@poe-platform/safe-js 0.1.321 → 0.1.323

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.
@@ -27,7 +27,7 @@ import {
27
27
  validateMigrationSemantics,
28
28
  validateSnapshotData,
29
29
  validateSnapshotMigration
30
- } from "./chunk-6SSHJVLI.js";
30
+ } from "./chunk-XWFNWZEL.js";
31
31
 
32
32
  // packages/safe-js/src/migrate.ts
33
33
  import { createHash } from "node:crypto";
@@ -8249,4 +8249,4 @@ export {
8249
8249
  parseMcpConfig,
8250
8250
  makeMcpModule
8251
8251
  };
8252
- //# sourceMappingURL=chunk-UEFYW6FZ.js.map
8252
+ //# sourceMappingURL=chunk-JLGN75VU.js.map
@@ -11947,42 +11947,43 @@ function defineArrayResult(result, index, value, options) {
11947
11947
  var arrayLikeSources = /* @__PURE__ */ new WeakMap();
11948
11948
  var activeArrayCallbacks = /* @__PURE__ */ new WeakMap();
11949
11949
  var localeArrays = /* @__PURE__ */ new WeakSet();
11950
- var arrayMethodNames = /* @__PURE__ */ new Set([
11951
- "map",
11952
- "filter",
11953
- "find",
11954
- "findIndex",
11955
- "findLast",
11956
- "findLastIndex",
11957
- "some",
11958
- "every",
11959
- "reduce",
11960
- "reduceRight",
11961
- "forEach",
11962
- "flatMap",
11963
- "flat",
11964
- "includes",
11965
- "indexOf",
11966
- "lastIndexOf",
11967
- "join",
11968
- "toLocaleString",
11969
- "slice",
11970
- "concat",
11971
- "splice",
11972
- "fill",
11973
- "copyWithin",
11974
- "at",
11975
- "sort",
11976
- "reverse",
11977
- "toSorted",
11978
- "toReversed",
11979
- "toSpliced",
11980
- "with",
11981
- "push",
11982
- "pop",
11983
- "shift",
11984
- "unshift"
11985
- ]);
11950
+ var arrayMethodLengths = {
11951
+ map: 1,
11952
+ filter: 1,
11953
+ find: 1,
11954
+ findIndex: 1,
11955
+ findLast: 1,
11956
+ findLastIndex: 1,
11957
+ some: 1,
11958
+ every: 1,
11959
+ reduce: 1,
11960
+ reduceRight: 1,
11961
+ forEach: 1,
11962
+ flatMap: 1,
11963
+ flat: 0,
11964
+ includes: 1,
11965
+ indexOf: 1,
11966
+ lastIndexOf: 1,
11967
+ join: 1,
11968
+ toLocaleString: 0,
11969
+ slice: 2,
11970
+ concat: 1,
11971
+ splice: 2,
11972
+ fill: 1,
11973
+ copyWithin: 2,
11974
+ at: 1,
11975
+ sort: 1,
11976
+ reverse: 0,
11977
+ toSorted: 1,
11978
+ toReversed: 0,
11979
+ toSpliced: 2,
11980
+ with: 2,
11981
+ push: 1,
11982
+ pop: 0,
11983
+ shift: 0,
11984
+ unshift: 1
11985
+ };
11986
+ var arrayMethodNames = new Set(Object.keys(arrayMethodLengths));
11986
11987
  function getArrayMember(value, property, options) {
11987
11988
  const index = getArrayIndex(property);
11988
11989
  if (index !== void 0) {
@@ -13503,7 +13504,7 @@ function createArrayGlobal(budget) {
13503
13504
  guest: true,
13504
13505
  sandbox: true,
13505
13506
  name,
13506
- length: Object.getOwnPropertyDescriptor(Array.prototype, name).value.length,
13507
+ length: arrayMethodLengths[name],
13507
13508
  call: (args, context) => callArrayMethod(context?.thisValue, name, args, {
13508
13509
  budget,
13509
13510
  context,
@@ -21250,9 +21251,10 @@ function validateArrayBufferStorage(value) {
21250
21251
  if (Object.hasOwn(value, "maxByteLength") && (!Array.isArray(value.bytes) || !Number.isSafeInteger(value.maxByteLength) || Number(value.maxByteLength) < value.bytes.length))
21251
21252
  throw new TypeError("Invalid ArrayBuffer maximum length.");
21252
21253
  }
21253
- function decodeArrayBufferStorage(value, resolve) {
21254
+ function decodeArrayBufferStorage(value, resolve, budget) {
21254
21255
  validateArrayBufferStorage(value);
21255
21256
  if (Array.isArray(value.bytes)) {
21257
+ budget?.allocateArrayLength(Number(value.maxByteLength ?? value.bytes.length));
21256
21258
  const buffer = Reflect.construct(ArrayBuffer, [
21257
21259
  value.bytes.length,
21258
21260
  Object.hasOwn(value, "maxByteLength") ? { maxByteLength: value.maxByteLength } : void 0
@@ -22162,7 +22164,7 @@ function decodeReplayData(input, options = {}, parent) {
22162
22164
  }
22163
22165
  if (kind === "arraybuffer") {
22164
22166
  if (typeof node.extensible !== "boolean") throw new TypeError("Invalid ArrayBuffer extensibility.");
22165
- const result3 = decodeArrayBufferStorage(node, child);
22167
+ const result3 = decodeArrayBufferStorage(node, child, compilation.owner?.budget);
22166
22168
  restored.set(id, result3);
22167
22169
  initializeValues.push(() => {
22168
22170
  defineProperties(result3, record2(own(node, "properties")), child, node.symbolEntries);
@@ -23063,7 +23065,7 @@ function copyHostValueToSandbox(value, stackFrames, options, state, path) {
23063
23065
  const existing = state.seen.get(value);
23064
23066
  if (existing !== void 0) return existing;
23065
23067
  const length = arrayBufferLength(value);
23066
- budget.allocateArrayLength(length);
23068
+ budget.allocateArrayLength(arrayBufferOptions(value)?.maxByteLength ?? length);
23067
23069
  budget.provisionDataUsage(length + 1)();
23068
23070
  const copy = copyArrayBufferStorage(value, state);
23069
23071
  state.seen.set(value, copy);
@@ -23086,6 +23088,8 @@ function copyHostValueToSandbox(value, stackFrames, options, state, path) {
23086
23088
  if (isFloat32Array(value)) {
23087
23089
  const existing = state.seen.get(value);
23088
23090
  if (existing !== void 0) return existing;
23091
+ const capacity = arrayBufferOptions(float32Storage(value).buffer)?.maxByteLength;
23092
+ if (capacity !== void 0) budget.allocateArrayLength(capacity);
23089
23093
  checkFloat32Allocation(Math.ceil(float32Storage(value).byteLength / 4), budget);
23090
23094
  const copy = copyFloat32Storage(value, state);
23091
23095
  state.seen.set(value, copy);
@@ -28083,7 +28087,7 @@ function allocateSandboxValue2(value, budget, seen) {
28083
28087
  if (isSandboxArrayBuffer(value)) {
28084
28088
  if (seen.has(value)) return;
28085
28089
  seen.add(value);
28086
- budget.allocateArrayLength(arrayBufferLength(value));
28090
+ budget.allocateArrayLength(arrayBufferOptions(value)?.maxByteLength ?? arrayBufferLength(value));
28087
28091
  for (const [key, descriptor] of arrayBufferDataProperties(value)) {
28088
28092
  if (typeof key === "string") budget.allocateString(key);
28089
28093
  allocateSandboxValue2(descriptor.value, budget, seen);
@@ -28105,6 +28109,8 @@ function allocateSandboxValue2(value, budget, seen) {
28105
28109
  if (seen.has(value)) return;
28106
28110
  seen.add(value);
28107
28111
  budget.allocateArrayLength(Math.ceil(float32Storage(value).byteLength / 4));
28112
+ const capacity = arrayBufferOptions(float32Storage(value).buffer)?.maxByteLength;
28113
+ if (capacity !== void 0) budget.allocateArrayLength(capacity);
28108
28114
  for (const [key, descriptor] of float32DataProperties(value)) {
28109
28115
  budget.allocateString(key);
28110
28116
  allocateSandboxValue2(descriptor.value, budget, seen);
@@ -42340,4 +42346,4 @@ export {
42340
42346
  FileSnapshotBackend,
42341
42347
  run
42342
42348
  };
42343
- //# sourceMappingURL=chunk-6SSHJVLI.js.map
42349
+ //# sourceMappingURL=chunk-XWFNWZEL.js.map