@kubb/core 3.0.0-alpha.1 → 3.0.0-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{FileManager-EVJig-LT.d.ts → FileManager-BbUCeEyv.d.cts} +108 -94
- package/dist/{FileManager-DSLZ6ps7.d.cts → FileManager-CpuFz6eH.d.ts} +108 -94
- package/dist/chunk-2EU7DMPM.js +96 -0
- package/dist/chunk-2EU7DMPM.js.map +1 -0
- package/dist/chunk-4X5FFJPJ.js +8 -13
- package/dist/chunk-4X5FFJPJ.js.map +1 -1
- package/dist/chunk-52WA2JF5.cjs +1536 -0
- package/dist/chunk-52WA2JF5.cjs.map +1 -0
- package/dist/chunk-ADFKVVPE.cjs +42 -0
- package/dist/chunk-ADFKVVPE.cjs.map +1 -0
- package/dist/{chunk-3OXCZ5DJ.js → chunk-E6CN2CZC.js} +63 -54
- package/dist/chunk-E6CN2CZC.js.map +1 -0
- package/dist/chunk-HBQM723K.js +1049 -0
- package/dist/chunk-HBQM723K.js.map +1 -0
- package/dist/{chunk-67C6RBGQ.cjs → chunk-HMCSWG5L.cjs} +25 -26
- package/dist/chunk-HMCSWG5L.cjs.map +1 -0
- package/dist/chunk-L6YLVCKM.js +894 -0
- package/dist/chunk-L6YLVCKM.js.map +1 -0
- package/dist/chunk-PJLUPV3P.cjs +1088 -0
- package/dist/chunk-PJLUPV3P.cjs.map +1 -0
- package/dist/chunk-TTDCUWK7.cjs +101 -0
- package/dist/chunk-TTDCUWK7.cjs.map +1 -0
- package/dist/{chunk-LM2YQC3T.cjs → chunk-YEVCYV36.cjs} +81 -51
- package/dist/chunk-YEVCYV36.cjs.map +1 -0
- package/dist/index.cjs +545 -610
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -19
- package/dist/index.d.ts +6 -19
- package/dist/index.js +438 -522
- package/dist/index.js.map +1 -1
- package/dist/{logger-DChjnJMn.d.cts → logger-DvbHXjIO.d.cts} +29 -19
- package/dist/{logger-DChjnJMn.d.ts → logger-DvbHXjIO.d.ts} +29 -19
- package/dist/logger.cjs +25 -15
- package/dist/logger.cjs.map +1 -1
- package/dist/logger.d.cts +1 -2
- package/dist/logger.d.ts +1 -2
- package/dist/logger.js +3 -15
- package/dist/logger.js.map +1 -1
- package/dist/mocks.cjs +27 -26
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.d.cts +6 -9
- package/dist/mocks.d.ts +6 -9
- package/dist/mocks.js +22 -24
- package/dist/mocks.js.map +1 -1
- package/dist/prompt-L5KFKY73.cjs +760 -0
- package/dist/prompt-L5KFKY73.cjs.map +1 -0
- package/dist/prompt-WQQUN22Z.js +749 -0
- package/dist/prompt-WQQUN22Z.js.map +1 -0
- package/dist/transformers.cjs +215 -49
- package/dist/transformers.cjs.map +1 -1
- package/dist/transformers.d.cts +1 -3
- package/dist/transformers.d.ts +1 -3
- package/dist/transformers.js +148 -35
- package/dist/transformers.js.map +1 -1
- package/dist/utils.cjs +65 -26
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +31 -3
- package/dist/utils.d.ts +31 -3
- package/dist/utils.js +3 -26
- package/dist/utils.js.map +1 -1
- package/package.json +10 -10
- package/src/BarrelManager.ts +93 -107
- package/src/{Generator.ts → BaseGenerator.ts} +1 -1
- package/src/FileManager.ts +198 -297
- package/src/PackageManager.ts +1 -1
- package/src/PluginManager.ts +152 -101
- package/src/__snapshots__/barrel.json +91 -0
- package/src/__snapshots__/grouped.json +114 -0
- package/src/__snapshots__/ordered.json +62 -0
- package/src/build.ts +86 -171
- package/src/errors.ts +0 -11
- package/src/index.ts +1 -2
- package/src/logger.ts +76 -34
- package/src/plugin.ts +3 -3
- package/src/transformers/index.ts +2 -3
- package/src/transformers/trim.ts +0 -4
- package/src/types.ts +35 -35
- package/src/utils/TreeNode.ts +132 -50
- package/src/utils/executeStrategies.ts +1 -1
- package/src/utils/index.ts +2 -1
- package/src/utils/parser.ts +157 -0
- package/dist/chunk-3OXCZ5DJ.js.map +0 -1
- package/dist/chunk-5JZNFPUP.js +0 -309
- package/dist/chunk-5JZNFPUP.js.map +0 -1
- package/dist/chunk-67C6RBGQ.cjs.map +0 -1
- package/dist/chunk-ADC5UNZ5.cjs +0 -1227
- package/dist/chunk-ADC5UNZ5.cjs.map +0 -1
- package/dist/chunk-HMLY7DHA.js +0 -16
- package/dist/chunk-HMLY7DHA.js.map +0 -1
- package/dist/chunk-JKZG2IJR.js +0 -283
- package/dist/chunk-JKZG2IJR.js.map +0 -1
- package/dist/chunk-LM2YQC3T.cjs.map +0 -1
- package/dist/chunk-PZT4CTBV.cjs +0 -299
- package/dist/chunk-PZT4CTBV.cjs.map +0 -1
- package/dist/chunk-SA2GZKXS.js +0 -596
- package/dist/chunk-SA2GZKXS.js.map +0 -1
- package/dist/chunk-XCPFG6DO.cjs +0 -66
- package/dist/chunk-XCPFG6DO.cjs.map +0 -1
- package/dist/chunk-YTSNYMHW.cjs +0 -320
- package/dist/chunk-YTSNYMHW.cjs.map +0 -1
- package/schema.json +0 -86
- package/src/utils/getParser.ts +0 -17
|
@@ -0,0 +1,1049 @@
|
|
|
1
|
+
import { formatWithOptions } from 'node:util';
|
|
2
|
+
import { sep } from 'node:path';
|
|
3
|
+
import * as tty from 'node:tty';
|
|
4
|
+
import process$1 from 'node:process';
|
|
5
|
+
|
|
6
|
+
// ../../node_modules/.pnpm/consola@3.2.3/node_modules/consola/dist/core.mjs
|
|
7
|
+
var LogLevels = {
|
|
8
|
+
silent: Number.NEGATIVE_INFINITY,
|
|
9
|
+
fatal: 0,
|
|
10
|
+
error: 0,
|
|
11
|
+
warn: 1,
|
|
12
|
+
log: 2,
|
|
13
|
+
info: 3,
|
|
14
|
+
success: 3,
|
|
15
|
+
fail: 3,
|
|
16
|
+
ready: 3,
|
|
17
|
+
start: 3,
|
|
18
|
+
box: 3,
|
|
19
|
+
debug: 4,
|
|
20
|
+
trace: 5,
|
|
21
|
+
verbose: Number.POSITIVE_INFINITY
|
|
22
|
+
};
|
|
23
|
+
var LogTypes = {
|
|
24
|
+
// Silent
|
|
25
|
+
silent: {
|
|
26
|
+
level: -1
|
|
27
|
+
},
|
|
28
|
+
// Level 0
|
|
29
|
+
fatal: {
|
|
30
|
+
level: LogLevels.fatal
|
|
31
|
+
},
|
|
32
|
+
error: {
|
|
33
|
+
level: LogLevels.error
|
|
34
|
+
},
|
|
35
|
+
// Level 1
|
|
36
|
+
warn: {
|
|
37
|
+
level: LogLevels.warn
|
|
38
|
+
},
|
|
39
|
+
// Level 2
|
|
40
|
+
log: {
|
|
41
|
+
level: LogLevels.log
|
|
42
|
+
},
|
|
43
|
+
// Level 3
|
|
44
|
+
info: {
|
|
45
|
+
level: LogLevels.info
|
|
46
|
+
},
|
|
47
|
+
success: {
|
|
48
|
+
level: LogLevels.success
|
|
49
|
+
},
|
|
50
|
+
fail: {
|
|
51
|
+
level: LogLevels.fail
|
|
52
|
+
},
|
|
53
|
+
ready: {
|
|
54
|
+
level: LogLevels.info
|
|
55
|
+
},
|
|
56
|
+
start: {
|
|
57
|
+
level: LogLevels.info
|
|
58
|
+
},
|
|
59
|
+
box: {
|
|
60
|
+
level: LogLevels.info
|
|
61
|
+
},
|
|
62
|
+
// Level 4
|
|
63
|
+
debug: {
|
|
64
|
+
level: LogLevels.debug
|
|
65
|
+
},
|
|
66
|
+
// Level 5
|
|
67
|
+
trace: {
|
|
68
|
+
level: LogLevels.trace
|
|
69
|
+
},
|
|
70
|
+
// Verbose
|
|
71
|
+
verbose: {
|
|
72
|
+
level: LogLevels.verbose
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
function isObject(value) {
|
|
76
|
+
return value !== null && typeof value === "object";
|
|
77
|
+
}
|
|
78
|
+
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
79
|
+
if (!isObject(defaults)) {
|
|
80
|
+
return _defu(baseObject, {}, namespace);
|
|
81
|
+
}
|
|
82
|
+
const object = Object.assign({}, defaults);
|
|
83
|
+
for (const key in baseObject) {
|
|
84
|
+
if (key === "__proto__" || key === "constructor") {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
const value = baseObject[key];
|
|
88
|
+
if (value === null || value === void 0) {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
92
|
+
object[key] = [...value, ...object[key]];
|
|
93
|
+
} else if (isObject(value) && isObject(object[key])) {
|
|
94
|
+
object[key] = _defu(
|
|
95
|
+
value,
|
|
96
|
+
object[key],
|
|
97
|
+
(namespace ? `${namespace}.` : "") + key.toString());
|
|
98
|
+
} else {
|
|
99
|
+
object[key] = value;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return object;
|
|
103
|
+
}
|
|
104
|
+
function createDefu(merger) {
|
|
105
|
+
return (...arguments_) => (
|
|
106
|
+
// eslint-disable-next-line unicorn/no-array-reduce
|
|
107
|
+
arguments_.reduce((p, c) => _defu(p, c, ""), {})
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
var defu = createDefu();
|
|
111
|
+
function isPlainObject(obj) {
|
|
112
|
+
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
113
|
+
}
|
|
114
|
+
function isLogObj(arg) {
|
|
115
|
+
if (!isPlainObject(arg)) {
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
if (!arg.message && !arg.args) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
if (arg.stack) {
|
|
122
|
+
return false;
|
|
123
|
+
}
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
var paused = false;
|
|
127
|
+
var queue = [];
|
|
128
|
+
var Consola = class _Consola {
|
|
129
|
+
constructor(options = {}) {
|
|
130
|
+
const types = options.types || LogTypes;
|
|
131
|
+
this.options = defu(
|
|
132
|
+
{
|
|
133
|
+
...options,
|
|
134
|
+
defaults: { ...options.defaults },
|
|
135
|
+
level: _normalizeLogLevel(options.level, types),
|
|
136
|
+
reporters: [...options.reporters || []]
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
types: LogTypes,
|
|
140
|
+
throttle: 1e3,
|
|
141
|
+
throttleMin: 5,
|
|
142
|
+
formatOptions: {
|
|
143
|
+
date: true,
|
|
144
|
+
colors: false,
|
|
145
|
+
compact: true
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
for (const type in types) {
|
|
150
|
+
const defaults = {
|
|
151
|
+
type,
|
|
152
|
+
...this.options.defaults,
|
|
153
|
+
...types[type]
|
|
154
|
+
};
|
|
155
|
+
this[type] = this._wrapLogFn(defaults);
|
|
156
|
+
this[type].raw = this._wrapLogFn(
|
|
157
|
+
defaults,
|
|
158
|
+
true
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
if (this.options.mockFn) {
|
|
162
|
+
this.mockTypes();
|
|
163
|
+
}
|
|
164
|
+
this._lastLog = {};
|
|
165
|
+
}
|
|
166
|
+
get level() {
|
|
167
|
+
return this.options.level;
|
|
168
|
+
}
|
|
169
|
+
set level(level) {
|
|
170
|
+
this.options.level = _normalizeLogLevel(
|
|
171
|
+
level,
|
|
172
|
+
this.options.types,
|
|
173
|
+
this.options.level
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
prompt(message, opts) {
|
|
177
|
+
if (!this.options.prompt) {
|
|
178
|
+
throw new Error("prompt is not supported!");
|
|
179
|
+
}
|
|
180
|
+
return this.options.prompt(message, opts);
|
|
181
|
+
}
|
|
182
|
+
create(options) {
|
|
183
|
+
const instance = new _Consola({
|
|
184
|
+
...this.options,
|
|
185
|
+
...options
|
|
186
|
+
});
|
|
187
|
+
if (this._mockFn) {
|
|
188
|
+
instance.mockTypes(this._mockFn);
|
|
189
|
+
}
|
|
190
|
+
return instance;
|
|
191
|
+
}
|
|
192
|
+
withDefaults(defaults) {
|
|
193
|
+
return this.create({
|
|
194
|
+
...this.options,
|
|
195
|
+
defaults: {
|
|
196
|
+
...this.options.defaults,
|
|
197
|
+
...defaults
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
withTag(tag) {
|
|
202
|
+
return this.withDefaults({
|
|
203
|
+
tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
addReporter(reporter) {
|
|
207
|
+
this.options.reporters.push(reporter);
|
|
208
|
+
return this;
|
|
209
|
+
}
|
|
210
|
+
removeReporter(reporter) {
|
|
211
|
+
if (reporter) {
|
|
212
|
+
const i = this.options.reporters.indexOf(reporter);
|
|
213
|
+
if (i >= 0) {
|
|
214
|
+
return this.options.reporters.splice(i, 1);
|
|
215
|
+
}
|
|
216
|
+
} else {
|
|
217
|
+
this.options.reporters.splice(0);
|
|
218
|
+
}
|
|
219
|
+
return this;
|
|
220
|
+
}
|
|
221
|
+
setReporters(reporters) {
|
|
222
|
+
this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
|
|
223
|
+
return this;
|
|
224
|
+
}
|
|
225
|
+
wrapAll() {
|
|
226
|
+
this.wrapConsole();
|
|
227
|
+
this.wrapStd();
|
|
228
|
+
}
|
|
229
|
+
restoreAll() {
|
|
230
|
+
this.restoreConsole();
|
|
231
|
+
this.restoreStd();
|
|
232
|
+
}
|
|
233
|
+
wrapConsole() {
|
|
234
|
+
for (const type in this.options.types) {
|
|
235
|
+
if (!console["__" + type]) {
|
|
236
|
+
console["__" + type] = console[type];
|
|
237
|
+
}
|
|
238
|
+
console[type] = this[type].raw;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
restoreConsole() {
|
|
242
|
+
for (const type in this.options.types) {
|
|
243
|
+
if (console["__" + type]) {
|
|
244
|
+
console[type] = console["__" + type];
|
|
245
|
+
delete console["__" + type];
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
wrapStd() {
|
|
250
|
+
this._wrapStream(this.options.stdout, "log");
|
|
251
|
+
this._wrapStream(this.options.stderr, "log");
|
|
252
|
+
}
|
|
253
|
+
_wrapStream(stream, type) {
|
|
254
|
+
if (!stream) {
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
if (!stream.__write) {
|
|
258
|
+
stream.__write = stream.write;
|
|
259
|
+
}
|
|
260
|
+
stream.write = (data) => {
|
|
261
|
+
this[type].raw(String(data).trim());
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
restoreStd() {
|
|
265
|
+
this._restoreStream(this.options.stdout);
|
|
266
|
+
this._restoreStream(this.options.stderr);
|
|
267
|
+
}
|
|
268
|
+
_restoreStream(stream) {
|
|
269
|
+
if (!stream) {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
if (stream.__write) {
|
|
273
|
+
stream.write = stream.__write;
|
|
274
|
+
delete stream.__write;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
pauseLogs() {
|
|
278
|
+
paused = true;
|
|
279
|
+
}
|
|
280
|
+
resumeLogs() {
|
|
281
|
+
paused = false;
|
|
282
|
+
const _queue = queue.splice(0);
|
|
283
|
+
for (const item of _queue) {
|
|
284
|
+
item[0]._logFn(item[1], item[2]);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
mockTypes(mockFn) {
|
|
288
|
+
const _mockFn = mockFn || this.options.mockFn;
|
|
289
|
+
this._mockFn = _mockFn;
|
|
290
|
+
if (typeof _mockFn !== "function") {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
for (const type in this.options.types) {
|
|
294
|
+
this[type] = _mockFn(type, this.options.types[type]) || this[type];
|
|
295
|
+
this[type].raw = this[type];
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
_wrapLogFn(defaults, isRaw) {
|
|
299
|
+
return (...args) => {
|
|
300
|
+
if (paused) {
|
|
301
|
+
queue.push([this, defaults, args, isRaw]);
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
return this._logFn(defaults, args, isRaw);
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
_logFn(defaults, args, isRaw) {
|
|
308
|
+
if ((defaults.level || 0) > this.level) {
|
|
309
|
+
return false;
|
|
310
|
+
}
|
|
311
|
+
const logObj = {
|
|
312
|
+
date: /* @__PURE__ */ new Date(),
|
|
313
|
+
args: [],
|
|
314
|
+
...defaults,
|
|
315
|
+
level: _normalizeLogLevel(defaults.level, this.options.types)
|
|
316
|
+
};
|
|
317
|
+
if (!isRaw && args.length === 1 && isLogObj(args[0])) {
|
|
318
|
+
Object.assign(logObj, args[0]);
|
|
319
|
+
} else {
|
|
320
|
+
logObj.args = [...args];
|
|
321
|
+
}
|
|
322
|
+
if (logObj.message) {
|
|
323
|
+
logObj.args.unshift(logObj.message);
|
|
324
|
+
delete logObj.message;
|
|
325
|
+
}
|
|
326
|
+
if (logObj.additional) {
|
|
327
|
+
if (!Array.isArray(logObj.additional)) {
|
|
328
|
+
logObj.additional = logObj.additional.split("\n");
|
|
329
|
+
}
|
|
330
|
+
logObj.args.push("\n" + logObj.additional.join("\n"));
|
|
331
|
+
delete logObj.additional;
|
|
332
|
+
}
|
|
333
|
+
logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
|
|
334
|
+
logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
|
|
335
|
+
const resolveLog = (newLog = false) => {
|
|
336
|
+
const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
|
|
337
|
+
if (this._lastLog.object && repeated > 0) {
|
|
338
|
+
const args2 = [...this._lastLog.object.args];
|
|
339
|
+
if (repeated > 1) {
|
|
340
|
+
args2.push(`(repeated ${repeated} times)`);
|
|
341
|
+
}
|
|
342
|
+
this._log({ ...this._lastLog.object, args: args2 });
|
|
343
|
+
this._lastLog.count = 1;
|
|
344
|
+
}
|
|
345
|
+
if (newLog) {
|
|
346
|
+
this._lastLog.object = logObj;
|
|
347
|
+
this._log(logObj);
|
|
348
|
+
}
|
|
349
|
+
};
|
|
350
|
+
clearTimeout(this._lastLog.timeout);
|
|
351
|
+
const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
|
|
352
|
+
this._lastLog.time = logObj.date;
|
|
353
|
+
if (diffTime < this.options.throttle) {
|
|
354
|
+
try {
|
|
355
|
+
const serializedLog = JSON.stringify([
|
|
356
|
+
logObj.type,
|
|
357
|
+
logObj.tag,
|
|
358
|
+
logObj.args
|
|
359
|
+
]);
|
|
360
|
+
const isSameLog = this._lastLog.serialized === serializedLog;
|
|
361
|
+
this._lastLog.serialized = serializedLog;
|
|
362
|
+
if (isSameLog) {
|
|
363
|
+
this._lastLog.count = (this._lastLog.count || 0) + 1;
|
|
364
|
+
if (this._lastLog.count > this.options.throttleMin) {
|
|
365
|
+
this._lastLog.timeout = setTimeout(
|
|
366
|
+
resolveLog,
|
|
367
|
+
this.options.throttle
|
|
368
|
+
);
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
} catch {
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
resolveLog(true);
|
|
376
|
+
}
|
|
377
|
+
_log(logObj) {
|
|
378
|
+
for (const reporter of this.options.reporters) {
|
|
379
|
+
reporter.log(logObj, {
|
|
380
|
+
options: this.options
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
|
|
386
|
+
if (input === void 0) {
|
|
387
|
+
return defaultLevel;
|
|
388
|
+
}
|
|
389
|
+
if (typeof input === "number") {
|
|
390
|
+
return input;
|
|
391
|
+
}
|
|
392
|
+
if (types[input] && types[input].level !== void 0) {
|
|
393
|
+
return types[input].level;
|
|
394
|
+
}
|
|
395
|
+
return defaultLevel;
|
|
396
|
+
}
|
|
397
|
+
Consola.prototype.add = Consola.prototype.addReporter;
|
|
398
|
+
Consola.prototype.remove = Consola.prototype.removeReporter;
|
|
399
|
+
Consola.prototype.clear = Consola.prototype.removeReporter;
|
|
400
|
+
Consola.prototype.withScope = Consola.prototype.withTag;
|
|
401
|
+
Consola.prototype.mock = Consola.prototype.mockTypes;
|
|
402
|
+
Consola.prototype.pause = Consola.prototype.pauseLogs;
|
|
403
|
+
Consola.prototype.resume = Consola.prototype.resumeLogs;
|
|
404
|
+
function createConsola(options = {}) {
|
|
405
|
+
return new Consola(options);
|
|
406
|
+
}
|
|
407
|
+
function parseStack(stack) {
|
|
408
|
+
const cwd = process.cwd() + sep;
|
|
409
|
+
const lines = stack.split("\n").splice(1).map((l) => l.trim().replace("file://", "").replace(cwd, ""));
|
|
410
|
+
return lines;
|
|
411
|
+
}
|
|
412
|
+
function writeStream(data, stream) {
|
|
413
|
+
const write = stream.__write || stream.write;
|
|
414
|
+
return write.call(stream, data);
|
|
415
|
+
}
|
|
416
|
+
var bracket = (x) => x ? `[${x}]` : "";
|
|
417
|
+
var BasicReporter = class {
|
|
418
|
+
formatStack(stack, opts) {
|
|
419
|
+
return " " + parseStack(stack).join("\n ");
|
|
420
|
+
}
|
|
421
|
+
formatArgs(args, opts) {
|
|
422
|
+
const _args = args.map((arg) => {
|
|
423
|
+
if (arg && typeof arg.stack === "string") {
|
|
424
|
+
return arg.message + "\n" + this.formatStack(arg.stack, opts);
|
|
425
|
+
}
|
|
426
|
+
return arg;
|
|
427
|
+
});
|
|
428
|
+
return formatWithOptions(opts, ..._args);
|
|
429
|
+
}
|
|
430
|
+
formatDate(date, opts) {
|
|
431
|
+
return opts.date ? date.toLocaleTimeString() : "";
|
|
432
|
+
}
|
|
433
|
+
filterAndJoin(arr) {
|
|
434
|
+
return arr.filter(Boolean).join(" ");
|
|
435
|
+
}
|
|
436
|
+
formatLogObj(logObj, opts) {
|
|
437
|
+
const message = this.formatArgs(logObj.args, opts);
|
|
438
|
+
if (logObj.type === "box") {
|
|
439
|
+
return "\n" + [
|
|
440
|
+
bracket(logObj.tag),
|
|
441
|
+
logObj.title && logObj.title,
|
|
442
|
+
...message.split("\n")
|
|
443
|
+
].filter(Boolean).map((l) => " > " + l).join("\n") + "\n";
|
|
444
|
+
}
|
|
445
|
+
return this.filterAndJoin([
|
|
446
|
+
bracket(logObj.type),
|
|
447
|
+
bracket(logObj.tag),
|
|
448
|
+
message
|
|
449
|
+
]);
|
|
450
|
+
}
|
|
451
|
+
log(logObj, ctx) {
|
|
452
|
+
const line = this.formatLogObj(logObj, {
|
|
453
|
+
columns: ctx.options.stdout.columns || 0,
|
|
454
|
+
...ctx.options.formatOptions
|
|
455
|
+
});
|
|
456
|
+
return writeStream(
|
|
457
|
+
line + "\n",
|
|
458
|
+
logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
var {
|
|
463
|
+
env = {},
|
|
464
|
+
argv = [],
|
|
465
|
+
platform = ""
|
|
466
|
+
} = typeof process === "undefined" ? {} : process;
|
|
467
|
+
var isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
468
|
+
var isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
469
|
+
var isWindows = platform === "win32";
|
|
470
|
+
var isDumbTerminal = env.TERM === "dumb";
|
|
471
|
+
var isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
|
|
472
|
+
var isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
473
|
+
var isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
474
|
+
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)) {
|
|
475
|
+
return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
476
|
+
}
|
|
477
|
+
function clearBleed(index, string, open, close, replace) {
|
|
478
|
+
return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
479
|
+
}
|
|
480
|
+
function filterEmpty(open, close, replace = open, at = open.length + 1) {
|
|
481
|
+
return (string) => string || !(string === "" || string === void 0) ? clearBleed(
|
|
482
|
+
("" + string).indexOf(close, at),
|
|
483
|
+
string,
|
|
484
|
+
open,
|
|
485
|
+
close,
|
|
486
|
+
replace
|
|
487
|
+
) : "";
|
|
488
|
+
}
|
|
489
|
+
function init(open, close, replace) {
|
|
490
|
+
return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
|
|
491
|
+
}
|
|
492
|
+
var colorDefs = {
|
|
493
|
+
reset: init(0, 0),
|
|
494
|
+
bold: init(1, 22, "\x1B[22m\x1B[1m"),
|
|
495
|
+
dim: init(2, 22, "\x1B[22m\x1B[2m"),
|
|
496
|
+
italic: init(3, 23),
|
|
497
|
+
underline: init(4, 24),
|
|
498
|
+
inverse: init(7, 27),
|
|
499
|
+
hidden: init(8, 28),
|
|
500
|
+
strikethrough: init(9, 29),
|
|
501
|
+
black: init(30, 39),
|
|
502
|
+
red: init(31, 39),
|
|
503
|
+
green: init(32, 39),
|
|
504
|
+
yellow: init(33, 39),
|
|
505
|
+
blue: init(34, 39),
|
|
506
|
+
magenta: init(35, 39),
|
|
507
|
+
cyan: init(36, 39),
|
|
508
|
+
white: init(37, 39),
|
|
509
|
+
gray: init(90, 39),
|
|
510
|
+
bgBlack: init(40, 49),
|
|
511
|
+
bgRed: init(41, 49),
|
|
512
|
+
bgGreen: init(42, 49),
|
|
513
|
+
bgYellow: init(43, 49),
|
|
514
|
+
bgBlue: init(44, 49),
|
|
515
|
+
bgMagenta: init(45, 49),
|
|
516
|
+
bgCyan: init(46, 49),
|
|
517
|
+
bgWhite: init(47, 49),
|
|
518
|
+
blackBright: init(90, 39),
|
|
519
|
+
redBright: init(91, 39),
|
|
520
|
+
greenBright: init(92, 39),
|
|
521
|
+
yellowBright: init(93, 39),
|
|
522
|
+
blueBright: init(94, 39),
|
|
523
|
+
magentaBright: init(95, 39),
|
|
524
|
+
cyanBright: init(96, 39),
|
|
525
|
+
whiteBright: init(97, 39),
|
|
526
|
+
bgBlackBright: init(100, 49),
|
|
527
|
+
bgRedBright: init(101, 49),
|
|
528
|
+
bgGreenBright: init(102, 49),
|
|
529
|
+
bgYellowBright: init(103, 49),
|
|
530
|
+
bgBlueBright: init(104, 49),
|
|
531
|
+
bgMagentaBright: init(105, 49),
|
|
532
|
+
bgCyanBright: init(106, 49),
|
|
533
|
+
bgWhiteBright: init(107, 49)
|
|
534
|
+
};
|
|
535
|
+
function createColors(useColor = isColorSupported) {
|
|
536
|
+
return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
|
|
537
|
+
}
|
|
538
|
+
var colors = createColors();
|
|
539
|
+
function getColor(color, fallback = "reset") {
|
|
540
|
+
return colors[color] || colors[fallback];
|
|
541
|
+
}
|
|
542
|
+
var ansiRegex = [
|
|
543
|
+
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
|
|
544
|
+
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"
|
|
545
|
+
].join("|");
|
|
546
|
+
function stripAnsi(text) {
|
|
547
|
+
return text.replace(new RegExp(ansiRegex, "g"), "");
|
|
548
|
+
}
|
|
549
|
+
var boxStylePresets = {
|
|
550
|
+
solid: {
|
|
551
|
+
tl: "\u250C",
|
|
552
|
+
tr: "\u2510",
|
|
553
|
+
bl: "\u2514",
|
|
554
|
+
br: "\u2518",
|
|
555
|
+
h: "\u2500",
|
|
556
|
+
v: "\u2502"
|
|
557
|
+
},
|
|
558
|
+
double: {
|
|
559
|
+
tl: "\u2554",
|
|
560
|
+
tr: "\u2557",
|
|
561
|
+
bl: "\u255A",
|
|
562
|
+
br: "\u255D",
|
|
563
|
+
h: "\u2550",
|
|
564
|
+
v: "\u2551"
|
|
565
|
+
},
|
|
566
|
+
doubleSingle: {
|
|
567
|
+
tl: "\u2553",
|
|
568
|
+
tr: "\u2556",
|
|
569
|
+
bl: "\u2559",
|
|
570
|
+
br: "\u255C",
|
|
571
|
+
h: "\u2500",
|
|
572
|
+
v: "\u2551"
|
|
573
|
+
},
|
|
574
|
+
doubleSingleRounded: {
|
|
575
|
+
tl: "\u256D",
|
|
576
|
+
tr: "\u256E",
|
|
577
|
+
bl: "\u2570",
|
|
578
|
+
br: "\u256F",
|
|
579
|
+
h: "\u2500",
|
|
580
|
+
v: "\u2551"
|
|
581
|
+
},
|
|
582
|
+
singleThick: {
|
|
583
|
+
tl: "\u250F",
|
|
584
|
+
tr: "\u2513",
|
|
585
|
+
bl: "\u2517",
|
|
586
|
+
br: "\u251B",
|
|
587
|
+
h: "\u2501",
|
|
588
|
+
v: "\u2503"
|
|
589
|
+
},
|
|
590
|
+
singleDouble: {
|
|
591
|
+
tl: "\u2552",
|
|
592
|
+
tr: "\u2555",
|
|
593
|
+
bl: "\u2558",
|
|
594
|
+
br: "\u255B",
|
|
595
|
+
h: "\u2550",
|
|
596
|
+
v: "\u2502"
|
|
597
|
+
},
|
|
598
|
+
singleDoubleRounded: {
|
|
599
|
+
tl: "\u256D",
|
|
600
|
+
tr: "\u256E",
|
|
601
|
+
bl: "\u2570",
|
|
602
|
+
br: "\u256F",
|
|
603
|
+
h: "\u2550",
|
|
604
|
+
v: "\u2502"
|
|
605
|
+
},
|
|
606
|
+
rounded: {
|
|
607
|
+
tl: "\u256D",
|
|
608
|
+
tr: "\u256E",
|
|
609
|
+
bl: "\u2570",
|
|
610
|
+
br: "\u256F",
|
|
611
|
+
h: "\u2500",
|
|
612
|
+
v: "\u2502"
|
|
613
|
+
}
|
|
614
|
+
};
|
|
615
|
+
var defaultStyle = {
|
|
616
|
+
borderColor: "white",
|
|
617
|
+
borderStyle: "rounded",
|
|
618
|
+
valign: "center",
|
|
619
|
+
padding: 2,
|
|
620
|
+
marginLeft: 1,
|
|
621
|
+
marginTop: 1,
|
|
622
|
+
marginBottom: 1
|
|
623
|
+
};
|
|
624
|
+
function box(text, _opts = {}) {
|
|
625
|
+
const opts = {
|
|
626
|
+
..._opts,
|
|
627
|
+
style: {
|
|
628
|
+
...defaultStyle,
|
|
629
|
+
..._opts.style
|
|
630
|
+
}
|
|
631
|
+
};
|
|
632
|
+
const textLines = text.split("\n");
|
|
633
|
+
const boxLines = [];
|
|
634
|
+
const _color = getColor(opts.style.borderColor);
|
|
635
|
+
const borderStyle = {
|
|
636
|
+
...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle
|
|
637
|
+
};
|
|
638
|
+
if (_color) {
|
|
639
|
+
for (const key in borderStyle) {
|
|
640
|
+
borderStyle[key] = _color(
|
|
641
|
+
borderStyle[key]
|
|
642
|
+
);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
|
|
646
|
+
const height = textLines.length + paddingOffset;
|
|
647
|
+
const width = Math.max(...textLines.map((line) => line.length)) + paddingOffset;
|
|
648
|
+
const widthOffset = width + paddingOffset;
|
|
649
|
+
const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
|
|
650
|
+
if (opts.style.marginTop > 0) {
|
|
651
|
+
boxLines.push("".repeat(opts.style.marginTop));
|
|
652
|
+
}
|
|
653
|
+
if (opts.title) {
|
|
654
|
+
const left = borderStyle.h.repeat(
|
|
655
|
+
Math.floor((width - stripAnsi(opts.title).length) / 2)
|
|
656
|
+
);
|
|
657
|
+
const right = borderStyle.h.repeat(
|
|
658
|
+
width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset
|
|
659
|
+
);
|
|
660
|
+
boxLines.push(
|
|
661
|
+
`${leftSpace}${borderStyle.tl}${left}${opts.title}${right}${borderStyle.tr}`
|
|
662
|
+
);
|
|
663
|
+
} else {
|
|
664
|
+
boxLines.push(
|
|
665
|
+
`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`
|
|
666
|
+
);
|
|
667
|
+
}
|
|
668
|
+
const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
|
|
669
|
+
for (let i = 0; i < height; i++) {
|
|
670
|
+
if (i < valignOffset || i >= valignOffset + textLines.length) {
|
|
671
|
+
boxLines.push(
|
|
672
|
+
`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`
|
|
673
|
+
);
|
|
674
|
+
} else {
|
|
675
|
+
const line = textLines[i - valignOffset];
|
|
676
|
+
const left = " ".repeat(paddingOffset);
|
|
677
|
+
const right = " ".repeat(width - stripAnsi(line).length);
|
|
678
|
+
boxLines.push(
|
|
679
|
+
`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`
|
|
680
|
+
);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
boxLines.push(
|
|
684
|
+
`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`
|
|
685
|
+
);
|
|
686
|
+
if (opts.style.marginBottom > 0) {
|
|
687
|
+
boxLines.push("".repeat(opts.style.marginBottom));
|
|
688
|
+
}
|
|
689
|
+
return boxLines.join("\n");
|
|
690
|
+
}
|
|
691
|
+
var providers = [
|
|
692
|
+
["APPVEYOR"],
|
|
693
|
+
["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],
|
|
694
|
+
["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],
|
|
695
|
+
["APPCIRCLE", "AC_APPCIRCLE"],
|
|
696
|
+
["BAMBOO", "bamboo_planKey"],
|
|
697
|
+
["BITBUCKET", "BITBUCKET_COMMIT"],
|
|
698
|
+
["BITRISE", "BITRISE_IO"],
|
|
699
|
+
["BUDDY", "BUDDY_WORKSPACE_ID"],
|
|
700
|
+
["BUILDKITE"],
|
|
701
|
+
["CIRCLE", "CIRCLECI"],
|
|
702
|
+
["CIRRUS", "CIRRUS_CI"],
|
|
703
|
+
["CLOUDFLARE_PAGES", "CF_PAGES", { ci: true }],
|
|
704
|
+
["CODEBUILD", "CODEBUILD_BUILD_ARN"],
|
|
705
|
+
["CODEFRESH", "CF_BUILD_ID"],
|
|
706
|
+
["DRONE"],
|
|
707
|
+
["DRONE", "DRONE_BUILD_EVENT"],
|
|
708
|
+
["DSARI"],
|
|
709
|
+
["GITHUB_ACTIONS"],
|
|
710
|
+
["GITLAB", "GITLAB_CI"],
|
|
711
|
+
["GITLAB", "CI_MERGE_REQUEST_ID"],
|
|
712
|
+
["GOCD", "GO_PIPELINE_LABEL"],
|
|
713
|
+
["LAYERCI"],
|
|
714
|
+
["HUDSON", "HUDSON_URL"],
|
|
715
|
+
["JENKINS", "JENKINS_URL"],
|
|
716
|
+
["MAGNUM"],
|
|
717
|
+
["NETLIFY"],
|
|
718
|
+
["NETLIFY", "NETLIFY_LOCAL", { ci: false }],
|
|
719
|
+
["NEVERCODE"],
|
|
720
|
+
["RENDER"],
|
|
721
|
+
["SAIL", "SAILCI"],
|
|
722
|
+
["SEMAPHORE"],
|
|
723
|
+
["SCREWDRIVER"],
|
|
724
|
+
["SHIPPABLE"],
|
|
725
|
+
["SOLANO", "TDDIUM"],
|
|
726
|
+
["STRIDER"],
|
|
727
|
+
["TEAMCITY", "TEAMCITY_VERSION"],
|
|
728
|
+
["TRAVIS"],
|
|
729
|
+
["VERCEL", "NOW_BUILDER"],
|
|
730
|
+
["APPCENTER", "APPCENTER_BUILD_ID"],
|
|
731
|
+
["CODESANDBOX", "CODESANDBOX_SSE", { ci: false }],
|
|
732
|
+
["STACKBLITZ"],
|
|
733
|
+
["STORMKIT"],
|
|
734
|
+
["CLEAVR"]
|
|
735
|
+
];
|
|
736
|
+
function detectProvider(env2) {
|
|
737
|
+
for (const provider of providers) {
|
|
738
|
+
const envName = provider[1] || provider[0];
|
|
739
|
+
if (env2[envName]) {
|
|
740
|
+
return {
|
|
741
|
+
name: provider[0].toLowerCase(),
|
|
742
|
+
...provider[2]
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
if (env2.SHELL && env2.SHELL === "/bin/jsh") {
|
|
747
|
+
return {
|
|
748
|
+
name: "stackblitz",
|
|
749
|
+
ci: false
|
|
750
|
+
};
|
|
751
|
+
}
|
|
752
|
+
return {
|
|
753
|
+
name: "",
|
|
754
|
+
ci: false
|
|
755
|
+
};
|
|
756
|
+
}
|
|
757
|
+
var processShim = typeof process !== "undefined" ? process : {};
|
|
758
|
+
var envShim = processShim.env || {};
|
|
759
|
+
var providerInfo = detectProvider(envShim);
|
|
760
|
+
var nodeENV = typeof process !== "undefined" && process.env && process.env.NODE_ENV || "";
|
|
761
|
+
processShim.platform;
|
|
762
|
+
providerInfo.name;
|
|
763
|
+
var isCI2 = toBoolean(envShim.CI) || providerInfo.ci !== false;
|
|
764
|
+
var hasTTY = toBoolean(processShim.stdout && processShim.stdout.isTTY);
|
|
765
|
+
var isDebug = toBoolean(envShim.DEBUG);
|
|
766
|
+
var isTest = nodeENV === "test" || toBoolean(envShim.TEST);
|
|
767
|
+
toBoolean(envShim.MINIMAL) || isCI2 || isTest || !hasTTY;
|
|
768
|
+
function toBoolean(val) {
|
|
769
|
+
return val ? val !== "false" : false;
|
|
770
|
+
}
|
|
771
|
+
function ansiRegex2({ onlyFirst = false } = {}) {
|
|
772
|
+
const pattern = [
|
|
773
|
+
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
|
|
774
|
+
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
|
|
775
|
+
].join("|");
|
|
776
|
+
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
777
|
+
}
|
|
778
|
+
var regex = ansiRegex2();
|
|
779
|
+
function stripAnsi2(string) {
|
|
780
|
+
if (typeof string !== "string") {
|
|
781
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
782
|
+
}
|
|
783
|
+
return string.replace(regex, "");
|
|
784
|
+
}
|
|
785
|
+
function getDefaultExportFromCjs(x) {
|
|
786
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
787
|
+
}
|
|
788
|
+
var eastasianwidth = { exports: {} };
|
|
789
|
+
(function(module) {
|
|
790
|
+
var eaw = {};
|
|
791
|
+
{
|
|
792
|
+
module.exports = eaw;
|
|
793
|
+
}
|
|
794
|
+
eaw.eastAsianWidth = function(character) {
|
|
795
|
+
var x = character.charCodeAt(0);
|
|
796
|
+
var y = character.length == 2 ? character.charCodeAt(1) : 0;
|
|
797
|
+
var codePoint = x;
|
|
798
|
+
if (55296 <= x && x <= 56319 && (56320 <= y && y <= 57343)) {
|
|
799
|
+
x &= 1023;
|
|
800
|
+
y &= 1023;
|
|
801
|
+
codePoint = x << 10 | y;
|
|
802
|
+
codePoint += 65536;
|
|
803
|
+
}
|
|
804
|
+
if (12288 == codePoint || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510) {
|
|
805
|
+
return "F";
|
|
806
|
+
}
|
|
807
|
+
if (8361 == codePoint || 65377 <= codePoint && codePoint <= 65470 || 65474 <= codePoint && codePoint <= 65479 || 65482 <= codePoint && codePoint <= 65487 || 65490 <= codePoint && codePoint <= 65495 || 65498 <= codePoint && codePoint <= 65500 || 65512 <= codePoint && codePoint <= 65518) {
|
|
808
|
+
return "H";
|
|
809
|
+
}
|
|
810
|
+
if (4352 <= codePoint && codePoint <= 4447 || 4515 <= codePoint && codePoint <= 4519 || 4602 <= codePoint && codePoint <= 4607 || 9001 <= codePoint && codePoint <= 9002 || 11904 <= codePoint && codePoint <= 11929 || 11931 <= codePoint && codePoint <= 12019 || 12032 <= codePoint && codePoint <= 12245 || 12272 <= codePoint && codePoint <= 12283 || 12289 <= codePoint && codePoint <= 12350 || 12353 <= codePoint && codePoint <= 12438 || 12441 <= codePoint && codePoint <= 12543 || 12549 <= codePoint && codePoint <= 12589 || 12593 <= codePoint && codePoint <= 12686 || 12688 <= codePoint && codePoint <= 12730 || 12736 <= codePoint && codePoint <= 12771 || 12784 <= codePoint && codePoint <= 12830 || 12832 <= codePoint && codePoint <= 12871 || 12880 <= codePoint && codePoint <= 13054 || 13056 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42124 || 42128 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 55216 <= codePoint && codePoint <= 55238 || 55243 <= codePoint && codePoint <= 55291 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65106 || 65108 <= codePoint && codePoint <= 65126 || 65128 <= codePoint && codePoint <= 65131 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127490 || 127504 <= codePoint && codePoint <= 127546 || 127552 <= codePoint && codePoint <= 127560 || 127568 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 194367 || 177984 <= codePoint && codePoint <= 196605 || 196608 <= codePoint && codePoint <= 262141) {
|
|
811
|
+
return "W";
|
|
812
|
+
}
|
|
813
|
+
if (32 <= codePoint && codePoint <= 126 || 162 <= codePoint && codePoint <= 163 || 165 <= codePoint && codePoint <= 166 || 172 == codePoint || 175 == codePoint || 10214 <= codePoint && codePoint <= 10221 || 10629 <= codePoint && codePoint <= 10630) {
|
|
814
|
+
return "Na";
|
|
815
|
+
}
|
|
816
|
+
if (161 == codePoint || 164 == codePoint || 167 <= codePoint && codePoint <= 168 || 170 == codePoint || 173 <= codePoint && codePoint <= 174 || 176 <= codePoint && codePoint <= 180 || 182 <= codePoint && codePoint <= 186 || 188 <= codePoint && codePoint <= 191 || 198 == codePoint || 208 == codePoint || 215 <= codePoint && codePoint <= 216 || 222 <= codePoint && codePoint <= 225 || 230 == codePoint || 232 <= codePoint && codePoint <= 234 || 236 <= codePoint && codePoint <= 237 || 240 == codePoint || 242 <= codePoint && codePoint <= 243 || 247 <= codePoint && codePoint <= 250 || 252 == codePoint || 254 == codePoint || 257 == codePoint || 273 == codePoint || 275 == codePoint || 283 == codePoint || 294 <= codePoint && codePoint <= 295 || 299 == codePoint || 305 <= codePoint && codePoint <= 307 || 312 == codePoint || 319 <= codePoint && codePoint <= 322 || 324 == codePoint || 328 <= codePoint && codePoint <= 331 || 333 == codePoint || 338 <= codePoint && codePoint <= 339 || 358 <= codePoint && codePoint <= 359 || 363 == codePoint || 462 == codePoint || 464 == codePoint || 466 == codePoint || 468 == codePoint || 470 == codePoint || 472 == codePoint || 474 == codePoint || 476 == codePoint || 593 == codePoint || 609 == codePoint || 708 == codePoint || 711 == codePoint || 713 <= codePoint && codePoint <= 715 || 717 == codePoint || 720 == codePoint || 728 <= codePoint && codePoint <= 731 || 733 == codePoint || 735 == codePoint || 768 <= codePoint && codePoint <= 879 || 913 <= codePoint && codePoint <= 929 || 931 <= codePoint && codePoint <= 937 || 945 <= codePoint && codePoint <= 961 || 963 <= codePoint && codePoint <= 969 || 1025 == codePoint || 1040 <= codePoint && codePoint <= 1103 || 1105 == codePoint || 8208 == codePoint || 8211 <= codePoint && codePoint <= 8214 || 8216 <= codePoint && codePoint <= 8217 || 8220 <= codePoint && codePoint <= 8221 || 8224 <= codePoint && codePoint <= 8226 || 8228 <= codePoint && codePoint <= 8231 || 8240 == codePoint || 8242 <= codePoint && codePoint <= 8243 || 8245 == codePoint || 8251 == codePoint || 8254 == codePoint || 8308 == codePoint || 8319 == codePoint || 8321 <= codePoint && codePoint <= 8324 || 8364 == codePoint || 8451 == codePoint || 8453 == codePoint || 8457 == codePoint || 8467 == codePoint || 8470 == codePoint || 8481 <= codePoint && codePoint <= 8482 || 8486 == codePoint || 8491 == codePoint || 8531 <= codePoint && codePoint <= 8532 || 8539 <= codePoint && codePoint <= 8542 || 8544 <= codePoint && codePoint <= 8555 || 8560 <= codePoint && codePoint <= 8569 || 8585 == codePoint || 8592 <= codePoint && codePoint <= 8601 || 8632 <= codePoint && codePoint <= 8633 || 8658 == codePoint || 8660 == codePoint || 8679 == codePoint || 8704 == codePoint || 8706 <= codePoint && codePoint <= 8707 || 8711 <= codePoint && codePoint <= 8712 || 8715 == codePoint || 8719 == codePoint || 8721 == codePoint || 8725 == codePoint || 8730 == codePoint || 8733 <= codePoint && codePoint <= 8736 || 8739 == codePoint || 8741 == codePoint || 8743 <= codePoint && codePoint <= 8748 || 8750 == codePoint || 8756 <= codePoint && codePoint <= 8759 || 8764 <= codePoint && codePoint <= 8765 || 8776 == codePoint || 8780 == codePoint || 8786 == codePoint || 8800 <= codePoint && codePoint <= 8801 || 8804 <= codePoint && codePoint <= 8807 || 8810 <= codePoint && codePoint <= 8811 || 8814 <= codePoint && codePoint <= 8815 || 8834 <= codePoint && codePoint <= 8835 || 8838 <= codePoint && codePoint <= 8839 || 8853 == codePoint || 8857 == codePoint || 8869 == codePoint || 8895 == codePoint || 8978 == codePoint || 9312 <= codePoint && codePoint <= 9449 || 9451 <= codePoint && codePoint <= 9547 || 9552 <= codePoint && codePoint <= 9587 || 9600 <= codePoint && codePoint <= 9615 || 9618 <= codePoint && codePoint <= 9621 || 9632 <= codePoint && codePoint <= 9633 || 9635 <= codePoint && codePoint <= 9641 || 9650 <= codePoint && codePoint <= 9651 || 9654 <= codePoint && codePoint <= 9655 || 9660 <= codePoint && codePoint <= 9661 || 9664 <= codePoint && codePoint <= 9665 || 9670 <= codePoint && codePoint <= 9672 || 9675 == codePoint || 9678 <= codePoint && codePoint <= 9681 || 9698 <= codePoint && codePoint <= 9701 || 9711 == codePoint || 9733 <= codePoint && codePoint <= 9734 || 9737 == codePoint || 9742 <= codePoint && codePoint <= 9743 || 9748 <= codePoint && codePoint <= 9749 || 9756 == codePoint || 9758 == codePoint || 9792 == codePoint || 9794 == codePoint || 9824 <= codePoint && codePoint <= 9825 || 9827 <= codePoint && codePoint <= 9829 || 9831 <= codePoint && codePoint <= 9834 || 9836 <= codePoint && codePoint <= 9837 || 9839 == codePoint || 9886 <= codePoint && codePoint <= 9887 || 9918 <= codePoint && codePoint <= 9919 || 9924 <= codePoint && codePoint <= 9933 || 9935 <= codePoint && codePoint <= 9953 || 9955 == codePoint || 9960 <= codePoint && codePoint <= 9983 || 10045 == codePoint || 10071 == codePoint || 10102 <= codePoint && codePoint <= 10111 || 11093 <= codePoint && codePoint <= 11097 || 12872 <= codePoint && codePoint <= 12879 || 57344 <= codePoint && codePoint <= 63743 || 65024 <= codePoint && codePoint <= 65039 || 65533 == codePoint || 127232 <= codePoint && codePoint <= 127242 || 127248 <= codePoint && codePoint <= 127277 || 127280 <= codePoint && codePoint <= 127337 || 127344 <= codePoint && codePoint <= 127386 || 917760 <= codePoint && codePoint <= 917999 || 983040 <= codePoint && codePoint <= 1048573 || 1048576 <= codePoint && codePoint <= 1114109) {
|
|
817
|
+
return "A";
|
|
818
|
+
}
|
|
819
|
+
return "N";
|
|
820
|
+
};
|
|
821
|
+
eaw.characterLength = function(character) {
|
|
822
|
+
var code = this.eastAsianWidth(character);
|
|
823
|
+
if (code == "F" || code == "W" || code == "A") {
|
|
824
|
+
return 2;
|
|
825
|
+
} else {
|
|
826
|
+
return 1;
|
|
827
|
+
}
|
|
828
|
+
};
|
|
829
|
+
function stringToArray(string) {
|
|
830
|
+
return string.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
831
|
+
}
|
|
832
|
+
eaw.length = function(string) {
|
|
833
|
+
var characters = stringToArray(string);
|
|
834
|
+
var len = 0;
|
|
835
|
+
for (var i = 0; i < characters.length; i++) {
|
|
836
|
+
len = len + this.characterLength(characters[i]);
|
|
837
|
+
}
|
|
838
|
+
return len;
|
|
839
|
+
};
|
|
840
|
+
eaw.slice = function(text, start, end) {
|
|
841
|
+
textLen = eaw.length(text);
|
|
842
|
+
start = start ? start : 0;
|
|
843
|
+
end = end ? end : 1;
|
|
844
|
+
if (start < 0) {
|
|
845
|
+
start = textLen + start;
|
|
846
|
+
}
|
|
847
|
+
if (end < 0) {
|
|
848
|
+
end = textLen + end;
|
|
849
|
+
}
|
|
850
|
+
var result = "";
|
|
851
|
+
var eawLen = 0;
|
|
852
|
+
var chars = stringToArray(text);
|
|
853
|
+
for (var i = 0; i < chars.length; i++) {
|
|
854
|
+
var char = chars[i];
|
|
855
|
+
var charLen = eaw.length(char);
|
|
856
|
+
if (eawLen >= start - (charLen == 2 ? 1 : 0)) {
|
|
857
|
+
if (eawLen + charLen <= end) {
|
|
858
|
+
result += char;
|
|
859
|
+
} else {
|
|
860
|
+
break;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
863
|
+
eawLen += charLen;
|
|
864
|
+
}
|
|
865
|
+
return result;
|
|
866
|
+
};
|
|
867
|
+
})(eastasianwidth);
|
|
868
|
+
var eastasianwidthExports = eastasianwidth.exports;
|
|
869
|
+
var eastAsianWidth = /* @__PURE__ */ getDefaultExportFromCjs(eastasianwidthExports);
|
|
870
|
+
var emojiRegex = () => {
|
|
871
|
+
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\u26D3\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](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\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]|\u26F9(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\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])?|[\uDFC3\uDFC4\uDFCA](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDFCB\uDFCC](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDCCF\uDD8E\uDD91-\uDD9A\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\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-\uDDF5\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]|\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(?:[\uDC08\uDC26](?:\u200D\u2B1B)?|[\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-\uDEB6](?:\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|[\uDD74\uDD90](?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?|[\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-\uDE44\uDE48-\uDE4A\uDE80-\uDEA2\uDEA4-\uDEB3\uDEB7-\uDEBF\uDEC1-\uDEC5\uDED0-\uDED2\uDED5-\uDED7\uDEDC-\uDEDF\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB\uDFF0]|\uDC15(?:\u200D\uD83E\uDDBA)?|\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-\uDDB3\uDDBC\uDDBD])|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD])|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83D[\uDC68\uDC69]\uD83C[\uDFFB-\uDFFE])))?))?|\uDC6F(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDD75(?:\uFE0F|\uD83C[\uDFFB-\uDFFF])?(?:\u200D[\u2640\u2642]\uFE0F?)?|\uDE2E(?:\u200D\uD83D\uDCA8)?|\uDE35(?:\u200D\uD83D\uDCAB)?|\uDE36(?:\u200D\uD83C\uDF2B\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-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC2\uDECE-\uDEDB\uDEE0-\uDEE8]|\uDD3C(?:\u200D[\u2640\u2642]\uFE0F?|\uD83C[\uDFFB-\uDFFF])?|\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-\uDDB3\uDDBC\uDDBD]|\uDD1D\u200D\uD83E\uDDD1))|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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-\uDDB3\uDDBC\uDDBD]|\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;
|
|
872
|
+
};
|
|
873
|
+
function stringWidth$1(string, options) {
|
|
874
|
+
if (typeof string !== "string" || string.length === 0) {
|
|
875
|
+
return 0;
|
|
876
|
+
}
|
|
877
|
+
options = {
|
|
878
|
+
ambiguousIsNarrow: true,
|
|
879
|
+
countAnsiEscapeCodes: false,
|
|
880
|
+
...options
|
|
881
|
+
};
|
|
882
|
+
if (!options.countAnsiEscapeCodes) {
|
|
883
|
+
string = stripAnsi2(string);
|
|
884
|
+
}
|
|
885
|
+
if (string.length === 0) {
|
|
886
|
+
return 0;
|
|
887
|
+
}
|
|
888
|
+
const ambiguousCharacterWidth = options.ambiguousIsNarrow ? 1 : 2;
|
|
889
|
+
let width = 0;
|
|
890
|
+
for (const { segment: character } of new Intl.Segmenter().segment(string)) {
|
|
891
|
+
const codePoint = character.codePointAt(0);
|
|
892
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) {
|
|
893
|
+
continue;
|
|
894
|
+
}
|
|
895
|
+
if (codePoint >= 768 && codePoint <= 879) {
|
|
896
|
+
continue;
|
|
897
|
+
}
|
|
898
|
+
if (emojiRegex().test(character)) {
|
|
899
|
+
width += 2;
|
|
900
|
+
continue;
|
|
901
|
+
}
|
|
902
|
+
const code = eastAsianWidth.eastAsianWidth(character);
|
|
903
|
+
switch (code) {
|
|
904
|
+
case "F":
|
|
905
|
+
case "W": {
|
|
906
|
+
width += 2;
|
|
907
|
+
break;
|
|
908
|
+
}
|
|
909
|
+
case "A": {
|
|
910
|
+
width += ambiguousCharacterWidth;
|
|
911
|
+
break;
|
|
912
|
+
}
|
|
913
|
+
default: {
|
|
914
|
+
width += 1;
|
|
915
|
+
}
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
return width;
|
|
919
|
+
}
|
|
920
|
+
function isUnicodeSupported() {
|
|
921
|
+
if (process$1.platform !== "win32") {
|
|
922
|
+
return process$1.env.TERM !== "linux";
|
|
923
|
+
}
|
|
924
|
+
return Boolean(process$1.env.CI) || Boolean(process$1.env.WT_SESSION) || Boolean(process$1.env.TERMINUS_SUBLIME) || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
925
|
+
}
|
|
926
|
+
var TYPE_COLOR_MAP = {
|
|
927
|
+
info: "cyan",
|
|
928
|
+
fail: "red",
|
|
929
|
+
success: "green",
|
|
930
|
+
ready: "green",
|
|
931
|
+
start: "magenta"
|
|
932
|
+
};
|
|
933
|
+
var LEVEL_COLOR_MAP = {
|
|
934
|
+
0: "red",
|
|
935
|
+
1: "yellow"
|
|
936
|
+
};
|
|
937
|
+
var unicode = isUnicodeSupported();
|
|
938
|
+
var s = (c, fallback) => unicode ? c : fallback;
|
|
939
|
+
var TYPE_ICONS = {
|
|
940
|
+
error: s("\u2716", "\xD7"),
|
|
941
|
+
fatal: s("\u2716", "\xD7"),
|
|
942
|
+
ready: s("\u2714", "\u221A"),
|
|
943
|
+
warn: s("\u26A0", "\u203C"),
|
|
944
|
+
info: s("\u2139", "i"),
|
|
945
|
+
success: s("\u2714", "\u221A"),
|
|
946
|
+
debug: s("\u2699", "D"),
|
|
947
|
+
trace: s("\u2192", "\u2192"),
|
|
948
|
+
fail: s("\u2716", "\xD7"),
|
|
949
|
+
start: s("\u25D0", "o"),
|
|
950
|
+
log: ""
|
|
951
|
+
};
|
|
952
|
+
function stringWidth(str) {
|
|
953
|
+
if (!Intl.Segmenter) {
|
|
954
|
+
return stripAnsi(str).length;
|
|
955
|
+
}
|
|
956
|
+
return stringWidth$1(str);
|
|
957
|
+
}
|
|
958
|
+
var FancyReporter = class extends BasicReporter {
|
|
959
|
+
formatStack(stack) {
|
|
960
|
+
return "\n" + parseStack(stack).map(
|
|
961
|
+
(line) => " " + line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_, m) => `(${colors.cyan(m)})`)
|
|
962
|
+
).join("\n");
|
|
963
|
+
}
|
|
964
|
+
formatType(logObj, isBadge, opts) {
|
|
965
|
+
const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
|
|
966
|
+
if (isBadge) {
|
|
967
|
+
return getBgColor(typeColor)(
|
|
968
|
+
colors.black(` ${logObj.type.toUpperCase()} `)
|
|
969
|
+
);
|
|
970
|
+
}
|
|
971
|
+
const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
|
|
972
|
+
return _type ? getColor2(typeColor)(_type) : "";
|
|
973
|
+
}
|
|
974
|
+
formatLogObj(logObj, opts) {
|
|
975
|
+
const [message, ...additional] = this.formatArgs(logObj.args, opts).split(
|
|
976
|
+
"\n"
|
|
977
|
+
);
|
|
978
|
+
if (logObj.type === "box") {
|
|
979
|
+
return box(
|
|
980
|
+
characterFormat(
|
|
981
|
+
message + (additional.length > 0 ? "\n" + additional.join("\n") : "")
|
|
982
|
+
),
|
|
983
|
+
{
|
|
984
|
+
title: logObj.title ? characterFormat(logObj.title) : void 0,
|
|
985
|
+
style: logObj.style
|
|
986
|
+
}
|
|
987
|
+
);
|
|
988
|
+
}
|
|
989
|
+
const date = this.formatDate(logObj.date, opts);
|
|
990
|
+
const coloredDate = date && colors.gray(date);
|
|
991
|
+
const isBadge = logObj.badge ?? logObj.level < 2;
|
|
992
|
+
const type = this.formatType(logObj, isBadge, opts);
|
|
993
|
+
const tag = logObj.tag ? colors.gray(logObj.tag) : "";
|
|
994
|
+
let line;
|
|
995
|
+
const left = this.filterAndJoin([type, characterFormat(message)]);
|
|
996
|
+
const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
|
|
997
|
+
const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
|
|
998
|
+
line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
|
|
999
|
+
line += characterFormat(
|
|
1000
|
+
additional.length > 0 ? "\n" + additional.join("\n") : ""
|
|
1001
|
+
);
|
|
1002
|
+
if (logObj.type === "trace") {
|
|
1003
|
+
const _err = new Error("Trace: " + logObj.message);
|
|
1004
|
+
line += this.formatStack(_err.stack || "");
|
|
1005
|
+
}
|
|
1006
|
+
return isBadge ? "\n" + line + "\n" : line;
|
|
1007
|
+
}
|
|
1008
|
+
};
|
|
1009
|
+
function characterFormat(str) {
|
|
1010
|
+
return str.replace(/`([^`]+)`/gm, (_, m) => colors.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_, m) => ` ${colors.underline(m)} `);
|
|
1011
|
+
}
|
|
1012
|
+
function getColor2(color = "white") {
|
|
1013
|
+
return colors[color] || colors.white;
|
|
1014
|
+
}
|
|
1015
|
+
function getBgColor(color = "bgWhite") {
|
|
1016
|
+
return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
|
|
1017
|
+
}
|
|
1018
|
+
function createConsola2(options = {}) {
|
|
1019
|
+
let level = _getDefaultLogLevel();
|
|
1020
|
+
if (process.env.CONSOLA_LEVEL) {
|
|
1021
|
+
level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
|
|
1022
|
+
}
|
|
1023
|
+
const consola2 = createConsola({
|
|
1024
|
+
level,
|
|
1025
|
+
defaults: { level },
|
|
1026
|
+
stdout: process.stdout,
|
|
1027
|
+
stderr: process.stderr,
|
|
1028
|
+
prompt: (...args) => import('./prompt-WQQUN22Z.js').then((m) => m.prompt(...args)),
|
|
1029
|
+
reporters: options.reporters || [
|
|
1030
|
+
options.fancy ?? !(isCI2 || isTest) ? new FancyReporter() : new BasicReporter()
|
|
1031
|
+
],
|
|
1032
|
+
...options
|
|
1033
|
+
});
|
|
1034
|
+
return consola2;
|
|
1035
|
+
}
|
|
1036
|
+
function _getDefaultLogLevel() {
|
|
1037
|
+
if (isDebug) {
|
|
1038
|
+
return LogLevels.debug;
|
|
1039
|
+
}
|
|
1040
|
+
if (isTest) {
|
|
1041
|
+
return LogLevels.warn;
|
|
1042
|
+
}
|
|
1043
|
+
return LogLevels.info;
|
|
1044
|
+
}
|
|
1045
|
+
createConsola2();
|
|
1046
|
+
|
|
1047
|
+
export { colors, createConsola2 as createConsola, getDefaultExportFromCjs, isUnicodeSupported };
|
|
1048
|
+
//# sourceMappingURL=chunk-HBQM723K.js.map
|
|
1049
|
+
//# sourceMappingURL=chunk-HBQM723K.js.map
|