@rolldown/browser 1.0.0-beta.7-commit.a0a7d95

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