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

Function main

benchmark/esm/esm-legacyMainResolve.js:33–52  ·  view source on GitHub ↗
(conf)

Source from the content-addressed store, hash-verified

31const bench = common.createBenchmark(main, configs, options);
32
33function main(conf) {
34 const { legacyMainResolve } = require('internal/modules/esm/resolve');
35 tmpdir.refresh();
36
37 fs.mkdirSync(path.join(benchmarkDirectory, 'node_modules', 'test'), { recursive: true });
38 fs.writeFileSync(path.join(benchmarkDirectory, conf.resolvedFile), '\n');
39
40 const packageJsonUrl = pathToFileURL(conf.packageJsonUrl);
41 const packageConfigMain = { main: conf.packageConfigMain };
42
43 bench.start();
44
45 for (let i = 0; i < conf.n; i++) {
46 try {
47 legacyMainResolve(packageJsonUrl, packageConfigMain, undefined);
48 } catch { /* empty */ }
49 }
50
51 bench.end(conf.n);
52}

Callers

nothing calls this directly

Calls 9

legacyMainResolveFunction · 0.85
requireFunction · 0.50
pathToFileURLFunction · 0.50
refreshMethod · 0.45
mkdirSyncMethod · 0.45
joinMethod · 0.45
writeFileSyncMethod · 0.45
startMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…