@kubb/core 4.11.3 → 4.12.1

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