@teams-max/mwsp 1.0.2 → 2.0.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.
Files changed (90) hide show
  1. package/bin/mwsp.js +0 -29
  2. package/es/cli/build.d.ts +0 -1
  3. package/es/cli/build.js +69 -61
  4. package/es/cli/cli.js +4 -12
  5. package/es/cli/start.d.ts +0 -1
  6. package/es/cli/start.js +48 -26
  7. package/es/index.d.ts +2 -0
  8. package/es/index.js +3 -1
  9. package/es/utils/chalk/LICENSE +9 -0
  10. package/es/utils/chalk/index.d.ts +416 -0
  11. package/es/utils/chalk/index.js +1719 -0
  12. package/es/utils/chalk/package.json +1 -0
  13. package/es/{cli/update.js → utils/changelog.js} +41 -34
  14. package/es/{internal → utils}/datetimeFormat.js +1 -3
  15. package/es/utils/defineConfig.js +20 -0
  16. package/es/{internal → utils}/exec.js +3 -2
  17. package/es/utils/getPackages.js +9 -0
  18. package/es/{cli/dev.js → utils/git.js} +88 -36
  19. package/es/{internal/buildNotify.js → utils/index.js} +220 -97
  20. package/es/utils/isNextVersion.js +3 -0
  21. package/es/utils/parseDoc.js +33 -0
  22. package/es/utils/yargs-parser/index.d.ts +112 -0
  23. package/es/utils/yargs-parser/index.js +919 -0
  24. package/es/utils/yargs-parser/package.json +1 -0
  25. package/lib/cli/build.d.ts +0 -1
  26. package/lib/cli/build.js +54 -50
  27. package/lib/cli/cli.js +0 -8
  28. package/lib/cli/start.d.ts +0 -1
  29. package/lib/cli/start.js +25 -30
  30. package/lib/index.d.ts +2 -0
  31. package/lib/index.js +3 -0
  32. package/lib/utils/chalk/LICENSE +9 -0
  33. package/lib/utils/chalk/index.d.ts +416 -0
  34. package/lib/utils/chalk/index.js +1495 -0
  35. package/lib/utils/chalk/package.json +1 -0
  36. package/lib/utils/changelog.js +21 -0
  37. package/lib/{internal → utils}/cross-spawn/index.js +1 -1
  38. package/lib/{internal → utils}/datetimeFormat.js +10 -29
  39. package/lib/utils/defineConfig.js +19 -0
  40. package/lib/utils/exec.js +23 -0
  41. package/lib/{internal → utils}/execa/index.js +1 -1
  42. package/lib/utils/getPackages.js +6 -0
  43. package/lib/utils/git.js +23 -0
  44. package/lib/utils/index.js +159 -0
  45. package/lib/utils/isNextVersion.js +4 -0
  46. package/lib/{internal → utils}/merge-stream/index.js +1 -1
  47. package/lib/utils/parseDoc.js +30 -0
  48. package/lib/utils/yargs-parser/index.d.ts +112 -0
  49. package/lib/utils/yargs-parser/index.js +905 -0
  50. package/lib/utils/yargs-parser/package.json +1 -0
  51. package/package.json +4 -11
  52. package/es/cli/dev.d.ts +0 -1
  53. package/es/cli/update.d.ts +0 -2
  54. package/es/internal/buildNotify.d.ts +0 -10
  55. package/es/internal/datetimeFormat.d.ts +0 -9
  56. package/es/internal/exec.d.ts +0 -1
  57. package/es/internal/utils.d.ts +0 -14
  58. package/es/internal/utils.js +0 -90
  59. package/lib/cli/dev.d.ts +0 -1
  60. package/lib/cli/dev.js +0 -62
  61. package/lib/cli/update.d.ts +0 -2
  62. package/lib/cli/update.js +0 -50
  63. package/lib/internal/buildNotify.d.ts +0 -10
  64. package/lib/internal/buildNotify.js +0 -112
  65. package/lib/internal/datetimeFormat.d.ts +0 -9
  66. package/lib/internal/exec.d.ts +0 -1
  67. package/lib/internal/exec.js +0 -60
  68. package/lib/internal/utils.d.ts +0 -14
  69. package/lib/internal/utils.js +0 -100
  70. /package/es/{internal → utils}/cross-spawn/LICENSE +0 -0
  71. /package/es/{internal → utils}/cross-spawn/index.d.ts +0 -0
  72. /package/es/{internal → utils}/cross-spawn/index.js +0 -0
  73. /package/es/{internal → utils}/cross-spawn/package.json +0 -0
  74. /package/es/{internal → utils}/execa/LICENSE +0 -0
  75. /package/es/{internal → utils}/execa/index.d.ts +0 -0
  76. /package/es/{internal → utils}/execa/index.js +0 -0
  77. /package/es/{internal → utils}/execa/package.json +0 -0
  78. /package/es/{internal → utils}/merge-stream/LICENSE +0 -0
  79. /package/es/{internal → utils}/merge-stream/index.d.ts +0 -0
  80. /package/es/{internal → utils}/merge-stream/index.js +0 -0
  81. /package/es/{internal → utils}/merge-stream/package.json +0 -0
  82. /package/lib/{internal → utils}/cross-spawn/LICENSE +0 -0
  83. /package/lib/{internal → utils}/cross-spawn/index.d.ts +0 -0
  84. /package/lib/{internal → utils}/cross-spawn/package.json +0 -0
  85. /package/lib/{internal → utils}/execa/LICENSE +0 -0
  86. /package/lib/{internal → utils}/execa/index.d.ts +0 -0
  87. /package/lib/{internal → utils}/execa/package.json +0 -0
  88. /package/lib/{internal → utils}/merge-stream/LICENSE +0 -0
  89. /package/lib/{internal → utils}/merge-stream/index.d.ts +0 -0
  90. /package/lib/{internal → utils}/merge-stream/package.json +0 -0
