MCPcopy Create free account
hub / github.com/nodejs/node / minimalRunCjs

Function minimalRunCjs

lib/internal/main/mksnapshot.js:191–203  ·  view source on GitHub ↗
(source)

Source from the content-addressed store, hash-verified

189 // TODO(addaleax): Make this `embedderRunCjs` once require('module')
190 // is supported in snapshots.
191 function minimalRunCjs(source) {
192 let filename;
193 let dirname;
194 if (process.argv[1] === anonymousMainPath) {
195 filename = dirname = process.argv[1];
196 } else {
197 filename = path.resolve(process.argv[1]);
198 dirname = path.dirname(filename);
199 }
200
201 const fn = compileSerializeMain(filename, source);
202 return fn(requireForUserSnapshot, filename, dirname);
203 }
204
205 if (isExperimentalSeaWarningNeeded()) {
206 emitExperimentalWarning('Single executable application');

Callers

nothing calls this directly

Calls 2

fnFunction · 0.50
resolveMethod · 0.45

Tested by

no test coverage detected