Generate TypeScript.
326633
async function run() {
  console.log(`\u{1f52c}  Searching for modules inside "${chalk.dim(SRC_DIR)}".`);
  const files = glob.sync('!(index)*.js', { cwd: SRC_DIR });
  const typings = files.map(file => createIconTyping(file));
  await Promise.all([...typings, createIndexTyping(files)]);
  console.log(`\u{1F5C4}  Written typings to ${chalk.dim(TARGET_DIR)}.`);
}
1339378
function generateController(path, modelName, modelFields, generateMethod, ts, cb) {
    var extension = (ts) ? 'ts' : 'js';
    var controller = ft.loadTemplateSync('controller.' + extension);

    var updateFields = '';
    var createFields = os.EOL;

    modelFields.forEach(function (f, index, fields) {
        var field = f.name;

        updateFields += modelName + '.' + field + ' = req.body.' + field + ' ? req.body.' + field + ' : ' +
            modelName + '.' + field + ';';
        updateFields += os.EOL + '\t\t\t';

        createFields += '\t\t\t' + field + ' : req.body.' + field;
        createFields += ((fields.length - 1) > index) ? ',' + os.EOL : '';
    });

    controller = controller.replace(/{modelName}/g, formatTools.capitalizeFirstLetter(modelName) + 'Model');
    controller = controller.replace(/{name}/g, modelName);
    controller = controller.replace(/{pluralName}/g, formatTools.pluralize(modelName));
    controller = controller.replace(/{controllerName}/g, modelName + 'Controller');
    controller = controller.replace(/{createFields}/g, createFields);
    controller = controller.replace(/{updateFields}/g, updateFields);

    if (generateMethod === 't') {
        ft.createDirIfIsNotDefined(path, 'controllers', function () {
            controller = controller.replace(/{modelPath}/g, '\'../models/' + modelName + 'Model.' + extension + '\'');
            ft.writeFile(path + '/controllers/' + modelName + 'Controller.' + extension, controller, null, cb);
        });
    } else {
        ft.createDirIfIsNotDefined(path, modelName, function () {
            controller = controller.replace(/{modelPath}/g, '\'./' + modelName + 'Model.' + extension + '\'');
            ft.writeFile(path + '/' + modelName + '/' + modelName + 'Controller.' + extension, controller, null, cb);
        });
    }
}
342206
function codegen(compiled, options) {
  const { code } = generate(t.file(t.program(compiled)), Object.assign({}, defaults, options));

  return code;
}
739732
def generate(env):
    """"""
    try:
        env['BUILDERS']['MSVSProject']
    except KeyError:
        env['BUILDERS']['MSVSProject'] = projectBuilder

    try:
        env['BUILDERS']['MSVSSolution']
    except KeyError:
        env['BUILDERS']['MSVSSolution'] = solutionBuilder

    env['MSVSPROJECTCOM'] = projectAction
    env['MSVSSOLUTIONCOM'] = solutionAction

    if SCons.Script.call_stack:
        # XXX Need to find a way to abstract this; the build engine
        # shouldn't depend on anything in SCons.Script.
        env['MSVSSCONSCRIPT'] = SCons.Script.call_stack[0].sconscript
    else:
        global default_MSVS_SConscript
        if default_MSVS_SConscript is None:
            default_MSVS_SConscript = env.File('SConstruct')
        env['MSVSSCONSCRIPT'] = default_MSVS_SConscript

    env['MSVSSCONS'] = '"%s" -c "%s"' % (python_executable, getExecScriptMain(env))
    env['MSVSSCONSFLAGS'] = '-C "${MSVSSCONSCRIPT.dir.get_abspath()}" -f ${MSVSSCONSCRIPT.name}'
    env['MSVSSCONSCOM'] = '$MSVSSCONS $MSVSSCONSFLAGS'
    env['MSVSBUILDCOM'] = '$MSVSSCONSCOM "$MSVSBUILDTARGET"'
    env['MSVSREBUILDCOM'] = '$MSVSSCONSCOM "$MSVSBUILDTARGET"'
    env['MSVSCLEANCOM'] = '$MSVSSCONSCOM -c "$MSVSBUILDTARGET"'

    # Set-up ms tools paths for default version
    msvc_setup_env_once(env)

    if 'MSVS_VERSION' in env:
        version_num, suite = msvs_parse_version(env['MSVS_VERSION'])
    else:
        (version_num, suite) = (7.0, None) # guess at a default
    if 'MSVS' not in env:
        env['MSVS'] = {}
    if (version_num < 7.0):
        env['MSVS']['PROJECTSUFFIX']  = '.dsp'
        env['MSVS']['SOLUTIONSUFFIX'] = '.dsw'
    elif (version_num < 10.0):
        env['MSVS']['PROJECTSUFFIX']  = '.vcproj'
        env['MSVS']['SOLUTIONSUFFIX'] = '.sln'
    else:
        env['MSVS']['PROJECTSUFFIX']  = '.vcxproj'
        env['MSVS']['SOLUTIONSUFFIX'] = '.sln'

    if (version_num >= 10.0):
        env['MSVSENCODING'] = 'utf-8'
    else:
        env['MSVSENCODING'] = 'Windows-1252'

    env['GET_MSVSPROJECTSUFFIX']  = GetMSVSProjectSuffix
    env['GET_MSVSSOLUTIONSUFFIX']  = GetMSVSSolutionSuffix
    env['MSVSPROJECTSUFFIX']  = '${GET_MSVSPROJECTSUFFIX}'
    env['MSVSSOLUTIONSUFFIX']  = '${GET_MSVSSOLUTIONSUFFIX}'
    env['SCONS_HOME'] = os.environ.get('SCONS_HOME')
