1 // Generated by CoffeeScript 1.8.0
3 var CoffeeScript, Module, binary, child_process, ext, findExtension, fork, helpers, loadFile, path, _i, _len, _ref;
5 CoffeeScript = require('./coffee-script');
7 child_process = require('child_process');
9 helpers = require('./helpers');
11 path = require('path');
13 loadFile = function(module, filename) {
15 answer = CoffeeScript._compileFile(filename, false);
16 return module._compile(answer, filename);
19 if (require.extensions) {
20 _ref = CoffeeScript.FILE_EXTENSIONS;
21 for (_i = 0, _len = _ref.length; _i < _len; _i++) {
23 require.extensions[ext] = loadFile;
25 Module = require('module');
26 findExtension = function(filename) {
27 var curExtension, extensions;
28 extensions = path.basename(filename).split('.');
29 if (extensions[0] === '') {
32 while (extensions.shift()) {
33 curExtension = '.' + extensions.join('.');
34 if (Module._extensions[curExtension]) {
40 Module.prototype.load = function(filename) {
42 this.filename = filename;
43 this.paths = Module._nodeModulePaths(path.dirname(filename));
44 extension = findExtension(filename);
45 Module._extensions[extension](this, filename);
46 return this.loaded = true;
51 fork = child_process.fork;
52 binary = require.resolve('../../bin/coffee');
53 child_process.fork = function(path, args, options) {
54 if (helpers.isCoffee(path)) {
55 if (!Array.isArray(args)) {
59 args = [path].concat(args);
62 return fork(path, args, options);