state-machine-cat 12.0.6 → 12.0.8
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/dist/cli/actions.mjs +34 -31
- package/dist/cli/attributes-parser.mjs +914 -889
- package/dist/cli/execute-command-line.mjs +98 -48
- package/dist/cli/file-name-to-stream.mjs +8 -8
- package/dist/cli/normalize.mjs +89 -70
- package/dist/cli/validations.mjs +72 -52
- package/dist/index-node.mjs +12 -9
- package/dist/index.mjs +10 -7
- package/dist/options.mjs +53 -53
- package/dist/parse/index.mjs +17 -17
- package/dist/parse/parser-helpers.mjs +159 -139
- package/dist/parse/scxml/index.mjs +152 -129
- package/dist/parse/scxml/normalize-machine.mjs +36 -35
- package/dist/parse/scxml/utl.mjs +1 -1
- package/dist/parse/smcat/smcat-parser.mjs +2794 -2844
- package/dist/parse/smcat-ast.schema.mjs +185 -168
- package/dist/render/dot/attributebuilder.mjs +40 -37
- package/dist/render/dot/counter.mjs +14 -14
- package/dist/render/dot/dot.states.template.js +1 -26
- package/dist/render/dot/dot.template.js +1 -14
- package/dist/render/dot/index.mjs +129 -82
- package/dist/render/dot/render-dot-from-ast.mjs +33 -16
- package/dist/render/dot/state-transformers.mjs +96 -85
- package/dist/render/dot/transition-transformers.mjs +39 -41
- package/dist/render/dot/utl.mjs +21 -19
- package/dist/render/index-node.mjs +16 -16
- package/dist/render/index.mjs +9 -9
- package/dist/render/scjson/index.mjs +111 -94
- package/dist/render/scjson/make-valid-event-names.mjs +21 -18
- package/dist/render/scjson/make-valid-xml-name.mjs +17 -13
- package/dist/render/scxml/index.mjs +2 -1
- package/dist/render/scxml/render-from-scjson.mjs +5 -2
- package/dist/render/scxml/scxml.states.template.js +1 -14
- package/dist/render/scxml/scxml.template.js +1 -6
- package/dist/render/smcat/index.mjs +54 -39
- package/dist/render/smcat/smcat.template.js +1 -13
- package/dist/render/vector/dot-to-vector-native.mjs +30 -26
- package/dist/render/vector/vector-native-dot-with-fallback.mjs +27 -20
- package/dist/render/vector/vector-with-wasm.mjs +13 -6
- package/dist/state-machine-model.mjs +67 -52
- package/dist/transform/desugar.mjs +115 -66
- package/dist/transform/utl.mjs +12 -12
- package/dist/version.mjs +1 -1
- package/package.json +74 -74
- package/types/state-machine-cat.d.mts +209 -209
package/dist/cli/actions.mjs
CHANGED
|
@@ -28,41 +28,44 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
28
28
|
|
|
29
29
|
`;
|
|
30
30
|
function getStream(pStream) {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
31
|
+
return new Promise((pResolve, pReject) => {
|
|
32
|
+
let lInputAsString = "";
|
|
33
|
+
pStream
|
|
34
|
+
.on("data", (pChunk) => {
|
|
35
|
+
lInputAsString += pChunk;
|
|
36
|
+
})
|
|
37
|
+
.on("error", pReject)
|
|
38
|
+
.on("end", () => {
|
|
39
|
+
pResolve(lInputAsString);
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
42
|
}
|
|
43
43
|
export function displayLicense(pOutStream) {
|
|
44
|
-
|
|
44
|
+
pOutStream.write(LICENSE, "utf8");
|
|
45
45
|
}
|
|
46
46
|
export function transform(pOptions) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
47
|
+
return getStream(getInStream(pOptions.inputFrom)).then((pInput) => {
|
|
48
|
+
const lOutput = smcat.render(pInput, {
|
|
49
|
+
inputType: pOptions.inputType,
|
|
50
|
+
outputType: pOptions.outputType,
|
|
51
|
+
engine: pOptions.engine,
|
|
52
|
+
direction: pOptions.direction,
|
|
53
|
+
dotGraphAttrs: pOptions.dotGraphAttrs,
|
|
54
|
+
dotNodeAttrs: pOptions.dotNodeAttrs,
|
|
55
|
+
dotEdgeAttrs: pOptions.dotEdgeAttrs,
|
|
56
|
+
desugar: pOptions.desugar,
|
|
57
|
+
});
|
|
58
|
+
return getOutStream(pOptions.outputTo).write(
|
|
59
|
+
typeof lOutput === "string"
|
|
60
|
+
? lOutput
|
|
61
|
+
: JSON.stringify(lOutput, null, " "),
|
|
62
|
+
"binary",
|
|
63
|
+
);
|
|
64
|
+
});
|
|
62
65
|
}
|
|
63
66
|
export function formatError(pError) {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
67
|
+
if (Boolean(pError.location)) {
|
|
68
|
+
return `\n syntax error on line ${pError.location.start.line}, column ${pError.location.start.column}:\n ${pError.message}\n\n`;
|
|
69
|
+
}
|
|
70
|
+
return pError.message;
|
|
68
71
|
}
|