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