@willbooster/tree-sitter-typescript 1.2.7 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -8
- package/package.json +7 -7
- package/tree-sitter-tsx.wasm +0 -0
- package/tree-sitter-typescript.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://github.com/WillBooster/tree-sitter-typescript/actions/workflows/test.yml)
|
|
6
6
|
[](https://github.com/WillBooster/tree-sitter-typescript/actions/workflows/test-rust.yml)
|
|
7
7
|
[](https://github.com/semantic-release/semantic-release)
|
|
8
|
-
[](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
|
|
9
9
|
[](https://crates.io/crates/willbooster-tree-sitter-typescript)
|
|
10
10
|
|
|
11
11
|
TypeScript and TSX grammars for [tree-sitter](https://github.com/tree-sitter/tree-sitter), forked from
|
|
@@ -102,31 +102,43 @@ script/parse-examples
|
|
|
102
102
|
cargo test
|
|
103
103
|
```
|
|
104
104
|
|
|
105
|
+
`script/tree-sitter` (also `bun run tree-sitter`) runs the tree-sitter CLI of WillBooster/tree-sitter at the runtime
|
|
106
|
+
version locked in `Cargo.lock`, so the parsers are generated, built, tested, and fuzzed with the generator and the
|
|
107
|
+
runtime this package ships. The first run downloads that CLI from its GitHub Release into `.tmp/`, or builds it with
|
|
108
|
+
`cargo` (which needs `cmake`) when the download fails or the release has no binary that runs here.
|
|
109
|
+
|
|
105
110
|
`bun run test/ci-setup` installs Chromium for the browser tests. `bun run build/ci` regenerates `typescript/src/` and
|
|
106
111
|
`tsx/src/` and builds both Wasm files. `bun run test` runs:
|
|
107
112
|
|
|
108
113
|
- the corpus in `test/corpus`, with the native build and with the Wasm build (the first run downloads the WASI SDK).
|
|
109
114
|
Cases run with the `typescript` grammar unless they carry `:language(tsx)`;
|
|
110
115
|
- an incremental-parsing check (`test/unit/incremental.test.ts`): `script/fuzz-corpus` runs `tree-sitter fuzz`, which
|
|
111
|
-
edits each corpus case of each grammar at random, reparses it, undoes the edits, and reparses again
|
|
112
|
-
WillBooster/tree-sitter runtime version locked in `Cargo.lock` (the first run downloads that CLI from its GitHub
|
|
113
|
-
Release, or builds it with `cargo` when the download fails or the release has no binary that runs here).
|
|
116
|
+
edits each corpus case of each grammar at random, reparses it, undoes the edits, and reparses again.
|
|
114
117
|
`TREE_SITTER_SEED`, `TREE_SITTER_ITERATIONS`, and `TREE_SITTER_EDITS` run other or more edits;
|
|
115
118
|
- a check that the real-world files in `examples/`, the checked-in ones and those of the cloned repositories, fail to
|
|
116
119
|
parse exactly as listed in `script/known-failures.txt`. `.ts` files are parsed with the `typescript` grammar and
|
|
117
120
|
`.tsx` files with the `tsx` grammar. The first run clones the repositories. The example repositories are pinned to
|
|
118
121
|
commits in `script/parse-examples`. After a grammar change or a moved pin alters that list, `script/parse-examples`
|
|
119
122
|
rewrites it; review its diff before committing;
|
|
120
|
-
- a performance check (`test/unit/performance.test.ts`) that recovering from an error on each of
|
|
121
|
-
linear time with each grammar, since consumers parse files while they are
|
|
122
|
-
through @willbooster/web-tree-sitter, which `bun run build/ci` rebuilds after
|
|
123
|
+
- a performance check (`test/unit/performance.test.ts`) that recovering from an error on each of 20,000 lines takes
|
|
124
|
+
linear time with each grammar, measured in the parsing thread's CPU time, since consumers parse files while they are
|
|
125
|
+
being edited. It loads the Wasm builds through @willbooster/web-tree-sitter, which `bun run build/ci` rebuilds after
|
|
126
|
+
regenerating the parsers;
|
|
123
127
|
- a check (`test/unit/queries.test.ts`) that the queries `tree-sitter.json` lists compile against each grammar, are
|
|
124
128
|
published in the npm package and the crate, and that `javascript/queries/` matches the queries of the installed
|
|
125
129
|
@willbooster/tree-sitter-javascript; after updating that dependency, `script/copy-javascript-queries` refreshes the
|
|
126
130
|
copies;
|
|
127
131
|
- checks that both Wasm builds load and parse through @willbooster/web-tree-sitter in Chromium
|
|
128
132
|
(`test/unit/browser/`) and in Cloudflare Workers with and without Node.js compatibility
|
|
129
|
-
(`test/unit/workers.test.ts`, running the Worker in `test/fixtures/worker/`)
|
|
133
|
+
(`test/unit/workers.test.ts`, running the Worker in `test/fixtures/worker/`);
|
|
134
|
+
- a check (`test/unit/runtimeVersion.test.ts`) that `package.json` and `Cargo.lock` lock the same runtime version,
|
|
135
|
+
since the Wasm tests run on @willbooster/web-tree-sitter and the Rust tests, the fuzzing, and the CLI on the
|
|
136
|
+
willbooster-tree-sitter crate.
|
|
137
|
+
|
|
138
|
+
The tests compile the parsers into `.tmp/tree-sitter-lib` instead of the CLI's cache shared by every checkout;
|
|
139
|
+
`script/parse-examples` and `script/fuzz-corpus` build a parser of their own per run and delete it afterwards.
|
|
140
|
+
`mise.toml` sets `TREE_SITTER_LIBDIR` to `.tmp/tree-sitter-lib` as well, so other `tree-sitter` commands run in the
|
|
141
|
+
checkout use this checkout's parsers too.
|
|
130
142
|
|
|
131
143
|
CI also runs these tests on Linux arm64 and macOS, where the Rust binding compiles the parsers natively, and fuzzes
|
|
132
144
|
both parsers with libFuzzer and sanitizers (`.github/workflows/robustness.yml`).
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-typescript",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.8",
|
|
4
4
|
"description": "TypeScript and TSX grammars for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"incremental",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"*.wasm"
|
|
28
28
|
],
|
|
29
29
|
"scripts": {
|
|
30
|
-
"build-wasm": "tree-sitter build --wasm typescript && tree-sitter build --wasm tsx",
|
|
31
|
-
"build/ci": "tree-sitter generate typescript/grammar.js && tree-sitter generate tsx/grammar.js && bun run build-wasm",
|
|
30
|
+
"build-wasm": "script/tree-sitter build --wasm typescript && script/tree-sitter build --wasm tsx",
|
|
31
|
+
"build/ci": "script/tree-sitter generate typescript/grammar.js && script/tree-sitter generate tsx/grammar.js && bun run build-wasm",
|
|
32
32
|
"cleanup": "bun wb lint --fix --format",
|
|
33
33
|
"format": "bun wb lint --format",
|
|
34
34
|
"lint": "bun wb lint",
|
|
@@ -36,10 +36,11 @@
|
|
|
36
36
|
"prepare": "(bun lefthook install || true) && (test ! -f .lefthook/normalize-bun-lockfile.sh || bash .lefthook/normalize-bun-lockfile.sh)",
|
|
37
37
|
"release": "wb release",
|
|
38
38
|
"prestart": "bun run build-wasm",
|
|
39
|
-
"start": "tree-sitter playground",
|
|
39
|
+
"start": "script/tree-sitter playground",
|
|
40
40
|
"test": "bun wb test",
|
|
41
41
|
"test/ci": "bun wb test-on-ci",
|
|
42
42
|
"test/ci-setup": "playwright install --with-deps chromium",
|
|
43
|
+
"tree-sitter": "script/tree-sitter",
|
|
43
44
|
"typecheck": "bun wb typecheck",
|
|
44
45
|
"verify": "bun wb verify",
|
|
45
46
|
"verify-full": "bun wb verify --full"
|
|
@@ -51,8 +52,8 @@
|
|
|
51
52
|
"@willbooster/oxfmt-config": "1.2.2",
|
|
52
53
|
"@willbooster/oxlint-config": "1.4.8",
|
|
53
54
|
"@willbooster/tree-sitter-javascript": "1.0.16",
|
|
54
|
-
"@willbooster/wb": "22.13.
|
|
55
|
-
"@willbooster/web-tree-sitter": "1.0.
|
|
55
|
+
"@willbooster/wb": "22.13.1",
|
|
56
|
+
"@willbooster/web-tree-sitter": "1.0.15",
|
|
56
57
|
"conventional-changelog-conventionalcommits": "10.4.0",
|
|
57
58
|
"lefthook": "2.1.14",
|
|
58
59
|
"oxfmt": "0.70.0",
|
|
@@ -61,7 +62,6 @@
|
|
|
61
62
|
"playwright": "1.63.0",
|
|
62
63
|
"semantic-release": "25.0.9",
|
|
63
64
|
"sort-package-json": "4.0.0",
|
|
64
|
-
"tree-sitter-cli": "0.27.0",
|
|
65
65
|
"typescript": "7.0.2",
|
|
66
66
|
"vite": "8.3.0",
|
|
67
67
|
"vitest": "5.0.1",
|
package/tree-sitter-tsx.wasm
CHANGED
|
Binary file
|
|
Binary file
|