@latticexyz/cli 1.28.0 → 1.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/bulkupload.js +81 -41
- package/dist/commands/call-system.js +24039 -54
- package/dist/commands/create.js +113 -44
- package/dist/commands/deploy.js +95177 -425
- package/dist/commands/diamond-abi.js +2406 -50
- package/dist/commands/faucet.js +6104 -0
- package/dist/commands/hello.js +44 -16
- package/dist/commands/sync-art.js +109 -40
- package/dist/commands/system-types.js +2431 -66
- package/dist/commands/trace.js +36585 -60
- package/dist/commands/types.js +234159 -0
- package/dist/index.js +4667 -12
- package/package.json +13 -9
- package/src/commands/deploy.ts +10 -9
- package/src/commands/faucet.ts +55 -0
- package/src/commands/system-types.ts +1 -6
- package/src/commands/types.ts +46 -0
- package/src/index.ts +6 -2
- package/dist/utils.js +0 -78
package/dist/index.js
CHANGED
|
@@ -1,15 +1,4670 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
-
var
|
|
4
|
-
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
5
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
5
6
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
|
|
8
|
+
// ../../node_modules/y18n/build/index.cjs
|
|
9
|
+
var require_build = __commonJS({
|
|
10
|
+
"../../node_modules/y18n/build/index.cjs"(exports, module2) {
|
|
11
|
+
"use strict";
|
|
12
|
+
var fs = require("fs");
|
|
13
|
+
var util = require("util");
|
|
14
|
+
var path = require("path");
|
|
15
|
+
var shim;
|
|
16
|
+
var Y18N = class {
|
|
17
|
+
constructor(opts) {
|
|
18
|
+
opts = opts || {};
|
|
19
|
+
this.directory = opts.directory || "./locales";
|
|
20
|
+
this.updateFiles = typeof opts.updateFiles === "boolean" ? opts.updateFiles : true;
|
|
21
|
+
this.locale = opts.locale || "en";
|
|
22
|
+
this.fallbackToLanguage = typeof opts.fallbackToLanguage === "boolean" ? opts.fallbackToLanguage : true;
|
|
23
|
+
this.cache = /* @__PURE__ */ Object.create(null);
|
|
24
|
+
this.writeQueue = [];
|
|
25
|
+
}
|
|
26
|
+
__(...args) {
|
|
27
|
+
if (typeof arguments[0] !== "string") {
|
|
28
|
+
return this._taggedLiteral(arguments[0], ...arguments);
|
|
29
|
+
}
|
|
30
|
+
const str = args.shift();
|
|
31
|
+
let cb = function() {
|
|
32
|
+
};
|
|
33
|
+
if (typeof args[args.length - 1] === "function")
|
|
34
|
+
cb = args.pop();
|
|
35
|
+
cb = cb || function() {
|
|
36
|
+
};
|
|
37
|
+
if (!this.cache[this.locale])
|
|
38
|
+
this._readLocaleFile();
|
|
39
|
+
if (!this.cache[this.locale][str] && this.updateFiles) {
|
|
40
|
+
this.cache[this.locale][str] = str;
|
|
41
|
+
this._enqueueWrite({
|
|
42
|
+
directory: this.directory,
|
|
43
|
+
locale: this.locale,
|
|
44
|
+
cb
|
|
45
|
+
});
|
|
46
|
+
} else {
|
|
47
|
+
cb();
|
|
48
|
+
}
|
|
49
|
+
return shim.format.apply(shim.format, [this.cache[this.locale][str] || str].concat(args));
|
|
50
|
+
}
|
|
51
|
+
__n() {
|
|
52
|
+
const args = Array.prototype.slice.call(arguments);
|
|
53
|
+
const singular = args.shift();
|
|
54
|
+
const plural = args.shift();
|
|
55
|
+
const quantity = args.shift();
|
|
56
|
+
let cb = function() {
|
|
57
|
+
};
|
|
58
|
+
if (typeof args[args.length - 1] === "function")
|
|
59
|
+
cb = args.pop();
|
|
60
|
+
if (!this.cache[this.locale])
|
|
61
|
+
this._readLocaleFile();
|
|
62
|
+
let str = quantity === 1 ? singular : plural;
|
|
63
|
+
if (this.cache[this.locale][singular]) {
|
|
64
|
+
const entry = this.cache[this.locale][singular];
|
|
65
|
+
str = entry[quantity === 1 ? "one" : "other"];
|
|
66
|
+
}
|
|
67
|
+
if (!this.cache[this.locale][singular] && this.updateFiles) {
|
|
68
|
+
this.cache[this.locale][singular] = {
|
|
69
|
+
one: singular,
|
|
70
|
+
other: plural
|
|
71
|
+
};
|
|
72
|
+
this._enqueueWrite({
|
|
73
|
+
directory: this.directory,
|
|
74
|
+
locale: this.locale,
|
|
75
|
+
cb
|
|
76
|
+
});
|
|
77
|
+
} else {
|
|
78
|
+
cb();
|
|
79
|
+
}
|
|
80
|
+
const values = [str];
|
|
81
|
+
if (~str.indexOf("%d"))
|
|
82
|
+
values.push(quantity);
|
|
83
|
+
return shim.format.apply(shim.format, values.concat(args));
|
|
84
|
+
}
|
|
85
|
+
setLocale(locale) {
|
|
86
|
+
this.locale = locale;
|
|
87
|
+
}
|
|
88
|
+
getLocale() {
|
|
89
|
+
return this.locale;
|
|
90
|
+
}
|
|
91
|
+
updateLocale(obj) {
|
|
92
|
+
if (!this.cache[this.locale])
|
|
93
|
+
this._readLocaleFile();
|
|
94
|
+
for (const key in obj) {
|
|
95
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
96
|
+
this.cache[this.locale][key] = obj[key];
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
_taggedLiteral(parts, ...args) {
|
|
101
|
+
let str = "";
|
|
102
|
+
parts.forEach(function(part, i) {
|
|
103
|
+
const arg = args[i + 1];
|
|
104
|
+
str += part;
|
|
105
|
+
if (typeof arg !== "undefined") {
|
|
106
|
+
str += "%s";
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
return this.__.apply(this, [str].concat([].slice.call(args, 1)));
|
|
110
|
+
}
|
|
111
|
+
_enqueueWrite(work) {
|
|
112
|
+
this.writeQueue.push(work);
|
|
113
|
+
if (this.writeQueue.length === 1)
|
|
114
|
+
this._processWriteQueue();
|
|
115
|
+
}
|
|
116
|
+
_processWriteQueue() {
|
|
117
|
+
const _this = this;
|
|
118
|
+
const work = this.writeQueue[0];
|
|
119
|
+
const directory = work.directory;
|
|
120
|
+
const locale = work.locale;
|
|
121
|
+
const cb = work.cb;
|
|
122
|
+
const languageFile = this._resolveLocaleFile(directory, locale);
|
|
123
|
+
const serializedLocale = JSON.stringify(this.cache[locale], null, 2);
|
|
124
|
+
shim.fs.writeFile(languageFile, serializedLocale, "utf-8", function(err) {
|
|
125
|
+
_this.writeQueue.shift();
|
|
126
|
+
if (_this.writeQueue.length > 0)
|
|
127
|
+
_this._processWriteQueue();
|
|
128
|
+
cb(err);
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
_readLocaleFile() {
|
|
132
|
+
let localeLookup = {};
|
|
133
|
+
const languageFile = this._resolveLocaleFile(this.directory, this.locale);
|
|
134
|
+
try {
|
|
135
|
+
if (shim.fs.readFileSync) {
|
|
136
|
+
localeLookup = JSON.parse(shim.fs.readFileSync(languageFile, "utf-8"));
|
|
137
|
+
}
|
|
138
|
+
} catch (err) {
|
|
139
|
+
if (err instanceof SyntaxError) {
|
|
140
|
+
err.message = "syntax error in " + languageFile;
|
|
141
|
+
}
|
|
142
|
+
if (err.code === "ENOENT")
|
|
143
|
+
localeLookup = {};
|
|
144
|
+
else
|
|
145
|
+
throw err;
|
|
146
|
+
}
|
|
147
|
+
this.cache[this.locale] = localeLookup;
|
|
148
|
+
}
|
|
149
|
+
_resolveLocaleFile(directory, locale) {
|
|
150
|
+
let file = shim.resolve(directory, "./", locale + ".json");
|
|
151
|
+
if (this.fallbackToLanguage && !this._fileExistsSync(file) && ~locale.lastIndexOf("_")) {
|
|
152
|
+
const languageFile = shim.resolve(directory, "./", locale.split("_")[0] + ".json");
|
|
153
|
+
if (this._fileExistsSync(languageFile))
|
|
154
|
+
file = languageFile;
|
|
155
|
+
}
|
|
156
|
+
return file;
|
|
157
|
+
}
|
|
158
|
+
_fileExistsSync(file) {
|
|
159
|
+
return shim.exists(file);
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
function y18n$1(opts, _shim) {
|
|
163
|
+
shim = _shim;
|
|
164
|
+
const y18n2 = new Y18N(opts);
|
|
165
|
+
return {
|
|
166
|
+
__: y18n2.__.bind(y18n2),
|
|
167
|
+
__n: y18n2.__n.bind(y18n2),
|
|
168
|
+
setLocale: y18n2.setLocale.bind(y18n2),
|
|
169
|
+
getLocale: y18n2.getLocale.bind(y18n2),
|
|
170
|
+
updateLocale: y18n2.updateLocale.bind(y18n2),
|
|
171
|
+
locale: y18n2.locale
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
var nodePlatformShim = {
|
|
175
|
+
fs: {
|
|
176
|
+
readFileSync: fs.readFileSync,
|
|
177
|
+
writeFile: fs.writeFile
|
|
178
|
+
},
|
|
179
|
+
format: util.format,
|
|
180
|
+
resolve: path.resolve,
|
|
181
|
+
exists: (file) => {
|
|
182
|
+
try {
|
|
183
|
+
return fs.statSync(file).isFile();
|
|
184
|
+
} catch (err) {
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
};
|
|
189
|
+
var y18n = (opts) => {
|
|
190
|
+
return y18n$1(opts, nodePlatformShim);
|
|
191
|
+
};
|
|
192
|
+
module2.exports = y18n;
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
// node_modules/yargs-parser/build/index.cjs
|
|
197
|
+
var require_build2 = __commonJS({
|
|
198
|
+
"node_modules/yargs-parser/build/index.cjs"(exports, module2) {
|
|
199
|
+
"use strict";
|
|
200
|
+
var util = require("util");
|
|
201
|
+
var path = require("path");
|
|
202
|
+
var fs = require("fs");
|
|
203
|
+
function camelCase(str) {
|
|
204
|
+
const isCamelCase = str !== str.toLowerCase() && str !== str.toUpperCase();
|
|
205
|
+
if (!isCamelCase) {
|
|
206
|
+
str = str.toLowerCase();
|
|
207
|
+
}
|
|
208
|
+
if (str.indexOf("-") === -1 && str.indexOf("_") === -1) {
|
|
209
|
+
return str;
|
|
210
|
+
} else {
|
|
211
|
+
let camelcase = "";
|
|
212
|
+
let nextChrUpper = false;
|
|
213
|
+
const leadingHyphens = str.match(/^-+/);
|
|
214
|
+
for (let i = leadingHyphens ? leadingHyphens[0].length : 0; i < str.length; i++) {
|
|
215
|
+
let chr = str.charAt(i);
|
|
216
|
+
if (nextChrUpper) {
|
|
217
|
+
nextChrUpper = false;
|
|
218
|
+
chr = chr.toUpperCase();
|
|
219
|
+
}
|
|
220
|
+
if (i !== 0 && (chr === "-" || chr === "_")) {
|
|
221
|
+
nextChrUpper = true;
|
|
222
|
+
} else if (chr !== "-" && chr !== "_") {
|
|
223
|
+
camelcase += chr;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return camelcase;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
function decamelize(str, joinString) {
|
|
230
|
+
const lowercase = str.toLowerCase();
|
|
231
|
+
joinString = joinString || "-";
|
|
232
|
+
let notCamelcase = "";
|
|
233
|
+
for (let i = 0; i < str.length; i++) {
|
|
234
|
+
const chrLower = lowercase.charAt(i);
|
|
235
|
+
const chrString = str.charAt(i);
|
|
236
|
+
if (chrLower !== chrString && i > 0) {
|
|
237
|
+
notCamelcase += `${joinString}${lowercase.charAt(i)}`;
|
|
238
|
+
} else {
|
|
239
|
+
notCamelcase += chrString;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return notCamelcase;
|
|
243
|
+
}
|
|
244
|
+
function looksLikeNumber(x) {
|
|
245
|
+
if (x === null || x === void 0)
|
|
246
|
+
return false;
|
|
247
|
+
if (typeof x === "number")
|
|
248
|
+
return true;
|
|
249
|
+
if (/^0x[0-9a-f]+$/i.test(x))
|
|
250
|
+
return true;
|
|
251
|
+
if (/^0[^.]/.test(x))
|
|
252
|
+
return false;
|
|
253
|
+
return /^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
|
|
254
|
+
}
|
|
255
|
+
function tokenizeArgString(argString) {
|
|
256
|
+
if (Array.isArray(argString)) {
|
|
257
|
+
return argString.map((e) => typeof e !== "string" ? e + "" : e);
|
|
258
|
+
}
|
|
259
|
+
argString = argString.trim();
|
|
260
|
+
let i = 0;
|
|
261
|
+
let prevC = null;
|
|
262
|
+
let c = null;
|
|
263
|
+
let opening = null;
|
|
264
|
+
const args = [];
|
|
265
|
+
for (let ii = 0; ii < argString.length; ii++) {
|
|
266
|
+
prevC = c;
|
|
267
|
+
c = argString.charAt(ii);
|
|
268
|
+
if (c === " " && !opening) {
|
|
269
|
+
if (!(prevC === " ")) {
|
|
270
|
+
i++;
|
|
271
|
+
}
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
if (c === opening) {
|
|
275
|
+
opening = null;
|
|
276
|
+
} else if ((c === "'" || c === '"') && !opening) {
|
|
277
|
+
opening = c;
|
|
278
|
+
}
|
|
279
|
+
if (!args[i])
|
|
280
|
+
args[i] = "";
|
|
281
|
+
args[i] += c;
|
|
282
|
+
}
|
|
283
|
+
return args;
|
|
284
|
+
}
|
|
285
|
+
var DefaultValuesForTypeKey;
|
|
286
|
+
(function(DefaultValuesForTypeKey2) {
|
|
287
|
+
DefaultValuesForTypeKey2["BOOLEAN"] = "boolean";
|
|
288
|
+
DefaultValuesForTypeKey2["STRING"] = "string";
|
|
289
|
+
DefaultValuesForTypeKey2["NUMBER"] = "number";
|
|
290
|
+
DefaultValuesForTypeKey2["ARRAY"] = "array";
|
|
291
|
+
})(DefaultValuesForTypeKey || (DefaultValuesForTypeKey = {}));
|
|
292
|
+
var mixin;
|
|
293
|
+
var YargsParser = class {
|
|
294
|
+
constructor(_mixin) {
|
|
295
|
+
mixin = _mixin;
|
|
296
|
+
}
|
|
297
|
+
parse(argsInput, options) {
|
|
298
|
+
const opts = Object.assign({
|
|
299
|
+
alias: void 0,
|
|
300
|
+
array: void 0,
|
|
301
|
+
boolean: void 0,
|
|
302
|
+
config: void 0,
|
|
303
|
+
configObjects: void 0,
|
|
304
|
+
configuration: void 0,
|
|
305
|
+
coerce: void 0,
|
|
306
|
+
count: void 0,
|
|
307
|
+
default: void 0,
|
|
308
|
+
envPrefix: void 0,
|
|
309
|
+
narg: void 0,
|
|
310
|
+
normalize: void 0,
|
|
311
|
+
string: void 0,
|
|
312
|
+
number: void 0,
|
|
313
|
+
__: void 0,
|
|
314
|
+
key: void 0
|
|
315
|
+
}, options);
|
|
316
|
+
const args = tokenizeArgString(argsInput);
|
|
317
|
+
const inputIsString = typeof argsInput === "string";
|
|
318
|
+
const aliases = combineAliases(Object.assign(/* @__PURE__ */ Object.create(null), opts.alias));
|
|
319
|
+
const configuration = Object.assign({
|
|
320
|
+
"boolean-negation": true,
|
|
321
|
+
"camel-case-expansion": true,
|
|
322
|
+
"combine-arrays": false,
|
|
323
|
+
"dot-notation": true,
|
|
324
|
+
"duplicate-arguments-array": true,
|
|
325
|
+
"flatten-duplicate-arrays": true,
|
|
326
|
+
"greedy-arrays": true,
|
|
327
|
+
"halt-at-non-option": false,
|
|
328
|
+
"nargs-eats-options": false,
|
|
329
|
+
"negation-prefix": "no-",
|
|
330
|
+
"parse-numbers": true,
|
|
331
|
+
"parse-positional-numbers": true,
|
|
332
|
+
"populate--": false,
|
|
333
|
+
"set-placeholder-key": false,
|
|
334
|
+
"short-option-groups": true,
|
|
335
|
+
"strip-aliased": false,
|
|
336
|
+
"strip-dashed": false,
|
|
337
|
+
"unknown-options-as-args": false
|
|
338
|
+
}, opts.configuration);
|
|
339
|
+
const defaults = Object.assign(/* @__PURE__ */ Object.create(null), opts.default);
|
|
340
|
+
const configObjects = opts.configObjects || [];
|
|
341
|
+
const envPrefix = opts.envPrefix;
|
|
342
|
+
const notFlagsOption = configuration["populate--"];
|
|
343
|
+
const notFlagsArgv = notFlagsOption ? "--" : "_";
|
|
344
|
+
const newAliases = /* @__PURE__ */ Object.create(null);
|
|
345
|
+
const defaulted = /* @__PURE__ */ Object.create(null);
|
|
346
|
+
const __ = opts.__ || mixin.format;
|
|
347
|
+
const flags = {
|
|
348
|
+
aliases: /* @__PURE__ */ Object.create(null),
|
|
349
|
+
arrays: /* @__PURE__ */ Object.create(null),
|
|
350
|
+
bools: /* @__PURE__ */ Object.create(null),
|
|
351
|
+
strings: /* @__PURE__ */ Object.create(null),
|
|
352
|
+
numbers: /* @__PURE__ */ Object.create(null),
|
|
353
|
+
counts: /* @__PURE__ */ Object.create(null),
|
|
354
|
+
normalize: /* @__PURE__ */ Object.create(null),
|
|
355
|
+
configs: /* @__PURE__ */ Object.create(null),
|
|
356
|
+
nargs: /* @__PURE__ */ Object.create(null),
|
|
357
|
+
coercions: /* @__PURE__ */ Object.create(null),
|
|
358
|
+
keys: []
|
|
359
|
+
};
|
|
360
|
+
const negative = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/;
|
|
361
|
+
const negatedBoolean = new RegExp("^--" + configuration["negation-prefix"] + "(.+)");
|
|
362
|
+
[].concat(opts.array || []).filter(Boolean).forEach(function(opt) {
|
|
363
|
+
const key = typeof opt === "object" ? opt.key : opt;
|
|
364
|
+
const assignment = Object.keys(opt).map(function(key2) {
|
|
365
|
+
const arrayFlagKeys = {
|
|
366
|
+
boolean: "bools",
|
|
367
|
+
string: "strings",
|
|
368
|
+
number: "numbers"
|
|
369
|
+
};
|
|
370
|
+
return arrayFlagKeys[key2];
|
|
371
|
+
}).filter(Boolean).pop();
|
|
372
|
+
if (assignment) {
|
|
373
|
+
flags[assignment][key] = true;
|
|
374
|
+
}
|
|
375
|
+
flags.arrays[key] = true;
|
|
376
|
+
flags.keys.push(key);
|
|
377
|
+
});
|
|
378
|
+
[].concat(opts.boolean || []).filter(Boolean).forEach(function(key) {
|
|
379
|
+
flags.bools[key] = true;
|
|
380
|
+
flags.keys.push(key);
|
|
381
|
+
});
|
|
382
|
+
[].concat(opts.string || []).filter(Boolean).forEach(function(key) {
|
|
383
|
+
flags.strings[key] = true;
|
|
384
|
+
flags.keys.push(key);
|
|
385
|
+
});
|
|
386
|
+
[].concat(opts.number || []).filter(Boolean).forEach(function(key) {
|
|
387
|
+
flags.numbers[key] = true;
|
|
388
|
+
flags.keys.push(key);
|
|
389
|
+
});
|
|
390
|
+
[].concat(opts.count || []).filter(Boolean).forEach(function(key) {
|
|
391
|
+
flags.counts[key] = true;
|
|
392
|
+
flags.keys.push(key);
|
|
393
|
+
});
|
|
394
|
+
[].concat(opts.normalize || []).filter(Boolean).forEach(function(key) {
|
|
395
|
+
flags.normalize[key] = true;
|
|
396
|
+
flags.keys.push(key);
|
|
397
|
+
});
|
|
398
|
+
if (typeof opts.narg === "object") {
|
|
399
|
+
Object.entries(opts.narg).forEach(([key, value]) => {
|
|
400
|
+
if (typeof value === "number") {
|
|
401
|
+
flags.nargs[key] = value;
|
|
402
|
+
flags.keys.push(key);
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
if (typeof opts.coerce === "object") {
|
|
407
|
+
Object.entries(opts.coerce).forEach(([key, value]) => {
|
|
408
|
+
if (typeof value === "function") {
|
|
409
|
+
flags.coercions[key] = value;
|
|
410
|
+
flags.keys.push(key);
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
if (typeof opts.config !== "undefined") {
|
|
415
|
+
if (Array.isArray(opts.config) || typeof opts.config === "string") {
|
|
416
|
+
[].concat(opts.config).filter(Boolean).forEach(function(key) {
|
|
417
|
+
flags.configs[key] = true;
|
|
418
|
+
});
|
|
419
|
+
} else if (typeof opts.config === "object") {
|
|
420
|
+
Object.entries(opts.config).forEach(([key, value]) => {
|
|
421
|
+
if (typeof value === "boolean" || typeof value === "function") {
|
|
422
|
+
flags.configs[key] = value;
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
extendAliases(opts.key, aliases, opts.default, flags.arrays);
|
|
428
|
+
Object.keys(defaults).forEach(function(key) {
|
|
429
|
+
(flags.aliases[key] || []).forEach(function(alias) {
|
|
430
|
+
defaults[alias] = defaults[key];
|
|
431
|
+
});
|
|
432
|
+
});
|
|
433
|
+
let error = null;
|
|
434
|
+
checkConfiguration();
|
|
435
|
+
let notFlags = [];
|
|
436
|
+
const argv = Object.assign(/* @__PURE__ */ Object.create(null), { _: [] });
|
|
437
|
+
const argvReturn = {};
|
|
438
|
+
for (let i = 0; i < args.length; i++) {
|
|
439
|
+
const arg = args[i];
|
|
440
|
+
const truncatedArg = arg.replace(/^-{3,}/, "---");
|
|
441
|
+
let broken;
|
|
442
|
+
let key;
|
|
443
|
+
let letters;
|
|
444
|
+
let m;
|
|
445
|
+
let next;
|
|
446
|
+
let value;
|
|
447
|
+
if (arg !== "--" && /^-/.test(arg) && isUnknownOptionAsArg(arg)) {
|
|
448
|
+
pushPositional(arg);
|
|
449
|
+
} else if (truncatedArg.match(/^---+(=|$)/)) {
|
|
450
|
+
pushPositional(arg);
|
|
451
|
+
continue;
|
|
452
|
+
} else if (arg.match(/^--.+=/) || !configuration["short-option-groups"] && arg.match(/^-.+=/)) {
|
|
453
|
+
m = arg.match(/^--?([^=]+)=([\s\S]*)$/);
|
|
454
|
+
if (m !== null && Array.isArray(m) && m.length >= 3) {
|
|
455
|
+
if (checkAllAliases(m[1], flags.arrays)) {
|
|
456
|
+
i = eatArray(i, m[1], args, m[2]);
|
|
457
|
+
} else if (checkAllAliases(m[1], flags.nargs) !== false) {
|
|
458
|
+
i = eatNargs(i, m[1], args, m[2]);
|
|
459
|
+
} else {
|
|
460
|
+
setArg(m[1], m[2], true);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
} else if (arg.match(negatedBoolean) && configuration["boolean-negation"]) {
|
|
464
|
+
m = arg.match(negatedBoolean);
|
|
465
|
+
if (m !== null && Array.isArray(m) && m.length >= 2) {
|
|
466
|
+
key = m[1];
|
|
467
|
+
setArg(key, checkAllAliases(key, flags.arrays) ? [false] : false);
|
|
468
|
+
}
|
|
469
|
+
} else if (arg.match(/^--.+/) || !configuration["short-option-groups"] && arg.match(/^-[^-]+/)) {
|
|
470
|
+
m = arg.match(/^--?(.+)/);
|
|
471
|
+
if (m !== null && Array.isArray(m) && m.length >= 2) {
|
|
472
|
+
key = m[1];
|
|
473
|
+
if (checkAllAliases(key, flags.arrays)) {
|
|
474
|
+
i = eatArray(i, key, args);
|
|
475
|
+
} else if (checkAllAliases(key, flags.nargs) !== false) {
|
|
476
|
+
i = eatNargs(i, key, args);
|
|
477
|
+
} else {
|
|
478
|
+
next = args[i + 1];
|
|
479
|
+
if (next !== void 0 && (!next.match(/^-/) || next.match(negative)) && !checkAllAliases(key, flags.bools) && !checkAllAliases(key, flags.counts)) {
|
|
480
|
+
setArg(key, next);
|
|
481
|
+
i++;
|
|
482
|
+
} else if (/^(true|false)$/.test(next)) {
|
|
483
|
+
setArg(key, next);
|
|
484
|
+
i++;
|
|
485
|
+
} else {
|
|
486
|
+
setArg(key, defaultValue(key));
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
} else if (arg.match(/^-.\..+=/)) {
|
|
491
|
+
m = arg.match(/^-([^=]+)=([\s\S]*)$/);
|
|
492
|
+
if (m !== null && Array.isArray(m) && m.length >= 3) {
|
|
493
|
+
setArg(m[1], m[2]);
|
|
494
|
+
}
|
|
495
|
+
} else if (arg.match(/^-.\..+/) && !arg.match(negative)) {
|
|
496
|
+
next = args[i + 1];
|
|
497
|
+
m = arg.match(/^-(.\..+)/);
|
|
498
|
+
if (m !== null && Array.isArray(m) && m.length >= 2) {
|
|
499
|
+
key = m[1];
|
|
500
|
+
if (next !== void 0 && !next.match(/^-/) && !checkAllAliases(key, flags.bools) && !checkAllAliases(key, flags.counts)) {
|
|
501
|
+
setArg(key, next);
|
|
502
|
+
i++;
|
|
503
|
+
} else {
|
|
504
|
+
setArg(key, defaultValue(key));
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
} else if (arg.match(/^-[^-]+/) && !arg.match(negative)) {
|
|
508
|
+
letters = arg.slice(1, -1).split("");
|
|
509
|
+
broken = false;
|
|
510
|
+
for (let j = 0; j < letters.length; j++) {
|
|
511
|
+
next = arg.slice(j + 2);
|
|
512
|
+
if (letters[j + 1] && letters[j + 1] === "=") {
|
|
513
|
+
value = arg.slice(j + 3);
|
|
514
|
+
key = letters[j];
|
|
515
|
+
if (checkAllAliases(key, flags.arrays)) {
|
|
516
|
+
i = eatArray(i, key, args, value);
|
|
517
|
+
} else if (checkAllAliases(key, flags.nargs) !== false) {
|
|
518
|
+
i = eatNargs(i, key, args, value);
|
|
519
|
+
} else {
|
|
520
|
+
setArg(key, value);
|
|
521
|
+
}
|
|
522
|
+
broken = true;
|
|
523
|
+
break;
|
|
524
|
+
}
|
|
525
|
+
if (next === "-") {
|
|
526
|
+
setArg(letters[j], next);
|
|
527
|
+
continue;
|
|
528
|
+
}
|
|
529
|
+
if (/[A-Za-z]/.test(letters[j]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(next) && checkAllAliases(next, flags.bools) === false) {
|
|
530
|
+
setArg(letters[j], next);
|
|
531
|
+
broken = true;
|
|
532
|
+
break;
|
|
533
|
+
}
|
|
534
|
+
if (letters[j + 1] && letters[j + 1].match(/\W/)) {
|
|
535
|
+
setArg(letters[j], next);
|
|
536
|
+
broken = true;
|
|
537
|
+
break;
|
|
538
|
+
} else {
|
|
539
|
+
setArg(letters[j], defaultValue(letters[j]));
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
key = arg.slice(-1)[0];
|
|
543
|
+
if (!broken && key !== "-") {
|
|
544
|
+
if (checkAllAliases(key, flags.arrays)) {
|
|
545
|
+
i = eatArray(i, key, args);
|
|
546
|
+
} else if (checkAllAliases(key, flags.nargs) !== false) {
|
|
547
|
+
i = eatNargs(i, key, args);
|
|
548
|
+
} else {
|
|
549
|
+
next = args[i + 1];
|
|
550
|
+
if (next !== void 0 && (!/^(-|--)[^-]/.test(next) || next.match(negative)) && !checkAllAliases(key, flags.bools) && !checkAllAliases(key, flags.counts)) {
|
|
551
|
+
setArg(key, next);
|
|
552
|
+
i++;
|
|
553
|
+
} else if (/^(true|false)$/.test(next)) {
|
|
554
|
+
setArg(key, next);
|
|
555
|
+
i++;
|
|
556
|
+
} else {
|
|
557
|
+
setArg(key, defaultValue(key));
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
} else if (arg.match(/^-[0-9]$/) && arg.match(negative) && checkAllAliases(arg.slice(1), flags.bools)) {
|
|
562
|
+
key = arg.slice(1);
|
|
563
|
+
setArg(key, defaultValue(key));
|
|
564
|
+
} else if (arg === "--") {
|
|
565
|
+
notFlags = args.slice(i + 1);
|
|
566
|
+
break;
|
|
567
|
+
} else if (configuration["halt-at-non-option"]) {
|
|
568
|
+
notFlags = args.slice(i);
|
|
569
|
+
break;
|
|
570
|
+
} else {
|
|
571
|
+
pushPositional(arg);
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
applyEnvVars(argv, true);
|
|
575
|
+
applyEnvVars(argv, false);
|
|
576
|
+
setConfig(argv);
|
|
577
|
+
setConfigObjects();
|
|
578
|
+
applyDefaultsAndAliases(argv, flags.aliases, defaults, true);
|
|
579
|
+
applyCoercions(argv);
|
|
580
|
+
if (configuration["set-placeholder-key"])
|
|
581
|
+
setPlaceholderKeys(argv);
|
|
582
|
+
Object.keys(flags.counts).forEach(function(key) {
|
|
583
|
+
if (!hasKey(argv, key.split(".")))
|
|
584
|
+
setArg(key, 0);
|
|
585
|
+
});
|
|
586
|
+
if (notFlagsOption && notFlags.length)
|
|
587
|
+
argv[notFlagsArgv] = [];
|
|
588
|
+
notFlags.forEach(function(key) {
|
|
589
|
+
argv[notFlagsArgv].push(key);
|
|
590
|
+
});
|
|
591
|
+
if (configuration["camel-case-expansion"] && configuration["strip-dashed"]) {
|
|
592
|
+
Object.keys(argv).filter((key) => key !== "--" && key.includes("-")).forEach((key) => {
|
|
593
|
+
delete argv[key];
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
if (configuration["strip-aliased"]) {
|
|
597
|
+
[].concat(...Object.keys(aliases).map((k) => aliases[k])).forEach((alias) => {
|
|
598
|
+
if (configuration["camel-case-expansion"] && alias.includes("-")) {
|
|
599
|
+
delete argv[alias.split(".").map((prop) => camelCase(prop)).join(".")];
|
|
600
|
+
}
|
|
601
|
+
delete argv[alias];
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
function pushPositional(arg) {
|
|
605
|
+
const maybeCoercedNumber = maybeCoerceNumber("_", arg);
|
|
606
|
+
if (typeof maybeCoercedNumber === "string" || typeof maybeCoercedNumber === "number") {
|
|
607
|
+
argv._.push(maybeCoercedNumber);
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
function eatNargs(i, key, args2, argAfterEqualSign) {
|
|
611
|
+
let ii;
|
|
612
|
+
let toEat = checkAllAliases(key, flags.nargs);
|
|
613
|
+
toEat = typeof toEat !== "number" || isNaN(toEat) ? 1 : toEat;
|
|
614
|
+
if (toEat === 0) {
|
|
615
|
+
if (!isUndefined(argAfterEqualSign)) {
|
|
616
|
+
error = Error(__("Argument unexpected for: %s", key));
|
|
617
|
+
}
|
|
618
|
+
setArg(key, defaultValue(key));
|
|
619
|
+
return i;
|
|
620
|
+
}
|
|
621
|
+
let available = isUndefined(argAfterEqualSign) ? 0 : 1;
|
|
622
|
+
if (configuration["nargs-eats-options"]) {
|
|
623
|
+
if (args2.length - (i + 1) + available < toEat) {
|
|
624
|
+
error = Error(__("Not enough arguments following: %s", key));
|
|
625
|
+
}
|
|
626
|
+
available = toEat;
|
|
627
|
+
} else {
|
|
628
|
+
for (ii = i + 1; ii < args2.length; ii++) {
|
|
629
|
+
if (!args2[ii].match(/^-[^0-9]/) || args2[ii].match(negative) || isUnknownOptionAsArg(args2[ii]))
|
|
630
|
+
available++;
|
|
631
|
+
else
|
|
632
|
+
break;
|
|
633
|
+
}
|
|
634
|
+
if (available < toEat)
|
|
635
|
+
error = Error(__("Not enough arguments following: %s", key));
|
|
636
|
+
}
|
|
637
|
+
let consumed = Math.min(available, toEat);
|
|
638
|
+
if (!isUndefined(argAfterEqualSign) && consumed > 0) {
|
|
639
|
+
setArg(key, argAfterEqualSign);
|
|
640
|
+
consumed--;
|
|
641
|
+
}
|
|
642
|
+
for (ii = i + 1; ii < consumed + i + 1; ii++) {
|
|
643
|
+
setArg(key, args2[ii]);
|
|
644
|
+
}
|
|
645
|
+
return i + consumed;
|
|
646
|
+
}
|
|
647
|
+
function eatArray(i, key, args2, argAfterEqualSign) {
|
|
648
|
+
let argsToSet = [];
|
|
649
|
+
let next = argAfterEqualSign || args2[i + 1];
|
|
650
|
+
const nargsCount = checkAllAliases(key, flags.nargs);
|
|
651
|
+
if (checkAllAliases(key, flags.bools) && !/^(true|false)$/.test(next)) {
|
|
652
|
+
argsToSet.push(true);
|
|
653
|
+
} else if (isUndefined(next) || isUndefined(argAfterEqualSign) && /^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next)) {
|
|
654
|
+
if (defaults[key] !== void 0) {
|
|
655
|
+
const defVal = defaults[key];
|
|
656
|
+
argsToSet = Array.isArray(defVal) ? defVal : [defVal];
|
|
657
|
+
}
|
|
658
|
+
} else {
|
|
659
|
+
if (!isUndefined(argAfterEqualSign)) {
|
|
660
|
+
argsToSet.push(processValue(key, argAfterEqualSign, true));
|
|
661
|
+
}
|
|
662
|
+
for (let ii = i + 1; ii < args2.length; ii++) {
|
|
663
|
+
if (!configuration["greedy-arrays"] && argsToSet.length > 0 || nargsCount && typeof nargsCount === "number" && argsToSet.length >= nargsCount)
|
|
664
|
+
break;
|
|
665
|
+
next = args2[ii];
|
|
666
|
+
if (/^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next))
|
|
667
|
+
break;
|
|
668
|
+
i = ii;
|
|
669
|
+
argsToSet.push(processValue(key, next, inputIsString));
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
if (typeof nargsCount === "number" && (nargsCount && argsToSet.length < nargsCount || isNaN(nargsCount) && argsToSet.length === 0)) {
|
|
673
|
+
error = Error(__("Not enough arguments following: %s", key));
|
|
674
|
+
}
|
|
675
|
+
setArg(key, argsToSet);
|
|
676
|
+
return i;
|
|
677
|
+
}
|
|
678
|
+
function setArg(key, val, shouldStripQuotes = inputIsString) {
|
|
679
|
+
if (/-/.test(key) && configuration["camel-case-expansion"]) {
|
|
680
|
+
const alias = key.split(".").map(function(prop) {
|
|
681
|
+
return camelCase(prop);
|
|
682
|
+
}).join(".");
|
|
683
|
+
addNewAlias(key, alias);
|
|
684
|
+
}
|
|
685
|
+
const value = processValue(key, val, shouldStripQuotes);
|
|
686
|
+
const splitKey = key.split(".");
|
|
687
|
+
setKey(argv, splitKey, value);
|
|
688
|
+
if (flags.aliases[key]) {
|
|
689
|
+
flags.aliases[key].forEach(function(x) {
|
|
690
|
+
const keyProperties = x.split(".");
|
|
691
|
+
setKey(argv, keyProperties, value);
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
if (splitKey.length > 1 && configuration["dot-notation"]) {
|
|
695
|
+
(flags.aliases[splitKey[0]] || []).forEach(function(x) {
|
|
696
|
+
let keyProperties = x.split(".");
|
|
697
|
+
const a = [].concat(splitKey);
|
|
698
|
+
a.shift();
|
|
699
|
+
keyProperties = keyProperties.concat(a);
|
|
700
|
+
if (!(flags.aliases[key] || []).includes(keyProperties.join("."))) {
|
|
701
|
+
setKey(argv, keyProperties, value);
|
|
702
|
+
}
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
if (checkAllAliases(key, flags.normalize) && !checkAllAliases(key, flags.arrays)) {
|
|
706
|
+
const keys = [key].concat(flags.aliases[key] || []);
|
|
707
|
+
keys.forEach(function(key2) {
|
|
708
|
+
Object.defineProperty(argvReturn, key2, {
|
|
709
|
+
enumerable: true,
|
|
710
|
+
get() {
|
|
711
|
+
return val;
|
|
712
|
+
},
|
|
713
|
+
set(value2) {
|
|
714
|
+
val = typeof value2 === "string" ? mixin.normalize(value2) : value2;
|
|
715
|
+
}
|
|
716
|
+
});
|
|
717
|
+
});
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
function addNewAlias(key, alias) {
|
|
721
|
+
if (!(flags.aliases[key] && flags.aliases[key].length)) {
|
|
722
|
+
flags.aliases[key] = [alias];
|
|
723
|
+
newAliases[alias] = true;
|
|
724
|
+
}
|
|
725
|
+
if (!(flags.aliases[alias] && flags.aliases[alias].length)) {
|
|
726
|
+
addNewAlias(alias, key);
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
function processValue(key, val, shouldStripQuotes) {
|
|
730
|
+
if (shouldStripQuotes) {
|
|
731
|
+
val = stripQuotes(val);
|
|
732
|
+
}
|
|
733
|
+
if (checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) {
|
|
734
|
+
if (typeof val === "string")
|
|
735
|
+
val = val === "true";
|
|
736
|
+
}
|
|
737
|
+
let value = Array.isArray(val) ? val.map(function(v) {
|
|
738
|
+
return maybeCoerceNumber(key, v);
|
|
739
|
+
}) : maybeCoerceNumber(key, val);
|
|
740
|
+
if (checkAllAliases(key, flags.counts) && (isUndefined(value) || typeof value === "boolean")) {
|
|
741
|
+
value = increment();
|
|
742
|
+
}
|
|
743
|
+
if (checkAllAliases(key, flags.normalize) && checkAllAliases(key, flags.arrays)) {
|
|
744
|
+
if (Array.isArray(val))
|
|
745
|
+
value = val.map((val2) => {
|
|
746
|
+
return mixin.normalize(val2);
|
|
747
|
+
});
|
|
748
|
+
else
|
|
749
|
+
value = mixin.normalize(val);
|
|
750
|
+
}
|
|
751
|
+
return value;
|
|
752
|
+
}
|
|
753
|
+
function maybeCoerceNumber(key, value) {
|
|
754
|
+
if (!configuration["parse-positional-numbers"] && key === "_")
|
|
755
|
+
return value;
|
|
756
|
+
if (!checkAllAliases(key, flags.strings) && !checkAllAliases(key, flags.bools) && !Array.isArray(value)) {
|
|
757
|
+
const shouldCoerceNumber = looksLikeNumber(value) && configuration["parse-numbers"] && Number.isSafeInteger(Math.floor(parseFloat(`${value}`)));
|
|
758
|
+
if (shouldCoerceNumber || !isUndefined(value) && checkAllAliases(key, flags.numbers)) {
|
|
759
|
+
value = Number(value);
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
return value;
|
|
763
|
+
}
|
|
764
|
+
function setConfig(argv2) {
|
|
765
|
+
const configLookup = /* @__PURE__ */ Object.create(null);
|
|
766
|
+
applyDefaultsAndAliases(configLookup, flags.aliases, defaults);
|
|
767
|
+
Object.keys(flags.configs).forEach(function(configKey) {
|
|
768
|
+
const configPath = argv2[configKey] || configLookup[configKey];
|
|
769
|
+
if (configPath) {
|
|
770
|
+
try {
|
|
771
|
+
let config = null;
|
|
772
|
+
const resolvedConfigPath = mixin.resolve(mixin.cwd(), configPath);
|
|
773
|
+
const resolveConfig = flags.configs[configKey];
|
|
774
|
+
if (typeof resolveConfig === "function") {
|
|
775
|
+
try {
|
|
776
|
+
config = resolveConfig(resolvedConfigPath);
|
|
777
|
+
} catch (e) {
|
|
778
|
+
config = e;
|
|
779
|
+
}
|
|
780
|
+
if (config instanceof Error) {
|
|
781
|
+
error = config;
|
|
782
|
+
return;
|
|
783
|
+
}
|
|
784
|
+
} else {
|
|
785
|
+
config = mixin.require(resolvedConfigPath);
|
|
786
|
+
}
|
|
787
|
+
setConfigObject(config);
|
|
788
|
+
} catch (ex) {
|
|
789
|
+
if (ex.name === "PermissionDenied")
|
|
790
|
+
error = ex;
|
|
791
|
+
else if (argv2[configKey])
|
|
792
|
+
error = Error(__("Invalid JSON config file: %s", configPath));
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
function setConfigObject(config, prev) {
|
|
798
|
+
Object.keys(config).forEach(function(key) {
|
|
799
|
+
const value = config[key];
|
|
800
|
+
const fullKey = prev ? prev + "." + key : key;
|
|
801
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value) && configuration["dot-notation"]) {
|
|
802
|
+
setConfigObject(value, fullKey);
|
|
803
|
+
} else {
|
|
804
|
+
if (!hasKey(argv, fullKey.split(".")) || checkAllAliases(fullKey, flags.arrays) && configuration["combine-arrays"]) {
|
|
805
|
+
setArg(fullKey, value);
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
});
|
|
809
|
+
}
|
|
810
|
+
function setConfigObjects() {
|
|
811
|
+
if (typeof configObjects !== "undefined") {
|
|
812
|
+
configObjects.forEach(function(configObject) {
|
|
813
|
+
setConfigObject(configObject);
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
function applyEnvVars(argv2, configOnly) {
|
|
818
|
+
if (typeof envPrefix === "undefined")
|
|
819
|
+
return;
|
|
820
|
+
const prefix = typeof envPrefix === "string" ? envPrefix : "";
|
|
821
|
+
const env2 = mixin.env();
|
|
822
|
+
Object.keys(env2).forEach(function(envVar) {
|
|
823
|
+
if (prefix === "" || envVar.lastIndexOf(prefix, 0) === 0) {
|
|
824
|
+
const keys = envVar.split("__").map(function(key, i) {
|
|
825
|
+
if (i === 0) {
|
|
826
|
+
key = key.substring(prefix.length);
|
|
827
|
+
}
|
|
828
|
+
return camelCase(key);
|
|
829
|
+
});
|
|
830
|
+
if ((configOnly && flags.configs[keys.join(".")] || !configOnly) && !hasKey(argv2, keys)) {
|
|
831
|
+
setArg(keys.join("."), env2[envVar]);
|
|
832
|
+
}
|
|
833
|
+
}
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
function applyCoercions(argv2) {
|
|
837
|
+
let coerce;
|
|
838
|
+
const applied = /* @__PURE__ */ new Set();
|
|
839
|
+
Object.keys(argv2).forEach(function(key) {
|
|
840
|
+
if (!applied.has(key)) {
|
|
841
|
+
coerce = checkAllAliases(key, flags.coercions);
|
|
842
|
+
if (typeof coerce === "function") {
|
|
843
|
+
try {
|
|
844
|
+
const value = maybeCoerceNumber(key, coerce(argv2[key]));
|
|
845
|
+
[].concat(flags.aliases[key] || [], key).forEach((ali) => {
|
|
846
|
+
applied.add(ali);
|
|
847
|
+
argv2[ali] = value;
|
|
848
|
+
});
|
|
849
|
+
} catch (err) {
|
|
850
|
+
error = err;
|
|
851
|
+
}
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
});
|
|
855
|
+
}
|
|
856
|
+
function setPlaceholderKeys(argv2) {
|
|
857
|
+
flags.keys.forEach((key) => {
|
|
858
|
+
if (~key.indexOf("."))
|
|
859
|
+
return;
|
|
860
|
+
if (typeof argv2[key] === "undefined")
|
|
861
|
+
argv2[key] = void 0;
|
|
862
|
+
});
|
|
863
|
+
return argv2;
|
|
864
|
+
}
|
|
865
|
+
function applyDefaultsAndAliases(obj, aliases2, defaults2, canLog = false) {
|
|
866
|
+
Object.keys(defaults2).forEach(function(key) {
|
|
867
|
+
if (!hasKey(obj, key.split("."))) {
|
|
868
|
+
setKey(obj, key.split("."), defaults2[key]);
|
|
869
|
+
if (canLog)
|
|
870
|
+
defaulted[key] = true;
|
|
871
|
+
(aliases2[key] || []).forEach(function(x) {
|
|
872
|
+
if (hasKey(obj, x.split(".")))
|
|
873
|
+
return;
|
|
874
|
+
setKey(obj, x.split("."), defaults2[key]);
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
});
|
|
878
|
+
}
|
|
879
|
+
function hasKey(obj, keys) {
|
|
880
|
+
let o = obj;
|
|
881
|
+
if (!configuration["dot-notation"])
|
|
882
|
+
keys = [keys.join(".")];
|
|
883
|
+
keys.slice(0, -1).forEach(function(key2) {
|
|
884
|
+
o = o[key2] || {};
|
|
885
|
+
});
|
|
886
|
+
const key = keys[keys.length - 1];
|
|
887
|
+
if (typeof o !== "object")
|
|
888
|
+
return false;
|
|
889
|
+
else
|
|
890
|
+
return key in o;
|
|
891
|
+
}
|
|
892
|
+
function setKey(obj, keys, value) {
|
|
893
|
+
let o = obj;
|
|
894
|
+
if (!configuration["dot-notation"])
|
|
895
|
+
keys = [keys.join(".")];
|
|
896
|
+
keys.slice(0, -1).forEach(function(key2) {
|
|
897
|
+
key2 = sanitizeKey(key2);
|
|
898
|
+
if (typeof o === "object" && o[key2] === void 0) {
|
|
899
|
+
o[key2] = {};
|
|
900
|
+
}
|
|
901
|
+
if (typeof o[key2] !== "object" || Array.isArray(o[key2])) {
|
|
902
|
+
if (Array.isArray(o[key2])) {
|
|
903
|
+
o[key2].push({});
|
|
904
|
+
} else {
|
|
905
|
+
o[key2] = [o[key2], {}];
|
|
906
|
+
}
|
|
907
|
+
o = o[key2][o[key2].length - 1];
|
|
908
|
+
} else {
|
|
909
|
+
o = o[key2];
|
|
910
|
+
}
|
|
911
|
+
});
|
|
912
|
+
const key = sanitizeKey(keys[keys.length - 1]);
|
|
913
|
+
const isTypeArray = checkAllAliases(keys.join("."), flags.arrays);
|
|
914
|
+
const isValueArray = Array.isArray(value);
|
|
915
|
+
let duplicate = configuration["duplicate-arguments-array"];
|
|
916
|
+
if (!duplicate && checkAllAliases(key, flags.nargs)) {
|
|
917
|
+
duplicate = true;
|
|
918
|
+
if (!isUndefined(o[key]) && flags.nargs[key] === 1 || Array.isArray(o[key]) && o[key].length === flags.nargs[key]) {
|
|
919
|
+
o[key] = void 0;
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
if (value === increment()) {
|
|
923
|
+
o[key] = increment(o[key]);
|
|
924
|
+
} else if (Array.isArray(o[key])) {
|
|
925
|
+
if (duplicate && isTypeArray && isValueArray) {
|
|
926
|
+
o[key] = configuration["flatten-duplicate-arrays"] ? o[key].concat(value) : (Array.isArray(o[key][0]) ? o[key] : [o[key]]).concat([value]);
|
|
927
|
+
} else if (!duplicate && Boolean(isTypeArray) === Boolean(isValueArray)) {
|
|
928
|
+
o[key] = value;
|
|
929
|
+
} else {
|
|
930
|
+
o[key] = o[key].concat([value]);
|
|
931
|
+
}
|
|
932
|
+
} else if (o[key] === void 0 && isTypeArray) {
|
|
933
|
+
o[key] = isValueArray ? value : [value];
|
|
934
|
+
} else if (duplicate && !(o[key] === void 0 || checkAllAliases(key, flags.counts) || checkAllAliases(key, flags.bools))) {
|
|
935
|
+
o[key] = [o[key], value];
|
|
936
|
+
} else {
|
|
937
|
+
o[key] = value;
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
function extendAliases(...args2) {
|
|
941
|
+
args2.forEach(function(obj) {
|
|
942
|
+
Object.keys(obj || {}).forEach(function(key) {
|
|
943
|
+
if (flags.aliases[key])
|
|
944
|
+
return;
|
|
945
|
+
flags.aliases[key] = [].concat(aliases[key] || []);
|
|
946
|
+
flags.aliases[key].concat(key).forEach(function(x) {
|
|
947
|
+
if (/-/.test(x) && configuration["camel-case-expansion"]) {
|
|
948
|
+
const c = camelCase(x);
|
|
949
|
+
if (c !== key && flags.aliases[key].indexOf(c) === -1) {
|
|
950
|
+
flags.aliases[key].push(c);
|
|
951
|
+
newAliases[c] = true;
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
});
|
|
955
|
+
flags.aliases[key].concat(key).forEach(function(x) {
|
|
956
|
+
if (x.length > 1 && /[A-Z]/.test(x) && configuration["camel-case-expansion"]) {
|
|
957
|
+
const c = decamelize(x, "-");
|
|
958
|
+
if (c !== key && flags.aliases[key].indexOf(c) === -1) {
|
|
959
|
+
flags.aliases[key].push(c);
|
|
960
|
+
newAliases[c] = true;
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
});
|
|
964
|
+
flags.aliases[key].forEach(function(x) {
|
|
965
|
+
flags.aliases[x] = [key].concat(flags.aliases[key].filter(function(y) {
|
|
966
|
+
return x !== y;
|
|
967
|
+
}));
|
|
968
|
+
});
|
|
969
|
+
});
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
function checkAllAliases(key, flag) {
|
|
973
|
+
const toCheck = [].concat(flags.aliases[key] || [], key);
|
|
974
|
+
const keys = Object.keys(flag);
|
|
975
|
+
const setAlias = toCheck.find((key2) => keys.includes(key2));
|
|
976
|
+
return setAlias ? flag[setAlias] : false;
|
|
977
|
+
}
|
|
978
|
+
function hasAnyFlag(key) {
|
|
979
|
+
const flagsKeys = Object.keys(flags);
|
|
980
|
+
const toCheck = [].concat(flagsKeys.map((k) => flags[k]));
|
|
981
|
+
return toCheck.some(function(flag) {
|
|
982
|
+
return Array.isArray(flag) ? flag.includes(key) : flag[key];
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
function hasFlagsMatching(arg, ...patterns) {
|
|
986
|
+
const toCheck = [].concat(...patterns);
|
|
987
|
+
return toCheck.some(function(pattern) {
|
|
988
|
+
const match = arg.match(pattern);
|
|
989
|
+
return match && hasAnyFlag(match[1]);
|
|
990
|
+
});
|
|
991
|
+
}
|
|
992
|
+
function hasAllShortFlags(arg) {
|
|
993
|
+
if (arg.match(negative) || !arg.match(/^-[^-]+/)) {
|
|
994
|
+
return false;
|
|
995
|
+
}
|
|
996
|
+
let hasAllFlags = true;
|
|
997
|
+
let next;
|
|
998
|
+
const letters = arg.slice(1).split("");
|
|
999
|
+
for (let j = 0; j < letters.length; j++) {
|
|
1000
|
+
next = arg.slice(j + 2);
|
|
1001
|
+
if (!hasAnyFlag(letters[j])) {
|
|
1002
|
+
hasAllFlags = false;
|
|
1003
|
+
break;
|
|
1004
|
+
}
|
|
1005
|
+
if (letters[j + 1] && letters[j + 1] === "=" || next === "-" || /[A-Za-z]/.test(letters[j]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(next) || letters[j + 1] && letters[j + 1].match(/\W/)) {
|
|
1006
|
+
break;
|
|
1007
|
+
}
|
|
1008
|
+
}
|
|
1009
|
+
return hasAllFlags;
|
|
1010
|
+
}
|
|
1011
|
+
function isUnknownOptionAsArg(arg) {
|
|
1012
|
+
return configuration["unknown-options-as-args"] && isUnknownOption(arg);
|
|
1013
|
+
}
|
|
1014
|
+
function isUnknownOption(arg) {
|
|
1015
|
+
arg = arg.replace(/^-{3,}/, "--");
|
|
1016
|
+
if (arg.match(negative)) {
|
|
1017
|
+
return false;
|
|
1018
|
+
}
|
|
1019
|
+
if (hasAllShortFlags(arg)) {
|
|
1020
|
+
return false;
|
|
1021
|
+
}
|
|
1022
|
+
const flagWithEquals = /^-+([^=]+?)=[\s\S]*$/;
|
|
1023
|
+
const normalFlag = /^-+([^=]+?)$/;
|
|
1024
|
+
const flagEndingInHyphen = /^-+([^=]+?)-$/;
|
|
1025
|
+
const flagEndingInDigits = /^-+([^=]+?\d+)$/;
|
|
1026
|
+
const flagEndingInNonWordCharacters = /^-+([^=]+?)\W+.*$/;
|
|
1027
|
+
return !hasFlagsMatching(arg, flagWithEquals, negatedBoolean, normalFlag, flagEndingInHyphen, flagEndingInDigits, flagEndingInNonWordCharacters);
|
|
1028
|
+
}
|
|
1029
|
+
function defaultValue(key) {
|
|
1030
|
+
if (!checkAllAliases(key, flags.bools) && !checkAllAliases(key, flags.counts) && `${key}` in defaults) {
|
|
1031
|
+
return defaults[key];
|
|
1032
|
+
} else {
|
|
1033
|
+
return defaultForType(guessType(key));
|
|
1034
|
+
}
|
|
1035
|
+
}
|
|
1036
|
+
function defaultForType(type) {
|
|
1037
|
+
const def = {
|
|
1038
|
+
[DefaultValuesForTypeKey.BOOLEAN]: true,
|
|
1039
|
+
[DefaultValuesForTypeKey.STRING]: "",
|
|
1040
|
+
[DefaultValuesForTypeKey.NUMBER]: void 0,
|
|
1041
|
+
[DefaultValuesForTypeKey.ARRAY]: []
|
|
1042
|
+
};
|
|
1043
|
+
return def[type];
|
|
1044
|
+
}
|
|
1045
|
+
function guessType(key) {
|
|
1046
|
+
let type = DefaultValuesForTypeKey.BOOLEAN;
|
|
1047
|
+
if (checkAllAliases(key, flags.strings))
|
|
1048
|
+
type = DefaultValuesForTypeKey.STRING;
|
|
1049
|
+
else if (checkAllAliases(key, flags.numbers))
|
|
1050
|
+
type = DefaultValuesForTypeKey.NUMBER;
|
|
1051
|
+
else if (checkAllAliases(key, flags.bools))
|
|
1052
|
+
type = DefaultValuesForTypeKey.BOOLEAN;
|
|
1053
|
+
else if (checkAllAliases(key, flags.arrays))
|
|
1054
|
+
type = DefaultValuesForTypeKey.ARRAY;
|
|
1055
|
+
return type;
|
|
1056
|
+
}
|
|
1057
|
+
function isUndefined(num) {
|
|
1058
|
+
return num === void 0;
|
|
1059
|
+
}
|
|
1060
|
+
function checkConfiguration() {
|
|
1061
|
+
Object.keys(flags.counts).find((key) => {
|
|
1062
|
+
if (checkAllAliases(key, flags.arrays)) {
|
|
1063
|
+
error = Error(__("Invalid configuration: %s, opts.count excludes opts.array.", key));
|
|
1064
|
+
return true;
|
|
1065
|
+
} else if (checkAllAliases(key, flags.nargs)) {
|
|
1066
|
+
error = Error(__("Invalid configuration: %s, opts.count excludes opts.narg.", key));
|
|
1067
|
+
return true;
|
|
1068
|
+
}
|
|
1069
|
+
return false;
|
|
1070
|
+
});
|
|
1071
|
+
}
|
|
1072
|
+
return {
|
|
1073
|
+
aliases: Object.assign({}, flags.aliases),
|
|
1074
|
+
argv: Object.assign(argvReturn, argv),
|
|
1075
|
+
configuration,
|
|
1076
|
+
defaulted: Object.assign({}, defaulted),
|
|
1077
|
+
error,
|
|
1078
|
+
newAliases: Object.assign({}, newAliases)
|
|
1079
|
+
};
|
|
1080
|
+
}
|
|
1081
|
+
};
|
|
1082
|
+
function combineAliases(aliases) {
|
|
1083
|
+
const aliasArrays = [];
|
|
1084
|
+
const combined = /* @__PURE__ */ Object.create(null);
|
|
1085
|
+
let change = true;
|
|
1086
|
+
Object.keys(aliases).forEach(function(key) {
|
|
1087
|
+
aliasArrays.push([].concat(aliases[key], key));
|
|
1088
|
+
});
|
|
1089
|
+
while (change) {
|
|
1090
|
+
change = false;
|
|
1091
|
+
for (let i = 0; i < aliasArrays.length; i++) {
|
|
1092
|
+
for (let ii = i + 1; ii < aliasArrays.length; ii++) {
|
|
1093
|
+
const intersect = aliasArrays[i].filter(function(v) {
|
|
1094
|
+
return aliasArrays[ii].indexOf(v) !== -1;
|
|
1095
|
+
});
|
|
1096
|
+
if (intersect.length) {
|
|
1097
|
+
aliasArrays[i] = aliasArrays[i].concat(aliasArrays[ii]);
|
|
1098
|
+
aliasArrays.splice(ii, 1);
|
|
1099
|
+
change = true;
|
|
1100
|
+
break;
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
}
|
|
1104
|
+
}
|
|
1105
|
+
aliasArrays.forEach(function(aliasArray) {
|
|
1106
|
+
aliasArray = aliasArray.filter(function(v, i, self) {
|
|
1107
|
+
return self.indexOf(v) === i;
|
|
1108
|
+
});
|
|
1109
|
+
const lastAlias = aliasArray.pop();
|
|
1110
|
+
if (lastAlias !== void 0 && typeof lastAlias === "string") {
|
|
1111
|
+
combined[lastAlias] = aliasArray;
|
|
1112
|
+
}
|
|
1113
|
+
});
|
|
1114
|
+
return combined;
|
|
1115
|
+
}
|
|
1116
|
+
function increment(orig) {
|
|
1117
|
+
return orig !== void 0 ? orig + 1 : 1;
|
|
1118
|
+
}
|
|
1119
|
+
function sanitizeKey(key) {
|
|
1120
|
+
if (key === "__proto__")
|
|
1121
|
+
return "___proto___";
|
|
1122
|
+
return key;
|
|
1123
|
+
}
|
|
1124
|
+
function stripQuotes(val) {
|
|
1125
|
+
return typeof val === "string" && (val[0] === "'" || val[0] === '"') && val[val.length - 1] === val[0] ? val.substring(1, val.length - 1) : val;
|
|
1126
|
+
}
|
|
1127
|
+
var _a;
|
|
1128
|
+
var _b;
|
|
1129
|
+
var _c;
|
|
1130
|
+
var minNodeVersion = process && process.env && process.env.YARGS_MIN_NODE_VERSION ? Number(process.env.YARGS_MIN_NODE_VERSION) : 12;
|
|
1131
|
+
var nodeVersion = (_b = (_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node) !== null && _b !== void 0 ? _b : (_c = process === null || process === void 0 ? void 0 : process.version) === null || _c === void 0 ? void 0 : _c.slice(1);
|
|
1132
|
+
if (nodeVersion) {
|
|
1133
|
+
const major = Number(nodeVersion.match(/^([^.]+)/)[1]);
|
|
1134
|
+
if (major < minNodeVersion) {
|
|
1135
|
+
throw Error(`yargs parser supports a minimum Node.js version of ${minNodeVersion}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
var env = process ? process.env : {};
|
|
1139
|
+
var parser = new YargsParser({
|
|
1140
|
+
cwd: process.cwd,
|
|
1141
|
+
env: () => {
|
|
1142
|
+
return env;
|
|
1143
|
+
},
|
|
1144
|
+
format: util.format,
|
|
1145
|
+
normalize: path.normalize,
|
|
1146
|
+
resolve: path.resolve,
|
|
1147
|
+
require: (path2) => {
|
|
1148
|
+
if (typeof require !== "undefined") {
|
|
1149
|
+
return require(path2);
|
|
1150
|
+
} else if (path2.match(/\.json$/)) {
|
|
1151
|
+
return JSON.parse(fs.readFileSync(path2, "utf8"));
|
|
1152
|
+
} else {
|
|
1153
|
+
throw Error("only .json config files are supported in ESM");
|
|
1154
|
+
}
|
|
1155
|
+
}
|
|
1156
|
+
});
|
|
1157
|
+
var yargsParser = function Parser(args, opts) {
|
|
1158
|
+
const result = parser.parse(args.slice(), opts);
|
|
1159
|
+
return result.argv;
|
|
1160
|
+
};
|
|
1161
|
+
yargsParser.detailed = function(args, opts) {
|
|
1162
|
+
return parser.parse(args.slice(), opts);
|
|
1163
|
+
};
|
|
1164
|
+
yargsParser.camelCase = camelCase;
|
|
1165
|
+
yargsParser.decamelize = decamelize;
|
|
1166
|
+
yargsParser.looksLikeNumber = looksLikeNumber;
|
|
1167
|
+
module2.exports = yargsParser;
|
|
1168
|
+
}
|
|
1169
|
+
});
|
|
1170
|
+
|
|
1171
|
+
// ../../node_modules/ansi-regex/index.js
|
|
1172
|
+
var require_ansi_regex = __commonJS({
|
|
1173
|
+
"../../node_modules/ansi-regex/index.js"(exports, module2) {
|
|
1174
|
+
"use strict";
|
|
1175
|
+
module2.exports = ({ onlyFirst = false } = {}) => {
|
|
1176
|
+
const pattern = [
|
|
1177
|
+
"[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]+)*|[a-zA-Z\\d]+(?:;[-a-zA-Z\\d\\/#&.:=?%@~_]*)*)?\\u0007)",
|
|
1178
|
+
"(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PR-TZcf-ntqry=><~]))"
|
|
1179
|
+
].join("|");
|
|
1180
|
+
return new RegExp(pattern, onlyFirst ? void 0 : "g");
|
|
1181
|
+
};
|
|
1182
|
+
}
|
|
1183
|
+
});
|
|
1184
|
+
|
|
1185
|
+
// ../../node_modules/strip-ansi/index.js
|
|
1186
|
+
var require_strip_ansi = __commonJS({
|
|
1187
|
+
"../../node_modules/strip-ansi/index.js"(exports, module2) {
|
|
1188
|
+
"use strict";
|
|
1189
|
+
var ansiRegex = require_ansi_regex();
|
|
1190
|
+
module2.exports = (string) => typeof string === "string" ? string.replace(ansiRegex(), "") : string;
|
|
1191
|
+
}
|
|
1192
|
+
});
|
|
1193
|
+
|
|
1194
|
+
// ../../node_modules/string-width/node_modules/is-fullwidth-code-point/index.js
|
|
1195
|
+
var require_is_fullwidth_code_point = __commonJS({
|
|
1196
|
+
"../../node_modules/string-width/node_modules/is-fullwidth-code-point/index.js"(exports, module2) {
|
|
1197
|
+
"use strict";
|
|
1198
|
+
var isFullwidthCodePoint = (codePoint) => {
|
|
1199
|
+
if (Number.isNaN(codePoint)) {
|
|
1200
|
+
return false;
|
|
1201
|
+
}
|
|
1202
|
+
if (codePoint >= 4352 && (codePoint <= 4447 || codePoint === 9001 || codePoint === 9002 || 11904 <= codePoint && codePoint <= 12871 && codePoint !== 12351 || 12880 <= codePoint && codePoint <= 19903 || 19968 <= codePoint && codePoint <= 42182 || 43360 <= codePoint && codePoint <= 43388 || 44032 <= codePoint && codePoint <= 55203 || 63744 <= codePoint && codePoint <= 64255 || 65040 <= codePoint && codePoint <= 65049 || 65072 <= codePoint && codePoint <= 65131 || 65281 <= codePoint && codePoint <= 65376 || 65504 <= codePoint && codePoint <= 65510 || 110592 <= codePoint && codePoint <= 110593 || 127488 <= codePoint && codePoint <= 127569 || 131072 <= codePoint && codePoint <= 262141)) {
|
|
1203
|
+
return true;
|
|
1204
|
+
}
|
|
1205
|
+
return false;
|
|
1206
|
+
};
|
|
1207
|
+
module2.exports = isFullwidthCodePoint;
|
|
1208
|
+
module2.exports.default = isFullwidthCodePoint;
|
|
1209
|
+
}
|
|
1210
|
+
});
|
|
1211
|
+
|
|
1212
|
+
// ../../node_modules/string-width/node_modules/emoji-regex/index.js
|
|
1213
|
+
var require_emoji_regex = __commonJS({
|
|
1214
|
+
"../../node_modules/string-width/node_modules/emoji-regex/index.js"(exports, module2) {
|
|
1215
|
+
"use strict";
|
|
1216
|
+
module2.exports = function() {
|
|
1217
|
+
return /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73)\uDB40\uDC7F|\uD83D\uDC68(?:\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68\uD83C\uDFFB|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C[\uDFFB-\uDFFF])|(?:\uD83E\uDDD1\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)\uD83C\uDFFB|\uD83E\uDDD1(?:\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1)|(?:\uD83E\uDDD1\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69]))(?:\uD83C[\uDFFB-\uDFFE])|(?:\uD83E\uDDD1\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB\uDFFC])|\uD83D\uDC69(?:\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|(?:\uD83E\uDDD1\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D\uD83D\uDC69)(?:\uD83C[\uDFFB-\uDFFD])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|(?:(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)\uFE0F|\uD83D\uDC6F|\uD83E[\uDD3C\uDDDE\uDDDF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620)\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF4\uD83C\uDDF2|\uD83C\uDDF6\uD83C\uDDE6|[#\*0-9]\uFE0F\u20E3|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC70\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD36\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5\uDEEB\uDEEC\uDEF4-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])|(?:[#\*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFA\uDFE0-\uDFEB]|\uD83E[\uDD0D-\uDD3A\uDD3C-\uDD45\uDD47-\uDD71\uDD73-\uDD76\uDD7A-\uDDA2\uDDA5-\uDDAA\uDDAE-\uDDCA\uDDCD-\uDDFF\uDE70-\uDE73\uDE78-\uDE7A\uDE80-\uDE82\uDE90-\uDE95])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
|
|
1218
|
+
};
|
|
1219
|
+
}
|
|
1220
|
+
});
|
|
1221
|
+
|
|
1222
|
+
// ../../node_modules/string-width/index.js
|
|
1223
|
+
var require_string_width = __commonJS({
|
|
1224
|
+
"../../node_modules/string-width/index.js"(exports, module2) {
|
|
1225
|
+
"use strict";
|
|
1226
|
+
var stripAnsi = require_strip_ansi();
|
|
1227
|
+
var isFullwidthCodePoint = require_is_fullwidth_code_point();
|
|
1228
|
+
var emojiRegex = require_emoji_regex();
|
|
1229
|
+
var stringWidth = (string) => {
|
|
1230
|
+
if (typeof string !== "string" || string.length === 0) {
|
|
1231
|
+
return 0;
|
|
1232
|
+
}
|
|
1233
|
+
string = stripAnsi(string);
|
|
1234
|
+
if (string.length === 0) {
|
|
1235
|
+
return 0;
|
|
1236
|
+
}
|
|
1237
|
+
string = string.replace(emojiRegex(), " ");
|
|
1238
|
+
let width = 0;
|
|
1239
|
+
for (let i = 0; i < string.length; i++) {
|
|
1240
|
+
const code = string.codePointAt(i);
|
|
1241
|
+
if (code <= 31 || code >= 127 && code <= 159) {
|
|
1242
|
+
continue;
|
|
1243
|
+
}
|
|
1244
|
+
if (code >= 768 && code <= 879) {
|
|
1245
|
+
continue;
|
|
1246
|
+
}
|
|
1247
|
+
if (code > 65535) {
|
|
1248
|
+
i++;
|
|
1249
|
+
}
|
|
1250
|
+
width += isFullwidthCodePoint(code) ? 2 : 1;
|
|
1251
|
+
}
|
|
1252
|
+
return width;
|
|
1253
|
+
};
|
|
1254
|
+
module2.exports = stringWidth;
|
|
1255
|
+
module2.exports.default = stringWidth;
|
|
1256
|
+
}
|
|
1257
|
+
});
|
|
1258
|
+
|
|
1259
|
+
// ../../node_modules/color-name/index.js
|
|
1260
|
+
var require_color_name = __commonJS({
|
|
1261
|
+
"../../node_modules/color-name/index.js"(exports, module2) {
|
|
1262
|
+
"use strict";
|
|
1263
|
+
module2.exports = {
|
|
1264
|
+
"aliceblue": [240, 248, 255],
|
|
1265
|
+
"antiquewhite": [250, 235, 215],
|
|
1266
|
+
"aqua": [0, 255, 255],
|
|
1267
|
+
"aquamarine": [127, 255, 212],
|
|
1268
|
+
"azure": [240, 255, 255],
|
|
1269
|
+
"beige": [245, 245, 220],
|
|
1270
|
+
"bisque": [255, 228, 196],
|
|
1271
|
+
"black": [0, 0, 0],
|
|
1272
|
+
"blanchedalmond": [255, 235, 205],
|
|
1273
|
+
"blue": [0, 0, 255],
|
|
1274
|
+
"blueviolet": [138, 43, 226],
|
|
1275
|
+
"brown": [165, 42, 42],
|
|
1276
|
+
"burlywood": [222, 184, 135],
|
|
1277
|
+
"cadetblue": [95, 158, 160],
|
|
1278
|
+
"chartreuse": [127, 255, 0],
|
|
1279
|
+
"chocolate": [210, 105, 30],
|
|
1280
|
+
"coral": [255, 127, 80],
|
|
1281
|
+
"cornflowerblue": [100, 149, 237],
|
|
1282
|
+
"cornsilk": [255, 248, 220],
|
|
1283
|
+
"crimson": [220, 20, 60],
|
|
1284
|
+
"cyan": [0, 255, 255],
|
|
1285
|
+
"darkblue": [0, 0, 139],
|
|
1286
|
+
"darkcyan": [0, 139, 139],
|
|
1287
|
+
"darkgoldenrod": [184, 134, 11],
|
|
1288
|
+
"darkgray": [169, 169, 169],
|
|
1289
|
+
"darkgreen": [0, 100, 0],
|
|
1290
|
+
"darkgrey": [169, 169, 169],
|
|
1291
|
+
"darkkhaki": [189, 183, 107],
|
|
1292
|
+
"darkmagenta": [139, 0, 139],
|
|
1293
|
+
"darkolivegreen": [85, 107, 47],
|
|
1294
|
+
"darkorange": [255, 140, 0],
|
|
1295
|
+
"darkorchid": [153, 50, 204],
|
|
1296
|
+
"darkred": [139, 0, 0],
|
|
1297
|
+
"darksalmon": [233, 150, 122],
|
|
1298
|
+
"darkseagreen": [143, 188, 143],
|
|
1299
|
+
"darkslateblue": [72, 61, 139],
|
|
1300
|
+
"darkslategray": [47, 79, 79],
|
|
1301
|
+
"darkslategrey": [47, 79, 79],
|
|
1302
|
+
"darkturquoise": [0, 206, 209],
|
|
1303
|
+
"darkviolet": [148, 0, 211],
|
|
1304
|
+
"deeppink": [255, 20, 147],
|
|
1305
|
+
"deepskyblue": [0, 191, 255],
|
|
1306
|
+
"dimgray": [105, 105, 105],
|
|
1307
|
+
"dimgrey": [105, 105, 105],
|
|
1308
|
+
"dodgerblue": [30, 144, 255],
|
|
1309
|
+
"firebrick": [178, 34, 34],
|
|
1310
|
+
"floralwhite": [255, 250, 240],
|
|
1311
|
+
"forestgreen": [34, 139, 34],
|
|
1312
|
+
"fuchsia": [255, 0, 255],
|
|
1313
|
+
"gainsboro": [220, 220, 220],
|
|
1314
|
+
"ghostwhite": [248, 248, 255],
|
|
1315
|
+
"gold": [255, 215, 0],
|
|
1316
|
+
"goldenrod": [218, 165, 32],
|
|
1317
|
+
"gray": [128, 128, 128],
|
|
1318
|
+
"green": [0, 128, 0],
|
|
1319
|
+
"greenyellow": [173, 255, 47],
|
|
1320
|
+
"grey": [128, 128, 128],
|
|
1321
|
+
"honeydew": [240, 255, 240],
|
|
1322
|
+
"hotpink": [255, 105, 180],
|
|
1323
|
+
"indianred": [205, 92, 92],
|
|
1324
|
+
"indigo": [75, 0, 130],
|
|
1325
|
+
"ivory": [255, 255, 240],
|
|
1326
|
+
"khaki": [240, 230, 140],
|
|
1327
|
+
"lavender": [230, 230, 250],
|
|
1328
|
+
"lavenderblush": [255, 240, 245],
|
|
1329
|
+
"lawngreen": [124, 252, 0],
|
|
1330
|
+
"lemonchiffon": [255, 250, 205],
|
|
1331
|
+
"lightblue": [173, 216, 230],
|
|
1332
|
+
"lightcoral": [240, 128, 128],
|
|
1333
|
+
"lightcyan": [224, 255, 255],
|
|
1334
|
+
"lightgoldenrodyellow": [250, 250, 210],
|
|
1335
|
+
"lightgray": [211, 211, 211],
|
|
1336
|
+
"lightgreen": [144, 238, 144],
|
|
1337
|
+
"lightgrey": [211, 211, 211],
|
|
1338
|
+
"lightpink": [255, 182, 193],
|
|
1339
|
+
"lightsalmon": [255, 160, 122],
|
|
1340
|
+
"lightseagreen": [32, 178, 170],
|
|
1341
|
+
"lightskyblue": [135, 206, 250],
|
|
1342
|
+
"lightslategray": [119, 136, 153],
|
|
1343
|
+
"lightslategrey": [119, 136, 153],
|
|
1344
|
+
"lightsteelblue": [176, 196, 222],
|
|
1345
|
+
"lightyellow": [255, 255, 224],
|
|
1346
|
+
"lime": [0, 255, 0],
|
|
1347
|
+
"limegreen": [50, 205, 50],
|
|
1348
|
+
"linen": [250, 240, 230],
|
|
1349
|
+
"magenta": [255, 0, 255],
|
|
1350
|
+
"maroon": [128, 0, 0],
|
|
1351
|
+
"mediumaquamarine": [102, 205, 170],
|
|
1352
|
+
"mediumblue": [0, 0, 205],
|
|
1353
|
+
"mediumorchid": [186, 85, 211],
|
|
1354
|
+
"mediumpurple": [147, 112, 219],
|
|
1355
|
+
"mediumseagreen": [60, 179, 113],
|
|
1356
|
+
"mediumslateblue": [123, 104, 238],
|
|
1357
|
+
"mediumspringgreen": [0, 250, 154],
|
|
1358
|
+
"mediumturquoise": [72, 209, 204],
|
|
1359
|
+
"mediumvioletred": [199, 21, 133],
|
|
1360
|
+
"midnightblue": [25, 25, 112],
|
|
1361
|
+
"mintcream": [245, 255, 250],
|
|
1362
|
+
"mistyrose": [255, 228, 225],
|
|
1363
|
+
"moccasin": [255, 228, 181],
|
|
1364
|
+
"navajowhite": [255, 222, 173],
|
|
1365
|
+
"navy": [0, 0, 128],
|
|
1366
|
+
"oldlace": [253, 245, 230],
|
|
1367
|
+
"olive": [128, 128, 0],
|
|
1368
|
+
"olivedrab": [107, 142, 35],
|
|
1369
|
+
"orange": [255, 165, 0],
|
|
1370
|
+
"orangered": [255, 69, 0],
|
|
1371
|
+
"orchid": [218, 112, 214],
|
|
1372
|
+
"palegoldenrod": [238, 232, 170],
|
|
1373
|
+
"palegreen": [152, 251, 152],
|
|
1374
|
+
"paleturquoise": [175, 238, 238],
|
|
1375
|
+
"palevioletred": [219, 112, 147],
|
|
1376
|
+
"papayawhip": [255, 239, 213],
|
|
1377
|
+
"peachpuff": [255, 218, 185],
|
|
1378
|
+
"peru": [205, 133, 63],
|
|
1379
|
+
"pink": [255, 192, 203],
|
|
1380
|
+
"plum": [221, 160, 221],
|
|
1381
|
+
"powderblue": [176, 224, 230],
|
|
1382
|
+
"purple": [128, 0, 128],
|
|
1383
|
+
"rebeccapurple": [102, 51, 153],
|
|
1384
|
+
"red": [255, 0, 0],
|
|
1385
|
+
"rosybrown": [188, 143, 143],
|
|
1386
|
+
"royalblue": [65, 105, 225],
|
|
1387
|
+
"saddlebrown": [139, 69, 19],
|
|
1388
|
+
"salmon": [250, 128, 114],
|
|
1389
|
+
"sandybrown": [244, 164, 96],
|
|
1390
|
+
"seagreen": [46, 139, 87],
|
|
1391
|
+
"seashell": [255, 245, 238],
|
|
1392
|
+
"sienna": [160, 82, 45],
|
|
1393
|
+
"silver": [192, 192, 192],
|
|
1394
|
+
"skyblue": [135, 206, 235],
|
|
1395
|
+
"slateblue": [106, 90, 205],
|
|
1396
|
+
"slategray": [112, 128, 144],
|
|
1397
|
+
"slategrey": [112, 128, 144],
|
|
1398
|
+
"snow": [255, 250, 250],
|
|
1399
|
+
"springgreen": [0, 255, 127],
|
|
1400
|
+
"steelblue": [70, 130, 180],
|
|
1401
|
+
"tan": [210, 180, 140],
|
|
1402
|
+
"teal": [0, 128, 128],
|
|
1403
|
+
"thistle": [216, 191, 216],
|
|
1404
|
+
"tomato": [255, 99, 71],
|
|
1405
|
+
"turquoise": [64, 224, 208],
|
|
1406
|
+
"violet": [238, 130, 238],
|
|
1407
|
+
"wheat": [245, 222, 179],
|
|
1408
|
+
"white": [255, 255, 255],
|
|
1409
|
+
"whitesmoke": [245, 245, 245],
|
|
1410
|
+
"yellow": [255, 255, 0],
|
|
1411
|
+
"yellowgreen": [154, 205, 50]
|
|
1412
|
+
};
|
|
1413
|
+
}
|
|
1414
|
+
});
|
|
1415
|
+
|
|
1416
|
+
// ../../node_modules/color-convert/conversions.js
|
|
1417
|
+
var require_conversions = __commonJS({
|
|
1418
|
+
"../../node_modules/color-convert/conversions.js"(exports, module2) {
|
|
1419
|
+
var cssKeywords = require_color_name();
|
|
1420
|
+
var reverseKeywords = {};
|
|
1421
|
+
for (const key of Object.keys(cssKeywords)) {
|
|
1422
|
+
reverseKeywords[cssKeywords[key]] = key;
|
|
1423
|
+
}
|
|
1424
|
+
var convert = {
|
|
1425
|
+
rgb: { channels: 3, labels: "rgb" },
|
|
1426
|
+
hsl: { channels: 3, labels: "hsl" },
|
|
1427
|
+
hsv: { channels: 3, labels: "hsv" },
|
|
1428
|
+
hwb: { channels: 3, labels: "hwb" },
|
|
1429
|
+
cmyk: { channels: 4, labels: "cmyk" },
|
|
1430
|
+
xyz: { channels: 3, labels: "xyz" },
|
|
1431
|
+
lab: { channels: 3, labels: "lab" },
|
|
1432
|
+
lch: { channels: 3, labels: "lch" },
|
|
1433
|
+
hex: { channels: 1, labels: ["hex"] },
|
|
1434
|
+
keyword: { channels: 1, labels: ["keyword"] },
|
|
1435
|
+
ansi16: { channels: 1, labels: ["ansi16"] },
|
|
1436
|
+
ansi256: { channels: 1, labels: ["ansi256"] },
|
|
1437
|
+
hcg: { channels: 3, labels: ["h", "c", "g"] },
|
|
1438
|
+
apple: { channels: 3, labels: ["r16", "g16", "b16"] },
|
|
1439
|
+
gray: { channels: 1, labels: ["gray"] }
|
|
1440
|
+
};
|
|
1441
|
+
module2.exports = convert;
|
|
1442
|
+
for (const model of Object.keys(convert)) {
|
|
1443
|
+
if (!("channels" in convert[model])) {
|
|
1444
|
+
throw new Error("missing channels property: " + model);
|
|
1445
|
+
}
|
|
1446
|
+
if (!("labels" in convert[model])) {
|
|
1447
|
+
throw new Error("missing channel labels property: " + model);
|
|
1448
|
+
}
|
|
1449
|
+
if (convert[model].labels.length !== convert[model].channels) {
|
|
1450
|
+
throw new Error("channel and label counts mismatch: " + model);
|
|
1451
|
+
}
|
|
1452
|
+
const { channels, labels } = convert[model];
|
|
1453
|
+
delete convert[model].channels;
|
|
1454
|
+
delete convert[model].labels;
|
|
1455
|
+
Object.defineProperty(convert[model], "channels", { value: channels });
|
|
1456
|
+
Object.defineProperty(convert[model], "labels", { value: labels });
|
|
1457
|
+
}
|
|
1458
|
+
convert.rgb.hsl = function(rgb) {
|
|
1459
|
+
const r = rgb[0] / 255;
|
|
1460
|
+
const g = rgb[1] / 255;
|
|
1461
|
+
const b = rgb[2] / 255;
|
|
1462
|
+
const min = Math.min(r, g, b);
|
|
1463
|
+
const max = Math.max(r, g, b);
|
|
1464
|
+
const delta = max - min;
|
|
1465
|
+
let h;
|
|
1466
|
+
let s;
|
|
1467
|
+
if (max === min) {
|
|
1468
|
+
h = 0;
|
|
1469
|
+
} else if (r === max) {
|
|
1470
|
+
h = (g - b) / delta;
|
|
1471
|
+
} else if (g === max) {
|
|
1472
|
+
h = 2 + (b - r) / delta;
|
|
1473
|
+
} else if (b === max) {
|
|
1474
|
+
h = 4 + (r - g) / delta;
|
|
1475
|
+
}
|
|
1476
|
+
h = Math.min(h * 60, 360);
|
|
1477
|
+
if (h < 0) {
|
|
1478
|
+
h += 360;
|
|
1479
|
+
}
|
|
1480
|
+
const l = (min + max) / 2;
|
|
1481
|
+
if (max === min) {
|
|
1482
|
+
s = 0;
|
|
1483
|
+
} else if (l <= 0.5) {
|
|
1484
|
+
s = delta / (max + min);
|
|
1485
|
+
} else {
|
|
1486
|
+
s = delta / (2 - max - min);
|
|
1487
|
+
}
|
|
1488
|
+
return [h, s * 100, l * 100];
|
|
1489
|
+
};
|
|
1490
|
+
convert.rgb.hsv = function(rgb) {
|
|
1491
|
+
let rdif;
|
|
1492
|
+
let gdif;
|
|
1493
|
+
let bdif;
|
|
1494
|
+
let h;
|
|
1495
|
+
let s;
|
|
1496
|
+
const r = rgb[0] / 255;
|
|
1497
|
+
const g = rgb[1] / 255;
|
|
1498
|
+
const b = rgb[2] / 255;
|
|
1499
|
+
const v = Math.max(r, g, b);
|
|
1500
|
+
const diff = v - Math.min(r, g, b);
|
|
1501
|
+
const diffc = function(c) {
|
|
1502
|
+
return (v - c) / 6 / diff + 1 / 2;
|
|
1503
|
+
};
|
|
1504
|
+
if (diff === 0) {
|
|
1505
|
+
h = 0;
|
|
1506
|
+
s = 0;
|
|
1507
|
+
} else {
|
|
1508
|
+
s = diff / v;
|
|
1509
|
+
rdif = diffc(r);
|
|
1510
|
+
gdif = diffc(g);
|
|
1511
|
+
bdif = diffc(b);
|
|
1512
|
+
if (r === v) {
|
|
1513
|
+
h = bdif - gdif;
|
|
1514
|
+
} else if (g === v) {
|
|
1515
|
+
h = 1 / 3 + rdif - bdif;
|
|
1516
|
+
} else if (b === v) {
|
|
1517
|
+
h = 2 / 3 + gdif - rdif;
|
|
1518
|
+
}
|
|
1519
|
+
if (h < 0) {
|
|
1520
|
+
h += 1;
|
|
1521
|
+
} else if (h > 1) {
|
|
1522
|
+
h -= 1;
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
return [
|
|
1526
|
+
h * 360,
|
|
1527
|
+
s * 100,
|
|
1528
|
+
v * 100
|
|
1529
|
+
];
|
|
1530
|
+
};
|
|
1531
|
+
convert.rgb.hwb = function(rgb) {
|
|
1532
|
+
const r = rgb[0];
|
|
1533
|
+
const g = rgb[1];
|
|
1534
|
+
let b = rgb[2];
|
|
1535
|
+
const h = convert.rgb.hsl(rgb)[0];
|
|
1536
|
+
const w = 1 / 255 * Math.min(r, Math.min(g, b));
|
|
1537
|
+
b = 1 - 1 / 255 * Math.max(r, Math.max(g, b));
|
|
1538
|
+
return [h, w * 100, b * 100];
|
|
1539
|
+
};
|
|
1540
|
+
convert.rgb.cmyk = function(rgb) {
|
|
1541
|
+
const r = rgb[0] / 255;
|
|
1542
|
+
const g = rgb[1] / 255;
|
|
1543
|
+
const b = rgb[2] / 255;
|
|
1544
|
+
const k = Math.min(1 - r, 1 - g, 1 - b);
|
|
1545
|
+
const c = (1 - r - k) / (1 - k) || 0;
|
|
1546
|
+
const m = (1 - g - k) / (1 - k) || 0;
|
|
1547
|
+
const y = (1 - b - k) / (1 - k) || 0;
|
|
1548
|
+
return [c * 100, m * 100, y * 100, k * 100];
|
|
1549
|
+
};
|
|
1550
|
+
function comparativeDistance(x, y) {
|
|
1551
|
+
return (x[0] - y[0]) ** 2 + (x[1] - y[1]) ** 2 + (x[2] - y[2]) ** 2;
|
|
1552
|
+
}
|
|
1553
|
+
convert.rgb.keyword = function(rgb) {
|
|
1554
|
+
const reversed = reverseKeywords[rgb];
|
|
1555
|
+
if (reversed) {
|
|
1556
|
+
return reversed;
|
|
1557
|
+
}
|
|
1558
|
+
let currentClosestDistance = Infinity;
|
|
1559
|
+
let currentClosestKeyword;
|
|
1560
|
+
for (const keyword of Object.keys(cssKeywords)) {
|
|
1561
|
+
const value = cssKeywords[keyword];
|
|
1562
|
+
const distance = comparativeDistance(rgb, value);
|
|
1563
|
+
if (distance < currentClosestDistance) {
|
|
1564
|
+
currentClosestDistance = distance;
|
|
1565
|
+
currentClosestKeyword = keyword;
|
|
1566
|
+
}
|
|
1567
|
+
}
|
|
1568
|
+
return currentClosestKeyword;
|
|
1569
|
+
};
|
|
1570
|
+
convert.keyword.rgb = function(keyword) {
|
|
1571
|
+
return cssKeywords[keyword];
|
|
1572
|
+
};
|
|
1573
|
+
convert.rgb.xyz = function(rgb) {
|
|
1574
|
+
let r = rgb[0] / 255;
|
|
1575
|
+
let g = rgb[1] / 255;
|
|
1576
|
+
let b = rgb[2] / 255;
|
|
1577
|
+
r = r > 0.04045 ? ((r + 0.055) / 1.055) ** 2.4 : r / 12.92;
|
|
1578
|
+
g = g > 0.04045 ? ((g + 0.055) / 1.055) ** 2.4 : g / 12.92;
|
|
1579
|
+
b = b > 0.04045 ? ((b + 0.055) / 1.055) ** 2.4 : b / 12.92;
|
|
1580
|
+
const x = r * 0.4124 + g * 0.3576 + b * 0.1805;
|
|
1581
|
+
const y = r * 0.2126 + g * 0.7152 + b * 0.0722;
|
|
1582
|
+
const z = r * 0.0193 + g * 0.1192 + b * 0.9505;
|
|
1583
|
+
return [x * 100, y * 100, z * 100];
|
|
1584
|
+
};
|
|
1585
|
+
convert.rgb.lab = function(rgb) {
|
|
1586
|
+
const xyz = convert.rgb.xyz(rgb);
|
|
1587
|
+
let x = xyz[0];
|
|
1588
|
+
let y = xyz[1];
|
|
1589
|
+
let z = xyz[2];
|
|
1590
|
+
x /= 95.047;
|
|
1591
|
+
y /= 100;
|
|
1592
|
+
z /= 108.883;
|
|
1593
|
+
x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
1594
|
+
y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
1595
|
+
z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
1596
|
+
const l = 116 * y - 16;
|
|
1597
|
+
const a = 500 * (x - y);
|
|
1598
|
+
const b = 200 * (y - z);
|
|
1599
|
+
return [l, a, b];
|
|
1600
|
+
};
|
|
1601
|
+
convert.hsl.rgb = function(hsl) {
|
|
1602
|
+
const h = hsl[0] / 360;
|
|
1603
|
+
const s = hsl[1] / 100;
|
|
1604
|
+
const l = hsl[2] / 100;
|
|
1605
|
+
let t2;
|
|
1606
|
+
let t3;
|
|
1607
|
+
let val;
|
|
1608
|
+
if (s === 0) {
|
|
1609
|
+
val = l * 255;
|
|
1610
|
+
return [val, val, val];
|
|
1611
|
+
}
|
|
1612
|
+
if (l < 0.5) {
|
|
1613
|
+
t2 = l * (1 + s);
|
|
1614
|
+
} else {
|
|
1615
|
+
t2 = l + s - l * s;
|
|
1616
|
+
}
|
|
1617
|
+
const t1 = 2 * l - t2;
|
|
1618
|
+
const rgb = [0, 0, 0];
|
|
1619
|
+
for (let i = 0; i < 3; i++) {
|
|
1620
|
+
t3 = h + 1 / 3 * -(i - 1);
|
|
1621
|
+
if (t3 < 0) {
|
|
1622
|
+
t3++;
|
|
1623
|
+
}
|
|
1624
|
+
if (t3 > 1) {
|
|
1625
|
+
t3--;
|
|
1626
|
+
}
|
|
1627
|
+
if (6 * t3 < 1) {
|
|
1628
|
+
val = t1 + (t2 - t1) * 6 * t3;
|
|
1629
|
+
} else if (2 * t3 < 1) {
|
|
1630
|
+
val = t2;
|
|
1631
|
+
} else if (3 * t3 < 2) {
|
|
1632
|
+
val = t1 + (t2 - t1) * (2 / 3 - t3) * 6;
|
|
1633
|
+
} else {
|
|
1634
|
+
val = t1;
|
|
1635
|
+
}
|
|
1636
|
+
rgb[i] = val * 255;
|
|
1637
|
+
}
|
|
1638
|
+
return rgb;
|
|
1639
|
+
};
|
|
1640
|
+
convert.hsl.hsv = function(hsl) {
|
|
1641
|
+
const h = hsl[0];
|
|
1642
|
+
let s = hsl[1] / 100;
|
|
1643
|
+
let l = hsl[2] / 100;
|
|
1644
|
+
let smin = s;
|
|
1645
|
+
const lmin = Math.max(l, 0.01);
|
|
1646
|
+
l *= 2;
|
|
1647
|
+
s *= l <= 1 ? l : 2 - l;
|
|
1648
|
+
smin *= lmin <= 1 ? lmin : 2 - lmin;
|
|
1649
|
+
const v = (l + s) / 2;
|
|
1650
|
+
const sv = l === 0 ? 2 * smin / (lmin + smin) : 2 * s / (l + s);
|
|
1651
|
+
return [h, sv * 100, v * 100];
|
|
1652
|
+
};
|
|
1653
|
+
convert.hsv.rgb = function(hsv) {
|
|
1654
|
+
const h = hsv[0] / 60;
|
|
1655
|
+
const s = hsv[1] / 100;
|
|
1656
|
+
let v = hsv[2] / 100;
|
|
1657
|
+
const hi = Math.floor(h) % 6;
|
|
1658
|
+
const f = h - Math.floor(h);
|
|
1659
|
+
const p = 255 * v * (1 - s);
|
|
1660
|
+
const q = 255 * v * (1 - s * f);
|
|
1661
|
+
const t = 255 * v * (1 - s * (1 - f));
|
|
1662
|
+
v *= 255;
|
|
1663
|
+
switch (hi) {
|
|
1664
|
+
case 0:
|
|
1665
|
+
return [v, t, p];
|
|
1666
|
+
case 1:
|
|
1667
|
+
return [q, v, p];
|
|
1668
|
+
case 2:
|
|
1669
|
+
return [p, v, t];
|
|
1670
|
+
case 3:
|
|
1671
|
+
return [p, q, v];
|
|
1672
|
+
case 4:
|
|
1673
|
+
return [t, p, v];
|
|
1674
|
+
case 5:
|
|
1675
|
+
return [v, p, q];
|
|
1676
|
+
}
|
|
1677
|
+
};
|
|
1678
|
+
convert.hsv.hsl = function(hsv) {
|
|
1679
|
+
const h = hsv[0];
|
|
1680
|
+
const s = hsv[1] / 100;
|
|
1681
|
+
const v = hsv[2] / 100;
|
|
1682
|
+
const vmin = Math.max(v, 0.01);
|
|
1683
|
+
let sl;
|
|
1684
|
+
let l;
|
|
1685
|
+
l = (2 - s) * v;
|
|
1686
|
+
const lmin = (2 - s) * vmin;
|
|
1687
|
+
sl = s * vmin;
|
|
1688
|
+
sl /= lmin <= 1 ? lmin : 2 - lmin;
|
|
1689
|
+
sl = sl || 0;
|
|
1690
|
+
l /= 2;
|
|
1691
|
+
return [h, sl * 100, l * 100];
|
|
1692
|
+
};
|
|
1693
|
+
convert.hwb.rgb = function(hwb) {
|
|
1694
|
+
const h = hwb[0] / 360;
|
|
1695
|
+
let wh = hwb[1] / 100;
|
|
1696
|
+
let bl = hwb[2] / 100;
|
|
1697
|
+
const ratio = wh + bl;
|
|
1698
|
+
let f;
|
|
1699
|
+
if (ratio > 1) {
|
|
1700
|
+
wh /= ratio;
|
|
1701
|
+
bl /= ratio;
|
|
1702
|
+
}
|
|
1703
|
+
const i = Math.floor(6 * h);
|
|
1704
|
+
const v = 1 - bl;
|
|
1705
|
+
f = 6 * h - i;
|
|
1706
|
+
if ((i & 1) !== 0) {
|
|
1707
|
+
f = 1 - f;
|
|
1708
|
+
}
|
|
1709
|
+
const n = wh + f * (v - wh);
|
|
1710
|
+
let r;
|
|
1711
|
+
let g;
|
|
1712
|
+
let b;
|
|
1713
|
+
switch (i) {
|
|
1714
|
+
default:
|
|
1715
|
+
case 6:
|
|
1716
|
+
case 0:
|
|
1717
|
+
r = v;
|
|
1718
|
+
g = n;
|
|
1719
|
+
b = wh;
|
|
1720
|
+
break;
|
|
1721
|
+
case 1:
|
|
1722
|
+
r = n;
|
|
1723
|
+
g = v;
|
|
1724
|
+
b = wh;
|
|
1725
|
+
break;
|
|
1726
|
+
case 2:
|
|
1727
|
+
r = wh;
|
|
1728
|
+
g = v;
|
|
1729
|
+
b = n;
|
|
1730
|
+
break;
|
|
1731
|
+
case 3:
|
|
1732
|
+
r = wh;
|
|
1733
|
+
g = n;
|
|
1734
|
+
b = v;
|
|
1735
|
+
break;
|
|
1736
|
+
case 4:
|
|
1737
|
+
r = n;
|
|
1738
|
+
g = wh;
|
|
1739
|
+
b = v;
|
|
1740
|
+
break;
|
|
1741
|
+
case 5:
|
|
1742
|
+
r = v;
|
|
1743
|
+
g = wh;
|
|
1744
|
+
b = n;
|
|
1745
|
+
break;
|
|
1746
|
+
}
|
|
1747
|
+
return [r * 255, g * 255, b * 255];
|
|
1748
|
+
};
|
|
1749
|
+
convert.cmyk.rgb = function(cmyk) {
|
|
1750
|
+
const c = cmyk[0] / 100;
|
|
1751
|
+
const m = cmyk[1] / 100;
|
|
1752
|
+
const y = cmyk[2] / 100;
|
|
1753
|
+
const k = cmyk[3] / 100;
|
|
1754
|
+
const r = 1 - Math.min(1, c * (1 - k) + k);
|
|
1755
|
+
const g = 1 - Math.min(1, m * (1 - k) + k);
|
|
1756
|
+
const b = 1 - Math.min(1, y * (1 - k) + k);
|
|
1757
|
+
return [r * 255, g * 255, b * 255];
|
|
1758
|
+
};
|
|
1759
|
+
convert.xyz.rgb = function(xyz) {
|
|
1760
|
+
const x = xyz[0] / 100;
|
|
1761
|
+
const y = xyz[1] / 100;
|
|
1762
|
+
const z = xyz[2] / 100;
|
|
1763
|
+
let r;
|
|
1764
|
+
let g;
|
|
1765
|
+
let b;
|
|
1766
|
+
r = x * 3.2406 + y * -1.5372 + z * -0.4986;
|
|
1767
|
+
g = x * -0.9689 + y * 1.8758 + z * 0.0415;
|
|
1768
|
+
b = x * 0.0557 + y * -0.204 + z * 1.057;
|
|
1769
|
+
r = r > 31308e-7 ? 1.055 * r ** (1 / 2.4) - 0.055 : r * 12.92;
|
|
1770
|
+
g = g > 31308e-7 ? 1.055 * g ** (1 / 2.4) - 0.055 : g * 12.92;
|
|
1771
|
+
b = b > 31308e-7 ? 1.055 * b ** (1 / 2.4) - 0.055 : b * 12.92;
|
|
1772
|
+
r = Math.min(Math.max(0, r), 1);
|
|
1773
|
+
g = Math.min(Math.max(0, g), 1);
|
|
1774
|
+
b = Math.min(Math.max(0, b), 1);
|
|
1775
|
+
return [r * 255, g * 255, b * 255];
|
|
1776
|
+
};
|
|
1777
|
+
convert.xyz.lab = function(xyz) {
|
|
1778
|
+
let x = xyz[0];
|
|
1779
|
+
let y = xyz[1];
|
|
1780
|
+
let z = xyz[2];
|
|
1781
|
+
x /= 95.047;
|
|
1782
|
+
y /= 100;
|
|
1783
|
+
z /= 108.883;
|
|
1784
|
+
x = x > 8856e-6 ? x ** (1 / 3) : 7.787 * x + 16 / 116;
|
|
1785
|
+
y = y > 8856e-6 ? y ** (1 / 3) : 7.787 * y + 16 / 116;
|
|
1786
|
+
z = z > 8856e-6 ? z ** (1 / 3) : 7.787 * z + 16 / 116;
|
|
1787
|
+
const l = 116 * y - 16;
|
|
1788
|
+
const a = 500 * (x - y);
|
|
1789
|
+
const b = 200 * (y - z);
|
|
1790
|
+
return [l, a, b];
|
|
1791
|
+
};
|
|
1792
|
+
convert.lab.xyz = function(lab) {
|
|
1793
|
+
const l = lab[0];
|
|
1794
|
+
const a = lab[1];
|
|
1795
|
+
const b = lab[2];
|
|
1796
|
+
let x;
|
|
1797
|
+
let y;
|
|
1798
|
+
let z;
|
|
1799
|
+
y = (l + 16) / 116;
|
|
1800
|
+
x = a / 500 + y;
|
|
1801
|
+
z = y - b / 200;
|
|
1802
|
+
const y2 = y ** 3;
|
|
1803
|
+
const x2 = x ** 3;
|
|
1804
|
+
const z2 = z ** 3;
|
|
1805
|
+
y = y2 > 8856e-6 ? y2 : (y - 16 / 116) / 7.787;
|
|
1806
|
+
x = x2 > 8856e-6 ? x2 : (x - 16 / 116) / 7.787;
|
|
1807
|
+
z = z2 > 8856e-6 ? z2 : (z - 16 / 116) / 7.787;
|
|
1808
|
+
x *= 95.047;
|
|
1809
|
+
y *= 100;
|
|
1810
|
+
z *= 108.883;
|
|
1811
|
+
return [x, y, z];
|
|
1812
|
+
};
|
|
1813
|
+
convert.lab.lch = function(lab) {
|
|
1814
|
+
const l = lab[0];
|
|
1815
|
+
const a = lab[1];
|
|
1816
|
+
const b = lab[2];
|
|
1817
|
+
let h;
|
|
1818
|
+
const hr = Math.atan2(b, a);
|
|
1819
|
+
h = hr * 360 / 2 / Math.PI;
|
|
1820
|
+
if (h < 0) {
|
|
1821
|
+
h += 360;
|
|
1822
|
+
}
|
|
1823
|
+
const c = Math.sqrt(a * a + b * b);
|
|
1824
|
+
return [l, c, h];
|
|
1825
|
+
};
|
|
1826
|
+
convert.lch.lab = function(lch) {
|
|
1827
|
+
const l = lch[0];
|
|
1828
|
+
const c = lch[1];
|
|
1829
|
+
const h = lch[2];
|
|
1830
|
+
const hr = h / 360 * 2 * Math.PI;
|
|
1831
|
+
const a = c * Math.cos(hr);
|
|
1832
|
+
const b = c * Math.sin(hr);
|
|
1833
|
+
return [l, a, b];
|
|
1834
|
+
};
|
|
1835
|
+
convert.rgb.ansi16 = function(args, saturation = null) {
|
|
1836
|
+
const [r, g, b] = args;
|
|
1837
|
+
let value = saturation === null ? convert.rgb.hsv(args)[2] : saturation;
|
|
1838
|
+
value = Math.round(value / 50);
|
|
1839
|
+
if (value === 0) {
|
|
1840
|
+
return 30;
|
|
1841
|
+
}
|
|
1842
|
+
let ansi = 30 + (Math.round(b / 255) << 2 | Math.round(g / 255) << 1 | Math.round(r / 255));
|
|
1843
|
+
if (value === 2) {
|
|
1844
|
+
ansi += 60;
|
|
1845
|
+
}
|
|
1846
|
+
return ansi;
|
|
1847
|
+
};
|
|
1848
|
+
convert.hsv.ansi16 = function(args) {
|
|
1849
|
+
return convert.rgb.ansi16(convert.hsv.rgb(args), args[2]);
|
|
1850
|
+
};
|
|
1851
|
+
convert.rgb.ansi256 = function(args) {
|
|
1852
|
+
const r = args[0];
|
|
1853
|
+
const g = args[1];
|
|
1854
|
+
const b = args[2];
|
|
1855
|
+
if (r === g && g === b) {
|
|
1856
|
+
if (r < 8) {
|
|
1857
|
+
return 16;
|
|
1858
|
+
}
|
|
1859
|
+
if (r > 248) {
|
|
1860
|
+
return 231;
|
|
1861
|
+
}
|
|
1862
|
+
return Math.round((r - 8) / 247 * 24) + 232;
|
|
1863
|
+
}
|
|
1864
|
+
const ansi = 16 + 36 * Math.round(r / 255 * 5) + 6 * Math.round(g / 255 * 5) + Math.round(b / 255 * 5);
|
|
1865
|
+
return ansi;
|
|
1866
|
+
};
|
|
1867
|
+
convert.ansi16.rgb = function(args) {
|
|
1868
|
+
let color = args % 10;
|
|
1869
|
+
if (color === 0 || color === 7) {
|
|
1870
|
+
if (args > 50) {
|
|
1871
|
+
color += 3.5;
|
|
1872
|
+
}
|
|
1873
|
+
color = color / 10.5 * 255;
|
|
1874
|
+
return [color, color, color];
|
|
1875
|
+
}
|
|
1876
|
+
const mult = (~~(args > 50) + 1) * 0.5;
|
|
1877
|
+
const r = (color & 1) * mult * 255;
|
|
1878
|
+
const g = (color >> 1 & 1) * mult * 255;
|
|
1879
|
+
const b = (color >> 2 & 1) * mult * 255;
|
|
1880
|
+
return [r, g, b];
|
|
1881
|
+
};
|
|
1882
|
+
convert.ansi256.rgb = function(args) {
|
|
1883
|
+
if (args >= 232) {
|
|
1884
|
+
const c = (args - 232) * 10 + 8;
|
|
1885
|
+
return [c, c, c];
|
|
1886
|
+
}
|
|
1887
|
+
args -= 16;
|
|
1888
|
+
let rem;
|
|
1889
|
+
const r = Math.floor(args / 36) / 5 * 255;
|
|
1890
|
+
const g = Math.floor((rem = args % 36) / 6) / 5 * 255;
|
|
1891
|
+
const b = rem % 6 / 5 * 255;
|
|
1892
|
+
return [r, g, b];
|
|
1893
|
+
};
|
|
1894
|
+
convert.rgb.hex = function(args) {
|
|
1895
|
+
const integer = ((Math.round(args[0]) & 255) << 16) + ((Math.round(args[1]) & 255) << 8) + (Math.round(args[2]) & 255);
|
|
1896
|
+
const string = integer.toString(16).toUpperCase();
|
|
1897
|
+
return "000000".substring(string.length) + string;
|
|
1898
|
+
};
|
|
1899
|
+
convert.hex.rgb = function(args) {
|
|
1900
|
+
const match = args.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);
|
|
1901
|
+
if (!match) {
|
|
1902
|
+
return [0, 0, 0];
|
|
1903
|
+
}
|
|
1904
|
+
let colorString = match[0];
|
|
1905
|
+
if (match[0].length === 3) {
|
|
1906
|
+
colorString = colorString.split("").map((char) => {
|
|
1907
|
+
return char + char;
|
|
1908
|
+
}).join("");
|
|
1909
|
+
}
|
|
1910
|
+
const integer = parseInt(colorString, 16);
|
|
1911
|
+
const r = integer >> 16 & 255;
|
|
1912
|
+
const g = integer >> 8 & 255;
|
|
1913
|
+
const b = integer & 255;
|
|
1914
|
+
return [r, g, b];
|
|
1915
|
+
};
|
|
1916
|
+
convert.rgb.hcg = function(rgb) {
|
|
1917
|
+
const r = rgb[0] / 255;
|
|
1918
|
+
const g = rgb[1] / 255;
|
|
1919
|
+
const b = rgb[2] / 255;
|
|
1920
|
+
const max = Math.max(Math.max(r, g), b);
|
|
1921
|
+
const min = Math.min(Math.min(r, g), b);
|
|
1922
|
+
const chroma = max - min;
|
|
1923
|
+
let grayscale;
|
|
1924
|
+
let hue;
|
|
1925
|
+
if (chroma < 1) {
|
|
1926
|
+
grayscale = min / (1 - chroma);
|
|
1927
|
+
} else {
|
|
1928
|
+
grayscale = 0;
|
|
1929
|
+
}
|
|
1930
|
+
if (chroma <= 0) {
|
|
1931
|
+
hue = 0;
|
|
1932
|
+
} else if (max === r) {
|
|
1933
|
+
hue = (g - b) / chroma % 6;
|
|
1934
|
+
} else if (max === g) {
|
|
1935
|
+
hue = 2 + (b - r) / chroma;
|
|
1936
|
+
} else {
|
|
1937
|
+
hue = 4 + (r - g) / chroma;
|
|
1938
|
+
}
|
|
1939
|
+
hue /= 6;
|
|
1940
|
+
hue %= 1;
|
|
1941
|
+
return [hue * 360, chroma * 100, grayscale * 100];
|
|
1942
|
+
};
|
|
1943
|
+
convert.hsl.hcg = function(hsl) {
|
|
1944
|
+
const s = hsl[1] / 100;
|
|
1945
|
+
const l = hsl[2] / 100;
|
|
1946
|
+
const c = l < 0.5 ? 2 * s * l : 2 * s * (1 - l);
|
|
1947
|
+
let f = 0;
|
|
1948
|
+
if (c < 1) {
|
|
1949
|
+
f = (l - 0.5 * c) / (1 - c);
|
|
1950
|
+
}
|
|
1951
|
+
return [hsl[0], c * 100, f * 100];
|
|
1952
|
+
};
|
|
1953
|
+
convert.hsv.hcg = function(hsv) {
|
|
1954
|
+
const s = hsv[1] / 100;
|
|
1955
|
+
const v = hsv[2] / 100;
|
|
1956
|
+
const c = s * v;
|
|
1957
|
+
let f = 0;
|
|
1958
|
+
if (c < 1) {
|
|
1959
|
+
f = (v - c) / (1 - c);
|
|
1960
|
+
}
|
|
1961
|
+
return [hsv[0], c * 100, f * 100];
|
|
1962
|
+
};
|
|
1963
|
+
convert.hcg.rgb = function(hcg) {
|
|
1964
|
+
const h = hcg[0] / 360;
|
|
1965
|
+
const c = hcg[1] / 100;
|
|
1966
|
+
const g = hcg[2] / 100;
|
|
1967
|
+
if (c === 0) {
|
|
1968
|
+
return [g * 255, g * 255, g * 255];
|
|
1969
|
+
}
|
|
1970
|
+
const pure = [0, 0, 0];
|
|
1971
|
+
const hi = h % 1 * 6;
|
|
1972
|
+
const v = hi % 1;
|
|
1973
|
+
const w = 1 - v;
|
|
1974
|
+
let mg = 0;
|
|
1975
|
+
switch (Math.floor(hi)) {
|
|
1976
|
+
case 0:
|
|
1977
|
+
pure[0] = 1;
|
|
1978
|
+
pure[1] = v;
|
|
1979
|
+
pure[2] = 0;
|
|
1980
|
+
break;
|
|
1981
|
+
case 1:
|
|
1982
|
+
pure[0] = w;
|
|
1983
|
+
pure[1] = 1;
|
|
1984
|
+
pure[2] = 0;
|
|
1985
|
+
break;
|
|
1986
|
+
case 2:
|
|
1987
|
+
pure[0] = 0;
|
|
1988
|
+
pure[1] = 1;
|
|
1989
|
+
pure[2] = v;
|
|
1990
|
+
break;
|
|
1991
|
+
case 3:
|
|
1992
|
+
pure[0] = 0;
|
|
1993
|
+
pure[1] = w;
|
|
1994
|
+
pure[2] = 1;
|
|
1995
|
+
break;
|
|
1996
|
+
case 4:
|
|
1997
|
+
pure[0] = v;
|
|
1998
|
+
pure[1] = 0;
|
|
1999
|
+
pure[2] = 1;
|
|
2000
|
+
break;
|
|
2001
|
+
default:
|
|
2002
|
+
pure[0] = 1;
|
|
2003
|
+
pure[1] = 0;
|
|
2004
|
+
pure[2] = w;
|
|
2005
|
+
}
|
|
2006
|
+
mg = (1 - c) * g;
|
|
2007
|
+
return [
|
|
2008
|
+
(c * pure[0] + mg) * 255,
|
|
2009
|
+
(c * pure[1] + mg) * 255,
|
|
2010
|
+
(c * pure[2] + mg) * 255
|
|
2011
|
+
];
|
|
2012
|
+
};
|
|
2013
|
+
convert.hcg.hsv = function(hcg) {
|
|
2014
|
+
const c = hcg[1] / 100;
|
|
2015
|
+
const g = hcg[2] / 100;
|
|
2016
|
+
const v = c + g * (1 - c);
|
|
2017
|
+
let f = 0;
|
|
2018
|
+
if (v > 0) {
|
|
2019
|
+
f = c / v;
|
|
2020
|
+
}
|
|
2021
|
+
return [hcg[0], f * 100, v * 100];
|
|
2022
|
+
};
|
|
2023
|
+
convert.hcg.hsl = function(hcg) {
|
|
2024
|
+
const c = hcg[1] / 100;
|
|
2025
|
+
const g = hcg[2] / 100;
|
|
2026
|
+
const l = g * (1 - c) + 0.5 * c;
|
|
2027
|
+
let s = 0;
|
|
2028
|
+
if (l > 0 && l < 0.5) {
|
|
2029
|
+
s = c / (2 * l);
|
|
2030
|
+
} else if (l >= 0.5 && l < 1) {
|
|
2031
|
+
s = c / (2 * (1 - l));
|
|
2032
|
+
}
|
|
2033
|
+
return [hcg[0], s * 100, l * 100];
|
|
2034
|
+
};
|
|
2035
|
+
convert.hcg.hwb = function(hcg) {
|
|
2036
|
+
const c = hcg[1] / 100;
|
|
2037
|
+
const g = hcg[2] / 100;
|
|
2038
|
+
const v = c + g * (1 - c);
|
|
2039
|
+
return [hcg[0], (v - c) * 100, (1 - v) * 100];
|
|
2040
|
+
};
|
|
2041
|
+
convert.hwb.hcg = function(hwb) {
|
|
2042
|
+
const w = hwb[1] / 100;
|
|
2043
|
+
const b = hwb[2] / 100;
|
|
2044
|
+
const v = 1 - b;
|
|
2045
|
+
const c = v - w;
|
|
2046
|
+
let g = 0;
|
|
2047
|
+
if (c < 1) {
|
|
2048
|
+
g = (v - c) / (1 - c);
|
|
2049
|
+
}
|
|
2050
|
+
return [hwb[0], c * 100, g * 100];
|
|
2051
|
+
};
|
|
2052
|
+
convert.apple.rgb = function(apple) {
|
|
2053
|
+
return [apple[0] / 65535 * 255, apple[1] / 65535 * 255, apple[2] / 65535 * 255];
|
|
2054
|
+
};
|
|
2055
|
+
convert.rgb.apple = function(rgb) {
|
|
2056
|
+
return [rgb[0] / 255 * 65535, rgb[1] / 255 * 65535, rgb[2] / 255 * 65535];
|
|
2057
|
+
};
|
|
2058
|
+
convert.gray.rgb = function(args) {
|
|
2059
|
+
return [args[0] / 100 * 255, args[0] / 100 * 255, args[0] / 100 * 255];
|
|
2060
|
+
};
|
|
2061
|
+
convert.gray.hsl = function(args) {
|
|
2062
|
+
return [0, 0, args[0]];
|
|
2063
|
+
};
|
|
2064
|
+
convert.gray.hsv = convert.gray.hsl;
|
|
2065
|
+
convert.gray.hwb = function(gray) {
|
|
2066
|
+
return [0, 100, gray[0]];
|
|
2067
|
+
};
|
|
2068
|
+
convert.gray.cmyk = function(gray) {
|
|
2069
|
+
return [0, 0, 0, gray[0]];
|
|
2070
|
+
};
|
|
2071
|
+
convert.gray.lab = function(gray) {
|
|
2072
|
+
return [gray[0], 0, 0];
|
|
2073
|
+
};
|
|
2074
|
+
convert.gray.hex = function(gray) {
|
|
2075
|
+
const val = Math.round(gray[0] / 100 * 255) & 255;
|
|
2076
|
+
const integer = (val << 16) + (val << 8) + val;
|
|
2077
|
+
const string = integer.toString(16).toUpperCase();
|
|
2078
|
+
return "000000".substring(string.length) + string;
|
|
2079
|
+
};
|
|
2080
|
+
convert.rgb.gray = function(rgb) {
|
|
2081
|
+
const val = (rgb[0] + rgb[1] + rgb[2]) / 3;
|
|
2082
|
+
return [val / 255 * 100];
|
|
2083
|
+
};
|
|
2084
|
+
}
|
|
2085
|
+
});
|
|
2086
|
+
|
|
2087
|
+
// ../../node_modules/color-convert/route.js
|
|
2088
|
+
var require_route = __commonJS({
|
|
2089
|
+
"../../node_modules/color-convert/route.js"(exports, module2) {
|
|
2090
|
+
var conversions = require_conversions();
|
|
2091
|
+
function buildGraph() {
|
|
2092
|
+
const graph = {};
|
|
2093
|
+
const models = Object.keys(conversions);
|
|
2094
|
+
for (let len = models.length, i = 0; i < len; i++) {
|
|
2095
|
+
graph[models[i]] = {
|
|
2096
|
+
distance: -1,
|
|
2097
|
+
parent: null
|
|
2098
|
+
};
|
|
2099
|
+
}
|
|
2100
|
+
return graph;
|
|
2101
|
+
}
|
|
2102
|
+
function deriveBFS(fromModel) {
|
|
2103
|
+
const graph = buildGraph();
|
|
2104
|
+
const queue = [fromModel];
|
|
2105
|
+
graph[fromModel].distance = 0;
|
|
2106
|
+
while (queue.length) {
|
|
2107
|
+
const current = queue.pop();
|
|
2108
|
+
const adjacents = Object.keys(conversions[current]);
|
|
2109
|
+
for (let len = adjacents.length, i = 0; i < len; i++) {
|
|
2110
|
+
const adjacent = adjacents[i];
|
|
2111
|
+
const node = graph[adjacent];
|
|
2112
|
+
if (node.distance === -1) {
|
|
2113
|
+
node.distance = graph[current].distance + 1;
|
|
2114
|
+
node.parent = current;
|
|
2115
|
+
queue.unshift(adjacent);
|
|
2116
|
+
}
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
return graph;
|
|
2120
|
+
}
|
|
2121
|
+
function link(from, to) {
|
|
2122
|
+
return function(args) {
|
|
2123
|
+
return to(from(args));
|
|
2124
|
+
};
|
|
2125
|
+
}
|
|
2126
|
+
function wrapConversion(toModel, graph) {
|
|
2127
|
+
const path = [graph[toModel].parent, toModel];
|
|
2128
|
+
let fn = conversions[graph[toModel].parent][toModel];
|
|
2129
|
+
let cur = graph[toModel].parent;
|
|
2130
|
+
while (graph[cur].parent) {
|
|
2131
|
+
path.unshift(graph[cur].parent);
|
|
2132
|
+
fn = link(conversions[graph[cur].parent][cur], fn);
|
|
2133
|
+
cur = graph[cur].parent;
|
|
2134
|
+
}
|
|
2135
|
+
fn.conversion = path;
|
|
2136
|
+
return fn;
|
|
2137
|
+
}
|
|
2138
|
+
module2.exports = function(fromModel) {
|
|
2139
|
+
const graph = deriveBFS(fromModel);
|
|
2140
|
+
const conversion = {};
|
|
2141
|
+
const models = Object.keys(graph);
|
|
2142
|
+
for (let len = models.length, i = 0; i < len; i++) {
|
|
2143
|
+
const toModel = models[i];
|
|
2144
|
+
const node = graph[toModel];
|
|
2145
|
+
if (node.parent === null) {
|
|
2146
|
+
continue;
|
|
2147
|
+
}
|
|
2148
|
+
conversion[toModel] = wrapConversion(toModel, graph);
|
|
2149
|
+
}
|
|
2150
|
+
return conversion;
|
|
2151
|
+
};
|
|
2152
|
+
}
|
|
2153
|
+
});
|
|
2154
|
+
|
|
2155
|
+
// ../../node_modules/color-convert/index.js
|
|
2156
|
+
var require_color_convert = __commonJS({
|
|
2157
|
+
"../../node_modules/color-convert/index.js"(exports, module2) {
|
|
2158
|
+
var conversions = require_conversions();
|
|
2159
|
+
var route = require_route();
|
|
2160
|
+
var convert = {};
|
|
2161
|
+
var models = Object.keys(conversions);
|
|
2162
|
+
function wrapRaw(fn) {
|
|
2163
|
+
const wrappedFn = function(...args) {
|
|
2164
|
+
const arg0 = args[0];
|
|
2165
|
+
if (arg0 === void 0 || arg0 === null) {
|
|
2166
|
+
return arg0;
|
|
2167
|
+
}
|
|
2168
|
+
if (arg0.length > 1) {
|
|
2169
|
+
args = arg0;
|
|
2170
|
+
}
|
|
2171
|
+
return fn(args);
|
|
2172
|
+
};
|
|
2173
|
+
if ("conversion" in fn) {
|
|
2174
|
+
wrappedFn.conversion = fn.conversion;
|
|
2175
|
+
}
|
|
2176
|
+
return wrappedFn;
|
|
2177
|
+
}
|
|
2178
|
+
function wrapRounded(fn) {
|
|
2179
|
+
const wrappedFn = function(...args) {
|
|
2180
|
+
const arg0 = args[0];
|
|
2181
|
+
if (arg0 === void 0 || arg0 === null) {
|
|
2182
|
+
return arg0;
|
|
2183
|
+
}
|
|
2184
|
+
if (arg0.length > 1) {
|
|
2185
|
+
args = arg0;
|
|
2186
|
+
}
|
|
2187
|
+
const result = fn(args);
|
|
2188
|
+
if (typeof result === "object") {
|
|
2189
|
+
for (let len = result.length, i = 0; i < len; i++) {
|
|
2190
|
+
result[i] = Math.round(result[i]);
|
|
2191
|
+
}
|
|
2192
|
+
}
|
|
2193
|
+
return result;
|
|
2194
|
+
};
|
|
2195
|
+
if ("conversion" in fn) {
|
|
2196
|
+
wrappedFn.conversion = fn.conversion;
|
|
2197
|
+
}
|
|
2198
|
+
return wrappedFn;
|
|
2199
|
+
}
|
|
2200
|
+
models.forEach((fromModel) => {
|
|
2201
|
+
convert[fromModel] = {};
|
|
2202
|
+
Object.defineProperty(convert[fromModel], "channels", { value: conversions[fromModel].channels });
|
|
2203
|
+
Object.defineProperty(convert[fromModel], "labels", { value: conversions[fromModel].labels });
|
|
2204
|
+
const routes = route(fromModel);
|
|
2205
|
+
const routeModels = Object.keys(routes);
|
|
2206
|
+
routeModels.forEach((toModel) => {
|
|
2207
|
+
const fn = routes[toModel];
|
|
2208
|
+
convert[fromModel][toModel] = wrapRounded(fn);
|
|
2209
|
+
convert[fromModel][toModel].raw = wrapRaw(fn);
|
|
2210
|
+
});
|
|
2211
|
+
});
|
|
2212
|
+
module2.exports = convert;
|
|
2213
|
+
}
|
|
2214
|
+
});
|
|
2215
|
+
|
|
2216
|
+
// ../../node_modules/ansi-styles/index.js
|
|
2217
|
+
var require_ansi_styles = __commonJS({
|
|
2218
|
+
"../../node_modules/ansi-styles/index.js"(exports, module2) {
|
|
2219
|
+
"use strict";
|
|
2220
|
+
var wrapAnsi16 = (fn, offset) => (...args) => {
|
|
2221
|
+
const code = fn(...args);
|
|
2222
|
+
return `\x1B[${code + offset}m`;
|
|
2223
|
+
};
|
|
2224
|
+
var wrapAnsi256 = (fn, offset) => (...args) => {
|
|
2225
|
+
const code = fn(...args);
|
|
2226
|
+
return `\x1B[${38 + offset};5;${code}m`;
|
|
2227
|
+
};
|
|
2228
|
+
var wrapAnsi16m = (fn, offset) => (...args) => {
|
|
2229
|
+
const rgb = fn(...args);
|
|
2230
|
+
return `\x1B[${38 + offset};2;${rgb[0]};${rgb[1]};${rgb[2]}m`;
|
|
2231
|
+
};
|
|
2232
|
+
var ansi2ansi = (n) => n;
|
|
2233
|
+
var rgb2rgb = (r, g, b) => [r, g, b];
|
|
2234
|
+
var setLazyProperty = (object, property, get) => {
|
|
2235
|
+
Object.defineProperty(object, property, {
|
|
2236
|
+
get: () => {
|
|
2237
|
+
const value = get();
|
|
2238
|
+
Object.defineProperty(object, property, {
|
|
2239
|
+
value,
|
|
2240
|
+
enumerable: true,
|
|
2241
|
+
configurable: true
|
|
2242
|
+
});
|
|
2243
|
+
return value;
|
|
2244
|
+
},
|
|
2245
|
+
enumerable: true,
|
|
2246
|
+
configurable: true
|
|
2247
|
+
});
|
|
2248
|
+
};
|
|
2249
|
+
var colorConvert;
|
|
2250
|
+
var makeDynamicStyles = (wrap, targetSpace, identity, isBackground) => {
|
|
2251
|
+
if (colorConvert === void 0) {
|
|
2252
|
+
colorConvert = require_color_convert();
|
|
2253
|
+
}
|
|
2254
|
+
const offset = isBackground ? 10 : 0;
|
|
2255
|
+
const styles = {};
|
|
2256
|
+
for (const [sourceSpace, suite] of Object.entries(colorConvert)) {
|
|
2257
|
+
const name = sourceSpace === "ansi16" ? "ansi" : sourceSpace;
|
|
2258
|
+
if (sourceSpace === targetSpace) {
|
|
2259
|
+
styles[name] = wrap(identity, offset);
|
|
2260
|
+
} else if (typeof suite === "object") {
|
|
2261
|
+
styles[name] = wrap(suite[targetSpace], offset);
|
|
2262
|
+
}
|
|
2263
|
+
}
|
|
2264
|
+
return styles;
|
|
2265
|
+
};
|
|
2266
|
+
function assembleStyles() {
|
|
2267
|
+
const codes = /* @__PURE__ */ new Map();
|
|
2268
|
+
const styles = {
|
|
2269
|
+
modifier: {
|
|
2270
|
+
reset: [0, 0],
|
|
2271
|
+
bold: [1, 22],
|
|
2272
|
+
dim: [2, 22],
|
|
2273
|
+
italic: [3, 23],
|
|
2274
|
+
underline: [4, 24],
|
|
2275
|
+
inverse: [7, 27],
|
|
2276
|
+
hidden: [8, 28],
|
|
2277
|
+
strikethrough: [9, 29]
|
|
2278
|
+
},
|
|
2279
|
+
color: {
|
|
2280
|
+
black: [30, 39],
|
|
2281
|
+
red: [31, 39],
|
|
2282
|
+
green: [32, 39],
|
|
2283
|
+
yellow: [33, 39],
|
|
2284
|
+
blue: [34, 39],
|
|
2285
|
+
magenta: [35, 39],
|
|
2286
|
+
cyan: [36, 39],
|
|
2287
|
+
white: [37, 39],
|
|
2288
|
+
blackBright: [90, 39],
|
|
2289
|
+
redBright: [91, 39],
|
|
2290
|
+
greenBright: [92, 39],
|
|
2291
|
+
yellowBright: [93, 39],
|
|
2292
|
+
blueBright: [94, 39],
|
|
2293
|
+
magentaBright: [95, 39],
|
|
2294
|
+
cyanBright: [96, 39],
|
|
2295
|
+
whiteBright: [97, 39]
|
|
2296
|
+
},
|
|
2297
|
+
bgColor: {
|
|
2298
|
+
bgBlack: [40, 49],
|
|
2299
|
+
bgRed: [41, 49],
|
|
2300
|
+
bgGreen: [42, 49],
|
|
2301
|
+
bgYellow: [43, 49],
|
|
2302
|
+
bgBlue: [44, 49],
|
|
2303
|
+
bgMagenta: [45, 49],
|
|
2304
|
+
bgCyan: [46, 49],
|
|
2305
|
+
bgWhite: [47, 49],
|
|
2306
|
+
bgBlackBright: [100, 49],
|
|
2307
|
+
bgRedBright: [101, 49],
|
|
2308
|
+
bgGreenBright: [102, 49],
|
|
2309
|
+
bgYellowBright: [103, 49],
|
|
2310
|
+
bgBlueBright: [104, 49],
|
|
2311
|
+
bgMagentaBright: [105, 49],
|
|
2312
|
+
bgCyanBright: [106, 49],
|
|
2313
|
+
bgWhiteBright: [107, 49]
|
|
2314
|
+
}
|
|
2315
|
+
};
|
|
2316
|
+
styles.color.gray = styles.color.blackBright;
|
|
2317
|
+
styles.bgColor.bgGray = styles.bgColor.bgBlackBright;
|
|
2318
|
+
styles.color.grey = styles.color.blackBright;
|
|
2319
|
+
styles.bgColor.bgGrey = styles.bgColor.bgBlackBright;
|
|
2320
|
+
for (const [groupName, group] of Object.entries(styles)) {
|
|
2321
|
+
for (const [styleName, style] of Object.entries(group)) {
|
|
2322
|
+
styles[styleName] = {
|
|
2323
|
+
open: `\x1B[${style[0]}m`,
|
|
2324
|
+
close: `\x1B[${style[1]}m`
|
|
2325
|
+
};
|
|
2326
|
+
group[styleName] = styles[styleName];
|
|
2327
|
+
codes.set(style[0], style[1]);
|
|
2328
|
+
}
|
|
2329
|
+
Object.defineProperty(styles, groupName, {
|
|
2330
|
+
value: group,
|
|
2331
|
+
enumerable: false
|
|
2332
|
+
});
|
|
2333
|
+
}
|
|
2334
|
+
Object.defineProperty(styles, "codes", {
|
|
2335
|
+
value: codes,
|
|
2336
|
+
enumerable: false
|
|
2337
|
+
});
|
|
2338
|
+
styles.color.close = "\x1B[39m";
|
|
2339
|
+
styles.bgColor.close = "\x1B[49m";
|
|
2340
|
+
setLazyProperty(styles.color, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, false));
|
|
2341
|
+
setLazyProperty(styles.color, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, false));
|
|
2342
|
+
setLazyProperty(styles.color, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, false));
|
|
2343
|
+
setLazyProperty(styles.bgColor, "ansi", () => makeDynamicStyles(wrapAnsi16, "ansi16", ansi2ansi, true));
|
|
2344
|
+
setLazyProperty(styles.bgColor, "ansi256", () => makeDynamicStyles(wrapAnsi256, "ansi256", ansi2ansi, true));
|
|
2345
|
+
setLazyProperty(styles.bgColor, "ansi16m", () => makeDynamicStyles(wrapAnsi16m, "rgb", rgb2rgb, true));
|
|
2346
|
+
return styles;
|
|
2347
|
+
}
|
|
2348
|
+
Object.defineProperty(module2, "exports", {
|
|
2349
|
+
enumerable: true,
|
|
2350
|
+
get: assembleStyles
|
|
2351
|
+
});
|
|
2352
|
+
}
|
|
2353
|
+
});
|
|
2354
|
+
|
|
2355
|
+
// ../../node_modules/wrap-ansi/index.js
|
|
2356
|
+
var require_wrap_ansi = __commonJS({
|
|
2357
|
+
"../../node_modules/wrap-ansi/index.js"(exports, module2) {
|
|
2358
|
+
"use strict";
|
|
2359
|
+
var stringWidth = require_string_width();
|
|
2360
|
+
var stripAnsi = require_strip_ansi();
|
|
2361
|
+
var ansiStyles = require_ansi_styles();
|
|
2362
|
+
var ESCAPES = /* @__PURE__ */ new Set([
|
|
2363
|
+
"\x1B",
|
|
2364
|
+
"\x9B"
|
|
2365
|
+
]);
|
|
2366
|
+
var END_CODE = 39;
|
|
2367
|
+
var ANSI_ESCAPE_BELL = "\x07";
|
|
2368
|
+
var ANSI_CSI = "[";
|
|
2369
|
+
var ANSI_OSC = "]";
|
|
2370
|
+
var ANSI_SGR_TERMINATOR = "m";
|
|
2371
|
+
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
2372
|
+
var wrapAnsi = (code) => `${ESCAPES.values().next().value}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
2373
|
+
var wrapAnsiHyperlink = (uri) => `${ESCAPES.values().next().value}${ANSI_ESCAPE_LINK}${uri}${ANSI_ESCAPE_BELL}`;
|
|
2374
|
+
var wordLengths = (string) => string.split(" ").map((character) => stringWidth(character));
|
|
2375
|
+
var wrapWord = (rows, word, columns) => {
|
|
2376
|
+
const characters = [...word];
|
|
2377
|
+
let isInsideEscape = false;
|
|
2378
|
+
let isInsideLinkEscape = false;
|
|
2379
|
+
let visible = stringWidth(stripAnsi(rows[rows.length - 1]));
|
|
2380
|
+
for (const [index, character] of characters.entries()) {
|
|
2381
|
+
const characterLength = stringWidth(character);
|
|
2382
|
+
if (visible + characterLength <= columns) {
|
|
2383
|
+
rows[rows.length - 1] += character;
|
|
2384
|
+
} else {
|
|
2385
|
+
rows.push(character);
|
|
2386
|
+
visible = 0;
|
|
2387
|
+
}
|
|
2388
|
+
if (ESCAPES.has(character)) {
|
|
2389
|
+
isInsideEscape = true;
|
|
2390
|
+
isInsideLinkEscape = characters.slice(index + 1).join("").startsWith(ANSI_ESCAPE_LINK);
|
|
2391
|
+
}
|
|
2392
|
+
if (isInsideEscape) {
|
|
2393
|
+
if (isInsideLinkEscape) {
|
|
2394
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
2395
|
+
isInsideEscape = false;
|
|
2396
|
+
isInsideLinkEscape = false;
|
|
2397
|
+
}
|
|
2398
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
2399
|
+
isInsideEscape = false;
|
|
2400
|
+
}
|
|
2401
|
+
continue;
|
|
2402
|
+
}
|
|
2403
|
+
visible += characterLength;
|
|
2404
|
+
if (visible === columns && index < characters.length - 1) {
|
|
2405
|
+
rows.push("");
|
|
2406
|
+
visible = 0;
|
|
2407
|
+
}
|
|
2408
|
+
}
|
|
2409
|
+
if (!visible && rows[rows.length - 1].length > 0 && rows.length > 1) {
|
|
2410
|
+
rows[rows.length - 2] += rows.pop();
|
|
2411
|
+
}
|
|
2412
|
+
};
|
|
2413
|
+
var stringVisibleTrimSpacesRight = (string) => {
|
|
2414
|
+
const words = string.split(" ");
|
|
2415
|
+
let last = words.length;
|
|
2416
|
+
while (last > 0) {
|
|
2417
|
+
if (stringWidth(words[last - 1]) > 0) {
|
|
2418
|
+
break;
|
|
2419
|
+
}
|
|
2420
|
+
last--;
|
|
2421
|
+
}
|
|
2422
|
+
if (last === words.length) {
|
|
2423
|
+
return string;
|
|
2424
|
+
}
|
|
2425
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
2426
|
+
};
|
|
2427
|
+
var exec = (string, columns, options = {}) => {
|
|
2428
|
+
if (options.trim !== false && string.trim() === "") {
|
|
2429
|
+
return "";
|
|
2430
|
+
}
|
|
2431
|
+
let returnValue = "";
|
|
2432
|
+
let escapeCode;
|
|
2433
|
+
let escapeUrl;
|
|
2434
|
+
const lengths = wordLengths(string);
|
|
2435
|
+
let rows = [""];
|
|
2436
|
+
for (const [index, word] of string.split(" ").entries()) {
|
|
2437
|
+
if (options.trim !== false) {
|
|
2438
|
+
rows[rows.length - 1] = rows[rows.length - 1].trimStart();
|
|
2439
|
+
}
|
|
2440
|
+
let rowLength = stringWidth(rows[rows.length - 1]);
|
|
2441
|
+
if (index !== 0) {
|
|
2442
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
2443
|
+
rows.push("");
|
|
2444
|
+
rowLength = 0;
|
|
2445
|
+
}
|
|
2446
|
+
if (rowLength > 0 || options.trim === false) {
|
|
2447
|
+
rows[rows.length - 1] += " ";
|
|
2448
|
+
rowLength++;
|
|
2449
|
+
}
|
|
2450
|
+
}
|
|
2451
|
+
if (options.hard && lengths[index] > columns) {
|
|
2452
|
+
const remainingColumns = columns - rowLength;
|
|
2453
|
+
const breaksStartingThisLine = 1 + Math.floor((lengths[index] - remainingColumns - 1) / columns);
|
|
2454
|
+
const breaksStartingNextLine = Math.floor((lengths[index] - 1) / columns);
|
|
2455
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
2456
|
+
rows.push("");
|
|
2457
|
+
}
|
|
2458
|
+
wrapWord(rows, word, columns);
|
|
2459
|
+
continue;
|
|
2460
|
+
}
|
|
2461
|
+
if (rowLength + lengths[index] > columns && rowLength > 0 && lengths[index] > 0) {
|
|
2462
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
2463
|
+
wrapWord(rows, word, columns);
|
|
2464
|
+
continue;
|
|
2465
|
+
}
|
|
2466
|
+
rows.push("");
|
|
2467
|
+
}
|
|
2468
|
+
if (rowLength + lengths[index] > columns && options.wordWrap === false) {
|
|
2469
|
+
wrapWord(rows, word, columns);
|
|
2470
|
+
continue;
|
|
2471
|
+
}
|
|
2472
|
+
rows[rows.length - 1] += word;
|
|
2473
|
+
}
|
|
2474
|
+
if (options.trim !== false) {
|
|
2475
|
+
rows = rows.map(stringVisibleTrimSpacesRight);
|
|
2476
|
+
}
|
|
2477
|
+
const pre = [...rows.join("\n")];
|
|
2478
|
+
for (const [index, character] of pre.entries()) {
|
|
2479
|
+
returnValue += character;
|
|
2480
|
+
if (ESCAPES.has(character)) {
|
|
2481
|
+
const { groups } = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`).exec(pre.slice(index).join("")) || { groups: {} };
|
|
2482
|
+
if (groups.code !== void 0) {
|
|
2483
|
+
const code2 = Number.parseFloat(groups.code);
|
|
2484
|
+
escapeCode = code2 === END_CODE ? void 0 : code2;
|
|
2485
|
+
} else if (groups.uri !== void 0) {
|
|
2486
|
+
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
2487
|
+
}
|
|
2488
|
+
}
|
|
2489
|
+
const code = ansiStyles.codes.get(Number(escapeCode));
|
|
2490
|
+
if (pre[index + 1] === "\n") {
|
|
2491
|
+
if (escapeUrl) {
|
|
2492
|
+
returnValue += wrapAnsiHyperlink("");
|
|
2493
|
+
}
|
|
2494
|
+
if (escapeCode && code) {
|
|
2495
|
+
returnValue += wrapAnsi(code);
|
|
2496
|
+
}
|
|
2497
|
+
} else if (character === "\n") {
|
|
2498
|
+
if (escapeCode && code) {
|
|
2499
|
+
returnValue += wrapAnsi(escapeCode);
|
|
2500
|
+
}
|
|
2501
|
+
if (escapeUrl) {
|
|
2502
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
2503
|
+
}
|
|
2504
|
+
}
|
|
2505
|
+
}
|
|
2506
|
+
return returnValue;
|
|
2507
|
+
};
|
|
2508
|
+
module2.exports = (string, columns, options) => {
|
|
2509
|
+
return String(string).normalize().replace(/\r\n/g, "\n").split("\n").map((line) => exec(line, columns, options)).join("\n");
|
|
2510
|
+
};
|
|
2511
|
+
}
|
|
2512
|
+
});
|
|
2513
|
+
|
|
2514
|
+
// ../../node_modules/cliui/build/index.cjs
|
|
2515
|
+
var require_build3 = __commonJS({
|
|
2516
|
+
"../../node_modules/cliui/build/index.cjs"(exports, module2) {
|
|
2517
|
+
"use strict";
|
|
2518
|
+
var align = {
|
|
2519
|
+
right: alignRight,
|
|
2520
|
+
center: alignCenter
|
|
2521
|
+
};
|
|
2522
|
+
var top = 0;
|
|
2523
|
+
var right = 1;
|
|
2524
|
+
var bottom = 2;
|
|
2525
|
+
var left = 3;
|
|
2526
|
+
var UI = class {
|
|
2527
|
+
constructor(opts) {
|
|
2528
|
+
var _a;
|
|
2529
|
+
this.width = opts.width;
|
|
2530
|
+
this.wrap = (_a = opts.wrap) !== null && _a !== void 0 ? _a : true;
|
|
2531
|
+
this.rows = [];
|
|
2532
|
+
}
|
|
2533
|
+
span(...args) {
|
|
2534
|
+
const cols = this.div(...args);
|
|
2535
|
+
cols.span = true;
|
|
2536
|
+
}
|
|
2537
|
+
resetOutput() {
|
|
2538
|
+
this.rows = [];
|
|
2539
|
+
}
|
|
2540
|
+
div(...args) {
|
|
2541
|
+
if (args.length === 0) {
|
|
2542
|
+
this.div("");
|
|
2543
|
+
}
|
|
2544
|
+
if (this.wrap && this.shouldApplyLayoutDSL(...args) && typeof args[0] === "string") {
|
|
2545
|
+
return this.applyLayoutDSL(args[0]);
|
|
2546
|
+
}
|
|
2547
|
+
const cols = args.map((arg) => {
|
|
2548
|
+
if (typeof arg === "string") {
|
|
2549
|
+
return this.colFromString(arg);
|
|
2550
|
+
}
|
|
2551
|
+
return arg;
|
|
2552
|
+
});
|
|
2553
|
+
this.rows.push(cols);
|
|
2554
|
+
return cols;
|
|
2555
|
+
}
|
|
2556
|
+
shouldApplyLayoutDSL(...args) {
|
|
2557
|
+
return args.length === 1 && typeof args[0] === "string" && /[\t\n]/.test(args[0]);
|
|
2558
|
+
}
|
|
2559
|
+
applyLayoutDSL(str) {
|
|
2560
|
+
const rows = str.split("\n").map((row) => row.split(" "));
|
|
2561
|
+
let leftColumnWidth = 0;
|
|
2562
|
+
rows.forEach((columns) => {
|
|
2563
|
+
if (columns.length > 1 && mixin.stringWidth(columns[0]) > leftColumnWidth) {
|
|
2564
|
+
leftColumnWidth = Math.min(Math.floor(this.width * 0.5), mixin.stringWidth(columns[0]));
|
|
2565
|
+
}
|
|
2566
|
+
});
|
|
2567
|
+
rows.forEach((columns) => {
|
|
2568
|
+
this.div(...columns.map((r, i) => {
|
|
2569
|
+
return {
|
|
2570
|
+
text: r.trim(),
|
|
2571
|
+
padding: this.measurePadding(r),
|
|
2572
|
+
width: i === 0 && columns.length > 1 ? leftColumnWidth : void 0
|
|
2573
|
+
};
|
|
2574
|
+
}));
|
|
2575
|
+
});
|
|
2576
|
+
return this.rows[this.rows.length - 1];
|
|
2577
|
+
}
|
|
2578
|
+
colFromString(text) {
|
|
2579
|
+
return {
|
|
2580
|
+
text,
|
|
2581
|
+
padding: this.measurePadding(text)
|
|
2582
|
+
};
|
|
2583
|
+
}
|
|
2584
|
+
measurePadding(str) {
|
|
2585
|
+
const noAnsi = mixin.stripAnsi(str);
|
|
2586
|
+
return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length];
|
|
2587
|
+
}
|
|
2588
|
+
toString() {
|
|
2589
|
+
const lines = [];
|
|
2590
|
+
this.rows.forEach((row) => {
|
|
2591
|
+
this.rowToString(row, lines);
|
|
2592
|
+
});
|
|
2593
|
+
return lines.filter((line) => !line.hidden).map((line) => line.text).join("\n");
|
|
2594
|
+
}
|
|
2595
|
+
rowToString(row, lines) {
|
|
2596
|
+
this.rasterize(row).forEach((rrow, r) => {
|
|
2597
|
+
let str = "";
|
|
2598
|
+
rrow.forEach((col, c) => {
|
|
2599
|
+
const { width } = row[c];
|
|
2600
|
+
const wrapWidth = this.negatePadding(row[c]);
|
|
2601
|
+
let ts = col;
|
|
2602
|
+
if (wrapWidth > mixin.stringWidth(col)) {
|
|
2603
|
+
ts += " ".repeat(wrapWidth - mixin.stringWidth(col));
|
|
2604
|
+
}
|
|
2605
|
+
if (row[c].align && row[c].align !== "left" && this.wrap) {
|
|
2606
|
+
const fn = align[row[c].align];
|
|
2607
|
+
ts = fn(ts, wrapWidth);
|
|
2608
|
+
if (mixin.stringWidth(ts) < wrapWidth) {
|
|
2609
|
+
ts += " ".repeat((width || 0) - mixin.stringWidth(ts) - 1);
|
|
2610
|
+
}
|
|
2611
|
+
}
|
|
2612
|
+
const padding = row[c].padding || [0, 0, 0, 0];
|
|
2613
|
+
if (padding[left]) {
|
|
2614
|
+
str += " ".repeat(padding[left]);
|
|
2615
|
+
}
|
|
2616
|
+
str += addBorder(row[c], ts, "| ");
|
|
2617
|
+
str += ts;
|
|
2618
|
+
str += addBorder(row[c], ts, " |");
|
|
2619
|
+
if (padding[right]) {
|
|
2620
|
+
str += " ".repeat(padding[right]);
|
|
2621
|
+
}
|
|
2622
|
+
if (r === 0 && lines.length > 0) {
|
|
2623
|
+
str = this.renderInline(str, lines[lines.length - 1]);
|
|
2624
|
+
}
|
|
2625
|
+
});
|
|
2626
|
+
lines.push({
|
|
2627
|
+
text: str.replace(/ +$/, ""),
|
|
2628
|
+
span: row.span
|
|
2629
|
+
});
|
|
2630
|
+
});
|
|
2631
|
+
return lines;
|
|
2632
|
+
}
|
|
2633
|
+
renderInline(source, previousLine) {
|
|
2634
|
+
const match = source.match(/^ */);
|
|
2635
|
+
const leadingWhitespace = match ? match[0].length : 0;
|
|
2636
|
+
const target = previousLine.text;
|
|
2637
|
+
const targetTextWidth = mixin.stringWidth(target.trimRight());
|
|
2638
|
+
if (!previousLine.span) {
|
|
2639
|
+
return source;
|
|
2640
|
+
}
|
|
2641
|
+
if (!this.wrap) {
|
|
2642
|
+
previousLine.hidden = true;
|
|
2643
|
+
return target + source;
|
|
2644
|
+
}
|
|
2645
|
+
if (leadingWhitespace < targetTextWidth) {
|
|
2646
|
+
return source;
|
|
2647
|
+
}
|
|
2648
|
+
previousLine.hidden = true;
|
|
2649
|
+
return target.trimRight() + " ".repeat(leadingWhitespace - targetTextWidth) + source.trimLeft();
|
|
2650
|
+
}
|
|
2651
|
+
rasterize(row) {
|
|
2652
|
+
const rrows = [];
|
|
2653
|
+
const widths = this.columnWidths(row);
|
|
2654
|
+
let wrapped;
|
|
2655
|
+
row.forEach((col, c) => {
|
|
2656
|
+
col.width = widths[c];
|
|
2657
|
+
if (this.wrap) {
|
|
2658
|
+
wrapped = mixin.wrap(col.text, this.negatePadding(col), { hard: true }).split("\n");
|
|
2659
|
+
} else {
|
|
2660
|
+
wrapped = col.text.split("\n");
|
|
2661
|
+
}
|
|
2662
|
+
if (col.border) {
|
|
2663
|
+
wrapped.unshift("." + "-".repeat(this.negatePadding(col) + 2) + ".");
|
|
2664
|
+
wrapped.push("'" + "-".repeat(this.negatePadding(col) + 2) + "'");
|
|
2665
|
+
}
|
|
2666
|
+
if (col.padding) {
|
|
2667
|
+
wrapped.unshift(...new Array(col.padding[top] || 0).fill(""));
|
|
2668
|
+
wrapped.push(...new Array(col.padding[bottom] || 0).fill(""));
|
|
2669
|
+
}
|
|
2670
|
+
wrapped.forEach((str, r) => {
|
|
2671
|
+
if (!rrows[r]) {
|
|
2672
|
+
rrows.push([]);
|
|
2673
|
+
}
|
|
2674
|
+
const rrow = rrows[r];
|
|
2675
|
+
for (let i = 0; i < c; i++) {
|
|
2676
|
+
if (rrow[i] === void 0) {
|
|
2677
|
+
rrow.push("");
|
|
2678
|
+
}
|
|
2679
|
+
}
|
|
2680
|
+
rrow.push(str);
|
|
2681
|
+
});
|
|
2682
|
+
});
|
|
2683
|
+
return rrows;
|
|
2684
|
+
}
|
|
2685
|
+
negatePadding(col) {
|
|
2686
|
+
let wrapWidth = col.width || 0;
|
|
2687
|
+
if (col.padding) {
|
|
2688
|
+
wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0);
|
|
2689
|
+
}
|
|
2690
|
+
if (col.border) {
|
|
2691
|
+
wrapWidth -= 4;
|
|
2692
|
+
}
|
|
2693
|
+
return wrapWidth;
|
|
2694
|
+
}
|
|
2695
|
+
columnWidths(row) {
|
|
2696
|
+
if (!this.wrap) {
|
|
2697
|
+
return row.map((col) => {
|
|
2698
|
+
return col.width || mixin.stringWidth(col.text);
|
|
2699
|
+
});
|
|
2700
|
+
}
|
|
2701
|
+
let unset = row.length;
|
|
2702
|
+
let remainingWidth = this.width;
|
|
2703
|
+
const widths = row.map((col) => {
|
|
2704
|
+
if (col.width) {
|
|
2705
|
+
unset--;
|
|
2706
|
+
remainingWidth -= col.width;
|
|
2707
|
+
return col.width;
|
|
2708
|
+
}
|
|
2709
|
+
return void 0;
|
|
2710
|
+
});
|
|
2711
|
+
const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0;
|
|
2712
|
+
return widths.map((w, i) => {
|
|
2713
|
+
if (w === void 0) {
|
|
2714
|
+
return Math.max(unsetWidth, _minWidth(row[i]));
|
|
2715
|
+
}
|
|
2716
|
+
return w;
|
|
2717
|
+
});
|
|
2718
|
+
}
|
|
2719
|
+
};
|
|
2720
|
+
function addBorder(col, ts, style) {
|
|
2721
|
+
if (col.border) {
|
|
2722
|
+
if (/[.']-+[.']/.test(ts)) {
|
|
2723
|
+
return "";
|
|
2724
|
+
}
|
|
2725
|
+
if (ts.trim().length !== 0) {
|
|
2726
|
+
return style;
|
|
2727
|
+
}
|
|
2728
|
+
return " ";
|
|
2729
|
+
}
|
|
2730
|
+
return "";
|
|
2731
|
+
}
|
|
2732
|
+
function _minWidth(col) {
|
|
2733
|
+
const padding = col.padding || [];
|
|
2734
|
+
const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0);
|
|
2735
|
+
if (col.border) {
|
|
2736
|
+
return minWidth + 4;
|
|
2737
|
+
}
|
|
2738
|
+
return minWidth;
|
|
2739
|
+
}
|
|
2740
|
+
function getWindowWidth() {
|
|
2741
|
+
if (typeof process === "object" && process.stdout && process.stdout.columns) {
|
|
2742
|
+
return process.stdout.columns;
|
|
2743
|
+
}
|
|
2744
|
+
return 80;
|
|
2745
|
+
}
|
|
2746
|
+
function alignRight(str, width) {
|
|
2747
|
+
str = str.trim();
|
|
2748
|
+
const strWidth = mixin.stringWidth(str);
|
|
2749
|
+
if (strWidth < width) {
|
|
2750
|
+
return " ".repeat(width - strWidth) + str;
|
|
2751
|
+
}
|
|
2752
|
+
return str;
|
|
2753
|
+
}
|
|
2754
|
+
function alignCenter(str, width) {
|
|
2755
|
+
str = str.trim();
|
|
2756
|
+
const strWidth = mixin.stringWidth(str);
|
|
2757
|
+
if (strWidth >= width) {
|
|
2758
|
+
return str;
|
|
2759
|
+
}
|
|
2760
|
+
return " ".repeat(width - strWidth >> 1) + str;
|
|
2761
|
+
}
|
|
2762
|
+
var mixin;
|
|
2763
|
+
function cliui(opts, _mixin) {
|
|
2764
|
+
mixin = _mixin;
|
|
2765
|
+
return new UI({
|
|
2766
|
+
width: (opts === null || opts === void 0 ? void 0 : opts.width) || getWindowWidth(),
|
|
2767
|
+
wrap: opts === null || opts === void 0 ? void 0 : opts.wrap
|
|
2768
|
+
});
|
|
2769
|
+
}
|
|
2770
|
+
var stringWidth = require_string_width();
|
|
2771
|
+
var stripAnsi = require_strip_ansi();
|
|
2772
|
+
var wrap = require_wrap_ansi();
|
|
2773
|
+
function ui(opts) {
|
|
2774
|
+
return cliui(opts, {
|
|
2775
|
+
stringWidth,
|
|
2776
|
+
stripAnsi,
|
|
2777
|
+
wrap
|
|
2778
|
+
});
|
|
2779
|
+
}
|
|
2780
|
+
module2.exports = ui;
|
|
2781
|
+
}
|
|
2782
|
+
});
|
|
2783
|
+
|
|
2784
|
+
// ../../node_modules/escalade/sync/index.js
|
|
2785
|
+
var require_sync = __commonJS({
|
|
2786
|
+
"../../node_modules/escalade/sync/index.js"(exports, module2) {
|
|
2787
|
+
var { dirname, resolve } = require("path");
|
|
2788
|
+
var { readdirSync, statSync } = require("fs");
|
|
2789
|
+
module2.exports = function(start, callback) {
|
|
2790
|
+
let dir = resolve(".", start);
|
|
2791
|
+
let tmp, stats = statSync(dir);
|
|
2792
|
+
if (!stats.isDirectory()) {
|
|
2793
|
+
dir = dirname(dir);
|
|
2794
|
+
}
|
|
2795
|
+
while (true) {
|
|
2796
|
+
tmp = callback(dir, readdirSync(dir));
|
|
2797
|
+
if (tmp)
|
|
2798
|
+
return resolve(dir, tmp);
|
|
2799
|
+
dir = dirname(tmp = dir);
|
|
2800
|
+
if (tmp === dir)
|
|
2801
|
+
break;
|
|
2802
|
+
}
|
|
2803
|
+
};
|
|
2804
|
+
}
|
|
2805
|
+
});
|
|
2806
|
+
|
|
2807
|
+
// ../../node_modules/get-caller-file/index.js
|
|
2808
|
+
var require_get_caller_file = __commonJS({
|
|
2809
|
+
"../../node_modules/get-caller-file/index.js"(exports, module2) {
|
|
2810
|
+
"use strict";
|
|
2811
|
+
module2.exports = function getCallerFile(position) {
|
|
2812
|
+
if (position === void 0) {
|
|
2813
|
+
position = 2;
|
|
2814
|
+
}
|
|
2815
|
+
if (position >= Error.stackTraceLimit) {
|
|
2816
|
+
throw new TypeError("getCallerFile(position) requires position be less then Error.stackTraceLimit but position was: `" + position + "` and Error.stackTraceLimit was: `" + Error.stackTraceLimit + "`");
|
|
2817
|
+
}
|
|
2818
|
+
var oldPrepareStackTrace = Error.prepareStackTrace;
|
|
2819
|
+
Error.prepareStackTrace = function(_, stack2) {
|
|
2820
|
+
return stack2;
|
|
2821
|
+
};
|
|
2822
|
+
var stack = new Error().stack;
|
|
2823
|
+
Error.prepareStackTrace = oldPrepareStackTrace;
|
|
2824
|
+
if (stack !== null && typeof stack === "object") {
|
|
2825
|
+
return stack[position] ? stack[position].getFileName() : void 0;
|
|
2826
|
+
}
|
|
2827
|
+
};
|
|
2828
|
+
}
|
|
2829
|
+
});
|
|
2830
|
+
|
|
2831
|
+
// ../../node_modules/require-directory/index.js
|
|
2832
|
+
var require_require_directory = __commonJS({
|
|
2833
|
+
"../../node_modules/require-directory/index.js"(exports, module2) {
|
|
2834
|
+
"use strict";
|
|
2835
|
+
var fs = require("fs");
|
|
2836
|
+
var join = require("path").join;
|
|
2837
|
+
var resolve = require("path").resolve;
|
|
2838
|
+
var dirname = require("path").dirname;
|
|
2839
|
+
var defaultOptions = {
|
|
2840
|
+
extensions: ["js", "json", "coffee"],
|
|
2841
|
+
recurse: true,
|
|
2842
|
+
rename: function(name) {
|
|
2843
|
+
return name;
|
|
2844
|
+
},
|
|
2845
|
+
visit: function(obj) {
|
|
2846
|
+
return obj;
|
|
2847
|
+
}
|
|
2848
|
+
};
|
|
2849
|
+
function checkFileInclusion(path, filename, options) {
|
|
2850
|
+
return new RegExp("\\.(" + options.extensions.join("|") + ")$", "i").test(filename) && !(options.include && options.include instanceof RegExp && !options.include.test(path)) && !(options.include && typeof options.include === "function" && !options.include(path, filename)) && !(options.exclude && options.exclude instanceof RegExp && options.exclude.test(path)) && !(options.exclude && typeof options.exclude === "function" && options.exclude(path, filename));
|
|
2851
|
+
}
|
|
2852
|
+
function requireDirectory(m, path, options) {
|
|
2853
|
+
var retval = {};
|
|
2854
|
+
if (path && !options && typeof path !== "string") {
|
|
2855
|
+
options = path;
|
|
2856
|
+
path = null;
|
|
2857
|
+
}
|
|
2858
|
+
options = options || {};
|
|
2859
|
+
for (var prop in defaultOptions) {
|
|
2860
|
+
if (typeof options[prop] === "undefined") {
|
|
2861
|
+
options[prop] = defaultOptions[prop];
|
|
2862
|
+
}
|
|
2863
|
+
}
|
|
2864
|
+
path = !path ? dirname(m.filename) : resolve(dirname(m.filename), path);
|
|
2865
|
+
fs.readdirSync(path).forEach(function(filename) {
|
|
2866
|
+
var joined = join(path, filename), files, key, obj;
|
|
2867
|
+
if (fs.statSync(joined).isDirectory() && options.recurse) {
|
|
2868
|
+
files = requireDirectory(m, joined, options);
|
|
2869
|
+
if (Object.keys(files).length) {
|
|
2870
|
+
retval[options.rename(filename, joined, filename)] = files;
|
|
2871
|
+
}
|
|
2872
|
+
} else {
|
|
2873
|
+
if (joined !== m.filename && checkFileInclusion(joined, filename, options)) {
|
|
2874
|
+
key = filename.substring(0, filename.lastIndexOf("."));
|
|
2875
|
+
obj = m.require(joined);
|
|
2876
|
+
retval[options.rename(key, joined, filename)] = options.visit(obj, joined, filename) || obj;
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2879
|
+
});
|
|
2880
|
+
return retval;
|
|
2881
|
+
}
|
|
2882
|
+
module2.exports = requireDirectory;
|
|
2883
|
+
module2.exports.defaults = defaultOptions;
|
|
2884
|
+
}
|
|
2885
|
+
});
|
|
2886
|
+
|
|
2887
|
+
// node_modules/yargs/build/index.cjs
|
|
2888
|
+
var require_build4 = __commonJS({
|
|
2889
|
+
"node_modules/yargs/build/index.cjs"(exports, module2) {
|
|
2890
|
+
"use strict";
|
|
2891
|
+
var t = require("assert");
|
|
2892
|
+
var e = class extends Error {
|
|
2893
|
+
constructor(t2) {
|
|
2894
|
+
super(t2 || "yargs error"), this.name = "YError", Error.captureStackTrace && Error.captureStackTrace(this, e);
|
|
2895
|
+
}
|
|
2896
|
+
};
|
|
2897
|
+
var s;
|
|
2898
|
+
var i = [];
|
|
2899
|
+
function n(t2, o2, a2, h2) {
|
|
2900
|
+
s = h2;
|
|
2901
|
+
let l2 = {};
|
|
2902
|
+
if (Object.prototype.hasOwnProperty.call(t2, "extends")) {
|
|
2903
|
+
if ("string" != typeof t2.extends)
|
|
2904
|
+
return l2;
|
|
2905
|
+
const r2 = /\.json|\..*rc$/.test(t2.extends);
|
|
2906
|
+
let h3 = null;
|
|
2907
|
+
if (r2)
|
|
2908
|
+
h3 = function(t3, e2) {
|
|
2909
|
+
return s.path.resolve(t3, e2);
|
|
2910
|
+
}(o2, t2.extends);
|
|
2911
|
+
else
|
|
2912
|
+
try {
|
|
2913
|
+
h3 = require.resolve(t2.extends);
|
|
2914
|
+
} catch (e2) {
|
|
2915
|
+
return t2;
|
|
2916
|
+
}
|
|
2917
|
+
!function(t3) {
|
|
2918
|
+
if (i.indexOf(t3) > -1)
|
|
2919
|
+
throw new e(`Circular extended configurations: '${t3}'.`);
|
|
2920
|
+
}(h3), i.push(h3), l2 = r2 ? JSON.parse(s.readFileSync(h3, "utf8")) : require(t2.extends), delete t2.extends, l2 = n(l2, s.path.dirname(h3), a2, s);
|
|
2921
|
+
}
|
|
2922
|
+
return i = [], a2 ? r(l2, t2) : Object.assign({}, l2, t2);
|
|
2923
|
+
}
|
|
2924
|
+
function r(t2, e2) {
|
|
2925
|
+
const s2 = {};
|
|
2926
|
+
function i2(t3) {
|
|
2927
|
+
return t3 && "object" == typeof t3 && !Array.isArray(t3);
|
|
2928
|
+
}
|
|
2929
|
+
Object.assign(s2, t2);
|
|
2930
|
+
for (const n2 of Object.keys(e2))
|
|
2931
|
+
i2(e2[n2]) && i2(s2[n2]) ? s2[n2] = r(t2[n2], e2[n2]) : s2[n2] = e2[n2];
|
|
2932
|
+
return s2;
|
|
2933
|
+
}
|
|
2934
|
+
function o(t2) {
|
|
2935
|
+
const e2 = t2.replace(/\s{2,}/g, " ").split(/\s+(?![^[]*]|[^<]*>)/), s2 = /\.*[\][<>]/g, i2 = e2.shift();
|
|
2936
|
+
if (!i2)
|
|
2937
|
+
throw new Error(`No command found in: ${t2}`);
|
|
2938
|
+
const n2 = { cmd: i2.replace(s2, ""), demanded: [], optional: [] };
|
|
2939
|
+
return e2.forEach((t3, i3) => {
|
|
2940
|
+
let r2 = false;
|
|
2941
|
+
t3 = t3.replace(/\s/g, ""), /\.+[\]>]/.test(t3) && i3 === e2.length - 1 && (r2 = true), /^\[/.test(t3) ? n2.optional.push({ cmd: t3.replace(s2, "").split("|"), variadic: r2 }) : n2.demanded.push({ cmd: t3.replace(s2, "").split("|"), variadic: r2 });
|
|
2942
|
+
}), n2;
|
|
2943
|
+
}
|
|
2944
|
+
var a = ["first", "second", "third", "fourth", "fifth", "sixth"];
|
|
2945
|
+
function h(t2, s2, i2) {
|
|
2946
|
+
try {
|
|
2947
|
+
let n2 = 0;
|
|
2948
|
+
const [r2, a2, h2] = "object" == typeof t2 ? [{ demanded: [], optional: [] }, t2, s2] : [o(`cmd ${t2}`), s2, i2], f2 = [].slice.call(a2);
|
|
2949
|
+
for (; f2.length && void 0 === f2[f2.length - 1]; )
|
|
2950
|
+
f2.pop();
|
|
2951
|
+
const d2 = h2 || f2.length;
|
|
2952
|
+
if (d2 < r2.demanded.length)
|
|
2953
|
+
throw new e(`Not enough arguments provided. Expected ${r2.demanded.length} but received ${f2.length}.`);
|
|
2954
|
+
const u2 = r2.demanded.length + r2.optional.length;
|
|
2955
|
+
if (d2 > u2)
|
|
2956
|
+
throw new e(`Too many arguments provided. Expected max ${u2} but received ${d2}.`);
|
|
2957
|
+
r2.demanded.forEach((t3) => {
|
|
2958
|
+
const e2 = l(f2.shift());
|
|
2959
|
+
0 === t3.cmd.filter((t4) => t4 === e2 || "*" === t4).length && c(e2, t3.cmd, n2), n2 += 1;
|
|
2960
|
+
}), r2.optional.forEach((t3) => {
|
|
2961
|
+
if (0 === f2.length)
|
|
2962
|
+
return;
|
|
2963
|
+
const e2 = l(f2.shift());
|
|
2964
|
+
0 === t3.cmd.filter((t4) => t4 === e2 || "*" === t4).length && c(e2, t3.cmd, n2), n2 += 1;
|
|
2965
|
+
});
|
|
2966
|
+
} catch (t3) {
|
|
2967
|
+
console.warn(t3.stack);
|
|
2968
|
+
}
|
|
2969
|
+
}
|
|
2970
|
+
function l(t2) {
|
|
2971
|
+
return Array.isArray(t2) ? "array" : null === t2 ? "null" : typeof t2;
|
|
2972
|
+
}
|
|
2973
|
+
function c(t2, s2, i2) {
|
|
2974
|
+
throw new e(`Invalid ${a[i2] || "manyith"} argument. Expected ${s2.join(" or ")} but received ${t2}.`);
|
|
2975
|
+
}
|
|
2976
|
+
function f(t2) {
|
|
2977
|
+
return !!t2 && !!t2.then && "function" == typeof t2.then;
|
|
2978
|
+
}
|
|
2979
|
+
function d(t2, e2, s2, i2) {
|
|
2980
|
+
s2.assert.notStrictEqual(t2, e2, i2);
|
|
2981
|
+
}
|
|
2982
|
+
function u(t2, e2) {
|
|
2983
|
+
e2.assert.strictEqual(typeof t2, "string");
|
|
2984
|
+
}
|
|
2985
|
+
function p(t2) {
|
|
2986
|
+
return Object.keys(t2);
|
|
2987
|
+
}
|
|
2988
|
+
function g(t2 = {}, e2 = () => true) {
|
|
2989
|
+
const s2 = {};
|
|
2990
|
+
return p(t2).forEach((i2) => {
|
|
2991
|
+
e2(i2, t2[i2]) && (s2[i2] = t2[i2]);
|
|
2992
|
+
}), s2;
|
|
2993
|
+
}
|
|
2994
|
+
function m() {
|
|
2995
|
+
return process.versions.electron && !process.defaultApp ? 0 : 1;
|
|
2996
|
+
}
|
|
2997
|
+
function y() {
|
|
2998
|
+
return process.argv[m()];
|
|
2999
|
+
}
|
|
3000
|
+
var b = Object.freeze({ __proto__: null, hideBin: function(t2) {
|
|
3001
|
+
return t2.slice(m() + 1);
|
|
3002
|
+
}, getProcessArgvBin: y });
|
|
3003
|
+
function v(t2, e2, s2, i2) {
|
|
3004
|
+
if ("a" === s2 && !i2)
|
|
3005
|
+
throw new TypeError("Private accessor was defined without a getter");
|
|
3006
|
+
if ("function" == typeof e2 ? t2 !== e2 || !i2 : !e2.has(t2))
|
|
3007
|
+
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
3008
|
+
return "m" === s2 ? i2 : "a" === s2 ? i2.call(t2) : i2 ? i2.value : e2.get(t2);
|
|
3009
|
+
}
|
|
3010
|
+
function O(t2, e2, s2, i2, n2) {
|
|
3011
|
+
if ("m" === i2)
|
|
3012
|
+
throw new TypeError("Private method is not writable");
|
|
3013
|
+
if ("a" === i2 && !n2)
|
|
3014
|
+
throw new TypeError("Private accessor was defined without a setter");
|
|
3015
|
+
if ("function" == typeof e2 ? t2 !== e2 || !n2 : !e2.has(t2))
|
|
3016
|
+
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
3017
|
+
return "a" === i2 ? n2.call(t2, s2) : n2 ? n2.value = s2 : e2.set(t2, s2), s2;
|
|
3018
|
+
}
|
|
3019
|
+
var w = class {
|
|
3020
|
+
constructor(t2) {
|
|
3021
|
+
this.globalMiddleware = [], this.frozens = [], this.yargs = t2;
|
|
3022
|
+
}
|
|
3023
|
+
addMiddleware(t2, e2, s2 = true, i2 = false) {
|
|
3024
|
+
if (h("<array|function> [boolean] [boolean] [boolean]", [t2, e2, s2], arguments.length), Array.isArray(t2)) {
|
|
3025
|
+
for (let i3 = 0; i3 < t2.length; i3++) {
|
|
3026
|
+
if ("function" != typeof t2[i3])
|
|
3027
|
+
throw Error("middleware must be a function");
|
|
3028
|
+
const n2 = t2[i3];
|
|
3029
|
+
n2.applyBeforeValidation = e2, n2.global = s2;
|
|
3030
|
+
}
|
|
3031
|
+
Array.prototype.push.apply(this.globalMiddleware, t2);
|
|
3032
|
+
} else if ("function" == typeof t2) {
|
|
3033
|
+
const n2 = t2;
|
|
3034
|
+
n2.applyBeforeValidation = e2, n2.global = s2, n2.mutates = i2, this.globalMiddleware.push(t2);
|
|
3035
|
+
}
|
|
3036
|
+
return this.yargs;
|
|
3037
|
+
}
|
|
3038
|
+
addCoerceMiddleware(t2, e2) {
|
|
3039
|
+
const s2 = this.yargs.getAliases();
|
|
3040
|
+
return this.globalMiddleware = this.globalMiddleware.filter((t3) => {
|
|
3041
|
+
const i2 = [...s2[e2] || [], e2];
|
|
3042
|
+
return !t3.option || !i2.includes(t3.option);
|
|
3043
|
+
}), t2.option = e2, this.addMiddleware(t2, true, true, true);
|
|
3044
|
+
}
|
|
3045
|
+
getMiddleware() {
|
|
3046
|
+
return this.globalMiddleware;
|
|
3047
|
+
}
|
|
3048
|
+
freeze() {
|
|
3049
|
+
this.frozens.push([...this.globalMiddleware]);
|
|
3050
|
+
}
|
|
3051
|
+
unfreeze() {
|
|
3052
|
+
const t2 = this.frozens.pop();
|
|
3053
|
+
void 0 !== t2 && (this.globalMiddleware = t2);
|
|
3054
|
+
}
|
|
3055
|
+
reset() {
|
|
3056
|
+
this.globalMiddleware = this.globalMiddleware.filter((t2) => t2.global);
|
|
3057
|
+
}
|
|
3058
|
+
};
|
|
3059
|
+
function C(t2, e2, s2, i2) {
|
|
3060
|
+
return s2.reduce((t3, s3) => {
|
|
3061
|
+
if (s3.applyBeforeValidation !== i2)
|
|
3062
|
+
return t3;
|
|
3063
|
+
if (s3.mutates) {
|
|
3064
|
+
if (s3.applied)
|
|
3065
|
+
return t3;
|
|
3066
|
+
s3.applied = true;
|
|
3067
|
+
}
|
|
3068
|
+
if (f(t3))
|
|
3069
|
+
return t3.then((t4) => Promise.all([t4, s3(t4, e2)])).then(([t4, e3]) => Object.assign(t4, e3));
|
|
3070
|
+
{
|
|
3071
|
+
const i3 = s3(t3, e2);
|
|
3072
|
+
return f(i3) ? i3.then((e3) => Object.assign(t3, e3)) : Object.assign(t3, i3);
|
|
3073
|
+
}
|
|
3074
|
+
}, t2);
|
|
3075
|
+
}
|
|
3076
|
+
function j(t2, e2, s2 = (t3) => {
|
|
3077
|
+
throw t3;
|
|
3078
|
+
}) {
|
|
3079
|
+
try {
|
|
3080
|
+
const s3 = "function" == typeof t2 ? t2() : t2;
|
|
3081
|
+
return f(s3) ? s3.then((t3) => e2(t3)) : e2(s3);
|
|
3082
|
+
} catch (t3) {
|
|
3083
|
+
return s2(t3);
|
|
3084
|
+
}
|
|
3085
|
+
}
|
|
3086
|
+
var _ = /(^\*)|(^\$0)/;
|
|
3087
|
+
var M = class {
|
|
3088
|
+
constructor(t2, e2, s2, i2) {
|
|
3089
|
+
this.requireCache = /* @__PURE__ */ new Set(), this.handlers = {}, this.aliasMap = {}, this.frozens = [], this.shim = i2, this.usage = t2, this.globalMiddleware = s2, this.validation = e2;
|
|
3090
|
+
}
|
|
3091
|
+
addDirectory(t2, e2, s2, i2) {
|
|
3092
|
+
"boolean" != typeof (i2 = i2 || {}).recurse && (i2.recurse = false), Array.isArray(i2.extensions) || (i2.extensions = ["js"]);
|
|
3093
|
+
const n2 = "function" == typeof i2.visit ? i2.visit : (t3) => t3;
|
|
3094
|
+
i2.visit = (t3, e3, s3) => {
|
|
3095
|
+
const i3 = n2(t3, e3, s3);
|
|
3096
|
+
if (i3) {
|
|
3097
|
+
if (this.requireCache.has(e3))
|
|
3098
|
+
return i3;
|
|
3099
|
+
this.requireCache.add(e3), this.addHandler(i3);
|
|
3100
|
+
}
|
|
3101
|
+
return i3;
|
|
3102
|
+
}, this.shim.requireDirectory({ require: e2, filename: s2 }, t2, i2);
|
|
3103
|
+
}
|
|
3104
|
+
addHandler(t2, e2, s2, i2, n2, r2) {
|
|
3105
|
+
let a2 = [];
|
|
3106
|
+
const h2 = function(t3) {
|
|
3107
|
+
return t3 ? t3.map((t4) => (t4.applyBeforeValidation = false, t4)) : [];
|
|
3108
|
+
}(n2);
|
|
3109
|
+
if (i2 = i2 || (() => {
|
|
3110
|
+
}), Array.isArray(t2))
|
|
3111
|
+
if (function(t3) {
|
|
3112
|
+
return t3.every((t4) => "string" == typeof t4);
|
|
3113
|
+
}(t2))
|
|
3114
|
+
[t2, ...a2] = t2;
|
|
3115
|
+
else
|
|
3116
|
+
for (const e3 of t2)
|
|
3117
|
+
this.addHandler(e3);
|
|
3118
|
+
else {
|
|
3119
|
+
if (function(t3) {
|
|
3120
|
+
return "object" == typeof t3 && !Array.isArray(t3);
|
|
3121
|
+
}(t2)) {
|
|
3122
|
+
let e3 = Array.isArray(t2.command) || "string" == typeof t2.command ? t2.command : this.moduleName(t2);
|
|
3123
|
+
return t2.aliases && (e3 = [].concat(e3).concat(t2.aliases)), void this.addHandler(e3, this.extractDesc(t2), t2.builder, t2.handler, t2.middlewares, t2.deprecated);
|
|
3124
|
+
}
|
|
3125
|
+
if (k(s2))
|
|
3126
|
+
return void this.addHandler([t2].concat(a2), e2, s2.builder, s2.handler, s2.middlewares, s2.deprecated);
|
|
3127
|
+
}
|
|
3128
|
+
if ("string" == typeof t2) {
|
|
3129
|
+
const n3 = o(t2);
|
|
3130
|
+
a2 = a2.map((t3) => o(t3).cmd);
|
|
3131
|
+
let l2 = false;
|
|
3132
|
+
const c2 = [n3.cmd].concat(a2).filter((t3) => !_.test(t3) || (l2 = true, false));
|
|
3133
|
+
0 === c2.length && l2 && c2.push("$0"), l2 && (n3.cmd = c2[0], a2 = c2.slice(1), t2 = t2.replace(_, n3.cmd)), a2.forEach((t3) => {
|
|
3134
|
+
this.aliasMap[t3] = n3.cmd;
|
|
3135
|
+
}), false !== e2 && this.usage.command(t2, e2, l2, a2, r2), this.handlers[n3.cmd] = { original: t2, description: e2, handler: i2, builder: s2 || {}, middlewares: h2, deprecated: r2, demanded: n3.demanded, optional: n3.optional }, l2 && (this.defaultCommand = this.handlers[n3.cmd]);
|
|
3136
|
+
}
|
|
3137
|
+
}
|
|
3138
|
+
getCommandHandlers() {
|
|
3139
|
+
return this.handlers;
|
|
3140
|
+
}
|
|
3141
|
+
getCommands() {
|
|
3142
|
+
return Object.keys(this.handlers).concat(Object.keys(this.aliasMap));
|
|
3143
|
+
}
|
|
3144
|
+
hasDefaultCommand() {
|
|
3145
|
+
return !!this.defaultCommand;
|
|
3146
|
+
}
|
|
3147
|
+
runCommand(t2, e2, s2, i2, n2, r2) {
|
|
3148
|
+
const o2 = this.handlers[t2] || this.handlers[this.aliasMap[t2]] || this.defaultCommand, a2 = e2.getInternalMethods().getContext(), h2 = a2.commands.slice(), l2 = !t2;
|
|
3149
|
+
t2 && (a2.commands.push(t2), a2.fullCommands.push(o2.original));
|
|
3150
|
+
const c2 = this.applyBuilderUpdateUsageAndParse(l2, o2, e2, s2.aliases, h2, i2, n2, r2);
|
|
3151
|
+
return f(c2) ? c2.then((t3) => this.applyMiddlewareAndGetResult(l2, o2, t3.innerArgv, a2, n2, t3.aliases, e2)) : this.applyMiddlewareAndGetResult(l2, o2, c2.innerArgv, a2, n2, c2.aliases, e2);
|
|
3152
|
+
}
|
|
3153
|
+
applyBuilderUpdateUsageAndParse(t2, e2, s2, i2, n2, r2, o2, a2) {
|
|
3154
|
+
const h2 = e2.builder;
|
|
3155
|
+
let l2 = s2;
|
|
3156
|
+
if (x(h2)) {
|
|
3157
|
+
const c2 = h2(s2.getInternalMethods().reset(i2), a2);
|
|
3158
|
+
if (f(c2))
|
|
3159
|
+
return c2.then((i3) => {
|
|
3160
|
+
var a3;
|
|
3161
|
+
return l2 = (a3 = i3) && "function" == typeof a3.getInternalMethods ? i3 : s2, this.parseAndUpdateUsage(t2, e2, l2, n2, r2, o2);
|
|
3162
|
+
});
|
|
3163
|
+
} else
|
|
3164
|
+
(function(t3) {
|
|
3165
|
+
return "object" == typeof t3;
|
|
3166
|
+
})(h2) && (l2 = s2.getInternalMethods().reset(i2), Object.keys(e2.builder).forEach((t3) => {
|
|
3167
|
+
l2.option(t3, h2[t3]);
|
|
3168
|
+
}));
|
|
3169
|
+
return this.parseAndUpdateUsage(t2, e2, l2, n2, r2, o2);
|
|
3170
|
+
}
|
|
3171
|
+
parseAndUpdateUsage(t2, e2, s2, i2, n2, r2) {
|
|
3172
|
+
t2 && s2.getInternalMethods().getUsageInstance().unfreeze(true), this.shouldUpdateUsage(s2) && s2.getInternalMethods().getUsageInstance().usage(this.usageFromParentCommandsCommandHandler(i2, e2), e2.description);
|
|
3173
|
+
const o2 = s2.getInternalMethods().runYargsParserAndExecuteCommands(null, void 0, true, n2, r2);
|
|
3174
|
+
return f(o2) ? o2.then((t3) => ({ aliases: s2.parsed.aliases, innerArgv: t3 })) : { aliases: s2.parsed.aliases, innerArgv: o2 };
|
|
3175
|
+
}
|
|
3176
|
+
shouldUpdateUsage(t2) {
|
|
3177
|
+
return !t2.getInternalMethods().getUsageInstance().getUsageDisabled() && 0 === t2.getInternalMethods().getUsageInstance().getUsage().length;
|
|
3178
|
+
}
|
|
3179
|
+
usageFromParentCommandsCommandHandler(t2, e2) {
|
|
3180
|
+
const s2 = _.test(e2.original) ? e2.original.replace(_, "").trim() : e2.original, i2 = t2.filter((t3) => !_.test(t3));
|
|
3181
|
+
return i2.push(s2), `$0 ${i2.join(" ")}`;
|
|
3182
|
+
}
|
|
3183
|
+
handleValidationAndGetResult(t2, e2, s2, i2, n2, r2, o2, a2) {
|
|
3184
|
+
if (!r2.getInternalMethods().getHasOutput()) {
|
|
3185
|
+
const e3 = r2.getInternalMethods().runValidation(n2, a2, r2.parsed.error, t2);
|
|
3186
|
+
s2 = j(s2, (t3) => (e3(t3), t3));
|
|
3187
|
+
}
|
|
3188
|
+
if (e2.handler && !r2.getInternalMethods().getHasOutput()) {
|
|
3189
|
+
r2.getInternalMethods().setHasOutput();
|
|
3190
|
+
const i3 = !!r2.getOptions().configuration["populate--"];
|
|
3191
|
+
r2.getInternalMethods().postProcess(s2, i3, false, false), s2 = j(s2 = C(s2, r2, o2, false), (t3) => {
|
|
3192
|
+
const s3 = e2.handler(t3);
|
|
3193
|
+
return f(s3) ? s3.then(() => t3) : t3;
|
|
3194
|
+
}), t2 || r2.getInternalMethods().getUsageInstance().cacheHelpMessage(), f(s2) && !r2.getInternalMethods().hasParseCallback() && s2.catch((t3) => {
|
|
3195
|
+
try {
|
|
3196
|
+
r2.getInternalMethods().getUsageInstance().fail(null, t3);
|
|
3197
|
+
} catch (t4) {
|
|
3198
|
+
}
|
|
3199
|
+
});
|
|
3200
|
+
}
|
|
3201
|
+
return t2 || (i2.commands.pop(), i2.fullCommands.pop()), s2;
|
|
3202
|
+
}
|
|
3203
|
+
applyMiddlewareAndGetResult(t2, e2, s2, i2, n2, r2, o2) {
|
|
3204
|
+
let a2 = {};
|
|
3205
|
+
if (n2)
|
|
3206
|
+
return s2;
|
|
3207
|
+
o2.getInternalMethods().getHasOutput() || (a2 = this.populatePositionals(e2, s2, i2, o2));
|
|
3208
|
+
const h2 = this.globalMiddleware.getMiddleware().slice(0).concat(e2.middlewares), l2 = C(s2, o2, h2, true);
|
|
3209
|
+
return f(l2) ? l2.then((s3) => this.handleValidationAndGetResult(t2, e2, s3, i2, r2, o2, h2, a2)) : this.handleValidationAndGetResult(t2, e2, l2, i2, r2, o2, h2, a2);
|
|
3210
|
+
}
|
|
3211
|
+
populatePositionals(t2, e2, s2, i2) {
|
|
3212
|
+
e2._ = e2._.slice(s2.commands.length);
|
|
3213
|
+
const n2 = t2.demanded.slice(0), r2 = t2.optional.slice(0), o2 = {};
|
|
3214
|
+
for (this.validation.positionalCount(n2.length, e2._.length); n2.length; ) {
|
|
3215
|
+
const t3 = n2.shift();
|
|
3216
|
+
this.populatePositional(t3, e2, o2);
|
|
3217
|
+
}
|
|
3218
|
+
for (; r2.length; ) {
|
|
3219
|
+
const t3 = r2.shift();
|
|
3220
|
+
this.populatePositional(t3, e2, o2);
|
|
3221
|
+
}
|
|
3222
|
+
return e2._ = s2.commands.concat(e2._.map((t3) => "" + t3)), this.postProcessPositionals(e2, o2, this.cmdToParseOptions(t2.original), i2), o2;
|
|
3223
|
+
}
|
|
3224
|
+
populatePositional(t2, e2, s2) {
|
|
3225
|
+
const i2 = t2.cmd[0];
|
|
3226
|
+
t2.variadic ? s2[i2] = e2._.splice(0).map(String) : e2._.length && (s2[i2] = [String(e2._.shift())]);
|
|
3227
|
+
}
|
|
3228
|
+
cmdToParseOptions(t2) {
|
|
3229
|
+
const e2 = { array: [], default: {}, alias: {}, demand: {} }, s2 = o(t2);
|
|
3230
|
+
return s2.demanded.forEach((t3) => {
|
|
3231
|
+
const [s3, ...i2] = t3.cmd;
|
|
3232
|
+
t3.variadic && (e2.array.push(s3), e2.default[s3] = []), e2.alias[s3] = i2, e2.demand[s3] = true;
|
|
3233
|
+
}), s2.optional.forEach((t3) => {
|
|
3234
|
+
const [s3, ...i2] = t3.cmd;
|
|
3235
|
+
t3.variadic && (e2.array.push(s3), e2.default[s3] = []), e2.alias[s3] = i2;
|
|
3236
|
+
}), e2;
|
|
3237
|
+
}
|
|
3238
|
+
postProcessPositionals(t2, e2, s2, i2) {
|
|
3239
|
+
const n2 = Object.assign({}, i2.getOptions());
|
|
3240
|
+
n2.default = Object.assign(s2.default, n2.default);
|
|
3241
|
+
for (const t3 of Object.keys(s2.alias))
|
|
3242
|
+
n2.alias[t3] = (n2.alias[t3] || []).concat(s2.alias[t3]);
|
|
3243
|
+
n2.array = n2.array.concat(s2.array), n2.config = {};
|
|
3244
|
+
const r2 = [];
|
|
3245
|
+
if (Object.keys(e2).forEach((t3) => {
|
|
3246
|
+
e2[t3].map((e3) => {
|
|
3247
|
+
n2.configuration["unknown-options-as-args"] && (n2.key[t3] = true), r2.push(`--${t3}`), r2.push(e3);
|
|
3248
|
+
});
|
|
3249
|
+
}), !r2.length)
|
|
3250
|
+
return;
|
|
3251
|
+
const o2 = Object.assign({}, n2.configuration, { "populate--": false }), a2 = this.shim.Parser.detailed(r2, Object.assign({}, n2, { configuration: o2 }));
|
|
3252
|
+
if (a2.error)
|
|
3253
|
+
i2.getInternalMethods().getUsageInstance().fail(a2.error.message, a2.error);
|
|
3254
|
+
else {
|
|
3255
|
+
const s3 = Object.keys(e2);
|
|
3256
|
+
Object.keys(e2).forEach((t3) => {
|
|
3257
|
+
s3.push(...a2.aliases[t3]);
|
|
3258
|
+
}), Object.keys(a2.argv).forEach((n3) => {
|
|
3259
|
+
s3.includes(n3) && (e2[n3] || (e2[n3] = a2.argv[n3]), !this.isInConfigs(i2, n3) && !this.isDefaulted(i2, n3) && Object.prototype.hasOwnProperty.call(t2, n3) && Object.prototype.hasOwnProperty.call(a2.argv, n3) && (Array.isArray(t2[n3]) || Array.isArray(a2.argv[n3])) ? t2[n3] = [].concat(t2[n3], a2.argv[n3]) : t2[n3] = a2.argv[n3]);
|
|
3260
|
+
});
|
|
3261
|
+
}
|
|
3262
|
+
}
|
|
3263
|
+
isDefaulted(t2, e2) {
|
|
3264
|
+
const { default: s2 } = t2.getOptions();
|
|
3265
|
+
return Object.prototype.hasOwnProperty.call(s2, e2) || Object.prototype.hasOwnProperty.call(s2, this.shim.Parser.camelCase(e2));
|
|
3266
|
+
}
|
|
3267
|
+
isInConfigs(t2, e2) {
|
|
3268
|
+
const { configObjects: s2 } = t2.getOptions();
|
|
3269
|
+
return s2.some((t3) => Object.prototype.hasOwnProperty.call(t3, e2)) || s2.some((t3) => Object.prototype.hasOwnProperty.call(t3, this.shim.Parser.camelCase(e2)));
|
|
3270
|
+
}
|
|
3271
|
+
runDefaultBuilderOn(t2) {
|
|
3272
|
+
if (!this.defaultCommand)
|
|
3273
|
+
return;
|
|
3274
|
+
if (this.shouldUpdateUsage(t2)) {
|
|
3275
|
+
const e3 = _.test(this.defaultCommand.original) ? this.defaultCommand.original : this.defaultCommand.original.replace(/^[^[\]<>]*/, "$0 ");
|
|
3276
|
+
t2.getInternalMethods().getUsageInstance().usage(e3, this.defaultCommand.description);
|
|
3277
|
+
}
|
|
3278
|
+
const e2 = this.defaultCommand.builder;
|
|
3279
|
+
if (x(e2))
|
|
3280
|
+
return e2(t2, true);
|
|
3281
|
+
k(e2) || Object.keys(e2).forEach((s2) => {
|
|
3282
|
+
t2.option(s2, e2[s2]);
|
|
3283
|
+
});
|
|
3284
|
+
}
|
|
3285
|
+
moduleName(t2) {
|
|
3286
|
+
const e2 = function(t3) {
|
|
3287
|
+
if ("undefined" == typeof require)
|
|
3288
|
+
return null;
|
|
3289
|
+
for (let e3, s2 = 0, i2 = Object.keys(require.cache); s2 < i2.length; s2++)
|
|
3290
|
+
if (e3 = require.cache[i2[s2]], e3.exports === t3)
|
|
3291
|
+
return e3;
|
|
3292
|
+
return null;
|
|
3293
|
+
}(t2);
|
|
3294
|
+
if (!e2)
|
|
3295
|
+
throw new Error(`No command name given for module: ${this.shim.inspect(t2)}`);
|
|
3296
|
+
return this.commandFromFilename(e2.filename);
|
|
3297
|
+
}
|
|
3298
|
+
commandFromFilename(t2) {
|
|
3299
|
+
return this.shim.path.basename(t2, this.shim.path.extname(t2));
|
|
3300
|
+
}
|
|
3301
|
+
extractDesc({ describe: t2, description: e2, desc: s2 }) {
|
|
3302
|
+
for (const i2 of [t2, e2, s2]) {
|
|
3303
|
+
if ("string" == typeof i2 || false === i2)
|
|
3304
|
+
return i2;
|
|
3305
|
+
d(i2, true, this.shim);
|
|
3306
|
+
}
|
|
3307
|
+
return false;
|
|
3308
|
+
}
|
|
3309
|
+
freeze() {
|
|
3310
|
+
this.frozens.push({ handlers: this.handlers, aliasMap: this.aliasMap, defaultCommand: this.defaultCommand });
|
|
3311
|
+
}
|
|
3312
|
+
unfreeze() {
|
|
3313
|
+
const t2 = this.frozens.pop();
|
|
3314
|
+
d(t2, void 0, this.shim), { handlers: this.handlers, aliasMap: this.aliasMap, defaultCommand: this.defaultCommand } = t2;
|
|
3315
|
+
}
|
|
3316
|
+
reset() {
|
|
3317
|
+
return this.handlers = {}, this.aliasMap = {}, this.defaultCommand = void 0, this.requireCache = /* @__PURE__ */ new Set(), this;
|
|
3318
|
+
}
|
|
3319
|
+
};
|
|
3320
|
+
function k(t2) {
|
|
3321
|
+
return "object" == typeof t2 && !!t2.builder && "function" == typeof t2.handler;
|
|
3322
|
+
}
|
|
3323
|
+
function x(t2) {
|
|
3324
|
+
return "function" == typeof t2;
|
|
3325
|
+
}
|
|
3326
|
+
function E(t2) {
|
|
3327
|
+
"undefined" != typeof process && [process.stdout, process.stderr].forEach((e2) => {
|
|
3328
|
+
const s2 = e2;
|
|
3329
|
+
s2._handle && s2.isTTY && "function" == typeof s2._handle.setBlocking && s2._handle.setBlocking(t2);
|
|
3330
|
+
});
|
|
3331
|
+
}
|
|
3332
|
+
function A(t2) {
|
|
3333
|
+
return "boolean" == typeof t2;
|
|
3334
|
+
}
|
|
3335
|
+
function P(t2, s2) {
|
|
3336
|
+
const i2 = s2.y18n.__, n2 = {}, r2 = [];
|
|
3337
|
+
n2.failFn = function(t3) {
|
|
3338
|
+
r2.push(t3);
|
|
3339
|
+
};
|
|
3340
|
+
let o2 = null, a2 = null, h2 = true;
|
|
3341
|
+
n2.showHelpOnFail = function(e2 = true, s3) {
|
|
3342
|
+
const [i3, r3] = "string" == typeof e2 ? [true, e2] : [e2, s3];
|
|
3343
|
+
return t2.getInternalMethods().isGlobalContext() && (a2 = r3), o2 = r3, h2 = i3, n2;
|
|
3344
|
+
};
|
|
3345
|
+
let l2 = false;
|
|
3346
|
+
n2.fail = function(s3, i3) {
|
|
3347
|
+
const c3 = t2.getInternalMethods().getLoggerInstance();
|
|
3348
|
+
if (!r2.length) {
|
|
3349
|
+
if (t2.getExitProcess() && E(true), !l2) {
|
|
3350
|
+
l2 = true, h2 && (t2.showHelp("error"), c3.error()), (s3 || i3) && c3.error(s3 || i3);
|
|
3351
|
+
const e2 = o2 || a2;
|
|
3352
|
+
e2 && ((s3 || i3) && c3.error(""), c3.error(e2));
|
|
3353
|
+
}
|
|
3354
|
+
if (i3 = i3 || new e(s3), t2.getExitProcess())
|
|
3355
|
+
return t2.exit(1);
|
|
3356
|
+
if (t2.getInternalMethods().hasParseCallback())
|
|
3357
|
+
return t2.exit(1, i3);
|
|
3358
|
+
throw i3;
|
|
3359
|
+
}
|
|
3360
|
+
for (let t3 = r2.length - 1; t3 >= 0; --t3) {
|
|
3361
|
+
const e2 = r2[t3];
|
|
3362
|
+
if (A(e2)) {
|
|
3363
|
+
if (i3)
|
|
3364
|
+
throw i3;
|
|
3365
|
+
if (s3)
|
|
3366
|
+
throw Error(s3);
|
|
3367
|
+
} else
|
|
3368
|
+
e2(s3, i3, n2);
|
|
3369
|
+
}
|
|
3370
|
+
};
|
|
3371
|
+
let c2 = [], f2 = false;
|
|
3372
|
+
n2.usage = (t3, e2) => null === t3 ? (f2 = true, c2 = [], n2) : (f2 = false, c2.push([t3, e2 || ""]), n2), n2.getUsage = () => c2, n2.getUsageDisabled = () => f2, n2.getPositionalGroupName = () => i2("Positionals:");
|
|
3373
|
+
let d2 = [];
|
|
3374
|
+
n2.example = (t3, e2) => {
|
|
3375
|
+
d2.push([t3, e2 || ""]);
|
|
3376
|
+
};
|
|
3377
|
+
let u2 = [];
|
|
3378
|
+
n2.command = function(t3, e2, s3, i3, n3 = false) {
|
|
3379
|
+
s3 && (u2 = u2.map((t4) => (t4[2] = false, t4))), u2.push([t3, e2 || "", s3, i3, n3]);
|
|
3380
|
+
}, n2.getCommands = () => u2;
|
|
3381
|
+
let p2 = {};
|
|
3382
|
+
n2.describe = function(t3, e2) {
|
|
3383
|
+
Array.isArray(t3) ? t3.forEach((t4) => {
|
|
3384
|
+
n2.describe(t4, e2);
|
|
3385
|
+
}) : "object" == typeof t3 ? Object.keys(t3).forEach((e3) => {
|
|
3386
|
+
n2.describe(e3, t3[e3]);
|
|
3387
|
+
}) : p2[t3] = e2;
|
|
3388
|
+
}, n2.getDescriptions = () => p2;
|
|
3389
|
+
let m2 = [];
|
|
3390
|
+
n2.epilog = (t3) => {
|
|
3391
|
+
m2.push(t3);
|
|
3392
|
+
};
|
|
3393
|
+
let y2, b2 = false;
|
|
3394
|
+
function v2() {
|
|
3395
|
+
return b2 || (y2 = function() {
|
|
3396
|
+
const t3 = 80;
|
|
3397
|
+
return s2.process.stdColumns ? Math.min(t3, s2.process.stdColumns) : t3;
|
|
3398
|
+
}(), b2 = true), y2;
|
|
3399
|
+
}
|
|
3400
|
+
n2.wrap = (t3) => {
|
|
3401
|
+
b2 = true, y2 = t3;
|
|
3402
|
+
};
|
|
3403
|
+
const O2 = "__yargsString__:";
|
|
3404
|
+
function w2(t3, e2, i3) {
|
|
3405
|
+
let n3 = 0;
|
|
3406
|
+
return Array.isArray(t3) || (t3 = Object.values(t3).map((t4) => [t4])), t3.forEach((t4) => {
|
|
3407
|
+
n3 = Math.max(s2.stringWidth(i3 ? `${i3} ${I(t4[0])}` : I(t4[0])) + $(t4[0]), n3);
|
|
3408
|
+
}), e2 && (n3 = Math.min(n3, parseInt((0.5 * e2).toString(), 10))), n3;
|
|
3409
|
+
}
|
|
3410
|
+
let C2;
|
|
3411
|
+
function j2(e2) {
|
|
3412
|
+
return t2.getOptions().hiddenOptions.indexOf(e2) < 0 || t2.parsed.argv[t2.getOptions().showHiddenOpt];
|
|
3413
|
+
}
|
|
3414
|
+
function _2(t3, e2) {
|
|
3415
|
+
let s3 = `[${i2("default:")} `;
|
|
3416
|
+
if (void 0 === t3 && !e2)
|
|
3417
|
+
return null;
|
|
3418
|
+
if (e2)
|
|
3419
|
+
s3 += e2;
|
|
3420
|
+
else
|
|
3421
|
+
switch (typeof t3) {
|
|
3422
|
+
case "string":
|
|
3423
|
+
s3 += `"${t3}"`;
|
|
3424
|
+
break;
|
|
3425
|
+
case "object":
|
|
3426
|
+
s3 += JSON.stringify(t3);
|
|
3427
|
+
break;
|
|
3428
|
+
default:
|
|
3429
|
+
s3 += t3;
|
|
3430
|
+
}
|
|
3431
|
+
return `${s3}]`;
|
|
3432
|
+
}
|
|
3433
|
+
n2.deferY18nLookup = (t3) => O2 + t3, n2.help = function() {
|
|
3434
|
+
if (C2)
|
|
3435
|
+
return C2;
|
|
3436
|
+
!function() {
|
|
3437
|
+
const e3 = t2.getDemandedOptions(), s3 = t2.getOptions();
|
|
3438
|
+
(Object.keys(s3.alias) || []).forEach((i3) => {
|
|
3439
|
+
s3.alias[i3].forEach((r4) => {
|
|
3440
|
+
p2[r4] && n2.describe(i3, p2[r4]), r4 in e3 && t2.demandOption(i3, e3[r4]), s3.boolean.includes(r4) && t2.boolean(i3), s3.count.includes(r4) && t2.count(i3), s3.string.includes(r4) && t2.string(i3), s3.normalize.includes(r4) && t2.normalize(i3), s3.array.includes(r4) && t2.array(i3), s3.number.includes(r4) && t2.number(i3);
|
|
3441
|
+
});
|
|
3442
|
+
});
|
|
3443
|
+
}();
|
|
3444
|
+
const e2 = t2.customScriptName ? t2.$0 : s2.path.basename(t2.$0), r3 = t2.getDemandedOptions(), o3 = t2.getDemandedCommands(), a3 = t2.getDeprecatedOptions(), h3 = t2.getGroups(), l3 = t2.getOptions();
|
|
3445
|
+
let g2 = [];
|
|
3446
|
+
g2 = g2.concat(Object.keys(p2)), g2 = g2.concat(Object.keys(r3)), g2 = g2.concat(Object.keys(o3)), g2 = g2.concat(Object.keys(l3.default)), g2 = g2.filter(j2), g2 = Object.keys(g2.reduce((t3, e3) => ("_" !== e3 && (t3[e3] = true), t3), {}));
|
|
3447
|
+
const y3 = v2(), b3 = s2.cliui({ width: y3, wrap: !!y3 });
|
|
3448
|
+
if (!f2) {
|
|
3449
|
+
if (c2.length)
|
|
3450
|
+
c2.forEach((t3) => {
|
|
3451
|
+
b3.div({ text: `${t3[0].replace(/\$0/g, e2)}` }), t3[1] && b3.div({ text: `${t3[1]}`, padding: [1, 0, 0, 0] });
|
|
3452
|
+
}), b3.div();
|
|
3453
|
+
else if (u2.length) {
|
|
3454
|
+
let t3 = null;
|
|
3455
|
+
t3 = o3._ ? `${e2} <${i2("command")}>
|
|
3456
|
+
` : `${e2} [${i2("command")}]
|
|
3457
|
+
`, b3.div(`${t3}`);
|
|
3458
|
+
}
|
|
3459
|
+
}
|
|
3460
|
+
if (u2.length > 1 || 1 === u2.length && !u2[0][2]) {
|
|
3461
|
+
b3.div(i2("Commands:"));
|
|
3462
|
+
const s3 = t2.getInternalMethods().getContext(), n3 = s3.commands.length ? `${s3.commands.join(" ")} ` : "";
|
|
3463
|
+
true === t2.getInternalMethods().getParserConfiguration()["sort-commands"] && (u2 = u2.sort((t3, e3) => t3[0].localeCompare(e3[0])));
|
|
3464
|
+
const r4 = e2 ? `${e2} ` : "";
|
|
3465
|
+
u2.forEach((t3) => {
|
|
3466
|
+
const s4 = `${r4}${n3}${t3[0].replace(/^\$0 ?/, "")}`;
|
|
3467
|
+
b3.span({ text: s4, padding: [0, 2, 0, 2], width: w2(u2, y3, `${e2}${n3}`) + 4 }, { text: t3[1] });
|
|
3468
|
+
const o4 = [];
|
|
3469
|
+
t3[2] && o4.push(`[${i2("default")}]`), t3[3] && t3[3].length && o4.push(`[${i2("aliases:")} ${t3[3].join(", ")}]`), t3[4] && ("string" == typeof t3[4] ? o4.push(`[${i2("deprecated: %s", t3[4])}]`) : o4.push(`[${i2("deprecated")}]`)), o4.length ? b3.div({ text: o4.join(" "), padding: [0, 0, 0, 2], align: "right" }) : b3.div();
|
|
3470
|
+
}), b3.div();
|
|
3471
|
+
}
|
|
3472
|
+
const M3 = (Object.keys(l3.alias) || []).concat(Object.keys(t2.parsed.newAliases) || []);
|
|
3473
|
+
g2 = g2.filter((e3) => !t2.parsed.newAliases[e3] && M3.every((t3) => -1 === (l3.alias[t3] || []).indexOf(e3)));
|
|
3474
|
+
const k3 = i2("Options:");
|
|
3475
|
+
h3[k3] || (h3[k3] = []), function(t3, e3, s3, i3) {
|
|
3476
|
+
let n3 = [], r4 = null;
|
|
3477
|
+
Object.keys(s3).forEach((t4) => {
|
|
3478
|
+
n3 = n3.concat(s3[t4]);
|
|
3479
|
+
}), t3.forEach((t4) => {
|
|
3480
|
+
r4 = [t4].concat(e3[t4]), r4.some((t5) => -1 !== n3.indexOf(t5)) || s3[i3].push(t4);
|
|
3481
|
+
});
|
|
3482
|
+
}(g2, l3.alias, h3, k3);
|
|
3483
|
+
const x2 = (t3) => /^--/.test(I(t3)), E2 = Object.keys(h3).filter((t3) => h3[t3].length > 0).map((t3) => ({ groupName: t3, normalizedKeys: h3[t3].filter(j2).map((t4) => {
|
|
3484
|
+
if (M3.includes(t4))
|
|
3485
|
+
return t4;
|
|
3486
|
+
for (let e3, s3 = 0; void 0 !== (e3 = M3[s3]); s3++)
|
|
3487
|
+
if ((l3.alias[e3] || []).includes(t4))
|
|
3488
|
+
return e3;
|
|
3489
|
+
return t4;
|
|
3490
|
+
}) })).filter(({ normalizedKeys: t3 }) => t3.length > 0).map(({ groupName: t3, normalizedKeys: e3 }) => {
|
|
3491
|
+
const s3 = e3.reduce((e4, s4) => (e4[s4] = [s4].concat(l3.alias[s4] || []).map((e5) => t3 === n2.getPositionalGroupName() ? e5 : (/^[0-9]$/.test(e5) ? l3.boolean.includes(s4) ? "-" : "--" : e5.length > 1 ? "--" : "-") + e5).sort((t4, e5) => x2(t4) === x2(e5) ? 0 : x2(t4) ? 1 : -1).join(", "), e4), {});
|
|
3492
|
+
return { groupName: t3, normalizedKeys: e3, switches: s3 };
|
|
3493
|
+
});
|
|
3494
|
+
if (E2.filter(({ groupName: t3 }) => t3 !== n2.getPositionalGroupName()).some(({ normalizedKeys: t3, switches: e3 }) => !t3.every((t4) => x2(e3[t4]))) && E2.filter(({ groupName: t3 }) => t3 !== n2.getPositionalGroupName()).forEach(({ normalizedKeys: t3, switches: e3 }) => {
|
|
3495
|
+
t3.forEach((t4) => {
|
|
3496
|
+
var s3, i3;
|
|
3497
|
+
x2(e3[t4]) && (e3[t4] = (s3 = e3[t4], i3 = "-x, ".length, S(s3) ? { text: s3.text, indentation: s3.indentation + i3 } : { text: s3, indentation: i3 }));
|
|
3498
|
+
});
|
|
3499
|
+
}), E2.forEach(({ groupName: t3, normalizedKeys: e3, switches: s3 }) => {
|
|
3500
|
+
b3.div(t3), e3.forEach((t4) => {
|
|
3501
|
+
const e4 = s3[t4];
|
|
3502
|
+
let o4 = p2[t4] || "", h4 = null;
|
|
3503
|
+
o4.includes(O2) && (o4 = i2(o4.substring(O2.length))), l3.boolean.includes(t4) && (h4 = `[${i2("boolean")}]`), l3.count.includes(t4) && (h4 = `[${i2("count")}]`), l3.string.includes(t4) && (h4 = `[${i2("string")}]`), l3.normalize.includes(t4) && (h4 = `[${i2("string")}]`), l3.array.includes(t4) && (h4 = `[${i2("array")}]`), l3.number.includes(t4) && (h4 = `[${i2("number")}]`);
|
|
3504
|
+
const c3 = [t4 in a3 ? (f3 = a3[t4], "string" == typeof f3 ? `[${i2("deprecated: %s", f3)}]` : `[${i2("deprecated")}]`) : null, h4, t4 in r3 ? `[${i2("required")}]` : null, l3.choices && l3.choices[t4] ? `[${i2("choices:")} ${n2.stringifiedValues(l3.choices[t4])}]` : null, _2(l3.default[t4], l3.defaultDescription[t4])].filter(Boolean).join(" ");
|
|
3505
|
+
var f3;
|
|
3506
|
+
b3.span({ text: I(e4), padding: [0, 2, 0, 2 + $(e4)], width: w2(s3, y3) + 4 }, o4), c3 ? b3.div({ text: c3, padding: [0, 0, 0, 2], align: "right" }) : b3.div();
|
|
3507
|
+
}), b3.div();
|
|
3508
|
+
}), d2.length && (b3.div(i2("Examples:")), d2.forEach((t3) => {
|
|
3509
|
+
t3[0] = t3[0].replace(/\$0/g, e2);
|
|
3510
|
+
}), d2.forEach((t3) => {
|
|
3511
|
+
"" === t3[1] ? b3.div({ text: t3[0], padding: [0, 2, 0, 2] }) : b3.div({ text: t3[0], padding: [0, 2, 0, 2], width: w2(d2, y3) + 4 }, { text: t3[1] });
|
|
3512
|
+
}), b3.div()), m2.length > 0) {
|
|
3513
|
+
const t3 = m2.map((t4) => t4.replace(/\$0/g, e2)).join("\n");
|
|
3514
|
+
b3.div(`${t3}
|
|
3515
|
+
`);
|
|
3516
|
+
}
|
|
3517
|
+
return b3.toString().replace(/\s*$/, "");
|
|
3518
|
+
}, n2.cacheHelpMessage = function() {
|
|
3519
|
+
C2 = this.help();
|
|
3520
|
+
}, n2.clearCachedHelpMessage = function() {
|
|
3521
|
+
C2 = void 0;
|
|
3522
|
+
}, n2.hasCachedHelpMessage = function() {
|
|
3523
|
+
return !!C2;
|
|
3524
|
+
}, n2.showHelp = (e2) => {
|
|
3525
|
+
const s3 = t2.getInternalMethods().getLoggerInstance();
|
|
3526
|
+
e2 || (e2 = "error");
|
|
3527
|
+
("function" == typeof e2 ? e2 : s3[e2])(n2.help());
|
|
3528
|
+
}, n2.functionDescription = (t3) => ["(", t3.name ? s2.Parser.decamelize(t3.name, "-") : i2("generated-value"), ")"].join(""), n2.stringifiedValues = function(t3, e2) {
|
|
3529
|
+
let s3 = "";
|
|
3530
|
+
const i3 = e2 || ", ", n3 = [].concat(t3);
|
|
3531
|
+
return t3 && n3.length ? (n3.forEach((t4) => {
|
|
3532
|
+
s3.length && (s3 += i3), s3 += JSON.stringify(t4);
|
|
3533
|
+
}), s3) : s3;
|
|
3534
|
+
};
|
|
3535
|
+
let M2 = null;
|
|
3536
|
+
n2.version = (t3) => {
|
|
3537
|
+
M2 = t3;
|
|
3538
|
+
}, n2.showVersion = (e2) => {
|
|
3539
|
+
const s3 = t2.getInternalMethods().getLoggerInstance();
|
|
3540
|
+
e2 || (e2 = "error");
|
|
3541
|
+
("function" == typeof e2 ? e2 : s3[e2])(M2);
|
|
3542
|
+
}, n2.reset = function(t3) {
|
|
3543
|
+
return o2 = null, l2 = false, c2 = [], f2 = false, m2 = [], d2 = [], u2 = [], p2 = g(p2, (e2) => !t3[e2]), n2;
|
|
3544
|
+
};
|
|
3545
|
+
const k2 = [];
|
|
3546
|
+
return n2.freeze = function() {
|
|
3547
|
+
k2.push({ failMessage: o2, failureOutput: l2, usages: c2, usageDisabled: f2, epilogs: m2, examples: d2, commands: u2, descriptions: p2 });
|
|
3548
|
+
}, n2.unfreeze = function(t3 = false) {
|
|
3549
|
+
const e2 = k2.pop();
|
|
3550
|
+
e2 && (t3 ? (p2 = { ...e2.descriptions, ...p2 }, u2 = [...e2.commands, ...u2], c2 = [...e2.usages, ...c2], d2 = [...e2.examples, ...d2], m2 = [...e2.epilogs, ...m2]) : { failMessage: o2, failureOutput: l2, usages: c2, usageDisabled: f2, epilogs: m2, examples: d2, commands: u2, descriptions: p2 } = e2);
|
|
3551
|
+
}, n2;
|
|
3552
|
+
}
|
|
3553
|
+
function S(t2) {
|
|
3554
|
+
return "object" == typeof t2;
|
|
3555
|
+
}
|
|
3556
|
+
function $(t2) {
|
|
3557
|
+
return S(t2) ? t2.indentation : 0;
|
|
3558
|
+
}
|
|
3559
|
+
function I(t2) {
|
|
3560
|
+
return S(t2) ? t2.text : t2;
|
|
3561
|
+
}
|
|
3562
|
+
var D = class {
|
|
3563
|
+
constructor(t2, e2, s2, i2) {
|
|
3564
|
+
var n2, r2, o2;
|
|
3565
|
+
this.yargs = t2, this.usage = e2, this.command = s2, this.shim = i2, this.completionKey = "get-yargs-completions", this.aliases = null, this.customCompletionFunction = null, this.indexAfterLastReset = 0, this.zshShell = null !== (o2 = (null === (n2 = this.shim.getEnv("SHELL")) || void 0 === n2 ? void 0 : n2.includes("zsh")) || (null === (r2 = this.shim.getEnv("ZSH_NAME")) || void 0 === r2 ? void 0 : r2.includes("zsh"))) && void 0 !== o2 && o2;
|
|
3566
|
+
}
|
|
3567
|
+
defaultCompletion(t2, e2, s2, i2) {
|
|
3568
|
+
const n2 = this.command.getCommandHandlers();
|
|
3569
|
+
for (let e3 = 0, s3 = t2.length; e3 < s3; ++e3)
|
|
3570
|
+
if (n2[t2[e3]] && n2[t2[e3]].builder) {
|
|
3571
|
+
const s4 = n2[t2[e3]].builder;
|
|
3572
|
+
if (x(s4)) {
|
|
3573
|
+
this.indexAfterLastReset = e3 + 1;
|
|
3574
|
+
const t3 = this.yargs.getInternalMethods().reset();
|
|
3575
|
+
return s4(t3, true), t3.argv;
|
|
3576
|
+
}
|
|
3577
|
+
}
|
|
3578
|
+
const r2 = [];
|
|
3579
|
+
this.commandCompletions(r2, t2, s2), this.optionCompletions(r2, t2, e2, s2), this.choicesFromOptionsCompletions(r2, t2, e2, s2), this.choicesFromPositionalsCompletions(r2, t2, e2, s2), i2(null, r2);
|
|
3580
|
+
}
|
|
3581
|
+
commandCompletions(t2, e2, s2) {
|
|
3582
|
+
const i2 = this.yargs.getInternalMethods().getContext().commands;
|
|
3583
|
+
s2.match(/^-/) || i2[i2.length - 1] === s2 || this.previousArgHasChoices(e2) || this.usage.getCommands().forEach((s3) => {
|
|
3584
|
+
const i3 = o(s3[0]).cmd;
|
|
3585
|
+
if (-1 === e2.indexOf(i3))
|
|
3586
|
+
if (this.zshShell) {
|
|
3587
|
+
const e3 = s3[1] || "";
|
|
3588
|
+
t2.push(i3.replace(/:/g, "\\:") + ":" + e3);
|
|
3589
|
+
} else
|
|
3590
|
+
t2.push(i3);
|
|
3591
|
+
});
|
|
3592
|
+
}
|
|
3593
|
+
optionCompletions(t2, e2, s2, i2) {
|
|
3594
|
+
if ((i2.match(/^-/) || "" === i2 && 0 === t2.length) && !this.previousArgHasChoices(e2)) {
|
|
3595
|
+
const s3 = this.yargs.getOptions(), n2 = this.yargs.getGroups()[this.usage.getPositionalGroupName()] || [];
|
|
3596
|
+
Object.keys(s3.key).forEach((r2) => {
|
|
3597
|
+
const o2 = !!s3.configuration["boolean-negation"] && s3.boolean.includes(r2);
|
|
3598
|
+
n2.includes(r2) || s3.hiddenOptions.includes(r2) || this.argsContainKey(e2, r2, o2) || (this.completeOptionKey(r2, t2, i2), o2 && s3.default[r2] && this.completeOptionKey(`no-${r2}`, t2, i2));
|
|
3599
|
+
});
|
|
3600
|
+
}
|
|
3601
|
+
}
|
|
3602
|
+
choicesFromOptionsCompletions(t2, e2, s2, i2) {
|
|
3603
|
+
if (this.previousArgHasChoices(e2)) {
|
|
3604
|
+
const s3 = this.getPreviousArgChoices(e2);
|
|
3605
|
+
s3 && s3.length > 0 && t2.push(...s3.map((t3) => t3.replace(/:/g, "\\:")));
|
|
3606
|
+
}
|
|
3607
|
+
}
|
|
3608
|
+
choicesFromPositionalsCompletions(t2, e2, s2, i2) {
|
|
3609
|
+
if ("" === i2 && t2.length > 0 && this.previousArgHasChoices(e2))
|
|
3610
|
+
return;
|
|
3611
|
+
const n2 = this.yargs.getGroups()[this.usage.getPositionalGroupName()] || [], r2 = Math.max(this.indexAfterLastReset, this.yargs.getInternalMethods().getContext().commands.length + 1), o2 = n2[s2._.length - r2 - 1];
|
|
3612
|
+
if (!o2)
|
|
3613
|
+
return;
|
|
3614
|
+
const a2 = this.yargs.getOptions().choices[o2] || [];
|
|
3615
|
+
for (const e3 of a2)
|
|
3616
|
+
e3.startsWith(i2) && t2.push(e3.replace(/:/g, "\\:"));
|
|
3617
|
+
}
|
|
3618
|
+
getPreviousArgChoices(t2) {
|
|
3619
|
+
if (t2.length < 1)
|
|
3620
|
+
return;
|
|
3621
|
+
let e2 = t2[t2.length - 1], s2 = "";
|
|
3622
|
+
if (!e2.startsWith("-") && t2.length > 1 && (s2 = e2, e2 = t2[t2.length - 2]), !e2.startsWith("-"))
|
|
3623
|
+
return;
|
|
3624
|
+
const i2 = e2.replace(/^-+/, ""), n2 = this.yargs.getOptions(), r2 = [i2, ...this.yargs.getAliases()[i2] || []];
|
|
3625
|
+
let o2;
|
|
3626
|
+
for (const t3 of r2)
|
|
3627
|
+
if (Object.prototype.hasOwnProperty.call(n2.key, t3) && Array.isArray(n2.choices[t3])) {
|
|
3628
|
+
o2 = n2.choices[t3];
|
|
3629
|
+
break;
|
|
3630
|
+
}
|
|
3631
|
+
return o2 ? o2.filter((t3) => !s2 || t3.startsWith(s2)) : void 0;
|
|
3632
|
+
}
|
|
3633
|
+
previousArgHasChoices(t2) {
|
|
3634
|
+
const e2 = this.getPreviousArgChoices(t2);
|
|
3635
|
+
return void 0 !== e2 && e2.length > 0;
|
|
3636
|
+
}
|
|
3637
|
+
argsContainKey(t2, e2, s2) {
|
|
3638
|
+
const i2 = (e3) => -1 !== t2.indexOf((/^[^0-9]$/.test(e3) ? "-" : "--") + e3);
|
|
3639
|
+
if (i2(e2))
|
|
3640
|
+
return true;
|
|
3641
|
+
if (s2 && i2(`no-${e2}`))
|
|
3642
|
+
return true;
|
|
3643
|
+
if (this.aliases) {
|
|
3644
|
+
for (const t3 of this.aliases[e2])
|
|
3645
|
+
if (i2(t3))
|
|
3646
|
+
return true;
|
|
3647
|
+
}
|
|
3648
|
+
return false;
|
|
3649
|
+
}
|
|
3650
|
+
completeOptionKey(t2, e2, s2) {
|
|
3651
|
+
const i2 = this.usage.getDescriptions(), n2 = !/^--/.test(s2) && ((t3) => /^[^0-9]$/.test(t3))(t2) ? "-" : "--";
|
|
3652
|
+
if (this.zshShell) {
|
|
3653
|
+
const s3 = i2[t2] || "";
|
|
3654
|
+
e2.push(n2 + `${t2.replace(/:/g, "\\:")}:${s3.replace("__yargsString__:", "")}`);
|
|
3655
|
+
} else
|
|
3656
|
+
e2.push(n2 + t2);
|
|
3657
|
+
}
|
|
3658
|
+
customCompletion(t2, e2, s2, i2) {
|
|
3659
|
+
if (d(this.customCompletionFunction, null, this.shim), this.customCompletionFunction.length < 3) {
|
|
3660
|
+
const t3 = this.customCompletionFunction(s2, e2);
|
|
3661
|
+
return f(t3) ? t3.then((t4) => {
|
|
3662
|
+
this.shim.process.nextTick(() => {
|
|
3663
|
+
i2(null, t4);
|
|
3664
|
+
});
|
|
3665
|
+
}).catch((t4) => {
|
|
3666
|
+
this.shim.process.nextTick(() => {
|
|
3667
|
+
i2(t4, void 0);
|
|
3668
|
+
});
|
|
3669
|
+
}) : i2(null, t3);
|
|
3670
|
+
}
|
|
3671
|
+
return function(t3) {
|
|
3672
|
+
return t3.length > 3;
|
|
3673
|
+
}(this.customCompletionFunction) ? this.customCompletionFunction(s2, e2, (n2 = i2) => this.defaultCompletion(t2, e2, s2, n2), (t3) => {
|
|
3674
|
+
i2(null, t3);
|
|
3675
|
+
}) : this.customCompletionFunction(s2, e2, (t3) => {
|
|
3676
|
+
i2(null, t3);
|
|
3677
|
+
});
|
|
3678
|
+
}
|
|
3679
|
+
getCompletion(t2, e2) {
|
|
3680
|
+
const s2 = t2.length ? t2[t2.length - 1] : "", i2 = this.yargs.parse(t2, true), n2 = this.customCompletionFunction ? (i3) => this.customCompletion(t2, i3, s2, e2) : (i3) => this.defaultCompletion(t2, i3, s2, e2);
|
|
3681
|
+
return f(i2) ? i2.then(n2) : n2(i2);
|
|
3682
|
+
}
|
|
3683
|
+
generateCompletionScript(t2, e2) {
|
|
3684
|
+
let s2 = this.zshShell ? `#compdef {{app_name}}
|
|
3685
|
+
###-begin-{{app_name}}-completions-###
|
|
3686
|
+
#
|
|
3687
|
+
# yargs command completion script
|
|
3688
|
+
#
|
|
3689
|
+
# Installation: {{app_path}} {{completion_command}} >> ~/.zshrc
|
|
3690
|
+
# or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.
|
|
3691
|
+
#
|
|
3692
|
+
_{{app_name}}_yargs_completions()
|
|
3693
|
+
{
|
|
3694
|
+
local reply
|
|
3695
|
+
local si=$IFS
|
|
3696
|
+
IFS=$'
|
|
3697
|
+
' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}"))
|
|
3698
|
+
IFS=$si
|
|
3699
|
+
_describe 'values' reply
|
|
3700
|
+
}
|
|
3701
|
+
compdef _{{app_name}}_yargs_completions {{app_name}}
|
|
3702
|
+
###-end-{{app_name}}-completions-###
|
|
3703
|
+
` : '###-begin-{{app_name}}-completions-###\n#\n# yargs command completion script\n#\n# Installation: {{app_path}} {{completion_command}} >> ~/.bashrc\n# or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.\n#\n_{{app_name}}_yargs_completions()\n{\n local cur_word args type_list\n\n cur_word="${COMP_WORDS[COMP_CWORD]}"\n args=("${COMP_WORDS[@]}")\n\n # ask yargs to generate completions.\n type_list=$({{app_path}} --get-yargs-completions "${args[@]}")\n\n COMPREPLY=( $(compgen -W "${type_list}" -- ${cur_word}) )\n\n # if no match was found, fall back to filename completion\n if [ ${#COMPREPLY[@]} -eq 0 ]; then\n COMPREPLY=()\n fi\n\n return 0\n}\ncomplete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}\n###-end-{{app_name}}-completions-###\n';
|
|
3704
|
+
const i2 = this.shim.path.basename(t2);
|
|
3705
|
+
return t2.match(/\.js$/) && (t2 = `./${t2}`), s2 = s2.replace(/{{app_name}}/g, i2), s2 = s2.replace(/{{completion_command}}/g, e2), s2.replace(/{{app_path}}/g, t2);
|
|
3706
|
+
}
|
|
3707
|
+
registerFunction(t2) {
|
|
3708
|
+
this.customCompletionFunction = t2;
|
|
3709
|
+
}
|
|
3710
|
+
setParsed(t2) {
|
|
3711
|
+
this.aliases = t2.aliases;
|
|
3712
|
+
}
|
|
3713
|
+
};
|
|
3714
|
+
function N(t2, e2) {
|
|
3715
|
+
if (0 === t2.length)
|
|
3716
|
+
return e2.length;
|
|
3717
|
+
if (0 === e2.length)
|
|
3718
|
+
return t2.length;
|
|
3719
|
+
const s2 = [];
|
|
3720
|
+
let i2, n2;
|
|
3721
|
+
for (i2 = 0; i2 <= e2.length; i2++)
|
|
3722
|
+
s2[i2] = [i2];
|
|
3723
|
+
for (n2 = 0; n2 <= t2.length; n2++)
|
|
3724
|
+
s2[0][n2] = n2;
|
|
3725
|
+
for (i2 = 1; i2 <= e2.length; i2++)
|
|
3726
|
+
for (n2 = 1; n2 <= t2.length; n2++)
|
|
3727
|
+
e2.charAt(i2 - 1) === t2.charAt(n2 - 1) ? s2[i2][n2] = s2[i2 - 1][n2 - 1] : i2 > 1 && n2 > 1 && e2.charAt(i2 - 2) === t2.charAt(n2 - 1) && e2.charAt(i2 - 1) === t2.charAt(n2 - 2) ? s2[i2][n2] = s2[i2 - 2][n2 - 2] + 1 : s2[i2][n2] = Math.min(s2[i2 - 1][n2 - 1] + 1, Math.min(s2[i2][n2 - 1] + 1, s2[i2 - 1][n2] + 1));
|
|
3728
|
+
return s2[e2.length][t2.length];
|
|
3729
|
+
}
|
|
3730
|
+
var H = ["$0", "--", "_"];
|
|
3731
|
+
var z;
|
|
3732
|
+
var q;
|
|
3733
|
+
var W;
|
|
3734
|
+
var F;
|
|
3735
|
+
var U;
|
|
3736
|
+
var L;
|
|
3737
|
+
var V;
|
|
3738
|
+
var G;
|
|
3739
|
+
var R;
|
|
3740
|
+
var T;
|
|
3741
|
+
var K;
|
|
3742
|
+
var B;
|
|
3743
|
+
var Y;
|
|
3744
|
+
var J;
|
|
3745
|
+
var Z;
|
|
3746
|
+
var X;
|
|
3747
|
+
var Q;
|
|
3748
|
+
var tt;
|
|
3749
|
+
var et;
|
|
3750
|
+
var st;
|
|
3751
|
+
var it;
|
|
3752
|
+
var nt;
|
|
3753
|
+
var rt;
|
|
3754
|
+
var ot;
|
|
3755
|
+
var at;
|
|
3756
|
+
var ht;
|
|
3757
|
+
var lt;
|
|
3758
|
+
var ct;
|
|
3759
|
+
var ft;
|
|
3760
|
+
var dt;
|
|
3761
|
+
var ut;
|
|
3762
|
+
var pt;
|
|
3763
|
+
var gt;
|
|
3764
|
+
var mt;
|
|
3765
|
+
var yt = Symbol("copyDoubleDash");
|
|
3766
|
+
var bt = Symbol("copyDoubleDash");
|
|
3767
|
+
var vt = Symbol("deleteFromParserHintObject");
|
|
3768
|
+
var Ot = Symbol("emitWarning");
|
|
3769
|
+
var wt = Symbol("freeze");
|
|
3770
|
+
var Ct = Symbol("getDollarZero");
|
|
3771
|
+
var jt = Symbol("getParserConfiguration");
|
|
3772
|
+
var _t = Symbol("guessLocale");
|
|
3773
|
+
var Mt = Symbol("guessVersion");
|
|
3774
|
+
var kt = Symbol("parsePositionalNumbers");
|
|
3775
|
+
var xt = Symbol("pkgUp");
|
|
3776
|
+
var Et = Symbol("populateParserHintArray");
|
|
3777
|
+
var At = Symbol("populateParserHintSingleValueDictionary");
|
|
3778
|
+
var Pt = Symbol("populateParserHintArrayDictionary");
|
|
3779
|
+
var St = Symbol("populateParserHintDictionary");
|
|
3780
|
+
var $t = Symbol("sanitizeKey");
|
|
3781
|
+
var It = Symbol("setKey");
|
|
3782
|
+
var Dt = Symbol("unfreeze");
|
|
3783
|
+
var Nt = Symbol("validateAsync");
|
|
3784
|
+
var Ht = Symbol("getCommandInstance");
|
|
3785
|
+
var zt = Symbol("getContext");
|
|
3786
|
+
var qt = Symbol("getHasOutput");
|
|
3787
|
+
var Wt = Symbol("getLoggerInstance");
|
|
3788
|
+
var Ft = Symbol("getParseContext");
|
|
3789
|
+
var Ut = Symbol("getUsageInstance");
|
|
3790
|
+
var Lt = Symbol("getValidationInstance");
|
|
3791
|
+
var Vt = Symbol("hasParseCallback");
|
|
3792
|
+
var Gt = Symbol("isGlobalContext");
|
|
3793
|
+
var Rt = Symbol("postProcess");
|
|
3794
|
+
var Tt = Symbol("rebase");
|
|
3795
|
+
var Kt = Symbol("reset");
|
|
3796
|
+
var Bt = Symbol("runYargsParserAndExecuteCommands");
|
|
3797
|
+
var Yt = Symbol("runValidation");
|
|
3798
|
+
var Jt = Symbol("setHasOutput");
|
|
3799
|
+
var Zt = Symbol("kTrackManuallySetKeys");
|
|
3800
|
+
var Xt = class {
|
|
3801
|
+
constructor(t2 = [], e2, s2, i2) {
|
|
3802
|
+
this.customScriptName = false, this.parsed = false, z.set(this, void 0), q.set(this, void 0), W.set(this, { commands: [], fullCommands: [] }), F.set(this, null), U.set(this, null), L.set(this, "show-hidden"), V.set(this, null), G.set(this, true), R.set(this, {}), T.set(this, true), K.set(this, []), B.set(this, void 0), Y.set(this, {}), J.set(this, false), Z.set(this, null), X.set(this, true), Q.set(this, void 0), tt.set(this, ""), et.set(this, void 0), st.set(this, void 0), it.set(this, {}), nt.set(this, null), rt.set(this, null), ot.set(this, {}), at.set(this, {}), ht.set(this, void 0), lt.set(this, false), ct.set(this, void 0), ft.set(this, false), dt.set(this, false), ut.set(this, false), pt.set(this, void 0), gt.set(this, null), mt.set(this, void 0), O(this, ct, i2, "f"), O(this, ht, t2, "f"), O(this, q, e2, "f"), O(this, st, s2, "f"), O(this, B, new w(this), "f"), this.$0 = this[Ct](), this[Kt](), O(this, z, v(this, z, "f"), "f"), O(this, pt, v(this, pt, "f"), "f"), O(this, mt, v(this, mt, "f"), "f"), O(this, et, v(this, et, "f"), "f"), v(this, et, "f").showHiddenOpt = v(this, L, "f"), O(this, Q, this[bt](), "f");
|
|
3803
|
+
}
|
|
3804
|
+
addHelpOpt(t2, e2) {
|
|
3805
|
+
return h("[string|boolean] [string]", [t2, e2], arguments.length), v(this, Z, "f") && (this[vt](v(this, Z, "f")), O(this, Z, null, "f")), false === t2 && void 0 === e2 || (O(this, Z, "string" == typeof t2 ? t2 : "help", "f"), this.boolean(v(this, Z, "f")), this.describe(v(this, Z, "f"), e2 || v(this, pt, "f").deferY18nLookup("Show help"))), this;
|
|
3806
|
+
}
|
|
3807
|
+
help(t2, e2) {
|
|
3808
|
+
return this.addHelpOpt(t2, e2);
|
|
3809
|
+
}
|
|
3810
|
+
addShowHiddenOpt(t2, e2) {
|
|
3811
|
+
if (h("[string|boolean] [string]", [t2, e2], arguments.length), false === t2 && void 0 === e2)
|
|
3812
|
+
return this;
|
|
3813
|
+
const s2 = "string" == typeof t2 ? t2 : v(this, L, "f");
|
|
3814
|
+
return this.boolean(s2), this.describe(s2, e2 || v(this, pt, "f").deferY18nLookup("Show hidden options")), v(this, et, "f").showHiddenOpt = s2, this;
|
|
3815
|
+
}
|
|
3816
|
+
showHidden(t2, e2) {
|
|
3817
|
+
return this.addShowHiddenOpt(t2, e2);
|
|
3818
|
+
}
|
|
3819
|
+
alias(t2, e2) {
|
|
3820
|
+
return h("<object|string|array> [string|array]", [t2, e2], arguments.length), this[Pt](this.alias.bind(this), "alias", t2, e2), this;
|
|
3821
|
+
}
|
|
3822
|
+
array(t2) {
|
|
3823
|
+
return h("<array|string>", [t2], arguments.length), this[Et]("array", t2), this[Zt](t2), this;
|
|
3824
|
+
}
|
|
3825
|
+
boolean(t2) {
|
|
3826
|
+
return h("<array|string>", [t2], arguments.length), this[Et]("boolean", t2), this[Zt](t2), this;
|
|
3827
|
+
}
|
|
3828
|
+
check(t2, e2) {
|
|
3829
|
+
return h("<function> [boolean]", [t2, e2], arguments.length), this.middleware((e3, s2) => j(() => t2(e3, s2.getOptions()), (s3) => (s3 ? ("string" == typeof s3 || s3 instanceof Error) && v(this, pt, "f").fail(s3.toString(), s3) : v(this, pt, "f").fail(v(this, ct, "f").y18n.__("Argument check failed: %s", t2.toString())), e3), (t3) => (v(this, pt, "f").fail(t3.message ? t3.message : t3.toString(), t3), e3)), false, e2), this;
|
|
3830
|
+
}
|
|
3831
|
+
choices(t2, e2) {
|
|
3832
|
+
return h("<object|string|array> [string|array]", [t2, e2], arguments.length), this[Pt](this.choices.bind(this), "choices", t2, e2), this;
|
|
3833
|
+
}
|
|
3834
|
+
coerce(t2, s2) {
|
|
3835
|
+
if (h("<object|string|array> [function]", [t2, s2], arguments.length), Array.isArray(t2)) {
|
|
3836
|
+
if (!s2)
|
|
3837
|
+
throw new e("coerce callback must be provided");
|
|
3838
|
+
for (const e2 of t2)
|
|
3839
|
+
this.coerce(e2, s2);
|
|
3840
|
+
return this;
|
|
3841
|
+
}
|
|
3842
|
+
if ("object" == typeof t2) {
|
|
3843
|
+
for (const e2 of Object.keys(t2))
|
|
3844
|
+
this.coerce(e2, t2[e2]);
|
|
3845
|
+
return this;
|
|
3846
|
+
}
|
|
3847
|
+
if (!s2)
|
|
3848
|
+
throw new e("coerce callback must be provided");
|
|
3849
|
+
return v(this, et, "f").key[t2] = true, v(this, B, "f").addCoerceMiddleware((i2, n2) => {
|
|
3850
|
+
let r2;
|
|
3851
|
+
return Object.prototype.hasOwnProperty.call(i2, t2) ? j(() => (r2 = n2.getAliases(), s2(i2[t2])), (e2) => {
|
|
3852
|
+
i2[t2] = e2;
|
|
3853
|
+
const s3 = n2.getInternalMethods().getParserConfiguration()["strip-aliased"];
|
|
3854
|
+
if (r2[t2] && true !== s3)
|
|
3855
|
+
for (const s4 of r2[t2])
|
|
3856
|
+
i2[s4] = e2;
|
|
3857
|
+
return i2;
|
|
3858
|
+
}, (t3) => {
|
|
3859
|
+
throw new e(t3.message);
|
|
3860
|
+
}) : i2;
|
|
3861
|
+
}, t2), this;
|
|
3862
|
+
}
|
|
3863
|
+
conflicts(t2, e2) {
|
|
3864
|
+
return h("<string|object> [string|array]", [t2, e2], arguments.length), v(this, mt, "f").conflicts(t2, e2), this;
|
|
3865
|
+
}
|
|
3866
|
+
config(t2 = "config", e2, s2) {
|
|
3867
|
+
return h("[object|string] [string|function] [function]", [t2, e2, s2], arguments.length), "object" != typeof t2 || Array.isArray(t2) ? ("function" == typeof e2 && (s2 = e2, e2 = void 0), this.describe(t2, e2 || v(this, pt, "f").deferY18nLookup("Path to JSON config file")), (Array.isArray(t2) ? t2 : [t2]).forEach((t3) => {
|
|
3868
|
+
v(this, et, "f").config[t3] = s2 || true;
|
|
3869
|
+
}), this) : (t2 = n(t2, v(this, q, "f"), this[jt]()["deep-merge-config"] || false, v(this, ct, "f")), v(this, et, "f").configObjects = (v(this, et, "f").configObjects || []).concat(t2), this);
|
|
3870
|
+
}
|
|
3871
|
+
completion(t2, e2, s2) {
|
|
3872
|
+
return h("[string] [string|boolean|function] [function]", [t2, e2, s2], arguments.length), "function" == typeof e2 && (s2 = e2, e2 = void 0), O(this, U, t2 || v(this, U, "f") || "completion", "f"), e2 || false === e2 || (e2 = "generate completion script"), this.command(v(this, U, "f"), e2), s2 && v(this, F, "f").registerFunction(s2), this;
|
|
3873
|
+
}
|
|
3874
|
+
command(t2, e2, s2, i2, n2, r2) {
|
|
3875
|
+
return h("<string|array|object> [string|boolean] [function|object] [function] [array] [boolean|string]", [t2, e2, s2, i2, n2, r2], arguments.length), v(this, z, "f").addHandler(t2, e2, s2, i2, n2, r2), this;
|
|
3876
|
+
}
|
|
3877
|
+
commands(t2, e2, s2, i2, n2, r2) {
|
|
3878
|
+
return this.command(t2, e2, s2, i2, n2, r2);
|
|
3879
|
+
}
|
|
3880
|
+
commandDir(t2, e2) {
|
|
3881
|
+
h("<string> [object]", [t2, e2], arguments.length);
|
|
3882
|
+
const s2 = v(this, st, "f") || v(this, ct, "f").require;
|
|
3883
|
+
return v(this, z, "f").addDirectory(t2, s2, v(this, ct, "f").getCallerFile(), e2), this;
|
|
3884
|
+
}
|
|
3885
|
+
count(t2) {
|
|
3886
|
+
return h("<array|string>", [t2], arguments.length), this[Et]("count", t2), this[Zt](t2), this;
|
|
3887
|
+
}
|
|
3888
|
+
default(t2, e2, s2) {
|
|
3889
|
+
return h("<object|string|array> [*] [string]", [t2, e2, s2], arguments.length), s2 && (u(t2, v(this, ct, "f")), v(this, et, "f").defaultDescription[t2] = s2), "function" == typeof e2 && (u(t2, v(this, ct, "f")), v(this, et, "f").defaultDescription[t2] || (v(this, et, "f").defaultDescription[t2] = v(this, pt, "f").functionDescription(e2)), e2 = e2.call()), this[At](this.default.bind(this), "default", t2, e2), this;
|
|
3890
|
+
}
|
|
3891
|
+
defaults(t2, e2, s2) {
|
|
3892
|
+
return this.default(t2, e2, s2);
|
|
3893
|
+
}
|
|
3894
|
+
demandCommand(t2 = 1, e2, s2, i2) {
|
|
3895
|
+
return h("[number] [number|string] [string|null|undefined] [string|null|undefined]", [t2, e2, s2, i2], arguments.length), "number" != typeof e2 && (s2 = e2, e2 = 1 / 0), this.global("_", false), v(this, et, "f").demandedCommands._ = { min: t2, max: e2, minMsg: s2, maxMsg: i2 }, this;
|
|
3896
|
+
}
|
|
3897
|
+
demand(t2, e2, s2) {
|
|
3898
|
+
return Array.isArray(e2) ? (e2.forEach((t3) => {
|
|
3899
|
+
d(s2, true, v(this, ct, "f")), this.demandOption(t3, s2);
|
|
3900
|
+
}), e2 = 1 / 0) : "number" != typeof e2 && (s2 = e2, e2 = 1 / 0), "number" == typeof t2 ? (d(s2, true, v(this, ct, "f")), this.demandCommand(t2, e2, s2, s2)) : Array.isArray(t2) ? t2.forEach((t3) => {
|
|
3901
|
+
d(s2, true, v(this, ct, "f")), this.demandOption(t3, s2);
|
|
3902
|
+
}) : "string" == typeof s2 ? this.demandOption(t2, s2) : true !== s2 && void 0 !== s2 || this.demandOption(t2), this;
|
|
3903
|
+
}
|
|
3904
|
+
demandOption(t2, e2) {
|
|
3905
|
+
return h("<object|string|array> [string]", [t2, e2], arguments.length), this[At](this.demandOption.bind(this), "demandedOptions", t2, e2), this;
|
|
3906
|
+
}
|
|
3907
|
+
deprecateOption(t2, e2) {
|
|
3908
|
+
return h("<string> [string|boolean]", [t2, e2], arguments.length), v(this, et, "f").deprecatedOptions[t2] = e2, this;
|
|
3909
|
+
}
|
|
3910
|
+
describe(t2, e2) {
|
|
3911
|
+
return h("<object|string|array> [string]", [t2, e2], arguments.length), this[It](t2, true), v(this, pt, "f").describe(t2, e2), this;
|
|
3912
|
+
}
|
|
3913
|
+
detectLocale(t2) {
|
|
3914
|
+
return h("<boolean>", [t2], arguments.length), O(this, G, t2, "f"), this;
|
|
3915
|
+
}
|
|
3916
|
+
env(t2) {
|
|
3917
|
+
return h("[string|boolean]", [t2], arguments.length), false === t2 ? delete v(this, et, "f").envPrefix : v(this, et, "f").envPrefix = t2 || "", this;
|
|
3918
|
+
}
|
|
3919
|
+
epilogue(t2) {
|
|
3920
|
+
return h("<string>", [t2], arguments.length), v(this, pt, "f").epilog(t2), this;
|
|
3921
|
+
}
|
|
3922
|
+
epilog(t2) {
|
|
3923
|
+
return this.epilogue(t2);
|
|
3924
|
+
}
|
|
3925
|
+
example(t2, e2) {
|
|
3926
|
+
return h("<string|array> [string]", [t2, e2], arguments.length), Array.isArray(t2) ? t2.forEach((t3) => this.example(...t3)) : v(this, pt, "f").example(t2, e2), this;
|
|
3927
|
+
}
|
|
3928
|
+
exit(t2, e2) {
|
|
3929
|
+
O(this, J, true, "f"), O(this, V, e2, "f"), v(this, T, "f") && v(this, ct, "f").process.exit(t2);
|
|
3930
|
+
}
|
|
3931
|
+
exitProcess(t2 = true) {
|
|
3932
|
+
return h("[boolean]", [t2], arguments.length), O(this, T, t2, "f"), this;
|
|
3933
|
+
}
|
|
3934
|
+
fail(t2) {
|
|
3935
|
+
if (h("<function|boolean>", [t2], arguments.length), "boolean" == typeof t2 && false !== t2)
|
|
3936
|
+
throw new e("Invalid first argument. Expected function or boolean 'false'");
|
|
3937
|
+
return v(this, pt, "f").failFn(t2), this;
|
|
3938
|
+
}
|
|
3939
|
+
getAliases() {
|
|
3940
|
+
return this.parsed ? this.parsed.aliases : {};
|
|
3941
|
+
}
|
|
3942
|
+
async getCompletion(t2, e2) {
|
|
3943
|
+
return h("<array> [function]", [t2, e2], arguments.length), e2 ? v(this, F, "f").getCompletion(t2, e2) : new Promise((e3, s2) => {
|
|
3944
|
+
v(this, F, "f").getCompletion(t2, (t3, i2) => {
|
|
3945
|
+
t3 ? s2(t3) : e3(i2);
|
|
3946
|
+
});
|
|
3947
|
+
});
|
|
3948
|
+
}
|
|
3949
|
+
getDemandedOptions() {
|
|
3950
|
+
return h([], 0), v(this, et, "f").demandedOptions;
|
|
3951
|
+
}
|
|
3952
|
+
getDemandedCommands() {
|
|
3953
|
+
return h([], 0), v(this, et, "f").demandedCommands;
|
|
3954
|
+
}
|
|
3955
|
+
getDeprecatedOptions() {
|
|
3956
|
+
return h([], 0), v(this, et, "f").deprecatedOptions;
|
|
3957
|
+
}
|
|
3958
|
+
getDetectLocale() {
|
|
3959
|
+
return v(this, G, "f");
|
|
3960
|
+
}
|
|
3961
|
+
getExitProcess() {
|
|
3962
|
+
return v(this, T, "f");
|
|
3963
|
+
}
|
|
3964
|
+
getGroups() {
|
|
3965
|
+
return Object.assign({}, v(this, Y, "f"), v(this, at, "f"));
|
|
3966
|
+
}
|
|
3967
|
+
getHelp() {
|
|
3968
|
+
if (O(this, J, true, "f"), !v(this, pt, "f").hasCachedHelpMessage()) {
|
|
3969
|
+
if (!this.parsed) {
|
|
3970
|
+
const t3 = this[Bt](v(this, ht, "f"), void 0, void 0, 0, true);
|
|
3971
|
+
if (f(t3))
|
|
3972
|
+
return t3.then(() => v(this, pt, "f").help());
|
|
3973
|
+
}
|
|
3974
|
+
const t2 = v(this, z, "f").runDefaultBuilderOn(this);
|
|
3975
|
+
if (f(t2))
|
|
3976
|
+
return t2.then(() => v(this, pt, "f").help());
|
|
3977
|
+
}
|
|
3978
|
+
return Promise.resolve(v(this, pt, "f").help());
|
|
3979
|
+
}
|
|
3980
|
+
getOptions() {
|
|
3981
|
+
return v(this, et, "f");
|
|
3982
|
+
}
|
|
3983
|
+
getStrict() {
|
|
3984
|
+
return v(this, ft, "f");
|
|
3985
|
+
}
|
|
3986
|
+
getStrictCommands() {
|
|
3987
|
+
return v(this, dt, "f");
|
|
3988
|
+
}
|
|
3989
|
+
getStrictOptions() {
|
|
3990
|
+
return v(this, ut, "f");
|
|
3991
|
+
}
|
|
3992
|
+
global(t2, e2) {
|
|
3993
|
+
return h("<string|array> [boolean]", [t2, e2], arguments.length), t2 = [].concat(t2), false !== e2 ? v(this, et, "f").local = v(this, et, "f").local.filter((e3) => -1 === t2.indexOf(e3)) : t2.forEach((t3) => {
|
|
3994
|
+
v(this, et, "f").local.includes(t3) || v(this, et, "f").local.push(t3);
|
|
3995
|
+
}), this;
|
|
3996
|
+
}
|
|
3997
|
+
group(t2, e2) {
|
|
3998
|
+
h("<string|array> <string>", [t2, e2], arguments.length);
|
|
3999
|
+
const s2 = v(this, at, "f")[e2] || v(this, Y, "f")[e2];
|
|
4000
|
+
v(this, at, "f")[e2] && delete v(this, at, "f")[e2];
|
|
4001
|
+
const i2 = {};
|
|
4002
|
+
return v(this, Y, "f")[e2] = (s2 || []).concat(t2).filter((t3) => !i2[t3] && (i2[t3] = true)), this;
|
|
4003
|
+
}
|
|
4004
|
+
hide(t2) {
|
|
4005
|
+
return h("<string>", [t2], arguments.length), v(this, et, "f").hiddenOptions.push(t2), this;
|
|
4006
|
+
}
|
|
4007
|
+
implies(t2, e2) {
|
|
4008
|
+
return h("<string|object> [number|string|array]", [t2, e2], arguments.length), v(this, mt, "f").implies(t2, e2), this;
|
|
4009
|
+
}
|
|
4010
|
+
locale(t2) {
|
|
4011
|
+
return h("[string]", [t2], arguments.length), void 0 === t2 ? (this[_t](), v(this, ct, "f").y18n.getLocale()) : (O(this, G, false, "f"), v(this, ct, "f").y18n.setLocale(t2), this);
|
|
4012
|
+
}
|
|
4013
|
+
middleware(t2, e2, s2) {
|
|
4014
|
+
return v(this, B, "f").addMiddleware(t2, !!e2, s2);
|
|
4015
|
+
}
|
|
4016
|
+
nargs(t2, e2) {
|
|
4017
|
+
return h("<string|object|array> [number]", [t2, e2], arguments.length), this[At](this.nargs.bind(this), "narg", t2, e2), this;
|
|
4018
|
+
}
|
|
4019
|
+
normalize(t2) {
|
|
4020
|
+
return h("<array|string>", [t2], arguments.length), this[Et]("normalize", t2), this;
|
|
4021
|
+
}
|
|
4022
|
+
number(t2) {
|
|
4023
|
+
return h("<array|string>", [t2], arguments.length), this[Et]("number", t2), this[Zt](t2), this;
|
|
4024
|
+
}
|
|
4025
|
+
option(t2, e2) {
|
|
4026
|
+
if (h("<string|object> [object]", [t2, e2], arguments.length), "object" == typeof t2)
|
|
4027
|
+
Object.keys(t2).forEach((e3) => {
|
|
4028
|
+
this.options(e3, t2[e3]);
|
|
4029
|
+
});
|
|
4030
|
+
else {
|
|
4031
|
+
"object" != typeof e2 && (e2 = {}), this[Zt](t2), !v(this, gt, "f") || "version" !== t2 && "version" !== (null == e2 ? void 0 : e2.alias) || this[Ot](['"version" is a reserved word.', "Please do one of the following:", '- Disable version with `yargs.version(false)` if using "version" as an option', "- Use the built-in `yargs.version` method instead (if applicable)", "- Use a different option key", "https://yargs.js.org/docs/#api-reference-version"].join("\n"), void 0, "versionWarning"), v(this, et, "f").key[t2] = true, e2.alias && this.alias(t2, e2.alias);
|
|
4032
|
+
const s2 = e2.deprecate || e2.deprecated;
|
|
4033
|
+
s2 && this.deprecateOption(t2, s2);
|
|
4034
|
+
const i2 = e2.demand || e2.required || e2.require;
|
|
4035
|
+
i2 && this.demand(t2, i2), e2.demandOption && this.demandOption(t2, "string" == typeof e2.demandOption ? e2.demandOption : void 0), e2.conflicts && this.conflicts(t2, e2.conflicts), "default" in e2 && this.default(t2, e2.default), void 0 !== e2.implies && this.implies(t2, e2.implies), void 0 !== e2.nargs && this.nargs(t2, e2.nargs), e2.config && this.config(t2, e2.configParser), e2.normalize && this.normalize(t2), e2.choices && this.choices(t2, e2.choices), e2.coerce && this.coerce(t2, e2.coerce), e2.group && this.group(t2, e2.group), (e2.boolean || "boolean" === e2.type) && (this.boolean(t2), e2.alias && this.boolean(e2.alias)), (e2.array || "array" === e2.type) && (this.array(t2), e2.alias && this.array(e2.alias)), (e2.number || "number" === e2.type) && (this.number(t2), e2.alias && this.number(e2.alias)), (e2.string || "string" === e2.type) && (this.string(t2), e2.alias && this.string(e2.alias)), (e2.count || "count" === e2.type) && this.count(t2), "boolean" == typeof e2.global && this.global(t2, e2.global), e2.defaultDescription && (v(this, et, "f").defaultDescription[t2] = e2.defaultDescription), e2.skipValidation && this.skipValidation(t2);
|
|
4036
|
+
const n2 = e2.describe || e2.description || e2.desc;
|
|
4037
|
+
this.describe(t2, n2), e2.hidden && this.hide(t2), e2.requiresArg && this.requiresArg(t2);
|
|
4038
|
+
}
|
|
4039
|
+
return this;
|
|
4040
|
+
}
|
|
4041
|
+
options(t2, e2) {
|
|
4042
|
+
return this.option(t2, e2);
|
|
4043
|
+
}
|
|
4044
|
+
parse(t2, e2, s2) {
|
|
4045
|
+
h("[string|array] [function|boolean|object] [function]", [t2, e2, s2], arguments.length), this[wt](), void 0 === t2 && (t2 = v(this, ht, "f")), "object" == typeof e2 && (O(this, rt, e2, "f"), e2 = s2), "function" == typeof e2 && (O(this, nt, e2, "f"), e2 = false), e2 || O(this, ht, t2, "f"), v(this, nt, "f") && O(this, T, false, "f");
|
|
4046
|
+
const i2 = this[Bt](t2, !!e2), n2 = this.parsed;
|
|
4047
|
+
return v(this, F, "f").setParsed(this.parsed), f(i2) ? i2.then((t3) => (v(this, nt, "f") && v(this, nt, "f").call(this, v(this, V, "f"), t3, v(this, tt, "f")), t3)).catch((t3) => {
|
|
4048
|
+
throw v(this, nt, "f") && v(this, nt, "f")(t3, this.parsed.argv, v(this, tt, "f")), t3;
|
|
4049
|
+
}).finally(() => {
|
|
4050
|
+
this[Dt](), this.parsed = n2;
|
|
4051
|
+
}) : (v(this, nt, "f") && v(this, nt, "f").call(this, v(this, V, "f"), i2, v(this, tt, "f")), this[Dt](), this.parsed = n2, i2);
|
|
4052
|
+
}
|
|
4053
|
+
parseAsync(t2, e2, s2) {
|
|
4054
|
+
const i2 = this.parse(t2, e2, s2);
|
|
4055
|
+
return f(i2) ? i2 : Promise.resolve(i2);
|
|
4056
|
+
}
|
|
4057
|
+
parseSync(t2, s2, i2) {
|
|
4058
|
+
const n2 = this.parse(t2, s2, i2);
|
|
4059
|
+
if (f(n2))
|
|
4060
|
+
throw new e(".parseSync() must not be used with asynchronous builders, handlers, or middleware");
|
|
4061
|
+
return n2;
|
|
4062
|
+
}
|
|
4063
|
+
parserConfiguration(t2) {
|
|
4064
|
+
return h("<object>", [t2], arguments.length), O(this, it, t2, "f"), this;
|
|
4065
|
+
}
|
|
4066
|
+
pkgConf(t2, e2) {
|
|
4067
|
+
h("<string> [string]", [t2, e2], arguments.length);
|
|
4068
|
+
let s2 = null;
|
|
4069
|
+
const i2 = this[xt](e2 || v(this, q, "f"));
|
|
4070
|
+
return i2[t2] && "object" == typeof i2[t2] && (s2 = n(i2[t2], e2 || v(this, q, "f"), this[jt]()["deep-merge-config"] || false, v(this, ct, "f")), v(this, et, "f").configObjects = (v(this, et, "f").configObjects || []).concat(s2)), this;
|
|
4071
|
+
}
|
|
4072
|
+
positional(t2, e2) {
|
|
4073
|
+
h("<string> <object>", [t2, e2], arguments.length);
|
|
4074
|
+
const s2 = ["default", "defaultDescription", "implies", "normalize", "choices", "conflicts", "coerce", "type", "describe", "desc", "description", "alias"];
|
|
4075
|
+
e2 = g(e2, (t3, e3) => !("type" === t3 && !["string", "number", "boolean"].includes(e3)) && s2.includes(t3));
|
|
4076
|
+
const i2 = v(this, W, "f").fullCommands[v(this, W, "f").fullCommands.length - 1], n2 = i2 ? v(this, z, "f").cmdToParseOptions(i2) : { array: [], alias: {}, default: {}, demand: {} };
|
|
4077
|
+
return p(n2).forEach((s3) => {
|
|
4078
|
+
const i3 = n2[s3];
|
|
4079
|
+
Array.isArray(i3) ? -1 !== i3.indexOf(t2) && (e2[s3] = true) : i3[t2] && !(s3 in e2) && (e2[s3] = i3[t2]);
|
|
4080
|
+
}), this.group(t2, v(this, pt, "f").getPositionalGroupName()), this.option(t2, e2);
|
|
4081
|
+
}
|
|
4082
|
+
recommendCommands(t2 = true) {
|
|
4083
|
+
return h("[boolean]", [t2], arguments.length), O(this, lt, t2, "f"), this;
|
|
4084
|
+
}
|
|
4085
|
+
required(t2, e2, s2) {
|
|
4086
|
+
return this.demand(t2, e2, s2);
|
|
4087
|
+
}
|
|
4088
|
+
require(t2, e2, s2) {
|
|
4089
|
+
return this.demand(t2, e2, s2);
|
|
4090
|
+
}
|
|
4091
|
+
requiresArg(t2) {
|
|
4092
|
+
return h("<array|string|object> [number]", [t2], arguments.length), "string" == typeof t2 && v(this, et, "f").narg[t2] || this[At](this.requiresArg.bind(this), "narg", t2, NaN), this;
|
|
4093
|
+
}
|
|
4094
|
+
showCompletionScript(t2, e2) {
|
|
4095
|
+
return h("[string] [string]", [t2, e2], arguments.length), t2 = t2 || this.$0, v(this, Q, "f").log(v(this, F, "f").generateCompletionScript(t2, e2 || v(this, U, "f") || "completion")), this;
|
|
4096
|
+
}
|
|
4097
|
+
showHelp(t2) {
|
|
4098
|
+
if (h("[string|function]", [t2], arguments.length), O(this, J, true, "f"), !v(this, pt, "f").hasCachedHelpMessage()) {
|
|
4099
|
+
if (!this.parsed) {
|
|
4100
|
+
const e3 = this[Bt](v(this, ht, "f"), void 0, void 0, 0, true);
|
|
4101
|
+
if (f(e3))
|
|
4102
|
+
return e3.then(() => {
|
|
4103
|
+
v(this, pt, "f").showHelp(t2);
|
|
4104
|
+
}), this;
|
|
4105
|
+
}
|
|
4106
|
+
const e2 = v(this, z, "f").runDefaultBuilderOn(this);
|
|
4107
|
+
if (f(e2))
|
|
4108
|
+
return e2.then(() => {
|
|
4109
|
+
v(this, pt, "f").showHelp(t2);
|
|
4110
|
+
}), this;
|
|
4111
|
+
}
|
|
4112
|
+
return v(this, pt, "f").showHelp(t2), this;
|
|
4113
|
+
}
|
|
4114
|
+
scriptName(t2) {
|
|
4115
|
+
return this.customScriptName = true, this.$0 = t2, this;
|
|
4116
|
+
}
|
|
4117
|
+
showHelpOnFail(t2, e2) {
|
|
4118
|
+
return h("[boolean|string] [string]", [t2, e2], arguments.length), v(this, pt, "f").showHelpOnFail(t2, e2), this;
|
|
4119
|
+
}
|
|
4120
|
+
showVersion(t2) {
|
|
4121
|
+
return h("[string|function]", [t2], arguments.length), v(this, pt, "f").showVersion(t2), this;
|
|
4122
|
+
}
|
|
4123
|
+
skipValidation(t2) {
|
|
4124
|
+
return h("<array|string>", [t2], arguments.length), this[Et]("skipValidation", t2), this;
|
|
4125
|
+
}
|
|
4126
|
+
strict(t2) {
|
|
4127
|
+
return h("[boolean]", [t2], arguments.length), O(this, ft, false !== t2, "f"), this;
|
|
4128
|
+
}
|
|
4129
|
+
strictCommands(t2) {
|
|
4130
|
+
return h("[boolean]", [t2], arguments.length), O(this, dt, false !== t2, "f"), this;
|
|
4131
|
+
}
|
|
4132
|
+
strictOptions(t2) {
|
|
4133
|
+
return h("[boolean]", [t2], arguments.length), O(this, ut, false !== t2, "f"), this;
|
|
4134
|
+
}
|
|
4135
|
+
string(t2) {
|
|
4136
|
+
return h("<array|string>", [t2], arguments.length), this[Et]("string", t2), this[Zt](t2), this;
|
|
4137
|
+
}
|
|
4138
|
+
terminalWidth() {
|
|
4139
|
+
return h([], 0), v(this, ct, "f").process.stdColumns;
|
|
4140
|
+
}
|
|
4141
|
+
updateLocale(t2) {
|
|
4142
|
+
return this.updateStrings(t2);
|
|
4143
|
+
}
|
|
4144
|
+
updateStrings(t2) {
|
|
4145
|
+
return h("<object>", [t2], arguments.length), O(this, G, false, "f"), v(this, ct, "f").y18n.updateLocale(t2), this;
|
|
4146
|
+
}
|
|
4147
|
+
usage(t2, s2, i2, n2) {
|
|
4148
|
+
if (h("<string|null|undefined> [string|boolean] [function|object] [function]", [t2, s2, i2, n2], arguments.length), void 0 !== s2) {
|
|
4149
|
+
if (d(t2, null, v(this, ct, "f")), (t2 || "").match(/^\$0( |$)/))
|
|
4150
|
+
return this.command(t2, s2, i2, n2);
|
|
4151
|
+
throw new e(".usage() description must start with $0 if being used as alias for .command()");
|
|
4152
|
+
}
|
|
4153
|
+
return v(this, pt, "f").usage(t2), this;
|
|
4154
|
+
}
|
|
4155
|
+
version(t2, e2, s2) {
|
|
4156
|
+
const i2 = "version";
|
|
4157
|
+
if (h("[boolean|string] [string] [string]", [t2, e2, s2], arguments.length), v(this, gt, "f") && (this[vt](v(this, gt, "f")), v(this, pt, "f").version(void 0), O(this, gt, null, "f")), 0 === arguments.length)
|
|
4158
|
+
s2 = this[Mt](), t2 = i2;
|
|
4159
|
+
else if (1 === arguments.length) {
|
|
4160
|
+
if (false === t2)
|
|
4161
|
+
return this;
|
|
4162
|
+
s2 = t2, t2 = i2;
|
|
4163
|
+
} else
|
|
4164
|
+
2 === arguments.length && (s2 = e2, e2 = void 0);
|
|
4165
|
+
return O(this, gt, "string" == typeof t2 ? t2 : i2, "f"), e2 = e2 || v(this, pt, "f").deferY18nLookup("Show version number"), v(this, pt, "f").version(s2 || void 0), this.boolean(v(this, gt, "f")), this.describe(v(this, gt, "f"), e2), this;
|
|
4166
|
+
}
|
|
4167
|
+
wrap(t2) {
|
|
4168
|
+
return h("<number|null|undefined>", [t2], arguments.length), v(this, pt, "f").wrap(t2), this;
|
|
4169
|
+
}
|
|
4170
|
+
[(z = /* @__PURE__ */ new WeakMap(), q = /* @__PURE__ */ new WeakMap(), W = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), U = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakMap(), G = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap(), T = /* @__PURE__ */ new WeakMap(), K = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakMap(), Y = /* @__PURE__ */ new WeakMap(), J = /* @__PURE__ */ new WeakMap(), Z = /* @__PURE__ */ new WeakMap(), X = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(), tt = /* @__PURE__ */ new WeakMap(), et = /* @__PURE__ */ new WeakMap(), st = /* @__PURE__ */ new WeakMap(), it = /* @__PURE__ */ new WeakMap(), nt = /* @__PURE__ */ new WeakMap(), rt = /* @__PURE__ */ new WeakMap(), ot = /* @__PURE__ */ new WeakMap(), at = /* @__PURE__ */ new WeakMap(), ht = /* @__PURE__ */ new WeakMap(), lt = /* @__PURE__ */ new WeakMap(), ct = /* @__PURE__ */ new WeakMap(), ft = /* @__PURE__ */ new WeakMap(), dt = /* @__PURE__ */ new WeakMap(), ut = /* @__PURE__ */ new WeakMap(), pt = /* @__PURE__ */ new WeakMap(), gt = /* @__PURE__ */ new WeakMap(), mt = /* @__PURE__ */ new WeakMap(), yt)](t2) {
|
|
4171
|
+
if (!t2._ || !t2["--"])
|
|
4172
|
+
return t2;
|
|
4173
|
+
t2._.push.apply(t2._, t2["--"]);
|
|
4174
|
+
try {
|
|
4175
|
+
delete t2["--"];
|
|
4176
|
+
} catch (t3) {
|
|
4177
|
+
}
|
|
4178
|
+
return t2;
|
|
4179
|
+
}
|
|
4180
|
+
[bt]() {
|
|
4181
|
+
return { log: (...t2) => {
|
|
4182
|
+
this[Vt]() || console.log(...t2), O(this, J, true, "f"), v(this, tt, "f").length && O(this, tt, v(this, tt, "f") + "\n", "f"), O(this, tt, v(this, tt, "f") + t2.join(" "), "f");
|
|
4183
|
+
}, error: (...t2) => {
|
|
4184
|
+
this[Vt]() || console.error(...t2), O(this, J, true, "f"), v(this, tt, "f").length && O(this, tt, v(this, tt, "f") + "\n", "f"), O(this, tt, v(this, tt, "f") + t2.join(" "), "f");
|
|
4185
|
+
} };
|
|
4186
|
+
}
|
|
4187
|
+
[vt](t2) {
|
|
4188
|
+
p(v(this, et, "f")).forEach((e2) => {
|
|
4189
|
+
if ("configObjects" === e2)
|
|
4190
|
+
return;
|
|
4191
|
+
const s2 = v(this, et, "f")[e2];
|
|
4192
|
+
Array.isArray(s2) ? s2.includes(t2) && s2.splice(s2.indexOf(t2), 1) : "object" == typeof s2 && delete s2[t2];
|
|
4193
|
+
}), delete v(this, pt, "f").getDescriptions()[t2];
|
|
4194
|
+
}
|
|
4195
|
+
[Ot](t2, e2, s2) {
|
|
4196
|
+
v(this, R, "f")[s2] || (v(this, ct, "f").process.emitWarning(t2, e2), v(this, R, "f")[s2] = true);
|
|
4197
|
+
}
|
|
4198
|
+
[wt]() {
|
|
4199
|
+
v(this, K, "f").push({ options: v(this, et, "f"), configObjects: v(this, et, "f").configObjects.slice(0), exitProcess: v(this, T, "f"), groups: v(this, Y, "f"), strict: v(this, ft, "f"), strictCommands: v(this, dt, "f"), strictOptions: v(this, ut, "f"), completionCommand: v(this, U, "f"), output: v(this, tt, "f"), exitError: v(this, V, "f"), hasOutput: v(this, J, "f"), parsed: this.parsed, parseFn: v(this, nt, "f"), parseContext: v(this, rt, "f") }), v(this, pt, "f").freeze(), v(this, mt, "f").freeze(), v(this, z, "f").freeze(), v(this, B, "f").freeze();
|
|
4200
|
+
}
|
|
4201
|
+
[Ct]() {
|
|
4202
|
+
let t2, e2 = "";
|
|
4203
|
+
return t2 = /\b(node|iojs|electron)(\.exe)?$/.test(v(this, ct, "f").process.argv()[0]) ? v(this, ct, "f").process.argv().slice(1, 2) : v(this, ct, "f").process.argv().slice(0, 1), e2 = t2.map((t3) => {
|
|
4204
|
+
const e3 = this[Tt](v(this, q, "f"), t3);
|
|
4205
|
+
return t3.match(/^(\/|([a-zA-Z]:)?\\)/) && e3.length < t3.length ? e3 : t3;
|
|
4206
|
+
}).join(" ").trim(), v(this, ct, "f").getEnv("_") && v(this, ct, "f").getProcessArgvBin() === v(this, ct, "f").getEnv("_") && (e2 = v(this, ct, "f").getEnv("_").replace(`${v(this, ct, "f").path.dirname(v(this, ct, "f").process.execPath())}/`, "")), e2;
|
|
4207
|
+
}
|
|
4208
|
+
[jt]() {
|
|
4209
|
+
return v(this, it, "f");
|
|
4210
|
+
}
|
|
4211
|
+
[_t]() {
|
|
4212
|
+
if (!v(this, G, "f"))
|
|
4213
|
+
return;
|
|
4214
|
+
const t2 = v(this, ct, "f").getEnv("LC_ALL") || v(this, ct, "f").getEnv("LC_MESSAGES") || v(this, ct, "f").getEnv("LANG") || v(this, ct, "f").getEnv("LANGUAGE") || "en_US";
|
|
4215
|
+
this.locale(t2.replace(/[.:].*/, ""));
|
|
4216
|
+
}
|
|
4217
|
+
[Mt]() {
|
|
4218
|
+
return this[xt]().version || "unknown";
|
|
4219
|
+
}
|
|
4220
|
+
[kt](t2) {
|
|
4221
|
+
const e2 = t2["--"] ? t2["--"] : t2._;
|
|
4222
|
+
for (let t3, s2 = 0; void 0 !== (t3 = e2[s2]); s2++)
|
|
4223
|
+
v(this, ct, "f").Parser.looksLikeNumber(t3) && Number.isSafeInteger(Math.floor(parseFloat(`${t3}`))) && (e2[s2] = Number(t3));
|
|
4224
|
+
return t2;
|
|
4225
|
+
}
|
|
4226
|
+
[xt](t2) {
|
|
4227
|
+
const e2 = t2 || "*";
|
|
4228
|
+
if (v(this, ot, "f")[e2])
|
|
4229
|
+
return v(this, ot, "f")[e2];
|
|
4230
|
+
let s2 = {};
|
|
4231
|
+
try {
|
|
4232
|
+
let e3 = t2 || v(this, ct, "f").mainFilename;
|
|
4233
|
+
!t2 && v(this, ct, "f").path.extname(e3) && (e3 = v(this, ct, "f").path.dirname(e3));
|
|
4234
|
+
const i2 = v(this, ct, "f").findUp(e3, (t3, e4) => e4.includes("package.json") ? "package.json" : void 0);
|
|
4235
|
+
d(i2, void 0, v(this, ct, "f")), s2 = JSON.parse(v(this, ct, "f").readFileSync(i2, "utf8"));
|
|
4236
|
+
} catch (t3) {
|
|
4237
|
+
}
|
|
4238
|
+
return v(this, ot, "f")[e2] = s2 || {}, v(this, ot, "f")[e2];
|
|
4239
|
+
}
|
|
4240
|
+
[Et](t2, e2) {
|
|
4241
|
+
(e2 = [].concat(e2)).forEach((e3) => {
|
|
4242
|
+
e3 = this[$t](e3), v(this, et, "f")[t2].push(e3);
|
|
4243
|
+
});
|
|
4244
|
+
}
|
|
4245
|
+
[At](t2, e2, s2, i2) {
|
|
4246
|
+
this[St](t2, e2, s2, i2, (t3, e3, s3) => {
|
|
4247
|
+
v(this, et, "f")[t3][e3] = s3;
|
|
4248
|
+
});
|
|
4249
|
+
}
|
|
4250
|
+
[Pt](t2, e2, s2, i2) {
|
|
4251
|
+
this[St](t2, e2, s2, i2, (t3, e3, s3) => {
|
|
4252
|
+
v(this, et, "f")[t3][e3] = (v(this, et, "f")[t3][e3] || []).concat(s3);
|
|
4253
|
+
});
|
|
4254
|
+
}
|
|
4255
|
+
[St](t2, e2, s2, i2, n2) {
|
|
4256
|
+
if (Array.isArray(s2))
|
|
4257
|
+
s2.forEach((e3) => {
|
|
4258
|
+
t2(e3, i2);
|
|
4259
|
+
});
|
|
4260
|
+
else if (((t3) => "object" == typeof t3)(s2))
|
|
4261
|
+
for (const e3 of p(s2))
|
|
4262
|
+
t2(e3, s2[e3]);
|
|
4263
|
+
else
|
|
4264
|
+
n2(e2, this[$t](s2), i2);
|
|
4265
|
+
}
|
|
4266
|
+
[$t](t2) {
|
|
4267
|
+
return "__proto__" === t2 ? "___proto___" : t2;
|
|
4268
|
+
}
|
|
4269
|
+
[It](t2, e2) {
|
|
4270
|
+
return this[At](this[It].bind(this), "key", t2, e2), this;
|
|
4271
|
+
}
|
|
4272
|
+
[Dt]() {
|
|
4273
|
+
var t2, e2, s2, i2, n2, r2, o2, a2, h2, l2, c2, f2;
|
|
4274
|
+
const u2 = v(this, K, "f").pop();
|
|
4275
|
+
let p2;
|
|
4276
|
+
d(u2, void 0, v(this, ct, "f")), t2 = this, e2 = this, s2 = this, i2 = this, n2 = this, r2 = this, o2 = this, a2 = this, h2 = this, l2 = this, c2 = this, f2 = this, { options: { set value(e3) {
|
|
4277
|
+
O(t2, et, e3, "f");
|
|
4278
|
+
} }.value, configObjects: p2, exitProcess: { set value(t3) {
|
|
4279
|
+
O(e2, T, t3, "f");
|
|
4280
|
+
} }.value, groups: { set value(t3) {
|
|
4281
|
+
O(s2, Y, t3, "f");
|
|
4282
|
+
} }.value, output: { set value(t3) {
|
|
4283
|
+
O(i2, tt, t3, "f");
|
|
4284
|
+
} }.value, exitError: { set value(t3) {
|
|
4285
|
+
O(n2, V, t3, "f");
|
|
4286
|
+
} }.value, hasOutput: { set value(t3) {
|
|
4287
|
+
O(r2, J, t3, "f");
|
|
4288
|
+
} }.value, parsed: this.parsed, strict: { set value(t3) {
|
|
4289
|
+
O(o2, ft, t3, "f");
|
|
4290
|
+
} }.value, strictCommands: { set value(t3) {
|
|
4291
|
+
O(a2, dt, t3, "f");
|
|
4292
|
+
} }.value, strictOptions: { set value(t3) {
|
|
4293
|
+
O(h2, ut, t3, "f");
|
|
4294
|
+
} }.value, completionCommand: { set value(t3) {
|
|
4295
|
+
O(l2, U, t3, "f");
|
|
4296
|
+
} }.value, parseFn: { set value(t3) {
|
|
4297
|
+
O(c2, nt, t3, "f");
|
|
4298
|
+
} }.value, parseContext: { set value(t3) {
|
|
4299
|
+
O(f2, rt, t3, "f");
|
|
4300
|
+
} }.value } = u2, v(this, et, "f").configObjects = p2, v(this, pt, "f").unfreeze(), v(this, mt, "f").unfreeze(), v(this, z, "f").unfreeze(), v(this, B, "f").unfreeze();
|
|
4301
|
+
}
|
|
4302
|
+
[Nt](t2, e2) {
|
|
4303
|
+
return j(e2, (e3) => (t2(e3), e3));
|
|
4304
|
+
}
|
|
4305
|
+
getInternalMethods() {
|
|
4306
|
+
return { getCommandInstance: this[Ht].bind(this), getContext: this[zt].bind(this), getHasOutput: this[qt].bind(this), getLoggerInstance: this[Wt].bind(this), getParseContext: this[Ft].bind(this), getParserConfiguration: this[jt].bind(this), getUsageInstance: this[Ut].bind(this), getValidationInstance: this[Lt].bind(this), hasParseCallback: this[Vt].bind(this), isGlobalContext: this[Gt].bind(this), postProcess: this[Rt].bind(this), reset: this[Kt].bind(this), runValidation: this[Yt].bind(this), runYargsParserAndExecuteCommands: this[Bt].bind(this), setHasOutput: this[Jt].bind(this) };
|
|
4307
|
+
}
|
|
4308
|
+
[Ht]() {
|
|
4309
|
+
return v(this, z, "f");
|
|
4310
|
+
}
|
|
4311
|
+
[zt]() {
|
|
4312
|
+
return v(this, W, "f");
|
|
4313
|
+
}
|
|
4314
|
+
[qt]() {
|
|
4315
|
+
return v(this, J, "f");
|
|
4316
|
+
}
|
|
4317
|
+
[Wt]() {
|
|
4318
|
+
return v(this, Q, "f");
|
|
4319
|
+
}
|
|
4320
|
+
[Ft]() {
|
|
4321
|
+
return v(this, rt, "f") || {};
|
|
4322
|
+
}
|
|
4323
|
+
[Ut]() {
|
|
4324
|
+
return v(this, pt, "f");
|
|
4325
|
+
}
|
|
4326
|
+
[Lt]() {
|
|
4327
|
+
return v(this, mt, "f");
|
|
4328
|
+
}
|
|
4329
|
+
[Vt]() {
|
|
4330
|
+
return !!v(this, nt, "f");
|
|
4331
|
+
}
|
|
4332
|
+
[Gt]() {
|
|
4333
|
+
return v(this, X, "f");
|
|
4334
|
+
}
|
|
4335
|
+
[Rt](t2, e2, s2, i2) {
|
|
4336
|
+
if (s2)
|
|
4337
|
+
return t2;
|
|
4338
|
+
if (f(t2))
|
|
4339
|
+
return t2;
|
|
4340
|
+
e2 || (t2 = this[yt](t2));
|
|
4341
|
+
return (this[jt]()["parse-positional-numbers"] || void 0 === this[jt]()["parse-positional-numbers"]) && (t2 = this[kt](t2)), i2 && (t2 = C(t2, this, v(this, B, "f").getMiddleware(), false)), t2;
|
|
4342
|
+
}
|
|
4343
|
+
[Kt](t2 = {}) {
|
|
4344
|
+
O(this, et, v(this, et, "f") || {}, "f");
|
|
4345
|
+
const e2 = {};
|
|
4346
|
+
e2.local = v(this, et, "f").local || [], e2.configObjects = v(this, et, "f").configObjects || [];
|
|
4347
|
+
const s2 = {};
|
|
4348
|
+
e2.local.forEach((e3) => {
|
|
4349
|
+
s2[e3] = true, (t2[e3] || []).forEach((t3) => {
|
|
4350
|
+
s2[t3] = true;
|
|
4351
|
+
});
|
|
4352
|
+
}), Object.assign(v(this, at, "f"), Object.keys(v(this, Y, "f")).reduce((t3, e3) => {
|
|
4353
|
+
const i2 = v(this, Y, "f")[e3].filter((t4) => !(t4 in s2));
|
|
4354
|
+
return i2.length > 0 && (t3[e3] = i2), t3;
|
|
4355
|
+
}, {})), O(this, Y, {}, "f");
|
|
4356
|
+
return ["array", "boolean", "string", "skipValidation", "count", "normalize", "number", "hiddenOptions"].forEach((t3) => {
|
|
4357
|
+
e2[t3] = (v(this, et, "f")[t3] || []).filter((t4) => !s2[t4]);
|
|
4358
|
+
}), ["narg", "key", "alias", "default", "defaultDescription", "config", "choices", "demandedOptions", "demandedCommands", "deprecatedOptions"].forEach((t3) => {
|
|
4359
|
+
e2[t3] = g(v(this, et, "f")[t3], (t4) => !s2[t4]);
|
|
4360
|
+
}), e2.envPrefix = v(this, et, "f").envPrefix, O(this, et, e2, "f"), O(this, pt, v(this, pt, "f") ? v(this, pt, "f").reset(s2) : P(this, v(this, ct, "f")), "f"), O(this, mt, v(this, mt, "f") ? v(this, mt, "f").reset(s2) : function(t3, e3, s3) {
|
|
4361
|
+
const i2 = s3.y18n.__, n2 = s3.y18n.__n, r2 = { nonOptionCount: function(s4) {
|
|
4362
|
+
const i3 = t3.getDemandedCommands(), r3 = s4._.length + (s4["--"] ? s4["--"].length : 0) - t3.getInternalMethods().getContext().commands.length;
|
|
4363
|
+
i3._ && (r3 < i3._.min || r3 > i3._.max) && (r3 < i3._.min ? void 0 !== i3._.minMsg ? e3.fail(i3._.minMsg ? i3._.minMsg.replace(/\$0/g, r3.toString()).replace(/\$1/, i3._.min.toString()) : null) : e3.fail(n2("Not enough non-option arguments: got %s, need at least %s", "Not enough non-option arguments: got %s, need at least %s", r3, r3.toString(), i3._.min.toString())) : r3 > i3._.max && (void 0 !== i3._.maxMsg ? e3.fail(i3._.maxMsg ? i3._.maxMsg.replace(/\$0/g, r3.toString()).replace(/\$1/, i3._.max.toString()) : null) : e3.fail(n2("Too many non-option arguments: got %s, maximum of %s", "Too many non-option arguments: got %s, maximum of %s", r3, r3.toString(), i3._.max.toString()))));
|
|
4364
|
+
}, positionalCount: function(t4, s4) {
|
|
4365
|
+
s4 < t4 && e3.fail(n2("Not enough non-option arguments: got %s, need at least %s", "Not enough non-option arguments: got %s, need at least %s", s4, s4 + "", t4 + ""));
|
|
4366
|
+
}, requiredArguments: function(t4, s4) {
|
|
4367
|
+
let i3 = null;
|
|
4368
|
+
for (const e4 of Object.keys(s4))
|
|
4369
|
+
Object.prototype.hasOwnProperty.call(t4, e4) && void 0 !== t4[e4] || (i3 = i3 || {}, i3[e4] = s4[e4]);
|
|
4370
|
+
if (i3) {
|
|
4371
|
+
const t5 = [];
|
|
4372
|
+
for (const e4 of Object.keys(i3)) {
|
|
4373
|
+
const s6 = i3[e4];
|
|
4374
|
+
s6 && t5.indexOf(s6) < 0 && t5.push(s6);
|
|
4375
|
+
}
|
|
4376
|
+
const s5 = t5.length ? `
|
|
4377
|
+
${t5.join("\n")}` : "";
|
|
4378
|
+
e3.fail(n2("Missing required argument: %s", "Missing required arguments: %s", Object.keys(i3).length, Object.keys(i3).join(", ") + s5));
|
|
4379
|
+
}
|
|
4380
|
+
}, unknownArguments: function(s4, i3, o3, a3, h2 = true) {
|
|
4381
|
+
var l3;
|
|
4382
|
+
const c3 = t3.getInternalMethods().getCommandInstance().getCommands(), f2 = [], d2 = t3.getInternalMethods().getContext();
|
|
4383
|
+
if (Object.keys(s4).forEach((e4) => {
|
|
4384
|
+
H.includes(e4) || Object.prototype.hasOwnProperty.call(o3, e4) || Object.prototype.hasOwnProperty.call(t3.getInternalMethods().getParseContext(), e4) || r2.isValidAndSomeAliasIsNotNew(e4, i3) || f2.push(e4);
|
|
4385
|
+
}), h2 && (d2.commands.length > 0 || c3.length > 0 || a3) && s4._.slice(d2.commands.length).forEach((t4) => {
|
|
4386
|
+
c3.includes("" + t4) || f2.push("" + t4);
|
|
4387
|
+
}), h2) {
|
|
4388
|
+
const e4 = (null === (l3 = t3.getDemandedCommands()._) || void 0 === l3 ? void 0 : l3.max) || 0, i4 = d2.commands.length + e4;
|
|
4389
|
+
i4 < s4._.length && s4._.slice(i4).forEach((t4) => {
|
|
4390
|
+
t4 = String(t4), d2.commands.includes(t4) || f2.includes(t4) || f2.push(t4);
|
|
4391
|
+
});
|
|
4392
|
+
}
|
|
4393
|
+
f2.length && e3.fail(n2("Unknown argument: %s", "Unknown arguments: %s", f2.length, f2.map((t4) => t4.trim() ? t4 : `"${t4}"`).join(", ")));
|
|
4394
|
+
}, unknownCommands: function(s4) {
|
|
4395
|
+
const i3 = t3.getInternalMethods().getCommandInstance().getCommands(), r3 = [], o3 = t3.getInternalMethods().getContext();
|
|
4396
|
+
return (o3.commands.length > 0 || i3.length > 0) && s4._.slice(o3.commands.length).forEach((t4) => {
|
|
4397
|
+
i3.includes("" + t4) || r3.push("" + t4);
|
|
4398
|
+
}), r3.length > 0 && (e3.fail(n2("Unknown command: %s", "Unknown commands: %s", r3.length, r3.join(", "))), true);
|
|
4399
|
+
}, isValidAndSomeAliasIsNotNew: function(e4, s4) {
|
|
4400
|
+
if (!Object.prototype.hasOwnProperty.call(s4, e4))
|
|
4401
|
+
return false;
|
|
4402
|
+
const i3 = t3.parsed.newAliases;
|
|
4403
|
+
return [e4, ...s4[e4]].some((t4) => !Object.prototype.hasOwnProperty.call(i3, t4) || !i3[e4]);
|
|
4404
|
+
}, limitedChoices: function(s4) {
|
|
4405
|
+
const n3 = t3.getOptions(), r3 = {};
|
|
4406
|
+
if (!Object.keys(n3.choices).length)
|
|
4407
|
+
return;
|
|
4408
|
+
Object.keys(s4).forEach((t4) => {
|
|
4409
|
+
-1 === H.indexOf(t4) && Object.prototype.hasOwnProperty.call(n3.choices, t4) && [].concat(s4[t4]).forEach((e4) => {
|
|
4410
|
+
-1 === n3.choices[t4].indexOf(e4) && void 0 !== e4 && (r3[t4] = (r3[t4] || []).concat(e4));
|
|
4411
|
+
});
|
|
4412
|
+
});
|
|
4413
|
+
const o3 = Object.keys(r3);
|
|
4414
|
+
if (!o3.length)
|
|
4415
|
+
return;
|
|
4416
|
+
let a3 = i2("Invalid values:");
|
|
4417
|
+
o3.forEach((t4) => {
|
|
4418
|
+
a3 += `
|
|
4419
|
+
${i2("Argument: %s, Given: %s, Choices: %s", t4, e3.stringifiedValues(r3[t4]), e3.stringifiedValues(n3.choices[t4]))}`;
|
|
4420
|
+
}), e3.fail(a3);
|
|
4421
|
+
} };
|
|
4422
|
+
let o2 = {};
|
|
4423
|
+
function a2(t4, e4) {
|
|
4424
|
+
const s4 = Number(e4);
|
|
4425
|
+
return "number" == typeof (e4 = isNaN(s4) ? e4 : s4) ? e4 = t4._.length >= e4 : e4.match(/^--no-.+/) ? (e4 = e4.match(/^--no-(.+)/)[1], e4 = !Object.prototype.hasOwnProperty.call(t4, e4)) : e4 = Object.prototype.hasOwnProperty.call(t4, e4), e4;
|
|
4426
|
+
}
|
|
4427
|
+
r2.implies = function(e4, i3) {
|
|
4428
|
+
h("<string|object> [array|number|string]", [e4, i3], arguments.length), "object" == typeof e4 ? Object.keys(e4).forEach((t4) => {
|
|
4429
|
+
r2.implies(t4, e4[t4]);
|
|
4430
|
+
}) : (t3.global(e4), o2[e4] || (o2[e4] = []), Array.isArray(i3) ? i3.forEach((t4) => r2.implies(e4, t4)) : (d(i3, void 0, s3), o2[e4].push(i3)));
|
|
4431
|
+
}, r2.getImplied = function() {
|
|
4432
|
+
return o2;
|
|
4433
|
+
}, r2.implications = function(t4) {
|
|
4434
|
+
const s4 = [];
|
|
4435
|
+
if (Object.keys(o2).forEach((e4) => {
|
|
4436
|
+
const i3 = e4;
|
|
4437
|
+
(o2[e4] || []).forEach((e5) => {
|
|
4438
|
+
let n3 = i3;
|
|
4439
|
+
const r3 = e5;
|
|
4440
|
+
n3 = a2(t4, n3), e5 = a2(t4, e5), n3 && !e5 && s4.push(` ${i3} -> ${r3}`);
|
|
4441
|
+
});
|
|
4442
|
+
}), s4.length) {
|
|
4443
|
+
let t5 = `${i2("Implications failed:")}
|
|
4444
|
+
`;
|
|
4445
|
+
s4.forEach((e4) => {
|
|
4446
|
+
t5 += e4;
|
|
4447
|
+
}), e3.fail(t5);
|
|
4448
|
+
}
|
|
4449
|
+
};
|
|
4450
|
+
let l2 = {};
|
|
4451
|
+
r2.conflicts = function(e4, s4) {
|
|
4452
|
+
h("<string|object> [array|string]", [e4, s4], arguments.length), "object" == typeof e4 ? Object.keys(e4).forEach((t4) => {
|
|
4453
|
+
r2.conflicts(t4, e4[t4]);
|
|
4454
|
+
}) : (t3.global(e4), l2[e4] || (l2[e4] = []), Array.isArray(s4) ? s4.forEach((t4) => r2.conflicts(e4, t4)) : l2[e4].push(s4));
|
|
4455
|
+
}, r2.getConflicting = () => l2, r2.conflicting = function(n3) {
|
|
4456
|
+
Object.keys(n3).forEach((t4) => {
|
|
4457
|
+
l2[t4] && l2[t4].forEach((s4) => {
|
|
4458
|
+
s4 && void 0 !== n3[t4] && void 0 !== n3[s4] && e3.fail(i2("Arguments %s and %s are mutually exclusive", t4, s4));
|
|
4459
|
+
});
|
|
4460
|
+
}), t3.getInternalMethods().getParserConfiguration()["strip-dashed"] && Object.keys(l2).forEach((t4) => {
|
|
4461
|
+
l2[t4].forEach((r3) => {
|
|
4462
|
+
r3 && void 0 !== n3[s3.Parser.camelCase(t4)] && void 0 !== n3[s3.Parser.camelCase(r3)] && e3.fail(i2("Arguments %s and %s are mutually exclusive", t4, r3));
|
|
4463
|
+
});
|
|
4464
|
+
});
|
|
4465
|
+
}, r2.recommendCommands = function(t4, s4) {
|
|
4466
|
+
s4 = s4.sort((t5, e4) => e4.length - t5.length);
|
|
4467
|
+
let n3 = null, r3 = 1 / 0;
|
|
4468
|
+
for (let e4, i3 = 0; void 0 !== (e4 = s4[i3]); i3++) {
|
|
4469
|
+
const s5 = N(t4, e4);
|
|
4470
|
+
s5 <= 3 && s5 < r3 && (r3 = s5, n3 = e4);
|
|
4471
|
+
}
|
|
4472
|
+
n3 && e3.fail(i2("Did you mean %s?", n3));
|
|
4473
|
+
}, r2.reset = function(t4) {
|
|
4474
|
+
return o2 = g(o2, (e4) => !t4[e4]), l2 = g(l2, (e4) => !t4[e4]), r2;
|
|
4475
|
+
};
|
|
4476
|
+
const c2 = [];
|
|
4477
|
+
return r2.freeze = function() {
|
|
4478
|
+
c2.push({ implied: o2, conflicting: l2 });
|
|
4479
|
+
}, r2.unfreeze = function() {
|
|
4480
|
+
const t4 = c2.pop();
|
|
4481
|
+
d(t4, void 0, s3), { implied: o2, conflicting: l2 } = t4;
|
|
4482
|
+
}, r2;
|
|
4483
|
+
}(this, v(this, pt, "f"), v(this, ct, "f")), "f"), O(this, z, v(this, z, "f") ? v(this, z, "f").reset() : function(t3, e3, s3, i2) {
|
|
4484
|
+
return new M(t3, e3, s3, i2);
|
|
4485
|
+
}(v(this, pt, "f"), v(this, mt, "f"), v(this, B, "f"), v(this, ct, "f")), "f"), v(this, F, "f") || O(this, F, function(t3, e3, s3, i2) {
|
|
4486
|
+
return new D(t3, e3, s3, i2);
|
|
4487
|
+
}(this, v(this, pt, "f"), v(this, z, "f"), v(this, ct, "f")), "f"), v(this, B, "f").reset(), O(this, U, null, "f"), O(this, tt, "", "f"), O(this, V, null, "f"), O(this, J, false, "f"), this.parsed = false, this;
|
|
4488
|
+
}
|
|
4489
|
+
[Tt](t2, e2) {
|
|
4490
|
+
return v(this, ct, "f").path.relative(t2, e2);
|
|
4491
|
+
}
|
|
4492
|
+
[Bt](t2, s2, i2, n2 = 0, r2 = false) {
|
|
4493
|
+
let o2 = !!i2 || r2;
|
|
4494
|
+
t2 = t2 || v(this, ht, "f"), v(this, et, "f").__ = v(this, ct, "f").y18n.__, v(this, et, "f").configuration = this[jt]();
|
|
4495
|
+
const a2 = !!v(this, et, "f").configuration["populate--"], h2 = Object.assign({}, v(this, et, "f").configuration, { "populate--": true }), l2 = v(this, ct, "f").Parser.detailed(t2, Object.assign({}, v(this, et, "f"), { configuration: { "parse-positional-numbers": false, ...h2 } })), c2 = Object.assign(l2.argv, v(this, rt, "f"));
|
|
4496
|
+
let d2;
|
|
4497
|
+
const u2 = l2.aliases;
|
|
4498
|
+
let p2 = false, g2 = false;
|
|
4499
|
+
Object.keys(c2).forEach((t3) => {
|
|
4500
|
+
t3 === v(this, Z, "f") && c2[t3] ? p2 = true : t3 === v(this, gt, "f") && c2[t3] && (g2 = true);
|
|
4501
|
+
}), c2.$0 = this.$0, this.parsed = l2, 0 === n2 && v(this, pt, "f").clearCachedHelpMessage();
|
|
4502
|
+
try {
|
|
4503
|
+
if (this[_t](), s2)
|
|
4504
|
+
return this[Rt](c2, a2, !!i2, false);
|
|
4505
|
+
if (v(this, Z, "f")) {
|
|
4506
|
+
[v(this, Z, "f")].concat(u2[v(this, Z, "f")] || []).filter((t3) => t3.length > 1).includes("" + c2._[c2._.length - 1]) && (c2._.pop(), p2 = true);
|
|
4507
|
+
}
|
|
4508
|
+
O(this, X, false, "f");
|
|
4509
|
+
const h3 = v(this, z, "f").getCommands(), m2 = v(this, F, "f").completionKey in c2, y2 = p2 || m2 || r2;
|
|
4510
|
+
if (c2._.length) {
|
|
4511
|
+
if (h3.length) {
|
|
4512
|
+
let t3;
|
|
4513
|
+
for (let e2, s3 = n2 || 0; void 0 !== c2._[s3]; s3++) {
|
|
4514
|
+
if (e2 = String(c2._[s3]), h3.includes(e2) && e2 !== v(this, U, "f")) {
|
|
4515
|
+
const t4 = v(this, z, "f").runCommand(e2, this, l2, s3 + 1, r2, p2 || g2 || r2);
|
|
4516
|
+
return this[Rt](t4, a2, !!i2, false);
|
|
4517
|
+
}
|
|
4518
|
+
if (!t3 && e2 !== v(this, U, "f")) {
|
|
4519
|
+
t3 = e2;
|
|
4520
|
+
break;
|
|
4521
|
+
}
|
|
4522
|
+
}
|
|
4523
|
+
!v(this, z, "f").hasDefaultCommand() && v(this, lt, "f") && t3 && !y2 && v(this, mt, "f").recommendCommands(t3, h3);
|
|
4524
|
+
}
|
|
4525
|
+
v(this, U, "f") && c2._.includes(v(this, U, "f")) && !m2 && (v(this, T, "f") && E(true), this.showCompletionScript(), this.exit(0));
|
|
4526
|
+
}
|
|
4527
|
+
if (v(this, z, "f").hasDefaultCommand() && !y2) {
|
|
4528
|
+
const t3 = v(this, z, "f").runCommand(null, this, l2, 0, r2, p2 || g2 || r2);
|
|
4529
|
+
return this[Rt](t3, a2, !!i2, false);
|
|
4530
|
+
}
|
|
4531
|
+
if (m2) {
|
|
4532
|
+
v(this, T, "f") && E(true);
|
|
4533
|
+
const s3 = (t2 = [].concat(t2)).slice(t2.indexOf(`--${v(this, F, "f").completionKey}`) + 1);
|
|
4534
|
+
return v(this, F, "f").getCompletion(s3, (t3, s4) => {
|
|
4535
|
+
if (t3)
|
|
4536
|
+
throw new e(t3.message);
|
|
4537
|
+
(s4 || []).forEach((t4) => {
|
|
4538
|
+
v(this, Q, "f").log(t4);
|
|
4539
|
+
}), this.exit(0);
|
|
4540
|
+
}), this[Rt](c2, !a2, !!i2, false);
|
|
4541
|
+
}
|
|
4542
|
+
if (v(this, J, "f") || (p2 ? (v(this, T, "f") && E(true), o2 = true, this.showHelp("log"), this.exit(0)) : g2 && (v(this, T, "f") && E(true), o2 = true, v(this, pt, "f").showVersion("log"), this.exit(0))), !o2 && v(this, et, "f").skipValidation.length > 0 && (o2 = Object.keys(c2).some((t3) => v(this, et, "f").skipValidation.indexOf(t3) >= 0 && true === c2[t3])), !o2) {
|
|
4543
|
+
if (l2.error)
|
|
4544
|
+
throw new e(l2.error.message);
|
|
4545
|
+
if (!m2) {
|
|
4546
|
+
const t3 = this[Yt](u2, {}, l2.error);
|
|
4547
|
+
i2 || (d2 = C(c2, this, v(this, B, "f").getMiddleware(), true)), d2 = this[Nt](t3, null != d2 ? d2 : c2), f(d2) && !i2 && (d2 = d2.then(() => C(c2, this, v(this, B, "f").getMiddleware(), false)));
|
|
4548
|
+
}
|
|
4549
|
+
}
|
|
4550
|
+
} catch (t3) {
|
|
4551
|
+
if (!(t3 instanceof e))
|
|
4552
|
+
throw t3;
|
|
4553
|
+
v(this, pt, "f").fail(t3.message, t3);
|
|
4554
|
+
}
|
|
4555
|
+
return this[Rt](null != d2 ? d2 : c2, a2, !!i2, true);
|
|
4556
|
+
}
|
|
4557
|
+
[Yt](t2, s2, i2, n2) {
|
|
4558
|
+
const r2 = { ...this.getDemandedOptions() };
|
|
4559
|
+
return (o2) => {
|
|
4560
|
+
if (i2)
|
|
4561
|
+
throw new e(i2.message);
|
|
4562
|
+
v(this, mt, "f").nonOptionCount(o2), v(this, mt, "f").requiredArguments(o2, r2);
|
|
4563
|
+
let a2 = false;
|
|
4564
|
+
v(this, dt, "f") && (a2 = v(this, mt, "f").unknownCommands(o2)), v(this, ft, "f") && !a2 ? v(this, mt, "f").unknownArguments(o2, t2, s2, !!n2) : v(this, ut, "f") && v(this, mt, "f").unknownArguments(o2, t2, {}, false, false), v(this, mt, "f").limitedChoices(o2), v(this, mt, "f").implications(o2), v(this, mt, "f").conflicting(o2);
|
|
4565
|
+
};
|
|
4566
|
+
}
|
|
4567
|
+
[Jt]() {
|
|
4568
|
+
O(this, J, true, "f");
|
|
4569
|
+
}
|
|
4570
|
+
[Zt](t2) {
|
|
4571
|
+
if ("string" == typeof t2)
|
|
4572
|
+
v(this, et, "f").key[t2] = true;
|
|
4573
|
+
else
|
|
4574
|
+
for (const e2 of t2)
|
|
4575
|
+
v(this, et, "f").key[e2] = true;
|
|
4576
|
+
}
|
|
4577
|
+
};
|
|
4578
|
+
var Qt;
|
|
4579
|
+
var te;
|
|
4580
|
+
var { readFileSync: ee } = require("fs");
|
|
4581
|
+
var { inspect: se } = require("util");
|
|
4582
|
+
var { resolve: ie } = require("path");
|
|
4583
|
+
var ne = require_build();
|
|
4584
|
+
var re = require_build2();
|
|
4585
|
+
var oe;
|
|
4586
|
+
var ae = { assert: { notStrictEqual: t.notStrictEqual, strictEqual: t.strictEqual }, cliui: require_build3(), findUp: require_sync(), getEnv: (t2) => process.env[t2], getCallerFile: require_get_caller_file(), getProcessArgvBin: y, inspect: se, mainFilename: null !== (te = null === (Qt = null === require || void 0 === require ? void 0 : require.main) || void 0 === Qt ? void 0 : Qt.filename) && void 0 !== te ? te : process.cwd(), Parser: re, path: require("path"), process: { argv: () => process.argv, cwd: process.cwd, emitWarning: (t2, e2) => process.emitWarning(t2, e2), execPath: () => process.execPath, exit: (t2) => {
|
|
4587
|
+
process.exit(t2);
|
|
4588
|
+
}, nextTick: process.nextTick, stdColumns: void 0 !== process.stdout.columns ? process.stdout.columns : null }, readFileSync: ee, require, requireDirectory: require_require_directory(), stringWidth: require_string_width(), y18n: ne({ directory: ie(__dirname, "../locales"), updateFiles: false }) };
|
|
4589
|
+
var he = (null === (oe = null === process || void 0 === process ? void 0 : process.env) || void 0 === oe ? void 0 : oe.YARGS_MIN_NODE_VERSION) ? Number(process.env.YARGS_MIN_NODE_VERSION) : 12;
|
|
4590
|
+
if (process && process.version) {
|
|
4591
|
+
if (Number(process.version.match(/v([^.]+)/)[1]) < he)
|
|
4592
|
+
throw Error(`yargs supports a minimum Node.js version of ${he}. Read our version support policy: https://github.com/yargs/yargs#supported-nodejs-versions`);
|
|
4593
|
+
}
|
|
4594
|
+
var le = require_build2();
|
|
4595
|
+
var ce;
|
|
4596
|
+
var fe = { applyExtends: n, cjsPlatformShim: ae, Yargs: (ce = ae, (t2 = [], e2 = ce.process.cwd(), s2) => {
|
|
4597
|
+
const i2 = new Xt(t2, e2, s2, ce);
|
|
4598
|
+
return Object.defineProperty(i2, "argv", { get: () => i2.parse(), enumerable: true }), i2.help(), i2.version(), i2;
|
|
4599
|
+
}), argsert: h, isPromise: f, objFilter: g, parseCommand: o, Parser: le, processArgv: b, YError: e };
|
|
4600
|
+
module2.exports = fe;
|
|
4601
|
+
}
|
|
4602
|
+
});
|
|
4603
|
+
|
|
4604
|
+
// node_modules/yargs/index.cjs
|
|
4605
|
+
var require_yargs = __commonJS({
|
|
4606
|
+
"node_modules/yargs/index.cjs"(exports, module2) {
|
|
4607
|
+
"use strict";
|
|
4608
|
+
var { Yargs, processArgv } = require_build4();
|
|
4609
|
+
Argv(processArgv.hideBin(process.argv));
|
|
4610
|
+
module2.exports = Argv;
|
|
4611
|
+
function Argv(processArgs, cwd) {
|
|
4612
|
+
const argv = Yargs(processArgs, cwd, require);
|
|
4613
|
+
singletonify(argv);
|
|
4614
|
+
return argv;
|
|
4615
|
+
}
|
|
4616
|
+
function defineGetter(obj, key, getter) {
|
|
4617
|
+
Object.defineProperty(obj, key, {
|
|
4618
|
+
configurable: true,
|
|
4619
|
+
enumerable: true,
|
|
4620
|
+
get: getter
|
|
4621
|
+
});
|
|
4622
|
+
}
|
|
4623
|
+
function lookupGetter(obj, key) {
|
|
4624
|
+
const desc = Object.getOwnPropertyDescriptor(obj, key);
|
|
4625
|
+
if (typeof desc !== "undefined") {
|
|
4626
|
+
return desc.get;
|
|
4627
|
+
}
|
|
4628
|
+
}
|
|
4629
|
+
function singletonify(inst) {
|
|
4630
|
+
[
|
|
4631
|
+
...Object.keys(inst),
|
|
4632
|
+
...Object.getOwnPropertyNames(inst.constructor.prototype)
|
|
4633
|
+
].forEach((key) => {
|
|
4634
|
+
if (key === "argv") {
|
|
4635
|
+
defineGetter(Argv, key, lookupGetter(inst, key));
|
|
4636
|
+
} else if (typeof inst[key] === "function") {
|
|
4637
|
+
Argv[key] = inst[key].bind(inst);
|
|
4638
|
+
} else {
|
|
4639
|
+
defineGetter(Argv, "$0", () => inst.$0);
|
|
4640
|
+
defineGetter(Argv, "parsed", () => inst.parsed);
|
|
4641
|
+
}
|
|
4642
|
+
});
|
|
4643
|
+
}
|
|
4644
|
+
}
|
|
4645
|
+
});
|
|
4646
|
+
|
|
4647
|
+
// node_modules/yargs/helpers/index.js
|
|
4648
|
+
var require_helpers = __commonJS({
|
|
4649
|
+
"node_modules/yargs/helpers/index.js"(exports, module2) {
|
|
4650
|
+
var {
|
|
4651
|
+
applyExtends,
|
|
4652
|
+
cjsPlatformShim,
|
|
4653
|
+
Parser,
|
|
4654
|
+
processArgv
|
|
4655
|
+
} = require_build4();
|
|
4656
|
+
module2.exports = {
|
|
4657
|
+
applyExtends: (config, cwd, mergeExtends) => {
|
|
4658
|
+
return applyExtends(config, cwd, mergeExtends, cjsPlatformShim);
|
|
4659
|
+
},
|
|
4660
|
+
hideBin: processArgv.hideBin,
|
|
4661
|
+
Parser
|
|
4662
|
+
};
|
|
4663
|
+
}
|
|
4664
|
+
});
|
|
4665
|
+
|
|
4666
|
+
// src/index.ts
|
|
4667
|
+
var yargs = require_yargs();
|
|
4668
|
+
var { hideBin } = require_helpers();
|
|
4669
|
+
global.self = (1, eval)("this");
|
|
4670
|
+
yargs(hideBin(process.argv)).commandDir("commands").strict().alias({ h: "help" }).argv;
|