Skip to content

Commit 622876f

Browse files
committed
feat: support Node 24
- bump `.nvmrc` and `engines.node` to 24.19.0, which also moves the CodSpeed instrumented, memory and walltime runs to Node 24 - add Node 24 to the example matrix. Its Node 20 entry moves from the stale 20.5.1 pin (it only mirrored the old `engines` value) to 20, because `node --import` needs `module.register`, added in 20.6.0 - run the ESM TypeScript benches with tsx: esbuild-register's ESM loader no longer intercepts `.ts` on Node >= 22, so those benches died with `Cannot use import statement outside a module`. `node --import tsx` keeps the benchmark in a single process, so the runner's PATH shim still delivers the V8 flags through `process.execArgv` - import the plugin by name in its own bench, since tsx resolves a relative directory import to `index.ts` instead of going through the package exports
1 parent 245dfad commit 622876f

10 files changed

Lines changed: 425 additions & 144 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
needs: list-examples
5050
strategy:
5151
matrix:
52-
node-version: ["18", "20.5.1"]
52+
node-version: ["18", "20", "24"]
5353
example: ${{ fromJson(needs.list-examples.outputs.examples) }}
5454
# tinybench v5+ requires Node >=20, so its examples cannot run on Node 18
5555
exclude:

‎.nvmrc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20.5.1
1+
24.19.0

‎examples/with-tinybench-v5/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
"private": true,
44
"type": "module",
55
"scripts": {
6-
"bench-tinybench": "node --loader esbuild-register/loader -r esbuild-register tinybench.ts",
6+
"bench-tinybench": "node --import tsx tinybench.ts",
77
"typecheck": "tsc --noEmit --pretty"
88
},
99
"devDependencies": {
1010
"@codspeed/tinybench-plugin": "workspace:*",
11-
"esbuild-register": "^3.4.2",
1211
"tinybench": "^5.1.0",
12+
"tsx": "^4.23.12",
1313
"typescript": "^5.1.3"
1414
}
1515
}

‎examples/with-tinybench-v6/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
"private": true,
44
"type": "module",
55
"scripts": {
6-
"bench-tinybench": "node --loader esbuild-register/loader -r esbuild-register tinybench.ts",
6+
"bench-tinybench": "node --import tsx tinybench.ts",
77
"typecheck": "tsc --noEmit --pretty"
88
},
99
"devDependencies": {
1010
"@codspeed/tinybench-plugin": "workspace:*",
11-
"esbuild-register": "^3.4.2",
1211
"tinybench": "^6.0.2",
12+
"tsx": "^4.23.12",
1313
"typescript": "^5.1.3"
1414
}
1515
}

‎examples/with-typescript-esm/package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"private": true,
44
"type": "module",
55
"scripts": {
6-
"bench-benchmark-js": "node --loader esbuild-register/loader -r esbuild-register bench/benchmark.js/index.bench.ts",
7-
"bench-tinybench": "node --loader esbuild-register/loader -r esbuild-register bench/tinybench/index.bench.ts",
6+
"bench-benchmark-js": "node --import tsx bench/benchmark.js/index.bench.ts",
7+
"bench-tinybench": "node --import tsx bench/tinybench/index.bench.ts",
88
"bench-vitest": "vitest bench --run"
99
},
1010
"devDependencies": {
@@ -13,8 +13,8 @@
1313
"@codspeed/vitest-plugin": "workspace:*",
1414
"@types/benchmark": "^2.1.2",
1515
"benchmark": "^2.1.4",
16-
"esbuild-register": "^3.4.2",
1716
"tinybench": "^4.0.1",
17+
"tsx": "^4.23.12",
1818
"typescript": "^5.1.3",
1919
"vitest": "^4.0.18"
2020
}

‎examples/with-typescript-simple-esm/package.json‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
"private": true,
44
"type": "module",
55
"scripts": {
6-
"bench-benchmark-js": "node --loader esbuild-register/loader -r esbuild-register benchmark-js.ts",
7-
"bench-tinybench": "node --loader esbuild-register/loader -r esbuild-register tinybench.ts"
6+
"bench-benchmark-js": "node --import tsx benchmark-js.ts",
7+
"bench-tinybench": "node --import tsx tinybench.ts"
88
},
99
"devDependencies": {
1010
"@codspeed/benchmark.js-plugin": "workspace:*",
1111
"@codspeed/tinybench-plugin": "workspace:*",
1212
"@types/benchmark": "^2.1.2",
1313
"benchmark": "^2.1.4",
14-
"esbuild-register": "^3.4.2",
1514
"tinybench": "^4.0.1",
15+
"tsx": "^4.23.12",
1616
"typescript": "^5.1.3"
1717
}
1818
}

‎package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"@rollup/plugin-node-resolve": "^15.2.3",
2020
"@rollup/plugin-typescript": "^11.1.5",
2121
"@types/jest": "^29.5.0",
22-
"@types/node": "^20.5.1",
22+
"@types/node": "^24.10.1",
2323
"@typescript-eslint/eslint-plugin": "^8.57.0",
2424
"@typescript-eslint/parser": "^8.57.0",
2525
"esbuild": "^0.17.16",
@@ -43,6 +43,6 @@
4343
},
4444
"packageManager": "pnpm@10.12.4",
4545
"engines": {
46-
"node": "20.5.1"
46+
"node": "24.19.0"
4747
}
4848
}

‎packages/tinybench-plugin/benches/sample.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
import { withCodSpeed } from "@codspeed/tinybench-plugin";
12
import { Bench } from "tinybench";
2-
import { withCodSpeed } from "..";
33
import parsePr from "./parsePr";
44
import { registerTimingBenchmarks } from "./timing";
55

‎packages/tinybench-plugin/package.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,16 @@
2828
"typecheck": "tsc --noEmit --pretty",
2929
"format": "prettier --config ../../.prettierrc.json --ignore-path ../../.prettierignore --check .",
3030
"fix-format": "prettier --config ../../.prettierrc.json --ignore-path ../../.prettierignore --write .",
31-
"bench": "node --loader esbuild-register/loader -r esbuild-register benches/sample.ts",
31+
"bench": "node --import tsx benches/sample.ts",
3232
"clean": "rm -rf dist"
3333
},
3434
"author": "Arthur Pastel <arthur@codspeed.io>",
3535
"repository": "https://github.com/CodSpeedHQ/codspeed-node",
3636
"homepage": "https://codspeed.io",
3737
"license": "Apache-2.0",
3838
"devDependencies": {
39-
"esbuild-register": "^3.4.2",
4039
"tinybench": "^4.0.1",
40+
"tsx": "^4.23.12",
4141
"vitest": "^3.2.4"
4242
},
4343
"dependencies": {

0 commit comments

Comments
 (0)