@mermanjs/tree-sitter-mermaid 0.2.0 → 0.3.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/CMakeLists.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  cmake_minimum_required(VERSION 3.13)
2
2
 
3
3
  project(tree-sitter-mermaid
4
- VERSION "0.2.0"
4
+ VERSION "0.3.1"
5
5
  DESCRIPTION "Tolerant Tree-sitter grammar and editor queries for Mermaid"
6
6
  HOMEPAGE_URL "https://github.com/Latias94/merman"
7
7
  LANGUAGES C)
package/Makefile CHANGED
@@ -5,7 +5,7 @@ endif
5
5
  LANGUAGE_NAME := tree-sitter-mermaid
6
6
  DESCRIPTION := Tolerant Tree-sitter grammar and editor queries for Mermaid
7
7
  HOMEPAGE_URL := https://github.com/Latias94/merman
8
- VERSION := 0.2.0
8
+ VERSION := 0.3.1
9
9
 
10
10
  SRC_DIR := src
11
11
  PARSER := $(SRC_DIR)/parser.c
package/README.md CHANGED
@@ -6,6 +6,9 @@ A tolerant, incremental [Tree-sitter] grammar for Mermaid source. It provides st
6
6
  syntax trees and editor queries for 37 public diagram families: the original 35-family Mermaid
7
7
  11.16.1 syntax baseline, plus Agentflow and Usecase from Mermaid 12.0.0. The ZenUML integration
8
8
  follows ZenUML Core 3.50.1.
9
+ Sequence actor-menu names (`link`, `links`, `properties`, and `details`) also work as message
10
+ endpoints, following the focused Mermaid 12.1.0 lexer fix without changing the other families'
11
+ syntax baseline.
9
12
 
10
13
  Use this package for syntax highlighting, syntax-aware selection, folding, and other editor features
11
14
  that must keep working while a document is incomplete. Use [`@mermanjs/web`] or the Merman Rust
@@ -20,18 +23,18 @@ accept or render the document.
20
23
  | Node.js | [`@mermanjs/tree-sitter-mermaid`] | Native Node binding, TypeScript declarations, queries, and language WASM |
21
24
  | Browser or Worker | [`@mermanjs/tree-sitter-mermaid`] + [`web-tree-sitter`] | Language WASM and portable queries for the generic browser runtime |
22
25
  | Rust | [`tree-sitter-mermaid`] | `LANGUAGE`, `NODE_TYPES`, and the portable queries |
23
- | C/C++ and editors | Repository source, or a matching [GitHub Release] when available | Generated C parser/scanner, public header, Make, CMake, and pkg-config metadata |
26
+ | C/C++ and editors | Repository source, or a matching [GitHub Release] | Generated C parser/scanner, public header, Make, CMake, and pkg-config metadata |
24
27
 
25
28
  The grammar has its own version line, independent of Merman. Its npm and Cargo artifacts share that
26
29
  grammar version, but their registry names differ: the npm package is scoped under `@mermanjs`, while
27
30
  the Rust crate and C library retain the standard `tree-sitter-mermaid` name.
28
31
 
