@teams-max/mwsp 1.0.2 → 2.0.1

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