@poe-platform/safe-js 0.1.263 → 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-22FQB7VW.js → chunk-DUEGXM77.js} +2 -2
- package/dist/safe-js/chunks/{chunk-ATYG2NJO.js → chunk-WOTMGYUK.js} +68 -25
- 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-ATYG2NJO.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-22FQB7VW.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);
|
|
@@ -13584,7 +13585,7 @@ function createObjectArrayGlobals(options) {
|
|
|
13584
13585
|
sandbox: true,
|
|
13585
13586
|
call: async ([value, key], context) => {
|
|
13586
13587
|
const descriptor = Object.getOwnPropertyDescriptor(
|
|
13587
|
-
|
|
13588
|
+
reflectionProperties(value),
|
|
13588
13589
|
await toPropertyKey(key, options.budget, context)
|
|
13589
13590
|
);
|
|
13590
13591
|
if (descriptor === void 0) return void 0;
|
|
@@ -13599,7 +13600,7 @@ function createObjectArrayGlobals(options) {
|
|
|
13599
13600
|
sandbox: true,
|
|
13600
13601
|
call: ([value]) => {
|
|
13601
13602
|
const descriptors2 = /* @__PURE__ */ Object.create(null);
|
|
13602
|
-
const properties =
|
|
13603
|
+
const properties = reflectionProperties(value);
|
|
13603
13604
|
for (const key of [...Object.getOwnPropertyNames(properties), ...ownSandboxSymbolKeys(value)])
|
|
13604
13605
|
defineOwnDataProperty(descriptors2, key, exposePropertyDescriptor(Object.getOwnPropertyDescriptor(properties, key)));
|
|
13605
13606
|
return allocateProducedSandboxValue(descriptors2, options.budget);
|
|
@@ -13608,7 +13609,7 @@ function createObjectArrayGlobals(options) {
|
|
|
13608
13609
|
}),
|
|
13609
13610
|
getOwnPropertyNames: createSandboxClosure({
|
|
13610
13611
|
sandbox: true,
|
|
13611
|
-
call: ([value]) => budgetSandboxValue2(Object.getOwnPropertyNames(
|
|
13612
|
+
call: ([value]) => budgetSandboxValue2(Object.getOwnPropertyNames(reflectionProperties(value)), options.budget),
|
|
13612
13613
|
name: "getOwnPropertyNames"
|
|
13613
13614
|
}),
|
|
13614
13615
|
getOwnPropertySymbols: createSandboxClosure({
|
|
@@ -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({
|
|
@@ -13963,7 +13964,13 @@ function assignSandboxValues(target, sources, budget, context) {
|
|
|
13963
13964
|
}
|
|
13964
13965
|
})();
|
|
13965
13966
|
}
|
|
13967
|
+
function reflectionProperties(value) {
|
|
13968
|
+
if (value !== null && value !== void 0 && typeof value !== "object")
|
|
13969
|
+
value = createSandboxBox(value);
|
|
13970
|
+
return objectProperties(value);
|
|
13971
|
+
}
|
|
13966
13972
|
function objectProperties(value, mutable = false) {
|
|
13973
|
+
if (isSandboxPromise(value)) return getPromiseProperties(value);
|
|
13967
13974
|
if (isSandboxMap(value) || isSandboxSet(value)) return getCollectionProperties(value);
|
|
13968
13975
|
if (isSandboxRegex(value)) return getRegexProperties(value);
|
|
13969
13976
|
if (isSandboxDate(value)) {
|
|
@@ -17439,7 +17446,7 @@ async function evaluateForInStatement(node, context) {
|
|
|
17439
17446
|
}
|
|
17440
17447
|
function forInObject(value) {
|
|
17441
17448
|
if (isGuestClosure(value)) return value;
|
|
17442
|
-
if (value === null || value === void 0 || isSandboxClosure(value)
|
|
17449
|
+
if (value === null || value === void 0 || isSandboxClosure(value)) {
|
|
17443
17450
|
return void 0;
|
|
17444
17451
|
}
|
|
17445
17452
|
if (typeof value === "string" || Array.isArray(value) || isFloat32Array(value) || isPlainForInObject(value)) {
|
|
@@ -17455,7 +17462,7 @@ function forInKeys(object, budget) {
|
|
|
17455
17462
|
for (let current = object; current !== null; current = getSandboxPrototype(current, budget)) {
|
|
17456
17463
|
if (depth > 0) budget.visitNode();
|
|
17457
17464
|
assertSandboxDataDepth(depth++);
|
|
17458
|
-
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;
|
|
17459
17466
|
for (const key of Object.getOwnPropertyNames(properties)) {
|
|
17460
17467
|
if (seen.has(key)) continue;
|
|
17461
17468
|
seen.add(key);
|
|
@@ -17471,7 +17478,7 @@ function hasForInProperty(object, key, budget) {
|
|
|
17471
17478
|
for (let current = object; current !== null; current = getSandboxPrototype(current, budget)) {
|
|
17472
17479
|
if (depth > 0) budget.visitNode();
|
|
17473
17480
|
assertSandboxDataDepth(depth++);
|
|
17474
|
-
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;
|
|
17475
17482
|
if (Object.hasOwn(properties, key)) return true;
|
|
17476
17483
|
}
|
|
17477
17484
|
return false;
|
|
@@ -17917,7 +17924,7 @@ async function evaluateDeleteExpression(node, context) {
|
|
|
17917
17924
|
}
|
|
17918
17925
|
throw new TypeError("Cannot delete properties of null or undefined.");
|
|
17919
17926
|
}
|
|
17920
|
-
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)) {
|
|
17921
17928
|
throw new TypeError("Unary operator 'delete' requires a sandbox object property.");
|
|
17922
17929
|
}
|
|
17923
17930
|
const property = await toPropertyKey(member.property, context.budget, createCoercionContext(context));
|
|
@@ -18356,7 +18363,7 @@ async function evaluateMemberCallExpression(node, context) {
|
|
|
18356
18363
|
if (isSandboxPromise(member.object)) {
|
|
18357
18364
|
return evaluateResolvedCallExpression(
|
|
18358
18365
|
node,
|
|
18359
|
-
|
|
18366
|
+
await getPropertyValue(member.object, member.property, context),
|
|
18360
18367
|
context,
|
|
18361
18368
|
member.object
|
|
18362
18369
|
);
|
|
@@ -18891,6 +18898,7 @@ function setSandboxProperty(target, property, value, budget, checkInherited = tr
|
|
|
18891
18898
|
return writePropertyDescriptor(descriptor2, target, value, context);
|
|
18892
18899
|
}
|
|
18893
18900
|
if (isGuestClosure(target)) target = materializeFunctionProperties(target);
|
|
18901
|
+
if (isSandboxPromise(target)) target = getPromiseProperties(target);
|
|
18894
18902
|
if (isSandboxMap(target) || isSandboxSet(target)) target = getCollectionProperties(target);
|
|
18895
18903
|
if (isFloat32Array(target)) {
|
|
18896
18904
|
if (typeof property === "symbol") throw new TypeError("Typed array symbol properties are not yet supported.");
|
|
@@ -18960,6 +18968,7 @@ function deleteSandboxProperty(target, property) {
|
|
|
18960
18968
|
if (isGuestHostObject(target)) return deleteHostObjectMember(target, String(property));
|
|
18961
18969
|
if (isGuestClosure(target)) target = materializeFunctionProperties(target);
|
|
18962
18970
|
if (isSandboxRegex(target)) target = getRegexProperties(target);
|
|
18971
|
+
if (isSandboxPromise(target)) target = getPromiseProperties(target);
|
|
18963
18972
|
if (isSandboxMap(target) || isSandboxSet(target)) target = getCollectionProperties(target);
|
|
18964
18973
|
if (Array.isArray(target)) {
|
|
18965
18974
|
assertCollectionMutable(target);
|
|
@@ -19188,7 +19197,7 @@ async function evaluateObjectSpread(node, context) {
|
|
|
19188
19197
|
}
|
|
19189
19198
|
return { ok: true, value: entries2 };
|
|
19190
19199
|
}
|
|
19191
|
-
if (isSandboxClosure(value.value) && !isGuestClosure(value.value)
|
|
19200
|
+
if (isSandboxClosure(value.value) && !isGuestClosure(value.value)) {
|
|
19192
19201
|
throw new TypeError(
|
|
19193
19202
|
`Cannot spread ${describeObjectSpreadValue(value.value)} into object literal.`
|
|
19194
19203
|
);
|
|
@@ -19530,7 +19539,7 @@ function conversionHook(value, name, budget, context) {
|
|
|
19530
19539
|
let current = value;
|
|
19531
19540
|
let depth = 0;
|
|
19532
19541
|
while (current !== null) {
|
|
19533
|
-
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;
|
|
19534
19543
|
const descriptor = properties === void 0 ? void 0 : Object.getOwnPropertyDescriptor(properties, name);
|
|
19535
19544
|
if (descriptor !== void 0) {
|
|
19536
19545
|
return readPropertyDescriptor(descriptor, value, context);
|
|
@@ -20238,7 +20247,8 @@ function hasOwnSandboxProperty(value, key, enumerable) {
|
|
|
20238
20247
|
if (key === "length" || key === "name") return !enumerable;
|
|
20239
20248
|
properties = value.properties ?? /* @__PURE__ */ Object.create(null);
|
|
20240
20249
|
} else if (isSandboxMap(value) || isSandboxSet(value)) properties = getCollectionProperties(value);
|
|
20241
|
-
else if (isSandboxPromise(value)
|
|
20250
|
+
else if (isSandboxPromise(value)) properties = getPromiseProperties(value);
|
|
20251
|
+
else if (isSandboxGenerator(value))
|
|
20242
20252
|
return false;
|
|
20243
20253
|
else if (isSandboxRegex(value)) properties = getRegexProperties(value);
|
|
20244
20254
|
else properties = Object(value);
|
|
@@ -21954,7 +21964,6 @@ async function stringifyValue(value, state, indent) {
|
|
|
21954
21964
|
if (typeof value === "bigint") {
|
|
21955
21965
|
throw new TypeError("Do not know how to serialize a BigInt.");
|
|
21956
21966
|
}
|
|
21957
|
-
if (isSandboxPromise(value)) return "{}";
|
|
21958
21967
|
if (value === void 0 || isSandboxClosure(value)) {
|
|
21959
21968
|
return void 0;
|
|
21960
21969
|
}
|
|
@@ -22054,7 +22063,7 @@ function quoteJsonString(value) {
|
|
|
22054
22063
|
return JSON.stringify(value);
|
|
22055
22064
|
}
|
|
22056
22065
|
function isStringifyContainer(value) {
|
|
22057
|
-
return typeof value === "object" && value !== null && !isSandboxClosure(value)
|
|
22066
|
+
return typeof value === "object" && value !== null && !isSandboxClosure(value);
|
|
22058
22067
|
}
|
|
22059
22068
|
function isStringifyObject(value) {
|
|
22060
22069
|
return isStringifyContainer(value) && !Array.isArray(value);
|
|
@@ -24855,6 +24864,15 @@ var sandboxRegexBrand = /* @__PURE__ */ Symbol("SandboxRegex");
|
|
|
24855
24864
|
var sandboxRegexPattern = /* @__PURE__ */ Symbol("SandboxRegexPattern");
|
|
24856
24865
|
var sandboxRetainedValues = /* @__PURE__ */ Symbol("SandboxRetainedValues");
|
|
24857
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
|
+
}
|
|
24858
24876
|
function createSandboxClosure(input) {
|
|
24859
24877
|
const closure = {
|
|
24860
24878
|
kind: "fn",
|
|
@@ -24920,6 +24938,7 @@ function ownEnumerableSandboxEntries(value, excludedKeys) {
|
|
|
24920
24938
|
let entries;
|
|
24921
24939
|
if (isGuestClosure(value)) entries = Object.entries(value.properties ?? {});
|
|
24922
24940
|
else if (isSandboxRegex(value)) entries = Object.entries(getRegexProperties(value));
|
|
24941
|
+
else if (isSandboxPromise(value)) entries = Object.entries(getPromiseProperties(value));
|
|
24923
24942
|
else if (isSandboxMap(value) || isSandboxSet(value)) entries = Object.entries(getCollectionProperties(value));
|
|
24924
24943
|
else if (isSandboxClosure(value) || isSandboxGenerator(value) || isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxRegex(value)) return [];
|
|
24925
24944
|
else entries = Object.entries(Object(value));
|
|
@@ -24930,18 +24949,20 @@ function ownSandboxSymbolKeys(value) {
|
|
|
24930
24949
|
if (isGuestHostObject(value)) return [];
|
|
24931
24950
|
if (isSandboxClosure(value)) value = value.properties ?? {};
|
|
24932
24951
|
else if (isSandboxRegex(value)) value = getRegexProperties(value);
|
|
24952
|
+
else if (isSandboxPromise(value)) value = getPromiseProperties(value);
|
|
24933
24953
|
else if (isSandboxMap(value) || isSandboxSet(value)) value = getCollectionProperties(value);
|
|
24934
24954
|
else if (isSandboxGenerator(value) || isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxRegex(value)) return [];
|
|
24935
24955
|
return Object.getOwnPropertySymbols(Object(value)).filter((key) => !internalSymbols.has(key));
|
|
24936
24956
|
}
|
|
24937
24957
|
function ownEnumerableSandboxKeys(value, includeSymbols = false) {
|
|
24938
24958
|
if (includeSymbols) {
|
|
24939
|
-
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);
|
|
24940
24960
|
return [...ownEnumerableSandboxKeys(value), ...ownSandboxSymbolKeys(value).filter((key) => Object.getOwnPropertyDescriptor(properties, key)?.enumerable === true)];
|
|
24941
24961
|
}
|
|
24942
24962
|
if (isGuestHostObject(value)) return getHostObjectKeys(value);
|
|
24943
24963
|
if (value === null || value === void 0) throw new TypeError("Cannot convert undefined or null to object.");
|
|
24944
24964
|
if (isGuestClosure(value)) return Object.keys(value.properties ?? {});
|
|
24965
|
+
if (isSandboxPromise(value)) return Object.keys(getPromiseProperties(value));
|
|
24945
24966
|
if (isSandboxRegex(value)) return Object.keys(getRegexProperties(value));
|
|
24946
24967
|
if (isSandboxMap(value) || isSandboxSet(value)) return Object.keys(getCollectionProperties(value));
|
|
24947
24968
|
if (isSandboxClosure(value) || isSandboxGenerator(value) || isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxRegex(value)) return [];
|
|
@@ -25250,7 +25271,15 @@ function measureSandboxData(values, options = {}) {
|
|
|
25250
25271
|
for (const completion of snapshot.sent) visit(completion.value, depth + 1);
|
|
25251
25272
|
return;
|
|
25252
25273
|
}
|
|
25253
|
-
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
|
+
}
|
|
25254
25283
|
if (isSandboxRegex(value)) {
|
|
25255
25284
|
const { source, flags, lastIndex } = captureRegexData(value);
|
|
25256
25285
|
const compiled = regexCompiledData(getSandboxRegexPattern(value));
|
|
@@ -25700,6 +25729,8 @@ function copyFromSandbox(value, state, path = "<root>", options, depth = 0) {
|
|
|
25700
25729
|
return wrapped;
|
|
25701
25730
|
}
|
|
25702
25731
|
if (isSandboxPromise(value)) {
|
|
25732
|
+
const existing = state.seen.get(value);
|
|
25733
|
+
if (existing !== void 0) return existing;
|
|
25703
25734
|
observeSandboxPromise(value);
|
|
25704
25735
|
const copySettlement = (settled) => {
|
|
25705
25736
|
const owner = options.compilation?.owner;
|
|
@@ -25715,10 +25746,22 @@ function copyFromSandbox(value, state, path = "<root>", options, depth = 0) {
|
|
|
25715
25746
|
operation?.release();
|
|
25716
25747
|
}
|
|
25717
25748
|
};
|
|
25718
|
-
|
|
25749
|
+
const copy = value.promise.then(
|
|
25719
25750
|
copySettlement,
|
|
25720
25751
|
(reason) => Promise.reject(reason instanceof SandboxError ? reason : copySettlement(reason))
|
|
25721
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;
|
|
25722
25765
|
}
|
|
25723
25766
|
if (isSandboxGenerator(value)) {
|
|
25724
25767
|
throw new TypeError("Sandbox generators cannot cross into host values.");
|
|
@@ -40041,4 +40084,4 @@ export {
|
|
|
40041
40084
|
FileSnapshotBackend,
|
|
40042
40085
|
run
|
|
40043
40086
|
};
|
|
40044
|
-
//# sourceMappingURL=chunk-
|
|
40087
|
+
//# sourceMappingURL=chunk-WOTMGYUK.js.map
|