@poe-platform/safe-js 0.1.322 → 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-ECGDQJ7F.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-CBU6A7YV.js.map
8252
+ //# sourceMappingURL=chunk-JLGN75VU.js.map
@@ -21251,9 +21251,10 @@ function validateArrayBufferStorage(value) {
21251
21251
  if (Object.hasOwn(value, "maxByteLength") && (!Array.isArray(value.bytes) || !Number.isSafeInteger(value.maxByteLength) || Number(value.maxByteLength) < value.bytes.length))
21252
21252
  throw new TypeError("Invalid ArrayBuffer maximum length.");
21253
21253
  }
21254
- function decodeArrayBufferStorage(value, resolve) {
21254
+ function decodeArrayBufferStorage(value, resolve, budget) {
21255
21255
  validateArrayBufferStorage(value);
21256
21256
  if (Array.isArray(value.bytes)) {
21257
+ budget?.allocateArrayLength(Number(value.maxByteLength ?? value.bytes.length));
21257
21258
  const buffer = Reflect.construct(ArrayBuffer, [
21258
21259
  value.bytes.length,
21259
21260
  Object.hasOwn(value, "maxByteLength") ? { maxByteLength: value.maxByteLength } : void 0
@@ -22163,7 +22164,7 @@ function decodeReplayData(input, options = {}, parent) {
22163
22164
  }
22164
22165
  if (kind === "arraybuffer") {
22165
22166
  if (typeof node.extensible !== "boolean") throw new TypeError("Invalid ArrayBuffer extensibility.");
22166
- const result3 = decodeArrayBufferStorage(node, child);
22167
+ const result3 = decodeArrayBufferStorage(node, child, compilation.owner?.budget);
22167
22168
  restored.set(id, result3);
22168
22169
  initializeValues.push(() => {
22169
22170
  defineProperties(result3, record2(own(node, "properties")), child, node.symbolEntries);
@@ -23064,7 +23065,7 @@ function copyHostValueToSandbox(value, stackFrames, options, state, path) {
23064
23065
  const existing = state.seen.get(value);
23065
23066
  if (existing !== void 0) return existing;
23066
23067
  const length = arrayBufferLength(value);
23067
- budget.allocateArrayLength(length);
23068
+ budget.allocateArrayLength(arrayBufferOptions(value)?.maxByteLength ?? length);
23068
23069
  budget.provisionDataUsage(length + 1)();
23069
23070
  const copy = copyArrayBufferStorage(value, state);
23070
23071
  state.seen.set(value, copy);
@@ -23087,6 +23088,8 @@ function copyHostValueToSandbox(value, stackFrames, options, state, path) {
23087
23088
  if (isFloat32Array(value)) {
23088
23089
  const existing = state.seen.get(value);
23089
23090
  if (existing !== void 0) return existing;
23091
+ const capacity = arrayBufferOptions(float32Storage(value).buffer)?.maxByteLength;
23092
+ if (capacity !== void 0) budget.allocateArrayLength(capacity);
23090
23093
  checkFloat32Allocation(Math.ceil(float32Storage(value).byteLength / 4), budget);
23091
23094
  const copy = copyFloat32Storage(value, state);
23092
23095
  state.seen.set(value, copy);
@@ -28084,7 +28087,7 @@ function allocateSandboxValue2(value, budget, seen) {
28084
28087
  if (isSandboxArrayBuffer(value)) {
28085
28088
  if (seen.has(value)) return;
28086
28089
  seen.add(value);
28087
- budget.allocateArrayLength(arrayBufferLength(value));
28090
+ budget.allocateArrayLength(arrayBufferOptions(value)?.maxByteLength ?? arrayBufferLength(value));
28088
28091
  for (const [key, descriptor] of arrayBufferDataProperties(value)) {
28089
28092
  if (typeof key === "string") budget.allocateString(key);
28090
28093
  allocateSandboxValue2(descriptor.value, budget, seen);
@@ -28106,6 +28109,8 @@ function allocateSandboxValue2(value, budget, seen) {
28106
28109
  if (seen.has(value)) return;
28107
28110
  seen.add(value);
28108
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);
28109
28114
  for (const [key, descriptor] of float32DataProperties(value)) {
28110
28115
  budget.allocateString(key);
28111
28116
  allocateSandboxValue2(descriptor.value, budget, seen);
@@ -42341,4 +42346,4 @@ export {
42341
42346
  FileSnapshotBackend,
42342
42347
  run
42343
42348
  };
42344
- //# sourceMappingURL=chunk-ECGDQJ7F.js.map
42349
+ //# sourceMappingURL=chunk-XWFNWZEL.js.map