Skip to content

Commit a6b8f2e

Browse files
committed
fix: tighten Node engines to >=22.6, restore strip-types guard, use replaceAll (#588)
Impact: 1 functions changed, 0 affected
1 parent 5c50b2a commit a6b8f2e

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
"README.md"
2727
],
2828
"engines": {
29-
"node": ">=22"
29+
"node": ">=22.6"
3030
},
3131
"scripts": {
32-
"build": "tsc && node -e \"require('fs').writeFileSync('dist/index.cjs',require('fs').readFileSync('src/index.cjs','utf8').replace('./index.ts','./index.js'))\"",
32+
"build": "tsc && node -e \"require('fs').writeFileSync('dist/index.cjs',require('fs').readFileSync('src/index.cjs','utf8').replaceAll('./index.ts','./index.js'))\"",
3333
"build:wasm": "node --experimental-strip-types scripts/build-wasm.ts",
3434
"typecheck": "tsc --noEmit",
3535
"verify-imports": "node --experimental-strip-types scripts/verify-imports.ts",

scripts/ts-resolve-hooks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { fileURLToPath } from 'node:url';
1313
export async function resolve(
1414
specifier: string,
1515
context: { parentURL?: string; conditions: string[] },
16-
nextResolve: Function,
16+
nextResolve: (specifier: string, context?: { parentURL?: string; conditions: string[] }) => Promise<{ url: string; shortCircuit?: boolean }>,
1717
): Promise<{ url: string; shortCircuit?: boolean }> {
1818
try {
1919
return await nextResolve(specifier, context);

vitest.config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import { defineConfig } from 'vitest/config';
22

3-
const [major] = process.versions.node.split('.').map(Number);
3+
const [major, minor] = process.versions.node.split('.').map(Number);
44
const existing = process.env.NODE_OPTIONS || '';
5+
const supportsStripTypes = major > 22 || (major === 22 && minor >= 6);
56
const stripFlag = major >= 23 ? '--strip-types' : '--experimental-strip-types';
67

78
export default defineConfig({
@@ -15,7 +16,7 @@ export default defineConfig({
1516
env: {
1617
NODE_OPTIONS: [
1718
existing,
18-
!existing.includes('--experimental-strip-types') && !existing.includes('--strip-types')
19+
supportsStripTypes && !existing.includes('--experimental-strip-types') && !existing.includes('--strip-types')
1920
? stripFlag
2021
: '',
2122
].filter(Boolean).join(' '),

0 commit comments

Comments
 (0)