Skip to content

Commit 6bd055f

Browse files
leeightcodebytere
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 <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Daniel Bevenius <[email protected]>
1 parent 164069c commit 6bd055f

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
@@ -403,7 +403,6 @@
403403

404404
function setupGlobalConsole() {
405405
const originalConsole = global.console;
406-
const CJSModule = NativeModule.require('internal/modules/cjs/loader');
407406
// Setup Node.js global.console.
408407
const wrappedConsole = NativeModule.require('console');
409408
Object.defineProperty(global, 'console', {
@@ -412,7 +411,7 @@
412411
value: wrappedConsole,
413412
writable: true
414413
});
415-
setupInspector(originalConsole, wrappedConsole, CJSModule);
414+
setupInspector(originalConsole, wrappedConsole);
416415
}
417416

418417
function setupGlobalURL() {
@@ -438,10 +437,11 @@
438437
NativeModule.require('internal/domexception');
439438
}
440439

441-
function setupInspector(originalConsole, wrappedConsole, CJSModule) {
440+
function setupInspector(originalConsole, wrappedConsole) {
442441
if (!process.config.variables.v8_enable_inspector) {
443442
return;
444443
}
444+
const CJSModule = NativeModule.require('internal/modules/cjs/loader');
445445
const { addCommandLineAPI, consoleCall } = process.binding('inspector');
446446
// Setup inspector command line API.
447447
const { makeRequireFunction } =

0 commit comments

Comments
 (0)