poe-code 11.0.12 → 11.0.13
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 +13 -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-WV23C6SS.js → chunk-EV4BL6HH.js} +2 -2
- package/packages/safejs/dist/chunks/{chunk-5BWI6HAZ.js → chunk-GTX2EXKD.js} +13 -7
- package/packages/safejs/dist/chunks/{chunk-5BWI6HAZ.js.map → chunk-GTX2EXKD.js.map} +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 +15 -8
- /package/packages/safejs/dist/chunks/{chunk-WV23C6SS.js.map → chunk-EV4BL6HH.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -144325,6 +144325,7 @@ function callReplaceLikeMethod(value, methodName, args, budget, callClosure) {
|
|
|
144325
144325
|
);
|
|
144326
144326
|
}
|
|
144327
144327
|
async function replaceRegex(value, regex, replacement, replaceAll2, budget, callClosure) {
|
|
144328
|
+
if (regex.flags.includes("g")) regex.lastIndex = 0;
|
|
144328
144329
|
const matches = collectRegexMatches(regex, value, replaceAll2 || regex.flags.includes("g"));
|
|
144329
144330
|
let result = "";
|
|
144330
144331
|
let copiedThrough = 0;
|
|
@@ -144413,11 +144414,16 @@ function callSplit(value, args, budget) {
|
|
|
144413
144414
|
if (args.some(isSandboxClosure))
|
|
144414
144415
|
throw new TypeError("String#split does not support function arguments.");
|
|
144415
144416
|
if (isSandboxRegex(args[0])) {
|
|
144417
|
+
const regex = args[0];
|
|
144418
|
+
const splitter = createSandboxRegex(
|
|
144419
|
+
regex.source,
|
|
144420
|
+
regex.flags.includes("g") ? regex.flags : `${regex.flags}g`
|
|
144421
|
+
);
|
|
144416
144422
|
const limit2 = asNumberOrUndefined(args[1]) ?? 2 ** 32 - 1;
|
|
144417
144423
|
const result2 = [];
|
|
144418
144424
|
let copiedThrough = 0;
|
|
144419
144425
|
let endedWithZeroWidthMatch = false;
|
|
144420
|
-
for (const match of collectRegexMatches(
|
|
144426
|
+
for (const match of collectRegexMatches(splitter, value, true)) {
|
|
144421
144427
|
endedWithZeroWidthMatch = match.text.length === 0 && match.index === value.length;
|
|
144422
144428
|
if (match.text.length === 0 && match.index === 0) continue;
|
|
144423
144429
|
if (result2.length >= limit2) break;
|
|
@@ -144455,18 +144461,18 @@ function callMatchLikeMethod(value, methodName, args) {
|
|
|
144455
144461
|
throw new TypeError("String#matchAll requires a global regex.");
|
|
144456
144462
|
if (methodName === "match" && !regex.flags.includes("g"))
|
|
144457
144463
|
return toMatchArray(executeRegex(regex, value), value);
|
|
144458
|
-
|
|
144464
|
+
if (methodName === "match") regex.lastIndex = 0;
|
|
144465
|
+
const matcher = methodName === "matchAll" ? createSandboxRegex(regex.source, regex.flags, regex.lastIndex) : regex;
|
|
144466
|
+
const matches = collectRegexMatches(matcher, value, true);
|
|
144459
144467
|
return methodName === "match" ? matches.map((match) => match.text) : matches.map((match) => toMatchArray(match, value));
|
|
144460
144468
|
}
|
|
144461
144469
|
function collectRegexMatches(regex, value, all) {
|
|
144462
144470
|
const matches = [];
|
|
144463
|
-
const pattern = getSandboxRegexPattern(regex);
|
|
144464
|
-
let startIndex = 0;
|
|
144465
144471
|
do {
|
|
144466
|
-
const match =
|
|
144472
|
+
const match = executeRegex(regex, value);
|
|
144467
144473
|
if (match === null) break;
|
|
144468
144474
|
matches.push(match);
|
|
144469
|
-
|
|
144475
|
+
if (all && match.text.length === 0) regex.lastIndex += 1;
|
|
144470
144476
|
} while (all);
|
|
144471
144477
|
return matches;
|
|
144472
144478
|
}
|
|
@@ -144488,7 +144494,6 @@ var init_string = __esm({
|
|
|
144488
144494
|
"packages/safejs/src/interp/methods/string.ts"() {
|
|
144489
144495
|
"use strict";
|
|
144490
144496
|
init_values();
|
|
144491
|
-
init_engine2();
|
|
144492
144497
|
init_regex2();
|
|
144493
144498
|
SPLIT_STRING_MESSAGE = "String#split only supports string separator values.";
|
|
144494
144499
|
stringMethodNames = /* @__PURE__ */ new Set([
|
|
@@ -155609,7 +155614,7 @@ var init_package2 = __esm({
|
|
|
155609
155614
|
"package.json"() {
|
|
155610
155615
|
package_default2 = {
|
|
155611
155616
|
name: "poe-code",
|
|
155612
|
-
version: "11.0.
|
|
155617
|
+
version: "11.0.13",
|
|
155613
155618
|
description: "CLI tool to configure Poe API for developer workflows.",
|
|
155614
155619
|
license: "MIT",
|
|
155615
155620
|
type: "module",
|