@willbooster/tree-sitter-xml 3.0.2 → 4.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 +8 -7
- package/package.json +18 -21
- package/tree-sitter-dtd.wasm +0 -0
- package/tree-sitter-xml.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-xml/actions/workflows/test.yml)
|
|
6
6
|
[](https://github.com/WillBooster/tree-sitter-xml/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-xml)
|
|
10
10
|
|
|
11
11
|
XML and DTD grammars 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 grammars and queries of upstream's version 0.7.0 and generates the parsers with the
|
|
16
16
|
[WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter) generator. The parsers carry that fork's own ABI
|
|
17
|
-
number (`
|
|
17
|
+
number (`0x57420009`) and load with that fork's runtime, version 13.0.0 or later in the 13.x series. The XML scanner
|
|
18
18
|
adapts to the generated array API with the change upstream itself made after 0.7.0. The parsers differ from
|
|
19
19
|
upstream's 0.7.0 packages in these ways:
|
|
20
20
|
|
|
@@ -38,11 +38,12 @@ parses external DTD files.
|
|
|
38
38
|
## Usage
|
|
39
39
|
|
|
40
40
|
The npm package ships `tree-sitter-xml.wasm` and `tree-sitter-dtd.wasm` for
|
|
41
|
-
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter) version
|
|
41
|
+
[@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.
|
|
42
42
|
In Node.js and Bun, load the grammar from its path:
|
|
43
43
|
|
|
44
44
|
```js
|
|
45
45
|
import { fileURLToPath } from 'node:url';
|
|
46
|
+
|
|
46
47
|
import { Language, Parser } from '@willbooster/web-tree-sitter';
|
|
47
48
|
|
|
48
49
|
await Parser.init();
|
|
@@ -55,9 +56,9 @@ const tree = parser.parse('<?xml version="1.0"?>\n<note><to>Tove</to></note>\n')
|
|
|
55
56
|
In browsers, serve both `.wasm` files and load them by URL (the example uses Vite's `?url` imports):
|
|
56
57
|
|
|
57
58
|
```js
|
|
59
|
+
import xmlUrl from '@willbooster/tree-sitter-xml/tree-sitter-xml.wasm?url';
|
|
58
60
|
import { Language, Parser } from '@willbooster/web-tree-sitter';
|
|
59
61
|
import runtimeUrl from '@willbooster/web-tree-sitter/web-tree-sitter.wasm?url';
|
|
60
|
-
import xmlUrl from '@willbooster/tree-sitter-xml/tree-sitter-xml.wasm?url';
|
|
61
62
|
|
|
62
63
|
await Parser.init({ locateFile: () => runtimeUrl });
|
|
63
64
|
const parser = new Parser();
|
|
@@ -68,9 +69,9 @@ Cloudflare Workers do not allow compiling Wasm at run time, so import both `.was
|
|
|
68
69
|
Node.js compatibility:
|
|
69
70
|
|
|
70
71
|
```js
|
|
72
|
+
import xml from '@willbooster/tree-sitter-xml/tree-sitter-xml.wasm';
|
|
71
73
|
import { Language, Parser } from '@willbooster/web-tree-sitter';
|
|
72
74
|
import runtime from '@willbooster/web-tree-sitter/web-tree-sitter.wasm';
|
|
73
|
-
import xml from '@willbooster/tree-sitter-xml/tree-sitter-xml.wasm';
|
|
74
75
|
|
|
75
76
|
await Parser.init({ wasmModule: runtime });
|
|
76
77
|
const parser = new Parser();
|
|
@@ -87,8 +88,8 @@ fuzzed with:
|
|
|
87
88
|
|
|
88
89
|
```toml
|
|
89
90
|
[dependencies]
|
|
90
|
-
tree-sitter = { package = "willbooster-tree-sitter", version = "
|
|
91
|
-
tree-sitter-xml = { package = "willbooster-tree-sitter-xml", version = "
|
|
91
|
+
tree-sitter = { package = "willbooster-tree-sitter", version = "13.0.0" }
|
|
92
|
+
tree-sitter-xml = { package = "willbooster-tree-sitter-xml", version = "4" }
|
|
92
93
|
```
|
|
93
94
|
|
|
94
95
|
```rust
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-xml",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "XML & DTD grammars for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
|
+
"dtd",
|
|
6
7
|
"incremental",
|
|
7
8
|
"parsing",
|
|
8
9
|
"tree-sitter",
|
|
9
|
-
"xml"
|
|
10
|
-
"dtd"
|
|
10
|
+
"xml"
|
|
11
11
|
],
|
|
12
|
+
"license": "MIT",
|
|
13
|
+
"author": "WillBooster Inc.",
|
|
12
14
|
"repository": {
|
|
13
15
|
"type": "git",
|
|
14
16
|
"url": "git+https://github.com/WillBooster/tree-sitter-xml.git"
|
|
15
17
|
},
|
|
16
|
-
"license": "MIT",
|
|
17
|
-
"author": "WillBooster Inc.",
|
|
18
18
|
"files": [
|
|
19
19
|
"common/common.mjs",
|
|
20
20
|
"xml/grammar.js",
|
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
"tree-sitter.json",
|
|
28
28
|
"*.wasm"
|
|
29
29
|
],
|
|
30
|
+
"publishConfig": {
|
|
31
|
+
"access": "public",
|
|
32
|
+
"registry": "https://registry.npmjs.org/"
|
|
33
|
+
},
|
|
30
34
|
"scripts": {
|
|
31
35
|
"build-wasm": "script/generate --build-wasm",
|
|
32
36
|
"build/ci": "bun run build-wasm",
|
|
@@ -49,32 +53,25 @@
|
|
|
49
53
|
"devDependencies": {
|
|
50
54
|
"@tsconfig/bun": "1.0.11",
|
|
51
55
|
"@types/bun": "1.4.3",
|
|
52
|
-
"@vitest/browser-playwright": "5.0.
|
|
53
|
-
"@willbooster/
|
|
54
|
-
"@willbooster/
|
|
55
|
-
"@willbooster/
|
|
56
|
-
"
|
|
57
|
-
"conventional-changelog-conventionalcommits": "10.4.0",
|
|
56
|
+
"@vitest/browser-playwright": "5.0.5",
|
|
57
|
+
"@willbooster/oxlint-config": "1.4.9",
|
|
58
|
+
"@willbooster/wb": "22.29.3",
|
|
59
|
+
"@willbooster/web-tree-sitter": "13.0.0",
|
|
60
|
+
"conventional-changelog-conventionalcommits": "10.4.1",
|
|
58
61
|
"lefthook": "2.2.2",
|
|
59
|
-
"oxfmt": "0.73.0",
|
|
60
62
|
"oxlint": "1.88.0",
|
|
61
63
|
"oxlint-tsgolint": "7.0.2004",
|
|
62
|
-
"playwright": "1.
|
|
64
|
+
"playwright": "1.64.1",
|
|
63
65
|
"semantic-release": "25.0.9",
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"wrangler": "4.147.0"
|
|
66
|
+
"vitest": "5.0.5",
|
|
67
|
+
"wrangler": "4.151.1"
|
|
67
68
|
},
|
|
68
69
|
"peerDependencies": {
|
|
69
|
-
"@willbooster/web-tree-sitter": "^
|
|
70
|
+
"@willbooster/web-tree-sitter": "^13.0.0"
|
|
70
71
|
},
|
|
71
72
|
"peerDependenciesMeta": {
|
|
72
73
|
"@willbooster/web-tree-sitter": {
|
|
73
74
|
"optional": true
|
|
74
75
|
}
|
|
75
|
-
},
|
|
76
|
-
"publishConfig": {
|
|
77
|
-
"access": "public",
|
|
78
|
-
"registry": "https://registry.npmjs.org/"
|
|
79
76
|
}
|
|
80
77
|
}
|
package/tree-sitter-dtd.wasm
CHANGED
|
Binary file
|
package/tree-sitter-xml.wasm
CHANGED
|
Binary file
|