Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
100583 views
1
// Generated by CoffeeScript 1.9.1
2
var CoffeeScript, Module, binary, child_process, ext, findExtension, fork, helpers, i, len, loadFile, path, ref;
3
4
CoffeeScript = require('./coffee-react-script');
5
6
child_process = require('child_process');
7
8
helpers = require('./helpers');
9
10
path = require('path');
11
12
loadFile = function(module, filename) {
13
var answer;
14
answer = CoffeeScript._compileFile(filename, false);
15
return module._compile(answer, filename);
16
};
17
18
if (require.extensions) {
19
ref = CoffeeScript.FILE_EXTENSIONS;
20
for (i = 0, len = ref.length; i < len; i++) {
21
ext = ref[i];
22
require.extensions[ext] = loadFile;
23
}
24
Module = require('module');
25
findExtension = function(filename) {
26
var curExtension, extensions;
27
extensions = path.basename(filename).split('.');
28
if (extensions[0] === '') {
29
extensions.shift();
30
}
31
while (extensions.shift()) {
32
curExtension = '.' + extensions.join('.');
33
if (Module._extensions[curExtension]) {
34
return curExtension;
35
}
36
}
37
return '.js';
38
};
39
Module.prototype.load = function(filename) {
40
var extension;
41
this.filename = filename;
42
this.paths = Module._nodeModulePaths(path.dirname(filename));
43
extension = findExtension(filename);
44
Module._extensions[extension](this, filename);
45
return this.loaded = true;
46
};
47
}
48
49
if (child_process) {
50
fork = child_process.fork;
51
binary = require.resolve('../bin/cjsx');
52
child_process.fork = function(path, args, options) {
53
if (helpers.isCoffee(path)) {
54
if (!Array.isArray(args)) {
55
options = args || {};
56
args = [];
57
}
58
args = [path].concat(args);
59
path = binary;
60
}
61
return fork(path, args, options);
62
};
63
}
64
65