@poe-platform/safe-js 0.1.410 → 0.1.412

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);
@@ -8164,6 +8165,7 @@ var typedArrayPrototypes = /* @__PURE__ */ new WeakMap();
8164
8165
  var guestClosures = /* @__PURE__ */ new WeakSet();
8165
8166
  var functionProperties = /* @__PURE__ */ new WeakMap();
8166
8167
  var functionPropertyRevisions = /* @__PURE__ */ new WeakMap();
8168
+ var trackedIntrinsicObjects = /* @__PURE__ */ new WeakSet();
8167
8169
  var prototypes = /* @__PURE__ */ new WeakMap();
8168
8170
  var trackedPrototypes = /* @__PURE__ */ new WeakMap();
8169
8171
  function storePrototype(value, prototype) {
@@ -8225,6 +8227,20 @@ function materializeFunctionProperties(closure) {
8225
8227
  descriptorObjects.add(prototype);
8226
8228
  Object.defineProperty(properties, "prototype", { value: prototype, writable: true });
8227
8229
  }
8230
+ const tracked = trackPropertyTable(properties);
8231
+ descriptorObjects.add(tracked);
8232
+ functionProperties.set(closure, tracked);
8233
+ return tracked;
8234
+ }
8235
+ function createIntrinsicObject(initial = /* @__PURE__ */ Object.create(null)) {
8236
+ const tracked = trackPropertyTable(Object.create(Object.getPrototypeOf(initial), Object.getOwnPropertyDescriptors(initial)));
8237
+ trackedIntrinsicObjects.add(tracked);
8238
+ return tracked;
8239
+ }
8240
+ function isTrackedIntrinsicObject(value) {
8241
+ return trackedIntrinsicObjects.has(value);
8242
+ }
8243
+ function trackPropertyTable(properties) {
8228
8244
  const state = { revision: 0 };
8229
8245
  const tracked = new Proxy(properties, {
8230
8246
  defineProperty(target, key, descriptor) {
@@ -8239,8 +8255,6 @@ function materializeFunctionProperties(closure) {
8239
8255
  }
8240
8256
  });
8241
8257
  functionPropertyRevisions.set(tracked, state);
8242
- descriptorObjects.add(tracked);
8243
- functionProperties.set(closure, tracked);
8244
8258
  return tracked;
8245
8259
  }
8246
8260
  function getGuestFunctionProperty(closure, key) {
@@ -11872,7 +11886,7 @@ function allocateTypedArray(source, budget, Native) {
11872
11886
  return new Native(length);
11873
11887
  }
11874
11888
  function createNumericTypedArrayPrototypes(budget, bindings) {
11875
- const shared = /* @__PURE__ */ Object.create(null);
11889
+ const shared = createIntrinsicObject();
11876
11890
  const abstractCall = () => {
11877
11891
  throw new TypeError("Abstract TypedArray constructor cannot be called.");
11878
11892
  };
@@ -11989,7 +12003,7 @@ function createNumericTypedArrayPrototypes(budget, bindings) {
11989
12003
  const prototypes2 = /* @__PURE__ */ new Map();
11990
12004
  for (const [name, Native] of Object.entries(numericTypedArrayConstructors)) {
11991
12005
  const constructor = bindings[name];
11992
- const prototype = /* @__PURE__ */ Object.create(null);
12006
+ const prototype = createIntrinsicObject();
11993
12007
  Object.defineProperties(materializeFunctionProperties(constructor), {
11994
12008
  prototype: { value: prototype, writable: false },
11995
12009
  BYTES_PER_ELEMENT: { value: Native.BYTES_PER_ELEMENT, writable: false, enumerable: false, configurable: false }
@@ -26212,7 +26226,7 @@ function f16round(value) {
26212
26226
  function createMathGlobals(options = {}) {
26213
26227
  const random = options.random ?? Math.random;
26214
26228
  const budget = options.budget ?? new Budget();
26215
- const mathObject = {
26229
+ const mathObject = createIntrinsicObject({
26216
26230
  E: Math.E,
26217
26231
  LN2: Math.LN2,
26218
26232
  LN10: Math.LN10,
@@ -26229,7 +26243,7 @@ function createMathGlobals(options = {}) {
26229
26243
  length: 1,
26230
26244
  call: ([source], context) => sumPrecise(source, budget, context)
26231
26245
  })
26232
- };
26246
+ });
26233
26247
  for (const [name, method] of Object.entries(mathMethods)) {
26234
26248
  const variadic = method === Math.max || method === Math.min || method === Math.hypot;
26235
26249
  mathObject[name] = createSandboxClosure({
@@ -30990,7 +31004,7 @@ function copyFromSandbox(value, state, path = "<root>", options, depth = 0) {
30990
31004
  if (options.unwrapHostObject === void 0) throw new TypeError("Live capabilities require their owning realm bridge.");
30991
31005
  return options.unwrapHostObject(value);
30992
31006
  }
30993
- if (nodeTypes.isProxy(value) && !isNumericTypedArray(value)) throw new TypeError("Unsupported proxy sandbox value.");
31007
+ if (nodeTypes.isProxy(value) && !isNumericTypedArray(value) && !isTrackedIntrinsicObject(value)) throw new TypeError("Unsupported proxy sandbox value.");
30994
31008
  if (sandboxErrorTypes.has(value) && hasExplicitSandboxPrototype(value)) {
30995
31009
  const prototype = getSandboxPrototype(value);
30996
31010
  let nativePrototype = null;
@@ -45575,4 +45589,4 @@ export {
45575
45589
  FileSnapshotBackend,
45576
45590
  run
45577
45591
  };
45578
- //# sourceMappingURL=chunk-I5MW527A.js.map
45592
+ //# sourceMappingURL=chunk-7Y4M6UQR.js.map