Compile the CoffeeScript file with the given filename to JavaScript. Returns the compiled
 code as a string. Returns failing test JavaScript if CoffeeScript support is not installed.
 Also adds a failing test on compilation failure.
962594
def compile_coffeescript(file)
      begin
        require 'coffee-script'
      rescue LoadError
        $stderr.puts <<-ERROR_MSG
You must install an additional gem to use CoffeeScript source or test files.
Run the following command (with sudo if necessary): gem install coffee-script
        ERROR_MSG

        return <<-ERROR_MSG_SCRIPT
module('CoffeeScript');
test('coffee-script gem must be installed to compile this file: #{file}', function() {
  ok(false, 'Install CoffeeScript support with `gem install coffee-script`')
});
        ERROR_MSG_SCRIPT
      end

      previously_compiled_file = compiled_coffeescript_files[file]
      if previously_compiled_file && File.mtime(file) < File.mtime(previously_compiled_file.path)
        return File.read previously_compiled_file.path
      end

      compiled_js_file = Tempfile.new(["compiled_#{File.basename(file).gsub('.', '_')}", '.js'])

      begin
        contents = CoffeeScript.compile(File.read(file))
      rescue => e
        return <<-COMPILATION_ERROR_SCRIPT
module('CoffeeScript');
test('CoffeeScript compilation error', function() {
  ok(false, "#{e.message.gsub('"', '\"')}")
});
        COMPILATION_ERROR_SCRIPT
      end

      compiled_js_file.write contents
      compiled_js_file.close

      compiled_coffeescript_files[file] = compiled_js_file

      contents
    end
485912
function isJsFile(file) {
    "use strict";
    var ext = fileExt(file);
    var valid = Object.keys(require.extensions).map(function(val) {
        return val.replace(/^\./, '');
    }).filter(function(ext) {
        return ext === 'js' || ext === 'coffee';
    });
    return isString(ext, "string") && valid.indexOf(ext) !== -1;
}
524973
def _compile(self, source, filename):
        
        if filename == '<template>':
            # make a better filename
            filename = 'dbt-{}'.format(
                codecs.encode(os.urandom(12), 'hex').decode('ascii')
            )
            # encode, though I don't think this matters
            filename = jinja2._compat.encode_filename(filename)
            # put ourselves in the cache
            linecache.cache[filename] = (
                len(source),
                None,
                [line + '\n' for line in source.splitlines()],
                filename
            )

        return super(MacroFuzzEnvironment, self)._compile(source, filename)
686596
function () {
            var value = this.value;
            var options = this.engine.options;

            if (!value
                || (options.strip && /^\s*$/.test(value))
            ) {
                return '';
            }

            return compileVariable(value, this.engine, 1);
        }
105025
def build_and_run_file(filename):
    ''' 
    '''
    (directory, name, extension) = get_file_tuple(filename)
    if extension == 'c':
        print(" = = = = = = ", YELLOW, "GCC: Compiling " + filename + " file", \
              RESET, " = = = = = =\n")
        compiler = Compiler(filename)
        out = compiler.compile()
        if out != 0:
            print('Error while compiling. Code:', out, 'Please retry.')
            return out
        print("")

        out = compiler.run()
        return out

    elif extension == 'cpp':
        print(" = = = = = = ", YELLOW, "GPP: Compiling " + filename + " file", \
              RESET, " = = = = = =\n")
        compiler = Compiler(filename)
        out = compiler.compile()
        if out != 0:
            print('Error while compiling. Code:', out, 'Please retry.')
            return out
        print("")

        out = compiler.run()
        return out

    elif extension == 'py':
        print(" = = = = = = ", YELLOW, "PYTHON: Executing " + filename + " file", \
              RESET, " = = = = = =\n")
        compiler = Compiler(filename)
        out = compiler.run()
        return out
    elif extension == 'java':
        command = EXECUTABLE_JAVAC + ' ' + filename
        perform_system_command(command)
        command_run = EXECUTABLE_JAVA + ' ' + name
        test_file = directory + "/" + name + ".input"
        if os.path.exists(test_file):
            command_run += " < " + test_file
        return perform_system_command(command_run)
    else:
        print("Language yet not supported")
        return -1
