@willbooster/tree-sitter-dart 4.0.0 → 6.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 +8 -7
- package/grammar.js +4 -6
- package/package.json +18 -21
- package/src/node-types.json +4 -0
- package/tree-sitter-dart.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://github.com/WillBooster/tree-sitter-dart/actions/workflows/test.yml)
|
|
6
6
|
[](https://github.com/WillBooster/tree-sitter-dart/actions/workflows/test-rust.yml)
|
|
7
7
|
[](https://github.com/semantic-release/semantic-release)
|
|
8
|
-
[](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
|
|
9
9
|
[](https://crates.io/crates/willbooster-tree-sitter-dart)
|
|
10
10
|
|
|
11
11
|
Dart grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter), forked from
|
|
@@ -13,8 +13,8 @@ Dart grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter), fork
|
|
|
13
13
|
to its authors and contributors. This is not an official release of that project.
|
|
14
14
|
|
|
15
15
|
This fork extends upstream's version 0.2.0 grammar, retains its external scanner, and generates the parser with the
|
|
16
|
-
[WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter) generator. The parser carries that fork's own ABI number (`
|
|
17
|
-
version
|
|
16
|
+
[WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter) generator. The parser carries that fork's own ABI number (`0x5742000a`), so it loads only with the fork's runtime,
|
|
17
|
+
version 14.0.0 or later in the 14.x series; upstream's runtime rejects it, and the fork's runtime rejects parsers generated by upstream's CLI.
|
|
18
18
|
|
|
19
19
|
## Differences from upstream's parser
|
|
20
20
|
|
|
@@ -31,11 +31,12 @@ Known differences from upstream's 0.2.0 parser include:
|
|
|
31
31
|
## Usage
|
|
32
32
|
|
|
33
33
|
The npm package ships `tree-sitter-dart.wasm` for
|
|
34
|
-
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version
|
|
34
|
+
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 14.0.0 or later in the 14.x series, which runs in Node.js, Bun, browsers, and Cloudflare Workers.
|
|
35
35
|
In Node.js and Bun, load the grammar from its path:
|
|
36
36
|
|
|
37
37
|
```js
|
|
38
38
|
import { fileURLToPath } from 'node:url';
|
|
39
|
+
|
|
39
40
|
import { Language, Parser } from '@willbooster/web-tree-sitter';
|
|
40
41
|
|
|
41
42
|
await Parser.init();
|
|
@@ -48,9 +49,9 @@ const tree = parser.parse('void main() {}\n');
|
|
|
48
49
|
In browsers, serve both `.wasm` files and load them by URL (the example uses Vite's `?url` imports):
|
|
49
50
|
|
|
50
51
|
```js
|
|
52
|
+
import grammarUrl from '@willbooster/tree-sitter-dart/tree-sitter-dart.wasm?url';
|
|
51
53
|
import { Language, Parser } from '@willbooster/web-tree-sitter';
|
|
52
54
|
import runtimeUrl from '@willbooster/web-tree-sitter/web-tree-sitter.wasm?url';
|
|
53
|
-
import grammarUrl from '@willbooster/tree-sitter-dart/tree-sitter-dart.wasm?url';
|
|
54
55
|
|
|
55
56
|
await Parser.init({ locateFile: () => runtimeUrl });
|
|
56
57
|
const parser = new Parser();
|
|
@@ -61,9 +62,9 @@ Cloudflare Workers do not allow compiling Wasm at run time, so import both `.was
|
|
|
61
62
|
Node.js compatibility:
|
|
62
63
|
|
|
63
64
|
```js
|
|
65
|
+
import grammar from '@willbooster/tree-sitter-dart/tree-sitter-dart.wasm';
|
|
64
66
|
import { Language, Parser } from '@willbooster/web-tree-sitter';
|
|
65
67
|
import runtime from '@willbooster/web-tree-sitter/web-tree-sitter.wasm';
|
|
66
|
-
import grammar from '@willbooster/tree-sitter-dart/tree-sitter-dart.wasm';
|
|
67
68
|
|
|
68
69
|
await Parser.init({ wasmModule: runtime });
|
|
69
70
|
const parser = new Parser();
|
|
@@ -78,7 +79,7 @@ fuzzed with:
|
|
|
78
79
|
|
|
79
80
|
```toml
|
|
80
81
|
[dependencies]
|
|
81
|
-
tree-sitter = { package = "willbooster-tree-sitter", version = "
|
|
82
|
+
tree-sitter = { package = "willbooster-tree-sitter", version = "14.0.0" }
|
|
82
83
|
tree-sitter-dart = { package = "willbooster-tree-sitter-dart", version = "4" }
|
|
83
84
|
```
|
|
84
85
|
|
package/grammar.js
CHANGED
|
@@ -1130,12 +1130,10 @@ module.exports = grammar({
|
|
|
1130
1130
|
multiplicative_expression: ($) =>
|
|
1131
1131
|
prec.left(
|
|
1132
1132
|
PREC.MULTIPLICATIVE,
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
),
|
|
1138
|
-
seq("super", repeat1(seq(choice("*", "/", "%", "~/"), $._unary_expression))),
|
|
1133
|
+
seq(
|
|
1134
|
+
choice($._unary_expression, $.multiplicative_expression, "super"),
|
|
1135
|
+
choice("*", "/", "%", "~/"),
|
|
1136
|
+
$._unary_expression,
|
|
1139
1137
|
),
|
|
1140
1138
|
),
|
|
1141
1139
|
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-dart",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Dart grammar for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
|
+
"dart",
|
|
6
7
|
"incremental",
|
|
7
8
|
"parsing",
|
|
8
|
-
"tree-sitter"
|
|
9
|
-
"dart"
|
|
9
|
+
"tree-sitter"
|
|
10
10
|
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"author": "WillBooster Inc.",
|
|
11
13
|
"repository": {
|
|
12
14
|
"type": "git",
|
|
13
15
|
"url": "git+https://github.com/WillBooster/tree-sitter-dart.git"
|
|
14
16
|
},
|
|
15
|
-
"license": "MIT",
|
|
16
|
-
"author": "WillBooster Inc.",
|
|
17
17
|
"files": [
|
|
18
18
|
"grammar.js",
|
|
19
19
|
"queries/*.scm",
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
"tree-sitter.json",
|
|
22
22
|
"*.wasm"
|
|
23
23
|
],
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public",
|
|
26
|
+
"registry": "https://registry.npmjs.org/"
|
|
27
|
+
},
|
|
24
28
|
"scripts": {
|
|
25
29
|
"build-wasm": "script/generate --build-wasm",
|
|
26
30
|
"build/ci": "bun run build-wasm",
|
|
@@ -43,32 +47,25 @@
|
|
|
43
47
|
"devDependencies": {
|
|
44
48
|
"@tsconfig/bun": "1.0.11",
|
|
45
49
|
"@types/bun": "1.4.3",
|
|
46
|
-
"@vitest/browser-playwright": "5.0.
|
|
47
|
-
"@willbooster/
|
|
48
|
-
"@willbooster/
|
|
49
|
-
"@willbooster/
|
|
50
|
-
"
|
|
51
|
-
"conventional-changelog-conventionalcommits": "10.4.0",
|
|
50
|
+
"@vitest/browser-playwright": "5.0.5",
|
|
51
|
+
"@willbooster/oxlint-config": "1.4.9",
|
|
52
|
+
"@willbooster/wb": "22.29.3",
|
|
53
|
+
"@willbooster/web-tree-sitter": "14.0.4",
|
|
54
|
+
"conventional-changelog-conventionalcommits": "10.4.1",
|
|
52
55
|
"lefthook": "2.2.2",
|
|
53
|
-
"oxfmt": "0.73.0",
|
|
54
56
|
"oxlint": "1.88.0",
|
|
55
57
|
"oxlint-tsgolint": "7.0.2004",
|
|
56
|
-
"playwright": "1.
|
|
58
|
+
"playwright": "1.64.1",
|
|
57
59
|
"semantic-release": "25.0.9",
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"wrangler": "4.147.0"
|
|
60
|
+
"vitest": "5.0.5",
|
|
61
|
+
"wrangler": "4.151.1"
|
|
61
62
|
},
|
|
62
63
|
"peerDependencies": {
|
|
63
|
-
"@willbooster/web-tree-sitter": "^
|
|
64
|
+
"@willbooster/web-tree-sitter": "^14.0.0"
|
|
64
65
|
},
|
|
65
66
|
"peerDependenciesMeta": {
|
|
66
67
|
"@willbooster/web-tree-sitter": {
|
|
67
68
|
"optional": true
|
|
68
69
|
}
|
|
69
|
-
},
|
|
70
|
-
"publishConfig": {
|
|
71
|
-
"access": "public",
|
|
72
|
-
"registry": "https://registry.npmjs.org/"
|
|
73
70
|
}
|
|
74
71
|
}
|
package/src/node-types.json
CHANGED
|
@@ -10782,6 +10782,10 @@
|
|
|
10782
10782
|
"type": "member_expression",
|
|
10783
10783
|
"named": true
|
|
10784
10784
|
},
|
|
10785
|
+
{
|
|
10786
|
+
"type": "multiplicative_expression",
|
|
10787
|
+
"named": true
|
|
10788
|
+
},
|
|
10785
10789
|
{
|
|
10786
10790
|
"type": "null_assertion_expression",
|
|
10787
10791
|
"named": true
|
package/tree-sitter-dart.wasm
CHANGED
|
Binary file
|