Files
Huáng JùnliàngandGitHub 254525d565 Enforce node protocol import (#17207)
* enable prefer-node-protocol rule

* prefer node protocol import

* fix broken scripts

* fix e2e-old-babel error

* strip node: protocol for old node versions

* update Makefile.mjs
2025-03-31 10:49:22 -04:00

40 lines
860 B
JavaScript

import { readFileSync } from "node:fs";
import {
currentCore,
baselineCore,
presetTypescript,
Benchmark,
} from "../../util.mjs";
import commonjs from "@babel/plugin-transform-modules-commonjs";
const benchmark = new Benchmark();
const input = readFileSync(
new URL("./babel-parser-tokenizer-index.txt", import.meta.url),
"utf-8"
);
function benchCases(name, implementation, options = {}) {
benchmark.add(
name,
() => {
implementation(input, {
presets: [presetTypescript],
plugins: [commonjs],
targets: "node 6",
configFile: false,
babelrc: false,
...options,
});
},
{
// increase minSamples for accuracy
minSamples: 100,
}
);
}
benchCases("baseline", baselineCore.transformSync);
benchCases("current", currentCore.transformSync);
benchmark.run();