742926
function compileFile(srcFullPath, saveOutFullPath, onlyCopy) {
  var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};

  var content = fs.readFileSync(srcFullPath, 'utf8');

  //when get file content empty, maybe file is locked
  if (!content) {
    return;
  }

  // only copy file content
  if (onlyCopy) {
    fse.copySync(srcFullPath, saveOutFullPath);
    return;
  }

  try {
    var startTime = Date.now();

    var data = compileByBabel(content, {
      filename: srcFullPath
      // sourceMaps: true,
      // sourceFileName: relativePath
    });

    var endTime = Date.now();

    if (options.debug) {
      console.log('Compile file ' + srcFullPath, 'Babel cost ' + (endTime - startTime) + ' ms');
    }

    // save file
    fse.outputFileSync(saveOutFullPath, data.code);

    return true;
  } catch (e) {
    console.error('compile file ' + srcFullPath + ' error', e);
  }

  return false;
}
611028
async function compile(remoteName){

    // run the lua compiler/interpreter to cache the file as bytecode
    const {response} = await _virtualTerminal.executeCommand(_luaCommandBuilder.prepare('compile', [remoteName]));
    return response;
}
501948
public Script build(File f) throws ScriptBuilderException {
        int k = f.getAbsolutePath().hashCode();
        if (dates.containsKey(k) && dates.get(k) == f.lastModified() && cache.containsKey(f.getPath())) {
            LOGGER.debug("get '" + f.getName() + "' from the cache");
            return cache.get(f.getPath());
        }

        LOGGER.debug(f.getName() + " is built from the file");
        dates.put(k, f.lastModified());
        String name = f.getName();
        try {
            Script v = build(new ANTLRFileStream(f.getAbsolutePath()));
            if (!name.equals(v.getlocalName() + Script.EXTENSION)) {
                throw new ScriptBuilderException("Script '" + v.getlocalName()
                        + "' must be declared in a file named '" + v.getlocalName() + Script.EXTENSION);
            }
            cache.put(f.getPath(), v);
            return v;
        } catch (IOException e) {
            throw new ScriptBuilderException(e.getMessage(), e);
        }

    }
341524
function compile(code, filename, options) {
  options = defaults(options || {}, {
    embedSourceMaps: true,
    bareModule: false,
    color: false
  });
  if (arguments.length !== compile.length) {
    throw new Error("incorrect argument count to compile");
  }
  var result = parse(ensureNewline(code));
  if (!result.status) {
    var expectations = uniq(result.expected);
    var data = "expected one of " + expectations.join(", ");
    var index = Math.min(result.index, code.length - 1);
    var oopsyInput = {index: index, data: data};
    var oopsies =
      OopsyData.fromIndices(code, [oopsyInput], {color: options.color});
    return {
      parsed: false,
      result: {
        expectations: expectations,
        oopsy: oopsies[0]
      }
    };
  }
  var squiggleAst = result.value;
  squiggleAst.bareModule = options.bareModule;
  var warnings = lint(squiggleAst);
  var contextualWarnings =
    OopsyData.fromLocations(code, warnings, {color: options.color});
  var esAst = transformAst(squiggleAst);
  var mangledAst = SHOULD_MANGLE ?
    esmangle.optimize(esAst) :
    esAst;
  var optimizedAst = SHOULD_OPTIMIZE ?
    optimize(mangledAst) :
    mangledAst;
  var stuff = generateCodeAndSourceMap(
    optimizedAst, filename, code);
  var js = ensureNewline(stuff.code);
  var sourceMap = stuff.map.toString();
  if (options.embedSourceMaps) {
    js = addSourceMapUrl(js, sourceMap);
  }
  return {
    parsed: true,
    warnings: contextualWarnings,
    sourceMap: sourceMap,
    code: js
  };
}
309164
function compile(source_file_path) {
    let pathParsed = path.parse(source_file_path);
    let nameParsed = path.parse(pathParsed.name);

    if (nameParsed.ext == '.module') {
      return Promise.reject({
        message: 'Modules are not supposed to be loaded'
      });
    }

    var str = fs.readFileSync(source_file_path, {
      encoding: 'utf8'
    });

    return getCompiler(str, source_file_path).render();
  }
421666
public static CompiledScript compile(String script) throws ScriptRuntimeException {
		try {
			return compile(getJavaScriptEngine(), script);
		} catch (ScriptException e) {
			throw new ScriptRuntimeException(e);
		}
	}
