* Evaluate an ESM entry point and return the promise that gets fulfilled after * it finishes evaluation. * @param {string} source Source code the ESM * @param {boolean} print Whether the result should be printed. * @returns {Promise}
(source, print)
| 71 | * @returns {Promise} |
| 72 | */ |
| 73 | function evalModuleEntryPoint(source, print) { |
| 74 | if (print) { |
| 75 | throw new ERR_EVAL_ESM_CANNOT_PRINT(); |
| 76 | } |
| 77 | RegExpPrototypeExec(/^/, ''); // Necessary to reset RegExp statics before user code runs. |
| 78 | return require('internal/modules/run_main').runEntryPointWithESMLoader( |
| 79 | (loader) => loader.eval(source, getEvalModuleUrl(), true), |
| 80 | ); |
| 81 | } |
| 82 | |
| 83 | function evalScript(name, body, breakFirstLine, print, shouldLoadESM = false) { |
| 84 | const origModule = globalThis.module; // Set e.g. when called from the REPL. |
no test coverage detected
searching dependent graphs…