@poe-platform/safe-js 0.1.182 → 0.1.183
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/safe-js/chunks/{chunk-A6KP64IV.js → chunk-7XAXYVOY.js} +21 -13
- package/dist/safe-js/chunks/chunk-7XAXYVOY.js.map +7 -0
- package/dist/safe-js/chunks/{chunk-J5JNS3B3.js → chunk-VZNLY6BP.js} +2 -2
- package/dist/safe-js/cli.js +2 -2
- package/dist/safe-js/core.js +1 -1
- package/dist/safe-js/index.js +2 -2
- package/package.json +2 -2
- package/dist/safe-js/chunks/chunk-A6KP64IV.js.map +0 -7
- /package/dist/safe-js/chunks/{chunk-J5JNS3B3.js.map → chunk-VZNLY6BP.js.map} +0 -0
|
@@ -10827,23 +10827,26 @@ function callReplaceLikeMethod(value, methodName, args, budget, callClosure, use
|
|
|
10827
10827
|
replacement,
|
|
10828
10828
|
methodName === "replaceAll",
|
|
10829
10829
|
budget,
|
|
10830
|
-
callClosure
|
|
10830
|
+
callClosure,
|
|
10831
|
+
context
|
|
10831
10832
|
);
|
|
10832
10833
|
}
|
|
10833
10834
|
async function replaceRegex(value, regex, replacement, budget, callClosure, context) {
|
|
10834
10835
|
if (regex.flags.includes("g")) regex.lastIndex = 0;
|
|
10835
10836
|
const cursor = regex.lastIndex;
|
|
10837
|
+
let result = "";
|
|
10836
10838
|
const retained = {};
|
|
10837
|
-
budget.setRetainedValues(retained, () => [value, regex, cursor, replacement]);
|
|
10839
|
+
budget.setRetainedValues(retained, () => [value, regex, cursor, replacement, result]);
|
|
10838
10840
|
try {
|
|
10839
10841
|
const lastIndex = await sandboxNumber(cursor, budget, context);
|
|
10840
10842
|
const matches = collectRegexMatches(regex, value, regex.flags.includes("g"), void 0, lastIndex);
|
|
10841
|
-
let result = "";
|
|
10842
10843
|
let copiedThrough = 0;
|
|
10843
10844
|
for (const match of matches) {
|
|
10844
10845
|
result += value.slice(copiedThrough, match.index);
|
|
10845
|
-
result += typeof replacement === "string" ? expandReplacement(replacement, match.text, match.captures, value, match.index) :
|
|
10846
|
-
await callClosure(replacement, [match.text, ...match.captures, match.index, value])
|
|
10846
|
+
result += typeof replacement === "string" ? expandReplacement(replacement, match.text, match.captures, value, match.index) : await sandboxString(
|
|
10847
|
+
await callClosure(replacement, [match.text, ...match.captures, match.index, value]),
|
|
10848
|
+
budget,
|
|
10849
|
+
context
|
|
10847
10850
|
);
|
|
10848
10851
|
copiedThrough = match.index + match.text.length;
|
|
10849
10852
|
}
|
|
@@ -10893,17 +10896,22 @@ function expandReplacement(replacement, match, captures, input, matchIndex) {
|
|
|
10893
10896
|
}
|
|
10894
10897
|
return result;
|
|
10895
10898
|
}
|
|
10896
|
-
async function replaceWithClosure(value, searchValue, replacer, replaceAll, budget, callClosure) {
|
|
10899
|
+
async function replaceWithClosure(value, searchValue, replacer, replaceAll, budget, callClosure, context) {
|
|
10897
10900
|
const offsets = findReplacementOffsets(value, searchValue, replaceAll);
|
|
10898
10901
|
let result = "";
|
|
10899
10902
|
let copiedThrough = 0;
|
|
10900
|
-
|
|
10901
|
-
|
|
10902
|
-
|
|
10903
|
-
|
|
10903
|
+
const release = retainValues(budget, () => [value, searchValue, replacer, result]);
|
|
10904
|
+
try {
|
|
10905
|
+
for (const offset of offsets) {
|
|
10906
|
+
result += value.slice(copiedThrough, offset);
|
|
10907
|
+
result += await sandboxString(await callClosure(replacer, [searchValue, offset, value]), budget, context);
|
|
10908
|
+
copiedThrough = offset + searchValue.length;
|
|
10909
|
+
}
|
|
10910
|
+
result += value.slice(copiedThrough);
|
|
10911
|
+
return budget.allocateString(result);
|
|
10912
|
+
} finally {
|
|
10913
|
+
release();
|
|
10904
10914
|
}
|
|
10905
|
-
result += value.slice(copiedThrough);
|
|
10906
|
-
return budget.allocateString(result);
|
|
10907
10915
|
}
|
|
10908
10916
|
function findReplacementOffsets(value, searchValue, replaceAll) {
|
|
10909
10917
|
const firstOffset = value.indexOf(searchValue);
|
|
@@ -36567,4 +36575,4 @@ export {
|
|
|
36567
36575
|
FileSnapshotBackend,
|
|
36568
36576
|
run
|
|
36569
36577
|
};
|
|
36570
|
-
//# sourceMappingURL=chunk-
|
|
36578
|
+
//# sourceMappingURL=chunk-7XAXYVOY.js.map
|