1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | 'use strict';
|
9 |
|
10 | function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
11 |
|
12 | function _interopNamespace(e) {
|
13 | if (e && e.__esModule) { return e; } else {
|
14 | var n = {};
|
15 | if (e) {
|
16 | Object.keys(e).forEach(function (k) {
|
17 | var d = Object.getOwnPropertyDescriptor(e, k);
|
18 | Object.defineProperty(n, k, d.get ? d : {
|
19 | enumerable: true,
|
20 | get: function () {
|
21 | return e[k];
|
22 | }
|
23 | });
|
24 | });
|
25 | }
|
26 | n['default'] = e;
|
27 | return n;
|
28 | }
|
29 | }
|
30 |
|
31 | const path = _interopDefault(require('path'));
|
32 | const config = require('@nuxt/config');
|
33 | const exit = _interopDefault(require('exit'));
|
34 | const utils = require('@nuxt/utils');
|
35 | const chalk = _interopDefault(require('chalk'));
|
36 | const env = _interopDefault(require('std-env'));
|
37 | const wrapAnsi = _interopDefault(require('wrap-ansi'));
|
38 | const boxen = _interopDefault(require('boxen'));
|
39 | const consola = _interopDefault(require('consola'));
|
40 | const minimist = _interopDefault(require('minimist'));
|
41 | const Hookable = _interopDefault(require('hable'));
|
42 | const fs = _interopDefault(require('fs'));
|
43 | const execa = _interopDefault(require('execa'));
|
44 |
|
45 | const commands = {
|
46 | start: () => new Promise(function (resolve) { resolve(require('./cli-start.js')); }),
|
47 | dev: () => new Promise(function (resolve) { resolve(require('./cli-dev.js')); }),
|
48 | build: () => new Promise(function (resolve) { resolve(require('./cli-build.js')); }),
|
49 | generate: () => new Promise(function (resolve) { resolve(require('./cli-generate.js')); }),
|
50 | webpack: () => new Promise(function (resolve) { resolve(require('./cli-webpack.js')); }),
|
51 | help: () => new Promise(function (resolve) { resolve(require('./cli-help.js')); })
|
52 | };
|
53 |
|
54 | function getCommand (name) {
|
55 | if (!commands[name]) {
|
56 | return Promise.resolve(null)
|
57 | }
|
58 | return commands[name]().then(m => m.default)
|
59 | }
|
60 |
|
61 | const index = Object.freeze({
|
62 | __proto__: null,
|
63 | 'default': getCommand
|
64 | });
|
65 |
|
66 | const localNodeModules = path.resolve(process.cwd(), 'node_modules');
|
67 |
|
68 |
|
69 | async function _import (modulePath) {
|
70 | for (const mp of [
|
71 | path.resolve(localNodeModules, modulePath),
|
72 | modulePath
|
73 | ]) {
|
74 | try {
|
75 | return await new Promise(function (resolve) { resolve(_interopNamespace(require(mp))); })
|
76 | } catch (e) {
|
77 | if (e.code !== 'MODULE_NOT_FOUND') {
|
78 | throw e
|
79 | }
|
80 | }
|
81 | }
|
82 |
|
83 | const error = new Error(`Cannot import module '${modulePath}'`);
|
84 | error.code = 'MODULE_NOT_FOUND';
|
85 | throw error
|
86 | }
|
87 |
|
88 | const builder = () => _import('@nuxt/builder');
|
89 | const webpack = () => _import('@nuxt/webpack');
|
90 | const generator = () => _import('@nuxt/generator');
|
91 | const core = () => _import('@nuxt/core');
|
92 |
|
93 | const importModule = _import;
|
94 |
|
95 | const imports = Object.freeze({
|
96 | __proto__: null,
|
97 | builder: builder,
|
98 | webpack: webpack,
|
99 | generator: generator,
|
100 | core: core,
|
101 | importModule: importModule
|
102 | });
|
103 |
|
104 | const forceExitTimeout = 5;
|
105 |
|
106 | const startSpaces = 2;
|
107 | const optionSpaces = 2;
|
108 |
|
109 |
|
110 |
|
111 | const maxCharsPerLine = () => (process.stdout.columns || 100) * 80 / 100;
|
112 |
|
113 | function indent (count, chr = ' ') {
|
114 | return chr.repeat(count)
|
115 | }
|
116 |
|
117 | function indentLines (string, spaces, firstLineSpaces) {
|
118 | const lines = Array.isArray(string) ? string : string.split('\n');
|
119 | let s = '';
|
120 | if (lines.length) {
|
121 | const i0 = indent(firstLineSpaces === undefined ? spaces : firstLineSpaces);
|
122 | s = i0 + lines.shift();
|
123 | }
|
124 | if (lines.length) {
|
125 | const i = indent(spaces);
|
126 | s += '\n' + lines.map(l => i + l).join('\n');
|
127 | }
|
128 | return s
|
129 | }
|
130 |
|
131 | function foldLines (string, spaces, firstLineSpaces, charsPerLine = maxCharsPerLine()) {
|
132 | return indentLines(wrapAnsi(string, charsPerLine), spaces, firstLineSpaces)
|
133 | }
|
134 |
|
135 | function colorize (text) {
|
136 | return text
|
137 | .replace(/\[[^ ]+]/g, m => chalk.grey(m))
|
138 | .replace(/<[^ ]+>/g, m => chalk.green(m))
|
139 | .replace(/ (-[-\w,]+)/g, m => chalk.bold(m))
|
140 | .replace(/`([^`]+)`/g, (_, m) => chalk.bold.cyan(m))
|
141 | }
|
142 |
|
143 | function box (message, title, options) {
|
144 | return boxen([
|
145 | title || chalk.white('Nuxt Message'),
|
146 | '',
|
147 | chalk.white(foldLines(message, 0, 0, maxCharsPerLine()))
|
148 | ].join('\n'), Object.assign({
|
149 | borderColor: 'white',
|
150 | borderStyle: 'round',
|
151 | padding: 1,
|
152 | margin: 1
|
153 | }, options)) + '\n'
|
154 | }
|
155 |
|
156 | function successBox (message, title) {
|
157 | return box(message, title || chalk.green('✔ Nuxt Success'), {
|
158 | borderColor: 'green'
|
159 | })
|
160 | }
|
161 |
|
162 | function warningBox (message, title) {
|
163 | return box(message, title || chalk.yellow('⚠ Nuxt Warning'), {
|
164 | borderColor: 'yellow'
|
165 | })
|
166 | }
|
167 |
|
168 | function errorBox (message, title) {
|
169 | return box(message, title || chalk.red('✖ Nuxt Error'), {
|
170 | borderColor: 'red'
|
171 | })
|
172 | }
|
173 |
|
174 | function fatalBox (message, title) {
|
175 | return errorBox(message, title || chalk.red('✖ Nuxt Fatal Error'))
|
176 | }
|
177 |
|
178 | const eventsMapping = {
|
179 | add: { icon: '+', color: 'green', action: 'Created' },
|
180 | change: { icon: env.windows ? '»' : '↻', color: 'blue', action: 'Updated' },
|
181 | unlink: { icon: '-', color: 'red', action: 'Removed' }
|
182 | };
|
183 |
|
184 | function formatPath (filePath) {
|
185 | if (!filePath) {
|
186 | return
|
187 | }
|
188 | return filePath.replace(process.cwd() + path.sep, '')
|
189 | }
|
190 |
|
191 |
|
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 | function normalizeArg (arg, defaultValue) {
|
200 | switch (arg) {
|
201 | case 'true': arg = true; break
|
202 | case '': arg = true; break
|
203 | case 'false': arg = false; break
|
204 | case undefined: arg = defaultValue; break
|
205 | }
|
206 | return arg
|
207 | }
|
208 |
|
209 | function forceExit (cmdName, timeout) {
|
210 | if (timeout !== false) {
|
211 | const exitTimeout = setTimeout(() => {
|
212 | const msg = `The command 'nuxt ${cmdName}' finished but did not exit after ${timeout}s
|
213 | This is most likely not caused by a bug in Nuxt.js
|
214 | Make sure to cleanup all timers and listeners you or your plugins/modules start.
|
215 | Nuxt.js will now force exit
|
216 |
|
217 | ${chalk.bold('DeprecationWarning: Starting with Nuxt version 3 this will be a fatal error')}`;
|
218 |
|
219 |
|
220 | process.stderr.write(warningBox(msg));
|
221 | exit(0);
|
222 | }, timeout * 1000);
|
223 | exitTimeout.unref();
|
224 | } else {
|
225 | exit(0);
|
226 | }
|
227 | }
|
228 |
|
229 |
|
230 |
|
231 | function createLock (...args) {
|
232 | return utils.lock(...args)
|
233 | }
|
234 |
|
235 | const common = {
|
236 | spa: {
|
237 | alias: 's',
|
238 | type: 'boolean',
|
239 | description: 'Launch in SPA mode'
|
240 | },
|
241 | universal: {
|
242 | alias: 'u',
|
243 | type: 'boolean',
|
244 | description: 'Launch in Universal mode (default)'
|
245 | },
|
246 | 'config-file': {
|
247 | alias: 'c',
|
248 | type: 'string',
|
249 | default: config.defaultNuxtConfigFile,
|
250 | description: `Path to Nuxt.js config file (default: \`${config.defaultNuxtConfigFile}\`)`
|
251 | },
|
252 | modern: {
|
253 | alias: 'm',
|
254 | type: 'string',
|
255 | description: 'Build/Start app for modern browsers, e.g. server, client and false',
|
256 | prepare (cmd, options, argv) {
|
257 | if (argv.modern !== undefined) {
|
258 | options.modern = normalizeArg(argv.modern);
|
259 | }
|
260 | }
|
261 | },
|
262 | 'force-exit': {
|
263 | type: 'boolean',
|
264 | default (cmd) {
|
265 | return ['build', 'generate'].includes(cmd.name)
|
266 | },
|
267 | description: 'Whether Nuxt.js should force exit after the command has finished'
|
268 | },
|
269 | version: {
|
270 | alias: 'v',
|
271 | type: 'boolean',
|
272 | description: 'Display the Nuxt version'
|
273 | },
|
274 | help: {
|
275 | alias: 'h',
|
276 | type: 'boolean',
|
277 | description: 'Display this message'
|
278 | }
|
279 | };
|
280 |
|
281 | const server = {
|
282 | port: {
|
283 | alias: 'p',
|
284 | type: 'string',
|
285 | description: 'Port number on which to start the application',
|
286 | prepare (cmd, options, argv) {
|
287 | if (argv.port) {
|
288 | options.server.port = +argv.port;
|
289 | }
|
290 | }
|
291 | },
|
292 | hostname: {
|
293 | alias: 'H',
|
294 | type: 'string',
|
295 | description: 'Hostname on which to start the application',
|
296 | prepare (cmd, options, argv) {
|
297 | if (argv.hostname === '') {
|
298 | consola.fatal('Provided hostname argument has no value');
|
299 | }
|
300 | }
|
301 | },
|
302 | 'unix-socket': {
|
303 | alias: 'n',
|
304 | type: 'string',
|
305 | description: 'Path to a UNIX socket'
|
306 | }
|
307 | };
|
308 |
|
309 | const locking = {
|
310 | lock: {
|
311 | type: 'boolean',
|
312 | default: true,
|
313 | description: 'Do not set a lock on the project when building'
|
314 | }
|
315 | };
|
316 |
|
317 |
|
318 |
|
319 | const index$1 = Object.freeze({
|
320 | __proto__: null,
|
321 | common: common,
|
322 | server: server,
|
323 | locking: locking
|
324 | });
|
325 |
|
326 | var name = "@nuxt/cli";
|
327 | var version = "2.12.0";
|
328 |
|
329 |
|
330 |
|
331 |
|
332 |
|
333 |
|
334 |
|
335 |
|
336 |
|
337 |
|
338 |
|
339 | function apply(func, thisArg, args) {
|
340 | switch (args.length) {
|
341 | case 0: return func.call(thisArg);
|
342 | case 1: return func.call(thisArg, args[0]);
|
343 | case 2: return func.call(thisArg, args[0], args[1]);
|
344 | case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
345 | }
|
346 | return func.apply(thisArg, args);
|
347 | }
|
348 |
|
349 | var _apply = apply;
|
350 |
|
351 |
|
352 |
|
353 |
|
354 |
|
355 |
|
356 |
|
357 |
|
358 |
|
359 |
|
360 |
|
361 |
|
362 |
|
363 |
|
364 |
|
365 |
|
366 |
|
367 | function identity(value) {
|
368 | return value;
|
369 | }
|
370 |
|
371 | var identity_1 = identity;
|
372 |
|
373 |
|
374 | var nativeMax = Math.max;
|
375 |
|
376 |
|
377 |
|
378 |
|
379 |
|
380 |
|
381 |
|
382 |
|
383 |
|
384 |
|
385 | function overRest(func, start, transform) {
|
386 | start = nativeMax(start === undefined ? (func.length - 1) : start, 0);
|
387 | return function() {
|
388 | var args = arguments,
|
389 | index = -1,
|
390 | length = nativeMax(args.length - start, 0),
|
391 | array = Array(length);
|
392 |
|
393 | while (++index < length) {
|
394 | array[index] = args[start + index];
|
395 | }
|
396 | index = -1;
|
397 | var otherArgs = Array(start + 1);
|
398 | while (++index < start) {
|
399 | otherArgs[index] = args[index];
|
400 | }
|
401 | otherArgs[start] = transform(array);
|
402 | return _apply(func, this, otherArgs);
|
403 | };
|
404 | }
|
405 |
|
406 | var _overRest = overRest;
|
407 |
|
408 |
|
409 |
|
410 |
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 |
|
422 |
|
423 |
|
424 |
|
425 |
|
426 |
|
427 | function constant(value) {
|
428 | return function() {
|
429 | return value;
|
430 | };
|
431 | }
|
432 |
|
433 | var constant_1 = constant;
|
434 |
|
435 | var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
436 |
|
437 | function createCommonjsModule(fn, module) {
|
438 | return module = { exports: {} }, fn(module, module.exports), module.exports;
|
439 | }
|
440 |
|
441 |
|
442 | var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
|
443 |
|
444 | var _freeGlobal = freeGlobal;
|
445 |
|
446 |
|
447 | var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
|
448 |
|
449 |
|
450 | var root = _freeGlobal || freeSelf || Function('return this')();
|
451 |
|
452 | var _root = root;
|
453 |
|
454 |
|
455 | var Symbol = _root.Symbol;
|
456 |
|
457 | var _Symbol = Symbol;
|
458 |
|
459 |
|
460 | var objectProto = Object.prototype;
|
461 |
|
462 |
|
463 | var hasOwnProperty = objectProto.hasOwnProperty;
|
464 |
|
465 |
|
466 |
|
467 |
|
468 |
|
469 |
|
470 | var nativeObjectToString = objectProto.toString;
|
471 |
|
472 |
|
473 | var symToStringTag = _Symbol ? _Symbol.toStringTag : undefined;
|
474 |
|
475 |
|
476 |
|
477 |
|
478 |
|
479 |
|
480 |
|
481 |
|
482 | function getRawTag(value) {
|
483 | var isOwn = hasOwnProperty.call(value, symToStringTag),
|
484 | tag = value[symToStringTag];
|
485 |
|
486 | try {
|
487 | value[symToStringTag] = undefined;
|
488 | var unmasked = true;
|
489 | } catch (e) {}
|
490 |
|
491 | var result = nativeObjectToString.call(value);
|
492 | if (unmasked) {
|
493 | if (isOwn) {
|
494 | value[symToStringTag] = tag;
|
495 | } else {
|
496 | delete value[symToStringTag];
|
497 | }
|
498 | }
|
499 | return result;
|
500 | }
|
501 |
|
502 | var _getRawTag = getRawTag;
|
503 |
|
504 |
|
505 | var objectProto$1 = Object.prototype;
|
506 |
|
507 |
|
508 |
|
509 |
|
510 |
|
511 |
|
512 | var nativeObjectToString$1 = objectProto$1.toString;
|
513 |
|
514 |
|
515 |
|
516 |
|
517 |
|
518 |
|
519 |
|
520 |
|
521 | function objectToString(value) {
|
522 | return nativeObjectToString$1.call(value);
|
523 | }
|
524 |
|
525 | var _objectToString = objectToString;
|
526 |
|
527 |
|
528 | var nullTag = '[object Null]',
|
529 | undefinedTag = '[object Undefined]';
|
530 |
|
531 |
|
532 | var symToStringTag$1 = _Symbol ? _Symbol.toStringTag : undefined;
|
533 |
|
534 |
|
535 |
|
536 |
|
537 |
|
538 |
|
539 |
|
540 |
|
541 | function baseGetTag(value) {
|
542 | if (value == null) {
|
543 | return value === undefined ? undefinedTag : nullTag;
|
544 | }
|
545 | return (symToStringTag$1 && symToStringTag$1 in Object(value))
|
546 | ? _getRawTag(value)
|
547 | : _objectToString(value);
|
548 | }
|
549 |
|
550 | var _baseGetTag = baseGetTag;
|
551 |
|
552 |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 |
|
558 |
|
559 |
|
560 |
|
561 |
|
562 |
|
563 |
|
564 |
|
565 |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 |
|
571 |
|
572 |
|
573 |
|
574 |
|
575 |
|
576 |
|
577 | function isObject(value) {
|
578 | var type = typeof value;
|
579 | return value != null && (type == 'object' || type == 'function');
|
580 | }
|
581 |
|
582 | var isObject_1 = isObject;
|
583 |
|
584 |
|
585 | var asyncTag = '[object AsyncFunction]',
|
586 | funcTag = '[object Function]',
|
587 | genTag = '[object GeneratorFunction]',
|
588 | proxyTag = '[object Proxy]';
|
589 |
|
590 |
|
591 |
|
592 |
|
593 |
|
594 |
|
595 |
|
596 |
|
597 |
|
598 |
|
599 |
|
600 |
|
601 |
|
602 |
|
603 |
|
604 |
|
605 |
|
606 |
|
607 | function isFunction(value) {
|
608 | if (!isObject_1(value)) {
|
609 | return false;
|
610 | }
|
611 |
|
612 |
|
613 | var tag = _baseGetTag(value);
|
614 | return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
|
615 | }
|
616 |
|
617 | var isFunction_1 = isFunction;
|
618 |
|
619 |
|
620 | var coreJsData = _root['__core-js_shared__'];
|
621 |
|
622 | var _coreJsData = coreJsData;
|
623 |
|
624 |
|
625 | var maskSrcKey = (function() {
|
626 | var uid = /[^.]+$/.exec(_coreJsData && _coreJsData.keys && _coreJsData.keys.IE_PROTO || '');
|
627 | return uid ? ('Symbol(src)_1.' + uid) : '';
|
628 | }());
|
629 |
|
630 |
|
631 |
|
632 |
|
633 |
|
634 |
|
635 |
|
636 |
|
637 | function isMasked(func) {
|
638 | return !!maskSrcKey && (maskSrcKey in func);
|
639 | }
|
640 |
|
641 | var _isMasked = isMasked;
|
642 |
|
643 |
|
644 | var funcProto = Function.prototype;
|
645 |
|
646 |
|
647 | var funcToString = funcProto.toString;
|
648 |
|
649 |
|
650 |
|
651 |
|
652 |
|
653 |
|
654 |
|
655 |
|
656 | function toSource(func) {
|
657 | if (func != null) {
|
658 | try {
|
659 | return funcToString.call(func);
|
660 | } catch (e) {}
|
661 | try {
|
662 | return (func + '');
|
663 | } catch (e) {}
|
664 | }
|
665 | return '';
|
666 | }
|
667 |
|
668 | var _toSource = toSource;
|
669 |
|
670 |
|
671 |
|
672 |
|
673 |
|
674 | var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
675 |
|
676 |
|
677 | var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
678 |
|
679 |
|
680 | var funcProto$1 = Function.prototype,
|
681 | objectProto$2 = Object.prototype;
|
682 |
|
683 |
|
684 | var funcToString$1 = funcProto$1.toString;
|
685 |
|
686 |
|
687 | var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
|
688 |
|
689 |
|
690 | var reIsNative = RegExp('^' +
|
691 | funcToString$1.call(hasOwnProperty$1).replace(reRegExpChar, '\\$&')
|
692 | .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
693 | );
|
694 |
|
695 |
|
696 |
|
697 |
|
698 |
|
699 |
|
700 |
|
701 |
|
702 |
|
703 | function baseIsNative(value) {
|
704 | if (!isObject_1(value) || _isMasked(value)) {
|
705 | return false;
|
706 | }
|
707 | var pattern = isFunction_1(value) ? reIsNative : reIsHostCtor;
|
708 | return pattern.test(_toSource(value));
|
709 | }
|
710 |
|
711 | var _baseIsNative = baseIsNative;
|
712 |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 |
|
718 |
|
719 |
|
720 |
|
721 | function getValue(object, key) {
|
722 | return object == null ? undefined : object[key];
|
723 | }
|
724 |
|
725 | var _getValue = getValue;
|
726 |
|
727 |
|
728 |
|
729 |
|
730 |
|
731 |
|
732 |
|
733 |
|
734 |
|
735 | function getNative(object, key) {
|
736 | var value = _getValue(object, key);
|
737 | return _baseIsNative(value) ? value : undefined;
|
738 | }
|
739 |
|
740 | var _getNative = getNative;
|
741 |
|
742 | var defineProperty = (function() {
|
743 | try {
|
744 | var func = _getNative(Object, 'defineProperty');
|
745 | func({}, '', {});
|
746 | return func;
|
747 | } catch (e) {}
|
748 | }());
|
749 |
|
750 | var _defineProperty = defineProperty;
|
751 |
|
752 |
|
753 |
|
754 |
|
755 |
|
756 |
|
757 |
|
758 |
|
759 |
|
760 | var baseSetToString = !_defineProperty ? identity_1 : function(func, string) {
|
761 | return _defineProperty(func, 'toString', {
|
762 | 'configurable': true,
|
763 | 'enumerable': false,
|
764 | 'value': constant_1(string),
|
765 | 'writable': true
|
766 | });
|
767 | };
|
768 |
|
769 | var _baseSetToString = baseSetToString;
|
770 |
|
771 |
|
772 | var HOT_COUNT = 800,
|
773 | HOT_SPAN = 16;
|
774 |
|
775 |
|
776 | var nativeNow = Date.now;
|
777 |
|
778 |
|
779 |
|
780 |
|
781 |
|
782 |
|
783 |
|
784 |
|
785 |
|
786 |
|
787 | function shortOut(func) {
|
788 | var count = 0,
|
789 | lastCalled = 0;
|
790 |
|
791 | return function() {
|
792 | var stamp = nativeNow(),
|
793 | remaining = HOT_SPAN - (stamp - lastCalled);
|
794 |
|
795 | lastCalled = stamp;
|
796 | if (remaining > 0) {
|
797 | if (++count >= HOT_COUNT) {
|
798 | return arguments[0];
|
799 | }
|
800 | } else {
|
801 | count = 0;
|
802 | }
|
803 | return func.apply(undefined, arguments);
|
804 | };
|
805 | }
|
806 |
|
807 | var _shortOut = shortOut;
|
808 |
|
809 |
|
810 |
|
811 |
|
812 |
|
813 |
|
814 |
|
815 |
|
816 |
|
817 | var setToString = _shortOut(_baseSetToString);
|
818 |
|
819 | var _setToString = setToString;
|
820 |
|
821 |
|
822 |
|
823 |
|
824 |
|
825 |
|
826 |
|
827 |
|
828 |
|
829 | function baseRest(func, start) {
|
830 | return _setToString(_overRest(func, start, identity_1), func + '');
|
831 | }
|
832 |
|
833 | var _baseRest = baseRest;
|
834 |
|
835 |
|
836 |
|
837 |
|
838 |
|
839 |
|
840 |
|
841 |
|
842 | function listCacheClear() {
|
843 | this.__data__ = [];
|
844 | this.size = 0;
|
845 | }
|
846 |
|
847 | var _listCacheClear = listCacheClear;
|
848 |
|
849 |
|
850 |
|
851 |
|
852 |
|
853 |
|
854 |
|
855 |
|
856 |
|
857 |
|
858 |
|
859 |
|
860 |
|
861 |
|
862 |
|
863 |
|
864 |
|
865 |
|
866 |
|
867 |
|
868 |
|
869 |
|
870 |
|
871 |
|
872 |
|
873 |
|
874 |
|
875 |
|
876 |
|
877 |
|
878 |
|
879 |
|
880 |
|
881 | function eq(value, other) {
|
882 | return value === other || (value !== value && other !== other);
|
883 | }
|
884 |
|
885 | var eq_1 = eq;
|
886 |
|
887 |
|
888 |
|
889 |
|
890 |
|
891 |
|
892 |
|
893 |
|
894 |
|
895 | function assocIndexOf(array, key) {
|
896 | var length = array.length;
|
897 | while (length--) {
|
898 | if (eq_1(array[length][0], key)) {
|
899 | return length;
|
900 | }
|
901 | }
|
902 | return -1;
|
903 | }
|
904 |
|
905 | var _assocIndexOf = assocIndexOf;
|
906 |
|
907 |
|
908 | var arrayProto = Array.prototype;
|
909 |
|
910 |
|
911 | var splice = arrayProto.splice;
|
912 |
|
913 |
|
914 |
|
915 |
|
916 |
|
917 |
|
918 |
|
919 |
|
920 |
|
921 |
|
922 | function listCacheDelete(key) {
|
923 | var data = this.__data__,
|
924 | index = _assocIndexOf(data, key);
|
925 |
|
926 | if (index < 0) {
|
927 | return false;
|
928 | }
|
929 | var lastIndex = data.length - 1;
|
930 | if (index == lastIndex) {
|
931 | data.pop();
|
932 | } else {
|
933 | splice.call(data, index, 1);
|
934 | }
|
935 | --this.size;
|
936 | return true;
|
937 | }
|
938 |
|
939 | var _listCacheDelete = listCacheDelete;
|
940 |
|
941 |
|
942 |
|
943 |
|
944 |
|
945 |
|
946 |
|
947 |
|
948 |
|
949 |
|
950 | function listCacheGet(key) {
|
951 | var data = this.__data__,
|
952 | index = _assocIndexOf(data, key);
|
953 |
|
954 | return index < 0 ? undefined : data[index][1];
|
955 | }
|
956 |
|
957 | var _listCacheGet = listCacheGet;
|
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 |
|
964 |
|
965 |
|
966 |
|
967 |
|
968 | function listCacheHas(key) {
|
969 | return _assocIndexOf(this.__data__, key) > -1;
|
970 | }
|
971 |
|
972 | var _listCacheHas = listCacheHas;
|
973 |
|
974 |
|
975 |
|
976 |
|
977 |
|
978 |
|
979 |
|
980 |
|
981 |
|
982 |
|
983 |
|
984 | function listCacheSet(key, value) {
|
985 | var data = this.__data__,
|
986 | index = _assocIndexOf(data, key);
|
987 |
|
988 | if (index < 0) {
|
989 | ++this.size;
|
990 | data.push([key, value]);
|
991 | } else {
|
992 | data[index][1] = value;
|
993 | }
|
994 | return this;
|
995 | }
|
996 |
|
997 | var _listCacheSet = listCacheSet;
|
998 |
|
999 |
|
1000 |
|
1001 |
|
1002 |
|
1003 |
|
1004 |
|
1005 |
|
1006 | function ListCache(entries) {
|
1007 | var index = -1,
|
1008 | length = entries == null ? 0 : entries.length;
|
1009 |
|
1010 | this.clear();
|
1011 | while (++index < length) {
|
1012 | var entry = entries[index];
|
1013 | this.set(entry[0], entry[1]);
|
1014 | }
|
1015 | }
|
1016 |
|
1017 |
|
1018 | ListCache.prototype.clear = _listCacheClear;
|
1019 | ListCache.prototype['delete'] = _listCacheDelete;
|
1020 | ListCache.prototype.get = _listCacheGet;
|
1021 | ListCache.prototype.has = _listCacheHas;
|
1022 | ListCache.prototype.set = _listCacheSet;
|
1023 |
|
1024 | var _ListCache = ListCache;
|
1025 |
|
1026 |
|
1027 |
|
1028 |
|
1029 |
|
1030 |
|
1031 |
|
1032 |
|
1033 | function stackClear() {
|
1034 | this.__data__ = new _ListCache;
|
1035 | this.size = 0;
|
1036 | }
|
1037 |
|
1038 | var _stackClear = stackClear;
|
1039 |
|
1040 |
|
1041 |
|
1042 |
|
1043 |
|
1044 |
|
1045 |
|
1046 |
|
1047 |
|
1048 |
|
1049 | function stackDelete(key) {
|
1050 | var data = this.__data__,
|
1051 | result = data['delete'](key);
|
1052 |
|
1053 | this.size = data.size;
|
1054 | return result;
|
1055 | }
|
1056 |
|
1057 | var _stackDelete = stackDelete;
|
1058 |
|
1059 |
|
1060 |
|
1061 |
|
1062 |
|
1063 |
|
1064 |
|
1065 |
|
1066 |
|
1067 |
|
1068 | function stackGet(key) {
|
1069 | return this.__data__.get(key);
|
1070 | }
|
1071 |
|
1072 | var _stackGet = stackGet;
|
1073 |
|
1074 |
|
1075 |
|
1076 |
|
1077 |
|
1078 |
|
1079 |
|
1080 |
|
1081 |
|
1082 |
|
1083 | function stackHas(key) {
|
1084 | return this.__data__.has(key);
|
1085 | }
|
1086 |
|
1087 | var _stackHas = stackHas;
|
1088 |
|
1089 |
|
1090 | var Map = _getNative(_root, 'Map');
|
1091 |
|
1092 | var _Map = Map;
|
1093 |
|
1094 |
|
1095 | var nativeCreate = _getNative(Object, 'create');
|
1096 |
|
1097 | var _nativeCreate = nativeCreate;
|
1098 |
|
1099 |
|
1100 |
|
1101 |
|
1102 |
|
1103 |
|
1104 |
|
1105 |
|
1106 | function hashClear() {
|
1107 | this.__data__ = _nativeCreate ? _nativeCreate(null) : {};
|
1108 | this.size = 0;
|
1109 | }
|
1110 |
|
1111 | var _hashClear = hashClear;
|
1112 |
|
1113 |
|
1114 |
|
1115 |
|
1116 |
|
1117 |
|
1118 |
|
1119 |
|
1120 |
|
1121 |
|
1122 |
|
1123 | function hashDelete(key) {
|
1124 | var result = this.has(key) && delete this.__data__[key];
|
1125 | this.size -= result ? 1 : 0;
|
1126 | return result;
|
1127 | }
|
1128 |
|
1129 | var _hashDelete = hashDelete;
|
1130 |
|
1131 |
|
1132 | var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
1133 |
|
1134 |
|
1135 | var objectProto$3 = Object.prototype;
|
1136 |
|
1137 |
|
1138 | var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
|
1139 |
|
1140 |
|
1141 |
|
1142 |
|
1143 |
|
1144 |
|
1145 |
|
1146 |
|
1147 |
|
1148 |
|
1149 | function hashGet(key) {
|
1150 | var data = this.__data__;
|
1151 | if (_nativeCreate) {
|
1152 | var result = data[key];
|
1153 | return result === HASH_UNDEFINED ? undefined : result;
|
1154 | }
|
1155 | return hasOwnProperty$2.call(data, key) ? data[key] : undefined;
|
1156 | }
|
1157 |
|
1158 | var _hashGet = hashGet;
|
1159 |
|
1160 |
|
1161 | var objectProto$4 = Object.prototype;
|
1162 |
|
1163 |
|
1164 | var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
1165 |
|
1166 |
|
1167 |
|
1168 |
|
1169 |
|
1170 |
|
1171 |
|
1172 |
|
1173 |
|
1174 |
|
1175 | function hashHas(key) {
|
1176 | var data = this.__data__;
|
1177 | return _nativeCreate ? (data[key] !== undefined) : hasOwnProperty$3.call(data, key);
|
1178 | }
|
1179 |
|
1180 | var _hashHas = hashHas;
|
1181 |
|
1182 |
|
1183 | var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
1184 |
|
1185 |
|
1186 |
|
1187 |
|
1188 |
|
1189 |
|
1190 |
|
1191 |
|
1192 |
|
1193 |
|
1194 |
|
1195 | function hashSet(key, value) {
|
1196 | var data = this.__data__;
|
1197 | this.size += this.has(key) ? 0 : 1;
|
1198 | data[key] = (_nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
|
1199 | return this;
|
1200 | }
|
1201 |
|
1202 | var _hashSet = hashSet;
|
1203 |
|
1204 |
|
1205 |
|
1206 |
|
1207 |
|
1208 |
|
1209 |
|
1210 |
|
1211 | function Hash(entries) {
|
1212 | var index = -1,
|
1213 | length = entries == null ? 0 : entries.length;
|
1214 |
|
1215 | this.clear();
|
1216 | while (++index < length) {
|
1217 | var entry = entries[index];
|
1218 | this.set(entry[0], entry[1]);
|
1219 | }
|
1220 | }
|
1221 |
|
1222 |
|
1223 | Hash.prototype.clear = _hashClear;
|
1224 | Hash.prototype['delete'] = _hashDelete;
|
1225 | Hash.prototype.get = _hashGet;
|
1226 | Hash.prototype.has = _hashHas;
|
1227 | Hash.prototype.set = _hashSet;
|
1228 |
|
1229 | var _Hash = Hash;
|
1230 |
|
1231 |
|
1232 |
|
1233 |
|
1234 |
|
1235 |
|
1236 |
|
1237 |
|
1238 | function mapCacheClear() {
|
1239 | this.size = 0;
|
1240 | this.__data__ = {
|
1241 | 'hash': new _Hash,
|
1242 | 'map': new (_Map || _ListCache),
|
1243 | 'string': new _Hash
|
1244 | };
|
1245 | }
|
1246 |
|
1247 | var _mapCacheClear = mapCacheClear;
|
1248 |
|
1249 |
|
1250 |
|
1251 |
|
1252 |
|
1253 |
|
1254 |
|
1255 |
|
1256 | function isKeyable(value) {
|
1257 | var type = typeof value;
|
1258 | return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
1259 | ? (value !== '__proto__')
|
1260 | : (value === null);
|
1261 | }
|
1262 |
|
1263 | var _isKeyable = isKeyable;
|
1264 |
|
1265 |
|
1266 |
|
1267 |
|
1268 |
|
1269 |
|
1270 |
|
1271 |
|
1272 |
|
1273 | function getMapData(map, key) {
|
1274 | var data = map.__data__;
|
1275 | return _isKeyable(key)
|
1276 | ? data[typeof key == 'string' ? 'string' : 'hash']
|
1277 | : data.map;
|
1278 | }
|
1279 |
|
1280 | var _getMapData = getMapData;
|
1281 |
|
1282 |
|
1283 |
|
1284 |
|
1285 |
|
1286 |
|
1287 |
|
1288 |
|
1289 |
|
1290 |
|
1291 | function mapCacheDelete(key) {
|
1292 | var result = _getMapData(this, key)['delete'](key);
|
1293 | this.size -= result ? 1 : 0;
|
1294 | return result;
|
1295 | }
|
1296 |
|
1297 | var _mapCacheDelete = mapCacheDelete;
|
1298 |
|
1299 |
|
1300 |
|
1301 |
|
1302 |
|
1303 |
|
1304 |
|
1305 |
|
1306 |
|
1307 |
|
1308 | function mapCacheGet(key) {
|
1309 | return _getMapData(this, key).get(key);
|
1310 | }
|
1311 |
|
1312 | var _mapCacheGet = mapCacheGet;
|
1313 |
|
1314 |
|
1315 |
|
1316 |
|
1317 |
|
1318 |
|
1319 |
|
1320 |
|
1321 |
|
1322 |
|
1323 | function mapCacheHas(key) {
|
1324 | return _getMapData(this, key).has(key);
|
1325 | }
|
1326 |
|
1327 | var _mapCacheHas = mapCacheHas;
|
1328 |
|
1329 |
|
1330 |
|
1331 |
|
1332 |
|
1333 |
|
1334 |
|
1335 |
|
1336 |
|
1337 |
|
1338 |
|
1339 | function mapCacheSet(key, value) {
|
1340 | var data = _getMapData(this, key),
|
1341 | size = data.size;
|
1342 |
|
1343 | data.set(key, value);
|
1344 | this.size += data.size == size ? 0 : 1;
|
1345 | return this;
|
1346 | }
|
1347 |
|
1348 | var _mapCacheSet = mapCacheSet;
|
1349 |
|
1350 |
|
1351 |
|
1352 |
|
1353 |
|
1354 |
|
1355 |
|
1356 |
|
1357 | function MapCache(entries) {
|
1358 | var index = -1,
|
1359 | length = entries == null ? 0 : entries.length;
|
1360 |
|
1361 | this.clear();
|
1362 | while (++index < length) {
|
1363 | var entry = entries[index];
|
1364 | this.set(entry[0], entry[1]);
|
1365 | }
|
1366 | }
|
1367 |
|
1368 |
|
1369 | MapCache.prototype.clear = _mapCacheClear;
|
1370 | MapCache.prototype['delete'] = _mapCacheDelete;
|
1371 | MapCache.prototype.get = _mapCacheGet;
|
1372 | MapCache.prototype.has = _mapCacheHas;
|
1373 | MapCache.prototype.set = _mapCacheSet;
|
1374 |
|
1375 | var _MapCache = MapCache;
|
1376 |
|
1377 |
|
1378 | var LARGE_ARRAY_SIZE = 200;
|
1379 |
|
1380 |
|
1381 |
|
1382 |
|
1383 |
|
1384 |
|
1385 |
|
1386 |
|
1387 |
|
1388 |
|
1389 |
|
1390 | function stackSet(key, value) {
|
1391 | var data = this.__data__;
|
1392 | if (data instanceof _ListCache) {
|
1393 | var pairs = data.__data__;
|
1394 | if (!_Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
1395 | pairs.push([key, value]);
|
1396 | this.size = ++data.size;
|
1397 | return this;
|
1398 | }
|
1399 | data = this.__data__ = new _MapCache(pairs);
|
1400 | }
|
1401 | data.set(key, value);
|
1402 | this.size = data.size;
|
1403 | return this;
|
1404 | }
|
1405 |
|
1406 | var _stackSet = stackSet;
|
1407 |
|
1408 |
|
1409 |
|
1410 |
|
1411 |
|
1412 |
|
1413 |
|
1414 |
|
1415 | function Stack(entries) {
|
1416 | var data = this.__data__ = new _ListCache(entries);
|
1417 | this.size = data.size;
|
1418 | }
|
1419 |
|
1420 |
|
1421 | Stack.prototype.clear = _stackClear;
|
1422 | Stack.prototype['delete'] = _stackDelete;
|
1423 | Stack.prototype.get = _stackGet;
|
1424 | Stack.prototype.has = _stackHas;
|
1425 | Stack.prototype.set = _stackSet;
|
1426 |
|
1427 | var _Stack = Stack;
|
1428 |
|
1429 |
|
1430 |
|
1431 |
|
1432 |
|
1433 |
|
1434 |
|
1435 |
|
1436 |
|
1437 |
|
1438 | function baseAssignValue(object, key, value) {
|
1439 | if (key == '__proto__' && _defineProperty) {
|
1440 | _defineProperty(object, key, {
|
1441 | 'configurable': true,
|
1442 | 'enumerable': true,
|
1443 | 'value': value,
|
1444 | 'writable': true
|
1445 | });
|
1446 | } else {
|
1447 | object[key] = value;
|
1448 | }
|
1449 | }
|
1450 |
|
1451 | var _baseAssignValue = baseAssignValue;
|
1452 |
|
1453 |
|
1454 |
|
1455 |
|
1456 |
|
1457 |
|
1458 |
|
1459 |
|
1460 |
|
1461 |
|
1462 | function assignMergeValue(object, key, value) {
|
1463 | if ((value !== undefined && !eq_1(object[key], value)) ||
|
1464 | (value === undefined && !(key in object))) {
|
1465 | _baseAssignValue(object, key, value);
|
1466 | }
|
1467 | }
|
1468 |
|
1469 | var _assignMergeValue = assignMergeValue;
|
1470 |
|
1471 |
|
1472 |
|
1473 |
|
1474 |
|
1475 |
|
1476 |
|
1477 |
|
1478 | function createBaseFor(fromRight) {
|
1479 | return function(object, iteratee, keysFunc) {
|
1480 | var index = -1,
|
1481 | iterable = Object(object),
|
1482 | props = keysFunc(object),
|
1483 | length = props.length;
|
1484 |
|
1485 | while (length--) {
|
1486 | var key = props[fromRight ? length : ++index];
|
1487 | if (iteratee(iterable[key], key, iterable) === false) {
|
1488 | break;
|
1489 | }
|
1490 | }
|
1491 | return object;
|
1492 | };
|
1493 | }
|
1494 |
|
1495 | var _createBaseFor = createBaseFor;
|
1496 |
|
1497 |
|
1498 |
|
1499 |
|
1500 |
|
1501 |
|
1502 |
|
1503 |
|
1504 |
|
1505 |
|
1506 |
|
1507 |
|
1508 | var baseFor = _createBaseFor();
|
1509 |
|
1510 | var _baseFor = baseFor;
|
1511 |
|
1512 | var _cloneBuffer = createCommonjsModule(function (module, exports) {
|
1513 |
|
1514 | var freeExports = exports && !exports.nodeType && exports;
|
1515 |
|
1516 |
|
1517 | var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
1518 |
|
1519 |
|
1520 | var moduleExports = freeModule && freeModule.exports === freeExports;
|
1521 |
|
1522 |
|
1523 | var Buffer = moduleExports ? _root.Buffer : undefined,
|
1524 | allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined;
|
1525 |
|
1526 |
|
1527 |
|
1528 |
|
1529 |
|
1530 |
|
1531 |
|
1532 |
|
1533 |
|
1534 | function cloneBuffer(buffer, isDeep) {
|
1535 | if (isDeep) {
|
1536 | return buffer.slice();
|
1537 | }
|
1538 | var length = buffer.length,
|
1539 | result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length);
|
1540 |
|
1541 | buffer.copy(result);
|
1542 | return result;
|
1543 | }
|
1544 |
|
1545 | module.exports = cloneBuffer;
|
1546 | });
|
1547 |
|
1548 |
|
1549 | var Uint8Array = _root.Uint8Array;
|
1550 |
|
1551 | var _Uint8Array = Uint8Array;
|
1552 |
|
1553 |
|
1554 |
|
1555 |
|
1556 |
|
1557 |
|
1558 |
|
1559 |
|
1560 | function cloneArrayBuffer(arrayBuffer) {
|
1561 | var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
1562 | new _Uint8Array(result).set(new _Uint8Array(arrayBuffer));
|
1563 | return result;
|
1564 | }
|
1565 |
|
1566 | var _cloneArrayBuffer = cloneArrayBuffer;
|
1567 |
|
1568 |
|
1569 |
|
1570 |
|
1571 |
|
1572 |
|
1573 |
|
1574 |
|
1575 |
|
1576 | function cloneTypedArray(typedArray, isDeep) {
|
1577 | var buffer = isDeep ? _cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
1578 | return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
1579 | }
|
1580 |
|
1581 | var _cloneTypedArray = cloneTypedArray;
|
1582 |
|
1583 |
|
1584 |
|
1585 |
|
1586 |
|
1587 |
|
1588 |
|
1589 |
|
1590 |
|
1591 | function copyArray(source, array) {
|
1592 | var index = -1,
|
1593 | length = source.length;
|
1594 |
|
1595 | array || (array = Array(length));
|
1596 | while (++index < length) {
|
1597 | array[index] = source[index];
|
1598 | }
|
1599 | return array;
|
1600 | }
|
1601 |
|
1602 | var _copyArray = copyArray;
|
1603 |
|
1604 |
|
1605 | var objectCreate = Object.create;
|
1606 |
|
1607 |
|
1608 |
|
1609 |
|
1610 |
|
1611 |
|
1612 |
|
1613 |
|
1614 |
|
1615 | var baseCreate = (function() {
|
1616 | function object() {}
|
1617 | return function(proto) {
|
1618 | if (!isObject_1(proto)) {
|
1619 | return {};
|
1620 | }
|
1621 | if (objectCreate) {
|
1622 | return objectCreate(proto);
|
1623 | }
|
1624 | object.prototype = proto;
|
1625 | var result = new object;
|
1626 | object.prototype = undefined;
|
1627 | return result;
|
1628 | };
|
1629 | }());
|
1630 |
|
1631 | var _baseCreate = baseCreate;
|
1632 |
|
1633 |
|
1634 |
|
1635 |
|
1636 |
|
1637 |
|
1638 |
|
1639 |
|
1640 |
|
1641 | function overArg(func, transform) {
|
1642 | return function(arg) {
|
1643 | return func(transform(arg));
|
1644 | };
|
1645 | }
|
1646 |
|
1647 | var _overArg = overArg;
|
1648 |
|
1649 |
|
1650 | var getPrototype = _overArg(Object.getPrototypeOf, Object);
|
1651 |
|
1652 | var _getPrototype = getPrototype;
|
1653 |
|
1654 |
|
1655 | var objectProto$5 = Object.prototype;
|
1656 |
|
1657 |
|
1658 |
|
1659 |
|
1660 |
|
1661 |
|
1662 |
|
1663 |
|
1664 | function isPrototype(value) {
|
1665 | var Ctor = value && value.constructor,
|
1666 | proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$5;
|
1667 |
|
1668 | return value === proto;
|
1669 | }
|
1670 |
|
1671 | var _isPrototype = isPrototype;
|
1672 |
|
1673 |
|
1674 |
|
1675 |
|
1676 |
|
1677 |
|
1678 |
|
1679 |
|
1680 | function initCloneObject(object) {
|
1681 | return (typeof object.constructor == 'function' && !_isPrototype(object))
|
1682 | ? _baseCreate(_getPrototype(object))
|
1683 | : {};
|
1684 | }
|
1685 |
|
1686 | var _initCloneObject = initCloneObject;
|
1687 |
|
1688 |
|
1689 |
|
1690 |
|
1691 |
|
1692 |
|
1693 |
|
1694 |
|
1695 |
|
1696 |
|
1697 |
|
1698 |
|
1699 |
|
1700 |
|
1701 |
|
1702 |
|
1703 |
|
1704 |
|
1705 |
|
1706 |
|
1707 |
|
1708 |
|
1709 |
|
1710 |
|
1711 |
|
1712 | function isObjectLike(value) {
|
1713 | return value != null && typeof value == 'object';
|
1714 | }
|
1715 |
|
1716 | var isObjectLike_1 = isObjectLike;
|
1717 |
|
1718 |
|
1719 | var argsTag = '[object Arguments]';
|
1720 |
|
1721 |
|
1722 |
|
1723 |
|
1724 |
|
1725 |
|
1726 |
|
1727 |
|
1728 | function baseIsArguments(value) {
|
1729 | return isObjectLike_1(value) && _baseGetTag(value) == argsTag;
|
1730 | }
|
1731 |
|
1732 | var _baseIsArguments = baseIsArguments;
|
1733 |
|
1734 |
|
1735 | var objectProto$6 = Object.prototype;
|
1736 |
|
1737 |
|
1738 | var hasOwnProperty$4 = objectProto$6.hasOwnProperty;
|
1739 |
|
1740 |
|
1741 | var propertyIsEnumerable = objectProto$6.propertyIsEnumerable;
|
1742 |
|
1743 |
|
1744 |
|
1745 |
|
1746 |
|
1747 |
|
1748 |
|
1749 |
|
1750 |
|
1751 |
|
1752 |
|
1753 |
|
1754 |
|
1755 |
|
1756 |
|
1757 |
|
1758 |
|
1759 |
|
1760 |
|
1761 | var isArguments = _baseIsArguments(function() { return arguments; }()) ? _baseIsArguments : function(value) {
|
1762 | return isObjectLike_1(value) && hasOwnProperty$4.call(value, 'callee') &&
|
1763 | !propertyIsEnumerable.call(value, 'callee');
|
1764 | };
|
1765 |
|
1766 | var isArguments_1 = isArguments;
|
1767 |
|
1768 |
|
1769 |
|
1770 |
|
1771 |
|
1772 |
|
1773 |
|
1774 |
|
1775 |
|
1776 |
|
1777 |
|
1778 |
|
1779 |
|
1780 |
|
1781 |
|
1782 |
|
1783 |
|
1784 |
|
1785 |
|
1786 |
|
1787 |
|
1788 |
|
1789 |
|
1790 |
|
1791 | var isArray = Array.isArray;
|
1792 |
|
1793 | var isArray_1 = isArray;
|
1794 |
|
1795 |
|
1796 | var MAX_SAFE_INTEGER = 9007199254740991;
|
1797 |
|
1798 |
|
1799 |
|
1800 |
|
1801 |
|
1802 |
|
1803 |
|
1804 |
|
1805 |
|
1806 |
|
1807 |
|
1808 |
|
1809 |
|
1810 |
|
1811 |
|
1812 |
|
1813 |
|
1814 |
|
1815 |
|
1816 |
|
1817 |
|
1818 |
|
1819 |
|
1820 |
|
1821 |
|
1822 |
|
1823 |
|
1824 | function isLength(value) {
|
1825 | return typeof value == 'number' &&
|
1826 | value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
1827 | }
|
1828 |
|
1829 | var isLength_1 = isLength;
|
1830 |
|
1831 |
|
1832 |
|
1833 |
|
1834 |
|
1835 |
|
1836 |
|
1837 |
|
1838 |
|
1839 |
|
1840 |
|
1841 |
|
1842 |
|
1843 |
|
1844 |
|
1845 |
|
1846 |
|
1847 |
|
1848 |
|
1849 |
|
1850 |
|
1851 |
|
1852 |
|
1853 |
|
1854 |
|
1855 |
|
1856 | function isArrayLike(value) {
|
1857 | return value != null && isLength_1(value.length) && !isFunction_1(value);
|
1858 | }
|
1859 |
|
1860 | var isArrayLike_1 = isArrayLike;
|
1861 |
|
1862 |
|
1863 |
|
1864 |
|
1865 |
|
1866 |
|
1867 |
|
1868 |
|
1869 |
|
1870 |
|
1871 |
|
1872 |
|
1873 |
|
1874 |
|
1875 |
|
1876 |
|
1877 |
|
1878 |
|
1879 |
|
1880 |
|
1881 |
|
1882 |
|
1883 |
|
1884 |
|
1885 |
|
1886 |
|
1887 | function isArrayLikeObject(value) {
|
1888 | return isObjectLike_1(value) && isArrayLike_1(value);
|
1889 | }
|
1890 |
|
1891 | var isArrayLikeObject_1 = isArrayLikeObject;
|
1892 |
|
1893 |
|
1894 |
|
1895 |
|
1896 |
|
1897 |
|
1898 |
|
1899 |
|
1900 |
|
1901 |
|
1902 |
|
1903 |
|
1904 |
|
1905 |
|
1906 | function stubFalse() {
|
1907 | return false;
|
1908 | }
|
1909 |
|
1910 | var stubFalse_1 = stubFalse;
|
1911 |
|
1912 | var isBuffer_1 = createCommonjsModule(function (module, exports) {
|
1913 |
|
1914 | var freeExports = exports && !exports.nodeType && exports;
|
1915 |
|
1916 |
|
1917 | var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
1918 |
|
1919 |
|
1920 | var moduleExports = freeModule && freeModule.exports === freeExports;
|
1921 |
|
1922 |
|
1923 | var Buffer = moduleExports ? _root.Buffer : undefined;
|
1924 |
|
1925 |
|
1926 | var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
|
1927 |
|
1928 |
|
1929 |
|
1930 |
|
1931 |
|
1932 |
|
1933 |
|
1934 |
|
1935 |
|
1936 |
|
1937 |
|
1938 |
|
1939 |
|
1940 |
|
1941 |
|
1942 |
|
1943 |
|
1944 |
|
1945 | var isBuffer = nativeIsBuffer || stubFalse_1;
|
1946 |
|
1947 | module.exports = isBuffer;
|
1948 | });
|
1949 |
|
1950 |
|
1951 | var objectTag = '[object Object]';
|
1952 |
|
1953 |
|
1954 | var funcProto$2 = Function.prototype,
|
1955 | objectProto$7 = Object.prototype;
|
1956 |
|
1957 |
|
1958 | var funcToString$2 = funcProto$2.toString;
|
1959 |
|
1960 |
|
1961 | var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
|
1962 |
|
1963 |
|
1964 | var objectCtorString = funcToString$2.call(Object);
|
1965 |
|
1966 |
|
1967 |
|
1968 |
|
1969 |
|
1970 |
|
1971 |
|
1972 |
|
1973 |
|
1974 |
|
1975 |
|
1976 |
|
1977 |
|
1978 |
|
1979 |
|
1980 |
|
1981 |
|
1982 |
|
1983 |
|
1984 |
|
1985 |
|
1986 |
|
1987 |
|
1988 |
|
1989 |
|
1990 |
|
1991 |
|
1992 |
|
1993 |
|
1994 | function isPlainObject(value) {
|
1995 | if (!isObjectLike_1(value) || _baseGetTag(value) != objectTag) {
|
1996 | return false;
|
1997 | }
|
1998 | var proto = _getPrototype(value);
|
1999 | if (proto === null) {
|
2000 | return true;
|
2001 | }
|
2002 | var Ctor = hasOwnProperty$5.call(proto, 'constructor') && proto.constructor;
|
2003 | return typeof Ctor == 'function' && Ctor instanceof Ctor &&
|
2004 | funcToString$2.call(Ctor) == objectCtorString;
|
2005 | }
|
2006 |
|
2007 | var isPlainObject_1 = isPlainObject;
|
2008 |
|
2009 |
|
2010 | var argsTag$1 = '[object Arguments]',
|
2011 | arrayTag = '[object Array]',
|
2012 | boolTag = '[object Boolean]',
|
2013 | dateTag = '[object Date]',
|
2014 | errorTag = '[object Error]',
|
2015 | funcTag$1 = '[object Function]',
|
2016 | mapTag = '[object Map]',
|
2017 | numberTag = '[object Number]',
|
2018 | objectTag$1 = '[object Object]',
|
2019 | regexpTag = '[object RegExp]',
|
2020 | setTag = '[object Set]',
|
2021 | stringTag = '[object String]',
|
2022 | weakMapTag = '[object WeakMap]';
|
2023 |
|
2024 | var arrayBufferTag = '[object ArrayBuffer]',
|
2025 | dataViewTag = '[object DataView]',
|
2026 | float32Tag = '[object Float32Array]',
|
2027 | float64Tag = '[object Float64Array]',
|
2028 | int8Tag = '[object Int8Array]',
|
2029 | int16Tag = '[object Int16Array]',
|
2030 | int32Tag = '[object Int32Array]',
|
2031 | uint8Tag = '[object Uint8Array]',
|
2032 | uint8ClampedTag = '[object Uint8ClampedArray]',
|
2033 | uint16Tag = '[object Uint16Array]',
|
2034 | uint32Tag = '[object Uint32Array]';
|
2035 |
|
2036 |
|
2037 | var typedArrayTags = {};
|
2038 | typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
2039 | typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
2040 | typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
2041 | typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
2042 | typedArrayTags[uint32Tag] = true;
|
2043 | typedArrayTags[argsTag$1] = typedArrayTags[arrayTag] =
|
2044 | typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
2045 | typedArrayTags[dataViewTag] = typedArrayTags[dateTag] =
|
2046 | typedArrayTags[errorTag] = typedArrayTags[funcTag$1] =
|
2047 | typedArrayTags[mapTag] = typedArrayTags[numberTag] =
|
2048 | typedArrayTags[objectTag$1] = typedArrayTags[regexpTag] =
|
2049 | typedArrayTags[setTag] = typedArrayTags[stringTag] =
|
2050 | typedArrayTags[weakMapTag] = false;
|
2051 |
|
2052 |
|
2053 |
|
2054 |
|
2055 |
|
2056 |
|
2057 |
|
2058 |
|
2059 | function baseIsTypedArray(value) {
|
2060 | return isObjectLike_1(value) &&
|
2061 | isLength_1(value.length) && !!typedArrayTags[_baseGetTag(value)];
|
2062 | }
|
2063 |
|
2064 | var _baseIsTypedArray = baseIsTypedArray;
|
2065 |
|
2066 |
|
2067 |
|
2068 |
|
2069 |
|
2070 |
|
2071 |
|
2072 |
|
2073 | function baseUnary(func) {
|
2074 | return function(value) {
|
2075 | return func(value);
|
2076 | };
|
2077 | }
|
2078 |
|
2079 | var _baseUnary = baseUnary;
|
2080 |
|
2081 | var _nodeUtil = createCommonjsModule(function (module, exports) {
|
2082 |
|
2083 | var freeExports = exports && !exports.nodeType && exports;
|
2084 |
|
2085 |
|
2086 | var freeModule = freeExports && 'object' == 'object' && module && !module.nodeType && module;
|
2087 |
|
2088 |
|
2089 | var moduleExports = freeModule && freeModule.exports === freeExports;
|
2090 |
|
2091 |
|
2092 | var freeProcess = moduleExports && _freeGlobal.process;
|
2093 |
|
2094 |
|
2095 | var nodeUtil = (function() {
|
2096 | try {
|
2097 |
|
2098 | var types = freeModule && freeModule.require && freeModule.require('util').types;
|
2099 |
|
2100 | if (types) {
|
2101 | return types;
|
2102 | }
|
2103 |
|
2104 |
|
2105 | return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
2106 | } catch (e) {}
|
2107 | }());
|
2108 |
|
2109 | module.exports = nodeUtil;
|
2110 | });
|
2111 |
|
2112 |
|
2113 | var nodeIsTypedArray = _nodeUtil && _nodeUtil.isTypedArray;
|
2114 |
|
2115 |
|
2116 |
|
2117 |
|
2118 |
|
2119 |
|
2120 |
|
2121 |
|
2122 |
|
2123 |
|
2124 |
|
2125 |
|
2126 |
|
2127 |
|
2128 |
|
2129 |
|
2130 |
|
2131 |
|
2132 | var isTypedArray = nodeIsTypedArray ? _baseUnary(nodeIsTypedArray) : _baseIsTypedArray;
|
2133 |
|
2134 | var isTypedArray_1 = isTypedArray;
|
2135 |
|
2136 |
|
2137 |
|
2138 |
|
2139 |
|
2140 |
|
2141 |
|
2142 |
|
2143 |
|
2144 | function safeGet(object, key) {
|
2145 | if (key === 'constructor' && typeof object[key] === 'function') {
|
2146 | return;
|
2147 | }
|
2148 |
|
2149 | if (key == '__proto__') {
|
2150 | return;
|
2151 | }
|
2152 |
|
2153 | return object[key];
|
2154 | }
|
2155 |
|
2156 | var _safeGet = safeGet;
|
2157 |
|
2158 |
|
2159 | var objectProto$8 = Object.prototype;
|
2160 |
|
2161 |
|
2162 | var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
|
2163 |
|
2164 |
|
2165 |
|
2166 |
|
2167 |
|
2168 |
|
2169 |
|
2170 |
|
2171 |
|
2172 |
|
2173 |
|
2174 | function assignValue(object, key, value) {
|
2175 | var objValue = object[key];
|
2176 | if (!(hasOwnProperty$6.call(object, key) && eq_1(objValue, value)) ||
|
2177 | (value === undefined && !(key in object))) {
|
2178 | _baseAssignValue(object, key, value);
|
2179 | }
|
2180 | }
|
2181 |
|
2182 | var _assignValue = assignValue;
|
2183 |
|
2184 |
|
2185 |
|
2186 |
|
2187 |
|
2188 |
|
2189 |
|
2190 |
|
2191 |
|
2192 |
|
2193 |
|
2194 | function copyObject(source, props, object, customizer) {
|
2195 | var isNew = !object;
|
2196 | object || (object = {});
|
2197 |
|
2198 | var index = -1,
|
2199 | length = props.length;
|
2200 |
|
2201 | while (++index < length) {
|
2202 | var key = props[index];
|
2203 |
|
2204 | var newValue = customizer
|
2205 | ? customizer(object[key], source[key], key, object, source)
|
2206 | : undefined;
|
2207 |
|
2208 | if (newValue === undefined) {
|
2209 | newValue = source[key];
|
2210 | }
|
2211 | if (isNew) {
|
2212 | _baseAssignValue(object, key, newValue);
|
2213 | } else {
|
2214 | _assignValue(object, key, newValue);
|
2215 | }
|
2216 | }
|
2217 | return object;
|
2218 | }
|
2219 |
|
2220 | var _copyObject = copyObject;
|
2221 |
|
2222 |
|
2223 |
|
2224 |
|
2225 |
|
2226 |
|
2227 |
|
2228 |
|
2229 |
|
2230 |
|
2231 | function baseTimes(n, iteratee) {
|
2232 | var index = -1,
|
2233 | result = Array(n);
|
2234 |
|
2235 | while (++index < n) {
|
2236 | result[index] = iteratee(index);
|
2237 | }
|
2238 | return result;
|
2239 | }
|
2240 |
|
2241 | var _baseTimes = baseTimes;
|
2242 |
|
2243 |
|
2244 | var MAX_SAFE_INTEGER$1 = 9007199254740991;
|
2245 |
|
2246 |
|
2247 | var reIsUint = /^(?:0|[1-9]\d*)$/;
|
2248 |
|
2249 |
|
2250 |
|
2251 |
|
2252 |
|
2253 |
|
2254 |
|
2255 |
|
2256 |
|
2257 | function isIndex(value, length) {
|
2258 | var type = typeof value;
|
2259 | length = length == null ? MAX_SAFE_INTEGER$1 : length;
|
2260 |
|
2261 | return !!length &&
|
2262 | (type == 'number' ||
|
2263 | (type != 'symbol' && reIsUint.test(value))) &&
|
2264 | (value > -1 && value % 1 == 0 && value < length);
|
2265 | }
|
2266 |
|
2267 | var _isIndex = isIndex;
|
2268 |
|
2269 |
|
2270 | var objectProto$9 = Object.prototype;
|
2271 |
|
2272 |
|
2273 | var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
|
2274 |
|
2275 |
|
2276 |
|
2277 |
|
2278 |
|
2279 |
|
2280 |
|
2281 |
|
2282 |
|
2283 | function arrayLikeKeys(value, inherited) {
|
2284 | var isArr = isArray_1(value),
|
2285 | isArg = !isArr && isArguments_1(value),
|
2286 | isBuff = !isArr && !isArg && isBuffer_1(value),
|
2287 | isType = !isArr && !isArg && !isBuff && isTypedArray_1(value),
|
2288 | skipIndexes = isArr || isArg || isBuff || isType,
|
2289 | result = skipIndexes ? _baseTimes(value.length, String) : [],
|
2290 | length = result.length;
|
2291 |
|
2292 | for (var key in value) {
|
2293 | if ((inherited || hasOwnProperty$7.call(value, key)) &&
|
2294 | !(skipIndexes && (
|
2295 |
|
2296 | key == 'length' ||
|
2297 |
|
2298 | (isBuff && (key == 'offset' || key == 'parent')) ||
|
2299 |
|
2300 | (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
2301 |
|
2302 | _isIndex(key, length)
|
2303 | ))) {
|
2304 | result.push(key);
|
2305 | }
|
2306 | }
|
2307 | return result;
|
2308 | }
|
2309 |
|
2310 | var _arrayLikeKeys = arrayLikeKeys;
|
2311 |
|
2312 |
|
2313 |
|
2314 |
|
2315 |
|
2316 |
|
2317 |
|
2318 |
|
2319 |
|
2320 |
|
2321 | function nativeKeysIn(object) {
|
2322 | var result = [];
|
2323 | if (object != null) {
|
2324 | for (var key in Object(object)) {
|
2325 | result.push(key);
|
2326 | }
|
2327 | }
|
2328 | return result;
|
2329 | }
|
2330 |
|
2331 | var _nativeKeysIn = nativeKeysIn;
|
2332 |
|
2333 |
|
2334 | var objectProto$a = Object.prototype;
|
2335 |
|
2336 |
|
2337 | var hasOwnProperty$8 = objectProto$a.hasOwnProperty;
|
2338 |
|
2339 |
|
2340 |
|
2341 |
|
2342 |
|
2343 |
|
2344 |
|
2345 |
|
2346 | function baseKeysIn(object) {
|
2347 | if (!isObject_1(object)) {
|
2348 | return _nativeKeysIn(object);
|
2349 | }
|
2350 | var isProto = _isPrototype(object),
|
2351 | result = [];
|
2352 |
|
2353 | for (var key in object) {
|
2354 | if (!(key == 'constructor' && (isProto || !hasOwnProperty$8.call(object, key)))) {
|
2355 | result.push(key);
|
2356 | }
|
2357 | }
|
2358 | return result;
|
2359 | }
|
2360 |
|
2361 | var _baseKeysIn = baseKeysIn;
|
2362 |
|
2363 |
|
2364 |
|
2365 |
|
2366 |
|
2367 |
|
2368 |
|
2369 |
|
2370 |
|
2371 |
|
2372 |
|
2373 |
|
2374 |
|
2375 |
|
2376 |
|
2377 |
|
2378 |
|
2379 |
|
2380 |
|
2381 |
|
2382 |
|
2383 |
|
2384 |
|
2385 |
|
2386 | function keysIn(object) {
|
2387 | return isArrayLike_1(object) ? _arrayLikeKeys(object, true) : _baseKeysIn(object);
|
2388 | }
|
2389 |
|
2390 | var keysIn_1 = keysIn;
|
2391 |
|
2392 |
|
2393 |
|
2394 |
|
2395 |
|
2396 |
|
2397 |
|
2398 |
|
2399 |
|
2400 |
|
2401 |
|
2402 |
|
2403 |
|
2404 |
|
2405 |
|
2406 |
|
2407 |
|
2408 |
|
2409 |
|
2410 |
|
2411 |
|
2412 |
|
2413 |
|
2414 |
|
2415 |
|
2416 | function toPlainObject(value) {
|
2417 | return _copyObject(value, keysIn_1(value));
|
2418 | }
|
2419 |
|
2420 | var toPlainObject_1 = toPlainObject;
|
2421 |
|
2422 |
|
2423 |
|
2424 |
|
2425 |
|
2426 |
|
2427 |
|
2428 |
|
2429 |
|
2430 |
|
2431 |
|
2432 |
|
2433 |
|
2434 |
|
2435 |
|
2436 |
|
2437 | function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) {
|
2438 | var objValue = _safeGet(object, key),
|
2439 | srcValue = _safeGet(source, key),
|
2440 | stacked = stack.get(srcValue);
|
2441 |
|
2442 | if (stacked) {
|
2443 | _assignMergeValue(object, key, stacked);
|
2444 | return;
|
2445 | }
|
2446 | var newValue = customizer
|
2447 | ? customizer(objValue, srcValue, (key + ''), object, source, stack)
|
2448 | : undefined;
|
2449 |
|
2450 | var isCommon = newValue === undefined;
|
2451 |
|
2452 | if (isCommon) {
|
2453 | var isArr = isArray_1(srcValue),
|
2454 | isBuff = !isArr && isBuffer_1(srcValue),
|
2455 | isTyped = !isArr && !isBuff && isTypedArray_1(srcValue);
|
2456 |
|
2457 | newValue = srcValue;
|
2458 | if (isArr || isBuff || isTyped) {
|
2459 | if (isArray_1(objValue)) {
|
2460 | newValue = objValue;
|
2461 | }
|
2462 | else if (isArrayLikeObject_1(objValue)) {
|
2463 | newValue = _copyArray(objValue);
|
2464 | }
|
2465 | else if (isBuff) {
|
2466 | isCommon = false;
|
2467 | newValue = _cloneBuffer(srcValue, true);
|
2468 | }
|
2469 | else if (isTyped) {
|
2470 | isCommon = false;
|
2471 | newValue = _cloneTypedArray(srcValue, true);
|
2472 | }
|
2473 | else {
|
2474 | newValue = [];
|
2475 | }
|
2476 | }
|
2477 | else if (isPlainObject_1(srcValue) || isArguments_1(srcValue)) {
|
2478 | newValue = objValue;
|
2479 | if (isArguments_1(objValue)) {
|
2480 | newValue = toPlainObject_1(objValue);
|
2481 | }
|
2482 | else if (!isObject_1(objValue) || isFunction_1(objValue)) {
|
2483 | newValue = _initCloneObject(srcValue);
|
2484 | }
|
2485 | }
|
2486 | else {
|
2487 | isCommon = false;
|
2488 | }
|
2489 | }
|
2490 | if (isCommon) {
|
2491 |
|
2492 | stack.set(srcValue, newValue);
|
2493 | mergeFunc(newValue, srcValue, srcIndex, customizer, stack);
|
2494 | stack['delete'](srcValue);
|
2495 | }
|
2496 | _assignMergeValue(object, key, newValue);
|
2497 | }
|
2498 |
|
2499 | var _baseMergeDeep = baseMergeDeep;
|
2500 |
|
2501 |
|
2502 |
|
2503 |
|
2504 |
|
2505 |
|
2506 |
|
2507 |
|
2508 |
|
2509 |
|
2510 |
|
2511 |
|
2512 | function baseMerge(object, source, srcIndex, customizer, stack) {
|
2513 | if (object === source) {
|
2514 | return;
|
2515 | }
|
2516 | _baseFor(source, function(srcValue, key) {
|
2517 | stack || (stack = new _Stack);
|
2518 | if (isObject_1(srcValue)) {
|
2519 | _baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack);
|
2520 | }
|
2521 | else {
|
2522 | var newValue = customizer
|
2523 | ? customizer(_safeGet(object, key), srcValue, (key + ''), object, source, stack)
|
2524 | : undefined;
|
2525 |
|
2526 | if (newValue === undefined) {
|
2527 | newValue = srcValue;
|
2528 | }
|
2529 | _assignMergeValue(object, key, newValue);
|
2530 | }
|
2531 | }, keysIn_1);
|
2532 | }
|
2533 |
|
2534 | var _baseMerge = baseMerge;
|
2535 |
|
2536 |
|
2537 |
|
2538 |
|
2539 |
|
2540 |
|
2541 |
|
2542 |
|
2543 |
|
2544 |
|
2545 |
|
2546 |
|
2547 |
|
2548 |
|
2549 |
|
2550 | function customDefaultsMerge(objValue, srcValue, key, object, source, stack) {
|
2551 | if (isObject_1(objValue) && isObject_1(srcValue)) {
|
2552 |
|
2553 | stack.set(srcValue, objValue);
|
2554 | _baseMerge(objValue, srcValue, undefined, customDefaultsMerge, stack);
|
2555 | stack['delete'](srcValue);
|
2556 | }
|
2557 | return objValue;
|
2558 | }
|
2559 |
|
2560 | var _customDefaultsMerge = customDefaultsMerge;
|
2561 |
|
2562 |
|
2563 |
|
2564 |
|
2565 |
|
2566 |
|
2567 |
|
2568 |
|
2569 |
|
2570 |
|
2571 |
|
2572 | function isIterateeCall(value, index, object) {
|
2573 | if (!isObject_1(object)) {
|
2574 | return false;
|
2575 | }
|
2576 | var type = typeof index;
|
2577 | if (type == 'number'
|
2578 | ? (isArrayLike_1(object) && _isIndex(index, object.length))
|
2579 | : (type == 'string' && index in object)
|
2580 | ) {
|
2581 | return eq_1(object[index], value);
|
2582 | }
|
2583 | return false;
|
2584 | }
|
2585 |
|
2586 | var _isIterateeCall = isIterateeCall;
|
2587 |
|
2588 |
|
2589 |
|
2590 |
|
2591 |
|
2592 |
|
2593 |
|
2594 |
|
2595 | function createAssigner(assigner) {
|
2596 | return _baseRest(function(object, sources) {
|
2597 | var index = -1,
|
2598 | length = sources.length,
|
2599 | customizer = length > 1 ? sources[length - 1] : undefined,
|
2600 | guard = length > 2 ? sources[2] : undefined;
|
2601 |
|
2602 | customizer = (assigner.length > 3 && typeof customizer == 'function')
|
2603 | ? (length--, customizer)
|
2604 | : undefined;
|
2605 |
|
2606 | if (guard && _isIterateeCall(sources[0], sources[1], guard)) {
|
2607 | customizer = length < 3 ? undefined : customizer;
|
2608 | length = 1;
|
2609 | }
|
2610 | object = Object(object);
|
2611 | while (++index < length) {
|
2612 | var source = sources[index];
|
2613 | if (source) {
|
2614 | assigner(object, source, index, customizer);
|
2615 | }
|
2616 | }
|
2617 | return object;
|
2618 | });
|
2619 | }
|
2620 |
|
2621 | var _createAssigner = createAssigner;
|
2622 |
|
2623 |
|
2624 |
|
2625 |
|
2626 |
|
2627 |
|
2628 |
|
2629 |
|
2630 |
|
2631 |
|
2632 |
|
2633 |
|
2634 |
|
2635 |
|
2636 |
|
2637 |
|
2638 |
|
2639 |
|
2640 |
|
2641 |
|
2642 |
|
2643 |
|
2644 |
|
2645 |
|
2646 |
|
2647 |
|
2648 |
|
2649 |
|
2650 |
|
2651 |
|
2652 |
|
2653 |
|
2654 | var mergeWith = _createAssigner(function(object, source, srcIndex, customizer) {
|
2655 | _baseMerge(object, source, srcIndex, customizer);
|
2656 | });
|
2657 |
|
2658 | var mergeWith_1 = mergeWith;
|
2659 |
|
2660 |
|
2661 |
|
2662 |
|
2663 |
|
2664 |
|
2665 |
|
2666 |
|
2667 |
|
2668 |
|
2669 |
|
2670 |
|
2671 |
|
2672 |
|
2673 |
|
2674 |
|
2675 |
|
2676 |
|
2677 |
|
2678 |
|
2679 | var defaultsDeep = _baseRest(function(args) {
|
2680 | args.push(undefined, _customDefaultsMerge);
|
2681 | return _apply(mergeWith_1, undefined, args);
|
2682 | });
|
2683 |
|
2684 | var defaultsDeep_1 = defaultsDeep;
|
2685 |
|
2686 | async function loadNuxtConfig (argv, configContext) {
|
2687 | const rootDir = path.resolve(argv._[0] || '.');
|
2688 | const configFile = argv['config-file'];
|
2689 |
|
2690 |
|
2691 | const options = await config.loadNuxtConfig({
|
2692 | rootDir,
|
2693 | configFile,
|
2694 | configContext
|
2695 | });
|
2696 |
|
2697 |
|
2698 | options.mode = (argv.spa && 'spa') || (argv.universal && 'universal') || options.mode;
|
2699 |
|
2700 |
|
2701 | options.server = defaultsDeep_1({
|
2702 | port: argv.port || undefined,
|
2703 | host: argv.hostname || undefined,
|
2704 | socket: argv['unix-socket'] || undefined
|
2705 | }, options.server || {}, config.getDefaultNuxtConfig().server);
|
2706 |
|
2707 | return options
|
2708 | }
|
2709 |
|
2710 | class NuxtCommand extends Hookable {
|
2711 | constructor (cmd = { name: '', usage: '', description: '' }, argv = process.argv.slice(2), hooks = {}) {
|
2712 | super(consola);
|
2713 | this.addHooks(hooks);
|
2714 |
|
2715 | if (!cmd.options) {
|
2716 | cmd.options = {};
|
2717 | }
|
2718 | this.cmd = cmd;
|
2719 |
|
2720 | this._argv = Array.from(argv);
|
2721 | this._parsedArgv = null;
|
2722 | }
|
2723 |
|
2724 | static run (cmd, argv, hooks) {
|
2725 | return NuxtCommand.from(cmd, argv, hooks).run()
|
2726 | }
|
2727 |
|
2728 | static from (cmd, argv, hooks) {
|
2729 | if (cmd instanceof NuxtCommand) {
|
2730 | return cmd
|
2731 | }
|
2732 | return new NuxtCommand(cmd, argv, hooks)
|
2733 | }
|
2734 |
|
2735 | async run () {
|
2736 | await this.callHook('run:before', {
|
2737 | argv: this._argv,
|
2738 | cmd: this.cmd,
|
2739 | rootDir: path.resolve(this.argv._[0] || '.')
|
2740 | });
|
2741 |
|
2742 | if (this.argv.help) {
|
2743 | this.showHelp();
|
2744 | return
|
2745 | }
|
2746 |
|
2747 | if (this.argv.version) {
|
2748 | this.showVersion();
|
2749 | return
|
2750 | }
|
2751 |
|
2752 | if (typeof this.cmd.run !== 'function') {
|
2753 | throw new TypeError('Invalid command! Commands should at least implement run() function.')
|
2754 | }
|
2755 |
|
2756 | let cmdError;
|
2757 |
|
2758 | try {
|
2759 | await this.cmd.run(this);
|
2760 | } catch (e) {
|
2761 | cmdError = e;
|
2762 | }
|
2763 |
|
2764 | if (this.argv.lock) {
|
2765 | await this.releaseLock();
|
2766 | }
|
2767 |
|
2768 | if (this.argv['force-exit']) {
|
2769 | const forceExitByUser = this.isUserSuppliedArg('force-exit');
|
2770 | if (cmdError) {
|
2771 | consola.fatal(cmdError);
|
2772 | }
|
2773 | forceExit(this.cmd.name, forceExitByUser ? false : forceExitTimeout);
|
2774 | if (forceExitByUser) {
|
2775 | return
|
2776 | }
|
2777 | }
|
2778 |
|
2779 | if (cmdError) {
|
2780 | throw cmdError
|
2781 | }
|
2782 | }
|
2783 |
|
2784 | showVersion () {
|
2785 | process.stdout.write(`${name} v${version}\n`);
|
2786 | }
|
2787 |
|
2788 | showHelp () {
|
2789 | process.stdout.write(this._getHelp());
|
2790 | }
|
2791 |
|
2792 | get argv () {
|
2793 | if (!this._parsedArgv) {
|
2794 | const minimistOptions = this._getMinimistOptions();
|
2795 | this._parsedArgv = minimist(this._argv, minimistOptions);
|
2796 | }
|
2797 | return this._parsedArgv
|
2798 | }
|
2799 |
|
2800 | async getNuxtConfig (extraOptions = {}) {
|
2801 |
|
2802 | extraOptions._cli = true;
|
2803 |
|
2804 | const context = {
|
2805 | command: this.cmd.name,
|
2806 | dev: !!extraOptions.dev
|
2807 | };
|
2808 |
|
2809 | const config = await loadNuxtConfig(this.argv, context);
|
2810 | const options = Object.assign(config, extraOptions);
|
2811 |
|
2812 | for (const name of Object.keys(this.cmd.options)) {
|
2813 | this.cmd.options[name].prepare && this.cmd.options[name].prepare(this, options, this.argv);
|
2814 | }
|
2815 |
|
2816 | await this.callHook('config', options);
|
2817 |
|
2818 | return options
|
2819 | }
|
2820 |
|
2821 | async getNuxt (options) {
|
2822 | const { Nuxt } = await core();
|
2823 |
|
2824 | const nuxt = new Nuxt(options);
|
2825 | await nuxt.ready();
|
2826 |
|
2827 | return nuxt
|
2828 | }
|
2829 |
|
2830 | async getBuilder (nuxt) {
|
2831 | const { Builder } = await builder();
|
2832 | const { BundleBuilder } = await webpack();
|
2833 | return new Builder(nuxt, BundleBuilder)
|
2834 | }
|
2835 |
|
2836 | async getGenerator (nuxt) {
|
2837 | const { Generator } = await generator();
|
2838 | const builder = await this.getBuilder(nuxt);
|
2839 | return new Generator(nuxt, builder)
|
2840 | }
|
2841 |
|
2842 | async setLock (lockRelease) {
|
2843 | if (lockRelease) {
|
2844 | if (this._lockRelease) {
|
2845 | consola.warn(`A previous unreleased lock was found, this shouldn't happen and is probably an error in 'nuxt ${this.cmd.name}' command. The lock will be removed but be aware of potential strange results`);
|
2846 |
|
2847 | await this.releaseLock();
|
2848 | this._lockRelease = lockRelease;
|
2849 | } else {
|
2850 | this._lockRelease = lockRelease;
|
2851 | }
|
2852 | }
|
2853 | }
|
2854 |
|
2855 | async releaseLock () {
|
2856 | if (this._lockRelease) {
|
2857 | await this._lockRelease();
|
2858 | this._lockRelease = undefined;
|
2859 | }
|
2860 | }
|
2861 |
|
2862 | isUserSuppliedArg (option) {
|
2863 | return this._argv.includes(`--${option}`) || this._argv.includes(`--no-${option}`)
|
2864 | }
|
2865 |
|
2866 | _getDefaultOptionValue (option) {
|
2867 | return typeof option.default === 'function' ? option.default(this.cmd) : option.default
|
2868 | }
|
2869 |
|
2870 | _getMinimistOptions () {
|
2871 | const minimistOptions = {
|
2872 | alias: {},
|
2873 | boolean: [],
|
2874 | string: [],
|
2875 | default: {}
|
2876 | };
|
2877 |
|
2878 | for (const name of Object.keys(this.cmd.options)) {
|
2879 | const option = this.cmd.options[name];
|
2880 |
|
2881 | if (option.alias) {
|
2882 | minimistOptions.alias[option.alias] = name;
|
2883 | }
|
2884 | if (option.type) {
|
2885 | minimistOptions[option.type].push(option.alias || name);
|
2886 | }
|
2887 | if (option.default) {
|
2888 | minimistOptions.default[option.alias || name] = this._getDefaultOptionValue(option);
|
2889 | }
|
2890 | }
|
2891 |
|
2892 | return minimistOptions
|
2893 | }
|
2894 |
|
2895 | _getHelp () {
|
2896 | const options = [];
|
2897 | let maxOptionLength = 0;
|
2898 |
|
2899 | for (const name in this.cmd.options) {
|
2900 | const option = this.cmd.options[name];
|
2901 |
|
2902 | let optionHelp = '--';
|
2903 | optionHelp += option.type === 'boolean' && this._getDefaultOptionValue(option) ? 'no-' : '';
|
2904 | optionHelp += name;
|
2905 | if (option.alias) {
|
2906 | optionHelp += `, -${option.alias}`;
|
2907 | }
|
2908 |
|
2909 | maxOptionLength = Math.max(maxOptionLength, optionHelp.length);
|
2910 | options.push([optionHelp, option.description]);
|
2911 | }
|
2912 |
|
2913 | const _opts = options.map(([option, description]) => {
|
2914 | const i = indent(maxOptionLength + optionSpaces - option.length);
|
2915 | return foldLines(
|
2916 | option + i + description,
|
2917 | startSpaces + maxOptionLength + optionSpaces * 2,
|
2918 | startSpaces + optionSpaces
|
2919 | )
|
2920 | }).join('\n');
|
2921 |
|
2922 | const usage = foldLines(`Usage: nuxt ${this.cmd.usage} [options]`, startSpaces);
|
2923 | const description = foldLines(this.cmd.description, startSpaces);
|
2924 | const opts = foldLines('Options:', startSpaces) + '\n\n' + _opts;
|
2925 |
|
2926 | let helpText = colorize(`${usage}\n\n`);
|
2927 | if (this.cmd.description) {
|
2928 | helpText += colorize(`${description}\n\n`);
|
2929 | }
|
2930 | if (options.length) {
|
2931 | helpText += colorize(`${opts}\n\n`);
|
2932 | }
|
2933 |
|
2934 | return helpText
|
2935 | }
|
2936 | }
|
2937 |
|
2938 | let _setup = false;
|
2939 |
|
2940 | function setup ({ dev }) {
|
2941 |
|
2942 | if (!process.env.NODE_ENV) {
|
2943 | process.env.NODE_ENV = dev ? 'development' : 'production';
|
2944 | }
|
2945 |
|
2946 | if (_setup) {
|
2947 | return
|
2948 | }
|
2949 | _setup = true;
|
2950 |
|
2951 |
|
2952 |
|
2953 | process.on('unhandledRejection', (err) => {
|
2954 | consola.error(err);
|
2955 | });
|
2956 |
|
2957 |
|
2958 |
|
2959 | consola.addReporter({
|
2960 | log (logObj) {
|
2961 | if (logObj.type === 'fatal') {
|
2962 | const errorMessage = String(logObj.args[0]);
|
2963 | process.stderr.write(fatalBox(errorMessage));
|
2964 | exit(1);
|
2965 | }
|
2966 | }
|
2967 | });
|
2968 |
|
2969 |
|
2970 | consola.wrapConsole();
|
2971 | }
|
2972 |
|
2973 | function packageExists (name) {
|
2974 | try {
|
2975 | require.resolve(name);
|
2976 | return true
|
2977 | } catch (e) {
|
2978 | return false
|
2979 | }
|
2980 | }
|
2981 |
|
2982 | async function run (_argv, hooks = {}) {
|
2983 |
|
2984 | const dupPkg = '@nuxt/' + ( 'cli-edge');
|
2985 | if (packageExists(dupPkg)) {
|
2986 | throw new Error('Both `nuxt` and `nuxt-edge` dependencies are installed! This is unsupported, please choose one and remove the other one from dependencies.')
|
2987 | }
|
2988 |
|
2989 |
|
2990 | const argv = _argv ? Array.from(_argv) : process.argv.slice(2);
|
2991 |
|
2992 |
|
2993 | let cmd = await getCommand(argv[0]);
|
2994 |
|
2995 |
|
2996 | if (!cmd && (!argv[0] || argv[0][0] === '-' || fs.existsSync(argv[0]))) {
|
2997 | argv.unshift('dev');
|
2998 | cmd = await getCommand('dev');
|
2999 | }
|
3000 |
|
3001 |
|
3002 | const dev = argv[0] === 'dev';
|
3003 |
|
3004 |
|
3005 | setup({ dev });
|
3006 |
|
3007 |
|
3008 | if (cmd) {
|
3009 | return NuxtCommand.run(cmd, argv.slice(1), hooks)
|
3010 | }
|
3011 |
|
3012 |
|
3013 | try {
|
3014 | await execa(`nuxt-${argv[0]}`, argv.slice(1), {
|
3015 | stdout: process.stdout,
|
3016 | stderr: process.stderr,
|
3017 | stdin: process.stdin
|
3018 | });
|
3019 | } catch (error) {
|
3020 | if (error.exitCode === 2) {
|
3021 | throw String(`Command not found: nuxt-${argv[0]}`)
|
3022 | }
|
3023 | throw String(`Failed to run command \`nuxt-${argv[0]}\`:\n${error}`)
|
3024 | }
|
3025 | }
|
3026 |
|
3027 | async function getWebpackConfig (name = 'client', loadOptions = {}) {
|
3028 | const { loadNuxt } = await core();
|
3029 | const { getBuilder } = await builder();
|
3030 |
|
3031 | const nuxt = await loadNuxt(loadOptions);
|
3032 | const builder$1 = await getBuilder(nuxt);
|
3033 | const { bundleBuilder } = builder$1;
|
3034 | return bundleBuilder.getWebpackConfig(name)
|
3035 | }
|
3036 |
|
3037 | exports.MapCache = _MapCache;
|
3038 | exports.NuxtCommand = NuxtCommand;
|
3039 | exports.Symbol = _Symbol;
|
3040 | exports.baseGetTag = _baseGetTag;
|
3041 | exports.colorize = colorize;
|
3042 | exports.common = common;
|
3043 | exports.createLock = createLock;
|
3044 | exports.eventsMapping = eventsMapping;
|
3045 | exports.foldLines = foldLines;
|
3046 | exports.formatPath = formatPath;
|
3047 | exports.getCommand = getCommand;
|
3048 | exports.getWebpackConfig = getWebpackConfig;
|
3049 | exports.imports = imports;
|
3050 | exports.indent = indent;
|
3051 | exports.index = index;
|
3052 | exports.index$1 = index$1;
|
3053 | exports.isArray = isArray_1;
|
3054 | exports.isObjectLike = isObjectLike_1;
|
3055 | exports.loadNuxtConfig = loadNuxtConfig;
|
3056 | exports.locking = locking;
|
3057 | exports.normalizeArg = normalizeArg;
|
3058 | exports.optionSpaces = optionSpaces;
|
3059 | exports.run = run;
|
3060 | exports.server = server;
|
3061 | exports.setup = setup;
|
3062 | exports.startSpaces = startSpaces;
|
3063 | exports.successBox = successBox;
|