@innei/pretty-logger-core 0.3.2 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,422 +1,304 @@
1
- "use strict";
1
+ //#region rolldown:runtime
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __getProtoOf = Object.getPrototypeOf;
7
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
8
+ var __commonJS = (cb, mod) => function() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
10
  };
12
11
  var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
12
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
13
+ key = keys[i];
14
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
15
+ get: ((k) => from[k]).bind(null, key),
16
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
17
+ });
18
+ }
19
+ return to;
19
20
  };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
22
+ value: mod,
23
+ enumerable: true
24
+ }) : target, mod));
29
25
 
30
- // index.ts
31
- var core_exports = {};
32
- __export(core_exports, {
33
- BasicReporter: () => BasicReporter,
34
- BrowserReporter: () => BrowserReporter,
35
- Consola: () => Consola,
36
- FancyReporter: () => FancyReporter,
37
- FileReporter: () => FileReporter,
38
- LEVEL_COLOR_MAP: () => LEVEL_COLOR_MAP,
39
- LogLevels: () => LogLevels,
40
- LogTypes: () => LogTypes,
41
- LoggerReporter: () => LoggerReporter,
42
- SubscriberReporter: () => SubscriberReporter,
43
- TYPE_COLOR_MAP: () => TYPE_COLOR_MAP,
44
- consola: () => consola,
45
- createConsola: () => createConsola2,
46
- createLoggerConsola: () => createLoggerConsola,
47
- wrapperSubscribers: () => wrapperSubscribers
48
- });
49
- module.exports = __toCommonJS(core_exports);
26
+ //#endregion
27
+ const std_env = __toESM(require("std-env"));
28
+ const defu = __toESM(require("defu"));
29
+ const node_util = __toESM(require("node:util"));
30
+ const node_path = __toESM(require("node:path"));
31
+ const node_tty = __toESM(require("node:tty"));
32
+ const node_fs = __toESM(require("node:fs"));
33
+ const cron = __toESM(require("cron"));
34
+ const picocolors = __toESM(require("picocolors"));
35
+ const node_events = __toESM(require("node:events"));
50
36
 
