@willbooster/tree-sitter-cpp 18.0.0 → 20.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-cpp.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-cpp/actions/workflows/test.yml)
|
|
6
6
|
[](https://github.com/WillBooster/tree-sitter-cpp/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-cpp)
|
|
10
10
|
|
|
11
11
|
C++ grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter), forked from
|
|
@@ -42,8 +42,8 @@ the compiler's interpretation.
|
|
|
42
42
|
|
|
43
43
|
The npm package ships `tree-sitter-cpp.wasm` for
|
|
44
44
|
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter), which runs in Node.js, Bun,
|
|
45
|
-
browsers, and Cloudflare Workers. Use runtime version
|
|
46
|
-
WillBooster/tree-sitter ABI `
|
|
45
|
+
browsers, and Cloudflare Workers. Use runtime version 15.0.0 or later within major version 15. The parser uses the
|
|
46
|
+
WillBooster/tree-sitter ABI `0x5742000b`; upgrade the grammar and runtime together. Install both:
|
|
47
47
|
|
|
48
48
|
```sh
|
|
49
49
|
npm install @willbooster/tree-sitter-cpp @willbooster/web-tree-sitter
|
|
@@ -53,6 +53,7 @@ In Node.js and Bun, load the `.wasm` file from its path:
|
|
|
53
53
|
|
|
54
54
|
```js
|
|
55
55
|
import { fileURLToPath } from 'node:url';
|
|
56
|
+
|
|
56
57
|
import { Language, Parser } from '@willbooster/web-tree-sitter';
|
|
57
58
|
|
|
58
59
|
await Parser.init();
|
|
@@ -65,9 +66,9 @@ const tree = parser.parse('int main() {}\n');
|
|
|
65
66
|
In browsers, serve both `.wasm` files and load them by URL. With Vite:
|
|
66
67
|
|
|
67
68
|
```js
|
|
69
|
+
import cppUrl from '@willbooster/tree-sitter-cpp/tree-sitter-cpp.wasm?url';
|
|
68
70
|
import { Language, Parser } from '@willbooster/web-tree-sitter';
|
|
69
71
|
import runtimeUrl from '@willbooster/web-tree-sitter/web-tree-sitter.wasm?url';
|
|
70
|
-
import cppUrl from '@willbooster/tree-sitter-cpp/tree-sitter-cpp.wasm?url';
|
|
71
72
|
|
|
72
73
|
await Parser.init({ locateFile: () => runtimeUrl });
|
|
73
74
|
const parser = new Parser();
|
|
@@ -77,9 +78,9 @@ parser.setLanguage(await Language.load(cppUrl));
|
|
|
77
78
|
In Cloudflare Workers, which do not allow compiling Wasm at run time, import both `.wasm` files as modules:
|
|
78
79
|
|
|
79
80
|
```js
|
|
81
|
+
import cpp from '@willbooster/tree-sitter-cpp/tree-sitter-cpp.wasm';
|
|
80
82
|
import { Language, Parser } from '@willbooster/web-tree-sitter';
|
|
81
83
|
import runtime from '@willbooster/web-tree-sitter/web-tree-sitter.wasm';
|
|
82
|
-
import cpp from '@willbooster/tree-sitter-cpp/tree-sitter-cpp.wasm';
|
|
83
84
|
|
|
84
85
|
await Parser.init({ wasmModule: runtime });
|
|
85
86
|
const parser = new Parser();
|
|
@@ -91,10 +92,10 @@ grammar's in `queries/` and, in `queries/c/`, the highlights of the C grammar it
|
|
|
91
92
|
|
|
92
93
|
In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-cpp) and on
|
|
93
94
|
[willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter), the runtime this package is tested and
|
|
94
|
-
fuzzed with. Use runtime version
|
|
95
|
+
fuzzed with. Use runtime version 15.0.0 or later within major version 15:
|
|
95
96
|
|
|
96
97
|
```sh
|
|
97
|
-
cargo add --rename tree-sitter willbooster-tree-sitter@
|
|
98
|
+
cargo add --rename tree-sitter willbooster-tree-sitter@15.0.0
|
|
98
99
|
cargo add --rename tree-sitter-cpp willbooster-tree-sitter-cpp
|
|
99
100
|
```
|
|
100
101
|
|
package/package.json
CHANGED
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-cpp",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "20.0.0",
|
|
4
4
|
"description": "C++ grammar for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
|
+
"cpp",
|
|
6
7
|
"incremental",
|
|
7
8
|
"parsing",
|
|
8
|
-
"tree-sitter"
|
|
9
|
-
"cpp"
|
|
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-cpp.git"
|
|
14
16
|
},
|
|
15
|
-
"license": "MIT",
|
|
16
|
-
"author": "WillBooster Inc.",
|
|
17
17
|
"files": [
|
|
18
18
|
"queries/**/*.scm",
|
|
19
19
|
"tree-sitter.json",
|
|
20
20
|
"src/node-types.json",
|
|
21
21
|
"*.wasm"
|
|
22
22
|
],
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public",
|
|
25
|
+
"registry": "https://registry.npmjs.org/"
|
|
26
|
+
},
|
|
23
27
|
"scripts": {
|
|
24
28
|
"build-wasm": "script/generate --build-wasm",
|
|
25
29
|
"build/ci": "bun run build-wasm",
|
|
@@ -42,34 +46,27 @@
|
|
|
42
46
|
"devDependencies": {
|
|
43
47
|
"@tsconfig/bun": "1.0.11",
|
|
44
48
|
"@types/bun": "1.4.3",
|
|
45
|
-
"@vitest/browser-playwright": "5.0.
|
|
46
|
-
"@willbooster/
|
|
47
|
-
"@willbooster/oxlint-config": "1.4.8",
|
|
49
|
+
"@vitest/browser-playwright": "5.0.5",
|
|
50
|
+
"@willbooster/oxlint-config": "1.4.9",
|
|
48
51
|
"@willbooster/tree-sitter-c": "9.0.1",
|
|
49
|
-
"@willbooster/wb": "22.
|
|
50
|
-
"@willbooster/web-tree-sitter": "
|
|
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
|
-
"sort-package-json": "4.1.0",
|
|
59
60
|
"vite": "8.3.4",
|
|
60
|
-
"vitest": "5.0.
|
|
61
|
-
"wrangler": "4.
|
|
61
|
+
"vitest": "5.0.5",
|
|
62
|
+
"wrangler": "4.151.1"
|
|
62
63
|
},
|
|
63
64
|
"peerDependencies": {
|
|
64
|
-
"@willbooster/web-tree-sitter": "^
|
|
65
|
+
"@willbooster/web-tree-sitter": "^15.0.0"
|
|
65
66
|
},
|
|
66
67
|
"peerDependenciesMeta": {
|
|
67
68
|
"@willbooster/web-tree-sitter": {
|
|
68
69
|
"optional": true
|
|
69
70
|
}
|
|
70
|
-
},
|
|
71
|
-
"publishConfig": {
|
|
72
|
-
"access": "public",
|
|
73
|
-
"registry": "https://registry.npmjs.org/"
|
|
74
71
|
}
|
|
75
72
|
}
|
package/tree-sitter-cpp.wasm
CHANGED
|
Binary file
|