@poe-platform/safe-js 0.1.412 → 0.1.413

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.
@@ -8987,7 +8987,7 @@ function restoreRegexProperties(value, data, decode) {
8987
8987
  }
8988
8988
 
8989
8989
  // packages/safe-js/src/snapshot/validation.ts
8990
- import { types as types8 } from "node:util";
8990
+ import { types as types9 } from "node:util";
8991
8991
 
8992
8992
  // packages/safe-js/src/interp/builtin-call.ts
8993
8993
  async function invokeBuiltinClosure(closure, args, budget, context, thisValue, construct = false) {
@@ -23684,6 +23684,9 @@ async function formatDateLocale(name, time, args, budget, context) {
23684
23684
  }
23685
23685
  }
23686
23686
 
23687
+ // packages/safe-js/src/interp/host-bridge.ts
23688
+ import { types as types8 } from "node:util";
23689
+
23687
23690
  // packages/safe-js/src/snapshot/replay-data.ts
23688
23691
  var MissingReplayCapabilityError = class extends TypeError {
23689
23692
  };
@@ -24633,11 +24636,12 @@ function copyHostResultToSandbox(result, stackFrames, options) {
24633
24636
  return value;
24634
24637
  }
24635
24638
  function createHostErrorValue(reason, stackFrames, budget, span, state = { seen: /* @__PURE__ */ new WeakMap() }, chargeBudget = false) {
24636
- if (reason instanceof Error) {
24639
+ const nativeError = types8.isNativeError(reason) || reason instanceof Error;
24640
+ if (nativeError) {
24637
24641
  const existing = state.seen.get(reason);
24638
24642
  if (existing !== void 0) return existing;
24639
24643
  }
24640
- const error = reason instanceof Error ? createSubsetErrorValue(reason.name, reason.message, stackFrames, budget, {
24644
+ const error = nativeError ? createSubsetErrorValue(reason.name, reason.message, stackFrames, budget, {
24641
24645
  cause: reason,
24642
24646
  chargeBudget,
24643
24647
  transport: true
@@ -24645,7 +24649,7 @@ function createHostErrorValue(reason, stackFrames, budget, span, state = { seen:
24645
24649
  chargeBudget: false,
24646
24650
  transport: true
24647
24651
  });
24648
- if (reason instanceof Error) {
24652
+ if (nativeError) {
24649
24653
  state.seen.set(reason, error);
24650
24654
  copyHostErrorMetadata(error, reason, budget, chargeBudget);
24651
24655
  const errors = reason instanceof AggregateError ? Object.getOwnPropertyDescriptor(reason, "errors") : void 0;
@@ -24867,7 +24871,7 @@ function copyHostValueToSandbox(value, stackFrames, options, state, path) {
24867
24871
  if (typeof value === "string") {
24868
24872
  return options.budget.allocateString(value);
24869
24873
  }
24870
- if (value instanceof Error) {
24874
+ if (types8.isNativeError(value) || value instanceof Error) {
24871
24875
  return createHostErrorValue(value, stackFrames, budget, void 0, state, true);
24872
24876
  }
24873
24877
  if (options.errorData && (typeof value === "function" || isSandboxClosure(value) || isSandboxPromise(value) || value instanceof Promise)) {
@@ -29512,7 +29516,7 @@ function validateGenericValue(value, path, depth, state) {
29512
29516
  if (typeof value === "object" && value !== null && hasGuestObjectState(value)) {
29513
29517
  fail("invalidState", path, "guest function properties, prototype links and custom descriptors cannot be restored");
29514
29518
  }
29515
- if (state.dataPropertiesOnly && types8.isProxy(value)) {
29519
+ if (state.dataPropertiesOnly && types9.isProxy(value)) {
29516
29520
  fail("invalidType", path, "proxy objects are not snapshot data");
29517
29521
  }
29518
29522
  if (depth > state.limits.maxDepth)
@@ -43467,7 +43471,7 @@ function createReplayableRandom(options = {}) {
43467
43471
 
43468
43472
  // packages/safe-js/src/realm.ts
43469
43473
  import { AsyncLocalStorage as AsyncLocalStorage6 } from "node:async_hooks";
43470
- import { types as types9 } from "node:util";
43474
+ import { types as types10 } from "node:util";
43471
43475
 
43472
43476
  // packages/safe-js/src/modules/registry.ts
43473
43477
  function createUnknownModuleMessage2(moduleName, moduleNames) {
@@ -43606,7 +43610,7 @@ var RealmState = class {
43606
43610
  throw new TypeError("Realm limits must be positive safe integers with supported names.");
43607
43611
  this.limits[name] = Number(value);
43608
43612
  }
43609
- if (options.extensions !== void 0 && (!Array.isArray(options.extensions) || types9.isProxy(options.extensions)))
43613
+ if (options.extensions !== void 0 && (!Array.isArray(options.extensions) || types10.isProxy(options.extensions)))
43610
43614
  throw new TypeError("Extensions must be a registration array.");
43611
43615
  const registrations = options.extensions ?? [];
43612
43616
  const extensions = [];
@@ -43841,7 +43845,7 @@ var RealmState = class {
43841
43845
  return this.phase.run(phase, () => {
43842
43846
  try {
43843
43847
  const result = call();
43844
- if (types9.isPromise(result) || phase.pending.size > 0 || phase.failure !== void 0) {
43848
+ if (types10.isPromise(result) || phase.pending.size > 0 || phase.failure !== void 0) {
43845
43849
  return Promise.resolve(result).then(
43846
43850
  async (value) => {
43847
43851
  await Promise.allSettled(phase.pending);
@@ -43910,7 +43914,7 @@ var RealmState = class {
43910
43914
  },
43911
43915
  read: (operation, validate) => {
43912
43916
  const value = this.invokeHost(operation, operation);
43913
- if (types9.isPromise(value)) {
43917
+ if (types10.isPromise(value)) {
43914
43918
  void Promise.resolve(value).catch(() => void 0);
43915
43919
  throw new TypeError("Live property operations must be synchronous.");
43916
43920
  }
@@ -43918,7 +43922,7 @@ var RealmState = class {
43918
43922
  },
43919
43923
  write: (operation, value) => {
43920
43924
  const result = this.invokeHost(operation, () => operation(this.exportValue(value)));
43921
- if (types9.isPromise(result)) {
43925
+ if (types10.isPromise(result)) {
43922
43926
  void Promise.resolve(result).catch(() => void 0);
43923
43927
  throw new TypeError("Live property setters must be synchronous.");
43924
43928
  }
@@ -44127,7 +44131,7 @@ var RealmState = class {
44127
44131
  }
44128
44132
  });
44129
44133
  const output = getExtensionSetup(extension)(context);
44130
- if (types9.isPromise(output)) {
44134
+ if (types10.isPromise(output)) {
44131
44135
  void Promise.resolve(output).catch(() => void 0);
44132
44136
  throw new TypeError("Extension setup must be synchronous.");
44133
44137
  }
@@ -44319,7 +44323,7 @@ var RealmState = class {
44319
44323
  };
44320
44324
  function readModules(input) {
44321
44325
  const entries = (value, label) => {
44322
- if (types9.isMap(value) && !types9.isProxy(value)) {
44326
+ if (types10.isMap(value) && !types10.isProxy(value)) {
44323
44327
  const result = [...Map.prototype.entries.call(value)];
44324
44328
  if (result.length > 4096 || result.some(([key]) => typeof key !== "string" || key.length === 0))
44325
44329
  throw new TypeError(`${label} requires bounded string keys.`);
@@ -45589,4 +45593,4 @@ export {
45589
45593
  FileSnapshotBackend,
45590
45594
  run
45591
45595
  };
45592
- //# sourceMappingURL=chunk-7Y4M6UQR.js.map
45596
+ //# sourceMappingURL=chunk-U6LJFM6J.js.map