keycloakify 10.0.0-rc.74 → 10.0.0-rc.75
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/README.md +2 -3
- package/bin/266.index.js +806 -0
- package/bin/{772.index.js → 304.index.js} +262 -678
- package/bin/720.index.js +243 -0
- package/bin/877.index.js +275 -0
- package/bin/main.js +454 -329
- package/package.json +6 -7
- package/bin/246.index.js +0 -466
- package/bin/420.index.js +0 -508
- package/bin/509.index.js +0 -438
package/bin/720.index.js
ADDED
@@ -0,0 +1,243 @@
|
|
1
|
+
"use strict";
|
2
|
+
exports.id = 720;
|
3
|
+
exports.ids = [720];
|
4
|
+
exports.modules = {
|
5
|
+
|
6
|
+
/***/ 68720:
|
7
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
8
|
+
|
9
|
+
__webpack_require__.r(__webpack_exports__);
|
10
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
11
|
+
/* harmony export */ "default": () => (/* binding */ wrapAnsi)
|
12
|
+
/* harmony export */ });
|
13
|
+
/* harmony import */ var string_width__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(10509);
|
14
|
+
/* harmony import */ var strip_ansi__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5505);
|
15
|
+
/* harmony import */ var ansi_styles__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(51284);
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
const ESCAPES = new Set([
|
21
|
+
'\u001B',
|
22
|
+
'\u009B',
|
23
|
+
]);
|
24
|
+
|
25
|
+
const END_CODE = 39;
|
26
|
+
const ANSI_ESCAPE_BELL = '\u0007';
|
27
|
+
const ANSI_CSI = '[';
|
28
|
+
const ANSI_OSC = ']';
|
29
|
+
const ANSI_SGR_TERMINATOR = 'm';
|
30
|
+
const ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
31
|
+
|
32
|
+
const wrapAnsiCode = code => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
33
|
+
const wrapAnsiHyperlink = url => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
|
34
|
+
|
35
|
+
// Calculate the length of words split on ' ', ignoring
|
36
|
+
// the extra characters added by ansi escape codes
|
37
|
+
const wordLengths = string => string.split(' ').map(character => (0,string_width__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)(character));
|
38
|
+
|
39
|
+
// Wrap a long word across multiple rows
|
40
|
+
// Ansi escape codes do not count towards length
|
41
|
+
const wrapWord = (rows, word, columns) => {
|
42
|
+
const characters = [...word];
|
43
|
+
|
44
|
+
let isInsideEscape = false;
|
45
|
+
let isInsideLinkEscape = false;
|
46
|
+
let visible = (0,string_width__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)((0,strip_ansi__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z)(rows.at(-1)));
|
47
|
+
|
48
|
+
for (const [index, character] of characters.entries()) {
|
49
|
+
const characterLength = (0,string_width__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)(character);
|
50
|
+
|
51
|
+
if (visible + characterLength <= columns) {
|
52
|
+
rows[rows.length - 1] += character;
|
53
|
+
} else {
|
54
|
+
rows.push(character);
|
55
|
+
visible = 0;
|
56
|
+
}
|
57
|
+
|
58
|
+
if (ESCAPES.has(character)) {
|
59
|
+
isInsideEscape = true;
|
60
|
+
|
61
|
+
const ansiEscapeLinkCandidate = characters.slice(index + 1, index + 1 + ANSI_ESCAPE_LINK.length).join('');
|
62
|
+
isInsideLinkEscape = ansiEscapeLinkCandidate === ANSI_ESCAPE_LINK;
|
63
|
+
}
|
64
|
+
|
65
|
+
if (isInsideEscape) {
|
66
|
+
if (isInsideLinkEscape) {
|
67
|
+
if (character === ANSI_ESCAPE_BELL) {
|
68
|
+
isInsideEscape = false;
|
69
|
+
isInsideLinkEscape = false;
|
70
|
+
}
|
71
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
72
|
+
isInsideEscape = false;
|
73
|
+
}
|
74
|
+
|
75
|
+
continue;
|
76
|
+
}
|
77
|
+
|
78
|
+
visible += characterLength;
|
79
|
+
|
80
|
+
if (visible === columns && index < characters.length - 1) {
|
81
|
+
rows.push('');
|
82
|
+
visible = 0;
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
// It's possible that the last row we copy over is only
|
87
|
+
// ansi escape characters, handle this edge-case
|
88
|
+
if (!visible && rows.at(-1).length > 0 && rows.length > 1) {
|
89
|
+
rows[rows.length - 2] += rows.pop();
|
90
|
+
}
|
91
|
+
};
|
92
|
+
|
93
|
+
// Trims spaces from a string ignoring invisible sequences
|
94
|
+
const stringVisibleTrimSpacesRight = string => {
|
95
|
+
const words = string.split(' ');
|
96
|
+
let last = words.length;
|
97
|
+
|
98
|
+
while (last > 0) {
|
99
|
+
if ((0,string_width__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)(words[last - 1]) > 0) {
|
100
|
+
break;
|
101
|
+
}
|
102
|
+
|
103
|
+
last--;
|
104
|
+
}
|
105
|
+
|
106
|
+
if (last === words.length) {
|
107
|
+
return string;
|
108
|
+
}
|
109
|
+
|
110
|
+
return words.slice(0, last).join(' ') + words.slice(last).join('');
|
111
|
+
};
|
112
|
+
|
113
|
+
// The wrap-ansi module can be invoked in either 'hard' or 'soft' wrap mode.
|
114
|
+
//
|
115
|
+
// 'hard' will never allow a string to take up more than columns characters.
|
116
|
+
//
|
117
|
+
// 'soft' allows long words to expand past the column length.
|
118
|
+
const exec = (string, columns, options = {}) => {
|
119
|
+
if (options.trim !== false && string.trim() === '') {
|
120
|
+
return '';
|
121
|
+
}
|
122
|
+
|
123
|
+
let returnValue = '';
|
124
|
+
let escapeCode;
|
125
|
+
let escapeUrl;
|
126
|
+
|
127
|
+
const lengths = wordLengths(string);
|
128
|
+
let rows = [''];
|
129
|
+
|
130
|
+
for (const [index, word] of string.split(' ').entries()) {
|
131
|
+
if (options.trim !== false) {
|
132
|
+
rows[rows.length - 1] = rows.at(-1).trimStart();
|
133
|
+
}
|
134
|
+
|
135
|
+
let rowLength = (0,string_width__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z)(rows.at(-1));
|
136
|
+
|
137
|
+
if (index !== 0) {
|
138
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
139
|
+
// If we start with a new word but the current row length equals the length of the columns, add a new row
|
140
|
+
rows.push('');
|
141
|
+
rowLength = 0;
|
142
|
+
}
|
143
|
+
|
144
|
+
if (rowLength > 0 || options.trim === false) {
|
145
|
+
rows[rows.length - 1] += ' ';
|
146
|
+
rowLength++;
|
147
|
+
}
|
148
|
+
}
|
149
|
+
|
150
|
+
// In 'hard' wrap mode, the length of a line is never allowed to extend past 'columns'
|
151
|
+
if (options.hard && lengths[index] > columns) {
|
152
|
+
const remainingColumns = (columns - rowLength);
|
153
|
+
const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
|
154
|
+
const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
|
155
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
156
|
+
rows.push('');
|
157
|
+
}
|
158
|
+
|
159
|
+
wrapWord(rows, word, columns);
|
160
|
+
continue;
|
161
|
+
}
|
162
|
+
|
163
|
+
if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
|
164
|
+
if (options.wordWrap === false && rowLength < columns) {
|
165
|
+
wrapWord(rows, word, columns);
|
166
|
+
continue;
|
167
|
+
}
|
168
|
+
|
169
|
+
rows.push('');
|
170
|
+
}
|
171
|
+
|
172
|
+
if (rowLength + lengths[index] > columns && options.wordWrap === false) {
|
173
|
+
wrapWord(rows, word, columns);
|
174
|
+
continue;
|
175
|
+
}
|
176
|
+
|
177
|
+
rows[rows.length - 1] += word;
|
178
|
+
}
|
179
|
+
|
180
|
+
if (options.trim !== false) {
|
181
|
+
rows = rows.map(row => stringVisibleTrimSpacesRight(row));
|
182
|
+
}
|
183
|
+
|
184
|
+
const preString = rows.join('\n');
|
185
|
+
const pre = [...preString];
|
186
|
+
|
187
|
+
// We need to keep a separate index as `String#slice()` works on Unicode code units, while `pre` is an array of codepoints.
|
188
|
+
let preStringIndex = 0;
|
189
|
+
|
190
|
+
for (const [index, character] of pre.entries()) {
|
191
|
+
returnValue += character;
|
192
|
+
|
193
|
+
if (ESCAPES.has(character)) {
|
194
|
+
const {groups} = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(preString.slice(preStringIndex)) || {groups: {}};
|
195
|
+
if (groups.code !== undefined) {
|
196
|
+
const code = Number.parseFloat(groups.code);
|
197
|
+
escapeCode = code === END_CODE ? undefined : code;
|
198
|
+
} else if (groups.uri !== undefined) {
|
199
|
+
escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
|
200
|
+
}
|
201
|
+
}
|
202
|
+
|
203
|
+
const code = ansi_styles__WEBPACK_IMPORTED_MODULE_1__/* ["default"].codes.get */ .ZP.codes.get(Number(escapeCode));
|
204
|
+
|
205
|
+
if (pre[index + 1] === '\n') {
|
206
|
+
if (escapeUrl) {
|
207
|
+
returnValue += wrapAnsiHyperlink('');
|
208
|
+
}
|
209
|
+
|
210
|
+
if (escapeCode && code) {
|
211
|
+
returnValue += wrapAnsiCode(code);
|
212
|
+
}
|
213
|
+
} else if (character === '\n') {
|
214
|
+
if (escapeCode && code) {
|
215
|
+
returnValue += wrapAnsiCode(escapeCode);
|
216
|
+
}
|
217
|
+
|
218
|
+
if (escapeUrl) {
|
219
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
220
|
+
}
|
221
|
+
}
|
222
|
+
|
223
|
+
preStringIndex += character.length;
|
224
|
+
}
|
225
|
+
|
226
|
+
return returnValue;
|
227
|
+
};
|
228
|
+
|
229
|
+
// For each newline, invoke the method separately
|
230
|
+
function wrapAnsi(string, columns, options) {
|
231
|
+
return String(string)
|
232
|
+
.normalize()
|
233
|
+
.replaceAll('\r\n', '\n')
|
234
|
+
.split('\n')
|
235
|
+
.map(line => exec(line, columns, options))
|
236
|
+
.join('\n');
|
237
|
+
}
|
238
|
+
|
239
|
+
|
240
|
+
/***/ })
|
241
|
+
|
242
|
+
};
|
243
|
+
;
|
package/bin/877.index.js
ADDED
@@ -0,0 +1,275 @@
|
|
1
|
+
"use strict";
|
2
|
+
exports.id = 877;
|
3
|
+
exports.ids = [877];
|
4
|
+
exports.modules = {
|
5
|
+
|
6
|
+
/***/ 85877:
|
7
|
+
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
|
8
|
+
|
9
|
+
// ESM COMPAT FLAG
|
10
|
+
__webpack_require__.r(__webpack_exports__);
|
11
|
+
|
12
|
+
// EXPORTS
|
13
|
+
__webpack_require__.d(__webpack_exports__, {
|
14
|
+
"default": () => (/* binding */ cliTruncate)
|
15
|
+
});
|
16
|
+
|
17
|
+
;// CONCATENATED MODULE: ./node_modules/listr2/node_modules/is-fullwidth-code-point/index.js
|
18
|
+
/* eslint-disable yoda */
|
19
|
+
|
20
|
+
function isFullwidthCodePoint(codePoint) {
|
21
|
+
if (!Number.isInteger(codePoint)) {
|
22
|
+
return false;
|
23
|
+
}
|
24
|
+
|
25
|
+
// Code points are derived from:
|
26
|
+
// https://unicode.org/Public/UNIDATA/EastAsianWidth.txt
|
27
|
+
return codePoint >= 0x1100 && (
|
28
|
+
codePoint <= 0x115F || // Hangul Jamo
|
29
|
+
codePoint === 0x2329 || // LEFT-POINTING ANGLE BRACKET
|
30
|
+
codePoint === 0x232A || // RIGHT-POINTING ANGLE BRACKET
|
31
|
+
// CJK Radicals Supplement .. Enclosed CJK Letters and Months
|
32
|
+
(0x2E80 <= codePoint && codePoint <= 0x3247 && codePoint !== 0x303F) ||
|
33
|
+
// Enclosed CJK Letters and Months .. CJK Unified Ideographs Extension A
|
34
|
+
(0x3250 <= codePoint && codePoint <= 0x4DBF) ||
|
35
|
+
// CJK Unified Ideographs .. Yi Radicals
|
36
|
+
(0x4E00 <= codePoint && codePoint <= 0xA4C6) ||
|
37
|
+
// Hangul Jamo Extended-A
|
38
|
+
(0xA960 <= codePoint && codePoint <= 0xA97C) ||
|
39
|
+
// Hangul Syllables
|
40
|
+
(0xAC00 <= codePoint && codePoint <= 0xD7A3) ||
|
41
|
+
// CJK Compatibility Ideographs
|
42
|
+
(0xF900 <= codePoint && codePoint <= 0xFAFF) ||
|
43
|
+
// Vertical Forms
|
44
|
+
(0xFE10 <= codePoint && codePoint <= 0xFE19) ||
|
45
|
+
// CJK Compatibility Forms .. Small Form Variants
|
46
|
+
(0xFE30 <= codePoint && codePoint <= 0xFE6B) ||
|
47
|
+
// Halfwidth and Fullwidth Forms
|
48
|
+
(0xFF01 <= codePoint && codePoint <= 0xFF60) ||
|
49
|
+
(0xFFE0 <= codePoint && codePoint <= 0xFFE6) ||
|
50
|
+
// Kana Supplement
|
51
|
+
(0x1B000 <= codePoint && codePoint <= 0x1B001) ||
|
52
|
+
// Enclosed Ideographic Supplement
|
53
|
+
(0x1F200 <= codePoint && codePoint <= 0x1F251) ||
|
54
|
+
// CJK Unified Ideographs Extension B .. Tertiary Ideographic Plane
|
55
|
+
(0x20000 <= codePoint && codePoint <= 0x3FFFD)
|
56
|
+
);
|
57
|
+
}
|
58
|
+
|
59
|
+
// EXTERNAL MODULE: ./node_modules/listr2/node_modules/ansi-styles/index.js
|
60
|
+
var ansi_styles = __webpack_require__(51284);
|
61
|
+
;// CONCATENATED MODULE: ./node_modules/listr2/node_modules/slice-ansi/index.js
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
const astralRegex = /^[\uD800-\uDBFF][\uDC00-\uDFFF]$/;
|
66
|
+
|
67
|
+
const ESCAPES = [
|
68
|
+
'\u001B',
|
69
|
+
'\u009B'
|
70
|
+
];
|
71
|
+
|
72
|
+
const wrapAnsi = code => `${ESCAPES[0]}[${code}m`;
|
73
|
+
|
74
|
+
const checkAnsi = (ansiCodes, isEscapes, endAnsiCode) => {
|
75
|
+
let output = [];
|
76
|
+
ansiCodes = [...ansiCodes];
|
77
|
+
|
78
|
+
for (let ansiCode of ansiCodes) {
|
79
|
+
const ansiCodeOrigin = ansiCode;
|
80
|
+
if (ansiCode.includes(';')) {
|
81
|
+
ansiCode = ansiCode.split(';')[0][0] + '0';
|
82
|
+
}
|
83
|
+
|
84
|
+
const item = ansi_styles/* default.codes.get */.ZP.codes.get(Number.parseInt(ansiCode, 10));
|
85
|
+
if (item) {
|
86
|
+
const indexEscape = ansiCodes.indexOf(item.toString());
|
87
|
+
if (indexEscape === -1) {
|
88
|
+
output.push(wrapAnsi(isEscapes ? item : ansiCodeOrigin));
|
89
|
+
} else {
|
90
|
+
ansiCodes.splice(indexEscape, 1);
|
91
|
+
}
|
92
|
+
} else if (isEscapes) {
|
93
|
+
output.push(wrapAnsi(0));
|
94
|
+
break;
|
95
|
+
} else {
|
96
|
+
output.push(wrapAnsi(ansiCodeOrigin));
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
if (isEscapes) {
|
101
|
+
output = output.filter((element, index) => output.indexOf(element) === index);
|
102
|
+
|
103
|
+
if (endAnsiCode !== undefined) {
|
104
|
+
const fistEscapeCode = wrapAnsi(ansi_styles/* default.codes.get */.ZP.codes.get(Number.parseInt(endAnsiCode, 10)));
|
105
|
+
// TODO: Remove the use of `.reduce` here.
|
106
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
107
|
+
output = output.reduce((current, next) => next === fistEscapeCode ? [next, ...current] : [...current, next], []);
|
108
|
+
}
|
109
|
+
}
|
110
|
+
|
111
|
+
return output.join('');
|
112
|
+
};
|
113
|
+
|
114
|
+
function sliceAnsi(string, begin, end) {
|
115
|
+
const characters = [...string];
|
116
|
+
const ansiCodes = [];
|
117
|
+
|
118
|
+
let stringEnd = typeof end === 'number' ? end : characters.length;
|
119
|
+
let isInsideEscape = false;
|
120
|
+
let ansiCode;
|
121
|
+
let visible = 0;
|
122
|
+
let output = '';
|
123
|
+
|
124
|
+
for (const [index, character] of characters.entries()) {
|
125
|
+
let leftEscape = false;
|
126
|
+
|
127
|
+
if (ESCAPES.includes(character)) {
|
128
|
+
const code = /\d[^m]*/.exec(string.slice(index, index + 18));
|
129
|
+
ansiCode = code && code.length > 0 ? code[0] : undefined;
|
130
|
+
|
131
|
+
if (visible < stringEnd) {
|
132
|
+
isInsideEscape = true;
|
133
|
+
|
134
|
+
if (ansiCode !== undefined) {
|
135
|
+
ansiCodes.push(ansiCode);
|
136
|
+
}
|
137
|
+
}
|
138
|
+
} else if (isInsideEscape && character === 'm') {
|
139
|
+
isInsideEscape = false;
|
140
|
+
leftEscape = true;
|
141
|
+
}
|
142
|
+
|
143
|
+
if (!isInsideEscape && !leftEscape) {
|
144
|
+
visible++;
|
145
|
+
}
|
146
|
+
|
147
|
+
if (!astralRegex.test(character) && isFullwidthCodePoint(character.codePointAt())) {
|
148
|
+
visible++;
|
149
|
+
|
150
|
+
if (typeof end !== 'number') {
|
151
|
+
stringEnd++;
|
152
|
+
}
|
153
|
+
}
|
154
|
+
|
155
|
+
if (visible > begin && visible <= stringEnd) {
|
156
|
+
output += character;
|
157
|
+
} else if (visible === begin && !isInsideEscape && ansiCode !== undefined) {
|
158
|
+
output = checkAnsi(ansiCodes);
|
159
|
+
} else if (visible >= stringEnd) {
|
160
|
+
output += checkAnsi(ansiCodes, true, ansiCode);
|
161
|
+
break;
|
162
|
+
}
|
163
|
+
}
|
164
|
+
|
165
|
+
return output;
|
166
|
+
}
|
167
|
+
|
168
|
+
// EXTERNAL MODULE: ./node_modules/listr2/node_modules/string-width/index.js
|
169
|
+
var string_width = __webpack_require__(10509);
|
170
|
+
;// CONCATENATED MODULE: ./node_modules/listr2/node_modules/cli-truncate/index.js
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
function getIndexOfNearestSpace(string, wantedIndex, shouldSearchRight) {
|
175
|
+
if (string.charAt(wantedIndex) === ' ') {
|
176
|
+
return wantedIndex;
|
177
|
+
}
|
178
|
+
|
179
|
+
const direction = shouldSearchRight ? 1 : -1;
|
180
|
+
|
181
|
+
for (let index = 0; index <= 3; index++) {
|
182
|
+
const finalIndex = wantedIndex + (index * direction);
|
183
|
+
if (string.charAt(finalIndex) === ' ') {
|
184
|
+
return finalIndex;
|
185
|
+
}
|
186
|
+
}
|
187
|
+
|
188
|
+
return wantedIndex;
|
189
|
+
}
|
190
|
+
|
191
|
+
function cliTruncate(text, columns, options = {}) {
|
192
|
+
const {
|
193
|
+
position = 'end',
|
194
|
+
space = false,
|
195
|
+
preferTruncationOnSpace = false,
|
196
|
+
} = options;
|
197
|
+
|
198
|
+
let {truncationCharacter = '…'} = options;
|
199
|
+
|
200
|
+
if (typeof text !== 'string') {
|
201
|
+
throw new TypeError(`Expected \`input\` to be a string, got ${typeof text}`);
|
202
|
+
}
|
203
|
+
|
204
|
+
if (typeof columns !== 'number') {
|
205
|
+
throw new TypeError(`Expected \`columns\` to be a number, got ${typeof columns}`);
|
206
|
+
}
|
207
|
+
|
208
|
+
if (columns < 1) {
|
209
|
+
return '';
|
210
|
+
}
|
211
|
+
|
212
|
+
if (columns === 1) {
|
213
|
+
return truncationCharacter;
|
214
|
+
}
|
215
|
+
|
216
|
+
const length = (0,string_width/* default */.Z)(text);
|
217
|
+
|
218
|
+
if (length <= columns) {
|
219
|
+
return text;
|
220
|
+
}
|
221
|
+
|
222
|
+
if (position === 'start') {
|
223
|
+
if (preferTruncationOnSpace) {
|
224
|
+
const nearestSpace = getIndexOfNearestSpace(text, length - columns + 1, true);
|
225
|
+
return truncationCharacter + sliceAnsi(text, nearestSpace, length).trim();
|
226
|
+
}
|
227
|
+
|
228
|
+
if (space === true) {
|
229
|
+
truncationCharacter += ' ';
|
230
|
+
}
|
231
|
+
|
232
|
+
return truncationCharacter + sliceAnsi(text, length - columns + (0,string_width/* default */.Z)(truncationCharacter), length);
|
233
|
+
}
|
234
|
+
|
235
|
+
if (position === 'middle') {
|
236
|
+
if (space === true) {
|
237
|
+
truncationCharacter = ` ${truncationCharacter} `;
|
238
|
+
}
|
239
|
+
|
240
|
+
const half = Math.floor(columns / 2);
|
241
|
+
|
242
|
+
if (preferTruncationOnSpace) {
|
243
|
+
const spaceNearFirstBreakPoint = getIndexOfNearestSpace(text, half);
|
244
|
+
const spaceNearSecondBreakPoint = getIndexOfNearestSpace(text, length - (columns - half) + 1, true);
|
245
|
+
return sliceAnsi(text, 0, spaceNearFirstBreakPoint) + truncationCharacter + sliceAnsi(text, spaceNearSecondBreakPoint, length).trim();
|
246
|
+
}
|
247
|
+
|
248
|
+
return (
|
249
|
+
sliceAnsi(text, 0, half)
|
250
|
+
+ truncationCharacter
|
251
|
+
+ sliceAnsi(text, length - (columns - half) + (0,string_width/* default */.Z)(truncationCharacter), length)
|
252
|
+
);
|
253
|
+
}
|
254
|
+
|
255
|
+
if (position === 'end') {
|
256
|
+
if (preferTruncationOnSpace) {
|
257
|
+
const nearestSpace = getIndexOfNearestSpace(text, columns - 1);
|
258
|
+
return sliceAnsi(text, 0, nearestSpace) + truncationCharacter;
|
259
|
+
}
|
260
|
+
|
261
|
+
if (space === true) {
|
262
|
+
truncationCharacter = ` ${truncationCharacter}`;
|
263
|
+
}
|
264
|
+
|
265
|
+
return sliceAnsi(text, 0, columns - (0,string_width/* default */.Z)(truncationCharacter)) + truncationCharacter;
|
266
|
+
}
|
267
|
+
|
268
|
+
throw new Error(`Expected \`options.position\` to be either \`start\`, \`middle\` or \`end\`, got ${position}`);
|
269
|
+
}
|
270
|
+
|
271
|
+
|
272
|
+
/***/ })
|
273
|
+
|
274
|
+
};
|
275
|
+
;
|