@rolldown/browser 1.0.0-rc.1 → 1.0.0-rc.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/cli.mjs +705 -1101
  2. package/dist/config.d.mts +9 -4
  3. package/dist/config.mjs +4 -13
  4. package/dist/{shared/constructors-BTW-c3jX.mjs → constructors-LtcP0f-6.js} +14 -7
  5. package/dist/error-nyELQq9T.js +157 -0
  6. package/dist/experimental-index.browser.mjs +74 -15
  7. package/dist/experimental-index.d.mts +128 -56
  8. package/dist/experimental-index.mjs +76 -17
  9. package/dist/filter-index.d.mts +1 -1
  10. package/dist/filter-index.mjs +25 -6
  11. package/dist/get-log-filter.d.mts +3 -7
  12. package/dist/get-log-filter.mjs +23 -3
  13. package/dist/index.browser.mjs +70 -75
  14. package/dist/index.d.mts +4 -4
  15. package/dist/index.mjs +6 -12
  16. package/dist/{normalize-string-or-regex-CL-PJZI7.js → normalize-string-or-regex-Db8ibFkp.js} +25 -23
  17. package/dist/parallel-plugin-worker.mjs +3 -7
  18. package/dist/parallel-plugin.d.mts +4 -4
  19. package/dist/parallel-plugin.mjs +1 -2
  20. package/dist/parse-ast-index.d.mts +27 -3
  21. package/dist/parse-ast-index.mjs +60 -3
  22. package/dist/plugins-index.browser.mjs +8 -7
  23. package/dist/plugins-index.d.mts +7 -4
  24. package/dist/plugins-index.mjs +8 -7
  25. package/dist/resolve-tsconfig-CkWJwi9L.js +112 -0
  26. package/dist/rolldown-binding.wasi-browser.js +6 -1
  27. package/dist/rolldown-binding.wasi.cjs +6 -1
  28. package/dist/rolldown-binding.wasm32-wasi.wasm +0 -0
  29. package/dist/{rolldown-build-C4tDS_XC.js → rolldown-build-BPQtF2AA.js} +1063 -745
  30. package/dist/shared/{bindingify-input-options-Bp2kpiI8.mjs → bindingify-input-options-CSSx7s5e.mjs} +124 -165
  31. package/dist/shared/{composable-filters-CIxSuZSM.mjs → composable-filters-B2ByPP8y.mjs} +1 -4
  32. package/dist/{constructors-B8gqcrFr.js → shared/constructors-BGLoUvKR.mjs} +14 -7
  33. package/dist/shared/{constructors-5bt5oBhE.d.mts → constructors-BVnf_fH1.d.mts} +13 -4
  34. package/dist/shared/define-config-Cr6054d_.d.mts +3869 -0
  35. package/dist/shared/{define-config-Dlptvz3X.mjs → define-config-DJOr6Iwt.mjs} +1 -2
  36. package/dist/shared/error-CQ6njWsV.mjs +86 -0
  37. package/dist/shared/get-log-filter-semyr3Lj.d.mts +35 -0
  38. package/dist/shared/{load-config-BBZgIUGN.mjs → load-config-CXtSVabV.mjs} +11 -5
  39. package/dist/shared/{logging-Nvu645a7.d.mts → logging-C6h4g8dA.d.mts} +6 -6
  40. package/dist/shared/{logs-B2CASPcx.mjs → logs-D80CXhvg.mjs} +6 -9
  41. package/dist/shared/{normalize-string-or-regex-DIwprzLy.mjs → normalize-string-or-regex-D0o84ejN.mjs} +21 -16
  42. package/dist/shared/parse-B_jvq8dU.mjs +73 -0
  43. package/dist/shared/{prompt-B6NrDD1-.mjs → prompt-BYQIwEjg.mjs} +4 -6
  44. package/dist/shared/resolve-tsconfig-Cwoo4h_o.mjs +112 -0
  45. package/dist/shared/{rolldown-C0_W0QdY.mjs → rolldown-D-bh1N9N.mjs} +2 -4
  46. package/dist/shared/rolldown-build-Bysdmf-9.mjs +3320 -0
  47. package/dist/shared/transform-DEgNAQOQ.d.mts +149 -0
  48. package/dist/shared/{types-CIYK49jr.d.mts → types-K2r0mx6Y.d.mts} +11 -9
  49. package/dist/shared/{watch-eIop0yN6.mjs → watch-V9eI6ua1.mjs} +71 -76
  50. package/dist/utils-index.browser.mjs +2414 -0
  51. package/dist/utils-index.d.mts +1673 -0
  52. package/dist/utils-index.mjs +2414 -0
  53. package/package.json +1 -1
  54. package/dist/cli-setup.d.mts +0 -1
  55. package/dist/cli-setup.mjs +0 -16
  56. package/dist/shared/define-config-CDlEOpr1.d.mts +0 -3531
  57. package/dist/shared/parse-ast-index-2ahkCVK6.mjs +0 -98
  58. package/dist/shared/rolldown-build-DLuUhuNw.mjs +0 -2368
  59. /package/dist/shared/{utils-CqMTwlsR.d.mts → utils-6wxe_LMG.d.mts} +0 -0
package/dist/cli.mjs CHANGED
@@ -1,995 +1,629 @@
1
- import { n as onExit, t as watch } from "./shared/watch-eIop0yN6.mjs";
2
- import "./shared/normalize-string-or-regex-DIwprzLy.mjs";
3
- import { C as description, w as version } from "./shared/bindingify-input-options-Bp2kpiI8.mjs";
4
- import { h as arraify } from "./shared/composable-filters-CIxSuZSM.mjs";
5
- import { a as getOutputCliKeys, c as styleText$1, i as getInputCliKeys, o as validateCliOptions, r as getCliSchemaInfo } from "./shared/rolldown-build-DLuUhuNw.mjs";
6
- import "./shared/parse-ast-index-2ahkCVK6.mjs";
7
- import { t as rolldown } from "./shared/rolldown-C0_W0QdY.mjs";
8
- import { t as loadConfig } from "./shared/load-config-BBZgIUGN.mjs";
9
- import path, { sep } from "node:path";
10
- import { formatWithOptions, parseArgs } from "node:util";
1
+ import { n as onExit, t as watch } from "./shared/watch-V9eI6ua1.mjs";
2
+ import { C as version, S as description } from "./shared/bindingify-input-options-CSSx7s5e.mjs";
3
+ import { h as arraify } from "./shared/composable-filters-B2ByPP8y.mjs";
4
+ import { a as getInputCliKeys, i as getCliSchemaInfo, l as styleText, o as getOutputCliKeys, r as logger, s as validateCliOptions } from "./shared/rolldown-build-Bysdmf-9.mjs";
5
+ import { t as rolldown } from "./shared/rolldown-D-bh1N9N.mjs";
6
+ import { t as loadConfig } from "./shared/load-config-CXtSVabV.mjs";
7
+ import path from "node:path";
11
8
  import process$1 from "node:process";
12
- import * as tty from "node:tty";
13
9
  import { performance } from "node:perf_hooks";
14
-
15
- //#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/core.mjs
16
- const LogLevels = {
17
- silent: Number.NEGATIVE_INFINITY,
18
- fatal: 0,
19
- error: 0,
20
- warn: 1,
21
- log: 2,
22
- info: 3,
23
- success: 3,
24
- fail: 3,
25
- ready: 3,
26
- start: 3,
27
- box: 3,
28
- debug: 4,
29
- trace: 5,
30
- verbose: Number.POSITIVE_INFINITY
31
- };
32
- const LogTypes = {
33
- silent: { level: -1 },
34
- fatal: { level: LogLevels.fatal },
35
- error: { level: LogLevels.error },
36
- warn: { level: LogLevels.warn },
37
- log: { level: LogLevels.log },
38
- info: { level: LogLevels.info },
39
- success: { level: LogLevels.success },
40
- fail: { level: LogLevels.fail },
41
- ready: { level: LogLevels.info },
42
- start: { level: LogLevels.info },
43
- box: { level: LogLevels.info },
44
- debug: { level: LogLevels.debug },
45
- trace: { level: LogLevels.trace },
46
- verbose: { level: LogLevels.verbose }
47
- };
48
- function isPlainObject$1(value) {
49
- if (value === null || typeof value !== "object") return false;
50
- const prototype = Object.getPrototypeOf(value);
51
- if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) return false;
52
- if (Symbol.iterator in value) return false;
53
- if (Symbol.toStringTag in value) return Object.prototype.toString.call(value) === "[object Module]";
54
- return true;
10
+ //#region ../../node_modules/.pnpm/cac@7.0.0/node_modules/cac/dist/index.js
11
+ function toArr(any) {
12
+ return any == null ? [] : Array.isArray(any) ? any : [any];
55
13
  }
