githublogen 0.3.25 → 0.4.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/README.md +1 -1
- package/dist/cli.mjs +103 -0
- package/package.json +11 -10
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -1237
- package/dist/prompt-X7YDA36E.js +0 -756
package/dist/cli.js
DELETED
|
@@ -1,1237 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
// src/cli.ts
|
|
4
|
-
import process2 from "process";
|
|
5
|
-
import cac from "cac";
|
|
6
|
-
|
|
7
|
-
// ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/core.mjs
|
|
8
|
-
var LogLevels = {
|
|
9
|
-
silent: Number.NEGATIVE_INFINITY,
|
|
10
|
-
fatal: 0,
|
|
11
|
-
error: 0,
|
|
12
|
-
warn: 1,
|
|
13
|
-
log: 2,
|
|
14
|
-
info: 3,
|
|
15
|
-
success: 3,
|
|
16
|
-
fail: 3,
|
|
17
|
-
ready: 3,
|
|
18
|
-
start: 3,
|
|
19
|
-
box: 3,
|
|
20
|
-
debug: 4,
|
|
21
|
-
trace: 5,
|
|
22
|
-
verbose: Number.POSITIVE_INFINITY
|
|
23
|
-
};
|
|
24
|
-
var LogTypes = {
|
|
25
|
-
// Silent
|
|
26
|
-
silent: {
|
|
27
|
-
level: -1
|
|
28
|
-
},
|
|
29
|
-
// Level 0
|
|
30
|
-
fatal: {
|
|
31
|
-
level: LogLevels.fatal
|
|
32
|
-
},
|
|
33
|
-
error: {
|
|
34
|
-
level: LogLevels.error
|
|
35
|
-
},
|
|
36
|
-
// Level 1
|
|
37
|
-
warn: {
|
|
38
|
-
level: LogLevels.warn
|
|
39
|
-
},
|
|
40
|
-
// Level 2
|
|
41
|
-
log: {
|
|
42
|
-
level: LogLevels.log
|
|
43
|
-
},
|
|
44
|
-
// Level 3
|
|
45
|
-
info: {
|
|
46
|
-
level: LogLevels.info
|
|
47
|
-
},
|
|
48
|
-
success: {
|
|
49
|
-
level: LogLevels.success
|
|
50
|
-
},
|
|
51
|
-
fail: {
|
|
52
|
-
level: LogLevels.fail
|
|
53
|
-
},
|
|
54
|
-
ready: {
|
|
55
|
-
level: LogLevels.info
|
|
56
|
-
},
|
|
57
|
-
start: {
|
|
58
|
-
level: LogLevels.info
|
|
59
|
-
},
|
|
60
|
-
box: {
|
|
61
|
-
level: LogLevels.info
|
|
62
|
-
},
|
|
63
|
-
// Level 4
|
|
64
|
-
debug: {
|
|
65
|
-
level: LogLevels.debug
|
|
66
|
-
},
|
|
67
|
-
// Level 5
|
|
68
|
-
trace: {
|
|
69
|
-
level: LogLevels.trace
|
|
70
|
-
},
|
|
71
|
-
// Verbose
|
|
72
|
-
verbose: {
|
|
73
|
-
level: LogLevels.verbose
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
function isPlainObject$1(value) {
|
|
77
|
-
if (value === null || typeof value !== "object") {
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
const prototype = Object.getPrototypeOf(value);
|
|
81
|
-
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
if (Symbol.iterator in value) {
|
|
85
|
-
return false;
|
|
86
|
-
}
|
|
87
|
-
if (Symbol.toStringTag in value) {
|
|
88
|
-
return Object.prototype.toString.call(value) === "[object Module]";
|
|
89
|
-
}
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
93
|
-
if (!isPlainObject$1(defaults)) {
|
|
94
|
-
return _defu(baseObject, {}, namespace, merger);
|
|
95
|
-
}
|
|
96
|
-
const object = Object.assign({}, defaults);
|
|
97
|
-
for (const key in baseObject) {
|
|
98
|
-
if (key === "__proto__" || key === "constructor") {
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
const value = baseObject[key];
|
|
102
|
-
if (value === null || value === void 0) {
|
|
103
|
-
continue;
|
|
104
|
-
}
|
|
105
|
-
if (merger && merger(object, key, value, namespace)) {
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
109
|
-
object[key] = [...value, ...object[key]];
|
|
110
|
-
} else if (isPlainObject$1(value) && isPlainObject$1(object[key])) {
|
|
111
|
-
object[key] = _defu(
|
|
112
|
-
value,
|
|
113
|
-
object[key],
|
|
114
|
-
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
115
|
-
merger
|
|
116
|
-
);
|
|
117
|
-
} else {
|
|
118
|
-
object[key] = value;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return object;
|
|
122
|
-
}
|
|
123
|
-
function createDefu(merger) {
|
|
124
|
-
return (...arguments_) => (
|
|
125
|
-
// eslint-disable-next-line unicorn/no-array-reduce
|
|
126
|
-
arguments_.reduce((p, c2) => _defu(p, c2, "", merger), {})
|
|
127
|
-
);
|
|
128
|
-
}
|
|
129
|
-
var defu = createDefu();
|
|
130
|
-
function isPlainObject(obj) {
|
|
131
|
-
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
132
|
-
}
|
|
133
|
-
function isLogObj(arg) {
|
|
134
|
-
if (!isPlainObject(arg)) {
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
if (!arg.message && !arg.args) {
|
|
138
|
-
return false;
|
|
139
|
-
}
|
|
140
|
-
if (arg.stack) {
|
|
141
|
-
return false;
|
|
142
|
-
}
|
|
143
|
-
return true;
|
|
144
|
-
}
|
|
145
|
-
var paused = false;
|
|
146
|
-
var queue = [];
|
|
147
|
-
var Consola = class _Consola {
|
|
148
|
-
options;
|
|
149
|
-
_lastLog;
|
|
150
|
-
_mockFn;
|
|
151
|
-
/**
|
|
152
|
-
* Creates an instance of Consola with specified options or defaults.
|
|
153
|
-
*
|
|
154
|
-
* @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
|
|
155
|
-
*/
|
|
156
|
-
constructor(options = {}) {
|
|
157
|
-
const types = options.types || LogTypes;
|
|
158
|
-
this.options = defu(
|
|
159
|
-
{
|
|
160
|
-
...options,
|
|
161
|
-
defaults: { ...options.defaults },
|
|
162
|
-
level: _normalizeLogLevel(options.level, types),
|
|
163
|
-
reporters: [...options.reporters || []]
|
|
164
|
-
},
|
|
165
|
-
{
|
|
166
|
-
types: LogTypes,
|
|
167
|
-
throttle: 1e3,
|
|
168
|
-
throttleMin: 5,
|
|
169
|
-
formatOptions: {
|
|
170
|
-
date: true,
|
|
171
|
-
colors: false,
|
|
172
|
-
compact: true
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
);
|
|
176
|
-
for (const type in types) {
|
|
177
|
-
const defaults = {
|
|
178
|
-
type,
|
|
179
|
-
...this.options.defaults,
|
|
180
|
-
...types[type]
|
|
181
|
-
};
|
|
182
|
-
this[type] = this._wrapLogFn(defaults);
|
|
183
|
-
this[type].raw = this._wrapLogFn(
|
|
184
|
-
defaults,
|
|
185
|
-
true
|
|
186
|
-
);
|
|
187
|
-
}
|
|
188
|
-
if (this.options.mockFn) {
|
|
189
|
-
this.mockTypes();
|
|
190
|
-
}
|
|
191
|
-
this._lastLog = {};
|
|
192
|
-
}
|
|
193
|
-
/**
|
|
194
|
-
* Gets the current log level of the Consola instance.
|
|
195
|
-
*
|
|
196
|
-
* @returns {number} The current log level.
|
|
197
|
-
*/
|
|
198
|
-
get level() {
|
|
199
|
-
return this.options.level;
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Sets the minimum log level that will be output by the instance.
|
|
203
|
-
*
|
|
204
|
-
* @param {number} level - The new log level to set.
|
|
205
|
-
*/
|
|
206
|
-
set level(level) {
|
|
207
|
-
this.options.level = _normalizeLogLevel(
|
|
208
|
-
level,
|
|
209
|
-
this.options.types,
|
|
210
|
-
this.options.level
|
|
211
|
-
);
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Displays a prompt to the user and returns the response.
|
|
215
|
-
* Throw an error if `prompt` is not supported by the current configuration.
|
|
216
|
-
*
|
|
217
|
-
* @template T
|
|
218
|
-
* @param {string} message - The message to display in the prompt.
|
|
219
|
-
* @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
|
|
220
|
-
* @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
|
|
221
|
-
*/
|
|
222
|
-
prompt(message, opts) {
|
|
223
|
-
if (!this.options.prompt) {
|
|
224
|
-
throw new Error("prompt is not supported!");
|
|
225
|
-
}
|
|
226
|
-
return this.options.prompt(message, opts);
|
|
227
|
-
}
|
|
228
|
-
/**
|
|
229
|
-
* Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
|
|
230
|
-
*
|
|
231
|
-
* @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
|
|
232
|
-
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
233
|
-
*/
|
|
234
|
-
create(options) {
|
|
235
|
-
const instance = new _Consola({
|
|
236
|
-
...this.options,
|
|
237
|
-
...options
|
|
238
|
-
});
|
|
239
|
-
if (this._mockFn) {
|
|
240
|
-
instance.mockTypes(this._mockFn);
|
|
241
|
-
}
|
|
242
|
-
return instance;
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* Creates a new Consola instance with the specified default log object properties.
|
|
246
|
-
*
|
|
247
|
-
* @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
|
|
248
|
-
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
249
|
-
*/
|
|
250
|
-
withDefaults(defaults) {
|
|
251
|
-
return this.create({
|
|
252
|
-
...this.options,
|
|
253
|
-
defaults: {
|
|
254
|
-
...this.options.defaults,
|
|
255
|
-
...defaults
|
|
256
|
-
}
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
|
-
/**
|
|
260
|
-
* Creates a new Consola instance with a specified tag, which will be included in every log.
|
|
261
|
-
*
|
|
262
|
-
* @param {string} tag - The tag to include in each log of the new instance.
|
|
263
|
-
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
264
|
-
*/
|
|
265
|
-
withTag(tag) {
|
|
266
|
-
return this.withDefaults({
|
|
267
|
-
tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
|
|
268
|
-
});
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Adds a custom reporter to the Consola instance.
|
|
272
|
-
* Reporters will be called for each log message, depending on their implementation and log level.
|
|
273
|
-
*
|
|
274
|
-
* @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
|
|
275
|
-
* @returns {Consola} The current Consola instance.
|
|
276
|
-
*/
|
|
277
|
-
addReporter(reporter) {
|
|
278
|
-
this.options.reporters.push(reporter);
|
|
279
|
-
return this;
|
|
280
|
-
}
|
|
281
|
-
/**
|
|
282
|
-
* Removes a custom reporter from the Consola instance.
|
|
283
|
-
* If no reporter is specified, all reporters will be removed.
|
|
284
|
-
*
|
|
285
|
-
* @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
|
|
286
|
-
* @returns {Consola} The current Consola instance.
|
|
287
|
-
*/
|
|
288
|
-
removeReporter(reporter) {
|
|
289
|
-
if (reporter) {
|
|
290
|
-
const i2 = this.options.reporters.indexOf(reporter);
|
|
291
|
-
if (i2 !== -1) {
|
|
292
|
-
return this.options.reporters.splice(i2, 1);
|
|
293
|
-
}
|
|
294
|
-
} else {
|
|
295
|
-
this.options.reporters.splice(0);
|
|
296
|
-
}
|
|
297
|
-
return this;
|
|
298
|
-
}
|
|
299
|
-
/**
|
|
300
|
-
* Replaces all reporters of the Consola instance with the specified array of reporters.
|
|
301
|
-
*
|
|
302
|
-
* @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
|
|
303
|
-
* @returns {Consola} The current Consola instance.
|
|
304
|
-
*/
|
|
305
|
-
setReporters(reporters) {
|
|
306
|
-
this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
|
|
307
|
-
return this;
|
|
308
|
-
}
|
|
309
|
-
wrapAll() {
|
|
310
|
-
this.wrapConsole();
|
|
311
|
-
this.wrapStd();
|
|
312
|
-
}
|
|
313
|
-
restoreAll() {
|
|
314
|
-
this.restoreConsole();
|
|
315
|
-
this.restoreStd();
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* Overrides console methods with Consola logging methods for consistent logging.
|
|
319
|
-
*/
|
|
320
|
-
wrapConsole() {
|
|
321
|
-
for (const type in this.options.types) {
|
|
322
|
-
if (!console["__" + type]) {
|
|
323
|
-
console["__" + type] = console[type];
|
|
324
|
-
}
|
|
325
|
-
console[type] = this[type].raw;
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
/**
|
|
329
|
-
* Restores the original console methods, removing Consola overrides.
|
|
330
|
-
*/
|
|
331
|
-
restoreConsole() {
|
|
332
|
-
for (const type in this.options.types) {
|
|
333
|
-
if (console["__" + type]) {
|
|
334
|
-
console[type] = console["__" + type];
|
|
335
|
-
delete console["__" + type];
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
/**
|
|
340
|
-
* Overrides standard output and error streams to redirect them through Consola.
|
|
341
|
-
*/
|
|
342
|
-
wrapStd() {
|
|
343
|
-
this._wrapStream(this.options.stdout, "log");
|
|
344
|
-
this._wrapStream(this.options.stderr, "log");
|
|
345
|
-
}
|
|
346
|
-
_wrapStream(stream, type) {
|
|
347
|
-
if (!stream) {
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
if (!stream.__write) {
|
|
351
|
-
stream.__write = stream.write;
|
|
352
|
-
}
|
|
353
|
-
stream.write = (data) => {
|
|
354
|
-
this[type].raw(String(data).trim());
|
|
355
|
-
};
|
|
356
|
-
}
|
|
357
|
-
/**
|
|
358
|
-
* Restores the original standard output and error streams, removing the Consola redirection.
|
|
359
|
-
*/
|
|
360
|
-
restoreStd() {
|
|
361
|
-
this._restoreStream(this.options.stdout);
|
|
362
|
-
this._restoreStream(this.options.stderr);
|
|
363
|
-
}
|
|
364
|
-
_restoreStream(stream) {
|
|
365
|
-
if (!stream) {
|
|
366
|
-
return;
|
|
367
|
-
}
|
|
368
|
-
if (stream.__write) {
|
|
369
|
-
stream.write = stream.__write;
|
|
370
|
-
delete stream.__write;
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
/**
|
|
374
|
-
* Pauses logging, queues incoming logs until resumed.
|
|
375
|
-
*/
|
|
376
|
-
pauseLogs() {
|
|
377
|
-
paused = true;
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* Resumes logging, processing any queued logs.
|
|
381
|
-
*/
|
|
382
|
-
resumeLogs() {
|
|
383
|
-
paused = false;
|
|
384
|
-
const _queue = queue.splice(0);
|
|
385
|
-
for (const item of _queue) {
|
|
386
|
-
item[0]._logFn(item[1], item[2]);
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
/**
|
|
390
|
-
* Replaces logging methods with mocks if a mock function is provided.
|
|
391
|
-
*
|
|
392
|
-
* @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
|
|
393
|
-
*/
|
|
394
|
-
mockTypes(mockFn) {
|
|
395
|
-
const _mockFn = mockFn || this.options.mockFn;
|
|
396
|
-
this._mockFn = _mockFn;
|
|
397
|
-
if (typeof _mockFn !== "function") {
|
|
398
|
-
return;
|
|
399
|
-
}
|
|
400
|
-
for (const type in this.options.types) {
|
|
401
|
-
this[type] = _mockFn(type, this.options.types[type]) || this[type];
|
|
402
|
-
this[type].raw = this[type];
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
_wrapLogFn(defaults, isRaw) {
|
|
406
|
-
return (...args) => {
|
|
407
|
-
if (paused) {
|
|
408
|
-
queue.push([this, defaults, args, isRaw]);
|
|
409
|
-
return;
|
|
410
|
-
}
|
|
411
|
-
return this._logFn(defaults, args, isRaw);
|
|
412
|
-
};
|
|
413
|
-
}
|
|
414
|
-
_logFn(defaults, args, isRaw) {
|
|
415
|
-
if ((defaults.level || 0) > this.level) {
|
|
416
|
-
return false;
|
|
417
|
-
}
|
|
418
|
-
const logObj = {
|
|
419
|
-
date: /* @__PURE__ */ new Date(),
|
|
420
|
-
args: [],
|
|
421
|
-
...defaults,
|
|
422
|
-
level: _normalizeLogLevel(defaults.level, this.options.types)
|
|
423
|
-
};
|
|
424
|
-
if (!isRaw && args.length === 1 && isLogObj(args[0])) {
|
|
425
|
-
Object.assign(logObj, args[0]);
|
|
426
|
-
} else {
|
|
427
|
-
logObj.args = [...args];
|
|
428
|
-
}
|
|
429
|
-
if (logObj.message) {
|
|
430
|
-
logObj.args.unshift(logObj.message);
|
|
431
|
-
delete logObj.message;
|
|
432
|
-
}
|
|
433
|
-
if (logObj.additional) {
|
|
434
|
-
if (!Array.isArray(logObj.additional)) {
|
|
435
|
-
logObj.additional = logObj.additional.split("\n");
|
|
436
|
-
}
|
|
437
|
-
logObj.args.push("\n" + logObj.additional.join("\n"));
|
|
438
|
-
delete logObj.additional;
|
|
439
|
-
}
|
|
440
|
-
logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
|
|
441
|
-
logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
|
|
442
|
-
const resolveLog = (newLog = false) => {
|
|
443
|
-
const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
|
|
444
|
-
if (this._lastLog.object && repeated > 0) {
|
|
445
|
-
const args2 = [...this._lastLog.object.args];
|
|
446
|
-
if (repeated > 1) {
|
|
447
|
-
args2.push(`(repeated ${repeated} times)`);
|
|
448
|
-
}
|
|
449
|
-
this._log({ ...this._lastLog.object, args: args2 });
|
|
450
|
-
this._lastLog.count = 1;
|
|
451
|
-
}
|
|
452
|
-
if (newLog) {
|
|
453
|
-
this._lastLog.object = logObj;
|
|
454
|
-
this._log(logObj);
|
|
455
|
-
}
|
|
456
|
-
};
|
|
457
|
-
clearTimeout(this._lastLog.timeout);
|
|
458
|
-
const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
|
|
459
|
-
this._lastLog.time = logObj.date;
|
|
460
|
-
if (diffTime < this.options.throttle) {
|
|
461
|
-
try {
|
|
462
|
-
const serializedLog = JSON.stringify([
|
|
463
|
-
logObj.type,
|
|
464
|
-
logObj.tag,
|
|
465
|
-
logObj.args
|
|
466
|
-
]);
|
|
467
|
-
const isSameLog = this._lastLog.serialized === serializedLog;
|
|
468
|
-
this._lastLog.serialized = serializedLog;
|
|
469
|
-
if (isSameLog) {
|
|
470
|
-
this._lastLog.count = (this._lastLog.count || 0) + 1;
|
|
471
|
-
if (this._lastLog.count > this.options.throttleMin) {
|
|
472
|
-
this._lastLog.timeout = setTimeout(
|
|
473
|
-
resolveLog,
|
|
474
|
-
this.options.throttle
|
|
475
|
-
);
|
|
476
|
-
return;
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
} catch {
|
|
480
|
-
}
|
|
481
|
-
}
|
|
482
|
-
resolveLog(true);
|
|
483
|
-
}
|
|
484
|
-
_log(logObj) {
|
|
485
|
-
for (const reporter of this.options.reporters) {
|
|
486
|
-
reporter.log(logObj, {
|
|
487
|
-
options: this.options
|
|
488
|
-
});
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
};
|
|
492
|
-
function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
|
|
493
|
-
if (input === void 0) {
|
|
494
|
-
return defaultLevel;
|
|
495
|
-
}
|
|
496
|
-
if (typeof input === "number") {
|
|
497
|
-
return input;
|
|
498
|
-
}
|
|
499
|
-
if (types[input] && types[input].level !== void 0) {
|
|
500
|
-
return types[input].level;
|
|
501
|
-
}
|
|
502
|
-
return defaultLevel;
|
|
503
|
-
}
|
|
504
|
-
Consola.prototype.add = Consola.prototype.addReporter;
|
|
505
|
-
Consola.prototype.remove = Consola.prototype.removeReporter;
|
|
506
|
-
Consola.prototype.clear = Consola.prototype.removeReporter;
|
|
507
|
-
Consola.prototype.withScope = Consola.prototype.withTag;
|
|
508
|
-
Consola.prototype.mock = Consola.prototype.mockTypes;
|
|
509
|
-
Consola.prototype.pause = Consola.prototype.pauseLogs;
|
|
510
|
-
Consola.prototype.resume = Consola.prototype.resumeLogs;
|
|
511
|
-
function createConsola(options = {}) {
|
|
512
|
-
return new Consola(options);
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
// ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs
|
|
516
|
-
import { formatWithOptions } from "util";
|
|
517
|
-
import { sep } from "path";
|
|
518
|
-
function parseStack(stack, message) {
|
|
519
|
-
const cwd = process.cwd() + sep;
|
|
520
|
-
const lines = stack.split("\n").splice(message.split("\n").length).map((l2) => l2.trim().replace("file://", "").replace(cwd, ""));
|
|
521
|
-
return lines;
|
|
522
|
-
}
|
|
523
|
-
function writeStream(data, stream) {
|
|
524
|
-
const write = stream.__write || stream.write;
|
|
525
|
-
return write.call(stream, data);
|
|
526
|
-
}
|
|
527
|
-
var bracket = (x) => x ? `[${x}]` : "";
|
|
528
|
-
var BasicReporter = class {
|
|
529
|
-
formatStack(stack, message, opts) {
|
|
530
|
-
const indent = " ".repeat(((opts == null ? void 0 : opts.errorLevel) || 0) + 1);
|
|
531
|
-
return indent + parseStack(stack, message).join(`
|
|
532
|
-
${indent}`);
|
|
533
|
-
}
|
|
534
|
-
formatError(err, opts) {
|
|
535
|
-
const message = err.message ?? formatWithOptions(opts, err);
|
|
536
|
-
const stack = err.stack ? this.formatStack(err.stack, message, opts) : "";
|
|
537
|
-
const level = (opts == null ? void 0 : opts.errorLevel) || 0;
|
|
538
|
-
const causedPrefix = level > 0 ? `${" ".repeat(level)}[cause]: ` : "";
|
|
539
|
-
const causedError = err.cause ? "\n\n" + this.formatError(err.cause, { ...opts, errorLevel: level + 1 }) : "";
|
|
540
|
-
return causedPrefix + message + "\n" + stack + causedError;
|
|
541
|
-
}
|
|
542
|
-
formatArgs(args, opts) {
|
|
543
|
-
const _args = args.map((arg) => {
|
|
544
|
-
if (arg && typeof arg.stack === "string") {
|
|
545
|
-
return this.formatError(arg, opts);
|
|
546
|
-
}
|
|
547
|
-
return arg;
|
|
548
|
-
});
|
|
549
|
-
return formatWithOptions(opts, ..._args);
|
|
550
|
-
}
|
|
551
|
-
formatDate(date, opts) {
|
|
552
|
-
return opts.date ? date.toLocaleTimeString() : "";
|
|
553
|
-
}
|
|
554
|
-
filterAndJoin(arr) {
|
|
555
|
-
return arr.filter(Boolean).join(" ");
|
|
556
|
-
}
|
|
557
|
-
formatLogObj(logObj, opts) {
|
|
558
|
-
const message = this.formatArgs(logObj.args, opts);
|
|
559
|
-
if (logObj.type === "box") {
|
|
560
|
-
return "\n" + [
|
|
561
|
-
bracket(logObj.tag),
|
|
562
|
-
logObj.title && logObj.title,
|
|
563
|
-
...message.split("\n")
|
|
564
|
-
].filter(Boolean).map((l2) => " > " + l2).join("\n") + "\n";
|
|
565
|
-
}
|
|
566
|
-
return this.filterAndJoin([
|
|
567
|
-
bracket(logObj.type),
|
|
568
|
-
bracket(logObj.tag),
|
|
569
|
-
message
|
|
570
|
-
]);
|
|
571
|
-
}
|
|
572
|
-
log(logObj, ctx) {
|
|
573
|
-
const line = this.formatLogObj(logObj, {
|
|
574
|
-
columns: ctx.options.stdout.columns || 0,
|
|
575
|
-
...ctx.options.formatOptions
|
|
576
|
-
});
|
|
577
|
-
return writeStream(
|
|
578
|
-
line + "\n",
|
|
579
|
-
logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout
|
|
580
|
-
);
|
|
581
|
-
}
|
|
582
|
-
};
|
|
583
|
-
|
|
584
|
-
// ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/index.mjs
|
|
585
|
-
import g$1 from "process";
|
|
586
|
-
|
|
587
|
-
// ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs
|
|
588
|
-
import * as tty from "tty";
|
|
589
|
-
var {
|
|
590
|
-
env = {},
|
|
591
|
-
argv = [],
|
|
592
|
-
platform = ""
|
|
593
|
-
} = typeof process === "undefined" ? {} : process;
|
|
594
|
-
var isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
595
|
-
var isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
596
|
-
var isWindows = platform === "win32";
|
|
597
|
-
var isDumbTerminal = env.TERM === "dumb";
|
|
598
|
-
var isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
|
|
599
|
-
var isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
600
|
-
var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
601
|
-
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)) {
|
|
602
|
-
return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
603
|
-
}
|
|
604
|
-
function clearBleed(index, string, open, close, replace) {
|
|
605
|
-
return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
606
|
-
}
|
|
607
|
-
function filterEmpty(open, close, replace = open, at = open.length + 1) {
|
|
608
|
-
return (string) => string || !(string === "" || string === void 0) ? clearBleed(
|
|
609
|
-
("" + string).indexOf(close, at),
|
|
610
|
-
string,
|
|
611
|
-
open,
|
|
612
|
-
close,
|
|
613
|
-
replace
|
|
614
|
-
) : "";
|
|
615
|
-
}
|
|
616
|
-
function init(open, close, replace) {
|
|
617
|
-
return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
|
|
618
|
-
}
|
|
619
|
-
var colorDefs = {
|
|
620
|
-
reset: init(0, 0),
|
|
621
|
-
bold: init(1, 22, "\x1B[22m\x1B[1m"),
|
|
622
|
-
dim: init(2, 22, "\x1B[22m\x1B[2m"),
|
|
623
|
-
italic: init(3, 23),
|
|
624
|
-
underline: init(4, 24),
|
|
625
|
-
inverse: init(7, 27),
|
|
626
|
-
hidden: init(8, 28),
|
|
627
|
-
strikethrough: init(9, 29),
|
|
628
|
-
black: init(30, 39),
|
|
629
|
-
red: init(31, 39),
|
|
630
|
-
green: init(32, 39),
|
|
631
|
-
yellow: init(33, 39),
|
|
632
|
-
blue: init(34, 39),
|
|
633
|
-
magenta: init(35, 39),
|
|
634
|
-
cyan: init(36, 39),
|
|
635
|
-
white: init(37, 39),
|
|
636
|
-
gray: init(90, 39),
|
|
637
|
-
bgBlack: init(40, 49),
|
|
638
|
-
bgRed: init(41, 49),
|
|
639
|
-
bgGreen: init(42, 49),
|
|
640
|
-
bgYellow: init(43, 49),
|
|
641
|
-
bgBlue: init(44, 49),
|
|
642
|
-
bgMagenta: init(45, 49),
|
|
643
|
-
bgCyan: init(46, 49),
|
|
644
|
-
bgWhite: init(47, 49),
|
|
645
|
-
blackBright: init(90, 39),
|
|
646
|
-
redBright: init(91, 39),
|
|
647
|
-
greenBright: init(92, 39),
|
|
648
|
-
yellowBright: init(93, 39),
|
|
649
|
-
blueBright: init(94, 39),
|
|
650
|
-
magentaBright: init(95, 39),
|
|
651
|
-
cyanBright: init(96, 39),
|
|
652
|
-
whiteBright: init(97, 39),
|
|
653
|
-
bgBlackBright: init(100, 49),
|
|
654
|
-
bgRedBright: init(101, 49),
|
|
655
|
-
bgGreenBright: init(102, 49),
|
|
656
|
-
bgYellowBright: init(103, 49),
|
|
657
|
-
bgBlueBright: init(104, 49),
|
|
658
|
-
bgMagentaBright: init(105, 49),
|
|
659
|
-
bgCyanBright: init(106, 49),
|
|
660
|
-
bgWhiteBright: init(107, 49)
|
|
661
|
-
};
|
|
662
|
-
function createColors(useColor = isColorSupported) {
|
|
663
|
-
return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
|
|
664
|
-
}
|
|
665
|
-
var colors = createColors();
|
|
666
|
-
function getColor(color, fallback = "reset") {
|
|
667
|
-
return colors[color] || colors[fallback];
|
|
668
|
-
}
|
|
669
|
-
var ansiRegex = [
|
|
670
|
-
String.raw`[\u001B\u009B][[\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\d\/#&.:=?%@~_]+)*|[a-zA-Z\d]+(?:;[-a-zA-Z\d\/#&.:=?%@~_]*)*)?\u0007)`,
|
|
671
|
-
String.raw`(?:(?:\d{1,4}(?:;\d{0,4})*)?[\dA-PR-TZcf-nq-uy=><~]))`
|
|
672
|
-
].join("|");
|
|
673
|
-
function stripAnsi(text) {
|
|
674
|
-
return text.replace(new RegExp(ansiRegex, "g"), "");
|
|
675
|
-
}
|
|
676
|
-
var boxStylePresets = {
|
|
677
|
-
solid: {
|
|
678
|
-
tl: "\u250C",
|
|
679
|
-
tr: "\u2510",
|
|
680
|
-
bl: "\u2514",
|
|
681
|
-
br: "\u2518",
|
|
682
|
-
h: "\u2500",
|
|
683
|
-
v: "\u2502"
|
|
684
|
-
},
|
|
685
|
-
double: {
|
|
686
|
-
tl: "\u2554",
|
|
687
|
-
tr: "\u2557",
|
|
688
|
-
bl: "\u255A",
|
|
689
|
-
br: "\u255D",
|
|
690
|
-
h: "\u2550",
|
|
691
|
-
v: "\u2551"
|
|
692
|
-
},
|
|
693
|
-
doubleSingle: {
|
|
694
|
-
tl: "\u2553",
|
|
695
|
-
tr: "\u2556",
|
|
696
|
-
bl: "\u2559",
|
|
697
|
-
br: "\u255C",
|
|
698
|
-
h: "\u2500",
|
|
699
|
-
v: "\u2551"
|
|
700
|
-
},
|
|
701
|
-
doubleSingleRounded: {
|
|
702
|
-
tl: "\u256D",
|
|
703
|
-
tr: "\u256E",
|
|
704
|
-
bl: "\u2570",
|
|
705
|
-
br: "\u256F",
|
|
706
|
-
h: "\u2500",
|
|
707
|
-
v: "\u2551"
|
|
708
|
-
},
|
|
709
|
-
singleThick: {
|
|
710
|
-
tl: "\u250F",
|
|
711
|
-
tr: "\u2513",
|
|
712
|
-
bl: "\u2517",
|
|
713
|
-
br: "\u251B",
|
|
714
|
-
h: "\u2501",
|
|
715
|
-
v: "\u2503"
|
|
716
|
-
},
|
|
717
|
-
singleDouble: {
|
|
718
|
-
tl: "\u2552",
|
|
719
|
-
tr: "\u2555",
|
|
720
|
-
bl: "\u2558",
|
|
721
|
-
br: "\u255B",
|
|
722
|
-
h: "\u2550",
|
|
723
|
-
v: "\u2502"
|
|
724
|
-
},
|
|
725
|
-
singleDoubleRounded: {
|
|
726
|
-
tl: "\u256D",
|
|
727
|
-
tr: "\u256E",
|
|
728
|
-
bl: "\u2570",
|
|
729
|
-
br: "\u256F",
|
|
730
|
-
h: "\u2550",
|
|
731
|
-
v: "\u2502"
|
|
732
|
-
},
|
|
733
|
-
rounded: {
|
|
734
|
-
tl: "\u256D",
|
|
735
|
-
tr: "\u256E",
|
|
736
|
-
bl: "\u2570",
|
|
737
|
-
br: "\u256F",
|
|
738
|
-
h: "\u2500",
|
|
739
|
-
v: "\u2502"
|
|
740
|
-
}
|
|
741
|
-
};
|
|
742
|
-
var defaultStyle = {
|
|
743
|
-
borderColor: "white",
|
|
744
|
-
borderStyle: "rounded",
|
|
745
|
-
valign: "center",
|
|
746
|
-
padding: 2,
|
|
747
|
-
marginLeft: 1,
|
|
748
|
-
marginTop: 1,
|
|
749
|
-
marginBottom: 1
|
|
750
|
-
};
|
|
751
|
-
function box(text, _opts = {}) {
|
|
752
|
-
const opts = {
|
|
753
|
-
..._opts,
|
|
754
|
-
style: {
|
|
755
|
-
...defaultStyle,
|
|
756
|
-
..._opts.style
|
|
757
|
-
}
|
|
758
|
-
};
|
|
759
|
-
const textLines = text.split("\n");
|
|
760
|
-
const boxLines = [];
|
|
761
|
-
const _color = getColor(opts.style.borderColor);
|
|
762
|
-
const borderStyle = {
|
|
763
|
-
...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
|
|
764
|
-
};
|
|
765
|
-
if (_color) {
|
|
766
|
-
for (const key in borderStyle) {
|
|
767
|
-
borderStyle[key] = _color(
|
|
768
|
-
borderStyle[key]
|
|
769
|
-
);
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
|
|
773
|
-
const height = textLines.length + paddingOffset;
|
|
774
|
-
const width = Math.max(
|
|
775
|
-
...textLines.map((line) => stripAnsi(line).length),
|
|
776
|
-
opts.title ? stripAnsi(opts.title).length : 0
|
|
777
|
-
) + paddingOffset;
|
|
778
|
-
const widthOffset = width + paddingOffset;
|
|
779
|
-
const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
|
|
780
|
-
if (opts.style.marginTop > 0) {
|
|
781
|
-
boxLines.push("".repeat(opts.style.marginTop));
|
|
782
|
-
}
|
|
783
|
-
if (opts.title) {
|
|
784
|
-
const title = _color ? _color(opts.title) : opts.title;
|
|
785
|
-
const left = borderStyle.h.repeat(
|
|
786
|
-
Math.floor((width - stripAnsi(opts.title).length) / 2)
|
|
787
|
-
);
|
|
788
|
-
const right = borderStyle.h.repeat(
|
|
789
|
-
width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset
|
|
790
|
-
);
|
|
791
|
-
boxLines.push(
|
|
792
|
-
`${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`
|
|
793
|
-
);
|
|
794
|
-
} else {
|
|
795
|
-
boxLines.push(
|
|
796
|
-
`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`
|
|
797
|
-
);
|
|
798
|
-
}
|
|
799
|
-
const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
|
|
800
|
-
for (let i2 = 0; i2 < height; i2++) {
|
|
801
|
-
if (i2 < valignOffset || i2 >= valignOffset + textLines.length) {
|
|
802
|
-
boxLines.push(
|
|
803
|
-
`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`
|
|
804
|
-
);
|
|
805
|
-
} else {
|
|
806
|
-
const line = textLines[i2 - valignOffset];
|
|
807
|
-
const left = " ".repeat(paddingOffset);
|
|
808
|
-
const right = " ".repeat(width - stripAnsi(line).length);
|
|
809
|
-
boxLines.push(
|
|
810
|
-
`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`
|
|
811
|
-
);
|
|
812
|
-
}
|
|
813
|
-
}
|
|
814
|
-
boxLines.push(
|
|
815
|
-
`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`
|
|
816
|
-
);
|
|
817
|
-
if (opts.style.marginBottom > 0) {
|
|
818
|
-
boxLines.push("".repeat(opts.style.marginBottom));
|
|
819
|
-
}
|
|
820
|
-
return boxLines.join("\n");
|
|
821
|
-
}
|
|
822
|
-
|
|
823
|
-
// ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/index.mjs
|
|
824
|
-
import "util";
|
|
825
|
-
import "path";
|
|
826
|
-
import "tty";
|
|
827
|
-
var r = /* @__PURE__ */ Object.create(null);
|
|
828
|
-
var i = (e) => {
|
|
829
|
-
var _a8, _b5;
|
|
830
|
-
return ((_a8 = globalThis.process) == null ? void 0 : _a8.env) || import.meta.env || ((_b5 = globalThis.Deno) == null ? void 0 : _b5.env.toObject()) || globalThis.__env__ || (e ? r : globalThis);
|
|
831
|
-
};
|
|
832
|
-
var o = new Proxy(r, { get(e, s2) {
|
|
833
|
-
return i()[s2] ?? r[s2];
|
|
834
|
-
}, has(e, s2) {
|
|
835
|
-
const E = i();
|
|
836
|
-
return s2 in E || s2 in r;
|
|
837
|
-
}, set(e, s2, E) {
|
|
838
|
-
const B = i(true);
|
|
839
|
-
return B[s2] = E, true;
|
|
840
|
-
}, deleteProperty(e, s2) {
|
|
841
|
-
if (!s2) return false;
|
|
842
|
-
const E = i(true);
|
|
843
|
-
return delete E[s2], true;
|
|
844
|
-
}, ownKeys() {
|
|
845
|
-
const e = i(true);
|
|
846
|
-
return Object.keys(e);
|
|
847
|
-
} });
|
|
848
|
-
var t = typeof process < "u" && process.env && process.env.NODE_ENV || "";
|
|
849
|
-
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 }]];
|
|
850
|
-
function b() {
|
|
851
|
-
var _a8, _b5, _c, _d, _e, _f;
|
|
852
|
-
if ((_a8 = globalThis.process) == null ? void 0 : _a8.env) for (const e of f) {
|
|
853
|
-
const s2 = e[1] || e[0];
|
|
854
|
-
if ((_b5 = globalThis.process) == null ? void 0 : _b5.env[s2]) return { name: e[0].toLowerCase(), ...e[2] };
|
|
855
|
-
}
|
|
856
|
-
return ((_d = (_c = globalThis.process) == null ? void 0 : _c.env) == null ? void 0 : _d.SHELL) === "/bin/jsh" && ((_f = (_e = globalThis.process) == null ? void 0 : _e.versions) == null ? void 0 : _f.webcontainer) ? { name: "stackblitz", ci: false } : { name: "", ci: false };
|
|
857
|
-
}
|
|
858
|
-
var l = b();
|
|
859
|
-
l.name;
|
|
860
|
-
function n(e) {
|
|
861
|
-
return e ? e !== "false" : false;
|
|
862
|
-
}
|
|
863
|
-
var _a;
|
|
864
|
-
var I = ((_a = globalThis.process) == null ? void 0 : _a.platform) || "";
|
|
865
|
-
var T = n(o.CI) || l.ci !== false;
|
|
866
|
-
var _a2, _b;
|
|
867
|
-
var a = n(((_a2 = globalThis.process) == null ? void 0 : _a2.stdout) && ((_b = globalThis.process) == null ? void 0 : _b.stdout.isTTY));
|
|
868
|
-
var g = n(o.DEBUG);
|
|
869
|
-
var R = t === "test" || n(o.TEST);
|
|
870
|
-
n(o.MINIMAL) || T || R || !a;
|
|
871
|
-
var A = /^win/i.test(I);
|
|
872
|
-
!n(o.NO_COLOR) && (n(o.FORCE_COLOR) || (a || A) && o.TERM !== "dumb" || T);
|
|
873
|
-
var _a3, _b2;
|
|
874
|
-
var C = (((_b2 = (_a3 = globalThis.process) == null ? void 0 : _a3.versions) == null ? void 0 : _b2.node) || "").replace(/^v/, "") || null;
|
|
875
|
-
Number(C == null ? void 0 : C.split(".")[0]) || null;
|
|
876
|
-
var y = globalThis.process || /* @__PURE__ */ Object.create(null);
|
|
877
|
-
var _ = { versions: {} };
|
|
878
|
-
new Proxy(y, { get(e, s2) {
|
|
879
|
-
if (s2 === "env") return o;
|
|
880
|
-
if (s2 in e) return e[s2];
|
|
881
|
-
if (s2 in _) return _[s2];
|
|
882
|
-
} });
|
|
883
|
-
var _a4, _b3;
|
|
884
|
-
var c = ((_b3 = (_a4 = globalThis.process) == null ? void 0 : _a4.release) == null ? void 0 : _b3.name) === "node";
|
|
885
|
-
var _a5, _b4;
|
|
886
|
-
var O = !!globalThis.Bun || !!((_b4 = (_a5 = globalThis.process) == null ? void 0 : _a5.versions) == null ? void 0 : _b4.bun);
|
|
887
|
-
var D = !!globalThis.Deno;
|
|
888
|
-
var L = !!globalThis.fastly;
|
|
889
|
-
var S = !!globalThis.Netlify;
|
|
890
|
-
var u = !!globalThis.EdgeRuntime;
|
|
891
|
-
var _a6;
|
|
892
|
-
var N = ((_a6 = globalThis.navigator) == null ? void 0 : _a6.userAgent) === "Cloudflare-Workers";
|
|
893
|
-
var F = [[S, "netlify"], [u, "edge-light"], [N, "workerd"], [L, "fastly"], [D, "deno"], [O, "bun"], [c, "node"]];
|
|
894
|
-
function G() {
|
|
895
|
-
const e = F.find((s2) => s2[0]);
|
|
896
|
-
if (e) return { name: e[1] };
|
|
897
|
-
}
|
|
898
|
-
var P = G();
|
|
899
|
-
(P == null ? void 0 : P.name) || "";
|
|
900
|
-
function ansiRegex2({ onlyFirst = false } = {}) {
|
|
901
|
-
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
902
|
-
const pattern = [
|
|
903
|
-
`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`,
|
|
904
|
-
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
|
|
905
|
-
].join("|");
|
|
906
|
-
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
907
|
-
}
|
|
908
|
-
var regex = ansiRegex2();
|
|
909
|
-
function stripAnsi2(string) {
|
|
910
|
-
if (typeof string !== "string") {
|
|
911
|
-
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
912
|
-
}
|
|
913
|
-
return string.replace(regex, "");
|
|
914
|
-
}
|
|
915
|
-
function isAmbiguous(x) {
|
|
916
|
-
return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
|
|
917
|
-
}
|
|
918
|
-
function isFullWidth(x) {
|
|
919
|
-
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
920
|
-
}
|
|
921
|
-
function isWide(x) {
|
|
922
|
-
return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9776 && x <= 9783 || x >= 9800 && x <= 9811 || x === 9855 || x >= 9866 && x <= 9871 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12773 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101631 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x >= 119552 && x <= 119638 || x >= 119648 && x <= 119670 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129673 || x >= 129679 && x <= 129734 || x >= 129742 && x <= 129756 || x >= 129759 && x <= 129769 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
923
|
-
}
|
|
924
|
-
function validate(codePoint) {
|
|
925
|
-
if (!Number.isSafeInteger(codePoint)) {
|
|
926
|
-
throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
927
|
-
}
|
|
928
|
-
}
|
|
929
|
-
function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
930
|
-
validate(codePoint);
|
|
931
|
-
if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) {
|
|
932
|
-
return 2;
|
|
933
|
-
}
|
|
934
|
-
return 1;
|
|
935
|
-
}
|
|
936
|
-
var emojiRegex = () => {
|
|
937
|
-
return /[#*0-9]\uFE0F?\u20E3|[\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23ED-\u23EF\u23F1\u23F2\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB\u25FC\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692\u2694-\u2697\u2699\u269B\u269C\u26A0\u26A7\u26AA\u26B0\u26B1\u26BD\u26BE\u26C4\u26C8\u26CF\u26D1\u26E9\u26F0-\u26F5\u26F7\u26F8\u26FA\u2702\u2708\u2709\u270F\u2712\u2714\u2716\u271D\u2721\u2733\u2734\u2744\u2747\u2757\u2763\u27A1\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B55\u3030\u303D\u3297\u3299]\uFE0F?|[\u261D\u270C\u270D](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\u270A\u270B](?:\uD83C[\uDFFB-\uDFFF])?|[\u23E9-\u23EC\u23F0\u23F3\u25FD\u2693\u26A1\u26AB\u26C5\u26CE\u26D4\u26EA\u26FD\u2705\u2728\u274C\u274E\u2753-\u2755\u2795-\u2797\u27B0\u27BF\u2B50]|\u26D3\uFE0F?(?:\u200D\uD83D\uDCA5)?|\u26F9(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\u2764\uFE0F?(?:\u200D(?:\uD83D\uDD25|\uD83E\uDE79))?|\uD83C(?:[\uDC04\uDD70\uDD71\uDD7E\uDD7F\uDE02\uDE37\uDF21\uDF24-\uDF2C\uDF36\uDF7D\uDF96\uDF97\uDF99-\uDF9B\uDF9E\uDF9F\uDFCD\uDFCE\uDFD4-\uDFDF\uDFF5\uDFF7]\uFE0F?|[\uDF85\uDFC2\uDFC7](?:\uD83C[\uDFFB-\uDFFF])?|[\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF43\uDF45-\uDF4A\uDF4C-\uDF7C\uDF7E-\uDF84\uDF86-\uDF93\uDFA0-\uDFC1\uDFC5\uDFC6\uDFC8\uDFC9\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF8-\uDFFF]|\uDDE6\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF]|\uDDE7\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF]|\uDDE8\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF7\uDDFA-\uDDFF]|\uDDE9\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF]|\uDDEA\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA]|\uDDEB\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7]|\uDDEC\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE]|\uDDED\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA]|\uDDEE\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9]|\uDDEF\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5]|\uDDF0\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF]|\uDDF1\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE]|\uDDF2\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF]|\uDDF3\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF]|\uDDF4\uD83C\uDDF2|\uDDF5\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE]|\uDDF6\uD83C\uDDE6|\uDDF7\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC]|\uDDF8\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF]|\uDDF9\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF]|\uDDFA\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF]|\uDDFB\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA]|\uDDFC\uD83C[\uDDEB\uDDF8]|\uDDFD\uD83C\uDDF0|\uDDFE\uD83C[\uDDEA\uDDF9]|\uDDFF\uD83C[\uDDE6\uDDF2\uDDFC]|\uDF44(?:\u200D\uD83D\uDFEB)?|\uDF4B(?:\u200D\uD83D\uDFE9)?|\uDFC3(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDFF3\uFE0F?(?:\u200D(?:\u26A7\uFE0F?|\uD83C\uDF08))?|\uDFF4(?:\u200D\u2620\uFE0F?|\uDB40\uDC67\uDB40\uDC62\uDB40(?:\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDC73\uDB40\uDC63\uDB40\uDC74|\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F)?)|\uD83D(?:[\uDC3F\uDCFD\uDD49\uDD4A\uDD6F\uDD70\uDD73\uDD76-\uDD79\uDD87\uDD8A-\uDD8D\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA\uDECB\uDECD-\uDECF\uDEE0-\uDEE5\uDEE9\uDEF0\uDEF3]\uFE0F?|[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDC8F\uDC91\uDCAA\uDD7A\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC](?:\uD83C[\uDFFB-\uDFFF])?|[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4\uDEB5](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?|[\uDC00-\uDC07\uDC09-\uDC14\uDC16-\uDC25\uDC27-\uDC3A\uDC3C-\uDC3E\uDC40\uDC44\uDC45\uDC51-\uDC65\uDC6A\uDC79-\uDC7B\uDC7D-\uDC80\uDC84\uDC88-\uDC8E\uDC90\uDC92-\uDCA9\uDCAB-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDDA4\uDDFB-\uDE2D\uDE2F-\uDE34\uDE37-\uDE41\uDE43\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC08(?:\u200D\u2B1B)?|\uDC15(?:\u200D\uD83E\uDDBA)?|\uDC26(?:\u200D(?:\u2B1B|\uD83D\uDD25))?|\uDC3B(?:\u200D\u2744\uFE0F?)?|\uDC41\uFE0F?(?:\u200D\uD83D\uDDE8\uFE0F?)?|\uDC68(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDC68\uDC69]\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?)|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?\uDC68\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D\uDC68\uD83C[\uDFFB-\uDFFE])))?))?|\uDC69(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:\uDC8B\u200D\uD83D)?[\uDC68\uDC69]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D(?:[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?|\uDC69\u200D\uD83D(?:\uDC66(?:\u200D\uD83D\uDC66)?|\uDC67(?:\u200D\uD83D[\uDC66\uDC67])?))|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFC-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFD-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFD\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D\uD83D(?:[\uDC68\uDC69]|\uDC8B\u200D\uD83D[\uDC68\uDC69])\uD83C[\uDFFB-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uD83C[\uDFFB-\uDFFF]|\uFE0F)?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\uFE0F?)?|\uDE42(?:\u200D[\u2194\u2195]\uFE0F?)?|\uDEB6(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?)|\uD83E(?:[\uDD0C\uDD0F\uDD18-\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2\uDDD3\uDDD5\uDEC3-\uDEC5\uDEF0\uDEF2-\uDEF8](?:\uD83C[\uDFFB-\uDFFF])?|[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD\uDDCF\uDDD4\uDDD6-\uDDDD](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDDDE\uDDDF](?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD0D\uDD0E\uDD10-\uDD17\uDD20-\uDD25\uDD27-\uDD2F\uDD3A\uDD3F-\uDD45\uDD47-\uDD76\uDD78-\uDDB4\uDDB7\uDDBA\uDDBC-\uDDCC\uDDD0\uDDE0-\uDDFF\uDE70-\uDE7C\uDE80-\uDE89\uDE8F-\uDEC2\uDEC6\uDECE-\uDEDC\uDEDF-\uDEE9]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\uDDCE(?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D(?:[\u2640\u2642]\uFE0F?(?:\u200D\u27A1\uFE0F?)?|\u27A1\uFE0F?))?|\uDDD1(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1|\uDDD1\u200D\uD83E\uDDD2(?:\u200D\uD83E\uDDD2)?|\uDDD2(?:\u200D\uD83E\uDDD2)?))|\uD83C(?:\uDFFB(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFC-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFC(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFD-\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFD(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFE(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFD\uDFFF]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?|\uDFFF(?:\u200D(?:[\u2695\u2696\u2708]\uFE0F?|\u2764\uFE0F?\u200D(?:\uD83D\uDC8B\u200D)?\uD83E\uDDD1\uD83C[\uDFFB-\uDFFE]|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E(?:[\uDDAF\uDDBC\uDDBD](?:\u200D\u27A1\uFE0F?)?|[\uDDB0-\uDDB3]|\uDD1D\u200D\uD83E\uDDD1\uD83C[\uDFFB-\uDFFF])))?))?|\uDEF1(?:\uD83C(?:\uDFFB(?:\u200D\uD83E\uDEF2\uD83C[\uDFFC-\uDFFF])?|\uDFFC(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFD-\uDFFF])?|\uDFFD(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])?|\uDFFE(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFD\uDFFF])?|\uDFFF(?:\u200D\uD83E\uDEF2\uD83C[\uDFFB-\uDFFE])?))?)/g;
|
|
938
|
-
};
|
|
939
|
-
var _a7;
|
|
940
|
-
var segmenter = ((_a7 = globalThis.Intl) == null ? void 0 : _a7.Segmenter) ? new Intl.Segmenter() : { segment: (str) => str.split("") };
|
|
941
|
-
var defaultIgnorableCodePointRegex = new RegExp("^\\p{Default_Ignorable_Code_Point}$", "u");
|
|
942
|
-
function stringWidth$1(string, options = {}) {
|
|
943
|
-
if (typeof string !== "string" || string.length === 0) {
|
|
944
|
-
return 0;
|
|
945
|
-
}
|
|
946
|
-
const {
|
|
947
|
-
ambiguousIsNarrow = true,
|
|
948
|
-
countAnsiEscapeCodes = false
|
|
949
|
-
} = options;
|
|
950
|
-
if (!countAnsiEscapeCodes) {
|
|
951
|
-
string = stripAnsi2(string);
|
|
952
|
-
}
|
|
953
|
-
if (string.length === 0) {
|
|
954
|
-
return 0;
|
|
955
|
-
}
|
|
956
|
-
let width = 0;
|
|
957
|
-
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
958
|
-
for (const { segment: character } of segmenter.segment(string)) {
|
|
959
|
-
const codePoint = character.codePointAt(0);
|
|
960
|
-
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
|
961
|
-
continue;
|
|
962
|
-
}
|
|
963
|
-
if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) {
|
|
964
|
-
continue;
|
|
965
|
-
}
|
|
966
|
-
if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) {
|
|
967
|
-
continue;
|
|
968
|
-
}
|
|
969
|
-
if (codePoint >= 55296 && codePoint <= 57343) {
|
|
970
|
-
continue;
|
|
971
|
-
}
|
|
972
|
-
if (codePoint >= 65024 && codePoint <= 65039) {
|
|
973
|
-
continue;
|
|
974
|
-
}
|
|
975
|
-
if (defaultIgnorableCodePointRegex.test(character)) {
|
|
976
|
-
continue;
|
|
977
|
-
}
|
|
978
|
-
if (emojiRegex().test(character)) {
|
|
979
|
-
width += 2;
|
|
980
|
-
continue;
|
|
981
|
-
}
|
|
982
|
-
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
983
|
-
}
|
|
984
|
-
return width;
|
|
985
|
-
}
|
|
986
|
-
function isUnicodeSupported() {
|
|
987
|
-
const { env: env2 } = g$1;
|
|
988
|
-
const { TERM, TERM_PROGRAM } = env2;
|
|
989
|
-
if (g$1.platform !== "win32") {
|
|
990
|
-
return TERM !== "linux";
|
|
991
|
-
}
|
|
992
|
-
return Boolean(env2.WT_SESSION) || Boolean(env2.TERMINUS_SUBLIME) || env2.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env2.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
993
|
-
}
|
|
994
|
-
var TYPE_COLOR_MAP = {
|
|
995
|
-
info: "cyan",
|
|
996
|
-
fail: "red",
|
|
997
|
-
success: "green",
|
|
998
|
-
ready: "green",
|
|
999
|
-
start: "magenta"
|
|
1000
|
-
};
|
|
1001
|
-
var LEVEL_COLOR_MAP = {
|
|
1002
|
-
0: "red",
|
|
1003
|
-
1: "yellow"
|
|
1004
|
-
};
|
|
1005
|
-
var unicode = isUnicodeSupported();
|
|
1006
|
-
var s = (c2, fallback) => unicode ? c2 : fallback;
|
|
1007
|
-
var TYPE_ICONS = {
|
|
1008
|
-
error: s("\u2716", "\xD7"),
|
|
1009
|
-
fatal: s("\u2716", "\xD7"),
|
|
1010
|
-
ready: s("\u2714", "\u221A"),
|
|
1011
|
-
warn: s("\u26A0", "\u203C"),
|
|
1012
|
-
info: s("\u2139", "i"),
|
|
1013
|
-
success: s("\u2714", "\u221A"),
|
|
1014
|
-
debug: s("\u2699", "D"),
|
|
1015
|
-
trace: s("\u2192", "\u2192"),
|
|
1016
|
-
fail: s("\u2716", "\xD7"),
|
|
1017
|
-
start: s("\u25D0", "o"),
|
|
1018
|
-
log: ""
|
|
1019
|
-
};
|
|
1020
|
-
function stringWidth(str) {
|
|
1021
|
-
const hasICU = typeof Intl === "object";
|
|
1022
|
-
if (!hasICU || !Intl.Segmenter) {
|
|
1023
|
-
return stripAnsi(str).length;
|
|
1024
|
-
}
|
|
1025
|
-
return stringWidth$1(str);
|
|
1026
|
-
}
|
|
1027
|
-
var FancyReporter = class extends BasicReporter {
|
|
1028
|
-
formatStack(stack, message, opts) {
|
|
1029
|
-
const indent = " ".repeat(((opts == null ? void 0 : opts.errorLevel) || 0) + 1);
|
|
1030
|
-
return `
|
|
1031
|
-
${indent}` + parseStack(stack, message).map(
|
|
1032
|
-
(line) => " " + line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_2, m) => `(${colors.cyan(m)})`)
|
|
1033
|
-
).join(`
|
|
1034
|
-
${indent}`);
|
|
1035
|
-
}
|
|
1036
|
-
formatType(logObj, isBadge, opts) {
|
|
1037
|
-
const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
|
|
1038
|
-
if (isBadge) {
|
|
1039
|
-
return getBgColor(typeColor)(
|
|
1040
|
-
colors.black(` ${logObj.type.toUpperCase()} `)
|
|
1041
|
-
);
|
|
1042
|
-
}
|
|
1043
|
-
const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
|
|
1044
|
-
return _type ? getColor2(typeColor)(_type) : "";
|
|
1045
|
-
}
|
|
1046
|
-
formatLogObj(logObj, opts) {
|
|
1047
|
-
const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
|
|
1048
|
-
"\n"
|
|
1049
|
-
);
|
|
1050
|
-
if (logObj.type === "box") {
|
|
1051
|
-
return box(
|
|
1052
|
-
characterFormat(
|
|
1053
|
-
message + (additional.length > 0 ? "\n" + additional.join("\n") : "")
|
|
1054
|
-
),
|
|
1055
|
-
{
|
|
1056
|
-
title: logObj.title ? characterFormat(logObj.title) : void 0,
|
|
1057
|
-
style: logObj.style
|
|
1058
|
-
}
|
|
1059
|
-
);
|
|
1060
|
-
}
|
|
1061
|
-
const date = this.formatDate(logObj.date, opts);
|
|
1062
|
-
const coloredDate = date && colors.gray(date);
|
|
1063
|
-
const isBadge = logObj.badge ?? logObj.level < 2;
|
|
1064
|
-
const type = this.formatType(logObj, isBadge, opts);
|
|
1065
|
-
const tag = logObj.tag ? colors.gray(logObj.tag) : "";
|
|
1066
|
-
let line;
|
|
1067
|
-
const left = this.filterAndJoin([type, characterFormat(message)]);
|
|
1068
|
-
const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
|
|
1069
|
-
const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
|
|
1070
|
-
line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
|
|
1071
|
-
line += characterFormat(
|
|
1072
|
-
additional.length > 0 ? "\n" + additional.join("\n") : ""
|
|
1073
|
-
);
|
|
1074
|
-
if (logObj.type === "trace") {
|
|
1075
|
-
const _err = new Error("Trace: " + logObj.message);
|
|
1076
|
-
line += this.formatStack(_err.stack || "", _err.message);
|
|
1077
|
-
}
|
|
1078
|
-
return isBadge ? "\n" + line + "\n" : line;
|
|
1079
|
-
}
|
|
1080
|
-
};
|
|
1081
|
-
function characterFormat(str) {
|
|
1082
|
-
return str.replace(/`([^`]+)`/gm, (_2, m) => colors.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_2, m) => ` ${colors.underline(m)} `);
|
|
1083
|
-
}
|
|
1084
|
-
function getColor2(color = "white") {
|
|
1085
|
-
return colors[color] || colors.white;
|
|
1086
|
-
}
|
|
1087
|
-
function getBgColor(color = "bgWhite") {
|
|
1088
|
-
return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
|
|
1089
|
-
}
|
|
1090
|
-
function createConsola2(options = {}) {
|
|
1091
|
-
let level = _getDefaultLogLevel();
|
|
1092
|
-
if (process.env.CONSOLA_LEVEL) {
|
|
1093
|
-
level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
|
|
1094
|
-
}
|
|
1095
|
-
const consola2 = createConsola({
|
|
1096
|
-
level,
|
|
1097
|
-
defaults: { level },
|
|
1098
|
-
stdout: process.stdout,
|
|
1099
|
-
stderr: process.stderr,
|
|
1100
|
-
prompt: (...args) => import("./prompt-X7YDA36E.js").then((m) => m.prompt(...args)),
|
|
1101
|
-
reporters: options.reporters || [
|
|
1102
|
-
options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()
|
|
1103
|
-
],
|
|
1104
|
-
...options
|
|
1105
|
-
});
|
|
1106
|
-
return consola2;
|
|
1107
|
-
}
|
|
1108
|
-
function _getDefaultLogLevel() {
|
|
1109
|
-
if (g) {
|
|
1110
|
-
return LogLevels.debug;
|
|
1111
|
-
}
|
|
1112
|
-
if (R) {
|
|
1113
|
-
return LogLevels.warn;
|
|
1114
|
-
}
|
|
1115
|
-
return LogLevels.info;
|
|
1116
|
-
}
|
|
1117
|
-
var consola = createConsola2();
|
|
1118
|
-
|
|
1119
|
-
// src/cli.ts
|
|
1120
|
-
import { blue, bold, cyan as cyan2, dim, red as red2, yellow as yellow2 } from "kolorist";
|
|
1121
|
-
import { getChangelogMarkdown } from "@soybeanjs/changelog";
|
|
1122
|
-
|
|
1123
|
-
// package.json
|
|
1124
|
-
var version = "0.3.25";
|
|
1125
|
-
|
|
1126
|
-
// src/github.ts
|
|
1127
|
-
import { ofetch } from "ofetch";
|
|
1128
|
-
import { cyan, green, red, yellow } from "kolorist";
|
|
1129
|
-
function getHeaders(githubToken) {
|
|
1130
|
-
return {
|
|
1131
|
-
accept: "application/vnd.github.v3+json",
|
|
1132
|
-
authorization: `token ${githubToken}`
|
|
1133
|
-
};
|
|
1134
|
-
}
|
|
1135
|
-
async function hasTagOnGitHub(tag, repo, githubToken) {
|
|
1136
|
-
try {
|
|
1137
|
-
await ofetch(`https://api.github.com/repos/${repo}/git/ref/tags/${tag}`, {
|
|
1138
|
-
headers: getHeaders(githubToken)
|
|
1139
|
-
});
|
|
1140
|
-
return true;
|
|
1141
|
-
} catch (e) {
|
|
1142
|
-
return false;
|
|
1143
|
-
}
|
|
1144
|
-
}
|
|
1145
|
-
async function sendRelease(options, content) {
|
|
1146
|
-
const headers = getHeaders(options.github.token);
|
|
1147
|
-
const github = options.github.repo;
|
|
1148
|
-
let url = `https://api.github.com/repos/${github}/releases`;
|
|
1149
|
-
let method = "POST";
|
|
1150
|
-
try {
|
|
1151
|
-
const exists = await ofetch(`https://api.github.com/repos/${github}/releases/tags/${options.to}`, {
|
|
1152
|
-
headers
|
|
1153
|
-
});
|
|
1154
|
-
if (exists.url) {
|
|
1155
|
-
url = exists.url;
|
|
1156
|
-
method = "PATCH";
|
|
1157
|
-
}
|
|
1158
|
-
} catch (e) {
|
|
1159
|
-
}
|
|
1160
|
-
const body = {
|
|
1161
|
-
body: content,
|
|
1162
|
-
draft: false,
|
|
1163
|
-
name: options.to,
|
|
1164
|
-
prerelease: options.prerelease,
|
|
1165
|
-
tag_name: options.to
|
|
1166
|
-
};
|
|
1167
|
-
const webUrl = `https://github.com/${github}/releases/new?title=${encodeURIComponent(
|
|
1168
|
-
String(body.name)
|
|
1169
|
-
)}&body=${encodeURIComponent(String(body.body))}&tag=${encodeURIComponent(String(options.to))}&prerelease=${options.prerelease}`;
|
|
1170
|
-
try {
|
|
1171
|
-
consola.log(cyan(method === "POST" ? "Creating release notes..." : "Updating release notes..."));
|
|
1172
|
-
const res = await ofetch(url, {
|
|
1173
|
-
method,
|
|
1174
|
-
body: JSON.stringify(body),
|
|
1175
|
-
headers
|
|
1176
|
-
});
|
|
1177
|
-
consola.log(green(`Released on ${res.html_url}`));
|
|
1178
|
-
} catch (e) {
|
|
1179
|
-
consola.error(red("Failed to create the release. Using the following link to create it manually:"));
|
|
1180
|
-
consola.error(yellow(webUrl));
|
|
1181
|
-
throw e;
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
async function execCommand(cmd, args) {
|
|
1185
|
-
const { execa } = await import("execa");
|
|
1186
|
-
const res = await execa(cmd, args);
|
|
1187
|
-
return res.stdout.trim();
|
|
1188
|
-
}
|
|
1189
|
-
async function isRepoShallow() {
|
|
1190
|
-
return (await execCommand("git", ["rev-parse", "--is-shallow-repository"])).trim() === "true";
|
|
1191
|
-
}
|
|
1192
|
-
|
|
1193
|
-
// src/cli.ts
|
|
1194
|
-
function setupCli() {
|
|
1195
|
-
const cli = cac("githublogen");
|
|
1196
|
-
cli.version(version).option("-t, --token <path>", "GitHub Token").help();
|
|
1197
|
-
cli.command("").action(async (args) => {
|
|
1198
|
-
var _a8;
|
|
1199
|
-
try {
|
|
1200
|
-
const cwd = process2.cwd();
|
|
1201
|
-
const { options, commits, markdown } = await getChangelogMarkdown(
|
|
1202
|
-
{
|
|
1203
|
-
cwd,
|
|
1204
|
-
...args
|
|
1205
|
-
},
|
|
1206
|
-
false
|
|
1207
|
-
);
|
|
1208
|
-
consola.log(cyan2(options.from) + dim(" -> ") + blue(options.to) + dim(` (${commits.length} commits)`));
|
|
1209
|
-
if (!await hasTagOnGitHub(options.to, options.github.repo, options.github.token)) {
|
|
1210
|
-
consola.error(yellow2(`Current ref "${bold(options.to)}" is not available as tags on GitHub. Release skipped.`));
|
|
1211
|
-
if (process2.exitCode) {
|
|
1212
|
-
process2.exitCode = 1;
|
|
1213
|
-
}
|
|
1214
|
-
}
|
|
1215
|
-
if (!commits.length && await isRepoShallow()) {
|
|
1216
|
-
consola.error(
|
|
1217
|
-
yellow2(
|
|
1218
|
-
"The repo seems to be clone shallowly, which make changelog failed to generate. You might want to specify `fetch-depth: 0` in your CI config."
|
|
1219
|
-
)
|
|
1220
|
-
);
|
|
1221
|
-
if (process2.exitCode) {
|
|
1222
|
-
process2.exitCode = 1;
|
|
1223
|
-
}
|
|
1224
|
-
return;
|
|
1225
|
-
}
|
|
1226
|
-
await sendRelease(options, markdown);
|
|
1227
|
-
} catch (e) {
|
|
1228
|
-
consola.error(red2(String(e)));
|
|
1229
|
-
if (e == null ? void 0 : e.stack) {
|
|
1230
|
-
consola.error(dim((_a8 = e.stack) == null ? void 0 : _a8.split("\n").slice(1).join("\n")));
|
|
1231
|
-
}
|
|
1232
|
-
process2.exit(1);
|
|
1233
|
-
}
|
|
1234
|
-
});
|
|
1235
|
-
cli.parse();
|
|
1236
|
-
}
|
|
1237
|
-
setupCli();
|