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