MCPcopy Index your code
hub / github.com/nodejs/node / evalModuleEntryPoint

Function evalModuleEntryPoint

lib/internal/process/execution.js:73–81  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

71 * @returns {Promise}
72 */
73function 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
83function evalScript(name, body, breakFirstLine, print, shouldLoadESM = false) {
84 const origModule = globalThis.module; // Set e.g. when called from the REPL.

Callers 5

eval_string.jsFile · 0.85
worker_thread.jsFile · 0.85
eval_stdin.jsFile · 0.85
evalScriptFunction · 0.85

Calls 3

getEvalModuleUrlFunction · 0.85
requireFunction · 0.50
evalMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…