@poe-platform/safe-js 0.1.264 → 0.1.266
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-5ICV3URR.js → chunk-2W5HRQU3.js} +61 -25
- package/dist/safe-js/chunks/chunk-2W5HRQU3.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-ZZ7KERZ7.js → chunk-QFWBIZSB.js} +2 -2
- 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-QFWBIZSB.js.map} +0 -0
|
@@ -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({
|
|
@@ -13935,9 +13936,7 @@ function assignSandboxValues(target, sources, budget, context) {
|
|
|
13935
13936
|
target = createSandboxBox(target);
|
|
13936
13937
|
budget.chargeDataUsage(measureSandboxData([target]));
|
|
13937
13938
|
}
|
|
13938
|
-
if (!
|
|
13939
|
-
throw new TypeError("Object.assign(target, ...sources) requires an object or array target.");
|
|
13940
|
-
}
|
|
13939
|
+
if (!isGuestHostObject(target)) objectProperties(target, true);
|
|
13941
13940
|
if (context === void 0) {
|
|
13942
13941
|
for (const source of sources) {
|
|
13943
13942
|
if (source === null || source === void 0) continue;
|
|
@@ -13969,6 +13968,7 @@ function reflectionProperties(value) {
|
|
|
13969
13968
|
return objectProperties(value);
|
|
13970
13969
|
}
|
|
13971
13970
|
function objectProperties(value, mutable = false) {
|
|
13971
|
+
if (isSandboxPromise(value)) return getPromiseProperties(value);
|
|
13972
13972
|
if (isSandboxMap(value) || isSandboxSet(value)) return getCollectionProperties(value);
|
|
13973
13973
|
if (isSandboxRegex(value)) return getRegexProperties(value);
|
|
13974
13974
|
if (isSandboxDate(value)) {
|
|
@@ -17444,7 +17444,7 @@ async function evaluateForInStatement(node, context) {
|
|
|
17444
17444
|
}
|
|
17445
17445
|
function forInObject(value) {
|
|
17446
17446
|
if (isGuestClosure(value)) return value;
|
|
17447
|
-
if (value === null || value === void 0 || isSandboxClosure(value)
|
|
17447
|
+
if (value === null || value === void 0 || isSandboxClosure(value)) {
|
|
17448
17448
|
return void 0;
|
|
17449
17449
|
}
|
|
17450
17450
|
if (typeof value === "string" || Array.isArray(value) || isFloat32Array(value) || isPlainForInObject(value)) {
|
|
@@ -17460,7 +17460,7 @@ function forInKeys(object, budget) {
|
|
|
17460
17460
|
for (let current = object; current !== null; current = getSandboxPrototype(current, budget)) {
|
|
17461
17461
|
if (depth > 0) budget.visitNode();
|
|
17462
17462
|
assertSandboxDataDepth(depth++);
|
|
17463
|
-
const properties = isGuestClosure(current) ? materializeFunctionProperties(current) : isSandboxClosure(current) ? current.properties ?? {} : isSandboxRegex(current) ? getRegexProperties(current) : isSandboxMap(current) || isSandboxSet(current) ? getCollectionProperties(current) : current;
|
|
17463
|
+
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
17464
|
for (const key of Object.getOwnPropertyNames(properties)) {
|
|
17465
17465
|
if (seen.has(key)) continue;
|
|
17466
17466
|
seen.add(key);
|
|
@@ -17476,7 +17476,7 @@ function hasForInProperty(object, key, budget) {
|
|
|
17476
17476
|
for (let current = object; current !== null; current = getSandboxPrototype(current, budget)) {
|
|
17477
17477
|
if (depth > 0) budget.visitNode();
|
|
17478
17478
|
assertSandboxDataDepth(depth++);
|
|
17479
|
-
const properties = isGuestClosure(current) ? materializeFunctionProperties(current) : isSandboxClosure(current) ? current.properties ?? {} : isSandboxRegex(current) ? getRegexProperties(current) : isSandboxMap(current) || isSandboxSet(current) ? getCollectionProperties(current) : current;
|
|
17479
|
+
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
17480
|
if (Object.hasOwn(properties, key)) return true;
|
|
17481
17481
|
}
|
|
17482
17482
|
return false;
|
|
@@ -17922,7 +17922,7 @@ async function evaluateDeleteExpression(node, context) {
|
|
|
17922
17922
|
}
|
|
17923
17923
|
throw new TypeError("Cannot delete properties of null or undefined.");
|
|
17924
17924
|
}
|
|
17925
|
-
if (!isIndexableSandboxValue(member.object) && !isSandboxRegex(member.object) && !isSandboxMap(member.object) && !isSandboxSet(member.object)) {
|
|
17925
|
+
if (!isIndexableSandboxValue(member.object) && !isSandboxPromise(member.object) && !isSandboxRegex(member.object) && !isSandboxMap(member.object) && !isSandboxSet(member.object)) {
|
|
17926
17926
|
throw new TypeError("Unary operator 'delete' requires a sandbox object property.");
|
|
17927
17927
|
}
|
|
17928
17928
|
const property = await toPropertyKey(member.property, context.budget, createCoercionContext(context));
|
|
@@ -18361,7 +18361,7 @@ async function evaluateMemberCallExpression(node, context) {
|
|
|
18361
18361
|
if (isSandboxPromise(member.object)) {
|
|
18362
18362
|
return evaluateResolvedCallExpression(
|
|
18363
18363
|
node,
|
|
18364
|
-
|
|
18364
|
+
await getPropertyValue(member.object, member.property, context),
|
|
18365
18365
|
context,
|
|
18366
18366
|
member.object
|
|
18367
18367
|
);
|
|
@@ -18896,6 +18896,7 @@ function setSandboxProperty(target, property, value, budget, checkInherited = tr
|
|
|
18896
18896
|
return writePropertyDescriptor(descriptor2, target, value, context);
|
|
18897
18897
|
}
|
|
18898
18898
|
if (isGuestClosure(target)) target = materializeFunctionProperties(target);
|
|
18899
|
+
if (isSandboxPromise(target)) target = getPromiseProperties(target);
|
|
18899
18900
|
if (isSandboxMap(target) || isSandboxSet(target)) target = getCollectionProperties(target);
|
|
18900
18901
|
if (isFloat32Array(target)) {
|
|
18901
18902
|
if (typeof property === "symbol") throw new TypeError("Typed array symbol properties are not yet supported.");
|
|
@@ -18965,6 +18966,7 @@ function deleteSandboxProperty(target, property) {
|
|
|
18965
18966
|
if (isGuestHostObject(target)) return deleteHostObjectMember(target, String(property));
|
|
18966
18967
|
if (isGuestClosure(target)) target = materializeFunctionProperties(target);
|
|
18967
18968
|
if (isSandboxRegex(target)) target = getRegexProperties(target);
|
|
18969
|
+
if (isSandboxPromise(target)) target = getPromiseProperties(target);
|
|
18968
18970
|
if (isSandboxMap(target) || isSandboxSet(target)) target = getCollectionProperties(target);
|
|
18969
18971
|
if (Array.isArray(target)) {
|
|
18970
18972
|
assertCollectionMutable(target);
|
|
@@ -19193,7 +19195,7 @@ async function evaluateObjectSpread(node, context) {
|
|
|
19193
19195
|
}
|
|
19194
19196
|
return { ok: true, value: entries2 };
|
|
19195
19197
|
}
|
|
19196
|
-
if (isSandboxClosure(value.value) && !isGuestClosure(value.value)
|
|
19198
|
+
if (isSandboxClosure(value.value) && !isGuestClosure(value.value)) {
|
|
19197
19199
|
throw new TypeError(
|
|
19198
19200
|
`Cannot spread ${describeObjectSpreadValue(value.value)} into object literal.`
|
|
19199
19201
|
);
|
|
@@ -19535,7 +19537,7 @@ function conversionHook(value, name, budget, context) {
|
|
|
19535
19537
|
let current = value;
|
|
19536
19538
|
let depth = 0;
|
|
19537
19539
|
while (current !== null) {
|
|
19538
|
-
const properties = isGuestClosure(current) ? getGuestFunctionProperties(current) : isSandboxRegex(current) ? getRegexProperties(current) : isSandboxMap(current) || isSandboxSet(current) ? getCollectionProperties(current) : current;
|
|
19540
|
+
const properties = isSandboxPromise(current) ? getPromiseProperties(current) : isGuestClosure(current) ? getGuestFunctionProperties(current) : isSandboxRegex(current) ? getRegexProperties(current) : isSandboxMap(current) || isSandboxSet(current) ? getCollectionProperties(current) : current;
|
|
19539
19541
|
const descriptor = properties === void 0 ? void 0 : Object.getOwnPropertyDescriptor(properties, name);
|
|
19540
19542
|
if (descriptor !== void 0) {
|
|
19541
19543
|
return readPropertyDescriptor(descriptor, value, context);
|
|
@@ -20243,7 +20245,8 @@ function hasOwnSandboxProperty(value, key, enumerable) {
|
|
|
20243
20245
|
if (key === "length" || key === "name") return !enumerable;
|
|
20244
20246
|
properties = value.properties ?? /* @__PURE__ */ Object.create(null);
|
|
20245
20247
|
} else if (isSandboxMap(value) || isSandboxSet(value)) properties = getCollectionProperties(value);
|
|
20246
|
-
else if (isSandboxPromise(value)
|
|
20248
|
+
else if (isSandboxPromise(value)) properties = getPromiseProperties(value);
|
|
20249
|
+
else if (isSandboxGenerator(value))
|
|
20247
20250
|
return false;
|
|
20248
20251
|
else if (isSandboxRegex(value)) properties = getRegexProperties(value);
|
|
20249
20252
|
else properties = Object(value);
|
|
@@ -21959,7 +21962,6 @@ async function stringifyValue(value, state, indent) {
|
|
|
21959
21962
|
if (typeof value === "bigint") {
|
|
21960
21963
|
throw new TypeError("Do not know how to serialize a BigInt.");
|
|
21961
21964
|
}
|
|
21962
|
-
if (isSandboxPromise(value)) return "{}";
|
|
21963
21965
|
if (value === void 0 || isSandboxClosure(value)) {
|
|
21964
21966
|
return void 0;
|
|
21965
21967
|
}
|
|
@@ -22059,7 +22061,7 @@ function quoteJsonString(value) {
|
|
|
22059
22061
|
return JSON.stringify(value);
|
|
22060
22062
|
}
|
|
22061
22063
|
function isStringifyContainer(value) {
|
|
22062
|
-
return typeof value === "object" && value !== null && !isSandboxClosure(value)
|
|
22064
|
+
return typeof value === "object" && value !== null && !isSandboxClosure(value);
|
|
22063
22065
|
}
|
|
22064
22066
|
function isStringifyObject(value) {
|
|
22065
22067
|
return isStringifyContainer(value) && !Array.isArray(value);
|
|
@@ -24860,6 +24862,15 @@ var sandboxRegexBrand = /* @__PURE__ */ Symbol("SandboxRegex");
|
|
|
24860
24862
|
var sandboxRegexPattern = /* @__PURE__ */ Symbol("SandboxRegexPattern");
|
|
24861
24863
|
var sandboxRetainedValues = /* @__PURE__ */ Symbol("SandboxRetainedValues");
|
|
24862
24864
|
for (const marker of [sandboxClosureBrand, sandboxGeneratorBrand, sandboxPromiseBrand, sandboxRegexBrand, sandboxRegexPattern, sandboxRetainedValues]) internalSymbols.add(marker);
|
|
24865
|
+
var promiseProperties = /* @__PURE__ */ new WeakMap();
|
|
24866
|
+
function getPromiseProperties(value) {
|
|
24867
|
+
let properties = promiseProperties.get(value);
|
|
24868
|
+
if (properties === void 0) {
|
|
24869
|
+
properties = /* @__PURE__ */ Object.create(null);
|
|
24870
|
+
promiseProperties.set(value, properties);
|
|
24871
|
+
}
|
|
24872
|
+
return properties;
|
|
24873
|
+
}
|
|
24863
24874
|
function createSandboxClosure(input) {
|
|
24864
24875
|
const closure = {
|
|
24865
24876
|
kind: "fn",
|
|
@@ -24925,6 +24936,7 @@ function ownEnumerableSandboxEntries(value, excludedKeys) {
|
|
|
24925
24936
|
let entries;
|
|
24926
24937
|
if (isGuestClosure(value)) entries = Object.entries(value.properties ?? {});
|
|
24927
24938
|
else if (isSandboxRegex(value)) entries = Object.entries(getRegexProperties(value));
|
|
24939
|
+
else if (isSandboxPromise(value)) entries = Object.entries(getPromiseProperties(value));
|
|
24928
24940
|
else if (isSandboxMap(value) || isSandboxSet(value)) entries = Object.entries(getCollectionProperties(value));
|
|
24929
24941
|
else if (isSandboxClosure(value) || isSandboxGenerator(value) || isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxRegex(value)) return [];
|
|
24930
24942
|
else entries = Object.entries(Object(value));
|
|
@@ -24935,18 +24947,20 @@ function ownSandboxSymbolKeys(value) {
|
|
|
24935
24947
|
if (isGuestHostObject(value)) return [];
|
|
24936
24948
|
if (isSandboxClosure(value)) value = value.properties ?? {};
|
|
24937
24949
|
else if (isSandboxRegex(value)) value = getRegexProperties(value);
|
|
24950
|
+
else if (isSandboxPromise(value)) value = getPromiseProperties(value);
|
|
24938
24951
|
else if (isSandboxMap(value) || isSandboxSet(value)) value = getCollectionProperties(value);
|
|
24939
24952
|
else if (isSandboxGenerator(value) || isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxRegex(value)) return [];
|
|
24940
24953
|
return Object.getOwnPropertySymbols(Object(value)).filter((key) => !internalSymbols.has(key));
|
|
24941
24954
|
}
|
|
24942
24955
|
function ownEnumerableSandboxKeys(value, includeSymbols = false) {
|
|
24943
24956
|
if (includeSymbols) {
|
|
24944
|
-
const properties = isSandboxClosure(value) ? value.properties ?? {} : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : Object(value);
|
|
24957
|
+
const properties = isSandboxClosure(value) ? value.properties ?? {} : isSandboxPromise(value) ? getPromiseProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : Object(value);
|
|
24945
24958
|
return [...ownEnumerableSandboxKeys(value), ...ownSandboxSymbolKeys(value).filter((key) => Object.getOwnPropertyDescriptor(properties, key)?.enumerable === true)];
|
|
24946
24959
|
}
|
|
24947
24960
|
if (isGuestHostObject(value)) return getHostObjectKeys(value);
|
|
24948
24961
|
if (value === null || value === void 0) throw new TypeError("Cannot convert undefined or null to object.");
|
|
24949
24962
|
if (isGuestClosure(value)) return Object.keys(value.properties ?? {});
|
|
24963
|
+
if (isSandboxPromise(value)) return Object.keys(getPromiseProperties(value));
|
|
24950
24964
|
if (isSandboxRegex(value)) return Object.keys(getRegexProperties(value));
|
|
24951
24965
|
if (isSandboxMap(value) || isSandboxSet(value)) return Object.keys(getCollectionProperties(value));
|
|
24952
24966
|
if (isSandboxClosure(value) || isSandboxGenerator(value) || isSandboxMap(value) || isSandboxSet(value) || isSandboxPromise(value) || isSandboxRegex(value)) return [];
|
|
@@ -25255,7 +25269,15 @@ function measureSandboxData(values, options = {}) {
|
|
|
25255
25269
|
for (const completion of snapshot.sent) visit(completion.value, depth + 1);
|
|
25256
25270
|
return;
|
|
25257
25271
|
}
|
|
25258
|
-
if (isSandboxPromise(value))
|
|
25272
|
+
if (isSandboxPromise(value)) {
|
|
25273
|
+
for (const key of Reflect.ownKeys(getPromiseProperties(value))) {
|
|
25274
|
+
const descriptor = Object.getOwnPropertyDescriptor(getPromiseProperties(value), key);
|
|
25275
|
+
usage += typeof key === "string" ? key.length + 1 : 1;
|
|
25276
|
+
if ("value" in descriptor) visit(descriptor.value, depth + 1);
|
|
25277
|
+
else for (const closure of retainedAccessorClosures(descriptor)) visit(closure, depth + 1);
|
|
25278
|
+
}
|
|
25279
|
+
return;
|
|
25280
|
+
}
|
|
25259
25281
|
if (isSandboxRegex(value)) {
|
|
25260
25282
|
const { source, flags, lastIndex } = captureRegexData(value);
|
|
25261
25283
|
const compiled = regexCompiledData(getSandboxRegexPattern(value));
|
|
@@ -25705,6 +25727,8 @@ function copyFromSandbox(value, state, path = "<root>", options, depth = 0) {
|
|
|
25705
25727
|
return wrapped;
|
|
25706
25728
|
}
|
|
25707
25729
|
if (isSandboxPromise(value)) {
|
|
25730
|
+
const existing = state.seen.get(value);
|
|
25731
|
+
if (existing !== void 0) return existing;
|
|
25708
25732
|
observeSandboxPromise(value);
|
|
25709
25733
|
const copySettlement = (settled) => {
|
|
25710
25734
|
const owner = options.compilation?.owner;
|
|
@@ -25720,10 +25744,22 @@ function copyFromSandbox(value, state, path = "<root>", options, depth = 0) {
|
|
|
25720
25744
|
operation?.release();
|
|
25721
25745
|
}
|
|
25722
25746
|
};
|
|
25723
|
-
|
|
25747
|
+
const copy = value.promise.then(
|
|
25724
25748
|
copySettlement,
|
|
25725
25749
|
(reason) => Promise.reject(reason instanceof SandboxError ? reason : copySettlement(reason))
|
|
25726
25750
|
);
|
|
25751
|
+
state.seen.set(value, copy);
|
|
25752
|
+
const properties = getPromiseProperties(value);
|
|
25753
|
+
for (const key of Reflect.ownKeys(properties)) {
|
|
25754
|
+
const descriptor = Object.getOwnPropertyDescriptor(properties, key);
|
|
25755
|
+
if (!("value" in descriptor)) throw new TypeError("Promise accessor properties cannot be copied as data.");
|
|
25756
|
+
Object.defineProperty(copy, key, {
|
|
25757
|
+
...descriptor,
|
|
25758
|
+
value: copyFromSandbox(descriptor.value, state, `${path}.<property>`, options, depth + 1)
|
|
25759
|
+
});
|
|
25760
|
+
}
|
|
25761
|
+
if (!Object.isExtensible(properties)) Object.preventExtensions(copy);
|
|
25762
|
+
return copy;
|
|
25727
25763
|
}
|
|
25728
25764
|
if (isSandboxGenerator(value)) {
|
|
25729
25765
|
throw new TypeError("Sandbox generators cannot cross into host values.");
|
|
@@ -40046,4 +40082,4 @@ export {
|
|
|
40046
40082
|
FileSnapshotBackend,
|
|
40047
40083
|
run
|
|
40048
40084
|
};
|
|
40049
|
-
//# sourceMappingURL=chunk-
|
|
40085
|
+
//# sourceMappingURL=chunk-2W5HRQU3.js.map
|