UNPKG

38.6 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, '__esModule', { value: true });
4
5function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
7var eslint = require('eslint');
8var baseConfig = _interopDefault(require('@burst/eslint-config'));
9
10var isPure = false;
11
12// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
13var global = typeof window == 'object' && window && window.Math == Math ? window
14 : typeof self == 'object' && self && self.Math == Math ? self
15 // eslint-disable-next-line no-new-func
16 : Function('return this')();
17
18var fails = function (exec) {
19 try {
20 return !!exec();
21 } catch (error) {
22 return true;
23 }
24};
25
26// Thank's IE8 for his funny defineProperty
27var descriptors = !fails(function () {
28 return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
29});
30
31var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
32var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
33
34// Nashorn ~ JDK8 bug
35var NASHORN_BUG = nativeGetOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
36
37var f = NASHORN_BUG ? function propertyIsEnumerable(V) {
38 var descriptor = nativeGetOwnPropertyDescriptor(this, V);
39 return !!descriptor && descriptor.enumerable;
40} : nativePropertyIsEnumerable;
41
42var objectPropertyIsEnumerable = {
43 f: f
44};
45
46var createPropertyDescriptor = function (bitmap, value) {
47 return {
48 enumerable: !(bitmap & 1),
49 configurable: !(bitmap & 2),
50 writable: !(bitmap & 4),
51 value: value
52 };
53};
54
55var toString = {}.toString;
56
57var classofRaw = function (it) {
58 return toString.call(it).slice(8, -1);
59};
60
61// fallback for non-array-like ES3 and non-enumerable old V8 strings
62
63
64var split = ''.split;
65
66var indexedObject = fails(function () {
67 // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
68 // eslint-disable-next-line no-prototype-builtins
69 return !Object('z').propertyIsEnumerable(0);
70}) ? function (it) {
71 return classofRaw(it) == 'String' ? split.call(it, '') : Object(it);
72} : Object;
73
74// `RequireObjectCoercible` abstract operation
75// https://tc39.github.io/ecma262/#sec-requireobjectcoercible
76var requireObjectCoercible = function (it) {
77 if (it == undefined) throw TypeError("Can't call method on " + it);
78 return it;
79};
80
81// toObject with fallback for non-array-like ES3 strings
82
83
84
85var toIndexedObject = function (it) {
86 return indexedObject(requireObjectCoercible(it));
87};
88
89var isObject = function (it) {
90 return typeof it === 'object' ? it !== null : typeof it === 'function';
91};
92
93// 7.1.1 ToPrimitive(input [, PreferredType])
94
95// instead of the ES6 spec version, we didn't implement @@toPrimitive case
96// and the second argument - flag - preferred type is a string
97var 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
106var hasOwnProperty = {}.hasOwnProperty;
107
108var has = function (it, key) {
109 return hasOwnProperty.call(it, key);
110};
111
112var document$1 = global.document;
113// typeof document.createElement is 'object' in old IE
114var exist = isObject(document$1) && isObject(document$1.createElement);
115
116var documentCreateElement = function (it) {
117 return exist ? document$1.createElement(it) : {};
118};
119
120// Thank's IE8 for his funny defineProperty
121var ie8DomDefine = !descriptors && !fails(function () {
122 return Object.defineProperty(documentCreateElement('div'), 'a', {
123 get: function () { return 7; }
124 }).a != 7;
125});
126
127var nativeGetOwnPropertyDescriptor$1 = Object.getOwnPropertyDescriptor;
128
129var f$1 = descriptors ? nativeGetOwnPropertyDescriptor$1 : function getOwnPropertyDescriptor(O, P) {
130 O = toIndexedObject(O);
131 P = toPrimitive(P, true);
132 if (ie8DomDefine) try {
133 return nativeGetOwnPropertyDescriptor$1(O, P);
134 } catch (error) { /* empty */ }
135 if (has(O, P)) return createPropertyDescriptor(!objectPropertyIsEnumerable.f.call(O, P), O[P]);
136};
137
138var objectGetOwnPropertyDescriptor = {
139 f: f$1
140};
141
142var anObject = function (it) {
143 if (!isObject(it)) {
144 throw TypeError(String(it) + ' is not an object');
145 } return it;
146};
147
148var nativeDefineProperty = Object.defineProperty;
149
150var f$2 = descriptors ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
151 anObject(O);
152 P = toPrimitive(P, true);
153 anObject(Attributes);
154 if (ie8DomDefine) try {
155 return nativeDefineProperty(O, P, Attributes);
156 } catch (error) { /* empty */ }
157 if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
158 if ('value' in Attributes) O[P] = Attributes.value;
159 return O;
160};
161
162var objectDefineProperty = {
163 f: f$2
164};
165
166var hide = descriptors ? function (object, key, value) {
167 return objectDefineProperty.f(object, key, createPropertyDescriptor(1, value));
168} : function (object, key, value) {
169 object[key] = value;
170 return object;
171};
172
173function createCommonjsModule(fn, module) {
174 return module = { exports: {} }, fn(module, module.exports), module.exports;
175}
176
177var setGlobal = function (key, value) {
178 try {
179 hide(global, key, value);
180 } catch (error) {
181 global[key] = value;
182 } return value;
183};
184
185var shared = createCommonjsModule(function (module) {
186var SHARED = '__core-js_shared__';
187var store = global[SHARED] || setGlobal(SHARED, {});
188
189(module.exports = function (key, value) {
190 return store[key] || (store[key] = value !== undefined ? value : {});
191})('versions', []).push({
192 version: '3.0.1',
193 mode: 'global',
194 copyright: '© 2019 Denis Pushkarev (zloirock.ru)'
195});
196});
197
198var functionToString = shared('native-function-to-string', Function.toString);
199
200var WeakMap = global.WeakMap;
201
202var nativeWeakMap = typeof WeakMap === 'function' && /native code/.test(functionToString.call(WeakMap));
203
204var id = 0;
205var postfix = Math.random();
206
207var uid = function (key) {
208 return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + postfix).toString(36));
209};
210
211var shared$1 = shared('keys');
212
213
214var sharedKey = function (key) {
215 return shared$1[key] || (shared$1[key] = uid(key));
216};
217
218var hiddenKeys = {};
219
220var WeakMap$1 = global.WeakMap;
221var set, get, has$1;
222
223var enforce = function (it) {
224 return has$1(it) ? get(it) : set(it, {});
225};
226
227var getterFor = function (TYPE) {
228 return function (it) {
229 var state;
230 if (!isObject(it) || (state = get(it)).type !== TYPE) {
231 throw TypeError('Incompatible receiver, ' + TYPE + ' required');
232 } return state;
233 };
234};
235
236if (nativeWeakMap) {
237 var store = new WeakMap$1();
238 var wmget = store.get;
239 var wmhas = store.has;
240 var wmset = store.set;
241 set = function (it, metadata) {
242 wmset.call(store, it, metadata);
243 return metadata;
244 };
245 get = function (it) {
246 return wmget.call(store, it) || {};
247 };
248 has$1 = function (it) {
249 return wmhas.call(store, it);
250 };
251} else {
252 var STATE = sharedKey('state');
253 hiddenKeys[STATE] = true;
254 set = function (it, metadata) {
255 hide(it, STATE, metadata);
256 return metadata;
257 };
258 get = function (it) {
259 return has(it, STATE) ? it[STATE] : {};
260 };
261 has$1 = function (it) {
262 return has(it, STATE);
263 };
264}
265
266var internalState = {
267 set: set,
268 get: get,
269 has: has$1,
270 enforce: enforce,
271 getterFor: getterFor
272};
273
274var redefine = createCommonjsModule(function (module) {
275var getInternalState = internalState.get;
276var enforceInternalState = internalState.enforce;
277var TEMPLATE = String(functionToString).split('toString');
278
279shared('inspectSource', function (it) {
280 return functionToString.call(it);
281});
282
283(module.exports = function (O, key, value, options) {
284 var unsafe = options ? !!options.unsafe : false;
285 var simple = options ? !!options.enumerable : false;
286 var noTargetGet = options ? !!options.noTargetGet : false;
287 if (typeof value == 'function') {
288 if (typeof key == 'string' && !has(value, 'name')) hide(value, 'name', key);
289 enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
290 }
291 if (O === global) {
292 if (simple) O[key] = value;
293 else setGlobal(key, value);
294 return;
295 } else if (!unsafe) {
296 delete O[key];
297 } else if (!noTargetGet && O[key]) {
298 simple = true;
299 }
300 if (simple) O[key] = value;
301 else hide(O, key, value);
302// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
303})(Function.prototype, 'toString', function toString() {
304 return typeof this == 'function' && getInternalState(this).source || functionToString.call(this);
305});
306});
307
308var ceil = Math.ceil;
309var floor = Math.floor;
310
311// `ToInteger` abstract operation
312// https://tc39.github.io/ecma262/#sec-tointeger
313var toInteger = function (argument) {
314 return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
315};
316
317var min = Math.min;
318
319// `ToLength` abstract operation
320// https://tc39.github.io/ecma262/#sec-tolength
321var toLength = function (argument) {
322 return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
323};
324
325var max = Math.max;
326var min$1 = Math.min;
327
328// Helper for a popular repeating case of the spec:
329// Let integer be ? ToInteger(index).
330// If integer < 0, let result be max((length + integer), 0); else let result be min(length, length).
331var toAbsoluteIndex = function (index, length) {
332 var integer = toInteger(index);
333 return integer < 0 ? max(integer + length, 0) : min$1(integer, length);
334};
335
336// `Array.prototype.{ indexOf, includes }` methods implementation
337// false -> Array#indexOf
338// https://tc39.github.io/ecma262/#sec-array.prototype.indexof
339// true -> Array#includes
340// https://tc39.github.io/ecma262/#sec-array.prototype.includes
341var arrayIncludes = function (IS_INCLUDES) {
342 return function ($this, el, fromIndex) {
343 var O = toIndexedObject($this);
344 var length = toLength(O.length);
345 var index = toAbsoluteIndex(fromIndex, length);
346 var value;
347 // Array#includes uses SameValueZero equality algorithm
348 // eslint-disable-next-line no-self-compare
349 if (IS_INCLUDES && el != el) while (length > index) {
350 value = O[index++];
351 // eslint-disable-next-line no-self-compare
352 if (value != value) return true;
353 // Array#indexOf ignores holes, Array#includes - not
354 } else for (;length > index; index++) if (IS_INCLUDES || index in O) {
355 if (O[index] === el) return IS_INCLUDES || index || 0;
356 } return !IS_INCLUDES && -1;
357 };
358};
359
360var arrayIndexOf = arrayIncludes(false);
361
362
363var objectKeysInternal = function (object, names) {
364 var O = toIndexedObject(object);
365 var i = 0;
366 var result = [];
367 var key;
368 for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
369 // Don't enum bug & hidden keys
370 while (names.length > i) if (has(O, key = names[i++])) {
371 ~arrayIndexOf(result, key) || result.push(key);
372 }
373 return result;
374};
375
376// IE8- don't enum bug keys
377var enumBugKeys = [
378 'constructor',
379 'hasOwnProperty',
380 'isPrototypeOf',
381 'propertyIsEnumerable',
382 'toLocaleString',
383 'toString',
384 'valueOf'
385];
386
387// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
388
389var hiddenKeys$1 = enumBugKeys.concat('length', 'prototype');
390
391var f$3 = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
392 return objectKeysInternal(O, hiddenKeys$1);
393};
394
395var objectGetOwnPropertyNames = {
396 f: f$3
397};
398
399var f$4 = Object.getOwnPropertySymbols;
400
401var objectGetOwnPropertySymbols = {
402 f: f$4
403};
404
405var Reflect = global.Reflect;
406
407// all object keys, includes non-enumerable and symbols
408var ownKeys = Reflect && Reflect.ownKeys || function ownKeys(it) {
409 var keys = objectGetOwnPropertyNames.f(anObject(it));
410 var getOwnPropertySymbols = objectGetOwnPropertySymbols.f;
411 return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
412};
413
414var copyConstructorProperties = function (target, source) {
415 var keys = ownKeys(source);
416 var defineProperty = objectDefineProperty.f;
417 var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
418 for (var i = 0; i < keys.length; i++) {
419 var key = keys[i];
420 if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
421 }
422};
423
424var replacement = /#|\.prototype\./;
425
426var isForced = function (feature, detection) {
427 var value = data[normalize(feature)];
428 return value == POLYFILL ? true
429 : value == NATIVE ? false
430 : typeof detection == 'function' ? fails(detection)
431 : !!detection;
432};
433
434var normalize = isForced.normalize = function (string) {
435 return String(string).replace(replacement, '.').toLowerCase();
436};
437
438var data = isForced.data = {};
439var NATIVE = isForced.NATIVE = 'N';
440var POLYFILL = isForced.POLYFILL = 'P';
441
442var isForced_1 = isForced;
443
444var getOwnPropertyDescriptor = objectGetOwnPropertyDescriptor.f;
445
446
447
448
449
450
451/*
452 options.target - name of the target object
453 options.global - target is the global object
454 options.stat - export as static methods of target
455 options.proto - export as prototype methods of target
456 options.real - real prototype method for the `pure` version
457 options.forced - export even if the native feature is available
458 options.bind - bind methods to the target, required for the `pure` version
459 options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
460 options.unsafe - use the simple assignment of property instead of delete + defineProperty
461 options.sham - add a flag to not completely full polyfills
462 options.enumerable - export as enumerable property
463 options.noTargetGet - prevent calling a getter on target
464*/
465var _export = function (options, source) {
466 var TARGET = options.target;
467 var GLOBAL = options.global;
468 var STATIC = options.stat;
469 var FORCED, target, key, targetProperty, sourceProperty, descriptor;
470 if (GLOBAL) {
471 target = global;
472 } else if (STATIC) {
473 target = global[TARGET] || setGlobal(TARGET, {});
474 } else {
475 target = (global[TARGET] || {}).prototype;
476 }
477 if (target) for (key in source) {
478 sourceProperty = source[key];
479 if (options.noTargetGet) {
480 descriptor = getOwnPropertyDescriptor(target, key);
481 targetProperty = descriptor && descriptor.value;
482 } else targetProperty = target[key];
483 FORCED = isForced_1(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
484 // contained in target
485 if (!FORCED && targetProperty !== undefined) {
486 if (typeof sourceProperty === typeof targetProperty) continue;
487 copyConstructorProperties(sourceProperty, targetProperty);
488 }
489 // add a flag to not completely full polyfills
490 if (options.sham || (targetProperty && targetProperty.sham)) {
491 hide(sourceProperty, 'sham', true);
492 }
493 // extend global
494 redefine(target, key, sourceProperty, options);
495 }
496};
497
498var aFunction = function (it) {
499 if (typeof it != 'function') {
500 throw TypeError(String(it) + ' is not a function');
501 } return it;
502};
503
504var anInstance = function (it, Constructor, name) {
505 if (!(it instanceof Constructor)) {
506 throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation');
507 } return it;
508};
509
510var iterators = {};
511
512// Chrome 38 Symbol has incorrect toString conversion
513var nativeSymbol = !fails(function () {
514 // eslint-disable-next-line no-undef
515 return !String(Symbol());
516});
517
518var store$1 = shared('wks');
519
520var Symbol$1 = global.Symbol;
521
522
523var wellKnownSymbol = function (name) {
524 return store$1[name] || (store$1[name] = nativeSymbol && Symbol$1[name]
525 || (nativeSymbol ? Symbol$1 : uid)('Symbol.' + name));
526};
527
528// check on default Array iterator
529
530var ITERATOR = wellKnownSymbol('iterator');
531var ArrayPrototype = Array.prototype;
532
533var isArrayIteratorMethod = function (it) {
534 return it !== undefined && (iterators.Array === it || ArrayPrototype[ITERATOR] === it);
535};
536
537// optional / simple context binding
538var bindContext = function (fn, that, length) {
539 aFunction(fn);
540 if (that === undefined) return fn;
541 switch (length) {
542 case 0: return function () {
543 return fn.call(that);
544 };
545 case 1: return function (a) {
546 return fn.call(that, a);
547 };
548 case 2: return function (a, b) {
549 return fn.call(that, a, b);
550 };
551 case 3: return function (a, b, c) {
552 return fn.call(that, a, b, c);
553 };
554 }
555 return function (/* ...args */) {
556 return fn.apply(that, arguments);
557 };
558};
559
560var TO_STRING_TAG = wellKnownSymbol('toStringTag');
561// ES3 wrong here
562var CORRECT_ARGUMENTS = classofRaw(function () { return arguments; }()) == 'Arguments';
563
564// fallback for IE11 Script Access Denied error
565var tryGet = function (it, key) {
566 try {
567 return it[key];
568 } catch (error) { /* empty */ }
569};
570
571// getting tag from ES6+ `Object.prototype.toString`
572var classof = function (it) {
573 var O, tag, result;
574 return it === undefined ? 'Undefined' : it === null ? 'Null'
575 // @@toStringTag case
576 : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag
577 // builtinTag case
578 : CORRECT_ARGUMENTS ? classofRaw(O)
579 // ES3 arguments fallback
580 : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result;
581};
582
583var ITERATOR$1 = wellKnownSymbol('iterator');
584
585
586var getIteratorMethod = function (it) {
587 if (it != undefined) return it[ITERATOR$1]
588 || it['@@iterator']
589 || iterators[classof(it)];
590};
591
592// call something on iterator step with safe closing on error
593var callWithSafeIterationClosing = function (iterator, fn, value, ENTRIES) {
594 try {
595 return ENTRIES ? fn(anObject(value)[0], value[1]) : fn(value);
596 // 7.4.6 IteratorClose(iterator, completion)
597 } catch (error) {
598 var returnMethod = iterator['return'];
599 if (returnMethod !== undefined) anObject(returnMethod.call(iterator));
600 throw error;
601 }
602};
603
604var iterate = createCommonjsModule(function (module) {
605var BREAK = {};
606
607var exports = module.exports = function (iterable, fn, that, ENTRIES, ITERATOR) {
608 var boundFunction = bindContext(fn, that, ENTRIES ? 2 : 1);
609 var iterator, iterFn, index, length, result, step;
610
611 if (ITERATOR) {
612 iterator = iterable;
613 } else {
614 iterFn = getIteratorMethod(iterable);
615 if (typeof iterFn != 'function') throw TypeError('Target is not iterable');
616 // optimisation for array iterators
617 if (isArrayIteratorMethod(iterFn)) {
618 for (index = 0, length = toLength(iterable.length); length > index; index++) {
619 result = ENTRIES ? boundFunction(anObject(step = iterable[index])[0], step[1]) : boundFunction(iterable[index]);
620 if (result === BREAK) return BREAK;
621 } return;
622 }
623 iterator = iterFn.call(iterable);
624 }
625
626 while (!(step = iterator.next()).done) {
627 if (callWithSafeIterationClosing(iterator, boundFunction, step.value, ENTRIES) === BREAK) return BREAK;
628 }
629};
630
631exports.BREAK = BREAK;
632});
633
634var ITERATOR$2 = wellKnownSymbol('iterator');
635var SAFE_CLOSING = false;
636
637try {
638 var called = 0;
639 var iteratorWithReturn = {
640 next: function () {
641 return { done: !!called++ };
642 },
643 'return': function () {
644 SAFE_CLOSING = true;
645 }
646 };
647 iteratorWithReturn[ITERATOR$2] = function () {
648 return this;
649 };
650} catch (error) { /* empty */ }
651
652var checkCorrectnessOfIteration = function (exec, SKIP_CLOSING) {
653 if (!SKIP_CLOSING && !SAFE_CLOSING) return false;
654 var ITERATION_SUPPORT = false;
655 try {
656 var object = {};
657 object[ITERATOR$2] = function () {
658 return {
659 next: function () {
660 return { done: ITERATION_SUPPORT = true };
661 }
662 };
663 };
664 exec(object);
665 } catch (error) { /* empty */ }
666 return ITERATION_SUPPORT;
667};
668
669var SPECIES = wellKnownSymbol('species');
670
671// `SpeciesConstructor` abstract operation
672// https://tc39.github.io/ecma262/#sec-speciesconstructor
673var speciesConstructor = function (O, defaultConstructor) {
674 var C = anObject(O).constructor;
675 var S;
676 return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aFunction(S);
677};
678
679var document$2 = global.document;
680
681var html = document$2 && document$2.documentElement;
682
683var set$1 = global.setImmediate;
684var clear = global.clearImmediate;
685var process = global.process;
686var MessageChannel = global.MessageChannel;
687var Dispatch = global.Dispatch;
688var counter = 0;
689var queue = {};
690var ONREADYSTATECHANGE = 'onreadystatechange';
691var defer, channel, port;
692
693var run = function () {
694 var id = +this;
695 // eslint-disable-next-line no-prototype-builtins
696 if (queue.hasOwnProperty(id)) {
697 var fn = queue[id];
698 delete queue[id];
699 fn();
700 }
701};
702
703var listener = function (event) {
704 run.call(event.data);
705};
706
707// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
708if (!set$1 || !clear) {
709 set$1 = function setImmediate(fn) {
710 var args = [];
711 var i = 1;
712 while (arguments.length > i) args.push(arguments[i++]);
713 queue[++counter] = function () {
714 // eslint-disable-next-line no-new-func
715 (typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args);
716 };
717 defer(counter);
718 return counter;
719 };
720 clear = function clearImmediate(id) {
721 delete queue[id];
722 };
723 // Node.js 0.8-
724 if (classofRaw(process) == 'process') {
725 defer = function (id) {
726 process.nextTick(bindContext(run, id, 1));
727 };
728 // Sphere (JS game engine) Dispatch API
729 } else if (Dispatch && Dispatch.now) {
730 defer = function (id) {
731 Dispatch.now(bindContext(run, id, 1));
732 };
733 // Browsers with MessageChannel, includes WebWorkers
734 } else if (MessageChannel) {
735 channel = new MessageChannel();
736 port = channel.port2;
737 channel.port1.onmessage = listener;
738 defer = bindContext(port.postMessage, port, 1);
739 // Browsers with postMessage, skip WebWorkers
740 // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
741 } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {
742 defer = function (id) {
743 global.postMessage(id + '', '*');
744 };
745 global.addEventListener('message', listener, false);
746 // IE8-
747 } else if (ONREADYSTATECHANGE in documentCreateElement('script')) {
748 defer = function (id) {
749 html.appendChild(documentCreateElement('script'))[ONREADYSTATECHANGE] = function () {
750 html.removeChild(this);
751 run.call(id);
752 };
753 };
754 // Rest old browsers
755 } else {
756 defer = function (id) {
757 setTimeout(bindContext(run, id, 1), 0);
758 };
759 }
760}
761
762var task = {
763 set: set$1,
764 clear: clear
765};
766
767var navigator = global.navigator;
768
769var userAgent = navigator && navigator.userAgent || '';
770
771var getOwnPropertyDescriptor$1 = objectGetOwnPropertyDescriptor.f;
772
773var macrotask = task.set;
774
775var MutationObserver = global.MutationObserver || global.WebKitMutationObserver;
776var process$1 = global.process;
777var Promise = global.Promise;
778var IS_NODE = classofRaw(process$1) == 'process';
779// Node.js 11 shows ExperimentalWarning on getting `queueMicrotask`
780var queueMicrotaskDescriptor = getOwnPropertyDescriptor$1(global, 'queueMicrotask');
781var queueMicrotask = queueMicrotaskDescriptor && queueMicrotaskDescriptor.value;
782
783var flush, head, last, notify, toggle, node, promise;
784
785// modern engines have queueMicrotask method
786if (!queueMicrotask) {
787 flush = function () {
788 var parent, fn;
789 if (IS_NODE && (parent = process$1.domain)) parent.exit();
790 while (head) {
791 fn = head.fn;
792 head = head.next;
793 try {
794 fn();
795 } catch (error) {
796 if (head) notify();
797 else last = undefined;
798 throw error;
799 }
800 } last = undefined;
801 if (parent) parent.enter();
802 };
803
804 // Node.js
805 if (IS_NODE) {
806 notify = function () {
807 process$1.nextTick(flush);
808 };
809 // browsers with MutationObserver, except iOS - https://github.com/zloirock/core-js/issues/339
810 } else if (MutationObserver && !/(iPhone|iPod|iPad).*AppleWebKit/i.test(userAgent)) {
811 toggle = true;
812 node = document.createTextNode('');
813 new MutationObserver(flush).observe(node, { characterData: true }); // eslint-disable-line no-new
814 notify = function () {
815 node.data = toggle = !toggle;
816 };
817 // environments with maybe non-completely correct, but existent Promise
818 } else if (Promise && Promise.resolve) {
819 // Promise.resolve without an argument throws an error in LG WebOS 2
820 promise = Promise.resolve(undefined);
821 notify = function () {
822 promise.then(flush);
823 };
824 // for other environments - macrotask based on:
825 // - setImmediate
826 // - MessageChannel
827 // - window.postMessag
828 // - onreadystatechange
829 // - setTimeout
830 } else {
831 notify = function () {
832 // strange IE + webpack dev server bug - use .call(global)
833 macrotask.call(global, flush);
834 };
835 }
836}
837
838var microtask = queueMicrotask || function (fn) {
839 var task = { fn: fn, next: undefined };
840 if (last) last.next = task;
841 if (!head) {
842 head = task;
843 notify();
844 } last = task;
845};
846
847// 25.4.1.5 NewPromiseCapability(C)
848
849
850var PromiseCapability = function (C) {
851 var resolve, reject;
852 this.promise = new C(function ($$resolve, $$reject) {
853 if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
854 resolve = $$resolve;
855 reject = $$reject;
856 });
857 this.resolve = aFunction(resolve);
858 this.reject = aFunction(reject);
859};
860
861var f$5 = function (C) {
862 return new PromiseCapability(C);
863};
864
865var newPromiseCapability = {
866 f: f$5
867};
868
869var promiseResolve = function (C, x) {
870 anObject(C);
871 if (isObject(x) && x.constructor === C) return x;
872 var promiseCapability = newPromiseCapability.f(C);
873 var resolve = promiseCapability.resolve;
874 resolve(x);
875 return promiseCapability.promise;
876};
877
878var hostReportErrors = function (a, b) {
879 var console = global.console;
880 if (console && console.error) {
881 arguments.length === 1 ? console.error(a) : console.error(a, b);
882 }
883};
884
885var perform = function (exec) {
886 try {
887 return { error: false, value: exec() };
888 } catch (error) {
889 return { error: true, value: error };
890 }
891};
892
893var redefineAll = function (target, src, options) {
894 for (var key in src) redefine(target, key, src[key], options);
895 return target;
896};
897
898var defineProperty = objectDefineProperty.f;
899
900var TO_STRING_TAG$1 = wellKnownSymbol('toStringTag');
901
902var setToStringTag = function (it, TAG, STATIC) {
903 if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG$1)) {
904 defineProperty(it, TO_STRING_TAG$1, { configurable: true, value: TAG });
905 }
906};
907
908var path = global;
909
910var aFunction$1 = function (variable) {
911 return typeof variable == 'function' ? variable : undefined;
912};
913
914var getBuiltIn = function (namespace, method) {
915 return arguments.length < 2 ? aFunction$1(path[namespace]) || aFunction$1(global[namespace])
916 : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];
917};
918
919var SPECIES$1 = wellKnownSymbol('species');
920
921var setSpecies = function (CONSTRUCTOR_NAME) {
922 var C = getBuiltIn(CONSTRUCTOR_NAME);
923 var defineProperty = objectDefineProperty.f;
924 if (descriptors && C && !C[SPECIES$1]) defineProperty(C, SPECIES$1, {
925 configurable: true,
926 get: function () { return this; }
927 });
928};
929
930var PROMISE = 'Promise';
931
932
933
934
935
936
937
938
939
940
941var task$1 = task.set;
942
943
944
945
946
947
948var SPECIES$2 = wellKnownSymbol('species');
949
950
951var getInternalState = internalState.get;
952var setInternalState = internalState.set;
953var getInternalPromiseState = internalState.getterFor(PROMISE);
954var PromiseConstructor = global[PROMISE];
955var TypeError$1 = global.TypeError;
956var document$3 = global.document;
957var process$2 = global.process;
958var $fetch = global.fetch;
959var versions = process$2 && process$2.versions;
960var v8 = versions && versions.v8 || '';
961var newPromiseCapability$1 = newPromiseCapability.f;
962var newGenericPromiseCapability = newPromiseCapability$1;
963var IS_NODE$1 = classofRaw(process$2) == 'process';
964var DISPATCH_EVENT = !!(document$3 && document$3.createEvent && global.dispatchEvent);
965var UNHANDLED_REJECTION = 'unhandledrejection';
966var REJECTION_HANDLED = 'rejectionhandled';
967var PENDING = 0;
968var FULFILLED = 1;
969var REJECTED = 2;
970var HANDLED = 1;
971var UNHANDLED = 2;
972var Internal, OwnPromiseCapability, PromiseWrapper;
973
974var FORCED = isForced_1(PROMISE, function () {
975 // correct subclassing with @@species support
976 var promise = PromiseConstructor.resolve(1);
977 var empty = function () { /* empty */ };
978 var FakePromise = (promise.constructor = {})[SPECIES$2] = function (exec) {
979 exec(empty, empty);
980 };
981 // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
982 return !((IS_NODE$1 || typeof PromiseRejectionEvent == 'function')
983 && (!isPure || promise['finally'])
984 && promise.then(empty) instanceof FakePromise
985 // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
986 // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
987 // we can't detect it synchronously, so just check versions
988 && v8.indexOf('6.6') !== 0
989 && userAgent.indexOf('Chrome/66') === -1);
990});
991
992var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (iterable) {
993 PromiseConstructor.all(iterable)['catch'](function () { /* empty */ });
994});
995
996// helpers
997var isThenable = function (it) {
998 var then;
999 return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
1000};
1001
1002var notify$1 = function (promise, state, isReject) {
1003 if (state.notified) return;
1004 state.notified = true;
1005 var chain = state.reactions;
1006 microtask(function () {
1007 var value = state.value;
1008 var ok = state.state == FULFILLED;
1009 var i = 0;
1010 var run = function (reaction) {
1011 var handler = ok ? reaction.ok : reaction.fail;
1012 var resolve = reaction.resolve;
1013 var reject = reaction.reject;
1014 var domain = reaction.domain;
1015 var result, then, exited;
1016 try {
1017 if (handler) {
1018 if (!ok) {
1019 if (state.rejection === UNHANDLED) onHandleUnhandled(promise, state);
1020 state.rejection = HANDLED;
1021 }
1022 if (handler === true) result = value;
1023 else {
1024 if (domain) domain.enter();
1025 result = handler(value); // may throw
1026 if (domain) {
1027 domain.exit();
1028 exited = true;
1029 }
1030 }
1031 if (result === reaction.promise) {
1032 reject(TypeError$1('Promise-chain cycle'));
1033 } else if (then = isThenable(result)) {
1034 then.call(result, resolve, reject);
1035 } else resolve(result);
1036 } else reject(value);
1037 } catch (error) {
1038 if (domain && !exited) domain.exit();
1039 reject(error);
1040 }
1041 };
1042 while (chain.length > i) run(chain[i++]); // variable length - can't use forEach
1043 state.reactions = [];
1044 state.notified = false;
1045 if (isReject && !state.rejection) onUnhandled(promise, state);
1046 });
1047};
1048
1049var dispatchEvent = function (name, promise, reason) {
1050 var event, handler;
1051 if (DISPATCH_EVENT) {
1052 event = document$3.createEvent('Event');
1053 event.promise = promise;
1054 event.reason = reason;
1055 event.initEvent(name, false, true);
1056 global.dispatchEvent(event);
1057 } else event = { promise: promise, reason: reason };
1058 if (handler = global['on' + name]) handler(event);
1059 else if (name === UNHANDLED_REJECTION) hostReportErrors('Unhandled promise rejection', reason);
1060};
1061
1062var onUnhandled = function (promise, state) {
1063 task$1.call(global, function () {
1064 var value = state.value;
1065 var IS_UNHANDLED = isUnhandled(state);
1066 var result;
1067 if (IS_UNHANDLED) {
1068 result = perform(function () {
1069 if (IS_NODE$1) {
1070 process$2.emit('unhandledRejection', value, promise);
1071 } else dispatchEvent(UNHANDLED_REJECTION, promise, value);
1072 });
1073 // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
1074 state.rejection = IS_NODE$1 || isUnhandled(state) ? UNHANDLED : HANDLED;
1075 if (result.error) throw result.value;
1076 }
1077 });
1078};
1079
1080var isUnhandled = function (state) {
1081 return state.rejection !== HANDLED && !state.parent;
1082};
1083
1084var onHandleUnhandled = function (promise, state) {
1085 task$1.call(global, function () {
1086 if (IS_NODE$1) {
1087 process$2.emit('rejectionHandled', promise);
1088 } else dispatchEvent(REJECTION_HANDLED, promise, state.value);
1089 });
1090};
1091
1092var bind = function (fn, promise, state, unwrap) {
1093 return function (value) {
1094 fn(promise, state, value, unwrap);
1095 };
1096};
1097
1098var internalReject = function (promise, state, value, unwrap) {
1099 if (state.done) return;
1100 state.done = true;
1101 if (unwrap) state = unwrap;
1102 state.value = value;
1103 state.state = REJECTED;
1104 notify$1(promise, state, true);
1105};
1106
1107var internalResolve = function (promise, state, value, unwrap) {
1108 if (state.done) return;
1109 state.done = true;
1110 if (unwrap) state = unwrap;
1111 try {
1112 if (promise === value) throw TypeError$1("Promise can't be resolved itself");
1113 var then = isThenable(value);
1114 if (then) {
1115 microtask(function () {
1116 var wrapper = { done: false };
1117 try {
1118 then.call(value,
1119 bind(internalResolve, promise, wrapper, state),
1120 bind(internalReject, promise, wrapper, state)
1121 );
1122 } catch (error) {
1123 internalReject(promise, wrapper, error, state);
1124 }
1125 });
1126 } else {
1127 state.value = value;
1128 state.state = FULFILLED;
1129 notify$1(promise, state, false);
1130 }
1131 } catch (error) {
1132 internalReject(promise, { done: false }, error, state);
1133 }
1134};
1135
1136// constructor polyfill
1137if (FORCED) {
1138 // 25.4.3.1 Promise(executor)
1139 PromiseConstructor = function Promise(executor) {
1140 anInstance(this, PromiseConstructor, PROMISE);
1141 aFunction(executor);
1142 Internal.call(this);
1143 var state = getInternalState(this);
1144 try {
1145 executor(bind(internalResolve, this, state), bind(internalReject, this, state));
1146 } catch (error) {
1147 internalReject(this, state, error);
1148 }
1149 };
1150 // eslint-disable-next-line no-unused-vars
1151 Internal = function Promise(executor) {
1152 setInternalState(this, {
1153 type: PROMISE,
1154 done: false,
1155 notified: false,
1156 parent: false,
1157 reactions: [],
1158 rejection: false,
1159 state: PENDING,
1160 value: undefined
1161 });
1162 };
1163 Internal.prototype = redefineAll(PromiseConstructor.prototype, {
1164 // `Promise.prototype.then` method
1165 // https://tc39.github.io/ecma262/#sec-promise.prototype.then
1166 then: function then(onFulfilled, onRejected) {
1167 var state = getInternalPromiseState(this);
1168 var reaction = newPromiseCapability$1(speciesConstructor(this, PromiseConstructor));
1169 reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
1170 reaction.fail = typeof onRejected == 'function' && onRejected;
1171 reaction.domain = IS_NODE$1 ? process$2.domain : undefined;
1172 state.parent = true;
1173 state.reactions.push(reaction);
1174 if (state.state != PENDING) notify$1(this, state, false);
1175 return reaction.promise;
1176 },
1177 // `Promise.prototype.catch` method
1178 // https://tc39.github.io/ecma262/#sec-promise.prototype.catch
1179 'catch': function (onRejected) {
1180 return this.then(undefined, onRejected);
1181 }
1182 });
1183 OwnPromiseCapability = function () {
1184 var promise = new Internal();
1185 var state = getInternalState(promise);
1186 this.promise = promise;
1187 this.resolve = bind(internalResolve, promise, state);
1188 this.reject = bind(internalReject, promise, state);
1189 };
1190 newPromiseCapability.f = newPromiseCapability$1 = function (C) {
1191 return C === PromiseConstructor || C === PromiseWrapper
1192 ? new OwnPromiseCapability(C)
1193 : newGenericPromiseCapability(C);
1194 };
1195
1196 // wrap fetch result
1197 if (typeof $fetch == 'function') _export({ global: true, enumerable: true, forced: true }, {
1198 // eslint-disable-next-line no-unused-vars
1199 fetch: function fetch(input) {
1200 return promiseResolve(PromiseConstructor, $fetch.apply(global, arguments));
1201 }
1202 });
1203}
1204
1205_export({ global: true, wrap: true, forced: FORCED }, { Promise: PromiseConstructor });
1206
1207setToStringTag(PromiseConstructor, PROMISE, false, true);
1208setSpecies(PROMISE);
1209
1210PromiseWrapper = path[PROMISE];
1211
1212// statics
1213_export({ target: PROMISE, stat: true, forced: FORCED }, {
1214 // `Promise.reject` method
1215 // https://tc39.github.io/ecma262/#sec-promise.reject
1216 reject: function reject(r) {
1217 var capability = newPromiseCapability$1(this);
1218 capability.reject.call(undefined, r);
1219 return capability.promise;
1220 }
1221});
1222
1223_export({ target: PROMISE, stat: true, forced: FORCED }, {
1224 // `Promise.resolve` method
1225 // https://tc39.github.io/ecma262/#sec-promise.resolve
1226 resolve: function resolve(x) {
1227 return promiseResolve(this, x);
1228 }
1229});
1230
1231_export({ target: PROMISE, stat: true, forced: INCORRECT_ITERATION }, {
1232 // `Promise.all` method
1233 // https://tc39.github.io/ecma262/#sec-promise.all
1234 all: function all(iterable) {
1235 var C = this;
1236 var capability = newPromiseCapability$1(C);
1237 var resolve = capability.resolve;
1238 var reject = capability.reject;
1239 var result = perform(function () {
1240 var values = [];
1241 var counter = 0;
1242 var remaining = 1;
1243 iterate(iterable, function (promise) {
1244 var index = counter++;
1245 var alreadyCalled = false;
1246 values.push(undefined);
1247 remaining++;
1248 C.resolve(promise).then(function (value) {
1249 if (alreadyCalled) return;
1250 alreadyCalled = true;
1251 values[index] = value;
1252 --remaining || resolve(values);
1253 }, reject);
1254 });
1255 --remaining || resolve(values);
1256 });
1257 if (result.error) reject(result.value);
1258 return capability.promise;
1259 },
1260 // `Promise.race` method
1261 // https://tc39.github.io/ecma262/#sec-promise.race
1262 race: function race(iterable) {
1263 var C = this;
1264 var capability = newPromiseCapability$1(C);
1265 var reject = capability.reject;
1266 var result = perform(function () {
1267 iterate(iterable, function (promise) {
1268 C.resolve(promise).then(capability.resolve, reject);
1269 });
1270 });
1271 if (result.error) reject(result.value);
1272 return capability.promise;
1273 }
1274});
1275
1276const eslintEngines = {};
1277async function lintFile(path, fix) {
1278 const fixString = fix.toString();
1279
1280 if (!eslintEngines[fixString]) {
1281 eslintEngines[fixString] = new eslint.CLIEngine({
1282 fix,
1283 baseConfig,
1284 useEslintrc: false,
1285 reportUnusedDisableDirectives: true,
1286 ignore: false
1287 });
1288 }
1289
1290 return eslintEngines[fixString].executeOnFiles([path]);
1291}
1292async function writeToDisk(report) {
1293 return eslint.CLIEngine.outputFixes(report);
1294}
1295
1296exports.lintFile = lintFile;
1297exports.writeToDisk = writeToDisk;