From 8feff0accc210232b29a12c7837257fec6d7354a Mon Sep 17 00:00:00 2001 From: Alex Matthews <2862661+qoole@users.noreply.github.com> Date: Mon, 31 Aug 2026 16:35:46 +0100 Subject: [PATCH] chore: bump tree-sitter runtime to 0.25 (python/go grammars to match) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Join the grammars that declare an older peer range — java, kotlin, php, r and typescript — to the existing overrides block alongside tree-sitter-swift, so the tree resolves to exactly one copy of tree-sitter. All eight grammars were verified to load and parse under 0.25.1; the stale peer metadata does not reflect an ABI break. The overrides key for R must be the alias tree-sitter-r, not @davisvaughan/tree-sitter-r, or npm ignores it and ERESOLVE still fires. Note this is the opposite of allowScripts, which keys by the resolved package (#233) — the two fields match on different identities. allowScripts is keyed by exact name@version, so the three moved versions are rewritten alongside the bumps to keep the list in sync. Dependabot is told not to bump tree-sitter-typescript on its own. Also corrects two docblocks that named the wrong runtime: the string parse() size limit was lifted in 0.22.0 (node-tree-sitter 9ea6558), not 0.25; and the PHP collapsed-enum workaround no longer cites an ABI ceiling this bump removes. Leaves the node-gyp 12 pin and the Node 20 matrix from #228 untouched. --- .github/dependabot.yml | 4 ++++ CHANGELOG.md | 16 ++++++++++++++ package-lock.json | 48 ++++++++++++++++++------------------------ package.json | 27 ++++++++++++++++++------ src/graph/extract.ts | 14 ++++++------ 5 files changed, 70 insertions(+), 39 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 39240b5d2..a26080a18 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,6 +5,10 @@ updates: schedule: interval: weekly open-pull-requests-limit: 10 + ignore: + # Upgrading this independently of the pinned tree-sitter runtime breaks + # peer resolution; see the overrides block in package.json. + - dependency-name: tree-sitter-typescript - package-ecosystem: github-actions directory: / diff --git a/CHANGELOG.md b/CHANGELOG.md index 335cadf10..b5aabbccf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## Unreleased + +### Changed + +- **tree-sitter runtime bumped to 0.25**, with `tree-sitter-python` and + `tree-sitter-go` moved to `0.25.x` to match its peer range. The grammars that + declare an older peer range — `tree-sitter-java`, `tree-sitter-kotlin`, + `tree-sitter-php`, `tree-sitter-r` and `tree-sitter-typescript` — join + `tree-sitter-swift` in the `overrides` block, so the tree resolves to exactly + one copy of `tree-sitter`. All eight grammars were verified to load and parse + under 0.25.1; the stale peer metadata does not reflect an ABI break. The + `overrides` key for R must be the alias `tree-sitter-r`, not + `@davisvaughan/tree-sitter-r` (unlike `allowScripts`, which keys by the + resolved package). `allowScripts` keys were updated for the three moved + versions. Dependabot is told not to bump `tree-sitter-typescript` on its own. + ## 0.16.0 ### Added diff --git a/package-lock.json b/package-lock.json index 6c95fb206..3e435ac61 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,12 +15,12 @@ "dotenv": "^17.4.2", "gray-matter": "^4.0.3", "openai": "^6.45.0", - "tree-sitter": "^0.21.1", - "tree-sitter-go": "^0.23.4", + "tree-sitter": "^0.25.0", + "tree-sitter-go": "^0.25.0", "tree-sitter-java": "^0.23.5", "tree-sitter-kotlin": "^0.3.8", "tree-sitter-php": "^0.23.4", - "tree-sitter-python": "^0.21.0", + "tree-sitter-python": "^0.25.0", "tree-sitter-r": "npm:@davisvaughan/tree-sitter-r@^1.3.0", "tree-sitter-swift": "^0.7.1", "tree-sitter-typescript": "^0.23.2", @@ -1070,14 +1070,14 @@ } }, "node_modules/tree-sitter": { - "version": "0.21.1", - "resolved": "https://registry.npmjs.org/tree-sitter/-/tree-sitter-0.21.1.tgz", - "integrity": "sha512-7dxoA6kYvtgWw80265MyqJlkRl4yawIjO7S5MigytjELkX43fV2WsAXzsNfO7sBpPPCF5Gp0+XzHk0DwLCq3xQ==", + "version": "0.25.1", + "resolved": "https://registry.npmjs.org/tree-sitter/-/tree-sitter-0.25.1.tgz", + "integrity": "sha512-mrcEdkYtHfrK1A6fs3O6FxkBo0Qig5XUXqHhxUOQu0bmPo00QF4XaSx4edpazdHwxnSCjlGKGgIqWdaN4dvTLA==", "hasInstallScript": true, "license": "MIT", "dependencies": { - "node-addon-api": "^8.0.0", - "node-gyp-build": "^4.8.0" + "node-addon-api": "^8.5.0", + "node-gyp-build": "^4.8.4" } }, "node_modules/tree-sitter-cli": { @@ -1094,17 +1094,17 @@ } }, "node_modules/tree-sitter-go": { - "version": "0.23.4", - "resolved": "https://registry.npmjs.org/tree-sitter-go/-/tree-sitter-go-0.23.4.tgz", - "integrity": "sha512-iQaHEs4yMa/hMo/ZCGqLfG61F0miinULU1fFh+GZreCRtKylFLtvn798ocCZjO2r/ungNZgAY1s1hPFyAwkc7w==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/tree-sitter-go/-/tree-sitter-go-0.25.0.tgz", + "integrity": "sha512-APBc/Dq3xz/e35Xpkhb1blu5UgW+2E3RyGWawZSCNcbGwa7jhSQPS8KsUupuzBla8PCo8+lz9W/JDJjmfRa2tw==", "hasInstallScript": true, "license": "MIT", "dependencies": { - "node-addon-api": "^8.2.1", - "node-gyp-build": "^4.8.2" + "node-addon-api": "^8.3.1", + "node-gyp-build": "^4.8.4" }, "peerDependencies": { - "tree-sitter": "^0.21.1" + "tree-sitter": "^0.25.0" }, "peerDependenciesMeta": { "tree-sitter": { @@ -1195,30 +1195,24 @@ } }, "node_modules/tree-sitter-python": { - "version": "0.21.0", - "resolved": "https://registry.npmjs.org/tree-sitter-python/-/tree-sitter-python-0.21.0.tgz", - "integrity": "sha512-IUKx7JcTVbByUx1iHGFS/QsIjx7pqwTMHL9bl/NGyhyyydbfNrpruo2C7W6V4KZrbkkCOlX8QVrCoGOFW5qecg==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/tree-sitter-python/-/tree-sitter-python-0.25.0.tgz", + "integrity": "sha512-eCmJx6zQa35GxaCtQD+wXHOhYqBxEL+bp71W/s3fcDMu06MrtzkVXR437dRrCrbrDbyLuUDJpAgycs7ncngLXw==", "hasInstallScript": true, "license": "MIT", "dependencies": { - "node-addon-api": "^7.1.0", - "node-gyp-build": "^4.8.0" + "node-addon-api": "^8.5.0", + "node-gyp-build": "^4.8.4" }, "peerDependencies": { - "tree-sitter": "^0.21.0" + "tree-sitter": "^0.25.0" }, "peerDependenciesMeta": { - "tree_sitter": { + "tree-sitter": { "optional": true } } }, - "node_modules/tree-sitter-python/node_modules/node-addon-api": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz", - "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==", - "license": "MIT" - }, "node_modules/tree-sitter-r": { "name": "@davisvaughan/tree-sitter-r", "version": "1.3.0", diff --git a/package.json b/package.json index bce6fa588..83bf9ace2 100644 --- a/package.json +++ b/package.json @@ -60,12 +60,12 @@ "dotenv": "^17.4.2", "gray-matter": "^4.0.3", "openai": "^6.45.0", - "tree-sitter": "^0.21.1", - "tree-sitter-go": "^0.23.4", + "tree-sitter": "^0.25.0", + "tree-sitter-go": "^0.25.0", "tree-sitter-java": "^0.23.5", "tree-sitter-kotlin": "^0.3.8", "tree-sitter-php": "^0.23.4", - "tree-sitter-python": "^0.21.0", + "tree-sitter-python": "^0.25.0", "tree-sitter-r": "npm:@davisvaughan/tree-sitter-r@^1.3.0", "tree-sitter-swift": "^0.7.1", "tree-sitter-typescript": "^0.23.2", @@ -84,10 +84,10 @@ "typescript": "^6.0.3" }, "allowScripts": { - "tree-sitter@0.21.1": true, + "tree-sitter@0.25.1": true, "tree-sitter-typescript@0.23.2": true, - "tree-sitter-python@0.21.0": true, - "tree-sitter-go@0.23.4": true, + "tree-sitter-python@0.25.0": true, + "tree-sitter-go@0.25.0": true, "tree-sitter-javascript@0.23.1": true, "tree-sitter-java@0.23.5": true, "esbuild@0.28.2": true, @@ -98,8 +98,23 @@ "tree-sitter-swift@0.7.1": true }, "overrides": { + "tree-sitter-java": { + "tree-sitter": "$tree-sitter" + }, + "tree-sitter-kotlin": { + "tree-sitter": "$tree-sitter" + }, + "tree-sitter-php": { + "tree-sitter": "$tree-sitter" + }, + "tree-sitter-r": { + "tree-sitter": "$tree-sitter" + }, "tree-sitter-swift": { "tree-sitter": "$tree-sitter" + }, + "tree-sitter-typescript": { + "tree-sitter": "$tree-sitter" } } } diff --git a/src/graph/extract.ts b/src/graph/extract.ts index d0f9dff19..fd2c2b4f7 100644 --- a/src/graph/extract.ts +++ b/src/graph/extract.ts @@ -374,11 +374,12 @@ interface DefDescriptor { variadic?: boolean; // last parameter is a vararg, so `arity` is a minimum } -/** tree-sitter's string `parse()` fails with "Invalid argument" on any input - * ≥ 32 KB, which silently drops large files — often the most important ones (a - * 2000-line command module, a core tab implementation). The callback form has - * no such limit as long as each returned chunk is under 32 KB, so we always feed - * the source in <32 KB slices. Code-unit indexing matches `String.slice`. */ +/** The chunked-callback parse predates tree-sitter 0.22, which lifted the + * string `parse()` size limit that used to fail with "Invalid argument" on + * any input ≥ 32 KB and silently drop large files — often the most important + * ones (a 2000-line command module, a core tab implementation). Kept because + * it is behavior-identical and exercised by existing tests. Code-unit + * indexing matches `String.slice`. */ const PARSE_CHUNK = 16384; function parseSource(source: string): Parser.SyntaxNode { return parser.parse((index: number) => source.slice(index, index + PARSE_CHUNK)).rootNode; @@ -457,7 +458,8 @@ export function mintId(base: string, minted: Set): string { * tree-sitter-php 0.23.x cannot parse a `const` inside an enum body (#145). An * array initializer collapses the whole `enum_declaration` into ERROR; the * method is recovered as a sibling `function_definition`. 0.24.2 parses this - * natively but is ABI 15 and cannot load on Graft's tree-sitter 0.21.1. + * natively, and the 0.25 runtime can load it, so this workaround stands only + * until tree-sitter-php is bumped separately — it stops firing once it is. * * Bound: only an ERROR that already contains `enum_case` + `name` is treated as * a collapsed enum. Only `const_declaration` / `function_definition` /