@poe-platform/safe-js 0.1.413 → 0.1.414

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 types9 } from "node:util";
8990
+ import { types as types10 } 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) {
@@ -16480,6 +16480,7 @@ async function callSetMethod(target, methodName, args, options, stack = []) {
16480
16480
  }
16481
16481
 
16482
16482
  // packages/safe-js/src/interp/globals/error.ts
16483
+ import { types as types8 } from "node:util";
16483
16484
  var errorConstructorNames = /* @__PURE__ */ new WeakMap();
16484
16485
  var errorNames = [
16485
16486
  "Error",
@@ -16553,7 +16554,20 @@ function createErrorPrototypes(budget, constructors2) {
16553
16554
  }
16554
16555
  })
16555
16556
  });
16557
+ const isError = createSandboxClosure({
16558
+ guest: true,
16559
+ sandbox: true,
16560
+ name: "isError",
16561
+ length: 1,
16562
+ call: ([value]) => typeof value === "object" && value !== null && (sandboxErrorTypes.has(value) || types8.isNativeError(value))
16563
+ });
16564
+ Object.defineProperty(materializeFunctionProperties(constructors2.Error), "isError", {
16565
+ value: isError,
16566
+ writable: true,
16567
+ configurable: true
16568
+ });
16556
16569
  registerBuiltinIdentities(budget, Object.fromEntries(errorNames.map((name) => [name, constructors2[name]])));
