From 1d8c7e2bb5f2dc846eb734defc3effb3f80d7d48 Mon Sep 17 00:00:00 2001 From: ilovepixelart Date: Tue, 17 Nov 2026 19:06:52 +0100 Subject: [PATCH] Match @types/node to the lowest supported Node @types/node ^26.1.1 -> ^22.19.21, following engines.node (>=22.19), so the compiler rejects Node APIs that the oldest supported runtime lacks. Dependabot ignores @types/node major updates; they move only with the engines floor. --- .github/dependabot.yml | 5 +++++ extensions/web.ts | 4 ++-- package-lock.json | 16 ++++++++-------- package.json | 2 +- tests/resolution-probe.ts | 2 +- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 6c3ac0e1..77a4c21c 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -8,6 +8,11 @@ updates: # Version updates wait 7 days; security updates are never delayed. cooldown: default-days: 7 + # @types/node follows the lowest supported Node (engines); a newer major would let code + # compile against APIs that runtime lacks, so majors move only with the engines floor. + ignore: + - dependency-name: "@types/node" + update-types: ["version-update:semver-major"] groups: # A dependency joins the first group it matches, so the groups run from most to # least specific. The pi packages pin each other with caret ranges: a lone bump diff --git a/extensions/web.ts b/extensions/web.ts index 0a83d285..581c1648 100644 --- a/extensions/web.ts +++ b/extensions/web.ts @@ -197,7 +197,7 @@ function declaredCharset(contentType: string): string { /** A decoder for `contentType`'s declared charset, or the platform default (UTF-8) for a * label TextDecoder does not recognize: a bad or made-up charset must not fail the fetch. */ -function decoderFor(contentType: string): TextDecoder { +function decoderFor(contentType: string): InstanceType { try { return new TextDecoder(declaredCharset(contentType)) } catch { @@ -206,7 +206,7 @@ function decoderFor(contentType: string): TextDecoder { } /** readCapped for a response with no body stream: the whole body is buffered, then cut or refused. */ -async function readUnstreamed(response: Response, decoder: TextDecoder, limit: BodyLimit, tooLarge: () => Error): Promise { +async function readUnstreamed(response: Response, decoder: InstanceType, limit: BodyLimit, tooLarge: () => Error): Promise { const bytes = new Uint8Array(await response.arrayBuffer()) if (bytes.byteLength > limit.maxBytes && limit.overflow === 'refuse') throw tooLarge() return decoder.decode(bytes.subarray(0, limit.maxBytes)) diff --git a/package-lock.json b/package-lock.json index a1baa9d4..4d55e95a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "@earendil-works/pi-ai": "^1.1.0", "@earendil-works/pi-coding-agent": "^1.1.0", "@earendil-works/pi-tui": "^1.1.0", - "@types/node": "^26.1.1", + "@types/node": "^22.19.21", "@vitest/coverage-v8": "^5.0.0", "fast-check": "^4.9.0", "knip": "^6.34.0", @@ -2174,13 +2174,13 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "26.6.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.6.tgz", - "integrity": "sha512-MzQj+8Kx3XI40OmUAE6Qoh58ZMNstNNMwn2nfd3qWsfe7nDNSqJNzes4njhz6AHwrSHOffSLwXU6yb474Q4aog==", + "version": "22.19.21", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.21.tgz", + "integrity": "sha512-VMeFBSCKQKmm2swI2kW51SFusDqekC6q9trBCvJ/JliDchFSuoYYKN7yVNjPthP1HKZcx3U1gI/wTcEBjEFKTA==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~8.9.0" + "undici-types": "~6.21.0" } }, "node_modules/@types/retry": { @@ -5317,9 +5317,9 @@ } }, "node_modules/undici-types": { - "version": "8.9.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz", - "integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==", + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", "dev": true, "license": "MIT" }, diff --git a/package.json b/package.json index fe10b36c..0af93828 100644 --- a/package.json +++ b/package.json @@ -69,7 +69,7 @@ "@earendil-works/pi-ai": "^1.1.0", "@earendil-works/pi-coding-agent": "^1.1.0", "@earendil-works/pi-tui": "^1.1.0", - "@types/node": "^26.1.1", + "@types/node": "^22.19.21", "@vitest/coverage-v8": "^5.0.0", "fast-check": "^4.9.0", "knip": "^6.34.0", diff --git a/tests/resolution-probe.ts b/tests/resolution-probe.ts index 4c66ed78..1361f067 100644 --- a/tests/resolution-probe.ts +++ b/tests/resolution-probe.ts @@ -21,7 +21,7 @@ process.env.USERPROFILE = home const agentDir = path.join(home, 'agent') // jiti stats through the CommonJS fs object, so the probe wraps that one. -const cjsFs = createRequire(import.meta.url)('node:fs') as typeof fs +const cjsFs = createRequire(import.meta.url)('node:fs') as { statSync: typeof fs.statSync } const statSync = cjsFs.statSync const misses = new Set() cjsFs.statSync = ((target: fs.PathLike, options?: fs.StatOptions) => {