(name, body, breakFirstLine, print, shouldLoadESM = false)
| 81 | } |
| 82 | |
| 83 | function evalScript(name, body, breakFirstLine, print, shouldLoadESM = false) { |
| 84 | const origModule = globalThis.module; // Set e.g. when called from the REPL. |
| 85 | const module = createModule(name); |
| 86 | const baseUrl = pathToFileURL(module.filename).href; |
| 87 | |
| 88 | if (shouldUseModuleEntryPoint(name, body)) { |
| 89 | return getOptionValue('--strip-types') ? |
| 90 | evalTypeScriptModuleEntryPoint(body, print) : |
| 91 | evalModuleEntryPoint(body, print); |
| 92 | } |
| 93 | |
| 94 | const evalFunction = () => runScriptInContext(name, |
| 95 | body, |
| 96 | breakFirstLine, |
| 97 | print, |
| 98 | module, |
| 99 | baseUrl, |
| 100 | undefined, |
| 101 | origModule); |
| 102 | |
| 103 | if (shouldLoadESM) { |
| 104 | return require('internal/modules/run_main').runEntryPointWithESMLoader(evalFunction); |
| 105 | } |
| 106 | evalFunction(); |
| 107 | } |
| 108 | |
| 109 | const exceptionHandlerState = { |
| 110 | captureFn: null, // Primary callback (for domain's exclusive use) |
no test coverage detected
searching dependent graphs…