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

Function makeContextifyScript

lib/internal/vm.js:180–208  ·  view source on GitHub ↗

* Creates a contextify script. * @param {string} code - The code of the script. * @param {string} filename - The filename of the script. * @param {number} lineOffset - The line offset of the script. * @param {number} columnOffset - The column offset of the script. * @param {Buffer} cachedData -

(code,
                              filename,
                              lineOffset,
                              columnOffset,
                              cachedData,
                              produceCachedData,
                              parsingContext,
                              hostDefinedOptionId,
                              importModuleDynamically)

Source from the content-addressed store, hash-verified

178 * @returns {ContextifyScript} The created contextify script.
179 */
180function makeContextifyScript(code,
181 filename,
182 lineOffset,
183 columnOffset,
184 cachedData,
185 produceCachedData,
186 parsingContext,
187 hostDefinedOptionId,
188 importModuleDynamically) {
189 let script;
190 // Calling `ReThrow()` on a native TryCatch does not generate a new
191 // abort-on-uncaught-exception check. A dummy try/catch in JS land
192 // protects against that.
193 try { // eslint-disable-line no-useless-catch
194 script = new ContextifyScript(code,
195 filename,
196 lineOffset,
197 columnOffset,
198 cachedData,
199 produceCachedData,
200 parsingContext,
201 hostDefinedOptionId);
202 } catch (e) {
203 throw e; /* node-do-not-add-exception-line */
204 }
205
206 registerImportModuleDynamically(script, importModuleDynamically);
207 return script;
208}
209
210/**
211 * Runs a script in the current context.

Callers 3

defaultEvalMethod · 0.85
wrapSafeFunction · 0.85
compileScriptFunction · 0.85

Calls 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…