Skip to content

Commit 3735985

Browse files
committed
chore: clear CI warnings
- bump `actions/setup-node` and `pnpm/action-setup` to the majors that run on Node 24, the runners now warn about the Node 20 based ones - use the `simulation` runner mode in the example matrix, `instrumentation` is deprecated - widen the root `engines.node` to `>=22`, the exact pin made every Node 22 example job print an unsupported engine warning - pass `sourceMap`/`outputToFilesystem` to the rollup config plugin, which otherwise warns while compiling `rollup.config.ts` - move the runner mode helpers to their own module: `introspection.ts` imported them from the barrel file, so rollup reported a cycle - ignore the `EVAL` warning for `optimization.ts`, %OptimizeFunctionOnNextCall has no non-eval entry point - build the symbol names with `v8::String::Utf8Value`, `Utf8Length` and `WriteUtf8` are deprecated as of the V8 shipped with Node 24
1 parent 09d275b commit 3735985

20 files changed

Lines changed: 87 additions & 74 deletions

File tree

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"ignorePatterns": [
1010
"**/dist/**",
1111
"**/node_modules/**",
12-
"**/rollup.config.ts",
12+
"**/rollup.config.mjs",
1313
"**/jest.config.js",
1414
"packages/core/src/native_core/instruments/hooks/**"
1515
],

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ jobs:
1717
with:
1818
fetch-depth: 0
1919
submodules: true
20-
- uses: pnpm/action-setup@v2
21-
- uses: actions/setup-node@v3
20+
- uses: pnpm/action-setup@v4
21+
- uses: actions/setup-node@v6
2222
with:
2323
cache: pnpm
2424
node-version-file: .nvmrc
@@ -57,8 +57,8 @@ jobs:
5757
with:
5858
fetch-depth: 0
5959
submodules: true
60-
- uses: pnpm/action-setup@v2
61-
- uses: actions/setup-node@v3
60+
- uses: pnpm/action-setup@v4
61+
- uses: actions/setup-node@v6
6262
with:
6363
cache: pnpm
6464
node-version: ${{ matrix.node-version }}
@@ -73,7 +73,7 @@ jobs:
7373
# use version from `main` branch to always test the latest version, in real projects, use a tag, like `@v2`
7474
uses: CodSpeedHQ/action@main
7575
with:
76-
mode: instrumentation
76+
mode: simulation
7777
run: pnpm --filter ${{ matrix.example }} bench-tinybench
7878
env:
7979
CODSPEED_SKIP_UPLOAD: true
@@ -82,7 +82,7 @@ jobs:
8282
# use version from `main` branch to always test the latest version, in real projects, use a tag, like `@v2`
8383
uses: CodSpeedHQ/action@main
8484
with:
85-
mode: instrumentation
85+
mode: simulation
8686
run: pnpm --filter ${{ matrix.example }} bench-benchmark-js
8787
env:
8888
CODSPEED_SKIP_UPLOAD: true

.github/workflows/codspeed.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ jobs:
3737
with:
3838
fetch-depth: 0
3939
submodules: true
40-
- uses: pnpm/action-setup@v2
41-
- uses: actions/setup-node@v3
40+
- uses: pnpm/action-setup@v4
41+
- uses: actions/setup-node@v6
4242
with:
4343
cache: pnpm
4444
node-version-file: .nvmrc
@@ -69,8 +69,8 @@ jobs:
6969
with:
7070
fetch-depth: 0
7171
submodules: true
72-
- uses: pnpm/action-setup@v2
73-
- uses: actions/setup-node@v3
72+
- uses: pnpm/action-setup@v4
73+
- uses: actions/setup-node@v6
7474
with:
7575
cache: pnpm
7676
node-version-file: .nvmrc
@@ -100,8 +100,8 @@ jobs:
100100
with:
101101
fetch-depth: 0
102102
submodules: true
103-
- uses: pnpm/action-setup@v2
104-
- uses: actions/setup-node@v3
103+
- uses: pnpm/action-setup@v4
104+
- uses: actions/setup-node@v6
105105
with:
106106
cache: pnpm
107107
node-version-file: .nvmrc

.github/workflows/release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ jobs:
2828
with:
2929
fetch-depth: 0
3030
submodules: true
31-
- uses: pnpm/action-setup@v2
32-
- uses: actions/setup-node@v3
31+
- uses: pnpm/action-setup@v4
32+
- uses: actions/setup-node@v6
3333
with:
3434
cache: pnpm
3535
node-version-file: .nvmrc
@@ -51,8 +51,8 @@ jobs:
5151
with:
5252
fetch-depth: 0
5353
submodules: true
54-
- uses: pnpm/action-setup@v2
55-
- uses: actions/setup-node@v3
54+
- uses: pnpm/action-setup@v4
55+
- uses: actions/setup-node@v6
5656
with:
5757
cache: pnpm
5858
node-version-file: .nvmrc

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@
4848
}
4949
},
5050
"engines": {
51-
"node": "24.19.0"
51+
"node": ">=22"
5252
}
5353
}

