poe-code 11.0.2 → 11.0.4
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.
- package/dist/index.js +43 -8
- package/dist/index.js.map +3 -3
- package/dist/metafile.json +1 -1
- package/package.json +1 -1
- package/packages/safejs/dist/chunks/{chunk-XU36QFFX.js → chunk-CA342J7E.js} +43 -8
- package/packages/safejs/dist/chunks/chunk-CA342J7E.js.map +7 -0
- package/packages/safejs/dist/chunks/{chunk-JUF273GA.js → chunk-NBVIHENC.js} +2 -2
- package/packages/safejs/dist/cli.js +2 -2
- package/packages/safejs/dist/core.js +1 -1
- package/packages/safejs/dist/index.js +2 -2
- package/packages/safejs/dist/interp/methods/string.js +45 -9
- package/packages/safejs/dist/lint/rules/known-globals.d.ts +1 -1
- package/packages/safejs/dist/lint/rules/known-globals.js +2 -0
- package/packages/safejs/dist/chunks/chunk-XU36QFFX.js.map +0 -7
- /package/packages/safejs/dist/chunks/{chunk-JUF273GA.js.map → chunk-NBVIHENC.js.map} +0 -0
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
validateMigrationSemantics,
|
|
28
28
|
validateSnapshotData,
|
|
29
29
|
validateSnapshotMigration
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-CA342J7E.js";
|
|
31
31
|
|
|
32
32
|
// packages/safejs/src/migrate.ts
|
|
33
33
|
import { createHash } from "node:crypto";
|
|
@@ -8048,4 +8048,4 @@ export {
|
|
|
8048
8048
|
parseMcpConfig,
|
|
8049
8049
|
makeMcpModule
|
|
8050
8050
|
};
|
|
8051
|
-
//# sourceMappingURL=chunk-
|
|
8051
|
+
//# sourceMappingURL=chunk-NBVIHENC.js.map
|
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
parseMcpConfig,
|
|
20
20
|
splitFrontmatter,
|
|
21
21
|
withBrokenPipeGuard
|
|
22
|
-
} from "./chunks/chunk-
|
|
22
|
+
} from "./chunks/chunk-NBVIHENC.js";
|
|
23
23
|
import {
|
|
24
24
|
Budget,
|
|
25
25
|
SandboxError,
|
|
@@ -31,7 +31,7 @@ import {
|
|
|
31
31
|
replaceErrorStack,
|
|
32
32
|
restore,
|
|
33
33
|
run
|
|
34
|
-
} from "./chunks/chunk-
|
|
34
|
+
} from "./chunks/chunk-CA342J7E.js";
|
|
35
35
|
import "./chunks/chunk-4YIDX44G.js";
|
|
36
36
|
|
|
37
37
|
// packages/safejs/src/cli.ts
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
runWithSpawnUsageAccumulator,
|
|
27
27
|
splitFrontmatter,
|
|
28
28
|
supportsSpawnMode
|
|
29
|
-
} from "./chunks/chunk-
|
|
29
|
+
} from "./chunks/chunk-NBVIHENC.js";
|
|
30
30
|
import {
|
|
31
31
|
Budget,
|
|
32
32
|
FileSnapshotBackend,
|
|
@@ -48,7 +48,7 @@ import {
|
|
|
48
48
|
registerPendingHostCallPolicy,
|
|
49
49
|
restore,
|
|
50
50
|
run
|
|
51
|
-
} from "./chunks/chunk-
|
|
51
|
+
} from "./chunks/chunk-CA342J7E.js";
|
|
52
52
|
import "./chunks/chunk-4YIDX44G.js";
|
|
53
53
|
|
|
54
54
|
// packages/safejs/src/runner/run-harness.ts
|
|
@@ -150,21 +150,57 @@ async function replaceRegex(value, regex, replacement, replaceAll, budget, callC
|
|
|
150
150
|
result += value.slice(copiedThrough, match.index);
|
|
151
151
|
result +=
|
|
152
152
|
typeof replacement === "string"
|
|
153
|
-
? expandReplacement(replacement, match.text, match.captures)
|
|
153
|
+
? expandReplacement(replacement, match.text, match.captures, value, match.index)
|
|
154
154
|
: String(await callClosure(replacement, [match.text, ...match.captures, match.index, value]));
|
|
155
155
|
copiedThrough = match.index + match.text.length;
|
|
156
156
|
}
|
|
157
157
|
result += value.slice(copiedThrough);
|
|
158
158
|
return budget.allocateString(result);
|
|
159
159
|
}
|
|
160
|
-
function expandReplacement(replacement, match, captures) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
if (
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
160
|
+
function expandReplacement(replacement, match, captures, input, matchIndex) {
|
|
161
|
+
let result = "";
|
|
162
|
+
for (let index = 0; index < replacement.length; index += 1) {
|
|
163
|
+
const character = replacement.charAt(index);
|
|
164
|
+
if (character !== "$") {
|
|
165
|
+
result += character;
|
|
166
|
+
continue;
|
|
167
|
+
}
|
|
168
|
+
const token = replacement.charAt(index + 1);
|
|
169
|
+
if (token === "$") {
|
|
170
|
+
result += "$";
|
|
171
|
+
}
|
|
172
|
+
else if (token === "&") {
|
|
173
|
+
result += match;
|
|
174
|
+
}
|
|
175
|
+
else if (token === "`") {
|
|
176
|
+
result += input.slice(0, matchIndex);
|
|
177
|
+
}
|
|
178
|
+
else if (token === "'") {
|
|
179
|
+
result += input.slice(matchIndex + match.length);
|
|
180
|
+
}
|
|
181
|
+
else if (token >= "0" && token <= "9") {
|
|
182
|
+
let captureIndex = Number(token);
|
|
183
|
+
const nextDigit = replacement.charAt(index + 2);
|
|
184
|
+
if (nextDigit >= "0" && nextDigit <= "9") {
|
|
185
|
+
const twoDigitIndex = Number(token + nextDigit);
|
|
186
|
+
if (twoDigitIndex > 0 && twoDigitIndex <= captures.length) {
|
|
187
|
+
captureIndex = twoDigitIndex;
|
|
188
|
+
index += 1;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
if (captureIndex === 0 || captureIndex > captures.length) {
|
|
192
|
+
result += "$";
|
|
193
|
+
continue;
|
|
194
|
+
}
|
|
195
|
+
result += captures[captureIndex - 1] ?? "";
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
result += "$";
|
|
199
|
+
continue;
|
|
200
|
+
}
|
|
201
|
+
index += 1;
|
|
202
|
+
}
|
|
203
|
+
return result;
|
|
168
204
|
}
|
|
169
205
|
async function replaceWithClosure(value, searchValue, replacer, replaceAll, budget, callClosure) {
|
|
170
206
|
const offsets = findReplacementOffsets(value, searchValue, replaceAll);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const KNOWN_RUNTIME_GLOBALS: readonly ["AggregateError", "Array", "Boolean", "Error", "isFinite", "isNaN", "JSON", "Map", "Math", "Number", "Object", "parseFloat", "parseInt", "Promise", "RangeError", "ReferenceError", "RegExp", "Set", "String", "structuredClone", "SyntaxError", "TypeError", "console"];
|
|
1
|
+
export declare const KNOWN_RUNTIME_GLOBALS: readonly ["AggregateError", "Array", "Boolean", "Error", "Infinity", "isFinite", "isNaN", "JSON", "Map", "Math", "NaN", "Number", "Object", "parseFloat", "parseInt", "Promise", "RangeError", "ReferenceError", "RegExp", "Set", "String", "structuredClone", "SyntaxError", "TypeError", "console"];
|