@poe-platform/safe-js 0.1.317 → 0.1.318

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-6Y6A7QMJ.js";
30
+ } from "./chunk-X4Q4MITB.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-KGKR4R3I.js.map
8252
+ //# sourceMappingURL=chunk-AXRLZHJU.js.map
@@ -14855,6 +14855,18 @@ function createFloat32ArrayPrototypes(budget, constructor) {
14855
14855
  setSandboxPrototype(prototype, shared);
14856
14856
  setSandboxPrototype(shared, getSandboxPrototype(/* @__PURE__ */ Object.create(null), budget));
14857
14857
  const getters = [];
14858
+ const species = createSandboxClosure({
14859
+ guest: true,
14860
+ sandbox: true,
14861
+ name: "get [Symbol.species]",
14862
+ length: 0,
14863
+ call: (_args, context) => context?.thisValue
14864
+ });
14865
+ getters.push(species);
14866
+ Object.defineProperty(materializeFunctionProperties(typedArray), Symbol.species, {
14867
+ get: accessorAdapter(species, "get"),
14868
+ configurable: true
14869
+ });
14858
14870
  for (const key of ["length", "byteLength", "byteOffset", "buffer"]) {
14859
14871
  const getter = createSandboxClosure({
14860
14872
  guest: true,
@@ -14871,7 +14883,7 @@ function createFloat32ArrayPrototypes(budget, constructor) {
14871
14883
  Object.defineProperty(shared, key, { get: accessorAdapter(getter, "get"), configurable: true });
14872
14884
  }
14873
14885
  for (const key of ["set", "slice", "subarray"])
14874
- Object.defineProperty(shared, key, { value: getFloat32Member(new Float32Array(0), key, budget), writable: true, configurable: true });
14886
+ Object.defineProperty(shared, key, { value: getFloat32Member(new Float32Array(0), key, budget, constructor), writable: true, configurable: true });
14875
14887
  const arrayPrototype = resolveIntrinsicIdentity(budget, '["Array","prototype"]');
14876
14888
  Object.defineProperty(shared, "toString", { value: getSandboxDataProperty(arrayPrototype, "toString", budget), writable: true, configurable: true });
14877
14889
  Object.defineProperty(shared, "join", {
@@ -14939,7 +14951,7 @@ function createFloat32ArrayPrototypes(budget, constructor) {
14939
14951
  function isFloat32ArrayConstructor(value) {
14940
14952
  return typeof value === "object" && value !== null && constructors.has(value);
14941
14953
  }
14942
- function getFloat32Member(value, property, budget) {
14954
+ function getFloat32Member(value, property, budget, defaultConstructor) {
14943
14955
  const key = String(property);
14944
14956
  const descriptor = Object.getOwnPropertyDescriptor(value, key);
14945
14957
  if (descriptor !== void 0) {
@@ -15007,28 +15019,61 @@ function getFloat32Member(value, property, budget) {
15007
15019
  })();
15008
15020
  }
15009
15021
  return (async () => {
15010
- const release = retainValues(budget, () => [receiver, ...args]);
15022
+ let candidate;
15023
+ let result;
15024
+ const release = retainValues(budget, () => [receiver, candidate, result, ...args]);
15011
15025
  try {
15012
15026
  const start = relativeIndex(await sandboxNumber(args[0], budget, bridge), storage2.length);
15013
15027
  const end = args[1] === void 0 ? storage2.length : relativeIndex(await sandboxNumber(args[1], budget, bridge), storage2.length);
15014
15028
  const length = Math.max(end - start, 0);
15029
+ const layout = float32ViewLayouts.get(receiver);
15030
+ const offset = (layout?.byteOffset ?? storage2.byteOffset) + start * 4;
15031
+ const tracking = layout !== void 0 && layout.length === void 0 && args[1] === void 0;
15032
+ if (defaultConstructor !== void 0) {
15033
+ candidate = await bridge.getProperty(receiver, "constructor");
15034
+ if (candidate !== void 0) {
15035
+ if (candidate === null || typeof candidate !== "object")
15036
+ throw new TypeError("TypedArray constructor must be an object.");
15037
+ candidate = await bridge.getProperty(candidate, Symbol.species);
15038
+ if (candidate !== void 0 && candidate !== null && (!isSandboxClosure(candidate) || candidate.construct === void 0))
15039
+ throw new TypeError("TypedArray species must be a constructor.");
15040
+ }
15041
+ }
15042
+ if (candidate !== void 0 && candidate !== null && candidate !== defaultConstructor) {
15043
+ const values = key === "slice" ? [length] : [storage2.buffer, offset, tracking ? void 0 : length];
15044
+ result = await invokeBuiltinClosure(candidate, values, budget, bridge, void 0, true);
15045
+ if (!isFloat32Array(result)) throw new TypeError("TypedArray species must return typed storage.");
15046
+ const target = float32Storage(result, key === "slice");
15047
+ if (key === "slice" && target.length < length)
15048
+ throw new TypeError("TypedArray species returned insufficient storage.");
15049
+ }
15015
15050
  if (key === "subarray") {
15016
- const layout = float32ViewLayouts.get(receiver);
15017
- const offset = (layout?.byteOffset ?? storage2.byteOffset) + start * 4;
15018
- const tracking = layout !== void 0 && layout.length === void 0 && args[1] === void 0;
15019
- const result2 = new Float32Array(storage2.buffer, offset, tracking ? void 0 : length);
15020
- if (arrayBufferOptions(storage2.buffer) !== void 0)
15021
- float32ViewLayouts.set(result2, { byteOffset: offset, ...tracking ? {} : { length } });
15022
- return result2;
15051
+ if (result === void 0) {
15052
+ result = new Float32Array(storage2.buffer, offset, tracking ? void 0 : length);
15053
+ if (arrayBufferOptions(storage2.buffer) !== void 0)
15054
+ float32ViewLayouts.set(result, { byteOffset: offset, ...tracking ? {} : { length } });
15055
+ }
15056
+ return result;
15057
+ }
15058
+ if (result === void 0) {
15059
+ checkFloat32Allocation(length, budget);
15060
+ result = new Float32Array(length);
15023
15061
  }
15024
- checkFloat32Allocation(length, budget);
15025
- const result = new Float32Array(length);
15062
+ if (!isFloat32Array(result)) throw new TypeError("TypedArray species must return typed storage.");
15026
15063
  if (length > 0) {
15027
15064
  const current = float32Storage(receiver, true);
15065
+ const target = float32Storage(result, true);
15028
15066
  const count = Math.min(length, Math.max(current.length - start, 0));
15029
- if (count > 0) new Uint8Array(result.buffer).set(
15030
- new Uint8Array(current.buffer, current.byteOffset + start * 4, count * 4)
15031
- );
15067
+ if (count > 0) {
15068
+ const sourceBytes = new Uint8Array(current.buffer, current.byteOffset + start * 4, count * 4);
15069
+ const targetBytes = new Uint8Array(target.buffer, target.byteOffset, count * 4);
15070
+ if (current.buffer === target.buffer && targetBytes.byteOffset > sourceBytes.byteOffset && targetBytes.byteOffset < sourceBytes.byteOffset + sourceBytes.length) {
15071
+ for (let index = 0; index < sourceBytes.length; index++) {
15072
+ budget.visitNode();
15073
+ targetBytes[index] = sourceBytes[index];
15074
+ }
15075
+ } else targetBytes.set(sourceBytes);
15076
+ }
15032
15077
  }
15033
15078
  return result;
15034
15079
  } finally {
@@ -42220,4 +42265,4 @@ export {
42220
42265
  FileSnapshotBackend,
42221
42266
  run
42222
42267
  };
42223
- //# sourceMappingURL=chunk-6Y6A7QMJ.js.map
42268
+ //# sourceMappingURL=chunk-X4Q4MITB.js.map