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/node.mjs CHANGED
@@ -1412,15 +1412,20 @@ var $;
1412
1412
  break;
1413
1413
  }
1414
1414
  if ($mol_promise_like(result)) {
1415
- const put = (res) => {
1416
- if (this.cache === result)
1417
- this.put(res);
1418
- return res;
1419
- };
1420
- wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
1421
- wrappers.set(result, result);
1422
- const error = new Error(`Promise in ${this}`);
1423
- Object.defineProperty(result, 'stack', { get: () => error.stack });
1415
+ if (wrappers.has(result)) {
1416
+ result = wrappers.get(result).then(a => a);
1417
+ }
1418
+ else {
1419
+ const put = (res) => {
1420
+ if (this.cache === result)
1421
+ this.put(res);
1422
+ return res;
1423
+ };
1424
+ wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
1425
+ wrappers.set(result, result);
1426
+ const error = new Error(`Promise in ${this}`);
1427
+ Object.defineProperty(result, 'stack', { get: () => error.stack });
1428
+ }
1424
1429
  }
1425
1430
  }
1426
1431
  catch (error) {
@@ -1431,12 +1436,17 @@ var $;
1431
1436
  result = new Error(String(error), { cause: error });
1432
1437
  }
1433
1438
  if ($mol_promise_like(result)) {
1434
- wrappers.set(result, result = Object.assign(result.finally(() => {
1435
- if (this.cache === result)
1436
- this.absorb();
1437
- }), { destructor: result.destructor || (() => { }) }));
1438
- const error = new Error(`Promise in ${this}`);
1439
- Object.defineProperty(result, 'stack', { get: () => error.stack });
1439
+ if (wrappers.has(result)) {
1440
+ result = wrappers.get(result);
1441
+ }
1442
+ else {
1443
+ wrappers.set(result, result = Object.assign(result.finally(() => {
1444
+ if (this.cache === result)
1445
+ this.absorb();
1446
+ }), { destructor: result.destructor || (() => { }) }));
1447
+ const error = new Error(`Promise in ${this}`);
1448
+ Object.defineProperty(result, 'stack', { get: () => error.stack });
1449
+ }
1440
1450
  }
1441
1451
  }
1442
1452
  if (!$mol_promise_like(result)) {
@@ -1498,6 +1508,12 @@ var $;
1498
1508
  };
1499
1509
  });
1500
1510
  }
1511
+ destructor() {
1512
+ super.destructor();
1513
+ if ($mol_owning_check(this, this.cache)) {
1514
+ this.cache.destructor();
1515
+ }
1516
+ }
1501
1517
  }
1502
1518
  $.$mol_wire_fiber = $mol_wire_fiber;
1503
1519
  })($ || ($ = {}));
@@ -1691,6 +1707,14 @@ var $;
1691
1707
  this.cursor = $mol_wire_cursor.fresh;
1692
1708
  if (next !== prev)
1693
1709
  this.emit();
1710
+ if ($mol_owning_catch(this, next)) {
1711
+ try {
1712
+ next[Symbol.toStringTag] = this[Symbol.toStringTag];
1713
+ }
1714
+ catch {
1715
+ Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
1716
+ }
1717
+ }
1694
1718
  return next;
1695
1719
  }
1696
1720
  this.cursor = $mol_wire_cursor.final;
@@ -2091,6 +2115,7 @@ var $;
2091
2115
  var $;
