mol_jsx_lib 0.0.412 → 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/web.mjs
CHANGED
|
@@ -824,6 +824,16 @@ var $;
|
|
|
824
824
|
;
|
|
825
825
|
"use strict";
|
|
826
826
|
var $;
|
|
827
|
+
(function ($) {
|
|
828
|
+
function $mol_promise_like(val) {
|
|
829
|
+
return val && typeof val.then === 'function';
|
|
830
|
+
}
|
|
831
|
+
$.$mol_promise_like = $mol_promise_like;
|
|
832
|
+
})($ || ($ = {}));
|
|
833
|
+
//mol/promise/like/like.ts
|
|
834
|
+
;
|
|
835
|
+
"use strict";
|
|
836
|
+
var $;
|
|
827
837
|
(function ($) {
|
|
828
838
|
const handled = new WeakSet();
|
|
829
839
|
class $mol_wire_fiber extends $mol_wire_pub_sub {
|
|
@@ -872,7 +882,7 @@ var $;
|
|
|
872
882
|
return this.data.slice(0, this.pub_from);
|
|
873
883
|
}
|
|
874
884
|
result() {
|
|
875
|
-
if (this.cache
|
|
885
|
+
if ($mol_promise_like(this.cache))
|
|
876
886
|
return;
|
|
877
887
|
if (this.cache instanceof Error)
|
|
878
888
|
return;
|
|
@@ -951,7 +961,7 @@ var $;
|
|
|
951
961
|
result = this.task.call(this.host, ...this.args);
|
|
952
962
|
break;
|
|
953
963
|
}
|
|
954
|
-
if (result
|
|
964
|
+
if ($mol_promise_like(result)) {
|
|
955
965
|
const put = (res) => {
|
|
956
966
|
if (this.cache === result)
|
|
957
967
|
this.put(res);
|
|
@@ -964,13 +974,13 @@ var $;
|
|
|
964
974
|
}
|
|
965
975
|
}
|
|
966
976
|
catch (error) {
|
|
967
|
-
if (error instanceof Error || error
|
|
977
|
+
if (error instanceof Error || $mol_promise_like(error)) {
|
|
968
978
|
result = error;
|
|
969
979
|
}
|
|
970
980
|
else {
|
|
971
981
|
result = new Error(String(error), { cause: error });
|
|
972
982
|
}
|
|
973
|
-
if (result
|
|
983
|
+
if ($mol_promise_like(result) && !handled.has(result)) {
|
|
974
984
|
result = Object.assign(result.finally(() => {
|
|
975
985
|
if (this.cache === result)
|
|
976
986
|
this.absorb();
|
|
@@ -980,7 +990,7 @@ var $;
|
|
|
980
990
|
handled.add(result);
|
|
981
991
|
}
|
|
982
992
|
}
|
|
983
|
-
if (
|
|
993
|
+
if (!$mol_promise_like(result)) {
|
|
984
994
|
this.track_cut();
|
|
985
995
|
}
|
|
986
996
|
this.track_off(bu);
|
|
@@ -999,7 +1009,7 @@ var $;
|
|
|
999
1009
|
if (this.cache instanceof Error) {
|
|
1000
1010
|
return $mol_fail_hidden(this.cache);
|
|
1001
1011
|
}
|
|
1002
|
-
if (this.cache
|
|
1012
|
+
if ($mol_promise_like(this.cache)) {
|
|
1003
1013
|
return $mol_fail_hidden(this.cache);
|
|
1004
1014
|
}
|
|
1005
1015
|
return this.cache;
|
|
@@ -1010,7 +1020,7 @@ var $;
|
|
|
1010
1020
|
if (this.cache instanceof Error) {
|
|
1011
1021
|
$mol_fail_hidden(this.cache);
|
|
1012
1022
|
}
|
|
1013
|
-
if (
|
|
1023
|
+
if (!$mol_promise_like(this.cache))
|
|
1014
1024
|
return this.cache;
|
|
1015
1025
|
await this.cache;
|
|
1016
1026
|
if (this.cursor === $mol_wire_cursor.final) {
|
|
@@ -1233,14 +1243,14 @@ var $;
|
|
|
1233
1243
|
};
|
|
1234
1244
|
}
|
|
1235
1245
|
complete() {
|
|
1236
|
-
if (this.cache
|
|
1246
|
+
if ($mol_promise_like(this.cache))
|
|
1237
1247
|
return;
|
|
1238
1248
|
this.destructor();
|
|
1239
1249
|
}
|
|
1240
1250
|
put(next) {
|
|
1241
1251
|
const prev = this.cache;
|
|
1242
1252
|
this.cache = next;
|
|
1243
|
-
if (next
|
|
1253
|
+
if ($mol_promise_like(next)) {
|
|
1244
1254
|
this.cursor = $mol_wire_cursor.fresh;
|
|
1245
1255
|
if (next !== prev)
|
|
1246
1256
|
this.emit();
|
|
@@ -1297,7 +1307,7 @@ var $;
|
|
|
1297
1307
|
function $mol_fail_catch(error) {
|
|
1298
1308
|
if (typeof error !== 'object')
|
|
1299
1309
|
return false;
|
|
1300
|
-
if (error
|
|
1310
|
+
if ($mol_promise_like(error))
|
|
1301
1311
|
$mol_fail_hidden(error);
|
|
1302
1312
|
if (catched.get(error))
|
|
1303
1313
|
return false;
|
|
@@ -1312,7 +1322,7 @@ var $;
|
|
|
1312
1322
|
var $;
|
|
1313
1323
|
(function ($) {
|
|
1314
1324
|
function $mol_fail_log(error) {
|
|
1315
|
-
if (error
|
|
1325
|
+
if ($mol_promise_like(error))
|
|
1316
1326
|
return false;
|
|
1317
1327
|
if (!$mol_fail_catch(error))
|
|
1318
1328
|
return false;
|
|
@@ -1436,7 +1446,7 @@ var $;
|
|
|
1436
1446
|
}
|
|
1437
1447
|
this.cache = next;
|
|
1438
1448
|
this.cursor = $mol_wire_cursor.fresh;
|
|
1439
|
-
if (next
|
|
1449
|
+
if ($mol_promise_like(next))
|
|
1440
1450
|
return next;
|
|
1441
1451
|
this.complete_pubs();
|
|
1442
1452
|
return next;
|
|
@@ -1727,7 +1737,7 @@ var $;
|
|
|
1727
1737
|
return error;
|
|
1728
1738
|
}
|
|
1729
1739
|
});
|
|
1730
|
-
const promises = results.filter(res => res
|
|
1740
|
+
const promises = results.filter(res => $mol_promise_like(res));
|
|
1731
1741
|
if (promises.length)
|
|
1732
1742
|
$mol_fail(Promise.race(promises));
|
|
1733
1743
|
const error = results.find(res => res instanceof Error);
|
|
@@ -2029,7 +2039,7 @@ var $;
|
|
|
2029
2039
|
}
|
|
2030
2040
|
$.$mol_promise = $mol_promise;
|
|
2031
2041
|
})($ || ($ = {}));
|
|
2032
|
-
//mol/promise/promise.ts
|
|
2042
|
+
//mol/promise/promise/promise.ts
|
|
2033
2043
|
;
|
|
2034
2044
|
"use strict";
|
|
2035
2045
|
var $;
|