7
7
prepareMainThreadExecution
8
8
} = require ( 'internal/bootstrap/pre_execution' ) ;
9
9
10
+ const esmLoader = require ( 'internal/process/esm_loader' ) ;
10
11
const {
11
12
evalScript
12
13
} = require ( 'internal/process/execution' ) ;
@@ -32,31 +33,33 @@ if (process.env.NODE_REPL_EXTERNAL_MODULE) {
32
33
process . exit ( 1 ) ;
33
34
}
34
35
35
- console . log ( `Welcome to Node.js ${ process . version } .\n` +
36
- 'Type ".help" for more information.' ) ;
36
+ esmLoader . loadESM ( ( ) => {
37
+ console . log ( `Welcome to Node.js ${ process . version } .\n` +
38
+ 'Type ".help" for more information.' ) ;
37
39
38
- const cliRepl = require ( 'internal/repl' ) ;
39
- cliRepl . createInternalRepl ( process . env , ( err , repl ) => {
40
- if ( err ) {
41
- throw err ;
42
- }
43
- repl . on ( 'exit' , ( ) => {
44
- if ( repl . _flushing ) {
45
- repl . pause ( ) ;
46
- return repl . once ( 'flushHistory' , ( ) => {
47
- process . exit ( ) ;
48
- } ) ;
40
+ const cliRepl = require ( 'internal/repl' ) ;
41
+ cliRepl . createInternalRepl ( process . env , ( err , repl ) => {
42
+ if ( err ) {
43
+ throw err ;
49
44
}
50
- process . exit ( ) ;
45
+ repl . on ( 'exit' , ( ) => {
46
+ if ( repl . _flushing ) {
47
+ repl . pause ( ) ;
48
+ return repl . once ( 'flushHistory' , ( ) => {
49
+ process . exit ( ) ;
50
+ } ) ;
51
+ }
52
+ process . exit ( ) ;
53
+ } ) ;
51
54
} ) ;
52
- } ) ;
53
55
54
- // If user passed '-e' or '--eval' along with `-i` or `--interactive`,
55
- // evaluate the code in the current context.
56
- if ( getOptionValue ( '[has_eval_string]' ) ) {
57
- evalScript ( '[eval]' ,
58
- getOptionValue ( '--eval' ) ,
59
- getOptionValue ( '--inspect-brk' ) ,
60
- getOptionValue ( '--print' ) ) ;
61
- }
56
+ // If user passed '-e' or '--eval' along with `-i` or `--interactive`,
57
+ // evaluate the code in the current context.
58
+ if ( getOptionValue ( '[has_eval_string]' ) ) {
59
+ evalScript ( '[eval]' ,
60
+ getOptionValue ( '--eval' ) ,
61
+ getOptionValue ( '--inspect-brk' ) ,
62
+ getOptionValue ( '--print' ) ) ;
63
+ }
64
+ } ) ;
62
65
}
0 commit comments