From 6bd055f7de45bfaf470d55a100039d517c476a19 Mon Sep 17 00:00:00 2001 From: leeight Date: Sat, 17 Nov 2018 23:12:59 +0800 Subject: [PATCH] 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: https://github.com/nodejs/node/pull/24446 Reviewed-By: Ouyang Yadong Reviewed-By: James M Snell Reviewed-By: Daniel Bevenius --- lib/internal/bootstrap/node.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/internal/bootstrap/node.js b/lib/internal/bootstrap/node.js index 0ac0559000732b..885546c5d6f1ca 100644 --- a/lib/internal/bootstrap/node.js +++ b/lib/internal/bootstrap/node.js @@ -403,7 +403,6 @@ function setupGlobalConsole() { const originalConsole = global.console; - const CJSModule = NativeModule.require('internal/modules/cjs/loader'); // Setup Node.js global.console. const wrappedConsole = NativeModule.require('console'); Object.defineProperty(global, 'console', { @@ -412,7 +411,7 @@ value: wrappedConsole, writable: true }); - setupInspector(originalConsole, wrappedConsole, CJSModule); + setupInspector(originalConsole, wrappedConsole); } function setupGlobalURL() { @@ -438,10 +437,11 @@ NativeModule.require('internal/domexception'); } - function setupInspector(originalConsole, wrappedConsole, CJSModule) { + function setupInspector(originalConsole, wrappedConsole) { if (!process.config.variables.v8_enable_inspector) { return; } + const CJSModule = NativeModule.require('internal/modules/cjs/loader'); const { addCommandLineAPI, consoleCall } = process.binding('inspector'); // Setup inspector command line API. const { makeRequireFunction } =