rolldown 0.10.5 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/cli.cjs +631 -69
- package/dist/cjs/index.cjs +16 -15
- package/dist/cjs/parallel-plugin-worker.cjs +17 -19
- package/dist/cjs/parallel-plugin.cjs +2 -4
- package/dist/esm/cli.mjs +630 -66
- package/dist/esm/index.mjs +13 -10
- package/dist/esm/parallel-plugin-worker.mjs +16 -18
- package/dist/shared/{chunk-eib2uzZZ.cjs → chunk-IY9XHjk1.cjs} +11 -17
- package/dist/shared/consola_36c0034f-5LhwiLE2.mjs +897 -0
- package/dist/shared/consola_36c0034f-WXb1k8ME.cjs +902 -0
- package/dist/shared/prompt-qKiYiowG.mjs +807 -0
- package/dist/shared/prompt-v8IJTptZ.cjs +810 -0
- package/dist/shared/rolldown-Jq_CbZp4.cjs +49 -0
- package/dist/shared/rolldown-RjvHfXoR.mjs +48 -0
- package/dist/shared/utils_index-DAvBTBzR.mjs +1532 -0
- package/dist/shared/utils_index-PYoHCZRc.cjs +1507 -0
- package/dist/types/binding.d.ts +72 -2
- package/dist/types/cli/colors.d.ts +0 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/log/logger.d.ts +1 -1
- package/dist/types/options/output-options.d.ts +4 -4
- package/dist/types/plugin/bindingify-builtin-plugin.d.ts +5 -2
- package/dist/types/plugin/plugin-context.d.ts +5 -0
- package/dist/types/utils/initialize-parallel-plugins.d.ts +0 -1
- package/package.json +18 -18
- package/dist/shared/bindingify_plugin-gPrr_HPR.mjs +0 -1053
- package/dist/shared/bindingify_plugin-sRZqfDBJ.cjs +0 -1032
- package/dist/shared/rolldown-1SJPa4fg.cjs +0 -547
- package/dist/shared/rolldown-bgokD9pg.mjs +0 -544
|
@@ -0,0 +1,902 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { __toESM } = require("./chunk-IY9XHjk1.cjs");
|
|
4
|
+
const { sep } = __toESM(require("node:path"));
|
|
5
|
+
const { default: process$1 } = __toESM(require("node:process"));
|
|
6
|
+
const { formatWithOptions } = __toESM(require("node:util"));
|
|
7
|
+
const tty = __toESM(require("node:tty"));
|
|
8
|
+
|
|
9
|
+
//#region ../../node_modules/.pnpm/consola@3.2.3/node_modules/consola/dist/core.mjs
|
|
10
|
+
const LogLevels = {
|
|
11
|
+
silent: Number.NEGATIVE_INFINITY,
|
|
12
|
+
fatal: 0,
|
|
13
|
+
error: 0,
|
|
14
|
+
warn: 1,
|
|
15
|
+
log: 2,
|
|
16
|
+
info: 3,
|
|
17
|
+
success: 3,
|
|
18
|
+
fail: 3,
|
|
19
|
+
ready: 3,
|
|
20
|
+
start: 3,
|
|
21
|
+
box: 3,
|
|
22
|
+
debug: 4,
|
|
23
|
+
trace: 5,
|
|
24
|
+
verbose: Number.POSITIVE_INFINITY
|
|
25
|
+
};
|
|
26
|
+
const LogTypes = {
|
|
27
|
+
silent: {level: -1},
|
|
28
|
+
fatal: {level: LogLevels.fatal},
|
|
29
|
+
error: {level: LogLevels.error},
|
|
30
|
+
warn: {level: LogLevels.warn},
|
|
31
|
+
log: {level: LogLevels.log},
|
|
32
|
+
info: {level: LogLevels.info},
|
|
33
|
+
success: {level: LogLevels.success},
|
|
34
|
+
fail: {level: LogLevels.fail},
|
|
35
|
+
ready: {level: LogLevels.info},
|
|
36
|
+
start: {level: LogLevels.info},
|
|
37
|
+
box: {level: LogLevels.info},
|
|
38
|
+
debug: {level: LogLevels.debug},
|
|
39
|
+
trace: {level: LogLevels.trace},
|
|
40
|
+
verbose: {level: LogLevels.verbose}
|
|
41
|
+
};
|
|
42
|
+
function isObject(value) {
|
|
43
|
+
return value !== null && typeof value === 'object';
|
|
44
|
+
}
|
|
45
|
+
function _defu(baseObject, defaults, namespace = '.', merger) {
|
|
46
|
+
if (!isObject(defaults)) {
|
|
47
|
+
return _defu(baseObject, {}, namespace, merger);
|
|
48
|
+
}
|
|
49
|
+
const object = Object.assign({}, defaults);
|
|
50
|
+
for (const key in baseObject) {
|
|
51
|
+
if (key === '__proto__' || key === 'constructor') {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
const value = baseObject[key];
|
|
55
|
+
if (value === null || value === void 0) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
if (merger && merger(object, key, value, namespace)) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
62
|
+
object[key] = [...value, ...object[key]];
|
|
63
|
+
} else if (isObject(value) && isObject(object[key])) {
|
|
64
|
+
object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : '') + key.toString(), merger);
|
|
65
|
+
} else {
|
|
66
|
+
object[key] = value;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return object;
|
|
70
|
+
}
|
|
71
|
+
function createDefu(merger) {
|
|
72
|
+
return (...arguments_) => arguments_.reduce((p, c) => _defu(p, c, '', merger), {});
|
|
73
|
+
}
|
|
74
|
+
const defu = createDefu();
|
|
75
|
+
function isPlainObject(obj) {
|
|
76
|
+
return Object.prototype.toString.call(obj) === '[object Object]';
|
|
77
|
+
}
|
|
78
|
+
function isLogObj(arg) {
|
|
79
|
+
if (!isPlainObject(arg)) {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
if (!arg.message && !arg.args) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
if (arg.stack) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
let paused = false;
|
|
91
|
+
const queue = [];
|
|
92
|
+
class Consola {
|
|
93
|
+
constructor(options = {}) {
|
|
94
|
+
const types = options.types || LogTypes;
|
|
95
|
+
this.options = defu({
|
|
96
|
+
...options,
|
|
97
|
+
defaults: {...options.defaults},
|
|
98
|
+
level: _normalizeLogLevel(options.level, types),
|
|
99
|
+
reporters: [...options.reporters || []]
|
|
100
|
+
}, {
|
|
101
|
+
types: LogTypes,
|
|
102
|
+
throttle: 1e3,
|
|
103
|
+
throttleMin: 5,
|
|
104
|
+
formatOptions: {
|
|
105
|
+
date: true,
|
|
106
|
+
colors: false,
|
|
107
|
+
compact: true
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
for (const type in types) {
|
|
111
|
+
const defaults = {
|
|
112
|
+
type,
|
|
113
|
+
...this.options.defaults,
|
|
114
|
+
...types[type]
|
|
115
|
+
};
|
|
116
|
+
this[type] = this._wrapLogFn(defaults);
|
|
117
|
+
this[type].raw = this._wrapLogFn(defaults, true);
|
|
118
|
+
}
|
|
119
|
+
if (this.options.mockFn) {
|
|
120
|
+
this.mockTypes();
|
|
121
|
+
}
|
|
122
|
+
this._lastLog = {};
|
|
123
|
+
}
|
|
124
|
+
get level() {
|
|
125
|
+
return this.options.level;
|
|
126
|
+
}
|
|
127
|
+
set level(level) {
|
|
128
|
+
this.options.level = _normalizeLogLevel(level, this.options.types, this.options.level);
|
|
129
|
+
}
|
|
130
|
+
prompt(message, opts) {
|
|
131
|
+
if (!this.options.prompt) {
|
|
132
|
+
throw new Error('prompt is not supported!');
|
|
133
|
+
}
|
|
134
|
+
return this.options.prompt(message, opts);
|
|
135
|
+
}
|
|
136
|
+
create(options) {
|
|
137
|
+
const instance = new Consola({
|
|
138
|
+
...this.options,
|
|
139
|
+
...options
|
|
140
|
+
});
|
|
141
|
+
if (this._mockFn) {
|
|
142
|
+
instance.mockTypes(this._mockFn);
|
|
143
|
+
}
|
|
144
|
+
return instance;
|
|
145
|
+
}
|
|
146
|
+
withDefaults(defaults) {
|
|
147
|
+
return this.create({
|
|
148
|
+
...this.options,
|
|
149
|
+
defaults: {
|
|
150
|
+
...this.options.defaults,
|
|
151
|
+
...defaults
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
withTag(tag) {
|
|
156
|
+
return this.withDefaults({tag: this.options.defaults.tag ? this.options.defaults.tag + ':' + tag : tag});
|
|
157
|
+
}
|
|
158
|
+
addReporter(reporter) {
|
|
159
|
+
this.options.reporters.push(reporter);
|
|
160
|
+
return this;
|
|
161
|
+
}
|
|
162
|
+
removeReporter(reporter) {
|
|
163
|
+
if (reporter) {
|
|
164
|
+
const i = this.options.reporters.indexOf(reporter);
|
|
165
|
+
if (i >= 0) {
|
|
166
|
+
return this.options.reporters.splice(i, 1);
|
|
167
|
+
}
|
|
168
|
+
} else {
|
|
169
|
+
this.options.reporters.splice(0);
|
|
170
|
+
}
|
|
171
|
+
return this;
|
|
172
|
+
}
|
|
173
|
+
setReporters(reporters) {
|
|
174
|
+
this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
|
|
175
|
+
return this;
|
|
176
|
+
}
|
|
177
|
+
wrapAll() {
|
|
178
|
+
this.wrapConsole();
|
|
179
|
+
this.wrapStd();
|
|
180
|
+
}
|
|
181
|
+
restoreAll() {
|
|
182
|
+
this.restoreConsole();
|
|
183
|
+
this.restoreStd();
|
|
184
|
+
}
|
|
185
|
+
wrapConsole() {
|
|
186
|
+
for (const type in this.options.types) {
|
|
187
|
+
if (!console['__' + type]) {
|
|
188
|
+
console['__' + type] = console[type];
|
|
189
|
+
}
|
|
190
|
+
console[type] = this[type].raw;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
restoreConsole() {
|
|
194
|
+
for (const type in this.options.types) {
|
|
195
|
+
if (console['__' + type]) {
|
|
196
|
+
console[type] = console['__' + type];
|
|
197
|
+
delete console['__' + type];
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
wrapStd() {
|
|
202
|
+
this._wrapStream(this.options.stdout, 'log');
|
|
203
|
+
this._wrapStream(this.options.stderr, 'log');
|
|
204
|
+
}
|
|
205
|
+
_wrapStream(stream, type) {
|
|
206
|
+
if (!stream) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
if (!stream.__write) {
|
|
210
|
+
stream.__write = stream.write;
|
|
211
|
+
}
|
|
212
|
+
stream.write = (data) => {
|
|
213
|
+
this[type].raw(String(data).trim());
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
restoreStd() {
|
|
217
|
+
this._restoreStream(this.options.stdout);
|
|
218
|
+
this._restoreStream(this.options.stderr);
|
|
219
|
+
}
|
|
220
|
+
_restoreStream(stream) {
|
|
221
|
+
if (!stream) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
if (stream.__write) {
|
|
225
|
+
stream.write = stream.__write;
|
|
226
|
+
delete stream.__write;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
pauseLogs() {
|
|
230
|
+
paused = true;
|
|
231
|
+
}
|
|
232
|
+
resumeLogs() {
|
|
233
|
+
paused = false;
|
|
234
|
+
const _queue = queue.splice(0);
|
|
235
|
+
for (const item of _queue) {
|
|
236
|
+
item[0]._logFn(item[1], item[2]);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
mockTypes(mockFn) {
|
|
240
|
+
const _mockFn = mockFn || this.options.mockFn;
|
|
241
|
+
this._mockFn = _mockFn;
|
|
242
|
+
if (typeof _mockFn !== 'function') {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
for (const type in this.options.types) {
|
|
246
|
+
this[type] = _mockFn(type, this.options.types[type]) || this[type];
|
|
247
|
+
this[type].raw = this[type];
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
_wrapLogFn(defaults, isRaw) {
|
|
251
|
+
return (...args) => {
|
|
252
|
+
if (paused) {
|
|
253
|
+
queue.push([this, defaults, args, isRaw]);
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
return this._logFn(defaults, args, isRaw);
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
_logFn(defaults, args, isRaw) {
|
|
260
|
+
if ((defaults.level || 0) > this.level) {
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
const logObj = {
|
|
264
|
+
date: new Date(),
|
|
265
|
+
args: [],
|
|
266
|
+
...defaults,
|
|
267
|
+
level: _normalizeLogLevel(defaults.level, this.options.types)
|
|
268
|
+
};
|
|
269
|
+
if (!isRaw && args.length === 1 && isLogObj(args[0])) {
|
|
270
|
+
Object.assign(logObj, args[0]);
|
|
271
|
+
} else {
|
|
272
|
+
logObj.args = [...args];
|
|
273
|
+
}
|
|
274
|
+
if (logObj.message) {
|
|
275
|
+
logObj.args.unshift(logObj.message);
|
|
276
|
+
delete logObj.message;
|
|
277
|
+
}
|
|
278
|
+
if (logObj.additional) {
|
|
279
|
+
if (!Array.isArray(logObj.additional)) {
|
|
280
|
+
logObj.additional = logObj.additional.split('\n');
|
|
281
|
+
}
|
|
282
|
+
logObj.args.push('\n' + logObj.additional.join('\n'));
|
|
283
|
+
delete logObj.additional;
|
|
284
|
+
}
|
|
285
|
+
logObj.type = typeof logObj.type === 'string' ? logObj.type.toLowerCase() : 'log';
|
|
286
|
+
logObj.tag = typeof logObj.tag === 'string' ? logObj.tag : '';
|
|
287
|
+
const resolveLog = (newLog = false) => {
|
|
288
|
+
const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
|
|
289
|
+
if (this._lastLog.object && repeated > 0) {
|
|
290
|
+
const args2 = [...this._lastLog.object.args];
|
|
291
|
+
if (repeated > 1) {
|
|
292
|
+
args2.push(`(repeated ${repeated} times)`);
|
|
293
|
+
}
|
|
294
|
+
this._log({
|
|
295
|
+
...this._lastLog.object,
|
|
296
|
+
args: args2
|
|
297
|
+
});
|
|
298
|
+
this._lastLog.count = 1;
|
|
299
|
+
}
|
|
300
|
+
if (newLog) {
|
|
301
|
+
this._lastLog.object = logObj;
|
|
302
|
+
this._log(logObj);
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
clearTimeout(this._lastLog.timeout);
|
|
306
|
+
const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
|
|
307
|
+
this._lastLog.time = logObj.date;
|
|
308
|
+
if (diffTime < this.options.throttle) {
|
|
309
|
+
try {
|
|
310
|
+
const serializedLog = JSON.stringify([logObj.type, logObj.tag, logObj.args]);
|
|
311
|
+
const isSameLog = this._lastLog.serialized === serializedLog;
|
|
312
|
+
this._lastLog.serialized = serializedLog;
|
|
313
|
+
if (isSameLog) {
|
|
314
|
+
this._lastLog.count = (this._lastLog.count || 0) + 1;
|
|
315
|
+
if (this._lastLog.count > this.options.throttleMin) {
|
|
316
|
+
this._lastLog.timeout = setTimeout(resolveLog, this.options.throttle);
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
} catch {}
|
|
321
|
+
}
|
|
322
|
+
resolveLog(true);
|
|
323
|
+
}
|
|
324
|
+
_log(logObj) {
|
|
325
|
+
for (const reporter of this.options.reporters) {
|
|
326
|
+
reporter.log(logObj, {options: this.options});
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
|
|
331
|
+
if (input === void 0) {
|
|
332
|
+
return defaultLevel;
|
|
333
|
+
}
|
|
334
|
+
if (typeof input === 'number') {
|
|
335
|
+
return input;
|
|
336
|
+
}
|
|
337
|
+
if (types[input] && types[input].level !== void 0) {
|
|
338
|
+
return types[input].level;
|
|
339
|
+
}
|
|
340
|
+
return defaultLevel;
|
|
341
|
+
}
|
|
342
|
+
Consola.prototype.add = Consola.prototype.addReporter;
|
|
343
|
+
Consola.prototype.remove = Consola.prototype.removeReporter;
|
|
344
|
+
Consola.prototype.clear = Consola.prototype.removeReporter;
|
|
345
|
+
Consola.prototype.withScope = Consola.prototype.withTag;
|
|
346
|
+
Consola.prototype.mock = Consola.prototype.mockTypes;
|
|
347
|
+
Consola.prototype.pause = Consola.prototype.pauseLogs;
|
|
348
|
+
Consola.prototype.resume = Consola.prototype.resumeLogs;
|
|
349
|
+
function createConsola$1(options = {}) {
|
|
350
|
+
return new Consola(options);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
//#endregion
|
|
354
|
+
//#region ../../node_modules/.pnpm/consola@3.2.3/node_modules/consola/dist/shared/consola.06ad8a64.mjs
|
|
355
|
+
function parseStack(stack) {
|
|
356
|
+
const cwd = process.cwd() + sep;
|
|
357
|
+
const lines = stack.split('\n').splice(1).map((l) => l.trim().replace('file://', '').replace(cwd, ''));
|
|
358
|
+
return lines;
|
|
359
|
+
}
|
|
360
|
+
function writeStream(data, stream) {
|
|
361
|
+
const write = stream.__write || stream.write;
|
|
362
|
+
return write.call(stream, data);
|
|
363
|
+
}
|
|
364
|
+
const bracket = (x) => x ? `[${x}]` : '';
|
|
365
|
+
class BasicReporter {
|
|
366
|
+
formatStack(stack, opts) {
|
|
367
|
+
return ' ' + parseStack(stack).join('\n ');
|
|
368
|
+
}
|
|
369
|
+
formatArgs(args, opts) {
|
|
370
|
+
const _args = args.map((arg) => {
|
|
371
|
+
if (arg && typeof arg.stack === 'string') {
|
|
372
|
+
return arg.message + '\n' + this.formatStack(arg.stack, opts);
|
|
373
|
+
}
|
|
374
|
+
return arg;
|
|
375
|
+
});
|
|
376
|
+
return formatWithOptions(opts, ..._args);
|
|
377
|
+
}
|
|
378
|
+
formatDate(date, opts) {
|
|
379
|
+
return opts.date ? date.toLocaleTimeString() : '';
|
|
380
|
+
}
|
|
381
|
+
filterAndJoin(arr) {
|
|
382
|
+
return arr.filter(Boolean).join(' ');
|
|
383
|
+
}
|
|
384
|
+
formatLogObj(logObj, opts) {
|
|
385
|
+
const message = this.formatArgs(logObj.args, opts);
|
|
386
|
+
if (logObj.type === 'box') {
|
|
387
|
+
return '\n' + [bracket(logObj.tag), logObj.title && logObj.title, ...message.split('\n')].filter(Boolean).map((l) => ' > ' + l).join('\n') + '\n';
|
|
388
|
+
}
|
|
389
|
+
return this.filterAndJoin([bracket(logObj.type), bracket(logObj.tag), message]);
|
|
390
|
+
}
|
|
391
|
+
log(logObj, ctx) {
|
|
392
|
+
const line = this.formatLogObj(logObj, {
|
|
393
|
+
columns: ctx.options.stdout.columns || 0,
|
|
394
|
+
...ctx.options.formatOptions
|
|
395
|
+
});
|
|
396
|
+
return writeStream(line + '\n', logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
//#endregion
|
|
401
|
+
//#region ../../node_modules/.pnpm/consola@3.2.3/node_modules/consola/dist/utils.mjs
|
|
402
|
+
const { env = {}, argv = [], platform = '' } = typeof process === 'undefined' ? {} : process;
|
|
403
|
+
const isDisabled = 'NO_COLOR'in env || argv.includes('--no-color');
|
|
404
|
+
const isForced = 'FORCE_COLOR'in env || argv.includes('--color');
|
|
405
|
+
const isWindows = platform === 'win32';
|
|
406
|
+
const isDumbTerminal = env.TERM === 'dumb';
|
|
407
|
+
const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
|
|
408
|
+
const isCI$1 = 'CI'in env && ('GITHUB_ACTIONS'in env || 'GITLAB_CI'in env || 'CIRCLECI'in env);
|
|
409
|
+
const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI$1);
|
|
410
|
+
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)) {
|
|
411
|
+
return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
412
|
+
}
|
|
413
|
+
function clearBleed(index, string, open, close, replace) {
|
|
414
|
+
return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
415
|
+
}
|
|
416
|
+
function filterEmpty(open, close, replace = open, at = open.length + 1) {
|
|
417
|
+
return (string) => string || !(string === '' || string === void 0) ? clearBleed(('' + string).indexOf(close, at), string, open, close, replace) : '';
|
|
418
|
+
}
|
|
419
|
+
function init(open, close, replace) {
|
|
420
|
+
return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
|
|
421
|
+
}
|
|
422
|
+
const colorDefs = {
|
|
423
|
+
reset: init(0, 0),
|
|
424
|
+
bold: init(1, 22, '\x1B[22m\x1B[1m'),
|
|
425
|
+
dim: init(2, 22, '\x1B[22m\x1B[2m'),
|
|
426
|
+
italic: init(3, 23),
|
|
427
|
+
underline: init(4, 24),
|
|
428
|
+
inverse: init(7, 27),
|
|
429
|
+
hidden: init(8, 28),
|
|
430
|
+
strikethrough: init(9, 29),
|
|
431
|
+
black: init(30, 39),
|
|
432
|
+
red: init(31, 39),
|
|
433
|
+
green: init(32, 39),
|
|
434
|
+
yellow: init(33, 39),
|
|
435
|
+
blue: init(34, 39),
|
|
436
|
+
magenta: init(35, 39),
|
|
437
|
+
cyan: init(36, 39),
|
|
438
|
+
white: init(37, 39),
|
|
439
|
+
gray: init(90, 39),
|
|
440
|
+
bgBlack: init(40, 49),
|
|
441
|
+
bgRed: init(41, 49),
|
|
442
|
+
bgGreen: init(42, 49),
|
|
443
|
+
bgYellow: init(43, 49),
|
|
444
|
+
bgBlue: init(44, 49),
|
|
445
|
+
bgMagenta: init(45, 49),
|
|
446
|
+
bgCyan: init(46, 49),
|
|
447
|
+
bgWhite: init(47, 49),
|
|
448
|
+
blackBright: init(90, 39),
|
|
449
|
+
redBright: init(91, 39),
|
|
450
|
+
greenBright: init(92, 39),
|
|
451
|
+
yellowBright: init(93, 39),
|
|
452
|
+
blueBright: init(94, 39),
|
|
453
|
+
magentaBright: init(95, 39),
|
|
454
|
+
cyanBright: init(96, 39),
|
|
455
|
+
whiteBright: init(97, 39),
|
|
456
|
+
bgBlackBright: init(100, 49),
|
|
457
|
+
bgRedBright: init(101, 49),
|
|
458
|
+
bgGreenBright: init(102, 49),
|
|
459
|
+
bgYellowBright: init(103, 49),
|
|
460
|
+
bgBlueBright: init(104, 49),
|
|
461
|
+
bgMagentaBright: init(105, 49),
|
|
462
|
+
bgCyanBright: init(106, 49),
|
|
463
|
+
bgWhiteBright: init(107, 49)
|
|
464
|
+
};
|
|
465
|
+
function createColors(useColor = isColorSupported) {
|
|
466
|
+
return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
|
|
467
|
+
}
|
|
468
|
+
const colors = createColors();
|
|
469
|
+
function getColor$1(color, fallback = 'reset') {
|
|
470
|
+
return colors[color] || colors[fallback];
|
|
471
|
+
}
|
|
472
|
+
const ansiRegex$1 = ['[\\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('|');
|
|
473
|
+
function stripAnsi$1(text) {
|
|
474
|
+
return text.replace(new RegExp(ansiRegex$1, 'g'), '');
|
|
475
|
+
}
|
|
476
|
+
const boxStylePresets = {
|
|
477
|
+
solid: {
|
|
478
|
+
tl: '┌',
|
|
479
|
+
tr: '┐',
|
|
480
|
+
bl: '└',
|
|
481
|
+
br: '┘',
|
|
482
|
+
h: '─',
|
|
483
|
+
v: '│'
|
|
484
|
+
},
|
|
485
|
+
double: {
|
|
486
|
+
tl: '╔',
|
|
487
|
+
tr: '╗',
|
|
488
|
+
bl: '╚',
|
|
489
|
+
br: '╝',
|
|
490
|
+
h: '═',
|
|
491
|
+
v: '║'
|
|
492
|
+
},
|
|
493
|
+
doubleSingle: {
|
|
494
|
+
tl: '╓',
|
|
495
|
+
tr: '╖',
|
|
496
|
+
bl: '╙',
|
|
497
|
+
br: '╜',
|
|
498
|
+
h: '─',
|
|
499
|
+
v: '║'
|
|
500
|
+
},
|
|
501
|
+
doubleSingleRounded: {
|
|
502
|
+
tl: '╭',
|
|
503
|
+
tr: '╮',
|
|
504
|
+
bl: '╰',
|
|
505
|
+
br: '╯',
|
|
506
|
+
h: '─',
|
|
507
|
+
v: '║'
|
|
508
|
+
},
|
|
509
|
+
singleThick: {
|
|
510
|
+
tl: '┏',
|
|
511
|
+
tr: '┓',
|
|
512
|
+
bl: '┗',
|
|
513
|
+
br: '┛',
|
|
514
|
+
h: '━',
|
|
515
|
+
v: '┃'
|
|
516
|
+
},
|
|
517
|
+
singleDouble: {
|
|
518
|
+
tl: '╒',
|
|
519
|
+
tr: '╕',
|
|
520
|
+
bl: '╘',
|
|
521
|
+
br: '╛',
|
|
522
|
+
h: '═',
|
|
523
|
+
v: '│'
|
|
524
|
+
},
|
|
525
|
+
singleDoubleRounded: {
|
|
526
|
+
tl: '╭',
|
|
527
|
+
tr: '╮',
|
|
528
|
+
bl: '╰',
|
|
529
|
+
br: '╯',
|
|
530
|
+
h: '═',
|
|
531
|
+
v: '│'
|
|
532
|
+
},
|
|
533
|
+
rounded: {
|
|
534
|
+
tl: '╭',
|
|
535
|
+
tr: '╮',
|
|
536
|
+
bl: '╰',
|
|
537
|
+
br: '╯',
|
|
538
|
+
h: '─',
|
|
539
|
+
v: '│'
|
|
540
|
+
}
|
|
541
|
+
};
|
|
542
|
+
const defaultStyle = {
|
|
543
|
+
borderColor: 'white',
|
|
544
|
+
borderStyle: 'rounded',
|
|
545
|
+
valign: 'center',
|
|
546
|
+
padding: 2,
|
|
547
|
+
marginLeft: 1,
|
|
548
|
+
marginTop: 1,
|
|
549
|
+
marginBottom: 1
|
|
550
|
+
};
|
|
551
|
+
function box(text, _opts = {}) {
|
|
552
|
+
const opts = {
|
|
553
|
+
..._opts,
|
|
554
|
+
style: {
|
|
555
|
+
...defaultStyle,
|
|
556
|
+
..._opts.style
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
const textLines = text.split('\n');
|
|
560
|
+
const boxLines = [];
|
|
561
|
+
const _color = getColor$1(opts.style.borderColor);
|
|
562
|
+
const borderStyle = {...typeof opts.style.borderStyle === 'string' ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle};
|
|
563
|
+
if (_color) {
|
|
564
|
+
for (const key in borderStyle) {
|
|
565
|
+
borderStyle[key] = _color(borderStyle[key]);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
|
|
569
|
+
const height = textLines.length + paddingOffset;
|
|
570
|
+
const width = Math.max(...textLines.map((line) => line.length)) + paddingOffset;
|
|
571
|
+
const widthOffset = width + paddingOffset;
|
|
572
|
+
const leftSpace = opts.style.marginLeft > 0 ? ' '.repeat(opts.style.marginLeft) : '';
|
|
573
|
+
if (opts.style.marginTop > 0) {
|
|
574
|
+
boxLines.push(''.repeat(opts.style.marginTop));
|
|
575
|
+
}
|
|
576
|
+
if (opts.title) {
|
|
577
|
+
const left = borderStyle.h.repeat(Math.floor((width - stripAnsi$1(opts.title).length) / 2));
|
|
578
|
+
const right = borderStyle.h.repeat(width - stripAnsi$1(opts.title).length - stripAnsi$1(left).length + paddingOffset);
|
|
579
|
+
boxLines.push(`${leftSpace}${borderStyle.tl}${left}${opts.title}${right}${borderStyle.tr}`);
|
|
580
|
+
} else {
|
|
581
|
+
boxLines.push(`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`);
|
|
582
|
+
}
|
|
583
|
+
const valignOffset = opts.style.valign === 'center' ? Math.floor((height - textLines.length) / 2) : opts.style.valign === 'top' ? height - textLines.length - paddingOffset : height - textLines.length;
|
|
584
|
+
for (let i = 0; i < height; i++) {
|
|
585
|
+
if (i < valignOffset || i >= valignOffset + textLines.length) {
|
|
586
|
+
boxLines.push(`${leftSpace}${borderStyle.v}${' '.repeat(widthOffset)}${borderStyle.v}`);
|
|
587
|
+
} else {
|
|
588
|
+
const line = textLines[i - valignOffset];
|
|
589
|
+
const left = ' '.repeat(paddingOffset);
|
|
590
|
+
const right = ' '.repeat(width - stripAnsi$1(line).length);
|
|
591
|
+
boxLines.push(`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
boxLines.push(`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`);
|
|
595
|
+
if (opts.style.marginBottom > 0) {
|
|
596
|
+
boxLines.push(''.repeat(opts.style.marginBottom));
|
|
597
|
+
}
|
|
598
|
+
return boxLines.join('\n');
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
//#endregion
|
|
602
|
+
//#region ../../node_modules/.pnpm/consola@3.2.3/node_modules/consola/dist/shared/consola.36c0034f.mjs
|
|
603
|
+
const providers = [['APPVEYOR'], ['AZURE_PIPELINES', 'SYSTEM_TEAMFOUNDATIONCOLLECTIONURI'], ['AZURE_STATIC', 'INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN'], ['APPCIRCLE', 'AC_APPCIRCLE'], ['BAMBOO', 'bamboo_planKey'], ['BITBUCKET', 'BITBUCKET_COMMIT'], ['BITRISE', 'BITRISE_IO'], ['BUDDY', 'BUDDY_WORKSPACE_ID'], ['BUILDKITE'], ['CIRCLE', 'CIRCLECI'], ['CIRRUS', 'CIRRUS_CI'], ['CLOUDFLARE_PAGES', 'CF_PAGES', {ci: true}], ['CODEBUILD', 'CODEBUILD_BUILD_ARN'], ['CODEFRESH', 'CF_BUILD_ID'], ['DRONE'], ['DRONE', 'DRONE_BUILD_EVENT'], ['DSARI'], ['GITHUB_ACTIONS'], ['GITLAB', 'GITLAB_CI'], ['GITLAB', 'CI_MERGE_REQUEST_ID'], ['GOCD', 'GO_PIPELINE_LABEL'], ['LAYERCI'], ['HUDSON', 'HUDSON_URL'], ['JENKINS', 'JENKINS_URL'], ['MAGNUM'], ['NETLIFY'], ['NETLIFY', 'NETLIFY_LOCAL', {ci: false}], ['NEVERCODE'], ['RENDER'], ['SAIL', 'SAILCI'], ['SEMAPHORE'], ['SCREWDRIVER'], ['SHIPPABLE'], ['SOLANO', 'TDDIUM'], ['STRIDER'], ['TEAMCITY', 'TEAMCITY_VERSION'], ['TRAVIS'], ['VERCEL', 'NOW_BUILDER'], ['APPCENTER', 'APPCENTER_BUILD_ID'], ['CODESANDBOX', 'CODESANDBOX_SSE', {ci: false}], ['STACKBLITZ'], ['STORMKIT'], ['CLEAVR']];
|
|
604
|
+
function detectProvider(env$1) {
|
|
605
|
+
for (const provider of providers) {
|
|
606
|
+
const envName = provider[1] || provider[0];
|
|
607
|
+
if (env$1[envName]) {
|
|
608
|
+
return {
|
|
609
|
+
name: provider[0].toLowerCase(),
|
|
610
|
+
...provider[2]
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
if (env$1.SHELL && env$1.SHELL === '/bin/jsh') {
|
|
615
|
+
return {
|
|
616
|
+
name: 'stackblitz',
|
|
617
|
+
ci: false
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
return {
|
|
621
|
+
name: '',
|
|
622
|
+
ci: false
|
|
623
|
+
};
|
|
624
|
+
}
|
|
625
|
+
const processShim = typeof process !== 'undefined' ? process : {};
|
|
626
|
+
const envShim = processShim.env || {};
|
|
627
|
+
const providerInfo = detectProvider(envShim);
|
|
628
|
+
const nodeENV = typeof process !== 'undefined' && process.env && process.env.NODE_ENV || '';
|
|
629
|
+
processShim.platform;
|
|
630
|
+
providerInfo.name;
|
|
631
|
+
const isCI = toBoolean(envShim.CI) || providerInfo.ci !== false;
|
|
632
|
+
const hasTTY = toBoolean(processShim.stdout && processShim.stdout.isTTY);
|
|
633
|
+
const isDebug = toBoolean(envShim.DEBUG);
|
|
634
|
+
const isTest = nodeENV === 'test' || toBoolean(envShim.TEST);
|
|
635
|
+
toBoolean(envShim.MINIMAL) || isCI || isTest || !hasTTY;
|
|
636
|
+
function toBoolean(val) {
|
|
637
|
+
return val ? val !== 'false' : false;
|
|
638
|
+
}
|
|
639
|
+
function ansiRegex({ onlyFirst = false } = {}) {
|
|
640
|
+
const pattern = ['[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)', '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))'].join('|');
|
|
641
|
+
return new RegExp(pattern, onlyFirst ? undefined : 'g');
|
|
642
|
+
}
|
|
643
|
+
const regex = ansiRegex();
|
|
644
|
+
function stripAnsi(string) {
|
|
645
|
+
if (typeof string !== 'string') {
|
|
646
|
+
throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
647
|
+
}
|
|
648
|
+
return string.replace(regex, '');
|
|
649
|
+
}
|
|
650
|
+
function getDefaultExportFromCjs(x) {
|
|
651
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
652
|
+
}
|
|
653
|
+
var eastasianwidth = {exports: {}};
|
|
654
|
+
(function(module) {
|
|
655
|
+
var eaw = {};
|
|
656
|
+
{
|
|
657
|
+
module.exports = eaw;
|
|
658
|
+
}
|
|
659
|
+
eaw.eastAsianWidth = function(character) {
|
|
660
|
+
var x = character.charCodeAt(0);
|
|
661
|
+
var y = character.length == 2 ? character.charCodeAt(1) : 0;
|
|
662
|
+
var codePoint = x;
|
|
663
|
+
if (0xD800 <= x && x <= 0xDBFF && 0xDC00 <= y && y <= 0xDFFF) {
|
|
664
|
+
x &= 0x3FF;
|
|
665
|
+
y &= 0x3FF;
|
|
666
|
+
codePoint = x << 10 | y;
|
|
667
|
+
codePoint += 0x10000;
|
|
668
|
+
}
|
|
669
|
+
if (0x3000 == codePoint || 0xFF01 <= codePoint && codePoint <= 0xFF60 || 0xFFE0 <= codePoint && codePoint <= 0xFFE6) {
|
|
670
|
+
return 'F';
|
|
671
|
+
}
|
|
672
|
+
if (0x20A9 == codePoint || 0xFF61 <= codePoint && codePoint <= 0xFFBE || 0xFFC2 <= codePoint && codePoint <= 0xFFC7 || 0xFFCA <= codePoint && codePoint <= 0xFFCF || 0xFFD2 <= codePoint && codePoint <= 0xFFD7 || 0xFFDA <= codePoint && codePoint <= 0xFFDC || 0xFFE8 <= codePoint && codePoint <= 0xFFEE) {
|
|
673
|
+
return 'H';
|
|
674
|
+
}
|
|
675
|
+
if (0x1100 <= codePoint && codePoint <= 0x115F || 0x11A3 <= codePoint && codePoint <= 0x11A7 || 0x11FA <= codePoint && codePoint <= 0x11FF || 0x2329 <= codePoint && codePoint <= 0x232A || 0x2E80 <= codePoint && codePoint <= 0x2E99 || 0x2E9B <= codePoint && codePoint <= 0x2EF3 || 0x2F00 <= codePoint && codePoint <= 0x2FD5 || 0x2FF0 <= codePoint && codePoint <= 0x2FFB || 0x3001 <= codePoint && codePoint <= 0x303E || 0x3041 <= codePoint && codePoint <= 0x3096 || 0x3099 <= codePoint && codePoint <= 0x30FF || 0x3105 <= codePoint && codePoint <= 0x312D || 0x3131 <= codePoint && codePoint <= 0x318E || 0x3190 <= codePoint && codePoint <= 0x31BA || 0x31C0 <= codePoint && codePoint <= 0x31E3 || 0x31F0 <= codePoint && codePoint <= 0x321E || 0x3220 <= codePoint && codePoint <= 0x3247 || 0x3250 <= codePoint && codePoint <= 0x32FE || 0x3300 <= codePoint && codePoint <= 0x4DBF || 0x4E00 <= codePoint && codePoint <= 0xA48C || 0xA490 <= codePoint && codePoint <= 0xA4C6 || 0xA960 <= codePoint && codePoint <= 0xA97C || 0xAC00 <= codePoint && codePoint <= 0xD7A3 || 0xD7B0 <= codePoint && codePoint <= 0xD7C6 || 0xD7CB <= codePoint && codePoint <= 0xD7FB || 0xF900 <= codePoint && codePoint <= 0xFAFF || 0xFE10 <= codePoint && codePoint <= 0xFE19 || 0xFE30 <= codePoint && codePoint <= 0xFE52 || 0xFE54 <= codePoint && codePoint <= 0xFE66 || 0xFE68 <= codePoint && codePoint <= 0xFE6B || 0x1B000 <= codePoint && codePoint <= 0x1B001 || 0x1F200 <= codePoint && codePoint <= 0x1F202 || 0x1F210 <= codePoint && codePoint <= 0x1F23A || 0x1F240 <= codePoint && codePoint <= 0x1F248 || 0x1F250 <= codePoint && codePoint <= 0x1F251 || 0x20000 <= codePoint && codePoint <= 0x2F73F || 0x2B740 <= codePoint && codePoint <= 0x2FFFD || 0x30000 <= codePoint && codePoint <= 0x3FFFD) {
|
|
676
|
+
return 'W';
|
|
677
|
+
}
|
|
678
|
+
if (0x0020 <= codePoint && codePoint <= 0x007E || 0x00A2 <= codePoint && codePoint <= 0x00A3 || 0x00A5 <= codePoint && codePoint <= 0x00A6 || 0x00AC == codePoint || 0x00AF == codePoint || 0x27E6 <= codePoint && codePoint <= 0x27ED || 0x2985 <= codePoint && codePoint <= 0x2986) {
|
|
679
|
+
return 'Na';
|
|
680
|
+
}
|
|
681
|
+
if (0x00A1 == codePoint || 0x00A4 == codePoint || 0x00A7 <= codePoint && codePoint <= 0x00A8 || 0x00AA == codePoint || 0x00AD <= codePoint && codePoint <= 0x00AE || 0x00B0 <= codePoint && codePoint <= 0x00B4 || 0x00B6 <= codePoint && codePoint <= 0x00BA || 0x00BC <= codePoint && codePoint <= 0x00BF || 0x00C6 == codePoint || 0x00D0 == codePoint || 0x00D7 <= codePoint && codePoint <= 0x00D8 || 0x00DE <= codePoint && codePoint <= 0x00E1 || 0x00E6 == codePoint || 0x00E8 <= codePoint && codePoint <= 0x00EA || 0x00EC <= codePoint && codePoint <= 0x00ED || 0x00F0 == codePoint || 0x00F2 <= codePoint && codePoint <= 0x00F3 || 0x00F7 <= codePoint && codePoint <= 0x00FA || 0x00FC == codePoint || 0x00FE == codePoint || 0x0101 == codePoint || 0x0111 == codePoint || 0x0113 == codePoint || 0x011B == codePoint || 0x0126 <= codePoint && codePoint <= 0x0127 || 0x012B == codePoint || 0x0131 <= codePoint && codePoint <= 0x0133 || 0x0138 == codePoint || 0x013F <= codePoint && codePoint <= 0x0142 || 0x0144 == codePoint || 0x0148 <= codePoint && codePoint <= 0x014B || 0x014D == codePoint || 0x0152 <= codePoint && codePoint <= 0x0153 || 0x0166 <= codePoint && codePoint <= 0x0167 || 0x016B == codePoint || 0x01CE == codePoint || 0x01D0 == codePoint || 0x01D2 == codePoint || 0x01D4 == codePoint || 0x01D6 == codePoint || 0x01D8 == codePoint || 0x01DA == codePoint || 0x01DC == codePoint || 0x0251 == codePoint || 0x0261 == codePoint || 0x02C4 == codePoint || 0x02C7 == codePoint || 0x02C9 <= codePoint && codePoint <= 0x02CB || 0x02CD == codePoint || 0x02D0 == codePoint || 0x02D8 <= codePoint && codePoint <= 0x02DB || 0x02DD == codePoint || 0x02DF == codePoint || 0x0300 <= codePoint && codePoint <= 0x036F || 0x0391 <= codePoint && codePoint <= 0x03A1 || 0x03A3 <= codePoint && codePoint <= 0x03A9 || 0x03B1 <= codePoint && codePoint <= 0x03C1 || 0x03C3 <= codePoint && codePoint <= 0x03C9 || 0x0401 == codePoint || 0x0410 <= codePoint && codePoint <= 0x044F || 0x0451 == codePoint || 0x2010 == codePoint || 0x2013 <= codePoint && codePoint <= 0x2016 || 0x2018 <= codePoint && codePoint <= 0x2019 || 0x201C <= codePoint && codePoint <= 0x201D || 0x2020 <= codePoint && codePoint <= 0x2022 || 0x2024 <= codePoint && codePoint <= 0x2027 || 0x2030 == codePoint || 0x2032 <= codePoint && codePoint <= 0x2033 || 0x2035 == codePoint || 0x203B == codePoint || 0x203E == codePoint || 0x2074 == codePoint || 0x207F == codePoint || 0x2081 <= codePoint && codePoint <= 0x2084 || 0x20AC == codePoint || 0x2103 == codePoint || 0x2105 == codePoint || 0x2109 == codePoint || 0x2113 == codePoint || 0x2116 == codePoint || 0x2121 <= codePoint && codePoint <= 0x2122 || 0x2126 == codePoint || 0x212B == codePoint || 0x2153 <= codePoint && codePoint <= 0x2154 || 0x215B <= codePoint && codePoint <= 0x215E || 0x2160 <= codePoint && codePoint <= 0x216B || 0x2170 <= codePoint && codePoint <= 0x2179 || 0x2189 == codePoint || 0x2190 <= codePoint && codePoint <= 0x2199 || 0x21B8 <= codePoint && codePoint <= 0x21B9 || 0x21D2 == codePoint || 0x21D4 == codePoint || 0x21E7 == codePoint || 0x2200 == codePoint || 0x2202 <= codePoint && codePoint <= 0x2203 || 0x2207 <= codePoint && codePoint <= 0x2208 || 0x220B == codePoint || 0x220F == codePoint || 0x2211 == codePoint || 0x2215 == codePoint || 0x221A == codePoint || 0x221D <= codePoint && codePoint <= 0x2220 || 0x2223 == codePoint || 0x2225 == codePoint || 0x2227 <= codePoint && codePoint <= 0x222C || 0x222E == codePoint || 0x2234 <= codePoint && codePoint <= 0x2237 || 0x223C <= codePoint && codePoint <= 0x223D || 0x2248 == codePoint || 0x224C == codePoint || 0x2252 == codePoint || 0x2260 <= codePoint && codePoint <= 0x2261 || 0x2264 <= codePoint && codePoint <= 0x2267 || 0x226A <= codePoint && codePoint <= 0x226B || 0x226E <= codePoint && codePoint <= 0x226F || 0x2282 <= codePoint && codePoint <= 0x2283 || 0x2286 <= codePoint && codePoint <= 0x2287 || 0x2295 == codePoint || 0x2299 == codePoint || 0x22A5 == codePoint || 0x22BF == codePoint || 0x2312 == codePoint || 0x2460 <= codePoint && codePoint <= 0x24E9 || 0x24EB <= codePoint && codePoint <= 0x254B || 0x2550 <= codePoint && codePoint <= 0x2573 || 0x2580 <= codePoint && codePoint <= 0x258F || 0x2592 <= codePoint && codePoint <= 0x2595 || 0x25A0 <= codePoint && codePoint <= 0x25A1 || 0x25A3 <= codePoint && codePoint <= 0x25A9 || 0x25B2 <= codePoint && codePoint <= 0x25B3 || 0x25B6 <= codePoint && codePoint <= 0x25B7 || 0x25BC <= codePoint && codePoint <= 0x25BD || 0x25C0 <= codePoint && codePoint <= 0x25C1 || 0x25C6 <= codePoint && codePoint <= 0x25C8 || 0x25CB == codePoint || 0x25CE <= codePoint && codePoint <= 0x25D1 || 0x25E2 <= codePoint && codePoint <= 0x25E5 || 0x25EF == codePoint || 0x2605 <= codePoint && codePoint <= 0x2606 || 0x2609 == codePoint || 0x260E <= codePoint && codePoint <= 0x260F || 0x2614 <= codePoint && codePoint <= 0x2615 || 0x261C == codePoint || 0x261E == codePoint || 0x2640 == codePoint || 0x2642 == codePoint || 0x2660 <= codePoint && codePoint <= 0x2661 || 0x2663 <= codePoint && codePoint <= 0x2665 || 0x2667 <= codePoint && codePoint <= 0x266A || 0x266C <= codePoint && codePoint <= 0x266D || 0x266F == codePoint || 0x269E <= codePoint && codePoint <= 0x269F || 0x26BE <= codePoint && codePoint <= 0x26BF || 0x26C4 <= codePoint && codePoint <= 0x26CD || 0x26CF <= codePoint && codePoint <= 0x26E1 || 0x26E3 == codePoint || 0x26E8 <= codePoint && codePoint <= 0x26FF || 0x273D == codePoint || 0x2757 == codePoint || 0x2776 <= codePoint && codePoint <= 0x277F || 0x2B55 <= codePoint && codePoint <= 0x2B59 || 0x3248 <= codePoint && codePoint <= 0x324F || 0xE000 <= codePoint && codePoint <= 0xF8FF || 0xFE00 <= codePoint && codePoint <= 0xFE0F || 0xFFFD == codePoint || 0x1F100 <= codePoint && codePoint <= 0x1F10A || 0x1F110 <= codePoint && codePoint <= 0x1F12D || 0x1F130 <= codePoint && codePoint <= 0x1F169 || 0x1F170 <= codePoint && codePoint <= 0x1F19A || 0xE0100 <= codePoint && codePoint <= 0xE01EF || 0xF0000 <= codePoint && codePoint <= 0xFFFFD || 0x100000 <= codePoint && codePoint <= 0x10FFFD) {
|
|
682
|
+
return 'A';
|
|
683
|
+
}
|
|
684
|
+
return 'N';
|
|
685
|
+
};
|
|
686
|
+
eaw.characterLength = function(character) {
|
|
687
|
+
var code = this.eastAsianWidth(character);
|
|
688
|
+
if (code == 'F' || code == 'W' || code == 'A') {
|
|
689
|
+
return 2;
|
|
690
|
+
} else {
|
|
691
|
+
return 1;
|
|
692
|
+
}
|
|
693
|
+
};
|
|
694
|
+
function stringToArray(string) {
|
|
695
|
+
return string.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[^\uD800-\uDFFF]/g) || [];
|
|
696
|
+
}
|
|
697
|
+
eaw.length = function(string) {
|
|
698
|
+
var characters = stringToArray(string);
|
|
699
|
+
var len = 0;
|
|
700
|
+
for (var i = 0; i < characters.length; i++) {
|
|
701
|
+
len = len + this.characterLength(characters[i]);
|
|
702
|
+
}
|
|
703
|
+
return len;
|
|
704
|
+
};
|
|
705
|
+
eaw.slice = function(text, start, end) {
|
|
706
|
+
textLen = eaw.length(text);
|
|
707
|
+
start = start ? start : 0;
|
|
708
|
+
end = end ? end : 1;
|
|
709
|
+
if (start < 0) {
|
|
710
|
+
start = textLen + start;
|
|
711
|
+
}
|
|
712
|
+
if (end < 0) {
|
|
713
|
+
end = textLen + end;
|
|
714
|
+
}
|
|
715
|
+
var result = '';
|
|
716
|
+
var eawLen = 0;
|
|
717
|
+
var chars = stringToArray(text);
|
|
718
|
+
for (var i = 0; i < chars.length; i++) {
|
|
719
|
+
var char = chars[i];
|
|
720
|
+
var charLen = eaw.length(char);
|
|
721
|
+
if (eawLen >= start - (charLen == 2 ? 1 : 0)) {
|
|
722
|
+
if (eawLen + charLen <= end) {
|
|
723
|
+
result += char;
|
|
724
|
+
} else {
|
|
725
|
+
break;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
eawLen += charLen;
|
|
729
|
+
}
|
|
730
|
+
return result;
|
|
731
|
+
};
|
|
732
|
+
})(eastasianwidth);
|
|
733
|
+
var eastasianwidthExports = eastasianwidth.exports;
|
|
734
|
+
const eastAsianWidth = getDefaultExportFromCjs(eastasianwidthExports);
|
|
735
|
+
const emojiRegex = () => {
|
|
736
|
+
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;
|
|
737
|
+
};
|
|
738
|
+
function stringWidth$1(string, options) {
|
|
739
|
+
if (typeof string !== 'string' || string.length === 0) {
|
|
740
|
+
return 0;
|
|
741
|
+
}
|
|
742
|
+
options = {
|
|
743
|
+
ambiguousIsNarrow: true,
|
|
744
|
+
countAnsiEscapeCodes: false,
|
|
745
|
+
...options
|
|
746
|
+
};
|
|
747
|
+
if (!options.countAnsiEscapeCodes) {
|
|
748
|
+
string = stripAnsi(string);
|
|
749
|
+
}
|
|
750
|
+
if (string.length === 0) {
|
|
751
|
+
return 0;
|
|
752
|
+
}
|
|
753
|
+
const ambiguousCharacterWidth = options.ambiguousIsNarrow ? 1 : 2;
|
|
754
|
+
let width = 0;
|
|
755
|
+
for (const { segment: character } of new Intl.Segmenter().segment(string)) {
|
|
756
|
+
const codePoint = character.codePointAt(0);
|
|
757
|
+
if (codePoint <= 0x1F || codePoint >= 0x7F && codePoint <= 0x9F) {
|
|
758
|
+
continue;
|
|
759
|
+
}
|
|
760
|
+
if (codePoint >= 0x3_00 && codePoint <= 0x3_6F) {
|
|
761
|
+
continue;
|
|
762
|
+
}
|
|
763
|
+
if (emojiRegex().test(character)) {
|
|
764
|
+
width += 2;
|
|
765
|
+
continue;
|
|
766
|
+
}
|
|
767
|
+
const code = eastAsianWidth.eastAsianWidth(character);
|
|
768
|
+
switch (code) {
|
|
769
|
+
case 'F':
|
|
770
|
+
case 'W': {
|
|
771
|
+
width += 2;
|
|
772
|
+
break;
|
|
773
|
+
}
|
|
774
|
+
case 'A': {
|
|
775
|
+
width += ambiguousCharacterWidth;
|
|
776
|
+
break;
|
|
777
|
+
}
|
|
778
|
+
default: {
|
|
779
|
+
width += 1;
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
return width;
|
|
784
|
+
}
|
|
785
|
+
function isUnicodeSupported() {
|
|
786
|
+
if (process$1.platform !== 'win32') {
|
|
787
|
+
return process$1.env.TERM !== 'linux';
|
|
788
|
+
}
|
|
789
|
+
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';
|
|
790
|
+
}
|
|
791
|
+
const TYPE_COLOR_MAP = {
|
|
792
|
+
info: 'cyan',
|
|
793
|
+
fail: 'red',
|
|
794
|
+
success: 'green',
|
|
795
|
+
ready: 'green',
|
|
796
|
+
start: 'magenta'
|
|
797
|
+
};
|
|
798
|
+
const LEVEL_COLOR_MAP = {
|
|
799
|
+
0: 'red',
|
|
800
|
+
1: 'yellow'
|
|
801
|
+
};
|
|
802
|
+
const unicode = isUnicodeSupported();
|
|
803
|
+
const s = (c, fallback) => unicode ? c : fallback;
|
|
804
|
+
const TYPE_ICONS = {
|
|
805
|
+
error: s('✖', '×'),
|
|
806
|
+
fatal: s('✖', '×'),
|
|
807
|
+
ready: s('✔', '√'),
|
|
808
|
+
warn: s('⚠', '‼'),
|
|
809
|
+
info: s('ℹ', 'i'),
|
|
810
|
+
success: s('✔', '√'),
|
|
811
|
+
debug: s('⚙', 'D'),
|
|
812
|
+
trace: s('→', '→'),
|
|
813
|
+
fail: s('✖', '×'),
|
|
814
|
+
start: s('◐', 'o'),
|
|
815
|
+
log: ''
|
|
816
|
+
};
|
|
817
|
+
function stringWidth(str) {
|
|
818
|
+
if (!Intl.Segmenter) {
|
|
819
|
+
return stripAnsi$1(str).length;
|
|
820
|
+
}
|
|
821
|
+
return stringWidth$1(str);
|
|
822
|
+
}
|
|
823
|
+
class FancyReporter extends BasicReporter {
|
|
824
|
+
formatStack(stack) {
|
|
825
|
+
return '\n' + parseStack(stack).map((line) => ' ' + line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_, m) => `(${colors.cyan(m)})`)).join('\n');
|
|
826
|
+
}
|
|
827
|
+
formatType(logObj, isBadge, opts) {
|
|
828
|
+
const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || 'gray';
|
|
829
|
+
if (isBadge) {
|
|
830
|
+
return getBgColor(typeColor)(colors.black(` ${logObj.type.toUpperCase()} `));
|
|
831
|
+
}
|
|
832
|
+
const _type = typeof TYPE_ICONS[logObj.type] === 'string' ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
|
|
833
|
+
return _type ? getColor(typeColor)(_type) : '';
|
|
834
|
+
}
|
|
835
|
+
formatLogObj(logObj, opts) {
|
|
836
|
+
const [message, ...additional] = this.formatArgs(logObj.args, opts).split('\n');
|
|
837
|
+
if (logObj.type === 'box') {
|
|
838
|
+
return box(characterFormat(message + (additional.length > 0 ? '\n' + additional.join('\n') : '')), {
|
|
839
|
+
title: logObj.title ? characterFormat(logObj.title) : void 0,
|
|
840
|
+
style: logObj.style
|
|
841
|
+
});
|
|
842
|
+
}
|
|
843
|
+
const date = this.formatDate(logObj.date, opts);
|
|
844
|
+
const coloredDate = date && colors.gray(date);
|
|
845
|
+
const isBadge = logObj.badge ?? logObj.level < 2;
|
|
846
|
+
const type = this.formatType(logObj, isBadge, opts);
|
|
847
|
+
const tag = logObj.tag ? colors.gray(logObj.tag) : '';
|
|
848
|
+
let line;
|
|
849
|
+
const left = this.filterAndJoin([type, characterFormat(message)]);
|
|
850
|
+
const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
|
|
851
|
+
const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
|
|
852
|
+
line = space > 0 && (opts.columns || 0) >= 80 ? left + ' '.repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : '') + left;
|
|
853
|
+
line += characterFormat(additional.length > 0 ? '\n' + additional.join('\n') : '');
|
|
854
|
+
if (logObj.type === 'trace') {
|
|
855
|
+
const _err = new Error('Trace: ' + logObj.message);
|
|
856
|
+
line += this.formatStack(_err.stack || '');
|
|
857
|
+
}
|
|
858
|
+
return isBadge ? '\n' + line + '\n' : line;
|
|
859
|
+
}
|
|
860
|
+
}
|
|
861
|
+
function characterFormat(str) {
|
|
862
|
+
return str.replace(/`([^`]+)`/gm, (_, m) => colors.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_, m) => ` ${colors.underline(m)} `);
|
|
863
|
+
}
|
|
864
|
+
function getColor(color = 'white') {
|
|
865
|
+
return colors[color] || colors.white;
|
|
866
|
+
}
|
|
867
|
+
function getBgColor(color = 'bgWhite') {
|
|
868
|
+
return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
|
|
869
|
+
}
|
|
870
|
+
function createConsola(options = {}) {
|
|
871
|
+
let level = _getDefaultLogLevel();
|
|
872
|
+
if (process.env.CONSOLA_LEVEL) {
|
|
873
|
+
level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
|
|
874
|
+
}
|
|
875
|
+
const consola2 = createConsola$1({
|
|
876
|
+
level,
|
|
877
|
+
defaults: {level},
|
|
878
|
+
stdout: process.stdout,
|
|
879
|
+
stderr: process.stderr,
|
|
880
|
+
prompt: (...args) => import('./prompt-v8IJTptZ.cjs').then((m) => m.prompt(...args)),
|
|
881
|
+
reporters: options.reporters || [options.fancy ?? !(isCI || isTest) ? new FancyReporter() : new BasicReporter()],
|
|
882
|
+
...options
|
|
883
|
+
});
|
|
884
|
+
return consola2;
|
|
885
|
+
}
|
|
886
|
+
function _getDefaultLogLevel() {
|
|
887
|
+
if (isDebug) {
|
|
888
|
+
return LogLevels.debug;
|
|
889
|
+
}
|
|
890
|
+
if (isTest) {
|
|
891
|
+
return LogLevels.warn;
|
|
892
|
+
}
|
|
893
|
+
return LogLevels.info;
|
|
894
|
+
}
|
|
895
|
+
const consola = createConsola();
|
|
896
|
+
|
|
897
|
+
//#endregion
|
|
898
|
+
exports.colors = colors;
|
|
899
|
+
exports.consola = consola;
|
|
900
|
+
exports.createConsola = createConsola;
|
|
901
|
+
exports.getDefaultExportFromCjs = getDefaultExportFromCjs;
|
|
902
|
+
exports.isUnicodeSupported = isUnicodeSupported;
|