@poe-platform/safe-js 0.1.474 → 0.1.475

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.
@@ -31817,6 +31817,45 @@ function createRegexGlobals(options) {
31817
31817
  configurable: true
31818
31818
  });
31819
31819
  const prototype = createIntrinsicObject();
31820
+ Object.defineProperty(prototype, "compile", {
31821
+ value: createSandboxClosure({
31822
+ guest: true,
31823
+ sandbox: true,
31824
+ name: "compile",
31825
+ length: 2,
31826
+ call: async ([pattern, flags], context) => {
31827
+ const receiver = context?.thisValue;
31828
+ if (!isSandboxRegex(receiver)) throw new TypeError("RegExp.compile requires a regex receiver.");
31829
+ if (isSandboxRegex(pattern) && flags !== void 0) throw new TypeError("Cannot supply flags with a RegExp pattern.");
31830
+ const selected = options.compileOwner ?? context?.compilation?.owner;
31831
+ if (context?.compilation?.owner !== void 0 && selected !== context.compilation.owner) throw new SandboxError("reentry");
31832
+ const operation = options.budget.acquireCompileOwner(false, selected);
31833
+ const compilation = context?.compilation?.owner === operation.owner ? context.compilation : new CompileScope(operation.owner);
31834
+ let source = "";
31835
+ const release = retainValues(options.budget, () => [receiver, pattern, flags, source]);
31836
+ try {
31837
+ if (isSandboxRegex(pattern)) {
31838
+ flags = pattern.flags;
31839
+ pattern = pattern.source;
31840
+ }
31841
+ source = pattern === void 0 ? "" : await sandboxString(pattern, options.budget, context);
31842
+ const flagText = flags === void 0 ? "" : await sandboxString(flags, options.budget, context);
31843
+ recompileSandboxRegex(receiver, source, flagText, compilation);
31844
+ return receiver;
31845
+ } finally {
31846
+ release();
31847
+ try {
31848
+ if (compilation !== context?.compilation) reconcileCompiledValues(options.budget, [receiver], compilation);
31849
+ } finally {
31850
+ if (compilation !== context?.compilation) compilation.dispose();
31851
+ operation.release();
31852
+ }
31853
+ }
31854
+ }
31855
+ }),
31856
+ writable: true,
31857
+ configurable: true
31858
+ });
31820
31859
  Object.defineProperty(materializeFunctionProperties(constructor), Symbol.species, {
31821
31860
  get: accessorAdapter(createSandboxClosure({
31822
31861
  sandbox: true,
@@ -38831,13 +38870,22 @@ function createSandboxRegex(source, flags = "", lastIndex = 0, compilation) {
38831
38870
  regexGuestProperties.set(regex, properties);
38832
38871
  Object.defineProperties(regex, {
38833
38872
  [sandboxRegexBrand]: { value: true },
38834
- [sandboxRegexPattern]: { value: pattern }
38873
+ [sandboxRegexPattern]: { value: pattern, writable: true }
38835
38874
  });
38836
38875
  return Object.seal(regex);
38837
38876
  }
38838
38877
  function getSandboxRegexPattern(regex) {
38839
38878
  return regex[sandboxRegexPattern];
38840
38879
  }
38880
+ function recompileSandboxRegex(regex, source, flags, compilation) {
38881
+ const pattern = parseRegex(source, flags, compilation, 7 + source.length + flags.length);
38882
+ Object.defineProperties(regex, {
38883
+ source: { value: source },
38884
+ flags: { value: flags },
38885
+ [sandboxRegexPattern]: { value: pattern }
38886
+ });
38887
+ regex.lastIndex = 0;
38888
+ }
38841
38889
  function isSandboxClosure(value) {
38842
38890
  return typeof value === "object" && value !== null && sandboxClosureBrand in value;
38843
38891
  }
@@ -57143,4 +57191,4 @@ authorization of the copyright holder.
57143
57191
  SPDX-License-Identifier: Unicode-3.0
57144
57192
 
57145
57193
  */
57146
- //# sourceMappingURL=chunk-CGSXGKIZ.js.map
57194
+ //# sourceMappingURL=chunk-PAFO5N4X.js.map