How to use the coffee-script._compileFile function in coffee-script

To help you get started, we’ve selected a few coffee-script examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fishbar / jscoverage / lib / patch.js View on Github external
Module._extensions['.coffee'] = Module._extensions['.litcoffee'] = function (module, filename, status) {
      var CoffeeScript = require('coffee-script');
      var content = CoffeeScript._compileFile(filename, false);
      var tmpFuncBody;
      var injectFn = exports.getInjectFunctions();
      // trim first line when script is a shell script
      // content = content.replace(/^\#\![^\n]+\n/, '');
      if (status && status.flagjsc) {
        content = jscoverage.process(filename, content);
      }
      if (status && status.needinject) {
        tmpFuncBody = injectFunctionBody.toString().replace(/\$\$(\w+)\$\$/g, function (m0, m1) {
          return injectFunctions[m1];
        });
        tmpFuncBody = tmpFuncBody.split(/\n/);
        content += '\n' + tmpFuncBody.slice(1, tmpFuncBody.length - 1).join('\n');
      }
      module._compile(stripBOM(content), filename);
    };
github tediousjs / tedious / test / register-coffee.js View on Github external
require.extensions[".coffee"] = function(module, filename) {
    var answer = CoffeeScript._compileFile(filename, false);
    var result = babel.transform(answer, {
      filename: filename,
      sourceMap: "both",
      ast:       false
    });

    return module._compile(result.code, filename);
  };
}