@poe-platform/safe-js 0.1.131 → 0.1.133

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-DZRTLKIV.js";
30
+ } from "./chunk-VKGWGZBH.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-RA54CNI6.js.map
8252
+ //# sourceMappingURL=chunk-V5FU2Y3Z.js.map
@@ -30926,6 +30926,46 @@ function createRegexGlobals(options) {
30926
30926
  };
30927
30927
  }
30928
30928
 
30929
+ // packages/safe-js/src/interp/globals/numeric-parsers.ts
30930
+ function createNumericParsers(budget) {
30931
+ return {
30932
+ parseInt: createSandboxClosure({
30933
+ sandbox: true,
30934
+ name: "parseInt",
30935
+ call: ([value, radix], context) => {
30936
+ const parse2 = (text2) => {
30937
+ const release = retainValues(budget, () => [text2]);
30938
+ let convertedRadix;
30939
+ try {
30940
+ convertedRadix = sandboxNumber(radix, budget, context);
30941
+ } catch (error) {
30942
+ release();
30943
+ throw error;
30944
+ }
30945
+ if (typeof convertedRadix === "number") {
30946
+ try {
30947
+ return globalThis.parseInt(text2, convertedRadix);
30948
+ } finally {
30949
+ release();
30950
+ }
30951
+ }
30952
+ return convertedRadix.then((number) => globalThis.parseInt(text2, number)).finally(release);
30953
+ };
30954
+ const text = sandboxString(value, budget, context);
30955
+ return typeof text === "string" ? parse2(text) : text.then(parse2);
30956
+ }
30957
+ }),
30958
+ parseFloat: createSandboxClosure({
30959
+ sandbox: true,
30960
+ name: "parseFloat",
30961
+ call: ([value], context) => {
30962
+ const text = sandboxString(value, budget, context);
30963
+ return typeof text === "string" ? globalThis.parseFloat(text) : text.then(globalThis.parseFloat);
30964
+ }
30965
+ })
30966
+ };
30967
+ }
30968
+
30929
30969
  // packages/safe-js/src/interp/globals/misc.ts
30930
30970
  function createMiscGlobals(options) {
30931
30971
  return {
@@ -30934,24 +30974,21 @@ function createMiscGlobals(options) {
30934
30974
  call: ([value], context) => structuredCloneSandboxValue(value, options.budget, context?.compilation),
30935
30975
  name: "structuredClone"
30936
30976
  }),
30937
- parseInt: createSandboxClosure({
30938
- sandbox: true,
30939
- call: (args) => Reflect.apply(globalThis.parseInt, globalThis, [...args]),
30940
- name: "parseInt"
30941
- }),
30942
- parseFloat: createSandboxClosure({
30943
- sandbox: true,
30944
- call: (args) => Reflect.apply(globalThis.parseFloat, globalThis, [...args]),
30945
- name: "parseFloat"
30946
- }),
30977
+ ...createNumericParsers(options.budget),
30947
30978
  isNaN: createSandboxClosure({
30948
30979
  sandbox: true,
30949
- call: ([value]) => globalThis.isNaN(value),
30980
+ call: ([value], context) => {
30981
+ const number = sandboxNumber(value, options.budget, context);
30982
+ return typeof number === "number" ? Number.isNaN(number) : number.then(Number.isNaN);
30983
+ },
30950
30984
  name: "isNaN"
30951
30985
  }),
30952
30986
  isFinite: createSandboxClosure({
30953
30987
  sandbox: true,
30954
- call: ([value]) => globalThis.isFinite(value),
30988
+ call: ([value], context) => {
30989
+ const number = sandboxNumber(value, options.budget, context);
30990
+ return typeof number === "number" ? Number.isFinite(number) : number.then(Number.isFinite);
30991
+ },
30955
30992
  name: "isFinite"
30956
30993
  })
30957
30994
  };
@@ -31205,16 +31242,7 @@ function createObjectArrayGlobals(options) {
31205
31242
  call: ([value]) => typeof value === "number" && Number.isInteger(value),
31206
31243
  name: "isInteger"
31207
31244
  }),
31208
- parseInt: createSandboxClosure({
31209
- sandbox: true,
31210
- call: (args) => Reflect.apply(Number.parseInt, Number, [...args]),
31211
- name: "parseInt"
31212
- }),
31213
- parseFloat: createSandboxClosure({
31214
- sandbox: true,
31215
- call: (args) => Reflect.apply(Number.parseFloat, Number, [...args]),
31216
- name: "parseFloat"
31217
- }),
31245
+ ...createNumericParsers(options.budget),
31218
31246
  isSafeInteger: createSandboxClosure({
31219
31247
  sandbox: true,
31220
31248
  call: ([value]) => typeof value === "number" && Number.isSafeInteger(value),
@@ -33587,4 +33615,4 @@ export {
33587
33615
  FileSnapshotBackend,
33588
33616
  run
33589
33617
  };
33590
- //# sourceMappingURL=chunk-DZRTLKIV.js.map
33618
+ //# sourceMappingURL=chunk-VKGWGZBH.js.map