create-expo 3.3.1 → 3.3.2
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/build/162.index.js +250 -0
- package/build/571.index.js +24202 -0
- package/build/733.index.js +1574 -0
- package/build/897.index.js +1380 -0
- package/build/gitignore +38 -0
- package/build/index.js +21 -49
- package/package.json +7 -7
|
@@ -0,0 +1,1380 @@
|
|
|
1
|
+
exports.id = 897;
|
|
2
|
+
exports.ids = [897];
|
|
3
|
+
exports.modules = {
|
|
4
|
+
|
|
5
|
+
/***/ 5134:
|
|
6
|
+
/***/ ((module) => {
|
|
7
|
+
|
|
8
|
+
"use strict";
|
|
9
|
+
/*!
|
|
10
|
+
* @description Recursive object extending
|
|
11
|
+
* @author Viacheslav Lotsmanov <lotsmanov89@gmail.com>
|
|
12
|
+
* @license MIT
|
|
13
|
+
*
|
|
14
|
+
* The MIT License (MIT)
|
|
15
|
+
*
|
|
16
|
+
* Copyright (c) 2013-2018 Viacheslav Lotsmanov
|
|
17
|
+
*
|
|
18
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
19
|
+
* this software and associated documentation files (the "Software"), to deal in
|
|
20
|
+
* the Software without restriction, including without limitation the rights to
|
|
21
|
+
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
22
|
+
* the Software, and to permit persons to whom the Software is furnished to do so,
|
|
23
|
+
* subject to the following conditions:
|
|
24
|
+
*
|
|
25
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
26
|
+
* copies or substantial portions of the Software.
|
|
27
|
+
*
|
|
28
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
29
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
30
|
+
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
31
|
+
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
32
|
+
* IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
33
|
+
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
function isSpecificValue(val) {
|
|
39
|
+
return (
|
|
40
|
+
val instanceof Buffer
|
|
41
|
+
|| val instanceof Date
|
|
42
|
+
|| val instanceof RegExp
|
|
43
|
+
) ? true : false;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function cloneSpecificValue(val) {
|
|
47
|
+
if (val instanceof Buffer) {
|
|
48
|
+
var x = Buffer.alloc
|
|
49
|
+
? Buffer.alloc(val.length)
|
|
50
|
+
: new Buffer(val.length);
|
|
51
|
+
val.copy(x);
|
|
52
|
+
return x;
|
|
53
|
+
} else if (val instanceof Date) {
|
|
54
|
+
return new Date(val.getTime());
|
|
55
|
+
} else if (val instanceof RegExp) {
|
|
56
|
+
return new RegExp(val);
|
|
57
|
+
} else {
|
|
58
|
+
throw new Error('Unexpected situation');
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Recursive cloning array.
|
|
64
|
+
*/
|
|
65
|
+
function deepCloneArray(arr) {
|
|
66
|
+
var clone = [];
|
|
67
|
+
arr.forEach(function (item, index) {
|
|
68
|
+
if (typeof item === 'object' && item !== null) {
|
|
69
|
+
if (Array.isArray(item)) {
|
|
70
|
+
clone[index] = deepCloneArray(item);
|
|
71
|
+
} else if (isSpecificValue(item)) {
|
|
72
|
+
clone[index] = cloneSpecificValue(item);
|
|
73
|
+
} else {
|
|
74
|
+
clone[index] = deepExtend({}, item);
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
clone[index] = item;
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
return clone;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function safeGetProperty(object, property) {
|
|
84
|
+
return property === '__proto__' ? undefined : object[property];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Extening object that entered in first argument.
|
|
89
|
+
*
|
|
90
|
+
* Returns extended object or false if have no target object or incorrect type.
|
|
91
|
+
*
|
|
92
|
+
* If you wish to clone source object (without modify it), just use empty new
|
|
93
|
+
* object as first argument, like this:
|
|
94
|
+
* deepExtend({}, yourObj_1, [yourObj_N]);
|
|
95
|
+
*/
|
|
96
|
+
var deepExtend = module.exports = function (/*obj_1, [obj_2], [obj_N]*/) {
|
|
97
|
+
if (arguments.length < 1 || typeof arguments[0] !== 'object') {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
if (arguments.length < 2) {
|
|
102
|
+
return arguments[0];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
var target = arguments[0];
|
|
106
|
+
|
|
107
|
+
// convert arguments to array and cut off target object
|
|
108
|
+
var args = Array.prototype.slice.call(arguments, 1);
|
|
109
|
+
|
|
110
|
+
var val, src, clone;
|
|
111
|
+
|
|
112
|
+
args.forEach(function (obj) {
|
|
113
|
+
// skip argument if isn't an object, is null, or is an array
|
|
114
|
+
if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
Object.keys(obj).forEach(function (key) {
|
|
119
|
+
src = safeGetProperty(target, key); // source value
|
|
120
|
+
val = safeGetProperty(obj, key); // new value
|
|
121
|
+
|
|
122
|
+
// recursion prevention
|
|
123
|
+
if (val === target) {
|
|
124
|
+
return;
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* if new value isn't object then just overwrite by new value
|
|
128
|
+
* instead of extending.
|
|
129
|
+
*/
|
|
130
|
+
} else if (typeof val !== 'object' || val === null) {
|
|
131
|
+
target[key] = val;
|
|
132
|
+
return;
|
|
133
|
+
|
|
134
|
+
// just clone arrays (and recursive clone objects inside)
|
|
135
|
+
} else if (Array.isArray(val)) {
|
|
136
|
+
target[key] = deepCloneArray(val);
|
|
137
|
+
return;
|
|
138
|
+
|
|
139
|
+
// custom cloning and overwrite for specific objects
|
|
140
|
+
} else if (isSpecificValue(val)) {
|
|
141
|
+
target[key] = cloneSpecificValue(val);
|
|
142
|
+
return;
|
|
143
|
+
|
|
144
|
+
// overwrite by new value if source isn't object or array
|
|
145
|
+
} else if (typeof src !== 'object' || src === null || Array.isArray(src)) {
|
|
146
|
+
target[key] = deepExtend({}, val);
|
|
147
|
+
return;
|
|
148
|
+
|
|
149
|
+
// source value and new value is objects both, extending...
|
|
150
|
+
} else {
|
|
151
|
+
target[key] = deepExtend(src, val);
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
return target;
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
/***/ }),
|
|
162
|
+
|
|
163
|
+
/***/ 1923:
|
|
164
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
165
|
+
|
|
166
|
+
exports.parse = exports.decode = decode
|
|
167
|
+
|
|
168
|
+
exports.stringify = exports.encode = encode
|
|
169
|
+
|
|
170
|
+
exports.safe = safe
|
|
171
|
+
exports.unsafe = unsafe
|
|
172
|
+
|
|
173
|
+
var eol = typeof process !== 'undefined' &&
|
|
174
|
+
process.platform === 'win32' ? '\r\n' : '\n'
|
|
175
|
+
|
|
176
|
+
function encode (obj, opt) {
|
|
177
|
+
var children = []
|
|
178
|
+
var out = ''
|
|
179
|
+
|
|
180
|
+
if (typeof opt === 'string') {
|
|
181
|
+
opt = {
|
|
182
|
+
section: opt,
|
|
183
|
+
whitespace: false,
|
|
184
|
+
}
|
|
185
|
+
} else {
|
|
186
|
+
opt = opt || {}
|
|
187
|
+
opt.whitespace = opt.whitespace === true
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
var separator = opt.whitespace ? ' = ' : '='
|
|
191
|
+
|
|
192
|
+
Object.keys(obj).forEach(function (k, _, __) {
|
|
193
|
+
var val = obj[k]
|
|
194
|
+
if (val && Array.isArray(val)) {
|
|
195
|
+
val.forEach(function (item) {
|
|
196
|
+
out += safe(k + '[]') + separator + safe(item) + '\n'
|
|
197
|
+
})
|
|
198
|
+
} else if (val && typeof val === 'object')
|
|
199
|
+
children.push(k)
|
|
200
|
+
else
|
|
201
|
+
out += safe(k) + separator + safe(val) + eol
|
|
202
|
+
})
|
|
203
|
+
|
|
204
|
+
if (opt.section && out.length)
|
|
205
|
+
out = '[' + safe(opt.section) + ']' + eol + out
|
|
206
|
+
|
|
207
|
+
children.forEach(function (k, _, __) {
|
|
208
|
+
var nk = dotSplit(k).join('\\.')
|
|
209
|
+
var section = (opt.section ? opt.section + '.' : '') + nk
|
|
210
|
+
var child = encode(obj[k], {
|
|
211
|
+
section: section,
|
|
212
|
+
whitespace: opt.whitespace,
|
|
213
|
+
})
|
|
214
|
+
if (out.length && child.length)
|
|
215
|
+
out += eol
|
|
216
|
+
|
|
217
|
+
out += child
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
return out
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function dotSplit (str) {
|
|
224
|
+
return str.replace(/\1/g, '\u0002LITERAL\\1LITERAL\u0002')
|
|
225
|
+
.replace(/\\\./g, '\u0001')
|
|
226
|
+
.split(/\./).map(function (part) {
|
|
227
|
+
return part.replace(/\1/g, '\\.')
|
|
228
|
+
.replace(/\2LITERAL\\1LITERAL\2/g, '\u0001')
|
|
229
|
+
})
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
function decode (str) {
|
|
233
|
+
var out = {}
|
|
234
|
+
var p = out
|
|
235
|
+
var section = null
|
|
236
|
+
// section |key = value
|
|
237
|
+
var re = /^\[([^\]]*)\]$|^([^=]+)(=(.*))?$/i
|
|
238
|
+
var lines = str.split(/[\r\n]+/g)
|
|
239
|
+
|
|
240
|
+
lines.forEach(function (line, _, __) {
|
|
241
|
+
if (!line || line.match(/^\s*[;#]/))
|
|
242
|
+
return
|
|
243
|
+
var match = line.match(re)
|
|
244
|
+
if (!match)
|
|
245
|
+
return
|
|
246
|
+
if (match[1] !== undefined) {
|
|
247
|
+
section = unsafe(match[1])
|
|
248
|
+
if (section === '__proto__') {
|
|
249
|
+
// not allowed
|
|
250
|
+
// keep parsing the section, but don't attach it.
|
|
251
|
+
p = {}
|
|
252
|
+
return
|
|
253
|
+
}
|
|
254
|
+
p = out[section] = out[section] || {}
|
|
255
|
+
return
|
|
256
|
+
}
|
|
257
|
+
var key = unsafe(match[2])
|
|
258
|
+
if (key === '__proto__')
|
|
259
|
+
return
|
|
260
|
+
var value = match[3] ? unsafe(match[4]) : true
|
|
261
|
+
switch (value) {
|
|
262
|
+
case 'true':
|
|
263
|
+
case 'false':
|
|
264
|
+
case 'null': value = JSON.parse(value)
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// Convert keys with '[]' suffix to an array
|
|
268
|
+
if (key.length > 2 && key.slice(-2) === '[]') {
|
|
269
|
+
key = key.substring(0, key.length - 2)
|
|
270
|
+
if (key === '__proto__')
|
|
271
|
+
return
|
|
272
|
+
if (!p[key])
|
|
273
|
+
p[key] = []
|
|
274
|
+
else if (!Array.isArray(p[key]))
|
|
275
|
+
p[key] = [p[key]]
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// safeguard against resetting a previously defined
|
|
279
|
+
// array by accidentally forgetting the brackets
|
|
280
|
+
if (Array.isArray(p[key]))
|
|
281
|
+
p[key].push(value)
|
|
282
|
+
else
|
|
283
|
+
p[key] = value
|
|
284
|
+
})
|
|
285
|
+
|
|
286
|
+
// {a:{y:1},"a.b":{x:2}} --> {a:{y:1,b:{x:2}}}
|
|
287
|
+
// use a filter to return the keys that have to be deleted.
|
|
288
|
+
Object.keys(out).filter(function (k, _, __) {
|
|
289
|
+
if (!out[k] ||
|
|
290
|
+
typeof out[k] !== 'object' ||
|
|
291
|
+
Array.isArray(out[k]))
|
|
292
|
+
return false
|
|
293
|
+
|
|
294
|
+
// see if the parent section is also an object.
|
|
295
|
+
// if so, add it to that, and mark this one for deletion
|
|
296
|
+
var parts = dotSplit(k)
|
|
297
|
+
var p = out
|
|
298
|
+
var l = parts.pop()
|
|
299
|
+
var nl = l.replace(/\\\./g, '.')
|
|
300
|
+
parts.forEach(function (part, _, __) {
|
|
301
|
+
if (part === '__proto__')
|
|
302
|
+
return
|
|
303
|
+
if (!p[part] || typeof p[part] !== 'object')
|
|
304
|
+
p[part] = {}
|
|
305
|
+
p = p[part]
|
|
306
|
+
})
|
|
307
|
+
if (p === out && nl === l)
|
|
308
|
+
return false
|
|
309
|
+
|
|
310
|
+
p[nl] = out[k]
|
|
311
|
+
return true
|
|
312
|
+
}).forEach(function (del, _, __) {
|
|
313
|
+
delete out[del]
|
|
314
|
+
})
|
|
315
|
+
|
|
316
|
+
return out
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
function isQuoted (val) {
|
|
320
|
+
return (val.charAt(0) === '"' && val.slice(-1) === '"') ||
|
|
321
|
+
(val.charAt(0) === "'" && val.slice(-1) === "'")
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
function safe (val) {
|
|
325
|
+
return (typeof val !== 'string' ||
|
|
326
|
+
val.match(/[=\r\n]/) ||
|
|
327
|
+
val.match(/^\[/) ||
|
|
328
|
+
(val.length > 1 &&
|
|
329
|
+
isQuoted(val)) ||
|
|
330
|
+
val !== val.trim())
|
|
331
|
+
? JSON.stringify(val)
|
|
332
|
+
: val.replace(/;/g, '\\;').replace(/#/g, '\\#')
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function unsafe (val, doUnesc) {
|
|
336
|
+
val = (val || '').trim()
|
|
337
|
+
if (isQuoted(val)) {
|
|
338
|
+
// remove the single quotes before calling JSON.parse
|
|
339
|
+
if (val.charAt(0) === "'")
|
|
340
|
+
val = val.substr(1, val.length - 2)
|
|
341
|
+
|
|
342
|
+
try {
|
|
343
|
+
val = JSON.parse(val)
|
|
344
|
+
} catch (_) {}
|
|
345
|
+
} else {
|
|
346
|
+
// walk the val to find the first not-escaped ; character
|
|
347
|
+
var esc = false
|
|
348
|
+
var unesc = ''
|
|
349
|
+
for (var i = 0, l = val.length; i < l; i++) {
|
|
350
|
+
var c = val.charAt(i)
|
|
351
|
+
if (esc) {
|
|
352
|
+
if ('\\;#'.indexOf(c) !== -1)
|
|
353
|
+
unesc += c
|
|
354
|
+
else
|
|
355
|
+
unesc += '\\' + c
|
|
356
|
+
|
|
357
|
+
esc = false
|
|
358
|
+
} else if (';#'.indexOf(c) !== -1)
|
|
359
|
+
break
|
|
360
|
+
else if (c === '\\')
|
|
361
|
+
esc = true
|
|
362
|
+
else
|
|
363
|
+
unesc += c
|
|
364
|
+
}
|
|
365
|
+
if (esc)
|
|
366
|
+
unesc += '\\'
|
|
367
|
+
|
|
368
|
+
return unesc.trim()
|
|
369
|
+
}
|
|
370
|
+
return val
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
/***/ }),
|
|
375
|
+
|
|
376
|
+
/***/ 5912:
|
|
377
|
+
/***/ ((module) => {
|
|
378
|
+
|
|
379
|
+
"use strict";
|
|
380
|
+
|
|
381
|
+
|
|
382
|
+
function hasKey(obj, keys) {
|
|
383
|
+
var o = obj;
|
|
384
|
+
keys.slice(0, -1).forEach(function (key) {
|
|
385
|
+
o = o[key] || {};
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
var key = keys[keys.length - 1];
|
|
389
|
+
return key in o;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
function isNumber(x) {
|
|
393
|
+
if (typeof x === 'number') { return true; }
|
|
394
|
+
if ((/^0x[0-9a-f]+$/i).test(x)) { return true; }
|
|
395
|
+
return (/^[-+]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/).test(x);
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
function isConstructorOrProto(obj, key) {
|
|
399
|
+
return (key === 'constructor' && typeof obj[key] === 'function') || key === '__proto__';
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
module.exports = function (args, opts) {
|
|
403
|
+
if (!opts) { opts = {}; }
|
|
404
|
+
|
|
405
|
+
var flags = {
|
|
406
|
+
bools: {},
|
|
407
|
+
strings: {},
|
|
408
|
+
unknownFn: null,
|
|
409
|
+
};
|
|
410
|
+
|
|
411
|
+
if (typeof opts.unknown === 'function') {
|
|
412
|
+
flags.unknownFn = opts.unknown;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
if (typeof opts.boolean === 'boolean' && opts.boolean) {
|
|
416
|
+
flags.allBools = true;
|
|
417
|
+
} else {
|
|
418
|
+
[].concat(opts.boolean).filter(Boolean).forEach(function (key) {
|
|
419
|
+
flags.bools[key] = true;
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
var aliases = {};
|
|
424
|
+
|
|
425
|
+
function aliasIsBoolean(key) {
|
|
426
|
+
return aliases[key].some(function (x) {
|
|
427
|
+
return flags.bools[x];
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
Object.keys(opts.alias || {}).forEach(function (key) {
|
|
432
|
+
aliases[key] = [].concat(opts.alias[key]);
|
|
433
|
+
aliases[key].forEach(function (x) {
|
|
434
|
+
aliases[x] = [key].concat(aliases[key].filter(function (y) {
|
|
435
|
+
return x !== y;
|
|
436
|
+
}));
|
|
437
|
+
});
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
[].concat(opts.string).filter(Boolean).forEach(function (key) {
|
|
441
|
+
flags.strings[key] = true;
|
|
442
|
+
if (aliases[key]) {
|
|
443
|
+
[].concat(aliases[key]).forEach(function (k) {
|
|
444
|
+
flags.strings[k] = true;
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
var defaults = opts.default || {};
|
|
450
|
+
|
|
451
|
+
var argv = { _: [] };
|
|
452
|
+
|
|
453
|
+
function argDefined(key, arg) {
|
|
454
|
+
return (flags.allBools && (/^--[^=]+$/).test(arg))
|
|
455
|
+
|| flags.strings[key]
|
|
456
|
+
|| flags.bools[key]
|
|
457
|
+
|| aliases[key];
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
function setKey(obj, keys, value) {
|
|
461
|
+
var o = obj;
|
|
462
|
+
for (var i = 0; i < keys.length - 1; i++) {
|
|
463
|
+
var key = keys[i];
|
|
464
|
+
if (isConstructorOrProto(o, key)) { return; }
|
|
465
|
+
if (o[key] === undefined) { o[key] = {}; }
|
|
466
|
+
if (
|
|
467
|
+
o[key] === Object.prototype
|
|
468
|
+
|| o[key] === Number.prototype
|
|
469
|
+
|| o[key] === String.prototype
|
|
470
|
+
) {
|
|
471
|
+
o[key] = {};
|
|
472
|
+
}
|
|
473
|
+
if (o[key] === Array.prototype) { o[key] = []; }
|
|
474
|
+
o = o[key];
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
var lastKey = keys[keys.length - 1];
|
|
478
|
+
if (isConstructorOrProto(o, lastKey)) { return; }
|
|
479
|
+
if (
|
|
480
|
+
o === Object.prototype
|
|
481
|
+
|| o === Number.prototype
|
|
482
|
+
|| o === String.prototype
|
|
483
|
+
) {
|
|
484
|
+
o = {};
|
|
485
|
+
}
|
|
486
|
+
if (o === Array.prototype) { o = []; }
|
|
487
|
+
if (o[lastKey] === undefined || flags.bools[lastKey] || typeof o[lastKey] === 'boolean') {
|
|
488
|
+
o[lastKey] = value;
|
|
489
|
+
} else if (Array.isArray(o[lastKey])) {
|
|
490
|
+
o[lastKey].push(value);
|
|
491
|
+
} else {
|
|
492
|
+
o[lastKey] = [o[lastKey], value];
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
function setArg(key, val, arg) {
|
|
497
|
+
if (arg && flags.unknownFn && !argDefined(key, arg)) {
|
|
498
|
+
if (flags.unknownFn(arg) === false) { return; }
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
var value = !flags.strings[key] && isNumber(val)
|
|
502
|
+
? Number(val)
|
|
503
|
+
: val;
|
|
504
|
+
setKey(argv, key.split('.'), value);
|
|
505
|
+
|
|
506
|
+
(aliases[key] || []).forEach(function (x) {
|
|
507
|
+
setKey(argv, x.split('.'), value);
|
|
508
|
+
});
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
Object.keys(flags.bools).forEach(function (key) {
|
|
512
|
+
setArg(key, defaults[key] === undefined ? false : defaults[key]);
|
|
513
|
+
});
|
|
514
|
+
|
|
515
|
+
var notFlags = [];
|
|
516
|
+
|
|
517
|
+
if (args.indexOf('--') !== -1) {
|
|
518
|
+
notFlags = args.slice(args.indexOf('--') + 1);
|
|
519
|
+
args = args.slice(0, args.indexOf('--'));
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
for (var i = 0; i < args.length; i++) {
|
|
523
|
+
var arg = args[i];
|
|
524
|
+
var key;
|
|
525
|
+
var next;
|
|
526
|
+
|
|
527
|
+
if ((/^--.+=/).test(arg)) {
|
|
528
|
+
// Using [\s\S] instead of . because js doesn't support the
|
|
529
|
+
// 'dotall' regex modifier. See:
|
|
530
|
+
// http://stackoverflow.com/a/1068308/13216
|
|
531
|
+
var m = arg.match(/^--([^=]+)=([\s\S]*)$/);
|
|
532
|
+
key = m[1];
|
|
533
|
+
var value = m[2];
|
|
534
|
+
if (flags.bools[key]) {
|
|
535
|
+
value = value !== 'false';
|
|
536
|
+
}
|
|
537
|
+
setArg(key, value, arg);
|
|
538
|
+
} else if ((/^--no-.+/).test(arg)) {
|
|
539
|
+
key = arg.match(/^--no-(.+)/)[1];
|
|
540
|
+
setArg(key, false, arg);
|
|
541
|
+
} else if ((/^--.+/).test(arg)) {
|
|
542
|
+
key = arg.match(/^--(.+)/)[1];
|
|
543
|
+
next = args[i + 1];
|
|
544
|
+
if (
|
|
545
|
+
next !== undefined
|
|
546
|
+
&& !(/^(-|--)[^-]/).test(next)
|
|
547
|
+
&& !flags.bools[key]
|
|
548
|
+
&& !flags.allBools
|
|
549
|
+
&& (aliases[key] ? !aliasIsBoolean(key) : true)
|
|
550
|
+
) {
|
|
551
|
+
setArg(key, next, arg);
|
|
552
|
+
i += 1;
|
|
553
|
+
} else if ((/^(true|false)$/).test(next)) {
|
|
554
|
+
setArg(key, next === 'true', arg);
|
|
555
|
+
i += 1;
|
|
556
|
+
} else {
|
|
557
|
+
setArg(key, flags.strings[key] ? '' : true, arg);
|
|
558
|
+
}
|
|
559
|
+
} else if ((/^-[^-]+/).test(arg)) {
|
|
560
|
+
var letters = arg.slice(1, -1).split('');
|
|
561
|
+
|
|
562
|
+
var broken = false;
|
|
563
|
+
for (var j = 0; j < letters.length; j++) {
|
|
564
|
+
next = arg.slice(j + 2);
|
|
565
|
+
|
|
566
|
+
if (next === '-') {
|
|
567
|
+
setArg(letters[j], next, arg);
|
|
568
|
+
continue;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
if ((/[A-Za-z]/).test(letters[j]) && next[0] === '=') {
|
|
572
|
+
setArg(letters[j], next.slice(1), arg);
|
|
573
|
+
broken = true;
|
|
574
|
+
break;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
if (
|
|
578
|
+
(/[A-Za-z]/).test(letters[j])
|
|
579
|
+
&& (/-?\d+(\.\d*)?(e-?\d+)?$/).test(next)
|
|
580
|
+
) {
|
|
581
|
+
setArg(letters[j], next, arg);
|
|
582
|
+
broken = true;
|
|
583
|
+
break;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
if (letters[j + 1] && letters[j + 1].match(/\W/)) {
|
|
587
|
+
setArg(letters[j], arg.slice(j + 2), arg);
|
|
588
|
+
broken = true;
|
|
589
|
+
break;
|
|
590
|
+
} else {
|
|
591
|
+
setArg(letters[j], flags.strings[letters[j]] ? '' : true, arg);
|
|
592
|
+
}
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
key = arg.slice(-1)[0];
|
|
596
|
+
if (!broken && key !== '-') {
|
|
597
|
+
if (
|
|
598
|
+
args[i + 1]
|
|
599
|
+
&& !(/^(-|--)[^-]/).test(args[i + 1])
|
|
600
|
+
&& !flags.bools[key]
|
|
601
|
+
&& (aliases[key] ? !aliasIsBoolean(key) : true)
|
|
602
|
+
) {
|
|
603
|
+
setArg(key, args[i + 1], arg);
|
|
604
|
+
i += 1;
|
|
605
|
+
} else if (args[i + 1] && (/^(true|false)$/).test(args[i + 1])) {
|
|
606
|
+
setArg(key, args[i + 1] === 'true', arg);
|
|
607
|
+
i += 1;
|
|
608
|
+
} else {
|
|
609
|
+
setArg(key, flags.strings[key] ? '' : true, arg);
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
} else {
|
|
613
|
+
if (!flags.unknownFn || flags.unknownFn(arg) !== false) {
|
|
614
|
+
argv._.push(flags.strings._ || !isNumber(arg) ? arg : Number(arg));
|
|
615
|
+
}
|
|
616
|
+
if (opts.stopEarly) {
|
|
617
|
+
argv._.push.apply(argv._, args.slice(i + 1));
|
|
618
|
+
break;
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
Object.keys(defaults).forEach(function (k) {
|
|
624
|
+
if (!hasKey(argv, k.split('.'))) {
|
|
625
|
+
setKey(argv, k.split('.'), defaults[k]);
|
|
626
|
+
|
|
627
|
+
(aliases[k] || []).forEach(function (x) {
|
|
628
|
+
setKey(argv, x.split('.'), defaults[k]);
|
|
629
|
+
});
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
|
|
633
|
+
if (opts['--']) {
|
|
634
|
+
argv['--'] = notFlags.slice();
|
|
635
|
+
} else {
|
|
636
|
+
notFlags.forEach(function (k) {
|
|
637
|
+
argv._.push(k);
|
|
638
|
+
});
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
return argv;
|
|
642
|
+
};
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
/***/ }),
|
|
646
|
+
|
|
647
|
+
/***/ 8271:
|
|
648
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
649
|
+
|
|
650
|
+
var cc = __webpack_require__(7563)
|
|
651
|
+
var join = (__webpack_require__(1017).join)
|
|
652
|
+
var deepExtend = __webpack_require__(5134)
|
|
653
|
+
var etc = '/etc'
|
|
654
|
+
var win = process.platform === "win32"
|
|
655
|
+
var home = win
|
|
656
|
+
? process.env.USERPROFILE
|
|
657
|
+
: process.env.HOME
|
|
658
|
+
|
|
659
|
+
module.exports = function (name, defaults, argv, parse) {
|
|
660
|
+
if('string' !== typeof name)
|
|
661
|
+
throw new Error('rc(name): name *must* be string')
|
|
662
|
+
if(!argv)
|
|
663
|
+
argv = __webpack_require__(5912)(process.argv.slice(2))
|
|
664
|
+
defaults = (
|
|
665
|
+
'string' === typeof defaults
|
|
666
|
+
? cc.json(defaults) : defaults
|
|
667
|
+
) || {}
|
|
668
|
+
|
|
669
|
+
parse = parse || cc.parse
|
|
670
|
+
|
|
671
|
+
var env = cc.env(name + '_')
|
|
672
|
+
|
|
673
|
+
var configs = [defaults]
|
|
674
|
+
var configFiles = []
|
|
675
|
+
function addConfigFile (file) {
|
|
676
|
+
if (configFiles.indexOf(file) >= 0) return
|
|
677
|
+
var fileConfig = cc.file(file)
|
|
678
|
+
if (fileConfig) {
|
|
679
|
+
configs.push(parse(fileConfig))
|
|
680
|
+
configFiles.push(file)
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
// which files do we look at?
|
|
685
|
+
if (!win)
|
|
686
|
+
[join(etc, name, 'config'),
|
|
687
|
+
join(etc, name + 'rc')].forEach(addConfigFile)
|
|
688
|
+
if (home)
|
|
689
|
+
[join(home, '.config', name, 'config'),
|
|
690
|
+
join(home, '.config', name),
|
|
691
|
+
join(home, '.' + name, 'config'),
|
|
692
|
+
join(home, '.' + name + 'rc')].forEach(addConfigFile)
|
|
693
|
+
addConfigFile(cc.find('.'+name+'rc'))
|
|
694
|
+
if (env.config) addConfigFile(env.config)
|
|
695
|
+
if (argv.config) addConfigFile(argv.config)
|
|
696
|
+
|
|
697
|
+
return deepExtend.apply(null, configs.concat([
|
|
698
|
+
env,
|
|
699
|
+
argv,
|
|
700
|
+
configFiles.length ? {configs: configFiles, config: configFiles[configFiles.length - 1]} : undefined,
|
|
701
|
+
]))
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
/***/ }),
|
|
706
|
+
|
|
707
|
+
/***/ 7563:
|
|
708
|
+
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
|
|
709
|
+
|
|
710
|
+
"use strict";
|
|
711
|
+
|
|
712
|
+
var fs = __webpack_require__(7147)
|
|
713
|
+
var ini = __webpack_require__(1923)
|
|
714
|
+
var path = __webpack_require__(1017)
|
|
715
|
+
var stripJsonComments = __webpack_require__(6397)
|
|
716
|
+
|
|
717
|
+
var parse = exports.parse = function (content) {
|
|
718
|
+
|
|
719
|
+
//if it ends in .json or starts with { then it must be json.
|
|
720
|
+
//must be done this way, because ini accepts everything.
|
|
721
|
+
//can't just try and parse it and let it throw if it's not ini.
|
|
722
|
+
//everything is ini. even json with a syntax error.
|
|
723
|
+
|
|
724
|
+
if(/^\s*{/.test(content))
|
|
725
|
+
return JSON.parse(stripJsonComments(content))
|
|
726
|
+
return ini.parse(content)
|
|
727
|
+
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
var file = exports.file = function () {
|
|
731
|
+
var args = [].slice.call(arguments).filter(function (arg) { return arg != null })
|
|
732
|
+
|
|
733
|
+
//path.join breaks if it's a not a string, so just skip this.
|
|
734
|
+
for(var i in args)
|
|
735
|
+
if('string' !== typeof args[i])
|
|
736
|
+
return
|
|
737
|
+
|
|
738
|
+
var file = path.join.apply(null, args)
|
|
739
|
+
var content
|
|
740
|
+
try {
|
|
741
|
+
return fs.readFileSync(file,'utf-8')
|
|
742
|
+
} catch (err) {
|
|
743
|
+
return
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
var json = exports.json = function () {
|
|
748
|
+
var content = file.apply(null, arguments)
|
|
749
|
+
return content ? parse(content) : null
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
var env = exports.env = function (prefix, env) {
|
|
753
|
+
env = env || process.env
|
|
754
|
+
var obj = {}
|
|
755
|
+
var l = prefix.length
|
|
756
|
+
for(var k in env) {
|
|
757
|
+
if(k.toLowerCase().indexOf(prefix.toLowerCase()) === 0) {
|
|
758
|
+
|
|
759
|
+
var keypath = k.substring(l).split('__')
|
|
760
|
+
|
|
761
|
+
// Trim empty strings from keypath array
|
|
762
|
+
var _emptyStringIndex
|
|
763
|
+
while ((_emptyStringIndex=keypath.indexOf('')) > -1) {
|
|
764
|
+
keypath.splice(_emptyStringIndex, 1)
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
var cursor = obj
|
|
768
|
+
keypath.forEach(function _buildSubObj(_subkey,i){
|
|
769
|
+
|
|
770
|
+
// (check for _subkey first so we ignore empty strings)
|
|
771
|
+
// (check for cursor to avoid assignment to primitive objects)
|
|
772
|
+
if (!_subkey || typeof cursor !== 'object')
|
|
773
|
+
return
|
|
774
|
+
|
|
775
|
+
// If this is the last key, just stuff the value in there
|
|
776
|
+
// Assigns actual value from env variable to final key
|
|
777
|
+
// (unless it's just an empty string- in that case use the last valid key)
|
|
778
|
+
if (i === keypath.length-1)
|
|
779
|
+
cursor[_subkey] = env[k]
|
|
780
|
+
|
|
781
|
+
|
|
782
|
+
// Build sub-object if nothing already exists at the keypath
|
|
783
|
+
if (cursor[_subkey] === undefined)
|
|
784
|
+
cursor[_subkey] = {}
|
|
785
|
+
|
|
786
|
+
// Increment cursor used to track the object at the current depth
|
|
787
|
+
cursor = cursor[_subkey]
|
|
788
|
+
|
|
789
|
+
})
|
|
790
|
+
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
return obj
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
var find = exports.find = function () {
|
|
799
|
+
var rel = path.join.apply(null, [].slice.call(arguments))
|
|
800
|
+
|
|
801
|
+
function find(start, rel) {
|
|
802
|
+
var file = path.join(start, rel)
|
|
803
|
+
try {
|
|
804
|
+
fs.statSync(file)
|
|
805
|
+
return file
|
|
806
|
+
} catch (err) {
|
|
807
|
+
if(path.dirname(start) !== start) // root
|
|
808
|
+
return find(path.dirname(start), rel)
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
return find(process.cwd(), rel)
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
|
|
817
|
+
/***/ }),
|
|
818
|
+
|
|
819
|
+
/***/ 6397:
|
|
820
|
+
/***/ ((module) => {
|
|
821
|
+
|
|
822
|
+
"use strict";
|
|
823
|
+
|
|
824
|
+
var singleComment = 1;
|
|
825
|
+
var multiComment = 2;
|
|
826
|
+
|
|
827
|
+
function stripWithoutWhitespace() {
|
|
828
|
+
return '';
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
function stripWithWhitespace(str, start, end) {
|
|
832
|
+
return str.slice(start, end).replace(/\S/g, ' ');
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
module.exports = function (str, opts) {
|
|
836
|
+
opts = opts || {};
|
|
837
|
+
|
|
838
|
+
var currentChar;
|
|
839
|
+
var nextChar;
|
|
840
|
+
var insideString = false;
|
|
841
|
+
var insideComment = false;
|
|
842
|
+
var offset = 0;
|
|
843
|
+
var ret = '';
|
|
844
|
+
var strip = opts.whitespace === false ? stripWithoutWhitespace : stripWithWhitespace;
|
|
845
|
+
|
|
846
|
+
for (var i = 0; i < str.length; i++) {
|
|
847
|
+
currentChar = str[i];
|
|
848
|
+
nextChar = str[i + 1];
|
|
849
|
+
|
|
850
|
+
if (!insideComment && currentChar === '"') {
|
|
851
|
+
var escaped = str[i - 1] === '\\' && str[i - 2] !== '\\';
|
|
852
|
+
if (!escaped) {
|
|
853
|
+
insideString = !insideString;
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
if (insideString) {
|
|
858
|
+
continue;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
if (!insideComment && currentChar + nextChar === '//') {
|
|
862
|
+
ret += str.slice(offset, i);
|
|
863
|
+
offset = i;
|
|
864
|
+
insideComment = singleComment;
|
|
865
|
+
i++;
|
|
866
|
+
} else if (insideComment === singleComment && currentChar + nextChar === '\r\n') {
|
|
867
|
+
i++;
|
|
868
|
+
insideComment = false;
|
|
869
|
+
ret += strip(str, offset, i);
|
|
870
|
+
offset = i;
|
|
871
|
+
continue;
|
|
872
|
+
} else if (insideComment === singleComment && currentChar === '\n') {
|
|
873
|
+
insideComment = false;
|
|
874
|
+
ret += strip(str, offset, i);
|
|
875
|
+
offset = i;
|
|
876
|
+
} else if (!insideComment && currentChar + nextChar === '/*') {
|
|
877
|
+
ret += str.slice(offset, i);
|
|
878
|
+
offset = i;
|
|
879
|
+
insideComment = multiComment;
|
|
880
|
+
i++;
|
|
881
|
+
continue;
|
|
882
|
+
} else if (insideComment === multiComment && currentChar + nextChar === '*/') {
|
|
883
|
+
i++;
|
|
884
|
+
insideComment = false;
|
|
885
|
+
ret += strip(str, offset, i + 1);
|
|
886
|
+
offset = i + 1;
|
|
887
|
+
continue;
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
|
|
891
|
+
return ret + (insideComment ? strip(str.substr(offset)) : str.substr(offset));
|
|
892
|
+
};
|
|
893
|
+
|
|
894
|
+
|
|
895
|
+
/***/ }),
|
|
896
|
+
|
|
897
|
+
/***/ 4955:
|
|
898
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
899
|
+
|
|
900
|
+
const safeBuffer = (__webpack_require__(3118).Buffer)
|
|
901
|
+
|
|
902
|
+
function decodeBase64 (base64) {
|
|
903
|
+
return safeBuffer.from(base64, 'base64').toString('utf8')
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
function encodeBase64 (string) {
|
|
907
|
+
return safeBuffer.from(string, 'utf8').toString('base64')
|
|
908
|
+
}
|
|
909
|
+
|
|
910
|
+
module.exports = {
|
|
911
|
+
decodeBase64: decodeBase64,
|
|
912
|
+
encodeBase64: encodeBase64
|
|
913
|
+
}
|
|
914
|
+
|
|
915
|
+
|
|
916
|
+
/***/ }),
|
|
917
|
+
|
|
918
|
+
/***/ 1384:
|
|
919
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
920
|
+
|
|
921
|
+
var url = __webpack_require__(7310)
|
|
922
|
+
var base64 = __webpack_require__(4955)
|
|
923
|
+
|
|
924
|
+
var decodeBase64 = base64.decodeBase64
|
|
925
|
+
var encodeBase64 = base64.encodeBase64
|
|
926
|
+
|
|
927
|
+
var tokenKey = ':_authToken'
|
|
928
|
+
var userKey = ':username'
|
|
929
|
+
var passwordKey = ':_password'
|
|
930
|
+
|
|
931
|
+
module.exports = function () {
|
|
932
|
+
var checkUrl
|
|
933
|
+
var options
|
|
934
|
+
if (arguments.length >= 2) {
|
|
935
|
+
checkUrl = arguments[0]
|
|
936
|
+
options = arguments[1]
|
|
937
|
+
} else if (typeof arguments[0] === 'string') {
|
|
938
|
+
checkUrl = arguments[0]
|
|
939
|
+
} else {
|
|
940
|
+
options = arguments[0]
|
|
941
|
+
}
|
|
942
|
+
options = options || {}
|
|
943
|
+
options.npmrc = options.npmrc || __webpack_require__(8271)('npm', {registry: 'https://registry.npmjs.org/'})
|
|
944
|
+
checkUrl = checkUrl || options.npmrc.registry
|
|
945
|
+
return getRegistryAuthInfo(checkUrl, options) || getLegacyAuthInfo(options.npmrc)
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
function getRegistryAuthInfo (checkUrl, options) {
|
|
949
|
+
var parsed = url.parse(checkUrl, false, true)
|
|
950
|
+
var pathname
|
|
951
|
+
|
|
952
|
+
while (pathname !== '/' && parsed.pathname !== pathname) {
|
|
953
|
+
pathname = parsed.pathname || '/'
|
|
954
|
+
|
|
955
|
+
var regUrl = '//' + parsed.host + pathname.replace(/\/$/, '')
|
|
956
|
+
var authInfo = getAuthInfoForUrl(regUrl, options.npmrc)
|
|
957
|
+
if (authInfo) {
|
|
958
|
+
return authInfo
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
// break if not recursive
|
|
962
|
+
if (!options.recursive) {
|
|
963
|
+
return /\/$/.test(checkUrl)
|
|
964
|
+
? undefined
|
|
965
|
+
: getRegistryAuthInfo(url.resolve(checkUrl, '.'), options)
|
|
966
|
+
}
|
|
967
|
+
|
|
968
|
+
parsed.pathname = url.resolve(normalizePath(pathname), '..') || '/'
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
return undefined
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
function getLegacyAuthInfo (npmrc) {
|
|
975
|
+
if (npmrc._auth) {
|
|
976
|
+
return {token: npmrc._auth, type: 'Basic'}
|
|
977
|
+
}
|
|
978
|
+
return undefined
|
|
979
|
+
}
|
|
980
|
+
|
|
981
|
+
function normalizePath (path) {
|
|
982
|
+
return path[path.length - 1] === '/' ? path : path + '/'
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
function getAuthInfoForUrl (regUrl, npmrc) {
|
|
986
|
+
// try to get bearer token
|
|
987
|
+
var bearerAuth = getBearerToken(npmrc[regUrl + tokenKey] || npmrc[regUrl + '/' + tokenKey])
|
|
988
|
+
if (bearerAuth) {
|
|
989
|
+
return bearerAuth
|
|
990
|
+
}
|
|
991
|
+
|
|
992
|
+
// try to get basic token
|
|
993
|
+
var username = npmrc[regUrl + userKey] || npmrc[regUrl + '/' + userKey]
|
|
994
|
+
var password = npmrc[regUrl + passwordKey] || npmrc[regUrl + '/' + passwordKey]
|
|
995
|
+
var basicAuth = getTokenForUsernameAndPassword(username, password)
|
|
996
|
+
if (basicAuth) {
|
|
997
|
+
return basicAuth
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
return undefined
|
|
1001
|
+
}
|
|
1002
|
+
|
|
1003
|
+
function getBearerToken (tok) {
|
|
1004
|
+
if (!tok) {
|
|
1005
|
+
return undefined
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
// check if bearer token
|
|
1009
|
+
var token = tok.replace(/^\$\{?([^}]*)\}?$/, function (fullMatch, envVar) {
|
|
1010
|
+
return process.env[envVar]
|
|
1011
|
+
})
|
|
1012
|
+
|
|
1013
|
+
return {token: token, type: 'Bearer'}
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
function getTokenForUsernameAndPassword (username, password) {
|
|
1017
|
+
if (!username || !password) {
|
|
1018
|
+
return undefined
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
// passwords are base64 encoded, so we need to decode it
|
|
1022
|
+
// See https://github.com/npm/npm/blob/v3.10.6/lib/config/set-credentials-by-uri.js#L26
|
|
1023
|
+
var pass = decodeBase64(password.replace(/^\$\{?([^}]*)\}?$/, function (fullMatch, envVar) {
|
|
1024
|
+
return process.env[envVar]
|
|
1025
|
+
}))
|
|
1026
|
+
|
|
1027
|
+
// a basic auth token is base64 encoded 'username:password'
|
|
1028
|
+
// See https://github.com/npm/npm/blob/v3.10.6/lib/config/get-credentials-by-uri.js#L70
|
|
1029
|
+
var token = encodeBase64(username + ':' + pass)
|
|
1030
|
+
|
|
1031
|
+
// we found a basicToken token so let's exit the loop
|
|
1032
|
+
return {
|
|
1033
|
+
token: token,
|
|
1034
|
+
type: 'Basic',
|
|
1035
|
+
password: pass,
|
|
1036
|
+
username: username
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
|
|
1040
|
+
|
|
1041
|
+
/***/ }),
|
|
1042
|
+
|
|
1043
|
+
/***/ 2447:
|
|
1044
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1045
|
+
|
|
1046
|
+
"use strict";
|
|
1047
|
+
|
|
1048
|
+
module.exports = function (scope) {
|
|
1049
|
+
var rc = __webpack_require__(8271)('npm', {registry: 'https://registry.npmjs.org/'});
|
|
1050
|
+
var url = rc[scope + ':registry'] || rc.registry;
|
|
1051
|
+
return url.slice(-1) === '/' ? url : url + '/';
|
|
1052
|
+
};
|
|
1053
|
+
|
|
1054
|
+
|
|
1055
|
+
/***/ }),
|
|
1056
|
+
|
|
1057
|
+
/***/ 3118:
|
|
1058
|
+
/***/ ((module, exports, __webpack_require__) => {
|
|
1059
|
+
|
|
1060
|
+
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
1061
|
+
/* eslint-disable node/no-deprecated-api */
|
|
1062
|
+
var buffer = __webpack_require__(4300)
|
|
1063
|
+
var Buffer = buffer.Buffer
|
|
1064
|
+
|
|
1065
|
+
// alternative to using Object.keys for old browsers
|
|
1066
|
+
function copyProps (src, dst) {
|
|
1067
|
+
for (var key in src) {
|
|
1068
|
+
dst[key] = src[key]
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
|
|
1072
|
+
module.exports = buffer
|
|
1073
|
+
} else {
|
|
1074
|
+
// Copy properties from require('buffer')
|
|
1075
|
+
copyProps(buffer, exports)
|
|
1076
|
+
exports.Buffer = SafeBuffer
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
function SafeBuffer (arg, encodingOrOffset, length) {
|
|
1080
|
+
return Buffer(arg, encodingOrOffset, length)
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
SafeBuffer.prototype = Object.create(Buffer.prototype)
|
|
1084
|
+
|
|
1085
|
+
// Copy static methods from Buffer
|
|
1086
|
+
copyProps(Buffer, SafeBuffer)
|
|
1087
|
+
|
|
1088
|
+
SafeBuffer.from = function (arg, encodingOrOffset, length) {
|
|
1089
|
+
if (typeof arg === 'number') {
|
|
1090
|
+
throw new TypeError('Argument must not be a number')
|
|
1091
|
+
}
|
|
1092
|
+
return Buffer(arg, encodingOrOffset, length)
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
SafeBuffer.alloc = function (size, fill, encoding) {
|
|
1096
|
+
if (typeof size !== 'number') {
|
|
1097
|
+
throw new TypeError('Argument must be a number')
|
|
1098
|
+
}
|
|
1099
|
+
var buf = Buffer(size)
|
|
1100
|
+
if (fill !== undefined) {
|
|
1101
|
+
if (typeof encoding === 'string') {
|
|
1102
|
+
buf.fill(fill, encoding)
|
|
1103
|
+
} else {
|
|
1104
|
+
buf.fill(fill)
|
|
1105
|
+
}
|
|
1106
|
+
} else {
|
|
1107
|
+
buf.fill(0)
|
|
1108
|
+
}
|
|
1109
|
+
return buf
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
SafeBuffer.allocUnsafe = function (size) {
|
|
1113
|
+
if (typeof size !== 'number') {
|
|
1114
|
+
throw new TypeError('Argument must be a number')
|
|
1115
|
+
}
|
|
1116
|
+
return Buffer(size)
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
SafeBuffer.allocUnsafeSlow = function (size) {
|
|
1120
|
+
if (typeof size !== 'number') {
|
|
1121
|
+
throw new TypeError('Argument must be a number')
|
|
1122
|
+
}
|
|
1123
|
+
return buffer.SlowBuffer(size)
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
|
|
1127
|
+
/***/ }),
|
|
1128
|
+
|
|
1129
|
+
/***/ 5418:
|
|
1130
|
+
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
|
|
1131
|
+
|
|
1132
|
+
// Native
|
|
1133
|
+
const {URL} = __webpack_require__(7310);
|
|
1134
|
+
const {join} = __webpack_require__(1017);
|
|
1135
|
+
const fs = __webpack_require__(7147);
|
|
1136
|
+
const {promisify} = __webpack_require__(3837);
|
|
1137
|
+
const {tmpdir} = __webpack_require__(2037);
|
|
1138
|
+
|
|
1139
|
+
// Packages
|
|
1140
|
+
const registryUrl = __webpack_require__(2447);
|
|
1141
|
+
|
|
1142
|
+
const writeFile = promisify(fs.writeFile);
|
|
1143
|
+
const mkdir = promisify(fs.mkdir);
|
|
1144
|
+
const readFile = promisify(fs.readFile);
|
|
1145
|
+
const compareVersions = (a, b) => a.localeCompare(b, 'en-US', {numeric: true});
|
|
1146
|
+
const encode = value => encodeURIComponent(value).replace(/^%40/, '@');
|
|
1147
|
+
|
|
1148
|
+
const getFile = async (details, distTag) => {
|
|
1149
|
+
const rootDir = tmpdir();
|
|
1150
|
+
const subDir = join(rootDir, 'update-check');
|
|
1151
|
+
|
|
1152
|
+
if (!fs.existsSync(subDir)) {
|
|
1153
|
+
await mkdir(subDir);
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
let name = `${details.name}-${distTag}.json`;
|
|
1157
|
+
|
|
1158
|
+
if (details.scope) {
|
|
1159
|
+
name = `${details.scope}-${name}`;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
return join(subDir, name);
|
|
1163
|
+
};
|
|
1164
|
+
|
|
1165
|
+
const evaluateCache = async (file, time, interval) => {
|
|
1166
|
+
if (fs.existsSync(file)) {
|
|
1167
|
+
const content = await readFile(file, 'utf8');
|
|
1168
|
+
const {lastUpdate, latest} = JSON.parse(content);
|
|
1169
|
+
const nextCheck = lastUpdate + interval;
|
|
1170
|
+
|
|
1171
|
+
// As long as the time of the next check is in
|
|
1172
|
+
// the future, we don't need to run it yet
|
|
1173
|
+
if (nextCheck > time) {
|
|
1174
|
+
return {
|
|
1175
|
+
shouldCheck: false,
|
|
1176
|
+
latest
|
|
1177
|
+
};
|
|
1178
|
+
}
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
return {
|
|
1182
|
+
shouldCheck: true,
|
|
1183
|
+
latest: null
|
|
1184
|
+
};
|
|
1185
|
+
};
|
|
1186
|
+
|
|
1187
|
+
const updateCache = async (file, latest, lastUpdate) => {
|
|
1188
|
+
const content = JSON.stringify({
|
|
1189
|
+
latest,
|
|
1190
|
+
lastUpdate
|
|
1191
|
+
});
|
|
1192
|
+
|
|
1193
|
+
await writeFile(file, content, 'utf8');
|
|
1194
|
+
};
|
|
1195
|
+
|
|
1196
|
+
const loadPackage = (url, authInfo) => new Promise((resolve, reject) => {
|
|
1197
|
+
const options = {
|
|
1198
|
+
host: url.hostname,
|
|
1199
|
+
path: url.pathname,
|
|
1200
|
+
port: url.port,
|
|
1201
|
+
headers: {
|
|
1202
|
+
accept: 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*'
|
|
1203
|
+
},
|
|
1204
|
+
timeout: 2000
|
|
1205
|
+
};
|
|
1206
|
+
|
|
1207
|
+
if (authInfo) {
|
|
1208
|
+
options.headers.authorization = `${authInfo.type} ${authInfo.token}`;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
const {get} = __webpack_require__(url.protocol === 'https:' ? 5687 : 3685);
|
|
1212
|
+
get(options, response => {
|
|
1213
|
+
const {statusCode} = response;
|
|
1214
|
+
|
|
1215
|
+
if (statusCode !== 200) {
|
|
1216
|
+
const error = new Error(`Request failed with code ${statusCode}`);
|
|
1217
|
+
error.code = statusCode;
|
|
1218
|
+
|
|
1219
|
+
reject(error);
|
|
1220
|
+
|
|
1221
|
+
// Consume response data to free up RAM
|
|
1222
|
+
response.resume();
|
|
1223
|
+
return;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
let rawData = '';
|
|
1227
|
+
response.setEncoding('utf8');
|
|
1228
|
+
|
|
1229
|
+
response.on('data', chunk => {
|
|
1230
|
+
rawData += chunk;
|
|
1231
|
+
});
|
|
1232
|
+
|
|
1233
|
+
response.on('end', () => {
|
|
1234
|
+
try {
|
|
1235
|
+
const parsedData = JSON.parse(rawData);
|
|
1236
|
+
resolve(parsedData);
|
|
1237
|
+
} catch (e) {
|
|
1238
|
+
reject(e);
|
|
1239
|
+
}
|
|
1240
|
+
});
|
|
1241
|
+
}).on('error', reject).on('timeout', reject);
|
|
1242
|
+
});
|
|
1243
|
+
|
|
1244
|
+
const getMostRecent = async ({full, scope}, distTag) => {
|
|
1245
|
+
const regURL = registryUrl(scope);
|
|
1246
|
+
const url = new URL(full, regURL);
|
|
1247
|
+
|
|
1248
|
+
let spec = null;
|
|
1249
|
+
|
|
1250
|
+
try {
|
|
1251
|
+
spec = await loadPackage(url);
|
|
1252
|
+
} catch (err) {
|
|
1253
|
+
// We need to cover:
|
|
1254
|
+
// 401 or 403 for when we don't have access
|
|
1255
|
+
// 404 when the package is hidden
|
|
1256
|
+
if (err.code && String(err.code).startsWith(4)) {
|
|
1257
|
+
// We only want to load this package for when we
|
|
1258
|
+
// really need to use the token
|
|
1259
|
+
const registryAuthToken = __webpack_require__(1384);
|
|
1260
|
+
const authInfo = registryAuthToken(regURL, {recursive: true});
|
|
1261
|
+
|
|
1262
|
+
spec = await loadPackage(url, authInfo);
|
|
1263
|
+
} else {
|
|
1264
|
+
throw err;
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
const version = spec['dist-tags'][distTag];
|
|
1269
|
+
|
|
1270
|
+
if (!version) {
|
|
1271
|
+
throw new Error(`Distribution tag ${distTag} is not available`);
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
return version;
|
|
1275
|
+
};
|
|
1276
|
+
|
|
1277
|
+
const defaultConfig = {
|
|
1278
|
+
interval: 3600000,
|
|
1279
|
+
distTag: 'latest'
|
|
1280
|
+
};
|
|
1281
|
+
|
|
1282
|
+
const getDetails = name => {
|
|
1283
|
+
const spec = {
|
|
1284
|
+
full: encode(name)
|
|
1285
|
+
};
|
|
1286
|
+
|
|
1287
|
+
if (name.includes('/')) {
|
|
1288
|
+
const parts = name.split('/');
|
|
1289
|
+
|
|
1290
|
+
spec.scope = parts[0];
|
|
1291
|
+
spec.name = parts[1];
|
|
1292
|
+
} else {
|
|
1293
|
+
spec.scope = null;
|
|
1294
|
+
spec.name = name;
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
return spec;
|
|
1298
|
+
};
|
|
1299
|
+
|
|
1300
|
+
module.exports = async (pkg, config) => {
|
|
1301
|
+
if (typeof pkg !== 'object') {
|
|
1302
|
+
throw new Error('The first parameter should be your package.json file content');
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
const details = getDetails(pkg.name);
|
|
1306
|
+
const time = Date.now();
|
|
1307
|
+
const {distTag, interval} = Object.assign({}, defaultConfig, config);
|
|
1308
|
+
const file = await getFile(details, distTag);
|
|
1309
|
+
|
|
1310
|
+
let latest = null;
|
|
1311
|
+
let shouldCheck = true;
|
|
1312
|
+
|
|
1313
|
+
({shouldCheck, latest} = await evaluateCache(file, time, interval));
|
|
1314
|
+
|
|
1315
|
+
if (shouldCheck) {
|
|
1316
|
+
latest = await getMostRecent(details, distTag);
|
|
1317
|
+
|
|
1318
|
+
// If we pulled an update, we need to update the cache
|
|
1319
|
+
await updateCache(file, latest, time);
|
|
1320
|
+
}
|
|
1321
|
+
|
|
1322
|
+
const comparision = compareVersions(pkg.version, latest);
|
|
1323
|
+
|
|
1324
|
+
if (comparision === -1) {
|
|
1325
|
+
return {
|
|
1326
|
+
latest,
|
|
1327
|
+
fromCache: !shouldCheck
|
|
1328
|
+
};
|
|
1329
|
+
}
|
|
1330
|
+
|
|
1331
|
+
return null;
|
|
1332
|
+
};
|
|
1333
|
+
|
|
1334
|
+
|
|
1335
|
+
/***/ }),
|
|
1336
|
+
|
|
1337
|
+
/***/ 5897:
|
|
1338
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
1339
|
+
|
|
1340
|
+
"use strict";
|
|
1341
|
+
__webpack_require__.r(__webpack_exports__);
|
|
1342
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1343
|
+
/* harmony export */ "default": () => (/* binding */ shouldUpdate)
|
|
1344
|
+
/* harmony export */ });
|
|
1345
|
+
/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(8746);
|
|
1346
|
+
/* harmony import */ var chalk__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(chalk__WEBPACK_IMPORTED_MODULE_0__);
|
|
1347
|
+
/* harmony import */ var update_check__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(5418);
|
|
1348
|
+
/* harmony import */ var update_check__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(update_check__WEBPACK_IMPORTED_MODULE_1__);
|
|
1349
|
+
|
|
1350
|
+
|
|
1351
|
+
const packageJson = __webpack_require__(9756);
|
|
1352
|
+
const debug = __webpack_require__(7984)('expo:init:update-check');
|
|
1353
|
+
async function shouldUpdate() {
|
|
1354
|
+
try {
|
|
1355
|
+
const res = await update_check__WEBPACK_IMPORTED_MODULE_1___default()(packageJson);
|
|
1356
|
+
if (res?.latest) {
|
|
1357
|
+
console.log();
|
|
1358
|
+
console.log(chalk__WEBPACK_IMPORTED_MODULE_0___default().yellow.bold(`A new version of \`${packageJson.name}\` is available`));
|
|
1359
|
+
console.log((chalk__WEBPACK_IMPORTED_MODULE_0___default()) `You can update by running: {cyan npm install -g ${packageJson.name}}`);
|
|
1360
|
+
console.log();
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
catch (error) {
|
|
1364
|
+
debug('Error checking for update:\n%O', error);
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
|
|
1369
|
+
/***/ }),
|
|
1370
|
+
|
|
1371
|
+
/***/ 9756:
|
|
1372
|
+
/***/ ((module) => {
|
|
1373
|
+
|
|
1374
|
+
module.exports = eval("require")("../package.json");
|
|
1375
|
+
|
|
1376
|
+
|
|
1377
|
+
/***/ })
|
|
1378
|
+
|
|
1379
|
+
};
|
|
1380
|
+
;
|