claude-presentation-master 3.8.0 → 3.8.6
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/BrowserWebSocketTransport-HTFZUK6G.mjs +7 -0
- package/dist/LaunchOptions-SFJP2D7Z.mjs +9 -0
- package/dist/NodeWebSocketTransport-RBVOEJLR.mjs +8 -0
- package/dist/bidi-BVFTPINL.mjs +18501 -0
- package/dist/chunk-3UL3L2R6.mjs +30 -0
- package/dist/chunk-4MOE77QU.mjs +1661 -0
- package/dist/chunk-5NJVL3OH.mjs +31312 -0
- package/dist/chunk-5TVEOHFT.mjs +244 -0
- package/dist/chunk-6D5VEPNW.mjs +12104 -0
- package/dist/chunk-CFGGYLHX.mjs +3684 -0
- package/dist/chunk-EC7LFFYG.mjs +15 -0
- package/dist/chunk-HEBXNMVQ.mjs +48 -0
- package/dist/chunk-KJPJW5EB.mjs +40 -0
- package/dist/chunk-QUYDTLMJ.mjs +775 -0
- package/dist/extract-zip-UJUIS3MT.mjs +1499 -0
- package/dist/helpers-GOUCEJ3S.mjs +17 -0
- package/dist/index.d.mts +36 -3
- package/dist/index.d.ts +36 -3
- package/dist/index.js +92418 -213
- package/dist/index.mjs +350 -30
- package/dist/main-GWERC3XX.mjs +56 -0
- package/dist/puppeteer-EG4MVFUF.mjs +14961 -0
- package/dist/src-HTL2N5EV.mjs +5 -0
- package/dist/tar-fs-NIVQWNBX.mjs +2562 -0
- package/dist/yargs-COGWK7P3.mjs +3230 -0
- package/package.json +1 -1
|
@@ -0,0 +1,1661 @@
|
|
|
1
|
+
import {
|
|
2
|
+
__require
|
|
3
|
+
} from "./chunk-HEBXNMVQ.mjs";
|
|
4
|
+
|
|
5
|
+
// node_modules/yargs-parser/build/lib/index.js
|
|
6
|
+
import { format } from "util";
|
|
7
|
+
import { normalize, resolve } from "path";
|
|
8
|
+
|
|
9
|
+
// node_modules/yargs-parser/build/lib/string-utils.js
|
|
10
|
+
function camelCase(str) {
|
|
11
|
+
const isCamelCase = str !== str.toLowerCase() && str !== str.toUpperCase();
|
|
12
|
+
if (!isCamelCase) {
|
|
13
|
+
str = str.toLowerCase();
|
|
14
|
+
}
|
|
15
|
+
if (str.indexOf("-") === -1 && str.indexOf("_") === -1) {
|
|
16
|
+
return str;
|
|
17
|
+
} else {
|
|
18
|
+
let camelcase = "";
|
|
19
|
+
let nextChrUpper = false;
|
|
20
|
+
const leadingHyphens = str.match(/^-+/);
|
|
21
|
+
for (let i = leadingHyphens ? leadingHyphens[0].length : 0; i < str.length; i++) {
|
|
22
|
+
let chr = str.charAt(i);
|
|
23
|
+
if (nextChrUpper) {
|
|
24
|
+
nextChrUpper = false;
|
|
25
|
+
chr = chr.toUpperCase();
|
|
26
|
+
}
|
|
27
|
+
if (i !== 0 && (chr === "-" || chr === "_")) {
|
|
28
|
+
nextChrUpper = true;
|
|
29
|
+
} else if (chr !== "-" && chr !== "_") {
|
|
30
|
+
camelcase += chr;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return camelcase;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function decamelize(str, joinString) {
|
|
37
|
+
const lowercase = str.toLowerCase();
|
|
38
|
+
joinString = joinString || "-";
|
|
39
|
+
let notCamelcase = "";
|
|
40
|
+
for (let i = 0; i < str.length; i++) {
|
|
41
|
+
const chrLower = lowercase.charAt(i);
|
|
42
|
+
const chrString = str.charAt(i);
|
|
43
|
+
if (chrLower !== chrString && i > 0) {
|
|
44
|
+
notCamelcase += `${joinString}${lowercase.charAt(i)}`;
|
|
45
|
+
} else {
|
|
46
|
+
notCamelcase += chrString;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return notCamelcase;
|
|
50
|
+
}
|
|
51
|
+
function looksLikeNumber(x) {
|
|
52
|
+
if (x === null || x === void 0)
|
|
53
|
+
return false;
|
|
54
|
+
if (typeof x === "number")
|
|
55
|
+
return true;
|
|
56
|
+
if (/^0x[0-9a-f]+$/i.test(x))
|
|
57
|
+
return true;
|
|
58
|
+
if (/^0[^.]/.test(x))
|
|
59
|
+
return false;
|
|
60
|
+
return /^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// node_modules/yargs-parser/build/lib/tokenize-arg-string.js
|
|
64
|
+
function tokenizeArgString(argString) {
|
|
65
|
+
if (Array.isArray(argString)) {
|
|
66
|
+
return argString.map((e) => typeof e !== "string" ? e + "" : e);
|
|
67
|
+
}
|
|
68
|
+
argString = argString.trim();
|
|
69
|
+
let i = 0;
|
|
70
|
+
let prevC = null;
|
|
71
|
+
let c = null;
|
|
72
|
+
let opening = null;
|
|
73
|
+
const args = [];
|
|
74
|
+
for (let ii = 0; ii < argString.length; ii++) {
|
|
75
|
+
prevC = c;
|
|
76
|
+
c = argString.charAt(ii);
|
|
77
|
+
if (c === " " && !opening) {
|
|
78
|
+
if (!(prevC === " ")) {
|
|
79
|
+
i++;
|
|
80
|
+
}
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
if (c === opening) {
|
|
84
|
+
opening = null;
|
|
85
|
+
} else if ((c === "'" || c === '"') && !opening) {
|
|
86
|
+
opening = c;
|
|
87
|
+
}
|
|
88
|
+
if (!args[i])
|
|
89
|
+
args[i] = "";
|
|
90
|
+
args[i] += c;
|
|
91
|
+
}
|
|
92
|
+
return args;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// node_modules/yargs-parser/build/lib/yargs-parser-types.js
|
|
96
|
+
var DefaultValuesForTypeKey;
|
|
97
|
+
(function(DefaultValuesForTypeKey2) {
|
|
98
|
+
DefaultValuesForTypeKey2["BOOLEAN"] = "boolean";
|
|
99
|
+
DefaultValuesForTypeKey2["STRING"] = "string";
|
|
100
|
+
DefaultValuesForTypeKey2["NUMBER"] = "number";
|
|
101
|
+
DefaultValuesForTypeKey2["ARRAY"] = "array";
|
|
102
|
+
})(DefaultValuesForTypeKey || (DefaultValuesForTypeKey = {}));
|
|
103
|
+
|
|
104
|
+
// node_modules/yargs-parser/build/lib/yargs-parser.js
|
|
105
|
+
var mixin;
|
|
106
|
+
var YargsParser = class {
|
|
107
|
+
constructor(_mixin) {
|
|
108
|
+
mixin = _mixin;
|
|
109
|
+
}
|
|
110
|
+
parse(argsInput, options) {
|
|
111
|
+
const opts = Object.assign({
|
|
112
|
+
alias: void 0,
|
|
113
|
+
array: void 0,
|
|
114
|
+
boolean: void 0,
|
|
115
|
+
config: void 0,
|
|
116
|
+
configObjects: void 0,
|
|
117
|
+
configuration: void 0,
|
|
118
|
+
coerce: void 0,
|
|
119
|
+
count: void 0,
|
|
120
|
+
default: void 0,
|
|
121
|
+
envPrefix: void 0,
|
|
122
|
+
narg: void 0,
|
|
123
|
+
normalize: void 0,
|
|
124
|
+
string: void 0,
|
|
125
|
+
number: void 0,
|
|
126
|
+
__: void 0,
|
|
127
|
+
key: void 0
|
|
128
|
+
}, options);
|
|
129
|
+
const args = tokenizeArgString(argsInput);
|
|
130
|
+
const inputIsString = typeof argsInput === "string";
|
|
131
|
+
const aliases = combineAliases(Object.assign(/* @__PURE__ */ Object.create(null), opts.alias));
|
|
132
|
+
const configuration = Object.assign({
|
|
133
|
+
"boolean-negation": true,
|
|
134
|
+
"camel-case-expansion": true,
|
|
135
|
+
"combine-arrays": false,
|
|
136
|
+
"dot-notation": true,
|
|
137
|
+
"duplicate-arguments-array": true,
|
|
138
|
+
"flatten-duplicate-arrays": true,
|
|
139
|
+
"greedy-arrays": true,
|
|
140
|
+
"halt-at-non-option": false,
|
|
141
|
+
"nargs-eats-options": false,
|
|
142
|
+
"negation-prefix": "no-",
|
|
143
|
+
"parse-numbers": true,
|
|
144
|
+
"parse-positional-numbers": true,
|
|
145
|
+
"populate--": false,
|
|
146
|
+
"set-placeholder-key": false,
|
|
147
|
+
"short-option-groups": true,
|
|
148
|
+
"strip-aliased": false,
|
|
149
|
+
"strip-dashed": false,
|
|
150
|
+
"unknown-options-as-args": false
|
|
151
|
+
}, opts.configuration);
|
|
152
|
+
const defaults = Object.assign(/* @__PURE__ */ Object.create(null), opts.default);
|
|
153
|
+
const configObjects = opts.configObjects || [];
|
|
154
|
+
const envPrefix = opts.envPrefix;
|
|
155
|
+
const notFlagsOption = configuration["populate--"];
|
|
156
|
+
const notFlagsArgv = notFlagsOption ? "--" : "_";
|
|
157
|
+
const newAliases = /* @__PURE__ */ Object.create(null);
|
|
158
|
+
const defaulted = /* @__PURE__ */ Object.create(null);
|
|
159
|
+
const __ = opts.__ || mixin.format;
|
|
160
|
+
const flags = {
|
|
161
|
+
aliases: /* @__PURE__ */ Object.create(null),
|
|
162
|
+
arrays: /* @__PURE__ */ Object.create(null),
|
|
163
|
+
bools: /* @__PURE__ */ Object.create(null),
|
|
164
|
+
strings: /* @__PURE__ */ Object.create(null),
|
|
165
|
+
numbers: /* @__PURE__ */ Object.create(null),
|
|
166
|
+
counts: /* @__PURE__ */ Object.create(null),
|
|
167
|
+
normalize: /* @__PURE__ */ Object.create(null),
|
|
168
|
+
configs: /* @__PURE__ */ Object.create(null),
|
|
169
|
+
nargs: /* @__PURE__ */ Object.create(null),
|
|
170
|
+
coercions: /* @__PURE__ */ Object.create(null),
|
|
171
|
+
keys: []
|
|
172
|
+
};
|
|
173
|
+
const negative = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/;
|
|
174
|
+
const negatedBoolean = new RegExp("^--" + configuration["negation-prefix"] + "(.+)");
|
|
175
|
+
[].concat(opts.array || []).filter(Boolean).forEach(function(opt) {
|
|
176
|
+
const key = typeof opt === "object" ? opt.key : opt;
|
|
177
|
+
const assignment = Object.keys(opt).map(function(key2) {
|
|
178
|
+
const arrayFlagKeys = {
|
|
179
|
+
boolean: "bools",
|
|
180
|
+
string: "strings",
|
|
181
|
+
number: "numbers"
|
|
182
|
+
};
|
|
183
|
+
return arrayFlagKeys[key2];
|
|
184
|
+
}).filter(Boolean).pop();
|
|
185
|
+
if (assignment) {
|
|
186
|
+
flags[assignment][key] = true;
|
|
187
|
+
}
|
|
188
|
+
flags.arrays[key] = true;
|
|
189
|
+
flags.keys.push(key);
|
|
190
|
+
});
|
|
191
|
+
[].concat(opts.boolean || []).filter(Boolean).forEach(function(key) {
|
|
192
|
+
flags.bools[key] = true;
|
|
193
|
+
flags.keys.push(key);
|
|
194
|
+
});
|
|
195
|
+
[].concat(opts.string || []).filter(Boolean).forEach(function(key) {
|
|
196
|
+
flags.strings[key] = true;
|
|
197
|
+
flags.keys.push(key);
|
|
198
|
+
});
|
|
199
|
+
[].concat(opts.number || []).filter(Boolean).forEach(function(key) {
|
|
200
|
+
flags.numbers[key] = true;
|
|
201
|
+
flags.keys.push(key);
|
|
202
|
+
});
|
|
203
|
+
[].concat(opts.count || []).filter(Boolean).forEach(function(key) {
|
|
204
|
+
flags.counts[key] = true;
|
|
205
|
+
flags.keys.push(key);
|
|
206
|
+
});
|
|
207
|
+
[].concat(opts.normalize || []).filter(Boolean).forEach(function(key) {
|
|
208
|
+
flags.normalize[key] = true;
|
|
209
|
+
flags.keys.push(key);
|
|
210
|
+
});
|
|
211
|
+
if (typeof opts.narg === "object") {
|
|
212
|
+
Object.entries(opts.narg).forEach(([key, value]) => {
|
|
213
|
+
if (typeof value === "number") {
|
|
214
|
+
flags.nargs[key] = value;
|
|
215
|
+
flags.keys.push(key);
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
if (typeof opts.coerce === "object") {
|
|
220
|
+
Object.entries(opts.coerce).forEach(([key, value]) => {
|
|
221
|
+
if (typeof value === "function") {
|
|
222
|
+
flags.coercions[key] = value;
|
|
223
|
+
flags.keys.push(key);
|
|
224
|
+
}
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
if (typeof opts.config !== "undefined") {
|
|
228
|
+
if (Array.isArray(opts.config) || typeof opts.config === "string") {
|
|
229
|
+
;
|
|
230
|
+
[].concat(opts.config).filter(Boolean).forEach(function(key) {
|
|
231
|
+
flags.configs[key] = true;
|
|
232
|
+
});
|
|
233
|
+
} else if (typeof opts.config === "object") {
|
|
234
|
+
Object.entries(opts.config).forEach(([key, value]) => {
|
|
235
|
+
if (typeof value === "boolean" || typeof value === "function") {
|
|
236
|
+
flags.configs[key] = value;
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
extendAliases(opts.key, aliases, opts.default, flags.arrays);
|
|
242
|
+
Object.keys(defaults).forEach(function(key) {
|
|
243
|
+
(flags.aliases[key] || []).forEach(function(alias) {
|
|
244
|
+
defaults[alias] = defaults[key];
|
|
245
|
+
});
|
|
246
|
+
});
|
|
247
|
+
let error = null;
|
|
248
|
+
checkConfiguration();
|
|
249
|
+
let notFlags = [];
|
|
250
|
+
const argv = Object.assign(/* @__PURE__ */ Object.create(null), { _: [] });
|
|
251
|
+
const argvReturn = {};
|
|
252
|
+
for (let i = 0; i < args.length; i++) {
|
|
253
|
+
const arg = args[i];
|
|
254
|
+
const truncatedArg = arg.replace(/^-{3,}/, "---");
|
|
255
|
+
let broken;
|
|
256
|
+
let key;
|
|
257
|
+
let letters;
|
|
258
|
+
let m;
|
|
259
|
+
let next;
|
|
260
|
+
let value;
|
|
261
|
+
if (arg !== "--" && /^-/.test(arg) && isUnknownOptionAsArg(arg)) {
|
|
262
|
+
pushPositional(arg);
|
|
263
|
+
} else if (truncatedArg.match(/^---+(=|$)/)) {
|
|
264
|
+
pushPositional(arg);
|
|
265
|
+
continue;
|
|
266
|
+
} else if (arg.match(/^--.+=/) || !configuration["short-option-groups"] && arg.match(/^-.+=/)) {
|
|
267
|
+
m = arg.match(/^--?([^=]+)=([\s\S]*)$/);
|
|
268
|
+
if (m !== null && Array.isArray(m) && m.length >= 3) {
|
|
269
|
+
if (checkAllAliases(m[1], flags.arrays)) {
|
|
270
|
+
i = eatArray(i, m[1], args, m[2]);
|
|
271
|
+
} else if (checkAllAliases(m[1], flags.nargs) !== false) {
|
|
272
|
+
i = eatNargs(i, m[1], args, m[2]);
|
|
273
|
+
} else {
|
|
274
|
+
setArg(m[1], m[2], true);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
} else if (arg.match(negatedBoolean) && configuration["boolean-negation"]) {
|
|
278
|
+
m = arg.match(negatedBoolean);
|
|
279
|
+
if (m !== null && Array.isArray(m) && m.length >= 2) {
|
|
280
|
+
key = m[1];
|
|
281
|
+
setArg(key, checkAllAliases(key, flags.arrays) ? [false] : false);
|
|
282
|
+
}
|
|
283
|
+
} else if (arg.match(/^--.+/) || !configuration["short-option-groups"] && arg.match(/^-[^-]+/)) {
|
|
284
|
+
m = arg.match(/^--?(.+)/);
|
|
285
|
+
if (m !== null && Array.isArray(m) && m.length >= 2) {
|
|
286
|
+
key = m[1];
|
|
287
|
+
if (checkAllAliases(key, flags.arrays)) {
|
|
288
|
+
i = eatArray(i, key, args);
|
|
289
|
+
} else if (checkAllAliases(key, flags.nargs) !== false) {
|
|
290
|
+
i = eatNargs(i, key, args);
|
|
291
|
+
} else {
|
|
292
|
+
next = args[i + 1];
|
|
293
|
+
if (next !== void 0 && (!next.match(/^-/) || next.match(negative)) && !checkAllAliases(key, flags.bools) && !checkAllAliases(key, flags.counts)) {
|
|
294
|
+
setArg(key, next);
|
|
295
|
+
i++;
|
|
296
|
+
} else if (/^(true|false)$/.test(next)) {
|
|
297
|
+
setArg(key, next);
|
|
298
|
+
i++;
|
|
299
|
+
} else {
|
|
300
|
+
setArg(key, defaultValue(key));
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
} else if (arg.match(/^-.\..+=/)) {
|
|
305
|
+
m = arg.match(/^-([^=]+)=([\s\S]*)$/);
|
|
306
|
+
if (m !== null && Array.isArray(m) && m.length >= 3) {
|
|
307
|
+
setArg(m[1], m[2]);
|
|
308
|
+
}
|
|
309
|
+
} else if (arg.match(/^-.\..+/) && !arg.match(negative)) {
|
|
310
|
+
next = args[i + 1];
|
|
311
|
+
m = arg.match(/^-(.\..+)/);
|
|
312
|
+
if (m !== null && Array.isArray(m) && m.length >= 2) {
|
|
313
|
+
key = m[1];
|
|
314
|
+
if (next !== void 0 && !next.match(/^-/) && !checkAllAliases(key, flags.bools) && !checkAllAliases(key, flags.counts)) {
|
|
315
|
+
setArg(key, next);
|
|
316
|
+
i++;
|
|
317
|
+
} else {
|
|
318
|
+
setArg(key, defaultValue(key));
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
} else if (arg.match(/^-[^-]+/) && !arg.match(negative)) {
|
|
322
|
+
letters = arg.slice(1, -1).split("");
|
|
323
|
+
broken = false;
|
|
324
|
+
for (let j = 0; j < letters.length; j++) {
|
|
325
|
+
next = arg.slice(j + 2);
|
|
326
|
+
if (letters[j + 1] && letters[j + 1] === "=") {
|
|
327
|
+
value = arg.slice(j + 3);
|
|
328
|
+
key = letters[j];
|
|
329
|
+
if (checkAllAliases(key, flags.arrays)) {
|
|
330
|
+
i = eatArray(i, key, args, value);
|
|
331
|
+
} else if (checkAllAliases(key, flags.nargs) !== false) {
|
|
332
|
+
i = eatNargs(i, key, args, value);
|
|
333
|
+
} else {
|
|
334
|
+
setArg(key, value);
|
|
335
|
+
}
|
|
336
|
+
broken = true;
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
339
|
+
if (next === "-") {
|
|
340
|
+
setArg(letters[j], next);
|
|
341
|
+
continue;
|
|
342
|
+
}
|
|
343
|
+
if (/[A-Za-z]/.test(letters[j]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(next) && checkAllAliases(next, flags.bools) === false) {
|
|
344
|
+
setArg(letters[j], next);
|
|
345
|
+
broken = true;
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
if (letters[j + 1] && letters[j + 1].match(/\W/)) {
|
|
349
|
+
setArg(letters[j], next);
|
|
350
|
+
broken = true;
|
|
351
|
+
break;
|
|
352
|
+
} else {
|
|
353
|
+
setArg(letters[j], defaultValue(letters[j]));
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
key = arg.slice(-1)[0];
|
|
357
|
+
if (!broken && key !== "-") {
|
|
358
|
+
if (checkAllAliases(key, flags.arrays)) {
|
|
359
|
+
i = eatArray(i, key, args);
|
|
360
|
+
} else if (checkAllAliases(key, flags.nargs) !== false) {
|
|
361
|
+
i = eatNargs(i, key, args);
|
|
362
|
+
} else {
|
|
363
|
+
next = args[i + 1];
|
|
364
|
+
if (next !== void 0 && (!/^(-|--)[^-]/.test(next) || next.match(negative)) && !checkAllAliases(key, flags.bools) && !checkAllAliases(key, flags.counts)) {
|
|
365
|
+
setArg(key, next);
|
|
366
|
+
i++;
|
|
367
|
+
} else if (/^(true|false)$/.test(next)) {
|
|
368
|
+
setArg(key, next);
|
|
369
|
+
i++;
|
|
370
|
+
} else {
|
|
371
|
+
setArg(key, defaultValue(key));
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
} else if (arg.match(/^-[0-9]$/) && arg.match(negative) && checkAllAliases(arg.slice(1), flags.bools)) {
|
|
376
|
+
key = arg.slice(1);
|
|
377
|
+
setArg(key, defaultValue(key));
|
|
378
|
+
} else if (arg === "--") {
|
|
379
|
+
notFlags = args.slice(i + 1);
|
|
380
|
+
break;
|
|
381
|
+
} else if (configuration["halt-at-non-option"]) {
|
|
382
|
+
notFlags = args.slice(i);
|
|
383
|
+
break;
|
|
384
|
+
} else {
|
|
385
|
+
pushPositional(arg);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
applyEnvVars(argv, true);
|
|
389
|
+
applyEnvVars(argv, false);
|
|
390
|
+
setConfig(argv);
|
|
391
|
+
setConfigObjects();
|
|
392
|
+
applyDefaultsAndAliases(argv, flags.aliases, defaults, true);
|
|
393
|
+
applyCoercions(argv);
|
|
394
|
+
if (configuration["set-placeholder-key"])
|
|
395
|
+
setPlaceholderKeys(argv);
|
|
396
|
+
Object.keys(flags.counts).forEach(function(key) {
|
|
397
|
+
if (!hasKey(argv, key.split(".")))
|
|
398
|
+
setArg(key, 0);
|
|
399
|
+
});
|
|
400
|
+
if (notFlagsOption && notFlags.length)
|
|
401
|
+
argv[notFlagsArgv] = [];
|
|
402
|
+
notFlags.forEach(function(key) {
|
|
403
|
+
argv[notFlagsArgv].push(key);
|
|
404
|
+
});
|
|
405
|
+
if (configuration["camel-case-expansion"] && configuration["strip-dashed"]) {
|
|
406
|
+
Object.keys(argv).filter((key) => key !== "--" && key.includes("-")).forEach((key) => {
|
|
407
|
+
delete argv[key];
|
|
408
|
+
});
|
|
409
|
+
}
|
|
410
|
+
if (configuration["strip-aliased"]) {
|
|
411
|
+
;
|
|
412
|
+
[].concat(...Object.keys(aliases).map((k) => aliases[k])).forEach((alias) => {
|
|
413
|
+
if (configuration["camel-case-expansion"] && alias.includes("-")) {
|
|
414
|
+
delete argv[alias.split(".").map((prop) => camelCase(prop)).join(".")];
|
|
415
|
+
}
|
|
416
|
+
delete argv[alias];
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
function pushPositional(arg) {
|
|
420
|
+
const maybeCoercedNumber = maybeCoerceNumber("_", arg);
|
|
421
|
+
if (typeof maybeCoercedNumber === "string" || typeof maybeCoercedNumber === "number") {
|
|
422
|
+
argv._.push(maybeCoercedNumber);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
function eatNargs(i, key, args2, argAfterEqualSign) {
|
|
426
|
+
let ii;
|
|
427
|
+
let toEat = checkAllAliases(key, flags.nargs);
|
|
428
|
+
toEat = typeof toEat !== "number" || isNaN(toEat) ? 1 : toEat;
|
|
429
|
+
if (toEat === 0) {
|
|
430
|
+
if (!isUndefined(argAfterEqualSign)) {
|
|
431
|
+
error = Error(__("Argument unexpected for: %s", key));
|
|
432
|
+
}
|
|
433
|
+
setArg(key, defaultValue(key));
|
|
434
|
+
return i;
|
|
435
|
+
}
|
|
436
|
+
let available = isUndefined(argAfterEqualSign) ? 0 : 1;
|
|
437
|
+
if (configuration["nargs-eats-options"]) {
|
|
438
|
+
if (args2.length - (i + 1) + available < toEat) {
|
|
439
|
+
error = Error(__("Not enough arguments following: %s", key));
|
|
440
|
+
}
|
|
441
|
+
available = toEat;
|
|
442
|
+
} else {
|
|
443
|
+
for (ii = i + 1; ii < args2.length; ii++) {
|
|
444
|
+
if (!args2[ii].match(/^-[^0-9]/) || args2[ii].match(negative) || isUnknownOptionAsArg(args2[ii]))
|
|
445
|
+
available++;
|
|
446
|
+
else
|
|
447
|
+
break;
|
|
448
|
+
}
|
|
449
|
+
if (available < toEat)
|
|
450
|
+
error = Error(__("Not enough arguments following: %s", key));
|
|
451
|
+
}
|
|
452
|
+
let consumed = Math.min(available, toEat);
|
|
453
|
+
if (!isUndefined(argAfterEqualSign) && consumed > 0) {
|
|
454
|
+
setArg(key, argAfterEqualSign);
|
|
455
|
+
consumed--;
|
|
456
|
+
}
|
|
457
|
+
for (ii = i + 1; ii < consumed + i + 1; ii++) {
|
|
458
|
+
setArg(key, args2[ii]);
|
|
459
|
+
}
|
|
460
|
+
return i + consumed;
|
|
461
|
+
}
|
|
462
|
+
function eatArray(i, key, args2, argAfterEqualSign) {
|
|
463
|
+
let argsToSet = [];
|
|
464
|
+
let next = argAfterEqualSign || args2[i + 1];
|
|
465
|
+
const nargsCount = checkAllAliases(key, flags.nargs);
|
|
466
|
+
if (checkAllAliases(key, flags.bools) && !/^(true|false)$/.test(next)) {
|
|
467
|
+
argsToSet.push(true);
|
|
468
|
+
} else if (isUndefined(next) || isUndefined(argAfterEqualSign) && /^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next)) {
|
|
469
|
+
if (defaults[key] !== void 0) {
|
|
470
|
+
const defVal = defaults[key];
|
|
471
|
+
argsToSet = Array.isArray(defVal) ? defVal : [defVal];
|
|
472
|
+
}
|
|
473
|
+
} else {
|
|
474
|
+
if (!isUndefined(argAfterEqualSign)) {
|
|
475
|
+
argsToSet.push(processValue(key, argAfterEqualSign, true));
|
|
476
|
+
}
|
|
477
|
+
for (let ii = i + 1; ii < args2.length; ii++) {
|
|
478
|
+
if (!configuration["greedy-arrays"] && argsToSet.length > 0 || nargsCount && typeof nargsCount === "number" && argsToSet.length >= nargsCount)
|
|
479
|
+
break;
|
|
480
|
+
next = args2[ii];
|
|
481
|
+
if (/^-/.test(next) && !negative.test(next) && !isUnknownOptionAsArg(next))
|
|
482
|
+
break;
|
|
483
|
+
i = ii;
|
|
484
|
+
argsToSet.push(processValue(key, next, inputIsString));
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
if (typeof nargsCount === "number" && (nargsCount && argsToSet.length < nargsCount || isNaN(nargsCount) && argsToSet.length === 0)) {
|
|
488
|
+
error = Error(__("Not enough arguments following: %s", key));
|
|
489
|
+
}
|
|
490
|
+
setArg(key, argsToSet);
|
|
491
|
+
return i;
|
|
492
|
+
}
|
|
493
|
+
function setArg(key, val, shouldStripQuotes = inputIsString) {
|
|
494
|
+
if (/-/.test(key) && configuration["camel-case-expansion"]) {
|
|
495
|
+
const alias = key.split(".").map(function(prop) {
|
|
496
|
+
return camelCase(prop);
|
|
497
|
+
}).join(".");
|
|
498
|
+
addNewAlias(key, alias);
|
|
499
|
+
}
|
|
500
|
+
const value = processValue(key, val, shouldStripQuotes);
|
|
501
|
+
const splitKey = key.split(".");
|
|
502
|
+
setKey(argv, splitKey, value);
|
|
503
|
+
if (flags.aliases[key]) {
|
|
504
|
+
flags.aliases[key].forEach(function(x) {
|
|
505
|
+
const keyProperties = x.split(".");
|
|
506
|
+
setKey(argv, keyProperties, value);
|
|
507
|
+
});
|
|
508
|
+
}
|
|
509
|
+
if (splitKey.length > 1 && configuration["dot-notation"]) {
|
|
510
|
+
;
|
|
511
|
+
(flags.aliases[splitKey[0]] || []).forEach(function(x) {
|
|
512
|
+
let keyProperties = x.split(".");
|
|
513
|
+
const a = [].concat(splitKey);
|
|
514
|
+
a.shift();
|
|
515
|
+
keyProperties = keyProperties.concat(a);
|
|
516
|
+
if (!(flags.aliases[key] || []).includes(keyProperties.join("."))) {
|
|
517
|
+
setKey(argv, keyProperties, value);
|
|
518
|
+
}
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
if (checkAllAliases(key, flags.normalize) && !checkAllAliases(key, flags.arrays)) {
|
|
522
|
+
const keys = [key].concat(flags.aliases[key] || []);
|
|
523
|
+
keys.forEach(function(key2) {
|
|
524
|
+
Object.defineProperty(argvReturn, key2, {
|
|
525
|
+
enumerable: true,
|
|
526
|
+
get() {
|
|
527
|
+
return val;
|
|
528
|
+
},
|
|
529
|
+
set(value2) {
|
|
530
|
+
val = typeof value2 === "string" ? mixin.normalize(value2) : value2;
|
|
531
|
+
}
|
|
532
|
+
});
|
|
533
|
+
});
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
function addNewAlias(key, alias) {
|
|
537
|
+
if (!(flags.aliases[key] && flags.aliases[key].length)) {
|
|
538
|
+
flags.aliases[key] = [alias];
|
|
539
|
+
newAliases[alias] = true;
|
|
540
|
+
}
|
|
541
|
+
if (!(flags.aliases[alias] && flags.aliases[alias].length)) {
|
|
542
|
+
addNewAlias(alias, key);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
function processValue(key, val, shouldStripQuotes) {
|
|
546
|
+
if (shouldStripQuotes) {
|
|
547
|
+
val = stripQuotes(val);
|
|
548
|
+
}
|
|
549
|
+
if (checkAllAliases(key, flags.bools) || checkAllAliases(key, flags.counts)) {
|
|
550
|
+
if (typeof val === "string")
|
|
551
|
+
val = val === "true";
|
|
552
|
+
}
|
|
553
|
+
let value = Array.isArray(val) ? val.map(function(v) {
|
|
554
|
+
return maybeCoerceNumber(key, v);
|
|
555
|
+
}) : maybeCoerceNumber(key, val);
|
|
556
|
+
if (checkAllAliases(key, flags.counts) && (isUndefined(value) || typeof value === "boolean")) {
|
|
557
|
+
value = increment();
|
|
558
|
+
}
|
|
559
|
+
if (checkAllAliases(key, flags.normalize) && checkAllAliases(key, flags.arrays)) {
|
|
560
|
+
if (Array.isArray(val))
|
|
561
|
+
value = val.map((val2) => {
|
|
562
|
+
return mixin.normalize(val2);
|
|
563
|
+
});
|
|
564
|
+
else
|
|
565
|
+
value = mixin.normalize(val);
|
|
566
|
+
}
|
|
567
|
+
return value;
|
|
568
|
+
}
|
|
569
|
+
function maybeCoerceNumber(key, value) {
|
|
570
|
+
if (!configuration["parse-positional-numbers"] && key === "_")
|
|
571
|
+
return value;
|
|
572
|
+
if (!checkAllAliases(key, flags.strings) && !checkAllAliases(key, flags.bools) && !Array.isArray(value)) {
|
|
573
|
+
const shouldCoerceNumber = looksLikeNumber(value) && configuration["parse-numbers"] && Number.isSafeInteger(Math.floor(parseFloat(`${value}`)));
|
|
574
|
+
if (shouldCoerceNumber || !isUndefined(value) && checkAllAliases(key, flags.numbers)) {
|
|
575
|
+
value = Number(value);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
return value;
|
|
579
|
+
}
|
|
580
|
+
function setConfig(argv2) {
|
|
581
|
+
const configLookup = /* @__PURE__ */ Object.create(null);
|
|
582
|
+
applyDefaultsAndAliases(configLookup, flags.aliases, defaults);
|
|
583
|
+
Object.keys(flags.configs).forEach(function(configKey) {
|
|
584
|
+
const configPath = argv2[configKey] || configLookup[configKey];
|
|
585
|
+
if (configPath) {
|
|
586
|
+
try {
|
|
587
|
+
let config = null;
|
|
588
|
+
const resolvedConfigPath = mixin.resolve(mixin.cwd(), configPath);
|
|
589
|
+
const resolveConfig = flags.configs[configKey];
|
|
590
|
+
if (typeof resolveConfig === "function") {
|
|
591
|
+
try {
|
|
592
|
+
config = resolveConfig(resolvedConfigPath);
|
|
593
|
+
} catch (e) {
|
|
594
|
+
config = e;
|
|
595
|
+
}
|
|
596
|
+
if (config instanceof Error) {
|
|
597
|
+
error = config;
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
} else {
|
|
601
|
+
config = mixin.require(resolvedConfigPath);
|
|
602
|
+
}
|
|
603
|
+
setConfigObject(config);
|
|
604
|
+
} catch (ex) {
|
|
605
|
+
if (ex.name === "PermissionDenied")
|
|
606
|
+
error = ex;
|
|
607
|
+
else if (argv2[configKey])
|
|
608
|
+
error = Error(__("Invalid JSON config file: %s", configPath));
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
function setConfigObject(config, prev) {
|
|
614
|
+
Object.keys(config).forEach(function(key) {
|
|
615
|
+
const value = config[key];
|
|
616
|
+
const fullKey = prev ? prev + "." + key : key;
|
|
617
|
+
if (typeof value === "object" && value !== null && !Array.isArray(value) && configuration["dot-notation"]) {
|
|
618
|
+
setConfigObject(value, fullKey);
|
|
619
|
+
} else {
|
|
620
|
+
if (!hasKey(argv, fullKey.split(".")) || checkAllAliases(fullKey, flags.arrays) && configuration["combine-arrays"]) {
|
|
621
|
+
setArg(fullKey, value);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
function setConfigObjects() {
|
|
627
|
+
if (typeof configObjects !== "undefined") {
|
|
628
|
+
configObjects.forEach(function(configObject) {
|
|
629
|
+
setConfigObject(configObject);
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
function applyEnvVars(argv2, configOnly) {
|
|
634
|
+
if (typeof envPrefix === "undefined")
|
|
635
|
+
return;
|
|
636
|
+
const prefix = typeof envPrefix === "string" ? envPrefix : "";
|
|
637
|
+
const env2 = mixin.env();
|
|
638
|
+
Object.keys(env2).forEach(function(envVar) {
|
|
639
|
+
if (prefix === "" || envVar.lastIndexOf(prefix, 0) === 0) {
|
|
640
|
+
const keys = envVar.split("__").map(function(key, i) {
|
|
641
|
+
if (i === 0) {
|
|
642
|
+
key = key.substring(prefix.length);
|
|
643
|
+
}
|
|
644
|
+
return camelCase(key);
|
|
645
|
+
});
|
|
646
|
+
if ((configOnly && flags.configs[keys.join(".")] || !configOnly) && !hasKey(argv2, keys)) {
|
|
647
|
+
setArg(keys.join("."), env2[envVar]);
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
function applyCoercions(argv2) {
|
|
653
|
+
let coerce;
|
|
654
|
+
const applied = /* @__PURE__ */ new Set();
|
|
655
|
+
Object.keys(argv2).forEach(function(key) {
|
|
656
|
+
if (!applied.has(key)) {
|
|
657
|
+
coerce = checkAllAliases(key, flags.coercions);
|
|
658
|
+
if (typeof coerce === "function") {
|
|
659
|
+
try {
|
|
660
|
+
const value = maybeCoerceNumber(key, coerce(argv2[key]));
|
|
661
|
+
[].concat(flags.aliases[key] || [], key).forEach((ali) => {
|
|
662
|
+
applied.add(ali);
|
|
663
|
+
argv2[ali] = value;
|
|
664
|
+
});
|
|
665
|
+
} catch (err) {
|
|
666
|
+
error = err;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
function setPlaceholderKeys(argv2) {
|
|
673
|
+
flags.keys.forEach((key) => {
|
|
674
|
+
if (~key.indexOf("."))
|
|
675
|
+
return;
|
|
676
|
+
if (typeof argv2[key] === "undefined")
|
|
677
|
+
argv2[key] = void 0;
|
|
678
|
+
});
|
|
679
|
+
return argv2;
|
|
680
|
+
}
|
|
681
|
+
function applyDefaultsAndAliases(obj, aliases2, defaults2, canLog = false) {
|
|
682
|
+
Object.keys(defaults2).forEach(function(key) {
|
|
683
|
+
if (!hasKey(obj, key.split("."))) {
|
|
684
|
+
setKey(obj, key.split("."), defaults2[key]);
|
|
685
|
+
if (canLog)
|
|
686
|
+
defaulted[key] = true;
|
|
687
|
+
(aliases2[key] || []).forEach(function(x) {
|
|
688
|
+
if (hasKey(obj, x.split(".")))
|
|
689
|
+
return;
|
|
690
|
+
setKey(obj, x.split("."), defaults2[key]);
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
function hasKey(obj, keys) {
|
|
696
|
+
let o = obj;
|
|
697
|
+
if (!configuration["dot-notation"])
|
|
698
|
+
keys = [keys.join(".")];
|
|
699
|
+
keys.slice(0, -1).forEach(function(key2) {
|
|
700
|
+
o = o[key2] || {};
|
|
701
|
+
});
|
|
702
|
+
const key = keys[keys.length - 1];
|
|
703
|
+
if (typeof o !== "object")
|
|
704
|
+
return false;
|
|
705
|
+
else
|
|
706
|
+
return key in o;
|
|
707
|
+
}
|
|
708
|
+
function setKey(obj, keys, value) {
|
|
709
|
+
let o = obj;
|
|
710
|
+
if (!configuration["dot-notation"])
|
|
711
|
+
keys = [keys.join(".")];
|
|
712
|
+
keys.slice(0, -1).forEach(function(key2) {
|
|
713
|
+
key2 = sanitizeKey(key2);
|
|
714
|
+
if (typeof o === "object" && o[key2] === void 0) {
|
|
715
|
+
o[key2] = {};
|
|
716
|
+
}
|
|
717
|
+
if (typeof o[key2] !== "object" || Array.isArray(o[key2])) {
|
|
718
|
+
if (Array.isArray(o[key2])) {
|
|
719
|
+
o[key2].push({});
|
|
720
|
+
} else {
|
|
721
|
+
o[key2] = [o[key2], {}];
|
|
722
|
+
}
|
|
723
|
+
o = o[key2][o[key2].length - 1];
|
|
724
|
+
} else {
|
|
725
|
+
o = o[key2];
|
|
726
|
+
}
|
|
727
|
+
});
|
|
728
|
+
const key = sanitizeKey(keys[keys.length - 1]);
|
|
729
|
+
const isTypeArray = checkAllAliases(keys.join("."), flags.arrays);
|
|
730
|
+
const isValueArray = Array.isArray(value);
|
|
731
|
+
let duplicate = configuration["duplicate-arguments-array"];
|
|
732
|
+
if (!duplicate && checkAllAliases(key, flags.nargs)) {
|
|
733
|
+
duplicate = true;
|
|
734
|
+
if (!isUndefined(o[key]) && flags.nargs[key] === 1 || Array.isArray(o[key]) && o[key].length === flags.nargs[key]) {
|
|
735
|
+
o[key] = void 0;
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
if (value === increment()) {
|
|
739
|
+
o[key] = increment(o[key]);
|
|
740
|
+
} else if (Array.isArray(o[key])) {
|
|
741
|
+
if (duplicate && isTypeArray && isValueArray) {
|
|
742
|
+
o[key] = configuration["flatten-duplicate-arrays"] ? o[key].concat(value) : (Array.isArray(o[key][0]) ? o[key] : [o[key]]).concat([value]);
|
|
743
|
+
} else if (!duplicate && Boolean(isTypeArray) === Boolean(isValueArray)) {
|
|
744
|
+
o[key] = value;
|
|
745
|
+
} else {
|
|
746
|
+
o[key] = o[key].concat([value]);
|
|
747
|
+
}
|
|
748
|
+
} else if (o[key] === void 0 && isTypeArray) {
|
|
749
|
+
o[key] = isValueArray ? value : [value];
|
|
750
|
+
} else if (duplicate && !(o[key] === void 0 || checkAllAliases(key, flags.counts) || checkAllAliases(key, flags.bools))) {
|
|
751
|
+
o[key] = [o[key], value];
|
|
752
|
+
} else {
|
|
753
|
+
o[key] = value;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
function extendAliases(...args2) {
|
|
757
|
+
args2.forEach(function(obj) {
|
|
758
|
+
Object.keys(obj || {}).forEach(function(key) {
|
|
759
|
+
if (flags.aliases[key])
|
|
760
|
+
return;
|
|
761
|
+
flags.aliases[key] = [].concat(aliases[key] || []);
|
|
762
|
+
flags.aliases[key].concat(key).forEach(function(x) {
|
|
763
|
+
if (/-/.test(x) && configuration["camel-case-expansion"]) {
|
|
764
|
+
const c = camelCase(x);
|
|
765
|
+
if (c !== key && flags.aliases[key].indexOf(c) === -1) {
|
|
766
|
+
flags.aliases[key].push(c);
|
|
767
|
+
newAliases[c] = true;
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
});
|
|
771
|
+
flags.aliases[key].concat(key).forEach(function(x) {
|
|
772
|
+
if (x.length > 1 && /[A-Z]/.test(x) && configuration["camel-case-expansion"]) {
|
|
773
|
+
const c = decamelize(x, "-");
|
|
774
|
+
if (c !== key && flags.aliases[key].indexOf(c) === -1) {
|
|
775
|
+
flags.aliases[key].push(c);
|
|
776
|
+
newAliases[c] = true;
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
});
|
|
780
|
+
flags.aliases[key].forEach(function(x) {
|
|
781
|
+
flags.aliases[x] = [key].concat(flags.aliases[key].filter(function(y) {
|
|
782
|
+
return x !== y;
|
|
783
|
+
}));
|
|
784
|
+
});
|
|
785
|
+
});
|
|
786
|
+
});
|
|
787
|
+
}
|
|
788
|
+
function checkAllAliases(key, flag) {
|
|
789
|
+
const toCheck = [].concat(flags.aliases[key] || [], key);
|
|
790
|
+
const keys = Object.keys(flag);
|
|
791
|
+
const setAlias = toCheck.find((key2) => keys.includes(key2));
|
|
792
|
+
return setAlias ? flag[setAlias] : false;
|
|
793
|
+
}
|
|
794
|
+
function hasAnyFlag(key) {
|
|
795
|
+
const flagsKeys = Object.keys(flags);
|
|
796
|
+
const toCheck = [].concat(flagsKeys.map((k) => flags[k]));
|
|
797
|
+
return toCheck.some(function(flag) {
|
|
798
|
+
return Array.isArray(flag) ? flag.includes(key) : flag[key];
|
|
799
|
+
});
|
|
800
|
+
}
|
|
801
|
+
function hasFlagsMatching(arg, ...patterns) {
|
|
802
|
+
const toCheck = [].concat(...patterns);
|
|
803
|
+
return toCheck.some(function(pattern) {
|
|
804
|
+
const match = arg.match(pattern);
|
|
805
|
+
return match && hasAnyFlag(match[1]);
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
function hasAllShortFlags(arg) {
|
|
809
|
+
if (arg.match(negative) || !arg.match(/^-[^-]+/)) {
|
|
810
|
+
return false;
|
|
811
|
+
}
|
|
812
|
+
let hasAllFlags = true;
|
|
813
|
+
let next;
|
|
814
|
+
const letters = arg.slice(1).split("");
|
|
815
|
+
for (let j = 0; j < letters.length; j++) {
|
|
816
|
+
next = arg.slice(j + 2);
|
|
817
|
+
if (!hasAnyFlag(letters[j])) {
|
|
818
|
+
hasAllFlags = false;
|
|
819
|
+
break;
|
|
820
|
+
}
|
|
821
|
+
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/)) {
|
|
822
|
+
break;
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
return hasAllFlags;
|
|
826
|
+
}
|
|
827
|
+
function isUnknownOptionAsArg(arg) {
|
|
828
|
+
return configuration["unknown-options-as-args"] && isUnknownOption(arg);
|
|
829
|
+
}
|
|
830
|
+
function isUnknownOption(arg) {
|
|
831
|
+
arg = arg.replace(/^-{3,}/, "--");
|
|
832
|
+
if (arg.match(negative)) {
|
|
833
|
+
return false;
|
|
834
|
+
}
|
|
835
|
+
if (hasAllShortFlags(arg)) {
|
|
836
|
+
return false;
|
|
837
|
+
}
|
|
838
|
+
const flagWithEquals = /^-+([^=]+?)=[\s\S]*$/;
|
|
839
|
+
const normalFlag = /^-+([^=]+?)$/;
|
|
840
|
+
const flagEndingInHyphen = /^-+([^=]+?)-$/;
|
|
841
|
+
const flagEndingInDigits = /^-+([^=]+?\d+)$/;
|
|
842
|
+
const flagEndingInNonWordCharacters = /^-+([^=]+?)\W+.*$/;
|
|
843
|
+
return !hasFlagsMatching(arg, flagWithEquals, negatedBoolean, normalFlag, flagEndingInHyphen, flagEndingInDigits, flagEndingInNonWordCharacters);
|
|
844
|
+
}
|
|
845
|
+
function defaultValue(key) {
|
|
846
|
+
if (!checkAllAliases(key, flags.bools) && !checkAllAliases(key, flags.counts) && `${key}` in defaults) {
|
|
847
|
+
return defaults[key];
|
|
848
|
+
} else {
|
|
849
|
+
return defaultForType(guessType(key));
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
function defaultForType(type) {
|
|
853
|
+
const def = {
|
|
854
|
+
[DefaultValuesForTypeKey.BOOLEAN]: true,
|
|
855
|
+
[DefaultValuesForTypeKey.STRING]: "",
|
|
856
|
+
[DefaultValuesForTypeKey.NUMBER]: void 0,
|
|
857
|
+
[DefaultValuesForTypeKey.ARRAY]: []
|
|
858
|
+
};
|
|
859
|
+
return def[type];
|
|
860
|
+
}
|
|
861
|
+
function guessType(key) {
|
|
862
|
+
let type = DefaultValuesForTypeKey.BOOLEAN;
|
|
863
|
+
if (checkAllAliases(key, flags.strings))
|
|
864
|
+
type = DefaultValuesForTypeKey.STRING;
|
|
865
|
+
else if (checkAllAliases(key, flags.numbers))
|
|
866
|
+
type = DefaultValuesForTypeKey.NUMBER;
|
|
867
|
+
else if (checkAllAliases(key, flags.bools))
|
|
868
|
+
type = DefaultValuesForTypeKey.BOOLEAN;
|
|
869
|
+
else if (checkAllAliases(key, flags.arrays))
|
|
870
|
+
type = DefaultValuesForTypeKey.ARRAY;
|
|
871
|
+
return type;
|
|
872
|
+
}
|
|
873
|
+
function isUndefined(num) {
|
|
874
|
+
return num === void 0;
|
|
875
|
+
}
|
|
876
|
+
function checkConfiguration() {
|
|
877
|
+
Object.keys(flags.counts).find((key) => {
|
|
878
|
+
if (checkAllAliases(key, flags.arrays)) {
|
|
879
|
+
error = Error(__("Invalid configuration: %s, opts.count excludes opts.array.", key));
|
|
880
|
+
return true;
|
|
881
|
+
} else if (checkAllAliases(key, flags.nargs)) {
|
|
882
|
+
error = Error(__("Invalid configuration: %s, opts.count excludes opts.narg.", key));
|
|
883
|
+
return true;
|
|
884
|
+
}
|
|
885
|
+
return false;
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
return {
|
|
889
|
+
aliases: Object.assign({}, flags.aliases),
|
|
890
|
+
argv: Object.assign(argvReturn, argv),
|
|
891
|
+
configuration,
|
|
892
|
+
defaulted: Object.assign({}, defaulted),
|
|
893
|
+
error,
|
|
894
|
+
newAliases: Object.assign({}, newAliases)
|
|
895
|
+
};
|
|
896
|
+
}
|
|
897
|
+
};
|
|
898
|
+
function combineAliases(aliases) {
|
|
899
|
+
const aliasArrays = [];
|
|
900
|
+
const combined = /* @__PURE__ */ Object.create(null);
|
|
901
|
+
let change = true;
|
|
902
|
+
Object.keys(aliases).forEach(function(key) {
|
|
903
|
+
aliasArrays.push([].concat(aliases[key], key));
|
|
904
|
+
});
|
|
905
|
+
while (change) {
|
|
906
|
+
change = false;
|
|
907
|
+
for (let i = 0; i < aliasArrays.length; i++) {
|
|
908
|
+
for (let ii = i + 1; ii < aliasArrays.length; ii++) {
|
|
909
|
+
const intersect = aliasArrays[i].filter(function(v) {
|
|
910
|
+
return aliasArrays[ii].indexOf(v) !== -1;
|
|
911
|
+
});
|
|
912
|
+
if (intersect.length) {
|
|
913
|
+
aliasArrays[i] = aliasArrays[i].concat(aliasArrays[ii]);
|
|
914
|
+
aliasArrays.splice(ii, 1);
|
|
915
|
+
change = true;
|
|
916
|
+
break;
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
aliasArrays.forEach(function(aliasArray) {
|
|
922
|
+
aliasArray = aliasArray.filter(function(v, i, self) {
|
|
923
|
+
return self.indexOf(v) === i;
|
|
924
|
+
});
|
|
925
|
+
const lastAlias = aliasArray.pop();
|
|
926
|
+
if (lastAlias !== void 0 && typeof lastAlias === "string") {
|
|
927
|
+
combined[lastAlias] = aliasArray;
|
|
928
|
+
}
|
|
929
|
+
});
|
|
930
|
+
return combined;
|
|
931
|
+
}
|
|
932
|
+
function increment(orig) {
|
|
933
|
+
return orig !== void 0 ? orig + 1 : 1;
|
|
934
|
+
}
|
|
935
|
+
function sanitizeKey(key) {
|
|
936
|
+
if (key === "__proto__")
|
|
937
|
+
return "___proto___";
|
|
938
|
+
return key;
|
|
939
|
+
}
|
|
940
|
+
function stripQuotes(val) {
|
|
941
|
+
return typeof val === "string" && (val[0] === "'" || val[0] === '"') && val[val.length - 1] === val[0] ? val.substring(1, val.length - 1) : val;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
// node_modules/yargs-parser/build/lib/index.js
|
|
945
|
+
import { readFileSync } from "fs";
|
|
946
|
+
var _a;
|
|
947
|
+
var _b;
|
|
948
|
+
var _c;
|
|
949
|
+
var minNodeVersion = process && process.env && process.env.YARGS_MIN_NODE_VERSION ? Number(process.env.YARGS_MIN_NODE_VERSION) : 12;
|
|
950
|
+
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);
|
|
951
|
+
if (nodeVersion) {
|
|
952
|
+
const major = Number(nodeVersion.match(/^([^.]+)/)[1]);
|
|
953
|
+
if (major < minNodeVersion) {
|
|
954
|
+
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`);
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
var env = process ? process.env : {};
|
|
958
|
+
var parser = new YargsParser({
|
|
959
|
+
cwd: process.cwd,
|
|
960
|
+
env: () => {
|
|
961
|
+
return env;
|
|
962
|
+
},
|
|
963
|
+
format,
|
|
964
|
+
normalize,
|
|
965
|
+
resolve,
|
|
966
|
+
// TODO: figure out a way to combine ESM and CJS coverage, such that
|
|
967
|
+
// we can exercise all the lines below:
|
|
968
|
+
require: (path) => {
|
|
969
|
+
if (typeof __require !== "undefined") {
|
|
970
|
+
return __require(path);
|
|
971
|
+
} else if (path.match(/\.json$/)) {
|
|
972
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
973
|
+
} else {
|
|
974
|
+
throw Error("only .json config files are supported in ESM");
|
|
975
|
+
}
|
|
976
|
+
}
|
|
977
|
+
});
|
|
978
|
+
var yargsParser = function Parser(args, opts) {
|
|
979
|
+
const result = parser.parse(args.slice(), opts);
|
|
980
|
+
return result.argv;
|
|
981
|
+
};
|
|
982
|
+
yargsParser.detailed = function(args, opts) {
|
|
983
|
+
return parser.parse(args.slice(), opts);
|
|
984
|
+
};
|
|
985
|
+
yargsParser.camelCase = camelCase;
|
|
986
|
+
yargsParser.decamelize = decamelize;
|
|
987
|
+
yargsParser.looksLikeNumber = looksLikeNumber;
|
|
988
|
+
var lib_default = yargsParser;
|
|
989
|
+
|
|
990
|
+
// node_modules/yargs/build/lib/utils/process-argv.js
|
|
991
|
+
function getProcessArgvBinIndex() {
|
|
992
|
+
if (isBundledElectronApp())
|
|
993
|
+
return 0;
|
|
994
|
+
return 1;
|
|
995
|
+
}
|
|
996
|
+
function isBundledElectronApp() {
|
|
997
|
+
return isElectronApp() && !process.defaultApp;
|
|
998
|
+
}
|
|
999
|
+
function isElectronApp() {
|
|
1000
|
+
return !!process.versions.electron;
|
|
1001
|
+
}
|
|
1002
|
+
function hideBin(argv) {
|
|
1003
|
+
return argv.slice(getProcessArgvBinIndex() + 1);
|
|
1004
|
+
}
|
|
1005
|
+
function getProcessArgvBin() {
|
|
1006
|
+
return process.argv[getProcessArgvBinIndex()];
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
// node_modules/yargs/lib/platform-shims/esm.mjs
|
|
1010
|
+
import { notStrictEqual, strictEqual } from "assert";
|
|
1011
|
+
|
|
1012
|
+
// node_modules/cliui/build/lib/index.js
|
|
1013
|
+
var align = {
|
|
1014
|
+
right: alignRight,
|
|
1015
|
+
center: alignCenter
|
|
1016
|
+
};
|
|
1017
|
+
var top = 0;
|
|
1018
|
+
var right = 1;
|
|
1019
|
+
var bottom = 2;
|
|
1020
|
+
var left = 3;
|
|
1021
|
+
var UI = class {
|
|
1022
|
+
constructor(opts) {
|
|
1023
|
+
var _a2;
|
|
1024
|
+
this.width = opts.width;
|
|
1025
|
+
this.wrap = (_a2 = opts.wrap) !== null && _a2 !== void 0 ? _a2 : true;
|
|
1026
|
+
this.rows = [];
|
|
1027
|
+
}
|
|
1028
|
+
span(...args) {
|
|
1029
|
+
const cols = this.div(...args);
|
|
1030
|
+
cols.span = true;
|
|
1031
|
+
}
|
|
1032
|
+
resetOutput() {
|
|
1033
|
+
this.rows = [];
|
|
1034
|
+
}
|
|
1035
|
+
div(...args) {
|
|
1036
|
+
if (args.length === 0) {
|
|
1037
|
+
this.div("");
|
|
1038
|
+
}
|
|
1039
|
+
if (this.wrap && this.shouldApplyLayoutDSL(...args) && typeof args[0] === "string") {
|
|
1040
|
+
return this.applyLayoutDSL(args[0]);
|
|
1041
|
+
}
|
|
1042
|
+
const cols = args.map((arg) => {
|
|
1043
|
+
if (typeof arg === "string") {
|
|
1044
|
+
return this.colFromString(arg);
|
|
1045
|
+
}
|
|
1046
|
+
return arg;
|
|
1047
|
+
});
|
|
1048
|
+
this.rows.push(cols);
|
|
1049
|
+
return cols;
|
|
1050
|
+
}
|
|
1051
|
+
shouldApplyLayoutDSL(...args) {
|
|
1052
|
+
return args.length === 1 && typeof args[0] === "string" && /[\t\n]/.test(args[0]);
|
|
1053
|
+
}
|
|
1054
|
+
applyLayoutDSL(str) {
|
|
1055
|
+
const rows = str.split("\n").map((row) => row.split(" "));
|
|
1056
|
+
let leftColumnWidth = 0;
|
|
1057
|
+
rows.forEach((columns) => {
|
|
1058
|
+
if (columns.length > 1 && mixin2.stringWidth(columns[0]) > leftColumnWidth) {
|
|
1059
|
+
leftColumnWidth = Math.min(Math.floor(this.width * 0.5), mixin2.stringWidth(columns[0]));
|
|
1060
|
+
}
|
|
1061
|
+
});
|
|
1062
|
+
rows.forEach((columns) => {
|
|
1063
|
+
this.div(...columns.map((r, i) => {
|
|
1064
|
+
return {
|
|
1065
|
+
text: r.trim(),
|
|
1066
|
+
padding: this.measurePadding(r),
|
|
1067
|
+
width: i === 0 && columns.length > 1 ? leftColumnWidth : void 0
|
|
1068
|
+
};
|
|
1069
|
+
}));
|
|
1070
|
+
});
|
|
1071
|
+
return this.rows[this.rows.length - 1];
|
|
1072
|
+
}
|
|
1073
|
+
colFromString(text) {
|
|
1074
|
+
return {
|
|
1075
|
+
text,
|
|
1076
|
+
padding: this.measurePadding(text)
|
|
1077
|
+
};
|
|
1078
|
+
}
|
|
1079
|
+
measurePadding(str) {
|
|
1080
|
+
const noAnsi = mixin2.stripAnsi(str);
|
|
1081
|
+
return [0, noAnsi.match(/\s*$/)[0].length, 0, noAnsi.match(/^\s*/)[0].length];
|
|
1082
|
+
}
|
|
1083
|
+
toString() {
|
|
1084
|
+
const lines = [];
|
|
1085
|
+
this.rows.forEach((row) => {
|
|
1086
|
+
this.rowToString(row, lines);
|
|
1087
|
+
});
|
|
1088
|
+
return lines.filter((line) => !line.hidden).map((line) => line.text).join("\n");
|
|
1089
|
+
}
|
|
1090
|
+
rowToString(row, lines) {
|
|
1091
|
+
this.rasterize(row).forEach((rrow, r) => {
|
|
1092
|
+
let str = "";
|
|
1093
|
+
rrow.forEach((col, c) => {
|
|
1094
|
+
const { width } = row[c];
|
|
1095
|
+
const wrapWidth = this.negatePadding(row[c]);
|
|
1096
|
+
let ts = col;
|
|
1097
|
+
if (wrapWidth > mixin2.stringWidth(col)) {
|
|
1098
|
+
ts += " ".repeat(wrapWidth - mixin2.stringWidth(col));
|
|
1099
|
+
}
|
|
1100
|
+
if (row[c].align && row[c].align !== "left" && this.wrap) {
|
|
1101
|
+
const fn = align[row[c].align];
|
|
1102
|
+
ts = fn(ts, wrapWidth);
|
|
1103
|
+
if (mixin2.stringWidth(ts) < wrapWidth) {
|
|
1104
|
+
ts += " ".repeat((width || 0) - mixin2.stringWidth(ts) - 1);
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
const padding = row[c].padding || [0, 0, 0, 0];
|
|
1108
|
+
if (padding[left]) {
|
|
1109
|
+
str += " ".repeat(padding[left]);
|
|
1110
|
+
}
|
|
1111
|
+
str += addBorder(row[c], ts, "| ");
|
|
1112
|
+
str += ts;
|
|
1113
|
+
str += addBorder(row[c], ts, " |");
|
|
1114
|
+
if (padding[right]) {
|
|
1115
|
+
str += " ".repeat(padding[right]);
|
|
1116
|
+
}
|
|
1117
|
+
if (r === 0 && lines.length > 0) {
|
|
1118
|
+
str = this.renderInline(str, lines[lines.length - 1]);
|
|
1119
|
+
}
|
|
1120
|
+
});
|
|
1121
|
+
lines.push({
|
|
1122
|
+
text: str.replace(/ +$/, ""),
|
|
1123
|
+
span: row.span
|
|
1124
|
+
});
|
|
1125
|
+
});
|
|
1126
|
+
return lines;
|
|
1127
|
+
}
|
|
1128
|
+
// if the full 'source' can render in
|
|
1129
|
+
// the target line, do so.
|
|
1130
|
+
renderInline(source, previousLine) {
|
|
1131
|
+
const match = source.match(/^ */);
|
|
1132
|
+
const leadingWhitespace = match ? match[0].length : 0;
|
|
1133
|
+
const target = previousLine.text;
|
|
1134
|
+
const targetTextWidth = mixin2.stringWidth(target.trimRight());
|
|
1135
|
+
if (!previousLine.span) {
|
|
1136
|
+
return source;
|
|
1137
|
+
}
|
|
1138
|
+
if (!this.wrap) {
|
|
1139
|
+
previousLine.hidden = true;
|
|
1140
|
+
return target + source;
|
|
1141
|
+
}
|
|
1142
|
+
if (leadingWhitespace < targetTextWidth) {
|
|
1143
|
+
return source;
|
|
1144
|
+
}
|
|
1145
|
+
previousLine.hidden = true;
|
|
1146
|
+
return target.trimRight() + " ".repeat(leadingWhitespace - targetTextWidth) + source.trimLeft();
|
|
1147
|
+
}
|
|
1148
|
+
rasterize(row) {
|
|
1149
|
+
const rrows = [];
|
|
1150
|
+
const widths = this.columnWidths(row);
|
|
1151
|
+
let wrapped;
|
|
1152
|
+
row.forEach((col, c) => {
|
|
1153
|
+
col.width = widths[c];
|
|
1154
|
+
if (this.wrap) {
|
|
1155
|
+
wrapped = mixin2.wrap(col.text, this.negatePadding(col), { hard: true }).split("\n");
|
|
1156
|
+
} else {
|
|
1157
|
+
wrapped = col.text.split("\n");
|
|
1158
|
+
}
|
|
1159
|
+
if (col.border) {
|
|
1160
|
+
wrapped.unshift("." + "-".repeat(this.negatePadding(col) + 2) + ".");
|
|
1161
|
+
wrapped.push("'" + "-".repeat(this.negatePadding(col) + 2) + "'");
|
|
1162
|
+
}
|
|
1163
|
+
if (col.padding) {
|
|
1164
|
+
wrapped.unshift(...new Array(col.padding[top] || 0).fill(""));
|
|
1165
|
+
wrapped.push(...new Array(col.padding[bottom] || 0).fill(""));
|
|
1166
|
+
}
|
|
1167
|
+
wrapped.forEach((str, r) => {
|
|
1168
|
+
if (!rrows[r]) {
|
|
1169
|
+
rrows.push([]);
|
|
1170
|
+
}
|
|
1171
|
+
const rrow = rrows[r];
|
|
1172
|
+
for (let i = 0; i < c; i++) {
|
|
1173
|
+
if (rrow[i] === void 0) {
|
|
1174
|
+
rrow.push("");
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
rrow.push(str);
|
|
1178
|
+
});
|
|
1179
|
+
});
|
|
1180
|
+
return rrows;
|
|
1181
|
+
}
|
|
1182
|
+
negatePadding(col) {
|
|
1183
|
+
let wrapWidth = col.width || 0;
|
|
1184
|
+
if (col.padding) {
|
|
1185
|
+
wrapWidth -= (col.padding[left] || 0) + (col.padding[right] || 0);
|
|
1186
|
+
}
|
|
1187
|
+
if (col.border) {
|
|
1188
|
+
wrapWidth -= 4;
|
|
1189
|
+
}
|
|
1190
|
+
return wrapWidth;
|
|
1191
|
+
}
|
|
1192
|
+
columnWidths(row) {
|
|
1193
|
+
if (!this.wrap) {
|
|
1194
|
+
return row.map((col) => {
|
|
1195
|
+
return col.width || mixin2.stringWidth(col.text);
|
|
1196
|
+
});
|
|
1197
|
+
}
|
|
1198
|
+
let unset = row.length;
|
|
1199
|
+
let remainingWidth = this.width;
|
|
1200
|
+
const widths = row.map((col) => {
|
|
1201
|
+
if (col.width) {
|
|
1202
|
+
unset--;
|
|
1203
|
+
remainingWidth -= col.width;
|
|
1204
|
+
return col.width;
|
|
1205
|
+
}
|
|
1206
|
+
return void 0;
|
|
1207
|
+
});
|
|
1208
|
+
const unsetWidth = unset ? Math.floor(remainingWidth / unset) : 0;
|
|
1209
|
+
return widths.map((w, i) => {
|
|
1210
|
+
if (w === void 0) {
|
|
1211
|
+
return Math.max(unsetWidth, _minWidth(row[i]));
|
|
1212
|
+
}
|
|
1213
|
+
return w;
|
|
1214
|
+
});
|
|
1215
|
+
}
|
|
1216
|
+
};
|
|
1217
|
+
function addBorder(col, ts, style) {
|
|
1218
|
+
if (col.border) {
|
|
1219
|
+
if (/[.']-+[.']/.test(ts)) {
|
|
1220
|
+
return "";
|
|
1221
|
+
}
|
|
1222
|
+
if (ts.trim().length !== 0) {
|
|
1223
|
+
return style;
|
|
1224
|
+
}
|
|
1225
|
+
return " ";
|
|
1226
|
+
}
|
|
1227
|
+
return "";
|
|
1228
|
+
}
|
|
1229
|
+
function _minWidth(col) {
|
|
1230
|
+
const padding = col.padding || [];
|
|
1231
|
+
const minWidth = 1 + (padding[left] || 0) + (padding[right] || 0);
|
|
1232
|
+
if (col.border) {
|
|
1233
|
+
return minWidth + 4;
|
|
1234
|
+
}
|
|
1235
|
+
return minWidth;
|
|
1236
|
+
}
|
|
1237
|
+
function getWindowWidth() {
|
|
1238
|
+
if (typeof process === "object" && process.stdout && process.stdout.columns) {
|
|
1239
|
+
return process.stdout.columns;
|
|
1240
|
+
}
|
|
1241
|
+
return 80;
|
|
1242
|
+
}
|
|
1243
|
+
function alignRight(str, width) {
|
|
1244
|
+
str = str.trim();
|
|
1245
|
+
const strWidth = mixin2.stringWidth(str);
|
|
1246
|
+
if (strWidth < width) {
|
|
1247
|
+
return " ".repeat(width - strWidth) + str;
|
|
1248
|
+
}
|
|
1249
|
+
return str;
|
|
1250
|
+
}
|
|
1251
|
+
function alignCenter(str, width) {
|
|
1252
|
+
str = str.trim();
|
|
1253
|
+
const strWidth = mixin2.stringWidth(str);
|
|
1254
|
+
if (strWidth >= width) {
|
|
1255
|
+
return str;
|
|
1256
|
+
}
|
|
1257
|
+
return " ".repeat(width - strWidth >> 1) + str;
|
|
1258
|
+
}
|
|
1259
|
+
var mixin2;
|
|
1260
|
+
function cliui(opts, _mixin) {
|
|
1261
|
+
mixin2 = _mixin;
|
|
1262
|
+
return new UI({
|
|
1263
|
+
width: (opts === null || opts === void 0 ? void 0 : opts.width) || getWindowWidth(),
|
|
1264
|
+
wrap: opts === null || opts === void 0 ? void 0 : opts.wrap
|
|
1265
|
+
});
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
// node_modules/cliui/build/lib/string-utils.js
|
|
1269
|
+
var ansi = new RegExp("\x1B(?:\\[(?:\\d+[ABCDEFGJKSTm]|\\d+;\\d+[Hfm]|\\d+;\\d+;\\d+m|6n|s|u|\\?25[lh])|\\w)", "g");
|
|
1270
|
+
function stripAnsi(str) {
|
|
1271
|
+
return str.replace(ansi, "");
|
|
1272
|
+
}
|
|
1273
|
+
function wrap(str, width) {
|
|
1274
|
+
const [start, end] = str.match(ansi) || ["", ""];
|
|
1275
|
+
str = stripAnsi(str);
|
|
1276
|
+
let wrapped = "";
|
|
1277
|
+
for (let i = 0; i < str.length; i++) {
|
|
1278
|
+
if (i !== 0 && i % width === 0) {
|
|
1279
|
+
wrapped += "\n";
|
|
1280
|
+
}
|
|
1281
|
+
wrapped += str.charAt(i);
|
|
1282
|
+
}
|
|
1283
|
+
if (start && end) {
|
|
1284
|
+
wrapped = `${start}${wrapped}${end}`;
|
|
1285
|
+
}
|
|
1286
|
+
return wrapped;
|
|
1287
|
+
}
|
|
1288
|
+
|
|
1289
|
+
// node_modules/cliui/index.mjs
|
|
1290
|
+
function ui(opts) {
|
|
1291
|
+
return cliui(opts, {
|
|
1292
|
+
stringWidth: (str) => {
|
|
1293
|
+
return [...str].length;
|
|
1294
|
+
},
|
|
1295
|
+
stripAnsi,
|
|
1296
|
+
wrap
|
|
1297
|
+
});
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
// node_modules/escalade/sync/index.mjs
|
|
1301
|
+
import { dirname, resolve as resolve2 } from "path";
|
|
1302
|
+
import { readdirSync, statSync } from "fs";
|
|
1303
|
+
function sync_default(start, callback) {
|
|
1304
|
+
let dir = resolve2(".", start);
|
|
1305
|
+
let tmp, stats = statSync(dir);
|
|
1306
|
+
if (!stats.isDirectory()) {
|
|
1307
|
+
dir = dirname(dir);
|
|
1308
|
+
}
|
|
1309
|
+
while (true) {
|
|
1310
|
+
tmp = callback(dir, readdirSync(dir));
|
|
1311
|
+
if (tmp) return resolve2(dir, tmp);
|
|
1312
|
+
dir = dirname(tmp = dir);
|
|
1313
|
+
if (tmp === dir) break;
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
// node_modules/yargs/lib/platform-shims/esm.mjs
|
|
1318
|
+
import { inspect } from "util";
|
|
1319
|
+
import { readFileSync as readFileSync3 } from "fs";
|
|
1320
|
+
import { fileURLToPath } from "url";
|
|
1321
|
+
import { basename, dirname as dirname2, extname, relative, resolve as resolve4 } from "path";
|
|
1322
|
+
|
|
1323
|
+
// node_modules/yargs/build/lib/yerror.js
|
|
1324
|
+
var YError = class _YError extends Error {
|
|
1325
|
+
constructor(msg) {
|
|
1326
|
+
super(msg || "yargs error");
|
|
1327
|
+
this.name = "YError";
|
|
1328
|
+
if (Error.captureStackTrace) {
|
|
1329
|
+
Error.captureStackTrace(this, _YError);
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
};
|
|
1333
|
+
|
|
1334
|
+
// node_modules/y18n/build/lib/platform-shims/node.js
|
|
1335
|
+
import { readFileSync as readFileSync2, statSync as statSync2, writeFile } from "fs";
|
|
1336
|
+
import { format as format2 } from "util";
|
|
1337
|
+
import { resolve as resolve3 } from "path";
|
|
1338
|
+
var node_default = {
|
|
1339
|
+
fs: {
|
|
1340
|
+
readFileSync: readFileSync2,
|
|
1341
|
+
writeFile
|
|
1342
|
+
},
|
|
1343
|
+
format: format2,
|
|
1344
|
+
resolve: resolve3,
|
|
1345
|
+
exists: (file) => {
|
|
1346
|
+
try {
|
|
1347
|
+
return statSync2(file).isFile();
|
|
1348
|
+
} catch (err) {
|
|
1349
|
+
return false;
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
};
|
|
1353
|
+
|
|
1354
|
+
// node_modules/y18n/build/lib/index.js
|
|
1355
|
+
var shim;
|
|
1356
|
+
var Y18N = class {
|
|
1357
|
+
constructor(opts) {
|
|
1358
|
+
opts = opts || {};
|
|
1359
|
+
this.directory = opts.directory || "./locales";
|
|
1360
|
+
this.updateFiles = typeof opts.updateFiles === "boolean" ? opts.updateFiles : true;
|
|
1361
|
+
this.locale = opts.locale || "en";
|
|
1362
|
+
this.fallbackToLanguage = typeof opts.fallbackToLanguage === "boolean" ? opts.fallbackToLanguage : true;
|
|
1363
|
+
this.cache = /* @__PURE__ */ Object.create(null);
|
|
1364
|
+
this.writeQueue = [];
|
|
1365
|
+
}
|
|
1366
|
+
__(...args) {
|
|
1367
|
+
if (typeof arguments[0] !== "string") {
|
|
1368
|
+
return this._taggedLiteral(arguments[0], ...arguments);
|
|
1369
|
+
}
|
|
1370
|
+
const str = args.shift();
|
|
1371
|
+
let cb = function() {
|
|
1372
|
+
};
|
|
1373
|
+
if (typeof args[args.length - 1] === "function")
|
|
1374
|
+
cb = args.pop();
|
|
1375
|
+
cb = cb || function() {
|
|
1376
|
+
};
|
|
1377
|
+
if (!this.cache[this.locale])
|
|
1378
|
+
this._readLocaleFile();
|
|
1379
|
+
if (!this.cache[this.locale][str] && this.updateFiles) {
|
|
1380
|
+
this.cache[this.locale][str] = str;
|
|
1381
|
+
this._enqueueWrite({
|
|
1382
|
+
directory: this.directory,
|
|
1383
|
+
locale: this.locale,
|
|
1384
|
+
cb
|
|
1385
|
+
});
|
|
1386
|
+
} else {
|
|
1387
|
+
cb();
|
|
1388
|
+
}
|
|
1389
|
+
return shim.format.apply(shim.format, [this.cache[this.locale][str] || str].concat(args));
|
|
1390
|
+
}
|
|
1391
|
+
__n() {
|
|
1392
|
+
const args = Array.prototype.slice.call(arguments);
|
|
1393
|
+
const singular = args.shift();
|
|
1394
|
+
const plural = args.shift();
|
|
1395
|
+
const quantity = args.shift();
|
|
1396
|
+
let cb = function() {
|
|
1397
|
+
};
|
|
1398
|
+
if (typeof args[args.length - 1] === "function")
|
|
1399
|
+
cb = args.pop();
|
|
1400
|
+
if (!this.cache[this.locale])
|
|
1401
|
+
this._readLocaleFile();
|
|
1402
|
+
let str = quantity === 1 ? singular : plural;
|
|
1403
|
+
if (this.cache[this.locale][singular]) {
|
|
1404
|
+
const entry = this.cache[this.locale][singular];
|
|
1405
|
+
str = entry[quantity === 1 ? "one" : "other"];
|
|
1406
|
+
}
|
|
1407
|
+
if (!this.cache[this.locale][singular] && this.updateFiles) {
|
|
1408
|
+
this.cache[this.locale][singular] = {
|
|
1409
|
+
one: singular,
|
|
1410
|
+
other: plural
|
|
1411
|
+
};
|
|
1412
|
+
this._enqueueWrite({
|
|
1413
|
+
directory: this.directory,
|
|
1414
|
+
locale: this.locale,
|
|
1415
|
+
cb
|
|
1416
|
+
});
|
|
1417
|
+
} else {
|
|
1418
|
+
cb();
|
|
1419
|
+
}
|
|
1420
|
+
const values = [str];
|
|
1421
|
+
if (~str.indexOf("%d"))
|
|
1422
|
+
values.push(quantity);
|
|
1423
|
+
return shim.format.apply(shim.format, values.concat(args));
|
|
1424
|
+
}
|
|
1425
|
+
setLocale(locale) {
|
|
1426
|
+
this.locale = locale;
|
|
1427
|
+
}
|
|
1428
|
+
getLocale() {
|
|
1429
|
+
return this.locale;
|
|
1430
|
+
}
|
|
1431
|
+
updateLocale(obj) {
|
|
1432
|
+
if (!this.cache[this.locale])
|
|
1433
|
+
this._readLocaleFile();
|
|
1434
|
+
for (const key in obj) {
|
|
1435
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
1436
|
+
this.cache[this.locale][key] = obj[key];
|
|
1437
|
+
}
|
|
1438
|
+
}
|
|
1439
|
+
}
|
|
1440
|
+
_taggedLiteral(parts, ...args) {
|
|
1441
|
+
let str = "";
|
|
1442
|
+
parts.forEach(function(part, i) {
|
|
1443
|
+
const arg = args[i + 1];
|
|
1444
|
+
str += part;
|
|
1445
|
+
if (typeof arg !== "undefined") {
|
|
1446
|
+
str += "%s";
|
|
1447
|
+
}
|
|
1448
|
+
});
|
|
1449
|
+
return this.__.apply(this, [str].concat([].slice.call(args, 1)));
|
|
1450
|
+
}
|
|
1451
|
+
_enqueueWrite(work) {
|
|
1452
|
+
this.writeQueue.push(work);
|
|
1453
|
+
if (this.writeQueue.length === 1)
|
|
1454
|
+
this._processWriteQueue();
|
|
1455
|
+
}
|
|
1456
|
+
_processWriteQueue() {
|
|
1457
|
+
const _this = this;
|
|
1458
|
+
const work = this.writeQueue[0];
|
|
1459
|
+
const directory = work.directory;
|
|
1460
|
+
const locale = work.locale;
|
|
1461
|
+
const cb = work.cb;
|
|
1462
|
+
const languageFile = this._resolveLocaleFile(directory, locale);
|
|
1463
|
+
const serializedLocale = JSON.stringify(this.cache[locale], null, 2);
|
|
1464
|
+
shim.fs.writeFile(languageFile, serializedLocale, "utf-8", function(err) {
|
|
1465
|
+
_this.writeQueue.shift();
|
|
1466
|
+
if (_this.writeQueue.length > 0)
|
|
1467
|
+
_this._processWriteQueue();
|
|
1468
|
+
cb(err);
|
|
1469
|
+
});
|
|
1470
|
+
}
|
|
1471
|
+
_readLocaleFile() {
|
|
1472
|
+
let localeLookup = {};
|
|
1473
|
+
const languageFile = this._resolveLocaleFile(this.directory, this.locale);
|
|
1474
|
+
try {
|
|
1475
|
+
if (shim.fs.readFileSync) {
|
|
1476
|
+
localeLookup = JSON.parse(shim.fs.readFileSync(languageFile, "utf-8"));
|
|
1477
|
+
}
|
|
1478
|
+
} catch (err) {
|
|
1479
|
+
if (err instanceof SyntaxError) {
|
|
1480
|
+
err.message = "syntax error in " + languageFile;
|
|
1481
|
+
}
|
|
1482
|
+
if (err.code === "ENOENT")
|
|
1483
|
+
localeLookup = {};
|
|
1484
|
+
else
|
|
1485
|
+
throw err;
|
|
1486
|
+
}
|
|
1487
|
+
this.cache[this.locale] = localeLookup;
|
|
1488
|
+
}
|
|
1489
|
+
_resolveLocaleFile(directory, locale) {
|
|
1490
|
+
let file = shim.resolve(directory, "./", locale + ".json");
|
|
1491
|
+
if (this.fallbackToLanguage && !this._fileExistsSync(file) && ~locale.lastIndexOf("_")) {
|
|
1492
|
+
const languageFile = shim.resolve(directory, "./", locale.split("_")[0] + ".json");
|
|
1493
|
+
if (this._fileExistsSync(languageFile))
|
|
1494
|
+
file = languageFile;
|
|
1495
|
+
}
|
|
1496
|
+
return file;
|
|
1497
|
+
}
|
|
1498
|
+
_fileExistsSync(file) {
|
|
1499
|
+
return shim.exists(file);
|
|
1500
|
+
}
|
|
1501
|
+
};
|
|
1502
|
+
function y18n(opts, _shim) {
|
|
1503
|
+
shim = _shim;
|
|
1504
|
+
const y18n3 = new Y18N(opts);
|
|
1505
|
+
return {
|
|
1506
|
+
__: y18n3.__.bind(y18n3),
|
|
1507
|
+
__n: y18n3.__n.bind(y18n3),
|
|
1508
|
+
setLocale: y18n3.setLocale.bind(y18n3),
|
|
1509
|
+
getLocale: y18n3.getLocale.bind(y18n3),
|
|
1510
|
+
updateLocale: y18n3.updateLocale.bind(y18n3),
|
|
1511
|
+
locale: y18n3.locale
|
|
1512
|
+
};
|
|
1513
|
+
}
|
|
1514
|
+
|
|
1515
|
+
// node_modules/y18n/index.mjs
|
|
1516
|
+
var y18n2 = (opts) => {
|
|
1517
|
+
return y18n(opts, node_default);
|
|
1518
|
+
};
|
|
1519
|
+
var y18n_default = y18n2;
|
|
1520
|
+
|
|
1521
|
+
// node_modules/yargs/lib/platform-shims/esm.mjs
|
|
1522
|
+
var REQUIRE_ERROR = "require is not supported by ESM";
|
|
1523
|
+
var REQUIRE_DIRECTORY_ERROR = "loading a directory of commands is not supported yet for ESM";
|
|
1524
|
+
var __dirname;
|
|
1525
|
+
try {
|
|
1526
|
+
__dirname = fileURLToPath(import.meta.url);
|
|
1527
|
+
} catch (e) {
|
|
1528
|
+
__dirname = process.cwd();
|
|
1529
|
+
}
|
|
1530
|
+
var mainFilename = __dirname.substring(0, __dirname.lastIndexOf("node_modules"));
|
|
1531
|
+
var esm_default = {
|
|
1532
|
+
assert: {
|
|
1533
|
+
notStrictEqual,
|
|
1534
|
+
strictEqual
|
|
1535
|
+
},
|
|
1536
|
+
cliui: ui,
|
|
1537
|
+
findUp: sync_default,
|
|
1538
|
+
getEnv: (key) => {
|
|
1539
|
+
return process.env[key];
|
|
1540
|
+
},
|
|
1541
|
+
inspect,
|
|
1542
|
+
getCallerFile: () => {
|
|
1543
|
+
throw new YError(REQUIRE_DIRECTORY_ERROR);
|
|
1544
|
+
},
|
|
1545
|
+
getProcessArgvBin,
|
|
1546
|
+
mainFilename: mainFilename || process.cwd(),
|
|
1547
|
+
Parser: lib_default,
|
|
1548
|
+
path: {
|
|
1549
|
+
basename,
|
|
1550
|
+
dirname: dirname2,
|
|
1551
|
+
extname,
|
|
1552
|
+
relative,
|
|
1553
|
+
resolve: resolve4
|
|
1554
|
+
},
|
|
1555
|
+
process: {
|
|
1556
|
+
argv: () => process.argv,
|
|
1557
|
+
cwd: process.cwd,
|
|
1558
|
+
emitWarning: (warning, type) => process.emitWarning(warning, type),
|
|
1559
|
+
execPath: () => process.execPath,
|
|
1560
|
+
exit: process.exit,
|
|
1561
|
+
nextTick: process.nextTick,
|
|
1562
|
+
stdColumns: typeof process.stdout.columns !== "undefined" ? process.stdout.columns : null
|
|
1563
|
+
},
|
|
1564
|
+
readFileSync: readFileSync3,
|
|
1565
|
+
require: () => {
|
|
1566
|
+
throw new YError(REQUIRE_ERROR);
|
|
1567
|
+
},
|
|
1568
|
+
requireDirectory: () => {
|
|
1569
|
+
throw new YError(REQUIRE_DIRECTORY_ERROR);
|
|
1570
|
+
},
|
|
1571
|
+
stringWidth: (str) => {
|
|
1572
|
+
return [...str].length;
|
|
1573
|
+
},
|
|
1574
|
+
y18n: y18n_default({
|
|
1575
|
+
directory: resolve4(__dirname, "../../../locales"),
|
|
1576
|
+
updateFiles: false
|
|
1577
|
+
})
|
|
1578
|
+
};
|
|
1579
|
+
|
|
1580
|
+
// node_modules/yargs/build/lib/utils/apply-extends.js
|
|
1581
|
+
var previouslyVisitedConfigs = [];
|
|
1582
|
+
var shim2;
|
|
1583
|
+
function applyExtends(config, cwd, mergeExtends, _shim) {
|
|
1584
|
+
shim2 = _shim;
|
|
1585
|
+
let defaultConfig = {};
|
|
1586
|
+
if (Object.prototype.hasOwnProperty.call(config, "extends")) {
|
|
1587
|
+
if (typeof config.extends !== "string")
|
|
1588
|
+
return defaultConfig;
|
|
1589
|
+
const isPath = /\.json|\..*rc$/.test(config.extends);
|
|
1590
|
+
let pathToDefault = null;
|
|
1591
|
+
if (!isPath) {
|
|
1592
|
+
try {
|
|
1593
|
+
pathToDefault = __require.resolve(config.extends);
|
|
1594
|
+
} catch (_err) {
|
|
1595
|
+
return config;
|
|
1596
|
+
}
|
|
1597
|
+
} else {
|
|
1598
|
+
pathToDefault = getPathToDefaultConfig(cwd, config.extends);
|
|
1599
|
+
}
|
|
1600
|
+
checkForCircularExtends(pathToDefault);
|
|
1601
|
+
previouslyVisitedConfigs.push(pathToDefault);
|
|
1602
|
+
defaultConfig = isPath ? JSON.parse(shim2.readFileSync(pathToDefault, "utf8")) : __require(config.extends);
|
|
1603
|
+
delete config.extends;
|
|
1604
|
+
defaultConfig = applyExtends(defaultConfig, shim2.path.dirname(pathToDefault), mergeExtends, shim2);
|
|
1605
|
+
}
|
|
1606
|
+
previouslyVisitedConfigs = [];
|
|
1607
|
+
return mergeExtends ? mergeDeep(defaultConfig, config) : Object.assign({}, defaultConfig, config);
|
|
1608
|
+
}
|
|
1609
|
+
function checkForCircularExtends(cfgPath) {
|
|
1610
|
+
if (previouslyVisitedConfigs.indexOf(cfgPath) > -1) {
|
|
1611
|
+
throw new YError(`Circular extended configurations: '${cfgPath}'.`);
|
|
1612
|
+
}
|
|
1613
|
+
}
|
|
1614
|
+
function getPathToDefaultConfig(cwd, pathToExtend) {
|
|
1615
|
+
return shim2.path.resolve(cwd, pathToExtend);
|
|
1616
|
+
}
|
|
1617
|
+
function mergeDeep(config1, config2) {
|
|
1618
|
+
const target = {};
|
|
1619
|
+
function isObject(obj) {
|
|
1620
|
+
return obj && typeof obj === "object" && !Array.isArray(obj);
|
|
1621
|
+
}
|
|
1622
|
+
Object.assign(target, config1);
|
|
1623
|
+
for (const key of Object.keys(config2)) {
|
|
1624
|
+
if (isObject(config2[key]) && isObject(target[key])) {
|
|
1625
|
+
target[key] = mergeDeep(config1[key], config2[key]);
|
|
1626
|
+
} else {
|
|
1627
|
+
target[key] = config2[key];
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
return target;
|
|
1631
|
+
}
|
|
1632
|
+
|
|
1633
|
+
export {
|
|
1634
|
+
lib_default,
|
|
1635
|
+
hideBin,
|
|
1636
|
+
YError,
|
|
1637
|
+
esm_default,
|
|
1638
|
+
applyExtends
|
|
1639
|
+
};
|
|
1640
|
+
/*! Bundled license information:
|
|
1641
|
+
|
|
1642
|
+
yargs-parser/build/lib/string-utils.js:
|
|
1643
|
+
yargs-parser/build/lib/tokenize-arg-string.js:
|
|
1644
|
+
yargs-parser/build/lib/yargs-parser-types.js:
|
|
1645
|
+
yargs-parser/build/lib/yargs-parser.js:
|
|
1646
|
+
(**
|
|
1647
|
+
* @license
|
|
1648
|
+
* Copyright (c) 2016, Contributors
|
|
1649
|
+
* SPDX-License-Identifier: ISC
|
|
1650
|
+
*)
|
|
1651
|
+
|
|
1652
|
+
yargs-parser/build/lib/index.js:
|
|
1653
|
+
(**
|
|
1654
|
+
* @fileoverview Main entrypoint for libraries using yargs-parser in Node.js
|
|
1655
|
+
* CJS and ESM environments.
|
|
1656
|
+
*
|
|
1657
|
+
* @license
|
|
1658
|
+
* Copyright (c) 2016, Contributors
|
|
1659
|
+
* SPDX-License-Identifier: ISC
|
|
1660
|
+
*)
|
|
1661
|
+
*/
|