mol_crypto_lib 0.1.1331 → 0.1.1332
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 +28 -26
- package/node.d.ts.map +1 -1
- package/node.deps.json +1 -1
- package/node.js +47 -23
- package/node.js.map +1 -1
- package/node.mjs +47 -23
- package/node.test.js +71 -23
- package/node.test.js.map +1 -1
- package/package.json +1 -1
- package/web.d.ts +22 -22
- package/web.deps.json +1 -1
- package/web.js +3 -1
- package/web.js.map +1 -1
- package/web.mjs +3 -1
- package/web.test.js +24 -0
- package/web.test.js.map +1 -1
package/node.mjs
CHANGED
@@ -1270,7 +1270,7 @@ var $;
|
|
1270
1270
|
"use strict";
|
1271
1271
|
var $;
|
1272
1272
|
(function ($) {
|
1273
|
-
const
|
1273
|
+
const wrappers = new WeakMap();
|
1274
1274
|
class $mol_wire_fiber extends $mol_wire_pub_sub {
|
1275
1275
|
task;
|
1276
1276
|
host;
|
@@ -1405,13 +1405,21 @@ var $;
|
|
1405
1405
|
result = this.task.call(this.host, ...this.args);
|
1406
1406
|
break;
|
1407
1407
|
}
|
1408
|
-
if ($mol_promise_like(result)
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1408
|
+
if ($mol_promise_like(result)) {
|
1409
|
+
if (wrappers.has(result)) {
|
1410
|
+
result = wrappers.get(result).then(a => a);
|
1411
|
+
}
|
1412
|
+
else {
|
1413
|
+
const put = (res) => {
|
1414
|
+
if (this.cache === result)
|
1415
|
+
this.put(res);
|
1416
|
+
return res;
|
1417
|
+
};
|
1418
|
+
wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
|
1419
|
+
wrappers.set(result, result);
|
1420
|
+
const error = new Error(`Promise in ${this}`);
|
1421
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
1422
|
+
}
|
1415
1423
|
}
|
1416
1424
|
}
|
1417
1425
|
catch (error) {
|
@@ -1421,21 +1429,20 @@ var $;
|
|
1421
1429
|
else {
|
1422
1430
|
result = new Error(String(error), { cause: error });
|
1423
1431
|
}
|
1424
|
-
if ($mol_promise_like(result)
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1432
|
+
if ($mol_promise_like(result)) {
|
1433
|
+
if (wrappers.has(result)) {
|
1434
|
+
result = wrappers.get(result);
|
1435
|
+
}
|
1436
|
+
else {
|
1437
|
+
wrappers.set(result, result = Object.assign(result.finally(() => {
|
1438
|
+
if (this.cache === result)
|
1439
|
+
this.absorb();
|
1440
|
+
}), { destructor: result.destructor || (() => { }) }));
|
1441
|
+
const error = new Error(`Promise in ${this}`);
|
1442
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
1443
|
+
}
|
1429
1444
|
}
|
1430
1445
|
}
|
1431
|
-
if ($mol_promise_like(result) && !handled.has(result)) {
|
1432
|
-
result = Object.assign(result, {
|
1433
|
-
destructor: result['destructor'] ?? (() => { })
|
1434
|
-
});
|
1435
|
-
handled.add(result);
|
1436
|
-
const error = new Error(`Promise in ${this}`);
|
1437
|
-
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
1438
|
-
}
|
1439
1446
|
if (!$mol_promise_like(result)) {
|
1440
1447
|
this.track_cut();
|
1441
1448
|
}
|
@@ -1495,6 +1502,12 @@ var $;
|
|
1495
1502
|
};
|
1496
1503
|
});
|
1497
1504
|
}
|
1505
|
+
destructor() {
|
1506
|
+
super.destructor();
|
1507
|
+
if ($mol_owning_check(this, this.cache)) {
|
1508
|
+
this.cache.destructor();
|
1509
|
+
}
|
1510
|
+
}
|
1498
1511
|
}
|
1499
1512
|
$.$mol_wire_fiber = $mol_wire_fiber;
|
1500
1513
|
})($ || ($ = {}));
|
@@ -1665,7 +1678,8 @@ var $;
|
|
1665
1678
|
$$.$mol_log3_warn({
|
1666
1679
|
place: '$mol_wire_task',
|
1667
1680
|
message: `Non idempotency`,
|
1668
|
-
|
1681
|
+
sub,
|
1682
|
+
pubs: [...sub?.pub_list ?? [], existen],
|
1669
1683
|
next,
|
1670
1684
|
hint: 'Ignore it',
|
1671
1685
|
});
|
@@ -1688,6 +1702,14 @@ var $;
|
|
1688
1702
|
this.cursor = $mol_wire_cursor.fresh;
|
1689
1703
|
if (next !== prev)
|
1690
1704
|
this.emit();
|
1705
|
+
if ($mol_owning_catch(this, next)) {
|
1706
|
+
try {
|
1707
|
+
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
1708
|
+
}
|
1709
|
+
catch {
|
1710
|
+
Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
|
1711
|
+
}
|
1712
|
+
}
|
1691
1713
|
return next;
|
1692
1714
|
}
|
1693
1715
|
this.cursor = $mol_wire_cursor.final;
|
@@ -2238,13 +2260,15 @@ var $;
|
|
2238
2260
|
class $mol_memo extends $mol_wrapper {
|
2239
2261
|
static wrap(task) {
|
2240
2262
|
const store = new WeakMap();
|
2241
|
-
|
2263
|
+
const fun = function (next) {
|
2242
2264
|
if (next === undefined && store.has(this))
|
2243
2265
|
return store.get(this);
|
2244
2266
|
const val = task.call(this, next) ?? next;
|
2245
2267
|
store.set(this, val);
|
2246
2268
|
return val;
|
2247
2269
|
};
|
2270
|
+
Reflect.defineProperty(fun, 'name', { value: task.name + ' ' });
|
2271
|
+
return fun;
|
2248
2272
|
}
|
2249
2273
|
}
|
2250
2274
|
$.$mol_memo = $mol_memo;
|
package/node.test.js
CHANGED
@@ -1261,7 +1261,7 @@ var $;
|
|
1261
1261
|
"use strict";
|
1262
1262
|
var $;
|
1263
1263
|
(function ($) {
|
1264
|
-
const
|
1264
|
+
const wrappers = new WeakMap();
|
1265
1265
|
class $mol_wire_fiber extends $mol_wire_pub_sub {
|
1266
1266
|
task;
|
1267
1267
|
host;
|
@@ -1396,13 +1396,21 @@ var $;
|
|
1396
1396
|
result = this.task.call(this.host, ...this.args);
|
1397
1397
|
break;
|
1398
1398
|
}
|
1399
|
-
if ($mol_promise_like(result)
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1399
|
+
if ($mol_promise_like(result)) {
|
1400
|
+
if (wrappers.has(result)) {
|
1401
|
+
result = wrappers.get(result).then(a => a);
|
1402
|
+
}
|
1403
|
+
else {
|
1404
|
+
const put = (res) => {
|
1405
|
+
if (this.cache === result)
|
1406
|
+
this.put(res);
|
1407
|
+
return res;
|
1408
|
+
};
|
1409
|
+
wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
|
1410
|
+
wrappers.set(result, result);
|
1411
|
+
const error = new Error(`Promise in ${this}`);
|
1412
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
1413
|
+
}
|
1406
1414
|
}
|
1407
1415
|
}
|
1408
1416
|
catch (error) {
|
@@ -1412,21 +1420,20 @@ var $;
|
|
1412
1420
|
else {
|
1413
1421
|
result = new Error(String(error), { cause: error });
|
1414
1422
|
}
|
1415
|
-
if ($mol_promise_like(result)
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1423
|
+
if ($mol_promise_like(result)) {
|
1424
|
+
if (wrappers.has(result)) {
|
1425
|
+
result = wrappers.get(result);
|
1426
|
+
}
|
1427
|
+
else {
|
1428
|
+
wrappers.set(result, result = Object.assign(result.finally(() => {
|
1429
|
+
if (this.cache === result)
|
1430
|
+
this.absorb();
|
1431
|
+
}), { destructor: result.destructor || (() => { }) }));
|
1432
|
+
const error = new Error(`Promise in ${this}`);
|
1433
|
+
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
1434
|
+
}
|
1420
1435
|
}
|
1421
1436
|
}
|
1422
|
-
if ($mol_promise_like(result) && !handled.has(result)) {
|
1423
|
-
result = Object.assign(result, {
|
1424
|
-
destructor: result['destructor'] ?? (() => { })
|
1425
|
-
});
|
1426
|
-
handled.add(result);
|
1427
|
-
const error = new Error(`Promise in ${this}`);
|
1428
|
-
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
1429
|
-
}
|
1430
1437
|
if (!$mol_promise_like(result)) {
|
1431
1438
|
this.track_cut();
|
1432
1439
|
}
|
@@ -1486,6 +1493,12 @@ var $;
|
|
1486
1493
|
};
|
1487
1494
|
});
|
1488
1495
|
}
|
1496
|
+
destructor() {
|
1497
|
+
super.destructor();
|
1498
|
+
if ($mol_owning_check(this, this.cache)) {
|
1499
|
+
this.cache.destructor();
|
1500
|
+
}
|
1501
|
+
}
|
1489
1502
|
}
|
1490
1503
|
$.$mol_wire_fiber = $mol_wire_fiber;
|
1491
1504
|
})($ || ($ = {}));
|
@@ -1656,7 +1669,8 @@ var $;
|
|
1656
1669
|
$$.$mol_log3_warn({
|
1657
1670
|
place: '$mol_wire_task',
|
1658
1671
|
message: `Non idempotency`,
|
1659
|
-
|
1672
|
+
sub,
|
1673
|
+
pubs: [...sub?.pub_list ?? [], existen],
|
1660
1674
|
next,
|
1661
1675
|
hint: 'Ignore it',
|
1662
1676
|
});
|
@@ -1679,6 +1693,14 @@ var $;
|
|
1679
1693
|
this.cursor = $mol_wire_cursor.fresh;
|
1680
1694
|
if (next !== prev)
|
1681
1695
|
this.emit();
|
1696
|
+
if ($mol_owning_catch(this, next)) {
|
1697
|
+
try {
|
1698
|
+
next[Symbol.toStringTag] = this[Symbol.toStringTag];
|
1699
|
+
}
|
1700
|
+
catch {
|
1701
|
+
Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
|
1702
|
+
}
|
1703
|
+
}
|
1682
1704
|
return next;
|
1683
1705
|
}
|
1684
1706
|
this.cursor = $mol_wire_cursor.final;
|
@@ -2229,13 +2251,15 @@ var $;
|
|
2229
2251
|
class $mol_memo extends $mol_wrapper {
|
2230
2252
|
static wrap(task) {
|
2231
2253
|
const store = new WeakMap();
|
2232
|
-
|
2254
|
+
const fun = function (next) {
|
2233
2255
|
if (next === undefined && store.has(this))
|
2234
2256
|
return store.get(this);
|
2235
2257
|
const val = task.call(this, next) ?? next;
|
2236
2258
|
store.set(this, val);
|
2237
2259
|
return val;
|
2238
2260
|
};
|
2261
|
+
Reflect.defineProperty(fun, 'name', { value: task.name + ' ' });
|
2262
|
+
return fun;
|
2239
2263
|
}
|
2240
2264
|
}
|
2241
2265
|
$.$mol_memo = $mol_memo;
|
@@ -3242,6 +3266,17 @@ var $;
|
|
3242
3266
|
;
|
3243
3267
|
"use strict";
|
3244
3268
|
|
3269
|
+
;
|
3270
|
+
"use strict";
|
3271
|
+
var $;
|
3272
|
+
(function ($) {
|
3273
|
+
function $mol_dom_serialize(node) {
|
3274
|
+
const serializer = new $mol_dom_context.XMLSerializer;
|
3275
|
+
return serializer.serializeToString(node);
|
3276
|
+
}
|
3277
|
+
$.$mol_dom_serialize = $mol_dom_serialize;
|
3278
|
+
})($ || ($ = {}));
|
3279
|
+
|
3245
3280
|
;
|
3246
3281
|
"use strict";
|
3247
3282
|
var $;
|
@@ -3399,6 +3434,19 @@ var $;
|
|
3399
3434
|
"!");
|
3400
3435
|
$mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
|
3401
3436
|
},
|
3437
|
+
'Make fragment'() {
|
3438
|
+
const dom = $mol_jsx($mol_jsx_frag, null,
|
3439
|
+
$mol_jsx("br", null),
|
3440
|
+
$mol_jsx("hr", null));
|
3441
|
+
$mol_assert_equal($mol_dom_serialize(dom), '<br xmlns="http://www.w3.org/1999/xhtml" /><hr xmlns="http://www.w3.org/1999/xhtml" />');
|
3442
|
+
},
|
3443
|
+
'Spread fragment'() {
|
3444
|
+
const dom = $mol_jsx("div", null,
|
3445
|
+
$mol_jsx($mol_jsx_frag, null,
|
3446
|
+
$mol_jsx("br", null),
|
3447
|
+
$mol_jsx("hr", null)));
|
3448
|
+
$mol_assert_equal(dom.outerHTML, '<div><br><hr></div>');
|
3449
|
+
},
|
3402
3450
|
'Function as component'() {
|
3403
3451
|
const Button = (props, target) => {
|
3404
3452
|
return $mol_jsx("button", { title: props.hint }, target());
|