@@ -353,6 +353,7 @@ function createRepl(inspector) {
353
353
} )
354
354
. join ( '\n' ) ;
355
355
}
356
+
356
357
function listScripts ( displayNatives = false ) {
357
358
print ( formatScripts ( displayNatives ) ) ;
358
359
}
@@ -402,9 +403,9 @@ function createRepl(inspector) {
402
403
const i = start + offset ;
403
404
const isCurrent = i === ( lineNumber + 1 ) ;
404
405
405
- const markedLine = isCurrent
406
- ? markSourceColumn ( lineText , columnNumber , options . colors )
407
- : lineText ;
406
+ const markedLine = isCurrent ?
407
+ markSourceColumn ( lineText , columnNumber , options . colors ) :
408
+ lineText ;
408
409
409
410
let isBreakpoint = false ;
410
411
knownBreakpoints . forEach ( ( { location } ) => {
@@ -488,7 +489,7 @@ function createRepl(inspector) {
488
489
489
490
function prepareControlCode ( input ) {
490
491
if ( input === '\n' ) return lastCommand ;
491
- // exec process.title => exec("process.title");
492
+ // Add parentheses: exec process.title => exec("process.title");
492
493
const match = input . match ( / ^ \s * e x e c \s + ( [ ^ \n ] * ) / ) ;
493
494
if ( match ) {
494
495
lastCommand = `exec(${ JSON . stringify ( match [ 1 ] ) } )` ;
@@ -678,13 +679,13 @@ function createRepl(inspector) {
678
679
// setBreakpoint('fn()'): Break when a function is called
679
680
if ( script . endsWith ( '()' ) ) {
680
681
const debugExpr = `debug(${ script . slice ( 0 , - 2 ) } )` ;
681
- const debugCall = selectedFrame
682
- ? Debugger . evaluateOnCallFrame ( {
682
+ const debugCall = selectedFrame ?
683
+ Debugger . evaluateOnCallFrame ( {
683
684
callFrameId : selectedFrame . callFrameId ,
684
685
expression : debugExpr ,
685
686
includeCommandLineAPI : true ,
686
- } )
687
- : Runtime . evaluate ( {
687
+ } ) :
688
+ Runtime . evaluate ( {
688
689
expression : debugExpr ,
689
690
includeCommandLineAPI : true ,
690
691
} ) ;
@@ -807,7 +808,7 @@ function createRepl(inspector) {
807
808
808
809
inspector . suspendReplWhile ( ( ) =>
809
810
Promise . all ( [ formatWatchers ( true ) , selectedFrame . list ( 2 ) ] )
810
- . then ( ( [ watcherList , context ] ) => {
811
+ . then ( ( { 0 : watcherList , 1 : context } ) => {
811
812
if ( watcherList ) {
812
813
return `${ watcherList } \n${ inspect ( context ) } ` ;
813
814
}
@@ -829,17 +830,15 @@ function createRepl(inspector) {
829
830
Debugger . on ( 'scriptParsed' , ( script ) => {
830
831
const { scriptId, url } = script ;
831
832
if ( url ) {
832
- knownScripts [ scriptId ] = Object . assign ( {
833
- isNative : isNativeUrl ( url ) ,
834
- } , script ) ;
833
+ knownScripts [ scriptId ] = { isNative : isNativeUrl ( url ) , ...script } ;
835
834
}
836
835
} ) ;
837
836
838
837
Profiler . on ( 'consoleProfileFinished' , ( { profile } ) => {
839
838
Profile . createAndRegister ( { profile } ) ;
840
839
print ( [
841
840
'Captured new CPU profile.' ,
842
- `Access it with profiles[${ profiles . length - 1 } ]`
841
+ `Access it with profiles[${ profiles . length - 1 } ]` ,
843
842
] . join ( '\n' ) ) ;
844
843
} ) ;
845
844
@@ -931,22 +930,26 @@ function createRepl(inspector) {
931
930
print ( `Heap snapshot: ${ done } /${ total } ` , false ) ;
932
931
}
933
932
}
933
+
934
934
function onChunk ( { chunk } ) {
935
935
sizeWritten += chunk . length ;
936
936
writer . write ( chunk ) ;
937
937
print ( `Writing snapshot: ${ sizeWritten } ` , false ) ;
938
938
}
939
+
939
940
function onResolve ( ) {
940
941
writer . end ( ( ) => {
941
942
teardown ( ) ;
942
943
print ( `Wrote snapshot: ${ absoluteFile } ` ) ;
943
944
resolve ( ) ;
944
945
} ) ;
945
946
}
947
+
946
948
function onReject ( error ) {
947
949
teardown ( ) ;
948
950
reject ( error ) ;
949
951
}
952
+
950
953
function teardown ( ) {
951
954
HeapProfiler . removeListener (
952
955
'reportHeapSnapshotProgress' , onProgress ) ;
@@ -1071,7 +1074,7 @@ function createRepl(inspector) {
1071
1074
. then ( ( ) => Debugger . setBlackboxPatterns ( { patterns : [ ] } ) )
1072
1075
. then ( ( ) => Debugger . setPauseOnExceptions ( { state : pauseOnExceptionState } ) )
1073
1076
. then ( ( ) => restoreBreakpoints ( ) )
1074
- . then ( ( ) => Runtime . runIfWaitingForDebugger ( ) )
1077
+ . then ( ( ) => Runtime . runIfWaitingForDebugger ( ) ) ;
1075
1078
}
1076
1079
1077
1080
return function startRepl ( ) {
0 commit comments