@poe-platform/safe-js 0.1.131 → 0.1.132

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.
@@ -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,16 +30974,7 @@ 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
30980
  call: ([value]) => globalThis.isNaN(value),
@@ -31205,16 +31236,7 @@ function createObjectArrayGlobals(options) {
31205
31236
  call: ([value]) => typeof value === "number" && Number.isInteger(value),
31206
31237
  name: "isInteger"
31207
31238
  }),
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
- }),
31239
+ ...createNumericParsers(options.budget),
31218
31240
  isSafeInteger: createSandboxClosure({
31219
31241
  sandbox: true,
31220
31242
  call: ([value]) => typeof value === "number" && Number.isSafeInteger(value),
@@ -33587,4 +33609,4 @@ export {
33587
33609
  FileSnapshotBackend,
33588
33610
  run
33589
33611
  };
33590
- //# sourceMappingURL=chunk-DZRTLKIV.js.map
33612
+ //# sourceMappingURL=chunk-7IGOMKO4.js.map