@@ -28,14 +28,15 @@ const {
2828 ReflectGetOwnPropertyDescriptor,
2929 ReflectOwnKeys,
3030 RegExpPrototypeExec,
31- RegExpPrototypeSymbolReplace,
3231 SafeMap,
33- SafePromiseAll,
32+ SafePromiseAllReturnArrayLike,
33+ SafePromiseAllReturnVoid,
3434 String,
3535 StringFromCharCode,
3636 StringPrototypeEndsWith,
3737 StringPrototypeIncludes,
3838 StringPrototypeRepeat,
39+ StringPrototypeReplaceAll,
3940 StringPrototypeSlice,
4041 StringPrototypeSplit,
4142 StringPrototypeStartsWith,
@@ -53,7 +54,7 @@ const Repl = require('repl');
5354const vm = require ( 'vm' ) ;
5455const { fileURLToPath } = require ( 'internal/url' ) ;
5556
56- const { customInspectSymbol } = require ( 'internal/util' ) ;
57+ const { customInspectSymbol, SideEffectFreeRegExpPrototypeSymbolReplace } = require ( 'internal/util' ) ;
5758const { inspect : utilInspect } = require ( 'internal/util/inspect' ) ;
5859const debuglog = require ( 'internal/util/debuglog' ) . debuglog ( 'inspect' ) ;
5960
@@ -121,7 +122,7 @@ const {
121122} = internalBinding ( 'builtins' ) ;
122123const NATIVES = internalBinding ( 'natives' ) ;
123124function isNativeUrl ( url ) {
124- url = RegExpPrototypeSymbolReplace ( / \. j s $ / , url , '' ) ;
125+ url = SideEffectFreeRegExpPrototypeSymbolReplace ( / \. j s $ / , url , '' ) ;
125126
126127 return StringPrototypeStartsWith ( url , 'node:internal/' ) ||
127128 ArrayPrototypeIncludes ( PUBLIC_BUILTINS , url ) ||
@@ -159,8 +160,8 @@ function markSourceColumn(sourceText, position, useColors) {
159160
160161 // Colourize char if stdout supports colours
161162 if ( useColors ) {
162- tail = RegExpPrototypeSymbolReplace ( / ( .+ ?) ( [ ^ \w ] | $ ) / , tail ,
163- '\u001b[32m$1\u001b[39m$2' ) ;
163+ tail = SideEffectFreeRegExpPrototypeSymbolReplace ( / ( .+ ?) ( [ ^ \w ] | $ ) / , tail ,
164+ '\u001b[32m$1\u001b[39m$2' ) ;
164165 }
165166
166167 // Return source line with coloured char at `position`
@@ -340,9 +341,9 @@ class ScopeSnapshot {
340341 StringPrototypeSlice ( this . type , 1 ) ;
341342 const name = this . name ? `<${ this . name } >` : '' ;
342343 const prefix = `${ type } ${ name } ` ;
343- return RegExpPrototypeSymbolReplace ( / ^ M a p / ,
344- utilInspect ( this . properties , opts ) ,
345- prefix ) ;
344+ return SideEffectFreeRegExpPrototypeSymbolReplace ( / ^ M a p / ,
345+ utilInspect ( this . properties , opts ) ,
346+ prefix ) ;
346347 }
347348}
348349
@@ -517,7 +518,7 @@ function createRepl(inspector) {
517518 }
518519
519520 loadScopes ( ) {
520- return SafePromiseAll (
521+ return SafePromiseAllReturnArrayLike (
521522 ArrayPrototypeFilter (
522523 this . scopeChain ,
523524 ( scope ) => scope . type !== 'global'
@@ -656,14 +657,14 @@ function createRepl(inspector) {
656657 ( error ) => `<${ error . message } >` ) ;
657658 const lastIndex = watchedExpressions . length - 1 ;
658659
659- const values = await SafePromiseAll ( watchedExpressions , inspectValue ) ;
660+ const values = await SafePromiseAllReturnArrayLike ( watchedExpressions , inspectValue ) ;
660661 const lines = ArrayPrototypeMap ( watchedExpressions , ( expr , idx ) => {
661662 const prefix = `${ leftPad ( idx , ' ' , lastIndex ) } : ${ expr } =` ;
662663 const value = inspect ( values [ idx ] ) ;
663664 if ( ! StringPrototypeIncludes ( value , '\n' ) ) {
664665 return `${ prefix } ${ value } ` ;
665666 }
666- return `${ prefix } \n ${ RegExpPrototypeSymbolReplace ( / \n / g , value , '\n ' ) } ` ;
667+ return `${ prefix } \n ${ StringPrototypeReplaceAll ( value , '\n' , '\n ' ) } ` ;
667668 } ) ;
668669 const valueList = ArrayPrototypeJoin ( lines , '\n' ) ;
669670 return verbose ? `Watchers:\n${ valueList } \n` : valueList ;
@@ -805,8 +806,8 @@ function createRepl(inspector) {
805806 registerBreakpoint ) ;
806807 }
807808
808- const escapedPath = RegExpPrototypeSymbolReplace ( / ( [ / \\ . ? * ( ) ^ $ { } | [ \] ] ) / g,
809- script , '\\$1' ) ;
809+ const escapedPath = SideEffectFreeRegExpPrototypeSymbolReplace ( / ( [ / \\ . ? * ( ) ^ $ { } | [ \] ] ) / g,
810+ script , '\\$1' ) ;
810811 const urlRegex = `^(.*[\\/\\\\])?${ escapedPath } $` ;
811812
812813 return PromisePrototypeThen (
@@ -860,9 +861,9 @@ function createRepl(inspector) {
860861 location . lineNumber + 1 ) ) ;
861862 if ( ! newBreakpoints . length ) return PromiseResolve ( ) ;
862863 return PromisePrototypeThen (
863- SafePromiseAll ( newBreakpoints ) ,
864- ( results ) => {
865- print ( `${ results . length } breakpoints restored.` ) ;
864+ SafePromiseAllReturnVoid ( newBreakpoints ) ,
865+ ( ) => {
866+ print ( `${ newBreakpoints . length } breakpoints restored.` ) ;
866867 } ) ;
867868 }
868869
@@ -896,7 +897,7 @@ function createRepl(inspector) {
896897
897898 inspector . suspendReplWhile ( ( ) =>
898899 PromisePrototypeThen (
899- SafePromiseAll ( [ formatWatchers ( true ) , selectedFrame . list ( 2 ) ] ) ,
900+ SafePromiseAllReturnArrayLike ( [ formatWatchers ( true ) , selectedFrame . list ( 2 ) ] ) ,
900901 ( { 0 : watcherList , 1 : context } ) => {
901902 const breakContext = watcherList ?
902903 `${ watcherList } \n${ inspect ( context ) } ` :
0 commit comments