@willbooster/tree-sitter-bash 2.1.2 → 2.1.4

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
@@ -4,7 +4,7 @@
4
4
  [![license](https://img.shields.io/npm/l/@willbooster/tree-sitter-bash.svg)](https://www.npmjs.com/package/@willbooster/tree-sitter-bash)
5
5
  [![Test](https://github.com/WillBooster/tree-sitter-bash/actions/workflows/test.yml/badge.svg)](https://github.com/WillBooster/tree-sitter-bash/actions/workflows/test.yml)
6
6
  [![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)
7
- [![wbfy](https://img.shields.io/badge/wbfy-20.26.0-1e90ff.svg)](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
7
+ [![wbfy](https://img.shields.io/badge/wbfy-20.28.7-1e90ff.svg)](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
8
8
 
9
9
  Bash grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter), forked from
10
10
  [tree-sitter/tree-sitter-bash](https://github.com/tree-sitter/tree-sitter-bash). We are grateful to its authors and
@@ -75,13 +75,19 @@ bun run test
75
75
  script/parse-examples
76
76
  ```
77
77
 
78
+ The scripts and tests generate, build, test, and parse with `script/tree-sitter`, the tree-sitter CLI of the
79
+ WillBooster/tree-sitter runtime version that `package.json` pins as `@willbooster/web-tree-sitter`, since the generator
80
+ and the runtime of upstream's CLI are not the ones this package ships with. Its first run downloads that CLI from the
81
+ runtime's GitHub Release, or builds it with `cargo` (which needs CMake) when the download fails or the release has no
82
+ binary that runs here. Run other CLI commands through it as well (e.g. `script/tree-sitter parse script.sh`).
83
+
78
84
  `bun run test` runs:
79
85
 
80
86
  - the corpus in `test/corpus`, with the native build and with the Wasm build (the first run downloads the WASI SDK);
81
- - an incremental-parsing check (`test/unit/incremental.test.ts`): `tree-sitter fuzz` edits each corpus case at random,
82
- reparses it, undoes the edits, and reparses again. `TREE_SITTER_SEED`, `TREE_SITTER_ITERATIONS`, and
83
- `TREE_SITTER_EDITS` run other or more edits. It also applies edits that random ones rarely reach and compares each
84
- incremental reparse with a fresh parse;
87
+ - an incremental-parsing check (`test/unit/incremental.test.ts`): `script/fuzz-corpus` runs `tree-sitter fuzz`, which
88
+ edits each corpus case at random, reparses it, undoes the edits, and reparses again. `TREE_SITTER_SEED`,
89
+ `TREE_SITTER_ITERATIONS`, and `TREE_SITTER_EDITS` run other or more edits. It also applies edits that random ones
90
+ rarely reach and compares each incremental reparse with a fresh parse;
85
91
  - a check that real-world scripts cloned into `examples/` fail to parse exactly as listed in
86
92
  `script/known-failures.txt`. The first run clones them, which takes a few minutes. The example repositories are
87
93
  pinned to commits in `script/parse-examples`. After a grammar change or a moved pin alters that list,
@@ -92,12 +98,16 @@ script/parse-examples
92
98
  `ERROR` or `MISSING` node for a script bash accepts. A failure prints the seed; `DIFFERENTIAL_SEED` and
93
99
  `DIFFERENTIAL_CASES` run other or more scripts. It loads the Wasm build through @willbooster/web-tree-sitter, which
94
100
  `bun run build/ci` rebuilds after regenerating the parser;
95
- - a performance check (`test/unit/performance.test.ts`) that a 240 KB line parses in linear time, since consumers
101
+ - a performance check (`test/unit/performance.test.ts`) that a long line parses in linear time, since consumers
96
102
  parse untrusted scripts;
97
103
  - checks that the Wasm build parses in Chromium (`test/unit/web.browser.test.ts`) and in Cloudflare Workers with and
98
104
  without Node.js compatibility (`test/unit/workers.test.ts`, with the Worker in `test/fixtures/worker`), loading it as
99
105
  the Usage section shows.
100
106
 
107
+ The tests and `script/parse-examples` compile the parser into `.tmp/tree-sitter-lib` rather than the CLI's cache shared
108
+ by every checkout; `script/fuzz-corpus` and the targeted edits of the incremental check build a parser of their own
109
+ for each run and delete it afterwards.
110
+
101
111
  CI also fuzzes the parser with libFuzzer and sanitizers (`.github/workflows/robustness.yml`).
102
112
 
103
113
  ### References
package/grammar.js CHANGED
@@ -3,9 +3,6 @@
3
3
  * @license MIT
4
4
  */
5
5
 
6
- /// <reference types="tree-sitter-cli/dsl" />
7
- // @ts-check
8
-
9
6
  // Characters that end an unquoted word part: metacharacters, quotes, and characters that begin an
10
7
  // expansion. `#` only starts a comment at the beginning of a word, so it is handled separately. Like
11
8
  // bash, only a space, a tab, and a newline separate words; any other whitespace (CR, a no-break space)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-bash",
3
- "version": "2.1.2",
3
+ "version": "2.1.4",
4
4
  "description": "Bash grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -22,16 +22,16 @@
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",
30
30
  "lint-fix": "bun wb lint --fix",
31
31
  "prepare": "(bun lefthook install || true) && (test ! -f .lefthook/normalize-bun-lockfile.sh || bash .lefthook/normalize-bun-lockfile.sh)",
32
- "release": "node script/release.mjs",
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
  "typecheck": "bun wb typecheck",
@@ -39,23 +39,21 @@
39
39
  "verify-full": "bun wb verify --full"
40
40
  },
41
41
  "devDependencies": {
42
- "@semantic-release/exec": "7.1.0",
43
42
  "@tsconfig/bun": "1.0.11",
44
43
  "@types/bun": "1.4.2",
45
44
  "@vitest/browser-playwright": "5.0.1",
46
45
  "@willbooster/oxfmt-config": "1.2.2",
47
46
  "@willbooster/oxlint-config": "1.4.8",
48
- "@willbooster/wb": "22.11.5",
49
- "@willbooster/web-tree-sitter": "1.0.7",
47
+ "@willbooster/wb": "22.13.1",
48
+ "@willbooster/web-tree-sitter": "1.0.15",
50
49
  "conventional-changelog-conventionalcommits": "10.4.0",
51
50
  "lefthook": "2.1.14",
52
51
  "oxfmt": "0.70.0",
53
52
  "oxlint": "1.85.0",
54
- "oxlint-tsgolint": "7.0.2002",
53
+ "oxlint-tsgolint": "7.0.2003",
55
54
  "playwright": "1.63.0",
56
55
  "semantic-release": "25.0.9",
57
56
  "sort-package-json": "4.0.0",
58
- "tree-sitter-cli": "0.27.0",
59
57
  "typescript": "7.0.2",
60
58
  "vite": "8.3.0",
61
59
  "vitest": "5.0.1",
Binary file
package/tree-sitter.json CHANGED
@@ -18,7 +18,7 @@
18
18
  }
19
19
  ],
20
20
  "metadata": {
21
- "version": "2.1.2",
21
+ "version": "2.1.4",
22
22
  "license": "MIT",
23
23
  "description": "Bash grammar for tree-sitter",
24
24
  "authors": [