@poe-platform/safe-js 0.1.408 → 0.1.409

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.
@@ -30359,6 +30359,29 @@ function measureSandboxData(values, options = {}) {
30359
30359
  assertSandboxDataDepth(depth);
30360
30360
  seen.add(value);
30361
30361
  usage += 1;
30362
+ const arrayLength = Array.isArray(value) ? value.length : void 0;
30363
+ const managedArray = arrayLength !== void 0 && hasManagedDescriptors(value);
30364
+ let arrayDescriptors;
30365
+ let arrayElements;
30366
+ if (arrayLength !== void 0) {
30367
+ if (managedArray) arrayDescriptors = [];
30368
+ else arrayElements = [];
30369
+ if (!managedArray && nodeTypes.isProxy(value)) {
30370
+ for (let index = 0; index < arrayLength; index += 1) {
30371
+ const descriptor = Object.getOwnPropertyDescriptor(value, index);
30372
+ if (descriptor !== void 0 && "value" in descriptor) arrayElements.push(descriptor.value);
30373
+ }
30374
+ } else {
30375
+ for (const key of Object.getOwnPropertyNames(value)) {
30376
+ if (key === "length" || !managedArray && !isArrayIndexKey2(key)) continue;
30377
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
30378
+ if (descriptor !== void 0) {
30379
+ if (arrayDescriptors !== void 0) arrayDescriptors.push([key, descriptor]);
30380
+ else if ("value" in descriptor) arrayElements.push(descriptor.value);
30381
+ }
30382
+ }
30383
+ }
30384
+ }
30362
30385
  const privateSlots = privateElements.get(value);
30363
30386
  if (privateSlots !== void 0) {
30364
30387
  for (const [name, element] of privateSlots) {
@@ -30427,36 +30450,17 @@ function measureSandboxData(values, options = {}) {
30427
30450
  }
30428
30451
  return;
30429
30452
  }
30430
- if (Array.isArray(value)) {
30431
- usage += value.length;
30432
- if (hasManagedDescriptors(value)) {
30433
- const descriptors2 = [];
30434
- for (const key of Object.getOwnPropertyNames(value)) {
30435
- if (key === "length") continue;
30436
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
30437
- if (descriptor !== void 0) descriptors2.push([key, descriptor]);
30438
- }
30439
- for (const [key, descriptor] of descriptors2) {
30453
+ if (arrayLength !== void 0) {
30454
+ usage += arrayLength;
30455
+ if (arrayDescriptors !== void 0) {
30456
+ for (const [key, descriptor] of arrayDescriptors) {
30440
30457
  usage += key.length + 1;
30441
30458
  if ("value" in descriptor) visit(descriptor.value, depth + 1);
30442
30459
  else for (const closure of retainedAccessorClosures(descriptor)) visit(closure, depth + 1);
30443
30460
  }
30444
- return;
30445
- }
30446
- const elements = [];
30447
- if (nodeTypes.isProxy(value)) {
30448
- for (let index = 0; index < value.length; index += 1) {
30449
- const descriptor = Object.getOwnPropertyDescriptor(value, index);
30450
- if (descriptor !== void 0 && "value" in descriptor) elements.push(descriptor.value);
30451
- }
30452
30461
  } else {
30453
- for (const key of Object.getOwnPropertyNames(value)) {
30454
- if (!isArrayIndexKey2(key)) continue;
30455
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
30456
- if (descriptor !== void 0 && "value" in descriptor) elements.push(descriptor.value);
30457
- }
30462
+ for (const element of arrayElements) visit(element, depth + 1);
30458
30463
  }
30459
- for (const element of elements) visit(element, depth + 1);
30460
30464
  return;
30461
30465
  }
30462
30466
  if (isSandboxMap(value) || isSandboxSet(value)) {
@@ -45568,4 +45572,4 @@ export {
45568
45572
  FileSnapshotBackend,
45569
45573
  run
45570
45574
  };
45571
- //# sourceMappingURL=chunk-6GFX7QAK.js.map
45575
+ //# sourceMappingURL=chunk-PRNIT3QM.js.map