@willbooster/tree-sitter-c 1.1.4 → 1.1.6

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 CHANGED
@@ -5,7 +5,7 @@
5
5
  [![Test](https://github.com/WillBooster/tree-sitter-c/actions/workflows/test.yml/badge.svg)](https://github.com/WillBooster/tree-sitter-c/actions/workflows/test.yml)
6
6
  [![Test rust](https://github.com/WillBooster/tree-sitter-c/actions/workflows/test-rust.yml/badge.svg)](https://github.com/WillBooster/tree-sitter-c/actions/workflows/test-rust.yml)
7
7
  [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
8
- [![wbfy](https://img.shields.io/badge/wbfy-20.26.0-1e90ff.svg)](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
8
+ [![wbfy](https://img.shields.io/badge/wbfy-20.28.8-1e90ff.svg)](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
9
9
  [![crates.io](https://img.shields.io/crates/v/willbooster-tree-sitter-c.svg)](https://crates.io/crates/willbooster-tree-sitter-c)
10
10
 
11
11
  C grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter), forked from
@@ -88,23 +88,36 @@ script/parse-examples
88
88
  cargo test
89
89
  ```
90
90
 
91
+ The scripts and tests generate, build, test, and parse with `script/tree-sitter`, the tree-sitter CLI of the
92
+ WillBooster/tree-sitter runtime version locked in `Cargo.lock`, since the generator and the runtime of upstream's CLI are
93
+ not the ones this package ships with. Its first run downloads that CLI from the runtime's GitHub Release, or builds it
94
+ with `cargo` (whose build runs the CMake that `mise.toml` pins) when the download fails or the release has no binary that runs here. Run other CLI commands through it as
95
+ well (e.g. `script/tree-sitter parse file.c`).
96
+
91
97
  `bun run test` runs:
92
98
 
93
99
  - the corpus in `test/corpus`, with the native build and with the Wasm build (the first run downloads the WASI SDK);
94
- - an incremental-parsing check (`test/unit/incremental.test.ts`): `tree-sitter fuzz` edits each corpus case at random,
95
- reparses it, undoes the edits, and reparses again. `TREE_SITTER_SEED`, `TREE_SITTER_ITERATIONS`, and
96
- `TREE_SITTER_EDITS` run other or more edits;
100
+ - an incremental-parsing check (`test/unit/incremental.test.ts`): `script/fuzz-corpus` runs `tree-sitter fuzz`, which
101
+ edits each corpus case at random, reparses it, undoes the edits, and reparses again. `TREE_SITTER_SEED`,
102
+ `TREE_SITTER_ITERATIONS`, and `TREE_SITTER_EDITS` run other or more edits;
97
103
  - a check that the real-world C files in `examples/`, the checked-in ones and those of the cloned repositories, fail to
98
104
  parse exactly as listed in `script/known-failures.txt`. Many of the listed files use preprocessor conditionals or
99
105
  macros that tree-sitter parses without expanding them. The first run clones the repositories. The example
100
106
  repositories are pinned to commits in `script/parse-examples`. After a grammar change or a moved pin alters that
101
107
  list, `script/parse-examples` rewrites it; review its diff before committing;
102
- - a performance check (`test/unit/performance.test.ts`) that recovering from an error on each of 10,000 lines takes
103
- linear time, since consumers parse files while they are being edited. It loads the Wasm build through
108
+ - a performance check (`test/unit/performance.test.ts`) that recovering from an error on each line takes linear
109
+ time, since consumers parse files while they are being edited. It loads the Wasm build through
104
110
  @willbooster/web-tree-sitter, which `bun run build/ci` rebuilds after regenerating the parser;
111
+ - a check (`test/unit/runtimeVersion.test.ts`) that `@willbooster/web-tree-sitter` in `package.json` and
112
+ `willbooster-tree-sitter` in `Cargo.lock` are the same version, since the Wasm tests run on the former and the Rust
113
+ tests, the fuzzer, and the CLI on the latter;
105
114
  - tests that load the Wasm build with @willbooster/web-tree-sitter in Chromium (`test/e2e/browser.test.ts`) and in
106
115
  Cloudflare Workers with and without Node.js compatibility (`test/e2e/workers.test.ts`).
107
116
 
117
+ The tests and `script/parse-examples` compile the parser into `.tmp/tree-sitter-lib` rather than the CLI's cache shared
118
+ by every checkout; `script/fuzz-corpus` builds a parser of its own in `.tmp/fuzz` for each run and deletes it
119
+ afterwards.
120
+
108
121
  CI also runs these tests on Linux arm64 and macOS, where the Rust binding compiles the parser natively, and fuzzes the
109
122
  parser with libFuzzer and sanitizers (`.github/workflows/robustness.yml`).
110
123
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-c",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "C grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -22,8 +22,8 @@
22
22
  "*.wasm"
23
23
  ],
24
24
  "scripts": {
25
- "build-wasm": "tree-sitter build --wasm",
26
- "build/ci": "tree-sitter generate && tree-sitter build --wasm",
25
+ "build-wasm": "script/tree-sitter build --wasm",
26
+ "build/ci": "script/tree-sitter generate && script/tree-sitter build --wasm",
27
27
  "cleanup": "bun wb lint --fix --format",
28
28
  "format": "bun wb lint --format",
29
29
  "lint": "bun wb lint",
@@ -31,7 +31,7 @@
31
31
  "prepare": "(bun lefthook install || true) && (test ! -f .lefthook/normalize-bun-lockfile.sh || bash .lefthook/normalize-bun-lockfile.sh)",
32
32
  "release": "wb release",
33
33
  "prestart": "bun run build-wasm",
34
- "start": "tree-sitter playground",
34
+ "start": "script/tree-sitter playground",
35
35
  "test": "bun wb test",
36
36
  "test/ci": "bun wb test-on-ci",
37
37
  "test/ci-setup": "playwright install --with-deps chromium",
@@ -45,13 +45,13 @@
45
45
  "@vitest/browser-playwright": "5.0.1",
46
46
  "@willbooster/oxfmt-config": "1.2.2",
47
47
  "@willbooster/oxlint-config": "1.4.8",
48
- "@willbooster/wb": "22.13.0",
49
- "@willbooster/web-tree-sitter": "1.0.7",
48
+ "@willbooster/wb": "22.13.2",
49
+ "@willbooster/web-tree-sitter": "1.0.17",
50
50
  "conventional-changelog-conventionalcommits": "10.4.0",
51
51
  "lefthook": "2.1.14",
52
52
  "oxfmt": "0.70.0",
53
53
  "oxlint": "1.85.0",
54
- "oxlint-tsgolint": "7.0.2002",
54
+ "oxlint-tsgolint": "7.0.2003",
55
55
  "playwright": "1.63.0",
56
56
  "semantic-release": "25.0.9",
57
57
  "sort-package-json": "4.0.0",
Binary file
package/tree-sitter.json CHANGED
@@ -16,7 +16,7 @@
16
16
  }
17
17
  ],
18
18
  "metadata": {
19
- "version": "1.1.4",
19
+ "version": "1.1.6",
20
20
  "license": "MIT",
21
21
  "description": "C grammar for tree-sitter",
22
22
  "authors": [