@willbooster/tree-sitter-embedded-template 11.0.0 → 12.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 +5 -6
- package/grammar.js +3 -3
- package/package.json +9 -9
- package/tree-sitter-embedded_template.wasm +0 -0
- package/tree-sitter.json +1 -1
package/README.md
CHANGED
|
@@ -16,10 +16,10 @@ It parses templating languages such as ERB and EJS, in which scripting code is e
|
|
|
16
16
|
`<%` and `%>`. This fork extends upstream's version 0.25.0 grammar with EJS output-tag whitespace slurping,
|
|
17
17
|
trimming closers on comments, and the `=%>` closer on statements.
|
|
18
18
|
It generates the parser with the
|
|
19
|
-
[WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter) generator (ABI `
|
|
19
|
+
[WillBooster/tree-sitter](https://github.com/WillBooster/tree-sitter) generator (ABI `0x5742000d`). The parser loads only
|
|
20
20
|
with that fork's runtime ([willbooster-tree-sitter](https://crates.io/crates/willbooster-tree-sitter),
|
|
21
21
|
[@willbooster/web-tree-sitter](https://www.npmjs.com/package/@willbooster/web-tree-sitter)); upstream's runtime rejects it.
|
|
22
|
-
This package targets and is tested with version
|
|
22
|
+
This package targets and is tested with version 23.0.0 or later in the 23.x series.
|
|
23
23
|
|
|
24
24
|
## Support Scope
|
|
25
25
|
|
|
@@ -31,7 +31,7 @@ may change; such changes are released as new major versions.
|
|
|
31
31
|
## Usage
|
|
32
32
|
|
|
33
33
|
The npm package ships `tree-sitter-embedded_template.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 23.0.0 or later in the 23.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
|
|
@@ -80,7 +80,7 @@ In Rust, depend on the [crate](https://crates.io/crates/willbooster-tree-sitter-
|
|
|
80
80
|
fuzzed with:
|
|
81
81
|
|
|
82
82
|
```sh
|
|
83
|
-
cargo add willbooster-tree-sitter@
|
|
83
|
+
cargo add willbooster-tree-sitter@23.0.0 --rename tree-sitter
|
|
84
84
|
cargo add willbooster-tree-sitter-embedded-template --rename tree-sitter-embedded-template
|
|
85
85
|
```
|
|
86
86
|
|
|
@@ -122,8 +122,7 @@ and the release build regenerate the parsers before compiling them.
|
|
|
122
122
|
`script/parse-examples`. After a grammar change or a moved pin alters that list, `script/parse-examples` rewrites it;
|
|
123
123
|
review its diff before committing;
|
|
124
124
|
- performance checks (`test/unit/performance.test.ts`) that templates ending in an unclosed directive or containing
|
|
125
|
-
long runs of delimiter prefix characters parse in linear time
|
|
126
|
-
token marking outside the per-byte loop. It loads the Wasm build through
|
|
125
|
+
long runs of delimiter prefix characters parse in linear time. It loads the Wasm build through
|
|
127
126
|
@willbooster/web-tree-sitter, which `bun run build/ci` rebuilds after regenerating the parser;
|
|
128
127
|
- a check (`test/unit/runtimeVersion.test.ts`) that `@willbooster/web-tree-sitter` in `package.json` and
|
|
129
128
|
`willbooster-tree-sitter` in `Cargo.lock` are the same version, since the Wasm tests run on the former and the Rust
|
package/grammar.js
CHANGED
|
@@ -21,9 +21,9 @@ module.exports = grammar({
|
|
|
21
21
|
$.content,
|
|
22
22
|
)),
|
|
23
23
|
|
|
24
|
-
// Keep pure `[^%=_-]+` and `[^<]*` tails outside any outer `(...)+` so
|
|
25
|
-
//
|
|
26
|
-
// and `<`) so fallback before `%>`, `<%`, or EOF stays linear.
|
|
24
|
+
// Keep pure `[^%=_-]+` and `[^<]*` tails outside any outer `(...)+` so their DFA states stay self-loops in
|
|
25
|
+
// `ts_lex_table` (allowing the runtime lexer to scan runs before recording acceptance), and bound delimiter
|
|
26
|
+
// prefixes (`[=_-]{1,3}` and `<`) so fallback before `%>`, `<%`, or EOF stays linear.
|
|
27
27
|
code: _ => repeat1(choice(/[^%=_-]+|[=_-]{1,3}[^%=_-]+|%[^>%=_-][^%=_-]*|[%=_-]/, '%%>')),
|
|
28
28
|
|
|
29
29
|
content: _ => prec.right(repeat1(choice(/[^<]+|<([^<%][^<]*)?/, '<%%'))),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@willbooster/tree-sitter-embedded-template",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.1",
|
|
4
4
|
"description": "Embedded template (ERB, EJS) grammar for tree-sitter",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"embedded-template",
|
|
@@ -45,21 +45,21 @@
|
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@tsconfig/bun": "1.0.11",
|
|
47
47
|
"@types/bun": "1.4.4",
|
|
48
|
-
"@vitest/browser-playwright": "5.0
|
|
48
|
+
"@vitest/browser-playwright": "5.1.0",
|
|
49
49
|
"@willbooster/oxlint-config": "1.4.9",
|
|
50
|
-
"@willbooster/wb": "23.3.
|
|
51
|
-
"@willbooster/web-tree-sitter": "
|
|
50
|
+
"@willbooster/wb": "23.3.4",
|
|
51
|
+
"@willbooster/web-tree-sitter": "23.0.0",
|
|
52
52
|
"conventional-changelog-conventionalcommits": "10.4.1",
|
|
53
53
|
"lefthook": "2.2.2",
|
|
54
|
-
"oxlint": "1.
|
|
55
|
-
"oxlint-tsgolint": "7.0.
|
|
56
|
-
"playwright": "1.
|
|
54
|
+
"oxlint": "1.92.0",
|
|
55
|
+
"oxlint-tsgolint": "7.0.2006",
|
|
56
|
+
"playwright": "1.65.0",
|
|
57
57
|
"semantic-release": "25.0.9",
|
|
58
|
-
"vitest": "5.0
|
|
58
|
+
"vitest": "5.1.0",
|
|
59
59
|
"wrangler": "4.156.0"
|
|
60
60
|
},
|
|
61
61
|
"peerDependencies": {
|
|
62
|
-
"@willbooster/web-tree-sitter": "^
|
|
62
|
+
"@willbooster/web-tree-sitter": "^23.0.0"
|
|
63
63
|
},
|
|
64
64
|
"peerDependenciesMeta": {
|
|
65
65
|
"@willbooster/web-tree-sitter": {
|
|
Binary file
|