mol_jsx_lib 0.0.411 → 0.0.413
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 +4 -0
- package/node.deps.json +1 -1
- package/node.js +24 -14
- package/node.js.map +1 -1
- package/node.mjs +24 -14
- package/node.mjs.map +1 -1
- package/node.test.js +26 -16
- package/node.test.js.map +1 -1
- package/package.json +4 -2
- package/web.d.ts +4 -0
- package/web.deps.json +1 -1
- package/web.js +24 -14
- package/web.js.map +1 -1
- package/web.mjs +24 -14
- package/web.mjs.map +1 -1
- package/web.test.js +2 -2
- package/web.test.js.map +1 -1
package/node.mjs
CHANGED
|
@@ -1421,6 +1421,16 @@ var $;
|
|
|
1421
1421
|
;
|
|
1422
1422
|
"use strict";
|
|
1423
1423
|
var $;
|
|
1424
|
+
(function ($) {
|
|
1425
|
+
function $mol_promise_like(val) {
|
|
1426
|
+
return val && typeof val.then === 'function';
|
|
1427
|
+
}
|
|
1428
|
+
$.$mol_promise_like = $mol_promise_like;
|
|
1429
|
+
})($ || ($ = {}));
|
|
1430
|
+
//mol/promise/like/like.ts
|
|
1431
|
+
;
|
|
1432
|
+
"use strict";
|
|
1433
|
+
var $;
|
|
1424
1434
|
(function ($) {
|
|
1425
1435
|
const handled = new WeakSet();
|
|
1426
1436
|
class $mol_wire_fiber extends $mol_wire_pub_sub {
|
|
@@ -1469,7 +1479,7 @@ var $;
|
|
|
1469
1479
|
return this.data.slice(0, this.pub_from);
|
|
1470
1480
|
}
|
|
1471
1481
|
result() {
|
|
1472
|
-
if (this.cache
|
|
1482
|
+
if ($mol_promise_like(this.cache))
|
|
1473
1483
|
return;
|
|
1474
1484
|
if (this.cache instanceof Error)
|
|
1475
1485
|
return;
|
|
@@ -1548,7 +1558,7 @@ var $;
|
|
|
1548
1558
|
result = this.task.call(this.host, ...this.args);
|
|
1549
1559
|
break;
|
|
1550
1560
|
}
|
|
1551
|
-
if (result
|
|
1561
|
+
if ($mol_promise_like(result)) {
|
|
1552
1562
|
const put = (res) => {
|
|
1553
1563
|
if (this.cache === result)
|
|
1554
1564
|
this.put(res);
|
|
@@ -1561,13 +1571,13 @@ var $;
|
|
|
1561
1571
|
}
|
|
1562
1572
|
}
|
|
1563
1573
|
catch (error) {
|
|
1564
|
-
if (error instanceof Error || error
|
|
1574
|
+
if (error instanceof Error || $mol_promise_like(error)) {
|
|
1565
1575
|
result = error;
|
|
1566
1576
|
}
|
|
1567
1577
|
else {
|
|
1568
1578
|
result = new Error(String(error), { cause: error });
|
|
1569
1579
|
}
|
|
1570
|
-
if (result
|
|
1580
|
+
if ($mol_promise_like(result) && !handled.has(result)) {
|
|
1571
1581
|
result = Object.assign(result.finally(() => {
|
|
1572
1582
|
if (this.cache === result)
|
|
1573
1583
|
this.absorb();
|
|
@@ -1577,7 +1587,7 @@ var $;
|
|
|
1577
1587
|
handled.add(result);
|
|
1578
1588
|
}
|
|
1579
1589
|
}
|
|
1580
|
-
if (
|
|
1590
|
+
if (!$mol_promise_like(result)) {
|
|
1581
1591
|
this.track_cut();
|
|
1582
1592
|
}
|
|
1583
1593
|
this.track_off(bu);
|
|
@@ -1596,7 +1606,7 @@ var $;
|
|
|
1596
1606
|
if (this.cache instanceof Error) {
|
|
1597
1607
|
return $mol_fail_hidden(this.cache);
|
|
1598
1608
|
}
|
|
1599
|
-
if (this.cache
|
|
1609
|
+
if ($mol_promise_like(this.cache)) {
|
|
1600
1610
|
return $mol_fail_hidden(this.cache);
|
|
1601
1611
|
}
|
|
1602
1612
|
return this.cache;
|
|
@@ -1607,7 +1617,7 @@ var $;
|
|
|
1607
1617
|
if (this.cache instanceof Error) {
|
|
1608
1618
|
$mol_fail_hidden(this.cache);
|
|
1609
1619
|
}
|
|
1610
|
-
if (
|
|
1620
|
+
if (!$mol_promise_like(this.cache))
|
|
1611
1621
|
return this.cache;
|
|
1612
1622
|
await this.cache;
|
|
1613
1623
|
if (this.cursor === $mol_wire_cursor.final) {
|
|
@@ -1830,14 +1840,14 @@ var $;
|
|
|
1830
1840
|
};
|
|
1831
1841
|
}
|
|
1832
1842
|
complete() {
|
|
1833
|
-
if (this.cache
|
|
1843
|
+
if ($mol_promise_like(this.cache))
|
|
1834
1844
|
return;
|
|
1835
1845
|
this.destructor();
|
|
1836
1846
|
}
|
|
1837
1847
|
put(next) {
|
|
1838
1848
|
const prev = this.cache;
|
|
1839
1849
|
this.cache = next;
|
|
1840
|
-
if (next
|
|
1850
|
+
if ($mol_promise_like(next)) {
|
|
1841
1851
|
this.cursor = $mol_wire_cursor.fresh;
|
|
1842
1852
|
if (next !== prev)
|
|
1843
1853
|
this.emit();
|
|
@@ -1894,7 +1904,7 @@ var $;
|
|
|
1894
1904
|
function $mol_fail_catch(error) {
|
|
1895
1905
|
if (typeof error !== 'object')
|
|
1896
1906
|
return false;
|
|
1897
|
-
if (error
|
|
1907
|
+
if ($mol_promise_like(error))
|
|
1898
1908
|
$mol_fail_hidden(error);
|
|
1899
1909
|
if (catched.get(error))
|
|
1900
1910
|
return false;
|
|
@@ -1909,7 +1919,7 @@ var $;
|
|
|
1909
1919
|
var $;
|
|
1910
1920
|
(function ($) {
|
|
1911
1921
|
function $mol_fail_log(error) {
|
|
1912
|
-
if (error
|
|
1922
|
+
if ($mol_promise_like(error))
|
|
1913
1923
|
return false;
|
|
1914
1924
|
if (!$mol_fail_catch(error))
|
|
1915
1925
|
return false;
|
|
@@ -2033,7 +2043,7 @@ var $;
|
|
|
2033
2043
|
}
|
|
2034
2044
|
this.cache = next;
|
|
2035
2045
|
this.cursor = $mol_wire_cursor.fresh;
|
|
2036
|
-
if (next
|
|
2046
|
+
if ($mol_promise_like(next))
|
|
2037
2047
|
return next;
|
|
2038
2048
|
this.complete_pubs();
|
|
2039
2049
|
return next;
|
|
@@ -2324,7 +2334,7 @@ var $;
|
|
|
2324
2334
|
return error;
|
|
2325
2335
|
}
|
|
2326
2336
|
});
|
|
2327
|
-
const promises = results.filter(res => res
|
|
2337
|
+
const promises = results.filter(res => $mol_promise_like(res));
|
|
2328
2338
|
if (promises.length)
|
|
2329
2339
|
$mol_fail(Promise.race(promises));
|
|
2330
2340
|
const error = results.find(res => res instanceof Error);
|
|
@@ -2605,7 +2615,7 @@ var $;
|
|
|
2605
2615
|
}
|
|
2606
2616
|
$.$mol_promise = $mol_promise;
|
|
2607
2617
|
})($ || ($ = {}));
|
|
2608
|
-
//mol/promise/promise.ts
|
|
2618
|
+
//mol/promise/promise/promise.ts
|
|
2609
2619
|
;
|
|
2610
2620
|
"use strict";
|
|
2611
2621
|
var $;
|