packages/benchmark.js-plugin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"dist"
1616
],
1717
"scripts": {
18-
"build": "NODE_NO_WARNINGS=1 rollup -c rollup.config.ts --configPlugin typescript --configImportAttributesKey with",
18+
"build": "rollup -c",
1919
"test": "jest --passWithNoTests --silent",
2020
"test/integ": "jest --passWithNoTests --silent -c jest.config.integ.js",
2121
"lint": "eslint .",

packages/benchmark.js-plugin/rollup.config.ts renamed to packages/benchmark.js-plugin/rollup.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { defineConfig } from "rollup";
2-
import { declarationsPlugin, jsPlugins } from "../../rollup.options";
2+
import { declarationsPlugin, jsPlugins } from "../../rollup.options.mjs";
33
import pkg from "./package.json" with { type: "json" };
44

55
const entrypoint = "src/index.ts";

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"types": "dist/index.d.ts",
1717
"gypfile": true,
1818
"scripts": {
19-
"build": "NODE_NO_WARNINGS=1 rollup -c rollup.config.ts --configPlugin typescript --configImportAttributesKey with",
19+
"build": "rollup -c",
2020
"build-native-addon": "prebuildify --name node --strip --no-napi --target 22.0.0 --target 24.0.0",
2121
"build-tracer-client": "openapi --client axios --input ./tracer.spec.json --name MongoTracer --output ./src/generated/openapi",
2222
"test": "jest --passWithNoTests --silent",
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { defineConfig } from "rollup";
2-
import { declarationsPlugin, jsPlugins } from "../../rollup.options";
2+
import { declarationsPlugin, jsPlugins } from "../../rollup.options.mjs";
33
import pkg from "./package.json" with { type: "json" };
44

55
const entrypoint = "src/index.ts";
@@ -27,5 +27,13 @@ export default defineConfig([
2727
{ file: pkg.module, format: "es", sourcemap: true },
2828
],
2929
plugins: jsPlugins(pkg.version),
30+
onwarn(warning, warn) {
31+
// The optimization helpers reach V8 natives syntax
32+
// (%OptimizeFunctionOnNextCall), which has no non-eval entry point.
33+
if (warning.code === "EVAL" && warning.id?.endsWith("optimization.ts")) {
34+
return;
35+
}
36+
warn(warning);
37+
},
3038
},
3139
]);

packages/core/src/index.ts

Lines changed: 3 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { checkV8Flags } from "./introspection";
22
import { MongoMeasurement } from "./mongoMeasurement";
33
import native_core from "./native_core";
4+
import { getCodspeedRunnerMode } from "./runnerMode";
45

56
declare const __VERSION__: string;
67

@@ -10,44 +11,6 @@ export const isBound = native_core.isBound;
1011

1112
export const mongoMeasurement = new MongoMeasurement();
1213

13-
type CodSpeedRunnerMode = "disabled" | "simulation" | "memory" | "walltime";
14-
15-
type InstrumentMode = "disabled" | "analysis" | "walltime";
16-
17-
export function getCodspeedRunnerMode(): CodSpeedRunnerMode {
18-
const isCodSpeedEnabled = process.env.CODSPEED_ENV !== undefined;
19-
if (!isCodSpeedEnabled) {
20-
return "disabled";
21-
}
22-
23-
// If CODSPEED_ENV is set, check CODSPEED_RUNNER_MODE
24-
const codspeedRunnerMode = process.env.CODSPEED_RUNNER_MODE;
25-
if (
26-
codspeedRunnerMode === "instrumentation" ||
27-
codspeedRunnerMode === "simulation"
28-
) {
29-
return "simulation";
30-
} else if (codspeedRunnerMode === "memory") {
31-
return "memory";
32-
} else if (codspeedRunnerMode === "walltime") {
33-
return "walltime";
34-
}
35-
36-
console.warn(
37-
`Unknown codspeed runner mode: ${codspeedRunnerMode}, defaulting to disabled`,
38-
);
39-
return "disabled";
40-
}
41-
42-
export function getInstrumentMode(): InstrumentMode {
43-
const runnerMode = getCodspeedRunnerMode();
44-
// Both "simulation" and "memory" map to "analysis" instrument mode
45-
if (runnerMode === "simulation" || runnerMode === "memory") {
46-
return "analysis";
47-
}
48-
return runnerMode; // "disabled" or "walltime"
49-
}
50-
5114
export const setupCore = () => {
5215
if (!native_core.isBound) {
5316
throw new Error(
@@ -85,7 +48,8 @@ export { optimizeFunction, optimizeFunctionSync } from "./optimization";
8548
export { wrapWithRootFrame, wrapWithRootFrameSync } from "./rootFrame";
8649
export * from "./utils";
8750
export * from "./walltime";
88-
export type { InstrumentMode };
51+
export type { InstrumentMode } from "./runnerMode";
52+
export { getCodspeedRunnerMode, getInstrumentMode } from "./runnerMode";
8953
export const InstrumentHooks = native_core.InstrumentHooks;
9054

9155
// Marker type constants, sourced from the native addon (which reads them from

0 commit comments

Comments
 (0)