@poe-platform/safe-js 0.1.180 → 0.1.181

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-V2ZFZP6Y.js";
30
+ } from "./chunk-IJRSYEH5.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-TCWUH7BD.js.map
8252
+ //# sourceMappingURL=chunk-27CDLBE5.js.map
@@ -10658,6 +10658,8 @@ function callStringMethodBody(value, methodName, args, budget, parent, context)
10658
10658
  return budget.allocateString(result + value.slice(spanStart));
10659
10659
  }
10660
10660
  const regex = args[0];
10661
+ if (methodName === "search" && isSandboxRegex(regex) && getSandboxPropertyDescriptor(regex, "exec", budget) !== void 0)
10662
+ return callCustomRegexSearch(value, regex, budget, context);
10661
10663
  if (methodName === "match" && isSandboxRegex(regex) && getSandboxPropertyDescriptor(regex, "exec", budget) !== void 0)
10662
10664
  return callCustomRegexMatch(value, regex, budget, context);
10663
10665
  if (isSandboxRegex(regex) && (methodName === "matchAll" || methodName === "match" && !regex.flags.includes("g") && regex.lastIndex !== null && typeof regex.lastIndex === "object")) {
@@ -11007,6 +11009,22 @@ async function callStringPattern(value, methodName, pattern, budget, parent, con
11007
11009
  operation.release();
11008
11010
  }
11009
11011
  }
11012
+ async function callCustomRegexSearch(value, regex, budget, context) {
11013
+ const previousIndex = regex.lastIndex;
11014
+ let result;
11015
+ const release = retainValues(budget, () => [value, regex, previousIndex, result]);
11016
+ try {
11017
+ if (!Object.is(previousIndex, 0)) regex.lastIndex = 0;
11018
+ result = await regexExec(regex, value, budget, context);
11019
+ if (!Object.is(regex.lastIndex, previousIndex)) regex.lastIndex = previousIndex;
11020
+ if (result === null) return -1;
11021
+ if (context?.getProperty !== void 0) return await context.getProperty(result, "index");
11022
+ const descriptor = getSandboxPropertyDescriptor(result, "index", budget);
11023
+ return descriptor === void 0 ? void 0 : await readPropertyDescriptor(descriptor, result, context);
11024
+ } finally {
11025
+ release();
11026
+ }
11027
+ }
11010
11028
  async function callCustomRegexMatch(value, regex, budget, context) {
11011
11029
  const matches = [];
11012
11030
  let result;
@@ -36549,4 +36567,4 @@ export {
36549
36567
  FileSnapshotBackend,
36550
36568
  run
36551
36569
  };
36552
- //# sourceMappingURL=chunk-V2ZFZP6Y.js.map
36570
+ //# sourceMappingURL=chunk-IJRSYEH5.js.map