hyoo_sync_client 0.0.545 → 0.0.547
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 +29 -27
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +55 -32
- package/node.js.map +1 -1
- package/node.mjs +55 -32
- package/node.test.js +79 -32
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.d.ts +25 -23
- package/web.d.ts.map +1 -1
- package/web.deps.json +1 -1
- package/web.js +49 -28
- package/web.js.map +1 -1
- package/web.mjs +49 -28
- package/web.test.js +24 -0
- package/web.test.js.map +1 -1
package/web.mjs
CHANGED
|
@@ -1256,7 +1256,7 @@ var $;
|
|
|
1256
1256
|
"use strict";
|
|
1257
1257
|
var $;
|
|
1258
1258
|
(function ($) {
|
|
1259
|
-
const
|
|
1259
|
+
const wrappers = new WeakMap();
|
|
1260
1260
|
class $mol_wire_fiber extends $mol_wire_pub_sub {
|
|
1261
1261
|
task;
|
|
1262
1262
|
host;
|
|
@@ -1391,13 +1391,21 @@ var $;
|
|
|
1391
1391
|
result = this.task.call(this.host, ...this.args);
|
|
1392
1392
|
break;
|
|
1393
1393
|
}
|
|
1394
|
-
if ($mol_promise_like(result)
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1394
|
+
if ($mol_promise_like(result)) {
|
|
1395
|
+
if (wrappers.has(result)) {
|
|
1396
|
+
result = wrappers.get(result).then(a => a);
|
|
1397
|
+
}
|
|
1398
|
+
else {
|
|
1399
|
+
const put = (res) => {
|
|
1400
|
+
if (this.cache === result)
|
|
1401
|
+
this.put(res);
|
|
1402
|
+
return res;
|
|
1403
|
+
};
|
|
1404
|
+
wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
|
|
1405
|
+
wrappers.set(result, result);
|
|
1406
|
+
const error = new Error(`Promise in ${this}`);
|
|
1407
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1408
|
+
}
|
|
1401
1409
|
}
|
|
1402
1410
|
}
|
|
1403
1411
|
catch (error) {
|
|
@@ -1407,21 +1415,20 @@ var $;
|
|
|
1407
1415
|
else {
|
|
1408
1416
|
result = new Error(String(error), { cause: error });
|
|
1409
1417
|
}
|
|
1410
|
-
if ($mol_promise_like(result)
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1418
|
+
if ($mol_promise_like(result)) {
|
|
1419
|
+
if (wrappers.has(result)) {
|
|
1420
|
+
result = wrappers.get(result);
|
|
1421
|
+
}
|
|
1422
|
+
else {
|
|
1423
|
+
wrappers.set(result, result = Object.assign(result.finally(() => {
|
|
1424
|
+
if (this.cache === result)
|
|
1425
|
+
this.absorb();
|
|
1426
|
+
}), { destructor: result.destructor || (() => { }) }));
|
|
1427
|
+
const error = new Error(`Promise in ${this}`);
|
|
1428
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1429
|
+
}
|
|
1415
1430
|
}
|
|
1416
1431
|
}
|
|
1417
|
-
if ($mol_promise_like(result) && !handled.has(result)) {
|
|
1418
|
-
result = Object.assign(result, {
|
|
1419
|
-
destructor: result['destructor'] ?? (() => { })
|
|
1420
|
-
});
|
|
1421
|
-
handled.add(result);
|
|
1422
|
-
const error = new Error(`Promise in ${this}`);
|
|
1423
|
-
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1424
|
-
}
|
|
1425
1432
|
if (!$mol_promise_like(result)) {
|
|
1426
1433
|
this.track_cut();
|
|
1427
1434
|
}
|
|
@@ -1481,6 +1488,12 @@ var $;
|
|
|
1481
1488
|
};
|
|
1482
1489
|
});
|
|
1483
1490
|
}
|
|
1491
|
+
destructor() {
|
|
1492
|
+
super.destructor();
|
|
1493
|
+
if ($mol_owning_check(this, this.cache)) {
|
|
1494
|
+
this.cache.destructor();
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1484
1497
|
}
|
|
1485
1498
|
$.$mol_wire_fiber = $mol_wire_fiber;
|
|
1486
1499
|
})($ || ($ = {}));
|
|
@@ -1505,6 +1518,7 @@ var $;
|
|
|
1505
1518
|
var $;
|
|
1506
1519
|
(function ($) {
|
|
1507
1520
|
$.$mol_key_store = new WeakMap();
|
|
1521
|
+
const TypedArray = Object.getPrototypeOf(Uint8Array);
|
|
1508
1522
|
function $mol_key(value) {
|
|
1509
1523
|
if (typeof value === 'bigint')
|
|
1510
1524
|
return value.toString() + 'n';
|
|
@@ -1534,7 +1548,7 @@ var $;
|
|
|
1534
1548
|
return value;
|
|
1535
1549
|
if (value instanceof RegExp)
|
|
1536
1550
|
return value.toString();
|
|
1537
|
-
if (value instanceof
|
|
1551
|
+
if (value instanceof TypedArray)
|
|
1538
1552
|
return [...value];
|
|
1539
1553
|
let key = $.$mol_key_store.get(value);
|
|
1540
1554
|
if (key)
|
|
@@ -1810,7 +1824,8 @@ var $;
|
|
|
1810
1824
|
$$.$mol_log3_warn({
|
|
1811
1825
|
place: '$mol_wire_task',
|
|
1812
1826
|
message: `Non idempotency`,
|
|
1813
|
-
|
|
1827
|
+
sub,
|
|
1828
|
+
pubs: [...sub?.pub_list ?? [], existen],
|
|
1814
1829
|
next,
|
|
1815
1830
|
hint: 'Ignore it',
|
|
1816
1831
|
});
|
|
@@ -1833,6 +1848,14 @@ var $;
|
|
|
1833
1848
|
this.cursor = $mol_wire_cursor.fresh;
|
|
1834
1849
|
if (next !== prev)
|
|
1835
1850
|
this.emit();
|
|
1851
|
+
if ($mol_owning_catch(this, next)) {
|
|
1852
|
+
try {
|
|
1853
|
+
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
1854
|
+
}
|
|
1855
|
+
catch {
|
|
1856
|
+
Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
|
|
1857
|
+
}
|
|
1858
|
+
}
|
|
1836
1859
|
return next;
|
|
1837
1860
|
}
|
|
1838
1861
|
this.cursor = $mol_wire_cursor.final;
|
|
@@ -1987,10 +2010,6 @@ var $;
|
|
|
1987
2010
|
}
|
|
1988
2011
|
destructor() {
|
|
1989
2012
|
super.destructor();
|
|
1990
|
-
const prev = this.cache;
|
|
1991
|
-
if ($mol_owning_check(this, prev)) {
|
|
1992
|
-
prev.destructor();
|
|
1993
|
-
}
|
|
1994
2013
|
if (this.pub_from === 0) {
|
|
1995
2014
|
;
|
|
1996
2015
|
(this.host ?? this.task)[this.field()] = null;
|
|
@@ -2619,13 +2638,15 @@ var $;
|
|
|
2619
2638
|
class $mol_memo extends $mol_wrapper {
|
|
2620
2639
|
static wrap(task) {
|
|
2621
2640
|
const store = new WeakMap();
|
|
2622
|
-
|
|
2641
|
+
const fun = function (next) {
|
|
2623
2642
|
if (next === undefined && store.has(this))
|
|
2624
2643
|
return store.get(this);
|
|
2625
2644
|
const val = task.call(this, next) ?? next;
|
|
2626
2645
|
store.set(this, val);
|
|
2627
2646
|
return val;
|
|
2628
2647
|
};
|
|
2648
|
+
Reflect.defineProperty(fun, 'name', { value: task.name + ' ' });
|
|
2649
|
+
return fun;
|
|
2629
2650
|
}
|
|
2630
2651
|
}
|
|
2631
2652
|
$.$mol_memo = $mol_memo;
|
package/web.test.js
CHANGED
|
@@ -107,6 +107,17 @@ var $;
|
|
|
107
107
|
;
|
|
108
108
|
"use strict";
|
|
109
109
|
|
|
110
|
+
;
|
|
111
|
+
"use strict";
|
|
112
|
+
var $;
|
|
113
|
+
(function ($) {
|
|
114
|
+
function $mol_dom_serialize(node) {
|
|
115
|
+
const serializer = new $mol_dom_context.XMLSerializer;
|
|
116
|
+
return serializer.serializeToString(node);
|
|
117
|
+
}
|
|
118
|
+
$.$mol_dom_serialize = $mol_dom_serialize;
|
|
119
|
+
})($ || ($ = {}));
|
|
120
|
+
|
|
110
121
|
;
|
|
111
122
|
"use strict";
|
|
112
123
|
var $;
|
|
@@ -143,6 +154,19 @@ var $;
|
|
|
143
154
|
"!");
|
|
144
155
|
$mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
|
|
145
156
|
},
|
|
157
|
+
'Make fragment'() {
|
|
158
|
+
const dom = $mol_jsx($mol_jsx_frag, null,
|
|
159
|
+
$mol_jsx("br", null),
|
|
160
|
+
$mol_jsx("hr", null));
|
|
161
|
+
$mol_assert_equal($mol_dom_serialize(dom), '<br xmlns="http://www.w3.org/1999/xhtml" /><hr xmlns="http://www.w3.org/1999/xhtml" />');
|
|
162
|
+
},
|
|
163
|
+
'Spread fragment'() {
|
|
164
|
+
const dom = $mol_jsx("div", null,
|
|
165
|
+
$mol_jsx($mol_jsx_frag, null,
|
|
166
|
+
$mol_jsx("br", null),
|
|
167
|
+
$mol_jsx("hr", null)));
|
|
168
|
+
$mol_assert_equal(dom.outerHTML, '<div><br><hr></div>');
|
|
169
|
+
},
|
|
146
170
|
'Function as component'() {
|
|
147
171
|
const Button = (props, target) => {
|
|
148
172
|
return $mol_jsx("button", { title: props.hint }, target());
|