29
- The version-pinned examples below target `0.2.0`, which adds Agentflow and Usecase to the `0.1.0` family catalog. Custom query consumers should review the [migration guide](https://github.com/Latias94/merman/blob/main/distribution/tree-sitter-mermaid/docs/query-migration.md).
32
+ This guide documents `0.3.1`, retaining the Mermaid 12.1 sequence endpoint fix from 0.3.0 and updating the generator/runtime contract. Match the examples to the version installed in your project; earlier versions have their own tagged documentation. Custom query consumers should review the [migration guide](https://github.com/Latias94/merman/blob/main/distribution/tree-sitter-mermaid/docs/query-migration.md).
30
33
 
31
34
  ## Node.js
32
35
 
33
36
  ```console
34
- npm install tree-sitter@0.25.1 @mermanjs/tree-sitter-mermaid@0.2.0
37
+ npm install tree-sitter@0.25.1 @mermanjs/tree-sitter-mermaid@0.3.1
35
38
  ```
36
39
 
37
40
  With npm 12 or later, review and approve the native install scripts, then rebuild:
@@ -68,7 +71,7 @@ import Mermaid from '@mermanjs/tree-sitter-mermaid';
68
71
  ## Browser and Workers
69
72
 
70
73
  ```console
71
- npm install web-tree-sitter@0.27.0 @mermanjs/tree-sitter-mermaid@0.2.0
74
+ npm install web-tree-sitter@0.27.1 @mermanjs/tree-sitter-mermaid@0.3.1
72
75
  ```
73
76
 
74
77
  The package exports `@mermanjs/tree-sitter-mermaid/tree-sitter-mermaid.wasm`. Copy that asset to a
@@ -89,7 +92,7 @@ A no-build browser prototype can pin the exact grammar version on jsDelivr:
89
92
 
90
93
  ```js
91
94
  const language = await Language.load(
92
- 'https://cdn.jsdelivr.net/npm/@mermanjs/tree-sitter-mermaid@0.2.0/tree-sitter-mermaid.wasm',
95
+ 'https://cdn.jsdelivr.net/npm/@mermanjs/tree-sitter-mermaid@0.3.1/tree-sitter-mermaid.wasm',
93
96
  );
94
97
  ```
95
98
 
@@ -101,7 +104,7 @@ diagnostics, completion, navigation, and rename.
101
104
  ## Rust
102
105
 
103
106
  ```console
104
- cargo add tree-sitter@=0.26.12 tree-sitter-mermaid@=0.2.0
107
+ cargo add tree-sitter@=0.27.1 tree-sitter-mermaid@=0.3.1
105
108
  ```
106
109
 
107
110
  ```rust
@@ -143,6 +146,8 @@ int main(void) {
143
146
  }
144
147
  ```
145
148
 
149
+ Version 0.3.1 pairs with Tree-sitter CLI, Rust, and Web runtime 0.27.1; the Rust language adapter uses compatible `^0.1.9`, and the generated language ABI remains 15. See [query migration](docs/query-migration.md) when upgrading queries and the [grammar release guide](../../docs/release/TREE_SITTER_MERMAID.md) when maintaining the package.
150
+
146
151
  ## Compatibility
147
152
 
148
153
  | Contract | Version |
@@ -151,8 +156,10 @@ int main(void) {
151
156
  | Agentflow and Usecase syntax | 12.0.0 |
152
157
  | ZenUML Core syntax baseline | 3.50.1 |
153
158
  | Tree-sitter language ABI | 15 |
154
- | Tested Rust runtime | 0.26.12 |
155
- | Tested Web runtime | 0.27.0 |
159
+ | Generator CLI | 0.27.1 |
160
+ | Rust language crate requirement / audited version | ^0.1.9 / 0.1.9 |
161
+ | Tested Rust runtime | 0.27.1 |
162
+ | Tested Web runtime | 0.27.1 |
156
163
  | Native Node runtime contract | 0.25.x |
157
164
 
158
165
  Before 1.0, a minor release may change named nodes, fields, canonical captures, the language ABI, or
@@ -203,6 +210,18 @@ npm run check:wasm --prefix distribution/tree-sitter-mermaid
203
210
  npm run test:wasm --prefix distribution/tree-sitter-mermaid
204
211
  ```
205
212
 
213
+ Regenerate both parser sources and language WASM after changing the version in `tree-sitter.json`:
214
+ the pinned generator embeds that version in `TSLanguage.metadata`.
215
+
216
+ `metadata/provenance.json` pins the [WASI SDK 34 release](https://github.com/WebAssembly/wasi-sdk/releases/tag/wasi-sdk-34)
217
+ and its LLVM commit. The official Windows compiler reports `23.1.0-rc3`; Linux and macOS report
218
+ `23.1.0-wasi-sdk` because the [SDK build configuration](https://github.com/WebAssembly/wasi-sdk/blob/wasi-sdk-34/cmake/wasi-sdk-toolchain.cmake#L81-L91)
219
+ overrides `LLVM_VERSION_SUFFIX` only outside Windows. Generation verifies the SDK's `VERSION`
220
+ and the exact host-specific compiler banner, including the LLVM commit. `-fno-ident` prevents
221
+ that banner from entering the WASM producers section; `--no-wasm-opt` excludes unpinned optimizers.
222
+ Freshness checks compare complete source and WASM bytes without normalization or host-specific
223
+ artifact hashes.
224
+
206
225
  See the [development guide] and [release guide] for grammar ownership, generation, testing, and
207
226
  publication details.
208
227
 
@@ -4,11 +4,18 @@ This source distribution derives syntax behavior or compatibility evidence from
4
4
  MIT-licensed projects. The corresponding license texts are included below
5
5
  `THIRD_PARTY_LICENSES/`.
6
6
 
7
- ## Tree-sitter 0.26.12
7
+ ## Tree-sitter 0.27.0 (generator and support headers)
8
+
9
+ - Source: https://github.com/tree-sitter/tree-sitter.git
10
+ - Commit: `6070dbfefd326bd735e5683eb128cc1b57dad0c0`
11
+ - Use: pinned generator and copied generated support headers
12
+ - License: `THIRD_PARTY_LICENSES/tree-sitter/LICENSE`
13
+
14
+ ## Tree-sitter 0.26.12 (retained implementation templates)
8
15
 
9
16
  - Source: https://github.com/tree-sitter/tree-sitter.git
10
17
  - Commit: `808e4b1fc06e269a107c4bd8bd936cc6fde18b00`
11
- - Use: pinned generator, copied generated support headers, and modified C, Rust, and Node binding templates
18
+ - Use: modified C, Rust, and Node binding templates and WASM build helper retained from the original implementation
12
19
  - License: `THIRD_PARTY_LICENSES/tree-sitter/LICENSE`
13
20
 
14
21
  ## Mermaid 11.16.1
@@ -1,6 +1,8 @@
1
1
  // Source translation: Mermaid 11.16.1
2
2
  // packages/mermaid/src/diagrams/sequence/parser/sequenceDiagram.jison
3
3
  // commit 7ecca0cd7f1658ef74f4e7e91f925724ef403bbf.
4
+ // Actor-menu keyword endpoints also follow Mermaid 12.1.0,
5
+ // commit 21f72f07ea22c0af48a3149c550654e80d8e40cb (same Jison source).
4
6
 
5
7
  const diagramKeyword = ($) => field(
6
8
  'keyword',
@@ -167,6 +169,7 @@ const sequenceRules = {
167
169
 
168
170
  _sequence_actor_identifier: ($) => choice(
169
171
  $._sequence_keyword_prefixed_actor_identifier,
172
+ $._sequence_actor_menu_keyword,
170
173
  token(prec(30, choice(
171
174
  // Reserve `-x` for cross arrows while retaining ordinary hyphenated ids.
172
175
  /[A-Za-z0-9_\u00c0-\uffff](?:[A-Za-z0-9_=.\u00c0-\uffff]|-[A-WYZa-wyz0-9_=.\u00c0-\uffff])*/,
@@ -175,12 +178,17 @@ const sequenceRules = {
175
178
  ))),
176
179
  ),
177
180
 
178
- // Jison only recognizes block keywords at word boundaries. Give a longer
179
- // actor such as `Parser` priority over the shorter `par` token.
180
- _sequence_keyword_prefixed_actor_identifier: (_) => token(prec(
181
- 50,
182
- /(?:loop|rect|opt|alt|else|par_over|par|and|critical|option|break|box|end)(?:[A-Za-z0-9_=.\u00c0-\uffff]|-[A-WYZa-wyz0-9_=.\u00c0-\uffff])(?:[A-Za-z0-9_=.\u00c0-\uffff]|-[A-WYZa-wyz0-9_=.\u00c0-\uffff])*/i,
183
- )),
181
+ // Give longer actor ids priority over shorter keyword tokens. Keep bare
182
+ // `links` out of the `link` prefix branch so it remains a shared menu token.
183
+ _sequence_keyword_prefixed_actor_identifier: (_) => token(prec(50, choice(
184
+ /(?:loop|rect|opt|alt|else|par_over|par|and|critical|option|break|box|end)(?:[A-Za-z0-9_=.\u00c0-\uffff]|-[A-WYZa-wyz0-9_=.\u00c0-\uffff])+/i,
185
+ /(?:links|properties|details)(?:[A-Za-z0-9_=.\u00c0-\uffff]|-[A-WYZa-wyz0-9_=.\u00c0-\uffff])+/i,
186
+ /link(?:[A-RT-Za-rt-z0-9_=.\u00c0-\uffff]|-[A-WYZa-wyz0-9_=.\u00c0-\uffff])(?:[A-Za-z0-9_=.\u00c0-\uffff]|-[A-WYZa-wyz0-9_=.\u00c0-\uffff])*/i,
187
+ ))),
188
+
189
+ // Share the lexical token between metadata and endpoints. The following
190
+ // actor or arrow chooses the statement without consuming an endpoint as a directive.
191
+ _sequence_actor_menu_keyword: (_) => token(prec(40, /(?:links|link|properties|details)/i)),
184
192
 
185
193
  sequence_participant_config: (_) => token(prec(30, /@\{[^}\r\n]*\}/)),
186
194
 
@@ -381,11 +389,9 @@ const sequenceRules = {
381
389
  ),
382
390
 
383
391
  sequence_actor_metadata_statement: ($) => seq(
384
- field('kind', choice(
385
- statementKeyword($, /links/i),
386
- statementKeyword($, /link/i),
387
- statementKeyword($, /properties/i),
388
- statementKeyword($, /details/i),
392
+ field('keyword', alias(
393
+ $._sequence_actor_menu_keyword,
394
+ $.sequence_statement_keyword,
389
395
  )),
390
396
  actorReference($, 'participant'),
391
397
  field('delimiter', ':'),
@@ -513,12 +513,12 @@
513
513
  ],
514
514
  "sources": [
515
515
  {
516
- "sourceId": "tree-sitter",
516
+ "sourceId": "tree-sitter-templates",
517
517
  "relationship": "modified",
518
518
  "sourcePaths": [
519
519
  "crates/cli/src/templates/binding.gyp",
520
- "crates/cli/src/templates/CMakeLists.txt",
521
- "crates/cli/src/templates/Makefile",
520
+ "crates/cli/src/templates/cmakelists.cmake",
521
+ "crates/cli/src/templates/makefile",
522
522
  "crates/cli/src/templates/PARSER_NAME.pc.in",
523
523
  "crates/cli/src/templates/PARSER_NAME.h",
524
524
  "crates/cli/src/templates/js-binding.cc",
@@ -564,7 +564,7 @@
564
564
  ],
565
565
  "sources": [
566
566
  {
567
- "sourceId": "tree-sitter",
567
+ "sourceId": "tree-sitter-templates",
568
568
  "relationship": "modified",
569
569
  "sourcePaths": [
570
570
  "crates/loader/src/loader.rs:1290-1467"
@@ -2,7 +2,7 @@
2
2
  "schemaVersion": 1,
3
3
  "package": {
4
4
  "name": "tree-sitter-mermaid",
5
- "version": "0.2.0",
5
+ "version": "0.3.1",
6
6
  "releaseState": "candidate"
7
7
  },
8
8
  "language": {
@@ -12,12 +12,17 @@
12
12
  "querySchemaVersion": 1
13
13
  },
14
14
  "toolchain": {
15
- "treeSitterCli": "0.26.12",
16
- "rustRuntime": "0.26.12",
15
+ "treeSitterCli": "0.27.1",
16
+ "rustRuntime": "0.27.1",
17
17
  "nodeRuntime": "0.25.1",
18
- "webRuntime": "0.27.0",
19
- "wasiSdk": "29.0",
20
- "wasiClang": "21.1.4-wasi-sdk"
18
+ "webRuntime": "0.27.1",
19
+ "wasiSdk": "34.0",
20
+ "wasiClang": {
21
+ "win32": "23.1.0-rc3",
22
+ "linux": "23.1.0-wasi-sdk",
23
+ "darwin": "23.1.0-wasi-sdk"
24
+ },
25
+ "wasiLlvmCommit": "895aa2c896ada719451be2e3673c83da8ddf1141"
21
26
  },
22
27
  "sources": [
23
28
  {
@@ -30,14 +35,25 @@
30
35
  },
31
36
  {
32
37
  "id": "tree-sitter",
33
- "kind": "generator-and-template-source",
38
+ "kind": "generator-source",
39
+ "version": "0.27.1",
40
+ "repository": "https://github.com/tree-sitter/tree-sitter.git",
41
+ "ref": "v0.27.1",
42
+ "commit": "10eb5ac119eec9cb4267a8e035066473983f5f3a",
43
+ "usage": "Pinned generator and generated support headers",
44
+ "license": "MIT",
45
+ "legalComponentId": "tree-sitter-generator"
46
+ },
47
+ {
48
+ "id": "tree-sitter-templates",
49
+ "kind": "implementation-template-source",
34
50
  "version": "0.26.12",
35
51
  "repository": "https://github.com/tree-sitter/tree-sitter.git",
36
52
  "ref": "v0.26.12",
37
53
  "commit": "808e4b1fc06e269a107c4bd8bd936cc6fde18b00",
38
- "usage": "Pinned generator, generated support headers, and modified C, Rust, and Node binding templates",
54
+ "usage": "Modified C, Rust, and Node binding templates and WASM build helper retained from the original implementation",
39
55
  "license": "MIT",
40
- "legalComponentId": "tree-sitter-generator"
56
+ "legalComponentId": "tree-sitter-templates"
41
57
  },
42
58
  {
43
59
  "id": "mermaid",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mermanjs/tree-sitter-mermaid",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "Tolerant Tree-sitter grammar and editor queries for Mermaid",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -80,15 +80,15 @@
80
80
  "node-gyp-build": "4.8.4"
81
81
  },
82
82
  "devDependencies": {
83
- "node-gyp": "13.0.1",
83
+ "node-gyp": "13.1.0",
84
84
  "prebuildify": "6.0.1",
85
85
  "tree-sitter": "0.25.1",
86
- "tree-sitter-cli": "0.26.12",
87
- "web-tree-sitter": "0.27.0"
86
+ "tree-sitter-cli": "0.27.1",
87
+ "web-tree-sitter": "0.27.1"
88
88
  },
89
89
  "allowScripts": {
90
90
  "tree-sitter@0.25.1": true,
91
- "tree-sitter-cli@0.26.12": true
91
+ "tree-sitter-cli@0.27.1": true
92
92
  },
93
93
  "peerDependencies": {
94
94
  "tree-sitter": "^0.25.0"
package/src/grammar.json CHANGED
@@ -56824,6 +56824,10 @@
56824
56824
  "type": "SYMBOL",
56825
56825
  "name": "_sequence_keyword_prefixed_actor_identifier"
56826
56826
  },
56827
+ {
56828
+ "type": "SYMBOL",
56829
+ "name": "_sequence_actor_menu_keyword"
56830
+ },
56827
56831
  {
56828
56832
  "type": "TOKEN",
56829
56833
  "content": {
@@ -56851,9 +56855,36 @@
56851
56855
  "content": {
56852
56856
  "type": "PREC",
56853
56857
  "value": 50,
56858
+ "content": {
56859
+ "type": "CHOICE",
56860
+ "members": [
56861
+ {
56862
+ "type": "PATTERN",
56863
+ "value": "(?:loop|rect|opt|alt|else|par_over|par|and|critical|option|break|box|end)(?:[A-Za-z0-9_=.\\u00c0-\\uffff]|-[A-WYZa-wyz0-9_=.\\u00c0-\\uffff])+",
56864
+ "flags": "i"
56865
+ },
56866
+ {
56867
+ "type": "PATTERN",
56868
+ "value": "(?:links|properties|details)(?:[A-Za-z0-9_=.\\u00c0-\\uffff]|-[A-WYZa-wyz0-9_=.\\u00c0-\\uffff])+",
56869
+ "flags": "i"
56870
+ },
56871
+ {
56872
+ "type": "PATTERN",
56873
+ "value": "link(?:[A-RT-Za-rt-z0-9_=.\\u00c0-\\uffff]|-[A-WYZa-wyz0-9_=.\\u00c0-\\uffff])(?:[A-Za-z0-9_=.\\u00c0-\\uffff]|-[A-WYZa-wyz0-9_=.\\u00c0-\\uffff])*",
56874
+ "flags": "i"
56875
+ }
56876
+ ]
56877
+ }
56878
+ }
56879
+ },
56880
+ "_sequence_actor_menu_keyword": {
56881
+ "type": "TOKEN",
56882
+ "content": {
56883
+ "type": "PREC",
56884
+ "value": 40,
56854
56885
  "content": {
56855
56886
  "type": "PATTERN",
56856
- "value": "(?:loop|rect|opt|alt|else|par_over|par|and|critical|option|break|box|end)(?:[A-Za-z0-9_=.\\u00c0-\\uffff]|-[A-WYZa-wyz0-9_=.\\u00c0-\\uffff])(?:[A-Za-z0-9_=.\\u00c0-\\uffff]|-[A-WYZa-wyz0-9_=.\\u00c0-\\uffff])*",
56887
+ "value": "(?:links|link|properties|details)",
56857
56888
  "flags": "i"
56858
56889
  }
56859
56890
  }
@@ -58917,95 +58948,15 @@
58917
58948
  "members": [
58918
58949
  {
58919
58950
  "type": "FIELD",
58920
- "name": "kind",
58951
+ "name": "keyword",
58921
58952
  "content": {
58922
- "type": "CHOICE",
58923
- "members": [
58924
- {
58925
- "type": "FIELD",
58926
- "name": "keyword",
58927
- "content": {
58928
- "type": "ALIAS",
58929
- "content": {
58930
- "type": "TOKEN",
58931
- "content": {
58932
- "type": "PREC",
58933
- "value": 40,
58934
- "content": {
58935
- "type": "PATTERN",
58936
- "value": "links",
58937
- "flags": "i"
58938
- }
58939
- }
58940
- },
58941
- "named": true,
58942
- "value": "sequence_statement_keyword"
58943
- }
58944
- },
58945
- {
58946
- "type": "FIELD",
58947
- "name": "keyword",
58948
- "content": {
58949
- "type": "ALIAS",
58950
- "content": {
58951
- "type": "TOKEN",
58952
- "content": {
58953
- "type": "PREC",
58954
- "value": 40,
58955
- "content": {
58956
- "type": "PATTERN",
58957
- "value": "link",
58958
- "flags": "i"
58959
- }
58960
- }
58961
- },
58962
- "named": true,
58963
- "value": "sequence_statement_keyword"
58964
- }
58965
- },
58966
- {
58967
- "type": "FIELD",
58968
- "name": "keyword",
58969
- "content": {
58970
- "type": "ALIAS",
58971
- "content": {
58972
- "type": "TOKEN",
58973
- "content": {
58974
- "type": "PREC",
58975
- "value": 40,
58976
- "content": {
58977
- "type": "PATTERN",
58978
- "value": "properties",
58979
- "flags": "i"
58980
- }
58981
- }
58982
- },
58983
- "named": true,
58984
- "value": "sequence_statement_keyword"
58985
- }
58986
- },
58987
- {
58988
- "type": "FIELD",
58989
- "name": "keyword",
58990
- "content": {
58991
- "type": "ALIAS",
58992
- "content": {
58993
- "type": "TOKEN",
58994
- "content": {
58995
- "type": "PREC",
58996
- "value": 40,
58997
- "content": {
58998
- "type": "PATTERN",
58999
- "value": "details",
59000
- "flags": "i"
59001
- }
59002
- }
59003
- },
59004
- "named": true,
59005
- "value": "sequence_statement_keyword"
59006
- }
59007
- }
59008
- ]
58953
+ "type": "ALIAS",
58954
+ "content": {
58955
+ "type": "SYMBOL",
58956
+ "name": "_sequence_actor_menu_keyword"
58957
+ },
58958
+ "named": true,
58959
+ "value": "sequence_statement_keyword"
59009
58960
  }
59010
58961
  },
59011
58962
  {