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
package/dist/index.js
CHANGED
|
@@ -124931,11 +124931,13 @@ var init_known_globals = __esm({
|
|
|
124931
124931
|
"Array",
|
|
124932
124932
|
"Boolean",
|
|
124933
124933
|
"Error",
|
|
124934
|
+
"Infinity",
|
|
124934
124935
|
"isFinite",
|
|
124935
124936
|
"isNaN",
|
|
124936
124937
|
"JSON",
|
|
124937
124938
|
"Map",
|
|
124938
124939
|
"Math",
|
|
124940
|
+
"NaN",
|
|
124939
124941
|
"Number",
|
|
124940
124942
|
"Object",
|
|
124941
124943
|
"parseFloat",
|
|
@@ -144251,7 +144253,7 @@ async function replaceRegex(value, regex, replacement, replaceAll2, budget, call
|
|
|
144251
144253
|
let copiedThrough = 0;
|
|
144252
144254
|
for (const match of matches) {
|
|
144253
144255
|
result += value.slice(copiedThrough, match.index);
|
|
144254
|
-
result += typeof replacement === "string" ? expandReplacement(replacement, match.text, match.captures) : String(
|
|
144256
|
+
result += typeof replacement === "string" ? expandReplacement(replacement, match.text, match.captures, value, match.index) : String(
|
|
144255
144257
|
await callClosure(replacement, [match.text, ...match.captures, match.index, value])
|
|
144256
144258
|
);
|
|
144257
144259
|
copiedThrough = match.index + match.text.length;
|
|
@@ -144259,12 +144261,45 @@ async function replaceRegex(value, regex, replacement, replaceAll2, budget, call
|
|
|
144259
144261
|
result += value.slice(copiedThrough);
|
|
144260
144262
|
return budget.allocateString(result);
|
|
144261
144263
|
}
|
|
144262
|
-
function expandReplacement(replacement, match, captures) {
|
|
144263
|
-
|
|
144264
|
-
|
|
144265
|
-
|
|
144266
|
-
|
|
144267
|
-
|
|
144264
|
+
function expandReplacement(replacement, match, captures, input, matchIndex) {
|
|
144265
|
+
let result = "";
|
|
144266
|
+
for (let index = 0; index < replacement.length; index += 1) {
|
|
144267
|
+
const character2 = replacement.charAt(index);
|
|
144268
|
+
if (character2 !== "$") {
|
|
144269
|
+
result += character2;
|
|
144270
|
+
continue;
|
|
144271
|
+
}
|
|
144272
|
+
const token = replacement.charAt(index + 1);
|
|
144273
|
+
if (token === "$") {
|
|
144274
|
+
result += "$";
|
|
144275
|
+
} else if (token === "&") {
|
|
144276
|
+
result += match;
|
|
144277
|
+
} else if (token === "`") {
|
|
144278
|
+
result += input.slice(0, matchIndex);
|
|
144279
|
+
} else if (token === "'") {
|
|
144280
|
+
result += input.slice(matchIndex + match.length);
|
|
144281
|
+
} else if (token >= "0" && token <= "9") {
|
|
144282
|
+
let captureIndex = Number(token);
|
|
144283
|
+
const nextDigit = replacement.charAt(index + 2);
|
|
144284
|
+
if (nextDigit >= "0" && nextDigit <= "9") {
|
|
144285
|
+
const twoDigitIndex = Number(token + nextDigit);
|
|
144286
|
+
if (twoDigitIndex > 0 && twoDigitIndex <= captures.length) {
|
|
144287
|
+
captureIndex = twoDigitIndex;
|
|
144288
|
+
index += 1;
|
|
144289
|
+
}
|
|
144290
|
+
}
|
|
144291
|
+
if (captureIndex === 0 || captureIndex > captures.length) {
|
|
144292
|
+
result += "$";
|
|
144293
|
+
continue;
|
|
144294
|
+
}
|
|
144295
|
+
result += captures[captureIndex - 1] ?? "";
|
|
144296
|
+
} else {
|
|
144297
|
+
result += "$";
|
|
144298
|
+
continue;
|
|
144299
|
+
}
|
|
144300
|
+
index += 1;
|
|
144301
|
+
}
|
|
144302
|
+
return result;
|
|
144268
144303
|
}
|
|
144269
144304
|
async function replaceWithClosure(value, searchValue, replacer, replaceAll2, budget, callClosure) {
|
|
144270
144305
|
const offsets = findReplacementOffsets(value, searchValue, replaceAll2);
|
|
@@ -155457,7 +155492,7 @@ var init_package2 = __esm({
|
|
|
155457
155492
|
"package.json"() {
|
|
155458
155493
|
package_default2 = {
|
|
155459
155494
|
name: "poe-code",
|
|
155460
|
-
version: "11.0.
|
|
155495
|
+
version: "11.0.4",
|
|
155461
155496
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
155462
155497
|
license: "MIT",
|
|
155463
155498
|
type: "module",
|