361779
def generate(env):
    """"""

    env['MIDL']          = 'MIDL.EXE'
    env['MIDLFLAGS']     = SCons.Util.CLVar('/nologo')
    env['MIDLCOM']       = '$MIDL $MIDLFLAGS /tlb ${TARGETS[0]} /h ${TARGETS[1]} /iid ${TARGETS[2]} /proxy ${TARGETS[3]} /dlldata ${TARGETS[4]} $SOURCE 2> NUL'
    env['BUILDERS']['TypeLibrary'] = midl_builder
840458
function exportTypeScriptDeclarations (classes) {

    const file = './ccxt.d.ts'
    const regex = /(?:    export class [^\s]+ extends [^\s]+ \{\}[\r]?[\n])+/
    const replacement = Object.keys (classes).map (className => {
        const baseClass = classes[className]
        return '    export class ' + className + ' extends ' + baseClass + " {}"
    }).join ("\n") + "\n"

    replaceInFile (file, regex, replacement)
}
864271
def generate(env):
    """"""

    global TeXLaTeXAction
    if TeXLaTeXAction is None:
        TeXLaTeXAction = SCons.Action.Action(TeXLaTeXFunction,
                              strfunction=TeXLaTeXStrFunction)

    env.AppendUnique(LATEXSUFFIXES=SCons.Tool.LaTeXSuffixes)

    generate_common(env)

    from . import dvi
    dvi.generate(env)

    bld = env['BUILDERS']['DVI']
    bld.add_action('.tex', TeXLaTeXAction)
    bld.add_emitter('.tex', tex_eps_emitter)
