@poe-platform/safe-js 0.1.374 → 0.1.376

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.
@@ -6887,6 +6887,24 @@ function arrayBufferDataProperties(value) {
6887
6887
  });
6888
6888
  }
6889
6889
 
6890
+ // packages/safe-js/src/interp/float16-array.ts
6891
+ import { Float16Array as PonyfillFloat16Array } from "@petamoriken/float16";
6892
+ var float16BackingViews = /* @__PURE__ */ new WeakMap();
6893
+ var FallbackFloat16Array = class Float16Array extends PonyfillFloat16Array {
6894
+ constructor(input, byteOffset, length) {
6895
+ super(input, byteOffset, length);
6896
+ if (Object.getPrototypeOf(this) !== Float16Array.prototype) return;
6897
+ const buffer = this.buffer;
6898
+ float16BackingViews.set(this, new Uint16Array(
6899
+ buffer,
6900
+ this.byteOffset,
6901
+ input === buffer && length === void 0 ? void 0 : this.length
6902
+ ));
6903
+ }
6904
+ };
6905
+ Object.defineProperty(FallbackFloat16Array, "name", { value: "Float16Array", configurable: true });
6906
+ var Float16Array2 = Object.getOwnPropertyDescriptor(globalThis, "Float16Array")?.value ?? FallbackFloat16Array;
6907
+
6890
6908
  // packages/safe-js/src/interp/typed-array-constructors.ts
6891
6909
  var numericTypedArrayConstructors = {
6892
6910
  Float32Array,
@@ -6899,7 +6917,8 @@ var numericTypedArrayConstructors = {
6899
6917
  Uint32Array,
6900
6918
  Float64Array,
6901
6919
  BigInt64Array,
6902
- BigUint64Array
6920
+ BigUint64Array,
6921
+ Float16Array: Float16Array2
6903
6922
  };
6904
6923
 
6905
6924
  // packages/safe-js/src/interp/typed-array.ts
@@ -6934,23 +6953,27 @@ function restoreTypedArrayView(buffer, byteOffset, length, budget, Native = Floa
6934
6953
  }
6935
6954
  }
6936
6955
  function isNumericTypedArray(value) {
6956
+ if (typeof value === "object" && value !== null && float16BackingViews.has(value))
6957
+ return Object.getPrototypeOf(value) === Float16Array2.prototype;
6937
6958
  if (!ArrayBuffer.isView(value)) return false;
6938
6959
  const tag = Reflect.apply(readTag, value, []);
6939
6960
  return Object.hasOwn(numericTypedArrayConstructors, tag) && Object.getPrototypeOf(value) === numericTypedArrayConstructors[tag].prototype;
6940
6961
  }
6941
6962
  function typedArrayStorage(value, requireInBounds = false) {
6942
- if (requireInBounds) Reflect.apply(createValuesIterator, value, []);
6943
- const buffer = Reflect.apply(readBuffer, value, []);
6963
+ const backingView = float16BackingViews.get(value);
6964
+ const view = backingView ?? value;
6965
+ if (requireInBounds) Reflect.apply(createValuesIterator, view, []);
6966
+ const buffer = Reflect.apply(readBuffer, view, []);
6944
6967
  if (Object.getPrototypeOf(buffer) !== ArrayBuffer.prototype) {
6945
6968
  throw new TypeError("Float32Array requires a non-shared ArrayBuffer.");
6946
6969
  }
6947
- const Native = numericTypedArrayConstructors[Reflect.apply(readTag, value, [])];
6970
+ const Native = backingView === void 0 ? numericTypedArrayConstructors[Reflect.apply(readTag, value, [])] : Float16Array2;
6948
6971
  return {
6949
6972
  Native,
6950
6973
  elementSize: Native.BYTES_PER_ELEMENT,
6951
6974
  buffer,
6952
- byteOffset: Reflect.apply(readOffset, value, []),
6953
- length: Reflect.apply(readLength2, value, []),
6975
+ byteOffset: Reflect.apply(readOffset, view, []),
6976
+ length: Reflect.apply(readLength2, view, []),
6954
6977
  byteLength: Reflect.apply(bufferLength, buffer, [])
6955
6978
  };
6956
6979
  }
