@willbooster/tree-sitter-go 5.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/package.json +17 -20
- package/tree-sitter-go.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-go/actions/workflows/test.yml)
|
|
6
6
|
[](https://github.com/WillBooster/tree-sitter-go/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-go)
|
|
10
10
|
|
|
11
11
|
Go grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter), forked from
|
|
@@ -14,16 +14,17 @@ 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.25.0 grammar with method type parameters and generates the parser with the
|
|
16
16
|
[WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter) generator. The parser carries that fork's own ABI
|
|
17
|
-
number (`
|
|
17
|
+
number (`0x5742000b`), so it loads only with the WillBooster runtime, version 15.0.0 or later within 15.x
|
|
18
18
|
(`willbooster-tree-sitter`, `@willbooster/web-tree-sitter`), and not with upstream's tree-sitter.
|
|
19
19
|
|
|
20
20
|
## Usage
|
|
21
21
|
|
|
22
22
|
The npm package ships `tree-sitter-go.wasm` for
|
|
23
|
-
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version
|
|
23
|
+
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 15.0.0 or later within 15.x, which runs in Node.js, Bun, browsers, and Cloudflare Workers. In Node.js and Bun, load the grammar from its path:
|
|
24
24
|
|
|
25
25
|
```js
|
|
26
26
|
import { fileURLToPath } from 'node:url';
|
|
27
|
+
|
|
27
28
|
import { Language, Parser } from '@willbooster/web-tree-sitter';
|
|
28
29
|
|
|
29
30
|
await Parser.init();
|
|
@@ -36,9 +37,9 @@ const tree = parser.parse('package main\n\nfunc main() {}\n');
|
|
|
36
37
|
In browsers, serve both `.wasm` files and load them by URL (the example uses Vite's `?url` imports):
|
|
37
38
|
|
|
38
39
|
```js
|
|
40
|
+
import goUrl from '@willbooster/tree-sitter-go/tree-sitter-go.wasm?url';
|
|
39
41
|
import { Language, Parser } from '@willbooster/web-tree-sitter';
|
|
40
42
|
import runtimeUrl from '@willbooster/web-tree-sitter/web-tree-sitter.wasm?url';
|
|
41
|
-
import goUrl from '@willbooster/tree-sitter-go/tree-sitter-go.wasm?url';
|
|
42
43
|
|
|
43
44
|
await Parser.init({ locateFile: () => runtimeUrl });
|
|
44
45
|
const parser = new Parser();
|
|
@@ -49,9 +50,9 @@ Cloudflare Workers do not allow compiling Wasm at run time, so import both `.was
|
|
|
49
50
|
Node.js compatibility:
|
|
50
51
|
|
|
51
52
|
```js
|
|
53
|
+
import go from '@willbooster/tree-sitter-go/tree-sitter-go.wasm';
|
|
52
54
|
import { Language, Parser } from '@willbooster/web-tree-sitter';
|
|
53
55
|
import runtime from '@willbooster/web-tree-sitter/web-tree-sitter.wasm';
|
|
54
|
-
import go from '@willbooster/tree-sitter-go/tree-sitter-go.wasm';
|
|
55
56
|
|
|
56
57
|
await Parser.init({ wasmModule: runtime });
|
|
57
58
|
const parser = new Parser();
|
|
@@ -66,8 +67,8 @@ fuzzed with:
|
|
|
66
67
|
|
|
67
68
|
```toml
|
|
68
69
|
[dependencies]
|
|
69
|
-
tree-sitter = { package = "willbooster-tree-sitter", version = "
|
|
70
|
-
tree-sitter-go = { package = "willbooster-tree-sitter-go", version = "
|
|
70
|
+
tree-sitter = { package = "willbooster-tree-sitter", version = "15.0.0" }
|
|
71
|
+
tree-sitter-go = { package = "willbooster-tree-sitter-go", version = "6" }
|
|
71
72
|
```
|
|
72
73
|
|
|
73
74
|
```rust
|
package/package.json
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-go",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0",
|
|
4
4
|
"description": "Go grammar for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
|
+
"go",
|
|
6
7
|
"incremental",
|
|
7
8
|
"parsing",
|
|
8
|
-
"tree-sitter"
|
|
9
|
-
"go"
|
|
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-go.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
|
-
"@willbooster/web-tree-sitter": "13.0.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": "15.0.0",
|
|
51
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.64.
|
|
58
|
+
"playwright": "1.64.1",
|
|
57
59
|
"semantic-release": "25.0.9",
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"wrangler": "4.149.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": "^15.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/tree-sitter-go.wasm
CHANGED
|
Binary file
|