1105753
function doc(pkgName, pkgVersion) {
    const typedoc = require("typedoc");
    const typescriptOptions = require(path.resolve("./build/tsconfig.es5-commonjs.json")).compilerOptions;
    const typedocOptions = require(path.resolve("./build/typedoc.js"));

    // Add version number to header of generated HTML documentation
    typedocOptions.name = pkgName + " v" + pkgVersion;

    const app = new typedoc.Application(Object.assign(typedocOptions, typescriptOptions));

    // A path to source files can only be specified on the command line, 
    // in the API we have to specify individual source files.
    // Note that the "exclude" option pattern is also not considered in API code.
    const srcFiles = [];
    getTypedocModuleSources(path.resolve(typedocOptions.src), srcFiles);
    getTypedocModuleSources(path.resolve(typedocOptions.src, "db/adapters/"), srcFiles);

    rimraf.sync(path.resolve("./" + typedocOptions.out));

    logInfo("Generate HTML documentation from source code...");
    const success = app.generateDocs(srcFiles, typedocOptions.out);
    if (!success) {
        logError("Failed to generate HTML documentation");
    }

    function getTypedocModuleSources(srcPath, srcFiles) {
        fse.readdirSync(srcPath).forEach((file, index) => {
            let filePath = path.join(srcPath, file);
            if (!fse.lstatSync(filePath).isDirectory()) {
                if (path.extname(filePath) === ".ts") {
                    srcFiles.push(filePath);
                }
            }
        });
    }
}
790380
def generate(self, api):
        """"""
        for namespace in api.namespaces.values():
            # One module per namespace is created. The module takes the name
            # of the namespace.
            with self.output_to_relative_path('{}.py'.format(namespace.name)):
                self._generate_namespace_module(namespace)
715585
function createAPIFiles(packageName, srcPath) {
    
    var config = path.join(srcPath, '/tsconfig.json');
    var output = path.join(destDir, packageName, 'api');
    var file = (packageName === "fast-animation") ? path.join(srcPath, '/lib/index.ts') : path.join(srcPath, '/src/index.ts');

    var typedocCmd = os.platform() == 'win32' ? 'typedoc.cmd' : 'typedoc';
    var typedocPath = path.join('node_modules', '.bin', typedocCmd);

    const typedoc = spawn(typedocPath, // the local TypeDoc installation is needed for the markdown theme to work
        [
            '--tsconfig', config,
            '--excludeNotExported',
            '--out', output, file,
            '--theme', "markdown"
        ]);

    typedoc.on('close', code => {
        if (code) {
            console.log(chalk.red(`${packageName} - TypeDoc API docs not generated, error code: ${code}`));
        } else {
            console.log(`${packageName} - TypeDoc API docs generated`)
            addHeaderToReadme(packageName);
            addAPILinkToReadme(packageName);
        }
    });

    // if set to true, will print detailed build output for typedoc process
    // useful for debugging
    if (verbose) {
        typedoc.stdout.on('data', (data) => {
            console.log(`${data}`);
        });
    }

    typedoc.on('error', (err) => {
        console.log(chalk.red(err));
    });

}
69821
function buildScripts() {
  return Promise.resolve()
    // Create the dist folder if it doesn't exist
    .then(() => {
      if(!FS.existsSync(Path.join(__dirname, 'dist'))) {
        return FS.mkdirAsync(Path.join(__dirname, 'dist'));
      }
    })

    // Generate minified scripts
    .then(() => new Promise((resolve, reject) => {
      let scripts = {
        'dropdowns.js': FS.readFileSync(Path.join(__dirname, 'source/js/dropdowns.js'), 'utf8'),
        'tabs.js': FS.readFileSync(Path.join(__dirname, 'source/js/tabs.js'), 'utf8')
      };

      let result = UglifyJS.minify(scripts, {
        output: {
          comments: /^!/
        }
      });
      if(result.error) {
        reject(result.error);
        return;
      }

      resolve(result.code);
    }))

    // Write minified scripts to dist
    .then((scripts) => {
      let file = Path.join(__dirname, 'dist/shoelace.js');

      // Update {{version}} in JS since it's not processed with Handlebars
      scripts = scripts.replace(/\{\{version\}\}/g, __version);

      // Output a message
      console.log(Chalk.green('JS processed: %s! 🐭'), Path.relative(__dirname, file));

      // Write output file
      return FS.writeFileAsync(file, scripts, 'utf8');
    });
}
730084
function generate() {
    // replace this with Object.entries when node > 8
    const allRules = requireIndex(path.resolve(__dirname, "../lib/rules"));

    const rules = Object.keys(allRules)
        .filter(key => !!allRules[key].meta.docs.recommended)
        .reduce((config, key) => {
            // having this here is just for output niceness (the keys will be ordered)
            if (bannedRecommendedRules.has(key)) {
                console.log(key.padEnd(MAX_RULE_NAME_LENGTH), "= off");
                config[key] = "off";
            }

            const ruleName = `typescript/${key}`;
            const setting = allRules[key].meta.docs.recommended;

            if (!["error", "warn"].includes(setting)) {
                console.log(`ERR! Invalid level for rule ${key}: "${setting}"`);
                // Don't want to throw an error since ^ explains what happened.
                // eslint-disable-next-line no-process-exit
                process.exit(1);
            }

            console.log(ruleName.padEnd(MAX_RULE_NAME_LENGTH), "=", setting);
            config[ruleName] = setting;

            return config;
        }, {});

    const filePath = path.resolve(__dirname, "../lib/configs/recommended.json");

    const recommendedConfig = {
        parser: "eslint-plugin-typescript/parser",
        parserOptions: {
            sourceType: "module",
        },
        plugins: ["typescript"],
        rules,
    };

    fs.writeFileSync(
        filePath,
        `${JSON.stringify(recommendedConfig, null, 4)}\n`
    );
}
1279377
function generateStyle( data, type ) {
			var content = "";
			var pattern = outputPattern[ type ];

			function resolveNested( data, parentKey ) {
				var name, key;
				for ( key in data ) {
					if ( data.hasOwnProperty( key ) ) {
						name = parentKey ? format( parentKey + "-" + key, options.cssFormat ) : format( key, options.cssFormat );

						if ( mout.lang.isObject( data[ key ] ) ) {

							resolveNested( data[ key ], name );

						} else {
							var converter = styleConverter[ type ] || getStyleSafeValue;
							var value = converter( data[ key ] );

							content += pattern.replace( "{{key}}", options.namespace + name ).replace( "{{value}}", value );
						}
					}
				}
			}

			resolveNested( data );

			return content;
		}
