poe-code 14.0.53 → 14.0.54

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-VDFW3EKS.js";
30
+ } from "./chunk-L7PHF62H.js";
31
31
  import {
32
32
  createFileSystem,
33
33
  createNodeFileSystemAdapterRegistry,
@@ -8245,4 +8245,4 @@ export {
8245
8245
  parseMcpConfig,
8246
8246
  makeMcpModule
8247
8247
  };
8248
- //# sourceMappingURL=chunk-4XYGVCOQ.js.map
8248
+ //# sourceMappingURL=chunk-Z55VACOY.js.map
@@ -22,7 +22,7 @@ import {
22
22
  resolveFsConfig,
23
23
  splitFrontmatter,
24
24
  withBrokenPipeGuard
25
- } from "./chunks/chunk-4XYGVCOQ.js";
25
+ } from "./chunks/chunk-Z55VACOY.js";
26
26
  import {
27
27
  Budget,
28
28
  SandboxError,
@@ -34,7 +34,7 @@ import {
34
34
  replaceErrorStack,
35
35
  restore,
36
36
  run
37
- } from "./chunks/chunk-VDFW3EKS.js";
37
+ } from "./chunks/chunk-L7PHF62H.js";
38
38
  import "./chunks/chunk-UXMKEUH3.js";
39
39
  import "./chunks/chunk-5DYEOCT5.js";
40
40
  import "./chunks/chunk-4YIDX44G.js";
@@ -5,7 +5,7 @@ import {
5
5
  defineExtension,
6
6
  lint,
7
7
  run
8
- } from "./chunks/chunk-VDFW3EKS.js";
8
+ } from "./chunks/chunk-L7PHF62H.js";
9
9
  import "./chunks/chunk-4YIDX44G.js";
10
10
  export {
11
11
  Budget,
@@ -26,7 +26,7 @@ import {
26
26
  runWithSpawnUsageAccumulator,
27
27
  splitFrontmatter,
28
28
  supportsSpawnMode
29
- } from "./chunks/chunk-4XYGVCOQ.js";
29
+ } from "./chunks/chunk-Z55VACOY.js";
30
30
  import {
31
31
  Budget,
32
32
  FileSnapshotBackend,
@@ -50,7 +50,7 @@ import {
50
50
  registerPendingHostCallPolicy,
51
51
  restore,
52
52
  run
53
- } from "./chunks/chunk-VDFW3EKS.js";
53
+ } from "./chunks/chunk-L7PHF62H.js";
54
54
  import "./chunks/chunk-UXMKEUH3.js";
55
55
  import "./chunks/chunk-5DYEOCT5.js";
56
56
  import "./chunks/chunk-4YIDX44G.js";
@@ -1,4 +1,6 @@
1
+ import { invokeBuiltinClosure } from "../builtin-call.js";
1
2
  import { CompileScope } from "../regex/compile-guard.js";
3
+ import { sandboxString } from "../string-coercion.js";
2
4
  import { createSandboxClosure, createSandboxRegex, deepCopyFromSandbox, isSandboxClosure, isSandboxRegex } from "../values.js";
3
5
  import { executeRegex, toMatchArray } from "./regex.js";
4
6
  const SPLIT_STRING_MESSAGE = "String#split only supports string separator values.";
@@ -51,9 +53,21 @@ export function getStringMember(value, property, budget) {
51
53
  name: `String#${property}`,
52
54
  ...(property === "localeCompare" ? { length: 1 } : {}),
53
55
  ...(property === "isWellFormed" || property === "toWellFormed" ? { length: 0 } : {}),
54
- call: (args, context) => callStringMethod(value, property, args, budget, context === undefined
55
- ? undefined
56
- : async (closure, closureArgs) => await closure.call(closureArgs, { ...context, thisValue: undefined }), context?.compilation)
56
+ call: async (args, context) => {
57
+ const receiver = context?.thisValue;
58
+ if (receiver === null || receiver === undefined) {
59
+ throw new TypeError(`String#${property} requires a non-null receiver.`);
60
+ }
61
+ const retainedReceiver = {};
62
+ budget.setRetainedValues(retainedReceiver, () => [receiver]);
63
+ try {
64
+ const string = await sandboxString(receiver, budget, context);
65
+ return await callStringMethod(string, property, args, budget, (closure, closureArgs) => invokeBuiltinClosure(closure, closureArgs, budget, context, undefined), context?.compilation);
66
+ }
67
+ finally {
68
+ budget.setRetainedValues(retainedReceiver, undefined);
69
+ }
70
+ }
57
71
  });
58
72
  }
59
73
  function getStringIndex(property) {