@catladder/cli 0.0.0-next-d3840b21 → 0.0.0-next-1f51158f
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.
|
@@ -941,12 +941,15 @@ const BashExpression_1 = __nccwpck_require__(2376);
|
|
|
941
941
|
// and adjusted a bit
|
|
942
942
|
async function replaceAsync(string, searchValue, replacer) {
|
|
943
943
|
const wasBashExpression = string instanceof BashExpression_1.BashExpression;
|
|
944
|
+
const stringRepresentation = wasBashExpression
|
|
945
|
+
? string.toString()
|
|
946
|
+
: (0, BashExpression_1.bashEscape)(string);
|
|
944
947
|
try {
|
|
945
948
|
// 1. Run fake pass of `replace`, collect values from `replacer` calls
|
|
946
949
|
// 2. Resolve them with `Promise.all`
|
|
947
950
|
// 3. Run `replace` with resolved values
|
|
948
951
|
const values = [];
|
|
949
|
-
String.prototype.replace.call(
|
|
952
|
+
String.prototype.replace.call(stringRepresentation, searchValue, function (...args) {
|
|
950
953
|
// eslint-disable-next-line prefer-spread
|
|
951
954
|
const result = replacer.apply(undefined, args);
|
|
952
955
|
values.push(result);
|
|
@@ -954,7 +957,7 @@ async function replaceAsync(string, searchValue, replacer) {
|
|
|
954
957
|
});
|
|
955
958
|
const resolvedValues = await Promise.all(values);
|
|
956
959
|
const containsBashExpression = resolvedValues.some((value) => value instanceof BashExpression_1.BashExpression);
|
|
957
|
-
const result = String.prototype.replace.call(
|
|
960
|
+
const result = String.prototype.replace.call(stringRepresentation, searchValue, function () {
|
|
958
961
|
var _a, _b;
|
|
959
962
|
return (_b = (_a = resolvedValues.shift()) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : "";
|
|
960
963
|
});
|
|
@@ -4107,12 +4107,15 @@ const BashExpression_1 = __nccwpck_require__(42376);
|
|
|
4107
4107
|
// and adjusted a bit
|
|
4108
4108
|
async function replaceAsync(string, searchValue, replacer) {
|
|
4109
4109
|
const wasBashExpression = string instanceof BashExpression_1.BashExpression;
|
|
4110
|
+
const stringRepresentation = wasBashExpression
|
|
4111
|
+
? string.toString()
|
|
4112
|
+
: (0, BashExpression_1.bashEscape)(string);
|
|
4110
4113
|
try {
|
|
4111
4114
|
// 1. Run fake pass of `replace`, collect values from `replacer` calls
|
|
4112
4115
|
// 2. Resolve them with `Promise.all`
|
|
4113
4116
|
// 3. Run `replace` with resolved values
|
|
4114
4117
|
const values = [];
|
|
4115
|
-
String.prototype.replace.call(
|
|
4118
|
+
String.prototype.replace.call(stringRepresentation, searchValue, function (...args) {
|
|
4116
4119
|
// eslint-disable-next-line prefer-spread
|
|
4117
4120
|
const result = replacer.apply(undefined, args);
|
|
4118
4121
|
values.push(result);
|
|
@@ -4120,7 +4123,7 @@ async function replaceAsync(string, searchValue, replacer) {
|
|
|
4120
4123
|
});
|
|
4121
4124
|
const resolvedValues = await Promise.all(values);
|
|
4122
4125
|
const containsBashExpression = resolvedValues.some((value) => value instanceof BashExpression_1.BashExpression);
|
|
4123
|
-
const result = String.prototype.replace.call(
|
|
4126
|
+
const result = String.prototype.replace.call(stringRepresentation, searchValue, function () {
|
|
4124
4127
|
var _a, _b;
|
|
4125
4128
|
return (_b = (_a = resolvedValues.shift()) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : "";
|
|
4126
4129
|
});
|
|
@@ -5,12 +5,15 @@ const BashExpression_1 = require("./BashExpression");
|
|
|
5
5
|
// and adjusted a bit
|
|
6
6
|
async function replaceAsync(string, searchValue, replacer) {
|
|
7
7
|
const wasBashExpression = string instanceof BashExpression_1.BashExpression;
|
|
8
|
+
const stringRepresentation = wasBashExpression
|
|
9
|
+
? string.toString()
|
|
10
|
+
: (0, BashExpression_1.bashEscape)(string);
|
|
8
11
|
try {
|
|
9
12
|
// 1. Run fake pass of `replace`, collect values from `replacer` calls
|
|
10
13
|
// 2. Resolve them with `Promise.all`
|
|
11
14
|
// 3. Run `replace` with resolved values
|
|
12
15
|
const values = [];
|
|
13
|
-
String.prototype.replace.call(
|
|
16
|
+
String.prototype.replace.call(stringRepresentation, searchValue, function (...args) {
|
|
14
17
|
// eslint-disable-next-line prefer-spread
|
|
15
18
|
const result = replacer.apply(undefined, args);
|
|
16
19
|
values.push(result);
|
|
@@ -18,7 +21,7 @@ async function replaceAsync(string, searchValue, replacer) {
|
|
|
18
21
|
});
|
|
19
22
|
const resolvedValues = await Promise.all(values);
|
|
20
23
|
const containsBashExpression = resolvedValues.some((value) => value instanceof BashExpression_1.BashExpression);
|
|
21
|
-
const result = String.prototype.replace.call(
|
|
24
|
+
const result = String.prototype.replace.call(stringRepresentation, searchValue, function () {
|
|
22
25
|
var _a, _b;
|
|
23
26
|
return (_b = (_a = resolvedValues.shift()) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : "";
|
|
24
27
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"replaceAsync.js","sourceRoot":"","sources":["../../../../../pipeline/src/bash/replaceAsync.ts"],"names":[],"mappings":";;AAAA,
|
|
1
|
+
{"version":3,"file":"replaceAsync.js","sourceRoot":"","sources":["../../../../../pipeline/src/bash/replaceAsync.ts"],"names":[],"mappings":";;AAAA,qDAA8D;AAE9D,wEAAwE;AACxE,qBAAqB;AACN,KAAK,UAAU,YAAY,CACxC,MAA+B,EAC/B,WAAgB,EAChB,QAGqC;IAErC,MAAM,iBAAiB,GAAG,MAAM,YAAY,+BAAc,CAAC;IAE3D,MAAM,oBAAoB,GAAG,iBAAiB;QAC5C,CAAC,CAAC,MAAM,CAAC,QAAQ,EAAE;QACnB,CAAC,CAAC,IAAA,2BAAU,EAAC,MAAM,CAAC,CAAC;IACvB,IAAI,CAAC;QACH,sEAAsE;QACtE,qCAAqC;QACrC,wCAAwC;QACxC,MAAM,MAAM,GAA4C,EAAE,CAAC;QAC3D,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAC3B,oBAAoB,EACpB,WAAW,EACX,UAAU,GAAG,IAAI;YACf,yCAAyC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