77 prepareMainThreadExecution
88} = require ( 'internal/bootstrap/pre_execution' ) ;
99
10+ const esmLoader = require ( 'internal/process/esm_loader' ) ;
1011const {
1112 evalScript
1213} = require ( 'internal/process/execution' ) ;
@@ -32,31 +33,33 @@ if (process.env.NODE_REPL_EXTERNAL_MODULE) {
3233 process . exit ( 1 ) ;
3334 }
3435
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.' ) ;
3739
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 ;
4944 }
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+ } ) ;
5154 } ) ;
52- } ) ;
53-
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- }
55+
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+ } , false ) ;
6265}
0 commit comments