@willbooster/tree-sitter-zig 4.0.0 → 5.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 CHANGED
@@ -5,7 +5,7 @@
5
5
  [![Test](https://github.com/WillBooster/tree-sitter-zig/actions/workflows/test.yml/badge.svg)](https://github.com/WillBooster/tree-sitter-zig/actions/workflows/test.yml)
6
6
  [![Test rust](https://github.com/WillBooster/tree-sitter-zig/actions/workflows/test-rust.yml/badge.svg)](https://github.com/WillBooster/tree-sitter-zig/actions/workflows/test-rust.yml)
7
7
  [![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)
8
- [![wbfy](https://img.shields.io/badge/wbfy-20.45.0-1e90ff.svg)](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
8
+ [![wbfy](https://img.shields.io/badge/wbfy-20.48.9-1e90ff.svg)](https://github.com/WillBooster/shared/tree/main/packages/wbfy)
9
9
  [![crates.io](https://img.shields.io/crates/v/willbooster-tree-sitter-zig.svg)](https://crates.io/crates/willbooster-tree-sitter-zig)
10
10
 
11
11
  Zig grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter), forked from
@@ -14,7 +14,7 @@ to its authors and contributors. This is not an official release of that project
14
14
 
15
15
  This fork builds on the grammar of upstream's version 1.1.2 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 (`0x57420009`) and loads only with that fork's runtime, version 13.0.0 or later in the 13.x series: upstream's tree-sitter runtime
17
+ number (`0x5742000b`) and loads only with that fork's runtime, version 15.0.0 or later in the 15.x series: upstream's tree-sitter runtime
18
18
  rejects it. It parses as the parser in upstream's 1.1.2 packages does, with these exceptions:
19
19
 
20
20
  - In the ranges a `for` loop iterates over, a range end whose first token can both start an expression and continue
@@ -44,11 +44,12 @@ rejects it. It parses as the parser in upstream's 1.1.2 packages does, with thes
44
44
  ## Usage
45
45
 
46
46
  The npm package ships `tree-sitter-zig.wasm` for
47
- [@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 13.0.0 or later in the 13.x series, which runs in Node.js, Bun, browsers, and Cloudflare Workers.
47
+ [@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version 15.0.0 or later in the 15.x series, which runs in Node.js, Bun, browsers, and Cloudflare Workers.
48
48
  In Node.js and Bun, load the grammar from its path:
49
49
 
50
50
  ```js
51
51
  import { fileURLToPath } from 'node:url';
52
+
52
53
  import { Language, Parser } from '@willbooster/web-tree-sitter';
53
54
 
54
55
  await Parser.init();
@@ -61,9 +62,9 @@ const tree = parser.parse('pub fn main() void {}\n');
61
62
  In browsers, serve both `.wasm` files and load them by URL (the example uses Vite's `?url` imports):
62
63
 
63
64
  ```js
65
+ import zigUrl from '@willbooster/tree-sitter-zig/tree-sitter-zig.wasm?url';
64
66
  import { Language, Parser } from '@willbooster/web-tree-sitter';
65
67
  import runtimeUrl from '@willbooster/web-tree-sitter/web-tree-sitter.wasm?url';
66
- import zigUrl from '@willbooster/tree-sitter-zig/tree-sitter-zig.wasm?url';
67
68
 
68
69
  await Parser.init({ locateFile: () => runtimeUrl });
69
70
  const parser = new Parser();
@@ -74,9 +75,9 @@ Cloudflare Workers do not allow compiling Wasm at run time, so import both `.was
74
75
  Node.js compatibility:
75
76
 
76
77
  ```js
78
+ import zig from '@willbooster/tree-sitter-zig/tree-sitter-zig.wasm';
77
79
  import { Language, Parser } from '@willbooster/web-tree-sitter';
78
80
  import runtime from '@willbooster/web-tree-sitter/web-tree-sitter.wasm';
79
- import zig from '@willbooster/tree-sitter-zig/tree-sitter-zig.wasm';
80
81
 
81
82
  await Parser.init({ wasmModule: runtime });
82
83
  const parser = new Parser();
@@ -91,8 +92,8 @@ fuzzed with:
91
92
 
92
93
  ```toml
93
94
  [dependencies]
94
- tree-sitter = { package = "willbooster-tree-sitter", version = "13.0.0" }
95
- tree-sitter-zig = { package = "willbooster-tree-sitter-zig", version = "4" }
95
+ tree-sitter = { package = "willbooster-tree-sitter", version = "15.0.0" }
96
+ tree-sitter-zig = { package = "willbooster-tree-sitter-zig", version = "5" }
96
97
  ```
97
98
 
98
99
  ```rust
package/grammar.js CHANGED
@@ -201,7 +201,7 @@ module.exports = grammar({
201
201
  _function_prototype: $ => seq(
202
202
  'fn',
203
203
  optional(field('name', $.identifier)),
204
- $.parameters,
204
+ field('parameters', $.parameters),
205
205
  optional($.byte_alignment),
206
206
  optional($.address_space),
207
207
  optional($.link_section),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@willbooster/tree-sitter-zig",
3
- "version": "4.0.0",
3
+ "version": "5.0.0",
4
4
  "description": "Zig grammar for tree-sitter",
5
5
  "keywords": [
6
6
  "incremental",
@@ -8,12 +8,12 @@
8
8
  "tree-sitter",
9
9
  "zig"
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-zig.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.3",
47
- "@willbooster/oxfmt-config": "1.2.2",
48
- "@willbooster/oxlint-config": "1.4.8",
49
- "@willbooster/wb": "22.26.3",
50
- "@willbooster/web-tree-sitter": "13.0.0",
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": "15.0.0",
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.63.0",
58
+ "playwright": "1.64.1",
57
59
  "semantic-release": "25.0.9",
58
- "sort-package-json": "4.1.0",
59
- "vitest": "5.0.3",
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": "^13.0.0"
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
  }
@@ -1455,6 +1455,16 @@
1455
1455
  }
1456
1456
  ]
1457
1457
  },
1458
+ "parameters": {
1459
+ "multiple": false,
1460
+ "required": true,
1461
+ "types": [
1462
+ {
1463
+ "type": "parameters",
1464
+ "named": true
1465
+ }
1466
+ ]
1467
+ },
1458
1468
  "type": {
1459
1469
  "multiple": false,
1460
1470
  "required": true,
@@ -1480,7 +1490,7 @@
1480
1490
  },
1481
1491
  "children": {
1482
1492
  "multiple": true,
1483
- "required": true,
1493
+ "required": false,
1484
1494
  "types": [
1485
1495
  {
1486
1496
  "type": "address_space",
@@ -1498,10 +1508,6 @@
1498
1508
  "type": "link_section",
1499
1509
  "named": true
1500
1510
  },
1501
- {
1502
- "type": "parameters",
1503
- "named": true
1504
- },
1505
1511
  {
1506
1512
  "type": "string",
1507
1513
  "named": true
@@ -1523,6 +1529,16 @@
1523
1529
  }
1524
1530
  ]
1525
1531
  },
1532
+ "parameters": {
1533
+ "multiple": false,
1534
+ "required": true,
1535
+ "types": [
1536
+ {
1537
+ "type": "parameters",
1538
+ "named": true
1539
+ }
1540
+ ]
1541
+ },
1526
1542
  "type": {
1527
1543
  "multiple": false,
1528
1544
  "required": true,
@@ -1548,7 +1564,7 @@
1548
1564
  },
1549
1565
  "children": {
1550
1566
  "multiple": true,
1551
- "required": true,
1567
+ "required": false,
1552
1568
  "types": [
1553
1569
  {
1554
1570
  "type": "address_space",
@@ -1565,10 +1581,6 @@
1565
1581
  {
1566
1582
  "type": "link_section",
1567
1583
  "named": true
1568
- },
1569
- {
1570
- "type": "parameters",
1571
- "named": true
1572
1584
  }
1573
1585
  ]
1574
1586
  }
Binary file
package/tree-sitter.json CHANGED
@@ -15,7 +15,7 @@
15
15
  }
16
16
  ],
17
17
  "metadata": {
18
- "version": "4.0.0",
18
+ "version": "5.0.0",
19
19
  "license": "MIT",
20
20
  "description": "Zig grammar for tree-sitter",
21
21
  "authors": [