56
- function _defu(baseObject, defaults, namespace = ".", merger) {
57
- if (!isPlainObject$1(defaults)) return _defu(baseObject, {}, namespace, merger);
58
- const object = Object.assign({}, defaults);
59
- for (const key in baseObject) {
60
- if (key === "__proto__" || key === "constructor") continue;
61
- const value = baseObject[key];
62
- if (value === null || value === void 0) continue;
63
- if (merger && merger(object, key, value, namespace)) continue;
64
- if (Array.isArray(value) && Array.isArray(object[key])) object[key] = [...value, ...object[key]];
65
- else if (isPlainObject$1(value) && isPlainObject$1(object[key])) object[key] = _defu(value, object[key], (namespace ? `${namespace}.` : "") + key.toString(), merger);
66
- else object[key] = value;
67
- }
68
- return object;
14
+ function toVal(out, key, val, opts) {
15
+ var x, old = out[key], nxt = !!~opts.string.indexOf(key) ? val == null || val === true ? "" : String(val) : typeof val === "boolean" ? val : !!~opts.boolean.indexOf(key) ? val === "false" ? false : val === "true" || (out._.push((x = +val, x * 0 === 0) ? x : val), !!val) : (x = +val, x * 0 === 0) ? x : val;
16
+ out[key] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
69
17
  }
70
- function createDefu(merger) {
71
- return (...arguments_) => arguments_.reduce((p, c) => _defu(p, c, "", merger), {});
18
+ function lib_default(args, opts) {
19
+ args = args || [];
20
+ opts = opts || {};
21
+ var k, arr, arg, name, val, out = { _: [] };
22
+ var i = 0, j = 0, idx = 0, len = args.length;
23
+ const alibi = opts.alias !== void 0;
24
+ const strict = opts.unknown !== void 0;
25
+ const defaults = opts.default !== void 0;
26
+ opts.alias = opts.alias || {};
27
+ opts.string = toArr(opts.string);
28
+ opts.boolean = toArr(opts.boolean);
29
+ if (alibi) for (k in opts.alias) {
30
+ arr = opts.alias[k] = toArr(opts.alias[k]);
31
+ for (i = 0; i < arr.length; i++) (opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
32
+ }
33
+ for (i = opts.boolean.length; i-- > 0;) {
34
+ arr = opts.alias[opts.boolean[i]] || [];
35
+ for (j = arr.length; j-- > 0;) opts.boolean.push(arr[j]);
36
+ }
37
+ for (i = opts.string.length; i-- > 0;) {
38
+ arr = opts.alias[opts.string[i]] || [];
39
+ for (j = arr.length; j-- > 0;) opts.string.push(arr[j]);
40
+ }
41
+ if (defaults) for (k in opts.default) {
42
+ name = typeof opts.default[k];
43
+ arr = opts.alias[k] = opts.alias[k] || [];
44
+ if (opts[name] !== void 0) {
45
+ opts[name].push(k);
46
+ for (i = 0; i < arr.length; i++) opts[name].push(arr[i]);
47
+ }
48
+ }
49
+ const keys = strict ? Object.keys(opts.alias) : [];
50
+ for (i = 0; i < len; i++) {
51
+ arg = args[i];
52
+ if (arg === "--") {
53
+ out._ = out._.concat(args.slice(++i));
54
+ break;
55
+ }
56
+ for (j = 0; j < arg.length; j++) if (arg.charCodeAt(j) !== 45) break;
57
+ if (j === 0) out._.push(arg);
58
+ else if (arg.substring(j, j + 3) === "no-") {
59
+ name = arg.substring(j + 3);
60
+ if (strict && !~keys.indexOf(name)) return opts.unknown(arg);
61
+ out[name] = false;
62
+ } else {
63
+ for (idx = j + 1; idx < arg.length; idx++) if (arg.charCodeAt(idx) === 61) break;
64
+ name = arg.substring(j, idx);
65
+ val = arg.substring(++idx) || i + 1 === len || ("" + args[i + 1]).charCodeAt(0) === 45 || args[++i];
66
+ arr = j === 2 ? [name] : name;
67
+ for (idx = 0; idx < arr.length; idx++) {
68
+ name = arr[idx];
69
+ if (strict && !~keys.indexOf(name)) return opts.unknown("-".repeat(j) + name);
70
+ toVal(out, name, idx + 1 < arr.length || val, opts);
71
+ }
72
+ }
73
+ }
74
+ if (defaults) {
75
+ for (k in opts.default) if (out[k] === void 0) out[k] = opts.default[k];
76
+ }
77
+ if (alibi) for (k in out) {
78
+ arr = opts.alias[k] || [];
79
+ while (arr.length > 0) out[arr.shift()] = out[k];
80
+ }
81
+ return out;
72
82
  }
73
- const defu = createDefu();
74
- function isPlainObject(obj) {
75
- return Object.prototype.toString.call(obj) === "[object Object]";
83
+ function removeBrackets(v) {
84
+ return v.replace(/[<[].+/, "").trim();
76
85
  }
77
- function isLogObj(arg) {
78
- if (!isPlainObject(arg)) return false;
79
- if (!arg.message && !arg.args) return false;
80
- if (arg.stack) return false;
81
- return true;
86
+ function findAllBrackets(v) {
87
+ const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;
88
+ const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g;
89
+ const res = [];
90
+ const parse = (match) => {
91
+ let variadic = false;
92
+ let value = match[1];
93
+ if (value.startsWith("...")) {
94
+ value = value.slice(3);
95
+ variadic = true;
96
+ }
97
+ return {
98
+ required: match[0].startsWith("<"),
99
+ value,
100
+ variadic
101
+ };
102
+ };
103
+ let angledMatch;
104
+ while (angledMatch = ANGLED_BRACKET_RE_GLOBAL.exec(v)) res.push(parse(angledMatch));
105
+ let squareMatch;
106
+ while (squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v)) res.push(parse(squareMatch));
107
+ return res;
82
108
  }
83
- let paused = false;
84
- const queue = [];
85
- var Consola = class Consola {
86
- options;
87
- _lastLog;
88
- _mockFn;
89
- /**
90
- * Creates an instance of Consola with specified options or defaults.
91
- *
92
- * @param {Partial<ConsolaOptions>} [options={}] - Configuration options for the Consola instance.
93
- */
94
- constructor(options = {}) {
95
- const types = options.types || LogTypes;
96
- this.options = defu({
97
- ...options,
98
- defaults: { ...options.defaults },
99
- level: _normalizeLogLevel(options.level, types),
100
- reporters: [...options.reporters || []]
101
- }, {
102
- types: LogTypes,
103
- throttle: 1e3,
104
- throttleMin: 5,
105
- formatOptions: {
106
- date: true,
107
- colors: false,
108
- compact: true
109
- }
110
- });
111
- for (const type in types) {
112
- const defaults = {
113
- type,
114
- ...this.options.defaults,
115
- ...types[type]
116
- };
117
- this[type] = this._wrapLogFn(defaults);
118
- this[type].raw = this._wrapLogFn(defaults, true);
109
+ function getMriOptions(options) {
110
+ const result = {
111
+ alias: {},
112
+ boolean: []
113
+ };
114
+ for (const [index, option] of options.entries()) {
115
+ if (option.names.length > 1) result.alias[option.names[0]] = option.names.slice(1);
116
+ if (option.isBoolean) if (option.negated) {
117
+ if (!options.some((o, i) => {
118
+ return i !== index && o.names.some((name) => option.names.includes(name)) && typeof o.required === "boolean";
119
+ })) result.boolean.push(option.names[0]);
120
+ } else result.boolean.push(option.names[0]);
121
+ }
122
+ return result;
123
+ }
124
+ function findLongest(arr) {
125
+ return arr.sort((a, b) => {
126
+ return a.length > b.length ? -1 : 1;
127
+ })[0];
128
+ }
129
+ function padRight(str, length) {
130
+ return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
131
+ }
132
+ function camelcase(input) {
133
+ return input.replaceAll(/([a-z])-([a-z])/g, (_, p1, p2) => {
134
+ return p1 + p2.toUpperCase();
135
+ });
136
+ }
137
+ function setDotProp(obj, keys, val) {
138
+ let current = obj;
139
+ for (let i = 0; i < keys.length; i++) {
140
+ const key = keys[i];
141
+ if (i === keys.length - 1) {
142
+ current[key] = val;
143
+ return;
144
+ }
145
+ if (current[key] == null) {
146
+ const nextKeyIsArrayIndex = +keys[i + 1] > -1;
147
+ current[key] = nextKeyIsArrayIndex ? [] : {};
148
+ }
149
+ current = current[key];
150
+ }
151
+ }
152
+ function setByType(obj, transforms) {
153
+ for (const key of Object.keys(transforms)) {
154
+ const transform = transforms[key];
155
+ if (transform.shouldTransform) {
156
+ obj[key] = [obj[key]].flat();
157
+ if (typeof transform.transformFunction === "function") obj[key] = obj[key].map(transform.transformFunction);
119
158
  }
120
- if (this.options.mockFn) this.mockTypes();
121
- this._lastLog = {};
159
+ }
160
+ }
161
+ function getFileName(input) {
162
+ const m = /([^\\/]+)$/.exec(input);
163
+ return m ? m[1] : "";
164
+ }
165
+ function camelcaseOptionName(name) {
166
+ return name.split(".").map((v, i) => {
167
+ return i === 0 ? camelcase(v) : v;
168
+ }).join(".");
169
+ }
170
+ var CACError = class extends Error {
171
+ constructor(message) {
172
+ super(message);
173
+ this.name = "CACError";
174
+ if (typeof Error.captureStackTrace !== "function") this.stack = new Error(message).stack;
175
+ }
176
+ };
177
+ var Option = class {
178
+ rawName;
179
+ description;
180
+ /** Option name */
181
+ name;
182
+ /** Option name and aliases */
183
+ names;
184
+ isBoolean;
185
+ required;
186
+ config;
187
+ negated;
188
+ constructor(rawName, description, config) {
189
+ this.rawName = rawName;
190
+ this.description = description;
191
+ this.config = Object.assign({}, config);
192
+ rawName = rawName.replaceAll(".*", "");
193
+ this.negated = false;
194
+ this.names = removeBrackets(rawName).split(",").map((v) => {
195
+ let name = v.trim().replace(/^-{1,2}/, "");
196
+ if (name.startsWith("no-")) {
197
+ this.negated = true;
198
+ name = name.replace(/^no-/, "");
199
+ }
200
+ return camelcaseOptionName(name);
201
+ }).sort((a, b) => a.length > b.length ? 1 : -1);
202
+ this.name = this.names.at(-1);
203
+ if (this.negated && this.config.default == null) this.config.default = true;
204
+ if (rawName.includes("<")) this.required = true;
205
+ else if (rawName.includes("[")) this.required = false;
206
+ else this.isBoolean = true;
207
+ }
208
+ };
209
+ let runtimeProcessArgs;
210
+ let runtimeInfo;
211
+ if (typeof process !== "undefined") {
212
+ let runtimeName;
213
+ if (typeof Deno !== "undefined" && typeof Deno.version?.deno === "string") runtimeName = "deno";
214
+ else if (typeof Bun !== "undefined" && typeof Bun.version === "string") runtimeName = "bun";
215
+ else runtimeName = "node";
216
+ runtimeInfo = `${process.platform}-${process.arch} ${runtimeName}-${process.version}`;
217
+ runtimeProcessArgs = process.argv;
218
+ } else if (typeof navigator === "undefined") runtimeInfo = `unknown`;
219
+ else runtimeInfo = `${navigator.platform} ${navigator.userAgent}`;
220
+ var Command = class {
221
+ rawName;
222
+ description;
223
+ config;
224
+ cli;
225
+ options;
226
+ aliasNames;
227
+ name;
228
+ args;
229
+ commandAction;
230
+ usageText;
231
+ versionNumber;
232
+ examples;
233
+ helpCallback;
234
+ globalCommand;
235
+ constructor(rawName, description, config = {}, cli) {
236
+ this.rawName = rawName;
237
+ this.description = description;
238
+ this.config = config;
239
+ this.cli = cli;
240
+ this.options = [];
241
+ this.aliasNames = [];
242
+ this.name = removeBrackets(rawName);
243
+ this.args = findAllBrackets(rawName);
244
+ this.examples = [];
245
+ }
246
+ usage(text) {
247
+ this.usageText = text;
248
+ return this;
249
+ }
250
+ allowUnknownOptions() {
251
+ this.config.allowUnknownOptions = true;
252
+ return this;
253
+ }
254
+ ignoreOptionDefaultValue() {
255
+ this.config.ignoreOptionDefaultValue = true;
256
+ return this;
257
+ }
258
+ version(version, customFlags = "-v, --version") {
259
+ this.versionNumber = version;
260
+ this.option(customFlags, "Display version number");
261
+ return this;
262
+ }
263
+ example(example) {
264
+ this.examples.push(example);
265
+ return this;
122
266
  }
123
267
  /**
124
- * Gets the current log level of the Consola instance.
125
- *
126
- * @returns {number} The current log level.
268
+ * Add a option for this command
269
+ * @param rawName Raw option name(s)
270
+ * @param description Option description
271
+ * @param config Option config
127
272
  */
128
- get level() {
129
- return this.options.level;
273
+ option(rawName, description, config) {
274
+ const option = new Option(rawName, description, config);
275
+ this.options.push(option);
276
+ return this;
277
+ }
278
+ alias(name) {
279
+ this.aliasNames.push(name);
280
+ return this;
281
+ }
282
+ action(callback) {
283
+ this.commandAction = callback;
284
+ return this;
130
285
  }
131
286
  /**
132
- * Sets the minimum log level that will be output by the instance.
133
- *
134
- * @param {number} level - The new log level to set.
287
+ * Check if a command name is matched by this command
288
+ * @param name Command name
135
289
  */
136
- set level(level) {
137
- this.options.level = _normalizeLogLevel(level, this.options.types, this.options.level);
290
+ isMatched(name) {
291
+ return this.name === name || this.aliasNames.includes(name);
292
+ }
293
+ get isDefaultCommand() {
294
+ return this.name === "" || this.aliasNames.includes("!");
295
+ }
296
+ get isGlobalCommand() {
297
+ return this instanceof GlobalCommand;
138
298
  }
139
299
  /**
140
- * Displays a prompt to the user and returns the response.
141
- * Throw an error if `prompt` is not supported by the current configuration.
142
- *
143
- * @template T
144
- * @param {string} message - The message to display in the prompt.
145
- * @param {T} [opts] - Optional options for the prompt. See {@link PromptOptions}.
146
- * @returns {promise<T>} A promise that infer with the prompt options. See {@link PromptOptions}.
300
+ * Check if an option is registered in this command
301
+ * @param name Option name
147
302
  */
148
- prompt(message, opts) {
149
- if (!this.options.prompt) throw new Error("prompt is not supported!");
150
- return this.options.prompt(message, opts);
303
+ hasOption(name) {
304
+ name = name.split(".")[0];
305
+ return this.options.find((option) => {
306
+ return option.names.includes(name);
307
+ });
308
+ }
309
+ outputHelp() {
310
+ const { name, commands } = this.cli;
311
+ const { versionNumber, options: globalOptions, helpCallback } = this.cli.globalCommand;
312
+ let sections = [{ body: `${name}${versionNumber ? `/${versionNumber}` : ""}` }];
313
+ sections.push({
314
+ title: "Usage",
315
+ body: ` $ ${name} ${this.usageText || this.rawName}`
316
+ });
317
+ if ((this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0) {
318
+ const longestCommandName = findLongest(commands.map((command) => command.rawName));
319
+ sections.push({
320
+ title: "Commands",
321
+ body: commands.map((command) => {
322
+ return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
323
+ }).join("\n")
324
+ }, {
325
+ title: `For more info, run any command with the \`--help\` flag`,
326
+ body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join("\n")
327
+ });
328
+ }
329
+ let options = this.isGlobalCommand ? globalOptions : [...this.options, ...globalOptions || []];
330
+ if (!this.isGlobalCommand && !this.isDefaultCommand) options = options.filter((option) => option.name !== "version");
331
+ if (options.length > 0) {
332
+ const longestOptionName = findLongest(options.map((option) => option.rawName));
333
+ sections.push({
334
+ title: "Options",
335
+ body: options.map((option) => {
336
+ return ` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${option.config.default === void 0 ? "" : `(default: ${option.config.default})`}`;
337
+ }).join("\n")
338
+ });
339
+ }
340
+ if (this.examples.length > 0) sections.push({
341
+ title: "Examples",
342
+ body: this.examples.map((example) => {
343
+ if (typeof example === "function") return example(name);
344
+ return example;
345
+ }).join("\n")
346
+ });
347
+ if (helpCallback) sections = helpCallback(sections) || sections;
348
+ console.info(sections.map((section) => {
349
+ return section.title ? `${section.title}:\n${section.body}` : section.body;
350
+ }).join("\n\n"));
351
+ }
352
+ outputVersion() {
353
+ const { name } = this.cli;
354
+ const { versionNumber } = this.cli.globalCommand;
355
+ if (versionNumber) console.info(`${name}/${versionNumber} ${runtimeInfo}`);
356
+ }
357
+ checkRequiredArgs() {
358
+ const minimalArgsCount = this.args.filter((arg) => arg.required).length;
359
+ if (this.cli.args.length < minimalArgsCount) throw new CACError(`missing required args for command \`${this.rawName}\``);
151
360
  }
152
361
  /**
153
- * Creates a new instance of Consola, inheriting options from the current instance, with possible overrides.
362
+ * Check if the parsed options contain any unknown options
154
363
  *
155
- * @param {Partial<ConsolaOptions>} options - Optional overrides for the new instance. See {@link ConsolaOptions}.
156
- * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
364
+ * Exit and output error when true
157
365
  */
158
- create(options) {
159
- const instance = new Consola({
160
- ...this.options,
161
- ...options
162
- });
163
- if (this._mockFn) instance.mockTypes(this._mockFn);
164
- return instance;
366
+ checkUnknownOptions() {
367
+ const { options, globalCommand } = this.cli;
368
+ if (!this.config.allowUnknownOptions) {
369
+ for (const name of Object.keys(options)) if (name !== "--" && !this.hasOption(name) && !globalCommand.hasOption(name)) throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);
370
+ }
165
371
  }
166
372
  /**
167
- * Creates a new Consola instance with the specified default log object properties.
168
- *
169
- * @param {InputLogObject} defaults - Default properties to include in any log from the new instance. See {@link InputLogObject}.
170
- * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
373
+ * Check if the required string-type options exist
171
374
  */
172
- withDefaults(defaults) {
173
- return this.create({
174
- ...this.options,
175
- defaults: {
176
- ...this.options.defaults,
177
- ...defaults
375
+ checkOptionValue() {
376
+ const { options: parsedOptions, globalCommand } = this.cli;
377
+ const options = [...globalCommand.options, ...this.options];
378
+ for (const option of options) {
379
+ const value = parsedOptions[option.name.split(".")[0]];
380
+ if (option.required) {
381
+ const hasNegated = options.some((o) => o.negated && o.names.includes(option.name));
382
+ if (value === true || value === false && !hasNegated) throw new CACError(`option \`${option.rawName}\` value is missing`);
178
383
  }
179
- });
384
+ }
180
385
  }
181
386
  /**
182
- * Creates a new Consola instance with a specified tag, which will be included in every log.
183
- *
184
- * @param {string} tag - The tag to include in each log of the new instance.
185
- * @returns {ConsolaInstance} A new Consola instance. See {@link ConsolaInstance}.
387
+ * Check if the number of args is more than expected
186
388
  */
187
- withTag(tag) {
188
- return this.withDefaults({ tag: this.options.defaults.tag ? this.options.defaults.tag + ":" + tag : tag });
389
+ checkUnusedArgs() {
390
+ const maximumArgsCount = this.args.some((arg) => arg.variadic) ? Infinity : this.args.length;
391
+ if (maximumArgsCount < this.cli.args.length) throw new CACError(`Unused args: ${this.cli.args.slice(maximumArgsCount).map((arg) => `\`${arg}\``).join(", ")}`);
189
392
  }
393
+ };
394
+ var GlobalCommand = class extends Command {
395
+ constructor(cli) {
396
+ super("@@global@@", "", {}, cli);
397
+ }
398
+ };
399
+ var CAC = class extends EventTarget {
400
+ /** The program name to display in help and version message */
401
+ name;
402
+ commands;
403
+ globalCommand;
404
+ matchedCommand;
405
+ matchedCommandName;
190
406
  /**
191
- * Adds a custom reporter to the Consola instance.
192
- * Reporters will be called for each log message, depending on their implementation and log level.
193
- *
194
- * @param {ConsolaReporter} reporter - The reporter to add. See {@link ConsolaReporter}.
195
- * @returns {Consola} The current Consola instance.
407
+ * Raw CLI arguments
196
408
  */
197
- addReporter(reporter) {
198
- this.options.reporters.push(reporter);
199
- return this;
200
- }
409
+ rawArgs;
201
410
  /**
202
- * Removes a custom reporter from the Consola instance.
203
- * If no reporter is specified, all reporters will be removed.
204
- *
205
- * @param {ConsolaReporter} reporter - The reporter to remove. See {@link ConsolaReporter}.
206
- * @returns {Consola} The current Consola instance.
411
+ * Parsed CLI arguments
207
412
  */
208
- removeReporter(reporter) {
209
- if (reporter) {
210
- const i = this.options.reporters.indexOf(reporter);
211
- if (i !== -1) return this.options.reporters.splice(i, 1);
212
- } else this.options.reporters.splice(0);
213
- return this;
413
+ args;
414
+ /**
415
+ * Parsed CLI options, camelCased
416
+ */
417
+ options;
418
+ showHelpOnExit;
419
+ showVersionOnExit;
420
+ /**
421
+ * @param name The program name to display in help and version message
422
+ */
423
+ constructor(name = "") {
424
+ super();
425
+ this.name = name;
426
+ this.commands = [];
427
+ this.rawArgs = [];
428
+ this.args = [];
429
+ this.options = {};
430
+ this.globalCommand = new GlobalCommand(this);
431
+ this.globalCommand.usage("<command> [options]");
214
432
  }
215
433
  /**
216
- * Replaces all reporters of the Consola instance with the specified array of reporters.
434
+ * Add a global usage text.
217
435
  *
218
- * @param {ConsolaReporter[]} reporters - The new reporters to set. See {@link ConsolaReporter}.
219
- * @returns {Consola} The current Consola instance.
436
+ * This is not used by sub-commands.
220
437
  */
221
- setReporters(reporters) {
222
- this.options.reporters = Array.isArray(reporters) ? reporters : [reporters];
438
+ usage(text) {
439
+ this.globalCommand.usage(text);
223
440
  return this;
224
441
  }
225
- wrapAll() {
226
- this.wrapConsole();
227
- this.wrapStd();
228
- }
229
- restoreAll() {
230
- this.restoreConsole();
231
- this.restoreStd();
232
- }
233
442
  /**
234
- * Overrides console methods with Consola logging methods for consistent logging.
443
+ * Add a sub-command
235
444
  */
236
- wrapConsole() {
237
- for (const type in this.options.types) {
238
- if (!console["__" + type]) console["__" + type] = console[type];
239
- console[type] = this[type].raw;
240
- }
445
+ command(rawName, description, config) {
446
+ const command = new Command(rawName, description || "", config, this);
447
+ command.globalCommand = this.globalCommand;
448
+ this.commands.push(command);
449
+ return command;
241
450
  }
242
451
  /**
243
- * Restores the original console methods, removing Consola overrides.
452
+ * Add a global CLI option.
453
+ *
454
+ * Which is also applied to sub-commands.
244
455
  */
245
- restoreConsole() {
246
- for (const type in this.options.types) if (console["__" + type]) {
247
- console[type] = console["__" + type];
248
- delete console["__" + type];
249
- }
456
+ option(rawName, description, config) {
457
+ this.globalCommand.option(rawName, description, config);
458
+ return this;
250
459
  }
251
460
  /**
252
- * Overrides standard output and error streams to redirect them through Consola.
461
+ * Show help message when `-h, --help` flags appear.
462
+ *
253
463
  */
254
- wrapStd() {
255
- this._wrapStream(this.options.stdout, "log");
256
- this._wrapStream(this.options.stderr, "log");
257
- }
258
- _wrapStream(stream, type) {
259
- if (!stream) return;
260
- if (!stream.__write) stream.__write = stream.write;
261
- stream.write = (data) => {
262
- this[type].raw(String(data).trim());
263
- };
464
+ help(callback) {
465
+ this.globalCommand.option("-h, --help", "Display this message");
466
+ this.globalCommand.helpCallback = callback;
467
+ this.showHelpOnExit = true;
468
+ return this;
264
469
  }
265
470
  /**
266
- * Restores the original standard output and error streams, removing the Consola redirection.
471
+ * Show version number when `-v, --version` flags appear.
472
+ *
267
473
  */
268
- restoreStd() {
269
- this._restoreStream(this.options.stdout);
270
- this._restoreStream(this.options.stderr);
271
- }
272
- _restoreStream(stream) {
273
- if (!stream) return;
274
- if (stream.__write) {
275
- stream.write = stream.__write;
276
- delete stream.__write;
277
- }
474
+ version(version, customFlags = "-v, --version") {
475
+ this.globalCommand.version(version, customFlags);
476
+ this.showVersionOnExit = true;
477
+ return this;
278
478
  }
279
479
  /**
280
- * Pauses logging, queues incoming logs until resumed.
480
+ * Add a global example.
481
+ *
482
+ * This example added here will not be used by sub-commands.
281
483
  */
282
- pauseLogs() {
283
- paused = true;
484
+ example(example) {
485
+ this.globalCommand.example(example);
486
+ return this;
284
487
  }
285
488
  /**
286
- * Resumes logging, processing any queued logs.
489
+ * Output the corresponding help message
490
+ * When a sub-command is matched, output the help message for the command
491
+ * Otherwise output the global one.
492
+ *
287
493
  */
288
- resumeLogs() {
289
- paused = false;
290
- const _queue = queue.splice(0);
291
- for (const item of _queue) item[0]._logFn(item[1], item[2]);
494
+ outputHelp() {
495
+ if (this.matchedCommand) this.matchedCommand.outputHelp();
496
+ else this.globalCommand.outputHelp();
292
497
  }
293
498
  /**
294
- * Replaces logging methods with mocks if a mock function is provided.
499
+ * Output the version number.
295
500
  *
296
- * @param {ConsolaOptions["mockFn"]} mockFn - The function to use for mocking logging methods. See {@link ConsolaOptions["mockFn"]}.
297
501
  */
298
- mockTypes(mockFn) {
299
- const _mockFn = mockFn || this.options.mockFn;
300
- this._mockFn = _mockFn;
301
- if (typeof _mockFn !== "function") return;
302
- for (const type in this.options.types) {
303
- this[type] = _mockFn(type, this.options.types[type]) || this[type];
304
- this[type].raw = this[type];
305
- }
502
+ outputVersion() {
503
+ this.globalCommand.outputVersion();
306
504
  }
307
- _wrapLogFn(defaults, isRaw) {
308
- return (...args) => {
309
- if (paused) {
310
- queue.push([
311
- this,
312
- defaults,
313
- args,
314
- isRaw
315
- ]);
316
- return;
317
- }
318
- return this._logFn(defaults, args, isRaw);
319
- };
505
+ setParsedInfo({ args, options }, matchedCommand, matchedCommandName) {
506
+ this.args = args;
507
+ this.options = options;
508
+ if (matchedCommand) this.matchedCommand = matchedCommand;
509
+ if (matchedCommandName) this.matchedCommandName = matchedCommandName;
510
+ return this;
320
511
  }
321
- _logFn(defaults, args, isRaw) {
322
- if ((defaults.level || 0) > this.level) return false;
323
- const logObj = {
324
- date: /* @__PURE__ */ new Date(),
325
- args: [],
326
- ...defaults,
327
- level: _normalizeLogLevel(defaults.level, this.options.types)
328
- };
329
- if (!isRaw && args.length === 1 && isLogObj(args[0])) Object.assign(logObj, args[0]);
330
- else logObj.args = [...args];
331
- if (logObj.message) {
332
- logObj.args.unshift(logObj.message);
333
- delete logObj.message;
334
- }
335
- if (logObj.additional) {
336
- if (!Array.isArray(logObj.additional)) logObj.additional = logObj.additional.split("\n");
337
- logObj.args.push("\n" + logObj.additional.join("\n"));
338
- delete logObj.additional;
512
+ unsetMatchedCommand() {
513
+ this.matchedCommand = void 0;
514
+ this.matchedCommandName = void 0;
515
+ }
516
+ /**
517
+ * Parse argv
518
+ */
519
+ parse(argv, { run = true } = {}) {
520
+ if (!argv) {
521
+ if (!runtimeProcessArgs) throw new Error("No argv provided and runtime process argv is not available.");
522
+ argv = runtimeProcessArgs;
339
523
  }
340
- logObj.type = typeof logObj.type === "string" ? logObj.type.toLowerCase() : "log";
341
- logObj.tag = typeof logObj.tag === "string" ? logObj.tag : "";
342
- const resolveLog = (newLog = false) => {
343
- const repeated = (this._lastLog.count || 0) - this.options.throttleMin;
344
- if (this._lastLog.object && repeated > 0) {
345
- const args2 = [...this._lastLog.object.args];
346
- if (repeated > 1) args2.push(`(repeated ${repeated} times)`);
347
- this._log({
348
- ...this._lastLog.object,
349
- args: args2
350
- });
351
- this._lastLog.count = 1;
352
- }
353
- if (newLog) {
354
- this._lastLog.object = logObj;
355
- this._log(logObj);
524
+ this.rawArgs = argv;
525
+ if (!this.name) this.name = argv[1] ? getFileName(argv[1]) : "cli";
526
+ let shouldParse = true;
527
+ for (const command of this.commands) {
528
+ const parsed = this.mri(argv.slice(2), command);
529
+ const commandName = parsed.args[0];
530
+ if (command.isMatched(commandName)) {
531
+ shouldParse = false;
532
+ const parsedInfo = {
533
+ ...parsed,
534
+ args: parsed.args.slice(1)
535
+ };
536
+ this.setParsedInfo(parsedInfo, command, commandName);
537
+ this.dispatchEvent(new CustomEvent(`command:${commandName}`, { detail: command }));
356
538
  }
357
- };
358
- clearTimeout(this._lastLog.timeout);
359
- const diffTime = this._lastLog.time && logObj.date ? logObj.date.getTime() - this._lastLog.time.getTime() : 0;
360
- this._lastLog.time = logObj.date;
361
- if (diffTime < this.options.throttle) try {
362
- const serializedLog = JSON.stringify([
363
- logObj.type,
364
- logObj.tag,
365
- logObj.args
366
- ]);
367
- const isSameLog = this._lastLog.serialized === serializedLog;
368
- this._lastLog.serialized = serializedLog;
369
- if (isSameLog) {
370
- this._lastLog.count = (this._lastLog.count || 0) + 1;
371
- if (this._lastLog.count > this.options.throttleMin) {
372
- this._lastLog.timeout = setTimeout(resolveLog, this.options.throttle);
373
- return;
374
- }
539
+ }
540
+ if (shouldParse) {
541
+ for (const command of this.commands) if (command.isDefaultCommand) {
542
+ shouldParse = false;
543
+ const parsed = this.mri(argv.slice(2), command);
544
+ this.setParsedInfo(parsed, command);
545
+ this.dispatchEvent(new CustomEvent("command:!", { detail: command }));
375
546
  }
376
- } catch {}
377
- resolveLog(true);
378
- }
379
- _log(logObj) {
380
- for (const reporter of this.options.reporters) reporter.log(logObj, { options: this.options });
381
- }
382
- };
383
- function _normalizeLogLevel(input, types = {}, defaultLevel = 3) {
384
- if (input === void 0) return defaultLevel;
385
- if (typeof input === "number") return input;
386
- if (types[input] && types[input].level !== void 0) return types[input].level;
387
- return defaultLevel;
388
- }
389
- Consola.prototype.add = Consola.prototype.addReporter;
390
- Consola.prototype.remove = Consola.prototype.removeReporter;
391
- Consola.prototype.clear = Consola.prototype.removeReporter;
392
- Consola.prototype.withScope = Consola.prototype.withTag;
393
- Consola.prototype.mock = Consola.prototype.mockTypes;
394
- Consola.prototype.pause = Consola.prototype.pauseLogs;
395
- Consola.prototype.resume = Consola.prototype.resumeLogs;
396
- function createConsola$1(options = {}) {
397
- return new Consola(options);
398
- }
399
-
400
- //#endregion
401
- //#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DRwqZj3T.mjs
402
- function parseStack(stack, message) {
403
- const cwd = process.cwd() + sep;
404
- return stack.split("\n").splice(message.split("\n").length).map((l) => l.trim().replace("file://", "").replace(cwd, ""));
405
- }
406
- function writeStream(data, stream) {
407
- return (stream.__write || stream.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 ?? 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
- return formatWithOptions(opts, ...args.map((arg) => {
429
- if (arg && typeof arg.stack === "string") return this.formatError(arg, opts);
430
- return arg;
431
- }));
432
- }
433
- formatDate(date, opts) {
434
- return opts.date ? date.toLocaleTimeString() : "";
435
- }
436
- filterAndJoin(arr) {
437
- return arr.filter(Boolean).join(" ");
438
- }
439
- formatLogObj(logObj, opts) {
440
- const message = this.formatArgs(logObj.args, opts);
441
- if (logObj.type === "box") return "\n" + [
442
- bracket(logObj.tag),
443
- logObj.title && logObj.title,
444
- ...message.split("\n")
445
- ].filter(Boolean).map((l) => " > " + l).join("\n") + "\n";
446
- return this.filterAndJoin([
447
- bracket(logObj.type),
448
- bracket(logObj.tag),
449
- message
450
- ]);
451
- }
452
- log(logObj, ctx) {
453
- return writeStream(this.formatLogObj(logObj, {
454
- columns: ctx.options.stdout.columns || 0,
455
- ...ctx.options.formatOptions
456
- }) + "\n", logObj.level < 2 ? ctx.options.stderr || process.stderr : ctx.options.stdout || process.stdout);
457
- }
458
- };
459
-
460
- //#endregion
461
- //#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/shared/consola.DXBYu-KD.mjs
462
- const { env = {}, argv = [], platform = "" } = typeof process === "undefined" ? {} : process;
463
- const isDisabled = "NO_COLOR" in env || argv.includes("--no-color");
464
- const isForced = "FORCE_COLOR" in env || argv.includes("--color");
465
- const isWindows = platform === "win32";
466
- const isDumbTerminal = env.TERM === "dumb";
467
- const isCompatibleTerminal = tty && tty.isatty && tty.isatty(1) && env.TERM && !isDumbTerminal;
468
- const isCI = "CI" in env && ("GITHUB_ACTIONS" in env || "GITLAB_CI" in env || "CIRCLECI" in env);
469
- const isColorSupported = !isDisabled && (isForced || isWindows && !isDumbTerminal || isCompatibleTerminal || isCI);
470
- 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)) {
471
- return head + (next < 0 ? tail : replaceClose(next, tail, close, replace));
472
- }
473
- function clearBleed(index, string, open, close, replace) {
474
- return index < 0 ? open + string + close : open + replaceClose(index, string, close, replace) + close;
475
- }
476
- function filterEmpty(open, close, replace = open, at = open.length + 1) {
477
- return (string) => string || !(string === "" || string === void 0) ? clearBleed(("" + string).indexOf(close, at), string, open, close, replace) : "";
478
- }
479
- function init(open, close, replace) {
480
- return filterEmpty(`\x1B[${open}m`, `\x1B[${close}m`, replace);
481
- }
482
- const colorDefs = {
483
- reset: init(0, 0),
484
- bold: init(1, 22, "\x1B[22m\x1B[1m"),
485
- dim: init(2, 22, "\x1B[22m\x1B[2m"),
486
- italic: init(3, 23),
487
- underline: init(4, 24),
488
- inverse: init(7, 27),
489
- hidden: init(8, 28),
490
- strikethrough: init(9, 29),
491
- black: init(30, 39),
492
- red: init(31, 39),
493
- green: init(32, 39),
494
- yellow: init(33, 39),
495
- blue: init(34, 39),
496
- magenta: init(35, 39),
497
- cyan: init(36, 39),
498
- white: init(37, 39),
499
- gray: init(90, 39),
500
- bgBlack: init(40, 49),
501
- bgRed: init(41, 49),
502
- bgGreen: init(42, 49),
503
- bgYellow: init(43, 49),
504
- bgBlue: init(44, 49),
505
- bgMagenta: init(45, 49),
506
- bgCyan: init(46, 49),
507
- bgWhite: init(47, 49),
508
- blackBright: init(90, 39),
509
- redBright: init(91, 39),
510
- greenBright: init(92, 39),
511
- yellowBright: init(93, 39),
512
- blueBright: init(94, 39),
513
- magentaBright: init(95, 39),
514
- cyanBright: init(96, 39),
515
- whiteBright: init(97, 39),
516
- bgBlackBright: init(100, 49),
517
- bgRedBright: init(101, 49),
518
- bgGreenBright: init(102, 49),
519
- bgYellowBright: init(103, 49),
520
- bgBlueBright: init(104, 49),
521
- bgMagentaBright: init(105, 49),
522
- bgCyanBright: init(106, 49),
523
- bgWhiteBright: init(107, 49)
524
- };
525
- function createColors(useColor = isColorSupported) {
526
- return useColor ? colorDefs : Object.fromEntries(Object.keys(colorDefs).map((key) => [key, String]));
527
- }
528
- const colors = createColors();
529
- function getColor$1(color, fallback = "reset") {
530
- return colors[color] || colors[fallback];
531
- }
532
- 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("|");
533
- function stripAnsi$1(text) {
534
- return text.replace(new RegExp(ansiRegex$1, "g"), "");
535
- }
536
- const boxStylePresets = {
537
- solid: {
538
- tl: "┌",
539
- tr: "┐",
540
- bl: "└",
541
- br: "┘",
542
- h: "─",
543
- v: "│"
544
- },
545
- double: {
546
- tl: "╔",
547
- tr: "╗",
548
- bl: "╚",
549
- br: "╝",
550
- h: "═",
551
- v: "║"
552
- },
553
- doubleSingle: {
554
- tl: "╓",
555
- tr: "╖",
556
- bl: "╙",
557
- br: "╜",
558
- h: "─",
559
- v: "║"
560
- },
561
- doubleSingleRounded: {
562
- tl: "╭",
563
- tr: "╮",
564
- bl: "╰",
565
- br: "╯",
566
- h: "─",
567
- v: "║"
568
- },
569
- singleThick: {
570
- tl: "┏",
571
- tr: "┓",
572
- bl: "┗",
573
- br: "┛",
574
- h: "━",
575
- v: "┃"
576
- },
577
- singleDouble: {
578
- tl: "╒",
579
- tr: "╕",
580
- bl: "╘",
581
- br: "╛",
582
- h: "═",
583
- v: "│"
584
- },
585
- singleDoubleRounded: {
586
- tl: "╭",
587
- tr: "╮",
588
- bl: "╰",
589
- br: "╯",
590
- h: "═",
591
- v: "│"
592
- },
593
- rounded: {
594
- tl: "╭",
595
- tr: "╮",
596
- bl: "╰",
597
- br: "╯",
598
- h: "─",
599
- v: "│"
600
- }
601
- };
602
- const defaultStyle = {
603
- borderColor: "white",
604
- borderStyle: "rounded",
605
- valign: "center",
606
- padding: 2,
607
- marginLeft: 1,
608
- marginTop: 1,
609
- marginBottom: 1
610
- };
611
- function box(text, _opts = {}) {
612
- const opts = {
613
- ..._opts,
614
- style: {
615
- ...defaultStyle,
616
- ..._opts.style
617
547
  }
618
- };
619
- const textLines = text.split("\n");
620
- const boxLines = [];
621
- const _color = getColor$1(opts.style.borderColor);
622
- const borderStyle = { ...typeof opts.style.borderStyle === "string" ? boxStylePresets[opts.style.borderStyle] || boxStylePresets.solid : opts.style.borderStyle };
623
- if (_color) for (const key in borderStyle) borderStyle[key] = _color(borderStyle[key]);
624
- const paddingOffset = opts.style.padding % 2 === 0 ? opts.style.padding : opts.style.padding + 1;
625
- const height = textLines.length + paddingOffset;
626
- const width = Math.max(...textLines.map((line) => stripAnsi$1(line).length), opts.title ? stripAnsi$1(opts.title).length : 0) + paddingOffset;
627
- const widthOffset = width + paddingOffset;
628
- const leftSpace = opts.style.marginLeft > 0 ? " ".repeat(opts.style.marginLeft) : "";
629
- if (opts.style.marginTop > 0) boxLines.push("".repeat(opts.style.marginTop));
630
- if (opts.title) {
631
- const title = _color ? _color(opts.title) : opts.title;
632
- const left = borderStyle.h.repeat(Math.floor((width - stripAnsi$1(opts.title).length) / 2));
633
- const right = borderStyle.h.repeat(width - stripAnsi$1(opts.title).length - stripAnsi$1(left).length + paddingOffset);
634
- boxLines.push(`${leftSpace}${borderStyle.tl}${left}${title}${right}${borderStyle.tr}`);
635
- } else boxLines.push(`${leftSpace}${borderStyle.tl}${borderStyle.h.repeat(widthOffset)}${borderStyle.tr}`);
636
- const valignOffset = opts.style.valign === "center" ? Math.floor((height - textLines.length) / 2) : opts.style.valign === "top" ? height - textLines.length - paddingOffset : height - textLines.length;
637
- for (let i = 0; i < height; i++) if (i < valignOffset || i >= valignOffset + textLines.length) boxLines.push(`${leftSpace}${borderStyle.v}${" ".repeat(widthOffset)}${borderStyle.v}`);
638
- else {
639
- const line = textLines[i - valignOffset];
640
- const left = " ".repeat(paddingOffset);
641
- const right = " ".repeat(width - stripAnsi$1(line).length);
642
- boxLines.push(`${leftSpace}${borderStyle.v}${left}${line}${right}${borderStyle.v}`);
643
- }
644
- boxLines.push(`${leftSpace}${borderStyle.bl}${borderStyle.h.repeat(widthOffset)}${borderStyle.br}`);
645
- if (opts.style.marginBottom > 0) boxLines.push("".repeat(opts.style.marginBottom));
646
- return boxLines.join("\n");
647
- }
648
-
649
- //#endregion
650
- //#region ../../node_modules/.pnpm/consola@3.4.2/node_modules/consola/dist/index.mjs
651
- const r = Object.create(null), i = (e) => globalThis.process?.env || import.meta.env || globalThis.Deno?.env.toObject() || globalThis.__env__ || (e ? r : globalThis), o = new Proxy(r, {
652
- get(e, s) {
653
- return i()[s] ?? r[s];
654
- },
655
- has(e, s) {
656
- return s in i() || s in r;
657
- },
658
- set(e, s, E) {
659
- const B = i(true);
660
- return B[s] = E, true;
661
- },
662
- deleteProperty(e, s) {
663
- if (!s) return false;
664
- const E = i(true);
665
- return delete E[s], true;
666
- },
667
- ownKeys() {
668
- const e = i(true);
669
- return Object.keys(e);
670
- }
671
- }), t = typeof process < "u" && process.env && process.env.NODE_ENV || "", f = [
672
- ["APPVEYOR"],
673
- [
674
- "AWS_AMPLIFY",
675
- "AWS_APP_ID",
676
- { ci: true }
677
- ],
678
- ["AZURE_PIPELINES", "SYSTEM_TEAMFOUNDATIONCOLLECTIONURI"],
679
- ["AZURE_STATIC", "INPUT_AZURE_STATIC_WEB_APPS_API_TOKEN"],
680
- ["APPCIRCLE", "AC_APPCIRCLE"],
681
- ["BAMBOO", "bamboo_planKey"],
682
- ["BITBUCKET", "BITBUCKET_COMMIT"],
683
- ["BITRISE", "BITRISE_IO"],
684
- ["BUDDY", "BUDDY_WORKSPACE_ID"],
685
- ["BUILDKITE"],
686
- ["CIRCLE", "CIRCLECI"],
687
- ["CIRRUS", "CIRRUS_CI"],
688
- [
689
- "CLOUDFLARE_PAGES",
690
- "CF_PAGES",
691
- { ci: true }
692
- ],
693
- ["CODEBUILD", "CODEBUILD_BUILD_ARN"],
694
- ["CODEFRESH", "CF_BUILD_ID"],
695
- ["DRONE"],
696
- ["DRONE", "DRONE_BUILD_EVENT"],
697
- ["DSARI"],
698
- ["GITHUB_ACTIONS"],
699
- ["GITLAB", "GITLAB_CI"],
700
- ["GITLAB", "CI_MERGE_REQUEST_ID"],
701
- ["GOCD", "GO_PIPELINE_LABEL"],
702
- ["LAYERCI"],
703
- ["HUDSON", "HUDSON_URL"],
704
- ["JENKINS", "JENKINS_URL"],
705
- ["MAGNUM"],
706
- ["NETLIFY"],
707
- [
708
- "NETLIFY",
709
- "NETLIFY_LOCAL",
710
- { ci: false }
711
- ],
712
- ["NEVERCODE"],
713
- ["RENDER"],
714
- ["SAIL", "SAILCI"],
715
- ["SEMAPHORE"],
716
- ["SCREWDRIVER"],
717
- ["SHIPPABLE"],
718
- ["SOLANO", "TDDIUM"],
719
- ["STRIDER"],
720
- ["TEAMCITY", "TEAMCITY_VERSION"],
721
- ["TRAVIS"],
722
- ["VERCEL", "NOW_BUILDER"],
723
- [
724
- "VERCEL",
725
- "VERCEL",
726
- { ci: false }
727
- ],
728
- [
729
- "VERCEL",
730
- "VERCEL_ENV",
731
- { ci: false }
732
- ],
733
- ["APPCENTER", "APPCENTER_BUILD_ID"],
734
- [
735
- "CODESANDBOX",
736
- "CODESANDBOX_SSE",
737
- { ci: false }
738
- ],
739
- [
740
- "CODESANDBOX",
741
- "CODESANDBOX_HOST",
742
- { ci: false }
743
- ],
744
- ["STACKBLITZ"],
745
- ["STORMKIT"],
746
- ["CLEAVR"],
747
- ["ZEABUR"],
748
- [
749
- "CODESPHERE",
750
- "CODESPHERE_APP_ID",
751
- { ci: true }
752
- ],
753
- ["RAILWAY", "RAILWAY_PROJECT_ID"],
754
- ["RAILWAY", "RAILWAY_SERVICE_ID"],
755
- ["DENO-DEPLOY", "DENO_DEPLOYMENT_ID"],
756
- [
757
- "FIREBASE_APP_HOSTING",
758
- "FIREBASE_APP_HOSTING",
759
- { ci: true }
760
- ]
761
- ];
762
- function b() {
763
- if (globalThis.process?.env) for (const e of f) {
764
- const s = e[1] || e[0];
765
- if (globalThis.process?.env[s]) return {
766
- name: e[0].toLowerCase(),
767
- ...e[2]
548
+ if (shouldParse) {
549
+ const parsed = this.mri(argv.slice(2));
550
+ this.setParsedInfo(parsed);
551
+ }
552
+ if (this.options.help && this.showHelpOnExit) {
553
+ this.outputHelp();
554
+ run = false;
555
+ this.unsetMatchedCommand();
556
+ }
557
+ if (this.options.version && this.showVersionOnExit && this.matchedCommandName == null) {
558
+ this.outputVersion();
559
+ run = false;
560
+ this.unsetMatchedCommand();
561
+ }
562
+ const parsedArgv = {
563
+ args: this.args,
564
+ options: this.options
768
565
  };
566
+ if (run) this.runMatchedCommand();
567
+ if (!this.matchedCommand && this.args[0]) this.dispatchEvent(new CustomEvent("command:*", { detail: this.args[0] }));
568
+ return parsedArgv;
769
569
  }
770
- return globalThis.process?.env?.SHELL === "/bin/jsh" && globalThis.process?.versions?.webcontainer ? {
771
- name: "stackblitz",
772
- ci: false
773
- } : {
774
- name: "",
775
- ci: false
776
- };
777
- }
778
- const l = b();
779
- l.name;
780
- function n(e) {
781
- return e ? e !== "false" : false;
782
- }
783
- 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);
784
- n(o.MINIMAL);
785
- const A = /^win/i.test(I);
786
- !n(o.NO_COLOR) && (n(o.FORCE_COLOR) || (a || A) && o.TERM);
787
- const C = (globalThis.process?.versions?.node || "").replace(/^v/, "") || null;
788
- Number(C?.split(".")[0]);
789
- const y = globalThis.process || Object.create(null), _ = { versions: {} };
790
- new Proxy(y, { get(e, s) {
791
- if (s === "env") return o;
792
- if (s in e) return e[s];
793
- if (s in _) return _[s];
794
- } });
795
- 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 = [
796
- [S, "netlify"],
797
- [u, "edge-light"],
798
- [N, "workerd"],
799
- [L, "fastly"],
800
- [D, "deno"],
801
- [O, "bun"],
802
- [c, "node"]
803
- ];
804
- function G() {
805
- const e = F.find((s) => s[0]);
806
- if (e) return { name: e[1] };
807
- }
808
- G()?.name;
809
- function ansiRegex({ onlyFirst = false } = {}) {
810
- const pattern = [`[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?(?:\\u0007|\\u001B\\u005C|\\u009C))`, "(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-nq-uy=><~]))"].join("|");
811
- return new RegExp(pattern, onlyFirst ? void 0 : "g");
812
- }
813
- const regex = ansiRegex();
814
- function stripAnsi(string) {
815
- if (typeof string !== "string") throw new TypeError(`Expected a \`string\`, got \`${typeof string}\``);
816
- return string.replace(regex, "");
817
- }
818
- function isAmbiguous(x) {
819
- 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;
820
- }
821
- function isFullWidth(x) {
822
- return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
823
- }
824
- function isWide(x) {
825
- 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;
826
- }
827
- function validate(codePoint) {
828
- if (!Number.isSafeInteger(codePoint)) throw new TypeError(`Expected a code point, got \`${typeof codePoint}\`.`);
829
- }
830
- function eastAsianWidth(codePoint, { ambiguousAsWide = false } = {}) {
831
- validate(codePoint);
832
- if (isFullWidth(codePoint) || isWide(codePoint) || ambiguousAsWide && isAmbiguous(codePoint)) return 2;
833
- return 1;
834
- }
835
- const emojiRegex = () => {
836
- 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;
837
- };
838
- const segmenter = globalThis.Intl?.Segmenter ? new Intl.Segmenter() : { segment: (str) => str.split("") };
839
- const defaultIgnorableCodePointRegex = /^\p{Default_Ignorable_Code_Point}$/u;
840
- function stringWidth$1(string, options = {}) {
841
- if (typeof string !== "string" || string.length === 0) return 0;
842
- const { ambiguousIsNarrow = true, countAnsiEscapeCodes = false } = options;
843
- if (!countAnsiEscapeCodes) string = stripAnsi(string);
844
- if (string.length === 0) return 0;
845
- let width = 0;
846
- const eastAsianWidthOptions = { ambiguousAsWide: !ambiguousIsNarrow };
847
- for (const { segment: character } of segmenter.segment(string)) {
848
- const codePoint = character.codePointAt(0);
849
- if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159) continue;
850
- if (codePoint >= 8203 && codePoint <= 8207 || codePoint === 65279) continue;
851
- if (codePoint >= 768 && codePoint <= 879 || codePoint >= 6832 && codePoint <= 6911 || codePoint >= 7616 && codePoint <= 7679 || codePoint >= 8400 && codePoint <= 8447 || codePoint >= 65056 && codePoint <= 65071) continue;
852
- if (codePoint >= 55296 && codePoint <= 57343) continue;
853
- if (codePoint >= 65024 && codePoint <= 65039) continue;
854
- if (defaultIgnorableCodePointRegex.test(character)) continue;
855
- if (emojiRegex().test(character)) {
856
- width += 2;
857
- continue;
570
+ mri(argv, command) {
571
+ const cliOptions = [...this.globalCommand.options, ...command ? command.options : []];
572
+ const mriOptions = getMriOptions(cliOptions);
573
+ let argsAfterDoubleDashes = [];
574
+ const doubleDashesIndex = argv.indexOf("--");
575
+ if (doubleDashesIndex !== -1) {
576
+ argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);
577
+ argv = argv.slice(0, doubleDashesIndex);
578
+ }
579
+ let parsed = lib_default(argv, mriOptions);
580
+ parsed = Object.keys(parsed).reduce((res, name) => {
581
+ return {
582
+ ...res,
583
+ [camelcaseOptionName(name)]: parsed[name]
584
+ };
585
+ }, { _: [] });
586
+ const args = parsed._;
587
+ const options = { "--": argsAfterDoubleDashes };
588
+ const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;
589
+ const transforms = Object.create(null);
590
+ for (const cliOption of cliOptions) {
591
+ if (!ignoreDefault && cliOption.config.default !== void 0) for (const name of cliOption.names) options[name] = cliOption.config.default;
592
+ if (Array.isArray(cliOption.config.type) && transforms[cliOption.name] === void 0) {
593
+ transforms[cliOption.name] = Object.create(null);
594
+ transforms[cliOption.name].shouldTransform = true;
595
+ transforms[cliOption.name].transformFunction = cliOption.config.type[0];
596
+ }
858
597
  }
859
- width += eastAsianWidth(codePoint, eastAsianWidthOptions);
598
+ for (const key of Object.keys(parsed)) if (key !== "_") {
599
+ setDotProp(options, key.split("."), parsed[key]);
600
+ setByType(options, transforms);
601
+ }
602
+ return {
603
+ args,
604
+ options
605
+ };
860
606
  }
861
- return width;
862
- }
863
- function isUnicodeSupported() {
864
- const { env } = process$1;
865
- const { TERM, TERM_PROGRAM } = env;
866
- if (process$1.platform !== "win32") return TERM !== "linux";
867
- return Boolean(env.WT_SESSION) || Boolean(env.TERMINUS_SUBLIME) || env.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
868
- }
869
- const TYPE_COLOR_MAP = {
870
- info: "cyan",
871
- fail: "red",
872
- success: "green",
873
- ready: "green",
874
- start: "magenta"
875
- };
876
- const LEVEL_COLOR_MAP = {
877
- 0: "red",
878
- 1: "yellow"
879
- };
880
- const unicode = isUnicodeSupported();
881
- const s = (c, fallback) => unicode ? c : fallback;
882
- const TYPE_ICONS = {
883
- error: s("✖", "×"),
884
- fatal: s("✖", "×"),
885
- ready: s("✔", "√"),
886
- warn: s("⚠", "‼"),
887
- info: s("ℹ", "i"),
888
- success: s("✔", "√"),
889
- debug: s("⚙", "D"),
890
- trace: s("→", "→"),
891
- fail: s("✖", "×"),
892
- start: s("◐", "o"),
893
- log: ""
894
- };
895
- function stringWidth(str) {
896
- if (!(typeof Intl === "object") || !Intl.Segmenter) return stripAnsi$1(str).length;
897
- return stringWidth$1(str);
898
- }
899
- var FancyReporter = class extends BasicReporter {
900
- formatStack(stack, message, opts) {
901
- const indent = " ".repeat((opts?.errorLevel || 0) + 1);
902
- return `
903
- ${indent}` + parseStack(stack, message).map((line) => " " + line.replace(/^at +/, (m) => colors.gray(m)).replace(/\((.+)\)/, (_, m) => `(${colors.cyan(m)})`)).join(`
904
- ${indent}`);
905
- }
906
- formatType(logObj, isBadge, opts) {
907
- const typeColor = TYPE_COLOR_MAP[logObj.type] || LEVEL_COLOR_MAP[logObj.level] || "gray";
908
- if (isBadge) return getBgColor(typeColor)(colors.black(` ${logObj.type.toUpperCase()} `));
909
- const _type = typeof TYPE_ICONS[logObj.type] === "string" ? TYPE_ICONS[logObj.type] : logObj.icon || logObj.type;
910
- return _type ? getColor(typeColor)(_type) : "";
911
- }
912
- formatLogObj(logObj, opts) {
913
- const [message, ...additional] = this.formatArgs(logObj.args, opts).split("\n");
914
- if (logObj.type === "box") return box(characterFormat(message + (additional.length > 0 ? "\n" + additional.join("\n") : "")), {
915
- title: logObj.title ? characterFormat(logObj.title) : void 0,
916
- style: logObj.style
607
+ runMatchedCommand() {
608
+ const { args, options, matchedCommand: command } = this;
609
+ if (!command || !command.commandAction) return;
610
+ command.checkUnknownOptions();
611
+ command.checkOptionValue();
612
+ command.checkRequiredArgs();
613
+ command.checkUnusedArgs();
614
+ const actionArgs = [];
615
+ command.args.forEach((arg, index) => {
616
+ if (arg.variadic) actionArgs.push(args.slice(index));
617
+ else actionArgs.push(args[index]);
917
618
  });
918
- const date = this.formatDate(logObj.date, opts);
919
- const coloredDate = date && colors.gray(date);
920
- const isBadge = logObj.badge ?? logObj.level < 2;
921
- const type = this.formatType(logObj, isBadge, opts);
922
- const tag = logObj.tag ? colors.gray(logObj.tag) : "";
923
- let line;
924
- const left = this.filterAndJoin([type, characterFormat(message)]);
925
- const right = this.filterAndJoin(opts.columns ? [tag, coloredDate] : [tag]);
926
- const space = (opts.columns || 0) - stringWidth(left) - stringWidth(right) - 2;
927
- line = space > 0 && (opts.columns || 0) >= 80 ? left + " ".repeat(space) + right : (right ? `${colors.gray(`[${right}]`)} ` : "") + left;
928
- line += characterFormat(additional.length > 0 ? "\n" + additional.join("\n") : "");
929
- if (logObj.type === "trace") {
930
- const _err = /* @__PURE__ */ new Error("Trace: " + logObj.message);
931
- line += this.formatStack(_err.stack || "", _err.message);
932
- }
933
- return isBadge ? "\n" + line + "\n" : line;
619
+ actionArgs.push(options);
620
+ return command.commandAction.apply(this, actionArgs);
934
621
  }
935
622
  };
936
- function characterFormat(str) {
937
- return str.replace(/`([^`]+)`/gm, (_, m) => colors.cyan(m)).replace(/\s+_([^_]+)_\s+/gm, (_, m) => ` ${colors.underline(m)} `);
938
- }
939
- function getColor(color = "white") {
940
- return colors[color] || colors.white;
941
- }
942
- function getBgColor(color = "bgWhite") {
943
- return colors[`bg${color[0].toUpperCase()}${color.slice(1)}`] || colors.bgWhite;
944
- }
945
- function createConsola(options = {}) {
946
- let level = _getDefaultLogLevel();
947
- if (process.env.CONSOLA_LEVEL) level = Number.parseInt(process.env.CONSOLA_LEVEL) ?? level;
948
- return createConsola$1({
949
- level,
950
- defaults: { level },
951
- stdout: process.stdout,
952
- stderr: process.stderr,
953
- prompt: (...args) => import("./shared/prompt-B6NrDD1-.mjs").then((m) => m.prompt(...args)),
954
- reporters: options.reporters || [options.fancy ?? !(T || R) ? new FancyReporter() : new BasicReporter()],
955
- ...options
956
- });
957
- }
958
- function _getDefaultLogLevel() {
959
- if (g) return LogLevels.debug;
960
- if (R) return LogLevels.warn;
961
- return LogLevels.info;
962
- }
963
- const consola = createConsola();
964
-
965
- //#endregion
966
- //#region src/cli/logger.ts
967
623
  /**
968
- * Console logger
624
+ * @param name The program name to display in help and version message
969
625
  */
970
- const logger = process.env.ROLLDOWN_TEST ? createTestingLogger() : createConsola({ formatOptions: { date: false } });
971
- function createTestingLogger() {
972
- const types = [
973
- "silent",
974
- "fatal",
975
- "error",
976
- "warn",
977
- "log",
978
- "info",
979
- "success",
980
- "fail",
981
- "ready",
982
- "start",
983
- "box",
984
- "debug",
985
- "trace",
986
- "verbose"
987
- ];
988
- const ret = Object.create(null);
989
- for (const type of types) ret[type] = console.log;
990
- return ret;
991
- }
992
-
626
+ const cac = (name = "") => new CAC(name);
993
627
  //#endregion
994
628
  //#region src/cli/arguments/alias.ts
995
629
  const alias = {
@@ -1000,36 +634,29 @@ const alias = {
1000
634
  help: { abbreviation: "h" },
1001
635
  version: { abbreviation: "v" },
1002
636
  watch: { abbreviation: "w" },
1003
- dir: { abbreviation: "d" },
1004
- file: { abbreviation: "o" },
637
+ dir: {
638
+ abbreviation: "d",
639
+ requireValue: true
640
+ },
641
+ file: {
642
+ abbreviation: "o",
643
+ requireValue: true
644
+ },
1005
645
  external: { abbreviation: "e" },
1006
646
  format: { abbreviation: "f" },
1007
647
  name: { abbreviation: "n" },
1008
648
  globals: { abbreviation: "g" },
1009
- sourcemap: {
1010
- abbreviation: "s",
1011
- default: true
1012
- },
649
+ sourcemap: { abbreviation: "s" },
1013
650
  minify: { abbreviation: "m" },
1014
651
  platform: { abbreviation: "p" },
1015
652
  assetFileNames: { hint: "name" },
1016
653
  chunkFileNames: { hint: "name" },
1017
654
  entryFileNames: { hint: "name" },
1018
- externalLiveBindings: {
1019
- default: true,
1020
- reverse: true
1021
- },
1022
- treeshake: {
1023
- default: true,
1024
- reverse: true
1025
- },
1026
- preserveEntrySignatures: {
1027
- default: "strict",
1028
- reverse: true
1029
- },
655
+ externalLiveBindings: { reverse: true },
656
+ treeshake: { reverse: true },
657
+ preserveEntrySignatures: { reverse: true },
1030
658
  moduleTypes: { hint: "types" }
1031
659
  };
1032
-
1033
660
  //#endregion
1034
661
  //#region src/cli/arguments/utils.ts
1035
662
  function setNestedProperty(obj, path, value) {
@@ -1050,25 +677,17 @@ function setNestedProperty(obj, path, value) {
1050
677
  function camelCaseToKebabCase(str) {
1051
678
  return str.replace(/[A-Z]/g, (match) => `-${match.toLowerCase()}`);
1052
679
  }
1053
- function kebabCaseToCamelCase(str) {
1054
- return str.replace(/-./g, (match) => match[1].toUpperCase());
1055
- }
1056
-
1057
680
  //#endregion
1058
681
  //#region src/cli/arguments/normalize.ts
682
+ const reservedKeys = new Set([
683
+ "help",
684
+ "version",
685
+ "config",
686
+ "watch",
687
+ "environment"
688
+ ]);
1059
689
  function normalizeCliOptions(cliOptions, positionals) {
1060
- const prototypePollutionKeys = [
1061
- "__proto__",
1062
- "constructor",
1063
- "prototype"
1064
- ];
1065
- const unflattenedCliOptions = {};
1066
- for (let [key, value] of Object.entries(cliOptions)) if (prototypePollutionKeys.includes(key)) {} else if (key.includes(".")) {
1067
- const [parentKey] = key.split(".");
1068
- unflattenedCliOptions[parentKey] ??= {};
1069
- setNestedProperty(unflattenedCliOptions, key, value);
1070
- } else unflattenedCliOptions[key] = value;
1071
- const [data, errors] = validateCliOptions(unflattenedCliOptions);
690
+ const [data, errors] = validateCliOptions(cliOptions);
1072
691
  if (errors?.length) {
1073
692
  errors.forEach((error) => {
1074
693
  logger.error(`${error}. You can use \`rolldown -h\` to see the help.`);
@@ -1084,21 +703,15 @@ function normalizeCliOptions(cliOptions, positionals) {
1084
703
  watch: options.watch ?? false
1085
704
  };
1086
705
  if (typeof options.config === "string") result.config = options.config;
706
+ else if (options.config === true) result.config = "";
1087
707
  if (options.environment !== void 0) result.environment = options.environment;
1088
- const keysOfInput = getInputCliKeys();
1089
- const keysOfOutput = getOutputCliKeys();
1090
- const reservedKeys = [
1091
- "help",
1092
- "version",
1093
- "config",
1094
- "watch",
1095
- "environment"
1096
- ];
708
+ const keysOfInput = new Set(getInputCliKeys());
709
+ const keysOfOutput = new Set(getOutputCliKeys());
1097
710
  for (let [key, value] of Object.entries(options)) {
1098
711
  const [primary] = key.split(".");
1099
- if (keysOfInput.includes(primary)) setNestedProperty(result.input, key, value);
1100
- else if (keysOfOutput.includes(primary)) setNestedProperty(result.output, key, value);
1101
- else if (!reservedKeys.includes(key)) {
712
+ if (keysOfInput.has(primary)) setNestedProperty(result.input, key, value);
713
+ else if (keysOfOutput.has(primary)) setNestedProperty(result.output, key, value);
714
+ else if (!reservedKeys.has(key)) {
1102
715
  logger.error(`Unknown option: ${key}`);
1103
716
  process.exit(1);
1104
717
  }
@@ -1107,124 +720,122 @@ function normalizeCliOptions(cliOptions, positionals) {
1107
720
  else result.input.input = positionals;
1108
721
  return result;
1109
722
  }
1110
-
1111
723
  //#endregion
1112
724
  //#region src/cli/arguments/index.ts
1113
725
  const schemaInfo = getCliSchemaInfo();
1114
726
  const options = Object.fromEntries(Object.entries(schemaInfo).filter(([_key, info]) => info.type !== "never").map(([key, info]) => {
1115
- const config = Object.getOwnPropertyDescriptor(alias, key)?.value;
727
+ const config = alias[key];
728
+ let description = info?.description ?? config?.description ?? "";
729
+ if (config?.reverse) {
730
+ if (description.startsWith("enable")) description = description.replace("enable", "disable");
731
+ else if (!description.startsWith("Avoid")) description = `disable ${description}`;
732
+ }
1116
733
  const result = {
1117
734
  type: info.type === "boolean" ? "boolean" : "string",
1118
- description: info?.description ?? config?.description ?? "",
1119
- hint: config?.hint
735
+ description
1120
736
  };
1121
- if (config && config?.abbreviation) result.short = config?.abbreviation;
1122
- if (config && config.reverse) {
1123
- if (result.description.startsWith("enable")) result.description = result.description.replace("enable", "disable");
1124
- else if (!result.description.startsWith("Avoid")) result.description = `disable ${result.description}`;
1125
- }
1126
- key = camelCaseToKebabCase(key);
1127
- return [config?.reverse ? `no-${key}` : key, result];
737
+ if (config?.abbreviation) result.short = config.abbreviation;
738
+ if (config?.hint) result.hint = config.hint;
739
+ const kebabKey = camelCaseToKebabCase(key);
740
+ return [config?.reverse ? `no-${kebabKey}` : kebabKey, result];
1128
741
  }));
742
+ const knownKeys = new Set(Object.keys(schemaInfo));
743
+ for (const key of Object.keys(schemaInfo)) {
744
+ const dotIdx = key.indexOf(".");
745
+ if (dotIdx > 0) knownKeys.add(key.substring(0, dotIdx));
746
+ }
747
+ const shortAliases = /* @__PURE__ */ new Set();
748
+ for (const config of Object.values(alias)) if (config?.abbreviation) shortAliases.add(config.abbreviation);
1129
749
  function parseCliArguments() {
1130
- const { values, tokens, positionals } = parseArgs({
1131
- options,
1132
- tokens: true,
1133
- allowPositionals: true,
1134
- strict: false
750
+ const cli = cac("rolldown");
751
+ for (const [key, info] of Object.entries(schemaInfo)) {
752
+ if (info.type === "never") continue;
753
+ const config = alias[key];
754
+ let rawName = "";
755
+ if (config?.abbreviation) rawName += `-${config.abbreviation}, `;
756
+ if (config?.reverse) rawName += `--no-${key}`;
757
+ else rawName += `--${key}`;
758
+ if (info.type !== "boolean" && !config?.reverse) if (config?.requireValue) rawName += ` <${config?.hint ?? key}>`;
759
+ else rawName += ` [${config?.hint ?? key}]`;
760
+ cli.option(rawName, info.description ?? config?.description ?? "");
761
+ }
762
+ let parsedInput = [];
763
+ let parsedOptions = {};
764
+ const cmd = cli.command("[...input]", "");
765
+ cmd.allowUnknownOptions();
766
+ cmd.ignoreOptionDefaultValue();
767
+ cmd.action((input, opts) => {
768
+ parsedInput = input;
769
+ parsedOptions = opts;
1135
770
  });
1136
- let invalid_options = tokens.filter((token) => token.kind === "option").map((option) => {
1137
- let negative = false;
1138
- if (option.name.startsWith("no-")) {
1139
- const name = kebabCaseToCamelCase(option.name.substring(3));
1140
- if (name in schemaInfo) {
1141
- delete values[option.name];
1142
- option.name = name;
1143
- negative = true;
1144
- }
771
+ try {
772
+ cli.parse(process.argv, { run: true });
773
+ } catch (err) {
774
+ if (err?.name === "CACError") {
775
+ const match = err.message.match(/option `(.+?)` value is missing/);
776
+ if (match) {
777
+ const optName = match[1].replace(/ [<[].*/, "").replace(/^-\w, /, "");
778
+ logger.error(`Option \`${optName}\` requires a value but none was provided.`);
779
+ } else logger.error(err.message);
780
+ process.exit(1);
1145
781
  }
1146
- delete values[option.name];
1147
- option.name = kebabCaseToCamelCase(option.name);
1148
- let originalInfo = schemaInfo[option.name];
1149
- if (!originalInfo) return {
1150
- name: option.name,
1151
- value: option.value
1152
- };
1153
- let type = originalInfo.type;
1154
- if (type === "string" && typeof option.value !== "string") {
1155
- let opt = option;
1156
- let defaultValue = Object.getOwnPropertyDescriptor(alias, opt.name)?.value;
1157
- Object.defineProperty(values, opt.name, {
1158
- value: defaultValue.default ?? "",
1159
- enumerable: true,
1160
- configurable: true,
1161
- writable: true
1162
- });
1163
- } else if (type === "object" && typeof option.value === "string") {
1164
- const pairs = option.value.split(",").map((x) => x.split("="));
1165
- if (!values[option.name]) Object.defineProperty(values, option.name, {
1166
- value: {},
1167
- enumerable: true,
1168
- configurable: true,
1169
- writable: true
1170
- });
1171
- for (const [key, value] of pairs) if (key && value) Object.defineProperty(values[option.name], key, {
1172
- value,
1173
- enumerable: true,
1174
- configurable: true,
1175
- writable: true
1176
- });
1177
- } else if (type === "array" && typeof option.value === "string") {
1178
- if (!values[option.name]) Object.defineProperty(values, option.name, {
1179
- value: [],
1180
- enumerable: true,
1181
- configurable: true,
1182
- writable: true
1183
- });
1184
- values[option.name].push(option.value);
1185
- } else if (type === "boolean") Object.defineProperty(values, option.name, {
1186
- value: !negative,
1187
- enumerable: true,
1188
- configurable: true,
1189
- writable: true
1190
- });
1191
- else if (type === "union") {
1192
- let defaultValue = Object.getOwnPropertyDescriptor(alias, option.name)?.value;
1193
- Object.defineProperty(values, option.name, {
1194
- value: option.value ?? defaultValue?.default ?? "",
1195
- enumerable: true,
1196
- configurable: true,
1197
- writable: true
1198
- });
1199
- } else Object.defineProperty(values, option.name, {
1200
- value: option.value ?? "",
1201
- enumerable: true,
1202
- configurable: true,
1203
- writable: true
1204
- });
1205
- }).filter((item) => {
1206
- return item !== void 0;
1207
- });
1208
- invalid_options.sort((a, b) => {
1209
- return a.name.localeCompare(b.name);
1210
- });
1211
- if (invalid_options.length !== 0) {
1212
- let single = invalid_options.length === 1;
1213
- logger.warn(`Option \`${invalid_options.map((item) => item.name).join(",")}\` ${single ? "is" : "are"} unrecognized. We will ignore ${single ? "this" : "those"} option${single ? "" : "s"}.`);
1214
- }
1215
- let rawArgs = {
1216
- ...values,
1217
- ...invalid_options.reduce((acc, cur) => {
1218
- acc[cur.name] = cur.value;
1219
- return acc;
1220
- }, Object.create(null))
1221
- };
782
+ throw err;
783
+ }
784
+ delete parsedOptions["--"];
785
+ for (const short of shortAliases) delete parsedOptions[short];
786
+ for (const key of Object.keys(parsedOptions)) if (key === "__proto__" || key === "constructor" || key === "prototype" || key.startsWith("__proto__.") || key.startsWith("constructor.") || key.startsWith("prototype.")) delete parsedOptions[key];
787
+ const unknownKeys = Object.keys(parsedOptions).filter((k) => !knownKeys.has(k));
788
+ if (unknownKeys.length > 0) {
789
+ unknownKeys.sort();
790
+ const single = unknownKeys.length === 1;
791
+ logger.warn(`Option \`${unknownKeys.join(",")}\` ${single ? "is" : "are"} unrecognized. We will ignore ${single ? "this" : "those"} option${single ? "" : "s"}.`);
792
+ }
793
+ const rawArgs = { ...parsedOptions };
794
+ for (const key of unknownKeys) delete parsedOptions[key];
795
+ for (const [key, value] of Object.entries(parsedOptions)) {
796
+ const type = schemaInfo[key]?.type;
797
+ if (Array.isArray(value)) {
798
+ if (type !== "array" && type !== "object") parsedOptions[key] = value[value.length - 1];
799
+ } else if (type === "array" && typeof value === "string") parsedOptions[key] = [value];
800
+ }
801
+ for (const [schemaKey, info] of Object.entries(schemaInfo)) {
802
+ if (info.type !== "object") continue;
803
+ const parts = schemaKey.split(".");
804
+ let parent = parsedOptions;
805
+ for (let i = 0; i < parts.length - 1; i++) parent = parent?.[parts[i]];
806
+ const leafKey = parts[parts.length - 1];
807
+ const value = parent?.[leafKey];
808
+ if (value === void 0) continue;
809
+ const values = Array.isArray(value) ? value : [value];
810
+ if (typeof values[0] !== "string") continue;
811
+ let usedDeprecatedSyntax = false;
812
+ const result = {};
813
+ for (const v of values) for (const pair of String(v).split(",")) {
814
+ const colonIdx = pair.indexOf(":");
815
+ const eqIdx = pair.indexOf("=");
816
+ let k;
817
+ let val;
818
+ if (colonIdx > 0 && (eqIdx === -1 || colonIdx < eqIdx)) {
819
+ k = pair.slice(0, colonIdx);
820
+ val = pair.slice(colonIdx + 1);
821
+ } else if (eqIdx > 0) {
822
+ k = pair.slice(0, eqIdx);
823
+ val = pair.slice(eqIdx + 1);
824
+ usedDeprecatedSyntax = true;
825
+ } else continue;
826
+ result[k] = val;
827
+ }
828
+ if (usedDeprecatedSyntax) {
829
+ const optionName = camelCaseToKebabCase(schemaKey);
830
+ logger.warn(`Using \`key=value\` syntax for \`--${optionName}\` is deprecated. Use \`key:value\` instead.`);
831
+ }
832
+ parent[leafKey] = result;
833
+ }
1222
834
  return {
1223
- ...normalizeCliOptions(values, positionals),
835
+ ...normalizeCliOptions(parsedOptions, parsedInput),
1224
836
  rawArgs
1225
837
  };
1226
838
  }
1227
-
1228
839
  //#endregion
1229
840
  //#region src/utils/clear-screen.ts
1230
841
  const CLEAR_SCREEN = "\x1Bc";
@@ -1235,9 +846,8 @@ function getClearScreenFunction(options) {
1235
846
  process.stdout.write(CLEAR_SCREEN);
1236
847
  };
1237
848
  }
1238
-
1239
849
  //#endregion
1240
- //#region \0@oxc-project+runtime@0.110.0/helpers/usingCtx.js
850
+ //#region \0@oxc-project+runtime@0.121.0/helpers/usingCtx.js
1241
851
  function _usingCtx() {
1242
852
  var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {
1243
853
  var n = Error();
@@ -1292,7 +902,6 @@ function _usingCtx() {
1292
902
  }
1293
903
  };
1294
904
  }
1295
-
1296
905
  //#endregion
1297
906
  //#region src/cli/commands/bundle.ts
1298
907
  async function bundleWithConfig(configPath, cliOptions, rawArgs = {}) {
@@ -1326,7 +935,7 @@ async function bundleWithCliOptions(cliOptions) {
1326
935
  process.exit(1);
1327
936
  }
1328
937
  for (const file of outputs) {
1329
- if (outputs.length > 1) logger.log(`\n${styleText$1(["cyan", "bold"], `|→ ${file.fileName}:`)}\n`);
938
+ if (outputs.length > 1) logger.log(`\n${styleText(["cyan", "bold"], `|→ ${file.fileName}:`)}\n`);
1330
939
  console.log(file.type === "asset" ? file.source : file.code);
1331
940
  }
1332
941
  } catch (_) {
@@ -1366,12 +975,12 @@ async function watchInner(config, cliOptions) {
1366
975
  clearScreen?.();
1367
976
  break;
1368
977
  case "BUNDLE_START":
1369
- if (changedFile.length > 0) logger.log(`Found ${styleText$1("bold", changedFile.map(relativeId).join(", "))} changed, rebuilding...`);
978
+ if (changedFile.length > 0) logger.log(`Found ${styleText("bold", changedFile.map(relativeId).join(", "))} changed, rebuilding...`);
1370
979
  changedFile.length = 0;
1371
980
  break;
1372
981
  case "BUNDLE_END":
1373
982
  await event.result.close();
1374
- logger.success(`Rebuilt ${styleText$1("bold", relativeId(event.output[0]))} in ${styleText$1("green", ms(event.duration))}.`);
983
+ logger.success(`Rebuilt ${styleText("bold", relativeId(event.output[0]))} in ${styleText("green", ms(event.duration))}.`);
1375
984
  break;
1376
985
  case "ERROR":
1377
986
  await event.result.close();
@@ -1404,7 +1013,7 @@ async function bundleInner(config, cliOptions) {
1404
1013
  result.forEach(printBundleOutputPretty);
1405
1014
  logger.log(``);
1406
1015
  const duration = performance.now() - startTime;
1407
- logger.success(`rolldown v${version} Finished in ${styleText$1("green", ms(duration))}`);
1016
+ logger.success(`rolldown v${version} Finished in ${styleText("green", ms(duration))}`);
1408
1017
  }
1409
1018
  function printBundleOutputPretty(output) {
1410
1019
  const outputEntries = collectOutputEntries(output.output);
@@ -1450,10 +1059,10 @@ function printOutputEntries(entries, sizeAdjustment, distPath) {
1450
1059
  const filtered = entries.filter((e) => e.type === group.type);
1451
1060
  if (!filtered.length) continue;
1452
1061
  for (const entry of filtered.sort((a, z) => a.size - z.size)) {
1453
- let log = styleText$1("dim", withTrailingSlash(distPath));
1454
- log += styleText$1(group.color, entry.fileName.padEnd(sizeAdjustment.longest + 2));
1455
- log += styleText$1("dim", entry.type);
1456
- log += styleText$1("dim", ` │ size: ${displaySize(entry.size).padStart(sizeAdjustment.sizePad)}`);
1062
+ let log = styleText("dim", withTrailingSlash(distPath));
1063
+ log += styleText(group.color, entry.fileName.padEnd(sizeAdjustment.longest + 2));
1064
+ log += styleText("dim", entry.type);
1065
+ log += styleText("dim", ` │ size: ${displaySize(entry.size).padStart(sizeAdjustment.sizePad)}`);
1457
1066
  logger.log(log);
1458
1067
  }
1459
1068
  }
@@ -1469,7 +1078,6 @@ function relativeId(id) {
1469
1078
  if (!path.isAbsolute(id)) return id;
1470
1079
  return path.relative(path.resolve(), id);
1471
1080
  }
1472
-
1473
1081
  //#endregion
1474
1082
  //#region src/cli/commands/help.ts
1475
1083
  const examples = [
@@ -1494,22 +1102,17 @@ const examples = [
1494
1102
  command: "rolldown src/main.ts -d dist -n bundle -f iife -e jQuery,window._ -g jQuery=$"
1495
1103
  }
1496
1104
  ];
1497
- const notes = [
1498
- "Due to the API limitation, you need to pass `-s` for `.map` sourcemap file as the last argument.",
1499
- "If you are using the configuration, please pass the `-c` as the last argument if you ignore the default configuration file.",
1500
- "CLI options will override the configuration file.",
1501
- "For more information, please visit https://rolldown.rs/."
1502
- ];
1105
+ const notes = ["CLI options will override the configuration file.", "For more information, please visit https://rolldown.rs/."];
1503
1106
  /**
1504
1107
  * Generates the CLI help text as a string.
1505
1108
  */
1506
1109
  function generateHelpText() {
1507
1110
  const lines = [];
1508
- lines.push(`${styleText$1("gray", `${description} (rolldown v${version})`)}`);
1111
+ lines.push(`${styleText("gray", `${description} (rolldown v${version})`)}`);
1509
1112
  lines.push("");
1510
- lines.push(`${styleText$1(["bold", "underline"], "USAGE")} ${styleText$1("cyan", "rolldown -c <config>")} or ${styleText$1("cyan", "rolldown <input> <options>")}`);
1113
+ lines.push(`${styleText(["bold", "underline"], "USAGE")} ${styleText("cyan", "rolldown -c <config>")} or ${styleText("cyan", "rolldown <input> <options>")}`);
1511
1114
  lines.push("");
1512
- lines.push(`${styleText$1(["bold", "underline"], "OPTIONS")}`);
1115
+ lines.push(`${styleText(["bold", "underline"], "OPTIONS")}`);
1513
1116
  lines.push("");
1514
1117
  lines.push(Object.entries(options).sort(([a], [b]) => {
1515
1118
  if (options[a].short && !options[b].short) return -1;
@@ -1522,27 +1125,26 @@ function generateHelpText() {
1522
1125
  if (short) optionStr += `-${short}, `;
1523
1126
  if (type === "string") optionStr += `<${hint ?? option}>`;
1524
1127
  if (description && description.length > 0) description = description[0].toUpperCase() + description.slice(1);
1525
- return styleText$1("cyan", optionStr.padEnd(30)) + description + (description && description?.endsWith(".") ? "" : ".");
1128
+ return styleText("cyan", optionStr.padEnd(30)) + description + (description && description?.endsWith(".") ? "" : ".");
1526
1129
  }).join("\n"));
1527
1130
  lines.push("");
1528
- lines.push(`${styleText$1(["bold", "underline"], "EXAMPLES")}`);
1131
+ lines.push(`${styleText(["bold", "underline"], "EXAMPLES")}`);
1529
1132
  lines.push("");
1530
1133
  examples.forEach(({ title, command }, ord) => {
1531
1134
  lines.push(` ${ord + 1}. ${title}:`);
1532
- lines.push(` ${styleText$1("cyan", command)}`);
1135
+ lines.push(` ${styleText("cyan", command)}`);
1533
1136
  lines.push("");
1534
1137
  });
1535
- lines.push(`${styleText$1(["bold", "underline"], "NOTES")}`);
1138
+ lines.push(`${styleText(["bold", "underline"], "NOTES")}`);
1536
1139
  lines.push("");
1537
1140
  notes.forEach((note) => {
1538
- lines.push(` * ${styleText$1("gray", note)}`);
1141
+ lines.push(` * ${styleText("gray", note)}`);
1539
1142
  });
1540
1143
  return lines.join("\n");
1541
1144
  }
1542
1145
  function showHelp() {
1543
1146
  logger.log(generateHelpText());
1544
1147
  }
1545
-
1546
1148
  //#endregion
1547
1149
  //#region src/cli/version-check.ts
1548
1150
  function checkNodeVersion(nodeVersion) {
@@ -1551,7 +1153,6 @@ function checkNodeVersion(nodeVersion) {
1551
1153
  const minor = parseInt(currentVersion[1], 10);
1552
1154
  return major === 20 && minor >= 19 || major === 22 && minor >= 12 || major > 22;
1553
1155
  }
1554
-
1555
1156
  //#endregion
1556
1157
  //#region src/cli/index.ts
1557
1158
  if (!checkNodeVersion(process$1.versions.node)) logger.warn(`You are using Node.js ${process$1.versions.node}. Rolldown requires Node.js version 20.19+ or 22.12+. Please upgrade your Node.js version.`);
@@ -1564,6 +1165,14 @@ async function main() {
1564
1165
  process$1.env[key] = value.length === 0 ? String(true) : value.join(":");
1565
1166
  }
1566
1167
  }
1168
+ if (cliOptions.help) {
1169
+ showHelp();
1170
+ return;
1171
+ }
1172
+ if (cliOptions.version) {
1173
+ logger.log(`rolldown v${version}`);
1174
+ return;
1175
+ }
1567
1176
  if (cliOptions.config || cliOptions.config === "") {
1568
1177
  await bundleWithConfig(cliOptions.config, cliOptions, rawArgs);
1569
1178
  return;
@@ -1572,16 +1181,11 @@ async function main() {
1572
1181
  await bundleWithCliOptions(cliOptions);
1573
1182
  return;
1574
1183
  }
1575
- if (cliOptions.version) {
1576
- logger.log(`rolldown v${version}`);
1577
- return;
1578
- }
1579
1184
  showHelp();
1580
1185
  }
1581
1186
  main().catch((err) => {
1582
1187
  logger.error(err);
1583
1188
  process$1.exit(1);
1584
1189
  });
1585
-
1586
1190
  //#endregion
1587
- export { };
1191
+ export {};