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