|
10 | 10 | (function(process) { |
11 | 11 |
|
12 | 12 | function startup() { |
13 | | - var EventEmitter = NativeModule.require('events'); |
| 13 | + const EventEmitter = NativeModule.require('events'); |
14 | 14 | process._eventsCount = 0; |
15 | 15 |
|
16 | 16 | Object.setPrototypeOf(process, Object.create(EventEmitter.prototype, { |
|
92 | 92 | // channel. This needs to be done before any user code gets executed |
93 | 93 | // (including preload modules). |
94 | 94 | if (process.argv[1] && process.env.NODE_UNIQUE_ID) { |
95 | | - var cluster = NativeModule.require('cluster'); |
| 95 | + const cluster = NativeModule.require('cluster'); |
96 | 96 | cluster._setupWorker(); |
97 | 97 |
|
98 | 98 | // Make sure it's not accidentally inherited by child processes. |
|
111 | 111 | }); |
112 | 112 | } else if (process.argv[1]) { |
113 | 113 | // make process.argv[1] into a full path |
114 | | - var path = NativeModule.require('path'); |
| 114 | + const path = NativeModule.require('path'); |
115 | 115 | process.argv[1] = path.resolve(process.argv[1]); |
116 | 116 |
|
117 | | - var Module = NativeModule.require('module'); |
| 117 | + const Module = NativeModule.require('module'); |
118 | 118 |
|
119 | 119 | // check if user passed `-c` or `--check` arguments to Node. |
120 | 120 | if (process._syntax_check_only != null) { |
121 | | - var vm = NativeModule.require('vm'); |
122 | | - var fs = NativeModule.require('fs'); |
123 | | - var internalModule = NativeModule.require('internal/module'); |
| 121 | + const vm = NativeModule.require('vm'); |
| 122 | + const fs = NativeModule.require('fs'); |
| 123 | + const internalModule = NativeModule.require('internal/module'); |
124 | 124 | // read the source |
125 | | - var filename = Module._resolveFilename(process.argv[1]); |
| 125 | + const filename = Module._resolveFilename(process.argv[1]); |
126 | 126 | var source = fs.readFileSync(filename, 'utf-8'); |
127 | 127 | // remove shebang and BOM |
128 | 128 | source = internalModule.stripBOM(source.replace(/^\#\!.*/, '')); |
|
140 | 140 | // If -i or --interactive were passed, or stdin is a TTY. |
141 | 141 | if (process._forceRepl || NativeModule.require('tty').isatty(0)) { |
142 | 142 | // REPL |
143 | | - var cliRepl = NativeModule.require('internal/repl'); |
| 143 | + const cliRepl = NativeModule.require('internal/repl'); |
144 | 144 | cliRepl.createInternalRepl(process.env, function(err, repl) { |
145 | 145 | if (err) { |
146 | 146 | throw err; |
|
254 | 254 | wrapConsoleCall) { |
255 | 255 | if (!inspectorConsole) |
256 | 256 | return; |
257 | | - var config = {}; |
| 257 | + const config = {}; |
258 | 258 | for (const key of Object.keys(console)) { |
259 | 259 | if (!inspectorConsole.hasOwnProperty(key)) |
260 | 260 | continue; |
|
374 | 374 | // V8 debug object about a connection, and runMain when |
375 | 375 | // that occurs. --isaacs |
376 | 376 |
|
377 | | - var debugTimeout = +process.env.NODE_DEBUG_TIMEOUT || 50; |
| 377 | + const debugTimeout = +process.env.NODE_DEBUG_TIMEOUT || 50; |
378 | 378 | setTimeout(entryFunction, debugTimeout); |
379 | 379 |
|
380 | 380 | } else { |
|
387 | 387 | // core modules found in lib/*.js. All core modules are compiled into the |
388 | 388 | // node binary, so they can be loaded faster. |
389 | 389 |
|
390 | | - var ContextifyScript = process.binding('contextify').ContextifyScript; |
| 390 | + const ContextifyScript = process.binding('contextify').ContextifyScript; |
391 | 391 | function runInThisContext(code, options) { |
392 | | - var script = new ContextifyScript(code, options); |
| 392 | + const script = new ContextifyScript(code, options); |
393 | 393 | return script.runInThisContext(); |
394 | 394 | } |
395 | 395 |
|
|
409 | 409 | return NativeModule; |
410 | 410 | } |
411 | 411 |
|
412 | | - var cached = NativeModule.getCached(id); |
| 412 | + const cached = NativeModule.getCached(id); |
413 | 413 | if (cached && (cached.loaded || cached.loading)) { |
414 | 414 | return cached.exports; |
415 | 415 | } |
|
420 | 420 |
|
421 | 421 | process.moduleLoadList.push(`NativeModule ${id}`); |
422 | 422 |
|
423 | | - var nativeModule = new NativeModule(id); |
| 423 | + const nativeModule = new NativeModule(id); |
424 | 424 |
|
425 | 425 | nativeModule.cache(); |
426 | 426 | nativeModule.compile(); |
|
477 | 477 | this.loading = true; |
478 | 478 |
|
479 | 479 | try { |
480 | | - var fn = runInThisContext(source, { |
| 480 | + const fn = runInThisContext(source, { |
481 | 481 | filename: this.filename, |
482 | 482 | lineOffset: 0, |
483 | 483 | displayErrors: true |
|
0 commit comments