Skip to content

Commit 97bcc6f

Browse files
Merge pull request #1027 from nodejs/main
Create a new pull request by comparing changes across two branches
2 parents e33a53c + e79ae1b commit 97bcc6f

File tree

3 files changed

+19
-17
lines changed

3 files changed

+19
-17
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,8 @@ For information about the governance of the Node.js project, see
410410
**Filip Skokan** <<[email protected]>> (he/him)
411411
* [pimterry](https://github.com/pimterry) -
412412
**Tim Perry** <<[email protected]>> (he/him)
413+
* [pmarchini](https://github.com/pmarchini)
414+
**Pietro Marchini** <<[email protected]>> (he/him)
413415
* [Qard](https://github.com/Qard) -
414416
**Stephen Belanger** <<[email protected]>> (he/him)
415417
* [RafaelGSS](https://github.com/RafaelGSS) -

benchmark/esm/detect-esm-syntax.js

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,33 @@
44
// We use the TypeScript fixture because it's a very large CommonJS file with no ESM syntax: the worst case.
55
const common = require('../common.js');
66
const tmpdir = require('../../test/common/tmpdir.js');
7-
const fixtures = require('../../test/common/fixtures.js');
8-
const scriptPath = fixtures.path('snapshot', 'typescript.js');
97
const fs = require('node:fs');
108

119
const bench = common.createBenchmark(main, {
12-
type: ['with-module-syntax-detection', 'without-module-syntax-detection'],
10+
type: ['with-package-json', 'without-package-json'],
1311
n: [1e4],
14-
}, {
15-
flags: ['--experimental-detect-module'],
1612
});
1713

18-
const benchmarkDirectory = tmpdir.fileURL('benchmark-detect-esm-syntax');
19-
const ambiguousURL = new URL('./typescript.js', benchmarkDirectory);
20-
const explicitURL = new URL('./typescript.cjs', benchmarkDirectory);
21-
2214
async function main({ n, type }) {
2315
tmpdir.refresh();
16+
fs.mkdirSync(tmpdir.resolve('bench'));
2417

25-
fs.mkdirSync(benchmarkDirectory, { recursive: true });
26-
fs.cpSync(scriptPath, ambiguousURL);
27-
fs.cpSync(scriptPath, explicitURL);
28-
29-
bench.start();
30-
18+
let loader = '';
19+
const modules = [];
3120
for (let i = 0; i < n; i++) {
32-
const url = type === 'with-module-syntax-detection' ? ambiguousURL : explicitURL;
33-
await import(url);
21+
const url = tmpdir.fileURL('bench', `mod${i}.js`);
22+
fs.writeFileSync(url, `const foo${i} = ${i};\nexport { foo${i} };\n`);
23+
loader += `import { foo${i} } from './mod${i}.js';\n`;
24+
modules.push(url);
3425
}
26+
const loaderURL = tmpdir.fileURL('bench', 'load.js');
27+
fs.writeFileSync(loaderURL, loader);
3528

29+
if (type === 'with-package-json') {
30+
fs.writeFileSync(tmpdir.resolve('bench', 'package.json'), '{ "type": "module" }');
31+
}
32+
33+
bench.start();
34+
await import(loaderURL);
3635
bench.end(n);
3736
}

doc/abi_version_registry.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"NODE_MODULE_VERSION": [
3+
{ "modules": 132,"runtime": "electron", "variant": "electron", "versions": "34" },
34
{ "modules": 131,"runtime": "node", "variant": "v8_12.9", "versions": "23.0.0-pre" },
45
{ "modules": 130,"runtime": "electron", "variant": "electron", "versions": "33" },
56
{ "modules": 129,"runtime": "node", "variant": "v8_12.8", "versions": "23.0.0-pre" },

0 commit comments

Comments
 (0)