51
- // consola.instance.ts
52
- var import_std_env3 = require("std-env");
53
-
54
- // consola/index.ts
55
- var import_std_env = require("std-env");
56
-
57
- // consola/consola.ts
58
- var import_defu = require("defu");
59
-
60
- // consola/constants.ts
61
- var LogLevels = {
62
- silent: Number.NEGATIVE_INFINITY,
63
- fatal: 0,
64
- error: 0,
65
- warn: 1,
66
- log: 2,
67
- info: 3,
68
- success: 3,
69
- fail: 3,
70
- ready: 3,
71
- start: 3,
72
- box: 3,
73
- debug: 4,
74
- trace: 5,
75
- verbose: Number.POSITIVE_INFINITY
37
+ //#region consola/constants.ts
38
+ const LogLevels = {
39
+ silent: Number.NEGATIVE_INFINITY,
40
+ fatal: 0,
41
+ error: 0,
42
+ warn: 1,
43
+ log: 2,
44
+ info: 3,
45
+ success: 3,
46
+ fail: 3,
47
+ ready: 3,
48
+ start: 3,
49
+ box: 3,
50
+ debug: 4,
51
+ trace: 5,
52
+ verbose: Number.POSITIVE_INFINITY
76
53
  };
77
- var LogTypes = {
78
- // Silent
79
- silent: {
80
- level: -1
81
- },
82
- // Level 0
83
- fatal: {
84
- level: LogLevels.fatal
85
- },
86
- error: {
87
- level: LogLevels.error
88
- },
89
- // Level 1
90
- warn: {
91
- level: LogLevels.warn
92
- },
93
- // Level 2
94
- log: {
95
- level: LogLevels.log
96
- },
97
- // Level 3
98
- info: {
99
- level: LogLevels.info
100
- },
101
- success: {
102
- level: LogLevels.success
103
- },
104
- fail: {
105
- level: LogLevels.fail
106
- },
107
- ready: {
108
- level: LogLevels.info
109
- },
110
- start: {
111
- level: LogLevels.info
112
- },
113
- box: {
114
- level: LogLevels.info
115
- },
116
- // Level 4
117
- debug: {
118
- level: LogLevels.debug
119
- },
120
- // Level 5
121
- trace: {
122
- level: LogLevels.trace
123
- },
124
- // Verbose
125
- verbose: {
126
- level: LogLevels.verbose
127
- }
54
+ const LogTypes = {
55
+ silent: { level: -1 },
56
+ fatal: { level: LogLevels.fatal },
57
+ error: { level: LogLevels.error },
58
+ warn: { level: LogLevels.warn },
59
+ log: { level: LogLevels.log },
60
+ info: { level: LogLevels.info },
61
+ success: { level: LogLevels.success },
62
+ fail: { level: LogLevels.fail },
63
+ ready: { level: LogLevels.info },
64
+ start: { level: LogLevels.info },
65
+ box: { level: LogLevels.info },
66
+ debug: { level: LogLevels.debug },
67
+ trace: { level: LogLevels.trace },
68
+ verbose: { level: LogLevels.verbose }
128
69
  };
129
70
 
130
- // consola/utils/log.ts
71
+ //#endregion
72
+ //#region consola/utils/log.ts
131
73
  function isPlainObject(obj) {
132
- return Object.prototype.toString.call(obj) === "[object Object]";
74
+ return Object.prototype.toString.call(obj) === "[object Object]";
133
75
  }
134
76
  function isLogObj(arg) {
135
- if (!isPlainObject(arg)) {
136
- return false;
137
- }
138
- if (!arg.message && !arg.args) {
139
- return false;
140
- }
141
- if (arg.stack) {
142
- return false;
143
- }
144
- return true;
77
+ if (!isPlainObject(arg)) return false;
78
+ if (!arg.message && !arg.args) return false;
79
+ if (arg.stack) return false;
80
+ return true;
145
81
  }
146
82
 
147
- // consola/consola.ts
148
- var paused = false;
149
- var queue = [];
150
- var Consola = class _Consola {
151
- constructor(options = {}) {
152
- const types = options.types || LogTypes;
153
- this.options = (0, import_defu.defu)(
154
- {
155
- ...options,
156
- defaults: { ...options.defaults },
157
- level: _normalizeLogLevel(options.level, types),
158
- reporters: [...options.reporters || []]
159
- },
160
- {
161
- types: LogTypes,
162
- throttle: 1e3,
163
- throttleMin: 5,
164
- formatOptions: {
165
- date: true,
166
- colors: false,
167
- compact: true
168
- }
169
- }
170
- );
171
- for (const type in types) {
172
- const defaults = {
173
- type,
174
- ...this.options.defaults,
175
- ...types[type]
176
- };
177
- this[type] = this._wrapLogFn(defaults);
178
- this[type].raw = this._wrapLogFn(
179
- defaults,
180
- true
181
- );
182
- }
183
- if (this.options.mockFn) {
184
- this.mockTypes();
185
- }
186
- this._lastLog = {};
187
- }
188
- get level() {
189
- return this.options.level;
190
- }
191
- set level(level) {
192
- this.options.level = _normalizeLogLevel(
193
- level,
194
- this.options.types,
195
- this.options.level
196
- );
197
- }
198
- create(options) {
199
- const instance = new _Consola({
200
- ...this.options,
201
- ...options
202
- });
203
- if (this._mockFn) {
204
- instance.mockTypes(this._mockFn);
205
- }
206
- return instance;
207
- }
208
- withDefaults(defaults) {
209
- return this.create({
210
- ...this.options,
211
- defaults: {
212
- ...this.options.defaults,
213
- ...defaults
214
- }
215
- });
216
- }
217
- withTag(tag) {
218
- return this.withDefaults({
219
- tag: this.options.defaults.tag ? `${this.options.defaults.tag}:${tag}` : tag
220
- });
221
- }
222
- addReporter(reporter) {
223
- this.options.reporters.push(reporter);
224
- return this;
225
- }
226
- removeReporter(reporter) {
227
- if (reporter) {
228
- const i = this.options.reporters.indexOf(reporter);
229
- if (i >= 0) {
230
- return this.options.reporters.splice(i, 1);
231
- }
232
- } else {
233
- this.options.reporters.splice(0);
234
- }
235
- return this;
236
- }
237
- setReporters(reporters) {
238
- this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
239
- return this;
240
- }
241
- wrapAll() {
242
- this.wrapConsole();
243
- this.wrapStd();
244
- }
245
- restoreAll() {
246
- this.restoreConsole();
247
- this.restoreStd();
248
- }
249
- wrapConsole() {
250
- for (const type in this.options.types) {
251
- if (!console[`__${type}`]) {
252
- ;
253
- console[`__${type}`] = console[type];
254
- }
255
- ;
256
- console[type] = this[type].raw;
257
- }
258
- }
259
- restoreConsole() {
260
- for (const type in this.options.types) {
261
- if (console[`__${type}`]) {
262
- ;
263
- console[type] = console[`__${type}`];
264
- delete console[`__${type}`];
265
- }
266
- }
267
- }
268
- wrapStd() {
269
- this._wrapStream(this.options.stdout, "log");
270
- this._wrapStream(this.options.stderr, "log");
271
- }
272
- _wrapStream(stream, type) {
273
- if (!stream) {
274
- return;
275
- }
276
- if (!stream.__write) {
277
- ;
278
- stream.__write = stream.write;
279
- }
280
- ;
281
- stream.write = (data) => {
282
- ;
283
- this[type].raw(String(data).trim());
284
- };
285
- }
286
- restoreStd() {
287
- this._restoreStream(this.options.stdout);
288
- this._restoreStream(this.options.stderr);
289
- }
290
- _restoreStream(stream) {
291
- if (!stream) {
292
- return;
293
- }
294
- if (stream.__write) {
295
- stream.write = stream.__write;
296
- delete stream.__write;
297
- }
298
- }
299
- pauseLogs() {
300
- paused = true;
301
- }
302
- resumeLogs() {
303
- paused = false;
304
- const _queue = queue.splice(0);
305
- for (const item of _queue) {
306
- item[0]._logFn(item[1], item[2]);
307
- }
308
- }
309
- mockTypes(mockFn) {
310
- const _mockFn = mockFn || this.options.mockFn;
311
- this._mockFn = _mockFn;
312
- if (typeof _mockFn !== "function") {
313
- return;
314
- }
315
- for (const type in this.options.types) {
316
- ;
317
- this[type] = _mockFn(type, this.options.types[type]) || this[type];
318
- this[type].raw = this[type];
319
- }
320
- }
321
- _wrapLogFn(defaults, isRaw) {
322
- return (...args) => {
323
- if (paused) {
324
- queue.push([this, defaults, args, isRaw]);
325
- return;
326
- }
327
- return this._logFn(defaults, args, isRaw);
328
- };
329
- }
330
- _logFn(defaults, args, isRaw) {
331
- if ((defaults.level || 0) > this.level) {
332
- return false;
333
- }
334
- const logObj = {
335
- date: /* @__PURE__ */ new Date(),
336
- args: [],
337
- ...defaults,
338
- level: _normalizeLogLevel(defaults.level, this.options.types)
339
- };
340
- if (!isRaw && args.length === 1 && isLogObj(args[0])) {
341
- Object.assign(logObj, args[0]);
342
- } else {
343
- logObj.args = [...args];
344
- }
345
- if (logObj.message) {
346
- logObj.args.unshift(logObj.message);
347
- delete logObj.message;
348
- }
349
- if (logObj.additional) {
350
- if (!Array.isArray(logObj.additional)) {
351
- logObj.additional = logObj.additional.split("\n");
352
- }
353
- logObj.args.push(`
354
- ${logObj.additional.join("\n")}`);
355
- delete logObj.additional;
356
- }
357
- logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
358
- logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
359
- const resolveLog = (newLog = false) => {
360
- const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
361
- if (this._lastLog.object && repeated > 0) {
362
- const args2 = [...this._lastLog.object.args];
363
- if (repeated > 1) {
364
- args2.push(`(repeated ${repeated} times)`);
365
- }
366
- this._log({ ...this._lastLog.object, args: args2 });
367
- this._lastLog.count = 1;
368
- }
369
- if (newLog) {
370
- this._lastLog.object = logObj;
371
- this._log(logObj);
372
- }
373
- };
374
- clearTimeout(this._lastLog.timeout);
375
- const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
376
- this._lastLog.time = logObj.date;
377
- if (diffTime < this.options.throttle) {
378
- try {
379
- const serializedLog = JSON.stringify([
380
- logObj.type,
381
- logObj.tag,
382
- logObj.args
383
- ]);
384
- const isSameLog = this._lastLog.serialized === serializedLog;
385
- this._lastLog.serialized = serializedLog;
386
- if (isSameLog) {
387
- this._lastLog.count = (this._lastLog.count || 0) + 1;
388
- if (this._lastLog.count > this.options.throttleMin) {
389
- this._lastLog.timeout = setTimeout(
390
- resolveLog,
391
- this.options.throttle
392
- );
393
- return;
394
- }
395
- }
396
- } catch {
397
- }
398
- }
399
- resolveLog(true);
400
- }
401
- _log(logObj) {
402
- for (const reporter of this.options.reporters) {
403
- reporter.log(logObj, {
404
- options: this.options
405
- });
406
- }
407
- }
83
+ //#endregion
84
+ //#region consola/consola.ts
85
+ let paused = false;
86
+ const queue = [];
87
+ var Consola = class Consola {
88
+ constructor(options = {}) {
89
+ const types = options.types || LogTypes;
90
+ this.options = (0, defu.defu)({
91
+ ...options,
92
+ defaults: { ...options.defaults },
93
+ level: _normalizeLogLevel(options.level, types),
94
+ reporters: [...options.reporters || []]
95
+ }, {
96
+ types: LogTypes,
97
+ throttle: 1e3,
98
+ throttleMin: 5,
99
+ formatOptions: {
100
+ date: true,
101
+ colors: false,
102
+ compact: true
103
+ }
104
+ });
105
+ for (const type in types) {
106
+ const defaults = {
107
+ type,
108
+ ...this.options.defaults,
109
+ ...types[type]
110
+ };
111
+ this[type] = this._wrapLogFn(defaults);
112
+ this[type].raw = this._wrapLogFn(defaults, true);
113
+ }
114
+ if (this.options.mockFn) this.mockTypes();
115
+ this._lastLog = {};
116
+ }
117
+ get level() {
118
+ return this.options.level;
119
+ }
120
+ set level(level) {
121
+ this.options.level = _normalizeLogLevel(level, this.options.types, this.options.level);
122
+ }
123
+ create(options) {
124
+ const instance = new Consola({
125
+ ...this.options,
126
+ ...options
127
+ });
128
+ if (this._mockFn) instance.mockTypes(this._mockFn);
129
+ return instance;
130
+ }
131
+ withDefaults(defaults) {
132
+ return this.create({
133
+ ...this.options,
134
+ defaults: {
135
+ ...this.options.defaults,
136
+ ...defaults
137
+ }
138
+ });
139
+ }
140
+ withTag(tag) {
141
+ return this.withDefaults({ tag: this.options.defaults.tag ? `${this.options.defaults.tag}:${tag}` : tag });
142
+ }
143
+ addReporter(reporter) {
144
+ this.options.reporters.push(reporter);
145
+ return this;
146
+ }
147
+ removeReporter(reporter) {
148
+ if (reporter) {
149
+ const i = this.options.reporters.indexOf(reporter);
150
+ if (i !== -1) return this.options.reporters.splice(i, 1);
151
+ } else this.options.reporters.splice(0);
152
+ return this;
153
+ }
154
+ setReporters(reporters) {
155
+ this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
156
+ return this;
157
+ }
158
+ wrapAll() {
159
+ this.wrapConsole();
160
+ this.wrapStd();
161
+ }
162
+ restoreAll() {
163
+ this.restoreConsole();
164
+ this.restoreStd();
165
+ }
166
+ wrapConsole() {
167
+ for (const type in this.options.types) {
168
+ if (!console[`__${type}`]) console[`__${type}`] = console[type];
169
+ console[type] = this[type].raw;
170
+ }
171
+ }
172
+ restoreConsole() {
173
+ for (const type in this.options.types) if (console[`__${type}`]) {
174
+ console[type] = console[`__${type}`];
175
+ delete console[`__${type}`];
176
+ }
177
+ }
178
+ wrapStd() {
179
+ this._wrapStream(this.options.stdout, "log");
180
+ this._wrapStream(this.options.stderr, "log");
181
+ }
182
+ _wrapStream(stream, type) {
183
+ if (!stream) return;
184
+ if (!stream.__write) stream.__write = stream.write;
185
+ stream.write = (data) => {
186
+ this[type].raw(String(data).trim());
187
+ };
188
+ }
189
+ restoreStd() {
190
+ this._restoreStream(this.options.stdout);
191
+ this._restoreStream(this.options.stderr);
192
+ }
193
+ _restoreStream(stream) {
194
+ if (!stream) return;
195
+ if (stream.__write) {
196
+ stream.write = stream.__write;
197
+ delete stream.__write;
198
+ }
199
+ }
200
+ pauseLogs() {
201
+ paused = true;
202
+ }
203
+ resumeLogs() {
204
+ paused = false;
205
+ const _queue = queue.splice(0);
206
+ for (const item of _queue) item[0]._logFn(item[1], item[2]);
207
+ }
208
+ mockTypes(mockFn) {
209
+ const _mockFn = mockFn || this.options.mockFn;
210
+ this._mockFn = _mockFn;
211
+ if (typeof _mockFn !== "function") return;
212
+ for (const type in this.options.types) {
213
+ this[type] = _mockFn(type, this.options.types[type]) || this[type];
214
+ this[type].raw = this[type];
215
+ }
216
+ }
217
+ _wrapLogFn(defaults, isRaw) {
218
+ return (...args) => {
219
+ if (paused) {
220
+ queue.push([
221
+ this,
222
+ defaults,
223
+ args,
224
+ isRaw
225
+ ]);
226
+ return;
227
+ }
228
+ return this._logFn(defaults, args, isRaw);
229
+ };
230
+ }
231
+ _logFn(defaults, args, isRaw) {
232
+ if ((defaults.level || 0) > this.level) return false;
233
+ const logObj = {
234
+ date: new Date(),
235
+ args: [],
236
+ ...defaults,
237
+ level: _normalizeLogLevel(defaults.level, this.options.types)
238
+ };
239
+ if (!isRaw && args.length === 1 && isLogObj(args[0])) Object.assign(logObj, args[0]);
240
+ else logObj.args = [...args];
241
+ if (logObj.message) {
242
+ logObj.args.unshift(logObj.message);
243
+ delete logObj.message;
244
+ }
245
+ if (logObj.additional) {
246
+ if (!Array.isArray(logObj.additional)) logObj.additional = logObj.additional.split("\n");
247
+ logObj.args.push(`\n${logObj.additional.join("\n")}`);
248
+ delete logObj.additional;
249
+ }
250
+ logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
251
+ logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
252
+ /**
253
+ * @param newLog false if the throttle expired and
254
+ * we don't want to log a duplicate
255
+ */
256
+ const resolveLog = (newLog = false) => {
257
+ const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
258
+ if (this._lastLog.object && repeated > 0) {
259
+ const args$1 = [...this._lastLog.object.args];
260
+ if (repeated > 1) args$1.push(`(repeated ${repeated} times)`);
261
+ this._log({
262
+ ...this._lastLog.object,
263
+ args: args$1
264
+ });
265
+ this._lastLog.count = 1;
266
+ }
267
+ if (newLog) {
268
+ this._lastLog.object = logObj;
269
+ this._log(logObj);
270
+ }
271
+ };
272
+ clearTimeout(this._lastLog.timeout);
273
+ const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
274
+ this._lastLog.time = logObj.date;
275
+ if (diffTime < this.options.throttle) try {
276
+ const serializedLog = JSON.stringify([
277
+ logObj.type,
278
+ logObj.tag,
279
+ logObj.args
280
+ ]);
281
+ const isSameLog = this._lastLog.serialized === serializedLog;
282
+ this._lastLog.serialized = serializedLog;
283
+ if (isSameLog) {
284
+ this._lastLog.count = (this._lastLog.count || 0) + 1;
285
+ if (this._lastLog.count > this.options.throttleMin) {
286
+ this._lastLog.timeout = setTimeout(resolveLog, this.options.throttle);
287
+ return;
288
+ }
289
+ }
290
+ } catch {}
291
+ resolveLog(true);
292
+ }
293
+ _log(logObj) {
294
+ for (const reporter of this.options.reporters) reporter.log(logObj, { options: this.options });
295
+ }
408
296
  };
409
297
  function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
410
- if (input === void 0) {
411
- return defaultLevel;
412
- }
413
- if (typeof input === "number") {
414
- return input;
415
- }
416
- if (types[input] && types[input].level !== void 0) {
417
- return types[input].level;
418
- }
419
- return defaultLevel;
298
+ if (input === void 0) return defaultLevel;
299
+ if (typeof input === "number") return input;
300
+ if (types[input] && types[input].level !== void 0) return types[input].level;
301
+ return defaultLevel;
420
302
  }
421
303
  Consola.prototype.add = Consola.prototype.addReporter;
422
304
  Consola.prototype.remove = Consola.prototype.removeReporter;
@@ -425,681 +307,626 @@ Consola.prototype.withScope = Consola.prototype.withTag;
425
307
  Consola.prototype.mock = Consola.prototype.mockTypes;
426
308
  Consola.prototype.pause = Consola.prototype.pauseLogs;
427
309
  Consola.prototype.resume = Consola.prototype.resumeLogs;
428
- function createConsola(options = {}) {
429
- return new Consola(options);
310
+ function createConsola$1(options = {}) {
311
+ return new Consola(options);
430
312
  }
431
313
 
432
- // consola/reporters/basic.ts
433
- var import_node_util = require("util");
434
-
435
- // consola/utils/error.ts
436
- var import_node_path = require("path");
314
+ //#endregion
315
+ //#region consola/utils/error.ts
437
316
  function parseStack(stack) {
438
- const cwd = process.cwd() + import_node_path.sep;
439
- const lines = stack.split("\n").splice(1).map((l) => l.trim().replace("file://", "").replace(cwd, ""));
440
- return lines;
317
+ const cwd = process.cwd() + node_path.sep;
318
+ const lines = stack.split("\n").splice(1).map((l) => l.trim().replace("file://", "").replace(cwd, ""));
319
+ return lines;
441
320
  }
442
321
 
443
- // consola/utils/stream.ts
322
+ //#endregion
323
+ //#region consola/utils/stream.ts
444
324
  function writeStream(data, stream) {
445
- const write = stream.__write || stream.write;
446
- return write.call(stream, data);
325
+ const write = stream.__write || stream.write;
326
+ return write.call(stream, data);
447
327
  }
448
328
 
449
- // consola/reporters/basic.ts
450
- var bracket = (x) => x ? `[${x}]` : "";
329
+ //#endregion
330
+ //#region consola/reporters/basic.ts
331
+ const bracket = (x) => x ? `[${x}]` : "";
451
332
  var BasicReporter = class {
452
- formatStack(stack, opts) {
453
- return ` ${parseStack(stack).join("\n ")}`;
454
- }
455
- formatArgs(args, opts) {
456
- const _args = args.map((arg) => {
457
- if (arg && typeof arg.stack === "string") {
458
- return `${arg.message}
459
- ${this.formatStack(arg.stack, opts)}`;
460
- }
461
- return arg;
462
- });
463
- return (0, import_node_util.formatWithOptions)(opts, ..._args);
464
- }
465
- formatDate(date, opts) {
466
- return opts.date ? date.toLocaleTimeString() : "";
467
- }
468
- filterAndJoin(arr) {
469
- return arr.filter(Boolean).join(" ");
470
- }
471
- formatLogObj(logObj, opts) {
472
- const message = this.formatArgs(logObj.args, opts);
473
- if (logObj.type === "box") {
474
- return `
475
- ${[
476
- bracket(logObj.tag),
477
- logObj.title && logObj.title,
478
- ...message.split("\n")
479
- ].filter(Boolean).map((l) => ` > ${l}`).join("\n")}
480
- `;
481
- }
482
- return this.filterAndJoin([
483
- bracket(logObj.type),
484
- bracket(logObj.tag),
485
- message
486
- ]);
487
- }
488
- log(logObj, ctx) {
489
- const line = this.formatLogObj(logObj, {
490
- columns: ctx.options.stdout.columns || 0,
491
- ...ctx.options.formatOptions
492
- });
493
- return writeStream(
494
- `${line}
495
- `,
496
- logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout
497
- );
498
- }
333
+ formatStack(stack, _opts) {
334
+ return ` ${parseStack(stack).join("\n ")}`;
335
+ }
336
+ formatArgs(args, opts) {
337
+ const _args = args.map((arg) => {
338
+ if (arg && typeof arg.stack === "string") return `${arg.message}\n${this.formatStack(arg.stack, opts)}`;
339
+ return arg;
340
+ });
341
+ return (0, node_util.formatWithOptions)(opts, ..._args);
342
+ }
343
+ formatDate(date, opts) {
344
+ return opts.date ? date.toLocaleTimeString() : "";
345
+ }
346
+ filterAndJoin(arr) {
347
+ return arr.filter(Boolean).join(" ");
348
+ }
349
+ formatLogObj(logObj, opts) {
350
+ const message = this.formatArgs(logObj.args, opts);
351
+ if (logObj.type === "box") return `\n${[
352
+ bracket(logObj.tag),
353
+ logObj.title && logObj.title,
354
+ ...message.split("\n")
355
+ ].filter(Boolean).map((l) => ` > ${l}`).join("\n")}\n`;
356
+ return this.filterAndJoin([
357
+ bracket(logObj.type),
358
+ bracket(logObj.tag),
359
+ message
360
+ ]);
361
+ }
362
+ log(logObj, ctx) {
363
+ const line = this.formatLogObj(logObj, {
364
+ columns: ctx.options.stdout.columns || 0,
365
+ ...ctx.options.formatOptions
366
+ });
367
+ return writeStream(`${line}\n`, logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
368
+ }
499
369
  };
500
370
 
501
- // consola/reporters/fancy.ts
502
- var import_string_width = __toESM(require("string-width"));
371
+ //#endregion
372
+ //#region ../../node_modules/.pnpm/ansi-regex@6.1.0/node_modules/ansi-regex/index.js
373
+ function ansiRegex$1({ onlyFirst = false } = {}) {
374
+ const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
375
+ const pattern = [`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`, "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
376
+ return new RegExp(pattern, onlyFirst ? void 0 : "g");
377
+ }
378
+
379
+ //#endregion
380
+ //#region ../../node_modules/.pnpm/strip-ansi@7.1.0/node_modules/strip-ansi/index.js
381
+ const regex = ansiRegex$1();
382
+ function stripAnsi$1(string) {
383
+ if (typeof string !== "string") throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
384
+ return string.replace(regex, "");
385
+ }
386
+
387
+ //#endregion
388
+ //#region ../../node_modules/.pnpm/get-east-asian-width@1.3.0/node_modules/get-east-asian-width/lookup.js
389
+ function isAmbiguous(x) {
390
+ 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;
391
+ }
392
+ function isFullWidth(x) {
393
+ return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
394
+ }
395
+ function isWide(x) {
396
+ 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;
397
+ }
398
+
399
+ //#endregion
400
+ //#region ../../node_modules/.pnpm/get-east-asian-width@1.3.0/node_modules/get-east-asian-width/index.js
401
+ function validate(codePoint) {
402
+ if (!Number.isSafeInteger(codePoint)) throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
403
+ }
404
+ function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
405
+ validate(codePoint);
406
+ if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) return 2;
407
+ return 1;
408
+ }
409
+
410
+ //#endregion
411
+ //#region ../../node_modules/.pnpm/emoji-regex@10.4.0/node_modules/emoji-regex/index.js
412
+ var require_emoji_regex = __commonJS({ "../../node_modules/.pnpm/emoji-regex@10.4.0/node_modules/emoji-regex/index.js"(exports, module) {
413
+ module.exports = () => {
414
+ 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;
415
+ };
416
+ } });
503
417
 
504
- // consola/utils/color.ts
505
- var tty = __toESM(require("tty"));
506
- var {
507
- env = {},
508
- argv = [],
509
- platform = ""
510
- } = typeof process === "undefined" ? {} : process;
511
- var isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
512
- var isForced = "FORCE_COLOR" in env || argv.includes("--color");
513
- var isWindows = platform === "win32";
514
- var isDumbTerminal = env.TERM === "dumb";
515
- var isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
516
- var isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
517
- var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
418
+ //#endregion
419
+ //#region ../../node_modules/.pnpm/string-width@7.2.0/node_modules/string-width/index.js
420
+ var import_emoji_regex = __toESM(require_emoji_regex(), 1);
421
+ const segmenter = new Intl.Segmenter();
422
+ const defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
423
+ function stringWidth$1(string, options = {}) {
424
+ if (typeof string !== "string" || string.length === 0) return 0;
425
+ const { ambiguousIsNarrow = true, countAnsiEscapeCodes = false } = options;
426
+ if (!countAnsiEscapeCodes) string = stripAnsi$1(string);
427
+ if (string.length === 0) return 0;
428
+ let width = 0;
429
+ const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
430
+ for (const { segment: character } of segmenter.segment(string)) {
431
+ const codePoint = character.codePointAt(0);
432
+ if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) continue;
433
+ if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) continue;
434
+ if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) continue;
435
+ if (codePoint >= 55296 && codePoint <= 57343) continue;
436
+ if (codePoint >= 65024 && codePoint <= 65039) continue;
437
+ if (defaultIgnorableCodePointRegex.test(character)) continue;
438
+ if ((0, import_emoji_regex.default)().test(character)) {
439
+ width += 2;
440
+ continue;
441
+ }
442
+ width += eastAsianWidth(codePoint, eastAsianWidthOptions);
443
+ }
444
+ return width;
445
+ }
446
+
447
+ //#endregion
448
+ //#region consola/utils/color.ts
449
+ const { env = {}, argv = [], platform = "" } = typeof process === "undefined" ? {} : process;
450
+ const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
451
+ const isForced = "FORCE_COLOR" in env || argv.includes("--color");
452
+ const isWindows = platform === "win32";
453
+ const isDumbTerminal = env.TERM === "dumb";
454
+ const isCompatibleTerminal = node_tty && node_tty.isatty && node_tty.isatty(1) && env.TERM && !isDumbTerminal;
455
+ const isCI$1 = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
456
+ const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI$1);
518
457
  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)) {
519
- return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
458
+ return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
520
459
  }
