@poe-platform/safe-js 0.1.208 → 0.1.210

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.
@@ -27,7 +27,7 @@ import {
27
27
  validateMigrationSemantics,
28
28
  validateSnapshotData,
29
29
  validateSnapshotMigration
30
- } from "./chunk-WGL3FZZM.js";
30
+ } from "./chunk-UZYQWFMY.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-G5R5W7BH.js.map
8252
+ //# sourceMappingURL=chunk-DHGWYRCM.js.map
@@ -34936,29 +34936,53 @@ function createConsoleJsonGlobals(options) {
34936
34936
  };
34937
34937
  }
34938
34938
  async function stringifyJson(value, replacer, indent, budget, context) {
34939
- if (replacer !== void 0 && replacer !== null && !isSandboxClosure(replacer)) {
34940
- throw new TypeError(
34941
- "JSON.stringify(value, replacer, indent) only supports function, null, or undefined replacers."
34942
- );
34943
- }
34944
- if (indent !== void 0 && typeof indent !== "number" && typeof indent !== "string") {
34945
- throw new TypeError(
34946
- "JSON.stringify(value, replacer, indent) requires indent to be a string, number, or undefined."
34947
- );
34948
- }
34949
- const holder = {};
34950
- defineDataProperty2(holder, "", value);
34951
- const output = await stringifyProperty("", holder, {
34952
- budget,
34953
- context,
34954
- gap: normalizeStringifyGap(indent),
34955
- replacer: isSandboxClosure(replacer) ? replacer : void 0,
34956
- stack: []
34957
- });
34958
- if (output === void 0) {
34959
- return void 0;
34939
+ const allocation = {};
34940
+ let propertyList;
34941
+ const release = retainValues(budget, () => [value, replacer, indent]);
34942
+ try {
34943
+ if (Array.isArray(replacer)) {
34944
+ propertyList = [];
34945
+ const seen = /* @__PURE__ */ new Set();
34946
+ let size = 0;
34947
+ const state = { budget, context, gap: "", stack: [] };
34948
+ const length = replacer.length;
34949
+ for (let index = 0; index < length; index++) {
34950
+ budget.visitNode();
34951
+ const entry = await getStringifyProperty(replacer, String(index), state);
34952
+ const primitive = isSandboxBox(entry) ? boxedValue(entry) : entry;
34953
+ if (typeof primitive !== "string" && typeof primitive !== "number") continue;
34954
+ const key = await sandboxString(entry, budget, context);
34955
+ if (seen.has(key)) continue;
34956
+ budget.allocateArrayLength(propertyList.length + 1);
34957
+ size += key.length + 2;
34958
+ budget.setRetainedDataUsage(allocation, size);
34959
+ propertyList.push(key);
34960
+ seen.add(key);
34961
+ }
34962
+ }
34963
+ if (isSandboxBox(indent)) {
34964
+ const primitive = boxedValue(indent);
34965
+ if (typeof primitive === "number") indent = await sandboxNumber(indent, budget, context);
34966
+ else if (typeof primitive === "string") indent = await sandboxString(indent, budget, context);
34967
+ }
34968
+ const holder = {};
34969
+ defineDataProperty2(holder, "", value);
34970
+ const output = await stringifyProperty("", holder, {
34971
+ budget,
34972
+ context,
34973
+ gap: normalizeStringifyGap(indent),
34974
+ replacer: isSandboxClosure(replacer) ? replacer : void 0,
34975
+ propertyList,
34976
+ stack: []
34977
+ });
34978
+ if (output === void 0) {
34979
+ return void 0;
34980
+ }
34981
+ return budget.allocateString(output);
34982
+ } finally {
34983
+ budget.setRetainedDataUsage(allocation, 0);
34984
+ release();
34960
34985
  }
34961
- return budget.allocateString(output);
34962
34986
  }
34963
34987
  async function stringifyProperty(key, holder, state, indent = "") {
34964
34988
  let value = await getStringifyProperty(holder, key, state);
@@ -35048,7 +35072,7 @@ async function stringifyObject(value, state, indent) {
35048
35072
  const release = retainValues(state.budget, () => entries);
35049
35073
  try {
35050
35074
  const nextIndent = indent + state.gap;
35051
- for (const key of Object.keys(value)) {
35075
+ for (const key of state.propertyList ?? Object.keys(value)) {
35052
35076
  const serialized = await stringifyProperty(key, value, state, nextIndent);
35053
35077
  if (serialized !== void 0) {
35054
35078
  entries.push(`${quoteJsonString(key)}:${state.gap === "" ? "" : " "}${serialized}`);
@@ -37905,4 +37929,4 @@ export {
37905
37929
  FileSnapshotBackend,
37906
37930
  run
37907
37931
  };
37908
- //# sourceMappingURL=chunk-WGL3FZZM.js.map
37932
+ //# sourceMappingURL=chunk-UZYQWFMY.js.map