mol_wire_lib 1.0.1230 → 1.0.1231

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
@@ -754,15 +754,20 @@ var $;
754
754
  break;
755
755
  }
756
756
  if ($mol_promise_like(result)) {
757
- const put = (res) => {
758
- if (this.cache === result)
759
- this.put(res);
760
- return res;
761
- };
762
- wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
763
- wrappers.set(result, result);
764
- const error = new Error(`Promise in ${this}`);
765
- Object.defineProperty(result, 'stack', { get: () => error.stack });
757
+ if (wrappers.has(result)) {
758
+ result = wrappers.get(result).then(a => a);
759
+ }
760
+ else {
761
+ const put = (res) => {
762
+ if (this.cache === result)
763
+ this.put(res);
764
+ return res;
765
+ };
766
+ wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
767
+ wrappers.set(result, result);
768
+ const error = new Error(`Promise in ${this}`);
769
+ Object.defineProperty(result, 'stack', { get: () => error.stack });
770
+ }
766
771
  }
767
772
  }
768
773
  catch (error) {
@@ -773,12 +778,17 @@ var $;
773
778
  result = new Error(String(error), { cause: error });
774
779
  }
775
780
  if ($mol_promise_like(result)) {
776
- wrappers.set(result, result = Object.assign(result.finally(() => {
777
- if (this.cache === result)
778
- this.absorb();
779
- }), { destructor: result.destructor || (() => { }) }));
780
- const error = new Error(`Promise in ${this}`);
781
- Object.defineProperty(result, 'stack', { get: () => error.stack });
781
+ if (wrappers.has(result)) {
782
+ result = wrappers.get(result);
783
+ }
784
+ else {
785
+ wrappers.set(result, result = Object.assign(result.finally(() => {
786
+ if (this.cache === result)
787
+ this.absorb();
788
+ }), { destructor: result.destructor || (() => { }) }));
789
+ const error = new Error(`Promise in ${this}`);
790
+ Object.defineProperty(result, 'stack', { get: () => error.stack });
791
+ }
782
792
  }
783
793
  }
784
794
  if (!$mol_promise_like(result)) {
@@ -1583,6 +1593,7 @@ var $;
1583
1593
  var $;
1584
1594
  (function ($) {
1585
1595
  $.$mol_key_store = new WeakMap();
1596
+ const TypedArray = Object.getPrototypeOf(Uint8Array);
1586
1597
  function $mol_key(value) {
1587
1598
  if (typeof value === 'bigint')
1588
1599
  return value.toString() + 'n';
@@ -1612,7 +1623,7 @@ var $;
1612
1623
  return value;
1613
1624
  if (value instanceof RegExp)
1614
1625
  return value.toString();
1615
- if (value instanceof Uint8Array)
1626
+ if (value instanceof TypedArray)
1616
1627
  return [...value];
1617
1628
  let key = $.$mol_key_store.get(value);
1618
1629
  if (key)
package/node.test.js CHANGED
@@ -745,15 +745,20 @@ var $;
745
745
  break;
746
746
  }
747
747
  if ($mol_promise_like(result)) {
748
- const put = (res) => {
749
- if (this.cache === result)
750
- this.put(res);
751
- return res;
752
- };
753
- wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
754
- wrappers.set(result, result);
755
- const error = new Error(`Promise in ${this}`);
756
- Object.defineProperty(result, 'stack', { get: () => error.stack });
748
+ if (wrappers.has(result)) {
749
+ result = wrappers.get(result).then(a => a);
750
+ }
751
+ else {
752
+ const put = (res) => {
753
+ if (this.cache === result)
754
+ this.put(res);
755
+ return res;
756
+ };
757
+ wrappers.set(result, result = Object.assign(result.then(put, put), { destructor: result.destructor || (() => { }) }));
758
+ wrappers.set(result, result);
759
+ const error = new Error(`Promise in ${this}`);
760
+ Object.defineProperty(result, 'stack', { get: () => error.stack });
761
+ }
757
762
  }
758
763
  }
759
764
  catch (error) {
@@ -764,12 +769,17 @@ var $;
764
769
  result = new Error(String(error), { cause: error });
765
770
  }
766
771
  if ($mol_promise_like(result)) {
767
- wrappers.set(result, result = Object.assign(result.finally(() => {
768
- if (this.cache === result)
769
- this.absorb();
770
- }), { destructor: result.destructor || (() => { }) }));
771
- const error = new Error(`Promise in ${this}`);
772
- Object.defineProperty(result, 'stack', { get: () => error.stack });
772
+ if (wrappers.has(result)) {
773
+ result = wrappers.get(result);
774
+ }
775
+ else {
776
+ wrappers.set(result, result = Object.assign(result.finally(() => {
777
+ if (this.cache === result)
778
+ this.absorb();
779
+ }), { destructor: result.destructor || (() => { }) }));
780
+ const error = new Error(`Promise in ${this}`);
781
+ Object.defineProperty(result, 'stack', { get: () => error.stack });
782
+ }
773
783
  }
774
784
  }
775
785
  if (!$mol_promise_like(result)) {
@@ -1574,6 +1584,7 @@ var $;
1574
1584
  var $;
1575
1585
  (function ($) {
1576
1586
  $.$mol_key_store = new WeakMap();
1587
+ const TypedArray = Object.getPrototypeOf(Uint8Array);
1577
1588
  function $mol_key(value) {
1578
1589
  if (typeof value === 'bigint')
1579
1590
  return value.toString() + 'n';
@@ -1603,7 +1614,7 @@ var $;
1603
1614
  return value;
1604
1615
  if (value instanceof RegExp)
1605
1616
  return value.toString();
1606
- if (value instanceof Uint8Array)
1617
+ if (value instanceof TypedArray)
1607
1618
  return [...value];
1608
1619
  let key = $.$mol_key_store.get(value);
1609
1620
  if (key)