1141996
function generateComponentIndex() {
    function generateSource(list) {
        const requires = list
            .map(
                name =>
                    `  '${name}': require('./components/prism-${name}.js').default`
            )
            .join(',\n');
        return moduleExport(`{\n${requires}\n};\n`);
    }

    fs.writeFileSync('./src/all-components.js', generateSource(LIST));
    fs.writeFileSync(
        './src/common-components.js',
        generateSource(LIST.filter(isCommon))
    );
}
200884
function includeJsFiles() {
        if (cog.getOption('include_only_external')) {
            return extLibFiles().concat(generatedJsFiles());
        }
        if (cog.getOption('compile_typescript')) {
            return extLibFiles().concat(generatedJsFiles());
        }
        return extLibFiles().concat(srcFiles()).concat(generatedJsFiles());
    }
554059
public void generateMethodTypesScript(Map<String,Integer> typeMap,
            Set<MethodTypes> methodTypes) {
        String sep = "";
        StringBuilder vars = new StringBuilder("var methods = {");
        for (Map.Entry<String,Integer> entry : typeMap.entrySet()) {
            vars.append(sep);
            sep = ",";
            vars.append("\"")
                    .append(entry.getKey())
                    .append("\":")
                    .append(entry.getValue());
        }
        vars.append("};").append(DocletConstants.NL);
        sep = "";
        vars.append("var tabs = {");
        for (MethodTypes entry : methodTypes) {
            vars.append(sep);
            sep = ",";
            vars.append(entry.value())
                    .append(":")
                    .append("[")
                    .append("\"")
                    .append(entry.tabId())
                    .append("\"")
                    .append(sep)
                    .append("\"")
                    .append(configuration.getText(entry.resourceKey()))
                    .append("\"]");
        }
        vars.append("};")
                .append(DocletConstants.NL);
        addStyles(HtmlStyle.altColor, vars);
        addStyles(HtmlStyle.rowColor, vars);
        addStyles(HtmlStyle.tableTab, vars);
        addStyles(HtmlStyle.activeTableTab, vars);
        script.addContent(new RawHtml(vars.toString()));
    }
1123086
def generate(env):
    """"""
    for t in SCons.Tool.tool_list(env['PLATFORM'], env):
        SCons.Tool.Tool(t)(env)