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

Function embedderRunESM

lib/internal/main/embedding.js:106–121  ·  view source on GitHub ↗
(content, filename)

Source from the content-addressed store, hash-verified

104}
105
106function embedderRunESM(content, filename) {
107 let resourceName;
108 if (path.isAbsolute(filename)) {
109 resourceName = pathToFileURL(filename).href;
110 } else {
111 resourceName = filename;
112 }
113 // TODO(joyeecheung): allow configuration from node::ModuleData,
114 // either via a more generic context object, or something like import.meta extensions.
115 const context = { isMain: true, __proto__: null };
116 const wrap = compileSourceTextModule(resourceName, content, kEmbedder, context);
117
118 // TODO(joyeecheung): we may want to return the v8::Module via a vm.SourceTextModule
119 // when vm.SourceTextModule stablizes, or put it in an out parameter.
120 return wrap.getNamespace();
121}
122
123function embedderRunEntryPoint(content, format, filename) {
124 format ||= moduleFormats.kCommonJS;

Callers 1

embedderRunEntryPointFunction · 0.85

Calls 2

compileSourceTextModuleFunction · 0.85
pathToFileURLFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…