@poe-platform/safe-js 0.1.165 → 0.1.166

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.
@@ -27,7 +27,7 @@ import {
27
27
  validateMigrationSemantics,
28
28
  validateSnapshotData,
29
29
  validateSnapshotMigration
30
- } from "./chunk-IHPQO2HC.js";
30
+ } from "./chunk-LVK2NO45.js";
31
31
 
32
32
  // packages/safe-js/src/migrate.ts
33
33
  import { createHash } from "node:crypto";
@@ -8249,4 +8249,4 @@ export {
8249
8249
  parseMcpConfig,
8250
8250
  makeMcpModule
8251
8251
  };
8252
- //# sourceMappingURL=chunk-4JKST34C.js.map
8252
+ //# sourceMappingURL=chunk-L2WEG3IX.js.map
@@ -16024,42 +16024,47 @@ function applyBinaryOperator(node, left, right, context) {
16024
16024
  case ">>>":
16025
16025
  return toNumber(left) >>> toNumber(right);
16026
16026
  case "instanceof":
16027
- while (isSandboxClosure(right) && right.boundTarget !== void 0) right = right.boundTarget;
16028
- if (isSandboxPromiseConstructor(right)) return isSandboxPromise(left);
16029
- if (isSandboxMapConstructor(right) && isSandboxMap(left)) {
16030
- return true;
16031
- }
16032
- if (isFloat32ArrayConstructor(right)) return isFloat32Array(left);
16033
- if (isDateConstructor(right))
16034
- return isSandboxDate(left) && getDatePrototype(left, context.budget, context.compilation?.owner) !== null;
16035
- if (isSandboxSetConstructor(right) && isSandboxSet(left)) {
16036
- return true;
16037
- }
16038
- if (isSandboxErrorConstructorInstance2(left, right)) {
16039
- return true;
16040
- }
16041
- if (isGuestClosure(right)) {
16042
- if (typeof left !== "object" || left === null) return false;
16043
- const check = (prototype2) => {
16044
- if (typeof prototype2 !== "object" || prototype2 === null) {
16045
- throw new TypeError("Function has a non-object prototype in instanceof check.");
16046
- }
16047
- let depth = 0;
16048
- for (let current = getSandboxPrototype(left, context.budget); current !== null; current = getSandboxPrototype(current, context.budget)) {
16049
- context.budget.visitNode();
16050
- assertSandboxDataDepth(depth++);
16051
- if (current === prototype2) return true;
16052
- }
16053
- return false;
16054
- };
16055
- const prototype = getPropertyValue(right, "prototype", context);
16056
- return prototype instanceof Promise ? prototype.then(check) : check(prototype);
16057
- }
16058
- return false;
16027
+ return evaluateInstanceof(left, right, context);
16059
16028
  case "in":
16060
16029
  return hasSandboxProperty(right, left, context);
16061
16030
  }
16062
16031
  }
16032
+ async function evaluateInstanceof(left, right, context) {
16033
+ while (true) {
16034
+ if (right === null || typeof right !== "object" && typeof right !== "function")
16035
+ throw new TypeError("Right-hand side of 'instanceof' must be an object.");
16036
+ const method = await getPropertyValue(right, Symbol.hasInstance, context);
16037
+ if (method !== void 0 && method !== null) {
16038
+ if (!isSandboxClosure(method)) throw new TypeError("Symbol.hasInstance must be callable.");
16039
+ return Boolean(await invokeSandboxClosure(method, [left], context, context.callStack, void 0, right));
16040
+ }
16041
+ if (!isSandboxClosure(right))
16042
+ throw new TypeError("Right-hand side of 'instanceof' is not a function.");
16043
+ if (right.boundTarget === void 0) break;
16044
+ context.budget.visitNode();
16045
+ right = right.boundTarget;
16046
+ }
16047
+ if (isSandboxPromiseConstructor(right)) return isSandboxPromise(left);
16048
+ if (isSandboxMapConstructor(right) && isSandboxMap(left)) return true;
16049
+ if (isFloat32ArrayConstructor(right)) return isFloat32Array(left);
16050
+ if (isDateConstructor(right))
16051
+ return isSandboxDate(left) && getDatePrototype(left, context.budget, context.compilation?.owner) !== null;
16052
+ if (isSandboxSetConstructor(right) && isSandboxSet(left)) return true;
16053
+ if (isSandboxErrorConstructorInstance2(left, right)) return true;
16054
+ if (isGuestClosure(right)) {
16055
+ if (typeof left !== "object" || left === null) return false;
16056
+ const prototype = await getPropertyValue(right, "prototype", context);
16057
+ if (typeof prototype !== "object" || prototype === null)
16058
+ throw new TypeError("Function has a non-object prototype in instanceof check.");
16059
+ let depth = 0;
16060
+ for (let current = getSandboxPrototype(left, context.budget); current !== null; current = getSandboxPrototype(current, context.budget)) {
16061
+ context.budget.visitNode();
16062
+ assertSandboxDataDepth(depth++);
16063
+ if (current === prototype) return true;
16064
+ }
16065
+ }
16066
+ return false;
16067
+ }
16063
16068
  function createCoercionContext(context) {
16064
16069
  return {
16065
16070
  stack: context.callStack,
@@ -35928,4 +35933,4 @@ export {
35928
35933
  FileSnapshotBackend,
35929
35934
  run
35930
35935
  };
35931
- //# sourceMappingURL=chunk-IHPQO2HC.js.map
35936
+ //# sourceMappingURL=chunk-LVK2NO45.js.map