mol_crypto_lib 0.1.1380 → 0.1.1382

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
@@ -105,11 +105,13 @@ var $node = new Proxy({ require }, {
105
105
  get(target, name, wrapper) {
106
106
  if (target[name])
107
107
  return target[name];
108
- const mod = target.require('module');
109
- if (mod.builtinModules.indexOf(name) >= 0)
108
+ if (name.startsWith('node:'))
110
109
  return target.require(name);
111
110
  if (name[0] === '.')
112
111
  return target.require(name);
112
+ const mod = target.require('module');
113
+ if (mod.builtinModules.indexOf(name) >= 0)
114
+ return target.require(name);
113
115
  try {
114
116
  target.require.resolve(name);
115
117
  }
@@ -446,9 +448,8 @@ var $;
446
448
  if (sub_pos !== end) {
447
449
  this.peer_move(end, sub_pos);
448
450
  }
449
- this.data.pop();
450
- this.data.pop();
451
- if (this.data.length === this.sub_from)
451
+ this.data.length = end;
452
+ if (end === this.sub_from)
452
453
  this.reap();
453
454
  }
454
455
  reap() { }
@@ -680,9 +681,8 @@ var $;
680
681
  const sub = this.data[cursor];
681
682
  const pos = this.data[cursor + 1];
682
683
  sub.pub_off(pos);
683
- this.data.pop();
684
- this.data.pop();
685
684
  }
685
+ this.data.length = this.sub_from;
686
686
  this.cursor = this.pub_from;
687
687
  this.track_cut();
688
688
  this.cursor = $mol_wire_cursor.final;
@@ -691,23 +691,15 @@ var $;
691
691
  if (this.cursor < this.pub_from) {
692
692
  $mol_fail(new Error('Cut of non begun sub'));
693
693
  }
694
- let tail = 0;
694
+ let end = this.data.length;
695
695
  for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
696
696
  const pub = this.data[cursor];
697
697
  pub?.sub_off(this.data[cursor + 1]);
698
- if (this.sub_from < this.data.length) {
699
- this.peer_move(this.data.length - 2, cursor);
700
- this.data.pop();
701
- this.data.pop();
702
- }
703
- else {
704
- ++tail;
705
- }
706
- }
707
- for (; tail; --tail) {
708
- this.data.pop();
709
- this.data.pop();
698
+ end -= 2;
699
+ if (this.sub_from <= end)
700
+ this.peer_move(end, cursor);
710
701
  }
702
+ this.data.length = end;
711
703
  this.sub_from = this.cursor;
712
704
  }
713
705
  complete() { }
package/node.test.js CHANGED
@@ -96,11 +96,13 @@ var $node = new Proxy({ require }, {
96
96
  get(target, name, wrapper) {
97
97
  if (target[name])
98
98
  return target[name];
99
- const mod = target.require('module');
100
- if (mod.builtinModules.indexOf(name) >= 0)
99
+ if (name.startsWith('node:'))
101
100
  return target.require(name);
102
101
  if (name[0] === '.')
103
102
  return target.require(name);
103
+ const mod = target.require('module');
104
+ if (mod.builtinModules.indexOf(name) >= 0)
105
+ return target.require(name);
104
106
  try {
105
107
  target.require.resolve(name);
106
108
  }
@@ -437,9 +439,8 @@ var $;
437
439
  if (sub_pos !== end) {
438
440
  this.peer_move(end, sub_pos);
439
441
  }
440
- this.data.pop();
441
- this.data.pop();
442
- if (this.data.length === this.sub_from)
442
+ this.data.length = end;
443
+ if (end === this.sub_from)
443
444
  this.reap();
444
445
  }
445
446
  reap() { }
@@ -671,9 +672,8 @@ var $;
671
672
  const sub = this.data[cursor];
672
673
  const pos = this.data[cursor + 1];
673
674
  sub.pub_off(pos);
674
- this.data.pop();
675
- this.data.pop();
676
675
  }
676
+ this.data.length = this.sub_from;
677
677
  this.cursor = this.pub_from;
678
678
  this.track_cut();
679
679
  this.cursor = $mol_wire_cursor.final;
@@ -682,23 +682,15 @@ var $;
682
682
  if (this.cursor < this.pub_from) {
683
683
  $mol_fail(new Error('Cut of non begun sub'));
684
684
  }
685
- let tail = 0;
685
+ let end = this.data.length;
686
686
  for (let cursor = this.cursor; cursor < this.sub_from; cursor += 2) {
687
687
  const pub = this.data[cursor];
688
688
  pub?.sub_off(this.data[cursor + 1]);
689
- if (this.sub_from < this.data.length) {
690
- this.peer_move(this.data.length - 2, cursor);
691
- this.data.pop();
692
- this.data.pop();
693
- }
694
- else {
695
- ++tail;
696
- }
697
- }
698
- for (; tail; --tail) {
699
- this.data.pop();
700
- this.data.pop();
689
+ end -= 2;
690
+ if (this.sub_from <= end)
691
+ this.peer_move(end, cursor);
701
692
  }
693
+ this.data.length = end;
702
694
  this.sub_from = this.cursor;
703
695
  }
704
696
  complete() { }