state-machine-cat 9.2.4 → 10.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/LICENSE +1 -1
- package/dist/commonjs/bundle.js +66 -66
- package/package.json +329 -71
- package/src/cli/actions.mjs +1 -1
- package/src/cli/attributes-parser.mjs +17 -14
- package/src/index.mjs +2 -1
- package/src/options.mjs +2 -7
- package/src/parse/scxml/index.mjs +5 -6
- package/src/parse/scxml/normalize-machine.mjs +5 -6
- package/src/parse/smcat/smcat-parser.mjs +182 -145
- package/src/render/dot/index.mjs +2 -2
- package/src/render/dot/state-transformers.mjs +3 -5
- package/src/render/index-node.mjs +1 -1
- package/src/render/index.mjs +1 -1
- package/src/render/smcat/index.js +3 -3
- package/src/transform/desugar.mjs +6 -6
- package/src/version.mjs +1 -1
- package/types/state-machine-cat.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "state-machine-cat",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.1",
|
|
4
4
|
"description": "write beautiful state charts",
|
|
5
5
|
"main": "./dist/commonjs/index.js",
|
|
6
6
|
"module": "./src/index.mjs",
|
|
@@ -23,35 +23,34 @@
|
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "make clean dist pages",
|
|
25
25
|
"build:cli": "make cli-build",
|
|
26
|
-
"check": "
|
|
27
|
-
"
|
|
28
|
-
"depcruise
|
|
29
|
-
"depcruise:
|
|
30
|
-
"depcruise:graph
|
|
31
|
-
"depcruise:graph:doc:
|
|
32
|
-
"depcruise:graph:doc:
|
|
33
|
-
"depcruise:graph:doc:deps-html": "
|
|
34
|
-
"depcruise:graph:doc:deps-svg": "
|
|
35
|
-
"depcruise:graph:doc:flat-
|
|
36
|
-
"depcruise:graph:doc:flat-
|
|
37
|
-
"depcruise:
|
|
38
|
-
"depcruise:graph:
|
|
39
|
-
"depcruise:graph:
|
|
40
|
-
"depcruise:
|
|
41
|
-
"depcruise:
|
|
42
|
-
"depcruise:
|
|
43
|
-
"depcruise:
|
|
44
|
-
"
|
|
45
|
-
"lint
|
|
46
|
-
"lint:
|
|
47
|
-
"lint:
|
|
48
|
-
"lint:types": "
|
|
49
|
-
"lint:types:
|
|
50
|
-
"lint:
|
|
51
|
-
"lint:fix
|
|
52
|
-
"lint:fix:
|
|
53
|
-
"lint:fix:
|
|
54
|
-
"lint:fix:types": "eslint --fix types",
|
|
26
|
+
"check": "wireit",
|
|
27
|
+
"cachefolder": "wireit",
|
|
28
|
+
"depcruise": "wireit",
|
|
29
|
+
"depcruise:json": "wireit",
|
|
30
|
+
"depcruise:graph": "wireit",
|
|
31
|
+
"depcruise:graph:doc:archi-html": "wireit",
|
|
32
|
+
"depcruise:graph:doc:archi-svg": "wireit",
|
|
33
|
+
"depcruise:graph:doc:deps-html": "wireit",
|
|
34
|
+
"depcruise:graph:doc:deps-svg": "wireit",
|
|
35
|
+
"depcruise:graph:doc:flat-deps-html": "wireit",
|
|
36
|
+
"depcruise:graph:doc:flat-deps-svg": "wireit",
|
|
37
|
+
"depcruise:html-report": "wireit",
|
|
38
|
+
"depcruise:graph:dev": "wireit",
|
|
39
|
+
"depcruise:graph:dev:flat": "wireit",
|
|
40
|
+
"depcruise:view-report": "wireit",
|
|
41
|
+
"depcruise:github-actions:markdown": "wireit",
|
|
42
|
+
"depcruise:github-actions:mermaid": "wireit",
|
|
43
|
+
"depcruise:github-actions:mermaid:diff": "wireit",
|
|
44
|
+
"lint": "wireit",
|
|
45
|
+
"lint:eslint": "wireit",
|
|
46
|
+
"lint:prettier": "wireit",
|
|
47
|
+
"lint:types": "wireit",
|
|
48
|
+
"lint:types:tsc": "wireit",
|
|
49
|
+
"lint:types:eslint": "wireit",
|
|
50
|
+
"lint:fix": "wireit",
|
|
51
|
+
"lint:fix:eslint": "wireit",
|
|
52
|
+
"lint:fix:prettier": "wireit",
|
|
53
|
+
"lint:fix:types": "wireit",
|
|
55
54
|
"scm:push": "run-p --aggregate-output scm:push:*",
|
|
56
55
|
"scm:push:github": "run-p --aggregate-output scm:push:github:*",
|
|
57
56
|
"scm:push:github:commits": "git push",
|
|
@@ -63,10 +62,8 @@
|
|
|
63
62
|
"scm:push:bitbucket-mirror:commits": "git push bitbucket-mirror",
|
|
64
63
|
"scm:push:bitbucket-mirror:tags": "git push --tags bitbucket-mirror",
|
|
65
64
|
"scm:stage": "git add .",
|
|
66
|
-
"test": "
|
|
67
|
-
"test:
|
|
68
|
-
"test:integration": "mocha --reporter spec --timeout 4000 --recursive test --invert --fgrep integration",
|
|
69
|
-
"test:cover": "c8 --all --check-coverage --statements 100 --branches 99.1 --functions 100 --lines 100 --exclude \"{bin/*,config/**/*,coverage/**/*,docs/**/*,public/**/*,test/**/*,tools/**/*,types/**/*,dist/commonjs/*,src/**/*{template,-parser}.{mjs,cjs,js},tmp*}\" --reporter text-summary --reporter html --reporter lcov npm test",
|
|
65
|
+
"test": "wireit",
|
|
66
|
+
"test:cover": "wireit",
|
|
70
67
|
"update-dependencies": "run-s upem:update upem:install lint:fix check",
|
|
71
68
|
"upem:install": "npm install",
|
|
72
69
|
"upem:update": "npm outdated --json | upem",
|
|
@@ -85,16 +82,6 @@
|
|
|
85
82
|
],
|
|
86
83
|
"upem": {
|
|
87
84
|
"policies": [
|
|
88
|
-
{
|
|
89
|
-
"package": "eslint",
|
|
90
|
-
"policy": "wanted",
|
|
91
|
-
"because": "some plugins are not compatible with eslint 8 yet"
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
"package": "eslint-plugin-unicorn",
|
|
95
|
-
"policy": "wanted",
|
|
96
|
-
"because": ">=41 aren't compatible with eslint 7 anymore"
|
|
97
|
-
},
|
|
98
85
|
{
|
|
99
86
|
"package": "fast-xml-parser",
|
|
100
87
|
"policy": "wanted",
|
|
@@ -112,6 +99,279 @@
|
|
|
112
99
|
}
|
|
113
100
|
]
|
|
114
101
|
},
|
|
102
|
+
"wireit": {
|
|
103
|
+
"check": {
|
|
104
|
+
"dependencies": [
|
|
105
|
+
"depcruise",
|
|
106
|
+
"lint",
|
|
107
|
+
"test:cover"
|
|
108
|
+
]
|
|
109
|
+
},
|
|
110
|
+
"cachefolder": {
|
|
111
|
+
"command": "mkdir -p node_modules/.cache",
|
|
112
|
+
"clean": false,
|
|
113
|
+
"files": [],
|
|
114
|
+
"output": [
|
|
115
|
+
"node_modules/.cache"
|
|
116
|
+
],
|
|
117
|
+
"packageLocks": []
|
|
118
|
+
},
|
|
119
|
+
"depcruise:json": {
|
|
120
|
+
"command": "dependency-cruise --progress none --output-type json --output-to node_modules/.cache/depcruise-cache.json --config config/dependency-cruiser.js src test bin",
|
|
121
|
+
"files": [
|
|
122
|
+
"src/**/*",
|
|
123
|
+
"test/**/*",
|
|
124
|
+
"bin/**/*",
|
|
125
|
+
"config/dependency-cruiser.js"
|
|
126
|
+
],
|
|
127
|
+
"dependencies": [
|
|
128
|
+
"cachefolder"
|
|
129
|
+
],
|
|
130
|
+
"clean": true,
|
|
131
|
+
"output": [
|
|
132
|
+
"node_modules/.cache/depcruise-cache.json"
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
"depcruise": {
|
|
136
|
+
"command": "depcruise-fmt node_modules/.cache/depcruise-cache.json --output-type err-long",
|
|
137
|
+
"files": [
|
|
138
|
+
"node_modules/.cache/depcruise-cache.json"
|
|
139
|
+
],
|
|
140
|
+
"dependencies": [
|
|
141
|
+
"depcruise:json"
|
|
142
|
+
],
|
|
143
|
+
"output": []
|
|
144
|
+
},
|
|
145
|
+
"depcruise:html-report": {
|
|
146
|
+
"command": "depcruise-fmt node_modules/.cache/depcruise-cache.json --output-type err-html --output-to dependency-violation-report.html",
|
|
147
|
+
"files": [
|
|
148
|
+
"node_modules/.cache/depcruise-cache.json"
|
|
149
|
+
],
|
|
150
|
+
"dependencies": [
|
|
151
|
+
"depcruise:json"
|
|
152
|
+
],
|
|
153
|
+
"clean": false,
|
|
154
|
+
"output": [
|
|
155
|
+
"dependency-violation-report.html"
|
|
156
|
+
]
|
|
157
|
+
},
|
|
158
|
+
"depcruise:graph:doc:deps-svg": {
|
|
159
|
+
"command": "depcruise-fmt node_modules/.cache/depcruise-cache.json --include-only '^(bin|src|package\\.json)' --output-type dot | dot -T svg -o docs/dependency-cruiser-graph.svg",
|
|
160
|
+
"files": [
|
|
161
|
+
"node_modules/.cache/depcruise-cache.json"
|
|
162
|
+
],
|
|
163
|
+
"dependencies": [
|
|
164
|
+
"depcruise:json"
|
|
165
|
+
],
|
|
166
|
+
"clean": false,
|
|
167
|
+
"output": [
|
|
168
|
+
"docs/dependency-cruiser-graph.svg"
|
|
169
|
+
]
|
|
170
|
+
},
|
|
171
|
+
"depcruise:graph:doc:deps-html": {
|
|
172
|
+
"command": "depcruise-wrap-stream-in-html < docs/dependency-cruiser-graph.svg > docs/dependency-cruiser-graph.html",
|
|
173
|
+
"files": [
|
|
174
|
+
"node_modules/.cache/depcruise-cache.json"
|
|
175
|
+
],
|
|
176
|
+
"dependencies": [
|
|
177
|
+
"depcruise:graph:doc:deps-svg"
|
|
178
|
+
],
|
|
179
|
+
"clean": false,
|
|
180
|
+
"output": [
|
|
181
|
+
"docs/dependency-cruiser-graph.html"
|
|
182
|
+
]
|
|
183
|
+
},
|
|
184
|
+
"depcruise:graph:doc:flat-deps-svg": {
|
|
185
|
+
"command": "depcruise-fmt node_modules/.cache/depcruise-cache.json --include-only '^(bin|src|package\\.json)' --output-type flat | dot -T svg -o docs/dependency-cruiser-graph-flat-dot.svg",
|
|
186
|
+
"files": [
|
|
187
|
+
"node_modules/.cache/depcruise-cache.json"
|
|
188
|
+
],
|
|
189
|
+
"dependencies": [
|
|
190
|
+
"depcruise:json"
|
|
191
|
+
],
|
|
192
|
+
"clean": false,
|
|
193
|
+
"output": [
|
|
194
|
+
"docs/dependency-cruiser-graph-flat-dot.svg"
|
|
195
|
+
]
|
|
196
|
+
},
|
|
197
|
+
"depcruise:graph:doc:flat-deps-html": {
|
|
198
|
+
"command": "depcruise-wrap-stream-in-html < docs/dependency-cruiser-graph-flat-dot.svg > docs/dependency-cruiser-graph-flat-dot.html",
|
|
199
|
+
"files": [
|
|
200
|
+
"node_modules/.cache/depcruise-cache.json"
|
|
201
|
+
],
|
|
202
|
+
"dependencies": [
|
|
203
|
+
"depcruise:graph:doc:flat-deps-svg"
|
|
204
|
+
],
|
|
205
|
+
"clean": false,
|
|
206
|
+
"output": [
|
|
207
|
+
"docs/dependency-cruiser-graph-flat-dot.html"
|
|
208
|
+
]
|
|
209
|
+
},
|
|
210
|
+
"depcruise:graph:doc:archi-svg": {
|
|
211
|
+
"command": "depcruise-fmt node_modules/.cache/depcruise-cache.json --include-only '^(bin|src|package\\.json)' --output-type archi | dot -T svg -o docs/dependency-cruiser-archi-graph.svg",
|
|
212
|
+
"files": [
|
|
213
|
+
"node_modules/.cache/depcruise-cache.json"
|
|
214
|
+
],
|
|
215
|
+
"dependencies": [
|
|
216
|
+
"depcruise:json"
|
|
217
|
+
],
|
|
218
|
+
"clean": false,
|
|
219
|
+
"output": [
|
|
220
|
+
"docs/dependency-cruiser-archi-graph.svg"
|
|
221
|
+
]
|
|
222
|
+
},
|
|
223
|
+
"depcruise:graph:doc:archi-html": {
|
|
224
|
+
"command": "depcruise-wrap-stream-in-html < docs/dependency-cruiser-archi-graph.svg > docs/dependency-cruiser-archi-graph.html",
|
|
225
|
+
"files": [
|
|
226
|
+
"node_modules/.cache/depcruise-cache.json"
|
|
227
|
+
],
|
|
228
|
+
"dependencies": [
|
|
229
|
+
"depcruise:graph:doc:archi-svg"
|
|
230
|
+
],
|
|
231
|
+
"clean": false,
|
|
232
|
+
"output": [
|
|
233
|
+
"docs/dependency-cruiser-archi-graph.html"
|
|
234
|
+
]
|
|
235
|
+
},
|
|
236
|
+
"depcruise:graph": {
|
|
237
|
+
"dependencies": [
|
|
238
|
+
"depcruise:graph:doc:archi-html",
|
|
239
|
+
"depcruise:graph:doc:deps-html",
|
|
240
|
+
"depcruise:graph:doc:flat-deps-html"
|
|
241
|
+
]
|
|
242
|
+
},
|
|
243
|
+
"depcruise:graph:dev": {
|
|
244
|
+
"command": "depcruise-fmt node_modules/.cache/depcruise-cache.json --output-type dot --include-only '^(bin|src|package\\.json)' --prefix vscode://file/$(pwd)/ | dot -Tsvg | depcruise-wrap-stream-in-html | browser",
|
|
245
|
+
"dependencies": [
|
|
246
|
+
"depcruise:json"
|
|
247
|
+
]
|
|
248
|
+
},
|
|
249
|
+
"depcruise:graph:dev:flat": {
|
|
250
|
+
"command": "depcruise-fmt node_modules/.cache/depcruise-cache.json --output-type flat --include-only '^(bin|src|package\\.json)' --prefix vscode://file/$(pwd)/ | twopi -Tsvg | depcruise-wrap-stream-in-html | browser",
|
|
251
|
+
"dependencies": [
|
|
252
|
+
"depcruise:json"
|
|
253
|
+
]
|
|
254
|
+
},
|
|
255
|
+
"depcruise:view-report": {
|
|
256
|
+
"command": "depcruise-fmt node_modules/.cache/depcruise-cache.json --output-type err-html --prefix vscode://file/$(pwd)/ | browser",
|
|
257
|
+
"dependencies": [
|
|
258
|
+
"depcruise:json"
|
|
259
|
+
]
|
|
260
|
+
},
|
|
261
|
+
"depcruise:github-actions:markdown": {
|
|
262
|
+
"command": "depcruise-fmt node_modules/.cache/depcruise-cache.json --output-type markdown >> $GITHUB_STEP_SUMMARY",
|
|
263
|
+
"dependencies": [
|
|
264
|
+
"depcruise:json"
|
|
265
|
+
]
|
|
266
|
+
},
|
|
267
|
+
"depcruise:github-actions:mermaid": {
|
|
268
|
+
"command": "echo '\n\n```mermaid' >> $GITHUB_STEP_SUMMARY && depcruise-fmt node_modules/.cache/depcruise-cache.json --include-only '^(bin|src)' --output-type mermaid >> $GITHUB_STEP_SUMMARY && echo '```\n\n' >> $GITHUB_STEP_SUMMARY",
|
|
269
|
+
"dependencies": [
|
|
270
|
+
"depcruise:json"
|
|
271
|
+
]
|
|
272
|
+
},
|
|
273
|
+
"depcruise:github-actions:mermaid:diff": {
|
|
274
|
+
"command": "echo '\n\n```mermaid' >> $GITHUB_STEP_SUMMARY && depcruise-fmt node_modules/.cache/depcruise-cache.json --include-only '^(bin|src)' --focus '$(watskeburt $SHA -T regex)' --output-type mermaid >> $GITHUB_STEP_SUMMARY && echo '```\n\n' >> $GITHUB_STEP_SUMMARY",
|
|
275
|
+
"dependencies": [
|
|
276
|
+
"depcruise:json"
|
|
277
|
+
]
|
|
278
|
+
},
|
|
279
|
+
"lint": {
|
|
280
|
+
"dependencies": [
|
|
281
|
+
"lint:eslint",
|
|
282
|
+
"lint:prettier",
|
|
283
|
+
"lint:types"
|
|
284
|
+
]
|
|
285
|
+
},
|
|
286
|
+
"lint:eslint": {
|
|
287
|
+
"command": "eslint --cache --cache-location node_modules/.cache/eslint/cache.json --color src test config",
|
|
288
|
+
"files": [
|
|
289
|
+
"{src,test}/**/*.{js,mjs}",
|
|
290
|
+
"config/**/*.{js,json}",
|
|
291
|
+
".eslintrc.json"
|
|
292
|
+
]
|
|
293
|
+
},
|
|
294
|
+
"lint:prettier": {
|
|
295
|
+
"command": "prettier --check \"bin/*.mjs\" \"{src,test}/**/*.{js,mjs}\" \"{config,test}/**/*.{js,json}\" \"tools/*.{js,mjs,json}\" \"types/*.ts\" \"*.{json,yml,md}\" \"docs/{smcat-online-interpreter.js,*.md}\"",
|
|
296
|
+
"files": [
|
|
297
|
+
"bin/*.mjs",
|
|
298
|
+
"{src,test}/**/*.{js,mjs}",
|
|
299
|
+
"{config,test}/**/*.{js,json}",
|
|
300
|
+
"tools/*.{js,mjs,json}",
|
|
301
|
+
"types/*.ts",
|
|
302
|
+
"*.{json,yml,md}",
|
|
303
|
+
"docs/{smcat-online-interpreter.js,*.md}"
|
|
304
|
+
]
|
|
305
|
+
},
|
|
306
|
+
"lint:types": {
|
|
307
|
+
"dependencies": [
|
|
308
|
+
"lint:types:tsc",
|
|
309
|
+
"lint:types:eslint"
|
|
310
|
+
]
|
|
311
|
+
},
|
|
312
|
+
"lint:types:tsc": {
|
|
313
|
+
"command": "tsc --noEmit --strict --types --noUnusedLocals --noUnusedParameters --pretty types/*.d.ts",
|
|
314
|
+
"files": [
|
|
315
|
+
"types/*.d.ts"
|
|
316
|
+
]
|
|
317
|
+
},
|
|
318
|
+
"lint:types:eslint": {
|
|
319
|
+
"command": "eslint types/*.d.ts",
|
|
320
|
+
"files": [
|
|
321
|
+
"types/*.d.ts",
|
|
322
|
+
".eslintrc.json"
|
|
323
|
+
]
|
|
324
|
+
},
|
|
325
|
+
"lint:fix": {
|
|
326
|
+
"dependencies": [
|
|
327
|
+
"lint:fix:eslint",
|
|
328
|
+
"lint:fix:prettier",
|
|
329
|
+
"lint:fix:types"
|
|
330
|
+
]
|
|
331
|
+
},
|
|
332
|
+
"lint:fix:eslint": {
|
|
333
|
+
"command": "eslint --cache --cache-location .cache --fix --color src test config",
|
|
334
|
+
"files": [
|
|
335
|
+
"{src,test}/**/*.{js,mjs}",
|
|
336
|
+
"config/**/*.{js,json}",
|
|
337
|
+
".eslintrc.json"
|
|
338
|
+
]
|
|
339
|
+
},
|
|
340
|
+
"lint:fix:prettier": {
|
|
341
|
+
"command": "prettier --loglevel warn --write \"bin/*.mjs\" \"{src,test}/**/*.{js,mjs}\" \"{config,test}/**/*.{js,json}\" \"tools/*.{js,mjs,json}\" \"types/*.ts\" \"*.{json,yml,md}\" \"docs/{smcat-online-interpreter.js,*.md}\"",
|
|
342
|
+
"files": [
|
|
343
|
+
"bin/*.mjs",
|
|
344
|
+
"{src,test}/**/*.{js,mjs}",
|
|
345
|
+
"{config,test}/**/*.{js,json}",
|
|
346
|
+
"tools/*.{js,mjs,json}",
|
|
347
|
+
"types/*.ts",
|
|
348
|
+
"*.{json,yml,md}",
|
|
349
|
+
"docs/{smcat-online-interpreter.js,*.md}"
|
|
350
|
+
]
|
|
351
|
+
},
|
|
352
|
+
"lint:fix:types": {
|
|
353
|
+
"command": "eslint --fix types/*.d.ts",
|
|
354
|
+
"files": [
|
|
355
|
+
"types/*.d.ts",
|
|
356
|
+
".eslintrc.json"
|
|
357
|
+
]
|
|
358
|
+
},
|
|
359
|
+
"test": {
|
|
360
|
+
"command": "mocha --reporter spec --full-trace --timeout 4000 --recursive test",
|
|
361
|
+
"files": [
|
|
362
|
+
"{src,test}/**/*.{js,mjs,json}"
|
|
363
|
+
]
|
|
364
|
+
},
|
|
365
|
+
"test:cover": {
|
|
366
|
+
"command": "c8 --all --check-coverage --statements 100 --branches 99.1 --functions 100 --lines 100 --exclude \"{bin/*,config/**/*,coverage/**/*,docs/**/*,public/**/*,test/**/*,tools/**/*,types/**/*,dist/commonjs/*,src/**/*{template,-parser}.{mjs,cjs,js},tmp*}\" --reporter text-summary --reporter html --reporter lcov mocha --reporter spec --full-trace --timeout 4000 --recursive test",
|
|
367
|
+
"output": [
|
|
368
|
+
"coverage/lcov.info"
|
|
369
|
+
],
|
|
370
|
+
"files": [
|
|
371
|
+
"{src,test}/**/*.{js,mjs,json}"
|
|
372
|
+
]
|
|
373
|
+
}
|
|
374
|
+
},
|
|
115
375
|
"keywords": [
|
|
116
376
|
"state",
|
|
117
377
|
"state chart",
|
|
@@ -131,51 +391,49 @@
|
|
|
131
391
|
"state-machine-cat": "bin/smcat.mjs"
|
|
132
392
|
},
|
|
133
393
|
"dependencies": {
|
|
134
|
-
"ajv": "8.
|
|
135
|
-
"chalk": "5.0.
|
|
136
|
-
"commander": "9.
|
|
394
|
+
"ajv": "8.11.0",
|
|
395
|
+
"chalk": "5.0.1",
|
|
396
|
+
"commander": "9.4.0",
|
|
137
397
|
"fast-xml-parser": "3.21.1",
|
|
138
398
|
"get-stream": "6.0.1",
|
|
139
399
|
"handlebars": "4.7.7",
|
|
140
400
|
"he": "1.2.0",
|
|
141
401
|
"indent-string": "5.0.0",
|
|
142
|
-
"lodash
|
|
143
|
-
"
|
|
144
|
-
"lodash.get": "4.4.2",
|
|
145
|
-
"lodash.has": "4.5.2",
|
|
146
|
-
"lodash.reject": "4.6.0",
|
|
147
|
-
"semver": "^7.3.5",
|
|
402
|
+
"lodash": "4.17.21",
|
|
403
|
+
"semver": "^7.3.7",
|
|
148
404
|
"viz.js": "1.8.2",
|
|
149
405
|
"wrap-ansi": "8.0.1"
|
|
150
406
|
},
|
|
151
407
|
"devDependencies": {
|
|
152
|
-
"@typescript-eslint/eslint-plugin": "5.
|
|
153
|
-
"@typescript-eslint/parser": "5.
|
|
154
|
-
"c8": "7.
|
|
408
|
+
"@typescript-eslint/eslint-plugin": "5.31.0",
|
|
409
|
+
"@typescript-eslint/parser": "5.31.0",
|
|
410
|
+
"c8": "7.12.0",
|
|
155
411
|
"chai": "4.3.6",
|
|
156
412
|
"chai-as-promised": "7.1.1",
|
|
157
413
|
"chai-json-schema": "1.5.1",
|
|
158
414
|
"chai-xml": "0.4.0",
|
|
159
|
-
"dependency-cruiser": "11.
|
|
160
|
-
"esbuild": "0.14.
|
|
161
|
-
"eslint": "^
|
|
162
|
-
"eslint-config-moving-meadow": "
|
|
415
|
+
"dependency-cruiser": "11.14.0",
|
|
416
|
+
"esbuild": "0.14.51",
|
|
417
|
+
"eslint": "^8.20.0",
|
|
418
|
+
"eslint-config-moving-meadow": "3.0.0",
|
|
163
419
|
"eslint-config-prettier": "8.5.0",
|
|
164
|
-
"eslint-plugin-budapestian": "
|
|
165
|
-
"eslint-plugin-import": "2.
|
|
166
|
-
"eslint-plugin-mocha": "10.0
|
|
420
|
+
"eslint-plugin-budapestian": "4.0.0",
|
|
421
|
+
"eslint-plugin-import": "2.26.0",
|
|
422
|
+
"eslint-plugin-mocha": "10.1.0",
|
|
167
423
|
"eslint-plugin-node": "11.1.0",
|
|
168
|
-
"eslint-plugin-security": "1.
|
|
169
|
-
"eslint-plugin-unicorn": "^
|
|
424
|
+
"eslint-plugin-security": "1.5.0",
|
|
425
|
+
"eslint-plugin-unicorn": "^43.0.2",
|
|
170
426
|
"husky": "4.3.8",
|
|
171
|
-
"lint-staged": "
|
|
172
|
-
"mocha": "
|
|
427
|
+
"lint-staged": "13.0.3",
|
|
428
|
+
"mocha": "10.0.0",
|
|
173
429
|
"npm-run-all": "4.1.5",
|
|
174
|
-
"peggy": "
|
|
175
|
-
"prettier": "^2.
|
|
430
|
+
"peggy": "2.0.1",
|
|
431
|
+
"prettier": "^2.7.1",
|
|
176
432
|
"query-string": "7.1.1",
|
|
177
|
-
"typescript": "4.
|
|
433
|
+
"typescript": "4.7.4",
|
|
178
434
|
"upem": "^7.0.0",
|
|
435
|
+
"watskeburt": "0.6.0",
|
|
436
|
+
"wireit": "0.7.1",
|
|
179
437
|
"xml-name-validator": "4.0.0"
|
|
180
438
|
},
|
|
181
439
|
"eslintIgnore": [
|
|
@@ -188,7 +446,7 @@
|
|
|
188
446
|
"src/**/*.template.js"
|
|
189
447
|
],
|
|
190
448
|
"engines": {
|
|
191
|
-
"node": "^
|
|
449
|
+
"node": "^14.13.1||^16||>=18"
|
|
192
450
|
},
|
|
193
451
|
"types": "types/state-machine-cat.d.ts",
|
|
194
452
|
"browserslist": [
|
package/src/cli/actions.mjs
CHANGED
|
@@ -7,7 +7,7 @@ const LICENSE = `
|
|
|
7
7
|
|
|
8
8
|
The MIT License (MIT)
|
|
9
9
|
|
|
10
|
-
Copyright (c) 2016-
|
|
10
|
+
Copyright (c) 2016-2022 Sander Verweij
|
|
11
11
|
|
|
12
12
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
13
13
|
a copy of this software and associated documentation files (the
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Generated by Peggy
|
|
1
|
+
// Generated by Peggy 2.0.1.
|
|
2
2
|
//
|
|
3
3
|
// https://peggyjs.org/
|
|
4
4
|
|
|
@@ -10,6 +10,7 @@ function peg$subclass(child, parent) {
|
|
|
10
10
|
|
|
11
11
|
function peg$SyntaxError(message, expected, found, location) {
|
|
12
12
|
var self = Error.call(this, message);
|
|
13
|
+
// istanbul ignore next Check is a necessary evil to support older environments
|
|
13
14
|
if (Object.setPrototypeOf) {
|
|
14
15
|
Object.setPrototypeOf(self, peg$SyntaxError.prototype);
|
|
15
16
|
}
|
|
@@ -45,14 +46,15 @@ peg$SyntaxError.prototype.format = function(sources) {
|
|
|
45
46
|
var loc = this.location.source + ":" + s.line + ":" + s.column;
|
|
46
47
|
if (src) {
|
|
47
48
|
var e = this.location.end;
|
|
48
|
-
var filler = peg$padEnd("", s.line.toString().length);
|
|
49
|
+
var filler = peg$padEnd("", s.line.toString().length, ' ');
|
|
49
50
|
var line = src[s.line - 1];
|
|
50
51
|
var last = s.line === e.line ? e.column : line.length + 1;
|
|
52
|
+
var hatLen = (last - s.column) || 1;
|
|
51
53
|
str += "\n --> " + loc + "\n"
|
|
52
54
|
+ filler + " |\n"
|
|
53
55
|
+ s.line + " | " + line + "\n"
|
|
54
|
-
+ filler + " | " + peg$padEnd("", s.column - 1)
|
|
55
|
-
+ peg$padEnd("",
|
|
56
|
+
+ filler + " | " + peg$padEnd("", s.column - 1, ' ')
|
|
57
|
+
+ peg$padEnd("", hatLen, "^");
|
|
56
58
|
} else {
|
|
57
59
|
str += "\n at " + loc;
|
|
58
60
|
}
|
|
@@ -73,7 +75,7 @@ peg$SyntaxError.buildMessage = function(expected, found) {
|
|
|
73
75
|
: classEscape(part);
|
|
74
76
|
});
|
|
75
77
|
|
|
76
|
-
return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]";
|
|
78
|
+
return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]";
|
|
77
79
|
},
|
|
78
80
|
|
|
79
81
|
any: function() {
|
|
@@ -209,10 +211,10 @@ function peg$parse(input, options) {
|
|
|
209
211
|
var peg$f1 = function(s) {return s.join("")};
|
|
210
212
|
var peg$f2 = function(c) {return c};
|
|
211
213
|
var peg$f3 = function(s) {return text()};
|
|
212
|
-
var peg$f4 = function(
|
|
213
|
-
var peg$f5 = function() {
|
|
214
|
-
var peg$f6 = function() {return
|
|
215
|
-
|
|
214
|
+
var peg$f4 = function(c) {return c};
|
|
215
|
+
var peg$f5 = function(bool) {return (bool==="true")};
|
|
216
|
+
var peg$f6 = function() { return parseInt(text(), 10); };
|
|
217
|
+
var peg$f7 = function() {return parseFloat(text())};
|
|
216
218
|
var peg$currPos = 0;
|
|
217
219
|
var peg$savedPos = 0;
|
|
218
220
|
var peg$posDetailsCache = [{ line: 1, column: 1 }];
|
|
@@ -698,7 +700,7 @@ function peg$parse(input, options) {
|
|
|
698
700
|
}
|
|
699
701
|
if (s3 !== peg$FAILED) {
|
|
700
702
|
peg$savedPos = s1;
|
|
701
|
-
s1 = peg$
|
|
703
|
+
s1 = peg$f4(s3);
|
|
702
704
|
} else {
|
|
703
705
|
peg$currPos = s1;
|
|
704
706
|
s1 = peg$FAILED;
|
|
@@ -773,7 +775,7 @@ function peg$parse(input, options) {
|
|
|
773
775
|
}
|
|
774
776
|
if (s3 !== peg$FAILED) {
|
|
775
777
|
peg$savedPos = s1;
|
|
776
|
-
s1 = peg$
|
|
778
|
+
s1 = peg$f4(s3);
|
|
777
779
|
} else {
|
|
778
780
|
peg$currPos = s1;
|
|
779
781
|
s1 = peg$FAILED;
|
|
@@ -813,7 +815,7 @@ function peg$parse(input, options) {
|
|
|
813
815
|
}
|
|
814
816
|
if (s1 !== peg$FAILED) {
|
|
815
817
|
peg$savedPos = s0;
|
|
816
|
-
s1 = peg$
|
|
818
|
+
s1 = peg$f5(s1);
|
|
817
819
|
}
|
|
818
820
|
s0 = s1;
|
|
819
821
|
peg$silentFails--;
|
|
@@ -854,7 +856,7 @@ function peg$parse(input, options) {
|
|
|
854
856
|
}
|
|
855
857
|
if (s1 !== peg$FAILED) {
|
|
856
858
|
peg$savedPos = s0;
|
|
857
|
-
s1 = peg$
|
|
859
|
+
s1 = peg$f6();
|
|
858
860
|
}
|
|
859
861
|
s0 = s1;
|
|
860
862
|
peg$silentFails--;
|
|
@@ -898,7 +900,7 @@ function peg$parse(input, options) {
|
|
|
898
900
|
s2 = null;
|
|
899
901
|
}
|
|
900
902
|
peg$savedPos = s0;
|
|
901
|
-
s0 = peg$
|
|
903
|
+
s0 = peg$f7();
|
|
902
904
|
} else {
|
|
903
905
|
peg$currPos = s0;
|
|
904
906
|
s0 = peg$FAILED;
|
|
@@ -962,5 +964,6 @@ function peg$parse(input, options) {
|
|
|
962
964
|
|
|
963
965
|
export {
|
|
964
966
|
peg$SyntaxError as SyntaxError,
|
|
967
|
+
|
|
965
968
|
peg$parse as parse
|
|
966
969
|
};
|
package/src/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable budapestian/global-constant-pattern */
|
|
1
2
|
import options from "./options.mjs";
|
|
2
3
|
import parse from "./parse/index.mjs";
|
|
3
4
|
import desugar from "./transform/desugar.mjs";
|
|
@@ -5,7 +6,7 @@ import getRenderFunction from "./render/index.mjs";
|
|
|
5
6
|
import { version as _version } from "./version.mjs";
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
|
-
* Translates the input script to an
|
|
9
|
+
* Translates the input script to an output-script.
|
|
9
10
|
*
|
|
10
11
|
* @param {string} pScript The script to translate
|
|
11
12
|
* @param {object} pOptions options influencing parsing & rendering.
|
package/src/options.mjs
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import _get from "lodash.get";
|
|
2
|
-
|
|
3
1
|
const ALLOWED_VALUES = Object.freeze({
|
|
4
2
|
inputType: {
|
|
5
3
|
default: "smcat",
|
|
@@ -58,11 +56,8 @@ const ALLOWED_VALUES = Object.freeze({
|
|
|
58
56
|
* @return {any} value
|
|
59
57
|
*/
|
|
60
58
|
function getOptionValue(pOptions, pOptionName) {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
pOptionName,
|
|
64
|
-
_get(ALLOWED_VALUES, `${pOptionName}.default`)
|
|
65
|
-
);
|
|
59
|
+
// eslint-disable-next-line security/detect-object-injection
|
|
60
|
+
return pOptions?.[pOptionName] ?? ALLOWED_VALUES[pOptionName].default;
|
|
66
61
|
}
|
|
67
62
|
|
|
68
63
|
function getAllowedValues() {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
/* eslint-disable security/detect-object-injection */
|
|
2
2
|
import fastxml from "fast-xml-parser";
|
|
3
3
|
import he from "he";
|
|
4
|
-
import
|
|
5
|
-
import _get from "lodash.get";
|
|
4
|
+
import castArray from "lodash/castArray.js";
|
|
6
5
|
import utl from "../../transform/utl.mjs";
|
|
7
6
|
import parserHelpers from "../parser-helpers.mjs";
|
|
8
7
|
import normalizeMachine from "./normalize-machine.mjs";
|
|
@@ -10,14 +9,14 @@ import normalizeMachine from "./normalize-machine.mjs";
|
|
|
10
9
|
const formatLabel = utl.formatLabel;
|
|
11
10
|
|
|
12
11
|
function extractActions(pState, pActionType) {
|
|
13
|
-
return
|
|
12
|
+
return castArray(pState[pActionType]).map((pAction) => ({
|
|
14
13
|
type: pActionType === "onexit" ? "exit" : "entry",
|
|
15
14
|
body: he.decode(pAction).trim(),
|
|
16
15
|
}));
|
|
17
16
|
}
|
|
18
17
|
|
|
19
18
|
function extractActionsFromInvokes(pInvokeTriggers) {
|
|
20
|
-
return
|
|
19
|
+
return castArray(pInvokeTriggers).map((pInvokeTrigger) => {
|
|
21
20
|
const lId = he.decode(pInvokeTrigger.id || "").trim();
|
|
22
21
|
|
|
23
22
|
return {
|
|
@@ -148,7 +147,7 @@ function extractTransitions(pStates) {
|
|
|
148
147
|
.reduce(
|
|
149
148
|
(pAllTransitions, pThisState) =>
|
|
150
149
|
pAllTransitions.concat(
|
|
151
|
-
|
|
150
|
+
castArray(pThisState.transition).reduce(
|
|
152
151
|
reduceTransition(pThisState),
|
|
153
152
|
[]
|
|
154
153
|
)
|
|
@@ -195,7 +194,7 @@ export function parse(pSCXMLString) {
|
|
|
195
194
|
stopNodes: ["onentry", "onexit", "transition"],
|
|
196
195
|
});
|
|
197
196
|
|
|
198
|
-
return mapMachine(
|
|
197
|
+
return mapMachine(lXMLAsJSON?.scxml ?? {});
|
|
199
198
|
}
|
|
200
199
|
throw new Error("That doesn't look like valid xml ...\n");
|
|
201
200
|
}
|