426563
function gnodeJsExtensionCompiler (module, filename) {
  var content = fs.readFileSync(filename, 'utf8');

  // remove the Byte Order Marker if present
  content = stripBOM(content);

  // strip away the shebang if present
  content = stripShebang(content);

  if (genFunExp.test(content) && !isValid(content)) {
    // compile JS via facebook/regenerator
    content = regenerator.compile(content, {
      includeRuntime: 'object' !== typeof regeneratorRuntime
    }).code;
  }

  module._compile(content, filename);
}
773858
def precompile(self, content, kind=None, elem=None, filename=None,
               charset=None, **kwargs):
    
    if not kind:
        return False, content
    attrs = self.parser.elem_attribs(elem)
    mimetype = attrs.get("type", None)
    if mimetype is None:
        return False, content

    filter_or_command = self.precompiler_mimetypes.get(mimetype)
    if filter_or_command is None:
        if mimetype in ("text/css", "text/javascript"):
            return False, content
        raise CompressorError("Couldn't find any precompiler in "
                              "COMPRESS_PRECOMPILERS setting for "
                              "mimetype '%s'." % mimetype)

    mod_name, cls_name = get_mod_func(filter_or_command)
    try:
        mod = import_module(mod_name)
    except (ImportError, TypeError):
        filter = CachedCompilerFilter(
            content=content, filter_type=self.type, filename=filename,
            charset=charset, command=filter_or_command, mimetype=mimetype)
        return True, filter.input(**kwargs)
    try:
        precompiler_class = getattr(mod, cls_name)
    except AttributeError:
        raise FilterDoesNotExist('Could not find "%s".' % filter_or_command)
    filter = precompiler_class(
        content, attrs=attrs, filter_type=self.type, charset=charset,
        filename=filename, **kwargs)
    return True, filter.input(**kwargs)
972794
function(filename) {
        var filepath = options.cwd + filename;
        var template = readTemplateFile({ src: [ filepath ] });
        return grunt.template.process(template, options);
      }
674730
public function _compile(&$view=NULL, $view_var='script_foot', $script_tags=TRUE) {
		// Components UI
		$ui=$this->ui();
		if ($this->ui()!=NULL) {
			if ($ui->isAutoCompile()) {
				$ui->compile(true);
			}
		}

		// Components BS
		$bootstrap=$this->bootstrap();
		if ($this->bootstrap()!=NULL) {
			if ($bootstrap->isAutoCompile()) {
				$bootstrap->compile(true);
			}
		}

		// Components Semantic
		$semantic=$this->semantic();
		if ($semantic!=NULL) {
			if ($semantic->isAutoCompile()) {
				$semantic->compile(true);
			}
		}

		// External references
		$external_scripts=implode('', $this->jquery_code_for_load);
		extract(array (
				'library_src' => $external_scripts
		));

		if (count($this->jquery_code_for_compile)==0) {
			// no inline references, let's just return
			return;
		}

		// Inline references
		$script='$(document).ready(function() {'."\n";
		$script.=implode('', $this->jquery_code_for_compile);
		$script.='});';

		$this->jquery_code_for_compile=array();
		if($this->params["debug"]==false){
			$script=$this->minify($script);
		}
		$output=($script_tags===FALSE) ? $script : $this->inline($script);

		if ($view!==NULL){
			$this->jsUtils->createScriptVariable($view,$view_var, $output);
		}
		return $output;
	}
578415
function compile(content, data) {
    return content.replace(/\${(\w+)}/gi, function (match, name) {
        return data[name] ? data[name] : '';
    });
}
1016257
function compile (extension, content, options, fn) {
    // allow optional options argument
    if (_.isFunction(options)) {
      fn = options;
      options = {};
    }

    var config = _.clone(compile.configuration)
      , args = flags.slice(0)
      , buffer = ''
      , errors = ''
      , compressor;

    if (compile.configuration.type) {
      config.type = extension;
    }

    // generate the --key value options, both the key and the value should added
    // seperately to the `args` array or the child_process will chocke.
    Object.keys(config).filter(function filter (option) {
      return config[option];
    }).forEach(function format (option) {
      var bool = _.isBoolean(config[option]);

      if (!bool || config[option]) {
        args.push('--' + option);
        if (!bool) args.push(config[option]);
      }
    });

    // apply the configuration
    _.extend(config, options);

    // spawn the shit and set the correct encoding
    compressor = spawn(type, args);
    compressor.stdout.setEncoding('utf8');
    compressor.stderr.setEncoding('utf8');

    /**
     * Buffer up the results so we can concat them once the compression is
     * finished.
     *
     * @param {Buffer} chunk
     * @api private
     */

    compressor.stdout.on('data', function data (chunk) {
      buffer += chunk;
    });

    compressor.stderr.on('data', function data (err) {
      errors += err;
    });

    /**
     * The compressor has finished can we now process the data and see if it was
     * a success.
     *
     * @param {Number} code
     * @api private
     */

    compressor.on('close', function close (code) {
      // invalid states
      if (errors.length) return fn(new Error(errors));
      if (code !== 0) return fn(new Error('process exited with code ' + code));
      if (!buffer.length) return fn(new Error('no data returned ' + type + args));

      // correctly processed the data
      fn(null, buffer);
    });

    // write out the content that needs to be minified
    compressor.stdin.end(content);
  }