@zakkster/lite-signal 1.8.0-alpha.0 → 1.8.0-alpha.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/Signal.js +16 -21
- package/package.json +1 -1
package/Signal.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @zakkster/lite-signal v1.8.0
|
|
2
|
+
* @zakkster/lite-signal v1.8.0
|
|
3
3
|
* Copyright (c) Zahary Shinikchiev <shinikchiev@yahoo.com>
|
|
4
4
|
* MIT License
|
|
5
5
|
* --------------------
|
|
@@ -943,25 +943,6 @@ export function createRegistry(config) {
|
|
|
943
943
|
* gen-snapshot guard is the v1.2 conformance fix for #141.
|
|
944
944
|
* @private
|
|
945
945
|
*/
|
|
946
|
-
// 1.12.1 (ledger #18): the cleanup-return APPEND LADDER lives here, OUT OF LINE.
|
|
947
|
-
// 1.8.0 inlined all 15 lines of it into executeEffect -- a hot body -- which pushed that
|
|
948
|
-
// body past V8's inline/code-size budget and cost 11-23% on effect-dense graphs
|
|
949
|
-
// (bisected: reverting ONLY that hunk restored 1.7.0 exactly). Same failure mode as
|
|
950
|
-
// ledger #17: BYTES, not instructions. The hot body now carries a single branch --
|
|
951
|
-
// `if (ret !== undefined)` -- and the common case (an effect returning nothing) is one
|
|
952
|
-
// undefined-compare. This cold function is entered only when a body actually returns
|
|
953
|
-
// something, i.e. it rides a branch that is already cold: the counter-placement rule.
|
|
954
|
-
// Semantics are IDENTICAL to 1.8.0: auto-detected (no API change), conditional returns
|
|
955
|
-
// work on any run, composes with imperative onCleanup in call order, and a self-disposed
|
|
956
|
-
// body (gen advanced) registers nothing -- the slot may already host a new resident.
|
|
957
|
-
function registerCleanupReturn(node, ret, savedGen) {
|
|
958
|
-
if (typeof ret !== "function" || node.gen !== savedGen) return;
|
|
959
|
-
const existing = node.cleanupFn;
|
|
960
|
-
if (existing === undefined) node.cleanupFn = ret;
|
|
961
|
-
else if (typeof existing === "function") node.cleanupFn = [existing, ret];
|
|
962
|
-
else existing.push(ret);
|
|
963
|
-
}
|
|
964
|
-
|
|
965
946
|
function executeEffect(node) {
|
|
966
947
|
if ((node.flags & FLAG_COMPUTING) !== 0) throw new Error("CycleError: Infinite effect loop detected.");
|
|
967
948
|
|
|
@@ -1009,8 +990,22 @@ export function createRegistry(config) {
|
|
|
1009
990
|
const savedGen = node.gen;
|
|
1010
991
|
if (mutationHook !== null) mutationHook(5, node.id, 0);
|
|
1011
992
|
try {
|
|
993
|
+
// 1.8.0 (Reflex pattern A): an effect body may RETURN a cleanup
|
|
994
|
+
// function -- Solid/Vue-compatible ergonomics for the existing
|
|
995
|
+
// imperative onCleanup(fn). The returned fn runs before the next
|
|
996
|
+
// re-run and on dispose, appended with the exact onCleanup append
|
|
997
|
+
// semantics (single fn -> pair array -> push), so the two
|
|
998
|
+
// registration styles compose in call order. Non-function returns
|
|
999
|
+
// are ignored; a self-disposed body (gen advanced) registers
|
|
1000
|
+
// nothing -- the slot may already host a new resident. One typeof
|
|
1001
|
+
// per effect run, entirely off the mark/pull path.
|
|
1012
1002
|
const ret = node.computeFn();
|
|
1013
|
-
if (ret
|
|
1003
|
+
if (typeof ret === "function" && node.gen === savedGen) {
|
|
1004
|
+
const existing = node.cleanupFn;
|
|
1005
|
+
if (existing === undefined) node.cleanupFn = ret;
|
|
1006
|
+
else if (typeof existing === "function") node.cleanupFn = [existing, ret];
|
|
1007
|
+
else existing.push(ret);
|
|
1008
|
+
}
|
|
1014
1009
|
} finally {
|
|
1015
1010
|
if (node.gen === savedGen) {
|
|
1016
1011
|
severTail(node);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zakkster/lite-signal",
|
|
3
|
-
"version": "1.8.0-alpha.
|
|
3
|
+
"version": "1.8.0-alpha.1",
|
|
4
4
|
"description": "Zero-GC reactive graph. Monomorphic object pool, versioned push-pull propagation, 32-bit modular versioning. Built for hot paths and long-running processes.",
|
|
5
5
|
"author": "Zahary Shinikchiev <shinikchiev@yahoo.com>",
|
|
6
6
|
"license": "MIT",
|