@willbooster/tree-sitter-ruby 15.0.1 → 17.0.0

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
@@ -14,8 +14,8 @@ to its authors and contributors. This is not an official release of that project
14
14
 
15
15
  This fork extends the upstream grammar to parse anonymous block forwarding, spaced block arguments, and command calls in endless methods, with a parser generated by
16
16
  [WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter), whose compact parse tables make the
17
- parser smaller. The parser carries that fork's own ABI number (`0x5742000c`), so it loads only with the WillBooster
18
- runtime 17.x; upstream's tree-sitter runtime and other major versions of the fork's runtime reject it.
17
+ parser smaller. The parser carries that fork's own ABI number (`0x5742000c`); upstream's tree-sitter runtime and
18
+ incompatible ABI versions of the fork's runtime reject it.
19
19
  The scanner preserves long heredoc identifiers
20
20
  when their state fits the runtime's serialization buffer. If the open heredocs cannot fit, their bodies are parsed as
21
21
  code instead of aborting the process.
@@ -23,15 +23,15 @@ code instead of aborting the process.
23
23
  ## Support Scope
24
24
 
25
25
  This fork maintains only full parsing: valid input yields a correct tree, and invalid input yields `ERROR` or `MISSING`
26
- nodes without crashing, hanging, or taking more than linear time. Parse each input without a previous tree; reusing
27
- an old tree is unsupported. No queries (highlights, locals, injections, tags) are shipped. Node types, field names, and
28
- the trees that error recovery produces may change; such changes are released as new major versions.
26
+ nodes without crashing, hanging, or taking more than linear time. Incremental parsing and queries (highlights, locals,
27
+ injections, tags) are not supported. Node types, field names, and the trees that error recovery produces may change;
28
+ such changes are released as new major versions.
29
29
 
30
30
  ## Usage
31
31
 
32
32
  The npm package ships `tree-sitter-ruby.wasm` for
33
- [@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter), which runs in Node.js, Bun,
34
- browsers, and Cloudflare Workers. The parser requires runtime 17.x.
33
+ [@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) 20.x, which runs in Node.js,
34
+ Bun, browsers, and Cloudflare Workers.
35
35
 
36
36
  In Node.js and Bun, load the grammar from its path:
37
37
 
@@ -74,11 +74,11 @@ parser.setLanguage(await Language.load(ruby));
74
74
  The package also ships the node types in `src/node-types.json`.
75
75
 
76
76
  In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-ruby) and on
77
- [willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter), the runtime this package is tested and
78
- fuzzed with. The parser requires runtime 17.x:
77
+ [willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter) 20.x, the runtime this package is tested and
78
+ fuzzed with:
79
79
 
80
80
  ```sh
81
- cargo add willbooster-tree-sitter@17.0.1 --rename tree-sitter
81
+ cargo add willbooster-tree-sitter@20.0.0 --rename tree-sitter
82
82
  cargo add willbooster-tree-sitter-ruby --rename tree-sitter-ruby
83
83
  ```
84
84
 
@@ -92,44 +92,17 @@ parser.set_language(&tree_sitter_ruby::LANGUAGE.into())?;
92
92
  ```sh
93
93
  mise install
94
94
  bun install --frozen-lockfile
95
+ bun run test/ci-setup
95
96
  bun run build/ci
97
+ bun run verify
96
98
  bun run test
97
- script/parse-examples
98
99
  cargo test
99
100
  ```
100
101
 
