2828const FS = require ( 'fs' ) ;
2929const Path = require ( 'path' ) ;
3030const Repl = require ( 'repl' ) ;
31- const util = require ( 'util' ) ;
3231const vm = require ( 'vm' ) ;
33- const fileURLToPath = require ( 'url' ) . fileURLToPath ;
32+ const { fileURLToPath } = require ( 'internal/ url' ) ;
3433
35- const debuglog = util . debuglog ( 'inspect' ) ;
34+ const { customInspectSymbol } = require ( 'internal/util' ) ;
35+ const { inspect : utilInspect } = require ( 'internal/util/inspect' ) ;
36+ const debuglog = require ( 'internal/util/debuglog' ) . debuglog ( 'inspect' ) ;
3637
3738const SHORTCUTS = {
3839 cont : 'c' ,
@@ -170,12 +171,12 @@ class RemoteObject {
170171 }
171172 }
172173
173- [ util . inspect . custom ] ( depth , opts ) {
174+ [ customInspectSymbol ] ( depth , opts ) {
174175 function formatProperty ( prop ) {
175176 switch ( prop . type ) {
176177 case 'string' :
177178 case 'undefined' :
178- return util . inspect ( prop . value , opts ) ;
179+ return utilInspect ( prop . value , opts ) ;
179180
180181 case 'number' :
181182 case 'boolean' :
@@ -184,7 +185,7 @@ class RemoteObject {
184185 case 'object' :
185186 case 'symbol' :
186187 if ( prop . subtype === 'date' ) {
187- return util . inspect ( new Date ( prop . value ) , opts ) ;
188+ return utilInspect ( new Date ( prop . value ) , opts ) ;
188189 }
189190 if ( prop . subtype === 'array' ) {
190191 return opts . stylize ( prop . value , 'special' ) ;
@@ -200,7 +201,7 @@ class RemoteObject {
200201 case 'number' :
201202 case 'string' :
202203 case 'undefined' :
203- return util . inspect ( this . value , opts ) ;
204+ return utilInspect ( this . value , opts ) ;
204205
205206 case 'symbol' :
206207 return opts . stylize ( this . description , 'special' ) ;
@@ -214,10 +215,10 @@ class RemoteObject {
214215 case 'object' :
215216 switch ( this . subtype ) {
216217 case 'date' :
217- return util . inspect ( new Date ( this . description ) , opts ) ;
218+ return utilInspect ( new Date ( this . description ) , opts ) ;
218219
219220 case 'null' :
220- return util . inspect ( null , opts ) ;
221+ return utilInspect ( null , opts ) ;
221222
222223 case 'regexp' :
223224 return opts . stylize ( this . description , 'regexp' ) ;
@@ -265,11 +266,11 @@ class ScopeSnapshot {
265266 this . completionGroup = properties . map ( ( prop ) => prop . name ) ;
266267 }
267268
268- [ util . inspect . custom ] ( depth , opts ) {
269+ [ customInspectSymbol ] ( depth , opts ) {
269270 const type = `${ this . type [ 0 ] . toUpperCase ( ) } ${ this . type . slice ( 1 ) } ` ;
270271 const name = this . name ? `<${ this . name } >` : '' ;
271272 const prefix = `${ type } ${ name } ` ;
272- return util . inspect ( this . properties , opts )
273+ return utilInspect ( this . properties , opts )
273274 . replace ( / ^ M a p / , prefix ) ;
274275 }
275276}
@@ -318,7 +319,7 @@ function createRepl(inspector) {
318319
319320 const INSPECT_OPTIONS = { colors : inspector . stdout . isTTY } ;
320321 function inspect ( value ) {
321- return util . inspect ( value , INSPECT_OPTIONS ) ;
322+ return utilInspect ( value , INSPECT_OPTIONS ) ;
322323 }
323324
324325 function print ( value , addNewline = true ) {
@@ -358,7 +359,7 @@ function createRepl(inspector) {
358359 function listScripts ( displayNatives = false ) {
359360 print ( formatScripts ( displayNatives ) ) ;
360361 }
361- listScripts [ util . inspect . custom ] = function listWithoutInternal ( ) {
362+ listScripts [ customInspectSymbol ] = function listWithoutInternal ( ) {
362363 return formatScripts ( ) ;
363364 } ;
364365
@@ -374,7 +375,7 @@ function createRepl(inspector) {
374375 return p ;
375376 }
376377
377- [ util . inspect . custom ] ( depth , { stylize } ) {
378+ [ customInspectSymbol ] ( depth , { stylize } ) {
378379 const { startTime, endTime } = this . data ;
379380 const MU = String . fromChar ( 956 ) ;
380381 return stylize ( `[Profile ${ endTime - startTime } ${ MU } s]` , 'special' ) ;
@@ -395,7 +396,7 @@ function createRepl(inspector) {
395396 this . delta = delta ;
396397 }
397398
398- [ util . inspect . custom ] ( depth , options ) {
399+ [ customInspectSymbol ] ( depth , options ) {
399400 const { scriptId, lineNumber, columnNumber, delta, scriptSource } = this ;
400401 const start = Math . max ( 1 , lineNumber - delta + 1 ) ;
401402 const end = lineNumber + delta + 1 ;
@@ -461,7 +462,7 @@ function createRepl(inspector) {
461462 }
462463
463464 class Backtrace extends Array {
464- [ util . inspect . custom ] ( ) {
465+ [ customInspectSymbol ] ( ) {
465466 return this . map ( ( callFrame , idx ) => {
466467 const {
467468 location : { scriptId, lineNumber, columnNumber } ,
0 commit comments