Skip to content

Commit e14abfe

Browse files
leeightrvagg
authored andcommitted
lib: refactor setupInspector in bootstrap/node.js
`CJSModule` is not used in `setupGlobalConsole`, so we can move it to `setupInspector` and remove the argument from `setupInspector`. PR-URL: #24446 Reviewed-By: Ouyang Yadong <oyydoibh@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
1 parent 3bfa953 commit e14abfe

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/internal/bootstrap/node.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,6 @@
439439

440440
function setupGlobalConsole() {
441441
const originalConsole = global.console;
442-
const CJSModule = NativeModule.require('internal/modules/cjs/loader');
443442
// Setup Node.js global.console.
444443
const wrappedConsole = NativeModule.require('console');
445444
Object.defineProperty(global, 'console', {
@@ -448,7 +447,7 @@
448447
value: wrappedConsole,
449448
writable: true
450449
});
451-
setupInspector(originalConsole, wrappedConsole, CJSModule);
450+
setupInspector(originalConsole, wrappedConsole);
452451
}
453452

454453
function setupGlobalURL() {
@@ -521,10 +520,11 @@
521520
NativeModule.require('internal/domexception');
522521
}
523522

524-
function setupInspector(originalConsole, wrappedConsole, CJSModule) {
523+
function setupInspector(originalConsole, wrappedConsole) {
525524
if (!process.config.variables.v8_enable_inspector) {
526525
return;
527526
}
527+
const CJSModule = NativeModule.require('internal/modules/cjs/loader');
528528
const { addCommandLineAPI, consoleCall } = process.binding('inspector');
529529
// Setup inspector command line API.
530530
const { makeRequireFunction } =

0 commit comments

Comments
 (0)