@poe-platform/safe-js 0.1.375 → 0.1.377
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-M22DVZY3.js → chunk-MNH75BJN.js} +224 -33
- package/dist/safe-js/chunks/chunk-MNH75BJN.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-UZHOTID6.js → chunk-V3IQSKGJ.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/package.json +2 -2
- package/dist/safe-js/chunks/chunk-M22DVZY3.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-UZHOTID6.js.map → chunk-V3IQSKGJ.js.map} +0 -0
|
@@ -8411,8 +8411,9 @@ function getSandboxDataProperty(value, key, budget) {
|
|
|
8411
8411
|
}
|
|
8412
8412
|
return void 0;
|
|
8413
8413
|
}
|
|
8414
|
-
function setSandboxPrototype(value, prototype, budget) {
|
|
8414
|
+
function setSandboxPrototype(value, prototype, budget, throwOnFailure = true) {
|
|
8415
8415
|
if (budget !== void 0 && intrinsicPrototypes.get(budget) === value && prototype !== null) {
|
|
8416
|
+
if (!throwOnFailure) return false;
|
|
8416
8417
|
throw new TypeError("Object.prototype has an immutable null prototype.");
|
|
8417
8418
|
}
|
|
8418
8419
|
if (!Array.isArray(value) && !isSandboxGenerator(value) && !isSandboxDate(value) && !isSandboxPromise(value) && !isSandboxRegex(value) && !isSandboxMap(value) && !isSandboxSet(value) && !isPrototypeRecord(value) || prototype !== null && !Array.isArray(prototype) && !isSandboxGenerator(prototype) && !isSandboxDate(prototype) && !isSandboxPromise(prototype) && !isSandboxRegex(prototype) && !isSandboxMap(prototype) && !isSandboxSet(prototype) && !isPrototypeRecord(prototype)) {
|
|
@@ -8422,18 +8423,23 @@ function setSandboxPrototype(value, prototype, budget) {
|
|
|
8422
8423
|
}
|
|
8423
8424
|
if (getSandboxPrototype(value, budget) === prototype) {
|
|
8424
8425
|
if (prototype === null) prototypes.set(value, null);
|
|
8425
|
-
return;
|
|
8426
|
+
return true;
|
|
8426
8427
|
}
|
|
8427
8428
|
if (!Object.isExtensible(isSandboxGenerator(value) ? getGeneratorProperties(value) : isGuestClosure(value) ? materializeFunctionProperties(value) : isSandboxPromise(value) ? getPromiseProperties(value) : isSandboxRegex(value) ? getRegexProperties(value) : isSandboxMap(value) || isSandboxSet(value) ? getCollectionProperties(value) : value)) {
|
|
8429
|
+
if (!throwOnFailure) return false;
|
|
8428
8430
|
throw new TypeError("Cannot change the prototype of a non-extensible object.");
|
|
8429
8431
|
}
|
|
8430
8432
|
let depth = 0;
|
|
8431
8433
|
for (let current = prototype; current !== null; current = getSandboxPrototype(current, budget)) {
|
|
8432
8434
|
budget?.visitNode();
|
|
8433
8435
|
assertSandboxDataDepth(depth++);
|
|
8434
|
-
if (current === value)
|
|
8436
|
+
if (current === value) {
|
|
8437
|
+
if (!throwOnFailure) return false;
|
|
8438
|
+
throw new TypeError("Cyclic prototype value.");
|
|
8439
|
+
}
|
|
8435
8440
|
}
|
|
8436
8441
|
prototypes.set(value, prototype);
|
|
8442
|
+
return true;
|
|
8437
8443
|
}
|
|
8438
8444
|
function isPrototypeRecord(value) {
|
|
8439
8445
|
if (isSandboxDataView(value)) return true;
|
|
@@ -8458,6 +8464,12 @@ function hasGuestObjectState(value) {
|
|
|
8458
8464
|
if (isLiveCapability(value)) return true;
|
|
8459
8465
|
if (functionProperties.has(value) || prototypes.has(value) && !hasNullObjectPrototype(value)) return true;
|
|
8460
8466
|
if (isSandboxBox(value) || isSandboxDate(value)) return false;
|
|
8467
|
+
if (Array.isArray(value) && descriptorObjects.has(value)) {
|
|
8468
|
+
return Object.getOwnPropertyNames(value).some((key) => {
|
|
8469
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
8470
|
+
return key === "length" ? descriptor.writable !== true : !descriptor.enumerable || !descriptor.configurable || !descriptor.writable;
|
|
8471
|
+
});
|
|
8472
|
+
}
|
|
8461
8473
|
return descriptorObjects.has(value) && (isNumericTypedArray(value) ? typedArrayProperties(value).map(([, descriptor]) => descriptor) : Object.values(Object.getOwnPropertyDescriptors(value))).some(
|
|
8462
8474
|
(descriptor) => !descriptor.enumerable || !descriptor.configurable || !descriptor.writable
|
|
8463
8475
|
);
|
|
@@ -15156,17 +15168,19 @@ async function definePropertiesFromObject(target, descriptors2, budget, context)
|
|
|
15156
15168
|
release();
|
|
15157
15169
|
}
|
|
15158
15170
|
}
|
|
15159
|
-
function defineDataProperty(target, key, descriptor, budget, context) {
|
|
15171
|
+
function defineDataProperty(target, key, descriptor, budget, context, throwOnFailure = true) {
|
|
15160
15172
|
budget.visitNode();
|
|
15161
15173
|
if (isNumericTypedArray(target) && typeof key !== "symbol" && isTypedArrayIndex(String(key)) && "value" in descriptor) {
|
|
15162
15174
|
const { value, ...attributes } = descriptor;
|
|
15163
|
-
Object.defineProperty(target, key, attributes);
|
|
15175
|
+
if (throwOnFailure) Object.defineProperty(target, key, attributes);
|
|
15176
|
+
else if (!Reflect.defineProperty(target, key, attributes)) return false;
|
|
15164
15177
|
return (async () => {
|
|
15165
15178
|
const release = retainValues(budget, () => [target, value]);
|
|
15166
15179
|
try {
|
|
15167
15180
|
const number = await typedArrayElement(value, typedArrayStorage(target).Native, budget, context);
|
|
15168
15181
|
Reflect.set(target, key, number);
|
|
15169
15182
|
markDescriptorObject(target);
|
|
15183
|
+
return throwOnFailure ? void 0 : true;
|
|
15170
15184
|
} finally {
|
|
15171
15185
|
release();
|
|
15172
15186
|
}
|
|
@@ -15174,17 +15188,43 @@ function defineDataProperty(target, key, descriptor, budget, context) {
|
|
|
15174
15188
|
}
|
|
15175
15189
|
const properties = objectProperties(target, true);
|
|
15176
15190
|
if (Array.isArray(properties)) {
|
|
15177
|
-
if (key === "length" && "value" in descriptor)
|
|
15178
|
-
|
|
15179
|
-
|
|
15191
|
+
if (key === "length" && "value" in descriptor) {
|
|
15192
|
+
const applyLength = (first, second) => {
|
|
15193
|
+
const length = first >>> 0;
|
|
15194
|
+
if (length !== second) throw new RangeError("Invalid array length.");
|
|
15195
|
+
budget.allocateArrayLength(length);
|
|
15196
|
+
const normalized = { ...descriptor, value: length };
|
|
15197
|
+
if (throwOnFailure) Object.defineProperty(properties, key, normalized);
|
|
15198
|
+
else {
|
|
15199
|
+
const success = Reflect.defineProperty(properties, key, normalized);
|
|
15200
|
+
markDescriptorObject(properties);
|
|
15201
|
+
return success;
|
|
15202
|
+
}
|
|
15203
|
+
markDescriptorObject(properties);
|
|
15204
|
+
return void 0;
|
|
15205
|
+
};
|
|
15206
|
+
if (typeof descriptor.value === "number") return applyLength(descriptor.value, descriptor.value);
|
|
15207
|
+
return (async () => {
|
|
15208
|
+
const release = retainValues(budget, () => [target, descriptor.value]);
|
|
15209
|
+
try {
|
|
15210
|
+
const first = await sandboxNumber(descriptor.value, budget, context);
|
|
15211
|
+
const second = await sandboxNumber(descriptor.value, budget, context);
|
|
15212
|
+
return applyLength(first, second);
|
|
15213
|
+
} finally {
|
|
15214
|
+
release();
|
|
15215
|
+
}
|
|
15216
|
+
})();
|
|
15217
|
+
} else if (typeof key !== "symbol") {
|
|
15180
15218
|
const index = Number(key);
|
|
15181
15219
|
if (Number.isInteger(index) && index >= 0 && index < 4294967295 && String(index) === key) {
|
|
15182
15220
|
budget.allocateArrayLength(index + 1);
|
|
15183
15221
|
}
|
|
15184
15222
|
}
|
|
15185
15223
|
}
|
|
15186
|
-
Object.defineProperty(properties, key, descriptor);
|
|
15224
|
+
if (throwOnFailure) Object.defineProperty(properties, key, descriptor);
|
|
15225
|
+
else if (!Reflect.defineProperty(properties, key, descriptor)) return false;
|
|
15187
15226
|
markDescriptorObject(properties);
|
|
15227
|
+
return throwOnFailure ? void 0 : true;
|
|
15188
15228
|
}
|
|
15189
15229
|
function isAssignableSandboxTarget(value) {
|
|
15190
15230
|
return typeof value === "object" && value !== null && !isSandboxClosure(value) && !isSandboxGenerator(value) && !isSandboxMap(value) && !isSandboxSet(value) && !isSandboxPromise(value) && !isSandboxRegex(value);
|
|
@@ -15728,8 +15768,21 @@ function callFunctionMethod(target, methodName, args, options, stack, context) {
|
|
|
15728
15768
|
if (typeof applyArgs !== "object") {
|
|
15729
15769
|
throw new TypeError("Function#apply requires an object or nullish arguments value.");
|
|
15730
15770
|
}
|
|
15731
|
-
if (context?.getProperty === void 0 && Array.isArray(applyArgs))
|
|
15732
|
-
|
|
15771
|
+
if (context?.getProperty === void 0 && Array.isArray(applyArgs)) {
|
|
15772
|
+
const budget = options.budget ?? new Budget();
|
|
15773
|
+
const length = applyArgs.length;
|
|
15774
|
+
budget.allocateArrayLength(length);
|
|
15775
|
+
const values = [];
|
|
15776
|
+
for (let index = 0; index < length; index++) {
|
|
15777
|
+
const descriptor = getSandboxPropertyDescriptor(applyArgs, String(index), budget);
|
|
15778
|
+
if (descriptor !== void 0 && !("value" in descriptor)) break;
|
|
15779
|
+
values.push(descriptor?.value);
|
|
15780
|
+
}
|
|
15781
|
+
if (values.length === length) {
|
|
15782
|
+
for (let index = 0; index < length; index++) budget.visitNode();
|
|
15783
|
+
return options.callClosure(target, values, stack, thisValue);
|
|
15784
|
+
}
|
|
15785
|
+
}
|
|
15733
15786
|
return (async () => {
|
|
15734
15787
|
const budget = options.budget ?? new Budget();
|
|
15735
15788
|
const invocationContext = {
|
|
@@ -26519,6 +26572,139 @@ async function dataViewIndex(value, budget, context) {
|
|
|
26519
26572
|
return index;
|
|
26520
26573
|
}
|
|
26521
26574
|
|
|
26575
|
+
// packages/safe-js/src/interp/globals/reflect.ts
|
|
26576
|
+
var nativeReflectPropertyNames = Object.getOwnPropertyNames(Reflect);
|
|
26577
|
+
function createReflectGlobal(budget) {
|
|
26578
|
+
const methods2 = {
|
|
26579
|
+
ownKeys: { length: 1, call: ([target]) => {
|
|
26580
|
+
const properties = objectProperties(target);
|
|
26581
|
+
return allocateProducedSandboxValue([...Object.getOwnPropertyNames(properties), ...ownSandboxSymbolKeys(target)], budget);
|
|
26582
|
+
} },
|
|
26583
|
+
getOwnPropertyDescriptor: { length: 2, call: async ([target, key], context) => {
|
|
26584
|
+
objectProperties(target);
|
|
26585
|
+
const property = await toPropertyKey(key, budget, context);
|
|
26586
|
+
const descriptor = Object.getOwnPropertyDescriptor(objectProperties(target), property);
|
|
26587
|
+
return descriptor === void 0 ? void 0 : allocateProducedSandboxValue(exposePropertyDescriptor(descriptor), budget);
|
|
26588
|
+
} },
|
|
26589
|
+
getPrototypeOf: { length: 1, call: ([target]) => {
|
|
26590
|
+
objectProperties(target);
|
|
26591
|
+
return getSandboxPrototype(target, budget);
|
|
26592
|
+
} },
|
|
26593
|
+
has: { length: 2, call: async ([target, key], context) => {
|
|
26594
|
+
objectProperties(target);
|
|
26595
|
+
return getSandboxPropertyDescriptor(target, await toPropertyKey(key, budget, context), budget) !== void 0;
|
|
26596
|
+
} },
|
|
26597
|
+
isExtensible: { length: 1, call: ([target]) => Object.isExtensible(objectProperties(target)) },
|
|
26598
|
+
preventExtensions: { length: 1, call: ([target]) => Reflect.preventExtensions(objectProperties(target, true)) },
|
|
26599
|
+
deleteProperty: { length: 2, call: async ([target, key], context) => {
|
|
26600
|
+
objectProperties(target, true);
|
|
26601
|
+
const property = await toPropertyKey(key, budget, context);
|
|
26602
|
+
return Reflect.deleteProperty(objectProperties(target, true), property);
|
|
26603
|
+
} },
|
|
26604
|
+
get: { length: 2, call: async (args, context) => {
|
|
26605
|
+
const [target, key] = args;
|
|
26606
|
+
objectProperties(target);
|
|
26607
|
+
const property = await toPropertyKey(key, budget, context);
|
|
26608
|
+
const descriptor = getSandboxPropertyDescriptor(target, property, budget);
|
|
26609
|
+
return descriptor === void 0 ? void 0 : readPropertyDescriptor(descriptor, args.length > 2 ? args[2] : target, context);
|
|
26610
|
+
} },
|
|
26611
|
+
defineProperty: { length: 3, call: async ([target, key, input], context) => {
|
|
26612
|
+
objectProperties(target, true);
|
|
26613
|
+
const property = await toPropertyKey(key, budget, context);
|
|
26614
|
+
const descriptor = await propertyDescriptor(input, budget, context);
|
|
26615
|
+
return await defineDataProperty(target, property, descriptor, budget, context, false);
|
|
26616
|
+
} },
|
|
26617
|
+
setPrototypeOf: { length: 2, call: ([target, prototype]) => {
|
|
26618
|
+
objectProperties(target, true);
|
|
26619
|
+
if (prototype !== null) objectProperties(prototype);
|
|
26620
|
+
return setSandboxPrototype(target, prototype, budget, false);
|
|
26621
|
+
} },
|
|
26622
|
+
set: { length: 3, call: async (args, context) => {
|
|
26623
|
+
const [target, key, value] = args;
|
|
26624
|
+
objectProperties(target, true);
|
|
26625
|
+
const property = await toPropertyKey(key, budget, context);
|
|
26626
|
+
const receiver = args.length > 3 ? args[3] : target;
|
|
26627
|
+
let descriptor;
|
|
26628
|
+
let depth = 0;
|
|
26629
|
+
for (let current = target; current !== null; current = getSandboxPrototype(current, budget)) {
|
|
26630
|
+
budget.visitNode();
|
|
26631
|
+
assertSandboxDataDepth(depth++);
|
|
26632
|
+
if (isNumericTypedArray(current) && typeof property === "string" && isTypedArrayIndex(property)) {
|
|
26633
|
+
if (current === receiver) {
|
|
26634
|
+
await setTypedArrayMember(current, property, value, budget, context);
|
|
26635
|
+
return true;
|
|
26636
|
+
}
|
|
26637
|
+
if (Object.getOwnPropertyDescriptor(current, property) === void 0) return true;
|
|
26638
|
+
}
|
|
26639
|
+
descriptor = Object.getOwnPropertyDescriptor(objectProperties(current), property);
|
|
26640
|
+
if (descriptor !== void 0) break;
|
|
26641
|
+
}
|
|
26642
|
+
if (descriptor !== void 0 && !("value" in descriptor)) {
|
|
26643
|
+
const setter = accessorClosure(descriptor.set);
|
|
26644
|
+
if (setter === void 0) return false;
|
|
26645
|
+
await context.invokeClosure(setter, [value], receiver);
|
|
26646
|
+
return true;
|
|
26647
|
+
}
|
|
26648
|
+
if (descriptor !== void 0 && !descriptor.writable) return false;
|
|
26649
|
+
if (receiver === null || typeof receiver !== "object") return false;
|
|
26650
|
+
const existing = Object.getOwnPropertyDescriptor(objectProperties(receiver, true), property);
|
|
26651
|
+
if (existing !== void 0 && (!("value" in existing) || !existing.writable)) return false;
|
|
26652
|
+
return await defineDataProperty(receiver, property, existing === void 0 ? { value, writable: true, enumerable: true, configurable: true } : { value }, budget, context, false);
|
|
26653
|
+
} },
|
|
26654
|
+
apply: { length: 3, call: ([target, receiver, values], context) => {
|
|
26655
|
+
if (!isSandboxClosure(target)) throw new TypeError("Reflect.apply requires a callable target.");
|
|
26656
|
+
objectProperties(values);
|
|
26657
|
+
return callFunctionMethod(target, "apply", [receiver, values], {
|
|
26658
|
+
budget,
|
|
26659
|
+
callClosure: (callee, args, _stack, thisValue) => context.invokeClosure(callee, args, thisValue)
|
|
26660
|
+
}, context.stack, context);
|
|
26661
|
+
} },
|
|
26662
|
+
construct: { length: 2, call: (args, context) => {
|
|
26663
|
+
const [target, values] = args;
|
|
26664
|
+
const newTarget = args.length > 2 ? args[2] : target;
|
|
26665
|
+
if (!isSandboxClosure(target) || target.construct === void 0 || !isSandboxClosure(newTarget) || newTarget.construct === void 0)
|
|
26666
|
+
throw new TypeError("Reflect.construct requires constructor targets.");
|
|
26667
|
+
objectProperties(values);
|
|
26668
|
+
return callFunctionMethod(target, "apply", [void 0, values], {
|
|
26669
|
+
budget,
|
|
26670
|
+
callClosure: (callee, items) => context.invokeClosure(callee, items, void 0, true, newTarget)
|
|
26671
|
+
}, context.stack, context);
|
|
26672
|
+
} }
|
|
26673
|
+
};
|
|
26674
|
+
const reflect = {};
|
|
26675
|
+
for (const name of nativeReflectPropertyNames) {
|
|
26676
|
+
const method = methods2[name];
|
|
26677
|
+
if (method === void 0) continue;
|
|
26678
|
+
const closure = createSandboxClosure({
|
|
26679
|
+
guest: true,
|
|
26680
|
+
sandbox: true,
|
|
26681
|
+
name,
|
|
26682
|
+
length: method.length,
|
|
26683
|
+
call: async (args, context) => {
|
|
26684
|
+
const release = retainValues(budget, () => args);
|
|
26685
|
+
try {
|
|
26686
|
+
return await method.call(args, {
|
|
26687
|
+
...context,
|
|
26688
|
+
stack: context?.stack ?? [],
|
|
26689
|
+
thisValue: context?.thisValue,
|
|
26690
|
+
invokeClosure: context?.invokeClosure ?? ((target, values, receiver, construct, newTarget) => invokeBuiltinClosure(target, values, budget, { ...context, stack: context?.stack ?? [], thisValue: receiver, newTarget }, receiver, construct))
|
|
26691
|
+
});
|
|
26692
|
+
} finally {
|
|
26693
|
+
release();
|
|
26694
|
+
}
|
|
26695
|
+
}
|
|
26696
|
+
});
|
|
26697
|
+
Object.defineProperty(reflect, name, { value: closure, writable: true, configurable: true });
|
|
26698
|
+
}
|
|
26699
|
+
Object.defineProperty(reflect, Symbol.toStringTag, { value: "Reflect", configurable: true });
|
|
26700
|
+
registerBuiltinIdentities(budget, { Reflect: reflect });
|
|
26701
|
+
for (const descriptor of Object.values(Object.getOwnPropertyDescriptors(reflect))) {
|
|
26702
|
+
if (isSandboxClosure(descriptor.value)) registerIntrinsicFunction(budget, descriptor.value);
|
|
26703
|
+
}
|
|
26704
|
+
registerIntrinsicObject(budget, reflect);
|
|
26705
|
+
return reflect;
|
|
26706
|
+
}
|
|
26707
|
+
|
|
26522
26708
|
// packages/safe-js/src/interp/globals.ts
|
|
26523
26709
|
function createBuiltinBindings(options) {
|
|
26524
26710
|
const bindings = {
|
|
@@ -26531,6 +26717,7 @@ function createBuiltinBindings(options) {
|
|
|
26531
26717
|
...createErrorGlobals({ ...options, errorPrototypes: options.errorPrototypes !== false }),
|
|
26532
26718
|
...createMathGlobals({ random: options.random, budget: options.budget }),
|
|
26533
26719
|
...createObjectArrayGlobals(options),
|
|
26720
|
+
Reflect: createReflectGlobal(options.budget),
|
|
26534
26721
|
ArrayBuffer: createArrayBufferGlobal(options.budget),
|
|
26535
26722
|
DataView: createDataViewGlobal(options.budget),
|
|
26536
26723
|
...createMiscGlobals(options),
|
|
@@ -28560,8 +28747,8 @@ function measureSandboxData(values, options = {}) {
|
|
|
28560
28747
|
usage += 1;
|
|
28561
28748
|
if (!isGuestHostObject(value)) {
|
|
28562
28749
|
const symbols = Object.getOwnPropertySymbols(value);
|
|
28563
|
-
const
|
|
28564
|
-
for (const [key, descriptor] of
|
|
28750
|
+
const descriptors2 = symbols.length === 0 ? [] : symbols.filter((key) => !internalSymbols.has(key)).map((key) => [key, Object.getOwnPropertyDescriptor(value, key)]);
|
|
28751
|
+
for (const [key, descriptor] of descriptors2) {
|
|
28565
28752
|
usage += 1;
|
|
28566
28753
|
visit(key, depth + 1);
|
|
28567
28754
|
if ("value" in descriptor) visit(descriptor.value, depth + 1);
|
|
@@ -28605,13 +28792,13 @@ function measureSandboxData(values, options = {}) {
|
|
|
28605
28792
|
if (Array.isArray(value)) {
|
|
28606
28793
|
usage += value.length;
|
|
28607
28794
|
if (hasManagedDescriptors(value)) {
|
|
28608
|
-
const
|
|
28795
|
+
const descriptors2 = [];
|
|
28609
28796
|
for (const key of Object.getOwnPropertyNames(value)) {
|
|
28610
28797
|
if (key === "length") continue;
|
|
28611
28798
|
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
28612
|
-
if (descriptor !== void 0)
|
|
28799
|
+
if (descriptor !== void 0) descriptors2.push([key, descriptor]);
|
|
28613
28800
|
}
|
|
28614
|
-
for (const [key, descriptor] of
|
|
28801
|
+
for (const [key, descriptor] of descriptors2) {
|
|
28615
28802
|
usage += key.length + 1;
|
|
28616
28803
|
if ("value" in descriptor) visit(descriptor.value, depth + 1);
|
|
28617
28804
|
else for (const closure of retainedAccessorClosures(descriptor)) visit(closure, depth + 1);
|
|
@@ -28678,13 +28865,13 @@ function measureSandboxData(values, options = {}) {
|
|
|
28678
28865
|
} else visit(value.properties, depth + 1);
|
|
28679
28866
|
}
|
|
28680
28867
|
if (!options.ignoreClosureCaptures)
|
|
28681
|
-
for (const
|
|
28868
|
+
for (const retained2 of value[sandboxRetainedValues]?.() ?? []) visit(retained2, depth + 1);
|
|
28682
28869
|
return;
|
|
28683
28870
|
}
|
|
28684
28871
|
if (isSandboxGenerator(value)) {
|
|
28685
|
-
const
|
|
28686
|
-
for (const key of Reflect.ownKeys(
|
|
28687
|
-
const descriptor =
|
|
28872
|
+
const descriptors2 = Object.getOwnPropertyDescriptors(getGeneratorProperties(value));
|
|
28873
|
+
for (const key of Reflect.ownKeys(descriptors2)) {
|
|
28874
|
+
const descriptor = descriptors2[key];
|
|
28688
28875
|
usage += typeof key === "string" ? key.length + 1 : 1;
|
|
28689
28876
|
if (typeof key === "symbol") visit(key, depth + 1);
|
|
28690
28877
|
if ("value" in descriptor) visit(descriptor.value, depth + 1);
|
|
@@ -28725,27 +28912,30 @@ function measureSandboxData(values, options = {}) {
|
|
|
28725
28912
|
const entries = [];
|
|
28726
28913
|
for (const key of Object.getOwnPropertyNames(value)) {
|
|
28727
28914
|
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
28728
|
-
const
|
|
28729
|
-
if (
|
|
28915
|
+
const retained2 = "value" in descriptor ? [descriptor.value] : retainedAccessorClosures(descriptor);
|
|
28916
|
+
if (retained2.length > 0) entries.push([key, retained2]);
|
|
28730
28917
|
}
|
|
28731
|
-
for (const [key,
|
|
28918
|
+
for (const [key, retained2] of entries) {
|
|
28732
28919
|
usage += 1 + key.length;
|
|
28733
|
-
for (const entry of
|
|
28920
|
+
for (const entry of retained2) visit(entry, depth + 1);
|
|
28734
28921
|
}
|
|
28735
28922
|
return;
|
|
28736
28923
|
}
|
|
28737
|
-
const
|
|
28738
|
-
|
|
28739
|
-
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
28740
|
-
if (descriptor !== void 0) descriptors2.push([key, descriptor]);
|
|
28741
|
-
}
|
|
28924
|
+
const proxyKeys = nodeTypes.isProxy(value) ? Object.getOwnPropertyNames(value) : void 0;
|
|
28925
|
+
const proxyDescriptors = proxyKeys?.map((key) => Object.getOwnPropertyDescriptor(value, key));
|
|
28742
28926
|
const includeNonEnumerable = isSandboxDate(value) || isSandboxArrayBuffer(value) || isSandboxDataView(value) || sandboxErrorTypes.has(value) || hasManagedDescriptors(value);
|
|
28743
|
-
|
|
28927
|
+
const keys = proxyKeys ?? (includeNonEnumerable ? Object.getOwnPropertyNames(value) : Object.keys(value));
|
|
28928
|
+
const retained = [];
|
|
28929
|
+
for (let index = 0; index < keys.length; index++) {
|
|
28930
|
+
const key = keys[index];
|
|
28931
|
+
const descriptor = proxyDescriptors === void 0 ? Object.getOwnPropertyDescriptor(value, key) : proxyDescriptors[index];
|
|
28932
|
+
if (descriptor === void 0) continue;
|
|
28744
28933
|
if (!descriptor.enumerable && !includeNonEnumerable) continue;
|
|
28745
28934
|
usage += 1 + key.length;
|
|
28746
|
-
if ("value" in descriptor)
|
|
28747
|
-
else for (const closure of retainedAccessorClosures(descriptor))
|
|
28935
|
+
if ("value" in descriptor) retained.push(descriptor.value);
|
|
28936
|
+
else for (const closure of retainedAccessorClosures(descriptor)) retained.push(closure);
|
|
28748
28937
|
}
|
|
28938
|
+
for (const entry of retained) visit(entry, depth + 1);
|
|
28749
28939
|
};
|
|
28750
28940
|
for (const value of values) visit(value);
|
|
28751
28941
|
return usage;
|
|
@@ -31211,6 +31401,7 @@ var KNOWN_RUNTIME_GLOBALS = [
|
|
|
31211
31401
|
"Promise",
|
|
31212
31402
|
"RangeError",
|
|
31213
31403
|
"ReferenceError",
|
|
31404
|
+
"Reflect",
|
|
31214
31405
|
"RegExp",
|
|
31215
31406
|
"Set",
|
|
31216
31407
|
"String",
|
|
@@ -43700,4 +43891,4 @@ export {
|
|
|
43700
43891
|
FileSnapshotBackend,
|
|
43701
43892
|
run
|
|
43702
43893
|
};
|
|
43703
|
-
//# sourceMappingURL=chunk-
|
|
43894
|
+
//# sourceMappingURL=chunk-MNH75BJN.js.map
|