@poe-platform/safe-js 0.1.121 → 0.1.123

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-7HK37H74.js";
30
+ } from "./chunk-N3CN2ACZ.js";
31
31
 
32
32
  // packages/safe-js/src/migrate.ts
33
33
  import { createHash } from "node:crypto";
@@ -8245,4 +8245,4 @@ export {
8245
8245
  parseMcpConfig,
8246
8246
  makeMcpModule
8247
8247
  };
8248
- //# sourceMappingURL=chunk-NU2O5IK6.js.map
8248
+ //# sourceMappingURL=chunk-3JECZNKB.js.map
@@ -8513,6 +8513,16 @@ function isLineTerminator(character) {
8513
8513
 
8514
8514
  // packages/safe-js/src/interp/methods/regex.ts
8515
8515
  var regexMethodNames = /* @__PURE__ */ new Set(["exec", "test"]);
8516
+ var regexFlagProperties = {
8517
+ hasIndices: "d",
8518
+ global: "g",
8519
+ ignoreCase: "i",
8520
+ multiline: "m",
8521
+ dotAll: "s",
8522
+ unicode: "u",
8523
+ unicodeSets: "v",
8524
+ sticky: "y"
8525
+ };
8516
8526
  function isRegexMethodName(property) {
8517
8527
  return typeof property === "string" && regexMethodNames.has(property);
8518
8528
  }
@@ -8523,6 +8533,7 @@ function getRegexMember(target, property, budget) {
8523
8533
  return budget === void 0 ? flags : budget.allocateString(flags);
8524
8534
  }
8525
8535
  if (property === "lastIndex") return target.lastIndex;
8536
+ if (Object.hasOwn(regexFlagProperties, property)) return target.flags.includes(regexFlagProperties[property]);
8526
8537
  if (!isRegexMethodName(property)) {
8527
8538
  return void 0;
8528
8539
  }
@@ -8565,7 +8576,8 @@ async function callRegexMethod(target, methodName, args, budget, context) {
8565
8576
  }
8566
8577
  const retained = {};
8567
8578
  let cursor;
8568
- budget.setRetainedValues(retained, () => [target, ...args, cursor]);
8579
+ let convertedInput;
8580
+ budget.setRetainedValues(retained, () => [target, ...args, cursor, convertedInput]);
8569
8581
  try {
8570
8582
  const input = await sandboxString(args[0], budget, context);
8571
8583
  if (methodName === "test") {
@@ -8579,6 +8591,7 @@ async function callRegexMethod(target, methodName, args, budget, context) {
8579
8591
  }
8580
8592
  }
8581
8593
  if (!isSandboxRegex(target)) throw new TypeError("RegExp execution requires a regex receiver.");
8594
+ if (typeof args[0] !== "string") convertedInput = input;
8582
8595
  cursor = target.lastIndex;
8583
8596
  const lastIndex = await sandboxNumber(cursor, budget, context);
8584
8597
  const match = executeRegex(target, input, lastIndex);
@@ -25208,7 +25221,7 @@ async function replaceRegex(value, regex, replacement, replaceAll, budget, callC
25208
25221
  if (regex.flags.includes("g")) regex.lastIndex = 0;
25209
25222
  const cursor = regex.lastIndex;
25210
25223
  const retained = {};
25211
- budget.setRetainedValues(retained, () => [regex, cursor, replacement]);
25224
+ budget.setRetainedValues(retained, () => [value, regex, cursor, replacement]);
25212
25225
  try {
25213
25226
  const lastIndex = await sandboxNumber(cursor, budget, context);
25214
25227
  const matches = collectRegexMatches(regex, value, replaceAll || regex.flags.includes("g"), void 0, lastIndex);
@@ -25341,7 +25354,7 @@ async function callStringPattern(value, methodName, pattern, budget, parent, con
25341
25354
  const operation = budget.acquireCompileOwner(false, parent?.owner);
25342
25355
  const compilation = new CompileScope(operation.owner);
25343
25356
  const retainedPattern = {};
25344
- budget.setRetainedValues(retainedPattern, () => [pattern]);
25357
+ budget.setRetainedValues(retainedPattern, () => [value, pattern]);
25345
25358
  try {
25346
25359
  const source = pattern === void 0 ? "" : await sandboxString(pattern, budget, context);
25347
25360
  const regex = createSandboxRegex(source, methodName === "matchAll" ? "g" : "", 0, compilation);
@@ -25357,7 +25370,7 @@ async function callStringRegexCursor(value, methodName, regex, budget, parent, c
25357
25370
  const compilation = new CompileScope(operation.owner);
25358
25371
  const cursor = regex.lastIndex;
25359
25372
  const retained = {};
25360
- budget.setRetainedValues(retained, () => [regex, cursor]);
25373
+ budget.setRetainedValues(retained, () => [value, regex, cursor]);
25361
25374
  try {
25362
25375
  const lastIndex = await sandboxNumber(cursor, budget, context);
25363
25376
  return callMatchLikeMethod(value, methodName, [regex], compilation, lastIndex);
@@ -33407,4 +33420,4 @@ export {
33407
33420
  FileSnapshotBackend,
33408
33421
  run
33409
33422
  };
33410
- //# sourceMappingURL=chunk-7HK37H74.js.map
33423
+ //# sourceMappingURL=chunk-N3CN2ACZ.js.map