|
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, { |
|
104 | 104 | // channel. This needs to be done before any user code gets executed |
105 | 105 | // (including preload modules). |
106 | 106 | if (process.argv[1] && process.env.NODE_UNIQUE_ID) { |
107 | | - var cluster = NativeModule.require('cluster'); |
| 107 | + const cluster = NativeModule.require('cluster'); |
108 | 108 | cluster._setupWorker(); |
109 | 109 |
|
110 | 110 | // Make sure it's not accidentally inherited by child processes. |
|
123 | 123 | }); |
124 | 124 | } else if (process.argv[1]) { |
125 | 125 | // make process.argv[1] into a full path |
126 | | - var path = NativeModule.require('path'); |
| 126 | + const path = NativeModule.require('path'); |
127 | 127 | process.argv[1] = path.resolve(process.argv[1]); |
128 | 128 |
|
129 | | - var Module = NativeModule.require('module'); |
| 129 | + const Module = NativeModule.require('module'); |
130 | 130 |
|
131 | 131 | // check if user passed `-c` or `--check` arguments to Node. |
132 | 132 | if (process._syntax_check_only != null) { |
133 | | - var vm = NativeModule.require('vm'); |
134 | | - var fs = NativeModule.require('fs'); |
135 | | - var internalModule = NativeModule.require('internal/module'); |
| 133 | + const vm = NativeModule.require('vm'); |
| 134 | + const fs = NativeModule.require('fs'); |
| 135 | + const internalModule = NativeModule.require('internal/module'); |
136 | 136 | // read the source |
137 | | - var filename = Module._resolveFilename(process.argv[1]); |
| 137 | + const filename = Module._resolveFilename(process.argv[1]); |
138 | 138 | var source = fs.readFileSync(filename, 'utf-8'); |
139 | 139 | // remove shebang and BOM |
140 | 140 | source = internalModule.stripBOM(source.replace(/^\#\!.*/, '')); |
|
152 | 152 | // If -i or --interactive were passed, or stdin is a TTY. |
153 | 153 | if (process._forceRepl || NativeModule.require('tty').isatty(0)) { |
154 | 154 | // REPL |
155 | | - var cliRepl = NativeModule.require('internal/repl'); |
| 155 | + const cliRepl = NativeModule.require('internal/repl'); |
156 | 156 | cliRepl.createInternalRepl(process.env, function(err, repl) { |
157 | 157 | if (err) { |
158 | 158 | throw err; |
|
266 | 266 | wrapConsoleCall) { |
267 | 267 | if (!inspectorConsole) |
268 | 268 | return; |
269 | | - var config = {}; |
| 269 | + const config = {}; |
270 | 270 | for (const key of Object.keys(console)) { |
271 | 271 | if (!inspectorConsole.hasOwnProperty(key)) |
272 | 272 | continue; |
|
386 | 386 | // V8 debug object about a connection, and runMain when |
387 | 387 | // that occurs. --isaacs |
388 | 388 |
|
389 | | - var debugTimeout = +process.env.NODE_DEBUG_TIMEOUT || 50; |
| 389 | + const debugTimeout = +process.env.NODE_DEBUG_TIMEOUT || 50; |
390 | 390 | setTimeout(entryFunction, debugTimeout); |
391 | 391 |
|
392 | 392 | } else { |
|
399 | 399 | // core modules found in lib/*.js. All core modules are compiled into the |
400 | 400 | // node binary, so they can be loaded faster. |
401 | 401 |
|
402 | | - var ContextifyScript = process.binding('contextify').ContextifyScript; |
| 402 | + const ContextifyScript = process.binding('contextify').ContextifyScript; |
403 | 403 | function runInThisContext(code, options) { |
404 | | - var script = new ContextifyScript(code, options); |
| 404 | + const script = new ContextifyScript(code, options); |
405 | 405 | return script.runInThisContext(); |
406 | 406 | } |
407 | 407 |
|
|
421 | 421 | return NativeModule; |
422 | 422 | } |
423 | 423 |
|
424 | | - var cached = NativeModule.getCached(id); |
| 424 | + const cached = NativeModule.getCached(id); |
425 | 425 | if (cached && (cached.loaded || cached.loading)) { |
426 | 426 | return cached.exports; |
427 | 427 | } |
|
432 | 432 |
|
433 | 433 | process.moduleLoadList.push(`NativeModule ${id}`); |
434 | 434 |
|
435 | | - var nativeModule = new NativeModule(id); |
| 435 | + const nativeModule = new NativeModule(id); |
436 | 436 |
|
437 | 437 | nativeModule.cache(); |
438 | 438 | nativeModule.compile(); |
|
489 | 489 | this.loading = true; |
490 | 490 |
|
491 | 491 | try { |
492 | | - var fn = runInThisContext(source, { |
| 492 | + const fn = runInThisContext(source, { |
493 | 493 | filename: this.filename, |
494 | 494 | lineOffset: 0, |
495 | 495 | displayErrors: true |
|
0 commit comments