poe-code 13.0.2 → 13.0.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "poe-code",
3
- "version": "13.0.2",
3
+ "version": "13.0.3",
4
4
  "description": "CLI tool to configure Poe API for developer workflows.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -18670,14 +18670,6 @@ function enterRunningState(object) {
18670
18670
  runningObjects.delete(object);
18671
18671
  };
18672
18672
  }
18673
- function enterCollectionCallback(object) {
18674
- const leaveRunning = enterRunningState(object);
18675
- lockedCollections.add(object);
18676
- return () => {
18677
- lockedCollections.delete(object);
18678
- leaveRunning();
18679
- };
18680
- }
18681
18673
  function assertCollectionMutable(object) {
18682
18674
  if (lockedCollections.has(object)) {
18683
18675
  throw new SandboxError("reentry");
@@ -24620,7 +24612,7 @@ async function callArrayMethod(value, methodName, args, options, stack = []) {
24620
24612
  if (isCallbackArrayMethod(methodName)) {
24621
24613
  let callbackState = activeArrayCallbacks.get(value);
24622
24614
  if (callbackState === void 0) {
24623
- callbackState = { depth: 0, leave: enterCollectionCallback(value) };
24615
+ callbackState = { depth: 0, leave: enterRunningState(value) };
24624
24616
  activeArrayCallbacks.set(value, callbackState);
24625
24617
  }
24626
24618
  callbackState.depth += 1;
@@ -24871,42 +24863,63 @@ function getRequiredCallback(methodName, value) {
24871
24863
  async function mapArray(value, callback, options, stack, thisValue) {
24872
24864
  const length = value.length;
24873
24865
  const result = new Array(length);
24874
- for (let index = 0; index < length; index += 1) {
24875
- if (!(index in value)) {
24876
- continue;
24866
+ options.budget.setRetainedValues(result, () => [result]);
24867
+ try {
24868
+ for (let index = 0; index < length; index += 1) {
24869
+ options.budget.visitNode();
24870
+ if (!(index in value)) {
24871
+ continue;
24872
+ }
24873
+ result[index] = await callArrayCallback(
24874
+ callback,
24875
+ value[index],
24876
+ index,
24877
+ value,
24878
+ options,
24879
+ stack,
24880
+ thisValue
24881
+ );
24877
24882
  }
24878
- result[index] = await callArrayCallback(
24879
- callback,
24880
- value[index],
24881
- index,
24882
- value,
24883
- options,
24884
- stack,
24885
- thisValue
24886
- );
24883
+ return result;
24884
+ } finally {
24885
+ options.budget.setRetainedValues(result, void 0);
24887
24886
  }
24888
- return result;
24889
24887
  }
24890
24888
  async function filterArray(value, callback, options, stack, thisValue) {
24891
24889
  const length = value.length;
24892
24890
  const result = [];
24893
- for (let index = 0; index < length; index += 1) {
24894
- if (!(index in value)) {
24895
- continue;
24896
- }
24897
- if (await callArrayCallback(callback, value[index], index, value, options, stack, thisValue)) {
24898
- result.push(value[index]);
24891
+ options.budget.setRetainedValues(result, () => [result]);
24892
+ try {
24893
+ for (let index = 0; index < length; index += 1) {
24894
+ options.budget.visitNode();
24895
+ if (!(index in value)) {
24896
+ continue;
24897
+ }
24898
+ const entry = value[index];
24899
+ if (await callArrayCallback(callback, entry, index, value, options, stack, thisValue)) {
24900
+ result.push(entry);
24901
+ }
24899
24902
  }
24903
+ return result;
24904
+ } finally {
24905
+ options.budget.setRetainedValues(result, void 0);
24900
24906
  }
24901
- return result;
24902
24907
  }
24903
24908
  async function findInArray(value, callback, options, stack, thisValue) {
24904
- const index = await findIndexInArray(value, callback, options, stack, thisValue);
24905
- return index < 0 ? void 0 : value[index];
24909
+ const length = value.length;
24910
+ for (let index = 0; index < length; index += 1) {
24911
+ options.budget.visitNode();
24912
+ const entry = index in value ? value[index] : void 0;
24913
+ if (await callArrayCallback(callback, entry, index, value, options, stack, thisValue)) {
24914
+ return entry;
24915
+ }
24916
+ }
24917
+ return void 0;
24906
24918
  }
24907
24919
  async function findIndexInArray(value, callback, options, stack, thisValue) {
24908
24920
  const length = value.length;
24909
24921
  for (let index = 0; index < length; index += 1) {
24922
+ options.budget.visitNode();
24910
24923
  const entry = index in value ? value[index] : void 0;
24911
24924
  if (await callArrayCallback(callback, entry, index, value, options, stack, thisValue)) {
24912
24925
  return index;
@@ -24917,6 +24930,7 @@ async function findIndexInArray(value, callback, options, stack, thisValue) {
24917
24930
  async function findLastInArray(value, callback, options, stack, thisValue) {
24918
24931
  const length = value.length;
24919
24932
  for (let index = length - 1; index >= 0; index -= 1) {
24933
+ options.budget.visitNode();
24920
24934
  const entry = index in value ? value[index] : void 0;
24921
24935
  if (await callArrayCallback(callback, entry, index, value, options, stack, thisValue)) {
24922
24936
  return entry;
@@ -24927,6 +24941,7 @@ async function findLastInArray(value, callback, options, stack, thisValue) {
24927
24941
  async function findLastIndexInArray(value, callback, options, stack, thisValue) {
24928
24942
  const length = value.length;
24929
24943
  for (let index = length - 1; index >= 0; index -= 1) {
24944
+ options.budget.visitNode();
24930
24945
  const entry = index in value ? value[index] : void 0;
24931
24946
  if (await callArrayCallback(callback, entry, index, value, options, stack, thisValue)) {
24932
24947
  return index;
@@ -24937,6 +24952,7 @@ async function findLastIndexInArray(value, callback, options, stack, thisValue)
24937
24952
  async function someInArray(value, callback, options, stack, thisValue) {
24938
24953
  const length = value.length;
24939
24954
  for (let index = 0; index < length; index += 1) {
24955
+ options.budget.visitNode();
24940
24956
  if (!(index in value)) {
24941
24957
  continue;
24942
24958
  }
@@ -24949,6 +24965,7 @@ async function someInArray(value, callback, options, stack, thisValue) {
24949
24965
  async function everyInArray(value, callback, options, stack, thisValue) {
24950
24966
  const length = value.length;
24951
24967
  for (let index = 0; index < length; index += 1) {
24968
+ options.budget.visitNode();
24952
24969
  if (!(index in value)) {
24953
24970
  continue;
24954
24971
  }
@@ -24960,10 +24977,10 @@ async function everyInArray(value, callback, options, stack, thisValue) {
24960
24977
  }
24961
24978
  async function reduceArray(value, callback, hasInitialValue, initialValue, options, stack) {
24962
24979
  const length = value.length;
24963
- const start = findNextDefinedIndex(value, 0, 1, length);
24964
24980
  if (hasInitialValue) {
24965
- return reduceFromLeft(value, callback, initialValue, start, length, options, stack);
24981
+ return reduceFromLeft(value, callback, initialValue, 0, length, options, stack);
24966
24982
  }
24983
+ const start = findNextDefinedIndex(value, 0, 1, length, options.budget);
24967
24984
  if (start < 0) {
24968
24985
  throw new TypeError("Reduce of empty array with no initial value.");
24969
24986
  }
@@ -24971,10 +24988,10 @@ async function reduceArray(value, callback, hasInitialValue, initialValue, optio
24971
24988
  }
24972
24989
  async function reduceRightArray(value, callback, hasInitialValue, initialValue, options, stack) {
24973
24990
  const length = value.length;
24974
- const start = findNextDefinedIndex(value, length - 1, -1, length);
24975
24991
  if (hasInitialValue) {
24976
- return reduceFromRight(value, callback, initialValue, start, length, options, stack);
24992
+ return reduceFromRight(value, callback, initialValue, length - 1, length, options, stack);
24977
24993
  }
24994
+ const start = findNextDefinedIndex(value, length - 1, -1, length, options.budget);
24978
24995
  if (start < 0) {
24979
24996
  throw new TypeError("Reduce of empty array with no initial value.");
24980
24997
  }
@@ -24982,27 +24999,42 @@ async function reduceRightArray(value, callback, hasInitialValue, initialValue,
24982
24999
  }
24983
25000
  async function reduceFromLeft(value, callback, accumulator, startIndex, length, options, stack) {
24984
25001
  let current = accumulator;
24985
- for (let index = startIndex; index < length; index += 1) {
24986
- if (!(index in value)) {
24987
- continue;
25002
+ const retainedAccumulator = {};
25003
+ options.budget.setRetainedValues(retainedAccumulator, () => [current]);
25004
+ try {
25005
+ for (let index = startIndex; index < length; index += 1) {
25006
+ options.budget.visitNode();
25007
+ if (!(index in value)) {
25008
+ continue;
25009
+ }
25010
+ current = await options.callClosure(callback, [current, value[index], index, value], stack);
24988
25011
  }
24989
- current = await options.callClosure(callback, [current, value[index], index, value], stack);
25012
+ return current;
25013
+ } finally {
25014
+ options.budget.setRetainedValues(retainedAccumulator, void 0);
24990
25015
  }
24991
- return current;
24992
25016
  }
24993
25017
  async function reduceFromRight(value, callback, accumulator, startIndex, length, options, stack) {
24994
25018
  let current = accumulator;
24995
- for (let index = Math.min(startIndex, length - 1); index >= 0; index -= 1) {
24996
- if (!(index in value)) {
24997
- continue;
25019
+ const retainedAccumulator = {};
25020
+ options.budget.setRetainedValues(retainedAccumulator, () => [current]);
25021
+ try {
25022
+ for (let index = Math.min(startIndex, length - 1); index >= 0; index -= 1) {
25023
+ options.budget.visitNode();
25024
+ if (!(index in value)) {
25025
+ continue;
25026
+ }
25027
+ current = await options.callClosure(callback, [current, value[index], index, value], stack);
24998
25028
  }
24999
- current = await options.callClosure(callback, [current, value[index], index, value], stack);
25029
+ return current;
25030
+ } finally {
25031
+ options.budget.setRetainedValues(retainedAccumulator, void 0);
25000
25032
  }
25001
- return current;
25002
25033
  }
25003
25034
  async function forEachArray(value, callback, options, stack, thisValue) {
25004
25035
  const length = value.length;
25005
25036
  for (let index = 0; index < length; index += 1) {
25037
+ options.budget.visitNode();
25006
25038
  if (!(index in value)) {
25007
25039
  continue;
25008
25040
  }
@@ -25012,33 +25044,40 @@ async function forEachArray(value, callback, options, stack, thisValue) {
25012
25044
  async function flatMapArray(value, callback, options, stack, thisValue) {
25013
25045
  const length = value.length;
25014
25046
  const result = [];
25015
- for (let index = 0; index < length; index += 1) {
25016
- if (!(index in value)) {
25017
- continue;
25018
- }
25019
- const mapped = await callArrayCallback(
25020
- callback,
25021
- value[index],
25022
- index,
25023
- value,
25024
- options,
25025
- stack,
25026
- thisValue
25027
- );
25028
- if (Array.isArray(mapped)) {
25029
- for (let mappedIndex = 0; mappedIndex < mapped.length; mappedIndex += 1) {
25030
- if (!(mappedIndex in mapped)) {
25031
- continue;
25047
+ options.budget.setRetainedValues(result, () => [result]);
25048
+ try {
25049
+ for (let index = 0; index < length; index += 1) {
25050
+ options.budget.visitNode();
25051
+ if (!(index in value)) {
25052
+ continue;
25053
+ }
25054
+ const mapped = await callArrayCallback(
25055
+ callback,
25056
+ value[index],
25057
+ index,
25058
+ value,
25059
+ options,
25060
+ stack,
25061
+ thisValue
25062
+ );
25063
+ if (Array.isArray(mapped)) {
25064
+ for (let mappedIndex = 0; mappedIndex < mapped.length; mappedIndex += 1) {
25065
+ options.budget.visitNode();
25066
+ if (!(mappedIndex in mapped)) {
25067
+ continue;
25068
+ }
25069
+ result.push(mapped[mappedIndex]);
25070
+ options.budget.allocateArrayLength(result.length);
25032
25071
  }
25033
- result.push(mapped[mappedIndex]);
25034
- options.budget.allocateArrayLength(result.length);
25072
+ continue;
25035
25073
  }
25036
- continue;
25074
+ result.push(mapped);
25075
+ options.budget.allocateArrayLength(result.length);
25037
25076
  }
25038
- result.push(mapped);
25039
- options.budget.allocateArrayLength(result.length);
25077
+ return result;
25078
+ } finally {
25079
+ options.budget.setRetainedValues(result, void 0);
25040
25080
  }
25041
- return result;
25042
25081
  }
25043
25082
  function flattenArray(value, depth, budget) {
25044
25083
  const result = [];
@@ -25060,47 +25099,59 @@ function appendFlattenedEntries(value, depth, result, budget) {
25060
25099
  }
25061
25100
  }
25062
25101
  async function sortArray(value, comparator, options, stack) {
25102
+ const length = value.length;
25063
25103
  const definedValues = [];
25064
25104
  let undefinedCount = 0;
25065
- for (let index = 0; index < value.length; index += 1) {
25066
- if (!(index in value)) {
25067
- continue;
25105
+ let currentEntry;
25106
+ options.budget.setRetainedValues(definedValues, () => [definedValues, currentEntry]);
25107
+ try {
25108
+ for (let index = 0; index < length; index += 1) {
25109
+ options.budget.visitNode();
25110
+ if (!(index in value)) {
25111
+ continue;
25112
+ }
25113
+ const entry = value[index];
25114
+ if (entry === void 0) {
25115
+ undefinedCount += 1;
25116
+ continue;
25117
+ }
25118
+ definedValues.push(entry);
25068
25119
  }
25069
- const entry = value[index];
25070
- if (entry === void 0) {
25071
- undefinedCount += 1;
25072
- continue;
25120
+ for (let index = 1; index < definedValues.length; index += 1) {
25121
+ currentEntry = definedValues[index];
25122
+ let cursor = index - 1;
25123
+ while (cursor >= 0 && await compareEntries(definedValues[cursor], currentEntry, comparator, options, stack) > 0) {
25124
+ definedValues[cursor + 1] = definedValues[cursor];
25125
+ cursor -= 1;
25126
+ }
25127
+ definedValues[cursor + 1] = currentEntry;
25073
25128
  }
25074
- definedValues.push(entry);
25075
- }
25076
- for (let index = 1; index < definedValues.length; index += 1) {
25077
- const entry = definedValues[index];
25078
- let cursor = index - 1;
25079
- while (cursor >= 0 && await compareEntries(definedValues[cursor], entry, comparator, options, stack) > 0) {
25080
- definedValues[cursor + 1] = definedValues[cursor];
25081
- cursor -= 1;
25129
+ currentEntry = void 0;
25130
+ for (let index = 0; index < definedValues.length; index += 1) {
25131
+ value[index] = definedValues[index];
25082
25132
  }
25083
- definedValues[cursor + 1] = entry;
25084
- }
25085
- for (let index = 0; index < definedValues.length; index += 1) {
25086
- value[index] = definedValues[index];
25087
- }
25088
- for (let index = 0; index < undefinedCount; index += 1) {
25089
- value[definedValues.length + index] = void 0;
25090
- }
25091
- for (let index = definedValues.length + undefinedCount; index < value.length; index += 1) {
25092
- delete value[index];
25133
+ for (let index = 0; index < undefinedCount; index += 1) {
25134
+ value[definedValues.length + index] = void 0;
25135
+ }
25136
+ for (let index = definedValues.length + undefinedCount; index < length; index += 1) {
25137
+ options.budget.visitNode();
25138
+ delete value[index];
25139
+ }
25140
+ } finally {
25141
+ options.budget.setRetainedValues(definedValues, void 0);
25093
25142
  }
25094
25143
  }
25095
25144
  async function compareEntries(left, right, comparator, options, stack) {
25145
+ options.budget.visitNode();
25096
25146
  const result = Number(await options.callClosure(comparator, [left, right], stack));
25097
25147
  return Number.isNaN(result) ? 0 : result;
25098
25148
  }
25099
25149
  async function callArrayCallback(callback, value, index, array, options, stack, thisValue) {
25100
25150
  return options.callClosure(callback, [value, index, array], stack, thisValue);
25101
25151
  }
25102
- function findNextDefinedIndex(value, startIndex, direction, length) {
25152
+ function findNextDefinedIndex(value, startIndex, direction, length, budget) {
25103
25153
  for (let index = startIndex; direction > 0 ? index < length : index >= 0; index += direction) {
25154
+ budget.visitNode();
25104
25155
  if (index in value) {
25105
25156
  return index;
25106
25157
  }
@@ -29841,4 +29892,4 @@ export {
29841
29892
  FileSnapshotBackend,
29842
29893
  run
29843
29894
  };
29844
- //# sourceMappingURL=chunk-RIQRHKCB.js.map
29895
+ //# sourceMappingURL=chunk-73LWNNUG.js.map