mol_crypto_lib 0.1.1330 → 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 -25
- package/node.js.map +1 -1
- package/node.mjs +47 -25
- package/node.test.js +71 -25
- 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,14 +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
|
-
|
1415
|
-
|
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
|
+
}
|
1416
1423
|
}
|
1417
1424
|
}
|
1418
1425
|
catch (error) {
|
@@ -1422,22 +1429,20 @@ var $;
|
|
1422
1429
|
else {
|
1423
1430
|
result = new Error(String(error), { cause: error });
|
1424
1431
|
}
|
1425
|
-
if ($mol_promise_like(result)
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
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
|
+
}
|
1431
1444
|
}
|
1432
1445
|
}
|
1433
|
-
if ($mol_promise_like(result) && !handled.has(result)) {
|
1434
|
-
result = Object.assign(result, {
|
1435
|
-
destructor: result['destructor'] ?? (() => { })
|
1436
|
-
});
|
1437
|
-
handled.add(result);
|
1438
|
-
const error = new Error(`Promise in ${this}`);
|
1439
|
-
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
1440
|
-
}
|
1441
1446
|
if (!$mol_promise_like(result)) {
|
1442
1447
|
this.track_cut();
|
1443
1448
|
}
|
@@ -1497,6 +1502,12 @@ var $;
|
|
1497
1502
|
};
|
1498
1503
|
});
|
1499
1504
|
}
|
1505
|
+
destructor() {
|
1506
|
+
super.destructor();
|
1507
|
+
if ($mol_owning_check(this, this.cache)) {
|
1508
|
+
this.cache.destructor();
|
1509
|
+
}
|
1510
|
+
}
|
1500
1511
|
}
|
1501
1512
|
$.$mol_wire_fiber = $mol_wire_fiber;
|
1502
1513
|
})($ || ($ = {}));
|
@@ -1667,7 +1678,8 @@ var $;
|
|
1667
1678
|
$$.$mol_log3_warn({
|
1668
1679
|
place: '$mol_wire_task',
|
1669
1680
|
message: `Non idempotency`,
|
1670
|
-
|
1681
|
+
sub,
|
1682
|
+
pubs: [...sub?.pub_list ?? [], existen],
|
1671
1683
|
next,
|
1672
1684
|
hint: 'Ignore it',
|
1673
1685
|
});
|
@@ -1690,6 +1702,14 @@ var $;
|
|
1690
1702
|
this.cursor = $mol_wire_cursor.fresh;
|
1691
1703
|
if (next !== prev)
|
1692
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
|
+
}
|
1693
1713
|
return next;
|
1694
1714
|
}
|
1695
1715
|
this.cursor = $mol_wire_cursor.final;
|
@@ -2240,13 +2260,15 @@ var $;
|
|
2240
2260
|
class $mol_memo extends $mol_wrapper {
|
2241
2261
|
static wrap(task) {
|
2242
2262
|
const store = new WeakMap();
|
2243
|
-
|
2263
|
+
const fun = function (next) {
|
2244
2264
|
if (next === undefined && store.has(this))
|
2245
2265
|
return store.get(this);
|
2246
2266
|
const val = task.call(this, next) ?? next;
|
2247
2267
|
store.set(this, val);
|
2248
2268
|
return val;
|
2249
2269
|
};
|
2270
|
+
Reflect.defineProperty(fun, 'name', { value: task.name + ' ' });
|
2271
|
+
return fun;
|
2250
2272
|
}
|
2251
2273
|
}
|
2252
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,14 +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
|
-
|
1406
|
-
|
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
|
+
}
|
1407
1414
|
}
|
1408
1415
|
}
|
1409
1416
|
catch (error) {
|
@@ -1413,22 +1420,20 @@ var $;
|
|
1413
1420
|
else {
|
1414
1421
|
result = new Error(String(error), { cause: error });
|
1415
1422
|
}
|
1416
|
-
if ($mol_promise_like(result)
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
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
|
+
}
|
1422
1435
|
}
|
1423
1436
|
}
|
1424
|
-
if ($mol_promise_like(result) && !handled.has(result)) {
|
1425
|
-
result = Object.assign(result, {
|
1426
|
-
destructor: result['destructor'] ?? (() => { })
|
1427
|
-
});
|
1428
|
-
handled.add(result);
|
1429
|
-
const error = new Error(`Promise in ${this}`);
|
1430
|
-
Object.defineProperty(result, 'stack', { get: () => error.stack });
|
1431
|
-
}
|
1432
1437
|
if (!$mol_promise_like(result)) {
|
1433
1438
|
this.track_cut();
|
1434
1439
|
}
|
@@ -1488,6 +1493,12 @@ var $;
|
|
1488
1493
|
};
|
1489
1494
|
});
|
1490
1495
|
}
|
1496
|
+
destructor() {
|
1497
|
+
super.destructor();
|
1498
|
+
if ($mol_owning_check(this, this.cache)) {
|
1499
|
+
this.cache.destructor();
|
1500
|
+
}
|
1501
|
+
}
|
1491
1502
|
}
|
1492
1503
|
$.$mol_wire_fiber = $mol_wire_fiber;
|
1493
1504
|
})($ || ($ = {}));
|
@@ -1658,7 +1669,8 @@ var $;
|
|
1658
1669
|
$$.$mol_log3_warn({
|
1659
1670
|
place: '$mol_wire_task',
|
1660
1671
|
message: `Non idempotency`,
|
1661
|
-
|
1672
|
+
sub,
|
1673
|
+
pubs: [...sub?.pub_list ?? [], existen],
|
1662
1674
|
next,
|
1663
1675
|
hint: 'Ignore it',
|
1664
1676
|
});
|
@@ -1681,6 +1693,14 @@ var $;
|
|
1681
1693
|
this.cursor = $mol_wire_cursor.fresh;
|
1682
1694
|
if (next !== prev)
|
1683
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
|
+
}
|
1684
1704
|
return next;
|
1685
1705
|
}
|
1686
1706
|
this.cursor = $mol_wire_cursor.final;
|
@@ -2231,13 +2251,15 @@ var $;
|
|
2231
2251
|
class $mol_memo extends $mol_wrapper {
|
2232
2252
|
static wrap(task) {
|
2233
2253
|
const store = new WeakMap();
|
2234
|
-
|
2254
|
+
const fun = function (next) {
|
2235
2255
|
if (next === undefined && store.has(this))
|
2236
2256
|
return store.get(this);
|
2237
2257
|
const val = task.call(this, next) ?? next;
|
2238
2258
|
store.set(this, val);
|
2239
2259
|
return val;
|
2240
2260
|
};
|
2261
|
+
Reflect.defineProperty(fun, 'name', { value: task.name + ' ' });
|
2262
|
+
return fun;
|
2241
2263
|
}
|
2242
2264
|
}
|
2243
2265
|
$.$mol_memo = $mol_memo;
|
@@ -3244,6 +3266,17 @@ var $;
|
|
3244
3266
|
;
|
3245
3267
|
"use strict";
|
3246
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
|
+
|
3247
3280
|
;
|
3248
3281
|
"use strict";
|
3249
3282
|
var $;
|
@@ -3401,6 +3434,19 @@ var $;
|
|
3401
3434
|
"!");
|
3402
3435
|
$mol_assert_equal(dom.outerHTML, '<div>hello<strong>world</strong>!</div>');
|
3403
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
|
+
},
|
3404
3450
|
'Function as component'() {
|
3405
3451
|
const Button = (props, target) => {
|
3406
3452
|
return $mol_jsx("button", { title: props.hint }, target());
|