From 7db0eca372e9843021f44335b8667533f0072905 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Tue, 9 Sep 2025 19:29:17 +0300 Subject: [PATCH 01/11] chore: track submodule release branch --- .gitmodules | 5 +++-- vendor/tree-sitter | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitmodules b/.gitmodules index 08707772..fd28697f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,4 @@ [submodule "vendor/tree-sitter"] - path = vendor/tree-sitter - url = https://github.com/tree-sitter/tree-sitter.git + path = vendor/tree-sitter + url = https://github.com/tree-sitter/tree-sitter.git + branch = release-0.25 diff --git a/vendor/tree-sitter b/vendor/tree-sitter index 460118b4..da6fe9be 160000 --- a/vendor/tree-sitter +++ b/vendor/tree-sitter @@ -1 +1 @@ -Subproject commit 460118b4c82318b083b4d527c9c750426730f9c0 +Subproject commit da6fe9beb4f7f67beb75914ca8e0d48ae48d6406 From 9223197fa37983c327eefaa4536723e5f06bbada Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Tue, 9 Sep 2025 19:31:51 +0300 Subject: [PATCH 02/11] ci(dependabot): enable dependency updates --- .github/dependabot.yml | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..f64d1130 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,44 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + day: sunday + cooldown: + default-days: 3 + commit-message: + prefix: ci + labels: [dependencies] + open-pull-requests-limit: 1 + groups: + actions: + patterns: ["*"] + + - package-ecosystem: gitsubmodule + directory: / + schedule: + interval: weekly + day: friday + commit-message: + prefix: build + labels: [dependencies] + open-pull-requests-limit: 1 + groups: + submodules: + patterns: ["*"] + + - package-ecosystem: npm + directory: / + schedule: + interval: weekly + day: saturday + cooldown: + default-days: 3 + commit-message: + prefix: build + labels: [dependencies] + open-pull-requests-limit: 1 + groups: + npm: + patterns: ["*"] From 2a01b2138b0c3d6dd40392f1b77c6fe095940237 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Tue, 9 Sep 2025 19:39:26 +0300 Subject: [PATCH 03/11] chore: add editorconfig --- .editorconfig | 16 ++++++++++++++++ tsconfig.json | 34 +++++++++++++++++----------------- tsconfig.typedoc.json | 12 ++++++------ typedoc.json | 2 +- 4 files changed, 40 insertions(+), 24 deletions(-) create mode 100644 .editorconfig diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..095d62c1 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true +max_line_length = off + +[*.{cc,h}] +max_line_length = 120 + +[*.js] +max_line_length = 120 diff --git a/tsconfig.json b/tsconfig.json index 2873553e..8245bca8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,19 +1,19 @@ { - "compilerOptions": { - "checkJs": true, - "allowJs": true, - "noEmit": true, - "strict": true, - "strictNullChecks": false, - "noImplicitAny": false, - "lib": [ - "es2020" - ] - }, - "include": [ - "./test/*.js" - ], - "exclude": [ - "node_modules" - ] + "compilerOptions": { + "checkJs": true, + "allowJs": true, + "noEmit": true, + "strict": true, + "strictNullChecks": false, + "noImplicitAny": false, + "lib": [ + "es2020" + ] + }, + "include": [ + "test/*.js" + ], + "exclude": [ + "node_modules" + ] } diff --git a/tsconfig.typedoc.json b/tsconfig.typedoc.json index ca60b972..63b6c640 100644 --- a/tsconfig.typedoc.json +++ b/tsconfig.typedoc.json @@ -1,8 +1,8 @@ { - "compilerOptions": { - "allowJs": false - }, - "include": [ - "./tree-sitter.d.ts" - ] + "compilerOptions": { + "allowJs": false + }, + "include": [ + "tree-sitter.d.ts" + ] } diff --git a/typedoc.json b/typedoc.json index e37793a5..7f5de385 100644 --- a/typedoc.json +++ b/typedoc.json @@ -2,7 +2,7 @@ "$schema": "https://typedoc.org/schema.json", "entryPoints": ["tree-sitter.d.ts"], "entryPointStrategy": "expand", - "tsconfig": "./tsconfig.typedoc.json", + "tsconfig": "tsconfig.typedoc.json", "out": "docs/api", "readme": "README.md", "cleanOutputDir": true, From 06e4763c7fa750252262de8e147002156763e4ce Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Tue, 9 Sep 2025 19:40:13 +0300 Subject: [PATCH 04/11] chore: remove npmignore --- .npmignore | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 .npmignore diff --git a/.npmignore b/.npmignore deleted file mode 100644 index 9c85d0f6..00000000 --- a/.npmignore +++ /dev/null @@ -1,12 +0,0 @@ -test - -out -build -prebuilds - -vendor/tree-sitter/**/* -!vendor/tree-sitter/lib/src/**/*.{c,h} -!vendor/tree-sitter/lib/include/tree_sitter/api.h - -.github/ -.vscode/ From 3b1a9699b19375a33ecdce7bac00f0f2a50bae6c Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Tue, 9 Sep 2025 19:53:04 +0300 Subject: [PATCH 05/11] ci: update & improve workflows - Update actions & Node.js and use arm runners - Enable trusted publishing and attestations --- .github/workflows/ci.yml | 60 +++++++++++++++-------------------- .github/workflows/docs.yml | 9 +++--- .github/workflows/publish.yml | 26 +++++++++------ 3 files changed, 45 insertions(+), 50 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e7443f06..696b23b3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,11 +2,9 @@ name: CI on: push: - branches: - - master + branches: [master] pull_request: - branches: - - master + branches: [master] workflow_call: concurrency: @@ -18,58 +16,50 @@ jobs: strategy: matrix: os: - - windows-latest - - macos-latest - - ubuntu-22.04 + - windows-2025 + - windows-11-arm + - macos-15 + - macos-15-intel + - ubuntu-24.04 + - ubuntu-24.04-arm node: - - 18 - - 20 - - 22 + - 20.19.6 + - 22.21.1 + - 24.12.0 + - 25.2.1 fail-fast: false - name: Test Node ${{ matrix.node }} on ${{ matrix.os }} - runs-on: ${{ matrix.os }} + name: Test Node ${{matrix.node}} on ${{matrix.os}} + runs-on: ${{matrix.os}} defaults: run: shell: bash steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: submodules: true - fetch-depth: 0 - name: Setup Node - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: - node-version: ${{ matrix.node }} - - - name: Install dependencies - run: npm ci --legacy-peer-deps + node-version: ${{matrix.node}} - name: Set npm_config_target - run: echo "CONFIG_TARGET=${{ matrix.node == 22 && '22.12.0' || '20.9.0' }}" >> $GITHUB_ENV + run: printf 'npm_config_target=${{matrix.node}}\n' >> "$GITHUB_ENV" - - name: Build x64 binary - run: npm_config_target=${{ env.CONFIG_TARGET }} npm x -- prebuildify --napi --arch x64 -t 20.9.0 - - - name: Set up cross-compilation - if: runner.os == 'Linux' - run: |- - sudo apt-get update - sudo apt-get install g++-aarch64-linux-gnu - printf '%s\n' >> "$GITHUB_ENV" \ - 'CC=aarch64-linux-gnu-gcc' 'CXX=aarch64-linux-gnu-g++' + - name: Install dependencies + run: npm ci --legacy-peer-deps - - name: Build arm64 binary - run: npm_config_target=${{ env.CONFIG_TARGET }} npm x -- prebuildify --napi --arch arm64 -t 20.9.0 + - name: Build binary + run: npm x -- prebuildify --napi - name: Run tests run: npm test - name: Upload prebuilds - uses: actions/upload-artifact@v4 - if: github.ref_type == 'tag' && matrix.node == 20 + uses: actions/upload-artifact@v6 + if: github.ref_type == 'tag' && startsWith(matrix.node, '24') with: path: prebuilds/** - name: prebuilds-${{matrix.os}} + name: prebuilds-${{runner.os}}-${{runner.arch}} retention-days: 2 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 430536af..9ea3a647 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -26,21 +26,20 @@ jobs: url: ${{steps.deployment.outputs.page_url}} steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: submodules: true - fetch-depth: 0 - name: Setup Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: - node-version: 20 + node-version: 24 cache: 'npm' - name: Install dependencies run: npm ci - name: Generate documentation run: npm run docs - name: Upload pages artifact - uses: actions/upload-pages-artifact@v3 + uses: actions/upload-pages-artifact@v4 with: path: docs/api - name: Deploy to GitHub Pages diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9af6b721..0a11993a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,22 +12,26 @@ jobs: publish: name: Publish runs-on: ubuntu-latest + environment: npm + permissions: + id-token: write + attestations: write + contents: read needs: build steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: submodules: true - fetch-depth: 0 - name: Setup Node - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: - node-version: 20 + node-version: 24 registry-url: https://registry.npmjs.org - name: Download prebuilds - uses: actions/download-artifact@v4 + uses: actions/download-artifact@v7 with: path: prebuilds pattern: prebuilds-* @@ -41,8 +45,6 @@ jobs: - name: Publish to NPM run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Prepare release artifacts run: | @@ -53,8 +55,12 @@ jobs: done ls -l dist + - name: Generate attestations + uses: actions/attest-build-provenance@v3 + with: + subject-path: dist/* + - name: Create release - run: |- - gh release create ${{ github.ref_name }} --generate-notes dist/* + run: gh release create "$GITHUB_REF_NAME" --generate-notes dist/* env: - GH_TOKEN: ${{ github.token }} + GH_TOKEN: ${{github.token}} From 43730f7c787ea90441fe2ebb0ab36f925135b161 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Tue, 9 Sep 2025 19:59:14 +0300 Subject: [PATCH 06/11] build: improve cflags --- binding.gyp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/binding.gyp b/binding.gyp index bb40aa7e..786d17d8 100644 --- a/binding.gyp +++ b/binding.gyp @@ -24,14 +24,11 @@ "defines": [ "NAPI_VERSION=<(napi_build_version)", ], - "cflags_cc": [ - "-std=c++17" - ], "conditions": [ ["OS=='mac'", { "xcode_settings": { "GCC_SYMBOLS_PRIVATE_EXTERN": "YES", # -fvisibility=hidden - "CLANG_CXX_LANGUAGE_STANDARD": "c++17", + "CLANG_CXX_LANGUAGE_STANDARD": "<(cxxstd)", "MACOSX_DEPLOYMENT_TARGET": "10.9", }, }], @@ -39,7 +36,7 @@ "msvs_settings": { "VCCLCompilerTool": { "AdditionalOptions": [ - "/std:c++17", + "/std:<(cxxstd)", ], "RuntimeLibrary": 0, }, @@ -47,7 +44,9 @@ }], ["OS == 'linux'", { "cflags_cc": [ - "-Wno-cast-function-type" + "-std=<(cxxstd)", + "-fvisibility=hidden", + "-Wno-cast-function-type", ] }], ] @@ -62,13 +61,21 @@ "vendor/tree-sitter/lib/src", "vendor/tree-sitter/lib/include", ], - "cflags": [ - "-std=c11" - ], "defines": [ "_POSIX_C_SOURCE=200112L", "_DEFAULT_SOURCE", - ] + ], + "conditions": [ + ["OS!='win'", { + "cflags_c": [ + "-std=c11", + ], + }, { # OS == "win" + "cflags_c": [ + "/std:c11", + ], + }], + ], } ], "variables": { @@ -76,5 +83,6 @@ "openssl_fips": "", "v8_enable_pointer_compression%": 0, "v8_enable_31bit_smis_on_64bit_arch%": 0, + "cxxstd%": " Date: Fri, 12 Sep 2025 19:02:27 +0300 Subject: [PATCH 07/11] feat: implement SyntaxNode.toJSON --- index.js | 9 +++++++++ tree-sitter.d.ts | 5 +++++ 2 files changed, 14 insertions(+) diff --git a/index.js b/index.js index 9a57b365..7ad7a290 100644 --- a/index.js +++ b/index.js @@ -239,6 +239,15 @@ class SyntaxNode { return NodeMethods.toString(this.tree); } + toJSON() { + return { + type: this.type, + startPosition: this.startPosition, + endPosition: this.endPosition, + childCount: this.childCount, + } + } + child(index) { marshalNode(this); return unmarshalNode(NodeMethods.child(this.tree, index), this.tree); diff --git a/tree-sitter.d.ts b/tree-sitter.d.ts index 4fd5c601..78489481 100644 --- a/tree-sitter.d.ts +++ b/tree-sitter.d.ts @@ -340,6 +340,11 @@ declare module "tree-sitter" { */ toString(): string; + /** + * Convert this node to its JSON representation + */ + toJSON(): object; + /** * Get the node's child at the given index, where zero represents the first child. * From 4387e90f19ba2f9e33de638771a7483c7217f3dc Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Fri, 12 Sep 2025 19:29:36 +0300 Subject: [PATCH 08/11] fix: improve type declarations --- index.js | 23 +++++--- test/lookahead_iterable_test.js | 3 +- test/node_test.js | 22 ++++---- test/parser_test.js | 6 ++- test/query_test.js | 3 +- test/tree_test.js | 3 +- tree-sitter.d.ts | 93 ++++++++++++++++++--------------- tsconfig.json | 2 +- 8 files changed, 90 insertions(+), 65 deletions(-) diff --git a/index.js b/index.js index 7ad7a290..c9639e7d 100644 --- a/index.js +++ b/index.js @@ -18,10 +18,10 @@ Object.defineProperty(Tree.prototype, 'rootNode', { Due to a race condition arising from Jest's worker pool, "this" has no knowledge of the native extension if the extension has not yet loaded when multiple Jest tests are being run simultaneously. - If the extension has correctly loaded, "this" should be an instance + If the extension has correctly loaded, "this" should be an instance of the class whose prototype we are acting on (in this case, Tree). - Furthermore, the race condition sometimes results in the function in - question being undefined even when the context is correct, so we also + Furthermore, the race condition sometimes results in the function in + question being undefined even when the context is correct, so we also perform a null function check. */ if (this instanceof Tree && rootNode) { @@ -61,7 +61,10 @@ Tree.prototype.walk = function() { class SyntaxNode { constructor(tree) { - this.tree = tree; + Object.defineProperty(this, 'tree', { + value: tree, + enumerable: true + }); } [util.inspect.custom]() { @@ -903,8 +906,16 @@ function initializeLanguageNodeClasses(language) { const className = camelCase(typeName, true) + 'Node'; const nodeSubclass = eval(`class ${className} extends SyntaxNode {${classBody}}; ${className}`); - nodeSubclass.prototype.type = typeName; - nodeSubclass.prototype.fields = Object.freeze(fieldNames.sort()) + Object.defineProperties(nodeSubclass.prototype, { + type: { + value: typeName, + enumerable: true + }, + fields: { + value: Object.freeze(fieldNames.sort()), + enumerable: true + } + }); nodeSubclasses[id] = nodeSubclass; } diff --git a/test/lookahead_iterable_test.js b/test/lookahead_iterable_test.js index 0cd3caa7..dd237841 100644 --- a/test/lookahead_iterable_test.js +++ b/test/lookahead_iterable_test.js @@ -1,4 +1,5 @@ -/** @type {typeof import('tree-sitter')} */ +/// +/** @type {typeof import("tree-sitter")} */ const Parser = require("../index.js"); const Rust = require("tree-sitter-rust"); const assert = require('node:assert'); diff --git a/test/node_test.js b/test/node_test.js index 8424f517..c6c1fe1a 100644 --- a/test/node_test.js +++ b/test/node_test.js @@ -1,5 +1,6 @@ -/** @type {typeof import('tree-sitter')} */ -const Parser = require("../index.js"); +/// +/** @type {typeof import("tree-sitter")} */ +const Parser = require("../index"); const C = require('tree-sitter-c'); const EmbeddedTemplate = require('tree-sitter-embedded-template'); @@ -64,17 +65,15 @@ describe("Node", () => { `); const classNode = tree.rootNode.firstChild; - // @ts-ignore assert.deepEqual(classNode.fields, ['bodyNode', 'decoratorNodes', 'nameNode']) - // @ts-ignore const methodNode = classNode.bodyNode.firstNamedChild; assert.equal(methodNode.constructor.name, 'MethodDefinitionNode'); assert.equal(methodNode.nameNode.text, 'b'); assert.deepEqual(methodNode.fields, ['bodyNode', 'decoratorNodes', 'nameNode', 'parametersNode']) const decoratorNodes = methodNode.decoratorNodes; - assert.deepEqual(decoratorNodes.map(_ => _.text), ['@autobind', '@something']) + assert.deepEqual(decoratorNodes.map(n => n.text), ['@autobind', '@something']) const paramsNode = methodNode.parametersNode; assert.equal(paramsNode.constructor.name, 'FormalParametersNode'); @@ -707,14 +706,14 @@ describe("Node", () => { describe(".text", () => { Object.entries({ - '.parse(String)': (parser, src) => parser.parse(src), - '.parse(Function)': (parser, src) => - parser.parse(offset => src.substr(offset, 4)), + '.parse(String)': (/** @type {import('tree-sitter')} */ parser, /** @type {string} */ src) => parser.parse(src), + '.parse(Function)': (/** @type {import('tree-sitter')} */ parser, /** @type {string} */ src) => + parser.parse(offset => src.substring(offset, offset + 4)), }).forEach(([method, parse]) => it(`returns the text of a node generated by ${method}`, async () => { const src = "α0 / b👎c👎" const [numeratorSrc, denominatorSrc] = src.split(/\s*\/\s+/) - const tree = await parse(parser, src) + const tree = parse(parser, src) const quotientNode = tree.rootNode.firstChild.firstChild; const [numerator, slash, denominator] = quotientNode.children; @@ -921,10 +920,8 @@ describe("Node", () => { it("shouldn't segfault when accessing properties on the prototype", () => { const tree = parser.parse('2 + 2'); const nodePrototype = Object.getPrototypeOf(tree.rootNode); - // const nodePrototype = tree.rootNode.__proto__; const properties = [ - "type", "typeId", "isNamed", "isMissing", @@ -950,6 +947,9 @@ describe("Node", () => { "previousSibling", "previousNamedSibling", ]; + if (nodePrototype.constructor.name === "SyntaxNode") { + assert.throws(() => { nodePrototype.type; }, TypeError) + } for (const property of properties) { assert.throws(() => { nodePrototype[property]; }, TypeError) } diff --git a/test/parser_test.js b/test/parser_test.js index 11dd2b12..0f9099d2 100644 --- a/test/parser_test.js +++ b/test/parser_test.js @@ -1,4 +1,5 @@ -/** @type {typeof import('tree-sitter')} */ +/// +/** @type {typeof import("tree-sitter")} */ const Parser = require("../index.js"); const HTML = require('tree-sitter-html'); const JavaScript = require('tree-sitter-javascript'); @@ -17,6 +18,7 @@ describe("Parser", () => { describe(".setLanguage", () => { it("throws an exception when the supplied object is not a tree-sitter language", () => { + // @ts-expect-error: Invalid language assert.throws(() => parser.setLanguage({}), /Invalid language/); assert.throws(() => parser.setLanguage(undefined), /Invalid language/); }); @@ -166,7 +168,7 @@ describe("Parser", () => { describe("when the input callback returns something other than a string", () => { it("stops reading", () => { - const parts = ["abc", "def", "ghi", {}, {}, {}, "second-word", " "]; + const parts = ["abc", "def", "ghi", null, null, null, "second-word", " "]; const tree = parser.parse(() => parts.shift()); assert.equal( tree.rootNode.toString(), diff --git a/test/query_test.js b/test/query_test.js index 05ce1a34..da7e86df 100644 --- a/test/query_test.js +++ b/test/query_test.js @@ -1,4 +1,5 @@ -/** @type {typeof import('tree-sitter')} */ +/// +/** @type {typeof import("tree-sitter")} */ const Parser = require("../index.js"); const C = require("tree-sitter-c"); diff --git a/test/tree_test.js b/test/tree_test.js index 924aa601..d6a4a469 100644 --- a/test/tree_test.js +++ b/test/tree_test.js @@ -1,4 +1,5 @@ -/** @type {typeof import('tree-sitter')} */ +/// +/** @type {typeof import("tree-sitter")} */ const Parser = require("../index.js"); const JavaScript = require('tree-sitter-javascript'); const Rust = require('tree-sitter-rust'); diff --git a/tree-sitter.d.ts b/tree-sitter.d.ts index 78489481..c964a9b7 100644 --- a/tree-sitter.d.ts +++ b/tree-sitter.d.ts @@ -187,13 +187,13 @@ declare module "tree-sitter" { * @param position - Optional position in the text as {row, column} * @returns A string chunk, or null/undefined if no text at this index */ - (index: number, position?: Point): string | null | undefined | {}; + (index: number, position?: Point): string | null | undefined; } /** The syntax tree that contains this node */ export interface SyntaxNode { /** The syntax tree that contains this node */ - tree: Tree; + readonly tree: Tree; /** * A unique numeric identifier for this node. @@ -201,139 +201,144 @@ declare module "tree-sitter" { * If a new tree is created based on an older tree and reuses * a node, that node will have the same id in both trees. */ - id: number; + readonly id: number; /** * This node's type as a numeric id */ - typeId: number; + readonly typeId: number; /** * This node's type as a numeric id as it appears in the grammar, * ignoring aliases */ - grammarId: number; + readonly grammarId: number; /** * This node's type as a string */ - type: string; + readonly type: string; /** * This node's symbol name as it appears in the grammar, * ignoring aliases */ - grammarType: string; + readonly grammarType: string; /** * Whether this node is named. * Named nodes correspond to named rules in the grammar, * whereas anonymous nodes correspond to string literals in the grammar. */ - isNamed: boolean; + readonly isNamed: boolean; /** * Whether this node is missing. * Missing nodes are inserted by the parser in order to * recover from certain kinds of syntax errors. */ - isMissing: boolean; + readonly isMissing: boolean; /** * Whether this node is extra. * Extra nodes represent things like comments, which are not * required by the grammar but can appear anywhere. */ - isExtra: boolean; + readonly isExtra: boolean; /** * Whether this node has been edited */ - hasChanges: boolean; + readonly hasChanges: boolean; /** * Whether this node represents a syntax error or contains * any syntax errors within it */ - hasError: boolean; + readonly hasError: boolean; /** * Whether this node represents a syntax error. * Syntax errors represent parts of the code that could not * be incorporated into a valid syntax tree. */ - isError: boolean; + readonly isError: boolean; /** The text content for this node from the source code */ - text: string; + readonly text: string; /** The parse state of this node */ - parseState: number; + readonly parseState: number; /** The parse state that follows this node */ - nextParseState: number; + readonly nextParseState: number; /** The position where this node starts in terms of rows and columns */ - startPosition: Point; + readonly startPosition: Point; /** The position where this node ends in terms of rows and columns */ - endPosition: Point; + readonly endPosition: Point; /** The byte offset where this node starts */ - startIndex: number; + readonly startIndex: number; /** The byte offset where this node ends */ - endIndex: number; + readonly endIndex: number; /** * This node's immediate parent. * For iterating over ancestors, prefer using {@link childWithDescendant} */ - parent: SyntaxNode | null; + readonly parent: SyntaxNode | null; /** Array of all child nodes */ - children: Array; + readonly children: Array; /** Array of all named child nodes */ - namedChildren: Array; + readonly namedChildren: Array; /** The number of children this node has */ - childCount: number; + readonly childCount: number; /** * The number of named children this node has. * @see {@link isNamed} */ - namedChildCount: number; + readonly namedChildCount: number; /** The first child of this node */ - firstChild: SyntaxNode | null; + readonly firstChild: SyntaxNode | null; /** The first named child of this node */ - firstNamedChild: SyntaxNode | null; + readonly firstNamedChild: SyntaxNode | null; /** The last child of this node */ - lastChild: SyntaxNode | null; + readonly lastChild: SyntaxNode | null; /** The last child of this node */ - lastNamedChild: SyntaxNode | null; + readonly lastNamedChild: SyntaxNode | null; /** This node's next sibling */ - nextSibling: SyntaxNode | null; + readonly nextSibling: SyntaxNode | null; /** This node's next named sibling */ - nextNamedSibling: SyntaxNode | null; + readonly nextNamedSibling: SyntaxNode | null; /** This node's previous sibling */ - previousSibling: SyntaxNode | null; + readonly previousSibling: SyntaxNode | null; /** This node's previous named sibling */ - previousNamedSibling: SyntaxNode | null; + readonly previousNamedSibling: SyntaxNode | null; /** * The number of descendants this node has, including itself */ - descendantCount: number; + readonly descendantCount: number; + + /** + * The names of extra fields available in the subclass, if any. + */ + readonly fields: Array<`${string}Node` | `${string}Nodes`>; /** * Convert this node to its string representation @@ -549,6 +554,10 @@ declare module "tree-sitter" { * @returns A new cursor positioned at this node */ walk(): TreeCursor; + + readonly [name: `${string}Node`]: SyntaxNode; + + readonly [name: `${string}Nodes`]: Array; } /** A stateful object for walking a syntax {@link Tree} efficiently */ @@ -631,7 +640,7 @@ declare module "tree-sitter" { /** * Move this cursor to the last child of its current node. - * Note: This may be slower than gotoFirstChild() as it needs to iterate + * Note: This may be slower than gotoFirstChild() as it needs to iterate * through all children to compute the position. * * @returns true if cursor successfully moved, false if there were no children @@ -701,7 +710,7 @@ declare module "tree-sitter" { /** * Edit the syntax tree to keep it in sync with source code that has been edited. - * The edit must be described both in terms of byte offsets and in terms of + * The edit must be described both in terms of byte offsets and in terms of * row/column coordinates. * * @param edit - The edit to apply to the tree @@ -725,11 +734,11 @@ declare module "tree-sitter" { getText(node: SyntaxNode): string; /** - * Compare this edited syntax tree to a new syntax tree representing the + * Compare this edited syntax tree to a new syntax tree representing the * same document, returning ranges whose syntactic structure has changed. * * For this to work correctly, this tree must have been edited to match - * the new tree's ranges. Generally, you'll want to call this right after + * the new tree's ranges. Generally, you'll want to call this right after * parsing, using the old tree that was passed to parse and the new tree * that was returned. * @@ -776,7 +785,7 @@ declare module "tree-sitter" { * A match of a {@link Query} to a particular set of {@link SyntaxNode}s. */ export interface QueryMatch { - /** + /** * The index of the pattern that was matched. * Each pattern in a query is assigned a numeric index in sequence. */ @@ -955,7 +964,7 @@ declare module "tree-sitter" { * This returns `null` if the state is invalid for this language. * * Iterating {@link LookaheadIterator} will yield valid symbols in the given - * parse state. Newly created lookahead iterators will have {@link currentType} + * parse state. Newly created lookahead iterators will have {@link currentType} * populated with the `ERROR` symbol. * * Lookahead iterators can be useful to generate suggestions and improve @@ -1035,9 +1044,9 @@ declare module "tree-sitter" { /** Information about a language */ interface Language { /** The name of the language */ - name: string; + name?: string; /** The inner language object */ - language: Language; + language: unknown; /** The node type information of the language */ nodeTypeInfo: NodeInfo[]; } diff --git a/tsconfig.json b/tsconfig.json index 8245bca8..47536892 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,7 +7,7 @@ "strictNullChecks": false, "noImplicitAny": false, "lib": [ - "es2020" + "ES2020" ] }, "include": [ From 7540e9f06451486bb18942c861a33431b3f50fce Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Sun, 28 Sep 2025 10:20:40 +0300 Subject: [PATCH 09/11] refactor: generate node subclasses without eval --- index.js | 49 +++++++++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/index.js b/index.js index c9639e7d..0bf3bef5 100644 --- a/index.js +++ b/index.js @@ -867,7 +867,8 @@ function initializeLanguageNodeClasses(language) { const nodeTypeInfo = language.nodeTypeInfo || []; const nodeSubclasses = []; - for (let id = 0, n = nodeTypeNamesById.length; id < n; id++) { + + for (let id = 0, n = nodeTypeNamesById.length; id < n; ++id) { nodeSubclasses[id] = SyntaxNode; const typeName = nodeTypeNamesById[id]; @@ -877,7 +878,8 @@ function initializeLanguageNodeClasses(language) { if (!typeInfo) continue; const fieldNames = []; - let classBody = '\n'; + const fieldGetters = {}; + if (typeInfo.fields) { for (const fieldName in typeInfo.fields) { const fieldId = nodeFieldNamesById.indexOf(fieldName); @@ -885,28 +887,38 @@ function initializeLanguageNodeClasses(language) { if (typeInfo.fields[fieldName].multiple) { const getterName = camelCase(fieldName) + 'Nodes'; fieldNames.push(getterName); - classBody += ` - get ${getterName}() { + fieldGetters[getterName] = { + get: function () { marshalNode(this); - return unmarshalNodes(NodeMethods.childNodesForFieldId(this.tree, ${fieldId}), this.tree); - } - `.replace(/\s+/g, ' ') + '\n'; + return unmarshalNodes( + NodeMethods.childNodesForFieldId(this.tree, fieldId), + this.tree + ); + }, + enumerable: true + }; } else { const getterName = camelCase(fieldName, false) + 'Node'; fieldNames.push(getterName); - classBody += ` - get ${getterName}() { + fieldGetters[getterName] = { + get: function () { marshalNode(this); - return unmarshalNode(NodeMethods.childNodeForFieldId(this.tree, ${fieldId}), this.tree); - } - `.replace(/\s+/g, ' ') + '\n'; + return unmarshalNode( + NodeMethods.childNodeForFieldId(this.tree, fieldId), + this.tree + ); + }, + enumerable: true + }; } } } - const className = camelCase(typeName, true) + 'Node'; - const nodeSubclass = eval(`class ${className} extends SyntaxNode {${classBody}}; ${className}`); - Object.defineProperties(nodeSubclass.prototype, { + nodeSubclasses[id] = new Function('SyntaxNode', ` + return class ${camelCase(typeName, true)}Node extends SyntaxNode {} + `)(SyntaxNode); + + Object.defineProperties(nodeSubclasses[id].prototype, { type: { value: typeName, enumerable: true @@ -914,14 +926,15 @@ function initializeLanguageNodeClasses(language) { fields: { value: Object.freeze(fieldNames.sort()), enumerable: true - } + }, + ...fieldGetters }); - nodeSubclasses[id] = nodeSubclass; } - language.nodeSubclasses = nodeSubclasses + language.nodeSubclasses = nodeSubclasses; } + function camelCase(name, upperCase) { name = name.replace(/_(\w)/g, (_match, letter) => letter.toUpperCase()); if (upperCase) name = name[0].toUpperCase() + name.slice(1); From 99479d2e5882add3bfe66792c4b951a912cfe806 Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Sat, 20 Dec 2025 11:50:33 +0200 Subject: [PATCH 10/11] build: update dependencies --- package-lock.json | 1184 +++++++++++---------------------------------- package.json | 26 +- 2 files changed, 308 insertions(+), 902 deletions(-) diff --git a/package-lock.json b/package-lock.json index 7c4c5640..94d6e136 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,58 +10,65 @@ "hasInstallScript": true, "license": "MIT", "dependencies": { - "node-addon-api": "^8.3.0", + "node-addon-api": "^8.5.0", "node-gyp-build": "^4.8.4" }, "devDependencies": { - "@types/node": "^22.10.2", + "@types/node": "^25.0.3", "@types/tmp": "^0.2.6", - "glob": "^11.0.0", - "node-gyp": "^11.0.0", + "glob": "^13.0.0", + "node-gyp": "^12.1.0", "prebuildify": "^6.0.1", - "tmp": "^0.2.3", - "tree-sitter-c": "^0.23.4", - "tree-sitter-embedded-template": "^0.23.2", + "tmp": "^0.2.5", + "tree-sitter-c": "^0.24.1", + "tree-sitter-embedded-template": "^0.25.0", "tree-sitter-html": "^0.23.2", "tree-sitter-java": "^0.23.5", - "tree-sitter-javascript": "^0.23.1", + "tree-sitter-javascript": "^0.25.0", "tree-sitter-json": "^0.24.8", - "tree-sitter-python": "^0.23.6", + "tree-sitter-python": "^0.25.0", "tree-sitter-ruby": "^0.23.1", - "tree-sitter-rust": "^0.23.2", - "typedoc": "^0.27.6", - "typedoc-plugin-rename-defaults": "^0.7.2", - "typescript": "^5.7.2" + "tree-sitter-rust": "^0.24.0", + "typedoc": "^0.28.15", + "typedoc-plugin-rename-defaults": "^0.7.3", + "typescript": "^5.9.3" } }, "node_modules/@gerrit0/mini-shiki": { - "version": "1.24.4", - "resolved": "https://registry.npmjs.org/@gerrit0/mini-shiki/-/mini-shiki-1.24.4.tgz", - "integrity": "sha512-YEHW1QeAg6UmxEmswiQbOVEg1CW22b1XUD/lNTliOsu0LD0wqoyleFMnmbTp697QE0pcadQiR5cVtbbAPncvpw==", + "version": "3.20.0", + "resolved": "https://registry.npmjs.org/@gerrit0/mini-shiki/-/mini-shiki-3.20.0.tgz", + "integrity": "sha512-Wa57i+bMpK6PGJZ1f2myxo3iO+K/kZikcyvH8NIqNNZhQUbDav7V9LQmWOXhf946mz5c1NZ19WMsGYiDKTryzQ==", "dev": true, "license": "MIT", "dependencies": { - "@shikijs/engine-oniguruma": "^1.24.2", - "@shikijs/types": "^1.24.2", - "@shikijs/vscode-textmate": "^9.3.1" + "@shikijs/engine-oniguruma": "^3.20.0", + "@shikijs/langs": "^3.20.0", + "@shikijs/themes": "^3.20.0", + "@shikijs/types": "^3.20.0", + "@shikijs/vscode-textmate": "^10.0.2" } }, - "node_modules/@isaacs/cliui": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "node_modules/@isaacs/balanced-match": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/@isaacs/balanced-match/-/balanced-match-4.0.1.tgz", + "integrity": "sha512-yzMTt9lEb8Gv7zRioUilSglI0c0smZ9k5D65677DLWLtWJaXIS3CqcGyUFByYKlnUj6TkjLVs54fBl6+TiGQDQ==", "dev": true, - "license": "ISC", + "license": "MIT", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@isaacs/brace-expansion": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@isaacs/brace-expansion/-/brace-expansion-5.0.0.tgz", + "integrity": "sha512-ZT55BDLV0yv0RBm2czMiZ+SqCGO7AvmOM3G/w2xhVPH+te0aKgFjmBvGlL1dH+ql2tgGO3MVrbb3jCKyvpgnxA==", + "dev": true, + "license": "MIT", "dependencies": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + "@isaacs/balanced-match": "^4.0.1" }, "engines": { - "node": ">=12" + "node": "20 || >=22" } }, "node_modules/@isaacs/fs-minipass": { @@ -78,72 +85,81 @@ } }, "node_modules/@npmcli/agent": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@npmcli/agent/-/agent-3.0.0.tgz", - "integrity": "sha512-S79NdEgDQd/NGCay6TCoVzXSj74skRZIKJcpJjC5lOq34SZzyI6MqtiiWoiVWoVrTcGjNeC4ipbh1VIHlpfF5Q==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/agent/-/agent-4.0.0.tgz", + "integrity": "sha512-kAQTcEN9E8ERLVg5AsGwLNoFb+oEG6engbqAU2P43gD4JEIkNGMHdVQ096FsOAAYpZPB0RSt0zgInKIAS1l5QA==", "dev": true, "license": "ISC", "dependencies": { "agent-base": "^7.1.0", "http-proxy-agent": "^7.0.0", "https-proxy-agent": "^7.0.1", - "lru-cache": "^10.0.1", + "lru-cache": "^11.2.1", "socks-proxy-agent": "^8.0.3" }, "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" } }, "node_modules/@npmcli/fs": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-4.0.0.tgz", - "integrity": "sha512-/xGlezI6xfGO9NwuJlnwz/K14qD1kCSAGtacBHnGzeAIuJGazcp45KP5NuyARXoKb7cwulAGWVsbeSxdG/cb0Q==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-5.0.0.tgz", + "integrity": "sha512-7OsC1gNORBEawOa5+j2pXN9vsicaIOH5cPXxoR6fJOmH6/EXpJB2CajXOu1fPRFun2m1lktEFX11+P89hqO/og==", "dev": true, "license": "ISC", "dependencies": { "semver": "^7.3.5" }, "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" } }, - "node_modules/@pkgjs/parseargs": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", - "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "node_modules/@shikijs/engine-oniguruma": { + "version": "3.20.0", + "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-3.20.0.tgz", + "integrity": "sha512-Yx3gy7xLzM0ZOjqoxciHjA7dAt5tyzJE3L4uQoM83agahy+PlW244XJSrmJRSBvGYELDhYXPacD4R/cauV5bzQ==", "dev": true, "license": "MIT", - "optional": true, - "engines": { - "node": ">=14" + "dependencies": { + "@shikijs/types": "3.20.0", + "@shikijs/vscode-textmate": "^10.0.2" } }, - "node_modules/@shikijs/engine-oniguruma": { - "version": "1.24.4", - "resolved": "https://registry.npmjs.org/@shikijs/engine-oniguruma/-/engine-oniguruma-1.24.4.tgz", - "integrity": "sha512-Do2ry6flp2HWdvpj2XOwwa0ljZBRy15HKZITzPcNIBOGSeprnA8gOooA/bLsSPuy8aJBa+Q/r34dMmC3KNL/zw==", + "node_modules/@shikijs/langs": { + "version": "3.20.0", + "resolved": "https://registry.npmjs.org/@shikijs/langs/-/langs-3.20.0.tgz", + "integrity": "sha512-le+bssCxcSHrygCWuOrYJHvjus6zhQ2K7q/0mgjiffRbkhM4o1EWu2m+29l0yEsHDbWaWPNnDUTRVVBvBBeKaA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@shikijs/types": "3.20.0" + } + }, + "node_modules/@shikijs/themes": { + "version": "3.20.0", + "resolved": "https://registry.npmjs.org/@shikijs/themes/-/themes-3.20.0.tgz", + "integrity": "sha512-U1NSU7Sl26Q7ErRvJUouArxfM2euWqq1xaSrbqMu2iqa+tSp0D1Yah8216sDYbdDHw4C8b75UpE65eWorm2erQ==", "dev": true, "license": "MIT", "dependencies": { - "@shikijs/types": "1.24.4", - "@shikijs/vscode-textmate": "^9.3.1" + "@shikijs/types": "3.20.0" } }, "node_modules/@shikijs/types": { - "version": "1.24.4", - "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-1.24.4.tgz", - "integrity": "sha512-0r0XU7Eaow0PuDxuWC1bVqmWCgm3XqizIaT7SM42K03vc69LGooT0U8ccSR44xP/hGlNx4FKhtYpV+BU6aaKAA==", + "version": "3.20.0", + "resolved": "https://registry.npmjs.org/@shikijs/types/-/types-3.20.0.tgz", + "integrity": "sha512-lhYAATn10nkZcBQ0BlzSbJA3wcmL5MXUUF8d2Zzon6saZDlToKaiRX60n2+ZaHJCmXEcZRWNzn+k9vplr8Jhsw==", "dev": true, "license": "MIT", "dependencies": { - "@shikijs/vscode-textmate": "^9.3.1", + "@shikijs/vscode-textmate": "^10.0.2", "@types/hast": "^3.0.4" } }, "node_modules/@shikijs/vscode-textmate": { - "version": "9.3.1", - "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-9.3.1.tgz", - "integrity": "sha512-79QfK1393x9Ho60QFyLti+QfdJzRQCVLFb97kOIV7Eo9vQU/roINgk7m24uv0a7AUvN//RDH36FLjjK48v0s9g==", + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/@shikijs/vscode-textmate/-/vscode-textmate-10.0.2.tgz", + "integrity": "sha512-83yeghZ2xxin3Nj8z1NMd/NCuca+gsYXswywDy5bHvwlWL8tpTQmzGeUuHd9FC3E/SBEMvzJRwWEOz5gGes9Qg==", "dev": true, "license": "MIT" }, @@ -158,13 +174,13 @@ } }, "node_modules/@types/node": { - "version": "22.10.2", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.2.tgz", - "integrity": "sha512-Xxr6BBRCAOQixvonOye19wnzyDiUtTeqldOOmj3CkeblonbccA12PFwlufvRdrpjXxqnmUaeiU5EOA+7s5diUQ==", + "version": "25.0.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-25.0.3.tgz", + "integrity": "sha512-W609buLVRVmeW693xKfzHeIV6nJGGz98uCPfeXI1ELMLXVeKYZ9m15fAMSaUPBHYLGFsVRcMmSCksQOrZV9BYA==", "dev": true, "license": "MIT", "dependencies": { - "undici-types": "~6.20.0" + "undici-types": "~7.16.0" } }, "node_modules/@types/tmp": { @@ -182,51 +198,25 @@ "license": "MIT" }, "node_modules/abbrev": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-2.0.0.tgz", - "integrity": "sha512-6/mh1E2u2YgEsCHdY0Yx5oW+61gZU+1vXaoiHHrpKeuRNNgFvS+/jrwHiQhB5apAf5oB7UB7E19ol2R2LKH8hQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-4.0.0.tgz", + "integrity": "sha512-a1wflyaL0tHtJSmLSOVybYhy22vRih4eduhhrkcjgrWGnRfrZtovJ2FRjxuTtkkj47O/baf0R86QU5OuYpz8fA==", "dev": true, "license": "ISC", "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + "node": "^20.17.0 || >=22.9.0" } }, "node_modules/agent-base": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.3.tgz", - "integrity": "sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==", + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", "dev": true, "license": "MIT", "engines": { "node": ">= 14" } }, - "node_modules/ansi-regex": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.1.0.tgz", - "integrity": "sha512-7HSX4QQb4CspciLpVFwyRe79O3xsIZDDLER21kERQ71oaPodF8jL725AgJMFAYbooIqolJoRLuM81SpeUkpkvA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/ansi-styles": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", - "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, "node_modules/argparse": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", @@ -275,9 +265,9 @@ } }, "node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "dev": true, "license": "MIT", "dependencies": { @@ -310,97 +300,26 @@ } }, "node_modules/cacache": { - "version": "19.0.1", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-19.0.1.tgz", - "integrity": "sha512-hdsUxulXCi5STId78vRVYEtDAjq99ICAUktLTeTYsLoTE6Z8dS0c8pWNCxwdrk9YfJeobDZc2Y186hD/5ZQgFQ==", + "version": "20.0.3", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-20.0.3.tgz", + "integrity": "sha512-3pUp4e8hv07k1QlijZu6Kn7c9+ZpWWk4j3F8N3xPuCExULobqJydKYOTj1FTq58srkJsXvO7LbGAH4C0ZU3WGw==", "dev": true, "license": "ISC", "dependencies": { - "@npmcli/fs": "^4.0.0", + "@npmcli/fs": "^5.0.0", "fs-minipass": "^3.0.0", - "glob": "^10.2.2", - "lru-cache": "^10.0.1", + "glob": "^13.0.0", + "lru-cache": "^11.1.0", "minipass": "^7.0.3", "minipass-collect": "^2.0.1", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", "p-map": "^7.0.2", - "ssri": "^12.0.0", - "tar": "^7.4.3", - "unique-filename": "^4.0.0" - }, - "engines": { - "node": "^18.17.0 || >=20.5.0" - } - }, - "node_modules/cacache/node_modules/glob": { - "version": "10.4.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", - "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", - "dev": true, - "license": "ISC", - "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^3.1.2", - "minimatch": "^9.0.4", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^1.11.1" - }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/cacache/node_modules/jackspeak": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", - "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - }, - "optionalDependencies": { - "@pkgjs/parseargs": "^0.11.0" - } - }, - "node_modules/cacache/node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" + "ssri": "^13.0.0", + "unique-filename": "^5.0.0" }, "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/cacache/node_modules/path-scurry": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", - "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "lru-cache": "^10.2.0", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" - }, - "engines": { - "node": ">=16 || 14 >=14.18" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "node": "^20.17.0 || >=22.9.0" } }, "node_modules/camelcase": { @@ -426,45 +345,10 @@ "node": ">=18" } }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, - "node_modules/cross-spawn": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, "node_modules/debug": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", - "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", "dev": true, "license": "MIT", "dependencies": { @@ -479,20 +363,6 @@ } } }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true, - "license": "MIT" - }, - "node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true, - "license": "MIT" - }, "node_modules/encoding": { "version": "0.1.13", "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz", @@ -551,21 +421,22 @@ "dev": true, "license": "Apache-2.0" }, - "node_modules/foreground-child": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", - "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", "dev": true, - "license": "ISC", - "dependencies": { - "cross-spawn": "^7.0.0", - "signal-exit": "^4.0.1" - }, + "license": "MIT", "engines": { - "node": ">=14" + "node": ">=12.0.0" }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } } }, "node_modules/fs-constants": { @@ -589,22 +460,16 @@ } }, "node_modules/glob": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.0.tgz", - "integrity": "sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-13.0.0.tgz", + "integrity": "sha512-tvZgpqk6fz4BaNZ66ZsRaZnbHvP/jG3uKJvAZOwEVUL4RTA5nJeeLYfyN9/VA8NX/V3IBG+hkeuGpKjvELkVhA==", "dev": true, - "license": "ISC", + "license": "BlueOak-1.0.0", "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^4.0.1", - "minimatch": "^10.0.0", + "minimatch": "^10.1.1", "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", "path-scurry": "^2.0.0" }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, "engines": { "node": "20 || >=22" }, @@ -620,9 +485,9 @@ "license": "ISC" }, "node_modules/http-cache-semantics": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.1.tgz", - "integrity": "sha512-er295DKPVsV82j5kw1Gjt+ADA/XYHsajl82cGNQG2eyoPkvgUhX+nDIyelzhIWbbsXP39EHcI6l5tYs2FYqYXQ==", + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.2.0.tgz", + "integrity": "sha512-dTxcvPXqPvXBQpq5dUr6mEMJX4oIEFv6bwom3FDwKRDsuIjjJGANqhBuoAn9c1RQJIdAKav33ED65E2ys+87QQ==", "dev": true, "license": "BSD-2-Clause" }, @@ -707,59 +572,25 @@ "license": "ISC" }, "node_modules/ip-address": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-9.0.5.tgz", - "integrity": "sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.1.0.tgz", + "integrity": "sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==", "dev": true, "license": "MIT", - "dependencies": { - "jsbn": "1.1.0", - "sprintf-js": "^1.1.3" - }, "engines": { "node": ">= 12" } }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true, - "license": "ISC" - }, - "node_modules/jackspeak": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.0.2.tgz", - "integrity": "sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, + "license": "ISC", "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" + "node": ">=16" } }, - "node_modules/jsbn": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-1.1.0.tgz", - "integrity": "sha512-4bYVV3aAMtDTTu4+xsDYa6sy9GyJ69/amsu9sYF2zqjiEoZA5xJi3BrfX3uY+/IekIu7MwdObdbDWpoZdBv3/A==", - "dev": true, - "license": "MIT" - }, "node_modules/linkify-it": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", @@ -771,11 +602,14 @@ } }, "node_modules/lru-cache": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", - "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", + "version": "11.2.4", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.2.4.tgz", + "integrity": "sha512-B5Y16Jr9LB9dHVkh6ZevG+vAbOsNOYCX+sXvFWFu7B3Iz5mijW3zdbMyhsh8ANd2mSWBYdJgnqi+mL7/LrOPYg==", "dev": true, - "license": "ISC" + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } }, "node_modules/lunr": { "version": "2.3.9", @@ -785,26 +619,26 @@ "license": "MIT" }, "node_modules/make-fetch-happen": { - "version": "14.0.3", - "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-14.0.3.tgz", - "integrity": "sha512-QMjGbFTP0blj97EeidG5hk/QhKQ3T4ICckQGLgz38QF7Vgbk6e6FTARN8KhKxyBbWn8R0HU+bnw8aSoFPD4qtQ==", + "version": "15.0.3", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-15.0.3.tgz", + "integrity": "sha512-iyyEpDty1mwW3dGlYXAJqC/azFn5PPvgKVwXayOGBSmKLxhKZ9fg4qIan2ePpp1vJIwfFiO34LAPZgq9SZW9Aw==", "dev": true, "license": "ISC", "dependencies": { - "@npmcli/agent": "^3.0.0", - "cacache": "^19.0.1", + "@npmcli/agent": "^4.0.0", + "cacache": "^20.0.1", "http-cache-semantics": "^4.1.1", "minipass": "^7.0.2", - "minipass-fetch": "^4.0.0", + "minipass-fetch": "^5.0.0", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", "negotiator": "^1.0.0", - "proc-log": "^5.0.0", + "proc-log": "^6.0.0", "promise-retry": "^2.0.1", - "ssri": "^12.0.0" + "ssri": "^13.0.0" }, "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" } }, "node_modules/markdown-it": { @@ -833,13 +667,13 @@ "license": "MIT" }, "node_modules/minimatch": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", - "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", + "version": "10.1.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.1.1.tgz", + "integrity": "sha512-enIvLvRAFZYXJzkCYG5RKmPfrFArdLv+R+lbQ53BmIMLIry74bjKzX6iHAm8WYamJkhSSEabrWN5D97XnKObjQ==", "dev": true, - "license": "ISC", + "license": "BlueOak-1.0.0", "dependencies": { - "brace-expansion": "^2.0.1" + "@isaacs/brace-expansion": "^5.0.0" }, "engines": { "node": "20 || >=22" @@ -882,9 +716,9 @@ } }, "node_modules/minipass-fetch": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-4.0.0.tgz", - "integrity": "sha512-2v6aXUXwLP1Epd/gc32HAMIWoczx+fZwEPRHm/VwtrJzRGwR1qGZXEYV3Zp8ZjjbwaZhMrM6uHV4KVkk+XCc2w==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-5.0.0.tgz", + "integrity": "sha512-fiCdUALipqgPWrOVTz9fw0XhcazULXOSU6ie40DDbX1F49p1dBrSRBuswndTx1x3vEb/g0FT7vC4c4C2u/mh3A==", "dev": true, "license": "MIT", "dependencies": { @@ -893,7 +727,7 @@ "minizlib": "^3.0.1" }, "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" }, "optionalDependencies": { "encoding": "^0.1.13" @@ -999,35 +833,18 @@ "license": "ISC" }, "node_modules/minizlib": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.0.1.tgz", - "integrity": "sha512-umcy022ILvb5/3Djuu8LWeqUa8D68JaBzlttKeMWen48SjabqS3iY5w/vzeMzMUNhLDifyhbOwKDSznB1vvrwg==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-3.1.0.tgz", + "integrity": "sha512-KZxYo1BUkWD2TVFLr0MQoM8vUUigWD3LlD83a/75BqC+4qE0Hb1Vo5v1FgcfaNXvfXzr+5EhQ6ing/CaBijTlw==", "dev": true, "license": "MIT", "dependencies": { - "minipass": "^7.0.4", - "rimraf": "^5.0.5" + "minipass": "^7.1.2" }, "engines": { "node": ">= 18" } }, - "node_modules/mkdirp": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-3.0.1.tgz", - "integrity": "sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==", - "dev": true, - "license": "MIT", - "bin": { - "mkdirp": "dist/cjs/src/bin.js" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/mkdirp-classic": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", @@ -1066,37 +883,37 @@ } }, "node_modules/node-addon-api": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.3.0.tgz", - "integrity": "sha512-8VOpLHFrOQlAH+qA0ZzuGRlALRA6/LVh8QJldbrC4DY0hXoMP0l4Acq8TzFC018HztWiRqyCEj2aTWY2UvnJUg==", + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-8.5.0.tgz", + "integrity": "sha512-/bRZty2mXUIFY/xU5HLvveNHlswNJej+RnxBjOMkidWfwZzgTbPG1E3K5TOxRLOR+5hX7bSofy8yf1hZevMS8A==", "license": "MIT", "engines": { "node": "^18 || ^20 || >= 21" } }, "node_modules/node-gyp": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-11.0.0.tgz", - "integrity": "sha512-zQS+9MTTeCMgY0F3cWPyJyRFAkVltQ1uXm+xXu/ES6KFgC6Czo1Seb9vQW2wNxSX2OrDTiqL0ojtkFxBQ0ypIw==", + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-12.1.0.tgz", + "integrity": "sha512-W+RYA8jBnhSr2vrTtlPYPc1K+CSjGpVDRZxcqJcERZ8ND3A1ThWPHRwctTx3qC3oW99jt726jhdz3Y6ky87J4g==", "dev": true, "license": "MIT", "dependencies": { "env-paths": "^2.2.0", "exponential-backoff": "^3.1.1", - "glob": "^10.3.10", "graceful-fs": "^4.2.6", - "make-fetch-happen": "^14.0.3", - "nopt": "^8.0.0", - "proc-log": "^5.0.0", + "make-fetch-happen": "^15.0.0", + "nopt": "^9.0.0", + "proc-log": "^6.0.0", "semver": "^7.3.5", - "tar": "^7.4.3", - "which": "^5.0.0" + "tar": "^7.5.2", + "tinyglobby": "^0.2.12", + "which": "^6.0.0" }, "bin": { "node-gyp": "bin/node-gyp.js" }, "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" } }, "node_modules/node-gyp-build": { @@ -1110,116 +927,20 @@ "node-gyp-build-test": "build-test.js" } }, - "node_modules/node-gyp/node_modules/glob": { - "version": "10.4.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", - "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", - "dev": true, - "license": "ISC", - "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^3.1.2", - "minimatch": "^9.0.4", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^1.11.1" - }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/node-gyp/node_modules/isexe": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", - "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=16" - } - }, - "node_modules/node-gyp/node_modules/jackspeak": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", - "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - }, - "optionalDependencies": { - "@pkgjs/parseargs": "^0.11.0" - } - }, - "node_modules/node-gyp/node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/node-gyp/node_modules/path-scurry": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", - "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "lru-cache": "^10.2.0", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" - }, - "engines": { - "node": ">=16 || 14 >=14.18" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/node-gyp/node_modules/which": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/which/-/which-5.0.0.tgz", - "integrity": "sha512-JEdGzHwwkrbWoGOlIHqQ5gtprKGOenpDHpxE9zVR1bWbOtYRyPPHMe9FaP6x61CmNaTThSkb0DAJte5jD+DmzQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^3.1.1" - }, - "bin": { - "node-which": "bin/which.js" - }, - "engines": { - "node": "^18.17.0 || >=20.5.0" - } - }, "node_modules/nopt": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-8.0.0.tgz", - "integrity": "sha512-1L/fTJ4UmV/lUxT2Uf006pfZKTvAgCF+chz+0OgBHO8u2Z67pE7AaAUUj7CJy0lXqHmymUvGFt6NE9R3HER0yw==", + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-9.0.0.tgz", + "integrity": "sha512-Zhq3a+yFKrYwSBluL4H9XP3m3y5uvQkB/09CwDruCiRmR/UJYnn9W4R48ry0uGC70aeTPKLynBtscP9efFFcPw==", "dev": true, "license": "ISC", "dependencies": { - "abbrev": "^2.0.0" + "abbrev": "^4.0.0" }, "bin": { "nopt": "bin/nopt.js" }, "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" } }, "node_modules/npm-run-path": { @@ -1246,9 +967,9 @@ } }, "node_modules/p-map": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.3.tgz", - "integrity": "sha512-VkndIv2fIB99swvQoA65bm+fsmt6UNdGeIB0oxBs+WhAhdh08QA04JXpI7rbB9r08/nkbysKoya9rtDERYOYMA==", + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/p-map/-/p-map-7.0.4.tgz", + "integrity": "sha512-tkAQEw8ysMzmkhgw8k+1U/iPhWNhykKnSk4Rd5zLoPJCuJaGRPo6YposrZgaxHKzDHdDWWZvE/Sk7hsL2X/CpQ==", "dev": true, "license": "MIT", "engines": { @@ -1258,13 +979,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/package-json-from-dist": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", - "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", - "dev": true, - "license": "BlueOak-1.0.0" - }, "node_modules/path-key": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", @@ -1292,14 +1006,17 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/path-scurry/node_modules/lru-cache": { - "version": "11.0.2", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.2.tgz", - "integrity": "sha512-123qHRfJBmo2jXDbo/a5YOQrJoHF/GNQTLzQ5+IdK5pWpceK17yRc6ozlWd25FxvGKQbIUs91fDFkXmDHTKcyA==", + "node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", "dev": true, - "license": "ISC", + "license": "MIT", "engines": { - "node": "20 || >=22" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" } }, "node_modules/prebuildify": { @@ -1321,13 +1038,13 @@ } }, "node_modules/proc-log": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-5.0.0.tgz", - "integrity": "sha512-Azwzvl90HaF0aCz1JrDdXQykFakSSNPaPoiZ9fm5qJIMHioDZEi7OAdRwSm6rSoPtY3Qutnm3L7ogmg3dc+wbQ==", + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-6.1.0.tgz", + "integrity": "sha512-iG+GYldRf2BQ0UDUAd6JQ/RwzaQy6mXmsk/IzlYyal4A4SNFw54MeH4/tLkF4I5WoWG9SQwuqWzS99jaFQHBuQ==", "dev": true, "license": "ISC", "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" } }, "node_modules/promise-retry": { @@ -1390,92 +1107,6 @@ "node": ">= 4" } }, - "node_modules/rimraf": { - "version": "5.0.10", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-5.0.10.tgz", - "integrity": "sha512-l0OE8wL34P4nJH/H2ffoaniAokM2qSmrtXHmlpvYr5AVVX8msAyW0l8NVJFDxlSK4u3Uh/f41cQheDVdnYijwQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "glob": "^10.3.7" - }, - "bin": { - "rimraf": "dist/esm/bin.mjs" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rimraf/node_modules/glob": { - "version": "10.4.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", - "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", - "dev": true, - "license": "ISC", - "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^3.1.2", - "minimatch": "^9.0.4", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^1.11.1" - }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rimraf/node_modules/jackspeak": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", - "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - }, - "optionalDependencies": { - "@pkgjs/parseargs": "^0.11.0" - } - }, - "node_modules/rimraf/node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/rimraf/node_modules/path-scurry": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", - "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "lru-cache": "^10.2.0", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" - }, - "engines": { - "node": ">=16 || 14 >=14.18" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -1518,42 +1149,6 @@ "node": ">=10" } }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "license": "MIT", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/smart-buffer": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", @@ -1566,13 +1161,13 @@ } }, "node_modules/socks": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.3.tgz", - "integrity": "sha512-l5x7VUUWbjVFbafGLxPWkYsHIhEvmF85tbIeFZWc8ZPtoMyybuEhL7Jye/ooC4/d48FgOjSJXgsF/AJPYCW8Zw==", + "version": "2.8.7", + "resolved": "https://registry.npmjs.org/socks/-/socks-2.8.7.tgz", + "integrity": "sha512-HLpt+uLy/pxB+bum/9DzAgiKS8CX1EvbWxI4zlmgGCExImLdiad2iCwXT5Z4c9c3Eq8rP2318mPW2c+QbtjK8A==", "dev": true, "license": "MIT", "dependencies": { - "ip-address": "^9.0.5", + "ip-address": "^10.0.1", "smart-buffer": "^4.2.0" }, "engines": { @@ -1595,24 +1190,17 @@ "node": ">= 14" } }, - "node_modules/sprintf-js": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.3.tgz", - "integrity": "sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==", - "dev": true, - "license": "BSD-3-Clause" - }, "node_modules/ssri": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/ssri/-/ssri-12.0.0.tgz", - "integrity": "sha512-S7iGNosepx9RadX82oimUkvr0Ct7IjJbEbs4mJcTxst8um95J3sDYU1RBEOvdu6oL1Wek2ODI5i4MAw+dZ6cAQ==", + "version": "13.0.0", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-13.0.0.tgz", + "integrity": "sha512-yizwGBpbCn4YomB2lzhZqrHLJoqFGXihNbib3ozhqF/cIp5ue+xSmOQrjNasEE62hFxsCcg/V/z23t4n8jMEng==", "dev": true, "license": "ISC", "dependencies": { "minipass": "^7.0.3" }, "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" } }, "node_modules/string_decoder": { @@ -1625,122 +1213,17 @@ "safe-buffer": "~5.2.0" } }, - "node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, - "license": "MIT", - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/string-width-cjs": { - "name": "string-width", - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true, - "license": "MIT" - }, - "node_modules/string-width-cjs/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", - "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/strip-ansi-cjs": { - "name": "strip-ansi", - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/tar": { - "version": "7.4.3", - "resolved": "https://registry.npmjs.org/tar/-/tar-7.4.3.tgz", - "integrity": "sha512-5S7Va8hKfV7W5U6g3aYxXmlPoZVAwUMy9AOKyF2fVuZa2UD3qZjg578OrLRt8PcNN1PleVaL/5/yYATNL0ICUw==", + "version": "7.5.2", + "resolved": "https://registry.npmjs.org/tar/-/tar-7.5.2.tgz", + "integrity": "sha512-7NyxrTE4Anh8km8iEy7o0QYPs+0JKBTj5ZaqHg6B39erLg0qYXN3BijtShwbsNSvQ+LN75+KV+C4QR/f6Gwnpg==", "dev": true, - "license": "ISC", + "license": "BlueOak-1.0.0", "dependencies": { "@isaacs/fs-minipass": "^4.0.0", "chownr": "^3.0.0", "minipass": "^7.1.2", - "minizlib": "^3.0.1", - "mkdirp": "^3.0.1", + "minizlib": "^3.1.0", "yallist": "^5.0.0" }, "engines": { @@ -1748,9 +1231,9 @@ } }, "node_modules/tar-fs": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", - "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.4.tgz", + "integrity": "sha512-mDAjwmZdh7LTT6pNleZ05Yt65HC3E+NiQzl672vQG38jIrehtJk/J3mNwIg+vShQPcLF/LV7CMnDW6vjj6sfYQ==", "dev": true, "license": "MIT", "dependencies": { @@ -1784,10 +1267,27 @@ "node": ">=6" } }, + "node_modules/tinyglobby": { + "version": "0.2.15", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.3" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, "node_modules/tmp": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.3.tgz", - "integrity": "sha512-nZD7m9iCPC5g0pYmcaxogYKggSfLsdxl8of3Q/oIbqCqLLIO9IAF0GWjX1z9NZRHPiXv8Wex4yDCaZsgEw0Y8w==", + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.5.tgz", + "integrity": "sha512-voyz6MApa1rQGUxT3E+BK7/ROe8itEx7vD8/HEvt4xwXucvQ5G5oeEiHkmHZJuBO21RpOf+YYm9MOivj709jow==", "dev": true, "license": "MIT", "engines": { @@ -1795,18 +1295,18 @@ } }, "node_modules/tree-sitter-c": { - "version": "0.23.4", - "resolved": "https://registry.npmjs.org/tree-sitter-c/-/tree-sitter-c-0.23.4.tgz", - "integrity": "sha512-hp3xYuWbuTBanHEwrAxOBhDjdwiD1k3u2XpVmpFk5GdJJj7N2jrcF45hYrZPcwuAjNXdL01YFG7TSLdmPi2lyg==", + "version": "0.24.1", + "resolved": "https://registry.npmjs.org/tree-sitter-c/-/tree-sitter-c-0.24.1.tgz", + "integrity": "sha512-lkYwWN3SRecpvaeqmFKkuPNR3ZbtnvHU+4XAEEkJdrp3JfSp2pBrhXOtvfsENUneye76g889Y0ddF2DM0gEDpA==", "dev": true, "hasInstallScript": true, "license": "MIT", "dependencies": { - "node-addon-api": "^8.3.0", + "node-addon-api": "^8.3.1", "node-gyp-build": "^4.8.4" }, "peerDependencies": { - "tree-sitter": "^0.22.1" + "tree-sitter": "^0.22.4" }, "peerDependenciesMeta": { "tree-sitter": { @@ -1815,18 +1315,18 @@ } }, "node_modules/tree-sitter-embedded-template": { - "version": "0.23.2", - "resolved": "https://registry.npmjs.org/tree-sitter-embedded-template/-/tree-sitter-embedded-template-0.23.2.tgz", - "integrity": "sha512-ZY9AarwhUxQpc5DWA8CFG54LojGn6D8385tQE9SWf+N34z5ryM93NcyBNWNT189CPQytVv9O3x1ulR0uGQOynw==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/tree-sitter-embedded-template/-/tree-sitter-embedded-template-0.25.0.tgz", + "integrity": "sha512-DLWFFWito68hgjMC3kDaqDpcHRGr+ZC2cz4pFR/XeWilq9C0dLawsxi+pK6qRM/ICZw6YNmf5w28y0tpcfbNsA==", "dev": true, "hasInstallScript": true, "license": "MIT", "dependencies": { - "node-addon-api": "^8.2.2", - "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": { @@ -1875,18 +1375,18 @@ } }, "node_modules/tree-sitter-javascript": { - "version": "0.23.1", - "resolved": "https://registry.npmjs.org/tree-sitter-javascript/-/tree-sitter-javascript-0.23.1.tgz", - "integrity": "sha512-/bnhbrTD9frUYHQTiYnPcxyHORIw157ERBa6dqzaKxvR/x3PC4Yzd+D1pZIMS6zNg2v3a8BZ0oK7jHqsQo9fWA==", + "version": "0.25.0", + "resolved": "https://registry.npmjs.org/tree-sitter-javascript/-/tree-sitter-javascript-0.25.0.tgz", + "integrity": "sha512-1fCbmzAskZkxcZzN41sFZ2br2iqTYP3tKls1b/HKGNPQUVOpsUxpmGxdN/wMqAk3jYZnYBR1dd/y/0avMeU7dw==", "dev": true, "hasInstallScript": true, "license": "MIT", "dependencies": { - "node-addon-api": "^8.2.2", - "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": { @@ -1915,18 +1415,18 @@ } }, "node_modules/tree-sitter-python": { - "version": "0.23.6", - "resolved": "https://registry.npmjs.org/tree-sitter-python/-/tree-sitter-python-0.23.6.tgz", - "integrity": "sha512-yIM9z0oxKIxT7bAtPOhgoVl6gTXlmlIhue7liFT4oBPF/lha7Ha4dQBS82Av6hMMRZoVnFJI8M6mL+SwWoLD3A==", + "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==", "dev": true, "hasInstallScript": true, "license": "MIT", "dependencies": { - "node-addon-api": "^8.3.0", + "node-addon-api": "^8.5.0", "node-gyp-build": "^4.8.4" }, "peerDependencies": { - "tree-sitter": "^0.22.1" + "tree-sitter": "^0.25.0" }, "peerDependenciesMeta": { "tree-sitter": { @@ -1955,9 +1455,9 @@ } }, "node_modules/tree-sitter-rust": { - "version": "0.23.2", - "resolved": "https://registry.npmjs.org/tree-sitter-rust/-/tree-sitter-rust-0.23.2.tgz", - "integrity": "sha512-mpII54xsZxTMdtNFxVk9WqhPTEP7kKEBkZyb8ulWlhnNJIFBQISpfmABpdqXtnaETeduVHEWABQ5H5o7KUH8XA==", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/tree-sitter-rust/-/tree-sitter-rust-0.24.0.tgz", + "integrity": "sha512-NWemUDf629Tfc90Y0Z55zuwPCAHkLxWnMf2RznYu4iBkkrQl2o/CHGB7Cr52TyN5F1DAx8FmUnDtCy9iUkXZEQ==", "dev": true, "hasInstallScript": true, "license": "MIT", @@ -1975,39 +1475,40 @@ } }, "node_modules/typedoc": { - "version": "0.27.6", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.27.6.tgz", - "integrity": "sha512-oBFRoh2Px6jFx366db0lLlihcalq/JzyCVp7Vaq1yphL/tbgx2e+bkpkCgJPunaPvPwoTOXSwasfklWHm7GfAw==", + "version": "0.28.15", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.28.15.tgz", + "integrity": "sha512-mw2/2vTL7MlT+BVo43lOsufkkd2CJO4zeOSuWQQsiXoV2VuEn7f6IZp2jsUDPmBMABpgR0R5jlcJ2OGEFYmkyg==", "dev": true, "license": "Apache-2.0", "dependencies": { - "@gerrit0/mini-shiki": "^1.24.0", + "@gerrit0/mini-shiki": "^3.17.0", "lunr": "^2.3.9", "markdown-it": "^14.1.0", "minimatch": "^9.0.5", - "yaml": "^2.6.1" + "yaml": "^2.8.1" }, "bin": { "typedoc": "bin/typedoc" }, "engines": { - "node": ">= 18" + "node": ">= 18", + "pnpm": ">= 10" }, "peerDependencies": { - "typescript": "5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x || 5.7.x" + "typescript": "5.0.x || 5.1.x || 5.2.x || 5.3.x || 5.4.x || 5.5.x || 5.6.x || 5.7.x || 5.8.x || 5.9.x" } }, "node_modules/typedoc-plugin-rename-defaults": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/typedoc-plugin-rename-defaults/-/typedoc-plugin-rename-defaults-0.7.2.tgz", - "integrity": "sha512-9oa1CsMN4p/xuVR2JW2YDD6xE7JcrIth3KAfjR8YBi6NnrDk2Q72o4lbArybLDjxKAkOzk7N1uUdGwJlooLEOg==", + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/typedoc-plugin-rename-defaults/-/typedoc-plugin-rename-defaults-0.7.3.tgz", + "integrity": "sha512-fDtrWZ9NcDfdGdlL865GW7uIGQXlthPscURPOhDkKUe4DBQSRRFUf33fhWw41FLlsz8ZTeSxzvvuNmh54MynFA==", "dev": true, "license": "MIT", "dependencies": { "camelcase": "^8.0.0" }, "peerDependencies": { - "typedoc": ">=0.22.x <0.28.x" + "typedoc": ">=0.22.x <0.29.x" } }, "node_modules/typedoc/node_modules/minimatch": { @@ -2027,9 +1528,9 @@ } }, "node_modules/typescript": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", - "integrity": "sha512-i5t66RHxDvVN40HfDd1PsEThGNnlMCMT3jMUuoh9/0TaqWevNontacunWyN02LA9/fIbEWlcHZcgTKb9QoaLfg==", + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", "dev": true, "license": "Apache-2.0", "bin": { @@ -2048,36 +1549,36 @@ "license": "MIT" }, "node_modules/undici-types": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", - "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", "dev": true, "license": "MIT" }, "node_modules/unique-filename": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-4.0.0.tgz", - "integrity": "sha512-XSnEewXmQ+veP7xX2dS5Q4yZAvO40cBN2MWkJ7D/6sW4Dg6wYBNwM1Vrnz1FhH5AdeLIlUXRI9e28z1YZi71NQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-5.0.0.tgz", + "integrity": "sha512-2RaJTAvAb4owyjllTfXzFClJ7WsGxlykkPvCr9pA//LD9goVq+m4PPAeBgNodGZ7nSrntT/auWpJ6Y5IFXcfjg==", "dev": true, "license": "ISC", "dependencies": { - "unique-slug": "^5.0.0" + "unique-slug": "^6.0.0" }, "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" } }, "node_modules/unique-slug": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-5.0.0.tgz", - "integrity": "sha512-9OdaqO5kwqR+1kVgHAhsp5vPNU0hnxRa26rBFNfNgM7M6pNtgzeBn3s/xbyCQL3dcjzOatcef6UUHpB/6MaETg==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-6.0.0.tgz", + "integrity": "sha512-4Lup7Ezn8W3d52/xBhZBVdx323ckxa7DEvd9kPQHppTkLoJXw6ltrBCyj5pnrxj0qKDxYMJ56CoxNuFCscdTiw==", "dev": true, "license": "ISC", "dependencies": { "imurmurhash": "^0.1.4" }, "engines": { - "node": "^18.17.0 || >=20.5.0" + "node": "^20.17.0 || >=22.9.0" } }, "node_modules/util-deprecate": { @@ -2088,117 +1589,19 @@ "license": "MIT" }, "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-6.0.0.tgz", + "integrity": "sha512-f+gEpIKMR9faW/JgAgPK1D7mekkFoqbmiwvNzuhsHetni20QSgzg9Vhn0g2JSJkkfehQnqdUAx7/e15qS1lPxg==", "dev": true, "license": "ISC", "dependencies": { - "isexe": "^2.0.0" + "isexe": "^3.1.1" }, "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs": { - "name": "wrap-ansi", - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true, - "license": "MIT" - }, - "node_modules/wrap-ansi-cjs/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" + "node-which": "bin/which.js" }, "engines": { - "node": ">=8" + "node": "^20.17.0 || >=22.9.0" } }, "node_modules/wrappy": { @@ -2219,16 +1622,19 @@ } }, "node_modules/yaml": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.1.tgz", - "integrity": "sha512-7r0XPzioN/Q9kXBro/XPnA6kznR73DHq+GXh5ON7ZozRO6aMjbmiBuKste2wslTFkC5d1dw0GooOCepZXJ2SAg==", + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.2.tgz", + "integrity": "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A==", "dev": true, "license": "ISC", "bin": { "yaml": "bin.mjs" }, "engines": { - "node": ">= 14" + "node": ">= 14.6" + }, + "funding": { + "url": "https://github.com/sponsors/eemeli" } } } diff --git a/package.json b/package.json index 8caa3bf1..afe2b939 100644 --- a/package.json +++ b/package.json @@ -43,28 +43,28 @@ "vendor/tree-sitter/lib/src/*" ], "dependencies": { - "node-addon-api": "^8.3.0", + "node-addon-api": "^8.5.0", "node-gyp-build": "^4.8.4" }, "devDependencies": { - "@types/node": "^22.10.2", + "@types/node": "^25.0.3", "@types/tmp": "^0.2.6", - "glob": "^11.0.0", - "node-gyp": "^11.0.0", + "glob": "^13.0.0", + "node-gyp": "^12.1.0", "prebuildify": "^6.0.1", - "tmp": "^0.2.3", - "tree-sitter-c": "^0.23.4", - "tree-sitter-embedded-template": "^0.23.2", + "tmp": "^0.2.5", + "tree-sitter-c": "^0.24.1", + "tree-sitter-embedded-template": "^0.25.0", "tree-sitter-html": "^0.23.2", "tree-sitter-java": "^0.23.5", - "tree-sitter-javascript": "^0.23.1", + "tree-sitter-javascript": "^0.25.0", "tree-sitter-json": "^0.24.8", - "tree-sitter-python": "^0.23.6", + "tree-sitter-python": "^0.25.0", "tree-sitter-ruby": "^0.23.1", - "tree-sitter-rust": "^0.23.2", - "typedoc": "^0.27.6", - "typedoc-plugin-rename-defaults": "^0.7.2", - "typescript": "^5.7.2" + "tree-sitter-rust": "^0.24.0", + "typedoc": "^0.28.15", + "typedoc-plugin-rename-defaults": "^0.7.3", + "typescript": "^5.9.3" }, "scripts": { "docs": "typedoc --out docs/api tree-sitter.d.ts --readme README.md", From 4016ae0ce29e4831b97248db46cd72de3d7bfd9e Mon Sep 17 00:00:00 2001 From: ObserverOfTime Date: Sat, 20 Dec 2025 13:30:06 +0200 Subject: [PATCH 11/11] feat: implement progress callback parameters and deprecate the timeouts --- index.js | 9 +++++---- src/language.cc | 7 +++---- src/node.cc | 2 +- src/parser.cc | 46 ++++++++++++++++++++++++++++++++++++---------- src/query.cc | 30 +++++++++++++++++++++++++++++- tree-sitter.d.ts | 47 +++++++++++++++++++++++++++++++++++++---------- 6 files changed, 111 insertions(+), 30 deletions(-) diff --git a/index.js b/index.js index 0bf3bef5..8e9ec2f1 100644 --- a/index.js +++ b/index.js @@ -373,7 +373,7 @@ Parser.prototype.getLanguage = function(_language) { return this[languageSymbol] || null; }; -Parser.prototype.parse = function(input, oldTree, {bufferSize, includedRanges}={}) { +Parser.prototype.parse = function(input, oldTree, {bufferSize, includedRanges, progressCallback}={}) { let getText, treeInput = input if (typeof input === 'string') { const inputString = input; @@ -389,6 +389,7 @@ Parser.prototype.parse = function(input, oldTree, {bufferSize, includedRanges}={ oldTree, bufferSize, includedRanges, + progressCallback, ) : undefined; @@ -696,13 +697,13 @@ Query.prototype.captures = function( matchLimit = 0xFFFFFFFF, maxStartDepth = 0xFFFFFFFF, timeoutMicros = 0, + progressCallback = undefined, } = {} ) { marshalNode(node); const [returnedMatches, returnedNodes] = _captures.call(this, node.tree, - startPosition.row, startPosition.column, - endPosition.row, endPosition.column, - startIndex, endIndex, matchLimit, maxStartDepth, timeoutMicros + startPosition.row, startPosition.column, endPosition.row, endPosition.column, + startIndex, endIndex, matchLimit, maxStartDepth, timeoutMicros, progressCallback ); const nodes = unmarshalNodes(returnedNodes, node.tree); const results = []; diff --git a/src/language.cc b/src/language.cc index 3dc4d807..b72f8f58 100644 --- a/src/language.cc +++ b/src/language.cc @@ -30,7 +30,7 @@ const TSLanguage *UnwrapLanguage(Napi::Value value) { if (arg.IsExternal() && arg.CheckTypeTag(&LANGUAGE_TYPE_TAG)) { const TSLanguage *language = arg.Data(); if (language != nullptr) { - uint16_t version = ts_language_version(language); + uint16_t version = ts_language_abi_version(language); if ( version < TREE_SITTER_MIN_COMPATIBLE_LANGUAGE_VERSION || version > TREE_SITTER_LANGUAGE_VERSION @@ -39,9 +39,8 @@ const TSLanguage *UnwrapLanguage(Napi::Value value) { "Incompatible language version. Compatible range: " + std::to_string(TREE_SITTER_MIN_COMPATIBLE_LANGUAGE_VERSION) + " - " + std::to_string(TREE_SITTER_LANGUAGE_VERSION) + ". Got: " + - std::to_string(ts_language_version(language)); - RangeError::New(env, message.c_str()); - return nullptr; + std::to_string(ts_language_abi_version(language)); + throw RangeError::New(env, message.c_str()); } return language; } diff --git a/src/node.cc b/src/node.cc index f4a9ac36..445497bb 100644 --- a/src/node.cc +++ b/src/node.cc @@ -793,7 +793,7 @@ Napi::Value ChildWithDescendant(const Napi::CallbackInfo &info) { const Tree *child_tree = Tree::UnwrapTree(info[1]); TSNode child_node = UnmarshalNode(env, child_tree, 1); if (self.id != nullptr && child_node.id != nullptr) { - return MarshalNode(info, tree, ts_node_child_with_descendant(self, child_node)); + return MarshalNode(info, tree, ts_node_child_with_descendant(self, child_node)); } return MarshalNullNode(env); } diff --git a/src/parser.cc b/src/parser.cc index a5c877a1..59f4317e 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -109,6 +109,29 @@ class CallbackInput final { ObjectReference partial_string; }; +class CallbackProgress final { + public: + static TSParseOptions Make(const Napi::Function &func) { + TSParseOptions options; + auto *callback = new CallbackProgress(); + callback->func = Napi::Persistent(func); + options.payload = static_cast(callback); + options.progress_callback = Cancel; + return options; + } + + private: + Napi::FunctionReference func; + + static bool Cancel(TSParseState *state) { + auto *callback = static_cast(state->payload); + Env env = callback->func.Env(); + Number index = Number::New(env, state->current_byte_offset); + Boolean has_error = Boolean::New(env, state->has_error); + return callback->func({ index, has_error }).As(); + } +}; + void Parser::Init(Napi::Env env, Napi::Object exports) { auto *data = env.GetInstanceData(); @@ -203,19 +226,22 @@ Napi::Value Parser::Parse(const CallbackInfo &info) { old_tree = tree->tree_; } - Napi::Value buffer_size = env.Null(); - if (info.Length() > 2) { - buffer_size = info[2]; - } + CallbackInput callback_input(callback, info.Length() > 2 ? info[2] : env.Null()); - if (!handle_included_ranges(env, parser_, info[3])) { - return env.Undefined(); + if (info.Length() > 3) { + if (!handle_included_ranges(env, parser_, info[3])) { + return env.Undefined(); + } } - CallbackInput callback_input(callback, buffer_size); - TSTree *tree = ts_parser_parse(parser_, old_tree, callback_input.Input()); - Napi::Value result = Tree::NewInstance(env, tree); - return result; + TSTree *tree; + if (info.Length() > 4 && info[4].IsFunction()) { + TSParseOptions options = CallbackProgress::Make(info[4].As()); + tree = ts_parser_parse_with_options(parser_, old_tree, callback_input.Input(), options); + } else { + tree = ts_parser_parse(parser_, old_tree, callback_input.Input()); + } + return Tree::NewInstance(env, tree); } Napi::Value Parser::IncludedRanges(const Napi::CallbackInfo &info) { diff --git a/src/query.cc b/src/query.cc index 4121b2f5..4d47bb05 100644 --- a/src/query.cc +++ b/src/query.cc @@ -31,6 +31,29 @@ const char *query_error_names[] = { "TSQueryErrorStructure", }; +class CallbackProgress final { + public: + static TSQueryCursorOptions Make(const Napi::Function &func) { + TSQueryCursorOptions options; + auto *callback = new CallbackProgress(); + callback->func = Napi::Persistent(func); + options.payload = static_cast(callback); + options.progress_callback = Cancel; + return options; + } + + private: + Napi::FunctionReference func; + + static bool Cancel(TSQueryCursorState *state) { + auto *callback = static_cast(state->payload); + Env env = callback->func.Env(); + Number index = Number::New(env, state->current_byte_offset); + return callback->func({ index }).As(); + } +}; + + void Query::Init(Napi::Env env, Napi::Object exports) { auto *data = env.GetInstanceData(); data->ts_query_cursor = ts_query_cursor_new(); @@ -219,7 +242,12 @@ Napi::Value Query::Matches(const Napi::CallbackInfo &info) { ts_query_cursor_set_match_limit(data->ts_query_cursor, match_limit); ts_query_cursor_set_max_start_depth(data->ts_query_cursor, max_start_depth); ts_query_cursor_set_timeout_micros(data->ts_query_cursor, timeout_micros); - ts_query_cursor_exec(data->ts_query_cursor, ts_query, root_node); + if (info.Length() > 10 && info[10].IsFunction()) { + TSQueryCursorOptions options = CallbackProgress::Make(info[10].As()); + ts_query_cursor_exec_with_options(data->ts_query_cursor, ts_query, root_node, &options); + } else { + ts_query_cursor_exec(data->ts_query_cursor, ts_query, root_node); + } Array js_matches = Array::New(env); unsigned index = 0; diff --git a/tree-sitter.d.ts b/tree-sitter.d.ts index c964a9b7..c92c5a88 100644 --- a/tree-sitter.d.ts +++ b/tree-sitter.d.ts @@ -15,13 +15,11 @@ declare module "tree-sitter" { * @param options - Optional parsing settings: * - bufferSize: Size of internal parsing buffer * - includedRanges: Array of ranges to parse within the input + * - progressCallback: A callback that receives the current parse state * * @returns A syntax tree representing the parsed text * - * @throws May return null or fail if: - * - No language has been set via {@link Parser.setLanguage} - * - The parsing timeout (set via {@link Parser.setTimeoutMicros}) was reached - * - Parsing was cancelled via cancellation flag + * @throws May fail if no language has been set or parsing was halted. */ parse(input: string | Parser.Input, oldTree?: Parser.Tree | null, options?: Parser.Options): Parser.Tree; @@ -38,6 +36,8 @@ declare module "tree-sitter" { * This timeout can be set via {@link Parser.setTimeoutMicros}. * * @returns The parsing timeout in microseconds + * + * @deprecated Use the {@link progressCallback} */ getTimeoutMicros(): number; @@ -47,16 +47,17 @@ declare module "tree-sitter" { * If parsing takes longer than this, it will halt early, returning null. * * @param timeout - The maximum parsing duration in microseconds + * + * @deprecated Use the {@link progressCallback} */ setTimeoutMicros(timeout: number): void; /** * Instruct the parser to start the next parse from the beginning. * - * If the parser previously failed because of a timeout or cancellation, - * it will resume where it left off on the next parse by default. - * Call this method if you want to parse a different document instead - * of resuming. + * If the parser previously failed, it will resume where it left off + * on the next parse by default. Call this method if you want to parse + * a different document instead of resuming. */ reset(): void; @@ -110,6 +111,16 @@ declare module "tree-sitter" { /** Array of ranges to include when parsing the input */ includedRanges?: Range[]; + + /** + * A callback that receives the parse state during parsing. + * + * @param index - The byte offset in the document that the parser is currently at + * @param hasError - Indicates whether the parser has encountered an error during parsing + * + * @returns `true` to stop parsing or `false` to continue + */ + progressCallback?: (index: number, hasError: boolean) => boolean; }; /** @@ -166,7 +177,7 @@ declare module "tree-sitter" { }; /** - * A callback that receives log messages during parser. + * A callback that receives log messages during parsing. * * @param message - The log message * @param params - Parameters associated with the log message @@ -832,8 +843,19 @@ declare module "tree-sitter" { * take before halting. * * If query execution takes longer than this, it will halt early, returning None. + * + * @deprecated Use the {@link progressCallback} */ timeoutMicros?: number; + + /** + * A callback that receives the query state during execution. + * + * @param index - The current byte offset + * + * @returns `true` to stop the query or `false` to continue + */ + progressCallback?: (index: number) => boolean; }; export class Query { @@ -955,6 +977,7 @@ declare module "tree-sitter" { export class LookaheadIterator { /** The current symbol of the lookahead iterator. */ readonly currentTypeId: number; + /** The current symbol name of the lookahead iterator. */ readonly currentType: string; @@ -1043,7 +1066,11 @@ declare module "tree-sitter" { /** Information about a language */ interface Language { - /** The name of the language */ + /** + * The name of the language + * + * @deprecated + */ name?: string; /** The inner language object */ language: unknown;