2092
2116
  (function ($) {
2093
2117
  $.$mol_key_store = new WeakMap();
2118
+ const TypedArray = Object.getPrototypeOf(Uint8Array);
2094
2119
  function $mol_key(value) {
2095
2120
  if (typeof value === 'bigint')
2096
2121
  return value.toString() + 'n';
@@ -2120,7 +2145,7 @@ var $;
2120
2145
  return value;
2121
2146
  if (value instanceof RegExp)
2122
2147
  return value.toString();
2123
- if (value instanceof Uint8Array)
2148
+ if (value instanceof TypedArray)
2124
2149
  return [...value];
2125
2150
  let key = $.$mol_key_store.get(value);
2126
2151
  if (key)
@@ -2276,10 +2301,6 @@ var $;
2276
2301
  }
2277
2302
  destructor() {
2278
2303
  super.destructor();
2279
- const prev = this.cache;
2280
- if ($mol_owning_check(this, prev)) {
2281
- prev.destructor();
2282
- }
2283
2304
  if (this.pub_from === 0) {
2284
2305
  ;
2285
2306
  (this.host ?? this.task)[this.field()] = null;
package/node.test.js CHANGED
@@ -1403,15 +1403,20 @@ var $;
1403
1403
  break;
1404
1404
  }
1405
1405
  if ($mol_promise_like(result)) {
1406
- const put = (res) => {
1407
- if (this.cache === result)
1408
- this.put(res);
1409
- return res;
1410
- };
1411
- wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
1412
- wrappers.set(result, result);
1413
- const error = new Error(`Promise in ${this}`);
1414
- Object.defineProperty(result, 'stack', { get: () => error.stack });
1406
+ if (wrappers.has(result)) {
1407
+ result = wrappers.get(result).then(a => a);
1408
+ }
1409
+ else {
1410
+ const put = (res) => {
1411
+ if (this.cache === result)
1412
+ this.put(res);
1413
+ return res;
1414
+ };
1415
+ wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
1416
+ wrappers.set(result, result);
1417
+ const error = new Error(`Promise in ${this}`);
1418
+ Object.defineProperty(result, 'stack', { get: () => error.stack });
1419
+ }
1415
1420
  }
1416
1421
  }
1417
1422
  catch (error) {
@@ -1422,12 +1427,17 @@ var $;
1422
1427
  result = new Error(String(error), { cause: error });
1423
1428
  }
1424
1429
  if ($mol_promise_like(result)) {
1425
- wrappers.set(result, result = Object.assign(result.finally(() => {
1426
- if (this.cache === result)
1427
- this.absorb();
1428
- }), { destructor: result.destructor || (() => { }) }));
1429
- const error = new Error(`Promise in ${this}`);
1430
- Object.defineProperty(result, 'stack', { get: () => error.stack });
1430
+ if (wrappers.has(result)) {
1431
+ result = wrappers.get(result);
1432
+ }
1433
+ else {
1434
+ wrappers.set(result, result = Object.assign(result.finally(() => {
1435
+ if (this.cache === result)
1436
+ this.absorb();
1437
+ }), { destructor: result.destructor || (() => { }) }));
1438
+ const error = new Error(`Promise in ${this}`);
1439
+ Object.defineProperty(result, 'stack', { get: () => error.stack });
1440
+ }
1431
1441
  }
1432
1442
  }
1433
1443
  if (!$mol_promise_like(result)) {
@@ -1489,6 +1499,12 @@ var $;
1489
1499
  };
1490
1500
  });
1491
1501
  }
1502
+ destructor() {
1503
+ super.destructor();
1504
+ if ($mol_owning_check(this, this.cache)) {
1505
+ this.cache.destructor();
1506
+ }
1507
+ }
1492
1508
  }
1493
1509
  $.$mol_wire_fiber = $mol_wire_fiber;
1494
1510
  })($ || ($ = {}));
@@ -1682,6 +1698,14 @@ var $;
1682
1698
  this.cursor = $mol_wire_cursor.fresh;
1683
1699
  if (next !== prev)
1684
1700
  this.emit();
1701
+ if ($mol_owning_catch(this, next)) {
1702
+ try {
1703
+ next[Symbol.toStringTag] = this[Symbol.toStringTag];
1704
+ }
1705
+ catch {
1706
+ Object.defineProperty(next, Symbol.toStringTag, { value: this[Symbol.toStringTag] });
1707
+ }
1708
+ }
1685
1709
  return next;
1686
1710
  }
1687
1711
  this.cursor = $mol_wire_cursor.final;
@@ -2082,6 +2106,7 @@ var $;
2082
2106
  var $;
2083
2107
  (function ($) {
2084
2108
  $.$mol_key_store = new WeakMap();
2109
+ const TypedArray = Object.getPrototypeOf(Uint8Array);
2085
2110
  function $mol_key(value) {
2086
2111
  if (typeof value === 'bigint')
2087
2112
  return value.toString() + 'n';
@@ -2111,7 +2136,7 @@ var $;
2111
2136
  return value;
2112
2137
  if (value instanceof RegExp)
2113
2138
  return value.toString();
2114
- if (value instanceof Uint8Array)
2139
+ if (value instanceof TypedArray)
2115
2140
  return [...value];
2116
2141
  let key = $.$mol_key_store.get(value);
2117
2142
  if (key)
@@ -2267,10 +2292,6 @@ var $;
2267
2292
  }
2268
2293
  destructor() {
2269
2294
  super.destructor();
2270
- const prev = this.cache;
2271
- if ($mol_owning_check(this, prev)) {
2272
- prev.destructor();
2273
- }
2274
2295
  if (this.pub_from === 0) {
2275
2296
  ;
2276
2297
  (this.host ?? this.task)[this.field()] = null;