@poe-platform/safe-js 0.1.184 → 0.1.185

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-Q64VTJKF.js";
30
+ } from "./chunk-ZOPU6AKV.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-4XA4KLMD.js.map
8252
+ //# sourceMappingURL=chunk-BWM5IA32.js.map
@@ -34345,16 +34345,38 @@ function createRegexGlobals(options) {
34345
34345
  const operation = options.budget.acquireCompileOwner(false, selected);
34346
34346
  const compilation = context?.compilation?.owner === operation.owner ? context.compilation : new CompileScope(operation.owner);
34347
34347
  let source = "";
34348
+ let retainedSource;
34349
+ let retainedFlags;
34348
34350
  const retained = {};
34349
- options.budget.setRetainedValues(retained, () => [...args, source]);
34351
+ options.budget.setRetainedValues(retained, () => [...args, source, retainedSource, retainedFlags]);
34350
34352
  try {
34351
34353
  const pattern = args[0];
34352
34354
  const flags = args[1];
34353
- if (!construct && isSandboxRegex(pattern) && flags === void 0) return pattern;
34354
- const sourceValue = isSandboxRegex(pattern) ? pattern.source : pattern;
34355
- const flagsValue = isSandboxRegex(pattern) && flags === void 0 ? pattern.flags : flags;
34355
+ const read = (key) => {
34356
+ const descriptor = getSandboxPropertyDescriptor(pattern, key, options.budget);
34357
+ if (key === "constructor" && descriptor === void 0 && isSandboxRegex(pattern)) return constructor;
34358
+ if (context?.getProperty !== void 0) return context.getProperty(pattern, key);
34359
+ return descriptor === void 0 ? void 0 : readPropertyDescriptor(descriptor, pattern, context);
34360
+ };
34361
+ let regexLike = false;
34362
+ if (pattern !== null && typeof pattern === "object") {
34363
+ const match = await read(Symbol.match);
34364
+ regexLike = match === void 0 ? isSandboxRegex(pattern) : Boolean(match);
34365
+ }
34366
+ if (!construct && regexLike && flags === void 0 && await read("constructor") === constructor) return pattern;
34367
+ let sourceValue = pattern;
34368
+ let flagsValue = flags;
34369
+ if (isSandboxRegex(pattern)) {
34370
+ sourceValue = pattern.source;
34371
+ if (flags === void 0) flagsValue = pattern.flags;
34372
+ } else if (regexLike) {
34373
+ sourceValue = retainedSource = await read("source");
34374
+ if (flags === void 0) flagsValue = retainedFlags = await read("flags");
34375
+ }
34356
34376
  source = sourceValue === void 0 ? "" : await sandboxString(sourceValue, options.budget, context);
34377
+ retainedSource = void 0;
34357
34378
  const flagText = flagsValue === void 0 ? "" : await sandboxString(flagsValue, options.budget, context);
34379
+ retainedFlags = void 0;
34358
34380
  const regex = createSandboxRegex(
34359
34381
  source,
34360
34382
  flagText,
@@ -34371,9 +34393,8 @@ function createRegexGlobals(options) {
34371
34393
  operation.release();
34372
34394
  }
34373
34395
  };
34374
- return {
34375
- RegExp: createSandboxClosure({ sandbox: true, name: "RegExp", call: invoke(false), construct: invoke(true) })
34376
- };
34396
+ const constructor = createSandboxClosure({ sandbox: true, name: "RegExp", call: invoke(false), construct: invoke(true) });
34397
+ return { RegExp: constructor };
34377
34398
  }
34378
34399
 
34379
34400
  // packages/safe-js/src/interp/globals/misc.ts
@@ -36686,4 +36707,4 @@ export {
36686
36707
  FileSnapshotBackend,
36687
36708
  run
36688
36709
  };
36689
- //# sourceMappingURL=chunk-Q64VTJKF.js.map
36710
+ //# sourceMappingURL=chunk-ZOPU6AKV.js.map