@@ -8388,8 +8411,9 @@ function getSandboxDataProperty(value, key, budget) {
8388
8411
  }
8389
8412
  return void 0;
8390
8413
  }
8391
- function setSandboxPrototype(value, prototype, budget) {
8414
+ function setSandboxPrototype(value, prototype, budget, throwOnFailure = true) {
8392
8415
  if (budget !== void 0 && intrinsicPrototypes.get(budget) === value && prototype !== null) {
8416
+ if (!throwOnFailure) return false;
8393
8417
  throw new TypeError("Object.prototype has an immutable null prototype.");
8394
8418
  }
8395
8419
  if (!Array.isArray(value) && !isSandboxGenerator(value) && !isSandboxDate(value) && !isSandboxPromise(value) && !isSandboxRegex(value) && !isSandboxMap(value) && !isSandboxSet(value) && !isPrototypeRecord(value) || prototype !== null && !Array.isArray(prototype) && !isSandboxGenerator(prototype) && !isSandboxDate(prototype) && !isSandboxPromise(prototype) && !isSandboxRegex(prototype) && !isSandboxMap(prototype) && !isSandboxSet(prototype) && !isPrototypeRecord(prototype)) {
@@ -8399,18 +8423,23 @@ function setSandboxPrototype(value, prototype, budget) {
8399
8423
  }
8400
8424
  if (getSandboxPrototype(value, budget) === prototype) {
8401
8425
  if (prototype === null) prototypes.set(value, null);
8402
- return;
8426
+ return true;
8403
8427
  }
8404
8428
  if (!Object.isExtensible(isSandboxGenerator(value) ? getGeneratorProperties(value) : isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value)) {
8429
+ if (!throwOnFailure) return false;
8405
8430
  throw new TypeError("Cannot change the prototype of a non-extensible object.");
8406
8431
  }
8407
8432
  let depth = 0;
8408
8433
  for (let current = prototype; current !== null; current = getSandboxPrototype(current, budget)) {
8409
8434
  budget?.visitNode();
8410
8435
  assertSandboxDataDepth(depth++);
8411
- if (current === value) throw new TypeError("Cyclic prototype value.");
8436
+ if (current === value) {
8437
+ if (!throwOnFailure) return false;
8438
+ throw new TypeError("Cyclic prototype value.");
8439
+ }
8412
8440
  }
8413
8441
  prototypes.set(value, prototype);
8442
+ return true;
8414
8443
  }
8415
8444
  function isPrototypeRecord(value) {
8416
8445
  if (isSandboxDataView(value)) return true;
@@ -8435,6 +8464,12 @@ function hasGuestObjectState(value) {
8435
8464
  if (isLiveCapability(value)) return true;
8436
8465
  if (functionProperties.has(value) || prototypes.has(value) && !hasNullObjectPrototype(value)) return true;
8437
8466
  if (isSandboxBox(value) || isSandboxDate(value)) return false;
8467
+ if (Array.isArray(value) && descriptorObjects.has(value)) {
8468
+ return Object.getOwnPropertyNames(value).some((key) => {
8469
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
8470
+ return key === "length" ? descriptor.writable !== true : !descriptor.enumerable || !descriptor.configurable || !descriptor.writable;
8471
+ });
8472
+ }
8438
8473
  return descriptorObjects.has(value) && (isNumericTypedArray(value) ? typedArrayProperties(value).map(([, descriptor]) => descriptor) : Object.values(Object.getOwnPropertyDescriptors(value))).some(
8439
8474
  (descriptor) => !descriptor.enumerable || !descriptor.configurable || !descriptor.writable
8440
8475
  );
@@ -11375,6 +11410,31 @@ var constructors = /* @__PURE__ */ new WeakMap();
11375
11410
  function hasBigIntContent(Native) {
11376
11411
  return Native === BigInt64Array || Native === BigUint64Array;
11377
11412
  }
11413
+ function copyTypedArrayElements(target, source, offset, budget) {
11414
+ if (!float16BackingViews.has(target) && !float16BackingViews.has(source)) {
11415
+ Reflect.apply(Float32Array.prototype.set, target, [source, offset]);
11416
+ return;
11417
+ }
11418
+ const to = typedArrayStorage(target, true);
11419
+ const from = typedArrayStorage(source, true);
11420
+ if (hasBigIntContent(to.Native) !== hasBigIntContent(from.Native))
11421
+ throw new TypeError("Cannot mix BigInt and Number typed arrays.");
11422
+ if (to.Native === from.Native) {
11423
+ new Uint8Array(to.buffer, to.byteOffset + offset * to.elementSize, from.length * from.elementSize).set(new Uint8Array(from.buffer, from.byteOffset, from.length * from.elementSize));
11424
+ return;
11425
+ }
11426
+ if (to.buffer === from.buffer) {
11427
+ checkTypedArrayAllocation(from.length, budget, from.elementSize);
11428
+ const copy = new from.Native(from.length);
11429
+ const copyStorage = typedArrayStorage(copy);
11430
+ new Uint8Array(copyStorage.buffer).set(new Uint8Array(from.buffer, from.byteOffset, from.length * from.elementSize));
11431
+ source = copy;
11432
+ }
11433
+ for (let index = 0; index < from.length; index++) {
11434
+ budget.visitNode();
11435
+ target[offset + index] = source[index];
11436
+ }
11437
+ }
11378
11438
  function typedArrayElement(value, Native, budget, context) {
11379
11439
  return hasBigIntContent(Native) ? sandboxBigInt(value, budget, context) : sandboxNumber(value, budget, context);
11380
11440
  }
@@ -11493,7 +11553,12 @@ function allocateTypedArray(source, budget, Native) {
11493
11553
  if (Array.isArray(source) || isNumericTypedArray(source)) {
11494
11554
  const length2 = isNumericTypedArray(source) ? typedArrayStorage(source).length : source.length;
11495
11555
  checkTypedArrayAllocation(length2, budget, Native.BYTES_PER_ELEMENT);
11496
- if (isNumericTypedArray(source)) return Reflect.construct(Native, [source]);
11556
+ if (isNumericTypedArray(source)) {
11557
+ typedArrayStorage(source, true);
11558
+ const result2 = new Native(length2);
11559
+ copyTypedArrayElements(result2, source, 0, budget);
11560
+ return result2;
11561
+ }
11497
11562
  const result = new Native(length2);
11498
11563
  for (let index = 0; index < length2; index += 1) {
11499
11564
  budget.visitNode();
@@ -12081,7 +12146,7 @@ function getTypedArrayMember(value, property, budget, bindings) {
12081
12146
  length = Number.isNaN(size) || size <= 0 ? 0 : Math.min(Math.trunc(size), Number.MAX_SAFE_INTEGER);
12082
12147
  }
12083
12148
  if (offset + length > targetStorage.length) throw new RangeError("Float32Array#set source is out of bounds.");
12084
- if (isNumericTypedArray(source)) Reflect.apply(Float32Array.prototype.set, receiver, [source, offset]);
12149
+ if (isNumericTypedArray(source)) copyTypedArrayElements(receiver, source, offset, budget);
12085
12150
  else for (let index = 0; index < length; index++) {
12086
12151
  budget.visitNode();
12087
12152
  current = await bridge.getProperty(sourceObject, String(index));
@@ -15103,17 +15168,19 @@ async function definePropertiesFromObject(target, descriptors2, budget, context)
15103
15168
  release();
15104
15169
  }
15105
15170
  }
15106
- function defineDataProperty(target, key, descriptor, budget, context) {
15171
+ function defineDataProperty(target, key, descriptor, budget, context, throwOnFailure = true) {
15107
15172
  budget.visitNode();
15108
15173
  if (isNumericTypedArray(target) && typeof key !== "symbol" && isTypedArrayIndex(String(key)) && "value" in descriptor) {
15109
15174
  const { value, ...attributes } = descriptor;
15110
- Object.defineProperty(target, key, attributes);
15175
+ if (throwOnFailure) Object.defineProperty(target, key, attributes);
15176
+ else if (!Reflect.defineProperty(target, key, attributes)) return false;
15111
15177
  return (async () => {
15112
15178
  const release = retainValues(budget, () => [target, value]);
15113
15179
  try {
15114
15180
  const number = await typedArrayElement(value, typedArrayStorage(target).Native, budget, context);
15115
15181
  Reflect.set(target, key, number);
15116
15182
  markDescriptorObject(target);
15183
+ return throwOnFailure ? void 0 : true;
15117
15184
  } finally {
15118
15185
  release();
15119
15186
  }
@@ -15121,17 +15188,43 @@ function defineDataProperty(target, key, descriptor, budget, context) {
15121
15188
  }
15122
15189
  const properties = objectProperties(target, true);
15123
15190
  if (Array.isArray(properties)) {
15124
- if (key === "length" && "value" in descriptor)
15125
- budget.allocateArrayLength(Number(descriptor.value));
15126
- else if (typeof key !== "symbol") {
15191
+ if (key === "length" && "value" in descriptor) {
15192
+ const applyLength = (first, second) => {
15193
+ const length = first >>> 0;
15194
+ if (length !== second) throw new RangeError("Invalid array length.");
15195
+ budget.allocateArrayLength(length);
15196
+ const normalized = { ...descriptor, value: length };
15197
+ if (throwOnFailure) Object.defineProperty(properties, key, normalized);
15198
+ else {
15199
+ const success = Reflect.defineProperty(properties, key, normalized);
15200
+ markDescriptorObject(properties);
15201
+ return success;
15202
+ }
15203
+ markDescriptorObject(properties);
15204
+ return void 0;
15205
+ };
15206
+ if (typeof descriptor.value === "number") return applyLength(descriptor.value, descriptor.value);
15207
+ return (async () => {
15208
+ const release = retainValues(budget, () => [target, descriptor.value]);
15209
+ try {
15210
+ const first = await sandboxNumber(descriptor.value, budget, context);
15211
+ const second = await sandboxNumber(descriptor.value, budget, context);
15212
+ return applyLength(first, second);
15213
+ } finally {
15214
+ release();
15215
+ }
15216
+ })();
15217
+ } else if (typeof key !== "symbol") {
15127
15218
  const index = Number(key);
15128
15219
  if (Number.isInteger(index) && index >= 0 && index < 4294967295 && String(index) === key) {
15129
15220
  budget.allocateArrayLength(index + 1);
15130
15221
  }
15131
15222
  }
15132
15223
  }
15133
- Object.defineProperty(properties, key, descriptor);
15224
+ if (throwOnFailure) Object.defineProperty(properties, key, descriptor);
15225
+ else if (!Reflect.defineProperty(properties, key, descriptor)) return false;
15134
15226
  markDescriptorObject(properties);
15227
+ return throwOnFailure ? void 0 : true;
15135
15228
  }
15136
15229
  function isAssignableSandboxTarget(value) {
15137
15230
  return typeof value === "object" && value !== null && !isSandboxClosure(value) && !isSandboxGenerator(value) && !isSandboxMap(value) && !isSandboxSet(value) && !isSandboxPromise(value) && !isSandboxRegex(value);
@@ -15675,8 +15768,21 @@ function callFunctionMethod(target, methodName, args, options, stack, context) {
15675
15768
  if (typeof applyArgs !== "object") {
15676
15769
  throw new TypeError("Function#apply requires an object or nullish arguments value.");
15677
15770
  }
15678
- if (context?.getProperty === void 0 && Array.isArray(applyArgs))
15679
- return options.callClosure(target, applyArgs, stack, thisValue);
15771
+ if (context?.getProperty === void 0 && Array.isArray(applyArgs)) {
15772
+ const budget = options.budget ?? new Budget();
15773
+ const length = applyArgs.length;
15774
+ budget.allocateArrayLength(length);
15775
+ const values = [];
15776
+ for (let index = 0; index < length; index++) {
15777
+ const descriptor = getSandboxPropertyDescriptor(applyArgs, String(index), budget);
15778
+ if (descriptor !== void 0 && !("value" in descriptor)) break;
15779
+ values.push(descriptor?.value);
15780
+ }
15781
+ if (values.length === length) {
15782
+ for (let index = 0; index < length; index++) budget.visitNode();
15783
+ return options.callClosure(target, values, stack, thisValue);
15784
+ }
15785
+ }
15680
15786
  return (async () => {
15681
15787
  const budget = options.budget ?? new Budget();
15682
15788
  const invocationContext = {
@@ -26162,7 +26268,7 @@ function createArrayBufferGlobal(budget) {
26162
26268
  sandbox: true,
26163
26269
  name: "isView",
26164
26270
  length: 1,
26165
- call: (args) => ArrayBuffer.isView(args[0])
26271
+ call: (args) => ArrayBuffer.isView(args[0]) || isNumericTypedArray(args[0])
26166
26272
  })
26167
26273
  });
26168
26274
  Object.defineProperties(prototype, {
@@ -26466,6 +26572,139 @@ async function dataViewIndex(value, budget, context) {
26466
26572
  return index;
26467
26573
  }
26468
26574
 
26575
+ // packages/safe-js/src/interp/globals/reflect.ts
26576
+ var nativeReflectPropertyNames = Object.getOwnPropertyNames(Reflect);
26577
+ function createReflectGlobal(budget) {
26578
+ const methods2 = {
26579
+ ownKeys: { length: 1, call: ([target]) => {
26580
+ const properties = objectProperties(target);
26581
+ return allocateProducedSandboxValue([...Object.getOwnPropertyNames(properties), ...ownSandboxSymbolKeys(target)], budget);
26582
+ } },
26583
+ getOwnPropertyDescriptor: { length: 2, call: async ([target, key], context) => {
26584
+ objectProperties(target);
26585
+ const property = await toPropertyKey(key, budget, context);
26586
+ const descriptor = Object.getOwnPropertyDescriptor(objectProperties(target), property);
26587
+ return descriptor === void 0 ? void 0 : allocateProducedSandboxValue(exposePropertyDescriptor(descriptor), budget);
26588
+ } },
26589
+ getPrototypeOf: { length: 1, call: ([target]) => {
26590
+ objectProperties(target);
26591
+ return getSandboxPrototype(target, budget);
26592
+ } },
26593
+ has: { length: 2, call: async ([target, key], context) => {
26594
+ objectProperties(target);
26595
+ return getSandboxPropertyDescriptor(target, await toPropertyKey(key, budget, context), budget) !== void 0;
26596
+ } },
26597
+ isExtensible: { length: 1, call: ([target]) => Object.isExtensible(objectProperties(target)) },
26598
+ preventExtensions: { length: 1, call: ([target]) => Reflect.preventExtensions(objectProperties(target, true)) },
26599
+ deleteProperty: { length: 2, call: async ([target, key], context) => {
26600
+ objectProperties(target, true);
26601
+ const property = await toPropertyKey(key, budget, context);
26602
+ return Reflect.deleteProperty(objectProperties(target, true), property);
26603
+ } },
26604
+ get: { length: 2, call: async (args, context) => {
26605
+ const [target, key] = args;
26606
+ objectProperties(target);
26607
+ const property = await toPropertyKey(key, budget, context);
26608
+ const descriptor = getSandboxPropertyDescriptor(target, property, budget);
26609
+ return descriptor === void 0 ? void 0 : readPropertyDescriptor(descriptor, args.length > 2 ? args[2] : target, context);
26610
+ } },
26611
+ defineProperty: { length: 3, call: async ([target, key, input], context) => {
26612
+ objectProperties(target, true);
26613
+ const property = await toPropertyKey(key, budget, context);
26614
+ const descriptor = await propertyDescriptor(input, budget, context);
26615
+ return await defineDataProperty(target, property, descriptor, budget, context, false);
26616
+ } },
26617
+ setPrototypeOf: { length: 2, call: ([target, prototype]) => {
26618
+ objectProperties(target, true);
26619
+ if (prototype !== null) objectProperties(prototype);
26620
+ return setSandboxPrototype(target, prototype, budget, false);
26621
+ } },
26622
+ set: { length: 3, call: async (args, context) => {
26623
+ const [target, key, value] = args;
26624
+ objectProperties(target, true);
26625
+ const property = await toPropertyKey(key, budget, context);
26626
+ const receiver = args.length > 3 ? args[3] : target;
26627
+ let descriptor;
26628
+ let depth = 0;
26629
+ for (let current = target; current !== null; current = getSandboxPrototype(current, budget)) {
26630
+ budget.visitNode();
26631
+ assertSandboxDataDepth(depth++);
26632
+ if (isNumericTypedArray(current) && typeof property === "string" && isTypedArrayIndex(property)) {
26633
+ if (current === receiver) {
26634
+ await setTypedArrayMember(current, property, value, budget, context);
26635
+ return true;
26636
+ }
26637
+ if (Object.getOwnPropertyDescriptor(current, property) === void 0) return true;
26638
+ }
26639
+ descriptor = Object.getOwnPropertyDescriptor(objectProperties(current), property);
26640
+ if (descriptor !== void 0) break;
26641
+ }
26642
+ if (descriptor !== void 0 && !("value" in descriptor)) {
26643
+ const setter = accessorClosure(descriptor.set);
26644
+ if (setter === void 0) return false;
26645
+ await context.invokeClosure(setter, [value], receiver);
26646
+ return true;
26647
+ }
26648
+ if (descriptor !== void 0 && !descriptor.writable) return false;
26649
+ if (receiver === null || typeof receiver !== "object") return false;
26650
+ const existing = Object.getOwnPropertyDescriptor(objectProperties(receiver, true), property);
26651
+ if (existing !== void 0 && (!("value" in existing) || !existing.writable)) return false;
26652
+ return await defineDataProperty(receiver, property, existing === void 0 ? { value, writable: true, enumerable: true, configurable: true } : { value }, budget, context, false);
26653
+ } },
26654
+ apply: { length: 3, call: ([target, receiver, values], context) => {
26655
+ if (!isSandboxClosure(target)) throw new TypeError("Reflect.apply requires a callable target.");
26656
+ objectProperties(values);
26657
+ return callFunctionMethod(target, "apply", [receiver, values], {
26658
+ budget,
26659
+ callClosure: (callee, args, _stack, thisValue) => context.invokeClosure(callee, args, thisValue)
26660
+ }, context.stack, context);
26661
+ } },
26662
+ construct: { length: 2, call: (args, context) => {
26663
+ const [target, values] = args;
26664
+ const newTarget = args.length > 2 ? args[2] : target;
26665
+ if (!isSandboxClosure(target) || target.construct === void 0 || !isSandboxClosure(newTarget) || newTarget.construct === void 0)
26666
+ throw new TypeError("Reflect.construct requires constructor targets.");
26667
+ objectProperties(values);
26668
+ return callFunctionMethod(target, "apply", [void 0, values], {
26669
+ budget,
26670
+ callClosure: (callee, items) => context.invokeClosure(callee, items, void 0, true, newTarget)
26671
+ }, context.stack, context);
26672
+ } }
26673
+ };
26674
+ const reflect = {};
26675
+ for (const name of nativeReflectPropertyNames) {
26676
+ const method = methods2[name];
26677
+ if (method === void 0) continue;
26678
+ const closure = createSandboxClosure({
26679
+ guest: true,
26680
+ sandbox: true,
26681
+ name,
26682
+ length: method.length,
26683
+ call: async (args, context) => {
26684
+ const release = retainValues(budget, () => args);
26685
+ try {
26686
+ return await method.call(args, {
26687
+ ...context,
26688
+ stack: context?.stack ?? [],
26689
+ thisValue: context?.thisValue,
26690
+ invokeClosure: context?.invokeClosure ?? ((target, values, receiver, construct, newTarget) => invokeBuiltinClosure(target, values, budget, { ...context, stack: context?.stack ?? [], thisValue: receiver, newTarget }, receiver, construct))
26691
+ });
26692
+ } finally {
26693
+ release();
26694
+ }
26695
+ }
26696
+ });
26697
+ Object.defineProperty(reflect, name, { value: closure, writable: true, configurable: true });
26698
+ }
26699
+ Object.defineProperty(reflect, Symbol.toStringTag, { value: "Reflect", configurable: true });
26700
+ registerBuiltinIdentities(budget, { Reflect: reflect });
26701
+ for (const descriptor of Object.values(Object.getOwnPropertyDescriptors(reflect))) {
26702
+ if (isSandboxClosure(descriptor.value)) registerIntrinsicFunction(budget, descriptor.value);
26703
+ }
26704
+ registerIntrinsicObject(budget, reflect);
26705
+ return reflect;
26706
+ }
26707
+
26469
26708
  // packages/safe-js/src/interp/globals.ts
26470
26709
  function createBuiltinBindings(options) {
26471
26710
  const bindings = {
@@ -26478,6 +26717,7 @@ function createBuiltinBindings(options) {
26478
26717
  ...createErrorGlobals({ ...options, errorPrototypes: options.errorPrototypes !== false }),
26479
26718
  ...createMathGlobals({ random: options.random, budget: options.budget }),
26480
26719
  ...createObjectArrayGlobals(options),
26720
+ Reflect: createReflectGlobal(options.budget),
26481
26721
  ArrayBuffer: createArrayBufferGlobal(options.budget),
26482
26722
  DataView: createDataViewGlobal(options.budget),
26483
26723
  ...createMiscGlobals(options),
@@ -29069,7 +29309,7 @@ function copyFromSandbox(value, state, path = "<root>", options, depth = 0) {
29069
29309
  if (options.unwrapHostObject === void 0) throw new TypeError("Live capabilities require their owning realm bridge.");
29070
29310
  return options.unwrapHostObject(value);
29071
29311
  }
29072
- if (nodeTypes.isProxy(value)) throw new TypeError("Unsupported proxy sandbox value.");
29312
+ if (nodeTypes.isProxy(value) && !isNumericTypedArray(value)) throw new TypeError("Unsupported proxy sandbox value.");
29073
29313
  if (sandboxErrorTypes.has(value) && hasExplicitSandboxPrototype(value)) {
29074
29314
  const prototype = getSandboxPrototype(value);
29075
29315
  let nativePrototype = null;
@@ -31158,6 +31398,7 @@ var KNOWN_RUNTIME_GLOBALS = [
31158
31398
  "Promise",
31159
31399
  "RangeError",
31160
31400
  "ReferenceError",
31401
+ "Reflect",
31161
31402
  "RegExp",
31162
31403
  "Set",
31163
31404
  "String",
@@ -43647,4 +43888,4 @@ export {
43647
43888
  FileSnapshotBackend,
43648
43889
  run
43649
43890
  };
43650
- //# sourceMappingURL=chunk-35DAUDMZ.js.map
43891
+ //# sourceMappingURL=chunk-7UITTELW.js.map