From a4984e625ffeac8faa8ce4aa83f3f04d93b7a2f9 Mon Sep 17 00:00:00 2001
From: leeight <leeight@gmail.com>
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`.
---
 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 85bfc688b391c0..21544bceb463d1 100644
--- a/lib/internal/bootstrap/node.js
+++ b/lib/internal/bootstrap/node.js
@@ -439,7 +439,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', {
@@ -448,7 +447,7 @@
       value: wrappedConsole,
       writable: true
     });
-    setupInspector(originalConsole, wrappedConsole, CJSModule);
+    setupInspector(originalConsole, wrappedConsole);
   }
 
   function setupGlobalURL() {
@@ -521,10 +520,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 } =