-
Notifications
You must be signed in to change notification settings - Fork 0
/
Deer.js
52 lines (50 loc) · 1.19 KB
/
Deer.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
const {
loader,
process,
console,
} = No.buildin;
function loaderNativeModule() {
const modules = [
{
module: 'libs/module/index.js',
name: 'module'
},
{
module: 'libs/events/index.js',
name: 'events'
},
{
module: 'libs/process/index.js',
name: 'process'
},
{
module: 'libs/buffer/index.js',
name: 'buffer',
after: (exports) => {
global.Buffer = exports;
}
},
{
module: 'libs/tcp/index.js',
name: 'tcp'
},
{
module: 'libs/http/index.js',
name: 'http'
},
];
No.libs = {};
for (let i = 0; i < modules.length; i++) {
const module = {
exports: {},
};
loader.compile(modules[i].module).call(null, loader.compile, module.exports, module);
No.libs[modules[i].name] = module.exports;
typeof modules[i].after === 'function' && modules[i].after(module.exports);
}
}
function runMain() {
No.libs.module.load(process.argv[1]);
}
loaderNativeModule();
runMain();