1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', { value: true });
|
4 |
|
5 | function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
6 |
|
7 | var lodash = require('lodash');
|
8 | var fs = _interopDefault(require('fs'));
|
9 | var path = _interopDefault(require('path'));
|
10 |
|
11 | var fails = function (exec) {
|
12 | try {
|
13 | return !!exec();
|
14 | } catch (error) {
|
15 | return true;
|
16 | }
|
17 | };
|
18 |
|
19 | var toString = {}.toString;
|
20 |
|
21 | var classofRaw = function (it) {
|
22 | return toString.call(it).slice(8, -1);
|
23 | };
|
24 |
|
25 |
|
26 |
|
27 |
|
28 | var split = ''.split;
|
29 |
|
30 | var indexedObject = fails(function () {
|
31 |
|
32 |
|
33 | return !Object('z').propertyIsEnumerable(0);
|
34 | }) ? function (it) {
|
35 | return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
|
36 | } : Object;
|
37 |
|
38 |
|
39 |
|
40 | var requireObjectCoercible = function (it) {
|
41 | if (it == undefined) throw TypeError("Can't call method on " + it);
|
42 | return it;
|
43 | };
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 | var toIndexedObject = function (it) {
|
50 | return indexedObject(requireObjectCoercible(it));
|
51 | };
|
52 |
|
53 | function createCommonjsModule(fn, module) {
|
54 | return module = { exports: {} }, fn(module, module.exports), module.exports;
|
55 | }
|
56 |
|
57 |
|
58 | var global = typeof window == 'object' && window && window.Math == Math ? window
|
59 | : typeof self == 'object' && self && self.Math == Math ? self
|
60 |
|
61 | : Function('return this')();
|
62 |
|
63 |
|
64 | var descriptors = !fails(function () {
|
65 | return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
|
66 | });
|
67 |
|
68 | var isObject = function (it) {
|
69 | return typeof it === 'object' ? it !== null : typeof it === 'function';
|
70 | };
|
71 |
|
72 | var document = global.document;
|
73 |
|
74 | var exist = isObject(document) && isObject(document.createElement);
|
75 |
|
76 | var documentCreateElement = function (it) {
|
77 | return exist ? document.createElement(it) : {};
|
78 | };
|
79 |
|
80 |
|
81 | var ie8DomDefine = !descriptors && !fails(function () {
|
82 | return Object.defineProperty(documentCreateElement('div'), 'a', {
|
83 | get: function () { return 7; }
|
84 | }).a != 7;
|
85 | });
|
86 |
|
87 | var anObject = function (it) {
|
88 | if (!isObject(it)) {
|
89 | throw TypeError(String(it) + ' is not an object');
|
90 | } return it;
|
91 | };
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 | var toPrimitive = function (it, S) {
|
98 | if (!isObject(it)) return it;
|
99 | var fn, val;
|
100 | if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
|
101 | if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
|
102 | if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
|
103 | throw TypeError("Can't convert object to primitive value");
|
104 | };
|
105 |
|
106 | var nativeDefineProperty = Object.defineProperty;
|
107 |
|
108 | var f = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
|
109 | anObject(O);
|
110 | P = toPrimitive(P, true);
|
111 | anObject(Attributes);
|
112 | if (ie8DomDefine) try {
|
113 | return nativeDefineProperty(O, P, Attributes);
|
114 | } catch (error) { }
|
115 | if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
|
116 | if ('value' in Attributes) O[P] = Attributes.value;
|
117 | return O;
|
118 | };
|
119 |
|
120 | var objectDefineProperty = {
|
121 | f: f
|
122 | };
|
123 |
|
124 | var createPropertyDescriptor = function (bitmap, value) {
|
125 | return {
|
126 | enumerable: !(bitmap & 1),
|
127 | configurable: !(bitmap & 2),
|
128 | writable: !(bitmap & 4),
|
129 | value: value
|
130 | };
|
131 | };
|
132 |
|
133 | var hide = descriptors ? function (object, key, value) {
|
134 | return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
|
135 | } : function (object, key, value) {
|
136 | object[key] = value;
|
137 | return object;
|
138 | };
|
139 |
|
140 | var setGlobal = function (key, value) {
|
141 | try {
|
142 | hide(global, key, value);
|
143 | } catch (error) {
|
144 | global[key] = value;
|
145 | } return value;
|
146 | };
|
147 |
|
148 | var shared = createCommonjsModule(function (module) {
|
149 | var SHARED = '__core-js_shared__';
|
150 | var store = global[SHARED] || setGlobal(SHARED, {});
|
151 |
|
152 | (module.exports = function (key, value) {
|
153 | return store[key] || (store[key] = value !== undefined ? value : {});
|
154 | })('versions', []).push({
|
155 | version: '3.0.1',
|
156 | mode: 'global',
|
157 | copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
|
158 | });
|
159 | });
|
160 |
|
161 | var id = 0;
|
162 | var postfix = Math.random();
|
163 |
|
164 | var uid = function (key) {
|
165 | return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + postfix).toString(36));
|
166 | };
|
167 |
|
168 |
|
169 | var nativeSymbol = !fails(function () {
|
170 |
|
171 | return !String(Symbol());
|
172 | });
|
173 |
|
174 | var store = shared('wks');
|
175 |
|
176 | var Symbol$1 = global.Symbol;
|
177 |
|
178 |
|
179 | var wellKnownSymbol = function (name) {
|
180 | return store[name] || (store[name] = nativeSymbol && Symbol$1[name]
|
181 | || (nativeSymbol ? Symbol$1 : uid)('Symbol.' + name));
|
182 | };
|
183 |
|
184 | var hasOwnProperty = {}.hasOwnProperty;
|
185 |
|
186 | var has = function (it, key) {
|
187 | return hasOwnProperty.call(it, key);
|
188 | };
|
189 |
|
190 | var ceil = Math.ceil;
|
191 | var floor = Math.floor;
|
192 |
|
193 |
|
194 |
|
195 | var toInteger = function (argument) {
|
196 | return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
|
197 | };
|
198 |
|
199 | var min = Math.min;
|
200 |
|
201 |
|
202 |
|
203 | var toLength = function (argument) {
|
204 | return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0;
|
205 | };
|
206 |
|
207 | var max = Math.max;
|
208 | var min$1 = Math.min;
|
209 |
|
210 |
|
211 |
|
212 |
|
213 | var toAbsoluteIndex = function (index, length) {
|
214 | var integer = toInteger(index);
|
215 | return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
|
216 | };
|
217 |
|
218 |
|
219 |
|
220 |
|
221 |
|
222 |
|
223 | var arrayIncludes = function (IS_INCLUDES) {
|
224 | return function ($this, el, fromIndex) {
|
225 | var O = toIndexedObject($this);
|
226 | var length = toLength(O.length);
|
227 | var index = toAbsoluteIndex(fromIndex, length);
|
228 | var value;
|
229 |
|
230 |
|
231 | if (IS_INCLUDES && el != el) while (length > index) {
|
232 | value = O[index++];
|
233 |
|
234 | if (value != value) return true;
|
235 |
|
236 | } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
|
237 | if (O[index] === el) return IS_INCLUDES || index || 0;
|
238 | } return !IS_INCLUDES && -1;
|
239 | };
|
240 | };
|
241 |
|
242 | var hiddenKeys = {};
|
243 |
|
244 | var arrayIndexOf = arrayIncludes(false);
|
245 |
|
246 |
|
247 | var objectKeysInternal = function (object, names) {
|
248 | var O = toIndexedObject(object);
|
249 | var i = 0;
|
250 | var result = [];
|
251 | var key;
|
252 | for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
|
253 |
|
254 | while (names.length > i) if (has(O, key = names[i++])) {
|
255 | ~arrayIndexOf(result, key) || result.push(key);
|
256 | }
|
257 | return result;
|
258 | };
|
259 |
|
260 |
|
261 | var enumBugKeys = [
|
262 | 'constructor',
|
263 | 'hasOwnProperty',
|
264 | 'isPrototypeOf',
|
265 | 'propertyIsEnumerable',
|
266 | 'toLocaleString',
|
267 | 'toString',
|
268 | 'valueOf'
|
269 | ];
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 | var objectKeys = Object.keys || function keys(O) {
|
276 | return objectKeysInternal(O, enumBugKeys);
|
277 | };
|
278 |
|
279 | var objectDefineProperties = descriptors ? Object.defineProperties : function defineProperties(O, Properties) {
|
280 | anObject(O);
|
281 | var keys = objectKeys(Properties);
|
282 | var length = keys.length;
|
283 | var i = 0;
|
284 | var key;
|
285 | while (length > i) objectDefineProperty.f(O, key = keys[i++], Properties[key]);
|
286 | return O;
|
287 | };
|
288 |
|
289 | var document$1 = global.document;
|
290 |
|
291 | var html = document$1 && document$1.documentElement;
|
292 |
|
293 | var shared$1 = shared('keys');
|
294 |
|
295 |
|
296 | var sharedKey = function (key) {
|
297 | return shared$1[key] || (shared$1[key] = uid(key));
|
298 | };
|
299 |
|
300 |
|
301 |
|
302 |
|
303 |
|
304 |
|
305 |
|
306 | var IE_PROTO = sharedKey('IE_PROTO');
|
307 | var PROTOTYPE = 'prototype';
|
308 | var Empty = function () { };
|
309 |
|
310 |
|
311 | var createDict = function () {
|
312 |
|
313 | var iframe = documentCreateElement('iframe');
|
314 | var length = enumBugKeys.length;
|
315 | var lt = '<';
|
316 | var script = 'script';
|
317 | var gt = '>';
|
318 | var js = 'java' + script + ':';
|
319 | var iframeDocument;
|
320 | iframe.style.display = 'none';
|
321 | html.appendChild(iframe);
|
322 | iframe.src = String(js);
|
323 | iframeDocument = iframe.contentWindow.document;
|
324 | iframeDocument.open();
|
325 | iframeDocument.write(lt + script + gt + 'document.F=Object' + lt + '/' + script + gt);
|
326 | iframeDocument.close();
|
327 | createDict = iframeDocument.F;
|
328 | while (length--) delete createDict[PROTOTYPE][enumBugKeys[length]];
|
329 | return createDict();
|
330 | };
|
331 |
|
332 | var objectCreate = Object.create || function create(O, Properties) {
|
333 | var result;
|
334 | if (O !== null) {
|
335 | Empty[PROTOTYPE] = anObject(O);
|
336 | result = new Empty();
|
337 | Empty[PROTOTYPE] = null;
|
338 |
|
339 | result[IE_PROTO] = O;
|
340 | } else result = createDict();
|
341 | return Properties === undefined ? result : objectDefineProperties(result, Properties);
|
342 | };
|
343 |
|
344 | hiddenKeys[IE_PROTO] = true;
|
345 |
|
346 | var UNSCOPABLES = wellKnownSymbol('unscopables');
|
347 |
|
348 |
|
349 | var ArrayPrototype = Array.prototype;
|
350 |
|
351 |
|
352 |
|
353 | if (ArrayPrototype[UNSCOPABLES] == undefined) {
|
354 | hide(ArrayPrototype, UNSCOPABLES, objectCreate(null));
|
355 | }
|
356 |
|
357 |
|
358 | var addToUnscopables = function (key) {
|
359 | ArrayPrototype[UNSCOPABLES][key] = true;
|
360 | };
|
361 |
|
362 | var functionToString = shared('native-function-to-string', Function.toString);
|
363 |
|
364 | var WeakMap = global.WeakMap;
|
365 |
|
366 | var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(functionToString.call(WeakMap));
|
367 |
|
368 | var WeakMap$1 = global.WeakMap;
|
369 | var set, get, has$1;
|
370 |
|
371 | var enforce = function (it) {
|
372 | return has$1(it) ? get(it) : set(it, {});
|
373 | };
|
374 |
|
375 | var getterFor = function (TYPE) {
|
376 | return function (it) {
|
377 | var state;
|
378 | if (!isObject(it) || (state = get(it)).type !== TYPE) {
|
379 | throw TypeError('Incompatible receiver, ' + TYPE + ' required');
|
380 | } return state;
|
381 | };
|
382 | };
|
383 |
|
384 | if (nativeWeakMap) {
|
385 | var store$1 = new WeakMap$1();
|
386 | var wmget = store$1.get;
|
387 | var wmhas = store$1.has;
|
388 | var wmset = store$1.set;
|
389 | set = function (it, metadata) {
|
390 | wmset.call(store$1, it, metadata);
|
391 | return metadata;
|
392 | };
|
393 | get = function (it) {
|
394 | return wmget.call(store$1, it) || {};
|
395 | };
|
396 | has$1 = function (it) {
|
397 | return wmhas.call(store$1, it);
|
398 | };
|
399 | } else {
|
400 | var STATE = sharedKey('state');
|
401 | hiddenKeys[STATE] = true;
|
402 | set = function (it, metadata) {
|
403 | hide(it, STATE, metadata);
|
404 | return metadata;
|
405 | };
|
406 | get = function (it) {
|
407 | return has(it, STATE) ? it[STATE] : {};
|
408 | };
|
409 | has$1 = function (it) {
|
410 | return has(it, STATE);
|
411 | };
|
412 | }
|
413 |
|
414 | var internalState = {
|
415 | set: set,
|
416 | get: get,
|
417 | has: has$1,
|
418 | enforce: enforce,
|
419 | getterFor: getterFor
|
420 | };
|
421 |
|
422 | var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
|
423 | var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
424 |
|
425 |
|
426 | var NASHORN_BUG = nativeGetOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
|
427 |
|
428 | var f$1 = NASHORN_BUG ? function propertyIsEnumerable(V) {
|
429 | var descriptor = nativeGetOwnPropertyDescriptor(this, V);
|
430 | return !!descriptor && descriptor.enumerable;
|
431 | } : nativePropertyIsEnumerable;
|
432 |
|
433 | var objectPropertyIsEnumerable = {
|
434 | f: f$1
|
435 | };
|
436 |
|
437 | var nativeGetOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
|
438 |
|
439 | var f$2 = descriptors ? nativeGetOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
|
440 | O = toIndexedObject(O);
|
441 | P = toPrimitive(P, true);
|
442 | if (ie8DomDefine) try {
|
443 | return nativeGetOwnPropertyDescriptor$1(O, P);
|
444 | } catch (error) { }
|
445 | if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
|
446 | };
|
447 |
|
448 | var objectGetOwnPropertyDescriptor = {
|
449 | f: f$2
|
450 | };
|
451 |
|
452 | var redefine = createCommonjsModule(function (module) {
|
453 | var getInternalState = internalState.get;
|
454 | var enforceInternalState = internalState.enforce;
|
455 | var TEMPLATE = String(functionToString).split('toString');
|
456 |
|
457 | shared('inspectSource', function (it) {
|
458 | return functionToString.call(it);
|
459 | });
|
460 |
|
461 | (module.exports = function (O, key, value, options) {
|
462 | var unsafe = options ? !!options.unsafe : false;
|
463 | var simple = options ? !!options.enumerable : false;
|
464 | var noTargetGet = options ? !!options.noTargetGet : false;
|
465 | if (typeof value == 'function') {
|
466 | if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
|
467 | enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
|
468 | }
|
469 | if (O === global) {
|
470 | if (simple) O[key] = value;
|
471 | else setGlobal(key, value);
|
472 | return;
|
473 | } else if (!unsafe) {
|
474 | delete O[key];
|
475 | } else if (!noTargetGet && O[key]) {
|
476 | simple = true;
|
477 | }
|
478 | if (simple) O[key] = value;
|
479 | else hide(O, key, value);
|
480 |
|
481 | })(Function.prototype, 'toString', function toString() {
|
482 | return typeof this == 'function' && getInternalState(this).source || functionToString.call(this);
|
483 | });
|
484 | });
|
485 |
|
486 |
|
487 |
|
488 | var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
|
489 |
|
490 | var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
|
491 | return objectKeysInternal(O, hiddenKeys$1);
|
492 | };
|
493 |
|
494 | var objectGetOwnPropertyNames = {
|
495 | f: f$3
|
496 | };
|
497 |
|
498 | var f$4 = Object.getOwnPropertySymbols;
|
499 |
|
500 | var objectGetOwnPropertySymbols = {
|
501 | f: f$4
|
502 | };
|
503 |
|
504 | var Reflect = global.Reflect;
|
505 |
|
506 |
|
507 | var ownKeys = Reflect && Reflect.ownKeys || function ownKeys(it) {
|
508 | var keys = objectGetOwnPropertyNames.f(anObject(it));
|
509 | var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
|
510 | return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
|
511 | };
|
512 |
|
513 | var copyConstructorProperties = function (target, source) {
|
514 | var keys = ownKeys(source);
|
515 | var defineProperty = objectDefineProperty.f;
|
516 | var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
517 | for (var i = 0; i < keys.length; i++) {
|
518 | var key = keys[i];
|
519 | if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
|
520 | }
|
521 | };
|
522 |
|
523 | var replacement = /#|\.prototype\./;
|
524 |
|
525 | var isForced = function (feature, detection) {
|
526 | var value = data[normalize(feature)];
|
527 | return value == POLYFILL ? true
|
528 | : value == NATIVE ? false
|
529 | : typeof detection == 'function' ? fails(detection)
|
530 | : !!detection;
|
531 | };
|
532 |
|
533 | var normalize = isForced.normalize = function (string) {
|
534 | return String(string).replace(replacement, '.').toLowerCase();
|
535 | };
|
536 |
|
537 | var data = isForced.data = {};
|
538 | var NATIVE = isForced.NATIVE = 'N';
|
539 | var POLYFILL = isForced.POLYFILL = 'P';
|
540 |
|
541 | var isForced_1 = isForced;
|
542 |
|
543 | var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
|
544 |
|
545 |
|
546 |
|
547 |
|
548 |
|
549 |
|
550 |
|
551 |
|
552 |
|
553 |
|
554 |
|
555 |
|
556 |
|
557 |
|
558 |
|
559 |
|
560 |
|
561 |
|
562 |
|
563 |
|
564 | var _export = function (options, source) {
|
565 | var TARGET = options.target;
|
566 | var GLOBAL = options.global;
|
567 | var STATIC = options.stat;
|
568 | var FORCED, target, key, targetProperty, sourceProperty, descriptor;
|
569 | if (GLOBAL) {
|
570 | target = global;
|
571 | } else if (STATIC) {
|
572 | target = global[TARGET] || setGlobal(TARGET, {});
|
573 | } else {
|
574 | target = (global[TARGET] || {}).prototype;
|
575 | }
|
576 | if (target) for (key in source) {
|
577 | sourceProperty = source[key];
|
578 | if (options.noTargetGet) {
|
579 | descriptor = getOwnPropertyDescriptor(target, key);
|
580 | targetProperty = descriptor && descriptor.value;
|
581 | } else targetProperty = target[key];
|
582 | FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
|
583 |
|
584 | if (!FORCED && targetProperty !== undefined) {
|
585 | if (typeof sourceProperty === typeof targetProperty) continue;
|
586 | copyConstructorProperties(sourceProperty, targetProperty);
|
587 | }
|
588 |
|
589 | if (options.sham || (targetProperty && targetProperty.sham)) {
|
590 | hide(sourceProperty, 'sham', true);
|
591 | }
|
592 |
|
593 | redefine(target, key, sourceProperty, options);
|
594 | }
|
595 | };
|
596 |
|
597 |
|
598 |
|
599 | var toObject = function (argument) {
|
600 | return Object(requireObjectCoercible(argument));
|
601 | };
|
602 |
|
603 | var correctPrototypeGetter = !fails(function () {
|
604 | function F() { }
|
605 | F.prototype.constructor = null;
|
606 | return Object.getPrototypeOf(new F()) !== F.prototype;
|
607 | });
|
608 |
|
609 |
|
610 |
|
611 |
|
612 | var IE_PROTO$1 = sharedKey('IE_PROTO');
|
613 |
|
614 | var ObjectPrototype = Object.prototype;
|
615 |
|
616 | var objectGetPrototypeOf = correctPrototypeGetter ? Object.getPrototypeOf : function (O) {
|
617 | O = toObject(O);
|
618 | if (has(O, IE_PROTO$1)) return O[IE_PROTO$1];
|
619 | if (typeof O.constructor == 'function' && O instanceof O.constructor) {
|
620 | return O.constructor.prototype;
|
621 | } return O instanceof Object ? ObjectPrototype : null;
|
622 | };
|
623 |
|
624 | var ITERATOR = wellKnownSymbol('iterator');
|
625 | var BUGGY_SAFARI_ITERATORS = false;
|
626 |
|
627 | var returnThis = function () { return this; };
|
628 |
|
629 |
|
630 |
|
631 | var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator;
|
632 |
|
633 | if ([].keys) {
|
634 | arrayIterator = [].keys();
|
635 |
|
636 | if (!('next' in arrayIterator)) BUGGY_SAFARI_ITERATORS = true;
|
637 | else {
|
638 | PrototypeOfArrayIteratorPrototype = objectGetPrototypeOf(objectGetPrototypeOf(arrayIterator));
|
639 | if (PrototypeOfArrayIteratorPrototype !== Object.prototype) IteratorPrototype = PrototypeOfArrayIteratorPrototype;
|
640 | }
|
641 | }
|
642 |
|
643 | if (IteratorPrototype == undefined) IteratorPrototype = {};
|
644 |
|
645 |
|
646 | if (!has(IteratorPrototype, ITERATOR)) hide(IteratorPrototype, ITERATOR, returnThis);
|
647 |
|
648 | var iteratorsCore = {
|
649 | IteratorPrototype: IteratorPrototype,
|
650 | BUGGY_SAFARI_ITERATORS: BUGGY_SAFARI_ITERATORS
|
651 | };
|
652 |
|
653 | var defineProperty = objectDefineProperty.f;
|
654 |
|
655 | var TO_STRING_TAG = wellKnownSymbol('toStringTag');
|
656 |
|
657 | var setToStringTag = function (it, TAG, STATIC) {
|
658 | if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) {
|
659 | defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG });
|
660 | }
|
661 | };
|
662 |
|
663 | var IteratorPrototype$1 = iteratorsCore.IteratorPrototype;
|
664 |
|
665 | var createIteratorConstructor = function (IteratorConstructor, NAME, next) {
|
666 | var TO_STRING_TAG = NAME + ' Iterator';
|
667 | IteratorConstructor.prototype = objectCreate(IteratorPrototype$1, { next: createPropertyDescriptor(1, next) });
|
668 | setToStringTag(IteratorConstructor, TO_STRING_TAG, false, true);
|
669 | return IteratorConstructor;
|
670 | };
|
671 |
|
672 | var validateSetPrototypeOfArguments = function (O, proto) {
|
673 | anObject(O);
|
674 | if (!isObject(proto) && proto !== null) {
|
675 | throw TypeError("Can't set " + String(proto) + ' as a prototype');
|
676 | }
|
677 | };
|
678 |
|
679 |
|
680 |
|
681 |
|
682 |
|
683 | var objectSetPrototypeOf = Object.setPrototypeOf || ('__proto__' in {} ? function () {
|
684 | var correctSetter = false;
|
685 | var test = {};
|
686 | var setter;
|
687 | try {
|
688 | setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
|
689 | setter.call(test, []);
|
690 | correctSetter = test instanceof Array;
|
691 | } catch (error) { }
|
692 | return function setPrototypeOf(O, proto) {
|
693 | validateSetPrototypeOfArguments(O, proto);
|
694 | if (correctSetter) setter.call(O, proto);
|
695 | else O.__proto__ = proto;
|
696 | return O;
|
697 | };
|
698 | }() : undefined);
|
699 |
|
700 | var ITERATOR$1 = wellKnownSymbol('iterator');
|
701 |
|
702 |
|
703 | var IteratorPrototype$2 = iteratorsCore.IteratorPrototype;
|
704 | var BUGGY_SAFARI_ITERATORS$1 = iteratorsCore.BUGGY_SAFARI_ITERATORS;
|
705 | var KEYS = 'keys';
|
706 | var VALUES = 'values';
|
707 | var ENTRIES = 'entries';
|
708 |
|
709 | var returnThis$1 = function () { return this; };
|
710 |
|
711 | var defineIterator = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, IS_SET, FORCED) {
|
712 | createIteratorConstructor(IteratorConstructor, NAME, next);
|
713 |
|
714 | var getIterationMethod = function (KIND) {
|
715 | if (KIND === DEFAULT && defaultIterator) return defaultIterator;
|
716 | if (!BUGGY_SAFARI_ITERATORS$1 && KIND in IterablePrototype) return IterablePrototype[KIND];
|
717 | switch (KIND) {
|
718 | case KEYS: return function keys() { return new IteratorConstructor(this, KIND); };
|
719 | case VALUES: return function values() { return new IteratorConstructor(this, KIND); };
|
720 | case ENTRIES: return function entries() { return new IteratorConstructor(this, KIND); };
|
721 | } return function () { return new IteratorConstructor(this); };
|
722 | };
|
723 |
|
724 | var TO_STRING_TAG = NAME + ' Iterator';
|
725 | var INCORRECT_VALUES_NAME = false;
|
726 | var IterablePrototype = Iterable.prototype;
|
727 | var nativeIterator = IterablePrototype[ITERATOR$1]
|
728 | || IterablePrototype['@@iterator']
|
729 | || DEFAULT && IterablePrototype[DEFAULT];
|
730 | var defaultIterator = !BUGGY_SAFARI_ITERATORS$1 && nativeIterator || getIterationMethod(DEFAULT);
|
731 | var anyNativeIterator = NAME == 'Array' ? IterablePrototype.entries || nativeIterator : nativeIterator;
|
732 | var CurrentIteratorPrototype, methods, KEY;
|
733 |
|
734 |
|
735 | if (anyNativeIterator) {
|
736 | CurrentIteratorPrototype = objectGetPrototypeOf(anyNativeIterator.call(new Iterable()));
|
737 | if (IteratorPrototype$2 !== Object.prototype && CurrentIteratorPrototype.next) {
|
738 | if (objectGetPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype$2) {
|
739 | if (objectSetPrototypeOf) {
|
740 | objectSetPrototypeOf(CurrentIteratorPrototype, IteratorPrototype$2);
|
741 | } else if (typeof CurrentIteratorPrototype[ITERATOR$1] != 'function') {
|
742 | hide(CurrentIteratorPrototype, ITERATOR$1, returnThis$1);
|
743 | }
|
744 | }
|
745 |
|
746 | setToStringTag(CurrentIteratorPrototype, TO_STRING_TAG, true, true);
|
747 | }
|
748 | }
|
749 |
|
750 |
|
751 | if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) {
|
752 | INCORRECT_VALUES_NAME = true;
|
753 | defaultIterator = function values() { return nativeIterator.call(this); };
|
754 | }
|
755 |
|
756 |
|
757 | if (IterablePrototype[ITERATOR$1] !== defaultIterator) {
|
758 | hide(IterablePrototype, ITERATOR$1, defaultIterator);
|
759 | }
|
760 |
|
761 |
|
762 | if (DEFAULT) {
|
763 | methods = {
|
764 | values: getIterationMethod(VALUES),
|
765 | keys: IS_SET ? defaultIterator : getIterationMethod(KEYS),
|
766 | entries: getIterationMethod(ENTRIES)
|
767 | };
|
768 | if (FORCED) for (KEY in methods) {
|
769 | if (BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME || !(KEY in IterablePrototype)) {
|
770 | redefine(IterablePrototype, KEY, methods[KEY]);
|
771 | }
|
772 | } else _export({ target: NAME, proto: true, forced: BUGGY_SAFARI_ITERATORS$1 || INCORRECT_VALUES_NAME }, methods);
|
773 | }
|
774 |
|
775 | return methods;
|
776 | };
|
777 |
|
778 | var ARRAY_ITERATOR = 'Array Iterator';
|
779 | var setInternalState = internalState.set;
|
780 | var getInternalState = internalState.getterFor(ARRAY_ITERATOR);
|
781 |
|
782 |
|
783 |
|
784 |
|
785 |
|
786 |
|
787 |
|
788 |
|
789 |
|
790 |
|
791 |
|
792 | var es_array_iterator = defineIterator(Array, 'Array', function (iterated, kind) {
|
793 | setInternalState(this, {
|
794 | type: ARRAY_ITERATOR,
|
795 | target: toIndexedObject(iterated),
|
796 | index: 0,
|
797 | kind: kind
|
798 | });
|
799 |
|
800 |
|
801 | }, function () {
|
802 | var state = getInternalState(this);
|
803 | var target = state.target;
|
804 | var kind = state.kind;
|
805 | var index = state.index++;
|
806 | if (!target || index >= target.length) {
|
807 | state.target = undefined;
|
808 | return { value: undefined, done: true };
|
809 | }
|
810 | if (kind == 'keys') return { value: index, done: false };
|
811 | if (kind == 'values') return { value: target[index], done: false };
|
812 | return { value: [index, target[index]], done: false };
|
813 | }, 'values');
|
814 |
|
815 |
|
816 | addToUnscopables('keys');
|
817 | addToUnscopables('values');
|
818 | addToUnscopables('entries');
|
819 |
|
820 | function doTsCheck(tsPath, filePaths) {
|
821 |
|
822 | const ts = require(tsPath);
|
823 |
|
824 | const configPaths = lodash.groupBy(filePaths, filePath => ts.findConfigFile(filePath, ts.sys.fileExists));
|
825 | const filesWithoutProject = configPaths.undefined || [];
|
826 | const filesNotIncludedInProject = [];
|
827 | const diagnostics = [];
|
828 | Object.entries(configPaths).forEach(([configPath, files]) => {
|
829 | const program = createTsProgram(ts, configPath);
|
830 | files.forEach(f => {
|
831 | if (!program.getSourceFile(f)) {
|
832 | filesNotIncludedInProject.push(f);
|
833 | }
|
834 | });
|
835 | diagnostics.push(...ts.getPreEmitDiagnostics(program));
|
836 | });
|
837 | return {
|
838 | filesWithoutProject,
|
839 | filesNotIncludedInProject,
|
840 | errors: diagnostics.map(d => ({
|
841 | filename: d.file ? d.file.fileName : 'Other TypeScript errors',
|
842 | message: typeof d.messageText === 'string' ? d.messageText : d.messageText.messageText
|
843 | }))
|
844 | };
|
845 | }
|
846 |
|
847 |
|
848 |
|
849 | function createTsProgram(ts, configPath) {
|
850 | const config = ts.readConfigFile(configPath, ts.sys.readFile);
|
851 |
|
852 | if (config.error !== undefined) {
|
853 | throw ts.formatDiagnostics([config.error], {
|
854 | getCanonicalFileName: f => f,
|
855 | getCurrentDirectory: process.cwd,
|
856 | getNewLine: () => '\n'
|
857 | });
|
858 | }
|
859 |
|
860 | const parseConfigHost = {
|
861 | fileExists: fs.existsSync,
|
862 | readDirectory: ts.sys.readDirectory,
|
863 | readFile: file => fs.readFileSync(file, 'utf8'),
|
864 | useCaseSensitiveFileNames: true
|
865 | };
|
866 | const parsed = ts.parseJsonConfigFileContent(config.config, parseConfigHost, path.resolve(path.dirname(configPath)), {
|
867 | noEmit: true
|
868 | });
|
869 |
|
870 | if (parsed.errors !== undefined) {
|
871 |
|
872 | const errors = parsed.errors.filter(d => d.category === ts.DiagnosticCategory.Error && d.code !== 18003);
|
873 |
|
874 | if (errors.length !== 0) {
|
875 | throw ts.formatDiagnostics(errors, {
|
876 | getCanonicalFileName: f => f,
|
877 | getCurrentDirectory: process.cwd,
|
878 | getNewLine: () => '\n'
|
879 | });
|
880 | }
|
881 | }
|
882 |
|
883 | const host = ts.createCompilerHost(parsed.options, true);
|
884 | const program = ts.createProgram(parsed.fileNames, parsed.options, host);
|
885 | return program;
|
886 | }
|
887 |
|
888 | exports.doTsCheck = doTsCheck;
|