@@ -0,0 +1,905 @@
1
+ // src/utils/yargs-parser/index.js
2
+ module.exports = (() => {
3
+ var s = {
4
+ 362: (s2) => {
5
+ "use strict";
6
+ const n2 = (s3) => {
7
+ let n3 = false;
8
+ let t2 = false;
9
+ let e = false;
10
+ for (let c = 0; c < s3.length; c++) {
11
+ const r = s3[c];
12
+ if (n3 && /[a-zA-Z]/.test(r) && r.toUpperCase() === r) {
13
+ s3 = s3.slice(0, c) + "-" + s3.slice(c);
14
+ n3 = false;
15
+ e = t2;
16
+ t2 = true;
17
+ c++;
18
+ } else if (t2 && e && /[a-zA-Z]/.test(r) && r.toLowerCase() === r) {
19
+ s3 = s3.slice(0, c - 1) + "-" + s3.slice(c - 1);
20
+ e = t2;
21
+ t2 = false;
22
+ n3 = true;
23
+ } else {
24
+ n3 = r.toLowerCase() === r && r.toUpperCase() !== r;
25
+ e = t2;
26
+ t2 = r.toUpperCase() === r && r.toLowerCase() !== r;
27
+ }
28
+ }
29
+ return s3;
30
+ };
31
+ const t = (s3, t2) => {
32
+ if (!(typeof s3 === "string" || Array.isArray(s3))) {
33
+ throw new TypeError("Expected the input to be `string | string[]`");
34
+ }
35
+ t2 = Object.assign({ pascalCase: false }, t2);
36
+ const e = (s4) => t2.pascalCase ? s4.charAt(0).toUpperCase() + s4.slice(1) : s4;
37
+ if (Array.isArray(s3)) {
38
+ s3 = s3.map((s4) => s4.trim()).filter((s4) => s4.length).join("-");
39
+ } else {
40
+ s3 = s3.trim();
41
+ }
42
+ if (s3.length === 0) {
43
+ return "";
44
+ }
45
+ if (s3.length === 1) {
46
+ return t2.pascalCase ? s3.toUpperCase() : s3.toLowerCase();
47
+ }
48
+ const c = s3 !== s3.toLowerCase();
49
+ if (c) {
50
+ s3 = n2(s3);
51
+ }
52
+ s3 = s3.replace(/^[_.\- ]+/, "").toLowerCase().replace(/[_.\- ]+(\w|$)/g, (s4, n3) => n3.toUpperCase()).replace(/\d+(\w|$)/g, (s4) => s4.toUpperCase());
53
+ return e(s3);
54
+ };
55
+ s2.exports = t;
56
+ s2.exports.default = t;
57
+ },
58
+ 159: (s2) => {
59
+ "use strict";
60
+ s2.exports = function(s3, n2) {
61
+ if (typeof s3 !== "string") {
62
+ throw new TypeError("Expected a string");
63
+ }
64
+ n2 = typeof n2 === "undefined" ? "_" : n2;
65
+ return s3.replace(/([a-z\d])([A-Z])/g, "$1" + n2 + "$2").replace(/([A-Z]+)([A-Z][a-z\d]+)/g, "$1" + n2 + "$2").toLowerCase();
66
+ };
67
+ },
68
+ 246: (s2, n2, t) => {
69
+ const e = t(362);
70
+ const c = t(159);
71
+ const r = t(622);
72
+ const l = t(433);
73
+ const o = t(669);
74
+ function parse(s3, n3) {
75
+ n3 = Object.assign(/* @__PURE__ */ Object.create(null), n3);
76
+ s3 = l(s3);
77
+ const t2 = combineAliases(Object.assign(/* @__PURE__ */ Object.create(null), n3.alias));
78
+ const f = Object.assign(
79
+ {
80
+ "boolean-negation": true,
81
+ "camel-case-expansion": true,
82
+ "combine-arrays": false,
83
+ "dot-notation": true,
84
+ "duplicate-arguments-array": true,
85
+ "flatten-duplicate-arrays": true,
86
+ "greedy-arrays": true,
87
+ "halt-at-non-option": false,
88
+ "nargs-eats-options": false,
89
+ "negation-prefix": "no-",
90
+ "parse-numbers": true,
91
+ "populate--": false,
92
+ "set-placeholder-key": false,
93
+ "short-option-groups": true,
94
+ "strip-aliased": false,
95
+ "strip-dashed": false,
96
+ "unknown-options-as-args": false
97
+ },
98
+ n3.configuration
99
+ );
100
+ const a = Object.assign(/* @__PURE__ */ Object.create(null), n3.default);
101
+ const i = n3.configObjects || [];
102
+ const u = n3.envPrefix;
103
+ const h = f["populate--"];
104
+ const A = h ? "--" : "_";
105
+ const p = /* @__PURE__ */ Object.create(null);
106
+ const d = /* @__PURE__ */ Object.create(null);
107
+ const b = n3.__ || o.format;
108
+ const O = {
109
+ aliases: /* @__PURE__ */ Object.create(null),
110
+ arrays: /* @__PURE__ */ Object.create(null),
111
+ bools: /* @__PURE__ */ Object.create(null),
112
+ strings: /* @__PURE__ */ Object.create(null),
113
+ numbers: /* @__PURE__ */ Object.create(null),
114
+ counts: /* @__PURE__ */ Object.create(null),
115
+ normalize: /* @__PURE__ */ Object.create(null),
116
+ configs: /* @__PURE__ */ Object.create(null),
117
+ nargs: /* @__PURE__ */ Object.create(null),
118
+ coercions: /* @__PURE__ */ Object.create(null),
119
+ keys: []
120
+ };
121
+ const m = /^-([0-9]+(\.[0-9]+)?|\.[0-9]+)$/;
122
+ const E = new RegExp("^--" + f["negation-prefix"] + "(.+)");
123
+ [].concat(n3.array).filter(Boolean).forEach(function(s4) {
124
+ const n4 = s4.key || s4;
125
+ const t3 = Object.keys(s4).map(function(s5) {
126
+ return { boolean: "bools", string: "strings", number: "numbers" }[s5];
127
+ }).filter(Boolean).pop();
128
+ if (t3) {
129
+ O[t3][n4] = true;
130
+ }
131
+ O.arrays[n4] = true;
132
+ O.keys.push(n4);
133
+ });
134
+ [].concat(n3.boolean).filter(Boolean).forEach(function(s4) {
135
+ O.bools[s4] = true;
136
+ O.keys.push(s4);
137
+ });
138
+ [].concat(n3.string).filter(Boolean).forEach(function(s4) {
139
+ O.strings[s4] = true;
140
+ O.keys.push(s4);
141
+ });
142
+ [].concat(n3.number).filter(Boolean).forEach(function(s4) {
143
+ O.numbers[s4] = true;
144
+ O.keys.push(s4);
145
+ });
146
+ [].concat(n3.count).filter(Boolean).forEach(function(s4) {
147
+ O.counts[s4] = true;
148
+ O.keys.push(s4);
149
+ });
150
+ [].concat(n3.normalize).filter(Boolean).forEach(function(s4) {
151
+ O.normalize[s4] = true;
152
+ O.keys.push(s4);
153
+ });
154
+ Object.keys(n3.narg || {}).forEach(function(s4) {
155
+ O.nargs[s4] = n3.narg[s4];
156
+ O.keys.push(s4);
157
+ });
158
+ Object.keys(n3.coerce || {}).forEach(function(s4) {
159
+ O.coercions[s4] = n3.coerce[s4];
160
+ O.keys.push(s4);
161
+ });
162
+ if (Array.isArray(n3.config) || typeof n3.config === "string") {
163
+ [].concat(n3.config).filter(Boolean).forEach(function(s4) {
164
+ O.configs[s4] = true;
165
+ });
166
+ } else {
167
+ Object.keys(n3.config || {}).forEach(function(s4) {
168
+ O.configs[s4] = n3.config[s4];
169
+ });
170
+ }
171
+ extendAliases(n3.key, t2, n3.default, O.arrays);
172
+ Object.keys(a).forEach(function(s4) {
173
+ (O.aliases[s4] || []).forEach(function(n4) {
174
+ a[n4] = a[s4];
175
+ });
176
+ });
177
+ let _ = null;
178
+ checkConfiguration();
179
+ let w = [];
180
+ const j = Object.assign(/* @__PURE__ */ Object.create(null), { _: [] });
181
+ const N = {};
182
+ for (let n4 = 0; n4 < s3.length; n4++) {
183
+ const t3 = s3[n4];
184
+ let e2;
185
+ let c2;
186
+ let r2;
187
+ let l2;
188
+ let o2;
189
+ let a2;
190
+ if (t3 !== "--" && isUnknownOptionAsArg(t3)) {
191
+ j._.push(t3);
192
+ } else if (t3.match(/^--.+=/) || !f["short-option-groups"] && t3.match(/^-.+=/)) {
193
+ l2 = t3.match(/^--?([^=]+)=([\s\S]*)$/);
194
+ if (checkAllAliases(l2[1], O.arrays)) {
195
+ n4 = eatArray(n4, l2[1], s3, l2[2]);
196
+ } else if (checkAllAliases(l2[1], O.nargs) !== false) {
197
+ n4 = eatNargs(n4, l2[1], s3, l2[2]);
198
+ } else {
199
+ setArg(l2[1], l2[2]);
200
+ }
201
+ } else if (t3.match(E) && f["boolean-negation"]) {
202
+ c2 = t3.match(E)[1];
203
+ setArg(c2, checkAllAliases(c2, O.arrays) ? [false] : false);
204
+ } else if (t3.match(/^--.+/) || !f["short-option-groups"] && t3.match(/^-[^-]+/)) {
205
+ c2 = t3.match(/^--?(.+)/)[1];
206
+ if (checkAllAliases(c2, O.arrays)) {
207
+ n4 = eatArray(n4, c2, s3);
208
+ } else if (checkAllAliases(c2, O.nargs) !== false) {
209
+ n4 = eatNargs(n4, c2, s3);
210
+ } else {
211
+ o2 = s3[n4 + 1];
212
+ if (o2 !== void 0 && (!o2.match(/^-/) || o2.match(m)) && !checkAllAliases(c2, O.bools) && !checkAllAliases(c2, O.counts)) {
213
+ setArg(c2, o2);
214
+ n4++;
215
+ } else if (/^(true|false)$/.test(o2)) {
216
+ setArg(c2, o2);
217
+ n4++;
218
+ } else {
219
+ setArg(c2, defaultValue(c2));
220
+ }
221
+ }
222
+ } else if (t3.match(/^-.\..+=/)) {
223
+ l2 = t3.match(/^-([^=]+)=([\s\S]*)$/);
224
+ setArg(l2[1], l2[2]);
225
+ } else if (t3.match(/^-.\..+/) && !t3.match(m)) {
226
+ o2 = s3[n4 + 1];
227
+ c2 = t3.match(/^-(.\..+)/)[1];
228
+ if (o2 !== void 0 && !o2.match(/^-/) && !checkAllAliases(c2, O.bools) && !checkAllAliases(c2, O.counts)) {
229
+ setArg(c2, o2);
230
+ n4++;
231
+ } else {
232
+ setArg(c2, defaultValue(c2));
233
+ }
234
+ } else if (t3.match(/^-[^-]+/) && !t3.match(m)) {
235
+ r2 = t3.slice(1, -1).split("");
236
+ e2 = false;
237
+ for (let l3 = 0; l3 < r2.length; l3++) {
238
+ o2 = t3.slice(l3 + 2);
239
+ if (r2[l3 + 1] && r2[l3 + 1] === "=") {
240
+ a2 = t3.slice(l3 + 3);
241
+ c2 = r2[l3];
242
+ if (checkAllAliases(c2, O.arrays)) {
243
+ n4 = eatArray(n4, c2, s3, a2);
244
+ } else if (checkAllAliases(c2, O.nargs) !== false) {
245
+ n4 = eatNargs(n4, c2, s3, a2);
246
+ } else {
247
+ setArg(c2, a2);
248
+ }
249
+ e2 = true;
250
+ break;
251
+ }
252
+ if (o2 === "-") {
253
+ setArg(r2[l3], o2);
254
+ continue;
255
+ }
256
+ if (/[A-Za-z]/.test(r2[l3]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(o2)) {
257
+ setArg(r2[l3], o2);
258
+ e2 = true;
259
+ break;
260
+ }
261
+ if (r2[l3 + 1] && r2[l3 + 1].match(/\W/)) {
262
+ setArg(r2[l3], o2);
263
+ e2 = true;
264
+ break;
265
+ } else {
266
+ setArg(r2[l3], defaultValue(r2[l3]));
267
+ }
268
+ }
269
+ c2 = t3.slice(-1)[0];
270
+ if (!e2 && c2 !== "-") {
271
+ if (checkAllAliases(c2, O.arrays)) {
272
+ n4 = eatArray(n4, c2, s3);
273
+ } else if (checkAllAliases(c2, O.nargs) !== false) {
274
+ n4 = eatNargs(n4, c2, s3);
275
+ } else {
276
+ o2 = s3[n4 + 1];
277
+ if (o2 !== void 0 && (!/^(-|--)[^-]/.test(o2) || o2.match(m)) && !checkAllAliases(c2, O.bools) && !checkAllAliases(c2, O.counts)) {
278
+ setArg(c2, o2);
279
+ n4++;
280
+ } else if (/^(true|false)$/.test(o2)) {
281
+ setArg(c2, o2);
282
+ n4++;
283
+ } else {
284
+ setArg(c2, defaultValue(c2));
285
+ }
286
+ }
287
+ }
288
+ } else if (t3.match(/^-[0-9]$/) && t3.match(m) && checkAllAliases(t3.slice(1), O.bools)) {
289
+ c2 = t3.slice(1);
290
+ setArg(c2, defaultValue(c2));
291
+ } else if (t3 === "--") {
292
+ w = s3.slice(n4 + 1);
293
+ break;
294
+ } else if (f["halt-at-non-option"]) {
295
+ w = s3.slice(n4);
296
+ break;
297
+ } else {
298
+ j._.push(maybeCoerceNumber("_", t3));
299
+ }
300
+ }
301
+ applyEnvVars(j, true);
302
+ applyEnvVars(j, false);
303
+ setConfig(j);
304
+ setConfigObjects();
305
+ applyDefaultsAndAliases(j, O.aliases, a, true);
306
+ applyCoercions(j);
307
+ if (f["set-placeholder-key"])
308
+ setPlaceholderKeys(j);
309
+ Object.keys(O.counts).forEach(function(s4) {
310
+ if (!hasKey(j, s4.split(".")))
311
+ setArg(s4, 0);
312
+ });
313
+ if (h && w.length)
314
+ j[A] = [];
315
+ w.forEach(function(s4) {
316
+ j[A].push(s4);
317
+ });
318
+ if (f["camel-case-expansion"] && f["strip-dashed"]) {
319
+ Object.keys(j).filter((s4) => s4 !== "--" && s4.includes("-")).forEach((s4) => {
320
+ delete j[s4];
321
+ });
322
+ }
323
+ if (f["strip-aliased"]) {
324
+ [].concat(...Object.keys(t2).map((s4) => t2[s4])).forEach((s4) => {
325
+ if (f["camel-case-expansion"]) {
326
+ delete j[s4.split(".").map((s5) => e(s5)).join(".")];
327
+ }
328
+ delete j[s4];
329
+ });
330
+ }
331
+ function eatNargs(s4, n4, t3, e2) {
332
+ let c2;
333
+ let r2 = checkAllAliases(n4, O.nargs);
334
+ r2 = isNaN(r2) ? 1 : r2;
335
+ if (r2 === 0) {
336
+ if (!isUndefined(e2)) {
337
+ _ = Error(b("Argument unexpected for: %s", n4));
338
+ }
339
+ setArg(n4, defaultValue(n4));
340
+ return s4;
341
+ }
342
+ let l2 = isUndefined(e2) ? 0 : 1;
343
+ if (f["nargs-eats-options"]) {
344
+ if (t3.length - (s4 + 1) + l2 < r2) {
345
+ _ = Error(b("Not enough arguments following: %s", n4));
346
+ }
347
+ l2 = r2;
348
+ } else {
349
+ for (c2 = s4 + 1; c2 < t3.length; c2++) {
350
+ if (!t3[c2].match(/^-[^0-9]/) || t3[c2].match(m) || isUnknownOptionAsArg(t3[c2]))
351
+ l2++;
352
+ else
353
+ break;
354
+ }
355
+ if (l2 < r2)
356
+ _ = Error(b("Not enough arguments following: %s", n4));
357
+ }
358
+ let o2 = Math.min(l2, r2);
359
+ if (!isUndefined(e2) && o2 > 0) {
360
+ setArg(n4, e2);
361
+ o2--;
362
+ }
363
+ for (c2 = s4 + 1; c2 < o2 + s4 + 1; c2++) {
364
+ setArg(n4, t3[c2]);
365
+ }
366
+ return s4 + o2;
367
+ }
368
+ function eatArray(s4, n4, t3, e2) {
369
+ let c2 = [];
370
+ let r2 = e2 || t3[s4 + 1];
371
+ const l2 = checkAllAliases(n4, O.nargs);
372
+ if (checkAllAliases(n4, O.bools) && !/^(true|false)$/.test(r2)) {
373
+ c2.push(true);
374
+ } else if (isUndefined(r2) || isUndefined(e2) && /^-/.test(r2) && !m.test(r2) && !isUnknownOptionAsArg(r2)) {
375
+ if (a[n4] !== void 0) {
376
+ const s5 = a[n4];
377
+ c2 = Array.isArray(s5) ? s5 : [s5];
378
+ }
379
+ } else {
380
+ if (!isUndefined(e2)) {
381
+ c2.push(processValue(n4, e2));
382
+ }
383
+ for (let e3 = s4 + 1; e3 < t3.length; e3++) {
384
+ if (!f["greedy-arrays"] && c2.length > 0 || l2 && c2.length >= l2)
385
+ break;
386
+ r2 = t3[e3];
387
+ if (/^-/.test(r2) && !m.test(r2) && !isUnknownOptionAsArg(r2))
388
+ break;
389
+ s4 = e3;
390
+ c2.push(processValue(n4, r2));
391
+ }
392
+ }
393
+ if (l2 && c2.length < l2 || isNaN(l2) && c2.length === 0) {
394
+ _ = Error(b("Not enough arguments following: %s", n4));
395
+ }
396
+ setArg(n4, c2);
397
+ return s4;
398
+ }
399
+ function setArg(s4, n4) {
400
+ if (/-/.test(s4) && f["camel-case-expansion"]) {
401
+ const n5 = s4.split(".").map(function(s5) {
402
+ return e(s5);
403
+ }).join(".");
404
+ addNewAlias(s4, n5);
405
+ }
406
+ const t3 = processValue(s4, n4);
407
+ const c2 = s4.split(".");
408
+ setKey(j, c2, t3);
409
+ if (O.aliases[s4]) {
410
+ O.aliases[s4].forEach(function(s5) {
411
+ s5 = s5.split(".");
412
+ setKey(j, s5, t3);
413
+ });
414
+ }
415
+ if (c2.length > 1 && f["dot-notation"]) {
416
+ (O.aliases[c2[0]] || []).forEach(function(n5) {
417
+ n5 = n5.split(".");
418
+ const e2 = [].concat(c2);
419
+ e2.shift();
420
+ n5 = n5.concat(e2);
421
+ if (!(O.aliases[s4] || []).includes(n5.join("."))) {
422
+ setKey(j, n5, t3);
423
+ }
424
+ });
425
+ }
426
+ if (checkAllAliases(s4, O.normalize) && !checkAllAliases(s4, O.arrays)) {
427
+ const t4 = [s4].concat(O.aliases[s4] || []);
428
+ t4.forEach(function(s5) {
429
+ Object.defineProperty(N, s5, {
430
+ enumerable: true,
431
+ get() {
432
+ return n4;
433
+ },
434
+ set(s6) {
435
+ n4 = typeof s6 === "string" ? r.normalize(s6) : s6;
436
+ }
437
+ });
438
+ });
439
+ }
440
+ }
441
+ function addNewAlias(s4, n4) {
442
+ if (!(O.aliases[s4] && O.aliases[s4].length)) {
443
+ O.aliases[s4] = [n4];
444
+ p[n4] = true;
445
+ }
446
+ if (!(O.aliases[n4] && O.aliases[n4].length)) {
447
+ addNewAlias(n4, s4);
448
+ }
449
+ }
450
+ function processValue(s4, n4) {
451
+ if (typeof n4 === "string" && (n4[0] === "'" || n4[0] === '"') && n4[n4.length - 1] === n4[0]) {
452
+ n4 = n4.substring(1, n4.length - 1);
453
+ }
454
+ if (checkAllAliases(s4, O.bools) || checkAllAliases(s4, O.counts)) {
455
+ if (typeof n4 === "string")
456
+ n4 = n4 === "true";
457
+ }
458
+ let t3 = Array.isArray(n4) ? n4.map(function(n5) {
459
+ return maybeCoerceNumber(s4, n5);
460
+ }) : maybeCoerceNumber(s4, n4);
461
+ if (checkAllAliases(s4, O.counts) && (isUndefined(t3) || typeof t3 === "boolean")) {
462
+ t3 = increment;
463
+ }
464
+ if (checkAllAliases(s4, O.normalize) && checkAllAliases(s4, O.arrays)) {
465
+ if (Array.isArray(n4))
466
+ t3 = n4.map(r.normalize);
467
+ else
468
+ t3 = r.normalize(n4);
469
+ }
470
+ return t3;
471
+ }
472
+ function maybeCoerceNumber(s4, n4) {
473
+ if (!checkAllAliases(s4, O.strings) && !checkAllAliases(s4, O.bools) && !Array.isArray(n4)) {
474
+ const t3 = isNumber(n4) && f["parse-numbers"] && Number.isSafeInteger(Math.floor(n4));
475
+ if (t3 || !isUndefined(n4) && checkAllAliases(s4, O.numbers))
476
+ n4 = Number(n4);
477
+ }
478
+ return n4;
479
+ }
480
+ function setConfig(s4) {
481
+ const n4 = /* @__PURE__ */ Object.create(null);
482
+ applyDefaultsAndAliases(n4, O.aliases, a);
483
+ Object.keys(O.configs).forEach(function(t3) {
484
+ const e2 = s4[t3] || n4[t3];
485
+ if (e2) {
486
+ try {
487
+ let n5 = null;
488
+ const c2 = r.resolve(process.cwd(), e2);
489
+ if (typeof O.configs[t3] === "function") {
490
+ try {
491
+ n5 = O.configs[t3](c2);
492
+ } catch (s5) {
493
+ n5 = s5;
494
+ }
495
+ if (n5 instanceof Error) {
496
+ _ = n5;
497
+ return;
498
+ }
499
+ } else {
500
+ n5 = require(c2);
501
+ }
502
+ setConfigObject(n5);
503
+ } catch (n5) {
504
+ if (s4[t3])
505
+ _ = Error(b("Invalid JSON config file: %s", e2));
506
+ }
507
+ }
508
+ });
509
+ }
510
+ function setConfigObject(s4, n4) {
511
+ Object.keys(s4).forEach(function(t3) {
512
+ const e2 = s4[t3];
513
+ const c2 = n4 ? n4 + "." + t3 : t3;
514
+ if (typeof e2 === "object" && e2 !== null && !Array.isArray(e2) && f["dot-notation"]) {
515
+ setConfigObject(e2, c2);
516
+ } else {
517
+ if (!hasKey(j, c2.split(".")) || checkAllAliases(c2, O.arrays) && f["combine-arrays"]) {
518
+ setArg(c2, e2);
519
+ }
520
+ }
521
+ });
522
+ }
523
+ function setConfigObjects() {
524
+ if (typeof i === "undefined")
525
+ return;
526
+ i.forEach(function(s4) {
527
+ setConfigObject(s4);
528
+ });
529
+ }
530
+ function applyEnvVars(s4, n4) {
531
+ if (typeof u === "undefined")
532
+ return;
533
+ const t3 = typeof u === "string" ? u : "";
534
+ Object.keys(process.env).forEach(function(c2) {
535
+ if (t3 === "" || c2.lastIndexOf(t3, 0) === 0) {
536
+ const r2 = c2.split("__").map(function(s5, n5) {
537
+ if (n5 === 0) {
538
+ s5 = s5.substring(t3.length);
539
+ }
540
+ return e(s5);
541
+ });
542
+ if ((n4 && O.configs[r2.join(".")] || !n4) && !hasKey(s4, r2)) {
543
+ setArg(r2.join("."), process.env[c2]);
544
+ }
545
+ }
546
+ });
547
+ }
548
+ function applyCoercions(s4) {
549
+ let n4;
550
+ const t3 = /* @__PURE__ */ new Set();
551
+ Object.keys(s4).forEach(function(e2) {
552
+ if (!t3.has(e2)) {
553
+ n4 = checkAllAliases(e2, O.coercions);
554
+ if (typeof n4 === "function") {
555
+ try {
556
+ const c2 = maybeCoerceNumber(e2, n4(s4[e2]));
557
+ [].concat(O.aliases[e2] || [], e2).forEach((n5) => {
558
+ t3.add(n5);
559
+ s4[n5] = c2;
560
+ });
561
+ } catch (s5) {
562
+ _ = s5;
563
+ }
564
+ }
565
+ }
566
+ });
567
+ }
568
+ function setPlaceholderKeys(s4) {
569
+ O.keys.forEach((n4) => {
570
+ if (~n4.indexOf("."))
571
+ return;
572
+ if (typeof s4[n4] === "undefined")
573
+ s4[n4] = void 0;
574
+ });
575
+ return s4;
576
+ }
577
+ function applyDefaultsAndAliases(s4, n4, t3, e2 = false) {
578
+ Object.keys(t3).forEach(function(c2) {
579
+ if (!hasKey(s4, c2.split("."))) {
580
+ setKey(s4, c2.split("."), t3[c2]);
581
+ if (e2)
582
+ d[c2] = true;
583
+ (n4[c2] || []).forEach(function(n5) {
584
+ if (hasKey(s4, n5.split(".")))
585
+ return;
586
+ setKey(s4, n5.split("."), t3[c2]);
587
+ });
588
+ }
589
+ });
590
+ }
591
+ function hasKey(s4, n4) {
592
+ let t3 = s4;
593
+ if (!f["dot-notation"])
594
+ n4 = [n4.join(".")];
595
+ n4.slice(0, -1).forEach(function(s5) {
596
+ t3 = t3[s5] || {};
597
+ });
598
+ const e2 = n4[n4.length - 1];
599
+ if (typeof t3 !== "object")
600
+ return false;
601
+ else
602
+ return e2 in t3;
603
+ }
604
+ function setKey(s4, n4, t3) {
605
+ let e2 = s4;
606
+ if (!f["dot-notation"])
607
+ n4 = [n4.join(".")];
608
+ n4.slice(0, -1).forEach(function(s5, n5) {
609
+ s5 = sanitizeKey(s5);
610
+ if (typeof e2 === "object" && e2[s5] === void 0) {
611
+ e2[s5] = {};
612
+ }
613
+ if (typeof e2[s5] !== "object" || Array.isArray(e2[s5])) {
614
+ if (Array.isArray(e2[s5])) {
615
+ e2[s5].push({});
616
+ } else {
617
+ e2[s5] = [e2[s5], {}];
618
+ }
619
+ e2 = e2[s5][e2[s5].length - 1];
620
+ } else {
621
+ e2 = e2[s5];
622
+ }
623
+ });
624
+ const c2 = sanitizeKey(n4[n4.length - 1]);
625
+ const r2 = checkAllAliases(n4.join("."), O.arrays);
626
+ const l2 = Array.isArray(t3);
627
+ let o2 = f["duplicate-arguments-array"];
628
+ if (!o2 && checkAllAliases(c2, O.nargs)) {
629
+ o2 = true;
630
+ if (!isUndefined(e2[c2]) && O.nargs[c2] === 1 || Array.isArray(e2[c2]) && e2[c2].length === O.nargs[c2]) {
631
+ e2[c2] = void 0;
632
+ }
633
+ }
634
+ if (t3 === increment) {
635
+ e2[c2] = increment(e2[c2]);
636
+ } else if (Array.isArray(e2[c2])) {
637
+ if (o2 && r2 && l2) {
638
+ e2[c2] = f["flatten-duplicate-arrays"] ? e2[c2].concat(t3) : (Array.isArray(e2[c2][0]) ? e2[c2] : [e2[c2]]).concat([t3]);
639
+ } else if (!o2 && Boolean(r2) === Boolean(l2)) {
640
+ e2[c2] = t3;
641
+ } else {
642
+ e2[c2] = e2[c2].concat([t3]);
643
+ }
644
+ } else if (e2[c2] === void 0 && r2) {
645
+ e2[c2] = l2 ? t3 : [t3];
646
+ } else if (o2 && !(e2[c2] === void 0 || checkAllAliases(c2, O.counts) || checkAllAliases(c2, O.bools))) {
647
+ e2[c2] = [e2[c2], t3];
648
+ } else {
649
+ e2[c2] = t3;
650
+ }
651
+ }
652
+ function extendAliases(...s4) {
653
+ s4.forEach(function(s5) {
654
+ Object.keys(s5 || {}).forEach(function(s6) {
655
+ if (O.aliases[s6])
656
+ return;
657
+ O.aliases[s6] = [].concat(t2[s6] || []);
658
+ O.aliases[s6].concat(s6).forEach(function(n4) {
659
+ if (/-/.test(n4) && f["camel-case-expansion"]) {
660
+ const t3 = e(n4);
661
+ if (t3 !== s6 && O.aliases[s6].indexOf(t3) === -1) {
662
+ O.aliases[s6].push(t3);
663
+ p[t3] = true;
664
+ }
665
+ }
666
+ });
667
+ O.aliases[s6].concat(s6).forEach(function(n4) {
668
+ if (n4.length > 1 && /[A-Z]/.test(n4) && f["camel-case-expansion"]) {
669
+ const t3 = c(n4, "-");
670
+ if (t3 !== s6 && O.aliases[s6].indexOf(t3) === -1) {
671
+ O.aliases[s6].push(t3);
672
+ p[t3] = true;
673
+ }
674
+ }
675
+ });
676
+ O.aliases[s6].forEach(function(n4) {
677
+ O.aliases[n4] = [s6].concat(
678
+ O.aliases[s6].filter(function(s7) {
679
+ return n4 !== s7;
680
+ })
681
+ );
682
+ });
683
+ });
684
+ });
685
+ }
686
+ function checkAllAliases(s4, n4) {
687
+ const t3 = [].concat(O.aliases[s4] || [], s4);
688
+ const e2 = Object.keys(n4);
689
+ const c2 = t3.find((s5) => e2.includes(s5));
690
+ return c2 ? n4[c2] : false;
691
+ }
692
+ function hasAnyFlag(s4) {
693
+ const n4 = [].concat(Object.keys(O).map((s5) => O[s5]));
694
+ return n4.some(function(n5) {
695
+ return Array.isArray(n5) ? n5.includes(s4) : n5[s4];
696
+ });
697
+ }
698
+ function hasFlagsMatching(s4, ...n4) {
699
+ const t3 = [].concat(...n4);
700
+ return t3.some(function(n5) {
701
+ const t4 = s4.match(n5);
702
+ return t4 && hasAnyFlag(t4[1]);
703
+ });
704
+ }
705
+ function hasAllShortFlags(s4) {
706
+ if (s4.match(m) || !s4.match(/^-[^-]+/)) {
707
+ return false;
708
+ }
709
+ let n4 = true;
710
+ let t3;
711
+ const e2 = s4.slice(1).split("");
712
+ for (let c2 = 0; c2 < e2.length; c2++) {
713
+ t3 = s4.slice(c2 + 2);
714
+ if (!hasAnyFlag(e2[c2])) {
715
+ n4 = false;
716
+ break;
717
+ }
718
+ if (e2[c2 + 1] && e2[c2 + 1] === "=" || t3 === "-" || /[A-Za-z]/.test(e2[c2]) && /^-?\d+(\.\d*)?(e-?\d+)?$/.test(t3) || e2[c2 + 1] && e2[c2 + 1].match(/\W/)) {
719
+ break;
720
+ }
721
+ }
722
+ return n4;
723
+ }
724
+ function isUnknownOptionAsArg(s4) {
725
+ return f["unknown-options-as-args"] && isUnknownOption(s4);
726
+ }
727
+ function isUnknownOption(s4) {
728
+ if (s4.match(m)) {
729
+ return false;
730
+ }
731
+ if (hasAllShortFlags(s4)) {
732
+ return false;
733
+ }
734
+ const n4 = /^-+([^=]+?)=[\s\S]*$/;
735
+ const t3 = /^-+([^=]+?)$/;
736
+ const e2 = /^-+([^=]+?)-$/;
737
+ const c2 = /^-+([^=]+?\d+)$/;
738
+ const r2 = /^-+([^=]+?)\W+.*$/;
739
+ return !hasFlagsMatching(s4, n4, E, t3, e2, c2, r2);
740
+ }
741
+ function defaultValue(s4) {
742
+ if (!checkAllAliases(s4, O.bools) && !checkAllAliases(s4, O.counts) && `${s4}` in a) {
743
+ return a[s4];
744
+ } else {
745
+ return defaultForType(guessType(s4));
746
+ }
747
+ }
748
+ function defaultForType(s4) {
749
+ const n4 = { boolean: true, string: "", number: void 0, array: [] };
750
+ return n4[s4];
751
+ }
752
+ function guessType(s4) {
753
+ let n4 = "boolean";
754
+ if (checkAllAliases(s4, O.strings))
755
+ n4 = "string";
756
+ else if (checkAllAliases(s4, O.numbers))
757
+ n4 = "number";
758
+ else if (checkAllAliases(s4, O.bools))
759
+ n4 = "boolean";
760
+ else if (checkAllAliases(s4, O.arrays))
761
+ n4 = "array";
762
+ return n4;
763
+ }
764
+ function isNumber(s4) {
765
+ if (s4 === null || s4 === void 0)
766
+ return false;
767
+ if (typeof s4 === "number")
768
+ return true;
769
+ if (/^0x[0-9a-f]+$/i.test(s4))
770
+ return true;
771
+ if (s4.length > 1 && s4[0] === "0")
772
+ return false;
773
+ return /^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(s4);
774
+ }
775
+ function isUndefined(s4) {
776
+ return s4 === void 0;
777
+ }
778
+ function checkConfiguration() {
779
+ Object.keys(O.counts).find((s4) => {
780
+ if (checkAllAliases(s4, O.arrays)) {
781
+ _ = Error(b("Invalid configuration: %s, opts.count excludes opts.array.", s4));
782
+ return true;
783
+ } else if (checkAllAliases(s4, O.nargs)) {
784
+ _ = Error(b("Invalid configuration: %s, opts.count excludes opts.narg.", s4));
785
+ return true;
786
+ }
787
+ });
788
+ }
789
+ return {
790
+ argv: Object.assign(N, j),
791
+ error: _,
792
+ aliases: Object.assign({}, O.aliases),
793
+ newAliases: Object.assign({}, p),
794
+ defaulted: Object.assign({}, d),
795
+ configuration: f
796
+ };
797
+ }
798
+ function combineAliases(s3) {
799
+ const n3 = [];
800
+ const t2 = /* @__PURE__ */ Object.create(null);
801
+ let e2 = true;
802
+ Object.keys(s3).forEach(function(t3) {
803
+ n3.push([].concat(s3[t3], t3));
804
+ });
805
+ while (e2) {
806
+ e2 = false;
807
+ for (let s4 = 0; s4 < n3.length; s4++) {
808
+ for (let t3 = s4 + 1; t3 < n3.length; t3++) {
809
+ const c2 = n3[s4].filter(function(s5) {
810
+ return n3[t3].indexOf(s5) !== -1;
811
+ });
812
+ if (c2.length) {
813
+ n3[s4] = n3[s4].concat(n3[t3]);
814
+ n3.splice(t3, 1);
815
+ e2 = true;
816
+ break;
817
+ }
818
+ }
819
+ }
820
+ }
821
+ n3.forEach(function(s4) {
822
+ s4 = s4.filter(function(s5, n4, t3) {
823
+ return t3.indexOf(s5) === n4;
824
+ });
825
+ t2[s4.pop()] = s4;
826
+ });
827
+ return t2;
828
+ }
829
+ function increment(s3) {
830
+ return s3 !== void 0 ? s3 + 1 : 1;
831
+ }
832
+ function Parser(s3, n3) {
833
+ const t2 = parse(s3.slice(), n3);
834
+ return t2.argv;
835
+ }
836
+ Parser.detailed = function(s3, n3) {
837
+ return parse(s3.slice(), n3);
838
+ };
839
+ function sanitizeKey(s3) {
840
+ if (s3 === "__proto__")
841
+ return "___proto___";
842
+ return s3;
843
+ }
844
+ s2.exports = Parser;
845
+ },
846
+ 433: (s2) => {
847
+ s2.exports = function(s3) {
848
+ if (Array.isArray(s3)) {
849
+ return s3.map((s4) => typeof s4 !== "string" ? s4 + "" : s4);
850
+ }
851
+ s3 = s3.trim();
852
+ let n2 = 0;
853
+ let t = null;
854
+ let e = null;
855
+ let c = null;
856
+ const r = [];
857
+ for (let l = 0; l < s3.length; l++) {
858
+ t = e;
859
+ e = s3.charAt(l);
860
+ if (e === " " && !c) {
861
+ if (!(t === " ")) {
862
+ n2++;
863
+ }
864
+ continue;
865
+ }
866
+ if (e === c) {
867
+ c = null;
868
+ } else if ((e === "'" || e === '"') && !c) {
869
+ c = e;
870
+ }
871
+ if (!r[n2])
872
+ r[n2] = "";
873
+ r[n2] += e;
874
+ }
875
+ return r;
876
+ };
877
+ },
878
+ 622: (s2) => {
879
+ "use strict";
880
+ s2.exports = require("path");
881
+ },
882
+ 669: (s2) => {
883
+ "use strict";
884
+ s2.exports = require("util");
885
+ }
886
+ };
887
+ var n = {};
888
+ function __nccwpck_require__(t) {
889
+ if (n[t]) {
890
+ return n[t].exports;
891
+ }
892
+ var e = n[t] = { exports: {} };
893
+ var c = true;
894
+ try {
895
+ s[t](e, e.exports, __nccwpck_require__);
896
+ c = false;
897
+ } finally {
898
+ if (c)
899
+ delete n[t];
900
+ }
901
+ return e.exports;
902
+ }
903
+ __nccwpck_require__.ab = __dirname + "/";
904
+ return __nccwpck_require__(246);
905
+ })();