diff --git a/lib/binding_web/.gitignore b/lib/binding_web/.gitignore index 5da2c102..bdb90ed4 100644 --- a/lib/binding_web/.gitignore +++ b/lib/binding_web/.gitignore @@ -1,3 +1,4 @@ +debug/ dist/ /tree-sitter.js /tree-sitter.js.map diff --git a/lib/binding_web/eslint.config.mjs b/lib/binding_web/eslint.config.mjs new file mode 100644 index 00000000..a8bb9739 --- /dev/null +++ b/lib/binding_web/eslint.config.mjs @@ -0,0 +1,27 @@ +import eslint from '@eslint/js'; +import tseslint from 'typescript-eslint'; + +export default tseslint.config( + eslint.configs.recommended, + tseslint.configs.recommendedTypeChecked, + tseslint.configs.strictTypeChecked, + tseslint.configs.stylisticTypeChecked, + { + languageOptions: { + parserOptions: { + projectService: true, + tsconfigRootDir: import.meta.dirname, + }, + }, + rules: { + 'no-fallthrough': 'off', + '@typescript-eslint/no-non-null-assertion': 'off', + '@typescript-eslint/no-unnecessary-condition': ['error', { + allowConstantLoopConditions: true + }], + '@typescript-eslint/restrict-template-expressions': ['error', { + allowNumber: true + }], + } + }, +); diff --git a/lib/binding_web/package-lock.json b/lib/binding_web/package-lock.json index b172434a..8cf041d2 100644 --- a/lib/binding_web/package-lock.json +++ b/lib/binding_web/package-lock.json @@ -7,16 +7,20 @@ "": { "name": "web-tree-sitter", "version": "0.25.0", + "hasInstallScript": true, "license": "MIT", "devDependencies": { + "@eslint/js": "^9.18.0", "@types/emscripten": "^1.39.13", "@types/node": "^22.10.7", - "@vitest/coverage-v8": "^2.1.8", + "@vitest/coverage-v8": "^3.0.2", "esbuild": "^0.24.2", - "eslint": ">=9.18.0", + "eslint": "^9.18.0", "source-map": "^0.7.4", + "tsx": "^4.19.2", "typescript": "^5.7.3", - "vitest": "^2.1.8" + "typescript-eslint": "^8.20.0", + "vitest": "^3.0.2" } }, "node_modules/@ampproject/remapping": { @@ -84,11 +88,14 @@ } }, "node_modules/@bcoe/v8-coverage": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", - "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-1.0.2.tgz", + "integrity": "sha512-6zABk/ECA/QYSCQ1NGiVwwbQerUCZ+TQbp64Q3AgmfNvurHH0j8TtXa1qbShXA6qqkpAj4V5W8pP6mLe1mcMqA==", "dev": true, - "license": "MIT" + "license": "MIT", + "engines": { + "node": ">=18" + } }, "node_modules/@esbuild/aix-ppc64": { "version": "0.24.2", @@ -790,6 +797,44 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", @@ -1107,32 +1152,238 @@ "undici-types": "~6.20.0" } }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.20.0.tgz", + "integrity": "sha512-naduuphVw5StFfqp4Gq4WhIBE2gN1GEmMUExpJYknZJdRnc+2gDzB8Z3+5+/Kv33hPQRDGzQO/0opHE72lZZ6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "8.20.0", + "@typescript-eslint/type-utils": "8.20.0", + "@typescript-eslint/utils": "8.20.0", + "@typescript-eslint/visitor-keys": "8.20.0", + "graphemer": "^1.4.0", + "ignore": "^5.3.1", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.0.0 || ^8.0.0-alpha.0", + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.20.0.tgz", + "integrity": "sha512-gKXG7A5HMyjDIedBi6bUrDcun8GIjnI8qOwVLiY3rx6T/sHP/19XLJOnIq/FgQvWLHja5JN/LSE7eklNBr612g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/scope-manager": "8.20.0", + "@typescript-eslint/types": "8.20.0", + "@typescript-eslint/typescript-estree": "8.20.0", + "@typescript-eslint/visitor-keys": "8.20.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.20.0.tgz", + "integrity": "sha512-J7+VkpeGzhOt3FeG1+SzhiMj9NzGD/M6KoGn9f4dbz3YzK9hvbhVTmLj/HiTp9DazIzJ8B4XcM80LrR9Dm1rJw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.20.0", + "@typescript-eslint/visitor-keys": "8.20.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.20.0.tgz", + "integrity": "sha512-bPC+j71GGvA7rVNAHAtOjbVXbLN5PkwqMvy1cwGeaxUoRQXVuKCebRoLzm+IPW/NtFFpstn1ummSIasD5t60GA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/typescript-estree": "8.20.0", + "@typescript-eslint/utils": "8.20.0", + "debug": "^4.3.4", + "ts-api-utils": "^2.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.20.0.tgz", + "integrity": "sha512-cqaMiY72CkP+2xZRrFt3ExRBu0WmVitN/rYPZErA80mHjHx/Svgp8yfbzkJmDoQ/whcytOPO9/IZXnOc+wigRA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.20.0.tgz", + "integrity": "sha512-Y7ncuy78bJqHI35NwzWol8E0X7XkRVS4K4P4TCyzWkOJih5NDvtoRDW4Ba9YJJoB2igm9yXDdYI/+fkiiAxPzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.20.0", + "@typescript-eslint/visitor-keys": "8.20.0", + "debug": "^4.3.4", + "fast-glob": "^3.3.2", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^2.0.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <5.8.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/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==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/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/@typescript-eslint/utils": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.20.0.tgz", + "integrity": "sha512-dq70RUw6UK9ei7vxc4KQtBRk7qkHZv447OUZ6RPQMQl71I3NZxQJX/f32Smr+iqWrB02pHKn2yAdHBb0KNrRMA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@typescript-eslint/scope-manager": "8.20.0", + "@typescript-eslint/types": "8.20.0", + "@typescript-eslint/typescript-estree": "8.20.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.20.0.tgz", + "integrity": "sha512-v/BpkeeYAsPkKCkR8BDwcno0llhzWVqPOamQrAEMdpZav2Y9OVjd9dwJyBLJWwf335B5DmlifECIkZRJCaGaHA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.20.0", + "eslint-visitor-keys": "^4.2.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, "node_modules/@vitest/coverage-v8": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-2.1.8.tgz", - "integrity": "sha512-2Y7BPlKH18mAZYAW1tYByudlCYrQyl5RGvnnDYJKW5tCiO5qg3KSAy3XAxcxKz900a0ZXxWtKrMuZLe3lKBpJw==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-3.0.2.tgz", + "integrity": "sha512-U+hZYb0FtgNDb6B3E9piAHzXXIuxuBw2cd6Lvepc9sYYY4KjgiwCBmo3Sird9ZRu3ggLpLBTfw1ZRr77ipiSfw==", "dev": true, "license": "MIT", "dependencies": { "@ampproject/remapping": "^2.3.0", - "@bcoe/v8-coverage": "^0.2.3", - "debug": "^4.3.7", + "@bcoe/v8-coverage": "^1.0.2", + "debug": "^4.4.0", "istanbul-lib-coverage": "^3.2.2", "istanbul-lib-report": "^3.0.1", "istanbul-lib-source-maps": "^5.0.6", "istanbul-reports": "^3.1.7", - "magic-string": "^0.30.12", + "magic-string": "^0.30.17", "magicast": "^0.3.5", "std-env": "^3.8.0", "test-exclude": "^7.0.1", - "tinyrainbow": "^1.2.0" + "tinyrainbow": "^2.0.0" }, "funding": { "url": "https://opencollective.com/vitest" }, "peerDependencies": { - "@vitest/browser": "2.1.8", - "vitest": "2.1.8" + "@vitest/browser": "3.0.2", + "vitest": "3.0.2" }, "peerDependenciesMeta": { "@vitest/browser": { @@ -1141,38 +1392,38 @@ } }, "node_modules/@vitest/expect": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.1.8.tgz", - "integrity": "sha512-8ytZ/fFHq2g4PJVAtDX57mayemKgDR6X3Oa2Foro+EygiOJHUXhCqBAAKQYYajZpFoIfvBCF1j6R6IYRSIUFuw==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-3.0.2.tgz", + "integrity": "sha512-dKSHLBcoZI+3pmP5hiZ7I5grNru2HRtEW8Z5Zp4IXog8QYcxhlox7JUPyIIFWfN53+3HW3KPLIl6nSzUGgKSuQ==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/spy": "2.1.8", - "@vitest/utils": "2.1.8", + "@vitest/spy": "3.0.2", + "@vitest/utils": "3.0.2", "chai": "^5.1.2", - "tinyrainbow": "^1.2.0" + "tinyrainbow": "^2.0.0" }, "funding": { "url": "https://opencollective.com/vitest" } }, "node_modules/@vitest/mocker": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-2.1.8.tgz", - "integrity": "sha512-7guJ/47I6uqfttp33mgo6ga5Gr1VnL58rcqYKyShoRK9ebu8T5Rs6HN3s1NABiBeVTdWNrwUMcHH54uXZBN4zA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-3.0.2.tgz", + "integrity": "sha512-Hr09FoBf0jlwwSyzIF4Xw31OntpO3XtZjkccpcBf8FeVW3tpiyKlkeUzxS/txzHqpUCNIX157NaTySxedyZLvA==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/spy": "2.1.8", + "@vitest/spy": "3.0.2", "estree-walker": "^3.0.3", - "magic-string": "^0.30.12" + "magic-string": "^0.30.17" }, "funding": { "url": "https://opencollective.com/vitest" }, "peerDependencies": { "msw": "^2.4.9", - "vite": "^5.0.0" + "vite": "^5.0.0 || ^6.0.0" }, "peerDependenciesMeta": { "msw": { @@ -1184,51 +1435,51 @@ } }, "node_modules/@vitest/pretty-format": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-2.1.8.tgz", - "integrity": "sha512-9HiSZ9zpqNLKlbIDRWOnAWqgcA7xu+8YxXSekhr0Ykab7PAYFkhkwoqVArPOtJhPmYeE2YHgKZlj3CP36z2AJQ==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-3.0.2.tgz", + "integrity": "sha512-yBohcBw/T/p0/JRgYD+IYcjCmuHzjC3WLAKsVE4/LwiubzZkE8N49/xIQ/KGQwDRA8PaviF8IRO8JMWMngdVVQ==", "dev": true, "license": "MIT", "dependencies": { - "tinyrainbow": "^1.2.0" + "tinyrainbow": "^2.0.0" }, "funding": { "url": "https://opencollective.com/vitest" } }, "node_modules/@vitest/runner": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-2.1.8.tgz", - "integrity": "sha512-17ub8vQstRnRlIU5k50bG+QOMLHRhYPAna5tw8tYbj+jzjcspnwnwtPtiOlkuKC4+ixDPTuLZiqiWWQ2PSXHVg==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-3.0.2.tgz", + "integrity": "sha512-GHEsWoncrGxWuW8s405fVoDfSLk6RF2LCXp6XhevbtDjdDme1WV/eNmUueDfpY1IX3MJaCRelVCEXsT9cArfEg==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/utils": "2.1.8", - "pathe": "^1.1.2" + "@vitest/utils": "3.0.2", + "pathe": "^2.0.1" }, "funding": { "url": "https://opencollective.com/vitest" } }, "node_modules/@vitest/snapshot": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-2.1.8.tgz", - "integrity": "sha512-20T7xRFbmnkfcmgVEz+z3AU/3b0cEzZOt/zmnvZEctg64/QZbSDJEVm9fLnnlSi74KibmRsO9/Qabi+t0vCRPg==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-3.0.2.tgz", + "integrity": "sha512-h9s67yD4+g+JoYG0zPCo/cLTabpDqzqNdzMawmNPzDStTiwxwkyYM1v5lWE8gmGv3SVJ2DcxA2NpQJZJv9ym3g==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "2.1.8", - "magic-string": "^0.30.12", - "pathe": "^1.1.2" + "@vitest/pretty-format": "3.0.2", + "magic-string": "^0.30.17", + "pathe": "^2.0.1" }, "funding": { "url": "https://opencollective.com/vitest" } }, "node_modules/@vitest/spy": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-2.1.8.tgz", - "integrity": "sha512-5swjf2q95gXeYPevtW0BLk6H8+bPlMb4Vw/9Em4hFxDcaOxS+e0LOX4yqNxoHzMR2akEB2xfpnWUzkZokmgWDg==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-3.0.2.tgz", + "integrity": "sha512-8mI2iUn+PJFMT44e3ISA1R+K6ALVs47W6eriDTfXe6lFqlflID05MB4+rIFhmDSLBj8iBsZkzBYlgSkinxLzSQ==", "dev": true, "license": "MIT", "dependencies": { @@ -1239,39 +1490,39 @@ } }, "node_modules/@vitest/ui": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/@vitest/ui/-/ui-2.1.8.tgz", - "integrity": "sha512-5zPJ1fs0ixSVSs5+5V2XJjXLmNzjugHRyV11RqxYVR+oMcogZ9qTuSfKW+OcTV0JeFNznI83BNylzH6SSNJ1+w==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@vitest/ui/-/ui-3.0.2.tgz", + "integrity": "sha512-R0E4nG0OAafsCKwKnENLdjpMbxAyDqT/hdbJp71eeAR1wE+C7IFv1G158sRj5gUfJ7pM7IxtcwIqa34beYzLhg==", "dev": true, "license": "MIT", "optional": true, "peer": true, "dependencies": { - "@vitest/utils": "2.1.8", + "@vitest/utils": "3.0.2", "fflate": "^0.8.2", - "flatted": "^3.3.1", - "pathe": "^1.1.2", + "flatted": "^3.3.2", + "pathe": "^2.0.1", "sirv": "^3.0.0", "tinyglobby": "^0.2.10", - "tinyrainbow": "^1.2.0" + "tinyrainbow": "^2.0.0" }, "funding": { "url": "https://opencollective.com/vitest" }, "peerDependencies": { - "vitest": "2.1.8" + "vitest": "3.0.2" } }, "node_modules/@vitest/utils": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-2.1.8.tgz", - "integrity": "sha512-dwSoui6djdwbfFmIgbIjX2ZhIoG7Ex/+xpxyiEgIGzjliY8xGkcpITKTlp6B4MgtGkF2ilvm97cPM96XZaAgcA==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-3.0.2.tgz", + "integrity": "sha512-Qu01ZYZlgHvDP02JnMBRpX43nRaZtNpIzw3C1clDXmn8eakgX6iQVGzTQ/NjkIr64WD8ioqOjkaYRVvHQI5qiw==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/pretty-format": "2.1.8", + "@vitest/pretty-format": "3.0.2", "loupe": "^3.1.2", - "tinyrainbow": "^1.2.0" + "tinyrainbow": "^2.0.0" }, "funding": { "url": "https://opencollective.com/vitest" @@ -1381,6 +1632,19 @@ "concat-map": "0.0.1" } }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/cac": { "version": "6.7.14", "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", @@ -1778,6 +2042,36 @@ "dev": true, "license": "MIT" }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", @@ -1792,10 +2086,20 @@ "dev": true, "license": "MIT" }, + "node_modules/fastq": { + "version": "1.18.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.18.0.tgz", + "integrity": "sha512-QKHXPW0hD8g4UET03SdOdunzSouc9N4AuHdsX8XNcTsuz+yYFILVNIX4l9yHABMhiEI9Db0JTTIpu0wB+Y1QQw==", + "dev": true, + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, "node_modules/fdir": { - "version": "6.4.2", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.2.tgz", - "integrity": "sha512-KnhMXsKSPZlAhp7+IjUkRZKPb4fUyccpDrdFXbi4QL1qkmFh9kVY09Yox+n4MaOb3lHZ1Tv829C3oaaXoMYPDQ==", + "version": "6.4.3", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.3.tgz", + "integrity": "sha512-PMXmW2y1hDDfTSRc9gaXIuCCRpuoz3Kaz8cUelp3smouvfT632ozg2vrT6lJsHKKOF59YLbOGfAWGUcKEfRMQw==", "dev": true, "license": "MIT", "optional": true, @@ -1831,6 +2135,19 @@ "node": ">=16.0.0" } }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/find-up": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", @@ -1901,6 +2218,19 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, + "node_modules/get-tsconfig": { + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.8.1.tgz", + "integrity": "sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, "node_modules/glob": { "version": "10.4.5", "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", @@ -1974,6 +2304,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true, + "license": "MIT" + }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -2061,6 +2398,16 @@ "node": ">=0.10.0" } }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, "node_modules/isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", @@ -2271,6 +2618,43 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/micromatch/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -2447,9 +2831,9 @@ } }, "node_modules/pathe": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz", - "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.2.tgz", + "integrity": "sha512-15Ztpk+nov8DR524R4BF7uEuzESgzUEAV4Ah7CUMNGXdE5ELuvxElxGXndBl32vMSsWa1jpNf22Z+Er3sKwq+w==", "dev": true, "license": "MIT" }, @@ -2534,6 +2918,27 @@ "node": ">=6" } }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, "node_modules/resolve-from": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", @@ -2544,6 +2949,27 @@ "node": ">=4" } }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, "node_modules/rollup": { "version": "4.30.1", "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.30.1.tgz", @@ -2583,6 +3009,30 @@ "fsevents": "~2.3.2" } }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, "node_modules/semver": { "version": "7.6.3", "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", @@ -2902,9 +3352,9 @@ } }, "node_modules/tinyrainbow": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-1.2.0.tgz", - "integrity": "sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-2.0.0.tgz", + "integrity": "sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==", "dev": true, "license": "MIT", "engines": { @@ -2921,6 +3371,19 @@ "node": ">=14.0.0" } }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, "node_modules/totalist": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/totalist/-/totalist-3.0.1.tgz", @@ -2933,6 +3396,487 @@ "node": ">=6" } }, + "node_modules/ts-api-utils": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.0.0.tgz", + "integrity": "sha512-xCt/TOAc+EOHS1XPnijD3/yzpH6qg2xppZO1YDqGoVsNXfQfzHpOdNuXwrwOU8u4ITXJyDCTyt8w5g1sZv9ynQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, + "node_modules/tsx": { + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.19.2.tgz", + "integrity": "sha512-pOUl6Vo2LUq/bSa8S5q7b91cgNSjctn9ugq/+Mvow99qW6x/UZYwzxy/3NmqoT66eHYfCVvFvACC58UBPFf28g==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.23.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/tsx/node_modules/@esbuild/aix-ppc64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", + "integrity": "sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.1.tgz", + "integrity": "sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz", + "integrity": "sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/android-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.1.tgz", + "integrity": "sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz", + "integrity": "sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/darwin-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz", + "integrity": "sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz", + "integrity": "sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/freebsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz", + "integrity": "sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz", + "integrity": "sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz", + "integrity": "sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ia32": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz", + "integrity": "sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-loong64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz", + "integrity": "sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-mips64el": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz", + "integrity": "sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-ppc64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz", + "integrity": "sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-riscv64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz", + "integrity": "sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-s390x": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz", + "integrity": "sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/linux-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz", + "integrity": "sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/netbsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz", + "integrity": "sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/openbsd-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz", + "integrity": "sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/openbsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz", + "integrity": "sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/sunos-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz", + "integrity": "sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz", + "integrity": "sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-ia32": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz", + "integrity": "sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/@esbuild/win32-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz", + "integrity": "sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/tsx/node_modules/esbuild": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.1.tgz", + "integrity": "sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.23.1", + "@esbuild/android-arm": "0.23.1", + "@esbuild/android-arm64": "0.23.1", + "@esbuild/android-x64": "0.23.1", + "@esbuild/darwin-arm64": "0.23.1", + "@esbuild/darwin-x64": "0.23.1", + "@esbuild/freebsd-arm64": "0.23.1", + "@esbuild/freebsd-x64": "0.23.1", + "@esbuild/linux-arm": "0.23.1", + "@esbuild/linux-arm64": "0.23.1", + "@esbuild/linux-ia32": "0.23.1", + "@esbuild/linux-loong64": "0.23.1", + "@esbuild/linux-mips64el": "0.23.1", + "@esbuild/linux-ppc64": "0.23.1", + "@esbuild/linux-riscv64": "0.23.1", + "@esbuild/linux-s390x": "0.23.1", + "@esbuild/linux-x64": "0.23.1", + "@esbuild/netbsd-x64": "0.23.1", + "@esbuild/openbsd-arm64": "0.23.1", + "@esbuild/openbsd-x64": "0.23.1", + "@esbuild/sunos-x64": "0.23.1", + "@esbuild/win32-arm64": "0.23.1", + "@esbuild/win32-ia32": "0.23.1", + "@esbuild/win32-x64": "0.23.1" + } + }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -2960,6 +3904,29 @@ "node": ">=14.17" } }, + "node_modules/typescript-eslint": { + "version": "8.20.0", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.20.0.tgz", + "integrity": "sha512-Kxz2QRFsgbWj6Xcftlw3Dd154b3cEPFqQC+qMZrMypSijPd4UanKKvoKDrJ4o8AIfZFKAF+7sMaEIR8mTElozA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.20.0", + "@typescript-eslint/parser": "8.20.0", + "@typescript-eslint/utils": "8.20.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <5.8.0" + } + }, "node_modules/undici-types": { "version": "6.20.0", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", @@ -2978,21 +3945,21 @@ } }, "node_modules/vite": { - "version": "5.4.11", - "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.11.tgz", - "integrity": "sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==", + "version": "6.0.7", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.0.7.tgz", + "integrity": "sha512-RDt8r/7qx9940f8FcOIAH9PTViRrghKaK2K1jY3RaAURrEUbm9Du1mJ72G+jlhtG3WwodnfzY8ORQZbBavZEAQ==", "dev": true, "license": "MIT", "dependencies": { - "esbuild": "^0.21.3", - "postcss": "^8.4.43", - "rollup": "^4.20.0" + "esbuild": "^0.24.2", + "postcss": "^8.4.49", + "rollup": "^4.23.0" }, "bin": { "vite": "bin/vite.js" }, "engines": { - "node": "^18.0.0 || >=20.0.0" + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" }, "funding": { "url": "https://github.com/vitejs/vite?sponsor=1" @@ -3001,19 +3968,25 @@ "fsevents": "~2.3.3" }, "peerDependencies": { - "@types/node": "^18.0.0 || >=20.0.0", + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "jiti": ">=1.21.0", "less": "*", "lightningcss": "^1.21.0", "sass": "*", "sass-embedded": "*", "stylus": "*", "sugarss": "*", - "terser": "^5.4.0" + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" }, "peerDependenciesMeta": { "@types/node": { "optional": true }, + "jiti": { + "optional": true + }, "less": { "optional": true }, @@ -3034,504 +4007,80 @@ }, "terser": { "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true } } }, "node_modules/vite-node": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-2.1.8.tgz", - "integrity": "sha512-uPAwSr57kYjAUux+8E2j0q0Fxpn8M9VoyfGiRI8Kfktz9NcYMCenwY5RnZxnF1WTu3TGiYipirIzacLL3VVGFg==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-3.0.2.tgz", + "integrity": "sha512-hsEQerBAHvVAbv40m3TFQe/lTEbOp7yDpyqMJqr2Tnd+W58+DEYOt+fluQgekOePcsNBmR77lpVAnIU2Xu4SvQ==", "dev": true, "license": "MIT", "dependencies": { "cac": "^6.7.14", - "debug": "^4.3.7", - "es-module-lexer": "^1.5.4", - "pathe": "^1.1.2", - "vite": "^5.0.0" + "debug": "^4.4.0", + "es-module-lexer": "^1.6.0", + "pathe": "^2.0.1", + "vite": "^5.0.0 || ^6.0.0" }, "bin": { "vite-node": "vite-node.mjs" }, "engines": { - "node": "^18.0.0 || >=20.0.0" + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" }, "funding": { "url": "https://opencollective.com/vitest" } }, - "node_modules/vite/node_modules/@esbuild/aix-ppc64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.21.5.tgz", - "integrity": "sha512-1SDgH6ZSPTlggy1yI6+Dbkiz8xzpHJEVAlF/AM1tHPLsf5STom9rwtjE4hKAF20FfXXNTFqEYXyJNWh1GiZedQ==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "aix" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/android-arm": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.21.5.tgz", - "integrity": "sha512-vCPvzSjpPHEi1siZdlvAlsPxXl7WbOVUBBAowWug4rJHb68Ox8KualB+1ocNvT5fjv6wpkX6o/iEpbDrf68zcg==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/android-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.21.5.tgz", - "integrity": "sha512-c0uX9VAUBQ7dTDCjq+wdyGLowMdtR/GoC2U5IYk/7D1H1JYC0qseD7+11iMP2mRLN9RcCMRcjC4YMclCzGwS/A==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/android-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.21.5.tgz", - "integrity": "sha512-D7aPRUUNHRBwHxzxRvp856rjUHRFW1SdQATKXH2hqA0kAZb1hKmi02OpYRacl0TxIGz/ZmXWlbZgjwWYaCakTA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/darwin-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.21.5.tgz", - "integrity": "sha512-DwqXqZyuk5AiWWf3UfLiRDJ5EDd49zg6O9wclZ7kUMv2WRFr4HKjXp/5t8JZ11QbQfUS6/cRCKGwYhtNAY88kQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/darwin-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.21.5.tgz", - "integrity": "sha512-se/JjF8NlmKVG4kNIuyWMV/22ZaerB+qaSi5MdrXtd6R08kvs2qCN4C09miupktDitvh8jRFflwGFBQcxZRjbw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/freebsd-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.21.5.tgz", - "integrity": "sha512-5JcRxxRDUJLX8JXp/wcBCy3pENnCgBR9bN6JsY4OmhfUtIHe3ZW0mawA7+RDAcMLrMIZaf03NlQiX9DGyB8h4g==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/freebsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.21.5.tgz", - "integrity": "sha512-J95kNBj1zkbMXtHVH29bBriQygMXqoVQOQYA+ISs0/2l3T9/kj42ow2mpqerRBxDJnmkUDCaQT/dfNXWX/ZZCQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-arm": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.21.5.tgz", - "integrity": "sha512-bPb5AHZtbeNGjCKVZ9UGqGwo8EUu4cLq68E95A53KlxAPRmUyYv2D6F0uUI65XisGOL1hBP5mTronbgo+0bFcA==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.21.5.tgz", - "integrity": "sha512-ibKvmyYzKsBeX8d8I7MH/TMfWDXBF3db4qM6sy+7re0YXya+K1cem3on9XgdT2EQGMu4hQyZhan7TeQ8XkGp4Q==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-ia32": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.21.5.tgz", - "integrity": "sha512-YvjXDqLRqPDl2dvRODYmmhz4rPeVKYvppfGYKSNGdyZkA01046pLWyRKKI3ax8fbJoK5QbxblURkwK/MWY18Tg==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-loong64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.21.5.tgz", - "integrity": "sha512-uHf1BmMG8qEvzdrzAqg2SIG/02+4/DHB6a9Kbya0XDvwDEKCoC8ZRWI5JJvNdUjtciBGFQ5PuBlpEOXQj+JQSg==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-mips64el": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.21.5.tgz", - "integrity": "sha512-IajOmO+KJK23bj52dFSNCMsz1QP1DqM6cwLUv3W1QwyxkyIWecfafnI555fvSGqEKwjMXVLokcV5ygHW5b3Jbg==", - "cpu": [ - "mips64el" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-ppc64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.21.5.tgz", - "integrity": "sha512-1hHV/Z4OEfMwpLO8rp7CvlhBDnjsC3CttJXIhBi+5Aj5r+MBvy4egg7wCbe//hSsT+RvDAG7s81tAvpL2XAE4w==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-riscv64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.21.5.tgz", - "integrity": "sha512-2HdXDMd9GMgTGrPWnJzP2ALSokE/0O5HhTUvWIbD3YdjME8JwvSCnNGBnTThKGEB91OZhzrJ4qIIxk/SBmyDDA==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-s390x": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.21.5.tgz", - "integrity": "sha512-zus5sxzqBJD3eXxwvjN1yQkRepANgxE9lgOW2qLnmr8ikMTphkjgXu1HR01K4FJg8h1kEEDAqDcZQtbrRnB41A==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/linux-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.21.5.tgz", - "integrity": "sha512-1rYdTpyv03iycF1+BhzrzQJCdOuAOtaqHTWJZCWvijKD2N5Xu0TtVC8/+1faWqcP9iBCWOmjmhoH94dH82BxPQ==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/netbsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.21.5.tgz", - "integrity": "sha512-Woi2MXzXjMULccIwMnLciyZH4nCIMpWQAs049KEeMvOcNADVxo0UBIQPfSmxB3CWKedngg7sWZdLvLczpe0tLg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "netbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/openbsd-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.21.5.tgz", - "integrity": "sha512-HLNNw99xsvx12lFBUwoT8EVCsSvRNDVxNpjZ7bPn947b8gJPzeHWyNVhFsaerc0n3TsbOINvRP2byTZ5LKezow==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "openbsd" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/sunos-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.21.5.tgz", - "integrity": "sha512-6+gjmFpfy0BHU5Tpptkuh8+uw3mnrvgs+dSPQXQOv3ekbordwnzTVEb4qnIvQcYXq6gzkyTnoZ9dZG+D4garKg==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "sunos" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/win32-arm64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.21.5.tgz", - "integrity": "sha512-Z0gOTd75VvXqyq7nsl93zwahcTROgqvuAcYDUr+vOv8uHhNSKROyU961kgtCD1e95IqPKSQKH7tBTslnS3tA8A==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/win32-ia32": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.21.5.tgz", - "integrity": "sha512-SWXFF1CL2RVNMaVs+BBClwtfZSvDgtL//G/smwAc5oVK/UPu2Gu9tIaRgFmYFFKrmg3SyAjSrElf0TiJ1v8fYA==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/@esbuild/win32-x64": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.21.5.tgz", - "integrity": "sha512-tQd/1efJuzPC6rCFwEvLtci/xNFcTZknmXs98FYDfGE4wP9ClFV98nyKrzJKVPMhdDnjzLhdUyMX4PsQAPjwIw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ], - "engines": { - "node": ">=12" - } - }, - "node_modules/vite/node_modules/esbuild": { - "version": "0.21.5", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.21.5.tgz", - "integrity": "sha512-mg3OPMV4hXywwpoDxu3Qda5xCKQi+vCTZq8S9J/EpkhB2HzKXq4SNFZE3+NK93JYxc8VMSep+lOUSC/RVKaBqw==", - "dev": true, - "hasInstallScript": true, - "license": "MIT", - "bin": { - "esbuild": "bin/esbuild" - }, - "engines": { - "node": ">=12" - }, - "optionalDependencies": { - "@esbuild/aix-ppc64": "0.21.5", - "@esbuild/android-arm": "0.21.5", - "@esbuild/android-arm64": "0.21.5", - "@esbuild/android-x64": "0.21.5", - "@esbuild/darwin-arm64": "0.21.5", - "@esbuild/darwin-x64": "0.21.5", - "@esbuild/freebsd-arm64": "0.21.5", - "@esbuild/freebsd-x64": "0.21.5", - "@esbuild/linux-arm": "0.21.5", - "@esbuild/linux-arm64": "0.21.5", - "@esbuild/linux-ia32": "0.21.5", - "@esbuild/linux-loong64": "0.21.5", - "@esbuild/linux-mips64el": "0.21.5", - "@esbuild/linux-ppc64": "0.21.5", - "@esbuild/linux-riscv64": "0.21.5", - "@esbuild/linux-s390x": "0.21.5", - "@esbuild/linux-x64": "0.21.5", - "@esbuild/netbsd-x64": "0.21.5", - "@esbuild/openbsd-x64": "0.21.5", - "@esbuild/sunos-x64": "0.21.5", - "@esbuild/win32-arm64": "0.21.5", - "@esbuild/win32-ia32": "0.21.5", - "@esbuild/win32-x64": "0.21.5" - } - }, "node_modules/vitest": { - "version": "2.1.8", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-2.1.8.tgz", - "integrity": "sha512-1vBKTZskHw/aosXqQUlVWWlGUxSJR8YtiyZDJAFeW2kPAeX6S3Sool0mjspO+kXLuxVWlEDDowBAeqeAQefqLQ==", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-3.0.2.tgz", + "integrity": "sha512-5bzaHakQ0hmVVKLhfh/jXf6oETDBtgPo8tQCHYB+wftNgFJ+Hah67IsWc8ivx4vFL025Ow8UiuTf4W57z4izvQ==", "dev": true, "license": "MIT", "dependencies": { - "@vitest/expect": "2.1.8", - "@vitest/mocker": "2.1.8", - "@vitest/pretty-format": "^2.1.8", - "@vitest/runner": "2.1.8", - "@vitest/snapshot": "2.1.8", - "@vitest/spy": "2.1.8", - "@vitest/utils": "2.1.8", + "@vitest/expect": "3.0.2", + "@vitest/mocker": "3.0.2", + "@vitest/pretty-format": "^3.0.2", + "@vitest/runner": "3.0.2", + "@vitest/snapshot": "3.0.2", + "@vitest/spy": "3.0.2", + "@vitest/utils": "3.0.2", "chai": "^5.1.2", - "debug": "^4.3.7", + "debug": "^4.4.0", "expect-type": "^1.1.0", - "magic-string": "^0.30.12", - "pathe": "^1.1.2", + "magic-string": "^0.30.17", + "pathe": "^2.0.1", "std-env": "^3.8.0", "tinybench": "^2.9.0", - "tinyexec": "^0.3.1", - "tinypool": "^1.0.1", - "tinyrainbow": "^1.2.0", - "vite": "^5.0.0", - "vite-node": "2.1.8", + "tinyexec": "^0.3.2", + "tinypool": "^1.0.2", + "tinyrainbow": "^2.0.0", + "vite": "^5.0.0 || ^6.0.0", + "vite-node": "3.0.2", "why-is-node-running": "^2.3.0" }, "bin": { "vitest": "vitest.mjs" }, "engines": { - "node": "^18.0.0 || >=20.0.0" + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" }, "funding": { "url": "https://opencollective.com/vitest" }, "peerDependencies": { "@edge-runtime/vm": "*", - "@types/node": "^18.0.0 || >=20.0.0", - "@vitest/browser": "2.1.8", - "@vitest/ui": "2.1.8", + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "@vitest/browser": "3.0.2", + "@vitest/ui": "3.0.2", "happy-dom": "*", "jsdom": "*" }, diff --git a/lib/binding_web/package.json b/lib/binding_web/package.json index 571aa68e..68202234 100644 --- a/lib/binding_web/package.json +++ b/lib/binding_web/package.json @@ -30,17 +30,23 @@ "tree-sitter.js.map", "tree-sitter.wasm", "tree-sitter.wasm.map", - "tree-sitter-web.d.ts" + "tree-sitter-web.d.ts", + "debug/tree-sitter.js", + "debug/tree-sitter.js.map", + "debug/tree-sitter.wasm", + "debug/tree-sitter.wasm.map" ], "devDependencies": { + "@eslint/js": "^9.18.0", "@types/emscripten": "^1.39.13", "@types/node": "^22.10.7", - "@vitest/coverage-v8": "^2.1.8", + "@vitest/coverage-v8": "^3.0.2", "esbuild": "^0.24.2", - "eslint": ">=9.18.0", + "eslint": "^9.18.0", "source-map": "^0.7.4", "typescript": "^5.7.3", - "vitest": "^2.1.8" + "typescript-eslint": "^8.20.0", + "vitest": "^3.0.2" }, "scripts": { "build:ts": "esbuild src/index.ts --bundle --platform=neutral --format=cjs --global-name=TreeSitterImpl --outfile=dist/tree-sitter.js --external:fs/* --external:fs/promises --sourcemap --sources-content=true --keep-names", diff --git a/lib/binding_web/src/constants.ts b/lib/binding_web/src/constants.ts index a10327c1..a0681946 100644 --- a/lib/binding_web/src/constants.ts +++ b/lib/binding_web/src/constants.ts @@ -1,4 +1,4 @@ -import { CaptureQuantifier } from "./query"; +import { CaptureQuantifier } from './query'; export interface Point { row: number; @@ -48,14 +48,15 @@ export function assertInternal(x: unknown): asserts x is Internal { if (x !== INTERNAL) throw new Error('Illegal constructor'); } -export function isPoint(point: Point): point is Point { +export function isPoint(point?: Point): point is Point { return ( !!point && - typeof (point as Point).row === 'number' && - typeof (point as Point).column === 'number' + typeof (point).row === 'number' && + typeof (point).column === 'number' ); } +// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment export const C: EmscriptenModule & { // Global _ts_init(): number; @@ -69,7 +70,6 @@ export const C: EmscriptenModule & { _ts_parser_new_wasm(): void; _ts_parser_delete(address: number): void; _ts_parser_set_language(parserAddress: number, languageAddress: number): void; - _ts_language_version(address: number): number; _ts_parser_enable_logger_wasm(address: number, enabled: number): void; _ts_parser_parse_wasm( address: number, @@ -234,5 +234,5 @@ export const C: EmscriptenModule & { _ts_lookahead_iterator_reset(address: number, languageAddress: number, stateId: number): boolean; _ts_lookahead_iterator_next(address: number): boolean; - // @ts-ignore + // @ts-expect-error Module is defined after compilation } = Module; diff --git a/lib/binding_web/src/language.ts b/lib/binding_web/src/language.ts index 43fab05f..5eacc968 100644 --- a/lib/binding_web/src/language.ts +++ b/lib/binding_web/src/language.ts @@ -4,11 +4,7 @@ import { Node } from './node'; import { TRANSFER_BUFFER } from './parser'; import { CaptureQuantifier, Predicate, PredicateStep, Properties, Query, TextPredicate } from './query'; -declare const UTF8ToString: (ptr: number, maxBytesToRead?: number) => string; -declare const lengthBytesUTF8: (str: string) => number; -declare const stringToUTF8: (str: string, outPtr: number, maxBytesToRead: number) => void; -declare const getValue: (ptr: number, type: string) => any; -declare const loadWebAssemblyModule: (bytes: Uint8Array, options: { loadAsync: boolean }) => Promise; +declare const loadWebAssemblyModule: (bytes: Uint8Array, options: { loadAsync: boolean }) => Promise number>>; const PREDICATE_STEP_TYPE_CAPTURE = 1; const PREDICATE_STEP_TYPE_STRING = 2; @@ -24,13 +20,13 @@ export class Language { constructor(internal: Internal, address: number) { assertInternal(internal); this[0] = address; - this.types = new Array(C._ts_language_symbol_count(this[0])); + this.types = new Array(C._ts_language_symbol_count(this[0])); for (let i = 0, n = this.types.length; i < n; i++) { if (C._ts_language_symbol_type(this[0], i) < 2) { this.types[i] = UTF8ToString(C._ts_language_symbol_name(this[0], i)); } } - this.fields = new Array(C._ts_language_field_count(this[0]) + 1); + this.fields = new Array(C._ts_language_field_count(this[0]) + 1); for (let i = 0, n = this.fields.length; i < n; i++) { const fieldName = C._ts_language_field_name_for_id(this[0], i); if (fieldName !== 0) { @@ -65,7 +61,7 @@ export class Language { } fieldNameForId(fieldId: number): string | null { - return this.fields[fieldId] || null; + return this.fields[fieldId] ?? null; } idForNodeType(type: string, named: boolean): number | null { @@ -98,7 +94,7 @@ export class Language { C._ts_language_supertypes_wasm(this[0]); const count = getValue(TRANSFER_BUFFER, 'i32'); const buffer = getValue(TRANSFER_BUFFER + SIZE_OF_INT, 'i32'); - const result = new Array(count); + const result = new Array(count); if (count > 0) { let address = buffer; @@ -115,7 +111,7 @@ export class Language { C._ts_language_subtypes_wasm(this[0], supertype); const count = getValue(TRANSFER_BUFFER, 'i32'); const buffer = getValue(TRANSFER_BUFFER + SIZE_OF_INT, 'i32'); - const result = new Array(count); + const result = new Array(count); if (count > 0) { let address = buffer; @@ -155,7 +151,7 @@ export class Language { const errorByte = getValue(TRANSFER_BUFFER, 'i32'); const errorIndex = UTF8ToString(sourceAddress, errorByte).length; const suffix = source.slice(errorIndex, errorIndex + 100).split('\n')[0]; - let word = suffix.match(QUERY_WORD_REGEX)?.[0] || ''; + let word = suffix.match(QUERY_WORD_REGEX)?.[0] ?? ''; let error: Error; switch (errorId) { @@ -178,7 +174,9 @@ export class Language { break; } + // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access (error as any).index = errorIndex; + // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access (error as any).length = word.length; C._free(sourceAddress); throw error; @@ -188,7 +186,7 @@ export class Language { const captureCount = C._ts_query_capture_count(address); const patternCount = C._ts_query_pattern_count(address); const captureNames = new Array(captureCount); - const captureQuantifiers = new Array>(patternCount); + const captureQuantifiers = new Array(patternCount); const stringValues = new Array(stringCount); for (let i = 0; i < captureCount; i++) { @@ -223,8 +221,8 @@ export class Language { const setProperties = new Array(patternCount); const assertedProperties = new Array(patternCount); const refutedProperties = new Array(patternCount); - const predicates = new Array>(patternCount); - const textPredicates = new Array>(patternCount); + const predicates = new Array(patternCount); + const textPredicates = new Array(patternCount); for (let i = 0; i < patternCount; i++) { const predicatesAddress = C._ts_query_predicates_for_pattern( @@ -255,7 +253,7 @@ export class Language { throw new Error('Predicates must begin with a literal value'); } - const operator = steps[0].value!; + const operator = steps[0].value; let isPositive = true; let matchAll = true; let captureName: string | undefined; @@ -278,8 +276,8 @@ export class Language { } matchAll = !operator.startsWith('any-'); if (steps[2].type === 'capture') { - const captureName1 = steps[1].name!; - const captureName2 = steps[2].name!; + const captureName1 = steps[1].name; + const captureName2 = steps[2].name; textPredicates[i].push((captures) => { const nodes1: Node[] = []; const nodes2: Node[] = []; @@ -366,7 +364,7 @@ export class Language { ); } if (!setProperties[i]) setProperties[i] = {}; - setProperties[i][steps[1].value!] = steps[2]?.value || null; + setProperties[i][steps[1].value!] = steps[2]?.value ?? null; break; } @@ -384,7 +382,7 @@ export class Language { } const properties = operator === 'is?' ? assertedProperties : refutedProperties; if (!properties[i]) properties[i] = {}; - properties[i][steps[1].value!] = steps[2]?.value || null; + properties[i][steps[1].value!] = steps[2]?.value ?? null; break; } @@ -448,15 +446,14 @@ export class Language { ); } - static load(input: string | Uint8Array): Promise { + static async load(input: string | Uint8Array): Promise { let bytes: Promise; if (input instanceof Uint8Array) { bytes = Promise.resolve(input); } else { - // @ts-ignore - if (globalThis.process?.versions?.node) { - // @ts-ignore - const fs = require('fs/promises'); + if (globalThis.process.versions.node) { + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-require-imports + const fs: typeof import('fs/promises') = require('fs/promises'); bytes = fs.readFile(input); } else { bytes = fetch(input) @@ -472,20 +469,15 @@ export class Language { } } - return bytes - .then((bytes) => loadWebAssemblyModule(bytes, { loadAsync: true })) - .then((mod) => { - const symbolNames = Object.keys(mod); - const functionName = symbolNames.find((key) => - LANGUAGE_FUNCTION_REGEX.test(key) && - !key.includes('external_scanner_'), - ); - if (!functionName) { - console.log(`Couldn't find language function in WASM file. Symbols:\n${JSON.stringify(symbolNames, null, 2)}`); - throw new Error('Language.load failed: no language function found in WASM file'); - } - const languageAddress = mod[functionName](); - return new Language(INTERNAL, languageAddress); - }); + const mod = await loadWebAssemblyModule(await bytes, { loadAsync: true }); + const symbolNames = Object.keys(mod); + const functionName = symbolNames.find((key) => LANGUAGE_FUNCTION_REGEX.test(key) && + !key.includes('external_scanner_')); + if (!functionName) { + console.log(`Couldn't find language function in WASM file. Symbols:\n${JSON.stringify(symbolNames, null, 2)}`); + throw new Error('Language.load failed: no language function found in WASM file'); + } + const languageAddress = mod[functionName](); + return new Language(INTERNAL, languageAddress); } } diff --git a/lib/binding_web/src/lookahead_iterator.ts b/lib/binding_web/src/lookahead_iterator.ts index b84d2d38..001466d6 100644 --- a/lib/binding_web/src/lookahead_iterator.ts +++ b/lib/binding_web/src/lookahead_iterator.ts @@ -37,11 +37,10 @@ export class LookaheadIterator implements Iterable { } [Symbol.iterator](): Iterator { - const self = this; return { - next(): IteratorResult { - if (C._ts_lookahead_iterator_next(self[0])) { - return { done: false, value: self.currentType }; + next: (): IteratorResult => { + if (C._ts_lookahead_iterator_next(this[0])) { + return { done: false, value: this.currentType }; } return { done: true, value: '' }; } diff --git a/lib/binding_web/src/marshal.ts b/lib/binding_web/src/marshal.ts index 38f23917..0661cc8c 100644 --- a/lib/binding_web/src/marshal.ts +++ b/lib/binding_web/src/marshal.ts @@ -5,7 +5,7 @@ import { Query } from "./query"; import { TreeCursor } from "./tree_cursor"; import { TRANSFER_BUFFER } from "./parser"; -export function unmarshalCaptures(query: Query, tree: Tree, address: number, result: Array<{name: string, node: Node}>) { +export function unmarshalCaptures(query: Query, tree: Tree, address: number, result: {name: string, node: Node}[]) { for (let i = 0, n = result.length; i < n; i++) { const captureIndex = getValue(address, 'i32'); address += SIZE_OF_INT; diff --git a/lib/binding_web/src/node.ts b/lib/binding_web/src/node.ts index 9000b073..aed0ead8 100644 --- a/lib/binding_web/src/node.ts +++ b/lib/binding_web/src/node.ts @@ -7,7 +7,6 @@ import { TRANSFER_BUFFER } from './parser'; declare const AsciiToString: (ptr: number) => string; export class Node { - // @ts-ignore private [0]: number; // Internal handle for WASM private _children?: (Node | null)[]; private _namedChildren?: (Node | null)[]; diff --git a/lib/binding_web/src/parser.ts b/lib/binding_web/src/parser.ts index 9a419dce..700c36a5 100644 --- a/lib/binding_web/src/parser.ts +++ b/lib/binding_web/src/parser.ts @@ -3,10 +3,6 @@ import { Language } from './language'; import { marshalRange, unmarshalRange } from './marshal'; import { Tree } from './tree'; -declare const getValue: (ptr: number, type: string) => any; -declare const Module: { [key: string]: any }; -declare let initPromise: Promise; - interface ParseOptions { includedRanges?: Range[]; progressCallback?: (percent: number) => void; @@ -21,16 +17,15 @@ export let TRANSFER_BUFFER: number; let VERSION: number; let MIN_COMPATIBLE_VERSION: number; -// @ts-ignore let currentParseCallback: ((index: number, position: Point) => string) | null = null; -// @ts-ignore +// eslint-disable-next-line @typescript-eslint/no-unused-vars let currentLogCallback: LogCallback = null; -// @ts-ignore +// eslint-disable-next-line @typescript-eslint/no-unused-vars let currentProgressCallback: ((percent: number) => void) | null = null; export class ParserImpl { - protected [0]: number = 0; - protected [1]: number = 0; + protected [0] = 0; + protected [1] = 0; protected language: Language | null = null; protected logCallback: LogCallback = null; static Language: typeof Language; @@ -94,7 +89,7 @@ export class ParserImpl { throw new Error('Argument must be a string or a function'); } - if (options?.progressCallback) { + if (options.progressCallback) { currentProgressCallback = options.progressCallback; } else { currentProgressCallback = null; @@ -110,7 +105,7 @@ export class ParserImpl { let rangeCount = 0; let rangeAddress = 0; - if (options?.includedRanges) { + if (options.includedRanges) { rangeCount = options.includedRanges.length; rangeAddress = C._calloc(rangeCount, SIZE_OF_RANGE); let address = rangeAddress; @@ -154,7 +149,7 @@ export class ParserImpl { C._ts_parser_included_ranges_wasm(this[0]); const count = getValue(TRANSFER_BUFFER, 'i32'); const buffer = getValue(TRANSFER_BUFFER + SIZE_OF_INT, 'i32'); - const result: Range[] = new Array(count); + const result = new Array(count); if (count > 0) { let address = buffer; diff --git a/lib/binding_web/src/query.ts b/lib/binding_web/src/query.ts index fdbbb2a3..7c055dbf 100644 --- a/lib/binding_web/src/query.ts +++ b/lib/binding_web/src/query.ts @@ -3,7 +3,7 @@ import { Node } from './node'; import { marshalNode, unmarshalCaptures } from './marshal'; import { TRANSFER_BUFFER } from './parser'; -// @ts-ignore +// eslint-disable-next-line @typescript-eslint/no-unused-vars let currentQueryProgressCallback: ((percent: number) => void) | null = null; interface QueryOptions { @@ -17,9 +17,7 @@ interface QueryOptions { progressCallback?: (percent: number) => void; } -export interface Properties { - [key: string]: string | null; -} +export type Properties = Record; export interface Predicate { operator: string; @@ -56,7 +54,7 @@ export type PredicateStep = | { type: 'string'; value: string } | { type: 'capture'; value?: string, name: string }; -export type TextPredicate = (captures: Array) => boolean; +export type TextPredicate = (captures: Capture[]) => boolean; export class Query { private [0]: number; // Internal handle for WASM @@ -64,7 +62,7 @@ export class Query { private textPredicates: TextPredicate[][]; readonly captureNames: string[]; - readonly captureQuantifiers: number[][]; + readonly captureQuantifiers: CaptureQuantifier[][]; readonly predicates: Predicate[][]; readonly setProperties: Properties[]; readonly assertedProperties: Properties[]; @@ -75,7 +73,7 @@ export class Query { internal: Internal, address: number, captureNames: string[], - captureQuantifiers: number[][], + captureQuantifiers: CaptureQuantifier[][], textPredicates: TextPredicate[][], predicates: Predicate[][], setProperties: Properties[], @@ -103,13 +101,13 @@ export class Query { node: Node, options: QueryOptions = {} ): QueryMatch[] { - const startPosition = options.startPosition || ZERO_POINT; - const endPosition = options.endPosition || ZERO_POINT; - const startIndex = options.startIndex || 0; - const endIndex = options.endIndex || 0; - const matchLimit = options.matchLimit || 0xFFFFFFFF; - const maxStartDepth = options.maxStartDepth || 0xFFFFFFFF; - const timeoutMicros = options.timeoutMicros || 0; + const startPosition = options.startPosition ?? ZERO_POINT; + const endPosition = options.endPosition ?? ZERO_POINT; + const startIndex = options.startIndex ?? 0; + const endIndex = options.endIndex ?? 0; + const matchLimit = options.matchLimit ?? 0xFFFFFFFF; + const maxStartDepth = options.maxStartDepth ?? 0xFFFFFFFF; + const timeoutMicros = options.timeoutMicros ?? 0; const progressCallback = options.progressCallback; if (typeof matchLimit !== 'number') { @@ -151,7 +149,7 @@ export class Query { const rawCount = getValue(TRANSFER_BUFFER, 'i32'); const startAddress = getValue(TRANSFER_BUFFER + SIZE_OF_INT, 'i32'); const didExceedMatchLimit = getValue(TRANSFER_BUFFER + 2 * SIZE_OF_INT, 'i32'); - const result = new Array(rawCount); + const result = new Array(rawCount); this.exceededMatchLimit = Boolean(didExceedMatchLimit); let filteredCount = 0; @@ -162,17 +160,17 @@ export class Query { const captureCount = getValue(address, 'i32'); address += SIZE_OF_INT; - const captures: Capture[] = new Array(captureCount); + const captures = new Array(captureCount); address = unmarshalCaptures(this, node.tree, address, captures); if (this.textPredicates[pattern].every((p) => p(captures))) { result[filteredCount] = { pattern, captures }; const setProperties = this.setProperties[pattern]; - if (setProperties) result[filteredCount].setProperties = setProperties; + result[filteredCount].setProperties = setProperties; const assertedProperties = this.assertedProperties[pattern]; - if (assertedProperties) result[filteredCount].assertedProperties = assertedProperties; + result[filteredCount].assertedProperties = assertedProperties; const refutedProperties = this.refutedProperties[pattern]; - if (refutedProperties) result[filteredCount].refutedProperties = refutedProperties; + result[filteredCount].refutedProperties = refutedProperties; filteredCount++; } } @@ -187,13 +185,13 @@ export class Query { node: Node, options: QueryOptions = {} ): Capture[] { - const startPosition = options.startPosition || ZERO_POINT; - const endPosition = options.endPosition || ZERO_POINT; - const startIndex = options.startIndex || 0; - const endIndex = options.endIndex || 0; - const matchLimit = options.matchLimit || 0xFFFFFFFF; - const maxStartDepth = options.maxStartDepth || 0xFFFFFFFF; - const timeoutMicros = options.timeoutMicros || 0; + const startPosition = options.startPosition ?? ZERO_POINT; + const endPosition = options.endPosition ?? ZERO_POINT; + const startIndex = options.startIndex ?? 0; + const endIndex = options.endIndex ?? 0; + const matchLimit = options.matchLimit ?? 0xFFFFFFFF; + const maxStartDepth = options.maxStartDepth ?? 0xFFFFFFFF; + const timeoutMicros = options.timeoutMicros ?? 0; const progressCallback = options.progressCallback; if (typeof matchLimit !== 'number') { @@ -254,11 +252,11 @@ export class Query { if (this.textPredicates[pattern].every((p) => p(captures))) { const capture = captures[captureIndex]; const setProperties = this.setProperties[pattern]; - if (setProperties) capture.setProperties = setProperties; + capture.setProperties = setProperties; const assertedProperties = this.assertedProperties[pattern]; - if (assertedProperties) capture.assertedProperties = assertedProperties; + capture.assertedProperties = assertedProperties; const refutedProperties = this.refutedProperties[pattern]; - if (refutedProperties) capture.refutedProperties = refutedProperties; + capture.refutedProperties = refutedProperties; result.push(capture); } } diff --git a/lib/binding_web/src/tree.ts b/lib/binding_web/src/tree.ts index e6e97907..27fe3d16 100644 --- a/lib/binding_web/src/tree.ts +++ b/lib/binding_web/src/tree.ts @@ -23,7 +23,7 @@ export function getText(tree: Tree, startIndex: number, endIndex: number, startP result = result.slice(0, length); } } - return result || ''; + return result ?? ''; } export class Tree { @@ -83,7 +83,7 @@ export class Tree { C._ts_tree_get_changed_ranges_wasm(this[0], other[0]); const count = getValue(TRANSFER_BUFFER, 'i32'); const buffer = getValue(TRANSFER_BUFFER + SIZE_OF_INT, 'i32'); - const result = new Array(count); + const result = new Array(count); if (count > 0) { let address = buffer; @@ -100,7 +100,7 @@ export class Tree { C._ts_tree_included_ranges_wasm(this[0]); const count = getValue(TRANSFER_BUFFER, 'i32'); const buffer = getValue(TRANSFER_BUFFER + SIZE_OF_INT, 'i32'); - const result = new Array(count); + const result = new Array(count); if (count > 0) { let address = buffer; diff --git a/lib/binding_web/src/tree_cursor.ts b/lib/binding_web/src/tree_cursor.ts index 8de0ce96..2b9395c6 100644 --- a/lib/binding_web/src/tree_cursor.ts +++ b/lib/binding_web/src/tree_cursor.ts @@ -5,14 +5,14 @@ import { TRANSFER_BUFFER } from './parser'; import { getText, Tree } from './tree'; export class TreeCursor { - // @ts-ignore - private [0]: number; // Internal handle for WASM - // @ts-ignore - private [1]: number; // Internal handle for WASM - // @ts-ignore - private [2]: number; // Internal handle for WASM - // @ts-ignore - private [3]: number; // Internal handle for WASM + // @ts-expect-error Internal handle for WASM + private [0]: number; + // @ts-expect-error Internal handle for WASM + private [1]: number; + // @ts-expect-error Internal handle for WASM + private [2]: number; + // @ts-expect-error Internal handle for WASM + private [3]: number; private tree: Tree; diff --git a/lib/binding_web/test/helper.ts b/lib/binding_web/test/helper.ts index 31287f19..74210385 100644 --- a/lib/binding_web/test/helper.ts +++ b/lib/binding_web/test/helper.ts @@ -1,13 +1,16 @@ -import TSParser from "web-tree-sitter"; +import type { default as ParserType } from 'web-tree-sitter'; +import path from 'path'; -// @ts-ignore -const Parser: typeof TSParser = await import('..').then(m => m.default); +// @ts-expect-error We're intentionally importing ../tree-sitter.js +// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access +const Parser: typeof ParserType = await import('..').then(m => m.default); // https://github.com/tree-sitter/tree-sitter/blob/master/xtask/src/fetch.rs#L15 -type LanguageName = "bash" | "c" | "cpp" | "embedded-template" | "go" | "html" | "java" | "javascript" | "jsdoc" | "json" | "php" | "python" | "ruby" | "rust" | "typescript"; +export type LanguageName = 'bash' | 'c' | 'cpp' | 'embedded-template' | 'go' | 'html' | 'java' | 'javascript' | 'jsdoc' | 'json' | 'php' | 'python' | 'ruby' | 'rust' | 'typescript' | 'tsx'; function languageURL(name: LanguageName): string { - return new URL(`../../../target/release/tree-sitter-${name}.wasm`, import.meta.url).pathname; + const basePath = process.cwd(); + return path.join(basePath, `../../target/release/tree-sitter-${name}.wasm`); } export default Parser.init().then(async () => ({ diff --git a/lib/binding_web/test/language.test.ts b/lib/binding_web/test/language.test.ts index a7c5cc7d..2a1f0ae1 100644 --- a/lib/binding_web/test/language.test.ts +++ b/lib/binding_web/test/language.test.ts @@ -1,6 +1,6 @@ import { describe, it, expect, beforeAll, afterAll } from 'vitest'; import helper from './helper'; -import TSParser, { type LookaheadIterable, type Language } from 'web-tree-sitter'; +import type { default as ParserType, LookaheadIterable, Language } from 'web-tree-sitter'; let JavaScript: Language; let Rust: Language; @@ -40,10 +40,10 @@ describe('Language', () => { expect(exportStatementId).toBeLessThan(JavaScript.nodeTypeCount); expect(starId).toBeLessThan(JavaScript.nodeTypeCount); - expect(JavaScript.nodeTypeIsNamed(exportStatementId!)).toBe(true); - expect(JavaScript.nodeTypeForId(exportStatementId!)).toBe('export_statement'); - expect(JavaScript.nodeTypeIsNamed(starId!)).toBe(false); - expect(JavaScript.nodeTypeForId(starId!)).toBe('*'); + expect(JavaScript.nodeTypeIsNamed(exportStatementId)).toBe(true); + expect(JavaScript.nodeTypeForId(exportStatementId)).toBe('export_statement'); + expect(JavaScript.nodeTypeIsNamed(starId)).toBe(false); + expect(JavaScript.nodeTypeForId(starId)).toBe('*'); }); it('handles invalid inputs', () => { @@ -135,7 +135,7 @@ describe('Lookahead iterator', () => { let state: number; beforeAll(async () => { - let Parser: typeof TSParser; + let Parser: typeof ParserType; ({ JavaScript, Parser } = await helper); const parser = new Parser(); parser.setLanguage(JavaScript); @@ -149,7 +149,7 @@ describe('Lookahead iterator', () => { expect(lookahead).toBeDefined(); }); - afterAll(() => lookahead.delete()); + afterAll(() => { lookahead.delete() }); const expected = ['(', 'identifier', '*', 'formal_parameters', 'html_comment', 'comment']; diff --git a/lib/binding_web/test/node.test.ts b/lib/binding_web/test/node.test.ts index 0ace6534..baa301ad 100644 --- a/lib/binding_web/test/node.test.ts +++ b/lib/binding_web/test/node.test.ts @@ -1,8 +1,8 @@ import { describe, it, expect, beforeAll, beforeEach, afterEach } from 'vitest'; -import TSParser, { type Language, type Tree, type SyntaxNode, type Point } from 'web-tree-sitter'; +import type { default as ParserType, Language, Tree, SyntaxNode } from 'web-tree-sitter'; import helper from './helper'; -let Parser: typeof TSParser; +let Parser: typeof ParserType; let C: Language; let JavaScript: Language; let JSON: Language; @@ -40,7 +40,7 @@ function getAllNodes(tree: Tree): SyntaxNode[] { } describe('Node', () => { - let parser: TSParser; + let parser: ParserType; let tree: Tree | null; beforeAll(async () => { @@ -220,15 +220,17 @@ describe('Node', () => { it('returns the smallest node that spans the given range', () => { tree = parser.parse('x10 + 1000'); const sumNode = tree.rootNode.firstChild!.firstChild; - expect(sumNode!.descendantForIndex(1, 2)!.type).toBe('identifier'); - expect(sumNode!.descendantForIndex(4, 4)!.type).toBe('+'); + expect(sumNode!.descendantForIndex(1, 2).type).toBe('identifier'); + expect(sumNode!.descendantForIndex(4, 4).type).toBe('+'); expect(() => { - sumNode!.descendantForIndex(1, {} as any); + // @ts-expect-error Testing invalid arguments + sumNode!.descendantForIndex(1, {}); }).toThrow('Arguments must be numbers'); expect(() => { - sumNode!.descendantForIndex(undefined as any); + // @ts-expect-error Testing invalid arguments + sumNode!.descendantForIndex(undefined); }).toThrow('Arguments must be numbers'); }); }); @@ -237,8 +239,8 @@ describe('Node', () => { it('returns the smallest named node that spans the given range', () => { tree = parser.parse('x10 + 1000'); const sumNode = tree.rootNode.firstChild; - expect(sumNode!.descendantForIndex(1, 2)!.type).toBe('identifier'); - expect(sumNode!.descendantForIndex(4, 4)!.type).toBe('+'); + expect(sumNode!.descendantForIndex(1, 2).type).toBe('identifier'); + expect(sumNode!.descendantForIndex(4, 4).type).toBe('+'); }); }); @@ -251,19 +253,21 @@ describe('Node', () => { sumNode!.descendantForPosition( { row: 0, column: 1 }, { row: 0, column: 2 } - )!.type + ).type ).toBe('identifier'); expect( - sumNode!.descendantForPosition({ row: 0, column: 4 })!.type + sumNode!.descendantForPosition({ row: 0, column: 4 }).type ).toBe('+'); expect(() => { - sumNode!.descendantForPosition(1 as any, {} as any); + // @ts-expect-error Testing invalid arguments + sumNode!.descendantForPosition(1, {}); }).toThrow('Arguments must be {row, column} objects'); expect(() => { - sumNode!.descendantForPosition(undefined as any); + // @ts-expect-error Testing invalid arguments + sumNode!.descendantForPosition(undefined); }).toThrow('Arguments must be {row, column} objects'); }); }); @@ -343,9 +347,9 @@ describe('Node', () => { const commentNode = node.descendantForIndex(7, 7); expect(node.type).toBe('program'); - expect(commentNode!.type).toBe('comment'); + expect(commentNode.type).toBe('comment'); expect(node.isExtra).toBe(false); - expect(commentNode!.isExtra).toBe(true); + expect(commentNode.isExtra).toBe(true); }); }); @@ -355,20 +359,20 @@ describe('Node', () => { Object.entries({ '.parse(String)': text, '.parse(Function)': (offset: number) => text.slice(offset, offset + 4), - }).forEach(([method, _parse]) => - it(`returns the text of a node generated by ${method}`, async () => { + }).forEach(([method, _parse]) => { + it(`returns the text of a node generated by ${method}`, () => { const [numeratorSrc, denominatorSrc] = text.split(/\s*\/\s+/); tree = parser.parse(_parse); - const quotientNode = tree.rootNode!.firstChild!.firstChild!; + const quotientNode = tree.rootNode.firstChild!.firstChild!; const [numerator, slash, denominator] = quotientNode.children; expect(tree.rootNode.text).toBe(text); expect(denominator.text).toBe(denominatorSrc); - expect(quotientNode!.text).toBe(text); + expect(quotientNode.text).toBe(text); expect(numerator.text).toBe(numeratorSrc); expect(slash.text).toBe('/'); - }), - ); + }); + }); }); describe('.descendantCount', () => { @@ -475,7 +479,7 @@ describe('Node', () => { tree = parser.parse('a + 1 * b * 2 + c + 3'); const outerSum = tree.rootNode.firstChild!.firstChild; - let descendants = outerSum!.descendantsOfType('number', { row: 0, column: 2 }, { row: 0, column: 15 }); + const descendants = outerSum!.descendantsOfType('number', { row: 0, column: 2 }, { row: 0, column: 15 }); expect(descendants.map(node => node.startIndex)).toEqual([4, 12]); expect(descendants.map(node => node.endPosition)).toEqual([ { row: 0, column: 5 }, diff --git a/lib/binding_web/test/parser.test.ts b/lib/binding_web/test/parser.test.ts index d7adc31a..13f69416 100644 --- a/lib/binding_web/test/parser.test.ts +++ b/lib/binding_web/test/parser.test.ts @@ -1,15 +1,15 @@ import { describe, it, expect, beforeAll, beforeEach, afterEach } from 'vitest'; -import helper from './helper'; -import TSParser, { type Language } from 'web-tree-sitter'; +import helper, { type LanguageName } from './helper'; +import type { default as ParserType, Language } from 'web-tree-sitter'; -let Parser: typeof TSParser; +let Parser: typeof ParserType; let JavaScript: Language; let HTML: Language; let JSON: Language; -let languageURL: (name: string) => string; +let languageURL: (name: LanguageName) => string; describe('Parser', () => { - let parser: TSParser; + let parser: ParserType; beforeAll(async () => { ({ Parser, JavaScript, HTML, JSON, languageURL } = await helper); @@ -33,8 +33,10 @@ describe('Parser', () => { }); it('throws an exception when the given object is not a tree-sitter language', () => { - expect(() => parser.setLanguage({} as any)).toThrow(/Argument must be a Language/); - expect(() => parser.setLanguage(1 as any)).toThrow(/Argument must be a Language/); + // @ts-expect-error Testing invalid arguments + expect(() => { parser.setLanguage({}); }).toThrow(/Argument must be a Language/); + // @ts-expect-error Testing invalid arguments + expect(() => { parser.setLanguage(1); }).toThrow(/Argument must be a Language/); }); }); @@ -56,7 +58,7 @@ describe('Parser', () => { }); it('allows the callback to be retrieved later', () => { - const callback = () => { }; + const callback = () => { return; }; parser.setLogger(callback); expect(parser.getLogger()).toBe(callback); parser.setLogger(false); @@ -72,12 +74,13 @@ describe('Parser', () => { }); it('throws an error when given a truthy value that isn\'t a function', () => { - expect(() => parser.setLogger('5' as any)).toThrow('Logger callback must be a function'); + // @ts-expect-error Testing invalid arguments + expect(() => { parser.setLogger('5'); }).toThrow('Logger callback must be a function'); }); it('rethrows errors thrown by the logging callback', () => { const error = new Error('The error message'); - parser.setLogger((_msg) => { + parser.setLogger(() => { throw error; }); expect(() => parser.parse('ok;')).toThrow('The error message'); @@ -219,7 +222,7 @@ describe('Parser', () => { }); describe('.parse', () => { - let tree: TSParser.Tree | null; + let tree: ParserType.Tree | null; beforeEach(() => { tree = null; @@ -245,9 +248,12 @@ describe('Parser', () => { }); it('throws an exception when the given input is not a function', () => { - expect(() => parser.parse(null as any)).toThrow('Argument must be a string or a function'); - expect(() => parser.parse(5 as any)).toThrow('Argument must be a string or a function'); - expect(() => parser.parse({} as any)).toThrow('Argument must be a string or a function'); + // @ts-expect-error Testing invalid arguments + expect(() => parser.parse(null)).toThrow('Argument must be a string or a function'); + // @ts-expect-error Testing invalid arguments + expect(() => parser.parse(5)).toThrow('Argument must be a string or a function'); + // @ts-expect-error Testing invalid arguments + expect(() => parser.parse({})).toThrow('Argument must be a string or a function'); }); it('handles long input strings', { timeout: 5000 }, () => { @@ -259,7 +265,7 @@ describe('Parser', () => { expect(tree.rootNode.firstChild!.firstChild!.namedChildCount).toBe(repeatCount); }); - it('can use the bash parser', async () => { + it('can use the bash parser', { timeout: 5000 }, async () => { parser.setLanguage(await Parser.Language.load(languageURL('bash'))); tree = parser.parse('FOO=bar echo < err.txt > hello.txt \nhello${FOO}\nEOF'); expect(tree.rootNode.toString()).toBe( @@ -274,7 +280,7 @@ describe('Parser', () => { '(heredoc_body ' + '(expansion (variable_name)) (heredoc_content)) (heredoc_end))))' ); - }, { timeout: 5000 }); + }); it('can use the c++ parser', { timeout: 5000 }, async () => { parser.setLanguage(await Parser.Language.load(languageURL('cpp'))); @@ -391,7 +397,7 @@ describe('Parser', () => { const startTime = performance.now(); let currentByteOffset = 0; - const progressCallback = (state: TSParser.State) => { + const progressCallback = (state: ParserType.State) => { expect(state.currentOffset).toBeGreaterThanOrEqual(currentByteOffset); currentByteOffset = state.currentOffset; @@ -402,7 +408,7 @@ describe('Parser', () => { }; expect(() => parser.parse( - (offset, _) => offset === 0 ? '[' : ',0', + (offset) => offset === 0 ? '[' : ',0', null, { progressCallback }, ) diff --git a/lib/binding_web/test/query.test.ts b/lib/binding_web/test/query.test.ts index 50195ff5..5cda3ad9 100644 --- a/lib/binding_web/test/query.test.ts +++ b/lib/binding_web/test/query.test.ts @@ -1,12 +1,12 @@ import { describe, it, expect, beforeAll, beforeEach, afterEach } from 'vitest'; -import TSParser, { type Language, type Tree, type Query, type QueryCapture, type QueryMatch } from 'web-tree-sitter'; +import type { default as ParserType, Language, Tree, Query, QueryCapture, QueryMatch } from 'web-tree-sitter'; import helper from './helper'; -let Parser: typeof TSParser; +let Parser: typeof ParserType; let JavaScript: Language; describe('Query', () => { - let parser: TSParser; + let parser: ParserType; let tree: Tree | null; let query: Query | null; @@ -552,7 +552,7 @@ describe('Query', () => { const matches = query.matches( tree.rootNode, { - progressCallback: (_) => { + progressCallback: () => { if (performance.now() - startTime > 1) { return true; } @@ -569,16 +569,17 @@ describe('Query', () => { }); // Helper functions -function formatMatches(matches: any[]): QueryMatch[] { +function formatMatches(matches: QueryMatch[]): QueryMatch[] { return matches.map(({ pattern, captures }) => ({ pattern, captures: formatCaptures(captures), })); } -function formatCaptures(captures: any[]): QueryCapture[] { +function formatCaptures(captures: QueryCapture[]): QueryCapture[] { return captures.map((c) => { const node = c.node; + // @ts-expect-error We're not interested in the node object for these tests delete c.node; c.text = node.text; return c; diff --git a/lib/binding_web/test/tree.test.ts b/lib/binding_web/test/tree.test.ts index 2f3568c8..0718e2b7 100644 --- a/lib/binding_web/test/tree.test.ts +++ b/lib/binding_web/test/tree.test.ts @@ -1,8 +1,8 @@ import { describe, it, expect, beforeAll, beforeEach, afterEach } from 'vitest'; -import TSParser, { type Language, type Tree, type TreeCursor, type Edit, Point } from 'web-tree-sitter'; +import type { default as ParserType, Language, Tree, TreeCursor, Edit, Point } from 'web-tree-sitter'; import helper from './helper'; -let Parser: typeof TSParser; +let Parser: typeof ParserType; let JavaScript: Language; interface CursorState { @@ -15,7 +15,7 @@ interface CursorState { } describe('Tree', () => { - let parser: TSParser; + let parser: ParserType; let tree: Tree; beforeAll(async () => { diff --git a/lib/binding_web/tree-sitter-web.d.ts b/lib/binding_web/tree-sitter-web.d.ts index 74db2ba3..8e82794a 100644 --- a/lib/binding_web/tree-sitter-web.d.ts +++ b/lib/binding_web/tree-sitter-web.d.ts @@ -22,45 +22,43 @@ declare module "web-tree-sitter" { } namespace Parser { - export type Options = { + export interface Options { includedRanges?: Range[]; progressCallback?: (state: Parser.State) => boolean; - }; + } - export type State = { + export interface State { currentOffset: number; - }; + } - export type Point = { + export interface Point { row: number; column: number; - }; + } - export type Range = { + export interface Range { startIndex: number; endIndex: number; startPosition: Point; endPosition: Point; - }; + } - export type Edit = { + export interface Edit { startIndex: number; oldEndIndex: number; newEndIndex: number; startPosition: Point; oldEndPosition: Point; newEndPosition: Point; - }; + } export type Logger = ( message: string, - params: { [param: string]: string }, + params: Record, type: "parse" | "lex", ) => void; - export interface Input { - (index: number, position?: Point): string | null | undefined; - } + export type Input = (index: number, position?: Point) => string | null | undefined; export interface SyntaxNode { tree: Tree; @@ -83,8 +81,8 @@ declare module "web-tree-sitter" { startIndex: number; endIndex: number; parent: SyntaxNode | null; - children: Array; - namedChildren: Array; + children: SyntaxNode[]; + namedChildren: SyntaxNode[]; childCount: number; namedChildCount: number; firstChild: SyntaxNode | null; @@ -105,30 +103,20 @@ declare module "web-tree-sitter" { childForFieldId(fieldId: number): SyntaxNode | null; fieldNameForChild(childIndex: number): string | null; fieldNameForNamedChild(childIndex: number): string | null; - childrenForFieldName(fieldName: string): Array; - childrenForFieldId(fieldId: number): Array; + childrenForFieldName(fieldName: string): SyntaxNode[]; + childrenForFieldId(fieldId: number): SyntaxNode[]; firstChildForIndex(index: number): SyntaxNode | null; firstNamedChildForIndex(index: number): SyntaxNode | null; - descendantForIndex(index: number): SyntaxNode; - descendantForIndex(startIndex: number, endIndex: number): SyntaxNode; - namedDescendantForIndex(index: number): SyntaxNode; - namedDescendantForIndex(startIndex: number, endIndex: number): SyntaxNode; - descendantForPosition(position: Point): SyntaxNode; - descendantForPosition( - startPosition: Point, - endPosition: Point, - ): SyntaxNode; - namedDescendantForPosition(position: Point): SyntaxNode; - namedDescendantForPosition( - startPosition: Point, - endPosition: Point, - ): SyntaxNode; + descendantForIndex(...args: [index: number] | [startIndex: number, endIndex: number]): SyntaxNode; + namedDescendantForIndex(...args: [index: number] | [startIndex: number, endIndex: number]): SyntaxNode; + descendantForPosition(...args: [position: Point] | [startPosition: Point, endPosition: Point]): SyntaxNode; + namedDescendantForPosition(...args: [position: Point] | [startPosition: Point, endPosition: Point]): SyntaxNode; descendantsOfType( - types: String | Array, + types: string | string[], startPosition?: Point, endPosition?: Point, - ): Array; + ): SyntaxNode[]; walk(): TreeCursor; } @@ -178,13 +166,15 @@ declare module "web-tree-sitter" { getLanguage(): Language; } + export type Properties = Record; + export interface QueryCapture { name: string; text?: string; node: SyntaxNode; - setProperties?: { [prop: string]: string | null }; - assertedProperties?: { [prop: string]: string | null }; - refutedProperties?: { [prop: string]: string | null }; + setProperties?: Properties; + assertedProperties?: Properties; + refutedProperties?: Properties; } export interface QueryMatch { @@ -192,11 +182,11 @@ declare module "web-tree-sitter" { captures: QueryCapture[]; } - export type QueryState = { + export interface QueryState { currentOffset: number; - }; + } - export type QueryOptions = { + export interface QueryOptions { startPosition?: Point; endPosition?: Point; startIndex?: number; @@ -205,7 +195,7 @@ declare module "web-tree-sitter" { maxStartDepth?: number; timeoutMicros?: number; progressCallback?: (state: QueryState) => boolean; - }; + } export interface Predicate { operator: string; @@ -222,21 +212,23 @@ declare module "web-tree-sitter" { operands: { name: string; type: string }[]; } - export enum CaptureQuantifier { - Zero = 0, - ZeroOrOne = 1, - ZeroOrMore = 2, - One = 3, - OneOrMore = 4, - } + export const CaptureQuantifier = { + Zero: 0, + ZeroOrOne: 1, + ZeroOrMore: 2, + One: 3, + OneOrMore: 4 + } as const; + + export type CaptureQuantifier = typeof CaptureQuantifier[keyof typeof CaptureQuantifier]; export class Query { readonly captureNames: string[]; - readonly captureQuantifiers: CaptureQuantifier[]; - readonly predicates: { [name: string]: Function }[]; - readonly setProperties: any[]; - readonly assertedProperties: any[]; - readonly refutedProperties: any[]; + readonly captureQuantifiers: CaptureQuantifier[][]; + readonly predicates: Predicate[][]; + readonly setProperties: Properties[]; + readonly assertedProperties: Properties[]; + readonly refutedProperties: Properties[]; readonly matchLimit?: number; delete(): void; diff --git a/lib/binding_web/tsconfig.json b/lib/binding_web/tsconfig.json index 5d74457b..b7b45b69 100644 --- a/lib/binding_web/tsconfig.json +++ b/lib/binding_web/tsconfig.json @@ -28,7 +28,8 @@ }, "include": [ "src/**/*", - "test/**/*" + "script/**/*", + "test/**/*", ], "exclude": [ "node_modules", diff --git a/lib/binding_web/wasm/imports.js b/lib/binding_web/wasm/imports.js index d40fbfd4..89ed6d93 100644 --- a/lib/binding_web/wasm/imports.js +++ b/lib/binding_web/wasm/imports.js @@ -7,7 +7,7 @@ mergeInto(LibraryManager.library, { lengthAddress, ) { const INPUT_BUFFER_SIZE = 10 * 1024; - const string = currentParseCallback(index, {row, column}); + const string = currentParseCallback(index, { row, column }); if (typeof string === 'string') { setValue(lengthAddress, string.length, 'i32'); stringToUTF16(string, inputBufferAddress, INPUT_BUFFER_SIZE); @@ -25,14 +25,14 @@ mergeInto(LibraryManager.library, { tree_sitter_progress_callback(currentOffset) { if (currentProgressCallback) { - return currentProgressCallback({currentOffset}); + return currentProgressCallback({ currentOffset }); } return false; }, tree_sitter_query_progress_callback(currentOffset) { if (currentQueryProgressCallback) { - return currentQueryProgressCallback({currentOffset}); + return currentQueryProgressCallback({ currentOffset }); } return false; }, diff --git a/xtask/src/build_wasm.rs b/xtask/src/build_wasm.rs index 37c18e9f..ddf7477e 100644 --- a/xtask/src/build_wasm.rs +++ b/xtask/src/build_wasm.rs @@ -155,33 +155,38 @@ pub fn run_wasm(args: &BuildWasm) -> Result<()> { let command = command.args(&emscripten_flags); if args.watch { - watch_wasm!(|| build_wasm(command)); + watch_wasm!(|| build_wasm(command, args.debug)); } else { - build_wasm(command)?; + build_wasm(command, args.debug)?; } Ok(()) } -fn build_wasm(cmd: &mut Command) -> Result<()> { +fn build_wasm(cmd: &mut Command, debug: bool) -> Result<()> { bail_on_err( &cmd.spawn()?.wait_with_output()?, "Failed to compile the Tree-sitter WASM library", )?; - fs::rename( - "target/scratch/tree-sitter.js", - "lib/binding_web/tree-sitter.js", - )?; + let dir = if debug { + PathBuf::from("lib/binding_web/debug") + } else { + PathBuf::from("lib/binding_web") + }; + + fs::create_dir_all(&dir)?; + + fs::rename("target/scratch/tree-sitter.js", dir.join("tree-sitter.js"))?; fs::rename( "target/scratch/tree-sitter.wasm", - "lib/binding_web/tree-sitter.wasm", + dir.join("tree-sitter.wasm"), )?; fs::rename( "target/scratch/tree-sitter.wasm.map", - "lib/binding_web/tree-sitter.wasm.map", + dir.join("tree-sitter.wasm.map"), )?; Ok(())