16570
+ registerIntrinsicFunction(budget, isError);
16557
16571
  for (const name of errorNames) {
16558
16572
  registerIntrinsicFunction(budget, constructors2[name]);
16559
16573
  registerIntrinsicObject(budget, prototypes2.get(name));
@@ -23685,7 +23699,7 @@ async function formatDateLocale(name, time, args, budget, context) {
23685
23699
  }
23686
23700
 
23687
23701
  // packages/safe-js/src/interp/host-bridge.ts
23688
- import { types as types8 } from "node:util";
23702
+ import { types as types9 } from "node:util";
23689
23703
 
23690
23704
  // packages/safe-js/src/snapshot/replay-data.ts
23691
23705
  var MissingReplayCapabilityError = class extends TypeError {
@@ -24636,7 +24650,7 @@ function copyHostResultToSandbox(result, stackFrames, options) {
24636
24650
  return value;
24637
24651
  }
24638
24652
  function createHostErrorValue(reason, stackFrames, budget, span, state = { seen: /* @__PURE__ */ new WeakMap() }, chargeBudget = false) {
24639
- const nativeError = types8.isNativeError(reason) || reason instanceof Error;
24653
+ const nativeError = types9.isNativeError(reason) || reason instanceof Error;
24640
24654
  if (nativeError) {
24641
24655
  const existing = state.seen.get(reason);
24642
24656
  if (existing !== void 0) return existing;
@@ -24871,7 +24885,7 @@ function copyHostValueToSandbox(value, stackFrames, options, state, path) {
24871
24885
  if (typeof value === "string") {
24872
24886
  return options.budget.allocateString(value);
24873
24887
  }
24874
- if (types8.isNativeError(value) || value instanceof Error) {
24888
+ if (types9.isNativeError(value) || value instanceof Error) {
24875
24889
  return createHostErrorValue(value, stackFrames, budget, void 0, state, true);
24876
24890
  }
24877
24891
  if (options.errorData && (typeof value === "function" || isSandboxClosure(value) || isSandboxPromise(value) || value instanceof Promise)) {
@@ -29516,7 +29530,7 @@ function validateGenericValue(value, path, depth, state) {
29516
29530
  if (typeof value === "object" && value !== null && hasGuestObjectState(value)) {
29517
29531
  fail("invalidState", path, "guest function properties, prototype links and custom descriptors cannot be restored");
29518
29532
  }
29519
- if (state.dataPropertiesOnly && types9.isProxy(value)) {
29533
+ if (state.dataPropertiesOnly && types10.isProxy(value)) {
29520
29534
  fail("invalidType", path, "proxy objects are not snapshot data");
29521
29535
  }
29522
29536
  if (depth > state.limits.maxDepth)
@@ -43471,7 +43485,7 @@ function createReplayableRandom(options = {}) {
43471
43485
 
43472
43486
  // packages/safe-js/src/realm.ts
43473
43487
  import { AsyncLocalStorage as AsyncLocalStorage6 } from "node:async_hooks";
43474
- import { types as types10 } from "node:util";
43488
+ import { types as types11 } from "node:util";
43475
43489
 
43476
43490
  // packages/safe-js/src/modules/registry.ts
43477
43491
  function createUnknownModuleMessage2(moduleName, moduleNames) {
@@ -43610,7 +43624,7 @@ var RealmState = class {
43610
43624
  throw new TypeError("Realm limits must be positive safe integers with supported names.");
43611
43625
  this.limits[name] = Number(value);
43612
43626
  }
43613
- if (options.extensions !== void 0 && (!Array.isArray(options.extensions) || types10.isProxy(options.extensions)))
43627
+ if (options.extensions !== void 0 && (!Array.isArray(options.extensions) || types11.isProxy(options.extensions)))
43614
43628
  throw new TypeError("Extensions must be a registration array.");
43615
43629
  const registrations = options.extensions ?? [];
43616
43630
  const extensions = [];
@@ -43845,7 +43859,7 @@ var RealmState = class {
43845
43859
  return this.phase.run(phase, () => {
43846
43860
  try {
43847
43861
  const result = call();
43848
- if (types10.isPromise(result) || phase.pending.size > 0 || phase.failure !== void 0) {
43862
+ if (types11.isPromise(result) || phase.pending.size > 0 || phase.failure !== void 0) {
43849
43863
  return Promise.resolve(result).then(
43850
43864
  async (value) => {
43851
43865
  await Promise.allSettled(phase.pending);
@@ -43914,7 +43928,7 @@ var RealmState = class {
43914
43928
  },
43915
43929
  read: (operation, validate) => {
43916
43930
  const value = this.invokeHost(operation, operation);
43917
- if (types10.isPromise(value)) {
43931
+ if (types11.isPromise(value)) {
43918
43932
  void Promise.resolve(value).catch(() => void 0);
43919
43933
  throw new TypeError("Live property operations must be synchronous.");
43920
43934
  }
@@ -43922,7 +43936,7 @@ var RealmState = class {
43922
43936
  },
43923
43937
  write: (operation, value) => {
43924
43938
  const result = this.invokeHost(operation, () => operation(this.exportValue(value)));
43925
- if (types10.isPromise(result)) {
43939
+ if (types11.isPromise(result)) {
43926
43940
  void Promise.resolve(result).catch(() => void 0);
43927
43941
  throw new TypeError("Live property setters must be synchronous.");
43928
43942
  }
@@ -44131,7 +44145,7 @@ var RealmState = class {
44131
44145
  }
44132
44146
  });
44133
44147
  const output = getExtensionSetup(extension)(context);
44134
- if (types10.isPromise(output)) {
44148
+ if (types11.isPromise(output)) {
44135
44149
  void Promise.resolve(output).catch(() => void 0);
44136
44150
  throw new TypeError("Extension setup must be synchronous.");
44137
44151
  }
@@ -44323,7 +44337,7 @@ var RealmState = class {
44323
44337
  };
44324
44338
  function readModules(input) {
44325
44339
  const entries = (value, label) => {
44326
- if (types10.isMap(value) && !types10.isProxy(value)) {
44340
+ if (types11.isMap(value) && !types11.isProxy(value)) {
44327
44341
  const result = [...Map.prototype.entries.call(value)];
44328
44342
  if (result.length > 4096 || result.some(([key]) => typeof key !== "string" || key.length === 0))
44329
44343
  throw new TypeError(`${label} requires bounded string keys.`);
@@ -45593,4 +45607,4 @@ export {
45593
45607
  FileSnapshotBackend,
45594
45608
  run
45595
45609
  };
45596
- //# sourceMappingURL=chunk-U6LJFM6J.js.map
45610
+ //# sourceMappingURL=chunk-OGZMY5KV.js.map