(payload: BootstrapState)
| 468 | } |
| 469 | |
| 470 | function phase4(payload: BootstrapState) { |
| 471 | const { isInChildProcess, tsNodeScript } = payload; |
| 472 | const { version, showConfig, restArgs, code, print, argv } = |
| 473 | payload.parseArgvResult; |
| 474 | const { cwd } = payload.phase2Result!; |
| 475 | const { preloadedConfig } = payload.phase3Result!; |
| 476 | |
| 477 | const { |
| 478 | entryPointPath, |
| 479 | executeEntrypoint, |
| 480 | executeEval, |
| 481 | executeRepl, |
| 482 | executeStdin, |
| 483 | } = getEntryPointInfo(payload); |
| 484 | |
| 485 | /** |
| 486 | * <repl>, [stdin], and [eval] are all essentially virtual files that do not exist on disc and are backed by a REPL |
| 487 | * service to handle eval-ing of code. |
| 488 | */ |
| 489 | interface VirtualFileState { |
| 490 | state: EvalState; |
| 491 | repl: ReplService; |
| 492 | module?: Module; |
| 493 | } |
| 494 | let evalStuff: VirtualFileState | undefined; |
| 495 | let replStuff: VirtualFileState | undefined; |
| 496 | let stdinStuff: VirtualFileState | undefined; |
| 497 | let evalAwarePartialHost: EvalAwarePartialHost | undefined = undefined; |
| 498 | if (executeEval) { |
| 499 | const state = new EvalState(join(cwd, EVAL_FILENAME)); |
| 500 | evalStuff = { |
| 501 | state, |
| 502 | repl: createRepl({ |
| 503 | state, |
| 504 | composeWithEvalAwarePartialHost: evalAwarePartialHost, |
| 505 | ignoreDiagnosticsThatAreAnnoyingInInteractiveRepl: false, |
| 506 | }), |
| 507 | }; |
| 508 | ({ evalAwarePartialHost } = evalStuff.repl); |
| 509 | // Create a local module instance based on `cwd`. |
| 510 | const module = (evalStuff.module = new Module(EVAL_NAME)); |
| 511 | module.filename = evalStuff.state.path; |
| 512 | module.paths = (Module as any)._nodeModulePaths(cwd); |
| 513 | } |
| 514 | if (executeStdin) { |
| 515 | const state = new EvalState(join(cwd, STDIN_FILENAME)); |
| 516 | stdinStuff = { |
| 517 | state, |
| 518 | repl: createRepl({ |
| 519 | state, |
| 520 | composeWithEvalAwarePartialHost: evalAwarePartialHost, |
| 521 | ignoreDiagnosticsThatAreAnnoyingInInteractiveRepl: false, |
| 522 | }), |
| 523 | }; |
| 524 | ({ evalAwarePartialHost } = stdinStuff.repl); |
| 525 | // Create a local module instance based on `cwd`. |
| 526 | const module = (stdinStuff.module = new Module(STDIN_NAME)); |
| 527 | module.filename = stdinStuff.state.path; |
no test coverage detected
searching dependent graphs…