@rolldown/browser 1.0.0-beta.9-commit.ca4e9dd → 1.0.0-rc.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.
- package/dist/cli-setup.mjs +16 -0
- package/dist/cli.mjs +1084 -1281
- package/dist/config.d.mts +1 -3
- package/dist/config.mjs +7 -5
- package/dist/constructors-B8gqcrFr.js +61 -0
- package/dist/experimental-index.browser.mjs +225 -50
- package/dist/experimental-index.d.mts +164 -76
- package/dist/experimental-index.mjs +220 -60
- package/dist/experimental-runtime-types.d.ts +98 -0
- package/dist/filter-index.d.mts +104 -2
- package/dist/filter-index.mjs +123 -3
- package/dist/get-log-filter.d.mts +7 -0
- package/dist/get-log-filter.mjs +48 -0
- package/dist/index.browser.mjs +242 -2
- package/dist/index.d.mts +4 -3
- package/dist/index.mjs +54 -5
- package/dist/{shared/parse-ast-index-BHaE0ECV.cjs → normalize-string-or-regex-CL-PJZI7.js} +70 -137
- package/dist/parallel-plugin-worker.mjs +26 -33
- package/dist/parallel-plugin.d.mts +7 -7
- package/dist/parse-ast-index.d.mts +5 -6
- package/dist/parse-ast-index.mjs +1 -2
- package/dist/plugins-index.browser.mjs +39 -0
- package/dist/plugins-index.d.mts +30 -0
- package/dist/plugins-index.mjs +39 -0
- package/dist/rolldown-binding.wasi-browser.js +41 -24
- package/dist/rolldown-binding.wasi.cjs +62 -24
- package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
- package/dist/rolldown-build-C4tDS_XC.js +5055 -0
- package/dist/shared/bindingify-input-options-Bp2kpiI8.mjs +2231 -0
- package/dist/shared/composable-filters-CIxSuZSM.mjs +227 -0
- package/dist/shared/constructors-5bt5oBhE.d.mts +28 -0
- package/dist/shared/constructors-BTW-c3jX.mjs +61 -0
- package/dist/shared/define-config-CDlEOpr1.d.mts +3531 -0
- package/dist/shared/define-config-Dlptvz3X.mjs +7 -0
- package/dist/shared/{load-config-vRugYmJ3.mjs → load-config-BBZgIUGN.mjs} +23 -33
- package/dist/shared/logging-Nvu645a7.d.mts +50 -0
- package/dist/shared/{parse-ast-index-vu376yZ1.mjs → logs-B2CASPcx.mjs} +21 -116
- package/dist/shared/normalize-string-or-regex-DIwprzLy.mjs +60 -0
- package/dist/shared/parse-ast-index-2ahkCVK6.mjs +98 -0
- package/dist/shared/{prompt-CxjDC0Gn.cjs → prompt-B6NrDD1-.mjs} +301 -308
- package/dist/shared/rolldown-C0_W0QdY.mjs +42 -0
- package/dist/shared/rolldown-build-DLuUhuNw.mjs +2368 -0
- package/dist/shared/types-CIYK49jr.d.mts +1300 -0
- package/dist/shared/utils-CqMTwlsR.d.mts +22 -0
- package/dist/shared/watch-eIop0yN6.mjs +378 -0
- package/package.json +33 -38
- package/dist/cli.cjs +0 -1748
- package/dist/config.cjs +0 -12
- package/dist/config.d.cts +0 -11
- package/dist/experimental-index.cjs +0 -129
- package/dist/experimental-index.d.cts +0 -96
- package/dist/filter-index.cjs +0 -53
- package/dist/filter-index.d.cts +0 -3
- package/dist/index.cjs +0 -9
- package/dist/index.d.cts +0 -3
- package/dist/parallel-plugin-worker.cjs +0 -33
- package/dist/parallel-plugin-worker.d.cts +0 -1
- package/dist/parallel-plugin.cjs +0 -8
- package/dist/parallel-plugin.d.cts +0 -14
- package/dist/parse-ast-index.cjs +0 -4
- package/dist/parse-ast-index.d.cts +0 -9
- package/dist/shared/chunk-DDkG_k5U.cjs +0 -39
- package/dist/shared/chunk-DSsiIF1Z.mjs +0 -30
- package/dist/shared/define-config.d-D4lKXE9V.d.cts +0 -1165
- package/dist/shared/define-config.d-Dm9iNdt9.d.mts +0 -1165
- package/dist/shared/dist-BMVjvV-v.cjs +0 -249
- package/dist/shared/dist-CAn6dxW6.mjs +0 -153
- package/dist/shared/load-config-42uI5RSv.cjs +0 -125
- package/dist/shared/prompt-GFYxfPw7.mjs +0 -854
- package/dist/shared/src-Cu4_wKhx.mjs +0 -4691
- package/dist/shared/src-CzdOBfDC.cjs +0 -4647
- package/dist/src-DQ33eKZS.js +0 -4333
- /package/dist/{cli.d.cts → cli-setup.d.mts} +0 -0
package/dist/cli.cjs
DELETED
|
@@ -1,1748 +0,0 @@
|
|
|
1
|
-
const require_chunk = require('./shared/chunk-DDkG_k5U.cjs');
|
|
2
|
-
const require_src = require('./shared/src-CzdOBfDC.cjs');
|
|
3
|
-
const require_dist = require('./shared/dist-BMVjvV-v.cjs');
|
|
4
|
-
require('./shared/parse-ast-index-BHaE0ECV.cjs');
|
|
5
|
-
const require_load_config = require('./shared/load-config-42uI5RSv.cjs');
|
|
6
|
-
const node_path = require_chunk.__toESM(require("node:path"));
|
|
7
|
-
const ansis = require_chunk.__toESM(require("ansis"));
|
|
8
|
-
const node_process = require_chunk.__toESM(require("node:process"));
|
|
9
|
-
const node_util = require_chunk.__toESM(require("node:util"));
|
|
10
|
-
const node_tty = require_chunk.__toESM(require("node:tty"));
|
|
11
|
-
const node_perf_hooks = require_chunk.__toESM(require("node:perf_hooks"));
|
|
12
|
-
|
|
13
|
-
//#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/core.mjs
|
|
14
|
-
const LogLevels = {
|
|
15
|
-
silent: Number.NEGATIVE_INFINITY,
|
|
16
|
-
fatal: 0,
|
|
17
|
-
error: 0,
|
|
18
|
-
warn: 1,
|
|
19
|
-
log: 2,
|
|
20
|
-
info: 3,
|
|
21
|
-
success: 3,
|
|
22
|
-
fail: 3,
|
|
23
|
-
ready: 3,
|
|
24
|
-
start: 3,
|
|
25
|
-
box: 3,
|
|
26
|
-
debug: 4,
|
|
27
|
-
trace: 5,
|
|
28
|
-
verbose: Number.POSITIVE_INFINITY
|
|
29
|
-
};
|
|
30
|
-
const LogTypes = {
|
|
31
|
-
silent: { level: -1 },
|
|
32
|
-
fatal: { level: LogLevels.fatal },
|
|
33
|
-
error: { level: LogLevels.error },
|
|
34
|
-
warn: { level: LogLevels.warn },
|
|
35
|
-
log: { level: LogLevels.log },
|
|
36
|
-
info: { level: LogLevels.info },
|
|
37
|
-
success: { level: LogLevels.success },
|
|
38
|
-
fail: { level: LogLevels.fail },
|
|
39
|
-
ready: { level: LogLevels.info },
|
|
40
|
-
start: { level: LogLevels.info },
|
|
41
|
-
box: { level: LogLevels.info },
|
|
42
|
-
debug: { level: LogLevels.debug },
|
|
43
|
-
trace: { level: LogLevels.trace },
|
|
44
|
-
verbose: { level: LogLevels.verbose }
|
|
45
|
-
};
|
|
46
|
-
function isPlainObject$1(value) {
|
|
47
|
-
if (value === null || typeof value !== "object") return false;
|
|
48
|
-
const prototype = Object.getPrototypeOf(value);
|
|
49
|
-
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
|
|
50
|
-
if (Symbol.iterator in value) return false;
|
|
51
|
-
if (Symbol.toStringTag in value) return Object.prototype.toString.call(value) === "[object Module]";
|
|
52
|
-
return true;
|
|
53
|
-
}
|
|
54
|
-
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
55
|
-
if (!isPlainObject$1(defaults)) return _defu(baseObject, {}, namespace, merger);
|
|
56
|
-
const object = Object.assign({}, defaults);
|
|
57
|
-
for (const key in baseObject) {
|
|
58
|
-
if (key === "__proto__" || key === "constructor") continue;
|
|
59
|
-
const value = baseObject[key];
|
|
60
|
-
if (value === null || value === void 0) continue;
|
|
61
|
-
if (merger && merger(object, key, value, namespace)) continue;
|
|
62
|
-
if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
|
|
63
|
-
else if (isPlainObject$1(value) && isPlainObject$1(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
|
|
64
|
-
else object[key] = value;
|
|
65
|
-
}
|
|
66
|
-
return object;
|
|
67
|
-
}
|
|
68
|
-
function createDefu(merger) {
|
|
69
|
-
return (...arguments_) => arguments_.reduce((p, c$1) => _defu(p, c$1, "", merger), {});
|
|
70
|
-
}
|
|
71
|
-
const defu = createDefu();
|
|
72
|
-
function isPlainObject(obj) {
|
|
73
|
-
return Object.prototype.toString.call(obj) === "[object Object]";
|
|
74
|
-
}
|
|
75
|
-
function isLogObj(arg) {
|
|
76
|
-
if (!isPlainObject(arg)) return false;
|
|
77
|
-
if (!arg.message && !arg.args) return false;
|
|
78
|
-
if (arg.stack) return false;
|
|
79
|
-
return true;
|
|
80
|
-
}
|
|
81
|
-
let paused = false;
|
|
82
|
-
const queue = [];
|
|
83
|
-
var Consola = class Consola {
|
|
84
|
-
options;
|
|
85
|
-
_lastLog;
|
|
86
|
-
_mockFn;
|
|
87
|
-
/**
|
|
88
|
-
* Creates an instance of Consola with specified options or defaults.
|
|
89
|
-
*
|
|
90
|
-
* @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
|
|
91
|
-
*/
|
|
92
|
-
constructor(options$1 = {}) {
|
|
93
|
-
const types = options$1.types || LogTypes;
|
|
94
|
-
this.options = defu({
|
|
95
|
-
...options$1,
|
|
96
|
-
defaults: { ...options$1.defaults },
|
|
97
|
-
level: _normalizeLogLevel(options$1.level, types),
|
|
98
|
-
reporters: [...options$1.reporters || []]
|
|
99
|
-
}, {
|
|
100
|
-
types: LogTypes,
|
|
101
|
-
throttle: 1e3,
|
|
102
|
-
throttleMin: 5,
|
|
103
|
-
formatOptions: {
|
|
104
|
-
date: true,
|
|
105
|
-
colors: false,
|
|
106
|
-
compact: true
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
for (const type in types) {
|
|
110
|
-
const defaults = {
|
|
111
|
-
type,
|
|
112
|
-
...this.options.defaults,
|
|
113
|
-
...types[type]
|
|
114
|
-
};
|
|
115
|
-
this[type] = this._wrapLogFn(defaults);
|
|
116
|
-
this[type].raw = this._wrapLogFn(defaults, true);
|
|
117
|
-
}
|
|
118
|
-
if (this.options.mockFn) this.mockTypes();
|
|
119
|
-
this._lastLog = {};
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Gets the current log level of the Consola instance.
|
|
123
|
-
*
|
|
124
|
-
* @returns {number} The current log level.
|
|
125
|
-
*/
|
|
126
|
-
get level() {
|
|
127
|
-
return this.options.level;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Sets the minimum log level that will be output by the instance.
|
|
131
|
-
*
|
|
132
|
-
* @param {number} level - The new log level to set.
|
|
133
|
-
*/
|
|
134
|
-
set level(level) {
|
|
135
|
-
this.options.level = _normalizeLogLevel(level, this.options.types, this.options.level);
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Displays a prompt to the user and returns the response.
|
|
139
|
-
* Throw an error if `prompt` is not supported by the current configuration.
|
|
140
|
-
*
|
|
141
|
-
* @template T
|
|
142
|
-
* @param {string} message - The message to display in the prompt.
|
|
143
|
-
* @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
|
|
144
|
-
* @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
|
|
145
|
-
*/
|
|
146
|
-
prompt(message, opts) {
|
|
147
|
-
if (!this.options.prompt) throw new Error("prompt is not supported!");
|
|
148
|
-
return this.options.prompt(message, opts);
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
|
|
152
|
-
*
|
|
153
|
-
* @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
|
|
154
|
-
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
155
|
-
*/
|
|
156
|
-
create(options$1) {
|
|
157
|
-
const instance = new Consola({
|
|
158
|
-
...this.options,
|
|
159
|
-
...options$1
|
|
160
|
-
});
|
|
161
|
-
if (this._mockFn) instance.mockTypes(this._mockFn);
|
|
162
|
-
return instance;
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Creates a new Consola instance with the specified default log object properties.
|
|
166
|
-
*
|
|
167
|
-
* @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
|
|
168
|
-
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
169
|
-
*/
|
|
170
|
-
withDefaults(defaults) {
|
|
171
|
-
return this.create({
|
|
172
|
-
...this.options,
|
|
173
|
-
defaults: {
|
|
174
|
-
...this.options.defaults,
|
|
175
|
-
...defaults
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
/**
|
|
180
|
-
* Creates a new Consola instance with a specified tag, which will be included in every log.
|
|
181
|
-
*
|
|
182
|
-
* @param {string} tag - The tag to include in each log of the new instance.
|
|
183
|
-
* @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
|
|
184
|
-
*/
|
|
185
|
-
withTag(tag) {
|
|
186
|
-
return this.withDefaults({ tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag });
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Adds a custom reporter to the Consola instance.
|
|
190
|
-
* Reporters will be called for each log message, depending on their implementation and log level.
|
|
191
|
-
*
|
|
192
|
-
* @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
|
|
193
|
-
* @returns {Consola} The current Consola instance.
|
|
194
|
-
*/
|
|
195
|
-
addReporter(reporter) {
|
|
196
|
-
this.options.reporters.push(reporter);
|
|
197
|
-
return this;
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Removes a custom reporter from the Consola instance.
|
|
201
|
-
* If no reporter is specified, all reporters will be removed.
|
|
202
|
-
*
|
|
203
|
-
* @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
|
|
204
|
-
* @returns {Consola} The current Consola instance.
|
|
205
|
-
*/
|
|
206
|
-
removeReporter(reporter) {
|
|
207
|
-
if (reporter) {
|
|
208
|
-
const i$1 = this.options.reporters.indexOf(reporter);
|
|
209
|
-
if (i$1 !== -1) return this.options.reporters.splice(i$1, 1);
|
|
210
|
-
} else this.options.reporters.splice(0);
|
|
211
|
-
return this;
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Replaces all reporters of the Consola instance with the specified array of reporters.
|
|
215
|
-
*
|
|
216
|
-
* @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
|
|
217
|
-
* @returns {Consola} The current Consola instance.
|
|
218
|
-
*/
|
|
219
|
-
setReporters(reporters) {
|
|
220
|
-
this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
|
|
221
|
-
return this;
|
|
222
|
-
}
|
|
223
|
-
wrapAll() {
|
|
224
|
-
this.wrapConsole();
|
|
225
|
-
this.wrapStd();
|
|
226
|
-
}
|
|
227
|
-
restoreAll() {
|
|
228
|
-
this.restoreConsole();
|
|
229
|
-
this.restoreStd();
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* Overrides console methods with Consola logging methods for consistent logging.
|
|
233
|
-
*/
|
|
234
|
-
wrapConsole() {
|
|
235
|
-
for (const type in this.options.types) {
|
|
236
|
-
if (!console["__" + type]) console["__" + type] = console[type];
|
|
237
|
-
console[type] = this[type].raw;
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
/**
|
|
241
|
-
* Restores the original console methods, removing Consola overrides.
|
|
242
|
-
*/
|
|
243
|
-
restoreConsole() {
|
|
244
|
-
for (const type in this.options.types) if (console["__" + type]) {
|
|
245
|
-
console[type] = console["__" + type];
|
|
246
|
-
delete console["__" + type];
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Overrides standard output and error streams to redirect them through Consola.
|
|
251
|
-
*/
|
|
252
|
-
wrapStd() {
|
|
253
|
-
this._wrapStream(this.options.stdout, "log");
|
|
254
|
-
this._wrapStream(this.options.stderr, "log");
|
|
255
|
-
}
|
|
256
|
-
_wrapStream(stream, type) {
|
|
257
|
-
if (!stream) return;
|
|
258
|
-
if (!stream.__write) stream.__write = stream.write;
|
|
259
|
-
stream.write = (data) => {
|
|
260
|
-
this[type].raw(String(data).trim());
|
|
261
|
-
};
|
|
262
|
-
}
|
|
263
|
-
/**
|
|
264
|
-
* Restores the original standard output and error streams, removing the Consola redirection.
|
|
265
|
-
*/
|
|
266
|
-
restoreStd() {
|
|
267
|
-
this._restoreStream(this.options.stdout);
|
|
268
|
-
this._restoreStream(this.options.stderr);
|
|
269
|
-
}
|
|
270
|
-
_restoreStream(stream) {
|
|
271
|
-
if (!stream) return;
|
|
272
|
-
if (stream.__write) {
|
|
273
|
-
stream.write = stream.__write;
|
|
274
|
-
delete stream.__write;
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Pauses logging, queues incoming logs until resumed.
|
|
279
|
-
*/
|
|
280
|
-
pauseLogs() {
|
|
281
|
-
paused = true;
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* Resumes logging, processing any queued logs.
|
|
285
|
-
*/
|
|
286
|
-
resumeLogs() {
|
|
287
|
-
paused = false;
|
|
288
|
-
const _queue = queue.splice(0);
|
|
289
|
-
for (const item of _queue) item[0]._logFn(item[1], item[2]);
|
|
290
|
-
}
|
|
291
|
-
/**
|
|
292
|
-
* Replaces logging methods with mocks if a mock function is provided.
|
|
293
|
-
*
|
|
294
|
-
* @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
|
|
295
|
-
*/
|
|
296
|
-
mockTypes(mockFn) {
|
|
297
|
-
const _mockFn = mockFn || this.options.mockFn;
|
|
298
|
-
this._mockFn = _mockFn;
|
|
299
|
-
if (typeof _mockFn !== "function") return;
|
|
300
|
-
for (const type in this.options.types) {
|
|
301
|
-
this[type] = _mockFn(type, this.options.types[type]) || this[type];
|
|
302
|
-
this[type].raw = this[type];
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
_wrapLogFn(defaults, isRaw) {
|
|
306
|
-
return (...args) => {
|
|
307
|
-
if (paused) {
|
|
308
|
-
queue.push([
|
|
309
|
-
this,
|
|
310
|
-
defaults,
|
|
311
|
-
args,
|
|
312
|
-
isRaw
|
|
313
|
-
]);
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
return this._logFn(defaults, args, isRaw);
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
_logFn(defaults, args, isRaw) {
|
|
320
|
-
if ((defaults.level || 0) > this.level) return false;
|
|
321
|
-
const logObj = {
|
|
322
|
-
date: /* @__PURE__ */ new Date(),
|
|
323
|
-
args: [],
|
|
324
|
-
...defaults,
|
|
325
|
-
level: _normalizeLogLevel(defaults.level, this.options.types)
|
|
326
|
-
};
|
|
327
|
-
if (!isRaw && args.length === 1 && isLogObj(args[0])) Object.assign(logObj, args[0]);
|
|
328
|
-
else logObj.args = [...args];
|
|
329
|
-
if (logObj.message) {
|
|
330
|
-
logObj.args.unshift(logObj.message);
|
|
331
|
-
delete logObj.message;
|
|
332
|
-
}
|
|
333
|
-
if (logObj.additional) {
|
|
334
|
-
if (!Array.isArray(logObj.additional)) logObj.additional = logObj.additional.split("\n");
|
|
335
|
-
logObj.args.push("\n" + logObj.additional.join("\n"));
|
|
336
|
-
delete logObj.additional;
|
|
337
|
-
}
|
|
338
|
-
logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
|
|
339
|
-
logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
|
|
340
|
-
const resolveLog = (newLog = false) => {
|
|
341
|
-
const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
|
|
342
|
-
if (this._lastLog.object && repeated > 0) {
|
|
343
|
-
const args2 = [...this._lastLog.object.args];
|
|
344
|
-
if (repeated > 1) args2.push(`(repeated ${repeated} times)`);
|
|
345
|
-
this._log({
|
|
346
|
-
...this._lastLog.object,
|
|
347
|
-
args: args2
|
|
348
|
-
});
|
|
349
|
-
this._lastLog.count = 1;
|
|
350
|
-
}
|
|
351
|
-
if (newLog) {
|
|
352
|
-
this._lastLog.object = logObj;
|
|
353
|
-
this._log(logObj);
|
|
354
|
-
}
|
|
355
|
-
};
|
|
356
|
-
clearTimeout(this._lastLog.timeout);
|
|
357
|
-
const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
|
|
358
|
-
this._lastLog.time = logObj.date;
|
|
359
|
-
if (diffTime < this.options.throttle) try {
|
|
360
|
-
const serializedLog = JSON.stringify([
|
|
361
|
-
logObj.type,
|
|
362
|
-
logObj.tag,
|
|
363
|
-
logObj.args
|
|
364
|
-
]);
|
|
365
|
-
const isSameLog = this._lastLog.serialized === serializedLog;
|
|
366
|
-
this._lastLog.serialized = serializedLog;
|
|
367
|
-
if (isSameLog) {
|
|
368
|
-
this._lastLog.count = (this._lastLog.count || 0) + 1;
|
|
369
|
-
if (this._lastLog.count > this.options.throttleMin) {
|
|
370
|
-
this._lastLog.timeout = setTimeout(resolveLog, this.options.throttle);
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
} catch {}
|
|
375
|
-
resolveLog(true);
|
|
376
|
-
}
|
|
377
|
-
_log(logObj) {
|
|
378
|
-
for (const reporter of this.options.reporters) reporter.log(logObj, { options: this.options });
|
|
379
|
-
}
|
|
380
|
-
};
|
|
381
|
-
function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
|
|
382
|
-
if (input === void 0) return defaultLevel;
|
|
383
|
-
if (typeof input === "number") return input;
|
|
384
|
-
if (types[input] && types[input].level !== void 0) return types[input].level;
|
|
385
|
-
return defaultLevel;
|
|
386
|
-
}
|
|
387
|
-
Consola.prototype.add = Consola.prototype.addReporter;
|
|
388
|
-
Consola.prototype.remove = Consola.prototype.removeReporter;
|
|
389
|
-
Consola.prototype.clear = Consola.prototype.removeReporter;
|
|
390
|
-
Consola.prototype.withScope = Consola.prototype.withTag;
|
|
391
|
-
Consola.prototype.mock = Consola.prototype.mockTypes;
|
|
392
|
-
Consola.prototype.pause = Consola.prototype.pauseLogs;
|
|
393
|
-
Consola.prototype.resume = Consola.prototype.resumeLogs;
|
|
394
|
-
function createConsola$1(options$1 = {}) {
|
|
395
|
-
return new Consola(options$1);
|
|
396
|
-
}
|
|
397
|
-
|
|
398
|
-
//#endregion
|
|
399
|
-
//#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs
|
|
400
|
-
function parseStack(stack, message) {
|
|
401
|
-
const cwd = process.cwd() + node_path.sep;
|
|
402
|
-
const lines = stack.split("\n").splice(message.split("\n").length).map((l$1) => l$1.trim().replace("file://", "").replace(cwd, ""));
|
|
403
|
-
return lines;
|
|
404
|
-
}
|
|
405
|
-
function writeStream(data, stream) {
|
|
406
|
-
const write = stream.__write || stream.write;
|
|
407
|
-
return write.call(stream, data);
|
|
408
|
-
}
|
|
409
|
-
const bracket = (x) => x ? `[${x}]` : "";
|
|
410
|
-
var BasicReporter = class {
|
|
411
|
-
formatStack(stack, message, opts) {
|
|
412
|
-
const indent = " ".repeat((opts?.errorLevel || 0) + 1);
|
|
413
|
-
return indent + parseStack(stack, message).join(`
|
|
414
|
-
${indent}`);
|
|
415
|
-
}
|
|
416
|
-
formatError(err, opts) {
|
|
417
|
-
const message = err.message ?? (0, node_util.formatWithOptions)(opts, err);
|
|
418
|
-
const stack = err.stack ? this.formatStack(err.stack, message, opts) : "";
|
|
419
|
-
const level = opts?.errorLevel || 0;
|
|
420
|
-
const causedPrefix = level > 0 ? `${" ".repeat(level)}[cause]: ` : "";
|
|
421
|
-
const causedError = err.cause ? "\n\n" + this.formatError(err.cause, {
|
|
422
|
-
...opts,
|
|
423
|
-
errorLevel: level + 1
|
|
424
|
-
}) : "";
|
|
425
|
-
return causedPrefix + message + "\n" + stack + causedError;
|
|
426
|
-
}
|
|
427
|
-
formatArgs(args, opts) {
|
|
428
|
-
const _args = args.map((arg) => {
|
|
429
|
-
if (arg && typeof arg.stack === "string") return this.formatError(arg, opts);
|
|
430
|
-
return arg;
|
|
431
|
-
});
|
|
432
|
-
return (0, node_util.formatWithOptions)(opts, ..._args);
|
|
433
|
-
}
|
|
434
|
-
formatDate(date, opts) {
|
|
435
|
-
return opts.date ? date.toLocaleTimeString() : "";
|
|
436
|
-
}
|
|
437
|
-
filterAndJoin(arr) {
|
|
438
|
-
return arr.filter(Boolean).join(" ");
|
|
439
|
-
}
|
|
440
|
-
formatLogObj(logObj, opts) {
|
|
441
|
-
const message = this.formatArgs(logObj.args, opts);
|
|
442
|
-
if (logObj.type === "box") return "\n" + [
|
|
443
|
-
bracket(logObj.tag),
|
|
444
|
-
logObj.title && logObj.title,
|
|
445
|
-
...message.split("\n")
|
|
446
|
-
].filter(Boolean).map((l$1) => " > " + l$1).join("\n") + "\n";
|
|
447
|
-
return this.filterAndJoin([
|
|
448
|
-
bracket(logObj.type),
|
|
449
|
-
bracket(logObj.tag),
|
|
450
|
-
message
|
|
451
|
-
]);
|
|
452
|
-
}
|
|
453
|
-
log(logObj, ctx) {
|
|
454
|
-
const line = this.formatLogObj(logObj, {
|
|
455
|
-
columns: ctx.options.stdout.columns || 0,
|
|
456
|
-
...ctx.options.formatOptions
|
|
457
|
-
});
|
|
458
|
-
return writeStream(line + "\n", logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
|
|
459
|
-
}
|
|
460
|
-
};
|
|
461
|
-
|
|
462
|
-
//#endregion
|
|
463
|
-
//#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs
|
|
464
|
-
const { env = {}, argv = [], platform = "" } = typeof process === "undefined" ? {} : process;
|
|
465
|
-
const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
|
|
466
|
-
const isForced = "FORCE_COLOR" in env || argv.includes("--color");
|
|
467
|
-
const isWindows = platform === "win32";
|
|
468
|
-
const isDumbTerminal = env.TERM === "dumb";
|
|
469
|
-
const isCompatibleTerminal = node_tty && node_tty.isatty && node_tty.isatty(1) && env.TERM && !isDumbTerminal;
|
|
470
|
-
const isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
|
|
471
|
-
const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
|
|
472
|
-
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)) {
|
|
473
|
-
return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
|
|
474
|
-
}
|
|
475
|
-
function clearBleed(index, string, open, close, replace) {
|
|
476
|
-
return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
|
|
477
|
-
}
|
|
478
|
-
function filterEmpty(open, close, replace = open, at = open.length + 1) {
|
|
479
|
-
return (string) => string || !(string === "" || string === void 0) ? clearBleed(("" + string).indexOf(close, at), string, open, close, replace) : "";
|
|
480
|
-
}
|
|
481
|
-
function init(open, close, replace) {
|
|
482
|
-
return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
|
|
483
|
-
}
|
|
484
|
-
const colorDefs = {
|
|
485
|
-
reset: init(0, 0),
|
|
486
|
-
bold: init(1, 22, "\x1B[22m\x1B[1m"),
|
|
487
|
-
dim: init(2, 22, "\x1B[22m\x1B[2m"),
|
|
488
|
-
italic: init(3, 23),
|
|
489
|
-
underline: init(4, 24),
|
|
490
|
-
inverse: init(7, 27),
|
|
491
|
-
hidden: init(8, 28),
|
|
492
|
-
strikethrough: init(9, 29),
|
|
493
|
-
black: init(30, 39),
|
|
494
|
-
red: init(31, 39),
|
|
495
|
-
green: init(32, 39),
|
|
496
|
-
yellow: init(33, 39),
|
|
497
|
-
blue: init(34, 39),
|
|
498
|
-
magenta: init(35, 39),
|
|
499
|
-
cyan: init(36, 39),
|
|
500
|
-
white: init(37, 39),
|
|
501
|
-
gray: init(90, 39),
|
|
502
|
-
bgBlack: init(40, 49),
|
|
503
|
-
bgRed: init(41, 49),
|
|
504
|
-
bgGreen: init(42, 49),
|
|
505
|
-
bgYellow: init(43, 49),
|
|
506
|
-
bgBlue: init(44, 49),
|
|
507
|
-
bgMagenta: init(45, 49),
|
|
508
|
-
bgCyan: init(46, 49),
|
|
509
|
-
bgWhite: init(47, 49),
|
|
510
|
-
blackBright: init(90, 39),
|
|
511
|
-
redBright: init(91, 39),
|
|
512
|
-
greenBright: init(92, 39),
|
|
513
|
-
yellowBright: init(93, 39),
|
|
514
|
-
blueBright: init(94, 39),
|
|
515
|
-
magentaBright: init(95, 39),
|
|
516
|
-
cyanBright: init(96, 39),
|
|
517
|
-
whiteBright: init(97, 39),
|
|
518
|
-
bgBlackBright: init(100, 49),
|
|
519
|
-
bgRedBright: init(101, 49),
|
|
520
|
-
bgGreenBright: init(102, 49),
|
|
521
|
-
bgYellowBright: init(103, 49),
|
|
522
|
-
bgBlueBright: init(104, 49),
|
|
523
|
-
bgMagentaBright: init(105, 49),
|
|
524
|
-
bgCyanBright: init(106, 49),
|
|
525
|
-
bgWhiteBright: init(107, 49)
|
|
526
|
-
};
|
|
527
|
-
function createColors(useColor = isColorSupported) {
|
|
528
|
-
return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
|
|
529
|
-
}
|
|
530
|
-
const colors$2 = createColors();
|
|
531
|
-
function getColor$1(color, fallback = "reset") {
|
|
532
|
-
return colors$2[color] || colors$2[fallback];
|
|
533
|
-
}
|
|
534
|
-
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("|");
|
|
535
|
-
function stripAnsi(text) {
|
|
536
|
-
return text.replace(new RegExp(ansiRegex$1, "g"), "");
|
|
537
|
-
}
|
|
538
|
-
const boxStylePresets = {
|
|
539
|
-
solid: {
|
|
540
|
-
tl: "┌",
|
|
541
|
-
tr: "┐",
|
|
542
|
-
bl: "└",
|
|
543
|
-
br: "┘",
|
|
544
|
-
h: "─",
|
|
545
|
-
v: "│"
|
|
546
|
-
},
|
|
547
|
-
double: {
|
|
548
|
-
tl: "╔",
|
|
549
|
-
tr: "╗",
|
|
550
|
-
bl: "╚",
|
|
551
|
-
br: "╝",
|
|
552
|
-
h: "═",
|
|
553
|
-
v: "║"
|
|
554
|
-
},
|
|
555
|
-
doubleSingle: {
|
|
556
|
-
tl: "╓",
|
|
557
|
-
tr: "╖",
|
|
558
|
-
bl: "╙",
|
|
559
|
-
br: "╜",
|
|
560
|
-
h: "─",
|
|
561
|
-
v: "║"
|
|
562
|
-
},
|
|
563
|
-
doubleSingleRounded: {
|
|
564
|
-
tl: "╭",
|
|
565
|
-
tr: "╮",
|
|
566
|
-
bl: "╰",
|
|
567
|
-
br: "╯",
|
|
568
|
-
h: "─",
|
|
569
|
-
v: "║"
|
|
570
|
-
},
|
|
571
|
-
singleThick: {
|
|
572
|
-
tl: "┏",
|
|
573
|
-
tr: "┓",
|
|
574
|
-
bl: "┗",
|
|
575
|
-
br: "┛",
|
|
576
|
-
h: "━",
|
|
577
|
-
v: "┃"
|
|
578
|
-
},
|
|
579
|
-
singleDouble: {
|
|
580
|
-
tl: "╒",
|
|
581
|
-
tr: "╕",
|
|
582
|
-
bl: "╘",
|
|
583
|
-
br: "╛",
|
|
584
|
-
h: "═",
|
|
585
|
-
v: "│"
|
|
586
|
-
},
|
|
587
|
-
singleDoubleRounded: {
|
|
588
|
-
tl: "╭",
|
|
589
|
-
tr: "╮",
|
|
590
|
-
bl: "╰",
|
|
591
|
-
br: "╯",
|
|
592
|
-
h: "═",
|
|
593
|
-
v: "│"
|
|
594
|
-
},
|
|
595
|
-
rounded: {
|
|
596
|
-
tl: "╭",
|
|
597
|
-
tr: "╮",
|
|
598
|
-
bl: "╰",
|
|
599
|
-
br: "╯",
|
|
600
|
-
h: "─",
|
|
601
|
-
v: "│"
|
|
602
|
-
}
|
|
603
|
-
};
|
|
604
|
-
const defaultStyle = {
|
|
605
|
-
borderColor: "white",
|
|
606
|
-
borderStyle: "rounded",
|
|
607
|
-
valign: "center",
|
|
608
|
-
padding: 2,
|
|
609
|
-
marginLeft: 1,
|
|
610
|
-
marginTop: 1,
|
|
611
|
-
marginBottom: 1
|
|
612
|
-
};
|
|
613
|
-
function box(text, _opts = {}) {
|
|
614
|
-
const opts = {
|
|
615
|
-
..._opts,
|
|
616
|
-
style: {
|
|
617
|
-
...defaultStyle,
|
|
618
|
-
..._opts.style
|
|
619
|
-
}
|
|
620
|
-
};
|
|
621
|
-
const textLines = text.split("\n");
|
|
622
|
-
const boxLines = [];
|
|
623
|
-
const _color = getColor$1(opts.style.borderColor);
|
|
624
|
-
const borderStyle = { ...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle };
|
|
625
|
-
if (_color) for (const key in borderStyle) borderStyle[key] = _color(borderStyle[key]);
|
|
626
|
-
const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
|
|
627
|
-
const height = textLines.length + paddingOffset;
|
|
628
|
-
const width = Math.max(...textLines.map((line) => stripAnsi(line).length), opts.title ? stripAnsi(opts.title).length : 0) + paddingOffset;
|
|
629
|
-
const widthOffset = width + paddingOffset;
|
|
630
|
-
const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
|
|
631
|
-
if (opts.style.marginTop > 0) boxLines.push("".repeat(opts.style.marginTop));
|
|
632
|
-
if (opts.title) {
|
|
633
|
-
const title = _color ? _color(opts.title) : opts.title;
|
|
634
|
-
const left = borderStyle.h.repeat(Math.floor((width - stripAnsi(opts.title).length) / 2));
|
|
635
|
-
const right = borderStyle.h.repeat(width - stripAnsi(opts.title).length - stripAnsi(left).length + paddingOffset);
|
|
636
|
-
boxLines.push(`${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`);
|
|
637
|
-
} else boxLines.push(`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`);
|
|
638
|
-
const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
|
|
639
|
-
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}`);
|
|
640
|
-
else {
|
|
641
|
-
const line = textLines[i$1 - valignOffset];
|
|
642
|
-
const left = " ".repeat(paddingOffset);
|
|
643
|
-
const right = " ".repeat(width - stripAnsi(line).length);
|
|
644
|
-
boxLines.push(`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`);
|
|
645
|
-
}
|
|
646
|
-
boxLines.push(`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`);
|
|
647
|
-
if (opts.style.marginBottom > 0) boxLines.push("".repeat(opts.style.marginBottom));
|
|
648
|
-
return boxLines.join("\n");
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
//#endregion
|
|
652
|
-
//#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/index.mjs
|
|
653
|
-
const r = Object.create(null), i = (e) => globalThis.process?.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? r : globalThis), o = new Proxy(r, {
|
|
654
|
-
get(e, s$1) {
|
|
655
|
-
return i()[s$1] ?? r[s$1];
|
|
656
|
-
},
|
|
657
|
-
has(e, s$1) {
|
|
658
|
-
const E = i();
|
|
659
|
-
return s$1 in E || s$1 in r;
|
|
660
|
-
},
|
|
661
|
-
set(e, s$1, E) {
|
|
662
|
-
const B = i(true);
|
|
663
|
-
return B[s$1] = E, true;
|
|
664
|
-
},
|
|
665
|
-
deleteProperty(e, s$1) {
|
|
666
|
-
if (!s$1) return false;
|
|
667
|
-
const E = i(true);
|
|
668
|
-
return delete E[s$1], true;
|
|
669
|
-
},
|
|
670
|
-
ownKeys() {
|
|
671
|
-
const e = i(true);
|
|
672
|
-
return Object.keys(e);
|
|
673
|
-
}
|
|
674
|
-
}), t = typeof process < "u" && process.env && process.env.NODE_ENV || "", f = [
|
|
675
|
-
["APPVEYOR"],
|
|
676
|
-
[
|
|
677
|
-
"AWS_AMPLIFY",
|
|
678
|
-
"AWS_APP_ID",
|
|
679
|
-
{ ci: true }
|
|
680
|
-
],
|
|
681
|
-
["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],
|
|
682
|
-
["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],
|
|
683
|
-
["APPCIRCLE", "AC_APPCIRCLE"],
|
|
684
|
-
["BAMBOO", "bamboo_planKey"],
|
|
685
|
-
["BITBUCKET", "BITBUCKET_COMMIT"],
|
|
686
|
-
["BITRISE", "BITRISE_IO"],
|
|
687
|
-
["BUDDY", "BUDDY_WORKSPACE_ID"],
|
|
688
|
-
["BUILDKITE"],
|
|
689
|
-
["CIRCLE", "CIRCLECI"],
|
|
690
|
-
["CIRRUS", "CIRRUS_CI"],
|
|
691
|
-
[
|
|
692
|
-
"CLOUDFLARE_PAGES",
|
|
693
|
-
"CF_PAGES",
|
|
694
|
-
{ ci: true }
|
|
695
|
-
],
|
|
696
|
-
["CODEBUILD", "CODEBUILD_BUILD_ARN"],
|
|
697
|
-
["CODEFRESH", "CF_BUILD_ID"],
|
|
698
|
-
["DRONE"],
|
|
699
|
-
["DRONE", "DRONE_BUILD_EVENT"],
|
|
700
|
-
["DSARI"],
|
|
701
|
-
["GITHUB_ACTIONS"],
|
|
702
|
-
["GITLAB", "GITLAB_CI"],
|
|
703
|
-
["GITLAB", "CI_MERGE_REQUEST_ID"],
|
|
704
|
-
["GOCD", "GO_PIPELINE_LABEL"],
|
|
705
|
-
["LAYERCI"],
|
|
706
|
-
["HUDSON", "HUDSON_URL"],
|
|
707
|
-
["JENKINS", "JENKINS_URL"],
|
|
708
|
-
["MAGNUM"],
|
|
709
|
-
["NETLIFY"],
|
|
710
|
-
[
|
|
711
|
-
"NETLIFY",
|
|
712
|
-
"NETLIFY_LOCAL",
|
|
713
|
-
{ ci: false }
|
|
714
|
-
],
|
|
715
|
-
["NEVERCODE"],
|
|
716
|
-
["RENDER"],
|
|
717
|
-
["SAIL", "SAILCI"],
|
|
718
|
-
["SEMAPHORE"],
|
|
719
|
-
["SCREWDRIVER"],
|
|
720
|
-
["SHIPPABLE"],
|
|
721
|
-
["SOLANO", "TDDIUM"],
|
|
722
|
-
["STRIDER"],
|
|
723
|
-
["TEAMCITY", "TEAMCITY_VERSION"],
|
|
724
|
-
["TRAVIS"],
|
|
725
|
-
["VERCEL", "NOW_BUILDER"],
|
|
726
|
-
[
|
|
727
|
-
"VERCEL",
|
|
728
|
-
"VERCEL",
|
|
729
|
-
{ ci: false }
|
|
730
|
-
],
|
|
731
|
-
[
|
|
732
|
-
"VERCEL",
|
|
733
|
-
"VERCEL_ENV",
|
|
734
|
-
{ ci: false }
|
|
735
|
-
],
|
|
736
|
-
["APPCENTER", "APPCENTER_BUILD_ID"],
|
|
737
|
-
[
|
|
738
|
-
"CODESANDBOX",
|
|
739
|
-
"CODESANDBOX_SSE",
|
|
740
|
-
{ ci: false }
|
|
741
|
-
],
|
|
742
|
-
[
|
|
743
|
-
"CODESANDBOX",
|
|
744
|
-
"CODESANDBOX_HOST",
|
|
745
|
-
{ ci: false }
|
|
746
|
-
],
|
|
747
|
-
["STACKBLITZ"],
|
|
748
|
-
["STORMKIT"],
|
|
749
|
-
["CLEAVR"],
|
|
750
|
-
["ZEABUR"],
|
|
751
|
-
[
|
|
752
|
-
"CODESPHERE",
|
|
753
|
-
"CODESPHERE_APP_ID",
|
|
754
|
-
{ ci: true }
|
|
755
|
-
],
|
|
756
|
-
["RAILWAY", "RAILWAY_PROJECT_ID"],
|
|
757
|
-
["RAILWAY", "RAILWAY_SERVICE_ID"],
|
|
758
|
-
["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"],
|
|
759
|
-
[
|
|
760
|
-
"FIREBASE_APP_HOSTING",
|
|
761
|
-
"FIREBASE_APP_HOSTING",
|
|
762
|
-
{ ci: true }
|
|
763
|
-
]
|
|
764
|
-
];
|
|
765
|
-
function b() {
|
|
766
|
-
if (globalThis.process?.env) for (const e of f) {
|
|
767
|
-
const s$1 = e[1] || e[0];
|
|
768
|
-
if (globalThis.process?.env[s$1]) return {
|
|
769
|
-
name: e[0].toLowerCase(),
|
|
770
|
-
...e[2]
|
|
771
|
-
};
|
|
772
|
-
}
|
|
773
|
-
return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? {
|
|
774
|
-
name: "stackblitz",
|
|
775
|
-
ci: false
|
|
776
|
-
} : {
|
|
777
|
-
name: "",
|
|
778
|
-
ci: false
|
|
779
|
-
};
|
|
780
|
-
}
|
|
781
|
-
const l = b();
|
|
782
|
-
l.name;
|
|
783
|
-
function n(e) {
|
|
784
|
-
return e ? e !== "false" : false;
|
|
785
|
-
}
|
|
786
|
-
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);
|
|
787
|
-
n(o.MINIMAL);
|
|
788
|
-
const A = /^win/i.test(I);
|
|
789
|
-
!n(o.NO_COLOR) && (n(o.FORCE_COLOR) || (a || A) && o.TERM);
|
|
790
|
-
const C = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
|
|
791
|
-
Number(C?.split(".")[0]);
|
|
792
|
-
const y = globalThis.process || Object.create(null), _ = { versions: {} };
|
|
793
|
-
new Proxy(y, { get(e, s$1) {
|
|
794
|
-
if (s$1 === "env") return o;
|
|
795
|
-
if (s$1 in e) return e[s$1];
|
|
796
|
-
if (s$1 in _) return _[s$1];
|
|
797
|
-
} });
|
|
798
|
-
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 = [
|
|
799
|
-
[S, "netlify"],
|
|
800
|
-
[u, "edge-light"],
|
|
801
|
-
[N, "workerd"],
|
|
802
|
-
[L, "fastly"],
|
|
803
|
-
[D, "deno"],
|
|
804
|
-
[O, "bun"],
|
|
805
|
-
[c, "node"]
|
|
806
|
-
];
|
|
807
|
-
function G() {
|
|
808
|
-
const e = F.find((s$1) => s$1[0]);
|
|
809
|
-
if (e) return { name: e[1] };
|
|
810
|
-
}
|
|
811
|
-
const P = G();
|
|
812
|
-
P?.name;
|
|
813
|
-
function ansiRegex({ onlyFirst = false } = {}) {
|
|
814
|
-
const ST = "(?:\\u0007|\\u001B\\u005C|\\u009C)";
|
|
815
|
-
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("|");
|
|
816
|
-
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
817
|
-
}
|
|
818
|
-
const regex = ansiRegex();
|
|
819
|
-
function stripAnsi$1(string) {
|
|
820
|
-
if (typeof string !== "string") throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
|
|
821
|
-
return string.replace(regex, "");
|
|
822
|
-
}
|
|
823
|
-
function isAmbiguous(x) {
|
|
824
|
-
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;
|
|
825
|
-
}
|
|
826
|
-
function isFullWidth(x) {
|
|
827
|
-
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
828
|
-
}
|
|
829
|
-
function isWide(x) {
|
|
830
|
-
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;
|
|
831
|
-
}
|
|
832
|
-
function validate(codePoint) {
|
|
833
|
-
if (!Number.isSafeInteger(codePoint)) throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
|
|
834
|
-
}
|
|
835
|
-
function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
|
|
836
|
-
validate(codePoint);
|
|
837
|
-
if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) return 2;
|
|
838
|
-
return 1;
|
|
839
|
-
}
|
|
840
|
-
const emojiRegex = () => {
|
|
841
|
-
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;
|
|
842
|
-
};
|
|
843
|
-
const segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : { segment: (str) => str.split("") };
|
|
844
|
-
const defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
|
|
845
|
-
function stringWidth$1(string, options$1 = {}) {
|
|
846
|
-
if (typeof string !== "string" || string.length === 0) return 0;
|
|
847
|
-
const { ambiguousIsNarrow = true, countAnsiEscapeCodes = false } = options$1;
|
|
848
|
-
if (!countAnsiEscapeCodes) string = stripAnsi$1(string);
|
|
849
|
-
if (string.length === 0) return 0;
|
|
850
|
-
let width = 0;
|
|
851
|
-
const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
|
|
852
|
-
for (const { segment: character } of segmenter.segment(string)) {
|
|
853
|
-
const codePoint = character.codePointAt(0);
|
|
854
|
-
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) continue;
|
|
855
|
-
if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) continue;
|
|
856
|
-
if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) continue;
|
|
857
|
-
if (codePoint >= 55296 && codePoint <= 57343) continue;
|
|
858
|
-
if (codePoint >= 65024 && codePoint <= 65039) continue;
|
|
859
|
-
if (defaultIgnorableCodePointRegex.test(character)) continue;
|
|
860
|
-
if (emojiRegex().test(character)) {
|
|
861
|
-
width += 2;
|
|
862
|
-
continue;
|
|
863
|
-
}
|
|
864
|
-
width += eastAsianWidth(codePoint, eastAsianWidthOptions);
|
|
865
|
-
}
|
|
866
|
-
return width;
|
|
867
|
-
}
|
|
868
|
-
function isUnicodeSupported() {
|
|
869
|
-
const { env: env$1 } = node_process.default;
|
|
870
|
-
const { TERM, TERM_PROGRAM } = env$1;
|
|
871
|
-
if (node_process.default.platform !== "win32") return TERM !== "linux";
|
|
872
|
-
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";
|
|
873
|
-
}
|
|
874
|
-
const TYPE_COLOR_MAP = {
|
|
875
|
-
info: "cyan",
|
|
876
|
-
fail: "red",
|
|
877
|
-
success: "green",
|
|
878
|
-
ready: "green",
|
|
879
|
-
start: "magenta"
|
|
880
|
-
};
|
|
881
|
-
const LEVEL_COLOR_MAP = {
|
|
882
|
-
0: "red",
|
|
883
|
-
1: "yellow"
|
|
884
|
-
};
|
|
885
|
-
const unicode = isUnicodeSupported();
|
|
886
|
-
const s = (c$1, fallback) => unicode ? c$1 : fallback;
|
|
887
|
-
const TYPE_ICONS = {
|
|
888
|
-
error: s("✖", "×"),
|
|
889
|
-
fatal: s("✖", "×"),
|
|
890
|
-
ready: s("✔", "√"),
|
|
891
|
-
warn: s("⚠", "‼"),
|
|
892
|
-
info: s("ℹ", "i"),
|
|
893
|
-
success: s("✔", "√"),
|
|
894
|
-
debug: s("⚙", "D"),
|
|
895
|
-
trace: s("→", "→"),
|
|
896
|
-
fail: s("✖", "×"),
|
|
897
|
-
start: s("◐", "o"),
|
|
898
|
-
log: ""
|
|
899
|
-
};
|
|
900
|
-
function stringWidth(str) {
|
|
901
|
-
const hasICU = typeof Intl === "object";
|
|
902
|
-
if (!hasICU || !Intl.Segmenter) return stripAnsi(str).length;
|
|
903
|
-
return stringWidth$1(str);
|
|
904
|
-
}
|
|
905
|
-
var FancyReporter = class extends BasicReporter {
|
|
906
|
-
formatStack(stack, message, opts) {
|
|
907
|
-
const indent = " ".repeat((opts?.errorLevel || 0) + 1);
|
|
908
|
-
return `
|
|
909
|
-
${indent}` + parseStack(stack, message).map((line) => " " + line.replace(/^at +/, (m) => colors$2.gray(m)).replace(/\((.+)\)/, (_$1, m) => `(${colors$2.cyan(m)})`)).join(`
|
|
910
|
-
${indent}`);
|
|
911
|
-
}
|
|
912
|
-
formatType(logObj, isBadge, opts) {
|
|
913
|
-
const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
|
|
914
|
-
if (isBadge) return getBgColor(typeColor)(colors$2.black(` ${logObj.type.toUpperCase()} `));
|
|
915
|
-
const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
|
|
916
|
-
return _type ? getColor(typeColor)(_type) : "";
|
|
917
|
-
}
|
|
918
|
-
formatLogObj(logObj, opts) {
|
|
919
|
-
const [message, ...additional] = this.formatArgs(logObj.args, opts).split("\n");
|
|
920
|
-
if (logObj.type === "box") return box(characterFormat(message + (additional.length > 0 ? "\n" + additional.join("\n") : "")), {
|
|
921
|
-
title: logObj.title ? characterFormat(logObj.title) : void 0,
|
|
922
|
-
style: logObj.style
|
|
923
|
-
});
|
|
924
|
-
const date = this.formatDate(logObj.date, opts);
|
|
925
|
-
const coloredDate = date && colors$2.gray(date);
|
|
926
|
-
const isBadge = logObj.badge ?? logObj.level < 2;
|
|
927
|
-
const type = this.formatType(logObj, isBadge, opts);
|
|
928
|
-
const tag = logObj.tag ? colors$2.gray(logObj.tag) : "";
|
|
929
|
-
let line;
|
|
930
|
-
const left = this.filterAndJoin([type, characterFormat(message)]);
|
|
931
|
-
const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
|
|
932
|
-
const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
|
|
933
|
-
line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors$2.gray(`[${right}]`)} ` : "") + left;
|
|
934
|
-
line += characterFormat(additional.length > 0 ? "\n" + additional.join("\n") : "");
|
|
935
|
-
if (logObj.type === "trace") {
|
|
936
|
-
const _err = new Error("Trace: " + logObj.message);
|
|
937
|
-
line += this.formatStack(_err.stack || "", _err.message);
|
|
938
|
-
}
|
|
939
|
-
return isBadge ? "\n" + line + "\n" : line;
|
|
940
|
-
}
|
|
941
|
-
};
|
|
942
|
-
function characterFormat(str) {
|
|
943
|
-
return str.replace(/`([^`]+)`/gm, (_$1, m) => colors$2.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_$1, m) => ` ${colors$2.underline(m)} `);
|
|
944
|
-
}
|
|
945
|
-
function getColor(color = "white") {
|
|
946
|
-
return colors$2[color] || colors$2.white;
|
|
947
|
-
}
|
|
948
|
-
function getBgColor(color = "bgWhite") {
|
|
949
|
-
return colors$2[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors$2.bgWhite;
|
|
950
|
-
}
|
|
951
|
-
function createConsola(options$1 = {}) {
|
|
952
|
-
let level = _getDefaultLogLevel();
|
|
953
|
-
if (process.env.CONSOLA_LEVEL) level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
|
|
954
|
-
const consola2 = createConsola$1({
|
|
955
|
-
level,
|
|
956
|
-
defaults: { level },
|
|
957
|
-
stdout: process.stdout,
|
|
958
|
-
stderr: process.stderr,
|
|
959
|
-
prompt: (...args) => Promise.resolve().then(function() {
|
|
960
|
-
return require("./shared/prompt-CxjDC0Gn.cjs");
|
|
961
|
-
}).then((m) => m.prompt(...args)),
|
|
962
|
-
reporters: options$1.reporters || [options$1.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
|
|
963
|
-
...options$1
|
|
964
|
-
});
|
|
965
|
-
return consola2;
|
|
966
|
-
}
|
|
967
|
-
function _getDefaultLogLevel() {
|
|
968
|
-
if (g) return LogLevels.debug;
|
|
969
|
-
if (R) return LogLevels.warn;
|
|
970
|
-
return LogLevels.info;
|
|
971
|
-
}
|
|
972
|
-
const consola = createConsola();
|
|
973
|
-
|
|
974
|
-
//#endregion
|
|
975
|
-
//#region src/cli/logger.ts
|
|
976
|
-
/**
|
|
977
|
-
* Console logger
|
|
978
|
-
*/
|
|
979
|
-
const logger = process.env.ROLLDOWN_TEST ? createTestingLogger() : createConsola({ formatOptions: { date: false } });
|
|
980
|
-
function createTestingLogger() {
|
|
981
|
-
const types = [
|
|
982
|
-
"silent",
|
|
983
|
-
"fatal",
|
|
984
|
-
"error",
|
|
985
|
-
"warn",
|
|
986
|
-
"log",
|
|
987
|
-
"info",
|
|
988
|
-
"success",
|
|
989
|
-
"fail",
|
|
990
|
-
"ready",
|
|
991
|
-
"start",
|
|
992
|
-
"box",
|
|
993
|
-
"debug",
|
|
994
|
-
"trace",
|
|
995
|
-
"verbose"
|
|
996
|
-
];
|
|
997
|
-
const ret = Object.create(null);
|
|
998
|
-
for (const type of types) ret[type] = console.log;
|
|
999
|
-
return ret;
|
|
1000
|
-
}
|
|
1001
|
-
|
|
1002
|
-
//#endregion
|
|
1003
|
-
//#region src/cli/arguments/alias.ts
|
|
1004
|
-
const alias = {
|
|
1005
|
-
config: {
|
|
1006
|
-
abbreviation: "c",
|
|
1007
|
-
hint: "filename"
|
|
1008
|
-
},
|
|
1009
|
-
help: { abbreviation: "h" },
|
|
1010
|
-
version: { abbreviation: "v" },
|
|
1011
|
-
watch: { abbreviation: "w" },
|
|
1012
|
-
dir: { abbreviation: "d" },
|
|
1013
|
-
file: { abbreviation: "o" },
|
|
1014
|
-
external: { abbreviation: "e" },
|
|
1015
|
-
format: { abbreviation: "f" },
|
|
1016
|
-
name: { abbreviation: "n" },
|
|
1017
|
-
globals: { abbreviation: "g" },
|
|
1018
|
-
sourcemap: {
|
|
1019
|
-
abbreviation: "s",
|
|
1020
|
-
default: true
|
|
1021
|
-
},
|
|
1022
|
-
minify: { abbreviation: "m" },
|
|
1023
|
-
platform: { abbreviation: "p" },
|
|
1024
|
-
assetFileNames: { hint: "name" },
|
|
1025
|
-
chunkFileNames: { hint: "name" },
|
|
1026
|
-
entryFileNames: { hint: "name" },
|
|
1027
|
-
externalLiveBindings: {
|
|
1028
|
-
default: true,
|
|
1029
|
-
reverse: true
|
|
1030
|
-
},
|
|
1031
|
-
treeshake: {
|
|
1032
|
-
default: true,
|
|
1033
|
-
reverse: true
|
|
1034
|
-
},
|
|
1035
|
-
moduleTypes: { hint: "types" }
|
|
1036
|
-
};
|
|
1037
|
-
|
|
1038
|
-
//#endregion
|
|
1039
|
-
//#region src/cli/arguments/utils.ts
|
|
1040
|
-
const priority = [
|
|
1041
|
-
"object",
|
|
1042
|
-
"array",
|
|
1043
|
-
"string",
|
|
1044
|
-
"number",
|
|
1045
|
-
"boolean"
|
|
1046
|
-
];
|
|
1047
|
-
function getSchemaType(schema) {
|
|
1048
|
-
if ("anyOf" in schema) {
|
|
1049
|
-
const types = schema.anyOf.map(getSchemaType);
|
|
1050
|
-
let result = priority.find((type) => types.includes(type));
|
|
1051
|
-
if (result) return result;
|
|
1052
|
-
}
|
|
1053
|
-
if ("type" in schema) return schema.type;
|
|
1054
|
-
if ("const" in schema) return typeof schema.const;
|
|
1055
|
-
return "never";
|
|
1056
|
-
}
|
|
1057
|
-
function flattenSchema(schema, base = {}, parent = "") {
|
|
1058
|
-
if (schema === void 0) return base;
|
|
1059
|
-
for (const [k, value] of Object.entries(schema)) {
|
|
1060
|
-
const key = parent ? `${parent}.${k}` : k;
|
|
1061
|
-
if (getSchemaType(value) === "object") if ("properties" in value) flattenSchema(value.properties, base, key);
|
|
1062
|
-
else base[key] = value;
|
|
1063
|
-
else base[key] = value;
|
|
1064
|
-
}
|
|
1065
|
-
return base;
|
|
1066
|
-
}
|
|
1067
|
-
function setNestedProperty(obj, path$1, value) {
|
|
1068
|
-
const keys = path$1.split(".");
|
|
1069
|
-
let current = obj;
|
|
1070
|
-
for (let i$1 = 0; i$1 < keys.length - 1; i$1++) {
|
|
1071
|
-
if (!current[keys[i$1]]) current[keys[i$1]] = {};
|
|
1072
|
-
current = current[keys[i$1]];
|
|
1073
|
-
}
|
|
1074
|
-
const finalKey = keys[keys.length - 1];
|
|
1075
|
-
Object.defineProperty(current, finalKey, {
|
|
1076
|
-
value,
|
|
1077
|
-
writable: true,
|
|
1078
|
-
enumerable: true,
|
|
1079
|
-
configurable: true
|
|
1080
|
-
});
|
|
1081
|
-
}
|
|
1082
|
-
function camelCaseToKebabCase(str) {
|
|
1083
|
-
return str.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
|
|
1084
|
-
}
|
|
1085
|
-
function kebabCaseToCamelCase(str) {
|
|
1086
|
-
return str.replace(/-./g, (match) => match[1].toUpperCase());
|
|
1087
|
-
}
|
|
1088
|
-
|
|
1089
|
-
//#endregion
|
|
1090
|
-
//#region src/cli/arguments/normalize.ts
|
|
1091
|
-
function normalizeCliOptions(cliOptions, positionals) {
|
|
1092
|
-
const [data, errors] = require_src.validateCliOptions(cliOptions);
|
|
1093
|
-
if (errors?.length) {
|
|
1094
|
-
errors.forEach((error) => {
|
|
1095
|
-
logger.error(`${error}. You can use \`rolldown -h\` to see the help.`);
|
|
1096
|
-
});
|
|
1097
|
-
process.exit(1);
|
|
1098
|
-
}
|
|
1099
|
-
const options$1 = data ?? {};
|
|
1100
|
-
const result = {
|
|
1101
|
-
input: {},
|
|
1102
|
-
output: {},
|
|
1103
|
-
help: options$1.help ?? false,
|
|
1104
|
-
version: options$1.version ?? false,
|
|
1105
|
-
watch: options$1.watch ?? false
|
|
1106
|
-
};
|
|
1107
|
-
if (typeof options$1.config === "string") result.config = options$1.config;
|
|
1108
|
-
const keysOfInput = require_src.getInputCliKeys();
|
|
1109
|
-
const keysOfOutput = require_src.getOutputCliKeys();
|
|
1110
|
-
const reservedKeys = [
|
|
1111
|
-
"help",
|
|
1112
|
-
"version",
|
|
1113
|
-
"config",
|
|
1114
|
-
"watch"
|
|
1115
|
-
];
|
|
1116
|
-
for (let [key, value] of Object.entries(options$1)) {
|
|
1117
|
-
const keys = key.split(".");
|
|
1118
|
-
const [primary] = keys;
|
|
1119
|
-
if (keysOfInput.includes(primary)) setNestedProperty(result.input, key, value);
|
|
1120
|
-
else if (keysOfOutput.includes(primary)) setNestedProperty(result.output, key, value);
|
|
1121
|
-
else if (!reservedKeys.includes(key)) {
|
|
1122
|
-
logger.error(`Unknown option: ${key}`);
|
|
1123
|
-
process.exit(1);
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
if (!result.config && positionals.length > 0) if (Array.isArray(result.input.input)) result.input.input.push(...positionals);
|
|
1127
|
-
else result.input.input = positionals;
|
|
1128
|
-
return result;
|
|
1129
|
-
}
|
|
1130
|
-
|
|
1131
|
-
//#endregion
|
|
1132
|
-
//#region src/cli/arguments/index.ts
|
|
1133
|
-
const objectSchema = require_src.getJsonSchema();
|
|
1134
|
-
const flattenedSchema = flattenSchema(objectSchema.properties);
|
|
1135
|
-
const options = Object.fromEntries(Object.entries(flattenedSchema).filter(([_key, schema]) => getSchemaType(schema) !== "never").map(([key, schema]) => {
|
|
1136
|
-
const config = Object.getOwnPropertyDescriptor(alias, key)?.value;
|
|
1137
|
-
const type = getSchemaType(schema);
|
|
1138
|
-
const result = {
|
|
1139
|
-
type: type === "boolean" ? "boolean" : "string",
|
|
1140
|
-
description: schema?.description ?? config?.description ?? "",
|
|
1141
|
-
hint: config?.hint
|
|
1142
|
-
};
|
|
1143
|
-
if (config && config?.abbreviation) result.short = config?.abbreviation;
|
|
1144
|
-
if (config && config.reverse) if (result.description.startsWith("enable")) result.description = result.description.replace("enable", "disable");
|
|
1145
|
-
else result.description = `disable ${result.description}`;
|
|
1146
|
-
key = camelCaseToKebabCase(key);
|
|
1147
|
-
return [config?.reverse ? `no-${key}` : key, result];
|
|
1148
|
-
}));
|
|
1149
|
-
function parseCliArguments() {
|
|
1150
|
-
const { values, tokens, positionals } = (0, node_util.parseArgs)({
|
|
1151
|
-
options,
|
|
1152
|
-
tokens: true,
|
|
1153
|
-
allowPositionals: true,
|
|
1154
|
-
strict: false
|
|
1155
|
-
});
|
|
1156
|
-
tokens.filter((token) => token.kind === "option").forEach((option) => {
|
|
1157
|
-
let negative = false;
|
|
1158
|
-
if (option.name.startsWith("no-")) {
|
|
1159
|
-
const name = kebabCaseToCamelCase(option.name.substring(3));
|
|
1160
|
-
if (name in flattenedSchema) {
|
|
1161
|
-
delete values[option.name];
|
|
1162
|
-
option.name = name;
|
|
1163
|
-
negative = true;
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
delete values[option.name];
|
|
1167
|
-
option.name = kebabCaseToCamelCase(option.name);
|
|
1168
|
-
let originalType = flattenedSchema[option.name];
|
|
1169
|
-
if (!originalType) {
|
|
1170
|
-
logger.error(`Invalid option: ${option.rawName}. We will ignore this option.`);
|
|
1171
|
-
process.exit(1);
|
|
1172
|
-
}
|
|
1173
|
-
let type = getSchemaType(originalType);
|
|
1174
|
-
if (type === "string" && typeof option.value !== "string") {
|
|
1175
|
-
let opt = option;
|
|
1176
|
-
let defaultValue = Object.getOwnPropertyDescriptor(alias, opt.name)?.value;
|
|
1177
|
-
Object.defineProperty(values, opt.name, {
|
|
1178
|
-
value: defaultValue.default ?? "",
|
|
1179
|
-
enumerable: true,
|
|
1180
|
-
configurable: true,
|
|
1181
|
-
writable: true
|
|
1182
|
-
});
|
|
1183
|
-
} else if (type === "object" && typeof option.value === "string") {
|
|
1184
|
-
const [key, value] = option.value.split(",").map((x) => x.split("="))[0];
|
|
1185
|
-
if (!values[option.name]) Object.defineProperty(values, option.name, {
|
|
1186
|
-
value: {},
|
|
1187
|
-
enumerable: true,
|
|
1188
|
-
configurable: true,
|
|
1189
|
-
writable: true
|
|
1190
|
-
});
|
|
1191
|
-
if (key && value) Object.defineProperty(values[option.name], key, {
|
|
1192
|
-
value,
|
|
1193
|
-
enumerable: true,
|
|
1194
|
-
configurable: true,
|
|
1195
|
-
writable: true
|
|
1196
|
-
});
|
|
1197
|
-
} else if (type === "array" && typeof option.value === "string") {
|
|
1198
|
-
if (!values[option.name]) Object.defineProperty(values, option.name, {
|
|
1199
|
-
value: [],
|
|
1200
|
-
enumerable: true,
|
|
1201
|
-
configurable: true,
|
|
1202
|
-
writable: true
|
|
1203
|
-
});
|
|
1204
|
-
values[option.name].push(option.value);
|
|
1205
|
-
} else if (type === "boolean") Object.defineProperty(values, option.name, {
|
|
1206
|
-
value: !negative,
|
|
1207
|
-
enumerable: true,
|
|
1208
|
-
configurable: true,
|
|
1209
|
-
writable: true
|
|
1210
|
-
});
|
|
1211
|
-
else Object.defineProperty(values, option.name, {
|
|
1212
|
-
value: option.value ?? "",
|
|
1213
|
-
enumerable: true,
|
|
1214
|
-
configurable: true,
|
|
1215
|
-
writable: true
|
|
1216
|
-
});
|
|
1217
|
-
});
|
|
1218
|
-
return normalizeCliOptions(values, positionals);
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1221
|
-
//#endregion
|
|
1222
|
-
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
|
|
1223
|
-
/**
|
|
1224
|
-
* This is not the set of all possible signals.
|
|
1225
|
-
*
|
|
1226
|
-
* It IS, however, the set of all signals that trigger
|
|
1227
|
-
* an exit on either Linux or BSD systems. Linux is a
|
|
1228
|
-
* superset of the signal names supported on BSD, and
|
|
1229
|
-
* the unknown signals just fail to register, so we can
|
|
1230
|
-
* catch that easily enough.
|
|
1231
|
-
*
|
|
1232
|
-
* Windows signals are a different set, since there are
|
|
1233
|
-
* signals that terminate Windows processes, but don't
|
|
1234
|
-
* terminate (or don't even exist) on Posix systems.
|
|
1235
|
-
*
|
|
1236
|
-
* Don't bother with SIGKILL. It's uncatchable, which
|
|
1237
|
-
* means that we can't fire any callbacks anyway.
|
|
1238
|
-
*
|
|
1239
|
-
* If a user does happen to register a handler on a non-
|
|
1240
|
-
* fatal signal like SIGWINCH or something, and then
|
|
1241
|
-
* exit, it'll end up firing `process.emit('exit')`, so
|
|
1242
|
-
* the handler will be fired anyway.
|
|
1243
|
-
*
|
|
1244
|
-
* SIGBUS, SIGFPE, SIGSEGV and SIGILL, when not raised
|
|
1245
|
-
* artificially, inherently leave the process in a
|
|
1246
|
-
* state from which it is not safe to try and enter JS
|
|
1247
|
-
* listeners.
|
|
1248
|
-
*/
|
|
1249
|
-
const signals = [];
|
|
1250
|
-
signals.push("SIGHUP", "SIGINT", "SIGTERM");
|
|
1251
|
-
if (process.platform !== "win32") signals.push("SIGALRM", "SIGABRT", "SIGVTALRM", "SIGXCPU", "SIGXFSZ", "SIGUSR2", "SIGTRAP", "SIGSYS", "SIGQUIT", "SIGIOT");
|
|
1252
|
-
if (process.platform === "linux") signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
|
|
1253
|
-
|
|
1254
|
-
//#endregion
|
|
1255
|
-
//#region ../../node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
|
|
1256
|
-
const processOk = (process$3) => !!process$3 && typeof process$3 === "object" && typeof process$3.removeListener === "function" && typeof process$3.emit === "function" && typeof process$3.reallyExit === "function" && typeof process$3.listeners === "function" && typeof process$3.kill === "function" && typeof process$3.pid === "number" && typeof process$3.on === "function";
|
|
1257
|
-
const kExitEmitter = Symbol.for("signal-exit emitter");
|
|
1258
|
-
const global = globalThis;
|
|
1259
|
-
const ObjectDefineProperty = Object.defineProperty.bind(Object);
|
|
1260
|
-
var Emitter = class {
|
|
1261
|
-
emitted = {
|
|
1262
|
-
afterExit: false,
|
|
1263
|
-
exit: false
|
|
1264
|
-
};
|
|
1265
|
-
listeners = {
|
|
1266
|
-
afterExit: [],
|
|
1267
|
-
exit: []
|
|
1268
|
-
};
|
|
1269
|
-
count = 0;
|
|
1270
|
-
id = Math.random();
|
|
1271
|
-
constructor() {
|
|
1272
|
-
if (global[kExitEmitter]) return global[kExitEmitter];
|
|
1273
|
-
ObjectDefineProperty(global, kExitEmitter, {
|
|
1274
|
-
value: this,
|
|
1275
|
-
writable: false,
|
|
1276
|
-
enumerable: false,
|
|
1277
|
-
configurable: false
|
|
1278
|
-
});
|
|
1279
|
-
}
|
|
1280
|
-
on(ev, fn) {
|
|
1281
|
-
this.listeners[ev].push(fn);
|
|
1282
|
-
}
|
|
1283
|
-
removeListener(ev, fn) {
|
|
1284
|
-
const list = this.listeners[ev];
|
|
1285
|
-
const i$1 = list.indexOf(fn);
|
|
1286
|
-
/* c8 ignore start */
|
|
1287
|
-
if (i$1 === -1) return;
|
|
1288
|
-
/* c8 ignore stop */
|
|
1289
|
-
if (i$1 === 0 && list.length === 1) list.length = 0;
|
|
1290
|
-
else list.splice(i$1, 1);
|
|
1291
|
-
}
|
|
1292
|
-
emit(ev, code, signal) {
|
|
1293
|
-
if (this.emitted[ev]) return false;
|
|
1294
|
-
this.emitted[ev] = true;
|
|
1295
|
-
let ret = false;
|
|
1296
|
-
for (const fn of this.listeners[ev]) ret = fn(code, signal) === true || ret;
|
|
1297
|
-
if (ev === "exit") ret = this.emit("afterExit", code, signal) || ret;
|
|
1298
|
-
return ret;
|
|
1299
|
-
}
|
|
1300
|
-
};
|
|
1301
|
-
var SignalExitBase = class {};
|
|
1302
|
-
const signalExitWrap = (handler) => {
|
|
1303
|
-
return {
|
|
1304
|
-
onExit(cb, opts) {
|
|
1305
|
-
return handler.onExit(cb, opts);
|
|
1306
|
-
},
|
|
1307
|
-
load() {
|
|
1308
|
-
return handler.load();
|
|
1309
|
-
},
|
|
1310
|
-
unload() {
|
|
1311
|
-
return handler.unload();
|
|
1312
|
-
}
|
|
1313
|
-
};
|
|
1314
|
-
};
|
|
1315
|
-
var SignalExitFallback = class extends SignalExitBase {
|
|
1316
|
-
onExit() {
|
|
1317
|
-
return () => {};
|
|
1318
|
-
}
|
|
1319
|
-
load() {}
|
|
1320
|
-
unload() {}
|
|
1321
|
-
};
|
|
1322
|
-
var SignalExit = class extends SignalExitBase {
|
|
1323
|
-
/* c8 ignore start */
|
|
1324
|
-
#hupSig = process$2.platform === "win32" ? "SIGINT" : "SIGHUP";
|
|
1325
|
-
/* c8 ignore stop */
|
|
1326
|
-
#emitter = new Emitter();
|
|
1327
|
-
#process;
|
|
1328
|
-
#originalProcessEmit;
|
|
1329
|
-
#originalProcessReallyExit;
|
|
1330
|
-
#sigListeners = {};
|
|
1331
|
-
#loaded = false;
|
|
1332
|
-
constructor(process$3) {
|
|
1333
|
-
super();
|
|
1334
|
-
this.#process = process$3;
|
|
1335
|
-
this.#sigListeners = {};
|
|
1336
|
-
for (const sig of signals) this.#sigListeners[sig] = () => {
|
|
1337
|
-
const listeners = this.#process.listeners(sig);
|
|
1338
|
-
let { count } = this.#emitter;
|
|
1339
|
-
/* c8 ignore start */
|
|
1340
|
-
const p = process$3;
|
|
1341
|
-
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") count += p.__signal_exit_emitter__.count;
|
|
1342
|
-
/* c8 ignore stop */
|
|
1343
|
-
if (listeners.length === count) {
|
|
1344
|
-
this.unload();
|
|
1345
|
-
const ret = this.#emitter.emit("exit", null, sig);
|
|
1346
|
-
/* c8 ignore start */
|
|
1347
|
-
const s$1 = sig === "SIGHUP" ? this.#hupSig : sig;
|
|
1348
|
-
if (!ret) process$3.kill(process$3.pid, s$1);
|
|
1349
|
-
}
|
|
1350
|
-
};
|
|
1351
|
-
this.#originalProcessReallyExit = process$3.reallyExit;
|
|
1352
|
-
this.#originalProcessEmit = process$3.emit;
|
|
1353
|
-
}
|
|
1354
|
-
onExit(cb, opts) {
|
|
1355
|
-
/* c8 ignore start */
|
|
1356
|
-
if (!processOk(this.#process)) return () => {};
|
|
1357
|
-
/* c8 ignore stop */
|
|
1358
|
-
if (this.#loaded === false) this.load();
|
|
1359
|
-
const ev = opts?.alwaysLast ? "afterExit" : "exit";
|
|
1360
|
-
this.#emitter.on(ev, cb);
|
|
1361
|
-
return () => {
|
|
1362
|
-
this.#emitter.removeListener(ev, cb);
|
|
1363
|
-
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) this.unload();
|
|
1364
|
-
};
|
|
1365
|
-
}
|
|
1366
|
-
load() {
|
|
1367
|
-
if (this.#loaded) return;
|
|
1368
|
-
this.#loaded = true;
|
|
1369
|
-
this.#emitter.count += 1;
|
|
1370
|
-
for (const sig of signals) try {
|
|
1371
|
-
const fn = this.#sigListeners[sig];
|
|
1372
|
-
if (fn) this.#process.on(sig, fn);
|
|
1373
|
-
} catch (_$1) {}
|
|
1374
|
-
this.#process.emit = (ev, ...a$1) => {
|
|
1375
|
-
return this.#processEmit(ev, ...a$1);
|
|
1376
|
-
};
|
|
1377
|
-
this.#process.reallyExit = (code) => {
|
|
1378
|
-
return this.#processReallyExit(code);
|
|
1379
|
-
};
|
|
1380
|
-
}
|
|
1381
|
-
unload() {
|
|
1382
|
-
if (!this.#loaded) return;
|
|
1383
|
-
this.#loaded = false;
|
|
1384
|
-
signals.forEach((sig) => {
|
|
1385
|
-
const listener = this.#sigListeners[sig];
|
|
1386
|
-
/* c8 ignore start */
|
|
1387
|
-
if (!listener) throw new Error("Listener not defined for signal: " + sig);
|
|
1388
|
-
/* c8 ignore stop */
|
|
1389
|
-
try {
|
|
1390
|
-
this.#process.removeListener(sig, listener);
|
|
1391
|
-
} catch (_$1) {}
|
|
1392
|
-
/* c8 ignore stop */
|
|
1393
|
-
});
|
|
1394
|
-
this.#process.emit = this.#originalProcessEmit;
|
|
1395
|
-
this.#process.reallyExit = this.#originalProcessReallyExit;
|
|
1396
|
-
this.#emitter.count -= 1;
|
|
1397
|
-
}
|
|
1398
|
-
#processReallyExit(code) {
|
|
1399
|
-
/* c8 ignore start */
|
|
1400
|
-
if (!processOk(this.#process)) return 0;
|
|
1401
|
-
this.#process.exitCode = code || 0;
|
|
1402
|
-
/* c8 ignore stop */
|
|
1403
|
-
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
1404
|
-
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
|
|
1405
|
-
}
|
|
1406
|
-
#processEmit(ev, ...args) {
|
|
1407
|
-
const og = this.#originalProcessEmit;
|
|
1408
|
-
if (ev === "exit" && processOk(this.#process)) {
|
|
1409
|
-
if (typeof args[0] === "number") this.#process.exitCode = args[0];
|
|
1410
|
-
/* c8 ignore start */
|
|
1411
|
-
const ret = og.call(this.#process, ev, ...args);
|
|
1412
|
-
/* c8 ignore start */
|
|
1413
|
-
this.#emitter.emit("exit", this.#process.exitCode, null);
|
|
1414
|
-
/* c8 ignore stop */
|
|
1415
|
-
return ret;
|
|
1416
|
-
} else return og.call(this.#process, ev, ...args);
|
|
1417
|
-
}
|
|
1418
|
-
};
|
|
1419
|
-
const process$2 = globalThis.process;
|
|
1420
|
-
const { onExit, load, unload } = signalExitWrap(processOk(process$2) ? new SignalExit(process$2) : new SignalExitFallback());
|
|
1421
|
-
|
|
1422
|
-
//#endregion
|
|
1423
|
-
//#region ../../node_modules/.pnpm/@oxc-project+runtime@0.72.0/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js
|
|
1424
|
-
var require_usingCtx = require_chunk.__commonJS({ "../../node_modules/.pnpm/@oxc-project+runtime@0.72.0/node_modules/@oxc-project/runtime/src/helpers/usingCtx.js"(exports, module) {
|
|
1425
|
-
function _usingCtx() {
|
|
1426
|
-
var r$1 = "function" == typeof SuppressedError ? SuppressedError : function(r$2, e$1) {
|
|
1427
|
-
var n$2 = Error();
|
|
1428
|
-
return n$2.name = "SuppressedError", n$2.error = r$2, n$2.suppressed = e$1, n$2;
|
|
1429
|
-
}, e = {}, n$1 = [];
|
|
1430
|
-
function using(r$2, e$1) {
|
|
1431
|
-
if (null != e$1) {
|
|
1432
|
-
if (Object(e$1) !== e$1) throw new TypeError("using declarations can only be used with objects, functions, null, or undefined.");
|
|
1433
|
-
if (r$2) var o$1 = e$1[Symbol.asyncDispose || Symbol["for"]("Symbol.asyncDispose")];
|
|
1434
|
-
if (void 0 === o$1 && (o$1 = e$1[Symbol.dispose || Symbol["for"]("Symbol.dispose")], r$2)) var t$1 = o$1;
|
|
1435
|
-
if ("function" != typeof o$1) throw new TypeError("Object is not disposable.");
|
|
1436
|
-
t$1 && (o$1 = function o$2() {
|
|
1437
|
-
try {
|
|
1438
|
-
t$1.call(e$1);
|
|
1439
|
-
} catch (r$3) {
|
|
1440
|
-
return Promise.reject(r$3);
|
|
1441
|
-
}
|
|
1442
|
-
}), n$1.push({
|
|
1443
|
-
v: e$1,
|
|
1444
|
-
d: o$1,
|
|
1445
|
-
a: r$2
|
|
1446
|
-
});
|
|
1447
|
-
} else r$2 && n$1.push({
|
|
1448
|
-
d: e$1,
|
|
1449
|
-
a: r$2
|
|
1450
|
-
});
|
|
1451
|
-
return e$1;
|
|
1452
|
-
}
|
|
1453
|
-
return {
|
|
1454
|
-
e,
|
|
1455
|
-
u: using.bind(null, !1),
|
|
1456
|
-
a: using.bind(null, !0),
|
|
1457
|
-
d: function d() {
|
|
1458
|
-
var o$1, t$1 = this.e, s$1 = 0;
|
|
1459
|
-
function next() {
|
|
1460
|
-
for (; o$1 = n$1.pop();) try {
|
|
1461
|
-
if (!o$1.a && 1 === s$1) return s$1 = 0, n$1.push(o$1), Promise.resolve().then(next);
|
|
1462
|
-
if (o$1.d) {
|
|
1463
|
-
var r$2 = o$1.d.call(o$1.v);
|
|
1464
|
-
if (o$1.a) return s$1 |= 2, Promise.resolve(r$2).then(next, err);
|
|
1465
|
-
} else s$1 |= 1;
|
|
1466
|
-
} catch (r$3) {
|
|
1467
|
-
return err(r$3);
|
|
1468
|
-
}
|
|
1469
|
-
if (1 === s$1) return t$1 !== e ? Promise.reject(t$1) : Promise.resolve();
|
|
1470
|
-
if (t$1 !== e) throw t$1;
|
|
1471
|
-
}
|
|
1472
|
-
function err(n$2) {
|
|
1473
|
-
return t$1 = t$1 !== e ? new r$1(n$2, t$1) : n$2, next();
|
|
1474
|
-
}
|
|
1475
|
-
return next();
|
|
1476
|
-
}
|
|
1477
|
-
};
|
|
1478
|
-
}
|
|
1479
|
-
module.exports = _usingCtx, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
1480
|
-
} });
|
|
1481
|
-
|
|
1482
|
-
//#endregion
|
|
1483
|
-
//#region src/cli/commands/bundle.ts
|
|
1484
|
-
var import_usingCtx = require_chunk.__toESM(require_usingCtx());
|
|
1485
|
-
async function bundleWithConfig(configPath, cliOptions) {
|
|
1486
|
-
if (cliOptions.watch) {
|
|
1487
|
-
process.env.ROLLUP_WATCH = "true";
|
|
1488
|
-
process.env.ROLLDOWN_WATCH = "true";
|
|
1489
|
-
}
|
|
1490
|
-
const config = await require_load_config.loadConfig(configPath);
|
|
1491
|
-
if (!config) {
|
|
1492
|
-
logger.error(`No configuration found at ${config}`);
|
|
1493
|
-
process.exit(1);
|
|
1494
|
-
}
|
|
1495
|
-
if (cliOptions.watch) await watchInner(config, cliOptions);
|
|
1496
|
-
else await bundleInner(config, cliOptions);
|
|
1497
|
-
}
|
|
1498
|
-
async function bundleWithCliOptions(cliOptions) {
|
|
1499
|
-
try {
|
|
1500
|
-
var _usingCtx$1 = (0, import_usingCtx.default)();
|
|
1501
|
-
if (cliOptions.output.dir || cliOptions.output.file) {
|
|
1502
|
-
const operation = cliOptions.watch ? watchInner : bundleInner;
|
|
1503
|
-
await operation({}, cliOptions);
|
|
1504
|
-
return;
|
|
1505
|
-
}
|
|
1506
|
-
if (cliOptions.watch) {
|
|
1507
|
-
logger.error("You must specify `output.dir` to use watch mode");
|
|
1508
|
-
process.exit(1);
|
|
1509
|
-
}
|
|
1510
|
-
const build = _usingCtx$1.a(await require_src.rolldown(cliOptions.input));
|
|
1511
|
-
const { output: outputs } = await build.generate(cliOptions.output);
|
|
1512
|
-
if (outputs.length === 0) {
|
|
1513
|
-
logger.error("No output generated");
|
|
1514
|
-
process.exit(1);
|
|
1515
|
-
}
|
|
1516
|
-
for (const file of outputs) {
|
|
1517
|
-
if (outputs.length > 1) logger.log(`\n${ansis.default.cyan(ansis.default.bold(`|→ ${file.fileName}:`))}\n`);
|
|
1518
|
-
console.log(file.type === "asset" ? file.source : file.code);
|
|
1519
|
-
}
|
|
1520
|
-
} catch (_$1) {
|
|
1521
|
-
_usingCtx$1.e = _$1;
|
|
1522
|
-
} finally {
|
|
1523
|
-
await _usingCtx$1.d();
|
|
1524
|
-
}
|
|
1525
|
-
}
|
|
1526
|
-
async function watchInner(config, cliOptions) {
|
|
1527
|
-
let normalizedConfig = require_dist.arraify(config).map((option) => {
|
|
1528
|
-
return {
|
|
1529
|
-
...option,
|
|
1530
|
-
...cliOptions.input,
|
|
1531
|
-
output: require_dist.arraify(option.output || {}).map((output) => {
|
|
1532
|
-
return {
|
|
1533
|
-
...output,
|
|
1534
|
-
...cliOptions.output
|
|
1535
|
-
};
|
|
1536
|
-
})
|
|
1537
|
-
};
|
|
1538
|
-
});
|
|
1539
|
-
const watcher = await require_src.watch(normalizedConfig);
|
|
1540
|
-
onExit((code) => {
|
|
1541
|
-
Promise.resolve(watcher.close()).finally(() => {
|
|
1542
|
-
process.exit(typeof code === "number" ? code : 0);
|
|
1543
|
-
});
|
|
1544
|
-
return true;
|
|
1545
|
-
});
|
|
1546
|
-
const changedFile = [];
|
|
1547
|
-
watcher.on("change", (id, event) => {
|
|
1548
|
-
if (event.event === "update") changedFile.push(id);
|
|
1549
|
-
});
|
|
1550
|
-
watcher.on("event", async (event) => {
|
|
1551
|
-
switch (event.code) {
|
|
1552
|
-
case "BUNDLE_START":
|
|
1553
|
-
if (changedFile.length > 0) logger.log(`Found ${ansis.default.bold(changedFile.map(relativeId).join(", "))} changed, rebuilding...`);
|
|
1554
|
-
changedFile.length = 0;
|
|
1555
|
-
break;
|
|
1556
|
-
case "BUNDLE_END":
|
|
1557
|
-
await event.result.close();
|
|
1558
|
-
logger.success(`Rebuilt ${ansis.default.bold(relativeId(event.output[0]))} in ${ansis.default.bold(ms(event.duration))}.`);
|
|
1559
|
-
break;
|
|
1560
|
-
case "ERROR":
|
|
1561
|
-
await event.result.close();
|
|
1562
|
-
logger.error(event.error);
|
|
1563
|
-
break;
|
|
1564
|
-
default: break;
|
|
1565
|
-
}
|
|
1566
|
-
});
|
|
1567
|
-
logger.log(`Waiting for changes...`);
|
|
1568
|
-
}
|
|
1569
|
-
async function bundleInner(config, cliOptions) {
|
|
1570
|
-
const startTime = node_perf_hooks.performance.now();
|
|
1571
|
-
const result = [];
|
|
1572
|
-
const configList = require_dist.arraify(config);
|
|
1573
|
-
for (const config$1 of configList) {
|
|
1574
|
-
const outputList = require_dist.arraify(config$1.output || {});
|
|
1575
|
-
const build = await require_src.rolldown({
|
|
1576
|
-
...config$1,
|
|
1577
|
-
...cliOptions.input
|
|
1578
|
-
});
|
|
1579
|
-
for (const output of outputList) try {
|
|
1580
|
-
result.push(await build.write({
|
|
1581
|
-
...output,
|
|
1582
|
-
...cliOptions.output
|
|
1583
|
-
}));
|
|
1584
|
-
} finally {
|
|
1585
|
-
await build.close();
|
|
1586
|
-
}
|
|
1587
|
-
}
|
|
1588
|
-
result.forEach(printBundleOutputPretty);
|
|
1589
|
-
logger.log(``);
|
|
1590
|
-
const endTime = node_perf_hooks.performance.now();
|
|
1591
|
-
const duration = endTime - startTime;
|
|
1592
|
-
logger.success(`Finished in ${ansis.default.bold(ms(duration))}`);
|
|
1593
|
-
}
|
|
1594
|
-
function printBundleOutputPretty(output) {
|
|
1595
|
-
const outputEntries = collectOutputEntries(output.output);
|
|
1596
|
-
const outputLayoutSizes = collectOutputLayoutAdjustmentSizes(outputEntries);
|
|
1597
|
-
printOutputEntries(outputEntries, outputLayoutSizes, "<DIR>");
|
|
1598
|
-
}
|
|
1599
|
-
function collectOutputEntries(output) {
|
|
1600
|
-
return output.map((chunk) => ({
|
|
1601
|
-
type: chunk.type,
|
|
1602
|
-
fileName: chunk.fileName,
|
|
1603
|
-
size: chunk.type === "chunk" ? Buffer.byteLength(chunk.code) : Buffer.byteLength(chunk.source)
|
|
1604
|
-
}));
|
|
1605
|
-
}
|
|
1606
|
-
function collectOutputLayoutAdjustmentSizes(entries) {
|
|
1607
|
-
let longest = 0;
|
|
1608
|
-
let biggestSize = 0;
|
|
1609
|
-
for (const entry of entries) {
|
|
1610
|
-
if (entry.fileName.length > longest) longest = entry.fileName.length;
|
|
1611
|
-
if (entry.size > biggestSize) biggestSize = entry.size;
|
|
1612
|
-
}
|
|
1613
|
-
const sizePad = displaySize(biggestSize).length;
|
|
1614
|
-
return {
|
|
1615
|
-
longest,
|
|
1616
|
-
biggestSize,
|
|
1617
|
-
sizePad
|
|
1618
|
-
};
|
|
1619
|
-
}
|
|
1620
|
-
const numberFormatter = new Intl.NumberFormat("en", {
|
|
1621
|
-
maximumFractionDigits: 2,
|
|
1622
|
-
minimumFractionDigits: 2
|
|
1623
|
-
});
|
|
1624
|
-
function displaySize(bytes) {
|
|
1625
|
-
return `${numberFormatter.format(bytes / 1e3)} kB`;
|
|
1626
|
-
}
|
|
1627
|
-
const CHUNK_GROUPS = [{
|
|
1628
|
-
type: "asset",
|
|
1629
|
-
color: "green"
|
|
1630
|
-
}, {
|
|
1631
|
-
type: "chunk",
|
|
1632
|
-
color: "cyan"
|
|
1633
|
-
}];
|
|
1634
|
-
function printOutputEntries(entries, sizeAdjustment, distPath) {
|
|
1635
|
-
for (const group of CHUNK_GROUPS) {
|
|
1636
|
-
const filtered = entries.filter((e) => e.type === group.type);
|
|
1637
|
-
if (!filtered.length) continue;
|
|
1638
|
-
for (const entry of filtered.sort((a$1, z) => a$1.size - z.size)) {
|
|
1639
|
-
let log = ansis.default.dim(withTrailingSlash(distPath));
|
|
1640
|
-
log += ansis.default[group.color](entry.fileName.padEnd(sizeAdjustment.longest + 2));
|
|
1641
|
-
log += ansis.default.dim(entry.type);
|
|
1642
|
-
log += ansis.default.dim(` │ size: ${displaySize(entry.size).padStart(sizeAdjustment.sizePad)}`);
|
|
1643
|
-
logger.log(log);
|
|
1644
|
-
}
|
|
1645
|
-
}
|
|
1646
|
-
}
|
|
1647
|
-
function withTrailingSlash(path$1) {
|
|
1648
|
-
if (path$1[path$1.length - 1] !== "/") return `${path$1}/`;
|
|
1649
|
-
return path$1;
|
|
1650
|
-
}
|
|
1651
|
-
function ms(duration) {
|
|
1652
|
-
return duration < 1e3 ? `${duration.toFixed(2)} ms` : `${(duration / 1e3).toFixed(2)} s`;
|
|
1653
|
-
}
|
|
1654
|
-
function relativeId(id) {
|
|
1655
|
-
if (!node_path.default.isAbsolute(id)) return id;
|
|
1656
|
-
return node_path.default.relative(node_path.default.resolve(), id);
|
|
1657
|
-
}
|
|
1658
|
-
|
|
1659
|
-
//#endregion
|
|
1660
|
-
//#region src/cli/commands/help.ts
|
|
1661
|
-
const introduction = `${ansis.default.gray(`${require_src.description} (rolldown v${require_src.version})`)}
|
|
1662
|
-
|
|
1663
|
-
${ansis.default.bold(ansis.default.underline("USAGE"))} ${ansis.default.cyan("rolldown -c <config>")} or ${ansis.default.cyan("rolldown <input> <options>")}`;
|
|
1664
|
-
const examples = [
|
|
1665
|
-
{
|
|
1666
|
-
title: "Bundle with a config file `rolldown.config.mjs`",
|
|
1667
|
-
command: "rolldown -c rolldown.config.mjs"
|
|
1668
|
-
},
|
|
1669
|
-
{
|
|
1670
|
-
title: "Bundle the `src/main.ts` to `dist` with `cjs` format",
|
|
1671
|
-
command: "rolldown src/main.ts -d dist -f cjs"
|
|
1672
|
-
},
|
|
1673
|
-
{
|
|
1674
|
-
title: "Bundle the `src/main.ts` and handle the `.png` assets to Data URL",
|
|
1675
|
-
command: "rolldown src/main.ts -d dist --moduleTypes .png=dataurl"
|
|
1676
|
-
},
|
|
1677
|
-
{
|
|
1678
|
-
title: "Bundle the `src/main.tsx` and minify the output with sourcemap",
|
|
1679
|
-
command: "rolldown src/main.tsx -d dist -m -s"
|
|
1680
|
-
},
|
|
1681
|
-
{
|
|
1682
|
-
title: "Create self-executing IIFE using external jQuery as `$` and `_`",
|
|
1683
|
-
command: "rolldown src/main.ts -d dist -n bundle -f iife -e jQuery,window._ -g jQuery=$"
|
|
1684
|
-
}
|
|
1685
|
-
];
|
|
1686
|
-
const notes = [
|
|
1687
|
-
"Due to the API limitation, you need to pass `-s` for `.map` sourcemap file as the last argument.",
|
|
1688
|
-
"If you are using the configuration, please pass the `-c` as the last argument if you ignore the default configuration file.",
|
|
1689
|
-
"CLI options will override the configuration file.",
|
|
1690
|
-
"For more information, please visit https://rolldown.rs/."
|
|
1691
|
-
];
|
|
1692
|
-
function showHelp() {
|
|
1693
|
-
logger.log(introduction);
|
|
1694
|
-
logger.log("");
|
|
1695
|
-
logger.log(`${ansis.default.bold(ansis.default.underline("OPTIONS"))}`);
|
|
1696
|
-
logger.log("");
|
|
1697
|
-
logger.log(Object.entries(options).sort(([a$1], [b$1]) => {
|
|
1698
|
-
if (options[a$1].short && !options[b$1].short) return -1;
|
|
1699
|
-
if (!options[a$1].short && options[b$1].short) return 1;
|
|
1700
|
-
if (options[a$1].short && options[b$1].short) return options[a$1].short.localeCompare(options[b$1].short);
|
|
1701
|
-
return a$1.localeCompare(b$1);
|
|
1702
|
-
}).map(([option, { type, short, hint, description: description$1 }]) => {
|
|
1703
|
-
let optionStr = ` --${option} `;
|
|
1704
|
-
option = camelCaseToKebabCase(option);
|
|
1705
|
-
if (short) optionStr += `-${short}, `;
|
|
1706
|
-
if (type === "string") optionStr += `<${hint ?? option}>`;
|
|
1707
|
-
if (description$1 && description$1.length > 0) description$1 = description$1[0].toUpperCase() + description$1.slice(1);
|
|
1708
|
-
return ansis.default.cyan(optionStr.padEnd(30)) + description$1 + (description$1 && description$1?.endsWith(".") ? "" : ".");
|
|
1709
|
-
}).join("\n"));
|
|
1710
|
-
logger.log("");
|
|
1711
|
-
logger.log(`${ansis.default.bold(ansis.default.underline("EXAMPLES"))}`);
|
|
1712
|
-
logger.log("");
|
|
1713
|
-
examples.forEach(({ title, command }, ord) => {
|
|
1714
|
-
logger.log(` ${ord + 1}. ${title}:`);
|
|
1715
|
-
logger.log(` ${ansis.default.cyan(command)}`);
|
|
1716
|
-
logger.log("");
|
|
1717
|
-
});
|
|
1718
|
-
logger.log(`${ansis.default.bold(ansis.default.underline("NOTES"))}`);
|
|
1719
|
-
logger.log("");
|
|
1720
|
-
notes.forEach((note) => {
|
|
1721
|
-
logger.log(` * ${ansis.default.gray(note)}`);
|
|
1722
|
-
});
|
|
1723
|
-
}
|
|
1724
|
-
|
|
1725
|
-
//#endregion
|
|
1726
|
-
//#region src/cli/index.ts
|
|
1727
|
-
async function main() {
|
|
1728
|
-
const cliOptions = parseCliArguments();
|
|
1729
|
-
if (cliOptions.config || cliOptions.config === "") {
|
|
1730
|
-
await bundleWithConfig(cliOptions.config, cliOptions);
|
|
1731
|
-
return;
|
|
1732
|
-
}
|
|
1733
|
-
if ("input" in cliOptions.input) {
|
|
1734
|
-
await bundleWithCliOptions(cliOptions);
|
|
1735
|
-
return;
|
|
1736
|
-
}
|
|
1737
|
-
if (cliOptions.version) {
|
|
1738
|
-
logger.log(`rolldown v${require_src.version}`);
|
|
1739
|
-
return;
|
|
1740
|
-
}
|
|
1741
|
-
showHelp();
|
|
1742
|
-
}
|
|
1743
|
-
main().catch((err) => {
|
|
1744
|
-
logger.error(err);
|
|
1745
|
-
node_process.default.exit(1);
|
|
1746
|
-
});
|
|
1747
|
-
|
|
1748
|
-
//#endregion
|