@kubb/core 3.7.0 → 3.7.2
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/{FileManager-ReyBN79g.d.ts → FileManager-BSJoY0XN.d.ts} +1 -1
- package/dist/{FileManager-DcUC8taH.d.cts → FileManager-Cg92aWHj.d.cts} +1 -1
- package/dist/{chunk-CK6IAYQK.js → chunk-4ESUQQVB.js} +257 -350
- package/dist/chunk-4ESUQQVB.js.map +1 -0
- package/dist/{chunk-UT6YSWYN.cjs → chunk-7CUHIALJ.cjs} +17 -17
- package/dist/{chunk-UT6YSWYN.cjs.map → chunk-7CUHIALJ.cjs.map} +1 -1
- package/dist/{chunk-GFNZKLLF.cjs → chunk-KEDZU7VZ.cjs} +4 -4
- package/dist/{chunk-GFNZKLLF.cjs.map → chunk-KEDZU7VZ.cjs.map} +1 -1
- package/dist/{chunk-GKTZK3PK.cjs → chunk-TW6NZHX6.cjs} +35 -35
- package/dist/{chunk-GKTZK3PK.cjs.map → chunk-TW6NZHX6.cjs.map} +1 -1
- package/dist/{chunk-JDOASIYH.cjs → chunk-UKZDPZZN.cjs} +266 -357
- package/dist/chunk-UKZDPZZN.cjs.map +1 -0
- package/dist/index.cjs +38 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -4
- package/dist/index.d.ts +7 -4
- package/dist/index.js +8 -5
- package/dist/index.js.map +1 -1
- package/dist/{logger-DvbHXjIO.d.cts → logger-BWq-oJU_.d.cts} +3 -2
- package/dist/{logger-DvbHXjIO.d.ts → logger-BWq-oJU_.d.ts} +3 -2
- package/dist/logger.cjs +6 -6
- package/dist/logger.d.cts +2 -1
- package/dist/logger.d.ts +2 -1
- package/dist/logger.js +1 -1
- package/dist/mocks.cjs +9 -9
- package/dist/mocks.d.cts +3 -2
- package/dist/mocks.d.ts +3 -2
- package/dist/{prompt-JT4FZN2Y.cjs → prompt-OGHA3VNC.cjs} +4 -4
- package/dist/{prompt-JT4FZN2Y.cjs.map → prompt-OGHA3VNC.cjs.map} +1 -1
- package/dist/transformers.cjs +22 -22
- package/dist/utils.cjs +17 -17
- package/dist/utils.d.cts +2 -1
- package/dist/utils.d.ts +2 -1
- package/package.json +7 -8
- package/src/build.ts +6 -1
- package/src/index.ts +1 -1
- package/src/logger.ts +11 -24
- package/dist/chunk-CK6IAYQK.js.map +0 -1
- package/dist/chunk-JDOASIYH.cjs.map +0 -1
|
@@ -1,93 +1,245 @@
|
|
|
1
1
|
import seedrandom from 'seedrandom';
|
|
2
|
-
import
|
|
2
|
+
import * as tty from 'node:tty';
|
|
3
3
|
import { EventEmitter as EventEmitter$1 } from 'node:events';
|
|
4
4
|
import { sep, resolve } from 'node:path';
|
|
5
5
|
import { write } from '@kubb/fs';
|
|
6
6
|
import { formatWithOptions } from 'node:util';
|
|
7
7
|
import g$1 from 'node:process';
|
|
8
|
-
import * as tty from 'node:tty';
|
|
9
8
|
|
|
10
9
|
// src/logger.ts
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
10
|
+
var {
|
|
11
|
+
env = {},
|
|
12
|
+
argv = [],
|
|
13
|
+
platform = ""
|
|
14
|
+
} = typeof process === "undefined" ? {} : process;
|
|
15
|
+
var isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
16
|
+
var isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
17
|
+
var isWindows = platform === "win32";
|
|
18
|
+
var isDumbTerminal = env.TERM === "dumb";
|
|
19
|
+
var isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
|
|
20
|
+
var isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
21
|
+
var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
22
|
+
function replaceClose(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
|
|
23
|
+
return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
24
|
+
}
|
|
25
|
+
function clearBleed(index, string, open, close, replace) {
|
|
26
|
+
return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
27
|
+
}
|
|
28
|
+
function filterEmpty(open, close, replace = open, at = open.length + 1) {
|
|
29
|
+
return (string) => string || !(string === "" || string === void 0) ? clearBleed(
|
|
30
|
+
("" + string).indexOf(close, at),
|
|
31
|
+
string,
|
|
32
|
+
open,
|
|
33
|
+
close,
|
|
34
|
+
replace
|
|
35
|
+
) : "";
|
|
36
|
+
}
|
|
37
|
+
function init(open, close, replace) {
|
|
38
|
+
return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
|
|
39
|
+
}
|
|
40
|
+
var colorDefs = {
|
|
41
|
+
reset: init(0, 0),
|
|
42
|
+
bold: init(1, 22, "\x1B[22m\x1B[1m"),
|
|
43
|
+
dim: init(2, 22, "\x1B[22m\x1B[2m"),
|
|
44
|
+
italic: init(3, 23),
|
|
45
|
+
underline: init(4, 24),
|
|
46
|
+
inverse: init(7, 27),
|
|
47
|
+
hidden: init(8, 28),
|
|
48
|
+
strikethrough: init(9, 29),
|
|
49
|
+
black: init(30, 39),
|
|
50
|
+
red: init(31, 39),
|
|
51
|
+
green: init(32, 39),
|
|
52
|
+
yellow: init(33, 39),
|
|
53
|
+
blue: init(34, 39),
|
|
54
|
+
magenta: init(35, 39),
|
|
55
|
+
cyan: init(36, 39),
|
|
56
|
+
white: init(37, 39),
|
|
57
|
+
gray: init(90, 39),
|
|
58
|
+
bgBlack: init(40, 49),
|
|
59
|
+
bgRed: init(41, 49),
|
|
60
|
+
bgGreen: init(42, 49),
|
|
61
|
+
bgYellow: init(43, 49),
|
|
62
|
+
bgBlue: init(44, 49),
|
|
63
|
+
bgMagenta: init(45, 49),
|
|
64
|
+
bgCyan: init(46, 49),
|
|
65
|
+
bgWhite: init(47, 49),
|
|
66
|
+
blackBright: init(90, 39),
|
|
67
|
+
redBright: init(91, 39),
|
|
68
|
+
greenBright: init(92, 39),
|
|
69
|
+
yellowBright: init(93, 39),
|
|
70
|
+
blueBright: init(94, 39),
|
|
71
|
+
magentaBright: init(95, 39),
|
|
72
|
+
cyanBright: init(96, 39),
|
|
73
|
+
whiteBright: init(97, 39),
|
|
74
|
+
bgBlackBright: init(100, 49),
|
|
75
|
+
bgRedBright: init(101, 49),
|
|
76
|
+
bgGreenBright: init(102, 49),
|
|
77
|
+
bgYellowBright: init(103, 49),
|
|
78
|
+
bgBlueBright: init(104, 49),
|
|
79
|
+
bgMagentaBright: init(105, 49),
|
|
80
|
+
bgCyanBright: init(106, 49),
|
|
81
|
+
bgWhiteBright: init(107, 49)
|
|
55
82
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return String(n2);
|
|
83
|
+
function createColors(useColor = isColorSupported) {
|
|
84
|
+
return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
|
|
59
85
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
let e = typeof process != "undefined" ? process : void 0, i2 = (e == null ? void 0 : e.env) || {}, g2 = (e == null ? void 0 : e.argv) || [];
|
|
64
|
-
return !("NO_COLOR" in i2 || g2.includes("--no-color")) && ("FORCE_COLOR" in i2 || g2.includes("--color") || (e == null ? void 0 : e.platform) === "win32" || n2 && i2.TERM !== "dumb" || "CI" in i2) || typeof window != "undefined" && !!window.chrome;
|
|
86
|
+
var colors = createColors();
|
|
87
|
+
function getColor(color, fallback = "reset") {
|
|
88
|
+
return colors[color] || colors[fallback];
|
|
65
89
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
},
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
var ansiRegex = [
|
|
91
|
+
String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`,
|
|
92
|
+
String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`
|
|
93
|
+
].join("|");
|
|
94
|
+
function stripAnsi(text) {
|
|
95
|
+
return text.replace(new RegExp(ansiRegex, "g"), "");
|
|
96
|
+
}
|
|
97
|
+
var boxStylePresets = {
|
|
98
|
+
solid: {
|
|
99
|
+
tl: "\u250C",
|
|
100
|
+
tr: "\u2510",
|
|
101
|
+
bl: "\u2514",
|
|
102
|
+
br: "\u2518",
|
|
103
|
+
h: "\u2500",
|
|
104
|
+
v: "\u2502"
|
|
105
|
+
},
|
|
106
|
+
double: {
|
|
107
|
+
tl: "\u2554",
|
|
108
|
+
tr: "\u2557",
|
|
109
|
+
bl: "\u255A",
|
|
110
|
+
br: "\u255D",
|
|
111
|
+
h: "\u2550",
|
|
112
|
+
v: "\u2551"
|
|
113
|
+
},
|
|
114
|
+
doubleSingle: {
|
|
115
|
+
tl: "\u2553",
|
|
116
|
+
tr: "\u2556",
|
|
117
|
+
bl: "\u2559",
|
|
118
|
+
br: "\u255C",
|
|
119
|
+
h: "\u2500",
|
|
120
|
+
v: "\u2551"
|
|
121
|
+
},
|
|
122
|
+
doubleSingleRounded: {
|
|
123
|
+
tl: "\u256D",
|
|
124
|
+
tr: "\u256E",
|
|
125
|
+
bl: "\u2570",
|
|
126
|
+
br: "\u256F",
|
|
127
|
+
h: "\u2500",
|
|
128
|
+
v: "\u2551"
|
|
129
|
+
},
|
|
130
|
+
singleThick: {
|
|
131
|
+
tl: "\u250F",
|
|
132
|
+
tr: "\u2513",
|
|
133
|
+
bl: "\u2517",
|
|
134
|
+
br: "\u251B",
|
|
135
|
+
h: "\u2501",
|
|
136
|
+
v: "\u2503"
|
|
137
|
+
},
|
|
138
|
+
singleDouble: {
|
|
139
|
+
tl: "\u2552",
|
|
140
|
+
tr: "\u2555",
|
|
141
|
+
bl: "\u2558",
|
|
142
|
+
br: "\u255B",
|
|
143
|
+
h: "\u2550",
|
|
144
|
+
v: "\u2502"
|
|
145
|
+
},
|
|
146
|
+
singleDoubleRounded: {
|
|
147
|
+
tl: "\u256D",
|
|
148
|
+
tr: "\u256E",
|
|
149
|
+
bl: "\u2570",
|
|
150
|
+
br: "\u256F",
|
|
151
|
+
h: "\u2550",
|
|
152
|
+
v: "\u2502"
|
|
153
|
+
},
|
|
154
|
+
rounded: {
|
|
155
|
+
tl: "\u256D",
|
|
156
|
+
tr: "\u256E",
|
|
157
|
+
bl: "\u2570",
|
|
158
|
+
br: "\u256F",
|
|
159
|
+
h: "\u2500",
|
|
160
|
+
v: "\u2502"
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
var defaultStyle = {
|
|
164
|
+
borderColor: "white",
|
|
165
|
+
borderStyle: "rounded",
|
|
166
|
+
valign: "center",
|
|
167
|
+
padding: 2,
|
|
168
|
+
marginLeft: 1,
|
|
169
|
+
marginTop: 1,
|
|
170
|
+
marginBottom: 1
|
|
171
|
+
};
|
|
172
|
+
function box(text, _opts = {}) {
|
|
173
|
+
const opts = {
|
|
174
|
+
..._opts,
|
|
175
|
+
style: {
|
|
176
|
+
...defaultStyle,
|
|
177
|
+
..._opts.style
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
const textLines = text.split("\n");
|
|
181
|
+
const boxLines = [];
|
|
182
|
+
const _color = getColor(opts.style.borderColor);
|
|
183
|
+
const borderStyle = {
|
|
184
|
+
...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
|
|
185
|
+
};
|
|
186
|
+
if (_color) {
|
|
187
|
+
for (const key in borderStyle) {
|
|
188
|
+
borderStyle[key] = _color(
|
|
189
|
+
borderStyle[key]
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
|
|
194
|
+
const height = textLines.length + paddingOffset;
|
|
195
|
+
const width = Math.max(
|
|
196
|
+
...textLines.map((line) => stripAnsi(line).length),
|
|
197
|
+
opts.title ? stripAnsi(opts.title).length : 0
|
|
198
|
+
) + paddingOffset;
|
|
199
|
+
const widthOffset = width + paddingOffset;
|
|
200
|
+
const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
|
|
201
|
+
if (opts.style.marginTop > 0) {
|
|
202
|
+
boxLines.push("".repeat(opts.style.marginTop));
|
|
203
|
+
}
|
|
204
|
+
if (opts.title) {
|
|
205
|
+
const title = _color ? _color(opts.title) : opts.title;
|
|
206
|
+
const left = borderStyle.h.repeat(
|
|
207
|
+
Math.floor((width - stripAnsi(opts.title).length) / 2)
|
|
208
|
+
);
|
|
209
|
+
const right = borderStyle.h.repeat(
|
|
210
|
+
width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset
|
|
211
|
+
);
|
|
212
|
+
boxLines.push(
|
|
213
|
+
`${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`
|
|
214
|
+
);
|
|
215
|
+
} else {
|
|
216
|
+
boxLines.push(
|
|
217
|
+
`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
|
|
221
|
+
for (let i2 = 0; i2 < height; i2++) {
|
|
222
|
+
if (i2 < valignOffset || i2 >= valignOffset + textLines.length) {
|
|
223
|
+
boxLines.push(
|
|
224
|
+
`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`
|
|
225
|
+
);
|
|
226
|
+
} else {
|
|
227
|
+
const line = textLines[i2 - valignOffset];
|
|
228
|
+
const left = " ".repeat(paddingOffset);
|
|
229
|
+
const right = " ".repeat(width - stripAnsi(line).length);
|
|
230
|
+
boxLines.push(
|
|
231
|
+
`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
boxLines.push(
|
|
236
|
+
`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`
|
|
237
|
+
);
|
|
238
|
+
if (opts.style.marginBottom > 0) {
|
|
239
|
+
boxLines.push("".repeat(opts.style.marginBottom));
|
|
240
|
+
}
|
|
241
|
+
return boxLines.join("\n");
|
|
89
242
|
}
|
|
90
|
-
var p2 = p(isatty(1));
|
|
91
243
|
var EventEmitter = class {
|
|
92
244
|
constructor() {
|
|
93
245
|
this.#emitter.setMaxListeners(100);
|
|
@@ -217,7 +369,7 @@ function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
|
217
369
|
function createDefu(merger) {
|
|
218
370
|
return (...arguments_) => (
|
|
219
371
|
// eslint-disable-next-line unicorn/no-array-reduce
|
|
220
|
-
arguments_.reduce((
|
|
372
|
+
arguments_.reduce((p, c2) => _defu(p, c2, ""), {})
|
|
221
373
|
);
|
|
222
374
|
}
|
|
223
375
|
var defu = createDefu();
|
|
@@ -670,248 +822,13 @@ ${indent}`);
|
|
|
670
822
|
);
|
|
671
823
|
}
|
|
672
824
|
};
|
|
673
|
-
var
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
} = typeof process === "undefined" ? {} : process;
|
|
678
|
-
var isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
679
|
-
var isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
680
|
-
var isWindows = platform === "win32";
|
|
681
|
-
var isDumbTerminal = env.TERM === "dumb";
|
|
682
|
-
var isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
|
|
683
|
-
var isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
684
|
-
var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
685
|
-
function replaceClose(index, string, close, replace, head = string.slice(0, Math.max(0, index)) + replace, tail = string.slice(Math.max(0, index + close.length)), next = tail.indexOf(close)) {
|
|
686
|
-
return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
687
|
-
}
|
|
688
|
-
function clearBleed(index, string, open, close, replace) {
|
|
689
|
-
return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
690
|
-
}
|
|
691
|
-
function filterEmpty(open, close, replace = open, at = open.length + 1) {
|
|
692
|
-
return (string) => string || !(string === "" || string === void 0) ? clearBleed(
|
|
693
|
-
("" + string).indexOf(close, at),
|
|
694
|
-
string,
|
|
695
|
-
open,
|
|
696
|
-
close,
|
|
697
|
-
replace
|
|
698
|
-
) : "";
|
|
699
|
-
}
|
|
700
|
-
function init(open, close, replace) {
|
|
701
|
-
return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
|
|
702
|
-
}
|
|
703
|
-
var colorDefs = {
|
|
704
|
-
reset: init(0, 0),
|
|
705
|
-
bold: init(1, 22, "\x1B[22m\x1B[1m"),
|
|
706
|
-
dim: init(2, 22, "\x1B[22m\x1B[2m"),
|
|
707
|
-
italic: init(3, 23),
|
|
708
|
-
underline: init(4, 24),
|
|
709
|
-
inverse: init(7, 27),
|
|
710
|
-
hidden: init(8, 28),
|
|
711
|
-
strikethrough: init(9, 29),
|
|
712
|
-
black: init(30, 39),
|
|
713
|
-
red: init(31, 39),
|
|
714
|
-
green: init(32, 39),
|
|
715
|
-
yellow: init(33, 39),
|
|
716
|
-
blue: init(34, 39),
|
|
717
|
-
magenta: init(35, 39),
|
|
718
|
-
cyan: init(36, 39),
|
|
719
|
-
white: init(37, 39),
|
|
720
|
-
gray: init(90, 39),
|
|
721
|
-
bgBlack: init(40, 49),
|
|
722
|
-
bgRed: init(41, 49),
|
|
723
|
-
bgGreen: init(42, 49),
|
|
724
|
-
bgYellow: init(43, 49),
|
|
725
|
-
bgBlue: init(44, 49),
|
|
726
|
-
bgMagenta: init(45, 49),
|
|
727
|
-
bgCyan: init(46, 49),
|
|
728
|
-
bgWhite: init(47, 49),
|
|
729
|
-
blackBright: init(90, 39),
|
|
730
|
-
redBright: init(91, 39),
|
|
731
|
-
greenBright: init(92, 39),
|
|
732
|
-
yellowBright: init(93, 39),
|
|
733
|
-
blueBright: init(94, 39),
|
|
734
|
-
magentaBright: init(95, 39),
|
|
735
|
-
cyanBright: init(96, 39),
|
|
736
|
-
whiteBright: init(97, 39),
|
|
737
|
-
bgBlackBright: init(100, 49),
|
|
738
|
-
bgRedBright: init(101, 49),
|
|
739
|
-
bgGreenBright: init(102, 49),
|
|
740
|
-
bgYellowBright: init(103, 49),
|
|
741
|
-
bgBlueBright: init(104, 49),
|
|
742
|
-
bgMagentaBright: init(105, 49),
|
|
743
|
-
bgCyanBright: init(106, 49),
|
|
744
|
-
bgWhiteBright: init(107, 49)
|
|
745
|
-
};
|
|
746
|
-
function createColors(useColor = isColorSupported) {
|
|
747
|
-
return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
|
|
748
|
-
}
|
|
749
|
-
var colors = createColors();
|
|
750
|
-
function getColor(color, fallback = "reset") {
|
|
751
|
-
return colors[color] || colors[fallback];
|
|
752
|
-
}
|
|
753
|
-
var ansiRegex = [
|
|
754
|
-
String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`,
|
|
755
|
-
String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`
|
|
756
|
-
].join("|");
|
|
757
|
-
function stripAnsi(text) {
|
|
758
|
-
return text.replace(new RegExp(ansiRegex, "g"), "");
|
|
759
|
-
}
|
|
760
|
-
var boxStylePresets = {
|
|
761
|
-
solid: {
|
|
762
|
-
tl: "\u250C",
|
|
763
|
-
tr: "\u2510",
|
|
764
|
-
bl: "\u2514",
|
|
765
|
-
br: "\u2518",
|
|
766
|
-
h: "\u2500",
|
|
767
|
-
v: "\u2502"
|
|
768
|
-
},
|
|
769
|
-
double: {
|
|
770
|
-
tl: "\u2554",
|
|
771
|
-
tr: "\u2557",
|
|
772
|
-
bl: "\u255A",
|
|
773
|
-
br: "\u255D",
|
|
774
|
-
h: "\u2550",
|
|
775
|
-
v: "\u2551"
|
|
776
|
-
},
|
|
777
|
-
doubleSingle: {
|
|
778
|
-
tl: "\u2553",
|
|
779
|
-
tr: "\u2556",
|
|
780
|
-
bl: "\u2559",
|
|
781
|
-
br: "\u255C",
|
|
782
|
-
h: "\u2500",
|
|
783
|
-
v: "\u2551"
|
|
784
|
-
},
|
|
785
|
-
doubleSingleRounded: {
|
|
786
|
-
tl: "\u256D",
|
|
787
|
-
tr: "\u256E",
|
|
788
|
-
bl: "\u2570",
|
|
789
|
-
br: "\u256F",
|
|
790
|
-
h: "\u2500",
|
|
791
|
-
v: "\u2551"
|
|
792
|
-
},
|
|
793
|
-
singleThick: {
|
|
794
|
-
tl: "\u250F",
|
|
795
|
-
tr: "\u2513",
|
|
796
|
-
bl: "\u2517",
|
|
797
|
-
br: "\u251B",
|
|
798
|
-
h: "\u2501",
|
|
799
|
-
v: "\u2503"
|
|
800
|
-
},
|
|
801
|
-
singleDouble: {
|
|
802
|
-
tl: "\u2552",
|
|
803
|
-
tr: "\u2555",
|
|
804
|
-
bl: "\u2558",
|
|
805
|
-
br: "\u255B",
|
|
806
|
-
h: "\u2550",
|
|
807
|
-
v: "\u2502"
|
|
808
|
-
},
|
|
809
|
-
singleDoubleRounded: {
|
|
810
|
-
tl: "\u256D",
|
|
811
|
-
tr: "\u256E",
|
|
812
|
-
bl: "\u2570",
|
|
813
|
-
br: "\u256F",
|
|
814
|
-
h: "\u2550",
|
|
815
|
-
v: "\u2502"
|
|
816
|
-
},
|
|
817
|
-
rounded: {
|
|
818
|
-
tl: "\u256D",
|
|
819
|
-
tr: "\u256E",
|
|
820
|
-
bl: "\u2570",
|
|
821
|
-
br: "\u256F",
|
|
822
|
-
h: "\u2500",
|
|
823
|
-
v: "\u2502"
|
|
824
|
-
}
|
|
825
|
-
};
|
|
826
|
-
var defaultStyle = {
|
|
827
|
-
borderColor: "white",
|
|
828
|
-
borderStyle: "rounded",
|
|
829
|
-
valign: "center",
|
|
830
|
-
padding: 2,
|
|
831
|
-
marginLeft: 1,
|
|
832
|
-
marginTop: 1,
|
|
833
|
-
marginBottom: 1
|
|
834
|
-
};
|
|
835
|
-
function box(text, _opts = {}) {
|
|
836
|
-
const opts = {
|
|
837
|
-
..._opts,
|
|
838
|
-
style: {
|
|
839
|
-
...defaultStyle,
|
|
840
|
-
..._opts.style
|
|
841
|
-
}
|
|
842
|
-
};
|
|
843
|
-
const textLines = text.split("\n");
|
|
844
|
-
const boxLines = [];
|
|
845
|
-
const _color = getColor(opts.style.borderColor);
|
|
846
|
-
const borderStyle = {
|
|
847
|
-
...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
|
|
848
|
-
};
|
|
849
|
-
if (_color) {
|
|
850
|
-
for (const key in borderStyle) {
|
|
851
|
-
borderStyle[key] = _color(
|
|
852
|
-
borderStyle[key]
|
|
853
|
-
);
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
|
|
857
|
-
const height = textLines.length + paddingOffset;
|
|
858
|
-
const width = Math.max(
|
|
859
|
-
...textLines.map((line) => stripAnsi(line).length),
|
|
860
|
-
opts.title ? stripAnsi(opts.title).length : 0
|
|
861
|
-
) + paddingOffset;
|
|
862
|
-
const widthOffset = width + paddingOffset;
|
|
863
|
-
const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
|
|
864
|
-
if (opts.style.marginTop > 0) {
|
|
865
|
-
boxLines.push("".repeat(opts.style.marginTop));
|
|
866
|
-
}
|
|
867
|
-
if (opts.title) {
|
|
868
|
-
const title = _color ? _color(opts.title) : opts.title;
|
|
869
|
-
const left = borderStyle.h.repeat(
|
|
870
|
-
Math.floor((width - stripAnsi(opts.title).length) / 2)
|
|
871
|
-
);
|
|
872
|
-
const right = borderStyle.h.repeat(
|
|
873
|
-
width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset
|
|
874
|
-
);
|
|
875
|
-
boxLines.push(
|
|
876
|
-
`${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`
|
|
877
|
-
);
|
|
878
|
-
} else {
|
|
879
|
-
boxLines.push(
|
|
880
|
-
`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`
|
|
881
|
-
);
|
|
882
|
-
}
|
|
883
|
-
const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
|
|
884
|
-
for (let i2 = 0; i2 < height; i2++) {
|
|
885
|
-
if (i2 < valignOffset || i2 >= valignOffset + textLines.length) {
|
|
886
|
-
boxLines.push(
|
|
887
|
-
`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`
|
|
888
|
-
);
|
|
889
|
-
} else {
|
|
890
|
-
const line = textLines[i2 - valignOffset];
|
|
891
|
-
const left = " ".repeat(paddingOffset);
|
|
892
|
-
const right = " ".repeat(width - stripAnsi(line).length);
|
|
893
|
-
boxLines.push(
|
|
894
|
-
`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`
|
|
895
|
-
);
|
|
896
|
-
}
|
|
897
|
-
}
|
|
898
|
-
boxLines.push(
|
|
899
|
-
`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`
|
|
900
|
-
);
|
|
901
|
-
if (opts.style.marginBottom > 0) {
|
|
902
|
-
boxLines.push("".repeat(opts.style.marginBottom));
|
|
903
|
-
}
|
|
904
|
-
return boxLines.join("\n");
|
|
905
|
-
}
|
|
906
|
-
|
|
907
|
-
// ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/index.mjs
|
|
908
|
-
var r2 = /* @__PURE__ */ Object.create(null);
|
|
909
|
-
var i = (e) => globalThis.process?.env || import.meta.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? r2 : globalThis);
|
|
910
|
-
var o = new Proxy(r2, { get(e, s2) {
|
|
911
|
-
return i()[s2] ?? r2[s2];
|
|
825
|
+
var r = /* @__PURE__ */ Object.create(null);
|
|
826
|
+
var i = (e) => globalThis.process?.env || import.meta.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? r : globalThis);
|
|
827
|
+
var o = new Proxy(r, { get(e, s2) {
|
|
828
|
+
return i()[s2] ?? r[s2];
|
|
912
829
|
}, has(e, s2) {
|
|
913
830
|
const E = i();
|
|
914
|
-
return s2 in E || s2 in
|
|
831
|
+
return s2 in E || s2 in r;
|
|
915
832
|
}, set(e, s2, E) {
|
|
916
833
|
const B = i(true);
|
|
917
834
|
return B[s2] = E, true;
|
|
@@ -924,9 +841,9 @@ var o = new Proxy(r2, { get(e, s2) {
|
|
|
924
841
|
return Object.keys(e);
|
|
925
842
|
} });
|
|
926
843
|
var t = typeof process < "u" && process.env && process.env.NODE_ENV || "";
|
|
927
|
-
var
|
|
844
|
+
var f = [["APPVEYOR"], ["AWS_AMPLIFY", "AWS_APP_ID", { ci: true }], ["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"], ["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"], ["APPCIRCLE", "AC_APPCIRCLE"], ["BAMBOO", "bamboo_planKey"], ["BITBUCKET", "BITBUCKET_COMMIT"], ["BITRISE", "BITRISE_IO"], ["BUDDY", "BUDDY_WORKSPACE_ID"], ["BUILDKITE"], ["CIRCLE", "CIRCLECI"], ["CIRRUS", "CIRRUS_CI"], ["CLOUDFLARE_PAGES", "CF_PAGES", { ci: true }], ["CODEBUILD", "CODEBUILD_BUILD_ARN"], ["CODEFRESH", "CF_BUILD_ID"], ["DRONE"], ["DRONE", "DRONE_BUILD_EVENT"], ["DSARI"], ["GITHUB_ACTIONS"], ["GITLAB", "GITLAB_CI"], ["GITLAB", "CI_MERGE_REQUEST_ID"], ["GOCD", "GO_PIPELINE_LABEL"], ["LAYERCI"], ["HUDSON", "HUDSON_URL"], ["JENKINS", "JENKINS_URL"], ["MAGNUM"], ["NETLIFY"], ["NETLIFY", "NETLIFY_LOCAL", { ci: false }], ["NEVERCODE"], ["RENDER"], ["SAIL", "SAILCI"], ["SEMAPHORE"], ["SCREWDRIVER"], ["SHIPPABLE"], ["SOLANO", "TDDIUM"], ["STRIDER"], ["TEAMCITY", "TEAMCITY_VERSION"], ["TRAVIS"], ["VERCEL", "NOW_BUILDER"], ["VERCEL", "VERCEL", { ci: false }], ["VERCEL", "VERCEL_ENV", { ci: false }], ["APPCENTER", "APPCENTER_BUILD_ID"], ["CODESANDBOX", "CODESANDBOX_SSE", { ci: false }], ["CODESANDBOX", "CODESANDBOX_HOST", { ci: false }], ["STACKBLITZ"], ["STORMKIT"], ["CLEAVR"], ["ZEABUR"], ["CODESPHERE", "CODESPHERE_APP_ID", { ci: true }], ["RAILWAY", "RAILWAY_PROJECT_ID"], ["RAILWAY", "RAILWAY_SERVICE_ID"], ["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"], ["FIREBASE_APP_HOSTING", "FIREBASE_APP_HOSTING", { ci: true }]];
|
|
928
845
|
function b() {
|
|
929
|
-
if (globalThis.process?.env) for (const e of
|
|
846
|
+
if (globalThis.process?.env) for (const e of f) {
|
|
930
847
|
const s2 = e[1] || e[0];
|
|
931
848
|
if (globalThis.process?.env[s2]) return { name: e[0].toLowerCase(), ...e[2] };
|
|
932
849
|
}
|
|
@@ -939,14 +856,14 @@ function n(e) {
|
|
|
939
856
|
}
|
|
940
857
|
var I = globalThis.process?.platform || "";
|
|
941
858
|
var T = n(o.CI) || l.ci !== false;
|
|
942
|
-
var
|
|
859
|
+
var a = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY);
|
|
943
860
|
var g = n(o.DEBUG);
|
|
944
861
|
var R = t === "test" || n(o.TEST);
|
|
945
|
-
n(o.MINIMAL) || T || R || !
|
|
862
|
+
n(o.MINIMAL) || T || R || !a;
|
|
946
863
|
var A = /^win/i.test(I);
|
|
947
|
-
!n(o.NO_COLOR) && (n(o.FORCE_COLOR) || (
|
|
948
|
-
var
|
|
949
|
-
Number(
|
|
864
|
+
!n(o.NO_COLOR) && (n(o.FORCE_COLOR) || (a || A) && o.TERM !== "dumb" || T);
|
|
865
|
+
var C = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
|
|
866
|
+
Number(C?.split(".")[0]) || null;
|
|
950
867
|
var y = globalThis.process || /* @__PURE__ */ Object.create(null);
|
|
951
868
|
var _ = { versions: {} };
|
|
952
869
|
new Proxy(y, { get(e, s2) {
|
|
@@ -1099,7 +1016,7 @@ var FancyReporter = class extends BasicReporter {
|
|
|
1099
1016
|
const indent = " ".repeat((opts?.errorLevel || 0) + 1);
|
|
1100
1017
|
return `
|
|
1101
1018
|
${indent}` + parseStack(stack, message).map(
|
|
1102
|
-
(line) => " " + line.replace(/^at +/, (
|
|
1019
|
+
(line) => " " + line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_2, m) => `(${colors.cyan(m)})`)
|
|
1103
1020
|
).join(`
|
|
1104
1021
|
${indent}`);
|
|
1105
1022
|
}
|
|
@@ -1149,7 +1066,7 @@ ${indent}`);
|
|
|
1149
1066
|
}
|
|
1150
1067
|
};
|
|
1151
1068
|
function characterFormat(str) {
|
|
1152
|
-
return str.replace(/`([^`]+)`/gm, (_2,
|
|
1069
|
+
return str.replace(/`([^`]+)`/gm, (_2, m) => colors.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_2, m) => ` ${colors.underline(m)} `);
|
|
1153
1070
|
}
|
|
1154
1071
|
function getColor2(color = "white") {
|
|
1155
1072
|
return colors[color] || colors.white;
|
|
@@ -1167,7 +1084,7 @@ function createConsola2(options = {}) {
|
|
|
1167
1084
|
defaults: { level },
|
|
1168
1085
|
stdout: process.stdout,
|
|
1169
1086
|
stderr: process.stderr,
|
|
1170
|
-
prompt: (...args) => import('./prompt-UVNS6X7J.js').then((
|
|
1087
|
+
prompt: (...args) => import('./prompt-UVNS6X7J.js').then((m) => m.prompt(...args)),
|
|
1171
1088
|
reporters: options.reporters || [
|
|
1172
1089
|
options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()
|
|
1173
1090
|
],
|
|
@@ -1213,10 +1130,10 @@ function createLogger({ logLevel = 3, name, consola: _consola } = {}) {
|
|
|
1213
1130
|
consola2.success(message);
|
|
1214
1131
|
});
|
|
1215
1132
|
events.on("warning", (message) => {
|
|
1216
|
-
consola2.warn(
|
|
1133
|
+
consola2.warn(colors.yellow(message));
|
|
1217
1134
|
});
|
|
1218
1135
|
events.on("info", (message) => {
|
|
1219
|
-
consola2.info(
|
|
1136
|
+
consola2.info(colors.yellow(message));
|
|
1220
1137
|
});
|
|
1221
1138
|
events.on("debug", (message) => {
|
|
1222
1139
|
if (message.logs.join("\n\n").length <= 100 && logLevel === LogMapper.debug) {
|
|
@@ -1261,33 +1178,23 @@ function createLogger({ logLevel = 3, name, consola: _consola } = {}) {
|
|
|
1261
1178
|
};
|
|
1262
1179
|
return logger;
|
|
1263
1180
|
}
|
|
1264
|
-
|
|
1265
|
-
function randomColour(text, colours = defaultColours) {
|
|
1181
|
+
function randomColour(text) {
|
|
1266
1182
|
if (!text) {
|
|
1267
1183
|
return "white";
|
|
1268
1184
|
}
|
|
1185
|
+
const defaultColours = ["black", "red", "green", "yellow", "blue", "red", "green", "magenta", "cyan", "gray"];
|
|
1269
1186
|
const random = seedrandom(text);
|
|
1270
|
-
const colour =
|
|
1187
|
+
const colour = defaultColours.at(Math.floor(random() * defaultColours.length)) || "white";
|
|
1271
1188
|
return colour;
|
|
1272
1189
|
}
|
|
1273
|
-
function randomCliColour(text
|
|
1274
|
-
const colours = p(true);
|
|
1190
|
+
function randomCliColour(text) {
|
|
1275
1191
|
if (!text) {
|
|
1276
|
-
return
|
|
1277
|
-
}
|
|
1278
|
-
const colour = randomColour(text, colors2);
|
|
1279
|
-
const isDark = colour.includes("dark");
|
|
1280
|
-
const key = colour.replace("dark", "").toLowerCase();
|
|
1281
|
-
const formatter = colours[key];
|
|
1282
|
-
if (isDark) {
|
|
1283
|
-
return p2.bold(formatter(text));
|
|
1284
|
-
}
|
|
1285
|
-
if (typeof formatter !== "function") {
|
|
1286
|
-
throw new Error("Formatter for picoColor is not of type function/Formatter");
|
|
1192
|
+
return "";
|
|
1287
1193
|
}
|
|
1288
|
-
|
|
1194
|
+
const colour = randomColour(text);
|
|
1195
|
+
return colors[colour]?.(text);
|
|
1289
1196
|
}
|
|
1290
1197
|
|
|
1291
1198
|
export { EventEmitter, LogMapper, createLogger, randomCliColour, randomColour };
|
|
1292
|
-
//# sourceMappingURL=chunk-
|
|
1293
|
-
//# sourceMappingURL=chunk-
|
|
1199
|
+
//# sourceMappingURL=chunk-4ESUQQVB.js.map
|
|
1200
|
+
//# sourceMappingURL=chunk-4ESUQQVB.js.map
|