mol_jsx_lib 0.0.1096 → 0.0.1098

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/web.mjs CHANGED
@@ -977,15 +977,20 @@ var $;
977
977
  break;
978
978
  }
979
979
  if ($mol_promise_like(result)) {
980
- const put = (res) => {
981
- if (this.cache === result)
982
- this.put(res);
983
- return res;
984
- };
985
- wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
986
- wrappers.set(result, result);
987
- const error = new Error(`Promise in ${this}`);
988
- Object.defineProperty(result, 'stack', { get: () => error.stack });
980
+ if (wrappers.has(result)) {
981
+ result = wrappers.get(result).then(a => a);
982
+ }
983
+ else {
984
+ const put = (res) => {
985
+ if (this.cache === result)
986
+ this.put(res);
987
+ return res;
988
+ };
989
+ wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
990
+ wrappers.set(result, result);
991
+ const error = new Error(`Promise in ${this}`);
992
+ Object.defineProperty(result, 'stack', { get: () => error.stack });
993
+ }
989
994
  }
990
995
  }
991
996
  catch (error) {
@@ -996,12 +1001,17 @@ var $;
996
1001
  result = new Error(String(error), { cause: error });
997
1002
  }
998
1003
  if ($mol_promise_like(result)) {
999
- wrappers.set(result, result = Object.assign(result.finally(() => {
1000
- if (this.cache === result)
1001
- this.absorb();
1002
- }), { destructor: result.destructor || (() => { }) }));
1003
- const error = new Error(`Promise in ${this}`);
1004
- Object.defineProperty(result, 'stack', { get: () => error.stack });
1004
+ if (wrappers.has(result)) {
1005
+ result = wrappers.get(result);
1006
+ }
1007
+ else {
1008
+ wrappers.set(result, result = Object.assign(result.finally(() => {
1009
+ if (this.cache === result)
1010
+ this.absorb();
1011
+ }), { destructor: result.destructor || (() => { }) }));
1012
+ const error = new Error(`Promise in ${this}`);
1013
+ Object.defineProperty(result, 'stack', { get: () => error.stack });
1014
+ }
1005
1015
  }
1006
1016
  }
1007
1017
  if (!$mol_promise_like(result)) {
@@ -1063,6 +1073,12 @@ var $;
1063
1073
  };
1064
1074
  });
1065
1075
  }
1076
+ destructor() {
1077
+ super.destructor();
1078
+ if ($mol_owning_check(this, this.cache)) {
1079
+ this.cache.destructor();
1080
+ }
1081
+ }
1066
1082
  }
1067
1083
  $.$mol_wire_fiber = $mol_wire_fiber;
1068
1084
  })($ || ($ = {}));
@@ -1087,6 +1103,7 @@ var $;
1087
1103
  var $;
1088
1104
  (function ($) {
1089
1105
  $.$mol_key_store = new WeakMap();
1106
+ const TypedArray = Object.getPrototypeOf(Uint8Array);
1090
1107
  function $mol_key(value) {
1091
1108
  if (typeof value === 'bigint')
1092
1109
  return value.toString() + 'n';
@@ -1116,7 +1133,7 @@ var $;
1116
1133
  return value;
1117
1134
  if (value instanceof RegExp)
1118
1135
  return value.toString();
1119
- if (value instanceof Uint8Array)
1136
+ if (value instanceof TypedArray)
1120
1137
  return [...value];
1121
1138
  let key = $.$mol_key_store.get(value);
1122
1139
  if (key)
@@ -1415,6 +1432,14 @@ var $;
1415
1432
  this.cursor = $mol_wire_cursor.fresh;
1416
1433
  if (next !== prev)
1417
1434
  this.emit();
1435
+ if ($mol_owning_catch(this, next)) {
1436
+ try {
1437
+ next[Symbol.toStringTag] = this[Symbol.toStringTag];
1438
+ }
1439
+ catch {
1440
+ Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
1441
+ }
1442
+ }
1418
1443
  return next;
1419
1444
  }
1420
1445
  this.cursor = $mol_wire_cursor.final;
@@ -1569,10 +1594,6 @@ var $;
1569
1594
  }
1570
1595
  destructor() {
1571
1596
  super.destructor();
1572
- const prev = this.cache;
1573
- if ($mol_owning_check(this, prev)) {
1574
- prev.destructor();
1575
- }
1576
1597
  if (this.pub_from === 0) {
1577
1598
  ;
1578
1599
  (this.host ?? this.task)[this.field()] = null;