jssm 5.143.22 → 5.143.24
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 +7 -7
- package/dist/cdn/instance.js +47 -21
- package/dist/cdn/viz.js +47 -21
- package/dist/cli/fsl-render.cjs +1 -1
- package/dist/cli/fsl.cjs +1 -1
- package/dist/deno/README.md +7 -7
- package/dist/deno/jssm.d.ts +1 -0
- package/dist/deno/jssm.js +1 -1
- package/dist/deno/jssm_types.d.ts +9 -0
- package/dist/jssm.es5.cjs +1 -1
- package/dist/jssm.es5.iife.js +1 -1
- package/dist/jssm.es6.mjs +1 -1
- package/dist/jssm_viz.cjs +1 -1
- package/dist/jssm_viz.iife.cjs +1 -1
- package/dist/jssm_viz.mjs +1 -1
- package/jssm.es5.d.cts +10 -0
- package/jssm.es6.d.ts +10 -0
- package/jssm_viz.es5.d.cts +10 -0
- package/jssm_viz.es6.d.ts +10 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,10 +18,10 @@ Please edit the file it's derived from, instead: `./src/md/readme_base.md`
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
* Generated for version 5.143.
|
|
21
|
+
* Generated for version 5.143.24 at 6/12/2026, 2:12:45 PM
|
|
22
22
|
|
|
23
23
|
-->
|
|
24
|
-
# jssm 5.143.
|
|
24
|
+
# jssm 5.143.24
|
|
25
25
|
|
|
26
26
|
[**Try the live editor**](https://stonecypher.github.io/jssm-viz-demo/graph_explorer.html) ·
|
|
27
27
|
[Documentation](https://stonecypher.github.io/jssm/docs/) ·
|
|
@@ -281,7 +281,7 @@ That decision shows up everywhere downstream:
|
|
|
281
281
|
or run `npm run benny` against your own machine.
|
|
282
282
|
|
|
283
283
|
- **More thoroughly tested than any other JavaScript state-machine
|
|
284
|
-
library.** 7,
|
|
284
|
+
library.** 7,012 tests at 100.0% line coverage
|
|
285
285
|
([report](https://coveralls.io/github/StoneCypher/jssm)), plus
|
|
286
286
|
fuzz testing via `fast-check`, with parser test data across ten natural
|
|
287
287
|
languages and Emoji.
|
|
@@ -414,11 +414,11 @@ If your contribution is missing here, please open an issue.
|
|
|
414
414
|
|
|
415
415
|
<br/>
|
|
416
416
|
|
|
417
|
-
***7,
|
|
417
|
+
***7,012 tests***, run 81,856 times.
|
|
418
418
|
|
|
419
|
-
- 6,
|
|
420
|
-
- 756 fuzz tests with 83.
|
|
421
|
-
- 5,
|
|
419
|
+
- 6,256 specs with 100.0% coverage
|
|
420
|
+
- 756 fuzz tests with 83.5% coverage
|
|
421
|
+
- 5,876 TypeScript lines - 1.2 tests per line, 13.9 generated tests per line
|
|
422
422
|
|
|
423
423
|
[](https://github.com/StoneCypher/jssm/actions)
|
|
424
424
|
[](https://www.npmjs.com/package/jssm)
|
package/dist/cdn/instance.js
CHANGED
|
@@ -11842,6 +11842,14 @@ function peg$parse(input, options) {
|
|
|
11842
11842
|
}
|
|
11843
11843
|
function peg$parseStripe() {
|
|
11844
11844
|
var s0, s1, s2, s3, s4, s5, s6;
|
|
11845
|
+
var cg = input.charCodeAt(peg$currPos);
|
|
11846
|
+
if (cg !== 43 && cg !== 45) {
|
|
11847
|
+
if (peg$silentFails === 0 && peg$currPos >= peg$maxFailPos) {
|
|
11848
|
+
peg$fail(peg$c1297);
|
|
11849
|
+
peg$fail(peg$c1300);
|
|
11850
|
+
}
|
|
11851
|
+
return peg$FAILED;
|
|
11852
|
+
}
|
|
11845
11853
|
s0 = peg$currPos;
|
|
11846
11854
|
if (input.substr(peg$currPos, 2) === peg$c1296) {
|
|
11847
11855
|
s1 = peg$c1296;
|
|
@@ -11958,6 +11966,15 @@ function peg$parse(input, options) {
|
|
|
11958
11966
|
}
|
|
11959
11967
|
function peg$parseCycle() {
|
|
11960
11968
|
var s0, s1, s2, s3, s4, s5, s6;
|
|
11969
|
+
var cg = input.charCodeAt(peg$currPos);
|
|
11970
|
+
if (cg !== 43 && cg !== 45) {
|
|
11971
|
+
if (peg$silentFails === 0 && peg$currPos >= peg$maxFailPos) {
|
|
11972
|
+
peg$fail(peg$c1303);
|
|
11973
|
+
peg$fail(peg$c1306);
|
|
11974
|
+
peg$fail(peg$c1309);
|
|
11975
|
+
}
|
|
11976
|
+
return peg$FAILED;
|
|
11977
|
+
}
|
|
11961
11978
|
s0 = peg$currPos;
|
|
11962
11979
|
if (input.charCodeAt(peg$currPos) === 43) {
|
|
11963
11980
|
s1 = peg$c1302;
|
|
@@ -21787,7 +21804,9 @@ function compile(tree) {
|
|
|
21787
21804
|
throw new JssmError(undefined, `A state may only bind a property once (${sd.state} re-binds ${decl.name})`, { source_location: nth_matching_loc(tree, (n) => n.key === 'state_declaration' && n.name === sd.state, 1) });
|
|
21788
21805
|
}
|
|
21789
21806
|
else {
|
|
21790
|
-
|
|
21807
|
+
// property/state carry the unserialized pair so the constructor can
|
|
21808
|
+
// validate bindings without JSON.parse-ing label back apart (#734)
|
|
21809
|
+
result_cfg.state_property.push({ name: label, default_value: decl.value, property: decl.name, state: sd.state });
|
|
21791
21810
|
}
|
|
21792
21811
|
}
|
|
21793
21812
|
});
|
|
@@ -22383,7 +22402,7 @@ var constants = /*#__PURE__*/Object.freeze({
|
|
|
22383
22402
|
* Useful for runtime diagnostics and for embedding in serialized machine
|
|
22384
22403
|
* snapshots so that deserializers can detect version-skew.
|
|
22385
22404
|
*/
|
|
22386
|
-
const version = "5.143.
|
|
22405
|
+
const version = "5.143.24";
|
|
22387
22406
|
|
|
22388
22407
|
// whargarbl lots of these return arrays could/should be sets
|
|
22389
22408
|
const { state_name_chars, state_name_first_chars, action_label_chars } = constants;
|
|
@@ -22717,6 +22736,7 @@ class Machine {
|
|
|
22717
22736
|
this._default_properties = new Map();
|
|
22718
22737
|
this._state_properties = new Map();
|
|
22719
22738
|
this._required_properties = new Set();
|
|
22739
|
+
this._state_property_first_state = new Map();
|
|
22720
22740
|
this._state_style = state_style_condense(default_state_config, this);
|
|
22721
22741
|
this._active_state_style = state_style_condense(default_active_state_config, this);
|
|
22722
22742
|
this._hooked_state_style = state_style_condense(default_hooked_state_config, this);
|
|
@@ -22904,6 +22924,19 @@ class Machine {
|
|
|
22904
22924
|
if (Array.isArray(state_property)) {
|
|
22905
22925
|
state_property.forEach(sp => {
|
|
22906
22926
|
this._state_properties.set(sp.name, sp.default_value);
|
|
22927
|
+
// Record the unserialized (property, state) pair for post-build
|
|
22928
|
+
// validation. The compiler writes both fields; a hand-built config
|
|
22929
|
+
// that carries only the serialized name pays one JSON.parse here,
|
|
22930
|
+
// which is what every binding used to pay at validation time (#734).
|
|
22931
|
+
let j_property = sp.property, j_state = sp.state;
|
|
22932
|
+
if ((j_property === undefined) || (j_state === undefined)) {
|
|
22933
|
+
const inside = JSON.parse(sp.name);
|
|
22934
|
+
j_property = inside[0];
|
|
22935
|
+
j_state = inside[1];
|
|
22936
|
+
}
|
|
22937
|
+
if (!(this._state_property_first_state.has(j_property))) {
|
|
22938
|
+
this._state_property_first_state.set(j_property, j_state);
|
|
22939
|
+
}
|
|
22907
22940
|
});
|
|
22908
22941
|
}
|
|
22909
22942
|
// set initial state either from the specified or the start state list. validate admission behavior.
|
|
@@ -22923,32 +22956,25 @@ class Machine {
|
|
|
22923
22956
|
}
|
|
22924
22957
|
// done building, do checks
|
|
22925
22958
|
// assert all props are valid
|
|
22926
|
-
//
|
|
22927
|
-
//
|
|
22928
|
-
//
|
|
22929
|
-
|
|
22930
|
-
|
|
22931
|
-
|
|
22932
|
-
if (
|
|
22933
|
-
|
|
22934
|
-
/* v8 ignore else */
|
|
22935
|
-
if (typeof j_property === 'string') {
|
|
22936
|
-
const j_state = inside[1];
|
|
22937
|
-
/* v8 ignore else */
|
|
22938
|
-
if (typeof j_state === 'string') {
|
|
22939
|
-
if (!(this.known_prop(j_property))) {
|
|
22940
|
-
throw new JssmError(this, `State "${j_state}" has property "${j_property}" which is not globally declared`);
|
|
22941
|
-
}
|
|
22942
|
-
}
|
|
22943
|
-
}
|
|
22959
|
+
// provenance pairs were recorded at insertion — first state per property,
|
|
22960
|
+
// in first-binding order — replacing the old JSON.parse of every
|
|
22961
|
+
// serialized key; the error fires for the same binding it always did,
|
|
22962
|
+
// because the first property in first-binding order whose name is
|
|
22963
|
+
// undeclared owns the earliest undeclared binding.
|
|
22964
|
+
this._state_property_first_state.forEach((j_state, j_property) => {
|
|
22965
|
+
if (!(this.known_prop(j_property))) {
|
|
22966
|
+
throw new JssmError(this, `State "${j_state}" has property "${j_property}" which is not globally declared`);
|
|
22944
22967
|
}
|
|
22945
22968
|
});
|
|
22946
22969
|
// assert all required properties are serviced
|
|
22970
|
+
// states() allocates a fresh array per call, so take it once rather than
|
|
22971
|
+
// once per required property
|
|
22972
|
+
const all_states_for_props = this.states();
|
|
22947
22973
|
this._required_properties.forEach(dp_key => {
|
|
22948
22974
|
if (this._default_properties.has(dp_key)) {
|
|
22949
22975
|
throw new JssmError(this, `The property "${dp_key}" is required, but also has a default; these conflict`);
|
|
22950
22976
|
}
|
|
22951
|
-
|
|
22977
|
+
all_states_for_props.forEach(s => {
|
|
22952
22978
|
const bound_name = name_bind_prop_and_state(dp_key, s);
|
|
22953
22979
|
if (!(this._state_properties.has(bound_name))) {
|
|
22954
22980
|
throw new JssmError(this, `State "${s}" is missing required property "${dp_key}"`);
|
package/dist/cdn/viz.js
CHANGED
|
@@ -11867,6 +11867,14 @@ function peg$parse(input, options) {
|
|
|
11867
11867
|
}
|
|
11868
11868
|
function peg$parseStripe() {
|
|
11869
11869
|
var s0, s1, s2, s3, s4, s5, s6;
|
|
11870
|
+
var cg = input.charCodeAt(peg$currPos);
|
|
11871
|
+
if (cg !== 43 && cg !== 45) {
|
|
11872
|
+
if (peg$silentFails === 0 && peg$currPos >= peg$maxFailPos) {
|
|
11873
|
+
peg$fail(peg$c1297);
|
|
11874
|
+
peg$fail(peg$c1300);
|
|
11875
|
+
}
|
|
11876
|
+
return peg$FAILED;
|
|
11877
|
+
}
|
|
11870
11878
|
s0 = peg$currPos;
|
|
11871
11879
|
if (input.substr(peg$currPos, 2) === peg$c1296) {
|
|
11872
11880
|
s1 = peg$c1296;
|
|
@@ -11983,6 +11991,15 @@ function peg$parse(input, options) {
|
|
|
11983
11991
|
}
|
|
11984
11992
|
function peg$parseCycle() {
|
|
11985
11993
|
var s0, s1, s2, s3, s4, s5, s6;
|
|
11994
|
+
var cg = input.charCodeAt(peg$currPos);
|
|
11995
|
+
if (cg !== 43 && cg !== 45) {
|
|
11996
|
+
if (peg$silentFails === 0 && peg$currPos >= peg$maxFailPos) {
|
|
11997
|
+
peg$fail(peg$c1303);
|
|
11998
|
+
peg$fail(peg$c1306);
|
|
11999
|
+
peg$fail(peg$c1309);
|
|
12000
|
+
}
|
|
12001
|
+
return peg$FAILED;
|
|
12002
|
+
}
|
|
11986
12003
|
s0 = peg$currPos;
|
|
11987
12004
|
if (input.charCodeAt(peg$currPos) === 43) {
|
|
11988
12005
|
s1 = peg$c1302;
|
|
@@ -21812,7 +21829,9 @@ function compile(tree) {
|
|
|
21812
21829
|
throw new JssmError(undefined, `A state may only bind a property once (${sd.state} re-binds ${decl.name})`, { source_location: nth_matching_loc(tree, (n) => n.key === 'state_declaration' && n.name === sd.state, 1) });
|
|
21813
21830
|
}
|
|
21814
21831
|
else {
|
|
21815
|
-
|
|
21832
|
+
// property/state carry the unserialized pair so the constructor can
|
|
21833
|
+
// validate bindings without JSON.parse-ing label back apart (#734)
|
|
21834
|
+
result_cfg.state_property.push({ name: label, default_value: decl.value, property: decl.name, state: sd.state });
|
|
21816
21835
|
}
|
|
21817
21836
|
}
|
|
21818
21837
|
});
|
|
@@ -22408,7 +22427,7 @@ var constants = /*#__PURE__*/Object.freeze({
|
|
|
22408
22427
|
* Useful for runtime diagnostics and for embedding in serialized machine
|
|
22409
22428
|
* snapshots so that deserializers can detect version-skew.
|
|
22410
22429
|
*/
|
|
22411
|
-
const version = "5.143.
|
|
22430
|
+
const version = "5.143.24";
|
|
22412
22431
|
|
|
22413
22432
|
// whargarbl lots of these return arrays could/should be sets
|
|
22414
22433
|
const { state_name_chars, state_name_first_chars, action_label_chars } = constants;
|
|
@@ -22742,6 +22761,7 @@ class Machine {
|
|
|
22742
22761
|
this._default_properties = new Map();
|
|
22743
22762
|
this._state_properties = new Map();
|
|
22744
22763
|
this._required_properties = new Set();
|
|
22764
|
+
this._state_property_first_state = new Map();
|
|
22745
22765
|
this._state_style = state_style_condense(default_state_config, this);
|
|
22746
22766
|
this._active_state_style = state_style_condense(default_active_state_config, this);
|
|
22747
22767
|
this._hooked_state_style = state_style_condense(default_hooked_state_config, this);
|
|
@@ -22929,6 +22949,19 @@ class Machine {
|
|
|
22929
22949
|
if (Array.isArray(state_property)) {
|
|
22930
22950
|
state_property.forEach(sp => {
|
|
22931
22951
|
this._state_properties.set(sp.name, sp.default_value);
|
|
22952
|
+
// Record the unserialized (property, state) pair for post-build
|
|
22953
|
+
// validation. The compiler writes both fields; a hand-built config
|
|
22954
|
+
// that carries only the serialized name pays one JSON.parse here,
|
|
22955
|
+
// which is what every binding used to pay at validation time (#734).
|
|
22956
|
+
let j_property = sp.property, j_state = sp.state;
|
|
22957
|
+
if ((j_property === undefined) || (j_state === undefined)) {
|
|
22958
|
+
const inside = JSON.parse(sp.name);
|
|
22959
|
+
j_property = inside[0];
|
|
22960
|
+
j_state = inside[1];
|
|
22961
|
+
}
|
|
22962
|
+
if (!(this._state_property_first_state.has(j_property))) {
|
|
22963
|
+
this._state_property_first_state.set(j_property, j_state);
|
|
22964
|
+
}
|
|
22932
22965
|
});
|
|
22933
22966
|
}
|
|
22934
22967
|
// set initial state either from the specified or the start state list. validate admission behavior.
|
|
@@ -22948,32 +22981,25 @@ class Machine {
|
|
|
22948
22981
|
}
|
|
22949
22982
|
// done building, do checks
|
|
22950
22983
|
// assert all props are valid
|
|
22951
|
-
//
|
|
22952
|
-
//
|
|
22953
|
-
//
|
|
22954
|
-
|
|
22955
|
-
|
|
22956
|
-
|
|
22957
|
-
if (
|
|
22958
|
-
|
|
22959
|
-
/* v8 ignore else */
|
|
22960
|
-
if (typeof j_property === 'string') {
|
|
22961
|
-
const j_state = inside[1];
|
|
22962
|
-
/* v8 ignore else */
|
|
22963
|
-
if (typeof j_state === 'string') {
|
|
22964
|
-
if (!(this.known_prop(j_property))) {
|
|
22965
|
-
throw new JssmError(this, `State "${j_state}" has property "${j_property}" which is not globally declared`);
|
|
22966
|
-
}
|
|
22967
|
-
}
|
|
22968
|
-
}
|
|
22984
|
+
// provenance pairs were recorded at insertion — first state per property,
|
|
22985
|
+
// in first-binding order — replacing the old JSON.parse of every
|
|
22986
|
+
// serialized key; the error fires for the same binding it always did,
|
|
22987
|
+
// because the first property in first-binding order whose name is
|
|
22988
|
+
// undeclared owns the earliest undeclared binding.
|
|
22989
|
+
this._state_property_first_state.forEach((j_state, j_property) => {
|
|
22990
|
+
if (!(this.known_prop(j_property))) {
|
|
22991
|
+
throw new JssmError(this, `State "${j_state}" has property "${j_property}" which is not globally declared`);
|
|
22969
22992
|
}
|
|
22970
22993
|
});
|
|
22971
22994
|
// assert all required properties are serviced
|
|
22995
|
+
// states() allocates a fresh array per call, so take it once rather than
|
|
22996
|
+
// once per required property
|
|
22997
|
+
const all_states_for_props = this.states();
|
|
22972
22998
|
this._required_properties.forEach(dp_key => {
|
|
22973
22999
|
if (this._default_properties.has(dp_key)) {
|
|
22974
23000
|
throw new JssmError(this, `The property "${dp_key}" is required, but also has a default; these conflict`);
|
|
22975
23001
|
}
|
|
22976
|
-
|
|
23002
|
+
all_states_for_props.forEach(s => {
|
|
22977
23003
|
const bound_name = name_bind_prop_and_state(dp_key, s);
|
|
22978
23004
|
if (!(this._state_properties.has(bound_name))) {
|
|
22979
23005
|
throw new JssmError(this, `State "${s}" is missing required property "${dp_key}"`);
|