-
Notifications
You must be signed in to change notification settings - Fork 2
/
nodemain.js
64 lines (59 loc) · 1.87 KB
/
nodemain.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Main module for node compatibility. Makes our AMD modules look like
// a standard node module.
var requirejs = require('requirejs');
requirejs.config({
nodeRequire: require,
baseUrl: __dirname,
deps:['./extensions']
});
// Set up some global context.
requirejs.define('timeouts', {
// Use node's own `setTimeout`/`clearTimeout` functions.
setTimeout: setTimeout,
clearTimeout: clearTimeout
});
// Define our language/library extensions (globally, alas).
requirejs('./extensions');
module.exports = Object.create(null);
// Things to export.
['parse', 'jcompile',
// Bytecode compiler-interpreter.
'bytecode-table', 'literal-map', 'bcompile', 'binterp', 'stdlib',
// Type analysis!
'banalyze',
// `asm.js` project.
'asm-llvm',
// FRS-style event system.
'events', 'eventtests',
// Top-level declarations suitable for compiling TurtleScript modules.
'top-level',
// A collection of interesting TurtleScript test cases.
'tests'
].forEach(function(m) {
module.exports[m.replace('-','_')] = requirejs('./'+m);
});
// Command-line utilities.
module.exports.write_rust_bytecode = function() {
// This module has side-effects when imported.
requirejs('./write-rust-bytecode');
};
module.exports.write_rust_ops = function() {
// This module has side-effects when imported.
requirejs('./write-rust-ops');
};
module.exports.write_php_bytecode = function() {
// This module has side-effects when imported.
requirejs('./write-php-bytecode');
};
module.exports.write_php_ops = function() {
// This module has side-effects when imported.
requirejs('./write-php-ops');
};
module.exports.write_lua_bytecode = function() {
// This module has side-effects when imported.
requirejs('./write-lua-bytecode');
};
module.exports.write_lua_ops = function() {
// This module has side-effects when imported.
requirejs('./write-lua-ops');
};