mol_dump_lib 0.0.536 → 0.0.537
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/node.d.ts +13 -11
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +55 -33
- package/node.js.map +1 -1
- package/node.mjs +55 -33
- package/node.test.js +79 -33
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.d.ts +13 -11
- package/web.d.ts.map +1 -1
- package/web.deps.json +1 -1
- package/web.js +49 -29
- package/web.js.map +1 -1
- package/web.mjs +49 -29
- package/web.test.js +24 -0
- package/web.test.js.map +1 -1
package/node.mjs
CHANGED
|
@@ -653,7 +653,7 @@ var $;
|
|
|
653
653
|
"use strict";
|
|
654
654
|
var $;
|
|
655
655
|
(function ($) {
|
|
656
|
-
const
|
|
656
|
+
const wrappers = new WeakMap();
|
|
657
657
|
class $mol_wire_fiber extends $mol_wire_pub_sub {
|
|
658
658
|
task;
|
|
659
659
|
host;
|
|
@@ -788,13 +788,21 @@ var $;
|
|
|
788
788
|
result = this.task.call(this.host, ...this.args);
|
|
789
789
|
break;
|
|
790
790
|
}
|
|
791
|
-
if ($mol_promise_like(result)
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
791
|
+
if ($mol_promise_like(result)) {
|
|
792
|
+
if (wrappers.has(result)) {
|
|
793
|
+
result = wrappers.get(result).then(a => a);
|
|
794
|
+
}
|
|
795
|
+
else {
|
|
796
|
+
const put = (res) => {
|
|
797
|
+
if (this.cache === result)
|
|
798
|
+
this.put(res);
|
|
799
|
+
return res;
|
|
800
|
+
};
|
|
801
|
+
wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
|
|
802
|
+
wrappers.set(result, result);
|
|
803
|
+
const error = new Error(`Promise in ${this}`);
|
|
804
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
805
|
+
}
|
|
798
806
|
}
|
|
799
807
|
}
|
|
800
808
|
catch (error) {
|
|
@@ -804,21 +812,20 @@ var $;
|
|
|
804
812
|
else {
|
|
805
813
|
result = new Error(String(error), { cause: error });
|
|
806
814
|
}
|
|
807
|
-
if ($mol_promise_like(result)
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
815
|
+
if ($mol_promise_like(result)) {
|
|
816
|
+
if (wrappers.has(result)) {
|
|
817
|
+
result = wrappers.get(result);
|
|
818
|
+
}
|
|
819
|
+
else {
|
|
820
|
+
wrappers.set(result, result = Object.assign(result.finally(() => {
|
|
821
|
+
if (this.cache === result)
|
|
822
|
+
this.absorb();
|
|
823
|
+
}), { destructor: result.destructor || (() => { }) }));
|
|
824
|
+
const error = new Error(`Promise in ${this}`);
|
|
825
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
826
|
+
}
|
|
812
827
|
}
|
|
813
828
|
}
|
|
814
|
-
if ($mol_promise_like(result) && !handled.has(result)) {
|
|
815
|
-
result = Object.assign(result, {
|
|
816
|
-
destructor: result['destructor'] ?? (() => { })
|
|
817
|
-
});
|
|
818
|
-
handled.add(result);
|
|
819
|
-
const error = new Error(`Promise in ${this}`);
|
|
820
|
-
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
821
|
-
}
|
|
822
829
|
if (!$mol_promise_like(result)) {
|
|
823
830
|
this.track_cut();
|
|
824
831
|
}
|
|
@@ -878,6 +885,12 @@ var $;
|
|
|
878
885
|
};
|
|
879
886
|
});
|
|
880
887
|
}
|
|
888
|
+
destructor() {
|
|
889
|
+
super.destructor();
|
|
890
|
+
if ($mol_owning_check(this, this.cache)) {
|
|
891
|
+
this.cache.destructor();
|
|
892
|
+
}
|
|
893
|
+
}
|
|
881
894
|
}
|
|
882
895
|
$.$mol_wire_fiber = $mol_wire_fiber;
|
|
883
896
|
})($ || ($ = {}));
|
|
@@ -902,6 +915,7 @@ var $;
|
|
|
902
915
|
var $;
|
|
903
916
|
(function ($) {
|
|
904
917
|
$.$mol_key_store = new WeakMap();
|
|
918
|
+
const TypedArray = Object.getPrototypeOf(Uint8Array);
|
|
905
919
|
function $mol_key(value) {
|
|
906
920
|
if (typeof value === 'bigint')
|
|
907
921
|
return value.toString() + 'n';
|
|
@@ -931,7 +945,7 @@ var $;
|
|
|
931
945
|
return value;
|
|
932
946
|
if (value instanceof RegExp)
|
|
933
947
|
return value.toString();
|
|
934
|
-
if (value instanceof
|
|
948
|
+
if (value instanceof TypedArray)
|
|
935
949
|
return [...value];
|
|
936
950
|
let key = $.$mol_key_store.get(value);
|
|
937
951
|
if (key)
|
|
@@ -1662,7 +1676,8 @@ var $;
|
|
|
1662
1676
|
$$.$mol_log3_warn({
|
|
1663
1677
|
place: '$mol_wire_task',
|
|
1664
1678
|
message: `Non idempotency`,
|
|
1665
|
-
|
|
1679
|
+
sub,
|
|
1680
|
+
pubs: [...sub?.pub_list ?? [], existen],
|
|
1666
1681
|
next,
|
|
1667
1682
|
hint: 'Ignore it',
|
|
1668
1683
|
});
|
|
@@ -1685,6 +1700,14 @@ var $;
|
|
|
1685
1700
|
this.cursor = $mol_wire_cursor.fresh;
|
|
1686
1701
|
if (next !== prev)
|
|
1687
1702
|
this.emit();
|
|
1703
|
+
if ($mol_owning_catch(this, next)) {
|
|
1704
|
+
try {
|
|
1705
|
+
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
1706
|
+
}
|
|
1707
|
+
catch {
|
|
1708
|
+
Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
|
|
1709
|
+
}
|
|
1710
|
+
}
|
|
1688
1711
|
return next;
|
|
1689
1712
|
}
|
|
1690
1713
|
this.cursor = $mol_wire_cursor.final;
|
|
@@ -1839,10 +1862,6 @@ var $;
|
|
|
1839
1862
|
}
|
|
1840
1863
|
destructor() {
|
|
1841
1864
|
super.destructor();
|
|
1842
|
-
const prev = this.cache;
|
|
1843
|
-
if ($mol_owning_check(this, prev)) {
|
|
1844
|
-
prev.destructor();
|
|
1845
|
-
}
|
|
1846
1865
|
if (this.pub_from === 0) {
|
|
1847
1866
|
;
|
|
1848
1867
|
(this.host ?? this.task)[this.field()] = null;
|
|
@@ -2317,13 +2336,15 @@ var $;
|
|
|
2317
2336
|
class $mol_memo extends $mol_wrapper {
|
|
2318
2337
|
static wrap(task) {
|
|
2319
2338
|
const store = new WeakMap();
|
|
2320
|
-
|
|
2339
|
+
const fun = function (next) {
|
|
2321
2340
|
if (next === undefined && store.has(this))
|
|
2322
2341
|
return store.get(this);
|
|
2323
2342
|
const val = task.call(this, next) ?? next;
|
|
2324
2343
|
store.set(this, val);
|
|
2325
2344
|
return val;
|
|
2326
2345
|
};
|
|
2346
|
+
Reflect.defineProperty(fun, 'name', { value: task.name + ' ' });
|
|
2347
|
+
return fun;
|
|
2327
2348
|
}
|
|
2328
2349
|
}
|
|
2329
2350
|
$.$mol_memo = $mol_memo;
|
|
@@ -3160,7 +3181,6 @@ var $;
|
|
|
3160
3181
|
const win = this.$.$mol_dom_context;
|
|
3161
3182
|
if (win.parent !== win.self && !win.document.hasFocus())
|
|
3162
3183
|
return;
|
|
3163
|
-
this.focused(true);
|
|
3164
3184
|
}
|
|
3165
3185
|
destructor() {
|
|
3166
3186
|
const node = $mol_wire_probe(() => this.dom_node());
|
|
@@ -5562,8 +5582,11 @@ var $;
|
|
|
5562
5582
|
stabilityThreshold: 100,
|
|
5563
5583
|
},
|
|
5564
5584
|
});
|
|
5565
|
-
watcher
|
|
5566
|
-
|
|
5585
|
+
watcher.on('all', (type, path) => {
|
|
5586
|
+
if (path instanceof Error) {
|
|
5587
|
+
this.$.$mol_fail_log(path);
|
|
5588
|
+
return;
|
|
5589
|
+
}
|
|
5567
5590
|
const file = $mol_file.relative(path.replace(/\\/g, '/'));
|
|
5568
5591
|
file.reset();
|
|
5569
5592
|
if (type === 'change') {
|
|
@@ -5572,8 +5595,7 @@ var $;
|
|
|
5572
5595
|
else {
|
|
5573
5596
|
file.parent().reset();
|
|
5574
5597
|
}
|
|
5575
|
-
})
|
|
5576
|
-
.on('error', $mol_fail_log);
|
|
5598
|
+
});
|
|
5577
5599
|
return {
|
|
5578
5600
|
destructor() {
|
|
5579
5601
|
watcher.close();
|
package/node.test.js
CHANGED
|
@@ -644,7 +644,7 @@ var $;
|
|
|
644
644
|
"use strict";
|
|
645
645
|
var $;
|
|
646
646
|
(function ($) {
|
|
647
|
-
const
|
|
647
|
+
const wrappers = new WeakMap();
|
|
648
648
|
class $mol_wire_fiber extends $mol_wire_pub_sub {
|
|
649
649
|
task;
|
|
650
650
|
host;
|
|
@@ -779,13 +779,21 @@ var $;
|
|
|
779
779
|
result = this.task.call(this.host, ...this.args);
|
|
780
780
|
break;
|
|
781
781
|
}
|
|
782
|
-
if ($mol_promise_like(result)
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
782
|
+
if ($mol_promise_like(result)) {
|
|
783
|
+
if (wrappers.has(result)) {
|
|
784
|
+
result = wrappers.get(result).then(a => a);
|
|
785
|
+
}
|
|
786
|
+
else {
|
|
787
|
+
const put = (res) => {
|
|
788
|
+
if (this.cache === result)
|
|
789
|
+
this.put(res);
|
|
790
|
+
return res;
|
|
791
|
+
};
|
|
792
|
+
wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
|
|
793
|
+
wrappers.set(result, result);
|
|
794
|
+
const error = new Error(`Promise in ${this}`);
|
|
795
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
796
|
+
}
|
|
789
797
|
}
|
|
790
798
|
}
|
|
791
799
|
catch (error) {
|
|
@@ -795,21 +803,20 @@ var $;
|
|
|
795
803
|
else {
|
|
796
804
|
result = new Error(String(error), { cause: error });
|
|
797
805
|
}
|
|
798
|
-
if ($mol_promise_like(result)
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
806
|
+
if ($mol_promise_like(result)) {
|
|
807
|
+
if (wrappers.has(result)) {
|
|
808
|
+
result = wrappers.get(result);
|
|
809
|
+
}
|
|
810
|
+
else {
|
|
811
|
+
wrappers.set(result, result = Object.assign(result.finally(() => {
|
|
812
|
+
if (this.cache === result)
|
|
813
|
+
this.absorb();
|
|
814
|
+
}), { destructor: result.destructor || (() => { }) }));
|
|
815
|
+
const error = new Error(`Promise in ${this}`);
|
|
816
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
817
|
+
}
|
|
803
818
|
}
|
|
804
819
|
}
|
|
805
|
-
if ($mol_promise_like(result) && !handled.has(result)) {
|
|
806
|
-
result = Object.assign(result, {
|
|
807
|
-
destructor: result['destructor'] ?? (() => { })
|
|
808
|
-
});
|
|
809
|
-
handled.add(result);
|
|
810
|
-
const error = new Error(`Promise in ${this}`);
|
|
811
|
-
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
812
|
-
}
|
|
813
820
|
if (!$mol_promise_like(result)) {
|
|
814
821
|
this.track_cut();
|
|
815
822
|
}
|
|
@@ -869,6 +876,12 @@ var $;
|
|
|
869
876
|
};
|
|
870
877
|
});
|
|
871
878
|
}
|
|
879
|
+
destructor() {
|
|
880
|
+
super.destructor();
|
|
881
|
+
if ($mol_owning_check(this, this.cache)) {
|
|
882
|
+
this.cache.destructor();
|
|
883
|
+
}
|
|
884
|
+
}
|
|
872
885
|
}
|
|
873
886
|
$.$mol_wire_fiber = $mol_wire_fiber;
|
|
874
887
|
})($ || ($ = {}));
|
|
@@ -893,6 +906,7 @@ var $;
|
|
|
893
906
|
var $;
|
|
894
907
|
(function ($) {
|
|
895
908
|
$.$mol_key_store = new WeakMap();
|
|
909
|
+
const TypedArray = Object.getPrototypeOf(Uint8Array);
|
|
896
910
|
function $mol_key(value) {
|
|
897
911
|
if (typeof value === 'bigint')
|
|
898
912
|
return value.toString() + 'n';
|
|
@@ -922,7 +936,7 @@ var $;
|
|
|
922
936
|
return value;
|
|
923
937
|
if (value instanceof RegExp)
|
|
924
938
|
return value.toString();
|
|
925
|
-
if (value instanceof
|
|
939
|
+
if (value instanceof TypedArray)
|
|
926
940
|
return [...value];
|
|
927
941
|
let key = $.$mol_key_store.get(value);
|
|
928
942
|
if (key)
|
|
@@ -1653,7 +1667,8 @@ var $;
|
|
|
1653
1667
|
$$.$mol_log3_warn({
|
|
1654
1668
|
place: '$mol_wire_task',
|
|
1655
1669
|
message: `Non idempotency`,
|
|
1656
|
-
|
|
1670
|
+
sub,
|
|
1671
|
+
pubs: [...sub?.pub_list ?? [], existen],
|
|
1657
1672
|
next,
|
|
1658
1673
|
hint: 'Ignore it',
|
|
1659
1674
|
});
|
|
@@ -1676,6 +1691,14 @@ var $;
|
|
|
1676
1691
|
this.cursor = $mol_wire_cursor.fresh;
|
|
1677
1692
|
if (next !== prev)
|
|
1678
1693
|
this.emit();
|
|
1694
|
+
if ($mol_owning_catch(this, next)) {
|
|
1695
|
+
try {
|
|
1696
|
+
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
1697
|
+
}
|
|
1698
|
+
catch {
|
|
1699
|
+
Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
|
|
1700
|
+
}
|
|
1701
|
+
}
|
|
1679
1702
|
return next;
|
|
1680
1703
|
}
|
|
1681
1704
|
this.cursor = $mol_wire_cursor.final;
|
|
@@ -1830,10 +1853,6 @@ var $;
|
|
|
1830
1853
|
}
|
|
1831
1854
|
destructor() {
|
|
1832
1855
|
super.destructor();
|
|
1833
|
-
const prev = this.cache;
|
|
1834
|
-
if ($mol_owning_check(this, prev)) {
|
|
1835
|
-
prev.destructor();
|
|
1836
|
-
}
|
|
1837
1856
|
if (this.pub_from === 0) {
|
|
1838
1857
|
;
|
|
1839
1858
|
(this.host ?? this.task)[this.field()] = null;
|
|
@@ -2308,13 +2327,15 @@ var $;
|
|
|
2308
2327
|
class $mol_memo extends $mol_wrapper {
|
|
2309
2328
|
static wrap(task) {
|
|
2310
2329
|
const store = new WeakMap();
|
|
2311
|
-
|
|
2330
|
+
const fun = function (next) {
|
|
2312
2331
|
if (next === undefined && store.has(this))
|
|
2313
2332
|
return store.get(this);
|
|
2314
2333
|
const val = task.call(this, next) ?? next;
|
|
2315
2334
|
store.set(this, val);
|
|
2316
2335
|
return val;
|
|
2317
2336
|
};
|
|
2337
|
+
Reflect.defineProperty(fun, 'name', { value: task.name + ' ' });
|
|
2338
|
+
return fun;
|
|
2318
2339
|
}
|
|
2319
2340
|
}
|
|
2320
2341
|
$.$mol_memo = $mol_memo;
|
|
@@ -3151,7 +3172,6 @@ var $;
|
|
|
3151
3172
|
const win = this.$.$mol_dom_context;
|
|
3152
3173
|
if (win.parent !== win.self && !win.document.hasFocus())
|
|
3153
3174
|
return;
|
|
3154
|
-
this.focused(true);
|
|
3155
3175
|
}
|
|
3156
3176
|
destructor() {
|
|
3157
3177
|
const node = $mol_wire_probe(() => this.dom_node());
|
|
@@ -5553,8 +5573,11 @@ var $;
|
|
|
5553
5573
|
stabilityThreshold: 100,
|
|
5554
5574
|
},
|
|
5555
5575
|
});
|
|
5556
|
-
watcher
|
|
5557
|
-
|
|
5576
|
+
watcher.on('all', (type, path) => {
|
|
5577
|
+
if (path instanceof Error) {
|
|
5578
|
+
this.$.$mol_fail_log(path);
|
|
5579
|
+
return;
|
|
5580
|
+
}
|
|
5558
5581
|
const file = $mol_file.relative(path.replace(/\\/g, '/'));
|
|
5559
5582
|
file.reset();
|
|
5560
5583
|
if (type === 'change') {
|
|
@@ -5563,8 +5586,7 @@ var $;
|
|
|
5563
5586
|
else {
|
|
5564
5587
|
file.parent().reset();
|
|
5565
5588
|
}
|
|
5566
|
-
})
|
|
5567
|
-
.on('error', $mol_fail_log);
|
|
5589
|
+
});
|
|
5568
5590
|
return {
|
|
5569
5591
|
destructor() {
|
|
5570
5592
|
watcher.close();
|
|
@@ -6862,6 +6884,17 @@ var $;
|
|
|
6862
6884
|
;
|
|
6863
6885
|
"use strict";
|
|
6864
6886
|
|
|
6887
|
+
;
|
|
6888
|
+
"use strict";
|
|
6889
|
+
var $;
|
|
6890
|
+
(function ($) {
|
|
6891
|
+
function $mol_dom_serialize(node) {
|
|
6892
|
+
const serializer = new $mol_dom_context.XMLSerializer;
|
|
6893
|
+
return serializer.serializeToString(node);
|
|
6894
|
+
}
|
|
6895
|
+
$.$mol_dom_serialize = $mol_dom_serialize;
|
|
6896
|
+
})($ || ($ = {}));
|
|
6897
|
+
|
|
6865
6898
|
;
|
|
6866
6899
|
"use strict";
|
|
6867
6900
|
var $;
|
|
@@ -7019,6 +7052,19 @@ var $;
|
|
|
7019
7052
|
"!");
|
|
7020
7053
|
$mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
|
|
7021
7054
|
},
|
|
7055
|
+
'Make fragment'() {
|
|
7056
|
+
const dom = $mol_jsx($mol_jsx_frag, null,
|
|
7057
|
+
$mol_jsx("br", null),
|
|
7058
|
+
$mol_jsx("hr", null));
|
|
7059
|
+
$mol_assert_equal($mol_dom_serialize(dom), '<br xmlns="http://www.w3.org/1999/xhtml" /><hr xmlns="http://www.w3.org/1999/xhtml" />');
|
|
7060
|
+
},
|
|
7061
|
+
'Spread fragment'() {
|
|
7062
|
+
const dom = $mol_jsx("div", null,
|
|
7063
|
+
$mol_jsx($mol_jsx_frag, null,
|
|
7064
|
+
$mol_jsx("br", null),
|
|
7065
|
+
$mol_jsx("hr", null)));
|
|
7066
|
+
$mol_assert_equal(dom.outerHTML, '<div><br><hr></div>');
|
|
7067
|
+
},
|
|
7022
7068
|
'Function as component'() {
|
|
7023
7069
|
const Button = (props, target) => {
|
|
7024
7070
|
return $mol_jsx("button", { title: props.hint }, target());
|