@poe-platform/safe-js 0.1.165 → 0.1.167
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.
- package/dist/safe-js/chunks/{chunk-4JKST34C.js → chunk-HH5HD7AM.js} +2 -2
- package/dist/safe-js/chunks/{chunk-IHPQO2HC.js → chunk-QQ2J2CDJ.js} +45 -36
- package/dist/safe-js/chunks/chunk-QQ2J2CDJ.js.map +7 -0
- package/dist/safe-js/cli.js +2 -2
- package/dist/safe-js/core.js +1 -1
- package/dist/safe-js/index.js +2 -2
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-IHPQO2HC.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-4JKST34C.js.map → chunk-HH5HD7AM.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-QQ2J2CDJ.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-
|
|
8252
|
+
//# sourceMappingURL=chunk-HH5HD7AM.js.map
|
|
@@ -7536,9 +7536,9 @@ function setSandboxPrototype(value, prototype, budget) {
|
|
|
7536
7536
|
if (budget !== void 0 && intrinsicPrototypes.get(budget) === value && prototype !== null) {
|
|
7537
7537
|
throw new TypeError("Object.prototype has an immutable null prototype.");
|
|
7538
7538
|
}
|
|
7539
|
-
if (!isPrototypeRecord(value) || prototype !== null && !isPrototypeRecord(prototype)) {
|
|
7539
|
+
if (!Array.isArray(value) && !isPrototypeRecord(value) || prototype !== null && !Array.isArray(prototype) && !isPrototypeRecord(prototype)) {
|
|
7540
7540
|
throw new TypeError(
|
|
7541
|
-
"Prototype links require ordinary sandbox objects or guest functions."
|
|
7541
|
+
"Prototype links require ordinary sandbox objects, arrays, or guest functions."
|
|
7542
7542
|
);
|
|
7543
7543
|
}
|
|
7544
7544
|
if (prototypes.has(value) && getSandboxPrototype(value, budget) === prototype) return;
|
|
@@ -9371,6 +9371,7 @@ function getSandboxIterator(value, budget, context) {
|
|
|
9371
9371
|
if (isSandboxSet(value)) {
|
|
9372
9372
|
return collectionIterator(value.values);
|
|
9373
9373
|
}
|
|
9374
|
+
if (Array.isArray(value) && hasExplicitSandboxPrototype(value)) return void 0;
|
|
9374
9375
|
if (Array.isArray(value) && context?.getProperty !== void 0) {
|
|
9375
9376
|
let index = 0;
|
|
9376
9377
|
return {
|
|
@@ -15713,6 +15714,8 @@ async function evaluateMemberCallExpression(node, context) {
|
|
|
15713
15714
|
return evaluateResolvedCallExpression(node, await getPropertyValue(member.object, member.property, context, member.superReceiver.value), context, member.superReceiver.value);
|
|
15714
15715
|
if (typeof member.property === "symbol")
|
|
15715
15716
|
return evaluateResolvedCallExpression(node, await getPropertyValue(member.object, member.property, context), context, member.object);
|
|
15717
|
+
if (Array.isArray(member.object) && hasExplicitSandboxPrototype(member.object))
|
|
15718
|
+
return evaluateResolvedCallExpression(node, await getPropertyValue(member.object, member.property, context), context, member.object);
|
|
15716
15719
|
if ((typeof member.object === "string" || typeof member.object === "number" || typeof member.object === "boolean" || typeof member.object === "symbol") && getBoxedPrototype(member.object, context.budget) !== void 0) {
|
|
15717
15720
|
if (isDefaultBoxedMethod(member.object, member.property, context.budget)) {
|
|
15718
15721
|
if (typeof member.object === "string" && isStringMethodName(member.property))
|
|
@@ -16024,42 +16027,47 @@ function applyBinaryOperator(node, left, right, context) {
|
|
|
16024
16027
|
case ">>>":
|
|
16025
16028
|
return toNumber(left) >>> toNumber(right);
|
|
16026
16029
|
case "instanceof":
|
|
16027
|
-
|
|
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;
|
|
16030
|
+
return evaluateInstanceof(left, right, context);
|
|
16059
16031
|
case "in":
|
|
16060
16032
|
return hasSandboxProperty(right, left, context);
|
|
16061
16033
|
}
|
|
16062
16034
|
}
|
|
16035
|
+
async function evaluateInstanceof(left, right, context) {
|
|
16036
|
+
while (true) {
|
|
16037
|
+
if (right === null || typeof right !== "object" && typeof right !== "function")
|
|
16038
|
+
throw new TypeError("Right-hand side of 'instanceof' must be an object.");
|
|
16039
|
+
const method = await getPropertyValue(right, Symbol.hasInstance, context);
|
|
16040
|
+
if (method !== void 0 && method !== null) {
|
|
16041
|
+
if (!isSandboxClosure(method)) throw new TypeError("Symbol.hasInstance must be callable.");
|
|
16042
|
+
return Boolean(await invokeSandboxClosure(method, [left], context, context.callStack, void 0, right));
|
|
16043
|
+
}
|
|
16044
|
+
if (!isSandboxClosure(right))
|
|
16045
|
+
throw new TypeError("Right-hand side of 'instanceof' is not a function.");
|
|
16046
|
+
if (right.boundTarget === void 0) break;
|
|
16047
|
+
context.budget.visitNode();
|
|
16048
|
+
right = right.boundTarget;
|
|
16049
|
+
}
|
|
16050
|
+
if (isSandboxPromiseConstructor(right)) return isSandboxPromise(left);
|
|
16051
|
+
if (isSandboxMapConstructor(right) && isSandboxMap(left)) return true;
|
|
16052
|
+
if (isFloat32ArrayConstructor(right)) return isFloat32Array(left);
|
|
16053
|
+
if (isDateConstructor(right))
|
|
16054
|
+
return isSandboxDate(left) && getDatePrototype(left, context.budget, context.compilation?.owner) !== null;
|
|
16055
|
+
if (isSandboxSetConstructor(right) && isSandboxSet(left)) return true;
|
|
16056
|
+
if (isSandboxErrorConstructorInstance2(left, right)) return true;
|
|
16057
|
+
if (isGuestClosure(right)) {
|
|
16058
|
+
if (typeof left !== "object" || left === null) return false;
|
|
16059
|
+
const prototype = await getPropertyValue(right, "prototype", context);
|
|
16060
|
+
if (typeof prototype !== "object" || prototype === null)
|
|
16061
|
+
throw new TypeError("Function has a non-object prototype in instanceof check.");
|
|
16062
|
+
let depth = 0;
|
|
16063
|
+
for (let current = getSandboxPrototype(left, context.budget); current !== null; current = getSandboxPrototype(current, context.budget)) {
|
|
16064
|
+
context.budget.visitNode();
|
|
16065
|
+
assertSandboxDataDepth(depth++);
|
|
16066
|
+
if (current === prototype) return true;
|
|
16067
|
+
}
|
|
16068
|
+
}
|
|
16069
|
+
return false;
|
|
16070
|
+
}
|
|
16063
16071
|
function createCoercionContext(context) {
|
|
16064
16072
|
return {
|
|
16065
16073
|
stack: context.callStack,
|
|
@@ -16076,7 +16084,7 @@ function hasSandboxProperty(value, key, context) {
|
|
|
16076
16084
|
while (typeof current === "object" && current !== null) {
|
|
16077
16085
|
if (isGuestHostObject(current)) return typeof key === "symbol" ? false : hasHostObjectMember(current, String(key));
|
|
16078
16086
|
if (hasOwnSandboxProperty(current, key, false)) return true;
|
|
16079
|
-
if (!(isGuestClosure(current) && hasExplicitSandboxPrototype(current)) && (Array.isArray(current) || !isPlainSandboxObject(current) || isSandboxDate(current) || isFloat32Array(current) || isSandboxGenerator(current) || isSandboxCollectionIterator(current))) {
|
|
16087
|
+
if (!((isGuestClosure(current) || Array.isArray(current)) && hasExplicitSandboxPrototype(current)) && (Array.isArray(current) || !isPlainSandboxObject(current) || isSandboxDate(current) || isFloat32Array(current) || isSandboxGenerator(current) || isSandboxCollectionIterator(current))) {
|
|
16080
16088
|
return getPropertyValue(current, key, context) !== void 0;
|
|
16081
16089
|
}
|
|
16082
16090
|
current = getSandboxPrototype(current, context.budget);
|
|
@@ -16289,6 +16297,7 @@ function getMemberValue(target, property, context) {
|
|
|
16289
16297
|
return void 0;
|
|
16290
16298
|
}
|
|
16291
16299
|
function getArrayMemberValue(target, property, context) {
|
|
16300
|
+
if (hasExplicitSandboxPrototype(target)) return void 0;
|
|
16292
16301
|
if (property === "raw" && taggedTemplateRawArrays.has(target)) {
|
|
16293
16302
|
return taggedTemplateRawArrays.get(target);
|
|
16294
16303
|
}
|
|
@@ -35928,4 +35937,4 @@ export {
|
|
|
35928
35937
|
FileSnapshotBackend,
|
|
35929
35938
|
run
|
|
35930
35939
|
};
|
|
35931
|
-
//# sourceMappingURL=chunk-
|
|
35940
|
+
//# sourceMappingURL=chunk-QQ2J2CDJ.js.map
|