521
460
  function clearBleed(index, string, open, close, replace) {
522
- return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
461
+ return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
523
462
  }
524
463
  function filterEmpty(open, close, replace = open, at = open.length + 1) {
525
- return (string) => string || !(string === "" || string === void 0) ? clearBleed(`${string}`.indexOf(close, at), string, open, close, replace) : "";
464
+ return (string) => string || !(string === "" || string === void 0) ? clearBleed(`${string}`.indexOf(close, at), string, open, close, replace) : "";
526
465
  }
527
466
  function init(open, close, replace) {
528
- return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
467
+ return filterEmpty(`\u001B[${open}m`, `\u001B[${close}m`, replace);
529
468
  }
530
- var colorDefs = {
531
- reset: init(0, 0),
532
- bold: init(1, 22, "\x1B[22m\x1B[1m"),
533
- dim: init(2, 22, "\x1B[22m\x1B[2m"),
534
- italic: init(3, 23),
535
- underline: init(4, 24),
536
- inverse: init(7, 27),
537
- hidden: init(8, 28),
538
- strikethrough: init(9, 29),
539
- black: init(30, 39),
540
- red: init(31, 39),
541
- green: init(32, 39),
542
- yellow: init(33, 39),
543
- blue: init(34, 39),
544
- magenta: init(35, 39),
545
- cyan: init(36, 39),
546
- white: init(37, 39),
547
- gray: init(90, 39),
548
- bgBlack: init(40, 49),
549
- bgRed: init(41, 49),
550
- bgGreen: init(42, 49),
551
- bgYellow: init(43, 49),
552
- bgBlue: init(44, 49),
553
- bgMagenta: init(45, 49),
554
- bgCyan: init(46, 49),
555
- bgWhite: init(47, 49),
556
- blackBright: init(90, 39),
557
- redBright: init(91, 39),
558
- greenBright: init(92, 39),
559
- yellowBright: init(93, 39),
560
- blueBright: init(94, 39),
561
- magentaBright: init(95, 39),
562
- cyanBright: init(96, 39),
563
- whiteBright: init(97, 39),
564
- bgBlackBright: init(100, 49),
565
- bgRedBright: init(101, 49),
566
- bgGreenBright: init(102, 49),
567
- bgYellowBright: init(103, 49),
568
- bgBlueBright: init(104, 49),
569
- bgMagentaBright: init(105, 49),
570
- bgCyanBright: init(106, 49),
571
- bgWhiteBright: init(107, 49)
469
+ const colorDefs = {
470
+ reset: init(0, 0),
471
+ bold: init(1, 22, "\x1B[22m\x1B[1m"),
472
+ dim: init(2, 22, "\x1B[22m\x1B[2m"),
473
+ italic: init(3, 23),
474
+ underline: init(4, 24),
475
+ inverse: init(7, 27),
476
+ hidden: init(8, 28),
477
+ strikethrough: init(9, 29),
478
+ black: init(30, 39),
479
+ red: init(31, 39),
480
+ green: init(32, 39),
481
+ yellow: init(33, 39),
482
+ blue: init(34, 39),
483
+ magenta: init(35, 39),
484
+ cyan: init(36, 39),
485
+ white: init(37, 39),
486
+ gray: init(90, 39),
487
+ bgBlack: init(40, 49),
488
+ bgRed: init(41, 49),
489
+ bgGreen: init(42, 49),
490
+ bgYellow: init(43, 49),
491
+ bgBlue: init(44, 49),
492
+ bgMagenta: init(45, 49),
493
+ bgCyan: init(46, 49),
494
+ bgWhite: init(47, 49),
495
+ blackBright: init(90, 39),
496
+ redBright: init(91, 39),
497
+ greenBright: init(92, 39),
498
+ yellowBright: init(93, 39),
499
+ blueBright: init(94, 39),
500
+ magentaBright: init(95, 39),
501
+ cyanBright: init(96, 39),
502
+ whiteBright: init(97, 39),
503
+ bgBlackBright: init(100, 49),
504
+ bgRedBright: init(101, 49),
505
+ bgGreenBright: init(102, 49),
506
+ bgYellowBright: init(103, 49),
507
+ bgBlueBright: init(104, 49),
508
+ bgMagentaBright: init(105, 49),
509
+ bgCyanBright: init(106, 49),
510
+ bgWhiteBright: init(107, 49)
572
511
  };
573
512
  function createColors(useColor = isColorSupported) {
574
- return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
513
+ return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
575
514
  }
576
- var colors = createColors();
577
- function getColor(color, fallback = "reset") {
578
- return colors[color] || colors[fallback];
515
+ const colors = createColors();
516
+ function getColor$1(color, fallback = "reset") {
517
+ return colors[color] || colors[fallback];
579
518
  }
580
519
 
581
- // consola/utils/string.ts
582
- var ansiRegex = [
583
- "[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
584
- "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
585
- ].join("|");
520
+ //#endregion
521
+ //#region consola/utils/string.ts
522
+ const ansiRegex = ["[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)", "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
586
523
  function stripAnsi(text) {
587
- return text.replace(new RegExp(ansiRegex, "g"), "");
524
+ return text.replaceAll(new RegExp(ansiRegex, "g"), "");
588
525
  }
589
526
 
590
- // consola/utils/box.ts
591
- var boxStylePresets = {
592
- solid: {
593
- tl: "\u250C",
594
- tr: "\u2510",
595
- bl: "\u2514",
596
- br: "\u2518",
597
- h: "\u2500",
598
- v: "\u2502"
599
- },
600
- double: {
601
- tl: "\u2554",
602
- tr: "\u2557",
603
- bl: "\u255A",
604
- br: "\u255D",
605
- h: "\u2550",
606
- v: "\u2551"
607
- },
608
- doubleSingle: {
609
- tl: "\u2553",
610
- tr: "\u2556",
611
- bl: "\u2559",
612
- br: "\u255C",
613
- h: "\u2500",
614
- v: "\u2551"
615
- },
616
- doubleSingleRounded: {
617
- tl: "\u256D",
618
- tr: "\u256E",
619
- bl: "\u2570",
620
- br: "\u256F",
621
- h: "\u2500",
622
- v: "\u2551"
623
- },
624
- singleThick: {
625
- tl: "\u250F",
626
- tr: "\u2513",
627
- bl: "\u2517",
628
- br: "\u251B",
629
- h: "\u2501",
630
- v: "\u2503"
631
- },
632
- singleDouble: {
633
- tl: "\u2552",
634
- tr: "\u2555",
635
- bl: "\u2558",
636
- br: "\u255B",
637
- h: "\u2550",
638
- v: "\u2502"
639
- },
640
- singleDoubleRounded: {
641
- tl: "\u256D",
642
- tr: "\u256E",
643
- bl: "\u2570",
644
- br: "\u256F",
645
- h: "\u2550",
646
- v: "\u2502"
647
- },
648
- rounded: {
649
- tl: "\u256D",
650
- tr: "\u256E",
651
- bl: "\u2570",
652
- br: "\u256F",
653
- h: "\u2500",
654
- v: "\u2502"
655
- }
527
+ //#endregion
528
+ //#region consola/utils/box.ts
529
+ const boxStylePresets = {
530
+ solid: {
531
+ tl: "",
532
+ tr: "",
533
+ bl: "",
534
+ br: "",
535
+ h: "",
536
+ v: "│"
537
+ },
538
+ double: {
539
+ tl: "",
540
+ tr: "",
541
+ bl: "",
542
+ br: "",
543
+ h: "",
544
+ v: "║"
545
+ },
546
+ doubleSingle: {
547
+ tl: "",
548
+ tr: "",
549
+ bl: "",
550
+ br: "",
551
+ h: "",
552
+ v: "║"
553
+ },
554
+ doubleSingleRounded: {
555
+ tl: "",
556
+ tr: "",
557
+ bl: "",
558
+ br: "",
559
+ h: "",
560
+ v: "║"
561
+ },
562
+ singleThick: {
563
+ tl: "",
564
+ tr: "",
565
+ bl: "",
566
+ br: "",
567
+ h: "",
568
+ v: "┃"
569
+ },
570
+ singleDouble: {
571
+ tl: "",
572
+ tr: "",
573
+ bl: "",
574
+ br: "",
575
+ h: "",
576
+ v: "│"
577
+ },
578
+ singleDoubleRounded: {
579
+ tl: "",
580
+ tr: "",
581
+ bl: "",
582
+ br: "",
583
+ h: "",
584
+ v: "│"
585
+ },
586
+ rounded: {
587
+ tl: "",
588
+ tr: "",
589
+ bl: "",
590
+ br: "",
591
+ h: "",
592
+ v: "│"
593
+ }
656
594
  };
657
- var defaultStyle = {
658
- borderColor: "white",
659
- borderStyle: "rounded",
660
- valign: "center",
661
- padding: 2,
662
- marginLeft: 1,
663
- marginTop: 1,
664
- marginBottom: 1
595
+ const defaultStyle = {
596
+ borderColor: "white",
597
+ borderStyle: "rounded",
598
+ valign: "center",
599
+ padding: 2,
600
+ marginLeft: 1,
601
+ marginTop: 1,
602
+ marginBottom: 1
665
603
  };
666
604
  function box(text, _opts = {}) {
667
- const opts = {
668
- ..._opts,
669
- style: {
670
- ...defaultStyle,
671
- ..._opts.style
672
- }
673
- };
674
- const textLines = text.split("\n");
675
- const boxLines = [];
676
- const _color = getColor(opts.style.borderColor);
677
- const borderStyle = {
678
- ...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
679
- };
680
- if (_color) {
681
- for (const key in borderStyle) {
682
- borderStyle[key] = _color(
683
- borderStyle[key]
684
- );
685
- }
686
- }
687
- const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
688
- const height = textLines.length + paddingOffset;
689
- const width = Math.max(...textLines.map((line) => line.length)) + paddingOffset;
690
- const widthOffset = width + paddingOffset;
691
- const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
692
- if (opts.style.marginTop > 0) {
693
- boxLines.push("".repeat(opts.style.marginTop));
694
- }
695
- if (opts.title) {
696
- const left = borderStyle.h.repeat(
697
- Math.floor((width - stripAnsi(opts.title).length) / 2)
698
- );
699
- const right = borderStyle.h.repeat(
700
- width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset
701
- );
702
- boxLines.push(
703
- `${leftSpace}${borderStyle.tl}${left}${opts.title}${right}${borderStyle.tr}`
704
- );
705
- } else {
706
- boxLines.push(
707
- `${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`
708
- );
709
- }
710
- const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
711
- for (let i = 0; i < height; i++) {
712
- if (i < valignOffset || i >= valignOffset + textLines.length) {
713
- boxLines.push(
714
- `${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`
715
- );
716
- } else {
717
- const line = textLines[i - valignOffset];
718
- const left = " ".repeat(paddingOffset);
719
- const right = " ".repeat(width - stripAnsi(line).length);
720
- boxLines.push(
721
- `${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`
722
- );
723
- }
724
- }
725
- boxLines.push(
726
- `${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`
727
- );
728
- if (opts.style.marginBottom > 0) {
729
- boxLines.push("".repeat(opts.style.marginBottom));
730
- }
731
- return boxLines.join("\n");
605
+ const opts = {
606
+ ..._opts,
607
+ style: {
608
+ ...defaultStyle,
609
+ ..._opts.style
610
+ }
611
+ };
612
+ const textLines = text.split("\n");
613
+ const boxLines = [];
614
+ const _color = getColor$1(opts.style.borderColor);
615
+ const borderStyle = { ...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle };
616
+ if (_color) for (const key in borderStyle) borderStyle[key] = _color(borderStyle[key]);
617
+ const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
618
+ const height = textLines.length + paddingOffset;
619
+ const width = Math.max(...textLines.map((line) => line.length)) + paddingOffset;
620
+ const widthOffset = width + paddingOffset;
621
+ const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
622
+ if (opts.style.marginTop > 0) boxLines.push("".repeat(opts.style.marginTop));
623
+ if (opts.title) {
624
+ const left = borderStyle.h.repeat(Math.floor((width - stripAnsi(opts.title).length) / 2));
625
+ const right = borderStyle.h.repeat(width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset);
626
+ boxLines.push(`${leftSpace}${borderStyle.tl}${left}${opts.title}${right}${borderStyle.tr}`);
627
+ } else boxLines.push(`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`);
628
+ const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
629
+ for (let i = 0; i < height; i++) if (i < valignOffset || i >= valignOffset + textLines.length) boxLines.push(`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`);
630
+ else {
631
+ const line = textLines[i - valignOffset];
632
+ const left = " ".repeat(paddingOffset);
633
+ const right = " ".repeat(width - stripAnsi(line).length);
634
+ boxLines.push(`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`);
635
+ }
636
+ boxLines.push(`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`);
637
+ if (opts.style.marginBottom > 0) boxLines.push("".repeat(opts.style.marginBottom));
638
+ return boxLines.join("\n");
732
639
  }
733
640
 
734
- // consola/utils/tester.ts
641
+ //#endregion
642
+ //#region consola/utils/tester.ts
735
643
  function isUnicodeSupported() {
736
- if (process.platform !== "win32") {
737
- return process.env.TERM !== "linux";
738
- }
739
- return Boolean(process.env.WT_SESSION) || // Windows Terminal
740
- Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
741
- process.env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
742
- process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
644
+ if (process.platform !== "win32") return process.env.TERM !== "linux";
645
+ return Boolean(process.env.WT_SESSION) || Boolean(process.env.TERMINUS_SUBLIME) || process.env.ConEmuTask === "{cmd::Cmder}" || process.env.TERM_PROGRAM === "Terminus-Sublime" || process.env.TERM_PROGRAM === "vscode" || process.env.TERM === "xterm-256color" || process.env.TERM === "alacritty" || process.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
743
646
  }
744
647
 
745
- // consola/reporters/fancy.ts
746
- var TYPE_COLOR_MAP = {
747
- info: "cyan",
748
- fail: "red",
749
- success: "green",
750
- ready: "green",
751
- start: "magenta"
648
+ //#endregion
649
+ //#region consola/reporters/fancy.ts
650
+ const TYPE_COLOR_MAP = {
651
+ info: "cyan",
652
+ fail: "red",
653
+ success: "green",
654
+ ready: "green",
655
+ start: "magenta"
752
656
  };
753
- var LEVEL_COLOR_MAP = {
754
- 0: "red",
755
- 1: "yellow"
657
+ const LEVEL_COLOR_MAP = {
658
+ 0: "red",
659
+ 1: "yellow"
756
660
  };
757
- var unicode = isUnicodeSupported();
758
- var s = (c, fallback) => unicode ? c : fallback;
759
- var TYPE_ICONS = {
760
- error: s("\u2716", "\xD7"),
761
- fatal: s("\u2716", "\xD7"),
762
- ready: s("\u2714", "\u221A"),
763
- warn: s("\u26A0", "\u203C"),
764
- info: s("\u2139", "i"),
765
- success: s("\u2714", "\u221A"),
766
- debug: s("\u2699", "D"),
767
- trace: s("\u2192", "\u2192"),
768
- fail: s("\u2716", "\xD7"),
769
- start: s("\u25D0", "o"),
770
- log: ""
661
+ const unicode = isUnicodeSupported();
662
+ const s = (c, fallback) => unicode ? c : fallback;
663
+ const TYPE_ICONS = {
664
+ error: s("", "×"),
665
+ fatal: s("", "×"),
666
+ ready: s("", ""),
667
+ warn: s("", ""),
668
+ info: s("", "i"),
669
+ success: s("", ""),
670
+ debug: s("", "D"),
671
+ trace: s("", ""),
672
+ fail: s("", "×"),
673
+ start: s("", "o"),
674
+ log: ""
771
675
  };
772
676
  function stringWidth(str) {
773
- if (!Intl.Segmenter) {
774
- return stripAnsi(str).length;
775
- }
776
- return (0, import_string_width.default)(str);
677
+ if (!Intl.Segmenter) return stripAnsi(str).length;
678
+ return stringWidth$1(str);
777
679
  }
778
680
  var FancyReporter = class extends BasicReporter {
779
- formatStack(stack) {
780
- return `
781
- ${parseStack(stack).map(
782
- (line) => ` ${line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_, m) => `(${colors.cyan(m)})`)}`
783
- ).join("\n")}`;
784
- }
785
- formatType(logObj, isBadge, opts) {
786
- const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
787
- if (isBadge) {
788
- return getBgColor(typeColor)(
789
- colors.black(` ${logObj.type.toUpperCase()} `)
790
- );
791
- }
792
- const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
793
- return _type ? getColor2(typeColor)(_type) : "";
794
- }
795
- formatLogObj(logObj, opts) {
796
- const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
797
- "\n"
798
- );
799
- if (logObj.type === "box") {
800
- return box(
801
- characterFormat(
802
- message + (additional.length > 0 ? `
803
- ${additional.join("\n")}` : "")
804
- ),
805
- {
806
- title: logObj.title ? characterFormat(logObj.title) : void 0,
807
- style: logObj.style
808
- }
809
- );
810
- }
811
- const date = this.formatDate(logObj.date, opts);
812
- const coloredDate = date && colors.gray(date);
813
- const isBadge = logObj.badge ?? logObj.level < 2;
814
- const type = this.formatType(logObj, isBadge, opts);
815
- const tag = logObj.tag ? colors.gray(logObj.tag) : "";
816
- let line;
817
- const left = this.filterAndJoin([type, characterFormat(message)]);
818
- const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
819
- const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
820
- line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
821
- line += characterFormat(
822
- additional.length > 0 ? `
823
- ${additional.join("\n")}` : ""
824
- );
825
- if (logObj.type === "trace") {
826
- const _err = new Error(`Trace: ${logObj.message}`);
827
- line += this.formatStack(_err.stack || "");
828
- }
829
- return isBadge ? `
830
- ${line}
831
- ` : line;
832
- }
681
+ formatStack(stack) {
682
+ return `\n${parseStack(stack).map((line) => ` ${line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_, m) => `(${colors.cyan(m)})`)}`).join("\n")}`;
683
+ }
684
+ formatType(logObj, isBadge, _opts) {
685
+ const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
686
+ if (isBadge) return getBgColor(typeColor)(colors.black(` ${logObj.type.toUpperCase()} `));
687
+ const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
688
+ return _type ? getColor(typeColor)(_type) : "";
689
+ }
690
+ formatLogObj(logObj, opts) {
691
+ const [message, ...additional] = this.formatArgs(logObj.args, opts).split("\n");
692
+ if (logObj.type === "box") return box(characterFormat(message + (additional.length > 0 ? `\n${additional.join("\n")}` : "")), {
693
+ title: logObj.title ? characterFormat(logObj.title) : void 0,
694
+ style: logObj.style
695
+ });
696
+ const date = this.formatDate(logObj.date, opts);
697
+ const coloredDate = date && colors.gray(date);
698
+ const isBadge = logObj.badge ?? logObj.level < 2;
699
+ const type = this.formatType(logObj, isBadge, opts);
700
+ const tag = logObj.tag ? colors.gray(logObj.tag) : "";
701
+ let line;
702
+ const left = this.filterAndJoin([type, characterFormat(message)]);
703
+ const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
704
+ const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
705
+ line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
706
+ line += characterFormat(additional.length > 0 ? `\n${additional.join("\n")}` : "");
707
+ if (logObj.type === "trace") {
708
+ const _err = new Error(`Trace: ${logObj.message}`);
709
+ line += this.formatStack(_err.stack || "");
710
+ }
711
+ return isBadge ? `\n${line}\n` : line;
712
+ }
833
713
  };
834
714
  function characterFormat(str) {
835
- return str.replace(/`([^`]+)`/gm, (_, m) => colors.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_, m) => ` ${colors.underline(m)} `);
715
+ return str.replaceAll(/`([^`]+)`/g, (_, m) => colors.cyan(m)).replaceAll(/\s+_([^_]+)_\s+/g, (_, m) => ` ${colors.underline(m)} `);
836
716
  }
837
- function getColor2(color = "white") {
838
- return colors[color] || colors.white;
717
+ function getColor(color = "white") {
718
+ return colors[color] || colors.white;
839
719
  }
840
720
  function getBgColor(color = "bgWhite") {
841
- return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
721
+ return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
842
722
  }
843
723
 
844
- // consola/index.ts
845
- function createConsola2(options = {}) {
846
- let level = _getDefaultLogLevel();
847
- if (process.env.CONSOLA_LEVEL) {
848
- level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
849
- }
850
- const consola2 = createConsola({
851
- level,
852
- defaults: { level },
853
- stdout: process.stdout,
854
- stderr: process.stderr,
855
- reporters: options.reporters || [
856
- options.fancy ?? !(import_std_env.isCI || import_std_env.isTest) ? new FancyReporter() : new BasicReporter()
857
- ],
858
- ...options
859
- });
860
- return consola2;
724
+ //#endregion
725
+ //#region consola/index.ts
726
+ function createConsola(options = {}) {
727
+ let level = _getDefaultLogLevel();
728
+ if (process.env.CONSOLA_LEVEL) level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
729
+ const consola$1 = createConsola$1({
730
+ level,
731
+ defaults: { level },
732
+ stdout: process.stdout,
733
+ stderr: process.stderr,
734
+ reporters: options.reporters || [options.fancy ?? !(std_env.isCI || std_env.isTest) ? new FancyReporter() : new BasicReporter()],
735
+ ...options
736
+ });
737
+ return consola$1;
861
738
  }
862
739
  function _getDefaultLogLevel() {
863
- if (import_std_env.isDebug) {
864
- return LogLevels.debug;
865
- }
866
- if (import_std_env.isTest) {
867
- return LogLevels.warn;
868
- }
869
- return LogLevels.info;
740
+ if (std_env.isDebug) return LogLevels.debug;
741
+ if (std_env.isTest) return LogLevels.warn;
742
+ return LogLevels.info;
870
743
  }
871
- var consola = createConsola2();
872
-
873
- // consola/reporters/file.ts
874
- var import_fs = require("fs");
875
- var fs = __toESM(require("fs"));
876
- var import_path2 = require("path");
877
- var import_cron = require("cron");
744
+ const consola = createConsola();
878
745
 
879
- // tool.util.ts
880
- var import_path = __toESM(require("path"));
881
- var getShortTime = (date) => {
882
- return Intl.DateTimeFormat("en-US", {
883
- timeStyle: "medium",
884
- hour12: false
885
- }).format(date);
886
- };
887
- var getShortDate = (date) => {
888
- return Intl.DateTimeFormat("en-US", {
889
- dateStyle: "short"
890
- }).format(date).replace(/\//g, "-");
891
- };
892
- var getLogFilePath = (logDir, formatString) => import_path.default.resolve(logDir, formatString.replace(/%d/g, getShortDate(/* @__PURE__ */ new Date())));
746
+ //#endregion
747
+ //#region tool.util.ts
748
+ function getShortTime(date) {
749
+ return Intl.DateTimeFormat("en-US", {
750
+ timeStyle: "medium",
751
+ hour12: false
752
+ }).format(date);
753
+ }
754
+ function getShortDate(date) {
755
+ return Intl.DateTimeFormat("en-US", { dateStyle: "short" }).format(date).replaceAll("/", "-");
756
+ }
757
+ function getLogFilePath(logDir, formatString) {
758
+ return node_path.default.resolve(logDir, formatString.replaceAll("%d", getShortDate(new Date())));
759
+ }
893
760
 
894
- // consola/reporters/logger.ts
895
- var import_picocolors = __toESM(require("picocolors"));
896
- var import_std_env2 = require("std-env");
761
+ //#endregion
762
+ //#region consola/reporters/logger.ts
897
763
  var LoggerReporter = class extends FancyReporter {
898
- constructor() {
899
- super(...arguments);
900
- this.latestLogTime = Date.now();
901
- }
902
- formatDate(date, opts) {
903
- const isInVirtualTerminal = typeof opts.columns === "undefined";
904
- if (import_std_env2.isDevelopment) {
905
- const now = Date.now();
906
- const delta = now - this.latestLogTime;
907
- this.latestLogTime = now;
908
- return `+${delta | 0}ms ${super.formatDate(date, opts)}`;
909
- }
910
- return isInVirtualTerminal ? "" : super.formatDate(date, opts);
911
- }
912
- formatLogObj(logObj, opts) {
913
- const isInVirtualTerminal = typeof opts.columns === "undefined";
914
- return isInVirtualTerminal ? `${import_picocolors.default.gray(getShortTime(/* @__PURE__ */ new Date()))} ${super.formatLogObj(logObj, opts).replace(/^\n/, "")}`.trimEnd() : super.formatLogObj(logObj, opts);
915
- }
764
+ constructor(..._args) {
765
+ super(..._args);
766
+ this.latestLogTime = Date.now();
767
+ }
768
+ formatDate(date, opts) {
769
+ const isInVirtualTerminal = opts.columns === void 0;
770
+ if (std_env.isDevelopment) {
771
+ const now = Date.now();
772
+ const delta = now - this.latestLogTime;
773
+ this.latestLogTime = now;
774
+ return `+${delta | 0}ms ${super.formatDate(date, opts)}`;
775
+ }
776
+ return isInVirtualTerminal ? "" : super.formatDate(date, opts);
777
+ }
778
+ formatLogObj(logObj, opts) {
779
+ const isInVirtualTerminal = opts.columns === void 0;
780
+ return isInVirtualTerminal ? `${picocolors.default.gray(getShortTime(new Date()))} ${super.formatLogObj(logObj, opts).replace(/^\n/, "")}`.trimEnd() : super.formatLogObj(logObj, opts);
781
+ }
916
782
  };
917
783
 
918
- // consola/reporters/file.ts
784
+ //#endregion
785
+ //#region consola/reporters/file.ts
919
786
  var FileReporter = class extends LoggerReporter {
920
- constructor(configs) {
921
- super();
922
- this.configs = configs;
923
- this.refreshWriteStream();
924
- this.scheduleRefreshWriteStream();
925
- }
926
- scheduleRefreshWriteStream() {
927
- const { cron = "0 0 * * *" } = this.configs;
928
- const job = new import_cron.CronJob(cron, this.refreshWriteStream.bind(this));
929
- job.start();
930
- this.__job = job;
931
- }
932
- teardown() {
933
- this.__job?.stop();
934
- this.stdoutStream?.end();
935
- this.stderrStream?.end();
936
- }
937
- refreshWriteStream() {
938
- const {
939
- loggerDir,
940
- stderrFileFormat = "error.log",
941
- stdoutFileFormat = "stdout_%d.log"
942
- } = this.configs;
943
- const stdoutPath = getLogFilePath(loggerDir, stdoutFileFormat);
944
- const stderrPath = getLogFilePath(loggerDir, stderrFileFormat);
945
- createLoggerFileIfNotExist(stdoutPath);
946
- createLoggerFileIfNotExist(stderrPath);
947
- const options = {
948
- encoding: "utf-8",
949
- flags: "a+"
950
- };
951
- [this.stderrStream, this.stdoutStream].forEach((stream) => {
952
- stream?.end();
953
- });
954
- this.stdoutStream = (0, import_fs.createWriteStream)(stdoutPath, options);
955
- this.stderrStream = (0, import_fs.createWriteStream)(stderrPath, options);
956
- [this.stderrStream, this.stdoutStream].forEach((stream) => {
957
- writeStream(
958
- "\n========================================================\n",
959
- stream
960
- );
961
- });
962
- }
963
- log(logObj, ctx) {
964
- if (!this.stdoutStream || !this.stderrStream) {
965
- return;
966
- }
967
- const finalStdout = this.stdoutStream;
968
- const finalStderr = this.stderrStream || this.stdoutStream;
969
- const line = super.formatLogObj(logObj, {
970
- ...ctx.options.formatOptions,
971
- columns: void 0
972
- });
973
- if (this.configs.errWriteToStdout && logObj.level < 2) {
974
- writeStream(`${line}
975
- `, finalStdout);
976
- }
977
- return writeStream(
978
- `${line}
979
- `,
980
- logObj.level < 2 ? finalStderr : finalStdout
981
- );
982
- }
983
- };
984
- var createLoggerFileIfNotExist = (path2) => {
985
- const dirPath = (0, import_path2.dirname)(path2);
986
- if (!fs.existsSync(dirPath)) {
987
- fs.mkdirSync(dirPath, { recursive: true });
988
- }
989
- if (!fs.existsSync(path2)) {
990
- fs.writeFileSync(path2, "", { flag: "wx" });
991
- }
787
+ constructor(configs) {
788
+ super();
789
+ this.configs = configs;
790
+ this.refreshWriteStream();
791
+ this.scheduleRefreshWriteStream();
792
+ }
793
+ scheduleRefreshWriteStream() {
794
+ const { cron: cron$1 = "0 0 * * *" } = this.configs;
795
+ const job = new cron.CronJob(cron$1, this.refreshWriteStream.bind(this));
796
+ job.start();
797
+ this.__job = job;
798
+ }
799
+ teardown() {
800
+ this.__job?.stop();
801
+ this.stdoutStream?.end();
802
+ this.stderrStream?.end();
803
+ }
804
+ refreshWriteStream() {
805
+ const { loggerDir, stderrFileFormat = "error.log", stdoutFileFormat = "stdout_%d.log" } = this.configs;
806
+ const stdoutPath = getLogFilePath(loggerDir, stdoutFileFormat);
807
+ const stderrPath = getLogFilePath(loggerDir, stderrFileFormat);
808
+ createLoggerFileIfNotExist(stdoutPath);
809
+ createLoggerFileIfNotExist(stderrPath);
810
+ const options = {
811
+ encoding: "utf-8",
812
+ flags: "a+"
813
+ };
814
+ [this.stderrStream, this.stdoutStream].forEach((stream) => {
815
+ stream?.end();
816
+ });
817
+ this.stdoutStream = (0, node_fs.createWriteStream)(stdoutPath, options);
818
+ this.stderrStream = (0, node_fs.createWriteStream)(stderrPath, options);
819
+ [this.stderrStream, this.stdoutStream].forEach((stream) => {
820
+ writeStream("\n========================================================\n", stream);
821
+ });
822
+ }
823
+ log(logObj, ctx) {
824
+ if (!this.stdoutStream || !this.stderrStream) return;
825
+ const finalStdout = this.stdoutStream;
826
+ const finalStderr = this.stderrStream || this.stdoutStream;
827
+ const line = super.formatLogObj(logObj, {
828
+ ...ctx.options.formatOptions,
829
+ columns: void 0
830
+ });
831
+ if (this.configs.errWriteToStdout && logObj.level < 2) writeStream(`${line}\n`, finalStdout);
832
+ return writeStream(`${line}\n`, logObj.level < 2 ? finalStderr : finalStdout);
833
+ }
992
834
  };
835
+ function createLoggerFileIfNotExist(path$1) {
836
+ const dirPath = (0, node_path.dirname)(path$1);
837
+ if (!node_fs.existsSync(dirPath)) node_fs.mkdirSync(dirPath, { recursive: true });
838
+ if (!node_fs.existsSync(path$1)) node_fs.writeFileSync(path$1, "", { flag: "wx" });
839
+ }
993
840
 
994
- // consola/reporters/subscriber.ts
995
- var import_events = __toESM(require("events"));
996
- var wrapperSubscribers = (consola2) => {
997
- Object.assign(consola2, {
998
- onData: (handler) => SubscriberReporter.subscriber.on("log", handler),
999
- onStdOut: (handler) => SubscriberReporter.subscriber.on("stdout", handler),
1000
- onStdErr: (handler) => SubscriberReporter.subscriber.on("stderr", handler)
1001
- });
1002
- return consola2;
1003
- };
1004
- var _SubscriberReporter = class _SubscriberReporter extends LoggerReporter {
1005
- log(logObj, ctx) {
1006
- const line = super.formatLogObj(logObj, ctx);
1007
- const event = logObj.level < 2 ? "stderr" : "stdout";
1008
- _SubscriberReporter.subscriber.emit(event, line);
1009
- _SubscriberReporter.subscriber.emit("log", line);
1010
- }
841
+ //#endregion
842
+ //#region consola/reporters/subscriber.ts
843
+ function wrapperSubscribers(consola$1) {
844
+ Object.assign(consola$1, {
845
+ onData: (handler) => SubscriberReporter.subscriber.on("log", handler),
846
+ onStdOut: (handler) => SubscriberReporter.subscriber.on("stdout", handler),
847
+ onStdErr: (handler) => SubscriberReporter.subscriber.on("stderr", handler)
848
+ });
849
+ return consola$1;
850
+ }
851
+ var SubscriberReporter = class SubscriberReporter extends LoggerReporter {
852
+ log(logObj, ctx) {
853
+ const line = super.formatLogObj(logObj, ctx);
854
+ const event = logObj.level < 2 ? "stderr" : "stdout";
855
+ SubscriberReporter.subscriber.emit(event, line);
856
+ SubscriberReporter.subscriber.emit("log", line);
857
+ }
1011
858
  };
1012
- _SubscriberReporter.subscriber = new import_events.default();
1013
- var SubscriberReporter = _SubscriberReporter;
859
+ SubscriberReporter.subscriber = new node_events.default();
1014
860
 
1015
- // consola.instance.ts
1016
- var createLoggerConsola = (options) => {
1017
- const reporters = [
1018
- new FancyReporter(),
1019
- new SubscriberReporter()
1020
- ];
1021
- if (options?.writeToFile) {
1022
- reporters.push(new FileReporter(options.writeToFile));
1023
- }
1024
- const consola2 = createConsola2({
1025
- formatOptions: {
1026
- date: true
1027
- },
1028
- reporters,
1029
- level: import_std_env3.isDevelopment ? LogLevels.trace : LogLevels.info,
1030
- ...options
1031
- });
1032
- return wrapperSubscribers(consola2);
1033
- };
861
+ //#endregion
862
+ //#region consola.instance.ts
863
+ function createLoggerConsola(options) {
864
+ const reporters = [new FancyReporter(), new SubscriberReporter()];
865
+ if (options?.writeToFile) reporters.push(new FileReporter(options.writeToFile));
866
+ const consola$1 = createConsola({
867
+ formatOptions: { date: true },
868
+ reporters,
869
+ level: std_env.isDevelopment ? LogLevels.trace : LogLevels.info,
870
+ ...options
871
+ });
872
+ return wrapperSubscribers(consola$1);
873
+ }
1034
874
 
1035
- // consola/reporters/browser.ts
875
+ //#endregion
876
+ //#region consola/reporters/browser.ts
1036
877
  var BrowserReporter = class {
1037
- constructor(options) {
1038
- this.options = { ...options };
1039
- this.defaultColor = "#7f8c8d";
1040
- this.levelColorMap = {
1041
- 0: "#c0392b",
1042
- // Red
1043
- 1: "#f39c12",
1044
- // Yellow
1045
- 3: "#00BCD4"
1046
- // Cyan
1047
- };
1048
- this.typeColorMap = {
1049
- success: "#2ecc71"
1050
- // Green
1051
- };
1052
- }
1053
- _getLogFn(level) {
1054
- if (level < 1) {
1055
- return console.__error || console.error;
1056
- }
1057
- if (level === 1) {
1058
- return console.__warn || console.warn;
1059
- }
1060
- return console.__log || console.log;
1061
- }
1062
- log(logObj) {
1063
- const consoleLogFn = this._getLogFn(logObj.level);
1064
- const type = logObj.type === "log" ? "" : logObj.type;
1065
- const tag = logObj.tag || "";
1066
- const color = this.typeColorMap[logObj.type] || this.levelColorMap[logObj.level] || this.defaultColor;
1067
- const style = `
878
+ constructor(options) {
879
+ this.options = { ...options };
880
+ this.defaultColor = "#7f8c8d";
881
+ this.levelColorMap = {
882
+ 0: "#c0392b",
883
+ 1: "#f39c12",
884
+ 3: "#00BCD4"
885
+ };
886
+ this.typeColorMap = { success: "#2ecc71" };
887
+ }
888
+ _getLogFn(level) {
889
+ if (level < 1) return console.__error || console.error;
890
+ if (level === 1) return console.__warn || console.warn;
891
+ return console.__log || console.log;
892
+ }
893
+ log(logObj) {
894
+ const consoleLogFn = this._getLogFn(logObj.level);
895
+ const type = logObj.type === "log" ? "" : logObj.type;
896
+ const tag = logObj.tag || "";
897
+ const color = this.typeColorMap[logObj.type] || this.levelColorMap[logObj.level] || this.defaultColor;
898
+ const style = `
1068
899
  background: ${color};
1069
900
  border-radius: 0.5em;
1070
901
  color: white;
1071
902
  font-weight: bold;
1072
903
  padding: 2px 0.5em;
1073
904
  `;
1074
- const badge = `%c${[tag, type].filter(Boolean).join(":")}`;
1075
- if (typeof logObj.args[0] === "string") {
1076
- consoleLogFn(
1077
- `${badge}%c ${logObj.args[0]}`,
1078
- style,
1079
- // Empty string as style resets to default console style
1080
- "",
1081
- ...logObj.args.slice(1)
1082
- );
1083
- } else {
1084
- consoleLogFn(badge, style, ...logObj.args);
1085
- }
1086
- }
905
+ const badge = `%c${[tag, type].filter(Boolean).join(":")}`;
906
+ if (typeof logObj.args[0] === "string") consoleLogFn(
907
+ `${badge}%c ${logObj.args[0]}`,
908
+ style,
909
+ // Empty string as style resets to default console style
910
+ "",
911
+ ...logObj.args.slice(1)
912
+ );
913
+ else consoleLogFn(badge, style, ...logObj.args);
914
+ }
1087
915
  };
1088
- // Annotate the CommonJS export names for ESM import in node:
1089
- 0 && (module.exports = {
1090
- BasicReporter,
1091
- BrowserReporter,
1092
- Consola,
1093
- FancyReporter,
1094
- FileReporter,
1095
- LEVEL_COLOR_MAP,
1096
- LogLevels,
1097
- LogTypes,
1098
- LoggerReporter,
1099
- SubscriberReporter,
1100
- TYPE_COLOR_MAP,
1101
- consola,
1102
- createConsola,
1103
- createLoggerConsola,
1104
- wrapperSubscribers
1105
- });
916
+
917
+ //#endregion
918
+ exports.BasicReporter = BasicReporter;
919
+ exports.BrowserReporter = BrowserReporter;
920
+ exports.Consola = Consola;
921
+ exports.FancyReporter = FancyReporter;
922
+ exports.FileReporter = FileReporter;
923
+ exports.LEVEL_COLOR_MAP = LEVEL_COLOR_MAP;
924
+ exports.LogLevels = LogLevels;
925
+ exports.LogTypes = LogTypes;
926
+ exports.LoggerReporter = LoggerReporter;
927
+ exports.SubscriberReporter = SubscriberReporter;
928
+ exports.TYPE_COLOR_MAP = TYPE_COLOR_MAP;
929
+ exports.consola = consola;
930
+ exports.createConsola = createConsola;
931
+ exports.createLoggerConsola = createLoggerConsola;
932
+ exports.wrapperSubscribers = wrapperSubscribers;