Files
bun.sh/bench/snippets/require-builtins.mjs
Meghan Denny fa219a2f8e js: update node:_http_agent (#24275)
pulled out of https://github.com/oven-sh/bun/pull/21809

+7 node tests

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2025-11-04 11:56:33 -08:00

25 lines
649 B
JavaScript

import { spawnSync } from "child_process";
import { writeFile } from "node:fs/promises";
import { builtinModules } from "node:module";
for (let builtin of builtinModules) {
const path = `/tmp/require.${builtin.replaceAll("/", "_")}.cjs`;
await writeFile(
path,
`
const builtin = ${JSON.stringify(builtin)};
const now = performance.now();
require(builtin);
const end = performance.now();
process.stdout.write(JSON.stringify({ builtin, time: end - now }) + "\\n");
`,
);
spawnSync(process.execPath, [path], {
stdio: ["inherit", "inherit", "inherit"],
env: {
...process.env,
NODE_NO_WARNINGS: "1",
},
});
}