101
- The scripts and tests generate, build, test, and parse with `script/tree-sitter`, the tree-sitter CLI of the
102
- WillBooster/tree-sitter runtime version locked in `Cargo.lock`, since the generator and the runtime of upstream's CLI are
103
- not the ones this package ships with. Its first run downloads that CLI from the runtime's GitHub Release, or builds it
104
- with `cargo` (whose build runs the CMake that `mise.toml` pins) when the download fails or the release has no binary
105
- that runs here. Run other CLI commands through it as well (e.g. `script/tree-sitter parse file.rb`).
106
-
107
- `bun run generate` records a fresh generation profile from the applicable `test/corpus` cases and Git-tracked
108
- files in `examples/`, then generates compact parser tables. The parser also embeds metadata from `tree-sitter.json`.
109
- After changing the grammar, `tree-sitter.json`, a corpus case, or a tracked example, regenerate and commit `src/`. Stage
110
- added or removed examples with `git add -A examples` before generation so the profile uses the intended file list.
111
- Profiles in `.tmp/generation-profiles/` are temporary and must not be committed. `bun run build-wasm`,
112
- `bun run build/ci`, and the release build regenerate the parser before compiling it.
113
-
114
- `bun run test` runs:
115
-
116
- - the corpus in `test/corpus`, with the native build and with the Wasm build (the first run downloads the WASI SDK);
117
- - included-range comment checks (`test/unit/includedRanges.test.ts`), which load the Wasm build produced by
118
- `bun run build/ci`;
119
- - a check that the real-world Ruby files of [ruby/spec](https://github.com/ruby/spec) cloned into `examples/` fail to
120
- parse exactly as listed in `script/known-failures.txt`. The first run clones the repository, which is pinned to a
121
- commit in `script/parse-examples`. After a grammar change or a moved pin alters that list, `script/parse-examples`
122
- rewrites it; review its diff before committing;
123
- - bounded CPU-growth checks for error recovery and comment chains (`test/unit/performance.test.ts`);
124
- - a check that `package.json` and `Cargo.lock` test the same runtime version (`test/unit/runtimeVersion.test.ts`);
125
- - checks that the Wasm build parses in Chromium (`test/unit/browser/`) and in Cloudflare Workers with and without
126
- Node.js compatibility (`test/unit/workerd.test.ts`). Run `bun run test/ci-setup` once to install Chromium.
127
-
128
- The tests and `script/parse-examples` compile the parser into `.tmp/tree-sitter-lib` rather than the CLI's cache shared
129
- by every checkout.
130
-
131
- CI also runs these tests on Linux arm64 and macOS, where the Rust binding compiles the parser natively, and fuzzes the
132
- parser with libFuzzer and sanitizers (`.github/workflows/robustness.yml`).
102
+ - `bun run test/ci-setup`: run once to install Chromium before `bun run test`.
103
+ - `bun run build/ci`: run before `bun run test`, and commit `src/` after changing `grammar.js`, `tree-sitter.json`, `test/corpus/`, or tracked files in `examples/`. Stage added or removed `examples/` files with `git add -A examples` before generating so the profile sees them.
104
+ - `script/parse-examples`: run without arguments to update `script/known-failures.txt` after a grammar or pin change alters which `ruby/spec` files fail to parse.
105
+ - `script/tree-sitter`: use for direct CLI commands such as `script/tree-sitter parse file.rb` so they run the `WillBooster/tree-sitter` version locked in `Cargo.lock`.
133
106
 
134
107
  ### References
135
108
 
package/package.json CHANGED
@@ -1,9 +1,8 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-ruby",
3
- "version": "15.0.1",
3
+ "version": "17.0.0",
4
4
  "description": "Ruby grammar for tree-sitter",
5
5
  "keywords": [
6
- "incremental",
7
6
  "parsing",
8
7
  "ruby",
9
8
  "tree-sitter"
@@ -49,7 +48,7 @@
49
48
  "@vitest/browser-playwright": "5.0.5",
50
49
  "@willbooster/oxlint-config": "1.4.9",
51
50
  "@willbooster/wb": "23.3.0",
52
- "@willbooster/web-tree-sitter": "17.0.1",
51
+ "@willbooster/web-tree-sitter": "20.0.0",
53
52
  "conventional-changelog-conventionalcommits": "10.4.1",
54
53
  "lefthook": "2.2.2",
55
54
  "oxlint": "1.90.0",
@@ -61,7 +60,7 @@
61
60
  "wrangler": "4.156.0"
62
61
  },
63
62
  "peerDependencies": {
64
- "@willbooster/web-tree-sitter": "^17.0.1"
63
+ "@willbooster/web-tree-sitter": "^20.0.0"
65
64
  },
66
65
  "peerDependenciesMeta": {
67
66
  "@willbooster/web-tree-sitter": {
Binary file
package/tree-sitter.json CHANGED
@@ -13,7 +13,7 @@
13
13
  }
14
14
  ],
15
15
  "metadata": {
16
- "version": "15.0.1",
16
+ "version": "17.0.0",
17
17
  "license": "MIT",
18
18
  "description": "Ruby grammar for tree-sitter",
19
19
  "authors": [