rolldown 1.0.0-beta.1-commit.7c52c94 → 1.0.0-beta.2-commit.f069c5d
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 +981 -25
- package/dist/cjs/experimental-index.cjs +2 -2
- package/dist/cjs/index.cjs +2 -2
- package/dist/cjs/parallel-plugin-worker.cjs +2 -2
- package/dist/cjs/parse-ast-index.cjs +1 -1
- package/dist/esm/cli.mjs +981 -26
- package/dist/esm/experimental-index.mjs +2 -2
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/parallel-plugin-worker.mjs +2 -2
- package/dist/esm/parse-ast-index.mjs +1 -1
- package/dist/shared/{binding-Bl7VQy7c.mjs → binding-l7VLSKnB.mjs} +3 -3
- package/dist/shared/{binding-fhgdIkpS.cjs → binding-orkvONpS.cjs} +3 -3
- package/dist/shared/prompt-B7tq3GL9.cjs +854 -0
- package/dist/shared/prompt-Nfm4Xz36.mjs +851 -0
- package/dist/shared/{src-lBcHSsjm.cjs → src-BRzD1T3r.cjs} +12 -6
- package/dist/shared/{src-CPCP99Z9.mjs → src-Cmr3pg11.mjs} +12 -6
- package/dist/types/api/build.js +22 -0
- package/dist/types/api/experimental.js +13 -0
- package/dist/types/api/rolldown/index.js +7 -0
- package/dist/types/api/rolldown/rolldown-build.js +43 -0
- package/dist/types/api/watch/index.js +8 -0
- package/dist/types/api/watch/watch-emitter.js +69 -0
- package/dist/types/api/watch/watcher.js +66 -0
- package/dist/types/binding.d.ts +40 -2
- package/dist/types/builtin-plugin/alias-plugin.js +4 -0
- package/dist/types/builtin-plugin/constructors.d.ts +2 -2
- package/dist/types/builtin-plugin/constructors.js +68 -0
- package/dist/types/builtin-plugin/replace-plugin.js +29 -0
- package/dist/types/builtin-plugin/transform-plugin.js +16 -0
- package/dist/types/builtin-plugin/utils.js +19 -0
- package/dist/types/cli/arguments/alias.js +63 -0
- package/dist/types/cli/arguments/index.js +127 -0
- package/dist/types/cli/arguments/normalize.js +48 -0
- package/dist/types/cli/arguments/utils.js +67 -0
- package/dist/types/cli/colors.js +17 -0
- package/dist/types/cli/commands/bundle.js +203 -0
- package/dist/types/cli/commands/help.js +88 -0
- package/dist/types/cli/index.js +27 -0
- package/dist/types/cli/load-config.js +95 -0
- package/dist/types/cli/logger.js +35 -0
- package/dist/types/constants/plugin-context.js +7 -0
- package/dist/types/constants/plugin.js +69 -0
- package/dist/types/experimental-index.js +9 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.js +7 -0
- package/dist/types/log/logHandler.js +25 -0
- package/dist/types/log/logger.js +107 -0
- package/dist/types/log/logging.js +11 -0
- package/dist/types/log/logs.js +86 -0
- package/dist/types/options/input-options.d.ts +47 -2
- package/dist/types/options/input-options.js +1 -0
- package/dist/types/options/normalized-input-options.js +21 -0
- package/dist/types/options/normalized-output-options.js +99 -0
- package/dist/types/options/output-options.d.ts +6 -0
- package/dist/types/options/output-options.js +1 -0
- package/dist/types/options/watch-options.js +1 -0
- package/dist/types/parallel-plugin-worker.js +31 -0
- package/dist/types/parallel-plugin.js +1 -0
- package/dist/types/parse-ast-index.js +73 -0
- package/dist/types/plugin/bindingify-build-hooks.js +213 -0
- package/dist/types/plugin/bindingify-hook-filter.js +39 -0
- package/dist/types/plugin/bindingify-output-hooks.js +189 -0
- package/dist/types/plugin/bindingify-plugin-hook-meta.js +19 -0
- package/dist/types/plugin/bindingify-plugin.js +124 -0
- package/dist/types/plugin/bindingify-watch-hooks.js +29 -0
- package/dist/types/plugin/hook-filter.js +1 -0
- package/dist/types/plugin/index.js +1 -0
- package/dist/types/plugin/minimal-plugin-context.js +25 -0
- package/dist/types/plugin/parallel-plugin-implementation.js +3 -0
- package/dist/types/plugin/parallel-plugin.js +6 -0
- package/dist/types/plugin/plugin-context-data.js +55 -0
- package/dist/types/plugin/plugin-context.js +108 -0
- package/dist/types/plugin/plugin-driver.js +88 -0
- package/dist/types/plugin/transform-plugin-context.js +37 -0
- package/dist/types/types/assert.js +1 -0
- package/dist/types/types/config-export.js +1 -0
- package/dist/types/types/misc.js +1 -0
- package/dist/types/types/module-info.js +1 -0
- package/dist/types/types/module-side-effects.js +1 -0
- package/dist/types/types/output-bundle.js +1 -0
- package/dist/types/types/rolldown-options.js +1 -0
- package/dist/types/types/rolldown-output.js +1 -0
- package/dist/types/types/schema.js +1 -0
- package/dist/types/types/sourcemap.js +16 -0
- package/dist/types/types/utils.js +1 -0
- package/dist/types/utils/asset-source.js +8 -0
- package/dist/types/utils/async-flatten.js +7 -0
- package/dist/types/utils/bindingify-input-options.js +225 -0
- package/dist/types/utils/bindingify-output-options.js +92 -0
- package/dist/types/utils/code-frame.js +46 -0
- package/dist/types/utils/compose-js-plugins.js +400 -0
- package/dist/types/utils/create-bundler-option.js +53 -0
- package/dist/types/utils/create-bundler.js +15 -0
- package/dist/types/utils/define-config.js +3 -0
- package/dist/types/utils/error.js +65 -0
- package/dist/types/utils/initialize-parallel-plugins.js +54 -0
- package/dist/types/utils/misc.js +22 -0
- package/dist/types/utils/normalize-hook.js +21 -0
- package/dist/types/utils/normalize-plugin-option.js +35 -0
- package/dist/types/utils/normalize-string-or-regex.js +14 -0
- package/dist/types/utils/plugin/index.js +7 -0
- package/dist/types/utils/transform-module-info.js +19 -0
- package/dist/types/utils/transform-rendered-chunk.js +43 -0
- package/dist/types/utils/transform-rendered-module.js +10 -0
- package/dist/types/utils/transform-side-effects.js +16 -0
- package/dist/types/utils/transform-sourcemap.js +29 -0
- package/dist/types/utils/transform-to-rollup-output.js +165 -0
- package/dist/types/utils/validator.js +275 -0
- package/package.json +28 -25
- package/dist/shared/consola_36c0034f-Cx52UqEq.mjs +0 -832
- package/dist/shared/consola_36c0034f-CynBWXXO.cjs +0 -859
- package/dist/shared/prompt-B58MxVuU.cjs +0 -762
- package/dist/shared/prompt-DjjlOckE.mjs +0 -758
- package/dist/tsconfig.dts.tsbuildinfo +0 -1
package/dist/cjs/cli.cjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const require_chunk = require('../shared/chunk-qZFfknuJ.cjs');
|
|
3
|
-
const require_src = require('../shared/src-
|
|
4
|
-
const require_binding = require('../shared/binding-
|
|
5
|
-
const require_consola_36c0034f = require('../shared/consola_36c0034f-CynBWXXO.cjs');
|
|
3
|
+
const require_src = require('../shared/src-BRzD1T3r.cjs');
|
|
4
|
+
const require_binding = require('../shared/binding-orkvONpS.cjs');
|
|
6
5
|
const node_process = require_chunk.__toESM(require("node:process"));
|
|
7
6
|
const node_path = require_chunk.__toESM(require("node:path"));
|
|
8
7
|
const node_fs = require_chunk.__toESM(require("node:fs"));
|
|
@@ -63,10 +62,10 @@ var Emitter = class {
|
|
|
63
62
|
}
|
|
64
63
|
removeListener(ev, fn) {
|
|
65
64
|
const list = this.listeners[ev];
|
|
66
|
-
const i = list.indexOf(fn);
|
|
67
|
-
if (i === -1) return;
|
|
68
|
-
if (i === 0 && list.length === 1) list.length = 0;
|
|
69
|
-
else list.splice(i, 1);
|
|
65
|
+
const i$1 = list.indexOf(fn);
|
|
66
|
+
if (i$1 === -1) return;
|
|
67
|
+
if (i$1 === 0 && list.length === 1) list.length = 0;
|
|
68
|
+
else list.splice(i$1, 1);
|
|
70
69
|
}
|
|
71
70
|
emit(ev, code, signal) {
|
|
72
71
|
if (this.emitted[ev]) return false;
|
|
@@ -113,13 +112,13 @@ var SignalExit = class extends SignalExitBase {
|
|
|
113
112
|
for (const sig of signals) this.#sigListeners[sig] = () => {
|
|
114
113
|
const listeners = this.#process.listeners(sig);
|
|
115
114
|
let { count } = this.#emitter;
|
|
116
|
-
const p = process$3;
|
|
117
|
-
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
|
|
115
|
+
const p$2 = process$3;
|
|
116
|
+
if (typeof p$2.__signal_exit_emitter__ === "object" && typeof p$2.__signal_exit_emitter__.count === "number") count += p$2.__signal_exit_emitter__.count;
|
|
118
117
|
if (listeners.length === count) {
|
|
119
118
|
this.unload();
|
|
120
119
|
const ret = this.#emitter.emit("exit", null, sig);
|
|
121
|
-
const s = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
122
|
-
if (!ret) process$3.kill(process$3.pid, s);
|
|
120
|
+
const s$2 = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
121
|
+
if (!ret) process$3.kill(process$3.pid, s$2);
|
|
123
122
|
}
|
|
124
123
|
};
|
|
125
124
|
this.#originalProcessReallyExit = process$3.reallyExit;
|
|
@@ -142,9 +141,9 @@ var SignalExit = class extends SignalExitBase {
|
|
|
142
141
|
for (const sig of signals) try {
|
|
143
142
|
const fn = this.#sigListeners[sig];
|
|
144
143
|
if (fn) this.#process.on(sig, fn);
|
|
145
|
-
} catch (_) {}
|
|
146
|
-
this.#process.emit = (ev, ...a) => {
|
|
147
|
-
return this.#processEmit(ev, ...a);
|
|
144
|
+
} catch (_$1) {}
|
|
145
|
+
this.#process.emit = (ev, ...a$1) => {
|
|
146
|
+
return this.#processEmit(ev, ...a$1);
|
|
148
147
|
};
|
|
149
148
|
this.#process.reallyExit = (code) => {
|
|
150
149
|
return this.#processReallyExit(code);
|
|
@@ -158,7 +157,7 @@ var SignalExit = class extends SignalExitBase {
|
|
|
158
157
|
if (!listener) throw new Error("Listener not defined for signal: " + sig);
|
|
159
158
|
try {
|
|
160
159
|
this.#process.removeListener(sig, listener);
|
|
161
|
-
} catch (_) {}
|
|
160
|
+
} catch (_$1) {}
|
|
162
161
|
});
|
|
163
162
|
this.#process.emit = this.#originalProcessEmit;
|
|
164
163
|
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
@@ -183,9 +182,966 @@ var SignalExit = class extends SignalExitBase {
|
|
|
183
182
|
const process$2 = globalThis.process;
|
|
184
183
|
const { onExit, load, unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
|
|
185
184
|
|
|
185
|
+
//#endregion
|
|
186
|
+
//#region ../../node_modules/.pnpm/consola@3.4.0/node_modules/consola/dist/core.mjs
|
|
187
|
+
const LogLevels = {
|
|
188
|
+
silent: Number.NEGATIVE_INFINITY,
|
|
189
|
+
fatal: 0,
|
|
190
|
+
error: 0,
|
|
191
|
+
warn: 1,
|
|
192
|
+
log: 2,
|
|
193
|
+
info: 3,
|
|
194
|
+
success: 3,
|
|
195
|
+
fail: 3,
|
|
196
|
+
ready: 3,
|
|
197
|
+
start: 3,
|
|
198
|
+
box: 3,
|
|
199
|
+
debug: 4,
|
|
200
|
+
trace: 5,
|
|
201
|
+
verbose: Number.POSITIVE_INFINITY
|
|
202
|
+
};
|
|
203
|
+
const LogTypes = {
|
|
204
|
+
silent: { level: -1 },
|
|
205
|
+
fatal: { level: LogLevels.fatal },
|
|
206
|
+
error: { level: LogLevels.error },
|
|
207
|
+
warn: { level: LogLevels.warn },
|
|
208
|
+
log: { level: LogLevels.log },
|
|
209
|
+
info: { level: LogLevels.info },
|
|
210
|
+
success: { level: LogLevels.success },
|
|
211
|
+
fail: { level: LogLevels.fail },
|
|
212
|
+
ready: { level: LogLevels.info },
|
|
213
|
+
start: { level: LogLevels.info },
|
|
214
|
+
box: { level: LogLevels.info },
|
|
215
|
+
debug: { level: LogLevels.debug },
|
|
216
|
+
trace: { level: LogLevels.trace },
|
|
217
|
+
verbose: { level: LogLevels.verbose }
|
|
218
|
+
};
|
|
219
|
+
function isPlainObject$1(value) {
|
|
220
|
+
if (value === null || typeof value !== "object") return false;
|
|
221
|
+
const prototype = Object.getPrototypeOf(value);
|
|
222
|
+
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
|
|
223
|
+
if (Symbol.iterator in value) return false;
|
|
224
|
+
if (Symbol.toStringTag in value) return Object.prototype.toString.call(value) === "[object Module]";
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
228
|
+
if (!isPlainObject$1(defaults)) return _defu(baseObject, {}, namespace, merger);
|
|
229
|
+
const object = Object.assign({}, defaults);
|
|
230
|
+
for (const key in baseObject) {
|
|
231
|
+
if (key === "__proto__" || key === "constructor") continue;
|
|
232
|
+
const value = baseObject[key];
|
|
233
|
+
if (value === null || value === undefined) continue;
|
|
234
|
+
if (merger && merger(object, key, value, namespace)) continue;
|
|
235
|
+
if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
|
|
236
|
+
else if (isPlainObject$1(value) && isPlainObject$1(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
|
|
237
|
+
else object[key] = value;
|
|
238
|
+
}
|
|
239
|
+
return object;
|
|
240
|
+
}
|
|
241
|
+
function createDefu(merger) {
|
|
242
|
+
return (...arguments_) => arguments_.reduce((p$2, c$1) => _defu(p$2, c$1, "", merger), {});
|
|
243
|
+
}
|
|
244
|
+
const defu = createDefu();
|
|
245
|
+
function isPlainObject(obj) {
|
|
246
|
+
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
247
|
+
}
|
|
248
|
+
function isLogObj(arg) {
|
|
249
|
+
if (!isPlainObject(arg)) return false;
|
|
250
|
+
if (!arg.message && !arg.args) return false;
|
|
251
|
+
if (arg.stack) return false;
|
|
252
|
+
return true;
|
|
253
|
+
}
|
|
254
|
+
let paused = false;
|
|
255
|
+
const queue = [];
|
|
256
|
+
var Consola = class Consola {
|
|
257
|
+
options;
|
|
258
|
+
_lastLog;
|
|
259
|
+
_mockFn;
|
|
260
|
+
/**
|
|
261
|
+
* Creates an instance of Consola with specified options or defaults.
|
|
262
|
+
*
|
|
263
|
+
* @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
|
|
264
|
+
*/
|
|
265
|
+
constructor(options$1 = {}) {
|
|
266
|
+
const types = options$1.types || LogTypes;
|
|
267
|
+
this.options = defu({
|
|
268
|
+
...options$1,
|
|
269
|
+
defaults: { ...options$1.defaults },
|
|
270
|
+
level: _normalizeLogLevel(options$1.level, types),
|
|
271
|
+
reporters: [...options$1.reporters || []]
|
|
272
|
+
}, {
|
|
273
|
+
types: LogTypes,
|
|
274
|
+
throttle: 1e3,
|
|
275
|
+
throttleMin: 5,
|
|
276
|
+
formatOptions: {
|
|
277
|
+
date: true,
|
|
278
|
+
colors: false,
|
|
279
|
+
compact: true
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
for (const type in types) {
|
|
283
|
+
const defaults = {
|
|
284
|
+
type,
|
|
285
|
+
...this.options.defaults,
|
|
286
|
+
...types[type]
|
|
287
|
+
};
|
|
288
|
+
this[type] = this._wrapLogFn(defaults);
|
|
289
|
+
this[type].raw = this._wrapLogFn(defaults, true);
|
|
290
|
+
}
|
|
291
|
+
if (this.options.mockFn) this.mockTypes();
|
|
292
|
+
this._lastLog = {};
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Gets the current log level of the Consola instance.
|
|
296
|
+
*
|
|
297
|
+
* @returns {number} The current log level.
|
|
298
|
+
*/
|
|
299
|
+
get level() {
|
|
300
|
+
return this.options.level;
|
|
301
|
+
}
|
|
302
|
+
/**
|
|
303
|
+
* Sets the minimum log level that will be output by the instance.
|
|
304
|
+
*
|
|
305
|
+
* @param {number} level - The new log level to set.
|
|
306
|
+
*/
|
|
307
|
+
set level(level) {
|
|
308
|
+
this.options.level = _normalizeLogLevel(level, this.options.types, this.options.level);
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Displays a prompt to the user and returns the response.
|
|
312
|
+
* Throw an error if `prompt` is not supported by the current configuration.
|
|
313
|
+
*
|
|
314
|
+
* @template T
|
|
315
|
+
* @param {string} message - The message to display in the prompt.
|
|
316
|
+
* @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
|
|
317
|
+
* @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
|
|
318
|
+
*/
|
|
319
|
+
prompt(message, opts) {
|
|
320
|
+
if (!this.options.prompt) throw new Error("prompt is not supported!");
|
|
321
|
+
return this.options.prompt(message, opts);
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
|
|
325
|
+
*
|
|
326
|
+
* @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
|
|
327
|
+
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
328
|
+
*/
|
|
329
|
+
create(options$1) {
|
|
330
|
+
const instance = new Consola({
|
|
331
|
+
...this.options,
|
|
332
|
+
...options$1
|
|
333
|
+
});
|
|
334
|
+
if (this._mockFn) instance.mockTypes(this._mockFn);
|
|
335
|
+
return instance;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Creates a new Consola instance with the specified default log object properties.
|
|
339
|
+
*
|
|
340
|
+
* @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
|
|
341
|
+
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
342
|
+
*/
|
|
343
|
+
withDefaults(defaults) {
|
|
344
|
+
return this.create({
|
|
345
|
+
...this.options,
|
|
346
|
+
defaults: {
|
|
347
|
+
...this.options.defaults,
|
|
348
|
+
...defaults
|
|
349
|
+
}
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
/**
|
|
353
|
+
* Creates a new Consola instance with a specified tag, which will be included in every log.
|
|
354
|
+
*
|
|
355
|
+
* @param {string} tag - The tag to include in each log of the new instance.
|
|
356
|
+
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
357
|
+
*/
|
|
358
|
+
withTag(tag) {
|
|
359
|
+
return this.withDefaults({ tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag });
|
|
360
|
+
}
|
|
361
|
+
/**
|
|
362
|
+
* Adds a custom reporter to the Consola instance.
|
|
363
|
+
* Reporters will be called for each log message, depending on their implementation and log level.
|
|
364
|
+
*
|
|
365
|
+
* @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
|
|
366
|
+
* @returns {Consola} The current Consola instance.
|
|
367
|
+
*/
|
|
368
|
+
addReporter(reporter) {
|
|
369
|
+
this.options.reporters.push(reporter);
|
|
370
|
+
return this;
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Removes a custom reporter from the Consola instance.
|
|
374
|
+
* If no reporter is specified, all reporters will be removed.
|
|
375
|
+
*
|
|
376
|
+
* @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
|
|
377
|
+
* @returns {Consola} The current Consola instance.
|
|
378
|
+
*/
|
|
379
|
+
removeReporter(reporter) {
|
|
380
|
+
if (reporter) {
|
|
381
|
+
const i$1 = this.options.reporters.indexOf(reporter);
|
|
382
|
+
if (i$1 !== -1) return this.options.reporters.splice(i$1, 1);
|
|
383
|
+
} else this.options.reporters.splice(0);
|
|
384
|
+
return this;
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Replaces all reporters of the Consola instance with the specified array of reporters.
|
|
388
|
+
*
|
|
389
|
+
* @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
|
|
390
|
+
* @returns {Consola} The current Consola instance.
|
|
391
|
+
*/
|
|
392
|
+
setReporters(reporters) {
|
|
393
|
+
this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
|
|
394
|
+
return this;
|
|
395
|
+
}
|
|
396
|
+
wrapAll() {
|
|
397
|
+
this.wrapConsole();
|
|
398
|
+
this.wrapStd();
|
|
399
|
+
}
|
|
400
|
+
restoreAll() {
|
|
401
|
+
this.restoreConsole();
|
|
402
|
+
this.restoreStd();
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Overrides console methods with Consola logging methods for consistent logging.
|
|
406
|
+
*/
|
|
407
|
+
wrapConsole() {
|
|
408
|
+
for (const type in this.options.types) {
|
|
409
|
+
if (!console["__" + type]) console["__" + type] = console[type];
|
|
410
|
+
console[type] = this[type].raw;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Restores the original console methods, removing Consola overrides.
|
|
415
|
+
*/
|
|
416
|
+
restoreConsole() {
|
|
417
|
+
for (const type in this.options.types) if (console["__" + type]) {
|
|
418
|
+
console[type] = console["__" + type];
|
|
419
|
+
delete console["__" + type];
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
/**
|
|
423
|
+
* Overrides standard output and error streams to redirect them through Consola.
|
|
424
|
+
*/
|
|
425
|
+
wrapStd() {
|
|
426
|
+
this._wrapStream(this.options.stdout, "log");
|
|
427
|
+
this._wrapStream(this.options.stderr, "log");
|
|
428
|
+
}
|
|
429
|
+
_wrapStream(stream, type) {
|
|
430
|
+
if (!stream) return;
|
|
431
|
+
if (!stream.__write) stream.__write = stream.write;
|
|
432
|
+
stream.write = (data) => {
|
|
433
|
+
this[type].raw(String(data).trim());
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* Restores the original standard output and error streams, removing the Consola redirection.
|
|
438
|
+
*/
|
|
439
|
+
restoreStd() {
|
|
440
|
+
this._restoreStream(this.options.stdout);
|
|
441
|
+
this._restoreStream(this.options.stderr);
|
|
442
|
+
}
|
|
443
|
+
_restoreStream(stream) {
|
|
444
|
+
if (!stream) return;
|
|
445
|
+
if (stream.__write) {
|
|
446
|
+
stream.write = stream.__write;
|
|
447
|
+
delete stream.__write;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Pauses logging, queues incoming logs until resumed.
|
|
452
|
+
*/
|
|
453
|
+
pauseLogs() {
|
|
454
|
+
paused = true;
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* Resumes logging, processing any queued logs.
|
|
458
|
+
*/
|
|
459
|
+
resumeLogs() {
|
|
460
|
+
paused = false;
|
|
461
|
+
const _queue = queue.splice(0);
|
|
462
|
+
for (const item of _queue) item[0]._logFn(item[1], item[2]);
|
|
463
|
+
}
|
|
464
|
+
/**
|
|
465
|
+
* Replaces logging methods with mocks if a mock function is provided.
|
|
466
|
+
*
|
|
467
|
+
* @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
|
|
468
|
+
*/
|
|
469
|
+
mockTypes(mockFn) {
|
|
470
|
+
const _mockFn = mockFn || this.options.mockFn;
|
|
471
|
+
this._mockFn = _mockFn;
|
|
472
|
+
if (typeof _mockFn !== "function") return;
|
|
473
|
+
for (const type in this.options.types) {
|
|
474
|
+
this[type] = _mockFn(type, this.options.types[type]) || this[type];
|
|
475
|
+
this[type].raw = this[type];
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
_wrapLogFn(defaults, isRaw) {
|
|
479
|
+
return (...args) => {
|
|
480
|
+
if (paused) {
|
|
481
|
+
queue.push([
|
|
482
|
+
this,
|
|
483
|
+
defaults,
|
|
484
|
+
args,
|
|
485
|
+
isRaw
|
|
486
|
+
]);
|
|
487
|
+
return;
|
|
488
|
+
}
|
|
489
|
+
return this._logFn(defaults, args, isRaw);
|
|
490
|
+
};
|
|
491
|
+
}
|
|
492
|
+
_logFn(defaults, args, isRaw) {
|
|
493
|
+
if ((defaults.level || 0) > this.level) return false;
|
|
494
|
+
const logObj = {
|
|
495
|
+
date: /* @__PURE__ */ new Date(),
|
|
496
|
+
args: [],
|
|
497
|
+
...defaults,
|
|
498
|
+
level: _normalizeLogLevel(defaults.level, this.options.types)
|
|
499
|
+
};
|
|
500
|
+
if (!isRaw && args.length === 1 && isLogObj(args[0])) Object.assign(logObj, args[0]);
|
|
501
|
+
else logObj.args = [...args];
|
|
502
|
+
if (logObj.message) {
|
|
503
|
+
logObj.args.unshift(logObj.message);
|
|
504
|
+
delete logObj.message;
|
|
505
|
+
}
|
|
506
|
+
if (logObj.additional) {
|
|
507
|
+
if (!Array.isArray(logObj.additional)) logObj.additional = logObj.additional.split("\n");
|
|
508
|
+
logObj.args.push("\n" + logObj.additional.join("\n"));
|
|
509
|
+
delete logObj.additional;
|
|
510
|
+
}
|
|
511
|
+
logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
|
|
512
|
+
logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
|
|
513
|
+
const resolveLog = (newLog = false) => {
|
|
514
|
+
const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
|
|
515
|
+
if (this._lastLog.object && repeated > 0) {
|
|
516
|
+
const args2 = [...this._lastLog.object.args];
|
|
517
|
+
if (repeated > 1) args2.push(`(repeated ${repeated} times)`);
|
|
518
|
+
this._log({
|
|
519
|
+
...this._lastLog.object,
|
|
520
|
+
args: args2
|
|
521
|
+
});
|
|
522
|
+
this._lastLog.count = 1;
|
|
523
|
+
}
|
|
524
|
+
if (newLog) {
|
|
525
|
+
this._lastLog.object = logObj;
|
|
526
|
+
this._log(logObj);
|
|
527
|
+
}
|
|
528
|
+
};
|
|
529
|
+
clearTimeout(this._lastLog.timeout);
|
|
530
|
+
const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
|
|
531
|
+
this._lastLog.time = logObj.date;
|
|
532
|
+
if (diffTime < this.options.throttle) try {
|
|
533
|
+
const serializedLog = JSON.stringify([
|
|
534
|
+
logObj.type,
|
|
535
|
+
logObj.tag,
|
|
536
|
+
logObj.args
|
|
537
|
+
]);
|
|
538
|
+
const isSameLog = this._lastLog.serialized === serializedLog;
|
|
539
|
+
this._lastLog.serialized = serializedLog;
|
|
540
|
+
if (isSameLog) {
|
|
541
|
+
this._lastLog.count = (this._lastLog.count || 0) + 1;
|
|
542
|
+
if (this._lastLog.count > this.options.throttleMin) {
|
|
543
|
+
this._lastLog.timeout = setTimeout(resolveLog, this.options.throttle);
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
} catch {}
|
|
548
|
+
resolveLog(true);
|
|
549
|
+
}
|
|
550
|
+
_log(logObj) {
|
|
551
|
+
for (const reporter of this.options.reporters) reporter.log(logObj, { options: this.options });
|
|
552
|
+
}
|
|
553
|
+
};
|
|
554
|
+
function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
|
|
555
|
+
if (input === undefined) return defaultLevel;
|
|
556
|
+
if (typeof input === "number") return input;
|
|
557
|
+
if (types[input] && types[input].level !== undefined) return types[input].level;
|
|
558
|
+
return defaultLevel;
|
|
559
|
+
}
|
|
560
|
+
Consola.prototype.add = Consola.prototype.addReporter;
|
|
561
|
+
Consola.prototype.remove = Consola.prototype.removeReporter;
|
|
562
|
+
Consola.prototype.clear = Consola.prototype.removeReporter;
|
|
563
|
+
Consola.prototype.withScope = Consola.prototype.withTag;
|
|
564
|
+
Consola.prototype.mock = Consola.prototype.mockTypes;
|
|
565
|
+
Consola.prototype.pause = Consola.prototype.pauseLogs;
|
|
566
|
+
Consola.prototype.resume = Consola.prototype.resumeLogs;
|
|
567
|
+
function createConsola$1(options$1 = {}) {
|
|
568
|
+
return new Consola(options$1);
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
//#endregion
|
|
572
|
+
//#region ../../node_modules/.pnpm/consola@3.4.0/node_modules/consola/dist/shared/consola.Cs5FdtHD.mjs
|
|
573
|
+
function parseStack(stack) {
|
|
574
|
+
const cwd$1 = process.cwd() + node_path.sep;
|
|
575
|
+
const lines = stack.split("\n").splice(1).map((l$1) => l$1.trim().replace("file://", "").replace(cwd$1, ""));
|
|
576
|
+
return lines;
|
|
577
|
+
}
|
|
578
|
+
function writeStream(data, stream) {
|
|
579
|
+
const write = stream.__write || stream.write;
|
|
580
|
+
return write.call(stream, data);
|
|
581
|
+
}
|
|
582
|
+
const bracket = (x) => x ? `[${x}]` : "";
|
|
583
|
+
var BasicReporter = class {
|
|
584
|
+
formatStack(stack, opts) {
|
|
585
|
+
const indent = " ".repeat((opts?.errorLevel || 0) + 1);
|
|
586
|
+
return indent + parseStack(stack).join(`
|
|
587
|
+
${indent}`);
|
|
588
|
+
}
|
|
589
|
+
formatError(err, opts) {
|
|
590
|
+
const message = err.message ?? (0, node_util.formatWithOptions)(opts, err);
|
|
591
|
+
const stack = err.stack ? this.formatStack(err.stack, opts) : "";
|
|
592
|
+
const level = opts?.errorLevel || 0;
|
|
593
|
+
const causedPrefix = level > 0 ? `${" ".repeat(level)}[cause]: ` : "";
|
|
594
|
+
const causedError = err.cause ? "\n\n" + this.formatError(err.cause, {
|
|
595
|
+
...opts,
|
|
596
|
+
errorLevel: level + 1
|
|
597
|
+
}) : "";
|
|
598
|
+
return causedPrefix + message + "\n" + stack + causedError;
|
|
599
|
+
}
|
|
600
|
+
formatArgs(args, opts) {
|
|
601
|
+
const _args = args.map((arg) => {
|
|
602
|
+
if (arg && typeof arg.stack === "string") return this.formatError(arg, opts);
|
|
603
|
+
return arg;
|
|
604
|
+
});
|
|
605
|
+
return (0, node_util.formatWithOptions)(opts, ..._args);
|
|
606
|
+
}
|
|
607
|
+
formatDate(date, opts) {
|
|
608
|
+
return opts.date ? date.toLocaleTimeString() : "";
|
|
609
|
+
}
|
|
610
|
+
filterAndJoin(arr) {
|
|
611
|
+
return arr.filter(Boolean).join(" ");
|
|
612
|
+
}
|
|
613
|
+
formatLogObj(logObj, opts) {
|
|
614
|
+
const message = this.formatArgs(logObj.args, opts);
|
|
615
|
+
if (logObj.type === "box") return "\n" + [
|
|
616
|
+
bracket(logObj.tag),
|
|
617
|
+
logObj.title && logObj.title,
|
|
618
|
+
...message.split("\n")
|
|
619
|
+
].filter(Boolean).map((l$1) => " > " + l$1).join("\n") + "\n";
|
|
620
|
+
return this.filterAndJoin([
|
|
621
|
+
bracket(logObj.type),
|
|
622
|
+
bracket(logObj.tag),
|
|
623
|
+
message
|
|
624
|
+
]);
|
|
625
|
+
}
|
|
626
|
+
log(logObj, ctx) {
|
|
627
|
+
const line = this.formatLogObj(logObj, {
|
|
628
|
+
columns: ctx.options.stdout.columns || 0,
|
|
629
|
+
...ctx.options.formatOptions
|
|
630
|
+
});
|
|
631
|
+
return writeStream(line + "\n", logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
|
|
632
|
+
}
|
|
633
|
+
};
|
|
634
|
+
|
|
635
|
+
//#endregion
|
|
636
|
+
//#region ../../node_modules/.pnpm/consola@3.4.0/node_modules/consola/dist/shared/consola.lX6kr4n8.mjs
|
|
637
|
+
const { env = {}, argv = [], platform = "" } = typeof process === "undefined" ? {} : process;
|
|
638
|
+
const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
639
|
+
const isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
640
|
+
const isWindows = platform === "win32";
|
|
641
|
+
const isDumbTerminal = env.TERM === "dumb";
|
|
642
|
+
const isCompatibleTerminal = node_tty && node_tty.isatty && node_tty.isatty(1) && env.TERM && !isDumbTerminal;
|
|
643
|
+
const isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
644
|
+
const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
645
|
+
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)) {
|
|
646
|
+
return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
647
|
+
}
|
|
648
|
+
function clearBleed(index, string, open, close, replace) {
|
|
649
|
+
return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
650
|
+
}
|
|
651
|
+
function filterEmpty(open, close, replace = open, at = open.length + 1) {
|
|
652
|
+
return (string) => string || !(string === "" || string === undefined) ? clearBleed(("" + string).indexOf(close, at), string, open, close, replace) : "";
|
|
653
|
+
}
|
|
654
|
+
function init(open, close, replace) {
|
|
655
|
+
return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
|
|
656
|
+
}
|
|
657
|
+
const colorDefs = {
|
|
658
|
+
reset: init(0, 0),
|
|
659
|
+
bold: init(1, 22, "\x1B[22m\x1B[1m"),
|
|
660
|
+
dim: init(2, 22, "\x1B[22m\x1B[2m"),
|
|
661
|
+
italic: init(3, 23),
|
|
662
|
+
underline: init(4, 24),
|
|
663
|
+
inverse: init(7, 27),
|
|
664
|
+
hidden: init(8, 28),
|
|
665
|
+
strikethrough: init(9, 29),
|
|
666
|
+
black: init(30, 39),
|
|
667
|
+
red: init(31, 39),
|
|
668
|
+
green: init(32, 39),
|
|
669
|
+
yellow: init(33, 39),
|
|
670
|
+
blue: init(34, 39),
|
|
671
|
+
magenta: init(35, 39),
|
|
672
|
+
cyan: init(36, 39),
|
|
673
|
+
white: init(37, 39),
|
|
674
|
+
gray: init(90, 39),
|
|
675
|
+
bgBlack: init(40, 49),
|
|
676
|
+
bgRed: init(41, 49),
|
|
677
|
+
bgGreen: init(42, 49),
|
|
678
|
+
bgYellow: init(43, 49),
|
|
679
|
+
bgBlue: init(44, 49),
|
|
680
|
+
bgMagenta: init(45, 49),
|
|
681
|
+
bgCyan: init(46, 49),
|
|
682
|
+
bgWhite: init(47, 49),
|
|
683
|
+
blackBright: init(90, 39),
|
|
684
|
+
redBright: init(91, 39),
|
|
685
|
+
greenBright: init(92, 39),
|
|
686
|
+
yellowBright: init(93, 39),
|
|
687
|
+
blueBright: init(94, 39),
|
|
688
|
+
magentaBright: init(95, 39),
|
|
689
|
+
cyanBright: init(96, 39),
|
|
690
|
+
whiteBright: init(97, 39),
|
|
691
|
+
bgBlackBright: init(100, 49),
|
|
692
|
+
bgRedBright: init(101, 49),
|
|
693
|
+
bgGreenBright: init(102, 49),
|
|
694
|
+
bgYellowBright: init(103, 49),
|
|
695
|
+
bgBlueBright: init(104, 49),
|
|
696
|
+
bgMagentaBright: init(105, 49),
|
|
697
|
+
bgCyanBright: init(106, 49),
|
|
698
|
+
bgWhiteBright: init(107, 49)
|
|
699
|
+
};
|
|
700
|
+
function createColors(useColor = isColorSupported) {
|
|
701
|
+
return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
|
|
702
|
+
}
|
|
703
|
+
const colors$1 = createColors();
|
|
704
|
+
function getColor$1(color, fallback = "reset") {
|
|
705
|
+
return colors$1[color] || colors$1[fallback];
|
|
706
|
+
}
|
|
707
|
+
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("|");
|
|
708
|
+
function stripAnsi$1(text) {
|
|
709
|
+
return text.replace(new RegExp(ansiRegex$1, "g"), "");
|
|
710
|
+
}
|
|
711
|
+
const boxStylePresets = {
|
|
712
|
+
solid: {
|
|
713
|
+
tl: "┌",
|
|
714
|
+
tr: "┐",
|
|
715
|
+
bl: "└",
|
|
716
|
+
br: "┘",
|
|
717
|
+
h: "─",
|
|
718
|
+
v: "│"
|
|
719
|
+
},
|
|
720
|
+
double: {
|
|
721
|
+
tl: "╔",
|
|
722
|
+
tr: "╗",
|
|
723
|
+
bl: "╚",
|
|
724
|
+
br: "╝",
|
|
725
|
+
h: "═",
|
|
726
|
+
v: "║"
|
|
727
|
+
},
|
|
728
|
+
doubleSingle: {
|
|
729
|
+
tl: "╓",
|
|
730
|
+
tr: "╖",
|
|
731
|
+
bl: "╙",
|
|
732
|
+
br: "╜",
|
|
733
|
+
h: "─",
|
|
734
|
+
v: "║"
|
|
735
|
+
},
|
|
736
|
+
doubleSingleRounded: {
|
|
737
|
+
tl: "╭",
|
|
738
|
+
tr: "╮",
|
|
739
|
+
bl: "╰",
|
|
740
|
+
br: "╯",
|
|
741
|
+
h: "─",
|
|
742
|
+
v: "║"
|
|
743
|
+
},
|
|
744
|
+
singleThick: {
|
|
745
|
+
tl: "┏",
|
|
746
|
+
tr: "┓",
|
|
747
|
+
bl: "┗",
|
|
748
|
+
br: "┛",
|
|
749
|
+
h: "━",
|
|
750
|
+
v: "┃"
|
|
751
|
+
},
|
|
752
|
+
singleDouble: {
|
|
753
|
+
tl: "╒",
|
|
754
|
+
tr: "╕",
|
|
755
|
+
bl: "╘",
|
|
756
|
+
br: "╛",
|
|
757
|
+
h: "═",
|
|
758
|
+
v: "│"
|
|
759
|
+
},
|
|
760
|
+
singleDoubleRounded: {
|
|
761
|
+
tl: "╭",
|
|
762
|
+
tr: "╮",
|
|
763
|
+
bl: "╰",
|
|
764
|
+
br: "╯",
|
|
765
|
+
h: "═",
|
|
766
|
+
v: "│"
|
|
767
|
+
},
|
|
768
|
+
rounded: {
|
|
769
|
+
tl: "╭",
|
|
770
|
+
tr: "╮",
|
|
771
|
+
bl: "╰",
|
|
772
|
+
br: "╯",
|
|
773
|
+
h: "─",
|
|
774
|
+
v: "│"
|
|
775
|
+
}
|
|
776
|
+
};
|
|
777
|
+
const defaultStyle = {
|
|
778
|
+
borderColor: "white",
|
|
779
|
+
borderStyle: "rounded",
|
|
780
|
+
valign: "center",
|
|
781
|
+
padding: 2,
|
|
782
|
+
marginLeft: 1,
|
|
783
|
+
marginTop: 1,
|
|
784
|
+
marginBottom: 1
|
|
785
|
+
};
|
|
786
|
+
function box(text, _opts = {}) {
|
|
787
|
+
const opts = {
|
|
788
|
+
..._opts,
|
|
789
|
+
style: {
|
|
790
|
+
...defaultStyle,
|
|
791
|
+
..._opts.style
|
|
792
|
+
}
|
|
793
|
+
};
|
|
794
|
+
const textLines = text.split("\n");
|
|
795
|
+
const boxLines = [];
|
|
796
|
+
const _color = getColor$1(opts.style.borderColor);
|
|
797
|
+
const borderStyle = { ...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle };
|
|
798
|
+
if (_color) for (const key in borderStyle) borderStyle[key] = _color(borderStyle[key]);
|
|
799
|
+
const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
|
|
800
|
+
const height = textLines.length + paddingOffset;
|
|
801
|
+
const width = Math.max(...textLines.map((line) => stripAnsi$1(line).length)) + paddingOffset;
|
|
802
|
+
const widthOffset = width + paddingOffset;
|
|
803
|
+
const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
|
|
804
|
+
if (opts.style.marginTop > 0) boxLines.push("".repeat(opts.style.marginTop));
|
|
805
|
+
if (opts.title) {
|
|
806
|
+
const title = _color ? _color(opts.title) : opts.title;
|
|
807
|
+
const left = borderStyle.h.repeat(Math.floor((width - stripAnsi$1(opts.title).length) / 2));
|
|
808
|
+
const right = borderStyle.h.repeat(width - stripAnsi$1(opts.title).length - stripAnsi$1(left).length + paddingOffset);
|
|
809
|
+
boxLines.push(`${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`);
|
|
810
|
+
} else boxLines.push(`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`);
|
|
811
|
+
const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
|
|
812
|
+
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}`);
|
|
813
|
+
else {
|
|
814
|
+
const line = textLines[i$1 - valignOffset];
|
|
815
|
+
const left = " ".repeat(paddingOffset);
|
|
816
|
+
const right = " ".repeat(width - stripAnsi$1(line).length);
|
|
817
|
+
boxLines.push(`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`);
|
|
818
|
+
}
|
|
819
|
+
boxLines.push(`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`);
|
|
820
|
+
if (opts.style.marginBottom > 0) boxLines.push("".repeat(opts.style.marginBottom));
|
|
821
|
+
return boxLines.join("\n");
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
//#endregion
|
|
825
|
+
//#region ../../node_modules/.pnpm/consola@3.4.0/node_modules/consola/dist/index.mjs
|
|
826
|
+
const r = Object.create(null), i = (e) => globalThis.process?.env || import.meta.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? r : globalThis), s$1 = new Proxy(r, {
|
|
827
|
+
get(e, o) {
|
|
828
|
+
return i()[o] ?? r[o];
|
|
829
|
+
},
|
|
830
|
+
has(e, o) {
|
|
831
|
+
const E = i();
|
|
832
|
+
return o in E || o in r;
|
|
833
|
+
},
|
|
834
|
+
set(e, o, E) {
|
|
835
|
+
const b = i(true);
|
|
836
|
+
return b[o] = E, true;
|
|
837
|
+
},
|
|
838
|
+
deleteProperty(e, o) {
|
|
839
|
+
if (!o) return false;
|
|
840
|
+
const E = i(true);
|
|
841
|
+
return delete E[o], true;
|
|
842
|
+
},
|
|
843
|
+
ownKeys() {
|
|
844
|
+
const e = i(true);
|
|
845
|
+
return Object.keys(e);
|
|
846
|
+
}
|
|
847
|
+
}), t = typeof process < "u" && process.env && process.env.NODE_ENV || "", B = [
|
|
848
|
+
["APPVEYOR"],
|
|
849
|
+
[
|
|
850
|
+
"AWS_AMPLIFY",
|
|
851
|
+
"AWS_APP_ID",
|
|
852
|
+
{ ci: true }
|
|
853
|
+
],
|
|
854
|
+
["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],
|
|
855
|
+
["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],
|
|
856
|
+
["APPCIRCLE", "AC_APPCIRCLE"],
|
|
857
|
+
["BAMBOO", "bamboo_planKey"],
|
|
858
|
+
["BITBUCKET", "BITBUCKET_COMMIT"],
|
|
859
|
+
["BITRISE", "BITRISE_IO"],
|
|
860
|
+
["BUDDY", "BUDDY_WORKSPACE_ID"],
|
|
861
|
+
["BUILDKITE"],
|
|
862
|
+
["CIRCLE", "CIRCLECI"],
|
|
863
|
+
["CIRRUS", "CIRRUS_CI"],
|
|
864
|
+
[
|
|
865
|
+
"CLOUDFLARE_PAGES",
|
|
866
|
+
"CF_PAGES",
|
|
867
|
+
{ ci: true }
|
|
868
|
+
],
|
|
869
|
+
["CODEBUILD", "CODEBUILD_BUILD_ARN"],
|
|
870
|
+
["CODEFRESH", "CF_BUILD_ID"],
|
|
871
|
+
["DRONE"],
|
|
872
|
+
["DRONE", "DRONE_BUILD_EVENT"],
|
|
873
|
+
["DSARI"],
|
|
874
|
+
["GITHUB_ACTIONS"],
|
|
875
|
+
["GITLAB", "GITLAB_CI"],
|
|
876
|
+
["GITLAB", "CI_MERGE_REQUEST_ID"],
|
|
877
|
+
["GOCD", "GO_PIPELINE_LABEL"],
|
|
878
|
+
["LAYERCI"],
|
|
879
|
+
["HUDSON", "HUDSON_URL"],
|
|
880
|
+
["JENKINS", "JENKINS_URL"],
|
|
881
|
+
["MAGNUM"],
|
|
882
|
+
["NETLIFY"],
|
|
883
|
+
[
|
|
884
|
+
"NETLIFY",
|
|
885
|
+
"NETLIFY_LOCAL",
|
|
886
|
+
{ ci: false }
|
|
887
|
+
],
|
|
888
|
+
["NEVERCODE"],
|
|
889
|
+
["RENDER"],
|
|
890
|
+
["SAIL", "SAILCI"],
|
|
891
|
+
["SEMAPHORE"],
|
|
892
|
+
["SCREWDRIVER"],
|
|
893
|
+
["SHIPPABLE"],
|
|
894
|
+
["SOLANO", "TDDIUM"],
|
|
895
|
+
["STRIDER"],
|
|
896
|
+
["TEAMCITY", "TEAMCITY_VERSION"],
|
|
897
|
+
["TRAVIS"],
|
|
898
|
+
["VERCEL", "NOW_BUILDER"],
|
|
899
|
+
[
|
|
900
|
+
"VERCEL",
|
|
901
|
+
"VERCEL",
|
|
902
|
+
{ ci: false }
|
|
903
|
+
],
|
|
904
|
+
[
|
|
905
|
+
"VERCEL",
|
|
906
|
+
"VERCEL_ENV",
|
|
907
|
+
{ ci: false }
|
|
908
|
+
],
|
|
909
|
+
["APPCENTER", "APPCENTER_BUILD_ID"],
|
|
910
|
+
[
|
|
911
|
+
"CODESANDBOX",
|
|
912
|
+
"CODESANDBOX_SSE",
|
|
913
|
+
{ ci: false }
|
|
914
|
+
],
|
|
915
|
+
["STACKBLITZ"],
|
|
916
|
+
["STORMKIT"],
|
|
917
|
+
["CLEAVR"],
|
|
918
|
+
["ZEABUR"],
|
|
919
|
+
[
|
|
920
|
+
"CODESPHERE",
|
|
921
|
+
"CODESPHERE_APP_ID",
|
|
922
|
+
{ ci: true }
|
|
923
|
+
],
|
|
924
|
+
["RAILWAY", "RAILWAY_PROJECT_ID"],
|
|
925
|
+
["RAILWAY", "RAILWAY_SERVICE_ID"],
|
|
926
|
+
["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"],
|
|
927
|
+
[
|
|
928
|
+
"FIREBASE_APP_HOSTING",
|
|
929
|
+
"FIREBASE_APP_HOSTING",
|
|
930
|
+
{ ci: true }
|
|
931
|
+
]
|
|
932
|
+
];
|
|
933
|
+
function p() {
|
|
934
|
+
if (globalThis.process?.env) for (const e of B) {
|
|
935
|
+
const o = e[1] || e[0];
|
|
936
|
+
if (globalThis.process?.env[o]) return {
|
|
937
|
+
name: e[0].toLowerCase(),
|
|
938
|
+
...e[2]
|
|
939
|
+
};
|
|
940
|
+
}
|
|
941
|
+
return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? {
|
|
942
|
+
name: "stackblitz",
|
|
943
|
+
ci: false
|
|
944
|
+
} : {
|
|
945
|
+
name: "",
|
|
946
|
+
ci: false
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
const l = p();
|
|
950
|
+
l.name;
|
|
951
|
+
function n(e) {
|
|
952
|
+
return e ? e !== "false" : false;
|
|
953
|
+
}
|
|
954
|
+
const I = globalThis.process?.platform || "", T = n(s$1.CI) || l.ci !== false, R = n(globalThis.process?.stdout && globalThis.process?.stdout.isTTY), U = n(s$1.DEBUG), A = t === "test" || n(s$1.TEST);
|
|
955
|
+
n(s$1.MINIMAL) || T || A || !R;
|
|
956
|
+
const _ = /^win/i.test(I);
|
|
957
|
+
!n(s$1.NO_COLOR) && (n(s$1.FORCE_COLOR) || (R || _) && s$1.TERM !== "dumb" || T);
|
|
958
|
+
const C = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
|
|
959
|
+
Number(C?.split(".")[0]) || null;
|
|
960
|
+
const y = globalThis.process || Object.create(null), c = { versions: {} };
|
|
961
|
+
new Proxy(y, { get(e, o) {
|
|
962
|
+
if (o === "env") return s$1;
|
|
963
|
+
if (o in e) return e[o];
|
|
964
|
+
if (o in c) return c[o];
|
|
965
|
+
} });
|
|
966
|
+
const L = globalThis.process?.release?.name === "node", a = !!globalThis.Bun || !!globalThis.process?.versions?.bun, D = !!globalThis.Deno, O = !!globalThis.fastly, S = !!globalThis.Netlify, N = !!globalThis.EdgeRuntime, P = globalThis.navigator?.userAgent === "Cloudflare-Workers", F = [
|
|
967
|
+
[S, "netlify"],
|
|
968
|
+
[N, "edge-light"],
|
|
969
|
+
[P, "workerd"],
|
|
970
|
+
[O, "fastly"],
|
|
971
|
+
[D, "deno"],
|
|
972
|
+
[a, "bun"],
|
|
973
|
+
[L, "node"]
|
|
974
|
+
];
|
|
975
|
+
function G() {
|
|
976
|
+
const e = F.find((o) => o[0]);
|
|
977
|
+
if (e) return { name: e[1] };
|
|
978
|
+
}
|
|
979
|
+
const u = G();
|
|
980
|
+
u?.name || "";
|
|
981
|
+
function ansiRegex({ onlyFirst = false } = {}) {
|
|
982
|
+
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
983
|
+
const pattern = [`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?${ST})`, "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
|
|
984
|
+
return new RegExp(pattern, onlyFirst ? undefined : "g");
|
|
985
|
+
}
|
|
986
|
+
const regex = ansiRegex();
|
|
987
|
+
function stripAnsi(string) {
|
|
988
|
+
if (typeof string !== "string") throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
989
|
+
return string.replace(regex, "");
|
|
990
|
+
}
|
|
991
|
+
function isAmbiguous(x) {
|
|
992
|
+
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;
|
|
993
|
+
}
|
|
994
|
+
function isFullWidth(x) {
|
|
995
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
996
|
+
}
|
|
997
|
+
function isWide(x) {
|
|
998
|
+
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;
|
|
999
|
+
}
|
|
1000
|
+
function validate(codePoint) {
|
|
1001
|
+
if (!Number.isSafeInteger(codePoint)) throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
1002
|
+
}
|
|
1003
|
+
function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
1004
|
+
validate(codePoint);
|
|
1005
|
+
if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) return 2;
|
|
1006
|
+
return 1;
|
|
1007
|
+
}
|
|
1008
|
+
const emojiRegex = () => {
|
|
1009
|
+
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;
|
|
1010
|
+
};
|
|
1011
|
+
const segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : { segment: (str) => str.split("") };
|
|
1012
|
+
const defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
1013
|
+
function stringWidth$1(string, options$1 = {}) {
|
|
1014
|
+
if (typeof string !== "string" || string.length === 0) return 0;
|
|
1015
|
+
const { ambiguousIsNarrow = true, countAnsiEscapeCodes = false } = options$1;
|
|
1016
|
+
if (!countAnsiEscapeCodes) string = stripAnsi(string);
|
|
1017
|
+
if (string.length === 0) return 0;
|
|
1018
|
+
let width = 0;
|
|
1019
|
+
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
1020
|
+
for (const { segment: character } of segmenter.segment(string)) {
|
|
1021
|
+
const codePoint = character.codePointAt(0);
|
|
1022
|
+
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) continue;
|
|
1023
|
+
if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) continue;
|
|
1024
|
+
if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) continue;
|
|
1025
|
+
if (codePoint >= 55296 && codePoint <= 57343) continue;
|
|
1026
|
+
if (codePoint >= 65024 && codePoint <= 65039) continue;
|
|
1027
|
+
if (defaultIgnorableCodePointRegex.test(character)) continue;
|
|
1028
|
+
if (emojiRegex().test(character)) {
|
|
1029
|
+
width += 2;
|
|
1030
|
+
continue;
|
|
1031
|
+
}
|
|
1032
|
+
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
1033
|
+
}
|
|
1034
|
+
return width;
|
|
1035
|
+
}
|
|
1036
|
+
function isUnicodeSupported() {
|
|
1037
|
+
const { env: env$1 } = node_process.default;
|
|
1038
|
+
const { TERM, TERM_PROGRAM } = env$1;
|
|
1039
|
+
if (node_process.default.platform !== "win32") return TERM !== "linux";
|
|
1040
|
+
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";
|
|
1041
|
+
}
|
|
1042
|
+
const TYPE_COLOR_MAP = {
|
|
1043
|
+
info: "cyan",
|
|
1044
|
+
fail: "red",
|
|
1045
|
+
success: "green",
|
|
1046
|
+
ready: "green",
|
|
1047
|
+
start: "magenta"
|
|
1048
|
+
};
|
|
1049
|
+
const LEVEL_COLOR_MAP = {
|
|
1050
|
+
0: "red",
|
|
1051
|
+
1: "yellow"
|
|
1052
|
+
};
|
|
1053
|
+
const unicode = isUnicodeSupported();
|
|
1054
|
+
const s = (c$1, fallback) => unicode ? c$1 : fallback;
|
|
1055
|
+
const TYPE_ICONS = {
|
|
1056
|
+
error: s("✖", "×"),
|
|
1057
|
+
fatal: s("✖", "×"),
|
|
1058
|
+
ready: s("✔", "√"),
|
|
1059
|
+
warn: s("⚠", "‼"),
|
|
1060
|
+
info: s("ℹ", "i"),
|
|
1061
|
+
success: s("✔", "√"),
|
|
1062
|
+
debug: s("⚙", "D"),
|
|
1063
|
+
trace: s("→", "→"),
|
|
1064
|
+
fail: s("✖", "×"),
|
|
1065
|
+
start: s("◐", "o"),
|
|
1066
|
+
log: ""
|
|
1067
|
+
};
|
|
1068
|
+
function stringWidth(str) {
|
|
1069
|
+
const hasICU = typeof Intl === "object";
|
|
1070
|
+
if (!hasICU || !Intl.Segmenter) return stripAnsi$1(str).length;
|
|
1071
|
+
return stringWidth$1(str);
|
|
1072
|
+
}
|
|
1073
|
+
var FancyReporter = class extends BasicReporter {
|
|
1074
|
+
formatStack(stack, opts) {
|
|
1075
|
+
const indent = " ".repeat((opts?.errorLevel || 0) + 1);
|
|
1076
|
+
return `
|
|
1077
|
+
${indent}` + parseStack(stack).map((line) => " " + line.replace(/^at +/, (m) => colors$1.gray(m)).replace(/\((.+)\)/, (_$1, m) => `(${colors$1.cyan(m)})`)).join(`
|
|
1078
|
+
${indent}`);
|
|
1079
|
+
}
|
|
1080
|
+
formatType(logObj, isBadge, opts) {
|
|
1081
|
+
const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
|
|
1082
|
+
if (isBadge) return getBgColor(typeColor)(colors$1.black(` ${logObj.type.toUpperCase()} `));
|
|
1083
|
+
const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
|
|
1084
|
+
return _type ? getColor(typeColor)(_type) : "";
|
|
1085
|
+
}
|
|
1086
|
+
formatLogObj(logObj, opts) {
|
|
1087
|
+
const [message, ...additional] = this.formatArgs(logObj.args, opts).split("\n");
|
|
1088
|
+
if (logObj.type === "box") return box(characterFormat(message + (additional.length > 0 ? "\n" + additional.join("\n") : "")), {
|
|
1089
|
+
title: logObj.title ? characterFormat(logObj.title) : undefined,
|
|
1090
|
+
style: logObj.style
|
|
1091
|
+
});
|
|
1092
|
+
const date = this.formatDate(logObj.date, opts);
|
|
1093
|
+
const coloredDate = date && colors$1.gray(date);
|
|
1094
|
+
const isBadge = logObj.badge ?? logObj.level < 2;
|
|
1095
|
+
const type = this.formatType(logObj, isBadge, opts);
|
|
1096
|
+
const tag = logObj.tag ? colors$1.gray(logObj.tag) : "";
|
|
1097
|
+
let line;
|
|
1098
|
+
const left = this.filterAndJoin([type, characterFormat(message)]);
|
|
1099
|
+
const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
|
|
1100
|
+
const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
|
|
1101
|
+
line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors$1.gray(`[${right}]`)} ` : "") + left;
|
|
1102
|
+
line += characterFormat(additional.length > 0 ? "\n" + additional.join("\n") : "");
|
|
1103
|
+
if (logObj.type === "trace") {
|
|
1104
|
+
const _err = new Error("Trace: " + logObj.message);
|
|
1105
|
+
line += this.formatStack(_err.stack || "");
|
|
1106
|
+
}
|
|
1107
|
+
return isBadge ? "\n" + line + "\n" : line;
|
|
1108
|
+
}
|
|
1109
|
+
};
|
|
1110
|
+
function characterFormat(str) {
|
|
1111
|
+
return str.replace(/`([^`]+)`/gm, (_$1, m) => colors$1.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_$1, m) => ` ${colors$1.underline(m)} `);
|
|
1112
|
+
}
|
|
1113
|
+
function getColor(color = "white") {
|
|
1114
|
+
return colors$1[color] || colors$1.white;
|
|
1115
|
+
}
|
|
1116
|
+
function getBgColor(color = "bgWhite") {
|
|
1117
|
+
return colors$1[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors$1.bgWhite;
|
|
1118
|
+
}
|
|
1119
|
+
function createConsola(options$1 = {}) {
|
|
1120
|
+
let level = _getDefaultLogLevel();
|
|
1121
|
+
if (process.env.CONSOLA_LEVEL) level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
|
|
1122
|
+
const consola2 = createConsola$1({
|
|
1123
|
+
level,
|
|
1124
|
+
defaults: { level },
|
|
1125
|
+
stdout: process.stdout,
|
|
1126
|
+
stderr: process.stderr,
|
|
1127
|
+
prompt: (...args) => Promise.resolve().then(function() {
|
|
1128
|
+
return require("../shared/prompt-B7tq3GL9.cjs");
|
|
1129
|
+
}).then((m) => m.prompt(...args)),
|
|
1130
|
+
reporters: options$1.reporters || [options$1.fancy ?? !(T || A) ? new FancyReporter() : new BasicReporter()],
|
|
1131
|
+
...options$1
|
|
1132
|
+
});
|
|
1133
|
+
return consola2;
|
|
1134
|
+
}
|
|
1135
|
+
function _getDefaultLogLevel() {
|
|
1136
|
+
if (U) return LogLevels.debug;
|
|
1137
|
+
if (A) return LogLevels.warn;
|
|
1138
|
+
return LogLevels.info;
|
|
1139
|
+
}
|
|
1140
|
+
const consola = createConsola();
|
|
1141
|
+
|
|
186
1142
|
//#endregion
|
|
187
1143
|
//#region src/cli/logger.ts
|
|
188
|
-
const logger = process.env.ROLLDOWN_TEST ? createTestingLogger() :
|
|
1144
|
+
const logger = process.env.ROLLDOWN_TEST ? createTestingLogger() : createConsola({ formatOptions: { date: false } });
|
|
189
1145
|
function createTestingLogger() {
|
|
190
1146
|
const types = [
|
|
191
1147
|
"silent",
|
|
@@ -438,7 +1394,7 @@ function printOutputEntries(entries, sizeAdjustment, distPath) {
|
|
|
438
1394
|
for (const group of CHUNK_GROUPS) {
|
|
439
1395
|
const filtered = entries.filter((e) => e.type === group.type);
|
|
440
1396
|
if (!filtered.length) continue;
|
|
441
|
-
for (const entry of filtered.sort((a, z) => a.size - z.size)) {
|
|
1397
|
+
for (const entry of filtered.sort((a$1, z) => a$1.size - z.size)) {
|
|
442
1398
|
let log = require_binding.colors.dim(withTrailingSlash(distPath));
|
|
443
1399
|
log += require_binding.colors[group.color](entry.fileName.padEnd(sizeAdjustment.longest + 2));
|
|
444
1400
|
log += require_binding.colors.dim(entry.type);
|
|
@@ -527,9 +1483,9 @@ function flattenSchema(schema, base = {}, parent = "") {
|
|
|
527
1483
|
function setNestedProperty(obj, path$2, value) {
|
|
528
1484
|
const keys = path$2.split(".");
|
|
529
1485
|
let current = obj;
|
|
530
|
-
for (let i = 0; i < keys.length - 1; i++) {
|
|
531
|
-
if (!current[keys[i]]) current[keys[i]] = {};
|
|
532
|
-
current = current[keys[i]];
|
|
1486
|
+
for (let i$1 = 0; i$1 < keys.length - 1; i$1++) {
|
|
1487
|
+
if (!current[keys[i$1]]) current[keys[i$1]] = {};
|
|
1488
|
+
current = current[keys[i$1]];
|
|
533
1489
|
}
|
|
534
1490
|
const finalKey = keys[keys.length - 1];
|
|
535
1491
|
Object.defineProperty(current, finalKey, {
|
|
@@ -715,11 +1671,11 @@ function showHelp() {
|
|
|
715
1671
|
logger.log("");
|
|
716
1672
|
logger.log(`${require_binding.colors.bold(require_binding.colors.underline("OPTIONS"))}`);
|
|
717
1673
|
logger.log("");
|
|
718
|
-
logger.log(Object.entries(options).sort(([a], [b]) => {
|
|
719
|
-
if (options[a].short && !options[b].short) return -1;
|
|
720
|
-
if (!options[a].short && options[b].short) return 1;
|
|
721
|
-
if (options[a].short && options[b].short) return options[a].short.localeCompare(options[b].short);
|
|
722
|
-
return a.localeCompare(b);
|
|
1674
|
+
logger.log(Object.entries(options).sort(([a$1], [b]) => {
|
|
1675
|
+
if (options[a$1].short && !options[b].short) return -1;
|
|
1676
|
+
if (!options[a$1].short && options[b].short) return 1;
|
|
1677
|
+
if (options[a$1].short && options[b].short) return options[a$1].short.localeCompare(options[b].short);
|
|
1678
|
+
return a$1.localeCompare(b);
|
|
723
1679
|
}).map(([option, { type, short, hint, description: description$1 }]) => {
|
|
724
1680
|
let optionStr = ` --${option} `;
|
|
725
1681
|
option = camelCaseToKebabCase(option);
|