@willbooster/tree-sitter-bash 10.0.0 → 11.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 +13 -6
- package/package.json +9 -10
- package/tree-sitter-bash.wasm +0 -0
- package/tree-sitter.json +1 -1
- package/queries/highlights.scm +0 -77
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
|
|
@@ -14,16 +14,23 @@ This fork aims to parse scripts exactly as bash runs them, so that tools can tel
|
|
|
14
14
|
scripts. It fixes parsing bugs and raises conformance with bash, checked by differential tests against bash itself.
|
|
15
15
|
As a result, its syntax trees differ from the original grammar's; review your queries when migrating.
|
|
16
16
|
|
|
17
|
+
## Support Scope
|
|
18
|
+
|
|
19
|
+
This fork maintains only full parsing: valid input yields a correct tree, and invalid input yields `ERROR` or `MISSING`
|
|
20
|
+
nodes without crashing, hanging, or taking more than linear time. Incremental parsing works as in upstream tree-sitter
|
|
21
|
+
but is not tested here, and no queries (highlights, locals, injections, tags) are shipped. Node types, field names, and
|
|
22
|
+
the trees that error recovery produces may change; such changes are released as new major versions.
|
|
23
|
+
|
|
17
24
|
## Usage
|
|
18
25
|
|
|
19
26
|
The npm package ships `tree-sitter-bash.wasm` for
|
|
20
|
-
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) 15.0.0 or later in the 15.x series,
|
|
27
|
+
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) 15.0.0 or later in the 15.x or 16.x series,
|
|
21
28
|
a peer dependency.
|
|
22
29
|
The parser carries the ABI number of WillBooster/tree-sitter (`0x5742000b`), so only that runtime loads it; the
|
|
23
30
|
original tree-sitter runtime rejects it, and earlier WillBooster runtime ABIs do too:
|
|
24
31
|
|
|
25
32
|
```sh
|
|
26
|
-
npm install @willbooster/tree-sitter-bash @willbooster/web-tree-sitter@^
|
|
33
|
+
npm install @willbooster/tree-sitter-bash @willbooster/web-tree-sitter@^16.0.0
|
|
27
34
|
```
|
|
28
35
|
|
|
29
36
|
In Node.js and Bun, load the grammar from its path:
|
|
@@ -66,9 +73,9 @@ const parser = new Parser();
|
|
|
66
73
|
parser.setLanguage(await Language.load(bash));
|
|
67
74
|
```
|
|
68
75
|
|
|
69
|
-
The package also ships the
|
|
76
|
+
The package also ships the node types in `src/node-types.json`.
|
|
70
77
|
|
|
71
|
-
Upgrade `@willbooster/web-tree-sitter` to 15.0.0 or later in the 15.x series when upgrading this package. Recovery trees
|
|
78
|
+
Upgrade `@willbooster/web-tree-sitter` to 15.0.0 or later in the 15.x or 16.x series when upgrading this package. Recovery trees
|
|
72
79
|
for malformed scripts can differ across runtime versions, so review consumers that depend on the exact shape of
|
|
73
80
|
`ERROR` nodes.
|
|
74
81
|
|
|
@@ -92,7 +99,7 @@ bun run verify
|
|
|
92
99
|
bun run test
|
|
93
100
|
```
|
|
94
101
|
|
|
95
|
-
- [Parser generation and validation](docs/development.md): read before changing grammar inputs, refreshing examples, or reproducing a
|
|
102
|
+
- [Parser generation and validation](docs/development.md): read before changing grammar inputs, refreshing examples, or reproducing a differential failure.
|
|
96
103
|
|
|
97
104
|
## References
|
|
98
105
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-bash",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "11.0.1",
|
|
4
4
|
"description": "Bash grammar for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bash",
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
"files": [
|
|
18
18
|
"grammar.js",
|
|
19
19
|
"tree-sitter.json",
|
|
20
|
-
"queries/*",
|
|
21
20
|
"src/node-types.json",
|
|
22
21
|
"*.wasm"
|
|
23
22
|
],
|
|
@@ -45,23 +44,23 @@
|
|
|
45
44
|
},
|
|
46
45
|
"devDependencies": {
|
|
47
46
|
"@tsconfig/bun": "1.0.11",
|
|
48
|
-
"@types/bun": "1.4.
|
|
47
|
+
"@types/bun": "1.4.4",
|
|
49
48
|
"@vitest/browser-playwright": "5.0.5",
|
|
50
49
|
"@willbooster/oxlint-config": "1.4.9",
|
|
51
|
-
"@willbooster/wb": "
|
|
52
|
-
"@willbooster/web-tree-sitter": "
|
|
50
|
+
"@willbooster/wb": "23.0.2",
|
|
51
|
+
"@willbooster/web-tree-sitter": "16.0.2",
|
|
53
52
|
"conventional-changelog-conventionalcommits": "10.4.1",
|
|
54
53
|
"lefthook": "2.2.2",
|
|
55
|
-
"oxlint": "1.
|
|
56
|
-
"oxlint-tsgolint": "7.0.
|
|
54
|
+
"oxlint": "1.89.0",
|
|
55
|
+
"oxlint-tsgolint": "7.0.2005",
|
|
57
56
|
"playwright": "1.64.1",
|
|
58
57
|
"semantic-release": "25.0.9",
|
|
59
|
-
"vite": "8.3.
|
|
58
|
+
"vite": "8.3.5",
|
|
60
59
|
"vitest": "5.0.5",
|
|
61
|
-
"wrangler": "4.
|
|
60
|
+
"wrangler": "4.152.0"
|
|
62
61
|
},
|
|
63
62
|
"peerDependencies": {
|
|
64
|
-
"@willbooster/web-tree-sitter": "^15.0.0"
|
|
63
|
+
"@willbooster/web-tree-sitter": "^15.0.0 || ^16.0.0"
|
|
65
64
|
},
|
|
66
65
|
"peerDependenciesMeta": {
|
|
67
66
|
"@willbooster/web-tree-sitter": {
|
package/tree-sitter-bash.wasm
CHANGED
|
Binary file
|
package/tree-sitter.json
CHANGED
package/queries/highlights.scm
DELETED
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
(string)
|
|
3
|
-
(raw_string)
|
|
4
|
-
(ansi_c_string)
|
|
5
|
-
(translated_string)
|
|
6
|
-
(heredoc_body)
|
|
7
|
-
(heredoc_start)
|
|
8
|
-
] @string
|
|
9
|
-
|
|
10
|
-
(regex) @string.regexp
|
|
11
|
-
|
|
12
|
-
(command_name) @function
|
|
13
|
-
|
|
14
|
-
(function_definition
|
|
15
|
-
name: (word) @function)
|
|
16
|
-
|
|
17
|
-
(variable_name) @property
|
|
18
|
-
|
|
19
|
-
(special_variable_name) @variable.builtin
|
|
20
|
-
|
|
21
|
-
[
|
|
22
|
-
"case"
|
|
23
|
-
"coproc"
|
|
24
|
-
"do"
|
|
25
|
-
"done"
|
|
26
|
-
"elif"
|
|
27
|
-
"else"
|
|
28
|
-
"esac"
|
|
29
|
-
"fi"
|
|
30
|
-
"for"
|
|
31
|
-
"function"
|
|
32
|
-
"if"
|
|
33
|
-
"in"
|
|
34
|
-
"select"
|
|
35
|
-
"then"
|
|
36
|
-
"time"
|
|
37
|
-
"until"
|
|
38
|
-
"while"
|
|
39
|
-
] @keyword
|
|
40
|
-
|
|
41
|
-
(comment) @comment
|
|
42
|
-
|
|
43
|
-
[
|
|
44
|
-
(file_descriptor)
|
|
45
|
-
(number)
|
|
46
|
-
] @number
|
|
47
|
-
|
|
48
|
-
[
|
|
49
|
-
(command_substitution)
|
|
50
|
-
(process_substitution)
|
|
51
|
-
(expansion)
|
|
52
|
-
(arithmetic_expansion)
|
|
53
|
-
] @embedded
|
|
54
|
-
|
|
55
|
-
(test_operator) @operator
|
|
56
|
-
|
|
57
|
-
[
|
|
58
|
-
"!"
|
|
59
|
-
"&&"
|
|
60
|
-
"||"
|
|
61
|
-
"|"
|
|
62
|
-
"|&"
|
|
63
|
-
">"
|
|
64
|
-
">>"
|
|
65
|
-
"<"
|
|
66
|
-
"<<<"
|
|
67
|
-
"&>"
|
|
68
|
-
"&>>"
|
|
69
|
-
"<&"
|
|
70
|
-
">&"
|
|
71
|
-
">|"
|
|
72
|
-
"=~"
|
|
73
|
-
] @operator
|
|
74
|
-
|
|
75
|
-
((command
|
|
76
|
-
argument: (word) @constant)
|
|
77
|
-
(#match? @constant "^-"))
|