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

Function compileScript

lib/internal/process/execution.js:413–431  ·  view source on GitHub ↗

* * @param {string} name - The filename of the script. * @param {string} body - The code of the script. * @param {string} baseUrl Path of the parent importing the module. * @returns {ContextifyScript} The created contextify script.

(name, body, baseUrl)

Source from the content-addressed store, hash-verified

411 * @returns {ContextifyScript} The created contextify script.
412 */
413function compileScript(name, body, baseUrl) {
414 const hostDefinedOptionId = Symbol(name);
415 async function importModuleDynamically(specifier, _, importAttributes, phase) {
416 const cascadedLoader = require('internal/modules/esm/loader').getOrInitializeCascadedLoader();
417 return cascadedLoader.import(specifier, baseUrl, importAttributes,
418 phase === 'source' ? kSourcePhase : kEvaluationPhase);
419 }
420 return makeContextifyScript(
421 body, // code
422 name, // filename,
423 0, // lineOffset
424 0, // columnOffset,
425 undefined, // cachedData
426 false, // produceCachedData
427 undefined, // parsingContext
428 hostDefinedOptionId, // hostDefinedOptionId
429 importModuleDynamically, // importModuleDynamically
430 );
431}
432
433/**
434 * @param {string} name - The filename of the script.

Callers 2

evalTypeScriptFunction · 0.70
runScriptInContextFunction · 0.70

Calls 2

makeContextifyScriptFunction · 0.85
SymbolFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…