@willbooster/tree-sitter-bash 2.1.3 → 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 +16 -6
- package/grammar.js +0 -3
- package/package.json +7 -8
- package/tree-sitter-bash.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/@willbooster/tree-sitter-bash)
|
|
5
5
|
[](https://github.com/WillBooster/tree-sitter-bash/actions/workflows/test.yml)
|
|
6
6
|
[](https://github.com/semantic-release/semantic-release)
|
|
7
|
-
[](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
|
|
82
|
-
reparses it, undoes the edits, and reparses again. `TREE_SITTER_SEED`,
|
|
83
|
-
`TREE_SITTER_EDITS` run other or more edits. It also applies edits that random ones
|
|
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
|
|
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.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"description": "Bash 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
|
"typecheck": "bun wb typecheck",
|
|
@@ -44,17 +44,16 @@
|
|
|
44
44
|
"@vitest/browser-playwright": "5.0.1",
|
|
45
45
|
"@willbooster/oxfmt-config": "1.2.2",
|
|
46
46
|
"@willbooster/oxlint-config": "1.4.8",
|
|
47
|
-
"@willbooster/wb": "22.13.
|
|
48
|
-
"@willbooster/web-tree-sitter": "1.0.
|
|
47
|
+
"@willbooster/wb": "22.13.1",
|
|
48
|
+
"@willbooster/web-tree-sitter": "1.0.15",
|
|
49
49
|
"conventional-changelog-conventionalcommits": "10.4.0",
|
|
50
50
|
"lefthook": "2.1.14",
|
|
51
51
|
"oxfmt": "0.70.0",
|
|
52
52
|
"oxlint": "1.85.0",
|
|
53
|
-
"oxlint-tsgolint": "7.0.
|
|
53
|
+
"oxlint-tsgolint": "7.0.2003",
|
|
54
54
|
"playwright": "1.63.0",
|
|
55
55
|
"semantic-release": "25.0.9",
|
|
56
56
|
"sort-package-json": "4.0.0",
|
|
57
|
-
"tree-sitter-cli": "0.27.0",
|
|
58
57
|
"typescript": "7.0.2",
|
|
59
58
|
"vite": "8.3.0",
|
|
60
59
|
"vitest": "5.0.1",
|
package/tree-sitter-bash.wasm
CHANGED
|
Binary file
|