@kubb/agent 4.29.1 → 4.31.0
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/.output/nitro.json +1 -1
- package/.output/server/chunks/nitro/nitro.mjs +505 -339
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/chunks/routes/api/health.get.mjs +3 -1
- package/.output/server/chunks/routes/api/health.get.mjs.map +1 -1
- package/.output/server/index.mjs +3 -1
- package/.output/server/index.mjs.map +1 -1
- package/.output/server/node_modules/@kubb/fabric-core/dist/index.js +6 -3
- package/.output/server/node_modules/@kubb/fabric-core/dist/{onProcessExit-CF200hsz.js → onProcessExit-B0rJqX4s.js} +7 -1
- package/.output/server/node_modules/@kubb/fabric-core/dist/plugins.js +1 -1
- package/.output/server/node_modules/@kubb/fabric-core/package.json +1 -1
- package/.output/server/node_modules/@kubb/react-fabric/dist/index.js +1 -1
- package/.output/server/node_modules/@kubb/react-fabric/dist/plugins.js +1 -1
- package/.output/server/node_modules/@kubb/react-fabric/dist/{reactPlugin-BkDkx1cs.js → reactPlugin-tE73eBS_.js} +5 -1
- package/.output/server/node_modules/@kubb/react-fabric/package.json +2 -2
- package/.output/server/node_modules/@logtail/core/dist/cjs/base.js +339 -0
- package/.output/server/node_modules/@logtail/core/dist/cjs/index.js +9 -0
- package/.output/server/node_modules/@logtail/core/package.json +45 -0
- package/.output/server/node_modules/@logtail/node/dist/cjs/context.js +93 -0
- package/.output/server/node_modules/@logtail/node/dist/cjs/index.js +6 -0
- package/.output/server/node_modules/@logtail/node/dist/cjs/node.js +106 -0
- package/.output/server/node_modules/@logtail/node/package.json +53 -0
- package/.output/server/node_modules/@logtail/tools/dist/cjs/batch.js +122 -0
- package/.output/server/node_modules/@logtail/tools/dist/cjs/burstProtection.js +50 -0
- package/.output/server/node_modules/@logtail/tools/dist/cjs/encode.js +12 -0
- package/.output/server/node_modules/@logtail/tools/dist/cjs/index.js +41 -0
- package/.output/server/node_modules/@logtail/tools/dist/cjs/queue.js +41 -0
- package/.output/server/node_modules/@logtail/tools/dist/cjs/throttle.js +67 -0
- package/.output/server/node_modules/@logtail/tools/package.json +39 -0
- package/.output/server/node_modules/@logtail/types/dist/cjs/types.js +21 -0
- package/.output/server/node_modules/@logtail/types/package.json +45 -0
- package/.output/server/node_modules/@msgpack/msgpack/dist/CachedKeyDecoder.js +63 -0
- package/.output/server/node_modules/@msgpack/msgpack/dist/DecodeError.js +18 -0
- package/.output/server/node_modules/@msgpack/msgpack/dist/Decoder.js +583 -0
- package/.output/server/node_modules/@msgpack/msgpack/dist/Encoder.js +408 -0
- package/.output/server/node_modules/@msgpack/msgpack/dist/ExtData.js +14 -0
- package/.output/server/node_modules/@msgpack/msgpack/dist/ExtensionCodec.js +72 -0
- package/.output/server/node_modules/@msgpack/msgpack/dist/decode.js +32 -0
- package/.output/server/node_modules/@msgpack/msgpack/dist/decodeAsync.js +44 -0
- package/.output/server/node_modules/@msgpack/msgpack/dist/encode.js +17 -0
- package/.output/server/node_modules/@msgpack/msgpack/dist/index.js +34 -0
- package/.output/server/node_modules/@msgpack/msgpack/dist/timestamp.js +104 -0
- package/.output/server/node_modules/@msgpack/msgpack/dist/utils/int.js +34 -0
- package/.output/server/node_modules/@msgpack/msgpack/dist/utils/prettyByte.js +8 -0
- package/.output/server/node_modules/@msgpack/msgpack/dist/utils/stream.js +40 -0
- package/.output/server/node_modules/@msgpack/msgpack/dist/utils/typedArrays.js +28 -0
- package/.output/server/node_modules/@msgpack/msgpack/dist/utils/utf8.js +167 -0
- package/.output/server/node_modules/@msgpack/msgpack/package.json +100 -0
- package/.output/server/node_modules/consola/dist/chunks/prompt.mjs +280 -0
- package/.output/server/node_modules/consola/dist/core.mjs +512 -0
- package/.output/server/node_modules/consola/dist/index.mjs +651 -0
- package/.output/server/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs +72 -0
- package/.output/server/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs +288 -0
- package/.output/server/node_modules/consola/package.json +136 -0
- package/.output/server/node_modules/serialize-error/index.js +154 -0
- package/.output/server/node_modules/serialize-error/package.json +41 -0
- package/.output/server/node_modules/stack-trace/lib/stack-trace.js +136 -0
- package/.output/server/node_modules/stack-trace/package.json +21 -0
- package/.output/server/package.json +11 -3
- package/README.md +3 -3
- package/package.json +23 -18
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { formatWithOptions } from 'node:util';
|
|
2
|
+
import { sep } from 'node:path';
|
|
3
|
+
|
|
4
|
+
function parseStack(stack, message) {
|
|
5
|
+
const cwd = process.cwd() + sep;
|
|
6
|
+
const lines = stack.split("\n").splice(message.split("\n").length).map((l) => l.trim().replace("file://", "").replace(cwd, ""));
|
|
7
|
+
return lines;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function writeStream(data, stream) {
|
|
11
|
+
const write = stream.__write || stream.write;
|
|
12
|
+
return write.call(stream, data);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const bracket = (x) => x ? `[${x}]` : "";
|
|
16
|
+
class BasicReporter {
|
|
17
|
+
formatStack(stack, message, opts) {
|
|
18
|
+
const indent = " ".repeat((opts?.errorLevel || 0) + 1);
|
|
19
|
+
return indent + parseStack(stack, message).join(`
|
|
20
|
+
${indent}`);
|
|
21
|
+
}
|
|
22
|
+
formatError(err, opts) {
|
|
23
|
+
const message = err.message ?? formatWithOptions(opts, err);
|
|
24
|
+
const stack = err.stack ? this.formatStack(err.stack, message, opts) : "";
|
|
25
|
+
const level = opts?.errorLevel || 0;
|
|
26
|
+
const causedPrefix = level > 0 ? `${" ".repeat(level)}[cause]: ` : "";
|
|
27
|
+
const causedError = err.cause ? "\n\n" + this.formatError(err.cause, { ...opts, errorLevel: level + 1 }) : "";
|
|
28
|
+
return causedPrefix + message + "\n" + stack + causedError;
|
|
29
|
+
}
|
|
30
|
+
formatArgs(args, opts) {
|
|
31
|
+
const _args = args.map((arg) => {
|
|
32
|
+
if (arg && typeof arg.stack === "string") {
|
|
33
|
+
return this.formatError(arg, opts);
|
|
34
|
+
}
|
|
35
|
+
return arg;
|
|
36
|
+
});
|
|
37
|
+
return formatWithOptions(opts, ..._args);
|
|
38
|
+
}
|
|
39
|
+
formatDate(date, opts) {
|
|
40
|
+
return opts.date ? date.toLocaleTimeString() : "";
|
|
41
|
+
}
|
|
42
|
+
filterAndJoin(arr) {
|
|
43
|
+
return arr.filter(Boolean).join(" ");
|
|
44
|
+
}
|
|
45
|
+
formatLogObj(logObj, opts) {
|
|
46
|
+
const message = this.formatArgs(logObj.args, opts);
|
|
47
|
+
if (logObj.type === "box") {
|
|
48
|
+
return "\n" + [
|
|
49
|
+
bracket(logObj.tag),
|
|
50
|
+
logObj.title && logObj.title,
|
|
51
|
+
...message.split("\n")
|
|
52
|
+
].filter(Boolean).map((l) => " > " + l).join("\n") + "\n";
|
|
53
|
+
}
|
|
54
|
+
return this.filterAndJoin([
|
|
55
|
+
bracket(logObj.type),
|
|
56
|
+
bracket(logObj.tag),
|
|
57
|
+
message
|
|
58
|
+
]);
|
|
59
|
+
}
|
|
60
|
+
log(logObj, ctx) {
|
|
61
|
+
const line = this.formatLogObj(logObj, {
|
|
62
|
+
columns: ctx.options.stdout.columns || 0,
|
|
63
|
+
...ctx.options.formatOptions
|
|
64
|
+
});
|
|
65
|
+
return writeStream(
|
|
66
|
+
line + "\n",
|
|
67
|
+
logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export { BasicReporter as B, parseStack as p };
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import * as tty from 'node:tty';
|
|
2
|
+
|
|
3
|
+
const {
|
|
4
|
+
env = {},
|
|
5
|
+
argv = [],
|
|
6
|
+
platform = ""
|
|
7
|
+
} = typeof process === "undefined" ? {} : process;
|
|
8
|
+
const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
9
|
+
const isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
10
|
+
const isWindows = platform === "win32";
|
|
11
|
+
const isDumbTerminal = env.TERM === "dumb";
|
|
12
|
+
const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
|
|
13
|
+
const isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
14
|
+
const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
15
|
+
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)) {
|
|
16
|
+
return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
17
|
+
}
|
|
18
|
+
function clearBleed(index, string, open, close, replace) {
|
|
19
|
+
return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
20
|
+
}
|
|
21
|
+
function filterEmpty(open, close, replace = open, at = open.length + 1) {
|
|
22
|
+
return (string) => string || !(string === "" || string === void 0) ? clearBleed(
|
|
23
|
+
("" + string).indexOf(close, at),
|
|
24
|
+
string,
|
|
25
|
+
open,
|
|
26
|
+
close,
|
|
27
|
+
replace
|
|
28
|
+
) : "";
|
|
29
|
+
}
|
|
30
|
+
function init(open, close, replace) {
|
|
31
|
+
return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
|
|
32
|
+
}
|
|
33
|
+
const colorDefs = {
|
|
34
|
+
reset: init(0, 0),
|
|
35
|
+
bold: init(1, 22, "\x1B[22m\x1B[1m"),
|
|
36
|
+
dim: init(2, 22, "\x1B[22m\x1B[2m"),
|
|
37
|
+
italic: init(3, 23),
|
|
38
|
+
underline: init(4, 24),
|
|
39
|
+
inverse: init(7, 27),
|
|
40
|
+
hidden: init(8, 28),
|
|
41
|
+
strikethrough: init(9, 29),
|
|
42
|
+
black: init(30, 39),
|
|
43
|
+
red: init(31, 39),
|
|
44
|
+
green: init(32, 39),
|
|
45
|
+
yellow: init(33, 39),
|
|
46
|
+
blue: init(34, 39),
|
|
47
|
+
magenta: init(35, 39),
|
|
48
|
+
cyan: init(36, 39),
|
|
49
|
+
white: init(37, 39),
|
|
50
|
+
gray: init(90, 39),
|
|
51
|
+
bgBlack: init(40, 49),
|
|
52
|
+
bgRed: init(41, 49),
|
|
53
|
+
bgGreen: init(42, 49),
|
|
54
|
+
bgYellow: init(43, 49),
|
|
55
|
+
bgBlue: init(44, 49),
|
|
56
|
+
bgMagenta: init(45, 49),
|
|
57
|
+
bgCyan: init(46, 49),
|
|
58
|
+
bgWhite: init(47, 49),
|
|
59
|
+
blackBright: init(90, 39),
|
|
60
|
+
redBright: init(91, 39),
|
|
61
|
+
greenBright: init(92, 39),
|
|
62
|
+
yellowBright: init(93, 39),
|
|
63
|
+
blueBright: init(94, 39),
|
|
64
|
+
magentaBright: init(95, 39),
|
|
65
|
+
cyanBright: init(96, 39),
|
|
66
|
+
whiteBright: init(97, 39),
|
|
67
|
+
bgBlackBright: init(100, 49),
|
|
68
|
+
bgRedBright: init(101, 49),
|
|
69
|
+
bgGreenBright: init(102, 49),
|
|
70
|
+
bgYellowBright: init(103, 49),
|
|
71
|
+
bgBlueBright: init(104, 49),
|
|
72
|
+
bgMagentaBright: init(105, 49),
|
|
73
|
+
bgCyanBright: init(106, 49),
|
|
74
|
+
bgWhiteBright: init(107, 49)
|
|
75
|
+
};
|
|
76
|
+
function createColors(useColor = isColorSupported) {
|
|
77
|
+
return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
|
|
78
|
+
}
|
|
79
|
+
const colors = createColors();
|
|
80
|
+
function getColor(color, fallback = "reset") {
|
|
81
|
+
return colors[color] || colors[fallback];
|
|
82
|
+
}
|
|
83
|
+
function colorize(color, text) {
|
|
84
|
+
return getColor(color)(text);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const ansiRegex = [
|
|
88
|
+
String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`,
|
|
89
|
+
String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`
|
|
90
|
+
].join("|");
|
|
91
|
+
function stripAnsi(text) {
|
|
92
|
+
return text.replace(new RegExp(ansiRegex, "g"), "");
|
|
93
|
+
}
|
|
94
|
+
function centerAlign(str, len, space = " ") {
|
|
95
|
+
const free = len - str.length;
|
|
96
|
+
if (free <= 0) {
|
|
97
|
+
return str;
|
|
98
|
+
}
|
|
99
|
+
const freeLeft = Math.floor(free / 2);
|
|
100
|
+
let _str = "";
|
|
101
|
+
for (let i = 0; i < len; i++) {
|
|
102
|
+
_str += i < freeLeft || i >= freeLeft + str.length ? space : str[i - freeLeft];
|
|
103
|
+
}
|
|
104
|
+
return _str;
|
|
105
|
+
}
|
|
106
|
+
function rightAlign(str, len, space = " ") {
|
|
107
|
+
const free = len - str.length;
|
|
108
|
+
if (free <= 0) {
|
|
109
|
+
return str;
|
|
110
|
+
}
|
|
111
|
+
let _str = "";
|
|
112
|
+
for (let i = 0; i < len; i++) {
|
|
113
|
+
_str += i < free ? space : str[i - free];
|
|
114
|
+
}
|
|
115
|
+
return _str;
|
|
116
|
+
}
|
|
117
|
+
function leftAlign(str, len, space = " ") {
|
|
118
|
+
let _str = "";
|
|
119
|
+
for (let i = 0; i < len; i++) {
|
|
120
|
+
_str += i < str.length ? str[i] : space;
|
|
121
|
+
}
|
|
122
|
+
return _str;
|
|
123
|
+
}
|
|
124
|
+
function align(alignment, str, len, space = " ") {
|
|
125
|
+
switch (alignment) {
|
|
126
|
+
case "left": {
|
|
127
|
+
return leftAlign(str, len, space);
|
|
128
|
+
}
|
|
129
|
+
case "right": {
|
|
130
|
+
return rightAlign(str, len, space);
|
|
131
|
+
}
|
|
132
|
+
case "center": {
|
|
133
|
+
return centerAlign(str, len, space);
|
|
134
|
+
}
|
|
135
|
+
default: {
|
|
136
|
+
return str;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
const boxStylePresets = {
|
|
142
|
+
solid: {
|
|
143
|
+
tl: "\u250C",
|
|
144
|
+
tr: "\u2510",
|
|
145
|
+
bl: "\u2514",
|
|
146
|
+
br: "\u2518",
|
|
147
|
+
h: "\u2500",
|
|
148
|
+
v: "\u2502"
|
|
149
|
+
},
|
|
150
|
+
double: {
|
|
151
|
+
tl: "\u2554",
|
|
152
|
+
tr: "\u2557",
|
|
153
|
+
bl: "\u255A",
|
|
154
|
+
br: "\u255D",
|
|
155
|
+
h: "\u2550",
|
|
156
|
+
v: "\u2551"
|
|
157
|
+
},
|
|
158
|
+
doubleSingle: {
|
|
159
|
+
tl: "\u2553",
|
|
160
|
+
tr: "\u2556",
|
|
161
|
+
bl: "\u2559",
|
|
162
|
+
br: "\u255C",
|
|
163
|
+
h: "\u2500",
|
|
164
|
+
v: "\u2551"
|
|
165
|
+
},
|
|
166
|
+
doubleSingleRounded: {
|
|
167
|
+
tl: "\u256D",
|
|
168
|
+
tr: "\u256E",
|
|
169
|
+
bl: "\u2570",
|
|
170
|
+
br: "\u256F",
|
|
171
|
+
h: "\u2500",
|
|
172
|
+
v: "\u2551"
|
|
173
|
+
},
|
|
174
|
+
singleThick: {
|
|
175
|
+
tl: "\u250F",
|
|
176
|
+
tr: "\u2513",
|
|
177
|
+
bl: "\u2517",
|
|
178
|
+
br: "\u251B",
|
|
179
|
+
h: "\u2501",
|
|
180
|
+
v: "\u2503"
|
|
181
|
+
},
|
|
182
|
+
singleDouble: {
|
|
183
|
+
tl: "\u2552",
|
|
184
|
+
tr: "\u2555",
|
|
185
|
+
bl: "\u2558",
|
|
186
|
+
br: "\u255B",
|
|
187
|
+
h: "\u2550",
|
|
188
|
+
v: "\u2502"
|
|
189
|
+
},
|
|
190
|
+
singleDoubleRounded: {
|
|
191
|
+
tl: "\u256D",
|
|
192
|
+
tr: "\u256E",
|
|
193
|
+
bl: "\u2570",
|
|
194
|
+
br: "\u256F",
|
|
195
|
+
h: "\u2550",
|
|
196
|
+
v: "\u2502"
|
|
197
|
+
},
|
|
198
|
+
rounded: {
|
|
199
|
+
tl: "\u256D",
|
|
200
|
+
tr: "\u256E",
|
|
201
|
+
bl: "\u2570",
|
|
202
|
+
br: "\u256F",
|
|
203
|
+
h: "\u2500",
|
|
204
|
+
v: "\u2502"
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
const defaultStyle = {
|
|
208
|
+
borderColor: "white",
|
|
209
|
+
borderStyle: "rounded",
|
|
210
|
+
valign: "center",
|
|
211
|
+
padding: 2,
|
|
212
|
+
marginLeft: 1,
|
|
213
|
+
marginTop: 1,
|
|
214
|
+
marginBottom: 1
|
|
215
|
+
};
|
|
216
|
+
function box(text, _opts = {}) {
|
|
217
|
+
const opts = {
|
|
218
|
+
..._opts,
|
|
219
|
+
style: {
|
|
220
|
+
...defaultStyle,
|
|
221
|
+
..._opts.style
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
const textLines = text.split("\n");
|
|
225
|
+
const boxLines = [];
|
|
226
|
+
const _color = getColor(opts.style.borderColor);
|
|
227
|
+
const borderStyle = {
|
|
228
|
+
...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
|
|
229
|
+
};
|
|
230
|
+
if (_color) {
|
|
231
|
+
for (const key in borderStyle) {
|
|
232
|
+
borderStyle[key] = _color(
|
|
233
|
+
borderStyle[key]
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
|
|
238
|
+
const height = textLines.length + paddingOffset;
|
|
239
|
+
const width = Math.max(
|
|
240
|
+
...textLines.map((line) => stripAnsi(line).length),
|
|
241
|
+
opts.title ? stripAnsi(opts.title).length : 0
|
|
242
|
+
) + paddingOffset;
|
|
243
|
+
const widthOffset = width + paddingOffset;
|
|
244
|
+
const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
|
|
245
|
+
if (opts.style.marginTop > 0) {
|
|
246
|
+
boxLines.push("".repeat(opts.style.marginTop));
|
|
247
|
+
}
|
|
248
|
+
if (opts.title) {
|
|
249
|
+
const title = _color ? _color(opts.title) : opts.title;
|
|
250
|
+
const left = borderStyle.h.repeat(
|
|
251
|
+
Math.floor((width - stripAnsi(opts.title).length) / 2)
|
|
252
|
+
);
|
|
253
|
+
const right = borderStyle.h.repeat(
|
|
254
|
+
width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset
|
|
255
|
+
);
|
|
256
|
+
boxLines.push(
|
|
257
|
+
`${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`
|
|
258
|
+
);
|
|
259
|
+
} else {
|
|
260
|
+
boxLines.push(
|
|
261
|
+
`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
|
|
265
|
+
for (let i = 0; i < height; i++) {
|
|
266
|
+
if (i < valignOffset || i >= valignOffset + textLines.length) {
|
|
267
|
+
boxLines.push(
|
|
268
|
+
`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`
|
|
269
|
+
);
|
|
270
|
+
} else {
|
|
271
|
+
const line = textLines[i - valignOffset];
|
|
272
|
+
const left = " ".repeat(paddingOffset);
|
|
273
|
+
const right = " ".repeat(width - stripAnsi(line).length);
|
|
274
|
+
boxLines.push(
|
|
275
|
+
`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
boxLines.push(
|
|
280
|
+
`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`
|
|
281
|
+
);
|
|
282
|
+
if (opts.style.marginBottom > 0) {
|
|
283
|
+
boxLines.push("".repeat(opts.style.marginBottom));
|
|
284
|
+
}
|
|
285
|
+
return boxLines.join("\n");
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export { centerAlign as a, align as b, colorize as c, box as d, colors as e, getColor as g, leftAlign as l, rightAlign as r, stripAnsi as s };
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "consola",
|
|
3
|
+
"version": "3.4.2",
|
|
4
|
+
"description": "Elegant Console Wrapper",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"console",
|
|
7
|
+
"logger",
|
|
8
|
+
"reporter",
|
|
9
|
+
"elegant",
|
|
10
|
+
"cli",
|
|
11
|
+
"universal",
|
|
12
|
+
"unified",
|
|
13
|
+
"prompt",
|
|
14
|
+
"clack",
|
|
15
|
+
"format",
|
|
16
|
+
"error",
|
|
17
|
+
"stacktrace"
|
|
18
|
+
],
|
|
19
|
+
"repository": "unjs/consola",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"type": "module",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"node": {
|
|
25
|
+
"import": {
|
|
26
|
+
"types": "./dist/index.d.mts",
|
|
27
|
+
"default": "./dist/index.mjs"
|
|
28
|
+
},
|
|
29
|
+
"require": {
|
|
30
|
+
"types": "./dist/index.d.cts",
|
|
31
|
+
"default": "./lib/index.cjs"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"default": {
|
|
35
|
+
"import": {
|
|
36
|
+
"types": "./dist/browser.d.mts",
|
|
37
|
+
"default": "./dist/browser.mjs"
|
|
38
|
+
},
|
|
39
|
+
"require": {
|
|
40
|
+
"types": "./dist/browser.d.cts",
|
|
41
|
+
"default": "./dist/browser.cjs"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"./browser": {
|
|
46
|
+
"import": {
|
|
47
|
+
"types": "./dist/browser.d.mts",
|
|
48
|
+
"default": "./dist/browser.mjs"
|
|
49
|
+
},
|
|
50
|
+
"require": {
|
|
51
|
+
"types": "./dist/browser.d.cts",
|
|
52
|
+
"default": "./dist/browser.cjs"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"./basic": {
|
|
56
|
+
"node": {
|
|
57
|
+
"import": {
|
|
58
|
+
"types": "./dist/basic.d.mts",
|
|
59
|
+
"default": "./dist/basic.mjs"
|
|
60
|
+
},
|
|
61
|
+
"require": {
|
|
62
|
+
"types": "./dist/basic.d.cts",
|
|
63
|
+
"default": "./dist/basic.cjs"
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"default": {
|
|
67
|
+
"import": {
|
|
68
|
+
"types": "./dist/browser.d.mts",
|
|
69
|
+
"default": "./dist/browser.mjs"
|
|
70
|
+
},
|
|
71
|
+
"require": {
|
|
72
|
+
"types": "./dist/browser.d.cts",
|
|
73
|
+
"default": "./dist/browser.cjs"
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"./core": {
|
|
78
|
+
"import": {
|
|
79
|
+
"types": "./dist/core.d.mts",
|
|
80
|
+
"default": "./dist/core.mjs"
|
|
81
|
+
},
|
|
82
|
+
"require": {
|
|
83
|
+
"types": "./dist/core.d.cts",
|
|
84
|
+
"default": "./dist/core.cjs"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"./utils": {
|
|
88
|
+
"import": {
|
|
89
|
+
"types": "./dist/utils.d.mts",
|
|
90
|
+
"default": "./dist/utils.mjs"
|
|
91
|
+
},
|
|
92
|
+
"require": {
|
|
93
|
+
"types": "./dist/utils.d.cts",
|
|
94
|
+
"default": "./dist/utils.cjs"
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"main": "./lib/index.cjs",
|
|
99
|
+
"module": "./dist/index.mjs",
|
|
100
|
+
"browser": "./dist/browser.mjs",
|
|
101
|
+
"types": "./dist/index.d.ts",
|
|
102
|
+
"files": [
|
|
103
|
+
"dist",
|
|
104
|
+
"lib",
|
|
105
|
+
"*.d.ts"
|
|
106
|
+
],
|
|
107
|
+
"scripts": {
|
|
108
|
+
"build": "unbuild",
|
|
109
|
+
"dev": "vitest",
|
|
110
|
+
"lint": "eslint . && prettier -c src examples test",
|
|
111
|
+
"lint:fix": "eslint . --fix && prettier -w src examples test",
|
|
112
|
+
"release": "pnpm test && pnpm build && changelogen --release --push && npm publish",
|
|
113
|
+
"test": "pnpm lint && pnpm vitest run --coverage"
|
|
114
|
+
},
|
|
115
|
+
"devDependencies": {
|
|
116
|
+
"@clack/prompts": "^0.10.0",
|
|
117
|
+
"@types/node": "^22.13.10",
|
|
118
|
+
"@vitest/coverage-v8": "^3.0.9",
|
|
119
|
+
"changelogen": "^0.6.1",
|
|
120
|
+
"defu": "^6.1.4",
|
|
121
|
+
"eslint": "^9.22.0",
|
|
122
|
+
"eslint-config-unjs": "^0.4.2",
|
|
123
|
+
"is-unicode-supported": "^2.1.0",
|
|
124
|
+
"prettier": "^3.5.3",
|
|
125
|
+
"sentencer": "^0.2.1",
|
|
126
|
+
"std-env": "^3.8.1",
|
|
127
|
+
"string-width": "^7.2.0",
|
|
128
|
+
"typescript": "^5.8.2",
|
|
129
|
+
"unbuild": "^3.5.0",
|
|
130
|
+
"vitest": "^3.0.9"
|
|
131
|
+
},
|
|
132
|
+
"engines": {
|
|
133
|
+
"node": "^14.18.0 || >=16.10.0"
|
|
134
|
+
},
|
|
135
|
+
"packageManager": "pnpm@10.6.3"
|
|
136
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
class NonError extends Error {
|
|
4
|
+
constructor(message) {
|
|
5
|
+
super(NonError._prepareSuperMessage(message));
|
|
6
|
+
Object.defineProperty(this, 'name', {
|
|
7
|
+
value: 'NonError',
|
|
8
|
+
configurable: true,
|
|
9
|
+
writable: true
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
if (Error.captureStackTrace) {
|
|
13
|
+
Error.captureStackTrace(this, NonError);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
static _prepareSuperMessage(message) {
|
|
18
|
+
try {
|
|
19
|
+
return JSON.stringify(message);
|
|
20
|
+
} catch {
|
|
21
|
+
return String(message);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const commonProperties = [
|
|
27
|
+
{property: 'name', enumerable: false},
|
|
28
|
+
{property: 'message', enumerable: false},
|
|
29
|
+
{property: 'stack', enumerable: false},
|
|
30
|
+
{property: 'code', enumerable: true}
|
|
31
|
+
];
|
|
32
|
+
|
|
33
|
+
const isCalled = Symbol('.toJSON called');
|
|
34
|
+
|
|
35
|
+
const toJSON = from => {
|
|
36
|
+
from[isCalled] = true;
|
|
37
|
+
const json = from.toJSON();
|
|
38
|
+
delete from[isCalled];
|
|
39
|
+
return json;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const destroyCircular = ({
|
|
43
|
+
from,
|
|
44
|
+
seen,
|
|
45
|
+
to_,
|
|
46
|
+
forceEnumerable,
|
|
47
|
+
maxDepth,
|
|
48
|
+
depth
|
|
49
|
+
}) => {
|
|
50
|
+
const to = to_ || (Array.isArray(from) ? [] : {});
|
|
51
|
+
|
|
52
|
+
seen.push(from);
|
|
53
|
+
|
|
54
|
+
if (depth >= maxDepth) {
|
|
55
|
+
return to;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (typeof from.toJSON === 'function' && from[isCalled] !== true) {
|
|
59
|
+
return toJSON(from);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
for (const [key, value] of Object.entries(from)) {
|
|
63
|
+
if (typeof Buffer === 'function' && Buffer.isBuffer(value)) {
|
|
64
|
+
to[key] = '[object Buffer]';
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (typeof value === 'function') {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (!value || typeof value !== 'object') {
|
|
73
|
+
to[key] = value;
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (!seen.includes(from[key])) {
|
|
78
|
+
depth++;
|
|
79
|
+
|
|
80
|
+
to[key] = destroyCircular({
|
|
81
|
+
from: from[key],
|
|
82
|
+
seen: seen.slice(),
|
|
83
|
+
forceEnumerable,
|
|
84
|
+
maxDepth,
|
|
85
|
+
depth
|
|
86
|
+
});
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
to[key] = '[Circular]';
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
for (const {property, enumerable} of commonProperties) {
|
|
94
|
+
if (typeof from[property] === 'string') {
|
|
95
|
+
Object.defineProperty(to, property, {
|
|
96
|
+
value: from[property],
|
|
97
|
+
enumerable: forceEnumerable ? true : enumerable,
|
|
98
|
+
configurable: true,
|
|
99
|
+
writable: true
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return to;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
const serializeError = (value, options = {}) => {
|
|
108
|
+
const {maxDepth = Number.POSITIVE_INFINITY} = options;
|
|
109
|
+
|
|
110
|
+
if (typeof value === 'object' && value !== null) {
|
|
111
|
+
return destroyCircular({
|
|
112
|
+
from: value,
|
|
113
|
+
seen: [],
|
|
114
|
+
forceEnumerable: true,
|
|
115
|
+
maxDepth,
|
|
116
|
+
depth: 0
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// People sometimes throw things besides Error objects…
|
|
121
|
+
if (typeof value === 'function') {
|
|
122
|
+
// `JSON.stringify()` discards functions. We do too, unless a function is thrown directly.
|
|
123
|
+
return `[Function: ${(value.name || 'anonymous')}]`;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return value;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
const deserializeError = (value, options = {}) => {
|
|
130
|
+
const {maxDepth = Number.POSITIVE_INFINITY} = options;
|
|
131
|
+
|
|
132
|
+
if (value instanceof Error) {
|
|
133
|
+
return value;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
137
|
+
const newError = new Error(); // eslint-disable-line unicorn/error-message
|
|
138
|
+
destroyCircular({
|
|
139
|
+
from: value,
|
|
140
|
+
seen: [],
|
|
141
|
+
to_: newError,
|
|
142
|
+
maxDepth,
|
|
143
|
+
depth: 0
|
|
144
|
+
});
|
|
145
|
+
return newError;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return new NonError(value);
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
module.exports = {
|
|
152
|
+
serializeError,
|
|
153
|
+
deserializeError
|
|
154
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "serialize-error",
|
|
3
|
+
"version": "8.1.0",
|
|
4
|
+
"description": "Serialize/deserialize an error into a plain object",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": "sindresorhus/serialize-error",
|
|
7
|
+
"funding": "https://github.com/sponsors/sindresorhus",
|
|
8
|
+
"author": {
|
|
9
|
+
"name": "Sindre Sorhus",
|
|
10
|
+
"email": "sindresorhus@gmail.com",
|
|
11
|
+
"url": "https://sindresorhus.com"
|
|
12
|
+
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=10"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"test": "xo && ava && tsd"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"index.js",
|
|
21
|
+
"index.d.ts"
|
|
22
|
+
],
|
|
23
|
+
"keywords": [
|
|
24
|
+
"error",
|
|
25
|
+
"serialize",
|
|
26
|
+
"stringify",
|
|
27
|
+
"object",
|
|
28
|
+
"convert",
|
|
29
|
+
"process",
|
|
30
|
+
"send",
|
|
31
|
+
"deserialize"
|
|
32
|
+
],
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"type-fest": "^0.20.2"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"ava": "^2.4.0",
|
|
38
|
+
"tsd": "^0.14.0",
|
|
39
|
+
"xo": "^0.37.1"
|
|
40
|
+
}
|
|
41
|
+
}
|