compile assemblyscript to WebAssembly(wasm)
@param {string} source - assemblyscript string
@returns {Buffer} wasm stream as a Buffer
558584
function compile(source) {
    var module = assemblyscript_1.Compiler.compileString(source, {
        target: assemblyscript_1.CompilerTarget.WASM32,
        memoryModel: assemblyscript_1.CompilerMemoryModel.MALLOC,
        silent: true
    });
    var wasmFile;
    if (!module) {
        throw Error('compilation failed');
    }
    module.optimize();
    if (!module.validate()) {
        throw Error('validation failed');
    }
    wasmFile = module.emitBinary();
    module.dispose();
    return new Buffer(wasmFile);
}
790249
function compileSelectStar(query, aliases, joinstar) {
	var sp = '',
		ss = [],
		columnIds = {};

	aliases.forEach(function(alias) {
		// console.log(query.aliases[alias]);
		//	console.log(query,alias);
		// console.log(query.aliases[alias].tableid);
		//	console.log(42,631,alias);
		//	console.log(query.aliases);
		//	if(!alias) {
		//		sp += 'for(var k1 in p) var w=p[k1];for(var k2 in w){r[k2]=w[k2]};';
		//	} else 	{

		// TODO move this out of this function
		query.ixsources = {};
		query.sources.forEach(function(source) {
			query.ixsources[source.alias] = source;
		});

		// Fixed
		var columns;
		if (query.ixsources[alias]) {
			var columns = query.ixsources[alias].columns;
		}

		//		if(columns.length == 0 && query.aliases[alias].tableid) {
		//			var columns = alasql.databases[query.aliases[alias].databaseid].tables[query.aliases[alias].tableid].columns;
		//		};

		// Check if this is a Table or other
		if (joinstar && alasql.options.joinstar == 'json') {
			sp += "r['" + alias + "']={};";
		}

		if (columns && columns.length > 0) {
			columns.forEach(function(tcol) {
				if (joinstar && alasql.options.joinstar == 'underscore') {
					ss.push(
						"'" +
							alias +
							'_' +
							tcol.columnid +
							"':p['" +
							alias +
							"']['" +
							tcol.columnid +
							"']"
					);
				} else if (joinstar && alasql.options.joinstar == 'json') {
					//				ss.push('\''+alias+'_'+tcol.columnid+'\':p[\''+alias+'\'][\''+tcol.columnid+'\']');
					sp +=
						"r['" +
						alias +
						"']['" +
						tcol.columnid +
						"']=p['" +
						alias +
						"']['" +
						tcol.columnid +
						"'];";
				} else {
					var value = "p['" + alias + "']['" + tcol.columnid + "']";
					if (!columnIds[tcol.columnid]) {
						var key = "'" + tcol.columnid + "':";
						ss.push(key + value);
						columnIds[tcol.columnid] = {
							id: ss.length - 1,
							value: value,
							key: key,
						};
					} else {
						var newValue =
							value +
							' !== undefined ? ' +
							value +
							' : ' +
							columnIds[tcol.columnid].value;
						ss[columnIds[tcol.columnid].id] = columnIds[tcol.columnid].key + newValue;
						columnIds[tcol.columnid].value = newValue;
					}
				}

				query.selectColumns[escapeq(tcol.columnid)] = true;

				//			console.log('ok',tcol);

				var coldef = {
					columnid: tcol.columnid,
					dbtypeid: tcol.dbtypeid,
					dbsize: tcol.dbsize,
					dbprecision: tcol.dbprecision,
					dbenum: tcol.dbenum,
				};
				query.columns.push(coldef);
				query.xcolumns[coldef.columnid] = coldef;
			});
			//console.log(999,columns);
		} else {
			//					console.log(60,alias,columns);

			// if column not exist, then copy all
			sp += 'var w=p["' + alias + '"];for(var k in w){r[k]=w[k]};';
			//console.log(777, sp);
			query.dirtyColumns = true;
		}
		//	}
		//console.log(87,{s:ss.join(','),sp:sp});
	});

	return {s: ss.join(','), sp: sp};
}
163893
function compileSourcePreCode() {
    var $version = '##version##';

    var componentRenderers = {};

    function extend(target, source) {
        if (source) {
            Object.keys(source).forEach(function (key) {
                var value = source[key];
                if (typeof value !== 'undefined') {
                    target[key] = value;
                }
            });
        }

        return target;
    }

    function each(array, iterator) {
        if (array && array.length > 0) {
            for (var i = 0, l = array.length; i < l; i++) {
                if (iterator(array[i], i) === false) {
                    break;
                }
            }
        }
    }

    function contains(array, value) {
        var result;
        each(array, function (item) {
            result = item === value;
            return !result;
        });

        return result;
    }

    var HTML_ENTITY = {
        /* jshint ignore:start */
        '&': '&amp;',
        '<': '&lt;',
        '>': '&gt;',
        '"': '&quot;',
        /* eslint-disable quotes */
        "'": '&#39;'
        /* eslint-enable quotes */
        /* jshint ignore:end */
    };

    function htmlFilterReplacer(c) {
        return HTML_ENTITY[c];
    }

    function escapeHTML(source) {
        if (source == null) {
            return '';
        }

        if (typeof source === 'string') {
            return source ? source.replace(/[&<>"']/g, htmlFilterReplacer) : '';
        }

        return '' + source;
    }

    function _classFilter(source) {
        if (source instanceof Array) {
            return source.join(' ');
        }

        return source;
    }

    function _styleFilter(source) {
        if (typeof source === 'object') {
            var result = '';
            if (source) {
                Object.keys(source).forEach(function (key) {
                    result += key + ':' + source[key] + ';';
                });
            }

            return result;
        }

        return source;
    }

    function _xclassFilter(source) {
        if (source instanceof Array) {
            source = source.join(' ');
        }

        return source ? ' ' + source : '';
    }

    function _xstyleFilter(source) {
        var result;
        if (typeof source === 'object') {
            result = '';
            if (source) {
                Object.keys(source).forEach(function (key) {
                    result += key + ':' + source[key] + ';';
                });
            }
        }
        else {
            result = source;
        }

        return result ? ';' + result : '';
    }

    function attrFilter(name, value) {
        if (value) {
            return ' ' + name + '="' + value + '"';
        }

        return '';
    }

    function boolAttrFilter(name, value) {
        if (value && value !== 'false' && value !== '0') {
            return ' ' + name;
        }

        return '';
    }

    function callFilter(ctx, name, args) {
        var filter = ctx.proto.filters[name];
        if (typeof filter === 'function') {
            return filter.apply(ctx, args);
        }
    }
}
1363697
function compileFileSync(
  buildDir /*: string */,
  moduleType /*: BsModuleFormat | 'js' */,
  path /*: string */,
) /*: string */ {
  try {
    runBuildSync(buildDir)
  } catch (e) {
    throw utils.processBsbError(e.output.toString())
  }

  const res = readFileSync(path)
  return utils.transformSrc(moduleType, res.toString())
}
124917
private Program compile( Stack<IScriptPartId> scriptPartIdStack, String strCompiledSource, ISymbolTable symbolTable, Map<String, List<IFunctionSymbol>> dfsDeclByName, ITypeUsesMap typeUsesMap, Stack<BlockExpression> blocks, ContextInferenceManager ctxInferenceMgr) throws ParseResultsException
  {
    IGosuParser parser = GosuParserFactory.createParser(symbolTable, ScriptabilityModifiers.SCRIPTABLE);
    for( IScriptPartId id: scriptPartIdStack ) {
      ((GosuParser)parser).pushScriptPart( id );
    }
    parser.setScript( strCompiledSource );
    if(parser instanceof GosuParser) {
      parser.setDfsDeclInSetByName(dfsDeclByName);
      if (ctxInferenceMgr != null) {
        ((GosuParser) parser).setContextInferenceManager(ctxInferenceMgr);
      }
    }
    if (typeUsesMap == null) {
      typeUsesMap = parser.getTypeUsesMap();
    } else {
      parser.setTypeUsesMap(typeUsesMap);
    }
    if(_fqn != null) {
      typeUsesMap.addToTypeUses(GosuClassUtil.getPackage(_fqn) + ".*");
    }
    if( blocks != null )
    {
      ((GosuParser) parser).setBlocks( blocks );
    }
    if(_supertype != null && _supertype instanceof IGosuClassInternal ) {
      IGosuClassInternal supertype = (IGosuClassInternal) _supertype;
      addStaticSymbols(symbolTable, (GosuParser) parser, supertype);

      List<? extends GosuClassTypeLoader> typeLoaders = TypeSystem.getCurrentModule().getTypeLoaders(GosuClassTypeLoader.class);
      for (GosuClassTypeLoader typeLoader : typeLoaders) {
        List<? extends IGosuEnhancement> enhancementsForType = typeLoader.getEnhancementIndex().getEnhancementsForType(supertype);
        for (IGosuEnhancement enhancement : enhancementsForType) {
          if (enhancement instanceof IGosuEnhancementInternal) {
            addStaticSymbols(symbolTable, (GosuParser) parser, (IGosuEnhancementInternal) enhancement);
          }
        }
      }

      // clear out private DFS that may have made their way into the dfsDecldsByName (jove this is ugly)
      for (Entry<String, List<IFunctionSymbol>> dfsDecls : parser.getDfsDecls().entrySet()) {
        for (Iterator<IFunctionSymbol> it = dfsDecls.getValue().iterator(); it.hasNext(); ) {
          IFunctionSymbol fs = it.next();
          if (fs instanceof Symbol && fs.isPrivate()) {
            it.remove();
          }
        }
      }
    }
    IScriptPartId scriptPart;
    ISymbol thisSymbol = symbolTable.getSymbol( Keyword.KW_this.getName() );
    if( thisSymbol != null && thisSymbol.getType() instanceof IGosuClass )
    {
      scriptPart = new ScriptPartId( thisSymbol.getType(), GS_TEMPLATE_PARSED );
    }
    else
    {
      scriptPart = new TypelessScriptPartId( GS_TEMPLATE_PARSED );
    }
    Program program = (Program)parser.parseProgram( scriptPart, null, null, true );
    program.clearParseTreeInformation();
    return program;
  }
739084
function compile( src ) {
    var watch  = arguments.length <= 1 || arguments[1] === void 0 ? true : arguments[1];
    var parent = arguments.length <= 2 || arguments[2] === void 0 ? null : arguments[2];

    var script = new SourceScript( src, parent );

    if( watch ) {
        script.watch();
    }

    return script;
}
595419
function writeText(wasmModule, format, output, callback) {
  if (format === "linear" || format === "stack") {
    if (!assemblyscript.util.wabt) {
      process.stderr.write("\nwabt.js not found\n");
      return callback(EFAILURE);
    }
    var binary = wasmModule.ascCurrentBinary || (wasmModule.ascCurrentBinary = wasmModule.emitBinary()); // reuse
    output.write(assemblyscript.util.wasmToWast(binary, { readDebugNames: true }), "utf8", end);
  } else
    output.write(wasmModule.emitText(), "utf8", end);

  function end(err) {
    if (err || output === process.stdout) return callback(err);
    output.end(callback);
  }
}
251164
function transformCode(transformFn, script) {
  let source;
  if (script.url != null) {
    source = script.url;
  } else {
    source = 'Inline Babel script';
    inlineScriptCount++;
    if (inlineScriptCount > 1) {
      source += ' (' + inlineScriptCount + ')';
    }
  }

  return transformFn(
    script.content,
    {
      filename: source,
      ...buildBabelOptions(script),
    }
  ).code;
}
1145346
function webpackGetCodeOnDone (compiler, done) {
	if (!(compiler instanceof Compiler)) {
		throw new Error(`Expected compiler to be an instance of 'Compiler'`)
	}

	const outputFs = compiler.outputFileSystem
	const outputPath = compiler.outputPath

	installSourceMapSupport(outputFs)

	let compiledCode
	let error = false

	compiler.plugin('done', stats => {
		error = false
		// Server compilation errors need to be propagated to the client.
		if (stats.compilation.errors.length) {
			error = stats.compilation.errors[0]
			return
		}
		const filename = getFilename(stats, outputPath, 'main')
		const buffer = outputFs.readFileSync(filename)

		try {
			compiledCode = getCompiled(filename, buffer)
		} catch (ex) {
			error = ex
		}

		if (compiledCode) {
			done(compiledCode)
		} else {
			throw new Error(
				`webpack-get-code-on-done: Compiled code is 'undefined'. Please check latest changes that may produced this error. ${error}`
			)
		}
	})
}
1213285
def compile(source, options = {})
      source  = prepare_source(source)
      options = prepare_options(options)
      command = ["node", "--eval"]
      command.push compilation_snippet \
        method:    "compile#{ "Client" if options[:client] }",
        arguments: [source, options],
        locals:    options.fetch(:locals, {}),
        options:   options
      stdout, stderr, exit_status = Open3.capture3(*command)
      raise engine::CompilationError, stderr unless exit_status.success?
      process_result(source, stdout, options)
    end
606546
function compileSass() {
    let tasks = [];

    Object.keys(config).forEach((key) => {
        let val = config[key];
        tasks.push(gulp.src(val.src)
            .pipe(plumber({ errorHandler: handleErrors }))
            .pipe(sourcemaps.init())
            .pipe(sass(config.settings))
            .pipe(sourcemaps.write('./'))
            .pipe(gulp.dest(val.dest)));
    });

    return merge(tasks);
}
447257
private Result compile(File source, File target) throws ServiceException {
        AssetServices assetServices = ServiceLocator.getAssetServices();
        AssetInfo parser = assetServices.getAsset(NODE_PACKAGE + "/parser.js");
        if (parser == null)
            throw new ServiceException(ServiceException.NOT_FOUND, "Asset not found: " + parser);
        AssetInfo runner = assetServices.getAsset(NODE_PACKAGE + "/webpackRunner.js");
        if (runner == null)
            throw new ServiceException(ServiceException.NOT_FOUND, "Asset not found: " + runner);

        NodeJS nodeJS = NodeJS.createNodeJS();

        logger.info("Compiling " + source + " using NODE JS: " + nodeJS.getNodeVersion());
        V8Object fileObj = new V8Object(nodeJS.getRuntime()).add("file", runner.getFile().getAbsolutePath());
        JavaCallback callback = (receiver, parameters) -> fileObj;
        nodeJS.getRuntime().registerJavaMethod(callback, "getRunner");

        final Result parseResult = new Result();
        callback = (receiver, parameters) -> {
            V8Object resultObj = parameters.getObject(0);
            parseResult.status = resultObj.getString("status");
            parseResult.message = resultObj.getString("message");
            resultObj.release();
            return null;
        };
        nodeJS.getRuntime().registerJavaMethod(callback, "setParseResult");

        nodeJS.exec(parser.getFile());
        while (nodeJS.isRunning()) {
            nodeJS.handleMessage();
        }

        fileObj.release();
        nodeJS.release();

        if (!parseResult.status.equals("OK"))
            throw new ServiceException(runner + " -> " + parseResult);

        // run
        nodeJS = NodeJS.createNodeJS();
        V8Object inputObj = new V8Object(nodeJS.getRuntime());
        inputObj.add("source", source.getAbsolutePath());
        inputObj.add("root", assetServices.getAssetRoot().getAbsolutePath());
        inputObj.add("output", target.getAbsolutePath());
        inputObj.add("debug", logger.isDebugEnabled());
        inputObj.add("devMode", isDevMode());
        callback = (receiver, parameters) -> inputObj;
        nodeJS.getRuntime().registerJavaMethod(callback, "getInput");

        final Result webpackResult = new Result();
        callback = (receiver, parameters) -> {
            V8Object resultObj = parameters.getObject(0);
            webpackResult.status = resultObj.getString("status");
            webpackResult.message = resultObj.getString("message");
            resultObj.release();
            return null;
        };
        nodeJS.getRuntime().registerJavaMethod(callback, "setWebpackResult");

        nodeJS.exec(runner.getFile());
        while (nodeJS.isRunning()) {
            nodeJS.handleMessage();
        }
        inputObj.release();
        nodeJS.release();

        if (!webpackResult.status.equals("OK"))
            throw new ServiceException(source + " -> " + webpackResult);

        return webpackResult;
    }
905894
async function compile(exitOnError = true) {
  config = config || (await asyncConfig());
  const startMessage = chalk.blue('Compiling Static Site...');
  const startTime = timer.start();
  let spinner;
  if (config.verbosity > 2) {
    console.log(startMessage);
  } else {
    spinner = ora(startMessage).start();
  }

  const pages = await getPages(config.srcDir);

  const renderPages = pages.map(async page => {
    const site = await getSiteData(pages);

    const layout = page.meta.layout ? page.meta.layout : 'default';
    const { ok, html, message } = await render(`@bolt/${layout}.twig`, {
      page,
      site,
    });

    if (!ok) {
      if (exitOnError) {
        log.errorAndExit(message);
      } else {
        log.error(message);
      }
    }

    const htmlFilePath = path.join(config.wwwDir, page.url);
    await mkdirp(path.dirname(htmlFilePath));
    await writeFile(htmlFilePath, html);
    if (config.verbosity > 3) {
      log.dim(`Wrote: ${htmlFilePath}`);
    }

    return true;
  });

  Promise.all(renderPages)
    .then(() => {
      const endMessage = chalk.green(
        `Compiled Static Site in ${timer.end(startTime)}`,
      );
      if (config.verbosity > 2) {
        console.log(endMessage);
      } else {
        spinner.succeed(endMessage);
      }
    })
    .catch(error => {
      console.log(error);
      const endMessage = chalk.red(
        `Compiling Static Site failed in ${timer.end(startTime)}`,
      );
      spinner.fail(endMessage);
    });
}
1014113
private void compile(AssetInfo asset, File source, File target) throws ServiceException {
        File watched = watchedAssets.get(asset);
        if (watched == null) {
            if (isDevMode()) {
                new Thread(() -> {
                    try {
                        // avoid recursive compiles
                        if (isDevMode())
                            watchedAssets.put(asset, target);
                        doCompile(asset, source, target);
                    }
                    catch (Exception ex) {
                        logger.severeException(ex.getMessage(), ex);
                    }
                }).start();
            }
            else {
                doCompile(asset, source, target);
            }
        }
    }
1289331
function Compile(input, options, callback) {

    var output = Path.join(options.cwd, Path.basename(input).slice(0, -4));

    if (options.precompiled) {
        callback(null, output);
    } else {
        CheckCobc(function (exists) {
            if (!exists) {
                return callback(new Error("Couldn't find the cobc executable in the PATH. Make sure you installed Open Cobol."));
            }

            var args = {
                x: true,
                _: input
            };
            Object.assign(args, options.compileargs);

            Exec(OArgv(args, "cobc"), {
                cwd: options.cwd
            }, function (err, stdout, stderr) {
                if (stderr || err) {
                    return callback(stderr || err);
                }
                callback(null, output);
            });
        });
    }
}
1356894
function compileCss(src, dest) {
  gulp
    .src(src)
    .pipe(plumber(config.plumberOptions))
    .pipe(gulpif(!config.production, sourcemaps.init()))
    .pipe(sass({
      outputStyle: config.production ? 'compressed' : 'expanded',
      precision: 5
    }))
    .pipe(postcss(processors))
    .pipe(gulpif(config.production, rename({
      suffix: '.min',
      extname: '.css'
    })))
    .pipe(gulpif(!config.production, sourcemaps.write()))
    .pipe(gulp.dest(dest));
}
853773
function buildJS(src, filename, dest, applyHeader, forceIncludePaths) {
  dest = dest || config.dist.jsPath;
  applyHeader = applyHeader || false;
  forceIncludePaths = forceIncludePaths || false;

  return gulp.src(src)
    .pipe(gulpif(
      forceIncludePaths,
      include({
        includePaths: [
          path.dirname(src),
          __dirname,
          config.packagesPath
        ]
      }),
      include()
    ))
    .on('error', console.log) // eslint-disable-line no-console
    .pipe(babel())
    .pipe(uglify({
      output: {
        // try to preserve non-standard headers (e.g. from objectFitPolyfill)
        comments: /^(!|---)/
      }
    }))
    .pipe(gulpif(applyHeader, header(config.prj.header, {
      config: config
    })))
    .pipe(rename(filename))
    .pipe(gulp.dest(dest));
}