@willbooster/tree-sitter-bash 2.1.9 → 3.0.1

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
@@ -17,7 +17,7 @@ As a result, its syntax trees differ from the original grammar's; review your qu
17
17
  ## Usage
18
18
 
19
19
  The npm package ships `tree-sitter-bash.wasm` for
20
- [@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) 1.x, a peer dependency:
20
+ [@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) 1.4.2 or later, a peer dependency:
21
21
 
22
22
  ```sh
23
23
  npm install @willbooster/tree-sitter-bash @willbooster/web-tree-sitter
@@ -64,6 +64,10 @@ parser.setLanguage(await Language.load(bash));
64
64
 
65
65
  The package also ships the queries in `queries/` and the node types in `src/node-types.json`.
66
66
 
67
+ The ABI 16 major release can change recovery trees for malformed scripts. Valid syntax and completed constructs
68
+ remain supported, and incremental parses must match fresh parses. Review consumers that depend on the exact shape
69
+ of `ERROR` nodes when upgrading.
70
+
67
71
  ## Development
68
72
 
69
73
  ```sh
@@ -81,6 +85,13 @@ and the runtime of upstream's CLI are not the ones this package ships with. Its
81
85
  runtime's GitHub Release, or builds it with `cargo` (whose build runs the CMake that `mise.toml` pins) when the download fails or the release has no
82
86
  binary that runs here. Run other CLI commands through it as well (e.g. `script/tree-sitter parse script.sh`).
83
87
 
88
+ `bun run generate` records a fresh ABI 16 generation profile from the applicable `test/corpus` cases and Git-tracked
89
+ files in `examples/`, then generates compact parser tables. The parser also embeds metadata from `tree-sitter.json`. After changing a grammar,
90
+ `tree-sitter.json`, a corpus case, or a tracked example,
91
+ regenerate and commit `src/`. Stage added or removed examples with `git add -A examples` before generation so the profile uses the intended file list.
92
+ Profiles in `.tmp/generation-profiles/` are temporary and must not be committed. `bun run build-wasm`, `bun run build/ci`,
93
+ and the release build regenerate the parsers before compiling them.
94
+
84
95
  `bun run test` runs:
85
96
 
86
97
  - the corpus in `test/corpus`, with the native build and with the Wasm build (the first run downloads the WASI SDK);
package/grammar.js CHANGED
@@ -146,6 +146,9 @@ module.exports = grammar({
146
146
  $._command_substitution_start,
147
147
  $._arithmetic_substitution_start,
148
148
  $._arithmetic_cache_reset,
149
+ $._timing_keyword,
150
+ $._timing_option,
151
+ $._timing_terminator,
149
152
  ],
150
153
 
151
154
  extras: ($) => [$.comment, $.heredoc_body, /[ \t\n]/, /\\\n/, $._line_continuation, $._arithmetic_cache_reset],
@@ -204,8 +207,9 @@ module.exports = grammar({
204
207
  prec.right(
205
208
  2,
206
209
  seq(
207
- 'time',
208
- optional(field('option', alias('-p', $.word))),
210
+ choice('time', alias($._timing_keyword, 'time')),
211
+ optional(field('option', alias(choice('-p', $._timing_option), $.word))),
212
+ optional(alias($._timing_terminator, $.word)),
209
213
  optional(choice($._command_statement, $.pipeline, $.negated_command))
210
214
  )
211
215
  ),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-bash",
3
- "version": "2.1.9",
3
+ "version": "3.0.1",
4
4
  "description": "Bash grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -22,10 +22,11 @@
22
22
  "*.wasm"
23
23
  ],
24
24
  "scripts": {
25
- "build-wasm": "script/tree-sitter build --wasm",
26
- "build/ci": "script/tree-sitter generate && script/tree-sitter build --wasm",
25
+ "build-wasm": "script/generate --build-wasm",
26
+ "build/ci": "bun run build-wasm",
27
27
  "cleanup": "bun wb lint --fix --format",
28
28
  "format": "bun wb lint --format",
29
+ "generate": "script/generate",
29
30
  "lint": "bun wb lint",
30
31
  "lint-fix": "bun wb lint --fix",
31
32
  "prepare": "(bun lefthook install || true) && (test ! -f .lefthook/normalize-bun-lockfile.sh || bash .lefthook/normalize-bun-lockfile.sh)",
@@ -45,7 +46,7 @@
45
46
  "@willbooster/oxfmt-config": "1.2.2",
46
47
  "@willbooster/oxlint-config": "1.4.8",
47
48
  "@willbooster/wb": "22.18.0",
48
- "@willbooster/web-tree-sitter": "1.0.17",
49
+ "@willbooster/web-tree-sitter": "1.4.2",
49
50
  "conventional-changelog-conventionalcommits": "10.4.0",
50
51
  "lefthook": "2.1.14",
51
52
  "oxfmt": "0.70.0",
@@ -61,7 +62,7 @@
61
62
  "wrangler": "4.141.0"
62
63
  },
63
64
  "peerDependencies": {
64
- "@willbooster/web-tree-sitter": "^1.0.0"
65
+ "@willbooster/web-tree-sitter": "^1.4.2"
65
66
  },
66
67
  "peerDependenciesMeta": {
67
68
  "@willbooster/web-tree-sitter": {
@@ -2882,7 +2882,7 @@
2882
2882
  }
2883
2883
  },
2884
2884
  "children": {
2885
- "multiple": false,
2885
+ "multiple": true,
2886
2886
  "required": false,
2887
2887
  "types": [
2888
2888
  {
@@ -2944,6 +2944,10 @@
2944
2944
  {
2945
2945
  "type": "while_statement",
2946
2946
  "named": true
2947
+ },
2948
+ {
2949
+ "type": "word",
2950
+ "named": true
2947
2951
  }
2948
2952
  ]
2949
2953
  }
Binary file
package/tree-sitter.json CHANGED
@@ -18,7 +18,7 @@
18
18
  }
19
19
  ],
20
20
  "metadata": {
21
- "version": "2.1.9",
21
+ "version": "3.0.1",
22
22
  "license": "MIT",
23
23
  "description": "Bash grammar for tree-sitter",
24
24
  "authors": [