@poe-platform/safe-js 0.1.284 → 0.1.285

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-TF7REBUG.js";
30
+ } from "./chunk-O3NO3NGW.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-KSXYQRJE.js.map
8252
+ //# sourceMappingURL=chunk-4HGDBYOL.js.map
@@ -21934,6 +21934,7 @@ function createDateGlobal(options) {
21934
21934
  if (!isSandboxDate(receiver))
21935
21935
  throw new TypeError(`Date#${name} requires a Date receiver.`);
21936
21936
  options.budget.visitNode();
21937
+ if (name.startsWith("set")) return coerceDateSetter(name, receiver, args, options.budget, context);
21937
21938
  const value = method.invoke(receiver, args);
21938
21939
  return typeof value === "string" ? options.budget.allocateString(value) : value;
21939
21940
  }
@@ -21965,6 +21966,15 @@ async function coerceDateParts(args, utc, budget, context) {
21965
21966
  for (const value of args.slice(0, 7)) parts.push(await sandboxNumber(value, budget, context));
21966
21967
  return dateFromParts(parts, utc);
21967
21968
  }
21969
+ async function coerceDateSetter(name, receiver, args, budget, context) {
21970
+ const method = dateMethods.get(name);
21971
+ const initialTime = dateTime(receiver);
21972
+ const converted = [];
21973
+ for (const value of args.slice(0, method.length)) converted.push(await sandboxNumber(value, budget, context));
21974
+ if (Number.isNaN(initialTime) && name !== "setTime" && !name.endsWith("FullYear")) return NaN;
21975
+ const result = method.invoke(createSandboxDate(initialTime), converted);
21976
+ return dateMethods.get("setTime").invoke(receiver, [result]);
21977
+ }
21968
21978
  async function dateToJSON(receiver, budget, context) {
21969
21979
  if (receiver === null || receiver === void 0) throw new TypeError("Date JSON conversion requires a receiver.");
21970
21980
  if (typeof receiver === "number" || typeof receiver === "string" || typeof receiver === "boolean") {
@@ -25672,7 +25682,7 @@ function copyToSandbox(value, state, path = "<root>", cloneSandboxCollections =
25672
25682
  }
25673
25683
  return copy;
25674
25684
  }
25675
- if (typeof value === "object" && value !== null && hasGuestObjectState(value)) {
25685
+ if (typeof value === "object" && value !== null && hasGuestObjectState(value) && !(state.structuredClone && isSandboxDate(value))) {
25676
25686
  throw new TypeError("Guest prototype links and custom descriptors cannot be copied as data.");
25677
25687
  }
25678
25688
  const primitive = nativeBoxedValue(value);
@@ -25741,6 +25751,7 @@ function copyToSandbox(value, state, path = "<root>", cloneSandboxCollections =
25741
25751
  if (existing !== void 0) return existing;
25742
25752
  const copy = copyNativeDate(value);
25743
25753
  state.seen.set(value, copy);
25754
+ if (state.structuredClone) return copy;
25744
25755
  if (!state.structuredClone && hasNullObjectPrototype(value)) setSandboxPrototype(copy, null);
25745
25756
  for (const [key, descriptor] of dateDataProperties(value)) {
25746
25757
  Object.defineProperty(copy, key, { ...descriptor, value: copyToSandbox(descriptor.value, state, joinPath2(path, key), cloneSandboxCollections, depth + 1) });
@@ -40319,4 +40330,4 @@ export {
40319
40330
  FileSnapshotBackend,
40320
40331
  run
40321
40332
  };
40322
- //# sourceMappingURL=chunk-TF7REBUG.js.map
40333
+ //# sourceMappingURL=chunk-O3NO3NGW.js.map