hyoo_sync_client 0.0.545 → 0.0.546
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/node.mjs
CHANGED
|
@@ -1277,7 +1277,7 @@ var $;
|
|
|
1277
1277
|
"use strict";
|
|
1278
1278
|
var $;
|
|
1279
1279
|
(function ($) {
|
|
1280
|
-
const
|
|
1280
|
+
const wrappers = new WeakMap();
|
|
1281
1281
|
class $mol_wire_fiber extends $mol_wire_pub_sub {
|
|
1282
1282
|
task;
|
|
1283
1283
|
host;
|
|
@@ -1412,13 +1412,21 @@ var $;
|
|
|
1412
1412
|
result = this.task.call(this.host, ...this.args);
|
|
1413
1413
|
break;
|
|
1414
1414
|
}
|
|
1415
|
-
if ($mol_promise_like(result)
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1415
|
+
if ($mol_promise_like(result)) {
|
|
1416
|
+
if (wrappers.has(result)) {
|
|
1417
|
+
result = wrappers.get(result).then(a => a);
|
|
1418
|
+
}
|
|
1419
|
+
else {
|
|
1420
|
+
const put = (res) => {
|
|
1421
|
+
if (this.cache === result)
|
|
1422
|
+
this.put(res);
|
|
1423
|
+
return res;
|
|
1424
|
+
};
|
|
1425
|
+
wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
|
|
1426
|
+
wrappers.set(result, result);
|
|
1427
|
+
const error = new Error(`Promise in ${this}`);
|
|
1428
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1429
|
+
}
|
|
1422
1430
|
}
|
|
1423
1431
|
}
|
|
1424
1432
|
catch (error) {
|
|
@@ -1428,21 +1436,20 @@ var $;
|
|
|
1428
1436
|
else {
|
|
1429
1437
|
result = new Error(String(error), { cause: error });
|
|
1430
1438
|
}
|
|
1431
|
-
if ($mol_promise_like(result)
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1439
|
+
if ($mol_promise_like(result)) {
|
|
1440
|
+
if (wrappers.has(result)) {
|
|
1441
|
+
result = wrappers.get(result);
|
|
1442
|
+
}
|
|
1443
|
+
else {
|
|
1444
|
+
wrappers.set(result, result = Object.assign(result.finally(() => {
|
|
1445
|
+
if (this.cache === result)
|
|
1446
|
+
this.absorb();
|
|
1447
|
+
}), { destructor: result.destructor || (() => { }) }));
|
|
1448
|
+
const error = new Error(`Promise in ${this}`);
|
|
1449
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1450
|
+
}
|
|
1436
1451
|
}
|
|
1437
1452
|
}
|
|
1438
|
-
if ($mol_promise_like(result) && !handled.has(result)) {
|
|
1439
|
-
result = Object.assign(result, {
|
|
1440
|
-
destructor: result['destructor'] ?? (() => { })
|
|
1441
|
-
});
|
|
1442
|
-
handled.add(result);
|
|
1443
|
-
const error = new Error(`Promise in ${this}`);
|
|
1444
|
-
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1445
|
-
}
|
|
1446
1453
|
if (!$mol_promise_like(result)) {
|
|
1447
1454
|
this.track_cut();
|
|
1448
1455
|
}
|
|
@@ -1502,6 +1509,12 @@ var $;
|
|
|
1502
1509
|
};
|
|
1503
1510
|
});
|
|
1504
1511
|
}
|
|
1512
|
+
destructor() {
|
|
1513
|
+
super.destructor();
|
|
1514
|
+
if ($mol_owning_check(this, this.cache)) {
|
|
1515
|
+
this.cache.destructor();
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1505
1518
|
}
|
|
1506
1519
|
$.$mol_wire_fiber = $mol_wire_fiber;
|
|
1507
1520
|
})($ || ($ = {}));
|
|
@@ -1672,7 +1685,8 @@ var $;
|
|
|
1672
1685
|
$$.$mol_log3_warn({
|
|
1673
1686
|
place: '$mol_wire_task',
|
|
1674
1687
|
message: `Non idempotency`,
|
|
1675
|
-
|
|
1688
|
+
sub,
|
|
1689
|
+
pubs: [...sub?.pub_list ?? [], existen],
|
|
1676
1690
|
next,
|
|
1677
1691
|
hint: 'Ignore it',
|
|
1678
1692
|
});
|
|
@@ -1695,6 +1709,14 @@ var $;
|
|
|
1695
1709
|
this.cursor = $mol_wire_cursor.fresh;
|
|
1696
1710
|
if (next !== prev)
|
|
1697
1711
|
this.emit();
|
|
1712
|
+
if ($mol_owning_catch(this, next)) {
|
|
1713
|
+
try {
|
|
1714
|
+
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
|
1715
|
+
}
|
|
1716
|
+
catch {
|
|
1717
|
+
Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
|
|
1718
|
+
}
|
|
1719
|
+
}
|
|
1698
1720
|
return next;
|
|
1699
1721
|
}
|
|
1700
1722
|
this.cursor = $mol_wire_cursor.final;
|
|
@@ -2454,6 +2476,7 @@ var $;
|
|
|
2454
2476
|
var $;
|
|
2455
2477
|
(function ($) {
|
|
2456
2478
|
$.$mol_key_store = new WeakMap();
|
|
2479
|
+
const TypedArray = Object.getPrototypeOf(Uint8Array);
|
|
2457
2480
|
function $mol_key(value) {
|
|
2458
2481
|
if (typeof value === 'bigint')
|
|
2459
2482
|
return value.toString() + 'n';
|
|
@@ -2483,7 +2506,7 @@ var $;
|
|
|
2483
2506
|
return value;
|
|
2484
2507
|
if (value instanceof RegExp)
|
|
2485
2508
|
return value.toString();
|
|
2486
|
-
if (value instanceof
|
|
2509
|
+
if (value instanceof TypedArray)
|
|
2487
2510
|
return [...value];
|
|
2488
2511
|
let key = $.$mol_key_store.get(value);
|
|
2489
2512
|
if (key)
|
|
@@ -2639,10 +2662,6 @@ var $;
|
|
|
2639
2662
|
}
|
|
2640
2663
|
destructor() {
|
|
2641
2664
|
super.destructor();
|
|
2642
|
-
const prev = this.cache;
|
|
2643
|
-
if ($mol_owning_check(this, prev)) {
|
|
2644
|
-
prev.destructor();
|
|
2645
|
-
}
|
|
2646
2665
|
if (this.pub_from === 0) {
|
|
2647
2666
|
;
|
|
2648
2667
|
(this.host ?? this.task)[this.field()] = null;
|
|
@@ -3194,8 +3213,11 @@ var $;
|
|
|
3194
3213
|
stabilityThreshold: 100,
|
|
3195
3214
|
},
|
|
3196
3215
|
});
|
|
3197
|
-
watcher
|
|
3198
|
-
|
|
3216
|
+
watcher.on('all', (type, path) => {
|
|
3217
|
+
if (path instanceof Error) {
|
|
3218
|
+
this.$.$mol_fail_log(path);
|
|
3219
|
+
return;
|
|
3220
|
+
}
|
|
3199
3221
|
const file = $mol_file.relative(path.replace(/\\/g, '/'));
|
|
3200
3222
|
file.reset();
|
|
3201
3223
|
if (type === 'change') {
|
|
@@ -3204,8 +3226,7 @@ var $;
|
|
|
3204
3226
|
else {
|
|
3205
3227
|
file.parent().reset();
|
|
3206
3228
|
}
|
|
3207
|
-
})
|
|
3208
|
-
.on('error', $mol_fail_log);
|
|
3229
|
+
});
|
|
3209
3230
|
return {
|
|
3210
3231
|
destructor() {
|
|
3211
3232
|
watcher.close();
|
|
@@ -3434,13 +3455,15 @@ var $;
|
|
|
3434
3455
|
class $mol_memo extends $mol_wrapper {
|
|
3435
3456
|
static wrap(task) {
|
|
3436
3457
|
const store = new WeakMap();
|
|
3437
|
-
|
|
3458
|
+
const fun = function (next) {
|
|
3438
3459
|
if (next === undefined && store.has(this))
|
|
3439
3460
|
return store.get(this);
|
|
3440
3461
|
const val = task.call(this, next) ?? next;
|
|
3441
3462
|
store.set(this, val);
|
|
3442
3463
|
return val;
|
|
3443
3464
|
};
|
|
3465
|
+
Reflect.defineProperty(fun, 'name', { value: task.name + ' ' });
|
|
3466
|
+
return fun;
|
|
3444
3467
|
}
|
|
3445
3468
|
}
|
|
3446
3469
|
$.$mol_memo = $mol_memo;
|
package/node.test.js
CHANGED
|
@@ -1268,7 +1268,7 @@ var $;
|
|
|
1268
1268
|
"use strict";
|
|
1269
1269
|
var $;
|
|
1270
1270
|
(function ($) {
|
|
1271
|
-
const
|
|
1271
|
+
const wrappers = new WeakMap();
|
|
1272
1272
|
class $mol_wire_fiber extends $mol_wire_pub_sub {
|
|
1273
1273
|
task;
|
|
1274
1274
|
host;
|
|
@@ -1403,13 +1403,21 @@ var $;
|
|
|
1403
1403
|
result = this.task.call(this.host, ...this.args);
|
|
1404
1404
|
break;
|
|
1405
1405
|
}
|
|
1406
|
-
if ($mol_promise_like(result)
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1406
|
+
if ($mol_promise_like(result)) {
|
|
1407
|
+
if (wrappers.has(result)) {
|
|
1408
|
+
result = wrappers.get(result).then(a => a);
|
|
1409
|
+
}
|
|
1410
|
+
else {
|
|
1411
|
+
const put = (res) => {
|
|
1412
|
+
if (this.cache === result)
|
|
1413
|
+
this.put(res);
|
|
1414
|
+
return res;
|
|
1415
|
+
};
|
|
1416
|
+
wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
|
|
1417
|
+
wrappers.set(result, result);
|
|
1418
|
+
const error = new Error(`Promise in ${this}`);
|
|
1419
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1420
|
+
}
|
|
1413
1421
|
}
|
|
1414
1422
|
}
|
|
1415
1423
|
catch (error) {
|
|
@@ -1419,21 +1427,20 @@ var $;
|
|
|
1419
1427
|
else {
|
|
1420
1428
|
result = new Error(String(error), { cause: error });
|
|
1421
1429
|
}
|
|
1422
|
-
if ($mol_promise_like(result)
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1430
|
+
if ($mol_promise_like(result)) {
|
|
1431
|
+
if (wrappers.has(result)) {
|
|
1432
|
+
result = wrappers.get(result);
|
|
1433
|
+
}
|
|
1434
|
+
else {
|
|
1435
|
+
wrappers.set(result, result = Object.assign(result.finally(() => {
|
|
1436
|
+
if (this.cache === result)
|
|
1437
|
+
this.absorb();
|
|
1438
|
+
}), { destructor: result.destructor || (() => { }) }));
|
|
1439
|
+
const error = new Error(`Promise in ${this}`);
|
|
1440
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1441
|
+
}
|
|
1427
1442
|
}
|
|
1428
1443
|
}
|
|
1429
|
-
if ($mol_promise_like(result) && !handled.has(result)) {
|
|
1430
|
-
result = Object.assign(result, {
|
|
1431
|
-
destructor: result['destructor'] ?? (() => { })
|
|
1432
|
-
});
|
|
1433
|
-
handled.add(result);
|
|
1434
|
-
const error = new Error(`Promise in ${this}`);
|
|
1435
|
-
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
|
1436
|
-
}
|
|
1437
1444
|
if (!$mol_promise_like(result)) {
|
|
1438
1445
|
this.track_cut();
|
|
1439
1446
|
}
|
|
@@ -1493,6 +1500,12 @@ var $;
|
|
|
1493
1500
|
};
|
|
1494
1501
|
});
|
|
1495
1502
|
}
|
|
1503
|
+
destructor() {
|
|
1504
|
+
super.destructor();
|
|
1505
|
+
if ($mol_owning_check(this, this.cache)) {
|
|
1506
|
+
this.cache.destructor();
|
|
1507
|
+
}
|
|
1508
|
+
}
|
|
1496
1509
|
}
|
|
1497
1510
|
$.$mol_wire_fiber = $mol_wire_fiber;
|
|
1498
1511
|
})($ || ($ = {}));
|
|
@@ -1663,7 +1676,8 @@ var $;
|
|
|
1663
1676
|
$$.$mol_log3_warn({
|
|
1664
1677
|
place: '$mol_wire_task',
|
|
1665
1678
|
message: `Non idempotency`,
|
|
1666
|
-
|
|
1679
|
+
sub,
|
|
1680
|
+
pubs: [...sub?.pub_list ?? [], existen],
|
|
1667
1681
|
next,
|
|
1668
1682
|
hint: 'Ignore it',
|
|
1669
1683
|
});
|
|
@@ -1686,6 +1700,14 @@ var $;
|
|
|
1686
1700
|
this.cursor = $mol_wire_cursor.fresh;
|
|
1687
1701
|
if (next !== prev)
|
|
1688
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
|
+
}
|
|
1689
1711
|
return next;
|
|
1690
1712
|
}
|
|
1691
1713
|
this.cursor = $mol_wire_cursor.final;
|
|
@@ -2445,6 +2467,7 @@ var $;
|
|
|
2445
2467
|
var $;
|
|
2446
2468
|
(function ($) {
|
|
2447
2469
|
$.$mol_key_store = new WeakMap();
|
|
2470
|
+
const TypedArray = Object.getPrototypeOf(Uint8Array);
|
|
2448
2471
|
function $mol_key(value) {
|
|
2449
2472
|
if (typeof value === 'bigint')
|
|
2450
2473
|
return value.toString() + 'n';
|
|
@@ -2474,7 +2497,7 @@ var $;
|
|
|
2474
2497
|
return value;
|
|
2475
2498
|
if (value instanceof RegExp)
|
|
2476
2499
|
return value.toString();
|
|
2477
|
-
if (value instanceof
|
|
2500
|
+
if (value instanceof TypedArray)
|
|
2478
2501
|
return [...value];
|
|
2479
2502
|
let key = $.$mol_key_store.get(value);
|
|
2480
2503
|
if (key)
|
|
@@ -2630,10 +2653,6 @@ var $;
|
|
|
2630
2653
|
}
|
|
2631
2654
|
destructor() {
|
|
2632
2655
|
super.destructor();
|
|
2633
|
-
const prev = this.cache;
|
|
2634
|
-
if ($mol_owning_check(this, prev)) {
|
|
2635
|
-
prev.destructor();
|
|
2636
|
-
}
|
|
2637
2656
|
if (this.pub_from === 0) {
|
|
2638
2657
|
;
|
|
2639
2658
|
(this.host ?? this.task)[this.field()] = null;
|
|
@@ -3185,8 +3204,11 @@ var $;
|
|
|
3185
3204
|
stabilityThreshold: 100,
|
|
3186
3205
|
},
|
|
3187
3206
|
});
|
|
3188
|
-
watcher
|
|
3189
|
-
|
|
3207
|
+
watcher.on('all', (type, path) => {
|
|
3208
|
+
if (path instanceof Error) {
|
|
3209
|
+
this.$.$mol_fail_log(path);
|
|
3210
|
+
return;
|
|
3211
|
+
}
|
|
3190
3212
|
const file = $mol_file.relative(path.replace(/\\/g, '/'));
|
|
3191
3213
|
file.reset();
|
|
3192
3214
|
if (type === 'change') {
|
|
@@ -3195,8 +3217,7 @@ var $;
|
|
|
3195
3217
|
else {
|
|
3196
3218
|
file.parent().reset();
|
|
3197
3219
|
}
|
|
3198
|
-
})
|
|
3199
|
-
.on('error', $mol_fail_log);
|
|
3220
|
+
});
|
|
3200
3221
|
return {
|
|
3201
3222
|
destructor() {
|
|
3202
3223
|
watcher.close();
|
|
@@ -3425,13 +3446,15 @@ var $;
|
|
|
3425
3446
|
class $mol_memo extends $mol_wrapper {
|
|
3426
3447
|
static wrap(task) {
|
|
3427
3448
|
const store = new WeakMap();
|
|
3428
|
-
|
|
3449
|
+
const fun = function (next) {
|
|
3429
3450
|
if (next === undefined && store.has(this))
|
|
3430
3451
|
return store.get(this);
|
|
3431
3452
|
const val = task.call(this, next) ?? next;
|
|
3432
3453
|
store.set(this, val);
|
|
3433
3454
|
return val;
|
|
3434
3455
|
};
|
|
3456
|
+
Reflect.defineProperty(fun, 'name', { value: task.name + ' ' });
|
|
3457
|
+
return fun;
|
|
3435
3458
|
}
|
|
3436
3459
|
}
|
|
3437
3460
|
$.$mol_memo = $mol_memo;
|
|
@@ -5478,6 +5501,17 @@ var $;
|
|
|
5478
5501
|
;
|
|
5479
5502
|
"use strict";
|
|
5480
5503
|
|
|
5504
|
+
;
|
|
5505
|
+
"use strict";
|
|
5506
|
+
var $;
|
|
5507
|
+
(function ($) {
|
|
5508
|
+
function $mol_dom_serialize(node) {
|
|
5509
|
+
const serializer = new $mol_dom_context.XMLSerializer;
|
|
5510
|
+
return serializer.serializeToString(node);
|
|
5511
|
+
}
|
|
5512
|
+
$.$mol_dom_serialize = $mol_dom_serialize;
|
|
5513
|
+
})($ || ($ = {}));
|
|
5514
|
+
|
|
5481
5515
|
;
|
|
5482
5516
|
"use strict";
|
|
5483
5517
|
var $;
|
|
@@ -5635,6 +5669,19 @@ var $;
|
|
|
5635
5669
|
"!");
|
|
5636
5670
|
$mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
|
|
5637
5671
|
},
|
|
5672
|
+
'Make fragment'() {
|
|
5673
|
+
const dom = $mol_jsx($mol_jsx_frag, null,
|
|
5674
|
+
$mol_jsx("br", null),
|
|
5675
|
+
$mol_jsx("hr", null));
|
|
5676
|
+
$mol_assert_equal($mol_dom_serialize(dom), '<br xmlns="http://www.w3.org/1999/xhtml" /><hr xmlns="http://www.w3.org/1999/xhtml" />');
|
|
5677
|
+
},
|
|
5678
|
+
'Spread fragment'() {
|
|
5679
|
+
const dom = $mol_jsx("div", null,
|
|
5680
|
+
$mol_jsx($mol_jsx_frag, null,
|
|
5681
|
+
$mol_jsx("br", null),
|
|
5682
|
+
$mol_jsx("hr", null)));
|
|
5683
|
+
$mol_assert_equal(dom.outerHTML, '<div><br><hr></div>');
|
|
5684
|
+
},
|
|
5638
5685
|
'Function as component'() {
|
|
5639
5686
|
const Button = (props, target) => {
|
|
5640
5687
|
return $mol_jsx("button", { title: props.hint }, target());
|