@poe-platform/safe-js 0.1.264 → 0.1.265
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-ZZ7KERZ7.js → chunk-DUEGXM77.js} +2 -2
- package/dist/safe-js/chunks/{chunk-5ICV3URR.js → chunk-WOTMGYUK.js} +60 -22
- package/dist/safe-js/chunks/chunk-WOTMGYUK.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/dist/safe-js/interp/values.d.ts +1 -0
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-5ICV3URR.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-ZZ7KERZ7.js.map → chunk-DUEGXM77.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-WOTMGYUK.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-DUEGXM77.js.map
|
|
@@ -7963,8 +7963,8 @@ function getSandboxPropertyDescriptor(value, key, budget) {
|
|
|
7963
7963
|
return hostProperties === void 0 ? void 0 : Object.getOwnPropertyDescriptor(hostProperties, key);
|
|
7964
7964
|
let current = value;
|
|
7965
7965
|
let depth = 0;
|
|
7966
|
-
while (typeof current === "object" && current !== null && (Array.isArray(current) || isSandboxDate(current) || isSandboxRegex(current) || isSandboxMap(current) || isSandboxSet(current) || isPrototypeRecord(current))) {
|
|
7967
|
-
const properties = isGuestClosure(current) ? getGuestFunctionProperties(current) : isSandboxRegex(current) ? getRegexProperties(current) : isSandboxMap(current) || isSandboxSet(current) ? getCollectionProperties(current) : current;
|
|
7966
|
+
while (typeof current === "object" && current !== null && (Array.isArray(current) || isSandboxDate(current) || isSandboxPromise(current) || isSandboxRegex(current) || isSandboxMap(current) || isSandboxSet(current) || isPrototypeRecord(current))) {
|
|
7967
|
+
const properties = isSandboxPromise(current) ? getPromiseProperties(current) : isGuestClosure(current) ? getGuestFunctionProperties(current) : isSandboxRegex(current) ? getRegexProperties(current) : isSandboxMap(current) || isSandboxSet(current) ? getCollectionProperties(current) : current;
|
|
7968
7968
|
const descriptor = properties === void 0 ? void 0 : Object.getOwnPropertyDescriptor(properties, key);
|
|
7969
7969
|
if (descriptor !== void 0) return descriptor;
|
|
7970
7970
|
current = getSandboxPrototype(current, budget);
|
|
@@ -7981,6 +7981,7 @@ function getSandboxDataProperty(value, key, budget) {
|
|
|
7981
7981
|
while (typeof current === "object" && current !== null) {
|
|
7982
7982
|
if (isGuestHostObject(current)) return typeof key === "symbol" ? void 0 : getHostObjectMember(current, String(key));
|
|
7983
7983
|
if (isSandboxRegex(current)) return Object.getOwnPropertyDescriptor(getRegexProperties(current), key)?.value;
|
|
7984
|
+
if (isSandboxPromise(current)) return Object.getOwnPropertyDescriptor(getPromiseProperties(current), key)?.value;
|
|
7984
7985
|
if (isSandboxMap(current) || isSandboxSet(current)) return Object.getOwnPropertyDescriptor(getCollectionProperties(current), key)?.value;
|
|
7985
7986
|
if (isGuestClosure(current)) {
|
|
7986
7987
|
const entry = getGuestFunctionProperty(current, key);
|
|
@@ -13717,14 +13718,14 @@ function createObjectArrayGlobals(options) {
|
|
|
13717
13718
|
call: ([value]) => {
|
|
13718
13719
|
if (isGuestHostObject(value))
|
|
13719
13720
|
throw new TypeError("Live host objects cannot be made non-extensible.");
|
|
13720
|
-
Object.preventExtensions(isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value);
|
|
13721
|
+
Object.preventExtensions(isSandboxPromise(value) ? getPromiseProperties(value) : isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value);
|
|
13721
13722
|
return value;
|
|
13722
13723
|
},
|
|
13723
13724
|
name: "preventExtensions"
|
|
13724
13725
|
}),
|
|
13725
13726
|
isExtensible: createSandboxClosure({
|
|
13726
13727
|
sandbox: true,
|
|
13727
|
-
call: ([value]) => Object.isExtensible(isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value),
|
|
13728
|
+
call: ([value]) => Object.isExtensible(isSandboxPromise(value) ? getPromiseProperties(value) : isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value),
|
|
13728
13729
|
name: "isExtensible"
|
|
13729
13730
|
}),
|
|
13730
13731
|
seal: createSandboxClosure({
|
|
@@ -13732,14 +13733,14 @@ function createObjectArrayGlobals(options) {
|
|
|
13732
13733
|
call: ([value]) => {
|
|
13733
13734
|
if (isGuestHostObject(value))
|
|
13734
13735
|
throw new TypeError("Live host objects cannot be sealed.");
|
|
13735
|
-
Object.seal(isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value);
|
|
13736
|
+
Object.seal(isSandboxPromise(value) ? getPromiseProperties(value) : isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value);
|
|
13736
13737
|
return value;
|
|
13737
13738
|
},
|
|
13738
13739
|
name: "seal"
|
|
13739
13740
|
}),
|
|
13740
13741
|
isSealed: createSandboxClosure({
|
|
13741
13742
|
sandbox: true,
|
|
13742
|
-
call: ([value]) => Object.isSealed(isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value),
|
|
13743
|
+
call: ([value]) => Object.isSealed(isSandboxPromise(value) ? getPromiseProperties(value) : isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value),
|
|
13743
13744
|
name: "isSealed"
|
|
13744
13745
|
}),
|
|
13745
13746
|
freeze: createSandboxClosure({
|
|
@@ -13748,7 +13749,7 @@ function createObjectArrayGlobals(options) {
|
|
|
13748
13749
|
if (isGuestHostObject(value))
|
|
13749
13750
|
throw new TypeError("Live host objects cannot be frozen.");
|
|
13750
13751
|
if (typeof value === "object" && value !== null) {
|
|
13751
|
-
Object.freeze(isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value);
|
|
13752
|
+
Object.freeze(isSandboxPromise(value) ? getPromiseProperties(value) : isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value);
|
|
13752
13753
|
}
|
|
13753
13754
|
return value;
|
|
13754
13755
|
},
|
|
@@ -13756,7 +13757,7 @@ function createObjectArrayGlobals(options) {
|
|
|
13756
13757
|
}),
|
|
13757
13758
|
isFrozen: createSandboxClosure({
|
|
13758
13759
|
sandbox: true,
|
|
13759
|
-
call: ([value]) => Object.isFrozen(isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value),
|
|
13760
|
+
call: ([value]) => Object.isFrozen(isSandboxPromise(value) ? getPromiseProperties(value) : isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value),
|
|
13760
13761
|
name: "isFrozen"
|
|
13761
13762
|
}),
|
|
13762
13763
|
assign: createSandboxClosure({
|
|
@@ -13969,6 +13970,7 @@ function reflectionProperties(value) {
|
|
|
13969
13970
|
return objectProperties(value);
|
|
13970
13971
|
}
|
|
13971
13972
|
function objectProperties(value, mutable = false) {
|
|
13973
|
+
if (isSandboxPromise(value)) return getPromiseProperties(value);
|
|
13972
13974
|
if (isSandboxMap(value) || isSandboxSet(value)) return getCollectionProperties(value);
|
|
13973
13975
|
if (isSandboxRegex(value)) return getRegexProperties(value);
|
|
13974
13976
|
if (isSandboxDate(value)) {
|
|
@@ -17444,7 +17446,7 @@ async function evaluateForInStatement(node, context) {
|
|
|
17444
17446
|
}
|
|
17445
17447
|
function forInObject(value) {
|
|
17446
17448
|
if (isGuestClosure(value)) return value;
|
|
17447
|
-
if (value === null || value === void 0 || isSandboxClosure(value)
|
|
17449
|
+
if (value === null || value === void 0 || isSandboxClosure(value)) {
|
|
17448
17450
|
return void 0;
|
|
17449
17451
|
}
|
|
17450
17452
|
if (typeof value === "string" || Array.isArray(value) || isFloat32Array(value) || isPlainForInObject(value)) {
|
|
@@ -17460,7 +17462,7 @@ function forInKeys(object, budget) {
|
|
|
17460
17462
|
for (let current = object; current !== null; current = getSandboxPrototype(current, budget)) {
|
|
17461
17463
|
if (depth > 0) budget.visitNode();
|
|
17462
17464
|
assertSandboxDataDepth(depth++);
|
|
17463
|
-
const properties = isGuestClosure(current) ? materializeFunctionProperties(current) : isSandboxClosure(current) ? current.properties ?? {} : isSandboxRegex(current) ? getRegexProperties(current) : isSandboxMap(current) || isSandboxSet(current) ? getCollectionProperties(current) : current;
|
|
17465
|
+
const properties = isSandboxPromise(current) ? getPromiseProperties(current) : isGuestClosure(current) ? materializeFunctionProperties(current) : isSandboxClosure(current) ? current.properties ?? {} : isSandboxRegex(current) ? getRegexProperties(current) : isSandboxMap(current) || isSandboxSet(current) ? getCollectionProperties(current) : current;
|
|
17464
17466
|
for (const key of Object.getOwnPropertyNames(properties)) {
|
|
17465
17467
|
if (seen.has(key)) continue;
|
|
17466
17468
|
seen.add(key);
|
|
@@ -17476,7 +17478,7 @@ function hasForInProperty(object, key, budget) {
|
|
|
17476
17478
|
for (let current = object; current !== null; current = getSandboxPrototype(current, budget)) {
|
|
17477
17479
|
if (depth > 0) budget.visitNode();
|
|
17478
17480
|
assertSandboxDataDepth(depth++);
|
|
17479
|
-
const properties = isGuestClosure(current) ? materializeFunctionProperties(current) : isSandboxClosure(current) ? current.properties ?? {} : isSandboxRegex(current) ? getRegexProperties(current) : isSandboxMap(current) || isSandboxSet(current) ? getCollectionProperties(current) : current;
|
|
17481
|
+
const properties = isSandboxPromise(current) ? getPromiseProperties(current) : isGuestClosure(current) ? materializeFunctionProperties(current) : isSandboxClosure(current) ? current.properties ?? {} : isSandboxRegex(current) ? getRegexProperties(current) : isSandboxMap(current) || isSandboxSet(current) ? getCollectionProperties(current) : current;
|
|
17480
17482
|
if (Object.hasOwn(properties, key)) return true;
|
|
17481
17483
|
}
|
|
17482
17484
|
return false;
|
|
@@ -17922,7 +17924,7 @@ async function evaluateDeleteExpression(node, context) {
|
|
|
17922
17924
|
}
|
|
17923
17925
|
throw new TypeError("Cannot delete properties of null or undefined.");
|
|
17924
17926
|
}
|
|
17925
|
-
if (!isIndexableSandboxValue(member.object) && !isSandboxRegex(member.object) && !isSandboxMap(member.object) && !isSandboxSet(member.object)) {
|
|
17927
|
+
if (!isIndexableSandboxValue(member.object) && !isSandboxPromise(member.object) && !isSandboxRegex(member.object) && !isSandboxMap(member.object) && !isSandboxSet(member.object)) {
|
|
17926
17928
|
throw new TypeError("Unary operator 'delete' requires a sandbox object property.");
|
|
17927
17929
|
}
|
|
17928
17930
|
const property = await toPropertyKey(member.property, context.budget, createCoercionContext(context));
|
|
@@ -18361,7 +18363,7 @@ async function evaluateMemberCallExpression(node, context) {
|
|
|
18361
18363
|
if (isSandboxPromise(member.object)) {
|
|
18362
18364
|
return evaluateResolvedCallExpression(
|
|
18363
18365
|
node,
|
|
18364
|
-
|
|
18366
|
+
await getPropertyValue(member.object, member.property, context),
|
|
18365
18367
|
context,
|
|
18366
18368
|
member.object
|
|
18367
18369
|
);
|
|
@@ -18896,6 +18898,7 @@ function setSandboxProperty(target, property, value, budget, checkInherited = tr
|
|
|
18896
18898
|
return writePropertyDescriptor(descriptor2, target, value, context);
|
|
18897
18899
|
}
|
|
18898
18900
|
if (isGuestClosure(target)) target = materializeFunctionProperties(target);
|
|
18901
|
+
if (isSandboxPromise(target)) target = getPromiseProperties(target);
|
|
18899
18902
|
if (isSandboxMap(target) || isSandboxSet(target)) target = getCollectionProperties(target);
|
|
18900
18903
|
if (isFloat32Array(target)) {
|
|
18901
18904
|
if (typeof property === "symbol") throw new TypeError("Typed array symbol properties are not yet supported.");
|
|
@@ -18965,6 +18968,7 @@ function deleteSandboxProperty(target, property) {
|
|
|
18965
18968
|
if (isGuestHostObject(target)) return deleteHostObjectMember(target, String(property));
|
|
18966
18969
|
if (isGuestClosure(target)) target = materializeFunctionProperties(target);
|
|
18967
18970
|
if (isSandboxRegex(target)) target = getRegexProperties(target);
|
|
18971
|
+
if (isSandboxPromise(target)) target = getPromiseProperties(target);
|
|
18968
18972
|
if (isSandboxMap(target) || isSandboxSet(target)) target = getCollectionProperties(target);
|
|
18969
18973
|
if (Array.isArray(target)) {
|
|
18970
18974
|
assertCollectionMutable(target);
|
|
@@ -19193,7 +19197,7 @@ async function evaluateObjectSpread(node, context) {
|
|
|
19193
19197
|
}
|
|
19194
19198
|
return { ok: true, value: entries2 };
|
|
19195
19199
|
}
|
|
19196
|
-
if (isSandboxClosure(value.value) && !isGuestClosure(value.value)
|
|
19200
|
+
if (isSandboxClosure(value.value) && !isGuestClosure(value.value)) {
|
|
19197
19201
|
throw new TypeError(
|
|
19198
19202
|
`Cannot spread ${describeObjectSpreadValue(value.value)} into object literal.`
|
|
19199
19203
|
);
|
|
@@ -19535,7 +19539,7 @@ function conversionHook(value, name, budget, context) {
|
|
|
19535
19539
|
let current = value;
|
|
19536
19540
|
let depth = 0;
|
|
19537
19541
|
while (current !== null) {
|
|
19538
|
-
const properties = isGuestClosure(current) ? getGuestFunctionProperties(current) : isSandboxRegex(current) ? getRegexProperties(current) : isSandboxMap(current) || isSandboxSet(current) ? getCollectionProperties(current) : current;
|
|
19542
|
+
const properties = isSandboxPromise(current) ? getPromiseProperties(current) : isGuestClosure(current) ? getGuestFunctionProperties(current) : isSandboxRegex(current) ? getRegexProperties(current) : isSandboxMap(current) || isSandboxSet(current) ? getCollectionProperties(current) : current;
|
|
19539
19543
|
const descriptor = properties === void 0 ? void 0 : Object.getOwnPropertyDescriptor(properties, name);
|
|
19540
19544
|
if (descriptor !== void 0) {
|
|
19541
19545
|
return readPropertyDescriptor(descriptor, value, context);
|
|
@@ -20243,7 +20247,8 @@ function hasOwnSandboxProperty(value, key, enumerable) {
|
|
|
20243
20247
|
if (key === "length" || key === "name") return !enumerable;
|
|
20244
20248
|
properties = value.properties ?? /* @__PURE__ */ Object.create(null);
|
|
20245
20249
|
} else if (isSandboxMap(value) || isSandboxSet(value)) properties = getCollectionProperties(value);
|
|
20246
|
-
else if (isSandboxPromise(value)
|
|
20250
|
+
else if (isSandboxPromise(value)) properties = getPromiseProperties(value);
|
|
20251
|
+
else if (isSandboxGenerator(value))
|
|
20247
20252
|
return false;
|
|
20248
20253
|
else if (isSandboxRegex(value)) properties = getRegexProperties(value);
|
|
20249
20254
|
else properties = Object(value);
|
|
@@ -21959,7 +21964,6 @@ async function stringifyValue(value, state, indent) {
|
|
|
21959
21964
|
if (typeof value === "bigint") {
|
|
21960
21965
|
throw new TypeError("Do not know how to serialize a BigInt.");
|
|
21961
21966
|
}
|
|
21962
|
-
if (isSandboxPromise(value)) return "{}";
|
|
21963
21967
|
if (value === void 0 || isSandboxClosure(value)) {
|
|
21964
21968
|
return void 0;
|
|
21965
21969
|
}
|
|
@@ -22059,7 +22063,7 @@ function quoteJsonString(value) {
|
|
|
22059
22063
|
return JSON.stringify(value);
|
|
22060
22064
|
}
|
|
22061
22065
|
function isStringifyContainer(value) {
|
|
22062
|
-
return typeof value === "object" && value !== null && !isSandboxClosure(value)
|
|
22066
|
+
return typeof value === "object" && value !== null && !isSandboxClosure(value);
|
|
22063
22067
|
}
|
|
22064
22068
|
function isStringifyObject(value) {
|
|
22065
22069
|
return isStringifyContainer(value) && !Array.isArray(value);
|
|
@@ -24860,6 +24864,15 @@ var sandboxRegexBrand = /* @__PURE__ */ Symbol("SandboxRegex");
|
|
|
24860
24864
|
var sandboxRegexPattern = /* @__PURE__ */ Symbol("SandboxRegexPattern");
|
|
24861
24865
|
var sandboxRetainedValues = /* @__PURE__ */ Symbol("SandboxRetainedValues");
|
|
24862
24866
|
for (const marker of [sandboxClosureBrand, sandboxGeneratorBrand, sandboxPromiseBrand, sandboxRegexBrand, sandboxRegexPattern, sandboxRetainedValues]) internalSymbols.add(marker);
|
|
24867
|
+
var promiseProperties = /* @__PURE__ */ new WeakMap();
|
|
24868
|
+
function getPromiseProperties(value) {
|
|
24869
|
+
let properties = promiseProperties.get(value);
|
|
24870
|
+
if (properties === void 0) {
|
|
24871
|
+
properties = /* @__PURE__ */ Object.create(null);
|
|
24872
|
+
promiseProperties.set(value, properties);
|
|
24873
|
+
}
|
|
24874
|
+
return properties;
|
|
24875
|
+
}
|
|
24863
24876
|
function createSandboxClosure(input) {
|
|
24864
24877
|
const closure = {
|
|
24865
24878
|
kind: "fn",
|
|
@@ -24925,6 +24938,7 @@ function ownEnumerableSandboxEntries(value, excludedKeys) {
|
|
|
24925
24938
|
let entries;
|
|
24926
24939
|
if (isGuestClosure(value)) entries = Object.entries(value.properties ?? {});
|
|
24927
24940
|
else if (isSandboxRegex(value)) entries = Object.entries(getRegexProperties(value));
|
|
24941
|
+
else if (isSandboxPromise(value)) entries = Object.entries(getPromiseProperties(value));
|
|
24928
24942
|
else if (isSandboxMap(value) || isSandboxSet(value)) entries = Object.entries(getCollectionProperties(value));
|
|
24929
24943
|
else if (isSandboxClosure(value) || isSandboxGenerator(value) || isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxRegex(value)) return [];
|
|
24930
24944
|
else entries = Object.entries(Object(value));
|
|
@@ -24935,18 +24949,20 @@ function ownSandboxSymbolKeys(value) {
|
|
|
24935
24949
|
if (isGuestHostObject(value)) return [];
|
|
24936
24950
|
if (isSandboxClosure(value)) value = value.properties ?? {};
|
|
24937
24951
|
else if (isSandboxRegex(value)) value = getRegexProperties(value);
|
|
24952
|
+
else if (isSandboxPromise(value)) value = getPromiseProperties(value);
|
|
24938
24953
|
else if (isSandboxMap(value) || isSandboxSet(value)) value = getCollectionProperties(value);
|
|
24939
24954
|
else if (isSandboxGenerator(value) || isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxRegex(value)) return [];
|
|
24940
24955
|
return Object.getOwnPropertySymbols(Object(value)).filter((key) => !internalSymbols.has(key));
|
|
24941
24956
|
}
|
|
24942
24957
|
function ownEnumerableSandboxKeys(value, includeSymbols = false) {
|
|
24943
24958
|
if (includeSymbols) {
|
|
24944
|
-
const properties = isSandboxClosure(value) ? value.properties ?? {} : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : Object(value);
|
|
24959
|
+
const properties = isSandboxClosure(value) ? value.properties ?? {} : isSandboxPromise(value) ? getPromiseProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : Object(value);
|
|
24945
24960
|
return [...ownEnumerableSandboxKeys(value), ...ownSandboxSymbolKeys(value).filter((key) => Object.getOwnPropertyDescriptor(properties, key)?.enumerable === true)];
|
|
24946
24961
|
}
|
|
24947
24962
|
if (isGuestHostObject(value)) return getHostObjectKeys(value);
|
|
24948
24963
|
if (value === null || value === void 0) throw new TypeError("Cannot convert undefined or null to object.");
|
|
24949
24964
|
if (isGuestClosure(value)) return Object.keys(value.properties ?? {});
|
|
24965
|
+
if (isSandboxPromise(value)) return Object.keys(getPromiseProperties(value));
|
|
24950
24966
|
if (isSandboxRegex(value)) return Object.keys(getRegexProperties(value));
|
|
24951
24967
|
if (isSandboxMap(value) || isSandboxSet(value)) return Object.keys(getCollectionProperties(value));
|
|
24952
24968
|
if (isSandboxClosure(value) || isSandboxGenerator(value) || isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxRegex(value)) return [];
|
|
@@ -25255,7 +25271,15 @@ function measureSandboxData(values, options = {}) {
|
|
|
25255
25271
|
for (const completion of snapshot.sent) visit(completion.value, depth + 1);
|
|
25256
25272
|
return;
|
|
25257
25273
|
}
|
|
25258
|
-
if (isSandboxPromise(value))
|
|
25274
|
+
if (isSandboxPromise(value)) {
|
|
25275
|
+
for (const key of Reflect.ownKeys(getPromiseProperties(value))) {
|
|
25276
|
+
const descriptor = Object.getOwnPropertyDescriptor(getPromiseProperties(value), key);
|
|
25277
|
+
usage += typeof key === "string" ? key.length + 1 : 1;
|
|
25278
|
+
if ("value" in descriptor) visit(descriptor.value, depth + 1);
|
|
25279
|
+
else for (const closure of retainedAccessorClosures(descriptor)) visit(closure, depth + 1);
|
|
25280
|
+
}
|
|
25281
|
+
return;
|
|
25282
|
+
}
|
|
25259
25283
|
if (isSandboxRegex(value)) {
|
|
25260
25284
|
const { source, flags, lastIndex } = captureRegexData(value);
|
|
25261
25285
|
const compiled = regexCompiledData(getSandboxRegexPattern(value));
|
|
@@ -25705,6 +25729,8 @@ function copyFromSandbox(value, state, path = "<root>", options, depth = 0) {
|
|
|
25705
25729
|
return wrapped;
|
|
25706
25730
|
}
|
|
25707
25731
|
if (isSandboxPromise(value)) {
|
|
25732
|
+
const existing = state.seen.get(value);
|
|
25733
|
+
if (existing !== void 0) return existing;
|
|
25708
25734
|
observeSandboxPromise(value);
|
|
25709
25735
|
const copySettlement = (settled) => {
|
|
25710
25736
|
const owner = options.compilation?.owner;
|
|
@@ -25720,10 +25746,22 @@ function copyFromSandbox(value, state, path = "<root>", options, depth = 0) {
|
|
|
25720
25746
|
operation?.release();
|
|
25721
25747
|
}
|
|
25722
25748
|
};
|
|
25723
|
-
|
|
25749
|
+
const copy = value.promise.then(
|
|
25724
25750
|
copySettlement,
|
|
25725
25751
|
(reason) => Promise.reject(reason instanceof SandboxError ? reason : copySettlement(reason))
|
|
25726
25752
|
);
|
|
25753
|
+
state.seen.set(value, copy);
|
|
25754
|
+
const properties = getPromiseProperties(value);
|
|
25755
|
+
for (const key of Reflect.ownKeys(properties)) {
|
|
25756
|
+
const descriptor = Object.getOwnPropertyDescriptor(properties, key);
|
|
25757
|
+
if (!("value" in descriptor)) throw new TypeError("Promise accessor properties cannot be copied as data.");
|
|
25758
|
+
Object.defineProperty(copy, key, {
|
|
25759
|
+
...descriptor,
|
|
25760
|
+
value: copyFromSandbox(descriptor.value, state, `${path}.<property>`, options, depth + 1)
|
|
25761
|
+
});
|
|
25762
|
+
}
|
|
25763
|
+
if (!Object.isExtensible(properties)) Object.preventExtensions(copy);
|
|
25764
|
+
return copy;
|
|
25727
25765
|
}
|
|
25728
25766
|
if (isSandboxGenerator(value)) {
|
|
25729
25767
|
throw new TypeError("Sandbox generators cannot cross into host values.");
|
|
@@ -40046,4 +40084,4 @@ export {
|
|
|
40046
40084
|
FileSnapshotBackend,
|
|
40047
40085
|
run
|
|
40048
40086
|
};
|
|
40049
|
-
//# sourceMappingURL=chunk-
|
|
40087
|
+
//# sourceMappingURL=chunk-WOTMGYUK.js.map
|