From 86d4afdb4b2eb1b6760aea9a3c51a643cc7d88e7 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Wed, 1 Dec 2021 13:44:18 +0100 Subject: [PATCH] commit build of 8.3.0 Signed-off-by: Thomas Lamprecht --- src/lib/eslint.js | 45986 ++++++++++++++++++-------------------------- 1 file changed, 18628 insertions(+), 27358 deletions(-) diff --git a/src/lib/eslint.js b/src/lib/eslint.js index 25c80c7..c85210d 100644 --- a/src/lib/eslint.js +++ b/src/lib/eslint.js @@ -15,66 +15,50 @@ return /******/ (() => { // webpackBootstrap __webpack_require__(1); -__webpack_require__(69); +__webpack_require__(84); -__webpack_require__(70); +__webpack_require__(85); -__webpack_require__(71); +__webpack_require__(86); -__webpack_require__(72); +__webpack_require__(87); -__webpack_require__(73); +__webpack_require__(88); -__webpack_require__(74); +__webpack_require__(89); -__webpack_require__(75); +__webpack_require__(90); -__webpack_require__(76); +__webpack_require__(91); -__webpack_require__(77); +__webpack_require__(92); -__webpack_require__(78); +__webpack_require__(93); -__webpack_require__(79); +__webpack_require__(94); -__webpack_require__(80); - -__webpack_require__(81); - -__webpack_require__(82); - -__webpack_require__(83); +__webpack_require__(95); __webpack_require__(96); -__webpack_require__(99); +__webpack_require__(97); -__webpack_require__(102); +__webpack_require__(98); -__webpack_require__(104); +__webpack_require__(113); -__webpack_require__(106); +__webpack_require__(115); -__webpack_require__(107); - -__webpack_require__(108); - -__webpack_require__(109); - -__webpack_require__(111); - -__webpack_require__(112); - -__webpack_require__(114); - -__webpack_require__(118); +__webpack_require__(117); __webpack_require__(119); -__webpack_require__(120); - __webpack_require__(121); +__webpack_require__(123); + +__webpack_require__(124); + __webpack_require__(125); __webpack_require__(126); @@ -83,11 +67,7 @@ __webpack_require__(128); __webpack_require__(129); -__webpack_require__(130); - -__webpack_require__(133); - -__webpack_require__(134); +__webpack_require__(131); __webpack_require__(135); @@ -95,9 +75,11 @@ __webpack_require__(136); __webpack_require__(137); +__webpack_require__(138); + __webpack_require__(142); -__webpack_require__(144); +__webpack_require__(143); __webpack_require__(145); @@ -105,35 +87,29 @@ __webpack_require__(146); __webpack_require__(147); +__webpack_require__(150); + +__webpack_require__(151); + +__webpack_require__(152); + +__webpack_require__(153); + __webpack_require__(154); -__webpack_require__(156); - -__webpack_require__(158); - __webpack_require__(159); -__webpack_require__(160); - __webpack_require__(161); __webpack_require__(162); __webpack_require__(163); -__webpack_require__(167); - -__webpack_require__(168); - -__webpack_require__(170); +__webpack_require__(164); __webpack_require__(171); -__webpack_require__(172); - -__webpack_require__(174); - -__webpack_require__(175); +__webpack_require__(173); __webpack_require__(176); @@ -143,78 +119,74 @@ __webpack_require__(178); __webpack_require__(179); +__webpack_require__(180); + +__webpack_require__(181); + __webpack_require__(185); -__webpack_require__(187); +__webpack_require__(186); __webpack_require__(188); __webpack_require__(189); -__webpack_require__(191); +__webpack_require__(190); __webpack_require__(192); +__webpack_require__(193); + __webpack_require__(194); __webpack_require__(195); +__webpack_require__(196); + __webpack_require__(197); -__webpack_require__(198); - -__webpack_require__(199); - -__webpack_require__(200); - -__webpack_require__(201); - -__webpack_require__(202); - -__webpack_require__(203); - -__webpack_require__(204); - __webpack_require__(205); -__webpack_require__(206); - __webpack_require__(207); -__webpack_require__(210); +__webpack_require__(208); + +__webpack_require__(209); __webpack_require__(211); -__webpack_require__(213); +__webpack_require__(212); + +__webpack_require__(214); __webpack_require__(215); -__webpack_require__(216); - __webpack_require__(217); __webpack_require__(218); __webpack_require__(219); +__webpack_require__(220); + __webpack_require__(221); +__webpack_require__(222); + __webpack_require__(223); +__webpack_require__(224); + __webpack_require__(225); __webpack_require__(226); -__webpack_require__(228); - -__webpack_require__(229); +__webpack_require__(227); __webpack_require__(231); __webpack_require__(232); -__webpack_require__(233); - __webpack_require__(234); __webpack_require__(236); @@ -227,8 +199,6 @@ __webpack_require__(239); __webpack_require__(240); -__webpack_require__(241); - __webpack_require__(242); __webpack_require__(244); @@ -237,21 +207,17 @@ __webpack_require__(245); __webpack_require__(246); -__webpack_require__(247); - __webpack_require__(248); __webpack_require__(249); -__webpack_require__(250); - __webpack_require__(251); __webpack_require__(252); __webpack_require__(253); -__webpack_require__(255); +__webpack_require__(254); __webpack_require__(256); @@ -259,6 +225,26 @@ __webpack_require__(257); __webpack_require__(258); +__webpack_require__(259); + +__webpack_require__(260); + +__webpack_require__(261); + +__webpack_require__(262); + +__webpack_require__(263); + +__webpack_require__(265); + +__webpack_require__(266); + +__webpack_require__(267); + +__webpack_require__(268); + +__webpack_require__(269); + __webpack_require__(270); __webpack_require__(271); @@ -269,63 +255,53 @@ __webpack_require__(273); __webpack_require__(274); -__webpack_require__(275); - __webpack_require__(276); __webpack_require__(277); +__webpack_require__(278); + __webpack_require__(279); -__webpack_require__(280); +__webpack_require__(291); -__webpack_require__(281); +__webpack_require__(292); -__webpack_require__(282); - -__webpack_require__(283); - -__webpack_require__(284); - -__webpack_require__(285); - -__webpack_require__(286); - -__webpack_require__(287); - -__webpack_require__(288); +__webpack_require__(293); __webpack_require__(294); __webpack_require__(295); +__webpack_require__(296); + __webpack_require__(297); __webpack_require__(298); -__webpack_require__(299); - __webpack_require__(300); __webpack_require__(301); __webpack_require__(302); +__webpack_require__(303); + __webpack_require__(304); +__webpack_require__(305); + +__webpack_require__(306); + __webpack_require__(307); __webpack_require__(308); __webpack_require__(309); -__webpack_require__(310); - -__webpack_require__(314); - __webpack_require__(315); -__webpack_require__(317); +__webpack_require__(316); __webpack_require__(318); @@ -333,34 +309,28 @@ __webpack_require__(319); __webpack_require__(320); +__webpack_require__(321); + __webpack_require__(322); __webpack_require__(323); __webpack_require__(324); -__webpack_require__(325); - __webpack_require__(326); -__webpack_require__(327); - __webpack_require__(329); __webpack_require__(330); __webpack_require__(331); -__webpack_require__(334); - -__webpack_require__(335); +__webpack_require__(332); __webpack_require__(336); __webpack_require__(337); -__webpack_require__(338); - __webpack_require__(339); __webpack_require__(340); @@ -369,22 +339,24 @@ __webpack_require__(341); __webpack_require__(342); -__webpack_require__(343); - __webpack_require__(344); __webpack_require__(345); __webpack_require__(346); +__webpack_require__(347); + +__webpack_require__(348); + +__webpack_require__(349); + +__webpack_require__(351); + __webpack_require__(352); __webpack_require__(353); -__webpack_require__(354); - -__webpack_require__(355); - __webpack_require__(356); __webpack_require__(357); @@ -401,20 +373,16 @@ __webpack_require__(362); __webpack_require__(363); +__webpack_require__(364); + +__webpack_require__(365); + +__webpack_require__(366); + __webpack_require__(367); __webpack_require__(368); -__webpack_require__(369); - -__webpack_require__(370); - -__webpack_require__(371); - -__webpack_require__(372); - -__webpack_require__(373); - __webpack_require__(374); __webpack_require__(375); @@ -441,16 +409,14 @@ __webpack_require__(385); __webpack_require__(386); -__webpack_require__(387); - -__webpack_require__(388); - -__webpack_require__(389); +__webpack_require__(390); __webpack_require__(391); __webpack_require__(392); +__webpack_require__(393); + __webpack_require__(394); __webpack_require__(395); @@ -461,11 +427,53 @@ __webpack_require__(397); __webpack_require__(398); -__webpack_require__(402); +__webpack_require__(399); + +__webpack_require__(400); __webpack_require__(401); -module.exports = __webpack_require__(62); +__webpack_require__(402); + +__webpack_require__(403); + +__webpack_require__(404); + +__webpack_require__(405); + +__webpack_require__(406); + +__webpack_require__(407); + +__webpack_require__(408); + +__webpack_require__(409); + +__webpack_require__(410); + +__webpack_require__(411); + +__webpack_require__(412); + +__webpack_require__(414); + +__webpack_require__(415); + +__webpack_require__(418); + +__webpack_require__(419); + +__webpack_require__(420); + +__webpack_require__(421); + +__webpack_require__(422); + +__webpack_require__(426); + +__webpack_require__(425); + +module.exports = __webpack_require__(77); /***/ }), /* 1 */ @@ -478,75 +486,85 @@ var $ = __webpack_require__(2); var global = __webpack_require__(3); -var getBuiltIn = __webpack_require__(17); +var getBuiltIn = __webpack_require__(20); -var IS_PURE = __webpack_require__(25); +var apply = __webpack_require__(62); + +var call = __webpack_require__(7); + +var uncurryThis = __webpack_require__(12); + +var IS_PURE = __webpack_require__(32); var DESCRIPTORS = __webpack_require__(5); -var NATIVE_SYMBOL = __webpack_require__(19); +var NATIVE_SYMBOL = __webpack_require__(23); var fails = __webpack_require__(6); -var has = __webpack_require__(28); +var hasOwn = __webpack_require__(35); -var isArray = __webpack_require__(53); +var isArray = __webpack_require__(63); -var isObject = __webpack_require__(15); +var isCallable = __webpack_require__(18); -var isSymbol = __webpack_require__(16); +var isObject = __webpack_require__(17); -var anObject = __webpack_require__(35); +var isPrototypeOf = __webpack_require__(21); -var toObject = __webpack_require__(29); +var isSymbol = __webpack_require__(19); -var toIndexedObject = __webpack_require__(9); +var anObject = __webpack_require__(42); -var toPropertyKey = __webpack_require__(13); +var toObject = __webpack_require__(36); -var $toString = __webpack_require__(54); +var toIndexedObject = __webpack_require__(10); -var createPropertyDescriptor = __webpack_require__(8); +var toPropertyKey = __webpack_require__(15); -var nativeObjectCreate = __webpack_require__(55); +var $toString = __webpack_require__(64); -var objectKeys = __webpack_require__(57); +var createPropertyDescriptor = __webpack_require__(9); -var getOwnPropertyNamesModule = __webpack_require__(44); +var nativeObjectCreate = __webpack_require__(67); -var getOwnPropertyNamesExternal = __webpack_require__(59); +var objectKeys = __webpack_require__(69); -var getOwnPropertySymbolsModule = __webpack_require__(51); +var getOwnPropertyNamesModule = __webpack_require__(52); + +var getOwnPropertyNamesExternal = __webpack_require__(71); + +var getOwnPropertySymbolsModule = __webpack_require__(60); var getOwnPropertyDescriptorModule = __webpack_require__(4); -var definePropertyModule = __webpack_require__(34); +var definePropertyModule = __webpack_require__(41); -var propertyIsEnumerableModule = __webpack_require__(7); +var propertyIsEnumerableModule = __webpack_require__(8); -var createNonEnumerableProperty = __webpack_require__(33); +var arraySlice = __webpack_require__(74); -var redefine = __webpack_require__(36); +var redefine = __webpack_require__(43); -var shared = __webpack_require__(24); +var shared = __webpack_require__(31); -var sharedKey = __webpack_require__(40); +var sharedKey = __webpack_require__(47); -var hiddenKeys = __webpack_require__(41); +var hiddenKeys = __webpack_require__(48); -var uid = __webpack_require__(30); +var uid = __webpack_require__(37); -var wellKnownSymbol = __webpack_require__(23); +var wellKnownSymbol = __webpack_require__(30); -var wrappedWellKnownSymbolModule = __webpack_require__(60); +var wrappedWellKnownSymbolModule = __webpack_require__(75); -var defineWellKnownSymbol = __webpack_require__(61); +var defineWellKnownSymbol = __webpack_require__(76); -var setToStringTag = __webpack_require__(63); +var setToStringTag = __webpack_require__(78); -var InternalStateModule = __webpack_require__(38); +var InternalStateModule = __webpack_require__(45); -var $forEach = __webpack_require__(64).forEach; +var $forEach = (__webpack_require__(79).forEach); var HIDDEN = sharedKey('hidden'); var SYMBOL = 'Symbol'; @@ -556,17 +574,20 @@ var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(SYMBOL); var ObjectPrototype = Object[PROTOTYPE]; var $Symbol = global.Symbol; +var SymbolPrototype = $Symbol && $Symbol[PROTOTYPE]; +var TypeError = global.TypeError; +var QObject = global.QObject; var $stringify = getBuiltIn('JSON', 'stringify'); var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; var nativeDefineProperty = definePropertyModule.f; var nativeGetOwnPropertyNames = getOwnPropertyNamesExternal.f; var nativePropertyIsEnumerable = propertyIsEnumerableModule.f; +var push = uncurryThis([].push); var AllSymbols = shared('symbols'); var ObjectPrototypeSymbols = shared('op-symbols'); var StringToSymbolRegistry = shared('string-to-symbol-registry'); var SymbolToStringRegistry = shared('symbol-to-string-registry'); -var WellKnownSymbolsStore = shared('wks'); -var QObject = global.QObject; // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 +var WellKnownSymbolsStore = shared('wks'); // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173 var USE_SETTER = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild; // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687 @@ -589,7 +610,7 @@ var setSymbolDescriptor = DESCRIPTORS && fails(function () { } : nativeDefineProperty; var wrap = function (tag, description) { - var symbol = AllSymbols[tag] = nativeObjectCreate($Symbol[PROTOTYPE]); + var symbol = AllSymbols[tag] = nativeObjectCreate(SymbolPrototype); setInternalState(symbol, { type: SYMBOL, tag: tag, @@ -605,12 +626,12 @@ var $defineProperty = function defineProperty(O, P, Attributes) { var key = toPropertyKey(P); anObject(Attributes); - if (has(AllSymbols, key)) { + if (hasOwn(AllSymbols, key)) { if (!Attributes.enumerable) { - if (!has(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {})); + if (!hasOwn(O, HIDDEN)) nativeDefineProperty(O, HIDDEN, createPropertyDescriptor(1, {})); O[HIDDEN][key] = true; } else { - if (has(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false; + if (hasOwn(O, HIDDEN) && O[HIDDEN][key]) O[HIDDEN][key] = false; Attributes = nativeObjectCreate(Attributes, { enumerable: createPropertyDescriptor(0, false) }); @@ -627,7 +648,7 @@ var $defineProperties = function defineProperties(O, Properties) { var properties = toIndexedObject(Properties); var keys = objectKeys(properties).concat($getOwnPropertySymbols(properties)); $forEach(keys, function (key) { - if (!DESCRIPTORS || $propertyIsEnumerable.call(properties, key)) $defineProperty(O, key, properties[key]); + if (!DESCRIPTORS || call($propertyIsEnumerable, properties, key)) $defineProperty(O, key, properties[key]); }); return O; }; @@ -638,18 +659,18 @@ var $create = function create(O, Properties) { var $propertyIsEnumerable = function propertyIsEnumerable(V) { var P = toPropertyKey(V); - var enumerable = nativePropertyIsEnumerable.call(this, P); - if (this === ObjectPrototype && has(AllSymbols, P) && !has(ObjectPrototypeSymbols, P)) return false; - return enumerable || !has(this, P) || !has(AllSymbols, P) || has(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true; + var enumerable = call(nativePropertyIsEnumerable, this, P); + if (this === ObjectPrototype && hasOwn(AllSymbols, P) && !hasOwn(ObjectPrototypeSymbols, P)) return false; + return enumerable || !hasOwn(this, P) || !hasOwn(AllSymbols, P) || hasOwn(this, HIDDEN) && this[HIDDEN][P] ? enumerable : true; }; var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(O, P) { var it = toIndexedObject(O); var key = toPropertyKey(P); - if (it === ObjectPrototype && has(AllSymbols, key) && !has(ObjectPrototypeSymbols, key)) return; + if (it === ObjectPrototype && hasOwn(AllSymbols, key) && !hasOwn(ObjectPrototypeSymbols, key)) return; var descriptor = nativeGetOwnPropertyDescriptor(it, key); - if (descriptor && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) { + if (descriptor && hasOwn(AllSymbols, key) && !(hasOwn(it, HIDDEN) && it[HIDDEN][key])) { descriptor.enumerable = true; } @@ -660,7 +681,7 @@ var $getOwnPropertyNames = function getOwnPropertyNames(O) { var names = nativeGetOwnPropertyNames(toIndexedObject(O)); var result = []; $forEach(names, function (key) { - if (!has(AllSymbols, key) && !has(hiddenKeys, key)) result.push(key); + if (!hasOwn(AllSymbols, key) && !hasOwn(hiddenKeys, key)) push(result, key); }); return result; }; @@ -670,8 +691,8 @@ var $getOwnPropertySymbols = function getOwnPropertySymbols(O) { var names = nativeGetOwnPropertyNames(IS_OBJECT_PROTOTYPE ? ObjectPrototypeSymbols : toIndexedObject(O)); var result = []; $forEach(names, function (key) { - if (has(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || has(ObjectPrototype, key))) { - result.push(AllSymbols[key]); + if (hasOwn(AllSymbols, key) && (!IS_OBJECT_PROTOTYPE || hasOwn(ObjectPrototype, key))) { + push(result, AllSymbols[key]); } }); return result; @@ -681,13 +702,13 @@ var $getOwnPropertySymbols = function getOwnPropertySymbols(O) { if (!NATIVE_SYMBOL) { $Symbol = function Symbol() { - if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor'); + if (isPrototypeOf(SymbolPrototype, this)) throw TypeError('Symbol is not a constructor'); var description = !arguments.length || arguments[0] === undefined ? undefined : $toString(arguments[0]); var tag = uid(description); var setter = function (value) { - if (this === ObjectPrototype) setter.call(ObjectPrototypeSymbols, value); - if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false; + if (this === ObjectPrototype) call(setter, ObjectPrototypeSymbols, value); + if (hasOwn(this, HIDDEN) && hasOwn(this[HIDDEN], tag)) this[HIDDEN][tag] = false; setSymbolDescriptor(this, tag, createPropertyDescriptor(1, value)); }; @@ -698,7 +719,8 @@ if (!NATIVE_SYMBOL) { return wrap(tag, description); }; - redefine($Symbol[PROTOTYPE], 'toString', function toString() { + SymbolPrototype = $Symbol[PROTOTYPE]; + redefine(SymbolPrototype, 'toString', function toString() { return getInternalState(this).tag; }); redefine($Symbol, 'withoutSetter', function (description) { @@ -716,7 +738,7 @@ if (!NATIVE_SYMBOL) { if (DESCRIPTORS) { // https://github.com/tc39/proposal-Symbol-description - nativeDefineProperty($Symbol[PROTOTYPE], 'description', { + nativeDefineProperty(SymbolPrototype, 'description', { configurable: true, get: function description() { return getInternalState(this).description; @@ -751,7 +773,7 @@ $({ // https://tc39.es/ecma262/#sec-symbol.for 'for': function (key) { var string = $toString(key); - if (has(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string]; + if (hasOwn(StringToSymbolRegistry, string)) return StringToSymbolRegistry[string]; var symbol = $Symbol(string); StringToSymbolRegistry[string] = symbol; SymbolToStringRegistry[symbol] = string; @@ -761,7 +783,7 @@ $({ // https://tc39.es/ecma262/#sec-symbol.keyfor keyFor: function keyFor(sym) { if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol'); - if (has(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym]; + if (hasOwn(SymbolToStringRegistry, sym)) return SymbolToStringRegistry[sym]; }, useSetter: function () { USE_SETTER = true; @@ -833,29 +855,29 @@ if ($stringify) { }, { // eslint-disable-next-line no-unused-vars -- required for `.length` stringify: function stringify(it, replacer, space) { - var args = [it]; - var index = 1; - var $replacer; - - while (arguments.length > index) args.push(arguments[index++]); - - $replacer = replacer; + var args = arraySlice(arguments); + var $replacer = replacer; if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined if (!isArray(replacer)) replacer = function (key, value) { - if (typeof $replacer == 'function') value = $replacer.call(this, key, value); + if (isCallable($replacer)) value = call($replacer, this, key, value); if (!isSymbol(value)) return value; }; args[1] = replacer; - return $stringify.apply(null, args); + return apply($stringify, null, args); } }); } // `Symbol.prototype[@@toPrimitive]` method // https://tc39.es/ecma262/#sec-symbol.prototype-@@toprimitive -if (!$Symbol[PROTOTYPE][TO_PRIMITIVE]) { - createNonEnumerableProperty($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf); +if (!SymbolPrototype[TO_PRIMITIVE]) { + var valueOf = SymbolPrototype.valueOf; // eslint-disable-next-line no-unused-vars -- required for .length + + redefine(SymbolPrototype, TO_PRIMITIVE, function (hint) { + // TODO: improve hint logic + return call(valueOf, this); + }); } // `Symbol.prototype[@@toStringTag]` property // https://tc39.es/ecma262/#sec-symbol.prototype-@@tostringtag @@ -869,17 +891,17 @@ hiddenKeys[HIDDEN] = true; var global = __webpack_require__(3); -var getOwnPropertyDescriptor = __webpack_require__(4).f; +var getOwnPropertyDescriptor = (__webpack_require__(4).f); -var createNonEnumerableProperty = __webpack_require__(33); +var createNonEnumerableProperty = __webpack_require__(40); -var redefine = __webpack_require__(36); +var redefine = __webpack_require__(43); -var setGlobal = __webpack_require__(27); +var setGlobal = __webpack_require__(34); -var copyConstructorProperties = __webpack_require__(42); +var copyConstructorProperties = __webpack_require__(50); -var isForced = __webpack_require__(52); +var isForced = __webpack_require__(61); /* options.target - name of the target object options.global - target is the global object @@ -893,6 +915,7 @@ var isForced = __webpack_require__(52); options.sham - add a flag to not completely full polyfills options.enumerable - export as enumerable property options.noTargetGet - prevent calling a getter on target + options.name - the .name of the function if it does not match the key */ @@ -921,7 +944,7 @@ module.exports = function (options, source) { FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced); // contained in target if (!FORCED && targetProperty !== undefined) { - if (typeof sourceProperty === typeof targetProperty) continue; + if (typeof sourceProperty == typeof targetProperty) continue; copyConstructorProperties(sourceProperty, targetProperty); } // add a flag to not completely full polyfills @@ -957,17 +980,19 @@ function () { var DESCRIPTORS = __webpack_require__(5); -var propertyIsEnumerableModule = __webpack_require__(7); +var call = __webpack_require__(7); -var createPropertyDescriptor = __webpack_require__(8); +var propertyIsEnumerableModule = __webpack_require__(8); -var toIndexedObject = __webpack_require__(9); +var createPropertyDescriptor = __webpack_require__(9); -var toPropertyKey = __webpack_require__(13); +var toIndexedObject = __webpack_require__(10); -var has = __webpack_require__(28); +var toPropertyKey = __webpack_require__(15); -var IE8_DOM_DEFINE = __webpack_require__(31); // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe +var hasOwn = __webpack_require__(35); + +var IE8_DOM_DEFINE = __webpack_require__(38); // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe var $getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; // `Object.getOwnPropertyDescriptor` method @@ -981,7 +1006,7 @@ exports.f = DESCRIPTORS ? $getOwnPropertyDescriptor : function getOwnPropertyDes } catch (error) { /* empty */ } - if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]); + if (hasOwn(O, P)) return createPropertyDescriptor(!call(propertyIsEnumerableModule.f, O, P), O[P]); }; /***/ }), @@ -1014,6 +1039,15 @@ module.exports = function (exec) { /***/ }), /* 7 */ +/***/ ((module) => { + +var call = Function.prototype.call; +module.exports = call.bind ? call.bind(call) : function () { + return call.apply(call, arguments); +}; + +/***/ }), +/* 8 */ /***/ ((__unused_webpack_module, exports) => { "use strict"; @@ -1034,7 +1068,7 @@ exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) { } : $propertyIsEnumerable; /***/ }), -/* 8 */ +/* 9 */ /***/ ((module) => { module.exports = function (bitmap, value) { @@ -1047,95 +1081,129 @@ module.exports = function (bitmap, value) { }; /***/ }), -/* 9 */ +/* 10 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { // toObject with fallback for non-array-like ES3 strings -var IndexedObject = __webpack_require__(10); +var IndexedObject = __webpack_require__(11); -var requireObjectCoercible = __webpack_require__(12); +var requireObjectCoercible = __webpack_require__(14); module.exports = function (it) { return IndexedObject(requireObjectCoercible(it)); }; /***/ }), -/* 10 */ +/* 11 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { +var global = __webpack_require__(3); + +var uncurryThis = __webpack_require__(12); + var fails = __webpack_require__(6); -var classof = __webpack_require__(11); +var classof = __webpack_require__(13); -var split = ''.split; // fallback for non-array-like ES3 and non-enumerable old V8 strings +var Object = global.Object; +var split = uncurryThis(''.split); // fallback for non-array-like ES3 and non-enumerable old V8 strings module.exports = fails(function () { // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346 // eslint-disable-next-line no-prototype-builtins -- safe return !Object('z').propertyIsEnumerable(0); }) ? function (it) { - return classof(it) == 'String' ? split.call(it, '') : Object(it); + return classof(it) == 'String' ? split(it, '') : Object(it); } : Object; -/***/ }), -/* 11 */ -/***/ ((module) => { - -var toString = {}.toString; - -module.exports = function (it) { - return toString.call(it).slice(8, -1); -}; - /***/ }), /* 12 */ /***/ ((module) => { -// `RequireObjectCoercible` abstract operation -// https://tc39.es/ecma262/#sec-requireobjectcoercible -module.exports = function (it) { - if (it == undefined) throw TypeError("Can't call method on " + it); - return it; +var FunctionPrototype = Function.prototype; +var bind = FunctionPrototype.bind; +var call = FunctionPrototype.call; +var callBind = bind && bind.bind(call); +module.exports = bind ? function (fn) { + return fn && callBind(call, fn); +} : function (fn) { + return fn && function () { + return call.apply(fn, arguments); + }; }; /***/ }), /* 13 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var toPrimitive = __webpack_require__(14); +var uncurryThis = __webpack_require__(12); -var isSymbol = __webpack_require__(16); // `ToPropertyKey` abstract operation -// https://tc39.es/ecma262/#sec-topropertykey +var toString = uncurryThis({}.toString); +var stringSlice = uncurryThis(''.slice); - -module.exports = function (argument) { - var key = toPrimitive(argument, 'string'); - return isSymbol(key) ? key : String(key); +module.exports = function (it) { + return stringSlice(toString(it), 8, -1); }; /***/ }), /* 14 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var isObject = __webpack_require__(15); +var global = __webpack_require__(3); -var isSymbol = __webpack_require__(16); +var TypeError = global.TypeError; // `RequireObjectCoercible` abstract operation +// https://tc39.es/ecma262/#sec-requireobjectcoercible -var ordinaryToPrimitive = __webpack_require__(22); +module.exports = function (it) { + if (it == undefined) throw TypeError("Can't call method on " + it); + return it; +}; -var wellKnownSymbol = __webpack_require__(23); +/***/ }), +/* 15 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +var toPrimitive = __webpack_require__(16); + +var isSymbol = __webpack_require__(19); // `ToPropertyKey` abstract operation +// https://tc39.es/ecma262/#sec-topropertykey + + +module.exports = function (argument) { + var key = toPrimitive(argument, 'string'); + return isSymbol(key) ? key : key + ''; +}; + +/***/ }), +/* 16 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var global = __webpack_require__(3); + +var call = __webpack_require__(7); + +var isObject = __webpack_require__(17); + +var isSymbol = __webpack_require__(19); + +var getMethod = __webpack_require__(26); + +var ordinaryToPrimitive = __webpack_require__(29); + +var wellKnownSymbol = __webpack_require__(30); + +var TypeError = global.TypeError; var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); // `ToPrimitive` abstract operation // https://tc39.es/ecma262/#sec-toprimitive module.exports = function (input, pref) { if (!isObject(input) || isSymbol(input)) return input; - var exoticToPrim = input[TO_PRIMITIVE]; + var exoticToPrim = getMethod(input, TO_PRIMITIVE); var result; - if (exoticToPrim !== undefined) { + if (exoticToPrim) { if (pref === undefined) pref = 'default'; - result = exoticToPrim.call(input, pref); + result = call(exoticToPrim, input, pref); if (!isObject(result) || isSymbol(result)) return result; throw TypeError("Can't convert object to primitive value"); } @@ -1145,36 +1213,57 @@ module.exports = function (input, pref) { }; /***/ }), -/* 15 */ -/***/ ((module) => { - -module.exports = function (it) { - return typeof it === 'object' ? it !== null : typeof it === 'function'; -}; - -/***/ }), -/* 16 */ +/* 17 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var getBuiltIn = __webpack_require__(17); +var isCallable = __webpack_require__(18); -var USE_SYMBOL_AS_UID = __webpack_require__(18); - -module.exports = USE_SYMBOL_AS_UID ? function (it) { - return typeof it == 'symbol'; -} : function (it) { - var $Symbol = getBuiltIn('Symbol'); - return typeof $Symbol == 'function' && Object(it) instanceof $Symbol; +module.exports = function (it) { + return typeof it == 'object' ? it !== null : isCallable(it); }; /***/ }), -/* 17 */ +/* 18 */ +/***/ ((module) => { + +// `IsCallable` abstract operation +// https://tc39.es/ecma262/#sec-iscallable +module.exports = function (argument) { + return typeof argument == 'function'; +}; + +/***/ }), +/* 19 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var global = __webpack_require__(3); -var aFunction = function (variable) { - return typeof variable == 'function' ? variable : undefined; +var getBuiltIn = __webpack_require__(20); + +var isCallable = __webpack_require__(18); + +var isPrototypeOf = __webpack_require__(21); + +var USE_SYMBOL_AS_UID = __webpack_require__(22); + +var Object = global.Object; +module.exports = USE_SYMBOL_AS_UID ? function (it) { + return typeof it == 'symbol'; +} : function (it) { + var $Symbol = getBuiltIn('Symbol'); + return isCallable($Symbol) && isPrototypeOf($Symbol.prototype, Object(it)); +}; + +/***/ }), +/* 20 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var global = __webpack_require__(3); + +var isCallable = __webpack_require__(18); + +var aFunction = function (argument) { + return isCallable(argument) ? argument : undefined; }; module.exports = function (namespace, method) { @@ -1182,20 +1271,28 @@ module.exports = function (namespace, method) { }; /***/ }), -/* 18 */ +/* 21 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var uncurryThis = __webpack_require__(12); + +module.exports = uncurryThis({}.isPrototypeOf); + +/***/ }), +/* 22 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /* eslint-disable es/no-symbol -- required for testing */ -var NATIVE_SYMBOL = __webpack_require__(19); +var NATIVE_SYMBOL = __webpack_require__(23); module.exports = NATIVE_SYMBOL && !Symbol.sham && typeof Symbol.iterator == 'symbol'; /***/ }), -/* 19 */ +/* 23 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /* eslint-disable es/no-symbol -- required for testing */ -var V8_VERSION = __webpack_require__(20); +var V8_VERSION = __webpack_require__(24); var fails = __webpack_require__(6); // eslint-disable-next-line es/no-object-getownpropertysymbols -- required for testing @@ -1209,12 +1306,12 @@ module.exports = !!Object.getOwnPropertySymbols && !fails(function () { }); /***/ }), -/* 20 */ +/* 24 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var global = __webpack_require__(3); -var userAgent = __webpack_require__(21); +var userAgent = __webpack_require__(25); var process = global.process; var Deno = global.Deno; @@ -1223,108 +1320,45 @@ var v8 = versions && versions.v8; var match, version; if (v8) { - match = v8.split('.'); - version = match[0] < 4 ? 1 : match[0] + match[1]; -} else if (userAgent) { + match = v8.split('.'); // in old Chrome, versions of V8 isn't V8 = Chrome / 10 + // but their correct versions are not interesting for us + + version = match[0] > 0 && match[0] < 4 ? 1 : +(match[0] + match[1]); +} // BrowserFS NodeJS `process` polyfill incorrectly set `.v8` to `0.0` +// so check `userAgent` even if `.v8` exists, but 0 + + +if (!version && userAgent) { match = userAgent.match(/Edge\/(\d+)/); if (!match || match[1] >= 74) { match = userAgent.match(/Chrome\/(\d+)/); - if (match) version = match[1]; + if (match) version = +match[1]; } } -module.exports = version && +version; - -/***/ }), -/* 21 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var getBuiltIn = __webpack_require__(17); - -module.exports = getBuiltIn('navigator', 'userAgent') || ''; - -/***/ }), -/* 22 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var isObject = __webpack_require__(15); // `OrdinaryToPrimitive` abstract operation -// https://tc39.es/ecma262/#sec-ordinarytoprimitive - - -module.exports = function (input, pref) { - var fn, val; - if (pref === 'string' && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; - if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val; - if (pref !== 'string' && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val; - throw TypeError("Can't convert object to primitive value"); -}; - -/***/ }), -/* 23 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var global = __webpack_require__(3); - -var shared = __webpack_require__(24); - -var has = __webpack_require__(28); - -var uid = __webpack_require__(30); - -var NATIVE_SYMBOL = __webpack_require__(19); - -var USE_SYMBOL_AS_UID = __webpack_require__(18); - -var WellKnownSymbolsStore = shared('wks'); -var Symbol = global.Symbol; -var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid; - -module.exports = function (name) { - if (!has(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) { - if (NATIVE_SYMBOL && has(Symbol, name)) { - WellKnownSymbolsStore[name] = Symbol[name]; - } else { - WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name); - } - } - - return WellKnownSymbolsStore[name]; -}; - -/***/ }), -/* 24 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var IS_PURE = __webpack_require__(25); - -var store = __webpack_require__(26); - -(module.exports = function (key, value) { - return store[key] || (store[key] = value !== undefined ? value : {}); -})('versions', []).push({ - version: '3.16.4', - mode: IS_PURE ? 'pure' : 'global', - copyright: '© 2021 Denis Pushkarev (zloirock.ru)' -}); +module.exports = version; /***/ }), /* 25 */ -/***/ ((module) => { +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = false; +var getBuiltIn = __webpack_require__(20); + +module.exports = getBuiltIn('navigator', 'userAgent') || ''; /***/ }), /* 26 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var global = __webpack_require__(3); +var aCallable = __webpack_require__(27); // `GetMethod` abstract operation +// https://tc39.es/ecma262/#sec-getmethod -var setGlobal = __webpack_require__(27); -var SHARED = '__core-js_shared__'; -var store = global[SHARED] || setGlobal(SHARED, {}); -module.exports = store; +module.exports = function (V, P) { + var func = V[P]; + return func == null ? undefined : aCallable(func); +}; /***/ }), /* 27 */ @@ -1332,10 +1366,139 @@ module.exports = store; var global = __webpack_require__(3); +var isCallable = __webpack_require__(18); + +var tryToString = __webpack_require__(28); + +var TypeError = global.TypeError; // `Assert: IsCallable(argument) is true` + +module.exports = function (argument) { + if (isCallable(argument)) return argument; + throw TypeError(tryToString(argument) + ' is not a function'); +}; + +/***/ }), +/* 28 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var global = __webpack_require__(3); + +var String = global.String; + +module.exports = function (argument) { + try { + return String(argument); + } catch (error) { + return 'Object'; + } +}; + +/***/ }), +/* 29 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var global = __webpack_require__(3); + +var call = __webpack_require__(7); + +var isCallable = __webpack_require__(18); + +var isObject = __webpack_require__(17); + +var TypeError = global.TypeError; // `OrdinaryToPrimitive` abstract operation +// https://tc39.es/ecma262/#sec-ordinarytoprimitive + +module.exports = function (input, pref) { + var fn, val; + if (pref === 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val; + if (isCallable(fn = input.valueOf) && !isObject(val = call(fn, input))) return val; + if (pref !== 'string' && isCallable(fn = input.toString) && !isObject(val = call(fn, input))) return val; + throw TypeError("Can't convert object to primitive value"); +}; + +/***/ }), +/* 30 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var global = __webpack_require__(3); + +var shared = __webpack_require__(31); + +var hasOwn = __webpack_require__(35); + +var uid = __webpack_require__(37); + +var NATIVE_SYMBOL = __webpack_require__(23); + +var USE_SYMBOL_AS_UID = __webpack_require__(22); + +var WellKnownSymbolsStore = shared('wks'); +var Symbol = global.Symbol; +var symbolFor = Symbol && Symbol['for']; +var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid; + +module.exports = function (name) { + if (!hasOwn(WellKnownSymbolsStore, name) || !(NATIVE_SYMBOL || typeof WellKnownSymbolsStore[name] == 'string')) { + var description = 'Symbol.' + name; + + if (NATIVE_SYMBOL && hasOwn(Symbol, name)) { + WellKnownSymbolsStore[name] = Symbol[name]; + } else if (USE_SYMBOL_AS_UID && symbolFor) { + WellKnownSymbolsStore[name] = symbolFor(description); + } else { + WellKnownSymbolsStore[name] = createWellKnownSymbol(description); + } + } + + return WellKnownSymbolsStore[name]; +}; + +/***/ }), +/* 31 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var IS_PURE = __webpack_require__(32); + +var store = __webpack_require__(33); + +(module.exports = function (key, value) { + return store[key] || (store[key] = value !== undefined ? value : {}); +})('versions', []).push({ + version: '3.19.2', + mode: IS_PURE ? 'pure' : 'global', + copyright: '© 2021 Denis Pushkarev (zloirock.ru)' +}); + +/***/ }), +/* 32 */ +/***/ ((module) => { + +module.exports = false; + +/***/ }), +/* 33 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var global = __webpack_require__(3); + +var setGlobal = __webpack_require__(34); + +var SHARED = '__core-js_shared__'; +var store = global[SHARED] || setGlobal(SHARED, {}); +module.exports = store; + +/***/ }), +/* 34 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var global = __webpack_require__(3); // eslint-disable-next-line es/no-object-defineproperty -- safe + + +var defineProperty = Object.defineProperty; + module.exports = function (key, value) { try { - // eslint-disable-next-line es/no-object-defineproperty -- safe - Object.defineProperty(global, key, { + defineProperty(global, key, { value: value, configurable: true, writable: true @@ -1348,49 +1511,58 @@ module.exports = function (key, value) { }; /***/ }), -/* 28 */ +/* 35 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var toObject = __webpack_require__(29); +var uncurryThis = __webpack_require__(12); -var hasOwnProperty = {}.hasOwnProperty; +var toObject = __webpack_require__(36); + +var hasOwnProperty = uncurryThis({}.hasOwnProperty); // `HasOwnProperty` abstract operation +// https://tc39.es/ecma262/#sec-hasownproperty module.exports = Object.hasOwn || function hasOwn(it, key) { - return hasOwnProperty.call(toObject(it), key); + return hasOwnProperty(toObject(it), key); }; /***/ }), -/* 29 */ +/* 36 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var requireObjectCoercible = __webpack_require__(12); // `ToObject` abstract operation -// https://tc39.es/ecma262/#sec-toobject +var global = __webpack_require__(3); +var requireObjectCoercible = __webpack_require__(14); + +var Object = global.Object; // `ToObject` abstract operation +// https://tc39.es/ecma262/#sec-toobject module.exports = function (argument) { return Object(requireObjectCoercible(argument)); }; /***/ }), -/* 30 */ -/***/ ((module) => { +/* 37 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var uncurryThis = __webpack_require__(12); var id = 0; var postfix = Math.random(); +var toString = uncurryThis(1.0.toString); module.exports = function (key) { - return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36); + return 'Symbol(' + (key === undefined ? '' : key) + ')_' + toString(++id + postfix, 36); }; /***/ }), -/* 31 */ +/* 38 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var DESCRIPTORS = __webpack_require__(5); var fails = __webpack_require__(6); -var createElement = __webpack_require__(32); // Thank's IE8 for his funny defineProperty +var createElement = __webpack_require__(39); // Thank's IE8 for his funny defineProperty module.exports = !DESCRIPTORS && !fails(function () { @@ -1403,12 +1575,12 @@ module.exports = !DESCRIPTORS && !fails(function () { }); /***/ }), -/* 32 */ +/* 39 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var global = __webpack_require__(3); -var isObject = __webpack_require__(15); +var isObject = __webpack_require__(17); var document = global.document; // typeof document.createElement is 'object' in old IE @@ -1419,14 +1591,14 @@ module.exports = function (it) { }; /***/ }), -/* 33 */ +/* 40 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var DESCRIPTORS = __webpack_require__(5); -var definePropertyModule = __webpack_require__(34); +var definePropertyModule = __webpack_require__(41); -var createPropertyDescriptor = __webpack_require__(8); +var createPropertyDescriptor = __webpack_require__(9); module.exports = DESCRIPTORS ? function (object, key, value) { return definePropertyModule.f(object, key, createPropertyDescriptor(1, value)); @@ -1436,17 +1608,20 @@ module.exports = DESCRIPTORS ? function (object, key, value) { }; /***/ }), -/* 34 */ +/* 41 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { +var global = __webpack_require__(3); + var DESCRIPTORS = __webpack_require__(5); -var IE8_DOM_DEFINE = __webpack_require__(31); +var IE8_DOM_DEFINE = __webpack_require__(38); -var anObject = __webpack_require__(35); +var anObject = __webpack_require__(42); -var toPropertyKey = __webpack_require__(13); // eslint-disable-next-line es/no-object-defineproperty -- safe +var toPropertyKey = __webpack_require__(15); +var TypeError = global.TypeError; // eslint-disable-next-line es/no-object-defineproperty -- safe var $defineProperty = Object.defineProperty; // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty @@ -1466,34 +1641,40 @@ exports.f = DESCRIPTORS ? $defineProperty : function defineProperty(O, P, Attrib }; /***/ }), -/* 35 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var isObject = __webpack_require__(15); - -module.exports = function (it) { - if (!isObject(it)) { - throw TypeError(String(it) + ' is not an object'); - } - - return it; -}; - -/***/ }), -/* 36 */ +/* 42 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var global = __webpack_require__(3); -var createNonEnumerableProperty = __webpack_require__(33); +var isObject = __webpack_require__(17); -var has = __webpack_require__(28); +var String = global.String; +var TypeError = global.TypeError; // `Assert: Type(argument) is Object` -var setGlobal = __webpack_require__(27); +module.exports = function (argument) { + if (isObject(argument)) return argument; + throw TypeError(String(argument) + ' is not an object'); +}; -var inspectSource = __webpack_require__(37); +/***/ }), +/* 43 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var InternalStateModule = __webpack_require__(38); +var global = __webpack_require__(3); + +var isCallable = __webpack_require__(18); + +var hasOwn = __webpack_require__(35); + +var createNonEnumerableProperty = __webpack_require__(40); + +var setGlobal = __webpack_require__(34); + +var inspectSource = __webpack_require__(44); + +var InternalStateModule = __webpack_require__(45); + +var CONFIGURABLE_FUNCTION_NAME = (__webpack_require__(49).CONFIGURABLE); var getInternalState = InternalStateModule.get; var enforceInternalState = InternalStateModule.enforce; @@ -1502,17 +1683,22 @@ var TEMPLATE = String(String).split('String'); var unsafe = options ? !!options.unsafe : false; var simple = options ? !!options.enumerable : false; var noTargetGet = options ? !!options.noTargetGet : false; + var name = options && options.name !== undefined ? options.name : key; var state; - if (typeof value == 'function') { - if (typeof key == 'string' && !has(value, 'name')) { - createNonEnumerableProperty(value, 'name', key); + if (isCallable(value)) { + if (String(name).slice(0, 7) === 'Symbol(') { + name = '[' + String(name).replace(/^Symbol\(([^)]*)\)/, '$1') + ']'; + } + + if (!hasOwn(value, 'name') || CONFIGURABLE_FUNCTION_NAME && value.name !== name) { + createNonEnumerableProperty(value, 'name', name); } state = enforceInternalState(value); if (!state.source) { - state.source = TEMPLATE.join(typeof key == 'string' ? key : ''); + state.source = TEMPLATE.join(typeof name == 'string' ? name : ''); } } @@ -1527,46 +1713,53 @@ var TEMPLATE = String(String).split('String'); if (simple) O[key] = value;else createNonEnumerableProperty(O, key, value); // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative })(Function.prototype, 'toString', function toString() { - return typeof this == 'function' && getInternalState(this).source || inspectSource(this); + return isCallable(this) && getInternalState(this).source || inspectSource(this); }); /***/ }), -/* 37 */ +/* 44 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var store = __webpack_require__(26); +var uncurryThis = __webpack_require__(12); -var functionToString = Function.toString; // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper +var isCallable = __webpack_require__(18); -if (typeof store.inspectSource != 'function') { +var store = __webpack_require__(33); + +var functionToString = uncurryThis(Function.toString); // this helper broken in `core-js@3.4.1-3.4.4`, so we can't use `shared` helper + +if (!isCallable(store.inspectSource)) { store.inspectSource = function (it) { - return functionToString.call(it); + return functionToString(it); }; } module.exports = store.inspectSource; /***/ }), -/* 38 */ +/* 45 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var NATIVE_WEAK_MAP = __webpack_require__(39); +var NATIVE_WEAK_MAP = __webpack_require__(46); var global = __webpack_require__(3); -var isObject = __webpack_require__(15); +var uncurryThis = __webpack_require__(12); -var createNonEnumerableProperty = __webpack_require__(33); +var isObject = __webpack_require__(17); -var objectHas = __webpack_require__(28); +var createNonEnumerableProperty = __webpack_require__(40); -var shared = __webpack_require__(26); +var hasOwn = __webpack_require__(35); -var sharedKey = __webpack_require__(40); +var shared = __webpack_require__(33); -var hiddenKeys = __webpack_require__(41); +var sharedKey = __webpack_require__(47); + +var hiddenKeys = __webpack_require__(48); var OBJECT_ALREADY_INITIALIZED = 'Object already initialized'; +var TypeError = global.TypeError; var WeakMap = global.WeakMap; var set, get, has; @@ -1588,41 +1781,41 @@ var getterFor = function (TYPE) { if (NATIVE_WEAK_MAP || shared.state) { var store = shared.state || (shared.state = new WeakMap()); - var wmget = store.get; - var wmhas = store.has; - var wmset = store.set; + var wmget = uncurryThis(store.get); + var wmhas = uncurryThis(store.has); + var wmset = uncurryThis(store.set); set = function (it, metadata) { - if (wmhas.call(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); + if (wmhas(store, it)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); metadata.facade = it; - wmset.call(store, it, metadata); + wmset(store, it, metadata); return metadata; }; get = function (it) { - return wmget.call(store, it) || {}; + return wmget(store, it) || {}; }; has = function (it) { - return wmhas.call(store, it); + return wmhas(store, it); }; } else { var STATE = sharedKey('state'); hiddenKeys[STATE] = true; set = function (it, metadata) { - if (objectHas(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); + if (hasOwn(it, STATE)) throw new TypeError(OBJECT_ALREADY_INITIALIZED); metadata.facade = it; createNonEnumerableProperty(it, STATE, metadata); return metadata; }; get = function (it) { - return objectHas(it, STATE) ? it[STATE] : {}; + return hasOwn(it, STATE) ? it[STATE] : {}; }; has = function (it) { - return objectHas(it, STATE); + return hasOwn(it, STATE); }; } @@ -1635,23 +1828,25 @@ module.exports = { }; /***/ }), -/* 39 */ +/* 46 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var global = __webpack_require__(3); -var inspectSource = __webpack_require__(37); +var isCallable = __webpack_require__(18); + +var inspectSource = __webpack_require__(44); var WeakMap = global.WeakMap; -module.exports = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap)); +module.exports = isCallable(WeakMap) && /native code/.test(inspectSource(WeakMap)); /***/ }), -/* 40 */ +/* 47 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var shared = __webpack_require__(24); +var shared = __webpack_require__(31); -var uid = __webpack_require__(30); +var uid = __webpack_require__(37); var keys = shared('keys'); @@ -1660,22 +1855,46 @@ module.exports = function (key) { }; /***/ }), -/* 41 */ +/* 48 */ /***/ ((module) => { module.exports = {}; /***/ }), -/* 42 */ +/* 49 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var has = __webpack_require__(28); +var DESCRIPTORS = __webpack_require__(5); -var ownKeys = __webpack_require__(43); +var hasOwn = __webpack_require__(35); + +var FunctionPrototype = Function.prototype; // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe + +var getDescriptor = DESCRIPTORS && Object.getOwnPropertyDescriptor; +var EXISTS = hasOwn(FunctionPrototype, 'name'); // additional protection from minified / mangled / dropped function names + +var PROPER = EXISTS && function something() { + /* empty */ +}.name === 'something'; + +var CONFIGURABLE = EXISTS && (!DESCRIPTORS || DESCRIPTORS && getDescriptor(FunctionPrototype, 'name').configurable); +module.exports = { + EXISTS: EXISTS, + PROPER: PROPER, + CONFIGURABLE: CONFIGURABLE +}; + +/***/ }), +/* 50 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var hasOwn = __webpack_require__(35); + +var ownKeys = __webpack_require__(51); var getOwnPropertyDescriptorModule = __webpack_require__(4); -var definePropertyModule = __webpack_require__(34); +var definePropertyModule = __webpack_require__(41); module.exports = function (target, source) { var keys = ownKeys(source); @@ -1684,36 +1903,39 @@ module.exports = function (target, source) { for (var i = 0; i < keys.length; i++) { var key = keys[i]; - if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key)); + if (!hasOwn(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key)); } }; /***/ }), -/* 43 */ +/* 51 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var getBuiltIn = __webpack_require__(17); +var getBuiltIn = __webpack_require__(20); -var getOwnPropertyNamesModule = __webpack_require__(44); +var uncurryThis = __webpack_require__(12); -var getOwnPropertySymbolsModule = __webpack_require__(51); +var getOwnPropertyNamesModule = __webpack_require__(52); -var anObject = __webpack_require__(35); // all object keys, includes non-enumerable and symbols +var getOwnPropertySymbolsModule = __webpack_require__(60); +var anObject = __webpack_require__(42); + +var concat = uncurryThis([].concat); // all object keys, includes non-enumerable and symbols module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) { var keys = getOwnPropertyNamesModule.f(anObject(it)); var getOwnPropertySymbols = getOwnPropertySymbolsModule.f; - return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys; + return getOwnPropertySymbols ? concat(keys, getOwnPropertySymbols(it)) : keys; }; /***/ }), -/* 44 */ +/* 52 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { -var internalObjectKeys = __webpack_require__(45); +var internalObjectKeys = __webpack_require__(53); -var enumBugKeys = __webpack_require__(50); +var enumBugKeys = __webpack_require__(59); var hiddenKeys = enumBugKeys.concat('length', 'prototype'); // `Object.getOwnPropertyNames` method // https://tc39.es/ecma262/#sec-object.getownpropertynames @@ -1724,16 +1946,20 @@ exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) { }; /***/ }), -/* 45 */ +/* 53 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var has = __webpack_require__(28); +var uncurryThis = __webpack_require__(12); -var toIndexedObject = __webpack_require__(9); +var hasOwn = __webpack_require__(35); -var indexOf = __webpack_require__(46).indexOf; +var toIndexedObject = __webpack_require__(10); -var hiddenKeys = __webpack_require__(41); +var indexOf = (__webpack_require__(54).indexOf); + +var hiddenKeys = __webpack_require__(48); + +var push = uncurryThis([].push); module.exports = function (object, names) { var O = toIndexedObject(object); @@ -1741,31 +1967,31 @@ module.exports = function (object, names) { var result = []; var key; - for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key); // Don't enum bug & hidden keys + for (key in O) !hasOwn(hiddenKeys, key) && hasOwn(O, key) && push(result, key); // Don't enum bug & hidden keys - while (names.length > i) if (has(O, key = names[i++])) { - ~indexOf(result, key) || result.push(key); + while (names.length > i) if (hasOwn(O, key = names[i++])) { + ~indexOf(result, key) || push(result, key); } return result; }; /***/ }), -/* 46 */ +/* 54 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var toIndexedObject = __webpack_require__(9); +var toIndexedObject = __webpack_require__(10); -var toLength = __webpack_require__(47); +var toAbsoluteIndex = __webpack_require__(55); -var toAbsoluteIndex = __webpack_require__(49); // `Array.prototype.{ indexOf, includes }` methods implementation +var lengthOfArrayLike = __webpack_require__(57); // `Array.prototype.{ indexOf, includes }` methods implementation var createMethod = function (IS_INCLUDES) { return function ($this, el, fromIndex) { var O = toIndexedObject($this); - var length = toLength(O.length); + var length = lengthOfArrayLike(O); var index = toAbsoluteIndex(fromIndex, length); var value; // Array#includes uses SameValueZero equality algorithm // eslint-disable-next-line no-self-compare -- NaN check @@ -1791,35 +2017,10 @@ module.exports = { }; /***/ }), -/* 47 */ +/* 55 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var toInteger = __webpack_require__(48); - -var min = Math.min; // `ToLength` abstract operation -// https://tc39.es/ecma262/#sec-tolength - -module.exports = function (argument) { - return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 -}; - -/***/ }), -/* 48 */ -/***/ ((module) => { - -var ceil = Math.ceil; -var floor = Math.floor; // `ToInteger` abstract operation -// https://tc39.es/ecma262/#sec-tointeger - -module.exports = function (argument) { - return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument); -}; - -/***/ }), -/* 49 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var toInteger = __webpack_require__(48); +var toIntegerOrInfinity = __webpack_require__(56); var max = Math.max; var min = Math.min; // Helper for a popular repeating case of the spec: @@ -1827,35 +2028,76 @@ var min = Math.min; // Helper for a popular repeating case of the spec: // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length). module.exports = function (index, length) { - var integer = toInteger(index); + var integer = toIntegerOrInfinity(index); return integer < 0 ? max(integer + length, 0) : min(integer, length); }; /***/ }), -/* 50 */ +/* 56 */ +/***/ ((module) => { + +var ceil = Math.ceil; +var floor = Math.floor; // `ToIntegerOrInfinity` abstract operation +// https://tc39.es/ecma262/#sec-tointegerorinfinity + +module.exports = function (argument) { + var number = +argument; // eslint-disable-next-line no-self-compare -- safe + + return number !== number || number === 0 ? 0 : (number > 0 ? floor : ceil)(number); +}; + +/***/ }), +/* 57 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var toLength = __webpack_require__(58); // `LengthOfArrayLike` abstract operation +// https://tc39.es/ecma262/#sec-lengthofarraylike + + +module.exports = function (obj) { + return toLength(obj.length); +}; + +/***/ }), +/* 58 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var toIntegerOrInfinity = __webpack_require__(56); + +var min = Math.min; // `ToLength` abstract operation +// https://tc39.es/ecma262/#sec-tolength + +module.exports = function (argument) { + return argument > 0 ? min(toIntegerOrInfinity(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991 +}; + +/***/ }), +/* 59 */ /***/ ((module) => { // IE8- don't enum bug keys module.exports = ['constructor', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'valueOf']; /***/ }), -/* 51 */ +/* 60 */ /***/ ((__unused_webpack_module, exports) => { // eslint-disable-next-line es/no-object-getownpropertysymbols -- safe exports.f = Object.getOwnPropertySymbols; /***/ }), -/* 52 */ +/* 61 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var fails = __webpack_require__(6); +var isCallable = __webpack_require__(18); + var replacement = /#|\.prototype\./; var isForced = function (feature, detection) { var value = data[normalize(feature)]; - return value == POLYFILL ? true : value == NATIVE ? false : typeof detection == 'function' ? fails(detection) : !!detection; + return value == POLYFILL ? true : value == NATIVE ? false : isCallable(detection) ? fails(detection) : !!detection; }; var normalize = isForced.normalize = function (string) { @@ -1868,47 +2110,113 @@ var POLYFILL = isForced.POLYFILL = 'P'; module.exports = isForced; /***/ }), -/* 53 */ +/* 62 */ +/***/ ((module) => { + +var FunctionPrototype = Function.prototype; +var apply = FunctionPrototype.apply; +var bind = FunctionPrototype.bind; +var call = FunctionPrototype.call; // eslint-disable-next-line es/no-reflect -- safe + +module.exports = typeof Reflect == 'object' && Reflect.apply || (bind ? call.bind(apply) : function () { + return call.apply(apply, arguments); +}); + +/***/ }), +/* 63 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var classof = __webpack_require__(11); // `IsArray` abstract operation +var classof = __webpack_require__(13); // `IsArray` abstract operation // https://tc39.es/ecma262/#sec-isarray // eslint-disable-next-line es/no-array-isarray -- safe -module.exports = Array.isArray || function isArray(arg) { - return classof(arg) == 'Array'; +module.exports = Array.isArray || function isArray(argument) { + return classof(argument) == 'Array'; }; /***/ }), -/* 54 */ +/* 64 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var isSymbol = __webpack_require__(16); +var global = __webpack_require__(3); + +var classof = __webpack_require__(65); + +var String = global.String; module.exports = function (argument) { - if (isSymbol(argument)) throw TypeError('Cannot convert a Symbol value to a string'); + if (classof(argument) === 'Symbol') throw TypeError('Cannot convert a Symbol value to a string'); return String(argument); }; /***/ }), -/* 55 */ +/* 65 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var global = __webpack_require__(3); + +var TO_STRING_TAG_SUPPORT = __webpack_require__(66); + +var isCallable = __webpack_require__(18); + +var classofRaw = __webpack_require__(13); + +var wellKnownSymbol = __webpack_require__(30); + +var TO_STRING_TAG = wellKnownSymbol('toStringTag'); +var Object = global.Object; // ES3 wrong here + +var CORRECT_ARGUMENTS = classofRaw(function () { + return arguments; +}()) == 'Arguments'; // fallback for IE11 Script Access Denied error + +var tryGet = function (it, key) { + try { + return it[key]; + } catch (error) { + /* empty */ + } +}; // getting tag from ES6+ `Object.prototype.toString` + + +module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) { + var O, tag, result; + return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case + : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag // builtinTag case + : CORRECT_ARGUMENTS ? classofRaw(O) // ES3 arguments fallback + : (result = classofRaw(O)) == 'Object' && isCallable(O.callee) ? 'Arguments' : result; +}; + +/***/ }), +/* 66 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var wellKnownSymbol = __webpack_require__(30); + +var TO_STRING_TAG = wellKnownSymbol('toStringTag'); +var test = {}; +test[TO_STRING_TAG] = 'z'; +module.exports = String(test) === '[object z]'; + +/***/ }), +/* 67 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /* global ActiveXObject -- old IE, WSH */ -var anObject = __webpack_require__(35); +var anObject = __webpack_require__(42); -var defineProperties = __webpack_require__(56); +var defineProperties = __webpack_require__(68); -var enumBugKeys = __webpack_require__(50); +var enumBugKeys = __webpack_require__(59); -var hiddenKeys = __webpack_require__(41); +var hiddenKeys = __webpack_require__(48); -var html = __webpack_require__(58); +var html = __webpack_require__(70); -var documentCreateElement = __webpack_require__(32); +var documentCreateElement = __webpack_require__(39); -var sharedKey = __webpack_require__(40); +var sharedKey = __webpack_require__(47); var GT = '>'; var LT = '<'; @@ -1993,39 +2301,42 @@ module.exports = Object.create || function create(O, Properties) { }; /***/ }), -/* 56 */ +/* 68 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var DESCRIPTORS = __webpack_require__(5); -var definePropertyModule = __webpack_require__(34); +var definePropertyModule = __webpack_require__(41); -var anObject = __webpack_require__(35); +var anObject = __webpack_require__(42); -var objectKeys = __webpack_require__(57); // `Object.defineProperties` method +var toIndexedObject = __webpack_require__(10); + +var objectKeys = __webpack_require__(69); // `Object.defineProperties` method // https://tc39.es/ecma262/#sec-object.defineproperties // eslint-disable-next-line es/no-object-defineproperties -- safe module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) { anObject(O); + var props = toIndexedObject(Properties); var keys = objectKeys(Properties); var length = keys.length; var index = 0; var key; - while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]); + while (length > index) definePropertyModule.f(O, key = keys[index++], props[key]); return O; }; /***/ }), -/* 57 */ +/* 69 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var internalObjectKeys = __webpack_require__(45); +var internalObjectKeys = __webpack_require__(53); -var enumBugKeys = __webpack_require__(50); // `Object.keys` method +var enumBugKeys = __webpack_require__(59); // `Object.keys` method // https://tc39.es/ecma262/#sec-object.keys // eslint-disable-next-line es/no-object-keys -- safe @@ -2035,67 +2346,123 @@ module.exports = Object.keys || function keys(O) { }; /***/ }), -/* 58 */ +/* 70 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var getBuiltIn = __webpack_require__(17); +var getBuiltIn = __webpack_require__(20); module.exports = getBuiltIn('document', 'documentElement'); /***/ }), -/* 59 */ +/* 71 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /* eslint-disable es/no-object-getownpropertynames -- safe */ -var toIndexedObject = __webpack_require__(9); +var classof = __webpack_require__(13); -var $getOwnPropertyNames = __webpack_require__(44).f; +var toIndexedObject = __webpack_require__(10); + +var $getOwnPropertyNames = (__webpack_require__(52).f); + +var arraySlice = __webpack_require__(72); -var toString = {}.toString; var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : []; var getWindowNames = function (it) { try { return $getOwnPropertyNames(it); } catch (error) { - return windowNames.slice(); + return arraySlice(windowNames); } }; // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window module.exports.f = function getOwnPropertyNames(it) { - return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : $getOwnPropertyNames(toIndexedObject(it)); + return windowNames && classof(it) == 'Window' ? getWindowNames(it) : $getOwnPropertyNames(toIndexedObject(it)); }; /***/ }), -/* 60 */ +/* 72 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var global = __webpack_require__(3); + +var toAbsoluteIndex = __webpack_require__(55); + +var lengthOfArrayLike = __webpack_require__(57); + +var createProperty = __webpack_require__(73); + +var Array = global.Array; +var max = Math.max; + +module.exports = function (O, start, end) { + var length = lengthOfArrayLike(O); + var k = toAbsoluteIndex(start, length); + var fin = toAbsoluteIndex(end === undefined ? length : end, length); + var result = Array(max(fin - k, 0)); + + for (var n = 0; k < fin; k++, n++) createProperty(result, n, O[k]); + + result.length = n; + return result; +}; + +/***/ }), +/* 73 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var toPropertyKey = __webpack_require__(15); + +var definePropertyModule = __webpack_require__(41); + +var createPropertyDescriptor = __webpack_require__(9); + +module.exports = function (object, key, value) { + var propertyKey = toPropertyKey(key); + if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));else object[propertyKey] = value; +}; + +/***/ }), +/* 74 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var uncurryThis = __webpack_require__(12); + +module.exports = uncurryThis([].slice); + +/***/ }), +/* 75 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { -var wellKnownSymbol = __webpack_require__(23); +var wellKnownSymbol = __webpack_require__(30); exports.f = wellKnownSymbol; /***/ }), -/* 61 */ +/* 76 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var path = __webpack_require__(62); +var path = __webpack_require__(77); -var has = __webpack_require__(28); +var hasOwn = __webpack_require__(35); -var wrappedWellKnownSymbolModule = __webpack_require__(60); +var wrappedWellKnownSymbolModule = __webpack_require__(75); -var defineProperty = __webpack_require__(34).f; +var defineProperty = (__webpack_require__(41).f); module.exports = function (NAME) { var Symbol = path.Symbol || (path.Symbol = {}); - if (!has(Symbol, NAME)) defineProperty(Symbol, NAME, { + if (!hasOwn(Symbol, NAME)) defineProperty(Symbol, NAME, { value: wrappedWellKnownSymbolModule.f(NAME) }); }; /***/ }), -/* 62 */ +/* 77 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var global = __webpack_require__(3); @@ -2103,19 +2470,19 @@ var global = __webpack_require__(3); module.exports = global; /***/ }), -/* 63 */ +/* 78 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var defineProperty = __webpack_require__(34).f; +var defineProperty = (__webpack_require__(41).f); -var has = __webpack_require__(28); +var hasOwn = __webpack_require__(35); -var wellKnownSymbol = __webpack_require__(23); +var wellKnownSymbol = __webpack_require__(30); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); module.exports = function (it, TAG, STATIC) { - if (it && !has(it = STATIC ? it : it.prototype, TO_STRING_TAG)) { + if (it && !hasOwn(it = STATIC ? it : it.prototype, TO_STRING_TAG)) { defineProperty(it, TO_STRING_TAG, { configurable: true, value: TAG @@ -2124,20 +2491,22 @@ module.exports = function (it, TAG, STATIC) { }; /***/ }), -/* 64 */ +/* 79 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var bind = __webpack_require__(65); +var bind = __webpack_require__(80); -var IndexedObject = __webpack_require__(10); +var uncurryThis = __webpack_require__(12); -var toObject = __webpack_require__(29); +var IndexedObject = __webpack_require__(11); -var toLength = __webpack_require__(47); +var toObject = __webpack_require__(36); -var arraySpeciesCreate = __webpack_require__(67); +var lengthOfArrayLike = __webpack_require__(57); -var push = [].push; // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation +var arraySpeciesCreate = __webpack_require__(81); + +var push = uncurryThis([].push); // `Array.prototype.{ forEach, map, filter, some, every, find, findIndex, filterReject }` methods implementation var createMethod = function (TYPE) { var IS_MAP = TYPE == 1; @@ -2150,8 +2519,8 @@ var createMethod = function (TYPE) { return function ($this, callbackfn, that, specificCreate) { var O = toObject($this); var self = IndexedObject(O); - var boundFunction = bind(callbackfn, that, 3); - var length = toLength(self.length); + var boundFunction = bind(callbackfn, that); + var length = lengthOfArrayLike(self); var index = 0; var create = specificCreate || arraySpeciesCreate; var target = IS_MAP ? create($this, length) : IS_FILTER || IS_FILTER_REJECT ? create($this, 0) : undefined; @@ -2177,7 +2546,7 @@ var createMethod = function (TYPE) { // findIndex case 2: - push.call(target, value); + push(target, value); // filter } else switch (TYPE) { case 4: @@ -2185,7 +2554,7 @@ var createMethod = function (TYPE) { // every case 7: - push.call(target, value); + push(target, value); // filterReject } } @@ -2223,60 +2592,29 @@ module.exports = { }; /***/ }), -/* 65 */ +/* 80 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var aFunction = __webpack_require__(66); // optional / simple context binding +var uncurryThis = __webpack_require__(12); +var aCallable = __webpack_require__(27); -module.exports = function (fn, that, length) { - aFunction(fn); - if (that === undefined) return fn; +var bind = uncurryThis(uncurryThis.bind); // optional / simple context binding - switch (length) { - case 0: - return function () { - return fn.call(that); - }; - - case 1: - return function (a) { - return fn.call(that, a); - }; - - case 2: - return function (a, b) { - return fn.call(that, a, b); - }; - - case 3: - return function (a, b, c) { - return fn.call(that, a, b, c); - }; - } - - return function () { +module.exports = function (fn, that) { + aCallable(fn); + return that === undefined ? fn : bind ? bind(fn, that) : function + /* ...args */ + () { return fn.apply(that, arguments); }; }; /***/ }), -/* 66 */ -/***/ ((module) => { - -module.exports = function (it) { - if (typeof it != 'function') { - throw TypeError(String(it) + ' is not a function'); - } - - return it; -}; - -/***/ }), -/* 67 */ +/* 81 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var arraySpeciesConstructor = __webpack_require__(68); // `ArraySpeciesCreate` abstract operation +var arraySpeciesConstructor = __webpack_require__(82); // `ArraySpeciesCreate` abstract operation // https://tc39.es/ecma262/#sec-arrayspeciescreate @@ -2285,16 +2623,21 @@ module.exports = function (originalArray, length) { }; /***/ }), -/* 68 */ +/* 82 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var isObject = __webpack_require__(15); +var global = __webpack_require__(3); -var isArray = __webpack_require__(53); +var isArray = __webpack_require__(63); -var wellKnownSymbol = __webpack_require__(23); +var isConstructor = __webpack_require__(83); -var SPECIES = wellKnownSymbol('species'); // a part of `ArraySpeciesCreate` abstract operation +var isObject = __webpack_require__(17); + +var wellKnownSymbol = __webpack_require__(30); + +var SPECIES = wellKnownSymbol('species'); +var Array = global.Array; // a part of `ArraySpeciesCreate` abstract operation // https://tc39.es/ecma262/#sec-arrayspeciescreate module.exports = function (originalArray) { @@ -2303,7 +2646,7 @@ module.exports = function (originalArray) { if (isArray(originalArray)) { C = originalArray.constructor; // cross-realm fallback - if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;else if (isObject(C)) { + if (isConstructor(C) && (C === Array || isArray(C.prototype))) C = undefined;else if (isObject(C)) { C = C[SPECIES]; if (C === null) C = undefined; } @@ -2313,7 +2656,67 @@ module.exports = function (originalArray) { }; /***/ }), -/* 69 */ +/* 83 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var uncurryThis = __webpack_require__(12); + +var fails = __webpack_require__(6); + +var isCallable = __webpack_require__(18); + +var classof = __webpack_require__(65); + +var getBuiltIn = __webpack_require__(20); + +var inspectSource = __webpack_require__(44); + +var noop = function () { + /* empty */ +}; + +var empty = []; +var construct = getBuiltIn('Reflect', 'construct'); +var constructorRegExp = /^\s*(?:class|function)\b/; +var exec = uncurryThis(constructorRegExp.exec); +var INCORRECT_TO_STRING = !constructorRegExp.exec(noop); + +var isConstructorModern = function (argument) { + if (!isCallable(argument)) return false; + + try { + construct(noop, empty, argument); + return true; + } catch (error) { + return false; + } +}; + +var isConstructorLegacy = function (argument) { + if (!isCallable(argument)) return false; + + switch (classof(argument)) { + case 'AsyncFunction': + case 'GeneratorFunction': + case 'AsyncGeneratorFunction': + return false; + // we can't check .prototype since constructors produced by .bind haven't it + } + + return INCORRECT_TO_STRING || !!exec(constructorRegExp, inspectSource(argument)); +}; // `IsConstructor` abstract operation +// https://tc39.es/ecma262/#sec-isconstructor + + +module.exports = !construct || fails(function () { + var called; + return isConstructorModern(isConstructorModern.call) || !isConstructorModern(Object) || !isConstructorModern(function () { + called = true; + }) || called; +}) ? isConstructorLegacy : isConstructorModern; + +/***/ }), +/* 84 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -2327,41 +2730,51 @@ var DESCRIPTORS = __webpack_require__(5); var global = __webpack_require__(3); -var has = __webpack_require__(28); +var uncurryThis = __webpack_require__(12); -var isObject = __webpack_require__(15); +var hasOwn = __webpack_require__(35); -var defineProperty = __webpack_require__(34).f; +var isCallable = __webpack_require__(18); -var copyConstructorProperties = __webpack_require__(42); +var isPrototypeOf = __webpack_require__(21); + +var toString = __webpack_require__(64); + +var defineProperty = (__webpack_require__(41).f); + +var copyConstructorProperties = __webpack_require__(50); var NativeSymbol = global.Symbol; +var SymbolPrototype = NativeSymbol && NativeSymbol.prototype; -if (DESCRIPTORS && typeof NativeSymbol == 'function' && (!('description' in NativeSymbol.prototype) || // Safari 12 bug +if (DESCRIPTORS && isCallable(NativeSymbol) && (!('description' in SymbolPrototype) || // Safari 12 bug NativeSymbol().description !== undefined)) { var EmptyStringDescriptionStore = {}; // wrap Symbol constructor for correct work with undefined description var SymbolWrapper = function Symbol() { - var description = arguments.length < 1 || arguments[0] === undefined ? undefined : String(arguments[0]); - var result = this instanceof SymbolWrapper ? new NativeSymbol(description) // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)' + var description = arguments.length < 1 || arguments[0] === undefined ? undefined : toString(arguments[0]); + var result = isPrototypeOf(SymbolPrototype, this) ? new NativeSymbol(description) // in Edge 13, String(Symbol(undefined)) === 'Symbol(undefined)' : description === undefined ? NativeSymbol() : NativeSymbol(description); if (description === '') EmptyStringDescriptionStore[result] = true; return result; }; copyConstructorProperties(SymbolWrapper, NativeSymbol); - var symbolPrototype = SymbolWrapper.prototype = NativeSymbol.prototype; - symbolPrototype.constructor = SymbolWrapper; - var symbolToString = symbolPrototype.toString; - var native = String(NativeSymbol('test')) == 'Symbol(test)'; + SymbolWrapper.prototype = SymbolPrototype; + SymbolPrototype.constructor = SymbolWrapper; + var NATIVE_SYMBOL = String(NativeSymbol('test')) == 'Symbol(test)'; + var symbolToString = uncurryThis(SymbolPrototype.toString); + var symbolValueOf = uncurryThis(SymbolPrototype.valueOf); var regexp = /^Symbol\((.*)\)[^)]+$/; - defineProperty(symbolPrototype, 'description', { + var replace = uncurryThis(''.replace); + var stringSlice = uncurryThis(''.slice); + defineProperty(SymbolPrototype, 'description', { configurable: true, get: function description() { - var symbol = isObject(this) ? this.valueOf() : this; - var string = symbolToString.call(symbol); - if (has(EmptyStringDescriptionStore, symbol)) return ''; - var desc = native ? string.slice(7, -1) : string.replace(regexp, '$1'); + var symbol = symbolValueOf(this); + var string = symbolToString(symbol); + if (hasOwn(EmptyStringDescriptionStore, symbol)) return ''; + var desc = NATIVE_SYMBOL ? stringSlice(string, 7, -1) : replace(string, regexp, '$1'); return desc === '' ? undefined : desc; } }); @@ -2374,137 +2787,137 @@ NativeSymbol().description !== undefined)) { } /***/ }), -/* 70 */ +/* 85 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var defineWellKnownSymbol = __webpack_require__(61); // `Symbol.asyncIterator` well-known symbol +var defineWellKnownSymbol = __webpack_require__(76); // `Symbol.asyncIterator` well-known symbol // https://tc39.es/ecma262/#sec-symbol.asynciterator defineWellKnownSymbol('asyncIterator'); /***/ }), -/* 71 */ +/* 86 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var defineWellKnownSymbol = __webpack_require__(61); // `Symbol.hasInstance` well-known symbol +var defineWellKnownSymbol = __webpack_require__(76); // `Symbol.hasInstance` well-known symbol // https://tc39.es/ecma262/#sec-symbol.hasinstance defineWellKnownSymbol('hasInstance'); /***/ }), -/* 72 */ +/* 87 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var defineWellKnownSymbol = __webpack_require__(61); // `Symbol.isConcatSpreadable` well-known symbol +var defineWellKnownSymbol = __webpack_require__(76); // `Symbol.isConcatSpreadable` well-known symbol // https://tc39.es/ecma262/#sec-symbol.isconcatspreadable defineWellKnownSymbol('isConcatSpreadable'); /***/ }), -/* 73 */ +/* 88 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var defineWellKnownSymbol = __webpack_require__(61); // `Symbol.iterator` well-known symbol +var defineWellKnownSymbol = __webpack_require__(76); // `Symbol.iterator` well-known symbol // https://tc39.es/ecma262/#sec-symbol.iterator defineWellKnownSymbol('iterator'); /***/ }), -/* 74 */ +/* 89 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var defineWellKnownSymbol = __webpack_require__(61); // `Symbol.match` well-known symbol +var defineWellKnownSymbol = __webpack_require__(76); // `Symbol.match` well-known symbol // https://tc39.es/ecma262/#sec-symbol.match defineWellKnownSymbol('match'); /***/ }), -/* 75 */ +/* 90 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var defineWellKnownSymbol = __webpack_require__(61); // `Symbol.matchAll` well-known symbol +var defineWellKnownSymbol = __webpack_require__(76); // `Symbol.matchAll` well-known symbol // https://tc39.es/ecma262/#sec-symbol.matchall defineWellKnownSymbol('matchAll'); /***/ }), -/* 76 */ +/* 91 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var defineWellKnownSymbol = __webpack_require__(61); // `Symbol.replace` well-known symbol +var defineWellKnownSymbol = __webpack_require__(76); // `Symbol.replace` well-known symbol // https://tc39.es/ecma262/#sec-symbol.replace defineWellKnownSymbol('replace'); /***/ }), -/* 77 */ +/* 92 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var defineWellKnownSymbol = __webpack_require__(61); // `Symbol.search` well-known symbol +var defineWellKnownSymbol = __webpack_require__(76); // `Symbol.search` well-known symbol // https://tc39.es/ecma262/#sec-symbol.search defineWellKnownSymbol('search'); /***/ }), -/* 78 */ +/* 93 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var defineWellKnownSymbol = __webpack_require__(61); // `Symbol.species` well-known symbol +var defineWellKnownSymbol = __webpack_require__(76); // `Symbol.species` well-known symbol // https://tc39.es/ecma262/#sec-symbol.species defineWellKnownSymbol('species'); /***/ }), -/* 79 */ +/* 94 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var defineWellKnownSymbol = __webpack_require__(61); // `Symbol.split` well-known symbol +var defineWellKnownSymbol = __webpack_require__(76); // `Symbol.split` well-known symbol // https://tc39.es/ecma262/#sec-symbol.split defineWellKnownSymbol('split'); /***/ }), -/* 80 */ +/* 95 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var defineWellKnownSymbol = __webpack_require__(61); // `Symbol.toPrimitive` well-known symbol +var defineWellKnownSymbol = __webpack_require__(76); // `Symbol.toPrimitive` well-known symbol // https://tc39.es/ecma262/#sec-symbol.toprimitive defineWellKnownSymbol('toPrimitive'); /***/ }), -/* 81 */ +/* 96 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var defineWellKnownSymbol = __webpack_require__(61); // `Symbol.toStringTag` well-known symbol +var defineWellKnownSymbol = __webpack_require__(76); // `Symbol.toStringTag` well-known symbol // https://tc39.es/ecma262/#sec-symbol.tostringtag defineWellKnownSymbol('toStringTag'); /***/ }), -/* 82 */ +/* 97 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var defineWellKnownSymbol = __webpack_require__(61); // `Symbol.unscopables` well-known symbol +var defineWellKnownSymbol = __webpack_require__(76); // `Symbol.unscopables` well-known symbol // https://tc39.es/ecma262/#sec-symbol.unscopables defineWellKnownSymbol('unscopables'); /***/ }), -/* 83 */ +/* 98 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -2512,42 +2925,68 @@ defineWellKnownSymbol('unscopables'); var $ = __webpack_require__(2); -var getPrototypeOf = __webpack_require__(84); +var global = __webpack_require__(3); -var setPrototypeOf = __webpack_require__(86); +var isPrototypeOf = __webpack_require__(21); -var create = __webpack_require__(55); +var getPrototypeOf = __webpack_require__(99); -var createNonEnumerableProperty = __webpack_require__(33); +var setPrototypeOf = __webpack_require__(101); -var createPropertyDescriptor = __webpack_require__(8); +var copyConstructorProperties = __webpack_require__(50); -var iterate = __webpack_require__(88); +var create = __webpack_require__(67); -var toString = __webpack_require__(54); +var createNonEnumerableProperty = __webpack_require__(40); -var $AggregateError = function AggregateError(errors, message) { - var that = this; - if (!(that instanceof $AggregateError)) return new $AggregateError(errors, message); +var createPropertyDescriptor = __webpack_require__(9); + +var clearErrorStack = __webpack_require__(103); + +var installErrorCause = __webpack_require__(104); + +var iterate = __webpack_require__(105); + +var normalizeStringArgument = __webpack_require__(111); + +var wellKnownSymbol = __webpack_require__(30); + +var ERROR_STACK_INSTALLABLE = __webpack_require__(112); + +var TO_STRING_TAG = wellKnownSymbol('toStringTag'); +var Error = global.Error; +var push = [].push; + +var $AggregateError = function AggregateError(errors, message +/* , options */ +) { + var options = arguments.length > 2 ? arguments[2] : undefined; + var isInstance = isPrototypeOf(AggregateErrorPrototype, this); + var that; if (setPrototypeOf) { - // eslint-disable-next-line unicorn/error-message -- expected - that = setPrototypeOf(new Error(undefined), getPrototypeOf(that)); + that = setPrototypeOf(new Error(undefined), isInstance ? getPrototypeOf(this) : AggregateErrorPrototype); + } else { + that = isInstance ? this : create(AggregateErrorPrototype); + createNonEnumerableProperty(that, TO_STRING_TAG, 'Error'); } - if (message !== undefined) createNonEnumerableProperty(that, 'message', toString(message)); + createNonEnumerableProperty(that, 'message', normalizeStringArgument(message, '')); + if (ERROR_STACK_INSTALLABLE) createNonEnumerableProperty(that, 'stack', clearErrorStack(that.stack, 1)); + installErrorCause(that, options); var errorsArray = []; - iterate(errors, errorsArray.push, { + iterate(errors, push, { that: errorsArray }); createNonEnumerableProperty(that, 'errors', errorsArray); return that; }; -$AggregateError.prototype = create(Error.prototype, { - constructor: createPropertyDescriptor(5, $AggregateError), - message: createPropertyDescriptor(5, ''), - name: createPropertyDescriptor(5, 'AggregateError') +if (setPrototypeOf) setPrototypeOf($AggregateError, Error);else copyConstructorProperties($AggregateError, Error); +var AggregateErrorPrototype = $AggregateError.prototype = create(Error.prototype, { + constructor: createPropertyDescriptor(1, $AggregateError), + message: createPropertyDescriptor(1, ''), + name: createPropertyDescriptor(1, 'AggregateError') }); // `AggregateError` constructor // https://tc39.es/ecma262/#sec-aggregate-error-constructor @@ -2558,35 +2997,40 @@ $({ }); /***/ }), -/* 84 */ +/* 99 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var has = __webpack_require__(28); +var global = __webpack_require__(3); -var toObject = __webpack_require__(29); +var hasOwn = __webpack_require__(35); -var sharedKey = __webpack_require__(40); +var isCallable = __webpack_require__(18); -var CORRECT_PROTOTYPE_GETTER = __webpack_require__(85); +var toObject = __webpack_require__(36); + +var sharedKey = __webpack_require__(47); + +var CORRECT_PROTOTYPE_GETTER = __webpack_require__(100); var IE_PROTO = sharedKey('IE_PROTO'); +var Object = global.Object; var ObjectPrototype = Object.prototype; // `Object.getPrototypeOf` method // https://tc39.es/ecma262/#sec-object.getprototypeof -// eslint-disable-next-line es/no-object-getprototypeof -- safe module.exports = CORRECT_PROTOTYPE_GETTER ? Object.getPrototypeOf : function (O) { - O = toObject(O); - if (has(O, IE_PROTO)) return O[IE_PROTO]; + var object = toObject(O); + if (hasOwn(object, IE_PROTO)) return object[IE_PROTO]; + var constructor = object.constructor; - if (typeof O.constructor == 'function' && O instanceof O.constructor) { - return O.constructor.prototype; + if (isCallable(constructor) && object instanceof constructor) { + return constructor.prototype; } - return O instanceof Object ? ObjectPrototype : null; + return object instanceof Object ? ObjectPrototype : null; }; /***/ }), -/* 85 */ +/* 100 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var fails = __webpack_require__(6); @@ -2602,13 +3046,15 @@ module.exports = !fails(function () { }); /***/ }), -/* 86 */ +/* 101 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /* eslint-disable no-proto -- safe */ -var anObject = __webpack_require__(35); +var uncurryThis = __webpack_require__(12); -var aPossiblePrototype = __webpack_require__(87); // `Object.setPrototypeOf` method +var anObject = __webpack_require__(42); + +var aPossiblePrototype = __webpack_require__(102); // `Object.setPrototypeOf` method // https://tc39.es/ecma262/#sec-object.setprototypeof // Works with __proto__ only. Old v8 can't work with null proto objects. // eslint-disable-next-line es/no-object-setprototypeof -- safe @@ -2621,8 +3067,8 @@ module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () { try { // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe - setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set; - setter.call(test, []); + setter = uncurryThis(Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set); + setter(test, []); CORRECT_SETTER = test instanceof Array; } catch (error) { /* empty */ @@ -2631,58 +3077,120 @@ module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () { return function setPrototypeOf(O, proto) { anObject(O); aPossiblePrototype(proto); - if (CORRECT_SETTER) setter.call(O, proto);else O.__proto__ = proto; + if (CORRECT_SETTER) setter(O, proto);else O.__proto__ = proto; return O; }; }() : undefined); /***/ }), -/* 87 */ +/* 102 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var isObject = __webpack_require__(15); +var global = __webpack_require__(3); -module.exports = function (it) { - if (!isObject(it) && it !== null) { - throw TypeError("Can't set " + String(it) + ' as a prototype'); - } +var isCallable = __webpack_require__(18); - return it; +var String = global.String; +var TypeError = global.TypeError; + +module.exports = function (argument) { + if (typeof argument == 'object' || isCallable(argument)) return argument; + throw TypeError("Can't set " + String(argument) + ' as a prototype'); }; /***/ }), -/* 88 */ +/* 103 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var anObject = __webpack_require__(35); +var uncurryThis = __webpack_require__(12); -var isArrayIteratorMethod = __webpack_require__(89); +var arraySlice = __webpack_require__(72); -var toLength = __webpack_require__(47); +var replace = uncurryThis(''.replace); +var split = uncurryThis(''.split); +var join = uncurryThis([].join); -var bind = __webpack_require__(65); +var TEST = function (arg) { + return String(Error(arg).stack); +}('zxcasd'); -var getIterator = __webpack_require__(91); +var V8_OR_CHAKRA_STACK_ENTRY = /\n\s*at [^:]*:[^\n]*/; +var IS_V8_OR_CHAKRA_STACK = V8_OR_CHAKRA_STACK_ENTRY.test(TEST); +var IS_FIREFOX_OR_SAFARI_STACK = /@[^\n]*\n/.test(TEST) && !/zxcasd/.test(TEST); -var getIteratorMethod = __webpack_require__(92); +module.exports = function (stack, dropEntries) { + if (typeof stack != 'string') return stack; -var iteratorClose = __webpack_require__(95); + if (IS_V8_OR_CHAKRA_STACK) { + while (dropEntries--) stack = replace(stack, V8_OR_CHAKRA_STACK_ENTRY, ''); + } else if (IS_FIREFOX_OR_SAFARI_STACK) { + return join(arraySlice(split(stack, '\n'), dropEntries), '\n'); + } + + return stack; +}; + +/***/ }), +/* 104 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var isObject = __webpack_require__(17); + +var createNonEnumerableProperty = __webpack_require__(40); // `InstallErrorCause` abstract operation +// https://tc39.es/proposal-error-cause/#sec-errorobjects-install-error-cause + + +module.exports = function (O, options) { + if (isObject(options) && 'cause' in options) { + createNonEnumerableProperty(O, 'cause', options.cause); + } +}; + +/***/ }), +/* 105 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var global = __webpack_require__(3); + +var bind = __webpack_require__(80); + +var call = __webpack_require__(7); + +var anObject = __webpack_require__(42); + +var tryToString = __webpack_require__(28); + +var isArrayIteratorMethod = __webpack_require__(106); + +var lengthOfArrayLike = __webpack_require__(57); + +var isPrototypeOf = __webpack_require__(21); + +var getIterator = __webpack_require__(108); + +var getIteratorMethod = __webpack_require__(109); + +var iteratorClose = __webpack_require__(110); + +var TypeError = global.TypeError; var Result = function (stopped, result) { this.stopped = stopped; this.result = result; }; +var ResultPrototype = Result.prototype; + module.exports = function (iterable, unboundFunction, options) { var that = options && options.that; var AS_ENTRIES = !!(options && options.AS_ENTRIES); var IS_ITERATOR = !!(options && options.IS_ITERATOR); var INTERRUPTED = !!(options && options.INTERRUPTED); - var fn = bind(unboundFunction, that, 1 + AS_ENTRIES + INTERRUPTED); + var fn = bind(unboundFunction, that); var iterator, iterFn, index, length, result, next, step; var stop = function (condition) { - if (iterator) iteratorClose(iterator, 'return', condition); + if (iterator) iteratorClose(iterator, 'normal', condition); return new Result(true, condition); }; @@ -2699,12 +3207,12 @@ module.exports = function (iterable, unboundFunction, options) { iterator = iterable; } else { iterFn = getIteratorMethod(iterable); - if (typeof iterFn != 'function') throw TypeError('Target is not iterable'); // optimisation for array iterators + if (!iterFn) throw TypeError(tryToString(iterable) + ' is not iterable'); // optimisation for array iterators if (isArrayIteratorMethod(iterFn)) { - for (index = 0, length = toLength(iterable.length); length > index; index++) { + for (index = 0, length = lengthOfArrayLike(iterable); length > index; index++) { result = callFn(iterable[index]); - if (result && result instanceof Result) return result; + if (result && isPrototypeOf(ResultPrototype, result)) return result; } return new Result(false); @@ -2715,26 +3223,26 @@ module.exports = function (iterable, unboundFunction, options) { next = iterator.next; - while (!(step = next.call(iterator)).done) { + while (!(step = call(next, iterator)).done) { try { result = callFn(step.value); } catch (error) { iteratorClose(iterator, 'throw', error); } - if (typeof result == 'object' && result && result instanceof Result) return result; + if (typeof result == 'object' && result && isPrototypeOf(ResultPrototype, result)) return result; } return new Result(false); }; /***/ }), -/* 89 */ +/* 106 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var wellKnownSymbol = __webpack_require__(23); +var wellKnownSymbol = __webpack_require__(30); -var Iterators = __webpack_require__(90); +var Iterators = __webpack_require__(107); var ITERATOR = wellKnownSymbol('iterator'); var ArrayPrototype = Array.prototype; // check on default Array iterator @@ -2744,108 +3252,76 @@ module.exports = function (it) { }; /***/ }), -/* 90 */ +/* 107 */ /***/ ((module) => { module.exports = {}; /***/ }), -/* 91 */ +/* 108 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var anObject = __webpack_require__(35); +var global = __webpack_require__(3); -var getIteratorMethod = __webpack_require__(92); +var call = __webpack_require__(7); -module.exports = function (it, usingIterator) { - var iteratorMethod = arguments.length < 2 ? getIteratorMethod(it) : usingIterator; +var aCallable = __webpack_require__(27); - if (typeof iteratorMethod != 'function') { - throw TypeError(String(it) + ' is not iterable'); - } +var anObject = __webpack_require__(42); - return anObject(iteratorMethod.call(it)); +var tryToString = __webpack_require__(28); + +var getIteratorMethod = __webpack_require__(109); + +var TypeError = global.TypeError; + +module.exports = function (argument, usingIterator) { + var iteratorMethod = arguments.length < 2 ? getIteratorMethod(argument) : usingIterator; + if (aCallable(iteratorMethod)) return anObject(call(iteratorMethod, argument)); + throw TypeError(tryToString(argument) + ' is not iterable'); }; /***/ }), -/* 92 */ +/* 109 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var classof = __webpack_require__(93); +var classof = __webpack_require__(65); -var Iterators = __webpack_require__(90); +var getMethod = __webpack_require__(26); -var wellKnownSymbol = __webpack_require__(23); +var Iterators = __webpack_require__(107); + +var wellKnownSymbol = __webpack_require__(30); var ITERATOR = wellKnownSymbol('iterator'); module.exports = function (it) { - if (it != undefined) return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)]; + if (it != undefined) return getMethod(it, ITERATOR) || getMethod(it, '@@iterator') || Iterators[classof(it)]; }; /***/ }), -/* 93 */ +/* 110 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var TO_STRING_TAG_SUPPORT = __webpack_require__(94); +var call = __webpack_require__(7); -var classofRaw = __webpack_require__(11); +var anObject = __webpack_require__(42); -var wellKnownSymbol = __webpack_require__(23); - -var TO_STRING_TAG = wellKnownSymbol('toStringTag'); // ES3 wrong here - -var CORRECT_ARGUMENTS = classofRaw(function () { - return arguments; -}()) == 'Arguments'; // fallback for IE11 Script Access Denied error - -var tryGet = function (it, key) { - try { - return it[key]; - } catch (error) { - /* empty */ - } -}; // getting tag from ES6+ `Object.prototype.toString` - - -module.exports = TO_STRING_TAG_SUPPORT ? classofRaw : function (it) { - var O, tag, result; - return it === undefined ? 'Undefined' : it === null ? 'Null' // @@toStringTag case - : typeof (tag = tryGet(O = Object(it), TO_STRING_TAG)) == 'string' ? tag // builtinTag case - : CORRECT_ARGUMENTS ? classofRaw(O) // ES3 arguments fallback - : (result = classofRaw(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : result; -}; - -/***/ }), -/* 94 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var wellKnownSymbol = __webpack_require__(23); - -var TO_STRING_TAG = wellKnownSymbol('toStringTag'); -var test = {}; -test[TO_STRING_TAG] = 'z'; -module.exports = String(test) === '[object z]'; - -/***/ }), -/* 95 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var anObject = __webpack_require__(35); +var getMethod = __webpack_require__(26); module.exports = function (iterator, kind, value) { var innerResult, innerError; anObject(iterator); try { - innerResult = iterator['return']; + innerResult = getMethod(iterator, 'return'); - if (innerResult === undefined) { + if (!innerResult) { if (kind === 'throw') throw value; return value; } - innerResult = innerResult.call(iterator); + innerResult = call(innerResult, iterator); } catch (error) { innerError = true; innerResult = error; @@ -2858,7 +3334,33 @@ module.exports = function (iterator, kind, value) { }; /***/ }), -/* 96 */ +/* 111 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var toString = __webpack_require__(64); + +module.exports = function (argument, $default) { + return argument === undefined ? arguments.length < 2 ? '' : $default : toString(argument); +}; + +/***/ }), +/* 112 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var fails = __webpack_require__(6); + +var createPropertyDescriptor = __webpack_require__(9); + +module.exports = !fails(function () { + var error = Error('a'); + if (!('stack' in error)) return true; // eslint-disable-next-line es/no-object-defineproperty -- safe + + Object.defineProperty(error, 'stack', createPropertyDescriptor(1, 7)); + return error.stack !== 7; +}); + +/***/ }), +/* 113 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -2866,29 +3368,91 @@ module.exports = function (iterator, kind, value) { var $ = __webpack_require__(2); +var toObject = __webpack_require__(36); + +var lengthOfArrayLike = __webpack_require__(57); + +var toIntegerOrInfinity = __webpack_require__(56); + +var addToUnscopables = __webpack_require__(114); // `Array.prototype.at` method +// https://github.com/tc39/proposal-relative-indexing-method + + +$({ + target: 'Array', + proto: true +}, { + at: function at(index) { + var O = toObject(this); + var len = lengthOfArrayLike(O); + var relativeIndex = toIntegerOrInfinity(index); + var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex; + return k < 0 || k >= len ? undefined : O[k]; + } +}); +addToUnscopables('at'); + +/***/ }), +/* 114 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var wellKnownSymbol = __webpack_require__(30); + +var create = __webpack_require__(67); + +var definePropertyModule = __webpack_require__(41); + +var UNSCOPABLES = wellKnownSymbol('unscopables'); +var ArrayPrototype = Array.prototype; // Array.prototype[@@unscopables] +// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables + +if (ArrayPrototype[UNSCOPABLES] == undefined) { + definePropertyModule.f(ArrayPrototype, UNSCOPABLES, { + configurable: true, + value: create(null) + }); +} // add a key to Array.prototype[@@unscopables] + + +module.exports = function (key) { + ArrayPrototype[UNSCOPABLES][key] = true; +}; + +/***/ }), +/* 115 */ +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var $ = __webpack_require__(2); + +var global = __webpack_require__(3); + var fails = __webpack_require__(6); -var isArray = __webpack_require__(53); +var isArray = __webpack_require__(63); -var isObject = __webpack_require__(15); +var isObject = __webpack_require__(17); -var toObject = __webpack_require__(29); +var toObject = __webpack_require__(36); -var toLength = __webpack_require__(47); +var lengthOfArrayLike = __webpack_require__(57); -var createProperty = __webpack_require__(97); +var createProperty = __webpack_require__(73); -var arraySpeciesCreate = __webpack_require__(67); +var arraySpeciesCreate = __webpack_require__(81); -var arrayMethodHasSpeciesSupport = __webpack_require__(98); +var arrayMethodHasSpeciesSupport = __webpack_require__(116); -var wellKnownSymbol = __webpack_require__(23); +var wellKnownSymbol = __webpack_require__(30); -var V8_VERSION = __webpack_require__(20); +var V8_VERSION = __webpack_require__(24); var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable'); var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; -var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded'; // We can't use this feature detection in V8 since it causes +var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded'; +var TypeError = global.TypeError; // We can't use this feature detection in V8 since it causes // deoptimization and serious performance degradation // https://github.com/zloirock/core-js/issues/679 @@ -2925,7 +3489,7 @@ $({ E = i === -1 ? O : arguments[i]; if (isConcatSpreadable(E)) { - len = toLength(E.length); + len = lengthOfArrayLike(E); if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED); for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]); @@ -2941,32 +3505,14 @@ $({ }); /***/ }), -/* 97 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var toPropertyKey = __webpack_require__(13); - -var definePropertyModule = __webpack_require__(34); - -var createPropertyDescriptor = __webpack_require__(8); - -module.exports = function (object, key, value) { - var propertyKey = toPropertyKey(key); - if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));else object[propertyKey] = value; -}; - -/***/ }), -/* 98 */ +/* 116 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var fails = __webpack_require__(6); -var wellKnownSymbol = __webpack_require__(23); +var wellKnownSymbol = __webpack_require__(30); -var V8_VERSION = __webpack_require__(20); +var V8_VERSION = __webpack_require__(24); var SPECIES = wellKnownSymbol('species'); @@ -2989,14 +3535,14 @@ module.exports = function (METHOD_NAME) { }; /***/ }), -/* 99 */ +/* 117 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var copyWithin = __webpack_require__(100); +var copyWithin = __webpack_require__(118); -var addToUnscopables = __webpack_require__(101); // `Array.prototype.copyWithin` method +var addToUnscopables = __webpack_require__(114); // `Array.prototype.copyWithin` method // https://tc39.es/ecma262/#sec-array.prototype.copywithin @@ -3010,17 +3556,17 @@ $({ addToUnscopables('copyWithin'); /***/ }), -/* 100 */ +/* 118 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var toObject = __webpack_require__(29); +var toObject = __webpack_require__(36); -var toAbsoluteIndex = __webpack_require__(49); +var toAbsoluteIndex = __webpack_require__(55); -var toLength = __webpack_require__(47); +var lengthOfArrayLike = __webpack_require__(57); var min = Math.min; // `Array.prototype.copyWithin` method implementation // https://tc39.es/ecma262/#sec-array.prototype.copywithin @@ -3032,7 +3578,7 @@ module.exports = [].copyWithin || function copyWithin(target /* = 0, end = @length */ ) { var O = toObject(this); - var len = toLength(O.length); + var len = lengthOfArrayLike(O); var to = toAbsoluteIndex(target, len); var from = toAbsoluteIndex(start, len); var end = arguments.length > 2 ? arguments[2] : undefined; @@ -3055,33 +3601,7 @@ module.exports = [].copyWithin || function copyWithin(target }; /***/ }), -/* 101 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var wellKnownSymbol = __webpack_require__(23); - -var create = __webpack_require__(55); - -var definePropertyModule = __webpack_require__(34); - -var UNSCOPABLES = wellKnownSymbol('unscopables'); -var ArrayPrototype = Array.prototype; // Array.prototype[@@unscopables] -// https://tc39.es/ecma262/#sec-array.prototype-@@unscopables - -if (ArrayPrototype[UNSCOPABLES] == undefined) { - definePropertyModule.f(ArrayPrototype, UNSCOPABLES, { - configurable: true, - value: create(null) - }); -} // add a key to Array.prototype[@@unscopables] - - -module.exports = function (key) { - ArrayPrototype[UNSCOPABLES][key] = true; -}; - -/***/ }), -/* 102 */ +/* 119 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -3089,9 +3609,9 @@ module.exports = function (key) { var $ = __webpack_require__(2); -var $every = __webpack_require__(64).every; +var $every = (__webpack_require__(79).every); -var arrayMethodIsStrict = __webpack_require__(103); +var arrayMethodIsStrict = __webpack_require__(120); var STRICT_METHOD = arrayMethodIsStrict('every'); // `Array.prototype.every` method // https://tc39.es/ecma262/#sec-array.prototype.every @@ -3109,7 +3629,7 @@ $({ }); /***/ }), -/* 103 */ +/* 120 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -3128,14 +3648,14 @@ module.exports = function (METHOD_NAME, argument) { }; /***/ }), -/* 104 */ +/* 121 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var fill = __webpack_require__(105); +var fill = __webpack_require__(122); -var addToUnscopables = __webpack_require__(101); // `Array.prototype.fill` method +var addToUnscopables = __webpack_require__(114); // `Array.prototype.fill` method // https://tc39.es/ecma262/#sec-array.prototype.fill @@ -3149,17 +3669,17 @@ $({ addToUnscopables('fill'); /***/ }), -/* 105 */ +/* 122 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var toObject = __webpack_require__(29); +var toObject = __webpack_require__(36); -var toAbsoluteIndex = __webpack_require__(49); +var toAbsoluteIndex = __webpack_require__(55); -var toLength = __webpack_require__(47); // `Array.prototype.fill` method implementation +var lengthOfArrayLike = __webpack_require__(57); // `Array.prototype.fill` method implementation // https://tc39.es/ecma262/#sec-array.prototype.fill @@ -3167,7 +3687,7 @@ module.exports = function fill(value /* , start = 0, end = @length */ ) { var O = toObject(this); - var length = toLength(O.length); + var length = lengthOfArrayLike(O); var argumentsLength = arguments.length; var index = toAbsoluteIndex(argumentsLength > 1 ? arguments[1] : undefined, length); var end = argumentsLength > 2 ? arguments[2] : undefined; @@ -3179,7 +3699,7 @@ module.exports = function fill(value }; /***/ }), -/* 106 */ +/* 123 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -3187,9 +3707,9 @@ module.exports = function fill(value var $ = __webpack_require__(2); -var $filter = __webpack_require__(64).filter; +var $filter = (__webpack_require__(79).filter); -var arrayMethodHasSpeciesSupport = __webpack_require__(98); +var arrayMethodHasSpeciesSupport = __webpack_require__(116); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('filter'); // `Array.prototype.filter` method // https://tc39.es/ecma262/#sec-array.prototype.filter @@ -3208,7 +3728,7 @@ $({ }); /***/ }), -/* 107 */ +/* 124 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -3216,9 +3736,9 @@ $({ var $ = __webpack_require__(2); -var $find = __webpack_require__(64).find; +var $find = (__webpack_require__(79).find); -var addToUnscopables = __webpack_require__(101); +var addToUnscopables = __webpack_require__(114); var FIND = 'find'; var SKIPS_HOLES = true; // Shouldn't skip holes @@ -3243,7 +3763,7 @@ $({ addToUnscopables(FIND); /***/ }), -/* 108 */ +/* 125 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -3251,9 +3771,9 @@ addToUnscopables(FIND); var $ = __webpack_require__(2); -var $findIndex = __webpack_require__(64).findIndex; +var $findIndex = (__webpack_require__(79).findIndex); -var addToUnscopables = __webpack_require__(101); +var addToUnscopables = __webpack_require__(114); var FIND_INDEX = 'findIndex'; var SKIPS_HOLES = true; // Shouldn't skip holes @@ -3278,7 +3798,7 @@ $({ addToUnscopables(FIND_INDEX); /***/ }), -/* 109 */ +/* 126 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -3286,15 +3806,15 @@ addToUnscopables(FIND_INDEX); var $ = __webpack_require__(2); -var flattenIntoArray = __webpack_require__(110); +var flattenIntoArray = __webpack_require__(127); -var toObject = __webpack_require__(29); +var toObject = __webpack_require__(36); -var toLength = __webpack_require__(47); +var lengthOfArrayLike = __webpack_require__(57); -var toInteger = __webpack_require__(48); +var toIntegerOrInfinity = __webpack_require__(56); -var arraySpeciesCreate = __webpack_require__(67); // `Array.prototype.flat` method +var arraySpeciesCreate = __webpack_require__(81); // `Array.prototype.flat` method // https://tc39.es/ecma262/#sec-array.prototype.flat @@ -3302,43 +3822,49 @@ $({ target: 'Array', proto: true }, { - flat: function flat() { + flat: function + /* depthArg = 1 */ + flat() { var depthArg = arguments.length ? arguments[0] : undefined; var O = toObject(this); - var sourceLen = toLength(O.length); + var sourceLen = lengthOfArrayLike(O); var A = arraySpeciesCreate(O, 0); - A.length = flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toInteger(depthArg)); + A.length = flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toIntegerOrInfinity(depthArg)); return A; } }); /***/ }), -/* 110 */ +/* 127 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var isArray = __webpack_require__(53); +var global = __webpack_require__(3); -var toLength = __webpack_require__(47); +var isArray = __webpack_require__(63); -var bind = __webpack_require__(65); // `FlattenIntoArray` abstract operation +var lengthOfArrayLike = __webpack_require__(57); + +var bind = __webpack_require__(80); + +var TypeError = global.TypeError; // `FlattenIntoArray` abstract operation // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray - var flattenIntoArray = function (target, original, source, sourceLen, start, depth, mapper, thisArg) { var targetIndex = start; var sourceIndex = 0; - var mapFn = mapper ? bind(mapper, thisArg, 3) : false; - var element; + var mapFn = mapper ? bind(mapper, thisArg) : false; + var element, elementLen; while (sourceIndex < sourceLen) { if (sourceIndex in source) { element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex]; if (depth > 0 && isArray(element)) { - targetIndex = flattenIntoArray(target, original, element, toLength(element.length), targetIndex, depth - 1) - 1; + elementLen = lengthOfArrayLike(element); + targetIndex = flattenIntoArray(target, original, element, elementLen, targetIndex, depth - 1) - 1; } else { if (targetIndex >= 0x1FFFFFFFFFFFFF) throw TypeError('Exceed the acceptable array length'); target[targetIndex] = element; @@ -3356,7 +3882,7 @@ var flattenIntoArray = function (target, original, source, sourceLen, start, dep module.exports = flattenIntoArray; /***/ }), -/* 111 */ +/* 128 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -3364,15 +3890,15 @@ module.exports = flattenIntoArray; var $ = __webpack_require__(2); -var flattenIntoArray = __webpack_require__(110); +var flattenIntoArray = __webpack_require__(127); -var toObject = __webpack_require__(29); +var aCallable = __webpack_require__(27); -var toLength = __webpack_require__(47); +var toObject = __webpack_require__(36); -var aFunction = __webpack_require__(66); +var lengthOfArrayLike = __webpack_require__(57); -var arraySpeciesCreate = __webpack_require__(67); // `Array.prototype.flatMap` method +var arraySpeciesCreate = __webpack_require__(81); // `Array.prototype.flatMap` method // https://tc39.es/ecma262/#sec-array.prototype.flatmap @@ -3384,9 +3910,9 @@ $({ /* , thisArg */ ) { var O = toObject(this); - var sourceLen = toLength(O.length); + var sourceLen = lengthOfArrayLike(O); var A; - aFunction(callbackfn); + aCallable(callbackfn); A = arraySpeciesCreate(O, 0); A.length = flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments.length > 1 ? arguments[1] : undefined); return A; @@ -3394,7 +3920,7 @@ $({ }); /***/ }), -/* 112 */ +/* 129 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -3402,7 +3928,7 @@ $({ var $ = __webpack_require__(2); -var forEach = __webpack_require__(113); // `Array.prototype.forEach` method +var forEach = __webpack_require__(130); // `Array.prototype.forEach` method // https://tc39.es/ecma262/#sec-array.prototype.foreach // eslint-disable-next-line es/no-array-prototype-foreach -- safe @@ -3416,15 +3942,15 @@ $({ }); /***/ }), -/* 113 */ +/* 130 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var $forEach = __webpack_require__(64).forEach; +var $forEach = (__webpack_require__(79).forEach); -var arrayMethodIsStrict = __webpack_require__(103); +var arrayMethodIsStrict = __webpack_require__(120); var STRICT_METHOD = arrayMethodIsStrict('forEach'); // `Array.prototype.forEach` method implementation // https://tc39.es/ecma262/#sec-array.prototype.foreach @@ -3436,14 +3962,14 @@ module.exports = !STRICT_METHOD ? function forEach(callbackfn } : [].forEach; /***/ }), -/* 114 */ +/* 131 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var from = __webpack_require__(115); +var from = __webpack_require__(132); -var checkCorrectnessOfIteration = __webpack_require__(117); +var checkCorrectnessOfIteration = __webpack_require__(134); var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) { // eslint-disable-next-line es/no-array-from -- required for testing @@ -3460,55 +3986,62 @@ $({ }); /***/ }), -/* 115 */ +/* 132 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var bind = __webpack_require__(65); +var global = __webpack_require__(3); -var toObject = __webpack_require__(29); +var bind = __webpack_require__(80); -var callWithSafeIterationClosing = __webpack_require__(116); +var call = __webpack_require__(7); -var isArrayIteratorMethod = __webpack_require__(89); +var toObject = __webpack_require__(36); -var toLength = __webpack_require__(47); +var callWithSafeIterationClosing = __webpack_require__(133); -var createProperty = __webpack_require__(97); +var isArrayIteratorMethod = __webpack_require__(106); -var getIterator = __webpack_require__(91); +var isConstructor = __webpack_require__(83); -var getIteratorMethod = __webpack_require__(92); // `Array.from` method implementation +var lengthOfArrayLike = __webpack_require__(57); + +var createProperty = __webpack_require__(73); + +var getIterator = __webpack_require__(108); + +var getIteratorMethod = __webpack_require__(109); + +var Array = global.Array; // `Array.from` method implementation // https://tc39.es/ecma262/#sec-array.from - module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undefined */ ) { var O = toObject(arrayLike); - var C = typeof this == 'function' ? this : Array; + var IS_CONSTRUCTOR = isConstructor(this); var argumentsLength = arguments.length; var mapfn = argumentsLength > 1 ? arguments[1] : undefined; var mapping = mapfn !== undefined; + if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined); var iteratorMethod = getIteratorMethod(O); var index = 0; - var length, result, step, iterator, next, value; - if (mapping) mapfn = bind(mapfn, argumentsLength > 2 ? arguments[2] : undefined, 2); // if the target is not iterable or it's an array with the default iterator - use a simple case + var length, result, step, iterator, next, value; // if the target is not iterable or it's an array with the default iterator - use a simple case - if (iteratorMethod != undefined && !(C == Array && isArrayIteratorMethod(iteratorMethod))) { + if (iteratorMethod && !(this == Array && isArrayIteratorMethod(iteratorMethod))) { iterator = getIterator(O, iteratorMethod); next = iterator.next; - result = new C(); + result = IS_CONSTRUCTOR ? new this() : []; - for (; !(step = next.call(iterator)).done; index++) { + for (; !(step = call(next, iterator)).done; index++) { value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value; createProperty(result, index, value); } } else { - length = toLength(O.length); - result = new C(length); + length = lengthOfArrayLike(O); + result = IS_CONSTRUCTOR ? new this(length) : Array(length); for (; length > index; index++) { value = mapping ? mapfn(O[index], index) : O[index]; @@ -3521,12 +4054,12 @@ module.exports = function from(arrayLike }; /***/ }), -/* 116 */ +/* 133 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var anObject = __webpack_require__(35); +var anObject = __webpack_require__(42); -var iteratorClose = __webpack_require__(95); // call something on iterator step with safe closing on error +var iteratorClose = __webpack_require__(110); // call something on iterator step with safe closing on error module.exports = function (iterator, fn, value, ENTRIES) { @@ -3538,10 +4071,10 @@ module.exports = function (iterator, fn, value, ENTRIES) { }; /***/ }), -/* 117 */ +/* 134 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var wellKnownSymbol = __webpack_require__(23); +var wellKnownSymbol = __webpack_require__(30); var ITERATOR = wellKnownSymbol('iterator'); var SAFE_CLOSING = false; @@ -3597,7 +4130,7 @@ module.exports = function (exec, SKIP_CLOSING) { }; /***/ }), -/* 118 */ +/* 135 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -3605,9 +4138,9 @@ module.exports = function (exec, SKIP_CLOSING) { var $ = __webpack_require__(2); -var $includes = __webpack_require__(46).includes; +var $includes = (__webpack_require__(54).includes); -var addToUnscopables = __webpack_require__(101); // `Array.prototype.includes` method +var addToUnscopables = __webpack_require__(114); // `Array.prototype.includes` method // https://tc39.es/ecma262/#sec-array.prototype.includes @@ -3625,7 +4158,7 @@ $({ addToUnscopables('includes'); /***/ }), -/* 119 */ +/* 136 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -3634,12 +4167,14 @@ addToUnscopables('includes'); var $ = __webpack_require__(2); -var $indexOf = __webpack_require__(46).indexOf; +var uncurryThis = __webpack_require__(12); -var arrayMethodIsStrict = __webpack_require__(103); +var $IndexOf = (__webpack_require__(54).indexOf); -var nativeIndexOf = [].indexOf; -var NEGATIVE_ZERO = !!nativeIndexOf && 1 / [1].indexOf(1, -0) < 0; +var arrayMethodIsStrict = __webpack_require__(120); + +var un$IndexOf = uncurryThis([].indexOf); +var NEGATIVE_ZERO = !!un$IndexOf && 1 / un$IndexOf([1], 1, -0) < 0; var STRICT_METHOD = arrayMethodIsStrict('indexOf'); // `Array.prototype.indexOf` method // https://tc39.es/ecma262/#sec-array.prototype.indexof @@ -3651,18 +4186,19 @@ $({ indexOf: function indexOf(searchElement /* , fromIndex = 0 */ ) { + var fromIndex = arguments.length > 1 ? arguments[1] : undefined; return NEGATIVE_ZERO // convert -0 to +0 - ? nativeIndexOf.apply(this, arguments) || 0 : $indexOf(this, searchElement, arguments.length > 1 ? arguments[1] : undefined); + ? un$IndexOf(this, searchElement, fromIndex) || 0 : $IndexOf(this, searchElement, fromIndex); } }); /***/ }), -/* 120 */ +/* 137 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var isArray = __webpack_require__(53); // `Array.isArray` method +var isArray = __webpack_require__(63); // `Array.isArray` method // https://tc39.es/ecma262/#sec-array.isarray @@ -3674,21 +4210,21 @@ $({ }); /***/ }), -/* 121 */ +/* 138 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var toIndexedObject = __webpack_require__(9); +var toIndexedObject = __webpack_require__(10); -var addToUnscopables = __webpack_require__(101); +var addToUnscopables = __webpack_require__(114); -var Iterators = __webpack_require__(90); +var Iterators = __webpack_require__(107); -var InternalStateModule = __webpack_require__(38); +var InternalStateModule = __webpack_require__(45); -var defineIterator = __webpack_require__(122); +var defineIterator = __webpack_require__(139); var ARRAY_ITERATOR = 'Array Iterator'; var setInternalState = InternalStateModule.set; @@ -3751,7 +4287,7 @@ addToUnscopables('values'); addToUnscopables('entries'); /***/ }), -/* 122 */ +/* 139 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -3759,26 +4295,34 @@ addToUnscopables('entries'); var $ = __webpack_require__(2); -var createIteratorConstructor = __webpack_require__(123); +var call = __webpack_require__(7); -var getPrototypeOf = __webpack_require__(84); +var IS_PURE = __webpack_require__(32); -var setPrototypeOf = __webpack_require__(86); +var FunctionName = __webpack_require__(49); -var setToStringTag = __webpack_require__(63); +var isCallable = __webpack_require__(18); -var createNonEnumerableProperty = __webpack_require__(33); +var createIteratorConstructor = __webpack_require__(140); -var redefine = __webpack_require__(36); +var getPrototypeOf = __webpack_require__(99); -var wellKnownSymbol = __webpack_require__(23); +var setPrototypeOf = __webpack_require__(101); -var IS_PURE = __webpack_require__(25); +var setToStringTag = __webpack_require__(78); -var Iterators = __webpack_require__(90); +var createNonEnumerableProperty = __webpack_require__(40); -var IteratorsCore = __webpack_require__(124); +var redefine = __webpack_require__(43); +var wellKnownSymbol = __webpack_require__(30); + +var Iterators = __webpack_require__(107); + +var IteratorsCore = __webpack_require__(141); + +var PROPER_FUNCTION_NAME = FunctionName.PROPER; +var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE; var IteratorPrototype = IteratorsCore.IteratorPrototype; var BUGGY_SAFARI_ITERATORS = IteratorsCore.BUGGY_SAFARI_ITERATORS; var ITERATOR = wellKnownSymbol('iterator'); @@ -3830,12 +4374,12 @@ module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, I if (anyNativeIterator) { CurrentIteratorPrototype = getPrototypeOf(anyNativeIterator.call(new Iterable())); - if (IteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) { + if (CurrentIteratorPrototype !== Object.prototype && CurrentIteratorPrototype.next) { if (!IS_PURE && getPrototypeOf(CurrentIteratorPrototype) !== IteratorPrototype) { if (setPrototypeOf) { setPrototypeOf(CurrentIteratorPrototype, IteratorPrototype); - } else if (typeof CurrentIteratorPrototype[ITERATOR] != 'function') { - createNonEnumerableProperty(CurrentIteratorPrototype, ITERATOR, returnThis); + } else if (!isCallable(CurrentIteratorPrototype[ITERATOR])) { + redefine(CurrentIteratorPrototype, ITERATOR, returnThis); } } // Set @@toStringTag to native iterators @@ -3846,21 +4390,19 @@ module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, I } // fix Array.prototype.{ values, @@iterator }.name in V8 / FF - if (DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) { - INCORRECT_VALUES_NAME = true; + if (PROPER_FUNCTION_NAME && DEFAULT == VALUES && nativeIterator && nativeIterator.name !== VALUES) { + if (!IS_PURE && CONFIGURABLE_FUNCTION_NAME) { + createNonEnumerableProperty(IterablePrototype, 'name', VALUES); + } else { + INCORRECT_VALUES_NAME = true; - defaultIterator = function values() { - return nativeIterator.call(this); - }; - } // define iterator + defaultIterator = function values() { + return call(nativeIterator, this); + }; + } + } // export additional methods - if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) { - createNonEnumerableProperty(IterablePrototype, ITERATOR, defaultIterator); - } - - Iterators[NAME] = defaultIterator; // export additional methods - if (DEFAULT) { methods = { values: getIterationMethod(VALUES), @@ -3876,27 +4418,35 @@ module.exports = function (Iterable, NAME, IteratorConstructor, next, DEFAULT, I proto: true, forced: BUGGY_SAFARI_ITERATORS || INCORRECT_VALUES_NAME }, methods); + } // define iterator + + + if ((!IS_PURE || FORCED) && IterablePrototype[ITERATOR] !== defaultIterator) { + redefine(IterablePrototype, ITERATOR, defaultIterator, { + name: DEFAULT + }); } + Iterators[NAME] = defaultIterator; return methods; }; /***/ }), -/* 123 */ +/* 140 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var IteratorPrototype = __webpack_require__(124).IteratorPrototype; +var IteratorPrototype = (__webpack_require__(141).IteratorPrototype); -var create = __webpack_require__(55); +var create = __webpack_require__(67); -var createPropertyDescriptor = __webpack_require__(8); +var createPropertyDescriptor = __webpack_require__(9); -var setToStringTag = __webpack_require__(63); +var setToStringTag = __webpack_require__(78); -var Iterators = __webpack_require__(90); +var Iterators = __webpack_require__(107); var returnThis = function () { return this; @@ -3913,7 +4463,7 @@ module.exports = function (IteratorConstructor, NAME, next) { }; /***/ }), -/* 124 */ +/* 141 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -3921,25 +4471,22 @@ module.exports = function (IteratorConstructor, NAME, next) { var fails = __webpack_require__(6); -var getPrototypeOf = __webpack_require__(84); +var isCallable = __webpack_require__(18); -var createNonEnumerableProperty = __webpack_require__(33); +var create = __webpack_require__(67); -var has = __webpack_require__(28); +var getPrototypeOf = __webpack_require__(99); -var wellKnownSymbol = __webpack_require__(23); +var redefine = __webpack_require__(43); -var IS_PURE = __webpack_require__(25); +var wellKnownSymbol = __webpack_require__(30); + +var IS_PURE = __webpack_require__(32); var ITERATOR = wellKnownSymbol('iterator'); -var BUGGY_SAFARI_ITERATORS = false; - -var returnThis = function () { - return this; -}; // `%IteratorPrototype%` object +var BUGGY_SAFARI_ITERATORS = false; // `%IteratorPrototype%` object // https://tc39.es/ecma262/#sec-%iteratorprototype%-object - var IteratorPrototype, PrototypeOfArrayIteratorPrototype, arrayIterator; /* eslint-disable es/no-array-prototype-keys -- safe */ @@ -3957,11 +4504,13 @@ var NEW_ITERATOR_PROTOTYPE = IteratorPrototype == undefined || fails(function () return IteratorPrototype[ITERATOR].call(test) !== test; }); -if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {}; // `%IteratorPrototype%[@@iterator]()` method +if (NEW_ITERATOR_PROTOTYPE) IteratorPrototype = {};else if (IS_PURE) IteratorPrototype = create(IteratorPrototype); // `%IteratorPrototype%[@@iterator]()` method // https://tc39.es/ecma262/#sec-%iteratorprototype%-@@iterator -if ((!IS_PURE || NEW_ITERATOR_PROTOTYPE) && !has(IteratorPrototype, ITERATOR)) { - createNonEnumerableProperty(IteratorPrototype, ITERATOR, returnThis); +if (!isCallable(IteratorPrototype[ITERATOR])) { + redefine(IteratorPrototype, ITERATOR, function () { + return this; + }); } module.exports = { @@ -3970,7 +4519,7 @@ module.exports = { }; /***/ }), -/* 125 */ +/* 142 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -3978,13 +4527,15 @@ module.exports = { var $ = __webpack_require__(2); -var IndexedObject = __webpack_require__(10); +var uncurryThis = __webpack_require__(12); -var toIndexedObject = __webpack_require__(9); +var IndexedObject = __webpack_require__(11); -var arrayMethodIsStrict = __webpack_require__(103); +var toIndexedObject = __webpack_require__(10); -var nativeJoin = [].join; +var arrayMethodIsStrict = __webpack_require__(120); + +var un$Join = uncurryThis([].join); var ES3_STRINGS = IndexedObject != Object; var STRICT_METHOD = arrayMethodIsStrict('join', ','); // `Array.prototype.join` method // https://tc39.es/ecma262/#sec-array.prototype.join @@ -3995,17 +4546,17 @@ $({ forced: ES3_STRINGS || !STRICT_METHOD }, { join: function join(separator) { - return nativeJoin.call(toIndexedObject(this), separator === undefined ? ',' : separator); + return un$Join(toIndexedObject(this), separator === undefined ? ',' : separator); } }); /***/ }), -/* 126 */ +/* 143 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var lastIndexOf = __webpack_require__(127); // `Array.prototype.lastIndexOf` method +var lastIndexOf = __webpack_require__(144); // `Array.prototype.lastIndexOf` method // https://tc39.es/ecma262/#sec-array.prototype.lastindexof // eslint-disable-next-line es/no-array-prototype-lastindexof -- required for testing @@ -4019,20 +4570,22 @@ $({ }); /***/ }), -/* 127 */ +/* 144 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; /* eslint-disable es/no-array-prototype-lastindexof -- safe */ -var toIndexedObject = __webpack_require__(9); +var apply = __webpack_require__(62); -var toInteger = __webpack_require__(48); +var toIndexedObject = __webpack_require__(10); -var toLength = __webpack_require__(47); +var toIntegerOrInfinity = __webpack_require__(56); -var arrayMethodIsStrict = __webpack_require__(103); +var lengthOfArrayLike = __webpack_require__(57); + +var arrayMethodIsStrict = __webpack_require__(120); var min = Math.min; var $lastIndexOf = [].lastIndexOf; @@ -4045,11 +4598,11 @@ module.exports = FORCED ? function lastIndexOf(searchElement /* , fromIndex = @[*-1] */ ) { // convert -0 to +0 - if (NEGATIVE_ZERO) return $lastIndexOf.apply(this, arguments) || 0; + if (NEGATIVE_ZERO) return apply($lastIndexOf, this, arguments) || 0; var O = toIndexedObject(this); - var length = toLength(O.length); + var length = lengthOfArrayLike(O); var index = length - 1; - if (arguments.length > 1) index = min(index, toInteger(arguments[1])); + if (arguments.length > 1) index = min(index, toIntegerOrInfinity(arguments[1])); if (index < 0) index = length + index; for (; index >= 0; index--) if (index in O && O[index] === searchElement) return index || 0; @@ -4058,7 +4611,7 @@ module.exports = FORCED ? function lastIndexOf(searchElement } : $lastIndexOf; /***/ }), -/* 128 */ +/* 145 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -4066,9 +4619,9 @@ module.exports = FORCED ? function lastIndexOf(searchElement var $ = __webpack_require__(2); -var $map = __webpack_require__(64).map; +var $map = (__webpack_require__(79).map); -var arrayMethodHasSpeciesSupport = __webpack_require__(98); +var arrayMethodHasSpeciesSupport = __webpack_require__(116); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map'); // `Array.prototype.map` method // https://tc39.es/ecma262/#sec-array.prototype.map @@ -4087,7 +4640,7 @@ $({ }); /***/ }), -/* 129 */ +/* 146 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -4095,15 +4648,19 @@ $({ var $ = __webpack_require__(2); +var global = __webpack_require__(3); + var fails = __webpack_require__(6); -var createProperty = __webpack_require__(97); +var isConstructor = __webpack_require__(83); +var createProperty = __webpack_require__(73); + +var Array = global.Array; var ISNT_GENERIC = fails(function () { function F() { /* empty */ - } // eslint-disable-next-line es/no-array-of -- required for testing - + } return !(Array.of.call(F) instanceof F); }); // `Array.of` method @@ -4115,10 +4672,12 @@ $({ stat: true, forced: ISNT_GENERIC }, { - of: function of() { + of: function + /* ...args */ + of() { var index = 0; var argumentsLength = arguments.length; - var result = new (typeof this == 'function' ? this : Array)(argumentsLength); + var result = new (isConstructor(this) ? this : Array)(argumentsLength); while (argumentsLength > index) createProperty(result, index, arguments[index++]); @@ -4128,7 +4687,7 @@ $({ }); /***/ }), -/* 130 */ +/* 147 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -4136,13 +4695,13 @@ $({ var $ = __webpack_require__(2); -var $reduce = __webpack_require__(131).left; +var $reduce = (__webpack_require__(148).left); -var arrayMethodIsStrict = __webpack_require__(103); +var arrayMethodIsStrict = __webpack_require__(120); -var CHROME_VERSION = __webpack_require__(20); +var CHROME_VERSION = __webpack_require__(24); -var IS_NODE = __webpack_require__(132); +var IS_NODE = __webpack_require__(149); var STRICT_METHOD = arrayMethodIsStrict('reduce'); // Chrome 80-82 has a critical bug // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982 @@ -4158,29 +4717,33 @@ $({ reduce: function reduce(callbackfn /* , initialValue */ ) { - return $reduce(this, callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); + var length = arguments.length; + return $reduce(this, callbackfn, length, length > 1 ? arguments[1] : undefined); } }); /***/ }), -/* 131 */ +/* 148 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var aFunction = __webpack_require__(66); +var global = __webpack_require__(3); -var toObject = __webpack_require__(29); +var aCallable = __webpack_require__(27); -var IndexedObject = __webpack_require__(10); +var toObject = __webpack_require__(36); -var toLength = __webpack_require__(47); // `Array.prototype.{ reduce, reduceRight }` methods implementation +var IndexedObject = __webpack_require__(11); +var lengthOfArrayLike = __webpack_require__(57); + +var TypeError = global.TypeError; // `Array.prototype.{ reduce, reduceRight }` methods implementation var createMethod = function (IS_RIGHT) { return function (that, callbackfn, argumentsLength, memo) { - aFunction(callbackfn); + aCallable(callbackfn); var O = toObject(that); var self = IndexedObject(O); - var length = toLength(O.length); + var length = lengthOfArrayLike(O); var index = IS_RIGHT ? length - 1 : 0; var i = IS_RIGHT ? -1 : 1; if (argumentsLength < 2) while (true) { @@ -4215,17 +4778,17 @@ module.exports = { }; /***/ }), -/* 132 */ +/* 149 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var classof = __webpack_require__(11); +var classof = __webpack_require__(13); var global = __webpack_require__(3); module.exports = classof(global.process) == 'process'; /***/ }), -/* 133 */ +/* 150 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -4233,13 +4796,13 @@ module.exports = classof(global.process) == 'process'; var $ = __webpack_require__(2); -var $reduceRight = __webpack_require__(131).right; +var $reduceRight = (__webpack_require__(148).right); -var arrayMethodIsStrict = __webpack_require__(103); +var arrayMethodIsStrict = __webpack_require__(120); -var CHROME_VERSION = __webpack_require__(20); +var CHROME_VERSION = __webpack_require__(24); -var IS_NODE = __webpack_require__(132); +var IS_NODE = __webpack_require__(149); var STRICT_METHOD = arrayMethodIsStrict('reduceRight'); // Chrome 80-82 has a critical bug // https://bugs.chromium.org/p/chromium/issues/detail?id=1049982 @@ -4260,7 +4823,7 @@ $({ }); /***/ }), -/* 134 */ +/* 151 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -4268,9 +4831,11 @@ $({ var $ = __webpack_require__(2); -var isArray = __webpack_require__(53); +var uncurryThis = __webpack_require__(12); -var nativeReverse = [].reverse; +var isArray = __webpack_require__(63); + +var un$Reverse = uncurryThis([].reverse); var test = [1, 2]; // `Array.prototype.reverse` method // https://tc39.es/ecma262/#sec-array.prototype.reverse // fix for Safari 12.0 bug @@ -4284,12 +4849,12 @@ $({ reverse: function reverse() { // eslint-disable-next-line no-self-assign -- dirty hack if (isArray(this)) this.length = this.length; - return nativeReverse.call(this); + return un$Reverse(this); } }); /***/ }), -/* 135 */ +/* 152 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -4297,25 +4862,31 @@ $({ var $ = __webpack_require__(2); -var isObject = __webpack_require__(15); +var global = __webpack_require__(3); -var isArray = __webpack_require__(53); +var isArray = __webpack_require__(63); -var toAbsoluteIndex = __webpack_require__(49); +var isConstructor = __webpack_require__(83); -var toLength = __webpack_require__(47); +var isObject = __webpack_require__(17); -var toIndexedObject = __webpack_require__(9); +var toAbsoluteIndex = __webpack_require__(55); -var createProperty = __webpack_require__(97); +var lengthOfArrayLike = __webpack_require__(57); -var wellKnownSymbol = __webpack_require__(23); +var toIndexedObject = __webpack_require__(10); -var arrayMethodHasSpeciesSupport = __webpack_require__(98); +var createProperty = __webpack_require__(73); + +var wellKnownSymbol = __webpack_require__(30); + +var arrayMethodHasSpeciesSupport = __webpack_require__(116); + +var un$Slice = __webpack_require__(74); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('slice'); var SPECIES = wellKnownSymbol('species'); -var nativeSlice = [].slice; +var Array = global.Array; var max = Math.max; // `Array.prototype.slice` method // https://tc39.es/ecma262/#sec-array.prototype.slice // fallback for not array-like ES3 strings and DOM objects @@ -4327,7 +4898,7 @@ $({ }, { slice: function slice(start, end) { var O = toIndexedObject(this); - var length = toLength(O.length); + var length = lengthOfArrayLike(O); var k = toAbsoluteIndex(start, length); var fin = toAbsoluteIndex(end === undefined ? length : end, length); // inline `ArraySpeciesCreate` for usage native `Array#slice` where it's possible @@ -4336,7 +4907,7 @@ $({ if (isArray(O)) { Constructor = O.constructor; // cross-realm fallback - if (typeof Constructor == 'function' && (Constructor === Array || isArray(Constructor.prototype))) { + if (isConstructor(Constructor) && (Constructor === Array || isArray(Constructor.prototype))) { Constructor = undefined; } else if (isObject(Constructor)) { Constructor = Constructor[SPECIES]; @@ -4344,7 +4915,7 @@ $({ } if (Constructor === Array || Constructor === undefined) { - return nativeSlice.call(O, k, fin); + return un$Slice(O, k, fin); } } @@ -4358,7 +4929,7 @@ $({ }); /***/ }), -/* 136 */ +/* 153 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -4366,9 +4937,9 @@ $({ var $ = __webpack_require__(2); -var $some = __webpack_require__(64).some; +var $some = (__webpack_require__(79).some); -var arrayMethodIsStrict = __webpack_require__(103); +var arrayMethodIsStrict = __webpack_require__(120); var STRICT_METHOD = arrayMethodIsStrict('some'); // `Array.prototype.some` method // https://tc39.es/ecma262/#sec-array.prototype.some @@ -4386,7 +4957,7 @@ $({ }); /***/ }), -/* 137 */ +/* 154 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -4394,30 +4965,33 @@ $({ var $ = __webpack_require__(2); -var aFunction = __webpack_require__(66); +var uncurryThis = __webpack_require__(12); -var toObject = __webpack_require__(29); +var aCallable = __webpack_require__(27); -var toLength = __webpack_require__(47); +var toObject = __webpack_require__(36); -var toString = __webpack_require__(54); +var lengthOfArrayLike = __webpack_require__(57); + +var toString = __webpack_require__(64); var fails = __webpack_require__(6); -var internalSort = __webpack_require__(138); +var internalSort = __webpack_require__(155); -var arrayMethodIsStrict = __webpack_require__(103); +var arrayMethodIsStrict = __webpack_require__(120); -var FF = __webpack_require__(139); +var FF = __webpack_require__(156); -var IE_OR_EDGE = __webpack_require__(140); +var IE_OR_EDGE = __webpack_require__(157); -var V8 = __webpack_require__(20); +var V8 = __webpack_require__(24); -var WEBKIT = __webpack_require__(141); +var WEBKIT = __webpack_require__(158); var test = []; -var nativeSort = test.sort; // IE8- +var un$Sort = uncurryThis(test.sort); +var push = uncurryThis(test.push); // IE8- var FAILS_ON_UNDEFINED = fails(function () { test.sort(undefined); @@ -4495,18 +5069,18 @@ $({ forced: FORCED }, { sort: function sort(comparefn) { - if (comparefn !== undefined) aFunction(comparefn); + if (comparefn !== undefined) aCallable(comparefn); var array = toObject(this); - if (STABLE_SORT) return comparefn === undefined ? nativeSort.call(array) : nativeSort.call(array, comparefn); + if (STABLE_SORT) return comparefn === undefined ? un$Sort(array) : un$Sort(array, comparefn); var items = []; - var arrayLength = toLength(array.length); + var arrayLength = lengthOfArrayLike(array); var itemsLength, index; for (index = 0; index < arrayLength; index++) { - if (index in array) items.push(array[index]); + if (index in array) push(items, array[index]); } - items = internalSort(items, getSortCompare(comparefn)); + internalSort(items, getSortCompare(comparefn)); itemsLength = items.length; index = 0; @@ -4519,16 +5093,17 @@ $({ }); /***/ }), -/* 138 */ -/***/ ((module) => { +/* 155 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var arraySlice = __webpack_require__(72); -// TODO: use something more complex like timsort? var floor = Math.floor; var mergeSort = function (array, comparefn) { var length = array.length; var middle = floor(length / 2); - return length < 8 ? insertionSort(array, comparefn) : merge(mergeSort(array.slice(0, middle), comparefn), mergeSort(array.slice(middle), comparefn), comparefn); + return length < 8 ? insertionSort(array, comparefn) : merge(array, mergeSort(arraySlice(array, 0, middle), comparefn), mergeSort(arraySlice(array, middle), comparefn), comparefn); }; var insertionSort = function (array, comparefn) { @@ -4550,74 +5125,69 @@ var insertionSort = function (array, comparefn) { return array; }; -var merge = function (left, right, comparefn) { +var merge = function (array, left, right, comparefn) { var llength = left.length; var rlength = right.length; var lindex = 0; var rindex = 0; - var result = []; while (lindex < llength || rindex < rlength) { - if (lindex < llength && rindex < rlength) { - result.push(comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++]); - } else { - result.push(lindex < llength ? left[lindex++] : right[rindex++]); - } + array[lindex + rindex] = lindex < llength && rindex < rlength ? comparefn(left[lindex], right[rindex]) <= 0 ? left[lindex++] : right[rindex++] : lindex < llength ? left[lindex++] : right[rindex++]; } - return result; + return array; }; module.exports = mergeSort; /***/ }), -/* 139 */ +/* 156 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var userAgent = __webpack_require__(21); +var userAgent = __webpack_require__(25); var firefox = userAgent.match(/firefox\/(\d+)/i); module.exports = !!firefox && +firefox[1]; /***/ }), -/* 140 */ +/* 157 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var UA = __webpack_require__(21); +var UA = __webpack_require__(25); module.exports = /MSIE|Trident/.test(UA); /***/ }), -/* 141 */ +/* 158 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var userAgent = __webpack_require__(21); +var userAgent = __webpack_require__(25); var webkit = userAgent.match(/AppleWebKit\/(\d+)\./); module.exports = !!webkit && +webkit[1]; /***/ }), -/* 142 */ +/* 159 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var setSpecies = __webpack_require__(143); // `Array[@@species]` getter +var setSpecies = __webpack_require__(160); // `Array[@@species]` getter // https://tc39.es/ecma262/#sec-get-array-@@species setSpecies('Array'); /***/ }), -/* 143 */ +/* 160 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var getBuiltIn = __webpack_require__(17); +var getBuiltIn = __webpack_require__(20); -var definePropertyModule = __webpack_require__(34); +var definePropertyModule = __webpack_require__(41); -var wellKnownSymbol = __webpack_require__(23); +var wellKnownSymbol = __webpack_require__(30); var DESCRIPTORS = __webpack_require__(5); @@ -4638,7 +5208,7 @@ module.exports = function (CONSTRUCTOR_NAME) { }; /***/ }), -/* 144 */ +/* 161 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -4646,21 +5216,24 @@ module.exports = function (CONSTRUCTOR_NAME) { var $ = __webpack_require__(2); -var toAbsoluteIndex = __webpack_require__(49); +var global = __webpack_require__(3); -var toInteger = __webpack_require__(48); +var toAbsoluteIndex = __webpack_require__(55); -var toLength = __webpack_require__(47); +var toIntegerOrInfinity = __webpack_require__(56); -var toObject = __webpack_require__(29); +var lengthOfArrayLike = __webpack_require__(57); -var arraySpeciesCreate = __webpack_require__(67); +var toObject = __webpack_require__(36); -var createProperty = __webpack_require__(97); +var arraySpeciesCreate = __webpack_require__(81); -var arrayMethodHasSpeciesSupport = __webpack_require__(98); +var createProperty = __webpack_require__(73); + +var arrayMethodHasSpeciesSupport = __webpack_require__(116); var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('splice'); +var TypeError = global.TypeError; var max = Math.max; var min = Math.min; var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF; @@ -4677,7 +5250,7 @@ $({ /* , ...items */ ) { var O = toObject(this); - var len = toLength(O.length); + var len = lengthOfArrayLike(O); var actualStart = toAbsoluteIndex(start, len); var argumentsLength = arguments.length; var insertCount, actualDeleteCount, A, k, from, to; @@ -4689,7 +5262,7 @@ $({ actualDeleteCount = len - actualStart; } else { insertCount = argumentsLength - 2; - actualDeleteCount = min(max(toInteger(deleteCount), 0), len - actualStart); + actualDeleteCount = min(max(toIntegerOrInfinity(deleteCount), 0), len - actualStart); } if (len + insertCount - actualDeleteCount > MAX_SAFE_INTEGER) { @@ -4731,29 +5304,29 @@ $({ }); /***/ }), -/* 145 */ +/* 162 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { // this method was added to unscopables after implementation // in popular engines, so it's moved to a separate module -var addToUnscopables = __webpack_require__(101); // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables +var addToUnscopables = __webpack_require__(114); // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('flat'); /***/ }), -/* 146 */ +/* 163 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { // this method was added to unscopables after implementation // in popular engines, so it's moved to a separate module -var addToUnscopables = __webpack_require__(101); // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables +var addToUnscopables = __webpack_require__(114); // https://tc39.es/ecma262/#sec-array.prototype-@@unscopables addToUnscopables('flatMap'); /***/ }), -/* 147 */ +/* 164 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -4763,9 +5336,9 @@ var $ = __webpack_require__(2); var global = __webpack_require__(3); -var arrayBufferModule = __webpack_require__(148); +var arrayBufferModule = __webpack_require__(165); -var setSpecies = __webpack_require__(143); +var setSpecies = __webpack_require__(160); var ARRAY_BUFFER = 'ArrayBuffer'; var ArrayBuffer = arrayBufferModule[ARRAY_BUFFER]; @@ -4781,7 +5354,7 @@ $({ setSpecies(ARRAY_BUFFER); /***/ }), -/* 148 */ +/* 165 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -4789,40 +5362,48 @@ setSpecies(ARRAY_BUFFER); var global = __webpack_require__(3); +var uncurryThis = __webpack_require__(12); + var DESCRIPTORS = __webpack_require__(5); -var NATIVE_ARRAY_BUFFER = __webpack_require__(149); +var NATIVE_ARRAY_BUFFER = __webpack_require__(166); -var createNonEnumerableProperty = __webpack_require__(33); +var FunctionName = __webpack_require__(49); -var redefineAll = __webpack_require__(150); +var createNonEnumerableProperty = __webpack_require__(40); + +var redefineAll = __webpack_require__(167); var fails = __webpack_require__(6); -var anInstance = __webpack_require__(151); +var anInstance = __webpack_require__(168); -var toInteger = __webpack_require__(48); +var toIntegerOrInfinity = __webpack_require__(56); -var toLength = __webpack_require__(47); +var toLength = __webpack_require__(58); -var toIndex = __webpack_require__(152); +var toIndex = __webpack_require__(169); -var IEEE754 = __webpack_require__(153); +var IEEE754 = __webpack_require__(170); -var getPrototypeOf = __webpack_require__(84); +var getPrototypeOf = __webpack_require__(99); -var setPrototypeOf = __webpack_require__(86); +var setPrototypeOf = __webpack_require__(101); -var getOwnPropertyNames = __webpack_require__(44).f; +var getOwnPropertyNames = (__webpack_require__(52).f); -var defineProperty = __webpack_require__(34).f; +var defineProperty = (__webpack_require__(41).f); -var arrayFill = __webpack_require__(105); +var arrayFill = __webpack_require__(122); -var setToStringTag = __webpack_require__(63); +var arraySlice = __webpack_require__(72); -var InternalStateModule = __webpack_require__(38); +var setToStringTag = __webpack_require__(78); +var InternalStateModule = __webpack_require__(45); + +var PROPER_FUNCTION_NAME = FunctionName.PROPER; +var CONFIGURABLE_FUNCTION_NAME = FunctionName.CONFIGURABLE; var getInternalState = InternalStateModule.get; var setInternalState = InternalStateModule.set; var ARRAY_BUFFER = 'ArrayBuffer'; @@ -4832,10 +5413,14 @@ var WRONG_LENGTH = 'Wrong length'; var WRONG_INDEX = 'Wrong index'; var NativeArrayBuffer = global[ARRAY_BUFFER]; var $ArrayBuffer = NativeArrayBuffer; +var ArrayBufferPrototype = $ArrayBuffer && $ArrayBuffer[PROTOTYPE]; var $DataView = global[DATA_VIEW]; -var $DataViewPrototype = $DataView && $DataView[PROTOTYPE]; +var DataViewPrototype = $DataView && $DataView[PROTOTYPE]; var ObjectPrototype = Object.prototype; +var Array = global.Array; var RangeError = global.RangeError; +var fill = uncurryThis(arrayFill); +var reverse = uncurryThis([].reverse); var packIEEE754 = IEEE754.pack; var unpackIEEE754 = IEEE754.unpack; @@ -4877,8 +5462,8 @@ var get = function (view, count, index, isLittleEndian) { if (intIndex + count > store.byteLength) throw RangeError(WRONG_INDEX); var bytes = getInternalState(store.buffer).bytes; var start = intIndex + store.byteOffset; - var pack = bytes.slice(start, start + count); - return isLittleEndian ? pack : pack.reverse(); + var pack = arraySlice(bytes, start, start + count); + return isLittleEndian ? pack : reverse(pack); }; var set = function (view, count, index, conversion, value, isLittleEndian) { @@ -4894,20 +5479,22 @@ var set = function (view, count, index, conversion, value, isLittleEndian) { if (!NATIVE_ARRAY_BUFFER) { $ArrayBuffer = function ArrayBuffer(length) { - anInstance(this, $ArrayBuffer, ARRAY_BUFFER); + anInstance(this, ArrayBufferPrototype); var byteLength = toIndex(length); setInternalState(this, { - bytes: arrayFill.call(new Array(byteLength), 0), + bytes: fill(Array(byteLength), 0), byteLength: byteLength }); if (!DESCRIPTORS) this.byteLength = byteLength; }; + ArrayBufferPrototype = $ArrayBuffer[PROTOTYPE]; + $DataView = function DataView(buffer, byteOffset, byteLength) { - anInstance(this, $DataView, DATA_VIEW); - anInstance(buffer, $ArrayBuffer, DATA_VIEW); + anInstance(this, DataViewPrototype); + anInstance(buffer, ArrayBufferPrototype); var bufferLength = getInternalState(buffer).byteLength; - var offset = toInteger(byteOffset); + var offset = toIntegerOrInfinity(byteOffset); if (offset < 0 || offset > bufferLength) throw RangeError('Wrong offset'); byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength); if (offset + byteLength > bufferLength) throw RangeError(WRONG_LENGTH); @@ -4924,6 +5511,8 @@ if (!NATIVE_ARRAY_BUFFER) { } }; + DataViewPrototype = $DataView[PROTOTYPE]; + if (DESCRIPTORS) { addGetter($ArrayBuffer, 'byteLength'); addGetter($DataView, 'buffer'); @@ -4931,7 +5520,7 @@ if (!NATIVE_ARRAY_BUFFER) { addGetter($DataView, 'byteOffset'); } - redefineAll($DataView[PROTOTYPE], { + redefineAll(DataViewPrototype, { getInt8: function getInt8(byteOffset) { return get(this, 1, byteOffset)[0] << 24 >> 24; }, @@ -5008,7 +5597,9 @@ if (!NATIVE_ARRAY_BUFFER) { } }); } else { + var INCORRECT_ARRAY_BUFFER_NAME = PROPER_FUNCTION_NAME && NativeArrayBuffer.name !== ARRAY_BUFFER; /* eslint-disable no-new -- required for testing */ + if (!fails(function () { NativeArrayBuffer(1); }) || !fails(function () { @@ -5017,15 +5608,15 @@ if (!NATIVE_ARRAY_BUFFER) { new NativeArrayBuffer(); new NativeArrayBuffer(1.5); new NativeArrayBuffer(NaN); - return NativeArrayBuffer.name != ARRAY_BUFFER; + return INCORRECT_ARRAY_BUFFER_NAME && !CONFIGURABLE_FUNCTION_NAME; })) { /* eslint-enable no-new -- required for testing */ $ArrayBuffer = function ArrayBuffer(length) { - anInstance(this, $ArrayBuffer); + anInstance(this, ArrayBufferPrototype); return new NativeArrayBuffer(toIndex(length)); }; - var ArrayBufferPrototype = $ArrayBuffer[PROTOTYPE] = NativeArrayBuffer[PROTOTYPE]; + $ArrayBuffer[PROTOTYPE] = ArrayBufferPrototype; for (var keys = getOwnPropertyNames(NativeArrayBuffer), j = 0, key; keys.length > j;) { if (!((key = keys[j++]) in $ArrayBuffer)) { @@ -5034,24 +5625,26 @@ if (!NATIVE_ARRAY_BUFFER) { } ArrayBufferPrototype.constructor = $ArrayBuffer; + } else if (INCORRECT_ARRAY_BUFFER_NAME && CONFIGURABLE_FUNCTION_NAME) { + createNonEnumerableProperty(NativeArrayBuffer, 'name', ARRAY_BUFFER); } // WebKit bug - the same parent prototype for typed arrays and data view - if (setPrototypeOf && getPrototypeOf($DataViewPrototype) !== ObjectPrototype) { - setPrototypeOf($DataViewPrototype, ObjectPrototype); + if (setPrototypeOf && getPrototypeOf(DataViewPrototype) !== ObjectPrototype) { + setPrototypeOf(DataViewPrototype, ObjectPrototype); } // iOS Safari 7.x bug var testView = new $DataView(new $ArrayBuffer(2)); - var $setInt8 = $DataViewPrototype.setInt8; + var $setInt8 = uncurryThis(DataViewPrototype.setInt8); testView.setInt8(0, 2147483648); testView.setInt8(1, 2147483649); - if (testView.getInt8(0) || !testView.getInt8(1)) redefineAll($DataViewPrototype, { + if (testView.getInt8(0) || !testView.getInt8(1)) redefineAll(DataViewPrototype, { setInt8: function setInt8(byteOffset, value) { - $setInt8.call(this, byteOffset, value << 24 >> 24); + $setInt8(this, byteOffset, value << 24 >> 24); }, setUint8: function setUint8(byteOffset, value) { - $setInt8.call(this, byteOffset, value << 24 >> 24); + $setInt8(this, byteOffset, value << 24 >> 24); } }, { unsafe: true @@ -5066,17 +5659,17 @@ module.exports = { }; /***/ }), -/* 149 */ +/* 166 */ /***/ ((module) => { // eslint-disable-next-line es/no-typed-arrays -- safe -module.exports = typeof ArrayBuffer !== 'undefined' && typeof DataView !== 'undefined'; +module.exports = typeof ArrayBuffer != 'undefined' && typeof DataView != 'undefined'; /***/ }), -/* 150 */ +/* 167 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var redefine = __webpack_require__(36); +var redefine = __webpack_require__(43); module.exports = function (target, src, options) { for (var key in src) redefine(target, key, src[key], options); @@ -5085,40 +5678,49 @@ module.exports = function (target, src, options) { }; /***/ }), -/* 151 */ -/***/ ((module) => { +/* 168 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { -module.exports = function (it, Constructor, name) { - if (!(it instanceof Constructor)) { - throw TypeError('Incorrect ' + (name ? name + ' ' : '') + 'invocation'); - } +var global = __webpack_require__(3); - return it; +var isPrototypeOf = __webpack_require__(21); + +var TypeError = global.TypeError; + +module.exports = function (it, Prototype) { + if (isPrototypeOf(Prototype, it)) return it; + throw TypeError('Incorrect invocation'); }; /***/ }), -/* 152 */ +/* 169 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var toInteger = __webpack_require__(48); +var global = __webpack_require__(3); -var toLength = __webpack_require__(47); // `ToIndex` abstract operation +var toIntegerOrInfinity = __webpack_require__(56); + +var toLength = __webpack_require__(58); + +var RangeError = global.RangeError; // `ToIndex` abstract operation // https://tc39.es/ecma262/#sec-toindex - module.exports = function (it) { if (it === undefined) return 0; - var number = toInteger(it); + var number = toIntegerOrInfinity(it); var length = toLength(number); if (number !== length) throw RangeError('Wrong length or index'); return length; }; /***/ }), -/* 153 */ -/***/ ((module) => { +/* 170 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { // IEEE754 conversions based on https://github.com/feross/ieee754 +var global = __webpack_require__(3); + +var Array = global.Array; var abs = Math.abs; var pow = Math.pow; var floor = Math.floor; @@ -5126,7 +5728,7 @@ var log = Math.log; var LN2 = Math.LN2; var pack = function (number, mantissaLength, bytes) { - var buffer = new Array(bytes); + var buffer = Array(bytes); var exponentLength = bytes * 8 - mantissaLength - 1; var eMax = (1 << exponentLength) - 1; var eBias = eMax >> 1; @@ -5142,8 +5744,9 @@ var pack = function (number, mantissaLength, bytes) { exponent = eMax; } else { exponent = floor(log(number) / LN2); + c = pow(2, -exponent); - if (number * (c = pow(2, -exponent)) < 1) { + if (number * c < 1) { exponent--; c *= 2; } @@ -5171,12 +5774,20 @@ var pack = function (number, mantissaLength, bytes) { } } - for (; mantissaLength >= 8; buffer[index++] = mantissa & 255, mantissa /= 256, mantissaLength -= 8); + while (mantissaLength >= 8) { + buffer[index++] = mantissa & 255; + mantissa /= 256; + mantissaLength -= 8; + } exponent = exponent << mantissaLength | mantissa; exponentLength += mantissaLength; - for (; exponentLength > 0; buffer[index++] = exponent & 255, exponent /= 256, exponentLength -= 8); + while (exponentLength > 0) { + buffer[index++] = exponent & 255; + exponent /= 256; + exponentLength -= 8; + } buffer[--index] |= sign * 128; return buffer; @@ -5194,13 +5805,19 @@ var unpack = function (buffer, mantissaLength) { var mantissa; sign >>= 7; - for (; nBits > 0; exponent = exponent * 256 + buffer[index], index--, nBits -= 8); + while (nBits > 0) { + exponent = exponent * 256 + buffer[index--]; + nBits -= 8; + } mantissa = exponent & (1 << -nBits) - 1; exponent >>= -nBits; nBits += mantissaLength; - for (; nBits > 0; mantissa = mantissa * 256 + buffer[index], index--, nBits -= 8); + while (nBits > 0) { + mantissa = mantissa * 256 + buffer[index--]; + nBits -= 8; + } if (exponent === 0) { exponent = 1 - eBias; @@ -5220,12 +5837,12 @@ module.exports = { }; /***/ }), -/* 154 */ +/* 171 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var ArrayBufferViewCore = __webpack_require__(155); +var ArrayBufferViewCore = __webpack_require__(172); var NATIVE_ARRAY_BUFFER_VIEWS = ArrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS; // `ArrayBuffer.isView` method // https://tc39.es/ecma262/#sec-arraybuffer.isview @@ -5239,37 +5856,43 @@ $({ }); /***/ }), -/* 155 */ +/* 172 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var NATIVE_ARRAY_BUFFER = __webpack_require__(149); +var NATIVE_ARRAY_BUFFER = __webpack_require__(166); var DESCRIPTORS = __webpack_require__(5); var global = __webpack_require__(3); -var isObject = __webpack_require__(15); +var isCallable = __webpack_require__(18); -var has = __webpack_require__(28); +var isObject = __webpack_require__(17); -var classof = __webpack_require__(93); +var hasOwn = __webpack_require__(35); -var createNonEnumerableProperty = __webpack_require__(33); +var classof = __webpack_require__(65); -var redefine = __webpack_require__(36); +var tryToString = __webpack_require__(28); -var defineProperty = __webpack_require__(34).f; +var createNonEnumerableProperty = __webpack_require__(40); -var getPrototypeOf = __webpack_require__(84); +var redefine = __webpack_require__(43); -var setPrototypeOf = __webpack_require__(86); +var defineProperty = (__webpack_require__(41).f); -var wellKnownSymbol = __webpack_require__(23); +var isPrototypeOf = __webpack_require__(21); -var uid = __webpack_require__(30); +var getPrototypeOf = __webpack_require__(99); + +var setPrototypeOf = __webpack_require__(101); + +var wellKnownSymbol = __webpack_require__(30); + +var uid = __webpack_require__(37); var Int8Array = global.Int8Array; var Int8ArrayPrototype = Int8Array && Int8Array.prototype; @@ -5278,7 +5901,7 @@ var Uint8ClampedArrayPrototype = Uint8ClampedArray && Uint8ClampedArray.prototyp var TypedArray = Int8Array && getPrototypeOf(Int8Array); var TypedArrayPrototype = Int8ArrayPrototype && getPrototypeOf(Int8ArrayPrototype); var ObjectPrototype = Object.prototype; -var isPrototypeOf = ObjectPrototype.isPrototypeOf; +var TypeError = global.TypeError; var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var TYPED_ARRAY_TAG = uid('TYPED_ARRAY_TAG'); var TYPED_ARRAY_CONSTRUCTOR = uid('TYPED_ARRAY_CONSTRUCTOR'); // Fixing native typed arrays in Opera Presto crashes the browser, see #595 @@ -5305,13 +5928,13 @@ var BigIntArrayConstructorsList = { var isView = function isView(it) { if (!isObject(it)) return false; var klass = classof(it); - return klass === 'DataView' || has(TypedArrayConstructorsList, klass) || has(BigIntArrayConstructorsList, klass); + return klass === 'DataView' || hasOwn(TypedArrayConstructorsList, klass) || hasOwn(BigIntArrayConstructorsList, klass); }; var isTypedArray = function (it) { if (!isObject(it)) return false; var klass = classof(it); - return has(TypedArrayConstructorsList, klass) || has(BigIntArrayConstructorsList, klass); + return hasOwn(TypedArrayConstructorsList, klass) || hasOwn(BigIntArrayConstructorsList, klass); }; var aTypedArray = function (it) { @@ -5320,18 +5943,15 @@ var aTypedArray = function (it) { }; var aTypedArrayConstructor = function (C) { - if (setPrototypeOf && !isPrototypeOf.call(TypedArray, C)) { - throw TypeError('Target is not a typed array constructor'); - } - - return C; + if (isCallable(C) && (!setPrototypeOf || isPrototypeOf(TypedArray, C))) return C; + throw TypeError(tryToString(C) + ' is not a typed array constructor'); }; var exportTypedArrayMethod = function (KEY, property, forced) { if (!DESCRIPTORS) return; if (forced) for (var ARRAY in TypedArrayConstructorsList) { var TypedArrayConstructor = global[ARRAY]; - if (TypedArrayConstructor && has(TypedArrayConstructor.prototype, KEY)) try { + if (TypedArrayConstructor && hasOwn(TypedArrayConstructor.prototype, KEY)) try { delete TypedArrayConstructor.prototype[KEY]; } catch (error) { /* empty */ @@ -5350,7 +5970,7 @@ var exportTypedArrayStaticMethod = function (KEY, property, forced) { if (setPrototypeOf) { if (forced) for (ARRAY in TypedArrayConstructorsList) { TypedArrayConstructor = global[ARRAY]; - if (TypedArrayConstructor && has(TypedArrayConstructor, KEY)) try { + if (TypedArrayConstructor && hasOwn(TypedArrayConstructor, KEY)) try { delete TypedArrayConstructor[KEY]; } catch (error) { /* empty */ @@ -5389,7 +6009,7 @@ for (NAME in BigIntArrayConstructorsList) { } // WebKit bug - typed arrays constructors prototype is Object.prototype -if (!NATIVE_ARRAY_BUFFER_VIEWS || typeof TypedArray != 'function' || TypedArray === Function.prototype) { +if (!NATIVE_ARRAY_BUFFER_VIEWS || !isCallable(TypedArray) || TypedArray === Function.prototype) { // eslint-disable-next-line no-shadow -- safe TypedArray = function TypedArray() { throw TypeError('Incorrect invocation'); @@ -5412,7 +6032,7 @@ if (NATIVE_ARRAY_BUFFER_VIEWS && getPrototypeOf(Uint8ClampedArrayPrototype) !== setPrototypeOf(Uint8ClampedArrayPrototype, TypedArrayPrototype); } -if (DESCRIPTORS && !has(TypedArrayPrototype, TO_STRING_TAG)) { +if (DESCRIPTORS && !hasOwn(TypedArrayPrototype, TO_STRING_TAG)) { TYPED_ARRAY_TAG_REQIRED = true; defineProperty(TypedArrayPrototype, TO_STRING_TAG, { get: function () { @@ -5440,7 +6060,7 @@ module.exports = { }; /***/ }), -/* 156 */ +/* 173 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -5448,21 +6068,26 @@ module.exports = { var $ = __webpack_require__(2); +var uncurryThis = __webpack_require__(12); + var fails = __webpack_require__(6); -var ArrayBufferModule = __webpack_require__(148); +var ArrayBufferModule = __webpack_require__(165); -var anObject = __webpack_require__(35); +var anObject = __webpack_require__(42); -var toAbsoluteIndex = __webpack_require__(49); +var toAbsoluteIndex = __webpack_require__(55); -var toLength = __webpack_require__(47); +var toLength = __webpack_require__(58); -var speciesConstructor = __webpack_require__(157); +var speciesConstructor = __webpack_require__(174); var ArrayBuffer = ArrayBufferModule.ArrayBuffer; var DataView = ArrayBufferModule.DataView; -var nativeArrayBufferSlice = ArrayBuffer.prototype.slice; +var DataViewPrototype = DataView.prototype; +var un$ArrayBufferSlice = uncurryThis(ArrayBuffer.prototype.slice); +var getUint8 = uncurryThis(DataViewPrototype.getUint8); +var setUint8 = uncurryThis(DataViewPrototype.setUint8); var INCORRECT_SLICE = fails(function () { return !new ArrayBuffer(2).slice(1, undefined).byteLength; }); // `ArrayBuffer.prototype.slice` method @@ -5475,8 +6100,8 @@ $({ forced: INCORRECT_SLICE }, { slice: function slice(start, end) { - if (nativeArrayBufferSlice !== undefined && end === undefined) { - return nativeArrayBufferSlice.call(anObject(this), start); // FF fix + if (un$ArrayBufferSlice && end === undefined) { + return un$ArrayBufferSlice(anObject(this), start); // FF fix } var length = anObject(this).byteLength; @@ -5488,7 +6113,7 @@ $({ var index = 0; while (first < fin) { - viewTarget.setUint8(index++, viewSource.getUint8(first++)); + setUint8(viewTarget, index++, getUint8(viewSource, first++)); } return result; @@ -5496,14 +6121,14 @@ $({ }); /***/ }), -/* 157 */ +/* 174 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var anObject = __webpack_require__(35); +var anObject = __webpack_require__(42); -var aFunction = __webpack_require__(66); +var aConstructor = __webpack_require__(175); -var wellKnownSymbol = __webpack_require__(23); +var wellKnownSymbol = __webpack_require__(30); var SPECIES = wellKnownSymbol('species'); // `SpeciesConstructor` abstract operation // https://tc39.es/ecma262/#sec-speciesconstructor @@ -5511,18 +6136,35 @@ var SPECIES = wellKnownSymbol('species'); // `SpeciesConstructor` abstract opera module.exports = function (O, defaultConstructor) { var C = anObject(O).constructor; var S; - return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aFunction(S); + return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? defaultConstructor : aConstructor(S); }; /***/ }), -/* 158 */ +/* 175 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var global = __webpack_require__(3); + +var isConstructor = __webpack_require__(83); + +var tryToString = __webpack_require__(28); + +var TypeError = global.TypeError; // `Assert: IsConstructor(argument) is true` + +module.exports = function (argument) { + if (isConstructor(argument)) return argument; + throw TypeError(tryToString(argument) + ' is not a constructor'); +}; + +/***/ }), +/* 176 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var ArrayBufferModule = __webpack_require__(148); +var ArrayBufferModule = __webpack_require__(165); -var NATIVE_ARRAY_BUFFER = __webpack_require__(149); // `DataView` constructor +var NATIVE_ARRAY_BUFFER = __webpack_require__(166); // `DataView` constructor // https://tc39.es/ecma262/#sec-dataview-constructor @@ -5534,7 +6176,7 @@ $({ }); /***/ }), -/* 159 */ +/* 177 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -5542,12 +6184,14 @@ $({ var $ = __webpack_require__(2); +var uncurryThis = __webpack_require__(12); + var fails = __webpack_require__(6); var FORCED = fails(function () { return new Date(16e11).getYear() !== 120; }); -var getFullYear = Date.prototype.getFullYear; // `Date.prototype.getYear` method +var getFullYear = uncurryThis(Date.prototype.getFullYear); // `Date.prototype.getYear` method // https://tc39.es/ecma262/#sec-date.prototype.getyear $({ @@ -5556,29 +6200,35 @@ $({ forced: FORCED }, { getYear: function getYear() { - return getFullYear.call(this) - 1900; + return getFullYear(this) - 1900; } }); /***/ }), -/* 160 */ +/* 178 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var $ = __webpack_require__(2); // `Date.now` method -// https://tc39.es/ecma262/#sec-date.now +var $ = __webpack_require__(2); +var global = __webpack_require__(3); + +var uncurryThis = __webpack_require__(12); + +var Date = global.Date; +var getTime = uncurryThis(Date.prototype.getTime); // `Date.now` method +// https://tc39.es/ecma262/#sec-date.now $({ target: 'Date', stat: true }, { now: function now() { - return new Date().getTime(); + return getTime(new Date()); } }); /***/ }), -/* 161 */ +/* 179 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -5586,10 +6236,13 @@ $({ var $ = __webpack_require__(2); -var toInteger = __webpack_require__(48); +var uncurryThis = __webpack_require__(12); -var getTime = Date.prototype.getTime; -var setFullYear = Date.prototype.setFullYear; // `Date.prototype.setYear` method +var toIntegerOrInfinity = __webpack_require__(56); + +var DatePrototype = Date.prototype; +var getTime = uncurryThis(DatePrototype.getTime); +var setFullYear = uncurryThis(DatePrototype.setFullYear); // `Date.prototype.setYear` method // https://tc39.es/ecma262/#sec-date.prototype.setyear $({ @@ -5598,15 +6251,15 @@ $({ }, { setYear: function setYear(year) { // validate - getTime.call(this); - var yi = toInteger(year); + getTime(this); + var yi = toIntegerOrInfinity(year); var yyyy = 0 <= yi && yi <= 99 ? yi + 1900 : yi; - return setFullYear.call(this, yyyy); + return setFullYear(this, yyyy); } }); /***/ }), -/* 162 */ +/* 180 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); // `Date.prototype.toGMTString` method @@ -5621,12 +6274,12 @@ $({ }); /***/ }), -/* 163 */ +/* 181 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var toISOString = __webpack_require__(164); // `Date.prototype.toISOString` method +var toISOString = __webpack_require__(182); // `Date.prototype.toISOString` method // https://tc39.es/ecma262/#sec-date.prototype.toisostring // PhantomJS / old WebKit has a broken implementations @@ -5640,62 +6293,78 @@ $({ }); /***/ }), -/* 164 */ +/* 182 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; +var global = __webpack_require__(3); + +var uncurryThis = __webpack_require__(12); + var fails = __webpack_require__(6); -var padStart = __webpack_require__(165).start; +var padStart = (__webpack_require__(183).start); +var RangeError = global.RangeError; var abs = Math.abs; var DatePrototype = Date.prototype; -var getTime = DatePrototype.getTime; -var nativeDateToISOString = DatePrototype.toISOString; // `Date.prototype.toISOString` method implementation +var n$DateToISOString = DatePrototype.toISOString; +var getTime = uncurryThis(DatePrototype.getTime); +var getUTCDate = uncurryThis(DatePrototype.getUTCDate); +var getUTCFullYear = uncurryThis(DatePrototype.getUTCFullYear); +var getUTCHours = uncurryThis(DatePrototype.getUTCHours); +var getUTCMilliseconds = uncurryThis(DatePrototype.getUTCMilliseconds); +var getUTCMinutes = uncurryThis(DatePrototype.getUTCMinutes); +var getUTCMonth = uncurryThis(DatePrototype.getUTCMonth); +var getUTCSeconds = uncurryThis(DatePrototype.getUTCSeconds); // `Date.prototype.toISOString` method implementation // https://tc39.es/ecma262/#sec-date.prototype.toisostring // PhantomJS / old WebKit fails here: module.exports = fails(function () { - return nativeDateToISOString.call(new Date(-5e13 - 1)) != '0385-07-25T07:06:39.999Z'; + return n$DateToISOString.call(new Date(-5e13 - 1)) != '0385-07-25T07:06:39.999Z'; }) || !fails(function () { - nativeDateToISOString.call(new Date(NaN)); + n$DateToISOString.call(new Date(NaN)); }) ? function toISOString() { - if (!isFinite(getTime.call(this))) throw RangeError('Invalid time value'); + if (!isFinite(getTime(this))) throw RangeError('Invalid time value'); var date = this; - var year = date.getUTCFullYear(); - var milliseconds = date.getUTCMilliseconds(); + var year = getUTCFullYear(date); + var milliseconds = getUTCMilliseconds(date); var sign = year < 0 ? '-' : year > 9999 ? '+' : ''; - return sign + padStart(abs(year), sign ? 6 : 4, 0) + '-' + padStart(date.getUTCMonth() + 1, 2, 0) + '-' + padStart(date.getUTCDate(), 2, 0) + 'T' + padStart(date.getUTCHours(), 2, 0) + ':' + padStart(date.getUTCMinutes(), 2, 0) + ':' + padStart(date.getUTCSeconds(), 2, 0) + '.' + padStart(milliseconds, 3, 0) + 'Z'; -} : nativeDateToISOString; + return sign + padStart(abs(year), sign ? 6 : 4, 0) + '-' + padStart(getUTCMonth(date) + 1, 2, 0) + '-' + padStart(getUTCDate(date), 2, 0) + 'T' + padStart(getUTCHours(date), 2, 0) + ':' + padStart(getUTCMinutes(date), 2, 0) + ':' + padStart(getUTCSeconds(date), 2, 0) + '.' + padStart(milliseconds, 3, 0) + 'Z'; +} : n$DateToISOString; /***/ }), -/* 165 */ +/* 183 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { // https://github.com/tc39/proposal-string-pad-start-end -var toLength = __webpack_require__(47); +var uncurryThis = __webpack_require__(12); -var toString = __webpack_require__(54); +var toLength = __webpack_require__(58); -var repeat = __webpack_require__(166); +var toString = __webpack_require__(64); -var requireObjectCoercible = __webpack_require__(12); +var $repeat = __webpack_require__(184); +var requireObjectCoercible = __webpack_require__(14); + +var repeat = uncurryThis($repeat); +var stringSlice = uncurryThis(''.slice); var ceil = Math.ceil; // `String.prototype.{ padStart, padEnd }` methods implementation var createMethod = function (IS_END) { return function ($this, maxLength, fillString) { var S = toString(requireObjectCoercible($this)); + var intMaxLength = toLength(maxLength); var stringLength = S.length; var fillStr = fillString === undefined ? ' ' : toString(fillString); - var intMaxLength = toLength(maxLength); var fillLen, stringFiller; if (intMaxLength <= stringLength || fillStr == '') return S; fillLen = intMaxLength - stringLength; - stringFiller = repeat.call(fillStr, ceil(fillLen / fillStr.length)); - if (stringFiller.length > fillLen) stringFiller = stringFiller.slice(0, fillLen); + stringFiller = repeat(fillStr, ceil(fillLen / fillStr.length)); + if (stringFiller.length > fillLen) stringFiller = stringSlice(stringFiller, 0, fillLen); return IS_END ? S + stringFiller : stringFiller + S; }; }; @@ -5710,24 +6379,27 @@ module.exports = { }; /***/ }), -/* 166 */ +/* 184 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var toInteger = __webpack_require__(48); +var global = __webpack_require__(3); -var toString = __webpack_require__(54); +var toIntegerOrInfinity = __webpack_require__(56); -var requireObjectCoercible = __webpack_require__(12); // `String.prototype.repeat` method implementation +var toString = __webpack_require__(64); + +var requireObjectCoercible = __webpack_require__(14); + +var RangeError = global.RangeError; // `String.prototype.repeat` method implementation // https://tc39.es/ecma262/#sec-string.prototype.repeat - module.exports = function repeat(count) { var str = toString(requireObjectCoercible(this)); var result = ''; - var n = toInteger(count); + var n = toIntegerOrInfinity(count); if (n < 0 || n == Infinity) throw RangeError('Wrong number of repetitions'); for (; n > 0; (n >>>= 1) && (str += str)) if (n & 1) result += str; @@ -5736,7 +6408,7 @@ module.exports = function repeat(count) { }; /***/ }), -/* 167 */ +/* 185 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -5746,9 +6418,9 @@ var $ = __webpack_require__(2); var fails = __webpack_require__(6); -var toObject = __webpack_require__(29); +var toObject = __webpack_require__(36); -var toPrimitive = __webpack_require__(14); +var toPrimitive = __webpack_require__(16); var FORCED = fails(function () { return new Date(NaN).toJSON() !== null || Date.prototype.toJSON.call({ @@ -5773,36 +6445,41 @@ $({ }); /***/ }), -/* 168 */ +/* 186 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var createNonEnumerableProperty = __webpack_require__(33); +var hasOwn = __webpack_require__(35); -var dateToPrimitive = __webpack_require__(169); +var redefine = __webpack_require__(43); -var wellKnownSymbol = __webpack_require__(23); +var dateToPrimitive = __webpack_require__(187); + +var wellKnownSymbol = __webpack_require__(30); var TO_PRIMITIVE = wellKnownSymbol('toPrimitive'); var DatePrototype = Date.prototype; // `Date.prototype[@@toPrimitive]` method // https://tc39.es/ecma262/#sec-date.prototype-@@toprimitive -if (!(TO_PRIMITIVE in DatePrototype)) { - createNonEnumerableProperty(DatePrototype, TO_PRIMITIVE, dateToPrimitive); +if (!hasOwn(DatePrototype, TO_PRIMITIVE)) { + redefine(DatePrototype, TO_PRIMITIVE, dateToPrimitive); } /***/ }), -/* 169 */ +/* 187 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var anObject = __webpack_require__(35); +var global = __webpack_require__(3); -var ordinaryToPrimitive = __webpack_require__(22); // `Date.prototype[@@toPrimitive](hint)` method implementation +var anObject = __webpack_require__(42); + +var ordinaryToPrimitive = __webpack_require__(29); + +var TypeError = global.TypeError; // `Date.prototype[@@toPrimitive](hint)` method implementation // https://tc39.es/ecma262/#sec-date.prototype-@@toprimitive - module.exports = function (hint) { anObject(this); if (hint === 'string' || hint === 'default') hint = 'string';else if (hint !== 'number') throw TypeError('Incorrect hint'); @@ -5810,28 +6487,30 @@ module.exports = function (hint) { }; /***/ }), -/* 170 */ +/* 188 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var redefine = __webpack_require__(36); +var uncurryThis = __webpack_require__(12); + +var redefine = __webpack_require__(43); var DatePrototype = Date.prototype; var INVALID_DATE = 'Invalid Date'; var TO_STRING = 'toString'; -var nativeDateToString = DatePrototype[TO_STRING]; -var getTime = DatePrototype.getTime; // `Date.prototype.toString` method +var un$DateToString = uncurryThis(DatePrototype[TO_STRING]); +var getTime = uncurryThis(DatePrototype.getTime); // `Date.prototype.toString` method // https://tc39.es/ecma262/#sec-date.prototype.tostring if (String(new Date(NaN)) != INVALID_DATE) { redefine(DatePrototype, TO_STRING, function toString() { - var value = getTime.call(this); // eslint-disable-next-line no-self-compare -- NaN check + var value = getTime(this); // eslint-disable-next-line no-self-compare -- NaN check - return value === value ? nativeDateToString.call(this) : INVALID_DATE; + return value === value ? un$DateToString(this) : INVALID_DATE; }); } /***/ }), -/* 171 */ +/* 189 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -5839,12 +6518,19 @@ if (String(new Date(NaN)) != INVALID_DATE) { var $ = __webpack_require__(2); -var toString = __webpack_require__(54); +var uncurryThis = __webpack_require__(12); +var toString = __webpack_require__(64); + +var charAt = uncurryThis(''.charAt); +var charCodeAt = uncurryThis(''.charCodeAt); +var exec = uncurryThis(/./.exec); +var numberToString = uncurryThis(1.0.toString); +var toUpperCase = uncurryThis(''.toUpperCase); var raw = /[\w*+\-./@]/; var hex = function (code, length) { - var result = code.toString(16); + var result = numberToString(code, 16); while (result.length < length) result = '0' + result; @@ -5864,17 +6550,17 @@ $({ var chr, code; while (index < length) { - chr = str.charAt(index++); + chr = charAt(str, index++); - if (raw.test(chr)) { + if (exec(raw, chr)) { result += chr; } else { - code = chr.charCodeAt(0); + code = charCodeAt(chr, 0); if (code < 256) { result += '%' + hex(code, 2); } else { - result += '%u' + hex(code, 4).toUpperCase(); + result += '%u' + toUpperCase(hex(code, 4)); } } } @@ -5884,12 +6570,12 @@ $({ }); /***/ }), -/* 172 */ +/* 190 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var bind = __webpack_require__(173); // `Function.prototype.bind` method +var bind = __webpack_require__(191); // `Function.prototype.bind` method // https://tc39.es/ecma262/#sec-function.prototype.bind @@ -5901,25 +6587,34 @@ $({ }); /***/ }), -/* 173 */ +/* 191 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var aFunction = __webpack_require__(66); +var global = __webpack_require__(3); -var isObject = __webpack_require__(15); +var uncurryThis = __webpack_require__(12); -var slice = [].slice; +var aCallable = __webpack_require__(27); + +var isObject = __webpack_require__(17); + +var hasOwn = __webpack_require__(35); + +var arraySlice = __webpack_require__(74); + +var Function = global.Function; +var concat = uncurryThis([].concat); +var join = uncurryThis([].join); var factories = {}; var construct = function (C, argsLength, args) { - if (!(argsLength in factories)) { - for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']'; // eslint-disable-next-line no-new-func -- we have no proper alternatives, IE8- only + if (!hasOwn(factories, argsLength)) { + for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']'; - - factories[argsLength] = Function('C,a', 'return new C(' + list.join(',') + ')'); + factories[argsLength] = Function('C,a', 'return new C(' + join(list, ',') + ')'); } return factories[argsLength](C, args); @@ -5930,32 +6625,37 @@ var construct = function (C, argsLength, args) { module.exports = Function.bind || function bind(that /* , ...args */ ) { - var fn = aFunction(this); - var partArgs = slice.call(arguments, 1); + var F = aCallable(this); + var Prototype = F.prototype; + var partArgs = arraySlice(arguments, 1); - var boundFunction = function bound() { - var args = partArgs.concat(slice.call(arguments)); - return this instanceof boundFunction ? construct(fn, args.length, args) : fn.apply(that, args); + var boundFunction = function + /* args... */ + bound() { + var args = concat(partArgs, arraySlice(arguments)); + return this instanceof boundFunction ? construct(F, args.length, args) : F.apply(that, args); }; - if (isObject(fn.prototype)) boundFunction.prototype = fn.prototype; + if (isObject(Prototype)) boundFunction.prototype = Prototype; return boundFunction; }; /***/ }), -/* 174 */ +/* 192 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var isObject = __webpack_require__(15); +var isCallable = __webpack_require__(18); -var definePropertyModule = __webpack_require__(34); +var isObject = __webpack_require__(17); -var getPrototypeOf = __webpack_require__(84); +var definePropertyModule = __webpack_require__(41); -var wellKnownSymbol = __webpack_require__(23); +var getPrototypeOf = __webpack_require__(99); + +var wellKnownSymbol = __webpack_require__(30); var HAS_INSTANCE = wellKnownSymbol('hasInstance'); var FunctionPrototype = Function.prototype; // `Function.prototype[@@hasInstance]` method @@ -5964,10 +6664,11 @@ var FunctionPrototype = Function.prototype; // `Function.prototype[@@hasInstance if (!(HAS_INSTANCE in FunctionPrototype)) { definePropertyModule.f(FunctionPrototype, HAS_INSTANCE, { value: function (O) { - if (typeof this != 'function' || !isObject(O)) return false; - if (!isObject(this.prototype)) return O instanceof this; // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this: + if (!isCallable(this) || !isObject(O)) return false; + var P = this.prototype; + if (!isObject(P)) return O instanceof this; // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this: - while (O = getPrototypeOf(O)) if (this.prototype === O) return true; + while (O = getPrototypeOf(O)) if (P === O) return true; return false; } @@ -5975,25 +6676,30 @@ if (!(HAS_INSTANCE in FunctionPrototype)) { } /***/ }), -/* 175 */ +/* 193 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var DESCRIPTORS = __webpack_require__(5); -var defineProperty = __webpack_require__(34).f; +var FUNCTION_NAME_EXISTS = (__webpack_require__(49).EXISTS); + +var uncurryThis = __webpack_require__(12); + +var defineProperty = (__webpack_require__(41).f); var FunctionPrototype = Function.prototype; -var FunctionPrototypeToString = FunctionPrototype.toString; -var nameRE = /^\s*function ([^ (]*)/; +var functionToString = uncurryThis(FunctionPrototype.toString); +var nameRE = /function\b(?:\s|\/\*[\S\s]*?\*\/|\/\/[^\n\r]*[\n\r]+)*([^\s(/]*)/; +var regExpExec = uncurryThis(nameRE.exec); var NAME = 'name'; // Function instances `.name` property // https://tc39.es/ecma262/#sec-function-instances-name -if (DESCRIPTORS && !(NAME in FunctionPrototype)) { +if (DESCRIPTORS && !FUNCTION_NAME_EXISTS) { defineProperty(FunctionPrototype, NAME, { configurable: true, get: function () { try { - return FunctionPrototypeToString.call(this).match(nameRE)[1]; + return regExpExec(nameRE, functionToString(this))[1]; } catch (error) { return ''; } @@ -6002,7 +6708,7 @@ if (DESCRIPTORS && !(NAME in FunctionPrototype)) { } /***/ }), -/* 176 */ +/* 194 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); @@ -6018,26 +6724,38 @@ $({ }); /***/ }), -/* 177 */ +/* 195 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var getBuiltIn = __webpack_require__(17); +var global = __webpack_require__(3); + +var getBuiltIn = __webpack_require__(20); + +var apply = __webpack_require__(62); + +var uncurryThis = __webpack_require__(12); var fails = __webpack_require__(6); +var Array = global.Array; var $stringify = getBuiltIn('JSON', 'stringify'); -var re = /[\uD800-\uDFFF]/g; +var exec = uncurryThis(/./.exec); +var charAt = uncurryThis(''.charAt); +var charCodeAt = uncurryThis(''.charCodeAt); +var replace = uncurryThis(''.replace); +var numberToString = uncurryThis(1.0.toString); +var tester = /[\uD800-\uDFFF]/g; var low = /^[\uD800-\uDBFF]$/; var hi = /^[\uDC00-\uDFFF]$/; var fix = function (match, offset, string) { - var prev = string.charAt(offset - 1); - var next = string.charAt(offset + 1); + var prev = charAt(string, offset - 1); + var next = charAt(string, offset + 1); - if (low.test(match) && !hi.test(next) || hi.test(match) && !low.test(prev)) { - return '\\u' + match.charCodeAt(0).toString(16); + if (exec(low, match) && !exec(hi, next) || exec(hi, match) && !exec(low, prev)) { + return '\\u' + numberToString(charCodeAt(match, 0), 16); } return match; @@ -6058,45 +6776,47 @@ if ($stringify) { }, { // eslint-disable-next-line no-unused-vars -- required for `.length` stringify: function stringify(it, replacer, space) { - var result = $stringify.apply(null, arguments); - return typeof result == 'string' ? result.replace(re, fix) : result; + for (var i = 0, l = arguments.length, args = Array(l); i < l; i++) args[i] = arguments[i]; + + var result = apply($stringify, null, args); + return typeof result == 'string' ? replace(result, tester, fix) : result; } }); } /***/ }), -/* 178 */ +/* 196 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var global = __webpack_require__(3); -var setToStringTag = __webpack_require__(63); // JSON[@@toStringTag] property +var setToStringTag = __webpack_require__(78); // JSON[@@toStringTag] property // https://tc39.es/ecma262/#sec-json-@@tostringtag setToStringTag(global.JSON, 'JSON', true); /***/ }), -/* 179 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/* 197 */ +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var collection = __webpack_require__(180); +var collection = __webpack_require__(198); -var collectionStrong = __webpack_require__(184); // `Map` constructor +var collectionStrong = __webpack_require__(204); // `Map` constructor // https://tc39.es/ecma262/#sec-map-objects -module.exports = collection('Map', function (init) { +collection('Map', function (init) { return function Map() { return init(this, arguments.length ? arguments[0] : undefined); }; }, collectionStrong); /***/ }), -/* 180 */ +/* 198 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -6106,25 +6826,29 @@ var $ = __webpack_require__(2); var global = __webpack_require__(3); -var isForced = __webpack_require__(52); +var uncurryThis = __webpack_require__(12); -var redefine = __webpack_require__(36); +var isForced = __webpack_require__(61); -var InternalMetadataModule = __webpack_require__(181); +var redefine = __webpack_require__(43); -var iterate = __webpack_require__(88); +var InternalMetadataModule = __webpack_require__(199); -var anInstance = __webpack_require__(151); +var iterate = __webpack_require__(105); -var isObject = __webpack_require__(15); +var anInstance = __webpack_require__(168); + +var isCallable = __webpack_require__(18); + +var isObject = __webpack_require__(17); var fails = __webpack_require__(6); -var checkCorrectnessOfIteration = __webpack_require__(117); +var checkCorrectnessOfIteration = __webpack_require__(134); -var setToStringTag = __webpack_require__(63); +var setToStringTag = __webpack_require__(78); -var inheritIfRequired = __webpack_require__(183); +var inheritIfRequired = __webpack_require__(203); module.exports = function (CONSTRUCTOR_NAME, wrapper, common) { var IS_MAP = CONSTRUCTOR_NAME.indexOf('Map') !== -1; @@ -6136,23 +6860,23 @@ module.exports = function (CONSTRUCTOR_NAME, wrapper, common) { var exported = {}; var fixMethod = function (KEY) { - var nativeMethod = NativePrototype[KEY]; + var uncurriedNativeMethod = uncurryThis(NativePrototype[KEY]); redefine(NativePrototype, KEY, KEY == 'add' ? function add(value) { - nativeMethod.call(this, value === 0 ? 0 : value); + uncurriedNativeMethod(this, value === 0 ? 0 : value); return this; } : KEY == 'delete' ? function (key) { - return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key); + return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key); } : KEY == 'get' ? function get(key) { - return IS_WEAK && !isObject(key) ? undefined : nativeMethod.call(this, key === 0 ? 0 : key); + return IS_WEAK && !isObject(key) ? undefined : uncurriedNativeMethod(this, key === 0 ? 0 : key); } : KEY == 'has' ? function has(key) { - return IS_WEAK && !isObject(key) ? false : nativeMethod.call(this, key === 0 ? 0 : key); + return IS_WEAK && !isObject(key) ? false : uncurriedNativeMethod(this, key === 0 ? 0 : key); } : function set(key, value) { - nativeMethod.call(this, key === 0 ? 0 : key, value); + uncurriedNativeMethod(this, key === 0 ? 0 : key, value); return this; }); }; - var REPLACE = isForced(CONSTRUCTOR_NAME, typeof NativeConstructor != 'function' || !(IS_WEAK || NativePrototype.forEach && !fails(function () { + var REPLACE = isForced(CONSTRUCTOR_NAME, !isCallable(NativeConstructor) || !(IS_WEAK || NativePrototype.forEach && !fails(function () { new NativeConstructor().entries().next(); }))); @@ -6186,7 +6910,7 @@ module.exports = function (CONSTRUCTOR_NAME, wrapper, common) { if (!ACCEPT_ITERABLES) { Constructor = wrapper(function (dummy, iterable) { - anInstance(dummy, Constructor, CONSTRUCTOR_NAME); + anInstance(dummy, NativePrototype); var that = inheritIfRequired(new NativeConstructor(), dummy, Constructor); if (iterable != undefined) iterate(iterable, that[ADDER], { that: that, @@ -6220,34 +6944,34 @@ module.exports = function (CONSTRUCTOR_NAME, wrapper, common) { }; /***/ }), -/* 181 */ +/* 199 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var hiddenKeys = __webpack_require__(41); +var uncurryThis = __webpack_require__(12); -var isObject = __webpack_require__(15); +var hiddenKeys = __webpack_require__(48); -var has = __webpack_require__(28); +var isObject = __webpack_require__(17); -var defineProperty = __webpack_require__(34).f; +var hasOwn = __webpack_require__(35); -var getOwnPropertyNamesModule = __webpack_require__(44); +var defineProperty = (__webpack_require__(41).f); -var getOwnPropertyNamesExternalModule = __webpack_require__(59); +var getOwnPropertyNamesModule = __webpack_require__(52); -var uid = __webpack_require__(30); +var getOwnPropertyNamesExternalModule = __webpack_require__(71); -var FREEZING = __webpack_require__(182); +var isExtensible = __webpack_require__(200); + +var uid = __webpack_require__(37); + +var FREEZING = __webpack_require__(202); var REQUIRED = false; var METADATA = uid('meta'); -var id = 0; // eslint-disable-next-line es/no-object-isextensible -- safe - -var isExtensible = Object.isExtensible || function () { - return true; -}; +var id = 0; var setMetadata = function (it) { defineProperty(it, METADATA, { @@ -6264,7 +6988,7 @@ var fastKey = function (it, create) { // return a primitive with prefix if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it; - if (!has(it, METADATA)) { + if (!hasOwn(it, METADATA)) { // can't set metadata to uncaught frozen object if (!isExtensible(it)) return 'F'; // not necessary to add metadata @@ -6277,7 +7001,7 @@ var fastKey = function (it, create) { }; var getWeakData = function (it, create) { - if (!has(it, METADATA)) { + if (!hasOwn(it, METADATA)) { // can't set metadata to uncaught frozen object if (!isExtensible(it)) return true; // not necessary to add metadata @@ -6291,7 +7015,7 @@ var getWeakData = function (it, create) { var onFreeze = function (it) { - if (FREEZING && REQUIRED && isExtensible(it) && !has(it, METADATA)) setMetadata(it); + if (FREEZING && REQUIRED && isExtensible(it) && !hasOwn(it, METADATA)) setMetadata(it); return it; }; @@ -6302,7 +7026,7 @@ var enable = function () { REQUIRED = true; var getOwnPropertyNames = getOwnPropertyNamesModule.f; - var splice = [].splice; + var splice = uncurryThis([].splice); var test = {}; test[METADATA] = 1; // prevent exposing of metadata key @@ -6312,7 +7036,7 @@ var enable = function () { for (var i = 0, length = result.length; i < length; i++) { if (result[i] === METADATA) { - splice.call(result, i, 1); + splice(result, i, 1); break; } } @@ -6339,7 +7063,49 @@ var meta = module.exports = { hiddenKeys[METADATA] = true; /***/ }), -/* 182 */ +/* 200 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var fails = __webpack_require__(6); + +var isObject = __webpack_require__(17); + +var classof = __webpack_require__(13); + +var ARRAY_BUFFER_NON_EXTENSIBLE = __webpack_require__(201); // eslint-disable-next-line es/no-object-isextensible -- safe + + +var $isExtensible = Object.isExtensible; +var FAILS_ON_PRIMITIVES = fails(function () { + $isExtensible(1); +}); // `Object.isExtensible` method +// https://tc39.es/ecma262/#sec-object.isextensible + +module.exports = FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE ? function isExtensible(it) { + if (!isObject(it)) return false; + if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return false; + return $isExtensible ? $isExtensible(it) : true; +} : $isExtensible; + +/***/ }), +/* 201 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +// FF26- bug: ArrayBuffers are non-extensible, but Object.isExtensible does not report it +var fails = __webpack_require__(6); + +module.exports = fails(function () { + if (typeof ArrayBuffer == 'function') { + var buffer = new ArrayBuffer(8); // eslint-disable-next-line es/no-object-isextensible, es/no-object-defineproperty -- safe + + if (Object.isExtensible(buffer)) Object.defineProperty(buffer, 'a', { + value: 8 + }); + } +}); + +/***/ }), +/* 202 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var fails = __webpack_require__(6); @@ -6350,57 +7116,59 @@ module.exports = !fails(function () { }); /***/ }), -/* 183 */ +/* 203 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var isObject = __webpack_require__(15); +var isCallable = __webpack_require__(18); -var setPrototypeOf = __webpack_require__(86); // makes subclassing work correct for wrapped built-ins +var isObject = __webpack_require__(17); + +var setPrototypeOf = __webpack_require__(101); // makes subclassing work correct for wrapped built-ins module.exports = function ($this, dummy, Wrapper) { var NewTarget, NewTargetPrototype; if ( // it can work only with native `setPrototypeOf` setPrototypeOf && // we haven't completely correct pre-ES6 way for getting `new.target`, so use this - typeof (NewTarget = dummy.constructor) == 'function' && NewTarget !== Wrapper && isObject(NewTargetPrototype = NewTarget.prototype) && NewTargetPrototype !== Wrapper.prototype) setPrototypeOf($this, NewTargetPrototype); + isCallable(NewTarget = dummy.constructor) && NewTarget !== Wrapper && isObject(NewTargetPrototype = NewTarget.prototype) && NewTargetPrototype !== Wrapper.prototype) setPrototypeOf($this, NewTargetPrototype); return $this; }; /***/ }), -/* 184 */ +/* 204 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var defineProperty = __webpack_require__(34).f; +var defineProperty = (__webpack_require__(41).f); -var create = __webpack_require__(55); +var create = __webpack_require__(67); -var redefineAll = __webpack_require__(150); +var redefineAll = __webpack_require__(167); -var bind = __webpack_require__(65); +var bind = __webpack_require__(80); -var anInstance = __webpack_require__(151); +var anInstance = __webpack_require__(168); -var iterate = __webpack_require__(88); +var iterate = __webpack_require__(105); -var defineIterator = __webpack_require__(122); +var defineIterator = __webpack_require__(139); -var setSpecies = __webpack_require__(143); +var setSpecies = __webpack_require__(160); var DESCRIPTORS = __webpack_require__(5); -var fastKey = __webpack_require__(181).fastKey; +var fastKey = (__webpack_require__(199).fastKey); -var InternalStateModule = __webpack_require__(38); +var InternalStateModule = __webpack_require__(45); var setInternalState = InternalStateModule.set; var internalStateGetterFor = InternalStateModule.getterFor; module.exports = { getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { - var C = wrapper(function (that, iterable) { - anInstance(that, C, CONSTRUCTOR_NAME); + var Constructor = wrapper(function (that, iterable) { + anInstance(that, Prototype); setInternalState(that, { type: CONSTRUCTOR_NAME, index: create(null), @@ -6414,6 +7182,7 @@ module.exports = { AS_ENTRIES: IS_MAP }); }); + var Prototype = Constructor.prototype; var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); var define = function (that, key, value) { @@ -6454,7 +7223,7 @@ module.exports = { } }; - redefineAll(C.prototype, { + redefineAll(Prototype, { // `{ Map, Set }.prototype.clear()` methods // https://tc39.es/ecma262/#sec-map.prototype.clear // https://tc39.es/ecma262/#sec-set.prototype.clear @@ -6503,7 +7272,7 @@ module.exports = { /* , that = undefined */ ) { var state = getInternalState(this); - var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3); + var boundFunction = bind(callbackfn, arguments.length > 1 ? arguments[1] : undefined); var entry; while (entry = entry ? entry.next : state.first) { @@ -6519,7 +7288,7 @@ module.exports = { return !!getEntry(this, key); } }); - redefineAll(C.prototype, IS_MAP ? { + redefineAll(Prototype, IS_MAP ? { // `Map.prototype.get(key)` method // https://tc39.es/ecma262/#sec-map.prototype.get get: function get(key) { @@ -6538,14 +7307,14 @@ module.exports = { return define(this, value = value === 0 ? 0 : value, value); } }); - if (DESCRIPTORS) defineProperty(C.prototype, 'size', { + if (DESCRIPTORS) defineProperty(Prototype, 'size', { get: function () { return getInternalState(this).size; } }); - return C; + return Constructor; }, - setStrong: function (C, CONSTRUCTOR_NAME, IS_MAP) { + setStrong: function (Constructor, CONSTRUCTOR_NAME, IS_MAP) { var ITERATOR_NAME = CONSTRUCTOR_NAME + ' Iterator'; var getInternalCollectionState = internalStateGetterFor(CONSTRUCTOR_NAME); var getInternalIteratorState = internalStateGetterFor(ITERATOR_NAME); // `{ Map, Set }.prototype.{ keys, values, entries, @@iterator }()` methods @@ -6558,7 +7327,7 @@ module.exports = { // https://tc39.es/ecma262/#sec-set.prototype.values // https://tc39.es/ecma262/#sec-set.prototype-@@iterator - defineIterator(C, CONSTRUCTOR_NAME, function (iterated, kind) { + defineIterator(Constructor, CONSTRUCTOR_NAME, function (iterated, kind) { setInternalState(this, { type: ITERATOR_NAME, target: iterated, @@ -6605,12 +7374,12 @@ module.exports = { }; /***/ }), -/* 185 */ +/* 205 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var log1p = __webpack_require__(186); // eslint-disable-next-line es/no-math-acosh -- required for testing +var log1p = __webpack_require__(206); // eslint-disable-next-line es/no-math-acosh -- required for testing var $acosh = Math.acosh; @@ -6633,7 +7402,7 @@ $({ }); /***/ }), -/* 186 */ +/* 206 */ /***/ ((module) => { var log = Math.log; // `Math.log1p` method implementation @@ -6645,7 +7414,7 @@ module.exports = Math.log1p || function log1p(x) { }; /***/ }), -/* 187 */ +/* 207 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); // eslint-disable-next-line es/no-math-asinh -- required for testing @@ -6671,7 +7440,7 @@ $({ }); /***/ }), -/* 188 */ +/* 208 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); // eslint-disable-next-line es/no-math-atanh -- required for testing @@ -6693,12 +7462,12 @@ $({ }); /***/ }), -/* 189 */ +/* 209 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var sign = __webpack_require__(190); +var sign = __webpack_require__(210); var abs = Math.abs; var pow = Math.pow; // `Math.cbrt` method @@ -6714,7 +7483,7 @@ $({ }); /***/ }), -/* 190 */ +/* 210 */ /***/ ((module) => { // `Math.sign` method implementation @@ -6726,7 +7495,7 @@ module.exports = Math.sign || function sign(x) { }; /***/ }), -/* 191 */ +/* 211 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); @@ -6746,12 +7515,12 @@ $({ }); /***/ }), -/* 192 */ +/* 212 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var expm1 = __webpack_require__(193); // eslint-disable-next-line es/no-math-cosh -- required for testing +var expm1 = __webpack_require__(213); // eslint-disable-next-line es/no-math-cosh -- required for testing var $cosh = Math.cosh; @@ -6771,7 +7540,7 @@ $({ }); /***/ }), -/* 193 */ +/* 213 */ /***/ ((module) => { // eslint-disable-next-line es/no-math-expm1 -- safe @@ -6786,12 +7555,12 @@ module.exports = !$expm1 // Old FF bug } : $expm1; /***/ }), -/* 194 */ +/* 214 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var expm1 = __webpack_require__(193); // `Math.expm1` method +var expm1 = __webpack_require__(213); // `Math.expm1` method // https://tc39.es/ecma262/#sec-math.expm1 // eslint-disable-next-line es/no-math-expm1 -- required for testing @@ -6805,12 +7574,12 @@ $({ }); /***/ }), -/* 195 */ +/* 215 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var fround = __webpack_require__(196); // `Math.fround` method +var fround = __webpack_require__(216); // `Math.fround` method // https://tc39.es/ecma262/#sec-math.fround @@ -6822,10 +7591,10 @@ $({ }); /***/ }), -/* 196 */ +/* 216 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var sign = __webpack_require__(190); +var sign = __webpack_require__(210); var abs = Math.abs; var pow = Math.pow; @@ -6854,7 +7623,7 @@ module.exports = Math.fround || function fround(x) { }; /***/ }), -/* 197 */ +/* 217 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); // eslint-disable-next-line es/no-math-hypot -- required for testing @@ -6899,7 +7668,7 @@ $({ }); /***/ }), -/* 198 */ +/* 218 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); @@ -6930,7 +7699,7 @@ $({ }); /***/ }), -/* 199 */ +/* 219 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); @@ -6949,12 +7718,12 @@ $({ }); /***/ }), -/* 200 */ +/* 220 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var log1p = __webpack_require__(186); // `Math.log1p` method +var log1p = __webpack_require__(206); // `Math.log1p` method // https://tc39.es/ecma262/#sec-math.log1p @@ -6966,7 +7735,7 @@ $({ }); /***/ }), -/* 201 */ +/* 221 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); @@ -6985,12 +7754,12 @@ $({ }); /***/ }), -/* 202 */ +/* 222 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var sign = __webpack_require__(190); // `Math.sign` method +var sign = __webpack_require__(210); // `Math.sign` method // https://tc39.es/ecma262/#sec-math.sign @@ -7002,14 +7771,14 @@ $({ }); /***/ }), -/* 203 */ +/* 223 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); var fails = __webpack_require__(6); -var expm1 = __webpack_require__(193); +var expm1 = __webpack_require__(213); var abs = Math.abs; var exp = Math.exp; @@ -7032,12 +7801,12 @@ $({ }); /***/ }), -/* 204 */ +/* 224 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var expm1 = __webpack_require__(193); +var expm1 = __webpack_require__(213); var exp = Math.exp; // `Math.tanh` method // https://tc39.es/ecma262/#sec-math.tanh @@ -7054,17 +7823,17 @@ $({ }); /***/ }), -/* 205 */ +/* 225 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var setToStringTag = __webpack_require__(63); // Math[@@toStringTag] property +var setToStringTag = __webpack_require__(78); // Math[@@toStringTag] property // https://tc39.es/ecma262/#sec-math-@@tostringtag setToStringTag(Math, 'Math', true); /***/ }), -/* 206 */ +/* 226 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); @@ -7083,7 +7852,7 @@ $({ }); /***/ }), -/* 207 */ +/* 227 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -7093,53 +7862,63 @@ var DESCRIPTORS = __webpack_require__(5); var global = __webpack_require__(3); -var isForced = __webpack_require__(52); +var uncurryThis = __webpack_require__(12); -var redefine = __webpack_require__(36); +var isForced = __webpack_require__(61); -var has = __webpack_require__(28); +var redefine = __webpack_require__(43); -var classof = __webpack_require__(11); +var hasOwn = __webpack_require__(35); -var inheritIfRequired = __webpack_require__(183); +var inheritIfRequired = __webpack_require__(203); -var isSymbol = __webpack_require__(16); +var isPrototypeOf = __webpack_require__(21); -var toPrimitive = __webpack_require__(14); +var isSymbol = __webpack_require__(19); + +var toPrimitive = __webpack_require__(16); var fails = __webpack_require__(6); -var create = __webpack_require__(55); +var getOwnPropertyNames = (__webpack_require__(52).f); -var getOwnPropertyNames = __webpack_require__(44).f; +var getOwnPropertyDescriptor = (__webpack_require__(4).f); -var getOwnPropertyDescriptor = __webpack_require__(4).f; +var defineProperty = (__webpack_require__(41).f); -var defineProperty = __webpack_require__(34).f; +var thisNumberValue = __webpack_require__(228); -var trim = __webpack_require__(208).trim; +var trim = (__webpack_require__(229).trim); var NUMBER = 'Number'; var NativeNumber = global[NUMBER]; -var NumberPrototype = NativeNumber.prototype; // Opera ~12 has broken Object#toString +var NumberPrototype = NativeNumber.prototype; +var TypeError = global.TypeError; +var arraySlice = uncurryThis(''.slice); +var charCodeAt = uncurryThis(''.charCodeAt); // `ToNumeric` abstract operation +// https://tc39.es/ecma262/#sec-tonumeric -var BROKEN_CLASSOF = classof(create(NumberPrototype)) == NUMBER; // `ToNumber` abstract operation +var toNumeric = function (value) { + var primValue = toPrimitive(value, 'number'); + return typeof primValue == 'bigint' ? primValue : toNumber(primValue); +}; // `ToNumber` abstract operation // https://tc39.es/ecma262/#sec-tonumber + var toNumber = function (argument) { - if (isSymbol(argument)) throw TypeError('Cannot convert a Symbol value to a number'); var it = toPrimitive(argument, 'number'); var first, third, radix, maxCode, digits, length, index, code; + if (isSymbol(it)) throw TypeError('Cannot convert a Symbol value to a number'); if (typeof it == 'string' && it.length > 2) { it = trim(it); - first = it.charCodeAt(0); + first = charCodeAt(it, 0); if (first === 43 || first === 45) { - third = it.charCodeAt(2); + third = charCodeAt(it, 2); if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix } else if (first === 48) { - switch (it.charCodeAt(1)) { + switch (charCodeAt(it, 1)) { case 66: case 98: radix = 2; @@ -7158,11 +7937,11 @@ var toNumber = function (argument) { return +it; } - digits = it.slice(2); + digits = arraySlice(it, 2); length = digits.length; for (index = 0; index < length; index++) { - code = digits.charCodeAt(index); // parseInt parses a string to a first unavailable symbol + code = charCodeAt(digits, index); // parseInt parses a string to a first unavailable symbol // but ToNumber should return NaN if a string contains unavailable symbols if (code < 48 || code > maxCode) return NaN; @@ -7179,19 +7958,19 @@ var toNumber = function (argument) { if (isForced(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) { var NumberWrapper = function Number(value) { - var it = arguments.length < 1 ? 0 : value; - var dummy = this; - return dummy instanceof NumberWrapper // check on 1..constructor(foo) case - && (BROKEN_CLASSOF ? fails(function () { - NumberPrototype.valueOf.call(dummy); - }) : classof(dummy) != NUMBER) ? inheritIfRequired(new NativeNumber(toNumber(it)), dummy, NumberWrapper) : toNumber(it); + var n = arguments.length < 1 ? 0 : NativeNumber(toNumeric(value)); + var dummy = this; // check on 1..constructor(foo) case + + return isPrototypeOf(NumberPrototype, dummy) && fails(function () { + thisNumberValue(dummy); + }) ? inheritIfRequired(Object(n), dummy, NumberWrapper) : n; }; for (var keys = DESCRIPTORS ? getOwnPropertyNames(NativeNumber) : ( // ES3: 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' + // ES2015 (in case, if modules with ES2015 Number statics required before): - 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,' + // ESNext + 'EPSILON,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,isFinite,isInteger,isNaN,isSafeInteger,parseFloat,parseInt,' + // ESNext 'fromString,range').split(','), j = 0, key; keys.length > j; j++) { - if (has(NativeNumber, key = keys[j]) && !has(NumberWrapper, key)) { + if (hasOwn(NativeNumber, key = keys[j]) && !hasOwn(NumberWrapper, key)) { defineProperty(NumberWrapper, key, getOwnPropertyDescriptor(NativeNumber, key)); } } @@ -7202,15 +7981,28 @@ if (isForced(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumb } /***/ }), -/* 208 */ +/* 228 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var requireObjectCoercible = __webpack_require__(12); +var uncurryThis = __webpack_require__(12); // `thisNumberValue` abstract operation +// https://tc39.es/ecma262/#sec-thisnumbervalue -var toString = __webpack_require__(54); -var whitespaces = __webpack_require__(209); +module.exports = uncurryThis(1.0.valueOf); +/***/ }), +/* 229 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +var uncurryThis = __webpack_require__(12); + +var requireObjectCoercible = __webpack_require__(14); + +var toString = __webpack_require__(64); + +var whitespaces = __webpack_require__(230); + +var replace = uncurryThis(''.replace); var whitespace = '[' + whitespaces + ']'; var ltrim = RegExp('^' + whitespace + whitespace + '*'); var rtrim = RegExp(whitespace + whitespace + '*$'); // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation @@ -7218,8 +8010,8 @@ var rtrim = RegExp(whitespace + whitespace + '*$'); // `String.prototype.{ trim, var createMethod = function (TYPE) { return function ($this) { var string = toString(requireObjectCoercible($this)); - if (TYPE & 1) string = string.replace(ltrim, ''); - if (TYPE & 2) string = string.replace(rtrim, ''); + if (TYPE & 1) string = replace(string, ltrim, ''); + if (TYPE & 2) string = replace(string, rtrim, ''); return string; }; }; @@ -7237,14 +8029,14 @@ module.exports = { }; /***/ }), -/* 209 */ +/* 230 */ /***/ ((module) => { // a string of all valid unicode whitespaces module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002' + '\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF'; /***/ }), -/* 210 */ +/* 231 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); // `Number.EPSILON` constant @@ -7259,12 +8051,12 @@ $({ }); /***/ }), -/* 211 */ +/* 232 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var numberIsFinite = __webpack_require__(212); // `Number.isFinite` method +var numberIsFinite = __webpack_require__(233); // `Number.isFinite` method // https://tc39.es/ecma262/#sec-number.isfinite @@ -7276,7 +8068,7 @@ $({ }); /***/ }), -/* 212 */ +/* 233 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var global = __webpack_require__(3); @@ -7290,12 +8082,12 @@ module.exports = Number.isFinite || function isFinite(it) { }; /***/ }), -/* 213 */ +/* 234 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var isInteger = __webpack_require__(214); // `Number.isInteger` method +var isIntegralNumber = __webpack_require__(235); // `Number.isInteger` method // https://tc39.es/ecma262/#sec-number.isinteger @@ -7303,24 +8095,25 @@ $({ target: 'Number', stat: true }, { - isInteger: isInteger + isInteger: isIntegralNumber }); /***/ }), -/* 214 */ +/* 235 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var isObject = __webpack_require__(15); +var isObject = __webpack_require__(17); -var floor = Math.floor; // `Number.isInteger` method implementation -// https://tc39.es/ecma262/#sec-number.isinteger +var floor = Math.floor; // `IsIntegralNumber` abstract operation +// https://tc39.es/ecma262/#sec-isintegralnumber +// eslint-disable-next-line es/no-number-isinteger -- safe -module.exports = function isInteger(it) { +module.exports = Number.isInteger || function isInteger(it) { return !isObject(it) && isFinite(it) && floor(it) === it; }; /***/ }), -/* 215 */ +/* 236 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); // `Number.isNaN` method @@ -7338,12 +8131,12 @@ $({ }); /***/ }), -/* 216 */ +/* 237 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var isInteger = __webpack_require__(214); +var isIntegralNumber = __webpack_require__(235); var abs = Math.abs; // `Number.isSafeInteger` method // https://tc39.es/ecma262/#sec-number.issafeinteger @@ -7353,12 +8146,12 @@ $({ stat: true }, { isSafeInteger: function isSafeInteger(number) { - return isInteger(number) && abs(number) <= 0x1FFFFFFFFFFFFF; + return isIntegralNumber(number) && abs(number) <= 0x1FFFFFFFFFFFFF; } }); /***/ }), -/* 217 */ +/* 238 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); // `Number.MAX_SAFE_INTEGER` constant @@ -7373,7 +8166,7 @@ $({ }); /***/ }), -/* 218 */ +/* 239 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); // `Number.MIN_SAFE_INTEGER` constant @@ -7388,12 +8181,12 @@ $({ }); /***/ }), -/* 219 */ +/* 240 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var parseFloat = __webpack_require__(220); // `Number.parseFloat` method +var parseFloat = __webpack_require__(241); // `Number.parseFloat` method // https://tc39.es/ecma262/#sec-number.parseFloat // eslint-disable-next-line es/no-number-parsefloat -- required for testing @@ -7407,34 +8200,44 @@ $({ }); /***/ }), -/* 220 */ +/* 241 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var global = __webpack_require__(3); -var toString = __webpack_require__(54); +var fails = __webpack_require__(6); -var trim = __webpack_require__(208).trim; +var uncurryThis = __webpack_require__(12); -var whitespaces = __webpack_require__(209); +var toString = __webpack_require__(64); -var $parseFloat = global.parseFloat; -var FORCED = 1 / $parseFloat(whitespaces + '-0') !== -Infinity; // `parseFloat` method +var trim = (__webpack_require__(229).trim); + +var whitespaces = __webpack_require__(230); + +var charAt = uncurryThis(''.charAt); +var n$ParseFloat = global.parseFloat; +var Symbol = global.Symbol; +var ITERATOR = Symbol && Symbol.iterator; +var FORCED = 1 / n$ParseFloat(whitespaces + '-0') !== -Infinity // MS Edge 18- broken with boxed symbols +|| ITERATOR && !fails(function () { + n$ParseFloat(Object(ITERATOR)); +}); // `parseFloat` method // https://tc39.es/ecma262/#sec-parsefloat-string module.exports = FORCED ? function parseFloat(string) { var trimmedString = trim(toString(string)); - var result = $parseFloat(trimmedString); - return result === 0 && trimmedString.charAt(0) == '-' ? -0 : result; -} : $parseFloat; + var result = n$ParseFloat(trimmedString); + return result === 0 && charAt(trimmedString, 0) == '-' ? -0 : result; +} : n$ParseFloat; /***/ }), -/* 221 */ +/* 242 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var parseInt = __webpack_require__(222); // `Number.parseInt` method +var parseInt = __webpack_require__(243); // `Number.parseInt` method // https://tc39.es/ecma262/#sec-number.parseint // eslint-disable-next-line es/no-number-parseint -- required for testing @@ -7448,29 +8251,39 @@ $({ }); /***/ }), -/* 222 */ +/* 243 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var global = __webpack_require__(3); -var toString = __webpack_require__(54); +var fails = __webpack_require__(6); -var trim = __webpack_require__(208).trim; +var uncurryThis = __webpack_require__(12); -var whitespaces = __webpack_require__(209); +var toString = __webpack_require__(64); + +var trim = (__webpack_require__(229).trim); + +var whitespaces = __webpack_require__(230); var $parseInt = global.parseInt; -var hex = /^[+-]?0[Xx]/; -var FORCED = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22; // `parseInt` method +var Symbol = global.Symbol; +var ITERATOR = Symbol && Symbol.iterator; +var hex = /^[+-]?0x/i; +var exec = uncurryThis(hex.exec); +var FORCED = $parseInt(whitespaces + '08') !== 8 || $parseInt(whitespaces + '0x16') !== 22 // MS Edge 18- broken with boxed symbols +|| ITERATOR && !fails(function () { + $parseInt(Object(ITERATOR)); +}); // `parseInt` method // https://tc39.es/ecma262/#sec-parseint-string-radix module.exports = FORCED ? function parseInt(string, radix) { var S = trim(toString(string)); - return $parseInt(S, radix >>> 0 || (hex.test(S) ? 16 : 10)); + return $parseInt(S, radix >>> 0 || (exec(hex, S) ? 16 : 10)); } : $parseInt; /***/ }), -/* 223 */ +/* 244 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -7478,16 +8291,24 @@ module.exports = FORCED ? function parseInt(string, radix) { var $ = __webpack_require__(2); -var toInteger = __webpack_require__(48); +var global = __webpack_require__(3); -var thisNumberValue = __webpack_require__(224); +var uncurryThis = __webpack_require__(12); -var repeat = __webpack_require__(166); +var toIntegerOrInfinity = __webpack_require__(56); + +var thisNumberValue = __webpack_require__(228); + +var $repeat = __webpack_require__(184); var fails = __webpack_require__(6); -var nativeToFixed = 1.0.toFixed; +var RangeError = global.RangeError; +var String = global.String; var floor = Math.floor; +var repeat = uncurryThis($repeat); +var stringSlice = uncurryThis(''.slice); +var un$ToFixed = uncurryThis(1.0.toFixed); var pow = function (x, n, acc) { return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc); @@ -7539,16 +8360,18 @@ var dataToString = function (data) { while (--index >= 0) { if (s !== '' || index === 0 || data[index] !== 0) { var t = String(data[index]); - s = s === '' ? t : s + repeat.call('0', 7 - t.length) + t; + s = s === '' ? t : s + repeat('0', 7 - t.length) + t; } } return s; }; -var FORCED = nativeToFixed && (0.00008.toFixed(3) !== '0.000' || 0.9.toFixed(0) !== '1' || 1.255.toFixed(2) !== '1.25' || 1000000000000000128.0.toFixed(0) !== '1000000000000000128') || !fails(function () { +var FORCED = fails(function () { + return un$ToFixed(0.00008, 3) !== '0.000' || un$ToFixed(0.9, 0) !== '1' || un$ToFixed(1.255, 2) !== '1.25' || un$ToFixed(1000000000000000128.0, 0) !== '1000000000000000128'; +}) || !fails(function () { // V8 ~ Android 4.3- - nativeToFixed.call({}); + un$ToFixed({}); }); // `Number.prototype.toFixed` method // https://tc39.es/ecma262/#sec-number.prototype.tofixed @@ -7559,7 +8382,7 @@ $({ }, { toFixed: function toFixed(fractionDigits) { var number = thisNumberValue(this); - var fractDigits = toInteger(fractionDigits); + var fractDigits = toIntegerOrInfinity(fractionDigits); var data = [0, 0, 0, 0, 0, 0]; var sign = ''; var result = '0'; @@ -7604,13 +8427,13 @@ $({ } else { multiply(data, 0, z); multiply(data, 1 << -e, 0); - result = dataToString(data) + repeat.call('0', fractDigits); + result = dataToString(data) + repeat('0', fractDigits); } } if (fractDigits > 0) { k = result.length; - result = sign + (k <= fractDigits ? '0.' + repeat.call('0', fractDigits - k) + result : result.slice(0, k - fractDigits) + '.' + result.slice(k - fractDigits)); + result = sign + (k <= fractDigits ? '0.' + repeat('0', fractDigits - k) + result : stringSlice(result, 0, k - fractDigits) + '.' + stringSlice(result, k - fractDigits)); } else { result = sign + result; } @@ -7620,23 +8443,7 @@ $({ }); /***/ }), -/* 224 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -var classof = __webpack_require__(11); // `thisNumberValue` abstract operation -// https://tc39.es/ecma262/#sec-thisnumbervalue - - -module.exports = function (value) { - if (typeof value != 'number' && classof(value) != 'Number') { - throw TypeError('Incorrect invocation'); - } - - return +value; -}; - -/***/ }), -/* 225 */ +/* 245 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -7644,17 +8451,19 @@ module.exports = function (value) { var $ = __webpack_require__(2); +var uncurryThis = __webpack_require__(12); + var fails = __webpack_require__(6); -var thisNumberValue = __webpack_require__(224); +var thisNumberValue = __webpack_require__(228); -var nativeToPrecision = 1.0.toPrecision; +var un$ToPrecision = uncurryThis(1.0.toPrecision); var FORCED = fails(function () { // IE7- - return nativeToPrecision.call(1, undefined) !== '1'; + return un$ToPrecision(1, undefined) !== '1'; }) || !fails(function () { // V8 ~ Android 4.3- - nativeToPrecision.call({}); + un$ToPrecision({}); }); // `Number.prototype.toPrecision` method // https://tc39.es/ecma262/#sec-number.prototype.toprecision @@ -7664,17 +8473,17 @@ $({ forced: FORCED }, { toPrecision: function toPrecision(precision) { - return precision === undefined ? nativeToPrecision.call(thisNumberValue(this)) : nativeToPrecision.call(thisNumberValue(this), precision); + return precision === undefined ? un$ToPrecision(thisNumberValue(this)) : un$ToPrecision(thisNumberValue(this), precision); } }); /***/ }), -/* 226 */ +/* 246 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var assign = __webpack_require__(227); // `Object.assign` method +var assign = __webpack_require__(247); // `Object.assign` method // https://tc39.es/ecma262/#sec-object.assign // eslint-disable-next-line es/no-object-assign -- required for testing @@ -7688,7 +8497,7 @@ $({ }); /***/ }), -/* 227 */ +/* 247 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -7696,22 +8505,27 @@ $({ var DESCRIPTORS = __webpack_require__(5); +var uncurryThis = __webpack_require__(12); + +var call = __webpack_require__(7); + var fails = __webpack_require__(6); -var objectKeys = __webpack_require__(57); +var objectKeys = __webpack_require__(69); -var getOwnPropertySymbolsModule = __webpack_require__(51); +var getOwnPropertySymbolsModule = __webpack_require__(60); -var propertyIsEnumerableModule = __webpack_require__(7); +var propertyIsEnumerableModule = __webpack_require__(8); -var toObject = __webpack_require__(29); +var toObject = __webpack_require__(36); -var IndexedObject = __webpack_require__(10); // eslint-disable-next-line es/no-object-assign -- safe +var IndexedObject = __webpack_require__(11); // eslint-disable-next-line es/no-object-assign -- safe var $assign = Object.assign; // eslint-disable-next-line es/no-object-defineproperty -- required for testing -var defineProperty = Object.defineProperty; // `Object.assign` method +var defineProperty = Object.defineProperty; +var concat = uncurryThis([].concat); // `Object.assign` method // https://tc39.es/ecma262/#sec-object.assign module.exports = !$assign || fails(function () { @@ -7750,14 +8564,14 @@ module.exports = !$assign || fails(function () { while (argumentsLength > index) { var S = IndexedObject(arguments[index++]); - var keys = getOwnPropertySymbols ? objectKeys(S).concat(getOwnPropertySymbols(S)) : objectKeys(S); + var keys = getOwnPropertySymbols ? concat(objectKeys(S), getOwnPropertySymbols(S)) : objectKeys(S); var length = keys.length; var j = 0; var key; while (length > j) { key = keys[j++]; - if (!DESCRIPTORS || propertyIsEnumerable.call(S, key)) T[key] = S[key]; + if (!DESCRIPTORS || call(propertyIsEnumerable, S, key)) T[key] = S[key]; } } @@ -7765,14 +8579,14 @@ module.exports = !$assign || fails(function () { } : $assign; /***/ }), -/* 228 */ +/* 248 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); var DESCRIPTORS = __webpack_require__(5); -var create = __webpack_require__(55); // `Object.create` method +var create = __webpack_require__(67); // `Object.create` method // https://tc39.es/ecma262/#sec-object.create @@ -7785,7 +8599,7 @@ $({ }); /***/ }), -/* 229 */ +/* 249 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -7795,13 +8609,13 @@ var $ = __webpack_require__(2); var DESCRIPTORS = __webpack_require__(5); -var FORCED = __webpack_require__(230); +var FORCED = __webpack_require__(250); -var toObject = __webpack_require__(29); +var aCallable = __webpack_require__(27); -var aFunction = __webpack_require__(66); +var toObject = __webpack_require__(36); -var definePropertyModule = __webpack_require__(34); // `Object.prototype.__defineGetter__` method +var definePropertyModule = __webpack_require__(41); // `Object.prototype.__defineGetter__` method // https://tc39.es/ecma262/#sec-object.prototype.__defineGetter__ @@ -7813,7 +8627,7 @@ if (DESCRIPTORS) { }, { __defineGetter__: function __defineGetter__(P, getter) { definePropertyModule.f(toObject(this), P, { - get: aFunction(getter), + get: aCallable(getter), enumerable: true, configurable: true }); @@ -7822,19 +8636,19 @@ if (DESCRIPTORS) { } /***/ }), -/* 230 */ +/* 250 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var IS_PURE = __webpack_require__(25); +var IS_PURE = __webpack_require__(32); var global = __webpack_require__(3); var fails = __webpack_require__(6); -var WEBKIT = __webpack_require__(141); // Forced replacement object prototype accessors methods +var WEBKIT = __webpack_require__(158); // Forced replacement object prototype accessors methods module.exports = IS_PURE || !fails(function () { @@ -7852,14 +8666,14 @@ module.exports = IS_PURE || !fails(function () { }); /***/ }), -/* 231 */ +/* 251 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); var DESCRIPTORS = __webpack_require__(5); -var defineProperties = __webpack_require__(56); // `Object.defineProperties` method +var defineProperties = __webpack_require__(68); // `Object.defineProperties` method // https://tc39.es/ecma262/#sec-object.defineproperties @@ -7873,14 +8687,14 @@ $({ }); /***/ }), -/* 232 */ +/* 252 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); var DESCRIPTORS = __webpack_require__(5); -var objectDefinePropertyModile = __webpack_require__(34); // `Object.defineProperty` method +var objectDefinePropertyModile = __webpack_require__(41); // `Object.defineProperty` method // https://tc39.es/ecma262/#sec-object.defineproperty @@ -7894,7 +8708,7 @@ $({ }); /***/ }), -/* 233 */ +/* 253 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -7904,13 +8718,13 @@ var $ = __webpack_require__(2); var DESCRIPTORS = __webpack_require__(5); -var FORCED = __webpack_require__(230); +var FORCED = __webpack_require__(250); -var toObject = __webpack_require__(29); +var aCallable = __webpack_require__(27); -var aFunction = __webpack_require__(66); +var toObject = __webpack_require__(36); -var definePropertyModule = __webpack_require__(34); // `Object.prototype.__defineSetter__` method +var definePropertyModule = __webpack_require__(41); // `Object.prototype.__defineSetter__` method // https://tc39.es/ecma262/#sec-object.prototype.__defineSetter__ @@ -7922,7 +8736,7 @@ if (DESCRIPTORS) { }, { __defineSetter__: function __defineSetter__(P, setter) { definePropertyModule.f(toObject(this), P, { - set: aFunction(setter), + set: aCallable(setter), enumerable: true, configurable: true }); @@ -7931,12 +8745,12 @@ if (DESCRIPTORS) { } /***/ }), -/* 234 */ +/* 254 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var $entries = __webpack_require__(235).entries; // `Object.entries` method +var $entries = (__webpack_require__(255).entries); // `Object.entries` method // https://tc39.es/ecma262/#sec-object.entries @@ -7950,17 +8764,21 @@ $({ }); /***/ }), -/* 235 */ +/* 255 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var DESCRIPTORS = __webpack_require__(5); -var objectKeys = __webpack_require__(57); +var uncurryThis = __webpack_require__(12); -var toIndexedObject = __webpack_require__(9); +var objectKeys = __webpack_require__(69); -var propertyIsEnumerable = __webpack_require__(7).f; // `Object.{ entries, values }` methods implementation +var toIndexedObject = __webpack_require__(10); +var $propertyIsEnumerable = (__webpack_require__(8).f); + +var propertyIsEnumerable = uncurryThis($propertyIsEnumerable); +var push = uncurryThis([].push); // `Object.{ entries, values }` methods implementation var createMethod = function (TO_ENTRIES) { return function (it) { @@ -7974,8 +8792,8 @@ var createMethod = function (TO_ENTRIES) { while (length > i) { key = keys[i++]; - if (!DESCRIPTORS || propertyIsEnumerable.call(O, key)) { - result.push(TO_ENTRIES ? [key, O[key]] : O[key]); + if (!DESCRIPTORS || propertyIsEnumerable(O, key)) { + push(result, TO_ENTRIES ? [key, O[key]] : O[key]); } } @@ -7993,18 +8811,18 @@ module.exports = { }; /***/ }), -/* 236 */ +/* 256 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var FREEZING = __webpack_require__(182); +var FREEZING = __webpack_require__(202); var fails = __webpack_require__(6); -var isObject = __webpack_require__(15); +var isObject = __webpack_require__(17); -var onFreeze = __webpack_require__(181).onFreeze; // eslint-disable-next-line es/no-object-freeze -- safe +var onFreeze = (__webpack_require__(199).onFreeze); // eslint-disable-next-line es/no-object-freeze -- safe var $freeze = Object.freeze; @@ -8025,14 +8843,14 @@ $({ }); /***/ }), -/* 237 */ +/* 257 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var iterate = __webpack_require__(88); +var iterate = __webpack_require__(105); -var createProperty = __webpack_require__(97); // `Object.fromEntries` method +var createProperty = __webpack_require__(73); // `Object.fromEntries` method // https://github.com/tc39/proposal-object-from-entries @@ -8052,16 +8870,16 @@ $({ }); /***/ }), -/* 238 */ +/* 258 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); var fails = __webpack_require__(6); -var toIndexedObject = __webpack_require__(9); +var toIndexedObject = __webpack_require__(10); -var nativeGetOwnPropertyDescriptor = __webpack_require__(4).f; +var nativeGetOwnPropertyDescriptor = (__webpack_require__(4).f); var DESCRIPTORS = __webpack_require__(5); @@ -8083,20 +8901,20 @@ $({ }); /***/ }), -/* 239 */ +/* 259 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); var DESCRIPTORS = __webpack_require__(5); -var ownKeys = __webpack_require__(43); +var ownKeys = __webpack_require__(51); -var toIndexedObject = __webpack_require__(9); +var toIndexedObject = __webpack_require__(10); var getOwnPropertyDescriptorModule = __webpack_require__(4); -var createProperty = __webpack_require__(97); // `Object.getOwnPropertyDescriptors` method +var createProperty = __webpack_require__(73); // `Object.getOwnPropertyDescriptors` method // https://tc39.es/ecma262/#sec-object.getownpropertydescriptors @@ -8123,14 +8941,14 @@ $({ }); /***/ }), -/* 240 */ +/* 260 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); var fails = __webpack_require__(6); -var getOwnPropertyNames = __webpack_require__(59).f; // eslint-disable-next-line es/no-object-getownpropertynames -- required for testing +var getOwnPropertyNames = (__webpack_require__(71).f); // eslint-disable-next-line es/no-object-getownpropertynames -- required for testing var FAILS_ON_PRIMITIVES = fails(function () { @@ -8147,18 +8965,18 @@ $({ }); /***/ }), -/* 241 */ +/* 261 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); var fails = __webpack_require__(6); -var toObject = __webpack_require__(29); +var toObject = __webpack_require__(36); -var nativeGetPrototypeOf = __webpack_require__(84); +var nativeGetPrototypeOf = __webpack_require__(99); -var CORRECT_PROTOTYPE_GETTER = __webpack_require__(85); +var CORRECT_PROTOTYPE_GETTER = __webpack_require__(100); var FAILS_ON_PRIMITIVES = fails(function () { nativeGetPrototypeOf(1); @@ -8177,12 +8995,29 @@ $({ }); /***/ }), -/* 242 */ +/* 262 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var is = __webpack_require__(243); // `Object.is` method +var hasOwn = __webpack_require__(35); // `Object.hasOwn` method +// https://github.com/tc39/proposal-accessible-object-hasownproperty + + +$({ + target: 'Object', + stat: true +}, { + hasOwn: hasOwn +}); + +/***/ }), +/* 263 */ +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + +var $ = __webpack_require__(2); + +var is = __webpack_require__(264); // `Object.is` method // https://tc39.es/ecma262/#sec-object.is @@ -8194,7 +9029,7 @@ $({ }); /***/ }), -/* 243 */ +/* 264 */ /***/ ((module) => { // `SameValue` abstract operation @@ -8206,41 +9041,37 @@ module.exports = Object.is || function is(x, y) { }; /***/ }), -/* 244 */ +/* 265 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var fails = __webpack_require__(6); - -var isObject = __webpack_require__(15); // eslint-disable-next-line es/no-object-isextensible -- safe - - -var $isExtensible = Object.isExtensible; -var FAILS_ON_PRIMITIVES = fails(function () { - $isExtensible(1); -}); // `Object.isExtensible` method +var $isExtensible = __webpack_require__(200); // `Object.isExtensible` method // https://tc39.es/ecma262/#sec-object.isextensible +// eslint-disable-next-line es/no-object-isextensible -- safe + $({ target: 'Object', stat: true, - forced: FAILS_ON_PRIMITIVES + forced: Object.isExtensible !== $isExtensible }, { - isExtensible: function isExtensible(it) { - return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false; - } + isExtensible: $isExtensible }); /***/ }), -/* 245 */ +/* 266 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); var fails = __webpack_require__(6); -var isObject = __webpack_require__(15); // eslint-disable-next-line es/no-object-isfrozen -- safe +var isObject = __webpack_require__(17); + +var classof = __webpack_require__(13); + +var ARRAY_BUFFER_NON_EXTENSIBLE = __webpack_require__(201); // eslint-disable-next-line es/no-object-isfrozen -- safe var $isFrozen = Object.isFrozen; @@ -8252,22 +9083,28 @@ var FAILS_ON_PRIMITIVES = fails(function () { $({ target: 'Object', stat: true, - forced: FAILS_ON_PRIMITIVES + forced: FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE }, { isFrozen: function isFrozen(it) { - return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true; + if (!isObject(it)) return true; + if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return true; + return $isFrozen ? $isFrozen(it) : false; } }); /***/ }), -/* 246 */ +/* 267 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); var fails = __webpack_require__(6); -var isObject = __webpack_require__(15); // eslint-disable-next-line es/no-object-issealed -- safe +var isObject = __webpack_require__(17); + +var classof = __webpack_require__(13); + +var ARRAY_BUFFER_NON_EXTENSIBLE = __webpack_require__(201); // eslint-disable-next-line es/no-object-issealed -- safe var $isSealed = Object.isSealed; @@ -8279,22 +9116,24 @@ var FAILS_ON_PRIMITIVES = fails(function () { $({ target: 'Object', stat: true, - forced: FAILS_ON_PRIMITIVES + forced: FAILS_ON_PRIMITIVES || ARRAY_BUFFER_NON_EXTENSIBLE }, { isSealed: function isSealed(it) { - return isObject(it) ? $isSealed ? $isSealed(it) : false : true; + if (!isObject(it)) return true; + if (ARRAY_BUFFER_NON_EXTENSIBLE && classof(it) == 'ArrayBuffer') return true; + return $isSealed ? $isSealed(it) : false; } }); /***/ }), -/* 247 */ +/* 268 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var toObject = __webpack_require__(29); +var toObject = __webpack_require__(36); -var nativeKeys = __webpack_require__(57); +var nativeKeys = __webpack_require__(69); var fails = __webpack_require__(6); @@ -8314,7 +9153,7 @@ $({ }); /***/ }), -/* 248 */ +/* 269 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -8324,15 +9163,15 @@ var $ = __webpack_require__(2); var DESCRIPTORS = __webpack_require__(5); -var FORCED = __webpack_require__(230); +var FORCED = __webpack_require__(250); -var toObject = __webpack_require__(29); +var toObject = __webpack_require__(36); -var toPropertyKey = __webpack_require__(13); +var toPropertyKey = __webpack_require__(15); -var getPrototypeOf = __webpack_require__(84); +var getPrototypeOf = __webpack_require__(99); -var getOwnPropertyDescriptor = __webpack_require__(4).f; // `Object.prototype.__lookupGetter__` method +var getOwnPropertyDescriptor = (__webpack_require__(4).f); // `Object.prototype.__lookupGetter__` method // https://tc39.es/ecma262/#sec-object.prototype.__lookupGetter__ @@ -8355,7 +9194,7 @@ if (DESCRIPTORS) { } /***/ }), -/* 249 */ +/* 270 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -8365,15 +9204,15 @@ var $ = __webpack_require__(2); var DESCRIPTORS = __webpack_require__(5); -var FORCED = __webpack_require__(230); +var FORCED = __webpack_require__(250); -var toObject = __webpack_require__(29); +var toObject = __webpack_require__(36); -var toPropertyKey = __webpack_require__(13); +var toPropertyKey = __webpack_require__(15); -var getPrototypeOf = __webpack_require__(84); +var getPrototypeOf = __webpack_require__(99); -var getOwnPropertyDescriptor = __webpack_require__(4).f; // `Object.prototype.__lookupSetter__` method +var getOwnPropertyDescriptor = (__webpack_require__(4).f); // `Object.prototype.__lookupSetter__` method // https://tc39.es/ecma262/#sec-object.prototype.__lookupSetter__ @@ -8396,16 +9235,16 @@ if (DESCRIPTORS) { } /***/ }), -/* 250 */ +/* 271 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var isObject = __webpack_require__(15); +var isObject = __webpack_require__(17); -var onFreeze = __webpack_require__(181).onFreeze; +var onFreeze = (__webpack_require__(199).onFreeze); -var FREEZING = __webpack_require__(182); +var FREEZING = __webpack_require__(202); var fails = __webpack_require__(6); // eslint-disable-next-line es/no-object-preventextensions -- safe @@ -8428,16 +9267,16 @@ $({ }); /***/ }), -/* 251 */ +/* 272 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var isObject = __webpack_require__(15); +var isObject = __webpack_require__(17); -var onFreeze = __webpack_require__(181).onFreeze; +var onFreeze = (__webpack_require__(199).onFreeze); -var FREEZING = __webpack_require__(182); +var FREEZING = __webpack_require__(202); var fails = __webpack_require__(6); // eslint-disable-next-line es/no-object-seal -- safe @@ -8460,12 +9299,12 @@ $({ }); /***/ }), -/* 252 */ +/* 273 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var setPrototypeOf = __webpack_require__(86); // `Object.setPrototypeOf` method +var setPrototypeOf = __webpack_require__(101); // `Object.setPrototypeOf` method // https://tc39.es/ecma262/#sec-object.setprototypeof @@ -8477,14 +9316,14 @@ $({ }); /***/ }), -/* 253 */ +/* 274 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var TO_STRING_TAG_SUPPORT = __webpack_require__(94); +var TO_STRING_TAG_SUPPORT = __webpack_require__(66); -var redefine = __webpack_require__(36); +var redefine = __webpack_require__(43); -var toString = __webpack_require__(254); // `Object.prototype.toString` method +var toString = __webpack_require__(275); // `Object.prototype.toString` method // https://tc39.es/ecma262/#sec-object.prototype.tostring @@ -8495,15 +9334,15 @@ if (!TO_STRING_TAG_SUPPORT) { } /***/ }), -/* 254 */ +/* 275 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var TO_STRING_TAG_SUPPORT = __webpack_require__(94); +var TO_STRING_TAG_SUPPORT = __webpack_require__(66); -var classof = __webpack_require__(93); // `Object.prototype.toString` method implementation +var classof = __webpack_require__(65); // `Object.prototype.toString` method implementation // https://tc39.es/ecma262/#sec-object.prototype.tostring @@ -8512,12 +9351,12 @@ module.exports = TO_STRING_TAG_SUPPORT ? {}.toString : function toString() { }; /***/ }), -/* 255 */ +/* 276 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var $values = __webpack_require__(235).values; // `Object.values` method +var $values = (__webpack_require__(255).values); // `Object.values` method // https://tc39.es/ecma262/#sec-object.values @@ -8531,41 +9370,41 @@ $({ }); /***/ }), -/* 256 */ +/* 277 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var parseFloatImplementation = __webpack_require__(220); // `parseFloat` method +var $parseFloat = __webpack_require__(241); // `parseFloat` method // https://tc39.es/ecma262/#sec-parsefloat-string $({ global: true, - forced: parseFloat != parseFloatImplementation + forced: parseFloat != $parseFloat }, { - parseFloat: parseFloatImplementation + parseFloat: $parseFloat }); /***/ }), -/* 257 */ +/* 278 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var parseIntImplementation = __webpack_require__(222); // `parseInt` method +var $parseInt = __webpack_require__(243); // `parseInt` method // https://tc39.es/ecma262/#sec-parseint-string-radix $({ global: true, - forced: parseInt != parseIntImplementation + forced: parseInt != $parseInt }, { - parseInt: parseIntImplementation + parseInt: $parseInt }); /***/ }), -/* 258 */ +/* 279 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -8573,61 +9412,65 @@ $({ var $ = __webpack_require__(2); -var IS_PURE = __webpack_require__(25); +var IS_PURE = __webpack_require__(32); var global = __webpack_require__(3); -var getBuiltIn = __webpack_require__(17); +var getBuiltIn = __webpack_require__(20); -var NativePromise = __webpack_require__(259); +var call = __webpack_require__(7); -var redefine = __webpack_require__(36); +var NativePromise = __webpack_require__(280); -var redefineAll = __webpack_require__(150); +var redefine = __webpack_require__(43); -var setPrototypeOf = __webpack_require__(86); +var redefineAll = __webpack_require__(167); -var setToStringTag = __webpack_require__(63); +var setPrototypeOf = __webpack_require__(101); -var setSpecies = __webpack_require__(143); +var setToStringTag = __webpack_require__(78); -var isObject = __webpack_require__(15); +var setSpecies = __webpack_require__(160); -var aFunction = __webpack_require__(66); +var aCallable = __webpack_require__(27); -var anInstance = __webpack_require__(151); +var isCallable = __webpack_require__(18); -var inspectSource = __webpack_require__(37); +var isObject = __webpack_require__(17); -var iterate = __webpack_require__(88); +var anInstance = __webpack_require__(168); -var checkCorrectnessOfIteration = __webpack_require__(117); +var inspectSource = __webpack_require__(44); -var speciesConstructor = __webpack_require__(157); +var iterate = __webpack_require__(105); -var task = __webpack_require__(260).set; +var checkCorrectnessOfIteration = __webpack_require__(134); -var microtask = __webpack_require__(262); +var speciesConstructor = __webpack_require__(174); -var promiseResolve = __webpack_require__(265); +var task = (__webpack_require__(281).set); -var hostReportErrors = __webpack_require__(267); +var microtask = __webpack_require__(283); -var newPromiseCapabilityModule = __webpack_require__(266); +var promiseResolve = __webpack_require__(286); -var perform = __webpack_require__(268); +var hostReportErrors = __webpack_require__(288); -var InternalStateModule = __webpack_require__(38); +var newPromiseCapabilityModule = __webpack_require__(287); -var isForced = __webpack_require__(52); +var perform = __webpack_require__(289); -var wellKnownSymbol = __webpack_require__(23); +var InternalStateModule = __webpack_require__(45); -var IS_BROWSER = __webpack_require__(269); +var isForced = __webpack_require__(61); -var IS_NODE = __webpack_require__(132); +var wellKnownSymbol = __webpack_require__(30); -var V8_VERSION = __webpack_require__(20); +var IS_BROWSER = __webpack_require__(290); + +var IS_NODE = __webpack_require__(149); + +var V8_VERSION = __webpack_require__(24); var SPECIES = wellKnownSymbol('species'); var PROMISE = 'Promise'; @@ -8636,14 +9479,14 @@ var setInternalState = InternalStateModule.set; var getInternalPromiseState = InternalStateModule.getterFor(PROMISE); var NativePromisePrototype = NativePromise && NativePromise.prototype; var PromiseConstructor = NativePromise; -var PromiseConstructorPrototype = NativePromisePrototype; +var PromisePrototype = NativePromisePrototype; var TypeError = global.TypeError; var document = global.document; var process = global.process; var newPromiseCapability = newPromiseCapabilityModule.f; var newGenericPromiseCapability = newPromiseCapability; var DISPATCH_EVENT = !!(document && document.createEvent && global.dispatchEvent); -var NATIVE_REJECTION_EVENT = typeof PromiseRejectionEvent == 'function'; +var NATIVE_REJECTION_EVENT = isCallable(global.PromiseRejectionEvent); var UNHANDLED_REJECTION = 'unhandledrejection'; var REJECTION_HANDLED = 'rejectionhandled'; var PENDING = 0; @@ -8661,7 +9504,7 @@ var FORCED = isForced(PROMISE, function () { if (!GLOBAL_CORE_JS_PROMISE && V8_VERSION === 66) return true; // We need Promise#finally in the pure version for preventing prototype pollution - if (IS_PURE && !PromiseConstructorPrototype['finally']) return true; // We can't use @@species feature detection in V8 since it causes + if (IS_PURE && !PromisePrototype['finally']) return true; // We can't use @@species feature detection in V8 since it causes // deoptimization and performance degradation // https://github.com/zloirock/core-js/issues/679 @@ -8696,7 +9539,7 @@ var INCORRECT_ITERATION = FORCED || !checkCorrectnessOfIteration(function (itera var isThenable = function (it) { var then; - return isObject(it) && typeof (then = it.then) == 'function' ? then : false; + return isObject(it) && isCallable(then = it.then) ? then : false; }; var notify = function (state, isReject) { @@ -8736,7 +9579,7 @@ var notify = function (state, isReject) { if (result === reaction.promise) { reject(TypeError('Promise-chain cycle')); } else if (then = isThenable(result)) { - then.call(result, resolve, reject); + call(then, result, resolve, reject); } else resolve(result); } else reject(value); } catch (error) { @@ -8769,7 +9612,7 @@ var dispatchEvent = function (name, promise, reason) { }; var onUnhandled = function (state) { - task.call(global, function () { + call(task, global, function () { var promise = state.facade; var value = state.value; var IS_UNHANDLED = isUnhandled(state); @@ -8793,7 +9636,7 @@ var isUnhandled = function (state) { }; var onHandleUnhandled = function (state) { - task.call(global, function () { + call(task, global, function () { var promise = state.facade; if (IS_NODE) { @@ -8833,7 +9676,7 @@ var internalResolve = function (state, value, unwrap) { }; try { - then.call(value, bind(internalResolve, wrapper, state), bind(internalReject, wrapper, state)); + call(then, value, bind(internalResolve, wrapper, state), bind(internalReject, wrapper, state)); } catch (error) { internalReject(wrapper, error, state); } @@ -8854,9 +9697,9 @@ var internalResolve = function (state, value, unwrap) { if (FORCED) { // 25.4.3.1 Promise(executor) PromiseConstructor = function Promise(executor) { - anInstance(this, PromiseConstructor, PROMISE); - aFunction(executor); - Internal.call(this); + anInstance(this, PromisePrototype); + aCallable(executor); + call(Internal, this); var state = getInternalState(this); try { @@ -8866,7 +9709,7 @@ if (FORCED) { } }; - PromiseConstructorPrototype = PromiseConstructor.prototype; // eslint-disable-next-line no-unused-vars -- required for `.length` + PromisePrototype = PromiseConstructor.prototype; // eslint-disable-next-line no-unused-vars -- required for `.length` Internal = function Promise(executor) { setInternalState(this, { @@ -8881,17 +9724,18 @@ if (FORCED) { }); }; - Internal.prototype = redefineAll(PromiseConstructorPrototype, { + Internal.prototype = redefineAll(PromisePrototype, { // `Promise.prototype.then` method // https://tc39.es/ecma262/#sec-promise.prototype.then then: function then(onFulfilled, onRejected) { var state = getInternalPromiseState(this); + var reactions = state.reactions; var reaction = newPromiseCapability(speciesConstructor(this, PromiseConstructor)); - reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true; - reaction.fail = typeof onRejected == 'function' && onRejected; + reaction.ok = isCallable(onFulfilled) ? onFulfilled : true; + reaction.fail = isCallable(onRejected) && onRejected; reaction.domain = IS_NODE ? process.domain : undefined; state.parent = true; - state.reactions.push(reaction); + reactions[reactions.length] = reaction; if (state.state != PENDING) notify(state, false); return reaction.promise; }, @@ -8914,7 +9758,7 @@ if (FORCED) { return C === PromiseConstructor || C === PromiseWrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C); }; - if (!IS_PURE && typeof NativePromise == 'function' && NativePromisePrototype !== Object.prototype) { + if (!IS_PURE && isCallable(NativePromise) && NativePromisePrototype !== Object.prototype) { nativeThen = NativePromisePrototype.then; if (!SUBCLASSING) { @@ -8922,13 +9766,13 @@ if (FORCED) { redefine(NativePromisePrototype, 'then', function then(onFulfilled, onRejected) { var that = this; return new PromiseConstructor(function (resolve, reject) { - nativeThen.call(that, resolve, reject); + call(nativeThen, that, resolve, reject); }).then(onFulfilled, onRejected); // https://github.com/zloirock/core-js/issues/640 }, { unsafe: true }); // makes sure that native promise-based APIs `Promise#catch` properly works with patched `Promise#then` - redefine(NativePromisePrototype, 'catch', PromiseConstructorPrototype['catch'], { + redefine(NativePromisePrototype, 'catch', PromisePrototype['catch'], { unsafe: true }); } // make `.constructor === Promise` work for native promise-based APIs @@ -8942,7 +9786,7 @@ if (FORCED) { if (setPrototypeOf) { - setPrototypeOf(NativePromisePrototype, PromiseConstructorPrototype); + setPrototypeOf(NativePromisePrototype, PromisePrototype); } } } @@ -8967,7 +9811,7 @@ $({ // https://tc39.es/ecma262/#sec-promise.reject reject: function reject(r) { var capability = newPromiseCapability(this); - capability.reject.call(undefined, r); + call(capability.reject, undefined, r); return capability.promise; } }); @@ -8995,16 +9839,15 @@ $({ var resolve = capability.resolve; var reject = capability.reject; var result = perform(function () { - var $promiseResolve = aFunction(C.resolve); + var $promiseResolve = aCallable(C.resolve); var values = []; var counter = 0; var remaining = 1; iterate(iterable, function (promise) { var index = counter++; var alreadyCalled = false; - values.push(undefined); remaining++; - $promiseResolve.call(C, promise).then(function (value) { + call($promiseResolve, C, promise).then(function (value) { if (alreadyCalled) return; alreadyCalled = true; values[index] = value; @@ -9023,9 +9866,9 @@ $({ var capability = newPromiseCapability(C); var reject = capability.reject; var result = perform(function () { - var $promiseResolve = aFunction(C.resolve); + var $promiseResolve = aCallable(C.resolve); iterate(iterable, function (promise) { - $promiseResolve.call(C, promise).then(capability.resolve, reject); + call($promiseResolve, C, promise).then(capability.resolve, reject); }); }); if (result.error) reject(result.value); @@ -9034,7 +9877,7 @@ $({ }); /***/ }), -/* 259 */ +/* 280 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var global = __webpack_require__(3); @@ -9042,28 +9885,38 @@ var global = __webpack_require__(3); module.exports = global.Promise; /***/ }), -/* 260 */ +/* 281 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var global = __webpack_require__(3); +var apply = __webpack_require__(62); + +var bind = __webpack_require__(80); + +var isCallable = __webpack_require__(18); + +var hasOwn = __webpack_require__(35); + var fails = __webpack_require__(6); -var bind = __webpack_require__(65); +var html = __webpack_require__(70); -var html = __webpack_require__(58); +var arraySlice = __webpack_require__(74); -var createElement = __webpack_require__(32); +var createElement = __webpack_require__(39); -var IS_IOS = __webpack_require__(261); +var IS_IOS = __webpack_require__(282); -var IS_NODE = __webpack_require__(132); +var IS_NODE = __webpack_require__(149); var set = global.setImmediate; var clear = global.clearImmediate; var process = global.process; -var MessageChannel = global.MessageChannel; var Dispatch = global.Dispatch; +var Function = global.Function; +var MessageChannel = global.MessageChannel; +var String = global.String; var counter = 0; var queue = {}; var ONREADYSTATECHANGE = 'onreadystatechange'; @@ -9077,8 +9930,7 @@ try { } var run = function (id) { - // eslint-disable-next-line no-prototype-builtins -- safe - if (queue.hasOwnProperty(id)) { + if (hasOwn(queue, id)) { var fn = queue[id]; delete queue[id]; fn(); @@ -9103,15 +9955,10 @@ var post = function (id) { if (!set || !clear) { set = function setImmediate(fn) { - var args = []; - var argumentsLength = arguments.length; - var i = 1; - - while (argumentsLength > i) args.push(arguments[i++]); + var args = arraySlice(arguments, 1); queue[++counter] = function () { - // eslint-disable-next-line no-new-func -- spec requirement - (typeof fn == 'function' ? fn : Function(fn)).apply(undefined, args); + apply(isCallable(fn) ? fn : Function(fn), undefined, args); }; defer(counter); @@ -9138,9 +9985,9 @@ if (!set || !clear) { channel = new MessageChannel(); port = channel.port2; channel.port1.onmessage = listener; - defer = bind(port.postMessage, port, 1); // Browsers with postMessage, skip WebWorkers + defer = bind(port.postMessage, port); // Browsers with postMessage, skip WebWorkers // IE8 has postMessage, but it's sync & typeof its postMessage is 'object' - } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts && location && location.protocol !== 'file:' && !fails(post)) { + } else if (global.addEventListener && isCallable(global.postMessage) && !global.importScripts && location && location.protocol !== 'file:' && !fails(post)) { defer = post; global.addEventListener('message', listener, false); // IE8- } else if (ONREADYSTATECHANGE in createElement('script')) { @@ -9164,30 +10011,32 @@ module.exports = { }; /***/ }), -/* 261 */ +/* 282 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var userAgent = __webpack_require__(21); +var userAgent = __webpack_require__(25); module.exports = /(?:ipad|iphone|ipod).*applewebkit/i.test(userAgent); /***/ }), -/* 262 */ +/* 283 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var global = __webpack_require__(3); -var getOwnPropertyDescriptor = __webpack_require__(4).f; +var bind = __webpack_require__(80); -var macrotask = __webpack_require__(260).set; +var getOwnPropertyDescriptor = (__webpack_require__(4).f); -var IS_IOS = __webpack_require__(261); +var macrotask = (__webpack_require__(281).set); -var IS_IOS_PEBBLE = __webpack_require__(263); +var IS_IOS = __webpack_require__(282); -var IS_WEBOS_WEBKIT = __webpack_require__(264); +var IS_IOS_PEBBLE = __webpack_require__(284); -var IS_NODE = __webpack_require__(132); +var IS_WEBOS_WEBKIT = __webpack_require__(285); + +var IS_NODE = __webpack_require__(149); var MutationObserver = global.MutationObserver || global.WebKitMutationObserver; var document = global.document; @@ -9237,10 +10086,10 @@ if (!queueMicrotask) { promise = Promise.resolve(undefined); // workaround of WebKit ~ iOS Safari 10.1 bug promise.constructor = Promise; - then = promise.then; + then = bind(promise.then, promise); notify = function () { - then.call(promise, flush); + then(flush); }; // Node.js without promises } else if (IS_NODE) { @@ -9254,9 +10103,11 @@ if (!queueMicrotask) { // - setTimeout } else { + // strange IE + webpack dev server bug - use .bind(global) + macrotask = bind(macrotask, global); + notify = function () { - // strange IE + webpack dev server bug - use .call(global) - macrotask.call(global, flush); + macrotask(flush); }; } } @@ -9277,32 +10128,32 @@ module.exports = queueMicrotask || function (fn) { }; /***/ }), -/* 263 */ +/* 284 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var userAgent = __webpack_require__(21); +var userAgent = __webpack_require__(25); var global = __webpack_require__(3); module.exports = /ipad|iphone|ipod/i.test(userAgent) && global.Pebble !== undefined; /***/ }), -/* 264 */ +/* 285 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var userAgent = __webpack_require__(21); +var userAgent = __webpack_require__(25); module.exports = /web0s(?!.*chrome)/i.test(userAgent); /***/ }), -/* 265 */ +/* 286 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var anObject = __webpack_require__(35); +var anObject = __webpack_require__(42); -var isObject = __webpack_require__(15); +var isObject = __webpack_require__(17); -var newPromiseCapability = __webpack_require__(266); +var newPromiseCapability = __webpack_require__(287); module.exports = function (C, x) { anObject(C); @@ -9314,13 +10165,13 @@ module.exports = function (C, x) { }; /***/ }), -/* 266 */ +/* 287 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var aFunction = __webpack_require__(66); +var aCallable = __webpack_require__(27); var PromiseCapability = function (C) { var resolve, reject; @@ -9329,8 +10180,8 @@ var PromiseCapability = function (C) { resolve = $$resolve; reject = $$reject; }); - this.resolve = aFunction(resolve); - this.reject = aFunction(reject); + this.resolve = aCallable(resolve); + this.reject = aCallable(reject); }; // `NewPromiseCapability` abstract operation // https://tc39.es/ecma262/#sec-newpromisecapability @@ -9340,7 +10191,7 @@ module.exports.f = function (C) { }; /***/ }), -/* 267 */ +/* 288 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var global = __webpack_require__(3); @@ -9349,12 +10200,12 @@ module.exports = function (a, b) { var console = global.console; if (console && console.error) { - arguments.length === 1 ? console.error(a) : console.error(a, b); + arguments.length == 1 ? console.error(a) : console.error(a, b); } }; /***/ }), -/* 268 */ +/* 289 */ /***/ ((module) => { module.exports = function (exec) { @@ -9372,13 +10223,13 @@ module.exports = function (exec) { }; /***/ }), -/* 269 */ +/* 290 */ /***/ ((module) => { module.exports = typeof window == 'object'; /***/ }), -/* 270 */ +/* 291 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -9386,13 +10237,15 @@ module.exports = typeof window == 'object'; var $ = __webpack_require__(2); -var aFunction = __webpack_require__(66); +var call = __webpack_require__(7); -var newPromiseCapabilityModule = __webpack_require__(266); +var aCallable = __webpack_require__(27); -var perform = __webpack_require__(268); +var newPromiseCapabilityModule = __webpack_require__(287); -var iterate = __webpack_require__(88); // `Promise.allSettled` method +var perform = __webpack_require__(289); + +var iterate = __webpack_require__(105); // `Promise.allSettled` method // https://tc39.es/ecma262/#sec-promise.allsettled @@ -9406,16 +10259,15 @@ $({ var resolve = capability.resolve; var reject = capability.reject; var result = perform(function () { - var promiseResolve = aFunction(C.resolve); + var promiseResolve = aCallable(C.resolve); var values = []; var counter = 0; var remaining = 1; iterate(iterable, function (promise) { var index = counter++; var alreadyCalled = false; - values.push(undefined); remaining++; - promiseResolve.call(C, promise).then(function (value) { + call(promiseResolve, C, promise).then(function (value) { if (alreadyCalled) return; alreadyCalled = true; values[index] = { @@ -9441,7 +10293,7 @@ $({ }); /***/ }), -/* 271 */ +/* 292 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -9449,15 +10301,17 @@ $({ var $ = __webpack_require__(2); -var aFunction = __webpack_require__(66); +var aCallable = __webpack_require__(27); -var getBuiltIn = __webpack_require__(17); +var getBuiltIn = __webpack_require__(20); -var newPromiseCapabilityModule = __webpack_require__(266); +var call = __webpack_require__(7); -var perform = __webpack_require__(268); +var newPromiseCapabilityModule = __webpack_require__(287); -var iterate = __webpack_require__(88); +var perform = __webpack_require__(289); + +var iterate = __webpack_require__(105); var PROMISE_ANY_ERROR = 'No one promise resolved'; // `Promise.any` method // https://tc39.es/ecma262/#sec-promise.any @@ -9468,11 +10322,12 @@ $({ }, { any: function any(iterable) { var C = this; + var AggregateError = getBuiltIn('AggregateError'); var capability = newPromiseCapabilityModule.f(C); var resolve = capability.resolve; var reject = capability.reject; var result = perform(function () { - var promiseResolve = aFunction(C.resolve); + var promiseResolve = aCallable(C.resolve); var errors = []; var counter = 0; var remaining = 1; @@ -9480,9 +10335,8 @@ $({ iterate(iterable, function (promise) { var index = counter++; var alreadyRejected = false; - errors.push(undefined); remaining++; - promiseResolve.call(C, promise).then(function (value) { + call(promiseResolve, C, promise).then(function (value) { if (alreadyRejected || alreadyResolved) return; alreadyResolved = true; resolve(value); @@ -9490,10 +10344,10 @@ $({ if (alreadyRejected || alreadyResolved) return; alreadyRejected = true; errors[index] = error; - --remaining || reject(new (getBuiltIn('AggregateError'))(errors, PROMISE_ANY_ERROR)); + --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR)); }); }); - --remaining || reject(new (getBuiltIn('AggregateError'))(errors, PROMISE_ANY_ERROR)); + --remaining || reject(new AggregateError(errors, PROMISE_ANY_ERROR)); }); if (result.error) reject(result.value); return capability.promise; @@ -9501,7 +10355,7 @@ $({ }); /***/ }), -/* 272 */ +/* 293 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -9509,19 +10363,21 @@ $({ var $ = __webpack_require__(2); -var IS_PURE = __webpack_require__(25); +var IS_PURE = __webpack_require__(32); -var NativePromise = __webpack_require__(259); +var NativePromise = __webpack_require__(280); var fails = __webpack_require__(6); -var getBuiltIn = __webpack_require__(17); +var getBuiltIn = __webpack_require__(20); -var speciesConstructor = __webpack_require__(157); +var isCallable = __webpack_require__(18); -var promiseResolve = __webpack_require__(265); +var speciesConstructor = __webpack_require__(174); -var redefine = __webpack_require__(36); // Safari bug https://bugs.webkit.org/show_bug.cgi?id=200829 +var promiseResolve = __webpack_require__(286); + +var redefine = __webpack_require__(43); // Safari bug https://bugs.webkit.org/show_bug.cgi?id=200829 var NON_GENERIC = !!NativePromise && fails(function () { @@ -9543,7 +10399,7 @@ $({ }, { 'finally': function (onFinally) { var C = speciesConstructor(this, getBuiltIn('Promise')); - var isFunction = typeof onFinally == 'function'; + var isFunction = isCallable(onFinally); return this.then(isFunction ? function (x) { return promiseResolve(C, onFinally()).then(function () { return x; @@ -9556,7 +10412,7 @@ $({ } }); // makes sure that native promise-based APIs `Promise#finally` properly works with patched `Promise#then` -if (!IS_PURE && typeof NativePromise == 'function') { +if (!IS_PURE && isCallable(NativePromise)) { var method = getBuiltIn('Promise').prototype['finally']; if (NativePromise.prototype['finally'] !== method) { @@ -9567,24 +10423,23 @@ if (!IS_PURE && typeof NativePromise == 'function') { } /***/ }), -/* 273 */ +/* 294 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var getBuiltIn = __webpack_require__(17); +var functionApply = __webpack_require__(62); -var aFunction = __webpack_require__(66); +var aCallable = __webpack_require__(27); -var anObject = __webpack_require__(35); +var anObject = __webpack_require__(42); -var fails = __webpack_require__(6); +var fails = __webpack_require__(6); // MS Edge argumentsList argument is optional -var nativeApply = getBuiltIn('Reflect', 'apply'); -var functionApply = Function.apply; // MS Edge argumentsList argument is optional var OPTIONAL_ARGUMENTS_LIST = !fails(function () { - nativeApply(function () { + // eslint-disable-next-line es/no-reflect -- required for testing + Reflect.apply(function () { /* empty */ }); }); // `Reflect.apply` method @@ -9596,33 +10451,35 @@ $({ forced: OPTIONAL_ARGUMENTS_LIST }, { apply: function apply(target, thisArgument, argumentsList) { - aFunction(target); - anObject(argumentsList); - return nativeApply ? nativeApply(target, thisArgument, argumentsList) : functionApply.call(target, thisArgument, argumentsList); + return functionApply(aCallable(target), thisArgument, anObject(argumentsList)); } }); /***/ }), -/* 274 */ +/* 295 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var getBuiltIn = __webpack_require__(17); +var getBuiltIn = __webpack_require__(20); -var aFunction = __webpack_require__(66); +var apply = __webpack_require__(62); -var anObject = __webpack_require__(35); +var bind = __webpack_require__(191); -var isObject = __webpack_require__(15); +var aConstructor = __webpack_require__(175); -var create = __webpack_require__(55); +var anObject = __webpack_require__(42); -var bind = __webpack_require__(173); +var isObject = __webpack_require__(17); + +var create = __webpack_require__(67); var fails = __webpack_require__(6); -var nativeConstruct = getBuiltIn('Reflect', 'construct'); // `Reflect.construct` method +var nativeConstruct = getBuiltIn('Reflect', 'construct'); +var ObjectPrototype = Object.prototype; +var push = [].push; // `Reflect.construct` method // https://tc39.es/ecma262/#sec-reflect.construct // MS Edge supports only 2 arguments and argumentsList argument is optional // FF Nightly sets third argument as `new.target`, but does not create `this` from it @@ -9651,9 +10508,9 @@ $({ construct: function construct(Target, args /* , newTarget */ ) { - aFunction(Target); + aConstructor(Target); anObject(args); - var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]); + var newTarget = arguments.length < 3 ? Target : aConstructor(arguments[2]); if (ARGS_BUG && !NEW_TARGET_BUG) return nativeConstruct(Target, args, newTarget); if (Target == newTarget) { @@ -9677,31 +10534,31 @@ $({ var $args = [null]; - $args.push.apply($args, args); - return new (bind.apply(Target, $args))(); + apply(push, $args, args); + return new (apply(bind, Target, $args))(); } // with altered newTarget, not support built-in constructors var proto = newTarget.prototype; - var instance = create(isObject(proto) ? proto : Object.prototype); - var result = Function.apply.call(Target, instance, args); + var instance = create(isObject(proto) ? proto : ObjectPrototype); + var result = apply(Target, instance, args); return isObject(result) ? result : instance; } }); /***/ }), -/* 275 */ +/* 296 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); var DESCRIPTORS = __webpack_require__(5); -var anObject = __webpack_require__(35); +var anObject = __webpack_require__(42); -var toPropertyKey = __webpack_require__(13); +var toPropertyKey = __webpack_require__(15); -var definePropertyModule = __webpack_require__(34); +var definePropertyModule = __webpack_require__(41); var fails = __webpack_require__(6); // MS Edge has broken Reflect.defineProperty - throwing instead of returning false @@ -9737,14 +10594,14 @@ $({ }); /***/ }), -/* 276 */ +/* 297 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var anObject = __webpack_require__(35); +var anObject = __webpack_require__(42); -var getOwnPropertyDescriptor = __webpack_require__(4).f; // `Reflect.deleteProperty` method +var getOwnPropertyDescriptor = (__webpack_require__(4).f); // `Reflect.deleteProperty` method // https://tc39.es/ecma262/#sec-reflect.deleteproperty @@ -9759,20 +10616,22 @@ $({ }); /***/ }), -/* 277 */ +/* 298 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var isObject = __webpack_require__(15); +var call = __webpack_require__(7); -var anObject = __webpack_require__(35); +var isObject = __webpack_require__(17); -var isDataDescriptor = __webpack_require__(278); +var anObject = __webpack_require__(42); + +var isDataDescriptor = __webpack_require__(299); var getOwnPropertyDescriptorModule = __webpack_require__(4); -var getPrototypeOf = __webpack_require__(84); // `Reflect.get` method +var getPrototypeOf = __webpack_require__(99); // `Reflect.get` method // https://tc39.es/ecma262/#sec-reflect.get @@ -9783,7 +10642,7 @@ function get(target, propertyKey var descriptor, prototype; if (anObject(target) === receiver) return target[propertyKey]; descriptor = getOwnPropertyDescriptorModule.f(target, propertyKey); - if (descriptor) return isDataDescriptor(descriptor) ? descriptor.value : descriptor.get === undefined ? undefined : descriptor.get.call(receiver); + if (descriptor) return isDataDescriptor(descriptor) ? descriptor.value : descriptor.get === undefined ? undefined : call(descriptor.get, receiver); if (isObject(prototype = getPrototypeOf(target))) return get(prototype, propertyKey, receiver); } @@ -9795,24 +10654,24 @@ $({ }); /***/ }), -/* 278 */ +/* 299 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var has = __webpack_require__(28); +var hasOwn = __webpack_require__(35); module.exports = function (descriptor) { - return descriptor !== undefined && (has(descriptor, 'value') || has(descriptor, 'writable')); + return descriptor !== undefined && (hasOwn(descriptor, 'value') || hasOwn(descriptor, 'writable')); }; /***/ }), -/* 279 */ +/* 300 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); var DESCRIPTORS = __webpack_require__(5); -var anObject = __webpack_require__(35); +var anObject = __webpack_require__(42); var getOwnPropertyDescriptorModule = __webpack_require__(4); // `Reflect.getOwnPropertyDescriptor` method // https://tc39.es/ecma262/#sec-reflect.getownpropertydescriptor @@ -9829,16 +10688,16 @@ $({ }); /***/ }), -/* 280 */ +/* 301 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var anObject = __webpack_require__(35); +var anObject = __webpack_require__(42); -var objectGetPrototypeOf = __webpack_require__(84); +var objectGetPrototypeOf = __webpack_require__(99); -var CORRECT_PROTOTYPE_GETTER = __webpack_require__(85); // `Reflect.getPrototypeOf` method +var CORRECT_PROTOTYPE_GETTER = __webpack_require__(100); // `Reflect.getPrototypeOf` method // https://tc39.es/ecma262/#sec-reflect.getprototypeof @@ -9853,7 +10712,7 @@ $({ }); /***/ }), -/* 281 */ +/* 302 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); // `Reflect.has` method @@ -9870,34 +10729,34 @@ $({ }); /***/ }), -/* 282 */ +/* 303 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var anObject = __webpack_require__(35); // eslint-disable-next-line es/no-object-isextensible -- safe +var anObject = __webpack_require__(42); - -var objectIsExtensible = Object.isExtensible; // `Reflect.isExtensible` method +var $isExtensible = __webpack_require__(200); // `Reflect.isExtensible` method // https://tc39.es/ecma262/#sec-reflect.isextensible + $({ target: 'Reflect', stat: true }, { isExtensible: function isExtensible(target) { anObject(target); - return objectIsExtensible ? objectIsExtensible(target) : true; + return $isExtensible(target); } }); /***/ }), -/* 283 */ +/* 304 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var ownKeys = __webpack_require__(43); // `Reflect.ownKeys` method +var ownKeys = __webpack_require__(51); // `Reflect.ownKeys` method // https://tc39.es/ecma262/#sec-reflect.ownkeys @@ -9909,16 +10768,16 @@ $({ }); /***/ }), -/* 284 */ +/* 305 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var getBuiltIn = __webpack_require__(17); +var getBuiltIn = __webpack_require__(20); -var anObject = __webpack_require__(35); +var anObject = __webpack_require__(42); -var FREEZING = __webpack_require__(182); // `Reflect.preventExtensions` method +var FREEZING = __webpack_require__(202); // `Reflect.preventExtensions` method // https://tc39.es/ecma262/#sec-reflect.preventextensions @@ -9941,26 +10800,28 @@ $({ }); /***/ }), -/* 285 */ +/* 306 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var anObject = __webpack_require__(35); +var call = __webpack_require__(7); -var isObject = __webpack_require__(15); +var anObject = __webpack_require__(42); -var isDataDescriptor = __webpack_require__(278); +var isObject = __webpack_require__(17); + +var isDataDescriptor = __webpack_require__(299); var fails = __webpack_require__(6); -var definePropertyModule = __webpack_require__(34); +var definePropertyModule = __webpack_require__(41); var getOwnPropertyDescriptorModule = __webpack_require__(4); -var getPrototypeOf = __webpack_require__(84); +var getPrototypeOf = __webpack_require__(99); -var createPropertyDescriptor = __webpack_require__(8); // `Reflect.set` method +var createPropertyDescriptor = __webpack_require__(9); // `Reflect.set` method // https://tc39.es/ecma262/#sec-reflect.set @@ -9990,7 +10851,7 @@ function set(target, propertyKey, V } else { setter = ownDescriptor.set; if (setter === undefined) return false; - setter.call(receiver, V); + call(setter, receiver, V); } return true; @@ -10018,16 +10879,16 @@ $({ }); /***/ }), -/* 286 */ +/* 307 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var anObject = __webpack_require__(35); +var anObject = __webpack_require__(42); -var aPossiblePrototype = __webpack_require__(87); +var aPossiblePrototype = __webpack_require__(102); -var objectSetPrototypeOf = __webpack_require__(86); // `Reflect.setPrototypeOf` method +var objectSetPrototypeOf = __webpack_require__(101); // `Reflect.setPrototypeOf` method // https://tc39.es/ecma262/#sec-reflect.setprototypeof @@ -10049,14 +10910,14 @@ if (objectSetPrototypeOf) $({ }); /***/ }), -/* 287 */ +/* 308 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); var global = __webpack_require__(3); -var setToStringTag = __webpack_require__(63); +var setToStringTag = __webpack_require__(78); $({ global: true @@ -10068,58 +10929,70 @@ $({ setToStringTag(global.Reflect, 'Reflect', true); /***/ }), -/* 288 */ +/* 309 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var DESCRIPTORS = __webpack_require__(5); var global = __webpack_require__(3); -var isForced = __webpack_require__(52); +var uncurryThis = __webpack_require__(12); -var inheritIfRequired = __webpack_require__(183); +var isForced = __webpack_require__(61); -var createNonEnumerableProperty = __webpack_require__(33); +var inheritIfRequired = __webpack_require__(203); -var defineProperty = __webpack_require__(34).f; +var createNonEnumerableProperty = __webpack_require__(40); -var getOwnPropertyNames = __webpack_require__(44).f; +var defineProperty = (__webpack_require__(41).f); -var isRegExp = __webpack_require__(289); +var getOwnPropertyNames = (__webpack_require__(52).f); -var toString = __webpack_require__(54); +var isPrototypeOf = __webpack_require__(21); -var getFlags = __webpack_require__(290); +var isRegExp = __webpack_require__(310); -var stickyHelpers = __webpack_require__(291); +var toString = __webpack_require__(64); -var redefine = __webpack_require__(36); +var regExpFlags = __webpack_require__(311); + +var stickyHelpers = __webpack_require__(312); + +var redefine = __webpack_require__(43); var fails = __webpack_require__(6); -var has = __webpack_require__(28); +var hasOwn = __webpack_require__(35); -var enforceInternalState = __webpack_require__(38).enforce; +var enforceInternalState = (__webpack_require__(45).enforce); -var setSpecies = __webpack_require__(143); +var setSpecies = __webpack_require__(160); -var wellKnownSymbol = __webpack_require__(23); +var wellKnownSymbol = __webpack_require__(30); -var UNSUPPORTED_DOT_ALL = __webpack_require__(292); +var UNSUPPORTED_DOT_ALL = __webpack_require__(313); -var UNSUPPORTED_NCG = __webpack_require__(293); +var UNSUPPORTED_NCG = __webpack_require__(314); var MATCH = wellKnownSymbol('match'); var NativeRegExp = global.RegExp; -var RegExpPrototype = NativeRegExp.prototype; // TODO: Use only propper RegExpIdentifierName +var RegExpPrototype = NativeRegExp.prototype; +var SyntaxError = global.SyntaxError; +var getFlags = uncurryThis(regExpFlags); +var exec = uncurryThis(RegExpPrototype.exec); +var charAt = uncurryThis(''.charAt); +var replace = uncurryThis(''.replace); +var stringIndexOf = uncurryThis(''.indexOf); +var stringSlice = uncurryThis(''.slice); // TODO: Use only propper RegExpIdentifierName var IS_NCG = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/; var re1 = /a/g; var re2 = /a/g; // "new" should create a new object, old webkit bug var CORRECT_NEW = new NativeRegExp(re1) !== re1; +var MISSED_STICKY = stickyHelpers.MISSED_STICKY; var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y; -var BASE_FORCED = DESCRIPTORS && (!CORRECT_NEW || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG || fails(function () { +var BASE_FORCED = DESCRIPTORS && (!CORRECT_NEW || MISSED_STICKY || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG || fails(function () { re2[MATCH] = false; // RegExp constructor can alter flags and IsRegExp works correct with @@match return NativeRegExp(re1) != re1 || NativeRegExp(re2) == re2 || NativeRegExp(re1, 'i') != '/a/i'; @@ -10133,10 +11006,10 @@ var handleDotAll = function (string) { var chr; for (; index <= length; index++) { - chr = string.charAt(index); + chr = charAt(string, index); if (chr === '\\') { - result += chr + string.charAt(++index); + result += chr + charAt(string, ++index); continue; } @@ -10169,10 +11042,10 @@ var handleNCG = function (string) { var chr; for (; index <= length; index++) { - chr = string.charAt(index); + chr = charAt(string, index); if (chr === '\\') { - chr = chr + string.charAt(++index); + chr = chr + charAt(string, ++index); } else if (chr === ']') { brackets = false; } else if (!brackets) switch (true) { @@ -10181,7 +11054,7 @@ var handleNCG = function (string) { break; case chr === '(': - if (IS_NCG.test(string.slice(index + 1))) { + if (exec(IS_NCG, stringSlice(string, index + 1))) { index += 2; ncg = true; } @@ -10191,12 +11064,12 @@ var handleNCG = function (string) { continue; case chr === '>' && ncg: - if (groupname === '' || has(names, groupname)) { + if (groupname === '' || hasOwn(names, groupname)) { throw new SyntaxError('Invalid capture group name'); } names[groupname] = true; - named.push([groupname, groupid]); + named[named.length] = [groupname, groupid]; ncg = false; groupname = ''; continue; @@ -10212,7 +11085,7 @@ var handleNCG = function (string) { if (isForced('RegExp', BASE_FORCED)) { var RegExpWrapper = function RegExp(pattern, flags) { - var thisIsRegExp = this instanceof RegExpWrapper; + var thisIsRegExp = isPrototypeOf(RegExpPrototype, this); var patternIsRegExp = isRegExp(pattern); var flagsAreUndefined = flags === undefined; var groups = []; @@ -10223,9 +11096,9 @@ if (isForced('RegExp', BASE_FORCED)) { return pattern; } - if (patternIsRegExp || pattern instanceof RegExpWrapper) { + if (patternIsRegExp || isPrototypeOf(RegExpPrototype, pattern)) { pattern = pattern.source; - if (flagsAreUndefined) flags = 'flags' in rawPattern ? rawPattern.flags : getFlags.call(rawPattern); + if (flagsAreUndefined) flags = 'flags' in rawPattern ? rawPattern.flags : getFlags(rawPattern); } pattern = pattern === undefined ? '' : toString(pattern); @@ -10233,15 +11106,15 @@ if (isForced('RegExp', BASE_FORCED)) { rawPattern = pattern; if (UNSUPPORTED_DOT_ALL && 'dotAll' in re1) { - dotAll = !!flags && flags.indexOf('s') > -1; - if (dotAll) flags = flags.replace(/s/g, ''); + dotAll = !!flags && stringIndexOf(flags, 's') > -1; + if (dotAll) flags = replace(flags, /s/g, ''); } rawFlags = flags; - if (UNSUPPORTED_Y && 'sticky' in re1) { - sticky = !!flags && flags.indexOf('y') > -1; - if (sticky) flags = flags.replace(/y/g, ''); + if (MISSED_STICKY && 'sticky' in re1) { + sticky = !!flags && stringIndexOf(flags, 'y') > -1; + if (sticky && UNSUPPORTED_Y) flags = replace(flags, /y/g, ''); } if (UNSUPPORTED_NCG) { @@ -10298,14 +11171,14 @@ if (isForced('RegExp', BASE_FORCED)) { setSpecies('RegExp'); /***/ }), -/* 289 */ +/* 310 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var isObject = __webpack_require__(15); +var isObject = __webpack_require__(17); -var classof = __webpack_require__(11); +var classof = __webpack_require__(13); -var wellKnownSymbol = __webpack_require__(23); +var wellKnownSymbol = __webpack_require__(30); var MATCH = wellKnownSymbol('match'); // `IsRegExp` abstract operation // https://tc39.es/ecma262/#sec-isregexp @@ -10316,13 +11189,13 @@ module.exports = function (it) { }; /***/ }), -/* 290 */ +/* 311 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var anObject = __webpack_require__(35); // `RegExp.prototype.flags` getter implementation +var anObject = __webpack_require__(42); // `RegExp.prototype.flags` getter implementation // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags @@ -10339,8 +11212,8 @@ module.exports = function () { }; /***/ }), -/* 291 */ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +/* 312 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { var fails = __webpack_require__(6); @@ -10348,20 +11221,30 @@ var global = __webpack_require__(3); // babel-minify and Closure Compiler transp var $RegExp = global.RegExp; -exports.UNSUPPORTED_Y = fails(function () { +var UNSUPPORTED_Y = fails(function () { var re = $RegExp('a', 'y'); re.lastIndex = 2; return re.exec('abcd') != null; +}); // UC Browser bug +// https://github.com/zloirock/core-js/issues/1008 + +var MISSED_STICKY = UNSUPPORTED_Y || fails(function () { + return !$RegExp('a', 'y').sticky; }); -exports.BROKEN_CARET = fails(function () { +var BROKEN_CARET = UNSUPPORTED_Y || fails(function () { // https://bugzilla.mozilla.org/show_bug.cgi?id=773687 var re = $RegExp('^r', 'gy'); re.lastIndex = 2; return re.exec('str') != null; }); +module.exports = { + BROKEN_CARET: BROKEN_CARET, + MISSED_STICKY: MISSED_STICKY, + UNSUPPORTED_Y: UNSUPPORTED_Y +}; /***/ }), -/* 292 */ +/* 313 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var fails = __webpack_require__(6); @@ -10376,7 +11259,7 @@ module.exports = fails(function () { }); /***/ }), -/* 293 */ +/* 314 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var fails = __webpack_require__(6); @@ -10391,18 +11274,23 @@ module.exports = fails(function () { }); /***/ }), -/* 294 */ +/* 315 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { +var global = __webpack_require__(3); + var DESCRIPTORS = __webpack_require__(5); -var UNSUPPORTED_DOT_ALL = __webpack_require__(292); +var UNSUPPORTED_DOT_ALL = __webpack_require__(313); -var defineProperty = __webpack_require__(34).f; +var classof = __webpack_require__(13); -var getInternalState = __webpack_require__(38).get; +var defineProperty = (__webpack_require__(41).f); -var RegExpPrototype = RegExp.prototype; // `RegExp.prototype.dotAll` getter +var getInternalState = (__webpack_require__(45).get); + +var RegExpPrototype = RegExp.prototype; +var TypeError = global.TypeError; // `RegExp.prototype.dotAll` getter // https://tc39.es/ecma262/#sec-get-regexp.prototype.dotall if (DESCRIPTORS && UNSUPPORTED_DOT_ALL) { @@ -10412,7 +11300,7 @@ if (DESCRIPTORS && UNSUPPORTED_DOT_ALL) { if (this === RegExpPrototype) return undefined; // We can't use InternalStateModule.getterFor because // we don't add metadata for regexps created by a literal. - if (this instanceof RegExp) { + if (classof(this) === 'RegExp') { return !!getInternalState(this).dotAll; } @@ -10422,7 +11310,7 @@ if (DESCRIPTORS && UNSUPPORTED_DOT_ALL) { } /***/ }), -/* 295 */ +/* 316 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -10430,7 +11318,7 @@ if (DESCRIPTORS && UNSUPPORTED_DOT_ALL) { var $ = __webpack_require__(2); -var exec = __webpack_require__(296); // `RegExp.prototype.exec` method +var exec = __webpack_require__(317); // `RegExp.prototype.exec` method // https://tc39.es/ecma262/#sec-regexp.prototype.exec @@ -10443,7 +11331,7 @@ $({ }); /***/ }), -/* 296 */ +/* 317 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -10452,41 +11340,48 @@ $({ /* eslint-disable regexp/no-useless-quantifier -- testing */ -var toString = __webpack_require__(54); +var call = __webpack_require__(7); -var regexpFlags = __webpack_require__(290); +var uncurryThis = __webpack_require__(12); -var stickyHelpers = __webpack_require__(291); +var toString = __webpack_require__(64); -var shared = __webpack_require__(24); +var regexpFlags = __webpack_require__(311); -var create = __webpack_require__(55); +var stickyHelpers = __webpack_require__(312); -var getInternalState = __webpack_require__(38).get; +var shared = __webpack_require__(31); -var UNSUPPORTED_DOT_ALL = __webpack_require__(292); +var create = __webpack_require__(67); -var UNSUPPORTED_NCG = __webpack_require__(293); +var getInternalState = (__webpack_require__(45).get); + +var UNSUPPORTED_DOT_ALL = __webpack_require__(313); + +var UNSUPPORTED_NCG = __webpack_require__(314); -var nativeExec = RegExp.prototype.exec; var nativeReplace = shared('native-string-replace', String.prototype.replace); +var nativeExec = RegExp.prototype.exec; var patchedExec = nativeExec; +var charAt = uncurryThis(''.charAt); +var indexOf = uncurryThis(''.indexOf); +var replace = uncurryThis(''.replace); +var stringSlice = uncurryThis(''.slice); var UPDATES_LAST_INDEX_WRONG = function () { var re1 = /a/; var re2 = /b*/g; - nativeExec.call(re1, 'a'); - nativeExec.call(re2, 'a'); + call(nativeExec, re1, 'a'); + call(nativeExec, re2, 'a'); return re1.lastIndex !== 0 || re2.lastIndex !== 0; }(); -var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y || stickyHelpers.BROKEN_CARET; // nonparticipating capturing group, copied from es5-shim's String#split patch. +var UNSUPPORTED_Y = stickyHelpers.BROKEN_CARET; // nonparticipating capturing group, copied from es5-shim's String#split patch. var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined; var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED || UNSUPPORTED_Y || UNSUPPORTED_DOT_ALL || UNSUPPORTED_NCG; if (PATCH) { - // eslint-disable-next-line max-statements -- TODO patchedExec = function exec(string) { var re = this; var state = getInternalState(re); @@ -10496,28 +11391,28 @@ if (PATCH) { if (raw) { raw.lastIndex = re.lastIndex; - result = patchedExec.call(raw, str); + result = call(patchedExec, raw, str); re.lastIndex = raw.lastIndex; return result; } var groups = state.groups; var sticky = UNSUPPORTED_Y && re.sticky; - var flags = regexpFlags.call(re); + var flags = call(regexpFlags, re); var source = re.source; var charsAdded = 0; var strCopy = str; if (sticky) { - flags = flags.replace('y', ''); + flags = replace(flags, 'y', ''); - if (flags.indexOf('g') === -1) { + if (indexOf(flags, 'g') === -1) { flags += 'g'; } - strCopy = str.slice(re.lastIndex); // Support anchored sticky behavior. + strCopy = stringSlice(str, re.lastIndex); // Support anchored sticky behavior. - if (re.lastIndex > 0 && (!re.multiline || re.multiline && str.charAt(re.lastIndex - 1) !== '\n')) { + if (re.lastIndex > 0 && (!re.multiline || re.multiline && charAt(str, re.lastIndex - 1) !== '\n')) { source = '(?: ' + source + ')'; strCopy = ' ' + strCopy; charsAdded++; @@ -10533,12 +11428,12 @@ if (PATCH) { } if (UPDATES_LAST_INDEX_WRONG) lastIndex = re.lastIndex; - match = nativeExec.call(sticky ? reCopy : re, strCopy); + match = call(nativeExec, sticky ? reCopy : re, strCopy); if (sticky) { if (match) { - match.input = match.input.slice(charsAdded); - match[0] = match[0].slice(charsAdded); + match.input = stringSlice(match.input, charsAdded); + match[0] = stringSlice(match[0], charsAdded); match.index = re.lastIndex; re.lastIndex += match[0].length; } else re.lastIndex = 0; @@ -10549,7 +11444,7 @@ if (PATCH) { if (NPCG_INCLUDED && match && match.length > 1) { // Fix browsers whose `exec` methods don't consistently return `undefined` // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/ - nativeReplace.call(match[0], reCopy, function () { + call(nativeReplace, match[0], reCopy, function () { for (i = 1; i < arguments.length - 2; i++) { if (arguments[i] === undefined) match[i] = undefined; } @@ -10572,54 +11467,60 @@ if (PATCH) { module.exports = patchedExec; /***/ }), -/* 297 */ +/* 318 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var DESCRIPTORS = __webpack_require__(5); -var objectDefinePropertyModule = __webpack_require__(34); +var objectDefinePropertyModule = __webpack_require__(41); -var regExpFlags = __webpack_require__(290); +var regExpFlags = __webpack_require__(311); var fails = __webpack_require__(6); +var RegExpPrototype = RegExp.prototype; var FORCED = DESCRIPTORS && fails(function () { // eslint-disable-next-line es/no-object-getownpropertydescriptor -- safe - return Object.getOwnPropertyDescriptor(RegExp.prototype, 'flags').get.call({ + return Object.getOwnPropertyDescriptor(RegExpPrototype, 'flags').get.call({ dotAll: true, sticky: true }) !== 'sy'; }); // `RegExp.prototype.flags` getter // https://tc39.es/ecma262/#sec-get-regexp.prototype.flags -if (FORCED) objectDefinePropertyModule.f(RegExp.prototype, 'flags', { +if (FORCED) objectDefinePropertyModule.f(RegExpPrototype, 'flags', { configurable: true, get: regExpFlags }); /***/ }), -/* 298 */ +/* 319 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { +var global = __webpack_require__(3); + var DESCRIPTORS = __webpack_require__(5); -var UNSUPPORTED_Y = __webpack_require__(291).UNSUPPORTED_Y; +var MISSED_STICKY = (__webpack_require__(312).MISSED_STICKY); -var defineProperty = __webpack_require__(34).f; +var classof = __webpack_require__(13); -var getInternalState = __webpack_require__(38).get; +var defineProperty = (__webpack_require__(41).f); -var RegExpPrototype = RegExp.prototype; // `RegExp.prototype.sticky` getter +var getInternalState = (__webpack_require__(45).get); + +var RegExpPrototype = RegExp.prototype; +var TypeError = global.TypeError; // `RegExp.prototype.sticky` getter // https://tc39.es/ecma262/#sec-get-regexp.prototype.sticky -if (DESCRIPTORS && UNSUPPORTED_Y) { +if (DESCRIPTORS && MISSED_STICKY) { defineProperty(RegExpPrototype, 'sticky', { configurable: true, get: function () { if (this === RegExpPrototype) return undefined; // We can't use InternalStateModule.getterFor because // we don't add metadata for regexps created by a literal. - if (this instanceof RegExp) { + if (classof(this) === 'RegExp') { return !!getInternalState(this).sticky; } @@ -10629,17 +11530,25 @@ if (DESCRIPTORS && UNSUPPORTED_Y) { } /***/ }), -/* 299 */ +/* 320 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; // TODO: Remove from `core-js@4` since it's moved to entry points -__webpack_require__(295); +__webpack_require__(316); var $ = __webpack_require__(2); -var isObject = __webpack_require__(15); +var global = __webpack_require__(3); + +var call = __webpack_require__(7); + +var uncurryThis = __webpack_require__(12); + +var isCallable = __webpack_require__(18); + +var isObject = __webpack_require__(17); var DELEGATES_TO_EXEC = function () { var execCalled = false; @@ -10653,7 +11562,8 @@ var DELEGATES_TO_EXEC = function () { return re.test('abc') === true && execCalled; }(); -var nativeTest = /./.test; // `RegExp.prototype.test` method +var Error = global.Error; +var un$Test = uncurryThis(/./.test); // `RegExp.prototype.test` method // https://tc39.es/ecma262/#sec-regexp.prototype.test $({ @@ -10662,11 +11572,9 @@ $({ forced: !DELEGATES_TO_EXEC }, { test: function (str) { - if (typeof this.exec !== 'function') { - return nativeTest.call(this, str); - } - - var result = this.exec(str); + var exec = this.exec; + if (!isCallable(exec)) return un$Test(this, str); + var result = call(exec, this, str); if (result !== null && !isObject(result)) { throw new Error('RegExp exec method returned something other than an Object or null'); @@ -10677,33 +11585,40 @@ $({ }); /***/ }), -/* 300 */ +/* 321 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var redefine = __webpack_require__(36); +var uncurryThis = __webpack_require__(12); -var anObject = __webpack_require__(35); +var PROPER_FUNCTION_NAME = (__webpack_require__(49).PROPER); -var $toString = __webpack_require__(54); +var redefine = __webpack_require__(43); + +var anObject = __webpack_require__(42); + +var isPrototypeOf = __webpack_require__(21); + +var $toString = __webpack_require__(64); var fails = __webpack_require__(6); -var flags = __webpack_require__(290); +var regExpFlags = __webpack_require__(311); var TO_STRING = 'toString'; var RegExpPrototype = RegExp.prototype; -var nativeToString = RegExpPrototype[TO_STRING]; +var n$ToString = RegExpPrototype[TO_STRING]; +var getFlags = uncurryThis(regExpFlags); var NOT_GENERIC = fails(function () { - return nativeToString.call({ + return n$ToString.call({ source: 'a', flags: 'b' }) != '/a/b'; }); // FF44- RegExp#toString has a wrong name -var INCORRECT_NAME = nativeToString.name != TO_STRING; // `RegExp.prototype.toString` method +var INCORRECT_NAME = PROPER_FUNCTION_NAME && n$ToString.name != TO_STRING; // `RegExp.prototype.toString` method // https://tc39.es/ecma262/#sec-regexp.prototype.tostring if (NOT_GENERIC || INCORRECT_NAME) { @@ -10711,7 +11626,7 @@ if (NOT_GENERIC || INCORRECT_NAME) { var R = anObject(this); var p = $toString(R.source); var rf = R.flags; - var f = $toString(rf === undefined && R instanceof RegExp && !('flags' in RegExpPrototype) ? flags.call(R) : rf); + var f = $toString(rf === undefined && isPrototypeOf(RegExpPrototype, R) && !('flags' in RegExpPrototype) ? getFlags(R) : rf); return '/' + p + '/' + f; }, { unsafe: true @@ -10719,26 +11634,26 @@ if (NOT_GENERIC || INCORRECT_NAME) { } /***/ }), -/* 301 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/* 322 */ +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var collection = __webpack_require__(180); +var collection = __webpack_require__(198); -var collectionStrong = __webpack_require__(184); // `Set` constructor +var collectionStrong = __webpack_require__(204); // `Set` constructor // https://tc39.es/ecma262/#sec-set-objects -module.exports = collection('Set', function (init) { +collection('Set', function (init) { return function Set() { return init(this, arguments.length ? arguments[0] : undefined); }; }, collectionStrong); /***/ }), -/* 302 */ +/* 323 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -10746,7 +11661,46 @@ module.exports = collection('Set', function (init) { var $ = __webpack_require__(2); -var codeAt = __webpack_require__(303).codeAt; // `String.prototype.codePointAt` method +var uncurryThis = __webpack_require__(12); + +var requireObjectCoercible = __webpack_require__(14); + +var toIntegerOrInfinity = __webpack_require__(56); + +var toString = __webpack_require__(64); + +var fails = __webpack_require__(6); + +var charAt = uncurryThis(''.charAt); +var FORCED = fails(function () { + return '𠮷'.at(0) !== '\uD842'; +}); // `String.prototype.at` method +// https://github.com/tc39/proposal-relative-indexing-method + +$({ + target: 'String', + proto: true, + forced: FORCED +}, { + at: function at(index) { + var S = toString(requireObjectCoercible(this)); + var len = S.length; + var relativeIndex = toIntegerOrInfinity(index); + var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex; + return k < 0 || k >= len ? undefined : charAt(S, k); + } +}); + +/***/ }), +/* 324 */ +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var $ = __webpack_require__(2); + +var codeAt = (__webpack_require__(325).codeAt); // `String.prototype.codePointAt` method // https://tc39.es/ecma262/#sec-string.prototype.codepointat @@ -10760,25 +11714,30 @@ $({ }); /***/ }), -/* 303 */ +/* 325 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var toInteger = __webpack_require__(48); +var uncurryThis = __webpack_require__(12); -var toString = __webpack_require__(54); +var toIntegerOrInfinity = __webpack_require__(56); -var requireObjectCoercible = __webpack_require__(12); // `String.prototype.codePointAt` methods implementation +var toString = __webpack_require__(64); +var requireObjectCoercible = __webpack_require__(14); + +var charAt = uncurryThis(''.charAt); +var charCodeAt = uncurryThis(''.charCodeAt); +var stringSlice = uncurryThis(''.slice); var createMethod = function (CONVERT_TO_STRING) { return function ($this, pos) { var S = toString(requireObjectCoercible($this)); - var position = toInteger(pos); + var position = toIntegerOrInfinity(pos); var size = S.length; var first, second; if (position < 0 || position >= size) return CONVERT_TO_STRING ? '' : undefined; - first = S.charCodeAt(position); - return first < 0xD800 || first > 0xDBFF || position + 1 === size || (second = S.charCodeAt(position + 1)) < 0xDC00 || second > 0xDFFF ? CONVERT_TO_STRING ? S.charAt(position) : first : CONVERT_TO_STRING ? S.slice(position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000; + first = charCodeAt(S, position); + return first < 0xD800 || first > 0xDBFF || position + 1 === size || (second = charCodeAt(S, position + 1)) < 0xDC00 || second > 0xDFFF ? CONVERT_TO_STRING ? charAt(S, position) : first : CONVERT_TO_STRING ? stringSlice(S, position, position + 2) : (first - 0xD800 << 10) + (second - 0xDC00) + 0x10000; }; }; @@ -10792,7 +11751,7 @@ module.exports = { }; /***/ }), -/* 304 */ +/* 326 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -10800,22 +11759,25 @@ module.exports = { var $ = __webpack_require__(2); -var getOwnPropertyDescriptor = __webpack_require__(4).f; +var uncurryThis = __webpack_require__(12); -var toLength = __webpack_require__(47); +var getOwnPropertyDescriptor = (__webpack_require__(4).f); -var toString = __webpack_require__(54); +var toLength = __webpack_require__(58); -var notARegExp = __webpack_require__(305); +var toString = __webpack_require__(64); -var requireObjectCoercible = __webpack_require__(12); +var notARegExp = __webpack_require__(327); -var correctIsRegExpLogic = __webpack_require__(306); +var requireObjectCoercible = __webpack_require__(14); -var IS_PURE = __webpack_require__(25); // eslint-disable-next-line es/no-string-prototype-endswith -- safe +var correctIsRegExpLogic = __webpack_require__(328); + +var IS_PURE = __webpack_require__(32); // eslint-disable-next-line es/no-string-prototype-endswith -- safe -var $endsWith = ''.endsWith; +var un$EndsWith = uncurryThis(''.endsWith); +var slice = uncurryThis(''.slice); var min = Math.min; var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('endsWith'); // https://github.com/zloirock/core-js/pull/702 @@ -10836,18 +11798,22 @@ $({ var that = toString(requireObjectCoercible(this)); notARegExp(searchString); var endPosition = arguments.length > 1 ? arguments[1] : undefined; - var len = toLength(that.length); + var len = that.length; var end = endPosition === undefined ? len : min(toLength(endPosition), len); var search = toString(searchString); - return $endsWith ? $endsWith.call(that, search, end) : that.slice(end - search.length, end) === search; + return un$EndsWith ? un$EndsWith(that, search, end) : slice(that, end - search.length, end) === search; } }); /***/ }), -/* 305 */ +/* 327 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var isRegExp = __webpack_require__(289); +var global = __webpack_require__(3); + +var isRegExp = __webpack_require__(310); + +var TypeError = global.TypeError; module.exports = function (it) { if (isRegExp(it)) { @@ -10858,10 +11824,10 @@ module.exports = function (it) { }; /***/ }), -/* 306 */ +/* 328 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var wellKnownSymbol = __webpack_require__(23); +var wellKnownSymbol = __webpack_require__(30); var MATCH = wellKnownSymbol('match'); @@ -10883,16 +11849,22 @@ module.exports = function (METHOD_NAME) { }; /***/ }), -/* 307 */ +/* 329 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var toAbsoluteIndex = __webpack_require__(49); +var global = __webpack_require__(3); +var uncurryThis = __webpack_require__(12); + +var toAbsoluteIndex = __webpack_require__(55); + +var RangeError = global.RangeError; var fromCharCode = String.fromCharCode; // eslint-disable-next-line es/no-string-fromcodepoint -- required for testing -var $fromCodePoint = String.fromCodePoint; // length should be 1, old FF problem +var $fromCodePoint = String.fromCodePoint; +var join = uncurryThis([].join); // length should be 1, old FF problem var INCORRECT_LENGTH = !!$fromCodePoint && $fromCodePoint.length != 1; // `String.fromCodePoint` method // https://tc39.es/ecma262/#sec-string.fromcodepoint @@ -10912,15 +11884,15 @@ $({ while (length > i) { code = +arguments[i++]; if (toAbsoluteIndex(code, 0x10FFFF) !== code) throw RangeError(code + ' is not a valid code point'); - elements.push(code < 0x10000 ? fromCharCode(code) : fromCharCode(((code -= 0x10000) >> 10) + 0xD800, code % 0x400 + 0xDC00)); + elements[i] = code < 0x10000 ? fromCharCode(code) : fromCharCode(((code -= 0x10000) >> 10) + 0xD800, code % 0x400 + 0xDC00); } - return elements.join(''); + return join(elements, ''); } }); /***/ }), -/* 308 */ +/* 330 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -10928,16 +11900,19 @@ $({ var $ = __webpack_require__(2); -var notARegExp = __webpack_require__(305); +var uncurryThis = __webpack_require__(12); -var requireObjectCoercible = __webpack_require__(12); +var notARegExp = __webpack_require__(327); -var toString = __webpack_require__(54); +var requireObjectCoercible = __webpack_require__(14); -var correctIsRegExpLogic = __webpack_require__(306); // `String.prototype.includes` method +var toString = __webpack_require__(64); + +var correctIsRegExpLogic = __webpack_require__(328); + +var stringIndexOf = uncurryThis(''.indexOf); // `String.prototype.includes` method // https://tc39.es/ecma262/#sec-string.prototype.includes - $({ target: 'String', proto: true, @@ -10946,24 +11921,24 @@ $({ includes: function includes(searchString /* , position = 0 */ ) { - return !!~toString(requireObjectCoercible(this)).indexOf(toString(notARegExp(searchString)), arguments.length > 1 ? arguments[1] : undefined); + return !!~stringIndexOf(toString(requireObjectCoercible(this)), toString(notARegExp(searchString)), arguments.length > 1 ? arguments[1] : undefined); } }); /***/ }), -/* 309 */ +/* 331 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var charAt = __webpack_require__(303).charAt; +var charAt = (__webpack_require__(325).charAt); -var toString = __webpack_require__(54); +var toString = __webpack_require__(64); -var InternalStateModule = __webpack_require__(38); +var InternalStateModule = __webpack_require__(45); -var defineIterator = __webpack_require__(122); +var defineIterator = __webpack_require__(139); var STRING_ITERATOR = 'String Iterator'; var setInternalState = InternalStateModule.set; @@ -10995,25 +11970,29 @@ defineIterator(String, 'String', function (iterated) { }); /***/ }), -/* 310 */ +/* 332 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var fixRegExpWellKnownSymbolLogic = __webpack_require__(311); +var call = __webpack_require__(7); -var anObject = __webpack_require__(35); +var fixRegExpWellKnownSymbolLogic = __webpack_require__(333); -var toLength = __webpack_require__(47); +var anObject = __webpack_require__(42); -var toString = __webpack_require__(54); +var toLength = __webpack_require__(58); -var requireObjectCoercible = __webpack_require__(12); +var toString = __webpack_require__(64); -var advanceStringIndex = __webpack_require__(312); +var requireObjectCoercible = __webpack_require__(14); -var regExpExec = __webpack_require__(313); // @@match logic +var getMethod = __webpack_require__(26); + +var advanceStringIndex = __webpack_require__(334); + +var regExpExec = __webpack_require__(335); // @@match logic fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNative) { @@ -11021,8 +12000,8 @@ fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNa // https://tc39.es/ecma262/#sec-string.prototype.match function match(regexp) { var O = requireObjectCoercible(this); - var matcher = regexp == undefined ? undefined : regexp[MATCH]; - return matcher !== undefined ? matcher.call(regexp, O) : new RegExp(regexp)[MATCH](toString(O)); + var matcher = regexp == undefined ? undefined : getMethod(regexp, MATCH); + return matcher ? call(matcher, regexp, O) : new RegExp(regexp)[MATCH](toString(O)); }, // `RegExp.prototype[@@match]` method // https://tc39.es/ecma262/#sec-regexp.prototype-@@match function (string) { @@ -11049,23 +12028,25 @@ fixRegExpWellKnownSymbolLogic('match', function (MATCH, nativeMatch, maybeCallNa }); /***/ }), -/* 311 */ +/* 333 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; // TODO: Remove from `core-js@4` since it's moved to entry points -__webpack_require__(295); +__webpack_require__(316); -var redefine = __webpack_require__(36); +var uncurryThis = __webpack_require__(12); -var regexpExec = __webpack_require__(296); +var redefine = __webpack_require__(43); + +var regexpExec = __webpack_require__(317); var fails = __webpack_require__(6); -var wellKnownSymbol = __webpack_require__(23); +var wellKnownSymbol = __webpack_require__(30); -var createNonEnumerableProperty = __webpack_require__(33); +var createNonEnumerableProperty = __webpack_require__(40); var SPECIES = wellKnownSymbol('species'); var RegExpPrototype = RegExp.prototype; @@ -11114,8 +12095,9 @@ module.exports = function (KEY, exec, FORCED, SHAM) { }); if (!DELEGATES_TO_SYMBOL || !DELEGATES_TO_EXEC || FORCED) { - var nativeRegExpMethod = /./[SYMBOL]; + var uncurriedNativeRegExpMethod = uncurryThis(/./[SYMBOL]); var methods = exec(SYMBOL, ''[KEY], function (nativeMethod, regexp, str, arg2, forceStringMethod) { + var uncurriedNativeMethod = uncurryThis(nativeMethod); var $exec = regexp.exec; if ($exec === regexpExec || $exec === RegExpPrototype.exec) { @@ -11125,13 +12107,13 @@ module.exports = function (KEY, exec, FORCED, SHAM) { // We avoid it by directly calling the native @@method method. return { done: true, - value: nativeRegExpMethod.call(regexp, str, arg2) + value: uncurriedNativeRegExpMethod(regexp, str, arg2) }; } return { done: true, - value: nativeMethod.call(str, regexp, arg2) + value: uncurriedNativeMethod(str, regexp, arg2) }; } @@ -11147,13 +12129,13 @@ module.exports = function (KEY, exec, FORCED, SHAM) { }; /***/ }), -/* 312 */ +/* 334 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var charAt = __webpack_require__(303).charAt; // `AdvanceStringIndex` abstract operation +var charAt = (__webpack_require__(325).charAt); // `AdvanceStringIndex` abstract operation // https://tc39.es/ecma262/#sec-advancestringindex @@ -11162,37 +12144,39 @@ module.exports = function (S, index, unicode) { }; /***/ }), -/* 313 */ +/* 335 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var classof = __webpack_require__(11); +var global = __webpack_require__(3); -var regexpExec = __webpack_require__(296); // `RegExpExec` abstract operation +var call = __webpack_require__(7); + +var anObject = __webpack_require__(42); + +var isCallable = __webpack_require__(18); + +var classof = __webpack_require__(13); + +var regexpExec = __webpack_require__(317); + +var TypeError = global.TypeError; // `RegExpExec` abstract operation // https://tc39.es/ecma262/#sec-regexpexec - module.exports = function (R, S) { var exec = R.exec; - if (typeof exec === 'function') { - var result = exec.call(R, S); - - if (typeof result !== 'object') { - throw TypeError('RegExp exec method returned something other than an Object or null'); - } - + if (isCallable(exec)) { + var result = call(exec, R, S); + if (result !== null) anObject(result); return result; } - if (classof(R) !== 'RegExp') { - throw TypeError('RegExp#exec called on incompatible receiver'); - } - - return regexpExec.call(R, S); + if (classof(R) === 'RegExp') return call(regexpExec, R, S); + throw TypeError('RegExp#exec called on incompatible receiver'); }; /***/ }), -/* 314 */ +/* 336 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -11201,37 +12185,47 @@ module.exports = function (R, S) { var $ = __webpack_require__(2); -var createIteratorConstructor = __webpack_require__(123); +var global = __webpack_require__(3); -var requireObjectCoercible = __webpack_require__(12); +var call = __webpack_require__(7); -var toLength = __webpack_require__(47); +var uncurryThis = __webpack_require__(12); -var toString = __webpack_require__(54); +var createIteratorConstructor = __webpack_require__(140); -var aFunction = __webpack_require__(66); +var requireObjectCoercible = __webpack_require__(14); -var anObject = __webpack_require__(35); +var toLength = __webpack_require__(58); -var classof = __webpack_require__(11); +var toString = __webpack_require__(64); -var isRegExp = __webpack_require__(289); +var anObject = __webpack_require__(42); -var getRegExpFlags = __webpack_require__(290); +var classof = __webpack_require__(13); -var createNonEnumerableProperty = __webpack_require__(33); +var isPrototypeOf = __webpack_require__(21); + +var isRegExp = __webpack_require__(310); + +var regExpFlags = __webpack_require__(311); + +var getMethod = __webpack_require__(26); + +var redefine = __webpack_require__(43); var fails = __webpack_require__(6); -var wellKnownSymbol = __webpack_require__(23); +var wellKnownSymbol = __webpack_require__(30); -var speciesConstructor = __webpack_require__(157); +var speciesConstructor = __webpack_require__(174); -var advanceStringIndex = __webpack_require__(312); +var advanceStringIndex = __webpack_require__(334); -var InternalStateModule = __webpack_require__(38); +var regExpExec = __webpack_require__(335); -var IS_PURE = __webpack_require__(25); +var InternalStateModule = __webpack_require__(45); + +var IS_PURE = __webpack_require__(32); var MATCH_ALL = wellKnownSymbol('matchAll'); var REGEXP_STRING = 'RegExp String'; @@ -11239,32 +12233,19 @@ var REGEXP_STRING_ITERATOR = REGEXP_STRING + ' Iterator'; var setInternalState = InternalStateModule.set; var getInternalState = InternalStateModule.getterFor(REGEXP_STRING_ITERATOR); var RegExpPrototype = RegExp.prototype; -var regExpBuiltinExec = RegExpPrototype.exec; -var nativeMatchAll = ''.matchAll; -var WORKS_WITH_NON_GLOBAL_REGEX = !!nativeMatchAll && !fails(function () { - 'a'.matchAll(/./); +var TypeError = global.TypeError; +var getFlags = uncurryThis(regExpFlags); +var stringIndexOf = uncurryThis(''.indexOf); +var un$MatchAll = uncurryThis(''.matchAll); +var WORKS_WITH_NON_GLOBAL_REGEX = !!un$MatchAll && !fails(function () { + un$MatchAll('a', /./); }); - -var regExpExec = function (R, S) { - var exec = R.exec; - var result; - - if (typeof exec == 'function') { - result = exec.call(R, S); - if (typeof result != 'object') throw TypeError('Incorrect exec result'); - return result; - } - - return regExpBuiltinExec.call(R, S); -}; // eslint-disable-next-line max-len -- ignore - - -var $RegExpStringIterator = createIteratorConstructor(function RegExpStringIterator(regexp, string, global, fullUnicode) { +var $RegExpStringIterator = createIteratorConstructor(function RegExpStringIterator(regexp, string, $global, fullUnicode) { setInternalState(this, { type: REGEXP_STRING_ITERATOR, regexp: regexp, string: string, - global: global, + global: $global, unicode: fullUnicode, done: false }); @@ -11300,20 +12281,20 @@ var $RegExpStringIterator = createIteratorConstructor(function RegExpStringItera var $matchAll = function (string) { var R = anObject(this); var S = toString(string); - var C, flagsValue, flags, matcher, global, fullUnicode; + var C, flagsValue, flags, matcher, $global, fullUnicode; C = speciesConstructor(R, RegExp); flagsValue = R.flags; - if (flagsValue === undefined && R instanceof RegExp && !('flags' in RegExpPrototype)) { - flagsValue = getRegExpFlags.call(R); + if (flagsValue === undefined && isPrototypeOf(RegExpPrototype, R) && !('flags' in RegExpPrototype)) { + flagsValue = getFlags(R); } flags = flagsValue === undefined ? '' : toString(flagsValue); matcher = new C(C === RegExp ? R.source : R, flags); - global = !!~flags.indexOf('g'); - fullUnicode = !!~flags.indexOf('u'); + $global = !!~stringIndexOf(flags, 'g'); + fullUnicode = !!~stringIndexOf(flags, 'u'); matcher.lastIndex = toLength(R.lastIndex); - return new $RegExpStringIterator(matcher, S, global, fullUnicode); + return new $RegExpStringIterator(matcher, S, $global, fullUnicode); }; // `String.prototype.matchAll` method // https://tc39.es/ecma262/#sec-string.prototype.matchall @@ -11329,25 +12310,25 @@ $({ if (regexp != null) { if (isRegExp(regexp)) { - flags = toString(requireObjectCoercible('flags' in RegExpPrototype ? regexp.flags : getRegExpFlags.call(regexp))); - if (!~flags.indexOf('g')) throw TypeError('`.matchAll` does not allow non-global regexes'); + flags = toString(requireObjectCoercible('flags' in RegExpPrototype ? regexp.flags : getFlags(regexp))); + if (!~stringIndexOf(flags, 'g')) throw TypeError('`.matchAll` does not allow non-global regexes'); } - if (WORKS_WITH_NON_GLOBAL_REGEX) return nativeMatchAll.apply(O, arguments); - matcher = regexp[MATCH_ALL]; + if (WORKS_WITH_NON_GLOBAL_REGEX) return un$MatchAll(O, regexp); + matcher = getMethod(regexp, MATCH_ALL); if (matcher === undefined && IS_PURE && classof(regexp) == 'RegExp') matcher = $matchAll; - if (matcher != null) return aFunction(matcher).call(regexp, O); - } else if (WORKS_WITH_NON_GLOBAL_REGEX) return nativeMatchAll.apply(O, arguments); + if (matcher) return call(matcher, regexp, O); + } else if (WORKS_WITH_NON_GLOBAL_REGEX) return un$MatchAll(O, regexp); S = toString(O); rx = new RegExp(regexp, 'g'); - return IS_PURE ? $matchAll.call(rx, S) : rx[MATCH_ALL](S); + return IS_PURE ? call($matchAll, rx, S) : rx[MATCH_ALL](S); } }); -IS_PURE || MATCH_ALL in RegExpPrototype || createNonEnumerableProperty(RegExpPrototype, MATCH_ALL, $matchAll); +IS_PURE || MATCH_ALL in RegExpPrototype || redefine(RegExpPrototype, MATCH_ALL, $matchAll); /***/ }), -/* 315 */ +/* 337 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -11355,9 +12336,9 @@ IS_PURE || MATCH_ALL in RegExpPrototype || createNonEnumerableProperty(RegExpPro var $ = __webpack_require__(2); -var $padEnd = __webpack_require__(165).end; +var $padEnd = (__webpack_require__(183).end); -var WEBKIT_BUG = __webpack_require__(316); // `String.prototype.padEnd` method +var WEBKIT_BUG = __webpack_require__(338); // `String.prototype.padEnd` method // https://tc39.es/ecma262/#sec-string.prototype.padend @@ -11374,17 +12355,16 @@ $({ }); /***/ }), -/* 316 */ +/* 338 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { // https://github.com/zloirock/core-js/issues/280 -var userAgent = __webpack_require__(21); // eslint-disable-next-line unicorn/no-unsafe-regex -- safe - +var userAgent = __webpack_require__(25); module.exports = /Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari\//.test(userAgent); /***/ }), -/* 317 */ +/* 339 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -11392,9 +12372,9 @@ module.exports = /Version\/10(?:\.\d+){1,2}(?: [\w./]+)?(?: Mobile\/\w+)? Safari var $ = __webpack_require__(2); -var $padStart = __webpack_require__(165).start; +var $padStart = (__webpack_require__(183).start); -var WEBKIT_BUG = __webpack_require__(316); // `String.prototype.padStart` method +var WEBKIT_BUG = __webpack_require__(338); // `String.prototype.padStart` method // https://tc39.es/ecma262/#sec-string.prototype.padstart @@ -11411,46 +12391,51 @@ $({ }); /***/ }), -/* 318 */ +/* 340 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var toIndexedObject = __webpack_require__(9); +var uncurryThis = __webpack_require__(12); -var toLength = __webpack_require__(47); +var toIndexedObject = __webpack_require__(10); -var toString = __webpack_require__(54); // `String.raw` method +var toObject = __webpack_require__(36); + +var toString = __webpack_require__(64); + +var lengthOfArrayLike = __webpack_require__(57); + +var push = uncurryThis([].push); +var join = uncurryThis([].join); // `String.raw` method // https://tc39.es/ecma262/#sec-string.raw - $({ target: 'String', stat: true }, { raw: function raw(template) { - var rawTemplate = toIndexedObject(template.raw); - var literalSegments = toLength(rawTemplate.length); + var rawTemplate = toIndexedObject(toObject(template).raw); + var literalSegments = lengthOfArrayLike(rawTemplate); var argumentsLength = arguments.length; var elements = []; var i = 0; while (literalSegments > i) { - elements.push(toString(rawTemplate[i++])); - if (i < argumentsLength) elements.push(toString(arguments[i])); + push(elements, toString(rawTemplate[i++])); + if (i === literalSegments) return join(elements, ''); + if (i < argumentsLength) push(elements, toString(arguments[i])); } - - return elements.join(''); } }); /***/ }), -/* 319 */ +/* 341 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); -var repeat = __webpack_require__(166); // `String.prototype.repeat` method +var repeat = __webpack_require__(184); // `String.prototype.repeat` method // https://tc39.es/ecma262/#sec-string.prototype.repeat @@ -11462,37 +12447,51 @@ $({ }); /***/ }), -/* 320 */ +/* 342 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var fixRegExpWellKnownSymbolLogic = __webpack_require__(311); +var apply = __webpack_require__(62); + +var call = __webpack_require__(7); + +var uncurryThis = __webpack_require__(12); + +var fixRegExpWellKnownSymbolLogic = __webpack_require__(333); var fails = __webpack_require__(6); -var anObject = __webpack_require__(35); +var anObject = __webpack_require__(42); -var toInteger = __webpack_require__(48); +var isCallable = __webpack_require__(18); -var toLength = __webpack_require__(47); +var toIntegerOrInfinity = __webpack_require__(56); -var toString = __webpack_require__(54); +var toLength = __webpack_require__(58); -var requireObjectCoercible = __webpack_require__(12); +var toString = __webpack_require__(64); -var advanceStringIndex = __webpack_require__(312); +var requireObjectCoercible = __webpack_require__(14); -var getSubstitution = __webpack_require__(321); +var advanceStringIndex = __webpack_require__(334); -var regExpExec = __webpack_require__(313); +var getMethod = __webpack_require__(26); -var wellKnownSymbol = __webpack_require__(23); +var getSubstitution = __webpack_require__(343); + +var regExpExec = __webpack_require__(335); + +var wellKnownSymbol = __webpack_require__(30); var REPLACE = wellKnownSymbol('replace'); var max = Math.max; var min = Math.min; +var concat = uncurryThis([].concat); +var push = uncurryThis([].push); +var stringIndexOf = uncurryThis(''.indexOf); +var stringSlice = uncurryThis(''.slice); var maybeToString = function (it) { return it === undefined ? it : String(it); @@ -11535,20 +12534,20 @@ fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNa // https://tc39.es/ecma262/#sec-string.prototype.replace function replace(searchValue, replaceValue) { var O = requireObjectCoercible(this); - var replacer = searchValue == undefined ? undefined : searchValue[REPLACE]; - return replacer !== undefined ? replacer.call(searchValue, O, replaceValue) : nativeReplace.call(toString(O), searchValue, replaceValue); + var replacer = searchValue == undefined ? undefined : getMethod(searchValue, REPLACE); + return replacer ? call(replacer, searchValue, O, replaceValue) : call(nativeReplace, toString(O), searchValue, replaceValue); }, // `RegExp.prototype[@@replace]` method // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace function (string, replaceValue) { var rx = anObject(this); var S = toString(string); - if (typeof replaceValue === 'string' && replaceValue.indexOf(UNSAFE_SUBSTITUTE) === -1 && replaceValue.indexOf('$<') === -1) { + if (typeof replaceValue == 'string' && stringIndexOf(replaceValue, UNSAFE_SUBSTITUTE) === -1 && stringIndexOf(replaceValue, '$<') === -1) { var res = maybeCallNative(nativeReplace, rx, S, replaceValue); if (res.done) return res.value; } - var functionalReplace = typeof replaceValue === 'function'; + var functionalReplace = isCallable(replaceValue); if (!functionalReplace) replaceValue = toString(replaceValue); var global = rx.global; @@ -11562,7 +12561,7 @@ fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNa while (true) { var result = regExpExec(rx, S); if (result === null) break; - results.push(result); + push(results, result); if (!global) break; var matchStr = toString(result[0]); if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode); @@ -11574,43 +12573,47 @@ fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNa for (var i = 0; i < results.length; i++) { result = results[i]; var matched = toString(result[0]); - var position = max(min(toInteger(result.index), S.length), 0); + var position = max(min(toIntegerOrInfinity(result.index), S.length), 0); var captures = []; // NOTE: This is equivalent to // captures = result.slice(1).map(maybeToString) // but for some reason `nativeSlice.call(result, 1, result.length)` (called in // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it. - for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j])); + for (var j = 1; j < result.length; j++) push(captures, maybeToString(result[j])); var namedCaptures = result.groups; if (functionalReplace) { - var replacerArgs = [matched].concat(captures, position, S); - if (namedCaptures !== undefined) replacerArgs.push(namedCaptures); - var replacement = toString(replaceValue.apply(undefined, replacerArgs)); + var replacerArgs = concat([matched], captures, position, S); + if (namedCaptures !== undefined) push(replacerArgs, namedCaptures); + var replacement = toString(apply(replaceValue, undefined, replacerArgs)); } else { replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue); } if (position >= nextSourcePosition) { - accumulatedResult += S.slice(nextSourcePosition, position) + replacement; + accumulatedResult += stringSlice(S, nextSourcePosition, position) + replacement; nextSourcePosition = position + matched.length; } } - return accumulatedResult + S.slice(nextSourcePosition); + return accumulatedResult + stringSlice(S, nextSourcePosition); }]; }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE); /***/ }), -/* 321 */ +/* 343 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var toObject = __webpack_require__(29); +var uncurryThis = __webpack_require__(12); + +var toObject = __webpack_require__(36); var floor = Math.floor; -var replace = ''.replace; +var charAt = uncurryThis(''.charAt); +var replace = uncurryThis(''.replace); +var stringSlice = uncurryThis(''.slice); var SUBSTITUTION_SYMBOLS = /\$([$&'`]|\d{1,2}|<[^>]*>)/g; var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&'`]|\d{1,2})/g; // `GetSubstitution` abstract operation // https://tc39.es/ecma262/#sec-getsubstitution @@ -11625,10 +12628,10 @@ module.exports = function (matched, str, position, captures, namedCaptures, repl symbols = SUBSTITUTION_SYMBOLS; } - return replace.call(replacement, symbols, function (match, ch) { + return replace(replacement, symbols, function (match, ch) { var capture; - switch (ch.charAt(0)) { + switch (charAt(ch, 0)) { case '$': return '$'; @@ -11636,13 +12639,13 @@ module.exports = function (matched, str, position, captures, namedCaptures, repl return matched; case '`': - return str.slice(0, position); + return stringSlice(str, 0, position); case "'": - return str.slice(tailPos); + return stringSlice(str, tailPos); case '<': - capture = namedCaptures[ch.slice(1, -1)]; + capture = namedCaptures[stringSlice(ch, 1, -1)]; break; default: @@ -11653,7 +12656,7 @@ module.exports = function (matched, str, position, captures, namedCaptures, repl if (n > m) { var f = floor(n / 10); if (f === 0) return match; - if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1); + if (f <= m) return captures[f - 1] === undefined ? charAt(ch, 1) : captures[f - 1] + charAt(ch, 1); return match; } @@ -11665,7 +12668,7 @@ module.exports = function (matched, str, position, captures, namedCaptures, repl }; /***/ }), -/* 322 */ +/* 344 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -11673,28 +12676,43 @@ module.exports = function (matched, str, position, captures, namedCaptures, repl var $ = __webpack_require__(2); -var requireObjectCoercible = __webpack_require__(12); +var global = __webpack_require__(3); -var isRegExp = __webpack_require__(289); +var call = __webpack_require__(7); -var toString = __webpack_require__(54); +var uncurryThis = __webpack_require__(12); -var getRegExpFlags = __webpack_require__(290); +var requireObjectCoercible = __webpack_require__(14); -var getSubstitution = __webpack_require__(321); +var isCallable = __webpack_require__(18); -var wellKnownSymbol = __webpack_require__(23); +var isRegExp = __webpack_require__(310); -var IS_PURE = __webpack_require__(25); +var toString = __webpack_require__(64); + +var getMethod = __webpack_require__(26); + +var regExpFlags = __webpack_require__(311); + +var getSubstitution = __webpack_require__(343); + +var wellKnownSymbol = __webpack_require__(30); + +var IS_PURE = __webpack_require__(32); var REPLACE = wellKnownSymbol('replace'); var RegExpPrototype = RegExp.prototype; +var TypeError = global.TypeError; +var getFlags = uncurryThis(regExpFlags); +var indexOf = uncurryThis(''.indexOf); +var replace = uncurryThis(''.replace); +var stringSlice = uncurryThis(''.slice); var max = Math.max; var stringIndexOf = function (string, searchValue, fromIndex) { if (fromIndex > string.length) return -1; if (searchValue === '') return fromIndex; - return string.indexOf(searchValue, fromIndex); + return indexOf(string, searchValue, fromIndex); }; // `String.prototype.replaceAll` method // https://tc39.es/ecma262/#sec-string.prototype.replaceall @@ -11714,41 +12732,36 @@ $({ IS_REG_EXP = isRegExp(searchValue); if (IS_REG_EXP) { - flags = toString(requireObjectCoercible('flags' in RegExpPrototype ? searchValue.flags : getRegExpFlags.call(searchValue))); - if (!~flags.indexOf('g')) throw TypeError('`.replaceAll` does not allow non-global regexes'); + flags = toString(requireObjectCoercible('flags' in RegExpPrototype ? searchValue.flags : getFlags(searchValue))); + if (!~indexOf(flags, 'g')) throw TypeError('`.replaceAll` does not allow non-global regexes'); } - replacer = searchValue[REPLACE]; + replacer = getMethod(searchValue, REPLACE); - if (replacer !== undefined) { - return replacer.call(searchValue, O, replaceValue); + if (replacer) { + return call(replacer, searchValue, O, replaceValue); } else if (IS_PURE && IS_REG_EXP) { - return toString(O).replace(searchValue, replaceValue); + return replace(toString(O), searchValue, replaceValue); } } string = toString(O); searchString = toString(searchValue); - functionalReplace = typeof replaceValue === 'function'; + functionalReplace = isCallable(replaceValue); if (!functionalReplace) replaceValue = toString(replaceValue); searchLength = searchString.length; advanceBy = max(1, searchLength); position = stringIndexOf(string, searchString, 0); while (position !== -1) { - if (functionalReplace) { - replacement = toString(replaceValue(searchString, position, string)); - } else { - replacement = getSubstitution(searchString, string, position, [], undefined, replaceValue); - } - - result += string.slice(endOfLastMatch, position) + replacement; + replacement = functionalReplace ? toString(replaceValue(searchString, position, string)) : getSubstitution(searchString, string, position, [], undefined, replaceValue); + result += stringSlice(string, endOfLastMatch, position) + replacement; endOfLastMatch = position + searchLength; position = stringIndexOf(string, searchString, position + advanceBy); } if (endOfLastMatch < string.length) { - result += string.slice(endOfLastMatch); + result += stringSlice(string, endOfLastMatch); } return result; @@ -11756,23 +12769,27 @@ $({ }); /***/ }), -/* 323 */ +/* 345 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var fixRegExpWellKnownSymbolLogic = __webpack_require__(311); +var call = __webpack_require__(7); -var anObject = __webpack_require__(35); +var fixRegExpWellKnownSymbolLogic = __webpack_require__(333); -var requireObjectCoercible = __webpack_require__(12); +var anObject = __webpack_require__(42); -var sameValue = __webpack_require__(243); +var requireObjectCoercible = __webpack_require__(14); -var toString = __webpack_require__(54); +var sameValue = __webpack_require__(264); -var regExpExec = __webpack_require__(313); // @@search logic +var toString = __webpack_require__(64); + +var getMethod = __webpack_require__(26); + +var regExpExec = __webpack_require__(335); // @@search logic fixRegExpWellKnownSymbolLogic('search', function (SEARCH, nativeSearch, maybeCallNative) { @@ -11780,8 +12797,8 @@ fixRegExpWellKnownSymbolLogic('search', function (SEARCH, nativeSearch, maybeCal // https://tc39.es/ecma262/#sec-string.prototype.search function search(regexp) { var O = requireObjectCoercible(this); - var searcher = regexp == undefined ? undefined : regexp[SEARCH]; - return searcher !== undefined ? searcher.call(regexp, O) : new RegExp(regexp)[SEARCH](toString(O)); + var searcher = regexp == undefined ? undefined : getMethod(regexp, SEARCH); + return searcher ? call(searcher, regexp, O) : new RegExp(regexp)[SEARCH](toString(O)); }, // `RegExp.prototype[@@search]` method // https://tc39.es/ecma262/#sec-regexp.prototype-@@search function (string) { @@ -11798,40 +12815,53 @@ fixRegExpWellKnownSymbolLogic('search', function (SEARCH, nativeSearch, maybeCal }); /***/ }), -/* 324 */ +/* 346 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var fixRegExpWellKnownSymbolLogic = __webpack_require__(311); +var apply = __webpack_require__(62); -var isRegExp = __webpack_require__(289); +var call = __webpack_require__(7); -var anObject = __webpack_require__(35); +var uncurryThis = __webpack_require__(12); -var requireObjectCoercible = __webpack_require__(12); +var fixRegExpWellKnownSymbolLogic = __webpack_require__(333); -var speciesConstructor = __webpack_require__(157); +var isRegExp = __webpack_require__(310); -var advanceStringIndex = __webpack_require__(312); +var anObject = __webpack_require__(42); -var toLength = __webpack_require__(47); +var requireObjectCoercible = __webpack_require__(14); -var toString = __webpack_require__(54); +var speciesConstructor = __webpack_require__(174); -var callRegExpExec = __webpack_require__(313); +var advanceStringIndex = __webpack_require__(334); -var regexpExec = __webpack_require__(296); +var toLength = __webpack_require__(58); -var stickyHelpers = __webpack_require__(291); +var toString = __webpack_require__(64); + +var getMethod = __webpack_require__(26); + +var arraySlice = __webpack_require__(72); + +var callRegExpExec = __webpack_require__(335); + +var regexpExec = __webpack_require__(317); + +var stickyHelpers = __webpack_require__(312); var fails = __webpack_require__(6); var UNSUPPORTED_Y = stickyHelpers.UNSUPPORTED_Y; -var arrayPush = [].push; +var MAX_UINT32 = 0xFFFFFFFF; var min = Math.min; -var MAX_UINT32 = 0xFFFFFFFF; // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec +var $push = [].push; +var exec = uncurryThis(/./.exec); +var push = uncurryThis($push); +var stringSlice = uncurryThis(''.slice); // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec // Weex JS has frozen built-in prototypes, so use try / catch wrapper var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = !fails(function () { @@ -11861,7 +12891,7 @@ fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNa if (separator === undefined) return [string]; // If `separator` is not a regex, use native split if (!isRegExp(separator)) { - return nativeSplit.call(string, separator, lim); + return call(nativeSplit, string, separator, lim); } var output = []; @@ -11871,12 +12901,12 @@ fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNa var separatorCopy = new RegExp(separator.source, flags + 'g'); var match, lastIndex, lastLength; - while (match = regexpExec.call(separatorCopy, string)) { + while (match = call(regexpExec, separatorCopy, string)) { lastIndex = separatorCopy.lastIndex; if (lastIndex > lastLastIndex) { - output.push(string.slice(lastLastIndex, match.index)); - if (match.length > 1 && match.index < string.length) arrayPush.apply(output, match.slice(1)); + push(output, stringSlice(string, lastLastIndex, match.index)); + if (match.length > 1 && match.index < string.length) apply($push, output, arraySlice(match, 1)); lastLength = match[0].length; lastLastIndex = lastIndex; if (output.length >= lim) break; @@ -11886,15 +12916,15 @@ fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNa } if (lastLastIndex === string.length) { - if (lastLength || !separatorCopy.test('')) output.push(''); - } else output.push(string.slice(lastLastIndex)); + if (lastLength || !exec(separatorCopy, '')) push(output, ''); + } else push(output, stringSlice(string, lastLastIndex)); - return output.length > lim ? output.slice(0, lim) : output; + return output.length > lim ? arraySlice(output, 0, lim) : output; }; // Chakra, V8 } else if ('0'.split(undefined, 0).length) { internalSplit = function (separator, limit) { - return separator === undefined && limit === 0 ? [] : nativeSplit.call(this, separator, limit); + return separator === undefined && limit === 0 ? [] : call(nativeSplit, this, separator, limit); }; } else internalSplit = nativeSplit; @@ -11902,8 +12932,8 @@ fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNa // https://tc39.es/ecma262/#sec-string.prototype.split function split(separator, limit) { var O = requireObjectCoercible(this); - var splitter = separator == undefined ? undefined : separator[SPLIT]; - return splitter !== undefined ? splitter.call(separator, O, limit) : internalSplit.call(toString(O), separator, limit); + var splitter = separator == undefined ? undefined : getMethod(separator, SPLIT); + return splitter ? call(splitter, separator, O, limit) : call(internalSplit, toString(O), separator, limit); }, // `RegExp.prototype[@@split]` method // https://tc39.es/ecma262/#sec-regexp.prototype-@@split // @@ -11929,17 +12959,17 @@ fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNa while (q < S.length) { splitter.lastIndex = UNSUPPORTED_Y ? 0 : q; - var z = callRegExpExec(splitter, UNSUPPORTED_Y ? S.slice(q) : S); + var z = callRegExpExec(splitter, UNSUPPORTED_Y ? stringSlice(S, q) : S); var e; if (z === null || (e = min(toLength(splitter.lastIndex + (UNSUPPORTED_Y ? q : 0)), S.length)) === p) { q = advanceStringIndex(S, q, unicodeMatching); } else { - A.push(S.slice(p, q)); + push(A, stringSlice(S, p, q)); if (A.length === lim) return A; for (var i = 1; i <= z.length - 1; i++) { - A.push(z[i]); + push(A, z[i]); if (A.length === lim) return A; } @@ -11947,13 +12977,13 @@ fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNa } } - A.push(S.slice(p)); + push(A, stringSlice(S, p)); return A; }]; }, !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC, UNSUPPORTED_Y); /***/ }), -/* 325 */ +/* 347 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -11961,22 +12991,25 @@ fixRegExpWellKnownSymbolLogic('split', function (SPLIT, nativeSplit, maybeCallNa var $ = __webpack_require__(2); -var getOwnPropertyDescriptor = __webpack_require__(4).f; +var uncurryThis = __webpack_require__(12); -var toLength = __webpack_require__(47); +var getOwnPropertyDescriptor = (__webpack_require__(4).f); -var toString = __webpack_require__(54); +var toLength = __webpack_require__(58); -var notARegExp = __webpack_require__(305); +var toString = __webpack_require__(64); -var requireObjectCoercible = __webpack_require__(12); +var notARegExp = __webpack_require__(327); -var correctIsRegExpLogic = __webpack_require__(306); +var requireObjectCoercible = __webpack_require__(14); -var IS_PURE = __webpack_require__(25); // eslint-disable-next-line es/no-string-prototype-startswith -- safe +var correctIsRegExpLogic = __webpack_require__(328); + +var IS_PURE = __webpack_require__(32); // eslint-disable-next-line es/no-string-prototype-startswith -- safe -var $startsWith = ''.startsWith; +var un$StartsWith = uncurryThis(''.startsWith); +var stringSlice = uncurryThis(''.slice); var min = Math.min; var CORRECT_IS_REGEXP_LOGIC = correctIsRegExpLogic('startsWith'); // https://github.com/zloirock/core-js/pull/702 @@ -11998,12 +13031,12 @@ $({ notARegExp(searchString); var index = toLength(min(arguments.length > 1 ? arguments[1] : undefined, that.length)); var search = toString(searchString); - return $startsWith ? $startsWith.call(that, search, index) : that.slice(index, index + search.length) === search; + return un$StartsWith ? un$StartsWith(that, search, index) : stringSlice(that, index, index + search.length) === search; } }); /***/ }), -/* 326 */ +/* 348 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -12011,37 +13044,42 @@ $({ var $ = __webpack_require__(2); -var requireObjectCoercible = __webpack_require__(12); +var uncurryThis = __webpack_require__(12); -var toInteger = __webpack_require__(48); +var requireObjectCoercible = __webpack_require__(14); -var toString = __webpack_require__(54); +var toIntegerOrInfinity = __webpack_require__(56); -var slice = ''.slice; +var toString = __webpack_require__(64); + +var stringSlice = uncurryThis(''.slice); var max = Math.max; -var min = Math.min; // `String.prototype.substr` method +var min = Math.min; // eslint-disable-next-line unicorn/prefer-string-slice -- required for testing + +var FORCED = !''.substr || 'ab'.substr(-1) !== 'b'; // `String.prototype.substr` method // https://tc39.es/ecma262/#sec-string.prototype.substr $({ target: 'String', - proto: true + proto: true, + forced: FORCED }, { substr: function substr(start, length) { var that = toString(requireObjectCoercible(this)); var size = that.length; - var intStart = toInteger(start); + var intStart = toIntegerOrInfinity(start); var intLength, intEnd; if (intStart === Infinity) intStart = 0; if (intStart < 0) intStart = max(size + intStart, 0); - intLength = length === undefined ? size : toInteger(length); + intLength = length === undefined ? size : toIntegerOrInfinity(length); if (intLength <= 0 || intLength === Infinity) return ''; intEnd = min(intStart + intLength, size); - return intStart >= intEnd ? '' : slice.call(that, intStart, intEnd); + return intStart >= intEnd ? '' : stringSlice(that, intStart, intEnd); } }); /***/ }), -/* 327 */ +/* 349 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -12049,9 +13087,9 @@ $({ var $ = __webpack_require__(2); -var $trim = __webpack_require__(208).trim; +var $trim = (__webpack_require__(229).trim); -var forcedStringTrimMethod = __webpack_require__(328); // `String.prototype.trim` method +var forcedStringTrimMethod = __webpack_require__(350); // `String.prototype.trim` method // https://tc39.es/ecma262/#sec-string.prototype.trim @@ -12066,24 +13104,26 @@ $({ }); /***/ }), -/* 328 */ +/* 350 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { +var PROPER_FUNCTION_NAME = (__webpack_require__(49).PROPER); + var fails = __webpack_require__(6); -var whitespaces = __webpack_require__(209); +var whitespaces = __webpack_require__(230); var non = '\u200B\u0085\u180E'; // check that a method works with the correct list // of whitespaces and has a correct name module.exports = function (METHOD_NAME) { return fails(function () { - return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() != non || whitespaces[METHOD_NAME].name !== METHOD_NAME; + return !!whitespaces[METHOD_NAME]() || non[METHOD_NAME]() !== non || PROPER_FUNCTION_NAME && whitespaces[METHOD_NAME].name !== METHOD_NAME; }); }; /***/ }), -/* 329 */ +/* 351 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -12091,9 +13131,9 @@ module.exports = function (METHOD_NAME) { var $ = __webpack_require__(2); -var $trimEnd = __webpack_require__(208).end; +var $trimEnd = (__webpack_require__(229).end); -var forcedStringTrimMethod = __webpack_require__(328); +var forcedStringTrimMethod = __webpack_require__(350); var FORCED = forcedStringTrimMethod('trimEnd'); var trimEnd = FORCED ? function trimEnd() { @@ -12105,6 +13145,7 @@ var trimEnd = FORCED ? function trimEnd() { $({ target: 'String', proto: true, + name: 'trimEnd', forced: FORCED }, { trimEnd: trimEnd, @@ -12112,7 +13153,7 @@ $({ }); /***/ }), -/* 330 */ +/* 352 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -12120,9 +13161,9 @@ $({ var $ = __webpack_require__(2); -var $trimStart = __webpack_require__(208).start; +var $trimStart = (__webpack_require__(229).start); -var forcedStringTrimMethod = __webpack_require__(328); +var forcedStringTrimMethod = __webpack_require__(350); var FORCED = forcedStringTrimMethod('trimStart'); var trimStart = FORCED ? function trimStart() { @@ -12134,6 +13175,7 @@ var trimStart = FORCED ? function trimStart() { $({ target: 'String', proto: true, + name: 'trimStart', forced: FORCED }, { trimStart: trimStart, @@ -12141,7 +13183,7 @@ $({ }); /***/ }), -/* 331 */ +/* 353 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -12149,9 +13191,9 @@ $({ var $ = __webpack_require__(2); -var createHTML = __webpack_require__(332); +var createHTML = __webpack_require__(354); -var forcedStringHTMLMethod = __webpack_require__(333); // `String.prototype.anchor` method +var forcedStringHTMLMethod = __webpack_require__(355); // `String.prototype.anchor` method // https://tc39.es/ecma262/#sec-string.prototype.anchor @@ -12166,25 +13208,28 @@ $({ }); /***/ }), -/* 332 */ +/* 354 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var requireObjectCoercible = __webpack_require__(12); +var uncurryThis = __webpack_require__(12); -var toString = __webpack_require__(54); +var requireObjectCoercible = __webpack_require__(14); -var quot = /"/g; // `CreateHTML` abstract operation +var toString = __webpack_require__(64); + +var quot = /"/g; +var replace = uncurryThis(''.replace); // `CreateHTML` abstract operation // https://tc39.es/ecma262/#sec-createhtml module.exports = function (string, tag, attribute, value) { var S = toString(requireObjectCoercible(string)); var p1 = '<' + tag; - if (attribute !== '') p1 += ' ' + attribute + '="' + toString(value).replace(quot, '"') + '"'; + if (attribute !== '') p1 += ' ' + attribute + '="' + replace(toString(value), quot, '"') + '"'; return p1 + '>' + S + ''; }; /***/ }), -/* 333 */ +/* 355 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var fails = __webpack_require__(6); // check the existence of a method, lowercase @@ -12199,7 +13244,7 @@ module.exports = function (METHOD_NAME) { }; /***/ }), -/* 334 */ +/* 356 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -12207,9 +13252,9 @@ module.exports = function (METHOD_NAME) { var $ = __webpack_require__(2); -var createHTML = __webpack_require__(332); +var createHTML = __webpack_require__(354); -var forcedStringHTMLMethod = __webpack_require__(333); // `String.prototype.big` method +var forcedStringHTMLMethod = __webpack_require__(355); // `String.prototype.big` method // https://tc39.es/ecma262/#sec-string.prototype.big @@ -12224,7 +13269,7 @@ $({ }); /***/ }), -/* 335 */ +/* 357 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -12232,9 +13277,9 @@ $({ var $ = __webpack_require__(2); -var createHTML = __webpack_require__(332); +var createHTML = __webpack_require__(354); -var forcedStringHTMLMethod = __webpack_require__(333); // `String.prototype.blink` method +var forcedStringHTMLMethod = __webpack_require__(355); // `String.prototype.blink` method // https://tc39.es/ecma262/#sec-string.prototype.blink @@ -12249,7 +13294,7 @@ $({ }); /***/ }), -/* 336 */ +/* 358 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -12257,9 +13302,9 @@ $({ var $ = __webpack_require__(2); -var createHTML = __webpack_require__(332); +var createHTML = __webpack_require__(354); -var forcedStringHTMLMethod = __webpack_require__(333); // `String.prototype.bold` method +var forcedStringHTMLMethod = __webpack_require__(355); // `String.prototype.bold` method // https://tc39.es/ecma262/#sec-string.prototype.bold @@ -12274,7 +13319,7 @@ $({ }); /***/ }), -/* 337 */ +/* 359 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -12282,9 +13327,9 @@ $({ var $ = __webpack_require__(2); -var createHTML = __webpack_require__(332); +var createHTML = __webpack_require__(354); -var forcedStringHTMLMethod = __webpack_require__(333); // `String.prototype.fixed` method +var forcedStringHTMLMethod = __webpack_require__(355); // `String.prototype.fixed` method // https://tc39.es/ecma262/#sec-string.prototype.fixed @@ -12299,7 +13344,7 @@ $({ }); /***/ }), -/* 338 */ +/* 360 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -12307,9 +13352,9 @@ $({ var $ = __webpack_require__(2); -var createHTML = __webpack_require__(332); +var createHTML = __webpack_require__(354); -var forcedStringHTMLMethod = __webpack_require__(333); // `String.prototype.fontcolor` method +var forcedStringHTMLMethod = __webpack_require__(355); // `String.prototype.fontcolor` method // https://tc39.es/ecma262/#sec-string.prototype.fontcolor @@ -12324,7 +13369,7 @@ $({ }); /***/ }), -/* 339 */ +/* 361 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -12332,9 +13377,9 @@ $({ var $ = __webpack_require__(2); -var createHTML = __webpack_require__(332); +var createHTML = __webpack_require__(354); -var forcedStringHTMLMethod = __webpack_require__(333); // `String.prototype.fontsize` method +var forcedStringHTMLMethod = __webpack_require__(355); // `String.prototype.fontsize` method // https://tc39.es/ecma262/#sec-string.prototype.fontsize @@ -12349,7 +13394,7 @@ $({ }); /***/ }), -/* 340 */ +/* 362 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -12357,9 +13402,9 @@ $({ var $ = __webpack_require__(2); -var createHTML = __webpack_require__(332); +var createHTML = __webpack_require__(354); -var forcedStringHTMLMethod = __webpack_require__(333); // `String.prototype.italics` method +var forcedStringHTMLMethod = __webpack_require__(355); // `String.prototype.italics` method // https://tc39.es/ecma262/#sec-string.prototype.italics @@ -12374,7 +13419,7 @@ $({ }); /***/ }), -/* 341 */ +/* 363 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -12382,9 +13427,9 @@ $({ var $ = __webpack_require__(2); -var createHTML = __webpack_require__(332); +var createHTML = __webpack_require__(354); -var forcedStringHTMLMethod = __webpack_require__(333); // `String.prototype.link` method +var forcedStringHTMLMethod = __webpack_require__(355); // `String.prototype.link` method // https://tc39.es/ecma262/#sec-string.prototype.link @@ -12399,7 +13444,7 @@ $({ }); /***/ }), -/* 342 */ +/* 364 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -12407,9 +13452,9 @@ $({ var $ = __webpack_require__(2); -var createHTML = __webpack_require__(332); +var createHTML = __webpack_require__(354); -var forcedStringHTMLMethod = __webpack_require__(333); // `String.prototype.small` method +var forcedStringHTMLMethod = __webpack_require__(355); // `String.prototype.small` method // https://tc39.es/ecma262/#sec-string.prototype.small @@ -12424,7 +13469,7 @@ $({ }); /***/ }), -/* 343 */ +/* 365 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -12432,9 +13477,9 @@ $({ var $ = __webpack_require__(2); -var createHTML = __webpack_require__(332); +var createHTML = __webpack_require__(354); -var forcedStringHTMLMethod = __webpack_require__(333); // `String.prototype.strike` method +var forcedStringHTMLMethod = __webpack_require__(355); // `String.prototype.strike` method // https://tc39.es/ecma262/#sec-string.prototype.strike @@ -12449,7 +13494,7 @@ $({ }); /***/ }), -/* 344 */ +/* 366 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -12457,9 +13502,9 @@ $({ var $ = __webpack_require__(2); -var createHTML = __webpack_require__(332); +var createHTML = __webpack_require__(354); -var forcedStringHTMLMethod = __webpack_require__(333); // `String.prototype.sub` method +var forcedStringHTMLMethod = __webpack_require__(355); // `String.prototype.sub` method // https://tc39.es/ecma262/#sec-string.prototype.sub @@ -12474,7 +13519,7 @@ $({ }); /***/ }), -/* 345 */ +/* 367 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -12482,9 +13527,9 @@ $({ var $ = __webpack_require__(2); -var createHTML = __webpack_require__(332); +var createHTML = __webpack_require__(354); -var forcedStringHTMLMethod = __webpack_require__(333); // `String.prototype.sup` method +var forcedStringHTMLMethod = __webpack_require__(355); // `String.prototype.sup` method // https://tc39.es/ecma262/#sec-string.prototype.sup @@ -12499,10 +13544,10 @@ $({ }); /***/ }), -/* 346 */ +/* 368 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var createTypedArrayConstructor = __webpack_require__(347); // `Float32Array` constructor +var createTypedArrayConstructor = __webpack_require__(369); // `Float32Array` constructor // https://tc39.es/ecma262/#sec-typedarray-objects @@ -12513,7 +13558,7 @@ createTypedArrayConstructor('Float32', function (init) { }); /***/ }), -/* 347 */ +/* 369 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -12523,57 +13568,61 @@ var $ = __webpack_require__(2); var global = __webpack_require__(3); +var call = __webpack_require__(7); + var DESCRIPTORS = __webpack_require__(5); -var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = __webpack_require__(348); +var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = __webpack_require__(370); -var ArrayBufferViewCore = __webpack_require__(155); +var ArrayBufferViewCore = __webpack_require__(172); -var ArrayBufferModule = __webpack_require__(148); +var ArrayBufferModule = __webpack_require__(165); -var anInstance = __webpack_require__(151); +var anInstance = __webpack_require__(168); -var createPropertyDescriptor = __webpack_require__(8); +var createPropertyDescriptor = __webpack_require__(9); -var createNonEnumerableProperty = __webpack_require__(33); +var createNonEnumerableProperty = __webpack_require__(40); -var isInteger = __webpack_require__(214); +var isIntegralNumber = __webpack_require__(235); -var toLength = __webpack_require__(47); +var toLength = __webpack_require__(58); -var toIndex = __webpack_require__(152); +var toIndex = __webpack_require__(169); -var toOffset = __webpack_require__(349); +var toOffset = __webpack_require__(371); -var toPropertyKey = __webpack_require__(13); +var toPropertyKey = __webpack_require__(15); -var has = __webpack_require__(28); +var hasOwn = __webpack_require__(35); -var classof = __webpack_require__(93); +var classof = __webpack_require__(65); -var isObject = __webpack_require__(15); +var isObject = __webpack_require__(17); -var isSymbol = __webpack_require__(16); +var isSymbol = __webpack_require__(19); -var create = __webpack_require__(55); +var create = __webpack_require__(67); -var setPrototypeOf = __webpack_require__(86); +var isPrototypeOf = __webpack_require__(21); -var getOwnPropertyNames = __webpack_require__(44).f; +var setPrototypeOf = __webpack_require__(101); -var typedArrayFrom = __webpack_require__(351); +var getOwnPropertyNames = (__webpack_require__(52).f); -var forEach = __webpack_require__(64).forEach; +var typedArrayFrom = __webpack_require__(373); -var setSpecies = __webpack_require__(143); +var forEach = (__webpack_require__(79).forEach); -var definePropertyModule = __webpack_require__(34); +var setSpecies = __webpack_require__(160); + +var definePropertyModule = __webpack_require__(41); var getOwnPropertyDescriptorModule = __webpack_require__(4); -var InternalStateModule = __webpack_require__(38); +var InternalStateModule = __webpack_require__(45); -var inheritIfRequired = __webpack_require__(183); +var inheritIfRequired = __webpack_require__(203); var getInternalState = InternalStateModule.get; var setInternalState = InternalStateModule.set; @@ -12582,6 +13631,7 @@ var nativeGetOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f; var round = Math.round; var RangeError = global.RangeError; var ArrayBuffer = ArrayBufferModule.ArrayBuffer; +var ArrayBufferPrototype = ArrayBuffer.prototype; var DataView = ArrayBufferModule.DataView; var NATIVE_ARRAY_BUFFER_VIEWS = ArrayBufferViewCore.NATIVE_ARRAY_BUFFER_VIEWS; var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR; @@ -12594,9 +13644,10 @@ var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT'; var WRONG_LENGTH = 'Wrong length'; var fromList = function (C, list) { + aTypedArrayConstructor(C); var index = 0; var length = list.length; - var result = new (aTypedArrayConstructor(C))(length); + var result = new C(length); while (length > index) result[index] = list[index++]; @@ -12613,11 +13664,11 @@ var addGetter = function (it, key) { var isArrayBuffer = function (it) { var klass; - return it instanceof ArrayBuffer || (klass = classof(it)) == 'ArrayBuffer' || klass == 'SharedArrayBuffer'; + return isPrototypeOf(ArrayBufferPrototype, it) || (klass = classof(it)) == 'ArrayBuffer' || klass == 'SharedArrayBuffer'; }; var isTypedArrayIndex = function (target, key) { - return isTypedArray(target) && !isSymbol(key) && key in target && isInteger(+key) && key >= 0; + return isTypedArray(target) && !isSymbol(key) && key in target && isIntegralNumber(+key) && key >= 0; }; var wrappedGetOwnPropertyDescriptor = function getOwnPropertyDescriptor(target, key) { @@ -12628,8 +13679,8 @@ var wrappedGetOwnPropertyDescriptor = function getOwnPropertyDescriptor(target, var wrappedDefineProperty = function defineProperty(target, key, descriptor) { key = toPropertyKey(key); - if (isTypedArrayIndex(target, key) && isObject(descriptor) && has(descriptor, 'value') && !has(descriptor, 'get') && !has(descriptor, 'set') // TODO: add validation descriptor w/o calling accessors - && !descriptor.configurable && (!has(descriptor, 'writable') || descriptor.writable) && (!has(descriptor, 'enumerable') || descriptor.enumerable)) { + if (isTypedArrayIndex(target, key) && isObject(descriptor) && hasOwn(descriptor, 'value') && !hasOwn(descriptor, 'get') && !hasOwn(descriptor, 'set') // TODO: add validation descriptor w/o calling accessors + && !descriptor.configurable && (!hasOwn(descriptor, 'writable') || descriptor.writable) && (!hasOwn(descriptor, 'enumerable') || descriptor.enumerable)) { target[key] = descriptor.value; return target; } @@ -12691,7 +13742,7 @@ if (DESCRIPTORS) { if (!NATIVE_ARRAY_BUFFER_VIEWS) { TypedArrayConstructor = wrapper(function (that, data, offset, $length) { - anInstance(that, TypedArrayConstructor, CONSTRUCTOR_NAME); + anInstance(that, TypedArrayConstructorPrototype); var index = 0; var byteOffset = 0; var buffer, byteLength, length; @@ -12718,7 +13769,7 @@ if (DESCRIPTORS) { } else if (isTypedArray(data)) { return fromList(TypedArrayConstructor, data); } else { - return typedArrayFrom.call(TypedArrayConstructor, data); + return call(typedArrayFrom, TypedArrayConstructor, data); } setInternalState(that, { @@ -12735,12 +13786,12 @@ if (DESCRIPTORS) { TypedArrayConstructorPrototype = TypedArrayConstructor.prototype = create(TypedArrayPrototype); } else if (TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS) { TypedArrayConstructor = wrapper(function (dummy, data, typedArrayOffset, $length) { - anInstance(dummy, TypedArrayConstructor, CONSTRUCTOR_NAME); + anInstance(dummy, TypedArrayConstructorPrototype); return inheritIfRequired(function () { if (!isObject(data)) return new NativeTypedArrayConstructor(toIndex(data)); if (isArrayBuffer(data)) return $length !== undefined ? new NativeTypedArrayConstructor(data, toOffset(typedArrayOffset, BYTES), $length) : typedArrayOffset !== undefined ? new NativeTypedArrayConstructor(data, toOffset(typedArrayOffset, BYTES)) : new NativeTypedArrayConstructor(data); if (isTypedArray(data)) return fromList(TypedArrayConstructor, data); - return typedArrayFrom.call(TypedArrayConstructor, data); + return call(typedArrayFrom, TypedArrayConstructor, data); }(), dummy, TypedArrayConstructor); }); if (setPrototypeOf) setPrototypeOf(TypedArrayConstructor, TypedArray); @@ -12784,7 +13835,7 @@ if (DESCRIPTORS) { }; /***/ }), -/* 348 */ +/* 370 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /* eslint-disable no-new -- required for testing */ @@ -12792,9 +13843,9 @@ var global = __webpack_require__(3); var fails = __webpack_require__(6); -var checkCorrectnessOfIteration = __webpack_require__(117); +var checkCorrectnessOfIteration = __webpack_require__(134); -var NATIVE_ARRAY_BUFFER_VIEWS = __webpack_require__(155).NATIVE_ARRAY_BUFFER_VIEWS; +var NATIVE_ARRAY_BUFFER_VIEWS = (__webpack_require__(172).NATIVE_ARRAY_BUFFER_VIEWS); var ArrayBuffer = global.ArrayBuffer; var Int8Array = global.Int8Array; @@ -12813,10 +13864,14 @@ module.exports = !NATIVE_ARRAY_BUFFER_VIEWS || !fails(function () { }); /***/ }), -/* 349 */ +/* 371 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var toPositiveInteger = __webpack_require__(350); +var global = __webpack_require__(3); + +var toPositiveInteger = __webpack_require__(372); + +var RangeError = global.RangeError; module.exports = function (it, BYTES) { var offset = toPositiveInteger(it); @@ -12825,38 +13880,47 @@ module.exports = function (it, BYTES) { }; /***/ }), -/* 350 */ +/* 372 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var toInteger = __webpack_require__(48); +var global = __webpack_require__(3); + +var toIntegerOrInfinity = __webpack_require__(56); + +var RangeError = global.RangeError; module.exports = function (it) { - var result = toInteger(it); + var result = toIntegerOrInfinity(it); if (result < 0) throw RangeError("The argument can't be less than 0"); return result; }; /***/ }), -/* 351 */ +/* 373 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var toObject = __webpack_require__(29); +var bind = __webpack_require__(80); -var toLength = __webpack_require__(47); +var call = __webpack_require__(7); -var getIterator = __webpack_require__(91); +var aConstructor = __webpack_require__(175); -var getIteratorMethod = __webpack_require__(92); +var toObject = __webpack_require__(36); -var isArrayIteratorMethod = __webpack_require__(89); +var lengthOfArrayLike = __webpack_require__(57); -var bind = __webpack_require__(65); +var getIterator = __webpack_require__(108); -var aTypedArrayConstructor = __webpack_require__(155).aTypedArrayConstructor; +var getIteratorMethod = __webpack_require__(109); + +var isArrayIteratorMethod = __webpack_require__(106); + +var aTypedArrayConstructor = (__webpack_require__(172).aTypedArrayConstructor); module.exports = function from(source /* , mapfn, thisArg */ ) { + var C = aConstructor(this); var O = toObject(source); var argumentsLength = arguments.length; var mapfn = argumentsLength > 1 ? arguments[1] : undefined; @@ -12864,22 +13928,22 @@ module.exports = function from(source var iteratorMethod = getIteratorMethod(O); var i, length, result, step, iterator, next; - if (iteratorMethod != undefined && !isArrayIteratorMethod(iteratorMethod)) { + if (iteratorMethod && !isArrayIteratorMethod(iteratorMethod)) { iterator = getIterator(O, iteratorMethod); next = iterator.next; O = []; - while (!(step = next.call(iterator)).done) { + while (!(step = call(next, iterator)).done) { O.push(step.value); } } if (mapping && argumentsLength > 2) { - mapfn = bind(mapfn, arguments[2], 2); + mapfn = bind(mapfn, arguments[2]); } - length = toLength(O.length); - result = new (aTypedArrayConstructor(this))(length); + length = lengthOfArrayLike(O); + result = new (aTypedArrayConstructor(C))(length); for (i = 0; length > i; i++) { result[i] = mapping ? mapfn(O[i], i) : O[i]; @@ -12889,10 +13953,10 @@ module.exports = function from(source }; /***/ }), -/* 352 */ +/* 374 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var createTypedArrayConstructor = __webpack_require__(347); // `Float64Array` constructor +var createTypedArrayConstructor = __webpack_require__(369); // `Float64Array` constructor // https://tc39.es/ecma262/#sec-typedarray-objects @@ -12903,10 +13967,10 @@ createTypedArrayConstructor('Float64', function (init) { }); /***/ }), -/* 353 */ +/* 375 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var createTypedArrayConstructor = __webpack_require__(347); // `Int8Array` constructor +var createTypedArrayConstructor = __webpack_require__(369); // `Int8Array` constructor // https://tc39.es/ecma262/#sec-typedarray-objects @@ -12917,10 +13981,10 @@ createTypedArrayConstructor('Int8', function (init) { }); /***/ }), -/* 354 */ +/* 376 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var createTypedArrayConstructor = __webpack_require__(347); // `Int16Array` constructor +var createTypedArrayConstructor = __webpack_require__(369); // `Int16Array` constructor // https://tc39.es/ecma262/#sec-typedarray-objects @@ -12931,10 +13995,10 @@ createTypedArrayConstructor('Int16', function (init) { }); /***/ }), -/* 355 */ +/* 377 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var createTypedArrayConstructor = __webpack_require__(347); // `Int32Array` constructor +var createTypedArrayConstructor = __webpack_require__(369); // `Int32Array` constructor // https://tc39.es/ecma262/#sec-typedarray-objects @@ -12945,10 +14009,10 @@ createTypedArrayConstructor('Int32', function (init) { }); /***/ }), -/* 356 */ +/* 378 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var createTypedArrayConstructor = __webpack_require__(347); // `Uint8Array` constructor +var createTypedArrayConstructor = __webpack_require__(369); // `Uint8Array` constructor // https://tc39.es/ecma262/#sec-typedarray-objects @@ -12959,10 +14023,10 @@ createTypedArrayConstructor('Uint8', function (init) { }); /***/ }), -/* 357 */ +/* 379 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var createTypedArrayConstructor = __webpack_require__(347); // `Uint8ClampedArray` constructor +var createTypedArrayConstructor = __webpack_require__(369); // `Uint8ClampedArray` constructor // https://tc39.es/ecma262/#sec-typedarray-objects @@ -12973,10 +14037,10 @@ createTypedArrayConstructor('Uint8', function (init) { }, true); /***/ }), -/* 358 */ +/* 380 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var createTypedArrayConstructor = __webpack_require__(347); // `Uint16Array` constructor +var createTypedArrayConstructor = __webpack_require__(369); // `Uint16Array` constructor // https://tc39.es/ecma262/#sec-typedarray-objects @@ -12987,10 +14051,10 @@ createTypedArrayConstructor('Uint16', function (init) { }); /***/ }), -/* 359 */ +/* 381 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { -var createTypedArrayConstructor = __webpack_require__(347); // `Uint32Array` constructor +var createTypedArrayConstructor = __webpack_require__(369); // `Uint32Array` constructor // https://tc39.es/ecma262/#sec-typedarray-objects @@ -13001,16 +14065,44 @@ createTypedArrayConstructor('Uint32', function (init) { }); /***/ }), -/* 360 */ +/* 382 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var ArrayBufferViewCore = __webpack_require__(155); +var ArrayBufferViewCore = __webpack_require__(172); -var $copyWithin = __webpack_require__(100); +var lengthOfArrayLike = __webpack_require__(57); +var toIntegerOrInfinity = __webpack_require__(56); + +var aTypedArray = ArrayBufferViewCore.aTypedArray; +var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.at` method +// https://github.com/tc39/proposal-relative-indexing-method + +exportTypedArrayMethod('at', function at(index) { + var O = aTypedArray(this); + var len = lengthOfArrayLike(O); + var relativeIndex = toIntegerOrInfinity(index); + var k = relativeIndex >= 0 ? relativeIndex : len + relativeIndex; + return k < 0 || k >= len ? undefined : O[k]; +}); + +/***/ }), +/* 383 */ +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { + +"use strict"; + + +var uncurryThis = __webpack_require__(12); + +var ArrayBufferViewCore = __webpack_require__(172); + +var $ArrayCopyWithin = __webpack_require__(118); + +var u$ArrayCopyWithin = uncurryThis($ArrayCopyWithin); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.copyWithin` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.copywithin @@ -13018,19 +14110,19 @@ var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%Ty exportTypedArrayMethod('copyWithin', function copyWithin(target, start /* , end */ ) { - return $copyWithin.call(aTypedArray(this), target, start, arguments.length > 2 ? arguments[2] : undefined); + return u$ArrayCopyWithin(aTypedArray(this), target, start, arguments.length > 2 ? arguments[2] : undefined); }); /***/ }), -/* 361 */ +/* 384 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var ArrayBufferViewCore = __webpack_require__(155); +var ArrayBufferViewCore = __webpack_require__(172); -var $every = __webpack_require__(64).every; +var $every = (__webpack_require__(79).every); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.every` method @@ -13043,39 +14135,41 @@ exportTypedArrayMethod('every', function every(callbackfn }); /***/ }), -/* 362 */ +/* 385 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var ArrayBufferViewCore = __webpack_require__(155); +var ArrayBufferViewCore = __webpack_require__(172); -var $fill = __webpack_require__(105); +var call = __webpack_require__(7); + +var $fill = __webpack_require__(122); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.fill` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.fill -// eslint-disable-next-line no-unused-vars -- required for `.length` exportTypedArrayMethod('fill', function fill(value /* , start, end */ ) { - return $fill.apply(aTypedArray(this), arguments); + var length = arguments.length; + return call($fill, aTypedArray(this), value, length > 1 ? arguments[1] : undefined, length > 2 ? arguments[2] : undefined); }); /***/ }), -/* 363 */ +/* 386 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var ArrayBufferViewCore = __webpack_require__(155); +var ArrayBufferViewCore = __webpack_require__(172); -var $filter = __webpack_require__(64).filter; +var $filter = (__webpack_require__(79).filter); -var fromSpeciesAndList = __webpack_require__(364); +var fromSpeciesAndList = __webpack_require__(387); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.filter` method @@ -13089,19 +14183,19 @@ exportTypedArrayMethod('filter', function filter(callbackfn }); /***/ }), -/* 364 */ +/* 387 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var arrayFromConstructorAndList = __webpack_require__(365); +var arrayFromConstructorAndList = __webpack_require__(388); -var typedArraySpeciesConstructor = __webpack_require__(366); +var typedArraySpeciesConstructor = __webpack_require__(389); module.exports = function (instance, list) { return arrayFromConstructorAndList(typedArraySpeciesConstructor(instance), list); }; /***/ }), -/* 365 */ +/* 388 */ /***/ ((module) => { module.exports = function (Constructor, list) { @@ -13115,12 +14209,12 @@ module.exports = function (Constructor, list) { }; /***/ }), -/* 366 */ +/* 389 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var ArrayBufferViewCore = __webpack_require__(155); +var ArrayBufferViewCore = __webpack_require__(172); -var speciesConstructor = __webpack_require__(157); +var speciesConstructor = __webpack_require__(174); var TYPED_ARRAY_CONSTRUCTOR = ArrayBufferViewCore.TYPED_ARRAY_CONSTRUCTOR; var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor; // a part of `TypedArraySpeciesCreate` abstract operation @@ -13131,15 +14225,15 @@ module.exports = function (originalArray) { }; /***/ }), -/* 367 */ +/* 390 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var ArrayBufferViewCore = __webpack_require__(155); +var ArrayBufferViewCore = __webpack_require__(172); -var $find = __webpack_require__(64).find; +var $find = (__webpack_require__(79).find); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.find` method @@ -13152,15 +14246,15 @@ exportTypedArrayMethod('find', function find(predicate }); /***/ }), -/* 368 */ +/* 391 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var ArrayBufferViewCore = __webpack_require__(155); +var ArrayBufferViewCore = __webpack_require__(172); -var $findIndex = __webpack_require__(64).findIndex; +var $findIndex = (__webpack_require__(79).findIndex); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.findIndex` method @@ -13173,15 +14267,15 @@ exportTypedArrayMethod('findIndex', function findIndex(predicate }); /***/ }), -/* 369 */ +/* 392 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var ArrayBufferViewCore = __webpack_require__(155); +var ArrayBufferViewCore = __webpack_require__(172); -var $forEach = __webpack_require__(64).forEach; +var $forEach = (__webpack_require__(79).forEach); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.forEach` method @@ -13194,32 +14288,32 @@ exportTypedArrayMethod('forEach', function forEach(callbackfn }); /***/ }), -/* 370 */ +/* 393 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = __webpack_require__(348); +var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = __webpack_require__(370); -var exportTypedArrayStaticMethod = __webpack_require__(155).exportTypedArrayStaticMethod; +var exportTypedArrayStaticMethod = (__webpack_require__(172).exportTypedArrayStaticMethod); -var typedArrayFrom = __webpack_require__(351); // `%TypedArray%.from` method +var typedArrayFrom = __webpack_require__(373); // `%TypedArray%.from` method // https://tc39.es/ecma262/#sec-%typedarray%.from exportTypedArrayStaticMethod('from', typedArrayFrom, TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS); /***/ }), -/* 371 */ +/* 394 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var ArrayBufferViewCore = __webpack_require__(155); +var ArrayBufferViewCore = __webpack_require__(172); -var $includes = __webpack_require__(46).includes; +var $includes = (__webpack_require__(54).includes); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.includes` method @@ -13232,15 +14326,15 @@ exportTypedArrayMethod('includes', function includes(searchElement }); /***/ }), -/* 372 */ +/* 395 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var ArrayBufferViewCore = __webpack_require__(155); +var ArrayBufferViewCore = __webpack_require__(172); -var $indexOf = __webpack_require__(46).indexOf; +var $indexOf = (__webpack_require__(54).indexOf); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.indexOf` method @@ -13253,7 +14347,7 @@ exportTypedArrayMethod('indexOf', function indexOf(searchElement }); /***/ }), -/* 373 */ +/* 396 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -13261,96 +14355,103 @@ exportTypedArrayMethod('indexOf', function indexOf(searchElement var global = __webpack_require__(3); -var ArrayBufferViewCore = __webpack_require__(155); +var uncurryThis = __webpack_require__(12); -var ArrayIterators = __webpack_require__(121); +var PROPER_FUNCTION_NAME = (__webpack_require__(49).PROPER); -var wellKnownSymbol = __webpack_require__(23); +var ArrayBufferViewCore = __webpack_require__(172); + +var ArrayIterators = __webpack_require__(138); + +var wellKnownSymbol = __webpack_require__(30); var ITERATOR = wellKnownSymbol('iterator'); var Uint8Array = global.Uint8Array; -var arrayValues = ArrayIterators.values; -var arrayKeys = ArrayIterators.keys; -var arrayEntries = ArrayIterators.entries; +var arrayValues = uncurryThis(ArrayIterators.values); +var arrayKeys = uncurryThis(ArrayIterators.keys); +var arrayEntries = uncurryThis(ArrayIterators.entries); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; var nativeTypedArrayIterator = Uint8Array && Uint8Array.prototype[ITERATOR]; -var CORRECT_ITER_NAME = !!nativeTypedArrayIterator && (nativeTypedArrayIterator.name == 'values' || nativeTypedArrayIterator.name == undefined); +var PROPER_ARRAY_VALUES_NAME = !!nativeTypedArrayIterator && nativeTypedArrayIterator.name === 'values'; var typedArrayValues = function values() { - return arrayValues.call(aTypedArray(this)); + return arrayValues(aTypedArray(this)); }; // `%TypedArray%.prototype.entries` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.entries exportTypedArrayMethod('entries', function entries() { - return arrayEntries.call(aTypedArray(this)); + return arrayEntries(aTypedArray(this)); }); // `%TypedArray%.prototype.keys` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.keys exportTypedArrayMethod('keys', function keys() { - return arrayKeys.call(aTypedArray(this)); + return arrayKeys(aTypedArray(this)); }); // `%TypedArray%.prototype.values` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.values -exportTypedArrayMethod('values', typedArrayValues, !CORRECT_ITER_NAME); // `%TypedArray%.prototype[@@iterator]` method +exportTypedArrayMethod('values', typedArrayValues, PROPER_FUNCTION_NAME && !PROPER_ARRAY_VALUES_NAME); // `%TypedArray%.prototype[@@iterator]` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype-@@iterator -exportTypedArrayMethod(ITERATOR, typedArrayValues, !CORRECT_ITER_NAME); +exportTypedArrayMethod(ITERATOR, typedArrayValues, PROPER_FUNCTION_NAME && !PROPER_ARRAY_VALUES_NAME); /***/ }), -/* 374 */ +/* 397 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var ArrayBufferViewCore = __webpack_require__(155); +var ArrayBufferViewCore = __webpack_require__(172); + +var uncurryThis = __webpack_require__(12); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; -var $join = [].join; // `%TypedArray%.prototype.join` method +var $join = uncurryThis([].join); // `%TypedArray%.prototype.join` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.join -// eslint-disable-next-line no-unused-vars -- required for `.length` exportTypedArrayMethod('join', function join(separator) { - return $join.apply(aTypedArray(this), arguments); + return $join(aTypedArray(this), separator); }); /***/ }), -/* 375 */ +/* 398 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var ArrayBufferViewCore = __webpack_require__(155); +var ArrayBufferViewCore = __webpack_require__(172); -var $lastIndexOf = __webpack_require__(127); +var apply = __webpack_require__(62); + +var $lastIndexOf = __webpack_require__(144); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.lastIndexOf` method // https://tc39.es/ecma262/#sec-%typedarray%.prototype.lastindexof -// eslint-disable-next-line no-unused-vars -- required for `.length` exportTypedArrayMethod('lastIndexOf', function lastIndexOf(searchElement /* , fromIndex */ ) { - return $lastIndexOf.apply(aTypedArray(this), arguments); + var length = arguments.length; + return apply($lastIndexOf, aTypedArray(this), length > 1 ? [searchElement, arguments[1]] : [searchElement]); }); /***/ }), -/* 376 */ +/* 399 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var ArrayBufferViewCore = __webpack_require__(155); +var ArrayBufferViewCore = __webpack_require__(172); -var $map = __webpack_require__(64).map; +var $map = (__webpack_require__(79).map); -var typedArraySpeciesConstructor = __webpack_require__(366); +var typedArraySpeciesConstructor = __webpack_require__(389); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.map` method @@ -13365,21 +14466,23 @@ exportTypedArrayMethod('map', function map(mapfn }); /***/ }), -/* 377 */ +/* 400 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var ArrayBufferViewCore = __webpack_require__(155); +var ArrayBufferViewCore = __webpack_require__(172); -var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = __webpack_require__(348); +var TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS = __webpack_require__(370); var aTypedArrayConstructor = ArrayBufferViewCore.aTypedArrayConstructor; var exportTypedArrayStaticMethod = ArrayBufferViewCore.exportTypedArrayStaticMethod; // `%TypedArray%.of` method // https://tc39.es/ecma262/#sec-%typedarray%.of -exportTypedArrayStaticMethod('of', function of() { +exportTypedArrayStaticMethod('of', function + /* ...items */ +of() { var index = 0; var length = arguments.length; var result = new (aTypedArrayConstructor(this))(length); @@ -13390,15 +14493,15 @@ exportTypedArrayStaticMethod('of', function of() { }, TYPED_ARRAYS_CONSTRUCTORS_REQUIRES_WRAPPERS); /***/ }), -/* 378 */ +/* 401 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var ArrayBufferViewCore = __webpack_require__(155); +var ArrayBufferViewCore = __webpack_require__(172); -var $reduce = __webpack_require__(131).left; +var $reduce = (__webpack_require__(148).left); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.reduce` method @@ -13407,19 +14510,20 @@ var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%Ty exportTypedArrayMethod('reduce', function reduce(callbackfn /* , initialValue */ ) { - return $reduce(aTypedArray(this), callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); + var length = arguments.length; + return $reduce(aTypedArray(this), callbackfn, length, length > 1 ? arguments[1] : undefined); }); /***/ }), -/* 379 */ +/* 402 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var ArrayBufferViewCore = __webpack_require__(155); +var ArrayBufferViewCore = __webpack_require__(172); -var $reduceRight = __webpack_require__(131).right; +var $reduceRight = (__webpack_require__(148).right); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.reduceRicht` method @@ -13428,17 +14532,18 @@ var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%Ty exportTypedArrayMethod('reduceRight', function reduceRight(callbackfn /* , initialValue */ ) { - return $reduceRight(aTypedArray(this), callbackfn, arguments.length, arguments.length > 1 ? arguments[1] : undefined); + var length = arguments.length; + return $reduceRight(aTypedArray(this), callbackfn, length, length > 1 ? arguments[1] : undefined); }); /***/ }), -/* 380 */ +/* 403 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var ArrayBufferViewCore = __webpack_require__(155); +var ArrayBufferViewCore = __webpack_require__(172); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; @@ -13462,22 +14567,25 @@ exportTypedArrayMethod('reverse', function reverse() { }); /***/ }), -/* 381 */ +/* 404 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var ArrayBufferViewCore = __webpack_require__(155); +var global = __webpack_require__(3); -var toLength = __webpack_require__(47); +var ArrayBufferViewCore = __webpack_require__(172); -var toOffset = __webpack_require__(349); +var lengthOfArrayLike = __webpack_require__(57); -var toObject = __webpack_require__(29); +var toOffset = __webpack_require__(371); + +var toObject = __webpack_require__(36); var fails = __webpack_require__(6); +var RangeError = global.RangeError; var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; var FORCED = fails(function () { @@ -13493,7 +14601,7 @@ exportTypedArrayMethod('set', function set(arrayLike var offset = toOffset(arguments.length > 1 ? arguments[1] : undefined, 1); var length = this.length; var src = toObject(arrayLike); - var len = toLength(src.length); + var len = lengthOfArrayLike(src); var index = 0; if (len + offset > length) throw RangeError('Wrong length'); @@ -13501,21 +14609,22 @@ exportTypedArrayMethod('set', function set(arrayLike }, FORCED); /***/ }), -/* 382 */ +/* 405 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var ArrayBufferViewCore = __webpack_require__(155); +var ArrayBufferViewCore = __webpack_require__(172); -var typedArraySpeciesConstructor = __webpack_require__(366); +var typedArraySpeciesConstructor = __webpack_require__(389); var fails = __webpack_require__(6); +var arraySlice = __webpack_require__(74); + var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; -var $slice = [].slice; var FORCED = fails(function () { // eslint-disable-next-line es/no-typed-arrays -- required for testing new Int8Array(1).slice(); @@ -13523,7 +14632,7 @@ var FORCED = fails(function () { // https://tc39.es/ecma262/#sec-%typedarray%.prototype.slice exportTypedArrayMethod('slice', function slice(start, end) { - var list = $slice.call(aTypedArray(this), start, end); + var list = arraySlice(aTypedArray(this), start, end); var C = typedArraySpeciesConstructor(this); var index = 0; var length = list.length; @@ -13535,15 +14644,15 @@ exportTypedArrayMethod('slice', function slice(start, end) { }, FORCED); /***/ }), -/* 383 */ +/* 406 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var ArrayBufferViewCore = __webpack_require__(155); +var ArrayBufferViewCore = __webpack_require__(172); -var $some = __webpack_require__(64).some; +var $some = (__webpack_require__(79).some); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.some` method @@ -13556,43 +14665,44 @@ exportTypedArrayMethod('some', function some(callbackfn }); /***/ }), -/* 384 */ +/* 407 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var ArrayBufferViewCore = __webpack_require__(155); - var global = __webpack_require__(3); +var uncurryThis = __webpack_require__(12); + var fails = __webpack_require__(6); -var aFunction = __webpack_require__(66); +var aCallable = __webpack_require__(27); -var toLength = __webpack_require__(47); +var internalSort = __webpack_require__(155); -var internalSort = __webpack_require__(138); +var ArrayBufferViewCore = __webpack_require__(172); -var FF = __webpack_require__(139); +var FF = __webpack_require__(156); -var IE_OR_EDGE = __webpack_require__(140); +var IE_OR_EDGE = __webpack_require__(157); -var V8 = __webpack_require__(20); +var V8 = __webpack_require__(24); -var WEBKIT = __webpack_require__(141); +var WEBKIT = __webpack_require__(158); +var Array = global.Array; var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; var Uint16Array = global.Uint16Array; -var nativeSort = Uint16Array && Uint16Array.prototype.sort; // WebKit +var un$Sort = Uint16Array && uncurryThis(Uint16Array.prototype.sort); // WebKit -var ACCEPT_INCORRECT_ARGUMENTS = !!nativeSort && !fails(function () { - var array = new Uint16Array(2); - array.sort(null); - array.sort({}); -}); -var STABLE_SORT = !!nativeSort && !fails(function () { +var ACCEPT_INCORRECT_ARGUMENTS = !!un$Sort && !(fails(function () { + un$Sort(new Uint16Array(2), null); +}) && fails(function () { + un$Sort(new Uint16Array(2), {}); +})); +var STABLE_SORT = !!un$Sort && !fails(function () { // feature detection can be too slow, so check engines versions if (V8) return V8 < 74; if (FF) return FF < 67; @@ -13608,7 +14718,7 @@ var STABLE_SORT = !!nativeSort && !fails(function () { expected[index] = index - 2 * mod + 3; } - array.sort(function (a, b) { + un$Sort(array, function (a, b) { return (a / 4 | 0) - (b / 4 | 0); }); @@ -13632,41 +14742,25 @@ var getSortCompare = function (comparefn) { exportTypedArrayMethod('sort', function sort(comparefn) { - var array = this; - if (comparefn !== undefined) aFunction(comparefn); - if (STABLE_SORT) return nativeSort.call(array, comparefn); - aTypedArray(array); - var arrayLength = toLength(array.length); - var items = Array(arrayLength); - var index; - - for (index = 0; index < arrayLength; index++) { - items[index] = array[index]; - } - - items = internalSort(array, getSortCompare(comparefn)); - - for (index = 0; index < arrayLength; index++) { - array[index] = items[index]; - } - - return array; + if (comparefn !== undefined) aCallable(comparefn); + if (STABLE_SORT) return un$Sort(this, comparefn); + return internalSort(aTypedArray(this), getSortCompare(comparefn)); }, !STABLE_SORT || ACCEPT_INCORRECT_ARGUMENTS); /***/ }), -/* 385 */ +/* 408 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var ArrayBufferViewCore = __webpack_require__(155); +var ArrayBufferViewCore = __webpack_require__(172); -var toLength = __webpack_require__(47); +var toLength = __webpack_require__(58); -var toAbsoluteIndex = __webpack_require__(49); +var toAbsoluteIndex = __webpack_require__(55); -var typedArraySpeciesConstructor = __webpack_require__(366); +var typedArraySpeciesConstructor = __webpack_require__(389); var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; // `%TypedArray%.prototype.subarray` method @@ -13681,7 +14775,7 @@ exportTypedArrayMethod('subarray', function subarray(begin, end) { }); /***/ }), -/* 386 */ +/* 409 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -13689,15 +14783,18 @@ exportTypedArrayMethod('subarray', function subarray(begin, end) { var global = __webpack_require__(3); -var ArrayBufferViewCore = __webpack_require__(155); +var apply = __webpack_require__(62); + +var ArrayBufferViewCore = __webpack_require__(172); var fails = __webpack_require__(6); +var arraySlice = __webpack_require__(74); + var Int8Array = global.Int8Array; var aTypedArray = ArrayBufferViewCore.aTypedArray; var exportTypedArrayMethod = ArrayBufferViewCore.exportTypedArrayMethod; -var $toLocaleString = [].toLocaleString; -var $slice = [].slice; // iOS Safari 6.x fails here +var $toLocaleString = [].toLocaleString; // iOS Safari 6.x fails here var TO_LOCALE_STRING_BUG = !!Int8Array && fails(function () { $toLocaleString.call(new Int8Array(1)); @@ -13710,32 +14807,34 @@ var FORCED = fails(function () { // https://tc39.es/ecma262/#sec-%typedarray%.prototype.tolocalestring exportTypedArrayMethod('toLocaleString', function toLocaleString() { - return $toLocaleString.apply(TO_LOCALE_STRING_BUG ? $slice.call(aTypedArray(this)) : aTypedArray(this), arguments); + return apply($toLocaleString, TO_LOCALE_STRING_BUG ? arraySlice(aTypedArray(this)) : aTypedArray(this), arraySlice(arguments)); }, FORCED); /***/ }), -/* 387 */ +/* 410 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var exportTypedArrayMethod = __webpack_require__(155).exportTypedArrayMethod; +var exportTypedArrayMethod = (__webpack_require__(172).exportTypedArrayMethod); var fails = __webpack_require__(6); var global = __webpack_require__(3); +var uncurryThis = __webpack_require__(12); + var Uint8Array = global.Uint8Array; var Uint8ArrayPrototype = Uint8Array && Uint8Array.prototype || {}; var arrayToString = [].toString; -var arrayJoin = [].join; +var join = uncurryThis([].join); if (fails(function () { arrayToString.call({}); })) { arrayToString = function toString() { - return arrayJoin.call(this); + return join(this); }; } @@ -13745,7 +14844,7 @@ var IS_NOT_ARRAY_METHOD = Uint8ArrayPrototype.toString != arrayToString; // `%Ty exportTypedArrayMethod('toString', arrayToString, IS_NOT_ARRAY_METHOD); /***/ }), -/* 388 */ +/* 411 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -13753,9 +14852,14 @@ exportTypedArrayMethod('toString', arrayToString, IS_NOT_ARRAY_METHOD); var $ = __webpack_require__(2); -var toString = __webpack_require__(54); +var uncurryThis = __webpack_require__(12); + +var toString = __webpack_require__(64); var fromCharCode = String.fromCharCode; +var charAt = uncurryThis(''.charAt); +var exec = uncurryThis(/./.exec); +var stringSlice = uncurryThis(''.slice); var hex2 = /^[\da-f]{2}$/i; var hex4 = /^[\da-f]{4}$/i; // `unescape` method // https://tc39.es/ecma262/#sec-unescape-string @@ -13768,25 +14872,25 @@ $({ var result = ''; var length = str.length; var index = 0; - var chr, slice; + var chr, part; while (index < length) { - chr = str.charAt(index++); + chr = charAt(str, index++); if (chr === '%') { - if (str.charAt(index) === 'u') { - slice = str.slice(index + 1, index + 5); + if (charAt(str, index) === 'u') { + part = stringSlice(str, index + 1, index + 5); - if (hex4.test(slice)) { - result += fromCharCode(parseInt(slice, 16)); + if (exec(hex4, part)) { + result += fromCharCode(parseInt(part, 16)); index += 5; continue; } } else { - slice = str.slice(index, index + 2); + part = stringSlice(str, index, index + 2); - if (hex2.test(slice)) { - result += fromCharCode(parseInt(slice, 16)); + if (exec(hex2, part)) { + result += fromCharCode(parseInt(part, 16)); index += 2; continue; } @@ -13801,31 +14905,33 @@ $({ }); /***/ }), -/* 389 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/* 412 */ +/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; var global = __webpack_require__(3); -var redefineAll = __webpack_require__(150); +var uncurryThis = __webpack_require__(12); -var InternalMetadataModule = __webpack_require__(181); +var redefineAll = __webpack_require__(167); -var collection = __webpack_require__(180); +var InternalMetadataModule = __webpack_require__(199); -var collectionWeak = __webpack_require__(390); +var collection = __webpack_require__(198); -var isObject = __webpack_require__(15); +var collectionWeak = __webpack_require__(413); -var enforceIternalState = __webpack_require__(38).enforce; +var isObject = __webpack_require__(17); -var NATIVE_WEAK_MAP = __webpack_require__(39); +var isExtensible = __webpack_require__(200); -var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global; // eslint-disable-next-line es/no-object-isextensible -- safe +var enforceIternalState = (__webpack_require__(45).enforce); -var isExtensible = Object.isExtensible; +var NATIVE_WEAK_MAP = __webpack_require__(46); + +var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global; var InternalWeakMap; var wrapper = function (init) { @@ -13836,7 +14942,7 @@ var wrapper = function (init) { // https://tc39.es/ecma262/#sec-weakmap-constructor -var $WeakMap = module.exports = collection('WeakMap', wrapper, collectionWeak); // IE11 WeakMap frozen keys fix +var $WeakMap = collection('WeakMap', wrapper, collectionWeak); // IE11 WeakMap frozen keys fix // We can't use feature detection because it crash some old IE builds // https://github.com/zloirock/core-js/issues/485 @@ -13844,44 +14950,44 @@ if (NATIVE_WEAK_MAP && IS_IE11) { InternalWeakMap = collectionWeak.getConstructor(wrapper, 'WeakMap', true); InternalMetadataModule.enable(); var WeakMapPrototype = $WeakMap.prototype; - var nativeDelete = WeakMapPrototype['delete']; - var nativeHas = WeakMapPrototype.has; - var nativeGet = WeakMapPrototype.get; - var nativeSet = WeakMapPrototype.set; + var nativeDelete = uncurryThis(WeakMapPrototype['delete']); + var nativeHas = uncurryThis(WeakMapPrototype.has); + var nativeGet = uncurryThis(WeakMapPrototype.get); + var nativeSet = uncurryThis(WeakMapPrototype.set); redefineAll(WeakMapPrototype, { 'delete': function (key) { if (isObject(key) && !isExtensible(key)) { var state = enforceIternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); - return nativeDelete.call(this, key) || state.frozen['delete'](key); + return nativeDelete(this, key) || state.frozen['delete'](key); } - return nativeDelete.call(this, key); + return nativeDelete(this, key); }, has: function has(key) { if (isObject(key) && !isExtensible(key)) { var state = enforceIternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); - return nativeHas.call(this, key) || state.frozen.has(key); + return nativeHas(this, key) || state.frozen.has(key); } - return nativeHas.call(this, key); + return nativeHas(this, key); }, get: function get(key) { if (isObject(key) && !isExtensible(key)) { var state = enforceIternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); - return nativeHas.call(this, key) ? nativeGet.call(this, key) : state.frozen.get(key); + return nativeHas(this, key) ? nativeGet(this, key) : state.frozen.get(key); } - return nativeGet.call(this, key); + return nativeGet(this, key); }, set: function set(key, value) { if (isObject(key) && !isExtensible(key)) { var state = enforceIternalState(this); if (!state.frozen) state.frozen = new InternalWeakMap(); - nativeHas.call(this, key) ? nativeSet.call(this, key, value) : state.frozen.set(key, value); - } else nativeSet.call(this, key, value); + nativeHas(this, key) ? nativeSet(this, key, value) : state.frozen.set(key, value); + } else nativeSet(this, key, value); return this; } @@ -13889,34 +14995,37 @@ if (NATIVE_WEAK_MAP && IS_IE11) { } /***/ }), -/* 390 */ +/* 413 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var redefineAll = __webpack_require__(150); +var uncurryThis = __webpack_require__(12); -var getWeakData = __webpack_require__(181).getWeakData; +var redefineAll = __webpack_require__(167); -var anObject = __webpack_require__(35); +var getWeakData = (__webpack_require__(199).getWeakData); -var isObject = __webpack_require__(15); +var anObject = __webpack_require__(42); -var anInstance = __webpack_require__(151); +var isObject = __webpack_require__(17); -var iterate = __webpack_require__(88); +var anInstance = __webpack_require__(168); -var ArrayIterationModule = __webpack_require__(64); +var iterate = __webpack_require__(105); -var $has = __webpack_require__(28); +var ArrayIterationModule = __webpack_require__(79); -var InternalStateModule = __webpack_require__(38); +var hasOwn = __webpack_require__(35); + +var InternalStateModule = __webpack_require__(45); var setInternalState = InternalStateModule.set; var internalStateGetterFor = InternalStateModule.getterFor; var find = ArrayIterationModule.find; var findIndex = ArrayIterationModule.findIndex; +var splice = uncurryThis([].splice); var id = 0; // fallback for uncaught frozen keys var uncaughtFrozenStore = function (store) { @@ -13949,14 +15058,14 @@ UncaughtFrozenStore.prototype = { var index = findIndex(this.entries, function (it) { return it[0] === key; }); - if (~index) this.entries.splice(index, 1); + if (~index) splice(this.entries, index, 1); return !!~index; } }; module.exports = { getConstructor: function (wrapper, CONSTRUCTOR_NAME, IS_MAP, ADDER) { - var C = wrapper(function (that, iterable) { - anInstance(that, C, CONSTRUCTOR_NAME); + var Constructor = wrapper(function (that, iterable) { + anInstance(that, Prototype); setInternalState(that, { type: CONSTRUCTOR_NAME, id: id++, @@ -13967,6 +15076,7 @@ module.exports = { AS_ENTRIES: IS_MAP }); }); + var Prototype = Constructor.prototype; var getInternalState = internalStateGetterFor(CONSTRUCTOR_NAME); var define = function (that, key, value) { @@ -13976,7 +15086,7 @@ module.exports = { return that; }; - redefineAll(C.prototype, { + redefineAll(Prototype, { // `{ WeakMap, WeakSet }.prototype.delete(key)` methods // https://tc39.es/ecma262/#sec-weakmap.prototype.delete // https://tc39.es/ecma262/#sec-weakset.prototype.delete @@ -13985,7 +15095,7 @@ module.exports = { if (!isObject(key)) return false; var data = getWeakData(key); if (data === true) return uncaughtFrozenStore(state)['delete'](key); - return data && $has(data, state.id) && delete data[state.id]; + return data && hasOwn(data, state.id) && delete data[state.id]; }, // `{ WeakMap, WeakSet }.prototype.has(key)` methods // https://tc39.es/ecma262/#sec-weakmap.prototype.has @@ -13995,10 +15105,10 @@ module.exports = { if (!isObject(key)) return false; var data = getWeakData(key); if (data === true) return uncaughtFrozenStore(state).has(key); - return data && $has(data, state.id); + return data && hasOwn(data, state.id); } }); - redefineAll(C.prototype, IS_MAP ? { + redefineAll(Prototype, IS_MAP ? { // `WeakMap.prototype.get(key)` method // https://tc39.es/ecma262/#sec-weakmap.prototype.get get: function get(key) { @@ -14022,20 +15132,20 @@ module.exports = { return define(this, value, true); } }); - return C; + return Constructor; } }; /***/ }), -/* 391 */ +/* 414 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var collection = __webpack_require__(180); +var collection = __webpack_require__(198); -var collectionWeak = __webpack_require__(390); // `WeakSet` constructor +var collectionWeak = __webpack_require__(413); // `WeakSet` constructor // https://tc39.es/ecma262/#sec-weakset-constructor @@ -14046,30 +15156,38 @@ collection('WeakSet', function (init) { }, collectionWeak); /***/ }), -/* 392 */ +/* 415 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var global = __webpack_require__(3); -var DOMIterables = __webpack_require__(393); +var DOMIterables = __webpack_require__(416); -var forEach = __webpack_require__(113); +var DOMTokenListPrototype = __webpack_require__(417); -var createNonEnumerableProperty = __webpack_require__(33); +var forEach = __webpack_require__(130); -for (var COLLECTION_NAME in DOMIterables) { - var Collection = global[COLLECTION_NAME]; - var CollectionPrototype = Collection && Collection.prototype; // some Chrome versions have non-configurable methods on DOMTokenList +var createNonEnumerableProperty = __webpack_require__(40); +var handlePrototype = function (CollectionPrototype) { + // some Chrome versions have non-configurable methods on DOMTokenList if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try { createNonEnumerableProperty(CollectionPrototype, 'forEach', forEach); } catch (error) { CollectionPrototype.forEach = forEach; } +}; + +for (var COLLECTION_NAME in DOMIterables) { + if (DOMIterables[COLLECTION_NAME]) { + handlePrototype(global[COLLECTION_NAME] && global[COLLECTION_NAME].prototype); + } } +handlePrototype(DOMTokenListPrototype); + /***/ }), -/* 393 */ +/* 416 */ /***/ ((module) => { // iterable DOM collections @@ -14109,27 +15227,37 @@ module.exports = { }; /***/ }), -/* 394 */ +/* 417 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +// in old WebKit versions, `element.classList` is not an instance of global `DOMTokenList` +var documentCreateElement = __webpack_require__(39); + +var classList = documentCreateElement('span').classList; +var DOMTokenListPrototype = classList && classList.constructor && classList.constructor.prototype; +module.exports = DOMTokenListPrototype === Object.prototype ? undefined : DOMTokenListPrototype; + +/***/ }), +/* 418 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var global = __webpack_require__(3); -var DOMIterables = __webpack_require__(393); +var DOMIterables = __webpack_require__(416); -var ArrayIteratorMethods = __webpack_require__(121); +var DOMTokenListPrototype = __webpack_require__(417); -var createNonEnumerableProperty = __webpack_require__(33); +var ArrayIteratorMethods = __webpack_require__(138); -var wellKnownSymbol = __webpack_require__(23); +var createNonEnumerableProperty = __webpack_require__(40); + +var wellKnownSymbol = __webpack_require__(30); var ITERATOR = wellKnownSymbol('iterator'); var TO_STRING_TAG = wellKnownSymbol('toStringTag'); var ArrayValues = ArrayIteratorMethods.values; -for (var COLLECTION_NAME in DOMIterables) { - var Collection = global[COLLECTION_NAME]; - var CollectionPrototype = Collection && Collection.prototype; - +var handlePrototype = function (CollectionPrototype, COLLECTION_NAME) { if (CollectionPrototype) { // some Chrome versions have non-configurable methods on DOMTokenList if (CollectionPrototype[ITERATOR] !== ArrayValues) try { @@ -14151,17 +15279,23 @@ for (var COLLECTION_NAME in DOMIterables) { } } } +}; + +for (var COLLECTION_NAME in DOMIterables) { + handlePrototype(global[COLLECTION_NAME] && global[COLLECTION_NAME].prototype, COLLECTION_NAME); } +handlePrototype(DOMTokenListPrototype, 'DOMTokenList'); + /***/ }), -/* 395 */ +/* 419 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); var global = __webpack_require__(3); -var task = __webpack_require__(260); +var task = __webpack_require__(281); var FORCED = !global.setImmediate || !global.clearImmediate; // http://w3c.github.io/setImmediate/ @@ -14180,16 +15314,16 @@ $({ }); /***/ }), -/* 396 */ +/* 420 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); var global = __webpack_require__(3); -var microtask = __webpack_require__(262); +var microtask = __webpack_require__(283); -var IS_NODE = __webpack_require__(132); +var IS_NODE = __webpack_require__(149); var process = global.process; // `queueMicrotask` method // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#dom-queuemicrotask @@ -14206,27 +15340,33 @@ $({ }); /***/ }), -/* 397 */ +/* 421 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { var $ = __webpack_require__(2); var global = __webpack_require__(3); -var userAgent = __webpack_require__(21); +var apply = __webpack_require__(62); + +var isCallable = __webpack_require__(18); + +var userAgent = __webpack_require__(25); + +var arraySlice = __webpack_require__(74); -var slice = [].slice; var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check +var Function = global.Function; + var wrap = function (scheduler) { return function (handler, timeout /* , ...arguments */ ) { var boundArgs = arguments.length > 2; - var args = boundArgs ? slice.call(arguments, 2) : undefined; + var args = boundArgs ? arraySlice(arguments, 2) : undefined; return scheduler(boundArgs ? function () { - // eslint-disable-next-line no-new-func -- spec requirement - (typeof handler == 'function' ? handler : Function(handler)).apply(this, args); + apply(isCallable(handler) ? handler : Function(handler), this, args); } : handler, timeout); }; }; // ie9- setTimeout & setInterval additional parameters fix @@ -14247,108 +15387,101 @@ $({ }); /***/ }), -/* 398 */ +/* 422 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env` -__webpack_require__(309); +__webpack_require__(331); var $ = __webpack_require__(2); var DESCRIPTORS = __webpack_require__(5); -var USE_NATIVE_URL = __webpack_require__(399); +var USE_NATIVE_URL = __webpack_require__(423); var global = __webpack_require__(3); -var defineProperties = __webpack_require__(56); +var bind = __webpack_require__(80); -var redefine = __webpack_require__(36); +var uncurryThis = __webpack_require__(12); -var anInstance = __webpack_require__(151); +var defineProperties = __webpack_require__(68); -var has = __webpack_require__(28); +var redefine = __webpack_require__(43); -var assign = __webpack_require__(227); +var anInstance = __webpack_require__(168); -var arrayFrom = __webpack_require__(115); +var hasOwn = __webpack_require__(35); -var codeAt = __webpack_require__(303).codeAt; +var assign = __webpack_require__(247); -var toASCII = __webpack_require__(400); +var arrayFrom = __webpack_require__(132); -var $toString = __webpack_require__(54); +var arraySlice = __webpack_require__(72); -var setToStringTag = __webpack_require__(63); +var codeAt = (__webpack_require__(325).codeAt); -var URLSearchParamsModule = __webpack_require__(401); +var toASCII = __webpack_require__(424); -var InternalStateModule = __webpack_require__(38); +var $toString = __webpack_require__(64); + +var setToStringTag = __webpack_require__(78); + +var URLSearchParamsModule = __webpack_require__(425); + +var InternalStateModule = __webpack_require__(45); -var NativeURL = global.URL; -var URLSearchParams = URLSearchParamsModule.URLSearchParams; -var getInternalSearchParamsState = URLSearchParamsModule.getState; var setInternalState = InternalStateModule.set; var getInternalURLState = InternalStateModule.getterFor('URL'); +var URLSearchParams = URLSearchParamsModule.URLSearchParams; +var getInternalSearchParamsState = URLSearchParamsModule.getState; +var NativeURL = global.URL; +var TypeError = global.TypeError; +var parseInt = global.parseInt; var floor = Math.floor; var pow = Math.pow; +var charAt = uncurryThis(''.charAt); +var exec = uncurryThis(/./.exec); +var join = uncurryThis([].join); +var numberToString = uncurryThis(1.0.toString); +var pop = uncurryThis([].pop); +var push = uncurryThis([].push); +var replace = uncurryThis(''.replace); +var shift = uncurryThis([].shift); +var split = uncurryThis(''.split); +var stringSlice = uncurryThis(''.slice); +var toLowerCase = uncurryThis(''.toLowerCase); +var unshift = uncurryThis([].unshift); var INVALID_AUTHORITY = 'Invalid authority'; var INVALID_SCHEME = 'Invalid scheme'; var INVALID_HOST = 'Invalid host'; var INVALID_PORT = 'Invalid port'; -var ALPHA = /[A-Za-z]/; // eslint-disable-next-line regexp/no-obscure-range -- safe +var ALPHA = /[a-z]/i; // eslint-disable-next-line regexp/no-obscure-range -- safe -var ALPHANUMERIC = /[\d+-.A-Za-z]/; +var ALPHANUMERIC = /[\d+-.a-z]/i; var DIGIT = /\d/; var HEX_START = /^0x/i; var OCT = /^[0-7]+$/; var DEC = /^\d+$/; -var HEX = /^[\dA-Fa-f]+$/; -/* eslint-disable no-control-regex -- safe */ +var HEX = /^[\da-f]+$/i; +/* eslint-disable regexp/no-control-character -- safe */ var FORBIDDEN_HOST_CODE_POINT = /[\0\t\n\r #%/:<>?@[\\\]^|]/; var FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT = /[\0\t\n\r #/:<>?@[\\\]^|]/; var LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE = /^[\u0000-\u0020]+|[\u0000-\u0020]+$/g; var TAB_AND_NEW_LINE = /[\t\n\r]/g; -/* eslint-enable no-control-regex -- safe */ +/* eslint-enable regexp/no-control-character -- safe */ -var EOF; - -var parseHost = function (url, input) { - var result, codePoints, index; - - if (input.charAt(0) == '[') { - if (input.charAt(input.length - 1) != ']') return INVALID_HOST; - result = parseIPv6(input.slice(1, -1)); - if (!result) return INVALID_HOST; - url.host = result; // opaque host - } else if (!isSpecial(url)) { - if (FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT.test(input)) return INVALID_HOST; - result = ''; - codePoints = arrayFrom(input); - - for (index = 0; index < codePoints.length; index++) { - result += percentEncode(codePoints[index], C0ControlPercentEncodeSet); - } - - url.host = result; - } else { - input = toASCII(input); - if (FORBIDDEN_HOST_CODE_POINT.test(input)) return INVALID_HOST; - result = parseIPv4(input); - if (result === null) return INVALID_HOST; - url.host = result; - } -}; +var EOF; // https://url.spec.whatwg.org/#ipv4-number-parser var parseIPv4 = function (input) { - var parts = input.split('.'); + var parts = split(input, '.'); var partsLength, numbers, index, part, radix, number, ipv4; if (parts.length && parts[parts.length - 1] == '') { - parts.pop(); + parts.length--; } partsLength = parts.length; @@ -14360,19 +15493,19 @@ var parseIPv4 = function (input) { if (part == '') return input; radix = 10; - if (part.length > 1 && part.charAt(0) == '0') { - radix = HEX_START.test(part) ? 16 : 8; - part = part.slice(radix == 8 ? 1 : 2); + if (part.length > 1 && charAt(part, 0) == '0') { + radix = exec(HEX_START, part) ? 16 : 8; + part = stringSlice(part, radix == 8 ? 1 : 2); } if (part === '') { number = 0; } else { - if (!(radix == 10 ? DEC : radix == 8 ? OCT : HEX).test(part)) return input; + if (!exec(radix == 10 ? DEC : radix == 8 ? OCT : HEX, part)) return input; number = parseInt(part, radix); } - numbers.push(number); + push(numbers, number); } for (index = 0; index < partsLength; index++) { @@ -14383,14 +15516,15 @@ var parseIPv4 = function (input) { } else if (number > 255) return null; } - ipv4 = numbers.pop(); + ipv4 = pop(numbers); for (index = 0; index < numbers.length; index++) { ipv4 += numbers[index] * pow(256, 3 - index); } return ipv4; -}; // eslint-disable-next-line max-statements -- TODO +}; // https://url.spec.whatwg.org/#concept-ipv6-parser +// eslint-disable-next-line max-statements -- TODO var parseIPv6 = function (input) { @@ -14400,21 +15534,21 @@ var parseIPv6 = function (input) { var pointer = 0; var value, length, numbersSeen, ipv4Piece, number, swaps, swap; - var char = function () { - return input.charAt(pointer); + var chr = function () { + return charAt(input, pointer); }; - if (char() == ':') { - if (input.charAt(1) != ':') return; + if (chr() == ':') { + if (charAt(input, 1) != ':') return; pointer += 2; pieceIndex++; compress = pieceIndex; } - while (char()) { + while (chr()) { if (pieceIndex == 8) return; - if (char() == ':') { + if (chr() == ':') { if (compress !== null) return; pointer++; pieceIndex++; @@ -14424,29 +15558,29 @@ var parseIPv6 = function (input) { value = length = 0; - while (length < 4 && HEX.test(char())) { - value = value * 16 + parseInt(char(), 16); + while (length < 4 && exec(HEX, chr())) { + value = value * 16 + parseInt(chr(), 16); pointer++; length++; } - if (char() == '.') { + if (chr() == '.') { if (length == 0) return; pointer -= length; if (pieceIndex > 6) return; numbersSeen = 0; - while (char()) { + while (chr()) { ipv4Piece = null; if (numbersSeen > 0) { - if (char() == '.' && numbersSeen < 4) pointer++;else return; + if (chr() == '.' && numbersSeen < 4) pointer++;else return; } - if (!DIGIT.test(char())) return; + if (!exec(DIGIT, chr())) return; - while (DIGIT.test(char())) { - number = parseInt(char(), 10); + while (exec(DIGIT, chr())) { + number = parseInt(chr(), 10); if (ipv4Piece === null) ipv4Piece = number;else if (ipv4Piece == 0) return;else ipv4Piece = ipv4Piece * 10 + number; if (ipv4Piece > 255) return; pointer++; @@ -14459,10 +15593,10 @@ var parseIPv6 = function (input) { if (numbersSeen != 4) return; break; - } else if (char() == ':') { + } else if (chr() == ':') { pointer++; - if (!char()) return; - } else if (char()) return; + if (!chr()) return; + } else if (chr()) return; address[pieceIndex++] = value; } @@ -14509,7 +15643,8 @@ var findLongestZeroSequence = function (ipv6) { } return maxIndex; -}; +}; // https://url.spec.whatwg.org/#host-serializing + var serializeHost = function (host) { var result, index, compress, ignore0; // ipv4 @@ -14518,11 +15653,11 @@ var serializeHost = function (host) { result = []; for (index = 0; index < 4; index++) { - result.unshift(host % 256); + unshift(result, host % 256); host = floor(host / 256); } - return result.join('.'); // ipv6 + return join(result, '.'); // ipv6 } else if (typeof host == 'object') { result = ''; compress = findLongestZeroSequence(host); @@ -14535,7 +15670,7 @@ var serializeHost = function (host) { result += index ? ':' : '::'; ignore0 = true; } else { - result += host[index].toString(16); + result += numberToString(host[index], 16); if (index < 7) result += ':'; } } @@ -14573,10 +15708,11 @@ var userinfoPercentEncodeSet = assign({}, pathPercentEncodeSet, { '|': 1 }); -var percentEncode = function (char, set) { - var code = codeAt(char, 0); - return code > 0x20 && code < 0x7F && !has(set, char) ? char : encodeURIComponent(char); -}; +var percentEncode = function (chr, set) { + var code = codeAt(chr, 0); + return code > 0x20 && code < 0x7F && !hasOwn(set, chr) ? chr : encodeURIComponent(chr); +}; // https://url.spec.whatwg.org/#special-scheme + var specialSchemes = { ftp: 21, @@ -14585,45 +15721,27 @@ var specialSchemes = { https: 443, ws: 80, wss: 443 -}; - -var isSpecial = function (url) { - return has(specialSchemes, url.scheme); -}; - -var includesCredentials = function (url) { - return url.username != '' || url.password != ''; -}; - -var cannotHaveUsernamePasswordPort = function (url) { - return !url.host || url.cannotBeABaseURL || url.scheme == 'file'; -}; +}; // https://url.spec.whatwg.org/#windows-drive-letter var isWindowsDriveLetter = function (string, normalized) { var second; - return string.length == 2 && ALPHA.test(string.charAt(0)) && ((second = string.charAt(1)) == ':' || !normalized && second == '|'); -}; + return string.length == 2 && exec(ALPHA, charAt(string, 0)) && ((second = charAt(string, 1)) == ':' || !normalized && second == '|'); +}; // https://url.spec.whatwg.org/#start-with-a-windows-drive-letter + var startsWithWindowsDriveLetter = function (string) { var third; - return string.length > 1 && isWindowsDriveLetter(string.slice(0, 2)) && (string.length == 2 || (third = string.charAt(2)) === '/' || third === '\\' || third === '?' || third === '#'); -}; + return string.length > 1 && isWindowsDriveLetter(stringSlice(string, 0, 2)) && (string.length == 2 || (third = charAt(string, 2)) === '/' || third === '\\' || third === '?' || third === '#'); +}; // https://url.spec.whatwg.org/#single-dot-path-segment -var shortenURLsPath = function (url) { - var path = url.path; - var pathSize = path.length; - - if (pathSize && (url.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) { - path.pop(); - } -}; var isSingleDot = function (segment) { - return segment === '.' || segment.toLowerCase() === '%2e'; -}; + return segment === '.' || toLowerCase(segment) === '%2e'; +}; // https://url.spec.whatwg.org/#double-dot-path-segment + var isDoubleDot = function (segment) { - segment = segment.toLowerCase(); + segment = toLowerCase(segment); return segment === '..' || segment === '%2e.' || segment === '.%2e' || segment === '%2e%2e'; }; // States: @@ -14648,570 +15766,695 @@ var PATH_START = {}; var PATH = {}; var CANNOT_BE_A_BASE_URL_PATH = {}; var QUERY = {}; -var FRAGMENT = {}; // eslint-disable-next-line max-statements -- TODO +var FRAGMENT = {}; -var parseURL = function (url, input, stateOverride, base) { - var state = stateOverride || SCHEME_START; - var pointer = 0; - var buffer = ''; - var seenAt = false; - var seenBracket = false; - var seenPasswordToken = false; - var codePoints, char, bufferCodePoints, failure; +var URLState = function (url, isBase, base) { + var urlString = $toString(url); + var baseState, failure, searchParams; - if (!stateOverride) { - url.scheme = ''; - url.username = ''; - url.password = ''; - url.host = null; - url.port = null; - url.path = []; - url.query = null; - url.fragment = null; - url.cannotBeABaseURL = false; - input = input.replace(LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, ''); + if (isBase) { + failure = this.parse(urlString); + if (failure) throw TypeError(failure); + this.searchParams = null; + } else { + if (base !== undefined) baseState = new URLState(base, true); + failure = this.parse(urlString, null, baseState); + if (failure) throw TypeError(failure); + searchParams = getInternalSearchParamsState(new URLSearchParams()); + searchParams.bindURL(this); + this.searchParams = searchParams; } +}; - input = input.replace(TAB_AND_NEW_LINE, ''); - codePoints = arrayFrom(input); +URLState.prototype = { + type: 'URL', + // https://url.spec.whatwg.org/#url-parsing + // eslint-disable-next-line max-statements -- TODO + parse: function (input, stateOverride, base) { + var url = this; + var state = stateOverride || SCHEME_START; + var pointer = 0; + var buffer = ''; + var seenAt = false; + var seenBracket = false; + var seenPasswordToken = false; + var codePoints, chr, bufferCodePoints, failure; + input = $toString(input); - while (pointer <= codePoints.length) { - char = codePoints[pointer]; + if (!stateOverride) { + url.scheme = ''; + url.username = ''; + url.password = ''; + url.host = null; + url.port = null; + url.path = []; + url.query = null; + url.fragment = null; + url.cannotBeABaseURL = false; + input = replace(input, LEADING_AND_TRAILING_C0_CONTROL_OR_SPACE, ''); + } - switch (state) { - case SCHEME_START: - if (char && ALPHA.test(char)) { - buffer += char.toLowerCase(); - state = SCHEME; - } else if (!stateOverride) { - state = NO_SCHEME; - continue; - } else return INVALID_SCHEME; + input = replace(input, TAB_AND_NEW_LINE, ''); + codePoints = arrayFrom(input); - break; + while (pointer <= codePoints.length) { + chr = codePoints[pointer]; - case SCHEME: - if (char && (ALPHANUMERIC.test(char) || char == '+' || char == '-' || char == '.')) { - buffer += char.toLowerCase(); - } else if (char == ':') { - if (stateOverride && (isSpecial(url) != has(specialSchemes, buffer) || buffer == 'file' && (includesCredentials(url) || url.port !== null) || url.scheme == 'file' && !url.host)) return; - url.scheme = buffer; + switch (state) { + case SCHEME_START: + if (chr && exec(ALPHA, chr)) { + buffer += toLowerCase(chr); + state = SCHEME; + } else if (!stateOverride) { + state = NO_SCHEME; + continue; + } else return INVALID_SCHEME; - if (stateOverride) { - if (isSpecial(url) && specialSchemes[url.scheme] == url.port) url.port = null; - return; - } - - buffer = ''; - - if (url.scheme == 'file') { - state = FILE; - } else if (isSpecial(url) && base && base.scheme == url.scheme) { - state = SPECIAL_RELATIVE_OR_AUTHORITY; - } else if (isSpecial(url)) { - state = SPECIAL_AUTHORITY_SLASHES; - } else if (codePoints[pointer + 1] == '/') { - state = PATH_OR_AUTHORITY; - pointer++; - } else { - url.cannotBeABaseURL = true; - url.path.push(''); - state = CANNOT_BE_A_BASE_URL_PATH; - } - } else if (!stateOverride) { - buffer = ''; - state = NO_SCHEME; - pointer = 0; - continue; - } else return INVALID_SCHEME; - - break; - - case NO_SCHEME: - if (!base || base.cannotBeABaseURL && char != '#') return INVALID_SCHEME; - - if (base.cannotBeABaseURL && char == '#') { - url.scheme = base.scheme; - url.path = base.path.slice(); - url.query = base.query; - url.fragment = ''; - url.cannotBeABaseURL = true; - state = FRAGMENT; break; - } - state = base.scheme == 'file' ? FILE : RELATIVE; - continue; + case SCHEME: + if (chr && (exec(ALPHANUMERIC, chr) || chr == '+' || chr == '-' || chr == '.')) { + buffer += toLowerCase(chr); + } else if (chr == ':') { + if (stateOverride && (url.isSpecial() != hasOwn(specialSchemes, buffer) || buffer == 'file' && (url.includesCredentials() || url.port !== null) || url.scheme == 'file' && !url.host)) return; + url.scheme = buffer; - case SPECIAL_RELATIVE_OR_AUTHORITY: - if (char == '/' && codePoints[pointer + 1] == '/') { - state = SPECIAL_AUTHORITY_IGNORE_SLASHES; - pointer++; - } else { - state = RELATIVE; - continue; - } - - break; - - case PATH_OR_AUTHORITY: - if (char == '/') { - state = AUTHORITY; - break; - } else { - state = PATH; - continue; - } - - case RELATIVE: - url.scheme = base.scheme; - - if (char == EOF) { - url.username = base.username; - url.password = base.password; - url.host = base.host; - url.port = base.port; - url.path = base.path.slice(); - url.query = base.query; - } else if (char == '/' || char == '\\' && isSpecial(url)) { - state = RELATIVE_SLASH; - } else if (char == '?') { - url.username = base.username; - url.password = base.password; - url.host = base.host; - url.port = base.port; - url.path = base.path.slice(); - url.query = ''; - state = QUERY; - } else if (char == '#') { - url.username = base.username; - url.password = base.password; - url.host = base.host; - url.port = base.port; - url.path = base.path.slice(); - url.query = base.query; - url.fragment = ''; - state = FRAGMENT; - } else { - url.username = base.username; - url.password = base.password; - url.host = base.host; - url.port = base.port; - url.path = base.path.slice(); - url.path.pop(); - state = PATH; - continue; - } - - break; - - case RELATIVE_SLASH: - if (isSpecial(url) && (char == '/' || char == '\\')) { - state = SPECIAL_AUTHORITY_IGNORE_SLASHES; - } else if (char == '/') { - state = AUTHORITY; - } else { - url.username = base.username; - url.password = base.password; - url.host = base.host; - url.port = base.port; - state = PATH; - continue; - } - - break; - - case SPECIAL_AUTHORITY_SLASHES: - state = SPECIAL_AUTHORITY_IGNORE_SLASHES; - if (char != '/' || buffer.charAt(pointer + 1) != '/') continue; - pointer++; - break; - - case SPECIAL_AUTHORITY_IGNORE_SLASHES: - if (char != '/' && char != '\\') { - state = AUTHORITY; - continue; - } - - break; - - case AUTHORITY: - if (char == '@') { - if (seenAt) buffer = '%40' + buffer; - seenAt = true; - bufferCodePoints = arrayFrom(buffer); - - for (var i = 0; i < bufferCodePoints.length; i++) { - var codePoint = bufferCodePoints[i]; - - if (codePoint == ':' && !seenPasswordToken) { - seenPasswordToken = true; - continue; + if (stateOverride) { + if (url.isSpecial() && specialSchemes[url.scheme] == url.port) url.port = null; + return; } - var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet); - if (seenPasswordToken) url.password += encodedCodePoints;else url.username += encodedCodePoints; - } - - buffer = ''; - } else if (char == EOF || char == '/' || char == '?' || char == '#' || char == '\\' && isSpecial(url)) { - if (seenAt && buffer == '') return INVALID_AUTHORITY; - pointer -= arrayFrom(buffer).length + 1; - buffer = ''; - state = HOST; - } else buffer += char; - - break; - - case HOST: - case HOSTNAME: - if (stateOverride && url.scheme == 'file') { - state = FILE_HOST; - continue; - } else if (char == ':' && !seenBracket) { - if (buffer == '') return INVALID_HOST; - failure = parseHost(url, buffer); - if (failure) return failure; - buffer = ''; - state = PORT; - if (stateOverride == HOSTNAME) return; - } else if (char == EOF || char == '/' || char == '?' || char == '#' || char == '\\' && isSpecial(url)) { - if (isSpecial(url) && buffer == '') return INVALID_HOST; - if (stateOverride && buffer == '' && (includesCredentials(url) || url.port !== null)) return; - failure = parseHost(url, buffer); - if (failure) return failure; - buffer = ''; - state = PATH_START; - if (stateOverride) return; - continue; - } else { - if (char == '[') seenBracket = true;else if (char == ']') seenBracket = false; - buffer += char; - } - - break; - - case PORT: - if (DIGIT.test(char)) { - buffer += char; - } else if (char == EOF || char == '/' || char == '?' || char == '#' || char == '\\' && isSpecial(url) || stateOverride) { - if (buffer != '') { - var port = parseInt(buffer, 10); - if (port > 0xFFFF) return INVALID_PORT; - url.port = isSpecial(url) && port === specialSchemes[url.scheme] ? null : port; buffer = ''; - } - if (stateOverride) return; - state = PATH_START; - continue; - } else return INVALID_PORT; + if (url.scheme == 'file') { + state = FILE; + } else if (url.isSpecial() && base && base.scheme == url.scheme) { + state = SPECIAL_RELATIVE_OR_AUTHORITY; + } else if (url.isSpecial()) { + state = SPECIAL_AUTHORITY_SLASHES; + } else if (codePoints[pointer + 1] == '/') { + state = PATH_OR_AUTHORITY; + pointer++; + } else { + url.cannotBeABaseURL = true; + push(url.path, ''); + state = CANNOT_BE_A_BASE_URL_PATH; + } + } else if (!stateOverride) { + buffer = ''; + state = NO_SCHEME; + pointer = 0; + continue; + } else return INVALID_SCHEME; - break; + break; - case FILE: - url.scheme = 'file'; - if (char == '/' || char == '\\') state = FILE_SLASH;else if (base && base.scheme == 'file') { - if (char == EOF) { - url.host = base.host; - url.path = base.path.slice(); - url.query = base.query; - } else if (char == '?') { - url.host = base.host; - url.path = base.path.slice(); - url.query = ''; - state = QUERY; - } else if (char == '#') { - url.host = base.host; - url.path = base.path.slice(); + case NO_SCHEME: + if (!base || base.cannotBeABaseURL && chr != '#') return INVALID_SCHEME; + + if (base.cannotBeABaseURL && chr == '#') { + url.scheme = base.scheme; + url.path = arraySlice(base.path); url.query = base.query; url.fragment = ''; + url.cannotBeABaseURL = true; state = FRAGMENT; - } else { - if (!startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) { - url.host = base.host; - url.path = base.path.slice(); - shortenURLsPath(url); - } + break; + } + state = base.scheme == 'file' ? FILE : RELATIVE; + continue; + + case SPECIAL_RELATIVE_OR_AUTHORITY: + if (chr == '/' && codePoints[pointer + 1] == '/') { + state = SPECIAL_AUTHORITY_IGNORE_SLASHES; + pointer++; + } else { + state = RELATIVE; + continue; + } + + break; + + case PATH_OR_AUTHORITY: + if (chr == '/') { + state = AUTHORITY; + break; + } else { state = PATH; continue; } - } else { - state = PATH; - continue; - } - break; - case FILE_SLASH: - if (char == '/' || char == '\\') { - state = FILE_HOST; - break; - } + case RELATIVE: + url.scheme = base.scheme; - if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(codePoints.slice(pointer).join(''))) { - if (isWindowsDriveLetter(base.path[0], true)) url.path.push(base.path[0]);else url.host = base.host; - } - - state = PATH; - continue; - - case FILE_HOST: - if (char == EOF || char == '/' || char == '\\' || char == '?' || char == '#') { - if (!stateOverride && isWindowsDriveLetter(buffer)) { - state = PATH; - } else if (buffer == '') { - url.host = ''; - if (stateOverride) return; - state = PATH_START; - } else { - failure = parseHost(url, buffer); - if (failure) return failure; - if (url.host == 'localhost') url.host = ''; - if (stateOverride) return; - buffer = ''; - state = PATH_START; - } - - continue; - } else buffer += char; - - break; - - case PATH_START: - if (isSpecial(url)) { - state = PATH; - if (char != '/' && char != '\\') continue; - } else if (!stateOverride && char == '?') { - url.query = ''; - state = QUERY; - } else if (!stateOverride && char == '#') { - url.fragment = ''; - state = FRAGMENT; - } else if (char != EOF) { - state = PATH; - if (char != '/') continue; - } - - break; - - case PATH: - if (char == EOF || char == '/' || char == '\\' && isSpecial(url) || !stateOverride && (char == '?' || char == '#')) { - if (isDoubleDot(buffer)) { - shortenURLsPath(url); - - if (char != '/' && !(char == '\\' && isSpecial(url))) { - url.path.push(''); - } - } else if (isSingleDot(buffer)) { - if (char != '/' && !(char == '\\' && isSpecial(url))) { - url.path.push(''); - } - } else { - if (url.scheme == 'file' && !url.path.length && isWindowsDriveLetter(buffer)) { - if (url.host) url.host = ''; - buffer = buffer.charAt(0) + ':'; // normalize windows drive letter - } - - url.path.push(buffer); - } - - buffer = ''; - - if (url.scheme == 'file' && (char == EOF || char == '?' || char == '#')) { - while (url.path.length > 1 && url.path[0] === '') { - url.path.shift(); - } - } - - if (char == '?') { + if (chr == EOF) { + url.username = base.username; + url.password = base.password; + url.host = base.host; + url.port = base.port; + url.path = arraySlice(base.path); + url.query = base.query; + } else if (chr == '/' || chr == '\\' && url.isSpecial()) { + state = RELATIVE_SLASH; + } else if (chr == '?') { + url.username = base.username; + url.password = base.password; + url.host = base.host; + url.port = base.port; + url.path = arraySlice(base.path); url.query = ''; state = QUERY; - } else if (char == '#') { + } else if (chr == '#') { + url.username = base.username; + url.password = base.password; + url.host = base.host; + url.port = base.port; + url.path = arraySlice(base.path); + url.query = base.query; url.fragment = ''; state = FRAGMENT; + } else { + url.username = base.username; + url.password = base.password; + url.host = base.host; + url.port = base.port; + url.path = arraySlice(base.path); + url.path.length--; + state = PATH; + continue; } - } else { - buffer += percentEncode(char, pathPercentEncodeSet); - } - break; + break; - case CANNOT_BE_A_BASE_URL_PATH: - if (char == '?') { - url.query = ''; - state = QUERY; - } else if (char == '#') { - url.fragment = ''; - state = FRAGMENT; - } else if (char != EOF) { - url.path[0] += percentEncode(char, C0ControlPercentEncodeSet); - } + case RELATIVE_SLASH: + if (url.isSpecial() && (chr == '/' || chr == '\\')) { + state = SPECIAL_AUTHORITY_IGNORE_SLASHES; + } else if (chr == '/') { + state = AUTHORITY; + } else { + url.username = base.username; + url.password = base.password; + url.host = base.host; + url.port = base.port; + state = PATH; + continue; + } - break; + break; - case QUERY: - if (!stateOverride && char == '#') { - url.fragment = ''; - state = FRAGMENT; - } else if (char != EOF) { - if (char == "'" && isSpecial(url)) url.query += '%27';else if (char == '#') url.query += '%23';else url.query += percentEncode(char, C0ControlPercentEncodeSet); - } + case SPECIAL_AUTHORITY_SLASHES: + state = SPECIAL_AUTHORITY_IGNORE_SLASHES; + if (chr != '/' || charAt(buffer, pointer + 1) != '/') continue; + pointer++; + break; - break; + case SPECIAL_AUTHORITY_IGNORE_SLASHES: + if (chr != '/' && chr != '\\') { + state = AUTHORITY; + continue; + } - case FRAGMENT: - if (char != EOF) url.fragment += percentEncode(char, fragmentPercentEncodeSet); - break; + break; + + case AUTHORITY: + if (chr == '@') { + if (seenAt) buffer = '%40' + buffer; + seenAt = true; + bufferCodePoints = arrayFrom(buffer); + + for (var i = 0; i < bufferCodePoints.length; i++) { + var codePoint = bufferCodePoints[i]; + + if (codePoint == ':' && !seenPasswordToken) { + seenPasswordToken = true; + continue; + } + + var encodedCodePoints = percentEncode(codePoint, userinfoPercentEncodeSet); + if (seenPasswordToken) url.password += encodedCodePoints;else url.username += encodedCodePoints; + } + + buffer = ''; + } else if (chr == EOF || chr == '/' || chr == '?' || chr == '#' || chr == '\\' && url.isSpecial()) { + if (seenAt && buffer == '') return INVALID_AUTHORITY; + pointer -= arrayFrom(buffer).length + 1; + buffer = ''; + state = HOST; + } else buffer += chr; + + break; + + case HOST: + case HOSTNAME: + if (stateOverride && url.scheme == 'file') { + state = FILE_HOST; + continue; + } else if (chr == ':' && !seenBracket) { + if (buffer == '') return INVALID_HOST; + failure = url.parseHost(buffer); + if (failure) return failure; + buffer = ''; + state = PORT; + if (stateOverride == HOSTNAME) return; + } else if (chr == EOF || chr == '/' || chr == '?' || chr == '#' || chr == '\\' && url.isSpecial()) { + if (url.isSpecial() && buffer == '') return INVALID_HOST; + if (stateOverride && buffer == '' && (url.includesCredentials() || url.port !== null)) return; + failure = url.parseHost(buffer); + if (failure) return failure; + buffer = ''; + state = PATH_START; + if (stateOverride) return; + continue; + } else { + if (chr == '[') seenBracket = true;else if (chr == ']') seenBracket = false; + buffer += chr; + } + + break; + + case PORT: + if (exec(DIGIT, chr)) { + buffer += chr; + } else if (chr == EOF || chr == '/' || chr == '?' || chr == '#' || chr == '\\' && url.isSpecial() || stateOverride) { + if (buffer != '') { + var port = parseInt(buffer, 10); + if (port > 0xFFFF) return INVALID_PORT; + url.port = url.isSpecial() && port === specialSchemes[url.scheme] ? null : port; + buffer = ''; + } + + if (stateOverride) return; + state = PATH_START; + continue; + } else return INVALID_PORT; + + break; + + case FILE: + url.scheme = 'file'; + if (chr == '/' || chr == '\\') state = FILE_SLASH;else if (base && base.scheme == 'file') { + if (chr == EOF) { + url.host = base.host; + url.path = arraySlice(base.path); + url.query = base.query; + } else if (chr == '?') { + url.host = base.host; + url.path = arraySlice(base.path); + url.query = ''; + state = QUERY; + } else if (chr == '#') { + url.host = base.host; + url.path = arraySlice(base.path); + url.query = base.query; + url.fragment = ''; + state = FRAGMENT; + } else { + if (!startsWithWindowsDriveLetter(join(arraySlice(codePoints, pointer), ''))) { + url.host = base.host; + url.path = arraySlice(base.path); + url.shortenPath(); + } + + state = PATH; + continue; + } + } else { + state = PATH; + continue; + } + break; + + case FILE_SLASH: + if (chr == '/' || chr == '\\') { + state = FILE_HOST; + break; + } + + if (base && base.scheme == 'file' && !startsWithWindowsDriveLetter(join(arraySlice(codePoints, pointer), ''))) { + if (isWindowsDriveLetter(base.path[0], true)) push(url.path, base.path[0]);else url.host = base.host; + } + + state = PATH; + continue; + + case FILE_HOST: + if (chr == EOF || chr == '/' || chr == '\\' || chr == '?' || chr == '#') { + if (!stateOverride && isWindowsDriveLetter(buffer)) { + state = PATH; + } else if (buffer == '') { + url.host = ''; + if (stateOverride) return; + state = PATH_START; + } else { + failure = url.parseHost(buffer); + if (failure) return failure; + if (url.host == 'localhost') url.host = ''; + if (stateOverride) return; + buffer = ''; + state = PATH_START; + } + + continue; + } else buffer += chr; + + break; + + case PATH_START: + if (url.isSpecial()) { + state = PATH; + if (chr != '/' && chr != '\\') continue; + } else if (!stateOverride && chr == '?') { + url.query = ''; + state = QUERY; + } else if (!stateOverride && chr == '#') { + url.fragment = ''; + state = FRAGMENT; + } else if (chr != EOF) { + state = PATH; + if (chr != '/') continue; + } + + break; + + case PATH: + if (chr == EOF || chr == '/' || chr == '\\' && url.isSpecial() || !stateOverride && (chr == '?' || chr == '#')) { + if (isDoubleDot(buffer)) { + url.shortenPath(); + + if (chr != '/' && !(chr == '\\' && url.isSpecial())) { + push(url.path, ''); + } + } else if (isSingleDot(buffer)) { + if (chr != '/' && !(chr == '\\' && url.isSpecial())) { + push(url.path, ''); + } + } else { + if (url.scheme == 'file' && !url.path.length && isWindowsDriveLetter(buffer)) { + if (url.host) url.host = ''; + buffer = charAt(buffer, 0) + ':'; // normalize windows drive letter + } + + push(url.path, buffer); + } + + buffer = ''; + + if (url.scheme == 'file' && (chr == EOF || chr == '?' || chr == '#')) { + while (url.path.length > 1 && url.path[0] === '') { + shift(url.path); + } + } + + if (chr == '?') { + url.query = ''; + state = QUERY; + } else if (chr == '#') { + url.fragment = ''; + state = FRAGMENT; + } + } else { + buffer += percentEncode(chr, pathPercentEncodeSet); + } + + break; + + case CANNOT_BE_A_BASE_URL_PATH: + if (chr == '?') { + url.query = ''; + state = QUERY; + } else if (chr == '#') { + url.fragment = ''; + state = FRAGMENT; + } else if (chr != EOF) { + url.path[0] += percentEncode(chr, C0ControlPercentEncodeSet); + } + + break; + + case QUERY: + if (!stateOverride && chr == '#') { + url.fragment = ''; + state = FRAGMENT; + } else if (chr != EOF) { + if (chr == "'" && url.isSpecial()) url.query += '%27';else if (chr == '#') url.query += '%23';else url.query += percentEncode(chr, C0ControlPercentEncodeSet); + } + + break; + + case FRAGMENT: + if (chr != EOF) url.fragment += percentEncode(chr, fragmentPercentEncodeSet); + break; + } + + pointer++; + } + }, + // https://url.spec.whatwg.org/#host-parsing + parseHost: function (input) { + var result, codePoints, index; + + if (charAt(input, 0) == '[') { + if (charAt(input, input.length - 1) != ']') return INVALID_HOST; + result = parseIPv6(stringSlice(input, 1, -1)); + if (!result) return INVALID_HOST; + this.host = result; // opaque host + } else if (!this.isSpecial()) { + if (exec(FORBIDDEN_HOST_CODE_POINT_EXCLUDING_PERCENT, input)) return INVALID_HOST; + result = ''; + codePoints = arrayFrom(input); + + for (index = 0; index < codePoints.length; index++) { + result += percentEncode(codePoints[index], C0ControlPercentEncodeSet); + } + + this.host = result; + } else { + input = toASCII(input); + if (exec(FORBIDDEN_HOST_CODE_POINT, input)) return INVALID_HOST; + result = parseIPv4(input); + if (result === null) return INVALID_HOST; + this.host = result; + } + }, + // https://url.spec.whatwg.org/#cannot-have-a-username-password-port + cannotHaveUsernamePasswordPort: function () { + return !this.host || this.cannotBeABaseURL || this.scheme == 'file'; + }, + // https://url.spec.whatwg.org/#include-credentials + includesCredentials: function () { + return this.username != '' || this.password != ''; + }, + // https://url.spec.whatwg.org/#is-special + isSpecial: function () { + return hasOwn(specialSchemes, this.scheme); + }, + // https://url.spec.whatwg.org/#shorten-a-urls-path + shortenPath: function () { + var path = this.path; + var pathSize = path.length; + + if (pathSize && (this.scheme != 'file' || pathSize != 1 || !isWindowsDriveLetter(path[0], true))) { + path.length--; + } + }, + // https://url.spec.whatwg.org/#concept-url-serializer + serialize: function () { + var url = this; + var scheme = url.scheme; + var username = url.username; + var password = url.password; + var host = url.host; + var port = url.port; + var path = url.path; + var query = url.query; + var fragment = url.fragment; + var output = scheme + ':'; + + if (host !== null) { + output += '//'; + + if (url.includesCredentials()) { + output += username + (password ? ':' + password : '') + '@'; + } + + output += serializeHost(host); + if (port !== null) output += ':' + port; + } else if (scheme == 'file') output += '//'; + + output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + join(path, '/') : ''; + if (query !== null) output += '?' + query; + if (fragment !== null) output += '#' + fragment; + return output; + }, + // https://url.spec.whatwg.org/#dom-url-href + setHref: function (href) { + var failure = this.parse(href); + if (failure) throw TypeError(failure); + this.searchParams.update(); + }, + // https://url.spec.whatwg.org/#dom-url-origin + getOrigin: function () { + var scheme = this.scheme; + var port = this.port; + if (scheme == 'blob') try { + return new URLConstructor(scheme.path[0]).origin; + } catch (error) { + return 'null'; + } + if (scheme == 'file' || !this.isSpecial()) return 'null'; + return scheme + '://' + serializeHost(this.host) + (port !== null ? ':' + port : ''); + }, + // https://url.spec.whatwg.org/#dom-url-protocol + getProtocol: function () { + return this.scheme + ':'; + }, + setProtocol: function (protocol) { + this.parse($toString(protocol) + ':', SCHEME_START); + }, + // https://url.spec.whatwg.org/#dom-url-username + getUsername: function () { + return this.username; + }, + setUsername: function (username) { + var codePoints = arrayFrom($toString(username)); + if (this.cannotHaveUsernamePasswordPort()) return; + this.username = ''; + + for (var i = 0; i < codePoints.length; i++) { + this.username += percentEncode(codePoints[i], userinfoPercentEncodeSet); + } + }, + // https://url.spec.whatwg.org/#dom-url-password + getPassword: function () { + return this.password; + }, + setPassword: function (password) { + var codePoints = arrayFrom($toString(password)); + if (this.cannotHaveUsernamePasswordPort()) return; + this.password = ''; + + for (var i = 0; i < codePoints.length; i++) { + this.password += percentEncode(codePoints[i], userinfoPercentEncodeSet); + } + }, + // https://url.spec.whatwg.org/#dom-url-host + getHost: function () { + var host = this.host; + var port = this.port; + return host === null ? '' : port === null ? serializeHost(host) : serializeHost(host) + ':' + port; + }, + setHost: function (host) { + if (this.cannotBeABaseURL) return; + this.parse(host, HOST); + }, + // https://url.spec.whatwg.org/#dom-url-hostname + getHostname: function () { + var host = this.host; + return host === null ? '' : serializeHost(host); + }, + setHostname: function (hostname) { + if (this.cannotBeABaseURL) return; + this.parse(hostname, HOSTNAME); + }, + // https://url.spec.whatwg.org/#dom-url-port + getPort: function () { + var port = this.port; + return port === null ? '' : $toString(port); + }, + setPort: function (port) { + if (this.cannotHaveUsernamePasswordPort()) return; + port = $toString(port); + if (port == '') this.port = null;else this.parse(port, PORT); + }, + // https://url.spec.whatwg.org/#dom-url-pathname + getPathname: function () { + var path = this.path; + return this.cannotBeABaseURL ? path[0] : path.length ? '/' + join(path, '/') : ''; + }, + setPathname: function (pathname) { + if (this.cannotBeABaseURL) return; + this.path = []; + this.parse(pathname, PATH_START); + }, + // https://url.spec.whatwg.org/#dom-url-search + getSearch: function () { + var query = this.query; + return query ? '?' + query : ''; + }, + setSearch: function (search) { + search = $toString(search); + + if (search == '') { + this.query = null; + } else { + if ('?' == charAt(search, 0)) search = stringSlice(search, 1); + this.query = ''; + this.parse(search, QUERY); } - pointer++; + this.searchParams.update(); + }, + // https://url.spec.whatwg.org/#dom-url-searchparams + getSearchParams: function () { + return this.searchParams.facade; + }, + // https://url.spec.whatwg.org/#dom-url-hash + getHash: function () { + var fragment = this.fragment; + return fragment ? '#' + fragment : ''; + }, + setHash: function (hash) { + hash = $toString(hash); + + if (hash == '') { + this.fragment = null; + return; + } + + if ('#' == charAt(hash, 0)) hash = stringSlice(hash, 1); + this.fragment = ''; + this.parse(hash, FRAGMENT); + }, + update: function () { + this.query = this.searchParams.serialize() || null; } }; // `URL` constructor // https://url.spec.whatwg.org/#url-class - var URLConstructor = function URL(url /* , base */ ) { - var that = anInstance(this, URLConstructor, 'URL'); + var that = anInstance(this, URLPrototype); var base = arguments.length > 1 ? arguments[1] : undefined; - var urlString = $toString(url); - var state = setInternalState(that, { - type: 'URL' - }); - var baseState, failure; - - if (base !== undefined) { - if (base instanceof URLConstructor) baseState = getInternalURLState(base);else { - failure = parseURL(baseState = {}, $toString(base)); - if (failure) throw TypeError(failure); - } - } - - failure = parseURL(state, urlString, null, baseState); - if (failure) throw TypeError(failure); - var searchParams = state.searchParams = new URLSearchParams(); - var searchParamsState = getInternalSearchParamsState(searchParams); - searchParamsState.updateSearchParams(state.query); - - searchParamsState.updateURL = function () { - state.query = String(searchParams) || null; - }; + var state = setInternalState(that, new URLState(url, false, base)); if (!DESCRIPTORS) { - that.href = serializeURL.call(that); - that.origin = getOrigin.call(that); - that.protocol = getProtocol.call(that); - that.username = getUsername.call(that); - that.password = getPassword.call(that); - that.host = getHost.call(that); - that.hostname = getHostname.call(that); - that.port = getPort.call(that); - that.pathname = getPathname.call(that); - that.search = getSearch.call(that); - that.searchParams = getSearchParams.call(that); - that.hash = getHash.call(that); + that.href = state.serialize(); + that.origin = state.getOrigin(); + that.protocol = state.getProtocol(); + that.username = state.getUsername(); + that.password = state.getPassword(); + that.host = state.getHost(); + that.hostname = state.getHostname(); + that.port = state.getPort(); + that.pathname = state.getPathname(); + that.search = state.getSearch(); + that.searchParams = state.getSearchParams(); + that.hash = state.getHash(); } }; var URLPrototype = URLConstructor.prototype; -var serializeURL = function () { - var url = getInternalURLState(this); - var scheme = url.scheme; - var username = url.username; - var password = url.password; - var host = url.host; - var port = url.port; - var path = url.path; - var query = url.query; - var fragment = url.fragment; - var output = scheme + ':'; - - if (host !== null) { - output += '//'; - - if (includesCredentials(url)) { - output += username + (password ? ':' + password : '') + '@'; - } - - output += serializeHost(host); - if (port !== null) output += ':' + port; - } else if (scheme == 'file') output += '//'; - - output += url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : ''; - if (query !== null) output += '?' + query; - if (fragment !== null) output += '#' + fragment; - return output; -}; - -var getOrigin = function () { - var url = getInternalURLState(this); - var scheme = url.scheme; - var port = url.port; - if (scheme == 'blob') try { - return new URLConstructor(scheme.path[0]).origin; - } catch (error) { - return 'null'; - } - if (scheme == 'file' || !isSpecial(url)) return 'null'; - return scheme + '://' + serializeHost(url.host) + (port !== null ? ':' + port : ''); -}; - -var getProtocol = function () { - return getInternalURLState(this).scheme + ':'; -}; - -var getUsername = function () { - return getInternalURLState(this).username; -}; - -var getPassword = function () { - return getInternalURLState(this).password; -}; - -var getHost = function () { - var url = getInternalURLState(this); - var host = url.host; - var port = url.port; - return host === null ? '' : port === null ? serializeHost(host) : serializeHost(host) + ':' + port; -}; - -var getHostname = function () { - var host = getInternalURLState(this).host; - return host === null ? '' : serializeHost(host); -}; - -var getPort = function () { - var port = getInternalURLState(this).port; - return port === null ? '' : String(port); -}; - -var getPathname = function () { - var url = getInternalURLState(this); - var path = url.path; - return url.cannotBeABaseURL ? path[0] : path.length ? '/' + path.join('/') : ''; -}; - -var getSearch = function () { - var query = getInternalURLState(this).query; - return query ? '?' + query : ''; -}; - -var getSearchParams = function () { - return getInternalURLState(this).searchParams; -}; - -var getHash = function () { - var fragment = getInternalURLState(this).fragment; - return fragment ? '#' + fragment : ''; -}; - var accessorDescriptor = function (getter, setter) { return { - get: getter, - set: setter, + get: function () { + return getInternalURLState(this)[getter](); + }, + set: setter && function (value) { + return getInternalURLState(this)[setter](value); + }, configurable: true, enumerable: true }; @@ -15221,124 +16464,54 @@ if (DESCRIPTORS) { defineProperties(URLPrototype, { // `URL.prototype.href` accessors pair // https://url.spec.whatwg.org/#dom-url-href - href: accessorDescriptor(serializeURL, function (href) { - var url = getInternalURLState(this); - var urlString = $toString(href); - var failure = parseURL(url, urlString); - if (failure) throw TypeError(failure); - getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query); - }), + href: accessorDescriptor('serialize', 'setHref'), // `URL.prototype.origin` getter // https://url.spec.whatwg.org/#dom-url-origin - origin: accessorDescriptor(getOrigin), + origin: accessorDescriptor('getOrigin'), // `URL.prototype.protocol` accessors pair // https://url.spec.whatwg.org/#dom-url-protocol - protocol: accessorDescriptor(getProtocol, function (protocol) { - var url = getInternalURLState(this); - parseURL(url, $toString(protocol) + ':', SCHEME_START); - }), + protocol: accessorDescriptor('getProtocol', 'setProtocol'), // `URL.prototype.username` accessors pair // https://url.spec.whatwg.org/#dom-url-username - username: accessorDescriptor(getUsername, function (username) { - var url = getInternalURLState(this); - var codePoints = arrayFrom($toString(username)); - if (cannotHaveUsernamePasswordPort(url)) return; - url.username = ''; - - for (var i = 0; i < codePoints.length; i++) { - url.username += percentEncode(codePoints[i], userinfoPercentEncodeSet); - } - }), + username: accessorDescriptor('getUsername', 'setUsername'), // `URL.prototype.password` accessors pair // https://url.spec.whatwg.org/#dom-url-password - password: accessorDescriptor(getPassword, function (password) { - var url = getInternalURLState(this); - var codePoints = arrayFrom($toString(password)); - if (cannotHaveUsernamePasswordPort(url)) return; - url.password = ''; - - for (var i = 0; i < codePoints.length; i++) { - url.password += percentEncode(codePoints[i], userinfoPercentEncodeSet); - } - }), + password: accessorDescriptor('getPassword', 'setPassword'), // `URL.prototype.host` accessors pair // https://url.spec.whatwg.org/#dom-url-host - host: accessorDescriptor(getHost, function (host) { - var url = getInternalURLState(this); - if (url.cannotBeABaseURL) return; - parseURL(url, $toString(host), HOST); - }), + host: accessorDescriptor('getHost', 'setHost'), // `URL.prototype.hostname` accessors pair // https://url.spec.whatwg.org/#dom-url-hostname - hostname: accessorDescriptor(getHostname, function (hostname) { - var url = getInternalURLState(this); - if (url.cannotBeABaseURL) return; - parseURL(url, $toString(hostname), HOSTNAME); - }), + hostname: accessorDescriptor('getHostname', 'setHostname'), // `URL.prototype.port` accessors pair // https://url.spec.whatwg.org/#dom-url-port - port: accessorDescriptor(getPort, function (port) { - var url = getInternalURLState(this); - if (cannotHaveUsernamePasswordPort(url)) return; - port = $toString(port); - if (port == '') url.port = null;else parseURL(url, port, PORT); - }), + port: accessorDescriptor('getPort', 'setPort'), // `URL.prototype.pathname` accessors pair // https://url.spec.whatwg.org/#dom-url-pathname - pathname: accessorDescriptor(getPathname, function (pathname) { - var url = getInternalURLState(this); - if (url.cannotBeABaseURL) return; - url.path = []; - parseURL(url, $toString(pathname), PATH_START); - }), + pathname: accessorDescriptor('getPathname', 'setPathname'), // `URL.prototype.search` accessors pair // https://url.spec.whatwg.org/#dom-url-search - search: accessorDescriptor(getSearch, function (search) { - var url = getInternalURLState(this); - search = $toString(search); - - if (search == '') { - url.query = null; - } else { - if ('?' == search.charAt(0)) search = search.slice(1); - url.query = ''; - parseURL(url, search, QUERY); - } - - getInternalSearchParamsState(url.searchParams).updateSearchParams(url.query); - }), + search: accessorDescriptor('getSearch', 'setSearch'), // `URL.prototype.searchParams` getter // https://url.spec.whatwg.org/#dom-url-searchparams - searchParams: accessorDescriptor(getSearchParams), + searchParams: accessorDescriptor('getSearchParams'), // `URL.prototype.hash` accessors pair // https://url.spec.whatwg.org/#dom-url-hash - hash: accessorDescriptor(getHash, function (hash) { - var url = getInternalURLState(this); - hash = $toString(hash); - - if (hash == '') { - url.fragment = null; - return; - } - - if ('#' == hash.charAt(0)) hash = hash.slice(1); - url.fragment = ''; - parseURL(url, hash, FRAGMENT); - }) + hash: accessorDescriptor('getHash', 'setHash') }); } // `URL.prototype.toJSON` method // https://url.spec.whatwg.org/#dom-url-tojson redefine(URLPrototype, 'toJSON', function toJSON() { - return serializeURL.call(this); + return getInternalURLState(this).serialize(); }, { enumerable: true }); // `URL.prototype.toString` method // https://url.spec.whatwg.org/#URL-stringification-behavior redefine(URLPrototype, 'toString', function toString() { - return serializeURL.call(this); + return getInternalURLState(this).serialize(); }, { enumerable: true }); @@ -15347,17 +16520,11 @@ if (NativeURL) { var nativeCreateObjectURL = NativeURL.createObjectURL; var nativeRevokeObjectURL = NativeURL.revokeObjectURL; // `URL.createObjectURL` method // https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL - // eslint-disable-next-line no-unused-vars -- required for `.length` - if (nativeCreateObjectURL) redefine(URLConstructor, 'createObjectURL', function createObjectURL(blob) { - return nativeCreateObjectURL.apply(NativeURL, arguments); - }); // `URL.revokeObjectURL` method + if (nativeCreateObjectURL) redefine(URLConstructor, 'createObjectURL', bind(nativeCreateObjectURL, NativeURL)); // `URL.revokeObjectURL` method // https://developer.mozilla.org/en-US/docs/Web/API/URL/revokeObjectURL - // eslint-disable-next-line no-unused-vars -- required for `.length` - if (nativeRevokeObjectURL) redefine(URLConstructor, 'revokeObjectURL', function revokeObjectURL(url) { - return nativeRevokeObjectURL.apply(NativeURL, arguments); - }); + if (nativeRevokeObjectURL) redefine(URLConstructor, 'revokeObjectURL', bind(nativeRevokeObjectURL, NativeURL)); } setToStringTag(URLConstructor, 'URL'); @@ -15370,14 +16537,14 @@ $({ }); /***/ }), -/* 399 */ +/* 423 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var fails = __webpack_require__(6); -var wellKnownSymbol = __webpack_require__(23); +var wellKnownSymbol = __webpack_require__(30); -var IS_PURE = __webpack_require__(25); +var IS_PURE = __webpack_require__(32); var ITERATOR = wellKnownSymbol('iterator'); module.exports = !fails(function () { @@ -15398,12 +16565,16 @@ module.exports = !fails(function () { }); /***/ }), -/* 400 */ -/***/ ((module) => { +/* 424 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; // based on https://github.com/bestiejs/punycode.js/blob/master/punycode.js +var global = __webpack_require__(3); + +var uncurryThis = __webpack_require__(12); + var maxInt = 2147483647; // aka. 0x7FFFFFFF or 2^31-1 var base = 36; @@ -15422,8 +16593,16 @@ var regexSeparators = /[.\u3002\uFF0E\uFF61]/g; // RFC 3490 separators var OVERFLOW_ERROR = 'Overflow: input needs wider integers to process'; var baseMinusTMin = base - tMin; +var RangeError = global.RangeError; +var exec = uncurryThis(regexSeparators.exec); var floor = Math.floor; -var stringFromCharCode = String.fromCharCode; +var fromCharCode = String.fromCharCode; +var charCodeAt = uncurryThis(''.charCodeAt); +var join = uncurryThis([].join); +var push = uncurryThis([].push); +var replace = uncurryThis(''.replace); +var split = uncurryThis(''.split); +var toLowerCase = uncurryThis(''.toLowerCase); /** * Creates an array containing the numeric code points of each Unicode * character in the string. While JavaScript uses UCS-2 internally, @@ -15438,23 +16617,23 @@ var ucs2decode = function (string) { var length = string.length; while (counter < length) { - var value = string.charCodeAt(counter++); + var value = charCodeAt(string, counter++); if (value >= 0xD800 && value <= 0xDBFF && counter < length) { // It's a high surrogate, and there is a next character. - var extra = string.charCodeAt(counter++); + var extra = charCodeAt(string, counter++); if ((extra & 0xFC00) == 0xDC00) { // Low surrogate. - output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); + push(output, ((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000); } else { // It's an unmatched surrogate; only append this code unit, in case the // next code unit is the high surrogate of a surrogate pair. - output.push(value); + push(output, value); counter--; } } else { - output.push(value); + push(output, value); } } @@ -15481,8 +16660,9 @@ var adapt = function (delta, numPoints, firstTime) { delta = firstTime ? floor(delta / damp) : delta >> 1; delta += floor(delta / numPoints); - for (; delta > baseMinusTMin * tMax >> 1; k += base) { + while (delta > baseMinusTMin * tMax >> 1) { delta = floor(delta / baseMinusTMin); + k += base; } return floor(k + (baseMinusTMin + 1) * delta / (delta + skew)); @@ -15491,7 +16671,6 @@ var adapt = function (delta, numPoints, firstTime) { * Converts a string of Unicode symbols (e.g. a domain name label) to a * Punycode string of ASCII-only symbols. */ -// eslint-disable-next-line max-statements -- TODO var encode = function (input) { @@ -15510,7 +16689,7 @@ var encode = function (input) { currentValue = input[i]; if (currentValue < 0x80) { - output.push(stringFromCharCode(currentValue)); + push(output, fromCharCode(currentValue)); } } @@ -15520,7 +16699,7 @@ var encode = function (input) { // Finish the basic string with a delimiter unless it's empty. if (basicLength) { - output.push(delimiter); + push(output, delimiter); } // Main encoding loop: @@ -15556,102 +16735,127 @@ var encode = function (input) { if (currentValue == n) { // Represent delta as a generalized variable-length integer. var q = delta; + var k = base; - for (var k = base;; k += base) { + while (true) { var t = k <= bias ? tMin : k >= bias + tMax ? tMax : k - bias; if (q < t) break; var qMinusT = q - t; var baseMinusT = base - t; - output.push(stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT))); + push(output, fromCharCode(digitToBasic(t + qMinusT % baseMinusT))); q = floor(qMinusT / baseMinusT); + k += base; } - output.push(stringFromCharCode(digitToBasic(q))); + push(output, fromCharCode(digitToBasic(q))); bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength); delta = 0; - ++handledCPCount; + handledCPCount++; } } - ++delta; - ++n; + delta++; + n++; } - return output.join(''); + return join(output, ''); }; module.exports = function (input) { var encoded = []; - var labels = input.toLowerCase().replace(regexSeparators, '\u002E').split('.'); + var labels = split(replace(toLowerCase(input), regexSeparators, '\u002E'), '.'); var i, label; for (i = 0; i < labels.length; i++) { label = labels[i]; - encoded.push(regexNonASCII.test(label) ? 'xn--' + encode(label) : label); + push(encoded, exec(regexNonASCII, label) ? 'xn--' + encode(label) : label); } - return encoded.join('.'); + return join(encoded, '.'); }; /***/ }), -/* 401 */ +/* 425 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; // TODO: in core-js@4, move /modules/ dependencies to public entries for better optimization by tools like `preset-env` -__webpack_require__(121); +__webpack_require__(138); var $ = __webpack_require__(2); -var getBuiltIn = __webpack_require__(17); +var global = __webpack_require__(3); -var USE_NATIVE_URL = __webpack_require__(399); +var getBuiltIn = __webpack_require__(20); -var redefine = __webpack_require__(36); +var call = __webpack_require__(7); -var redefineAll = __webpack_require__(150); +var uncurryThis = __webpack_require__(12); -var setToStringTag = __webpack_require__(63); +var USE_NATIVE_URL = __webpack_require__(423); -var createIteratorConstructor = __webpack_require__(123); +var redefine = __webpack_require__(43); -var InternalStateModule = __webpack_require__(38); +var redefineAll = __webpack_require__(167); -var anInstance = __webpack_require__(151); +var setToStringTag = __webpack_require__(78); -var hasOwn = __webpack_require__(28); +var createIteratorConstructor = __webpack_require__(140); -var bind = __webpack_require__(65); +var InternalStateModule = __webpack_require__(45); -var classof = __webpack_require__(93); +var anInstance = __webpack_require__(168); -var anObject = __webpack_require__(35); +var isCallable = __webpack_require__(18); -var isObject = __webpack_require__(15); +var hasOwn = __webpack_require__(35); -var $toString = __webpack_require__(54); +var bind = __webpack_require__(80); -var create = __webpack_require__(55); +var classof = __webpack_require__(65); -var createPropertyDescriptor = __webpack_require__(8); +var anObject = __webpack_require__(42); -var getIterator = __webpack_require__(91); +var isObject = __webpack_require__(17); -var getIteratorMethod = __webpack_require__(92); +var $toString = __webpack_require__(64); -var wellKnownSymbol = __webpack_require__(23); +var create = __webpack_require__(67); + +var createPropertyDescriptor = __webpack_require__(9); + +var getIterator = __webpack_require__(108); + +var getIteratorMethod = __webpack_require__(109); + +var wellKnownSymbol = __webpack_require__(30); + +var arraySort = __webpack_require__(155); -var nativeFetch = getBuiltIn('fetch'); -var NativeRequest = getBuiltIn('Request'); -var RequestPrototype = NativeRequest && NativeRequest.prototype; -var Headers = getBuiltIn('Headers'); var ITERATOR = wellKnownSymbol('iterator'); var URL_SEARCH_PARAMS = 'URLSearchParams'; var URL_SEARCH_PARAMS_ITERATOR = URL_SEARCH_PARAMS + 'Iterator'; var setInternalState = InternalStateModule.set; var getInternalParamsState = InternalStateModule.getterFor(URL_SEARCH_PARAMS); var getInternalIteratorState = InternalStateModule.getterFor(URL_SEARCH_PARAMS_ITERATOR); +var n$Fetch = getBuiltIn('fetch'); +var N$Request = getBuiltIn('Request'); +var Headers = getBuiltIn('Headers'); +var RequestPrototype = N$Request && N$Request.prototype; +var HeadersPrototype = Headers && Headers.prototype; +var RegExp = global.RegExp; +var TypeError = global.TypeError; +var decodeURIComponent = global.decodeURIComponent; +var encodeURIComponent = global.encodeURIComponent; +var charAt = uncurryThis(''.charAt); +var join = uncurryThis([].join); +var push = uncurryThis([].push); +var replace = uncurryThis(''.replace); +var shift = uncurryThis([].shift); +var splice = uncurryThis([].splice); +var split = uncurryThis(''.split); +var stringSlice = uncurryThis(''.slice); var plus = /\+/g; var sequences = Array(4); @@ -15668,14 +16872,14 @@ var percentDecode = function (sequence) { }; var deserialize = function (it) { - var result = it.replace(plus, ' '); + var result = replace(it, plus, ' '); var bytes = 4; try { return decodeURIComponent(result); } catch (error) { while (bytes) { - result = result.replace(percentSequence(bytes--), percentDecode); + result = replace(result, percentSequence(bytes--), percentDecode); } return result; @@ -15683,7 +16887,7 @@ var deserialize = function (it) { }; var find = /[!'()~]|%20/g; -var replace = { +var replacements = { '!': '%21', "'": '%27', '(': '%28', @@ -15693,36 +16897,11 @@ var replace = { }; var replacer = function (match) { - return replace[match]; + return replacements[match]; }; var serialize = function (it) { - return encodeURIComponent(it).replace(find, replacer); -}; - -var parseSearchParams = function (result, query) { - if (query) { - var attributes = query.split('&'); - var index = 0; - var attribute, entry; - - while (index < attributes.length) { - attribute = attributes[index++]; - - if (attribute.length) { - entry = attribute.split('='); - result.push({ - key: deserialize(entry.shift()), - value: deserialize(entry.join('=')) - }); - } - } - } -}; - -var updateSearchParams = function (query) { - this.entries.length = 0; - parseSearchParams(this.entries, query); + return replace(encodeURIComponent(it), find, replacer); }; var validateArgumentsLength = function (passed, required) { @@ -15746,49 +16925,95 @@ var URLSearchParamsIterator = createIteratorConstructor(function Iterator(params } return step; -}); // `URLSearchParams` constructor -// https://url.spec.whatwg.org/#interface-urlsearchparams +}); -var URLSearchParamsConstructor = function URLSearchParams() { - anInstance(this, URLSearchParamsConstructor, URL_SEARCH_PARAMS); - var init = arguments.length > 0 ? arguments[0] : undefined; - var that = this; - var entries = []; - var iteratorMethod, iterator, next, step, entryIterator, entryNext, first, second, key; - setInternalState(that, { - type: URL_SEARCH_PARAMS, - entries: entries, - updateURL: function () { - /* empty */ - }, - updateSearchParams: updateSearchParams - }); +var URLSearchParamsState = function (init) { + this.entries = []; + this.url = null; if (init !== undefined) { - if (isObject(init)) { - iteratorMethod = getIteratorMethod(init); + if (isObject(init)) this.parseObject(init);else this.parseQuery(typeof init == 'string' ? charAt(init, 0) === '?' ? stringSlice(init, 1) : init : $toString(init)); + } +}; - if (typeof iteratorMethod === 'function') { - iterator = getIterator(init, iteratorMethod); - next = iterator.next; +URLSearchParamsState.prototype = { + type: URL_SEARCH_PARAMS, + bindURL: function (url) { + this.url = url; + this.update(); + }, + parseObject: function (object) { + var iteratorMethod = getIteratorMethod(object); + var iterator, next, step, entryIterator, entryNext, first, second; - while (!(step = next.call(iterator)).done) { - entryIterator = getIterator(anObject(step.value)); - entryNext = entryIterator.next; - if ((first = entryNext.call(entryIterator)).done || (second = entryNext.call(entryIterator)).done || !entryNext.call(entryIterator).done) throw TypeError('Expected sequence with length 2'); - entries.push({ - key: $toString(first.value), - value: $toString(second.value) + if (iteratorMethod) { + iterator = getIterator(object, iteratorMethod); + next = iterator.next; + + while (!(step = call(next, iterator)).done) { + entryIterator = getIterator(anObject(step.value)); + entryNext = entryIterator.next; + if ((first = call(entryNext, entryIterator)).done || (second = call(entryNext, entryIterator)).done || !call(entryNext, entryIterator).done) throw TypeError('Expected sequence with length 2'); + push(this.entries, { + key: $toString(first.value), + value: $toString(second.value) + }); + } + } else for (var key in object) if (hasOwn(object, key)) { + push(this.entries, { + key: key, + value: $toString(object[key]) + }); + } + }, + parseQuery: function (query) { + if (query) { + var attributes = split(query, '&'); + var index = 0; + var attribute, entry; + + while (index < attributes.length) { + attribute = attributes[index++]; + + if (attribute.length) { + entry = split(attribute, '='); + push(this.entries, { + key: deserialize(shift(entry)), + value: deserialize(join(entry, '=')) }); } - } else for (key in init) if (hasOwn(init, key)) entries.push({ - key: key, - value: $toString(init[key]) - }); - } else { - parseSearchParams(entries, typeof init === 'string' ? init.charAt(0) === '?' ? init.slice(1) : init : $toString(init)); + } } + }, + serialize: function () { + var entries = this.entries; + var result = []; + var index = 0; + var entry; + + while (index < entries.length) { + entry = entries[index++]; + push(result, serialize(entry.key) + '=' + serialize(entry.value)); + } + + return join(result, '&'); + }, + update: function () { + this.entries.length = 0; + this.parseQuery(this.url.query); + }, + updateURL: function () { + if (this.url) this.url.update(); } +}; // `URLSearchParams` constructor +// https://url.spec.whatwg.org/#interface-urlsearchparams + +var URLSearchParamsConstructor = function + /* init */ +URLSearchParams() { + anInstance(this, URLSearchParamsPrototype); + var init = arguments.length > 0 ? arguments[0] : undefined; + setInternalState(this, new URLSearchParamsState(init)); }; var URLSearchParamsPrototype = URLSearchParamsConstructor.prototype; @@ -15798,7 +17023,7 @@ redefineAll(URLSearchParamsPrototype, { append: function append(name, value) { validateArgumentsLength(arguments.length, 2); var state = getInternalParamsState(this); - state.entries.push({ + push(state.entries, { key: $toString(name), value: $toString(value) }); @@ -15814,7 +17039,7 @@ redefineAll(URLSearchParamsPrototype, { var index = 0; while (index < entries.length) { - if (entries[index].key === key) entries.splice(index, 1);else index++; + if (entries[index].key === key) splice(entries, index, 1);else index++; } state.updateURL(); @@ -15843,7 +17068,7 @@ redefineAll(URLSearchParamsPrototype, { var index = 0; for (; index < entries.length; index++) { - if (entries[index].key === key) result.push(entries[index].value); + if (entries[index].key === key) push(result, entries[index].value); } return result; @@ -15878,14 +17103,14 @@ redefineAll(URLSearchParamsPrototype, { entry = entries[index]; if (entry.key === key) { - if (found) entries.splice(index--, 1);else { + if (found) splice(entries, index--, 1);else { found = true; entry.value = val; } } } - if (!found) entries.push({ + if (!found) push(entries, { key: key, value: val }); @@ -15895,25 +17120,9 @@ redefineAll(URLSearchParamsPrototype, { // https://url.spec.whatwg.org/#dom-urlsearchparams-sort sort: function sort() { var state = getInternalParamsState(this); - var entries = state.entries; // Array#sort is not stable in some engines - - var slice = entries.slice(); - var entry, entriesIndex, sliceIndex; - entries.length = 0; - - for (sliceIndex = 0; sliceIndex < slice.length; sliceIndex++) { - entry = slice[sliceIndex]; - - for (entriesIndex = 0; entriesIndex < sliceIndex; entriesIndex++) { - if (entries[entriesIndex].key > entry.key) { - entries.splice(entriesIndex, 0, entry); - break; - } - } - - if (entriesIndex === sliceIndex) entries.push(entry); - } - + arraySort(state.entries, function (a, b) { + return a.key > b.key ? 1 : -1; + }); state.updateURL(); }, // `URLSearchParams.prototype.forEach` method @@ -15921,7 +17130,7 @@ redefineAll(URLSearchParamsPrototype, { /* , thisArg */ ) { var entries = getInternalParamsState(this).entries; - var boundFunction = bind(callback, arguments.length > 1 ? arguments[1] : undefined, 3); + var boundFunction = bind(callback, arguments.length > 1 ? arguments[1] : undefined); var index = 0; var entry; @@ -15946,21 +17155,13 @@ redefineAll(URLSearchParamsPrototype, { enumerable: true }); // `URLSearchParams.prototype[@@iterator]` method -redefine(URLSearchParamsPrototype, ITERATOR, URLSearchParamsPrototype.entries); // `URLSearchParams.prototype.toString` method +redefine(URLSearchParamsPrototype, ITERATOR, URLSearchParamsPrototype.entries, { + name: 'entries' +}); // `URLSearchParams.prototype.toString` method // https://url.spec.whatwg.org/#urlsearchparams-stringification-behavior redefine(URLSearchParamsPrototype, 'toString', function toString() { - var entries = getInternalParamsState(this).entries; - var result = []; - var index = 0; - var entry; - - while (index < entries.length) { - entry = entries[index++]; - result.push(serialize(entry.key) + '=' + serialize(entry.value)); - } - - return result.join('&'); + return getInternalParamsState(this).serialize(); }, { enumerable: true }); @@ -15972,7 +17173,10 @@ $({ URLSearchParams: URLSearchParamsConstructor }); // Wrap `fetch` and `Request` for correct work with polyfilled `URLSearchParams` -if (!USE_NATIVE_URL && typeof Headers == 'function') { +if (!USE_NATIVE_URL && isCallable(Headers)) { + var headersHas = uncurryThis(HeadersPrototype.has); + var headersSet = uncurryThis(HeadersPrototype.set); + var wrapRequestOptions = function (init) { if (isObject(init)) { var body = init.body; @@ -15981,12 +17185,12 @@ if (!USE_NATIVE_URL && typeof Headers == 'function') { if (classof(body) === URL_SEARCH_PARAMS) { headers = init.headers ? new Headers(init.headers) : new Headers(); - if (!headers.has('content-type')) { - headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8'); + if (!headersHas(headers, 'content-type')) { + headersSet(headers, 'content-type', 'application/x-www-form-urlencoded;charset=UTF-8'); } return create(init, { - body: createPropertyDescriptor(0, String(body)), + body: createPropertyDescriptor(0, $toString(body)), headers: createPropertyDescriptor(0, headers) }); } @@ -15995,7 +17199,7 @@ if (!USE_NATIVE_URL && typeof Headers == 'function') { return init; }; - if (typeof nativeFetch == 'function') { + if (isCallable(n$Fetch)) { $({ global: true, enumerable: true, @@ -16004,17 +17208,17 @@ if (!USE_NATIVE_URL && typeof Headers == 'function') { fetch: function fetch(input /* , init */ ) { - return nativeFetch(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {}); + return n$Fetch(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {}); } }); } - if (typeof NativeRequest == 'function') { + if (isCallable(N$Request)) { var RequestConstructor = function Request(input /* , init */ ) { - anInstance(this, RequestConstructor, 'Request'); - return new NativeRequest(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {}); + anInstance(this, RequestPrototype); + return new N$Request(input, arguments.length > 1 ? wrapRequestOptions(arguments[1]) : {}); }; RequestPrototype.constructor = RequestConstructor; @@ -16034,13 +17238,15 @@ module.exports = { }; /***/ }), -/* 402 */ +/* 426 */ /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var $ = __webpack_require__(2); // `URL.prototype.toJSON` method +var $ = __webpack_require__(2); + +var call = __webpack_require__(7); // `URL.prototype.toJSON` method // https://url.spec.whatwg.org/#dom-url-tojson @@ -16050,12 +17256,12 @@ $({ enumerable: true }, { toJSON: function toJSON() { - return URL.prototype.toString.call(this); + return call(URL.prototype.toString, this); } }); /***/ }), -/* 403 */ +/* 427 */ /***/ ((module) => { /** @@ -16783,11 +17989,11 @@ try { } /***/ }), -/* 404 */ +/* 428 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(445); +/* provided dependency */ var process = __webpack_require__(494); /** * @fileoverview Main Linter Class * @author Gyandeep Singh @@ -16797,35 +18003,40 @@ try { // Requirements //------------------------------------------------------------------------------ -const path = __webpack_require__(405), - eslintScope = __webpack_require__(406), - evk = __webpack_require__(421), - espree = __webpack_require__(423), - merge = __webpack_require__(434), - BuiltInEnvironments = __webpack_require__(435), - pkg = __webpack_require__(438), - astUtils = __webpack_require__(439), - ConfigOps = __webpack_require__(440), - ConfigValidator = __webpack_require__(441), +const path = __webpack_require__(429), + eslintScope = __webpack_require__(430), + evk = __webpack_require__(435), + espree = __webpack_require__(436), + merge = __webpack_require__(442), + pkg = __webpack_require__(443), + astUtils = __webpack_require__(444), + { + Legacy: { + ConfigOps, + ConfigValidator, + environments: BuiltInEnvironments + } +} = __webpack_require__(445), Traverser = __webpack_require__(495), { SourceCode } = __webpack_require__(499), CodePathAnalyzer = __webpack_require__(517), applyDisableDirectives = __webpack_require__(524), - ConfigCommentParser = __webpack_require__(525), - NodeEventGenerator = __webpack_require__(538), - createReportTranslator = __webpack_require__(540), - Rules = __webpack_require__(543), - createEmitter = __webpack_require__(854), - SourceCodeFixer = __webpack_require__(855), - timing = __webpack_require__(856), - ruleReplacements = __webpack_require__(857); + ConfigCommentParser = __webpack_require__(526), + NodeEventGenerator = __webpack_require__(539), + createReportTranslator = __webpack_require__(541), + Rules = __webpack_require__(544), + createEmitter = __webpack_require__(855), + SourceCodeFixer = __webpack_require__(856), + timing = __webpack_require__(857), + ruleReplacements = __webpack_require__(858); const debug = __webpack_require__(496)("eslint:linter"); const MAX_AUTOFIX_PASSES = 10; const DEFAULT_PARSER_NAME = "espree"; +const DEFAULT_ECMA_VERSION = 5; const commentParser = new ConfigCommentParser(); const DEFAULT_ERROR_LOC = { start: { @@ -16836,13 +18047,14 @@ const DEFAULT_ERROR_LOC = { line: 1, column: 1 } -}; //------------------------------------------------------------------------------ +}; +const parserSymbol = Symbol.for("eslint.RuleTester.parser"); //------------------------------------------------------------------------------ // Typedefs //------------------------------------------------------------------------------ -/** @typedef {InstanceType} ConfigArray */ +/** @typedef {InstanceType} ConfigArray */ -/** @typedef {InstanceType} ExtractedConfig */ +/** @typedef {InstanceType} ExtractedConfig */ /** @typedef {import("../shared/types").ConfigData} ConfigData */ @@ -16858,17 +18070,21 @@ const DEFAULT_ERROR_LOC = { /** @typedef {import("../shared/types").Rule} Rule */ +/* eslint-disable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/4#issuecomment-778805577 */ + /** * @template T * @typedef {{ [P in keyof T]-?: T[P] }} Required */ +/* eslint-enable jsdoc/valid-types -- https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/4#issuecomment-778805577 */ + /** * @typedef {Object} DisableDirective - * @property {("disable"|"enable"|"disable-line"|"disable-next-line")} type - * @property {number} line - * @property {number} column - * @property {(string|null)} ruleId + * @property {("disable"|"enable"|"disable-line"|"disable-next-line")} type Type of directive + * @property {number} line The line number + * @property {number} column The column number + * @property {(string|null)} ruleId The rule ID */ /** @@ -16896,12 +18112,12 @@ const DEFAULT_ERROR_LOC = { * @typedef {Object} ProcessorOptions * @property {(filename:string, text:string) => boolean} [filterCodeBlock] the * predicate function that selects adopt code blocks. - * @property {Processor["postprocess"]} [postprocess] postprocessor for report + * @property {Processor.postprocess} [postprocess] postprocessor for report * messages. If provided, this should accept an array of the message lists * for each code block returned from the preprocessor, apply a mapping to * the messages as appropriate, and return a one-dimensional array of * messages. - * @property {Processor["preprocess"]} [preprocess] preprocessor for source text. + * @property {Processor.preprocess} [preprocess] preprocessor for source text. * If provided, this should accept a string of source text, and return an * array of code blocks to lint. */ @@ -16931,10 +18147,12 @@ const DEFAULT_ERROR_LOC = { * @returns {void} */ -function addDeclaredGlobals(globalScope, configGlobals, { - exportedVariables, - enabledGlobals -}) { +function addDeclaredGlobals(globalScope, configGlobals, _ref) { + let { + exportedVariables, + enabledGlobals + } = _ref; + // Define configured global variables. for (const id of new Set([...Object.keys(configGlobals), ...Object.keys(enabledGlobals)])) { /* @@ -17004,7 +18222,7 @@ function addDeclaredGlobals(globalScope, configGlobals, { function createMissingRuleMessage(ruleId) { - return Object.prototype.hasOwnProperty.call(ruleReplacements.rules, ruleId) ? `Rule '${ruleId}' was removed and replaced by: ${ruleReplacements.rules[ruleId].join(", ")}` : `Definition for rule '${ruleId}' was not found.`; + return Object.prototype.hasOwnProperty.call(ruleReplacements.rules, ruleId) ? "Rule '".concat(ruleId, "' was removed and replaced by: ").concat(ruleReplacements.rules[ruleId].join(", ")) : "Definition for rule '".concat(ruleId, "' was not found."); } /** * creates a linting problem @@ -17040,7 +18258,7 @@ function createLintingProblem(options) { * Creates a collection of disable directives from a comment * @param {Object} options to create disable directives * @param {("disable"|"enable"|"disable-line"|"disable-next-line")} options.type The type of directive comment - * @param {{line: number, column: number}} options.loc The 0-based location of the comment token + * @param {token} options.commentToken The Comment token * @param {string} options.value The value after the directive in the comment * comment specified no specific rules, so it applies to all rules (e.g. `eslint-disable`) * @param {function(string): {create: Function}} options.ruleMapper A map from rule IDs to defined rules @@ -17050,8 +18268,8 @@ function createLintingProblem(options) { function createDisableDirectives(options) { const { + commentToken, type, - loc, value, ruleMapper } = options; @@ -17063,20 +18281,25 @@ function createDisableDirectives(options) { directiveProblems: [] // problems in directives }; + const parentComment = { + commentToken, + ruleIds + }; for (const ruleId of directiveRules) { // push to directives, if the rule is defined(including null, e.g. /*eslint enable*/) if (ruleId === null || ruleMapper(ruleId) !== null) { result.directives.push({ + parentComment, type, - line: loc.start.line, - column: loc.start.column + 1, + line: commentToken.loc.start.line, + column: commentToken.loc.start.column + 1, ruleId }); } else { result.directiveProblems.push(createLintingProblem({ ruleId, - loc + loc: commentToken.loc })); } } @@ -17131,10 +18354,10 @@ function getDirectiveComments(filename, ast, ruleMapper, warnInlineConfig) { } if (warnInlineConfig) { - const kind = comment.type === "Block" ? `/*${directiveText}*/` : `//${directiveText}`; + const kind = comment.type === "Block" ? "/*".concat(directiveText, "*/") : "//".concat(directiveText); problems.push(createLintingProblem({ ruleId: null, - message: `'${kind}' has no effect because you have 'noInlineConfig' setting in ${warnInlineConfig}.`, + message: "'".concat(kind, "' has no effect because you have 'noInlineConfig' setting in ").concat(warnInlineConfig, "."), loc: comment.loc, severity: 1 })); @@ -17142,7 +18365,7 @@ function getDirectiveComments(filename, ast, ruleMapper, warnInlineConfig) { } if (lineCommentSupported && comment.loc.start.line !== comment.loc.end.line) { - const message = `${directiveText} comment should not span multiple lines.`; + const message = "".concat(directiveText, " comment should not span multiple lines."); problems.push(createLintingProblem({ ruleId: null, message, @@ -17161,8 +18384,8 @@ function getDirectiveComments(filename, ast, ruleMapper, warnInlineConfig) { { const directiveType = directiveText.slice("eslint-".length); const options = { + commentToken: comment, type: directiveType, - loc: comment.loc, value: directiveValue, ruleMapper }; @@ -17260,20 +18483,28 @@ function getDirectiveComments(filename, ast, ruleMapper, warnInlineConfig) { } /** * Normalize ECMAScript version from the initial config - * @param {number} ecmaVersion ECMAScript version from the initial config + * @param {Parser} parser The parser which uses this options. + * @param {number} ecmaVersion ECMAScript version from the initial config * @returns {number} normalized ECMAScript version */ -function normalizeEcmaVersion(ecmaVersion) { +function normalizeEcmaVersion(parser, ecmaVersion) { + if ((parser[parserSymbol] || parser) === espree) { + if (ecmaVersion === "latest") { + return espree.latestEcmaVersion; + } + } /* * Calculate ECMAScript edition number from official year version starting with * ES2015, which corresponds with ES6 (or a difference of 2009). */ + + return ecmaVersion >= 2015 ? ecmaVersion - 2009 : ecmaVersion; } -const eslintEnvPattern = /\/\*\s*eslint-env\s(.+?)\*\//gsu; +const eslintEnvPattern = /\/\*\s*eslint-env\s(.+?)(?:\*\/|$)/gsu; /** * Checks whether or not there is a comment which has "eslint-env *" in a given text. * @param {string} text A source code text to check. @@ -17285,7 +18516,9 @@ function findEslintEnv(text) { eslintEnvPattern.lastIndex = 0; while ((match = eslintEnvPattern.exec(text)) !== null) { - retv = Object.assign(retv || {}, commentParser.parseListConfig(stripDirectiveComment(match[1]))); + if (match[0].endsWith("*/")) { + retv = Object.assign(retv || {}, commentParser.parseListConfig(stripDirectiveComment(match[1]))); + } } return retv; @@ -17321,7 +18554,7 @@ function normalizeFilename(filename) { function normalizeVerifyOptions(providedOptions, config) { const disableInlineConfig = config.noInlineConfig === true; const ignoreInlineConfig = providedOptions.allowInlineConfig === false; - const configNameOfNoInlineConfig = config.configNameOfNoInlineConfig ? ` (${config.configNameOfNoInlineConfig})` : ""; + const configNameOfNoInlineConfig = config.configNameOfNoInlineConfig ? " (".concat(config.configNameOfNoInlineConfig, ")") : ""; let reportUnusedDisableDirectives = providedOptions.reportUnusedDisableDirectives; if (typeof reportUnusedDisableDirectives === "boolean") { @@ -17335,21 +18568,21 @@ function normalizeVerifyOptions(providedOptions, config) { return { filename: normalizeFilename(providedOptions.filename || ""), allowInlineConfig: !ignoreInlineConfig, - warnInlineConfig: disableInlineConfig && !ignoreInlineConfig ? `your config${configNameOfNoInlineConfig}` : null, + warnInlineConfig: disableInlineConfig && !ignoreInlineConfig ? "your config".concat(configNameOfNoInlineConfig) : null, reportUnusedDisableDirectives, disableFixes: Boolean(providedOptions.disableFixes) }; } /** * Combines the provided parserOptions with the options from environments - * @param {string} parserName The parser name which uses this options. + * @param {Parser} parser The parser which uses this options. * @param {ParserOptions} providedOptions The provided 'parserOptions' key in a config * @param {Environment[]} enabledEnvironments The environments enabled in configuration and with inline comments * @returns {ParserOptions} Resulting parser options after merge */ -function resolveParserOptions(parserName, providedOptions, enabledEnvironments) { +function resolveParserOptions(parser, providedOptions, enabledEnvironments) { const parserOptionsFromEnv = enabledEnvironments.filter(env => env.parserOptions).reduce((parserOptions, env) => merge(parserOptions, env.parserOptions), {}); const mergedParserOptions = merge(parserOptionsFromEnv, providedOptions || {}); const isModule = mergedParserOptions.sourceType === "module"; @@ -17363,14 +18596,8 @@ function resolveParserOptions(parserName, providedOptions, enabledEnvironments) globalReturn: false }); } - /* - * TODO: @aladdin-add - * 1. for a 3rd-party parser, do not normalize parserOptions - * 2. for espree, no need to do this (espree will do it) - */ - - mergedParserOptions.ecmaVersion = normalizeEcmaVersion(mergedParserOptions.ecmaVersion); + mergedParserOptions.ecmaVersion = normalizeEcmaVersion(parser, mergedParserOptions.ecmaVersion); return mergedParserOptions; } /** @@ -17428,12 +18655,12 @@ function getRuleOptions(ruleConfig) { function analyzeScope(ast, parserOptions, visitorKeys) { const ecmaFeatures = parserOptions.ecmaFeatures || {}; - const ecmaVersion = parserOptions.ecmaVersion || 5; + const ecmaVersion = parserOptions.ecmaVersion || DEFAULT_ECMA_VERSION; return eslintScope.analyze(ast, { ignoreEval: true, nodejsScope: ecmaFeatures.globalReturn, impliedStrict: ecmaFeatures.impliedStrict, - ecmaVersion, + ecmaVersion: typeof ecmaVersion === "number" ? ecmaVersion : 6, sourceType: parserOptions.sourceType || "script", childVisitorKeys: visitorKeys || evk.KEYS, fallback: Traverser.getKeys @@ -17454,7 +18681,7 @@ function analyzeScope(ast, parserOptions, visitorKeys) { function parse(text, parser, providedParserOptions, filePath) { - const textToParse = stripUnicodeBOM(text).replace(astUtils.shebangPattern, (match, captured) => `//${captured}`); + const textToParse = stripUnicodeBOM(text).replace(astUtils.shebangPattern, (match, captured) => "//".concat(captured)); const parserOptions = Object.assign({}, providedParserOptions, { loc: true, range: true, @@ -17499,7 +18726,7 @@ function parse(text, parser, providedParserOptions, filePath) { }; } catch (ex) { // If the message includes a leading line number, strip it: - const message = `Parsing error: ${ex.message.replace(/^line \d+:/iu, "").trim()}`; + const message = "Parsing error: ".concat(ex.message.replace(/^line \d+:/iu, "").trim()); debug("%s\n%s", message, ex.stack); return { success: false, @@ -17572,6 +18799,7 @@ function markVariableAsUsed(scopeManager, currentNode, parserOptions, name) { * Runs a rule, and gets its listeners * @param {Rule} rule A normalized rule with a `create` method * @param {Context} ruleContext The context that should be passed to the rule + * @throws {any} Any error during the rule's `create` * @returns {Object} A map of selector listeners provided by the rule */ @@ -17580,7 +18808,7 @@ function createRuleListeners(rule, ruleContext) { try { return rule.create(ruleContext); } catch (ex) { - ex.message = `Error while loading rule '${ruleContext.id}': ${ex.message}`; + ex.message = "Error while loading rule '".concat(ruleContext.id, "': ").concat(ex.message); throw ex; } } @@ -17626,8 +18854,8 @@ const DEPRECATED_SOURCECODE_PASSTHROUGHS = { getTokensBetween: "getTokensBetween" }; const BASE_TRAVERSAL_CONTEXT = Object.freeze(Object.keys(DEPRECATED_SOURCECODE_PASSTHROUGHS).reduce((contextInfo, methodName) => Object.assign(contextInfo, { - [methodName](...args) { - return this.getSourceCode()[DEPRECATED_SOURCECODE_PASSTHROUGHS[methodName]](...args); + [methodName]() { + return this.getSourceCode()[DEPRECATED_SOURCECODE_PASSTHROUGHS[methodName]](...arguments); } }), {})); @@ -17711,7 +18939,7 @@ function runRules(sourceCode, configuredRules, ruleMapper, parserOptions, parser id: ruleId, options: getRuleOptions(configuredRules[ruleId]), - report(...args) { + report() { /* * Create a report translator lazily. * In a vast majority of cases, any given rule reports zero errors on a given @@ -17732,20 +18960,47 @@ function runRules(sourceCode, configuredRules, ruleMapper, parserOptions, parser }); } - const problem = reportTranslator(...args); + const problem = reportTranslator(...arguments); - if (problem.fix && rule.meta && !rule.meta.fixable) { - throw new Error("Fixable rules should export a `meta.fixable` property."); + if (problem.fix && !(rule.meta && rule.meta.fixable)) { + throw new Error("Fixable rules must set the `meta.fixable` property to \"code\" or \"whitespace\"."); + } + + if (problem.suggestions && !(rule.meta && rule.meta.hasSuggestions === true)) { + if (rule.meta && rule.meta.docs && typeof rule.meta.docs.suggestion !== "undefined") { + // Encourage migration from the former property name. + throw new Error("Rules with suggestions must set the `meta.hasSuggestions` property to `true`. `meta.docs.suggestion` is ignored by ESLint."); + } + + throw new Error("Rules with suggestions must set the `meta.hasSuggestions` property to `true`."); } lintingProblems.push(problem); } })); - const ruleListeners = createRuleListeners(rule, ruleContext); // add all the selectors from the rule as listeners + const ruleListeners = createRuleListeners(rule, ruleContext); + /** + * Include `ruleId` in error logs + * @param {Function} ruleListener A rule method that listens for a node. + * @returns {Function} ruleListener wrapped in error handler + */ + + function addRuleErrorHandler(ruleListener) { + return function ruleErrorHandler() { + try { + return ruleListener(...arguments); + } catch (e) { + e.ruleId = ruleId; + throw e; + } + }; + } // add all the selectors from the rule as listeners + Object.keys(ruleListeners).forEach(selector => { - emitter.on(selector, timing.enabled ? timing.time(ruleId, ruleListeners[selector]) : ruleListeners[selector]); + const ruleListener = timing.enabled ? timing.time(ruleId, ruleListeners[selector]) : ruleListeners[selector]; + emitter.on(selector, addRuleErrorHandler(ruleListener)); }); }); // only run code path analyzer if the top level node is "Program", skip otherwise @@ -17828,7 +19083,7 @@ function normalizeCwd(cwd) { if (typeof process === "object") { return process.cwd(); } // It's more explicit to assign the undefined - // eslint-disable-next-line no-undefined + // eslint-disable-next-line no-undefined -- Consistently returning a value return undefined; @@ -17852,11 +19107,12 @@ class Linter { /** * Initialize the Linter. * @param {Object} [config] the config object - * @param {string} [config.cwd] path to a directory that should be considered as the current working directory, can be undefined. + * @param {string} [config.cwd] path to a directory that should be considered as the current working directory, can be undefined. */ - constructor({ - cwd - } = {}) { + constructor() { + let { + cwd + } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; internalSlotsMap.set(this, { cwd: normalizeCwd(cwd), lastConfigArray: null, @@ -17881,6 +19137,7 @@ class Linter { * @param {string|SourceCode} textOrSourceCode The text to parse or a SourceCode object. * @param {ConfigData} providedConfig An ESLintConfig instance to configure everything. * @param {VerifyOptions} [providedOptions] The optional filename of the file being checked. + * @throws {Error} If during rule execution. * @returns {LintMessage[]} The results as an array of messages or an empty array if no messages. */ @@ -17912,7 +19169,7 @@ class Linter { ruleId: null, fatal: true, severity: 2, - message: `Configured parser '${config.parser}' was not found.`, + message: "Configured parser '".concat(config.parser, "' was not found."), line: 0, column: 0 }]; @@ -17928,7 +19185,7 @@ class Linter { builtin: true }, config.env, envInFile); const enabledEnvs = Object.keys(resolvedEnvConfig).filter(envName => resolvedEnvConfig[envName]).map(envName => getEnv(slots, envName)).filter(env => env); - const parserOptions = resolveParserOptions(parserName, config.parserOptions || {}, enabledEnvs); + const parserOptions = resolveParserOptions(parser, config.parserOptions || {}, enabledEnvs); const configuredGlobals = resolveGlobals(config.globals || {}, enabledEnvs); const settings = config.settings || {}; @@ -17975,7 +19232,7 @@ class Linter { try { lintingProblems = runRules(sourceCode, configuredRules, ruleId => getRule(slots, ruleId), parserOptions, parserName, settings, options.filename, options.disableFixes, slots.cwd, providedOptions.physicalFilename); } catch (err) { - err.message += `\nOccurred while linting ${options.filename}`; + err.message += "\nOccurred while linting ".concat(options.filename); debug("An error occurred while traversing"); debug("Filename:", options.filename); @@ -17984,17 +19241,23 @@ class Linter { line } = err.currentNode.loc.start; debug("Line:", line); - err.message += `:${line}`; + err.message += ":".concat(line); } debug("Parser Options:", parserOptions); debug("Parser Path:", parserName); debug("Settings:", settings); + + if (err.ruleId) { + err.message += "\nRule: \"".concat(err.ruleId, "\""); + } + throw err; } return applyDisableDirectives({ directives: commentDirectives.disableDirectives, + disableFixes: options.disableFixes, problems: lintingProblems.concat(commentDirectives.problems).sort((problemA, problemB) => problemA.line - problemB.line || problemA.column - problemB.column), reportUnusedDisableDirectives: options.reportUnusedDisableDirectives }); @@ -18081,10 +19344,9 @@ class Linter { const physicalFilename = options.physicalFilename || filenameToExpose; const text = ensureText(textOrSourceCode); - const preprocess = options.preprocess || (rawText => [rawText]); // TODO(stephenwade): Replace this with array.flat() when we drop support for Node v10 + const preprocess = options.preprocess || (rawText => [rawText]); - - const postprocess = options.postprocess || (array => [].concat(...array)); + const postprocess = options.postprocess || (messagesList => messagesList.flat()); const filterCodeBlock = options.filterCodeBlock || (blockFilename => blockFilename.endsWith(".js")); @@ -18097,7 +19359,7 @@ class Linter { } const blockText = block.text; - const blockName = path.join(filename, `${i}_${block.filename}`); // Skip this block if filtered. + const blockName = path.join(filename, "".concat(i, "_").concat(block.filename)); // Skip this block if filtered. if (!filterCodeBlock(blockName, blockText)) { debug("This code block was skipped."); @@ -18200,7 +19462,7 @@ class Linter { fixed = false, passNumber = 0, currentText = text; - const debugTextDescription = options && options.filename || `${text.slice(0, 10)}...`; + const debugTextDescription = options && options.filename || "".concat(text.slice(0, 10), "..."); const shouldFix = options && typeof options.fix !== "undefined" ? options.fix : true; /** * This loop continues until one of the following is true: @@ -18214,9 +19476,9 @@ class Linter { do { passNumber++; - debug(`Linting code for ${debugTextDescription} (pass ${passNumber})`); + debug("Linting code for ".concat(debugTextDescription, " (pass ").concat(passNumber, ")")); messages = this.verify(currentText, config, options); - debug(`Generating fixed text for ${debugTextDescription} (pass ${passNumber})`); + debug("Generating fixed text for ".concat(debugTextDescription, " (pass ").concat(passNumber, ")")); fixedResult = SourceCodeFixer.applyFixes(currentText, messages, shouldFix); /* * stop if there are any syntax errors. @@ -18265,2000 +19527,31 @@ module.exports = { }; /***/ }), -/* 405 */ +/* 429 */ /***/ ((module) => { "use strict"; module.exports = require("path"); /***/ }), -/* 406 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; -/* - Copyright (C) 2012-2014 Yusuke Suzuki - Copyright (C) 2013 Alex Seville - Copyright (C) 2014 Thiago de Arruda - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/** - * Escope (escope) is an ECMAScript - * scope analyzer extracted from the esmangle project. - *

- * escope finds lexical scopes in a source program, i.e. areas of that - * program where different occurrences of the same identifier refer to the same - * variable. With each scope the contained variables are collected, and each - * identifier reference in code is linked to its corresponding variable (if - * possible). - *

- * escope works on a syntax tree of the parsed source code which has - * to adhere to the - * Mozilla Parser API. E.g. espree is a parser - * that produces such syntax trees. - *

- * The main interface is the {@link analyze} function. - * @module escope - */ - -/* eslint no-underscore-dangle: ["error", { "allow": ["__currentScope"] }] */ - -const assert = __webpack_require__(407); - -const ScopeManager = __webpack_require__(408); - -const Referencer = __webpack_require__(415); - -const Reference = __webpack_require__(412); - -const Variable = __webpack_require__(413); - -const Scope = __webpack_require__(409).Scope; - -const version = __webpack_require__(420).version; -/** - * Set the default options - * @returns {Object} options - */ - - -function defaultOptions() { - return { - optimistic: false, - directive: false, - nodejsScope: false, - impliedStrict: false, - sourceType: "script", - // one of ['script', 'module'] - ecmaVersion: 5, - childVisitorKeys: null, - fallback: "iteration" - }; -} -/** - * Preform deep update on option object - * @param {Object} target - Options - * @param {Object} override - Updates - * @returns {Object} Updated options - */ - - -function updateDeeply(target, override) { - /** - * Is hash object - * @param {Object} value - Test value - * @returns {boolean} Result - */ - function isHashObject(value) { - return typeof value === "object" && value instanceof Object && !(value instanceof Array) && !(value instanceof RegExp); - } - - for (const key in override) { - if (Object.prototype.hasOwnProperty.call(override, key)) { - const val = override[key]; - - if (isHashObject(val)) { - if (isHashObject(target[key])) { - updateDeeply(target[key], val); - } else { - target[key] = updateDeeply({}, val); - } - } else { - target[key] = val; - } - } - } - - return target; -} -/** - * Main interface function. Takes an Espree syntax tree and returns the - * analyzed scopes. - * @function analyze - * @param {espree.Tree} tree - Abstract Syntax Tree - * @param {Object} providedOptions - Options that tailor the scope analysis - * @param {boolean} [providedOptions.optimistic=false] - the optimistic flag - * @param {boolean} [providedOptions.directive=false]- the directive flag - * @param {boolean} [providedOptions.ignoreEval=false]- whether to check 'eval()' calls - * @param {boolean} [providedOptions.nodejsScope=false]- whether the whole - * script is executed under node.js environment. When enabled, escope adds - * a function scope immediately following the global scope. - * @param {boolean} [providedOptions.impliedStrict=false]- implied strict mode - * (if ecmaVersion >= 5). - * @param {string} [providedOptions.sourceType='script']- the source type of the script. one of 'script' and 'module' - * @param {number} [providedOptions.ecmaVersion=5]- which ECMAScript version is considered - * @param {Object} [providedOptions.childVisitorKeys=null] - Additional known visitor keys. See [esrecurse](https://github.com/estools/esrecurse)'s the `childVisitorKeys` option. - * @param {string} [providedOptions.fallback='iteration'] - A kind of the fallback in order to encounter with unknown node. See [esrecurse](https://github.com/estools/esrecurse)'s the `fallback` option. - * @returns {ScopeManager} ScopeManager - */ - - -function analyze(tree, providedOptions) { - const options = updateDeeply(defaultOptions(), providedOptions); - const scopeManager = new ScopeManager(options); - const referencer = new Referencer(options, scopeManager); - referencer.visit(tree); - assert(scopeManager.__currentScope === null, "currentScope should be null."); - return scopeManager; -} - -module.exports = { - /** @name module:escope.version */ - version, - - /** @name module:escope.Reference */ - Reference, - - /** @name module:escope.Variable */ - Variable, - - /** @name module:escope.Scope */ - Scope, - - /** @name module:escope.ScopeManager */ - ScopeManager, - analyze -}; -/* vim: set sw=4 ts=4 et tw=80 : */ - -/***/ }), -/* 407 */ -/***/ ((module) => { - -"use strict"; -module.exports = require("assert"); - -/***/ }), -/* 408 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; -/* - Copyright (C) 2015 Yusuke Suzuki - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* eslint-disable no-underscore-dangle */ - -const Scope = __webpack_require__(409); - -const assert = __webpack_require__(407); - -const GlobalScope = Scope.GlobalScope; -const CatchScope = Scope.CatchScope; -const WithScope = Scope.WithScope; -const ModuleScope = Scope.ModuleScope; -const ClassScope = Scope.ClassScope; -const SwitchScope = Scope.SwitchScope; -const FunctionScope = Scope.FunctionScope; -const ForScope = Scope.ForScope; -const FunctionExpressionNameScope = Scope.FunctionExpressionNameScope; -const BlockScope = Scope.BlockScope; -/** - * @class ScopeManager - */ - -class ScopeManager { - constructor(options) { - this.scopes = []; - this.globalScope = null; - this.__nodeToScope = new WeakMap(); - this.__currentScope = null; - this.__options = options; - this.__declaredVariables = new WeakMap(); - } - - __useDirective() { - return this.__options.directive; - } - - __isOptimistic() { - return this.__options.optimistic; - } - - __ignoreEval() { - return this.__options.ignoreEval; - } - - __isNodejsScope() { - return this.__options.nodejsScope; - } - - isModule() { - return this.__options.sourceType === "module"; - } - - isImpliedStrict() { - return this.__options.impliedStrict; - } - - isStrictModeSupported() { - return this.__options.ecmaVersion >= 5; - } // Returns appropriate scope for this node. - - - __get(node) { - return this.__nodeToScope.get(node); - } - /** - * Get variables that are declared by the node. - * - * "are declared by the node" means the node is same as `Variable.defs[].node` or `Variable.defs[].parent`. - * If the node declares nothing, this method returns an empty array. - * CAUTION: This API is experimental. See https://github.com/estools/escope/pull/69 for more details. - * - * @param {Espree.Node} node - a node to get. - * @returns {Variable[]} variables that declared by the node. - */ - - - getDeclaredVariables(node) { - return this.__declaredVariables.get(node) || []; - } - /** - * acquire scope from node. - * @method ScopeManager#acquire - * @param {Espree.Node} node - node for the acquired scope. - * @param {boolean=} inner - look up the most inner scope, default value is false. - * @returns {Scope?} Scope from node - */ - - - acquire(node, inner) { - /** - * predicate - * @param {Scope} testScope - scope to test - * @returns {boolean} predicate - */ - function predicate(testScope) { - if (testScope.type === "function" && testScope.functionExpressionScope) { - return false; - } - - return true; - } - - const scopes = this.__get(node); - - if (!scopes || scopes.length === 0) { - return null; - } // Heuristic selection from all scopes. - // If you would like to get all scopes, please use ScopeManager#acquireAll. - - - if (scopes.length === 1) { - return scopes[0]; - } - - if (inner) { - for (let i = scopes.length - 1; i >= 0; --i) { - const scope = scopes[i]; - - if (predicate(scope)) { - return scope; - } - } - } else { - for (let i = 0, iz = scopes.length; i < iz; ++i) { - const scope = scopes[i]; - - if (predicate(scope)) { - return scope; - } - } - } - - return null; - } - /** - * acquire all scopes from node. - * @method ScopeManager#acquireAll - * @param {Espree.Node} node - node for the acquired scope. - * @returns {Scopes?} Scope array - */ - - - acquireAll(node) { - return this.__get(node); - } - /** - * release the node. - * @method ScopeManager#release - * @param {Espree.Node} node - releasing node. - * @param {boolean=} inner - look up the most inner scope, default value is false. - * @returns {Scope?} upper scope for the node. - */ - - - release(node, inner) { - const scopes = this.__get(node); - - if (scopes && scopes.length) { - const scope = scopes[0].upper; - - if (!scope) { - return null; - } - - return this.acquire(scope.block, inner); - } - - return null; - } - - attach() {} // eslint-disable-line class-methods-use-this - - - detach() {} // eslint-disable-line class-methods-use-this - - - __nestScope(scope) { - if (scope instanceof GlobalScope) { - assert(this.__currentScope === null); - this.globalScope = scope; - } - - this.__currentScope = scope; - return scope; - } - - __nestGlobalScope(node) { - return this.__nestScope(new GlobalScope(this, node)); - } - - __nestBlockScope(node) { - return this.__nestScope(new BlockScope(this, this.__currentScope, node)); - } - - __nestFunctionScope(node, isMethodDefinition) { - return this.__nestScope(new FunctionScope(this, this.__currentScope, node, isMethodDefinition)); - } - - __nestForScope(node) { - return this.__nestScope(new ForScope(this, this.__currentScope, node)); - } - - __nestCatchScope(node) { - return this.__nestScope(new CatchScope(this, this.__currentScope, node)); - } - - __nestWithScope(node) { - return this.__nestScope(new WithScope(this, this.__currentScope, node)); - } - - __nestClassScope(node) { - return this.__nestScope(new ClassScope(this, this.__currentScope, node)); - } - - __nestSwitchScope(node) { - return this.__nestScope(new SwitchScope(this, this.__currentScope, node)); - } - - __nestModuleScope(node) { - return this.__nestScope(new ModuleScope(this, this.__currentScope, node)); - } - - __nestFunctionExpressionNameScope(node) { - return this.__nestScope(new FunctionExpressionNameScope(this, this.__currentScope, node)); - } - - __isES6() { - return this.__options.ecmaVersion >= 6; - } - -} - -module.exports = ScopeManager; -/* vim: set sw=4 ts=4 et tw=80 : */ - -/***/ }), -/* 409 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; -/* - Copyright (C) 2015 Yusuke Suzuki - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/* eslint-disable no-underscore-dangle */ - -/* eslint-disable no-undefined */ - -const Syntax = __webpack_require__(410).Syntax; - -const Reference = __webpack_require__(412); - -const Variable = __webpack_require__(413); - -const Definition = __webpack_require__(414).Definition; - -const assert = __webpack_require__(407); -/** - * Test if scope is struct - * @param {Scope} scope - scope - * @param {Block} block - block - * @param {boolean} isMethodDefinition - is method definition - * @param {boolean} useDirective - use directive - * @returns {boolean} is strict scope - */ - - -function isStrictScope(scope, block, isMethodDefinition, useDirective) { - let body; // When upper scope is exists and strict, inner scope is also strict. - - if (scope.upper && scope.upper.isStrict) { - return true; - } - - if (isMethodDefinition) { - return true; - } - - if (scope.type === "class" || scope.type === "module") { - return true; - } - - if (scope.type === "block" || scope.type === "switch") { - return false; - } - - if (scope.type === "function") { - if (block.type === Syntax.ArrowFunctionExpression && block.body.type !== Syntax.BlockStatement) { - return false; - } - - if (block.type === Syntax.Program) { - body = block; - } else { - body = block.body; - } - - if (!body) { - return false; - } - } else if (scope.type === "global") { - body = block; - } else { - return false; - } // Search 'use strict' directive. - - - if (useDirective) { - for (let i = 0, iz = body.body.length; i < iz; ++i) { - const stmt = body.body[i]; - - if (stmt.type !== Syntax.DirectiveStatement) { - break; - } - - if (stmt.raw === "\"use strict\"" || stmt.raw === "'use strict'") { - return true; - } - } - } else { - for (let i = 0, iz = body.body.length; i < iz; ++i) { - const stmt = body.body[i]; - - if (stmt.type !== Syntax.ExpressionStatement) { - break; - } - - const expr = stmt.expression; - - if (expr.type !== Syntax.Literal || typeof expr.value !== "string") { - break; - } - - if (expr.raw !== null && expr.raw !== undefined) { - if (expr.raw === "\"use strict\"" || expr.raw === "'use strict'") { - return true; - } - } else { - if (expr.value === "use strict") { - return true; - } - } - } - } - - return false; -} -/** - * Register scope - * @param {ScopeManager} scopeManager - scope manager - * @param {Scope} scope - scope - * @returns {void} - */ - - -function registerScope(scopeManager, scope) { - scopeManager.scopes.push(scope); - - const scopes = scopeManager.__nodeToScope.get(scope.block); - - if (scopes) { - scopes.push(scope); - } else { - scopeManager.__nodeToScope.set(scope.block, [scope]); - } -} -/** - * Should be statically - * @param {Object} def - def - * @returns {boolean} should be statically - */ - - -function shouldBeStatically(def) { - return def.type === Variable.ClassName || def.type === Variable.Variable && def.parent.kind !== "var"; -} -/** - * @class Scope - */ - - -class Scope { - constructor(scopeManager, type, upperScope, block, isMethodDefinition) { - /** - * One of 'module', 'block', 'switch', 'function', 'catch', 'with', 'function', 'class', 'global'. - * @member {String} Scope#type - */ - this.type = type; - /** - * The scoped {@link Variable}s of this scope, as { Variable.name - * : Variable }. - * @member {Map} Scope#set - */ - - this.set = new Map(); - /** - * The tainted variables of this scope, as { Variable.name : - * boolean }. - * @member {Map} Scope#taints */ - - this.taints = new Map(); - /** - * Generally, through the lexical scoping of JS you can always know - * which variable an identifier in the source code refers to. There are - * a few exceptions to this rule. With 'global' and 'with' scopes you - * can only decide at runtime which variable a reference refers to. - * Moreover, if 'eval()' is used in a scope, it might introduce new - * bindings in this or its parent scopes. - * All those scopes are considered 'dynamic'. - * @member {boolean} Scope#dynamic - */ - - this.dynamic = this.type === "global" || this.type === "with"; - /** - * A reference to the scope-defining syntax node. - * @member {espree.Node} Scope#block - */ - - this.block = block; - /** - * The {@link Reference|references} that are not resolved with this scope. - * @member {Reference[]} Scope#through - */ - - this.through = []; - /** - * The scoped {@link Variable}s of this scope. In the case of a - * 'function' scope this includes the automatic argument arguments as - * its first element, as well as all further formal arguments. - * @member {Variable[]} Scope#variables - */ - - this.variables = []; - /** - * Any variable {@link Reference|reference} found in this scope. This - * includes occurrences of local variables as well as variables from - * parent scopes (including the global scope). For local variables - * this also includes defining occurrences (like in a 'var' statement). - * In a 'function' scope this does not include the occurrences of the - * formal parameter in the parameter list. - * @member {Reference[]} Scope#references - */ - - this.references = []; - /** - * For 'global' and 'function' scopes, this is a self-reference. For - * other scope types this is the variableScope value of the - * parent scope. - * @member {Scope} Scope#variableScope - */ - - this.variableScope = this.type === "global" || this.type === "function" || this.type === "module" ? this : upperScope.variableScope; - /** - * Whether this scope is created by a FunctionExpression. - * @member {boolean} Scope#functionExpressionScope - */ - - this.functionExpressionScope = false; - /** - * Whether this is a scope that contains an 'eval()' invocation. - * @member {boolean} Scope#directCallToEvalScope - */ - - this.directCallToEvalScope = false; - /** - * @member {boolean} Scope#thisFound - */ - - this.thisFound = false; - this.__left = []; - /** - * Reference to the parent {@link Scope|scope}. - * @member {Scope} Scope#upper - */ - - this.upper = upperScope; - /** - * Whether 'use strict' is in effect in this scope. - * @member {boolean} Scope#isStrict - */ - - this.isStrict = isStrictScope(this, block, isMethodDefinition, scopeManager.__useDirective()); - /** - * List of nested {@link Scope}s. - * @member {Scope[]} Scope#childScopes - */ - - this.childScopes = []; - - if (this.upper) { - this.upper.childScopes.push(this); - } - - this.__declaredVariables = scopeManager.__declaredVariables; - registerScope(scopeManager, this); - } - - __shouldStaticallyClose(scopeManager) { - return !this.dynamic || scopeManager.__isOptimistic(); - } - - __shouldStaticallyCloseForGlobal(ref) { - // On global scope, let/const/class declarations should be resolved statically. - const name = ref.identifier.name; - - if (!this.set.has(name)) { - return false; - } - - const variable = this.set.get(name); - const defs = variable.defs; - return defs.length > 0 && defs.every(shouldBeStatically); - } - - __staticCloseRef(ref) { - if (!this.__resolve(ref)) { - this.__delegateToUpperScope(ref); - } - } - - __dynamicCloseRef(ref) { - // notify all names are through to global - let current = this; - - do { - current.through.push(ref); - current = current.upper; - } while (current); - } - - __globalCloseRef(ref) { - // let/const/class declarations should be resolved statically. - // others should be resolved dynamically. - if (this.__shouldStaticallyCloseForGlobal(ref)) { - this.__staticCloseRef(ref); - } else { - this.__dynamicCloseRef(ref); - } - } - - __close(scopeManager) { - let closeRef; - - if (this.__shouldStaticallyClose(scopeManager)) { - closeRef = this.__staticCloseRef; - } else if (this.type !== "global") { - closeRef = this.__dynamicCloseRef; - } else { - closeRef = this.__globalCloseRef; - } // Try Resolving all references in this scope. - - - for (let i = 0, iz = this.__left.length; i < iz; ++i) { - const ref = this.__left[i]; - closeRef.call(this, ref); - } - - this.__left = null; - return this.upper; - } // To override by function scopes. - // References in default parameters isn't resolved to variables which are in their function body. - - - __isValidResolution(ref, variable) { - // eslint-disable-line class-methods-use-this, no-unused-vars - return true; - } - - __resolve(ref) { - const name = ref.identifier.name; - - if (!this.set.has(name)) { - return false; - } - - const variable = this.set.get(name); - - if (!this.__isValidResolution(ref, variable)) { - return false; - } - - variable.references.push(ref); - variable.stack = variable.stack && ref.from.variableScope === this.variableScope; - - if (ref.tainted) { - variable.tainted = true; - this.taints.set(variable.name, true); - } - - ref.resolved = variable; - return true; - } - - __delegateToUpperScope(ref) { - if (this.upper) { - this.upper.__left.push(ref); - } - - this.through.push(ref); - } - - __addDeclaredVariablesOfNode(variable, node) { - if (node === null || node === undefined) { - return; - } - - let variables = this.__declaredVariables.get(node); - - if (variables === null || variables === undefined) { - variables = []; - - this.__declaredVariables.set(node, variables); - } - - if (variables.indexOf(variable) === -1) { - variables.push(variable); - } - } - - __defineGeneric(name, set, variables, node, def) { - let variable; - variable = set.get(name); - - if (!variable) { - variable = new Variable(name, this); - set.set(name, variable); - variables.push(variable); - } - - if (def) { - variable.defs.push(def); - - this.__addDeclaredVariablesOfNode(variable, def.node); - - this.__addDeclaredVariablesOfNode(variable, def.parent); - } - - if (node) { - variable.identifiers.push(node); - } - } - - __define(node, def) { - if (node && node.type === Syntax.Identifier) { - this.__defineGeneric(node.name, this.set, this.variables, node, def); - } - } - - __referencing(node, assign, writeExpr, maybeImplicitGlobal, partial, init) { - // because Array element may be null - if (!node || node.type !== Syntax.Identifier) { - return; - } // Specially handle like `this`. - - - if (node.name === "super") { - return; - } - - const ref = new Reference(node, this, assign || Reference.READ, writeExpr, maybeImplicitGlobal, !!partial, !!init); - this.references.push(ref); - - this.__left.push(ref); - } - - __detectEval() { - let current = this; - this.directCallToEvalScope = true; - - do { - current.dynamic = true; - current = current.upper; - } while (current); - } - - __detectThis() { - this.thisFound = true; - } - - __isClosed() { - return this.__left === null; - } - /** - * returns resolved {Reference} - * @method Scope#resolve - * @param {Espree.Identifier} ident - identifier to be resolved. - * @returns {Reference} reference - */ - - - resolve(ident) { - let ref, i, iz; - assert(this.__isClosed(), "Scope should be closed."); - assert(ident.type === Syntax.Identifier, "Target should be identifier."); - - for (i = 0, iz = this.references.length; i < iz; ++i) { - ref = this.references[i]; - - if (ref.identifier === ident) { - return ref; - } - } - - return null; - } - /** - * returns this scope is static - * @method Scope#isStatic - * @returns {boolean} static - */ - - - isStatic() { - return !this.dynamic; - } - /** - * returns this scope has materialized arguments - * @method Scope#isArgumentsMaterialized - * @returns {boolean} arguemnts materialized - */ - - - isArgumentsMaterialized() { - // eslint-disable-line class-methods-use-this - return true; - } - /** - * returns this scope has materialized `this` reference - * @method Scope#isThisMaterialized - * @returns {boolean} this materialized - */ - - - isThisMaterialized() { - // eslint-disable-line class-methods-use-this - return true; - } - - isUsedName(name) { - if (this.set.has(name)) { - return true; - } - - for (let i = 0, iz = this.through.length; i < iz; ++i) { - if (this.through[i].identifier.name === name) { - return true; - } - } - - return false; - } - -} - -class GlobalScope extends Scope { - constructor(scopeManager, block) { - super(scopeManager, "global", null, block, false); - this.implicit = { - set: new Map(), - variables: [], - - /** - * List of {@link Reference}s that are left to be resolved (i.e. which - * need to be linked to the variable they refer to). - * @member {Reference[]} Scope#implicit#left - */ - left: [] - }; - } - - __close(scopeManager) { - const implicit = []; - - for (let i = 0, iz = this.__left.length; i < iz; ++i) { - const ref = this.__left[i]; - - if (ref.__maybeImplicitGlobal && !this.set.has(ref.identifier.name)) { - implicit.push(ref.__maybeImplicitGlobal); - } - } // create an implicit global variable from assignment expression - - - for (let i = 0, iz = implicit.length; i < iz; ++i) { - const info = implicit[i]; - - this.__defineImplicit(info.pattern, new Definition(Variable.ImplicitGlobalVariable, info.pattern, info.node, null, null, null)); - } - - this.implicit.left = this.__left; - return super.__close(scopeManager); - } - - __defineImplicit(node, def) { - if (node && node.type === Syntax.Identifier) { - this.__defineGeneric(node.name, this.implicit.set, this.implicit.variables, node, def); - } - } - -} - -class ModuleScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "module", upperScope, block, false); - } - -} - -class FunctionExpressionNameScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "function-expression-name", upperScope, block, false); - - this.__define(block.id, new Definition(Variable.FunctionName, block.id, block, null, null, null)); - - this.functionExpressionScope = true; - } - -} - -class CatchScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "catch", upperScope, block, false); - } - -} - -class WithScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "with", upperScope, block, false); - } - - __close(scopeManager) { - if (this.__shouldStaticallyClose(scopeManager)) { - return super.__close(scopeManager); - } - - for (let i = 0, iz = this.__left.length; i < iz; ++i) { - const ref = this.__left[i]; - ref.tainted = true; - - this.__delegateToUpperScope(ref); - } - - this.__left = null; - return this.upper; - } - -} - -class BlockScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "block", upperScope, block, false); - } - -} - -class SwitchScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "switch", upperScope, block, false); - } - -} - -class FunctionScope extends Scope { - constructor(scopeManager, upperScope, block, isMethodDefinition) { - super(scopeManager, "function", upperScope, block, isMethodDefinition); // section 9.2.13, FunctionDeclarationInstantiation. - // NOTE Arrow functions never have an arguments objects. - - if (this.block.type !== Syntax.ArrowFunctionExpression) { - this.__defineArguments(); - } - } - - isArgumentsMaterialized() { - // TODO(Constellation) - // We can more aggressive on this condition like this. - // - // function t() { - // // arguments of t is always hidden. - // function arguments() { - // } - // } - if (this.block.type === Syntax.ArrowFunctionExpression) { - return false; - } - - if (!this.isStatic()) { - return true; - } - - const variable = this.set.get("arguments"); - assert(variable, "Always have arguments variable."); - return variable.tainted || variable.references.length !== 0; - } - - isThisMaterialized() { - if (!this.isStatic()) { - return true; - } - - return this.thisFound; - } - - __defineArguments() { - this.__defineGeneric("arguments", this.set, this.variables, null, null); - - this.taints.set("arguments", true); - } // References in default parameters isn't resolved to variables which are in their function body. - // const x = 1 - // function f(a = x) { // This `x` is resolved to the `x` in the outer scope. - // const x = 2 - // console.log(a) - // } - - - __isValidResolution(ref, variable) { - // If `options.nodejsScope` is true, `this.block` becomes a Program node. - if (this.block.type === "Program") { - return true; - } - - const bodyStart = this.block.body.range[0]; // It's invalid resolution in the following case: - - return !(variable.scope === this && ref.identifier.range[0] < bodyStart && // the reference is in the parameter part. - variable.defs.every(d => d.name.range[0] >= bodyStart) // the variable is in the body. - ); - } - -} - -class ForScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "for", upperScope, block, false); - } - -} - -class ClassScope extends Scope { - constructor(scopeManager, upperScope, block) { - super(scopeManager, "class", upperScope, block, false); - } - -} - -module.exports = { - Scope, - GlobalScope, - ModuleScope, - FunctionExpressionNameScope, - CatchScope, - WithScope, - BlockScope, - SwitchScope, - FunctionScope, - ForScope, - ClassScope -}; -/* vim: set sw=4 ts=4 et tw=80 : */ - -/***/ }), -/* 410 */ +/* 430 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { -/* - Copyright (C) 2012-2013 Yusuke Suzuki - Copyright (C) 2012 Ariya Hidayat - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -/*jslint vars:false, bitwise:true*/ - -/*jshint indent:4*/ - -/*global exports:true*/ -(function clone(exports) { - 'use strict'; - - var Syntax, VisitorOption, VisitorKeys, BREAK, SKIP, REMOVE; - - function deepCopy(obj) { - var ret = {}, - key, - val; - - for (key in obj) { - if (obj.hasOwnProperty(key)) { - val = obj[key]; - - if (typeof val === 'object' && val !== null) { - ret[key] = deepCopy(val); - } else { - ret[key] = val; - } - } - } - - return ret; - } // based on LLVM libc++ upper_bound / lower_bound - // MIT License - - - function upperBound(array, func) { - var diff, len, i, current; - len = array.length; - i = 0; - - while (len) { - diff = len >>> 1; - current = i + diff; - - if (func(array[current])) { - len = diff; - } else { - i = current + 1; - len -= diff + 1; - } - } - - return i; - } - - Syntax = { - AssignmentExpression: 'AssignmentExpression', - AssignmentPattern: 'AssignmentPattern', - ArrayExpression: 'ArrayExpression', - ArrayPattern: 'ArrayPattern', - ArrowFunctionExpression: 'ArrowFunctionExpression', - AwaitExpression: 'AwaitExpression', - // CAUTION: It's deferred to ES7. - BlockStatement: 'BlockStatement', - BinaryExpression: 'BinaryExpression', - BreakStatement: 'BreakStatement', - CallExpression: 'CallExpression', - CatchClause: 'CatchClause', - ClassBody: 'ClassBody', - ClassDeclaration: 'ClassDeclaration', - ClassExpression: 'ClassExpression', - ComprehensionBlock: 'ComprehensionBlock', - // CAUTION: It's deferred to ES7. - ComprehensionExpression: 'ComprehensionExpression', - // CAUTION: It's deferred to ES7. - ConditionalExpression: 'ConditionalExpression', - ContinueStatement: 'ContinueStatement', - DebuggerStatement: 'DebuggerStatement', - DirectiveStatement: 'DirectiveStatement', - DoWhileStatement: 'DoWhileStatement', - EmptyStatement: 'EmptyStatement', - ExportAllDeclaration: 'ExportAllDeclaration', - ExportDefaultDeclaration: 'ExportDefaultDeclaration', - ExportNamedDeclaration: 'ExportNamedDeclaration', - ExportSpecifier: 'ExportSpecifier', - ExpressionStatement: 'ExpressionStatement', - ForStatement: 'ForStatement', - ForInStatement: 'ForInStatement', - ForOfStatement: 'ForOfStatement', - FunctionDeclaration: 'FunctionDeclaration', - FunctionExpression: 'FunctionExpression', - GeneratorExpression: 'GeneratorExpression', - // CAUTION: It's deferred to ES7. - Identifier: 'Identifier', - IfStatement: 'IfStatement', - ImportExpression: 'ImportExpression', - ImportDeclaration: 'ImportDeclaration', - ImportDefaultSpecifier: 'ImportDefaultSpecifier', - ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', - ImportSpecifier: 'ImportSpecifier', - Literal: 'Literal', - LabeledStatement: 'LabeledStatement', - LogicalExpression: 'LogicalExpression', - MemberExpression: 'MemberExpression', - MetaProperty: 'MetaProperty', - MethodDefinition: 'MethodDefinition', - ModuleSpecifier: 'ModuleSpecifier', - NewExpression: 'NewExpression', - ObjectExpression: 'ObjectExpression', - ObjectPattern: 'ObjectPattern', - Program: 'Program', - Property: 'Property', - RestElement: 'RestElement', - ReturnStatement: 'ReturnStatement', - SequenceExpression: 'SequenceExpression', - SpreadElement: 'SpreadElement', - Super: 'Super', - SwitchStatement: 'SwitchStatement', - SwitchCase: 'SwitchCase', - TaggedTemplateExpression: 'TaggedTemplateExpression', - TemplateElement: 'TemplateElement', - TemplateLiteral: 'TemplateLiteral', - ThisExpression: 'ThisExpression', - ThrowStatement: 'ThrowStatement', - TryStatement: 'TryStatement', - UnaryExpression: 'UnaryExpression', - UpdateExpression: 'UpdateExpression', - VariableDeclaration: 'VariableDeclaration', - VariableDeclarator: 'VariableDeclarator', - WhileStatement: 'WhileStatement', - WithStatement: 'WithStatement', - YieldExpression: 'YieldExpression' - }; - VisitorKeys = { - AssignmentExpression: ['left', 'right'], - AssignmentPattern: ['left', 'right'], - ArrayExpression: ['elements'], - ArrayPattern: ['elements'], - ArrowFunctionExpression: ['params', 'body'], - AwaitExpression: ['argument'], - // CAUTION: It's deferred to ES7. - BlockStatement: ['body'], - BinaryExpression: ['left', 'right'], - BreakStatement: ['label'], - CallExpression: ['callee', 'arguments'], - CatchClause: ['param', 'body'], - ClassBody: ['body'], - ClassDeclaration: ['id', 'superClass', 'body'], - ClassExpression: ['id', 'superClass', 'body'], - ComprehensionBlock: ['left', 'right'], - // CAUTION: It's deferred to ES7. - ComprehensionExpression: ['blocks', 'filter', 'body'], - // CAUTION: It's deferred to ES7. - ConditionalExpression: ['test', 'consequent', 'alternate'], - ContinueStatement: ['label'], - DebuggerStatement: [], - DirectiveStatement: [], - DoWhileStatement: ['body', 'test'], - EmptyStatement: [], - ExportAllDeclaration: ['source'], - ExportDefaultDeclaration: ['declaration'], - ExportNamedDeclaration: ['declaration', 'specifiers', 'source'], - ExportSpecifier: ['exported', 'local'], - ExpressionStatement: ['expression'], - ForStatement: ['init', 'test', 'update', 'body'], - ForInStatement: ['left', 'right', 'body'], - ForOfStatement: ['left', 'right', 'body'], - FunctionDeclaration: ['id', 'params', 'body'], - FunctionExpression: ['id', 'params', 'body'], - GeneratorExpression: ['blocks', 'filter', 'body'], - // CAUTION: It's deferred to ES7. - Identifier: [], - IfStatement: ['test', 'consequent', 'alternate'], - ImportExpression: ['source'], - ImportDeclaration: ['specifiers', 'source'], - ImportDefaultSpecifier: ['local'], - ImportNamespaceSpecifier: ['local'], - ImportSpecifier: ['imported', 'local'], - Literal: [], - LabeledStatement: ['label', 'body'], - LogicalExpression: ['left', 'right'], - MemberExpression: ['object', 'property'], - MetaProperty: ['meta', 'property'], - MethodDefinition: ['key', 'value'], - ModuleSpecifier: [], - NewExpression: ['callee', 'arguments'], - ObjectExpression: ['properties'], - ObjectPattern: ['properties'], - Program: ['body'], - Property: ['key', 'value'], - RestElement: ['argument'], - ReturnStatement: ['argument'], - SequenceExpression: ['expressions'], - SpreadElement: ['argument'], - Super: [], - SwitchStatement: ['discriminant', 'cases'], - SwitchCase: ['test', 'consequent'], - TaggedTemplateExpression: ['tag', 'quasi'], - TemplateElement: [], - TemplateLiteral: ['quasis', 'expressions'], - ThisExpression: [], - ThrowStatement: ['argument'], - TryStatement: ['block', 'handler', 'finalizer'], - UnaryExpression: ['argument'], - UpdateExpression: ['argument'], - VariableDeclaration: ['declarations'], - VariableDeclarator: ['id', 'init'], - WhileStatement: ['test', 'body'], - WithStatement: ['object', 'body'], - YieldExpression: ['argument'] - }; // unique id - - BREAK = {}; - SKIP = {}; - REMOVE = {}; - VisitorOption = { - Break: BREAK, - Skip: SKIP, - Remove: REMOVE - }; - - function Reference(parent, key) { - this.parent = parent; - this.key = key; - } - - Reference.prototype.replace = function replace(node) { - this.parent[this.key] = node; - }; - - Reference.prototype.remove = function remove() { - if (Array.isArray(this.parent)) { - this.parent.splice(this.key, 1); - return true; - } else { - this.replace(null); - return false; - } - }; - - function Element(node, path, wrap, ref) { - this.node = node; - this.path = path; - this.wrap = wrap; - this.ref = ref; - } - - function Controller() {} // API: - // return property path array from root to current node - - - Controller.prototype.path = function path() { - var i, iz, j, jz, result, element; - - function addToPath(result, path) { - if (Array.isArray(path)) { - for (j = 0, jz = path.length; j < jz; ++j) { - result.push(path[j]); - } - } else { - result.push(path); - } - } // root node - - - if (!this.__current.path) { - return null; - } // first node is sentinel, second node is root element - - - result = []; - - for (i = 2, iz = this.__leavelist.length; i < iz; ++i) { - element = this.__leavelist[i]; - addToPath(result, element.path); - } - - addToPath(result, this.__current.path); - return result; - }; // API: - // return type of current node - - - Controller.prototype.type = function () { - var node = this.current(); - return node.type || this.__current.wrap; - }; // API: - // return array of parent elements - - - Controller.prototype.parents = function parents() { - var i, iz, result; // first node is sentinel - - result = []; - - for (i = 1, iz = this.__leavelist.length; i < iz; ++i) { - result.push(this.__leavelist[i].node); - } - - return result; - }; // API: - // return current node - - - Controller.prototype.current = function current() { - return this.__current.node; - }; - - Controller.prototype.__execute = function __execute(callback, element) { - var previous, result; - result = undefined; - previous = this.__current; - this.__current = element; - this.__state = null; - - if (callback) { - result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node); - } - - this.__current = previous; - return result; - }; // API: - // notify control skip / break - - - Controller.prototype.notify = function notify(flag) { - this.__state = flag; - }; // API: - // skip child nodes of current node - - - Controller.prototype.skip = function () { - this.notify(SKIP); - }; // API: - // break traversals - - - Controller.prototype['break'] = function () { - this.notify(BREAK); - }; // API: - // remove node - - - Controller.prototype.remove = function () { - this.notify(REMOVE); - }; - - Controller.prototype.__initialize = function (root, visitor) { - this.visitor = visitor; - this.root = root; - this.__worklist = []; - this.__leavelist = []; - this.__current = null; - this.__state = null; - this.__fallback = null; - - if (visitor.fallback === 'iteration') { - this.__fallback = Object.keys; - } else if (typeof visitor.fallback === 'function') { - this.__fallback = visitor.fallback; - } - - this.__keys = VisitorKeys; - - if (visitor.keys) { - this.__keys = Object.assign(Object.create(this.__keys), visitor.keys); - } - }; - - function isNode(node) { - if (node == null) { - return false; - } - - return typeof node === 'object' && typeof node.type === 'string'; - } - - function isProperty(nodeType, key) { - return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key; - } - - Controller.prototype.traverse = function traverse(root, visitor) { - var worklist, leavelist, element, node, nodeType, ret, key, current, current2, candidates, candidate, sentinel; - - this.__initialize(root, visitor); - - sentinel = {}; // reference - - worklist = this.__worklist; - leavelist = this.__leavelist; // initialize - - worklist.push(new Element(root, null, null, null)); - leavelist.push(new Element(null, null, null, null)); - - while (worklist.length) { - element = worklist.pop(); - - if (element === sentinel) { - element = leavelist.pop(); - ret = this.__execute(visitor.leave, element); - - if (this.__state === BREAK || ret === BREAK) { - return; - } - - continue; - } - - if (element.node) { - ret = this.__execute(visitor.enter, element); - - if (this.__state === BREAK || ret === BREAK) { - return; - } - - worklist.push(sentinel); - leavelist.push(element); - - if (this.__state === SKIP || ret === SKIP) { - continue; - } - - node = element.node; - nodeType = node.type || element.wrap; - candidates = this.__keys[nodeType]; - - if (!candidates) { - if (this.__fallback) { - candidates = this.__fallback(node); - } else { - throw new Error('Unknown node type ' + nodeType + '.'); - } - } - - current = candidates.length; - - while ((current -= 1) >= 0) { - key = candidates[current]; - candidate = node[key]; - - if (!candidate) { - continue; - } - - if (Array.isArray(candidate)) { - current2 = candidate.length; - - while ((current2 -= 1) >= 0) { - if (!candidate[current2]) { - continue; - } - - if (isProperty(nodeType, candidates[current])) { - element = new Element(candidate[current2], [key, current2], 'Property', null); - } else if (isNode(candidate[current2])) { - element = new Element(candidate[current2], [key, current2], null, null); - } else { - continue; - } - - worklist.push(element); - } - } else if (isNode(candidate)) { - worklist.push(new Element(candidate, key, null, null)); - } - } - } - } - }; - - Controller.prototype.replace = function replace(root, visitor) { - var worklist, leavelist, node, nodeType, target, element, current, current2, candidates, candidate, sentinel, outer, key; - - function removeElem(element) { - var i, key, nextElem, parent; - - if (element.ref.remove()) { - // When the reference is an element of an array. - key = element.ref.key; - parent = element.ref.parent; // If removed from array, then decrease following items' keys. - - i = worklist.length; - - while (i--) { - nextElem = worklist[i]; - - if (nextElem.ref && nextElem.ref.parent === parent) { - if (nextElem.ref.key < key) { - break; - } - - --nextElem.ref.key; - } - } - } - } - - this.__initialize(root, visitor); - - sentinel = {}; // reference - - worklist = this.__worklist; - leavelist = this.__leavelist; // initialize - - outer = { - root: root - }; - element = new Element(root, null, null, new Reference(outer, 'root')); - worklist.push(element); - leavelist.push(element); - - while (worklist.length) { - element = worklist.pop(); - - if (element === sentinel) { - element = leavelist.pop(); - target = this.__execute(visitor.leave, element); // node may be replaced with null, - // so distinguish between undefined and null in this place - - if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { - // replace - element.ref.replace(target); - } - - if (this.__state === REMOVE || target === REMOVE) { - removeElem(element); - } - - if (this.__state === BREAK || target === BREAK) { - return outer.root; - } - - continue; - } - - target = this.__execute(visitor.enter, element); // node may be replaced with null, - // so distinguish between undefined and null in this place - - if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) { - // replace - element.ref.replace(target); - element.node = target; - } - - if (this.__state === REMOVE || target === REMOVE) { - removeElem(element); - element.node = null; - } - - if (this.__state === BREAK || target === BREAK) { - return outer.root; - } // node may be null - - - node = element.node; - - if (!node) { - continue; - } - - worklist.push(sentinel); - leavelist.push(element); - - if (this.__state === SKIP || target === SKIP) { - continue; - } - - nodeType = node.type || element.wrap; - candidates = this.__keys[nodeType]; - - if (!candidates) { - if (this.__fallback) { - candidates = this.__fallback(node); - } else { - throw new Error('Unknown node type ' + nodeType + '.'); - } - } - - current = candidates.length; - - while ((current -= 1) >= 0) { - key = candidates[current]; - candidate = node[key]; - - if (!candidate) { - continue; - } - - if (Array.isArray(candidate)) { - current2 = candidate.length; - - while ((current2 -= 1) >= 0) { - if (!candidate[current2]) { - continue; - } - - if (isProperty(nodeType, candidates[current])) { - element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2)); - } else if (isNode(candidate[current2])) { - element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2)); - } else { - continue; - } - - worklist.push(element); - } - } else if (isNode(candidate)) { - worklist.push(new Element(candidate, key, null, new Reference(node, key))); - } - } - } - - return outer.root; - }; - - function traverse(root, visitor) { - var controller = new Controller(); - return controller.traverse(root, visitor); - } - - function replace(root, visitor) { - var controller = new Controller(); - return controller.replace(root, visitor); - } - - function extendCommentRange(comment, tokens) { - var target; - target = upperBound(tokens, function search(token) { - return token.range[0] > comment.range[0]; - }); - comment.extendedRange = [comment.range[0], comment.range[1]]; - - if (target !== tokens.length) { - comment.extendedRange[1] = tokens[target].range[0]; - } - - target -= 1; - - if (target >= 0) { - comment.extendedRange[0] = tokens[target].range[1]; - } - - return comment; - } - - function attachComments(tree, providedComments, tokens) { - // At first, we should calculate extended comment ranges. - var comments = [], - comment, - len, - i, - cursor; - - if (!tree.range) { - throw new Error('attachComments needs range information'); - } // tokens array is empty, we attach comments to tree as 'leadingComments' - - - if (!tokens.length) { - if (providedComments.length) { - for (i = 0, len = providedComments.length; i < len; i += 1) { - comment = deepCopy(providedComments[i]); - comment.extendedRange = [0, tree.range[0]]; - comments.push(comment); - } - - tree.leadingComments = comments; - } - - return tree; - } - - for (i = 0, len = providedComments.length; i < len; i += 1) { - comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens)); - } // This is based on John Freeman's implementation. - - - cursor = 0; - traverse(tree, { - enter: function (node) { - var comment; - - while (cursor < comments.length) { - comment = comments[cursor]; - - if (comment.extendedRange[1] > node.range[0]) { - break; - } - - if (comment.extendedRange[1] === node.range[0]) { - if (!node.leadingComments) { - node.leadingComments = []; - } - - node.leadingComments.push(comment); - comments.splice(cursor, 1); - } else { - cursor += 1; - } - } // already out of owned node - - - if (cursor === comments.length) { - return VisitorOption.Break; - } - - if (comments[cursor].extendedRange[0] > node.range[1]) { - return VisitorOption.Skip; - } - } - }); - cursor = 0; - traverse(tree, { - leave: function (node) { - var comment; - - while (cursor < comments.length) { - comment = comments[cursor]; - - if (node.range[1] < comment.extendedRange[0]) { - break; - } - - if (node.range[1] === comment.extendedRange[0]) { - if (!node.trailingComments) { - node.trailingComments = []; - } - - node.trailingComments.push(comment); - comments.splice(cursor, 1); - } else { - cursor += 1; - } - } // already out of owned node - - - if (cursor === comments.length) { - return VisitorOption.Break; - } - - if (comments[cursor].extendedRange[0] > node.range[1]) { - return VisitorOption.Skip; - } - } - }); - return tree; - } - - exports.version = __webpack_require__(411).version; - exports.Syntax = Syntax; - exports.traverse = traverse; - exports.replace = replace; - exports.attachComments = attachComments; - exports.VisitorKeys = VisitorKeys; - exports.VisitorOption = VisitorOption; - exports.Controller = Controller; - - exports.cloneEnvironment = function () { - return clone({}); - }; - - return exports; -})(exports); -/* vim: set sw=4 ts=4 et tw=80 : */ - -/***/ }), -/* 411 */ -/***/ ((module) => { - "use strict"; -module.exports = JSON.parse('{"name":"estraverse","description":"ECMAScript JS AST traversal functions","homepage":"https://github.com/estools/estraverse","main":"estraverse.js","version":"4.3.0","engines":{"node":">=4.0"},"maintainers":[{"name":"Yusuke Suzuki","email":"utatane.tea@gmail.com","web":"http://github.com/Constellation"}],"repository":{"type":"git","url":"http://github.com/estools/estraverse.git"},"devDependencies":{"babel-preset-env":"^1.6.1","babel-register":"^6.3.13","chai":"^2.1.1","espree":"^1.11.0","gulp":"^3.8.10","gulp-bump":"^0.2.2","gulp-filter":"^2.0.0","gulp-git":"^1.0.1","gulp-tag-version":"^1.3.0","jshint":"^2.5.6","mocha":"^2.1.0"},"license":"BSD-2-Clause","scripts":{"test":"npm run-script lint && npm run-script unit-test","lint":"jshint estraverse.js","unit-test":"mocha --compilers js:babel-register"}}'); -/***/ }), -/* 412 */ -/***/ ((module) => { -"use strict"; +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var assert = __webpack_require__(431); +var estraverse = __webpack_require__(432); +var esrecurse = __webpack_require__(433); + +function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + +var assert__default = /*#__PURE__*/_interopDefaultLegacy(assert); +var estraverse__default = /*#__PURE__*/_interopDefaultLegacy(estraverse); +var esrecurse__default = /*#__PURE__*/_interopDefaultLegacy(esrecurse); + /* Copyright (C) 2015 Yusuke Suzuki @@ -20283,161 +19576,147 @@ module.exports = JSON.parse('{"name":"estraverse","description":"ECMAScript JS A THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - const READ = 0x1; const WRITE = 0x2; const RW = READ | WRITE; + /** * A Reference represents a single occurrence of an identifier in code. - * @class Reference + * @constructor Reference */ - class Reference { - constructor(ident, scope, flag, writeExpr, maybeImplicitGlobal, partial, init) { - /** - * Identifier syntax node. - * @member {espreeIdentifier} Reference#identifier - */ - this.identifier = ident; - /** - * Reference to the enclosing Scope. - * @member {Scope} Reference#from - */ + constructor(ident, scope, flag, writeExpr, maybeImplicitGlobal, partial, init) { - this.from = scope; - /** - * Whether the reference comes from a dynamic scope (such as 'eval', - * 'with', etc.), and may be trapped by dynamic scopes. - * @member {boolean} Reference#tainted - */ + /** + * Identifier syntax node. + * @member {espreeIdentifier} Reference#identifier + */ + this.identifier = ident; - this.tainted = false; - /** - * The variable this reference is resolved with. - * @member {Variable} Reference#resolved - */ + /** + * Reference to the enclosing Scope. + * @member {Scope} Reference#from + */ + this.from = scope; - this.resolved = null; - /** - * The read-write mode of the reference. (Value is one of {@link - * Reference.READ}, {@link Reference.RW}, {@link Reference.WRITE}). - * @member {number} Reference#flag - * @private - */ + /** + * Whether the reference comes from a dynamic scope (such as 'eval', + * 'with', etc.), and may be trapped by dynamic scopes. + * @member {boolean} Reference#tainted + */ + this.tainted = false; - this.flag = flag; + /** + * The variable this reference is resolved with. + * @member {Variable} Reference#resolved + */ + this.resolved = null; - if (this.isWrite()) { - /** - * If reference is writeable, this is the tree being written to it. - * @member {espreeNode} Reference#writeExpr - */ - this.writeExpr = writeExpr; - /** - * Whether the Reference might refer to a partial value of writeExpr. - * @member {boolean} Reference#partial - */ + /** + * The read-write mode of the reference. (Value is one of {@link + * Reference.READ}, {@link Reference.RW}, {@link Reference.WRITE}). + * @member {number} Reference#flag + * @private + */ + this.flag = flag; + if (this.isWrite()) { - this.partial = partial; - /** - * Whether the Reference is to write of initialization. - * @member {boolean} Reference#init - */ + /** + * If reference is writeable, this is the tree being written to it. + * @member {espreeNode} Reference#writeExpr + */ + this.writeExpr = writeExpr; - this.init = init; + /** + * Whether the Reference might refer to a partial value of writeExpr. + * @member {boolean} Reference#partial + */ + this.partial = partial; + + /** + * Whether the Reference is to write of initialization. + * @member {boolean} Reference#init + */ + this.init = init; + } + this.__maybeImplicitGlobal = maybeImplicitGlobal; } - this.__maybeImplicitGlobal = maybeImplicitGlobal; - } - /** - * Whether the reference is static. - * @method Reference#isStatic - * @returns {boolean} static - */ + /** + * Whether the reference is static. + * @function Reference#isStatic + * @returns {boolean} static + */ + isStatic() { + return !this.tainted && this.resolved && this.resolved.scope.isStatic(); + } + /** + * Whether the reference is writeable. + * @function Reference#isWrite + * @returns {boolean} write + */ + isWrite() { + return !!(this.flag & Reference.WRITE); + } - isStatic() { - return !this.tainted && this.resolved && this.resolved.scope.isStatic(); - } - /** - * Whether the reference is writeable. - * @method Reference#isWrite - * @returns {boolean} write - */ + /** + * Whether the reference is readable. + * @function Reference#isRead + * @returns {boolean} read + */ + isRead() { + return !!(this.flag & Reference.READ); + } + /** + * Whether the reference is read-only. + * @function Reference#isReadOnly + * @returns {boolean} read only + */ + isReadOnly() { + return this.flag === Reference.READ; + } - isWrite() { - return !!(this.flag & Reference.WRITE); - } - /** - * Whether the reference is readable. - * @method Reference#isRead - * @returns {boolean} read - */ - - - isRead() { - return !!(this.flag & Reference.READ); - } - /** - * Whether the reference is read-only. - * @method Reference#isReadOnly - * @returns {boolean} read only - */ - - - isReadOnly() { - return this.flag === Reference.READ; - } - /** - * Whether the reference is write-only. - * @method Reference#isWriteOnly - * @returns {boolean} write only - */ - - - isWriteOnly() { - return this.flag === Reference.WRITE; - } - /** - * Whether the reference is read-write. - * @method Reference#isReadWrite - * @returns {boolean} read write - */ - - - isReadWrite() { - return this.flag === Reference.RW; - } + /** + * Whether the reference is write-only. + * @function Reference#isWriteOnly + * @returns {boolean} write only + */ + isWriteOnly() { + return this.flag === Reference.WRITE; + } + /** + * Whether the reference is read-write. + * @function Reference#isReadWrite + * @returns {boolean} read write + */ + isReadWrite() { + return this.flag === Reference.RW; + } } + /** * @constant Reference.READ * @private */ - - Reference.READ = READ; + /** * @constant Reference.WRITE * @private */ - Reference.WRITE = WRITE; + /** * @constant Reference.RW * @private */ - Reference.RW = RW; -module.exports = Reference; + /* vim: set sw=4 ts=4 et tw=80 : */ -/***/ }), -/* 413 */ -/***/ ((module) => { - -"use strict"; /* Copyright (C) 2015 Yusuke Suzuki @@ -20465,53 +19744,53 @@ module.exports = Reference; /** * A Variable represents a locally scoped identifier. These include arguments to * functions. - * @class Variable + * @constructor Variable */ - class Variable { - constructor(name, scope) { - /** - * The variable name, as given in the source code. - * @member {String} Variable#name - */ - this.name = name; - /** - * List of defining occurrences of this variable (like in 'var ...' - * statements or as parameter), as AST nodes. - * @member {espree.Identifier[]} Variable#identifiers - */ + constructor(name, scope) { - this.identifiers = []; - /** - * List of {@link Reference|references} of this variable (excluding parameter entries) - * in its defining scope and all nested scopes. For defining - * occurrences only see {@link Variable#defs}. - * @member {Reference[]} Variable#references - */ + /** + * The variable name, as given in the source code. + * @member {string} Variable#name + */ + this.name = name; - this.references = []; - /** - * List of defining occurrences of this variable (like in 'var ...' - * statements or as parameter), as custom objects. - * @member {Definition[]} Variable#defs - */ + /** + * List of defining occurrences of this variable (like in 'var ...' + * statements or as parameter), as AST nodes. + * @member {espree.Identifier[]} Variable#identifiers + */ + this.identifiers = []; - this.defs = []; - this.tainted = false; - /** - * Whether this is a stack variable. - * @member {boolean} Variable#stack - */ + /** + * List of {@link Reference|references} of this variable (excluding parameter entries) + * in its defining scope and all nested scopes. For defining + * occurrences only see {@link Variable#defs}. + * @member {Reference[]} Variable#references + */ + this.references = []; - this.stack = true; - /** - * Reference to the enclosing Scope. - * @member {Scope} Variable#scope - */ + /** + * List of defining occurrences of this variable (like in 'var ...' + * statements or as parameter), as custom objects. + * @member {Definition[]} Variable#defs + */ + this.defs = []; - this.scope = scope; - } + this.tainted = false; + /** + * Whether this is a stack variable. + * @member {boolean} Variable#stack + */ + this.stack = true; + + /** + * Reference to the enclosing Scope. + * @member {Scope} Variable#scope + */ + this.scope = scope; + } } Variable.CatchClause = "CatchClause"; @@ -20521,14 +19800,9 @@ Variable.ClassName = "ClassName"; Variable.Variable = "Variable"; Variable.ImportBinding = "ImportBinding"; Variable.ImplicitGlobalVariable = "ImplicitGlobalVariable"; -module.exports = Variable; + /* vim: set sw=4 ts=4 et tw=80 : */ -/***/ }), -/* 414 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; /* Copyright (C) 2015 Yusuke Suzuki @@ -20553,76 +19827,61 @@ module.exports = Variable; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -const Variable = __webpack_require__(413); /** - * @class Definition + * @constructor Definition */ - - class Definition { - constructor(type, name, node, parent, index, kind) { - /** - * @member {String} Definition#type - type of the occurrence (e.g. "Parameter", "Variable", ...). - */ - this.type = type; - /** - * @member {espree.Identifier} Definition#name - the identifier AST node of the occurrence. - */ + constructor(type, name, node, parent, index, kind) { - this.name = name; - /** - * @member {espree.Node} Definition#node - the enclosing node of the identifier. - */ + /** + * @member {string} Definition#type - type of the occurrence (e.g. "Parameter", "Variable", ...). + */ + this.type = type; - this.node = node; - /** - * @member {espree.Node?} Definition#parent - the enclosing statement node of the identifier. - */ + /** + * @member {espree.Identifier} Definition#name - the identifier AST node of the occurrence. + */ + this.name = name; - this.parent = parent; - /** - * @member {Number?} Definition#index - the index in the declaration statement. - */ + /** + * @member {espree.Node} Definition#node - the enclosing node of the identifier. + */ + this.node = node; - this.index = index; - /** - * @member {String?} Definition#kind - the kind of the declaration statement. - */ + /** + * @member {espree.Node?} Definition#parent - the enclosing statement node of the identifier. + */ + this.parent = parent; - this.kind = kind; - } + /** + * @member {number?} Definition#index - the index in the declaration statement. + */ + this.index = index; + /** + * @member {string?} Definition#kind - the kind of the declaration statement. + */ + this.kind = kind; + } } + /** - * @class ParameterDefinition + * @constructor ParameterDefinition */ - - class ParameterDefinition extends Definition { - constructor(name, node, index, rest) { - super(Variable.Parameter, name, node, null, index, null); - /** - * Whether the parameter definition is a part of a rest parameter. - * @member {boolean} ParameterDefinition#rest - */ - - this.rest = rest; - } + constructor(name, node, index, rest) { + super(Variable.Parameter, name, node, null, index, null); + /** + * Whether the parameter definition is a part of a rest parameter. + * @member {boolean} ParameterDefinition#rest + */ + this.rest = rest; + } } -module.exports = { - ParameterDefinition, - Definition -}; /* vim: set sw=4 ts=4 et tw=80 : */ -/***/ }), -/* 415 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; /* Copyright (C) 2015 Yusuke Suzuki @@ -20647,554 +19906,1758 @@ module.exports = { THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* eslint-disable no-underscore-dangle */ +const { Syntax: Syntax$2 } = estraverse__default["default"]; -/* eslint-disable no-undefined */ - -const Syntax = __webpack_require__(410).Syntax; - -const esrecurse = __webpack_require__(416); - -const Reference = __webpack_require__(412); - -const Variable = __webpack_require__(413); - -const PatternVisitor = __webpack_require__(419); - -const definition = __webpack_require__(414); - -const assert = __webpack_require__(407); - -const ParameterDefinition = definition.ParameterDefinition; -const Definition = definition.Definition; /** - * Traverse identifier in pattern - * @param {Object} options - options - * @param {pattern} rootPattern - root pattern - * @param {Refencer} referencer - referencer - * @param {callback} callback - callback + * Test if scope is struct + * @param {Scope} scope scope + * @param {Block} block block + * @param {boolean} isMethodDefinition is method definition + * @param {boolean} useDirective use directive + * @returns {boolean} is strict scope + */ +function isStrictScope(scope, block, isMethodDefinition, useDirective) { + let body; + + // When upper scope is exists and strict, inner scope is also strict. + if (scope.upper && scope.upper.isStrict) { + return true; + } + + if (isMethodDefinition) { + return true; + } + + if (scope.type === "class" || scope.type === "module") { + return true; + } + + if (scope.type === "block" || scope.type === "switch") { + return false; + } + + if (scope.type === "function") { + if (block.type === Syntax$2.ArrowFunctionExpression && block.body.type !== Syntax$2.BlockStatement) { + return false; + } + + if (block.type === Syntax$2.Program) { + body = block; + } else { + body = block.body; + } + + if (!body) { + return false; + } + } else if (scope.type === "global") { + body = block; + } else { + return false; + } + + // Search 'use strict' directive. + if (useDirective) { + for (let i = 0, iz = body.body.length; i < iz; ++i) { + const stmt = body.body[i]; + + if (stmt.type !== Syntax$2.DirectiveStatement) { + break; + } + if (stmt.raw === "\"use strict\"" || stmt.raw === "'use strict'") { + return true; + } + } + } else { + for (let i = 0, iz = body.body.length; i < iz; ++i) { + const stmt = body.body[i]; + + if (stmt.type !== Syntax$2.ExpressionStatement) { + break; + } + const expr = stmt.expression; + + if (expr.type !== Syntax$2.Literal || typeof expr.value !== "string") { + break; + } + if (expr.raw !== null && expr.raw !== undefined) { + if (expr.raw === "\"use strict\"" || expr.raw === "'use strict'") { + return true; + } + } else { + if (expr.value === "use strict") { + return true; + } + } + } + } + return false; +} + +/** + * Register scope + * @param {ScopeManager} scopeManager scope manager + * @param {Scope} scope scope * @returns {void} */ +function registerScope(scopeManager, scope) { + scopeManager.scopes.push(scope); + const scopes = scopeManager.__nodeToScope.get(scope.block); + + if (scopes) { + scopes.push(scope); + } else { + scopeManager.__nodeToScope.set(scope.block, [scope]); + } +} + +/** + * Should be statically + * @param {Object} def def + * @returns {boolean} should be statically + */ +function shouldBeStatically(def) { + return ( + (def.type === Variable.ClassName) || + (def.type === Variable.Variable && def.parent.kind !== "var") + ); +} + +/** + * @constructor Scope + */ +class Scope { + constructor(scopeManager, type, upperScope, block, isMethodDefinition) { + + /** + * One of "global", "module", "function", "function-expression-name", "block", "switch", "catch", "with", "for", + * "class", "class-field-initializer", "class-static-block". + * @member {string} Scope#type + */ + this.type = type; + + /** + * The scoped {@link Variable}s of this scope, as { Variable.name + * : Variable }. + * @member {Map} Scope#set + */ + this.set = new Map(); + + /** + * The tainted variables of this scope, as { Variable.name : + * boolean }. + * @member {Map} Scope#taints */ + this.taints = new Map(); + + /** + * Generally, through the lexical scoping of JS you can always know + * which variable an identifier in the source code refers to. There are + * a few exceptions to this rule. With 'global' and 'with' scopes you + * can only decide at runtime which variable a reference refers to. + * Moreover, if 'eval()' is used in a scope, it might introduce new + * bindings in this or its parent scopes. + * All those scopes are considered 'dynamic'. + * @member {boolean} Scope#dynamic + */ + this.dynamic = this.type === "global" || this.type === "with"; + + /** + * A reference to the scope-defining syntax node. + * @member {espree.Node} Scope#block + */ + this.block = block; + + /** + * The {@link Reference|references} that are not resolved with this scope. + * @member {Reference[]} Scope#through + */ + this.through = []; + + /** + * The scoped {@link Variable}s of this scope. In the case of a + * 'function' scope this includes the automatic argument arguments as + * its first element, as well as all further formal arguments. + * @member {Variable[]} Scope#variables + */ + this.variables = []; + + /** + * Any variable {@link Reference|reference} found in this scope. This + * includes occurrences of local variables as well as variables from + * parent scopes (including the global scope). For local variables + * this also includes defining occurrences (like in a 'var' statement). + * In a 'function' scope this does not include the occurrences of the + * formal parameter in the parameter list. + * @member {Reference[]} Scope#references + */ + this.references = []; + + /** + * For 'global' and 'function' scopes, this is a self-reference. For + * other scope types this is the variableScope value of the + * parent scope. + * @member {Scope} Scope#variableScope + */ + this.variableScope = + this.type === "global" || + this.type === "module" || + this.type === "function" || + this.type === "class-field-initializer" || + this.type === "class-static-block" + ? this + : upperScope.variableScope; + + /** + * Whether this scope is created by a FunctionExpression. + * @member {boolean} Scope#functionExpressionScope + */ + this.functionExpressionScope = false; + + /** + * Whether this is a scope that contains an 'eval()' invocation. + * @member {boolean} Scope#directCallToEvalScope + */ + this.directCallToEvalScope = false; + + /** + * @member {boolean} Scope#thisFound + */ + this.thisFound = false; + + this.__left = []; + + /** + * Reference to the parent {@link Scope|scope}. + * @member {Scope} Scope#upper + */ + this.upper = upperScope; + + /** + * Whether 'use strict' is in effect in this scope. + * @member {boolean} Scope#isStrict + */ + this.isStrict = isStrictScope(this, block, isMethodDefinition, scopeManager.__useDirective()); + + /** + * List of nested {@link Scope}s. + * @member {Scope[]} Scope#childScopes + */ + this.childScopes = []; + if (this.upper) { + this.upper.childScopes.push(this); + } + + this.__declaredVariables = scopeManager.__declaredVariables; + + registerScope(scopeManager, this); + } + + __shouldStaticallyClose(scopeManager) { + return (!this.dynamic || scopeManager.__isOptimistic()); + } + + __shouldStaticallyCloseForGlobal(ref) { + + // On global scope, let/const/class declarations should be resolved statically. + const name = ref.identifier.name; + + if (!this.set.has(name)) { + return false; + } + + const variable = this.set.get(name); + const defs = variable.defs; + + return defs.length > 0 && defs.every(shouldBeStatically); + } + + __staticCloseRef(ref) { + if (!this.__resolve(ref)) { + this.__delegateToUpperScope(ref); + } + } + + __dynamicCloseRef(ref) { + + // notify all names are through to global + let current = this; + + do { + current.through.push(ref); + current = current.upper; + } while (current); + } + + __globalCloseRef(ref) { + + // let/const/class declarations should be resolved statically. + // others should be resolved dynamically. + if (this.__shouldStaticallyCloseForGlobal(ref)) { + this.__staticCloseRef(ref); + } else { + this.__dynamicCloseRef(ref); + } + } + + __close(scopeManager) { + let closeRef; + + if (this.__shouldStaticallyClose(scopeManager)) { + closeRef = this.__staticCloseRef; + } else if (this.type !== "global") { + closeRef = this.__dynamicCloseRef; + } else { + closeRef = this.__globalCloseRef; + } + + // Try Resolving all references in this scope. + for (let i = 0, iz = this.__left.length; i < iz; ++i) { + const ref = this.__left[i]; + + closeRef.call(this, ref); + } + this.__left = null; + + return this.upper; + } + + // To override by function scopes. + // References in default parameters isn't resolved to variables which are in their function body. + __isValidResolution(ref, variable) { // eslint-disable-line class-methods-use-this, no-unused-vars + return true; + } + + __resolve(ref) { + const name = ref.identifier.name; + + if (!this.set.has(name)) { + return false; + } + const variable = this.set.get(name); + + if (!this.__isValidResolution(ref, variable)) { + return false; + } + variable.references.push(ref); + variable.stack = variable.stack && ref.from.variableScope === this.variableScope; + if (ref.tainted) { + variable.tainted = true; + this.taints.set(variable.name, true); + } + ref.resolved = variable; + + return true; + } + + __delegateToUpperScope(ref) { + if (this.upper) { + this.upper.__left.push(ref); + } + this.through.push(ref); + } + + __addDeclaredVariablesOfNode(variable, node) { + if (node === null || node === undefined) { + return; + } + + let variables = this.__declaredVariables.get(node); + + if (variables === null || variables === undefined) { + variables = []; + this.__declaredVariables.set(node, variables); + } + if (variables.indexOf(variable) === -1) { + variables.push(variable); + } + } + + __defineGeneric(name, set, variables, node, def) { + let variable; + + variable = set.get(name); + if (!variable) { + variable = new Variable(name, this); + set.set(name, variable); + variables.push(variable); + } + + if (def) { + variable.defs.push(def); + this.__addDeclaredVariablesOfNode(variable, def.node); + this.__addDeclaredVariablesOfNode(variable, def.parent); + } + if (node) { + variable.identifiers.push(node); + } + } + + __define(node, def) { + if (node && node.type === Syntax$2.Identifier) { + this.__defineGeneric( + node.name, + this.set, + this.variables, + node, + def + ); + } + } + + __referencing(node, assign, writeExpr, maybeImplicitGlobal, partial, init) { + + // because Array element may be null + if (!node || node.type !== Syntax$2.Identifier) { + return; + } + + // Specially handle like `this`. + if (node.name === "super") { + return; + } + + const ref = new Reference(node, this, assign || Reference.READ, writeExpr, maybeImplicitGlobal, !!partial, !!init); + + this.references.push(ref); + this.__left.push(ref); + } + + __detectEval() { + let current = this; + + this.directCallToEvalScope = true; + do { + current.dynamic = true; + current = current.upper; + } while (current); + } + + __detectThis() { + this.thisFound = true; + } + + __isClosed() { + return this.__left === null; + } + + /** + * returns resolved {Reference} + * @function Scope#resolve + * @param {Espree.Identifier} ident identifier to be resolved. + * @returns {Reference} reference + */ + resolve(ident) { + let ref, i, iz; + + assert__default["default"](this.__isClosed(), "Scope should be closed."); + assert__default["default"](ident.type === Syntax$2.Identifier, "Target should be identifier."); + for (i = 0, iz = this.references.length; i < iz; ++i) { + ref = this.references[i]; + if (ref.identifier === ident) { + return ref; + } + } + return null; + } + + /** + * returns this scope is static + * @function Scope#isStatic + * @returns {boolean} static + */ + isStatic() { + return !this.dynamic; + } + + /** + * returns this scope has materialized arguments + * @function Scope#isArgumentsMaterialized + * @returns {boolean} arguemnts materialized + */ + isArgumentsMaterialized() { // eslint-disable-line class-methods-use-this + return true; + } + + /** + * returns this scope has materialized `this` reference + * @function Scope#isThisMaterialized + * @returns {boolean} this materialized + */ + isThisMaterialized() { // eslint-disable-line class-methods-use-this + return true; + } + + isUsedName(name) { + if (this.set.has(name)) { + return true; + } + for (let i = 0, iz = this.through.length; i < iz; ++i) { + if (this.through[i].identifier.name === name) { + return true; + } + } + return false; + } +} + +class GlobalScope extends Scope { + constructor(scopeManager, block) { + super(scopeManager, "global", null, block, false); + this.implicit = { + set: new Map(), + variables: [], + + /** + * List of {@link Reference}s that are left to be resolved (i.e. which + * need to be linked to the variable they refer to). + * @member {Reference[]} Scope#implicit#left + */ + left: [] + }; + } + + __close(scopeManager) { + const implicit = []; + + for (let i = 0, iz = this.__left.length; i < iz; ++i) { + const ref = this.__left[i]; + + if (ref.__maybeImplicitGlobal && !this.set.has(ref.identifier.name)) { + implicit.push(ref.__maybeImplicitGlobal); + } + } + + // create an implicit global variable from assignment expression + for (let i = 0, iz = implicit.length; i < iz; ++i) { + const info = implicit[i]; + + this.__defineImplicit(info.pattern, + new Definition( + Variable.ImplicitGlobalVariable, + info.pattern, + info.node, + null, + null, + null + )); + + } + + this.implicit.left = this.__left; + + return super.__close(scopeManager); + } + + __defineImplicit(node, def) { + if (node && node.type === Syntax$2.Identifier) { + this.__defineGeneric( + node.name, + this.implicit.set, + this.implicit.variables, + node, + def + ); + } + } +} + +class ModuleScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "module", upperScope, block, false); + } +} + +class FunctionExpressionNameScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "function-expression-name", upperScope, block, false); + this.__define(block.id, + new Definition( + Variable.FunctionName, + block.id, + block, + null, + null, + null + )); + this.functionExpressionScope = true; + } +} + +class CatchScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "catch", upperScope, block, false); + } +} + +class WithScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "with", upperScope, block, false); + } + + __close(scopeManager) { + if (this.__shouldStaticallyClose(scopeManager)) { + return super.__close(scopeManager); + } + + for (let i = 0, iz = this.__left.length; i < iz; ++i) { + const ref = this.__left[i]; + + ref.tainted = true; + this.__delegateToUpperScope(ref); + } + this.__left = null; + + return this.upper; + } +} + +class BlockScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "block", upperScope, block, false); + } +} + +class SwitchScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "switch", upperScope, block, false); + } +} + +class FunctionScope extends Scope { + constructor(scopeManager, upperScope, block, isMethodDefinition) { + super(scopeManager, "function", upperScope, block, isMethodDefinition); + + // section 9.2.13, FunctionDeclarationInstantiation. + // NOTE Arrow functions never have an arguments objects. + if (this.block.type !== Syntax$2.ArrowFunctionExpression) { + this.__defineArguments(); + } + } + + isArgumentsMaterialized() { + + // TODO(Constellation) + // We can more aggressive on this condition like this. + // + // function t() { + // // arguments of t is always hidden. + // function arguments() { + // } + // } + if (this.block.type === Syntax$2.ArrowFunctionExpression) { + return false; + } + + if (!this.isStatic()) { + return true; + } + + const variable = this.set.get("arguments"); + + assert__default["default"](variable, "Always have arguments variable."); + return variable.tainted || variable.references.length !== 0; + } + + isThisMaterialized() { + if (!this.isStatic()) { + return true; + } + return this.thisFound; + } + + __defineArguments() { + this.__defineGeneric( + "arguments", + this.set, + this.variables, + null, + null + ); + this.taints.set("arguments", true); + } + + // References in default parameters isn't resolved to variables which are in their function body. + // const x = 1 + // function f(a = x) { // This `x` is resolved to the `x` in the outer scope. + // const x = 2 + // console.log(a) + // } + __isValidResolution(ref, variable) { + + // If `options.nodejsScope` is true, `this.block` becomes a Program node. + if (this.block.type === "Program") { + return true; + } + + const bodyStart = this.block.body.range[0]; + + // It's invalid resolution in the following case: + return !( + variable.scope === this && + ref.identifier.range[0] < bodyStart && // the reference is in the parameter part. + variable.defs.every(d => d.name.range[0] >= bodyStart) // the variable is in the body. + ); + } +} + +class ForScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "for", upperScope, block, false); + } +} + +class ClassScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "class", upperScope, block, false); + } +} + +class ClassFieldInitializerScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "class-field-initializer", upperScope, block, true); + } +} + +class ClassStaticBlockScope extends Scope { + constructor(scopeManager, upperScope, block) { + super(scopeManager, "class-static-block", upperScope, block, true); + } +} + +/* vim: set sw=4 ts=4 et tw=80 : */ + +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +/** + * @constructor ScopeManager + */ +class ScopeManager { + constructor(options) { + this.scopes = []; + this.globalScope = null; + this.__nodeToScope = new WeakMap(); + this.__currentScope = null; + this.__options = options; + this.__declaredVariables = new WeakMap(); + } + + __useDirective() { + return this.__options.directive; + } + + __isOptimistic() { + return this.__options.optimistic; + } + + __ignoreEval() { + return this.__options.ignoreEval; + } + + __isNodejsScope() { + return this.__options.nodejsScope || this.__options.sourceType === "commonjs"; + } + + isModule() { + return this.__options.sourceType === "module"; + } + + isImpliedStrict() { + return this.__options.impliedStrict; + } + + isStrictModeSupported() { + return this.__options.ecmaVersion >= 5; + } + + // Returns appropriate scope for this node. + __get(node) { + return this.__nodeToScope.get(node); + } + + /** + * Get variables that are declared by the node. + * + * "are declared by the node" means the node is same as `Variable.defs[].node` or `Variable.defs[].parent`. + * If the node declares nothing, this method returns an empty array. + * CAUTION: This API is experimental. See https://github.com/estools/escope/pull/69 for more details. + * @param {Espree.Node} node a node to get. + * @returns {Variable[]} variables that declared by the node. + */ + getDeclaredVariables(node) { + return this.__declaredVariables.get(node) || []; + } + + /** + * acquire scope from node. + * @function ScopeManager#acquire + * @param {Espree.Node} node node for the acquired scope. + * @param {?boolean} [inner=false] look up the most inner scope, default value is false. + * @returns {Scope?} Scope from node + */ + acquire(node, inner) { + + /** + * predicate + * @param {Scope} testScope scope to test + * @returns {boolean} predicate + */ + function predicate(testScope) { + if (testScope.type === "function" && testScope.functionExpressionScope) { + return false; + } + return true; + } + + const scopes = this.__get(node); + + if (!scopes || scopes.length === 0) { + return null; + } + + // Heuristic selection from all scopes. + // If you would like to get all scopes, please use ScopeManager#acquireAll. + if (scopes.length === 1) { + return scopes[0]; + } + + if (inner) { + for (let i = scopes.length - 1; i >= 0; --i) { + const scope = scopes[i]; + + if (predicate(scope)) { + return scope; + } + } + } else { + for (let i = 0, iz = scopes.length; i < iz; ++i) { + const scope = scopes[i]; + + if (predicate(scope)) { + return scope; + } + } + } + + return null; + } + + /** + * acquire all scopes from node. + * @function ScopeManager#acquireAll + * @param {Espree.Node} node node for the acquired scope. + * @returns {Scopes?} Scope array + */ + acquireAll(node) { + return this.__get(node); + } + + /** + * release the node. + * @function ScopeManager#release + * @param {Espree.Node} node releasing node. + * @param {?boolean} [inner=false] look up the most inner scope, default value is false. + * @returns {Scope?} upper scope for the node. + */ + release(node, inner) { + const scopes = this.__get(node); + + if (scopes && scopes.length) { + const scope = scopes[0].upper; + + if (!scope) { + return null; + } + return this.acquire(scope.block, inner); + } + return null; + } + + attach() { } // eslint-disable-line class-methods-use-this + + detach() { } // eslint-disable-line class-methods-use-this + + __nestScope(scope) { + if (scope instanceof GlobalScope) { + assert__default["default"](this.__currentScope === null); + this.globalScope = scope; + } + this.__currentScope = scope; + return scope; + } + + __nestGlobalScope(node) { + return this.__nestScope(new GlobalScope(this, node)); + } + + __nestBlockScope(node) { + return this.__nestScope(new BlockScope(this, this.__currentScope, node)); + } + + __nestFunctionScope(node, isMethodDefinition) { + return this.__nestScope(new FunctionScope(this, this.__currentScope, node, isMethodDefinition)); + } + + __nestForScope(node) { + return this.__nestScope(new ForScope(this, this.__currentScope, node)); + } + + __nestCatchScope(node) { + return this.__nestScope(new CatchScope(this, this.__currentScope, node)); + } + + __nestWithScope(node) { + return this.__nestScope(new WithScope(this, this.__currentScope, node)); + } + + __nestClassScope(node) { + return this.__nestScope(new ClassScope(this, this.__currentScope, node)); + } + + __nestClassFieldInitializerScope(node) { + return this.__nestScope(new ClassFieldInitializerScope(this, this.__currentScope, node)); + } + + __nestClassStaticBlockScope(node) { + return this.__nestScope(new ClassStaticBlockScope(this, this.__currentScope, node)); + } + + __nestSwitchScope(node) { + return this.__nestScope(new SwitchScope(this, this.__currentScope, node)); + } + + __nestModuleScope(node) { + return this.__nestScope(new ModuleScope(this, this.__currentScope, node)); + } + + __nestFunctionExpressionNameScope(node) { + return this.__nestScope(new FunctionExpressionNameScope(this, this.__currentScope, node)); + } + + __isES6() { + return this.__options.ecmaVersion >= 6; + } +} + +/* vim: set sw=4 ts=4 et tw=80 : */ + +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +const { Syntax: Syntax$1 } = estraverse__default["default"]; + +/** + * Get last array element + * @param {Array} xs array + * @returns {any} Last elment + */ +function getLast(xs) { + return xs[xs.length - 1] || null; +} + +class PatternVisitor extends esrecurse__default["default"].Visitor { + static isPattern(node) { + const nodeType = node.type; + + return ( + nodeType === Syntax$1.Identifier || + nodeType === Syntax$1.ObjectPattern || + nodeType === Syntax$1.ArrayPattern || + nodeType === Syntax$1.SpreadElement || + nodeType === Syntax$1.RestElement || + nodeType === Syntax$1.AssignmentPattern + ); + } + + constructor(options, rootPattern, callback) { + super(null, options); + this.rootPattern = rootPattern; + this.callback = callback; + this.assignments = []; + this.rightHandNodes = []; + this.restElements = []; + } + + Identifier(pattern) { + const lastRestElement = getLast(this.restElements); + + this.callback(pattern, { + topLevel: pattern === this.rootPattern, + rest: lastRestElement !== null && lastRestElement !== undefined && lastRestElement.argument === pattern, + assignments: this.assignments + }); + } + + Property(property) { + + // Computed property's key is a right hand node. + if (property.computed) { + this.rightHandNodes.push(property.key); + } + + // If it's shorthand, its key is same as its value. + // If it's shorthand and has its default value, its key is same as its value.left (the value is AssignmentPattern). + // If it's not shorthand, the name of new variable is its value's. + this.visit(property.value); + } + + ArrayPattern(pattern) { + for (let i = 0, iz = pattern.elements.length; i < iz; ++i) { + const element = pattern.elements[i]; + + this.visit(element); + } + } + + AssignmentPattern(pattern) { + this.assignments.push(pattern); + this.visit(pattern.left); + this.rightHandNodes.push(pattern.right); + this.assignments.pop(); + } + + RestElement(pattern) { + this.restElements.push(pattern); + this.visit(pattern.argument); + this.restElements.pop(); + } + + MemberExpression(node) { + + // Computed property's key is a right hand node. + if (node.computed) { + this.rightHandNodes.push(node.property); + } + + // the object is only read, write to its property. + this.rightHandNodes.push(node.object); + } + + // + // ForInStatement.left and AssignmentExpression.left are LeftHandSideExpression. + // By spec, LeftHandSideExpression is Pattern or MemberExpression. + // (see also: https://github.com/estree/estree/pull/20#issuecomment-74584758) + // But espree 2.0 parses to ArrayExpression, ObjectExpression, etc... + // + + SpreadElement(node) { + this.visit(node.argument); + } + + ArrayExpression(node) { + node.elements.forEach(this.visit, this); + } + + AssignmentExpression(node) { + this.assignments.push(node); + this.visit(node.left); + this.rightHandNodes.push(node.right); + this.assignments.pop(); + } + + CallExpression(node) { + + // arguments are right hand nodes. + node.arguments.forEach(a => { + this.rightHandNodes.push(a); + }); + this.visit(node.callee); + } +} + +/* vim: set sw=4 ts=4 et tw=80 : */ + +/* + Copyright (C) 2015 Yusuke Suzuki + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +*/ + +const { Syntax } = estraverse__default["default"]; + +/** + * Traverse identifier in pattern + * @param {Object} options options + * @param {pattern} rootPattern root pattern + * @param {Refencer} referencer referencer + * @param {callback} callback callback + * @returns {void} + */ function traverseIdentifierInPattern(options, rootPattern, referencer, callback) { - // Call the callback at left hand identifier nodes, and Collect right hand nodes. - const visitor = new PatternVisitor(options, rootPattern, callback); - visitor.visit(rootPattern); // Process the right hand nodes recursively. - if (referencer !== null && referencer !== undefined) { - visitor.rightHandNodes.forEach(referencer.visit, referencer); - } -} // Importing ImportDeclaration. + // Call the callback at left hand identifier nodes, and Collect right hand nodes. + const visitor = new PatternVisitor(options, rootPattern, callback); + + visitor.visit(rootPattern); + + // Process the right hand nodes recursively. + if (referencer !== null && referencer !== undefined) { + visitor.rightHandNodes.forEach(referencer.visit, referencer); + } +} + +// Importing ImportDeclaration. // http://people.mozilla.org/~jorendorff/es6-draft.html#sec-moduledeclarationinstantiation // https://github.com/estree/estree/blob/master/es6.md#importdeclaration // FIXME: Now, we don't create module environment, because the context is // implementation dependent. - -class Importer extends esrecurse.Visitor { - constructor(declaration, referencer) { - super(null, referencer.options); - this.declaration = declaration; - this.referencer = referencer; - } - - visitImport(id, specifier) { - this.referencer.visitPattern(id, pattern => { - this.referencer.currentScope().__define(pattern, new Definition(Variable.ImportBinding, pattern, specifier, this.declaration, null, null)); - }); - } - - ImportNamespaceSpecifier(node) { - const local = node.local || node.id; - - if (local) { - this.visitImport(local, node); - } - } - - ImportDefaultSpecifier(node) { - const local = node.local || node.id; - this.visitImport(local, node); - } - - ImportSpecifier(node) { - const local = node.local || node.id; - - if (node.name) { - this.visitImport(node.name, node); - } else { - this.visitImport(local, node); - } - } - -} // Referencing variables and creating bindings. - - -class Referencer extends esrecurse.Visitor { - constructor(options, scopeManager) { - super(null, options); - this.options = options; - this.scopeManager = scopeManager; - this.parent = null; - this.isInnerMethodDefinition = false; - } - - currentScope() { - return this.scopeManager.__currentScope; - } - - close(node) { - while (this.currentScope() && node === this.currentScope().block) { - this.scopeManager.__currentScope = this.currentScope().__close(this.scopeManager); - } - } - - pushInnerMethodDefinition(isInnerMethodDefinition) { - const previous = this.isInnerMethodDefinition; - this.isInnerMethodDefinition = isInnerMethodDefinition; - return previous; - } - - popInnerMethodDefinition(isInnerMethodDefinition) { - this.isInnerMethodDefinition = isInnerMethodDefinition; - } - - referencingDefaultValue(pattern, assignments, maybeImplicitGlobal, init) { - const scope = this.currentScope(); - assignments.forEach(assignment => { - scope.__referencing(pattern, Reference.WRITE, assignment.right, maybeImplicitGlobal, pattern !== assignment.left, init); - }); - } - - visitPattern(node, options, callback) { - let visitPatternOptions = options; - let visitPatternCallback = callback; - - if (typeof options === "function") { - visitPatternCallback = options; - visitPatternOptions = { - processRightHandNodes: false - }; +class Importer extends esrecurse__default["default"].Visitor { + constructor(declaration, referencer) { + super(null, referencer.options); + this.declaration = declaration; + this.referencer = referencer; } - traverseIdentifierInPattern(this.options, node, visitPatternOptions.processRightHandNodes ? this : null, visitPatternCallback); - } - - visitFunction(node) { - let i, iz; // FunctionDeclaration name is defined in upper scope - // NOTE: Not referring variableScope. It is intended. - // Since - // in ES5, FunctionDeclaration should be in FunctionBody. - // in ES6, FunctionDeclaration should be block scoped. - - if (node.type === Syntax.FunctionDeclaration) { - // id is defined in upper scope - this.currentScope().__define(node.id, new Definition(Variable.FunctionName, node.id, node, null, null, null)); - } // FunctionExpression with name creates its special scope; - // FunctionExpressionNameScope. - - - if (node.type === Syntax.FunctionExpression && node.id) { - this.scopeManager.__nestFunctionExpressionNameScope(node); - } // Consider this function is in the MethodDefinition. - - - this.scopeManager.__nestFunctionScope(node, this.isInnerMethodDefinition); - - const that = this; - /** - * Visit pattern callback - * @param {pattern} pattern - pattern - * @param {Object} info - info - * @returns {void} - */ - - function visitPatternCallback(pattern, info) { - that.currentScope().__define(pattern, new ParameterDefinition(pattern, node, i, info.rest)); - - that.referencingDefaultValue(pattern, info.assignments, null, true); - } // Process parameter declarations. - - - for (i = 0, iz = node.params.length; i < iz; ++i) { - this.visitPattern(node.params[i], { - processRightHandNodes: true - }, visitPatternCallback); - } // if there's a rest argument, add that - - - if (node.rest) { - this.visitPattern({ - type: "RestElement", - argument: node.rest - }, pattern => { - this.currentScope().__define(pattern, new ParameterDefinition(pattern, node, node.params.length, true)); - }); - } // In TypeScript there are a number of function-like constructs which have no body, - // so check it exists before traversing - - - if (node.body) { - // Skip BlockStatement to prevent creating BlockStatement scope. - if (node.body.type === Syntax.BlockStatement) { - this.visitChildren(node.body); - } else { - this.visit(node.body); - } - } - - this.close(node); - } - - visitClass(node) { - if (node.type === Syntax.ClassDeclaration) { - this.currentScope().__define(node.id, new Definition(Variable.ClassName, node.id, node, null, null, null)); - } - - this.visit(node.superClass); - - this.scopeManager.__nestClassScope(node); - - if (node.id) { - this.currentScope().__define(node.id, new Definition(Variable.ClassName, node.id, node)); - } - - this.visit(node.body); - this.close(node); - } - - visitProperty(node) { - let previous; - - if (node.computed) { - this.visit(node.key); - } - - const isMethodDefinition = node.type === Syntax.MethodDefinition; - - if (isMethodDefinition) { - previous = this.pushInnerMethodDefinition(true); - } - - this.visit(node.value); - - if (isMethodDefinition) { - this.popInnerMethodDefinition(previous); - } - } - - visitForIn(node) { - if (node.left.type === Syntax.VariableDeclaration && node.left.kind !== "var") { - this.scopeManager.__nestForScope(node); - } - - if (node.left.type === Syntax.VariableDeclaration) { - this.visit(node.left); - this.visitPattern(node.left.declarations[0].id, pattern => { - this.currentScope().__referencing(pattern, Reference.WRITE, node.right, null, true, true); - }); - } else { - this.visitPattern(node.left, { - processRightHandNodes: true - }, (pattern, info) => { - let maybeImplicitGlobal = null; - - if (!this.currentScope().isStrict) { - maybeImplicitGlobal = { - pattern, - node - }; - } - - this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false); - - this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, true, false); - }); - } - - this.visit(node.right); - this.visit(node.body); - this.close(node); - } - - visitVariableDeclaration(variableTargetScope, type, node, index) { - const decl = node.declarations[index]; - const init = decl.init; - this.visitPattern(decl.id, { - processRightHandNodes: true - }, (pattern, info) => { - variableTargetScope.__define(pattern, new Definition(type, pattern, decl, node, index, node.kind)); - - this.referencingDefaultValue(pattern, info.assignments, null, true); - - if (init) { - this.currentScope().__referencing(pattern, Reference.WRITE, init, null, !info.topLevel, true); - } - }); - } - - AssignmentExpression(node) { - if (PatternVisitor.isPattern(node.left)) { - if (node.operator === "=") { - this.visitPattern(node.left, { - processRightHandNodes: true - }, (pattern, info) => { - let maybeImplicitGlobal = null; - - if (!this.currentScope().isStrict) { - maybeImplicitGlobal = { - pattern, - node - }; - } - - this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false); - - this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, !info.topLevel, false); + visitImport(id, specifier) { + this.referencer.visitPattern(id, pattern => { + this.referencer.currentScope().__define(pattern, + new Definition( + Variable.ImportBinding, + pattern, + specifier, + this.declaration, + null, + null + )); }); - } else { - this.currentScope().__referencing(node.left, Reference.RW, node.right); - } - } else { - this.visit(node.left); } - this.visit(node.right); - } + ImportNamespaceSpecifier(node) { + const local = (node.local || node.id); - CatchClause(node) { - this.scopeManager.__nestCatchScope(node); - - this.visitPattern(node.param, { - processRightHandNodes: true - }, (pattern, info) => { - this.currentScope().__define(pattern, new Definition(Variable.CatchClause, node.param, node, null, null, null)); - - this.referencingDefaultValue(pattern, info.assignments, null, true); - }); - this.visit(node.body); - this.close(node); - } - - Program(node) { - this.scopeManager.__nestGlobalScope(node); - - if (this.scopeManager.__isNodejsScope()) { - // Force strictness of GlobalScope to false when using node.js scope. - this.currentScope().isStrict = false; - - this.scopeManager.__nestFunctionScope(node, false); + if (local) { + this.visitImport(local, node); + } } - if (this.scopeManager.__isES6() && this.scopeManager.isModule()) { - this.scopeManager.__nestModuleScope(node); + ImportDefaultSpecifier(node) { + const local = (node.local || node.id); + + this.visitImport(local, node); } - if (this.scopeManager.isStrictModeSupported() && this.scopeManager.isImpliedStrict()) { - this.currentScope().isStrict = true; + ImportSpecifier(node) { + const local = (node.local || node.id); + + if (node.name) { + this.visitImport(node.name, node); + } else { + this.visitImport(local, node); + } + } +} + +// Referencing variables and creating bindings. +class Referencer extends esrecurse__default["default"].Visitor { + constructor(options, scopeManager) { + super(null, options); + this.options = options; + this.scopeManager = scopeManager; + this.parent = null; + this.isInnerMethodDefinition = false; + } + + currentScope() { + return this.scopeManager.__currentScope; + } + + close(node) { + while (this.currentScope() && node === this.currentScope().block) { + this.scopeManager.__currentScope = this.currentScope().__close(this.scopeManager); + } + } + + pushInnerMethodDefinition(isInnerMethodDefinition) { + const previous = this.isInnerMethodDefinition; + + this.isInnerMethodDefinition = isInnerMethodDefinition; + return previous; + } + + popInnerMethodDefinition(isInnerMethodDefinition) { + this.isInnerMethodDefinition = isInnerMethodDefinition; + } + + referencingDefaultValue(pattern, assignments, maybeImplicitGlobal, init) { + const scope = this.currentScope(); + + assignments.forEach(assignment => { + scope.__referencing( + pattern, + Reference.WRITE, + assignment.right, + maybeImplicitGlobal, + pattern !== assignment.left, + init + ); + }); + } + + visitPattern(node, options, callback) { + let visitPatternOptions = options; + let visitPatternCallback = callback; + + if (typeof options === "function") { + visitPatternCallback = options; + visitPatternOptions = { processRightHandNodes: false }; + } + + traverseIdentifierInPattern( + this.options, + node, + visitPatternOptions.processRightHandNodes ? this : null, + visitPatternCallback + ); + } + + visitFunction(node) { + let i, iz; + + // FunctionDeclaration name is defined in upper scope + // NOTE: Not referring variableScope. It is intended. + // Since + // in ES5, FunctionDeclaration should be in FunctionBody. + // in ES6, FunctionDeclaration should be block scoped. + + if (node.type === Syntax.FunctionDeclaration) { + + // id is defined in upper scope + this.currentScope().__define(node.id, + new Definition( + Variable.FunctionName, + node.id, + node, + null, + null, + null + )); + } + + // FunctionExpression with name creates its special scope; + // FunctionExpressionNameScope. + if (node.type === Syntax.FunctionExpression && node.id) { + this.scopeManager.__nestFunctionExpressionNameScope(node); + } + + // Consider this function is in the MethodDefinition. + this.scopeManager.__nestFunctionScope(node, this.isInnerMethodDefinition); + + const that = this; + + /** + * Visit pattern callback + * @param {pattern} pattern pattern + * @param {Object} info info + * @returns {void} + */ + function visitPatternCallback(pattern, info) { + that.currentScope().__define(pattern, + new ParameterDefinition( + pattern, + node, + i, + info.rest + )); + + that.referencingDefaultValue(pattern, info.assignments, null, true); + } + + // Process parameter declarations. + for (i = 0, iz = node.params.length; i < iz; ++i) { + this.visitPattern(node.params[i], { processRightHandNodes: true }, visitPatternCallback); + } + + // if there's a rest argument, add that + if (node.rest) { + this.visitPattern({ + type: "RestElement", + argument: node.rest + }, pattern => { + this.currentScope().__define(pattern, + new ParameterDefinition( + pattern, + node, + node.params.length, + true + )); + }); + } + + // In TypeScript there are a number of function-like constructs which have no body, + // so check it exists before traversing + if (node.body) { + + // Skip BlockStatement to prevent creating BlockStatement scope. + if (node.body.type === Syntax.BlockStatement) { + this.visitChildren(node.body); + } else { + this.visit(node.body); + } + } + + this.close(node); + } + + visitClass(node) { + if (node.type === Syntax.ClassDeclaration) { + this.currentScope().__define(node.id, + new Definition( + Variable.ClassName, + node.id, + node, + null, + null, + null + )); + } + + this.visit(node.superClass); + + this.scopeManager.__nestClassScope(node); + + if (node.id) { + this.currentScope().__define(node.id, + new Definition( + Variable.ClassName, + node.id, + node + )); + } + this.visit(node.body); + + this.close(node); + } + + visitProperty(node) { + let previous; + + if (node.computed) { + this.visit(node.key); + } + + const isMethodDefinition = node.type === Syntax.MethodDefinition; + + if (isMethodDefinition) { + previous = this.pushInnerMethodDefinition(true); + } + this.visit(node.value); + if (isMethodDefinition) { + this.popInnerMethodDefinition(previous); + } + } + + visitForIn(node) { + if (node.left.type === Syntax.VariableDeclaration && node.left.kind !== "var") { + this.scopeManager.__nestForScope(node); + } + + if (node.left.type === Syntax.VariableDeclaration) { + this.visit(node.left); + this.visitPattern(node.left.declarations[0].id, pattern => { + this.currentScope().__referencing(pattern, Reference.WRITE, node.right, null, true, true); + }); + } else { + this.visitPattern(node.left, { processRightHandNodes: true }, (pattern, info) => { + let maybeImplicitGlobal = null; + + if (!this.currentScope().isStrict) { + maybeImplicitGlobal = { + pattern, + node + }; + } + this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false); + this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, true, false); + }); + } + this.visit(node.right); + this.visit(node.body); + + this.close(node); + } + + visitVariableDeclaration(variableTargetScope, type, node, index) { + + const decl = node.declarations[index]; + const init = decl.init; + + this.visitPattern(decl.id, { processRightHandNodes: true }, (pattern, info) => { + variableTargetScope.__define( + pattern, + new Definition( + type, + pattern, + decl, + node, + index, + node.kind + ) + ); + + this.referencingDefaultValue(pattern, info.assignments, null, true); + if (init) { + this.currentScope().__referencing(pattern, Reference.WRITE, init, null, !info.topLevel, true); + } + }); + } + + AssignmentExpression(node) { + if (PatternVisitor.isPattern(node.left)) { + if (node.operator === "=") { + this.visitPattern(node.left, { processRightHandNodes: true }, (pattern, info) => { + let maybeImplicitGlobal = null; + + if (!this.currentScope().isStrict) { + maybeImplicitGlobal = { + pattern, + node + }; + } + this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false); + this.currentScope().__referencing(pattern, Reference.WRITE, node.right, maybeImplicitGlobal, !info.topLevel, false); + }); + } else { + this.currentScope().__referencing(node.left, Reference.RW, node.right); + } + } else { + this.visit(node.left); + } + this.visit(node.right); + } + + CatchClause(node) { + this.scopeManager.__nestCatchScope(node); + + this.visitPattern(node.param, { processRightHandNodes: true }, (pattern, info) => { + this.currentScope().__define(pattern, + new Definition( + Variable.CatchClause, + node.param, + node, + null, + null, + null + )); + this.referencingDefaultValue(pattern, info.assignments, null, true); + }); + this.visit(node.body); + + this.close(node); + } + + Program(node) { + this.scopeManager.__nestGlobalScope(node); + + if (this.scopeManager.__isNodejsScope()) { + + // Force strictness of GlobalScope to false when using node.js scope. + this.currentScope().isStrict = false; + this.scopeManager.__nestFunctionScope(node, false); + } + + if (this.scopeManager.__isES6() && this.scopeManager.isModule()) { + this.scopeManager.__nestModuleScope(node); + } + + if (this.scopeManager.isStrictModeSupported() && this.scopeManager.isImpliedStrict()) { + this.currentScope().isStrict = true; + } + + this.visitChildren(node); + this.close(node); + } + + Identifier(node) { + this.currentScope().__referencing(node); + } + + // eslint-disable-next-line class-methods-use-this + PrivateIdentifier() { + + // Do nothing. + } + + UpdateExpression(node) { + if (PatternVisitor.isPattern(node.argument)) { + this.currentScope().__referencing(node.argument, Reference.RW, null); + } else { + this.visitChildren(node); + } + } + + MemberExpression(node) { + this.visit(node.object); + if (node.computed) { + this.visit(node.property); + } + } + + Property(node) { + this.visitProperty(node); + } + + PropertyDefinition(node) { + const { computed, key, value } = node; + + if (computed) { + this.visit(key); + } + if (value) { + this.scopeManager.__nestClassFieldInitializerScope(value); + this.visit(value); + this.close(value); + } + } + + StaticBlock(node) { + this.scopeManager.__nestClassStaticBlockScope(node); + + this.visitChildren(node); + + this.close(node); + } + + MethodDefinition(node) { + this.visitProperty(node); + } + + BreakStatement() {} // eslint-disable-line class-methods-use-this + + ContinueStatement() {} // eslint-disable-line class-methods-use-this + + LabeledStatement(node) { + this.visit(node.body); + } + + ForStatement(node) { + + // Create ForStatement declaration. + // NOTE: In ES6, ForStatement dynamically generates + // per iteration environment. However, escope is + // a static analyzer, we only generate one scope for ForStatement. + if (node.init && node.init.type === Syntax.VariableDeclaration && node.init.kind !== "var") { + this.scopeManager.__nestForScope(node); + } + + this.visitChildren(node); + + this.close(node); + } + + ClassExpression(node) { + this.visitClass(node); + } + + ClassDeclaration(node) { + this.visitClass(node); + } + + CallExpression(node) { + + // Check this is direct call to eval + if (!this.scopeManager.__ignoreEval() && node.callee.type === Syntax.Identifier && node.callee.name === "eval") { + + // NOTE: This should be `variableScope`. Since direct eval call always creates Lexical environment and + // let / const should be enclosed into it. Only VariableDeclaration affects on the caller's environment. + this.currentScope().variableScope.__detectEval(); + } + this.visitChildren(node); + } + + BlockStatement(node) { + if (this.scopeManager.__isES6()) { + this.scopeManager.__nestBlockScope(node); + } + + this.visitChildren(node); + + this.close(node); + } + + ThisExpression() { + this.currentScope().variableScope.__detectThis(); + } + + WithStatement(node) { + this.visit(node.object); + + // Then nest scope for WithStatement. + this.scopeManager.__nestWithScope(node); + + this.visit(node.body); + + this.close(node); + } + + VariableDeclaration(node) { + const variableTargetScope = (node.kind === "var") ? this.currentScope().variableScope : this.currentScope(); + + for (let i = 0, iz = node.declarations.length; i < iz; ++i) { + const decl = node.declarations[i]; + + this.visitVariableDeclaration(variableTargetScope, Variable.Variable, node, i); + if (decl.init) { + this.visit(decl.init); + } + } + } + + // sec 13.11.8 + SwitchStatement(node) { + this.visit(node.discriminant); + + if (this.scopeManager.__isES6()) { + this.scopeManager.__nestSwitchScope(node); + } + + for (let i = 0, iz = node.cases.length; i < iz; ++i) { + this.visit(node.cases[i]); + } + + this.close(node); + } + + FunctionDeclaration(node) { + this.visitFunction(node); + } + + FunctionExpression(node) { + this.visitFunction(node); + } + + ForOfStatement(node) { + this.visitForIn(node); + } + + ForInStatement(node) { + this.visitForIn(node); + } + + ArrowFunctionExpression(node) { + this.visitFunction(node); + } + + ImportDeclaration(node) { + assert__default["default"](this.scopeManager.__isES6() && this.scopeManager.isModule(), "ImportDeclaration should appear when the mode is ES6 and in the module context."); + + const importer = new Importer(node, this); + + importer.visit(node); + } + + visitExportDeclaration(node) { + if (node.source) { + return; + } + if (node.declaration) { + this.visit(node.declaration); + return; + } + + this.visitChildren(node); + } + + // TODO: ExportDeclaration doesn't exist. for bc? + ExportDeclaration(node) { + this.visitExportDeclaration(node); + } + + ExportAllDeclaration(node) { + this.visitExportDeclaration(node); + } + + ExportDefaultDeclaration(node) { + this.visitExportDeclaration(node); + } + + ExportNamedDeclaration(node) { + this.visitExportDeclaration(node); + } + + ExportSpecifier(node) { + + // TODO: `node.id` doesn't exist. for bc? + const local = (node.id || node.local); + + this.visit(local); + } + + MetaProperty() { // eslint-disable-line class-methods-use-this + + // do nothing. } - - this.visitChildren(node); - this.close(node); - } - - Identifier(node) { - this.currentScope().__referencing(node); - } - - UpdateExpression(node) { - if (PatternVisitor.isPattern(node.argument)) { - this.currentScope().__referencing(node.argument, Reference.RW, null); - } else { - this.visitChildren(node); - } - } - - MemberExpression(node) { - this.visit(node.object); - - if (node.computed) { - this.visit(node.property); - } - } - - Property(node) { - this.visitProperty(node); - } - - MethodDefinition(node) { - this.visitProperty(node); - } - - BreakStatement() {} // eslint-disable-line class-methods-use-this - - - ContinueStatement() {} // eslint-disable-line class-methods-use-this - - - LabeledStatement(node) { - this.visit(node.body); - } - - ForStatement(node) { - // Create ForStatement declaration. - // NOTE: In ES6, ForStatement dynamically generates - // per iteration environment. However, escope is - // a static analyzer, we only generate one scope for ForStatement. - if (node.init && node.init.type === Syntax.VariableDeclaration && node.init.kind !== "var") { - this.scopeManager.__nestForScope(node); - } - - this.visitChildren(node); - this.close(node); - } - - ClassExpression(node) { - this.visitClass(node); - } - - ClassDeclaration(node) { - this.visitClass(node); - } - - CallExpression(node) { - // Check this is direct call to eval - if (!this.scopeManager.__ignoreEval() && node.callee.type === Syntax.Identifier && node.callee.name === "eval") { - // NOTE: This should be `variableScope`. Since direct eval call always creates Lexical environment and - // let / const should be enclosed into it. Only VariableDeclaration affects on the caller's environment. - this.currentScope().variableScope.__detectEval(); - } - - this.visitChildren(node); - } - - BlockStatement(node) { - if (this.scopeManager.__isES6()) { - this.scopeManager.__nestBlockScope(node); - } - - this.visitChildren(node); - this.close(node); - } - - ThisExpression() { - this.currentScope().variableScope.__detectThis(); - } - - WithStatement(node) { - this.visit(node.object); // Then nest scope for WithStatement. - - this.scopeManager.__nestWithScope(node); - - this.visit(node.body); - this.close(node); - } - - VariableDeclaration(node) { - const variableTargetScope = node.kind === "var" ? this.currentScope().variableScope : this.currentScope(); - - for (let i = 0, iz = node.declarations.length; i < iz; ++i) { - const decl = node.declarations[i]; - this.visitVariableDeclaration(variableTargetScope, Variable.Variable, node, i); - - if (decl.init) { - this.visit(decl.init); - } - } - } // sec 13.11.8 - - - SwitchStatement(node) { - this.visit(node.discriminant); - - if (this.scopeManager.__isES6()) { - this.scopeManager.__nestSwitchScope(node); - } - - for (let i = 0, iz = node.cases.length; i < iz; ++i) { - this.visit(node.cases[i]); - } - - this.close(node); - } - - FunctionDeclaration(node) { - this.visitFunction(node); - } - - FunctionExpression(node) { - this.visitFunction(node); - } - - ForOfStatement(node) { - this.visitForIn(node); - } - - ForInStatement(node) { - this.visitForIn(node); - } - - ArrowFunctionExpression(node) { - this.visitFunction(node); - } - - ImportDeclaration(node) { - assert(this.scopeManager.__isES6() && this.scopeManager.isModule(), "ImportDeclaration should appear when the mode is ES6 and in the module context."); - const importer = new Importer(node, this); - importer.visit(node); - } - - visitExportDeclaration(node) { - if (node.source) { - return; - } - - if (node.declaration) { - this.visit(node.declaration); - return; - } - - this.visitChildren(node); - } // TODO: ExportDeclaration doesn't exist. for bc? - - - ExportDeclaration(node) { - this.visitExportDeclaration(node); - } - - ExportAllDeclaration(node) { - this.visitExportDeclaration(node); - } - - ExportDefaultDeclaration(node) { - this.visitExportDeclaration(node); - } - - ExportNamedDeclaration(node) { - this.visitExportDeclaration(node); - } - - ExportSpecifier(node) { - // TODO: `node.id` doesn't exist. for bc? - const local = node.id || node.local; - this.visit(local); - } - - MetaProperty() {// eslint-disable-line class-methods-use-this - // do nothing. - } - } -module.exports = Referencer; /* vim: set sw=4 ts=4 et tw=80 : */ -/***/ }), -/* 416 */ -/***/ ((__unused_webpack_module, exports, __webpack_require__) => { +const version = "7.1.0"; /* - Copyright (C) 2014 Yusuke Suzuki + Copyright (C) 2012-2014 Yusuke Suzuki + Copyright (C) 2013 Alex Seville + Copyright (C) 2014 Thiago de Arruda Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -21216,109 +21679,114 @@ module.exports = Referencer; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -(function () { - 'use strict'; - var estraverse = __webpack_require__(417); +/** + * Set the default options + * @returns {Object} options + */ +function defaultOptions() { + return { + optimistic: false, + directive: false, + nodejsScope: false, + impliedStrict: false, + sourceType: "script", // one of ['script', 'module', 'commonjs'] + ecmaVersion: 5, + childVisitorKeys: null, + fallback: "iteration" + }; +} - function isNode(node) { - if (node == null) { - return false; +/** + * Preform deep update on option object + * @param {Object} target Options + * @param {Object} override Updates + * @returns {Object} Updated options + */ +function updateDeeply(target, override) { + + /** + * Is hash object + * @param {Object} value Test value + * @returns {boolean} Result + */ + function isHashObject(value) { + return typeof value === "object" && value instanceof Object && !(value instanceof Array) && !(value instanceof RegExp); } - return typeof node === 'object' && typeof node.type === 'string'; - } + for (const key in override) { + if (Object.prototype.hasOwnProperty.call(override, key)) { + const val = override[key]; - function isProperty(nodeType, key) { - return (nodeType === estraverse.Syntax.ObjectExpression || nodeType === estraverse.Syntax.ObjectPattern) && key === 'properties'; - } - - function Visitor(visitor, options) { - options = options || {}; - this.__visitor = visitor || this; - this.__childVisitorKeys = options.childVisitorKeys ? Object.assign({}, estraverse.VisitorKeys, options.childVisitorKeys) : estraverse.VisitorKeys; - - if (options.fallback === 'iteration') { - this.__fallback = Object.keys; - } else if (typeof options.fallback === 'function') { - this.__fallback = options.fallback; - } - } - /* Default method for visiting children. - * When you need to call default visiting operation inside custom visiting - * operation, you can use it with `this.visitChildren(node)`. - */ - - - Visitor.prototype.visitChildren = function (node) { - var type, children, i, iz, j, jz, child; - - if (node == null) { - return; - } - - type = node.type || estraverse.Syntax.Property; - children = this.__childVisitorKeys[type]; - - if (!children) { - if (this.__fallback) { - children = this.__fallback(node); - } else { - throw new Error('Unknown node type ' + type + '.'); - } - } - - for (i = 0, iz = children.length; i < iz; ++i) { - child = node[children[i]]; - - if (child) { - if (Array.isArray(child)) { - for (j = 0, jz = child.length; j < jz; ++j) { - if (child[j]) { - if (isNode(child[j]) || isProperty(type, children[i])) { - this.visit(child[j]); - } + if (isHashObject(val)) { + if (isHashObject(target[key])) { + updateDeeply(target[key], val); + } else { + target[key] = updateDeeply({}, val); + } + } else { + target[key] = val; } - } - } else if (isNode(child)) { - this.visit(child); } - } } - }; - /* Dispatching node. */ + return target; +} +/** + * Main interface function. Takes an Espree syntax tree and returns the + * analyzed scopes. + * @function analyze + * @param {espree.Tree} tree Abstract Syntax Tree + * @param {Object} providedOptions Options that tailor the scope analysis + * @param {boolean} [providedOptions.optimistic=false] the optimistic flag + * @param {boolean} [providedOptions.directive=false] the directive flag + * @param {boolean} [providedOptions.ignoreEval=false] whether to check 'eval()' calls + * @param {boolean} [providedOptions.nodejsScope=false] whether the whole + * script is executed under node.js environment. When enabled, escope adds + * a function scope immediately following the global scope. + * @param {boolean} [providedOptions.impliedStrict=false] implied strict mode + * (if ecmaVersion >= 5). + * @param {string} [providedOptions.sourceType='script'] the source type of the script. one of 'script', 'module', and 'commonjs' + * @param {number} [providedOptions.ecmaVersion=5] which ECMAScript version is considered + * @param {Object} [providedOptions.childVisitorKeys=null] Additional known visitor keys. See [esrecurse](https://github.com/estools/esrecurse)'s the `childVisitorKeys` option. + * @param {string} [providedOptions.fallback='iteration'] A kind of the fallback in order to encounter with unknown node. See [esrecurse](https://github.com/estools/esrecurse)'s the `fallback` option. + * @returns {ScopeManager} ScopeManager + */ +function analyze(tree, providedOptions) { + const options = updateDeeply(defaultOptions(), providedOptions); + const scopeManager = new ScopeManager(options); + const referencer = new Referencer(options, scopeManager); - Visitor.prototype.visit = function (node) { - var type; + referencer.visit(tree); - if (node == null) { - return; - } + assert__default["default"](scopeManager.__currentScope === null, "currentScope should be null."); - type = node.type || estraverse.Syntax.Property; + return scopeManager; +} - if (this.__visitor[type]) { - this.__visitor[type].call(this, node); - - return; - } - - this.visitChildren(node); - }; - - exports.version = __webpack_require__(418).version; - exports.Visitor = Visitor; - - exports.visit = function (node, visitor, options) { - var v = new Visitor(visitor, options); - v.visit(node); - }; -})(); /* vim: set sw=4 ts=4 et tw=80 : */ +exports.Definition = Definition; +exports.PatternVisitor = PatternVisitor; +exports.Reference = Reference; +exports.Referencer = Referencer; +exports.Scope = Scope; +exports.ScopeManager = ScopeManager; +exports.Variable = Variable; +exports.analyze = analyze; +exports.version = version; +//# sourceMappingURL=eslint-scope.cjs.map + + /***/ }), -/* 417 */ +/* 431 */ +/***/ ((module) => { + +"use strict"; +module.exports = require("assert"); + +/***/ }), +/* 432 */ /***/ ((__unused_webpack_module, exports) => { /* @@ -21454,8 +21922,10 @@ module.exports = Referencer; NewExpression: 'NewExpression', ObjectExpression: 'ObjectExpression', ObjectPattern: 'ObjectPattern', + PrivateIdentifier: 'PrivateIdentifier', Program: 'Program', Property: 'Property', + PropertyDefinition: 'PropertyDefinition', RestElement: 'RestElement', ReturnStatement: 'ReturnStatement', SequenceExpression: 'SequenceExpression', @@ -21533,8 +22003,10 @@ module.exports = Referencer; NewExpression: ['callee', 'arguments'], ObjectExpression: ['properties'], ObjectPattern: ['properties'], + PrivateIdentifier: [], Program: ['body'], Property: ['key', 'value'], + PropertyDefinition: ['key', 'value'], RestElement: ['argument'], ReturnStatement: ['argument'], SequenceExpression: ['expressions'], @@ -22128,19 +22600,11 @@ module.exports = Referencer; /* vim: set sw=4 ts=4 et tw=80 : */ /***/ }), -/* 418 */ -/***/ ((module) => { +/* 433 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { -"use strict"; -module.exports = JSON.parse('{"name":"esrecurse","description":"ECMAScript AST recursive visitor","homepage":"https://github.com/estools/esrecurse","main":"esrecurse.js","version":"4.3.0","engines":{"node":">=4.0"},"maintainers":[{"name":"Yusuke Suzuki","email":"utatane.tea@gmail.com","web":"https://github.com/Constellation"}],"repository":{"type":"git","url":"https://github.com/estools/esrecurse.git"},"dependencies":{"estraverse":"^5.2.0"},"devDependencies":{"babel-cli":"^6.24.1","babel-eslint":"^7.2.3","babel-preset-es2015":"^6.24.1","babel-register":"^6.24.1","chai":"^4.0.2","esprima":"^4.0.0","gulp":"^3.9.0","gulp-bump":"^2.7.0","gulp-eslint":"^4.0.0","gulp-filter":"^5.0.0","gulp-git":"^2.4.1","gulp-mocha":"^4.3.1","gulp-tag-version":"^1.2.1","jsdoc":"^3.3.0-alpha10","minimist":"^1.1.0"},"license":"BSD-2-Clause","scripts":{"test":"gulp travis","unit-test":"gulp test","lint":"gulp lint"},"babel":{"presets":["es2015"]}}'); - -/***/ }), -/* 419 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; /* - Copyright (C) 2015 Yusuke Suzuki + Copyright (C) 2014 Yusuke Suzuki Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -22162,224 +22626,1322 @@ module.exports = JSON.parse('{"name":"esrecurse","description":"ECMAScript AST r (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +(function () { + 'use strict'; -/* eslint-disable no-undefined */ + var estraverse = __webpack_require__(432); -const Syntax = __webpack_require__(410).Syntax; + function isNode(node) { + if (node == null) { + return false; + } -const esrecurse = __webpack_require__(416); -/** - * Get last array element - * @param {array} xs - array - * @returns {any} Last elment - */ - - -function getLast(xs) { - return xs[xs.length - 1] || null; -} - -class PatternVisitor extends esrecurse.Visitor { - static isPattern(node) { - const nodeType = node.type; - return nodeType === Syntax.Identifier || nodeType === Syntax.ObjectPattern || nodeType === Syntax.ArrayPattern || nodeType === Syntax.SpreadElement || nodeType === Syntax.RestElement || nodeType === Syntax.AssignmentPattern; + return typeof node === 'object' && typeof node.type === 'string'; } - constructor(options, rootPattern, callback) { - super(null, options); - this.rootPattern = rootPattern; - this.callback = callback; - this.assignments = []; - this.rightHandNodes = []; - this.restElements = []; + function isProperty(nodeType, key) { + return (nodeType === estraverse.Syntax.ObjectExpression || nodeType === estraverse.Syntax.ObjectPattern) && key === 'properties'; } - Identifier(pattern) { - const lastRestElement = getLast(this.restElements); - this.callback(pattern, { - topLevel: pattern === this.rootPattern, - rest: lastRestElement !== null && lastRestElement !== undefined && lastRestElement.argument === pattern, - assignments: this.assignments - }); - } + function Visitor(visitor, options) { + options = options || {}; + this.__visitor = visitor || this; + this.__childVisitorKeys = options.childVisitorKeys ? Object.assign({}, estraverse.VisitorKeys, options.childVisitorKeys) : estraverse.VisitorKeys; - Property(property) { - // Computed property's key is a right hand node. - if (property.computed) { - this.rightHandNodes.push(property.key); - } // If it's shorthand, its key is same as its value. - // If it's shorthand and has its default value, its key is same as its value.left (the value is AssignmentPattern). - // If it's not shorthand, the name of new variable is its value's. - - - this.visit(property.value); - } - - ArrayPattern(pattern) { - for (let i = 0, iz = pattern.elements.length; i < iz; ++i) { - const element = pattern.elements[i]; - this.visit(element); + if (options.fallback === 'iteration') { + this.__fallback = Object.keys; + } else if (typeof options.fallback === 'function') { + this.__fallback = options.fallback; } } - - AssignmentPattern(pattern) { - this.assignments.push(pattern); - this.visit(pattern.left); - this.rightHandNodes.push(pattern.right); - this.assignments.pop(); - } - - RestElement(pattern) { - this.restElements.push(pattern); - this.visit(pattern.argument); - this.restElements.pop(); - } - - MemberExpression(node) { - // Computed property's key is a right hand node. - if (node.computed) { - this.rightHandNodes.push(node.property); - } // the object is only read, write to its property. + /* Default method for visiting children. + * When you need to call default visiting operation inside custom visiting + * operation, you can use it with `this.visitChildren(node)`. + */ - this.rightHandNodes.push(node.object); - } // - // ForInStatement.left and AssignmentExpression.left are LeftHandSideExpression. - // By spec, LeftHandSideExpression is Pattern or MemberExpression. - // (see also: https://github.com/estree/estree/pull/20#issuecomment-74584758) - // But espree 2.0 parses to ArrayExpression, ObjectExpression, etc... - // + Visitor.prototype.visitChildren = function (node) { + var type, children, i, iz, j, jz, child; + + if (node == null) { + return; + } + + type = node.type || estraverse.Syntax.Property; + children = this.__childVisitorKeys[type]; + + if (!children) { + if (this.__fallback) { + children = this.__fallback(node); + } else { + throw new Error('Unknown node type ' + type + '.'); + } + } + + for (i = 0, iz = children.length; i < iz; ++i) { + child = node[children[i]]; + + if (child) { + if (Array.isArray(child)) { + for (j = 0, jz = child.length; j < jz; ++j) { + if (child[j]) { + if (isNode(child[j]) || isProperty(type, children[i])) { + this.visit(child[j]); + } + } + } + } else if (isNode(child)) { + this.visit(child); + } + } + } + }; + /* Dispatching node. */ - SpreadElement(node) { - this.visit(node.argument); - } + Visitor.prototype.visit = function (node) { + var type; - ArrayExpression(node) { - node.elements.forEach(this.visit, this); - } + if (node == null) { + return; + } - AssignmentExpression(node) { - this.assignments.push(node); - this.visit(node.left); - this.rightHandNodes.push(node.right); - this.assignments.pop(); - } + type = node.type || estraverse.Syntax.Property; - CallExpression(node) { - // arguments are right hand nodes. - node.arguments.forEach(a => { - this.rightHandNodes.push(a); - }); - this.visit(node.callee); - } + if (this.__visitor[type]) { + this.__visitor[type].call(this, node); -} + return; + } -module.exports = PatternVisitor; + this.visitChildren(node); + }; + + exports.version = __webpack_require__(434).version; + exports.Visitor = Visitor; + + exports.visit = function (node, visitor, options) { + var v = new Visitor(visitor, options); + v.visit(node); + }; +})(); /* vim: set sw=4 ts=4 et tw=80 : */ /***/ }), -/* 420 */ +/* 434 */ /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"name":"eslint-scope","description":"ECMAScript scope analyzer for ESLint","homepage":"http://github.com/eslint/eslint-scope","main":"lib/index.js","version":"5.1.1","engines":{"node":">=8.0.0"},"repository":"eslint/eslint-scope","bugs":{"url":"https://github.com/eslint/eslint-scope/issues"},"license":"BSD-2-Clause","scripts":{"test":"node Makefile.js test","lint":"node Makefile.js lint","generate-release":"eslint-generate-release","generate-alpharelease":"eslint-generate-prerelease alpha","generate-betarelease":"eslint-generate-prerelease beta","generate-rcrelease":"eslint-generate-prerelease rc","publish-release":"eslint-publish-release"},"files":["LICENSE","README.md","lib"],"dependencies":{"esrecurse":"^4.3.0","estraverse":"^4.1.1"},"devDependencies":{"@typescript-eslint/parser":"^1.11.0","chai":"^4.2.0","eslint":"^6.0.1","eslint-config-eslint":"^5.0.1","eslint-plugin-node":"^9.1.0","eslint-release":"^1.0.0","eslint-visitor-keys":"^1.2.0","espree":"^7.1.0","istanbul":"^0.4.5","mocha":"^6.1.4","npm-license":"^0.3.3","shelljs":"^0.8.3","typescript":"^3.5.2"}}'); +module.exports = JSON.parse('{"name":"esrecurse","description":"ECMAScript AST recursive visitor","homepage":"https://github.com/estools/esrecurse","main":"esrecurse.js","version":"4.3.0","engines":{"node":">=4.0"},"maintainers":[{"name":"Yusuke Suzuki","email":"utatane.tea@gmail.com","web":"https://github.com/Constellation"}],"repository":{"type":"git","url":"https://github.com/estools/esrecurse.git"},"dependencies":{"estraverse":"^5.2.0"},"devDependencies":{"babel-cli":"^6.24.1","babel-eslint":"^7.2.3","babel-preset-es2015":"^6.24.1","babel-register":"^6.24.1","chai":"^4.0.2","esprima":"^4.0.0","gulp":"^3.9.0","gulp-bump":"^2.7.0","gulp-eslint":"^4.0.0","gulp-filter":"^5.0.0","gulp-git":"^2.4.1","gulp-mocha":"^4.3.1","gulp-tag-version":"^1.2.1","jsdoc":"^3.3.0-alpha10","minimist":"^1.1.0"},"license":"BSD-2-Clause","scripts":{"test":"gulp travis","unit-test":"gulp test","lint":"gulp lint"},"babel":{"presets":["es2015"]}}'); /***/ }), -/* 421 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/* 435 */ +/***/ ((__unused_webpack_module, exports) => { "use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +const KEYS = { + AssignmentExpression: [ + "left", + "right" + ], + AssignmentPattern: [ + "left", + "right" + ], + ArrayExpression: [ + "elements" + ], + ArrayPattern: [ + "elements" + ], + ArrowFunctionExpression: [ + "params", + "body" + ], + AwaitExpression: [ + "argument" + ], + BlockStatement: [ + "body" + ], + BinaryExpression: [ + "left", + "right" + ], + BreakStatement: [ + "label" + ], + CallExpression: [ + "callee", + "arguments" + ], + CatchClause: [ + "param", + "body" + ], + ChainExpression: [ + "expression" + ], + ClassBody: [ + "body" + ], + ClassDeclaration: [ + "id", + "superClass", + "body" + ], + ClassExpression: [ + "id", + "superClass", + "body" + ], + ConditionalExpression: [ + "test", + "consequent", + "alternate" + ], + ContinueStatement: [ + "label" + ], + DebuggerStatement: [], + DoWhileStatement: [ + "body", + "test" + ], + EmptyStatement: [], + ExportAllDeclaration: [ + "exported", + "source" + ], + ExportDefaultDeclaration: [ + "declaration" + ], + ExportNamedDeclaration: [ + "declaration", + "specifiers", + "source" + ], + ExportSpecifier: [ + "exported", + "local" + ], + ExpressionStatement: [ + "expression" + ], + ExperimentalRestProperty: [ + "argument" + ], + ExperimentalSpreadProperty: [ + "argument" + ], + ForStatement: [ + "init", + "test", + "update", + "body" + ], + ForInStatement: [ + "left", + "right", + "body" + ], + ForOfStatement: [ + "left", + "right", + "body" + ], + FunctionDeclaration: [ + "id", + "params", + "body" + ], + FunctionExpression: [ + "id", + "params", + "body" + ], + Identifier: [], + IfStatement: [ + "test", + "consequent", + "alternate" + ], + ImportDeclaration: [ + "specifiers", + "source" + ], + ImportDefaultSpecifier: [ + "local" + ], + ImportExpression: [ + "source" + ], + ImportNamespaceSpecifier: [ + "local" + ], + ImportSpecifier: [ + "imported", + "local" + ], + JSXAttribute: [ + "name", + "value" + ], + JSXClosingElement: [ + "name" + ], + JSXElement: [ + "openingElement", + "children", + "closingElement" + ], + JSXEmptyExpression: [], + JSXExpressionContainer: [ + "expression" + ], + JSXIdentifier: [], + JSXMemberExpression: [ + "object", + "property" + ], + JSXNamespacedName: [ + "namespace", + "name" + ], + JSXOpeningElement: [ + "name", + "attributes" + ], + JSXSpreadAttribute: [ + "argument" + ], + JSXText: [], + JSXFragment: [ + "openingFragment", + "children", + "closingFragment" + ], + Literal: [], + LabeledStatement: [ + "label", + "body" + ], + LogicalExpression: [ + "left", + "right" + ], + MemberExpression: [ + "object", + "property" + ], + MetaProperty: [ + "meta", + "property" + ], + MethodDefinition: [ + "key", + "value" + ], + NewExpression: [ + "callee", + "arguments" + ], + ObjectExpression: [ + "properties" + ], + ObjectPattern: [ + "properties" + ], + PrivateIdentifier: [], + Program: [ + "body" + ], + Property: [ + "key", + "value" + ], + PropertyDefinition: [ + "key", + "value" + ], + RestElement: [ + "argument" + ], + ReturnStatement: [ + "argument" + ], + SequenceExpression: [ + "expressions" + ], + SpreadElement: [ + "argument" + ], + StaticBlock: [ + "body" + ], + Super: [], + SwitchStatement: [ + "discriminant", + "cases" + ], + SwitchCase: [ + "test", + "consequent" + ], + TaggedTemplateExpression: [ + "tag", + "quasi" + ], + TemplateElement: [], + TemplateLiteral: [ + "quasis", + "expressions" + ], + ThisExpression: [], + ThrowStatement: [ + "argument" + ], + TryStatement: [ + "block", + "handler", + "finalizer" + ], + UnaryExpression: [ + "argument" + ], + UpdateExpression: [ + "argument" + ], + VariableDeclaration: [ + "declarations" + ], + VariableDeclarator: [ + "id", + "init" + ], + WhileStatement: [ + "test", + "body" + ], + WithStatement: [ + "object", + "body" + ], + YieldExpression: [ + "argument" + ] +}; + +// Types. +const NODE_TYPES = Object.keys(KEYS); + +// Freeze the keys. +for (const type of NODE_TYPES) { + Object.freeze(KEYS[type]); +} +Object.freeze(KEYS); + /** * @author Toru Nagashima * See LICENSE file in root directory for full license. */ +// List to ignore keys. +const KEY_BLACKLIST = new Set([ + "parent", + "leadingComments", + "trailingComments" +]); -const KEYS = __webpack_require__(422); // Types. - - -const NODE_TYPES = Object.freeze(Object.keys(KEYS)); // Freeze the keys. - -for (const type of NODE_TYPES) { - Object.freeze(KEYS[type]); -} - -Object.freeze(KEYS); // List to ignore keys. - -const KEY_BLACKLIST = new Set(["parent", "leadingComments", "trailingComments"]); /** * Check whether a given key should be used or not. * @param {string} key The key to check. * @returns {boolean} `true` if the key should be used. */ - function filterKey(key) { - return !KEY_BLACKLIST.has(key) && key[0] !== "_"; -} //------------------------------------------------------------------------------ -// Public interfaces -//------------------------------------------------------------------------------ + return !KEY_BLACKLIST.has(key) && key[0] !== "_"; +} - -module.exports = Object.freeze({ - /** - * Visitor keys. - * @type {{ [type: string]: string[] | undefined }} - */ - KEYS, - - /** - * Get visitor keys of a given node. - * @param {Object} node The AST node to get keys. - * @returns {string[]} Visitor keys of the node. - */ - getKeys(node) { +/** + * Get visitor keys of a given node. + * @param {Object} node The AST node to get keys. + * @returns {string[]} Visitor keys of the node. + */ +function getKeys(node) { return Object.keys(node).filter(filterKey); - }, +} - // Disable valid-jsdoc rule because it reports syntax error on the type of @returns. - // eslint-disable-next-line valid-jsdoc - - /** - * Make the union set with `KEYS` and given keys. - * @param {Object} additionalKeys The additional keys. - * @returns {{ [type: string]: string[] | undefined }} The union set. - */ - unionWith(additionalKeys) { +// Disable valid-jsdoc rule because it reports syntax error on the type of @returns. +// eslint-disable-next-line valid-jsdoc +/** + * Make the union set with `KEYS` and given keys. + * @param {Object} additionalKeys The additional keys. + * @returns {{ [type: string]: string[] | undefined }} The union set. + */ +function unionWith(additionalKeys) { const retv = Object.assign({}, KEYS); for (const type of Object.keys(additionalKeys)) { - if (retv.hasOwnProperty(type)) { - const keys = new Set(additionalKeys[type]); + if (Object.prototype.hasOwnProperty.call(retv, type)) { + const keys = new Set(additionalKeys[type]); - for (const key of retv[type]) { - keys.add(key); + for (const key of retv[type]) { + keys.add(key); + } + + retv[type] = Object.freeze(Array.from(keys)); + } else { + retv[type] = Object.freeze(Array.from(additionalKeys[type])); } - - retv[type] = Object.freeze(Array.from(keys)); - } else { - retv[type] = Object.freeze(Array.from(additionalKeys[type])); - } } return Object.freeze(retv); - } +} + +exports.KEYS = KEYS; +exports.getKeys = getKeys; +exports.unionWith = unionWith; +//# sourceMappingURL=eslint-visitor-keys.cjs.map -}); /***/ }), -/* 422 */ -/***/ ((module) => { - -"use strict"; -module.exports = JSON.parse('{"AssignmentExpression":["left","right"],"AssignmentPattern":["left","right"],"ArrayExpression":["elements"],"ArrayPattern":["elements"],"ArrowFunctionExpression":["params","body"],"AwaitExpression":["argument"],"BlockStatement":["body"],"BinaryExpression":["left","right"],"BreakStatement":["label"],"CallExpression":["callee","arguments"],"CatchClause":["param","body"],"ChainExpression":["expression"],"ClassBody":["body"],"ClassDeclaration":["id","superClass","body"],"ClassExpression":["id","superClass","body"],"ConditionalExpression":["test","consequent","alternate"],"ContinueStatement":["label"],"DebuggerStatement":[],"DoWhileStatement":["body","test"],"EmptyStatement":[],"ExportAllDeclaration":["exported","source"],"ExportDefaultDeclaration":["declaration"],"ExportNamedDeclaration":["declaration","specifiers","source"],"ExportSpecifier":["exported","local"],"ExpressionStatement":["expression"],"ExperimentalRestProperty":["argument"],"ExperimentalSpreadProperty":["argument"],"ForStatement":["init","test","update","body"],"ForInStatement":["left","right","body"],"ForOfStatement":["left","right","body"],"FunctionDeclaration":["id","params","body"],"FunctionExpression":["id","params","body"],"Identifier":[],"IfStatement":["test","consequent","alternate"],"ImportDeclaration":["specifiers","source"],"ImportDefaultSpecifier":["local"],"ImportExpression":["source"],"ImportNamespaceSpecifier":["local"],"ImportSpecifier":["imported","local"],"JSXAttribute":["name","value"],"JSXClosingElement":["name"],"JSXElement":["openingElement","children","closingElement"],"JSXEmptyExpression":[],"JSXExpressionContainer":["expression"],"JSXIdentifier":[],"JSXMemberExpression":["object","property"],"JSXNamespacedName":["namespace","name"],"JSXOpeningElement":["name","attributes"],"JSXSpreadAttribute":["argument"],"JSXText":[],"JSXFragment":["openingFragment","children","closingFragment"],"Literal":[],"LabeledStatement":["label","body"],"LogicalExpression":["left","right"],"MemberExpression":["object","property"],"MetaProperty":["meta","property"],"MethodDefinition":["key","value"],"NewExpression":["callee","arguments"],"ObjectExpression":["properties"],"ObjectPattern":["properties"],"PrivateIdentifier":[],"Program":["body"],"Property":["key","value"],"PropertyDefinition":["key","value"],"RestElement":["argument"],"ReturnStatement":["argument"],"SequenceExpression":["expressions"],"SpreadElement":["argument"],"Super":[],"SwitchStatement":["discriminant","cases"],"SwitchCase":["test","consequent"],"TaggedTemplateExpression":["tag","quasi"],"TemplateElement":[],"TemplateLiteral":["quasis","expressions"],"ThisExpression":[],"ThrowStatement":["argument"],"TryStatement":["block","handler","finalizer"],"UnaryExpression":["argument"],"UpdateExpression":["argument"],"VariableDeclaration":["declarations"],"VariableDeclarator":["id","init"],"WhileStatement":["test","body"],"WithStatement":["object","body"],"YieldExpression":["argument"]}'); - -/***/ }), -/* 423 */ +/* 436 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var acorn = __webpack_require__(437); +var jsx = __webpack_require__(440); +var visitorKeys = __webpack_require__(435); + +function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + +function _interopNamespace(e) { + if (e && e.__esModule) return e; + var n = Object.create(null); + if (e) { + Object.keys(e).forEach(function (k) { + if (k !== 'default') { + var d = Object.getOwnPropertyDescriptor(e, k); + Object.defineProperty(n, k, d.get ? d : { + enumerable: true, + get: function () { return e[k]; } + }); + } + }); + } + n["default"] = e; + return Object.freeze(n); +} + +var acorn__namespace = /*#__PURE__*/_interopNamespace(acorn); +var jsx__default = /*#__PURE__*/_interopDefaultLegacy(jsx); +var visitorKeys__namespace = /*#__PURE__*/_interopNamespace(visitorKeys); + +/** + * @fileoverview The AST node types produced by the parser. + * @author Nicholas C. Zakas + */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +// None! + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +var astNodeTypes = { + AssignmentExpression: "AssignmentExpression", + AssignmentPattern: "AssignmentPattern", + ArrayExpression: "ArrayExpression", + ArrayPattern: "ArrayPattern", + ArrowFunctionExpression: "ArrowFunctionExpression", + AwaitExpression: "AwaitExpression", + BlockStatement: "BlockStatement", + BinaryExpression: "BinaryExpression", + BreakStatement: "BreakStatement", + CallExpression: "CallExpression", + CatchClause: "CatchClause", + ClassBody: "ClassBody", + ClassDeclaration: "ClassDeclaration", + ClassExpression: "ClassExpression", + ConditionalExpression: "ConditionalExpression", + ContinueStatement: "ContinueStatement", + DoWhileStatement: "DoWhileStatement", + DebuggerStatement: "DebuggerStatement", + EmptyStatement: "EmptyStatement", + ExpressionStatement: "ExpressionStatement", + ForStatement: "ForStatement", + ForInStatement: "ForInStatement", + ForOfStatement: "ForOfStatement", + FunctionDeclaration: "FunctionDeclaration", + FunctionExpression: "FunctionExpression", + Identifier: "Identifier", + IfStatement: "IfStatement", + Literal: "Literal", + LabeledStatement: "LabeledStatement", + LogicalExpression: "LogicalExpression", + MemberExpression: "MemberExpression", + MetaProperty: "MetaProperty", + MethodDefinition: "MethodDefinition", + NewExpression: "NewExpression", + ObjectExpression: "ObjectExpression", + ObjectPattern: "ObjectPattern", + Program: "Program", + Property: "Property", + RestElement: "RestElement", + ReturnStatement: "ReturnStatement", + SequenceExpression: "SequenceExpression", + SpreadElement: "SpreadElement", + Super: "Super", + SwitchCase: "SwitchCase", + SwitchStatement: "SwitchStatement", + TaggedTemplateExpression: "TaggedTemplateExpression", + TemplateElement: "TemplateElement", + TemplateLiteral: "TemplateLiteral", + ThisExpression: "ThisExpression", + ThrowStatement: "ThrowStatement", + TryStatement: "TryStatement", + UnaryExpression: "UnaryExpression", + UpdateExpression: "UpdateExpression", + VariableDeclaration: "VariableDeclaration", + VariableDeclarator: "VariableDeclarator", + WhileStatement: "WhileStatement", + WithStatement: "WithStatement", + YieldExpression: "YieldExpression", + JSXIdentifier: "JSXIdentifier", + JSXNamespacedName: "JSXNamespacedName", + JSXMemberExpression: "JSXMemberExpression", + JSXEmptyExpression: "JSXEmptyExpression", + JSXExpressionContainer: "JSXExpressionContainer", + JSXElement: "JSXElement", + JSXClosingElement: "JSXClosingElement", + JSXOpeningElement: "JSXOpeningElement", + JSXAttribute: "JSXAttribute", + JSXSpreadAttribute: "JSXSpreadAttribute", + JSXText: "JSXText", + ExportDefaultDeclaration: "ExportDefaultDeclaration", + ExportNamedDeclaration: "ExportNamedDeclaration", + ExportAllDeclaration: "ExportAllDeclaration", + ExportSpecifier: "ExportSpecifier", + ImportDeclaration: "ImportDeclaration", + ImportSpecifier: "ImportSpecifier", + ImportDefaultSpecifier: "ImportDefaultSpecifier", + ImportNamespaceSpecifier: "ImportNamespaceSpecifier" +}; + +/** + * @fileoverview Translates tokens between Acorn format and Esprima format. + * @author Nicholas C. Zakas + */ +/* eslint no-underscore-dangle: 0 */ + +//------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +// none! + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + + +// Esprima Token Types +const Token = { + Boolean: "Boolean", + EOF: "", + Identifier: "Identifier", + PrivateIdentifier: "PrivateIdentifier", + Keyword: "Keyword", + Null: "Null", + Numeric: "Numeric", + Punctuator: "Punctuator", + String: "String", + RegularExpression: "RegularExpression", + Template: "Template", + JSXIdentifier: "JSXIdentifier", + JSXText: "JSXText" +}; + +/** + * Converts part of a template into an Esprima token. + * @param {AcornToken[]} tokens The Acorn tokens representing the template. + * @param {string} code The source code. + * @returns {EsprimaToken} The Esprima equivalent of the template token. + * @private + */ +function convertTemplatePart(tokens, code) { + const firstToken = tokens[0], + lastTemplateToken = tokens[tokens.length - 1]; + + const token = { + type: Token.Template, + value: code.slice(firstToken.start, lastTemplateToken.end) + }; + + if (firstToken.loc) { + token.loc = { + start: firstToken.loc.start, + end: lastTemplateToken.loc.end + }; + } + + if (firstToken.range) { + token.start = firstToken.range[0]; + token.end = lastTemplateToken.range[1]; + token.range = [token.start, token.end]; + } + + return token; +} + +/** + * Contains logic to translate Acorn tokens into Esprima tokens. + * @param {Object} acornTokTypes The Acorn token types. + * @param {string} code The source code Acorn is parsing. This is necessary + * to correct the "value" property of some tokens. + * @constructor + */ +function TokenTranslator(acornTokTypes, code) { + + // token types + this._acornTokTypes = acornTokTypes; + + // token buffer for templates + this._tokens = []; + + // track the last curly brace + this._curlyBrace = null; + + // the source code + this._code = code; + +} + +TokenTranslator.prototype = { + constructor: TokenTranslator, + + /** + * Translates a single Esprima token to a single Acorn token. This may be + * inaccurate due to how templates are handled differently in Esprima and + * Acorn, but should be accurate for all other tokens. + * @param {AcornToken} token The Acorn token to translate. + * @param {Object} extra Espree extra object. + * @returns {EsprimaToken} The Esprima version of the token. + */ + translate(token, extra) { + + const type = token.type, + tt = this._acornTokTypes; + + if (type === tt.name) { + token.type = Token.Identifier; + + // TODO: See if this is an Acorn bug + if (token.value === "static") { + token.type = Token.Keyword; + } + + if (extra.ecmaVersion > 5 && (token.value === "yield" || token.value === "let")) { + token.type = Token.Keyword; + } + + } else if (type === tt.privateId) { + token.type = Token.PrivateIdentifier; + + } else if (type === tt.semi || type === tt.comma || + type === tt.parenL || type === tt.parenR || + type === tt.braceL || type === tt.braceR || + type === tt.dot || type === tt.bracketL || + type === tt.colon || type === tt.question || + type === tt.bracketR || type === tt.ellipsis || + type === tt.arrow || type === tt.jsxTagStart || + type === tt.incDec || type === tt.starstar || + type === tt.jsxTagEnd || type === tt.prefix || + type === tt.questionDot || + (type.binop && !type.keyword) || + type.isAssign) { + + token.type = Token.Punctuator; + token.value = this._code.slice(token.start, token.end); + } else if (type === tt.jsxName) { + token.type = Token.JSXIdentifier; + } else if (type.label === "jsxText" || type === tt.jsxAttrValueToken) { + token.type = Token.JSXText; + } else if (type.keyword) { + if (type.keyword === "true" || type.keyword === "false") { + token.type = Token.Boolean; + } else if (type.keyword === "null") { + token.type = Token.Null; + } else { + token.type = Token.Keyword; + } + } else if (type === tt.num) { + token.type = Token.Numeric; + token.value = this._code.slice(token.start, token.end); + } else if (type === tt.string) { + + if (extra.jsxAttrValueToken) { + extra.jsxAttrValueToken = false; + token.type = Token.JSXText; + } else { + token.type = Token.String; + } + + token.value = this._code.slice(token.start, token.end); + } else if (type === tt.regexp) { + token.type = Token.RegularExpression; + const value = token.value; + + token.regex = { + flags: value.flags, + pattern: value.pattern + }; + token.value = `/${value.pattern}/${value.flags}`; + } + + return token; + }, + + /** + * Function to call during Acorn's onToken handler. + * @param {AcornToken} token The Acorn token. + * @param {Object} extra The Espree extra object. + * @returns {void} + */ + onToken(token, extra) { + + const that = this, + tt = this._acornTokTypes, + tokens = extra.tokens, + templateTokens = this._tokens; + + /** + * Flushes the buffered template tokens and resets the template + * tracking. + * @returns {void} + * @private + */ + function translateTemplateTokens() { + tokens.push(convertTemplatePart(that._tokens, that._code)); + that._tokens = []; + } + + if (token.type === tt.eof) { + + // might be one last curlyBrace + if (this._curlyBrace) { + tokens.push(this.translate(this._curlyBrace, extra)); + } + + return; + } + + if (token.type === tt.backQuote) { + + // if there's already a curly, it's not part of the template + if (this._curlyBrace) { + tokens.push(this.translate(this._curlyBrace, extra)); + this._curlyBrace = null; + } + + templateTokens.push(token); + + // it's the end + if (templateTokens.length > 1) { + translateTemplateTokens(); + } + + return; + } + if (token.type === tt.dollarBraceL) { + templateTokens.push(token); + translateTemplateTokens(); + return; + } + if (token.type === tt.braceR) { + + // if there's already a curly, it's not part of the template + if (this._curlyBrace) { + tokens.push(this.translate(this._curlyBrace, extra)); + } + + // store new curly for later + this._curlyBrace = token; + return; + } + if (token.type === tt.template || token.type === tt.invalidTemplate) { + if (this._curlyBrace) { + templateTokens.push(this._curlyBrace); + this._curlyBrace = null; + } + + templateTokens.push(token); + return; + } + + if (this._curlyBrace) { + tokens.push(this.translate(this._curlyBrace, extra)); + this._curlyBrace = null; + } + + tokens.push(this.translate(token, extra)); + } +}; + +/** + * @fileoverview A collection of methods for processing Espree's options. + * @author Kai Cataldo + */ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +const SUPPORTED_VERSIONS = [ + 3, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13 +]; + +/** + * Get the latest ECMAScript version supported by Espree. + * @returns {number} The latest ECMAScript version. + */ +function getLatestEcmaVersion() { + return SUPPORTED_VERSIONS[SUPPORTED_VERSIONS.length - 1]; +} + +/** + * Get the list of ECMAScript versions supported by Espree. + * @returns {number[]} An array containing the supported ECMAScript versions. + */ +function getSupportedEcmaVersions() { + return [...SUPPORTED_VERSIONS]; +} + +/** + * Normalize ECMAScript version from the initial config + * @param {(number|"latest")} ecmaVersion ECMAScript version from the initial config + * @throws {Error} throws an error if the ecmaVersion is invalid. + * @returns {number} normalized ECMAScript version + */ +function normalizeEcmaVersion(ecmaVersion = 5) { + + let version = ecmaVersion === "latest" ? getLatestEcmaVersion() : ecmaVersion; + + if (typeof version !== "number") { + throw new Error(`ecmaVersion must be a number or "latest". Received value of type ${typeof ecmaVersion} instead.`); + } + + // Calculate ECMAScript edition number from official year version starting with + // ES2015, which corresponds with ES6 (or a difference of 2009). + if (version >= 2015) { + version -= 2009; + } + + if (!SUPPORTED_VERSIONS.includes(version)) { + throw new Error("Invalid ecmaVersion."); + } + + return version; +} + +/** + * Normalize sourceType from the initial config + * @param {string} sourceType to normalize + * @throws {Error} throw an error if sourceType is invalid + * @returns {string} normalized sourceType + */ +function normalizeSourceType(sourceType = "script") { + if (sourceType === "script" || sourceType === "module") { + return sourceType; + } + + if (sourceType === "commonjs") { + return "script"; + } + + throw new Error("Invalid sourceType."); +} + +/** + * Normalize parserOptions + * @param {Object} options the parser options to normalize + * @throws {Error} throw an error if found invalid option. + * @returns {Object} normalized options + */ +function normalizeOptions(options) { + const ecmaVersion = normalizeEcmaVersion(options.ecmaVersion); + const sourceType = normalizeSourceType(options.sourceType); + const ranges = options.range === true; + const locations = options.loc === true; + const allowReserved = ecmaVersion === 3 ? "never" : false; + const ecmaFeatures = options.ecmaFeatures || {}; + const allowReturnOutsideFunction = options.sourceType === "commonjs" || + Boolean(ecmaFeatures.globalReturn); + + if (sourceType === "module" && ecmaVersion < 6) { + throw new Error("sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options."); + } + + return Object.assign({}, options, { + ecmaVersion, + sourceType, + ranges, + locations, + allowReserved, + allowReturnOutsideFunction + }); +} + +/* eslint-disable no-param-reassign*/ + + +const STATE = Symbol("espree's internal state"); +const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); + + +/** + * Converts an Acorn comment to a Esprima comment. + * @param {boolean} block True if it's a block comment, false if not. + * @param {string} text The text of the comment. + * @param {int} start The index at which the comment starts. + * @param {int} end The index at which the comment ends. + * @param {Location} startLoc The location at which the comment starts. + * @param {Location} endLoc The location at which the comment ends. + * @returns {Object} The comment object. + * @private + */ +function convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc) { + const comment = { + type: block ? "Block" : "Line", + value: text + }; + + if (typeof start === "number") { + comment.start = start; + comment.end = end; + comment.range = [start, end]; + } + + if (typeof startLoc === "object") { + comment.loc = { + start: startLoc, + end: endLoc + }; + } + + return comment; +} + +var espree = () => Parser => { + const tokTypes = Object.assign({}, Parser.acorn.tokTypes); + + if (Parser.acornJsx) { + Object.assign(tokTypes, Parser.acornJsx.tokTypes); + } + + return class Espree extends Parser { + constructor(opts, code) { + if (typeof opts !== "object" || opts === null) { + opts = {}; + } + if (typeof code !== "string" && !(code instanceof String)) { + code = String(code); + } + + // save original source type in case of commonjs + const originalSourceType = opts.sourceType; + const options = normalizeOptions(opts); + const ecmaFeatures = options.ecmaFeatures || {}; + const tokenTranslator = + options.tokens === true + ? new TokenTranslator(tokTypes, code) + : null; + + // Initialize acorn parser. + super({ + + // do not use spread, because we don't want to pass any unknown options to acorn + ecmaVersion: options.ecmaVersion, + sourceType: options.sourceType, + ranges: options.ranges, + locations: options.locations, + allowReserved: options.allowReserved, + + // Truthy value is true for backward compatibility. + allowReturnOutsideFunction: options.allowReturnOutsideFunction, + + // Collect tokens + onToken: token => { + if (tokenTranslator) { + + // Use `tokens`, `ecmaVersion`, and `jsxAttrValueToken` in the state. + tokenTranslator.onToken(token, this[STATE]); + } + if (token.type !== tokTypes.eof) { + this[STATE].lastToken = token; + } + }, + + // Collect comments + onComment: (block, text, start, end, startLoc, endLoc) => { + if (this[STATE].comments) { + const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc); + + this[STATE].comments.push(comment); + } + } + }, code); + + /* + * Data that is unique to Espree and is not represented internally in + * Acorn. We put all of this data into a symbol property as a way to + * avoid potential naming conflicts with future versions of Acorn. + */ + this[STATE] = { + originalSourceType: originalSourceType || options.sourceType, + tokens: tokenTranslator ? [] : null, + comments: options.comment === true ? [] : null, + impliedStrict: ecmaFeatures.impliedStrict === true && this.options.ecmaVersion >= 5, + ecmaVersion: this.options.ecmaVersion, + jsxAttrValueToken: false, + lastToken: null, + templateElements: [] + }; + } + + tokenize() { + do { + this.next(); + } while (this.type !== tokTypes.eof); + + // Consume the final eof token + this.next(); + + const extra = this[STATE]; + const tokens = extra.tokens; + + if (extra.comments) { + tokens.comments = extra.comments; + } + + return tokens; + } + + finishNode(...args) { + const result = super.finishNode(...args); + + return this[ESPRIMA_FINISH_NODE](result); + } + + finishNodeAt(...args) { + const result = super.finishNodeAt(...args); + + return this[ESPRIMA_FINISH_NODE](result); + } + + parse() { + const extra = this[STATE]; + const program = super.parse(); + + program.sourceType = extra.originalSourceType; + + if (extra.comments) { + program.comments = extra.comments; + } + if (extra.tokens) { + program.tokens = extra.tokens; + } + + /* + * Adjust opening and closing position of program to match Esprima. + * Acorn always starts programs at range 0 whereas Esprima starts at the + * first AST node's start (the only real difference is when there's leading + * whitespace or leading comments). Acorn also counts trailing whitespace + * as part of the program whereas Esprima only counts up to the last token. + */ + if (program.body.length) { + const [firstNode] = program.body; + + if (program.range) { + program.range[0] = firstNode.range[0]; + } + if (program.loc) { + program.loc.start = firstNode.loc.start; + } + program.start = firstNode.start; + } + if (extra.lastToken) { + if (program.range) { + program.range[1] = extra.lastToken.range[1]; + } + if (program.loc) { + program.loc.end = extra.lastToken.loc.end; + } + program.end = extra.lastToken.end; + } + + + /* + * https://github.com/eslint/espree/issues/349 + * Ensure that template elements have correct range information. + * This is one location where Acorn produces a different value + * for its start and end properties vs. the values present in the + * range property. In order to avoid confusion, we set the start + * and end properties to the values that are present in range. + * This is done here, instead of in finishNode(), because Acorn + * uses the values of start and end internally while parsing, making + * it dangerous to change those values while parsing is ongoing. + * By waiting until the end of parsing, we can safely change these + * values without affect any other part of the process. + */ + this[STATE].templateElements.forEach(templateElement => { + const startOffset = -1; + const endOffset = templateElement.tail ? 1 : 2; + + templateElement.start += startOffset; + templateElement.end += endOffset; + + if (templateElement.range) { + templateElement.range[0] += startOffset; + templateElement.range[1] += endOffset; + } + + if (templateElement.loc) { + templateElement.loc.start.column += startOffset; + templateElement.loc.end.column += endOffset; + } + }); + + return program; + } + + parseTopLevel(node) { + if (this[STATE].impliedStrict) { + this.strict = true; + } + return super.parseTopLevel(node); + } + + /** + * Overwrites the default raise method to throw Esprima-style errors. + * @param {int} pos The position of the error. + * @param {string} message The error message. + * @throws {SyntaxError} A syntax error. + * @returns {void} + */ + raise(pos, message) { + const loc = Parser.acorn.getLineInfo(this.input, pos); + const err = new SyntaxError(message); + + err.index = pos; + err.lineNumber = loc.line; + err.column = loc.column + 1; // acorn uses 0-based columns + throw err; + } + + /** + * Overwrites the default raise method to throw Esprima-style errors. + * @param {int} pos The position of the error. + * @param {string} message The error message. + * @throws {SyntaxError} A syntax error. + * @returns {void} + */ + raiseRecoverable(pos, message) { + this.raise(pos, message); + } + + /** + * Overwrites the default unexpected method to throw Esprima-style errors. + * @param {int} pos The position of the error. + * @throws {SyntaxError} A syntax error. + * @returns {void} + */ + unexpected(pos) { + let message = "Unexpected token"; + + if (pos !== null && pos !== void 0) { + this.pos = pos; + + if (this.options.locations) { + while (this.pos < this.lineStart) { + this.lineStart = this.input.lastIndexOf("\n", this.lineStart - 2) + 1; + --this.curLine; + } + } + + this.nextToken(); + } + + if (this.end > this.start) { + message += ` ${this.input.slice(this.start, this.end)}`; + } + + this.raise(this.start, message); + } + + /* + * Esprima-FB represents JSX strings as tokens called "JSXText", but Acorn-JSX + * uses regular tt.string without any distinction between this and regular JS + * strings. As such, we intercept an attempt to read a JSX string and set a flag + * on extra so that when tokens are converted, the next token will be switched + * to JSXText via onToken. + */ + jsx_readString(quote) { // eslint-disable-line camelcase + const result = super.jsx_readString(quote); + + if (this.type === tokTypes.string) { + this[STATE].jsxAttrValueToken = true; + } + return result; + } + + /** + * Performs last-minute Esprima-specific compatibility checks and fixes. + * @param {ASTNode} result The node to check. + * @returns {ASTNode} The finished node. + */ + [ESPRIMA_FINISH_NODE](result) { + + // Acorn doesn't count the opening and closing backticks as part of templates + // so we have to adjust ranges/locations appropriately. + if (result.type === "TemplateElement") { + + // save template element references to fix start/end later + this[STATE].templateElements.push(result); + } + + if (result.type.includes("Function") && !result.generator) { + result.generator = false; + } + + return result; + } + }; +}; + +const version$1 = "9.1.0"; + /** * @fileoverview Main Espree file that converts Acorn into Esprima output. * @@ -22437,49 +23999,38 @@ module.exports = JSON.parse('{"AssignmentExpression":["left","right"],"Assignmen * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* eslint no-undefined:0, no-use-before-define: 0 */ - - -const acorn = __webpack_require__(424); - -const jsx = __webpack_require__(425); - -const astNodeTypes = __webpack_require__(427); - -const espree = __webpack_require__(428); - -const { - getLatestEcmaVersion, - getSupportedEcmaVersions -} = __webpack_require__(430); // To initialize lazily. - +// To initialize lazily. const parsers = { - _regular: null, - _jsx: null, + _regular: null, + _jsx: null, - get regular() { - if (this._regular === null) { - this._regular = acorn.Parser.extend(espree()); + get regular() { + if (this._regular === null) { + this._regular = acorn__namespace.Parser.extend(espree()); + } + return this._regular; + }, + + get jsx() { + if (this._jsx === null) { + this._jsx = acorn__namespace.Parser.extend(jsx__default["default"](), espree()); + } + return this._jsx; + }, + + get(options) { + const useJsx = Boolean( + options && + options.ecmaFeatures && + options.ecmaFeatures.jsx + ); + + return useJsx ? this.jsx : this.regular; } +}; - return this._regular; - }, - - get jsx() { - if (this._jsx === null) { - this._jsx = acorn.Parser.extend(jsx(), espree()); - } - - return this._jsx; - }, - - get(options) { - const useJsx = Boolean(options && options.ecmaFeatures && options.ecmaFeatures.jsx); - return useJsx ? this.jsx : this.regular; - } - -}; //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // Tokenizer //------------------------------------------------------------------------------ @@ -22491,18 +24042,18 @@ const parsers = { * @throws {SyntaxError} If the input code is invalid. * @private */ - function tokenize(code, options) { - const Parser = parsers.get(options); // Ensure to collect tokens. + const Parser = parsers.get(options); - if (!options || options.tokens !== true) { - options = Object.assign({}, options, { - tokens: true - }); // eslint-disable-line no-param-reassign - } + // Ensure to collect tokens. + if (!options || options.tokens !== true) { + options = Object.assign({}, options, { tokens: true }); // eslint-disable-line no-param-reassign + } - return new Parser(options, code).tokenize(); -} //------------------------------------------------------------------------------ + return new Parser(options, code).tokenize(); +} + +//------------------------------------------------------------------------------ // Parser //------------------------------------------------------------------------------ @@ -22513,56 +24064,66 @@ function tokenize(code, options) { * @returns {ASTNode} The "Program" AST node. * @throws {SyntaxError} If the input code is invalid. */ - - function parse(code, options) { - const Parser = parsers.get(options); - return new Parser(options, code).parse(); -} //------------------------------------------------------------------------------ + const Parser = parsers.get(options); + + return new Parser(options, code).parse(); +} + +//------------------------------------------------------------------------------ // Public //------------------------------------------------------------------------------ +const version = version$1; -exports.version = __webpack_require__(431).version; -exports.tokenize = tokenize; -exports.parse = parse; // Deep copy. +// Deep copy. /* istanbul ignore next */ +const Syntax = (function() { + let name, + types = {}; -exports.Syntax = function () { - let name, - types = {}; - - if (typeof Object.create === "function") { - types = Object.create(null); - } - - for (name in astNodeTypes) { - if (Object.hasOwnProperty.call(astNodeTypes, name)) { - types[name] = astNodeTypes[name]; + if (typeof Object.create === "function") { + types = Object.create(null); } - } - if (typeof Object.freeze === "function") { - Object.freeze(types); - } + for (name in astNodeTypes) { + if (Object.hasOwnProperty.call(astNodeTypes, name)) { + types[name] = astNodeTypes[name]; + } + } + + if (typeof Object.freeze === "function") { + Object.freeze(types); + } + + return types; +}()); - return types; -}(); /* istanbul ignore next */ +const VisitorKeys = (function() { + return visitorKeys__namespace.KEYS; +}()); +const latestEcmaVersion = getLatestEcmaVersion(); -exports.VisitorKeys = function () { - return __webpack_require__(432).KEYS; -}(); +const supportedEcmaVersions = getSupportedEcmaVersions(); + +exports.Syntax = Syntax; +exports.VisitorKeys = VisitorKeys; +exports.latestEcmaVersion = latestEcmaVersion; +exports.parse = parse; +exports.supportedEcmaVersions = supportedEcmaVersions; +exports.tokenize = tokenize; +exports.version = version; +//# sourceMappingURL=espree.cjs.map -exports.latestEcmaVersion = getLatestEcmaVersion(); -exports.supportedEcmaVersions = getSupportedEcmaVersions(); /***/ }), -/* 424 */ -/***/ (function(__unused_webpack_module, exports) { +/* 437 */ +/***/ (function(__unused_webpack_module, exports, __webpack_require__) { +/* provided dependency */ var console = __webpack_require__(438); (function (global, factory) { true ? factory(exports) : 0; })(this, function (exports) { @@ -22577,7 +24138,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // And the keywords var ecma5AndLessKeywords = "break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this"; - var keywords = { + var keywords$1 = { 5: ecma5AndLessKeywords, "5module": ecma5AndLessKeywords + " export import", 6: ecma5AndLessKeywords + " const class extends export import super" @@ -22737,19 +24298,20 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); startsExpr: true }; // Map keyword names to token types. - var keywords$1 = {}; // Succinct definitions of keyword token types + var keywords = {}; // Succinct definitions of keyword token types function kw(name, options) { if (options === void 0) options = {}; options.keyword = name; - return keywords$1[name] = new TokenType(name, options); + return keywords[name] = new TokenType(name, options); } - var types = { + var types$1 = { num: new TokenType("num", startsExpr), regexp: new TokenType("regexp", startsExpr), string: new TokenType("string", startsExpr), name: new TokenType("name", startsExpr), + privateId: new TokenType("privateId", startsExpr), eof: new TokenType("eof"), // Punctuation token types. bracketL: new TokenType("[", { @@ -22904,8 +24466,8 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); var lineBreak = /\r\n?|\n|\u2028|\u2029/; var lineBreakG = new RegExp(lineBreak.source, "g"); - function isNewLine(code, ecma2019String) { - return code === 10 || code === 13 || !ecma2019String && (code === 0x2028 || code === 0x2029); + function isNewLine(code) { + return code === 10 || code === 13 || code === 0x2028 || code === 0x2029; } var nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/; @@ -22963,17 +24525,18 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return new Position(line, offset - cur); } } - } // A second optional argument can be given to further configure - // the parser process. These options are recognized: + } // A second argument must be given to configure the parser process. + // These options are recognized (only `ecmaVersion` is required): var defaultOptions = { // `ecmaVersion` indicates the ECMAScript version to parse. Must be - // either 3, 5, 6 (2015), 7 (2016), 8 (2017), 9 (2018), or 10 - // (2019). This influences support for strict mode, the set of - // reserved words, and support for new syntax features. The default - // is 10. - ecmaVersion: 10, + // either 3, 5, 6 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10 + // (2019), 11 (2020), 12 (2021), 13 (2022), or `"latest"` (the + // latest version the library supports). This influences support + // for strict mode, the set of reserved words, and support for + // new syntax features. + ecmaVersion: null, // `sourceType` indicates the mode the code should be parsed in. // Can be either `"script"` or `"module"`. This influences global // strict mode and parsing of `import` and `export` declarations. @@ -22996,11 +24559,16 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // error. allowReturnOutsideFunction: false, // When enabled, import/export statements are not constrained to - // appearing at the top of the program. + // appearing at the top of the program, and an import.meta expression + // in a script isn't considered an error. allowImportExportEverywhere: false, + // By default, await identifiers are allowed to appear at the top-level scope only if ecmaVersion >= 2022. // When enabled, await identifiers are allowed to appear at the top-level scope, // but they are still not allowed in non-async functions. - allowAwaitOutsideFunction: false, + allowAwaitOutsideFunction: null, + // When enabled, super identifiers are not constrained to + // appearing in methods and do not raise an error when they appear elsewhere. + allowSuperOutsideMethod: null, // When enabled, hashbang directive in the beginning of file // is allowed and treated as a line comment. allowHashBang: false, @@ -23052,6 +24620,8 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); preserveParens: false }; // Interpret and default an options object + var warnedAboutEcmaVersion = false; + function getOptions(opts) { var options = {}; @@ -23059,7 +24629,16 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); options[opt] = opts && has(opts, opt) ? opts[opt] : defaultOptions[opt]; } - if (options.ecmaVersion >= 2015) { + if (options.ecmaVersion === "latest") { + options.ecmaVersion = 1e8; + } else if (options.ecmaVersion == null) { + if (!warnedAboutEcmaVersion && typeof console === "object" && console.warn) { + warnedAboutEcmaVersion = true; + console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future."); + } + + options.ecmaVersion = 11; + } else if (options.ecmaVersion >= 2015) { options.ecmaVersion -= 2009; } @@ -23106,17 +24685,18 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); var SCOPE_TOP = 1, SCOPE_FUNCTION = 2, - SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION, SCOPE_ASYNC = 4, SCOPE_GENERATOR = 8, SCOPE_ARROW = 16, SCOPE_SIMPLE_CATCH = 32, SCOPE_SUPER = 64, - SCOPE_DIRECT_SUPER = 128; + SCOPE_DIRECT_SUPER = 128, + SCOPE_CLASS_STATIC_BLOCK = 256, + SCOPE_VAR = SCOPE_TOP | SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK; function functionFlags(async, generator) { return SCOPE_FUNCTION | (async ? SCOPE_ASYNC : 0) | (generator ? SCOPE_GENERATOR : 0); - } // Used in checkLVal and declareName to determine the type of a binding + } // Used in checkLVal* and declareName to determine the type of a binding var BIND_NONE = 0, @@ -23134,15 +24714,11 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); var Parser = function Parser(options, input, startPos) { this.options = options = getOptions(options); this.sourceFile = options.sourceFile; - this.keywords = wordsRegexp(keywords[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]); + this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]); var reserved = ""; if (options.allowReserved !== true) { - for (var v = options.ecmaVersion;; v--) { - if (reserved = reservedWords[v]) { - break; - } - } + reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3]; if (options.sourceType === "module") { reserved += " await"; @@ -23171,7 +24747,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // Its type - this.type = types.eof; // For tokens that include more information than their type, the value + this.type = types$1.eof; // For tokens that include more information than their type, the value this.value = null; // Its start and end offset @@ -23191,13 +24767,14 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); this.inModule = options.sourceType === "module"; this.strict = this.inModule || this.strictDirective(this.pos); // Used to signify the start of a potential arrow function - this.potentialArrowAt = -1; // Positions to delayed-check that yield/await does not exist in default parameters. + this.potentialArrowAt = -1; + this.potentialArrowInForAwait = false; // Positions to delayed-check that yield/await does not exist in default parameters. this.yieldPos = this.awaitPos = this.awaitIdentPos = 0; // Labels in scope. this.labels = []; // Thus-far undefined exports. - this.undefinedExports = {}; // If enabled, skip leading hashbang line. + this.undefinedExports = Object.create(null); // If enabled, skip leading hashbang line. if (this.pos === 0 && options.allowHashBang && this.input.slice(0, 2) === "#!") { this.skipLineComment(2); @@ -23207,7 +24784,11 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); this.scopeStack = []; this.enterScope(SCOPE_TOP); // For RegExp validation - this.regexpState = null; + this.regexpState = null; // The stack of private names. + // Each element has two properties: 'declared' and 'used'. + // When it exited from the outermost class definition, all used private names must be declared. + + this.privateNameStack = []; }; var prototypeAccessors = { @@ -23220,6 +24801,9 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); inAsync: { configurable: true }, + canAwait: { + configurable: true + }, allowSuper: { configurable: true }, @@ -23228,6 +24812,12 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }, treatFunctionsAsVar: { configurable: true + }, + allowNewDotTarget: { + configurable: true + }, + inClassStaticBlock: { + configurable: true } }; @@ -23242,15 +24832,34 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; prototypeAccessors.inGenerator.get = function () { - return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0; + return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit; }; prototypeAccessors.inAsync.get = function () { - return (this.currentVarScope().flags & SCOPE_ASYNC) > 0; + return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 && !this.currentVarScope().inClassFieldInit; + }; + + prototypeAccessors.canAwait.get = function () { + for (var i = this.scopeStack.length - 1; i >= 0; i--) { + var scope = this.scopeStack[i]; + + if (scope.inClassFieldInit || scope.flags & SCOPE_CLASS_STATIC_BLOCK) { + return false; + } + + if (scope.flags & SCOPE_FUNCTION) { + return (scope.flags & SCOPE_ASYNC) > 0; + } + } + + return this.inModule && this.options.ecmaVersion >= 13 || this.options.allowAwaitOutsideFunction; }; prototypeAccessors.allowSuper.get = function () { - return (this.currentThisScope().flags & SCOPE_SUPER) > 0; + var ref = this.currentThisScope(); + var flags = ref.flags; + var inClassFieldInit = ref.inClassFieldInit; + return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod; }; prototypeAccessors.allowDirectSuper.get = function () { @@ -23259,11 +24868,17 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()); - }; // Switch to a getter for 7.0.0. + }; + prototypeAccessors.allowNewDotTarget.get = function () { + var ref = this.currentThisScope(); + var flags = ref.flags; + var inClassFieldInit = ref.inClassFieldInit; + return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit; + }; - Parser.prototype.inNonArrowFunction = function inNonArrowFunction() { - return (this.currentThisScope().flags & SCOPE_FUNCTION) > 0; + prototypeAccessors.inClassStaticBlock.get = function () { + return (this.currentVarScope().flags & SCOPE_CLASS_STATIC_BLOCK) > 0; }; Parser.extend = function extend() { @@ -23296,11 +24911,11 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; Object.defineProperties(Parser.prototype, prototypeAccessors); - var pp = Parser.prototype; // ## Parser utilities + var pp$9 = Parser.prototype; // ## Parser utilities var literal = /^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/; - pp.strictDirective = function (start) { + pp$9.strictDirective = function (start) { for (;;) { // Try to find string literal. skipWhiteSpace.lastIndex = start; @@ -23332,7 +24947,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // type, and if yes, consumes it as a side effect. - pp.eat = function (type) { + pp$9.eat = function (type) { if (this.type === type) { this.next(); return true; @@ -23342,12 +24957,12 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // Tests whether parsed token is a contextual keyword. - pp.isContextual = function (name) { - return this.type === types.name && this.value === name && !this.containsEsc; + pp$9.isContextual = function (name) { + return this.type === types$1.name && this.value === name && !this.containsEsc; }; // Consumes contextual keyword if possible. - pp.eatContextual = function (name) { + pp$9.eatContextual = function (name) { if (!this.isContextual(name)) { return false; } @@ -23357,18 +24972,18 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // Asserts that following token is given contextual keyword. - pp.expectContextual = function (name) { + pp$9.expectContextual = function (name) { if (!this.eatContextual(name)) { this.unexpected(); } }; // Test whether a semicolon can be inserted at the current position. - pp.canInsertSemicolon = function () { - return this.type === types.eof || this.type === types.braceR || lineBreak.test(this.input.slice(this.lastTokEnd, this.start)); + pp$9.canInsertSemicolon = function () { + return this.type === types$1.eof || this.type === types$1.braceR || lineBreak.test(this.input.slice(this.lastTokEnd, this.start)); }; - pp.insertSemicolon = function () { + pp$9.insertSemicolon = function () { if (this.canInsertSemicolon()) { if (this.options.onInsertedSemicolon) { this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc); @@ -23380,13 +24995,13 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // pretend that there is a semicolon at this position. - pp.semicolon = function () { - if (!this.eat(types.semi) && !this.insertSemicolon()) { + pp$9.semicolon = function () { + if (!this.eat(types$1.semi) && !this.insertSemicolon()) { this.unexpected(); } }; - pp.afterTrailingComma = function (tokType, notNext) { + pp$9.afterTrailingComma = function (tokType, notNext) { if (this.type === tokType) { if (this.options.onTrailingComma) { this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc); @@ -23402,12 +25017,12 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // raise an unexpected token error. - pp.expect = function (type) { + pp$9.expect = function (type) { this.eat(type) || this.unexpected(); }; // Raise an unexpected token error. - pp.unexpected = function (pos) { + pp$9.unexpected = function (pos) { this.raise(pos != null ? pos : this.start, "Unexpected token"); }; @@ -23415,7 +25030,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = this.doubleProto = -1; } - pp.checkPatternErrors = function (refDestructuringErrors, isAssign) { + pp$9.checkPatternErrors = function (refDestructuringErrors, isAssign) { if (!refDestructuringErrors) { return; } @@ -23431,7 +25046,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } }; - pp.checkExpressionErrors = function (refDestructuringErrors, andThrow) { + pp$9.checkExpressionErrors = function (refDestructuringErrors, andThrow) { if (!refDestructuringErrors) { return false; } @@ -23452,7 +25067,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } }; - pp.checkYieldAwaitInDefaultParams = function () { + pp$9.checkYieldAwaitInDefaultParams = function () { if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos)) { this.raise(this.yieldPos, "Yield expression cannot be a default value"); } @@ -23462,7 +25077,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } }; - pp.isSimpleAssignTarget = function (expr) { + pp$9.isSimpleAssignTarget = function (expr) { if (expr.type === "ParenthesizedExpression") { return this.isSimpleAssignTarget(expr.expression); } @@ -23470,20 +25085,20 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return expr.type === "Identifier" || expr.type === "MemberExpression"; }; - var pp$1 = Parser.prototype; // ### Statement parsing + var pp$8 = Parser.prototype; // ### Statement parsing // Parse a program. Initializes the parser, reads any number of // statements, and wraps them in a Program node. Optionally takes a // `program` argument. If present, the statements will be appended // to its body instead of creating a new node. - pp$1.parseTopLevel = function (node) { - var exports = {}; + pp$8.parseTopLevel = function (node) { + var exports = Object.create(null); if (!node.body) { node.body = []; } - while (this.type !== types.eof) { + while (this.type !== types$1.eof) { var stmt = this.parseStatement(null, true, exports); node.body.push(stmt); } @@ -23508,7 +25123,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); kind: "switch" }; - pp$1.isLet = function (context) { + pp$8.isLet = function (context) { if (this.options.ecmaVersion < 6 || !this.isContextual("let")) { return false; } @@ -23521,9 +25136,9 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // is allowed. However, `let [` is an explicit negative lookahead for // ExpressionStatement, so special-case it first. - if (nextCh === 91) { + if (nextCh === 91 || nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true; - } // '[' + } // '[', '/', astral if (context) { @@ -23538,10 +25153,14 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); if (isIdentifierStart(nextCh, true)) { var pos = next + 1; - while (isIdentifierChar(this.input.charCodeAt(pos), true)) { + while (isIdentifierChar(nextCh = this.input.charCodeAt(pos), true)) { ++pos; } + if (nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) { + return true; + } + var ident = this.input.slice(next, pos); if (!keywordRelationalOperator.test(ident)) { @@ -23555,15 +25174,16 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // - 'async /*\n*/ function' is invalid. - pp$1.isAsyncFunction = function () { + pp$8.isAsyncFunction = function () { if (this.options.ecmaVersion < 8 || !this.isContextual("async")) { return false; } skipWhiteSpace.lastIndex = this.pos; var skip = skipWhiteSpace.exec(this.input); - var next = this.pos + skip[0].length; - return !lineBreak.test(this.input.slice(this.pos, next)) && this.input.slice(next, next + 8) === "function" && (next + 8 === this.input.length || !isIdentifierChar(this.input.charAt(next + 8))); + var next = this.pos + skip[0].length, + after; + return !lineBreak.test(this.input.slice(this.pos, next)) && this.input.slice(next, next + 8) === "function" && (next + 8 === this.input.length || !(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 0xd7ff && after < 0xdc00)); }; // Parse a single statement. // // If expecting a statement and finding a slash operator, parse a @@ -23572,13 +25192,13 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // does not help. - pp$1.parseStatement = function (context, topLevel, exports) { + pp$8.parseStatement = function (context, topLevel, exports) { var starttype = this.type, node = this.startNode(), kind; if (this.isLet(context)) { - starttype = types._var; + starttype = types$1._var; kind = "let"; } // Most types of statements are recognized by the keyword they // start with. Many are trivial to parse, some require a bit of @@ -23586,20 +25206,20 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); switch (starttype) { - case types._break: - case types._continue: + case types$1._break: + case types$1._continue: return this.parseBreakContinueStatement(node, starttype.keyword); - case types._debugger: + case types$1._debugger: return this.parseDebuggerStatement(node); - case types._do: + case types$1._do: return this.parseDoStatement(node); - case types._for: + case types$1._for: return this.parseForStatement(node); - case types._function: + case types$1._function: // Function as sole body of either an if statement or a labeled statement // works, but not when it is part of a labeled statement that is the sole // body of an if statement. @@ -23609,30 +25229,30 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return this.parseFunctionStatement(node, false, !context); - case types._class: + case types$1._class: if (context) { this.unexpected(); } return this.parseClass(node, true); - case types._if: + case types$1._if: return this.parseIfStatement(node); - case types._return: + case types$1._return: return this.parseReturnStatement(node); - case types._switch: + case types$1._switch: return this.parseSwitchStatement(node); - case types._throw: + case types$1._throw: return this.parseThrowStatement(node); - case types._try: + case types$1._try: return this.parseTryStatement(node); - case types._const: - case types._var: + case types$1._const: + case types$1._var: kind = kind || this.value; if (context && kind !== "var") { @@ -23641,21 +25261,21 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return this.parseVarStatement(node, kind); - case types._while: + case types$1._while: return this.parseWhileStatement(node); - case types._with: + case types$1._with: return this.parseWithStatement(node); - case types.braceL: + case types$1.braceL: return this.parseBlock(true, node); - case types.semi: + case types$1.semi: return this.parseEmptyStatement(node); - case types._export: - case types._import: - if (this.options.ecmaVersion > 10 && starttype === types._import) { + case types$1._export: + case types$1._import: + if (this.options.ecmaVersion > 10 && starttype === types$1._import) { skipWhiteSpace.lastIndex = this.pos; var skip = skipWhiteSpace.exec(this.input); var next = this.pos + skip[0].length, @@ -23677,7 +25297,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } } - return starttype === types._import ? this.parseImport(node) : this.parseExport(node, exports); + return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports); // If the statement does not start with a statement keyword or a // brace, it's an ExpressionStatement or LabeledStatement. We // simply start parsing an expression, and afterwards, if the @@ -23697,7 +25317,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); var maybeName = this.value, expr = this.parseExpression(); - if (starttype === types.name && expr.type === "Identifier" && this.eat(types.colon)) { + if (starttype === types$1.name && expr.type === "Identifier" && this.eat(types$1.colon)) { return this.parseLabeledStatement(node, maybeName, expr, context); } else { return this.parseExpressionStatement(node, expr); @@ -23706,13 +25326,13 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } }; - pp$1.parseBreakContinueStatement = function (node, keyword) { + pp$8.parseBreakContinueStatement = function (node, keyword) { var isBreak = keyword === "break"; this.next(); - if (this.eat(types.semi) || this.insertSemicolon()) { + if (this.eat(types$1.semi) || this.insertSemicolon()) { node.label = null; - } else if (this.type !== types.name) { + } else if (this.type !== types$1.name) { this.unexpected(); } else { node.label = this.parseIdent(); @@ -23744,22 +25364,22 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement"); }; - pp$1.parseDebuggerStatement = function (node) { + pp$8.parseDebuggerStatement = function (node) { this.next(); this.semicolon(); return this.finishNode(node, "DebuggerStatement"); }; - pp$1.parseDoStatement = function (node) { + pp$8.parseDoStatement = function (node) { this.next(); this.labels.push(loopLabel); node.body = this.parseStatement("do"); this.labels.pop(); - this.expect(types._while); + this.expect(types$1._while); node.test = this.parseParenExpression(); if (this.options.ecmaVersion >= 6) { - this.eat(types.semi); + this.eat(types$1.semi); } else { this.semicolon(); } @@ -23774,14 +25394,14 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // is a regular `for` loop. - pp$1.parseForStatement = function (node) { + pp$8.parseForStatement = function (node) { this.next(); - var awaitAt = this.options.ecmaVersion >= 9 && (this.inAsync || !this.inFunction && this.options.allowAwaitOutsideFunction) && this.eatContextual("await") ? this.lastTokStart : -1; + var awaitAt = this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await") ? this.lastTokStart : -1; this.labels.push(loopLabel); this.enterScope(0); - this.expect(types.parenL); + this.expect(types$1.parenL); - if (this.type === types.semi) { + if (this.type === types$1.semi) { if (awaitAt > -1) { this.unexpected(awaitAt); } @@ -23791,16 +25411,16 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); var isLet = this.isLet(); - if (this.type === types._var || this.type === types._const || isLet) { + if (this.type === types$1._var || this.type === types$1._const || isLet) { var init$1 = this.startNode(), kind = isLet ? "let" : this.value; this.next(); this.parseVar(init$1, true, kind); this.finishNode(init$1, "VariableDeclaration"); - if ((this.type === types._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && init$1.declarations.length === 1) { + if ((this.type === types$1._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && init$1.declarations.length === 1) { if (this.options.ecmaVersion >= 9) { - if (this.type === types._in) { + if (this.type === types$1._in) { if (awaitAt > -1) { this.unexpected(awaitAt); } @@ -23819,12 +25439,14 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return this.parseFor(node, init$1); } + var startsWithLet = this.isContextual("let"), + isForOf = false; var refDestructuringErrors = new DestructuringErrors(); - var init = this.parseExpression(true, refDestructuringErrors); + var init = this.parseExpression(awaitAt > -1 ? "await" : true, refDestructuringErrors); - if (this.type === types._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) { + if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) { if (this.options.ecmaVersion >= 9) { - if (this.type === types._in) { + if (this.type === types$1._in) { if (awaitAt > -1) { this.unexpected(awaitAt); } @@ -23833,8 +25455,12 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } } + if (startsWithLet && isForOf) { + this.raise(init.start, "The left-hand side of a for-of loop may not start with 'let'."); + } + this.toAssignable(init, false, refDestructuringErrors); - this.checkLVal(init); + this.checkLValPattern(init); return this.parseForIn(node, init); } else { this.checkExpressionErrors(refDestructuringErrors, true); @@ -23847,21 +25473,21 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return this.parseFor(node, init); }; - pp$1.parseFunctionStatement = function (node, isAsync, declarationPosition) { + pp$8.parseFunctionStatement = function (node, isAsync, declarationPosition) { this.next(); return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync); }; - pp$1.parseIfStatement = function (node) { + pp$8.parseIfStatement = function (node) { this.next(); node.test = this.parseParenExpression(); // allow function declarations in branches, but only in non-strict mode node.consequent = this.parseStatement("if"); - node.alternate = this.eat(types._else) ? this.parseStatement("if") : null; + node.alternate = this.eat(types$1._else) ? this.parseStatement("if") : null; return this.finishNode(node, "IfStatement"); }; - pp$1.parseReturnStatement = function (node) { + pp$8.parseReturnStatement = function (node) { if (!this.inFunction && !this.options.allowReturnOutsideFunction) { this.raise(this.start, "'return' outside of function"); } @@ -23870,7 +25496,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // optional arguments, we eagerly look for a semicolon or the // possibility to insert one. - if (this.eat(types.semi) || this.insertSemicolon()) { + if (this.eat(types$1.semi) || this.insertSemicolon()) { node.argument = null; } else { node.argument = this.parseExpression(); @@ -23880,11 +25506,11 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return this.finishNode(node, "ReturnStatement"); }; - pp$1.parseSwitchStatement = function (node) { + pp$8.parseSwitchStatement = function (node) { this.next(); node.discriminant = this.parseParenExpression(); node.cases = []; - this.expect(types.braceL); + this.expect(types$1.braceL); this.labels.push(switchLabel); this.enterScope(0); // Statements under must be grouped (by label) in SwitchCase // nodes. `cur` is used to keep the node that we are currently @@ -23892,9 +25518,9 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); var cur; - for (var sawDefault = false; this.type !== types.braceR;) { - if (this.type === types._case || this.type === types._default) { - var isCase = this.type === types._case; + for (var sawDefault = false; this.type !== types$1.braceR;) { + if (this.type === types$1._case || this.type === types$1._default) { + var isCase = this.type === types$1._case; if (cur) { this.finishNode(cur, "SwitchCase"); @@ -23915,7 +25541,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); cur.test = null; } - this.expect(types.colon); + this.expect(types$1.colon); } else { if (!cur) { this.unexpected(); @@ -23937,7 +25563,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return this.finishNode(node, "SwitchStatement"); }; - pp$1.parseThrowStatement = function (node) { + pp$8.parseThrowStatement = function (node) { this.next(); if (lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) { @@ -23950,23 +25576,23 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // Reused empty array added for node fields that are always empty. - var empty = []; + var empty$1 = []; - pp$1.parseTryStatement = function (node) { + pp$8.parseTryStatement = function (node) { this.next(); node.block = this.parseBlock(); node.handler = null; - if (this.type === types._catch) { + if (this.type === types$1._catch) { var clause = this.startNode(); this.next(); - if (this.eat(types.parenL)) { + if (this.eat(types$1.parenL)) { clause.param = this.parseBindingAtom(); var simple = clause.param.type === "Identifier"; this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0); - this.checkLVal(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL); - this.expect(types.parenR); + this.checkLValPattern(clause.param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL); + this.expect(types$1.parenR); } else { if (this.options.ecmaVersion < 10) { this.unexpected(); @@ -23981,7 +25607,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); node.handler = this.finishNode(clause, "CatchClause"); } - node.finalizer = this.eat(types._finally) ? this.parseBlock() : null; + node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null; if (!node.handler && !node.finalizer) { this.raise(node.start, "Missing catch or finally clause"); @@ -23990,14 +25616,14 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return this.finishNode(node, "TryStatement"); }; - pp$1.parseVarStatement = function (node, kind) { + pp$8.parseVarStatement = function (node, kind) { this.next(); this.parseVar(node, false, kind); this.semicolon(); return this.finishNode(node, "VariableDeclaration"); }; - pp$1.parseWhileStatement = function (node) { + pp$8.parseWhileStatement = function (node) { this.next(); node.test = this.parseParenExpression(); this.labels.push(loopLabel); @@ -24006,7 +25632,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return this.finishNode(node, "WhileStatement"); }; - pp$1.parseWithStatement = function (node) { + pp$8.parseWithStatement = function (node) { if (this.strict) { this.raise(this.start, "'with' in strict mode"); } @@ -24017,12 +25643,12 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return this.finishNode(node, "WithStatement"); }; - pp$1.parseEmptyStatement = function (node) { + pp$8.parseEmptyStatement = function (node) { this.next(); return this.finishNode(node, "EmptyStatement"); }; - pp$1.parseLabeledStatement = function (node, maybeName, expr, context) { + pp$8.parseLabeledStatement = function (node, maybeName, expr, context) { for (var i$1 = 0, list = this.labels; i$1 < list.length; i$1 += 1) { var label = list[i$1]; @@ -24031,7 +25657,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } } - var kind = this.type.isLoop ? "loop" : this.type === types._switch ? "switch" : null; + var kind = this.type.isLoop ? "loop" : this.type === types$1._switch ? "switch" : null; for (var i = this.labels.length - 1; i >= 0; i--) { var label$1 = this.labels[i]; @@ -24056,7 +25682,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return this.finishNode(node, "LabeledStatement"); }; - pp$1.parseExpressionStatement = function (node, expr) { + pp$8.parseExpressionStatement = function (node, expr) { node.expression = expr; this.semicolon(); return this.finishNode(node, "ExpressionStatement"); @@ -24065,17 +25691,17 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // function bodies). - pp$1.parseBlock = function (createNewLexicalScope, node, exitStrict) { + pp$8.parseBlock = function (createNewLexicalScope, node, exitStrict) { if (createNewLexicalScope === void 0) createNewLexicalScope = true; if (node === void 0) node = this.startNode(); node.body = []; - this.expect(types.braceL); + this.expect(types$1.braceL); if (createNewLexicalScope) { this.enterScope(0); } - while (this.type !== types.braceR) { + while (this.type !== types$1.braceR) { var stmt = this.parseStatement(null); node.body.push(stmt); } @@ -24096,13 +25722,13 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // expression. - pp$1.parseFor = function (node, init) { + pp$8.parseFor = function (node, init) { node.init = init; - this.expect(types.semi); - node.test = this.type === types.semi ? null : this.parseExpression(); - this.expect(types.semi); - node.update = this.type === types.parenR ? null : this.parseExpression(); - this.expect(types.parenR); + this.expect(types$1.semi); + node.test = this.type === types$1.semi ? null : this.parseExpression(); + this.expect(types$1.semi); + node.update = this.type === types$1.parenR ? null : this.parseExpression(); + this.expect(types$1.parenR); node.body = this.parseStatement("for"); this.exitScope(); this.labels.pop(); @@ -24111,19 +25737,17 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // same from parser's perspective. - pp$1.parseForIn = function (node, init) { - var isForIn = this.type === types._in; + pp$8.parseForIn = function (node, init) { + var isForIn = this.type === types$1._in; this.next(); if (init.type === "VariableDeclaration" && init.declarations[0].init != null && (!isForIn || this.options.ecmaVersion < 8 || this.strict || init.kind !== "var" || init.declarations[0].id.type !== "Identifier")) { this.raise(init.start, (isForIn ? "for-in" : "for-of") + " loop variable declaration may not have an initializer"); - } else if (init.type === "AssignmentPattern") { - this.raise(init.start, "Invalid left-hand side in for-loop"); } node.left = init; node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign(); - this.expect(types.parenR); + this.expect(types$1.parenR); node.body = this.parseStatement("for"); this.exitScope(); this.labels.pop(); @@ -24131,7 +25755,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // Parse a list of variable declarations. - pp$1.parseVar = function (node, isFor, kind) { + pp$8.parseVar = function (node, isFor, kind) { node.declarations = []; node.kind = kind; @@ -24139,11 +25763,11 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); var decl = this.startNode(); this.parseVarId(decl, kind); - if (this.eat(types.eq)) { + if (this.eat(types$1.eq)) { decl.init = this.parseMaybeAssign(isFor); - } else if (kind === "const" && !(this.type === types._in || this.options.ecmaVersion >= 6 && this.isContextual("of"))) { + } else if (kind === "const" && !(this.type === types$1._in || this.options.ecmaVersion >= 6 && this.isContextual("of"))) { this.unexpected(); - } else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types._in || this.isContextual("of")))) { + } else if (decl.id.type !== "Identifier" && !(isFor && (this.type === types$1._in || this.isContextual("of")))) { this.raise(this.lastTokEnd, "Complex binding patterns require an initialization value"); } else { decl.init = null; @@ -24151,7 +25775,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); node.declarations.push(this.finishNode(decl, "VariableDeclarator")); - if (!this.eat(types.comma)) { + if (!this.eat(types$1.comma)) { break; } } @@ -24159,9 +25783,9 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return node; }; - pp$1.parseVarId = function (decl, kind) { + pp$8.parseVarId = function (decl, kind) { decl.id = this.parseBindingAtom(); - this.checkLVal(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false); + this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false); }; var FUNC_STATEMENT = 1, @@ -24170,15 +25794,15 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // `statement & FUNC_STATEMENT`). // Remove `allowExpressionBody` for 7.0.0, as it is only called with false - pp$1.parseFunction = function (node, statement, allowExpressionBody, isAsync) { + pp$8.parseFunction = function (node, statement, allowExpressionBody, isAsync, forInit) { this.initFunction(node); if (this.options.ecmaVersion >= 9 || this.options.ecmaVersion >= 6 && !isAsync) { - if (this.type === types.star && statement & FUNC_HANGING_STATEMENT) { + if (this.type === types$1.star && statement & FUNC_HANGING_STATEMENT) { this.unexpected(); } - node.generator = this.eat(types.star); + node.generator = this.eat(types$1.star); } if (this.options.ecmaVersion >= 8) { @@ -24186,14 +25810,14 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } if (statement & FUNC_STATEMENT) { - node.id = statement & FUNC_NULLABLE_ID && this.type !== types.name ? null : this.parseIdent(); + node.id = statement & FUNC_NULLABLE_ID && this.type !== types$1.name ? null : this.parseIdent(); if (node.id && !(statement & FUNC_HANGING_STATEMENT)) // If it is a regular function declaration in sloppy mode, then it is // subject to Annex B semantics (BIND_FUNCTION). Otherwise, the binding // mode depends on properties of the current scope (see // treatFunctionsAsVar). { - this.checkLVal(node.id, this.strict || node.generator || node.async ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION); + this.checkLValSimple(node.id, this.strict || node.generator || node.async ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION); } } @@ -24206,26 +25830,26 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); this.enterScope(functionFlags(node.async, node.generator)); if (!(statement & FUNC_STATEMENT)) { - node.id = this.type === types.name ? this.parseIdent() : null; + node.id = this.type === types$1.name ? this.parseIdent() : null; } this.parseFunctionParams(node); - this.parseFunctionBody(node, allowExpressionBody, false); + this.parseFunctionBody(node, allowExpressionBody, false, forInit); this.yieldPos = oldYieldPos; this.awaitPos = oldAwaitPos; this.awaitIdentPos = oldAwaitIdentPos; return this.finishNode(node, statement & FUNC_STATEMENT ? "FunctionDeclaration" : "FunctionExpression"); }; - pp$1.parseFunctionParams = function (node) { - this.expect(types.parenL); - node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8); + pp$8.parseFunctionParams = function (node) { + this.expect(types$1.parenL); + node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8); this.checkYieldAwaitInDefaultParams(); }; // Parse a class declaration or literal (depending on the // `isStatement` parameter). - pp$1.parseClass = function (node, isStatement) { + pp$8.parseClass = function (node, isStatement) { this.next(); // ecma-262 14.6 Class Definitions // A class definition is always strict mode code. @@ -24233,12 +25857,13 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); this.strict = true; this.parseClassId(node, isStatement); this.parseClassSuper(node); + var privateNameMap = this.enterClassBody(); var classBody = this.startNode(); var hadConstructor = false; classBody.body = []; - this.expect(types.braceL); + this.expect(types$1.braceL); - while (this.type !== types.braceR) { + while (this.type !== types$1.braceR) { var element = this.parseClassElement(node.superClass !== null); if (element) { @@ -24250,6 +25875,8 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } hadConstructor = true; + } else if (element.key && element.key.type === "PrivateIdentifier" && isPrivateNameConflicted(privateNameMap, element)) { + this.raiseRecoverable(element.key.start, "Identifier '#" + element.key.name + "' has already been declared"); } } } @@ -24257,70 +25884,115 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); this.strict = oldStrict; this.next(); node.body = this.finishNode(classBody, "ClassBody"); + this.exitClassBody(); return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression"); }; - pp$1.parseClassElement = function (constructorAllowsSuper) { - var this$1 = this; - - if (this.eat(types.semi)) { + pp$8.parseClassElement = function (constructorAllowsSuper) { + if (this.eat(types$1.semi)) { return null; } - var method = this.startNode(); - - var tryContextual = function (k, noLineBreak) { - if (noLineBreak === void 0) noLineBreak = false; - var start = this$1.start, - startLoc = this$1.startLoc; - - if (!this$1.eatContextual(k)) { - return false; - } - - if (this$1.type !== types.parenL && (!noLineBreak || !this$1.canInsertSemicolon())) { - return true; - } - - if (method.key) { - this$1.unexpected(); - } - - method.computed = false; - method.key = this$1.startNodeAt(start, startLoc); - method.key.name = k; - this$1.finishNode(method.key, "Identifier"); - return false; - }; - - method.kind = "method"; - method.static = tryContextual("static"); - var isGenerator = this.eat(types.star); + var ecmaVersion = this.options.ecmaVersion; + var node = this.startNode(); + var keyName = ""; + var isGenerator = false; var isAsync = false; + var kind = "method"; + var isStatic = false; - if (!isGenerator) { - if (this.options.ecmaVersion >= 8 && tryContextual("async", true)) { + if (this.eatContextual("static")) { + // Parse static init block + if (ecmaVersion >= 13 && this.eat(types$1.braceL)) { + this.parseClassStaticBlock(node); + return node; + } + + if (this.isClassElementNameStart() || this.type === types$1.star) { + isStatic = true; + } else { + keyName = "static"; + } + } + + node.static = isStatic; + + if (!keyName && ecmaVersion >= 8 && this.eatContextual("async")) { + if ((this.isClassElementNameStart() || this.type === types$1.star) && !this.canInsertSemicolon()) { isAsync = true; - isGenerator = this.options.ecmaVersion >= 9 && this.eat(types.star); - } else if (tryContextual("get")) { - method.kind = "get"; - } else if (tryContextual("set")) { - method.kind = "set"; + } else { + keyName = "async"; } } - if (!method.key) { - this.parsePropertyName(method); + if (!keyName && (ecmaVersion >= 9 || !isAsync) && this.eat(types$1.star)) { + isGenerator = true; } + if (!keyName && !isAsync && !isGenerator) { + var lastValue = this.value; + + if (this.eatContextual("get") || this.eatContextual("set")) { + if (this.isClassElementNameStart()) { + kind = lastValue; + } else { + keyName = lastValue; + } + } + } // Parse element name + + + if (keyName) { + // 'async', 'get', 'set', or 'static' were not a keyword contextually. + // The last token is any of those. Make it the element name. + node.computed = false; + node.key = this.startNodeAt(this.lastTokStart, this.lastTokStartLoc); + node.key.name = keyName; + this.finishNode(node.key, "Identifier"); + } else { + this.parseClassElementName(node); + } // Parse element value + + + if (ecmaVersion < 13 || this.type === types$1.parenL || kind !== "method" || isGenerator || isAsync) { + var isConstructor = !node.static && checkKeyName(node, "constructor"); + var allowsDirectSuper = isConstructor && constructorAllowsSuper; // Couldn't move this check into the 'parseClassMethod' method for backward compatibility. + + if (isConstructor && kind !== "method") { + this.raise(node.key.start, "Constructor can't have get/set modifier"); + } + + node.kind = isConstructor ? "constructor" : kind; + this.parseClassMethod(node, isGenerator, isAsync, allowsDirectSuper); + } else { + this.parseClassField(node); + } + + return node; + }; + + pp$8.isClassElementNameStart = function () { + return this.type === types$1.name || this.type === types$1.privateId || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword; + }; + + pp$8.parseClassElementName = function (element) { + if (this.type === types$1.privateId) { + if (this.value === "constructor") { + this.raise(this.start, "Classes can't have an element named '#constructor'"); + } + + element.computed = false; + element.key = this.parsePrivateIdent(); + } else { + this.parsePropertyName(element); + } + }; + + pp$8.parseClassMethod = function (method, isGenerator, isAsync, allowsDirectSuper) { + // Check key and flags var key = method.key; - var allowsDirectSuper = false; - - if (!method.computed && !method.static && (key.type === "Identifier" && key.name === "constructor" || key.type === "Literal" && key.value === "constructor")) { - if (method.kind !== "method") { - this.raise(key.start, "Constructor can't have get/set modifier"); - } + if (method.kind === "constructor") { if (isGenerator) { this.raise(key.start, "Constructor can't be a generator"); } @@ -24328,41 +26000,73 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); if (isAsync) { this.raise(key.start, "Constructor can't be an async method"); } - - method.kind = "constructor"; - allowsDirectSuper = constructorAllowsSuper; - } else if (method.static && key.type === "Identifier" && key.name === "prototype") { + } else if (method.static && checkKeyName(method, "prototype")) { this.raise(key.start, "Classes may not have a static property named prototype"); + } // Parse value + + + var value = method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper); // Check value + + if (method.kind === "get" && value.params.length !== 0) { + this.raiseRecoverable(value.start, "getter should have no params"); } - this.parseClassMethod(method, isGenerator, isAsync, allowsDirectSuper); - - if (method.kind === "get" && method.value.params.length !== 0) { - this.raiseRecoverable(method.value.start, "getter should have no params"); + if (method.kind === "set" && value.params.length !== 1) { + this.raiseRecoverable(value.start, "setter should have exactly one param"); } - if (method.kind === "set" && method.value.params.length !== 1) { - this.raiseRecoverable(method.value.start, "setter should have exactly one param"); + if (method.kind === "set" && value.params[0].type === "RestElement") { + this.raiseRecoverable(value.params[0].start, "Setter cannot use rest params"); } - if (method.kind === "set" && method.value.params[0].type === "RestElement") { - this.raiseRecoverable(method.value.params[0].start, "Setter cannot use rest params"); - } - - return method; - }; - - pp$1.parseClassMethod = function (method, isGenerator, isAsync, allowsDirectSuper) { - method.value = this.parseMethod(isGenerator, isAsync, allowsDirectSuper); return this.finishNode(method, "MethodDefinition"); }; - pp$1.parseClassId = function (node, isStatement) { - if (this.type === types.name) { + pp$8.parseClassField = function (field) { + if (checkKeyName(field, "constructor")) { + this.raise(field.key.start, "Classes can't have a field named 'constructor'"); + } else if (field.static && checkKeyName(field, "prototype")) { + this.raise(field.key.start, "Classes can't have a static field named 'prototype'"); + } + + if (this.eat(types$1.eq)) { + // To raise SyntaxError if 'arguments' exists in the initializer. + var scope = this.currentThisScope(); + var inClassFieldInit = scope.inClassFieldInit; + scope.inClassFieldInit = true; + field.value = this.parseMaybeAssign(); + scope.inClassFieldInit = inClassFieldInit; + } else { + field.value = null; + } + + this.semicolon(); + return this.finishNode(field, "PropertyDefinition"); + }; + + pp$8.parseClassStaticBlock = function (node) { + node.body = []; + var oldLabels = this.labels; + this.labels = []; + this.enterScope(SCOPE_CLASS_STATIC_BLOCK | SCOPE_SUPER); + + while (this.type !== types$1.braceR) { + var stmt = this.parseStatement(null); + node.body.push(stmt); + } + + this.next(); + this.exitScope(); + this.labels = oldLabels; + return this.finishNode(node, "StaticBlock"); + }; + + pp$8.parseClassId = function (node, isStatement) { + if (this.type === types$1.name) { node.id = this.parseIdent(); if (isStatement) { - this.checkLVal(node.id, BIND_LEXICAL, false); + this.checkLValSimple(node.id, BIND_LEXICAL, false); } } else { if (isStatement === true) { @@ -24373,15 +26077,71 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } }; - pp$1.parseClassSuper = function (node) { - node.superClass = this.eat(types._extends) ? this.parseExprSubscripts() : null; - }; // Parses module export declaration. + pp$8.parseClassSuper = function (node) { + node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(false) : null; + }; + + pp$8.enterClassBody = function () { + var element = { + declared: Object.create(null), + used: [] + }; + this.privateNameStack.push(element); + return element.declared; + }; + + pp$8.exitClassBody = function () { + var ref = this.privateNameStack.pop(); + var declared = ref.declared; + var used = ref.used; + var len = this.privateNameStack.length; + var parent = len === 0 ? null : this.privateNameStack[len - 1]; + + for (var i = 0; i < used.length; ++i) { + var id = used[i]; + + if (!has(declared, id.name)) { + if (parent) { + parent.used.push(id); + } else { + this.raiseRecoverable(id.start, "Private field '#" + id.name + "' must be declared in an enclosing class"); + } + } + } + }; + + function isPrivateNameConflicted(privateNameMap, element) { + var name = element.key.name; + var curr = privateNameMap[name]; + var next = "true"; + + if (element.type === "MethodDefinition" && (element.kind === "get" || element.kind === "set")) { + next = (element.static ? "s" : "i") + element.kind; + } // `class { get #a(){}; static set #a(_){} }` is also conflict. - pp$1.parseExport = function (node, exports) { + if (curr === "iget" && next === "iset" || curr === "iset" && next === "iget" || curr === "sget" && next === "sset" || curr === "sset" && next === "sget") { + privateNameMap[name] = "true"; + return false; + } else if (!curr) { + privateNameMap[name] = next; + return false; + } else { + return true; + } + } + + function checkKeyName(node, name) { + var computed = node.computed; + var key = node.key; + return !computed && (key.type === "Identifier" && key.name === name || key.type === "Literal" && key.value === name); + } // Parses module export declaration. + + + pp$8.parseExport = function (node, exports) { this.next(); // export * from '...' - if (this.eat(types.star)) { + if (this.eat(types$1.star)) { if (this.options.ecmaVersion >= 11) { if (this.eatContextual("as")) { node.exported = this.parseIdent(true); @@ -24393,7 +26153,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); this.expectContextual("from"); - if (this.type !== types.string) { + if (this.type !== types$1.string) { this.unexpected(); } @@ -24402,12 +26162,12 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return this.finishNode(node, "ExportAllDeclaration"); } - if (this.eat(types._default)) { + if (this.eat(types$1._default)) { // export default ... this.checkExport(exports, "default", this.lastTokStart); var isAsync; - if (this.type === types._function || (isAsync = this.isAsyncFunction())) { + if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) { var fNode = this.startNode(); this.next(); @@ -24416,7 +26176,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } node.declaration = this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync); - } else if (this.type === types._class) { + } else if (this.type === types$1._class) { var cNode = this.startNode(); node.declaration = this.parseClass(cNode, "nullableID"); } else { @@ -24445,7 +26205,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); node.specifiers = this.parseExportSpecifiers(exports); if (this.eatContextual("from")) { - if (this.type !== types.string) { + if (this.type !== types$1.string) { this.unexpected(); } @@ -24468,7 +26228,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return this.finishNode(node, "ExportNamedDeclaration"); }; - pp$1.checkExport = function (exports, name, pos) { + pp$8.checkExport = function (exports, name, pos) { if (!exports) { return; } @@ -24480,7 +26240,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); exports[name] = true; }; - pp$1.checkPatternExport = function (exports, pat) { + pp$8.checkPatternExport = function (exports, pat) { var type = pat.type; if (type === "Identifier") { @@ -24509,7 +26269,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } }; - pp$1.checkVariableExport = function (exports, decls) { + pp$8.checkVariableExport = function (exports, decls) { if (!exports) { return; } @@ -24520,22 +26280,22 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } }; - pp$1.shouldParseExportStatement = function () { + pp$8.shouldParseExportStatement = function () { return this.type.keyword === "var" || this.type.keyword === "const" || this.type.keyword === "class" || this.type.keyword === "function" || this.isLet() || this.isAsyncFunction(); }; // Parses a comma-separated list of module exports. - pp$1.parseExportSpecifiers = function (exports) { + pp$8.parseExportSpecifiers = function (exports) { var nodes = [], first = true; // export { x, y as z } [from '...'] - this.expect(types.braceL); + this.expect(types$1.braceL); - while (!this.eat(types.braceR)) { + while (!this.eat(types$1.braceR)) { if (!first) { - this.expect(types.comma); + this.expect(types$1.comma); - if (this.afterTrailingComma(types.braceR)) { + if (this.afterTrailingComma(types$1.braceR)) { break; } } else { @@ -24553,16 +26313,16 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // Parses import declaration. - pp$1.parseImport = function (node) { + pp$8.parseImport = function (node) { this.next(); // import '...' - if (this.type === types.string) { - node.specifiers = empty; + if (this.type === types$1.string) { + node.specifiers = empty$1; node.source = this.parseExprAtom(); } else { node.specifiers = this.parseImportSpecifiers(); this.expectContextual("from"); - node.source = this.type === types.string ? this.parseExprAtom() : this.unexpected(); + node.source = this.type === types$1.string ? this.parseExprAtom() : this.unexpected(); } this.semicolon(); @@ -24570,39 +26330,39 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // Parses a comma-separated list of module imports. - pp$1.parseImportSpecifiers = function () { + pp$8.parseImportSpecifiers = function () { var nodes = [], first = true; - if (this.type === types.name) { + if (this.type === types$1.name) { // import defaultObj, { x, y as z } from '...' var node = this.startNode(); node.local = this.parseIdent(); - this.checkLVal(node.local, BIND_LEXICAL); + this.checkLValSimple(node.local, BIND_LEXICAL); nodes.push(this.finishNode(node, "ImportDefaultSpecifier")); - if (!this.eat(types.comma)) { + if (!this.eat(types$1.comma)) { return nodes; } } - if (this.type === types.star) { + if (this.type === types$1.star) { var node$1 = this.startNode(); this.next(); this.expectContextual("as"); node$1.local = this.parseIdent(); - this.checkLVal(node$1.local, BIND_LEXICAL); + this.checkLValSimple(node$1.local, BIND_LEXICAL); nodes.push(this.finishNode(node$1, "ImportNamespaceSpecifier")); return nodes; } - this.expect(types.braceL); + this.expect(types$1.braceL); - while (!this.eat(types.braceR)) { + while (!this.eat(types$1.braceR)) { if (!first) { - this.expect(types.comma); + this.expect(types$1.comma); - if (this.afterTrailingComma(types.braceR)) { + if (this.afterTrailingComma(types$1.braceR)) { break; } } else { @@ -24619,7 +26379,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); node$2.local = node$2.imported; } - this.checkLVal(node$2.local, BIND_LEXICAL); + this.checkLValSimple(node$2.local, BIND_LEXICAL); nodes.push(this.finishNode(node$2, "ImportSpecifier")); } @@ -24627,20 +26387,21 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // Set `ExpressionStatement#directive` property for directive prologues. - pp$1.adaptDirectivePrologue = function (statements) { + pp$8.adaptDirectivePrologue = function (statements) { for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) { statements[i].directive = statements[i].expression.raw.slice(1, -1); } }; - pp$1.isDirectiveCandidate = function (statement) { - return statement.type === "ExpressionStatement" && statement.expression.type === "Literal" && typeof statement.expression.value === "string" && (this.input[statement.start] === "\"" || this.input[statement.start] === "'"); + pp$8.isDirectiveCandidate = function (statement) { + return statement.type === "ExpressionStatement" && statement.expression.type === "Literal" && typeof statement.expression.value === "string" && ( // Reject parenthesized strings. + this.input[statement.start] === "\"" || this.input[statement.start] === "'"); }; - var pp$2 = Parser.prototype; // Convert existing expression atom to assignable pattern + var pp$7 = Parser.prototype; // Convert existing expression atom to assignable pattern // if possible. - pp$2.toAssignable = function (node, isBinding, refDestructuringErrors) { + pp$7.toAssignable = function (node, isBinding, refDestructuringErrors) { if (this.options.ecmaVersion >= 6 && node) { switch (node.type) { case "Identifier": @@ -24652,6 +26413,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); case "ObjectPattern": case "ArrayPattern": + case "AssignmentPattern": case "RestElement": break; @@ -24714,9 +26476,6 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); node.type = "AssignmentPattern"; delete node.operator; this.toAssignable(node.left, isBinding); - // falls through to AssignmentPattern - - case "AssignmentPattern": break; case "ParenthesizedExpression": @@ -24743,7 +26502,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // Convert list of expression atoms to binding list. - pp$2.toAssignableList = function (exprList, isBinding) { + pp$7.toAssignableList = function (exprList, isBinding) { var end = exprList.length; for (var i = 0; i < end; i++) { @@ -24766,18 +26525,18 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // Parses spread element. - pp$2.parseSpread = function (refDestructuringErrors) { + pp$7.parseSpread = function (refDestructuringErrors) { var node = this.startNode(); this.next(); node.argument = this.parseMaybeAssign(false, refDestructuringErrors); return this.finishNode(node, "SpreadElement"); }; - pp$2.parseRestBinding = function () { + pp$7.parseRestBinding = function () { var node = this.startNode(); this.next(); // RestElement inside of a function parameter must be an identifier - if (this.options.ecmaVersion === 6 && this.type !== types.name) { + if (this.options.ecmaVersion === 6 && this.type !== types$1.name) { this.unexpected(); } @@ -24786,16 +26545,16 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // Parses lvalue (assignable) atom. - pp$2.parseBindingAtom = function () { + pp$7.parseBindingAtom = function () { if (this.options.ecmaVersion >= 6) { switch (this.type) { - case types.bracketL: + case types$1.bracketL: var node = this.startNode(); this.next(); - node.elements = this.parseBindingList(types.bracketR, true, true); + node.elements = this.parseBindingList(types$1.bracketR, true, true); return this.finishNode(node, "ArrayPattern"); - case types.braceL: + case types$1.braceL: return this.parseObj(true); } } @@ -24803,7 +26562,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return this.parseIdent(); }; - pp$2.parseBindingList = function (close, allowEmpty, allowTrailingComma) { + pp$7.parseBindingList = function (close, allowEmpty, allowTrailingComma) { var elts = [], first = true; @@ -24811,19 +26570,19 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); if (first) { first = false; } else { - this.expect(types.comma); + this.expect(types$1.comma); } - if (allowEmpty && this.type === types.comma) { + if (allowEmpty && this.type === types$1.comma) { elts.push(null); } else if (allowTrailingComma && this.afterTrailingComma(close)) { break; - } else if (this.type === types.ellipsis) { + } else if (this.type === types$1.ellipsis) { var rest = this.parseRestBinding(); this.parseBindingListItem(rest); elts.push(rest); - if (this.type === types.comma) { + if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); } @@ -24839,15 +26598,15 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return elts; }; - pp$2.parseBindingListItem = function (param) { + pp$7.parseBindingListItem = function (param) { return param; }; // Parses assignment pattern around given atom if possible. - pp$2.parseMaybeDefault = function (startPos, startLoc, left) { + pp$7.parseMaybeDefault = function (startPos, startLoc, left) { left = left || this.parseBindingAtom(); - if (this.options.ecmaVersion < 6 || !this.eat(types.eq)) { + if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) { return left; } @@ -24855,37 +26614,97 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); node.left = left; node.right = this.parseMaybeAssign(); return this.finishNode(node, "AssignmentPattern"); - }; // Verify that a node is an lval — something that can be assigned - // to. - // bindingType can be either: - // 'var' indicating that the lval creates a 'var' binding - // 'let' indicating that the lval creates a lexical ('let' or 'const') binding - // 'none' indicating that the binding should be checked for illegal identifiers, but not for duplicate references + }; // The following three functions all verify that a node is an lvalue — + // something that can be bound, or assigned to. In order to do so, they perform + // a variety of checks: + // + // - Check that none of the bound/assigned-to identifiers are reserved words. + // - Record name declarations for bindings in the appropriate scope. + // - Check duplicate argument names, if checkClashes is set. + // + // If a complex binding pattern is encountered (e.g., object and array + // destructuring), the entire pattern is recursively checked. + // + // There are three versions of checkLVal*() appropriate for different + // circumstances: + // + // - checkLValSimple() shall be used if the syntactic construct supports + // nothing other than identifiers and member expressions. Parenthesized + // expressions are also correctly handled. This is generally appropriate for + // constructs for which the spec says + // + // > It is a Syntax Error if AssignmentTargetType of [the production] is not + // > simple. + // + // It is also appropriate for checking if an identifier is valid and not + // defined elsewhere, like import declarations or function/class identifiers. + // + // Examples where this is used include: + // a += …; + // import a from '…'; + // where a is the node to be checked. + // + // - checkLValPattern() shall be used if the syntactic construct supports + // anything checkLValSimple() supports, as well as object and array + // destructuring patterns. This is generally appropriate for constructs for + // which the spec says + // + // > It is a Syntax Error if [the production] is neither an ObjectLiteral nor + // > an ArrayLiteral and AssignmentTargetType of [the production] is not + // > simple. + // + // Examples where this is used include: + // (a = …); + // const a = …; + // try { … } catch (a) { … } + // where a is the node to be checked. + // + // - checkLValInnerPattern() shall be used if the syntactic construct supports + // anything checkLValPattern() supports, as well as default assignment + // patterns, rest elements, and other constructs that may appear within an + // object or array destructuring pattern. + // + // As a special case, function parameters also use checkLValInnerPattern(), + // as they also support defaults and rest constructs. + // + // These functions deliberately support both assignment and binding constructs, + // as the logic for both is exceedingly similar. If the node is the target of + // an assignment, then bindingType should be set to BIND_NONE. Otherwise, it + // should be set to the appropriate BIND_* constant, like BIND_VAR or + // BIND_LEXICAL. + // + // If the function is called with a non-BIND_NONE bindingType, then + // additionally a checkClashes object may be specified to allow checking for + // duplicate argument names. checkClashes is ignored if the provided construct + // is an assignment (i.e., bindingType is BIND_NONE). - pp$2.checkLVal = function (expr, bindingType, checkClashes) { + pp$7.checkLValSimple = function (expr, bindingType, checkClashes) { if (bindingType === void 0) bindingType = BIND_NONE; + var isBind = bindingType !== BIND_NONE; switch (expr.type) { case "Identifier": - if (bindingType === BIND_LEXICAL && expr.name === "let") { - this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name"); - } - if (this.strict && this.reservedWordsStrictBind.test(expr.name)) { - this.raiseRecoverable(expr.start, (bindingType ? "Binding " : "Assigning to ") + expr.name + " in strict mode"); + this.raiseRecoverable(expr.start, (isBind ? "Binding " : "Assigning to ") + expr.name + " in strict mode"); } - if (checkClashes) { - if (has(checkClashes, expr.name)) { - this.raiseRecoverable(expr.start, "Argument name clash"); + if (isBind) { + if (bindingType === BIND_LEXICAL && expr.name === "let") { + this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name"); } - checkClashes[expr.name] = true; - } + if (checkClashes) { + if (has(checkClashes, expr.name)) { + this.raiseRecoverable(expr.start, "Argument name clash"); + } - if (bindingType !== BIND_NONE && bindingType !== BIND_OUTSIDE) { - this.declareName(expr.name, bindingType, expr.start); + checkClashes[expr.name] = true; + } + + if (bindingType !== BIND_OUTSIDE) { + this.declareName(expr.name, bindingType, expr.start); + } } break; @@ -24895,60 +26714,260 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); break; case "MemberExpression": - if (bindingType) { + if (isBind) { this.raiseRecoverable(expr.start, "Binding member expression"); } break; + case "ParenthesizedExpression": + if (isBind) { + this.raiseRecoverable(expr.start, "Binding parenthesized expression"); + } + + return this.checkLValSimple(expr.expression, bindingType, checkClashes); + + default: + this.raise(expr.start, (isBind ? "Binding" : "Assigning to") + " rvalue"); + } + }; + + pp$7.checkLValPattern = function (expr, bindingType, checkClashes) { + if (bindingType === void 0) bindingType = BIND_NONE; + + switch (expr.type) { case "ObjectPattern": for (var i = 0, list = expr.properties; i < list.length; i += 1) { var prop = list[i]; - this.checkLVal(prop, bindingType, checkClashes); + this.checkLValInnerPattern(prop, bindingType, checkClashes); } break; - case "Property": - // AssignmentProperty has type === "Property" - this.checkLVal(expr.value, bindingType, checkClashes); - break; - case "ArrayPattern": for (var i$1 = 0, list$1 = expr.elements; i$1 < list$1.length; i$1 += 1) { var elem = list$1[i$1]; if (elem) { - this.checkLVal(elem, bindingType, checkClashes); + this.checkLValInnerPattern(elem, bindingType, checkClashes); } } break; + default: + this.checkLValSimple(expr, bindingType, checkClashes); + } + }; + + pp$7.checkLValInnerPattern = function (expr, bindingType, checkClashes) { + if (bindingType === void 0) bindingType = BIND_NONE; + + switch (expr.type) { + case "Property": + // AssignmentProperty has type === "Property" + this.checkLValInnerPattern(expr.value, bindingType, checkClashes); + break; + case "AssignmentPattern": - this.checkLVal(expr.left, bindingType, checkClashes); + this.checkLValPattern(expr.left, bindingType, checkClashes); break; case "RestElement": - this.checkLVal(expr.argument, bindingType, checkClashes); - break; - - case "ParenthesizedExpression": - this.checkLVal(expr.expression, bindingType, checkClashes); + this.checkLValPattern(expr.argument, bindingType, checkClashes); break; default: - this.raise(expr.start, (bindingType ? "Binding" : "Assigning to") + " rvalue"); + this.checkLValPattern(expr, bindingType, checkClashes); } + }; // The algorithm used to determine whether a regexp can appear at a + + + var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) { + this.token = token; + this.isExpr = !!isExpr; + this.preserveSpace = !!preserveSpace; + this.override = override; + this.generator = !!generator; + }; + + var types = { + b_stat: new TokContext("{", false), + b_expr: new TokContext("{", true), + b_tmpl: new TokContext("${", false), + p_stat: new TokContext("(", false), + p_expr: new TokContext("(", true), + q_tmpl: new TokContext("`", true, true, function (p) { + return p.tryReadTemplateToken(); + }), + f_stat: new TokContext("function", false), + f_expr: new TokContext("function", true), + f_expr_gen: new TokContext("function", true, false, null, true), + f_gen: new TokContext("function", false, false, null, true) + }; + var pp$6 = Parser.prototype; + + pp$6.initialContext = function () { + return [types.b_stat]; + }; + + pp$6.curContext = function () { + return this.context[this.context.length - 1]; + }; + + pp$6.braceIsBlock = function (prevType) { + var parent = this.curContext(); + + if (parent === types.f_expr || parent === types.f_stat) { + return true; + } + + if (prevType === types$1.colon && (parent === types.b_stat || parent === types.b_expr)) { + return !parent.isExpr; + } // The check for `tt.name && exprAllowed` detects whether we are + // after a `yield` or `of` construct. See the `updateContext` for + // `tt.name`. + + + if (prevType === types$1._return || prevType === types$1.name && this.exprAllowed) { + return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)); + } + + if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow) { + return true; + } + + if (prevType === types$1.braceL) { + return parent === types.b_stat; + } + + if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name) { + return false; + } + + return !this.exprAllowed; + }; + + pp$6.inGeneratorContext = function () { + for (var i = this.context.length - 1; i >= 1; i--) { + var context = this.context[i]; + + if (context.token === "function") { + return context.generator; + } + } + + return false; + }; + + pp$6.updateContext = function (prevType) { + var update, + type = this.type; + + if (type.keyword && prevType === types$1.dot) { + this.exprAllowed = false; + } else if (update = type.updateContext) { + update.call(this, prevType); + } else { + this.exprAllowed = type.beforeExpr; + } + }; // Used to handle egde case when token context could not be inferred correctly in tokenize phase + + + pp$6.overrideContext = function (tokenCtx) { + if (this.curContext() !== tokenCtx) { + this.context[this.context.length - 1] = tokenCtx; + } + }; // Token-specific context update code + + + types$1.parenR.updateContext = types$1.braceR.updateContext = function () { + if (this.context.length === 1) { + this.exprAllowed = true; + return; + } + + var out = this.context.pop(); + + if (out === types.b_stat && this.curContext().token === "function") { + out = this.context.pop(); + } + + this.exprAllowed = !out.isExpr; + }; + + types$1.braceL.updateContext = function (prevType) { + this.context.push(this.braceIsBlock(prevType) ? types.b_stat : types.b_expr); + this.exprAllowed = true; + }; + + types$1.dollarBraceL.updateContext = function () { + this.context.push(types.b_tmpl); + this.exprAllowed = true; + }; + + types$1.parenL.updateContext = function (prevType) { + var statementParens = prevType === types$1._if || prevType === types$1._for || prevType === types$1._with || prevType === types$1._while; + this.context.push(statementParens ? types.p_stat : types.p_expr); + this.exprAllowed = true; + }; + + types$1.incDec.updateContext = function () {// tokExprAllowed stays unchanged + }; + + types$1._function.updateContext = types$1._class.updateContext = function (prevType) { + if (prevType.beforeExpr && prevType !== types$1._else && !(prevType === types$1.semi && this.curContext() !== types.p_stat) && !(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) && !((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat)) { + this.context.push(types.f_expr); + } else { + this.context.push(types.f_stat); + } + + this.exprAllowed = false; + }; + + types$1.backQuote.updateContext = function () { + if (this.curContext() === types.q_tmpl) { + this.context.pop(); + } else { + this.context.push(types.q_tmpl); + } + + this.exprAllowed = false; + }; + + types$1.star.updateContext = function (prevType) { + if (prevType === types$1._function) { + var index = this.context.length - 1; + + if (this.context[index] === types.f_expr) { + this.context[index] = types.f_expr_gen; + } else { + this.context[index] = types.f_gen; + } + } + + this.exprAllowed = true; + }; + + types$1.name.updateContext = function (prevType) { + var allowed = false; + + if (this.options.ecmaVersion >= 6 && prevType !== types$1.dot) { + if (this.value === "of" && !this.exprAllowed || this.value === "yield" && this.inGeneratorContext()) { + allowed = true; + } + } + + this.exprAllowed = allowed; }; // A recursive descent parser operates by defining functions for all - var pp$3 = Parser.prototype; // Check if property name clashes with already added. + var pp$5 = Parser.prototype; // Check if property name clashes with already added. // Object/class getters and setters are not allowed to clash — // either with each other or with an init property — and in // strict mode, init properties are also not allowed to be repeated. - pp$3.checkPropClash = function (prop, propHash, refDestructuringErrors) { + pp$5.checkPropClash = function (prop, propHash, refDestructuringErrors) { if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement") { return; } @@ -24981,8 +27000,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); if (refDestructuringErrors) { if (refDestructuringErrors.doubleProto < 0) { refDestructuringErrors.doubleProto = key.start; - } // Backwards-compat kludge. Can be removed in version 6.0 - + } } else { this.raiseRecoverable(key.start, "Redefinition of __proto__ property"); } @@ -25032,17 +27050,17 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // delayed syntax error at correct position). - pp$3.parseExpression = function (noIn, refDestructuringErrors) { + pp$5.parseExpression = function (forInit, refDestructuringErrors) { var startPos = this.start, startLoc = this.startLoc; - var expr = this.parseMaybeAssign(noIn, refDestructuringErrors); + var expr = this.parseMaybeAssign(forInit, refDestructuringErrors); - if (this.type === types.comma) { + if (this.type === types$1.comma) { var node = this.startNodeAt(startPos, startLoc); node.expressions = [expr]; - while (this.eat(types.comma)) { - node.expressions.push(this.parseMaybeAssign(noIn, refDestructuringErrors)); + while (this.eat(types$1.comma)) { + node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); } return this.finishNode(node, "SequenceExpression"); @@ -25053,10 +27071,10 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // operators like `+=`. - pp$3.parseMaybeAssign = function (noIn, refDestructuringErrors, afterLeftParse) { + pp$5.parseMaybeAssign = function (forInit, refDestructuringErrors, afterLeftParse) { if (this.isContextual("yield")) { if (this.inGenerator) { - return this.parseYield(noIn); + return this.parseYield(forInit); } // The tokenizer will assume an expression is allowed after // `yield`, but this isn't that kind of yield else { @@ -25066,11 +27084,13 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); var ownDestructuringErrors = false, oldParenAssign = -1, - oldTrailingComma = -1; + oldTrailingComma = -1, + oldDoubleProto = -1; if (refDestructuringErrors) { oldParenAssign = refDestructuringErrors.parenthesizedAssign; oldTrailingComma = refDestructuringErrors.trailingComma; + oldDoubleProto = refDestructuringErrors.doubleProto; refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = -1; } else { refDestructuringErrors = new DestructuringErrors(); @@ -25080,11 +27100,12 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); var startPos = this.start, startLoc = this.startLoc; - if (this.type === types.parenL || this.type === types.name) { + if (this.type === types$1.parenL || this.type === types$1.name) { this.potentialArrowAt = this.start; + this.potentialArrowInForAwait = forInit === "await"; } - var left = this.parseMaybeConditional(noIn, refDestructuringErrors); + var left = this.parseMaybeConditional(forInit, refDestructuringErrors); if (afterLeftParse) { left = afterLeftParse.call(this, left, startPos, startLoc); @@ -25093,20 +27114,34 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); if (this.type.isAssign) { var node = this.startNodeAt(startPos, startLoc); node.operator = this.value; - node.left = this.type === types.eq ? this.toAssignable(left, false, refDestructuringErrors) : left; + + if (this.type === types$1.eq) { + left = this.toAssignable(left, false, refDestructuringErrors); + } if (!ownDestructuringErrors) { refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1; } - if (refDestructuringErrors.shorthandAssign >= node.left.start) { + if (refDestructuringErrors.shorthandAssign >= left.start) { refDestructuringErrors.shorthandAssign = -1; } // reset because shorthand default was used correctly - this.checkLVal(left); + if (this.type === types$1.eq) { + this.checkLValPattern(left); + } else { + this.checkLValSimple(left); + } + + node.left = left; this.next(); - node.right = this.parseMaybeAssign(noIn); + node.right = this.parseMaybeAssign(forInit); + + if (oldDoubleProto > -1) { + refDestructuringErrors.doubleProto = oldDoubleProto; + } + return this.finishNode(node, "AssignmentExpression"); } else { if (ownDestructuringErrors) { @@ -25126,21 +27161,21 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // Parse a ternary conditional (`?:`) operator. - pp$3.parseMaybeConditional = function (noIn, refDestructuringErrors) { + pp$5.parseMaybeConditional = function (forInit, refDestructuringErrors) { var startPos = this.start, startLoc = this.startLoc; - var expr = this.parseExprOps(noIn, refDestructuringErrors); + var expr = this.parseExprOps(forInit, refDestructuringErrors); if (this.checkExpressionErrors(refDestructuringErrors)) { return expr; } - if (this.eat(types.question)) { + if (this.eat(types$1.question)) { var node = this.startNodeAt(startPos, startLoc); node.test = expr; node.consequent = this.parseMaybeAssign(); - this.expect(types.colon); - node.alternate = this.parseMaybeAssign(noIn); + this.expect(types$1.colon); + node.alternate = this.parseMaybeAssign(forInit); return this.finishNode(node, "ConditionalExpression"); } @@ -25148,16 +27183,16 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // Start the precedence parser. - pp$3.parseExprOps = function (noIn, refDestructuringErrors) { + pp$5.parseExprOps = function (forInit, refDestructuringErrors) { var startPos = this.start, startLoc = this.startLoc; - var expr = this.parseMaybeUnary(refDestructuringErrors, false); + var expr = this.parseMaybeUnary(refDestructuringErrors, false, false, forInit); if (this.checkExpressionErrors(refDestructuringErrors)) { return expr; } - return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, noIn); + return expr.start === startPos && expr.type === "ArrowFunctionExpression" ? expr : this.parseExprOp(expr, startPos, startLoc, -1, forInit); }; // Parse binary operators with the operator precedence parsing // algorithm. `left` is the left-hand side of the operator. // `minPrec` provides context that allows the function to stop and @@ -25165,39 +27200,43 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // operator that has a lower precedence than the set it is parsing. - pp$3.parseExprOp = function (left, leftStartPos, leftStartLoc, minPrec, noIn) { + pp$5.parseExprOp = function (left, leftStartPos, leftStartLoc, minPrec, forInit) { var prec = this.type.binop; - if (prec != null && (!noIn || this.type !== types._in)) { + if (prec != null && (!forInit || this.type !== types$1._in)) { if (prec > minPrec) { - var logical = this.type === types.logicalOR || this.type === types.logicalAND; - var coalesce = this.type === types.coalesce; + var logical = this.type === types$1.logicalOR || this.type === types$1.logicalAND; + var coalesce = this.type === types$1.coalesce; if (coalesce) { // Handle the precedence of `tt.coalesce` as equal to the range of logical expressions. // In other words, `node.right` shouldn't contain logical expressions in order to check the mixed error. - prec = types.logicalAND.binop; + prec = types$1.logicalAND.binop; } var op = this.value; this.next(); var startPos = this.start, startLoc = this.startLoc; - var right = this.parseExprOp(this.parseMaybeUnary(null, false), startPos, startLoc, prec, noIn); + var right = this.parseExprOp(this.parseMaybeUnary(null, false, false, forInit), startPos, startLoc, prec, forInit); var node = this.buildBinary(leftStartPos, leftStartLoc, left, right, op, logical || coalesce); - if (logical && this.type === types.coalesce || coalesce && (this.type === types.logicalOR || this.type === types.logicalAND)) { + if (logical && this.type === types$1.coalesce || coalesce && (this.type === types$1.logicalOR || this.type === types$1.logicalAND)) { this.raiseRecoverable(this.start, "Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"); } - return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, noIn); + return this.parseExprOp(node, leftStartPos, leftStartLoc, minPrec, forInit); } } return left; }; - pp$3.buildBinary = function (startPos, startLoc, left, right, op, logical) { + pp$5.buildBinary = function (startPos, startLoc, left, right, op, logical) { + if (right.type === "PrivateIdentifier") { + this.raise(right.start, "Private identifier can only be left side of binary expression"); + } + var node = this.startNodeAt(startPos, startLoc); node.left = left; node.operator = op; @@ -25206,34 +27245,46 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // Parse unary operators, both prefix and postfix. - pp$3.parseMaybeUnary = function (refDestructuringErrors, sawUnary) { + pp$5.parseMaybeUnary = function (refDestructuringErrors, sawUnary, incDec, forInit) { var startPos = this.start, startLoc = this.startLoc, expr; - if (this.isContextual("await") && (this.inAsync || !this.inFunction && this.options.allowAwaitOutsideFunction)) { - expr = this.parseAwait(); + if (this.isContextual("await") && this.canAwait) { + expr = this.parseAwait(forInit); sawUnary = true; } else if (this.type.prefix) { var node = this.startNode(), - update = this.type === types.incDec; + update = this.type === types$1.incDec; node.operator = this.value; node.prefix = true; this.next(); - node.argument = this.parseMaybeUnary(null, true); + node.argument = this.parseMaybeUnary(null, true, update, forInit); this.checkExpressionErrors(refDestructuringErrors, true); if (update) { - this.checkLVal(node.argument); + this.checkLValSimple(node.argument); } else if (this.strict && node.operator === "delete" && node.argument.type === "Identifier") { this.raiseRecoverable(node.start, "Deleting local variable in strict mode"); + } else if (node.operator === "delete" && isPrivateFieldAccess(node.argument)) { + this.raiseRecoverable(node.start, "Private fields can not be deleted"); } else { sawUnary = true; } expr = this.finishNode(node, update ? "UpdateExpression" : "UnaryExpression"); + } else if (!sawUnary && this.type === types$1.privateId) { + if (forInit || this.privateNameStack.length === 0) { + this.unexpected(); + } + + expr = this.parsePrivateIdent(); // only could be private fields in 'in', such as #x in obj + + if (this.type !== types$1._in) { + this.unexpected(); + } } else { - expr = this.parseExprSubscripts(refDestructuringErrors); + expr = this.parseExprSubscripts(refDestructuringErrors, forInit); if (this.checkExpressionErrors(refDestructuringErrors)) { return expr; @@ -25244,30 +27295,38 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); node$1.operator = this.value; node$1.prefix = false; node$1.argument = expr; - this.checkLVal(expr); + this.checkLValSimple(expr); this.next(); expr = this.finishNode(node$1, "UpdateExpression"); } } - if (!sawUnary && this.eat(types.starstar)) { - return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false), "**", false); + if (!incDec && this.eat(types$1.starstar)) { + if (sawUnary) { + this.unexpected(this.lastTokStart); + } else { + return this.buildBinary(startPos, startLoc, expr, this.parseMaybeUnary(null, false, false, forInit), "**", false); + } } else { return expr; } - }; // Parse call, dot, and `[]`-subscript expressions. + }; + + function isPrivateFieldAccess(node) { + return node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" || node.type === "ChainExpression" && isPrivateFieldAccess(node.expression); + } // Parse call, dot, and `[]`-subscript expressions. - pp$3.parseExprSubscripts = function (refDestructuringErrors) { + pp$5.parseExprSubscripts = function (refDestructuringErrors, forInit) { var startPos = this.start, startLoc = this.startLoc; - var expr = this.parseExprAtom(refDestructuringErrors); + var expr = this.parseExprAtom(refDestructuringErrors, forInit); if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")") { return expr; } - var result = this.parseSubscripts(expr, startPos, startLoc); + var result = this.parseSubscripts(expr, startPos, startLoc, false, forInit); if (refDestructuringErrors && result.type === "MemberExpression") { if (refDestructuringErrors.parenthesizedAssign >= result.start) { @@ -25277,17 +27336,21 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); if (refDestructuringErrors.parenthesizedBind >= result.start) { refDestructuringErrors.parenthesizedBind = -1; } + + if (refDestructuringErrors.trailingComma >= result.start) { + refDestructuringErrors.trailingComma = -1; + } } return result; }; - pp$3.parseSubscripts = function (base, startPos, startLoc, noCalls) { + pp$5.parseSubscripts = function (base, startPos, startLoc, noCalls, forInit) { var maybeAsyncArrow = this.options.ecmaVersion >= 8 && base.type === "Identifier" && base.name === "async" && this.lastTokEnd === base.end && !this.canInsertSemicolon() && base.end - base.start === 5 && this.potentialArrowAt === base.start; var optionalChained = false; while (true) { - var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained); + var element = this.parseSubscript(base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit); if (element.optional) { optionalChained = true; @@ -25307,32 +27370,37 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } }; - pp$3.parseSubscript = function (base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained) { + pp$5.parseSubscript = function (base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) { var optionalSupported = this.options.ecmaVersion >= 11; - var optional = optionalSupported && this.eat(types.questionDot); + var optional = optionalSupported && this.eat(types$1.questionDot); if (noCalls && optional) { this.raise(this.lastTokStart, "Optional chaining cannot appear in the callee of new expressions"); } - var computed = this.eat(types.bracketL); + var computed = this.eat(types$1.bracketL); - if (computed || optional && this.type !== types.parenL && this.type !== types.backQuote || this.eat(types.dot)) { + if (computed || optional && this.type !== types$1.parenL && this.type !== types$1.backQuote || this.eat(types$1.dot)) { var node = this.startNodeAt(startPos, startLoc); node.object = base; - node.property = computed ? this.parseExpression() : this.parseIdent(this.options.allowReserved !== "never"); - node.computed = !!computed; if (computed) { - this.expect(types.bracketR); + node.property = this.parseExpression(); + this.expect(types$1.bracketR); + } else if (this.type === types$1.privateId && base.type !== "Super") { + node.property = this.parsePrivateIdent(); + } else { + node.property = this.parseIdent(this.options.allowReserved !== "never"); } + node.computed = !!computed; + if (optionalSupported) { node.optional = optional; } base = this.finishNode(node, "MemberExpression"); - } else if (!noCalls && this.eat(types.parenL)) { + } else if (!noCalls && this.eat(types$1.parenL)) { var refDestructuringErrors = new DestructuringErrors(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, @@ -25340,9 +27408,9 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); this.yieldPos = 0; this.awaitPos = 0; this.awaitIdentPos = 0; - var exprList = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors); + var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors); - if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types.arrow)) { + if (maybeAsyncArrow && !optional && !this.canInsertSemicolon() && this.eat(types$1.arrow)) { this.checkPatternErrors(refDestructuringErrors, false); this.checkYieldAwaitInDefaultParams(); @@ -25353,7 +27421,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); this.yieldPos = oldYieldPos; this.awaitPos = oldAwaitPos; this.awaitIdentPos = oldAwaitIdentPos; - return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true); + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit); } this.checkExpressionErrors(refDestructuringErrors, true); @@ -25369,7 +27437,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } base = this.finishNode(node$1, "CallExpression"); - } else if (this.type === types.backQuote) { + } else if (this.type === types$1.backQuote) { if (optional || optionalChained) { this.raise(this.start, "Optional chaining cannot appear in the tag of tagged template expressions"); } @@ -25389,10 +27457,10 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // or `{}`. - pp$3.parseExprAtom = function (refDestructuringErrors) { + pp$5.parseExprAtom = function (refDestructuringErrors, forInit) { // If a division operator appears in an expression position, the // tokenizer got confused, and we force it to read a regexp instead. - if (this.type === types.slash) { + if (this.type === types$1.slash) { this.readRegexp(); } @@ -25400,7 +27468,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); canBeArrow = this.potentialArrowAt === this.start; switch (this.type) { - case types._super: + case types$1._super: if (!this.allowSuper) { this.raise(this.start, "'super' keyword outside a method"); } @@ -25408,7 +27476,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); node = this.startNode(); this.next(); - if (this.type === types.parenL && !this.allowDirectSuper) { + if (this.type === types$1.parenL && !this.allowDirectSuper) { this.raise(node.start, "super() call outside constructor of a subclass"); } // The `super` keyword can appear at below: // SuperProperty: @@ -25418,46 +27486,47 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // super ( Arguments ) - if (this.type !== types.dot && this.type !== types.bracketL && this.type !== types.parenL) { + if (this.type !== types$1.dot && this.type !== types$1.bracketL && this.type !== types$1.parenL) { this.unexpected(); } return this.finishNode(node, "Super"); - case types._this: + case types$1._this: node = this.startNode(); this.next(); return this.finishNode(node, "ThisExpression"); - case types.name: + case types$1.name: var startPos = this.start, startLoc = this.startLoc, containsEsc = this.containsEsc; var id = this.parseIdent(false); - if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types._function)) { - return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true); + if (this.options.ecmaVersion >= 8 && !containsEsc && id.name === "async" && !this.canInsertSemicolon() && this.eat(types$1._function)) { + this.overrideContext(types.f_expr); + return this.parseFunction(this.startNodeAt(startPos, startLoc), 0, false, true, forInit); } if (canBeArrow && !this.canInsertSemicolon()) { - if (this.eat(types.arrow)) { - return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false); + if (this.eat(types$1.arrow)) { + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit); } - if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types.name && !containsEsc) { + if (this.options.ecmaVersion >= 8 && id.name === "async" && this.type === types$1.name && !containsEsc && (!this.potentialArrowInForAwait || this.value !== "of" || this.containsEsc)) { id = this.parseIdent(false); - if (this.canInsertSemicolon() || !this.eat(types.arrow)) { + if (this.canInsertSemicolon() || !this.eat(types$1.arrow)) { this.unexpected(); } - return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true); + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit); } } return id; - case types.regexp: + case types$1.regexp: var value = this.value; node = this.parseLiteral(value.value); node.regex = { @@ -25466,22 +27535,22 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; return node; - case types.num: - case types.string: + case types$1.num: + case types$1.string: return this.parseLiteral(this.value); - case types._null: - case types._true: - case types._false: + case types$1._null: + case types$1._true: + case types$1._false: node = this.startNode(); - node.value = this.type === types._null ? null : this.type === types._true; + node.value = this.type === types$1._null ? null : this.type === types$1._true; node.raw = this.type.keyword; this.next(); return this.finishNode(node, "Literal"); - case types.parenL: + case types$1.parenL: var start = this.start, - expr = this.parseParenAndDistinguishExpression(canBeArrow); + expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit); if (refDestructuringErrors) { if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr)) { @@ -25495,30 +27564,31 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return expr; - case types.bracketL: + case types$1.bracketL: node = this.startNode(); this.next(); - node.elements = this.parseExprList(types.bracketR, true, true, refDestructuringErrors); + node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors); return this.finishNode(node, "ArrayExpression"); - case types.braceL: + case types$1.braceL: + this.overrideContext(types.b_expr); return this.parseObj(false, refDestructuringErrors); - case types._function: + case types$1._function: node = this.startNode(); this.next(); return this.parseFunction(node, 0); - case types._class: + case types$1._class: return this.parseClass(this.startNode(), false); - case types._new: + case types$1._new: return this.parseNew(); - case types.backQuote: + case types$1.backQuote: return this.parseTemplate(); - case types._import: + case types$1._import: if (this.options.ecmaVersion >= 11) { return this.parseExprImport(); } else { @@ -25530,7 +27600,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } }; - pp$3.parseExprImport = function () { + pp$5.parseExprImport = function () { var node = this.startNode(); // Consume `import` as an identifier for `import.meta`. // Because `this.parseIdent(true)` doesn't check escape sequences, it needs the check of `this.containsEsc`. @@ -25541,10 +27611,10 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); var meta = this.parseIdent(true); switch (this.type) { - case types.parenL: + case types$1.parenL: return this.parseDynamicImport(node); - case types.dot: + case types$1.dot: node.meta = meta; return this.parseImportMeta(node); @@ -25553,16 +27623,16 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } }; - pp$3.parseDynamicImport = function (node) { + pp$5.parseDynamicImport = function (node) { this.next(); // skip `(` // Parse node.source. node.source = this.parseMaybeAssign(); // Verify ending. - if (!this.eat(types.parenR)) { + if (!this.eat(types$1.parenR)) { var errorPos = this.start; - if (this.eat(types.comma) && this.eat(types.parenR)) { + if (this.eat(types$1.comma) && this.eat(types$1.parenR)) { this.raiseRecoverable(errorPos, "Trailing comma is not allowed in import()"); } else { this.unexpected(errorPos); @@ -25572,7 +27642,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return this.finishNode(node, "ImportExpression"); }; - pp$3.parseImportMeta = function (node) { + pp$5.parseImportMeta = function (node) { this.next(); // skip `.` var containsEsc = this.containsEsc; @@ -25586,14 +27656,14 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters"); } - if (this.options.sourceType !== "module") { + if (this.options.sourceType !== "module" && !this.options.allowImportExportEverywhere) { this.raiseRecoverable(node.start, "Cannot use 'import.meta' outside a module"); } return this.finishNode(node, "MetaProperty"); }; - pp$3.parseLiteral = function (value) { + pp$5.parseLiteral = function (value) { var node = this.startNode(); node.value = value; node.raw = this.input.slice(this.start, this.end); @@ -25606,14 +27676,14 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return this.finishNode(node, "Literal"); }; - pp$3.parseParenExpression = function () { - this.expect(types.parenL); + pp$5.parseParenExpression = function () { + this.expect(types$1.parenL); var val = this.parseExpression(); - this.expect(types.parenR); + this.expect(types$1.parenR); return val; }; - pp$3.parseParenAndDistinguishExpression = function (canBeArrow) { + pp$5.parseParenAndDistinguishExpression = function (canBeArrow, forInit) { var startPos = this.start, startLoc = this.startLoc, val, @@ -25633,17 +27703,17 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); this.yieldPos = 0; this.awaitPos = 0; // Do not save awaitIdentPos to allow checking awaits nested in parameters - while (this.type !== types.parenR) { - first ? first = false : this.expect(types.comma); + while (this.type !== types$1.parenR) { + first ? first = false : this.expect(types$1.comma); - if (allowTrailingComma && this.afterTrailingComma(types.parenR, true)) { + if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) { lastIsComma = true; break; - } else if (this.type === types.ellipsis) { + } else if (this.type === types$1.ellipsis) { spreadStart = this.start; exprList.push(this.parseParenItem(this.parseRestBinding())); - if (this.type === types.comma) { + if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); } @@ -25653,16 +27723,16 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } } - var innerEndPos = this.start, - innerEndLoc = this.startLoc; - this.expect(types.parenR); + var innerEndPos = this.lastTokEnd, + innerEndLoc = this.lastTokEndLoc; + this.expect(types$1.parenR); - if (canBeArrow && !this.canInsertSemicolon() && this.eat(types.arrow)) { + if (canBeArrow && !this.canInsertSemicolon() && this.eat(types$1.arrow)) { this.checkPatternErrors(refDestructuringErrors, false); this.checkYieldAwaitInDefaultParams(); this.yieldPos = oldYieldPos; this.awaitPos = oldAwaitPos; - return this.parseParenArrowList(startPos, startLoc, exprList); + return this.parseParenArrowList(startPos, startLoc, exprList, forInit); } if (!exprList.length || lastIsComma) { @@ -25697,12 +27767,12 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } }; - pp$3.parseParenItem = function (item) { + pp$5.parseParenItem = function (item) { return item; }; - pp$3.parseParenArrowList = function (startPos, startLoc, exprList) { - return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList); + pp$5.parseParenArrowList = function (startPos, startLoc, exprList, forInit) { + return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, false, forInit); }; // New's precedence is slightly tricky. It must allow its argument to // be a `[]` or dot subscript expression, but not a call — at least, // not without wrapping it in parentheses. Thus, it uses the noCalls @@ -25710,9 +27780,9 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // argument list. - var empty$1 = []; + var empty = []; - pp$3.parseNew = function () { + pp$5.parseNew = function () { if (this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword new"); } @@ -25720,7 +27790,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); var node = this.startNode(); var meta = this.parseIdent(true); - if (this.options.ecmaVersion >= 6 && this.eat(types.dot)) { + if (this.options.ecmaVersion >= 6 && this.eat(types$1.dot)) { node.meta = meta; var containsEsc = this.containsEsc; node.property = this.parseIdent(true); @@ -25733,8 +27803,8 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters"); } - if (!this.inNonArrowFunction()) { - this.raiseRecoverable(node.start, "'new.target' can only be used in functions"); + if (!this.allowNewDotTarget) { + this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block"); } return this.finishNode(node, "MetaProperty"); @@ -25742,28 +27812,28 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); var startPos = this.start, startLoc = this.startLoc, - isImport = this.type === types._import; - node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true); + isImport = this.type === types$1._import; + node.callee = this.parseSubscripts(this.parseExprAtom(), startPos, startLoc, true, false); if (isImport && node.callee.type === "ImportExpression") { this.raise(startPos, "Cannot use new with import()"); } - if (this.eat(types.parenL)) { - node.arguments = this.parseExprList(types.parenR, this.options.ecmaVersion >= 8, false); + if (this.eat(types$1.parenL)) { + node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); } else { - node.arguments = empty$1; + node.arguments = empty; } return this.finishNode(node, "NewExpression"); }; // Parse template expression. - pp$3.parseTemplateElement = function (ref) { + pp$5.parseTemplateElement = function (ref) { var isTagged = ref.isTagged; var elem = this.startNode(); - if (this.type === types.invalidTemplate) { + if (this.type === types$1.invalidTemplate) { if (!isTagged) { this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal"); } @@ -25780,11 +27850,11 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } this.next(); - elem.tail = this.type === types.backQuote; + elem.tail = this.type === types$1.backQuote; return this.finishNode(elem, "TemplateElement"); }; - pp$3.parseTemplate = function (ref) { + pp$5.parseTemplate = function (ref) { if (ref === void 0) ref = {}; var isTagged = ref.isTagged; if (isTagged === void 0) isTagged = false; @@ -25797,13 +27867,13 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); node.quasis = [curElt]; while (!curElt.tail) { - if (this.type === types.eof) { + if (this.type === types$1.eof) { this.raise(this.pos, "Unterminated template literal"); } - this.expect(types.dollarBraceL); + this.expect(types$1.dollarBraceL); node.expressions.push(this.parseExpression()); - this.expect(types.braceR); + this.expect(types$1.braceR); node.quasis.push(curElt = this.parseTemplateElement({ isTagged: isTagged })); @@ -25813,23 +27883,23 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return this.finishNode(node, "TemplateLiteral"); }; - pp$3.isAsyncProp = function (prop) { - return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" && (this.type === types.name || this.type === types.num || this.type === types.string || this.type === types.bracketL || this.type.keyword || this.options.ecmaVersion >= 9 && this.type === types.star) && !lineBreak.test(this.input.slice(this.lastTokEnd, this.start)); + pp$5.isAsyncProp = function (prop) { + return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" && (this.type === types$1.name || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword || this.options.ecmaVersion >= 9 && this.type === types$1.star) && !lineBreak.test(this.input.slice(this.lastTokEnd, this.start)); }; // Parse an object literal or binding pattern. - pp$3.parseObj = function (isPattern, refDestructuringErrors) { + pp$5.parseObj = function (isPattern, refDestructuringErrors) { var node = this.startNode(), first = true, propHash = {}; node.properties = []; this.next(); - while (!this.eat(types.braceR)) { + while (!this.eat(types$1.braceR)) { if (!first) { - this.expect(types.comma); + this.expect(types$1.comma); - if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types.braceR)) { + if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) { break; } } else { @@ -25848,18 +27918,18 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression"); }; - pp$3.parseProperty = function (isPattern, refDestructuringErrors) { + pp$5.parseProperty = function (isPattern, refDestructuringErrors) { var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc; - if (this.options.ecmaVersion >= 9 && this.eat(types.ellipsis)) { + if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) { if (isPattern) { prop.argument = this.parseIdent(false); - if (this.type === types.comma) { + if (this.type === types$1.comma) { this.raise(this.start, "Comma is not permitted after the rest element"); } @@ -25867,7 +27937,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } // To disallow parenthesized identifier via `this.toAssignable()`. - if (this.type === types.parenL && refDestructuringErrors) { + if (this.type === types$1.parenL && refDestructuringErrors) { if (refDestructuringErrors.parenthesizedAssign < 0) { refDestructuringErrors.parenthesizedAssign = this.start; } @@ -25880,7 +27950,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); prop.argument = this.parseMaybeAssign(false, refDestructuringErrors); // To disallow trailing comma via `this.toAssignable()`. - if (this.type === types.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) { + if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) { refDestructuringErrors.trailingComma = this.start; } // Finish @@ -25898,7 +27968,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } if (!isPattern) { - isGenerator = this.eat(types.star); + isGenerator = this.eat(types$1.star); } } @@ -25907,7 +27977,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) { isAsync = true; - isGenerator = this.options.ecmaVersion >= 9 && this.eat(types.star); + isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star); this.parsePropertyName(prop, refDestructuringErrors); } else { isAsync = false; @@ -25917,15 +27987,15 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return this.finishNode(prop, "Property"); }; - pp$3.parsePropertyValue = function (prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) { - if ((isGenerator || isAsync) && this.type === types.colon) { + pp$5.parsePropertyValue = function (prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc) { + if ((isGenerator || isAsync) && this.type === types$1.colon) { this.unexpected(); } - if (this.eat(types.colon)) { + if (this.eat(types$1.colon)) { prop.value = isPattern ? this.parseMaybeDefault(this.start, this.startLoc) : this.parseMaybeAssign(false, refDestructuringErrors); prop.kind = "init"; - } else if (this.options.ecmaVersion >= 6 && this.type === types.parenL) { + } else if (this.options.ecmaVersion >= 6 && this.type === types$1.parenL) { if (isPattern) { this.unexpected(); } @@ -25933,7 +28003,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); prop.kind = "init"; prop.method = true; prop.value = this.parseMethod(isGenerator, isAsync); - } else if (!isPattern && !containsEsc && this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && this.type !== types.comma && this.type !== types.braceR && this.type !== types.eq) { + } else if (!isPattern && !containsEsc && this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && this.type !== types$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq) { if (isGenerator || isAsync) { this.unexpected(); } @@ -25970,15 +28040,15 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); prop.kind = "init"; if (isPattern) { - prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key); - } else if (this.type === types.eq && refDestructuringErrors) { + prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key)); + } else if (this.type === types$1.eq && refDestructuringErrors) { if (refDestructuringErrors.shorthandAssign < 0) { refDestructuringErrors.shorthandAssign = this.start; } - prop.value = this.parseMaybeDefault(startPos, startLoc, prop.key); + prop.value = this.parseMaybeDefault(startPos, startLoc, this.copyNode(prop.key)); } else { - prop.value = prop.key; + prop.value = this.copyNode(prop.key); } prop.shorthand = true; @@ -25987,23 +28057,23 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } }; - pp$3.parsePropertyName = function (prop) { + pp$5.parsePropertyName = function (prop) { if (this.options.ecmaVersion >= 6) { - if (this.eat(types.bracketL)) { + if (this.eat(types$1.bracketL)) { prop.computed = true; prop.key = this.parseMaybeAssign(); - this.expect(types.bracketR); + this.expect(types$1.bracketR); return prop.key; } else { prop.computed = false; } } - return prop.key = this.type === types.num || this.type === types.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never"); + return prop.key = this.type === types$1.num || this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never"); }; // Initialize empty function node. - pp$3.initFunction = function (node) { + pp$5.initFunction = function (node) { node.id = null; if (this.options.ecmaVersion >= 6) { @@ -26016,7 +28086,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // Parse object or class method. - pp$3.parseMethod = function (isGenerator, isAsync, allowDirectSuper) { + pp$5.parseMethod = function (isGenerator, isAsync, allowDirectSuper) { var node = this.startNode(), oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, @@ -26035,10 +28105,10 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); this.awaitPos = 0; this.awaitIdentPos = 0; this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0)); - this.expect(types.parenL); - node.params = this.parseBindingList(types.parenR, false, this.options.ecmaVersion >= 8); + this.expect(types$1.parenL); + node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8); this.checkYieldAwaitInDefaultParams(); - this.parseFunctionBody(node, false, true); + this.parseFunctionBody(node, false, true, false); this.yieldPos = oldYieldPos; this.awaitPos = oldAwaitPos; this.awaitIdentPos = oldAwaitIdentPos; @@ -26046,7 +28116,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // Parse arrow function expression with given parameters. - pp$3.parseArrowExpression = function (node, params, isAsync) { + pp$5.parseArrowExpression = function (node, params, isAsync, forInit) { var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos; @@ -26061,7 +28131,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); this.awaitPos = 0; this.awaitIdentPos = 0; node.params = this.toAssignableList(params, true); - this.parseFunctionBody(node, true, false); + this.parseFunctionBody(node, true, false, forInit); this.yieldPos = oldYieldPos; this.awaitPos = oldAwaitPos; this.awaitIdentPos = oldAwaitIdentPos; @@ -26069,13 +28139,13 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // Parse function body and check parameters. - pp$3.parseFunctionBody = function (node, isArrowFunction, isMethod) { - var isExpression = isArrowFunction && this.type !== types.braceL; + pp$5.parseFunctionBody = function (node, isArrowFunction, isMethod, forInit) { + var isExpression = isArrowFunction && this.type !== types$1.braceL; var oldStrict = this.strict, useStrict = false; if (isExpression) { - node.body = this.parseMaybeAssign(); + node.body = this.parseMaybeAssign(forInit); node.expression = true; this.checkParams(node, false); } else { @@ -26105,7 +28175,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod && this.isSimpleParamList(node.params)); // Ensure the function name isn't a forbidden identifier in strict mode, e.g. 'eval' if (this.strict && node.id) { - this.checkLVal(node.id, BIND_OUTSIDE); + this.checkLValSimple(node.id, BIND_OUTSIDE); } node.body = this.parseBlock(false, undefined, useStrict && !oldStrict); @@ -26117,7 +28187,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); this.exitScope(); }; - pp$3.isSimpleParamList = function (params) { + pp$5.isSimpleParamList = function (params) { for (var i = 0, list = params; i < list.length; i += 1) { var param = list[i]; @@ -26131,12 +28201,12 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // or "arguments" and duplicate parameters. - pp$3.checkParams = function (node, allowDuplicates) { - var nameHash = {}; + pp$5.checkParams = function (node, allowDuplicates) { + var nameHash = Object.create(null); for (var i = 0, list = node.params; i < list.length; i += 1) { var param = list[i]; - this.checkLVal(param, BIND_VAR, allowDuplicates ? null : nameHash); + this.checkLValInnerPattern(param, BIND_VAR, allowDuplicates ? null : nameHash); } }; // Parses a comma-separated list of expressions, and returns them as // an array. `close` is the token type that ends the list, and @@ -26145,13 +28215,13 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // for array literals). - pp$3.parseExprList = function (close, allowTrailingComma, allowEmpty, refDestructuringErrors) { + pp$5.parseExprList = function (close, allowTrailingComma, allowEmpty, refDestructuringErrors) { var elts = [], first = true; while (!this.eat(close)) { if (!first) { - this.expect(types.comma); + this.expect(types$1.comma); if (allowTrailingComma && this.afterTrailingComma(close)) { break; @@ -26162,12 +28232,12 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); var elt = void 0; - if (allowEmpty && this.type === types.comma) { + if (allowEmpty && this.type === types$1.comma) { elt = null; - } else if (this.type === types.ellipsis) { + } else if (this.type === types$1.ellipsis) { elt = this.parseSpread(refDestructuringErrors); - if (refDestructuringErrors && this.type === types.comma && refDestructuringErrors.trailingComma < 0) { + if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0) { refDestructuringErrors.trailingComma = this.start; } } else { @@ -26180,7 +28250,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return elts; }; - pp$3.checkUnreserved = function (ref) { + pp$5.checkUnreserved = function (ref) { var start = ref.start; var end = ref.end; var name = ref.name; @@ -26193,6 +28263,14 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); this.raiseRecoverable(start, "Cannot use 'await' as identifier inside an async function"); } + if (this.currentThisScope().inClassFieldInit && name === "arguments") { + this.raiseRecoverable(start, "Cannot use 'arguments' in class field initializer"); + } + + if (this.inClassStaticBlock && (name === "arguments" || name === "await")) { + this.raise(start, "Cannot use " + name + " in class static initialization block"); + } + if (this.keywords.test(name)) { this.raise(start, "Unexpected keyword '" + name + "'"); } @@ -26215,10 +28293,10 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // identifiers. - pp$3.parseIdent = function (liberal, isBinding) { + pp$5.parseIdent = function (liberal, isBinding) { var node = this.startNode(); - if (this.type === types.name) { + if (this.type === types$1.name) { node.name = this.value; } else if (this.type.keyword) { node.name = this.type.keyword; // To fix https://github.com/acornjs/acorn/issues/575 @@ -26244,11 +28322,32 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } } + return node; + }; + + pp$5.parsePrivateIdent = function () { + var node = this.startNode(); + + if (this.type === types$1.privateId) { + node.name = this.value; + } else { + this.unexpected(); + } + + this.next(); + this.finishNode(node, "PrivateIdentifier"); // For validating existence + + if (this.privateNameStack.length === 0) { + this.raise(node.start, "Private field '#" + node.name + "' must be declared in an enclosing class"); + } else { + this.privateNameStack[this.privateNameStack.length - 1].used.push(node); + } + return node; }; // Parses yield expression inside generator. - pp$3.parseYield = function (noIn) { + pp$5.parseYield = function (forInit) { if (!this.yieldPos) { this.yieldPos = this.start; } @@ -26256,25 +28355,25 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); var node = this.startNode(); this.next(); - if (this.type === types.semi || this.canInsertSemicolon() || this.type !== types.star && !this.type.startsExpr) { + if (this.type === types$1.semi || this.canInsertSemicolon() || this.type !== types$1.star && !this.type.startsExpr) { node.delegate = false; node.argument = null; } else { - node.delegate = this.eat(types.star); - node.argument = this.parseMaybeAssign(noIn); + node.delegate = this.eat(types$1.star); + node.argument = this.parseMaybeAssign(forInit); } return this.finishNode(node, "YieldExpression"); }; - pp$3.parseAwait = function () { + pp$5.parseAwait = function (forInit) { if (!this.awaitPos) { this.awaitPos = this.start; } var node = this.startNode(); this.next(); - node.argument = this.parseMaybeUnary(null, false); + node.argument = this.parseMaybeUnary(null, true, false, forInit); return this.finishNode(node, "AwaitExpression"); }; @@ -26302,7 +28401,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } }; - var pp$5 = Parser.prototype; + var pp$3 = Parser.prototype; var Scope = function Scope(flags) { this.flags = flags; // A list of var-declared names in the current lexical scope @@ -26311,26 +28410,28 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); this.lexical = []; // A list of lexically-declared FunctionDeclaration names in the current lexical scope - this.functions = []; + this.functions = []; // A switch to disallow the identifier reference 'arguments' + + this.inClassFieldInit = false; }; // The functions in this module keep track of declared variables in the current scope in order to detect duplicate variable names. - pp$5.enterScope = function (flags) { + pp$3.enterScope = function (flags) { this.scopeStack.push(new Scope(flags)); }; - pp$5.exitScope = function () { + pp$3.exitScope = function () { this.scopeStack.pop(); }; // The spec says: // > At the top level of a function, or script, function declarations are // > treated like var declarations rather than like lexical declarations. - pp$5.treatFunctionsAsVarInScope = function (scope) { + pp$3.treatFunctionsAsVarInScope = function (scope) { return scope.flags & SCOPE_FUNCTION || !this.inModule && scope.flags & SCOPE_TOP; }; - pp$5.declareName = function (name, bindingType, pos) { + pp$3.declareName = function (name, bindingType, pos) { var redeclared = false; if (bindingType === BIND_LEXICAL) { @@ -26380,18 +28481,18 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } }; - pp$5.checkLocalExport = function (id) { + pp$3.checkLocalExport = function (id) { // scope.functions must be empty as Module code is always strict. if (this.scopeStack[0].lexical.indexOf(id.name) === -1 && this.scopeStack[0].var.indexOf(id.name) === -1) { this.undefinedExports[id.name] = id; } }; - pp$5.currentScope = function () { + pp$3.currentScope = function () { return this.scopeStack[this.scopeStack.length - 1]; }; - pp$5.currentVarScope = function () { + pp$3.currentVarScope = function () { for (var i = this.scopeStack.length - 1;; i--) { var scope = this.scopeStack[i]; @@ -26402,7 +28503,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`. - pp$5.currentThisScope = function () { + pp$3.currentThisScope = function () { for (var i = this.scopeStack.length - 1;; i--) { var scope = this.scopeStack[i]; @@ -26431,13 +28532,13 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // Start an AST node, attaching a start offset. - var pp$6 = Parser.prototype; + var pp$2 = Parser.prototype; - pp$6.startNode = function () { + pp$2.startNode = function () { return new Node(this, this.start, this.startLoc); }; - pp$6.startNodeAt = function (pos, loc) { + pp$2.startNodeAt = function (pos, loc) { return new Node(this, pos, loc); }; // Finish an AST node, adding `type` and `end` properties. @@ -26457,181 +28558,23 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return node; } - pp$6.finishNode = function (node, type) { + pp$2.finishNode = function (node, type) { return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc); }; // Finish node at given position - pp$6.finishNodeAt = function (node, type, pos, loc) { + pp$2.finishNodeAt = function (node, type, pos, loc) { return finishNodeAt.call(this, node, type, pos, loc); - }; // The algorithm used to determine whether a regexp can appear at a - - - var TokContext = function TokContext(token, isExpr, preserveSpace, override, generator) { - this.token = token; - this.isExpr = !!isExpr; - this.preserveSpace = !!preserveSpace; - this.override = override; - this.generator = !!generator; }; - var types$1 = { - b_stat: new TokContext("{", false), - b_expr: new TokContext("{", true), - b_tmpl: new TokContext("${", false), - p_stat: new TokContext("(", false), - p_expr: new TokContext("(", true), - q_tmpl: new TokContext("`", true, true, function (p) { - return p.tryReadTemplateToken(); - }), - f_stat: new TokContext("function", false), - f_expr: new TokContext("function", true), - f_expr_gen: new TokContext("function", true, false, null, true), - f_gen: new TokContext("function", false, false, null, true) - }; - var pp$7 = Parser.prototype; + pp$2.copyNode = function (node) { + var newNode = new Node(this, node.start, this.startLoc); - pp$7.initialContext = function () { - return [types$1.b_stat]; - }; - - pp$7.braceIsBlock = function (prevType) { - var parent = this.curContext(); - - if (parent === types$1.f_expr || parent === types$1.f_stat) { - return true; + for (var prop in node) { + newNode[prop] = node[prop]; } - if (prevType === types.colon && (parent === types$1.b_stat || parent === types$1.b_expr)) { - return !parent.isExpr; - } // The check for `tt.name && exprAllowed` detects whether we are - // after a `yield` or `of` construct. See the `updateContext` for - // `tt.name`. - - - if (prevType === types._return || prevType === types.name && this.exprAllowed) { - return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)); - } - - if (prevType === types._else || prevType === types.semi || prevType === types.eof || prevType === types.parenR || prevType === types.arrow) { - return true; - } - - if (prevType === types.braceL) { - return parent === types$1.b_stat; - } - - if (prevType === types._var || prevType === types._const || prevType === types.name) { - return false; - } - - return !this.exprAllowed; - }; - - pp$7.inGeneratorContext = function () { - for (var i = this.context.length - 1; i >= 1; i--) { - var context = this.context[i]; - - if (context.token === "function") { - return context.generator; - } - } - - return false; - }; - - pp$7.updateContext = function (prevType) { - var update, - type = this.type; - - if (type.keyword && prevType === types.dot) { - this.exprAllowed = false; - } else if (update = type.updateContext) { - update.call(this, prevType); - } else { - this.exprAllowed = type.beforeExpr; - } - }; // Token-specific context update code - - - types.parenR.updateContext = types.braceR.updateContext = function () { - if (this.context.length === 1) { - this.exprAllowed = true; - return; - } - - var out = this.context.pop(); - - if (out === types$1.b_stat && this.curContext().token === "function") { - out = this.context.pop(); - } - - this.exprAllowed = !out.isExpr; - }; - - types.braceL.updateContext = function (prevType) { - this.context.push(this.braceIsBlock(prevType) ? types$1.b_stat : types$1.b_expr); - this.exprAllowed = true; - }; - - types.dollarBraceL.updateContext = function () { - this.context.push(types$1.b_tmpl); - this.exprAllowed = true; - }; - - types.parenL.updateContext = function (prevType) { - var statementParens = prevType === types._if || prevType === types._for || prevType === types._with || prevType === types._while; - this.context.push(statementParens ? types$1.p_stat : types$1.p_expr); - this.exprAllowed = true; - }; - - types.incDec.updateContext = function () {// tokExprAllowed stays unchanged - }; - - types._function.updateContext = types._class.updateContext = function (prevType) { - if (prevType.beforeExpr && prevType !== types.semi && prevType !== types._else && !(prevType === types._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) && !((prevType === types.colon || prevType === types.braceL) && this.curContext() === types$1.b_stat)) { - this.context.push(types$1.f_expr); - } else { - this.context.push(types$1.f_stat); - } - - this.exprAllowed = false; - }; - - types.backQuote.updateContext = function () { - if (this.curContext() === types$1.q_tmpl) { - this.context.pop(); - } else { - this.context.push(types$1.q_tmpl); - } - - this.exprAllowed = false; - }; - - types.star.updateContext = function (prevType) { - if (prevType === types._function) { - var index = this.context.length - 1; - - if (this.context[index] === types$1.f_expr) { - this.context[index] = types$1.f_expr_gen; - } else { - this.context[index] = types$1.f_gen; - } - } - - this.exprAllowed = true; - }; - - types.name.updateContext = function (prevType) { - var allowed = false; - - if (this.options.ecmaVersion >= 6 && prevType !== types.dot) { - if (this.value === "of" && !this.exprAllowed || this.value === "yield" && this.inGeneratorContext()) { - allowed = true; - } - } - - this.exprAllowed = allowed; + return newNode; }; // This file contains Unicode properties extracted from the ECMAScript // specification. The lists are extracted like so: // $$('#table-binary-unicode-properties > figure > table > tbody > tr > td:nth-child(1) code').map(el => el.innerText) @@ -26641,10 +28584,12 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); var ecma9BinaryProperties = "ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS"; var ecma10BinaryProperties = ecma9BinaryProperties + " Extended_Pictographic"; var ecma11BinaryProperties = ecma10BinaryProperties; + var ecma12BinaryProperties = ecma11BinaryProperties + " EBase EComp EMod EPres ExtPict"; var unicodeBinaryProperties = { 9: ecma9BinaryProperties, 10: ecma10BinaryProperties, - 11: ecma11BinaryProperties + 11: ecma11BinaryProperties, + 12: ecma12BinaryProperties }; // #table-unicode-general-category-values var unicodeGeneralCategoryValues = "Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu"; // #table-unicode-script-values @@ -26652,10 +28597,12 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); var ecma9ScriptValues = "Adlam Adlm Ahom Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb"; var ecma10ScriptValues = ecma9ScriptValues + " Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd"; var ecma11ScriptValues = ecma10ScriptValues + " Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho"; + var ecma12ScriptValues = ecma11ScriptValues + " Chorasmian Chrs Diak Dives_Akuru Khitan_Small_Script Kits Yezi Yezidi"; var unicodeScriptValues = { 9: ecma9ScriptValues, 10: ecma10ScriptValues, - 11: ecma11ScriptValues + 11: ecma11ScriptValues, + 12: ecma12ScriptValues }; var data = {}; @@ -26676,12 +28623,13 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); buildUnicodeData(9); buildUnicodeData(10); buildUnicodeData(11); - var pp$8 = Parser.prototype; + buildUnicodeData(12); + var pp$1 = Parser.prototype; var RegExpValidationState = function RegExpValidationState(parser) { this.parser = parser; - this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : ""); - this.unicodeProperties = data[parser.options.ecmaVersion >= 11 ? 11 : parser.options.ecmaVersion]; + this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : ""); + this.unicodeProperties = data[parser.options.ecmaVersion >= 12 ? 12 : parser.options.ecmaVersion]; this.source = ""; this.flags = ""; this.start = 0; @@ -26776,7 +28724,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return false; }; - function codePointToString(ch) { + function codePointToString$1(ch) { if (ch <= 0xFFFF) { return String.fromCharCode(ch); } @@ -26792,7 +28740,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); */ - pp$8.validateRegExpFlags = function (state) { + pp$1.validateRegExpFlags = function (state) { var validFlags = state.validFlags; var flags = state.flags; @@ -26816,7 +28764,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); */ - pp$8.validateRegExpPattern = function (state) { + pp$1.validateRegExpPattern = function (state) { this.regexp_pattern(state); // The goal symbol for the parse is |Pattern[~U, ~N]|. If the result of // parsing contains a |GroupName|, reparse with the goal symbol // |Pattern[~U, +N]| and use this result instead. Throw a *SyntaxError* @@ -26830,7 +28778,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern - pp$8.regexp_pattern = function (state) { + pp$1.regexp_pattern = function (state) { state.pos = 0; state.lastIntValue = 0; state.lastStringValue = ""; @@ -26872,7 +28820,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction - pp$8.regexp_disjunction = function (state) { + pp$1.regexp_disjunction = function (state) { this.regexp_alternative(state); while (state.eat(0x7C @@ -26894,12 +28842,12 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative - pp$8.regexp_alternative = function (state) { + pp$1.regexp_alternative = function (state) { while (state.pos < state.source.length && this.regexp_eatTerm(state)) {} }; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Term - pp$8.regexp_eatTerm = function (state) { + pp$1.regexp_eatTerm = function (state) { if (this.regexp_eatAssertion(state)) { // Handle `QuantifiableAssertion Quantifier` alternative. // `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion @@ -26923,7 +28871,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion - pp$8.regexp_eatAssertion = function (state) { + pp$1.regexp_eatAssertion = function (state) { var start = state.pos; state.lastAssertionIsQuantifiable = false; // ^, $ @@ -26987,7 +28935,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier - pp$8.regexp_eatQuantifier = function (state, noError) { + pp$1.regexp_eatQuantifier = function (state, noError) { if (noError === void 0) noError = false; if (this.regexp_eatQuantifierPrefix(state, noError)) { @@ -27001,7 +28949,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix - pp$8.regexp_eatQuantifierPrefix = function (state, noError) { + pp$1.regexp_eatQuantifierPrefix = function (state, noError) { return state.eat(0x2A /* * */ ) || state.eat(0x2B @@ -27011,7 +28959,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); ) || this.regexp_eatBracedQuantifier(state, noError); }; - pp$8.regexp_eatBracedQuantifier = function (state, noError) { + pp$1.regexp_eatBracedQuantifier = function (state, noError) { var start = state.pos; if (state.eat(0x7B @@ -27052,13 +29000,13 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // https://www.ecma-international.org/ecma-262/8.0/#prod-Atom - pp$8.regexp_eatAtom = function (state) { + pp$1.regexp_eatAtom = function (state) { return this.regexp_eatPatternCharacters(state) || state.eat(0x2E /* . */ ) || this.regexp_eatReverseSolidusAtomEscape(state) || this.regexp_eatCharacterClass(state) || this.regexp_eatUncapturingGroup(state) || this.regexp_eatCapturingGroup(state); }; - pp$8.regexp_eatReverseSolidusAtomEscape = function (state) { + pp$1.regexp_eatReverseSolidusAtomEscape = function (state) { var start = state.pos; if (state.eat(0x5C @@ -27074,7 +29022,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return false; }; - pp$8.regexp_eatUncapturingGroup = function (state) { + pp$1.regexp_eatUncapturingGroup = function (state) { var start = state.pos; if (state.eat(0x28 @@ -27102,7 +29050,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return false; }; - pp$8.regexp_eatCapturingGroup = function (state) { + pp$1.regexp_eatCapturingGroup = function (state) { if (state.eat(0x28 /* ( */ )) { @@ -27130,14 +29078,14 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom - pp$8.regexp_eatExtendedAtom = function (state) { + pp$1.regexp_eatExtendedAtom = function (state) { return state.eat(0x2E /* . */ ) || this.regexp_eatReverseSolidusAtomEscape(state) || this.regexp_eatCharacterClass(state) || this.regexp_eatUncapturingGroup(state) || this.regexp_eatCapturingGroup(state) || this.regexp_eatInvalidBracedQuantifier(state) || this.regexp_eatExtendedPatternCharacter(state); }; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-InvalidBracedQuantifier - pp$8.regexp_eatInvalidBracedQuantifier = function (state) { + pp$1.regexp_eatInvalidBracedQuantifier = function (state) { if (this.regexp_eatBracedQuantifier(state, true)) { state.raise("Nothing to repeat"); } @@ -27146,7 +29094,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter - pp$8.regexp_eatSyntaxCharacter = function (state) { + pp$1.regexp_eatSyntaxCharacter = function (state) { var ch = state.current(); if (isSyntaxCharacter(ch)) { @@ -27182,7 +29130,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // But eat eager. - pp$8.regexp_eatPatternCharacters = function (state) { + pp$1.regexp_eatPatternCharacters = function (state) { var start = state.pos; var ch = 0; @@ -27194,7 +29142,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter - pp$8.regexp_eatExtendedPatternCharacter = function (state) { + pp$1.regexp_eatExtendedPatternCharacter = function (state) { var ch = state.current(); if (ch !== -1 && ch !== 0x24 @@ -27224,7 +29172,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // `?` GroupName - pp$8.regexp_groupSpecifier = function (state) { + pp$1.regexp_groupSpecifier = function (state) { if (state.eat(0x3F /* ? */ )) { @@ -27244,7 +29192,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // Note: this updates `state.lastStringValue` property with the eaten name. - pp$8.regexp_eatGroupName = function (state) { + pp$1.regexp_eatGroupName = function (state) { state.lastStringValue = ""; if (state.eat(0x3C @@ -27266,14 +29214,14 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // Note: this updates `state.lastStringValue` property with the eaten name. - pp$8.regexp_eatRegExpIdentifierName = function (state) { + pp$1.regexp_eatRegExpIdentifierName = function (state) { state.lastStringValue = ""; if (this.regexp_eatRegExpIdentifierStart(state)) { - state.lastStringValue += codePointToString(state.lastIntValue); + state.lastStringValue += codePointToString$1(state.lastIntValue); while (this.regexp_eatRegExpIdentifierPart(state)) { - state.lastStringValue += codePointToString(state.lastIntValue); + state.lastStringValue += codePointToString$1(state.lastIntValue); } return true; @@ -27287,7 +29235,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // `\` RegExpUnicodeEscapeSequence[+U] - pp$8.regexp_eatRegExpIdentifierStart = function (state) { + pp$1.regexp_eatRegExpIdentifierStart = function (state) { var start = state.pos; var forceU = this.options.ecmaVersion >= 11; var ch = state.current(forceU); @@ -27322,7 +29270,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // - pp$8.regexp_eatRegExpIdentifierPart = function (state) { + pp$1.regexp_eatRegExpIdentifierPart = function (state) { var start = state.pos; var forceU = this.options.ecmaVersion >= 11; var ch = state.current(forceU); @@ -27355,7 +29303,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape - pp$8.regexp_eatAtomEscape = function (state) { + pp$1.regexp_eatAtomEscape = function (state) { if (this.regexp_eatBackReference(state) || this.regexp_eatCharacterClassEscape(state) || this.regexp_eatCharacterEscape(state) || state.switchN && this.regexp_eatKGroupName(state)) { return true; } @@ -27374,7 +29322,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return false; }; - pp$8.regexp_eatBackReference = function (state) { + pp$1.regexp_eatBackReference = function (state) { var start = state.pos; if (this.regexp_eatDecimalEscape(state)) { @@ -27399,7 +29347,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return false; }; - pp$8.regexp_eatKGroupName = function (state) { + pp$1.regexp_eatKGroupName = function (state) { if (state.eat(0x6B /* k */ )) { @@ -27415,11 +29363,11 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape - pp$8.regexp_eatCharacterEscape = function (state) { + pp$1.regexp_eatCharacterEscape = function (state) { return this.regexp_eatControlEscape(state) || this.regexp_eatCControlLetter(state) || this.regexp_eatZero(state) || this.regexp_eatHexEscapeSequence(state) || this.regexp_eatRegExpUnicodeEscapeSequence(state, false) || !state.switchU && this.regexp_eatLegacyOctalEscapeSequence(state) || this.regexp_eatIdentityEscape(state); }; - pp$8.regexp_eatCControlLetter = function (state) { + pp$1.regexp_eatCControlLetter = function (state) { var start = state.pos; if (state.eat(0x63 @@ -27435,7 +29383,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return false; }; - pp$8.regexp_eatZero = function (state) { + pp$1.regexp_eatZero = function (state) { if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) { @@ -27448,7 +29396,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape - pp$8.regexp_eatControlEscape = function (state) { + pp$1.regexp_eatControlEscape = function (state) { var ch = state.current(); if (ch === 0x74 @@ -27505,7 +29453,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter - pp$8.regexp_eatControlLetter = function (state) { + pp$1.regexp_eatControlLetter = function (state) { var ch = state.current(); if (isControlLetter(ch)) { @@ -27530,7 +29478,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } // https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence - pp$8.regexp_eatRegExpUnicodeEscapeSequence = function (state, forceU) { + pp$1.regexp_eatRegExpUnicodeEscapeSequence = function (state, forceU) { if (forceU === void 0) forceU = false; var start = state.pos; var switchU = forceU || state.switchU; @@ -27587,7 +29535,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape - pp$8.regexp_eatIdentityEscape = function (state) { + pp$1.regexp_eatIdentityEscape = function (state) { if (state.switchU) { if (this.regexp_eatSyntaxCharacter(state)) { return true; @@ -27621,7 +29569,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape - pp$8.regexp_eatDecimalEscape = function (state) { + pp$1.regexp_eatDecimalEscape = function (state) { state.lastIntValue = 0; var ch = state.current(); @@ -27648,7 +29596,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape - pp$8.regexp_eatCharacterClassEscape = function (state) { + pp$1.regexp_eatCharacterClassEscape = function (state) { var ch = state.current(); if (isCharacterClassEscape(ch)) { @@ -27698,7 +29646,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // LoneUnicodePropertyNameOrValue - pp$8.regexp_eatUnicodePropertyValueExpression = function (state) { + pp$1.regexp_eatUnicodePropertyValueExpression = function (state) { var start = state.pos; // UnicodePropertyName `=` UnicodePropertyValue if (this.regexp_eatUnicodePropertyName(state) && state.eat(0x3D @@ -27724,7 +29672,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return false; }; - pp$8.regexp_validateUnicodePropertyNameAndValue = function (state, name, value) { + pp$1.regexp_validateUnicodePropertyNameAndValue = function (state, name, value) { if (!has(state.unicodeProperties.nonBinary, name)) { state.raise("Invalid property name"); } @@ -27734,7 +29682,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } }; - pp$8.regexp_validateUnicodePropertyNameOrValue = function (state, nameOrValue) { + pp$1.regexp_validateUnicodePropertyNameOrValue = function (state, nameOrValue) { if (!state.unicodeProperties.binary.test(nameOrValue)) { state.raise("Invalid property name"); } @@ -27742,12 +29690,12 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // UnicodePropertyNameCharacters - pp$8.regexp_eatUnicodePropertyName = function (state) { + pp$1.regexp_eatUnicodePropertyName = function (state) { var ch = 0; state.lastStringValue = ""; while (isUnicodePropertyNameCharacter(ch = state.current())) { - state.lastStringValue += codePointToString(ch); + state.lastStringValue += codePointToString$1(ch); state.advance(); } @@ -27761,12 +29709,12 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // UnicodePropertyValueCharacters - pp$8.regexp_eatUnicodePropertyValue = function (state) { + pp$1.regexp_eatUnicodePropertyValue = function (state) { var ch = 0; state.lastStringValue = ""; while (isUnicodePropertyValueCharacter(ch = state.current())) { - state.lastStringValue += codePointToString(ch); + state.lastStringValue += codePointToString$1(ch); state.advance(); } @@ -27779,12 +29727,12 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // UnicodePropertyValueCharacters - pp$8.regexp_eatLoneUnicodePropertyNameOrValue = function (state) { + pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function (state) { return this.regexp_eatUnicodePropertyValue(state); }; // https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass - pp$8.regexp_eatCharacterClass = function (state) { + pp$1.regexp_eatCharacterClass = function (state) { if (state.eat(0x5B /* [ */ )) { @@ -27809,7 +29757,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash - pp$8.regexp_classRanges = function (state) { + pp$1.regexp_classRanges = function (state) { while (this.regexp_eatClassAtom(state)) { var left = state.lastIntValue; @@ -27831,7 +29779,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash - pp$8.regexp_eatClassAtom = function (state) { + pp$1.regexp_eatClassAtom = function (state) { var start = state.pos; if (state.eat(0x5C @@ -27871,7 +29819,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape - pp$8.regexp_eatClassEscape = function (state) { + pp$1.regexp_eatClassEscape = function (state) { var start = state.pos; if (state.eat(0x62 @@ -27906,7 +29854,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter - pp$8.regexp_eatClassControlLetter = function (state) { + pp$1.regexp_eatClassControlLetter = function (state) { var ch = state.current(); if (isDecimalDigit(ch) || ch === 0x5F @@ -27921,7 +29869,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence - pp$8.regexp_eatHexEscapeSequence = function (state) { + pp$1.regexp_eatHexEscapeSequence = function (state) { var start = state.pos; if (state.eat(0x78 @@ -27942,7 +29890,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits - pp$8.regexp_eatDecimalDigits = function (state) { + pp$1.regexp_eatDecimalDigits = function (state) { var start = state.pos; var ch = 0; state.lastIntValue = 0; @@ -27965,7 +29913,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } // https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits - pp$8.regexp_eatHexDigits = function (state) { + pp$1.regexp_eatHexDigits = function (state) { var start = state.pos; var ch = 0; state.lastIntValue = 0; @@ -28021,7 +29969,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // Allows only 0-377(octal) i.e. 0-255(decimal). - pp$8.regexp_eatLegacyOctalEscapeSequence = function (state) { + pp$1.regexp_eatLegacyOctalEscapeSequence = function (state) { if (this.regexp_eatOctalDigit(state)) { var n1 = state.lastIntValue; @@ -28044,7 +29992,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit - pp$8.regexp_eatOctalDigit = function (state) { + pp$1.regexp_eatOctalDigit = function (state) { var ch = state.current(); if (isOctalDigit(ch)) { @@ -28069,7 +30017,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence - pp$8.regexp_eatFixedHexDigits = function (state, length) { + pp$1.regexp_eatFixedHexDigits = function (state, length) { var start = state.pos; state.lastIntValue = 0; @@ -28107,9 +30055,9 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // ## Tokenizer - var pp$9 = Parser.prototype; // Move to the next token + var pp = Parser.prototype; // Move to the next token - pp$9.next = function (ignoreEscapeSequenceInKeyword) { + pp.next = function (ignoreEscapeSequenceInKeyword) { if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc) { this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword); } @@ -28125,20 +30073,20 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); this.nextToken(); }; - pp$9.getToken = function () { + pp.getToken = function () { this.next(); return new Token(this); }; // If we're in an ES6 environment, make parsers iterable if (typeof Symbol !== "undefined") { - pp$9[Symbol.iterator] = function () { - var this$1 = this; + pp[Symbol.iterator] = function () { + var this$1$1 = this; return { next: function () { - var token = this$1.getToken(); + var token = this$1$1.getToken(); return { - done: token.type === types.eof, + done: token.type === types$1.eof, value: token }; } @@ -28146,15 +30094,11 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; } // Toggle strict mode. Re-reads the next number or string to please // pedantic tests (`"use strict"; 010;` should fail). - - - pp$9.curContext = function () { - return this.context[this.context.length - 1]; - }; // Read a single token, updating the parser object's token-related + // Read a single token, updating the parser object's token-related // properties. - pp$9.nextToken = function () { + pp.nextToken = function () { var curContext = this.curContext(); if (!curContext || !curContext.preserveSpace) { @@ -28168,7 +30112,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } if (this.pos >= this.input.length) { - return this.finishToken(types.eof); + return this.finishToken(types$1.eof); } if (curContext.override) { @@ -28178,7 +30122,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } }; - pp$9.readToken = function (code) { + pp.readToken = function (code) { // Identifier or keyword. '\uXXXX' sequences are allowed in // identifiers, so '\' also dispatches to that. if (isIdentifierStart(code, this.options.ecmaVersion >= 6) || code === 92 @@ -28190,18 +30134,18 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return this.getTokenFromCode(code); }; - pp$9.fullCharCodeAtPos = function () { + pp.fullCharCodeAtPos = function () { var code = this.input.charCodeAt(this.pos); - if (code <= 0xd7ff || code >= 0xe000) { + if (code <= 0xd7ff || code >= 0xdc00) { return code; } var next = this.input.charCodeAt(this.pos + 1); - return (code << 10) + next - 0x35fdc00; + return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00; }; - pp$9.skipBlockComment = function () { + pp.skipBlockComment = function () { var startLoc = this.options.onComment && this.curPosition(); var start = this.pos, end = this.input.indexOf("*/", this.pos += 2); @@ -28227,7 +30171,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } }; - pp$9.skipLineComment = function (startSkip) { + pp.skipLineComment = function (startSkip) { var start = this.pos; var startLoc = this.options.onComment && this.curPosition(); var ch = this.input.charCodeAt(this.pos += startSkip); @@ -28243,7 +30187,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // whitespace and comments, and. - pp$9.skipSpace = function () { + pp.skipSpace = function () { loop: while (this.pos < this.input.length) { var ch = this.input.charCodeAt(this.pos); @@ -28304,7 +30248,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // right position. - pp$9.finishToken = function (type, val) { + pp.finishToken = function (type, val) { this.end = this.pos; if (this.options.locations) { @@ -28325,7 +30269,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // - pp$9.readToken_dot = function () { + pp.readToken_dot = function () { var next = this.input.charCodeAt(this.pos + 1); if (next >= 48 && next <= 57) { @@ -28337,14 +30281,14 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) { // 46 = dot '.' this.pos += 3; - return this.finishToken(types.ellipsis); + return this.finishToken(types$1.ellipsis); } else { ++this.pos; - return this.finishToken(types.dot); + return this.finishToken(types$1.dot); } }; - pp$9.readToken_slash = function () { + pp.readToken_slash = function () { // '/' var next = this.input.charCodeAt(this.pos + 1); @@ -28354,32 +30298,32 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } if (next === 61) { - return this.finishOp(types.assign, 2); + return this.finishOp(types$1.assign, 2); } - return this.finishOp(types.slash, 1); + return this.finishOp(types$1.slash, 1); }; - pp$9.readToken_mult_modulo_exp = function (code) { + pp.readToken_mult_modulo_exp = function (code) { // '%*' var next = this.input.charCodeAt(this.pos + 1); var size = 1; - var tokentype = code === 42 ? types.star : types.modulo; // exponentiation operator ** and **= + var tokentype = code === 42 ? types$1.star : types$1.modulo; // exponentiation operator ** and **= if (this.options.ecmaVersion >= 7 && code === 42 && next === 42) { ++size; - tokentype = types.starstar; + tokentype = types$1.starstar; next = this.input.charCodeAt(this.pos + 2); } if (next === 61) { - return this.finishOp(types.assign, size + 1); + return this.finishOp(types$1.assign, size + 1); } return this.finishOp(tokentype, size); }; - pp$9.readToken_pipe_amp = function (code) { + pp.readToken_pipe_amp = function (code) { // '|&' var next = this.input.charCodeAt(this.pos + 1); @@ -28388,32 +30332,32 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); var next2 = this.input.charCodeAt(this.pos + 2); if (next2 === 61) { - return this.finishOp(types.assign, 3); + return this.finishOp(types$1.assign, 3); } } - return this.finishOp(code === 124 ? types.logicalOR : types.logicalAND, 2); + return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2); } if (next === 61) { - return this.finishOp(types.assign, 2); + return this.finishOp(types$1.assign, 2); } - return this.finishOp(code === 124 ? types.bitwiseOR : types.bitwiseAND, 1); + return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1); }; - pp$9.readToken_caret = function () { + pp.readToken_caret = function () { // '^' var next = this.input.charCodeAt(this.pos + 1); if (next === 61) { - return this.finishOp(types.assign, 2); + return this.finishOp(types$1.assign, 2); } - return this.finishOp(types.bitwiseXOR, 1); + return this.finishOp(types$1.bitwiseXOR, 1); }; - pp$9.readToken_plus_min = function (code) { + pp.readToken_plus_min = function (code) { // '+-' var next = this.input.charCodeAt(this.pos + 1); @@ -28425,17 +30369,17 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return this.nextToken(); } - return this.finishOp(types.incDec, 2); + return this.finishOp(types$1.incDec, 2); } if (next === 61) { - return this.finishOp(types.assign, 2); + return this.finishOp(types$1.assign, 2); } - return this.finishOp(types.plusMin, 1); + return this.finishOp(types$1.plusMin, 1); }; - pp$9.readToken_lt_gt = function (code) { + pp.readToken_lt_gt = function (code) { // '<>' var next = this.input.charCodeAt(this.pos + 1); var size = 1; @@ -28444,10 +30388,10 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2; if (this.input.charCodeAt(this.pos + size) === 61) { - return this.finishOp(types.assign, size + 1); + return this.finishOp(types$1.assign, size + 1); } - return this.finishOp(types.bitShift, size); + return this.finishOp(types$1.bitShift, size); } if (next === 33 && code === 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 45 && this.input.charCodeAt(this.pos + 3) === 45) { @@ -28461,27 +30405,27 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); size = 2; } - return this.finishOp(types.relational, size); + return this.finishOp(types$1.relational, size); }; - pp$9.readToken_eq_excl = function (code) { + pp.readToken_eq_excl = function (code) { // '=!' var next = this.input.charCodeAt(this.pos + 1); if (next === 61) { - return this.finishOp(types.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2); + return this.finishOp(types$1.equality, this.input.charCodeAt(this.pos + 2) === 61 ? 3 : 2); } if (code === 61 && next === 62 && this.options.ecmaVersion >= 6) { // '=>' this.pos += 2; - return this.finishToken(types.arrow); + return this.finishToken(types$1.arrow); } - return this.finishOp(code === 61 ? types.eq : types.prefix, 1); + return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1); }; - pp$9.readToken_question = function () { + pp.readToken_question = function () { // '?' var ecmaVersion = this.options.ecmaVersion; @@ -28492,7 +30436,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); var next2 = this.input.charCodeAt(this.pos + 2); if (next2 < 48 || next2 > 57) { - return this.finishOp(types.questionDot, 2); + return this.finishOp(types$1.questionDot, 2); } } @@ -28501,18 +30445,37 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); var next2$1 = this.input.charCodeAt(this.pos + 2); if (next2$1 === 61) { - return this.finishOp(types.assign, 3); + return this.finishOp(types$1.assign, 3); } } - return this.finishOp(types.coalesce, 2); + return this.finishOp(types$1.coalesce, 2); } } - return this.finishOp(types.question, 1); + return this.finishOp(types$1.question, 1); }; - pp$9.getTokenFromCode = function (code) { + pp.readToken_numberSign = function () { + // '#' + var ecmaVersion = this.options.ecmaVersion; + var code = 35; // '#' + + if (ecmaVersion >= 13) { + ++this.pos; + code = this.fullCharCodeAtPos(); + + if (isIdentifierStart(code, true) || code === 92 + /* '\' */ + ) { + return this.finishToken(types$1.privateId, this.readWord1()); + } + } + + this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'"); + }; + + pp.getTokenFromCode = function (code) { switch (code) { // The interpretation of a dot depends on whether it is followed // by a digit or another two dots. @@ -28523,39 +30486,39 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); case 40: ++this.pos; - return this.finishToken(types.parenL); + return this.finishToken(types$1.parenL); case 41: ++this.pos; - return this.finishToken(types.parenR); + return this.finishToken(types$1.parenR); case 59: ++this.pos; - return this.finishToken(types.semi); + return this.finishToken(types$1.semi); case 44: ++this.pos; - return this.finishToken(types.comma); + return this.finishToken(types$1.comma); case 91: ++this.pos; - return this.finishToken(types.bracketL); + return this.finishToken(types$1.bracketL); case 93: ++this.pos; - return this.finishToken(types.bracketR); + return this.finishToken(types$1.bracketR); case 123: ++this.pos; - return this.finishToken(types.braceL); + return this.finishToken(types$1.braceL); case 125: ++this.pos; - return this.finishToken(types.braceR); + return this.finishToken(types$1.braceR); case 58: ++this.pos; - return this.finishToken(types.colon); + return this.finishToken(types$1.colon); case 96: // '`' @@ -28564,7 +30527,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } ++this.pos; - return this.finishToken(types.backQuote); + return this.finishToken(types$1.backQuote); case 48: // '0' @@ -28651,19 +30614,23 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); case 126: // '~' - return this.finishOp(types.prefix, 1); + return this.finishOp(types$1.prefix, 1); + + case 35: + // '#' + return this.readToken_numberSign(); } - this.raise(this.pos, "Unexpected character '" + codePointToString$1(code) + "'"); + this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'"); }; - pp$9.finishOp = function (type, size) { + pp.finishOp = function (type, size) { var str = this.input.slice(this.pos, this.pos + size); this.pos += size; return this.finishToken(type, str); }; - pp$9.readRegexp = function () { + pp.readRegexp = function () { var escaped, inClass, start = this.pos; @@ -28719,7 +30686,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral } - return this.finishToken(types.regexp, { + return this.finishToken(types$1.regexp, { pattern: pattern, flags: flags, value: value @@ -28729,7 +30696,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // will return `null` unless the integer has exactly `len` digits. - pp$9.readInt = function (radix, len, maybeLegacyOctalNumericLiteral) { + pp.readInt = function (radix, len, maybeLegacyOctalNumericLiteral) { // `len` is used for character escape sequences. In that case, disallow separators. var allowSeparators = this.options.ecmaVersion >= 12 && len === undefined; // `maybeLegacyOctalNumericLiteral` is true if it doesn't have prefix (0x,0o,0b) // and isn't fraction part nor exponent part. In that case, if the first digit @@ -28811,7 +30778,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return BigInt(str.replace(/_/g, "")); } - pp$9.readRadixNumber = function (radix) { + pp.readRadixNumber = function (radix) { var start = this.pos; this.pos += 2; // 0x @@ -28828,11 +30795,11 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); this.raise(this.pos, "Identifier directly after number"); } - return this.finishToken(types.num, val); + return this.finishToken(types$1.num, val); }; // Read an integer, octal integer, or floating-point number. - pp$9.readNumber = function (startsWithDot) { + pp.readNumber = function (startsWithDot) { var start = this.pos; if (!startsWithDot && this.readInt(10, undefined, true) === null) { @@ -28855,7 +30822,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); this.raise(this.pos, "Identifier directly after number"); } - return this.finishToken(types.num, val$1); + return this.finishToken(types$1.num, val$1); } if (octal && /[89]/.test(this.input.slice(start, this.pos))) { @@ -28888,11 +30855,11 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } var val = stringToNumber(this.input.slice(start, this.pos), octal); - return this.finishToken(types.num, val); + return this.finishToken(types$1.num, val); }; // Read a string value, interpreting backslash-escapes. - pp$9.readCodePoint = function () { + pp.readCodePoint = function () { var ch = this.input.charCodeAt(this.pos), code; @@ -28916,7 +30883,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return code; }; - function codePointToString$1(code) { + function codePointToString(code) { // UTF-16 Decoding if (code <= 0xFFFF) { return String.fromCharCode(code); @@ -28926,7 +30893,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00); } - pp$9.readString = function (quote) { + pp.readString = function (quote) { var out = "", chunkStart = ++this.pos; @@ -28946,8 +30913,19 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); out += this.input.slice(chunkStart, this.pos); out += this.readEscapedChar(false); chunkStart = this.pos; + } else if (ch === 0x2028 || ch === 0x2029) { + if (this.options.ecmaVersion < 10) { + this.raise(this.start, "Unterminated string constant"); + } + + ++this.pos; + + if (this.options.locations) { + this.curLine++; + this.lineStart = this.pos; + } } else { - if (isNewLine(ch, this.options.ecmaVersion >= 10)) { + if (isNewLine(ch)) { this.raise(this.start, "Unterminated string constant"); } @@ -28956,13 +30934,13 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } out += this.input.slice(chunkStart, this.pos++); - return this.finishToken(types.string, out); + return this.finishToken(types$1.string, out); }; // Reads template string tokens. var INVALID_TEMPLATE_ESCAPE_ERROR = {}; - pp$9.tryReadTemplateToken = function () { + pp.tryReadTemplateToken = function () { this.inTemplateElement = true; try { @@ -28978,7 +30956,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); this.inTemplateElement = false; }; - pp$9.invalidStringToken = function (position, message) { + pp.invalidStringToken = function (position, message) { if (this.inTemplateElement && this.options.ecmaVersion >= 9) { throw INVALID_TEMPLATE_ESCAPE_ERROR; } else { @@ -28986,7 +30964,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); } }; - pp$9.readTmplToken = function () { + pp.readTmplToken = function () { var out = "", chunkStart = this.pos; @@ -28999,18 +30977,18 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) { // '`', '${' - if (this.pos === this.start && (this.type === types.template || this.type === types.invalidTemplate)) { + if (this.pos === this.start && (this.type === types$1.template || this.type === types$1.invalidTemplate)) { if (ch === 36) { this.pos += 2; - return this.finishToken(types.dollarBraceL); + return this.finishToken(types$1.dollarBraceL); } else { ++this.pos; - return this.finishToken(types.backQuote); + return this.finishToken(types$1.backQuote); } } out += this.input.slice(chunkStart, this.pos); - return this.finishToken(types.template, out); + return this.finishToken(types$1.template, out); } if (ch === 92) { @@ -29050,7 +31028,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // Reads a template token to search for the end, without validating any escape sequences - pp$9.readInvalidTemplateToken = function () { + pp.readInvalidTemplateToken = function () { for (; this.pos < this.input.length; this.pos++) { switch (this.input[this.pos]) { case "\\": @@ -29065,7 +31043,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // falls through case "`": - return this.finishToken(types.invalidTemplate, this.input.slice(this.start, this.pos)); + return this.finishToken(types$1.invalidTemplate, this.input.slice(this.start, this.pos)); // no default } } @@ -29074,7 +31052,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // Used to read escaped characters - pp$9.readEscapedChar = function (inTemplate) { + pp.readEscapedChar = function (inTemplate) { var ch = this.input.charCodeAt(++this.pos); ++this.pos; @@ -29092,7 +31070,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // 'x' case 117: - return codePointToString$1(this.readCodePoint()); + return codePointToString(this.readCodePoint()); // 'u' case 116: @@ -29129,6 +31107,10 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); case 56: case 57: + if (this.strict) { + this.invalidStringToken(this.pos - 1, "Invalid escape sequence"); + } + if (inTemplate) { var codePos = this.pos - 1; this.invalidStringToken(codePos, "Invalid escape sequence in template string"); @@ -29166,7 +31148,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }; // Used to read character escape sequences ('\x', '\u', '\U'). - pp$9.readHexChar = function (len) { + pp.readHexChar = function (len) { var codePos = this.pos; var n = this.readInt(16, len); @@ -29182,7 +31164,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // as a micro-optimization. - pp$9.readWord1 = function () { + pp.readWord1 = function () { this.containsEsc = false; var word = "", first = true, @@ -29212,7 +31194,7 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); this.invalidStringToken(escStart, "Invalid Unicode escape"); } - word += codePointToString$1(esc); + word += codePointToString(esc); chunkStart = this.pos; } else { break; @@ -29226,19 +31208,19 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); // words when necessary. - pp$9.readWord = function () { + pp.readWord = function () { var word = this.readWord1(); - var type = types.name; + var type = types$1.name; if (this.keywords.test(word)) { - type = keywords$1[word]; + type = keywords[word]; } return this.finishToken(type, word); }; // Acorn is a tiny, fast JavaScript parser written in JavaScript. - var version = "7.4.1"; + var version = "8.6.0"; Parser.acorn = { Parser: Parser, version: version, @@ -29248,10 +31230,10 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); getLineInfo: getLineInfo, Node: Node, TokenType: TokenType, - tokTypes: types, - keywordTypes: keywords$1, + tokTypes: types$1, + keywordTypes: keywords, TokContext: TokContext, - tokContexts: types$1, + tokContexts: types, isIdentifierChar: isIdentifierChar, isIdentifierStart: isIdentifierStart, Token: Token, @@ -29295,14 +31277,14 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); exports.isIdentifierChar = isIdentifierChar; exports.isIdentifierStart = isIdentifierStart; exports.isNewLine = isNewLine; - exports.keywordTypes = keywords$1; + exports.keywordTypes = keywords; exports.lineBreak = lineBreak; exports.lineBreakG = lineBreakG; exports.nonASCIIwhitespace = nonASCIIwhitespace; exports.parse = parse; exports.parseExpressionAt = parseExpressionAt; - exports.tokContexts = types$1; - exports.tokTypes = types; + exports.tokContexts = types; + exports.tokTypes = types$1; exports.tokenizer = tokenizer; exports.version = version; Object.defineProperty(exports, '__esModule', { @@ -29311,13 +31293,107 @@ exports.supportedEcmaVersions = getSupportedEcmaVersions(); }); /***/ }), -/* 425 */ +/* 438 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { + +/*global window, global*/ +var util = __webpack_require__(439); + +var assert = __webpack_require__(431); + +function now() { + return new Date().getTime(); +} + +var slice = Array.prototype.slice; +var console; +var times = {}; + +if (typeof global !== "undefined" && global.console) { + console = global.console; +} else if (typeof window !== "undefined" && window.console) { + console = window.console; +} else { + console = {}; +} + +var functions = [[log, "log"], [info, "info"], [warn, "warn"], [error, "error"], [time, "time"], [timeEnd, "timeEnd"], [trace, "trace"], [dir, "dir"], [consoleAssert, "assert"]]; + +for (var i = 0; i < functions.length; i++) { + var tuple = functions[i]; + var f = tuple[0]; + var name = tuple[1]; + + if (!console[name]) { + console[name] = f; + } +} + +module.exports = console; + +function log() {} + +function info() { + console.log.apply(console, arguments); +} + +function warn() { + console.log.apply(console, arguments); +} + +function error() { + console.warn.apply(console, arguments); +} + +function time(label) { + times[label] = now(); +} + +function timeEnd(label) { + var time = times[label]; + + if (!time) { + throw new Error("No such label: " + label); + } + + delete times[label]; + var duration = now() - time; + console.log(label + ": " + duration + "ms"); +} + +function trace() { + var err = new Error(); + err.name = "Trace"; + err.message = util.format.apply(null, arguments); + console.error(err.stack); +} + +function dir(object) { + console.log(util.inspect(object) + "\n"); +} + +function consoleAssert(expression) { + if (!expression) { + var arr = slice.call(arguments, 1); + assert.ok(false, util.format.apply(null, arr)); + } +} + +/***/ }), +/* 439 */ +/***/ ((module) => { + +"use strict"; +module.exports = require("util"); + +/***/ }), +/* 440 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -const XHTMLEntities = __webpack_require__(426); +const XHTMLEntities = __webpack_require__(441); const hexNumber = /^[\da-fA-F]+$/; const decimalNumber = /^\d+$/; // The map to `acorn-jsx` tokens from `acorn` namespace objects. @@ -29402,14 +31478,14 @@ module.exports = function (options) { Object.defineProperty(module.exports, "tokTypes", ({ get: function get_tokTypes() { - return getJsxTokens(__webpack_require__(424)).tokTypes; + return getJsxTokens(__webpack_require__(437)).tokTypes; }, configurable: true, enumerable: true })); function plugin(options, Parser) { - const acorn = Parser.acorn || __webpack_require__(424); + const acorn = Parser.acorn || __webpack_require__(437); const acornJsx = getJsxTokens(acorn); const tt = acorn.tokTypes; @@ -29813,7 +31889,7 @@ function plugin(options, Parser) { } /***/ }), -/* 426 */ +/* 441 */ /***/ ((module) => { module.exports = { @@ -30073,838 +32149,7 @@ module.exports = { }; /***/ }), -/* 427 */ -/***/ ((module) => { - -"use strict"; -/** - * @fileoverview The AST node types produced by the parser. - * @author Nicholas C. Zakas - */ - //------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ -// None! -//------------------------------------------------------------------------------ -// Public -//------------------------------------------------------------------------------ - -module.exports = { - AssignmentExpression: "AssignmentExpression", - AssignmentPattern: "AssignmentPattern", - ArrayExpression: "ArrayExpression", - ArrayPattern: "ArrayPattern", - ArrowFunctionExpression: "ArrowFunctionExpression", - AwaitExpression: "AwaitExpression", - BlockStatement: "BlockStatement", - BinaryExpression: "BinaryExpression", - BreakStatement: "BreakStatement", - CallExpression: "CallExpression", - CatchClause: "CatchClause", - ClassBody: "ClassBody", - ClassDeclaration: "ClassDeclaration", - ClassExpression: "ClassExpression", - ConditionalExpression: "ConditionalExpression", - ContinueStatement: "ContinueStatement", - DoWhileStatement: "DoWhileStatement", - DebuggerStatement: "DebuggerStatement", - EmptyStatement: "EmptyStatement", - ExpressionStatement: "ExpressionStatement", - ForStatement: "ForStatement", - ForInStatement: "ForInStatement", - ForOfStatement: "ForOfStatement", - FunctionDeclaration: "FunctionDeclaration", - FunctionExpression: "FunctionExpression", - Identifier: "Identifier", - IfStatement: "IfStatement", - Literal: "Literal", - LabeledStatement: "LabeledStatement", - LogicalExpression: "LogicalExpression", - MemberExpression: "MemberExpression", - MetaProperty: "MetaProperty", - MethodDefinition: "MethodDefinition", - NewExpression: "NewExpression", - ObjectExpression: "ObjectExpression", - ObjectPattern: "ObjectPattern", - Program: "Program", - Property: "Property", - RestElement: "RestElement", - ReturnStatement: "ReturnStatement", - SequenceExpression: "SequenceExpression", - SpreadElement: "SpreadElement", - Super: "Super", - SwitchCase: "SwitchCase", - SwitchStatement: "SwitchStatement", - TaggedTemplateExpression: "TaggedTemplateExpression", - TemplateElement: "TemplateElement", - TemplateLiteral: "TemplateLiteral", - ThisExpression: "ThisExpression", - ThrowStatement: "ThrowStatement", - TryStatement: "TryStatement", - UnaryExpression: "UnaryExpression", - UpdateExpression: "UpdateExpression", - VariableDeclaration: "VariableDeclaration", - VariableDeclarator: "VariableDeclarator", - WhileStatement: "WhileStatement", - WithStatement: "WithStatement", - YieldExpression: "YieldExpression", - JSXIdentifier: "JSXIdentifier", - JSXNamespacedName: "JSXNamespacedName", - JSXMemberExpression: "JSXMemberExpression", - JSXEmptyExpression: "JSXEmptyExpression", - JSXExpressionContainer: "JSXExpressionContainer", - JSXElement: "JSXElement", - JSXClosingElement: "JSXClosingElement", - JSXOpeningElement: "JSXOpeningElement", - JSXAttribute: "JSXAttribute", - JSXSpreadAttribute: "JSXSpreadAttribute", - JSXText: "JSXText", - ExportDefaultDeclaration: "ExportDefaultDeclaration", - ExportNamedDeclaration: "ExportNamedDeclaration", - ExportAllDeclaration: "ExportAllDeclaration", - ExportSpecifier: "ExportSpecifier", - ImportDeclaration: "ImportDeclaration", - ImportSpecifier: "ImportSpecifier", - ImportDefaultSpecifier: "ImportDefaultSpecifier", - ImportNamespaceSpecifier: "ImportNamespaceSpecifier" -}; - -/***/ }), -/* 428 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - -/* eslint-disable no-param-reassign*/ - -const TokenTranslator = __webpack_require__(429); - -const { - normalizeOptions -} = __webpack_require__(430); - -const STATE = Symbol("espree's internal state"); -const ESPRIMA_FINISH_NODE = Symbol("espree's esprimaFinishNode"); -/** - * Converts an Acorn comment to a Esprima comment. - * @param {boolean} block True if it's a block comment, false if not. - * @param {string} text The text of the comment. - * @param {int} start The index at which the comment starts. - * @param {int} end The index at which the comment ends. - * @param {Location} startLoc The location at which the comment starts. - * @param {Location} endLoc The location at which the comment ends. - * @returns {Object} The comment object. - * @private - */ - -function convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc) { - const comment = { - type: block ? "Block" : "Line", - value: text - }; - - if (typeof start === "number") { - comment.start = start; - comment.end = end; - comment.range = [start, end]; - } - - if (typeof startLoc === "object") { - comment.loc = { - start: startLoc, - end: endLoc - }; - } - - return comment; -} - -module.exports = () => Parser => { - const tokTypes = Object.assign({}, Parser.acorn.tokTypes); - - if (Parser.acornJsx) { - Object.assign(tokTypes, Parser.acornJsx.tokTypes); - } - - return class Espree extends Parser { - constructor(opts, code) { - if (typeof opts !== "object" || opts === null) { - opts = {}; - } - - if (typeof code !== "string" && !(code instanceof String)) { - code = String(code); - } - - const options = normalizeOptions(opts); - const ecmaFeatures = options.ecmaFeatures || {}; - const tokenTranslator = options.tokens === true ? new TokenTranslator(tokTypes, code) : null; // Initialize acorn parser. - - super({ - // TODO: use {...options} when spread is supported(Node.js >= 8.3.0). - ecmaVersion: options.ecmaVersion, - sourceType: options.sourceType, - ranges: options.ranges, - locations: options.locations, - // Truthy value is true for backward compatibility. - allowReturnOutsideFunction: Boolean(ecmaFeatures.globalReturn), - // Collect tokens - onToken: token => { - if (tokenTranslator) { - // Use `tokens`, `ecmaVersion`, and `jsxAttrValueToken` in the state. - tokenTranslator.onToken(token, this[STATE]); - } - - if (token.type !== tokTypes.eof) { - this[STATE].lastToken = token; - } - }, - // Collect comments - onComment: (block, text, start, end, startLoc, endLoc) => { - if (this[STATE].comments) { - const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc); - this[STATE].comments.push(comment); - } - } - }, code); // Initialize internal state. - - this[STATE] = { - tokens: tokenTranslator ? [] : null, - comments: options.comment === true ? [] : null, - impliedStrict: ecmaFeatures.impliedStrict === true && this.options.ecmaVersion >= 5, - ecmaVersion: this.options.ecmaVersion, - jsxAttrValueToken: false, - lastToken: null - }; - } - - tokenize() { - do { - this.next(); - } while (this.type !== tokTypes.eof); // Consume the final eof token - - - this.next(); - const extra = this[STATE]; - const tokens = extra.tokens; - - if (extra.comments) { - tokens.comments = extra.comments; - } - - return tokens; - } - - finishNode(...args) { - const result = super.finishNode(...args); - return this[ESPRIMA_FINISH_NODE](result); - } - - finishNodeAt(...args) { - const result = super.finishNodeAt(...args); - return this[ESPRIMA_FINISH_NODE](result); - } - - parse() { - const extra = this[STATE]; - const program = super.parse(); - program.sourceType = this.options.sourceType; - - if (extra.comments) { - program.comments = extra.comments; - } - - if (extra.tokens) { - program.tokens = extra.tokens; - } - /* - * Adjust opening and closing position of program to match Esprima. - * Acorn always starts programs at range 0 whereas Esprima starts at the - * first AST node's start (the only real difference is when there's leading - * whitespace or leading comments). Acorn also counts trailing whitespace - * as part of the program whereas Esprima only counts up to the last token. - */ - - - if (program.range) { - program.range[0] = program.body.length ? program.body[0].range[0] : program.range[0]; - program.range[1] = extra.lastToken ? extra.lastToken.range[1] : program.range[1]; - } - - if (program.loc) { - program.loc.start = program.body.length ? program.body[0].loc.start : program.loc.start; - program.loc.end = extra.lastToken ? extra.lastToken.loc.end : program.loc.end; - } - - return program; - } - - parseTopLevel(node) { - if (this[STATE].impliedStrict) { - this.strict = true; - } - - return super.parseTopLevel(node); - } - /** - * Overwrites the default raise method to throw Esprima-style errors. - * @param {int} pos The position of the error. - * @param {string} message The error message. - * @throws {SyntaxError} A syntax error. - * @returns {void} - */ - - - raise(pos, message) { - const loc = Parser.acorn.getLineInfo(this.input, pos); - const err = new SyntaxError(message); - err.index = pos; - err.lineNumber = loc.line; - err.column = loc.column + 1; // acorn uses 0-based columns - - throw err; - } - /** - * Overwrites the default raise method to throw Esprima-style errors. - * @param {int} pos The position of the error. - * @param {string} message The error message. - * @throws {SyntaxError} A syntax error. - * @returns {void} - */ - - - raiseRecoverable(pos, message) { - this.raise(pos, message); - } - /** - * Overwrites the default unexpected method to throw Esprima-style errors. - * @param {int} pos The position of the error. - * @throws {SyntaxError} A syntax error. - * @returns {void} - */ - - - unexpected(pos) { - let message = "Unexpected token"; - - if (pos !== null && pos !== void 0) { - this.pos = pos; - - if (this.options.locations) { - while (this.pos < this.lineStart) { - this.lineStart = this.input.lastIndexOf("\n", this.lineStart - 2) + 1; - --this.curLine; - } - } - - this.nextToken(); - } - - if (this.end > this.start) { - message += ` ${this.input.slice(this.start, this.end)}`; - } - - this.raise(this.start, message); - } - /* - * Esprima-FB represents JSX strings as tokens called "JSXText", but Acorn-JSX - * uses regular tt.string without any distinction between this and regular JS - * strings. As such, we intercept an attempt to read a JSX string and set a flag - * on extra so that when tokens are converted, the next token will be switched - * to JSXText via onToken. - */ - - - jsx_readString(quote) { - // eslint-disable-line camelcase - const result = super.jsx_readString(quote); - - if (this.type === tokTypes.string) { - this[STATE].jsxAttrValueToken = true; - } - - return result; - } - /** - * Performs last-minute Esprima-specific compatibility checks and fixes. - * @param {ASTNode} result The node to check. - * @returns {ASTNode} The finished node. - */ - - - [ESPRIMA_FINISH_NODE](result) { - // Acorn doesn't count the opening and closing backticks as part of templates - // so we have to adjust ranges/locations appropriately. - if (result.type === "TemplateElement") { - // additional adjustment needed if ${ is the last token - const terminalDollarBraceL = this.input.slice(result.end, result.end + 2) === "${"; - - if (result.range) { - result.range[0]--; - result.range[1] += terminalDollarBraceL ? 2 : 1; - } - - if (result.loc) { - result.loc.start.column--; - result.loc.end.column += terminalDollarBraceL ? 2 : 1; - } - } - - if (result.type.indexOf("Function") > -1 && !result.generator) { - result.generator = false; - } - - return result; - } - - }; -}; - -/***/ }), -/* 429 */ -/***/ ((module) => { - -"use strict"; -/** - * @fileoverview Translates tokens between Acorn format and Esprima format. - * @author Nicholas C. Zakas - */ - -/* eslint no-underscore-dangle: 0 */ - //------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ -// none! -//------------------------------------------------------------------------------ -// Private -//------------------------------------------------------------------------------ -// Esprima Token Types - -const Token = { - Boolean: "Boolean", - EOF: "", - Identifier: "Identifier", - Keyword: "Keyword", - Null: "Null", - Numeric: "Numeric", - Punctuator: "Punctuator", - String: "String", - RegularExpression: "RegularExpression", - Template: "Template", - JSXIdentifier: "JSXIdentifier", - JSXText: "JSXText" -}; -/** - * Converts part of a template into an Esprima token. - * @param {AcornToken[]} tokens The Acorn tokens representing the template. - * @param {string} code The source code. - * @returns {EsprimaToken} The Esprima equivalent of the template token. - * @private - */ - -function convertTemplatePart(tokens, code) { - const firstToken = tokens[0], - lastTemplateToken = tokens[tokens.length - 1]; - const token = { - type: Token.Template, - value: code.slice(firstToken.start, lastTemplateToken.end) - }; - - if (firstToken.loc) { - token.loc = { - start: firstToken.loc.start, - end: lastTemplateToken.loc.end - }; - } - - if (firstToken.range) { - token.start = firstToken.range[0]; - token.end = lastTemplateToken.range[1]; - token.range = [token.start, token.end]; - } - - return token; -} -/** - * Contains logic to translate Acorn tokens into Esprima tokens. - * @param {Object} acornTokTypes The Acorn token types. - * @param {string} code The source code Acorn is parsing. This is necessary - * to correct the "value" property of some tokens. - * @constructor - */ - - -function TokenTranslator(acornTokTypes, code) { - // token types - this._acornTokTypes = acornTokTypes; // token buffer for templates - - this._tokens = []; // track the last curly brace - - this._curlyBrace = null; // the source code - - this._code = code; -} - -TokenTranslator.prototype = { - constructor: TokenTranslator, - - /** - * Translates a single Esprima token to a single Acorn token. This may be - * inaccurate due to how templates are handled differently in Esprima and - * Acorn, but should be accurate for all other tokens. - * @param {AcornToken} token The Acorn token to translate. - * @param {Object} extra Espree extra object. - * @returns {EsprimaToken} The Esprima version of the token. - */ - translate(token, extra) { - const type = token.type, - tt = this._acornTokTypes; - - if (type === tt.name) { - token.type = Token.Identifier; // TODO: See if this is an Acorn bug - - if (token.value === "static") { - token.type = Token.Keyword; - } - - if (extra.ecmaVersion > 5 && (token.value === "yield" || token.value === "let")) { - token.type = Token.Keyword; - } - } else if (type === tt.semi || type === tt.comma || type === tt.parenL || type === tt.parenR || type === tt.braceL || type === tt.braceR || type === tt.dot || type === tt.bracketL || type === tt.colon || type === tt.question || type === tt.bracketR || type === tt.ellipsis || type === tt.arrow || type === tt.jsxTagStart || type === tt.incDec || type === tt.starstar || type === tt.jsxTagEnd || type === tt.prefix || type === tt.questionDot || type.binop && !type.keyword || type.isAssign) { - token.type = Token.Punctuator; - token.value = this._code.slice(token.start, token.end); - } else if (type === tt.jsxName) { - token.type = Token.JSXIdentifier; - } else if (type.label === "jsxText" || type === tt.jsxAttrValueToken) { - token.type = Token.JSXText; - } else if (type.keyword) { - if (type.keyword === "true" || type.keyword === "false") { - token.type = Token.Boolean; - } else if (type.keyword === "null") { - token.type = Token.Null; - } else { - token.type = Token.Keyword; - } - } else if (type === tt.num) { - token.type = Token.Numeric; - token.value = this._code.slice(token.start, token.end); - } else if (type === tt.string) { - if (extra.jsxAttrValueToken) { - extra.jsxAttrValueToken = false; - token.type = Token.JSXText; - } else { - token.type = Token.String; - } - - token.value = this._code.slice(token.start, token.end); - } else if (type === tt.regexp) { - token.type = Token.RegularExpression; - const value = token.value; - token.regex = { - flags: value.flags, - pattern: value.pattern - }; - token.value = `/${value.pattern}/${value.flags}`; - } - - return token; - }, - - /** - * Function to call during Acorn's onToken handler. - * @param {AcornToken} token The Acorn token. - * @param {Object} extra The Espree extra object. - * @returns {void} - */ - onToken(token, extra) { - const that = this, - tt = this._acornTokTypes, - tokens = extra.tokens, - templateTokens = this._tokens; - /** - * Flushes the buffered template tokens and resets the template - * tracking. - * @returns {void} - * @private - */ - - function translateTemplateTokens() { - tokens.push(convertTemplatePart(that._tokens, that._code)); - that._tokens = []; - } - - if (token.type === tt.eof) { - // might be one last curlyBrace - if (this._curlyBrace) { - tokens.push(this.translate(this._curlyBrace, extra)); - } - - return; - } - - if (token.type === tt.backQuote) { - // if there's already a curly, it's not part of the template - if (this._curlyBrace) { - tokens.push(this.translate(this._curlyBrace, extra)); - this._curlyBrace = null; - } - - templateTokens.push(token); // it's the end - - if (templateTokens.length > 1) { - translateTemplateTokens(); - } - - return; - } - - if (token.type === tt.dollarBraceL) { - templateTokens.push(token); - translateTemplateTokens(); - return; - } - - if (token.type === tt.braceR) { - // if there's already a curly, it's not part of the template - if (this._curlyBrace) { - tokens.push(this.translate(this._curlyBrace, extra)); - } // store new curly for later - - - this._curlyBrace = token; - return; - } - - if (token.type === tt.template || token.type === tt.invalidTemplate) { - if (this._curlyBrace) { - templateTokens.push(this._curlyBrace); - this._curlyBrace = null; - } - - templateTokens.push(token); - return; - } - - if (this._curlyBrace) { - tokens.push(this.translate(this._curlyBrace, extra)); - this._curlyBrace = null; - } - - tokens.push(this.translate(token, extra)); - } - -}; //------------------------------------------------------------------------------ -// Public -//------------------------------------------------------------------------------ - -module.exports = TokenTranslator; - -/***/ }), -/* 430 */ -/***/ ((module) => { - -"use strict"; -/** - * @fileoverview A collection of methods for processing Espree's options. - * @author Kai Cataldo - */ - //------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -const DEFAULT_ECMA_VERSION = 5; -const SUPPORTED_VERSIONS = [3, 5, 6, 7, 8, 9, 10, 11, 12]; -/** - * Normalize ECMAScript version from the initial config - * @param {number} ecmaVersion ECMAScript version from the initial config - * @throws {Error} throws an error if the ecmaVersion is invalid. - * @returns {number} normalized ECMAScript version - */ - -function normalizeEcmaVersion(ecmaVersion = DEFAULT_ECMA_VERSION) { - if (typeof ecmaVersion !== "number") { - throw new Error(`ecmaVersion must be a number. Received value of type ${typeof ecmaVersion} instead.`); - } - - let version = ecmaVersion; // Calculate ECMAScript edition number from official year version starting with - // ES2015, which corresponds with ES6 (or a difference of 2009). - - if (version >= 2015) { - version -= 2009; - } - - if (!SUPPORTED_VERSIONS.includes(version)) { - throw new Error("Invalid ecmaVersion."); - } - - return version; -} -/** - * Normalize sourceType from the initial config - * @param {string} sourceType to normalize - * @throws {Error} throw an error if sourceType is invalid - * @returns {string} normalized sourceType - */ - - -function normalizeSourceType(sourceType = "script") { - if (sourceType === "script" || sourceType === "module") { - return sourceType; - } - - throw new Error("Invalid sourceType."); -} -/** - * Normalize parserOptions - * @param {Object} options the parser options to normalize - * @throws {Error} throw an error if found invalid option. - * @returns {Object} normalized options - */ - - -function normalizeOptions(options) { - const ecmaVersion = normalizeEcmaVersion(options.ecmaVersion); - const sourceType = normalizeSourceType(options.sourceType); - const ranges = options.range === true; - const locations = options.loc === true; - - if (sourceType === "module" && ecmaVersion < 6) { - throw new Error("sourceType 'module' is not supported when ecmaVersion < 2015. Consider adding `{ ecmaVersion: 2015 }` to the parser options."); - } - - return Object.assign({}, options, { - ecmaVersion, - sourceType, - ranges, - locations - }); -} -/** - * Get the latest ECMAScript version supported by Espree. - * @returns {number} The latest ECMAScript version. - */ - - -function getLatestEcmaVersion() { - return SUPPORTED_VERSIONS[SUPPORTED_VERSIONS.length - 1]; -} -/** - * Get the list of ECMAScript versions supported by Espree. - * @returns {number[]} An array containing the supported ECMAScript versions. - */ - - -function getSupportedEcmaVersions() { - return [...SUPPORTED_VERSIONS]; -} //------------------------------------------------------------------------------ -// Public -//------------------------------------------------------------------------------ - - -module.exports = { - normalizeOptions, - getLatestEcmaVersion, - getSupportedEcmaVersions -}; - -/***/ }), -/* 431 */ -/***/ ((module) => { - -"use strict"; -module.exports = JSON.parse('{"name":"espree","description":"An Esprima-compatible JavaScript parser built on Acorn","author":"Nicholas C. Zakas ","homepage":"https://github.com/eslint/espree","main":"espree.js","version":"7.3.1","files":["lib","espree.js"],"engines":{"node":"^10.12.0 || >=12.0.0"},"repository":"eslint/espree","bugs":{"url":"http://github.com/eslint/espree.git"},"license":"BSD-2-Clause","dependencies":{"acorn":"^7.4.0","acorn-jsx":"^5.3.1","eslint-visitor-keys":"^1.3.0"},"devDependencies":{"browserify":"^16.5.0","chai":"^4.2.0","eslint":"^6.0.1","eslint-config-eslint":"^5.0.1","eslint-plugin-node":"^9.1.0","eslint-release":"^1.0.0","esprima":"latest","esprima-fb":"^8001.2001.0-dev-harmony-fb","json-diff":"^0.5.4","leche":"^2.3.0","mocha":"^6.2.0","nyc":"^14.1.1","regenerate":"^1.4.0","shelljs":"^0.3.0","shelljs-nodecli":"^0.1.1","unicode-6.3.0":"^0.7.5"},"keywords":["ast","ecmascript","javascript","parser","syntax","acorn"],"scripts":{"generate-regex":"node tools/generate-identifier-regex.js","test":"npm run-script lint && node Makefile.js test","lint":"node Makefile.js lint","fixlint":"node Makefile.js lint --fix","sync-docs":"node Makefile.js docs","browserify":"node Makefile.js browserify","generate-release":"eslint-generate-release","generate-alpharelease":"eslint-generate-prerelease alpha","generate-betarelease":"eslint-generate-prerelease beta","generate-rcrelease":"eslint-generate-prerelease rc","publish-release":"eslint-publish-release"}}'); - -/***/ }), -/* 432 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; -/** - * @author Toru Nagashima - * See LICENSE file in root directory for full license. - */ - - -const KEYS = __webpack_require__(433); // Types. - - -const NODE_TYPES = Object.freeze(Object.keys(KEYS)); // Freeze the keys. - -for (const type of NODE_TYPES) { - Object.freeze(KEYS[type]); -} - -Object.freeze(KEYS); // List to ignore keys. - -const KEY_BLACKLIST = new Set(["parent", "leadingComments", "trailingComments"]); -/** - * Check whether a given key should be used or not. - * @param {string} key The key to check. - * @returns {boolean} `true` if the key should be used. - */ - -function filterKey(key) { - return !KEY_BLACKLIST.has(key) && key[0] !== "_"; -} //------------------------------------------------------------------------------ -// Public interfaces -//------------------------------------------------------------------------------ - - -module.exports = Object.freeze({ - /** - * Visitor keys. - * @type {{ [type: string]: string[] | undefined }} - */ - KEYS, - - /** - * Get visitor keys of a given node. - * @param {Object} node The AST node to get keys. - * @returns {string[]} Visitor keys of the node. - */ - getKeys(node) { - return Object.keys(node).filter(filterKey); - }, - - // Disable valid-jsdoc rule because it reports syntax error on the type of @returns. - // eslint-disable-next-line valid-jsdoc - - /** - * Make the union set with `KEYS` and given keys. - * @param {Object} additionalKeys The additional keys. - * @returns {{ [type: string]: string[] | undefined }} The union set. - */ - unionWith(additionalKeys) { - const retv = Object.assign({}, KEYS); - - for (const type of Object.keys(additionalKeys)) { - if (retv.hasOwnProperty(type)) { - const keys = new Set(additionalKeys[type]); - - for (const key of retv[type]) { - keys.add(key); - } - - retv[type] = Object.freeze(Array.from(keys)); - } else { - retv[type] = Object.freeze(Array.from(additionalKeys[type])); - } - } - - return Object.freeze(retv); - } - -}); - -/***/ }), -/* 433 */ -/***/ ((module) => { - -"use strict"; -module.exports = JSON.parse('{"AssignmentExpression":["left","right"],"AssignmentPattern":["left","right"],"ArrayExpression":["elements"],"ArrayPattern":["elements"],"ArrowFunctionExpression":["params","body"],"AwaitExpression":["argument"],"BlockStatement":["body"],"BinaryExpression":["left","right"],"BreakStatement":["label"],"CallExpression":["callee","arguments"],"CatchClause":["param","body"],"ChainExpression":["expression"],"ClassBody":["body"],"ClassDeclaration":["id","superClass","body"],"ClassExpression":["id","superClass","body"],"ConditionalExpression":["test","consequent","alternate"],"ContinueStatement":["label"],"DebuggerStatement":[],"DoWhileStatement":["body","test"],"EmptyStatement":[],"ExportAllDeclaration":["exported","source"],"ExportDefaultDeclaration":["declaration"],"ExportNamedDeclaration":["declaration","specifiers","source"],"ExportSpecifier":["exported","local"],"ExpressionStatement":["expression"],"ExperimentalRestProperty":["argument"],"ExperimentalSpreadProperty":["argument"],"ForStatement":["init","test","update","body"],"ForInStatement":["left","right","body"],"ForOfStatement":["left","right","body"],"FunctionDeclaration":["id","params","body"],"FunctionExpression":["id","params","body"],"Identifier":[],"IfStatement":["test","consequent","alternate"],"ImportDeclaration":["specifiers","source"],"ImportDefaultSpecifier":["local"],"ImportExpression":["source"],"ImportNamespaceSpecifier":["local"],"ImportSpecifier":["imported","local"],"JSXAttribute":["name","value"],"JSXClosingElement":["name"],"JSXElement":["openingElement","children","closingElement"],"JSXEmptyExpression":[],"JSXExpressionContainer":["expression"],"JSXIdentifier":[],"JSXMemberExpression":["object","property"],"JSXNamespacedName":["namespace","name"],"JSXOpeningElement":["name","attributes"],"JSXSpreadAttribute":["argument"],"JSXText":[],"JSXFragment":["openingFragment","children","closingFragment"],"Literal":[],"LabeledStatement":["label","body"],"LogicalExpression":["left","right"],"MemberExpression":["object","property"],"MetaProperty":["meta","property"],"MethodDefinition":["key","value"],"NewExpression":["callee","arguments"],"ObjectExpression":["properties"],"ObjectPattern":["properties"],"Program":["body"],"Property":["key","value"],"RestElement":["argument"],"ReturnStatement":["argument"],"SequenceExpression":["expressions"],"SpreadElement":["argument"],"Super":[],"SwitchStatement":["discriminant","cases"],"SwitchCase":["test","consequent"],"TaggedTemplateExpression":["tag","quasi"],"TemplateElement":[],"TemplateLiteral":["quasis","expressions"],"ThisExpression":[],"ThrowStatement":["argument"],"TryStatement":["block","handler","finalizer"],"UnaryExpression":["argument"],"UpdateExpression":["argument"],"VariableDeclaration":["declarations"],"VariableDeclarator":["id","init"],"WhileStatement":["test","body"],"WithStatement":["object","body"],"YieldExpression":["argument"]}'); - -/***/ }), -/* 434 */ +/* 442 */ /***/ ((module, exports, __webpack_require__) => { /* module decorator */ module = __webpack_require__.nmd(module); @@ -31665,7 +32910,9 @@ function arrayLikeKeys(value, inherited) { for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && ( // Safari 9 has enumerable `arguments.length` in strict mode. - key == 'length' || isBuff && (key == 'offset' || key == 'parent') || isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset') || // Skip index properties. + key == 'length' || // Node.js 0.10 has enumerable non-index properties on buffers. + isBuff && (key == 'offset' || key == 'parent') || // PhantomJS 2 has enumerable non-index properties on typed arrays. + isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset') || // Skip index properties. isIndex(key, length)))) { result.push(key); } @@ -32959,219 +34206,14 @@ function stubFalse() { module.exports = merge; /***/ }), -/* 435 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; -/** - * @fileoverview Defines environment settings and globals. - * @author Elan Shanker - */ - //------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const globals = __webpack_require__(436); //------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Get the object that has difference. - * @param {Record} current The newer object. - * @param {Record} prev The older object. - * @returns {Record} The difference object. - */ - - -function getDiff(current, prev) { - const retv = {}; - - for (const [key, value] of Object.entries(current)) { - if (!Object.hasOwnProperty.call(prev, key)) { - retv[key] = value; - } - } - - return retv; -} - -const newGlobals2015 = getDiff(globals.es2015, globals.es5); // 19 variables such as Promise, Map, ... - -const newGlobals2017 = { - Atomics: false, - SharedArrayBuffer: false -}; -const newGlobals2020 = { - BigInt: false, - BigInt64Array: false, - BigUint64Array: false, - globalThis: false -}; -const newGlobals2021 = { - AggregateError: false, - FinalizationRegistry: false, - WeakRef: false -}; //------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** @type {Map} */ - -module.exports = new Map(Object.entries({ - // Language - builtin: { - globals: globals.es5 - }, - es6: { - globals: newGlobals2015, - parserOptions: { - ecmaVersion: 6 - } - }, - es2015: { - globals: newGlobals2015, - parserOptions: { - ecmaVersion: 6 - } - }, - es2017: { - globals: { ...newGlobals2015, - ...newGlobals2017 - }, - parserOptions: { - ecmaVersion: 8 - } - }, - es2020: { - globals: { ...newGlobals2015, - ...newGlobals2017, - ...newGlobals2020 - }, - parserOptions: { - ecmaVersion: 11 - } - }, - es2021: { - globals: { ...newGlobals2015, - ...newGlobals2017, - ...newGlobals2020, - ...newGlobals2021 - }, - parserOptions: { - ecmaVersion: 12 - } - }, - // Platforms - browser: { - globals: globals.browser - }, - node: { - globals: globals.node, - parserOptions: { - ecmaFeatures: { - globalReturn: true - } - } - }, - "shared-node-browser": { - globals: globals["shared-node-browser"] - }, - worker: { - globals: globals.worker - }, - serviceworker: { - globals: globals.serviceworker - }, - // Frameworks - commonjs: { - globals: globals.commonjs, - parserOptions: { - ecmaFeatures: { - globalReturn: true - } - } - }, - amd: { - globals: globals.amd - }, - mocha: { - globals: globals.mocha - }, - jasmine: { - globals: globals.jasmine - }, - jest: { - globals: globals.jest - }, - phantomjs: { - globals: globals.phantomjs - }, - jquery: { - globals: globals.jquery - }, - qunit: { - globals: globals.qunit - }, - prototypejs: { - globals: globals.prototypejs - }, - shelljs: { - globals: globals.shelljs - }, - meteor: { - globals: globals.meteor - }, - mongo: { - globals: globals.mongo - }, - protractor: { - globals: globals.protractor - }, - applescript: { - globals: globals.applescript - }, - nashorn: { - globals: globals.nashorn - }, - atomtest: { - globals: globals.atomtest - }, - embertest: { - globals: globals.embertest - }, - webextensions: { - globals: globals.webextensions - }, - greasemonkey: { - globals: globals.greasemonkey - } -})); - -/***/ }), -/* 436 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -module.exports = __webpack_require__(437); - -/***/ }), -/* 437 */ +/* 443 */ /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"builtin":{"AggregateError":false,"Array":false,"ArrayBuffer":false,"Atomics":false,"BigInt":false,"BigInt64Array":false,"BigUint64Array":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"FinalizationRegistry":false,"Float32Array":false,"Float64Array":false,"Function":false,"globalThis":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"SharedArrayBuffer":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakRef":false,"WeakSet":false},"es5":{"Array":false,"Boolean":false,"constructor":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"propertyIsEnumerable":false,"RangeError":false,"ReferenceError":false,"RegExp":false,"String":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false},"es2015":{"Array":false,"ArrayBuffer":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"es2017":{"Array":false,"ArrayBuffer":false,"Atomics":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"SharedArrayBuffer":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"es2020":{"Array":false,"ArrayBuffer":false,"Atomics":false,"BigInt":false,"BigInt64Array":false,"BigUint64Array":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"globalThis":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"SharedArrayBuffer":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"es2021":{"AggregateError":false,"Array":false,"ArrayBuffer":false,"Atomics":false,"BigInt":false,"BigInt64Array":false,"BigUint64Array":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"FinalizationRegistry":false,"Float32Array":false,"Float64Array":false,"Function":false,"globalThis":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"SharedArrayBuffer":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakRef":false,"WeakSet":false},"browser":{"AbortController":false,"AbortSignal":false,"addEventListener":false,"alert":false,"AnalyserNode":false,"Animation":false,"AnimationEffectReadOnly":false,"AnimationEffectTiming":false,"AnimationEffectTimingReadOnly":false,"AnimationEvent":false,"AnimationPlaybackEvent":false,"AnimationTimeline":false,"applicationCache":false,"ApplicationCache":false,"ApplicationCacheErrorEvent":false,"atob":false,"Attr":false,"Audio":false,"AudioBuffer":false,"AudioBufferSourceNode":false,"AudioContext":false,"AudioDestinationNode":false,"AudioListener":false,"AudioNode":false,"AudioParam":false,"AudioProcessingEvent":false,"AudioScheduledSourceNode":false,"AudioWorkletGlobalScope ":false,"AudioWorkletNode":false,"AudioWorkletProcessor":false,"BarProp":false,"BaseAudioContext":false,"BatteryManager":false,"BeforeUnloadEvent":false,"BiquadFilterNode":false,"Blob":false,"BlobEvent":false,"blur":false,"BroadcastChannel":false,"btoa":false,"BudgetService":false,"ByteLengthQueuingStrategy":false,"Cache":false,"caches":false,"CacheStorage":false,"cancelAnimationFrame":false,"cancelIdleCallback":false,"CanvasCaptureMediaStreamTrack":false,"CanvasGradient":false,"CanvasPattern":false,"CanvasRenderingContext2D":false,"ChannelMergerNode":false,"ChannelSplitterNode":false,"CharacterData":false,"clearInterval":false,"clearTimeout":false,"clientInformation":false,"ClipboardEvent":false,"close":false,"closed":false,"CloseEvent":false,"Comment":false,"CompositionEvent":false,"confirm":false,"console":false,"ConstantSourceNode":false,"ConvolverNode":false,"CountQueuingStrategy":false,"createImageBitmap":false,"Credential":false,"CredentialsContainer":false,"crypto":false,"Crypto":false,"CryptoKey":false,"CSS":false,"CSSConditionRule":false,"CSSFontFaceRule":false,"CSSGroupingRule":false,"CSSImportRule":false,"CSSKeyframeRule":false,"CSSKeyframesRule":false,"CSSMatrixComponent":false,"CSSMediaRule":false,"CSSNamespaceRule":false,"CSSPageRule":false,"CSSPerspective":false,"CSSRotate":false,"CSSRule":false,"CSSRuleList":false,"CSSScale":false,"CSSSkew":false,"CSSSkewX":false,"CSSSkewY":false,"CSSStyleDeclaration":false,"CSSStyleRule":false,"CSSStyleSheet":false,"CSSSupportsRule":false,"CSSTransformValue":false,"CSSTranslate":false,"CustomElementRegistry":false,"customElements":false,"CustomEvent":false,"DataTransfer":false,"DataTransferItem":false,"DataTransferItemList":false,"defaultstatus":false,"defaultStatus":false,"DelayNode":false,"DeviceMotionEvent":false,"DeviceOrientationEvent":false,"devicePixelRatio":false,"dispatchEvent":false,"document":false,"Document":false,"DocumentFragment":false,"DocumentType":false,"DOMError":false,"DOMException":false,"DOMImplementation":false,"DOMMatrix":false,"DOMMatrixReadOnly":false,"DOMParser":false,"DOMPoint":false,"DOMPointReadOnly":false,"DOMQuad":false,"DOMRect":false,"DOMRectList":false,"DOMRectReadOnly":false,"DOMStringList":false,"DOMStringMap":false,"DOMTokenList":false,"DragEvent":false,"DynamicsCompressorNode":false,"Element":false,"ErrorEvent":false,"event":false,"Event":false,"EventSource":false,"EventTarget":false,"external":false,"fetch":false,"File":false,"FileList":false,"FileReader":false,"find":false,"focus":false,"FocusEvent":false,"FontFace":false,"FontFaceSetLoadEvent":false,"FormData":false,"frameElement":false,"frames":false,"GainNode":false,"Gamepad":false,"GamepadButton":false,"GamepadEvent":false,"getComputedStyle":false,"getSelection":false,"HashChangeEvent":false,"Headers":false,"history":false,"History":false,"HTMLAllCollection":false,"HTMLAnchorElement":false,"HTMLAreaElement":false,"HTMLAudioElement":false,"HTMLBaseElement":false,"HTMLBodyElement":false,"HTMLBRElement":false,"HTMLButtonElement":false,"HTMLCanvasElement":false,"HTMLCollection":false,"HTMLContentElement":false,"HTMLDataElement":false,"HTMLDataListElement":false,"HTMLDetailsElement":false,"HTMLDialogElement":false,"HTMLDirectoryElement":false,"HTMLDivElement":false,"HTMLDListElement":false,"HTMLDocument":false,"HTMLElement":false,"HTMLEmbedElement":false,"HTMLFieldSetElement":false,"HTMLFontElement":false,"HTMLFormControlsCollection":false,"HTMLFormElement":false,"HTMLFrameElement":false,"HTMLFrameSetElement":false,"HTMLHeadElement":false,"HTMLHeadingElement":false,"HTMLHRElement":false,"HTMLHtmlElement":false,"HTMLIFrameElement":false,"HTMLImageElement":false,"HTMLInputElement":false,"HTMLLabelElement":false,"HTMLLegendElement":false,"HTMLLIElement":false,"HTMLLinkElement":false,"HTMLMapElement":false,"HTMLMarqueeElement":false,"HTMLMediaElement":false,"HTMLMenuElement":false,"HTMLMetaElement":false,"HTMLMeterElement":false,"HTMLModElement":false,"HTMLObjectElement":false,"HTMLOListElement":false,"HTMLOptGroupElement":false,"HTMLOptionElement":false,"HTMLOptionsCollection":false,"HTMLOutputElement":false,"HTMLParagraphElement":false,"HTMLParamElement":false,"HTMLPictureElement":false,"HTMLPreElement":false,"HTMLProgressElement":false,"HTMLQuoteElement":false,"HTMLScriptElement":false,"HTMLSelectElement":false,"HTMLShadowElement":false,"HTMLSlotElement":false,"HTMLSourceElement":false,"HTMLSpanElement":false,"HTMLStyleElement":false,"HTMLTableCaptionElement":false,"HTMLTableCellElement":false,"HTMLTableColElement":false,"HTMLTableElement":false,"HTMLTableRowElement":false,"HTMLTableSectionElement":false,"HTMLTemplateElement":false,"HTMLTextAreaElement":false,"HTMLTimeElement":false,"HTMLTitleElement":false,"HTMLTrackElement":false,"HTMLUListElement":false,"HTMLUnknownElement":false,"HTMLVideoElement":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"IdleDeadline":false,"IIRFilterNode":false,"Image":false,"ImageBitmap":false,"ImageBitmapRenderingContext":false,"ImageCapture":false,"ImageData":false,"indexedDB":false,"innerHeight":false,"innerWidth":false,"InputEvent":false,"IntersectionObserver":false,"IntersectionObserverEntry":false,"Intl":false,"isSecureContext":false,"KeyboardEvent":false,"KeyframeEffect":false,"KeyframeEffectReadOnly":false,"length":false,"localStorage":false,"location":true,"Location":false,"locationbar":false,"matchMedia":false,"MediaDeviceInfo":false,"MediaDevices":false,"MediaElementAudioSourceNode":false,"MediaEncryptedEvent":false,"MediaError":false,"MediaKeyMessageEvent":false,"MediaKeySession":false,"MediaKeyStatusMap":false,"MediaKeySystemAccess":false,"MediaList":false,"MediaQueryList":false,"MediaQueryListEvent":false,"MediaRecorder":false,"MediaSettingsRange":false,"MediaSource":false,"MediaStream":false,"MediaStreamAudioDestinationNode":false,"MediaStreamAudioSourceNode":false,"MediaStreamEvent":false,"MediaStreamTrack":false,"MediaStreamTrackEvent":false,"menubar":false,"MessageChannel":false,"MessageEvent":false,"MessagePort":false,"MIDIAccess":false,"MIDIConnectionEvent":false,"MIDIInput":false,"MIDIInputMap":false,"MIDIMessageEvent":false,"MIDIOutput":false,"MIDIOutputMap":false,"MIDIPort":false,"MimeType":false,"MimeTypeArray":false,"MouseEvent":false,"moveBy":false,"moveTo":false,"MutationEvent":false,"MutationObserver":false,"MutationRecord":false,"name":false,"NamedNodeMap":false,"NavigationPreloadManager":false,"navigator":false,"Navigator":false,"NetworkInformation":false,"Node":false,"NodeFilter":false,"NodeIterator":false,"NodeList":false,"Notification":false,"OfflineAudioCompletionEvent":false,"OfflineAudioContext":false,"offscreenBuffering":false,"OffscreenCanvas":true,"OffscreenCanvasRenderingContext2D":false,"onabort":true,"onafterprint":true,"onanimationend":true,"onanimationiteration":true,"onanimationstart":true,"onappinstalled":true,"onauxclick":true,"onbeforeinstallprompt":true,"onbeforeprint":true,"onbeforeunload":true,"onblur":true,"oncancel":true,"oncanplay":true,"oncanplaythrough":true,"onchange":true,"onclick":true,"onclose":true,"oncontextmenu":true,"oncuechange":true,"ondblclick":true,"ondevicemotion":true,"ondeviceorientation":true,"ondeviceorientationabsolute":true,"ondrag":true,"ondragend":true,"ondragenter":true,"ondragleave":true,"ondragover":true,"ondragstart":true,"ondrop":true,"ondurationchange":true,"onemptied":true,"onended":true,"onerror":true,"onfocus":true,"ongotpointercapture":true,"onhashchange":true,"oninput":true,"oninvalid":true,"onkeydown":true,"onkeypress":true,"onkeyup":true,"onlanguagechange":true,"onload":true,"onloadeddata":true,"onloadedmetadata":true,"onloadstart":true,"onlostpointercapture":true,"onmessage":true,"onmessageerror":true,"onmousedown":true,"onmouseenter":true,"onmouseleave":true,"onmousemove":true,"onmouseout":true,"onmouseover":true,"onmouseup":true,"onmousewheel":true,"onoffline":true,"ononline":true,"onpagehide":true,"onpageshow":true,"onpause":true,"onplay":true,"onplaying":true,"onpointercancel":true,"onpointerdown":true,"onpointerenter":true,"onpointerleave":true,"onpointermove":true,"onpointerout":true,"onpointerover":true,"onpointerup":true,"onpopstate":true,"onprogress":true,"onratechange":true,"onrejectionhandled":true,"onreset":true,"onresize":true,"onscroll":true,"onsearch":true,"onseeked":true,"onseeking":true,"onselect":true,"onstalled":true,"onstorage":true,"onsubmit":true,"onsuspend":true,"ontimeupdate":true,"ontoggle":true,"ontransitionend":true,"onunhandledrejection":true,"onunload":true,"onvolumechange":true,"onwaiting":true,"onwheel":true,"open":false,"openDatabase":false,"opener":false,"Option":false,"origin":false,"OscillatorNode":false,"outerHeight":false,"outerWidth":false,"OverconstrainedError":false,"PageTransitionEvent":false,"pageXOffset":false,"pageYOffset":false,"PannerNode":false,"parent":false,"Path2D":false,"PaymentAddress":false,"PaymentRequest":false,"PaymentRequestUpdateEvent":false,"PaymentResponse":false,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceLongTaskTiming":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceNavigationTiming":false,"PerformanceObserver":false,"PerformanceObserverEntryList":false,"PerformancePaintTiming":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"PeriodicWave":false,"Permissions":false,"PermissionStatus":false,"personalbar":false,"PhotoCapabilities":false,"Plugin":false,"PluginArray":false,"PointerEvent":false,"PopStateEvent":false,"postMessage":false,"Presentation":false,"PresentationAvailability":false,"PresentationConnection":false,"PresentationConnectionAvailableEvent":false,"PresentationConnectionCloseEvent":false,"PresentationConnectionList":false,"PresentationReceiver":false,"PresentationRequest":false,"print":false,"ProcessingInstruction":false,"ProgressEvent":false,"PromiseRejectionEvent":false,"prompt":false,"PushManager":false,"PushSubscription":false,"PushSubscriptionOptions":false,"queueMicrotask":false,"RadioNodeList":false,"Range":false,"ReadableStream":false,"registerProcessor":false,"RemotePlayback":false,"removeEventListener":false,"Request":false,"requestAnimationFrame":false,"requestIdleCallback":false,"resizeBy":false,"ResizeObserver":false,"ResizeObserverEntry":false,"resizeTo":false,"Response":false,"RTCCertificate":false,"RTCDataChannel":false,"RTCDataChannelEvent":false,"RTCDtlsTransport":false,"RTCIceCandidate":false,"RTCIceGatherer":false,"RTCIceTransport":false,"RTCPeerConnection":false,"RTCPeerConnectionIceEvent":false,"RTCRtpContributingSource":false,"RTCRtpReceiver":false,"RTCRtpSender":false,"RTCSctpTransport":false,"RTCSessionDescription":false,"RTCStatsReport":false,"RTCTrackEvent":false,"screen":false,"Screen":false,"screenLeft":false,"ScreenOrientation":false,"screenTop":false,"screenX":false,"screenY":false,"ScriptProcessorNode":false,"scroll":false,"scrollbars":false,"scrollBy":false,"scrollTo":false,"scrollX":false,"scrollY":false,"SecurityPolicyViolationEvent":false,"Selection":false,"self":false,"ServiceWorker":false,"ServiceWorkerContainer":false,"ServiceWorkerRegistration":false,"sessionStorage":false,"setInterval":false,"setTimeout":false,"ShadowRoot":false,"SharedWorker":false,"SourceBuffer":false,"SourceBufferList":false,"speechSynthesis":false,"SpeechSynthesisEvent":false,"SpeechSynthesisUtterance":false,"StaticRange":false,"status":false,"statusbar":false,"StereoPannerNode":false,"stop":false,"Storage":false,"StorageEvent":false,"StorageManager":false,"styleMedia":false,"StyleSheet":false,"StyleSheetList":false,"SubtleCrypto":false,"SVGAElement":false,"SVGAngle":false,"SVGAnimatedAngle":false,"SVGAnimatedBoolean":false,"SVGAnimatedEnumeration":false,"SVGAnimatedInteger":false,"SVGAnimatedLength":false,"SVGAnimatedLengthList":false,"SVGAnimatedNumber":false,"SVGAnimatedNumberList":false,"SVGAnimatedPreserveAspectRatio":false,"SVGAnimatedRect":false,"SVGAnimatedString":false,"SVGAnimatedTransformList":false,"SVGAnimateElement":false,"SVGAnimateMotionElement":false,"SVGAnimateTransformElement":false,"SVGAnimationElement":false,"SVGCircleElement":false,"SVGClipPathElement":false,"SVGComponentTransferFunctionElement":false,"SVGDefsElement":false,"SVGDescElement":false,"SVGDiscardElement":false,"SVGElement":false,"SVGEllipseElement":false,"SVGFEBlendElement":false,"SVGFEColorMatrixElement":false,"SVGFEComponentTransferElement":false,"SVGFECompositeElement":false,"SVGFEConvolveMatrixElement":false,"SVGFEDiffuseLightingElement":false,"SVGFEDisplacementMapElement":false,"SVGFEDistantLightElement":false,"SVGFEDropShadowElement":false,"SVGFEFloodElement":false,"SVGFEFuncAElement":false,"SVGFEFuncBElement":false,"SVGFEFuncGElement":false,"SVGFEFuncRElement":false,"SVGFEGaussianBlurElement":false,"SVGFEImageElement":false,"SVGFEMergeElement":false,"SVGFEMergeNodeElement":false,"SVGFEMorphologyElement":false,"SVGFEOffsetElement":false,"SVGFEPointLightElement":false,"SVGFESpecularLightingElement":false,"SVGFESpotLightElement":false,"SVGFETileElement":false,"SVGFETurbulenceElement":false,"SVGFilterElement":false,"SVGForeignObjectElement":false,"SVGGElement":false,"SVGGeometryElement":false,"SVGGradientElement":false,"SVGGraphicsElement":false,"SVGImageElement":false,"SVGLength":false,"SVGLengthList":false,"SVGLinearGradientElement":false,"SVGLineElement":false,"SVGMarkerElement":false,"SVGMaskElement":false,"SVGMatrix":false,"SVGMetadataElement":false,"SVGMPathElement":false,"SVGNumber":false,"SVGNumberList":false,"SVGPathElement":false,"SVGPatternElement":false,"SVGPoint":false,"SVGPointList":false,"SVGPolygonElement":false,"SVGPolylineElement":false,"SVGPreserveAspectRatio":false,"SVGRadialGradientElement":false,"SVGRect":false,"SVGRectElement":false,"SVGScriptElement":false,"SVGSetElement":false,"SVGStopElement":false,"SVGStringList":false,"SVGStyleElement":false,"SVGSVGElement":false,"SVGSwitchElement":false,"SVGSymbolElement":false,"SVGTextContentElement":false,"SVGTextElement":false,"SVGTextPathElement":false,"SVGTextPositioningElement":false,"SVGTitleElement":false,"SVGTransform":false,"SVGTransformList":false,"SVGTSpanElement":false,"SVGUnitTypes":false,"SVGUseElement":false,"SVGViewElement":false,"TaskAttributionTiming":false,"Text":false,"TextDecoder":false,"TextEncoder":false,"TextEvent":false,"TextMetrics":false,"TextTrack":false,"TextTrackCue":false,"TextTrackCueList":false,"TextTrackList":false,"TimeRanges":false,"toolbar":false,"top":false,"Touch":false,"TouchEvent":false,"TouchList":false,"TrackEvent":false,"TransitionEvent":false,"TreeWalker":false,"UIEvent":false,"URL":false,"URLSearchParams":false,"ValidityState":false,"visualViewport":false,"VisualViewport":false,"VTTCue":false,"WaveShaperNode":false,"WebAssembly":false,"WebGL2RenderingContext":false,"WebGLActiveInfo":false,"WebGLBuffer":false,"WebGLContextEvent":false,"WebGLFramebuffer":false,"WebGLProgram":false,"WebGLQuery":false,"WebGLRenderbuffer":false,"WebGLRenderingContext":false,"WebGLSampler":false,"WebGLShader":false,"WebGLShaderPrecisionFormat":false,"WebGLSync":false,"WebGLTexture":false,"WebGLTransformFeedback":false,"WebGLUniformLocation":false,"WebGLVertexArrayObject":false,"WebSocket":false,"WheelEvent":false,"window":false,"Window":false,"Worker":false,"WritableStream":false,"XMLDocument":false,"XMLHttpRequest":false,"XMLHttpRequestEventTarget":false,"XMLHttpRequestUpload":false,"XMLSerializer":false,"XPathEvaluator":false,"XPathExpression":false,"XPathResult":false,"XSLTProcessor":false},"worker":{"addEventListener":false,"applicationCache":false,"atob":false,"Blob":false,"BroadcastChannel":false,"btoa":false,"Cache":false,"caches":false,"clearInterval":false,"clearTimeout":false,"close":true,"console":false,"fetch":false,"FileReaderSync":false,"FormData":false,"Headers":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"ImageData":false,"importScripts":true,"indexedDB":false,"location":false,"MessageChannel":false,"MessagePort":false,"name":false,"navigator":false,"Notification":false,"onclose":true,"onconnect":true,"onerror":true,"onlanguagechange":true,"onmessage":true,"onoffline":true,"ononline":true,"onrejectionhandled":true,"onunhandledrejection":true,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"postMessage":true,"Promise":false,"queueMicrotask":false,"removeEventListener":false,"Request":false,"Response":false,"self":true,"ServiceWorkerRegistration":false,"setInterval":false,"setTimeout":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false,"WebSocket":false,"Worker":false,"WorkerGlobalScope":false,"XMLHttpRequest":false},"node":{"__dirname":false,"__filename":false,"AbortController":false,"Buffer":false,"clearImmediate":false,"clearInterval":false,"clearTimeout":false,"console":false,"exports":true,"global":false,"Intl":false,"module":false,"process":false,"queueMicrotask":false,"require":false,"setImmediate":false,"setInterval":false,"setTimeout":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false},"nodeBuiltin":{"AbortController":false,"Buffer":false,"clearImmediate":false,"clearInterval":false,"clearTimeout":false,"console":false,"global":false,"Intl":false,"process":false,"queueMicrotask":false,"setImmediate":false,"setInterval":false,"setTimeout":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false},"commonjs":{"exports":true,"global":false,"module":false,"require":false},"amd":{"define":false,"require":false},"mocha":{"after":false,"afterEach":false,"before":false,"beforeEach":false,"context":false,"describe":false,"it":false,"mocha":false,"run":false,"setup":false,"specify":false,"suite":false,"suiteSetup":false,"suiteTeardown":false,"teardown":false,"test":false,"xcontext":false,"xdescribe":false,"xit":false,"xspecify":false},"jasmine":{"afterAll":false,"afterEach":false,"beforeAll":false,"beforeEach":false,"describe":false,"expect":false,"expectAsync":false,"fail":false,"fdescribe":false,"fit":false,"it":false,"jasmine":false,"pending":false,"runs":false,"spyOn":false,"spyOnAllFunctions":false,"spyOnProperty":false,"waits":false,"waitsFor":false,"xdescribe":false,"xit":false},"jest":{"afterAll":false,"afterEach":false,"beforeAll":false,"beforeEach":false,"describe":false,"expect":false,"fdescribe":false,"fit":false,"it":false,"jest":false,"pit":false,"require":false,"test":false,"xdescribe":false,"xit":false,"xtest":false},"qunit":{"asyncTest":false,"deepEqual":false,"equal":false,"expect":false,"module":false,"notDeepEqual":false,"notEqual":false,"notOk":false,"notPropEqual":false,"notStrictEqual":false,"ok":false,"propEqual":false,"QUnit":false,"raises":false,"start":false,"stop":false,"strictEqual":false,"test":false,"throws":false},"phantomjs":{"console":true,"exports":true,"phantom":true,"require":true,"WebPage":true},"couch":{"emit":false,"exports":false,"getRow":false,"log":false,"module":false,"provides":false,"require":false,"respond":false,"send":false,"start":false,"sum":false},"rhino":{"defineClass":false,"deserialize":false,"gc":false,"help":false,"importClass":false,"importPackage":false,"java":false,"load":false,"loadClass":false,"Packages":false,"print":false,"quit":false,"readFile":false,"readUrl":false,"runCommand":false,"seal":false,"serialize":false,"spawn":false,"sync":false,"toint32":false,"version":false},"nashorn":{"__DIR__":false,"__FILE__":false,"__LINE__":false,"com":false,"edu":false,"exit":false,"java":false,"Java":false,"javafx":false,"JavaImporter":false,"javax":false,"JSAdapter":false,"load":false,"loadWithNewGlobal":false,"org":false,"Packages":false,"print":false,"quit":false},"wsh":{"ActiveXObject":false,"CollectGarbage":false,"Debug":false,"Enumerator":false,"GetObject":false,"RuntimeObject":false,"ScriptEngine":false,"ScriptEngineBuildVersion":false,"ScriptEngineMajorVersion":false,"ScriptEngineMinorVersion":false,"VBArray":false,"WScript":false,"WSH":false},"jquery":{"$":false,"jQuery":false},"yui":{"YAHOO":false,"YAHOO_config":false,"YUI":false,"YUI_config":false},"shelljs":{"cat":false,"cd":false,"chmod":false,"config":false,"cp":false,"dirs":false,"echo":false,"env":false,"error":false,"exec":false,"exit":false,"find":false,"grep":false,"ln":false,"ls":false,"mkdir":false,"mv":false,"popd":false,"pushd":false,"pwd":false,"rm":false,"sed":false,"set":false,"target":false,"tempdir":false,"test":false,"touch":false,"which":false},"prototypejs":{"$":false,"$$":false,"$A":false,"$break":false,"$continue":false,"$F":false,"$H":false,"$R":false,"$w":false,"Abstract":false,"Ajax":false,"Autocompleter":false,"Builder":false,"Class":false,"Control":false,"Draggable":false,"Draggables":false,"Droppables":false,"Effect":false,"Element":false,"Enumerable":false,"Event":false,"Field":false,"Form":false,"Hash":false,"Insertion":false,"ObjectRange":false,"PeriodicalExecuter":false,"Position":false,"Prototype":false,"Scriptaculous":false,"Selector":false,"Sortable":false,"SortableObserver":false,"Sound":false,"Template":false,"Toggle":false,"Try":false},"meteor":{"$":false,"Accounts":false,"AccountsClient":false,"AccountsCommon":false,"AccountsServer":false,"App":false,"Assets":false,"Blaze":false,"check":false,"Cordova":false,"DDP":false,"DDPRateLimiter":false,"DDPServer":false,"Deps":false,"EJSON":false,"Email":false,"HTTP":false,"Log":false,"Match":false,"Meteor":false,"Mongo":false,"MongoInternals":false,"Npm":false,"Package":false,"Plugin":false,"process":false,"Random":false,"ReactiveDict":false,"ReactiveVar":false,"Router":false,"ServiceConfiguration":false,"Session":false,"share":false,"Spacebars":false,"Template":false,"Tinytest":false,"Tracker":false,"UI":false,"Utils":false,"WebApp":false,"WebAppInternals":false},"mongo":{"_isWindows":false,"_rand":false,"BulkWriteResult":false,"cat":false,"cd":false,"connect":false,"db":false,"getHostName":false,"getMemInfo":false,"hostname":false,"ISODate":false,"listFiles":false,"load":false,"ls":false,"md5sumFile":false,"mkdir":false,"Mongo":false,"NumberInt":false,"NumberLong":false,"ObjectId":false,"PlanCache":false,"print":false,"printjson":false,"pwd":false,"quit":false,"removeFile":false,"rs":false,"sh":false,"UUID":false,"version":false,"WriteResult":false},"applescript":{"$":false,"Application":false,"Automation":false,"console":false,"delay":false,"Library":false,"ObjC":false,"ObjectSpecifier":false,"Path":false,"Progress":false,"Ref":false},"serviceworker":{"addEventListener":false,"applicationCache":false,"atob":false,"Blob":false,"BroadcastChannel":false,"btoa":false,"Cache":false,"caches":false,"CacheStorage":false,"clearInterval":false,"clearTimeout":false,"Client":false,"clients":false,"Clients":false,"close":true,"console":false,"ExtendableEvent":false,"ExtendableMessageEvent":false,"fetch":false,"FetchEvent":false,"FileReaderSync":false,"FormData":false,"Headers":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"ImageData":false,"importScripts":false,"indexedDB":false,"location":false,"MessageChannel":false,"MessagePort":false,"name":false,"navigator":false,"Notification":false,"onclose":true,"onconnect":true,"onerror":true,"onfetch":true,"oninstall":true,"onlanguagechange":true,"onmessage":true,"onmessageerror":true,"onnotificationclick":true,"onnotificationclose":true,"onoffline":true,"ononline":true,"onpush":true,"onpushsubscriptionchange":true,"onrejectionhandled":true,"onsync":true,"onunhandledrejection":true,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"postMessage":true,"Promise":false,"queueMicrotask":false,"registration":false,"removeEventListener":false,"Request":false,"Response":false,"self":false,"ServiceWorker":false,"ServiceWorkerContainer":false,"ServiceWorkerGlobalScope":false,"ServiceWorkerMessageEvent":false,"ServiceWorkerRegistration":false,"setInterval":false,"setTimeout":false,"skipWaiting":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false,"WebSocket":false,"WindowClient":false,"Worker":false,"WorkerGlobalScope":false,"XMLHttpRequest":false},"atomtest":{"advanceClock":false,"atom":false,"fakeClearInterval":false,"fakeClearTimeout":false,"fakeSetInterval":false,"fakeSetTimeout":false,"resetTimeouts":false,"waitsForPromise":false},"embertest":{"andThen":false,"click":false,"currentPath":false,"currentRouteName":false,"currentURL":false,"fillIn":false,"find":false,"findAll":false,"findWithAssert":false,"keyEvent":false,"pauseTest":false,"resumeTest":false,"triggerEvent":false,"visit":false,"wait":false},"protractor":{"$":false,"$$":false,"browser":false,"by":false,"By":false,"DartObject":false,"element":false,"protractor":false},"shared-node-browser":{"clearInterval":false,"clearTimeout":false,"console":false,"setInterval":false,"setTimeout":false,"URL":false,"URLSearchParams":false},"webextensions":{"browser":false,"chrome":false,"opr":false},"greasemonkey":{"cloneInto":false,"createObjectIn":false,"exportFunction":false,"GM":false,"GM_addElement":false,"GM_addStyle":false,"GM_addValueChangeListener":false,"GM_deleteValue":false,"GM_download":false,"GM_getResourceText":false,"GM_getResourceURL":false,"GM_getTab":false,"GM_getTabs":false,"GM_getValue":false,"GM_info":false,"GM_listValues":false,"GM_log":false,"GM_notification":false,"GM_openInTab":false,"GM_registerMenuCommand":false,"GM_removeValueChangeListener":false,"GM_saveTab":false,"GM_setClipboard":false,"GM_setValue":false,"GM_unregisterMenuCommand":false,"GM_xmlhttpRequest":false,"unsafeWindow":false},"devtools":{"$":false,"$_":false,"$$":false,"$0":false,"$1":false,"$2":false,"$3":false,"$4":false,"$x":false,"chrome":false,"clear":false,"copy":false,"debug":false,"dir":false,"dirxml":false,"getEventListeners":false,"inspect":false,"keys":false,"monitor":false,"monitorEvents":false,"profile":false,"profileEnd":false,"queryObjects":false,"table":false,"undebug":false,"unmonitor":false,"unmonitorEvents":false,"values":false}}'); +module.exports = JSON.parse('{"name":"eslint","version":"8.3.0","author":"Nicholas C. Zakas ","description":"An AST-based pattern checker for JavaScript.","bin":{"eslint":"./bin/eslint.js"},"main":"./lib/api.js","exports":{"./package.json":"./package.json",".":"./lib/api.js","./use-at-your-own-risk":"./lib/unsupported-api.js"},"scripts":{"test":"node Makefile.js test","test:cli":"mocha","lint":"node Makefile.js lint","fix":"node Makefile.js lint -- fix","fuzz":"node Makefile.js fuzz","generate-release":"node Makefile.js generateRelease","generate-alpharelease":"node Makefile.js generatePrerelease -- alpha","generate-betarelease":"node Makefile.js generatePrerelease -- beta","generate-rcrelease":"node Makefile.js generatePrerelease -- rc","publish-release":"node Makefile.js publishRelease","gensite":"node Makefile.js gensite","webpack":"node Makefile.js webpack","perf":"node Makefile.js perf"},"gitHooks":{"pre-commit":"lint-staged"},"lint-staged":{"*.js":"eslint --fix","*.md":"markdownlint"},"files":["LICENSE","README.md","bin","conf","lib","messages"],"repository":"eslint/eslint","funding":"https://opencollective.com/eslint","homepage":"https://eslint.org","bugs":"https://github.com/eslint/eslint/issues/","dependencies":{"@eslint/eslintrc":"^1.0.4","@humanwhocodes/config-array":"^0.6.0","ajv":"^6.10.0","chalk":"^4.0.0","cross-spawn":"^7.0.2","debug":"^4.3.2","doctrine":"^3.0.0","enquirer":"^2.3.5","escape-string-regexp":"^4.0.0","eslint-scope":"^7.1.0","eslint-utils":"^3.0.0","eslint-visitor-keys":"^3.1.0","espree":"^9.1.0","esquery":"^1.4.0","esutils":"^2.0.2","fast-deep-equal":"^3.1.3","file-entry-cache":"^6.0.1","functional-red-black-tree":"^1.0.1","glob-parent":"^6.0.1","globals":"^13.6.0","ignore":"^4.0.6","import-fresh":"^3.0.0","imurmurhash":"^0.1.4","is-glob":"^4.0.0","js-yaml":"^4.1.0","json-stable-stringify-without-jsonify":"^1.0.1","levn":"^0.4.1","lodash.merge":"^4.6.2","minimatch":"^3.0.4","natural-compare":"^1.4.0","optionator":"^0.9.1","progress":"^2.0.0","regexpp":"^3.2.0","semver":"^7.2.1","strip-ansi":"^6.0.1","strip-json-comments":"^3.1.0","text-table":"^0.2.0","v8-compile-cache":"^2.0.3"},"devDependencies":{"@babel/core":"^7.4.3","@babel/preset-env":"^7.4.3","babel-loader":"^8.0.5","chai":"^4.0.1","cheerio":"^0.22.0","common-tags":"^1.8.0","core-js":"^3.1.3","dateformat":"^4.5.1","ejs":"^3.0.2","eslint":"file:.","eslint-config-eslint":"file:packages/eslint-config-eslint","eslint-plugin-eslint-comments":"^3.2.0","eslint-plugin-eslint-plugin":"^4.0.1","eslint-plugin-internal-rules":"file:tools/internal-rules","eslint-plugin-jsdoc":"^37.0.0","eslint-plugin-node":"^11.1.0","eslint-release":"^3.2.0","eslump":"^3.0.0","esprima":"^4.0.1","fs-teardown":"^0.1.3","glob":"^7.1.6","jsdoc":"^3.5.5","karma":"^6.1.1","karma-chrome-launcher":"^3.1.0","karma-mocha":"^2.0.1","karma-mocha-reporter":"^2.2.5","karma-webpack":"^5.0.0","lint-staged":"^11.0.0","load-perf":"^0.2.0","markdownlint":"^0.23.1","markdownlint-cli":"^0.28.1","memfs":"^3.0.1","mocha":"^8.3.2","mocha-junit-reporter":"^2.0.0","node-polyfill-webpack-plugin":"^1.0.3","npm-license":"^0.3.3","nyc":"^15.0.1","proxyquire":"^2.0.1","puppeteer":"^9.1.1","recast":"^0.20.4","regenerator-runtime":"^0.13.2","shelljs":"^0.8.2","sinon":"^11.0.0","temp":"^0.9.0","webpack":"^5.23.0","webpack-cli":"^4.5.0","yorkie":"^2.0.0"},"keywords":["ast","lint","javascript","ecmascript","espree"],"license":"MIT","engines":{"node":"^12.22.0 || ^14.17.0 || >=16.0.0"}}'); /***/ }), -/* 438 */ -/***/ ((module) => { - -"use strict"; -module.exports = JSON.parse('{"name":"eslint","version":"7.28.0","author":"Nicholas C. Zakas ","description":"An AST-based pattern checker for JavaScript.","bin":{"eslint":"./bin/eslint.js"},"main":"./lib/api.js","scripts":{"test":"node Makefile.js test","test:cli":"mocha","lint":"node Makefile.js lint","fix":"node Makefile.js lint -- fix","fuzz":"node Makefile.js fuzz","generate-release":"node Makefile.js generateRelease","generate-alpharelease":"node Makefile.js generatePrerelease -- alpha","generate-betarelease":"node Makefile.js generatePrerelease -- beta","generate-rcrelease":"node Makefile.js generatePrerelease -- rc","publish-release":"node Makefile.js publishRelease","docs":"node Makefile.js docs","gensite":"node Makefile.js gensite","webpack":"node Makefile.js webpack","perf":"node Makefile.js perf"},"gitHooks":{"pre-commit":"lint-staged"},"lint-staged":{"*.js":"eslint --fix","*.md":"markdownlint"},"files":["LICENSE","README.md","bin","conf","lib","messages"],"repository":"eslint/eslint","funding":"https://opencollective.com/eslint","homepage":"https://eslint.org","bugs":"https://github.com/eslint/eslint/issues/","dependencies":{"@babel/code-frame":"7.12.11","@eslint/eslintrc":"^0.4.2","ajv":"^6.10.0","chalk":"^4.0.0","cross-spawn":"^7.0.2","debug":"^4.0.1","doctrine":"^3.0.0","enquirer":"^2.3.5","escape-string-regexp":"^4.0.0","eslint-scope":"^5.1.1","eslint-utils":"^2.1.0","eslint-visitor-keys":"^2.0.0","espree":"^7.3.1","esquery":"^1.4.0","esutils":"^2.0.2","fast-deep-equal":"^3.1.3","file-entry-cache":"^6.0.1","functional-red-black-tree":"^1.0.1","glob-parent":"^5.1.2","globals":"^13.6.0","ignore":"^4.0.6","import-fresh":"^3.0.0","imurmurhash":"^0.1.4","is-glob":"^4.0.0","js-yaml":"^3.13.1","json-stable-stringify-without-jsonify":"^1.0.1","levn":"^0.4.1","lodash.merge":"^4.6.2","minimatch":"^3.0.4","natural-compare":"^1.4.0","optionator":"^0.9.1","progress":"^2.0.0","regexpp":"^3.1.0","semver":"^7.2.1","strip-ansi":"^6.0.0","strip-json-comments":"^3.1.0","table":"^6.0.9","text-table":"^0.2.0","v8-compile-cache":"^2.0.3"},"devDependencies":{"@babel/core":"^7.4.3","@babel/preset-env":"^7.4.3","babel-loader":"^8.0.5","chai":"^4.0.1","cheerio":"^0.22.0","common-tags":"^1.8.0","core-js":"^3.1.3","dateformat":"^3.0.3","ejs":"^3.0.2","eslint":"file:.","eslint-config-eslint":"file:packages/eslint-config-eslint","eslint-plugin-eslint-plugin":"^3.0.3","eslint-plugin-internal-rules":"file:tools/internal-rules","eslint-plugin-jsdoc":"^25.4.3","eslint-plugin-node":"^11.1.0","eslint-release":"^2.0.0","eslump":"^3.0.0","esprima":"^4.0.1","fs-teardown":"^0.1.0","glob":"^7.1.6","jsdoc":"^3.5.5","karma":"^6.1.1","karma-chrome-launcher":"^3.1.0","karma-mocha":"^2.0.1","karma-mocha-reporter":"^2.2.5","karma-webpack":"^5.0.0","lint-staged":"^10.1.2","load-perf":"^0.2.0","markdownlint":"^0.19.0","markdownlint-cli":"^0.22.0","memfs":"^3.0.1","mocha":"^8.3.2","mocha-junit-reporter":"^2.0.0","node-polyfill-webpack-plugin":"^1.0.3","npm-license":"^0.3.3","nyc":"^15.0.1","proxyquire":"^2.0.1","puppeteer":"^7.1.0","recast":"^0.19.0","regenerator-runtime":"^0.13.2","shelljs":"^0.8.2","sinon":"^9.0.1","temp":"^0.9.0","webpack":"^5.23.0","webpack-cli":"^4.5.0","yorkie":"^2.0.0"},"keywords":["ast","lint","javascript","ecmascript","espree"],"license":"MIT","engines":{"node":"^10.12.0 || >=12.0.0"}}'); - -/***/ }), -/* 439 */ +/* 444 */ /***/ ((module) => { "use strict"; @@ -33206,612 +34248,188 @@ module.exports = { }; /***/ }), -/* 440 */ -/***/ ((module) => { +/* 445 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; +/* provided dependency */ var process = __webpack_require__(494); + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var util = __webpack_require__(439); +var path = __webpack_require__(429); +var Ajv = __webpack_require__(446); +var globals = __webpack_require__(492); + +function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + +var util__default = /*#__PURE__*/_interopDefaultLegacy(util); +var path__default = /*#__PURE__*/_interopDefaultLegacy(path); +var Ajv__default = /*#__PURE__*/_interopDefaultLegacy(Ajv); +var globals__default = /*#__PURE__*/_interopDefaultLegacy(globals); + /** * @fileoverview Config file operations. This file must be usable in the browser, * so no Node-specific code can be here. * @author Nicholas C. Zakas */ - //------------------------------------------------------------------------------ + +//------------------------------------------------------------------------------ // Private //------------------------------------------------------------------------------ const RULE_SEVERITY_STRINGS = ["off", "warn", "error"], - RULE_SEVERITY = RULE_SEVERITY_STRINGS.reduce((map, value, index) => { - map[value] = index; - return map; -}, {}), - VALID_SEVERITIES = [0, 1, 2, "off", "warn", "error"]; //------------------------------------------------------------------------------ + RULE_SEVERITY = RULE_SEVERITY_STRINGS.reduce((map, value, index) => { + map[value] = index; + return map; + }, {}), + VALID_SEVERITIES = [0, 1, 2, "off", "warn", "error"]; + +//------------------------------------------------------------------------------ // Public Interface //------------------------------------------------------------------------------ -module.exports = { - /** - * Normalizes the severity value of a rule's configuration to a number - * @param {(number|string|[number, ...*]|[string, ...*])} ruleConfig A rule's configuration value, generally - * received from the user. A valid config value is either 0, 1, 2, the string "off" (treated the same as 0), - * the string "warn" (treated the same as 1), the string "error" (treated the same as 2), or an array - * whose first element is one of the above values. Strings are matched case-insensitively. - * @returns {(0|1|2)} The numeric severity value if the config value was valid, otherwise 0. - */ - getRuleSeverity(ruleConfig) { +/** + * Normalizes the severity value of a rule's configuration to a number + * @param {(number|string|[number, ...*]|[string, ...*])} ruleConfig A rule's configuration value, generally + * received from the user. A valid config value is either 0, 1, 2, the string "off" (treated the same as 0), + * the string "warn" (treated the same as 1), the string "error" (treated the same as 2), or an array + * whose first element is one of the above values. Strings are matched case-insensitively. + * @returns {(0|1|2)} The numeric severity value if the config value was valid, otherwise 0. + */ +function getRuleSeverity(ruleConfig) { const severityValue = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig; if (severityValue === 0 || severityValue === 1 || severityValue === 2) { - return severityValue; + return severityValue; } if (typeof severityValue === "string") { - return RULE_SEVERITY[severityValue.toLowerCase()] || 0; + return RULE_SEVERITY[severityValue.toLowerCase()] || 0; } return 0; - }, +} + +/** + * Converts old-style severity settings (0, 1, 2) into new-style + * severity settings (off, warn, error) for all rules. Assumption is that severity + * values have already been validated as correct. + * @param {Object} config The config object to normalize. + * @returns {void} + */ +function normalizeToStrings(config) { - /** - * Converts old-style severity settings (0, 1, 2) into new-style - * severity settings (off, warn, error) for all rules. Assumption is that severity - * values have already been validated as correct. - * @param {Object} config The config object to normalize. - * @returns {void} - */ - normalizeToStrings(config) { if (config.rules) { - Object.keys(config.rules).forEach(ruleId => { - const ruleConfig = config.rules[ruleId]; + Object.keys(config.rules).forEach(ruleId => { + const ruleConfig = config.rules[ruleId]; - if (typeof ruleConfig === "number") { - config.rules[ruleId] = RULE_SEVERITY_STRINGS[ruleConfig] || RULE_SEVERITY_STRINGS[0]; - } else if (Array.isArray(ruleConfig) && typeof ruleConfig[0] === "number") { - ruleConfig[0] = RULE_SEVERITY_STRINGS[ruleConfig[0]] || RULE_SEVERITY_STRINGS[0]; - } - }); + if (typeof ruleConfig === "number") { + config.rules[ruleId] = RULE_SEVERITY_STRINGS[ruleConfig] || RULE_SEVERITY_STRINGS[0]; + } else if (Array.isArray(ruleConfig) && typeof ruleConfig[0] === "number") { + ruleConfig[0] = RULE_SEVERITY_STRINGS[ruleConfig[0]] || RULE_SEVERITY_STRINGS[0]; + } + }); } - }, +} - /** - * Determines if the severity for the given rule configuration represents an error. - * @param {int|string|Array} ruleConfig The configuration for an individual rule. - * @returns {boolean} True if the rule represents an error, false if not. - */ - isErrorSeverity(ruleConfig) { - return module.exports.getRuleSeverity(ruleConfig) === 2; - }, +/** + * Determines if the severity for the given rule configuration represents an error. + * @param {int|string|Array} ruleConfig The configuration for an individual rule. + * @returns {boolean} True if the rule represents an error, false if not. + */ +function isErrorSeverity(ruleConfig) { + return getRuleSeverity(ruleConfig) === 2; +} - /** - * Checks whether a given config has valid severity or not. - * @param {number|string|Array} ruleConfig The configuration for an individual rule. - * @returns {boolean} `true` if the configuration has valid severity. - */ - isValidSeverity(ruleConfig) { +/** + * Checks whether a given config has valid severity or not. + * @param {number|string|Array} ruleConfig The configuration for an individual rule. + * @returns {boolean} `true` if the configuration has valid severity. + */ +function isValidSeverity(ruleConfig) { let severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig; if (typeof severity === "string") { - severity = severity.toLowerCase(); + severity = severity.toLowerCase(); } - return VALID_SEVERITIES.indexOf(severity) !== -1; - }, +} - /** - * Checks whether every rule of a given config has valid severity or not. - * @param {Object} config The configuration for rules. - * @returns {boolean} `true` if the configuration has valid severity. - */ - isEverySeverityValid(config) { - return Object.keys(config).every(ruleId => this.isValidSeverity(config[ruleId])); - }, +/** + * Checks whether every rule of a given config has valid severity or not. + * @param {Object} config The configuration for rules. + * @returns {boolean} `true` if the configuration has valid severity. + */ +function isEverySeverityValid(config) { + return Object.keys(config).every(ruleId => isValidSeverity(config[ruleId])); +} - /** - * Normalizes a value for a global in a config - * @param {(boolean|string|null)} configuredValue The value given for a global in configuration or in - * a global directive comment - * @returns {("readable"|"writeable"|"off")} The value normalized as a string - * @throws Error if global value is invalid - */ - normalizeConfigGlobal(configuredValue) { +/** + * Normalizes a value for a global in a config + * @param {(boolean|string|null)} configuredValue The value given for a global in configuration or in + * a global directive comment + * @returns {("readable"|"writeable"|"off")} The value normalized as a string + * @throws Error if global value is invalid + */ +function normalizeConfigGlobal(configuredValue) { switch (configuredValue) { - case "off": - return "off"; + case "off": + return "off"; - case true: - case "true": - case "writeable": - case "writable": - return "writable"; + case true: + case "true": + case "writeable": + case "writable": + return "writable"; - case null: - case false: - case "false": - case "readable": - case "readonly": - return "readonly"; + case null: + case false: + case "false": + case "readable": + case "readonly": + return "readonly"; - default: - throw new Error(`'${configuredValue}' is not a valid configuration for a global (use 'readonly', 'writable', or 'off')`); + default: + throw new Error(`'${configuredValue}' is not a valid configuration for a global (use 'readonly', 'writable', or 'off')`); } - } +} +var ConfigOps = { + __proto__: null, + getRuleSeverity: getRuleSeverity, + normalizeToStrings: normalizeToStrings, + isErrorSeverity: isErrorSeverity, + isValidSeverity: isValidSeverity, + isEverySeverityValid: isEverySeverityValid, + normalizeConfigGlobal: normalizeConfigGlobal }; -/***/ }), -/* 441 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; -/** - * @fileoverview Validates configs. - * @author Brandon Mills - */ - -/* eslint class-methods-use-this: "off" */ -//------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const util = __webpack_require__(442), - configSchema = __webpack_require__(443), - BuiltInEnvironments = __webpack_require__(435), - ConfigOps = __webpack_require__(440), - { - emitDeprecationWarning -} = __webpack_require__(444); - -const ajv = __webpack_require__(446)(); - -const ruleValidators = new WeakMap(); -const noop = Function.prototype; //------------------------------------------------------------------------------ -// Private -//------------------------------------------------------------------------------ - -let validateSchema; -const severityMap = { - error: 2, - warn: 1, - off: 0 -}; -const validated = new WeakSet(); //----------------------------------------------------------------------------- -// Exports -//----------------------------------------------------------------------------- - -module.exports = class ConfigValidator { - constructor({ - builtInRules = new Map() - } = {}) { - this.builtInRules = builtInRules; - } - /** - * Gets a complete options schema for a rule. - * @param {{create: Function, schema: (Array|null)}} rule A new-style rule object - * @returns {Object} JSON Schema for the rule's options. - */ - - - getRuleOptionsSchema(rule) { - if (!rule) { - return null; - } - - const schema = rule.schema || rule.meta && rule.meta.schema; // Given a tuple of schemas, insert warning level at the beginning - - if (Array.isArray(schema)) { - if (schema.length) { - return { - type: "array", - items: schema, - minItems: 0, - maxItems: schema.length - }; - } - - return { - type: "array", - minItems: 0, - maxItems: 0 - }; - } // Given a full schema, leave it alone - - - return schema || null; - } - /** - * Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid. - * @param {options} options The given options for the rule. - * @returns {number|string} The rule's severity value - */ - - - validateRuleSeverity(options) { - const severity = Array.isArray(options) ? options[0] : options; - const normSeverity = typeof severity === "string" ? severityMap[severity.toLowerCase()] : severity; - - if (normSeverity === 0 || normSeverity === 1 || normSeverity === 2) { - return normSeverity; - } - - throw new Error(`\tSeverity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '${util.inspect(severity).replace(/'/gu, "\"").replace(/\n/gu, "")}').\n`); - } - /** - * Validates the non-severity options passed to a rule, based on its schema. - * @param {{create: Function}} rule The rule to validate - * @param {Array} localOptions The options for the rule, excluding severity - * @returns {void} - */ - - - validateRuleSchema(rule, localOptions) { - if (!ruleValidators.has(rule)) { - const schema = this.getRuleOptionsSchema(rule); - - if (schema) { - ruleValidators.set(rule, ajv.compile(schema)); - } - } - - const validateRule = ruleValidators.get(rule); - - if (validateRule) { - validateRule(localOptions); - - if (validateRule.errors) { - throw new Error(validateRule.errors.map(error => `\tValue ${JSON.stringify(error.data)} ${error.message}.\n`).join("")); - } - } - } - /** - * Validates a rule's options against its schema. - * @param {{create: Function}|null} rule The rule that the config is being validated for - * @param {string} ruleId The rule's unique name. - * @param {Array|number} options The given options for the rule. - * @param {string|null} source The name of the configuration source to report in any errors. If null or undefined, - * no source is prepended to the message. - * @returns {void} - */ - - - validateRuleOptions(rule, ruleId, options, source = null) { - try { - const severity = this.validateRuleSeverity(options); - - if (severity !== 0) { - this.validateRuleSchema(rule, Array.isArray(options) ? options.slice(1) : []); - } - } catch (err) { - const enhancedMessage = `Configuration for rule "${ruleId}" is invalid:\n${err.message}`; - - if (typeof source === "string") { - throw new Error(`${source}:\n\t${enhancedMessage}`); - } else { - throw new Error(enhancedMessage); - } - } - } - /** - * Validates an environment object - * @param {Object} environment The environment config object to validate. - * @param {string} source The name of the configuration source to report in any errors. - * @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded environments. - * @returns {void} - */ - - - validateEnvironment(environment, source, getAdditionalEnv = noop) { - // not having an environment is ok - if (!environment) { - return; - } - - Object.keys(environment).forEach(id => { - const env = getAdditionalEnv(id) || BuiltInEnvironments.get(id) || null; - - if (!env) { - const message = `${source}:\n\tEnvironment key "${id}" is unknown\n`; - throw new Error(message); - } - }); - } - /** - * Validates a rules config object - * @param {Object} rulesConfig The rules config object to validate. - * @param {string} source The name of the configuration source to report in any errors. - * @param {function(ruleId:string): Object} getAdditionalRule A map from strings to loaded rules - * @returns {void} - */ - - - validateRules(rulesConfig, source, getAdditionalRule = noop) { - if (!rulesConfig) { - return; - } - - Object.keys(rulesConfig).forEach(id => { - const rule = getAdditionalRule(id) || this.builtInRules.get(id) || null; - this.validateRuleOptions(rule, id, rulesConfig[id], source); - }); - } - /** - * Validates a `globals` section of a config file - * @param {Object} globalsConfig The `globals` section - * @param {string|null} source The name of the configuration source to report in the event of an error. - * @returns {void} - */ - - - validateGlobals(globalsConfig, source = null) { - if (!globalsConfig) { - return; - } - - Object.entries(globalsConfig).forEach(([configuredGlobal, configuredValue]) => { - try { - ConfigOps.normalizeConfigGlobal(configuredValue); - } catch (err) { - throw new Error(`ESLint configuration of global '${configuredGlobal}' in ${source} is invalid:\n${err.message}`); - } - }); - } - /** - * Validate `processor` configuration. - * @param {string|undefined} processorName The processor name. - * @param {string} source The name of config file. - * @param {function(id:string): Processor} getProcessor The getter of defined processors. - * @returns {void} - */ - - - validateProcessor(processorName, source, getProcessor) { - if (processorName && !getProcessor(processorName)) { - throw new Error(`ESLint configuration of processor in '${source}' is invalid: '${processorName}' was not found.`); - } - } - /** - * Formats an array of schema validation errors. - * @param {Array} errors An array of error messages to format. - * @returns {string} Formatted error message - */ - - - formatErrors(errors) { - return errors.map(error => { - if (error.keyword === "additionalProperties") { - const formattedPropertyPath = error.dataPath.length ? `${error.dataPath.slice(1)}.${error.params.additionalProperty}` : error.params.additionalProperty; - return `Unexpected top-level property "${formattedPropertyPath}"`; - } - - if (error.keyword === "type") { - const formattedField = error.dataPath.slice(1); - const formattedExpectedType = Array.isArray(error.schema) ? error.schema.join("/") : error.schema; - const formattedValue = JSON.stringify(error.data); - return `Property "${formattedField}" is the wrong type (expected ${formattedExpectedType} but got \`${formattedValue}\`)`; - } - - const field = error.dataPath[0] === "." ? error.dataPath.slice(1) : error.dataPath; - return `"${field}" ${error.message}. Value: ${JSON.stringify(error.data)}`; - }).map(message => `\t- ${message}.\n`).join(""); - } - /** - * Validates the top level properties of the config object. - * @param {Object} config The config object to validate. - * @param {string} source The name of the configuration source to report in any errors. - * @returns {void} - */ - - - validateConfigSchema(config, source = null) { - validateSchema = validateSchema || ajv.compile(configSchema); - - if (!validateSchema(config)) { - throw new Error(`ESLint configuration in ${source} is invalid:\n${this.formatErrors(validateSchema.errors)}`); - } - - if (Object.hasOwnProperty.call(config, "ecmaFeatures")) { - emitDeprecationWarning(source, "ESLINT_LEGACY_ECMAFEATURES"); - } - } - /** - * Validates an entire config object. - * @param {Object} config The config object to validate. - * @param {string} source The name of the configuration source to report in any errors. - * @param {function(ruleId:string): Object} [getAdditionalRule] A map from strings to loaded rules. - * @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded envs. - * @returns {void} - */ - - - validate(config, source, getAdditionalRule, getAdditionalEnv) { - this.validateConfigSchema(config, source); - this.validateRules(config.rules, source, getAdditionalRule); - this.validateEnvironment(config.env, source, getAdditionalEnv); - this.validateGlobals(config.globals, source); - - for (const override of config.overrides || []) { - this.validateRules(override.rules, source, getAdditionalRule); - this.validateEnvironment(override.env, source, getAdditionalEnv); - this.validateGlobals(config.globals, source); - } - } - /** - * Validate config array object. - * @param {ConfigArray} configArray The config array to validate. - * @returns {void} - */ - - - validateConfigArray(configArray) { - const getPluginEnv = Map.prototype.get.bind(configArray.pluginEnvironments); - const getPluginProcessor = Map.prototype.get.bind(configArray.pluginProcessors); - const getPluginRule = Map.prototype.get.bind(configArray.pluginRules); // Validate. - - for (const element of configArray) { - if (validated.has(element)) { - continue; - } - - validated.add(element); - this.validateEnvironment(element.env, element.name, getPluginEnv); - this.validateGlobals(element.globals, element.name); - this.validateProcessor(element.processor, element.name, getPluginProcessor); - this.validateRules(element.rules, element.name, getPluginRule); - } - } - -}; - -/***/ }), -/* 442 */ -/***/ ((module) => { - -"use strict"; -module.exports = require("util"); - -/***/ }), -/* 443 */ -/***/ ((module) => { - -"use strict"; -/** - * @fileoverview Defines a schema for configs. - * @author Sylvan Mably - */ - - -const baseConfigProperties = { - $schema: { - type: "string" - }, - env: { - type: "object" - }, - extends: { - $ref: "#/definitions/stringOrStrings" - }, - globals: { - type: "object" - }, - overrides: { - type: "array", - items: { - $ref: "#/definitions/overrideConfig" - }, - additionalItems: false - }, - parser: { - type: ["string", "null"] - }, - parserOptions: { - type: "object" - }, - plugins: { - type: "array" - }, - processor: { - type: "string" - }, - rules: { - type: "object" - }, - settings: { - type: "object" - }, - noInlineConfig: { - type: "boolean" - }, - reportUnusedDisableDirectives: { - type: "boolean" - }, - ecmaFeatures: { - type: "object" - } // deprecated; logs a warning when used - -}; -const configSchema = { - definitions: { - stringOrStrings: { - oneOf: [{ - type: "string" - }, { - type: "array", - items: { - type: "string" - }, - additionalItems: false - }] - }, - stringOrStringsRequired: { - oneOf: [{ - type: "string" - }, { - type: "array", - items: { - type: "string" - }, - additionalItems: false, - minItems: 1 - }] - }, - // Config at top-level. - objectConfig: { - type: "object", - properties: { - root: { - type: "boolean" - }, - ignorePatterns: { - $ref: "#/definitions/stringOrStrings" - }, - ...baseConfigProperties - }, - additionalProperties: false - }, - // Config in `overrides`. - overrideConfig: { - type: "object", - properties: { - excludedFiles: { - $ref: "#/definitions/stringOrStrings" - }, - files: { - $ref: "#/definitions/stringOrStringsRequired" - }, - ...baseConfigProperties - }, - required: ["files"], - additionalProperties: false - } - }, - $ref: "#/definitions/objectConfig" -}; -module.exports = configSchema; - -/***/ }), -/* 444 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; -/* provided dependency */ var process = __webpack_require__(445); /** * @fileoverview Provide the function that emits deprecation warnings. * @author Toru Nagashima */ - //------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ -const path = __webpack_require__(405); //------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ // Private //------------------------------------------------------------------------------ + // Defitions for deprecation warnings. - - const deprecationWarningMessages = { - ESLINT_LEGACY_ECMAFEATURES: "The 'ecmaFeatures' config file property is deprecated and has no effect.", - ESLINT_PERSONAL_CONFIG_LOAD: "'~/.eslintrc.*' config files have been deprecated. " + "Please use a config file per project or the '--config' option.", - ESLINT_PERSONAL_CONFIG_SUPPRESS: "'~/.eslintrc.*' config files have been deprecated. " + "Please remove it or add 'root:true' to the config files in your " + "projects in order to avoid loading '~/.eslintrc.*' accidentally." + ESLINT_LEGACY_ECMAFEATURES: + "The 'ecmaFeatures' config file property is deprecated and has no effect.", + ESLINT_PERSONAL_CONFIG_LOAD: + "'~/.eslintrc.*' config files have been deprecated. " + + "Please use a config file per project or the '--config' option.", + ESLINT_PERSONAL_CONFIG_SUPPRESS: + "'~/.eslintrc.*' config files have been deprecated. " + + "Please remove it or add 'root:true' to the config files in your " + + "projects in order to avoid loading '~/.eslintrc.*' accidentally." }; + const sourceFileErrorCache = new Set(); + /** * Emits a deprecation warning containing a given filepath. A new deprecation warning is emitted * for each unique file path, but repeated invocations with the same file path have no effect. @@ -33820,295 +34438,908 @@ const sourceFileErrorCache = new Set(); * @param {string} errorCode The warning message to show. * @returns {void} */ - function emitDeprecationWarning(source, errorCode) { - const cacheKey = JSON.stringify({ - source, - errorCode - }); + const cacheKey = JSON.stringify({ source, errorCode }); - if (sourceFileErrorCache.has(cacheKey)) { - return; - } + if (sourceFileErrorCache.has(cacheKey)) { + return; + } + sourceFileErrorCache.add(cacheKey); - sourceFileErrorCache.add(cacheKey); - const rel = path.relative(process.cwd(), source); - const message = deprecationWarningMessages[errorCode]; - process.emitWarning(`${message} (found in "${rel}")`, "DeprecationWarning", errorCode); -} //------------------------------------------------------------------------------ + const rel = path__default["default"].relative(process.cwd(), source); + const message = deprecationWarningMessages[errorCode]; + + process.emitWarning( + `${message} (found in "${rel}")`, + "DeprecationWarning", + errorCode + ); +} + +/** + * @fileoverview The instance of Ajv validator. + * @author Evgeny Poberezkin + */ + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +/* + * Copied from ajv/lib/refs/json-schema-draft-04.json + * The MIT License (MIT) + * Copyright (c) 2015-2017 Evgeny Poberezkin + */ +const metaSchema = { + id: "http://json-schema.org/draft-04/schema#", + $schema: "http://json-schema.org/draft-04/schema#", + description: "Core schema meta-schema", + definitions: { + schemaArray: { + type: "array", + minItems: 1, + items: { $ref: "#" } + }, + positiveInteger: { + type: "integer", + minimum: 0 + }, + positiveIntegerDefault0: { + allOf: [{ $ref: "#/definitions/positiveInteger" }, { default: 0 }] + }, + simpleTypes: { + enum: ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + stringArray: { + type: "array", + items: { type: "string" }, + minItems: 1, + uniqueItems: true + } + }, + type: "object", + properties: { + id: { + type: "string" + }, + $schema: { + type: "string" + }, + title: { + type: "string" + }, + description: { + type: "string" + }, + default: { }, + multipleOf: { + type: "number", + minimum: 0, + exclusiveMinimum: true + }, + maximum: { + type: "number" + }, + exclusiveMaximum: { + type: "boolean", + default: false + }, + minimum: { + type: "number" + }, + exclusiveMinimum: { + type: "boolean", + default: false + }, + maxLength: { $ref: "#/definitions/positiveInteger" }, + minLength: { $ref: "#/definitions/positiveIntegerDefault0" }, + pattern: { + type: "string", + format: "regex" + }, + additionalItems: { + anyOf: [ + { type: "boolean" }, + { $ref: "#" } + ], + default: { } + }, + items: { + anyOf: [ + { $ref: "#" }, + { $ref: "#/definitions/schemaArray" } + ], + default: { } + }, + maxItems: { $ref: "#/definitions/positiveInteger" }, + minItems: { $ref: "#/definitions/positiveIntegerDefault0" }, + uniqueItems: { + type: "boolean", + default: false + }, + maxProperties: { $ref: "#/definitions/positiveInteger" }, + minProperties: { $ref: "#/definitions/positiveIntegerDefault0" }, + required: { $ref: "#/definitions/stringArray" }, + additionalProperties: { + anyOf: [ + { type: "boolean" }, + { $ref: "#" } + ], + default: { } + }, + definitions: { + type: "object", + additionalProperties: { $ref: "#" }, + default: { } + }, + properties: { + type: "object", + additionalProperties: { $ref: "#" }, + default: { } + }, + patternProperties: { + type: "object", + additionalProperties: { $ref: "#" }, + default: { } + }, + dependencies: { + type: "object", + additionalProperties: { + anyOf: [ + { $ref: "#" }, + { $ref: "#/definitions/stringArray" } + ] + } + }, + enum: { + type: "array", + minItems: 1, + uniqueItems: true + }, + type: { + anyOf: [ + { $ref: "#/definitions/simpleTypes" }, + { + type: "array", + items: { $ref: "#/definitions/simpleTypes" }, + minItems: 1, + uniqueItems: true + } + ] + }, + format: { type: "string" }, + allOf: { $ref: "#/definitions/schemaArray" }, + anyOf: { $ref: "#/definitions/schemaArray" }, + oneOf: { $ref: "#/definitions/schemaArray" }, + not: { $ref: "#" } + }, + dependencies: { + exclusiveMaximum: ["maximum"], + exclusiveMinimum: ["minimum"] + }, + default: { } +}; + +//------------------------------------------------------------------------------ // Public Interface //------------------------------------------------------------------------------ +var ajvOrig = (additionalOptions = {}) => { + const ajv = new Ajv__default["default"]({ + meta: false, + useDefaults: true, + validateSchema: false, + missingRefs: "ignore", + verbose: true, + schemaId: "auto", + ...additionalOptions + }); -module.exports = { - emitDeprecationWarning + ajv.addMetaSchema(metaSchema); + // eslint-disable-next-line no-underscore-dangle + ajv._opts.defaultMeta = metaSchema.id; + + return ajv; }; -/***/ }), -/* 445 */ -/***/ ((module) => { +/** + * @fileoverview Defines a schema for configs. + * @author Sylvan Mably + */ -// shim for using process in browser -var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it -// don't break things. But we need to wrap it in a try catch in case it is -// wrapped in strict mode code which doesn't define any globals. It's inside a -// function because try/catches deoptimize in certain engines. +const baseConfigProperties = { + $schema: { type: "string" }, + env: { type: "object" }, + extends: { $ref: "#/definitions/stringOrStrings" }, + globals: { type: "object" }, + overrides: { + type: "array", + items: { $ref: "#/definitions/overrideConfig" }, + additionalItems: false + }, + parser: { type: ["string", "null"] }, + parserOptions: { type: "object" }, + plugins: { type: "array" }, + processor: { type: "string" }, + rules: { type: "object" }, + settings: { type: "object" }, + noInlineConfig: { type: "boolean" }, + reportUnusedDisableDirectives: { type: "boolean" }, -var cachedSetTimeout; -var cachedClearTimeout; + ecmaFeatures: { type: "object" } // deprecated; logs a warning when used +}; -function defaultSetTimout() { - throw new Error('setTimeout has not been defined'); -} +const configSchema = { + definitions: { + stringOrStrings: { + oneOf: [ + { type: "string" }, + { + type: "array", + items: { type: "string" }, + additionalItems: false + } + ] + }, + stringOrStringsRequired: { + oneOf: [ + { type: "string" }, + { + type: "array", + items: { type: "string" }, + additionalItems: false, + minItems: 1 + } + ] + }, -function defaultClearTimeout() { - throw new Error('clearTimeout has not been defined'); -} + // Config at top-level. + objectConfig: { + type: "object", + properties: { + root: { type: "boolean" }, + ignorePatterns: { $ref: "#/definitions/stringOrStrings" }, + ...baseConfigProperties + }, + additionalProperties: false + }, -(function () { - try { - if (typeof setTimeout === 'function') { - cachedSetTimeout = setTimeout; - } else { - cachedSetTimeout = defaultSetTimout; - } - } catch (e) { - cachedSetTimeout = defaultSetTimout; - } + // Config in `overrides`. + overrideConfig: { + type: "object", + properties: { + excludedFiles: { $ref: "#/definitions/stringOrStrings" }, + files: { $ref: "#/definitions/stringOrStringsRequired" }, + ...baseConfigProperties + }, + required: ["files"], + additionalProperties: false + } + }, - try { - if (typeof clearTimeout === 'function') { - cachedClearTimeout = clearTimeout; - } else { - cachedClearTimeout = defaultClearTimeout; - } - } catch (e) { - cachedClearTimeout = defaultClearTimeout; - } -})(); + $ref: "#/definitions/objectConfig" +}; -function runTimeout(fun) { - if (cachedSetTimeout === setTimeout) { - //normal enviroments in sane situations - return setTimeout(fun, 0); - } // if setTimeout wasn't available but was latter defined +/** + * @fileoverview Defines environment settings and globals. + * @author Elan Shanker + */ +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ - if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { - cachedSetTimeout = setTimeout; - return setTimeout(fun, 0); - } +/** + * Get the object that has difference. + * @param {Record} current The newer object. + * @param {Record} prev The older object. + * @returns {Record} The difference object. + */ +function getDiff(current, prev) { + const retv = {}; - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedSetTimeout(fun, 0); - } catch (e) { - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedSetTimeout.call(null, fun, 0); - } catch (e) { - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error - return cachedSetTimeout.call(this, fun, 0); - } - } -} - -function runClearTimeout(marker) { - if (cachedClearTimeout === clearTimeout) { - //normal enviroments in sane situations - return clearTimeout(marker); - } // if clearTimeout wasn't available but was latter defined - - - if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { - cachedClearTimeout = clearTimeout; - return clearTimeout(marker); - } - - try { - // when when somebody has screwed with setTimeout but no I.E. maddness - return cachedClearTimeout(marker); - } catch (e) { - try { - // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally - return cachedClearTimeout.call(null, marker); - } catch (e) { - // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. - // Some versions of I.E. have different rules for clearTimeout vs setTimeout - return cachedClearTimeout.call(this, marker); - } - } -} - -var queue = []; -var draining = false; -var currentQueue; -var queueIndex = -1; - -function cleanUpNextTick() { - if (!draining || !currentQueue) { - return; - } - - draining = false; - - if (currentQueue.length) { - queue = currentQueue.concat(queue); - } else { - queueIndex = -1; - } - - if (queue.length) { - drainQueue(); - } -} - -function drainQueue() { - if (draining) { - return; - } - - var timeout = runTimeout(cleanUpNextTick); - draining = true; - var len = queue.length; - - while (len) { - currentQueue = queue; - queue = []; - - while (++queueIndex < len) { - if (currentQueue) { - currentQueue[queueIndex].run(); - } + for (const [key, value] of Object.entries(current)) { + if (!Object.hasOwnProperty.call(prev, key)) { + retv[key] = value; + } } - queueIndex = -1; - len = queue.length; - } - - currentQueue = null; - draining = false; - runClearTimeout(timeout); + return retv; } -process.nextTick = function (fun) { - var args = new Array(arguments.length - 1); +const newGlobals2015 = getDiff(globals__default["default"].es2015, globals__default["default"].es5); // 19 variables such as Promise, Map, ... +const newGlobals2017 = { + Atomics: false, + SharedArrayBuffer: false +}; +const newGlobals2020 = { + BigInt: false, + BigInt64Array: false, + BigUint64Array: false, + globalThis: false +}; - if (arguments.length > 1) { - for (var i = 1; i < arguments.length; i++) { - args[i - 1] = arguments[i]; +const newGlobals2021 = { + AggregateError: false, + FinalizationRegistry: false, + WeakRef: false +}; + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** @type {Map} */ +var environments = new Map(Object.entries({ + + // Language + builtin: { + globals: globals__default["default"].es5 + }, + es6: { + globals: newGlobals2015, + parserOptions: { + ecmaVersion: 6 + } + }, + es2015: { + globals: newGlobals2015, + parserOptions: { + ecmaVersion: 6 + } + }, + es2017: { + globals: { ...newGlobals2015, ...newGlobals2017 }, + parserOptions: { + ecmaVersion: 8 + } + }, + es2020: { + globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020 }, + parserOptions: { + ecmaVersion: 11 + } + }, + es2021: { + globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 }, + parserOptions: { + ecmaVersion: 12 + } + }, + + // Platforms + browser: { + globals: globals__default["default"].browser + }, + node: { + globals: globals__default["default"].node, + parserOptions: { + ecmaFeatures: { + globalReturn: true + } + } + }, + "shared-node-browser": { + globals: globals__default["default"]["shared-node-browser"] + }, + worker: { + globals: globals__default["default"].worker + }, + serviceworker: { + globals: globals__default["default"].serviceworker + }, + + // Frameworks + commonjs: { + globals: globals__default["default"].commonjs, + parserOptions: { + ecmaFeatures: { + globalReturn: true + } + } + }, + amd: { + globals: globals__default["default"].amd + }, + mocha: { + globals: globals__default["default"].mocha + }, + jasmine: { + globals: globals__default["default"].jasmine + }, + jest: { + globals: globals__default["default"].jest + }, + phantomjs: { + globals: globals__default["default"].phantomjs + }, + jquery: { + globals: globals__default["default"].jquery + }, + qunit: { + globals: globals__default["default"].qunit + }, + prototypejs: { + globals: globals__default["default"].prototypejs + }, + shelljs: { + globals: globals__default["default"].shelljs + }, + meteor: { + globals: globals__default["default"].meteor + }, + mongo: { + globals: globals__default["default"].mongo + }, + protractor: { + globals: globals__default["default"].protractor + }, + applescript: { + globals: globals__default["default"].applescript + }, + nashorn: { + globals: globals__default["default"].nashorn + }, + atomtest: { + globals: globals__default["default"].atomtest + }, + embertest: { + globals: globals__default["default"].embertest + }, + webextensions: { + globals: globals__default["default"].webextensions + }, + greasemonkey: { + globals: globals__default["default"].greasemonkey } - } +})); - queue.push(new Item(fun, args)); +/** + * @fileoverview Validates configs. + * @author Brandon Mills + */ - if (queue.length === 1 && !draining) { - runTimeout(drainQueue); - } -}; // v8 likes predictible objects +const ajv = ajvOrig(); +const ruleValidators = new WeakMap(); +const noop = Function.prototype; + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ +let validateSchema; +const severityMap = { + error: 2, + warn: 1, + off: 0 +}; + +const validated = new WeakSet(); + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +class ConfigValidator { + constructor({ builtInRules = new Map() } = {}) { + this.builtInRules = builtInRules; + } + + /** + * Gets a complete options schema for a rule. + * @param {{create: Function, schema: (Array|null)}} rule A new-style rule object + * @returns {Object} JSON Schema for the rule's options. + */ + getRuleOptionsSchema(rule) { + if (!rule) { + return null; + } + + const schema = rule.schema || rule.meta && rule.meta.schema; + + // Given a tuple of schemas, insert warning level at the beginning + if (Array.isArray(schema)) { + if (schema.length) { + return { + type: "array", + items: schema, + minItems: 0, + maxItems: schema.length + }; + } + return { + type: "array", + minItems: 0, + maxItems: 0 + }; + + } + + // Given a full schema, leave it alone + return schema || null; + } + + /** + * Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid. + * @param {options} options The given options for the rule. + * @returns {number|string} The rule's severity value + */ + validateRuleSeverity(options) { + const severity = Array.isArray(options) ? options[0] : options; + const normSeverity = typeof severity === "string" ? severityMap[severity.toLowerCase()] : severity; + + if (normSeverity === 0 || normSeverity === 1 || normSeverity === 2) { + return normSeverity; + } + + throw new Error(`\tSeverity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '${util__default["default"].inspect(severity).replace(/'/gu, "\"").replace(/\n/gu, "")}').\n`); + + } + + /** + * Validates the non-severity options passed to a rule, based on its schema. + * @param {{create: Function}} rule The rule to validate + * @param {Array} localOptions The options for the rule, excluding severity + * @returns {void} + */ + validateRuleSchema(rule, localOptions) { + if (!ruleValidators.has(rule)) { + const schema = this.getRuleOptionsSchema(rule); + + if (schema) { + ruleValidators.set(rule, ajv.compile(schema)); + } + } + + const validateRule = ruleValidators.get(rule); + + if (validateRule) { + validateRule(localOptions); + if (validateRule.errors) { + throw new Error(validateRule.errors.map( + error => `\tValue ${JSON.stringify(error.data)} ${error.message}.\n` + ).join("")); + } + } + } + + /** + * Validates a rule's options against its schema. + * @param {{create: Function}|null} rule The rule that the config is being validated for + * @param {string} ruleId The rule's unique name. + * @param {Array|number} options The given options for the rule. + * @param {string|null} source The name of the configuration source to report in any errors. If null or undefined, + * no source is prepended to the message. + * @returns {void} + */ + validateRuleOptions(rule, ruleId, options, source = null) { + try { + const severity = this.validateRuleSeverity(options); + + if (severity !== 0) { + this.validateRuleSchema(rule, Array.isArray(options) ? options.slice(1) : []); + } + } catch (err) { + const enhancedMessage = `Configuration for rule "${ruleId}" is invalid:\n${err.message}`; + + if (typeof source === "string") { + throw new Error(`${source}:\n\t${enhancedMessage}`); + } else { + throw new Error(enhancedMessage); + } + } + } + + /** + * Validates an environment object + * @param {Object} environment The environment config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded environments. + * @returns {void} + */ + validateEnvironment( + environment, + source, + getAdditionalEnv = noop + ) { + + // not having an environment is ok + if (!environment) { + return; + } + + Object.keys(environment).forEach(id => { + const env = getAdditionalEnv(id) || environments.get(id) || null; + + if (!env) { + const message = `${source}:\n\tEnvironment key "${id}" is unknown\n`; + + throw new Error(message); + } + }); + } + + /** + * Validates a rules config object + * @param {Object} rulesConfig The rules config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @param {function(ruleId:string): Object} getAdditionalRule A map from strings to loaded rules + * @returns {void} + */ + validateRules( + rulesConfig, + source, + getAdditionalRule = noop + ) { + if (!rulesConfig) { + return; + } + + Object.keys(rulesConfig).forEach(id => { + const rule = getAdditionalRule(id) || this.builtInRules.get(id) || null; + + this.validateRuleOptions(rule, id, rulesConfig[id], source); + }); + } + + /** + * Validates a `globals` section of a config file + * @param {Object} globalsConfig The `globals` section + * @param {string|null} source The name of the configuration source to report in the event of an error. + * @returns {void} + */ + validateGlobals(globalsConfig, source = null) { + if (!globalsConfig) { + return; + } + + Object.entries(globalsConfig) + .forEach(([configuredGlobal, configuredValue]) => { + try { + normalizeConfigGlobal(configuredValue); + } catch (err) { + throw new Error(`ESLint configuration of global '${configuredGlobal}' in ${source} is invalid:\n${err.message}`); + } + }); + } + + /** + * Validate `processor` configuration. + * @param {string|undefined} processorName The processor name. + * @param {string} source The name of config file. + * @param {function(id:string): Processor} getProcessor The getter of defined processors. + * @returns {void} + */ + validateProcessor(processorName, source, getProcessor) { + if (processorName && !getProcessor(processorName)) { + throw new Error(`ESLint configuration of processor in '${source}' is invalid: '${processorName}' was not found.`); + } + } + + /** + * Formats an array of schema validation errors. + * @param {Array} errors An array of error messages to format. + * @returns {string} Formatted error message + */ + formatErrors(errors) { + return errors.map(error => { + if (error.keyword === "additionalProperties") { + const formattedPropertyPath = error.dataPath.length ? `${error.dataPath.slice(1)}.${error.params.additionalProperty}` : error.params.additionalProperty; + + return `Unexpected top-level property "${formattedPropertyPath}"`; + } + if (error.keyword === "type") { + const formattedField = error.dataPath.slice(1); + const formattedExpectedType = Array.isArray(error.schema) ? error.schema.join("/") : error.schema; + const formattedValue = JSON.stringify(error.data); + + return `Property "${formattedField}" is the wrong type (expected ${formattedExpectedType} but got \`${formattedValue}\`)`; + } + + const field = error.dataPath[0] === "." ? error.dataPath.slice(1) : error.dataPath; + + return `"${field}" ${error.message}. Value: ${JSON.stringify(error.data)}`; + }).map(message => `\t- ${message}.\n`).join(""); + } + + /** + * Validates the top level properties of the config object. + * @param {Object} config The config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @returns {void} + */ + validateConfigSchema(config, source = null) { + validateSchema = validateSchema || ajv.compile(configSchema); + + if (!validateSchema(config)) { + throw new Error(`ESLint configuration in ${source} is invalid:\n${this.formatErrors(validateSchema.errors)}`); + } + + if (Object.hasOwnProperty.call(config, "ecmaFeatures")) { + emitDeprecationWarning(source, "ESLINT_LEGACY_ECMAFEATURES"); + } + } + + /** + * Validates an entire config object. + * @param {Object} config The config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @param {function(ruleId:string): Object} [getAdditionalRule] A map from strings to loaded rules. + * @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded envs. + * @returns {void} + */ + validate(config, source, getAdditionalRule, getAdditionalEnv) { + this.validateConfigSchema(config, source); + this.validateRules(config.rules, source, getAdditionalRule); + this.validateEnvironment(config.env, source, getAdditionalEnv); + this.validateGlobals(config.globals, source); + + for (const override of config.overrides || []) { + this.validateRules(override.rules, source, getAdditionalRule); + this.validateEnvironment(override.env, source, getAdditionalEnv); + this.validateGlobals(config.globals, source); + } + } + + /** + * Validate config array object. + * @param {ConfigArray} configArray The config array to validate. + * @returns {void} + */ + validateConfigArray(configArray) { + const getPluginEnv = Map.prototype.get.bind(configArray.pluginEnvironments); + const getPluginProcessor = Map.prototype.get.bind(configArray.pluginProcessors); + const getPluginRule = Map.prototype.get.bind(configArray.pluginRules); + + // Validate. + for (const element of configArray) { + if (validated.has(element)) { + continue; + } + validated.add(element); + + this.validateEnvironment(element.env, element.name, getPluginEnv); + this.validateGlobals(element.globals, element.name); + this.validateProcessor(element.processor, element.name, getPluginProcessor); + this.validateRules(element.rules, element.name, getPluginRule); + } + } -function Item(fun, array) { - this.fun = fun; - this.array = array; } -Item.prototype.run = function () { - this.fun.apply(null, this.array); +/** + * @fileoverview Common helpers for naming of plugins, formatters and configs + */ + +const NAMESPACE_REGEX = /^@.*\//iu; + +/** + * Brings package name to correct format based on prefix + * @param {string} name The name of the package. + * @param {string} prefix Can be either "eslint-plugin", "eslint-config" or "eslint-formatter" + * @returns {string} Normalized name of the package + * @private + */ +function normalizePackageName(name, prefix) { + let normalizedName = name; + + /** + * On Windows, name can come in with Windows slashes instead of Unix slashes. + * Normalize to Unix first to avoid errors later on. + * https://github.com/eslint/eslint/issues/5644 + */ + if (normalizedName.includes("\\")) { + normalizedName = normalizedName.replace(/\\/gu, "/"); + } + + if (normalizedName.charAt(0) === "@") { + + /** + * it's a scoped package + * package name is the prefix, or just a username + */ + const scopedPackageShortcutRegex = new RegExp(`^(@[^/]+)(?:/(?:${prefix})?)?$`, "u"), + scopedPackageNameRegex = new RegExp(`^${prefix}(-|$)`, "u"); + + if (scopedPackageShortcutRegex.test(normalizedName)) { + normalizedName = normalizedName.replace(scopedPackageShortcutRegex, `$1/${prefix}`); + } else if (!scopedPackageNameRegex.test(normalizedName.split("/")[1])) { + + /** + * for scoped packages, insert the prefix after the first / unless + * the path is already @scope/eslint or @scope/eslint-xxx-yyy + */ + normalizedName = normalizedName.replace(/^@([^/]+)\/(.*)$/u, `@$1/${prefix}-$2`); + } + } else if (!normalizedName.startsWith(`${prefix}-`)) { + normalizedName = `${prefix}-${normalizedName}`; + } + + return normalizedName; +} + +/** + * Removes the prefix from a fullname. + * @param {string} fullname The term which may have the prefix. + * @param {string} prefix The prefix to remove. + * @returns {string} The term without prefix. + */ +function getShorthandName(fullname, prefix) { + if (fullname[0] === "@") { + let matchResult = new RegExp(`^(@[^/]+)/${prefix}$`, "u").exec(fullname); + + if (matchResult) { + return matchResult[1]; + } + + matchResult = new RegExp(`^(@[^/]+)/${prefix}-(.+)$`, "u").exec(fullname); + if (matchResult) { + return `${matchResult[1]}/${matchResult[2]}`; + } + } else if (fullname.startsWith(`${prefix}-`)) { + return fullname.slice(prefix.length + 1); + } + + return fullname; +} + +/** + * Gets the scope (namespace) of a term. + * @param {string} term The term which may have the namespace. + * @returns {string} The namespace of the term if it has one. + */ +function getNamespaceFromTerm(term) { + const match = term.match(NAMESPACE_REGEX); + + return match ? match[0] : ""; +} + +var naming = { + __proto__: null, + normalizePackageName: normalizePackageName, + getShorthandName: getShorthandName, + getNamespaceFromTerm: getNamespaceFromTerm }; -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; -process.version = ''; // empty string to avoid regexp issues +/** + * @fileoverview Package exports for @eslint/eslintrc + * @author Nicholas C. Zakas + */ -process.versions = {}; +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- -function noop() {} +const Legacy = { + environments, -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; -process.prependListener = noop; -process.prependOnceListener = noop; - -process.listeners = function (name) { - return []; + // shared + ConfigOps, + ConfigValidator, + naming }; -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; +exports.Legacy = Legacy; +//# sourceMappingURL=eslintrc-universal.cjs.map -process.cwd = function () { - return '/'; -}; - -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; - -process.umask = function () { - return 0; -}; /***/ }), /* 446 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/** - * @fileoverview The instance of Ajv validator. - * @author Evgeny Poberezkin - */ - //------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const Ajv = __webpack_require__(447), - metaSchema = __webpack_require__(494); //------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ +/* provided dependency */ var console = __webpack_require__(438); -module.exports = (additionalOptions = {}) => { - const ajv = new Ajv({ - meta: false, - useDefaults: true, - validateSchema: false, - missingRefs: "ignore", - verbose: true, - schemaId: "auto", - ...additionalOptions - }); - ajv.addMetaSchema(metaSchema); // eslint-disable-next-line no-underscore-dangle - - ajv._opts.defaultMeta = metaSchema.id; - return ajv; -}; - -/***/ }), -/* 447 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; -/* provided dependency */ var console = __webpack_require__(493); - - -var compileSchema = __webpack_require__(448), - resolve = __webpack_require__(449), - Cache = __webpack_require__(459), - SchemaObject = __webpack_require__(454), - stableStringify = __webpack_require__(457), - formats = __webpack_require__(460), - rules = __webpack_require__(461), - $dataMetaSchema = __webpack_require__(486), - util = __webpack_require__(452); +var compileSchema = __webpack_require__(447), + resolve = __webpack_require__(448), + Cache = __webpack_require__(458), + SchemaObject = __webpack_require__(453), + stableStringify = __webpack_require__(456), + formats = __webpack_require__(459), + rules = __webpack_require__(460), + $dataMetaSchema = __webpack_require__(485), + util = __webpack_require__(451); module.exports = Ajv; Ajv.prototype.validate = validate; @@ -34122,16 +35353,16 @@ Ajv.prototype.addFormat = addFormat; Ajv.prototype.errorsText = errorsText; Ajv.prototype._addSchema = _addSchema; Ajv.prototype._compile = _compile; -Ajv.prototype.compileAsync = __webpack_require__(487); +Ajv.prototype.compileAsync = __webpack_require__(486); -var customKeyword = __webpack_require__(488); +var customKeyword = __webpack_require__(487); Ajv.prototype.addKeyword = customKeyword.add; Ajv.prototype.getKeyword = customKeyword.get; Ajv.prototype.removeKeyword = customKeyword.remove; Ajv.prototype.validateKeyword = customKeyword.validate; -var errorClasses = __webpack_require__(456); +var errorClasses = __webpack_require__(455); Ajv.ValidationError = errorClasses.Validation; Ajv.MissingRefError = errorClasses.MissingRef; @@ -34564,13 +35795,13 @@ function addDefaultMetaSchema(self) { var $dataSchema; if (self._opts.$data) { - $dataSchema = __webpack_require__(492); + $dataSchema = __webpack_require__(491); self.addMetaSchema($dataSchema, $dataSchema.$id, true); } if (self._opts.meta === false) return; - var metaSchema = __webpack_require__(491); + var metaSchema = __webpack_require__(490); if (self._opts.$data) metaSchema = $dataMetaSchema(metaSchema, META_SUPPORT_DATA); self.addMetaSchema(metaSchema, META_SCHEMA_ID, true); @@ -34628,18 +35859,18 @@ function setLogger(self) { function noop() {} /***/ }), -/* 448 */ +/* 447 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var resolve = __webpack_require__(449), - util = __webpack_require__(452), - errorClasses = __webpack_require__(456), - stableStringify = __webpack_require__(457); +var resolve = __webpack_require__(448), + util = __webpack_require__(451), + errorClasses = __webpack_require__(455), + stableStringify = __webpack_require__(456); -var validateGenerator = __webpack_require__(458); +var validateGenerator = __webpack_require__(457); /** * Functions below are used inside compiled validations function */ @@ -34647,7 +35878,7 @@ var validateGenerator = __webpack_require__(458); var ucs2length = util.ucs2length; -var equal = __webpack_require__(451); // this error is thrown by async schemas to return validation errors via exception +var equal = __webpack_require__(450); // this error is thrown by async schemas to return validation errors via exception var ValidationError = errorClasses.Validation; @@ -35009,17 +36240,17 @@ function vars(arr, statement) { } /***/ }), -/* 449 */ +/* 448 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var URI = __webpack_require__(450), - equal = __webpack_require__(451), - util = __webpack_require__(452), - SchemaObject = __webpack_require__(454), - traverse = __webpack_require__(455); +var URI = __webpack_require__(449), + equal = __webpack_require__(450), + util = __webpack_require__(451), + SchemaObject = __webpack_require__(453), + traverse = __webpack_require__(454); module.exports = resolve; resolve.normalizeId = normalizeId; @@ -35297,7 +36528,7 @@ function resolveIds(schema) { } /***/ }), -/* 450 */ +/* 449 */ /***/ (function(__unused_webpack_module, exports) { /** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */ @@ -36873,7 +38104,7 @@ function resolveIds(schema) { }); /***/ }), -/* 451 */ +/* 450 */ /***/ ((module) => { "use strict"; @@ -36917,7 +38148,7 @@ module.exports = function equal(a, b) { }; /***/ }), -/* 452 */ +/* 451 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -36931,8 +38162,8 @@ module.exports = { toHash: toHash, getProperty: getProperty, escapeQuotes: escapeQuotes, - equal: __webpack_require__(451), - ucs2length: __webpack_require__(453), + equal: __webpack_require__(450), + ucs2length: __webpack_require__(452), varOccurences: varOccurences, varReplace: varReplace, schemaHasRules: schemaHasRules, @@ -37156,7 +38387,7 @@ function unescapeJsonPointer(str) { } /***/ }), -/* 453 */ +/* 452 */ /***/ ((module) => { "use strict"; @@ -37184,13 +38415,13 @@ module.exports = function ucs2length(str) { }; /***/ }), -/* 454 */ +/* 453 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var util = __webpack_require__(452); +var util = __webpack_require__(451); module.exports = SchemaObject; @@ -37199,7 +38430,7 @@ function SchemaObject(obj) { } /***/ }), -/* 455 */ +/* 454 */ /***/ ((module) => { "use strict"; @@ -37290,13 +38521,13 @@ function escapeJsonPtr(str) { } /***/ }), -/* 456 */ +/* 455 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var resolve = __webpack_require__(449); +var resolve = __webpack_require__(448); module.exports = { Validation: errorSubclass(ValidationError), @@ -37326,7 +38557,7 @@ function errorSubclass(Subclass) { } /***/ }), -/* 457 */ +/* 456 */ /***/ ((module) => { "use strict"; @@ -37402,7 +38633,7 @@ module.exports = function (data, opts) { }; /***/ }), -/* 458 */ +/* 457 */ /***/ ((module) => { "use strict"; @@ -38009,7 +39240,7 @@ module.exports = function generate_validate(it, $keyword, $ruleType) { }; /***/ }), -/* 459 */ +/* 458 */ /***/ ((module) => { "use strict"; @@ -38036,13 +39267,13 @@ Cache.prototype.clear = function Cache_clear() { }; /***/ }), -/* 460 */ +/* 459 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var util = __webpack_require__(452); +var util = __webpack_require__(451); var DATE = /^(\d\d\d\d)-(\d\d)-(\d\d)$/; var DAYS = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; @@ -38171,14 +39402,14 @@ function regex(str) { } /***/ }), -/* 461 */ +/* 460 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var ruleModules = __webpack_require__(462), - toHash = __webpack_require__(452).toHash; +var ruleModules = __webpack_require__(461), + toHash = (__webpack_require__(451).toHash); module.exports = function rules() { var RULES = [{ @@ -38241,45 +39472,45 @@ module.exports = function rules() { }; /***/ }), -/* 462 */ +/* 461 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; //all requires must be explicit because browserify won't work with dynamic requires module.exports = { - '$ref': __webpack_require__(463), - allOf: __webpack_require__(464), - anyOf: __webpack_require__(465), - '$comment': __webpack_require__(466), - const: __webpack_require__(467), - contains: __webpack_require__(468), - dependencies: __webpack_require__(469), - 'enum': __webpack_require__(470), - format: __webpack_require__(471), - 'if': __webpack_require__(472), - items: __webpack_require__(473), - maximum: __webpack_require__(474), - minimum: __webpack_require__(474), - maxItems: __webpack_require__(475), - minItems: __webpack_require__(475), - maxLength: __webpack_require__(476), - minLength: __webpack_require__(476), - maxProperties: __webpack_require__(477), - minProperties: __webpack_require__(477), - multipleOf: __webpack_require__(478), - not: __webpack_require__(479), - oneOf: __webpack_require__(480), - pattern: __webpack_require__(481), - properties: __webpack_require__(482), - propertyNames: __webpack_require__(483), - required: __webpack_require__(484), - uniqueItems: __webpack_require__(485), - validate: __webpack_require__(458) + '$ref': __webpack_require__(462), + allOf: __webpack_require__(463), + anyOf: __webpack_require__(464), + '$comment': __webpack_require__(465), + const: __webpack_require__(466), + contains: __webpack_require__(467), + dependencies: __webpack_require__(468), + 'enum': __webpack_require__(469), + format: __webpack_require__(470), + 'if': __webpack_require__(471), + items: __webpack_require__(472), + maximum: __webpack_require__(473), + minimum: __webpack_require__(473), + maxItems: __webpack_require__(474), + minItems: __webpack_require__(474), + maxLength: __webpack_require__(475), + minLength: __webpack_require__(475), + maxProperties: __webpack_require__(476), + minProperties: __webpack_require__(476), + multipleOf: __webpack_require__(477), + not: __webpack_require__(478), + oneOf: __webpack_require__(479), + pattern: __webpack_require__(480), + properties: __webpack_require__(481), + propertyNames: __webpack_require__(482), + required: __webpack_require__(483), + uniqueItems: __webpack_require__(484), + validate: __webpack_require__(457) }; /***/ }), -/* 463 */ +/* 462 */ /***/ ((module) => { "use strict"; @@ -38438,7 +39669,7 @@ module.exports = function generate_ref(it, $keyword, $ruleType) { }; /***/ }), -/* 464 */ +/* 463 */ /***/ ((module) => { "use strict"; @@ -38494,7 +39725,7 @@ module.exports = function generate_allOf(it, $keyword, $ruleType) { }; /***/ }), -/* 465 */ +/* 464 */ /***/ ((module) => { "use strict"; @@ -38589,7 +39820,7 @@ module.exports = function generate_anyOf(it, $keyword, $ruleType) { }; /***/ }), -/* 466 */ +/* 465 */ /***/ ((module) => { "use strict"; @@ -38612,7 +39843,7 @@ module.exports = function generate_comment(it, $keyword, $ruleType) { }; /***/ }), -/* 467 */ +/* 466 */ /***/ ((module) => { "use strict"; @@ -38688,7 +39919,7 @@ module.exports = function generate_const(it, $keyword, $ruleType) { }; /***/ }), -/* 468 */ +/* 467 */ /***/ ((module) => { "use strict"; @@ -38791,7 +40022,7 @@ module.exports = function generate_contains(it, $keyword, $ruleType) { }; /***/ }), -/* 469 */ +/* 468 */ /***/ ((module) => { "use strict"; @@ -39016,7 +40247,7 @@ module.exports = function generate_dependencies(it, $keyword, $ruleType) { }; /***/ }), -/* 470 */ +/* 469 */ /***/ ((module) => { "use strict"; @@ -39107,7 +40338,7 @@ module.exports = function generate_enum(it, $keyword, $ruleType) { }; /***/ }), -/* 471 */ +/* 470 */ /***/ ((module) => { "use strict"; @@ -39308,7 +40539,7 @@ module.exports = function generate_format(it, $keyword, $ruleType) { }; /***/ }), -/* 472 */ +/* 471 */ /***/ ((module) => { "use strict"; @@ -39437,7 +40668,7 @@ module.exports = function generate_if(it, $keyword, $ruleType) { }; /***/ }), -/* 473 */ +/* 472 */ /***/ ((module) => { "use strict"; @@ -39613,7 +40844,7 @@ module.exports = function generate_items(it, $keyword, $ruleType) { }; /***/ }), -/* 474 */ +/* 473 */ /***/ ((module) => { "use strict"; @@ -39820,7 +41051,7 @@ module.exports = function generate__limit(it, $keyword, $ruleType) { }; /***/ }), -/* 475 */ +/* 474 */ /***/ ((module) => { "use strict"; @@ -39928,7 +41159,7 @@ module.exports = function generate__limitItems(it, $keyword, $ruleType) { }; /***/ }), -/* 476 */ +/* 475 */ /***/ ((module) => { "use strict"; @@ -40042,7 +41273,7 @@ module.exports = function generate__limitLength(it, $keyword, $ruleType) { }; /***/ }), -/* 477 */ +/* 476 */ /***/ ((module) => { "use strict"; @@ -40150,7 +41381,7 @@ module.exports = function generate__limitProperties(it, $keyword, $ruleType) { }; /***/ }), -/* 478 */ +/* 477 */ /***/ ((module) => { "use strict"; @@ -40259,7 +41490,7 @@ module.exports = function generate_multipleOf(it, $keyword, $ruleType) { }; /***/ }), -/* 479 */ +/* 478 */ /***/ ((module) => { "use strict"; @@ -40370,7 +41601,7 @@ module.exports = function generate_not(it, $keyword, $ruleType) { }; /***/ }), -/* 480 */ +/* 479 */ /***/ ((module) => { "use strict"; @@ -40467,7 +41698,7 @@ module.exports = function generate_oneOf(it, $keyword, $ruleType) { }; /***/ }), -/* 481 */ +/* 480 */ /***/ ((module) => { "use strict"; @@ -40569,7 +41800,7 @@ module.exports = function generate_pattern(it, $keyword, $ruleType) { }; /***/ }), -/* 482 */ +/* 481 */ /***/ ((module) => { "use strict"; @@ -40990,7 +42221,7 @@ module.exports = function generate_properties(it, $keyword, $ruleType) { }; /***/ }), -/* 483 */ +/* 482 */ /***/ ((module) => { "use strict"; @@ -41095,7 +42326,7 @@ module.exports = function generate_propertyNames(it, $keyword, $ruleType) { }; /***/ }), -/* 484 */ +/* 483 */ /***/ ((module) => { "use strict"; @@ -41461,7 +42692,7 @@ module.exports = function generate_required(it, $keyword, $ruleType) { }; /***/ }), -/* 485 */ +/* 484 */ /***/ ((module) => { "use strict"; @@ -41575,7 +42806,7 @@ module.exports = function generate_uniqueItems(it, $keyword, $ruleType) { }; /***/ }), -/* 486 */ +/* 485 */ /***/ ((module) => { "use strict"; @@ -41610,13 +42841,13 @@ module.exports = function (metaSchema, keywordsJsonPointers) { }; /***/ }), -/* 487 */ +/* 486 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var MissingRefError = __webpack_require__(456).MissingRef; +var MissingRefError = (__webpack_require__(455).MissingRef); module.exports = compileAsync; /** @@ -41704,7 +42935,7 @@ function compileAsync(schema, meta, callback) { } /***/ }), -/* 488 */ +/* 487 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -41712,9 +42943,9 @@ function compileAsync(schema, meta, callback) { var IDENTIFIER = /^[a-z_$][a-z0-9_$-]*$/i; -var customRuleCode = __webpack_require__(489); +var customRuleCode = __webpack_require__(488); -var definitionSchema = __webpack_require__(490); +var definitionSchema = __webpack_require__(489); module.exports = { add: addKeyword, @@ -41857,7 +43088,7 @@ function validateKeyword(definition, throwError) { } /***/ }), -/* 489 */ +/* 488 */ /***/ ((module) => { "use strict"; @@ -42140,13 +43371,13 @@ module.exports = function generate_custom(it, $keyword, $ruleType) { }; /***/ }), -/* 490 */ +/* 489 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -var metaSchema = __webpack_require__(491); +var metaSchema = __webpack_require__(490); module.exports = { $id: 'https://github.com/ajv-validator/ajv/blob/master/lib/definition_schema.js', @@ -42204,112 +43435,247 @@ module.exports = { }; /***/ }), -/* 491 */ +/* 490 */ /***/ ((module) => { "use strict"; module.exports = JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"http://json-schema.org/draft-07/schema#","title":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"nonNegativeInteger":{"type":"integer","minimum":0},"nonNegativeIntegerDefault0":{"allOf":[{"$ref":"#/definitions/nonNegativeInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"uniqueItems":true,"default":[]}},"type":["object","boolean"],"properties":{"$id":{"type":"string","format":"uri-reference"},"$schema":{"type":"string","format":"uri"},"$ref":{"type":"string","format":"uri-reference"},"$comment":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":true,"readOnly":{"type":"boolean","default":false},"examples":{"type":"array","items":true},"multipleOf":{"type":"number","exclusiveMinimum":0},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"maxLength":{"$ref":"#/definitions/nonNegativeInteger"},"minLength":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"$ref":"#"},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":true},"maxItems":{"$ref":"#/definitions/nonNegativeInteger"},"minItems":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"contains":{"$ref":"#"},"maxProperties":{"$ref":"#/definitions/nonNegativeInteger"},"minProperties":{"$ref":"#/definitions/nonNegativeIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"$ref":"#"},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"propertyNames":{"format":"regex"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"propertyNames":{"$ref":"#"},"const":true,"enum":{"type":"array","items":true,"minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"contentMediaType":{"type":"string"},"contentEncoding":{"type":"string"},"if":{"$ref":"#"},"then":{"$ref":"#"},"else":{"$ref":"#"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"default":true}'); /***/ }), -/* 492 */ +/* 491 */ /***/ ((module) => { "use strict"; module.exports = JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","$id":"https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#","description":"Meta-schema for $data reference (JSON Schema extension proposal)","type":"object","required":["$data"],"properties":{"$data":{"type":"string","anyOf":[{"format":"relative-json-pointer"},{"format":"json-pointer"}]}},"additionalProperties":false}'); /***/ }), -/* 493 */ +/* 492 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/*global window, global*/ -var util = __webpack_require__(442); +"use strict"; -var assert = __webpack_require__(407); -function now() { - return new Date().getTime(); -} +module.exports = __webpack_require__(493); -var slice = Array.prototype.slice; -var console; -var times = {}; +/***/ }), +/* 493 */ +/***/ ((module) => { -if (typeof global !== "undefined" && global.console) { - console = global.console; -} else if (typeof window !== "undefined" && window.console) { - console = window.console; -} else { - console = {}; -} - -var functions = [[log, "log"], [info, "info"], [warn, "warn"], [error, "error"], [time, "time"], [timeEnd, "timeEnd"], [trace, "trace"], [dir, "dir"], [consoleAssert, "assert"]]; - -for (var i = 0; i < functions.length; i++) { - var tuple = functions[i]; - var f = tuple[0]; - var name = tuple[1]; - - if (!console[name]) { - console[name] = f; - } -} - -module.exports = console; - -function log() {} - -function info() { - console.log.apply(console, arguments); -} - -function warn() { - console.log.apply(console, arguments); -} - -function error() { - console.warn.apply(console, arguments); -} - -function time(label) { - times[label] = now(); -} - -function timeEnd(label) { - var time = times[label]; - - if (!time) { - throw new Error("No such label: " + label); - } - - delete times[label]; - var duration = now() - time; - console.log(label + ": " + duration + "ms"); -} - -function trace() { - var err = new Error(); - err.name = "Trace"; - err.message = util.format.apply(null, arguments); - console.error(err.stack); -} - -function dir(object) { - console.log(util.inspect(object) + "\n"); -} - -function consoleAssert(expression) { - if (!expression) { - var arr = slice.call(arguments, 1); - assert.ok(false, util.format.apply(null, arr)); - } -} +"use strict"; +module.exports = JSON.parse('{"builtin":{"AggregateError":false,"Array":false,"ArrayBuffer":false,"Atomics":false,"BigInt":false,"BigInt64Array":false,"BigUint64Array":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"FinalizationRegistry":false,"Float32Array":false,"Float64Array":false,"Function":false,"globalThis":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"SharedArrayBuffer":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakRef":false,"WeakSet":false},"es5":{"Array":false,"Boolean":false,"constructor":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"propertyIsEnumerable":false,"RangeError":false,"ReferenceError":false,"RegExp":false,"String":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false},"es2015":{"Array":false,"ArrayBuffer":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"es2017":{"Array":false,"ArrayBuffer":false,"Atomics":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"SharedArrayBuffer":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"es2020":{"Array":false,"ArrayBuffer":false,"Atomics":false,"BigInt":false,"BigInt64Array":false,"BigUint64Array":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"Float32Array":false,"Float64Array":false,"Function":false,"globalThis":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"SharedArrayBuffer":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakSet":false},"es2021":{"AggregateError":false,"Array":false,"ArrayBuffer":false,"Atomics":false,"BigInt":false,"BigInt64Array":false,"BigUint64Array":false,"Boolean":false,"constructor":false,"DataView":false,"Date":false,"decodeURI":false,"decodeURIComponent":false,"encodeURI":false,"encodeURIComponent":false,"Error":false,"escape":false,"eval":false,"EvalError":false,"FinalizationRegistry":false,"Float32Array":false,"Float64Array":false,"Function":false,"globalThis":false,"hasOwnProperty":false,"Infinity":false,"Int16Array":false,"Int32Array":false,"Int8Array":false,"isFinite":false,"isNaN":false,"isPrototypeOf":false,"JSON":false,"Map":false,"Math":false,"NaN":false,"Number":false,"Object":false,"parseFloat":false,"parseInt":false,"Promise":false,"propertyIsEnumerable":false,"Proxy":false,"RangeError":false,"ReferenceError":false,"Reflect":false,"RegExp":false,"Set":false,"SharedArrayBuffer":false,"String":false,"Symbol":false,"SyntaxError":false,"toLocaleString":false,"toString":false,"TypeError":false,"Uint16Array":false,"Uint32Array":false,"Uint8Array":false,"Uint8ClampedArray":false,"undefined":false,"unescape":false,"URIError":false,"valueOf":false,"WeakMap":false,"WeakRef":false,"WeakSet":false},"browser":{"AbortController":false,"AbortSignal":false,"addEventListener":false,"alert":false,"AnalyserNode":false,"Animation":false,"AnimationEffectReadOnly":false,"AnimationEffectTiming":false,"AnimationEffectTimingReadOnly":false,"AnimationEvent":false,"AnimationPlaybackEvent":false,"AnimationTimeline":false,"applicationCache":false,"ApplicationCache":false,"ApplicationCacheErrorEvent":false,"atob":false,"Attr":false,"Audio":false,"AudioBuffer":false,"AudioBufferSourceNode":false,"AudioContext":false,"AudioDestinationNode":false,"AudioListener":false,"AudioNode":false,"AudioParam":false,"AudioProcessingEvent":false,"AudioScheduledSourceNode":false,"AudioWorkletGlobalScope ":false,"AudioWorkletNode":false,"AudioWorkletProcessor":false,"BarProp":false,"BaseAudioContext":false,"BatteryManager":false,"BeforeUnloadEvent":false,"BiquadFilterNode":false,"Blob":false,"BlobEvent":false,"blur":false,"BroadcastChannel":false,"btoa":false,"BudgetService":false,"ByteLengthQueuingStrategy":false,"Cache":false,"caches":false,"CacheStorage":false,"cancelAnimationFrame":false,"cancelIdleCallback":false,"CanvasCaptureMediaStreamTrack":false,"CanvasGradient":false,"CanvasPattern":false,"CanvasRenderingContext2D":false,"ChannelMergerNode":false,"ChannelSplitterNode":false,"CharacterData":false,"clearInterval":false,"clearTimeout":false,"clientInformation":false,"ClipboardEvent":false,"close":false,"closed":false,"CloseEvent":false,"Comment":false,"CompositionEvent":false,"confirm":false,"console":false,"ConstantSourceNode":false,"ConvolverNode":false,"CountQueuingStrategy":false,"createImageBitmap":false,"Credential":false,"CredentialsContainer":false,"crypto":false,"Crypto":false,"CryptoKey":false,"CSS":false,"CSSConditionRule":false,"CSSFontFaceRule":false,"CSSGroupingRule":false,"CSSImportRule":false,"CSSKeyframeRule":false,"CSSKeyframesRule":false,"CSSMatrixComponent":false,"CSSMediaRule":false,"CSSNamespaceRule":false,"CSSPageRule":false,"CSSPerspective":false,"CSSRotate":false,"CSSRule":false,"CSSRuleList":false,"CSSScale":false,"CSSSkew":false,"CSSSkewX":false,"CSSSkewY":false,"CSSStyleDeclaration":false,"CSSStyleRule":false,"CSSStyleSheet":false,"CSSSupportsRule":false,"CSSTransformValue":false,"CSSTranslate":false,"CustomElementRegistry":false,"customElements":false,"CustomEvent":false,"DataTransfer":false,"DataTransferItem":false,"DataTransferItemList":false,"defaultstatus":false,"defaultStatus":false,"DelayNode":false,"DeviceMotionEvent":false,"DeviceOrientationEvent":false,"devicePixelRatio":false,"dispatchEvent":false,"document":false,"Document":false,"DocumentFragment":false,"DocumentType":false,"DOMError":false,"DOMException":false,"DOMImplementation":false,"DOMMatrix":false,"DOMMatrixReadOnly":false,"DOMParser":false,"DOMPoint":false,"DOMPointReadOnly":false,"DOMQuad":false,"DOMRect":false,"DOMRectList":false,"DOMRectReadOnly":false,"DOMStringList":false,"DOMStringMap":false,"DOMTokenList":false,"DragEvent":false,"DynamicsCompressorNode":false,"Element":false,"ErrorEvent":false,"event":false,"Event":false,"EventSource":false,"EventTarget":false,"external":false,"fetch":false,"File":false,"FileList":false,"FileReader":false,"find":false,"focus":false,"FocusEvent":false,"FontFace":false,"FontFaceSetLoadEvent":false,"FormData":false,"frameElement":false,"frames":false,"GainNode":false,"Gamepad":false,"GamepadButton":false,"GamepadEvent":false,"getComputedStyle":false,"getSelection":false,"HashChangeEvent":false,"Headers":false,"history":false,"History":false,"HTMLAllCollection":false,"HTMLAnchorElement":false,"HTMLAreaElement":false,"HTMLAudioElement":false,"HTMLBaseElement":false,"HTMLBodyElement":false,"HTMLBRElement":false,"HTMLButtonElement":false,"HTMLCanvasElement":false,"HTMLCollection":false,"HTMLContentElement":false,"HTMLDataElement":false,"HTMLDataListElement":false,"HTMLDetailsElement":false,"HTMLDialogElement":false,"HTMLDirectoryElement":false,"HTMLDivElement":false,"HTMLDListElement":false,"HTMLDocument":false,"HTMLElement":false,"HTMLEmbedElement":false,"HTMLFieldSetElement":false,"HTMLFontElement":false,"HTMLFormControlsCollection":false,"HTMLFormElement":false,"HTMLFrameElement":false,"HTMLFrameSetElement":false,"HTMLHeadElement":false,"HTMLHeadingElement":false,"HTMLHRElement":false,"HTMLHtmlElement":false,"HTMLIFrameElement":false,"HTMLImageElement":false,"HTMLInputElement":false,"HTMLLabelElement":false,"HTMLLegendElement":false,"HTMLLIElement":false,"HTMLLinkElement":false,"HTMLMapElement":false,"HTMLMarqueeElement":false,"HTMLMediaElement":false,"HTMLMenuElement":false,"HTMLMetaElement":false,"HTMLMeterElement":false,"HTMLModElement":false,"HTMLObjectElement":false,"HTMLOListElement":false,"HTMLOptGroupElement":false,"HTMLOptionElement":false,"HTMLOptionsCollection":false,"HTMLOutputElement":false,"HTMLParagraphElement":false,"HTMLParamElement":false,"HTMLPictureElement":false,"HTMLPreElement":false,"HTMLProgressElement":false,"HTMLQuoteElement":false,"HTMLScriptElement":false,"HTMLSelectElement":false,"HTMLShadowElement":false,"HTMLSlotElement":false,"HTMLSourceElement":false,"HTMLSpanElement":false,"HTMLStyleElement":false,"HTMLTableCaptionElement":false,"HTMLTableCellElement":false,"HTMLTableColElement":false,"HTMLTableElement":false,"HTMLTableRowElement":false,"HTMLTableSectionElement":false,"HTMLTemplateElement":false,"HTMLTextAreaElement":false,"HTMLTimeElement":false,"HTMLTitleElement":false,"HTMLTrackElement":false,"HTMLUListElement":false,"HTMLUnknownElement":false,"HTMLVideoElement":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"IdleDeadline":false,"IIRFilterNode":false,"Image":false,"ImageBitmap":false,"ImageBitmapRenderingContext":false,"ImageCapture":false,"ImageData":false,"indexedDB":false,"innerHeight":false,"innerWidth":false,"InputEvent":false,"IntersectionObserver":false,"IntersectionObserverEntry":false,"Intl":false,"isSecureContext":false,"KeyboardEvent":false,"KeyframeEffect":false,"KeyframeEffectReadOnly":false,"length":false,"localStorage":false,"location":true,"Location":false,"locationbar":false,"matchMedia":false,"MediaDeviceInfo":false,"MediaDevices":false,"MediaElementAudioSourceNode":false,"MediaEncryptedEvent":false,"MediaError":false,"MediaKeyMessageEvent":false,"MediaKeySession":false,"MediaKeyStatusMap":false,"MediaKeySystemAccess":false,"MediaList":false,"MediaQueryList":false,"MediaQueryListEvent":false,"MediaRecorder":false,"MediaSettingsRange":false,"MediaSource":false,"MediaStream":false,"MediaStreamAudioDestinationNode":false,"MediaStreamAudioSourceNode":false,"MediaStreamEvent":false,"MediaStreamTrack":false,"MediaStreamTrackEvent":false,"menubar":false,"MessageChannel":false,"MessageEvent":false,"MessagePort":false,"MIDIAccess":false,"MIDIConnectionEvent":false,"MIDIInput":false,"MIDIInputMap":false,"MIDIMessageEvent":false,"MIDIOutput":false,"MIDIOutputMap":false,"MIDIPort":false,"MimeType":false,"MimeTypeArray":false,"MouseEvent":false,"moveBy":false,"moveTo":false,"MutationEvent":false,"MutationObserver":false,"MutationRecord":false,"name":false,"NamedNodeMap":false,"NavigationPreloadManager":false,"navigator":false,"Navigator":false,"NetworkInformation":false,"Node":false,"NodeFilter":false,"NodeIterator":false,"NodeList":false,"Notification":false,"OfflineAudioCompletionEvent":false,"OfflineAudioContext":false,"offscreenBuffering":false,"OffscreenCanvas":true,"OffscreenCanvasRenderingContext2D":false,"onabort":true,"onafterprint":true,"onanimationend":true,"onanimationiteration":true,"onanimationstart":true,"onappinstalled":true,"onauxclick":true,"onbeforeinstallprompt":true,"onbeforeprint":true,"onbeforeunload":true,"onblur":true,"oncancel":true,"oncanplay":true,"oncanplaythrough":true,"onchange":true,"onclick":true,"onclose":true,"oncontextmenu":true,"oncuechange":true,"ondblclick":true,"ondevicemotion":true,"ondeviceorientation":true,"ondeviceorientationabsolute":true,"ondrag":true,"ondragend":true,"ondragenter":true,"ondragleave":true,"ondragover":true,"ondragstart":true,"ondrop":true,"ondurationchange":true,"onemptied":true,"onended":true,"onerror":true,"onfocus":true,"ongotpointercapture":true,"onhashchange":true,"oninput":true,"oninvalid":true,"onkeydown":true,"onkeypress":true,"onkeyup":true,"onlanguagechange":true,"onload":true,"onloadeddata":true,"onloadedmetadata":true,"onloadstart":true,"onlostpointercapture":true,"onmessage":true,"onmessageerror":true,"onmousedown":true,"onmouseenter":true,"onmouseleave":true,"onmousemove":true,"onmouseout":true,"onmouseover":true,"onmouseup":true,"onmousewheel":true,"onoffline":true,"ononline":true,"onpagehide":true,"onpageshow":true,"onpause":true,"onplay":true,"onplaying":true,"onpointercancel":true,"onpointerdown":true,"onpointerenter":true,"onpointerleave":true,"onpointermove":true,"onpointerout":true,"onpointerover":true,"onpointerup":true,"onpopstate":true,"onprogress":true,"onratechange":true,"onrejectionhandled":true,"onreset":true,"onresize":true,"onscroll":true,"onsearch":true,"onseeked":true,"onseeking":true,"onselect":true,"onstalled":true,"onstorage":true,"onsubmit":true,"onsuspend":true,"ontimeupdate":true,"ontoggle":true,"ontransitionend":true,"onunhandledrejection":true,"onunload":true,"onvolumechange":true,"onwaiting":true,"onwheel":true,"open":false,"openDatabase":false,"opener":false,"Option":false,"origin":false,"OscillatorNode":false,"outerHeight":false,"outerWidth":false,"OverconstrainedError":false,"PageTransitionEvent":false,"pageXOffset":false,"pageYOffset":false,"PannerNode":false,"parent":false,"Path2D":false,"PaymentAddress":false,"PaymentRequest":false,"PaymentRequestUpdateEvent":false,"PaymentResponse":false,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceLongTaskTiming":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceNavigationTiming":false,"PerformanceObserver":false,"PerformanceObserverEntryList":false,"PerformancePaintTiming":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"PeriodicWave":false,"Permissions":false,"PermissionStatus":false,"personalbar":false,"PhotoCapabilities":false,"Plugin":false,"PluginArray":false,"PointerEvent":false,"PopStateEvent":false,"postMessage":false,"Presentation":false,"PresentationAvailability":false,"PresentationConnection":false,"PresentationConnectionAvailableEvent":false,"PresentationConnectionCloseEvent":false,"PresentationConnectionList":false,"PresentationReceiver":false,"PresentationRequest":false,"print":false,"ProcessingInstruction":false,"ProgressEvent":false,"PromiseRejectionEvent":false,"prompt":false,"PushManager":false,"PushSubscription":false,"PushSubscriptionOptions":false,"queueMicrotask":false,"RadioNodeList":false,"Range":false,"ReadableStream":false,"registerProcessor":false,"RemotePlayback":false,"removeEventListener":false,"Request":false,"requestAnimationFrame":false,"requestIdleCallback":false,"resizeBy":false,"ResizeObserver":false,"ResizeObserverEntry":false,"resizeTo":false,"Response":false,"RTCCertificate":false,"RTCDataChannel":false,"RTCDataChannelEvent":false,"RTCDtlsTransport":false,"RTCIceCandidate":false,"RTCIceGatherer":false,"RTCIceTransport":false,"RTCPeerConnection":false,"RTCPeerConnectionIceEvent":false,"RTCRtpContributingSource":false,"RTCRtpReceiver":false,"RTCRtpSender":false,"RTCSctpTransport":false,"RTCSessionDescription":false,"RTCStatsReport":false,"RTCTrackEvent":false,"screen":false,"Screen":false,"screenLeft":false,"ScreenOrientation":false,"screenTop":false,"screenX":false,"screenY":false,"ScriptProcessorNode":false,"scroll":false,"scrollbars":false,"scrollBy":false,"scrollTo":false,"scrollX":false,"scrollY":false,"SecurityPolicyViolationEvent":false,"Selection":false,"self":false,"ServiceWorker":false,"ServiceWorkerContainer":false,"ServiceWorkerRegistration":false,"sessionStorage":false,"setInterval":false,"setTimeout":false,"ShadowRoot":false,"SharedWorker":false,"SourceBuffer":false,"SourceBufferList":false,"speechSynthesis":false,"SpeechSynthesisEvent":false,"SpeechSynthesisUtterance":false,"StaticRange":false,"status":false,"statusbar":false,"StereoPannerNode":false,"stop":false,"Storage":false,"StorageEvent":false,"StorageManager":false,"styleMedia":false,"StyleSheet":false,"StyleSheetList":false,"SubtleCrypto":false,"SVGAElement":false,"SVGAngle":false,"SVGAnimatedAngle":false,"SVGAnimatedBoolean":false,"SVGAnimatedEnumeration":false,"SVGAnimatedInteger":false,"SVGAnimatedLength":false,"SVGAnimatedLengthList":false,"SVGAnimatedNumber":false,"SVGAnimatedNumberList":false,"SVGAnimatedPreserveAspectRatio":false,"SVGAnimatedRect":false,"SVGAnimatedString":false,"SVGAnimatedTransformList":false,"SVGAnimateElement":false,"SVGAnimateMotionElement":false,"SVGAnimateTransformElement":false,"SVGAnimationElement":false,"SVGCircleElement":false,"SVGClipPathElement":false,"SVGComponentTransferFunctionElement":false,"SVGDefsElement":false,"SVGDescElement":false,"SVGDiscardElement":false,"SVGElement":false,"SVGEllipseElement":false,"SVGFEBlendElement":false,"SVGFEColorMatrixElement":false,"SVGFEComponentTransferElement":false,"SVGFECompositeElement":false,"SVGFEConvolveMatrixElement":false,"SVGFEDiffuseLightingElement":false,"SVGFEDisplacementMapElement":false,"SVGFEDistantLightElement":false,"SVGFEDropShadowElement":false,"SVGFEFloodElement":false,"SVGFEFuncAElement":false,"SVGFEFuncBElement":false,"SVGFEFuncGElement":false,"SVGFEFuncRElement":false,"SVGFEGaussianBlurElement":false,"SVGFEImageElement":false,"SVGFEMergeElement":false,"SVGFEMergeNodeElement":false,"SVGFEMorphologyElement":false,"SVGFEOffsetElement":false,"SVGFEPointLightElement":false,"SVGFESpecularLightingElement":false,"SVGFESpotLightElement":false,"SVGFETileElement":false,"SVGFETurbulenceElement":false,"SVGFilterElement":false,"SVGForeignObjectElement":false,"SVGGElement":false,"SVGGeometryElement":false,"SVGGradientElement":false,"SVGGraphicsElement":false,"SVGImageElement":false,"SVGLength":false,"SVGLengthList":false,"SVGLinearGradientElement":false,"SVGLineElement":false,"SVGMarkerElement":false,"SVGMaskElement":false,"SVGMatrix":false,"SVGMetadataElement":false,"SVGMPathElement":false,"SVGNumber":false,"SVGNumberList":false,"SVGPathElement":false,"SVGPatternElement":false,"SVGPoint":false,"SVGPointList":false,"SVGPolygonElement":false,"SVGPolylineElement":false,"SVGPreserveAspectRatio":false,"SVGRadialGradientElement":false,"SVGRect":false,"SVGRectElement":false,"SVGScriptElement":false,"SVGSetElement":false,"SVGStopElement":false,"SVGStringList":false,"SVGStyleElement":false,"SVGSVGElement":false,"SVGSwitchElement":false,"SVGSymbolElement":false,"SVGTextContentElement":false,"SVGTextElement":false,"SVGTextPathElement":false,"SVGTextPositioningElement":false,"SVGTitleElement":false,"SVGTransform":false,"SVGTransformList":false,"SVGTSpanElement":false,"SVGUnitTypes":false,"SVGUseElement":false,"SVGViewElement":false,"TaskAttributionTiming":false,"Text":false,"TextDecoder":false,"TextEncoder":false,"TextEvent":false,"TextMetrics":false,"TextTrack":false,"TextTrackCue":false,"TextTrackCueList":false,"TextTrackList":false,"TimeRanges":false,"toolbar":false,"top":false,"Touch":false,"TouchEvent":false,"TouchList":false,"TrackEvent":false,"TransitionEvent":false,"TreeWalker":false,"UIEvent":false,"URL":false,"URLSearchParams":false,"ValidityState":false,"visualViewport":false,"VisualViewport":false,"VTTCue":false,"WaveShaperNode":false,"WebAssembly":false,"WebGL2RenderingContext":false,"WebGLActiveInfo":false,"WebGLBuffer":false,"WebGLContextEvent":false,"WebGLFramebuffer":false,"WebGLProgram":false,"WebGLQuery":false,"WebGLRenderbuffer":false,"WebGLRenderingContext":false,"WebGLSampler":false,"WebGLShader":false,"WebGLShaderPrecisionFormat":false,"WebGLSync":false,"WebGLTexture":false,"WebGLTransformFeedback":false,"WebGLUniformLocation":false,"WebGLVertexArrayObject":false,"WebSocket":false,"WheelEvent":false,"window":false,"Window":false,"Worker":false,"WritableStream":false,"XMLDocument":false,"XMLHttpRequest":false,"XMLHttpRequestEventTarget":false,"XMLHttpRequestUpload":false,"XMLSerializer":false,"XPathEvaluator":false,"XPathExpression":false,"XPathResult":false,"XSLTProcessor":false},"worker":{"addEventListener":false,"applicationCache":false,"atob":false,"Blob":false,"BroadcastChannel":false,"btoa":false,"Cache":false,"caches":false,"clearInterval":false,"clearTimeout":false,"close":true,"console":false,"fetch":false,"FileReaderSync":false,"FormData":false,"Headers":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"ImageData":false,"importScripts":true,"indexedDB":false,"location":false,"MessageChannel":false,"MessagePort":false,"name":false,"navigator":false,"Notification":false,"onclose":true,"onconnect":true,"onerror":true,"onlanguagechange":true,"onmessage":true,"onoffline":true,"ononline":true,"onrejectionhandled":true,"onunhandledrejection":true,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"postMessage":true,"Promise":false,"queueMicrotask":false,"removeEventListener":false,"Request":false,"Response":false,"self":true,"ServiceWorkerRegistration":false,"setInterval":false,"setTimeout":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false,"WebSocket":false,"Worker":false,"WorkerGlobalScope":false,"XMLHttpRequest":false},"node":{"__dirname":false,"__filename":false,"AbortController":false,"AbortSignal":false,"atob":false,"btoa":false,"Buffer":false,"clearImmediate":false,"clearInterval":false,"clearTimeout":false,"console":false,"DOMException":false,"Event":false,"EventTarget":false,"exports":true,"global":false,"Intl":false,"MessageChannel":false,"MessageEvent":false,"MessagePort":false,"module":false,"performance":false,"process":false,"queueMicrotask":false,"require":false,"setImmediate":false,"setInterval":false,"setTimeout":false,"structuredClone":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false},"nodeBuiltin":{"AbortController":false,"AbortSignal":false,"atob":false,"btoa":false,"Buffer":false,"clearImmediate":false,"clearInterval":false,"clearTimeout":false,"console":false,"DOMException":false,"Event":false,"EventTarget":false,"global":false,"Intl":false,"MessageChannel":false,"MessageEvent":false,"MessagePort":false,"performance":false,"process":false,"queueMicrotask":false,"setImmediate":false,"setInterval":false,"setTimeout":false,"structuredClone":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false},"commonjs":{"exports":true,"global":false,"module":false,"require":false},"amd":{"define":false,"require":false},"mocha":{"after":false,"afterEach":false,"before":false,"beforeEach":false,"context":false,"describe":false,"it":false,"mocha":false,"run":false,"setup":false,"specify":false,"suite":false,"suiteSetup":false,"suiteTeardown":false,"teardown":false,"test":false,"xcontext":false,"xdescribe":false,"xit":false,"xspecify":false},"jasmine":{"afterAll":false,"afterEach":false,"beforeAll":false,"beforeEach":false,"describe":false,"expect":false,"expectAsync":false,"fail":false,"fdescribe":false,"fit":false,"it":false,"jasmine":false,"pending":false,"runs":false,"spyOn":false,"spyOnAllFunctions":false,"spyOnProperty":false,"waits":false,"waitsFor":false,"xdescribe":false,"xit":false},"jest":{"afterAll":false,"afterEach":false,"beforeAll":false,"beforeEach":false,"describe":false,"expect":false,"fdescribe":false,"fit":false,"it":false,"jest":false,"pit":false,"require":false,"test":false,"xdescribe":false,"xit":false,"xtest":false},"qunit":{"asyncTest":false,"deepEqual":false,"equal":false,"expect":false,"module":false,"notDeepEqual":false,"notEqual":false,"notOk":false,"notPropEqual":false,"notStrictEqual":false,"ok":false,"propEqual":false,"QUnit":false,"raises":false,"start":false,"stop":false,"strictEqual":false,"test":false,"throws":false},"phantomjs":{"console":true,"exports":true,"phantom":true,"require":true,"WebPage":true},"couch":{"emit":false,"exports":false,"getRow":false,"log":false,"module":false,"provides":false,"require":false,"respond":false,"send":false,"start":false,"sum":false},"rhino":{"defineClass":false,"deserialize":false,"gc":false,"help":false,"importClass":false,"importPackage":false,"java":false,"load":false,"loadClass":false,"Packages":false,"print":false,"quit":false,"readFile":false,"readUrl":false,"runCommand":false,"seal":false,"serialize":false,"spawn":false,"sync":false,"toint32":false,"version":false},"nashorn":{"__DIR__":false,"__FILE__":false,"__LINE__":false,"com":false,"edu":false,"exit":false,"java":false,"Java":false,"javafx":false,"JavaImporter":false,"javax":false,"JSAdapter":false,"load":false,"loadWithNewGlobal":false,"org":false,"Packages":false,"print":false,"quit":false},"wsh":{"ActiveXObject":false,"CollectGarbage":false,"Debug":false,"Enumerator":false,"GetObject":false,"RuntimeObject":false,"ScriptEngine":false,"ScriptEngineBuildVersion":false,"ScriptEngineMajorVersion":false,"ScriptEngineMinorVersion":false,"VBArray":false,"WScript":false,"WSH":false},"jquery":{"$":false,"jQuery":false},"yui":{"YAHOO":false,"YAHOO_config":false,"YUI":false,"YUI_config":false},"shelljs":{"cat":false,"cd":false,"chmod":false,"config":false,"cp":false,"dirs":false,"echo":false,"env":false,"error":false,"exec":false,"exit":false,"find":false,"grep":false,"ln":false,"ls":false,"mkdir":false,"mv":false,"popd":false,"pushd":false,"pwd":false,"rm":false,"sed":false,"set":false,"target":false,"tempdir":false,"test":false,"touch":false,"which":false},"prototypejs":{"$":false,"$$":false,"$A":false,"$break":false,"$continue":false,"$F":false,"$H":false,"$R":false,"$w":false,"Abstract":false,"Ajax":false,"Autocompleter":false,"Builder":false,"Class":false,"Control":false,"Draggable":false,"Draggables":false,"Droppables":false,"Effect":false,"Element":false,"Enumerable":false,"Event":false,"Field":false,"Form":false,"Hash":false,"Insertion":false,"ObjectRange":false,"PeriodicalExecuter":false,"Position":false,"Prototype":false,"Scriptaculous":false,"Selector":false,"Sortable":false,"SortableObserver":false,"Sound":false,"Template":false,"Toggle":false,"Try":false},"meteor":{"$":false,"Accounts":false,"AccountsClient":false,"AccountsCommon":false,"AccountsServer":false,"App":false,"Assets":false,"Blaze":false,"check":false,"Cordova":false,"DDP":false,"DDPRateLimiter":false,"DDPServer":false,"Deps":false,"EJSON":false,"Email":false,"HTTP":false,"Log":false,"Match":false,"Meteor":false,"Mongo":false,"MongoInternals":false,"Npm":false,"Package":false,"Plugin":false,"process":false,"Random":false,"ReactiveDict":false,"ReactiveVar":false,"Router":false,"ServiceConfiguration":false,"Session":false,"share":false,"Spacebars":false,"Template":false,"Tinytest":false,"Tracker":false,"UI":false,"Utils":false,"WebApp":false,"WebAppInternals":false},"mongo":{"_isWindows":false,"_rand":false,"BulkWriteResult":false,"cat":false,"cd":false,"connect":false,"db":false,"getHostName":false,"getMemInfo":false,"hostname":false,"ISODate":false,"listFiles":false,"load":false,"ls":false,"md5sumFile":false,"mkdir":false,"Mongo":false,"NumberInt":false,"NumberLong":false,"ObjectId":false,"PlanCache":false,"print":false,"printjson":false,"pwd":false,"quit":false,"removeFile":false,"rs":false,"sh":false,"UUID":false,"version":false,"WriteResult":false},"applescript":{"$":false,"Application":false,"Automation":false,"console":false,"delay":false,"Library":false,"ObjC":false,"ObjectSpecifier":false,"Path":false,"Progress":false,"Ref":false},"serviceworker":{"addEventListener":false,"applicationCache":false,"atob":false,"Blob":false,"BroadcastChannel":false,"btoa":false,"Cache":false,"caches":false,"CacheStorage":false,"clearInterval":false,"clearTimeout":false,"Client":false,"clients":false,"Clients":false,"close":true,"console":false,"ExtendableEvent":false,"ExtendableMessageEvent":false,"fetch":false,"FetchEvent":false,"FileReaderSync":false,"FormData":false,"Headers":false,"IDBCursor":false,"IDBCursorWithValue":false,"IDBDatabase":false,"IDBFactory":false,"IDBIndex":false,"IDBKeyRange":false,"IDBObjectStore":false,"IDBOpenDBRequest":false,"IDBRequest":false,"IDBTransaction":false,"IDBVersionChangeEvent":false,"ImageData":false,"importScripts":false,"indexedDB":false,"location":false,"MessageChannel":false,"MessagePort":false,"name":false,"navigator":false,"Notification":false,"onclose":true,"onconnect":true,"onerror":true,"onfetch":true,"oninstall":true,"onlanguagechange":true,"onmessage":true,"onmessageerror":true,"onnotificationclick":true,"onnotificationclose":true,"onoffline":true,"ononline":true,"onpush":true,"onpushsubscriptionchange":true,"onrejectionhandled":true,"onsync":true,"onunhandledrejection":true,"performance":false,"Performance":false,"PerformanceEntry":false,"PerformanceMark":false,"PerformanceMeasure":false,"PerformanceNavigation":false,"PerformanceResourceTiming":false,"PerformanceTiming":false,"postMessage":true,"Promise":false,"queueMicrotask":false,"registration":false,"removeEventListener":false,"Request":false,"Response":false,"self":false,"ServiceWorker":false,"ServiceWorkerContainer":false,"ServiceWorkerGlobalScope":false,"ServiceWorkerMessageEvent":false,"ServiceWorkerRegistration":false,"setInterval":false,"setTimeout":false,"skipWaiting":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false,"WebSocket":false,"WindowClient":false,"Worker":false,"WorkerGlobalScope":false,"XMLHttpRequest":false},"atomtest":{"advanceClock":false,"atom":false,"fakeClearInterval":false,"fakeClearTimeout":false,"fakeSetInterval":false,"fakeSetTimeout":false,"resetTimeouts":false,"waitsForPromise":false},"embertest":{"andThen":false,"click":false,"currentPath":false,"currentRouteName":false,"currentURL":false,"fillIn":false,"find":false,"findAll":false,"findWithAssert":false,"keyEvent":false,"pauseTest":false,"resumeTest":false,"triggerEvent":false,"visit":false,"wait":false},"protractor":{"$":false,"$$":false,"browser":false,"by":false,"By":false,"DartObject":false,"element":false,"protractor":false},"shared-node-browser":{"AbortController":false,"AbortSignal":false,"atob":false,"btoa":false,"clearInterval":false,"clearTimeout":false,"console":false,"DOMException":false,"Event":false,"EventTarget":false,"Intl":false,"MessageChannel":false,"MessageEvent":false,"MessagePort":false,"performance":false,"queueMicrotask":false,"setInterval":false,"setTimeout":false,"TextDecoder":false,"TextEncoder":false,"URL":false,"URLSearchParams":false},"webextensions":{"browser":false,"chrome":false,"opr":false},"greasemonkey":{"cloneInto":false,"createObjectIn":false,"exportFunction":false,"GM":false,"GM_addElement":false,"GM_addStyle":false,"GM_addValueChangeListener":false,"GM_deleteValue":false,"GM_download":false,"GM_getResourceText":false,"GM_getResourceURL":false,"GM_getTab":false,"GM_getTabs":false,"GM_getValue":false,"GM_info":false,"GM_listValues":false,"GM_log":false,"GM_notification":false,"GM_openInTab":false,"GM_registerMenuCommand":false,"GM_removeValueChangeListener":false,"GM_saveTab":false,"GM_setClipboard":false,"GM_setValue":false,"GM_unregisterMenuCommand":false,"GM_xmlhttpRequest":false,"unsafeWindow":false},"devtools":{"$":false,"$_":false,"$$":false,"$0":false,"$1":false,"$2":false,"$3":false,"$4":false,"$x":false,"chrome":false,"clear":false,"copy":false,"debug":false,"dir":false,"dirxml":false,"getEventListeners":false,"inspect":false,"keys":false,"monitor":false,"monitorEvents":false,"profile":false,"profileEnd":false,"queryObjects":false,"table":false,"undebug":false,"unmonitor":false,"unmonitorEvents":false,"values":false}}'); /***/ }), /* 494 */ /***/ ((module) => { -"use strict"; -module.exports = JSON.parse('{"id":"http://json-schema.org/draft-04/schema#","$schema":"http://json-schema.org/draft-04/schema#","description":"Core schema meta-schema","definitions":{"schemaArray":{"type":"array","minItems":1,"items":{"$ref":"#"}},"positiveInteger":{"type":"integer","minimum":0},"positiveIntegerDefault0":{"allOf":[{"$ref":"#/definitions/positiveInteger"},{"default":0}]},"simpleTypes":{"enum":["array","boolean","integer","null","number","object","string"]},"stringArray":{"type":"array","items":{"type":"string"},"minItems":1,"uniqueItems":true}},"type":"object","properties":{"id":{"type":"string"},"$schema":{"type":"string"},"title":{"type":"string"},"description":{"type":"string"},"default":{},"multipleOf":{"type":"number","minimum":0,"exclusiveMinimum":true},"maximum":{"type":"number"},"exclusiveMaximum":{"type":"boolean","default":false},"minimum":{"type":"number"},"exclusiveMinimum":{"type":"boolean","default":false},"maxLength":{"$ref":"#/definitions/positiveInteger"},"minLength":{"$ref":"#/definitions/positiveIntegerDefault0"},"pattern":{"type":"string","format":"regex"},"additionalItems":{"anyOf":[{"type":"boolean"},{"$ref":"#"}],"default":{}},"items":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/schemaArray"}],"default":{}},"maxItems":{"$ref":"#/definitions/positiveInteger"},"minItems":{"$ref":"#/definitions/positiveIntegerDefault0"},"uniqueItems":{"type":"boolean","default":false},"maxProperties":{"$ref":"#/definitions/positiveInteger"},"minProperties":{"$ref":"#/definitions/positiveIntegerDefault0"},"required":{"$ref":"#/definitions/stringArray"},"additionalProperties":{"anyOf":[{"type":"boolean"},{"$ref":"#"}],"default":{}},"definitions":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"properties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"patternProperties":{"type":"object","additionalProperties":{"$ref":"#"},"default":{}},"dependencies":{"type":"object","additionalProperties":{"anyOf":[{"$ref":"#"},{"$ref":"#/definitions/stringArray"}]}},"enum":{"type":"array","minItems":1,"uniqueItems":true},"type":{"anyOf":[{"$ref":"#/definitions/simpleTypes"},{"type":"array","items":{"$ref":"#/definitions/simpleTypes"},"minItems":1,"uniqueItems":true}]},"format":{"type":"string"},"allOf":{"$ref":"#/definitions/schemaArray"},"anyOf":{"$ref":"#/definitions/schemaArray"},"oneOf":{"$ref":"#/definitions/schemaArray"},"not":{"$ref":"#"}},"dependencies":{"exclusiveMaximum":["maximum"],"exclusiveMinimum":["minimum"]},"default":{}}'); +// shim for using process in browser +var process = module.exports = {}; // cached from whatever global is present so that test runners that stub it +// don't break things. But we need to wrap it in a try catch in case it is +// wrapped in strict mode code which doesn't define any globals. It's inside a +// function because try/catches deoptimize in certain engines. + +var cachedSetTimeout; +var cachedClearTimeout; + +function defaultSetTimout() { + throw new Error('setTimeout has not been defined'); +} + +function defaultClearTimeout() { + throw new Error('clearTimeout has not been defined'); +} + +(function () { + try { + if (typeof setTimeout === 'function') { + cachedSetTimeout = setTimeout; + } else { + cachedSetTimeout = defaultSetTimout; + } + } catch (e) { + cachedSetTimeout = defaultSetTimout; + } + + try { + if (typeof clearTimeout === 'function') { + cachedClearTimeout = clearTimeout; + } else { + cachedClearTimeout = defaultClearTimeout; + } + } catch (e) { + cachedClearTimeout = defaultClearTimeout; + } +})(); + +function runTimeout(fun) { + if (cachedSetTimeout === setTimeout) { + //normal enviroments in sane situations + return setTimeout(fun, 0); + } // if setTimeout wasn't available but was latter defined + + + if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { + cachedSetTimeout = setTimeout; + return setTimeout(fun, 0); + } + + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedSetTimeout(fun, 0); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedSetTimeout.call(null, fun, 0); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error + return cachedSetTimeout.call(this, fun, 0); + } + } +} + +function runClearTimeout(marker) { + if (cachedClearTimeout === clearTimeout) { + //normal enviroments in sane situations + return clearTimeout(marker); + } // if clearTimeout wasn't available but was latter defined + + + if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { + cachedClearTimeout = clearTimeout; + return clearTimeout(marker); + } + + try { + // when when somebody has screwed with setTimeout but no I.E. maddness + return cachedClearTimeout(marker); + } catch (e) { + try { + // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally + return cachedClearTimeout.call(null, marker); + } catch (e) { + // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. + // Some versions of I.E. have different rules for clearTimeout vs setTimeout + return cachedClearTimeout.call(this, marker); + } + } +} + +var queue = []; +var draining = false; +var currentQueue; +var queueIndex = -1; + +function cleanUpNextTick() { + if (!draining || !currentQueue) { + return; + } + + draining = false; + + if (currentQueue.length) { + queue = currentQueue.concat(queue); + } else { + queueIndex = -1; + } + + if (queue.length) { + drainQueue(); + } +} + +function drainQueue() { + if (draining) { + return; + } + + var timeout = runTimeout(cleanUpNextTick); + draining = true; + var len = queue.length; + + while (len) { + currentQueue = queue; + queue = []; + + while (++queueIndex < len) { + if (currentQueue) { + currentQueue[queueIndex].run(); + } + } + + queueIndex = -1; + len = queue.length; + } + + currentQueue = null; + draining = false; + runClearTimeout(timeout); +} + +process.nextTick = function (fun) { + var args = new Array(arguments.length - 1); + + if (arguments.length > 1) { + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; + } + } + + queue.push(new Item(fun, args)); + + if (queue.length === 1 && !draining) { + runTimeout(drainQueue); + } +}; // v8 likes predictible objects + + +function Item(fun, array) { + this.fun = fun; + this.array = array; +} + +Item.prototype.run = function () { + this.fun.apply(null, this.array); +}; + +process.title = 'browser'; +process.browser = true; +process.env = {}; +process.argv = []; +process.version = ''; // empty string to avoid regexp issues + +process.versions = {}; + +function noop() {} + +process.on = noop; +process.addListener = noop; +process.once = noop; +process.off = noop; +process.removeListener = noop; +process.removeAllListeners = noop; +process.emit = noop; +process.prependListener = noop; +process.prependOnceListener = noop; + +process.listeners = function (name) { + return []; +}; + +process.binding = function (name) { + throw new Error('process.binding is not supported'); +}; + +process.cwd = function () { + return '/'; +}; + +process.chdir = function (dir) { + throw new Error('process.chdir is not supported'); +}; + +process.umask = function () { + return 0; +}; /***/ }), /* 495 */ @@ -42325,7 +43691,7 @@ module.exports = JSON.parse('{"id":"http://json-schema.org/draft-04/schema#","$s // Requirements //------------------------------------------------------------------------------ -const vk = __webpack_require__(421); +const vk = __webpack_require__(435); const debug = __webpack_require__(496)("eslint:traverser"); //------------------------------------------------------------------------------ // Helpers @@ -42381,18 +43747,18 @@ class Traverser { this._visitorKeys = null; this._enter = null; this._leave = null; - } // eslint-disable-next-line jsdoc/require-description - + } /** + * Gives current node. * @returns {ASTNode} The current node. */ current() { return this._current; - } // eslint-disable-next-line jsdoc/require-description - + } /** + * Gives a a copy of the ancestor nodes. * @returns {ASTNode[]} The ancestor nodes. */ @@ -42530,8 +43896,8 @@ module.exports = Traverser; /* 496 */ /***/ ((module, exports, __webpack_require__) => { -/* provided dependency */ var console = __webpack_require__(493); -/* provided dependency */ var process = __webpack_require__(445); +/* provided dependency */ var console = __webpack_require__(438); +/* provided dependency */ var process = __webpack_require__(494); /* eslint-env browser */ /** @@ -42582,7 +43948,11 @@ function useColors() { // document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 - return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); + return typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance || // Is firebug? http://stackoverflow.com/a/398120/376773 + typeof window !== 'undefined' && window.console && (window.console.firebug || window.console.exception && window.console.table) || // Is firefox >= v31? + // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31 || // Double check webkit in userAgent just in case we are in a worker + typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/); } /** * Colorize log arguments if enabled. @@ -42716,7 +44086,7 @@ formatters.j = function (v) { /* 497 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var console = __webpack_require__(493); +/* provided dependency */ var console = __webpack_require__(438); /** * This is the common logic for both the Node.js and web browser * implementations of `debug()`. @@ -42748,7 +44118,7 @@ function setup(env) { createDebug.formatters = {}; /** * Selects a color for a debug namespace - * @param {String} namespace The namespace string for the for the debug instance to be colored + * @param {String} namespace The namespace string for the debug instance to be colored * @return {Number|String} An ANSI color code for the given namespace * @api private */ @@ -42779,7 +44149,11 @@ function setup(env) { let namespacesCache; let enabledCache; - function debug(...args) { + function debug() { + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + // Disabled? if (!debug.enabled) { return; @@ -43198,7 +44572,7 @@ const { isCommentToken } = __webpack_require__(501), TokenStore = __webpack_require__(504), - astUtils = __webpack_require__(439), + astUtils = __webpack_require__(444), Traverser = __webpack_require__(495); //------------------------------------------------------------------------------ // Private //------------------------------------------------------------------------------ @@ -43305,7 +44679,12 @@ function isSpaceBetween(sourceCode, first, second, checkInsideOfJSXText) { includeComments: true }); - if (currentToken.range[1] !== nextToken.range[0] || checkInsideOfJSXText && nextToken !== finalToken && nextToken.type === "JSXText" && /\s/u.test(nextToken.value)) { + if (currentToken.range[1] !== nextToken.range[0] || + /* + * For backward compatibility, check spaces in JSXText. + * https://github.com/eslint/eslint/issues/12614 + */ + checkInsideOfJSXText && nextToken !== finalToken && nextToken.type === "JSXText" && /\s/u.test(nextToken.value)) { return true; } @@ -43317,10 +44696,13 @@ function isSpaceBetween(sourceCode, first, second, checkInsideOfJSXText) { // Public Interface //------------------------------------------------------------------------------ +/** + * Represents parsed source code. + */ + class SourceCode extends TokenStore { /** - * Represents parsed source code. * @param {string|Object} textOrConfig The source code text or config object. * @param {string} textOrConfig.text The source code text. * @param {ASTNode} textOrConfig.ast The Program node of the AST representing the code. This AST should be created from the text that BOM was stripped. @@ -43347,20 +44729,20 @@ class SourceCode extends TokenStore { super(ast.tokens, ast.comments); /** * The flag to indicate that the source code has Unicode BOM. - * @type boolean + * @type {boolean} */ this.hasBOM = text.charCodeAt(0) === 0xFEFF; /** * The original text source code. * BOM was stripped from this text. - * @type string + * @type {string} */ this.text = this.hasBOM ? text.slice(1) : text; /** * The parsed AST for the source code. - * @type ASTNode + * @type {ASTNode} */ this.ast = ast; @@ -43394,7 +44776,7 @@ class SourceCode extends TokenStore { /** * The source code split into lines according to ECMA-262 specification. * This is done to avoid each rule needing to do so separately. - * @type string[] + * @type {string[]} */ this.lines = []; @@ -43522,7 +44904,7 @@ class SourceCode extends TokenStore { }); while (currentToken && isCommentToken(currentToken)) { - if (node.parent && currentToken.start < node.parent.start) { + if (node.parent && node.parent.type !== "Program" && currentToken.start < node.parent.start) { break; } @@ -43538,7 +44920,7 @@ class SourceCode extends TokenStore { }); while (currentToken && isCommentToken(currentToken)) { - if (node.parent && currentToken.end > node.parent.end) { + if (node.parent && node.parent.type !== "Program" && currentToken.end > node.parent.end) { break; } @@ -43682,6 +45064,7 @@ class SourceCode extends TokenStore { /** * Converts a source text index into a (line, column) pair. * @param {number} index The index of a character in a file + * @throws {TypeError} If non-numeric index or index out of range. * @returns {Object} A {line, column} location object with a 0-indexed column * @public */ @@ -43693,7 +45076,7 @@ class SourceCode extends TokenStore { } if (index < 0 || index > this.text.length) { - throw new RangeError(`Index out of range (requested index ${index}, but source text has length ${this.text.length}).`); + throw new RangeError("Index out of range (requested index ".concat(index, ", but source text has length ").concat(this.text.length, ").")); } /* * For an argument of this.text.length, return the location one "spot" past the last character @@ -43727,6 +45110,9 @@ class SourceCode extends TokenStore { * @param {Object} loc A line/column location * @param {number} loc.line The line number of the location (1-indexed) * @param {number} loc.column The column number of the location (0-indexed) + * @throws {TypeError|RangeError} If `loc` is not an object with a numeric + * `line` and `column`, if the `line` is less than or equal to zero or + * the line or column is out of the expected range. * @returns {number} The range index of the location in the file. * @public */ @@ -43738,11 +45124,11 @@ class SourceCode extends TokenStore { } if (loc.line <= 0) { - throw new RangeError(`Line number out of range (line ${loc.line} requested). Line numbers should be 1-based.`); + throw new RangeError("Line number out of range (line ".concat(loc.line, " requested). Line numbers should be 1-based.")); } if (loc.line > this.lineStartIndices.length) { - throw new RangeError(`Line number out of range (line ${loc.line} requested, but only ${this.lineStartIndices.length} lines present).`); + throw new RangeError("Line number out of range (line ".concat(loc.line, " requested, but only ").concat(this.lineStartIndices.length, " lines present).")); } const lineStartIndex = this.lineStartIndices[loc.line - 1]; @@ -43758,7 +45144,7 @@ class SourceCode extends TokenStore { */ if (loc.line === this.lineStartIndices.length && positionIndex > lineEndIndex || loc.line < this.lineStartIndices.length && positionIndex >= lineEndIndex) { - throw new RangeError(`Column number out of range (column ${loc.column} requested, but the length of line ${loc.line} is ${lineEndIndex - lineStartIndex}).`); + throw new RangeError("Column number out of range (column ".concat(loc.column, " requested, but the length of line ").concat(loc.line, " is ").concat(lineEndIndex - lineStartIndex, ").")); } return positionIndex; @@ -43865,6 +45251,17 @@ function negate0(token) { function negate(f) { return negate0.bind(f); } +/** + * Checks if the given token is a PunctuatorToken with the given value + * @param {Token} token - The token to check. + * @param {string} value - The value to check. + * @returns {boolean} `true` if the token is a PunctuatorToken with the given value. + */ + + +function isPunctuatorTokenWithValue(token, value) { + return token.type === "Punctuator" && token.value === value; +} /** * Checks if the given token is an arrow token or not. * @param {Token} token - The token to check. @@ -43873,7 +45270,7 @@ function negate(f) { function isArrowToken(token) { - return token.value === "=>" && token.type === "Punctuator"; + return isPunctuatorTokenWithValue(token, "=>"); } /** * Checks if the given token is a comma token or not. @@ -43883,7 +45280,7 @@ function isArrowToken(token) { function isCommaToken(token) { - return token.value === "," && token.type === "Punctuator"; + return isPunctuatorTokenWithValue(token, ","); } /** * Checks if the given token is a semicolon token or not. @@ -43893,7 +45290,7 @@ function isCommaToken(token) { function isSemicolonToken(token) { - return token.value === ";" && token.type === "Punctuator"; + return isPunctuatorTokenWithValue(token, ";"); } /** * Checks if the given token is a colon token or not. @@ -43903,7 +45300,7 @@ function isSemicolonToken(token) { function isColonToken(token) { - return token.value === ":" && token.type === "Punctuator"; + return isPunctuatorTokenWithValue(token, ":"); } /** * Checks if the given token is an opening parenthesis token or not. @@ -43913,7 +45310,7 @@ function isColonToken(token) { function isOpeningParenToken(token) { - return token.value === "(" && token.type === "Punctuator"; + return isPunctuatorTokenWithValue(token, "("); } /** * Checks if the given token is a closing parenthesis token or not. @@ -43923,7 +45320,7 @@ function isOpeningParenToken(token) { function isClosingParenToken(token) { - return token.value === ")" && token.type === "Punctuator"; + return isPunctuatorTokenWithValue(token, ")"); } /** * Checks if the given token is an opening square bracket token or not. @@ -43933,7 +45330,7 @@ function isClosingParenToken(token) { function isOpeningBracketToken(token) { - return token.value === "[" && token.type === "Punctuator"; + return isPunctuatorTokenWithValue(token, "["); } /** * Checks if the given token is a closing square bracket token or not. @@ -43943,7 +45340,7 @@ function isOpeningBracketToken(token) { function isClosingBracketToken(token) { - return token.value === "]" && token.type === "Punctuator"; + return isPunctuatorTokenWithValue(token, "]"); } /** * Checks if the given token is an opening brace token or not. @@ -43953,7 +45350,7 @@ function isClosingBracketToken(token) { function isOpeningBraceToken(token) { - return token.value === "{" && token.type === "Punctuator"; + return isPunctuatorTokenWithValue(token, "{"); } /** * Checks if the given token is a closing brace token or not. @@ -43963,7 +45360,7 @@ function isOpeningBraceToken(token) { function isClosingBraceToken(token) { - return token.value === "}" && token.type === "Punctuator"; + return isPunctuatorTokenWithValue(token, "}"); } /** * Checks if the given token is a comment token or not. @@ -43973,7 +45370,7 @@ function isClosingBraceToken(token) { function isCommentToken(token) { - return token.type === "Line" || token.type === "Block" || token.type === "Shebang"; + return ["Block", "Line", "Shebang"].includes(token.type); } const isNotArrowToken = negate(isArrowToken); @@ -44014,7 +45411,7 @@ function getFunctionHeadLocation(node, sourceCode) { const arrowToken = sourceCode.getTokenBefore(node.body, isArrowToken); start = arrowToken.loc.start; end = arrowToken.loc.end; - } else if (parent.type === "Property" || parent.type === "MethodDefinition") { + } else if (parent.type === "Property" || parent.type === "MethodDefinition" || parent.type === "PropertyDefinition") { start = parent.loc.start; end = getOpeningParenOfParams(node, sourceCode).loc.start; } else { @@ -44023,16 +45420,18 @@ function getFunctionHeadLocation(node, sourceCode) { } return { - start: Object.assign({}, start), - end: Object.assign({}, end) + start: { ...start + }, + end: { ...end + } }; } -/* globals BigInt, globalThis, global, self, window */ +/* globals globalThis, global, self, window */ const globalObject = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {}; const builtinNames = Object.freeze(new Set(["Array", "ArrayBuffer", "BigInt", "BigInt64Array", "BigUint64Array", "Boolean", "DataView", "Date", "decodeURI", "decodeURIComponent", "encodeURI", "encodeURIComponent", "escape", "Float32Array", "Float64Array", "Function", "Infinity", "Int16Array", "Int32Array", "Int8Array", "isFinite", "isNaN", "isPrototypeOf", "JSON", "Map", "Math", "NaN", "Number", "Object", "parseFloat", "parseInt", "Promise", "Proxy", "Reflect", "RegExp", "Set", "String", "Symbol", "Uint16Array", "Uint32Array", "Uint8Array", "Uint8ClampedArray", "undefined", "unescape", "WeakMap", "WeakSet"])); -const callAllowed = new Set([Array.isArray, typeof BigInt === "function" ? BigInt : undefined, Boolean, Date, Date.parse, decodeURI, decodeURIComponent, encodeURI, encodeURIComponent, escape, isFinite, isNaN, isPrototypeOf, ...Object.getOwnPropertyNames(Math).map(k => Math[k]).filter(f => typeof f === "function"), Number, Number.isFinite, Number.isNaN, Number.parseFloat, Number.parseInt, Object, Object.entries, Object.is, Object.isExtensible, Object.isFrozen, Object.isSealed, Object.keys, Object.values, parseFloat, parseInt, RegExp, String, String.fromCharCode, String.fromCodePoint, String.raw, Symbol, Symbol.for, Symbol.keyFor, unescape].filter(f => typeof f === "function")); +const callAllowed = new Set([Array.isArray, typeof BigInt === "function" ? BigInt : undefined, Boolean, Date, Date.parse, decodeURI, decodeURIComponent, encodeURI, encodeURIComponent, escape, isFinite, isNaN, isPrototypeOf, ...Object.getOwnPropertyNames(Math).map(k => Math[k]).filter(f => typeof f === "function"), Number, Number.isFinite, Number.isNaN, Number.parseFloat, Number.parseInt, Object, Object.entries, Object.is, Object.isExtensible, Object.isFrozen, Object.isSealed, Object.keys, Object.values, parseFloat, parseInt, RegExp, String, String.fromCharCode, String.fromCodePoint, String.raw, Symbol.for, Symbol.keyFor, unescape].filter(f => typeof f === "function")); const callPassThrough = new Set([Object.freeze, Object.preventExtensions, Object.seal]); /** * Get the property descriptor. @@ -44246,6 +45645,10 @@ const operations = Object.freeze({ if (args != null) { if (calleeNode.type === "MemberExpression") { + if (calleeNode.property.type === "PrivateIdentifier") { + return null; + } + const object = getStaticValueR(calleeNode.object, initialScope); if (object != null) { @@ -44256,9 +45659,7 @@ const operations = Object.freeze({ }; } - const property = calleeNode.computed ? getStaticValueR(calleeNode.property, initialScope) : { - value: calleeNode.property.name - }; + const property = getStaticPropertyNameValue(calleeNode, initialScope); if (property != null) { const receiver = object.value; @@ -44377,6 +45778,10 @@ const operations = Object.freeze({ }, MemberExpression(node, initialScope) { + if (node.property.type === "PrivateIdentifier") { + return null; + } + const object = getStaticValueR(node.object, initialScope); if (object != null) { @@ -44387,9 +45792,7 @@ const operations = Object.freeze({ }; } - const property = node.computed ? getStaticValueR(node.property, initialScope) : { - value: node.property.name - }; + const property = getStaticPropertyNameValue(node, initialScope); if (property != null && !isGetter(object.value, property.value)) { return { @@ -44439,9 +45842,7 @@ const operations = Object.freeze({ return null; } - const key = propertyNode.computed ? getStaticValueR(propertyNode.key, initialScope) : { - value: propertyNode.key.name - }; + const key = getStaticPropertyNameValue(propertyNode, initialScope); const value = getStaticValueR(propertyNode.value, initialScope); if (key == null || value == null) { @@ -44573,6 +45974,41 @@ function getStaticValueR(node, initialScope) { return null; } +/** + * Get the static value of property name from a MemberExpression node or a Property node. + * @param {Node} node The node to get. + * @param {Scope} [initialScope] The scope to start finding variable. Optional. If the node is a computed property node and this scope was given, this checks the computed property name by the `getStringIfConstant` function with the scope, and returns the value of it. + * @returns {{value:any}|{value:undefined,optional?:true}|null} The static value of the property name of the node, or `null`. + */ + + +function getStaticPropertyNameValue(node, initialScope) { + const nameNode = node.type === "Property" ? node.key : node.property; + + if (node.computed) { + return getStaticValueR(nameNode, initialScope); + } + + if (nameNode.type === "Identifier") { + return { + value: nameNode.name + }; + } + + if (nameNode.type === "Literal") { + if (nameNode.bigint) { + return { + value: nameNode.bigint + }; + } + + return { + value: String(nameNode.value) + }; + } + + return null; +} /** * Get the value of a given node if it's a static value. * @param {Node} node The node to get. @@ -44581,7 +46017,9 @@ function getStaticValueR(node, initialScope) { */ -function getStaticValue(node, initialScope = null) { +function getStaticValue(node) { + let initialScope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + try { return getStaticValueR(node, initialScope); } catch (_error) { @@ -44596,11 +46034,13 @@ function getStaticValue(node, initialScope = null) { */ -function getStringIfConstant(node, initialScope = null) { +function getStringIfConstant(node) { + let initialScope = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; + // Handle the literals that the platform doesn't support natively. if (node && node.type === "Literal" && node.value === null) { if (node.regex) { - return `/${node.regex.pattern}/${node.regex.flags}`; + return "/".concat(node.regex.pattern, "/").concat(node.regex.flags); } if (node.bigint) { @@ -44626,10 +46066,15 @@ function getPropertyName(node, initialScope) { return getStringIfConstant(node.property, initialScope); } + if (node.property.type === "PrivateIdentifier") { + return null; + } + return node.property.name; case "Property": case "MethodDefinition": + case "PropertyDefinition": if (node.computed) { return getStringIfConstant(node.key, initialScope); } @@ -44638,6 +46083,10 @@ function getPropertyName(node, initialScope) { return String(node.key.value); } + if (node.key.type === "PrivateIdentifier") { + return null; + } + return node.key.name; // no default } @@ -44647,16 +46096,27 @@ function getPropertyName(node, initialScope) { /** * Get the name and kind of the given function node. * @param {ASTNode} node - The function node to get. + * @param {SourceCode} [sourceCode] The source code object to get the code of computed property keys. * @returns {string} The name and kind of the function node. */ +// eslint-disable-next-line complexity -function getFunctionNameWithKind(node) { +function getFunctionNameWithKind(node, sourceCode) { const parent = node.parent; const tokens = []; + const isObjectMethod = parent.type === "Property" && parent.value === node; + const isClassMethod = parent.type === "MethodDefinition" && parent.value === node; + const isClassFieldMethod = parent.type === "PropertyDefinition" && parent.value === node; // Modifiers. - if (parent.type === "MethodDefinition" && parent.static) { - tokens.push("static"); + if (isClassMethod || isClassFieldMethod) { + if (parent.static) { + tokens.push("static"); + } + + if (parent.key.type === "PrivateIdentifier") { + tokens.push("private"); + } } if (node.async) { @@ -44665,11 +46125,10 @@ function getFunctionNameWithKind(node) { if (node.generator) { tokens.push("generator"); - } + } // Kinds. - if (node.type === "ArrowFunctionExpression") { - tokens.push("arrow", "function"); - } else if (parent.type === "Property" || parent.type === "MethodDefinition") { + + if (isObjectMethod || isClassMethod) { if (parent.kind === "constructor") { return "constructor"; } @@ -44681,28 +46140,39 @@ function getFunctionNameWithKind(node) { } else { tokens.push("method"); } + } else if (isClassFieldMethod) { + tokens.push("method"); } else { + if (node.type === "ArrowFunctionExpression") { + tokens.push("arrow"); + } + tokens.push("function"); - } + } // Names. - if (node.id) { - tokens.push(`'${node.id.name}'`); - } else { - const name = getPropertyName(parent); - if (name) { - tokens.push(`'${name}'`); - } - } - - if (node.type === "ArrowFunctionExpression") { - if (parent.type === "VariableDeclarator" && parent.id && parent.id.type === "Identifier") { - tokens.push(`'${parent.id.name}'`); - } - - if (parent.type === "AssignmentExpression" && parent.left && parent.left.type === "Identifier") { - tokens.push(`'${parent.left.name}'`); + if (isObjectMethod || isClassMethod || isClassFieldMethod) { + if (parent.key.type === "PrivateIdentifier") { + tokens.push("#".concat(parent.key.name)); + } else { + const name = getPropertyName(parent); + + if (name) { + tokens.push("'".concat(name, "'")); + } else if (sourceCode) { + const keyText = sourceCode.getText(parent.key); + + if (!keyText.includes("\n")) { + tokens.push("[".concat(keyText, "]")); + } + } } + } else if (node.id) { + tokens.push("'".concat(node.id.name, "'")); + } else if (parent.type === "VariableDeclarator" && parent.id && parent.id.type === "Identifier") { + tokens.push("'".concat(parent.id.name, "'")); + } else if ((parent.type === "AssignmentExpression" || parent.type === "AssignmentPattern") && parent.left && parent.left.type === "Identifier") { + tokens.push("'".concat(parent.left.name, "'")); } return tokens.join(" "); @@ -44819,6 +46289,14 @@ const visitor = Object.freeze(Object.assign(Object.create(null), { return this.$visitChildren(node, options, visitorKeys); }, + PropertyDefinition(node, options, visitorKeys) { + if (options.considerImplicitTypeConversion && node.computed && node.key.type !== "Literal") { + return true; + } + + return this.$visitChildren(node, options, visitorKeys); + }, + UnaryExpression(node, options, visitorKeys) { if (node.operator === "delete") { return true; @@ -44851,10 +46329,11 @@ const visitor = Object.freeze(Object.assign(Object.create(null), { * @returns {boolean} `true` if the node has a certain side effect. */ -function hasSideEffect(node, sourceCode, { - considerGetters = false, - considerImplicitTypeConversion = false -} = {}) { +function hasSideEffect(node, sourceCode) { + let { + considerGetters = false, + considerImplicitTypeConversion = false + } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; return visitor.$visit(node, { considerGetters, considerImplicitTypeConversion @@ -44954,7 +46433,8 @@ function isParenthesized(timesOrNode, nodeOrSourceCode, optionalSourceCode) { sourceCode = nodeOrSourceCode; } - if (node == null) { + if (node == null || // `CatchClause.param` can't be parenthesized, example `try {} catch (error) {}` + node.parent.type === "CatchClause" && node.parent.param === node) { return false; } @@ -45083,9 +46563,11 @@ class PatternMatcher { * @param {RegExp} pattern The pattern to match. * @param {{escaped:boolean}} options The options. */ - constructor(pattern, { - escaped = false - } = {}) { + constructor(pattern) { + let { + escaped = false + } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + if (!(pattern instanceof RegExp)) { throw new TypeError("'pattern' should be a RegExp instance."); } @@ -45210,10 +46692,11 @@ class ReferenceTracker { * @param {"legacy"|"strict"} [options.mode="strict"] The mode to determine the ImportDeclaration's behavior for CJS modules. * @param {string[]} [options.globalObjectNames=["global","globalThis","self","window"]] The variable names for Global Object. */ - constructor(globalScope, { - mode = "strict", - globalObjectNames = ["global", "globalThis", "self", "window"] - } = {}) { + constructor(globalScope) { + let { + mode = "strict", + globalObjectNames = ["global", "globalThis", "self", "window"] + } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; this.variableStack = []; this.globalScope = globalScope; this.mode = mode; @@ -45332,9 +46815,10 @@ class ReferenceTracker { for (const specifier of node.specifiers) { const esm = has(nextTraceMap, ESM); - const it = this._iterateImportReferences(specifier, path, esm ? nextTraceMap : this.mode === "legacy" ? Object.assign({ - default: nextTraceMap - }, nextTraceMap) : { + const it = this._iterateImportReferences(specifier, path, esm ? nextTraceMap : this.mode === "legacy" ? { + default: nextTraceMap, + ...nextTraceMap + } : { default: nextTraceMap }); @@ -45663,7 +47147,7 @@ exports.ESM = ESM; exports.PatternMatcher = PatternMatcher; exports.READ = READ; exports.ReferenceTracker = ReferenceTracker; -exports.default = index; +exports["default"] = index; exports.findVariable = findVariable; exports.getFunctionHeadLocation = getFunctionHeadLocation; exports.getFunctionNameWithKind = getFunctionNameWithKind; @@ -45783,7 +47267,7 @@ module.exports = Object.freeze({ /***/ ((module) => { "use strict"; -module.exports = JSON.parse('{"AssignmentExpression":["left","right"],"AssignmentPattern":["left","right"],"ArrayExpression":["elements"],"ArrayPattern":["elements"],"ArrowFunctionExpression":["params","body"],"AwaitExpression":["argument"],"BlockStatement":["body"],"BinaryExpression":["left","right"],"BreakStatement":["label"],"CallExpression":["callee","arguments"],"CatchClause":["param","body"],"ChainExpression":["expression"],"ClassBody":["body"],"ClassDeclaration":["id","superClass","body"],"ClassExpression":["id","superClass","body"],"ConditionalExpression":["test","consequent","alternate"],"ContinueStatement":["label"],"DebuggerStatement":[],"DoWhileStatement":["body","test"],"EmptyStatement":[],"ExportAllDeclaration":["exported","source"],"ExportDefaultDeclaration":["declaration"],"ExportNamedDeclaration":["declaration","specifiers","source"],"ExportSpecifier":["exported","local"],"ExpressionStatement":["expression"],"ExperimentalRestProperty":["argument"],"ExperimentalSpreadProperty":["argument"],"ForStatement":["init","test","update","body"],"ForInStatement":["left","right","body"],"ForOfStatement":["left","right","body"],"FunctionDeclaration":["id","params","body"],"FunctionExpression":["id","params","body"],"Identifier":[],"IfStatement":["test","consequent","alternate"],"ImportDeclaration":["specifiers","source"],"ImportDefaultSpecifier":["local"],"ImportExpression":["source"],"ImportNamespaceSpecifier":["local"],"ImportSpecifier":["imported","local"],"JSXAttribute":["name","value"],"JSXClosingElement":["name"],"JSXElement":["openingElement","children","closingElement"],"JSXEmptyExpression":[],"JSXExpressionContainer":["expression"],"JSXIdentifier":[],"JSXMemberExpression":["object","property"],"JSXNamespacedName":["namespace","name"],"JSXOpeningElement":["name","attributes"],"JSXSpreadAttribute":["argument"],"JSXText":[],"JSXFragment":["openingFragment","children","closingFragment"],"Literal":[],"LabeledStatement":["label","body"],"LogicalExpression":["left","right"],"MemberExpression":["object","property"],"MetaProperty":["meta","property"],"MethodDefinition":["key","value"],"NewExpression":["callee","arguments"],"ObjectExpression":["properties"],"ObjectPattern":["properties"],"Program":["body"],"Property":["key","value"],"RestElement":["argument"],"ReturnStatement":["argument"],"SequenceExpression":["expressions"],"SpreadElement":["argument"],"Super":[],"SwitchStatement":["discriminant","cases"],"SwitchCase":["test","consequent"],"TaggedTemplateExpression":["tag","quasi"],"TemplateElement":[],"TemplateLiteral":["quasis","expressions"],"ThisExpression":[],"ThrowStatement":["argument"],"TryStatement":["block","handler","finalizer"],"UnaryExpression":["argument"],"UpdateExpression":["argument"],"VariableDeclaration":["declarations"],"VariableDeclarator":["id","init"],"WhileStatement":["test","body"],"WithStatement":["object","body"],"YieldExpression":["argument"]}'); +module.exports = JSON.parse('{"AssignmentExpression":["left","right"],"AssignmentPattern":["left","right"],"ArrayExpression":["elements"],"ArrayPattern":["elements"],"ArrowFunctionExpression":["params","body"],"AwaitExpression":["argument"],"BlockStatement":["body"],"BinaryExpression":["left","right"],"BreakStatement":["label"],"CallExpression":["callee","arguments"],"CatchClause":["param","body"],"ChainExpression":["expression"],"ClassBody":["body"],"ClassDeclaration":["id","superClass","body"],"ClassExpression":["id","superClass","body"],"ConditionalExpression":["test","consequent","alternate"],"ContinueStatement":["label"],"DebuggerStatement":[],"DoWhileStatement":["body","test"],"EmptyStatement":[],"ExportAllDeclaration":["exported","source"],"ExportDefaultDeclaration":["declaration"],"ExportNamedDeclaration":["declaration","specifiers","source"],"ExportSpecifier":["exported","local"],"ExpressionStatement":["expression"],"ExperimentalRestProperty":["argument"],"ExperimentalSpreadProperty":["argument"],"ForStatement":["init","test","update","body"],"ForInStatement":["left","right","body"],"ForOfStatement":["left","right","body"],"FunctionDeclaration":["id","params","body"],"FunctionExpression":["id","params","body"],"Identifier":[],"IfStatement":["test","consequent","alternate"],"ImportDeclaration":["specifiers","source"],"ImportDefaultSpecifier":["local"],"ImportExpression":["source"],"ImportNamespaceSpecifier":["local"],"ImportSpecifier":["imported","local"],"JSXAttribute":["name","value"],"JSXClosingElement":["name"],"JSXElement":["openingElement","children","closingElement"],"JSXEmptyExpression":[],"JSXExpressionContainer":["expression"],"JSXIdentifier":[],"JSXMemberExpression":["object","property"],"JSXNamespacedName":["namespace","name"],"JSXOpeningElement":["name","attributes"],"JSXSpreadAttribute":["argument"],"JSXText":[],"JSXFragment":["openingFragment","children","closingFragment"],"Literal":[],"LabeledStatement":["label","body"],"LogicalExpression":["left","right"],"MemberExpression":["object","property"],"MetaProperty":["meta","property"],"MethodDefinition":["key","value"],"NewExpression":["callee","arguments"],"ObjectExpression":["properties"],"ObjectPattern":["properties"],"PrivateIdentifier":[],"Program":["body"],"Property":["key","value"],"PropertyDefinition":["key","value"],"RestElement":["argument"],"ReturnStatement":["argument"],"SequenceExpression":["expressions"],"SpreadElement":["argument"],"Super":[],"SwitchStatement":["discriminant","cases"],"SwitchCase":["test","consequent"],"TaggedTemplateExpression":["tag","quasi"],"TemplateElement":[],"TemplateLiteral":["quasis","expressions"],"ThisExpression":[],"ThrowStatement":["argument"],"TryStatement":["block","handler","finalizer"],"UnaryExpression":["argument"],"UpdateExpression":["argument"],"VariableDeclaration":["declarations"],"VariableDeclarator":["id","init"],"WhileStatement":["test","body"],"WithStatement":["object","body"],"YieldExpression":["argument"]}'); /***/ }), /* 504 */ @@ -45798,7 +47282,7 @@ module.exports = JSON.parse('{"AssignmentExpression":["left","right"],"Assignmen // Requirements //------------------------------------------------------------------------------ -const assert = __webpack_require__(407); +const assert = __webpack_require__(431); const { isCommentToken @@ -46566,7 +48050,7 @@ module.exports = class Cursor { moveNext() { - // eslint-disable-line class-methods-use-this + // eslint-disable-line class-methods-use-this -- Unused throw new Error("Not implemented."); } @@ -47118,10 +48602,10 @@ module.exports = class PaddedTokenCursor extends ForwardTokenCursor { // Requirements //------------------------------------------------------------------------------ -const assert = __webpack_require__(407), +const assert = __webpack_require__(431), { breakableTypePattern -} = __webpack_require__(439), +} = __webpack_require__(444), CodePath = __webpack_require__(518), CodePathSegment = __webpack_require__(520), IdGenerator = __webpack_require__(523), @@ -47139,6 +48623,18 @@ const assert = __webpack_require__(407), function isCaseNode(node) { return Boolean(node.test); } +/** + * Checks if a given node appears as the value of a PropertyDefinition node. + * @param {ASTNode} node THe node to check. + * @returns {boolean} `true` if the node is a PropertyDefinition value, + * false if not. + */ + + +function isPropertyDefinitionValue(node) { + const parent = node.parent; + return parent && parent.type === "PropertyDefinition" && parent.value === node; +} /** * Checks whether the given logical operator is taken into account for the code * path analysis. @@ -47257,6 +48753,7 @@ function isIdentifierReference(node) { return parent.id !== node; case "Property": + case "PropertyDefinition": case "MethodDefinition": return parent.key !== node || parent.computed || parent.shorthand; @@ -47294,7 +48791,7 @@ function forwardCurrentToHead(analyzer, node) { headSegment = headSegments[i]; if (currentSegment !== headSegment && currentSegment) { - debug.dump(`onCodePathSegmentEnd ${currentSegment.id}`); + debug.dump("onCodePathSegmentEnd ".concat(currentSegment.id)); if (currentSegment.reachable) { analyzer.emitter.emit("onCodePathSegmentEnd", currentSegment, node); @@ -47310,7 +48807,7 @@ function forwardCurrentToHead(analyzer, node) { headSegment = headSegments[i]; if (currentSegment !== headSegment && headSegment) { - debug.dump(`onCodePathSegmentStart ${headSegment.id}`); + debug.dump("onCodePathSegmentStart ".concat(headSegment.id)); CodePathSegment.markUsed(headSegment); if (headSegment.reachable) { @@ -47334,7 +48831,7 @@ function leaveFromCurrentSegment(analyzer, node) { for (let i = 0; i < currentSegments.length; ++i) { const currentSegment = currentSegments[i]; - debug.dump(`onCodePathSegmentEnd ${currentSegment.id}`); + debug.dump("onCodePathSegmentEnd ".concat(currentSegment.id)); if (currentSegment.reachable) { analyzer.emitter.emit("onCodePathSegmentEnd", currentSegment, node); @@ -47495,24 +48992,66 @@ function processCodePathToEnter(analyzer, node) { let codePath = analyzer.codePath; let state = codePath && CodePath.getState(codePath); const parent = node.parent; + /** + * Creates a new code path and trigger the onCodePathStart event + * based on the currently selected node. + * @param {string} origin The reason the code path was started. + * @returns {void} + */ + + function startCodePath(origin) { + if (codePath) { + // Emits onCodePathSegmentStart events if updated. + forwardCurrentToHead(analyzer, node); + debug.dumpState(node, state, false); + } // Create the code path of this scope. + + + codePath = analyzer.codePath = new CodePath({ + id: analyzer.idGenerator.next(), + origin, + upper: codePath, + onLooped: analyzer.onLooped + }); + state = CodePath.getState(codePath); // Emits onCodePathStart events. + + debug.dump("onCodePathStart ".concat(codePath.id)); + analyzer.emitter.emit("onCodePathStart", codePath, node); + } + /* + * Special case: The right side of class field initializer is considered + * to be its own function, so we need to start a new code path in this + * case. + */ + + + if (isPropertyDefinitionValue(node)) { + startCodePath("class-field-initializer"); + /* + * Intentional fall through because `node` needs to also be + * processed by the code below. For example, if we have: + * + * class Foo { + * a = () => {} + * } + * + * In this case, we also need start a second code path. + */ + } switch (node.type) { case "Program": + startCodePath("program"); + break; + case "FunctionDeclaration": case "FunctionExpression": case "ArrowFunctionExpression": - if (codePath) { - // Emits onCodePathSegmentStart events if updated. - forwardCurrentToHead(analyzer, node); - debug.dumpState(node, state, false); - } // Create the code path of this scope. + startCodePath("function"); + break; - - codePath = analyzer.codePath = new CodePath(analyzer.idGenerator.next(), codePath, analyzer.onLooped); - state = CodePath.getState(codePath); // Emits onCodePathStart events. - - debug.dump(`onCodePathStart ${codePath.id}`); - analyzer.emitter.emit("onCodePathStart", codePath, node); + case "StaticBlock": + startCodePath("class-static-block"); break; case "ChainExpression": @@ -47736,27 +49275,35 @@ function processCodePathToExit(analyzer, node) { function postprocess(analyzer, node) { + /** + * Ends the code path for the current node. + * @returns {void} + */ + function endCodePath() { + let codePath = analyzer.codePath; // Mark the current path as the final node. + + CodePath.getState(codePath).makeFinal(); // Emits onCodePathSegmentEnd event of the current segments. + + leaveFromCurrentSegment(analyzer, node); // Emits onCodePathEnd event of this code path. + + debug.dump("onCodePathEnd ".concat(codePath.id)); + analyzer.emitter.emit("onCodePathEnd", codePath, node); + debug.dumpDot(codePath); + codePath = analyzer.codePath = analyzer.codePath.upper; + + if (codePath) { + debug.dumpState(node, CodePath.getState(codePath), true); + } + } + switch (node.type) { case "Program": case "FunctionDeclaration": case "FunctionExpression": case "ArrowFunctionExpression": + case "StaticBlock": { - let codePath = analyzer.codePath; // Mark the current path as the final node. - - CodePath.getState(codePath).makeFinal(); // Emits onCodePathSegmentEnd event of the current segments. - - leaveFromCurrentSegment(analyzer, node); // Emits onCodePathEnd event of this code path. - - debug.dump(`onCodePathEnd ${codePath.id}`); - analyzer.emitter.emit("onCodePathEnd", codePath, node); - debug.dumpDot(codePath); - codePath = analyzer.codePath = analyzer.codePath.upper; - - if (codePath) { - debug.dumpState(node, CodePath.getState(codePath), true); - } - + endCodePath(); break; } // The `arguments.length >= 1` case is in `preprocess` function. @@ -47771,6 +49318,28 @@ function postprocess(analyzer, node) { default: break; } + /* + * Special case: The right side of class field initializer is considered + * to be its own function, so we need to end a code path in this + * case. + * + * We need to check after the other checks in order to close the + * code paths in the correct order for code like this: + * + * + * class Foo { + * a = () => {} + * } + * + * In this case, The ArrowFunctionExpression code path is closed first + * and then we need to close the code path for the PropertyDefinition + * value. + */ + + + if (isPropertyDefinitionValue(node)) { + endCodePath(); + } } //------------------------------------------------------------------------------ // Public Interface //------------------------------------------------------------------------------ @@ -47782,8 +49351,6 @@ function postprocess(analyzer, node) { class CodePathAnalyzer { - // eslint-disable-next-line jsdoc/require-description - /** * @param {EventGenerator} eventGenerator An event generator to wrap. */ @@ -47853,7 +49420,7 @@ class CodePathAnalyzer { onLooped(fromSegment, toSegment) { if (fromSegment.reachable && toSegment.reachable) { - debug.dump(`onCodePathSegmentLoop ${fromSegment.id} -> ${toSegment.id}`); + debug.dump("onCodePathSegmentLoop ".concat(fromSegment.id, " -> ").concat(toSegment.id)); this.emitter.emit("onCodePathSegmentLoop", fromSegment, toSegment, this.currentNode); } } @@ -47887,20 +49454,35 @@ const IdGenerator = __webpack_require__(523); //-------------------------------- class CodePath { - // eslint-disable-next-line jsdoc/require-description - /** - * @param {string} id An identifier. - * @param {CodePath|null} upper The code path of the upper function scope. - * @param {Function} onLooped A callback function to notify looping. + * Creates a new instance. + * @param {Object} options Options for the function (see below). + * @param {string} options.id An identifier. + * @param {string} options.origin The type of code path origin. + * @param {CodePath|null} options.upper The code path of the upper function scope. + * @param {Function} options.onLooped A callback function to notify looping. */ - constructor(id, upper, onLooped) { + constructor(_ref) { + let { + id, + origin, + upper, + onLooped + } = _ref; + /** * The identifier of this code path. * Rules use it to store additional information of each rule. * @type {string} */ this.id = id; + /** + * The reason that this code path was started. May be "program", + * "function", "class-field-initializer", or "class-static-block". + * @type {string} + */ + + this.origin = origin; /** * The code path of the upper function scope. * @type {CodePath|null} @@ -47915,7 +49497,7 @@ class CodePath { this.childCodePaths = []; // Initializes internal state. Object.defineProperty(this, "internal", { - value: new CodePathState(new IdGenerator(`${id}_`), onLooped) + value: new CodePathState(new IdGenerator("".concat(id, "_")), onLooped) }); // Adds this into `childCodePaths` of `upper`. if (upper) { @@ -48339,8 +49921,6 @@ function finalizeTestSegmentsOfFor(context, choiceContext, head) { class CodePathState { - // eslint-disable-next-line jsdoc/require-description - /** * @param {IdGenerator} idGenerator An id generator to generate id for code * path segments. @@ -48476,6 +50056,7 @@ class CodePathState { } /** * Pops the last choice context and finalizes it. + * @throws {Error} (Unreachable.) * @returns {ChoiceContext} The popped context. */ @@ -48559,6 +50140,7 @@ class CodePathState { /** * Makes a code path segment of the right-hand operand of a logical * expression. + * @throws {Error} (Unreachable.) * @returns {void} */ @@ -49063,6 +50645,7 @@ class CodePathState { * `WhileStatement`, `DoWhileStatement`, `ForStatement`, `ForInStatement`, * and `ForStatement`. * @param {string|null} label A label of the node which was triggered. + * @throws {Error} (Unreachable - unknown type.) * @returns {void} */ @@ -49131,11 +50714,12 @@ class CodePathState { /* istanbul ignore next */ default: - throw new Error(`unknown type: "${type}"`); + throw new Error("unknown type: \"".concat(type, "\"")); } } /** * Pops the last context of a loop statement and finalizes it. + * @throws {Error} (Unreachable - unknown type.) * @returns {void} */ @@ -49592,8 +51176,6 @@ function isReachable(segment) { class CodePathSegment { - // eslint-disable-next-line jsdoc/require-description - /** * @param {string} id An identifier. * @param {CodePathSegment[]} allPrevSegments An array of the previous segments. @@ -49822,7 +51404,7 @@ const debug = __webpack_require__(496)("eslint:code-path"); //------------------ function getId(segment) { - // eslint-disable-line jsdoc/require-jsdoc + // eslint-disable-line jsdoc/require-jsdoc -- Ignoring return segment.id + (segment.reachable ? "" : "!"); } /** @@ -49834,17 +51416,17 @@ function getId(segment) { function nodeToString(node, label) { - const suffix = label ? `:${label}` : ""; + const suffix = label ? ":".concat(label) : ""; switch (node.type) { case "Identifier": - return `${node.type}${suffix} (${node.name})`; + return "".concat(node.type).concat(suffix, " (").concat(node.name, ")"); case "Literal": - return `${node.type}${suffix} (${node.value})`; + return "".concat(node.type).concat(suffix, " (").concat(node.value, ")"); default: - return `${node.type}${suffix}`; + return "".concat(node.type).concat(suffix); } } //------------------------------------------------------------------------------ // Public Interface @@ -49891,7 +51473,7 @@ module.exports = { } } - debug([`${state.currentSegments.map(getId).join(",")})`, `${node.type}${leaving ? ":exit" : ""}`].join(" ")); + debug(["".concat(state.currentSegments.map(getId).join(","), ")"), "".concat(node.type).concat(leaving ? ":exit" : "")].join(" ")); }, /** @@ -49919,9 +51501,9 @@ module.exports = { const arrows = this.makeDotArrows(codePath, traceMap); for (const id in traceMap) { - // eslint-disable-line guard-for-in + // eslint-disable-line guard-for-in -- Want ability to traverse prototype const segment = traceMap[id]; - text += `${id}[`; + text += "".concat(id, "["); if (segment.reachable) { text += "label=\""; @@ -49938,7 +51520,7 @@ module.exports = { text += "\"];\n"; } - text += `${arrows}\n`; + text += "".concat(arrows, "\n"); text += "}"; debug("DOT", text); }, @@ -49954,7 +51536,7 @@ module.exports = { const stack = [[codePath.initialSegment, 0]]; const done = traceMap || Object.create(null); let lastId = codePath.initialSegment.id; - let text = `initial->${codePath.initialSegment.id}`; + let text = "initial->".concat(codePath.initialSegment.id); while (stack.length > 0) { const item = stack.pop(); @@ -49973,9 +51555,9 @@ module.exports = { } if (lastId === segment.id) { - text += `->${nextSegment.id}`; + text += "->".concat(nextSegment.id); } else { - text += `;\n${segment.id}->${nextSegment.id}`; + text += ";\n".concat(segment.id, "->").concat(nextSegment.id); } lastId = nextSegment.id; @@ -49987,7 +51569,7 @@ module.exports = { if (lastId === finalSegment.id) { text += "->final"; } else { - text += `;\n${finalSegment.id}->final`; + text += ";\n".concat(finalSegment.id, "->final"); } lastId = null; @@ -49996,12 +51578,12 @@ module.exports = { if (lastId === finalSegment.id) { text += "->thrown"; } else { - text += `;\n${finalSegment.id}->thrown`; + text += ";\n".concat(finalSegment.id, "->thrown"); } lastId = null; }); - return `${text};`; + return "".concat(text, ";"); } }; @@ -50023,7 +51605,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const assert = __webpack_require__(407), +const assert = __webpack_require__(431), CodePathSegment = __webpack_require__(520); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -50105,8 +51687,6 @@ function mergeExtraSegments(context, segments) { class ForkContext { - // eslint-disable-next-line jsdoc/require-description - /** * @param {IdGenerator} idGenerator An identifier generator for segments. * @param {ForkContext|null} upper An upper fork context. @@ -50192,7 +51772,7 @@ class ForkContext { add(segments) { - assert(segments.length >= this.count, `${segments.length} >= ${this.count}`); + assert(segments.length >= this.count, "".concat(segments.length, " >= ").concat(this.count)); this.segmentsList.push(mergeExtraSegments(this, segments)); } /** @@ -50204,7 +51784,7 @@ class ForkContext { replaceHead(segments) { - assert(segments.length >= this.count, `${segments.length} >= ${this.count}`); + assert(segments.length >= this.count, "".concat(segments.length, " >= ").concat(this.count)); this.segmentsList.splice(-1, 1, mergeExtraSegments(this, segments)); } /** @@ -50281,8 +51861,6 @@ module.exports = ForkContext; */ class IdGenerator { - // eslint-disable-next-line jsdoc/require-description - /** * @param {string} prefix Optional. A prefix of generated ids. */ @@ -50313,7 +51891,7 @@ module.exports = IdGenerator; /***/ }), /* 524 */ -/***/ ((module) => { +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; /** @@ -50321,6 +51899,12 @@ module.exports = IdGenerator; * @author Teddy Katz */ + +var _templateObject; + +function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } + +const escapeRegExp = __webpack_require__(525); /** * Compares the locations of two objects in a source file * @param {{line: number, column: number}} itemA The first object @@ -50329,9 +51913,175 @@ module.exports = IdGenerator; * itemA appears after itemB in the source file, or 0 if itemA and itemB have the same location. */ + function compareLocations(itemA, itemB) { return itemA.line - itemB.line || itemA.column - itemB.column; } +/** + * Groups a set of directives into sub-arrays by their parent comment. + * @param {Directive[]} directives Unused directives to be removed. + * @returns {Directive[][]} Directives grouped by their parent comment. + */ + + +function groupByParentComment(directives) { + const groups = new Map(); + + for (const directive of directives) { + const { + unprocessedDirective: { + parentComment + } + } = directive; + + if (groups.has(parentComment)) { + groups.get(parentComment).push(directive); + } else { + groups.set(parentComment, [directive]); + } + } + + return [...groups.values()]; +} +/** + * Creates removal details for a set of directives within the same comment. + * @param {Directive[]} directives Unused directives to be removed. + * @param {Token} commentToken The backing Comment token. + * @returns {{ description, fix, position }[]} Details for later creation of output Problems. + */ + + +function createIndividualDirectivesRemoval(directives, commentToken) { + /* + * `commentToken.value` starts right after `//` or `/*`. + * All calculated offsets will be relative to this index. + */ + const commentValueStart = commentToken.range[0] + "//".length; // Find where the list of rules starts. `\S+` matches with the directive name (e.g. `eslint-disable-line`) + + const listStartOffset = /^\s*\S+\s+/u.exec(commentToken.value)[0].length; + /* + * Get the list text without any surrounding whitespace. In order to preserve the original + * formatting, we don't want to change that whitespace. + * + * // eslint-disable-line rule-one , rule-two , rule-three -- comment + * ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + */ + + const listText = commentToken.value.slice(listStartOffset) // remove directive name and all whitespace before the list + .split(/\s-{2,}\s/u)[0] // remove `-- comment`, if it exists + .trimRight(); // remove all whitespace after the list + + /* + * We can assume that `listText` contains multiple elements. + * Otherwise, this function wouldn't be called - if there is + * only one rule in the list, then the whole comment must be removed. + */ + + return directives.map(directive => { + const { + ruleId + } = directive; + const regex = new RegExp(String.raw(_templateObject || (_templateObject = _taggedTemplateLiteral(["(?:^|s*,s*)", "(?:s*,s*|$)"], ["(?:^|\\s*,\\s*)", "(?:\\s*,\\s*|$)"])), escapeRegExp(ruleId)), "u"); + const match = regex.exec(listText); + const matchedText = match[0]; + const matchStartOffset = listStartOffset + match.index; + const matchEndOffset = matchStartOffset + matchedText.length; + const firstIndexOfComma = matchedText.indexOf(","); + const lastIndexOfComma = matchedText.lastIndexOf(","); + let removalStartOffset, removalEndOffset; + + if (firstIndexOfComma !== lastIndexOfComma) { + /* + * Since there are two commas, this must one of the elements in the middle of the list. + * Matched range starts where the previous rule name ends, and ends where the next rule name starts. + * + * // eslint-disable-line rule-one , rule-two , rule-three -- comment + * ^^^^^^^^^^^^^^ + * + * We want to remove only the content between the two commas, and also one of the commas. + * + * // eslint-disable-line rule-one , rule-two , rule-three -- comment + * ^^^^^^^^^^^ + */ + removalStartOffset = matchStartOffset + firstIndexOfComma; + removalEndOffset = matchStartOffset + lastIndexOfComma; + } else { + /* + * This is either the first element or the last element. + * + * If this is the first element, matched range starts where the first rule name starts + * and ends where the second rule name starts. This is exactly the range we want + * to remove so that the second rule name will start where the first one was starting + * and thus preserve the original formatting. + * + * // eslint-disable-line rule-one , rule-two , rule-three -- comment + * ^^^^^^^^^^^ + * + * Similarly, if this is the last element, we've already matched the range we want to + * remove. The previous rule name will end where the last one was ending, relative + * to the content on the right side. + * + * // eslint-disable-line rule-one , rule-two , rule-three -- comment + * ^^^^^^^^^^^^^ + */ + removalStartOffset = matchStartOffset; + removalEndOffset = matchEndOffset; + } + + return { + description: "'".concat(ruleId, "'"), + fix: { + range: [commentValueStart + removalStartOffset, commentValueStart + removalEndOffset], + text: "" + }, + position: directive.unprocessedDirective + }; + }); +} +/** + * Creates a description of deleting an entire unused disable comment. + * @param {Directive[]} directives Unused directives to be removed. + * @param {Token} commentToken The backing Comment token. + * @returns {{ description, fix, position }} Details for later creation of an output Problem. + */ + + +function createCommentRemoval(directives, commentToken) { + const { + range + } = commentToken; + const ruleIds = directives.filter(directive => directive.ruleId).map(directive => "'".concat(directive.ruleId, "'")); + return { + description: ruleIds.length <= 2 ? ruleIds.join(" or ") : "".concat(ruleIds.slice(0, ruleIds.length - 1).join(", "), ", or ").concat(ruleIds[ruleIds.length - 1]), + fix: { + range, + text: " " + }, + position: directives[0].unprocessedDirective + }; +} +/** + * Parses details from directives to create output Problems. + * @param {Directive[]} allDirectives Unused directives to be removed. + * @returns {{ description, fix, position }[]} Details for later creation of output Problems. + */ + + +function processUnusedDisableDirectives(allDirectives) { + const directiveGroups = groupByParentComment(allDirectives); + return directiveGroups.flatMap(directives => { + const { + parentComment + } = directives[0].unprocessedDirective; + const remainingRuleIds = new Set(parentComment.ruleIds); + + for (const directive of directives) { + remainingRuleIds.delete(directive.ruleId); + } + + return remainingRuleIds.size ? createIndividualDirectivesRemoval(directives, parentComment.commentToken) : [createCommentRemoval(directives, parentComment.commentToken)]; + }); +} /** * This is the same as the exported function, except that it * doesn't handle disable-line and disable-next-line directives, and it always reports unused @@ -50397,14 +52147,26 @@ function applyDirectives(options) { } } - const unusedDisableDirectives = options.directives.filter(directive => directive.type === "disable" && !usedDisableDirectives.has(directive)).map(directive => ({ - ruleId: null, - message: directive.ruleId ? `Unused eslint-disable directive (no problems were reported from '${directive.ruleId}').` : "Unused eslint-disable directive (no problems were reported).", - line: directive.unprocessedDirective.line, - column: directive.unprocessedDirective.column, - severity: options.reportUnusedDisableDirectives === "warn" ? 1 : 2, - nodeType: null - })); + const unusedDisableDirectivesToReport = options.directives.filter(directive => directive.type === "disable" && !usedDisableDirectives.has(directive)); + const processed = processUnusedDisableDirectives(unusedDisableDirectivesToReport); + const unusedDisableDirectives = processed.map(_ref => { + let { + description, + fix, + position + } = _ref; + return { + ruleId: null, + message: description ? "Unused eslint-disable directive (no problems were reported from ".concat(description, ").") : "Unused eslint-disable directive (no problems were reported).", + line: position.line, + column: position.column, + severity: options.reportUnusedDisableDirectives === "warn" ? 1 : 2, + nodeType: null, + ...(options.disableFixes ? {} : { + fix + }) + }; + }); return { problems, unusedDisableDirectives @@ -50425,34 +52187,23 @@ function applyDirectives(options) { * @param {{ruleId: (string|null), line: number, column: number}[]} options.problems * A list of problems reported by rules, sorted by increasing location in the file, with one-based columns. * @param {"off" | "warn" | "error"} options.reportUnusedDisableDirectives If `"warn"` or `"error"`, adds additional problems for unused directives + * @param {boolean} options.disableFixes If true, it doesn't make `fix` properties. * @returns {{ruleId: (string|null), line: number, column: number}[]} * A list of reported problems that were not disabled by the directive comments. */ -module.exports = ({ - directives, - problems, - reportUnusedDisableDirectives = "off" -}) => { +module.exports = _ref2 => { + let { + directives, + disableFixes, + problems, + reportUnusedDisableDirectives = "off" + } = _ref2; const blockDirectives = directives.filter(directive => directive.type === "disable" || directive.type === "enable").map(directive => Object.assign({}, directive, { unprocessedDirective: directive })).sort(compareLocations); - /** - * Returns a new array formed by applying a given callback function to each element of the array, and then flattening the result by one level. - * TODO(stephenwade): Replace this with array.flatMap when we drop support for Node v10 - * @param {any[]} array The array to process - * @param {Function} fn The function to use - * @returns {any[]} The result array - */ - - function flatMap(array, fn) { - const mapped = array.map(fn); - const flattened = [].concat(...mapped); - return flattened; - } - - const lineDirectives = flatMap(directives, directive => { + const lineDirectives = directives.flatMap(directive => { switch (directive.type) { case "disable": case "enable": @@ -50489,17 +52240,19 @@ module.exports = ({ }]; default: - throw new TypeError(`Unrecognized directive type '${directive.type}'`); + throw new TypeError("Unrecognized directive type '".concat(directive.type, "'")); } }).sort(compareLocations); const blockDirectivesResult = applyDirectives({ problems, directives: blockDirectives, + disableFixes, reportUnusedDisableDirectives }); const lineDirectivesResult = applyDirectives({ problems: blockDirectivesResult.problems, directives: lineDirectives, + disableFixes, reportUnusedDisableDirectives }); return reportUnusedDisableDirectives !== "off" ? lineDirectivesResult.problems.concat(blockDirectivesResult.unusedDisableDirectives).concat(lineDirectivesResult.unusedDisableDirectives).sort(compareLocations) : lineDirectivesResult.problems; @@ -50507,6 +52260,23 @@ module.exports = ({ /***/ }), /* 525 */ +/***/ ((module) => { + +"use strict"; + + +module.exports = string => { + if (typeof string !== 'string') { + throw new TypeError('Expected a string'); + } // Escape characters with special meaning either inside or outside character sets. + // Use a simple backslash escape when it’s always valid, and a \unnnn escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar. + + + return string.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d'); +}; + +/***/ }), +/* 526 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -50515,13 +52285,17 @@ module.exports = ({ * @author Nicholas C. Zakas */ -/* eslint-disable class-methods-use-this*/ +/* eslint class-methods-use-this: off -- Methods desired on instance */ //------------------------------------------------------------------------------ // Requirements //------------------------------------------------------------------------------ -const levn = __webpack_require__(526), - ConfigOps = __webpack_require__(440); +const levn = __webpack_require__(527), + { + Legacy: { + ConfigOps + } +} = __webpack_require__(445); const debug = __webpack_require__(496)("eslint:config-comment-parser"); //------------------------------------------------------------------------------ // Public Interface @@ -50597,7 +52371,7 @@ module.exports = class ConfigCommentParser { const normalizedString = string.replace(/([-a-zA-Z0-9/]+):/gu, "\"$1\":").replace(/(\]|[0-9])\s+(?=")/u, "$1,"); try { - items = JSON.parse(`{${normalizedString}}`); + items = JSON.parse("{".concat(normalizedString, "}")); } catch (ex) { debug("Manual parsing failed."); return { @@ -50606,7 +52380,7 @@ module.exports = class ConfigCommentParser { ruleId: null, fatal: true, severity: 2, - message: `Failed to parse JSON from '${normalizedString}': ${ex.message}`, + message: "Failed to parse JSON from '".concat(normalizedString, "': ").concat(ex.message), line: location.start.line, column: location.start.column + 1 } @@ -50642,15 +52416,15 @@ module.exports = class ConfigCommentParser { }; /***/ }), -/* 526 */ +/* 527 */ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { // Generated by LiveScript 1.6.0 (function () { var parseString, cast, parseType, VERSION, parsedTypeParse, parse; - parseString = __webpack_require__(527); - cast = __webpack_require__(534); - parseType = __webpack_require__(535).parseType; + parseString = __webpack_require__(528); + cast = __webpack_require__(535); + parseType = (__webpack_require__(536).parseType); VERSION = '0.4.1'; parsedTypeParse = function (parsedType, string, options) { @@ -50672,13 +52446,13 @@ module.exports = class ConfigCommentParser { }).call(this); /***/ }), -/* 527 */ +/* 528 */ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { // Generated by LiveScript 1.6.0 (function () { var reject, special, tokenRegex; - reject = __webpack_require__(528).reject; + reject = (__webpack_require__(529).reject); function consumeOp(tokens, op) { if (tokens[0] === op) { @@ -50819,7 +52593,7 @@ module.exports = class ConfigCommentParser { }).call(this); /***/ }), -/* 528 */ +/* 529 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { // Generated by LiveScript 1.6.0 @@ -50833,11 +52607,11 @@ var Func, replicate, prelude, toString$ = {}.toString; -Func = __webpack_require__(529); -List = __webpack_require__(530); -Obj = __webpack_require__(531); -Str = __webpack_require__(532); -Num = __webpack_require__(533); +Func = __webpack_require__(530); +List = __webpack_require__(531); +Obj = __webpack_require__(532); +Str = __webpack_require__(533); +Num = __webpack_require__(534); id = function (x) { return x; @@ -51016,7 +52790,7 @@ function curry$(f, bound) { } /***/ }), -/* 529 */ +/* 530 */ /***/ ((module) => { // Generated by LiveScript 1.6.0 @@ -51109,7 +52883,7 @@ function curry$(f, bound) { } /***/ }), -/* 530 */ +/* 531 */ /***/ ((module) => { // Generated by LiveScript 1.6.0 @@ -52138,7 +53912,7 @@ function not$(x) { } /***/ }), -/* 531 */ +/* 532 */ /***/ ((module) => { // Generated by LiveScript 1.6.0 @@ -52358,7 +54132,7 @@ function curry$(f, bound) { } /***/ }), -/* 532 */ +/* 533 */ /***/ ((module) => { // Generated by LiveScript 1.6.0 @@ -52469,7 +54243,7 @@ function curry$(f, bound) { } /***/ }), -/* 533 */ +/* 534 */ /***/ ((module) => { // Generated by LiveScript 1.6.0 @@ -52618,7 +54392,7 @@ function curry$(f, bound) { } /***/ }), -/* 534 */ +/* 535 */ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { // Generated by LiveScript 1.6.0 @@ -52626,7 +54400,7 @@ function curry$(f, bound) { var parsedTypeCheck, types, toString$ = {}.toString; - parsedTypeCheck = __webpack_require__(535).parsedTypeCheck; + parsedTypeCheck = (__webpack_require__(536).parsedTypeCheck); types = { '*': function (value, options) { switch (toString$.call(value).slice(8, -1)) { @@ -52999,15 +54773,15 @@ function curry$(f, bound) { }).call(this); /***/ }), -/* 535 */ +/* 536 */ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { // Generated by LiveScript 1.6.0 (function () { var VERSION, parseType, parsedTypeCheck, typeCheck; VERSION = '0.4.0'; - parseType = __webpack_require__(536); - parsedTypeCheck = __webpack_require__(537); + parseType = __webpack_require__(537); + parsedTypeCheck = __webpack_require__(538); typeCheck = function (type, input, options) { return parsedTypeCheck(parseType(type), input, options); @@ -53022,7 +54796,7 @@ function curry$(f, bound) { }).call(this); /***/ }), -/* 536 */ +/* 537 */ /***/ (function(module) { // Generated by LiveScript 1.6.0 @@ -53275,7 +55049,7 @@ function curry$(f, bound) { }).call(this); /***/ }), -/* 537 */ +/* 538 */ /***/ (function(module, __unused_webpack_exports, __webpack_require__) { // Generated by LiveScript 1.6.0 @@ -53287,7 +55061,7 @@ function curry$(f, bound) { types, defaultType, toString$ = {}.toString; - ref$ = __webpack_require__(528), any = ref$.any, all = ref$.all, isItNaN = ref$.isItNaN; + ref$ = __webpack_require__(529), any = ref$.any, all = ref$.all, isItNaN = ref$.isItNaN; types = { Number: { typeOf: 'Number', @@ -53441,7 +55215,7 @@ function curry$(f, bound) { }).call(this); /***/ }), -/* 538 */ +/* 539 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -53453,7 +55227,7 @@ function curry$(f, bound) { // Requirements //------------------------------------------------------------------------------ -const esquery = __webpack_require__(539); //------------------------------------------------------------------------------ +const esquery = __webpack_require__(540); //------------------------------------------------------------------------------ // Typedefs //------------------------------------------------------------------------------ @@ -53479,9 +55253,12 @@ const esquery = __webpack_require__(539); //------------------------------------ */ -function union(...arrays) { - // TODO(stephenwade): Replace this with arrays.flat() when we drop support for Node v10 - return [...new Set([].concat(...arrays))]; +function union() { + for (var _len = arguments.length, arrays = new Array(_len), _key = 0; _key < _len; _key++) { + arrays[_key] = arguments[_key]; + } + + return [...new Set(arrays.flat())]; } /** * Computes the intersection of one or more arrays @@ -53490,7 +55267,11 @@ function union(...arrays) { */ -function intersection(...arrays) { +function intersection() { + for (var _len2 = arguments.length, arrays = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + arrays[_key2] = arguments[_key2]; + } + if (arrays.length === 0) { return []; } @@ -53548,6 +55329,13 @@ function getPossibleTypes(parsedSelector) { case "adjacent": return getPossibleTypes(parsedSelector.right); + case "class": + if (parsedSelector.name === "function") { + return ["FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression"]; + } + + return null; + default: return null; } @@ -53637,7 +55425,7 @@ function tryParseSelector(rawSelector) { return esquery.parse(rawSelector.replace(/:exit$/u, "")); } catch (err) { if (err.location && err.location.start && typeof err.location.start.offset === "number") { - throw new SyntaxError(`Syntax error in selector "${rawSelector}" at position ${err.location.start.offset}: ${err.message}`); + throw new SyntaxError("Syntax error in selector \"".concat(rawSelector, "\" at position ").concat(err.location.start.offset, ": ").concat(err.message)); } throw err; @@ -53686,8 +55474,6 @@ function parseSelector(rawSelector) { class NodeEventGenerator { - // eslint-disable-next-line jsdoc/require-description - /** * @param {SafeEmitter} emitter * An SafeEmitter which is the destination of events. This emitter must already @@ -53798,7 +55584,7 @@ class NodeEventGenerator { module.exports = NodeEventGenerator; /***/ }), -/* 539 */ +/* 540 */ /***/ (function(module) { !function (e, t) { @@ -55463,7 +57249,7 @@ module.exports = NodeEventGenerator; }); /***/ }), -/* 540 */ +/* 541 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -55475,11 +57261,11 @@ module.exports = NodeEventGenerator; // Requirements //------------------------------------------------------------------------------ -const assert = __webpack_require__(407); +const assert = __webpack_require__(431); -const ruleFixer = __webpack_require__(541); +const ruleFixer = __webpack_require__(542); -const interpolate = __webpack_require__(542); //------------------------------------------------------------------------------ +const interpolate = __webpack_require__(543); //------------------------------------------------------------------------------ // Typedefs //------------------------------------------------------------------------------ @@ -55498,18 +57284,18 @@ const interpolate = __webpack_require__(542); //-------------------------------- /** * Information about the report * @typedef {Object} ReportInfo - * @property {string} ruleId - * @property {(0|1|2)} severity - * @property {(string|undefined)} message - * @property {(string|undefined)} [messageId] - * @property {number} line - * @property {number} column - * @property {(number|undefined)} [endLine] - * @property {(number|undefined)} [endColumn] - * @property {(string|null)} nodeType - * @property {string} source - * @property {({text: string, range: (number[]|null)}|null)} [fix] - * @property {Array<{text: string, range: (number[]|null)}|null>} [suggestions] + * @property {string} ruleId The rule ID + * @property {(0|1|2)} severity Severity of the error + * @property {(string|undefined)} message The message + * @property {(string|undefined)} [messageId] The message ID + * @property {number} line The line number + * @property {number} column The column number + * @property {(number|undefined)} [endLine] The ending line number + * @property {(number|undefined)} [endColumn] The ending column number + * @property {(string|null)} nodeType Type of node + * @property {string} source Source text + * @property {({text: string, range: (number[]|null)}|null)} [fix] The fix object + * @property {Array<{text: string, range: (number[]|null)}|null>} [suggestions] Suggestion info */ //------------------------------------------------------------------------------ // Module Definition @@ -55522,30 +57308,30 @@ const interpolate = __webpack_require__(542); //-------------------------------- */ -function normalizeMultiArgReportCall(...args) { +function normalizeMultiArgReportCall() { // If there is one argument, it is considered to be a new-style call already. - if (args.length === 1) { + if (arguments.length === 1) { // Shallow clone the object to avoid surprises if reusing the descriptor - return Object.assign({}, args[0]); + return Object.assign({}, arguments.length <= 0 ? undefined : arguments[0]); } // If the second argument is a string, the arguments are interpreted as [node, message, data, fix]. - if (typeof args[1] === "string") { + if (typeof (arguments.length <= 1 ? undefined : arguments[1]) === "string") { return { - node: args[0], - message: args[1], - data: args[2], - fix: args[3] + node: arguments.length <= 0 ? undefined : arguments[0], + message: arguments.length <= 1 ? undefined : arguments[1], + data: arguments.length <= 2 ? undefined : arguments[2], + fix: arguments.length <= 3 ? undefined : arguments[3] }; } // Otherwise, the arguments are interpreted as [node, loc, message, data, fix]. return { - node: args[0], - loc: args[1], - message: args[2], - data: args[3], - fix: args[4] + node: arguments.length <= 0 ? undefined : arguments[0], + loc: arguments.length <= 1 ? undefined : arguments[1], + message: arguments.length <= 2 ? undefined : arguments[2], + data: arguments.length <= 3 ? undefined : arguments[3], + fix: arguments.length <= 4 ? undefined : arguments[4] }; } /** @@ -55594,7 +57380,7 @@ function normalizeReportLoc(descriptor) { function assertValidFix(fix) { if (fix) { - assert(fix.range && typeof fix.range[0] === "number" && typeof fix.range[1] === "number", `Fix has invalid range: ${JSON.stringify(fix, null, 2)}`); + assert(fix.range && typeof fix.range[0] === "number" && typeof fix.range[1] === "number", "Fix has invalid range: ".concat(JSON.stringify(fix, null, 2))); } } /** @@ -55699,9 +57485,12 @@ function mapSuggestions(descriptor, sourceCode, messages) { fix: normalizeFixes(suggestInfo, sourceCode) }; }) // Remove suggestions that didn't provide a fix - .filter(({ - fix - }) => fix); + .filter(_ref => { + let { + fix + } = _ref; + return fix; + }); } /** * Creates information about the report from a descriptor @@ -55768,11 +57557,11 @@ function validateSuggestions(suggest, messages) { } = suggestion; if (!messages) { - throw new TypeError(`context.report() called with a suggest option with a messageId '${messageId}', but no messages were present in the rule metadata.`); + throw new TypeError("context.report() called with a suggest option with a messageId '".concat(messageId, "', but no messages were present in the rule metadata.")); } if (!messages[messageId]) { - throw new TypeError(`context.report() called with a suggest option with a messageId '${messageId}' which is not present in the 'messages' config: ${JSON.stringify(messages, null, 2)}`); + throw new TypeError("context.report() called with a suggest option with a messageId '".concat(messageId, "' which is not present in the 'messages' config: ").concat(JSON.stringify(messages, null, 2))); } if (suggestion.desc) { @@ -55783,7 +57572,7 @@ function validateSuggestions(suggest, messages) { } if (typeof suggestion.fix !== "function") { - throw new TypeError(`context.report() called with a suggest option without a fix function. See: ${suggestion}`); + throw new TypeError("context.report() called with a suggest option without a fix function. See: ".concat(suggestion)); } }); } @@ -55804,8 +57593,8 @@ module.exports = function createReportTranslator(metadata) { * called every time a rule reports a problem, which happens much less frequently (usually, the vast * majority of rules don't report any problems for a given file). */ - return (...args) => { - const descriptor = normalizeMultiArgReportCall(...args); + return function () { + const descriptor = normalizeMultiArgReportCall(...arguments); const messages = metadata.messageIds; assertValidNodeInfo(descriptor); let computedMessage; @@ -55822,7 +57611,7 @@ module.exports = function createReportTranslator(metadata) { } if (!messages || !Object.prototype.hasOwnProperty.call(messages, id)) { - throw new TypeError(`context.report() called with a messageId of '${id}' which is not present in the 'messages' config: ${JSON.stringify(messages, null, 2)}`); + throw new TypeError("context.report() called with a messageId of '".concat(id, "' which is not present in the 'messages' config: ").concat(JSON.stringify(messages, null, 2))); } computedMessage = messages[id]; @@ -55847,7 +57636,7 @@ module.exports = function createReportTranslator(metadata) { }; /***/ }), -/* 541 */ +/* 542 */ /***/ ((module) => { "use strict"; @@ -55986,7 +57775,7 @@ const ruleFixer = Object.freeze({ module.exports = ruleFixer; /***/ }), -/* 542 */ +/* 543 */ /***/ ((module) => { "use strict"; @@ -56017,7 +57806,7 @@ module.exports = (text, data) => { }; /***/ }), -/* 543 */ +/* 544 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -56030,7 +57819,7 @@ module.exports = (text, data) => { // Requirements //------------------------------------------------------------------------------ -const builtInRules = __webpack_require__(544); //------------------------------------------------------------------------------ +const builtInRules = __webpack_require__(545); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -56050,6 +57839,10 @@ function normalizeRule(rule) { // Public Interface //------------------------------------------------------------------------------ +/** + * A storage for rules. + */ + class Rules { constructor() { @@ -56076,7 +57869,7 @@ class Rules { get(ruleId) { if (typeof this._rules[ruleId] === "string") { - this.define(ruleId, __webpack_require__(853)(this._rules[ruleId])); + this.define(ruleId, __webpack_require__(854)(this._rules[ruleId])); } if (this._rules[ruleId]) { @@ -56103,7 +57896,7 @@ class Rules { module.exports = Rules; /***/ }), -/* 544 */ +/* 545 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -56113,16 +57906,16 @@ module.exports = Rules; * @author Peter (Somogyvari) Metz */ -/* eslint sort-keys: ["error", "asc"] */ +/* eslint sort-keys: ["error", "asc"] -- More readable for long list */ const { LazyLoadingRuleMap -} = __webpack_require__(545); +} = __webpack_require__(546); /** @type {Map} */ module.exports = new LazyLoadingRuleMap(Object.entries({ - "accessor-pairs": () => __webpack_require__(546), + "accessor-pairs": () => __webpack_require__(547), "array-bracket-newline": () => __webpack_require__(553), "array-bracket-spacing": () => __webpack_require__(554), "array-callback-return": () => __webpack_require__(555), @@ -56331,85 +58124,86 @@ module.exports = new LazyLoadingRuleMap(Object.entries({ "no-unsafe-optional-chaining": () => __webpack_require__(770), "no-unused-expressions": () => __webpack_require__(771), "no-unused-labels": () => __webpack_require__(772), - "no-unused-vars": () => __webpack_require__(773), - "no-use-before-define": () => __webpack_require__(774), - "no-useless-backreference": () => __webpack_require__(775), - "no-useless-call": () => __webpack_require__(776), - "no-useless-catch": () => __webpack_require__(777), - "no-useless-computed-key": () => __webpack_require__(778), - "no-useless-concat": () => __webpack_require__(779), - "no-useless-constructor": () => __webpack_require__(780), - "no-useless-escape": () => __webpack_require__(781), - "no-useless-rename": () => __webpack_require__(782), - "no-useless-return": () => __webpack_require__(783), - "no-var": () => __webpack_require__(784), - "no-void": () => __webpack_require__(785), - "no-warning-comments": () => __webpack_require__(786), - "no-whitespace-before-property": () => __webpack_require__(787), - "no-with": () => __webpack_require__(788), - "nonblock-statement-body-position": () => __webpack_require__(789), - "object-curly-newline": () => __webpack_require__(790), - "object-curly-spacing": () => __webpack_require__(791), - "object-property-newline": () => __webpack_require__(792), - "object-shorthand": () => __webpack_require__(793), - "one-var": () => __webpack_require__(794), - "one-var-declaration-per-line": () => __webpack_require__(795), - "operator-assignment": () => __webpack_require__(796), - "operator-linebreak": () => __webpack_require__(797), - "padded-blocks": () => __webpack_require__(798), - "padding-line-between-statements": () => __webpack_require__(799), - "prefer-arrow-callback": () => __webpack_require__(800), - "prefer-const": () => __webpack_require__(801), - "prefer-destructuring": () => __webpack_require__(802), - "prefer-exponentiation-operator": () => __webpack_require__(803), - "prefer-named-capture-group": () => __webpack_require__(804), - "prefer-numeric-literals": () => __webpack_require__(805), - "prefer-object-spread": () => __webpack_require__(806), - "prefer-promise-reject-errors": () => __webpack_require__(807), - "prefer-reflect": () => __webpack_require__(808), - "prefer-regex-literals": () => __webpack_require__(809), - "prefer-rest-params": () => __webpack_require__(810), - "prefer-spread": () => __webpack_require__(811), - "prefer-template": () => __webpack_require__(812), - "quote-props": () => __webpack_require__(813), - quotes: () => __webpack_require__(814), - radix: () => __webpack_require__(815), - "require-atomic-updates": () => __webpack_require__(816), - "require-await": () => __webpack_require__(817), - "require-jsdoc": () => __webpack_require__(818), - "require-unicode-regexp": () => __webpack_require__(819), - "require-yield": () => __webpack_require__(820), - "rest-spread-spacing": () => __webpack_require__(821), - semi: () => __webpack_require__(822), - "semi-spacing": () => __webpack_require__(823), - "semi-style": () => __webpack_require__(824), - "sort-imports": () => __webpack_require__(825), - "sort-keys": () => __webpack_require__(826), - "sort-vars": () => __webpack_require__(828), - "space-before-blocks": () => __webpack_require__(829), - "space-before-function-paren": () => __webpack_require__(830), - "space-in-parens": () => __webpack_require__(831), - "space-infix-ops": () => __webpack_require__(832), - "space-unary-ops": () => __webpack_require__(833), - "spaced-comment": () => __webpack_require__(834), - strict: () => __webpack_require__(835), - "switch-colon-spacing": () => __webpack_require__(836), - "symbol-description": () => __webpack_require__(837), - "template-curly-spacing": () => __webpack_require__(838), - "template-tag-spacing": () => __webpack_require__(839), - "unicode-bom": () => __webpack_require__(840), - "use-isnan": () => __webpack_require__(841), - "valid-jsdoc": () => __webpack_require__(842), - "valid-typeof": () => __webpack_require__(847), - "vars-on-top": () => __webpack_require__(848), - "wrap-iife": () => __webpack_require__(849), - "wrap-regex": () => __webpack_require__(850), - "yield-star-spacing": () => __webpack_require__(851), - yoda: () => __webpack_require__(852) + "no-unused-private-class-members": () => __webpack_require__(773), + "no-unused-vars": () => __webpack_require__(774), + "no-use-before-define": () => __webpack_require__(775), + "no-useless-backreference": () => __webpack_require__(776), + "no-useless-call": () => __webpack_require__(777), + "no-useless-catch": () => __webpack_require__(778), + "no-useless-computed-key": () => __webpack_require__(779), + "no-useless-concat": () => __webpack_require__(780), + "no-useless-constructor": () => __webpack_require__(781), + "no-useless-escape": () => __webpack_require__(782), + "no-useless-rename": () => __webpack_require__(783), + "no-useless-return": () => __webpack_require__(784), + "no-var": () => __webpack_require__(785), + "no-void": () => __webpack_require__(786), + "no-warning-comments": () => __webpack_require__(787), + "no-whitespace-before-property": () => __webpack_require__(788), + "no-with": () => __webpack_require__(789), + "nonblock-statement-body-position": () => __webpack_require__(790), + "object-curly-newline": () => __webpack_require__(791), + "object-curly-spacing": () => __webpack_require__(792), + "object-property-newline": () => __webpack_require__(793), + "object-shorthand": () => __webpack_require__(794), + "one-var": () => __webpack_require__(795), + "one-var-declaration-per-line": () => __webpack_require__(796), + "operator-assignment": () => __webpack_require__(797), + "operator-linebreak": () => __webpack_require__(798), + "padded-blocks": () => __webpack_require__(799), + "padding-line-between-statements": () => __webpack_require__(800), + "prefer-arrow-callback": () => __webpack_require__(801), + "prefer-const": () => __webpack_require__(802), + "prefer-destructuring": () => __webpack_require__(803), + "prefer-exponentiation-operator": () => __webpack_require__(804), + "prefer-named-capture-group": () => __webpack_require__(805), + "prefer-numeric-literals": () => __webpack_require__(806), + "prefer-object-spread": () => __webpack_require__(807), + "prefer-promise-reject-errors": () => __webpack_require__(808), + "prefer-reflect": () => __webpack_require__(809), + "prefer-regex-literals": () => __webpack_require__(810), + "prefer-rest-params": () => __webpack_require__(811), + "prefer-spread": () => __webpack_require__(812), + "prefer-template": () => __webpack_require__(813), + "quote-props": () => __webpack_require__(814), + quotes: () => __webpack_require__(815), + radix: () => __webpack_require__(816), + "require-atomic-updates": () => __webpack_require__(817), + "require-await": () => __webpack_require__(818), + "require-jsdoc": () => __webpack_require__(819), + "require-unicode-regexp": () => __webpack_require__(820), + "require-yield": () => __webpack_require__(821), + "rest-spread-spacing": () => __webpack_require__(822), + semi: () => __webpack_require__(823), + "semi-spacing": () => __webpack_require__(824), + "semi-style": () => __webpack_require__(825), + "sort-imports": () => __webpack_require__(826), + "sort-keys": () => __webpack_require__(827), + "sort-vars": () => __webpack_require__(829), + "space-before-blocks": () => __webpack_require__(830), + "space-before-function-paren": () => __webpack_require__(831), + "space-in-parens": () => __webpack_require__(832), + "space-infix-ops": () => __webpack_require__(833), + "space-unary-ops": () => __webpack_require__(834), + "spaced-comment": () => __webpack_require__(835), + strict: () => __webpack_require__(836), + "switch-colon-spacing": () => __webpack_require__(837), + "symbol-description": () => __webpack_require__(838), + "template-curly-spacing": () => __webpack_require__(839), + "template-tag-spacing": () => __webpack_require__(840), + "unicode-bom": () => __webpack_require__(841), + "use-isnan": () => __webpack_require__(842), + "valid-jsdoc": () => __webpack_require__(843), + "valid-typeof": () => __webpack_require__(848), + "vars-on-top": () => __webpack_require__(849), + "wrap-iife": () => __webpack_require__(850), + "wrap-regex": () => __webpack_require__(851), + "yield-star-spacing": () => __webpack_require__(852), + yoda: () => __webpack_require__(853) })); /***/ }), -/* 545 */ +/* 546 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -56428,10 +58222,10 @@ const debug = __webpack_require__(496)("eslint:rules"); * const rules = new LazyLoadingRuleMap([ * ["eqeqeq", () => require("eqeqeq")], * ["semi", () => require("semi")], - * ["no-unused-vars", () => require("no-unused-vars")], - * ]) + * ["no-unused-vars", () => require("no-unused-vars")] + * ]); * - * rules.get("semi") // call `() => require("semi")` here. + * rules.get("semi"); // call `() => require("semi")` here. * * @extends {Map Rule>} */ @@ -56444,7 +58238,8 @@ class LazyLoadingRuleMap extends Map { */ constructor(loaders) { let remaining = loaders.length; - super(debug.enabled ? loaders.map(([ruleId, load]) => { + super(debug.enabled ? loaders.map(_ref => { + let [ruleId, load] = _ref; let cache = null; return [ruleId, () => { if (!cache) { @@ -56532,7 +58327,7 @@ module.exports = { }; /***/ }), -/* 546 */ +/* 547 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -56544,7 +58339,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Typedefs //------------------------------------------------------------------------------ @@ -56664,7 +58459,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce getter and setter pairs in objects and classes", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/accessor-pairs" }, @@ -56714,7 +58508,7 @@ module.exports = { if (node.type === "Property") { context.report({ node, - messageId: `${messageKind}InObjectLiteral`, + messageId: "".concat(messageKind, "InObjectLiteral"), loc: astUtils.getFunctionHeadLoc(node.value, sourceCode), data: { name: astUtils.getFunctionNameWithKind(node.value) @@ -56723,7 +58517,7 @@ module.exports = { } else if (node.type === "MethodDefinition") { context.report({ node, - messageId: `${messageKind}InClass`, + messageId: "".concat(messageKind, "InClass"), loc: astUtils.getFunctionHeadLoc(node.value, sourceCode), data: { name: astUtils.getFunctionNameWithKind(node.value) @@ -56732,7 +58526,7 @@ module.exports = { } else { context.report({ node, - messageId: `${messageKind}InPropertyDescriptor` + messageId: "".concat(messageKind, "InPropertyDescriptor") }); } } @@ -56832,9 +58626,12 @@ module.exports = { function checkPropertyDescriptor(node) { - const namesToCheck = node.properties.filter(p => p.type === "Property" && p.kind === "init" && !p.computed).map(({ - key - }) => key.name); + const namesToCheck = node.properties.filter(p => p.type === "Property" && p.kind === "init" && !p.computed).map(_ref => { + let { + key + } = _ref; + return key.name; + }); const hasGetter = namesToCheck.includes("get"); const hasSetter = namesToCheck.includes("set"); @@ -56891,7 +58688,7 @@ module.exports = { }; /***/ }), -/* 547 */ +/* 548 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -56903,18 +58700,18 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const esutils = __webpack_require__(548); +const esutils = __webpack_require__(549); -const espree = __webpack_require__(423); +const espree = __webpack_require__(436); -const escapeRegExp = __webpack_require__(552); +const escapeRegExp = __webpack_require__(525); const { breakableTypePattern, createGlobalLinebreakMatcher, lineBreakPattern, shebangPattern -} = __webpack_require__(439); //------------------------------------------------------------------------------ +} = __webpack_require__(444); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -56928,7 +58725,7 @@ const thisTagPattern = /^[\s*]*@this/mu; const COMMENTS_IGNORE_PATTERN = /^\s*(?:eslint|jshint\s+|jslint\s+|istanbul\s+|globals?\s+|exported\s+|jscs)/u; const LINEBREAKS = new Set(["\r\n", "\r", "\n", "\u2028", "\u2029"]); // A set of node types that can contain a list of statements -const STATEMENT_LIST_PARENTS = new Set(["Program", "BlockStatement", "SwitchCase"]); +const STATEMENT_LIST_PARENTS = new Set(["Program", "BlockStatement", "StaticBlock", "SwitchCase"]); const DECIMAL_INTEGER_PATTERN = /^(?:0|0[0-7]*[89]\d*|[1-9](?:_?\d)*)$/u; // Tests the presence of at least one LegacyOctalEscapeSequence or NonOctalDecimalEscapeSequence in a raw string const OCTAL_OR_NON_OCTAL_DECIMAL_ESCAPE_PATTERN = /^(?:[^\\]|\\.)*\\(?:[1-9]|0[0-9])/su; @@ -57095,7 +58892,7 @@ function getStaticStringValue(node) { } if (node.regex) { - return `/${node.regex.pattern}/${node.regex.flags}`; + return "/".concat(node.regex.pattern, "/").concat(node.regex.flags); } if (node.bigint) { @@ -57159,6 +58956,7 @@ function getStaticPropertyName(node) { return getStaticPropertyName(node.expression); case "Property": + case "PropertyDefinition": case "MethodDefinition": prop = node.key; break; @@ -57277,7 +59075,9 @@ function equalLiteralValue(left, right) { */ -function isSameReference(left, right, disableStaticComputedKey = false) { +function isSameReference(left, right) { + let disableStaticComputedKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + if (left.type !== right.type) { // Handle `a.b` and `a?.b` are samely. if (left.type === "ChainExpression") { @@ -57297,6 +59097,7 @@ function isSameReference(left, right, disableStaticComputedKey = false) { return true; case "Identifier": + case "PrivateIdentifier": return left.name === right.name; case "Literal": @@ -57403,6 +59204,16 @@ function isParenthesised(sourceCode, node) { nextToken = sourceCode.getTokenAfter(node); return Boolean(previousToken && nextToken) && previousToken.value === "(" && previousToken.range[1] <= node.range[0] && nextToken.value === ")" && nextToken.range[0] >= node.range[1]; } +/** + * Checks if the given token is a `=` token or not. + * @param {Token} token The token to check. + * @returns {boolean} `true` if the token is a `=` token. + */ + + +function isEqToken(token) { + return token.value === "=" && token.type === "Punctuator"; +} /** * Checks if the given token is an arrow token or not. * @param {Token} token The token to check. @@ -57552,6 +59363,14 @@ function isKeywordToken(token) { function getOpeningParenOfParams(node, sourceCode) { + // If the node is an arrow function and doesn't have parens, this returns the identifier of the first param. + if (node.type === "ArrowFunctionExpression" && node.params.length === 1) { + const argToken = sourceCode.getFirstToken(node.params[0]); + const maybeParenToken = sourceCode.getTokenBefore(argToken); + return isOpeningParenToken(maybeParenToken) ? maybeParenToken : argToken; + } // Otherwise, returns paren. + + return node.id ? sourceCode.getTokenAfter(node.id, isOpeningParenToken) : sourceCode.getFirstToken(node, isOpeningParenToken); } /** @@ -57632,6 +59451,21 @@ function isMixedLogicalAndCoalesceExpressions(left, right) { function isLogicalAssignmentOperator(operator) { return LOGICAL_ASSIGNMENT_OPERATORS.has(operator); +} +/** + * Get the colon token of the given SwitchCase node. + * @param {ASTNode} node The SwitchCase node to get. + * @param {SourceCode} sourceCode The source code object to get tokens. + * @returns {Token} The colon token of the node. + */ + + +function getSwitchCaseColonToken(node, sourceCode) { + if (node.test) { + return sourceCode.getTokenAfter(node.test, isColonToken); + } + + return sourceCode.getFirstToken(node, 1); } //------------------------------------------------------------------------------ // Public Interface //------------------------------------------------------------------------------ @@ -57691,6 +59525,7 @@ module.exports = { isOpeningBracketToken, isOpeningParenToken, isSemicolonToken, + isEqToken, /** * Checks whether or not a given node is a string literal. @@ -57730,8 +59565,8 @@ module.exports = { /** * Validate that a string passed in is surrounded by the specified character - * @param {string} val The text to check. - * @param {string} character The character to see if it's surrounded by. + * @param {string} val The text to check. + * @param {string} character The character to see if it's surrounded by. * @returns {boolean} True if the text is surrounded by the character, false if not. * @private */ @@ -57788,6 +59623,8 @@ module.exports = { * * First, this checks the node: * + * - The given node is not in `PropertyDefinition#value` position. + * - The given node is not `StaticBlock`. * - The function name does not start with uppercase. It's a convention to capitalize the names * of constructor functions. This check is not performed if `capIsConstructor` is set to `false`. * - The function does not have a JSDoc comment that has a @this tag. @@ -57802,15 +59639,32 @@ module.exports = { * - The location is not on an ES2015 class. * - Its `bind`/`call`/`apply` method is not called directly. * - The function is not a callback of array methods (such as `.forEach()`) if `thisArg` is given. - * @param {ASTNode} node A function node to check. + * @param {ASTNode} node A function node to check. It also can be an implicit function, like `StaticBlock` + * or any expression that is `PropertyDefinition#value` node. * @param {SourceCode} sourceCode A SourceCode instance to get comments. * @param {boolean} [capIsConstructor = true] `false` disables the assumption that functions which name starts * with an uppercase or are assigned to a variable which name starts with an uppercase are constructors. * @returns {boolean} The function node is the default `this` binding. */ - isDefaultThisBinding(node, sourceCode, { - capIsConstructor = true - } = {}) { + isDefaultThisBinding(node, sourceCode) { + let { + capIsConstructor = true + } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + + /* + * Class field initializers are implicit functions, but ESTree doesn't have the AST node of field initializers. + * Therefore, A expression node at `PropertyDefinition#value` is a function. + * In this case, `this` is always not default binding. + */ + if (node.parent.type === "PropertyDefinition" && node.parent.value === node) { + return false; + } // Class static blocks are implicit functions. In this case, `this` is always not default binding. + + + if (node.type === "StaticBlock") { + return false; + } + if (capIsConstructor && isES5Constructor(node) || hasJSDocThisTag(node, sourceCode)) { return false; } @@ -57873,9 +59727,11 @@ module.exports = { * class A { get foo() { ... } } * class A { set foo() { ... } } * class A { static foo() { ... } } + * class A { foo = function() { ... } } */ case "Property": + case "PropertyDefinition": case "MethodDefinition": return parent.value !== currentNode; @@ -58079,7 +59935,12 @@ module.exports = { getDirectivePrologue(node) { const directives = []; // Directive prologues only occur at the top of files or functions. - if (node.type === "Program" || node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression" && node.body.type === "BlockStatement") { + if (node.type === "Program" || node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || + /* + * Do not check arrow functions with implicit return. + * `() => "use strict";` returns the string `"use strict"`. + */ + node.type === "ArrowFunctionExpression" && node.body.type === "BlockStatement") { const statements = node.type === "Program" ? node.body : node.body.body; for (const statement of statements) { @@ -58121,7 +59982,8 @@ module.exports = { * 5e1_000 // false * 5n // false * 1_000n // false - * '5' // false + * "5" // false + * */ isDecimalInteger(node) { return node.type === "Literal" && typeof node.value === "number" && DECIMAL_INTEGER_PATTERN.test(node.raw); @@ -58182,6 +60044,16 @@ module.exports = { * - `class A { static async foo() {} }` .... `static async method 'foo'` * - `class A { static get foo() {} }` ...... `static getter 'foo'` * - `class A { static set foo(a) {} }` ..... `static setter 'foo'` + * - `class A { foo = () => {}; }` .......... `method 'foo'` + * - `class A { foo = function() {}; }` ..... `method 'foo'` + * - `class A { foo = function bar() {}; }` . `method 'foo'` + * - `class A { static foo = () => {}; }` ... `static method 'foo'` + * - `class A { '#foo' = () => {}; }` ....... `method '#foo'` + * - `class A { #foo = () => {}; }` ......... `private method #foo` + * - `class A { static #foo = () => {}; }` .. `static private method #foo` + * - `class A { '#foo'() {} }` .............. `method '#foo'` + * - `class A { #foo() {} }` ................ `private method #foo` + * - `class A { static #foo() {} }` ......... `static private method #foo` * @param {ASTNode} node The function node to get. * @returns {string} The name and kind of the function node. */ @@ -58189,8 +60061,15 @@ module.exports = { const parent = node.parent; const tokens = []; - if (parent.type === "MethodDefinition" && parent.static) { - tokens.push("static"); + if (parent.type === "MethodDefinition" || parent.type === "PropertyDefinition") { + // The proposal uses `static` word consistently before visibility words: https://github.com/tc39/proposal-static-class-features + if (parent.static) { + tokens.push("static"); + } + + if (!parent.computed && parent.key.type === "PrivateIdentifier") { + tokens.push("private"); + } } if (node.async) { @@ -58201,9 +60080,7 @@ module.exports = { tokens.push("generator"); } - if (node.type === "ArrowFunctionExpression") { - tokens.push("arrow", "function"); - } else if (parent.type === "Property" || parent.type === "MethodDefinition") { + if (parent.type === "Property" || parent.type === "MethodDefinition") { if (parent.kind === "constructor") { return "constructor"; } @@ -58215,18 +60092,30 @@ module.exports = { } else { tokens.push("method"); } + } else if (parent.type === "PropertyDefinition") { + tokens.push("method"); } else { + if (node.type === "ArrowFunctionExpression") { + tokens.push("arrow"); + } + tokens.push("function"); } - if (node.id) { - tokens.push(`'${node.id.name}'`); - } else { - const name = getStaticPropertyName(parent); + if (parent.type === "Property" || parent.type === "MethodDefinition" || parent.type === "PropertyDefinition") { + if (!parent.computed && parent.key.type === "PrivateIdentifier") { + tokens.push("#".concat(parent.key.name)); + } else { + const name = getStaticPropertyName(parent); - if (name !== null) { - tokens.push(`'${name}'`); + if (name !== null) { + tokens.push("'".concat(name, "'")); + } else if (node.id) { + tokens.push("'".concat(node.id.name, "'")); + } } + } else if (node.id) { + tokens.push("'".concat(node.id.name, "'")); } return tokens.join(" "); @@ -58319,6 +60208,12 @@ module.exports = { * ^^^^^^^^^^^^^^ * - `class A { static set foo(a) {} }` * ^^^^^^^^^^^^^^ + * - `class A { foo = function() {} }` + * ^^^^^^^^^^^^^^ + * - `class A { static foo = function() {} }` + * ^^^^^^^^^^^^^^^^^^^^^ + * - `class A { foo = (a, b) => {} }` + * ^^^^^^ * @param {ASTNode} node The function node to get. * @param {SourceCode} sourceCode The source code object to get tokens. * @returns {string} The location of the function node for reporting. @@ -58328,13 +60223,13 @@ module.exports = { let start = null; let end = null; - if (node.type === "ArrowFunctionExpression") { + if (parent.type === "Property" || parent.type === "MethodDefinition" || parent.type === "PropertyDefinition") { + start = parent.loc.start; + end = getOpeningParenOfParams(node, sourceCode).loc.start; + } else if (node.type === "ArrowFunctionExpression") { const arrowToken = sourceCode.getTokenBefore(node.body, isArrowToken); start = arrowToken.loc.start; end = arrowToken.loc.end; - } else if (parent.type === "Property" || parent.type === "MethodDefinition") { - start = parent.loc.start; - end = getOpeningParenOfParams(node, sourceCode).loc.start; } else { start = node.loc.start; end = getOpeningParenOfParams(node, sourceCode).loc.start; @@ -58390,10 +60285,12 @@ module.exports = { * @param {{line: number, column: number}} location The location * @returns {{line: number, column: number} | null} Next location */ - getNextLocation(sourceCode, { - line, - column - }) { + getNextLocation(sourceCode, _ref) { + let { + line, + column + } = _ref; + if (column < sourceCode.lines[line - 1].length) { return { line, @@ -58430,9 +60327,9 @@ module.exports = { return sourceCode.getText().slice(leftToken.range[0], rightToken.range[1]); }, - /* + /** * Determine if a node has a possibility to be an Error object - * @param {ASTNode} node ASTNode to check + * @param {ASTNode} node ASTNode to check * @returns {boolean} True if there is a chance it contains an Error obj */ couldBeError(node) { @@ -58594,6 +60491,10 @@ module.exports = { return true; } + if (rightToken.type === "PrivateIdentifier") { + return true; + } + return false; }, @@ -58605,7 +60506,7 @@ module.exports = { * @returns {SourceLocation} The `loc` object. */ getNameLocationInGlobalDirectiveComment(sourceCode, comment, name) { - const namePattern = new RegExp(`[\\s,]${escapeRegExp(name)}(?:$|[\\s,:])`, "gu"); // To ignore the first text "global". + const namePattern = new RegExp("[\\s,]".concat(escapeRegExp(name), "(?:$|[\\s,:])"), "gu"); // To ignore the first text "global". namePattern.lastIndex = comment.value.indexOf("global") + 6; // Search a given variable name. @@ -58649,11 +60550,12 @@ module.exports = { isSpecificMemberAccess, equalLiteralValue, isSameReference, - isLogicalAssignmentOperator + isLogicalAssignmentOperator, + getSwitchCaseColonToken }; /***/ }), -/* 548 */ +/* 549 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { /* @@ -58682,14 +60584,14 @@ module.exports = { (function () { 'use strict'; - exports.ast = __webpack_require__(549); - exports.code = __webpack_require__(550); - exports.keyword = __webpack_require__(551); + exports.ast = __webpack_require__(550); + exports.code = __webpack_require__(551); + exports.keyword = __webpack_require__(552); })(); /* vim: set sw=4 ts=4 et tw=80 : */ /***/ }), -/* 549 */ +/* 550 */ /***/ ((module) => { /* @@ -58854,7 +60756,7 @@ module.exports = { /* vim: set sw=4 ts=4 et tw=80 : */ /***/ }), -/* 550 */ +/* 551 */ /***/ ((module) => { /* @@ -58984,7 +60886,7 @@ module.exports = { /* vim: set sw=4 ts=4 et tw=80 : */ /***/ }), -/* 551 */ +/* 552 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { /* @@ -59013,7 +60915,7 @@ module.exports = { (function () { 'use strict'; - var code = __webpack_require__(550); + var code = __webpack_require__(551); function isStrictModeReservedWordES6(id) { switch (id) { @@ -59176,23 +61078,6 @@ module.exports = { })(); /* vim: set sw=4 ts=4 et tw=80 : */ -/***/ }), -/* 552 */ -/***/ ((module) => { - -"use strict"; - - -module.exports = string => { - if (typeof string !== 'string') { - throw new TypeError('Expected a string'); - } // Escape characters with special meaning either inside or outside character sets. - // Use a simple backslash escape when it’s always valid, and a \unnnn escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar. - - - return string.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d'); -}; - /***/ }), /* 553 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { @@ -59204,7 +61089,7 @@ module.exports = string => { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -59214,7 +61099,6 @@ module.exports = { type: "layout", docs: { description: "enforce linebreaks after opening and before closing array brackets", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/array-bracket-newline" }, @@ -59466,7 +61350,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -59476,7 +61360,6 @@ module.exports = { type: "layout", docs: { description: "enforce consistent spacing inside array brackets", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/array-bracket-spacing" }, @@ -59715,7 +61598,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -59846,7 +61729,6 @@ module.exports = { type: "problem", docs: { description: "enforce `return` statements in callbacks of array methods", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/array-callback-return" }, @@ -60003,7 +61885,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -60013,7 +61895,6 @@ module.exports = { type: "layout", docs: { description: "enforce line breaks after each array element", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/array-element-newline" }, @@ -60301,7 +62182,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -60311,7 +62192,6 @@ module.exports = { type: "suggestion", docs: { description: "require braces around arrow function bodies", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/arrow-body-style" }, @@ -60585,7 +62465,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -60608,7 +62488,6 @@ module.exports = { type: "layout", docs: { description: "require parentheses around arrow function arguments", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/arrow-parens" }, @@ -60756,7 +62635,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -60766,7 +62645,6 @@ module.exports = { type: "layout", docs: { description: "enforce consistent spacing before and after the arrow in arrow functions", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/arrow-spacing" }, @@ -60923,7 +62801,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce the use of variables within the scope they are defined", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/block-scoped-var" }, @@ -61023,6 +62900,8 @@ module.exports = { "SwitchStatement:exit": exitScope, CatchClause: enterScope, "CatchClause:exit": exitScope, + StaticBlock: enterScope, + "StaticBlock:exit": exitScope, // Finds and reports references which are outside of valid scope. VariableDeclaration: checkForVariables }; @@ -61041,7 +62920,7 @@ module.exports = { */ -const util = __webpack_require__(547); //------------------------------------------------------------------------------ +const util = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -61051,7 +62930,6 @@ module.exports = { type: "layout", docs: { description: "disallow or enforce spaces inside of blocks after opening block and before closing block", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/block-spacing" }, @@ -61071,7 +62949,7 @@ module.exports = { sourceCode = context.getSourceCode(); /** * Gets the open brace token from a given node. - * @param {ASTNode} node A BlockStatement/SwitchStatement node to get. + * @param {ASTNode} node A BlockStatement/StaticBlock/SwitchStatement node to get. * @returns {Token} The token of the open brace. */ @@ -61084,6 +62962,13 @@ module.exports = { return sourceCode.getLastToken(node, 1); } + if (node.type === "StaticBlock") { + return sourceCode.getFirstToken(node, { + skip: 1 + }); // skip the `static` token + } // "BlockStatement" + + return sourceCode.getFirstToken(node); } /** @@ -61103,8 +62988,8 @@ module.exports = { return !util.isTokenOnSameLine(left, right) || sourceCode.isSpaceBetweenTokens(left, right) === always; } /** - * Reports invalid spacing style inside braces. - * @param {ASTNode} node A BlockStatement/SwitchStatement node to get. + * Checks and reports invalid spacing style inside braces. + * @param {ASTNode} node A BlockStatement/StaticBlock/SwitchStatement node to check. * @returns {void} */ @@ -61193,6 +63078,7 @@ module.exports = { return { BlockStatement: checkSpacingInsideBraces, + StaticBlock: checkSpacingInsideBraces, SwitchStatement: checkSpacingInsideBraces }; } @@ -61210,7 +63096,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -61220,7 +63106,6 @@ module.exports = { type: "layout", docs: { description: "enforce consistent brace style for blocks", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/brace-style" }, @@ -61354,6 +63239,13 @@ module.exports = { } }, + StaticBlock(node) { + validateCurlyPair(sourceCode.getFirstToken(node, { + skip: 1 + }), // skip the `static` token + sourceCode.getLastToken(node)); + }, + ClassBody(node) { validateCurlyPair(sourceCode.getFirstToken(node), sourceCode.getLastToken(node)); }, @@ -61394,6 +63286,7 @@ module.exports = { /** * @fileoverview Enforce return after a callback. * @author Jamund Ferguson + * @deprecated in ESLint v7.0.0 */ //------------------------------------------------------------------------------ // Rule Definition @@ -61406,7 +63299,6 @@ module.exports = { type: "suggestion", docs: { description: "require `return` statements after callbacks", - category: "Node.js and CommonJS", recommended: false, url: "https://eslint.org/docs/rules/callback-return" }, @@ -61584,7 +63476,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce camelcase naming convention", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/camelcase" }, @@ -61618,29 +63509,23 @@ module.exports = { additionalProperties: false }], messages: { - notCamelCase: "Identifier '{{name}}' is not in camel case." + notCamelCase: "Identifier '{{name}}' is not in camel case.", + notCamelCasePrivate: "#{{name}} is not in camel case." } }, create(context) { const options = context.options[0] || {}; - let properties = options.properties || ""; + const properties = options.properties === "never" ? "never" : "always"; const ignoreDestructuring = options.ignoreDestructuring; const ignoreImports = options.ignoreImports; const ignoreGlobals = options.ignoreGlobals; - const allow = options.allow || []; - let globalScope; - - if (properties !== "always" && properties !== "never") { - properties = "always"; - } //-------------------------------------------------------------------------- + const allow = options.allow || []; //-------------------------------------------------------------------------- // Helpers //-------------------------------------------------------------------------- // contains reported nodes to avoid reporting twice on destructuring with shorthand notation - - const reported = []; - const ALLOWED_PARENT_TYPES = new Set(["CallExpression", "NewExpression"]); + const reported = new Set(); /** * Checks if a string contains an underscore and isn't all upper-case * @param {string} name The string to check. @@ -61649,8 +63534,9 @@ module.exports = { */ function isUnderscored(name) { - // if there's an underscore, it might be A_CONSTANT, which is okay - return name.includes("_") && name !== name.toUpperCase(); + const nameBody = name.replace(/^_+|_+$/gu, ""); // if there's an underscore, it might be A_CONSTANT, which is okay + + return nameBody.includes("_") && nameBody !== nameBody.toUpperCase(); } /** * Checks if a string match the ignore list @@ -61664,77 +63550,67 @@ module.exports = { return allow.some(entry => name === entry || name.match(new RegExp(entry, "u"))); } /** - * Checks if a parent of a node is an ObjectPattern. - * @param {ASTNode} node The node to check. - * @returns {boolean} if the node is inside an ObjectPattern + * Checks if a given name is good or not. + * @param {string} name The name to check. + * @returns {boolean} `true` if the name is good. * @private */ - function isInsideObjectPattern(node) { - let current = node; - - while (current) { - const parent = current.parent; - - if (parent && parent.type === "Property" && parent.computed && parent.key === current) { - return false; - } - - if (current.type === "ObjectPattern") { - return true; - } - - current = parent; - } - - return false; + function isGoodName(name) { + return !isUnderscored(name) || isAllowed(name); } /** - * Checks whether the given node represents assignment target property in destructuring. - * - * For examples: - * ({a: b.foo} = c); // => true for `foo` - * ([a.foo] = b); // => true for `foo` - * ([a.foo = 1] = b); // => true for `foo` - * ({...a.foo} = b); // => true for `foo` - * @param {ASTNode} node An Identifier node to check - * @returns {boolean} True if the node is an assignment target property in destructuring. + * Checks if a given identifier reference or member expression is an assignment + * target. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node is an assignment target. */ - function isAssignmentTargetPropertyInDestructuring(node) { - if (node.parent.type === "MemberExpression" && node.parent.property === node && !node.parent.computed) { - const effectiveParent = node.parent.parent; - return effectiveParent.type === "Property" && effectiveParent.value === node.parent && effectiveParent.parent.type === "ObjectPattern" || effectiveParent.type === "ArrayPattern" || effectiveParent.type === "RestElement" || effectiveParent.type === "AssignmentPattern" && effectiveParent.left === node.parent; - } - - return false; - } - /** - * Checks whether the given node represents a reference to a global variable that is not declared in the source code. - * These identifiers will be allowed, as it is assumed that user has no control over the names of external global variables. - * @param {ASTNode} node `Identifier` node to check. - * @returns {boolean} `true` if the node is a reference to a global variable. - */ - - - function isReferenceToGlobalVariable(node) { - const variable = globalScope.set.get(node.name); - return variable && variable.defs.length === 0 && variable.references.some(ref => ref.identifier === node); - } - /** - * Checks whether the given node represents a reference to a property of an object in an object literal expression. - * This allows to differentiate between a global variable that is allowed to be used as a reference, and the key - * of the expressed object (which shouldn't be allowed). - * @param {ASTNode} node `Identifier` node to check. - * @returns {boolean} `true` if the node is a property name of an object literal expression - */ - - - function isPropertyNameInObjectLiteral(node) { + function isAssignmentTarget(node) { const parent = node.parent; - return parent.type === "Property" && parent.parent.type === "ObjectExpression" && !parent.computed && parent.key === node; + + switch (parent.type) { + case "AssignmentExpression": + case "AssignmentPattern": + return parent.left === node; + + case "Property": + return parent.parent.type === "ObjectPattern" && parent.value === node; + + case "ArrayPattern": + case "RestElement": + return true; + + default: + return false; + } + } + /** + * Checks if a given binding identifier uses the original name as-is. + * - If it's in object destructuring, the original name is its property name. + * - If it's in import declaration, the original name is its exported name. + * @param {ASTNode} node The `Identifier` node to check. + * @returns {boolean} `true` if the identifier uses the original name as-is. + */ + + + function equalsToOriginalName(node) { + const localName = node.name; + const valueNode = node.parent.type === "AssignmentPattern" ? node.parent : node; + const parent = valueNode.parent; + + switch (parent.type) { + case "Property": + return parent.parent.type === "ObjectPattern" && parent.value === valueNode && !parent.computed && parent.key.type === "Identifier" && parent.key.name === localName; + + case "ImportSpecifier": + return parent.local === node && parent.imported.name === localName; + + default: + return false; + } } /** * Reports an AST node as a rule violation. @@ -61745,109 +63621,188 @@ module.exports = { function report(node) { - if (!reported.includes(node)) { - reported.push(node); - context.report({ - node, - messageId: "notCamelCase", - data: { - name: node.name - } - }); + if (reported.has(node.range[0])) { + return; } + + reported.add(node.range[0]); // Report it. + + context.report({ + node, + messageId: node.type === "PrivateIdentifier" ? "notCamelCasePrivate" : "notCamelCase", + data: { + name: node.name + } + }); + } + /** + * Reports an identifier reference or a binding identifier. + * @param {ASTNode} node The `Identifier` node to report. + * @returns {void} + */ + + + function reportReferenceId(node) { + /* + * For backward compatibility, if it's in callings then ignore it. + * Not sure why it is. + */ + if (node.parent.type === "CallExpression" || node.parent.type === "NewExpression") { + return; + } + /* + * For backward compatibility, if it's a default value of + * destructuring/parameters then ignore it. + * Not sure why it is. + */ + + + if (node.parent.type === "AssignmentPattern" && node.parent.right === node) { + return; + } + /* + * The `ignoreDestructuring` flag skips the identifiers that uses + * the property name as-is. + */ + + + if (ignoreDestructuring && equalsToOriginalName(node)) { + return; + } + + report(node); } return { + // Report camelcase of global variable references ------------------ Program() { - globalScope = context.getScope(); - }, + const scope = context.getScope(); - Identifier(node) { - /* - * Leading and trailing underscores are commonly used to flag - * private/protected identifiers, strip them before checking if underscored - */ - const name = node.name, - nameIsUnderscored = isUnderscored(name.replace(/^_+|_+$/gu, "")), - effectiveParent = node.parent.type === "MemberExpression" ? node.parent.parent : node.parent; // First, we ignore the node if it match the ignore list + if (!ignoreGlobals) { + // Defined globals in config files or directive comments. + for (const variable of scope.variables) { + if (variable.identifiers.length > 0 || isGoodName(variable.name)) { + continue; + } - if (isAllowed(name)) { - return; - } // Check if it's a global variable + for (const reference of variable.references) { + /* + * For backward compatibility, this rule reports read-only + * references as well. + */ + reportReferenceId(reference.identifier); + } + } + } // Undefined globals. - if (ignoreGlobals && isReferenceToGlobalVariable(node) && !isPropertyNameInObjectLiteral(node)) { - return; - } // MemberExpressions get special rules + for (const reference of scope.through) { + const id = reference.identifier; - - if (node.parent.type === "MemberExpression") { - // "never" check properties - if (properties === "never") { - return; - } // Always report underscored object names - - - if (node.parent.object.type === "Identifier" && node.parent.object.name === node.name && nameIsUnderscored) { - report(node); // Report AssignmentExpressions only if they are the left side of the assignment - } else if (effectiveParent.type === "AssignmentExpression" && nameIsUnderscored && (effectiveParent.right.type !== "MemberExpression" || effectiveParent.left.type === "MemberExpression" && effectiveParent.left.property.name === node.name)) { - report(node); - } else if (isAssignmentTargetPropertyInDestructuring(node) && nameIsUnderscored) { - report(node); + if (isGoodName(id.name)) { + continue; } /* - * Properties have their own rules, and - * AssignmentPattern nodes can be treated like Properties: - * e.g.: const { no_camelcased = false } = bar; + * For backward compatibility, this rule reports read-only + * references as well. */ - } else if (node.parent.type === "Property" || node.parent.type === "AssignmentPattern") { - if (node.parent.parent && node.parent.parent.type === "ObjectPattern") { - if (node.parent.shorthand && node.parent.value.left && nameIsUnderscored) { - report(node); - } - const assignmentKeyEqualsValue = node.parent.key.name === node.parent.value.name; - - if (nameIsUnderscored && node.parent.computed) { - report(node); - } // prevent checking righthand side of destructured object - - - if (node.parent.key === node && node.parent.value !== node) { - return; - } - - const valueIsUnderscored = node.parent.value.name && nameIsUnderscored; // ignore destructuring if the option is set, unless a new identifier is created - - if (valueIsUnderscored && !(assignmentKeyEqualsValue && ignoreDestructuring)) { - report(node); - } - } // "never" check properties or always ignore destructuring - - - if (properties === "never" || ignoreDestructuring && isInsideObjectPattern(node)) { - return; - } // don't check right hand side of AssignmentExpression to prevent duplicate warnings - - - if (nameIsUnderscored && !ALLOWED_PARENT_TYPES.has(effectiveParent.type) && !(node.parent.right === node)) { - report(node); - } // Check if it's an import specifier - - } else if (["ImportSpecifier", "ImportNamespaceSpecifier", "ImportDefaultSpecifier"].includes(node.parent.type)) { - if (node.parent.type === "ImportSpecifier" && ignoreImports) { - return; - } // Report only if the local imported identifier is underscored - - - if (node.parent.local && node.parent.local.name === node.name && nameIsUnderscored) { - report(node); - } // Report anything that is underscored that isn't a CallExpression - - } else if (nameIsUnderscored && !ALLOWED_PARENT_TYPES.has(effectiveParent.type)) { - report(node); + reportReferenceId(id); } + }, + + // Report camelcase of declared variables -------------------------- + [["VariableDeclaration", "FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression", "ClassDeclaration", "ClassExpression", "CatchClause"]](node) { + for (const variable of context.getDeclaredVariables(node)) { + if (isGoodName(variable.name)) { + continue; + } + + const id = variable.identifiers[0]; // Report declaration. + + if (!(ignoreDestructuring && equalsToOriginalName(id))) { + report(id); + } + /* + * For backward compatibility, report references as well. + * It looks unnecessary because declarations are reported. + */ + + + for (const reference of variable.references) { + if (reference.init) { + continue; // Skip the write references of initializers. + } + + reportReferenceId(reference.identifier); + } + } + }, + + // Report camelcase in properties ---------------------------------- + [["ObjectExpression > Property[computed!=true] > Identifier.key", "MethodDefinition[computed!=true] > Identifier.key", "PropertyDefinition[computed!=true] > Identifier.key", "MethodDefinition > PrivateIdentifier.key", "PropertyDefinition > PrivateIdentifier.key"]](node) { + if (properties === "never" || isGoodName(node.name)) { + return; + } + + report(node); + }, + + "MemberExpression[computed!=true] > Identifier.property"(node) { + if (properties === "never" || !isAssignmentTarget(node.parent) || // ← ignore read-only references. + isGoodName(node.name)) { + return; + } + + report(node); + }, + + // Report camelcase in import -------------------------------------- + ImportDeclaration(node) { + for (const variable of context.getDeclaredVariables(node)) { + if (isGoodName(variable.name)) { + continue; + } + + const id = variable.identifiers[0]; // Report declaration. + + if (!(ignoreImports && equalsToOriginalName(id))) { + report(id); + } + /* + * For backward compatibility, report references as well. + * It looks unnecessary because declarations are reported. + */ + + + for (const reference of variable.references) { + reportReferenceId(reference.identifier); + } + } + }, + + // Report camelcase in re-export ----------------------------------- + [["ExportAllDeclaration > Identifier.exported", "ExportSpecifier > Identifier.exported"]](node) { + if (isGoodName(node.name)) { + return; + } + + report(node); + }, + + // Report camelcase in labels -------------------------------------- + [["LabeledStatement > Identifier.label", + /* + * For backward compatibility, report references as well. + * It looks unnecessary because declarations are reported. + */ + "BreakStatement > Identifier.label", "ContinueStatement > Identifier.label"]](node) { + if (isGoodName(node.name)) { + return; + } + + report(node); } }; @@ -61870,7 +63825,7 @@ module.exports = { const LETTER_PATTERN = __webpack_require__(566); -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -61930,7 +63885,8 @@ function getNormalizedOptions(rawOptions, which) { */ -function getAllNormalizedOptions(rawOptions = {}) { +function getAllNormalizedOptions() { + let rawOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; return { Line: getNormalizedOptions(rawOptions, "line"), Block: getNormalizedOptions(rawOptions, "block") @@ -61951,7 +63907,7 @@ function createRegExpForIgnorePatterns(normalizedOptions) { const ignorePatternStr = normalizedOptions[key].ignorePattern; if (ignorePatternStr) { - const regExp = RegExp(`^\\s*(?:${ignorePatternStr})`, "u"); + const regExp = RegExp("^\\s*(?:".concat(ignorePatternStr, ")"), "u"); normalizedOptions[key].ignorePatternRegExp = regExp; } }); @@ -61965,7 +63921,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce or disallow capitalization of the first letter of a comment", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/capitalized-comments" }, @@ -62195,7 +64150,7 @@ module.exports = /[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\ // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -62205,7 +64160,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce that class methods utilize `this`", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/class-methods-use-this" }, @@ -62217,6 +64171,10 @@ module.exports = { items: { type: "string" } + }, + enforceForClassFields: { + type: "boolean", + default: true } }, additionalProperties: false @@ -62228,8 +64186,26 @@ module.exports = { create(context) { const config = Object.assign({}, context.options[0]); + const enforceForClassFields = config.enforceForClassFields !== false; const exceptMethods = new Set(config.exceptMethods || []); const stack = []; + /** + * Push `this` used flag initialized with `false` onto the stack. + * @returns {void} + */ + + function pushContext() { + stack.push(false); + } + /** + * Pop `this` used flag from the stack. + * @returns {boolean | undefined} `this` used flag + */ + + + function popContext() { + return stack.pop(); + } /** * Initializes the current context to false and pushes it onto the stack. * These booleans represent whether 'this' has been used in the context. @@ -62237,8 +64213,9 @@ module.exports = { * @private */ + function enterFunction() { - stack.push(false); + pushContext(); } /** * Check if the node is an instance method @@ -62249,7 +64226,16 @@ module.exports = { function isInstanceMethod(node) { - return !node.static && node.kind !== "constructor" && node.type === "MethodDefinition"; + switch (node.type) { + case "MethodDefinition": + return !node.static && node.kind !== "constructor"; + + case "PropertyDefinition": + return !node.static && enforceForClassFields; + + default: + return false; + } } /** * Check if the node is an instance method not excluded by config @@ -62260,7 +64246,17 @@ module.exports = { function isIncludedInstanceMethod(node) { - return isInstanceMethod(node) && (node.computed || !exceptMethods.has(node.key.name)); + if (isInstanceMethod(node)) { + if (node.computed) { + return true; + } + + const hashIfNeeded = node.key.type === "PrivateIdentifier" ? "#" : ""; + const name = node.key.type === "Literal" ? astUtils.getStaticStringValue(node.key) : node.key.name || ""; + return !exceptMethods.has(hashIfNeeded + name); + } + + return false; } /** * Checks if we are leaving a function that is a method, and reports if 'this' has not been used. @@ -62273,11 +64269,12 @@ module.exports = { function exitFunction(node) { - const methodUsesThis = stack.pop(); + const methodUsesThis = popContext(); if (isIncludedInstanceMethod(node.parent) && !methodUsesThis) { context.report({ node, + loc: astUtils.getFunctionHeadLoc(node, context.getSourceCode()), messageId: "missingThis", data: { name: astUtils.getFunctionNameWithKind(node) @@ -62303,8 +64300,27 @@ module.exports = { "FunctionDeclaration:exit": exitFunction, FunctionExpression: enterFunction, "FunctionExpression:exit": exitFunction, + + /* + * Class field value are implicit functions. + */ + "PropertyDefinition > *.key:exit": pushContext, + "PropertyDefinition:exit": popContext, + + /* + * Class static blocks are implicit functions. They aren't required to use `this`, + * but we have to push context so that it captures any use of `this` in the static block + * separately from enclosing contexts, because static blocks have their own `this` and it + * shouldn't count as used `this` in enclosing contexts. + */ + StaticBlock: pushContext, + "StaticBlock:exit": popContext, ThisExpression: markThisUsed, - Super: markThisUsed + Super: markThisUsed, + ...(enforceForClassFields && { + "PropertyDefinition > ArrowFunctionExpression.value": enterFunction, + "PropertyDefinition > ArrowFunctionExpression.value:exit": exitFunction + }) }; } @@ -62323,7 +64339,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -62385,7 +64401,6 @@ module.exports = { type: "layout", docs: { description: "require or disallow trailing commas", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/comma-dangle" }, @@ -62424,7 +64439,8 @@ module.exports = { }, additionalProperties: false }] - }] + }], + additionalItems: false }, messages: { unexpected: "Unexpected trailing comma.", @@ -62671,7 +64687,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -62681,7 +64697,6 @@ module.exports = { type: "layout", docs: { description: "enforce consistent spacing before and after commas", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/comma-spacing" }, @@ -62857,7 +64872,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -62867,7 +64882,6 @@ module.exports = { type: "layout", docs: { description: "enforce consistent comma style", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/comma-style" }, @@ -62929,13 +64943,13 @@ module.exports = { function getReplacedText(styleType, text) { switch (styleType) { case "between": - return `,${text.replace(astUtils.LINEBREAK_MATCHER, "")}`; + return ",".concat(text.replace(astUtils.LINEBREAK_MATCHER, "")); case "first": - return `${text},`; + return "".concat(text, ","); case "last": - return `,${text}`; + return ",".concat(text); default: return ""; @@ -63041,6 +65055,8 @@ module.exports = { if (item) { const tokenAfterItem = sourceCode.getTokenAfter(item, astUtils.isNotClosingParenToken); previousItemToken = tokenAfterItem ? sourceCode.getTokenBefore(tokenAfterItem) : sourceCode.ast.tokens[sourceCode.ast.tokens.length - 1]; + } else { + previousItemToken = currentItemToken; } }); /* @@ -63151,7 +65167,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); +const astUtils = __webpack_require__(548); const { upperCaseFirst @@ -63165,7 +65181,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce a maximum cyclomatic complexity allowed in a program", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/complexity" }, @@ -63204,80 +65219,30 @@ module.exports = { } //-------------------------------------------------------------------------- // Helpers //-------------------------------------------------------------------------- - // Using a stack to store complexity (handling nested functions) + // Using a stack to store complexity per code path - const fns = []; + const complexities = []; /** - * When parsing a new function, store it in our function stack + * Increase the complexity of the code path in context * @returns {void} * @private */ - function startFunction() { - fns.push(1); - } - /** - * Evaluate the node at the end of function - * @param {ASTNode} node node to evaluate - * @returns {void} - * @private - */ - - - function endFunction(node) { - const name = upperCaseFirst(astUtils.getFunctionNameWithKind(node)); - const complexity = fns.pop(); - - if (complexity > THRESHOLD) { - context.report({ - node, - messageId: "complex", - data: { - name, - complexity, - max: THRESHOLD - } - }); - } - } - /** - * Increase the complexity of the function in context - * @returns {void} - * @private - */ - - function increaseComplexity() { - if (fns.length) { - fns[fns.length - 1]++; - } - } - /** - * Increase the switch complexity in context - * @param {ASTNode} node node to evaluate - * @returns {void} - * @private - */ - - - function increaseSwitchComplexity(node) { - // Avoiding `default` - if (node.test) { - increaseComplexity(); - } + complexities[complexities.length - 1]++; } //-------------------------------------------------------------------------- // Public API //-------------------------------------------------------------------------- return { - FunctionDeclaration: startFunction, - FunctionExpression: startFunction, - ArrowFunctionExpression: startFunction, - "FunctionDeclaration:exit": endFunction, - "FunctionExpression:exit": endFunction, - "ArrowFunctionExpression:exit": endFunction, + onCodePathStart() { + // The initial complexity is 1, representing one execution path in the CodePath + complexities.push(1); + }, + + // Each branching in the code adds 1 to the complexity CatchClause: increaseComplexity, ConditionalExpression: increaseComplexity, LogicalExpression: increaseComplexity, @@ -63285,14 +65250,52 @@ module.exports = { ForInStatement: increaseComplexity, ForOfStatement: increaseComplexity, IfStatement: increaseComplexity, - SwitchCase: increaseSwitchComplexity, WhileStatement: increaseComplexity, DoWhileStatement: increaseComplexity, + // Avoid `default` + "SwitchCase[test]": increaseComplexity, + // Logical assignment operators have short-circuiting behavior AssignmentExpression(node) { if (astUtils.isLogicalAssignmentOperator(node.operator)) { increaseComplexity(); } + }, + + onCodePathEnd(codePath, node) { + const complexity = complexities.pop(); + /* + * This rule only evaluates complexity of functions, so "program" is excluded. + * Class field initializers and class static blocks are implicit functions. Therefore, + * they shouldn't contribute to the enclosing function's complexity, but their + * own complexity should be evaluated. + */ + + if (codePath.origin !== "function" && codePath.origin !== "class-field-initializer" && codePath.origin !== "class-static-block") { + return; + } + + if (complexity > THRESHOLD) { + let name; + + if (codePath.origin === "class-field-initializer") { + name = "class field initializer"; + } else if (codePath.origin === "class-static-block") { + name = "class static block"; + } else { + name = astUtils.getFunctionNameWithKind(node); + } + + context.report({ + node, + messageId: "complex", + data: { + name: upperCaseFirst(name), + complexity, + max: THRESHOLD + } + }); + } } }; @@ -63339,7 +65342,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -63349,7 +65352,6 @@ module.exports = { type: "layout", docs: { description: "enforce consistent spacing inside computed property brackets", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/computed-property-spacing" }, @@ -63540,7 +65542,7 @@ module.exports = { }; if (enforceForClassMembers) { - listeners.MethodDefinition = checkSpacing("key"); + listeners.MethodDefinition = listeners.PropertyDefinition = listeners.Property; } return listeners; @@ -63561,7 +65563,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); +const astUtils = __webpack_require__(548); const { upperCaseFirst @@ -63598,7 +65600,6 @@ module.exports = { type: "suggestion", docs: { description: "require `return` statements to either always or never specify values", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/consistent-return" }, @@ -63651,13 +65652,13 @@ module.exports = { name = "program"; } else if (node.type === "ArrowFunctionExpression") { // `=>` token - loc = context.getSourceCode().getTokenBefore(node.body, astUtils.isArrowToken).loc.start; + loc = context.getSourceCode().getTokenBefore(node.body, astUtils.isArrowToken).loc; } else if (node.parent.type === "MethodDefinition" || node.parent.type === "Property" && node.parent.method) { // Method name. - loc = node.parent.key.loc.start; + loc = node.parent.key.loc; } else { // Function name or `function` keyword. - loc = (node.id || node).loc.start; + loc = (node.id || context.getSourceCode().getFirstToken(node)).loc; } if (!name) { @@ -63745,7 +65746,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce consistent naming when capturing the current execution context", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/consistent-this" }, @@ -63775,7 +65775,7 @@ module.exports = { * Reports that a variable declarator or assignment expression is assigning * a non-'this' value to the specified alias. * @param {ASTNode} node The assigning node. - * @param {string} name the name of the alias that was incorrectly used. + * @param {string} name the name of the alias that was incorrectly used. * @returns {void} */ @@ -64003,7 +66003,6 @@ module.exports = { type: "problem", docs: { description: "require `super()` calls in constructors", - category: "ECMAScript 6", recommended: true, url: "https://eslint.org/docs/rules/constructor-super" }, @@ -64299,7 +66298,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -64309,7 +66308,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce consistent brace style for all control statements", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/curly" }, @@ -64406,16 +66404,6 @@ module.exports = { function isElseKeywordToken(token) { return token.value === "else" && token.type === "Keyword"; } - /** - * Gets the `else` keyword token of a given `IfStatement` node. - * @param {ASTNode} node A `IfStatement` node to get. - * @returns {Token} The `else` keyword token. - */ - - - function getElseKeyword(node) { - return node.alternate && sourceCode.getFirstTokenBetween(node.consequent, node.alternate, isElseKeywordToken); - } /** * Determines whether the given node has an `else` keyword token as the first token after. * @param {ASTNode} node The node to check. @@ -64634,17 +66622,17 @@ module.exports = { if (this.expected) { context.report({ node, - loc: (name !== "else" ? node : getElseKeyword(node)).loc.start, + loc: body.loc, messageId: opts && opts.condition ? "missingCurlyAfterCondition" : "missingCurlyAfter", data: { name }, - fix: fixer => fixer.replaceText(body, `{${sourceCode.getText(body)}}`) + fix: fixer => fixer.replaceText(body, "{".concat(sourceCode.getText(body), "}")) }); } else { context.report({ node, - loc: (name !== "else" ? node : getElseKeyword(node)).loc.start, + loc: body.loc, messageId: opts && opts.condition ? "unexpectedCurlyAfterCondition" : "unexpectedCurlyAfter", data: { name @@ -64790,7 +66778,6 @@ module.exports = { type: "suggestion", docs: { description: "require `default` cases in `switch` statements", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/default-case" }, @@ -64817,8 +66804,8 @@ module.exports = { /** * Shortcut to get last element of array - * @param {*[]} collection Array - * @returns {*} Last element + * @param {*[]} collection Array + * @returns {any} Last element */ function last(collection) { @@ -64881,7 +66868,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce default clauses in switch statements to be last", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/default-case-last" }, @@ -64927,7 +66913,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce default parameters to be last", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/default-param-last" }, @@ -64938,9 +66923,8 @@ module.exports = { }, create(context) { - // eslint-disable-next-line jsdoc/require-description - /** + * Handler for function contexts. * @param {ASTNode} node function node * @returns {void} */ @@ -64984,7 +66968,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -64994,7 +66978,6 @@ module.exports = { type: "layout", docs: { description: "enforce consistent newlines before and after dots", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/dot-location" }, @@ -65035,7 +67018,7 @@ module.exports = { *fix(fixer) { if (dotToken.value.startsWith(".") && astUtils.isDecimalIntegerNumericToken(tokenBeforeDot)) { - yield fixer.insertTextAfter(tokenBeforeDot, ` ${dotToken.value}`); + yield fixer.insertTextAfter(tokenBeforeDot, " ".concat(dotToken.value)); } else { yield fixer.insertTextAfter(tokenBeforeDot, dotToken.value); } @@ -65092,7 +67075,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); +const astUtils = __webpack_require__(548); const keywords = __webpack_require__(583); //------------------------------------------------------------------------------ // Rule Definition @@ -65107,7 +67090,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce dot notation whenever possible", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/dot-notation" }, @@ -65151,7 +67133,7 @@ module.exports = { function checkComputedProperty(node, value) { if (validIdentifier.test(value) && (allowKeywords || keywords.indexOf(String(value)) === -1) && !(allowPattern && allowPattern.test(value))) { - const formattedValue = node.property.type === "Literal" ? JSON.stringify(value) : `\`${value}\``; + const formattedValue = node.property.type === "Literal" ? JSON.stringify(value) : "`".concat(value, "`"); context.report({ node: node.property, messageId: "useDot", @@ -65165,7 +67147,7 @@ module.exports = { const nextToken = sourceCode.getTokenAfter(node); // Don't perform any fixes if there are comments inside the brackets. if (sourceCode.commentsExistBetween(leftBracket, rightBracket)) { - return; // eslint-disable-line eslint-plugin/fixer-return -- false positive + return; } // Replace the brackets by an identifier. @@ -65194,7 +67176,7 @@ module.exports = { checkComputedProperty(node, node.property.quasis[0].value.cooked); } - if (!allowKeywords && !node.computed && keywords.indexOf(String(node.property.name)) !== -1) { + if (!allowKeywords && !node.computed && node.property.type === "Identifier" && keywords.indexOf(String(node.property.name)) !== -1) { context.report({ node: node.property, messageId: "useBrackets", @@ -65206,12 +67188,12 @@ module.exports = { const dotToken = sourceCode.getTokenBefore(node.property); // A statement that starts with `let[` is parsed as a destructuring variable declaration, not a MemberExpression. if (node.object.type === "Identifier" && node.object.name === "let" && !node.optional) { - return; // eslint-disable-line eslint-plugin/fixer-return -- false positive + return; } // Don't perform any fixes if there are comments between the dot and the property name. if (sourceCode.commentsExistBetween(dotToken, node.property)) { - return; // eslint-disable-line eslint-plugin/fixer-return -- false positive + return; } // Replace the identifier to brackets. @@ -65219,7 +67201,7 @@ module.exports = { yield fixer.remove(dotToken); } - yield fixer.replaceText(node.property, `["${node.property.name}"]`); + yield fixer.replaceText(node.property, "[\"".concat(node.property.name, "\"]")); } }); @@ -65262,7 +67244,6 @@ module.exports = { type: "layout", docs: { description: "require or disallow newline at the end of files", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/eol-last" }, @@ -65290,7 +67271,7 @@ module.exports = { line: sourceCode.lines.length }, LF = "\n", - CRLF = `\r${LF}`, + CRLF = "\r".concat(LF), endsWithNewline = src.endsWith(LF); /* * Empty source is always valid: No content in file so we don't @@ -65328,10 +67309,20 @@ module.exports = { }); } else if (mode === "never" && endsWithNewline) { - // File is newline-terminated, but shouldn't be + const secondLastLine = sourceCode.lines[sourceCode.lines.length - 2]; // File is newline-terminated, but shouldn't be + context.report({ node, - loc: location, + loc: { + start: { + line: sourceCode.lines.length - 1, + column: secondLastLine.length + }, + end: { + line: sourceCode.lines.length, + column: 0 + } + }, messageId: "unexpected", fix(fixer) { @@ -65363,7 +67354,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -65373,7 +67364,6 @@ module.exports = { type: "suggestion", docs: { description: "require the use of `===` and `!==`", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/eqeqeq" }, @@ -65415,7 +67405,7 @@ module.exports = { const enforceInverseRuleForNull = nullOption === "never"; /** * Checks if an expression is a typeof expression - * @param {ASTNode} node The node to check + * @param {ASTNode} node The node to check * @returns {boolean} if the node is a typeof expression */ @@ -65507,7 +67497,7 @@ module.exports = { return; } - report(node, `${node.operator}=`); + report(node, "".concat(node.operator, "=")); } }; @@ -65533,7 +67523,6 @@ module.exports = { type: "problem", docs: { description: "enforce \"for\" loop update clause moving the counter in the right direction.", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/for-direction" }, @@ -65662,7 +67651,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -65672,7 +67661,6 @@ module.exports = { type: "layout", docs: { description: "require or disallow spacing between function identifiers and their invocations", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/func-call-spacing" }, @@ -65888,9 +67876,9 @@ module.exports = { // Requirements //-------------------------------------------------------------------------- -const astUtils = __webpack_require__(547); +const astUtils = __webpack_require__(548); -const esutils = __webpack_require__(548); //-------------------------------------------------------------------------- +const esutils = __webpack_require__(549); //-------------------------------------------------------------------------- // Helpers //-------------------------------------------------------------------------- @@ -65955,7 +67943,6 @@ module.exports = { type: "suggestion", docs: { description: "require function names to match the name of the variable or property to which they are assigned", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/func-name-matching" }, @@ -66075,21 +68062,21 @@ module.exports = { const isProp = node.left.type === "MemberExpression"; const name = isProp ? astUtils.getStaticPropertyName(node.left) : node.left.name; - if (node.right.id && isIdentifier(name) && shouldWarn(name, node.right.id.name)) { + if (node.right.id && name && isIdentifier(name) && shouldWarn(name, node.right.id.name)) { report(node, name, node.right.id.name, isProp); } }, - Property(node) { - if (node.value.type !== "FunctionExpression" || !node.value.id || node.computed && !isStringLiteral(node.key)) { + "Property, PropertyDefinition[value]"(node) { + if (!(node.value.type === "FunctionExpression" && node.value.id)) { return; } - if (node.key.type === "Identifier") { + if (node.key.type === "Identifier" && !node.computed) { const functionName = node.value.id.name; let propertyName = node.key.name; - if (considerPropertyDescriptor && propertyName === "value") { + if (considerPropertyDescriptor && propertyName === "value" && node.parent.type === "ObjectExpression") { if (isPropertyCall("Object", "defineProperty", node.parent.parent) || isPropertyCall("Reflect", "defineProperty", node.parent.parent)) { const property = node.parent.parent.arguments[1]; @@ -66141,7 +68128,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); +const astUtils = __webpack_require__(548); /** * Checks whether or not a given variable is a function name. * @param {eslint-scope.Variable} variable A variable to check. @@ -66161,7 +68148,6 @@ module.exports = { type: "suggestion", docs: { description: "require or disallow named `function` expressions", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/func-names" }, @@ -66226,7 +68212,7 @@ module.exports = { function hasInferredName(node) { const parent = node.parent; - return isObjectOrClassMethod(node) || parent.type === "VariableDeclarator" && parent.id.type === "Identifier" && parent.init === node || parent.type === "Property" && parent.value === node || parent.type === "AssignmentExpression" && parent.left.type === "Identifier" && parent.right === node || parent.type === "AssignmentPattern" && parent.left.type === "Identifier" && parent.right === node; + return isObjectOrClassMethod(node) || parent.type === "VariableDeclarator" && parent.id.type === "Identifier" && parent.init === node || parent.type === "Property" && parent.value === node || parent.type === "PropertyDefinition" && parent.value === node || parent.type === "AssignmentExpression" && parent.left.type === "Identifier" && parent.right === node || parent.type === "AssignmentPattern" && parent.left.type === "Identifier" && parent.right === node; } /** * Reports that an unnamed function should be named @@ -66321,7 +68307,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce the consistent use of either `function` declarations or expressions", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/func-style" }, @@ -66427,7 +68412,6 @@ module.exports = { type: "layout", docs: { description: "enforce line breaks between arguments of a function call", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/function-call-argument-newline" }, @@ -66537,7 +68521,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -66547,7 +68531,6 @@ module.exports = { type: "layout", docs: { description: "enforce consistent line breaks inside function parentheses", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/function-paren-newline" }, @@ -66704,6 +68687,7 @@ module.exports = { /** * Gets the left paren and right paren tokens of a node. * @param {ASTNode} node The node with parens + * @throws {TypeError} Unexecpted node type. * @returns {Object} An object with keys `leftParen` for the left paren token, and `rightParen` for the right paren token. * Can also return `null` if an expression has no parens (e.g. a NewExpression with no arguments, or an ArrowFunctionExpression * with a single parameter) @@ -66767,7 +68751,7 @@ module.exports = { } default: - throw new TypeError(`unexpected node with type ${node.type}`); + throw new TypeError("unexpected node with type ".concat(node.type)); } } //---------------------------------------------------------------------- // Public @@ -66835,7 +68819,6 @@ module.exports = { type: "layout", docs: { description: "enforce consistent spacing around `*` operators in generator functions", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/generator-star-spacing" }, @@ -66957,7 +68940,7 @@ module.exports = { const after = leftToken.value === "*"; const spaceRequired = modes[kind][side]; const node = after ? leftToken : rightToken; - const messageId = `${spaceRequired ? "missing" : "unexpected"}${capitalize(side)}`; + const messageId = "".concat(spaceRequired ? "missing" : "unexpected").concat(capitalize(side)); context.report({ node, messageId, @@ -67029,7 +69012,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -67053,7 +69036,6 @@ module.exports = { type: "problem", docs: { description: "enforce `return` statements in getters", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/getter-return" }, @@ -67189,6 +69171,7 @@ module.exports = { /** * @fileoverview Rule for disallowing require() outside of the top-level module context * @author Jamund Ferguson + * @deprecated in ESLint v7.0.0 */ @@ -67230,7 +69213,6 @@ module.exports = { type: "suggestion", docs: { description: "require `require()` calls to be placed at top-level module scope", - category: "Node.js and CommonJS", recommended: false, url: "https://eslint.org/docs/rules/global-require" }, @@ -67275,7 +69257,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Typedefs //------------------------------------------------------------------------------ @@ -67360,7 +69342,6 @@ module.exports = { type: "suggestion", docs: { description: "require grouped accessor pairs in object literals and classes", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/grouped-accessor-pairs" }, @@ -67501,7 +69482,6 @@ module.exports = { type: "suggestion", docs: { description: "require `for-in` loops to include an `if` statement", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/guard-for-in" }, @@ -67568,6 +69548,7 @@ module.exports = { /** * @fileoverview Ensure handling of errors when we know they exist. * @author Jamund Ferguson + * @deprecated in ESLint v7.0.0 */ //------------------------------------------------------------------------------ // Rule Definition @@ -67580,7 +69561,6 @@ module.exports = { type: "suggestion", docs: { description: "require error handling in callbacks", - category: "Node.js and CommonJS", recommended: false, url: "https://eslint.org/docs/rules/handle-callback-err" }, @@ -67669,6 +69649,7 @@ module.exports = { * @fileoverview Rule that warns when identifier names that are * specified in the configuration are used. * @author Keith Cirkel (http://keithcirkel.co.uk) + * @deprecated in ESLint v7.5.0 */ //------------------------------------------------------------------------------ // Helpers @@ -67739,7 +69720,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow specified identifiers", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/id-blacklist" }, @@ -67811,7 +69791,16 @@ module.exports = { function report(node) { - if (!reportedNodes.has(node)) { + /* + * We used the range instead of the node because it's possible + * for the same identifier to be represented by two different + * nodes, with the most clear example being shorthand properties: + * { foo } + * In this case, "foo" is represented by one node for the name + * and one for the value. The only way to know they are the same + * is to look at the range. + */ + if (!reportedNodes.has(node.range.toString())) { context.report({ node, messageId: "restricted", @@ -67819,7 +69808,7 @@ module.exports = { name: node.name } }); - reportedNodes.add(node); + reportedNodes.add(node.range.toString()); } } @@ -67883,29 +69872,18 @@ function isRenamedImport(node) { parent.local !== parent.exported && parent.local === node; } /** - * Checks whether the given node is a renamed identifier node in an ObjectPattern destructuring. + * Checks whether the given node is an ObjectPattern destructuring. * * Examples: - * const { a : b } = foo; // node `a` is renamed node. + * const { a : b } = foo; * @param {ASTNode} node `Identifier` node to check. - * @returns {boolean} `true` if the node is a renamed node in an ObjectPattern destructuring. + * @returns {boolean} `true` if the node is in an ObjectPattern destructuring. */ -function isRenamedInDestructuring(node) { +function isPropertyNameInDestructuring(node) { const parent = node.parent; - return !parent.computed && parent.type === "Property" && parent.parent.type === "ObjectPattern" && parent.value !== node && parent.key === node; -} -/** - * Checks whether the given node represents shorthand definition of a property in an object literal. - * @param {ASTNode} node `Identifier` node to check. - * @returns {boolean} `true` if the node is a shorthand property definition. - */ - - -function isShorthandPropertyDefinition(node) { - const parent = node.parent; - return parent.type === "Property" && parent.parent.type === "ObjectExpression" && parent.shorthand; + return !parent.computed && parent.type === "Property" && parent.parent.type === "ObjectPattern" && parent.key === node; } //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -67916,7 +69894,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow specified identifiers", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/id-denylist" }, @@ -67928,7 +69905,8 @@ module.exports = { uniqueItems: true }, messages: { - restricted: "Identifier '{{name}}' is restricted." + restricted: "Identifier '{{name}}' is restricted.", + restrictedPrivate: "Identifier '#{{name}}' is restricted." } }, @@ -67977,7 +69955,7 @@ module.exports = { return isAssignmentTarget(parent); } - return parent.type !== "CallExpression" && parent.type !== "NewExpression" && !isRenamedImport(node) && !isRenamedInDestructuring(node) && !(isReferenceToGlobalVariable(node) && !isShorthandPropertyDefinition(node)); + return parent.type !== "CallExpression" && parent.type !== "NewExpression" && !isRenamedImport(node) && !isPropertyNameInDestructuring(node) && !isReferenceToGlobalVariable(node); } /** * Reports an AST node as a rule violation. @@ -67988,15 +69966,25 @@ module.exports = { function report(node) { - if (!reportedNodes.has(node)) { + /* + * We used the range instead of the node because it's possible + * for the same identifier to be represented by two different + * nodes, with the most clear example being shorthand properties: + * { foo } + * In this case, "foo" is represented by one node for the name + * and one for the value. The only way to know they are the same + * is to look at the range. + */ + if (!reportedNodes.has(node.range.toString())) { + const isPrivate = node.type === "PrivateIdentifier"; context.report({ node, - messageId: "restricted", + messageId: isPrivate ? "restrictedPrivate" : "restricted", data: { name: node.name } }); - reportedNodes.add(node); + reportedNodes.add(node.range.toString()); } } @@ -68005,7 +69993,7 @@ module.exports = { globalScope = context.getScope(); }, - Identifier(node) { + [["Identifier", "PrivateIdentifier"]](node) { if (isRestricted(node.name) && shouldCheck(node)) { report(node); } @@ -68035,7 +70023,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce minimum and maximum identifier lengths", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/id-length" }, @@ -68071,7 +70058,9 @@ module.exports = { }], messages: { tooShort: "Identifier name '{{name}}' is too short (< {{min}}).", - tooLong: "Identifier name '{{name}}' is too long (> {{max}})." + tooShortPrivate: "Identifier name '#{{name}}' is too short (< {{min}}).", + tooLong: "Identifier name '{{name}}' is too long (> {{max}}).", + tooLongPrivate: "Identifier name #'{{name}}' is too long (> {{max}})." } }, @@ -68082,7 +70071,7 @@ module.exports = { const properties = options.properties !== "never"; const exceptions = new Set(options.exceptions); const exceptionPatterns = (options.exceptionPatterns || []).map(pattern => new RegExp(pattern, "u")); - const reportedNode = new Set(); + const reportedNodes = new Set(); /** * Checks if a string matches the provided exception patterns * @param {string} name The string to check. @@ -68096,7 +70085,8 @@ module.exports = { const SUPPORTED_EXPRESSIONS = { MemberExpression: properties && function (parent) { - return !parent.computed && (parent.parent.left === parent && parent.parent.type === "AssignmentExpression" || // or the last identifier in an ObjectPattern destructuring + return !parent.computed && ( // regular property assignment + parent.parent.left === parent && parent.parent.type === "AssignmentExpression" || // or the last identifier in an ObjectPattern destructuring parent.parent.type === "Property" && parent.parent.value === parent && parent.parent.parent.type === "ObjectPattern" && parent.parent.parent.parent.left === parent.parent.parent); }, @@ -68110,10 +70100,11 @@ module.exports = { Property(parent, node) { if (parent.parent.type === "ObjectPattern") { - return parent.value !== parent.key && parent.value === node || parent.value === parent.key && parent.key === node && properties; + const isKeyAndValueSame = parent.value.name === parent.key.name; + return !isKeyAndValueSame && parent.value === node || isKeyAndValueSame && parent.key === node && properties; } - return properties && !parent.computed && parent.key === node; + return properties && !parent.computed && parent.key.name === node.name; }, ImportDefaultSpecifier: true, @@ -68123,11 +70114,12 @@ module.exports = { ClassDeclaration: true, FunctionDeclaration: true, MethodDefinition: true, + PropertyDefinition: true, CatchClause: true, ArrayPattern: true }; return { - Identifier(node) { + [["Identifier", "PrivateIdentifier"]](node) { const name = node.name; const parent = node.parent; const isShort = name.length < minLength; @@ -68138,12 +70130,27 @@ module.exports = { } const isValidExpression = SUPPORTED_EXPRESSIONS[parent.type]; + /* + * We used the range instead of the node because it's possible + * for the same identifier to be represented by two different + * nodes, with the most clear example being shorthand properties: + * { foo } + * In this case, "foo" is represented by one node for the name + * and one for the value. The only way to know they are the same + * is to look at the range. + */ + + if (isValidExpression && !reportedNodes.has(node.range.toString()) && (isValidExpression === true || isValidExpression(parent, node))) { + reportedNodes.add(node.range.toString()); + let messageId = isShort ? "tooShort" : "tooLong"; + + if (node.type === "PrivateIdentifier") { + messageId += "Private"; + } - if (isValidExpression && !reportedNode.has(node) && (isValidExpression === true || isValidExpression(parent, node))) { - reportedNode.add(node); context.report({ node, - messageId: isShort ? "tooShort" : "tooLong", + messageId, data: { name, min: minLength, @@ -68176,7 +70183,6 @@ module.exports = { type: "suggestion", docs: { description: "require identifiers to match a specified regular expression", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/id-match" }, @@ -68189,6 +70195,10 @@ module.exports = { type: "boolean", default: false }, + classFields: { + type: "boolean", + default: false + }, onlyDeclarations: { type: "boolean", default: false @@ -68201,7 +70211,8 @@ module.exports = { additionalProperties: false }], messages: { - notMatch: "Identifier '{{name}}' does not match the pattern '{{pattern}}'." + notMatch: "Identifier '{{name}}' does not match the pattern '{{pattern}}'.", + notMatchPrivate: "Identifier '#{{name}}' does not match the pattern '{{pattern}}'." } }, @@ -68212,14 +70223,15 @@ module.exports = { const pattern = context.options[0] || "^.+$", regexp = new RegExp(pattern, "u"); const options = context.options[1] || {}, - properties = !!options.properties, + checkProperties = !!options.properties, + checkClassFields = !!options.classFields, onlyDeclarations = !!options.onlyDeclarations, ignoreDestructuring = !!options.ignoreDestructuring; //-------------------------------------------------------------------------- // Helpers //-------------------------------------------------------------------------- // contains reported nodes to avoid reporting twice on destructuring with shorthand notation - const reported = new Map(); + const reportedNodes = new Set(); const ALLOWED_PARENT_TYPES = new Set(["CallExpression", "NewExpression"]); const DECLARATION_TYPES = new Set(["FunctionDeclaration", "VariableDeclarator"]); const IMPORT_TYPES = new Set(["ImportSpecifier", "ImportNamespaceSpecifier", "ImportDefaultSpecifier"]); @@ -68277,16 +70289,26 @@ module.exports = { function report(node) { - if (!reported.has(node)) { + /* + * We used the range instead of the node because it's possible + * for the same identifier to be represented by two different + * nodes, with the most clear example being shorthand properties: + * { foo } + * In this case, "foo" is represented by one node for the name + * and one for the value. The only way to know they are the same + * is to look at the range. + */ + if (!reportedNodes.has(node.range.toString())) { + const messageId = node.type === "PrivateIdentifier" ? "notMatchPrivate" : "notMatch"; context.report({ node, - messageId: "notMatch", + messageId, data: { name: node.name, pattern } }); - reported.set(node, true); + reportedNodes.add(node.range.toString()); } } @@ -68297,7 +70319,7 @@ module.exports = { effectiveParent = parent.type === "MemberExpression" ? parent.parent : parent; if (parent.type === "MemberExpression") { - if (!properties) { + if (!checkProperties) { return; } // Always check object names @@ -68325,7 +70347,7 @@ module.exports = { } else if (parent.type === "Property" || parent.type === "AssignmentPattern") { if (parent.parent && parent.parent.type === "ObjectPattern") { - if (parent.shorthand && parent.value.left && isInvalid(name)) { + if (!ignoreDestructuring && parent.shorthand && parent.value.left && isInvalid(name)) { report(node); } @@ -68343,7 +70365,7 @@ module.exports = { } // never check properties or always ignore destructuring - if (!properties || ignoreDestructuring && isInsideObjectPattern(node)) { + if (!checkProperties || ignoreDestructuring && isInsideObjectPattern(node)) { return; } // don't check right hand side of AssignmentExpression to prevent duplicate warnings @@ -68356,11 +70378,27 @@ module.exports = { // Report only if the local imported identifier is invalid if (parent.local && parent.local.name === node.name && isInvalid(name)) { report(node); + } + } else if (parent.type === "PropertyDefinition") { + if (checkClassFields && isInvalid(name)) { + report(node); } // Report anything that is invalid that isn't a CallExpression } else if (shouldReport(effectiveParent, name)) { report(node); } + }, + + "PrivateIdentifier"(node) { + const isClassField = node.parent.type === "PropertyDefinition"; + + if (isClassField && !checkClassFields) { + return; + } + + if (isInvalid(node.name)) { + report(node); + } } }; @@ -68382,7 +70420,7 @@ module.exports = { const { isCommentToken, isNotOpeningParenToken -} = __webpack_require__(547); //------------------------------------------------------------------------------ +} = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -68392,7 +70430,6 @@ module.exports = { type: "layout", docs: { description: "enforce the location of arrow function bodies", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/implicit-arrow-linebreak" }, @@ -68477,12 +70514,12 @@ module.exports = { const createTree = __webpack_require__(605); -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ -const KNOWN_NODES = new Set(["AssignmentExpression", "AssignmentPattern", "ArrayExpression", "ArrayPattern", "ArrowFunctionExpression", "AwaitExpression", "BlockStatement", "BinaryExpression", "BreakStatement", "CallExpression", "CatchClause", "ChainExpression", "ClassBody", "ClassDeclaration", "ClassExpression", "ConditionalExpression", "ContinueStatement", "DoWhileStatement", "DebuggerStatement", "EmptyStatement", "ExperimentalRestProperty", "ExperimentalSpreadProperty", "ExpressionStatement", "ForStatement", "ForInStatement", "ForOfStatement", "FunctionDeclaration", "FunctionExpression", "Identifier", "IfStatement", "Literal", "LabeledStatement", "LogicalExpression", "MemberExpression", "MetaProperty", "MethodDefinition", "NewExpression", "ObjectExpression", "ObjectPattern", "Program", "Property", "RestElement", "ReturnStatement", "SequenceExpression", "SpreadElement", "Super", "SwitchCase", "SwitchStatement", "TaggedTemplateExpression", "TemplateElement", "TemplateLiteral", "ThisExpression", "ThrowStatement", "TryStatement", "UnaryExpression", "UpdateExpression", "VariableDeclaration", "VariableDeclarator", "WhileStatement", "WithStatement", "YieldExpression", "JSXFragment", "JSXOpeningFragment", "JSXClosingFragment", "JSXIdentifier", "JSXNamespacedName", "JSXMemberExpression", "JSXEmptyExpression", "JSXExpressionContainer", "JSXElement", "JSXClosingElement", "JSXOpeningElement", "JSXAttribute", "JSXSpreadAttribute", "JSXText", "ExportDefaultDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration", "ExportSpecifier", "ImportDeclaration", "ImportSpecifier", "ImportDefaultSpecifier", "ImportNamespaceSpecifier", "ImportExpression"]); +const KNOWN_NODES = new Set(["AssignmentExpression", "AssignmentPattern", "ArrayExpression", "ArrayPattern", "ArrowFunctionExpression", "AwaitExpression", "BlockStatement", "BinaryExpression", "BreakStatement", "CallExpression", "CatchClause", "ChainExpression", "ClassBody", "ClassDeclaration", "ClassExpression", "ConditionalExpression", "ContinueStatement", "DoWhileStatement", "DebuggerStatement", "EmptyStatement", "ExperimentalRestProperty", "ExperimentalSpreadProperty", "ExpressionStatement", "ForStatement", "ForInStatement", "ForOfStatement", "FunctionDeclaration", "FunctionExpression", "Identifier", "IfStatement", "Literal", "LabeledStatement", "LogicalExpression", "MemberExpression", "MetaProperty", "MethodDefinition", "NewExpression", "ObjectExpression", "ObjectPattern", "PrivateIdentifier", "Program", "Property", "PropertyDefinition", "RestElement", "ReturnStatement", "SequenceExpression", "SpreadElement", "StaticBlock", "Super", "SwitchCase", "SwitchStatement", "TaggedTemplateExpression", "TemplateElement", "TemplateLiteral", "ThisExpression", "ThrowStatement", "TryStatement", "UnaryExpression", "UpdateExpression", "VariableDeclaration", "VariableDeclarator", "WhileStatement", "WithStatement", "YieldExpression", "JSXFragment", "JSXOpeningFragment", "JSXClosingFragment", "JSXIdentifier", "JSXNamespacedName", "JSXMemberExpression", "JSXEmptyExpression", "JSXExpressionContainer", "JSXElement", "JSXClosingElement", "JSXOpeningElement", "JSXAttribute", "JSXSpreadAttribute", "JSXText", "ExportDefaultDeclaration", "ExportNamedDeclaration", "ExportAllDeclaration", "ExportSpecifier", "ImportDeclaration", "ImportSpecifier", "ImportDefaultSpecifier", "ImportNamespaceSpecifier", "ImportExpression"]); /* * General rule strategy: * 1. An OffsetStorage instance stores a map of desired offsets, where each token has a specified offset from another @@ -68512,7 +70549,7 @@ class BinarySearchTree { /** * Inserts an entry into the tree. * @param {number} key The entry's key - * @param {*} value The entry's value + * @param {any} value The entry's value * @returns {void} */ @@ -68570,8 +70607,6 @@ class BinarySearchTree { class TokenInfo { - // eslint-disable-next-line jsdoc/require-description - /** * @param {SourceCode} sourceCode A SourceCode object */ @@ -68627,8 +70662,6 @@ class TokenInfo { class OffsetStorage { - // eslint-disable-next-line jsdoc/require-description - /** * @param {TokenInfo} tokenInfo a TokenInfo instance * @param {number} indentSize The desired size of each indentation level @@ -68656,7 +70689,7 @@ class OffsetStorage { } /** * Sets the offset column of token B to match the offset column of token A. - * **WARNING**: This matches a *column*, even if baseToken is not the first token on its line. In + * - **WARNING**: This matches a *column*, even if baseToken is not the first token on its line. In * most cases, `setDesiredOffset` should be used instead. * @param {Token} baseToken The first token * @param {Token} offsetToken The second token, whose offset should be matched to the first token @@ -68746,11 +70779,11 @@ class OffsetStorage { * Instead, the offset tree is represented as a collection of contiguous offset ranges in a file. For example, the following * list could represent the state of the offset tree at a given point: * - * * Tokens starting in the interval [0, 15) are aligned with the beginning of the file - * * Tokens starting in the interval [15, 30) are offset by 1 indent level from the `bar` token - * * Tokens starting in the interval [30, 43) are offset by 1 indent level from the `foo` token - * * Tokens starting in the interval [43, 820) are offset by 2 indent levels from the `bar` token - * * Tokens starting in the interval [820, ∞) are offset by 1 indent level from the `baz` token + * - Tokens starting in the interval [0, 15) are aligned with the beginning of the file + * - Tokens starting in the interval [15, 30) are offset by 1 indent level from the `bar` token + * - Tokens starting in the interval [30, 43) are offset by 1 indent level from the `foo` token + * - Tokens starting in the interval [43, 820) are offset by 2 indent levels from the `bar` token + * - Tokens starting in the interval [820, ∞) are offset by 1 indent level from the `baz` token * * The `setDesiredOffsets` methods inserts ranges like the ones above. The third line above would be inserted by using: * `setDesiredOffsets([30, 43], fooToken, 1);` @@ -68883,7 +70916,6 @@ module.exports = { type: "layout", docs: { description: "enforce consistent indentation", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/indent" }, @@ -68952,6 +70984,16 @@ module.exports = { }, additionalProperties: false }, + StaticBlock: { + type: "object", + properties: { + body: { + type: "integer", + minimum: 0 + } + }, + additionalProperties: false + }, CallExpression: { type: "object", properties: { @@ -69013,6 +71055,9 @@ module.exports = { parameters: DEFAULT_PARAMETER_INDENT, body: DEFAULT_FUNCTION_BODY_INDENT }, + StaticBlock: { + body: DEFAULT_FUNCTION_BODY_INDENT + }, CallExpression: { arguments: DEFAULT_PARAMETER_INDENT }, @@ -69060,11 +71105,11 @@ module.exports = { */ function createErrorMessageData(expectedAmount, actualSpaces, actualTabs) { - const expectedStatement = `${expectedAmount} ${indentType}${expectedAmount === 1 ? "" : "s"}`; // e.g. "2 tabs" + const expectedStatement = "".concat(expectedAmount, " ").concat(indentType).concat(expectedAmount === 1 ? "" : "s"); // e.g. "2 tabs" - const foundSpacesWord = `space${actualSpaces === 1 ? "" : "s"}`; // e.g. "space" + const foundSpacesWord = "space".concat(actualSpaces === 1 ? "" : "s"); // e.g. "space" - const foundTabsWord = `tab${actualTabs === 1 ? "" : "s"}`; // e.g. "tabs" + const foundTabsWord = "tab".concat(actualTabs === 1 ? "" : "s"); // e.g. "tabs" let foundStatement; @@ -69073,9 +71118,9 @@ module.exports = { * Abbreviate the message if the expected indentation is also spaces. * e.g. 'Expected 4 spaces but found 2' rather than 'Expected 4 spaces but found 2 spaces' */ - foundStatement = indentType === "space" ? actualSpaces : `${actualSpaces} ${foundSpacesWord}`; + foundStatement = indentType === "space" ? actualSpaces : "".concat(actualSpaces, " ").concat(foundSpacesWord); } else if (actualTabs > 0) { - foundStatement = indentType === "tab" ? actualTabs : `${actualTabs} ${foundTabsWord}`; + foundStatement = indentType === "tab" ? actualTabs : "".concat(actualTabs, " ").concat(foundTabsWord); } else { foundStatement = "0"; } @@ -69689,6 +71734,54 @@ module.exports = { } }, + PropertyDefinition(node) { + const firstToken = sourceCode.getFirstToken(node); + const maybeSemicolonToken = sourceCode.getLastToken(node); + let keyLastToken = null; // Indent key. + + if (node.computed) { + const bracketTokenL = sourceCode.getTokenBefore(node.key, astUtils.isOpeningBracketToken); + const bracketTokenR = keyLastToken = sourceCode.getTokenAfter(node.key, astUtils.isClosingBracketToken); + const keyRange = [bracketTokenL.range[1], bracketTokenR.range[0]]; + + if (bracketTokenL !== firstToken) { + offsets.setDesiredOffset(bracketTokenL, firstToken, 0); + } + + offsets.setDesiredOffsets(keyRange, bracketTokenL, 1); + offsets.setDesiredOffset(bracketTokenR, bracketTokenL, 0); + } else { + const idToken = keyLastToken = sourceCode.getFirstToken(node.key); + + if (idToken !== firstToken) { + offsets.setDesiredOffset(idToken, firstToken, 1); + } + } // Indent initializer. + + + if (node.value) { + const eqToken = sourceCode.getTokenBefore(node.value, astUtils.isEqToken); + const valueToken = sourceCode.getTokenAfter(eqToken); + offsets.setDesiredOffset(eqToken, keyLastToken, 1); + offsets.setDesiredOffset(valueToken, eqToken, 1); + + if (astUtils.isSemicolonToken(maybeSemicolonToken)) { + offsets.setDesiredOffset(maybeSemicolonToken, eqToken, 1); + } + } else if (astUtils.isSemicolonToken(maybeSemicolonToken)) { + offsets.setDesiredOffset(maybeSemicolonToken, keyLastToken, 1); + } + }, + + StaticBlock(node) { + const openingCurly = sourceCode.getFirstToken(node, { + skip: 1 + }); // skip the `static` token + + const closingCurly = sourceCode.getLastToken(node); + addElementListIndent(node.body, openingCurly, closingCurly, options.StaticBlock.body); + }, + SwitchStatement(node) { const openingCurly = sourceCode.getTokenAfter(node.discriminant, astUtils.isOpeningBraceToken); const closingCurly = sourceCode.getLastToken(node); @@ -71161,12 +73254,13 @@ function createRBTree(compare) { * This rule has been ported and modified from nodeca. * @author Vitaly Puzrin * @author Gyandeep Singh + * @deprecated in ESLint v4.0.0 */ //------------------------------------------------------------------------------ // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -71178,7 +73272,6 @@ module.exports = { type: "layout", docs: { description: "enforce consistent indentation", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/indent-legacy" }, @@ -71397,24 +73490,24 @@ module.exports = { */ function createErrorMessageData(expectedAmount, actualSpaces, actualTabs) { - const expectedStatement = `${expectedAmount} ${indentType}${expectedAmount === 1 ? "" : "s"}`; // e.g. "2 tabs" + const expectedStatement = "".concat(expectedAmount, " ").concat(indentType).concat(expectedAmount === 1 ? "" : "s"); // e.g. "2 tabs" - const foundSpacesWord = `space${actualSpaces === 1 ? "" : "s"}`; // e.g. "space" + const foundSpacesWord = "space".concat(actualSpaces === 1 ? "" : "s"); // e.g. "space" - const foundTabsWord = `tab${actualTabs === 1 ? "" : "s"}`; // e.g. "tabs" + const foundTabsWord = "tab".concat(actualTabs === 1 ? "" : "s"); // e.g. "tabs" let foundStatement; if (actualSpaces > 0 && actualTabs > 0) { - foundStatement = `${actualSpaces} ${foundSpacesWord} and ${actualTabs} ${foundTabsWord}`; // e.g. "1 space and 2 tabs" + foundStatement = "".concat(actualSpaces, " ").concat(foundSpacesWord, " and ").concat(actualTabs, " ").concat(foundTabsWord); // e.g. "1 space and 2 tabs" } else if (actualSpaces > 0) { /* * Abbreviate the message if the expected indentation is also spaces. * e.g. 'Expected 4 spaces but found 2' rather than 'Expected 4 spaces but found 2 spaces' */ - foundStatement = indentType === "space" ? actualSpaces : `${actualSpaces} ${foundSpacesWord}`; + foundStatement = indentType === "space" ? actualSpaces : "".concat(actualSpaces, " ").concat(foundSpacesWord); } else if (actualTabs > 0) { - foundStatement = indentType === "tab" ? actualTabs : `${actualTabs} ${foundTabsWord}`; + foundStatement = indentType === "tab" ? actualTabs : "".concat(actualTabs, " ").concat(foundTabsWord); } else { foundStatement = "0"; } @@ -72233,7 +74326,6 @@ module.exports = { type: "suggestion", docs: { description: "require or disallow initialization in variable declarations", - category: "Variables", recommended: false, url: "https://eslint.org/docs/rules/init-declarations" }, @@ -72324,7 +74416,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Constants //------------------------------------------------------------------------------ @@ -72357,7 +74449,6 @@ module.exports = { type: "layout", docs: { description: "enforce the consistent use of either double or single quotes in JSX attributes", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/jsx-quotes" }, @@ -72422,7 +74513,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -72552,7 +74643,6 @@ module.exports = { type: "layout", docs: { description: "enforce consistent spacing between keys and values in object literal properties", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/key-spacing" }, @@ -72772,7 +74862,8 @@ module.exports = { function isKeyValueProperty(property) { - return !(property.method || property.shorthand || property.kind !== "init" || property.type !== "Property"); + return !(property.method || property.shorthand || property.kind !== "init" || property.type !== "Property" // Could be "ExperimentalSpreadProperty" or "SpreadElement" + ); } /** * Starting from the given a node (a property.key node here) looks forward @@ -72826,27 +74917,27 @@ module.exports = { function report(property, side, whitespace, expected, mode) { - const diff = whitespace.length - expected, - nextColon = getNextColon(property.key), - tokenBeforeColon = sourceCode.getTokenBefore(nextColon, { - includeComments: true - }), - tokenAfterColon = sourceCode.getTokenAfter(nextColon, { - includeComments: true - }), - isKeySide = side === "key", - isExtra = diff > 0, - diffAbs = Math.abs(diff), - spaces = Array(diffAbs + 1).join(" "); - const locStart = isKeySide ? tokenBeforeColon.loc.end : nextColon.loc.start; - const locEnd = isKeySide ? nextColon.loc.start : tokenAfterColon.loc.start; - const missingLoc = isKeySide ? tokenBeforeColon.loc : tokenAfterColon.loc; - const loc = isExtra ? { - start: locStart, - end: locEnd - } : missingLoc; + const diff = whitespace.length - expected; if ((diff && mode === "strict" || diff < 0 && mode === "minimum" || diff > 0 && !expected && mode === "minimum") && !(expected && containsLineTerminator(whitespace))) { + const nextColon = getNextColon(property.key), + tokenBeforeColon = sourceCode.getTokenBefore(nextColon, { + includeComments: true + }), + tokenAfterColon = sourceCode.getTokenAfter(nextColon, { + includeComments: true + }), + isKeySide = side === "key", + isExtra = diff > 0, + diffAbs = Math.abs(diff), + spaces = Array(diffAbs + 1).join(" "); + const locStart = isKeySide ? tokenBeforeColon.loc.end : nextColon.loc.start; + const locEnd = isKeySide ? nextColon.loc.start : tokenAfterColon.loc.start; + const missingLoc = isKeySide ? tokenBeforeColon.loc : tokenAfterColon.loc; + const loc = isExtra ? { + start: locStart, + end: locEnd + } : missingLoc; let fix; if (isExtra) { @@ -72928,8 +75019,8 @@ module.exports = { } /** * Creates groups of properties. - * @param {ASTNode} node ObjectExpression node being evaluated. - * @returns {Array.} Groups of property AST node lists. + * @param {ASTNode} node ObjectExpression node being evaluated. + * @returns {Array} Groups of property AST node lists. */ @@ -73004,7 +75095,7 @@ module.exports = { } /** * Verifies spacing of property conforms to specified options. - * @param {ASTNode} node Property node being evaluated. + * @param {ASTNode} node Property node being evaluated. * @param {Object} lineOptions Configured singleLine or multiLine options * @returns {void} */ @@ -73036,7 +75127,7 @@ module.exports = { } /** * Verifies vertical alignment, taking into account groups of properties. - * @param {ASTNode} node ObjectExpression node being evaluated. + * @param {ASTNode} node ObjectExpression node being evaluated. * @returns {void} */ @@ -73094,7 +75185,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547), +const astUtils = __webpack_require__(548), keywords = __webpack_require__(583); //------------------------------------------------------------------------------ // Constants //------------------------------------------------------------------------------ @@ -73106,7 +75197,7 @@ const PREV_TOKEN_M = /^[)\]}>*]$/u; const NEXT_TOKEN_M = /^[{*]$/u; const TEMPLATE_OPEN_PAREN = /\$\{$/u; const TEMPLATE_CLOSE_PAREN = /^\}/u; -const CHECK_TYPE = /^(?:JSXElement|RegularExpression|String|Template)$/u; +const CHECK_TYPE = /^(?:JSXElement|RegularExpression|String|Template|PrivateIdentifier)$/u; const KEYS = keywords.concat(["as", "async", "await", "from", "get", "let", "of", "set", "yield"]); // check duplications. (function () { @@ -73114,7 +75205,7 @@ const KEYS = keywords.concat(["as", "async", "await", "from", "get", "let", "of" for (let i = 1; i < KEYS.length; ++i) { if (KEYS[i] === KEYS[i - 1]) { - throw new Error(`Duplication was found in the keyword list: ${KEYS[i]}`); + throw new Error("Duplication was found in the keyword list: ".concat(KEYS[i])); } } })(); //------------------------------------------------------------------------------ @@ -73150,7 +75241,6 @@ module.exports = { type: "layout", docs: { description: "enforce consistent spacing before and after keywords", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/keyword-spacing" }, @@ -73198,6 +75288,7 @@ module.exports = { create(context) { const sourceCode = context.getSourceCode(); + const tokensToIgnore = new WeakSet(); /** * Reports a given token if there are not space(s) before the token. * @param {Token} token A token to report. @@ -73208,7 +75299,7 @@ module.exports = { function expectSpaceBefore(token, pattern) { const prevToken = sourceCode.getTokenBefore(token); - if (prevToken && (CHECK_TYPE.test(prevToken.type) || pattern.test(prevToken.value)) && !isOpenParenOfTemplate(prevToken) && astUtils.isTokenOnSameLine(prevToken, token) && !sourceCode.isSpaceBetweenTokens(prevToken, token)) { + if (prevToken && (CHECK_TYPE.test(prevToken.type) || pattern.test(prevToken.value)) && !isOpenParenOfTemplate(prevToken) && !tokensToIgnore.has(prevToken) && astUtils.isTokenOnSameLine(prevToken, token) && !sourceCode.isSpaceBetweenTokens(prevToken, token)) { context.report({ loc: token.loc, messageId: "expectedBefore", @@ -73232,7 +75323,7 @@ module.exports = { function unexpectSpaceBefore(token, pattern) { const prevToken = sourceCode.getTokenBefore(token); - if (prevToken && (CHECK_TYPE.test(prevToken.type) || pattern.test(prevToken.value)) && !isOpenParenOfTemplate(prevToken) && astUtils.isTokenOnSameLine(prevToken, token) && sourceCode.isSpaceBetweenTokens(prevToken, token)) { + if (prevToken && (CHECK_TYPE.test(prevToken.type) || pattern.test(prevToken.value)) && !isOpenParenOfTemplate(prevToken) && !tokensToIgnore.has(prevToken) && astUtils.isTokenOnSameLine(prevToken, token) && sourceCode.isSpaceBetweenTokens(prevToken, token)) { context.report({ loc: { start: prevToken.loc.end, @@ -73259,7 +75350,7 @@ module.exports = { function expectSpaceAfter(token, pattern) { const nextToken = sourceCode.getTokenAfter(token); - if (nextToken && (CHECK_TYPE.test(nextToken.type) || pattern.test(nextToken.value)) && !isCloseParenOfTemplate(nextToken) && astUtils.isTokenOnSameLine(token, nextToken) && !sourceCode.isSpaceBetweenTokens(token, nextToken)) { + if (nextToken && (CHECK_TYPE.test(nextToken.type) || pattern.test(nextToken.value)) && !isCloseParenOfTemplate(nextToken) && !tokensToIgnore.has(nextToken) && astUtils.isTokenOnSameLine(token, nextToken) && !sourceCode.isSpaceBetweenTokens(token, nextToken)) { context.report({ loc: token.loc, messageId: "expectedAfter", @@ -73283,7 +75374,7 @@ module.exports = { function unexpectSpaceAfter(token, pattern) { const nextToken = sourceCode.getTokenAfter(token); - if (nextToken && (CHECK_TYPE.test(nextToken.type) || pattern.test(nextToken.value)) && !isCloseParenOfTemplate(nextToken) && astUtils.isTokenOnSameLine(token, nextToken) && sourceCode.isSpaceBetweenTokens(token, nextToken)) { + if (nextToken && (CHECK_TYPE.test(nextToken.type) || pattern.test(nextToken.value)) && !isCloseParenOfTemplate(nextToken) && !tokensToIgnore.has(nextToken) && astUtils.isTokenOnSameLine(token, nextToken) && sourceCode.isSpaceBetweenTokens(token, nextToken)) { context.report({ loc: { start: token.loc.end, @@ -73308,7 +75399,8 @@ module.exports = { */ - function parseOptions(options = {}) { + function parseOptions() { + let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; const before = options.before !== false; const after = options.after !== false; const defaultValue = { @@ -73495,7 +75587,14 @@ module.exports = { function checkSpacingForForInStatement(node) { checkSpacingAroundFirstToken(node); - checkSpacingAroundTokenBefore(node.right); + const inToken = sourceCode.getTokenBefore(node.right, astUtils.isNotOpeningParenToken); + const previousToken = sourceCode.getTokenBefore(inToken); + + if (previousToken.type !== "PrivateIdentifier") { + checkSpacingBefore(inToken); + } + + checkSpacingAfter(inToken); } /** * Reports `for` and `of` keywords of a given node if usage of spacing @@ -73513,7 +75612,14 @@ module.exports = { checkSpacingAroundFirstToken(node); } - checkSpacingAround(sourceCode.getTokenBefore(node.right, astUtils.isNotOpeningParenToken)); + const ofToken = sourceCode.getTokenBefore(node.right, astUtils.isNotOpeningParenToken); + const previousToken = sourceCode.getTokenBefore(ofToken); + + if (previousToken.type !== "PrivateIdentifier") { + checkSpacingBefore(ofToken); + } + + checkSpacingAfter(ofToken); } /** * Reports `import`, `export`, `as`, and `from` keywords of a given node if @@ -73564,6 +75670,7 @@ module.exports = { * Reports `static`, `get`, and `set` keywords of a given node if usage of * spacing around those keywords is invalid. * @param {ASTNode} node A node to report. + * @throws {Error} If unable to find token get, set, or async beside method name. * @returns {void} */ @@ -73646,7 +75753,16 @@ module.exports = { // Others ImportNamespaceSpecifier: checkSpacingForImportNamespaceSpecifier, MethodDefinition: checkSpacingForProperty, - Property: checkSpacingForProperty + PropertyDefinition: checkSpacingForProperty, + StaticBlock: checkSpacingAroundFirstToken, + Property: checkSpacingForProperty, + + // To avoid conflicts with `space-infix-ops`, e.g. `a > this.b` + "BinaryExpression[operator='>']"(node) { + const operatorToken = sourceCode.getTokenBefore(node.right, astUtils.isNotOpeningParenToken); + tokensToIgnore.add(operatorToken); + } + }; } @@ -73663,7 +75779,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -73673,7 +75789,6 @@ module.exports = { type: "layout", docs: { description: "enforce position of line comments", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/line-comment-position" }, @@ -73784,7 +75899,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -73794,7 +75909,6 @@ module.exports = { type: "layout", docs: { description: "enforce consistent linebreak style", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/linebreak-style" }, @@ -73884,7 +75998,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -73927,7 +76041,6 @@ module.exports = { type: "layout", docs: { description: "require empty lines around comments", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/lines-around-comment" }, @@ -74053,12 +76166,41 @@ module.exports = { /** * Returns the parent node that contains the given token. * @param {token} token The token to check. - * @returns {ASTNode} The parent node that contains the given token. + * @returns {ASTNode|null} The parent node that contains the given token. */ function getParentNodeOfToken(token) { - return sourceCode.getNodeByRangeIndex(token.range[0]); + const node = sourceCode.getNodeByRangeIndex(token.range[0]); + /* + * For the purpose of this rule, the comment token is in a `StaticBlock` node only + * if it's inside the braces of that `StaticBlock` node. + * + * Example where this function returns `null`: + * + * static + * // comment + * { + * } + * + * Example where this function returns `StaticBlock` node: + * + * static + * { + * // comment + * } + * + */ + + if (node && node.type === "StaticBlock") { + const openingBrace = sourceCode.getFirstToken(node, { + skip: 1 + }); // skip the `static` token + + return token.range[0] >= openingBrace.range[0] ? node : null; + } + + return node; } /** * Returns whether or not comments are at the parent start or not. @@ -74070,7 +76212,16 @@ module.exports = { function isCommentAtParentStart(token, nodeType) { const parent = getParentNodeOfToken(token); - return parent && isParentNodeType(parent, nodeType) && token.loc.start.line - parent.loc.start.line === 1; + + if (parent && isParentNodeType(parent, nodeType)) { + const parentStartNodeOrToken = parent.type === "StaticBlock" ? sourceCode.getFirstToken(parent, { + skip: 1 + }) // opening brace of the static block + : parent; + return token.loc.start.line - parentStartNodeOrToken.loc.start.line === 1; + } + + return false; } /** * Returns whether or not comments are at the parent end or not. @@ -74082,7 +76233,7 @@ module.exports = { function isCommentAtParentEnd(token, nodeType) { const parent = getParentNodeOfToken(token); - return parent && isParentNodeType(parent, nodeType) && parent.loc.end.line - token.loc.end.line === 1; + return !!parent && isParentNodeType(parent, nodeType) && parent.loc.end.line - token.loc.end.line === 1; } /** * Returns whether or not comments are at the block start or not. @@ -74092,7 +76243,7 @@ module.exports = { function isCommentAtBlockStart(token) { - return isCommentAtParentStart(token, "ClassBody") || isCommentAtParentStart(token, "BlockStatement") || isCommentAtParentStart(token, "SwitchCase"); + return isCommentAtParentStart(token, "ClassBody") || isCommentAtParentStart(token, "BlockStatement") || isCommentAtParentStart(token, "StaticBlock") || isCommentAtParentStart(token, "SwitchCase"); } /** * Returns whether or not comments are at the block end or not. @@ -74102,7 +76253,7 @@ module.exports = { function isCommentAtBlockEnd(token) { - return isCommentAtParentEnd(token, "ClassBody") || isCommentAtParentEnd(token, "BlockStatement") || isCommentAtParentEnd(token, "SwitchCase") || isCommentAtParentEnd(token, "SwitchStatement"); + return isCommentAtParentEnd(token, "ClassBody") || isCommentAtParentEnd(token, "BlockStatement") || isCommentAtParentEnd(token, "StaticBlock") || isCommentAtParentEnd(token, "SwitchCase") || isCommentAtParentEnd(token, "SwitchStatement"); } /** * Returns whether or not comments are at the class start or not. @@ -74284,11 +76435,11 @@ module.exports = { /** * @fileoverview Require or disallow newlines around directives. * @author Kai Cataldo - * @deprecated + * @deprecated in ESLint v4.0.0 */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -74298,7 +76449,6 @@ module.exports = { type: "layout", docs: { description: "require or disallow newlines around directives", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/lines-around-directive" }, @@ -74484,9 +76634,11 @@ module.exports = { * @fileoverview Rule to check empty newline between class members * @author 薛定谔的猫 */ + //------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ - -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -74496,7 +76648,6 @@ module.exports = { type: "layout", docs: { description: "require or disallow an empty line between class members", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/lines-between-class-members" }, @@ -74526,6 +76677,50 @@ module.exports = { exceptAfterSingleLine: false }; const sourceCode = context.getSourceCode(); + /** + * Gets a pair of tokens that should be used to check lines between two class member nodes. + * + * In most cases, this returns the very last token of the current node and + * the very first token of the next node. + * For example: + * + * class C { + * x = 1; // curLast: `;` nextFirst: `in` + * in = 2 + * } + * + * There is only one exception. If the given node ends with a semicolon, and it looks like + * a semicolon-less style's semicolon - one that is not on the same line as the preceding + * token, but is on the line where the next class member starts - this returns the preceding + * token and the semicolon as boundary tokens. + * For example: + * + * class C { + * x = 1 // curLast: `1` nextFirst: `;` + * ;in = 2 + * } + * When determining the desired layout of the code, we should treat this semicolon as + * a part of the next class member node instead of the one it technically belongs to. + * @param {ASTNode} curNode Current class member node. + * @param {ASTNode} nextNode Next class member node. + * @returns {Token} The actual last token of `node`. + * @private + */ + + function getBoundaryTokens(curNode, nextNode) { + const lastToken = sourceCode.getLastToken(curNode); + const prevToken = sourceCode.getTokenBefore(lastToken); + const nextToken = sourceCode.getFirstToken(nextNode); // skip possible lone `;` between nodes + + const isSemicolonLessStyle = astUtils.isSemicolonToken(lastToken) && !astUtils.isTokenOnSameLine(prevToken, lastToken) && astUtils.isTokenOnSameLine(lastToken, nextToken); + return isSemicolonLessStyle ? { + curLast: prevToken, + nextFirst: lastToken + } : { + curLast: lastToken, + nextFirst: nextToken + }; + } /** * Return the last token among the consecutive tokens that have no exceed max line difference in between, before the first token in the next member. * @param {Token} prevLastToken The last token in the previous member node. @@ -74534,6 +76729,7 @@ module.exports = { * @returns {Token} The last token among the consecutive tokens. */ + function findLastConsecutiveTokenAfter(prevLastToken, nextFirstToken, maxLine) { const after = sourceCode.getTokenAfter(prevLastToken, { includeComments: true @@ -74585,8 +76781,10 @@ module.exports = { for (let i = 0; i < body.length - 1; i++) { const curFirst = sourceCode.getFirstToken(body[i]); - const curLast = sourceCode.getLastToken(body[i]); - const nextFirst = sourceCode.getFirstToken(body[i + 1]); + const { + curLast, + nextFirst + } = getBoundaryTokens(body[i], body[i + 1]); const isMulti = !astUtils.isTokenOnSameLine(curFirst, curLast); const skip = !isMulti && options[1].exceptAfterSingleLine; const beforePadding = findLastConsecutiveTokenAfter(curLast, nextFirst, 1); @@ -74639,13 +76837,26 @@ module.exports = { type: "suggestion", docs: { description: "enforce a maximum number of classes per file", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/max-classes-per-file" }, schema: [{ - type: "integer", - minimum: 1 + oneOf: [{ + type: "integer", + minimum: 1 + }, { + type: "object", + properties: { + ignoreExpressions: { + type: "boolean" + }, + max: { + type: "integer", + minimum: 1 + } + }, + additionalProperties: false + }] }], messages: { maximumExceeded: "File has too many classes ({{ classCount }}). Maximum allowed is {{ max }}." @@ -74653,7 +76864,8 @@ module.exports = { }, create(context) { - const maxClasses = context.options[0] || 1; + const [option = {}] = context.options; + const [ignoreExpressions, max] = typeof option === "number" ? [false, option || 1] : [option.ignoreExpressions, option.max || 1]; let classCount = 0; return { Program() { @@ -74661,20 +76873,26 @@ module.exports = { }, "Program:exit"(node) { - if (classCount > maxClasses) { + if (classCount > max) { context.report({ node, messageId: "maximumExceeded", data: { classCount, - max: maxClasses + max } }); } }, - "ClassDeclaration, ClassExpression"() { + "ClassDeclaration"() { classCount++; + }, + + "ClassExpression"() { + if (!ignoreExpressions) { + classCount++; + } } }; @@ -74700,7 +76918,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce a maximum depth that blocks can be nested", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/max-depth" }, @@ -74804,6 +77021,7 @@ module.exports = { FunctionDeclaration: startFunction, FunctionExpression: startFunction, ArrowFunctionExpression: startFunction, + StaticBlock: startFunction, IfStatement(node) { if (node.parent.type !== "IfStatement") { @@ -74831,6 +77049,7 @@ module.exports = { "FunctionDeclaration:exit": endFunction, "FunctionExpression:exit": endFunction, "ArrowFunctionExpression:exit": endFunction, + "StaticBlock:exit": endFunction, "Program:exit": endFunction }; } @@ -74903,7 +77122,6 @@ module.exports = { type: "layout", docs: { description: "enforce a maximum line length", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/max-len" }, @@ -75034,7 +77252,7 @@ module.exports = { * Ensure that an array exists at [key] on `object`, and add `value` to it. * @param {Object} object the object to mutate * @param {string} key the object's key - * @param {*} value the value to add + * @param {any} value the value to add * @returns {void} * @private */ @@ -75250,7 +77468,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -75274,7 +77492,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce a maximum number of lines per file", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/max-lines" }, @@ -75367,20 +77584,6 @@ module.exports = { return []; } - /** - * Returns a new array formed by applying a given callback function to each element of the array, and then flattening the result by one level. - * TODO(stephenwade): Replace this with array.flatMap when we drop support for Node v10 - * @param {any[]} array The array to process - * @param {Function} fn The function to use - * @returns {any[]} The result array - */ - - - function flatMap(array, fn) { - const mapped = array.map(fn); - const flattened = [].concat(...mapped); - return flattened; - } return { "Program:exit"() { @@ -75403,7 +77606,7 @@ module.exports = { if (skipComments) { const comments = sourceCode.getAllComments(); - const commentLines = flatMap(comments, comment => getLinesWithoutCode(comment)); + const commentLines = comments.flatMap(getLinesWithoutCode); lines = lines.filter(l => !commentLines.includes(l.lineNumber)); } @@ -75447,7 +77650,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); +const astUtils = __webpack_require__(548); const { upperCaseFirst @@ -75484,7 +77687,7 @@ const OPTIONS_OR_INTEGER_SCHEMA = { /** * Given a list of comment nodes, return a map with numeric keys (source code line numbers) and comment token values. * @param {Array} comments An array of comment nodes. - * @returns {Map.} A map with numeric keys (source code line numbers) and comment token values. + * @returns {Map} A map with numeric keys (source code line numbers) and comment token values. */ function getCommentLineNumbers(comments) { @@ -75505,7 +77708,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce a maximum number of lines of code in a function", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/max-lines-per-function" }, @@ -75667,7 +77869,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce a maximum depth that callbacks can be nested", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/max-nested-callbacks" }, @@ -75775,7 +77976,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); +const astUtils = __webpack_require__(548); const { upperCaseFirst @@ -75789,7 +77990,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce a maximum number of parameters in function definitions", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/max-params" }, @@ -75874,7 +78074,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); +const astUtils = __webpack_require__(548); const { upperCaseFirst @@ -75888,7 +78088,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce a maximum number of statements allowed in function blocks", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/max-statements" }, @@ -75983,6 +78182,14 @@ module.exports = { function endFunction(node) { const count = functionStack.pop(); + /* + * This rule does not apply to class static blocks, but we have to track them so + * that stataments in them do not count as statements in the enclosing function. + */ + + if (node.type === "StaticBlock") { + return; + } if (ignoreTopLevelFunctions && functionStack.length === 0) { topLevelFunctions.push({ @@ -76012,10 +78219,12 @@ module.exports = { FunctionDeclaration: startFunction, FunctionExpression: startFunction, ArrowFunctionExpression: startFunction, + StaticBlock: startFunction, BlockStatement: countStatements, "FunctionDeclaration:exit": endFunction, "FunctionExpression:exit": endFunction, "ArrowFunctionExpression:exit": endFunction, + "StaticBlock:exit": endFunction, "Program:exit"() { if (topLevelFunctions.length === 1) { @@ -76047,7 +78256,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -76057,7 +78266,6 @@ module.exports = { type: "layout", docs: { description: "enforce a maximum number of statements allowed per line", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/max-statements-per-line" }, @@ -76236,7 +78444,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -76246,7 +78454,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce a particular style for multiline comments", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/multiline-comment-style" }, @@ -76287,7 +78494,9 @@ module.exports = { */ - function isStarredBlockComment([firstComment]) { + function isStarredBlockComment(_ref) { + let [firstComment] = _ref; + if (firstComment.type !== "Block") { return false; } @@ -76303,7 +78512,9 @@ module.exports = { */ - function isJSDocComment([firstComment]) { + function isJSDocComment(_ref2) { + let [firstComment] = _ref2; + if (firstComment.type !== "Block") { return false; } @@ -76319,12 +78530,18 @@ module.exports = { function processSeparateLineComments(commentGroup) { - const allLinesHaveLeadingSpace = commentGroup.map(({ - value - }) => value).filter(line => line.trim().length).every(line => line.startsWith(" ")); - return commentGroup.map(({ - value - }) => allLinesHaveLeadingSpace ? value.replace(/^ /u, "") : value); + const allLinesHaveLeadingSpace = commentGroup.map(_ref3 => { + let { + value + } = _ref3; + return value; + }).filter(line => line.trim().length).every(line => line.startsWith(" ")); + return commentGroup.map(_ref4 => { + let { + value + } = _ref4; + return allLinesHaveLeadingSpace ? value.replace(/^ /u, "") : value; + }); } /** * Processes a comment group that is currently in starred-block form, calculating the offset for each line. @@ -76347,7 +78564,7 @@ module.exports = { function processBareBlockComment(comment) { const lines = comment.value.split(astUtils.LINEBREAK_MATCHER).map(line => line.replace(/^\s*$/u, "")); - const leadingWhitespace = `${sourceCode.text.slice(comment.range[0] - comment.loc.start.column, comment.range[0])} `; + const leadingWhitespace = "".concat(sourceCode.text.slice(comment.range[0] - comment.loc.start.column, comment.range[0]), " "); let offset = ""; /* * Calculate the offset of the least indented line and use that as the basis for offsetting all the lines. @@ -76375,11 +78592,11 @@ module.exports = { const [, lineOffset, lineContents] = match; if (lineOffset.length > leadingWhitespace.length) { - return `${lineOffset.slice(leadingWhitespace.length - (offset.length + lineOffset.length))}${lineContents}`; + return "".concat(lineOffset.slice(leadingWhitespace.length - (offset.length + lineOffset.length))).concat(lineContents); } if (lineOffset.length < leadingWhitespace.length) { - return `${lineOffset.slice(leadingWhitespace.length)}${lineContents}`; + return "".concat(lineOffset.slice(leadingWhitespace.length)).concat(lineContents); } return lineContents; @@ -76425,7 +78642,7 @@ module.exports = { function convertToStarredBlock(firstComment, commentLinesList) { const initialOffset = getInitialOffset(firstComment); - return `/*\n${commentLinesList.map(line => `${initialOffset} * ${line}`).join("\n")}\n${initialOffset} */`; + return "/*\n".concat(commentLinesList.map(line => "".concat(initialOffset, " * ").concat(line)).join("\n"), "\n").concat(initialOffset, " */"); } /** * Converts a comment into separate-line form @@ -76436,7 +78653,7 @@ module.exports = { function convertToSeparateLines(firstComment, commentLinesList) { - return commentLinesList.map(line => `// ${line}`).join(`\n${getInitialOffset(firstComment)}`); + return commentLinesList.map(line => "// ".concat(line)).join("\n".concat(getInitialOffset(firstComment))); } /** * Converts a comment into bare-block form @@ -76447,7 +78664,7 @@ module.exports = { function convertToBlock(firstComment, commentLinesList) { - return `/* ${commentLinesList.join(`\n${getInitialOffset(firstComment)} `)} */`; + return "/* ".concat(commentLinesList.join("\n".concat(getInitialOffset(firstComment), " ")), " */"); } /** * Each method checks a group of comments to see if it's valid according to the given option. @@ -76483,7 +78700,7 @@ module.exports = { } else { const lines = firstComment.value.split(astUtils.LINEBREAK_MATCHER); const expectedLeadingWhitespace = getInitialOffset(firstComment); - const expectedLinePrefix = `${expectedLeadingWhitespace} *`; + const expectedLinePrefix = "".concat(expectedLeadingWhitespace, " *"); if (!/^\*?\s*$/u.test(lines[0])) { const start = firstComment.value.startsWith("*") ? firstComment.range[0] + 1 : firstComment.range[0]; @@ -76496,7 +78713,7 @@ module.exports = { } }, messageId: "startNewline", - fix: fixer => fixer.insertTextAfterRange([start, start + 2], `\n${expectedLinePrefix}`) + fix: fixer => fixer.insertTextAfterRange([start, start + 2], "\n".concat(expectedLinePrefix)) }); } @@ -76510,7 +78727,7 @@ module.exports = { end: firstComment.loc.end }, messageId: "endNewline", - fix: fixer => fixer.replaceTextRange([firstComment.range[1] - 2, firstComment.range[1]], `\n${expectedLinePrefix}/`) + fix: fixer => fixer.replaceTextRange([firstComment.range[1] - 2, firstComment.range[1]], "\n".concat(expectedLinePrefix, "/")) }); } @@ -76555,7 +78772,7 @@ module.exports = { const lineTextToAlignWith = sourceCode.lines[firstComment.loc.start.line - 1 + idx]; const [, prefix = "", initialOffset = ""] = lineTextToAlignWith.match(/^(\s*(?:\/?\*)?(\s*))/u) || []; - offset = `${commentTextPrefix.slice(prefix.length)}${initialOffset}`; + offset = "".concat(commentTextPrefix.slice(prefix.length)).concat(initialOffset); if (/^\s*\//u.test(lineText) && offset.length === 0) { offset += " "; @@ -76564,7 +78781,7 @@ module.exports = { break; } - return fixer.replaceTextRange([lineStartIndex, commentTextStartIndex], `${expectedLinePrefix}${offset}`); + return fixer.replaceTextRange([lineStartIndex, commentTextStartIndex], "".concat(expectedLinePrefix).concat(offset)); } }); @@ -76691,7 +78908,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -76701,7 +78918,6 @@ module.exports = { type: "layout", docs: { description: "enforce newlines between operands of ternary expressions", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/multiline-ternary" }, @@ -76847,7 +79063,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -76857,14 +79073,15 @@ const CAPS_ALLOWED = ["Array", "Boolean", "Date", "Error", "Function", "Number", * Ensure that if the key is provided, it must be an array. * @param {Object} obj Object to check with `key`. * @param {string} key Object key to check on `obj`. - * @param {*} fallback If obj[key] is not present, this will be returned. + * @param {any} fallback If obj[key] is not present, this will be returned. + * @throws {TypeError} If key is not an own array type property of `obj`. * @returns {string[]} Returns obj[key] if it's an Array, otherwise `fallback` */ function checkArray(obj, key, fallback) { /* istanbul ignore if */ if (Object.prototype.hasOwnProperty.call(obj, key) && !Array.isArray(obj[key])) { - throw new TypeError(`${key}, if provided, must be an Array`); + throw new TypeError("".concat(key, ", if provided, must be an Array")); } return obj[key] || fallback; @@ -76906,7 +79123,6 @@ module.exports = { type: "suggestion", docs: { description: "require constructor names to begin with a capital letter", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/new-cap" }, @@ -77102,7 +79318,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ //------------------------------------------------------------------------------ @@ -77115,7 +79331,6 @@ module.exports = { type: "layout", docs: { description: "enforce or disallow parentheses when invoking a constructor with no arguments", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/new-parens" }, @@ -77184,13 +79399,13 @@ module.exports = { /** * @fileoverview Rule to check empty newline after "var" statement * @author Gopal Venkatesan - * @deprecated + * @deprecated in ESLint v4.0.0 */ //------------------------------------------------------------------------------ // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -77200,7 +79415,6 @@ module.exports = { type: "layout", docs: { description: "require or disallow an empty line after variable declarations", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/newline-after-var" }, @@ -77316,9 +79530,9 @@ module.exports = { } /** * Determine if a token starts more than one line after a comment ends - * @param {token} token The token being checked - * @param {integer} commentStartLine The line number on which the comment starts - * @returns {boolean} True if `token` does not start immediately after a comment + * @param {token} token The token being checked + * @param {integer} commentStartLine The line number on which the comment starts + * @returns {boolean} True if `token` does not start immediately after a comment */ @@ -77391,7 +79605,7 @@ module.exports = { fix(fixer) { const linesBetween = sourceCode.getText().slice(lastToken.range[1], nextToken.range[0]).split(astUtils.LINEBREAK_MATCHER); - return fixer.replaceTextRange([lastToken.range[1], nextToken.range[0]], `${linesBetween.slice(0, -1).join("")}\n${linesBetween[linesBetween.length - 1]}`); + return fixer.replaceTextRange([lastToken.range[1], nextToken.range[0]], "".concat(linesBetween.slice(0, -1).join(""), "\n").concat(linesBetween[linesBetween.length - 1])); } }); @@ -77436,7 +79650,7 @@ module.exports = { /** * @fileoverview Rule to require newlines before `return` statement * @author Kai Cataldo - * @deprecated + * @deprecated in ESLint v4.0.0 */ //------------------------------------------------------------------------------ // Rule Definition @@ -77447,7 +79661,6 @@ module.exports = { type: "layout", docs: { description: "require an empty line before `return` statements", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/newline-before-return" }, @@ -77662,7 +79875,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -77672,7 +79885,6 @@ module.exports = { type: "layout", docs: { description: "require a newline after each call in a method chain", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/newline-per-chained-call" }, @@ -77702,7 +79914,7 @@ module.exports = { * Get the prefix of a given MemberExpression node. * If the MemberExpression node is a computed value it returns a * left bracket. If not it returns a period. - * @param {ASTNode} node A MemberExpression node to get + * @param {ASTNode} node A MemberExpression node to get * @returns {string} The prefix of the node. */ @@ -77795,7 +80007,7 @@ const { getStaticPropertyName: getPropertyName, getVariableByName, skipChainExpression -} = __webpack_require__(547); //------------------------------------------------------------------------------ +} = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -77866,7 +80078,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow the use of `alert`, `confirm`, and `prompt`", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-alert" }, @@ -77932,7 +80143,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow `Array` constructors", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-array-constructor" }, @@ -77984,7 +80194,6 @@ module.exports = { type: "problem", docs: { description: "disallow using an async function as a Promise executor", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-async-promise-executor" }, @@ -78027,7 +80236,12 @@ module.exports = { function isBoundary(node) { const t = node.type; - return t === "FunctionDeclaration" || t === "FunctionExpression" || t === "ArrowFunctionExpression" || t === "ForOfStatement" && node.await === true; + return t === "FunctionDeclaration" || t === "FunctionExpression" || t === "ArrowFunctionExpression" || + /* + * Don't report the await expressions on for-await-of loop since it's + * asynchronous iteration intentionally. + */ + t === "ForOfStatement" && node.await === true; } /** * Check whether the given node is in loop. @@ -78060,7 +80274,6 @@ module.exports = { type: "problem", docs: { description: "disallow `await` inside of loops", - category: "Possible Errors", recommended: false, url: "https://eslint.org/docs/rules/no-await-in-loop" }, @@ -78131,7 +80344,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow bitwise operators", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-bitwise" }, @@ -78163,7 +80375,7 @@ module.exports = { const int32Hint = options.int32Hint === true; /** * Reports an unexpected use of a bitwise operator. - * @param {ASTNode} node Node which contains the bitwise operator. + * @param {ASTNode} node Node which contains the bitwise operator. * @returns {void} */ @@ -78178,7 +80390,7 @@ module.exports = { } /** * Checks if the given node has a bitwise operator. - * @param {ASTNode} node The node to check. + * @param {ASTNode} node The node to check. * @returns {boolean} Whether or not the node has a bitwise operator. */ @@ -78188,7 +80400,7 @@ module.exports = { } /** * Checks if exceptions were provided, e.g. `{ allow: ['~', '|'] }`. - * @param {ASTNode} node The node to check. + * @param {ASTNode} node The node to check. * @returns {boolean} Whether or not the node has a bitwise operator. */ @@ -78198,7 +80410,7 @@ module.exports = { } /** * Checks if the given bitwise operator is used for integer typecasting, i.e. "|0" - * @param {ASTNode} node The node to check. + * @param {ASTNode} node The node to check. * @returns {boolean} whether the node is used in integer typecasting. */ @@ -78208,7 +80420,7 @@ module.exports = { } /** * Report if the given node contains a bitwise operator. - * @param {ASTNode} node The node to check. + * @param {ASTNode} node The node to check. * @returns {void} */ @@ -78236,6 +80448,7 @@ module.exports = { /** * @fileoverview disallow use of the Buffer() constructor * @author Teddy Katz + * @deprecated in ESLint v7.0.0 */ //------------------------------------------------------------------------------ // Rule Definition @@ -78248,7 +80461,6 @@ module.exports = { type: "problem", docs: { description: "disallow use of the `Buffer()` constructor", - category: "Node.js and CommonJS", recommended: false, url: "https://eslint.org/docs/rules/no-buffer-constructor" }, @@ -78296,7 +80508,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow the use of `arguments.caller` or `arguments.callee`", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-caller" }, @@ -78346,7 +80557,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow lexical declarations in case clauses", - category: "Best Practices", recommended: true, url: "https://eslint.org/docs/rules/no-case-declarations" }, @@ -78409,7 +80619,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -78419,7 +80629,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow `catch` clause parameters from shadowing variables in the outer scope", - category: "Variables", recommended: false, url: "https://eslint.org/docs/rules/no-catch-shadow" }, @@ -78488,7 +80697,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -78498,7 +80707,6 @@ module.exports = { type: "problem", docs: { description: "disallow reassigning class members", - category: "ECMAScript 6", recommended: true, url: "https://eslint.org/docs/rules/no-class-assign" }, @@ -78562,7 +80770,6 @@ module.exports = { type: "problem", docs: { description: "disallow comparing against -0", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-compare-neg-zero" }, @@ -78621,7 +80828,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -78641,7 +80848,6 @@ module.exports = { type: "problem", docs: { description: "disallow assignment operators in conditional expressions", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-cond-assign" }, @@ -78762,7 +80968,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -78785,7 +80991,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow arrow functions where they could be confused with comparisons", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/no-confusing-arrow" }, @@ -78825,7 +81030,7 @@ module.exports = { fix(fixer) { // if `allowParens` is not set to true don't bother wrapping in parens - return allowParens && fixer.replaceText(node.body, `(${sourceCode.getText(node.body)})`); + return allowParens && fixer.replaceText(node.body, "(".concat(sourceCode.getText(node.body), ")")); } }); @@ -78852,7 +81057,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -78862,7 +81067,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow the use of `console`", - category: "Possible Errors", recommended: false, url: "https://eslint.org/docs/rules/no-console" }, @@ -78974,7 +81178,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -78984,7 +81188,6 @@ module.exports = { type: "problem", docs: { description: "disallow reassigning `const` variables", - category: "ECMAScript 6", recommended: true, url: "https://eslint.org/docs/rules/no-const-assign" }, @@ -79045,7 +81248,6 @@ module.exports = { type: "problem", docs: { description: "disallow constant expressions in conditions", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-constant-condition" }, @@ -79329,7 +81531,6 @@ module.exports = { type: "problem", docs: { description: "disallow returning value from constructor", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-constructor-return" }, @@ -79389,7 +81590,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow `continue` statements", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-continue" }, @@ -79424,7 +81624,7 @@ module.exports = { */ -const RegExpValidator = __webpack_require__(651).RegExpValidator; +const RegExpValidator = (__webpack_require__(651).RegExpValidator); const collector = new class { constructor() { @@ -79439,7 +81639,7 @@ const collector = new class { onCharacter(start, end, cp) { if (cp >= 0x00 && cp <= 0x1F && (this._source.codePointAt(start) === cp || this._source.slice(start, end).startsWith("\\x") || this._source.slice(start, end).startsWith("\\u"))) { - this._controlChars.push(`\\x${`0${cp.toString(16)}`.slice(-2)}`); + this._controlChars.push("\\x".concat("0".concat(cp.toString(16)).slice(-2))); } } @@ -79464,7 +81664,6 @@ module.exports = { type: "problem", docs: { description: "disallow control characters in regular expressions", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-control-regex" }, @@ -79889,13 +82088,13 @@ class RegExpSyntaxError extends SyntaxError { constructor(source, uFlag, index, message) { if (source) { if (!source.startsWith("/")) { - source = `/${source}/${uFlag ? "u" : ""}`; + source = "/".concat(source, "/").concat(uFlag ? "u" : ""); } - source = `: ${source}`; + source = ": ".concat(source); } - super(`Invalid regular expression${source}: ${message}`); + super("Invalid regular expression".concat(source, ": ").concat(message)); this.index = index; } @@ -79939,7 +82138,9 @@ class RegExpValidator { this._options = options || {}; } - validateLiteral(source, start = 0, end = source.length) { + validateLiteral(source) { + let start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + let end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : source.length; this._uFlag = this._nFlag = false; this.reset(source, start, end); this.onLiteralEnter(start); @@ -79953,13 +82154,15 @@ class RegExpValidator { this.raise("Empty"); } else { const c = String.fromCodePoint(this.currentCodePoint); - this.raise(`Unexpected character '${c}'`); + this.raise("Unexpected character '".concat(c, "'")); } this.onLiteralLeave(start, end); } - validateFlags(source, start = 0, end = source.length) { + validateFlags(source) { + let start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + let end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : source.length; const existingFlags = new Set(); let global = false; let ignoreCase = false; @@ -79973,7 +82176,7 @@ class RegExpValidator { const flag = source.charCodeAt(i); if (existingFlags.has(flag)) { - this.raise(`Duplicated flag '${source[i]}'`); + this.raise("Duplicated flag '".concat(source[i], "'")); } existingFlags.add(flag); @@ -79993,14 +82196,17 @@ class RegExpValidator { } else if (flag === LatinSmallLetterD && this.ecmaVersion >= 2022) { hasIndices = true; } else { - this.raise(`Invalid flag '${source[i]}'`); + this.raise("Invalid flag '".concat(source[i], "'")); } } this.onFlags(start, end, global, ignoreCase, multiline, unicode, sticky, dotAll, hasIndices); } - validatePattern(source, start = 0, end = source.length, uFlag = false) { + validatePattern(source) { + let start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + let end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : source.length; + let uFlag = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; this._uFlag = uFlag && this.ecmaVersion >= 2015; this._nFlag = uFlag && this.ecmaVersion >= 2018; this.reset(source, start, end); @@ -80239,7 +82445,7 @@ class RegExpValidator { if (cp === -1 || isLineTerminator(cp)) { const kind = inClass ? "character class" : "regular expression"; - this.raise(`Unterminated ${kind}`); + this.raise("Unterminated ".concat(kind)); } if (escaped) { @@ -80286,7 +82492,7 @@ class RegExpValidator { } const c = String.fromCodePoint(cp); - this.raise(`Unexpected character '${c}'`); + this.raise("Unexpected character '".concat(c, "'")); } for (const name of this._backreferenceNames) { @@ -80415,7 +82621,8 @@ class RegExpValidator { return false; } - consumeQuantifier(noConsume = false) { + consumeQuantifier() { + let noConsume = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; const start = this.index; let min = 0; let max = 0; @@ -80999,7 +83206,8 @@ class RegExpValidator { return false; } - eatRegExpUnicodeEscapeSequence(forceUFlag = false) { + eatRegExpUnicodeEscapeSequence() { + let forceUFlag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; const start = this.index; const uFlag = forceUFlag || this._uFlag; @@ -81686,7 +83894,9 @@ class RegExpParser { this._validator = new RegExpValidator(this._state); } - parseLiteral(source, start = 0, end = source.length) { + parseLiteral(source) { + let start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + let end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : source.length; this._state.source = source; this._validator.validateLiteral(source, start, end); @@ -81707,7 +83917,9 @@ class RegExpParser { return literal; } - parseFlags(source, start = 0, end = source.length) { + parseFlags(source) { + let start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + let end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : source.length; this._state.source = source; this._validator.validateFlags(source, start, end); @@ -81715,7 +83927,10 @@ class RegExpParser { return this._state.flags; } - parsePattern(source, start = 0, end = source.length, uFlag = false) { + parsePattern(source) { + let start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; + let end = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : source.length; + let uFlag = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; this._state.source = source; this._validator.validatePattern(source, start, end, uFlag); @@ -81785,7 +84000,7 @@ class RegExpVisitor { break; default: - throw new Error(`Unknown type: ${node.type}`); + throw new Error("Unknown type: ".concat(node.type)); } } @@ -81980,7 +84195,6 @@ module.exports = { type: "problem", docs: { description: "disallow the use of `debugger`", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-debugger" }, @@ -82023,7 +84237,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow deleting variables", - category: "Variables", recommended: true, url: "https://eslint.org/docs/rules/no-delete-var" }, @@ -82067,7 +84280,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow division operators explicitly at the beginning of regular expressions", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-div-regex" }, @@ -82120,7 +84332,6 @@ module.exports = { type: "problem", docs: { description: "disallow duplicate arguments in `function` definitions", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-dupe-args" }, @@ -82193,7 +84404,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -82203,7 +84414,6 @@ module.exports = { type: "problem", docs: { description: "disallow duplicate class members", - category: "ECMAScript 6", recommended: true, url: "https://eslint.org/docs/rules/no-dupe-class-members" }, @@ -82227,7 +84437,7 @@ module.exports = { function getState(name, isStatic) { const stateMap = stack[stack.length - 1]; - const key = `$${name}`; // to avoid "__proto__". + const key = "$".concat(name); // to avoid "__proto__". if (!stateMap[key]) { stateMap[key] = { @@ -82264,20 +84474,21 @@ module.exports = { }, // Reports the node if its name has been declared already. - MethodDefinition(node) { + "MethodDefinition, PropertyDefinition"(node) { const name = astUtils.getStaticPropertyName(node); + const kind = node.type === "MethodDefinition" ? node.kind : "field"; - if (name === null || node.kind === "constructor") { + if (name === null || kind === "constructor") { return; } const state = getState(name, node.static); let isDuplicate = false; - if (node.kind === "get") { + if (kind === "get") { isDuplicate = state.init || state.get; state.get = true; - } else if (node.kind === "set") { + } else if (kind === "set") { isDuplicate = state.init || state.set; state.set = true; } else { @@ -82314,7 +84525,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -82356,7 +84567,6 @@ module.exports = { type: "problem", docs: { description: "disallow duplicate conditions in if-else-if chains", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-dupe-else-if" }, @@ -82429,7 +84639,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -82441,8 +84651,6 @@ const SET_KIND = /^(?:init|set)$/u; */ class ObjectInfo { - // eslint-disable-next-line jsdoc/require-description - /** * @param {ObjectInfo|null} upper The information of the outer object. * @param {ASTNode} node The ObjectExpression node of this information. @@ -82511,7 +84719,6 @@ module.exports = { type: "problem", docs: { description: "disallow duplicate keys in object literals", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-dupe-keys" }, @@ -82579,7 +84786,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -82589,7 +84796,6 @@ module.exports = { type: "problem", docs: { description: "disallow duplicate case labels", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-duplicate-case" }, @@ -82680,9 +84886,12 @@ function isImportExportSpecifier(importExportType, type) { function getImportExportType(node) { if (node.specifiers && node.specifiers.length > 0) { const nodeSpecifiers = node.specifiers; - const index = nodeSpecifiers.findIndex(({ - type - }) => isImportExportSpecifier(type, "named") || isImportExportSpecifier(type, "namespace")); + const index = nodeSpecifiers.findIndex(_ref => { + let { + type + } = _ref; + return isImportExportSpecifier(type, "named") || isImportExportSpecifier(type, "namespace"); + }); const i = index > -1 ? index : 0; return nodeSpecifiers[i].type; } @@ -82749,11 +84958,17 @@ function shouldReportImportExport(node, previousNodes) { function getNodesByDeclarationType(nodes, type) { - return nodes.filter(({ - declarationType - }) => declarationType === type).map(({ - node - }) => node); + return nodes.filter(_ref2 => { + let { + declarationType + } = _ref2; + return declarationType === type; + }).map(_ref3 => { + let { + node + } = _ref3; + return node; + }); } /** * Returns the name of the module imported or re-exported. @@ -82864,7 +85079,6 @@ module.exports = { type: "problem", docs: { description: "disallow duplicate module imports", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/no-duplicate-imports" }, @@ -82916,7 +85130,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); +const astUtils = __webpack_require__(548); const FixTracker = __webpack_require__(662); //------------------------------------------------------------------------------ // Rule Definition @@ -82928,7 +85142,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow `else` blocks after `return` statements in `if` statements", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-else-return" }, @@ -82978,21 +85191,30 @@ module.exports = { * Redeclaring any of these would cause a syntax error, except for the implicit variables. */ - const declaredVariables = scope.variables.filter(({ - defs - }) => defs.length > 0); + const declaredVariables = scope.variables.filter(_ref => { + let { + defs + } = _ref; + return defs.length > 0; + }); - if (declaredVariables.some(({ - name - }) => names.includes(name))) { + if (declaredVariables.some(_ref2 => { + let { + name + } = _ref2; + return names.includes(name); + })) { return false; } // Redeclaring a catch variable would also cause a syntax error. if (scope !== functionScope && scope.upper.type === "catch") { - if (scope.upper.variables.some(({ - name - }) => names.includes(name))) { + if (scope.upper.variables.some(_ref3 => { + let { + name + } = _ref3; + return names.includes(name); + })) { return false; } } @@ -83003,14 +85225,20 @@ module.exports = { */ - const usedImplicitVariables = scope.variables.filter(({ - defs, - references - }) => defs.length === 0 && references.length > 0); + const usedImplicitVariables = scope.variables.filter(_ref4 => { + let { + defs, + references + } = _ref4; + return defs.length === 0 && references.length > 0; + }); - if (usedImplicitVariables.some(({ - name - }) => names.includes(name))) { + if (usedImplicitVariables.some(_ref5 => { + let { + name + } = _ref5; + return names.includes(name); + })) { return false; } /* @@ -83033,15 +85261,21 @@ module.exports = { if (scope !== functionScope) { const scopeNodeRange = scope.block.range; - const variablesToCheck = functionScope.variables.filter(({ - name - }) => names.includes(name)); + const variablesToCheck = functionScope.variables.filter(_ref6 => { + let { + name + } = _ref6; + return names.includes(name); + }); - if (variablesToCheck.some(v => v.defs.some(({ - node: { - range - } - }) => scopeNodeRange[0] <= range[0] && range[1] <= scopeNodeRange[1]))) { + if (variablesToCheck.some(v => v.defs.some(_ref7 => { + let { + node: { + range + } + } = _ref7; + return scopeNodeRange[0] <= range[0] && range[1] <= scopeNodeRange[1]; + }))) { return false; } } @@ -83066,9 +85300,12 @@ module.exports = { return true; } - const elseBlockScope = scope.childScopes.find(({ - block - }) => block === node); + const elseBlockScope = scope.childScopes.find(_ref8 => { + let { + block + } = _ref8; + return block === node; + }); if (!elseBlockScope) { // ecmaVersion < 6, `else` block statement cannot have its own scope, no possible collisions. @@ -83081,9 +85318,12 @@ module.exports = { */ - const namesToCheck = elseBlockScope.variables.map(({ - name - }) => name); + const namesToCheck = elseBlockScope.variables.map(_ref9 => { + let { + name + } = _ref9; + return name; + }); return isSafeToDeclare(namesToCheck, scope); } /** @@ -83335,7 +85575,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Public Interface //------------------------------------------------------------------------------ @@ -83448,7 +85688,7 @@ module.exports = FixTracker; // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -83458,7 +85698,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow empty block statements", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-empty" }, @@ -83544,17 +85783,14 @@ module.exports = { /* * plain-English description of the following regexp: * 0. `^` fix the match at the beginning of the string - * 1. `\/`: the `/` that begins the regexp - * 2. `([^\\[]|\\.|\[([^\\\]]|\\.)+\])*`: regexp contents; 0 or more of the following - * 2.0. `[^\\[]`: any character that's not a `\` or a `[` (anything but escape sequences and character classes) - * 2.1. `\\.`: an escape sequence - * 2.2. `\[([^\\\]]|\\.)+\]`: a character class that isn't empty - * 3. `\/` the `/` that ends the regexp - * 4. `[gimuy]*`: optional regexp flags - * 5. `$`: fix the match at the end of the string + * 1. `([^\\[]|\\.|\[([^\\\]]|\\.)+\])*`: regexp contents; 0 or more of the following + * 1.0. `[^\\[]`: any character that's not a `\` or a `[` (anything but escape sequences and character classes) + * 1.1. `\\.`: an escape sequence + * 1.2. `\[([^\\\]]|\\.)+\]`: a character class that isn't empty + * 2. `$`: fix the match at the end of the string */ -const regex = /^\/([^\\[]|\\.|\[([^\\\]]|\\.)+\])*\/[gimuys]*$/u; //------------------------------------------------------------------------------ +const regex = /^([^\\[]|\\.|\[([^\\\]]|\\.)+\])*$/u; //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -83563,7 +85799,6 @@ module.exports = { type: "problem", docs: { description: "disallow empty character classes in regular expressions", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-empty-character-class" }, @@ -83574,12 +85809,9 @@ module.exports = { }, create(context) { - const sourceCode = context.getSourceCode(); return { - Literal(node) { - const token = sourceCode.getFirstToken(node); - - if (token.type === "RegularExpression" && !regex.test(token.value)) { + "Literal[regex]"(node) { + if (!regex.test(node.regex.pattern)) { context.report({ node, messageId: "unexpected" @@ -83605,7 +85837,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -83681,7 +85913,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow empty functions", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-empty-function" }, @@ -83766,7 +85997,6 @@ module.exports = { type: "problem", docs: { description: "disallow empty destructuring patterns", - category: "Best Practices", recommended: true, url: "https://eslint.org/docs/rules/no-empty-pattern" }, @@ -83826,7 +86056,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow `null` comparisons without type-checking operators", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-eq-null" }, @@ -83867,7 +86096,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -83894,7 +86123,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow the use of `eval()`", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-eval" }, @@ -84084,6 +86312,10 @@ module.exports = { "FunctionExpression:exit": exitVarScope, ArrowFunctionExpression: enterVarScope, "ArrowFunctionExpression:exit": exitVarScope, + "PropertyDefinition > *.value": enterVarScope, + "PropertyDefinition > *.value:exit": exitVarScope, + StaticBlock: enterVarScope, + "StaticBlock:exit": exitVarScope, ThisExpression(node) { if (!isMember(node.parent, "eval")) { @@ -84122,7 +86354,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -84132,7 +86364,6 @@ module.exports = { type: "problem", docs: { description: "disallow reassigning exceptions in `catch` clauses", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-ex-assign" }, @@ -84180,9 +86411,9 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); +const astUtils = __webpack_require__(548); -const globals = __webpack_require__(436); //------------------------------------------------------------------------------ +const globals = __webpack_require__(492); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -84192,7 +86423,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow extending native types", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-extend-native" }, @@ -84333,7 +86563,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -84347,7 +86577,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow unnecessary calls to `.bind()`", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-extra-bind" }, @@ -84414,7 +86643,10 @@ module.exports = { return null; } - return tokenPairs.map(([start, end]) => fixer.removeRange([start.range[0], end.range[1]])); + return tokenPairs.map(_ref => { + let [start, end] = _ref; + return fixer.removeRange([start.range[0], end.range[1]]); + }); } }); @@ -84522,7 +86754,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); +const astUtils = __webpack_require__(548); const eslintUtils = __webpack_require__(501); @@ -84535,7 +86767,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow unnecessary boolean casts", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-extra-boolean-cast" }, @@ -84588,7 +86819,8 @@ module.exports = { function isInBooleanContext(node) { - return isBooleanFunctionOrConstructorCall(node.parent) && node === node.parent.arguments[0] || BOOLEAN_NODE_TYPES.indexOf(node.parent.type) !== -1 && node === node.parent.test || node.parent.type === "UnaryExpression" && node.parent.operator === "!"; + return isBooleanFunctionOrConstructorCall(node.parent) && node === node.parent.arguments[0] || BOOLEAN_NODE_TYPES.indexOf(node.parent.type) !== -1 && node === node.parent.test || // ! + node.parent.type === "UnaryExpression" && node.parent.operator === "!"; } /** * Checks whether the node is a context that should report an error @@ -84634,6 +86866,7 @@ module.exports = { * For example, if the parent is `ConditionalExpression`, `previousNode` must be its `test` child. * @param {ASTNode} previousNode Previous node. * @param {ASTNode} node The node to check. + * @throws {Error} (Unreachable.) * @returns {boolean} `true` if the node needs to be parenthesized. */ @@ -84682,7 +86915,7 @@ module.exports = { /* istanbul ignore next */ default: - throw new Error(`Unexpected parent type: ${parent.type}`); + throw new Error("Unexpected parent type: ".concat(parent.type)); } } @@ -84705,7 +86938,7 @@ module.exports = { } if (needsParens(parent, node.argument)) { - return fixer.replaceText(parent, `(${sourceCode.getText(node.argument)})`); + return fixer.replaceText(parent, "(".concat(sourceCode.getText(node.argument), ")")); } let prefix = ""; @@ -84779,7 +87012,7 @@ module.exports = { if (needsParens(node, argument)) { - return fixer.replaceText(node, `(${sourceCode.getText(argument)})`); + return fixer.replaceText(node, "(".concat(sourceCode.getText(argument), ")")); } return fixer.replaceText(node, sourceCode.getText(argument)); @@ -84811,7 +87044,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -84821,7 +87054,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow unnecessary labels", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-extra-label" }, @@ -84971,14 +87203,13 @@ const { isParenthesized: isParenthesizedRaw } = __webpack_require__(501); -const astUtils = __webpack_require__(547); +const astUtils = __webpack_require__(548); module.exports = { meta: { type: "layout", docs: { description: "disallow unnecessary parentheses", - category: "Possible Errors", recommended: false, url: "https://eslint.org/docs/rules/no-extra-parens" }, @@ -85438,7 +87669,10 @@ module.exports = { const callee = node.callee; if (hasExcessParensWithPrecedence(callee, precedence(node))) { - if (hasDoubleExcessParens(callee) || !(isIIFE(node) || callee.type === "NewExpression" && !isNewExpressionWithParens(callee) && !(node.type === "NewExpression" && !isNewExpressionWithParens(node)) || node.type === "NewExpression" && callee.type === "MemberExpression" && doesMemberExpressionContainCallExpression(callee) || !node.optional && callee.type === "ChainExpression")) { + if (hasDoubleExcessParens(callee) || !(isIIFE(node) || // (new A)(); new (new A)(); + callee.type === "NewExpression" && !isNewExpressionWithParens(callee) && !(node.type === "NewExpression" && !isNewExpressionWithParens(node)) || // new (a().b)(); new (a.b().c); + node.type === "NewExpression" && callee.type === "MemberExpression" && doesMemberExpressionContainCallExpression(callee) || // (a?.b)(); (a?.())(); + !node.optional && callee.type === "ChainExpression")) { report(node.callee); } } @@ -85638,9 +87872,12 @@ module.exports = { upper.reports.push(...reports); } else { // flush remaining reports - reports.forEach(({ - finishReport - }) => finishReport()); + reports.forEach(_ref => { + let { + finishReport + } = _ref; + return finishReport(); + }); } reportsBuffer = upper; @@ -85732,10 +87969,6 @@ module.exports = { CallExpression: checkCallNew, - ClassBody(node) { - node.body.filter(member => member.type === "MethodDefinition" && member.computed && member.key).filter(member => hasExcessParensWithPrecedence(member.key, PRECEDENCE_OF_ASSIGNMENT_EXPR)).forEach(member => report(member.key)); - }, - ConditionalExpression(node) { if (isReturnAssignException(node)) { return; @@ -85915,7 +88148,8 @@ module.exports = { const shouldAllowWrapOnce = isMemberExpInNewCallee(node) && doesMemberExpressionContainCallExpression(node); const nodeObjHasExcessParens = shouldAllowWrapOnce ? hasDoubleExcessParens(node.object) : hasExcessParens(node.object) && !(isImmediateFunctionPrototypeMethodCall(node.parent) && node.parent.callee === node && IGNORE_FUNCTION_PROTOTYPE_METHODS); - if (nodeObjHasExcessParens && precedence(node.object) >= precedence(node) && (node.computed || !(astUtils.isDecimalInteger(node.object) || node.object.type === "Literal" && node.object.regex))) { + if (nodeObjHasExcessParens && precedence(node.object) >= precedence(node) && (node.computed || !(astUtils.isDecimalInteger(node.object) || // RegExp literal is allowed to have parens (#1589) + node.object.type === "Literal" && node.object.regex))) { report(node.object); } @@ -85936,6 +88170,12 @@ module.exports = { } }, + "MethodDefinition[computed=true]"(node) { + if (hasExcessParensWithPrecedence(node.key, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { + report(node.key); + } + }, + NewExpression: checkCallNew, ObjectExpression(node) { @@ -85961,6 +88201,16 @@ module.exports = { } }, + PropertyDefinition(node) { + if (node.computed && hasExcessParensWithPrecedence(node.key, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { + report(node.key); + } + + if (node.value && hasExcessParensWithPrecedence(node.value, PRECEDENCE_OF_ASSIGNMENT_EXPR)) { + report(node.value); + } + }, + RestElement(node) { const argument = node.argument; @@ -86104,7 +88354,7 @@ module.exports = { const FixTracker = __webpack_require__(662); -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -86114,7 +88364,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow unnecessary semicolons", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-extra-semi" }, @@ -86194,7 +88443,7 @@ module.exports = { * @param {Node} node A MethodDefinition node of the start point. * @returns {void} */ - MethodDefinition(node) { + "MethodDefinition, PropertyDefinition, StaticBlock"(node) { checkForPartOfClassBody(sourceCode.getTokenAfter(node)); } @@ -86218,16 +88467,27 @@ module.exports = { const DEFAULT_FALLTHROUGH_COMMENT = /falls?\s?through/iu; /** - * Checks whether or not a given node has a fallthrough comment. - * @param {ASTNode} node A SwitchCase node to get comments. + * Checks whether or not a given case has a fallthrough comment. + * @param {ASTNode} caseWhichFallsThrough SwitchCase node which falls through. + * @param {ASTNode} subsequentCase The case after caseWhichFallsThrough. * @param {RuleContext} context A rule context which stores comments. * @param {RegExp} fallthroughCommentPattern A pattern to match comment to. - * @returns {boolean} `true` if the node has a valid fallthrough comment. + * @returns {boolean} `true` if the case has a valid fallthrough comment. */ -function hasFallthroughComment(node, context, fallthroughCommentPattern) { +function hasFallthroughComment(caseWhichFallsThrough, subsequentCase, context, fallthroughCommentPattern) { const sourceCode = context.getSourceCode(); - const comment = sourceCode.getCommentsBefore(node).pop(); + + if (caseWhichFallsThrough.consequent.length === 1 && caseWhichFallsThrough.consequent[0].type === "BlockStatement") { + const trailingCloseBrace = sourceCode.getLastToken(caseWhichFallsThrough.consequent[0]); + const commentInBlock = sourceCode.getCommentsBefore(trailingCloseBrace).pop(); + + if (commentInBlock && fallthroughCommentPattern.test(commentInBlock.value)) { + return true; + } + } + + const comment = sourceCode.getCommentsBefore(subsequentCase).pop(); return Boolean(comment && fallthroughCommentPattern.test(comment.value)); } /** @@ -86260,7 +88520,6 @@ module.exports = { type: "problem", docs: { description: "disallow fallthrough of `case` statements", - category: "Best Practices", recommended: true, url: "https://eslint.org/docs/rules/no-fallthrough" }, @@ -86312,7 +88571,7 @@ module.exports = { * Checks whether or not there is a fallthrough comment. * And reports the previous fallthrough node if that does not exist. */ - if (fallthroughCase && !hasFallthroughComment(node, context, fallthroughCommentPattern)) { + if (fallthroughCase && !hasFallthroughComment(fallthroughCase, node, context, fallthroughCommentPattern)) { context.report({ messageId: node.test ? "case" : "default", node @@ -86353,7 +88612,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -86363,7 +88622,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow leading or trailing decimal points in numeric literals", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-floating-decimal" }, @@ -86387,7 +88645,7 @@ module.exports = { fix(fixer) { const tokenBefore = sourceCode.getTokenBefore(node); - const needsSpaceBefore = tokenBefore && tokenBefore.range[1] === node.range[0] && !astUtils.canTokensBeAdjacent(tokenBefore, `0${node.raw}`); + const needsSpaceBefore = tokenBefore && tokenBefore.range[1] === node.range[0] && !astUtils.canTokensBeAdjacent(tokenBefore, "0".concat(node.raw)); return fixer.insertTextBefore(node, needsSpaceBefore ? " 0" : "0"); } @@ -86420,7 +88678,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -86430,7 +88688,6 @@ module.exports = { type: "problem", docs: { description: "disallow reassigning `function` declarations", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-func-assign" }, @@ -86506,7 +88763,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow assignments to native objects or read-only global variables", - category: "Best Practices", recommended: true, url: "https://eslint.org/docs/rules/no-global-assign" }, @@ -86542,7 +88798,12 @@ module.exports = { function checkReference(reference, index, references) { const identifier = reference.identifier; - if (reference.init === false && reference.isWrite() && (index === 0 || references[index - 1].identifier !== identifier)) { + if (reference.init === false && reference.isWrite() && ( + /* + * Destructuring assignments can have multiple default value, + * so possibly there are multiple writeable references for the same identifier. + */ + index === 0 || references[index - 1].identifier !== identifier)) { context.report({ node: identifier, messageId: "globalShouldNotBeModified", @@ -86587,7 +88848,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -86737,7 +88998,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow shorthand type conversions", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-implicit-coercion" }, @@ -86803,7 +89063,7 @@ module.exports = { const tokenBefore = sourceCode.getTokenBefore(node); if (tokenBefore && tokenBefore.range[1] === node.range[0] && !astUtils.canTokensBeAdjacent(tokenBefore, recommendation)) { - return fixer.replaceText(node, ` ${recommendation}`); + return fixer.replaceText(node, " ".concat(recommendation)); } return fixer.replaceText(node, recommendation); @@ -86819,7 +89079,7 @@ module.exports = { operatorAllowed = options.allow.indexOf("!!") >= 0; if (!operatorAllowed && options.boolean && isDoubleLogicalNegating(node)) { - const recommendation = `Boolean(${sourceCode.getText(node.argument.argument)})`; + const recommendation = "Boolean(".concat(sourceCode.getText(node.argument.argument), ")"); report(node, recommendation, true); } // ~foo.indexOf(bar) @@ -86829,7 +89089,7 @@ module.exports = { if (!operatorAllowed && options.boolean && isBinaryNegatingOfIndexOf(node)) { // `foo?.indexOf(bar) !== -1` will be true (== found) if the `foo` is nullish. So use `>= 0` in that case. const comparison = node.argument.type === "ChainExpression" ? ">= 0" : "!== -1"; - const recommendation = `${sourceCode.getText(node.argument)} ${comparison}`; + const recommendation = "".concat(sourceCode.getText(node.argument), " ").concat(comparison); report(node, recommendation, false); } // +foo @@ -86837,7 +89097,7 @@ module.exports = { operatorAllowed = options.allow.indexOf("+") >= 0; if (!operatorAllowed && options.number && node.operator === "+" && !isNumeric(node.argument)) { - const recommendation = `Number(${sourceCode.getText(node.argument)})`; + const recommendation = "Number(".concat(sourceCode.getText(node.argument), ")"); report(node, recommendation, true); } }, @@ -86850,7 +89110,7 @@ module.exports = { const nonNumericOperand = !operatorAllowed && options.number && isMultiplyByOne(node) && getNonNumericOperand(node); if (nonNumericOperand) { - const recommendation = `Number(${sourceCode.getText(nonNumericOperand)})`; + const recommendation = "Number(".concat(sourceCode.getText(nonNumericOperand), ")"); report(node, recommendation, true); } // "" + foo @@ -86858,7 +89118,7 @@ module.exports = { operatorAllowed = options.allow.indexOf("+") >= 0; if (!operatorAllowed && options.string && isConcatWithEmptyString(node)) { - const recommendation = `String(${sourceCode.getText(getNonEmptyOperand(node))})`; + const recommendation = "String(".concat(sourceCode.getText(getNonEmptyOperand(node)), ")"); report(node, recommendation, true); } }, @@ -86869,7 +89129,7 @@ module.exports = { if (!operatorAllowed && options.string && isAppendEmptyString(node)) { const code = sourceCode.getText(getNonEmptyOperand(node)); - const recommendation = `${code} = String(${code})`; + const recommendation = "".concat(code, " = String(").concat(code, ")"); report(node, recommendation, true); } }, @@ -86905,7 +89165,7 @@ module.exports = { } const code = sourceCode.getText(node.expressions[0]); - const recommendation = `String(${code})`; + const recommendation = "String(".concat(code, ")"); report(node, recommendation, true); } @@ -86932,7 +89192,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow declarations in the global scope", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-implicit-globals" }, @@ -86995,7 +89254,7 @@ module.exports = { if (isReadonlyEslintGlobalVariable) { report(defNode, "redeclarationOfReadonlyGlobal"); } else { - report(defNode, "globalNonLexicalBinding", def.type === "FunctionName" ? "function" : `'${def.parent.kind}'`); + report(defNode, "globalNonLexicalBinding", def.type === "FunctionName" ? "function" : "'".concat(def.parent.kind, "'")); } } @@ -87004,7 +89263,7 @@ module.exports = { if (isReadonlyEslintGlobalVariable) { report(defNode, "redeclarationOfReadonlyGlobal"); } else { - report(defNode, "globalLexicalBinding", def.type === "ClassName" ? "class" : `'${def.parent.kind}'`); + report(defNode, "globalLexicalBinding", def.type === "ClassName" ? "class" : "'".concat(def.parent.kind, "'")); } } } @@ -87052,7 +89311,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); +const astUtils = __webpack_require__(548); const { getStaticValue @@ -87066,7 +89325,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow the use of `eval()`-like methods", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-implied-eval" }, @@ -87187,7 +89445,7 @@ const { findVariable } = __webpack_require__(501); -const astUtils = __webpack_require__(547); +const astUtils = __webpack_require__(548); const WellKnownMutationFunctions = { Object: /^(?:assign|definePropert(?:y|ies)|freeze|setPrototypeOf)$/u, @@ -87307,7 +89565,6 @@ module.exports = { type: "problem", docs: { description: "disallow assigning to imported bindings", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-import-assign" }, @@ -87378,7 +89635,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -87388,7 +89645,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow inline comments after code", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-inline-comments" }, @@ -87485,19 +89741,46 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ -const validParent = new Set(["Program", "ExportNamedDeclaration", "ExportDefaultDeclaration"]); +const validParent = new Set(["Program", "StaticBlock", "ExportNamedDeclaration", "ExportDefaultDeclaration"]); const validBlockStatementParent = new Set(["FunctionDeclaration", "FunctionExpression", "ArrowFunctionExpression"]); +/** + * Finds the nearest enclosing context where this rule allows declarations and returns its description. + * @param {ASTNode} node Node to search from. + * @returns {string} Description. One of "program", "function body", "class static block body". + */ + +function getAllowedBodyDescription(node) { + let { + parent + } = node; + + while (parent) { + if (parent.type === "StaticBlock") { + return "class static block body"; + } + + if (astUtils.isFunction(parent)) { + return "function body"; + } + + ({ + parent + } = parent); + } + + return "program"; +} + module.exports = { meta: { type: "problem", docs: { description: "disallow variable or `function` declarations in nested blocks", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-inner-declarations" }, @@ -87526,13 +89809,12 @@ module.exports = { return; } - const upperFunction = astUtils.getUpperFunction(parent); context.report({ node, messageId: "moveDeclToRoot", data: { type: node.type === "FunctionDeclaration" ? "function" : "variable", - body: upperFunction === null ? "program" : "function body" + body: getAllowedBodyDescription(node) } }); } @@ -87564,10 +89846,10 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const RegExpValidator = __webpack_require__(651).RegExpValidator; +const RegExpValidator = (__webpack_require__(651).RegExpValidator); const validator = new RegExpValidator(); -const validFlags = /[gimuys]/gu; +const validFlags = /[dgimsuy]/gu; const undefined1 = void 0; //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -87577,7 +89859,6 @@ module.exports = { type: "problem", docs: { description: "disallow invalid regular expression strings in `RegExp` constructors", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-invalid-regexp" }, @@ -87606,7 +89887,7 @@ module.exports = { const temp = options.allowConstructorFlags.join("").replace(validFlags, ""); if (temp) { - allowedFlags = new RegExp(`[${temp}]`, "giu"); + allowedFlags = new RegExp("[".concat(temp, "]"), "giu"); } } /** @@ -87671,7 +89952,7 @@ module.exports = { validator.validateFlags(flags); return null; } catch { - return `Invalid flags supplied to RegExp constructor '${flags}'`; + return "Invalid flags supplied to RegExp constructor '".concat(flags, "'"); } } @@ -87720,7 +90001,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -87730,7 +90011,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow `this` keywords outside of classes or class-like objects", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-invalid-this" }, @@ -87827,6 +90107,12 @@ module.exports = { "FunctionDeclaration:exit": exitFunction, FunctionExpression: enterFunction, "FunctionExpression:exit": exitFunction, + // Field initializers are implicit functions. + "PropertyDefinition > *.value": enterFunction, + "PropertyDefinition > *.value:exit": exitFunction, + // Class static blocks are implicit functions. + StaticBlock: enterFunction, + "StaticBlock:exit": exitFunction, // Reports if `this` of the current context is invalid. ThisExpression(node) { @@ -87859,7 +90145,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Constants //------------------------------------------------------------------------------ @@ -87876,7 +90162,6 @@ module.exports = { type: "problem", docs: { description: "disallow irregular whitespace", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-irregular-whitespace" }, @@ -87928,11 +90213,14 @@ module.exports = { function removeWhitespaceError(node) { const locStart = node.loc.start; const locEnd = node.loc.end; - errors = errors.filter(({ - loc: { - start: errorLocStart - } - }) => errorLocStart.line < locStart.line || errorLocStart.line === locStart.line && errorLocStart.column < locStart.column || errorLocStart.line === locEnd.line && errorLocStart.column >= locEnd.column || errorLocStart.line > locEnd.line); + errors = errors.filter(_ref => { + let { + loc: { + start: errorLocStart + } + } = _ref; + return errorLocStart.line < locStart.line || errorLocStart.line === locStart.line && errorLocStart.column < locStart.column || errorLocStart.line === locEnd.line && errorLocStart.column >= locEnd.column || errorLocStart.line > locEnd.line; + }); } /** * Checks identifier or literal nodes for errors that we are choosing to ignore and calls the relevant methods to remove the errors @@ -88111,7 +90399,7 @@ module.exports = { const { getStaticPropertyName -} = __webpack_require__(547); //------------------------------------------------------------------------------ +} = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -88121,7 +90409,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow the use of the `__iterator__` property", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-iterator" }, @@ -88160,7 +90447,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -88170,7 +90457,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow labels that share a name with a variable", - category: "Variables", recommended: false, url: "https://eslint.org/docs/rules/no-label-var" }, @@ -88234,7 +90520,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -88244,7 +90530,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow labeled statements", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-labels" }, @@ -88397,7 +90682,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow unnecessary nested blocks", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-lone-blocks" }, @@ -88419,7 +90703,7 @@ module.exports = { */ function report(node) { - const messageId = node.parent.type === "BlockStatement" ? "redundantNestedBlock" : "redundantBlock"; + const messageId = node.parent.type === "BlockStatement" || node.parent.type === "StaticBlock" ? "redundantNestedBlock" : "redundantBlock"; context.report({ node, messageId @@ -88433,7 +90717,7 @@ module.exports = { function isLoneBlock(node) { - return node.parent.type === "BlockStatement" || node.parent.type === "Program" || // Don't report blocks in switch cases if the block is the only statement of the case. + return node.parent.type === "BlockStatement" || node.parent.type === "StaticBlock" || node.parent.type === "Program" || // Don't report blocks in switch cases if the block is the only statement of the case. node.parent.type === "SwitchCase" && !(node.parent.consequent[0] === node && node.parent.consequent.length === 1); } /** @@ -88477,7 +90761,7 @@ module.exports = { if (loneBlocks.length > 0 && loneBlocks[loneBlocks.length - 1] === node) { loneBlocks.pop(); report(node); - } else if (node.parent.type === "BlockStatement" && node.parent.body.length === 1) { + } else if ((node.parent.type === "BlockStatement" || node.parent.type === "StaticBlock") && node.parent.body.length === 1) { report(node); } } @@ -88522,7 +90806,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow `if` statements as the only statement in `else` blocks", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-lonely-if" }, @@ -88725,7 +91008,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow function declarations that contain unsafe references inside loop statements", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-loop-func" }, @@ -88742,7 +91024,7 @@ module.exports = { * - has a loop node in ancestors. * - has any references which refers to an unsafe variable. * @param {ASTNode} node The AST node to check. - * @returns {boolean} Whether or not the node is within a loop. + * @returns {void} */ function checkForLoops(node) { const loopNode = getContainingLoopNode(node); @@ -88759,7 +91041,7 @@ module.exports = { node, messageId: "unsafeRefs", data: { - varNames: `'${unsafeRefs.join("', '")}'` + varNames: "'".concat(unsafeRefs.join("', '"), "'") } }); } @@ -88792,8 +91074,7 @@ module.exports = { type: "problem", docs: { description: "disallow literal numbers that lose precision", - category: "Possible Errors", - recommended: false, + recommended: true, url: "https://eslint.org/docs/rules/no-loss-of-precision" }, schema: [], @@ -88861,7 +91142,7 @@ module.exports = { function addDecimalPointToNumber(stringNumber) { - return `${stringNumber.slice(0, 1)}.${stringNumber.slice(1)}`; + return "".concat(stringNumber.slice(0, 1), ".").concat(stringNumber.slice(1)); } /** * Returns the number stripped of leading zeros @@ -88935,7 +91216,7 @@ module.exports = { const normalizedNumber = stringNumber.includes(".") ? normalizeFloat(originalCoefficient) : normalizeInteger(originalCoefficient); const normalizedCoefficient = normalizedNumber.coefficient; const magnitude = splitNumber.length > 1 ? parseInt(splitNumber[1], 10) + normalizedNumber.magnitude : normalizedNumber.magnitude; - return `${normalizedCoefficient}e${magnitude}`; + return "".concat(normalizedCoefficient, "e").concat(magnitude); } /** * Checks that the user-intended base ten number equals the actual number after is has been converted to the Number type @@ -88993,7 +91274,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); // Maximum array length by the ECMAScript Specification. +const astUtils = __webpack_require__(548); // Maximum array length by the ECMAScript Specification. const MAX_ARRAY_LENGTH = 2 ** 32 - 1; //------------------------------------------------------------------------------ @@ -89019,7 +91300,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow magic numbers", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-magic-numbers" }, @@ -89161,7 +91441,7 @@ module.exports = { if (node.parent.type === "UnaryExpression" && node.parent.operator === "-") { fullNumberNode = node.parent; value = -node.value; - raw = `-${node.raw}`; + raw = "-".concat(node.raw); } else { fullNumberNode = node; value = node.value; @@ -89301,7 +91581,6 @@ module.exports = { type: "problem", docs: { description: "disallow characters which are made with multiple code points in character class syntax", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-misleading-character-class" }, @@ -89508,7 +91787,7 @@ module.exports = function isSurrogatePair(lead, tail) { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -89529,7 +91808,8 @@ const TARGET_NODE_TYPE = /^(?:Binary|Logical|Conditional)Expression$/u; * @returns {Object} Normalized option object. */ -function normalizeOptions(options = {}) { +function normalizeOptions() { + let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; const hasGroups = options.groups && options.groups.length > 0; const groups = hasGroups ? options.groups : DEFAULT_GROUPS; const allowSamePrecedence = options.allowSamePrecedence !== false; @@ -89540,7 +91820,7 @@ function normalizeOptions(options = {}) { } /** * Checks whether any group which includes both given operator exists or not. - * @param {Array.} groups A list of groups to check. + * @param {Array} groups A list of groups to check. * @param {string} left An operator. * @param {string} right Another operator. * @returns {boolean} `true` if such group existed. @@ -89571,7 +91851,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow mixed binary operators", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-mixed-operators" }, @@ -89598,7 +91877,7 @@ module.exports = { additionalProperties: false }], messages: { - unexpectedMixedOperator: "Unexpected mix of '{{leftOperator}}' and '{{rightOperator}}'." + unexpectedMixedOperator: "Unexpected mix of '{{leftOperator}}' and '{{rightOperator}}'. Use parentheses to clarify the intended order of operations." } }, @@ -89703,6 +91982,7 @@ module.exports = { /** * @fileoverview Rule to enforce grouped require statements for Node.JS * @author Raphael Pigulla + * @deprecated in ESLint v7.0.0 */ //------------------------------------------------------------------------------ // Rule Definition @@ -89715,7 +91995,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow `require` calls to be mixed with regular variable declarations", - category: "Node.js and CommonJS", recommended: false, url: "https://eslint.org/docs/rules/no-mixed-requires" }, @@ -89915,7 +92194,6 @@ module.exports = { type: "layout", docs: { description: "disallow mixed spaces and tabs for indentation", - category: "Stylistic Issues", recommended: true, url: "https://eslint.org/docs/rules/no-mixed-spaces-and-tabs" }, @@ -90026,7 +92304,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow use of chained assignment expressions", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-multi-assign" }, @@ -90052,15 +92329,18 @@ module.exports = { const options = context.options[0] || { ignoreNonDeclaration: false }; - const targetParent = options.ignoreNonDeclaration ? ["VariableDeclarator"] : ["AssignmentExpression", "VariableDeclarator"]; + const selectors = ["VariableDeclarator > AssignmentExpression.init", "PropertyDefinition > AssignmentExpression.value"]; + + if (!options.ignoreNonDeclaration) { + selectors.push("AssignmentExpression > AssignmentExpression.right"); + } + return { - AssignmentExpression(node) { - if (targetParent.indexOf(node.parent.type) !== -1) { - context.report({ - node, - messageId: "unexpectedChain" - }); - } + [selectors](node) { + context.report({ + node, + messageId: "unexpectedChain" + }); } }; @@ -90079,7 +92359,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -90089,7 +92369,6 @@ module.exports = { type: "layout", docs: { description: "disallow multiple spaces", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-multi-spaces" }, @@ -90136,7 +92415,7 @@ module.exports = { function formatReportedCommentValue(token) { const valueLines = token.value.split("\n"); const value = valueLines[0]; - const formattedValue = `${value.slice(0, 12)}...`; + const formattedValue = "".concat(value.slice(0, 12), "..."); return valueLines.length === 1 && value.length <= 12 ? value : formattedValue; } //-------------------------------------------------------------------------- // Public @@ -90173,9 +92452,9 @@ module.exports = { let displayValue; if (rightToken.type === "Block") { - displayValue = `/*${formatReportedCommentValue(rightToken)}*/`; + displayValue = "/*".concat(formatReportedCommentValue(rightToken), "*/"); } else if (rightToken.type === "Line") { - displayValue = `//${formatReportedCommentValue(rightToken)}`; + displayValue = "//".concat(formatReportedCommentValue(rightToken)); } else { displayValue = rightToken.value; } @@ -90213,7 +92492,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -90223,7 +92502,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow multiline strings", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-multi-str" }, @@ -90281,7 +92559,6 @@ module.exports = { type: "layout", docs: { description: "disallow multiple empty lines", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-multiple-empty-lines" }, @@ -90434,7 +92711,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow assignments to native objects or read-only global variables", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-native-reassign" }, @@ -90472,7 +92748,12 @@ module.exports = { function checkReference(reference, index, references) { const identifier = reference.identifier; - if (reference.init === false && reference.isWrite() && (index === 0 || references[index - 1].identifier !== identifier)) { + if (reference.init === false && reference.isWrite() && ( + /* + * Destructuring assignments can have multiple default value, + * so possibly there are multiple writeable references for the same identifier. + */ + index === 0 || references[index - 1].identifier !== identifier)) { context.report({ node: identifier, messageId: "nativeReassign", @@ -90522,7 +92803,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow negated conditions", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-negated-condition" }, @@ -90623,7 +92903,6 @@ module.exports = { type: "problem", docs: { description: "disallow negating the left operand in `in` expressions", - category: "Possible Errors", recommended: false, url: "https://eslint.org/docs/rules/no-negated-in-lhs" }, @@ -90669,7 +92948,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow nested ternary expressions", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-nested-ternary" }, @@ -90714,7 +92992,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow `new` operators outside of assignments or comparisons", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-new" }, @@ -90740,7 +93017,7 @@ module.exports = { /***/ }), /* 715 */ -/***/ ((module) => { +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; /** @@ -90748,6 +93025,15 @@ module.exports = { * @author Ilya Volodin */ //------------------------------------------------------------------------------ +// Requirements +//------------------------------------------------------------------------------ + +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + + +const callMethods = new Set(["apply", "bind", "call"]); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -90756,7 +93042,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow `new` operators with the `Function` object", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-new-func" }, @@ -90778,10 +93063,23 @@ module.exports = { const { parent } = node; + let evalNode; - if (parent && (parent.type === "NewExpression" || parent.type === "CallExpression") && node === parent.callee) { + if (parent) { + if (node === parent.callee && (parent.type === "NewExpression" || parent.type === "CallExpression")) { + evalNode = parent; + } else if (parent.type === "MemberExpression" && node === parent.object && callMethods.has(astUtils.getStaticPropertyName(parent))) { + const maybeCallee = parent.parent.type === "ChainExpression" ? parent.parent : parent; + + if (maybeCallee.parent.type === "CallExpression" && maybeCallee.parent.callee === maybeCallee) { + evalNode = maybeCallee.parent; + } + } + } + + if (evalNode) { context.report({ - node: parent, + node: evalNode, messageId: "noFunctionConstructor" }); } @@ -90807,7 +93105,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -90817,7 +93115,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow `Object` constructors", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-new-object" }, @@ -90857,6 +93154,7 @@ module.exports = { /** * @fileoverview Rule to disallow use of new operator with the `require` function * @author Wil Moore III + * @deprecated in ESLint v7.0.0 */ //------------------------------------------------------------------------------ // Rule Definition @@ -90869,7 +93167,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow `new` operators with calls to `require`", - category: "Node.js and CommonJS", recommended: false, url: "https://eslint.org/docs/rules/no-new-require" }, @@ -90913,7 +93210,6 @@ module.exports = { type: "problem", docs: { description: "disallow `new` operators with the `Symbol` object", - category: "ECMAScript 6", recommended: true, url: "https://eslint.org/docs/rules/no-new-symbol" }, @@ -90967,7 +93263,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow `new` operators with the `String`, `Number`, and `Boolean` objects", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-new-wrappers" }, @@ -91019,7 +93314,7 @@ const QUICK_TEST_REGEX = /\\[89]/u; */ function getUnicodeEscape(character) { - return `\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`; + return "\\u".concat(character.charCodeAt(0).toString(16).padStart(4, "0")); } //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -91030,11 +93325,10 @@ module.exports = { type: "suggestion", docs: { description: "disallow `\\8` and `\\9` escape sequences in string literals", - category: "Best Practices", - recommended: false, - url: "https://eslint.org/docs/rules/no-nonoctal-decimal-escape", - suggestion: true + recommended: true, + url: "https://eslint.org/docs/rules/no-nonoctal-decimal-escape" }, + hasSuggestions: true, schema: [], messages: { decimalEscape: "Don't use '{{decimalEscape}}' escape sequence.", @@ -91099,7 +93393,7 @@ module.exports = { * an octal escape while fixing a decimal escape, we provide different suggestions. */ suggest.push(createSuggestion( // "\0\8" -> "\u00008" - "refactor", [decimalEscapeRangeStart - previousEscape.length, decimalEscapeRangeEnd], `${getUnicodeEscape("\0")}${decimalEscape[1]}`), createSuggestion( // "\8" -> "\u0038" + "refactor", [decimalEscapeRangeStart - previousEscape.length, decimalEscapeRangeEnd], "".concat(getUnicodeEscape("\0")).concat(decimalEscape[1])), createSuggestion( // "\8" -> "\u0038" "refactor", decimalEscapeRange, getUnicodeEscape(decimalEscape[1]))); } else { suggest.push(createSuggestion( // "\8" -> "8" @@ -91107,7 +93401,7 @@ module.exports = { } suggest.push(createSuggestion( // "\8" -> "\\8" - "escapeBackslash", decimalEscapeRange, `\\${decimalEscape}`)); + "escapeBackslash", decimalEscapeRange, "\\".concat(decimalEscape))); context.report({ node, loc: { @@ -91147,7 +93441,7 @@ const { ReferenceTracker } = __webpack_require__(501); -const getPropertyName = __webpack_require__(547).getStaticPropertyName; //------------------------------------------------------------------------------ +const getPropertyName = (__webpack_require__(548).getStaticPropertyName); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -91179,7 +93473,6 @@ module.exports = { type: "problem", docs: { description: "disallow calling global object properties as functions", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-obj-calls" }, @@ -91245,7 +93538,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow octal literals", - category: "Best Practices", recommended: true, url: "https://eslint.org/docs/rules/no-octal" }, @@ -91289,7 +93581,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow octal escape sequences in string literals", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-octal-escape" }, @@ -91344,7 +93635,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow reassigning `function` parameters", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-param-reassign" }, @@ -91494,7 +93784,12 @@ module.exports = { function checkReference(reference, index, references) { const identifier = reference.identifier; - if (identifier && !reference.init && (index === 0 || references[index - 1].identifier !== identifier)) { + if (identifier && !reference.init && ( + /* + * Destructuring assignments can have multiple default value, + * so possibly there are multiple writeable references for the same identifier. + */ + index === 0 || references[index - 1].identifier !== identifier)) { if (reference.isWrite()) { context.report({ node: identifier, @@ -91555,6 +93850,7 @@ module.exports = { /** * @fileoverview Disallow string concatenation when using __dirname and __filename * @author Nicholas C. Zakas + * @deprecated in ESLint v7.0.0 */ //------------------------------------------------------------------------------ // Rule Definition @@ -91567,7 +93863,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow string concatenation with `__dirname` and `__filename`", - category: "Node.js and CommonJS", recommended: false, url: "https://eslint.org/docs/rules/no-path-concat" }, @@ -91654,7 +93949,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow the unary operators `++` and `--`", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-plusplus" }, @@ -91709,6 +94003,7 @@ module.exports = { /** * @fileoverview Disallow the use of process.env() * @author Vignesh Anand + * @deprecated in ESLint v7.0.0 */ //------------------------------------------------------------------------------ // Rule Definition @@ -91721,7 +94016,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow the use of `process.env`", - category: "Node.js and CommonJS", recommended: false, url: "https://eslint.org/docs/rules/no-process-env" }, @@ -91758,6 +94052,7 @@ module.exports = { /** * @fileoverview Disallow the use of process.exit() * @author Nicholas C. Zakas + * @deprecated in ESLint v7.0.0 */ //------------------------------------------------------------------------------ // Rule Definition @@ -91770,7 +94065,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow the use of `process.exit()`", - category: "Node.js and CommonJS", recommended: false, url: "https://eslint.org/docs/rules/no-process-exit" }, @@ -91866,7 +94160,6 @@ module.exports = { type: "problem", docs: { description: "disallow returning values from Promise executor functions", - category: "Possible Errors", recommended: false, url: "https://eslint.org/docs/rules/no-promise-executor-return" }, @@ -91933,7 +94226,7 @@ module.exports = { const { getStaticPropertyName -} = __webpack_require__(547); //------------------------------------------------------------------------------ +} = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -91943,7 +94236,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow the use of the `__proto__` property", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-proto" }, @@ -91982,7 +94274,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -91992,7 +94284,6 @@ module.exports = { type: "problem", docs: { description: "disallow calling some `Object.prototype` methods directly on objects", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-prototype-builtins" }, @@ -92051,7 +94342,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -92061,7 +94352,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow variable redeclaration", - category: "Best Practices", recommended: true, url: "https://eslint.org/docs/rules/no-redeclare" }, @@ -92194,6 +94484,7 @@ module.exports = { FunctionDeclaration: checkForBlock, FunctionExpression: checkForBlock, ArrowFunctionExpression: checkForBlock, + StaticBlock: checkForBlock, BlockStatement: checkForBlock, ForStatement: checkForBlock, ForInStatement: checkForBlock, @@ -92217,7 +94508,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); +const astUtils = __webpack_require__(548); const regexpp = __webpack_require__(651); //------------------------------------------------------------------------------ // Helpers @@ -92245,7 +94536,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow multiple spaces in regular expressions", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-regex-spaces" }, @@ -92300,10 +94590,13 @@ module.exports = { index } = match; // Report only consecutive spaces that are not in character classes. - if (characterClassNodes.every(({ - start, - end - }) => index < start || end <= index)) { + if (characterClassNodes.every(_ref => { + let { + start, + end + } = _ref; + return index < start || end <= index; + })) { context.report({ node: nodeToReport, messageId: "multipleSpaces", @@ -92316,7 +94609,7 @@ module.exports = { return null; } - return fixer.replaceTextRange([rawPatternStartRange + index, rawPatternStartRange + index + length], ` {${length}}`); + return fixer.replaceTextRange([rawPatternStartRange + index, rawPatternStartRange + index + length], " {".concat(length, "}")); } }); // Report only the first occurrence of consecutive spaces @@ -92393,7 +94686,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow specified names in exports", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/no-restricted-exports" }, @@ -92482,7 +94774,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow specified global variables", - category: "Variables", recommended: false, url: "https://eslint.org/docs/rules/no-restricted-globals" }, @@ -92510,7 +94801,7 @@ module.exports = { }, messages: { defaultMessage: "Unexpected use of '{{name}}'.", - // eslint-disable-next-line eslint-plugin/report-message-format + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period customMessage: "Unexpected use of '{{name}}'. {{customMessage}}" } }, @@ -92663,22 +94954,21 @@ module.exports = { type: "suggestion", docs: { description: "disallow specified modules when loaded by `import`", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/no-restricted-imports" }, messages: { path: "'{{importSource}}' import is restricted from being used.", - // eslint-disable-next-line eslint-plugin/report-message-format + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period pathWithCustomMessage: "'{{importSource}}' import is restricted from being used. {{customMessage}}", patterns: "'{{importSource}}' import is restricted from being used by a pattern.", - // eslint-disable-next-line eslint-plugin/report-message-format + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period patternWithCustomMessage: "'{{importSource}}' import is restricted from being used by a pattern. {{customMessage}}", everything: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted.", - // eslint-disable-next-line eslint-plugin/report-message-format + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period everythingWithCustomMessage: "* import is invalid because '{{importNames}}' from '{{importSource}}' is restricted. {{customMessage}}", importName: "'{{importName}}' import from '{{importSource}}' is restricted.", - // eslint-disable-next-line eslint-plugin/report-message-format + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period importNameWithCustomMessage: "'{{importName}}' import from '{{importSource}}' is restricted. {{customMessage}}" }, schema: { @@ -92720,13 +95010,16 @@ module.exports = { const restrictedPatterns = (isPathAndPatternsObject ? options[0].patterns : []) || []; const restrictedPatternGroups = restrictedPatterns.length > 0 && typeof restrictedPatterns[0] === "string" ? [{ matcher: ignore().add(restrictedPatterns) - }] : restrictedPatterns.map(({ - group, - message - }) => ({ - matcher: ignore().add(group), - customMessage: message - })); // if no imports are restricted we don"t need to check + }] : restrictedPatterns.map(_ref => { + let { + group, + message + } = _ref; + return { + matcher: ignore().add(group), + customMessage: message + }; + }); // if no imports are restricted we don't need to check if (Object.keys(restrictedPaths).length === 0 && restrictedPatternGroups.length === 0) { return {}; @@ -92895,7 +95188,7 @@ module.exports = { /* 737 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -/* provided dependency */ var process = __webpack_require__(445); +/* provided dependency */ var process = __webpack_require__(494); // A simple implementation of make-array function make_array(subject) { return Array.isArray(subject) ? subject : [subject]; @@ -92951,9 +95244,9 @@ const DEFAULT_REPLACER_PREFIX = [// > Trailing spaces are ignored unless they ar // > - and the opening square bracket [, // > - the opening curly brace {, // > These special characters are often called "metacharacters". -[/[\\^$.|*+(){]/g, match => `\\${match}`], [// > [abc] matches any character inside the brackets +[/[\\^$.|*+(){]/g, match => "\\".concat(match)], [// > [abc] matches any character inside the brackets // > (in this case a, b, or c); -/\[([^\]/]*)($|\])/g, (match, p1, p2) => p2 === ']' ? `[${sanitizeRange(p1)}]` : `\\${match}`], [// > a question mark (?) matches a single character +/\[([^\]/]*)($|\])/g, (match, p1, p2) => p2 === ']' ? "[".concat(sanitizeRange(p1), "]") : "\\".concat(match)], [// > a question mark (?) matches a single character /(?!\\)\?/g, () => '[^/]'], // leading slash [// > A leading slash matches the beginning of the pathname. // > For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c". @@ -92999,17 +95292,17 @@ const DEFAULT_REPLACER_SUFFIX = [// starting // 'abc.*' -> skip this rule /(^|[^\\]+)\\\*(?=.+)/g, // '*.js' matches '.js' // '*.js' doesn't match 'abc' -(match, p1) => `${p1}[^\\/]*`], // trailing wildcard +(match, p1) => "".concat(p1, "[^\\/]*")], // trailing wildcard [/(\^|\\\/)?\\\*$/, (match, p1) => { const prefix = p1 // '\^': // '/*' does not match '' // '/*' does not match everything // '\\\/': // 'abc/*' does not match 'abc/' - ? `${p1}[^/]+` // 'a*' matches 'a' + ? "".concat(p1, "[^/]+") // 'a*' matches 'a' // 'a*' matches 'aa' : '[^/]*'; - return `${prefix}(?=$|\\/$)`; + return "".concat(prefix, "(?=$|\\/$)"); }], [// unescape /\\\\\\/g, () => '\\']]; const POSITIVE_REPLACERS = [...DEFAULT_REPLACER_PREFIX, // 'f' @@ -93029,7 +95322,7 @@ const POSITIVE_REPLACERS = [...DEFAULT_REPLACER_PREFIX, // 'f' /(?:[^*/])$/, // 'js*' will not match 'a.js' // 'js/' will not match 'a.js' // 'js' will match 'a.js' and 'a.js/' -match => `${match}(?=$|\\/)`], ...DEFAULT_REPLACER_SUFFIX]; +match => "".concat(match, "(?=$|\\/)")], ...DEFAULT_REPLACER_SUFFIX]; const NEGATIVE_REPLACERS = [...DEFAULT_REPLACER_PREFIX, // #24, #38 // The MISSING rule of [gitignore docs](https://git-scm.com/docs/gitignore) // A negative pattern without a trailing wildcard should not @@ -93037,7 +95330,7 @@ const NEGATIVE_REPLACERS = [...DEFAULT_REPLACER_PREFIX, // #24, #38 // eg: // ['node_modules/*', '!node_modules'] // should ignore `node_modules/a.js` -[/(?:[^*])$/, match => `${match}(?=$|\\/$)`], ...DEFAULT_REPLACER_SUFFIX]; // A simple cache, because an ignore rule only has only one certain meaning +[/(?:[^*])$/, match => "".concat(match, "(?=$|\\/$)")], ...DEFAULT_REPLACER_SUFFIX]; // A simple cache, because an ignore rule only has only one certain meaning const cache = Object.create(null); // @param {pattern} @@ -93081,9 +95374,10 @@ const createRule = (pattern, ignorecase) => { }; class IgnoreBase { - constructor({ - ignorecase = true - } = {}) { + constructor() { + let { + ignorecase = true + } = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; this._rules = []; this._ignorecase = ignorecase; define(this, KEY_IGNORE, true); @@ -93215,6 +95509,7 @@ module.exports = options => new IgnoreBase(options); /** * @fileoverview Restrict usage of specified node modules. * @author Christian Schulz + * @deprecated in ESLint v7.0.0 */ //------------------------------------------------------------------------------ // Rule Definition @@ -93258,7 +95553,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow specified modules when loaded by `require`", - category: "Node.js and CommonJS", recommended: false, url: "https://eslint.org/docs/rules/no-restricted-modules" }, @@ -93278,7 +95572,7 @@ module.exports = { }, messages: { defaultMessage: "'{{name}}' module is restricted from being used.", - // eslint-disable-next-line eslint-plugin/report-message-format + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period customMessage: "'{{name}}' module is restricted from being used. {{customMessage}}", patternMessage: "'{{name}}' module is restricted from being used by a pattern." } @@ -93297,7 +95591,7 @@ module.exports = { } return memo; - }, {}); // if no imports are restricted we don"t need to check + }, {}); // if no imports are restricted we don't need to check if (Object.keys(restrictedPaths).length === 0 && restrictedPatterns.length === 0) { return {}; @@ -93427,7 +95721,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -93437,7 +95731,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow certain properties on certain objects", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-restricted-properties" }, @@ -93480,9 +95773,9 @@ module.exports = { uniqueItems: true }, messages: { - // eslint-disable-next-line eslint-plugin/report-message-format + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period restrictedObjectProperty: "'{{objectName}}.{{propertyName}}' is restricted from being used.{{message}}", - // eslint-disable-next-line eslint-plugin/report-message-format + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period restrictedProperty: "'{{propertyName}}' is restricted from being used.{{message}}" } }, @@ -93537,7 +95830,7 @@ module.exports = { const globalMatchedProperty = globallyRestrictedProperties.get(propertyName); if (matchedObjectProperty) { - const message = matchedObjectProperty.message ? ` ${matchedObjectProperty.message}` : ""; + const message = matchedObjectProperty.message ? " ".concat(matchedObjectProperty.message) : ""; context.report({ node, messageId: "restrictedObjectProperty", @@ -93548,7 +95841,7 @@ module.exports = { } }); } else if (globalMatchedProperty) { - const message = globalMatchedProperty.message ? ` ${globalMatchedProperty.message}` : ""; + const message = globalMatchedProperty.message ? " ".concat(globalMatchedProperty.message) : ""; context.report({ node, messageId: "restrictedProperty", @@ -93620,7 +95913,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow specified syntax", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-restricted-syntax" }, @@ -93647,7 +95939,7 @@ module.exports = { minItems: 0 }, messages: { - // eslint-disable-next-line eslint-plugin/report-message-format + // eslint-disable-next-line eslint-plugin/report-message-format -- Custom message might not end in a period restrictedSyntax: "{{message}}" } }, @@ -93657,7 +95949,7 @@ module.exports = { const isStringFormat = typeof selectorOrObject === "string"; const hasCustomMessage = !isStringFormat && Boolean(selectorOrObject.message); const selector = isStringFormat ? selectorOrObject : selectorOrObject.selector; - const message = hasCustomMessage ? selectorOrObject.message : `Using '${selector}' is not allowed.`; + const message = hasCustomMessage ? selectorOrObject.message : "Using '".concat(selector, "' is not allowed."); return Object.assign(result, { [selector](node) { context.report({ @@ -93688,7 +95980,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -93702,7 +95994,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow assignment operators in `return` statements", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-return-assign" }, @@ -93762,7 +96053,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -93772,7 +96063,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow unnecessary `return await`", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-return-await" }, @@ -93872,12 +96162,10 @@ module.exports = { * @author Ilya Volodin */ -/* jshint scripturl: true */ - -/* eslint no-script-url: 0 */ +/* eslint no-script-url: 0 -- Code is checking to report such URLs */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -93887,7 +96175,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow `javascript:` urls", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-script-url" }, @@ -93946,7 +96233,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -94026,7 +96313,6 @@ module.exports = { type: "problem", docs: { description: "disallow assignments where both sides are exactly the same", - category: "Best Practices", recommended: true, url: "https://eslint.org/docs/rules/no-self-assign" }, @@ -94097,7 +96383,6 @@ module.exports = { type: "problem", docs: { description: "disallow comparisons where both sides are exactly the same", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-self-compare" }, @@ -94152,7 +96437,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -94168,7 +96453,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow comma operators", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-sequences" }, @@ -94287,7 +96571,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); +const astUtils = __webpack_require__(548); const { findVariable @@ -94359,7 +96643,7 @@ function isPropertyDescriptor(node, scope) { function isSetter(node, scope) { const parent = node.parent; - if (parent.kind === "set" && parent.value === node) { + if ((parent.type === "Property" || parent.type === "MethodDefinition") && parent.kind === "set" && parent.value === node) { // Setter in an object literal or in a class return true; } @@ -94396,7 +96680,6 @@ module.exports = { type: "problem", docs: { description: "disallow returning values from setters", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-setter-return" }, @@ -94493,7 +96776,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -94503,7 +96786,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow variable declarations from shadowing variables declared in the outer scope", - category: "Variables", recommended: false, url: "https://eslint.org/docs/rules/no-shadow" }, @@ -94541,7 +96823,7 @@ module.exports = { }; /** * Check if variable name is allowed. - * @param {ASTNode} variable The variable to check. + * @param {ASTNode} variable The variable to check. * @returns {boolean} Whether or not the variable name is allowed. */ @@ -94630,7 +96912,8 @@ module.exports = { const outerDef = scopeVar.defs[0]; const inner = getNameRange(variable); const outer = getNameRange(scopeVar); - return inner && outer && inner[1] < outer[0] && (options.hoist !== "functions" || !outerDef || outerDef.node.type !== "FunctionDeclaration"); + return inner && outer && inner[1] < outer[0] && ( // Excepts FunctionDeclaration if is {"hoist":"function"}. + options.hoist !== "functions" || !outerDef || outerDef.node.type !== "FunctionDeclaration"); } /** * Checks the current context for shadowed variables. @@ -94720,7 +97003,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow identifiers from shadowing restricted names", - category: "Variables", recommended: true, url: "https://eslint.org/docs/rules/no-shadow-restricted-names" }, @@ -94771,7 +97053,6 @@ module.exports = { type: "layout", docs: { description: "disallow spacing between function identifiers and their applications (deprecated)", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-spaced-func" }, @@ -94844,7 +97125,6 @@ module.exports = { type: "problem", docs: { description: "disallow sparse arrays", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-sparse-arrays" }, @@ -94883,9 +97163,8 @@ module.exports = { /** * @fileoverview Rule to check for properties whose identifier ends with the string Sync * @author Matt DuVall + * @deprecated in ESLint v7.0.0 */ - -/* jshint node:true */ //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -94897,7 +97176,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow synchronous methods", - category: "Node.js and CommonJS", recommended: false, url: "https://eslint.org/docs/rules/no-sync" }, @@ -94957,7 +97235,6 @@ module.exports = { type: "layout", docs: { description: "disallow all tabs", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-tabs" }, @@ -95030,7 +97307,6 @@ module.exports = { type: "problem", docs: { description: "disallow template literal placeholder syntax in regular strings", - category: "Possible Errors", recommended: false, url: "https://eslint.org/docs/rules/no-template-curly-in-string" }, @@ -95075,7 +97351,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow ternary operators", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-ternary" }, @@ -95112,7 +97387,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -95137,7 +97412,6 @@ module.exports = { type: "problem", docs: { description: "disallow `this`/`super` before calling `super()` in constructors", - category: "ECMAScript 6", recommended: true, url: "https://eslint.org/docs/rules/no-this-before-super" }, @@ -95398,7 +97672,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -95408,7 +97682,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow throwing literals as exceptions", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-throw-literal" }, @@ -95455,7 +97728,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -95465,7 +97738,6 @@ module.exports = { type: "layout", docs: { description: "disallow trailing whitespace at the end of lines", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-trailing-spaces" }, @@ -95492,8 +97764,8 @@ module.exports = { create(context) { const sourceCode = context.getSourceCode(); const BLANK_CLASS = "[ \t\u00a0\u2000-\u200b\u3000]", - SKIP_BLANK = `^${BLANK_CLASS}*$`, - NONBLANK = `${BLANK_CLASS}+$`; + SKIP_BLANK = "^".concat(BLANK_CLASS, "*$"), + NONBLANK = "".concat(BLANK_CLASS, "+$"); const options = context.options[0] || {}, skipBlankLines = options.skipBlankLines || false, ignoreComments = options.ignoreComments || false; @@ -95649,7 +97921,6 @@ module.exports = { type: "problem", docs: { description: "disallow the use of undeclared variables unless mentioned in `/*global */` comments", - category: "Variables", recommended: true, url: "https://eslint.org/docs/rules/no-undef" }, @@ -95705,7 +97976,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -95715,7 +97986,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow initializing variables to `undefined`", - category: "Variables", recommended: false, url: "https://eslint.org/docs/rules/no-undef-init" }, @@ -95789,7 +98059,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow the use of `undefined` as an identifier", - category: "Variables", recommended: false, url: "https://eslint.org/docs/rules/no-undefined" }, @@ -95868,7 +98137,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow dangling underscores in identifiers", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-underscore-dangle" }, @@ -96103,7 +98371,7 @@ module.exports = { node, messageId: "unexpectedUnderscore", data: { - identifier + identifier: node.key.type === "PrivateIdentifier" ? "#".concat(identifier) : identifier } }); } @@ -96117,6 +98385,7 @@ module.exports = { VariableDeclarator: checkForDanglingUnderscoreInVariableExpression, MemberExpression: checkForDanglingUnderscoreInMemberExpression, MethodDefinition: checkForDanglingUnderscoreInMethod, + PropertyDefinition: checkForDanglingUnderscoreInMethod, Property: checkForDanglingUnderscoreInMethod, FunctionExpression: checkForDanglingUnderscoreInFunction, ArrowFunctionExpression: checkForDanglingUnderscoreInFunction @@ -96138,7 +98407,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -96148,7 +98417,6 @@ module.exports = { type: "problem", docs: { description: "disallow confusing multiline expressions", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-unexpected-multiline" }, @@ -96256,7 +98524,7 @@ module.exports = { //------------------------------------------------------------------------------ const Traverser = __webpack_require__(495), - astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ + astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -96404,7 +98672,6 @@ module.exports = { type: "problem", docs: { description: "disallow unmodified loop conditions", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-unmodified-loop-condition" }, @@ -96608,7 +98875,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); // Operators that always result in a boolean value +const astUtils = __webpack_require__(548); // Operators that always result in a boolean value const BOOLEAN_OPERATORS = new Set(["==", "===", "!=", "!==", ">", ">=", "<", "<=", "in", "instanceof"]); @@ -96631,7 +98898,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow ternary operators when simpler alternatives exist", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-unneeded-ternary" }, @@ -96683,10 +98949,10 @@ module.exports = { if (astUtils.getPrecedence(node) < astUtils.getPrecedence({ type: "UnaryExpression" })) { - return `!(${astUtils.getParenthesisedText(sourceCode, node)})`; + return "!(".concat(astUtils.getParenthesisedText(sourceCode, node), ")"); } - return `!${astUtils.getParenthesisedText(sourceCode, node)}`; + return "!".concat(astUtils.getParenthesisedText(sourceCode, node)); } /** * Tests if a given node always evaluates to a boolean value @@ -96729,7 +98995,7 @@ module.exports = { } // Replace `foo ? true : false` with `foo` if `foo` is guaranteed to be a boolean, or `!!foo` otherwise. - return fixer.replaceText(node, isBooleanExpression(node.test) ? astUtils.getParenthesisedText(sourceCode, node.test) : `!${invertExpression(node.test)}`); + return fixer.replaceText(node, isBooleanExpression(node.test) ? astUtils.getParenthesisedText(sourceCode, node.test) : "!".concat(invertExpression(node.test))); } }); @@ -96739,9 +99005,9 @@ module.exports = { messageId: "unnecessaryConditionalAssignment", fix: fixer => { const shouldParenthesizeAlternate = (astUtils.getPrecedence(node.alternate) < OR_PRECEDENCE || astUtils.isCoalesceExpression(node.alternate)) && !astUtils.isParenthesised(sourceCode, node.alternate); - const alternateText = shouldParenthesizeAlternate ? `(${sourceCode.getText(node.alternate)})` : astUtils.getParenthesisedText(sourceCode, node.alternate); + const alternateText = shouldParenthesizeAlternate ? "(".concat(sourceCode.getText(node.alternate), ")") : astUtils.getParenthesisedText(sourceCode, node.alternate); const testText = astUtils.getParenthesisedText(sourceCode, node.test); - return fixer.replaceText(node, `${testText} || ${alternateText}`); + return fixer.replaceText(node, "".concat(testText, " || ").concat(alternateText)); } }); } @@ -96765,6 +99031,12 @@ module.exports = { // Helpers //------------------------------------------------------------------------------ +/** + * @typedef {Object} ConstructorInfo + * @property {ConstructorInfo | null} upper Info about the constructor that encloses this constructor. + * @property {boolean} hasSuperCall The flag about having `super()` expressions. + */ + /** * Checks whether or not a given variable declarator has the initializer. * @param {ASTNode} node A VariableDeclarator node to check. @@ -96867,7 +99139,6 @@ module.exports = { type: "problem", docs: { description: "disallow unreachable code after `return`, `throw`, `continue`, and `break` statements", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-unreachable" }, @@ -96879,6 +99150,11 @@ module.exports = { create(context) { let currentCodePath = null; + /** @type {ConstructorInfo | null} */ + + let constructorInfo = null; + /** @type {ConsecutiveRange} */ + const range = new ConsecutiveRange(context.getSourceCode()); /** * Reports a given node if it's unreachable. @@ -96889,7 +99165,7 @@ module.exports = { function reportIfUnreachable(node) { let nextNode = null; - if (node && currentCodePath.currentSegments.every(isUnreachable)) { + if (node && (node.type === "PropertyDefinition" || currentCodePath.currentSegments.every(isUnreachable))) { // Store this statement to distinguish consecutive statements. if (range.isEmpty) { range.reset(node); @@ -96970,6 +99246,44 @@ module.exports = { "Program:exit"() { reportIfUnreachable(); + }, + + /* + * Instance fields defined in a subclass are never created if the constructor of the subclass + * doesn't call `super()`, so their definitions are unreachable code. + */ + "MethodDefinition[kind='constructor']"() { + constructorInfo = { + upper: constructorInfo, + hasSuperCall: false + }; + }, + + "MethodDefinition[kind='constructor']:exit"(node) { + const { + hasSuperCall + } = constructorInfo; + constructorInfo = constructorInfo.upper; // skip typescript constructors without the body + + if (!node.value.body) { + return; + } + + const classDefinition = node.parent.parent; + + if (classDefinition.superClass && !hasSuperCall) { + for (const element of classDefinition.body.body) { + if (element.type === "PropertyDefinition" && !element.static) { + reportIfUnreachable(element); + } + } + } + }, + + "CallExpression > Super.callee"() { + if (constructorInfo) { + constructorInfo.hasSuperCall = true; + } } }; @@ -97041,7 +99355,6 @@ module.exports = { type: "problem", docs: { description: "disallow loops with a body that allows only one iteration", - category: "Possible Errors", recommended: false, url: "https://eslint.org/docs/rules/no-unreachable-loop" }, @@ -97151,7 +99464,6 @@ module.exports = { type: "problem", docs: { description: "disallow control flow statements in `finally` blocks", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/no-unsafe-finally" }, @@ -97250,7 +99562,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -97293,11 +99605,10 @@ module.exports = { type: "problem", docs: { description: "disallow negating the left operand of relational operators", - category: "Possible Errors", recommended: true, - url: "https://eslint.org/docs/rules/no-unsafe-negation", - suggestion: true + url: "https://eslint.org/docs/rules/no-unsafe-negation" }, + hasSuggestions: true, schema: [{ type: "object", properties: { @@ -97343,14 +99654,14 @@ module.exports = { const negationToken = sourceCode.getFirstToken(node.left); const fixRange = [negationToken.range[1], node.range[1]]; const text = sourceCode.text.slice(fixRange[0], fixRange[1]); - return fixer.replaceTextRange(fixRange, `(${text})`); + return fixer.replaceTextRange(fixRange, "(".concat(text, ")")); } }, { messageId: "suggestParenthesisedNegation", fix(fixer) { - return fixer.replaceText(node.left, `(${sourceCode.getText(node.left)})`); + return fixer.replaceText(node.left, "(".concat(sourceCode.getText(node.left), ")")); } }] @@ -97392,8 +99703,7 @@ module.exports = { type: "problem", docs: { description: "disallow use of optional chaining in contexts where the `undefined` value is not allowed", - category: "Possible Errors", - recommended: false, + recommended: true, url: "https://eslint.org/docs/rules/no-unsafe-optional-chaining" }, schema: [{ @@ -97622,7 +99932,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow unused expressions", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-unused-expressions" }, @@ -97658,18 +99967,18 @@ module.exports = { allowShortCircuit = config.allowShortCircuit || false, allowTernary = config.allowTernary || false, allowTaggedTemplates = config.allowTaggedTemplates || false, - enforceForJSX = config.enforceForJSX || false; // eslint-disable-next-line jsdoc/require-description - + enforceForJSX = config.enforceForJSX || false; /** + * Has AST suggesting a directive. * @param {ASTNode} node any node * @returns {boolean} whether the given node structurally represents a directive */ function looksLikeDirective(node) { return node.type === "ExpressionStatement" && node.expression.type === "Literal" && typeof node.expression.value === "string"; - } // eslint-disable-next-line jsdoc/require-description - + } /** + * Gets the leading sequence of members in a list that pass the predicate. * @param {Function} predicate ([a] -> Boolean) the function used to make the determination * @param {a[]} list the input list * @returns {a[]} the leading sequence of members in the given list that pass the given predicate @@ -97684,9 +99993,9 @@ module.exports = { } return list.slice(); - } // eslint-disable-next-line jsdoc/require-description - + } /** + * Gets leading directives nodes in a Node body. * @param {ASTNode} node a Program or BlockStatement node * @returns {ASTNode[]} the leading sequence of directive nodes in the given node's body */ @@ -97694,9 +100003,9 @@ module.exports = { function directives(node) { return takeWhile(looksLikeDirective, node.body); - } // eslint-disable-next-line jsdoc/require-description - + } /** + * Detect if a Node is a directive. * @param {ASTNode} node any node * @param {ASTNode[]} ancestors the given node's ancestors * @returns {boolean} whether the given node is considered a directive in its current position @@ -97706,6 +100015,13 @@ module.exports = { function isDirective(node, ancestors) { const parent = ancestors[ancestors.length - 1], grandparent = ancestors[ancestors.length - 2]; + /** + * https://tc39.es/ecma262/#directive-prologue + * + * Only `FunctionBody`, `ScriptBody` and `ModuleBody` can have directive prologue. + * Class static blocks do not have directive prologue. + */ + return (parent.type === "Program" || parent.type === "BlockStatement" && /Function/u.test(grandparent.type)) && directives(parent).indexOf(node) >= 0; } /** @@ -97808,7 +100124,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow unused labels", - category: "Best Practices", recommended: true, url: "https://eslint.org/docs/rules/no-unused-labels" }, @@ -97909,6 +100224,196 @@ module.exports = { /***/ }), /* 773 */ +/***/ ((module) => { + +"use strict"; +/** + * @fileoverview Rule to flag declared but unused private class members + * @author Tim van der Lippe + */ + //------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +module.exports = { + meta: { + type: "problem", + docs: { + description: "disallow unused private class members", + recommended: false, + url: "https://eslint.org/docs/rules/no-unused-private-class-members" + }, + schema: [], + messages: { + unusedPrivateClassMember: "'{{classMemberName}}' is defined but never used." + } + }, + + create(context) { + const trackedClasses = []; + /** + * Check whether the current node is in a write only assignment. + * @param {ASTNode} privateIdentifierNode Node referring to a private identifier + * @returns {boolean} Whether the node is in a write only assignment + * @private + */ + + function isWriteOnlyAssignment(privateIdentifierNode) { + const parentStatement = privateIdentifierNode.parent.parent; + const isAssignmentExpression = parentStatement.type === "AssignmentExpression"; + + if (!isAssignmentExpression && parentStatement.type !== "ForInStatement" && parentStatement.type !== "ForOfStatement" && parentStatement.type !== "AssignmentPattern") { + return false; + } // It is a write-only usage, since we still allow usages on the right for reads + + + if (parentStatement.left !== privateIdentifierNode.parent) { + return false; + } // For any other operator (such as '+=') we still consider it a read operation + + + if (isAssignmentExpression && parentStatement.operator !== "=") { + /* + * However, if the read operation is "discarded" in an empty statement, then + * we consider it write only. + */ + return parentStatement.parent.type === "ExpressionStatement"; + } + + return true; + } //-------------------------------------------------------------------------- + // Public + //-------------------------------------------------------------------------- + + + return { + // Collect all declared members up front and assume they are all unused + ClassBody(classBodyNode) { + const privateMembers = new Map(); + trackedClasses.unshift(privateMembers); + + for (const bodyMember of classBodyNode.body) { + if (bodyMember.type === "PropertyDefinition" || bodyMember.type === "MethodDefinition") { + if (bodyMember.key.type === "PrivateIdentifier") { + privateMembers.set(bodyMember.key.name, { + declaredNode: bodyMember, + isAccessor: bodyMember.type === "MethodDefinition" && (bodyMember.kind === "set" || bodyMember.kind === "get") + }); + } + } + } + }, + + /* + * Process all usages of the private identifier and remove a member from + * `declaredAndUnusedPrivateMembers` if we deem it used. + */ + PrivateIdentifier(privateIdentifierNode) { + const classBody = trackedClasses.find(classProperties => classProperties.has(privateIdentifierNode.name)); // Can't happen, as it is a parser to have a missing class body, but let's code defensively here. + + if (!classBody) { + return; + } // In case any other usage was already detected, we can short circuit the logic here. + + + const memberDefinition = classBody.get(privateIdentifierNode.name); + + if (memberDefinition.isUsed) { + return; + } // The definition of the class member itself + + + if (privateIdentifierNode.parent.type === "PropertyDefinition" || privateIdentifierNode.parent.type === "MethodDefinition") { + return; + } + /* + * Any usage of an accessor is considered a read, as the getter/setter can have + * side-effects in its definition. + */ + + + if (memberDefinition.isAccessor) { + memberDefinition.isUsed = true; + return; + } // Any assignments to this member, except for assignments that also read + + + if (isWriteOnlyAssignment(privateIdentifierNode)) { + return; + } + + const wrappingExpressionType = privateIdentifierNode.parent.parent.type; + const parentOfWrappingExpressionType = privateIdentifierNode.parent.parent.parent.type; // A statement which only increments (`this.#x++;`) + + if (wrappingExpressionType === "UpdateExpression" && parentOfWrappingExpressionType === "ExpressionStatement") { + return; + } + /* + * ({ x: this.#usedInDestructuring } = bar); + * + * But should treat the following as a read: + * ({ [this.#x]: a } = foo); + */ + + + if (wrappingExpressionType === "Property" && parentOfWrappingExpressionType === "ObjectPattern" && privateIdentifierNode.parent.parent.value === privateIdentifierNode.parent) { + return; + } // [...this.#unusedInRestPattern] = bar; + + + if (wrappingExpressionType === "RestElement") { + return; + } // [this.#unusedInAssignmentPattern] = bar; + + + if (wrappingExpressionType === "ArrayPattern") { + return; + } + /* + * We can't delete the memberDefinition, as we need to keep track of which member we are marking as used. + * In the case of nested classes, we only mark the first member we encounter as used. If you were to delete + * the member, then any subsequent usage could incorrectly mark the member of an encapsulating parent class + * as used, which is incorrect. + */ + + + memberDefinition.isUsed = true; + }, + + /* + * Post-process the class members and report any remaining members. + * Since private members can only be accessed in the current class context, + * we can safely assume that all usages are within the current class body. + */ + "ClassBody:exit"() { + const unusedPrivateMembers = trackedClasses.shift(); + + for (const [classMemberName, { + declaredNode, + isUsed + }] of unusedPrivateMembers.entries()) { + if (isUsed) { + continue; + } + + context.report({ + node: declaredNode, + loc: declaredNode.key.loc, + messageId: "unusedPrivateClassMember", + data: { + classMemberName: "#".concat(classMemberName) + } + }); + } + } + + }; + } + +}; + +/***/ }), +/* 774 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -97920,7 +100425,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Typedefs //------------------------------------------------------------------------------ @@ -97941,7 +100446,6 @@ module.exports = { type: "problem", docs: { description: "disallow unused variables", - category: "Variables", recommended: true, url: "https://eslint.org/docs/rules/no-unused-vars" }, @@ -98038,7 +100542,7 @@ module.exports = { pattern = config.varsIgnorePattern.toString(); } - const additional = type ? `. Allowed unused ${type} must match ${pattern}` : ""; + const additional = type ? ". Allowed unused ".concat(type, " must match ").concat(pattern) : ""; return { varName: unusedVar.name, action: "defined", @@ -98054,7 +100558,7 @@ module.exports = { function getAssignedMessageData(unusedVar) { - const additional = config.varsIgnorePattern ? `. Allowed unused vars must match ${config.varsIgnorePattern.toString()}` : ""; + const additional = config.varsIgnorePattern ? ". Allowed unused vars must match ".concat(config.varsIgnorePattern.toString()) : ""; return { varName: unusedVar.name, action: "assigned a value", @@ -98189,6 +100693,33 @@ module.exports = { function isInside(inner, outer) { return inner.range[0] >= outer.range[0] && inner.range[1] <= outer.range[1]; } + /** + * Checks whether a given node is unused expression or not. + * @param {ASTNode} node The node itself + * @returns {boolean} The node is an unused expression. + * @private + */ + + + function isUnusedExpression(node) { + const parent = node.parent; + + if (parent.type === "ExpressionStatement") { + return true; + } + + if (parent.type === "SequenceExpression") { + const isLastExpression = parent.expressions[parent.expressions.length - 1] === node; + + if (!isLastExpression) { + return true; + } + + return isUnusedExpression(parent); + } + + return false; + } /** * If a given reference is left-hand side of an assignment, this gets * the right-hand side node of the assignment. @@ -98209,7 +100740,6 @@ module.exports = { function getRhsNode(ref, prevRhsNode) { const id = ref.identifier; const parent = id.parent; - const grandparent = parent.parent; const refScope = ref.from.variableScope; const varScope = ref.resolved.scope.variableScope; const canBeUsedLater = refScope !== varScope || astUtils.isInLoop(id); @@ -98222,7 +100752,7 @@ module.exports = { return prevRhsNode; } - if (parent.type === "AssignmentExpression" && grandparent.type === "ExpressionStatement" && id === parent.left && !canBeUsedLater) { + if (parent.type === "AssignmentExpression" && isUnusedExpression(parent) && id === parent.left && !canBeUsedLater) { return parent.right; } @@ -98300,33 +100830,6 @@ module.exports = { const funcNode = astUtils.getUpperFunction(id); return funcNode && isInside(funcNode, rhsNode) && isStorableFunction(funcNode, rhsNode); } - /** - * Checks whether a given node is unused expression or not. - * @param {ASTNode} node The node itself - * @returns {boolean} The node is an unused expression. - * @private - */ - - - function isUnusedExpression(node) { - const parent = node.parent; - - if (parent.type === "ExpressionStatement") { - return true; - } - - if (parent.type === "SequenceExpression") { - const isLastExpression = parent.expressions[parent.expressions.length - 1] === node; - - if (!isLastExpression) { - return true; - } - - return isUnusedExpression(parent); - } - - return false; - } /** * Checks whether a given reference is a read to update itself or not. * @param {eslint-scope.Reference} ref A reference to check. @@ -98340,7 +100843,8 @@ module.exports = { const id = ref.identifier; const parent = id.parent; return ref.isRead() && ( // self update. e.g. `a += 1`, `a++` - parent.type === "AssignmentExpression" && parent.left === id && isUnusedExpression(parent) || parent.type === "UpdateExpression" && isUnusedExpression(parent) || rhsNode && isInside(id, rhsNode) && !isInsideOfStorableFunction(id, rhsNode)); + parent.type === "AssignmentExpression" && parent.left === id && isUnusedExpression(parent) || parent.type === "UpdateExpression" && isUnusedExpression(parent) || // in RHS of an assignment for itself. e.g. `a = a + 1` + rhsNode && isInside(id, rhsNode) && !isInsideOfStorableFunction(id, rhsNode)); } /** * Determine if an identifier is used either in for-in loops. @@ -98544,7 +101048,7 @@ module.exports = { }; /***/ }), -/* 774 */ +/* 775 */ /***/ ((module) => { "use strict"; @@ -98583,38 +101087,6 @@ function parseOptions(options) { variables }; } -/** - * Checks whether or not a given variable is a function declaration. - * @param {eslint-scope.Variable} variable A variable to check. - * @returns {boolean} `true` if the variable is a function declaration. - */ - - -function isFunction(variable) { - return variable.defs[0].type === "FunctionName"; -} -/** - * Checks whether or not a given variable is a class declaration in an upper function scope. - * @param {eslint-scope.Variable} variable A variable to check. - * @param {eslint-scope.Reference} reference A reference to check. - * @returns {boolean} `true` if the variable is a class declaration. - */ - - -function isOuterClass(variable, reference) { - return variable.defs[0].type === "ClassName" && variable.scope.variableScope !== reference.from.variableScope; -} -/** - * Checks whether or not a given variable is a variable declaration in an upper function scope. - * @param {eslint-scope.Variable} variable A variable to check. - * @param {eslint-scope.Reference} reference A reference to check. - * @returns {boolean} `true` if the variable is a variable declaration. - */ - - -function isOuterVariable(variable, reference) { - return variable.defs[0].type === "Variable" && variable.scope.variableScope !== reference.from.variableScope; -} /** * Checks whether or not a given location is inside of the range of a given node. * @param {ASTNode} node An node to check. @@ -98627,7 +101099,92 @@ function isInRange(node, location) { return node && node.range[0] <= location && location <= node.range[1]; } /** - * Checks whether or not a given reference is inside of the initializers of a given variable. + * Checks whether or not a given location is inside of the range of a class static initializer. + * Static initializers are static blocks and initializers of static fields. + * @param {ASTNode} node `ClassBody` node to check static initializers. + * @param {number} location A location to check. + * @returns {boolean} `true` if the location is inside of a class static initializer. + */ + + +function isInClassStaticInitializerRange(node, location) { + return node.body.some(classMember => classMember.type === "StaticBlock" && isInRange(classMember, location) || classMember.type === "PropertyDefinition" && classMember.static && classMember.value && isInRange(classMember.value, location)); +} +/** + * Checks whether a given scope is the scope of a a class static initializer. + * Static initializers are static blocks and initializers of static fields. + * @param {eslint-scope.Scope} scope A scope to check. + * @returns {boolean} `true` if the scope is a class static initializer scope. + */ + + +function isClassStaticInitializerScope(scope) { + if (scope.type === "class-static-block") { + return true; + } + + if (scope.type === "class-field-initializer") { + // `scope.block` is PropertyDefinition#value node + const propertyDefinition = scope.block.parent; + return propertyDefinition.static; + } + + return false; +} +/** + * Checks whether a given reference is evaluated in an execution context + * that isn't the one where the variable it refers to is defined. + * Execution contexts are: + * - top-level + * - functions + * - class field initializers (implicit functions) + * - class static blocks (implicit functions) + * Static class field initializers and class static blocks are automatically run during the class definition evaluation, + * and therefore we'll consider them as a part of the parent execution context. + * Example: + * + * const x = 1; + * + * x; // returns `false` + * () => x; // returns `true` + * + * class C { + * field = x; // returns `true` + * static field = x; // returns `false` + * + * method() { + * x; // returns `true` + * } + * + * static method() { + * x; // returns `true` + * } + * + * static { + * x; // returns `false` + * } + * } + * @param {eslint-scope.Reference} reference A reference to check. + * @returns {boolean} `true` if the reference is from a separate execution context. + */ + + +function isFromSeparateExecutionContext(reference) { + const variable = reference.resolved; + let scope = reference.from; // Scope#variableScope represents execution context + + while (variable.scope.variableScope !== scope.variableScope) { + if (isClassStaticInitializerScope(scope.variableScope)) { + scope = scope.variableScope.upper; + } else { + return true; + } + } + + return false; +} +/** + * Checks whether or not a given reference is evaluated during the initialization of its variable. * * This returns `true` in the following cases: * @@ -98636,19 +101193,41 @@ function isInRange(node, location) { * var {a = a} = obj * for (var a in a) {} * for (var a of a) {} - * @param {Variable} variable A variable to check. + * var C = class { [C]; }; + * var C = class { static foo = C; }; + * var C = class { static { foo = C; } }; + * class C extends C {} + * class C extends (class { static foo = C; }) {} + * class C { [C]; } * @param {Reference} reference A reference to check. - * @returns {boolean} `true` if the reference is inside of the initializers. + * @returns {boolean} `true` if the reference is evaluated during the initialization. */ -function isInInitializer(variable, reference) { - if (variable.scope !== reference.from) { +function isEvaluatedDuringInitialization(reference) { + if (isFromSeparateExecutionContext(reference)) { + /* + * Even if the reference appears in the initializer, it isn't evaluated during the initialization. + * For example, `const x = () => x;` is valid. + */ return false; } - let node = variable.identifiers[0].parent; const location = reference.identifier.range[1]; + const definition = reference.resolved.defs[0]; + + if (definition.type === "ClassName") { + // `ClassDeclaration` or `ClassExpression` + const classDefinition = definition.node; + return isInRange(classDefinition, location) && + /* + * Class binding is initialized before running static initializers. + * For example, `class C { static foo = C; static { bar = C; } }` is valid. + */ + !isInClassStaticInitializerRange(classDefinition.body, location); + } + + let node = definition.name.parent; while (node) { if (node.type === "VariableDeclarator") { @@ -98683,7 +101262,6 @@ module.exports = { type: "problem", docs: { description: "disallow the use of variables before they are defined", - category: "Variables", recommended: false, url: "https://eslint.org/docs/rules/no-use-before-define" }, @@ -98714,64 +101292,68 @@ module.exports = { create(context) { const options = parseOptions(context.options[0]); /** - * Determines whether a given use-before-define case should be reported according to the options. - * @param {eslint-scope.Variable} variable The variable that gets used before being defined - * @param {eslint-scope.Reference} reference The reference to the variable - * @returns {boolean} `true` if the usage should be reported + * Determines whether a given reference should be checked. + * + * Returns `false` if the reference is: + * - initialization's (e.g., `let a = 1`). + * - referring to an undefined variable (i.e., if it's an unresolved reference). + * - referring to a variable that is defined, but not in the given source code + * (e.g., global environment variable or `arguments` in functions). + * - allowed by options. + * @param {eslint-scope.Reference} reference The reference + * @returns {boolean} `true` if the reference should be checked */ - function isForbidden(variable, reference) { - if (isFunction(variable)) { - return options.functions; + function shouldCheck(reference) { + if (reference.init) { + return false; } - if (isOuterClass(variable, reference)) { - return options.classes; + const variable = reference.resolved; + + if (!variable || variable.defs.length === 0) { + return false; } - if (isOuterVariable(variable, reference)) { - return options.variables; + const definitionType = variable.defs[0].type; + + if (!options.functions && definitionType === "FunctionName") { + return false; + } + + if ((!options.variables && definitionType === "Variable" || !options.classes && definitionType === "ClassName") && // don't skip checking the reference if it's in the same execution context, because of TDZ + isFromSeparateExecutionContext(reference)) { + return false; } return true; } /** - * Finds and validates all variables in a given scope. - * @param {Scope} scope The scope object. + * Finds and validates all references in a given scope and its child scopes. + * @param {eslint-scope.Scope} scope The scope object. * @returns {void} - * @private */ - function findVariablesInScope(scope) { - scope.references.forEach(reference => { + function checkReferencesInScope(scope) { + scope.references.filter(shouldCheck).forEach(reference => { const variable = reference.resolved; - /* - * Skips when the reference is: - * - initialization's. - * - referring to an undefined variable. - * - referring to a global environment variable (there're no identifiers). - * - located preceded by the variable (except in initializers). - * - allowed by options. - */ + const definitionIdentifier = variable.defs[0].name; - if (reference.init || !variable || variable.identifiers.length === 0 || variable.identifiers[0].range[1] < reference.identifier.range[1] && !isInInitializer(variable, reference) || !isForbidden(variable, reference)) { - return; - } // Reports. - - - context.report({ - node: reference.identifier, - messageId: "usedBeforeDefined", - data: reference.identifier - }); + if (reference.identifier.range[1] < definitionIdentifier.range[1] || isEvaluatedDuringInitialization(reference)) { + context.report({ + node: reference.identifier, + messageId: "usedBeforeDefined", + data: reference.identifier + }); + } }); - scope.childScopes.forEach(findVariablesInScope); + scope.childScopes.forEach(checkReferencesInScope); } return { Program() { - findVariablesInScope(context.getScope()); + checkReferencesInScope(context.getScope()); } }; @@ -98780,7 +101362,7 @@ module.exports = { }; /***/ }), -/* 775 */ +/* 776 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -98854,8 +101436,7 @@ module.exports = { type: "problem", docs: { description: "disallow useless backreferences in regular expressions", - category: "Possible Errors", - recommended: false, + recommended: true, url: "https://eslint.org/docs/rules/no-useless-backreference" }, schema: [], @@ -98980,7 +101561,7 @@ module.exports = { }; /***/ }), -/* 776 */ +/* 777 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -98990,7 +101571,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -99030,7 +101611,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow unnecessary calls to `.call()` and `.apply()`", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-useless-call" }, @@ -99070,7 +101650,7 @@ module.exports = { }; /***/ }), -/* 777 */ +/* 778 */ /***/ ((module) => { "use strict"; @@ -99087,7 +101667,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow unnecessary `catch` clauses", - category: "Best Practices", recommended: true, url: "https://eslint.org/docs/rules/no-useless-catch" }, @@ -99122,7 +101701,7 @@ module.exports = { }; /***/ }), -/* 778 */ +/* 779 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -99134,7 +101713,82 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Determines whether the computed key syntax is unnecessarily used for the given node. + * In particular, it determines whether removing the square brackets and using the content between them + * directly as the key (e.g. ['foo'] -> 'foo') would produce valid syntax and preserve the same behavior. + * Valid non-computed keys are only: identifiers, number literals and string literals. + * Only literals can preserve the same behavior, with a few exceptions for specific node types: + * Property + * - { ["__proto__"]: foo } defines a property named "__proto__" + * { "__proto__": foo } defines object's prototype + * PropertyDefinition + * - class C { ["constructor"]; } defines an instance field named "constructor" + * class C { "constructor"; } produces a parsing error + * - class C { static ["constructor"]; } defines a static field named "constructor" + * class C { static "constructor"; } produces a parsing error + * - class C { static ["prototype"]; } produces a runtime error (doesn't break the whole script) + * class C { static "prototype"; } produces a parsing error (breaks the whole script) + * MethodDefinition + * - class C { ["constructor"]() {} } defines a prototype method named "constructor" + * class C { "constructor"() {} } defines the constructor + * - class C { static ["prototype"]() {} } produces a runtime error (doesn't break the whole script) + * class C { static "prototype"() {} } produces a parsing error (breaks the whole script) + * @param {ASTNode} node The node to check. It can be `Property`, `PropertyDefinition` or `MethodDefinition`. + * @throws {Error} (Unreachable.) + * @returns {void} `true` if the node has useless computed key. + */ + + +function hasUselessComputedKey(node) { + if (!node.computed) { + return false; + } + + const { + key + } = node; + + if (key.type !== "Literal") { + return false; + } + + const { + value + } = key; + + if (typeof value !== "number" && typeof value !== "string") { + return false; + } + + switch (node.type) { + case "Property": + return value !== "__proto__"; + + case "PropertyDefinition": + if (node.static) { + return value !== "constructor" && value !== "prototype"; + } + + return value !== "constructor"; + + case "MethodDefinition": + if (node.static) { + return value !== "prototype"; + } + + return value !== "constructor"; + + /* istanbul ignore next */ + + default: + throw new Error("Unexpected node type: ".concat(node.type)); + } +} //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -99144,7 +101798,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow unnecessary computed property keys in objects and classes", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/no-useless-computed-key" }, @@ -99174,21 +101827,10 @@ module.exports = { */ function check(node) { - if (!node.computed) { - return; - } - - const key = node.key, - nodeType = typeof key.value; - let allowedKey; - - if (node.type === "MethodDefinition") { - allowedKey = node.static ? "prototype" : "constructor"; - } else { - allowedKey = "__proto__"; - } - - if (key.type === "Literal" && (nodeType === "string" || nodeType === "number") && key.value !== allowedKey) { + if (hasUselessComputedKey(node)) { + const { + key + } = node; context.report({ node, messageId: "unnecessarilyComputedProperty", @@ -99225,14 +101867,15 @@ module.exports = { return { Property: check, - MethodDefinition: enforceForClassMembers ? check : noop + MethodDefinition: enforceForClassMembers ? check : noop, + PropertyDefinition: enforceForClassMembers ? check : noop }; } }; /***/ }), -/* 779 */ +/* 780 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -99244,7 +101887,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -99309,7 +101952,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow unnecessary concatenation of literals or template literals", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-useless-concat" }, @@ -99348,7 +101990,7 @@ module.exports = { }; /***/ }), -/* 780 */ +/* 781 */ /***/ ((module) => { "use strict"; @@ -99468,7 +102110,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow unnecessary constructors", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/no-useless-constructor" }, @@ -99518,7 +102159,7 @@ module.exports = { }; /***/ }), -/* 781 */ +/* 782 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -99528,7 +102169,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -99556,16 +102197,17 @@ const REGEX_NON_CHARCLASS_ESCAPES = union(REGEX_GENERAL_ESCAPES, new Set("^/.$*+ * @returns {Object[]} A list of characters, each with info on escaping and whether they're in a character class. * @example * - * parseRegExp('a\\b[cd-]') + * parseRegExp("a\\b[cd-]"); * - * returns: + * // returns: * [ - * {text: 'a', index: 0, escaped: false, inCharClass: false, startsCharClass: false, endsCharClass: false}, - * {text: 'b', index: 2, escaped: true, inCharClass: false, startsCharClass: false, endsCharClass: false}, - * {text: 'c', index: 4, escaped: false, inCharClass: true, startsCharClass: true, endsCharClass: false}, - * {text: 'd', index: 5, escaped: false, inCharClass: true, startsCharClass: false, endsCharClass: false}, - * {text: '-', index: 6, escaped: false, inCharClass: true, startsCharClass: false, endsCharClass: false} - * ] + * { text: "a", index: 0, escaped: false, inCharClass: false, startsCharClass: false, endsCharClass: false }, + * { text: "b", index: 2, escaped: true, inCharClass: false, startsCharClass: false, endsCharClass: false }, + * { text: "c", index: 4, escaped: false, inCharClass: true, startsCharClass: true, endsCharClass: false }, + * { text: "d", index: 5, escaped: false, inCharClass: true, startsCharClass: false, endsCharClass: false }, + * { text: "-", index: 6, escaped: false, inCharClass: true, startsCharClass: false, endsCharClass: false } + * ]; + * */ function parseRegExp(regExpText) { @@ -99622,11 +102264,10 @@ module.exports = { type: "suggestion", docs: { description: "disallow unnecessary escape characters", - category: "Best Practices", recommended: true, - url: "https://eslint.org/docs/rules/no-useless-escape", - suggestion: true + url: "https://eslint.org/docs/rules/no-useless-escape" }, + hasSuggestions: true, messages: { unnecessaryEscape: "Unnecessary escape character: \\{{character}}.", removeEscape: "Remove the `\\`. This maintains the current functionality.", @@ -99778,7 +102419,7 @@ module.exports = { }; /***/ }), -/* 782 */ +/* 783 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -99790,7 +102431,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -99800,7 +102441,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow renaming import, export, and destructured assignments to the same name", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/no-useless-rename" }, @@ -99947,7 +102587,7 @@ module.exports = { }; /***/ }), -/* 783 */ +/* 784 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -99959,7 +102599,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547), +const astUtils = __webpack_require__(548), FixTracker = __webpack_require__(662); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -100014,7 +102654,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow redundant return statements", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-useless-return" }, @@ -100238,7 +102877,7 @@ module.exports = { }; /***/ }), -/* 784 */ +/* 785 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -100250,7 +102889,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -100422,7 +103061,6 @@ module.exports = { type: "suggestion", docs: { description: "require `let` or `const` instead of `var`", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/no-var" }, @@ -100563,7 +103201,7 @@ module.exports = { }; /***/ }), -/* 785 */ +/* 786 */ /***/ ((module) => { "use strict"; @@ -100580,7 +103218,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow `void` operators", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-void" }, @@ -100622,7 +103259,7 @@ module.exports = { }; /***/ }), -/* 786 */ +/* 787 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -100632,9 +103269,9 @@ module.exports = { */ -const escapeRegExp = __webpack_require__(552); +const escapeRegExp = __webpack_require__(525); -const astUtils = __webpack_require__(547); +const astUtils = __webpack_require__(548); const CHAR_LIMIT = 40; //------------------------------------------------------------------------------ // Rule Definition @@ -100645,7 +103282,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow specified warning terms in comments", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/no-warning-comments" }, @@ -100686,7 +103322,7 @@ module.exports = { function convertToRegExp(term) { const escaped = escapeRegExp(term); const wordBoundary = "\\b"; - const eitherOrWordBoundary = `|${wordBoundary}`; + const eitherOrWordBoundary = "|".concat(wordBoundary); let prefix; /* * If the term ends in a word character (a-z0-9_), ensure a word @@ -100767,7 +103403,7 @@ module.exports = { let truncated = false; for (const c of comment.trim().split(/\s+/u)) { - const tmp = commentToDisplay ? `${commentToDisplay} ${c}` : c; + const tmp = commentToDisplay ? "".concat(commentToDisplay, " ").concat(c) : c; if (tmp.length <= CHAR_LIMIT) { commentToDisplay = tmp; @@ -100782,7 +103418,7 @@ module.exports = { messageId: "unexpectedComment", data: { matchedTerm, - comment: `${commentToDisplay}${truncated ? "..." : ""}` + comment: "".concat(commentToDisplay).concat(truncated ? "..." : "") } }); }); @@ -100800,7 +103436,7 @@ module.exports = { }; /***/ }), -/* 787 */ +/* 788 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -100812,7 +103448,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -100822,7 +103458,6 @@ module.exports = { type: "layout", docs: { description: "disallow whitespace before properties", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/no-whitespace-before-property" }, @@ -100914,7 +103549,7 @@ module.exports = { }; /***/ }), -/* 788 */ +/* 789 */ /***/ ((module) => { "use strict"; @@ -100931,7 +103566,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow `with` statements", - category: "Best Practices", recommended: true, url: "https://eslint.org/docs/rules/no-with" }, @@ -100956,7 +103590,7 @@ module.exports = { }; /***/ }), -/* 789 */ +/* 790 */ /***/ ((module) => { "use strict"; @@ -100976,7 +103610,6 @@ module.exports = { type: "layout", docs: { description: "enforce the location of single-line statements", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/nonblock-statement-body-position" }, @@ -101079,7 +103712,7 @@ module.exports = { }; /***/ }), -/* 790 */ +/* 791 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -101091,7 +103724,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ // Schema objects. @@ -101231,7 +103864,6 @@ module.exports = { type: "layout", docs: { description: "enforce consistent line breaks after opening and before closing braces", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/object-curly-newline" }, @@ -101389,7 +104021,7 @@ module.exports = { }; /***/ }), -/* 791 */ +/* 792 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -101399,7 +104031,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -101409,7 +104041,6 @@ module.exports = { type: "layout", docs: { description: "enforce consistent spacing inside braces", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/object-curly-spacing" }, @@ -101716,7 +104347,7 @@ module.exports = { }; /***/ }), -/* 792 */ +/* 793 */ /***/ ((module) => { "use strict"; @@ -101733,7 +104364,6 @@ module.exports = { type: "layout", docs: { description: "enforce placing object properties on separate lines", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/object-property-newline" }, @@ -101811,7 +104441,7 @@ module.exports = { }; /***/ }), -/* 793 */ +/* 794 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -101832,7 +104462,7 @@ const OPTIONS = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -101842,7 +104472,6 @@ module.exports = { type: "suggestion", docs: { description: "require or disallow method and property shorthand syntax for object literals", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/object-shorthand" }, @@ -101942,7 +104571,6 @@ module.exports = { * @param {ASTNode} property Property AST node * @returns {boolean} True if the property can have a shorthand form * @private - * */ @@ -101951,7 +104579,7 @@ module.exports = { } /** * Checks whether a node is a string literal. - * @param {ASTNode} node Any AST node. + * @param {ASTNode} node Any AST node. * @returns {boolean} `true` if it is a string literal. */ @@ -101964,7 +104592,6 @@ module.exports = { * @param {ASTNode} property Property AST node * @returns {boolean} True if the property is considered shorthand, false if not. * @private - * */ @@ -101977,7 +104604,6 @@ module.exports = { * @param {ASTNode} property Property AST node * @returns {boolean} True if the key and value are named equally, false if not. * @private - * */ @@ -101996,10 +104622,9 @@ module.exports = { } /** * Ensures that an object's properties are consistently shorthand, or not shorthand at all. - * @param {ASTNode} node Property AST node - * @param {boolean} checkRedundancy Whether to check longform redundancy + * @param {ASTNode} node Property AST node + * @param {boolean} checkRedundancy Whether to check longform redundancy * @returns {void} - * */ @@ -102093,7 +104718,7 @@ module.exports = { const sliceStart = shouldAddParensAroundParameters ? node.value.params[0].range[0] : tokenBeforeParams.range[0]; const sliceEnd = sourceCode.getTokenBefore(arrowToken).range[1]; const oldParamText = sourceCode.text.slice(sliceStart, sliceEnd); - const newParamText = shouldAddParensAroundParameters ? `(${oldParamText})` : oldParamText; + const newParamText = shouldAddParensAroundParameters ? "(".concat(oldParamText, ")") : oldParamText; return fixer.replaceTextRange(fixRange, methodPrefix + newParamText + fnBody); } /** @@ -102111,14 +104736,14 @@ module.exports = { let functionHeader = "function"; if (node.value.async) { - functionHeader = `async ${functionHeader}`; + functionHeader = "async ".concat(functionHeader); } if (node.value.generator) { - functionHeader = `${functionHeader}*`; + functionHeader = "".concat(functionHeader, "*"); } - return fixer.replaceTextRange([node.range[0], lastKeyToken.range[1]], `${keyText}: ${functionHeader}`); + return fixer.replaceTextRange([node.range[0], lastKeyToken.range[1]], "".concat(keyText, ": ").concat(functionHeader)); } /* * To determine whether a given arrow function has a lexical identifier (`this`, `arguments`, `super`, or `new.target`), @@ -102242,7 +104867,7 @@ module.exports = { context.report({ node, messageId: "expectedPropertyLongform", - fix: fixer => fixer.insertTextAfter(node.key, `: ${node.key.name}`) + fix: fixer => fixer.insertTextAfter(node.key, ": ".concat(node.key.name)) }); } } else if (APPLY_TO_METHODS && !node.value.id && (node.value.type === "FunctionExpression" || node.value.type === "ArrowFunctionExpression")) { @@ -102297,7 +104922,7 @@ module.exports = { }; /***/ }), -/* 794 */ +/* 795 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -102309,7 +104934,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -102332,7 +104957,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce variables to be declared either together or separately in functions", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/one-var" }, @@ -102530,7 +105154,7 @@ module.exports = { } /** * Determines the current scope (function or block) - * @param {string} statementType node.kind, one of: "var", "let", or "const" + * @param {string} statementType node.kind, one of: "var", "let", or "const" * @returns {Object} The scope associated with statementType */ @@ -102684,7 +105308,7 @@ module.exports = { */ if (afterComma.range[0] === tokenAfterDeclarator.range[1]) { - return fixer.replaceText(tokenAfterDeclarator, `; ${exportPlacement}${declaration.kind} `); + return fixer.replaceText(tokenAfterDeclarator, "; ".concat(exportPlacement).concat(declaration.kind, " ")); } /* * `var x, @@ -102703,10 +105327,10 @@ module.exports = { }); } - return fixer.replaceTextRange([tokenAfterDeclarator.range[0], lastComment.range[0]], `;${sourceCode.text.slice(tokenAfterDeclarator.range[1], lastComment.range[0])}${exportPlacement}${declaration.kind} `); + return fixer.replaceTextRange([tokenAfterDeclarator.range[0], lastComment.range[0]], ";".concat(sourceCode.text.slice(tokenAfterDeclarator.range[1], lastComment.range[0])).concat(exportPlacement).concat(declaration.kind, " ")); } - return fixer.replaceText(tokenAfterDeclarator, `; ${exportPlacement}${declaration.kind}`); + return fixer.replaceText(tokenAfterDeclarator, "; ".concat(exportPlacement).concat(declaration.kind)); }).filter(x => x); } /** @@ -102868,6 +105492,8 @@ module.exports = { FunctionDeclaration: startFunction, FunctionExpression: startFunction, ArrowFunctionExpression: startFunction, + StaticBlock: startFunction, + // StaticBlock creates a new scope for `var` variables BlockStatement: startBlock, ForStatement: startBlock, ForInStatement: startBlock, @@ -102882,14 +105508,15 @@ module.exports = { "Program:exit": endFunction, "FunctionDeclaration:exit": endFunction, "FunctionExpression:exit": endFunction, - "ArrowFunctionExpression:exit": endFunction + "ArrowFunctionExpression:exit": endFunction, + "StaticBlock:exit": endFunction }; } }; /***/ }), -/* 795 */ +/* 796 */ /***/ ((module) => { "use strict"; @@ -102906,7 +105533,6 @@ module.exports = { type: "suggestion", docs: { description: "require or disallow newlines around variable declarations", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/one-var-declaration-per-line" }, @@ -102976,7 +105602,7 @@ module.exports = { }; /***/ }), -/* 796 */ +/* 797 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -102988,15 +105614,15 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ /** * Checks whether an operator is commutative and has an operator assignment * shorthand form. - * @param {string} operator Operator to check. - * @returns {boolean} True if the operator is commutative and has a + * @param {string} operator Operator to check. + * @returns {boolean} True if the operator is commutative and has a * shorthand form. */ @@ -103007,8 +105633,8 @@ function isCommutativeOperatorWithShorthand(operator) { /** * Checks whether an operator is not commutative and has an operator assignment * shorthand form. - * @param {string} operator Operator to check. - * @returns {boolean} True if the operator is not commutative and has + * @param {string} operator Operator to check. + * @returns {boolean} True if the operator is not commutative and has * a shorthand form. */ @@ -103036,7 +105662,6 @@ module.exports = { type: "suggestion", docs: { description: "require or disallow assignment operator shorthand where possible", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/operator-assignment" }, @@ -103045,8 +105670,8 @@ module.exports = { }], fixable: "code", messages: { - replaced: "Assignment can be replaced with operator assignment.", - unexpected: "Unexpected operator assignment shorthand." + replaced: "Assignment (=) can be replaced with operator assignment ({{operator}}=).", + unexpected: "Unexpected operator assignment ({{operator}}=) shorthand." } }, @@ -103063,7 +105688,7 @@ module.exports = { } /** * Ensures that an assignment uses the shorthand form where possible. - * @param {ASTNode} node An AssignmentExpression node. + * @param {ASTNode} node An AssignmentExpression node. * @returns {void} */ @@ -103082,6 +105707,9 @@ module.exports = { context.report({ node, messageId: "replaced", + data: { + operator + }, fix(fixer) { if (canBeFixed(left) && canBeFixed(expr.left)) { @@ -103094,7 +105722,7 @@ module.exports = { return null; } - return fixer.replaceText(node, `${leftText}${expr.operator}=${rightText}`); + return fixer.replaceText(node, "".concat(leftText).concat(expr.operator, "=").concat(rightText)); } return null; @@ -103109,14 +105737,17 @@ module.exports = { */ context.report({ node, - messageId: "replaced" + messageId: "replaced", + data: { + operator + } }); } } } /** * Warns if an assignment expression uses operator assignment shorthand. - * @param {ASTNode} node An AssignmentExpression node. + * @param {ASTNode} node An AssignmentExpression node. * @returns {void} */ @@ -103126,6 +105757,9 @@ module.exports = { context.report({ node, messageId: "unexpected", + data: { + operator: node.operator + }, fix(fixer) { if (canBeFixed(node.left)) { @@ -103144,7 +105778,7 @@ module.exports = { type: "BinaryExpression", operator: newOperator }) && !astUtils.isParenthesised(sourceCode, node.right)) { - rightText = `${sourceCode.text.slice(operatorToken.range[1], node.right.range[0])}(${sourceCode.getText(node.right)})`; + rightText = "".concat(sourceCode.text.slice(operatorToken.range[1], node.right.range[0]), "(").concat(sourceCode.getText(node.right), ")"); } else { const tokenAfterOperator = sourceCode.getTokenAfter(operatorToken, { includeComments: true @@ -103158,10 +105792,10 @@ module.exports = { rightTextPrefix = " "; // foo+=+bar -> foo= foo+ +bar } - rightText = `${rightTextPrefix}${sourceCode.text.slice(operatorToken.range[1], node.range[1])}`; + rightText = "".concat(rightTextPrefix).concat(sourceCode.text.slice(operatorToken.range[1], node.range[1])); } - return fixer.replaceText(node, `${leftText}= ${leftText}${newOperator}${rightText}`); + return fixer.replaceText(node, "".concat(leftText, "= ").concat(leftText).concat(newOperator).concat(rightText)); } return null; @@ -103179,7 +105813,7 @@ module.exports = { }; /***/ }), -/* 797 */ +/* 798 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -103191,7 +105825,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -103201,7 +105835,6 @@ module.exports = { type: "layout", docs: { description: "enforce consistent linebreak style for operators", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/operator-linebreak" }, @@ -103306,24 +105939,22 @@ module.exports = { /** * Checks the operator placement * @param {ASTNode} node The node to check - * @param {ASTNode} leftSide The node that comes before the operator in `node` + * @param {ASTNode} rightSide The node that comes after the operator in `node` + * @param {string} operator The operator * @private * @returns {void} */ - function validateNode(node, leftSide) { + function validateNode(node, rightSide, operator) { /* - * When the left part of a binary expression is a single expression wrapped in - * parentheses (ex: `(a) + b`), leftToken will be the last token of the expression - * and operatorToken will be the closing parenthesis. - * The leftToken should be the last closing parenthesis, and the operatorToken - * should be the token right after that. + * Find the operator token by searching from the right side, because between the left side and the operator + * there could be additional tokens from type annotations. Search specifically for the token which + * value equals the operator, in order to skip possible opening parentheses before the right side node. */ - const operatorToken = sourceCode.getTokenAfter(leftSide, astUtils.isNotClosingParenToken); + const operatorToken = sourceCode.getTokenBefore(rightSide, token => token.value === operator); const leftToken = sourceCode.getTokenBefore(operatorToken); const rightToken = sourceCode.getTokenAfter(operatorToken); - const operator = operatorToken.value; const operatorStyleOverride = styleOverrides[operator]; const style = operatorStyleOverride || globalStyle; const fix = getFixer(operatorToken, style); // if single line @@ -103380,7 +106011,7 @@ module.exports = { function validateBinaryExpression(node) { - validateNode(node, node.left); + validateNode(node, node.right, node.operator); } //-------------------------------------------------------------------------- // Public //-------------------------------------------------------------------------- @@ -103393,13 +106024,19 @@ module.exports = { VariableDeclarator(node) { if (node.init) { - validateNode(node, node.id); + validateNode(node, node.init, "="); + } + }, + + PropertyDefinition(node) { + if (node.value) { + validateNode(node, node.value, "="); } }, ConditionalExpression(node) { - validateNode(node, node.test); - validateNode(node, node.consequent); + validateNode(node, node.consequent, "?"); + validateNode(node, node.alternate, ":"); } }; @@ -103408,7 +106045,7 @@ module.exports = { }; /***/ }), -/* 798 */ +/* 799 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -103420,7 +106057,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -103430,7 +106067,6 @@ module.exports = { type: "layout", docs: { description: "require or disallow padding within blocks", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/padded-blocks" }, @@ -103509,6 +106145,13 @@ module.exports = { return sourceCode.getTokenBefore(node.cases[0]); } + if (node.type === "StaticBlock") { + return sourceCode.getFirstToken(node, { + skip: 1 + }); // skip the `static` token + } // `BlockStatement` or `ClassBody` + + return sourceCode.getFirstToken(node); } /** @@ -103575,6 +106218,7 @@ module.exports = { /** * Checks if a node should be padded, according to the rule config. * @param {ASTNode} node The AST node to check. + * @throws {Error} (Unreachable) * @returns {boolean} True if the node should be padded, false otherwise. */ @@ -103582,6 +106226,7 @@ module.exports = { function requirePaddingFor(node) { switch (node.type) { case "BlockStatement": + case "StaticBlock": return options.blocks; case "SwitchStatement": @@ -103708,6 +106353,8 @@ module.exports = { checkPadding(node); }; + + rule.StaticBlock = rule.BlockStatement; } if (Object.prototype.hasOwnProperty.call(options, "classes")) { @@ -103726,7 +106373,7 @@ module.exports = { }; /***/ }), -/* 799 */ +/* 800 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -103738,13 +106385,17 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +var _templateObject; + +function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } + +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ -const LT = `[${Array.from(astUtils.LINEBREAKS).join("")}]`; -const PADDING_LINE_SEQUENCE = new RegExp(String.raw`^(\s*?${LT})\s*${LT}(\s*;?)$`, "u"); +const LT = "[".concat(Array.from(astUtils.LINEBREAKS).join(""), "]"); +const PADDING_LINE_SEQUENCE = new RegExp(String.raw(_templateObject || (_templateObject = _taggedTemplateLiteral(["^(s*?", ")s*", "(s*;?)$"], ["^(\\s*?", ")\\s*", "(\\s*;?)$"])), LT, LT), "u"); const CJS_EXPORT = /^(?:module\s*\.\s*)?exports(?:\s*\.|\s*\[|$)/u; const CJS_IMPORT = /^require\(/u; /** @@ -104125,7 +106776,6 @@ module.exports = { type: "layout", docs: { description: "require or disallow padding lines between statements", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/padding-line-between-statements" }, @@ -104319,9 +106969,11 @@ module.exports = { Program: enterScope, BlockStatement: enterScope, SwitchStatement: enterScope, + StaticBlock: enterScope, "Program:exit": exitScope, "BlockStatement:exit": exitScope, "SwitchStatement:exit": exitScope, + "StaticBlock:exit": exitScope, ":statement": verify, SwitchCase: verifyThenEnterScope, "SwitchCase:exit": exitScope @@ -104331,7 +106983,7 @@ module.exports = { }; /***/ }), -/* 800 */ +/* 801 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -104341,7 +106993,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -104397,6 +107049,7 @@ function getVariableOfArguments(scope) { /** * Checks whether or not a given node is a callback. * @param {ASTNode} node A node to check. + * @throws {Error} (Unreachable.) * @returns {Object} * {boolean} retv.isCallback - `true` if the node is a callback. * {boolean} retv.isLexicalThis - `true` if the node is with `.bind(this)`. @@ -104484,7 +107137,6 @@ module.exports = { type: "suggestion", docs: { description: "require using arrow functions for callbacks", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/prefer-arrow-callback" }, @@ -104623,7 +107275,7 @@ module.exports = { * If the callback function has duplicates in its list of parameters (possible in sloppy mode), * don't replace it with an arrow function, because this is a SyntaxError with arrow functions. */ - return; // eslint-disable-line eslint-plugin/fixer-return -- false positive + return; } // Remove `.bind(this)` if exists. @@ -104635,7 +107287,7 @@ module.exports = { */ if (memberNode.type !== "MemberExpression") { - return; // eslint-disable-line eslint-plugin/fixer-return -- false positive + return; } const callNode = memberNode.parent; @@ -104648,12 +107300,12 @@ module.exports = { */ if (astUtils.isParenthesised(sourceCode, memberNode)) { - return; // eslint-disable-line eslint-plugin/fixer-return -- false positive + return; } // If comments exist in the `.bind(this)`, don't remove those. if (sourceCode.commentsExistBetween(firstTokenToRemove, lastTokenToRemove)) { - return; // eslint-disable-line eslint-plugin/fixer-return -- false positive + return; } yield fixer.removeRange([firstTokenToRemove.range[0], lastTokenToRemove.range[1]]); @@ -104705,7 +107357,7 @@ module.exports = { }; /***/ }), -/* 801 */ +/* 802 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -104719,13 +107371,13 @@ module.exports = { const FixTracker = __webpack_require__(662); -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ const PATTERN_TYPE = /^(?:.+?Pattern|RestElement|SpreadProperty|ExperimentalRestProperty|Property)$/u; -const DECLARATION_HOST_TYPE = /^(?:Program|BlockStatement|SwitchCase)$/u; +const DECLARATION_HOST_TYPE = /^(?:Program|BlockStatement|StaticBlock|SwitchCase)$/u; const DESTRUCTURING_HOST_TYPE = /^(?:VariableDeclarator|AssignmentExpression)$/u; /** * Checks whether a given node is located at `ForStatement.init` or not. @@ -105022,7 +107674,6 @@ module.exports = { type: "suggestion", docs: { description: "require `const` declarations for variables that are never reassigned after declared", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/prefer-const" }, @@ -105111,7 +107762,8 @@ module.exports = { } } - let shouldFix = varDeclParent && (varDeclParent.parent.type === "ForInStatement" || varDeclParent.parent.type === "ForOfStatement" || varDeclParent.declarations.every(declaration => declaration.init)) && + let shouldFix = varDeclParent && ( // Don't do a fix unless all variables in the declarations are initialized (or it's in a for-in or for-of loop) + varDeclParent.parent.type === "ForInStatement" || varDeclParent.parent.type === "ForOfStatement" || varDeclParent.declarations.every(declaration => declaration.init)) && /* * If options.destructuring is "all", then this warning will not occur unless * every assignment in the destructuring should be const. In that case, it's safe @@ -105167,7 +107819,7 @@ module.exports = { }; /***/ }), -/* 802 */ +/* 803 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -105179,7 +107831,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -105195,7 +107847,6 @@ module.exports = { type: "suggestion", docs: { description: "require destructuring from arrays and/or objects", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/prefer-destructuring" }, @@ -105282,9 +107933,9 @@ module.exports = { } //-------------------------------------------------------------------------- // Helpers //-------------------------------------------------------------------------- - // eslint-disable-next-line jsdoc/require-description /** + * Checks if destructuring type should be checked. * @param {string} nodeType "AssignmentExpression" or "VariableDeclarator" * @param {string} destructuringType "array" or "object" * @returns {boolean} `true` if the destructuring type should be checked for the given node @@ -105364,10 +108015,10 @@ module.exports = { let objectText = sourceCode.getText(rightNode.object); if (astUtils.getPrecedence(rightNode.object) < PRECEDENCE_OF_ASSIGNMENT_EXPR) { - objectText = `(${objectText})`; + objectText = "(".concat(objectText, ")"); } - return fixer.replaceText(node, `{${rightNode.property.name}} = ${objectText}`); + return fixer.replaceText(node, "{".concat(rightNode.property.name, "} = ").concat(objectText)); } /** * Check that the `prefer-destructuring` rules are followed based on the @@ -105383,7 +108034,7 @@ module.exports = { function performCheck(leftNode, rightNode, reportNode) { - if (rightNode.type !== "MemberExpression" || rightNode.object.type === "Super") { + if (rightNode.type !== "MemberExpression" || rightNode.object.type === "Super" || rightNode.property.type === "PrivateIdentifier") { return; } @@ -105456,7 +108107,7 @@ module.exports = { }; /***/ }), -/* 803 */ +/* 804 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -105468,7 +108119,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); +const astUtils = __webpack_require__(548); const { CALL, @@ -105527,7 +108178,7 @@ function doesExponentiationExpressionNeedParens(node, sourceCode) { function parenthesizeIfShould(text, shouldParenthesize) { - return shouldParenthesize ? `(${text})` : text; + return shouldParenthesize ? "(".concat(text, ")") : text; } //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -105538,7 +108189,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow the use of `Math.pow` in favor of the `**` operator", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/prefer-exponentiation-operator" }, @@ -105599,8 +108249,8 @@ module.exports = { const baseReplacement = parenthesizeIfShould(baseText, shouldParenthesizeBase), exponentReplacement = parenthesizeIfShould(exponentText, shouldParenthesizeExponent), - replacement = parenthesizeIfShould(`${baseReplacement}**${exponentReplacement}`, shouldParenthesizeAll); - return fixer.replaceText(node, `${prefix}${replacement}${suffix}`); + replacement = parenthesizeIfShould("".concat(baseReplacement, "**").concat(exponentReplacement), shouldParenthesizeAll); + return fixer.replaceText(node, "".concat(prefix).concat(replacement).concat(suffix)); } }); @@ -105631,7 +108281,7 @@ module.exports = { }; /***/ }), -/* 804 */ +/* 805 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -105664,7 +108314,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce using named capture group in regular expression", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/prefer-named-capture-group" }, @@ -105743,7 +108392,7 @@ module.exports = { }; /***/ }), -/* 805 */ +/* 806 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -105755,7 +108404,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -105790,7 +108439,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/prefer-numeric-literals" }, @@ -105830,7 +108478,7 @@ module.exports = { return null; } - const replacement = `${literalPrefix}${str}`; + const replacement = "".concat(literalPrefix).concat(str); if (+replacement !== parseInt(str, radix)) { /* @@ -105863,7 +108511,7 @@ module.exports = { suffix = " "; } - return fixer.replaceText(node, `${prefix}${replacement}${suffix}`); + return fixer.replaceText(node, "".concat(prefix).concat(replacement).concat(suffix)); } }); @@ -105876,7 +108524,7 @@ module.exports = { }; /***/ }), -/* 806 */ +/* 807 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -105897,7 +108545,7 @@ const { isOpeningParenToken, isClosingParenToken, isParenthesised -} = __webpack_require__(547); +} = __webpack_require__(548); const ANY_SPACE = /\s/u; /** @@ -106122,7 +108770,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow using Object.assign with an object literal as the first argument and prefer the use of object spread instead.", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/prefer-object-spread" }, @@ -106169,7 +108816,7 @@ module.exports = { }; /***/ }), -/* 807 */ +/* 808 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -106179,7 +108826,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -106189,7 +108836,6 @@ module.exports = { type: "suggestion", docs: { description: "require using Error objects as Promise rejection reasons", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/prefer-promise-reject-errors" }, @@ -106285,7 +108931,7 @@ module.exports = { }; /***/ }), -/* 808 */ +/* 809 */ /***/ ((module) => { "use strict"; @@ -106303,7 +108949,6 @@ module.exports = { type: "suggestion", docs: { description: "require `Reflect` methods where applicable", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/prefer-reflect" }, @@ -106398,7 +109043,7 @@ module.exports = { }; /***/ }), -/* 809 */ +/* 810 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -106410,7 +109055,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); +const astUtils = __webpack_require__(548); const { CALL, @@ -106460,7 +109105,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow use of the `RegExp` constructor in favor of regular expression literals", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/prefer-regex-literals" }, @@ -106595,7 +109239,7 @@ module.exports = { }; /***/ }), -/* 810 */ +/* 811 */ /***/ ((module) => { "use strict"; @@ -106658,7 +109302,6 @@ module.exports = { type: "suggestion", docs: { description: "require rest parameters instead of `arguments`", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/prefer-rest-params" }, @@ -106704,7 +109347,7 @@ module.exports = { }; /***/ }), -/* 811 */ +/* 812 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -106714,7 +109357,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -106753,7 +109396,6 @@ module.exports = { type: "suggestion", docs: { description: "require spread operators instead of `.apply()`", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/prefer-spread" }, @@ -106790,7 +109432,7 @@ module.exports = { }; /***/ }), -/* 812 */ +/* 813 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -106802,7 +109444,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -106927,7 +109569,6 @@ module.exports = { type: "suggestion", docs: { description: "require template literals instead of string concatenation", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/prefer-template" }, @@ -106970,13 +109611,13 @@ module.exports = { * for some reason, don't add another backslash, because that would change the meaning of the code (it would cause * an actual backslash character to appear before the dollar sign). */ - return `\`${currentNode.raw.slice(1, -1).replace(/\\*(\$\{|`)/gu, matched => { + return "`".concat(currentNode.raw.slice(1, -1).replace(/\\*(\$\{|`)/gu, matched => { if (matched.lastIndexOf("\\") % 2) { - return `\\${matched}`; + return "\\".concat(matched); } return matched; // Unescape any quotes that appear in the original Literal that no longer need to be escaped. - }).replace(new RegExp(`\\\\${currentNode.raw[0]}`, "gu"), currentNode.raw[0])}\``; + }).replace(new RegExp("\\\\".concat(currentNode.raw[0]), "gu"), currentNode.raw[0]), "`"); } if (currentNode.type === "TemplateLiteral") { @@ -107007,10 +109648,10 @@ module.exports = { */ - return `${getTemplateLiteral(currentNode.left, textBeforeNode, null)}${textBeforePlus}+${textAfterPlus}${getTemplateLiteral(currentNode.right, textAfterNode, null)}`; + return "".concat(getTemplateLiteral(currentNode.left, textBeforeNode, null)).concat(textBeforePlus, "+").concat(textAfterPlus).concat(getTemplateLiteral(currentNode.right, textAfterNode, null)); } - return `\`\${${textBeforeNode || ""}${sourceCode.getText(currentNode)}${textAfterNode || ""}}\``; + return "`${".concat(textBeforeNode || "").concat(sourceCode.getText(currentNode)).concat(textAfterNode || "", "}`"); } /** * Returns a fixer object that converts a non-string binary expression to a template literal @@ -107071,7 +109712,7 @@ module.exports = { }; /***/ }), -/* 813 */ +/* 814 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -107083,9 +109724,9 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const espree = __webpack_require__(423); +const espree = __webpack_require__(436); -const astUtils = __webpack_require__(547); +const astUtils = __webpack_require__(548); const keywords = __webpack_require__(583); //------------------------------------------------------------------------------ // Rule Definition @@ -107097,7 +109738,6 @@ module.exports = { type: "suggestion", docs: { description: "require quotes around object literal property names", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/quote-props" }, @@ -107152,7 +109792,7 @@ module.exports = { sourceCode = context.getSourceCode(); /** * Checks whether a certain string constitutes an ES3 token - * @param {string} tokenStr The string to be checked. + * @param {string} tokenStr The string to be checked. * @returns {boolean} `true` if it is an ES3 token. */ @@ -107161,9 +109801,9 @@ module.exports = { } /** * Checks if an espree-tokenized key has redundant quotes (i.e. whether quotes are unnecessary) - * @param {string} rawKey The raw key value from the source - * @param {espreeTokens} tokens The espree-tokenized node key - * @param {boolean} [skipNumberLiterals=false] Indicates whether number literals should be checked + * @param {string} rawKey The raw key value from the source + * @param {espreeTokens} tokens The espree-tokenized node key + * @param {boolean} [skipNumberLiterals=false] Indicates whether number literals should be checked * @returns {boolean} Whether or not a key has redundant quotes. * @private */ @@ -107196,11 +109836,11 @@ module.exports = { } // Otherwise, the key is either an identifier or a number literal. - return `"${key.type === "Identifier" ? key.name : key.value}"`; + return "\"".concat(key.type === "Identifier" ? key.name : key.value, "\""); } /** * Ensures that a property's key is quoted only when necessary - * @param {ASTNode} node Property AST node + * @param {ASTNode} node Property AST node * @returns {void} */ @@ -107263,7 +109903,7 @@ module.exports = { } /** * Ensures that a property's key is quoted - * @param {ASTNode} node Property AST node + * @param {ASTNode} node Property AST node * @returns {void} */ @@ -107284,8 +109924,8 @@ module.exports = { } /** * Ensures that an object's keys are consistently quoted, optionally checks for redundancy of quotes - * @param {ASTNode} node Property AST node - * @param {boolean} checkQuotesRedundancy Whether to check quotes' redundancy + * @param {ASTNode} node Property AST node + * @param {boolean} checkQuotesRedundancy Whether to check quotes' redundancy * @returns {void} */ @@ -107386,7 +110026,7 @@ module.exports = { }; /***/ }), -/* 814 */ +/* 815 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -107398,7 +110038,11 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +var _templateObject; + +function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } + +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Constants //------------------------------------------------------------------------------ @@ -107421,7 +110065,7 @@ const QUOTE_SETTINGS = { } }; // An unescaped newline is a newline preceded by an even number of backslashes. -const UNESCAPED_LINEBREAK_PATTERN = new RegExp(String.raw`(^|[^\\])(\\\\)*[${Array.from(astUtils.LINEBREAKS).join("")}]`, "u"); +const UNESCAPED_LINEBREAK_PATTERN = new RegExp(String.raw(_templateObject || (_templateObject = _taggedTemplateLiteral(["(^|[^\\])(\\\\)*[", "]"], ["(^|[^\\\\])(\\\\\\\\)*[", "]"])), Array.from(astUtils.LINEBREAKS).join("")), "u"); /** * Switches quoting of javascript string between ' " and ` * escaping and unescaping as necessary. @@ -107446,7 +110090,7 @@ QUOTE_SETTINGS.double.convert = QUOTE_SETTINGS.single.convert = QUOTE_SETTINGS.b } if (match === newQuote || newQuote === "`" && match === "${") { - return `\\${match}`; // escape + return "\\".concat(match); // escape } if (newline && oldQuote === "`") { @@ -107466,7 +110110,6 @@ module.exports = { type: "layout", docs: { description: "enforce the consistent use of either backticks, double, or single quotes", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/quotes" }, @@ -107591,6 +110234,7 @@ module.exports = { // LiteralPropertyName. case "Property": + case "PropertyDefinition": case "MethodDefinition": return parent.key === node && !parent.computed; // ModuleSpecifier. @@ -107707,7 +110351,7 @@ module.exports = { }; /***/ }), -/* 815 */ +/* 816 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -107719,7 +110363,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -107783,11 +110427,10 @@ module.exports = { type: "suggestion", docs: { description: "enforce the consistent use of the radix argument when using `parseInt()`", - category: "Best Practices", recommended: false, - url: "https://eslint.org/docs/rules/radix", - suggestion: true + url: "https://eslint.org/docs/rules/radix" }, + hasSuggestions: true, schema: [{ enum: ["always", "as-needed"] }], @@ -107900,7 +110543,7 @@ module.exports = { }; /***/ }), -/* 816 */ +/* 817 */ /***/ ((module) => { "use strict"; @@ -107917,7 +110560,9 @@ module.exports = { * @returns {Map} `referenceMap`. */ -function createReferenceMap(scope, outReferenceMap = new Map()) { +function createReferenceMap(scope) { + let outReferenceMap = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Map(); + for (const reference of scope.references) { if (reference.resolved === null) { continue; @@ -107987,6 +110632,10 @@ function isLocalVariableWithoutEscape(variable, isMemberAccess) { const functionScope = variable.scope.variableScope; return variable.references.every(reference => reference.from.variableScope === functionScope); } +/** + * Represents segment information. + */ + class SegmentInfo { constructor() { @@ -108083,18 +110732,28 @@ module.exports = { type: "problem", docs: { description: "disallow assignments that can lead to race conditions due to usage of `await` or `yield`", - category: "Possible Errors", recommended: false, url: "https://eslint.org/docs/rules/require-atomic-updates" }, fixable: null, - schema: [], + schema: [{ + type: "object", + properties: { + allowProperties: { + type: "boolean", + default: false + } + }, + additionalProperties: false + }], messages: { - nonAtomicUpdate: "Possible race condition: `{{value}}` might be reassigned based on an outdated value of `{{value}}`." + nonAtomicUpdate: "Possible race condition: `{{value}}` might be reassigned based on an outdated value of `{{value}}`.", + nonAtomicObjectUpdate: "Possible race condition: `{{value}}` might be assigned based on an outdated state of `{{object}}`." } }, create(context) { + const allowProperties = !!context.options[0] && context.options[0].allowProperties; const sourceCode = context.getSourceCode(); const assignmentReferences = new Map(); const segmentInfo = new SegmentInfo(); @@ -108186,13 +110845,24 @@ module.exports = { const variable = reference.resolved; if (segmentInfo.isOutdated(codePath.currentSegments, variable)) { - context.report({ - node: node.parent, - messageId: "nonAtomicUpdate", - data: { - value: sourceCode.getText(node.parent.left) - } - }); + if (node.parent.left === reference.identifier) { + context.report({ + node: node.parent, + messageId: "nonAtomicUpdate", + data: { + value: variable.name + } + }); + } else if (!allowProperties) { + context.report({ + node: node.parent, + messageId: "nonAtomicObjectUpdate", + data: { + value: sourceCode.getText(node.parent.left), + object: variable.name + } + }); + } } } } @@ -108204,7 +110874,7 @@ module.exports = { }; /***/ }), -/* 817 */ +/* 818 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -108216,7 +110886,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -108239,7 +110909,6 @@ module.exports = { type: "suggestion", docs: { description: "disallow async functions which have no `await` expression", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/require-await" }, @@ -108318,13 +110987,14 @@ module.exports = { }; /***/ }), -/* 818 */ +/* 819 */ /***/ ((module) => { "use strict"; /** * @fileoverview Rule to check for jsdoc presence. * @author Gyandeep Singh + * @deprecated in ESLint v5.10.0 */ @@ -108333,7 +111003,6 @@ module.exports = { type: "suggestion", docs: { description: "require JSDoc comments", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/require-jsdoc" }, @@ -108445,7 +111114,7 @@ module.exports = { }; /***/ }), -/* 819 */ +/* 820 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -108472,7 +111141,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce the use of `u` flag on RegExp", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/require-unicode-regexp" }, @@ -108526,7 +111194,7 @@ module.exports = { }; /***/ }), -/* 820 */ +/* 821 */ /***/ ((module) => { "use strict"; @@ -108543,7 +111211,6 @@ module.exports = { type: "suggestion", docs: { description: "require generator functions to contain `yield`", - category: "ECMAScript 6", recommended: true, url: "https://eslint.org/docs/rules/require-yield" }, @@ -108609,7 +111276,7 @@ module.exports = { }; /***/ }), -/* 821 */ +/* 822 */ /***/ ((module) => { "use strict"; @@ -108626,7 +111293,6 @@ module.exports = { type: "layout", docs: { description: "enforce spacing between rest and spread operators and their expressions", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/rest-spread-spacing" }, @@ -108737,7 +111403,7 @@ module.exports = { }; /***/ }), -/* 822 */ +/* 823 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -108751,7 +111417,7 @@ module.exports = { const FixTracker = __webpack_require__(662); -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -108761,7 +111427,6 @@ module.exports = { type: "layout", docs: { description: "require or disallow semicolons instead of ASI", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/semi" }, @@ -108808,6 +111473,8 @@ module.exports = { create(context) { const OPT_OUT_PATTERN = /^[-[(/+`]/u; // One of [(/+-` + const unsafeClassFieldNames = new Set(["get", "set", "static"]); + const unsafeClassFieldFollowers = new Set(["*", "in", "instanceof"]); const options = context.options[1]; const never = context.options[0] === "never"; const exceptOneLine = Boolean(options && options.omitLastInOneLineBlock); @@ -108884,6 +111551,54 @@ module.exports = { const node = sourceCode.getNodeByRangeIndex(lastToken.range[0]); return node.type === "BlockStatement" && node.parent.type === "ArrowFunctionExpression"; } + /** + * Checks if a given PropertyDefinition node followed by a semicolon + * can safely remove that semicolon. It is not to safe to remove if + * the class field name is "get", "set", or "static", or if + * followed by a generator method. + * @param {ASTNode} node The node to check. + * @returns {boolean} `true` if the node cannot have the semicolon + * removed. + */ + + + function maybeClassFieldAsiHazard(node) { + if (node.type !== "PropertyDefinition") { + return false; + } + /* + * Computed property names and non-identifiers are always safe + * as they can be distinguished from keywords easily. + */ + + + const needsNameCheck = !node.computed && node.key.type === "Identifier"; + /* + * Certain names are problematic unless they also have a + * a way to distinguish between keywords and property + * names. + */ + + if (needsNameCheck && unsafeClassFieldNames.has(node.key.name)) { + /* + * Special case: If the field name is `static`, + * it is only valid if the field is marked as static, + * so "static static" is okay but "static" is not. + */ + const isStaticStatic = node.static && node.key.name === "static"; + /* + * For other unsafe names, we only care if there is no + * initializer. No initializer = hazard. + */ + + if (!isStaticStatic && !node.value) { + return true; + } + } + + const followingToken = sourceCode.getTokenAfter(node); + return unsafeClassFieldFollowers.has(followingToken.value); + } /** * Check whether a given node is on the same line with the next token. * @param {Node} node A statement node to check. @@ -108948,11 +111663,16 @@ module.exports = { return true; // `;;` or `;}` } - if (isOnSameLineWithNextToken(node)) { - return false; // One liner. + if (maybeClassFieldAsiHazard(node)) { + return false; } - if (beforeStatementContinuationChars === "never" && !maybeAsiHazardAfter(node)) { + if (isOnSameLineWithNextToken(node)) { + return false; // One liner. + } // continuation characters should not apply to class fields + + + if (node.type !== "PropertyDefinition" && beforeStatementContinuationChars === "never" && !maybeAsiHazardAfter(node)) { return true; // ASI works. This statement doesn't connect to the next. } @@ -108963,13 +111683,15 @@ module.exports = { return false; } /** - * Checks a node to see if it's in a one-liner block statement. + * Checks a node to see if it's the last item in a one-liner block. + * Block is any `BlockStatement` or `StaticBlock` node. Block is a one-liner if its + * braces (and consequently everything between them) are on the same line. * @param {ASTNode} node The node to check. - * @returns {boolean} whether the node is in a one-liner block statement. + * @returns {boolean} whether the node is the last item in a one-liner block. */ - function isOneLinerBlock(node) { + function isLastInOneLinerBlock(node) { const parent = node.parent; const nextToken = sourceCode.getTokenAfter(node); @@ -108977,7 +111699,19 @@ module.exports = { return false; } - return !!parent && parent.type === "BlockStatement" && parent.loc.start.line === parent.loc.end.line; + if (parent.type === "BlockStatement") { + return parent.loc.start.line === parent.loc.end.line; + } + + if (parent.type === "StaticBlock") { + const openingBrace = sourceCode.getFirstToken(parent, { + skip: 1 + }); // skip the `static` token + + return openingBrace.loc.start.line === parent.loc.end.line; + } + + return false; } /** * Checks a node to see if it's followed by a semicolon. @@ -108992,11 +111726,11 @@ module.exports = { if (never) { if (isSemi && canRemoveSemicolon(node)) { report(node, true); - } else if (!isSemi && beforeStatementContinuationChars === "always" && maybeAsiHazardBefore(sourceCode.getTokenAfter(node))) { + } else if (!isSemi && beforeStatementContinuationChars === "always" && node.type !== "PropertyDefinition" && maybeAsiHazardBefore(sourceCode.getTokenAfter(node))) { report(node); } } else { - const oneLinerBlock = exceptOneLine && isOneLinerBlock(node); + const oneLinerBlock = exceptOneLine && isLastInOneLinerBlock(node); if (isSemi && oneLinerBlock) { report(node, true); @@ -109045,15 +111779,16 @@ module.exports = { if (!/(?:Class|Function)Declaration/u.test(node.declaration.type)) { checkForSemicolon(node); } - } + }, + PropertyDefinition: checkForSemicolon }; } }; /***/ }), -/* 823 */ +/* 824 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -109063,7 +111798,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -109073,7 +111808,6 @@ module.exports = { type: "layout", docs: { description: "enforce consistent spacing before and after semicolons", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/semi-spacing" }, @@ -109292,15 +112026,16 @@ module.exports = { if (node.test) { checkSemicolonSpacing(sourceCode.getTokenAfter(node.test), node); } - } + }, + PropertyDefinition: checkNode }; } }; /***/ }), -/* 824 */ +/* 825 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -109312,15 +112047,16 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ -const SELECTOR = `:matches(${["BreakStatement", "ContinueStatement", "DebuggerStatement", "DoWhileStatement", "ExportAllDeclaration", "ExportDefaultDeclaration", "ExportNamedDeclaration", "ExpressionStatement", "ImportDeclaration", "ReturnStatement", "ThrowStatement", "VariableDeclaration"].join(",")})`; +const SELECTOR = ["BreakStatement", "ContinueStatement", "DebuggerStatement", "DoWhileStatement", "ExportAllDeclaration", "ExportDefaultDeclaration", "ExportNamedDeclaration", "ExpressionStatement", "ImportDeclaration", "ReturnStatement", "ThrowStatement", "VariableDeclaration", "PropertyDefinition"].join(","); /** * Get the child node list of a given node. - * This returns `Program#body`, `BlockStatement#body`, or `SwitchCase#consequent`. + * This returns `BlockStatement#body`, `StaticBlock#body`, `Program#body`, + * `ClassBody#body`, or `SwitchCase#consequent`. * This is used to check whether a node is the first/last child. * @param {Node} node A node to get child node list. * @returns {Node[]|null} The child node list. @@ -109329,7 +112065,7 @@ const SELECTOR = `:matches(${["BreakStatement", "ContinueStatement", "DebuggerSt function getChildren(node) { const t = node.type; - if (t === "BlockStatement" || t === "Program") { + if (t === "BlockStatement" || t === "StaticBlock" || t === "Program" || t === "ClassBody") { return node.body; } @@ -109368,7 +112104,6 @@ module.exports = { type: "layout", docs: { description: "enforce location of semicolons", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/semi-style" }, @@ -109452,7 +112187,7 @@ module.exports = { }; /***/ }), -/* 825 */ +/* 826 */ /***/ ((module) => { "use strict"; @@ -109469,7 +112204,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce sorted import declarations within modules", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/sort-imports" }, @@ -109678,7 +112412,7 @@ module.exports = { }; /***/ }), -/* 826 */ +/* 827 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -109690,8 +112424,8 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547), - naturalCompare = __webpack_require__(827); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548), + naturalCompare = __webpack_require__(828); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -109768,7 +112502,6 @@ module.exports = { type: "suggestion", docs: { description: "require object keys to be sorted", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/sort-keys" }, @@ -109866,7 +112599,7 @@ module.exports = { }; /***/ }), -/* 827 */ +/* 828 */ /***/ ((module) => { /* @@ -109921,7 +112654,7 @@ try { } /***/ }), -/* 828 */ +/* 829 */ /***/ ((module) => { "use strict"; @@ -109938,7 +112671,6 @@ module.exports = { type: "suggestion", docs: { description: "require variables within the same declaration block to be sorted", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/sort-vars" }, @@ -110010,7 +112742,7 @@ module.exports = { }; /***/ }), -/* 829 */ +/* 830 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -110022,7 +112754,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -110046,7 +112778,6 @@ module.exports = { type: "layout", docs: { description: "enforce consistent spacing before blocks", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/space-before-blocks" }, @@ -110105,6 +112836,7 @@ module.exports = { * Checks whether the spacing before the given block is already controlled by another rule: * - `arrow-spacing` checks spaces after `=>`. * - `keyword-spacing` checks spaces after keywords in certain contexts. + * - `switch-colon-spacing` checks spaces after `:` of switch cases. * @param {Token} precedingToken first token before the block. * @param {ASTNode|Token} node `BlockStatement` node or `{` token of a `SwitchStatement` node. * @returns {boolean} `true` if requiring or disallowing spaces before the given block could produce conflicts with other rules. @@ -110112,7 +112844,7 @@ module.exports = { function isConflicted(precedingToken, node) { - return astUtils.isArrowToken(precedingToken) || astUtils.isKeywordToken(precedingToken) && !isFunctionBody(node); + return astUtils.isArrowToken(precedingToken) || astUtils.isKeywordToken(precedingToken) && !isFunctionBody(node) || astUtils.isColonToken(precedingToken) && node.parent && node.parent.type === "SwitchCase" && precedingToken === astUtils.getSwitchCaseColonToken(node.parent, sourceCode); } /** * Checks the given BlockStatement node has a preceding space if it doesn’t start on a new line. @@ -110193,7 +112925,7 @@ module.exports = { }; /***/ }), -/* 830 */ +/* 831 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -110205,7 +112937,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -110215,7 +112947,6 @@ module.exports = { type: "layout", docs: { description: "enforce consistent spacing before `function` definition opening parenthesis", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/space-before-function-paren" }, @@ -110344,7 +113075,7 @@ module.exports = { }; /***/ }), -/* 831 */ +/* 832 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -110354,7 +113085,7 @@ module.exports = { */ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -110364,7 +113095,6 @@ module.exports = { type: "layout", docs: { description: "enforce consistent spacing inside parentheses", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/space-in-parens" }, @@ -110645,24 +113375,28 @@ module.exports = { }; /***/ }), -/* 832 */ -/***/ ((module) => { +/* 833 */ +/***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; /** * @fileoverview Require spaces around infix operators * @author Michael Ficarra */ - //------------------------------------------------------------------------------ + + +const { + isEqToken +} = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ + module.exports = { meta: { type: "layout", docs: { description: "require spacing around infix operators", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/space-infix-ops" }, @@ -110811,14 +113545,35 @@ module.exports = { BinaryExpression: checkBinary, LogicalExpression: checkBinary, ConditionalExpression: checkConditional, - VariableDeclarator: checkVar + VariableDeclarator: checkVar, + + PropertyDefinition(node) { + if (!node.value) { + return; + } + /* + * Because of computed properties and type annotations, some + * tokens may exist between `node.key` and `=`. + * Therefore, find the `=` from the right. + */ + + + const operatorToken = sourceCode.getTokenBefore(node.value, isEqToken); + const leftToken = sourceCode.getTokenBefore(operatorToken); + const rightToken = sourceCode.getTokenAfter(operatorToken); + + if (!sourceCode.isSpaceBetweenTokens(leftToken, operatorToken) || !sourceCode.isSpaceBetweenTokens(operatorToken, rightToken)) { + report(node, operatorToken); + } + } + }; } }; /***/ }), -/* 833 */ +/* 834 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -110830,7 +113585,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -110840,7 +113595,6 @@ module.exports = { type: "layout", docs: { description: "enforce consistent spacing before or after unary operators", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/space-unary-ops" }, @@ -111157,7 +113911,7 @@ module.exports = { }; /***/ }), -/* 834 */ +/* 835 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -111167,9 +113921,9 @@ module.exports = { */ -const escapeRegExp = __webpack_require__(552); +const escapeRegExp = __webpack_require__(525); -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -111181,7 +113935,7 @@ const astUtils = __webpack_require__(547); //----------------------------------- function escape(s) { - return `(?:${escapeRegExp(s)})`; + return "(?:".concat(escapeRegExp(s), ")"); } /** * Escapes the control characters of a given string. @@ -111192,7 +113946,7 @@ function escape(s) { function escapeAndRepeat(s) { - return `${escape(s)}+`; + return "".concat(escape(s), "+"); } /** * Parses `markers` option. @@ -111247,7 +114001,7 @@ function createExceptionsPattern(exceptions) { pattern += ")"; } - pattern += `(?:$|[${Array.from(astUtils.LINEBREAKS).join("")}]))`; + pattern += "(?:$|[".concat(Array.from(astUtils.LINEBREAKS).join(""), "]))"); } return pattern; @@ -111300,7 +114054,7 @@ function createAlwaysStylePattern(markers, exceptions) { function createNeverStylePattern(markers) { - const pattern = `^(${markers.map(escape).join("|")})?[ \t]+`; + const pattern = "^(".concat(markers.map(escape).join("|"), ")?[ \t]+"); return new RegExp(pattern, "u"); } //------------------------------------------------------------------------------ // Rule Definition @@ -111312,7 +114066,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce consistent spacing after the `//` or `/*` in a comment", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/spaced-comment" }, @@ -111406,9 +114159,9 @@ module.exports = { rule[type] = { beginRegex: requireSpace ? createAlwaysStylePattern(markers, exceptions) : createNeverStylePattern(markers), - endRegex: balanced && requireSpace ? new RegExp(`${createExceptionsPattern(exceptions)}$`, "u") : new RegExp(endNeverPattern, "u"), + endRegex: balanced && requireSpace ? new RegExp("".concat(createExceptionsPattern(exceptions), "$"), "u") : new RegExp(endNeverPattern, "u"), hasExceptions: exceptions.length > 0, - captureMarker: new RegExp(`^(${markers.map(escape).join("|")})`, "u"), + captureMarker: new RegExp("^(".concat(markers.map(escape).join("|"), ")"), "u"), markers: new Set(markers) }; return rule; @@ -111537,7 +114290,7 @@ module.exports = { }; /***/ }), -/* 835 */ +/* 836 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -111549,7 +114302,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -111605,7 +114358,6 @@ module.exports = { type: "suggestion", docs: { description: "require or disallow strict mode directives", - category: "Strict Mode", recommended: false, url: "https://eslint.org/docs/rules/strict" }, @@ -111844,7 +114596,7 @@ module.exports = { }; /***/ }), -/* 836 */ +/* 837 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -111856,7 +114608,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -111866,7 +114618,6 @@ module.exports = { type: "layout", docs: { description: "enforce spacing around colons of switch statements", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/switch-colon-spacing" }, @@ -111900,19 +114651,6 @@ module.exports = { const afterSpacing = options.after !== false; // true by default - /** - * Get the colon token of the given SwitchCase node. - * @param {ASTNode} node The SwitchCase node to get. - * @returns {Token} The colon token of the node. - */ - - function getColonToken(node) { - if (node.test) { - return sourceCode.getTokenAfter(node.test, astUtils.isColonToken); - } - - return sourceCode.getFirstToken(node, 1); - } /** * Check whether the spacing between the given 2 tokens is valid or not. * @param {Token} left The left token to check. @@ -111921,7 +114659,6 @@ module.exports = { * @returns {boolean} `true` if the spacing between the tokens is valid. */ - function isValidSpacing(left, right, expected) { return astUtils.isClosingBraceToken(right) || !astUtils.isTokenOnSameLine(left, right) || sourceCode.isSpaceBetweenTokens(left, right) === expected; } @@ -111963,7 +114700,7 @@ module.exports = { return { SwitchCase(node) { - const colonToken = getColonToken(node); + const colonToken = astUtils.getSwitchCaseColonToken(node, sourceCode); const beforeToken = sourceCode.getTokenBefore(colonToken); const afterToken = sourceCode.getTokenAfter(colonToken); @@ -111992,7 +114729,7 @@ module.exports = { }; /***/ }), -/* 837 */ +/* 838 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -112004,7 +114741,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -112014,7 +114751,6 @@ module.exports = { type: "suggestion", docs: { description: "require symbol descriptions", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/symbol-description" }, @@ -112063,7 +114799,7 @@ module.exports = { }; /***/ }), -/* 838 */ +/* 839 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -112075,7 +114811,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -112085,7 +114821,6 @@ module.exports = { type: "layout", docs: { description: "require or disallow spacing around embedded expressions of template strings", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/template-curly-spacing" }, @@ -112209,7 +114944,7 @@ module.exports = { }; /***/ }), -/* 839 */ +/* 840 */ /***/ ((module) => { "use strict"; @@ -112226,7 +114961,6 @@ module.exports = { type: "layout", docs: { description: "require or disallow spacing between template tags and their literals", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/template-tag-spacing" }, @@ -112300,7 +115034,7 @@ module.exports = { }; /***/ }), -/* 840 */ +/* 841 */ /***/ ((module) => { "use strict"; @@ -112317,7 +115051,6 @@ module.exports = { type: "layout", docs: { description: "require or disallow Unicode byte order mark (BOM)", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/unicode-bom" }, @@ -112374,7 +115107,7 @@ module.exports = { }; /***/ }), -/* 841 */ +/* 842 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -112386,7 +115119,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); //------------------------------------------------------------------------------ +const astUtils = __webpack_require__(548); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ @@ -112398,7 +115131,7 @@ const astUtils = __webpack_require__(547); //----------------------------------- function isNaNIdentifier(node) { - return Boolean(node) && node.type === "Identifier" && node.name === "NaN"; + return Boolean(node) && (astUtils.isSpecificId(node, "NaN") || astUtils.isSpecificMemberAccess(node, "Number", "NaN")); } //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -112409,7 +115142,6 @@ module.exports = { type: "problem", docs: { description: "require calls to `isNaN()` when checking for `NaN`", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/use-isnan" }, @@ -112519,19 +115251,20 @@ module.exports = { }; /***/ }), -/* 842 */ +/* 843 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; /** * @fileoverview Validates JSDoc comments are syntactically correct * @author Nicholas C. Zakas + * @deprecated in ESLint v5.10.0 */ //------------------------------------------------------------------------------ // Requirements //------------------------------------------------------------------------------ -const doctrine = __webpack_require__(843); //------------------------------------------------------------------------------ +const doctrine = __webpack_require__(844); //------------------------------------------------------------------------------ // Rule Definition //------------------------------------------------------------------------------ @@ -112541,7 +115274,6 @@ module.exports = { type: "suggestion", docs: { description: "enforce valid JSDoc comments", - category: "Possible Errors", recommended: false, url: "https://eslint.org/docs/rules/valid-jsdoc" }, @@ -112884,7 +115616,7 @@ module.exports = { start: entireTagRange.start, end: { line: entireTagRange.start.line, - column: entireTagRange.start.column + `@${tag.title}`.length + column: entireTagRange.start.column + "@".concat(tag.title).length } }, data: { @@ -113047,7 +115779,7 @@ module.exports = { }; /***/ }), -/* 843 */ +/* 844 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { /* @@ -113060,9 +115792,9 @@ module.exports = { 'use strict'; var typed, utility, jsdoc, esutils, hasOwnProperty; - esutils = __webpack_require__(548); - typed = __webpack_require__(844); - utility = __webpack_require__(845); + esutils = __webpack_require__(549); + typed = __webpack_require__(845); + utility = __webpack_require__(846); function sliceSource(source, index, last) { return source.slice(index, last); @@ -114030,7 +116762,7 @@ module.exports = { /* vim: set sw=4 ts=4 et tw=80 : */ /***/ }), -/* 844 */ +/* 845 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { /* @@ -114044,8 +116776,8 @@ module.exports = { 'use strict'; var Syntax, Token, source, length, index, previous, token, value, esutils, utility, rangeOffset, addRange; - esutils = __webpack_require__(548); - utility = __webpack_require__(845); + esutils = __webpack_require__(549); + utility = __webpack_require__(846); Syntax = { NullableLiteral: 'NullableLiteral', AllLiteral: 'AllLiteral', @@ -115503,7 +118235,7 @@ module.exports = { /* vim: set sw=4 ts=4 et tw=80 : */ /***/ }), -/* 845 */ +/* 846 */ /***/ ((__unused_webpack_module, exports, __webpack_require__) => { /* @@ -115514,7 +118246,7 @@ module.exports = { 'use strict'; var VERSION; - VERSION = __webpack_require__(846).version; + VERSION = (__webpack_require__(847).version); exports.VERSION = VERSION; function DoctrineError(message) { @@ -115537,19 +118269,19 @@ module.exports = { } exports.throwError = throwError; - exports.assert = __webpack_require__(407); + exports.assert = __webpack_require__(431); })(); /* vim: set sw=4 ts=4 et tw=80 : */ /***/ }), -/* 846 */ +/* 847 */ /***/ ((module) => { "use strict"; module.exports = JSON.parse('{"name":"doctrine","description":"JSDoc parser","homepage":"https://github.com/eslint/doctrine","main":"lib/doctrine.js","version":"3.0.0","engines":{"node":">=6.0.0"},"directories":{"lib":"./lib"},"files":["lib"],"maintainers":[{"name":"Nicholas C. Zakas","email":"nicholas+npm@nczconsulting.com","web":"https://www.nczonline.net"},{"name":"Yusuke Suzuki","email":"utatane.tea@gmail.com","web":"https://github.com/Constellation"}],"repository":"eslint/doctrine","devDependencies":{"coveralls":"^3.0.1","dateformat":"^1.0.11","eslint":"^1.10.3","eslint-release":"^1.0.0","linefix":"^0.1.1","mocha":"^3.4.2","npm-license":"^0.3.1","nyc":"^10.3.2","semver":"^5.0.3","shelljs":"^0.5.3","shelljs-nodecli":"^0.1.1","should":"^5.0.1"},"license":"Apache-2.0","scripts":{"pretest":"npm run lint","test":"nyc mocha","coveralls":"nyc report --reporter=text-lcov | coveralls","lint":"eslint lib/","generate-release":"eslint-generate-release","generate-alpharelease":"eslint-generate-prerelease alpha","generate-betarelease":"eslint-generate-prerelease beta","generate-rcrelease":"eslint-generate-prerelease rc","publish-release":"eslint-publish-release"},"dependencies":{"esutils":"^2.0.2"}}'); /***/ }), -/* 847 */ +/* 848 */ /***/ ((module) => { "use strict"; @@ -115566,7 +118298,6 @@ module.exports = { type: "problem", docs: { description: "enforce comparing `typeof` expressions against valid strings", - category: "Possible Errors", recommended: true, url: "https://eslint.org/docs/rules/valid-typeof" }, @@ -115636,7 +118367,7 @@ module.exports = { }; /***/ }), -/* 848 */ +/* 849 */ /***/ ((module) => { "use strict"; @@ -115654,7 +118385,6 @@ module.exports = { type: "suggestion", docs: { description: "require `var` declarations be placed at the top of their containing scope", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/vars-on-top" }, @@ -115668,9 +118398,9 @@ module.exports = { //-------------------------------------------------------------------------- // Helpers //-------------------------------------------------------------------------- - // eslint-disable-next-line jsdoc/require-description /** + * Has AST suggesting a directive. * @param {ASTNode} node any node * @returns {boolean} whether the given node structurally represents a directive */ @@ -115707,11 +118437,13 @@ module.exports = { function isVarOnTop(node, statements) { const l = statements.length; - let i = 0; // skip over directives + let i = 0; // Skip over directives and imports. Static blocks don't have either. - for (; i < l; ++i) { - if (!looksLikeDirective(statements[i]) && !looksLikeImport(statements[i])) { - break; + if (node.parent.type !== "StaticBlock") { + for (; i < l; ++i) { + if (!looksLikeDirective(statements[i]) && !looksLikeImport(statements[i])) { + break; + } } } @@ -115746,19 +118478,27 @@ module.exports = { /** * Checks whether variable is on top at functional block scope level * @param {ASTNode} node The node to check - * @param {ASTNode} parent Parent of the node - * @param {ASTNode} grandParent Parent of the node's parent * @returns {void} */ - function blockScopeVarCheck(node, parent, grandParent) { - if (!(/Function/u.test(grandParent.type) && parent.type === "BlockStatement" && isVarOnTop(node, parent.body))) { - context.report({ - node, - messageId: "top" - }); + function blockScopeVarCheck(node) { + const { + parent + } = node; + + if (parent.type === "BlockStatement" && /Function/u.test(parent.parent.type) && isVarOnTop(node, parent.body)) { + return; } + + if (parent.type === "StaticBlock" && isVarOnTop(node, parent.body)) { + return; + } + + context.report({ + node, + messageId: "top" + }); } //-------------------------------------------------------------------------- // Public API //-------------------------------------------------------------------------- @@ -115771,7 +118511,7 @@ module.exports = { } else if (node.parent.type === "Program") { globalVarCheck(node, node.parent); } else { - blockScopeVarCheck(node, node.parent, node.parent.parent); + blockScopeVarCheck(node); } } @@ -115781,7 +118521,7 @@ module.exports = { }; /***/ }), -/* 849 */ +/* 850 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -115793,7 +118533,7 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const astUtils = __webpack_require__(547); +const astUtils = __webpack_require__(548); const eslintUtils = __webpack_require__(501); //---------------------------------------------------------------------- // Helpers @@ -115820,7 +118560,6 @@ module.exports = { type: "layout", docs: { description: "require parentheses around immediate `function` invocations", - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/wrap-iife" }, @@ -115908,7 +118647,7 @@ module.exports = { fix(fixer) { const nodeToSurround = style === "inside" ? innerNode : node; - return fixer.replaceText(nodeToSurround, `(${sourceCode.getText(nodeToSurround)})`); + return fixer.replaceText(nodeToSurround, "(".concat(sourceCode.getText(nodeToSurround), ")")); } }); @@ -115926,7 +118665,7 @@ module.exports = { * for example, in `(function(foo) {}(bar))`, the range `(bar))` should get replaced with `)(bar)`. */ const parenAfter = sourceCode.getTokenAfter(node); - return fixer.replaceTextRange([innerNode.range[1], parenAfter.range[1]], `)${sourceCode.getText().slice(innerNode.range[1], parenAfter.range[0])}`); + return fixer.replaceTextRange([innerNode.range[1], parenAfter.range[1]], ")".concat(sourceCode.getText().slice(innerNode.range[1], parenAfter.range[0]))); } /* * Call expression is wrapped in mandatory parens such as if(), or in necessary grouping parens. @@ -115934,7 +118673,7 @@ module.exports = { */ - return fixer.replaceText(innerNode, `(${sourceCode.getText(innerNode)})`); + return fixer.replaceText(innerNode, "(".concat(sourceCode.getText(innerNode), ")")); } }); @@ -115951,7 +118690,7 @@ module.exports = { * should get replaced with `(bar))`. */ const parenAfter = sourceCode.getTokenAfter(innerNode); - return fixer.replaceTextRange([parenAfter.range[0], node.range[1]], `${sourceCode.getText().slice(parenAfter.range[1], node.range[1])})`); + return fixer.replaceTextRange([parenAfter.range[0], node.range[1]], "".concat(sourceCode.getText().slice(parenAfter.range[1], node.range[1]), ")")); } }); @@ -115964,7 +118703,7 @@ module.exports = { }; /***/ }), -/* 850 */ +/* 851 */ /***/ ((module) => { "use strict"; @@ -115981,7 +118720,6 @@ module.exports = { type: "layout", docs: { description: "require parenthesis around regex literals", - category: "Stylistic Issues", recommended: false, url: "https://eslint.org/docs/rules/wrap-regex" }, @@ -116009,7 +118747,7 @@ module.exports = { context.report({ node, messageId: "requireParens", - fix: fixer => fixer.replaceText(node, `(${sourceCode.getText(node)})`) + fix: fixer => fixer.replaceText(node, "(".concat(sourceCode.getText(node), ")")) }); } } @@ -116021,7 +118759,7 @@ module.exports = { }; /***/ }), -/* 851 */ +/* 852 */ /***/ ((module) => { "use strict"; @@ -116038,7 +118776,6 @@ module.exports = { type: "layout", docs: { description: "require or disallow spacing around the `*` in `yield*` expressions", - category: "ECMAScript 6", recommended: false, url: "https://eslint.org/docs/rules/yield-star-spacing" }, @@ -116165,7 +118902,7 @@ module.exports = { }; /***/ }), -/* 852 */ +/* 853 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -116177,7 +118914,7 @@ module.exports = { // Requirements //-------------------------------------------------------------------------- -const astUtils = __webpack_require__(547); //-------------------------------------------------------------------------- +const astUtils = __webpack_require__(548); //-------------------------------------------------------------------------- // Helpers //-------------------------------------------------------------------------- @@ -116266,7 +119003,7 @@ function getNormalizedLiteral(node) { return { type: "Literal", value: -node.argument.value, - raw: `-${node.argument.value}` + raw: "-".concat(node.argument.value) }; } @@ -116289,7 +119026,6 @@ module.exports = { type: "suggestion", docs: { description: 'require or disallow "Yoda" conditions', - category: "Best Practices", recommended: false, url: "https://eslint.org/docs/rules/yoda" }, @@ -116469,7 +119205,7 @@ module.exports = { }; /***/ }), -/* 853 */ +/* 854 */ /***/ ((module) => { function webpackEmptyContext(req) { @@ -116479,11 +119215,11 @@ function webpackEmptyContext(req) { } webpackEmptyContext.keys = () => ([]); webpackEmptyContext.resolve = webpackEmptyContext; -webpackEmptyContext.id = 853; +webpackEmptyContext.id = 854; module.exports = webpackEmptyContext; /***/ }), -/* 854 */ +/* 855 */ /***/ ((module) => { "use strict"; @@ -116498,8 +119234,8 @@ module.exports = webpackEmptyContext; /** * An event emitter * @typedef {Object} SafeEmitter - * @property {function(eventName: string, listenerFunc: Function): void} on Adds a listener for a given event name - * @property {function(eventName: string, arg1?: any, arg2?: any, arg3?: any)} emit Emits an event with a given name. + * @property {(eventName: string, listenerFunc: Function) => void} on Adds a listener for a given event name + * @property {(eventName: string, arg1?: any, arg2?: any, arg3?: any) => void} emit Emits an event with a given name. * This calls all the listeners that were listening for that name, with `arg1`, `arg2`, and `arg3` as arguments. * @property {function(): string[]} eventNames Gets the list of event names that have registered listeners. */ @@ -116527,7 +119263,11 @@ module.exports = () => { } }, - emit(eventName, ...args) { + emit(eventName) { + for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + args[_key - 1] = arguments[_key]; + } + if (eventName in listeners) { listeners[eventName].forEach(listener => listener(...args)); } @@ -116541,7 +119281,7 @@ module.exports = () => { }; /***/ }), -/* 855 */ +/* 856 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -116625,8 +119365,8 @@ SourceCodeFixer.applyFixes = function (sourceText, messages, shouldFix) { output = bom; /** * Try to use the 'fix' from a problem. - * @param {Message} problem The message object to apply fixes from - * @returns {boolean} Whether fix was successfully applied + * @param {Message} problem The message object to apply fixes from + * @returns {boolean} Whether fix was successfully applied */ function attemptFix(problem) { @@ -116696,12 +119436,12 @@ SourceCodeFixer.applyFixes = function (sourceText, messages, shouldFix) { module.exports = SourceCodeFixer; /***/ }), -/* 856 */ +/* 857 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(445); -/* provided dependency */ var console = __webpack_require__(493); +/* provided dependency */ var process = __webpack_require__(494); +/* provided dependency */ var console = __webpack_require__(438); /** * @fileoverview Tracks performance of individual rules. * @author Brandon Mills @@ -116783,7 +119523,7 @@ function display(data) { return [key, time]; }).sort((a, b) => b[1] - a[1]).slice(0, getListSize()); rows.forEach(row => { - row.push(`${(row[1] * 100 / total).toFixed(1)}%`); + row.push("".concat((row[1] * 100 / total).toFixed(1), "%")); row[1] = row[1].toFixed(3); }); rows.unshift(HEADERS); @@ -116804,7 +119544,7 @@ function display(data) { const extraAlignment = index !== 0 && index !== widths.length - 1 ? 2 : 1; return ALIGN[index](":", width + extraAlignment, "-"); }).join("|")); - console.log(table.join("\n")); // eslint-disable-line no-console + console.log(table.join("\n")); // eslint-disable-line no-console -- Debugging function } /* istanbul ignore next */ @@ -116813,7 +119553,7 @@ module.exports = function () { const data = Object.create(null); /** * Time the run - * @param {*} key key from the data object + * @param {any} key key from the data object * @param {Function} fn function to be called * @returns {Function} function to be executed * @private @@ -116824,9 +119564,9 @@ module.exports = function () { data[key] = 0; } - return function (...args) { + return function () { let t = process.hrtime(); - fn(...args); + fn(...arguments); t = process.hrtime(t); data[key] += t[0] * 1e3 + t[1] / 1e6; }; @@ -116846,14 +119586,14 @@ module.exports = function () { }(); /***/ }), -/* 857 */ +/* 858 */ /***/ ((module) => { "use strict"; module.exports = JSON.parse('{"rules":{"generator-star":["generator-star-spacing"],"global-strict":["strict"],"no-arrow-condition":["no-confusing-arrow","no-constant-condition"],"no-comma-dangle":["comma-dangle"],"no-empty-class":["no-empty-character-class"],"no-empty-label":["no-labels"],"no-extra-strict":["strict"],"no-reserved-keys":["quote-props"],"no-space-before-semi":["semi-spacing"],"no-wrap-func":["no-extra-parens"],"space-after-function-name":["space-before-function-paren"],"space-after-keywords":["keyword-spacing"],"space-before-function-parentheses":["space-before-function-paren"],"space-before-keywords":["keyword-spacing"],"space-in-brackets":["object-curly-spacing","array-bracket-spacing","computed-property-spacing"],"space-return-throw-case":["keyword-spacing"],"space-unary-word-ops":["space-unary-ops"],"spaced-line-comment":["spaced-comment"]}}'); /***/ }), -/* 858 */ +/* 859 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; @@ -116861,18 +119601,18 @@ module.exports = JSON.parse('{"rules":{"generator-star":["generator-star-spacing const { CLIEngine -} = __webpack_require__(859); +} = __webpack_require__(860); module.exports = { CLIEngine }; /***/ }), -/* 859 */ +/* 860 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; -/* provided dependency */ var process = __webpack_require__(445); +/* provided dependency */ var process = __webpack_require__(494); /** * @fileoverview Main CLI object. * @author Nicholas C. Zakas @@ -116887,13 +119627,13 @@ module.exports = { // Requirements //------------------------------------------------------------------------------ -const fs = __webpack_require__(860); +const fs = __webpack_require__(861); -const path = __webpack_require__(405); +const path = __webpack_require__(429); -const defaultOptions = __webpack_require__(861); +const defaultOptions = __webpack_require__(862); -const pkg = __webpack_require__(438); +const pkg = __webpack_require__(443); const { Legacy: { @@ -116904,27 +119644,27 @@ const { getUsedExtractedConfigs, ModuleResolver } -} = __webpack_require__(862); +} = __webpack_require__(863); const { FileEnumerator -} = __webpack_require__(919); +} = __webpack_require__(877); const { Linter -} = __webpack_require__(923); +} = __webpack_require__(881); -const builtInRules = __webpack_require__(544); +const builtInRules = __webpack_require__(545); -const loadRules = __webpack_require__(924); +const loadRules = __webpack_require__(882); -const hash = __webpack_require__(926); +const hash = __webpack_require__(884); -const LintResultCache = __webpack_require__(928); +const LintResultCache = __webpack_require__(886); const debug = __webpack_require__(496)("eslint:cli-engine"); -const validFixTypes = new Set(["problem", "suggestion", "layout"]); //------------------------------------------------------------------------------ +const validFixTypes = new Set(["directive", "problem", "suggestion", "layout"]); //------------------------------------------------------------------------------ // Typedefs //------------------------------------------------------------------------------ // For VSCode IntelliSense @@ -116943,9 +119683,9 @@ const validFixTypes = new Set(["problem", "suggestion", "layout"]); //---------- /** @typedef {import("../shared/types").Rule} Rule */ -/** @typedef {ReturnType} ConfigArray */ +/** @typedef {ReturnType} ConfigArray */ -/** @typedef {ReturnType} ExtractedConfig */ +/** @typedef {ReturnType} ExtractedConfig */ /** * The options to configure a CLI engine with. @@ -117030,7 +119770,7 @@ const internalSlotsMap = new WeakMap(); function validateFixTypes(fixTypes) { for (const fixType of fixTypes) { if (!validFixTypes.has(fixType)) { - throw new Error(`Invalid fix type "${fixType}" found.`); + throw new Error("Invalid fix type \"".concat(fixType, "\" found.")); } } } @@ -117047,6 +119787,10 @@ function calculateStatsPerFile(messages) { if (message.fatal || message.severity === 2) { stat.errorCount++; + if (message.fatal) { + stat.fatalErrorCount++; + } + if (message.fix) { stat.fixableErrorCount++; } @@ -117061,6 +119805,7 @@ function calculateStatsPerFile(messages) { return stat; }, { errorCount: 0, + fatalErrorCount: 0, warningCount: 0, fixableErrorCount: 0, fixableWarningCount: 0 @@ -117077,12 +119822,14 @@ function calculateStatsPerFile(messages) { function calculateStatsPerRun(results) { return results.reduce((stat, result) => { stat.errorCount += result.errorCount; + stat.fatalErrorCount += result.fatalErrorCount; stat.warningCount += result.warningCount; stat.fixableErrorCount += result.fixableErrorCount; stat.fixableWarningCount += result.fixableWarningCount; return stat; }, { errorCount: 0, + fatalErrorCount: 0, warningCount: 0, fixableErrorCount: 0, fixableWarningCount: 0 @@ -117105,19 +119852,20 @@ function calculateStatsPerRun(results) { */ -function verifyText({ - text, - cwd, - filePath: providedFilePath, - config, - fix, - allowInlineConfig, - reportUnusedDisableDirectives, - fileEnumerator, - linter -}) { +function verifyText(_ref) { + let { + text, + cwd, + filePath: providedFilePath, + config, + fix, + allowInlineConfig, + reportUnusedDisableDirectives, + fileEnumerator, + linter + } = _ref; const filePath = providedFilePath || ""; - debug(`Lint ${filePath}`); + debug("Lint ".concat(filePath)); /* * Verify. * `config.extractConfig(filePath)` requires an absolute path, but `linter` @@ -117165,7 +119913,7 @@ function verifyText({ /** * Returns result with warning by ignore settings * @param {string} filePath File path of checked code - * @param {string} baseDir Absolute path of base directory + * @param {string} baseDir Absolute path of base directory * @returns {LintResult} Result with single warning * @private */ @@ -117216,6 +119964,23 @@ function getRule(ruleId, configArrays) { return builtInRules.get(ruleId) || null; } +/** + * Checks whether a message's rule type should be fixed. + * @param {LintMessage} message The message to check. + * @param {ConfigArray[]} lastConfigArrays The list of config arrays that the last `executeOnFiles` or `executeOnText` used. + * @param {string[]} fixTypes An array of fix types to check. + * @returns {boolean} Whether the message should be fixed. + */ + + +function shouldMessageBeFixed(message, lastConfigArrays, fixTypes) { + if (!message.ruleId) { + return fixTypes.has("directive"); + } + + const rule = message.ruleId && getRule(message.ruleId, lastConfigArrays); + return Boolean(rule && rule.meta && fixTypes.has(rule.meta.type)); +} /** * Collect used deprecated rules. * @param {ConfigArray[]} usedConfigArrays The config arrays which were used. @@ -117294,7 +120059,7 @@ function getCacheFile(cacheFile, cwd) { */ function getCacheFileForDirectory() { - return path.join(resolvedCacheFile, `.cache_${hash(cwd)}`); + return path.join(resolvedCacheFile, ".cache_".concat(hash(cwd))); } let fileStats; @@ -117343,13 +120108,14 @@ function getCacheFile(cacheFile, cwd) { * @param {string[]|null} keys The keys to assign true. * @param {boolean} defaultValue The default value for each property. * @param {string} displayName The property name which is used in error message. + * @throws {Error} Requires array. * @returns {Record} The boolean map. */ function toBooleanMap(keys, defaultValue, displayName) { if (keys && !Array.isArray(keys)) { - throw new Error(`${displayName} must be an array.`); + throw new Error("".concat(displayName, " must be an array.")); } if (keys && keys.length > 0) { @@ -117401,6 +120167,7 @@ function createConfigDataFromOptions(options) { /** * Checks whether a directory exists at the given location * @param {string} resolvedPath A path from the CWD + * @throws {Error} As thrown by `fs.statSync` or `fs.isDirectory`. * @returns {boolean} `true` if a directory exists */ @@ -117419,13 +120186,22 @@ function directoryExists(resolvedPath) { // Public Interface //------------------------------------------------------------------------------ +/** + * Core CLI. + */ + class CLIEngine { /** * Creates a new instance of the core CLI engine. * @param {CLIEngineOptions} providedOptions The options for this instance. + * @param {Object} [additionalData] Additional settings that are not CLIEngineOptions. + * @param {Record|null} [additionalData.preloadedPlugins] Preloaded plugins. */ constructor(providedOptions) { + let { + preloadedPlugins + } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; const options = Object.assign(Object.create(null), defaultOptions, { cwd: process.cwd() }, providedOptions); @@ -117435,6 +120211,13 @@ class CLIEngine { } const additionalPluginPool = new Map(); + + if (preloadedPlugins) { + for (const [id, plugin] of Object.entries(preloadedPlugins)) { + additionalPluginPool.set(id, plugin); + } + } + const cacheFilePath = getCacheFile(options.cacheLocation || options.cacheFile, options.cwd); const configArrayFactory = new CascadingConfigArrayFactory({ additionalPluginPool, @@ -117480,7 +120263,7 @@ class CLIEngine { }); // setup special filter for fixes if (options.fix && options.fixTypes && options.fixTypes.length > 0) { - debug(`Using fix types ${options.fixTypes}`); // throw an error if any invalid fix types are found + debug("Using fix types ".concat(options.fixTypes)); // throw an error if any invalid fix types are found validateFixTypes(options.fixTypes); // convert to Set for faster lookup @@ -117488,11 +120271,7 @@ class CLIEngine { const originalFix = typeof options.fix === "function" ? options.fix : () => true; - options.fix = message => { - const rule = message.ruleId && getRule(message.ruleId, lastConfigArrays); - const matches = rule && rule.meta && fixTypes.has(rule.meta.type); - return matches && originalFix(message); - }; + options.fix = message => shouldMessageBeFixed(message, lastConfigArrays, fixTypes) && originalFix(message); } } @@ -117544,25 +120323,6 @@ class CLIEngine { fs.writeFileSync(result.filePath, result.output); }); } - /** - * Add a plugin by passing its configuration - * @param {string} name Name of the plugin. - * @param {Plugin} pluginObject Plugin configuration object. - * @returns {void} - */ - - - addPlugin(name, pluginObject) { - const { - additionalPluginPool, - configArrayFactory, - lastConfigArrays - } = internalSlotsMap.get(this); - additionalPluginPool.set(name, pluginObject); - configArrayFactory.clearCache(); - lastConfigArrays.length = 1; - lastConfigArrays[0] = configArrayFactory.getConfigArrayForFile(); - } /** * Resolves the patterns passed into executeOnFiles() into glob-based patterns * for easier handling. @@ -117581,7 +120341,7 @@ class CLIEngine { } const extensions = (options.extensions || [".js"]).map(ext => ext.replace(/^\./u, "")); - const dirSuffix = `/**/*.{${extensions.join(",")}}`; + const dirSuffix = "/**/*.{".concat(extensions.join(","), "}"); return patterns.filter(Boolean).map(pathname => { const resolvedPath = path.resolve(options.cwd, pathname); const newPath = directoryExists(resolvedPath) ? pathname.replace(/[/\\]$/u, "") + dirSuffix : pathname; @@ -117591,6 +120351,7 @@ class CLIEngine { /** * Executes the current configuration on an array of file and directory names. * @param {string[]} patterns An array of file and directory names. + * @throws {Error} As may be thrown by `fs.unlinkSync`. * @returns {LintReport} The results for all files that were linted. */ @@ -117657,9 +120418,9 @@ class CLIEngine { const hadMessages = cachedResult.messages && cachedResult.messages.length > 0; if (hadMessages && fix) { - debug(`Reprocessing cached file to allow autofix: ${filePath}`); + debug("Reprocessing cached file to allow autofix: ".concat(filePath)); } else { - debug(`Skipping file since it hasn't changed: ${filePath}`); + debug("Skipping file since it hasn't changed: ".concat(filePath)); results.push(cachedResult); continue; } @@ -117696,7 +120457,7 @@ class CLIEngine { lintResultCache.reconcile(); } - debug(`Linting complete in: ${Date.now() - startTime}ms`); + debug("Linting complete in: ".concat(Date.now() - startTime, "ms")); let usedDeprecatedRules; return { results, @@ -117769,7 +120530,7 @@ class CLIEngine { })); } - debug(`Linting complete in: ${Date.now() - startTime}ms`); + debug("Linting complete in: ".concat(Date.now() - startTime, "ms")); let usedDeprecatedRules; return { results, @@ -117791,6 +120552,7 @@ class CLIEngine { * This is the same logic used by the ESLint CLI executable to determine * configuration for each file it processes. * @param {string} filePath The path of the file to retrieve a config object for. + * @throws {Error} If filepath a directory path. * @returns {ConfigData} A configuration object for the file. */ @@ -117840,6 +120602,7 @@ class CLIEngine { * Returns the formatter representing the given format or null if the `format` is not a string. * @param {string} [format] The name of the format to load or the path to a * custom formatter. + * @throws {any} As may be thrown by requiring of formatter * @returns {(Function|null)} The formatter function or null if the `format` is not a string. */ @@ -117868,9 +120631,14 @@ class CLIEngine { } try { - return __webpack_require__(925)(formatterPath); + return __webpack_require__(883)(formatterPath); } catch (ex) { - ex.message = `There was a problem loading formatter: ${formatterPath}\nError: ${ex.message}`; + if (format === "table" || format === "codeframe") { + ex.message = "The ".concat(format, " formatter is no longer part of core ESLint. Install it manually with `npm install -D eslint-formatter-").concat(format, "`"); + } else { + ex.message = "There was a problem loading formatter: ".concat(formatterPath, "\nError: ").concat(ex.message); + } + throw ex; } } else { @@ -117897,14 +120665,14 @@ module.exports = { }; /***/ }), -/* 860 */ +/* 861 */ /***/ ((module) => { "use strict"; module.exports = require("fs"); /***/ }), -/* 861 */ +/* 862 */ /***/ ((module) => { "use strict"; @@ -117941,89 +120709,2334 @@ module.exports = { }; /***/ }), -/* 862 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/* 863 */ +/***/ ((__unused_webpack_module, exports, __webpack_require__) => { "use strict"; +/* provided dependency */ var process = __webpack_require__(494); + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var fs = __webpack_require__(861); +var path = __webpack_require__(429); +var importFresh = __webpack_require__(864); +var stripComments = __webpack_require__(870); +var util = __webpack_require__(439); +var Ajv = __webpack_require__(446); +var globals = __webpack_require__(492); +var Module = __webpack_require__(866); +var assert = __webpack_require__(431); +var ignore = __webpack_require__(737); +var debugOrig = __webpack_require__(496); +var minimatch = __webpack_require__(871); +var os = __webpack_require__(875); +var url = __webpack_require__(876); + +function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } + +var fs__default = /*#__PURE__*/_interopDefaultLegacy(fs); +var path__default = /*#__PURE__*/_interopDefaultLegacy(path); +var importFresh__default = /*#__PURE__*/_interopDefaultLegacy(importFresh); +var stripComments__default = /*#__PURE__*/_interopDefaultLegacy(stripComments); +var util__default = /*#__PURE__*/_interopDefaultLegacy(util); +var Ajv__default = /*#__PURE__*/_interopDefaultLegacy(Ajv); +var globals__default = /*#__PURE__*/_interopDefaultLegacy(globals); +var Module__default = /*#__PURE__*/_interopDefaultLegacy(Module); +var assert__default = /*#__PURE__*/_interopDefaultLegacy(assert); +var ignore__default = /*#__PURE__*/_interopDefaultLegacy(ignore); +var debugOrig__default = /*#__PURE__*/_interopDefaultLegacy(debugOrig); +var minimatch__default = /*#__PURE__*/_interopDefaultLegacy(minimatch); +var os__default = /*#__PURE__*/_interopDefaultLegacy(os); + /** - * @fileoverview Package exports for @eslint/eslintrc + * @fileoverview Config file operations. This file must be usable in the browser, + * so no Node-specific code can be here. * @author Nicholas C. Zakas */ - //------------------------------------------------------------------------------ -// Requirements + +//------------------------------------------------------------------------------ +// Private //------------------------------------------------------------------------------ -const { - ConfigArrayFactory, - createContext: createConfigArrayFactoryContext -} = __webpack_require__(863); +const RULE_SEVERITY_STRINGS = ["off", "warn", "error"], + RULE_SEVERITY = RULE_SEVERITY_STRINGS.reduce((map, value, index) => { + map[value] = index; + return map; + }, {}), + VALID_SEVERITIES = [0, 1, 2, "off", "warn", "error"]; -const { - CascadingConfigArrayFactory -} = __webpack_require__(916); +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ -const ModuleResolver = __webpack_require__(872); +/** + * Normalizes the severity value of a rule's configuration to a number + * @param {(number|string|[number, ...*]|[string, ...*])} ruleConfig A rule's configuration value, generally + * received from the user. A valid config value is either 0, 1, 2, the string "off" (treated the same as 0), + * the string "warn" (treated the same as 1), the string "error" (treated the same as 2), or an array + * whose first element is one of the above values. Strings are matched case-insensitively. + * @returns {(0|1|2)} The numeric severity value if the config value was valid, otherwise 0. + */ +function getRuleSeverity(ruleConfig) { + const severityValue = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig; -const { - ConfigArray, - getUsedExtractedConfigs -} = __webpack_require__(873); + if (severityValue === 0 || severityValue === 1 || severityValue === 2) { + return severityValue; + } -const { - ConfigDependency -} = __webpack_require__(877); + if (typeof severityValue === "string") { + return RULE_SEVERITY[severityValue.toLowerCase()] || 0; + } -const { - ExtractedConfig -} = __webpack_require__(875); + return 0; +} -const { - IgnorePattern -} = __webpack_require__(876); +/** + * Converts old-style severity settings (0, 1, 2) into new-style + * severity settings (off, warn, error) for all rules. Assumption is that severity + * values have already been validated as correct. + * @param {Object} config The config object to normalize. + * @returns {void} + */ +function normalizeToStrings(config) { -const { - OverrideTester -} = __webpack_require__(878); + if (config.rules) { + Object.keys(config.rules).forEach(ruleId => { + const ruleConfig = config.rules[ruleId]; -const ConfigOps = __webpack_require__(440); + if (typeof ruleConfig === "number") { + config.rules[ruleId] = RULE_SEVERITY_STRINGS[ruleConfig] || RULE_SEVERITY_STRINGS[0]; + } else if (Array.isArray(ruleConfig) && typeof ruleConfig[0] === "number") { + ruleConfig[0] = RULE_SEVERITY_STRINGS[ruleConfig[0]] || RULE_SEVERITY_STRINGS[0]; + } + }); + } +} -const ConfigValidator = __webpack_require__(441); +/** + * Determines if the severity for the given rule configuration represents an error. + * @param {int|string|Array} ruleConfig The configuration for an individual rule. + * @returns {boolean} True if the rule represents an error, false if not. + */ +function isErrorSeverity(ruleConfig) { + return getRuleSeverity(ruleConfig) === 2; +} -const naming = __webpack_require__(871); +/** + * Checks whether a given config has valid severity or not. + * @param {number|string|Array} ruleConfig The configuration for an individual rule. + * @returns {boolean} `true` if the configuration has valid severity. + */ +function isValidSeverity(ruleConfig) { + let severity = Array.isArray(ruleConfig) ? ruleConfig[0] : ruleConfig; -const { - FlatCompat -} = __webpack_require__(918); //----------------------------------------------------------------------------- + if (typeof severity === "string") { + severity = severity.toLowerCase(); + } + return VALID_SEVERITIES.indexOf(severity) !== -1; +} + +/** + * Checks whether every rule of a given config has valid severity or not. + * @param {Object} config The configuration for rules. + * @returns {boolean} `true` if the configuration has valid severity. + */ +function isEverySeverityValid(config) { + return Object.keys(config).every(ruleId => isValidSeverity(config[ruleId])); +} + +/** + * Normalizes a value for a global in a config + * @param {(boolean|string|null)} configuredValue The value given for a global in configuration or in + * a global directive comment + * @returns {("readable"|"writeable"|"off")} The value normalized as a string + * @throws Error if global value is invalid + */ +function normalizeConfigGlobal(configuredValue) { + switch (configuredValue) { + case "off": + return "off"; + + case true: + case "true": + case "writeable": + case "writable": + return "writable"; + + case null: + case false: + case "false": + case "readable": + case "readonly": + return "readonly"; + + default: + throw new Error(`'${configuredValue}' is not a valid configuration for a global (use 'readonly', 'writable', or 'off')`); + } +} + +var ConfigOps = { + __proto__: null, + getRuleSeverity: getRuleSeverity, + normalizeToStrings: normalizeToStrings, + isErrorSeverity: isErrorSeverity, + isValidSeverity: isValidSeverity, + isEverySeverityValid: isEverySeverityValid, + normalizeConfigGlobal: normalizeConfigGlobal +}; + +/** + * @fileoverview Provide the function that emits deprecation warnings. + * @author Toru Nagashima + */ + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ + +// Defitions for deprecation warnings. +const deprecationWarningMessages = { + ESLINT_LEGACY_ECMAFEATURES: + "The 'ecmaFeatures' config file property is deprecated and has no effect.", + ESLINT_PERSONAL_CONFIG_LOAD: + "'~/.eslintrc.*' config files have been deprecated. " + + "Please use a config file per project or the '--config' option.", + ESLINT_PERSONAL_CONFIG_SUPPRESS: + "'~/.eslintrc.*' config files have been deprecated. " + + "Please remove it or add 'root:true' to the config files in your " + + "projects in order to avoid loading '~/.eslintrc.*' accidentally." +}; + +const sourceFileErrorCache = new Set(); + +/** + * Emits a deprecation warning containing a given filepath. A new deprecation warning is emitted + * for each unique file path, but repeated invocations with the same file path have no effect. + * No warnings are emitted if the `--no-deprecation` or `--no-warnings` Node runtime flags are active. + * @param {string} source The name of the configuration source to report the warning for. + * @param {string} errorCode The warning message to show. + * @returns {void} + */ +function emitDeprecationWarning(source, errorCode) { + const cacheKey = JSON.stringify({ source, errorCode }); + + if (sourceFileErrorCache.has(cacheKey)) { + return; + } + sourceFileErrorCache.add(cacheKey); + + const rel = path__default["default"].relative(process.cwd(), source); + const message = deprecationWarningMessages[errorCode]; + + process.emitWarning( + `${message} (found in "${rel}")`, + "DeprecationWarning", + errorCode + ); +} + +/** + * @fileoverview The instance of Ajv validator. + * @author Evgeny Poberezkin + */ + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +/* + * Copied from ajv/lib/refs/json-schema-draft-04.json + * The MIT License (MIT) + * Copyright (c) 2015-2017 Evgeny Poberezkin + */ +const metaSchema = { + id: "http://json-schema.org/draft-04/schema#", + $schema: "http://json-schema.org/draft-04/schema#", + description: "Core schema meta-schema", + definitions: { + schemaArray: { + type: "array", + minItems: 1, + items: { $ref: "#" } + }, + positiveInteger: { + type: "integer", + minimum: 0 + }, + positiveIntegerDefault0: { + allOf: [{ $ref: "#/definitions/positiveInteger" }, { default: 0 }] + }, + simpleTypes: { + enum: ["array", "boolean", "integer", "null", "number", "object", "string"] + }, + stringArray: { + type: "array", + items: { type: "string" }, + minItems: 1, + uniqueItems: true + } + }, + type: "object", + properties: { + id: { + type: "string" + }, + $schema: { + type: "string" + }, + title: { + type: "string" + }, + description: { + type: "string" + }, + default: { }, + multipleOf: { + type: "number", + minimum: 0, + exclusiveMinimum: true + }, + maximum: { + type: "number" + }, + exclusiveMaximum: { + type: "boolean", + default: false + }, + minimum: { + type: "number" + }, + exclusiveMinimum: { + type: "boolean", + default: false + }, + maxLength: { $ref: "#/definitions/positiveInteger" }, + minLength: { $ref: "#/definitions/positiveIntegerDefault0" }, + pattern: { + type: "string", + format: "regex" + }, + additionalItems: { + anyOf: [ + { type: "boolean" }, + { $ref: "#" } + ], + default: { } + }, + items: { + anyOf: [ + { $ref: "#" }, + { $ref: "#/definitions/schemaArray" } + ], + default: { } + }, + maxItems: { $ref: "#/definitions/positiveInteger" }, + minItems: { $ref: "#/definitions/positiveIntegerDefault0" }, + uniqueItems: { + type: "boolean", + default: false + }, + maxProperties: { $ref: "#/definitions/positiveInteger" }, + minProperties: { $ref: "#/definitions/positiveIntegerDefault0" }, + required: { $ref: "#/definitions/stringArray" }, + additionalProperties: { + anyOf: [ + { type: "boolean" }, + { $ref: "#" } + ], + default: { } + }, + definitions: { + type: "object", + additionalProperties: { $ref: "#" }, + default: { } + }, + properties: { + type: "object", + additionalProperties: { $ref: "#" }, + default: { } + }, + patternProperties: { + type: "object", + additionalProperties: { $ref: "#" }, + default: { } + }, + dependencies: { + type: "object", + additionalProperties: { + anyOf: [ + { $ref: "#" }, + { $ref: "#/definitions/stringArray" } + ] + } + }, + enum: { + type: "array", + minItems: 1, + uniqueItems: true + }, + type: { + anyOf: [ + { $ref: "#/definitions/simpleTypes" }, + { + type: "array", + items: { $ref: "#/definitions/simpleTypes" }, + minItems: 1, + uniqueItems: true + } + ] + }, + format: { type: "string" }, + allOf: { $ref: "#/definitions/schemaArray" }, + anyOf: { $ref: "#/definitions/schemaArray" }, + oneOf: { $ref: "#/definitions/schemaArray" }, + not: { $ref: "#" } + }, + dependencies: { + exclusiveMaximum: ["maximum"], + exclusiveMinimum: ["minimum"] + }, + default: { } +}; + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +var ajvOrig = (additionalOptions = {}) => { + const ajv = new Ajv__default["default"]({ + meta: false, + useDefaults: true, + validateSchema: false, + missingRefs: "ignore", + verbose: true, + schemaId: "auto", + ...additionalOptions + }); + + ajv.addMetaSchema(metaSchema); + // eslint-disable-next-line no-underscore-dangle + ajv._opts.defaultMeta = metaSchema.id; + + return ajv; +}; + +/** + * @fileoverview Defines a schema for configs. + * @author Sylvan Mably + */ + +const baseConfigProperties = { + $schema: { type: "string" }, + env: { type: "object" }, + extends: { $ref: "#/definitions/stringOrStrings" }, + globals: { type: "object" }, + overrides: { + type: "array", + items: { $ref: "#/definitions/overrideConfig" }, + additionalItems: false + }, + parser: { type: ["string", "null"] }, + parserOptions: { type: "object" }, + plugins: { type: "array" }, + processor: { type: "string" }, + rules: { type: "object" }, + settings: { type: "object" }, + noInlineConfig: { type: "boolean" }, + reportUnusedDisableDirectives: { type: "boolean" }, + + ecmaFeatures: { type: "object" } // deprecated; logs a warning when used +}; + +const configSchema = { + definitions: { + stringOrStrings: { + oneOf: [ + { type: "string" }, + { + type: "array", + items: { type: "string" }, + additionalItems: false + } + ] + }, + stringOrStringsRequired: { + oneOf: [ + { type: "string" }, + { + type: "array", + items: { type: "string" }, + additionalItems: false, + minItems: 1 + } + ] + }, + + // Config at top-level. + objectConfig: { + type: "object", + properties: { + root: { type: "boolean" }, + ignorePatterns: { $ref: "#/definitions/stringOrStrings" }, + ...baseConfigProperties + }, + additionalProperties: false + }, + + // Config in `overrides`. + overrideConfig: { + type: "object", + properties: { + excludedFiles: { $ref: "#/definitions/stringOrStrings" }, + files: { $ref: "#/definitions/stringOrStringsRequired" }, + ...baseConfigProperties + }, + required: ["files"], + additionalProperties: false + } + }, + + $ref: "#/definitions/objectConfig" +}; + +/** + * @fileoverview Defines environment settings and globals. + * @author Elan Shanker + */ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Get the object that has difference. + * @param {Record} current The newer object. + * @param {Record} prev The older object. + * @returns {Record} The difference object. + */ +function getDiff(current, prev) { + const retv = {}; + + for (const [key, value] of Object.entries(current)) { + if (!Object.hasOwnProperty.call(prev, key)) { + retv[key] = value; + } + } + + return retv; +} + +const newGlobals2015 = getDiff(globals__default["default"].es2015, globals__default["default"].es5); // 19 variables such as Promise, Map, ... +const newGlobals2017 = { + Atomics: false, + SharedArrayBuffer: false +}; +const newGlobals2020 = { + BigInt: false, + BigInt64Array: false, + BigUint64Array: false, + globalThis: false +}; + +const newGlobals2021 = { + AggregateError: false, + FinalizationRegistry: false, + WeakRef: false +}; + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** @type {Map} */ +var environments = new Map(Object.entries({ + + // Language + builtin: { + globals: globals__default["default"].es5 + }, + es6: { + globals: newGlobals2015, + parserOptions: { + ecmaVersion: 6 + } + }, + es2015: { + globals: newGlobals2015, + parserOptions: { + ecmaVersion: 6 + } + }, + es2017: { + globals: { ...newGlobals2015, ...newGlobals2017 }, + parserOptions: { + ecmaVersion: 8 + } + }, + es2020: { + globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020 }, + parserOptions: { + ecmaVersion: 11 + } + }, + es2021: { + globals: { ...newGlobals2015, ...newGlobals2017, ...newGlobals2020, ...newGlobals2021 }, + parserOptions: { + ecmaVersion: 12 + } + }, + + // Platforms + browser: { + globals: globals__default["default"].browser + }, + node: { + globals: globals__default["default"].node, + parserOptions: { + ecmaFeatures: { + globalReturn: true + } + } + }, + "shared-node-browser": { + globals: globals__default["default"]["shared-node-browser"] + }, + worker: { + globals: globals__default["default"].worker + }, + serviceworker: { + globals: globals__default["default"].serviceworker + }, + + // Frameworks + commonjs: { + globals: globals__default["default"].commonjs, + parserOptions: { + ecmaFeatures: { + globalReturn: true + } + } + }, + amd: { + globals: globals__default["default"].amd + }, + mocha: { + globals: globals__default["default"].mocha + }, + jasmine: { + globals: globals__default["default"].jasmine + }, + jest: { + globals: globals__default["default"].jest + }, + phantomjs: { + globals: globals__default["default"].phantomjs + }, + jquery: { + globals: globals__default["default"].jquery + }, + qunit: { + globals: globals__default["default"].qunit + }, + prototypejs: { + globals: globals__default["default"].prototypejs + }, + shelljs: { + globals: globals__default["default"].shelljs + }, + meteor: { + globals: globals__default["default"].meteor + }, + mongo: { + globals: globals__default["default"].mongo + }, + protractor: { + globals: globals__default["default"].protractor + }, + applescript: { + globals: globals__default["default"].applescript + }, + nashorn: { + globals: globals__default["default"].nashorn + }, + atomtest: { + globals: globals__default["default"].atomtest + }, + embertest: { + globals: globals__default["default"].embertest + }, + webextensions: { + globals: globals__default["default"].webextensions + }, + greasemonkey: { + globals: globals__default["default"].greasemonkey + } +})); + +/** + * @fileoverview Validates configs. + * @author Brandon Mills + */ + +const ajv = ajvOrig(); + +const ruleValidators = new WeakMap(); +const noop = Function.prototype; + +//------------------------------------------------------------------------------ +// Private +//------------------------------------------------------------------------------ +let validateSchema; +const severityMap = { + error: 2, + warn: 1, + off: 0 +}; + +const validated = new WeakSet(); + +//----------------------------------------------------------------------------- // Exports //----------------------------------------------------------------------------- +class ConfigValidator { + constructor({ builtInRules = new Map() } = {}) { + this.builtInRules = builtInRules; + } -module.exports = { - Legacy: { - ConfigArray, - createConfigArrayFactoryContext, - CascadingConfigArrayFactory, - ConfigArrayFactory, - ConfigDependency, - ExtractedConfig, - IgnorePattern, - OverrideTester, - getUsedExtractedConfigs, - // shared - ConfigOps, - ConfigValidator, - ModuleResolver, - naming - }, - FlatCompat + /** + * Gets a complete options schema for a rule. + * @param {{create: Function, schema: (Array|null)}} rule A new-style rule object + * @returns {Object} JSON Schema for the rule's options. + */ + getRuleOptionsSchema(rule) { + if (!rule) { + return null; + } + + const schema = rule.schema || rule.meta && rule.meta.schema; + + // Given a tuple of schemas, insert warning level at the beginning + if (Array.isArray(schema)) { + if (schema.length) { + return { + type: "array", + items: schema, + minItems: 0, + maxItems: schema.length + }; + } + return { + type: "array", + minItems: 0, + maxItems: 0 + }; + + } + + // Given a full schema, leave it alone + return schema || null; + } + + /** + * Validates a rule's severity and returns the severity value. Throws an error if the severity is invalid. + * @param {options} options The given options for the rule. + * @returns {number|string} The rule's severity value + */ + validateRuleSeverity(options) { + const severity = Array.isArray(options) ? options[0] : options; + const normSeverity = typeof severity === "string" ? severityMap[severity.toLowerCase()] : severity; + + if (normSeverity === 0 || normSeverity === 1 || normSeverity === 2) { + return normSeverity; + } + + throw new Error(`\tSeverity should be one of the following: 0 = off, 1 = warn, 2 = error (you passed '${util__default["default"].inspect(severity).replace(/'/gu, "\"").replace(/\n/gu, "")}').\n`); + + } + + /** + * Validates the non-severity options passed to a rule, based on its schema. + * @param {{create: Function}} rule The rule to validate + * @param {Array} localOptions The options for the rule, excluding severity + * @returns {void} + */ + validateRuleSchema(rule, localOptions) { + if (!ruleValidators.has(rule)) { + const schema = this.getRuleOptionsSchema(rule); + + if (schema) { + ruleValidators.set(rule, ajv.compile(schema)); + } + } + + const validateRule = ruleValidators.get(rule); + + if (validateRule) { + validateRule(localOptions); + if (validateRule.errors) { + throw new Error(validateRule.errors.map( + error => `\tValue ${JSON.stringify(error.data)} ${error.message}.\n` + ).join("")); + } + } + } + + /** + * Validates a rule's options against its schema. + * @param {{create: Function}|null} rule The rule that the config is being validated for + * @param {string} ruleId The rule's unique name. + * @param {Array|number} options The given options for the rule. + * @param {string|null} source The name of the configuration source to report in any errors. If null or undefined, + * no source is prepended to the message. + * @returns {void} + */ + validateRuleOptions(rule, ruleId, options, source = null) { + try { + const severity = this.validateRuleSeverity(options); + + if (severity !== 0) { + this.validateRuleSchema(rule, Array.isArray(options) ? options.slice(1) : []); + } + } catch (err) { + const enhancedMessage = `Configuration for rule "${ruleId}" is invalid:\n${err.message}`; + + if (typeof source === "string") { + throw new Error(`${source}:\n\t${enhancedMessage}`); + } else { + throw new Error(enhancedMessage); + } + } + } + + /** + * Validates an environment object + * @param {Object} environment The environment config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded environments. + * @returns {void} + */ + validateEnvironment( + environment, + source, + getAdditionalEnv = noop + ) { + + // not having an environment is ok + if (!environment) { + return; + } + + Object.keys(environment).forEach(id => { + const env = getAdditionalEnv(id) || environments.get(id) || null; + + if (!env) { + const message = `${source}:\n\tEnvironment key "${id}" is unknown\n`; + + throw new Error(message); + } + }); + } + + /** + * Validates a rules config object + * @param {Object} rulesConfig The rules config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @param {function(ruleId:string): Object} getAdditionalRule A map from strings to loaded rules + * @returns {void} + */ + validateRules( + rulesConfig, + source, + getAdditionalRule = noop + ) { + if (!rulesConfig) { + return; + } + + Object.keys(rulesConfig).forEach(id => { + const rule = getAdditionalRule(id) || this.builtInRules.get(id) || null; + + this.validateRuleOptions(rule, id, rulesConfig[id], source); + }); + } + + /** + * Validates a `globals` section of a config file + * @param {Object} globalsConfig The `globals` section + * @param {string|null} source The name of the configuration source to report in the event of an error. + * @returns {void} + */ + validateGlobals(globalsConfig, source = null) { + if (!globalsConfig) { + return; + } + + Object.entries(globalsConfig) + .forEach(([configuredGlobal, configuredValue]) => { + try { + normalizeConfigGlobal(configuredValue); + } catch (err) { + throw new Error(`ESLint configuration of global '${configuredGlobal}' in ${source} is invalid:\n${err.message}`); + } + }); + } + + /** + * Validate `processor` configuration. + * @param {string|undefined} processorName The processor name. + * @param {string} source The name of config file. + * @param {function(id:string): Processor} getProcessor The getter of defined processors. + * @returns {void} + */ + validateProcessor(processorName, source, getProcessor) { + if (processorName && !getProcessor(processorName)) { + throw new Error(`ESLint configuration of processor in '${source}' is invalid: '${processorName}' was not found.`); + } + } + + /** + * Formats an array of schema validation errors. + * @param {Array} errors An array of error messages to format. + * @returns {string} Formatted error message + */ + formatErrors(errors) { + return errors.map(error => { + if (error.keyword === "additionalProperties") { + const formattedPropertyPath = error.dataPath.length ? `${error.dataPath.slice(1)}.${error.params.additionalProperty}` : error.params.additionalProperty; + + return `Unexpected top-level property "${formattedPropertyPath}"`; + } + if (error.keyword === "type") { + const formattedField = error.dataPath.slice(1); + const formattedExpectedType = Array.isArray(error.schema) ? error.schema.join("/") : error.schema; + const formattedValue = JSON.stringify(error.data); + + return `Property "${formattedField}" is the wrong type (expected ${formattedExpectedType} but got \`${formattedValue}\`)`; + } + + const field = error.dataPath[0] === "." ? error.dataPath.slice(1) : error.dataPath; + + return `"${field}" ${error.message}. Value: ${JSON.stringify(error.data)}`; + }).map(message => `\t- ${message}.\n`).join(""); + } + + /** + * Validates the top level properties of the config object. + * @param {Object} config The config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @returns {void} + */ + validateConfigSchema(config, source = null) { + validateSchema = validateSchema || ajv.compile(configSchema); + + if (!validateSchema(config)) { + throw new Error(`ESLint configuration in ${source} is invalid:\n${this.formatErrors(validateSchema.errors)}`); + } + + if (Object.hasOwnProperty.call(config, "ecmaFeatures")) { + emitDeprecationWarning(source, "ESLINT_LEGACY_ECMAFEATURES"); + } + } + + /** + * Validates an entire config object. + * @param {Object} config The config object to validate. + * @param {string} source The name of the configuration source to report in any errors. + * @param {function(ruleId:string): Object} [getAdditionalRule] A map from strings to loaded rules. + * @param {function(envId:string): Object} [getAdditionalEnv] A map from strings to loaded envs. + * @returns {void} + */ + validate(config, source, getAdditionalRule, getAdditionalEnv) { + this.validateConfigSchema(config, source); + this.validateRules(config.rules, source, getAdditionalRule); + this.validateEnvironment(config.env, source, getAdditionalEnv); + this.validateGlobals(config.globals, source); + + for (const override of config.overrides || []) { + this.validateRules(override.rules, source, getAdditionalRule); + this.validateEnvironment(override.env, source, getAdditionalEnv); + this.validateGlobals(config.globals, source); + } + } + + /** + * Validate config array object. + * @param {ConfigArray} configArray The config array to validate. + * @returns {void} + */ + validateConfigArray(configArray) { + const getPluginEnv = Map.prototype.get.bind(configArray.pluginEnvironments); + const getPluginProcessor = Map.prototype.get.bind(configArray.pluginProcessors); + const getPluginRule = Map.prototype.get.bind(configArray.pluginRules); + + // Validate. + for (const element of configArray) { + if (validated.has(element)) { + continue; + } + validated.add(element); + + this.validateEnvironment(element.env, element.name, getPluginEnv); + this.validateGlobals(element.globals, element.name); + this.validateProcessor(element.processor, element.name, getPluginProcessor); + this.validateRules(element.rules, element.name, getPluginRule); + } + } + +} + +/** + * @fileoverview Common helpers for naming of plugins, formatters and configs + */ + +const NAMESPACE_REGEX = /^@.*\//iu; + +/** + * Brings package name to correct format based on prefix + * @param {string} name The name of the package. + * @param {string} prefix Can be either "eslint-plugin", "eslint-config" or "eslint-formatter" + * @returns {string} Normalized name of the package + * @private + */ +function normalizePackageName(name, prefix) { + let normalizedName = name; + + /** + * On Windows, name can come in with Windows slashes instead of Unix slashes. + * Normalize to Unix first to avoid errors later on. + * https://github.com/eslint/eslint/issues/5644 + */ + if (normalizedName.includes("\\")) { + normalizedName = normalizedName.replace(/\\/gu, "/"); + } + + if (normalizedName.charAt(0) === "@") { + + /** + * it's a scoped package + * package name is the prefix, or just a username + */ + const scopedPackageShortcutRegex = new RegExp(`^(@[^/]+)(?:/(?:${prefix})?)?$`, "u"), + scopedPackageNameRegex = new RegExp(`^${prefix}(-|$)`, "u"); + + if (scopedPackageShortcutRegex.test(normalizedName)) { + normalizedName = normalizedName.replace(scopedPackageShortcutRegex, `$1/${prefix}`); + } else if (!scopedPackageNameRegex.test(normalizedName.split("/")[1])) { + + /** + * for scoped packages, insert the prefix after the first / unless + * the path is already @scope/eslint or @scope/eslint-xxx-yyy + */ + normalizedName = normalizedName.replace(/^@([^/]+)\/(.*)$/u, `@$1/${prefix}-$2`); + } + } else if (!normalizedName.startsWith(`${prefix}-`)) { + normalizedName = `${prefix}-${normalizedName}`; + } + + return normalizedName; +} + +/** + * Removes the prefix from a fullname. + * @param {string} fullname The term which may have the prefix. + * @param {string} prefix The prefix to remove. + * @returns {string} The term without prefix. + */ +function getShorthandName(fullname, prefix) { + if (fullname[0] === "@") { + let matchResult = new RegExp(`^(@[^/]+)/${prefix}$`, "u").exec(fullname); + + if (matchResult) { + return matchResult[1]; + } + + matchResult = new RegExp(`^(@[^/]+)/${prefix}-(.+)$`, "u").exec(fullname); + if (matchResult) { + return `${matchResult[1]}/${matchResult[2]}`; + } + } else if (fullname.startsWith(`${prefix}-`)) { + return fullname.slice(prefix.length + 1); + } + + return fullname; +} + +/** + * Gets the scope (namespace) of a term. + * @param {string} term The term which may have the namespace. + * @returns {string} The namespace of the term if it has one. + */ +function getNamespaceFromTerm(term) { + const match = term.match(NAMESPACE_REGEX); + + return match ? match[0] : ""; +} + +var naming = { + __proto__: null, + normalizePackageName: normalizePackageName, + getShorthandName: getShorthandName, + getNamespaceFromTerm: getNamespaceFromTerm }; -/***/ }), -/* 863 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { +/** + * Utility for resolving a module relative to another module + * @author Teddy Katz + */ + +/* + * `Module.createRequire` is added in v12.2.0. It supports URL as well. + * We only support the case where the argument is a filepath, not a URL. + */ +const createRequire = Module__default["default"].createRequire; + +/** + * Resolves a Node module relative to another module + * @param {string} moduleName The name of a Node module, or a path to a Node module. + * @param {string} relativeToPath An absolute path indicating the module that `moduleName` should be resolved relative to. This must be + * a file rather than a directory, but the file need not actually exist. + * @returns {string} The absolute path that would result from calling `require.resolve(moduleName)` in a file located at `relativeToPath` + */ +function resolve(moduleName, relativeToPath) { + try { + return createRequire(relativeToPath).resolve(moduleName); + } catch (error) { + + // This `if` block is for older Node.js than 12.0.0. We can remove this block in the future. + if ( + typeof error === "object" && + error !== null && + error.code === "MODULE_NOT_FOUND" && + !error.requireStack && + error.message.includes(moduleName) + ) { + error.message += `\nRequire stack:\n- ${relativeToPath}`; + } + throw error; + } +} + +var ModuleResolver = { + __proto__: null, + resolve: resolve +}; + +/** + * @fileoverview `IgnorePattern` class. + * + * `IgnorePattern` class has the set of glob patterns and the base path. + * + * It provides two static methods. + * + * - `IgnorePattern.createDefaultIgnore(cwd)` + * Create the default predicate function. + * - `IgnorePattern.createIgnore(ignorePatterns)` + * Create the predicate function from multiple `IgnorePattern` objects. + * + * It provides two properties and a method. + * + * - `patterns` + * The glob patterns that ignore to lint. + * - `basePath` + * The base path of the glob patterns. If absolute paths existed in the + * glob patterns, those are handled as relative paths to the base path. + * - `getPatternsRelativeTo(basePath)` + * Get `patterns` as modified for a given base path. It modifies the + * absolute paths in the patterns as prepending the difference of two base + * paths. + * + * `ConfigArrayFactory` creates `IgnorePattern` objects when it processes + * `ignorePatterns` properties. + * + * @author Toru Nagashima + */ + +const debug$3 = debugOrig__default["default"]("eslintrc:ignore-pattern"); + +/** @typedef {ReturnType} Ignore */ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Get the path to the common ancestor directory of given paths. + * @param {string[]} sourcePaths The paths to calculate the common ancestor. + * @returns {string} The path to the common ancestor directory. + */ +function getCommonAncestorPath(sourcePaths) { + let result = sourcePaths[0]; + + for (let i = 1; i < sourcePaths.length; ++i) { + const a = result; + const b = sourcePaths[i]; + + // Set the shorter one (it's the common ancestor if one includes the other). + result = a.length < b.length ? a : b; + + // Set the common ancestor. + for (let j = 0, lastSepPos = 0; j < a.length && j < b.length; ++j) { + if (a[j] !== b[j]) { + result = a.slice(0, lastSepPos); + break; + } + if (a[j] === path__default["default"].sep) { + lastSepPos = j; + } + } + } + + let resolvedResult = result || path__default["default"].sep; + + // if Windows common ancestor is root of drive must have trailing slash to be absolute. + if (resolvedResult && resolvedResult.endsWith(":") && process.platform === "win32") { + resolvedResult += path__default["default"].sep; + } + return resolvedResult; +} + +/** + * Make relative path. + * @param {string} from The source path to get relative path. + * @param {string} to The destination path to get relative path. + * @returns {string} The relative path. + */ +function relative(from, to) { + const relPath = path__default["default"].relative(from, to); + + if (path__default["default"].sep === "/") { + return relPath; + } + return relPath.split(path__default["default"].sep).join("/"); +} + +/** + * Get the trailing slash if existed. + * @param {string} filePath The path to check. + * @returns {string} The trailing slash if existed. + */ +function dirSuffix(filePath) { + const isDir = ( + filePath.endsWith(path__default["default"].sep) || + (process.platform === "win32" && filePath.endsWith("/")) + ); + + return isDir ? "/" : ""; +} + +const DefaultPatterns = Object.freeze(["/**/node_modules/*"]); +const DotPatterns = Object.freeze([".*", "!.eslintrc.*", "!../"]); + +//------------------------------------------------------------------------------ +// Public +//------------------------------------------------------------------------------ + +class IgnorePattern { + + /** + * The default patterns. + * @type {string[]} + */ + static get DefaultPatterns() { + return DefaultPatterns; + } + + /** + * Create the default predicate function. + * @param {string} cwd The current working directory. + * @returns {((filePath:string, dot:boolean) => boolean) & {basePath:string; patterns:string[]}} + * The preficate function. + * The first argument is an absolute path that is checked. + * The second argument is the flag to not ignore dotfiles. + * If the predicate function returned `true`, it means the path should be ignored. + */ + static createDefaultIgnore(cwd) { + return this.createIgnore([new IgnorePattern(DefaultPatterns, cwd)]); + } + + /** + * Create the predicate function from multiple `IgnorePattern` objects. + * @param {IgnorePattern[]} ignorePatterns The list of ignore patterns. + * @returns {((filePath:string, dot?:boolean) => boolean) & {basePath:string; patterns:string[]}} + * The preficate function. + * The first argument is an absolute path that is checked. + * The second argument is the flag to not ignore dotfiles. + * If the predicate function returned `true`, it means the path should be ignored. + */ + static createIgnore(ignorePatterns) { + debug$3("Create with: %o", ignorePatterns); + + const basePath = getCommonAncestorPath(ignorePatterns.map(p => p.basePath)); + const patterns = [].concat( + ...ignorePatterns.map(p => p.getPatternsRelativeTo(basePath)) + ); + const ig = ignore__default["default"]().add([...DotPatterns, ...patterns]); + const dotIg = ignore__default["default"]().add(patterns); + + debug$3(" processed: %o", { basePath, patterns }); + + return Object.assign( + (filePath, dot = false) => { + assert__default["default"](path__default["default"].isAbsolute(filePath), "'filePath' should be an absolute path."); + const relPathRaw = relative(basePath, filePath); + const relPath = relPathRaw && (relPathRaw + dirSuffix(filePath)); + const adoptedIg = dot ? dotIg : ig; + const result = relPath !== "" && adoptedIg.ignores(relPath); + + debug$3("Check", { filePath, dot, relativePath: relPath, result }); + return result; + }, + { basePath, patterns } + ); + } + + /** + * Initialize a new `IgnorePattern` instance. + * @param {string[]} patterns The glob patterns that ignore to lint. + * @param {string} basePath The base path of `patterns`. + */ + constructor(patterns, basePath) { + assert__default["default"](path__default["default"].isAbsolute(basePath), "'basePath' should be an absolute path."); + + /** + * The glob patterns that ignore to lint. + * @type {string[]} + */ + this.patterns = patterns; + + /** + * The base path of `patterns`. + * @type {string} + */ + this.basePath = basePath; + + /** + * If `true` then patterns which don't start with `/` will match the paths to the outside of `basePath`. Defaults to `false`. + * + * It's set `true` for `.eslintignore`, `package.json`, and `--ignore-path` for backward compatibility. + * It's `false` as-is for `ignorePatterns` property in config files. + * @type {boolean} + */ + this.loose = false; + } + + /** + * Get `patterns` as modified for a given base path. It modifies the + * absolute paths in the patterns as prepending the difference of two base + * paths. + * @param {string} newBasePath The base path. + * @returns {string[]} Modifired patterns. + */ + getPatternsRelativeTo(newBasePath) { + assert__default["default"](path__default["default"].isAbsolute(newBasePath), "'newBasePath' should be an absolute path."); + const { basePath, loose, patterns } = this; + + if (newBasePath === basePath) { + return patterns; + } + const prefix = `/${relative(newBasePath, basePath)}`; + + return patterns.map(pattern => { + const negative = pattern.startsWith("!"); + const head = negative ? "!" : ""; + const body = negative ? pattern.slice(1) : pattern; + + if (body.startsWith("/") || body.startsWith("../")) { + return `${head}${prefix}${body}`; + } + return loose ? pattern : `${head}${prefix}/**/${body}`; + }); + } +} + +/** + * @fileoverview `ExtractedConfig` class. + * + * `ExtractedConfig` class expresses a final configuration for a specific file. + * + * It provides one method. + * + * - `toCompatibleObjectAsConfigFileContent()` + * Convert this configuration to the compatible object as the content of + * config files. It converts the loaded parser and plugins to strings. + * `CLIEngine#getConfigForFile(filePath)` method uses this method. + * + * `ConfigArray#extractConfig(filePath)` creates a `ExtractedConfig` instance. + * + * @author Toru Nagashima + */ + +// For VSCode intellisense +/** @typedef {import("../../shared/types").ConfigData} ConfigData */ +/** @typedef {import("../../shared/types").GlobalConf} GlobalConf */ +/** @typedef {import("../../shared/types").SeverityConf} SeverityConf */ +/** @typedef {import("./config-dependency").DependentParser} DependentParser */ +/** @typedef {import("./config-dependency").DependentPlugin} DependentPlugin */ + +/** + * Check if `xs` starts with `ys`. + * @template T + * @param {T[]} xs The array to check. + * @param {T[]} ys The array that may be the first part of `xs`. + * @returns {boolean} `true` if `xs` starts with `ys`. + */ +function startsWith(xs, ys) { + return xs.length >= ys.length && ys.every((y, i) => y === xs[i]); +} + +/** + * The class for extracted config data. + */ +class ExtractedConfig { + constructor() { + + /** + * The config name what `noInlineConfig` setting came from. + * @type {string} + */ + this.configNameOfNoInlineConfig = ""; + + /** + * Environments. + * @type {Record} + */ + this.env = {}; + + /** + * Global variables. + * @type {Record} + */ + this.globals = {}; + + /** + * The glob patterns that ignore to lint. + * @type {(((filePath:string, dot?:boolean) => boolean) & { basePath:string; patterns:string[] }) | undefined} + */ + this.ignores = void 0; + + /** + * The flag that disables directive comments. + * @type {boolean|undefined} + */ + this.noInlineConfig = void 0; + + /** + * Parser definition. + * @type {DependentParser|null} + */ + this.parser = null; + + /** + * Options for the parser. + * @type {Object} + */ + this.parserOptions = {}; + + /** + * Plugin definitions. + * @type {Record} + */ + this.plugins = {}; + + /** + * Processor ID. + * @type {string|null} + */ + this.processor = null; + + /** + * The flag that reports unused `eslint-disable` directive comments. + * @type {boolean|undefined} + */ + this.reportUnusedDisableDirectives = void 0; + + /** + * Rule settings. + * @type {Record} + */ + this.rules = {}; + + /** + * Shared settings. + * @type {Object} + */ + this.settings = {}; + } + + /** + * Convert this config to the compatible object as a config file content. + * @returns {ConfigData} The converted object. + */ + toCompatibleObjectAsConfigFileContent() { + const { + /* eslint-disable no-unused-vars */ + configNameOfNoInlineConfig: _ignore1, + processor: _ignore2, + /* eslint-enable no-unused-vars */ + ignores, + ...config + } = this; + + config.parser = config.parser && config.parser.filePath; + config.plugins = Object.keys(config.plugins).filter(Boolean).reverse(); + config.ignorePatterns = ignores ? ignores.patterns : []; + + // Strip the default patterns from `ignorePatterns`. + if (startsWith(config.ignorePatterns, IgnorePattern.DefaultPatterns)) { + config.ignorePatterns = + config.ignorePatterns.slice(IgnorePattern.DefaultPatterns.length); + } + + return config; + } +} + +/** + * @fileoverview `ConfigArray` class. + * + * `ConfigArray` class expresses the full of a configuration. It has the entry + * config file, base config files that were extended, loaded parsers, and loaded + * plugins. + * + * `ConfigArray` class provides three properties and two methods. + * + * - `pluginEnvironments` + * - `pluginProcessors` + * - `pluginRules` + * The `Map` objects that contain the members of all plugins that this + * config array contains. Those map objects don't have mutation methods. + * Those keys are the member ID such as `pluginId/memberName`. + * - `isRoot()` + * If `true` then this configuration has `root:true` property. + * - `extractConfig(filePath)` + * Extract the final configuration for a given file. This means merging + * every config array element which that `criteria` property matched. The + * `filePath` argument must be an absolute path. + * + * `ConfigArrayFactory` provides the loading logic of config files. + * + * @author Toru Nagashima + */ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +// Define types for VSCode IntelliSense. +/** @typedef {import("../../shared/types").Environment} Environment */ +/** @typedef {import("../../shared/types").GlobalConf} GlobalConf */ +/** @typedef {import("../../shared/types").RuleConf} RuleConf */ +/** @typedef {import("../../shared/types").Rule} Rule */ +/** @typedef {import("../../shared/types").Plugin} Plugin */ +/** @typedef {import("../../shared/types").Processor} Processor */ +/** @typedef {import("./config-dependency").DependentParser} DependentParser */ +/** @typedef {import("./config-dependency").DependentPlugin} DependentPlugin */ +/** @typedef {import("./override-tester")["OverrideTester"]} OverrideTester */ + +/** + * @typedef {Object} ConfigArrayElement + * @property {string} name The name of this config element. + * @property {string} filePath The path to the source file of this config element. + * @property {InstanceType|null} criteria The tester for the `files` and `excludedFiles` of this config element. + * @property {Record|undefined} env The environment settings. + * @property {Record|undefined} globals The global variable settings. + * @property {IgnorePattern|undefined} ignorePattern The ignore patterns. + * @property {boolean|undefined} noInlineConfig The flag that disables directive comments. + * @property {DependentParser|undefined} parser The parser loader. + * @property {Object|undefined} parserOptions The parser options. + * @property {Record|undefined} plugins The plugin loaders. + * @property {string|undefined} processor The processor name to refer plugin's processor. + * @property {boolean|undefined} reportUnusedDisableDirectives The flag to report unused `eslint-disable` comments. + * @property {boolean|undefined} root The flag to express root. + * @property {Record|undefined} rules The rule settings + * @property {Object|undefined} settings The shared settings. + * @property {"config" | "ignore" | "implicit-processor"} type The element type. + */ + +/** + * @typedef {Object} ConfigArrayInternalSlots + * @property {Map} cache The cache to extract configs. + * @property {ReadonlyMap|null} envMap The map from environment ID to environment definition. + * @property {ReadonlyMap|null} processorMap The map from processor ID to environment definition. + * @property {ReadonlyMap|null} ruleMap The map from rule ID to rule definition. + */ + +/** @type {WeakMap} */ +const internalSlotsMap$2 = new class extends WeakMap { + get(key) { + let value = super.get(key); + + if (!value) { + value = { + cache: new Map(), + envMap: null, + processorMap: null, + ruleMap: null + }; + super.set(key, value); + } + + return value; + } +}(); + +/** + * Get the indices which are matched to a given file. + * @param {ConfigArrayElement[]} elements The elements. + * @param {string} filePath The path to a target file. + * @returns {number[]} The indices. + */ +function getMatchedIndices(elements, filePath) { + const indices = []; + + for (let i = elements.length - 1; i >= 0; --i) { + const element = elements[i]; + + if (!element.criteria || (filePath && element.criteria.test(filePath))) { + indices.push(i); + } + } + + return indices; +} + +/** + * Check if a value is a non-null object. + * @param {any} x The value to check. + * @returns {boolean} `true` if the value is a non-null object. + */ +function isNonNullObject(x) { + return typeof x === "object" && x !== null; +} + +/** + * Merge two objects. + * + * Assign every property values of `y` to `x` if `x` doesn't have the property. + * If `x`'s property value is an object, it does recursive. + * @param {Object} target The destination to merge + * @param {Object|undefined} source The source to merge. + * @returns {void} + */ +function mergeWithoutOverwrite(target, source) { + if (!isNonNullObject(source)) { + return; + } + + for (const key of Object.keys(source)) { + if (key === "__proto__") { + continue; + } + + if (isNonNullObject(target[key])) { + mergeWithoutOverwrite(target[key], source[key]); + } else if (target[key] === void 0) { + if (isNonNullObject(source[key])) { + target[key] = Array.isArray(source[key]) ? [] : {}; + mergeWithoutOverwrite(target[key], source[key]); + } else if (source[key] !== void 0) { + target[key] = source[key]; + } + } + } +} + +/** + * The error for plugin conflicts. + */ +class PluginConflictError extends Error { + + /** + * Initialize this error object. + * @param {string} pluginId The plugin ID. + * @param {{filePath:string, importerName:string}[]} plugins The resolved plugins. + */ + constructor(pluginId, plugins) { + super(`Plugin "${pluginId}" was conflicted between ${plugins.map(p => `"${p.importerName}"`).join(" and ")}.`); + this.messageTemplate = "plugin-conflict"; + this.messageData = { pluginId, plugins }; + } +} + +/** + * Merge plugins. + * `target`'s definition is prior to `source`'s. + * @param {Record} target The destination to merge + * @param {Record|undefined} source The source to merge. + * @returns {void} + */ +function mergePlugins(target, source) { + if (!isNonNullObject(source)) { + return; + } + + for (const key of Object.keys(source)) { + if (key === "__proto__") { + continue; + } + const targetValue = target[key]; + const sourceValue = source[key]; + + // Adopt the plugin which was found at first. + if (targetValue === void 0) { + if (sourceValue.error) { + throw sourceValue.error; + } + target[key] = sourceValue; + } else if (sourceValue.filePath !== targetValue.filePath) { + throw new PluginConflictError(key, [ + { + filePath: targetValue.filePath, + importerName: targetValue.importerName + }, + { + filePath: sourceValue.filePath, + importerName: sourceValue.importerName + } + ]); + } + } +} + +/** + * Merge rule configs. + * `target`'s definition is prior to `source`'s. + * @param {Record} target The destination to merge + * @param {Record|undefined} source The source to merge. + * @returns {void} + */ +function mergeRuleConfigs(target, source) { + if (!isNonNullObject(source)) { + return; + } + + for (const key of Object.keys(source)) { + if (key === "__proto__") { + continue; + } + const targetDef = target[key]; + const sourceDef = source[key]; + + // Adopt the rule config which was found at first. + if (targetDef === void 0) { + if (Array.isArray(sourceDef)) { + target[key] = [...sourceDef]; + } else { + target[key] = [sourceDef]; + } + + /* + * If the first found rule config is severity only and the current rule + * config has options, merge the severity and the options. + */ + } else if ( + targetDef.length === 1 && + Array.isArray(sourceDef) && + sourceDef.length >= 2 + ) { + targetDef.push(...sourceDef.slice(1)); + } + } +} + +/** + * Create the extracted config. + * @param {ConfigArray} instance The config elements. + * @param {number[]} indices The indices to use. + * @returns {ExtractedConfig} The extracted config. + */ +function createConfig(instance, indices) { + const config = new ExtractedConfig(); + const ignorePatterns = []; + + // Merge elements. + for (const index of indices) { + const element = instance[index]; + + // Adopt the parser which was found at first. + if (!config.parser && element.parser) { + if (element.parser.error) { + throw element.parser.error; + } + config.parser = element.parser; + } + + // Adopt the processor which was found at first. + if (!config.processor && element.processor) { + config.processor = element.processor; + } + + // Adopt the noInlineConfig which was found at first. + if (config.noInlineConfig === void 0 && element.noInlineConfig !== void 0) { + config.noInlineConfig = element.noInlineConfig; + config.configNameOfNoInlineConfig = element.name; + } + + // Adopt the reportUnusedDisableDirectives which was found at first. + if (config.reportUnusedDisableDirectives === void 0 && element.reportUnusedDisableDirectives !== void 0) { + config.reportUnusedDisableDirectives = element.reportUnusedDisableDirectives; + } + + // Collect ignorePatterns + if (element.ignorePattern) { + ignorePatterns.push(element.ignorePattern); + } + + // Merge others. + mergeWithoutOverwrite(config.env, element.env); + mergeWithoutOverwrite(config.globals, element.globals); + mergeWithoutOverwrite(config.parserOptions, element.parserOptions); + mergeWithoutOverwrite(config.settings, element.settings); + mergePlugins(config.plugins, element.plugins); + mergeRuleConfigs(config.rules, element.rules); + } + + // Create the predicate function for ignore patterns. + if (ignorePatterns.length > 0) { + config.ignores = IgnorePattern.createIgnore(ignorePatterns.reverse()); + } + + return config; +} + +/** + * Collect definitions. + * @template T, U + * @param {string} pluginId The plugin ID for prefix. + * @param {Record} defs The definitions to collect. + * @param {Map} map The map to output. + * @param {function(T): U} [normalize] The normalize function for each value. + * @returns {void} + */ +function collect(pluginId, defs, map, normalize) { + if (defs) { + const prefix = pluginId && `${pluginId}/`; + + for (const [key, value] of Object.entries(defs)) { + map.set( + `${prefix}${key}`, + normalize ? normalize(value) : value + ); + } + } +} + +/** + * Normalize a rule definition. + * @param {Function|Rule} rule The rule definition to normalize. + * @returns {Rule} The normalized rule definition. + */ +function normalizePluginRule(rule) { + return typeof rule === "function" ? { create: rule } : rule; +} + +/** + * Delete the mutation methods from a given map. + * @param {Map} map The map object to delete. + * @returns {void} + */ +function deleteMutationMethods(map) { + Object.defineProperties(map, { + clear: { configurable: true, value: void 0 }, + delete: { configurable: true, value: void 0 }, + set: { configurable: true, value: void 0 } + }); +} + +/** + * Create `envMap`, `processorMap`, `ruleMap` with the plugins in the config array. + * @param {ConfigArrayElement[]} elements The config elements. + * @param {ConfigArrayInternalSlots} slots The internal slots. + * @returns {void} + */ +function initPluginMemberMaps(elements, slots) { + const processed = new Set(); + + slots.envMap = new Map(); + slots.processorMap = new Map(); + slots.ruleMap = new Map(); + + for (const element of elements) { + if (!element.plugins) { + continue; + } + + for (const [pluginId, value] of Object.entries(element.plugins)) { + const plugin = value.definition; + + if (!plugin || processed.has(pluginId)) { + continue; + } + processed.add(pluginId); + + collect(pluginId, plugin.environments, slots.envMap); + collect(pluginId, plugin.processors, slots.processorMap); + collect(pluginId, plugin.rules, slots.ruleMap, normalizePluginRule); + } + } + + deleteMutationMethods(slots.envMap); + deleteMutationMethods(slots.processorMap); + deleteMutationMethods(slots.ruleMap); +} + +/** + * Create `envMap`, `processorMap`, `ruleMap` with the plugins in the config array. + * @param {ConfigArray} instance The config elements. + * @returns {ConfigArrayInternalSlots} The extracted config. + */ +function ensurePluginMemberMaps(instance) { + const slots = internalSlotsMap$2.get(instance); + + if (!slots.ruleMap) { + initPluginMemberMaps(instance, slots); + } + + return slots; +} + +//------------------------------------------------------------------------------ +// Public Interface +//------------------------------------------------------------------------------ + +/** + * The Config Array. + * + * `ConfigArray` instance contains all settings, parsers, and plugins. + * You need to call `ConfigArray#extractConfig(filePath)` method in order to + * extract, merge and get only the config data which is related to an arbitrary + * file. + * @extends {Array} + */ +class ConfigArray extends Array { + + /** + * Get the plugin environments. + * The returned map cannot be mutated. + * @type {ReadonlyMap} The plugin environments. + */ + get pluginEnvironments() { + return ensurePluginMemberMaps(this).envMap; + } + + /** + * Get the plugin processors. + * The returned map cannot be mutated. + * @type {ReadonlyMap} The plugin processors. + */ + get pluginProcessors() { + return ensurePluginMemberMaps(this).processorMap; + } + + /** + * Get the plugin rules. + * The returned map cannot be mutated. + * @returns {ReadonlyMap} The plugin rules. + */ + get pluginRules() { + return ensurePluginMemberMaps(this).ruleMap; + } + + /** + * Check if this config has `root` flag. + * @returns {boolean} `true` if this config array is root. + */ + isRoot() { + for (let i = this.length - 1; i >= 0; --i) { + const root = this[i].root; + + if (typeof root === "boolean") { + return root; + } + } + return false; + } + + /** + * Extract the config data which is related to a given file. + * @param {string} filePath The absolute path to the target file. + * @returns {ExtractedConfig} The extracted config data. + */ + extractConfig(filePath) { + const { cache } = internalSlotsMap$2.get(this); + const indices = getMatchedIndices(this, filePath); + const cacheKey = indices.join(","); + + if (!cache.has(cacheKey)) { + cache.set(cacheKey, createConfig(this, indices)); + } + + return cache.get(cacheKey); + } + + /** + * Check if a given path is an additional lint target. + * @param {string} filePath The absolute path to the target file. + * @returns {boolean} `true` if the file is an additional lint target. + */ + isAdditionalTargetPath(filePath) { + for (const { criteria, type } of this) { + if ( + type === "config" && + criteria && + !criteria.endsWithWildcard && + criteria.test(filePath) + ) { + return true; + } + } + return false; + } +} + +/** + * Get the used extracted configs. + * CLIEngine will use this method to collect used deprecated rules. + * @param {ConfigArray} instance The config array object to get. + * @returns {ExtractedConfig[]} The used extracted configs. + * @private + */ +function getUsedExtractedConfigs(instance) { + const { cache } = internalSlotsMap$2.get(instance); + + return Array.from(cache.values()); +} + +/** + * @fileoverview `ConfigDependency` class. + * + * `ConfigDependency` class expresses a loaded parser or plugin. + * + * If the parser or plugin was loaded successfully, it has `definition` property + * and `filePath` property. Otherwise, it has `error` property. + * + * When `JSON.stringify()` converted a `ConfigDependency` object to a JSON, it + * omits `definition` property. + * + * `ConfigArrayFactory` creates `ConfigDependency` objects when it loads parsers + * or plugins. + * + * @author Toru Nagashima + */ + +/** + * The class is to store parsers or plugins. + * This class hides the loaded object from `JSON.stringify()` and `console.log`. + * @template T + */ +class ConfigDependency { + + /** + * Initialize this instance. + * @param {Object} data The dependency data. + * @param {T} [data.definition] The dependency if the loading succeeded. + * @param {Error} [data.error] The error object if the loading failed. + * @param {string} [data.filePath] The actual path to the dependency if the loading succeeded. + * @param {string} data.id The ID of this dependency. + * @param {string} data.importerName The name of the config file which loads this dependency. + * @param {string} data.importerPath The path to the config file which loads this dependency. + */ + constructor({ + definition = null, + error = null, + filePath = null, + id, + importerName, + importerPath + }) { + + /** + * The loaded dependency if the loading succeeded. + * @type {T|null} + */ + this.definition = definition; + + /** + * The error object if the loading failed. + * @type {Error|null} + */ + this.error = error; + + /** + * The loaded dependency if the loading succeeded. + * @type {string|null} + */ + this.filePath = filePath; + + /** + * The ID of this dependency. + * @type {string} + */ + this.id = id; + + /** + * The name of the config file which loads this dependency. + * @type {string} + */ + this.importerName = importerName; + + /** + * The path to the config file which loads this dependency. + * @type {string} + */ + this.importerPath = importerPath; + } + + // eslint-disable-next-line jsdoc/require-description + /** + * @returns {Object} a JSON compatible object. + */ + toJSON() { + const obj = this[util__default["default"].inspect.custom](); + + // Display `error.message` (`Error#message` is unenumerable). + if (obj.error instanceof Error) { + obj.error = { ...obj.error, message: obj.error.message }; + } + + return obj; + } + + // eslint-disable-next-line jsdoc/require-description + /** + * @returns {Object} an object to display by `console.log()`. + */ + [util__default["default"].inspect.custom]() { + const { + definition: _ignore, // eslint-disable-line no-unused-vars + ...obj + } = this; + + return obj; + } +} + +/** + * @fileoverview `OverrideTester` class. + * + * `OverrideTester` class handles `files` property and `excludedFiles` property + * of `overrides` config. + * + * It provides one method. + * + * - `test(filePath)` + * Test if a file path matches the pair of `files` property and + * `excludedFiles` property. The `filePath` argument must be an absolute + * path. + * + * `ConfigArrayFactory` creates `OverrideTester` objects when it processes + * `overrides` properties. + * + * @author Toru Nagashima + */ + +const { Minimatch } = minimatch__default["default"]; + +const minimatchOpts = { dot: true, matchBase: true }; + +/** + * @typedef {Object} Pattern + * @property {InstanceType[] | null} includes The positive matchers. + * @property {InstanceType[] | null} excludes The negative matchers. + */ + +/** + * Normalize a given pattern to an array. + * @param {string|string[]|undefined} patterns A glob pattern or an array of glob patterns. + * @returns {string[]|null} Normalized patterns. + * @private + */ +function normalizePatterns(patterns) { + if (Array.isArray(patterns)) { + return patterns.filter(Boolean); + } + if (typeof patterns === "string" && patterns) { + return [patterns]; + } + return []; +} + +/** + * Create the matchers of given patterns. + * @param {string[]} patterns The patterns. + * @returns {InstanceType[] | null} The matchers. + */ +function toMatcher(patterns) { + if (patterns.length === 0) { + return null; + } + return patterns.map(pattern => { + if (/^\.[/\\]/u.test(pattern)) { + return new Minimatch( + pattern.slice(2), + + // `./*.js` should not match with `subdir/foo.js` + { ...minimatchOpts, matchBase: false } + ); + } + return new Minimatch(pattern, minimatchOpts); + }); +} + +/** + * Convert a given matcher to string. + * @param {Pattern} matchers The matchers. + * @returns {string} The string expression of the matcher. + */ +function patternToJson({ includes, excludes }) { + return { + includes: includes && includes.map(m => m.pattern), + excludes: excludes && excludes.map(m => m.pattern) + }; +} + +/** + * The class to test given paths are matched by the patterns. + */ +class OverrideTester { + + /** + * Create a tester with given criteria. + * If there are no criteria, returns `null`. + * @param {string|string[]} files The glob patterns for included files. + * @param {string|string[]} excludedFiles The glob patterns for excluded files. + * @param {string} basePath The path to the base directory to test paths. + * @returns {OverrideTester|null} The created instance or `null`. + */ + static create(files, excludedFiles, basePath) { + const includePatterns = normalizePatterns(files); + const excludePatterns = normalizePatterns(excludedFiles); + let endsWithWildcard = false; + + if (includePatterns.length === 0) { + return null; + } + + // Rejects absolute paths or relative paths to parents. + for (const pattern of includePatterns) { + if (path__default["default"].isAbsolute(pattern) || pattern.includes("..")) { + throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`); + } + if (pattern.endsWith("*")) { + endsWithWildcard = true; + } + } + for (const pattern of excludePatterns) { + if (path__default["default"].isAbsolute(pattern) || pattern.includes("..")) { + throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`); + } + } + + const includes = toMatcher(includePatterns); + const excludes = toMatcher(excludePatterns); + + return new OverrideTester( + [{ includes, excludes }], + basePath, + endsWithWildcard + ); + } + + /** + * Combine two testers by logical and. + * If either of the testers was `null`, returns the other tester. + * The `basePath` property of the two must be the same value. + * @param {OverrideTester|null} a A tester. + * @param {OverrideTester|null} b Another tester. + * @returns {OverrideTester|null} Combined tester. + */ + static and(a, b) { + if (!b) { + return a && new OverrideTester( + a.patterns, + a.basePath, + a.endsWithWildcard + ); + } + if (!a) { + return new OverrideTester( + b.patterns, + b.basePath, + b.endsWithWildcard + ); + } + + assert__default["default"].strictEqual(a.basePath, b.basePath); + return new OverrideTester( + a.patterns.concat(b.patterns), + a.basePath, + a.endsWithWildcard || b.endsWithWildcard + ); + } + + /** + * Initialize this instance. + * @param {Pattern[]} patterns The matchers. + * @param {string} basePath The base path. + * @param {boolean} endsWithWildcard If `true` then a pattern ends with `*`. + */ + constructor(patterns, basePath, endsWithWildcard = false) { + + /** @type {Pattern[]} */ + this.patterns = patterns; + + /** @type {string} */ + this.basePath = basePath; + + /** @type {boolean} */ + this.endsWithWildcard = endsWithWildcard; + } + + /** + * Test if a given path is matched or not. + * @param {string} filePath The absolute path to the target file. + * @returns {boolean} `true` if the path was matched. + */ + test(filePath) { + if (typeof filePath !== "string" || !path__default["default"].isAbsolute(filePath)) { + throw new Error(`'filePath' should be an absolute path, but got ${filePath}.`); + } + const relativePath = path__default["default"].relative(this.basePath, filePath); + + return this.patterns.every(({ includes, excludes }) => ( + (!includes || includes.some(m => m.match(relativePath))) && + (!excludes || !excludes.some(m => m.match(relativePath))) + )); + } + + // eslint-disable-next-line jsdoc/require-description + /** + * @returns {Object} a JSON compatible object. + */ + toJSON() { + if (this.patterns.length === 1) { + return { + ...patternToJson(this.patterns[0]), + basePath: this.basePath + }; + } + return { + AND: this.patterns.map(patternToJson), + basePath: this.basePath + }; + } + + // eslint-disable-next-line jsdoc/require-description + /** + * @returns {Object} an object to display by `console.log()`. + */ + [util__default["default"].inspect.custom]() { + return this.toJSON(); + } +} + +/** + * @fileoverview `ConfigArray` class. + * @author Toru Nagashima + */ -"use strict"; -/* provided dependency */ var process = __webpack_require__(445); /** * @fileoverview The factory of `ConfigArray` objects. * @@ -118059,52 +123072,32 @@ module.exports = { * * @author Toru Nagashima */ - //------------------------------------------------------------------------------ -// Requirements +const require$1 = Module.createRequire((typeof document === 'undefined' ? new ((__webpack_require__(876).URL))('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('eslintrc.cjs', document.baseURI).href))); + +const debug$2 = debugOrig__default["default"]("eslintrc:config-array-factory"); + //------------------------------------------------------------------------------ - -const fs = __webpack_require__(860); - -const path = __webpack_require__(405); - -const importFresh = __webpack_require__(864); - -const stripComments = __webpack_require__(870); - -const ConfigValidator = __webpack_require__(441); - -const naming = __webpack_require__(871); - -const ModuleResolver = __webpack_require__(872); - -const { - ConfigArray, - ConfigDependency, - IgnorePattern, - OverrideTester -} = __webpack_require__(873); - -const debug = __webpack_require__(496)("eslintrc:config-array-factory"); //------------------------------------------------------------------------------ // Helpers //------------------------------------------------------------------------------ +const configFilenames = [ + ".eslintrc.js", + ".eslintrc.cjs", + ".eslintrc.yaml", + ".eslintrc.yml", + ".eslintrc.json", + ".eslintrc", + "package.json" +]; -const configFilenames = [".eslintrc.js", ".eslintrc.cjs", ".eslintrc.yaml", ".eslintrc.yml", ".eslintrc.json", ".eslintrc", "package.json"]; // Define types for VSCode IntelliSense. - +// Define types for VSCode IntelliSense. /** @typedef {import("./shared/types").ConfigData} ConfigData */ - /** @typedef {import("./shared/types").OverrideConfigData} OverrideConfigData */ - /** @typedef {import("./shared/types").Parser} Parser */ - /** @typedef {import("./shared/types").Plugin} Plugin */ - /** @typedef {import("./shared/types").Rule} Rule */ - /** @typedef {import("./config-array/config-dependency").DependentParser} DependentParser */ - /** @typedef {import("./config-array/config-dependency").DependentPlugin} DependentPlugin */ - /** @typedef {ConfigArray[0]} ConfigArrayElement */ /** @@ -118147,28 +123140,30 @@ const configFilenames = [".eslintrc.js", ".eslintrc.cjs", ".eslintrc.yaml", ".es */ /** @type {WeakMap} */ +const internalSlotsMap$1 = new WeakMap(); -const internalSlotsMap = new WeakMap(); /** * Check if a given string is a file path. * @param {string} nameOrPath A module name or file path. * @returns {boolean} `true` if the `nameOrPath` is a file path. */ - function isFilePath(nameOrPath) { - return /^\.{1,2}[/\\]/u.test(nameOrPath) || path.isAbsolute(nameOrPath); + return ( + /^\.{1,2}[/\\]/u.test(nameOrPath) || + path__default["default"].isAbsolute(nameOrPath) + ); } + /** * Convenience wrapper for synchronously reading file contents. * @param {string} filePath The filename to read. * @returns {string} The file contents, with the BOM removed. * @private */ - - function readFile(filePath) { - return fs.readFileSync(filePath, "utf8").replace(/^\ufeff/u, ""); + return fs__default["default"].readFileSync(filePath, "utf8").replace(/^\ufeff/u, ""); } + /** * Loads a YAML configuration from a file. * @param {string} filePath The filename to load. @@ -118176,22 +123171,23 @@ function readFile(filePath) { * @throws {Error} If the file cannot be read. * @private */ - - function loadYAMLConfigFile(filePath) { - debug(`Loading YAML config file: ${filePath}`); // lazy load YAML to improve performance when not used + debug$2(`Loading YAML config file: ${filePath}`); - const yaml = __webpack_require__(883); + // lazy load YAML to improve performance when not used + const yaml = require$1("js-yaml"); - try { - // empty YAML file can be null, so always use - return yaml.safeLoad(readFile(filePath)) || {}; - } catch (e) { - debug(`Error reading YAML file: ${filePath}`); - e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; - throw e; - } + try { + + // empty YAML file can be null, so always use + return yaml.load(readFile(filePath)) || {}; + } catch (e) { + debug$2(`Error reading YAML file: ${filePath}`); + e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; + throw e; + } } + /** * Loads a JSON configuration from a file. * @param {string} filePath The filename to load. @@ -118199,24 +123195,23 @@ function loadYAMLConfigFile(filePath) { * @throws {Error} If the file cannot be read. * @private */ - - function loadJSONConfigFile(filePath) { - debug(`Loading JSON config file: ${filePath}`); + debug$2(`Loading JSON config file: ${filePath}`); - try { - return JSON.parse(stripComments(readFile(filePath))); - } catch (e) { - debug(`Error reading JSON file: ${filePath}`); - e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; - e.messageTemplate = "failed-to-read-json"; - e.messageData = { - path: filePath, - message: e.message - }; - throw e; - } + try { + return JSON.parse(stripComments__default["default"](readFile(filePath))); + } catch (e) { + debug$2(`Error reading JSON file: ${filePath}`); + e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; + e.messageTemplate = "failed-to-read-json"; + e.messageData = { + path: filePath, + message: e.message + }; + throw e; + } } + /** * Loads a legacy (.eslintrc) configuration from a file. * @param {string} filePath The filename to load. @@ -118224,23 +123219,21 @@ function loadJSONConfigFile(filePath) { * @throws {Error} If the file cannot be read. * @private */ - - function loadLegacyConfigFile(filePath) { - debug(`Loading legacy config file: ${filePath}`); // lazy load YAML to improve performance when not used + debug$2(`Loading legacy config file: ${filePath}`); - const yaml = __webpack_require__(883); + // lazy load YAML to improve performance when not used + const yaml = require$1("js-yaml"); - try { - return yaml.safeLoad(stripComments(readFile(filePath))) || - /* istanbul ignore next */ - {}; - } catch (e) { - debug("Error reading YAML file: %s\n%o", filePath, e); - e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; - throw e; - } + try { + return yaml.load(stripComments__default["default"](readFile(filePath))) || /* istanbul ignore next */ {}; + } catch (e) { + debug$2("Error reading YAML file: %s\n%o", filePath, e); + e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; + throw e; + } } + /** * Loads a JavaScript configuration from a file. * @param {string} filePath The filename to load. @@ -118248,19 +123241,17 @@ function loadLegacyConfigFile(filePath) { * @throws {Error} If the file cannot be read. * @private */ - - function loadJSConfigFile(filePath) { - debug(`Loading JS config file: ${filePath}`); - - try { - return importFresh(filePath); - } catch (e) { - debug(`Error reading JavaScript file: ${filePath}`); - e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; - throw e; - } + debug$2(`Loading JS config file: ${filePath}`); + try { + return importFresh__default["default"](filePath); + } catch (e) { + debug$2(`Error reading JavaScript file: ${filePath}`); + e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; + throw e; + } } + /** * Loads a configuration from a package.json file. * @param {string} filePath The filename to load. @@ -118268,46 +123259,46 @@ function loadJSConfigFile(filePath) { * @throws {Error} If the file cannot be read. * @private */ - - function loadPackageJSONConfigFile(filePath) { - debug(`Loading package.json config file: ${filePath}`); + debug$2(`Loading package.json config file: ${filePath}`); + try { + const packageData = loadJSONConfigFile(filePath); - try { - const packageData = loadJSONConfigFile(filePath); + if (!Object.hasOwnProperty.call(packageData, "eslintConfig")) { + throw Object.assign( + new Error("package.json file doesn't have 'eslintConfig' field."), + { code: "ESLINT_CONFIG_FIELD_NOT_FOUND" } + ); + } - if (!Object.hasOwnProperty.call(packageData, "eslintConfig")) { - throw Object.assign(new Error("package.json file doesn't have 'eslintConfig' field."), { - code: "ESLINT_CONFIG_FIELD_NOT_FOUND" - }); + return packageData.eslintConfig; + } catch (e) { + debug$2(`Error reading package.json file: ${filePath}`); + e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; + throw e; } - - return packageData.eslintConfig; - } catch (e) { - debug(`Error reading package.json file: ${filePath}`); - e.message = `Cannot read config file: ${filePath}\nError: ${e.message}`; - throw e; - } } + /** * Loads a `.eslintignore` from a file. * @param {string} filePath The filename to load. * @returns {string[]} The ignore patterns from the file. * @private */ - - function loadESLintIgnoreFile(filePath) { - debug(`Loading .eslintignore file: ${filePath}`); + debug$2(`Loading .eslintignore file: ${filePath}`); - try { - return readFile(filePath).split(/\r?\n/gu).filter(line => line.trim() !== "" && !line.startsWith("#")); - } catch (e) { - debug(`Error reading .eslintignore file: ${filePath}`); - e.message = `Cannot read .eslintignore file: ${filePath}\nError: ${e.message}`; - throw e; - } + try { + return readFile(filePath) + .split(/\r?\n/gu) + .filter(line => line.trim() !== "" && !line.startsWith("#")); + } catch (e) { + debug$2(`Error reading .eslintignore file: ${filePath}`); + e.message = `Cannot read .eslintignore file: ${filePath}\nError: ${e.message}`; + throw e; + } } + /** * Creates an error to notify about a missing config to extend from. * @param {string} configName The name of the missing config. @@ -118316,17 +123307,16 @@ function loadESLintIgnoreFile(filePath) { * @returns {Error} The error object to throw * @private */ - - function configInvalidError(configName, importerName, messageTemplate) { - return Object.assign(new Error(`Failed to load config "${configName}" to extend from.`), { - messageTemplate, - messageData: { - configName, - importerName - } - }); + return Object.assign( + new Error(`Failed to load config "${configName}" to extend from.`), + { + messageTemplate, + messageData: { configName, importerName } + } + ); } + /** * Loads a configuration file regardless of the source. Inspects the file path * to determine the correctly way to load the config file. @@ -118334,29 +123324,27 @@ function configInvalidError(configName, importerName, messageTemplate) { * @returns {ConfigData|null} The configuration information. * @private */ - - function loadConfigFile(filePath) { - switch (path.extname(filePath)) { - case ".js": - case ".cjs": - return loadJSConfigFile(filePath); + switch (path__default["default"].extname(filePath)) { + case ".js": + case ".cjs": + return loadJSConfigFile(filePath); - case ".json": - if (path.basename(filePath) === "package.json") { - return loadPackageJSONConfigFile(filePath); - } + case ".json": + if (path__default["default"].basename(filePath) === "package.json") { + return loadPackageJSONConfigFile(filePath); + } + return loadJSONConfigFile(filePath); - return loadJSONConfigFile(filePath); + case ".yaml": + case ".yml": + return loadYAMLConfigFile(filePath); - case ".yaml": - case ".yml": - return loadYAMLConfigFile(filePath); - - default: - return loadLegacyConfigFile(filePath); - } + default: + return loadLegacyConfigFile(filePath); + } } + /** * Write debug log. * @param {string} request The requested module name. @@ -118364,29 +123352,28 @@ function loadConfigFile(filePath) { * @param {string} filePath The resolved file path. * @returns {void} */ - - function writeDebugLogForLoading(request, relativeTo, filePath) { - /* istanbul ignore next */ - if (debug.enabled) { - let nameAndVersion = null; + /* istanbul ignore next */ + if (debug$2.enabled) { + let nameAndVersion = null; - try { - const packageJsonPath = ModuleResolver.resolve(`${request}/package.json`, relativeTo); + try { + const packageJsonPath = resolve( + `${request}/package.json`, + relativeTo + ); + const { version = "unknown" } = require$1(packageJsonPath); - const { - version = "unknown" - } = __webpack_require__(915)(packageJsonPath); + nameAndVersion = `${request}@${version}`; + } catch (error) { + debug$2("package.json was not found:", error.message); + nameAndVersion = request; + } - nameAndVersion = `${request}@${version}`; - } catch (error) { - debug("package.json was not found:", error.message); - nameAndVersion = request; + debug$2("Loaded: %s (%s)", nameAndVersion, filePath); } - - debug("Loaded: %s (%s)", nameAndVersion, filePath); - } } + /** * Create a new context with default values. * @param {ConfigArrayFactoryInternalSlots} slots The internal slots. @@ -118396,25 +123383,33 @@ function writeDebugLogForLoading(request, relativeTo, filePath) { * @param {string | undefined} providedMatchBasePath The type of the current configuration. Default is the directory of `filePath` or `cwd`. * @returns {ConfigArrayFactoryLoadingContext} The created context. */ +function createContext( + { cwd, resolvePluginsRelativeTo }, + providedType, + providedName, + providedFilePath, + providedMatchBasePath +) { + const filePath = providedFilePath + ? path__default["default"].resolve(cwd, providedFilePath) + : ""; + const matchBasePath = + (providedMatchBasePath && path__default["default"].resolve(cwd, providedMatchBasePath)) || + (filePath && path__default["default"].dirname(filePath)) || + cwd; + const name = + providedName || + (filePath && path__default["default"].relative(cwd, filePath)) || + ""; + const pluginBasePath = + resolvePluginsRelativeTo || + (filePath && path__default["default"].dirname(filePath)) || + cwd; + const type = providedType || "config"; - -function createContext({ - cwd, - resolvePluginsRelativeTo -}, providedType, providedName, providedFilePath, providedMatchBasePath) { - const filePath = providedFilePath ? path.resolve(cwd, providedFilePath) : ""; - const matchBasePath = providedMatchBasePath && path.resolve(cwd, providedMatchBasePath) || filePath && path.dirname(filePath) || cwd; - const name = providedName || filePath && path.relative(cwd, filePath) || ""; - const pluginBasePath = resolvePluginsRelativeTo || filePath && path.dirname(filePath) || cwd; - const type = providedType || "config"; - return { - filePath, - matchBasePath, - name, - pluginBasePath, - type - }; + return { filePath, matchBasePath, name, pluginBasePath, type }; } + /** * Normalize a given plugin. * - Ensure the object to have four properties: configs, environments, processors, and rules. @@ -118422,700 +123417,1541 @@ function createContext({ * @param {Plugin} plugin The plugin to normalize. * @returns {Plugin} The normalized plugin. */ - - function normalizePlugin(plugin) { - return { - configs: plugin.configs || {}, - environments: plugin.environments || {}, - processors: plugin.processors || {}, - rules: plugin.rules || {} - }; -} //------------------------------------------------------------------------------ + return { + configs: plugin.configs || {}, + environments: plugin.environments || {}, + processors: plugin.processors || {}, + rules: plugin.rules || {} + }; +} + +//------------------------------------------------------------------------------ // Public Interface //------------------------------------------------------------------------------ /** * The factory of `ConfigArray` objects. */ - - class ConfigArrayFactory { - /** - * Initialize this instance. - * @param {ConfigArrayFactoryOptions} [options] The map for additional plugins. - */ - constructor({ - additionalPluginPool = new Map(), - cwd = process.cwd(), - resolvePluginsRelativeTo, - builtInRules, - resolver = ModuleResolver, - eslintAllPath, - eslintRecommendedPath - } = {}) { - internalSlotsMap.set(this, { - additionalPluginPool, - cwd, - resolvePluginsRelativeTo: resolvePluginsRelativeTo && path.resolve(cwd, resolvePluginsRelativeTo), - builtInRules, - resolver, - eslintAllPath, - eslintRecommendedPath - }); - } - /** - * Create `ConfigArray` instance from a config data. - * @param {ConfigData|null} configData The config data to create. - * @param {Object} [options] The options. - * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. - * @param {string} [options.filePath] The path to this config data. - * @param {string} [options.name] The config name. - * @returns {ConfigArray} Loaded config. - */ - - create(configData, { - basePath, - filePath, - name - } = {}) { - if (!configData) { - return new ConfigArray(); + /** + * Initialize this instance. + * @param {ConfigArrayFactoryOptions} [options] The map for additional plugins. + */ + constructor({ + additionalPluginPool = new Map(), + cwd = process.cwd(), + resolvePluginsRelativeTo, + builtInRules, + resolver = ModuleResolver, + eslintAllPath, + eslintRecommendedPath + } = {}) { + internalSlotsMap$1.set(this, { + additionalPluginPool, + cwd, + resolvePluginsRelativeTo: + resolvePluginsRelativeTo && + path__default["default"].resolve(cwd, resolvePluginsRelativeTo), + builtInRules, + resolver, + eslintAllPath, + eslintRecommendedPath + }); } - const slots = internalSlotsMap.get(this); - const ctx = createContext(slots, "config", name, filePath, basePath); - - const elements = this._normalizeConfigData(configData, ctx); - - return new ConfigArray(...elements); - } - /** - * Load a config file. - * @param {string} filePath The path to a config file. - * @param {Object} [options] The options. - * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. - * @param {string} [options.name] The config name. - * @returns {ConfigArray} Loaded config. - */ - - - loadFile(filePath, { - basePath, - name - } = {}) { - const slots = internalSlotsMap.get(this); - const ctx = createContext(slots, "config", name, filePath, basePath); - return new ConfigArray(...this._loadConfigData(ctx)); - } - /** - * Load the config file on a given directory if exists. - * @param {string} directoryPath The path to a directory. - * @param {Object} [options] The options. - * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. - * @param {string} [options.name] The config name. - * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist. - */ - - - loadInDirectory(directoryPath, { - basePath, - name - } = {}) { - const slots = internalSlotsMap.get(this); - - for (const filename of configFilenames) { - const ctx = createContext(slots, "config", name, path.join(directoryPath, filename), basePath); - - if (fs.existsSync(ctx.filePath) && fs.statSync(ctx.filePath).isFile()) { - let configData; - - try { - configData = loadConfigFile(ctx.filePath); - } catch (error) { - if (!error || error.code !== "ESLINT_CONFIG_FIELD_NOT_FOUND") { - throw error; - } + /** + * Create `ConfigArray` instance from a config data. + * @param {ConfigData|null} configData The config data to create. + * @param {Object} [options] The options. + * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. + * @param {string} [options.filePath] The path to this config data. + * @param {string} [options.name] The config name. + * @returns {ConfigArray} Loaded config. + */ + create(configData, { basePath, filePath, name } = {}) { + if (!configData) { + return new ConfigArray(); } + const slots = internalSlotsMap$1.get(this); + const ctx = createContext(slots, "config", name, filePath, basePath); + const elements = this._normalizeConfigData(configData, ctx); + + return new ConfigArray(...elements); + } + + /** + * Load a config file. + * @param {string} filePath The path to a config file. + * @param {Object} [options] The options. + * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. + * @param {string} [options.name] The config name. + * @returns {ConfigArray} Loaded config. + */ + loadFile(filePath, { basePath, name } = {}) { + const slots = internalSlotsMap$1.get(this); + const ctx = createContext(slots, "config", name, filePath, basePath); + + return new ConfigArray(...this._loadConfigData(ctx)); + } + + /** + * Load the config file on a given directory if exists. + * @param {string} directoryPath The path to a directory. + * @param {Object} [options] The options. + * @param {string} [options.basePath] The base path to resolve relative paths in `overrides[].files`, `overrides[].excludedFiles`, and `ignorePatterns`. + * @param {string} [options.name] The config name. + * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist. + */ + loadInDirectory(directoryPath, { basePath, name } = {}) { + const slots = internalSlotsMap$1.get(this); + + for (const filename of configFilenames) { + const ctx = createContext( + slots, + "config", + name, + path__default["default"].join(directoryPath, filename), + basePath + ); + + if (fs__default["default"].existsSync(ctx.filePath) && fs__default["default"].statSync(ctx.filePath).isFile()) { + let configData; + + try { + configData = loadConfigFile(ctx.filePath); + } catch (error) { + if (!error || error.code !== "ESLINT_CONFIG_FIELD_NOT_FOUND") { + throw error; + } + } + + if (configData) { + debug$2(`Config file found: ${ctx.filePath}`); + return new ConfigArray( + ...this._normalizeConfigData(configData, ctx) + ); + } + } + } + + debug$2(`Config file not found on ${directoryPath}`); + return new ConfigArray(); + } + + /** + * Check if a config file on a given directory exists or not. + * @param {string} directoryPath The path to a directory. + * @returns {string | null} The path to the found config file. If not found then null. + */ + static getPathToConfigFileInDirectory(directoryPath) { + for (const filename of configFilenames) { + const filePath = path__default["default"].join(directoryPath, filename); + + if (fs__default["default"].existsSync(filePath)) { + if (filename === "package.json") { + try { + loadPackageJSONConfigFile(filePath); + return filePath; + } catch { /* ignore */ } + } else { + return filePath; + } + } + } + return null; + } + + /** + * Load `.eslintignore` file. + * @param {string} filePath The path to a `.eslintignore` file to load. + * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist. + */ + loadESLintIgnore(filePath) { + const slots = internalSlotsMap$1.get(this); + const ctx = createContext( + slots, + "ignore", + void 0, + filePath, + slots.cwd + ); + const ignorePatterns = loadESLintIgnoreFile(ctx.filePath); + + return new ConfigArray( + ...this._normalizeESLintIgnoreData(ignorePatterns, ctx) + ); + } + + /** + * Load `.eslintignore` file in the current working directory. + * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist. + */ + loadDefaultESLintIgnore() { + const slots = internalSlotsMap$1.get(this); + const eslintIgnorePath = path__default["default"].resolve(slots.cwd, ".eslintignore"); + const packageJsonPath = path__default["default"].resolve(slots.cwd, "package.json"); + + if (fs__default["default"].existsSync(eslintIgnorePath)) { + return this.loadESLintIgnore(eslintIgnorePath); + } + if (fs__default["default"].existsSync(packageJsonPath)) { + const data = loadJSONConfigFile(packageJsonPath); + + if (Object.hasOwnProperty.call(data, "eslintIgnore")) { + if (!Array.isArray(data.eslintIgnore)) { + throw new Error("Package.json eslintIgnore property requires an array of paths"); + } + const ctx = createContext( + slots, + "ignore", + "eslintIgnore in package.json", + packageJsonPath, + slots.cwd + ); + + return new ConfigArray( + ...this._normalizeESLintIgnoreData(data.eslintIgnore, ctx) + ); + } + } + + return new ConfigArray(); + } + + /** + * Load a given config file. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} Loaded config. + * @private + */ + _loadConfigData(ctx) { + return this._normalizeConfigData(loadConfigFile(ctx.filePath), ctx); + } + + /** + * Normalize a given `.eslintignore` data to config array elements. + * @param {string[]} ignorePatterns The patterns to ignore files. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + *_normalizeESLintIgnoreData(ignorePatterns, ctx) { + const elements = this._normalizeObjectConfigData( + { ignorePatterns }, + ctx + ); + + // Set `ignorePattern.loose` flag for backward compatibility. + for (const element of elements) { + if (element.ignorePattern) { + element.ignorePattern.loose = true; + } + yield element; + } + } + + /** + * Normalize a given config to an array. + * @param {ConfigData} configData The config data to normalize. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + _normalizeConfigData(configData, ctx) { + const validator = new ConfigValidator(); + + validator.validateConfigSchema(configData, ctx.name || ctx.filePath); + return this._normalizeObjectConfigData(configData, ctx); + } + + /** + * Normalize a given config to an array. + * @param {ConfigData|OverrideConfigData} configData The config data to normalize. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + *_normalizeObjectConfigData(configData, ctx) { + const { files, excludedFiles, ...configBody } = configData; + const criteria = OverrideTester.create( + files, + excludedFiles, + ctx.matchBasePath + ); + const elements = this._normalizeObjectConfigDataBody(configBody, ctx); + + // Apply the criteria to every element. + for (const element of elements) { + + /* + * Merge the criteria. + * This is for the `overrides` entries that came from the + * configurations of `overrides[].extends`. + */ + element.criteria = OverrideTester.and(criteria, element.criteria); + + /* + * Remove `root` property to ignore `root` settings which came from + * `extends` in `overrides`. + */ + if (element.criteria) { + element.root = void 0; + } + + yield element; + } + } + + /** + * Normalize a given config to an array. + * @param {ConfigData} configData The config data to normalize. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + *_normalizeObjectConfigDataBody( + { + env, + extends: extend, + globals, + ignorePatterns, + noInlineConfig, + parser: parserName, + parserOptions, + plugins: pluginList, + processor, + reportUnusedDisableDirectives, + root, + rules, + settings, + overrides: overrideList = [] + }, + ctx + ) { + const extendList = Array.isArray(extend) ? extend : [extend]; + const ignorePattern = ignorePatterns && new IgnorePattern( + Array.isArray(ignorePatterns) ? ignorePatterns : [ignorePatterns], + ctx.matchBasePath + ); + + // Flatten `extends`. + for (const extendName of extendList.filter(Boolean)) { + yield* this._loadExtends(extendName, ctx); + } + + // Load parser & plugins. + const parser = parserName && this._loadParser(parserName, ctx); + const plugins = pluginList && this._loadPlugins(pluginList, ctx); + + // Yield pseudo config data for file extension processors. + if (plugins) { + yield* this._takeFileExtensionProcessors(plugins, ctx); + } + + // Yield the config data except `extends` and `overrides`. + yield { + + // Debug information. + type: ctx.type, + name: ctx.name, + filePath: ctx.filePath, + + // Config data. + criteria: null, + env, + globals, + ignorePattern, + noInlineConfig, + parser, + parserOptions, + plugins, + processor, + reportUnusedDisableDirectives, + root, + rules, + settings + }; + + // Flatten `overries`. + for (let i = 0; i < overrideList.length; ++i) { + yield* this._normalizeObjectConfigData( + overrideList[i], + { ...ctx, name: `${ctx.name}#overrides[${i}]` } + ); + } + } + + /** + * Load configs of an element in `extends`. + * @param {string} extendName The name of a base config. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + _loadExtends(extendName, ctx) { + debug$2("Loading {extends:%j} relative to %s", extendName, ctx.filePath); + try { + if (extendName.startsWith("eslint:")) { + return this._loadExtendedBuiltInConfig(extendName, ctx); + } + if (extendName.startsWith("plugin:")) { + return this._loadExtendedPluginConfig(extendName, ctx); + } + return this._loadExtendedShareableConfig(extendName, ctx); + } catch (error) { + error.message += `\nReferenced from: ${ctx.filePath || ctx.name}`; + throw error; + } + } + + /** + * Load configs of an element in `extends`. + * @param {string} extendName The name of a base config. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + _loadExtendedBuiltInConfig(extendName, ctx) { + const { eslintAllPath, eslintRecommendedPath } = internalSlotsMap$1.get(this); + + if (extendName === "eslint:recommended") { + return this._loadConfigData({ + ...ctx, + filePath: eslintRecommendedPath, + name: `${ctx.name} » ${extendName}` + }); + } + if (extendName === "eslint:all") { + return this._loadConfigData({ + ...ctx, + filePath: eslintAllPath, + name: `${ctx.name} » ${extendName}` + }); + } + + throw configInvalidError(extendName, ctx.name, "extend-config-missing"); + } + + /** + * Load configs of an element in `extends`. + * @param {string} extendName The name of a base config. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + _loadExtendedPluginConfig(extendName, ctx) { + const slashIndex = extendName.lastIndexOf("/"); + + if (slashIndex === -1) { + throw configInvalidError(extendName, ctx.filePath, "plugin-invalid"); + } + + const pluginName = extendName.slice("plugin:".length, slashIndex); + const configName = extendName.slice(slashIndex + 1); + + if (isFilePath(pluginName)) { + throw new Error("'extends' cannot use a file path for plugins."); + } + + const plugin = this._loadPlugin(pluginName, ctx); + const configData = + plugin.definition && + plugin.definition.configs[configName]; + if (configData) { - debug(`Config file found: ${ctx.filePath}`); - return new ConfigArray(...this._normalizeConfigData(configData, ctx)); + return this._normalizeConfigData(configData, { + ...ctx, + filePath: plugin.filePath || ctx.filePath, + name: `${ctx.name} » plugin:${plugin.id}/${configName}` + }); } - } + + throw plugin.error || configInvalidError(extendName, ctx.filePath, "extend-config-missing"); } - debug(`Config file not found on ${directoryPath}`); - return new ConfigArray(); - } - /** - * Check if a config file on a given directory exists or not. - * @param {string} directoryPath The path to a directory. - * @returns {string | null} The path to the found config file. If not found then null. - */ + /** + * Load configs of an element in `extends`. + * @param {string} extendName The name of a base config. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The normalized config. + * @private + */ + _loadExtendedShareableConfig(extendName, ctx) { + const { cwd, resolver } = internalSlotsMap$1.get(this); + const relativeTo = ctx.filePath || path__default["default"].join(cwd, "__placeholder__.js"); + let request; - - static getPathToConfigFileInDirectory(directoryPath) { - for (const filename of configFilenames) { - const filePath = path.join(directoryPath, filename); - - if (fs.existsSync(filePath)) { - if (filename === "package.json") { - try { - loadPackageJSONConfigFile(filePath); - return filePath; - } catch { - /* ignore */ - } + if (isFilePath(extendName)) { + request = extendName; + } else if (extendName.startsWith(".")) { + request = `./${extendName}`; // For backward compatibility. A ton of tests depended on this behavior. } else { - return filePath; - } - } - } - - return null; - } - /** - * Load `.eslintignore` file. - * @param {string} filePath The path to a `.eslintignore` file to load. - * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist. - */ - - - loadESLintIgnore(filePath) { - const slots = internalSlotsMap.get(this); - const ctx = createContext(slots, "ignore", void 0, filePath, slots.cwd); - const ignorePatterns = loadESLintIgnoreFile(ctx.filePath); - return new ConfigArray(...this._normalizeESLintIgnoreData(ignorePatterns, ctx)); - } - /** - * Load `.eslintignore` file in the current working directory. - * @returns {ConfigArray} Loaded config. An empty `ConfigArray` if any config doesn't exist. - */ - - - loadDefaultESLintIgnore() { - const slots = internalSlotsMap.get(this); - const eslintIgnorePath = path.resolve(slots.cwd, ".eslintignore"); - const packageJsonPath = path.resolve(slots.cwd, "package.json"); - - if (fs.existsSync(eslintIgnorePath)) { - return this.loadESLintIgnore(eslintIgnorePath); - } - - if (fs.existsSync(packageJsonPath)) { - const data = loadJSONConfigFile(packageJsonPath); - - if (Object.hasOwnProperty.call(data, "eslintIgnore")) { - if (!Array.isArray(data.eslintIgnore)) { - throw new Error("Package.json eslintIgnore property requires an array of paths"); + request = normalizePackageName( + extendName, + "eslint-config" + ); } - const ctx = createContext(slots, "ignore", "eslintIgnore in package.json", packageJsonPath, slots.cwd); - return new ConfigArray(...this._normalizeESLintIgnoreData(data.eslintIgnore, ctx)); - } - } - - return new ConfigArray(); - } - /** - * Load a given config file. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {IterableIterator} Loaded config. - * @private - */ - - - _loadConfigData(ctx) { - return this._normalizeConfigData(loadConfigFile(ctx.filePath), ctx); - } - /** - * Normalize a given `.eslintignore` data to config array elements. - * @param {string[]} ignorePatterns The patterns to ignore files. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {IterableIterator} The normalized config. - * @private - */ - - - *_normalizeESLintIgnoreData(ignorePatterns, ctx) { - const elements = this._normalizeObjectConfigData({ - ignorePatterns - }, ctx); // Set `ignorePattern.loose` flag for backward compatibility. - - - for (const element of elements) { - if (element.ignorePattern) { - element.ignorePattern.loose = true; - } - - yield element; - } - } - /** - * Normalize a given config to an array. - * @param {ConfigData} configData The config data to normalize. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {IterableIterator} The normalized config. - * @private - */ - - - _normalizeConfigData(configData, ctx) { - const validator = new ConfigValidator(); - validator.validateConfigSchema(configData, ctx.name || ctx.filePath); - return this._normalizeObjectConfigData(configData, ctx); - } - /** - * Normalize a given config to an array. - * @param {ConfigData|OverrideConfigData} configData The config data to normalize. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {IterableIterator} The normalized config. - * @private - */ - - - *_normalizeObjectConfigData(configData, ctx) { - const { - files, - excludedFiles, - ...configBody - } = configData; - const criteria = OverrideTester.create(files, excludedFiles, ctx.matchBasePath); - - const elements = this._normalizeObjectConfigDataBody(configBody, ctx); // Apply the criteria to every element. - - - for (const element of elements) { - /* - * Merge the criteria. - * This is for the `overrides` entries that came from the - * configurations of `overrides[].extends`. - */ - element.criteria = OverrideTester.and(criteria, element.criteria); - /* - * Remove `root` property to ignore `root` settings which came from - * `extends` in `overrides`. - */ - - if (element.criteria) { - element.root = void 0; - } - - yield element; - } - } - /** - * Normalize a given config to an array. - * @param {ConfigData} configData The config data to normalize. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {IterableIterator} The normalized config. - * @private - */ - - - *_normalizeObjectConfigDataBody({ - env, - extends: extend, - globals, - ignorePatterns, - noInlineConfig, - parser: parserName, - parserOptions, - plugins: pluginList, - processor, - reportUnusedDisableDirectives, - root, - rules, - settings, - overrides: overrideList = [] - }, ctx) { - const extendList = Array.isArray(extend) ? extend : [extend]; - const ignorePattern = ignorePatterns && new IgnorePattern(Array.isArray(ignorePatterns) ? ignorePatterns : [ignorePatterns], ctx.matchBasePath); // Flatten `extends`. - - for (const extendName of extendList.filter(Boolean)) { - yield* this._loadExtends(extendName, ctx); - } // Load parser & plugins. - - - const parser = parserName && this._loadParser(parserName, ctx); - - const plugins = pluginList && this._loadPlugins(pluginList, ctx); // Yield pseudo config data for file extension processors. - - - if (plugins) { - yield* this._takeFileExtensionProcessors(plugins, ctx); - } // Yield the config data except `extends` and `overrides`. - - - yield { - // Debug information. - type: ctx.type, - name: ctx.name, - filePath: ctx.filePath, - // Config data. - criteria: null, - env, - globals, - ignorePattern, - noInlineConfig, - parser, - parserOptions, - plugins, - processor, - reportUnusedDisableDirectives, - root, - rules, - settings - }; // Flatten `overries`. - - for (let i = 0; i < overrideList.length; ++i) { - yield* this._normalizeObjectConfigData(overrideList[i], { ...ctx, - name: `${ctx.name}#overrides[${i}]` - }); - } - } - /** - * Load configs of an element in `extends`. - * @param {string} extendName The name of a base config. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {IterableIterator} The normalized config. - * @private - */ - - - _loadExtends(extendName, ctx) { - debug("Loading {extends:%j} relative to %s", extendName, ctx.filePath); - - try { - if (extendName.startsWith("eslint:")) { - return this._loadExtendedBuiltInConfig(extendName, ctx); - } - - if (extendName.startsWith("plugin:")) { - return this._loadExtendedPluginConfig(extendName, ctx); - } - - return this._loadExtendedShareableConfig(extendName, ctx); - } catch (error) { - error.message += `\nReferenced from: ${ctx.filePath || ctx.name}`; - throw error; - } - } - /** - * Load configs of an element in `extends`. - * @param {string} extendName The name of a base config. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {IterableIterator} The normalized config. - * @private - */ - - - _loadExtendedBuiltInConfig(extendName, ctx) { - const { - eslintAllPath, - eslintRecommendedPath - } = internalSlotsMap.get(this); - - if (extendName === "eslint:recommended") { - return this._loadConfigData({ ...ctx, - filePath: eslintRecommendedPath, - name: `${ctx.name} » ${extendName}` - }); - } - - if (extendName === "eslint:all") { - return this._loadConfigData({ ...ctx, - filePath: eslintAllPath, - name: `${ctx.name} » ${extendName}` - }); - } - - throw configInvalidError(extendName, ctx.name, "extend-config-missing"); - } - /** - * Load configs of an element in `extends`. - * @param {string} extendName The name of a base config. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {IterableIterator} The normalized config. - * @private - */ - - - _loadExtendedPluginConfig(extendName, ctx) { - const slashIndex = extendName.lastIndexOf("/"); - - if (slashIndex === -1) { - throw configInvalidError(extendName, ctx.filePath, "plugin-invalid"); - } - - const pluginName = extendName.slice("plugin:".length, slashIndex); - const configName = extendName.slice(slashIndex + 1); - - if (isFilePath(pluginName)) { - throw new Error("'extends' cannot use a file path for plugins."); - } - - const plugin = this._loadPlugin(pluginName, ctx); - - const configData = plugin.definition && plugin.definition.configs[configName]; - - if (configData) { - return this._normalizeConfigData(configData, { ...ctx, - filePath: plugin.filePath || ctx.filePath, - name: `${ctx.name} » plugin:${plugin.id}/${configName}` - }); - } - - throw plugin.error || configInvalidError(extendName, ctx.filePath, "extend-config-missing"); - } - /** - * Load configs of an element in `extends`. - * @param {string} extendName The name of a base config. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {IterableIterator} The normalized config. - * @private - */ - - - _loadExtendedShareableConfig(extendName, ctx) { - const { - cwd, - resolver - } = internalSlotsMap.get(this); - const relativeTo = ctx.filePath || path.join(cwd, "__placeholder__.js"); - let request; - - if (isFilePath(extendName)) { - request = extendName; - } else if (extendName.startsWith(".")) { - request = `./${extendName}`; // For backward compatibility. A ton of tests depended on this behavior. - } else { - request = naming.normalizePackageName(extendName, "eslint-config"); - } - - let filePath; - - try { - filePath = resolver.resolve(request, relativeTo); - } catch (error) { - /* istanbul ignore else */ - if (error && error.code === "MODULE_NOT_FOUND") { - throw configInvalidError(extendName, ctx.filePath, "extend-config-missing"); - } - - throw error; - } - - writeDebugLogForLoading(request, relativeTo, filePath); - return this._loadConfigData({ ...ctx, - filePath, - name: `${ctx.name} » ${request}` - }); - } - /** - * Load given plugins. - * @param {string[]} names The plugin names to load. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {Record} The loaded parser. - * @private - */ - - - _loadPlugins(names, ctx) { - return names.reduce((map, name) => { - if (isFilePath(name)) { - throw new Error("Plugins array cannot includes file paths."); - } - - const plugin = this._loadPlugin(name, ctx); - - map[plugin.id] = plugin; - return map; - }, {}); - } - /** - * Load a given parser. - * @param {string} nameOrPath The package name or the path to a parser file. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {DependentParser} The loaded parser. - */ - - - _loadParser(nameOrPath, ctx) { - debug("Loading parser %j from %s", nameOrPath, ctx.filePath); - const { - cwd - } = internalSlotsMap.get(this); - const relativeTo = ctx.filePath || path.join(cwd, "__placeholder__.js"); - - try { - const filePath = ModuleResolver.resolve(nameOrPath, relativeTo); - writeDebugLogForLoading(nameOrPath, relativeTo, filePath); - return new ConfigDependency({ - definition: __webpack_require__(915)(filePath), - filePath, - id: nameOrPath, - importerName: ctx.name, - importerPath: ctx.filePath - }); - } catch (error) { - // If the parser name is "espree", load the espree of ESLint. - if (nameOrPath === "espree") { - debug("Fallback espree."); - return new ConfigDependency({ - definition: __webpack_require__(423), - filePath: /*require.resolve*/(423), - id: nameOrPath, - importerName: ctx.name, - importerPath: ctx.filePath - }); - } - - debug("Failed to load parser '%s' declared in '%s'.", nameOrPath, ctx.name); - error.message = `Failed to load parser '${nameOrPath}' declared in '${ctx.name}': ${error.message}`; - return new ConfigDependency({ - error, - id: nameOrPath, - importerName: ctx.name, - importerPath: ctx.filePath - }); - } - } - /** - * Load a given plugin. - * @param {string} name The plugin name to load. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {DependentPlugin} The loaded plugin. - * @private - */ - - - _loadPlugin(name, ctx) { - debug("Loading plugin %j from %s", name, ctx.filePath); - const { - additionalPluginPool - } = internalSlotsMap.get(this); - const request = naming.normalizePackageName(name, "eslint-plugin"); - const id = naming.getShorthandName(request, "eslint-plugin"); - const relativeTo = path.join(ctx.pluginBasePath, "__placeholder__.js"); - - if (name.match(/\s+/u)) { - const error = Object.assign(new Error(`Whitespace found in plugin name '${name}'`), { - messageTemplate: "whitespace-found", - messageData: { - pluginName: request + let filePath; + + try { + filePath = resolver.resolve(request, relativeTo); + } catch (error) { + /* istanbul ignore else */ + if (error && error.code === "MODULE_NOT_FOUND") { + throw configInvalidError(extendName, ctx.filePath, "extend-config-missing"); + } + throw error; } - }); - return new ConfigDependency({ - error, - id, - importerName: ctx.name, - importerPath: ctx.filePath - }); - } // Check for additional pool. - - const plugin = additionalPluginPool.get(request) || additionalPluginPool.get(id); - - if (plugin) { - return new ConfigDependency({ - definition: normalizePlugin(plugin), - filePath: "", - // It's unknown where the plugin came from. - id, - importerName: ctx.name, - importerPath: ctx.filePath - }); - } - - let filePath; - let error; - - try { - filePath = ModuleResolver.resolve(request, relativeTo); - } catch (resolveError) { - error = resolveError; - /* istanbul ignore else */ - - if (error && error.code === "MODULE_NOT_FOUND") { - error.messageTemplate = "plugin-missing"; - error.messageData = { - pluginName: request, - resolvePluginsRelativeTo: ctx.pluginBasePath, - importerName: ctx.name - }; - } - } - - if (filePath) { - try { writeDebugLogForLoading(request, relativeTo, filePath); - const startTime = Date.now(); - - const pluginDefinition = __webpack_require__(915)(filePath); - - debug(`Plugin ${filePath} loaded in: ${Date.now() - startTime}ms`); - return new ConfigDependency({ - definition: normalizePlugin(pluginDefinition), - filePath, - id, - importerName: ctx.name, - importerPath: ctx.filePath + return this._loadConfigData({ + ...ctx, + filePath, + name: `${ctx.name} » ${request}` }); - } catch (loadError) { - error = loadError; - } } - debug("Failed to load plugin '%s' declared in '%s'.", name, ctx.name); - error.message = `Failed to load plugin '${name}' declared in '${ctx.name}': ${error.message}`; - return new ConfigDependency({ - error, - id, - importerName: ctx.name, - importerPath: ctx.filePath - }); - } - /** - * Take file expression processors as config array elements. - * @param {Record} plugins The plugin definitions. - * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. - * @returns {IterableIterator} The config array elements of file expression processors. - * @private - */ + /** + * Load given plugins. + * @param {string[]} names The plugin names to load. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {Record} The loaded parser. + * @private + */ + _loadPlugins(names, ctx) { + return names.reduce((map, name) => { + if (isFilePath(name)) { + throw new Error("Plugins array cannot includes file paths."); + } + const plugin = this._loadPlugin(name, ctx); + map[plugin.id] = plugin; - *_takeFileExtensionProcessors(plugins, ctx) { - for (const pluginId of Object.keys(plugins)) { - const processors = plugins[pluginId] && plugins[pluginId].definition && plugins[pluginId].definition.processors; + return map; + }, {}); + } - if (!processors) { - continue; - } + /** + * Load a given parser. + * @param {string} nameOrPath The package name or the path to a parser file. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {DependentParser} The loaded parser. + */ + _loadParser(nameOrPath, ctx) { + debug$2("Loading parser %j from %s", nameOrPath, ctx.filePath); - for (const processorId of Object.keys(processors)) { - if (processorId.startsWith(".")) { - yield* this._normalizeObjectConfigData({ - files: [`*${processorId}`], - processor: `${pluginId}/${processorId}` - }, { ...ctx, - type: "implicit-processor", - name: `${ctx.name}#processors["${pluginId}/${processorId}"]` - }); + const { cwd, resolver } = internalSlotsMap$1.get(this); + const relativeTo = ctx.filePath || path__default["default"].join(cwd, "__placeholder__.js"); + + try { + const filePath = resolver.resolve(nameOrPath, relativeTo); + + writeDebugLogForLoading(nameOrPath, relativeTo, filePath); + + return new ConfigDependency({ + definition: require$1(filePath), + filePath, + id: nameOrPath, + importerName: ctx.name, + importerPath: ctx.filePath + }); + } catch (error) { + + // If the parser name is "espree", load the espree of ESLint. + if (nameOrPath === "espree") { + debug$2("Fallback espree."); + return new ConfigDependency({ + definition: require$1("espree"), + filePath: require$1.resolve("espree"), + id: nameOrPath, + importerName: ctx.name, + importerPath: ctx.filePath + }); + } + + debug$2("Failed to load parser '%s' declared in '%s'.", nameOrPath, ctx.name); + error.message = `Failed to load parser '${nameOrPath}' declared in '${ctx.name}': ${error.message}`; + + return new ConfigDependency({ + error, + id: nameOrPath, + importerName: ctx.name, + importerPath: ctx.filePath + }); } - } } - } + /** + * Load a given plugin. + * @param {string} name The plugin name to load. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {DependentPlugin} The loaded plugin. + * @private + */ + _loadPlugin(name, ctx) { + debug$2("Loading plugin %j from %s", name, ctx.filePath); + + const { additionalPluginPool, resolver } = internalSlotsMap$1.get(this); + const request = normalizePackageName(name, "eslint-plugin"); + const id = getShorthandName(request, "eslint-plugin"); + const relativeTo = path__default["default"].join(ctx.pluginBasePath, "__placeholder__.js"); + + if (name.match(/\s+/u)) { + const error = Object.assign( + new Error(`Whitespace found in plugin name '${name}'`), + { + messageTemplate: "whitespace-found", + messageData: { pluginName: request } + } + ); + + return new ConfigDependency({ + error, + id, + importerName: ctx.name, + importerPath: ctx.filePath + }); + } + + // Check for additional pool. + const plugin = + additionalPluginPool.get(request) || + additionalPluginPool.get(id); + + if (plugin) { + return new ConfigDependency({ + definition: normalizePlugin(plugin), + filePath: "", // It's unknown where the plugin came from. + id, + importerName: ctx.name, + importerPath: ctx.filePath + }); + } + + let filePath; + let error; + + try { + filePath = resolver.resolve(request, relativeTo); + } catch (resolveError) { + error = resolveError; + /* istanbul ignore else */ + if (error && error.code === "MODULE_NOT_FOUND") { + error.messageTemplate = "plugin-missing"; + error.messageData = { + pluginName: request, + resolvePluginsRelativeTo: ctx.pluginBasePath, + importerName: ctx.name + }; + } + } + + if (filePath) { + try { + writeDebugLogForLoading(request, relativeTo, filePath); + + const startTime = Date.now(); + const pluginDefinition = require$1(filePath); + + debug$2(`Plugin ${filePath} loaded in: ${Date.now() - startTime}ms`); + + return new ConfigDependency({ + definition: normalizePlugin(pluginDefinition), + filePath, + id, + importerName: ctx.name, + importerPath: ctx.filePath + }); + } catch (loadError) { + error = loadError; + } + } + + debug$2("Failed to load plugin '%s' declared in '%s'.", name, ctx.name); + error.message = `Failed to load plugin '${name}' declared in '${ctx.name}': ${error.message}`; + return new ConfigDependency({ + error, + id, + importerName: ctx.name, + importerPath: ctx.filePath + }); + } + + /** + * Take file expression processors as config array elements. + * @param {Record} plugins The plugin definitions. + * @param {ConfigArrayFactoryLoadingContext} ctx The loading context. + * @returns {IterableIterator} The config array elements of file expression processors. + * @private + */ + *_takeFileExtensionProcessors(plugins, ctx) { + for (const pluginId of Object.keys(plugins)) { + const processors = + plugins[pluginId] && + plugins[pluginId].definition && + plugins[pluginId].definition.processors; + + if (!processors) { + continue; + } + + for (const processorId of Object.keys(processors)) { + if (processorId.startsWith(".")) { + yield* this._normalizeObjectConfigData( + { + files: [`*${processorId}`], + processor: `${pluginId}/${processorId}` + }, + { + ...ctx, + type: "implicit-processor", + name: `${ctx.name}#processors["${pluginId}/${processorId}"]` + } + ); + } + } + } + } } -module.exports = { - ConfigArrayFactory, - createContext +/** + * @fileoverview `CascadingConfigArrayFactory` class. + * + * `CascadingConfigArrayFactory` class has a responsibility: + * + * 1. Handles cascading of config files. + * + * It provides two methods: + * + * - `getConfigArrayForFile(filePath)` + * Get the corresponded configuration of a given file. This method doesn't + * throw even if the given file didn't exist. + * - `clearCache()` + * Clear the internal cache. You have to call this method when + * `additionalPluginPool` was updated if `baseConfig` or `cliConfig` depends + * on the additional plugins. (`CLIEngine#addPlugin()` method calls this.) + * + * @author Toru Nagashima + */ + +const debug$1 = debugOrig__default["default"]("eslintrc:cascading-config-array-factory"); + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +// Define types for VSCode IntelliSense. +/** @typedef {import("./shared/types").ConfigData} ConfigData */ +/** @typedef {import("./shared/types").Parser} Parser */ +/** @typedef {import("./shared/types").Plugin} Plugin */ +/** @typedef {import("./shared/types").Rule} Rule */ +/** @typedef {ReturnType} ConfigArray */ + +/** + * @typedef {Object} CascadingConfigArrayFactoryOptions + * @property {Map} [additionalPluginPool] The map for additional plugins. + * @property {ConfigData} [baseConfig] The config by `baseConfig` option. + * @property {ConfigData} [cliConfig] The config by CLI options (`--env`, `--global`, `--ignore-pattern`, `--parser`, `--parser-options`, `--plugin`, and `--rule`). CLI options overwrite the setting in config files. + * @property {string} [cwd] The base directory to start lookup. + * @property {string} [ignorePath] The path to the alternative file of `.eslintignore`. + * @property {string[]} [rulePaths] The value of `--rulesdir` option. + * @property {string} [specificConfigPath] The value of `--config` option. + * @property {boolean} [useEslintrc] if `false` then it doesn't load config files. + * @property {Function} loadRules The function to use to load rules. + * @property {Map} builtInRules The rules that are built in to ESLint. + * @property {Object} [resolver=ModuleResolver] The module resolver object. + * @property {string} eslintAllPath The path to the definitions for eslint:all. + * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended. + */ + +/** + * @typedef {Object} CascadingConfigArrayFactoryInternalSlots + * @property {ConfigArray} baseConfigArray The config array of `baseConfig` option. + * @property {ConfigData} baseConfigData The config data of `baseConfig` option. This is used to reset `baseConfigArray`. + * @property {ConfigArray} cliConfigArray The config array of CLI options. + * @property {ConfigData} cliConfigData The config data of CLI options. This is used to reset `cliConfigArray`. + * @property {ConfigArrayFactory} configArrayFactory The factory for config arrays. + * @property {Map} configCache The cache from directory paths to config arrays. + * @property {string} cwd The base directory to start lookup. + * @property {WeakMap} finalizeCache The cache from config arrays to finalized config arrays. + * @property {string} [ignorePath] The path to the alternative file of `.eslintignore`. + * @property {string[]|null} rulePaths The value of `--rulesdir` option. This is used to reset `baseConfigArray`. + * @property {string|null} specificConfigPath The value of `--config` option. This is used to reset `cliConfigArray`. + * @property {boolean} useEslintrc if `false` then it doesn't load config files. + * @property {Function} loadRules The function to use to load rules. + * @property {Map} builtInRules The rules that are built in to ESLint. + * @property {Object} [resolver=ModuleResolver] The module resolver object. + * @property {string} eslintAllPath The path to the definitions for eslint:all. + * @property {string} eslintRecommendedPath The path to the definitions for eslint:recommended. + */ + +/** @type {WeakMap} */ +const internalSlotsMap = new WeakMap(); + +/** + * Create the config array from `baseConfig` and `rulePaths`. + * @param {CascadingConfigArrayFactoryInternalSlots} slots The slots. + * @returns {ConfigArray} The config array of the base configs. + */ +function createBaseConfigArray({ + configArrayFactory, + baseConfigData, + rulePaths, + cwd, + loadRules +}) { + const baseConfigArray = configArrayFactory.create( + baseConfigData, + { name: "BaseConfig" } + ); + + /* + * Create the config array element for the default ignore patterns. + * This element has `ignorePattern` property that ignores the default + * patterns in the current working directory. + */ + baseConfigArray.unshift(configArrayFactory.create( + { ignorePatterns: IgnorePattern.DefaultPatterns }, + { name: "DefaultIgnorePattern" } + )[0]); + + /* + * Load rules `--rulesdir` option as a pseudo plugin. + * Use a pseudo plugin to define rules of `--rulesdir`, so we can validate + * the rule's options with only information in the config array. + */ + if (rulePaths && rulePaths.length > 0) { + baseConfigArray.push({ + type: "config", + name: "--rulesdir", + filePath: "", + plugins: { + "": new ConfigDependency({ + definition: { + rules: rulePaths.reduce( + (map, rulesPath) => Object.assign( + map, + loadRules(rulesPath, cwd) + ), + {} + ) + }, + filePath: "", + id: "", + importerName: "--rulesdir", + importerPath: "" + }) + } + }); + } + + return baseConfigArray; +} + +/** + * Create the config array from CLI options. + * @param {CascadingConfigArrayFactoryInternalSlots} slots The slots. + * @returns {ConfigArray} The config array of the base configs. + */ +function createCLIConfigArray({ + cliConfigData, + configArrayFactory, + cwd, + ignorePath, + specificConfigPath +}) { + const cliConfigArray = configArrayFactory.create( + cliConfigData, + { name: "CLIOptions" } + ); + + cliConfigArray.unshift( + ...(ignorePath + ? configArrayFactory.loadESLintIgnore(ignorePath) + : configArrayFactory.loadDefaultESLintIgnore()) + ); + + if (specificConfigPath) { + cliConfigArray.unshift( + ...configArrayFactory.loadFile( + specificConfigPath, + { name: "--config", basePath: cwd } + ) + ); + } + + return cliConfigArray; +} + +/** + * The error type when there are files matched by a glob, but all of them have been ignored. + */ +class ConfigurationNotFoundError extends Error { + + // eslint-disable-next-line jsdoc/require-description + /** + * @param {string} directoryPath The directory path. + */ + constructor(directoryPath) { + super(`No ESLint configuration found in ${directoryPath}.`); + this.messageTemplate = "no-config-found"; + this.messageData = { directoryPath }; + } +} + +/** + * This class provides the functionality that enumerates every file which is + * matched by given glob patterns and that configuration. + */ +class CascadingConfigArrayFactory { + + /** + * Initialize this enumerator. + * @param {CascadingConfigArrayFactoryOptions} options The options. + */ + constructor({ + additionalPluginPool = new Map(), + baseConfig: baseConfigData = null, + cliConfig: cliConfigData = null, + cwd = process.cwd(), + ignorePath, + resolvePluginsRelativeTo, + rulePaths = [], + specificConfigPath = null, + useEslintrc = true, + builtInRules = new Map(), + loadRules, + resolver, + eslintRecommendedPath, + eslintAllPath + } = {}) { + const configArrayFactory = new ConfigArrayFactory({ + additionalPluginPool, + cwd, + resolvePluginsRelativeTo, + builtInRules, + resolver, + eslintRecommendedPath, + eslintAllPath + }); + + internalSlotsMap.set(this, { + baseConfigArray: createBaseConfigArray({ + baseConfigData, + configArrayFactory, + cwd, + rulePaths, + loadRules, + resolver + }), + baseConfigData, + cliConfigArray: createCLIConfigArray({ + cliConfigData, + configArrayFactory, + cwd, + ignorePath, + specificConfigPath + }), + cliConfigData, + configArrayFactory, + configCache: new Map(), + cwd, + finalizeCache: new WeakMap(), + ignorePath, + rulePaths, + specificConfigPath, + useEslintrc, + builtInRules, + loadRules + }); + } + + /** + * The path to the current working directory. + * This is used by tests. + * @type {string} + */ + get cwd() { + const { cwd } = internalSlotsMap.get(this); + + return cwd; + } + + /** + * Get the config array of a given file. + * If `filePath` was not given, it returns the config which contains only + * `baseConfigData` and `cliConfigData`. + * @param {string} [filePath] The file path to a file. + * @param {Object} [options] The options. + * @param {boolean} [options.ignoreNotFoundError] If `true` then it doesn't throw `ConfigurationNotFoundError`. + * @returns {ConfigArray} The config array of the file. + */ + getConfigArrayForFile(filePath, { ignoreNotFoundError = false } = {}) { + const { + baseConfigArray, + cliConfigArray, + cwd + } = internalSlotsMap.get(this); + + if (!filePath) { + return new ConfigArray(...baseConfigArray, ...cliConfigArray); + } + + const directoryPath = path__default["default"].dirname(path__default["default"].resolve(cwd, filePath)); + + debug$1(`Load config files for ${directoryPath}.`); + + return this._finalizeConfigArray( + this._loadConfigInAncestors(directoryPath), + directoryPath, + ignoreNotFoundError + ); + } + + /** + * Set the config data to override all configs. + * Require to call `clearCache()` method after this method is called. + * @param {ConfigData} configData The config data to override all configs. + * @returns {void} + */ + setOverrideConfig(configData) { + const slots = internalSlotsMap.get(this); + + slots.cliConfigData = configData; + } + + /** + * Clear config cache. + * @returns {void} + */ + clearCache() { + const slots = internalSlotsMap.get(this); + + slots.baseConfigArray = createBaseConfigArray(slots); + slots.cliConfigArray = createCLIConfigArray(slots); + slots.configCache.clear(); + } + + /** + * Load and normalize config files from the ancestor directories. + * @param {string} directoryPath The path to a leaf directory. + * @param {boolean} configsExistInSubdirs `true` if configurations exist in subdirectories. + * @returns {ConfigArray} The loaded config. + * @private + */ + _loadConfigInAncestors(directoryPath, configsExistInSubdirs = false) { + const { + baseConfigArray, + configArrayFactory, + configCache, + cwd, + useEslintrc + } = internalSlotsMap.get(this); + + if (!useEslintrc) { + return baseConfigArray; + } + + let configArray = configCache.get(directoryPath); + + // Hit cache. + if (configArray) { + debug$1(`Cache hit: ${directoryPath}.`); + return configArray; + } + debug$1(`No cache found: ${directoryPath}.`); + + const homePath = os__default["default"].homedir(); + + // Consider this is root. + if (directoryPath === homePath && cwd !== homePath) { + debug$1("Stop traversing because of considered root."); + if (configsExistInSubdirs) { + const filePath = ConfigArrayFactory.getPathToConfigFileInDirectory(directoryPath); + + if (filePath) { + emitDeprecationWarning( + filePath, + "ESLINT_PERSONAL_CONFIG_SUPPRESS" + ); + } + } + return this._cacheConfig(directoryPath, baseConfigArray); + } + + // Load the config on this directory. + try { + configArray = configArrayFactory.loadInDirectory(directoryPath); + } catch (error) { + /* istanbul ignore next */ + if (error.code === "EACCES") { + debug$1("Stop traversing because of 'EACCES' error."); + return this._cacheConfig(directoryPath, baseConfigArray); + } + throw error; + } + + if (configArray.length > 0 && configArray.isRoot()) { + debug$1("Stop traversing because of 'root:true'."); + configArray.unshift(...baseConfigArray); + return this._cacheConfig(directoryPath, configArray); + } + + // Load from the ancestors and merge it. + const parentPath = path__default["default"].dirname(directoryPath); + const parentConfigArray = parentPath && parentPath !== directoryPath + ? this._loadConfigInAncestors( + parentPath, + configsExistInSubdirs || configArray.length > 0 + ) + : baseConfigArray; + + if (configArray.length > 0) { + configArray.unshift(...parentConfigArray); + } else { + configArray = parentConfigArray; + } + + // Cache and return. + return this._cacheConfig(directoryPath, configArray); + } + + /** + * Freeze and cache a given config. + * @param {string} directoryPath The path to a directory as a cache key. + * @param {ConfigArray} configArray The config array as a cache value. + * @returns {ConfigArray} The `configArray` (frozen). + */ + _cacheConfig(directoryPath, configArray) { + const { configCache } = internalSlotsMap.get(this); + + Object.freeze(configArray); + configCache.set(directoryPath, configArray); + + return configArray; + } + + /** + * Finalize a given config array. + * Concatenate `--config` and other CLI options. + * @param {ConfigArray} configArray The parent config array. + * @param {string} directoryPath The path to the leaf directory to find config files. + * @param {boolean} ignoreNotFoundError If `true` then it doesn't throw `ConfigurationNotFoundError`. + * @returns {ConfigArray} The loaded config. + * @private + */ + _finalizeConfigArray(configArray, directoryPath, ignoreNotFoundError) { + const { + cliConfigArray, + configArrayFactory, + finalizeCache, + useEslintrc, + builtInRules + } = internalSlotsMap.get(this); + + let finalConfigArray = finalizeCache.get(configArray); + + if (!finalConfigArray) { + finalConfigArray = configArray; + + // Load the personal config if there are no regular config files. + if ( + useEslintrc && + configArray.every(c => !c.filePath) && + cliConfigArray.every(c => !c.filePath) // `--config` option can be a file. + ) { + const homePath = os__default["default"].homedir(); + + debug$1("Loading the config file of the home directory:", homePath); + + const personalConfigArray = configArrayFactory.loadInDirectory( + homePath, + { name: "PersonalConfig" } + ); + + if ( + personalConfigArray.length > 0 && + !directoryPath.startsWith(homePath) + ) { + const lastElement = + personalConfigArray[personalConfigArray.length - 1]; + + emitDeprecationWarning( + lastElement.filePath, + "ESLINT_PERSONAL_CONFIG_LOAD" + ); + } + + finalConfigArray = finalConfigArray.concat(personalConfigArray); + } + + // Apply CLI options. + if (cliConfigArray.length > 0) { + finalConfigArray = finalConfigArray.concat(cliConfigArray); + } + + // Validate rule settings and environments. + const validator = new ConfigValidator({ + builtInRules + }); + + validator.validateConfigArray(finalConfigArray); + + // Cache it. + Object.freeze(finalConfigArray); + finalizeCache.set(configArray, finalConfigArray); + + debug$1( + "Configuration was determined: %o on %s", + finalConfigArray, + directoryPath + ); + } + + // At least one element (the default ignore patterns) exists. + if (!ignoreNotFoundError && useEslintrc && finalConfigArray.length <= 1) { + throw new ConfigurationNotFoundError(directoryPath); + } + + return finalConfigArray; + } +} + +/** + * @fileoverview Compatibility class for flat config. + * @author Nicholas C. Zakas + */ + +const dirname = path__default["default"].dirname(url.fileURLToPath((typeof document === 'undefined' ? new ((__webpack_require__(876).URL))('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('eslintrc.cjs', document.baseURI).href)))); + +//----------------------------------------------------------------------------- +// Helpers +//----------------------------------------------------------------------------- + +/** @typedef {import("../../shared/types").Environment} Environment */ +/** @typedef {import("../../shared/types").Processor} Processor */ + +const debug = debugOrig__default["default"]("eslintrc:flat-compat"); +const cafactory = Symbol("cafactory"); + +/** + * Translates an ESLintRC-style config object into a flag-config-style config + * object. + * @param {Object} eslintrcConfig An ESLintRC-style config object. + * @param {Object} options Options to help translate the config. + * @param {string} options.resolveConfigRelativeTo To the directory to resolve + * configs from. + * @param {string} options.resolvePluginsRelativeTo The directory to resolve + * plugins from. + * @param {ReadOnlyMap} options.pluginEnvironments A map of plugin environment + * names to objects. + * @param {ReadOnlyMap} options.pluginProcessors A map of plugin processor + * names to objects. + * @returns {Object} A flag-config-style config object. + */ +function translateESLintRC(eslintrcConfig, { + resolveConfigRelativeTo, + resolvePluginsRelativeTo, + pluginEnvironments, + pluginProcessors +}) { + + const flatConfig = {}; + const configs = []; + const languageOptions = {}; + const linterOptions = {}; + const keysToCopy = ["settings", "rules", "processor"]; + const languageOptionsKeysToCopy = ["globals", "parser", "parserOptions"]; + const linterOptionsKeysToCopy = ["noInlineConfig", "reportUnusedDisableDirectives"]; + + // check for special settings for eslint:all and eslint:recommended: + if (eslintrcConfig.settings) { + if (eslintrcConfig.settings["eslint:all"] === true) { + return ["eslint:all"]; + } + + if (eslintrcConfig.settings["eslint:recommended"] === true) { + return ["eslint:recommended"]; + } + } + + // copy over simple translations + for (const key of keysToCopy) { + if (key in eslintrcConfig && typeof eslintrcConfig[key] !== "undefined") { + flatConfig[key] = eslintrcConfig[key]; + } + } + + // copy over languageOptions + for (const key of languageOptionsKeysToCopy) { + if (key in eslintrcConfig && typeof eslintrcConfig[key] !== "undefined") { + + // create the languageOptions key in the flat config + flatConfig.languageOptions = languageOptions; + + if (key === "parser") { + debug(`Resolving parser '${languageOptions[key]}' relative to ${resolveConfigRelativeTo}`); + + if (eslintrcConfig[key].error) { + throw eslintrcConfig[key].error; + } + + languageOptions[key] = eslintrcConfig[key].definition; + continue; + } + + // clone any object values that are in the eslintrc config + if (eslintrcConfig[key] && typeof eslintrcConfig[key] === "object") { + languageOptions[key] = { + ...eslintrcConfig[key] + }; + } else { + languageOptions[key] = eslintrcConfig[key]; + } + } + } + + // copy over linterOptions + for (const key of linterOptionsKeysToCopy) { + if (key in eslintrcConfig && typeof eslintrcConfig[key] !== "undefined") { + flatConfig.linterOptions = linterOptions; + linterOptions[key] = eslintrcConfig[key]; + } + } + + // move ecmaVersion a level up + if (languageOptions.parserOptions) { + + if ("ecmaVersion" in languageOptions.parserOptions) { + languageOptions.ecmaVersion = languageOptions.parserOptions.ecmaVersion; + delete languageOptions.parserOptions.ecmaVersion; + } + + if ("sourceType" in languageOptions.parserOptions) { + languageOptions.sourceType = languageOptions.parserOptions.sourceType; + delete languageOptions.parserOptions.sourceType; + } + + // check to see if we even need parserOptions anymore and remove it if not + if (Object.keys(languageOptions.parserOptions).length === 0) { + delete languageOptions.parserOptions; + } + } + + // overrides + if (eslintrcConfig.criteria) { + flatConfig.files = [absoluteFilePath => eslintrcConfig.criteria.test(absoluteFilePath)]; + } + + // translate plugins + if (eslintrcConfig.plugins && typeof eslintrcConfig.plugins === "object") { + debug(`Translating plugins: ${eslintrcConfig.plugins}`); + + flatConfig.plugins = {}; + + for (const pluginName of Object.keys(eslintrcConfig.plugins)) { + + debug(`Translating plugin: ${pluginName}`); + debug(`Resolving plugin '${pluginName} relative to ${resolvePluginsRelativeTo}`); + + const { definition: plugin, error } = eslintrcConfig.plugins[pluginName]; + + if (error) { + throw error; + } + + flatConfig.plugins[pluginName] = plugin; + + // create a config for any processors + if (plugin.processors) { + for (const processorName of Object.keys(plugin.processors)) { + if (processorName.startsWith(".")) { + debug(`Assigning processor: ${pluginName}/${processorName}`); + + configs.unshift({ + files: [`**/*${processorName}`], + processor: pluginProcessors.get(`${pluginName}/${processorName}`) + }); + } + + } + } + } + } + + // translate env - must come after plugins + if (eslintrcConfig.env && typeof eslintrcConfig.env === "object") { + for (const envName of Object.keys(eslintrcConfig.env)) { + + // only add environments that are true + if (eslintrcConfig.env[envName]) { + debug(`Translating environment: ${envName}`); + + if (environments.has(envName)) { + + // built-in environments should be defined first + configs.unshift(...translateESLintRC(environments.get(envName), { + resolveConfigRelativeTo, + resolvePluginsRelativeTo + })); + } else if (pluginEnvironments.has(envName)) { + + // if the environment comes from a plugin, it should come after the plugin config + configs.push(...translateESLintRC(pluginEnvironments.get(envName), { + resolveConfigRelativeTo, + resolvePluginsRelativeTo + })); + } + } + } + } + + // only add if there are actually keys in the config + if (Object.keys(flatConfig).length > 0) { + configs.push(flatConfig); + } + + return configs; +} + + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +/** + * A compatibility class for working with configs. + */ +class FlatCompat { + + constructor({ + baseDirectory = process.cwd(), + resolvePluginsRelativeTo = baseDirectory + } = {}) { + this.baseDirectory = baseDirectory; + this.resolvePluginsRelativeTo = resolvePluginsRelativeTo; + this[cafactory] = new ConfigArrayFactory({ + cwd: baseDirectory, + resolvePluginsRelativeTo, + eslintAllPath: path__default["default"].resolve(dirname, "../conf/eslint-all.cjs"), + eslintRecommendedPath: path__default["default"].resolve(dirname, "../conf/eslint-recommended.cjs") + }); + } + + /** + * Translates an ESLintRC-style config into a flag-config-style config. + * @param {Object} eslintrcConfig The ESLintRC-style config object. + * @returns {Object} A flag-config-style config object. + */ + config(eslintrcConfig) { + const eslintrcArray = this[cafactory].create(eslintrcConfig, { + basePath: this.baseDirectory + }); + + const flatArray = []; + let hasIgnorePatterns = false; + + eslintrcArray.forEach(configData => { + if (configData.type === "config") { + hasIgnorePatterns = hasIgnorePatterns || configData.ignorePattern; + flatArray.push(...translateESLintRC(configData, { + resolveConfigRelativeTo: path__default["default"].join(this.baseDirectory, "__placeholder.js"), + resolvePluginsRelativeTo: path__default["default"].join(this.resolvePluginsRelativeTo, "__placeholder.js"), + pluginEnvironments: eslintrcArray.pluginEnvironments, + pluginProcessors: eslintrcArray.pluginProcessors + })); + } + }); + + // combine ignorePatterns to emulate ESLintRC behavior better + if (hasIgnorePatterns) { + flatArray.unshift({ + ignores: [filePath => { + + // Compute the final config for this file. + // This filters config array elements by `files`/`excludedFiles` then merges the elements. + const finalConfig = eslintrcArray.extractConfig(filePath); + + // Test the `ignorePattern` properties of the final config. + return Boolean(finalConfig.ignores) && finalConfig.ignores(filePath); + }] + }); + } + + return flatArray; + } + + /** + * Translates the `env` section of an ESLintRC-style config. + * @param {Object} envConfig The `env` section of an ESLintRC config. + * @returns {Object} A flag-config object representing the environments. + */ + env(envConfig) { + return this.config({ + env: envConfig + }); + } + + /** + * Translates the `extends` section of an ESLintRC-style config. + * @param {...string} configsToExtend The names of the configs to load. + * @returns {Object} A flag-config object representing the config. + */ + extends(...configsToExtend) { + return this.config({ + extends: configsToExtend + }); + } + + /** + * Translates the `plugins` section of an ESLintRC-style config. + * @param {...string} plugins The names of the plugins to load. + * @returns {Object} A flag-config object representing the plugins. + */ + plugins(...plugins) { + return this.config({ + plugins + }); + } +} + +/** + * @fileoverview Package exports for @eslint/eslintrc + * @author Nicholas C. Zakas + */ + +//----------------------------------------------------------------------------- +// Exports +//----------------------------------------------------------------------------- + +const Legacy = { + ConfigArray, + createConfigArrayFactoryContext: createContext, + CascadingConfigArrayFactory, + ConfigArrayFactory, + ConfigDependency, + ExtractedConfig, + IgnorePattern, + OverrideTester, + getUsedExtractedConfigs, + environments, + + // shared + ConfigOps, + ConfigValidator, + ModuleResolver, + naming }; +exports.FlatCompat = FlatCompat; +exports.Legacy = Legacy; +//# sourceMappingURL=eslintrc.cjs.map + + /***/ }), /* 864 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { @@ -119123,7 +124959,7 @@ module.exports = { "use strict"; -const path = __webpack_require__(405); +const path = __webpack_require__(429); const resolveFrom = __webpack_require__(865); @@ -119163,19 +124999,19 @@ module.exports = moduleId => { "use strict"; -const path = __webpack_require__(405); +const path = __webpack_require__(429); const Module = __webpack_require__(866); -const fs = __webpack_require__(860); +const fs = __webpack_require__(861); const resolveFrom = (fromDir, moduleId, silent) => { if (typeof fromDir !== 'string') { - throw new TypeError(`Expected \`fromDir\` to be of type \`string\`, got \`${typeof fromDir}\``); + throw new TypeError("Expected `fromDir` to be of type `string`, got `".concat(typeof fromDir, "`")); } if (typeof moduleId !== 'string') { - throw new TypeError(`Expected \`moduleId\` to be of type \`string\`, got \`${typeof moduleId}\``); + throw new TypeError("Expected `moduleId` to be of type `string`, got `".concat(typeof moduleId, "`")); } try { @@ -119282,7 +125118,7 @@ const callsites = () => { module.exports = callsites; // TODO: Remove this for the next major release -module.exports.default = callsites; +module.exports["default"] = callsites; /***/ }), /* 869 */ @@ -119324,9 +125160,11 @@ const isEscaped = (jsonString, quotePosition) => { return Boolean(backslashCount % 2); }; -module.exports = (jsonString, options = {}) => { +module.exports = function (jsonString) { + let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + if (typeof jsonString !== 'string') { - throw new TypeError(`Expected argument \`jsonString\` to be a \`string\`, got \`${typeof jsonString}\``); + throw new TypeError("Expected argument `jsonString` to be a `string`, got `".concat(typeof jsonString, "`")); } const strip = options.whitespace === false ? stripWithoutWhitespace : stripWithWhitespace; @@ -119386,1543 +125224,9 @@ module.exports = (jsonString, options = {}) => { /***/ }), /* 871 */ -/***/ ((module) => { - -"use strict"; -/** - * @fileoverview Common helpers for naming of plugins, formatters and configs - */ - - -const NAMESPACE_REGEX = /^@.*\//iu; -/** - * Brings package name to correct format based on prefix - * @param {string} name The name of the package. - * @param {string} prefix Can be either "eslint-plugin", "eslint-config" or "eslint-formatter" - * @returns {string} Normalized name of the package - * @private - */ - -function normalizePackageName(name, prefix) { - let normalizedName = name; - /** - * On Windows, name can come in with Windows slashes instead of Unix slashes. - * Normalize to Unix first to avoid errors later on. - * https://github.com/eslint/eslint/issues/5644 - */ - - if (normalizedName.includes("\\")) { - normalizedName = normalizedName.replace(/\\/gu, "/"); - } - - if (normalizedName.charAt(0) === "@") { - /** - * it's a scoped package - * package name is the prefix, or just a username - */ - const scopedPackageShortcutRegex = new RegExp(`^(@[^/]+)(?:/(?:${prefix})?)?$`, "u"), - scopedPackageNameRegex = new RegExp(`^${prefix}(-|$)`, "u"); - - if (scopedPackageShortcutRegex.test(normalizedName)) { - normalizedName = normalizedName.replace(scopedPackageShortcutRegex, `$1/${prefix}`); - } else if (!scopedPackageNameRegex.test(normalizedName.split("/")[1])) { - /** - * for scoped packages, insert the prefix after the first / unless - * the path is already @scope/eslint or @scope/eslint-xxx-yyy - */ - normalizedName = normalizedName.replace(/^@([^/]+)\/(.*)$/u, `@$1/${prefix}-$2`); - } - } else if (!normalizedName.startsWith(`${prefix}-`)) { - normalizedName = `${prefix}-${normalizedName}`; - } - - return normalizedName; -} -/** - * Removes the prefix from a fullname. - * @param {string} fullname The term which may have the prefix. - * @param {string} prefix The prefix to remove. - * @returns {string} The term without prefix. - */ - - -function getShorthandName(fullname, prefix) { - if (fullname[0] === "@") { - let matchResult = new RegExp(`^(@[^/]+)/${prefix}$`, "u").exec(fullname); - - if (matchResult) { - return matchResult[1]; - } - - matchResult = new RegExp(`^(@[^/]+)/${prefix}-(.+)$`, "u").exec(fullname); - - if (matchResult) { - return `${matchResult[1]}/${matchResult[2]}`; - } - } else if (fullname.startsWith(`${prefix}-`)) { - return fullname.slice(prefix.length + 1); - } - - return fullname; -} -/** - * Gets the scope (namespace) of a term. - * @param {string} term The term which may have the namespace. - * @returns {string} The namespace of the term if it has one. - */ - - -function getNamespaceFromTerm(term) { - const match = term.match(NAMESPACE_REGEX); - return match ? match[0] : ""; -} //------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - - -module.exports = { - normalizePackageName, - getShorthandName, - getNamespaceFromTerm -}; - -/***/ }), -/* 872 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -"use strict"; -/** - * Utility for resolving a module relative to another module - * @author Teddy Katz - */ - - -const Module = __webpack_require__(866); -/* - * `Module.createRequire` is added in v12.2.0. It supports URL as well. - * We only support the case where the argument is a filepath, not a URL. - */ -// eslint-disable-next-line node/no-unsupported-features/node-builtins, node/no-deprecated-api - - -const createRequire = Module.createRequire || Module.createRequireFromPath; -module.exports = { - /** - * Resolves a Node module relative to another module - * @param {string} moduleName The name of a Node module, or a path to a Node module. - * @param {string} relativeToPath An absolute path indicating the module that `moduleName` should be resolved relative to. This must be - * a file rather than a directory, but the file need not actually exist. - * @returns {string} The absolute path that would result from calling `require.resolve(moduleName)` in a file located at `relativeToPath` - */ - resolve(moduleName, relativeToPath) { - try { - return createRequire(relativeToPath).resolve(moduleName); - } catch (error) { - // This `if` block is for older Node.js than 12.0.0. We can remove this block in the future. - if (typeof error === "object" && error !== null && error.code === "MODULE_NOT_FOUND" && !error.requireStack && error.message.includes(moduleName)) { - error.message += `\nRequire stack:\n- ${relativeToPath}`; - } - - throw error; - } - } - -}; - -/***/ }), -/* 873 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; -/** - * @fileoverview `ConfigArray` class. - * @author Toru Nagashima - */ - - -const { - ConfigArray, - getUsedExtractedConfigs -} = __webpack_require__(874); - -const { - ConfigDependency -} = __webpack_require__(877); - -const { - ExtractedConfig -} = __webpack_require__(875); - -const { - IgnorePattern -} = __webpack_require__(876); - -const { - OverrideTester -} = __webpack_require__(878); - -module.exports = { - ConfigArray, - ConfigDependency, - ExtractedConfig, - IgnorePattern, - OverrideTester, - getUsedExtractedConfigs -}; - -/***/ }), -/* 874 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; -/** - * @fileoverview `ConfigArray` class. - * - * `ConfigArray` class expresses the full of a configuration. It has the entry - * config file, base config files that were extended, loaded parsers, and loaded - * plugins. - * - * `ConfigArray` class provides three properties and two methods. - * - * - `pluginEnvironments` - * - `pluginProcessors` - * - `pluginRules` - * The `Map` objects that contain the members of all plugins that this - * config array contains. Those map objects don't have mutation methods. - * Those keys are the member ID such as `pluginId/memberName`. - * - `isRoot()` - * If `true` then this configuration has `root:true` property. - * - `extractConfig(filePath)` - * Extract the final configuration for a given file. This means merging - * every config array element which that `criteria` property matched. The - * `filePath` argument must be an absolute path. - * - * `ConfigArrayFactory` provides the loading logic of config files. - * - * @author Toru Nagashima - */ - //------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const { - ExtractedConfig -} = __webpack_require__(875); - -const { - IgnorePattern -} = __webpack_require__(876); //------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ -// Define types for VSCode IntelliSense. - -/** @typedef {import("../../shared/types").Environment} Environment */ - -/** @typedef {import("../../shared/types").GlobalConf} GlobalConf */ - -/** @typedef {import("../../shared/types").RuleConf} RuleConf */ - -/** @typedef {import("../../shared/types").Rule} Rule */ - -/** @typedef {import("../../shared/types").Plugin} Plugin */ - -/** @typedef {import("../../shared/types").Processor} Processor */ - -/** @typedef {import("./config-dependency").DependentParser} DependentParser */ - -/** @typedef {import("./config-dependency").DependentPlugin} DependentPlugin */ - -/** @typedef {import("./override-tester")["OverrideTester"]} OverrideTester */ - -/** - * @typedef {Object} ConfigArrayElement - * @property {string} name The name of this config element. - * @property {string} filePath The path to the source file of this config element. - * @property {InstanceType|null} criteria The tester for the `files` and `excludedFiles` of this config element. - * @property {Record|undefined} env The environment settings. - * @property {Record|undefined} globals The global variable settings. - * @property {IgnorePattern|undefined} ignorePattern The ignore patterns. - * @property {boolean|undefined} noInlineConfig The flag that disables directive comments. - * @property {DependentParser|undefined} parser The parser loader. - * @property {Object|undefined} parserOptions The parser options. - * @property {Record|undefined} plugins The plugin loaders. - * @property {string|undefined} processor The processor name to refer plugin's processor. - * @property {boolean|undefined} reportUnusedDisableDirectives The flag to report unused `eslint-disable` comments. - * @property {boolean|undefined} root The flag to express root. - * @property {Record|undefined} rules The rule settings - * @property {Object|undefined} settings The shared settings. - * @property {"config" | "ignore" | "implicit-processor"} type The element type. - */ - -/** - * @typedef {Object} ConfigArrayInternalSlots - * @property {Map} cache The cache to extract configs. - * @property {ReadonlyMap|null} envMap The map from environment ID to environment definition. - * @property {ReadonlyMap|null} processorMap The map from processor ID to environment definition. - * @property {ReadonlyMap|null} ruleMap The map from rule ID to rule definition. - */ - -/** @type {WeakMap} */ - - -const internalSlotsMap = new class extends WeakMap { - get(key) { - let value = super.get(key); - - if (!value) { - value = { - cache: new Map(), - envMap: null, - processorMap: null, - ruleMap: null - }; - super.set(key, value); - } - - return value; - } - -}(); -/** - * Get the indices which are matched to a given file. - * @param {ConfigArrayElement[]} elements The elements. - * @param {string} filePath The path to a target file. - * @returns {number[]} The indices. - */ - -function getMatchedIndices(elements, filePath) { - const indices = []; - - for (let i = elements.length - 1; i >= 0; --i) { - const element = elements[i]; - - if (!element.criteria || filePath && element.criteria.test(filePath)) { - indices.push(i); - } - } - - return indices; -} -/** - * Check if a value is a non-null object. - * @param {any} x The value to check. - * @returns {boolean} `true` if the value is a non-null object. - */ - - -function isNonNullObject(x) { - return typeof x === "object" && x !== null; -} -/** - * Merge two objects. - * - * Assign every property values of `y` to `x` if `x` doesn't have the property. - * If `x`'s property value is an object, it does recursive. - * @param {Object} target The destination to merge - * @param {Object|undefined} source The source to merge. - * @returns {void} - */ - - -function mergeWithoutOverwrite(target, source) { - if (!isNonNullObject(source)) { - return; - } - - for (const key of Object.keys(source)) { - if (key === "__proto__") { - continue; - } - - if (isNonNullObject(target[key])) { - mergeWithoutOverwrite(target[key], source[key]); - } else if (target[key] === void 0) { - if (isNonNullObject(source[key])) { - target[key] = Array.isArray(source[key]) ? [] : {}; - mergeWithoutOverwrite(target[key], source[key]); - } else if (source[key] !== void 0) { - target[key] = source[key]; - } - } - } -} -/** - * The error for plugin conflicts. - */ - - -class PluginConflictError extends Error { - /** - * Initialize this error object. - * @param {string} pluginId The plugin ID. - * @param {{filePath:string, importerName:string}[]} plugins The resolved plugins. - */ - constructor(pluginId, plugins) { - super(`Plugin "${pluginId}" was conflicted between ${plugins.map(p => `"${p.importerName}"`).join(" and ")}.`); - this.messageTemplate = "plugin-conflict"; - this.messageData = { - pluginId, - plugins - }; - } - -} -/** - * Merge plugins. - * `target`'s definition is prior to `source`'s. - * @param {Record} target The destination to merge - * @param {Record|undefined} source The source to merge. - * @returns {void} - */ - - -function mergePlugins(target, source) { - if (!isNonNullObject(source)) { - return; - } - - for (const key of Object.keys(source)) { - if (key === "__proto__") { - continue; - } - - const targetValue = target[key]; - const sourceValue = source[key]; // Adopt the plugin which was found at first. - - if (targetValue === void 0) { - if (sourceValue.error) { - throw sourceValue.error; - } - - target[key] = sourceValue; - } else if (sourceValue.filePath !== targetValue.filePath) { - throw new PluginConflictError(key, [{ - filePath: targetValue.filePath, - importerName: targetValue.importerName - }, { - filePath: sourceValue.filePath, - importerName: sourceValue.importerName - }]); - } - } -} -/** - * Merge rule configs. - * `target`'s definition is prior to `source`'s. - * @param {Record} target The destination to merge - * @param {Record|undefined} source The source to merge. - * @returns {void} - */ - - -function mergeRuleConfigs(target, source) { - if (!isNonNullObject(source)) { - return; - } - - for (const key of Object.keys(source)) { - if (key === "__proto__") { - continue; - } - - const targetDef = target[key]; - const sourceDef = source[key]; // Adopt the rule config which was found at first. - - if (targetDef === void 0) { - if (Array.isArray(sourceDef)) { - target[key] = [...sourceDef]; - } else { - target[key] = [sourceDef]; - } - /* - * If the first found rule config is severity only and the current rule - * config has options, merge the severity and the options. - */ - - } else if (targetDef.length === 1 && Array.isArray(sourceDef) && sourceDef.length >= 2) { - targetDef.push(...sourceDef.slice(1)); - } - } -} -/** - * Create the extracted config. - * @param {ConfigArray} instance The config elements. - * @param {number[]} indices The indices to use. - * @returns {ExtractedConfig} The extracted config. - */ - - -function createConfig(instance, indices) { - const config = new ExtractedConfig(); - const ignorePatterns = []; // Merge elements. - - for (const index of indices) { - const element = instance[index]; // Adopt the parser which was found at first. - - if (!config.parser && element.parser) { - if (element.parser.error) { - throw element.parser.error; - } - - config.parser = element.parser; - } // Adopt the processor which was found at first. - - - if (!config.processor && element.processor) { - config.processor = element.processor; - } // Adopt the noInlineConfig which was found at first. - - - if (config.noInlineConfig === void 0 && element.noInlineConfig !== void 0) { - config.noInlineConfig = element.noInlineConfig; - config.configNameOfNoInlineConfig = element.name; - } // Adopt the reportUnusedDisableDirectives which was found at first. - - - if (config.reportUnusedDisableDirectives === void 0 && element.reportUnusedDisableDirectives !== void 0) { - config.reportUnusedDisableDirectives = element.reportUnusedDisableDirectives; - } // Collect ignorePatterns - - - if (element.ignorePattern) { - ignorePatterns.push(element.ignorePattern); - } // Merge others. - - - mergeWithoutOverwrite(config.env, element.env); - mergeWithoutOverwrite(config.globals, element.globals); - mergeWithoutOverwrite(config.parserOptions, element.parserOptions); - mergeWithoutOverwrite(config.settings, element.settings); - mergePlugins(config.plugins, element.plugins); - mergeRuleConfigs(config.rules, element.rules); - } // Create the predicate function for ignore patterns. - - - if (ignorePatterns.length > 0) { - config.ignores = IgnorePattern.createIgnore(ignorePatterns.reverse()); - } - - return config; -} -/** - * Collect definitions. - * @template T, U - * @param {string} pluginId The plugin ID for prefix. - * @param {Record} defs The definitions to collect. - * @param {Map} map The map to output. - * @param {function(T): U} [normalize] The normalize function for each value. - * @returns {void} - */ - - -function collect(pluginId, defs, map, normalize) { - if (defs) { - const prefix = pluginId && `${pluginId}/`; - - for (const [key, value] of Object.entries(defs)) { - map.set(`${prefix}${key}`, normalize ? normalize(value) : value); - } - } -} -/** - * Normalize a rule definition. - * @param {Function|Rule} rule The rule definition to normalize. - * @returns {Rule} The normalized rule definition. - */ - - -function normalizePluginRule(rule) { - return typeof rule === "function" ? { - create: rule - } : rule; -} -/** - * Delete the mutation methods from a given map. - * @param {Map} map The map object to delete. - * @returns {void} - */ - - -function deleteMutationMethods(map) { - Object.defineProperties(map, { - clear: { - configurable: true, - value: void 0 - }, - delete: { - configurable: true, - value: void 0 - }, - set: { - configurable: true, - value: void 0 - } - }); -} -/** - * Create `envMap`, `processorMap`, `ruleMap` with the plugins in the config array. - * @param {ConfigArrayElement[]} elements The config elements. - * @param {ConfigArrayInternalSlots} slots The internal slots. - * @returns {void} - */ - - -function initPluginMemberMaps(elements, slots) { - const processed = new Set(); - slots.envMap = new Map(); - slots.processorMap = new Map(); - slots.ruleMap = new Map(); - - for (const element of elements) { - if (!element.plugins) { - continue; - } - - for (const [pluginId, value] of Object.entries(element.plugins)) { - const plugin = value.definition; - - if (!plugin || processed.has(pluginId)) { - continue; - } - - processed.add(pluginId); - collect(pluginId, plugin.environments, slots.envMap); - collect(pluginId, plugin.processors, slots.processorMap); - collect(pluginId, plugin.rules, slots.ruleMap, normalizePluginRule); - } - } - - deleteMutationMethods(slots.envMap); - deleteMutationMethods(slots.processorMap); - deleteMutationMethods(slots.ruleMap); -} -/** - * Create `envMap`, `processorMap`, `ruleMap` with the plugins in the config array. - * @param {ConfigArray} instance The config elements. - * @returns {ConfigArrayInternalSlots} The extracted config. - */ - - -function ensurePluginMemberMaps(instance) { - const slots = internalSlotsMap.get(instance); - - if (!slots.ruleMap) { - initPluginMemberMaps(instance, slots); - } - - return slots; -} //------------------------------------------------------------------------------ -// Public Interface -//------------------------------------------------------------------------------ - -/** - * The Config Array. - * - * `ConfigArray` instance contains all settings, parsers, and plugins. - * You need to call `ConfigArray#extractConfig(filePath)` method in order to - * extract, merge and get only the config data which is related to an arbitrary - * file. - * @extends {Array} - */ - - -class ConfigArray extends Array { - /** - * Get the plugin environments. - * The returned map cannot be mutated. - * @type {ReadonlyMap} The plugin environments. - */ - get pluginEnvironments() { - return ensurePluginMemberMaps(this).envMap; - } - /** - * Get the plugin processors. - * The returned map cannot be mutated. - * @type {ReadonlyMap} The plugin processors. - */ - - - get pluginProcessors() { - return ensurePluginMemberMaps(this).processorMap; - } - /** - * Get the plugin rules. - * The returned map cannot be mutated. - * @returns {ReadonlyMap} The plugin rules. - */ - - - get pluginRules() { - return ensurePluginMemberMaps(this).ruleMap; - } - /** - * Check if this config has `root` flag. - * @returns {boolean} `true` if this config array is root. - */ - - - isRoot() { - for (let i = this.length - 1; i >= 0; --i) { - const root = this[i].root; - - if (typeof root === "boolean") { - return root; - } - } - - return false; - } - /** - * Extract the config data which is related to a given file. - * @param {string} filePath The absolute path to the target file. - * @returns {ExtractedConfig} The extracted config data. - */ - - - extractConfig(filePath) { - const { - cache - } = internalSlotsMap.get(this); - const indices = getMatchedIndices(this, filePath); - const cacheKey = indices.join(","); - - if (!cache.has(cacheKey)) { - cache.set(cacheKey, createConfig(this, indices)); - } - - return cache.get(cacheKey); - } - /** - * Check if a given path is an additional lint target. - * @param {string} filePath The absolute path to the target file. - * @returns {boolean} `true` if the file is an additional lint target. - */ - - - isAdditionalTargetPath(filePath) { - for (const { - criteria, - type - } of this) { - if (type === "config" && criteria && !criteria.endsWithWildcard && criteria.test(filePath)) { - return true; - } - } - - return false; - } - -} - -const exportObject = { - ConfigArray, - - /** - * Get the used extracted configs. - * CLIEngine will use this method to collect used deprecated rules. - * @param {ConfigArray} instance The config array object to get. - * @returns {ExtractedConfig[]} The used extracted configs. - * @private - */ - getUsedExtractedConfigs(instance) { - const { - cache - } = internalSlotsMap.get(instance); - return Array.from(cache.values()); - } - -}; -module.exports = exportObject; - -/***/ }), -/* 875 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; -/** - * @fileoverview `ExtractedConfig` class. - * - * `ExtractedConfig` class expresses a final configuration for a specific file. - * - * It provides one method. - * - * - `toCompatibleObjectAsConfigFileContent()` - * Convert this configuration to the compatible object as the content of - * config files. It converts the loaded parser and plugins to strings. - * `CLIEngine#getConfigForFile(filePath)` method uses this method. - * - * `ConfigArray#extractConfig(filePath)` creates a `ExtractedConfig` instance. - * - * @author Toru Nagashima - */ - - -const { - IgnorePattern -} = __webpack_require__(876); // For VSCode intellisense - -/** @typedef {import("../../shared/types").ConfigData} ConfigData */ - -/** @typedef {import("../../shared/types").GlobalConf} GlobalConf */ - -/** @typedef {import("../../shared/types").SeverityConf} SeverityConf */ - -/** @typedef {import("./config-dependency").DependentParser} DependentParser */ - -/** @typedef {import("./config-dependency").DependentPlugin} DependentPlugin */ - -/** - * Check if `xs` starts with `ys`. - * @template T - * @param {T[]} xs The array to check. - * @param {T[]} ys The array that may be the first part of `xs`. - * @returns {boolean} `true` if `xs` starts with `ys`. - */ - - -function startsWith(xs, ys) { - return xs.length >= ys.length && ys.every((y, i) => y === xs[i]); -} -/** - * The class for extracted config data. - */ - - -class ExtractedConfig { - constructor() { - /** - * The config name what `noInlineConfig` setting came from. - * @type {string} - */ - this.configNameOfNoInlineConfig = ""; - /** - * Environments. - * @type {Record} - */ - - this.env = {}; - /** - * Global variables. - * @type {Record} - */ - - this.globals = {}; - /** - * The glob patterns that ignore to lint. - * @type {(((filePath:string, dot?:boolean) => boolean) & { basePath:string; patterns:string[] }) | undefined} - */ - - this.ignores = void 0; - /** - * The flag that disables directive comments. - * @type {boolean|undefined} - */ - - this.noInlineConfig = void 0; - /** - * Parser definition. - * @type {DependentParser|null} - */ - - this.parser = null; - /** - * Options for the parser. - * @type {Object} - */ - - this.parserOptions = {}; - /** - * Plugin definitions. - * @type {Record} - */ - - this.plugins = {}; - /** - * Processor ID. - * @type {string|null} - */ - - this.processor = null; - /** - * The flag that reports unused `eslint-disable` directive comments. - * @type {boolean|undefined} - */ - - this.reportUnusedDisableDirectives = void 0; - /** - * Rule settings. - * @type {Record} - */ - - this.rules = {}; - /** - * Shared settings. - * @type {Object} - */ - - this.settings = {}; - } - /** - * Convert this config to the compatible object as a config file content. - * @returns {ConfigData} The converted object. - */ - - - toCompatibleObjectAsConfigFileContent() { - const { - /* eslint-disable no-unused-vars */ - configNameOfNoInlineConfig: _ignore1, - processor: _ignore2, - - /* eslint-enable no-unused-vars */ - ignores, - ...config - } = this; - config.parser = config.parser && config.parser.filePath; - config.plugins = Object.keys(config.plugins).filter(Boolean).reverse(); - config.ignorePatterns = ignores ? ignores.patterns : []; // Strip the default patterns from `ignorePatterns`. - - if (startsWith(config.ignorePatterns, IgnorePattern.DefaultPatterns)) { - config.ignorePatterns = config.ignorePatterns.slice(IgnorePattern.DefaultPatterns.length); - } - - return config; - } - -} - -module.exports = { - ExtractedConfig -}; - -/***/ }), -/* 876 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; -/* provided dependency */ var process = __webpack_require__(445); -/** - * @fileoverview `IgnorePattern` class. - * - * `IgnorePattern` class has the set of glob patterns and the base path. - * - * It provides two static methods. - * - * - `IgnorePattern.createDefaultIgnore(cwd)` - * Create the default predicate function. - * - `IgnorePattern.createIgnore(ignorePatterns)` - * Create the predicate function from multiple `IgnorePattern` objects. - * - * It provides two properties and a method. - * - * - `patterns` - * The glob patterns that ignore to lint. - * - `basePath` - * The base path of the glob patterns. If absolute paths existed in the - * glob patterns, those are handled as relative paths to the base path. - * - `getPatternsRelativeTo(basePath)` - * Get `patterns` as modified for a given base path. It modifies the - * absolute paths in the patterns as prepending the difference of two base - * paths. - * - * `ConfigArrayFactory` creates `IgnorePattern` objects when it processes - * `ignorePatterns` properties. - * - * @author Toru Nagashima - */ - //------------------------------------------------------------------------------ -// Requirements -//------------------------------------------------------------------------------ - -const assert = __webpack_require__(407); - -const path = __webpack_require__(405); - -const ignore = __webpack_require__(737); - -const debug = __webpack_require__(496)("eslintrc:ignore-pattern"); -/** @typedef {ReturnType} Ignore */ -//------------------------------------------------------------------------------ -// Helpers -//------------------------------------------------------------------------------ - -/** - * Get the path to the common ancestor directory of given paths. - * @param {string[]} sourcePaths The paths to calculate the common ancestor. - * @returns {string} The path to the common ancestor directory. - */ - - -function getCommonAncestorPath(sourcePaths) { - let result = sourcePaths[0]; - - for (let i = 1; i < sourcePaths.length; ++i) { - const a = result; - const b = sourcePaths[i]; // Set the shorter one (it's the common ancestor if one includes the other). - - result = a.length < b.length ? a : b; // Set the common ancestor. - - for (let j = 0, lastSepPos = 0; j < a.length && j < b.length; ++j) { - if (a[j] !== b[j]) { - result = a.slice(0, lastSepPos); - break; - } - - if (a[j] === path.sep) { - lastSepPos = j; - } - } - } - - let resolvedResult = result || path.sep; // if Windows common ancestor is root of drive must have trailing slash to be absolute. - - if (resolvedResult && resolvedResult.endsWith(":") && process.platform === "win32") { - resolvedResult += path.sep; - } - - return resolvedResult; -} -/** - * Make relative path. - * @param {string} from The source path to get relative path. - * @param {string} to The destination path to get relative path. - * @returns {string} The relative path. - */ - - -function relative(from, to) { - const relPath = path.relative(from, to); - - if (path.sep === "/") { - return relPath; - } - - return relPath.split(path.sep).join("/"); -} -/** - * Get the trailing slash if existed. - * @param {string} filePath The path to check. - * @returns {string} The trailing slash if existed. - */ - - -function dirSuffix(filePath) { - const isDir = filePath.endsWith(path.sep) || process.platform === "win32" && filePath.endsWith("/"); - return isDir ? "/" : ""; -} - -const DefaultPatterns = Object.freeze(["/**/node_modules/*"]); -const DotPatterns = Object.freeze([".*", "!.eslintrc.*", "!../"]); //------------------------------------------------------------------------------ -// Public -//------------------------------------------------------------------------------ - -class IgnorePattern { - /** - * The default patterns. - * @type {string[]} - */ - static get DefaultPatterns() { - return DefaultPatterns; - } - /** - * Create the default predicate function. - * @param {string} cwd The current working directory. - * @returns {((filePath:string, dot:boolean) => boolean) & {basePath:string; patterns:string[]}} - * The preficate function. - * The first argument is an absolute path that is checked. - * The second argument is the flag to not ignore dotfiles. - * If the predicate function returned `true`, it means the path should be ignored. - */ - - - static createDefaultIgnore(cwd) { - return this.createIgnore([new IgnorePattern(DefaultPatterns, cwd)]); - } - /** - * Create the predicate function from multiple `IgnorePattern` objects. - * @param {IgnorePattern[]} ignorePatterns The list of ignore patterns. - * @returns {((filePath:string, dot?:boolean) => boolean) & {basePath:string; patterns:string[]}} - * The preficate function. - * The first argument is an absolute path that is checked. - * The second argument is the flag to not ignore dotfiles. - * If the predicate function returned `true`, it means the path should be ignored. - */ - - - static createIgnore(ignorePatterns) { - debug("Create with: %o", ignorePatterns); - const basePath = getCommonAncestorPath(ignorePatterns.map(p => p.basePath)); - const patterns = [].concat(...ignorePatterns.map(p => p.getPatternsRelativeTo(basePath))); - const ig = ignore().add([...DotPatterns, ...patterns]); - const dotIg = ignore().add(patterns); - debug(" processed: %o", { - basePath, - patterns - }); - return Object.assign((filePath, dot = false) => { - assert(path.isAbsolute(filePath), "'filePath' should be an absolute path."); - const relPathRaw = relative(basePath, filePath); - const relPath = relPathRaw && relPathRaw + dirSuffix(filePath); - const adoptedIg = dot ? dotIg : ig; - const result = relPath !== "" && adoptedIg.ignores(relPath); - debug("Check", { - filePath, - dot, - relativePath: relPath, - result - }); - return result; - }, { - basePath, - patterns - }); - } - /** - * Initialize a new `IgnorePattern` instance. - * @param {string[]} patterns The glob patterns that ignore to lint. - * @param {string} basePath The base path of `patterns`. - */ - - - constructor(patterns, basePath) { - assert(path.isAbsolute(basePath), "'basePath' should be an absolute path."); - /** - * The glob patterns that ignore to lint. - * @type {string[]} - */ - - this.patterns = patterns; - /** - * The base path of `patterns`. - * @type {string} - */ - - this.basePath = basePath; - /** - * If `true` then patterns which don't start with `/` will match the paths to the outside of `basePath`. Defaults to `false`. - * - * It's set `true` for `.eslintignore`, `package.json`, and `--ignore-path` for backward compatibility. - * It's `false` as-is for `ignorePatterns` property in config files. - * @type {boolean} - */ - - this.loose = false; - } - /** - * Get `patterns` as modified for a given base path. It modifies the - * absolute paths in the patterns as prepending the difference of two base - * paths. - * @param {string} newBasePath The base path. - * @returns {string[]} Modifired patterns. - */ - - - getPatternsRelativeTo(newBasePath) { - assert(path.isAbsolute(newBasePath), "'newBasePath' should be an absolute path."); - const { - basePath, - loose, - patterns - } = this; - - if (newBasePath === basePath) { - return patterns; - } - - const prefix = `/${relative(newBasePath, basePath)}`; - return patterns.map(pattern => { - const negative = pattern.startsWith("!"); - const head = negative ? "!" : ""; - const body = negative ? pattern.slice(1) : pattern; - - if (body.startsWith("/") || body.startsWith("../")) { - return `${head}${prefix}${body}`; - } - - return loose ? pattern : `${head}${prefix}/**/${body}`; - }); - } - -} - -module.exports = { - IgnorePattern -}; - -/***/ }), -/* 877 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; -/** - * @fileoverview `ConfigDependency` class. - * - * `ConfigDependency` class expresses a loaded parser or plugin. - * - * If the parser or plugin was loaded successfully, it has `definition` property - * and `filePath` property. Otherwise, it has `error` property. - * - * When `JSON.stringify()` converted a `ConfigDependency` object to a JSON, it - * omits `definition` property. - * - * `ConfigArrayFactory` creates `ConfigDependency` objects when it loads parsers - * or plugins. - * - * @author Toru Nagashima - */ - - -const util = __webpack_require__(442); -/** - * The class is to store parsers or plugins. - * This class hides the loaded object from `JSON.stringify()` and `console.log`. - * @template T - */ - - -class ConfigDependency { - /** - * Initialize this instance. - * @param {Object} data The dependency data. - * @param {T} [data.definition] The dependency if the loading succeeded. - * @param {Error} [data.error] The error object if the loading failed. - * @param {string} [data.filePath] The actual path to the dependency if the loading succeeded. - * @param {string} data.id The ID of this dependency. - * @param {string} data.importerName The name of the config file which loads this dependency. - * @param {string} data.importerPath The path to the config file which loads this dependency. - */ - constructor({ - definition = null, - error = null, - filePath = null, - id, - importerName, - importerPath - }) { - /** - * The loaded dependency if the loading succeeded. - * @type {T|null} - */ - this.definition = definition; - /** - * The error object if the loading failed. - * @type {Error|null} - */ - - this.error = error; - /** - * The loaded dependency if the loading succeeded. - * @type {string|null} - */ - - this.filePath = filePath; - /** - * The ID of this dependency. - * @type {string} - */ - - this.id = id; - /** - * The name of the config file which loads this dependency. - * @type {string} - */ - - this.importerName = importerName; - /** - * The path to the config file which loads this dependency. - * @type {string} - */ - - this.importerPath = importerPath; - } // eslint-disable-next-line jsdoc/require-description - - /** - * @returns {Object} a JSON compatible object. - */ - - - toJSON() { - const obj = this[util.inspect.custom](); // Display `error.message` (`Error#message` is unenumerable). - - if (obj.error instanceof Error) { - obj.error = { ...obj.error, - message: obj.error.message - }; - } - - return obj; - } // eslint-disable-next-line jsdoc/require-description - - /** - * @returns {Object} an object to display by `console.log()`. - */ - - - [util.inspect.custom]() { - const { - definition: _ignore, - // eslint-disable-line no-unused-vars - ...obj - } = this; - return obj; - } - -} -/** @typedef {ConfigDependency} DependentParser */ - -/** @typedef {ConfigDependency} DependentPlugin */ - - -module.exports = { - ConfigDependency -}; - -/***/ }), -/* 878 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; -/** - * @fileoverview `OverrideTester` class. - * - * `OverrideTester` class handles `files` property and `excludedFiles` property - * of `overrides` config. - * - * It provides one method. - * - * - `test(filePath)` - * Test if a file path matches the pair of `files` property and - * `excludedFiles` property. The `filePath` argument must be an absolute - * path. - * - * `ConfigArrayFactory` creates `OverrideTester` objects when it processes - * `overrides` properties. - * - * @author Toru Nagashima - */ - - -const assert = __webpack_require__(407); - -const path = __webpack_require__(405); - -const util = __webpack_require__(442); - -const { - Minimatch -} = __webpack_require__(879); - -const minimatchOpts = { - dot: true, - matchBase: true -}; -/** - * @typedef {Object} Pattern - * @property {InstanceType[] | null} includes The positive matchers. - * @property {InstanceType[] | null} excludes The negative matchers. - */ - -/** - * Normalize a given pattern to an array. - * @param {string|string[]|undefined} patterns A glob pattern or an array of glob patterns. - * @returns {string[]|null} Normalized patterns. - * @private - */ - -function normalizePatterns(patterns) { - if (Array.isArray(patterns)) { - return patterns.filter(Boolean); - } - - if (typeof patterns === "string" && patterns) { - return [patterns]; - } - - return []; -} -/** - * Create the matchers of given patterns. - * @param {string[]} patterns The patterns. - * @returns {InstanceType[] | null} The matchers. - */ - - -function toMatcher(patterns) { - if (patterns.length === 0) { - return null; - } - - return patterns.map(pattern => { - if (/^\.[/\\]/u.test(pattern)) { - return new Minimatch(pattern.slice(2), // `./*.js` should not match with `subdir/foo.js` - { ...minimatchOpts, - matchBase: false - }); - } - - return new Minimatch(pattern, minimatchOpts); - }); -} -/** - * Convert a given matcher to string. - * @param {Pattern} matchers The matchers. - * @returns {string} The string expression of the matcher. - */ - - -function patternToJson({ - includes, - excludes -}) { - return { - includes: includes && includes.map(m => m.pattern), - excludes: excludes && excludes.map(m => m.pattern) - }; -} -/** - * The class to test given paths are matched by the patterns. - */ - - -class OverrideTester { - /** - * Create a tester with given criteria. - * If there are no criteria, returns `null`. - * @param {string|string[]} files The glob patterns for included files. - * @param {string|string[]} excludedFiles The glob patterns for excluded files. - * @param {string} basePath The path to the base directory to test paths. - * @returns {OverrideTester|null} The created instance or `null`. - */ - static create(files, excludedFiles, basePath) { - const includePatterns = normalizePatterns(files); - const excludePatterns = normalizePatterns(excludedFiles); - let endsWithWildcard = false; - - if (includePatterns.length === 0) { - return null; - } // Rejects absolute paths or relative paths to parents. - - - for (const pattern of includePatterns) { - if (path.isAbsolute(pattern) || pattern.includes("..")) { - throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`); - } - - if (pattern.endsWith("*")) { - endsWithWildcard = true; - } - } - - for (const pattern of excludePatterns) { - if (path.isAbsolute(pattern) || pattern.includes("..")) { - throw new Error(`Invalid override pattern (expected relative path not containing '..'): ${pattern}`); - } - } - - const includes = toMatcher(includePatterns); - const excludes = toMatcher(excludePatterns); - return new OverrideTester([{ - includes, - excludes - }], basePath, endsWithWildcard); - } - /** - * Combine two testers by logical and. - * If either of the testers was `null`, returns the other tester. - * The `basePath` property of the two must be the same value. - * @param {OverrideTester|null} a A tester. - * @param {OverrideTester|null} b Another tester. - * @returns {OverrideTester|null} Combined tester. - */ - - - static and(a, b) { - if (!b) { - return a && new OverrideTester(a.patterns, a.basePath, a.endsWithWildcard); - } - - if (!a) { - return new OverrideTester(b.patterns, b.basePath, b.endsWithWildcard); - } - - assert.strictEqual(a.basePath, b.basePath); - return new OverrideTester(a.patterns.concat(b.patterns), a.basePath, a.endsWithWildcard || b.endsWithWildcard); - } - /** - * Initialize this instance. - * @param {Pattern[]} patterns The matchers. - * @param {string} basePath The base path. - * @param {boolean} endsWithWildcard If `true` then a pattern ends with `*`. - */ - - - constructor(patterns, basePath, endsWithWildcard = false) { - /** @type {Pattern[]} */ - this.patterns = patterns; - /** @type {string} */ - - this.basePath = basePath; - /** @type {boolean} */ - - this.endsWithWildcard = endsWithWildcard; - } - /** - * Test if a given path is matched or not. - * @param {string} filePath The absolute path to the target file. - * @returns {boolean} `true` if the path was matched. - */ - - - test(filePath) { - if (typeof filePath !== "string" || !path.isAbsolute(filePath)) { - throw new Error(`'filePath' should be an absolute path, but got ${filePath}.`); - } - - const relativePath = path.relative(this.basePath, filePath); - return this.patterns.every(({ - includes, - excludes - }) => (!includes || includes.some(m => m.match(relativePath))) && (!excludes || !excludes.some(m => m.match(relativePath)))); - } // eslint-disable-next-line jsdoc/require-description - - /** - * @returns {Object} a JSON compatible object. - */ - - - toJSON() { - if (this.patterns.length === 1) { - return { ...patternToJson(this.patterns[0]), - basePath: this.basePath - }; - } - - return { - AND: this.patterns.map(patternToJson), - basePath: this.basePath - }; - } // eslint-disable-next-line jsdoc/require-description - - /** - * @returns {Object} an object to display by `console.log()`. - */ - - - [util.inspect.custom]() { - return this.toJSON(); - } - -} - -module.exports = { - OverrideTester -}; - -/***/ }), -/* 879 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -/* provided dependency */ var console = __webpack_require__(493); +/* provided dependency */ var console = __webpack_require__(438); module.exports = minimatch; minimatch.Minimatch = Minimatch; var path = { @@ -120930,12 +125234,12 @@ var path = { }; try { - path = __webpack_require__(405); + path = __webpack_require__(429); } catch (er) {} var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}; -var expand = __webpack_require__(880); +var expand = __webpack_require__(872); var plTypes = { '!': { @@ -121828,12 +126132,12 @@ function regExpEscape(s) { } /***/ }), -/* 880 */ +/* 872 */ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { -var concatMap = __webpack_require__(881); +var concatMap = __webpack_require__(873); -var balanced = __webpack_require__(882); +var balanced = __webpack_require__(874); module.exports = expandTop; var escSlash = '\0SLASH' + Math.random() + '\0'; @@ -122013,7 +126317,7 @@ function expand(str, isTop) { } /***/ }), -/* 881 */ +/* 873 */ /***/ ((module) => { module.exports = function (xs, fn) { @@ -122032,7 +126336,7 @@ var isArray = Array.isArray || function (xs) { }; /***/ }), -/* 882 */ +/* 874 */ /***/ ((module) => { "use strict"; @@ -122103,13217 +126407,25 @@ function range(a, b, str) { } /***/ }), -/* 883 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var yaml = __webpack_require__(884); - -module.exports = yaml; - -/***/ }), -/* 884 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var loader = __webpack_require__(885); - -var dumper = __webpack_require__(914); - -function deprecated(name) { - return function () { - throw new Error('Function ' + name + ' is deprecated and cannot be used.'); - }; -} - -module.exports.Type = __webpack_require__(891); -module.exports.Schema = __webpack_require__(890); -module.exports.FAILSAFE_SCHEMA = __webpack_require__(894); -module.exports.JSON_SCHEMA = __webpack_require__(893); -module.exports.CORE_SCHEMA = __webpack_require__(892); -module.exports.DEFAULT_SAFE_SCHEMA = __webpack_require__(889); -module.exports.DEFAULT_FULL_SCHEMA = __webpack_require__(909); -module.exports.load = loader.load; -module.exports.loadAll = loader.loadAll; -module.exports.safeLoad = loader.safeLoad; -module.exports.safeLoadAll = loader.safeLoadAll; -module.exports.dump = dumper.dump; -module.exports.safeDump = dumper.safeDump; -module.exports.YAMLException = __webpack_require__(887); // Deprecated schema names from JS-YAML 2.0.x - -module.exports.MINIMAL_SCHEMA = __webpack_require__(894); -module.exports.SAFE_SCHEMA = __webpack_require__(889); -module.exports.DEFAULT_SCHEMA = __webpack_require__(909); // Deprecated functions from JS-YAML 1.x.x - -module.exports.scan = deprecated('scan'); -module.exports.parse = deprecated('parse'); -module.exports.compose = deprecated('compose'); -module.exports.addConstructor = deprecated('addConstructor'); - -/***/ }), -/* 885 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - -/*eslint-disable max-len,no-use-before-define*/ - -var common = __webpack_require__(886); - -var YAMLException = __webpack_require__(887); - -var Mark = __webpack_require__(888); - -var DEFAULT_SAFE_SCHEMA = __webpack_require__(889); - -var DEFAULT_FULL_SCHEMA = __webpack_require__(909); - -var _hasOwnProperty = Object.prototype.hasOwnProperty; -var CONTEXT_FLOW_IN = 1; -var CONTEXT_FLOW_OUT = 2; -var CONTEXT_BLOCK_IN = 3; -var CONTEXT_BLOCK_OUT = 4; -var CHOMPING_CLIP = 1; -var CHOMPING_STRIP = 2; -var CHOMPING_KEEP = 3; -var PATTERN_NON_PRINTABLE = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/; -var PATTERN_NON_ASCII_LINE_BREAKS = /[\x85\u2028\u2029]/; -var PATTERN_FLOW_INDICATORS = /[,\[\]\{\}]/; -var PATTERN_TAG_HANDLE = /^(?:!|!!|![a-z\-]+!)$/i; -var PATTERN_TAG_URI = /^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i; - -function _class(obj) { - return Object.prototype.toString.call(obj); -} - -function is_EOL(c) { - return c === 0x0A - /* LF */ - || c === 0x0D - /* CR */ - ; -} - -function is_WHITE_SPACE(c) { - return c === 0x09 - /* Tab */ - || c === 0x20 - /* Space */ - ; -} - -function is_WS_OR_EOL(c) { - return c === 0x09 - /* Tab */ - || c === 0x20 - /* Space */ - || c === 0x0A - /* LF */ - || c === 0x0D - /* CR */ - ; -} - -function is_FLOW_INDICATOR(c) { - return c === 0x2C - /* , */ - || c === 0x5B - /* [ */ - || c === 0x5D - /* ] */ - || c === 0x7B - /* { */ - || c === 0x7D - /* } */ - ; -} - -function fromHexCode(c) { - var lc; - - if (0x30 - /* 0 */ - <= c && c <= 0x39 - /* 9 */ - ) { - return c - 0x30; - } - /*eslint-disable no-bitwise*/ - - - lc = c | 0x20; - - if (0x61 - /* a */ - <= lc && lc <= 0x66 - /* f */ - ) { - return lc - 0x61 + 10; - } - - return -1; -} - -function escapedHexLen(c) { - if (c === 0x78 - /* x */ - ) { - return 2; - } - - if (c === 0x75 - /* u */ - ) { - return 4; - } - - if (c === 0x55 - /* U */ - ) { - return 8; - } - - return 0; -} - -function fromDecimalCode(c) { - if (0x30 - /* 0 */ - <= c && c <= 0x39 - /* 9 */ - ) { - return c - 0x30; - } - - return -1; -} - -function simpleEscapeSequence(c) { - /* eslint-disable indent */ - return c === 0x30 - /* 0 */ - ? '\x00' : c === 0x61 - /* a */ - ? '\x07' : c === 0x62 - /* b */ - ? '\x08' : c === 0x74 - /* t */ - ? '\x09' : c === 0x09 - /* Tab */ - ? '\x09' : c === 0x6E - /* n */ - ? '\x0A' : c === 0x76 - /* v */ - ? '\x0B' : c === 0x66 - /* f */ - ? '\x0C' : c === 0x72 - /* r */ - ? '\x0D' : c === 0x65 - /* e */ - ? '\x1B' : c === 0x20 - /* Space */ - ? ' ' : c === 0x22 - /* " */ - ? '\x22' : c === 0x2F - /* / */ - ? '/' : c === 0x5C - /* \ */ - ? '\x5C' : c === 0x4E - /* N */ - ? '\x85' : c === 0x5F - /* _ */ - ? '\xA0' : c === 0x4C - /* L */ - ? '\u2028' : c === 0x50 - /* P */ - ? '\u2029' : ''; -} - -function charFromCodepoint(c) { - if (c <= 0xFFFF) { - return String.fromCharCode(c); - } // Encode UTF-16 surrogate pair - // https://en.wikipedia.org/wiki/UTF-16#Code_points_U.2B010000_to_U.2B10FFFF - - - return String.fromCharCode((c - 0x010000 >> 10) + 0xD800, (c - 0x010000 & 0x03FF) + 0xDC00); -} - -var simpleEscapeCheck = new Array(256); // integer, for fast access - -var simpleEscapeMap = new Array(256); - -for (var i = 0; i < 256; i++) { - simpleEscapeCheck[i] = simpleEscapeSequence(i) ? 1 : 0; - simpleEscapeMap[i] = simpleEscapeSequence(i); -} - -function State(input, options) { - this.input = input; - this.filename = options['filename'] || null; - this.schema = options['schema'] || DEFAULT_FULL_SCHEMA; - this.onWarning = options['onWarning'] || null; - this.legacy = options['legacy'] || false; - this.json = options['json'] || false; - this.listener = options['listener'] || null; - this.implicitTypes = this.schema.compiledImplicit; - this.typeMap = this.schema.compiledTypeMap; - this.length = input.length; - this.position = 0; - this.line = 0; - this.lineStart = 0; - this.lineIndent = 0; - this.documents = []; - /* - this.version; - this.checkLineBreaks; - this.tagMap; - this.anchorMap; - this.tag; - this.anchor; - this.kind; - this.result;*/ -} - -function generateError(state, message) { - return new YAMLException(message, new Mark(state.filename, state.input, state.position, state.line, state.position - state.lineStart)); -} - -function throwError(state, message) { - throw generateError(state, message); -} - -function throwWarning(state, message) { - if (state.onWarning) { - state.onWarning.call(null, generateError(state, message)); - } -} - -var directiveHandlers = { - YAML: function handleYamlDirective(state, name, args) { - var match, major, minor; - - if (state.version !== null) { - throwError(state, 'duplication of %YAML directive'); - } - - if (args.length !== 1) { - throwError(state, 'YAML directive accepts exactly one argument'); - } - - match = /^([0-9]+)\.([0-9]+)$/.exec(args[0]); - - if (match === null) { - throwError(state, 'ill-formed argument of the YAML directive'); - } - - major = parseInt(match[1], 10); - minor = parseInt(match[2], 10); - - if (major !== 1) { - throwError(state, 'unacceptable YAML version of the document'); - } - - state.version = args[0]; - state.checkLineBreaks = minor < 2; - - if (minor !== 1 && minor !== 2) { - throwWarning(state, 'unsupported YAML version of the document'); - } - }, - TAG: function handleTagDirective(state, name, args) { - var handle, prefix; - - if (args.length !== 2) { - throwError(state, 'TAG directive accepts exactly two arguments'); - } - - handle = args[0]; - prefix = args[1]; - - if (!PATTERN_TAG_HANDLE.test(handle)) { - throwError(state, 'ill-formed tag handle (first argument) of the TAG directive'); - } - - if (_hasOwnProperty.call(state.tagMap, handle)) { - throwError(state, 'there is a previously declared suffix for "' + handle + '" tag handle'); - } - - if (!PATTERN_TAG_URI.test(prefix)) { - throwError(state, 'ill-formed tag prefix (second argument) of the TAG directive'); - } - - state.tagMap[handle] = prefix; - } -}; - -function captureSegment(state, start, end, checkJson) { - var _position, _length, _character, _result; - - if (start < end) { - _result = state.input.slice(start, end); - - if (checkJson) { - for (_position = 0, _length = _result.length; _position < _length; _position += 1) { - _character = _result.charCodeAt(_position); - - if (!(_character === 0x09 || 0x20 <= _character && _character <= 0x10FFFF)) { - throwError(state, 'expected valid JSON character'); - } - } - } else if (PATTERN_NON_PRINTABLE.test(_result)) { - throwError(state, 'the stream contains non-printable characters'); - } - - state.result += _result; - } -} - -function mergeMappings(state, destination, source, overridableKeys) { - var sourceKeys, key, index, quantity; - - if (!common.isObject(source)) { - throwError(state, 'cannot merge mappings; the provided source object is unacceptable'); - } - - sourceKeys = Object.keys(source); - - for (index = 0, quantity = sourceKeys.length; index < quantity; index += 1) { - key = sourceKeys[index]; - - if (!_hasOwnProperty.call(destination, key)) { - destination[key] = source[key]; - overridableKeys[key] = true; - } - } -} - -function storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, startLine, startPos) { - var index, quantity; // The output is a plain object here, so keys can only be strings. - // We need to convert keyNode to a string, but doing so can hang the process - // (deeply nested arrays that explode exponentially using aliases). - - if (Array.isArray(keyNode)) { - keyNode = Array.prototype.slice.call(keyNode); - - for (index = 0, quantity = keyNode.length; index < quantity; index += 1) { - if (Array.isArray(keyNode[index])) { - throwError(state, 'nested arrays are not supported inside keys'); - } - - if (typeof keyNode === 'object' && _class(keyNode[index]) === '[object Object]') { - keyNode[index] = '[object Object]'; - } - } - } // Avoid code execution in load() via toString property - // (still use its own toString for arrays, timestamps, - // and whatever user schema extensions happen to have @@toStringTag) - - - if (typeof keyNode === 'object' && _class(keyNode) === '[object Object]') { - keyNode = '[object Object]'; - } - - keyNode = String(keyNode); - - if (_result === null) { - _result = {}; - } - - if (keyTag === 'tag:yaml.org,2002:merge') { - if (Array.isArray(valueNode)) { - for (index = 0, quantity = valueNode.length; index < quantity; index += 1) { - mergeMappings(state, _result, valueNode[index], overridableKeys); - } - } else { - mergeMappings(state, _result, valueNode, overridableKeys); - } - } else { - if (!state.json && !_hasOwnProperty.call(overridableKeys, keyNode) && _hasOwnProperty.call(_result, keyNode)) { - state.line = startLine || state.line; - state.position = startPos || state.position; - throwError(state, 'duplicated mapping key'); - } - - _result[keyNode] = valueNode; - delete overridableKeys[keyNode]; - } - - return _result; -} - -function readLineBreak(state) { - var ch; - ch = state.input.charCodeAt(state.position); - - if (ch === 0x0A - /* LF */ - ) { - state.position++; - } else if (ch === 0x0D - /* CR */ - ) { - state.position++; - - if (state.input.charCodeAt(state.position) === 0x0A - /* LF */ - ) { - state.position++; - } - } else { - throwError(state, 'a line break is expected'); - } - - state.line += 1; - state.lineStart = state.position; -} - -function skipSeparationSpace(state, allowComments, checkIndent) { - var lineBreaks = 0, - ch = state.input.charCodeAt(state.position); - - while (ch !== 0) { - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (allowComments && ch === 0x23 - /* # */ - ) { - do { - ch = state.input.charCodeAt(++state.position); - } while (ch !== 0x0A - /* LF */ - && ch !== 0x0D - /* CR */ - && ch !== 0); - } - - if (is_EOL(ch)) { - readLineBreak(state); - ch = state.input.charCodeAt(state.position); - lineBreaks++; - state.lineIndent = 0; - - while (ch === 0x20 - /* Space */ - ) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); - } - } else { - break; - } - } - - if (checkIndent !== -1 && lineBreaks !== 0 && state.lineIndent < checkIndent) { - throwWarning(state, 'deficient indentation'); - } - - return lineBreaks; -} - -function testDocumentSeparator(state) { - var _position = state.position, - ch; - ch = state.input.charCodeAt(_position); // Condition state.position === state.lineStart is tested - // in parent on each call, for efficiency. No needs to test here again. - - if ((ch === 0x2D - /* - */ - || ch === 0x2E - /* . */ - ) && ch === state.input.charCodeAt(_position + 1) && ch === state.input.charCodeAt(_position + 2)) { - _position += 3; - ch = state.input.charCodeAt(_position); - - if (ch === 0 || is_WS_OR_EOL(ch)) { - return true; - } - } - - return false; -} - -function writeFoldedLines(state, count) { - if (count === 1) { - state.result += ' '; - } else if (count > 1) { - state.result += common.repeat('\n', count - 1); - } -} - -function readPlainScalar(state, nodeIndent, withinFlowCollection) { - var preceding, - following, - captureStart, - captureEnd, - hasPendingContent, - _line, - _lineStart, - _lineIndent, - _kind = state.kind, - _result = state.result, - ch; - - ch = state.input.charCodeAt(state.position); - - if (is_WS_OR_EOL(ch) || is_FLOW_INDICATOR(ch) || ch === 0x23 - /* # */ - || ch === 0x26 - /* & */ - || ch === 0x2A - /* * */ - || ch === 0x21 - /* ! */ - || ch === 0x7C - /* | */ - || ch === 0x3E - /* > */ - || ch === 0x27 - /* ' */ - || ch === 0x22 - /* " */ - || ch === 0x25 - /* % */ - || ch === 0x40 - /* @ */ - || ch === 0x60 - /* ` */ - ) { - return false; - } - - if (ch === 0x3F - /* ? */ - || ch === 0x2D - /* - */ - ) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) { - return false; - } - } - - state.kind = 'scalar'; - state.result = ''; - captureStart = captureEnd = state.position; - hasPendingContent = false; - - while (ch !== 0) { - if (ch === 0x3A - /* : */ - ) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following) || withinFlowCollection && is_FLOW_INDICATOR(following)) { - break; - } - } else if (ch === 0x23 - /* # */ - ) { - preceding = state.input.charCodeAt(state.position - 1); - - if (is_WS_OR_EOL(preceding)) { - break; - } - } else if (state.position === state.lineStart && testDocumentSeparator(state) || withinFlowCollection && is_FLOW_INDICATOR(ch)) { - break; - } else if (is_EOL(ch)) { - _line = state.line; - _lineStart = state.lineStart; - _lineIndent = state.lineIndent; - skipSeparationSpace(state, false, -1); - - if (state.lineIndent >= nodeIndent) { - hasPendingContent = true; - ch = state.input.charCodeAt(state.position); - continue; - } else { - state.position = captureEnd; - state.line = _line; - state.lineStart = _lineStart; - state.lineIndent = _lineIndent; - break; - } - } - - if (hasPendingContent) { - captureSegment(state, captureStart, captureEnd, false); - writeFoldedLines(state, state.line - _line); - captureStart = captureEnd = state.position; - hasPendingContent = false; - } - - if (!is_WHITE_SPACE(ch)) { - captureEnd = state.position + 1; - } - - ch = state.input.charCodeAt(++state.position); - } - - captureSegment(state, captureStart, captureEnd, false); - - if (state.result) { - return true; - } - - state.kind = _kind; - state.result = _result; - return false; -} - -function readSingleQuotedScalar(state, nodeIndent) { - var ch, captureStart, captureEnd; - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x27 - /* ' */ - ) { - return false; - } - - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; - - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - if (ch === 0x27 - /* ' */ - ) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); - - if (ch === 0x27 - /* ' */ - ) { - captureStart = state.position; - state.position++; - captureEnd = state.position; - } else { - return true; - } - } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; - } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a single quoted scalar'); - } else { - state.position++; - captureEnd = state.position; - } - } - - throwError(state, 'unexpected end of the stream within a single quoted scalar'); -} - -function readDoubleQuotedScalar(state, nodeIndent) { - var captureStart, captureEnd, hexLength, hexResult, tmp, ch; - ch = state.input.charCodeAt(state.position); - - if (ch !== 0x22 - /* " */ - ) { - return false; - } - - state.kind = 'scalar'; - state.result = ''; - state.position++; - captureStart = captureEnd = state.position; - - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - if (ch === 0x22 - /* " */ - ) { - captureSegment(state, captureStart, state.position, true); - state.position++; - return true; - } else if (ch === 0x5C - /* \ */ - ) { - captureSegment(state, captureStart, state.position, true); - ch = state.input.charCodeAt(++state.position); - - if (is_EOL(ch)) { - skipSeparationSpace(state, false, nodeIndent); // TODO: rework to inline fn with no type cast? - } else if (ch < 256 && simpleEscapeCheck[ch]) { - state.result += simpleEscapeMap[ch]; - state.position++; - } else if ((tmp = escapedHexLen(ch)) > 0) { - hexLength = tmp; - hexResult = 0; - - for (; hexLength > 0; hexLength--) { - ch = state.input.charCodeAt(++state.position); - - if ((tmp = fromHexCode(ch)) >= 0) { - hexResult = (hexResult << 4) + tmp; - } else { - throwError(state, 'expected hexadecimal character'); - } - } - - state.result += charFromCodepoint(hexResult); - state.position++; - } else { - throwError(state, 'unknown escape sequence'); - } - - captureStart = captureEnd = state.position; - } else if (is_EOL(ch)) { - captureSegment(state, captureStart, captureEnd, true); - writeFoldedLines(state, skipSeparationSpace(state, false, nodeIndent)); - captureStart = captureEnd = state.position; - } else if (state.position === state.lineStart && testDocumentSeparator(state)) { - throwError(state, 'unexpected end of the document within a double quoted scalar'); - } else { - state.position++; - captureEnd = state.position; - } - } - - throwError(state, 'unexpected end of the stream within a double quoted scalar'); -} - -function readFlowCollection(state, nodeIndent) { - var readNext = true, - _line, - _tag = state.tag, - _result, - _anchor = state.anchor, - following, - terminator, - isPair, - isExplicitPair, - isMapping, - overridableKeys = {}, - keyNode, - keyTag, - valueNode, - ch; - - ch = state.input.charCodeAt(state.position); - - if (ch === 0x5B - /* [ */ - ) { - terminator = 0x5D; - /* ] */ - - isMapping = false; - _result = []; - } else if (ch === 0x7B - /* { */ - ) { - terminator = 0x7D; - /* } */ - - isMapping = true; - _result = {}; - } else { - return false; - } - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } - - ch = state.input.charCodeAt(++state.position); - - while (ch !== 0) { - skipSeparationSpace(state, true, nodeIndent); - ch = state.input.charCodeAt(state.position); - - if (ch === terminator) { - state.position++; - state.tag = _tag; - state.anchor = _anchor; - state.kind = isMapping ? 'mapping' : 'sequence'; - state.result = _result; - return true; - } else if (!readNext) { - throwError(state, 'missed comma between flow collection entries'); - } - - keyTag = keyNode = valueNode = null; - isPair = isExplicitPair = false; - - if (ch === 0x3F - /* ? */ - ) { - following = state.input.charCodeAt(state.position + 1); - - if (is_WS_OR_EOL(following)) { - isPair = isExplicitPair = true; - state.position++; - skipSeparationSpace(state, true, nodeIndent); - } - } - - _line = state.line; - composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); - keyTag = state.tag; - keyNode = state.result; - skipSeparationSpace(state, true, nodeIndent); - ch = state.input.charCodeAt(state.position); - - if ((isExplicitPair || state.line === _line) && ch === 0x3A - /* : */ - ) { - isPair = true; - ch = state.input.charCodeAt(++state.position); - skipSeparationSpace(state, true, nodeIndent); - composeNode(state, nodeIndent, CONTEXT_FLOW_IN, false, true); - valueNode = state.result; - } - - if (isMapping) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode); - } else if (isPair) { - _result.push(storeMappingPair(state, null, overridableKeys, keyTag, keyNode, valueNode)); - } else { - _result.push(keyNode); - } - - skipSeparationSpace(state, true, nodeIndent); - ch = state.input.charCodeAt(state.position); - - if (ch === 0x2C - /* , */ - ) { - readNext = true; - ch = state.input.charCodeAt(++state.position); - } else { - readNext = false; - } - } - - throwError(state, 'unexpected end of the stream within a flow collection'); -} - -function readBlockScalar(state, nodeIndent) { - var captureStart, - folding, - chomping = CHOMPING_CLIP, - didReadContent = false, - detectedIndent = false, - textIndent = nodeIndent, - emptyLines = 0, - atMoreIndented = false, - tmp, - ch; - ch = state.input.charCodeAt(state.position); - - if (ch === 0x7C - /* | */ - ) { - folding = false; - } else if (ch === 0x3E - /* > */ - ) { - folding = true; - } else { - return false; - } - - state.kind = 'scalar'; - state.result = ''; - - while (ch !== 0) { - ch = state.input.charCodeAt(++state.position); - - if (ch === 0x2B - /* + */ - || ch === 0x2D - /* - */ - ) { - if (CHOMPING_CLIP === chomping) { - chomping = ch === 0x2B - /* + */ - ? CHOMPING_KEEP : CHOMPING_STRIP; - } else { - throwError(state, 'repeat of a chomping mode identifier'); - } - } else if ((tmp = fromDecimalCode(ch)) >= 0) { - if (tmp === 0) { - throwError(state, 'bad explicit indentation width of a block scalar; it cannot be less than one'); - } else if (!detectedIndent) { - textIndent = nodeIndent + tmp - 1; - detectedIndent = true; - } else { - throwError(state, 'repeat of an indentation width identifier'); - } - } else { - break; - } - } - - if (is_WHITE_SPACE(ch)) { - do { - ch = state.input.charCodeAt(++state.position); - } while (is_WHITE_SPACE(ch)); - - if (ch === 0x23 - /* # */ - ) { - do { - ch = state.input.charCodeAt(++state.position); - } while (!is_EOL(ch) && ch !== 0); - } - } - - while (ch !== 0) { - readLineBreak(state); - state.lineIndent = 0; - ch = state.input.charCodeAt(state.position); - - while ((!detectedIndent || state.lineIndent < textIndent) && ch === 0x20 - /* Space */ - ) { - state.lineIndent++; - ch = state.input.charCodeAt(++state.position); - } - - if (!detectedIndent && state.lineIndent > textIndent) { - textIndent = state.lineIndent; - } - - if (is_EOL(ch)) { - emptyLines++; - continue; - } // End of the scalar. - - - if (state.lineIndent < textIndent) { - // Perform the chomping. - if (chomping === CHOMPING_KEEP) { - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - } else if (chomping === CHOMPING_CLIP) { - if (didReadContent) { - // i.e. only if the scalar is not empty. - state.result += '\n'; - } - } // Break this `while` cycle and go to the funciton's epilogue. - - - break; - } // Folded style: use fancy rules to handle line breaks. - - - if (folding) { - // Lines starting with white space characters (more-indented lines) are not folded. - if (is_WHITE_SPACE(ch)) { - atMoreIndented = true; // except for the first content line (cf. Example 8.1) - - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); // End of more-indented block. - } else if (atMoreIndented) { - atMoreIndented = false; - state.result += common.repeat('\n', emptyLines + 1); // Just one line break - perceive as the same line. - } else if (emptyLines === 0) { - if (didReadContent) { - // i.e. only if we have already read some scalar content. - state.result += ' '; - } // Several line breaks - perceive as different lines. - - } else { - state.result += common.repeat('\n', emptyLines); - } // Literal style: just add exact number of line breaks between content lines. - - } else { - // Keep all line breaks except the header line break. - state.result += common.repeat('\n', didReadContent ? 1 + emptyLines : emptyLines); - } - - didReadContent = true; - detectedIndent = true; - emptyLines = 0; - captureStart = state.position; - - while (!is_EOL(ch) && ch !== 0) { - ch = state.input.charCodeAt(++state.position); - } - - captureSegment(state, captureStart, state.position, false); - } - - return true; -} - -function readBlockSequence(state, nodeIndent) { - var _line, - _tag = state.tag, - _anchor = state.anchor, - _result = [], - following, - detected = false, - ch; - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } - - ch = state.input.charCodeAt(state.position); - - while (ch !== 0) { - if (ch !== 0x2D - /* - */ - ) { - break; - } - - following = state.input.charCodeAt(state.position + 1); - - if (!is_WS_OR_EOL(following)) { - break; - } - - detected = true; - state.position++; - - if (skipSeparationSpace(state, true, -1)) { - if (state.lineIndent <= nodeIndent) { - _result.push(null); - - ch = state.input.charCodeAt(state.position); - continue; - } - } - - _line = state.line; - composeNode(state, nodeIndent, CONTEXT_BLOCK_IN, false, true); - - _result.push(state.result); - - skipSeparationSpace(state, true, -1); - ch = state.input.charCodeAt(state.position); - - if ((state.line === _line || state.lineIndent > nodeIndent) && ch !== 0) { - throwError(state, 'bad indentation of a sequence entry'); - } else if (state.lineIndent < nodeIndent) { - break; - } - } - - if (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'sequence'; - state.result = _result; - return true; - } - - return false; -} - -function readBlockMapping(state, nodeIndent, flowIndent) { - var following, - allowCompact, - _line, - _pos, - _tag = state.tag, - _anchor = state.anchor, - _result = {}, - overridableKeys = {}, - keyTag = null, - keyNode = null, - valueNode = null, - atExplicitKey = false, - detected = false, - ch; - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = _result; - } - - ch = state.input.charCodeAt(state.position); - - while (ch !== 0) { - following = state.input.charCodeAt(state.position + 1); - _line = state.line; // Save the current line. - - _pos = state.position; // - // Explicit notation case. There are two separate blocks: - // first for the key (denoted by "?") and second for the value (denoted by ":") - // - - if ((ch === 0x3F - /* ? */ - || ch === 0x3A - /* : */ - ) && is_WS_OR_EOL(following)) { - if (ch === 0x3F - /* ? */ - ) { - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); - keyTag = keyNode = valueNode = null; - } - - detected = true; - atExplicitKey = true; - allowCompact = true; - } else if (atExplicitKey) { - // i.e. 0x3A/* : */ === character after the explicit key. - atExplicitKey = false; - allowCompact = true; - } else { - throwError(state, 'incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line'); - } - - state.position += 1; - ch = following; // - // Implicit notation case. Flow-style node as the key first, then ":", and the value. - // - } else if (composeNode(state, flowIndent, CONTEXT_FLOW_OUT, false, true)) { - if (state.line === _line) { - ch = state.input.charCodeAt(state.position); - - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (ch === 0x3A - /* : */ - ) { - ch = state.input.charCodeAt(++state.position); - - if (!is_WS_OR_EOL(ch)) { - throwError(state, 'a whitespace character is expected after the key-value separator within a block mapping'); - } - - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); - keyTag = keyNode = valueNode = null; - } - - detected = true; - atExplicitKey = false; - allowCompact = false; - keyTag = state.tag; - keyNode = state.result; - } else if (detected) { - throwError(state, 'can not read an implicit mapping pair; a colon is missed'); - } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. - } - } else if (detected) { - throwError(state, 'can not read a block mapping entry; a multiline key may not be an implicit key'); - } else { - state.tag = _tag; - state.anchor = _anchor; - return true; // Keep the result of `composeNode`. - } - } else { - break; // Reading is done. Go to the epilogue. - } // - // Common reading code for both explicit and implicit notations. - // - - - if (state.line === _line || state.lineIndent > nodeIndent) { - if (composeNode(state, nodeIndent, CONTEXT_BLOCK_OUT, true, allowCompact)) { - if (atExplicitKey) { - keyNode = state.result; - } else { - valueNode = state.result; - } - } - - if (!atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, valueNode, _line, _pos); - keyTag = keyNode = valueNode = null; - } - - skipSeparationSpace(state, true, -1); - ch = state.input.charCodeAt(state.position); - } - - if (state.lineIndent > nodeIndent && ch !== 0) { - throwError(state, 'bad indentation of a mapping entry'); - } else if (state.lineIndent < nodeIndent) { - break; - } - } // - // Epilogue. - // - // Special case: last mapping's node contains only the key in explicit notation. - - - if (atExplicitKey) { - storeMappingPair(state, _result, overridableKeys, keyTag, keyNode, null); - } // Expose the resulting mapping. - - - if (detected) { - state.tag = _tag; - state.anchor = _anchor; - state.kind = 'mapping'; - state.result = _result; - } - - return detected; -} - -function readTagProperty(state) { - var _position, - isVerbatim = false, - isNamed = false, - tagHandle, - tagName, - ch; - - ch = state.input.charCodeAt(state.position); - if (ch !== 0x21 - /* ! */ - ) return false; - - if (state.tag !== null) { - throwError(state, 'duplication of a tag property'); - } - - ch = state.input.charCodeAt(++state.position); - - if (ch === 0x3C - /* < */ - ) { - isVerbatim = true; - ch = state.input.charCodeAt(++state.position); - } else if (ch === 0x21 - /* ! */ - ) { - isNamed = true; - tagHandle = '!!'; - ch = state.input.charCodeAt(++state.position); - } else { - tagHandle = '!'; - } - - _position = state.position; - - if (isVerbatim) { - do { - ch = state.input.charCodeAt(++state.position); - } while (ch !== 0 && ch !== 0x3E - /* > */ - ); - - if (state.position < state.length) { - tagName = state.input.slice(_position, state.position); - ch = state.input.charCodeAt(++state.position); - } else { - throwError(state, 'unexpected end of the stream within a verbatim tag'); - } - } else { - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - if (ch === 0x21 - /* ! */ - ) { - if (!isNamed) { - tagHandle = state.input.slice(_position - 1, state.position + 1); - - if (!PATTERN_TAG_HANDLE.test(tagHandle)) { - throwError(state, 'named tag handle cannot contain such characters'); - } - - isNamed = true; - _position = state.position + 1; - } else { - throwError(state, 'tag suffix cannot contain exclamation marks'); - } - } - - ch = state.input.charCodeAt(++state.position); - } - - tagName = state.input.slice(_position, state.position); - - if (PATTERN_FLOW_INDICATORS.test(tagName)) { - throwError(state, 'tag suffix cannot contain flow indicator characters'); - } - } - - if (tagName && !PATTERN_TAG_URI.test(tagName)) { - throwError(state, 'tag name cannot contain such characters: ' + tagName); - } - - if (isVerbatim) { - state.tag = tagName; - } else if (_hasOwnProperty.call(state.tagMap, tagHandle)) { - state.tag = state.tagMap[tagHandle] + tagName; - } else if (tagHandle === '!') { - state.tag = '!' + tagName; - } else if (tagHandle === '!!') { - state.tag = 'tag:yaml.org,2002:' + tagName; - } else { - throwError(state, 'undeclared tag handle "' + tagHandle + '"'); - } - - return true; -} - -function readAnchorProperty(state) { - var _position, ch; - - ch = state.input.charCodeAt(state.position); - if (ch !== 0x26 - /* & */ - ) return false; - - if (state.anchor !== null) { - throwError(state, 'duplication of an anchor property'); - } - - ch = state.input.charCodeAt(++state.position); - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (state.position === _position) { - throwError(state, 'name of an anchor node must contain at least one character'); - } - - state.anchor = state.input.slice(_position, state.position); - return true; -} - -function readAlias(state) { - var _position, alias, ch; - - ch = state.input.charCodeAt(state.position); - if (ch !== 0x2A - /* * */ - ) return false; - ch = state.input.charCodeAt(++state.position); - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch) && !is_FLOW_INDICATOR(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (state.position === _position) { - throwError(state, 'name of an alias node must contain at least one character'); - } - - alias = state.input.slice(_position, state.position); - - if (!_hasOwnProperty.call(state.anchorMap, alias)) { - throwError(state, 'unidentified alias "' + alias + '"'); - } - - state.result = state.anchorMap[alias]; - skipSeparationSpace(state, true, -1); - return true; -} - -function composeNode(state, parentIndent, nodeContext, allowToSeek, allowCompact) { - var allowBlockStyles, - allowBlockScalars, - allowBlockCollections, - indentStatus = 1, - // 1: this>parent, 0: this=parent, -1: this parentIndent) { - indentStatus = 1; - } else if (state.lineIndent === parentIndent) { - indentStatus = 0; - } else if (state.lineIndent < parentIndent) { - indentStatus = -1; - } - } - } - - if (indentStatus === 1) { - while (readTagProperty(state) || readAnchorProperty(state)) { - if (skipSeparationSpace(state, true, -1)) { - atNewLine = true; - allowBlockCollections = allowBlockStyles; - - if (state.lineIndent > parentIndent) { - indentStatus = 1; - } else if (state.lineIndent === parentIndent) { - indentStatus = 0; - } else if (state.lineIndent < parentIndent) { - indentStatus = -1; - } - } else { - allowBlockCollections = false; - } - } - } - - if (allowBlockCollections) { - allowBlockCollections = atNewLine || allowCompact; - } - - if (indentStatus === 1 || CONTEXT_BLOCK_OUT === nodeContext) { - if (CONTEXT_FLOW_IN === nodeContext || CONTEXT_FLOW_OUT === nodeContext) { - flowIndent = parentIndent; - } else { - flowIndent = parentIndent + 1; - } - - blockIndent = state.position - state.lineStart; - - if (indentStatus === 1) { - if (allowBlockCollections && (readBlockSequence(state, blockIndent) || readBlockMapping(state, blockIndent, flowIndent)) || readFlowCollection(state, flowIndent)) { - hasContent = true; - } else { - if (allowBlockScalars && readBlockScalar(state, flowIndent) || readSingleQuotedScalar(state, flowIndent) || readDoubleQuotedScalar(state, flowIndent)) { - hasContent = true; - } else if (readAlias(state)) { - hasContent = true; - - if (state.tag !== null || state.anchor !== null) { - throwError(state, 'alias node should not have any properties'); - } - } else if (readPlainScalar(state, flowIndent, CONTEXT_FLOW_IN === nodeContext)) { - hasContent = true; - - if (state.tag === null) { - state.tag = '?'; - } - } - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - } - } else if (indentStatus === 0) { - // Special case: block sequences are allowed to have same indentation level as the parent. - // http://www.yaml.org/spec/1.2/spec.html#id2799784 - hasContent = allowBlockCollections && readBlockSequence(state, blockIndent); - } - } - - if (state.tag !== null && state.tag !== '!') { - if (state.tag === '?') { - // Implicit resolving is not allowed for non-scalar types, and '?' - // non-specific tag is only automatically assigned to plain scalars. - // - // We only need to check kind conformity in case user explicitly assigns '?' - // tag, for example like this: "! [0]" - // - if (state.result !== null && state.kind !== 'scalar') { - throwError(state, 'unacceptable node kind for ! tag; it should be "scalar", not "' + state.kind + '"'); - } - - for (typeIndex = 0, typeQuantity = state.implicitTypes.length; typeIndex < typeQuantity; typeIndex += 1) { - type = state.implicitTypes[typeIndex]; - - if (type.resolve(state.result)) { - // `state.result` updated in resolver if matched - state.result = type.construct(state.result); - state.tag = type.tag; - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - - break; - } - } - } else if (_hasOwnProperty.call(state.typeMap[state.kind || 'fallback'], state.tag)) { - type = state.typeMap[state.kind || 'fallback'][state.tag]; - - if (state.result !== null && type.kind !== state.kind) { - throwError(state, 'unacceptable node kind for !<' + state.tag + '> tag; it should be "' + type.kind + '", not "' + state.kind + '"'); - } - - if (!type.resolve(state.result)) { - // `state.result` updated in resolver if matched - throwError(state, 'cannot resolve a node with !<' + state.tag + '> explicit tag'); - } else { - state.result = type.construct(state.result); - - if (state.anchor !== null) { - state.anchorMap[state.anchor] = state.result; - } - } - } else { - throwError(state, 'unknown tag !<' + state.tag + '>'); - } - } - - if (state.listener !== null) { - state.listener('close', state); - } - - return state.tag !== null || state.anchor !== null || hasContent; -} - -function readDocument(state) { - var documentStart = state.position, - _position, - directiveName, - directiveArgs, - hasDirectives = false, - ch; - - state.version = null; - state.checkLineBreaks = state.legacy; - state.tagMap = {}; - state.anchorMap = {}; - - while ((ch = state.input.charCodeAt(state.position)) !== 0) { - skipSeparationSpace(state, true, -1); - ch = state.input.charCodeAt(state.position); - - if (state.lineIndent > 0 || ch !== 0x25 - /* % */ - ) { - break; - } - - hasDirectives = true; - ch = state.input.charCodeAt(++state.position); - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - directiveName = state.input.slice(_position, state.position); - directiveArgs = []; - - if (directiveName.length < 1) { - throwError(state, 'directive name must not be less than one character in length'); - } - - while (ch !== 0) { - while (is_WHITE_SPACE(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - if (ch === 0x23 - /* # */ - ) { - do { - ch = state.input.charCodeAt(++state.position); - } while (ch !== 0 && !is_EOL(ch)); - - break; - } - - if (is_EOL(ch)) break; - _position = state.position; - - while (ch !== 0 && !is_WS_OR_EOL(ch)) { - ch = state.input.charCodeAt(++state.position); - } - - directiveArgs.push(state.input.slice(_position, state.position)); - } - - if (ch !== 0) readLineBreak(state); - - if (_hasOwnProperty.call(directiveHandlers, directiveName)) { - directiveHandlers[directiveName](state, directiveName, directiveArgs); - } else { - throwWarning(state, 'unknown document directive "' + directiveName + '"'); - } - } - - skipSeparationSpace(state, true, -1); - - if (state.lineIndent === 0 && state.input.charCodeAt(state.position) === 0x2D - /* - */ - && state.input.charCodeAt(state.position + 1) === 0x2D - /* - */ - && state.input.charCodeAt(state.position + 2) === 0x2D - /* - */ - ) { - state.position += 3; - skipSeparationSpace(state, true, -1); - } else if (hasDirectives) { - throwError(state, 'directives end mark is expected'); - } - - composeNode(state, state.lineIndent - 1, CONTEXT_BLOCK_OUT, false, true); - skipSeparationSpace(state, true, -1); - - if (state.checkLineBreaks && PATTERN_NON_ASCII_LINE_BREAKS.test(state.input.slice(documentStart, state.position))) { - throwWarning(state, 'non-ASCII line breaks are interpreted as content'); - } - - state.documents.push(state.result); - - if (state.position === state.lineStart && testDocumentSeparator(state)) { - if (state.input.charCodeAt(state.position) === 0x2E - /* . */ - ) { - state.position += 3; - skipSeparationSpace(state, true, -1); - } - - return; - } - - if (state.position < state.length - 1) { - throwError(state, 'end of the stream or a document separator is expected'); - } else { - return; - } -} - -function loadDocuments(input, options) { - input = String(input); - options = options || {}; - - if (input.length !== 0) { - // Add tailing `\n` if not exists - if (input.charCodeAt(input.length - 1) !== 0x0A - /* LF */ - && input.charCodeAt(input.length - 1) !== 0x0D - /* CR */ - ) { - input += '\n'; - } // Strip BOM - - - if (input.charCodeAt(0) === 0xFEFF) { - input = input.slice(1); - } - } - - var state = new State(input, options); - var nullpos = input.indexOf('\0'); - - if (nullpos !== -1) { - state.position = nullpos; - throwError(state, 'null byte is not allowed in input'); - } // Use 0 as string terminator. That significantly simplifies bounds check. - - - state.input += '\0'; - - while (state.input.charCodeAt(state.position) === 0x20 - /* Space */ - ) { - state.lineIndent += 1; - state.position += 1; - } - - while (state.position < state.length - 1) { - readDocument(state); - } - - return state.documents; -} - -function loadAll(input, iterator, options) { - if (iterator !== null && typeof iterator === 'object' && typeof options === 'undefined') { - options = iterator; - iterator = null; - } - - var documents = loadDocuments(input, options); - - if (typeof iterator !== 'function') { - return documents; - } - - for (var index = 0, length = documents.length; index < length; index += 1) { - iterator(documents[index]); - } -} - -function load(input, options) { - var documents = loadDocuments(input, options); - - if (documents.length === 0) { - /*eslint-disable no-undefined*/ - return undefined; - } else if (documents.length === 1) { - return documents[0]; - } - - throw new YAMLException('expected a single document in the stream, but found more'); -} - -function safeLoadAll(input, iterator, options) { - if (typeof iterator === 'object' && iterator !== null && typeof options === 'undefined') { - options = iterator; - iterator = null; - } - - return loadAll(input, iterator, common.extend({ - schema: DEFAULT_SAFE_SCHEMA - }, options)); -} - -function safeLoad(input, options) { - return load(input, common.extend({ - schema: DEFAULT_SAFE_SCHEMA - }, options)); -} - -module.exports.loadAll = loadAll; -module.exports.load = load; -module.exports.safeLoadAll = safeLoadAll; -module.exports.safeLoad = safeLoad; - -/***/ }), -/* 886 */ -/***/ ((module) => { - -"use strict"; - - -function isNothing(subject) { - return typeof subject === 'undefined' || subject === null; -} - -function isObject(subject) { - return typeof subject === 'object' && subject !== null; -} - -function toArray(sequence) { - if (Array.isArray(sequence)) return sequence;else if (isNothing(sequence)) return []; - return [sequence]; -} - -function extend(target, source) { - var index, length, key, sourceKeys; - - if (source) { - sourceKeys = Object.keys(source); - - for (index = 0, length = sourceKeys.length; index < length; index += 1) { - key = sourceKeys[index]; - target[key] = source[key]; - } - } - - return target; -} - -function repeat(string, count) { - var result = '', - cycle; - - for (cycle = 0; cycle < count; cycle += 1) { - result += string; - } - - return result; -} - -function isNegativeZero(number) { - return number === 0 && Number.NEGATIVE_INFINITY === 1 / number; -} - -module.exports.isNothing = isNothing; -module.exports.isObject = isObject; -module.exports.toArray = toArray; -module.exports.repeat = repeat; -module.exports.isNegativeZero = isNegativeZero; -module.exports.extend = extend; - -/***/ }), -/* 887 */ -/***/ ((module) => { - -"use strict"; -// YAML error class. http://stackoverflow.com/questions/8458984 -// - - -function YAMLException(reason, mark) { - // Super constructor - Error.call(this); - this.name = 'YAMLException'; - this.reason = reason; - this.mark = mark; - this.message = (this.reason || '(unknown reason)') + (this.mark ? ' ' + this.mark.toString() : ''); // Include stack trace in error object - - if (Error.captureStackTrace) { - // Chrome and NodeJS - Error.captureStackTrace(this, this.constructor); - } else { - // FF, IE 10+ and Safari 6+. Fallback for others - this.stack = new Error().stack || ''; - } -} // Inherit from Error - - -YAMLException.prototype = Object.create(Error.prototype); -YAMLException.prototype.constructor = YAMLException; - -YAMLException.prototype.toString = function toString(compact) { - var result = this.name + ': '; - result += this.reason || '(unknown reason)'; - - if (!compact && this.mark) { - result += ' ' + this.mark.toString(); - } - - return result; -}; - -module.exports = YAMLException; - -/***/ }), -/* 888 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var common = __webpack_require__(886); - -function Mark(name, buffer, position, line, column) { - this.name = name; - this.buffer = buffer; - this.position = position; - this.line = line; - this.column = column; -} - -Mark.prototype.getSnippet = function getSnippet(indent, maxLength) { - var head, start, tail, end, snippet; - if (!this.buffer) return null; - indent = indent || 4; - maxLength = maxLength || 75; - head = ''; - start = this.position; - - while (start > 0 && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(start - 1)) === -1) { - start -= 1; - - if (this.position - start > maxLength / 2 - 1) { - head = ' ... '; - start += 5; - break; - } - } - - tail = ''; - end = this.position; - - while (end < this.buffer.length && '\x00\r\n\x85\u2028\u2029'.indexOf(this.buffer.charAt(end)) === -1) { - end += 1; - - if (end - this.position > maxLength / 2 - 1) { - tail = ' ... '; - end -= 5; - break; - } - } - - snippet = this.buffer.slice(start, end); - return common.repeat(' ', indent) + head + snippet + tail + '\n' + common.repeat(' ', indent + this.position - start + head.length) + '^'; -}; - -Mark.prototype.toString = function toString(compact) { - var snippet, - where = ''; - - if (this.name) { - where += 'in "' + this.name + '" '; - } - - where += 'at line ' + (this.line + 1) + ', column ' + (this.column + 1); - - if (!compact) { - snippet = this.getSnippet(); - - if (snippet) { - where += ':\n' + snippet; - } - } - - return where; -}; - -module.exports = Mark; - -/***/ }), -/* 889 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; -// JS-YAML's default schema for `safeLoad` function. -// It is not described in the YAML specification. -// -// This schema is based on standard YAML's Core schema and includes most of -// extra types described at YAML tag repository. (http://yaml.org/type/) - - -var Schema = __webpack_require__(890); - -module.exports = new Schema({ - include: [__webpack_require__(892)], - implicit: [__webpack_require__(902), __webpack_require__(903)], - explicit: [__webpack_require__(904), __webpack_require__(906), __webpack_require__(907), __webpack_require__(908)] -}); - -/***/ }), -/* 890 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - -/*eslint-disable max-len*/ - -var common = __webpack_require__(886); - -var YAMLException = __webpack_require__(887); - -var Type = __webpack_require__(891); - -function compileList(schema, name, result) { - var exclude = []; - schema.include.forEach(function (includedSchema) { - result = compileList(includedSchema, name, result); - }); - schema[name].forEach(function (currentType) { - result.forEach(function (previousType, previousIndex) { - if (previousType.tag === currentType.tag && previousType.kind === currentType.kind) { - exclude.push(previousIndex); - } - }); - result.push(currentType); - }); - return result.filter(function (type, index) { - return exclude.indexOf(index) === -1; - }); -} - -function compileMap() { - var result = { - scalar: {}, - sequence: {}, - mapping: {}, - fallback: {} - }, - index, - length; - - function collectType(type) { - result[type.kind][type.tag] = result['fallback'][type.tag] = type; - } - - for (index = 0, length = arguments.length; index < length; index += 1) { - arguments[index].forEach(collectType); - } - - return result; -} - -function Schema(definition) { - this.include = definition.include || []; - this.implicit = definition.implicit || []; - this.explicit = definition.explicit || []; - this.implicit.forEach(function (type) { - if (type.loadKind && type.loadKind !== 'scalar') { - throw new YAMLException('There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.'); - } - }); - this.compiledImplicit = compileList(this, 'implicit', []); - this.compiledExplicit = compileList(this, 'explicit', []); - this.compiledTypeMap = compileMap(this.compiledImplicit, this.compiledExplicit); -} - -Schema.DEFAULT = null; - -Schema.create = function createSchema() { - var schemas, types; - - switch (arguments.length) { - case 1: - schemas = Schema.DEFAULT; - types = arguments[0]; - break; - - case 2: - schemas = arguments[0]; - types = arguments[1]; - break; - - default: - throw new YAMLException('Wrong number of arguments for Schema.create function'); - } - - schemas = common.toArray(schemas); - types = common.toArray(types); - - if (!schemas.every(function (schema) { - return schema instanceof Schema; - })) { - throw new YAMLException('Specified list of super schemas (or a single Schema object) contains a non-Schema object.'); - } - - if (!types.every(function (type) { - return type instanceof Type; - })) { - throw new YAMLException('Specified list of YAML types (or a single Type object) contains a non-Type object.'); - } - - return new Schema({ - include: schemas, - explicit: types - }); -}; - -module.exports = Schema; - -/***/ }), -/* 891 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var YAMLException = __webpack_require__(887); - -var TYPE_CONSTRUCTOR_OPTIONS = ['kind', 'resolve', 'construct', 'instanceOf', 'predicate', 'represent', 'defaultStyle', 'styleAliases']; -var YAML_NODE_KINDS = ['scalar', 'sequence', 'mapping']; - -function compileStyleAliases(map) { - var result = {}; - - if (map !== null) { - Object.keys(map).forEach(function (style) { - map[style].forEach(function (alias) { - result[String(alias)] = style; - }); - }); - } - - return result; -} - -function Type(tag, options) { - options = options || {}; - Object.keys(options).forEach(function (name) { - if (TYPE_CONSTRUCTOR_OPTIONS.indexOf(name) === -1) { - throw new YAMLException('Unknown option "' + name + '" is met in definition of "' + tag + '" YAML type.'); - } - }); // TODO: Add tag format check. - - this.tag = tag; - this.kind = options['kind'] || null; - - this.resolve = options['resolve'] || function () { - return true; - }; - - this.construct = options['construct'] || function (data) { - return data; - }; - - this.instanceOf = options['instanceOf'] || null; - this.predicate = options['predicate'] || null; - this.represent = options['represent'] || null; - this.defaultStyle = options['defaultStyle'] || null; - this.styleAliases = compileStyleAliases(options['styleAliases'] || null); - - if (YAML_NODE_KINDS.indexOf(this.kind) === -1) { - throw new YAMLException('Unknown kind "' + this.kind + '" is specified for "' + tag + '" YAML type.'); - } -} - -module.exports = Type; - -/***/ }), -/* 892 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; -// Standard YAML's Core schema. -// http://www.yaml.org/spec/1.2/spec.html#id2804923 -// -// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. -// So, Core schema has no distinctions from JSON schema is JS-YAML. - - -var Schema = __webpack_require__(890); - -module.exports = new Schema({ - include: [__webpack_require__(893)] -}); - -/***/ }), -/* 893 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; -// Standard YAML's JSON schema. -// http://www.yaml.org/spec/1.2/spec.html#id2803231 -// -// NOTE: JS-YAML does not support schema-specific tag resolution restrictions. -// So, this schema is not such strict as defined in the YAML specification. -// It allows numbers in binary notaion, use `Null` and `NULL` as `null`, etc. - - -var Schema = __webpack_require__(890); - -module.exports = new Schema({ - include: [__webpack_require__(894)], - implicit: [__webpack_require__(898), __webpack_require__(899), __webpack_require__(900), __webpack_require__(901)] -}); - -/***/ }), -/* 894 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; -// Standard YAML's Failsafe schema. -// http://www.yaml.org/spec/1.2/spec.html#id2802346 - - -var Schema = __webpack_require__(890); - -module.exports = new Schema({ - explicit: [__webpack_require__(895), __webpack_require__(896), __webpack_require__(897)] -}); - -/***/ }), -/* 895 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var Type = __webpack_require__(891); - -module.exports = new Type('tag:yaml.org,2002:str', { - kind: 'scalar', - construct: function (data) { - return data !== null ? data : ''; - } -}); - -/***/ }), -/* 896 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var Type = __webpack_require__(891); - -module.exports = new Type('tag:yaml.org,2002:seq', { - kind: 'sequence', - construct: function (data) { - return data !== null ? data : []; - } -}); - -/***/ }), -/* 897 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var Type = __webpack_require__(891); - -module.exports = new Type('tag:yaml.org,2002:map', { - kind: 'mapping', - construct: function (data) { - return data !== null ? data : {}; - } -}); - -/***/ }), -/* 898 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var Type = __webpack_require__(891); - -function resolveYamlNull(data) { - if (data === null) return true; - var max = data.length; - return max === 1 && data === '~' || max === 4 && (data === 'null' || data === 'Null' || data === 'NULL'); -} - -function constructYamlNull() { - return null; -} - -function isNull(object) { - return object === null; -} - -module.exports = new Type('tag:yaml.org,2002:null', { - kind: 'scalar', - resolve: resolveYamlNull, - construct: constructYamlNull, - predicate: isNull, - represent: { - canonical: function () { - return '~'; - }, - lowercase: function () { - return 'null'; - }, - uppercase: function () { - return 'NULL'; - }, - camelcase: function () { - return 'Null'; - } - }, - defaultStyle: 'lowercase' -}); - -/***/ }), -/* 899 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var Type = __webpack_require__(891); - -function resolveYamlBoolean(data) { - if (data === null) return false; - var max = data.length; - return max === 4 && (data === 'true' || data === 'True' || data === 'TRUE') || max === 5 && (data === 'false' || data === 'False' || data === 'FALSE'); -} - -function constructYamlBoolean(data) { - return data === 'true' || data === 'True' || data === 'TRUE'; -} - -function isBoolean(object) { - return Object.prototype.toString.call(object) === '[object Boolean]'; -} - -module.exports = new Type('tag:yaml.org,2002:bool', { - kind: 'scalar', - resolve: resolveYamlBoolean, - construct: constructYamlBoolean, - predicate: isBoolean, - represent: { - lowercase: function (object) { - return object ? 'true' : 'false'; - }, - uppercase: function (object) { - return object ? 'TRUE' : 'FALSE'; - }, - camelcase: function (object) { - return object ? 'True' : 'False'; - } - }, - defaultStyle: 'lowercase' -}); - -/***/ }), -/* 900 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var common = __webpack_require__(886); - -var Type = __webpack_require__(891); - -function isHexCode(c) { - return 0x30 - /* 0 */ - <= c && c <= 0x39 - /* 9 */ - || 0x41 - /* A */ - <= c && c <= 0x46 - /* F */ - || 0x61 - /* a */ - <= c && c <= 0x66 - /* f */ - ; -} - -function isOctCode(c) { - return 0x30 - /* 0 */ - <= c && c <= 0x37 - /* 7 */ - ; -} - -function isDecCode(c) { - return 0x30 - /* 0 */ - <= c && c <= 0x39 - /* 9 */ - ; -} - -function resolveYamlInteger(data) { - if (data === null) return false; - var max = data.length, - index = 0, - hasDigits = false, - ch; - if (!max) return false; - ch = data[index]; // sign - - if (ch === '-' || ch === '+') { - ch = data[++index]; - } - - if (ch === '0') { - // 0 - if (index + 1 === max) return true; - ch = data[++index]; // base 2, base 8, base 16 - - if (ch === 'b') { - // base 2 - index++; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (ch !== '0' && ch !== '1') return false; - hasDigits = true; - } - - return hasDigits && ch !== '_'; - } - - if (ch === 'x') { - // base 16 - index++; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isHexCode(data.charCodeAt(index))) return false; - hasDigits = true; - } - - return hasDigits && ch !== '_'; - } // base 8 - - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (!isOctCode(data.charCodeAt(index))) return false; - hasDigits = true; - } - - return hasDigits && ch !== '_'; - } // base 10 (except 0) or base 60 - // value should not start with `_`; - - - if (ch === '_') return false; - - for (; index < max; index++) { - ch = data[index]; - if (ch === '_') continue; - if (ch === ':') break; - - if (!isDecCode(data.charCodeAt(index))) { - return false; - } - - hasDigits = true; - } // Should have digits and should not end with `_` - - - if (!hasDigits || ch === '_') return false; // if !base60 - done; - - if (ch !== ':') return true; // base60 almost not used, no needs to optimize - - return /^(:[0-5]?[0-9])+$/.test(data.slice(index)); -} - -function constructYamlInteger(data) { - var value = data, - sign = 1, - ch, - base, - digits = []; - - if (value.indexOf('_') !== -1) { - value = value.replace(/_/g, ''); - } - - ch = value[0]; - - if (ch === '-' || ch === '+') { - if (ch === '-') sign = -1; - value = value.slice(1); - ch = value[0]; - } - - if (value === '0') return 0; - - if (ch === '0') { - if (value[1] === 'b') return sign * parseInt(value.slice(2), 2); - if (value[1] === 'x') return sign * parseInt(value, 16); - return sign * parseInt(value, 8); - } - - if (value.indexOf(':') !== -1) { - value.split(':').forEach(function (v) { - digits.unshift(parseInt(v, 10)); - }); - value = 0; - base = 1; - digits.forEach(function (d) { - value += d * base; - base *= 60; - }); - return sign * value; - } - - return sign * parseInt(value, 10); -} - -function isInteger(object) { - return Object.prototype.toString.call(object) === '[object Number]' && object % 1 === 0 && !common.isNegativeZero(object); -} - -module.exports = new Type('tag:yaml.org,2002:int', { - kind: 'scalar', - resolve: resolveYamlInteger, - construct: constructYamlInteger, - predicate: isInteger, - represent: { - binary: function (obj) { - return obj >= 0 ? '0b' + obj.toString(2) : '-0b' + obj.toString(2).slice(1); - }, - octal: function (obj) { - return obj >= 0 ? '0' + obj.toString(8) : '-0' + obj.toString(8).slice(1); - }, - decimal: function (obj) { - return obj.toString(10); - }, - - /* eslint-disable max-len */ - hexadecimal: function (obj) { - return obj >= 0 ? '0x' + obj.toString(16).toUpperCase() : '-0x' + obj.toString(16).toUpperCase().slice(1); - } - }, - defaultStyle: 'decimal', - styleAliases: { - binary: [2, 'bin'], - octal: [8, 'oct'], - decimal: [10, 'dec'], - hexadecimal: [16, 'hex'] - } -}); - -/***/ }), -/* 901 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var common = __webpack_require__(886); - -var Type = __webpack_require__(891); - -var YAML_FLOAT_PATTERN = new RegExp( // 2.5e4, 2.5 and integers -'^(?:[-+]?(?:0|[1-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?' + // .2e4, .2 -// special case, seems not from spec -'|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?' + // 20:59 -'|[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*' + // .inf -'|[-+]?\\.(?:inf|Inf|INF)' + // .nan -'|\\.(?:nan|NaN|NAN))$'); - -function resolveYamlFloat(data) { - if (data === null) return false; - - if (!YAML_FLOAT_PATTERN.test(data) || // Quick hack to not allow integers end with `_` - // Probably should update regexp & check speed - data[data.length - 1] === '_') { - return false; - } - - return true; -} - -function constructYamlFloat(data) { - var value, sign, base, digits; - value = data.replace(/_/g, '').toLowerCase(); - sign = value[0] === '-' ? -1 : 1; - digits = []; - - if ('+-'.indexOf(value[0]) >= 0) { - value = value.slice(1); - } - - if (value === '.inf') { - return sign === 1 ? Number.POSITIVE_INFINITY : Number.NEGATIVE_INFINITY; - } else if (value === '.nan') { - return NaN; - } else if (value.indexOf(':') >= 0) { - value.split(':').forEach(function (v) { - digits.unshift(parseFloat(v, 10)); - }); - value = 0.0; - base = 1; - digits.forEach(function (d) { - value += d * base; - base *= 60; - }); - return sign * value; - } - - return sign * parseFloat(value, 10); -} - -var SCIENTIFIC_WITHOUT_DOT = /^[-+]?[0-9]+e/; - -function representYamlFloat(object, style) { - var res; - - if (isNaN(object)) { - switch (style) { - case 'lowercase': - return '.nan'; - - case 'uppercase': - return '.NAN'; - - case 'camelcase': - return '.NaN'; - } - } else if (Number.POSITIVE_INFINITY === object) { - switch (style) { - case 'lowercase': - return '.inf'; - - case 'uppercase': - return '.INF'; - - case 'camelcase': - return '.Inf'; - } - } else if (Number.NEGATIVE_INFINITY === object) { - switch (style) { - case 'lowercase': - return '-.inf'; - - case 'uppercase': - return '-.INF'; - - case 'camelcase': - return '-.Inf'; - } - } else if (common.isNegativeZero(object)) { - return '-0.0'; - } - - res = object.toString(10); // JS stringifier can build scientific format without dots: 5e-100, - // while YAML requres dot: 5.e-100. Fix it with simple hack - - return SCIENTIFIC_WITHOUT_DOT.test(res) ? res.replace('e', '.e') : res; -} - -function isFloat(object) { - return Object.prototype.toString.call(object) === '[object Number]' && (object % 1 !== 0 || common.isNegativeZero(object)); -} - -module.exports = new Type('tag:yaml.org,2002:float', { - kind: 'scalar', - resolve: resolveYamlFloat, - construct: constructYamlFloat, - predicate: isFloat, - represent: representYamlFloat, - defaultStyle: 'lowercase' -}); - -/***/ }), -/* 902 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var Type = __webpack_require__(891); - -var YAML_DATE_REGEXP = new RegExp('^([0-9][0-9][0-9][0-9])' + // [1] year -'-([0-9][0-9])' + // [2] month -'-([0-9][0-9])$'); // [3] day - -var YAML_TIMESTAMP_REGEXP = new RegExp('^([0-9][0-9][0-9][0-9])' + // [1] year -'-([0-9][0-9]?)' + // [2] month -'-([0-9][0-9]?)' + // [3] day -'(?:[Tt]|[ \\t]+)' + // ... -'([0-9][0-9]?)' + // [4] hour -':([0-9][0-9])' + // [5] minute -':([0-9][0-9])' + // [6] second -'(?:\\.([0-9]*))?' + // [7] fraction -'(?:[ \\t]*(Z|([-+])([0-9][0-9]?)' + // [8] tz [9] tz_sign [10] tz_hour -'(?::([0-9][0-9]))?))?$'); // [11] tz_minute - -function resolveYamlTimestamp(data) { - if (data === null) return false; - if (YAML_DATE_REGEXP.exec(data) !== null) return true; - if (YAML_TIMESTAMP_REGEXP.exec(data) !== null) return true; - return false; -} - -function constructYamlTimestamp(data) { - var match, - year, - month, - day, - hour, - minute, - second, - fraction = 0, - delta = null, - tz_hour, - tz_minute, - date; - match = YAML_DATE_REGEXP.exec(data); - if (match === null) match = YAML_TIMESTAMP_REGEXP.exec(data); - if (match === null) throw new Error('Date resolve error'); // match: [1] year [2] month [3] day - - year = +match[1]; - month = +match[2] - 1; // JS month starts with 0 - - day = +match[3]; - - if (!match[4]) { - // no hour - return new Date(Date.UTC(year, month, day)); - } // match: [4] hour [5] minute [6] second [7] fraction - - - hour = +match[4]; - minute = +match[5]; - second = +match[6]; - - if (match[7]) { - fraction = match[7].slice(0, 3); - - while (fraction.length < 3) { - // milli-seconds - fraction += '0'; - } - - fraction = +fraction; - } // match: [8] tz [9] tz_sign [10] tz_hour [11] tz_minute - - - if (match[9]) { - tz_hour = +match[10]; - tz_minute = +(match[11] || 0); - delta = (tz_hour * 60 + tz_minute) * 60000; // delta in mili-seconds - - if (match[9] === '-') delta = -delta; - } - - date = new Date(Date.UTC(year, month, day, hour, minute, second, fraction)); - if (delta) date.setTime(date.getTime() - delta); - return date; -} - -function representYamlTimestamp(object -/*, style*/ -) { - return object.toISOString(); -} - -module.exports = new Type('tag:yaml.org,2002:timestamp', { - kind: 'scalar', - resolve: resolveYamlTimestamp, - construct: constructYamlTimestamp, - instanceOf: Date, - represent: representYamlTimestamp -}); - -/***/ }), -/* 903 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var Type = __webpack_require__(891); - -function resolveYamlMerge(data) { - return data === '<<' || data === null; -} - -module.exports = new Type('tag:yaml.org,2002:merge', { - kind: 'scalar', - resolve: resolveYamlMerge -}); - -/***/ }), -/* 904 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - -/*eslint-disable no-bitwise*/ - -var NodeBuffer; - -try { - // A trick for browserified version, to not include `Buffer` shim - var _require = undefined; - NodeBuffer = __webpack_require__(905).Buffer; -} catch (__) {} - -var Type = __webpack_require__(891); // [ 64, 65, 66 ] -> [ padding, CR, LF ] - - -var BASE64_MAP = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r'; - -function resolveYamlBinary(data) { - if (data === null) return false; - var code, - idx, - bitlen = 0, - max = data.length, - map = BASE64_MAP; // Convert one by one. - - for (idx = 0; idx < max; idx++) { - code = map.indexOf(data.charAt(idx)); // Skip CR/LF - - if (code > 64) continue; // Fail on illegal characters - - if (code < 0) return false; - bitlen += 6; - } // If there are any bits left, source was corrupted - - - return bitlen % 8 === 0; -} - -function constructYamlBinary(data) { - var idx, - tailbits, - input = data.replace(/[\r\n=]/g, ''), - // remove CR/LF & padding to simplify scan - max = input.length, - map = BASE64_MAP, - bits = 0, - result = []; // Collect by 6*4 bits (3 bytes) - - for (idx = 0; idx < max; idx++) { - if (idx % 4 === 0 && idx) { - result.push(bits >> 16 & 0xFF); - result.push(bits >> 8 & 0xFF); - result.push(bits & 0xFF); - } - - bits = bits << 6 | map.indexOf(input.charAt(idx)); - } // Dump tail - - - tailbits = max % 4 * 6; - - if (tailbits === 0) { - result.push(bits >> 16 & 0xFF); - result.push(bits >> 8 & 0xFF); - result.push(bits & 0xFF); - } else if (tailbits === 18) { - result.push(bits >> 10 & 0xFF); - result.push(bits >> 2 & 0xFF); - } else if (tailbits === 12) { - result.push(bits >> 4 & 0xFF); - } // Wrap into Buffer for NodeJS and leave Array for browser - - - if (NodeBuffer) { - // Support node 6.+ Buffer API when available - return NodeBuffer.from ? NodeBuffer.from(result) : new NodeBuffer(result); - } - - return result; -} - -function representYamlBinary(object -/*, style*/ -) { - var result = '', - bits = 0, - idx, - tail, - max = object.length, - map = BASE64_MAP; // Convert every three bytes to 4 ASCII characters. - - for (idx = 0; idx < max; idx++) { - if (idx % 3 === 0 && idx) { - result += map[bits >> 18 & 0x3F]; - result += map[bits >> 12 & 0x3F]; - result += map[bits >> 6 & 0x3F]; - result += map[bits & 0x3F]; - } - - bits = (bits << 8) + object[idx]; - } // Dump tail - - - tail = max % 3; - - if (tail === 0) { - result += map[bits >> 18 & 0x3F]; - result += map[bits >> 12 & 0x3F]; - result += map[bits >> 6 & 0x3F]; - result += map[bits & 0x3F]; - } else if (tail === 2) { - result += map[bits >> 10 & 0x3F]; - result += map[bits >> 4 & 0x3F]; - result += map[bits << 2 & 0x3F]; - result += map[64]; - } else if (tail === 1) { - result += map[bits >> 2 & 0x3F]; - result += map[bits << 4 & 0x3F]; - result += map[64]; - result += map[64]; - } - - return result; -} - -function isBinary(object) { - return NodeBuffer && NodeBuffer.isBuffer(object); -} - -module.exports = new Type('tag:yaml.org,2002:binary', { - kind: 'scalar', - resolve: resolveYamlBinary, - construct: constructYamlBinary, - predicate: isBinary, - represent: representYamlBinary -}); - -/***/ }), -/* 905 */ -/***/ ((module) => { - -"use strict"; -module.exports = require("buffer"); - -/***/ }), -/* 906 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var Type = __webpack_require__(891); - -var _hasOwnProperty = Object.prototype.hasOwnProperty; -var _toString = Object.prototype.toString; - -function resolveYamlOmap(data) { - if (data === null) return true; - var objectKeys = [], - index, - length, - pair, - pairKey, - pairHasKey, - object = data; - - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; - pairHasKey = false; - if (_toString.call(pair) !== '[object Object]') return false; - - for (pairKey in pair) { - if (_hasOwnProperty.call(pair, pairKey)) { - if (!pairHasKey) pairHasKey = true;else return false; - } - } - - if (!pairHasKey) return false; - if (objectKeys.indexOf(pairKey) === -1) objectKeys.push(pairKey);else return false; - } - - return true; -} - -function constructYamlOmap(data) { - return data !== null ? data : []; -} - -module.exports = new Type('tag:yaml.org,2002:omap', { - kind: 'sequence', - resolve: resolveYamlOmap, - construct: constructYamlOmap -}); - -/***/ }), -/* 907 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var Type = __webpack_require__(891); - -var _toString = Object.prototype.toString; - -function resolveYamlPairs(data) { - if (data === null) return true; - var index, - length, - pair, - keys, - result, - object = data; - result = new Array(object.length); - - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; - if (_toString.call(pair) !== '[object Object]') return false; - keys = Object.keys(pair); - if (keys.length !== 1) return false; - result[index] = [keys[0], pair[keys[0]]]; - } - - return true; -} - -function constructYamlPairs(data) { - if (data === null) return []; - var index, - length, - pair, - keys, - result, - object = data; - result = new Array(object.length); - - for (index = 0, length = object.length; index < length; index += 1) { - pair = object[index]; - keys = Object.keys(pair); - result[index] = [keys[0], pair[keys[0]]]; - } - - return result; -} - -module.exports = new Type('tag:yaml.org,2002:pairs', { - kind: 'sequence', - resolve: resolveYamlPairs, - construct: constructYamlPairs -}); - -/***/ }), -/* 908 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var Type = __webpack_require__(891); - -var _hasOwnProperty = Object.prototype.hasOwnProperty; - -function resolveYamlSet(data) { - if (data === null) return true; - var key, - object = data; - - for (key in object) { - if (_hasOwnProperty.call(object, key)) { - if (object[key] !== null) return false; - } - } - - return true; -} - -function constructYamlSet(data) { - return data !== null ? data : {}; -} - -module.exports = new Type('tag:yaml.org,2002:set', { - kind: 'mapping', - resolve: resolveYamlSet, - construct: constructYamlSet -}); - -/***/ }), -/* 909 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; -// JS-YAML's default schema for `load` function. -// It is not described in the YAML specification. -// -// This schema is based on JS-YAML's default safe schema and includes -// JavaScript-specific types: !!js/undefined, !!js/regexp and !!js/function. -// -// Also this schema is used as default base schema at `Schema.create` function. - - -var Schema = __webpack_require__(890); - -module.exports = Schema.DEFAULT = new Schema({ - include: [__webpack_require__(889)], - explicit: [__webpack_require__(910), __webpack_require__(911), __webpack_require__(912)] -}); - -/***/ }), -/* 910 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var Type = __webpack_require__(891); - -function resolveJavascriptUndefined() { - return true; -} - -function constructJavascriptUndefined() { - /*eslint-disable no-undefined*/ - return undefined; -} - -function representJavascriptUndefined() { - return ''; -} - -function isUndefined(object) { - return typeof object === 'undefined'; -} - -module.exports = new Type('tag:yaml.org,2002:js/undefined', { - kind: 'scalar', - resolve: resolveJavascriptUndefined, - construct: constructJavascriptUndefined, - predicate: isUndefined, - represent: representJavascriptUndefined -}); - -/***/ }), -/* 911 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var Type = __webpack_require__(891); - -function resolveJavascriptRegExp(data) { - if (data === null) return false; - if (data.length === 0) return false; - var regexp = data, - tail = /\/([gim]*)$/.exec(data), - modifiers = ''; // if regexp starts with '/' it can have modifiers and must be properly closed - // `/foo/gim` - modifiers tail can be maximum 3 chars - - if (regexp[0] === '/') { - if (tail) modifiers = tail[1]; - if (modifiers.length > 3) return false; // if expression starts with /, is should be properly terminated - - if (regexp[regexp.length - modifiers.length - 1] !== '/') return false; - } - - return true; -} - -function constructJavascriptRegExp(data) { - var regexp = data, - tail = /\/([gim]*)$/.exec(data), - modifiers = ''; // `/foo/gim` - tail can be maximum 4 chars - - if (regexp[0] === '/') { - if (tail) modifiers = tail[1]; - regexp = regexp.slice(1, regexp.length - modifiers.length - 1); - } - - return new RegExp(regexp, modifiers); -} - -function representJavascriptRegExp(object -/*, style*/ -) { - var result = '/' + object.source + '/'; - if (object.global) result += 'g'; - if (object.multiline) result += 'm'; - if (object.ignoreCase) result += 'i'; - return result; -} - -function isRegExp(object) { - return Object.prototype.toString.call(object) === '[object RegExp]'; -} - -module.exports = new Type('tag:yaml.org,2002:js/regexp', { - kind: 'scalar', - resolve: resolveJavascriptRegExp, - construct: constructJavascriptRegExp, - predicate: isRegExp, - represent: representJavascriptRegExp -}); - -/***/ }), -/* 912 */ -/***/ ((module, __unused_webpack_exports, __webpack_require__) => { - -"use strict"; - - -var esprima; // Browserified version does not have esprima -// -// 1. For node.js just require module as deps -// 2. For browser try to require mudule via external AMD system. -// If not found - try to fallback to window.esprima. If not -// found too - then fail to parse. -// - -try { - // workaround to exclude package from browserify list. - var _require = undefined; - esprima = __webpack_require__(913); -} catch (_) { - /* eslint-disable no-redeclare */ - - /* global window */ - if (typeof window !== 'undefined') esprima = window.esprima; -} - -var Type = __webpack_require__(891); - -function resolveJavascriptFunction(data) { - if (data === null) return false; - - try { - var source = '(' + data + ')', - ast = esprima.parse(source, { - range: true - }); - - if (ast.type !== 'Program' || ast.body.length !== 1 || ast.body[0].type !== 'ExpressionStatement' || ast.body[0].expression.type !== 'ArrowFunctionExpression' && ast.body[0].expression.type !== 'FunctionExpression') { - return false; - } - - return true; - } catch (err) { - return false; - } -} - -function constructJavascriptFunction(data) { - /*jslint evil:true*/ - var source = '(' + data + ')', - ast = esprima.parse(source, { - range: true - }), - params = [], - body; - - if (ast.type !== 'Program' || ast.body.length !== 1 || ast.body[0].type !== 'ExpressionStatement' || ast.body[0].expression.type !== 'ArrowFunctionExpression' && ast.body[0].expression.type !== 'FunctionExpression') { - throw new Error('Failed to resolve function'); - } - - ast.body[0].expression.params.forEach(function (param) { - params.push(param.name); - }); - body = ast.body[0].expression.body.range; // Esprima's ranges include the first '{' and the last '}' characters on - // function expressions. So cut them out. - - if (ast.body[0].expression.body.type === 'BlockStatement') { - /*eslint-disable no-new-func*/ - return new Function(params, source.slice(body[0] + 1, body[1] - 1)); - } // ES6 arrow functions can omit the BlockStatement. In that case, just return - // the body. - - /*eslint-disable no-new-func*/ - - - return new Function(params, 'return ' + source.slice(body[0], body[1])); -} - -function representJavascriptFunction(object -/*, style*/ -) { - return object.toString(); -} - -function isFunction(object) { - return Object.prototype.toString.call(object) === '[object Function]'; -} - -module.exports = new Type('tag:yaml.org,2002:js/function', { - kind: 'scalar', - resolve: resolveJavascriptFunction, - construct: constructJavascriptFunction, - predicate: isFunction, - represent: representJavascriptFunction -}); - -/***/ }), -/* 913 */ -/***/ (function(module) { - -(function webpackUniversalModuleDefinition(root, factory) { - /* istanbul ignore next */ - if (true) module.exports = factory();else {} -})(this, function () { - return ( - /******/ - function (modules) { - // webpackBootstrap - - /******/ - // The module cache - - /******/ - var installedModules = {}; - /******/ - // The require function - - /******/ - - function __nested_webpack_require_646__(moduleId) { - /******/ - // Check if module is in cache - - /* istanbul ignore if */ - - /******/ - if (installedModules[moduleId]) - /******/ - return installedModules[moduleId].exports; - /******/ - // Create a new module (and put it into the cache) - - /******/ - - var module = installedModules[moduleId] = { - /******/ - exports: {}, - - /******/ - id: moduleId, - - /******/ - loaded: false - /******/ - - }; - /******/ - // Execute the module function - - /******/ - - modules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_646__); - /******/ - // Flag the module as loaded - - /******/ - - module.loaded = true; - /******/ - // Return the exports of the module - - /******/ - - return module.exports; - /******/ - } - /******/ - // expose the modules object (__webpack_modules__) - - /******/ - - - __nested_webpack_require_646__.m = modules; - /******/ - // expose the module cache - - /******/ - - __nested_webpack_require_646__.c = installedModules; - /******/ - // __webpack_public_path__ - - /******/ - - __nested_webpack_require_646__.p = ""; - /******/ - // Load entry module and return exports - - /******/ - - return __nested_webpack_require_646__(0); - /******/ - }([ - /* 0 */ - - /***/ - function (module, exports, __nested_webpack_require_2155__) { - "use strict"; - /* - Copyright JS Foundation and other contributors, https://js.foundation/ - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var comment_handler_1 = __nested_webpack_require_2155__(1); - - var jsx_parser_1 = __nested_webpack_require_2155__(3); - - var parser_1 = __nested_webpack_require_2155__(8); - - var tokenizer_1 = __nested_webpack_require_2155__(15); - - function parse(code, options, delegate) { - var commentHandler = null; - - var proxyDelegate = function (node, metadata) { - if (delegate) { - delegate(node, metadata); - } - - if (commentHandler) { - commentHandler.visit(node, metadata); - } - }; - - var parserDelegate = typeof delegate === 'function' ? proxyDelegate : null; - var collectComment = false; - - if (options) { - collectComment = typeof options.comment === 'boolean' && options.comment; - var attachComment = typeof options.attachComment === 'boolean' && options.attachComment; - - if (collectComment || attachComment) { - commentHandler = new comment_handler_1.CommentHandler(); - commentHandler.attach = attachComment; - options.comment = true; - parserDelegate = proxyDelegate; - } - } - - var isModule = false; - - if (options && typeof options.sourceType === 'string') { - isModule = options.sourceType === 'module'; - } - - var parser; - - if (options && typeof options.jsx === 'boolean' && options.jsx) { - parser = new jsx_parser_1.JSXParser(code, options, parserDelegate); - } else { - parser = new parser_1.Parser(code, options, parserDelegate); - } - - var program = isModule ? parser.parseModule() : parser.parseScript(); - var ast = program; - - if (collectComment && commentHandler) { - ast.comments = commentHandler.comments; - } - - if (parser.config.tokens) { - ast.tokens = parser.tokens; - } - - if (parser.config.tolerant) { - ast.errors = parser.errorHandler.errors; - } - - return ast; - } - - exports.parse = parse; - - function parseModule(code, options, delegate) { - var parsingOptions = options || {}; - parsingOptions.sourceType = 'module'; - return parse(code, parsingOptions, delegate); - } - - exports.parseModule = parseModule; - - function parseScript(code, options, delegate) { - var parsingOptions = options || {}; - parsingOptions.sourceType = 'script'; - return parse(code, parsingOptions, delegate); - } - - exports.parseScript = parseScript; - - function tokenize(code, options, delegate) { - var tokenizer = new tokenizer_1.Tokenizer(code, options); - var tokens; - tokens = []; - - try { - while (true) { - var token = tokenizer.getNextToken(); - - if (!token) { - break; - } - - if (delegate) { - token = delegate(token); - } - - tokens.push(token); - } - } catch (e) { - tokenizer.errorHandler.tolerate(e); - } - - if (tokenizer.errorHandler.tolerant) { - tokens.errors = tokenizer.errors(); - } - - return tokens; - } - - exports.tokenize = tokenize; - - var syntax_1 = __nested_webpack_require_2155__(2); - - exports.Syntax = syntax_1.Syntax; // Sync with *.json manifests. - - exports.version = '4.0.1'; - /***/ - }, - /* 1 */ - - /***/ - function (module, exports, __nested_webpack_require_7174__) { - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var syntax_1 = __nested_webpack_require_7174__(2); - - var CommentHandler = function () { - function CommentHandler() { - this.attach = false; - this.comments = []; - this.stack = []; - this.leading = []; - this.trailing = []; - } - - CommentHandler.prototype.insertInnerComments = function (node, metadata) { - // innnerComments for properties empty block - // `function a() {/** comments **\/}` - if (node.type === syntax_1.Syntax.BlockStatement && node.body.length === 0) { - var innerComments = []; - - for (var i = this.leading.length - 1; i >= 0; --i) { - var entry = this.leading[i]; - - if (metadata.end.offset >= entry.start) { - innerComments.unshift(entry.comment); - this.leading.splice(i, 1); - this.trailing.splice(i, 1); - } - } - - if (innerComments.length) { - node.innerComments = innerComments; - } - } - }; - - CommentHandler.prototype.findTrailingComments = function (metadata) { - var trailingComments = []; - - if (this.trailing.length > 0) { - for (var i = this.trailing.length - 1; i >= 0; --i) { - var entry_1 = this.trailing[i]; - - if (entry_1.start >= metadata.end.offset) { - trailingComments.unshift(entry_1.comment); - } - } - - this.trailing.length = 0; - return trailingComments; - } - - var entry = this.stack[this.stack.length - 1]; - - if (entry && entry.node.trailingComments) { - var firstComment = entry.node.trailingComments[0]; - - if (firstComment && firstComment.range[0] >= metadata.end.offset) { - trailingComments = entry.node.trailingComments; - delete entry.node.trailingComments; - } - } - - return trailingComments; - }; - - CommentHandler.prototype.findLeadingComments = function (metadata) { - var leadingComments = []; - var target; - - while (this.stack.length > 0) { - var entry = this.stack[this.stack.length - 1]; - - if (entry && entry.start >= metadata.start.offset) { - target = entry.node; - this.stack.pop(); - } else { - break; - } - } - - if (target) { - var count = target.leadingComments ? target.leadingComments.length : 0; - - for (var i = count - 1; i >= 0; --i) { - var comment = target.leadingComments[i]; - - if (comment.range[1] <= metadata.start.offset) { - leadingComments.unshift(comment); - target.leadingComments.splice(i, 1); - } - } - - if (target.leadingComments && target.leadingComments.length === 0) { - delete target.leadingComments; - } - - return leadingComments; - } - - for (var i = this.leading.length - 1; i >= 0; --i) { - var entry = this.leading[i]; - - if (entry.start <= metadata.start.offset) { - leadingComments.unshift(entry.comment); - this.leading.splice(i, 1); - } - } - - return leadingComments; - }; - - CommentHandler.prototype.visitNode = function (node, metadata) { - if (node.type === syntax_1.Syntax.Program && node.body.length > 0) { - return; - } - - this.insertInnerComments(node, metadata); - var trailingComments = this.findTrailingComments(metadata); - var leadingComments = this.findLeadingComments(metadata); - - if (leadingComments.length > 0) { - node.leadingComments = leadingComments; - } - - if (trailingComments.length > 0) { - node.trailingComments = trailingComments; - } - - this.stack.push({ - node: node, - start: metadata.start.offset - }); - }; - - CommentHandler.prototype.visitComment = function (node, metadata) { - var type = node.type[0] === 'L' ? 'Line' : 'Block'; - var comment = { - type: type, - value: node.value - }; - - if (node.range) { - comment.range = node.range; - } - - if (node.loc) { - comment.loc = node.loc; - } - - this.comments.push(comment); - - if (this.attach) { - var entry = { - comment: { - type: type, - value: node.value, - range: [metadata.start.offset, metadata.end.offset] - }, - start: metadata.start.offset - }; - - if (node.loc) { - entry.comment.loc = node.loc; - } - - node.type = type; - this.leading.push(entry); - this.trailing.push(entry); - } - }; - - CommentHandler.prototype.visit = function (node, metadata) { - if (node.type === 'LineComment') { - this.visitComment(node, metadata); - } else if (node.type === 'BlockComment') { - this.visitComment(node, metadata); - } else if (this.attach) { - this.visitNode(node, metadata); - } - }; - - return CommentHandler; - }(); - - exports.CommentHandler = CommentHandler; - /***/ - }, - /* 2 */ - - /***/ - function (module, exports) { - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.Syntax = { - AssignmentExpression: 'AssignmentExpression', - AssignmentPattern: 'AssignmentPattern', - ArrayExpression: 'ArrayExpression', - ArrayPattern: 'ArrayPattern', - ArrowFunctionExpression: 'ArrowFunctionExpression', - AwaitExpression: 'AwaitExpression', - BlockStatement: 'BlockStatement', - BinaryExpression: 'BinaryExpression', - BreakStatement: 'BreakStatement', - CallExpression: 'CallExpression', - CatchClause: 'CatchClause', - ClassBody: 'ClassBody', - ClassDeclaration: 'ClassDeclaration', - ClassExpression: 'ClassExpression', - ConditionalExpression: 'ConditionalExpression', - ContinueStatement: 'ContinueStatement', - DoWhileStatement: 'DoWhileStatement', - DebuggerStatement: 'DebuggerStatement', - EmptyStatement: 'EmptyStatement', - ExportAllDeclaration: 'ExportAllDeclaration', - ExportDefaultDeclaration: 'ExportDefaultDeclaration', - ExportNamedDeclaration: 'ExportNamedDeclaration', - ExportSpecifier: 'ExportSpecifier', - ExpressionStatement: 'ExpressionStatement', - ForStatement: 'ForStatement', - ForOfStatement: 'ForOfStatement', - ForInStatement: 'ForInStatement', - FunctionDeclaration: 'FunctionDeclaration', - FunctionExpression: 'FunctionExpression', - Identifier: 'Identifier', - IfStatement: 'IfStatement', - ImportDeclaration: 'ImportDeclaration', - ImportDefaultSpecifier: 'ImportDefaultSpecifier', - ImportNamespaceSpecifier: 'ImportNamespaceSpecifier', - ImportSpecifier: 'ImportSpecifier', - Literal: 'Literal', - LabeledStatement: 'LabeledStatement', - LogicalExpression: 'LogicalExpression', - MemberExpression: 'MemberExpression', - MetaProperty: 'MetaProperty', - MethodDefinition: 'MethodDefinition', - NewExpression: 'NewExpression', - ObjectExpression: 'ObjectExpression', - ObjectPattern: 'ObjectPattern', - Program: 'Program', - Property: 'Property', - RestElement: 'RestElement', - ReturnStatement: 'ReturnStatement', - SequenceExpression: 'SequenceExpression', - SpreadElement: 'SpreadElement', - Super: 'Super', - SwitchCase: 'SwitchCase', - SwitchStatement: 'SwitchStatement', - TaggedTemplateExpression: 'TaggedTemplateExpression', - TemplateElement: 'TemplateElement', - TemplateLiteral: 'TemplateLiteral', - ThisExpression: 'ThisExpression', - ThrowStatement: 'ThrowStatement', - TryStatement: 'TryStatement', - UnaryExpression: 'UnaryExpression', - UpdateExpression: 'UpdateExpression', - VariableDeclaration: 'VariableDeclaration', - VariableDeclarator: 'VariableDeclarator', - WhileStatement: 'WhileStatement', - WithStatement: 'WithStatement', - YieldExpression: 'YieldExpression' - }; - /***/ - }, - /* 3 */ - - /***/ - function (module, exports, __nested_webpack_require_16002__) { - "use strict"; - /* istanbul ignore next */ - - var __extends = this && this.__extends || function () { - var extendStatics = Object.setPrototypeOf || { - __proto__: [] - } instanceof Array && function (d, b) { - d.__proto__ = b; - } || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - }; - - return function (d, b) { - extendStatics(d, b); - - function __() { - this.constructor = d; - } - - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); - }; - }(); - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var character_1 = __nested_webpack_require_16002__(4); - - var JSXNode = __nested_webpack_require_16002__(5); - - var jsx_syntax_1 = __nested_webpack_require_16002__(6); - - var Node = __nested_webpack_require_16002__(7); - - var parser_1 = __nested_webpack_require_16002__(8); - - var token_1 = __nested_webpack_require_16002__(13); - - var xhtml_entities_1 = __nested_webpack_require_16002__(14); - - token_1.TokenName[100 - /* Identifier */ - ] = 'JSXIdentifier'; - token_1.TokenName[101 - /* Text */ - ] = 'JSXText'; // Fully qualified element name, e.g. returns "svg:path" - - function getQualifiedElementName(elementName) { - var qualifiedName; - - switch (elementName.type) { - case jsx_syntax_1.JSXSyntax.JSXIdentifier: - var id = elementName; - qualifiedName = id.name; - break; - - case jsx_syntax_1.JSXSyntax.JSXNamespacedName: - var ns = elementName; - qualifiedName = getQualifiedElementName(ns.namespace) + ':' + getQualifiedElementName(ns.name); - break; - - case jsx_syntax_1.JSXSyntax.JSXMemberExpression: - var expr = elementName; - qualifiedName = getQualifiedElementName(expr.object) + '.' + getQualifiedElementName(expr.property); - break; - - /* istanbul ignore next */ - - default: - break; - } - - return qualifiedName; - } - - var JSXParser = function (_super) { - __extends(JSXParser, _super); - - function JSXParser(code, options, delegate) { - return _super.call(this, code, options, delegate) || this; - } - - JSXParser.prototype.parsePrimaryExpression = function () { - return this.match('<') ? this.parseJSXRoot() : _super.prototype.parsePrimaryExpression.call(this); - }; - - JSXParser.prototype.startJSX = function () { - // Unwind the scanner before the lookahead token. - this.scanner.index = this.startMarker.index; - this.scanner.lineNumber = this.startMarker.line; - this.scanner.lineStart = this.startMarker.index - this.startMarker.column; - }; - - JSXParser.prototype.finishJSX = function () { - // Prime the next lookahead. - this.nextToken(); - }; - - JSXParser.prototype.reenterJSX = function () { - this.startJSX(); - this.expectJSX('}'); // Pop the closing '}' added from the lookahead. - - if (this.config.tokens) { - this.tokens.pop(); - } - }; - - JSXParser.prototype.createJSXNode = function () { - this.collectComments(); - return { - index: this.scanner.index, - line: this.scanner.lineNumber, - column: this.scanner.index - this.scanner.lineStart - }; - }; - - JSXParser.prototype.createJSXChildNode = function () { - return { - index: this.scanner.index, - line: this.scanner.lineNumber, - column: this.scanner.index - this.scanner.lineStart - }; - }; - - JSXParser.prototype.scanXHTMLEntity = function (quote) { - var result = '&'; - var valid = true; - var terminated = false; - var numeric = false; - var hex = false; - - while (!this.scanner.eof() && valid && !terminated) { - var ch = this.scanner.source[this.scanner.index]; - - if (ch === quote) { - break; - } - - terminated = ch === ';'; - result += ch; - ++this.scanner.index; - - if (!terminated) { - switch (result.length) { - case 2: - // e.g. '{' - numeric = ch === '#'; - break; - - case 3: - if (numeric) { - // e.g. 'A' - hex = ch === 'x'; - valid = hex || character_1.Character.isDecimalDigit(ch.charCodeAt(0)); - numeric = numeric && !hex; - } - - break; - - default: - valid = valid && !(numeric && !character_1.Character.isDecimalDigit(ch.charCodeAt(0))); - valid = valid && !(hex && !character_1.Character.isHexDigit(ch.charCodeAt(0))); - break; - } - } - } - - if (valid && terminated && result.length > 2) { - // e.g. 'A' becomes just '#x41' - var str = result.substr(1, result.length - 2); - - if (numeric && str.length > 1) { - result = String.fromCharCode(parseInt(str.substr(1), 10)); - } else if (hex && str.length > 2) { - result = String.fromCharCode(parseInt('0' + str.substr(1), 16)); - } else if (!numeric && !hex && xhtml_entities_1.XHTMLEntities[str]) { - result = xhtml_entities_1.XHTMLEntities[str]; - } - } - - return result; - }; // Scan the next JSX token. This replaces Scanner#lex when in JSX mode. - - - JSXParser.prototype.lexJSX = function () { - var cp = this.scanner.source.charCodeAt(this.scanner.index); // < > / : = { } - - if (cp === 60 || cp === 62 || cp === 47 || cp === 58 || cp === 61 || cp === 123 || cp === 125) { - var value = this.scanner.source[this.scanner.index++]; - return { - type: 7 - /* Punctuator */ - , - value: value, - lineNumber: this.scanner.lineNumber, - lineStart: this.scanner.lineStart, - start: this.scanner.index - 1, - end: this.scanner.index - }; - } // " ' - - - if (cp === 34 || cp === 39) { - var start = this.scanner.index; - var quote = this.scanner.source[this.scanner.index++]; - var str = ''; - - while (!this.scanner.eof()) { - var ch = this.scanner.source[this.scanner.index++]; - - if (ch === quote) { - break; - } else if (ch === '&') { - str += this.scanXHTMLEntity(quote); - } else { - str += ch; - } - } - - return { - type: 8 - /* StringLiteral */ - , - value: str, - lineNumber: this.scanner.lineNumber, - lineStart: this.scanner.lineStart, - start: start, - end: this.scanner.index - }; - } // ... or . - - - if (cp === 46) { - var n1 = this.scanner.source.charCodeAt(this.scanner.index + 1); - var n2 = this.scanner.source.charCodeAt(this.scanner.index + 2); - var value = n1 === 46 && n2 === 46 ? '...' : '.'; - var start = this.scanner.index; - this.scanner.index += value.length; - return { - type: 7 - /* Punctuator */ - , - value: value, - lineNumber: this.scanner.lineNumber, - lineStart: this.scanner.lineStart, - start: start, - end: this.scanner.index - }; - } // ` - - - if (cp === 96) { - // Only placeholder, since it will be rescanned as a real assignment expression. - return { - type: 10 - /* Template */ - , - value: '', - lineNumber: this.scanner.lineNumber, - lineStart: this.scanner.lineStart, - start: this.scanner.index, - end: this.scanner.index - }; - } // Identifer can not contain backslash (char code 92). - - - if (character_1.Character.isIdentifierStart(cp) && cp !== 92) { - var start = this.scanner.index; - ++this.scanner.index; - - while (!this.scanner.eof()) { - var ch = this.scanner.source.charCodeAt(this.scanner.index); - - if (character_1.Character.isIdentifierPart(ch) && ch !== 92) { - ++this.scanner.index; - } else if (ch === 45) { - // Hyphen (char code 45) can be part of an identifier. - ++this.scanner.index; - } else { - break; - } - } - - var id = this.scanner.source.slice(start, this.scanner.index); - return { - type: 100 - /* Identifier */ - , - value: id, - lineNumber: this.scanner.lineNumber, - lineStart: this.scanner.lineStart, - start: start, - end: this.scanner.index - }; - } - - return this.scanner.lex(); - }; - - JSXParser.prototype.nextJSXToken = function () { - this.collectComments(); - this.startMarker.index = this.scanner.index; - this.startMarker.line = this.scanner.lineNumber; - this.startMarker.column = this.scanner.index - this.scanner.lineStart; - var token = this.lexJSX(); - this.lastMarker.index = this.scanner.index; - this.lastMarker.line = this.scanner.lineNumber; - this.lastMarker.column = this.scanner.index - this.scanner.lineStart; - - if (this.config.tokens) { - this.tokens.push(this.convertToken(token)); - } - - return token; - }; - - JSXParser.prototype.nextJSXText = function () { - this.startMarker.index = this.scanner.index; - this.startMarker.line = this.scanner.lineNumber; - this.startMarker.column = this.scanner.index - this.scanner.lineStart; - var start = this.scanner.index; - var text = ''; - - while (!this.scanner.eof()) { - var ch = this.scanner.source[this.scanner.index]; - - if (ch === '{' || ch === '<') { - break; - } - - ++this.scanner.index; - text += ch; - - if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) { - ++this.scanner.lineNumber; - - if (ch === '\r' && this.scanner.source[this.scanner.index] === '\n') { - ++this.scanner.index; - } - - this.scanner.lineStart = this.scanner.index; - } - } - - this.lastMarker.index = this.scanner.index; - this.lastMarker.line = this.scanner.lineNumber; - this.lastMarker.column = this.scanner.index - this.scanner.lineStart; - var token = { - type: 101 - /* Text */ - , - value: text, - lineNumber: this.scanner.lineNumber, - lineStart: this.scanner.lineStart, - start: start, - end: this.scanner.index - }; - - if (text.length > 0 && this.config.tokens) { - this.tokens.push(this.convertToken(token)); - } - - return token; - }; - - JSXParser.prototype.peekJSXToken = function () { - var state = this.scanner.saveState(); - this.scanner.scanComments(); - var next = this.lexJSX(); - this.scanner.restoreState(state); - return next; - }; // Expect the next JSX token to match the specified punctuator. - // If not, an exception will be thrown. - - - JSXParser.prototype.expectJSX = function (value) { - var token = this.nextJSXToken(); - - if (token.type !== 7 - /* Punctuator */ - || token.value !== value) { - this.throwUnexpectedToken(token); - } - }; // Return true if the next JSX token matches the specified punctuator. - - - JSXParser.prototype.matchJSX = function (value) { - var next = this.peekJSXToken(); - return next.type === 7 - /* Punctuator */ - && next.value === value; - }; - - JSXParser.prototype.parseJSXIdentifier = function () { - var node = this.createJSXNode(); - var token = this.nextJSXToken(); - - if (token.type !== 100 - /* Identifier */ - ) { - this.throwUnexpectedToken(token); - } - - return this.finalize(node, new JSXNode.JSXIdentifier(token.value)); - }; - - JSXParser.prototype.parseJSXElementName = function () { - var node = this.createJSXNode(); - var elementName = this.parseJSXIdentifier(); - - if (this.matchJSX(':')) { - var namespace = elementName; - this.expectJSX(':'); - var name_1 = this.parseJSXIdentifier(); - elementName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_1)); - } else if (this.matchJSX('.')) { - while (this.matchJSX('.')) { - var object = elementName; - this.expectJSX('.'); - var property = this.parseJSXIdentifier(); - elementName = this.finalize(node, new JSXNode.JSXMemberExpression(object, property)); - } - } - - return elementName; - }; - - JSXParser.prototype.parseJSXAttributeName = function () { - var node = this.createJSXNode(); - var attributeName; - var identifier = this.parseJSXIdentifier(); - - if (this.matchJSX(':')) { - var namespace = identifier; - this.expectJSX(':'); - var name_2 = this.parseJSXIdentifier(); - attributeName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_2)); - } else { - attributeName = identifier; - } - - return attributeName; - }; - - JSXParser.prototype.parseJSXStringLiteralAttribute = function () { - var node = this.createJSXNode(); - var token = this.nextJSXToken(); - - if (token.type !== 8 - /* StringLiteral */ - ) { - this.throwUnexpectedToken(token); - } - - var raw = this.getTokenRaw(token); - return this.finalize(node, new Node.Literal(token.value, raw)); - }; - - JSXParser.prototype.parseJSXExpressionAttribute = function () { - var node = this.createJSXNode(); - this.expectJSX('{'); - this.finishJSX(); - - if (this.match('}')) { - this.tolerateError('JSX attributes must only be assigned a non-empty expression'); - } - - var expression = this.parseAssignmentExpression(); - this.reenterJSX(); - return this.finalize(node, new JSXNode.JSXExpressionContainer(expression)); - }; - - JSXParser.prototype.parseJSXAttributeValue = function () { - return this.matchJSX('{') ? this.parseJSXExpressionAttribute() : this.matchJSX('<') ? this.parseJSXElement() : this.parseJSXStringLiteralAttribute(); - }; - - JSXParser.prototype.parseJSXNameValueAttribute = function () { - var node = this.createJSXNode(); - var name = this.parseJSXAttributeName(); - var value = null; - - if (this.matchJSX('=')) { - this.expectJSX('='); - value = this.parseJSXAttributeValue(); - } - - return this.finalize(node, new JSXNode.JSXAttribute(name, value)); - }; - - JSXParser.prototype.parseJSXSpreadAttribute = function () { - var node = this.createJSXNode(); - this.expectJSX('{'); - this.expectJSX('...'); - this.finishJSX(); - var argument = this.parseAssignmentExpression(); - this.reenterJSX(); - return this.finalize(node, new JSXNode.JSXSpreadAttribute(argument)); - }; - - JSXParser.prototype.parseJSXAttributes = function () { - var attributes = []; - - while (!this.matchJSX('/') && !this.matchJSX('>')) { - var attribute = this.matchJSX('{') ? this.parseJSXSpreadAttribute() : this.parseJSXNameValueAttribute(); - attributes.push(attribute); - } - - return attributes; - }; - - JSXParser.prototype.parseJSXOpeningElement = function () { - var node = this.createJSXNode(); - this.expectJSX('<'); - var name = this.parseJSXElementName(); - var attributes = this.parseJSXAttributes(); - var selfClosing = this.matchJSX('/'); - - if (selfClosing) { - this.expectJSX('/'); - } - - this.expectJSX('>'); - return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes)); - }; - - JSXParser.prototype.parseJSXBoundaryElement = function () { - var node = this.createJSXNode(); - this.expectJSX('<'); - - if (this.matchJSX('/')) { - this.expectJSX('/'); - var name_3 = this.parseJSXElementName(); - this.expectJSX('>'); - return this.finalize(node, new JSXNode.JSXClosingElement(name_3)); - } - - var name = this.parseJSXElementName(); - var attributes = this.parseJSXAttributes(); - var selfClosing = this.matchJSX('/'); - - if (selfClosing) { - this.expectJSX('/'); - } - - this.expectJSX('>'); - return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes)); - }; - - JSXParser.prototype.parseJSXEmptyExpression = function () { - var node = this.createJSXChildNode(); - this.collectComments(); - this.lastMarker.index = this.scanner.index; - this.lastMarker.line = this.scanner.lineNumber; - this.lastMarker.column = this.scanner.index - this.scanner.lineStart; - return this.finalize(node, new JSXNode.JSXEmptyExpression()); - }; - - JSXParser.prototype.parseJSXExpressionContainer = function () { - var node = this.createJSXNode(); - this.expectJSX('{'); - var expression; - - if (this.matchJSX('}')) { - expression = this.parseJSXEmptyExpression(); - this.expectJSX('}'); - } else { - this.finishJSX(); - expression = this.parseAssignmentExpression(); - this.reenterJSX(); - } - - return this.finalize(node, new JSXNode.JSXExpressionContainer(expression)); - }; - - JSXParser.prototype.parseJSXChildren = function () { - var children = []; - - while (!this.scanner.eof()) { - var node = this.createJSXChildNode(); - var token = this.nextJSXText(); - - if (token.start < token.end) { - var raw = this.getTokenRaw(token); - var child = this.finalize(node, new JSXNode.JSXText(token.value, raw)); - children.push(child); - } - - if (this.scanner.source[this.scanner.index] === '{') { - var container = this.parseJSXExpressionContainer(); - children.push(container); - } else { - break; - } - } - - return children; - }; - - JSXParser.prototype.parseComplexJSXElement = function (el) { - var stack = []; - - while (!this.scanner.eof()) { - el.children = el.children.concat(this.parseJSXChildren()); - var node = this.createJSXChildNode(); - var element = this.parseJSXBoundaryElement(); - - if (element.type === jsx_syntax_1.JSXSyntax.JSXOpeningElement) { - var opening = element; - - if (opening.selfClosing) { - var child = this.finalize(node, new JSXNode.JSXElement(opening, [], null)); - el.children.push(child); - } else { - stack.push(el); - el = { - node: node, - opening: opening, - closing: null, - children: [] - }; - } - } - - if (element.type === jsx_syntax_1.JSXSyntax.JSXClosingElement) { - el.closing = element; - var open_1 = getQualifiedElementName(el.opening.name); - var close_1 = getQualifiedElementName(el.closing.name); - - if (open_1 !== close_1) { - this.tolerateError('Expected corresponding JSX closing tag for %0', open_1); - } - - if (stack.length > 0) { - var child = this.finalize(el.node, new JSXNode.JSXElement(el.opening, el.children, el.closing)); - el = stack[stack.length - 1]; - el.children.push(child); - stack.pop(); - } else { - break; - } - } - } - - return el; - }; - - JSXParser.prototype.parseJSXElement = function () { - var node = this.createJSXNode(); - var opening = this.parseJSXOpeningElement(); - var children = []; - var closing = null; - - if (!opening.selfClosing) { - var el = this.parseComplexJSXElement({ - node: node, - opening: opening, - closing: closing, - children: children - }); - children = el.children; - closing = el.closing; - } - - return this.finalize(node, new JSXNode.JSXElement(opening, children, closing)); - }; - - JSXParser.prototype.parseJSXRoot = function () { - // Pop the opening '<' added from the lookahead. - if (this.config.tokens) { - this.tokens.pop(); - } - - this.startJSX(); - var element = this.parseJSXElement(); - this.finishJSX(); - return element; - }; - - JSXParser.prototype.isStartOfExpression = function () { - return _super.prototype.isStartOfExpression.call(this) || this.match('<'); - }; - - return JSXParser; - }(parser_1.Parser); - - exports.JSXParser = JSXParser; - /***/ - }, - /* 4 */ - - /***/ - function (module, exports) { - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); // See also tools/generate-unicode-regex.js. - - var Regex = { - // Unicode v8.0.0 NonAsciiIdentifierStart: - NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/, - // Unicode v8.0.0 NonAsciiIdentifierPart: - NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3C-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B5C\u0B5D\u0B5F-\u0B63\u0B66-\u0B6F\u0B71\u0B82\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD0\u0BD7\u0BE6-\u0BEF\u0C00-\u0C03\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C58-\u0C5A\u0C60-\u0C63\u0C66-\u0C6F\u0C81-\u0C83\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBC-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CDE\u0CE0-\u0CE3\u0CE6-\u0CEF\u0CF1\u0CF2\u0D01-\u0D03\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D-\u0D44\u0D46-\u0D48\u0D4A-\u0D4E\u0D57\u0D5F-\u0D63\u0D66-\u0D6F\u0D7A-\u0D7F\u0D82\u0D83\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DE6-\u0DEF\u0DF2\u0DF3\u0E01-\u0E3A\u0E40-\u0E4E\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABEA\uABEC\uABED\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE00-\uFE0F\uFE20-\uFE2F\uFE33\uFE34\uFE4D-\uFE4F\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF3F\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDDFD\uDE80-\uDE9C\uDEA0-\uDED0\uDEE0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF7A\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00-\uDE03\uDE05\uDE06\uDE0C-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE38-\uDE3A\uDE3F\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE6\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99\uDC9D\uDC9E]|\uD834[\uDD65-\uDD69\uDD6D-\uDD72\uDD7B-\uDD82\uDD85-\uDD8B\uDDAA-\uDDAD\uDE42-\uDE44]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD836[\uDE00-\uDE36\uDE3B-\uDE6C\uDE75\uDE84\uDE9B-\uDE9F\uDEA1-\uDEAF]|\uD83A[\uDC00-\uDCC4\uDCD0-\uDCD6]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]|\uDB40[\uDD00-\uDDEF]/ - }; - exports.Character = { - /* tslint:disable:no-bitwise */ - fromCodePoint: function (cp) { - return cp < 0x10000 ? String.fromCharCode(cp) : String.fromCharCode(0xD800 + (cp - 0x10000 >> 10)) + String.fromCharCode(0xDC00 + (cp - 0x10000 & 1023)); - }, - // https://tc39.github.io/ecma262/#sec-white-space - isWhiteSpace: function (cp) { - return cp === 0x20 || cp === 0x09 || cp === 0x0B || cp === 0x0C || cp === 0xA0 || cp >= 0x1680 && [0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(cp) >= 0; - }, - // https://tc39.github.io/ecma262/#sec-line-terminators - isLineTerminator: function (cp) { - return cp === 0x0A || cp === 0x0D || cp === 0x2028 || cp === 0x2029; - }, - // https://tc39.github.io/ecma262/#sec-names-and-keywords - isIdentifierStart: function (cp) { - return cp === 0x24 || cp === 0x5F || cp >= 0x41 && cp <= 0x5A || cp >= 0x61 && cp <= 0x7A || cp === 0x5C || cp >= 0x80 && Regex.NonAsciiIdentifierStart.test(exports.Character.fromCodePoint(cp)); - }, - isIdentifierPart: function (cp) { - return cp === 0x24 || cp === 0x5F || cp >= 0x41 && cp <= 0x5A || cp >= 0x61 && cp <= 0x7A || cp >= 0x30 && cp <= 0x39 || cp === 0x5C || cp >= 0x80 && Regex.NonAsciiIdentifierPart.test(exports.Character.fromCodePoint(cp)); - }, - // https://tc39.github.io/ecma262/#sec-literals-numeric-literals - isDecimalDigit: function (cp) { - return cp >= 0x30 && cp <= 0x39; // 0..9 - }, - isHexDigit: function (cp) { - return cp >= 0x30 && cp <= 0x39 || cp >= 0x41 && cp <= 0x46 || cp >= 0x61 && cp <= 0x66; // a..f - }, - isOctalDigit: function (cp) { - return cp >= 0x30 && cp <= 0x37; // 0..7 - } - }; - /***/ - }, - /* 5 */ - - /***/ - function (module, exports, __nested_webpack_require_55533__) { - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var jsx_syntax_1 = __nested_webpack_require_55533__(6); - /* tslint:disable:max-classes-per-file */ - - - var JSXClosingElement = function () { - function JSXClosingElement(name) { - this.type = jsx_syntax_1.JSXSyntax.JSXClosingElement; - this.name = name; - } - - return JSXClosingElement; - }(); - - exports.JSXClosingElement = JSXClosingElement; - - var JSXElement = function () { - function JSXElement(openingElement, children, closingElement) { - this.type = jsx_syntax_1.JSXSyntax.JSXElement; - this.openingElement = openingElement; - this.children = children; - this.closingElement = closingElement; - } - - return JSXElement; - }(); - - exports.JSXElement = JSXElement; - - var JSXEmptyExpression = function () { - function JSXEmptyExpression() { - this.type = jsx_syntax_1.JSXSyntax.JSXEmptyExpression; - } - - return JSXEmptyExpression; - }(); - - exports.JSXEmptyExpression = JSXEmptyExpression; - - var JSXExpressionContainer = function () { - function JSXExpressionContainer(expression) { - this.type = jsx_syntax_1.JSXSyntax.JSXExpressionContainer; - this.expression = expression; - } - - return JSXExpressionContainer; - }(); - - exports.JSXExpressionContainer = JSXExpressionContainer; - - var JSXIdentifier = function () { - function JSXIdentifier(name) { - this.type = jsx_syntax_1.JSXSyntax.JSXIdentifier; - this.name = name; - } - - return JSXIdentifier; - }(); - - exports.JSXIdentifier = JSXIdentifier; - - var JSXMemberExpression = function () { - function JSXMemberExpression(object, property) { - this.type = jsx_syntax_1.JSXSyntax.JSXMemberExpression; - this.object = object; - this.property = property; - } - - return JSXMemberExpression; - }(); - - exports.JSXMemberExpression = JSXMemberExpression; - - var JSXAttribute = function () { - function JSXAttribute(name, value) { - this.type = jsx_syntax_1.JSXSyntax.JSXAttribute; - this.name = name; - this.value = value; - } - - return JSXAttribute; - }(); - - exports.JSXAttribute = JSXAttribute; - - var JSXNamespacedName = function () { - function JSXNamespacedName(namespace, name) { - this.type = jsx_syntax_1.JSXSyntax.JSXNamespacedName; - this.namespace = namespace; - this.name = name; - } - - return JSXNamespacedName; - }(); - - exports.JSXNamespacedName = JSXNamespacedName; - - var JSXOpeningElement = function () { - function JSXOpeningElement(name, selfClosing, attributes) { - this.type = jsx_syntax_1.JSXSyntax.JSXOpeningElement; - this.name = name; - this.selfClosing = selfClosing; - this.attributes = attributes; - } - - return JSXOpeningElement; - }(); - - exports.JSXOpeningElement = JSXOpeningElement; - - var JSXSpreadAttribute = function () { - function JSXSpreadAttribute(argument) { - this.type = jsx_syntax_1.JSXSyntax.JSXSpreadAttribute; - this.argument = argument; - } - - return JSXSpreadAttribute; - }(); - - exports.JSXSpreadAttribute = JSXSpreadAttribute; - - var JSXText = function () { - function JSXText(value, raw) { - this.type = jsx_syntax_1.JSXSyntax.JSXText; - this.value = value; - this.raw = raw; - } - - return JSXText; - }(); - - exports.JSXText = JSXText; - /***/ - }, - /* 6 */ - - /***/ - function (module, exports) { - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - exports.JSXSyntax = { - JSXAttribute: 'JSXAttribute', - JSXClosingElement: 'JSXClosingElement', - JSXElement: 'JSXElement', - JSXEmptyExpression: 'JSXEmptyExpression', - JSXExpressionContainer: 'JSXExpressionContainer', - JSXIdentifier: 'JSXIdentifier', - JSXMemberExpression: 'JSXMemberExpression', - JSXNamespacedName: 'JSXNamespacedName', - JSXOpeningElement: 'JSXOpeningElement', - JSXSpreadAttribute: 'JSXSpreadAttribute', - JSXText: 'JSXText' - }; - /***/ - }, - /* 7 */ - - /***/ - function (module, exports, __nested_webpack_require_60046__) { - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var syntax_1 = __nested_webpack_require_60046__(2); - /* tslint:disable:max-classes-per-file */ - - - var ArrayExpression = function () { - function ArrayExpression(elements) { - this.type = syntax_1.Syntax.ArrayExpression; - this.elements = elements; - } - - return ArrayExpression; - }(); - - exports.ArrayExpression = ArrayExpression; - - var ArrayPattern = function () { - function ArrayPattern(elements) { - this.type = syntax_1.Syntax.ArrayPattern; - this.elements = elements; - } - - return ArrayPattern; - }(); - - exports.ArrayPattern = ArrayPattern; - - var ArrowFunctionExpression = function () { - function ArrowFunctionExpression(params, body, expression) { - this.type = syntax_1.Syntax.ArrowFunctionExpression; - this.id = null; - this.params = params; - this.body = body; - this.generator = false; - this.expression = expression; - this.async = false; - } - - return ArrowFunctionExpression; - }(); - - exports.ArrowFunctionExpression = ArrowFunctionExpression; - - var AssignmentExpression = function () { - function AssignmentExpression(operator, left, right) { - this.type = syntax_1.Syntax.AssignmentExpression; - this.operator = operator; - this.left = left; - this.right = right; - } - - return AssignmentExpression; - }(); - - exports.AssignmentExpression = AssignmentExpression; - - var AssignmentPattern = function () { - function AssignmentPattern(left, right) { - this.type = syntax_1.Syntax.AssignmentPattern; - this.left = left; - this.right = right; - } - - return AssignmentPattern; - }(); - - exports.AssignmentPattern = AssignmentPattern; - - var AsyncArrowFunctionExpression = function () { - function AsyncArrowFunctionExpression(params, body, expression) { - this.type = syntax_1.Syntax.ArrowFunctionExpression; - this.id = null; - this.params = params; - this.body = body; - this.generator = false; - this.expression = expression; - this.async = true; - } - - return AsyncArrowFunctionExpression; - }(); - - exports.AsyncArrowFunctionExpression = AsyncArrowFunctionExpression; - - var AsyncFunctionDeclaration = function () { - function AsyncFunctionDeclaration(id, params, body) { - this.type = syntax_1.Syntax.FunctionDeclaration; - this.id = id; - this.params = params; - this.body = body; - this.generator = false; - this.expression = false; - this.async = true; - } - - return AsyncFunctionDeclaration; - }(); - - exports.AsyncFunctionDeclaration = AsyncFunctionDeclaration; - - var AsyncFunctionExpression = function () { - function AsyncFunctionExpression(id, params, body) { - this.type = syntax_1.Syntax.FunctionExpression; - this.id = id; - this.params = params; - this.body = body; - this.generator = false; - this.expression = false; - this.async = true; - } - - return AsyncFunctionExpression; - }(); - - exports.AsyncFunctionExpression = AsyncFunctionExpression; - - var AwaitExpression = function () { - function AwaitExpression(argument) { - this.type = syntax_1.Syntax.AwaitExpression; - this.argument = argument; - } - - return AwaitExpression; - }(); - - exports.AwaitExpression = AwaitExpression; - - var BinaryExpression = function () { - function BinaryExpression(operator, left, right) { - var logical = operator === '||' || operator === '&&'; - this.type = logical ? syntax_1.Syntax.LogicalExpression : syntax_1.Syntax.BinaryExpression; - this.operator = operator; - this.left = left; - this.right = right; - } - - return BinaryExpression; - }(); - - exports.BinaryExpression = BinaryExpression; - - var BlockStatement = function () { - function BlockStatement(body) { - this.type = syntax_1.Syntax.BlockStatement; - this.body = body; - } - - return BlockStatement; - }(); - - exports.BlockStatement = BlockStatement; - - var BreakStatement = function () { - function BreakStatement(label) { - this.type = syntax_1.Syntax.BreakStatement; - this.label = label; - } - - return BreakStatement; - }(); - - exports.BreakStatement = BreakStatement; - - var CallExpression = function () { - function CallExpression(callee, args) { - this.type = syntax_1.Syntax.CallExpression; - this.callee = callee; - this.arguments = args; - } - - return CallExpression; - }(); - - exports.CallExpression = CallExpression; - - var CatchClause = function () { - function CatchClause(param, body) { - this.type = syntax_1.Syntax.CatchClause; - this.param = param; - this.body = body; - } - - return CatchClause; - }(); - - exports.CatchClause = CatchClause; - - var ClassBody = function () { - function ClassBody(body) { - this.type = syntax_1.Syntax.ClassBody; - this.body = body; - } - - return ClassBody; - }(); - - exports.ClassBody = ClassBody; - - var ClassDeclaration = function () { - function ClassDeclaration(id, superClass, body) { - this.type = syntax_1.Syntax.ClassDeclaration; - this.id = id; - this.superClass = superClass; - this.body = body; - } - - return ClassDeclaration; - }(); - - exports.ClassDeclaration = ClassDeclaration; - - var ClassExpression = function () { - function ClassExpression(id, superClass, body) { - this.type = syntax_1.Syntax.ClassExpression; - this.id = id; - this.superClass = superClass; - this.body = body; - } - - return ClassExpression; - }(); - - exports.ClassExpression = ClassExpression; - - var ComputedMemberExpression = function () { - function ComputedMemberExpression(object, property) { - this.type = syntax_1.Syntax.MemberExpression; - this.computed = true; - this.object = object; - this.property = property; - } - - return ComputedMemberExpression; - }(); - - exports.ComputedMemberExpression = ComputedMemberExpression; - - var ConditionalExpression = function () { - function ConditionalExpression(test, consequent, alternate) { - this.type = syntax_1.Syntax.ConditionalExpression; - this.test = test; - this.consequent = consequent; - this.alternate = alternate; - } - - return ConditionalExpression; - }(); - - exports.ConditionalExpression = ConditionalExpression; - - var ContinueStatement = function () { - function ContinueStatement(label) { - this.type = syntax_1.Syntax.ContinueStatement; - this.label = label; - } - - return ContinueStatement; - }(); - - exports.ContinueStatement = ContinueStatement; - - var DebuggerStatement = function () { - function DebuggerStatement() { - this.type = syntax_1.Syntax.DebuggerStatement; - } - - return DebuggerStatement; - }(); - - exports.DebuggerStatement = DebuggerStatement; - - var Directive = function () { - function Directive(expression, directive) { - this.type = syntax_1.Syntax.ExpressionStatement; - this.expression = expression; - this.directive = directive; - } - - return Directive; - }(); - - exports.Directive = Directive; - - var DoWhileStatement = function () { - function DoWhileStatement(body, test) { - this.type = syntax_1.Syntax.DoWhileStatement; - this.body = body; - this.test = test; - } - - return DoWhileStatement; - }(); - - exports.DoWhileStatement = DoWhileStatement; - - var EmptyStatement = function () { - function EmptyStatement() { - this.type = syntax_1.Syntax.EmptyStatement; - } - - return EmptyStatement; - }(); - - exports.EmptyStatement = EmptyStatement; - - var ExportAllDeclaration = function () { - function ExportAllDeclaration(source) { - this.type = syntax_1.Syntax.ExportAllDeclaration; - this.source = source; - } - - return ExportAllDeclaration; - }(); - - exports.ExportAllDeclaration = ExportAllDeclaration; - - var ExportDefaultDeclaration = function () { - function ExportDefaultDeclaration(declaration) { - this.type = syntax_1.Syntax.ExportDefaultDeclaration; - this.declaration = declaration; - } - - return ExportDefaultDeclaration; - }(); - - exports.ExportDefaultDeclaration = ExportDefaultDeclaration; - - var ExportNamedDeclaration = function () { - function ExportNamedDeclaration(declaration, specifiers, source) { - this.type = syntax_1.Syntax.ExportNamedDeclaration; - this.declaration = declaration; - this.specifiers = specifiers; - this.source = source; - } - - return ExportNamedDeclaration; - }(); - - exports.ExportNamedDeclaration = ExportNamedDeclaration; - - var ExportSpecifier = function () { - function ExportSpecifier(local, exported) { - this.type = syntax_1.Syntax.ExportSpecifier; - this.exported = exported; - this.local = local; - } - - return ExportSpecifier; - }(); - - exports.ExportSpecifier = ExportSpecifier; - - var ExpressionStatement = function () { - function ExpressionStatement(expression) { - this.type = syntax_1.Syntax.ExpressionStatement; - this.expression = expression; - } - - return ExpressionStatement; - }(); - - exports.ExpressionStatement = ExpressionStatement; - - var ForInStatement = function () { - function ForInStatement(left, right, body) { - this.type = syntax_1.Syntax.ForInStatement; - this.left = left; - this.right = right; - this.body = body; - this.each = false; - } - - return ForInStatement; - }(); - - exports.ForInStatement = ForInStatement; - - var ForOfStatement = function () { - function ForOfStatement(left, right, body) { - this.type = syntax_1.Syntax.ForOfStatement; - this.left = left; - this.right = right; - this.body = body; - } - - return ForOfStatement; - }(); - - exports.ForOfStatement = ForOfStatement; - - var ForStatement = function () { - function ForStatement(init, test, update, body) { - this.type = syntax_1.Syntax.ForStatement; - this.init = init; - this.test = test; - this.update = update; - this.body = body; - } - - return ForStatement; - }(); - - exports.ForStatement = ForStatement; - - var FunctionDeclaration = function () { - function FunctionDeclaration(id, params, body, generator) { - this.type = syntax_1.Syntax.FunctionDeclaration; - this.id = id; - this.params = params; - this.body = body; - this.generator = generator; - this.expression = false; - this.async = false; - } - - return FunctionDeclaration; - }(); - - exports.FunctionDeclaration = FunctionDeclaration; - - var FunctionExpression = function () { - function FunctionExpression(id, params, body, generator) { - this.type = syntax_1.Syntax.FunctionExpression; - this.id = id; - this.params = params; - this.body = body; - this.generator = generator; - this.expression = false; - this.async = false; - } - - return FunctionExpression; - }(); - - exports.FunctionExpression = FunctionExpression; - - var Identifier = function () { - function Identifier(name) { - this.type = syntax_1.Syntax.Identifier; - this.name = name; - } - - return Identifier; - }(); - - exports.Identifier = Identifier; - - var IfStatement = function () { - function IfStatement(test, consequent, alternate) { - this.type = syntax_1.Syntax.IfStatement; - this.test = test; - this.consequent = consequent; - this.alternate = alternate; - } - - return IfStatement; - }(); - - exports.IfStatement = IfStatement; - - var ImportDeclaration = function () { - function ImportDeclaration(specifiers, source) { - this.type = syntax_1.Syntax.ImportDeclaration; - this.specifiers = specifiers; - this.source = source; - } - - return ImportDeclaration; - }(); - - exports.ImportDeclaration = ImportDeclaration; - - var ImportDefaultSpecifier = function () { - function ImportDefaultSpecifier(local) { - this.type = syntax_1.Syntax.ImportDefaultSpecifier; - this.local = local; - } - - return ImportDefaultSpecifier; - }(); - - exports.ImportDefaultSpecifier = ImportDefaultSpecifier; - - var ImportNamespaceSpecifier = function () { - function ImportNamespaceSpecifier(local) { - this.type = syntax_1.Syntax.ImportNamespaceSpecifier; - this.local = local; - } - - return ImportNamespaceSpecifier; - }(); - - exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier; - - var ImportSpecifier = function () { - function ImportSpecifier(local, imported) { - this.type = syntax_1.Syntax.ImportSpecifier; - this.local = local; - this.imported = imported; - } - - return ImportSpecifier; - }(); - - exports.ImportSpecifier = ImportSpecifier; - - var LabeledStatement = function () { - function LabeledStatement(label, body) { - this.type = syntax_1.Syntax.LabeledStatement; - this.label = label; - this.body = body; - } - - return LabeledStatement; - }(); - - exports.LabeledStatement = LabeledStatement; - - var Literal = function () { - function Literal(value, raw) { - this.type = syntax_1.Syntax.Literal; - this.value = value; - this.raw = raw; - } - - return Literal; - }(); - - exports.Literal = Literal; - - var MetaProperty = function () { - function MetaProperty(meta, property) { - this.type = syntax_1.Syntax.MetaProperty; - this.meta = meta; - this.property = property; - } - - return MetaProperty; - }(); - - exports.MetaProperty = MetaProperty; - - var MethodDefinition = function () { - function MethodDefinition(key, computed, value, kind, isStatic) { - this.type = syntax_1.Syntax.MethodDefinition; - this.key = key; - this.computed = computed; - this.value = value; - this.kind = kind; - this.static = isStatic; - } - - return MethodDefinition; - }(); - - exports.MethodDefinition = MethodDefinition; - - var Module = function () { - function Module(body) { - this.type = syntax_1.Syntax.Program; - this.body = body; - this.sourceType = 'module'; - } - - return Module; - }(); - - exports.Module = Module; - - var NewExpression = function () { - function NewExpression(callee, args) { - this.type = syntax_1.Syntax.NewExpression; - this.callee = callee; - this.arguments = args; - } - - return NewExpression; - }(); - - exports.NewExpression = NewExpression; - - var ObjectExpression = function () { - function ObjectExpression(properties) { - this.type = syntax_1.Syntax.ObjectExpression; - this.properties = properties; - } - - return ObjectExpression; - }(); - - exports.ObjectExpression = ObjectExpression; - - var ObjectPattern = function () { - function ObjectPattern(properties) { - this.type = syntax_1.Syntax.ObjectPattern; - this.properties = properties; - } - - return ObjectPattern; - }(); - - exports.ObjectPattern = ObjectPattern; - - var Property = function () { - function Property(kind, key, computed, value, method, shorthand) { - this.type = syntax_1.Syntax.Property; - this.key = key; - this.computed = computed; - this.value = value; - this.kind = kind; - this.method = method; - this.shorthand = shorthand; - } - - return Property; - }(); - - exports.Property = Property; - - var RegexLiteral = function () { - function RegexLiteral(value, raw, pattern, flags) { - this.type = syntax_1.Syntax.Literal; - this.value = value; - this.raw = raw; - this.regex = { - pattern: pattern, - flags: flags - }; - } - - return RegexLiteral; - }(); - - exports.RegexLiteral = RegexLiteral; - - var RestElement = function () { - function RestElement(argument) { - this.type = syntax_1.Syntax.RestElement; - this.argument = argument; - } - - return RestElement; - }(); - - exports.RestElement = RestElement; - - var ReturnStatement = function () { - function ReturnStatement(argument) { - this.type = syntax_1.Syntax.ReturnStatement; - this.argument = argument; - } - - return ReturnStatement; - }(); - - exports.ReturnStatement = ReturnStatement; - - var Script = function () { - function Script(body) { - this.type = syntax_1.Syntax.Program; - this.body = body; - this.sourceType = 'script'; - } - - return Script; - }(); - - exports.Script = Script; - - var SequenceExpression = function () { - function SequenceExpression(expressions) { - this.type = syntax_1.Syntax.SequenceExpression; - this.expressions = expressions; - } - - return SequenceExpression; - }(); - - exports.SequenceExpression = SequenceExpression; - - var SpreadElement = function () { - function SpreadElement(argument) { - this.type = syntax_1.Syntax.SpreadElement; - this.argument = argument; - } - - return SpreadElement; - }(); - - exports.SpreadElement = SpreadElement; - - var StaticMemberExpression = function () { - function StaticMemberExpression(object, property) { - this.type = syntax_1.Syntax.MemberExpression; - this.computed = false; - this.object = object; - this.property = property; - } - - return StaticMemberExpression; - }(); - - exports.StaticMemberExpression = StaticMemberExpression; - - var Super = function () { - function Super() { - this.type = syntax_1.Syntax.Super; - } - - return Super; - }(); - - exports.Super = Super; - - var SwitchCase = function () { - function SwitchCase(test, consequent) { - this.type = syntax_1.Syntax.SwitchCase; - this.test = test; - this.consequent = consequent; - } - - return SwitchCase; - }(); - - exports.SwitchCase = SwitchCase; - - var SwitchStatement = function () { - function SwitchStatement(discriminant, cases) { - this.type = syntax_1.Syntax.SwitchStatement; - this.discriminant = discriminant; - this.cases = cases; - } - - return SwitchStatement; - }(); - - exports.SwitchStatement = SwitchStatement; - - var TaggedTemplateExpression = function () { - function TaggedTemplateExpression(tag, quasi) { - this.type = syntax_1.Syntax.TaggedTemplateExpression; - this.tag = tag; - this.quasi = quasi; - } - - return TaggedTemplateExpression; - }(); - - exports.TaggedTemplateExpression = TaggedTemplateExpression; - - var TemplateElement = function () { - function TemplateElement(value, tail) { - this.type = syntax_1.Syntax.TemplateElement; - this.value = value; - this.tail = tail; - } - - return TemplateElement; - }(); - - exports.TemplateElement = TemplateElement; - - var TemplateLiteral = function () { - function TemplateLiteral(quasis, expressions) { - this.type = syntax_1.Syntax.TemplateLiteral; - this.quasis = quasis; - this.expressions = expressions; - } - - return TemplateLiteral; - }(); - - exports.TemplateLiteral = TemplateLiteral; - - var ThisExpression = function () { - function ThisExpression() { - this.type = syntax_1.Syntax.ThisExpression; - } - - return ThisExpression; - }(); - - exports.ThisExpression = ThisExpression; - - var ThrowStatement = function () { - function ThrowStatement(argument) { - this.type = syntax_1.Syntax.ThrowStatement; - this.argument = argument; - } - - return ThrowStatement; - }(); - - exports.ThrowStatement = ThrowStatement; - - var TryStatement = function () { - function TryStatement(block, handler, finalizer) { - this.type = syntax_1.Syntax.TryStatement; - this.block = block; - this.handler = handler; - this.finalizer = finalizer; - } - - return TryStatement; - }(); - - exports.TryStatement = TryStatement; - - var UnaryExpression = function () { - function UnaryExpression(operator, argument) { - this.type = syntax_1.Syntax.UnaryExpression; - this.operator = operator; - this.argument = argument; - this.prefix = true; - } - - return UnaryExpression; - }(); - - exports.UnaryExpression = UnaryExpression; - - var UpdateExpression = function () { - function UpdateExpression(operator, argument, prefix) { - this.type = syntax_1.Syntax.UpdateExpression; - this.operator = operator; - this.argument = argument; - this.prefix = prefix; - } - - return UpdateExpression; - }(); - - exports.UpdateExpression = UpdateExpression; - - var VariableDeclaration = function () { - function VariableDeclaration(declarations, kind) { - this.type = syntax_1.Syntax.VariableDeclaration; - this.declarations = declarations; - this.kind = kind; - } - - return VariableDeclaration; - }(); - - exports.VariableDeclaration = VariableDeclaration; - - var VariableDeclarator = function () { - function VariableDeclarator(id, init) { - this.type = syntax_1.Syntax.VariableDeclarator; - this.id = id; - this.init = init; - } - - return VariableDeclarator; - }(); - - exports.VariableDeclarator = VariableDeclarator; - - var WhileStatement = function () { - function WhileStatement(test, body) { - this.type = syntax_1.Syntax.WhileStatement; - this.test = test; - this.body = body; - } - - return WhileStatement; - }(); - - exports.WhileStatement = WhileStatement; - - var WithStatement = function () { - function WithStatement(object, body) { - this.type = syntax_1.Syntax.WithStatement; - this.object = object; - this.body = body; - } - - return WithStatement; - }(); - - exports.WithStatement = WithStatement; - - var YieldExpression = function () { - function YieldExpression(argument, delegate) { - this.type = syntax_1.Syntax.YieldExpression; - this.argument = argument; - this.delegate = delegate; - } - - return YieldExpression; - }(); - - exports.YieldExpression = YieldExpression; - /***/ - }, - /* 8 */ - - /***/ - function (module, exports, __nested_webpack_require_84249__) { - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var assert_1 = __nested_webpack_require_84249__(9); - - var error_handler_1 = __nested_webpack_require_84249__(10); - - var messages_1 = __nested_webpack_require_84249__(11); - - var Node = __nested_webpack_require_84249__(7); - - var scanner_1 = __nested_webpack_require_84249__(12); - - var syntax_1 = __nested_webpack_require_84249__(2); - - var token_1 = __nested_webpack_require_84249__(13); - - var ArrowParameterPlaceHolder = 'ArrowParameterPlaceHolder'; - - var Parser = function () { - function Parser(code, options, delegate) { - if (options === void 0) { - options = {}; - } - - this.config = { - range: typeof options.range === 'boolean' && options.range, - loc: typeof options.loc === 'boolean' && options.loc, - source: null, - tokens: typeof options.tokens === 'boolean' && options.tokens, - comment: typeof options.comment === 'boolean' && options.comment, - tolerant: typeof options.tolerant === 'boolean' && options.tolerant - }; - - if (this.config.loc && options.source && options.source !== null) { - this.config.source = String(options.source); - } - - this.delegate = delegate; - this.errorHandler = new error_handler_1.ErrorHandler(); - this.errorHandler.tolerant = this.config.tolerant; - this.scanner = new scanner_1.Scanner(code, this.errorHandler); - this.scanner.trackComment = this.config.comment; - this.operatorPrecedence = { - ')': 0, - ';': 0, - ',': 0, - '=': 0, - ']': 0, - '||': 1, - '&&': 2, - '|': 3, - '^': 4, - '&': 5, - '==': 6, - '!=': 6, - '===': 6, - '!==': 6, - '<': 7, - '>': 7, - '<=': 7, - '>=': 7, - '<<': 8, - '>>': 8, - '>>>': 8, - '+': 9, - '-': 9, - '*': 11, - '/': 11, - '%': 11 - }; - this.lookahead = { - type: 2 - /* EOF */ - , - value: '', - lineNumber: this.scanner.lineNumber, - lineStart: 0, - start: 0, - end: 0 - }; - this.hasLineTerminator = false; - this.context = { - isModule: false, - await: false, - allowIn: true, - allowStrictDirective: true, - allowYield: true, - firstCoverInitializedNameError: null, - isAssignmentTarget: false, - isBindingElement: false, - inFunctionBody: false, - inIteration: false, - inSwitch: false, - labelSet: {}, - strict: false - }; - this.tokens = []; - this.startMarker = { - index: 0, - line: this.scanner.lineNumber, - column: 0 - }; - this.lastMarker = { - index: 0, - line: this.scanner.lineNumber, - column: 0 - }; - this.nextToken(); - this.lastMarker = { - index: this.scanner.index, - line: this.scanner.lineNumber, - column: this.scanner.index - this.scanner.lineStart - }; - } - - Parser.prototype.throwError = function (messageFormat) { - var values = []; - - for (var _i = 1; _i < arguments.length; _i++) { - values[_i - 1] = arguments[_i]; - } - - var args = Array.prototype.slice.call(arguments, 1); - var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) { - assert_1.assert(idx < args.length, 'Message reference must be in range'); - return args[idx]; - }); - var index = this.lastMarker.index; - var line = this.lastMarker.line; - var column = this.lastMarker.column + 1; - throw this.errorHandler.createError(index, line, column, msg); - }; - - Parser.prototype.tolerateError = function (messageFormat) { - var values = []; - - for (var _i = 1; _i < arguments.length; _i++) { - values[_i - 1] = arguments[_i]; - } - - var args = Array.prototype.slice.call(arguments, 1); - var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) { - assert_1.assert(idx < args.length, 'Message reference must be in range'); - return args[idx]; - }); - var index = this.lastMarker.index; - var line = this.scanner.lineNumber; - var column = this.lastMarker.column + 1; - this.errorHandler.tolerateError(index, line, column, msg); - }; // Throw an exception because of the token. - - - Parser.prototype.unexpectedTokenError = function (token, message) { - var msg = message || messages_1.Messages.UnexpectedToken; - var value; - - if (token) { - if (!message) { - msg = token.type === 2 - /* EOF */ - ? messages_1.Messages.UnexpectedEOS : token.type === 3 - /* Identifier */ - ? messages_1.Messages.UnexpectedIdentifier : token.type === 6 - /* NumericLiteral */ - ? messages_1.Messages.UnexpectedNumber : token.type === 8 - /* StringLiteral */ - ? messages_1.Messages.UnexpectedString : token.type === 10 - /* Template */ - ? messages_1.Messages.UnexpectedTemplate : messages_1.Messages.UnexpectedToken; - - if (token.type === 4 - /* Keyword */ - ) { - if (this.scanner.isFutureReservedWord(token.value)) { - msg = messages_1.Messages.UnexpectedReserved; - } else if (this.context.strict && this.scanner.isStrictModeReservedWord(token.value)) { - msg = messages_1.Messages.StrictReservedWord; - } - } - } - - value = token.value; - } else { - value = 'ILLEGAL'; - } - - msg = msg.replace('%0', value); - - if (token && typeof token.lineNumber === 'number') { - var index = token.start; - var line = token.lineNumber; - var lastMarkerLineStart = this.lastMarker.index - this.lastMarker.column; - var column = token.start - lastMarkerLineStart + 1; - return this.errorHandler.createError(index, line, column, msg); - } else { - var index = this.lastMarker.index; - var line = this.lastMarker.line; - var column = this.lastMarker.column + 1; - return this.errorHandler.createError(index, line, column, msg); - } - }; - - Parser.prototype.throwUnexpectedToken = function (token, message) { - throw this.unexpectedTokenError(token, message); - }; - - Parser.prototype.tolerateUnexpectedToken = function (token, message) { - this.errorHandler.tolerate(this.unexpectedTokenError(token, message)); - }; - - Parser.prototype.collectComments = function () { - if (!this.config.comment) { - this.scanner.scanComments(); - } else { - var comments = this.scanner.scanComments(); - - if (comments.length > 0 && this.delegate) { - for (var i = 0; i < comments.length; ++i) { - var e = comments[i]; - var node = void 0; - node = { - type: e.multiLine ? 'BlockComment' : 'LineComment', - value: this.scanner.source.slice(e.slice[0], e.slice[1]) - }; - - if (this.config.range) { - node.range = e.range; - } - - if (this.config.loc) { - node.loc = e.loc; - } - - var metadata = { - start: { - line: e.loc.start.line, - column: e.loc.start.column, - offset: e.range[0] - }, - end: { - line: e.loc.end.line, - column: e.loc.end.column, - offset: e.range[1] - } - }; - this.delegate(node, metadata); - } - } - } - }; // From internal representation to an external structure - - - Parser.prototype.getTokenRaw = function (token) { - return this.scanner.source.slice(token.start, token.end); - }; - - Parser.prototype.convertToken = function (token) { - var t = { - type: token_1.TokenName[token.type], - value: this.getTokenRaw(token) - }; - - if (this.config.range) { - t.range = [token.start, token.end]; - } - - if (this.config.loc) { - t.loc = { - start: { - line: this.startMarker.line, - column: this.startMarker.column - }, - end: { - line: this.scanner.lineNumber, - column: this.scanner.index - this.scanner.lineStart - } - }; - } - - if (token.type === 9 - /* RegularExpression */ - ) { - var pattern = token.pattern; - var flags = token.flags; - t.regex = { - pattern: pattern, - flags: flags - }; - } - - return t; - }; - - Parser.prototype.nextToken = function () { - var token = this.lookahead; - this.lastMarker.index = this.scanner.index; - this.lastMarker.line = this.scanner.lineNumber; - this.lastMarker.column = this.scanner.index - this.scanner.lineStart; - this.collectComments(); - - if (this.scanner.index !== this.startMarker.index) { - this.startMarker.index = this.scanner.index; - this.startMarker.line = this.scanner.lineNumber; - this.startMarker.column = this.scanner.index - this.scanner.lineStart; - } - - var next = this.scanner.lex(); - this.hasLineTerminator = token.lineNumber !== next.lineNumber; - - if (next && this.context.strict && next.type === 3 - /* Identifier */ - ) { - if (this.scanner.isStrictModeReservedWord(next.value)) { - next.type = 4 - /* Keyword */ - ; - } - } - - this.lookahead = next; - - if (this.config.tokens && next.type !== 2 - /* EOF */ - ) { - this.tokens.push(this.convertToken(next)); - } - - return token; - }; - - Parser.prototype.nextRegexToken = function () { - this.collectComments(); - var token = this.scanner.scanRegExp(); - - if (this.config.tokens) { - // Pop the previous token, '/' or '/=' - // This is added from the lookahead token. - this.tokens.pop(); - this.tokens.push(this.convertToken(token)); - } // Prime the next lookahead. - - - this.lookahead = token; - this.nextToken(); - return token; - }; - - Parser.prototype.createNode = function () { - return { - index: this.startMarker.index, - line: this.startMarker.line, - column: this.startMarker.column - }; - }; - - Parser.prototype.startNode = function (token, lastLineStart) { - if (lastLineStart === void 0) { - lastLineStart = 0; - } - - var column = token.start - token.lineStart; - var line = token.lineNumber; - - if (column < 0) { - column += lastLineStart; - line--; - } - - return { - index: token.start, - line: line, - column: column - }; - }; - - Parser.prototype.finalize = function (marker, node) { - if (this.config.range) { - node.range = [marker.index, this.lastMarker.index]; - } - - if (this.config.loc) { - node.loc = { - start: { - line: marker.line, - column: marker.column - }, - end: { - line: this.lastMarker.line, - column: this.lastMarker.column - } - }; - - if (this.config.source) { - node.loc.source = this.config.source; - } - } - - if (this.delegate) { - var metadata = { - start: { - line: marker.line, - column: marker.column, - offset: marker.index - }, - end: { - line: this.lastMarker.line, - column: this.lastMarker.column, - offset: this.lastMarker.index - } - }; - this.delegate(node, metadata); - } - - return node; - }; // Expect the next token to match the specified punctuator. - // If not, an exception will be thrown. - - - Parser.prototype.expect = function (value) { - var token = this.nextToken(); - - if (token.type !== 7 - /* Punctuator */ - || token.value !== value) { - this.throwUnexpectedToken(token); - } - }; // Quietly expect a comma when in tolerant mode, otherwise delegates to expect(). - - - Parser.prototype.expectCommaSeparator = function () { - if (this.config.tolerant) { - var token = this.lookahead; - - if (token.type === 7 - /* Punctuator */ - && token.value === ',') { - this.nextToken(); - } else if (token.type === 7 - /* Punctuator */ - && token.value === ';') { - this.nextToken(); - this.tolerateUnexpectedToken(token); - } else { - this.tolerateUnexpectedToken(token, messages_1.Messages.UnexpectedToken); - } - } else { - this.expect(','); - } - }; // Expect the next token to match the specified keyword. - // If not, an exception will be thrown. - - - Parser.prototype.expectKeyword = function (keyword) { - var token = this.nextToken(); - - if (token.type !== 4 - /* Keyword */ - || token.value !== keyword) { - this.throwUnexpectedToken(token); - } - }; // Return true if the next token matches the specified punctuator. - - - Parser.prototype.match = function (value) { - return this.lookahead.type === 7 - /* Punctuator */ - && this.lookahead.value === value; - }; // Return true if the next token matches the specified keyword - - - Parser.prototype.matchKeyword = function (keyword) { - return this.lookahead.type === 4 - /* Keyword */ - && this.lookahead.value === keyword; - }; // Return true if the next token matches the specified contextual keyword - // (where an identifier is sometimes a keyword depending on the context) - - - Parser.prototype.matchContextualKeyword = function (keyword) { - return this.lookahead.type === 3 - /* Identifier */ - && this.lookahead.value === keyword; - }; // Return true if the next token is an assignment operator - - - Parser.prototype.matchAssign = function () { - if (this.lookahead.type !== 7 - /* Punctuator */ - ) { - return false; - } - - var op = this.lookahead.value; - return op === '=' || op === '*=' || op === '**=' || op === '/=' || op === '%=' || op === '+=' || op === '-=' || op === '<<=' || op === '>>=' || op === '>>>=' || op === '&=' || op === '^=' || op === '|='; - }; // Cover grammar support. - // - // When an assignment expression position starts with an left parenthesis, the determination of the type - // of the syntax is to be deferred arbitrarily long until the end of the parentheses pair (plus a lookahead) - // or the first comma. This situation also defers the determination of all the expressions nested in the pair. - // - // There are three productions that can be parsed in a parentheses pair that needs to be determined - // after the outermost pair is closed. They are: - // - // 1. AssignmentExpression - // 2. BindingElements - // 3. AssignmentTargets - // - // In order to avoid exponential backtracking, we use two flags to denote if the production can be - // binding element or assignment target. - // - // The three productions have the relationship: - // - // BindingElements ⊆ AssignmentTargets ⊆ AssignmentExpression - // - // with a single exception that CoverInitializedName when used directly in an Expression, generates - // an early error. Therefore, we need the third state, firstCoverInitializedNameError, to track the - // first usage of CoverInitializedName and report it when we reached the end of the parentheses pair. - // - // isolateCoverGrammar function runs the given parser function with a new cover grammar context, and it does not - // effect the current flags. This means the production the parser parses is only used as an expression. Therefore - // the CoverInitializedName check is conducted. - // - // inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates - // the flags outside of the parser. This means the production the parser parses is used as a part of a potential - // pattern. The CoverInitializedName check is deferred. - - - Parser.prototype.isolateCoverGrammar = function (parseFunction) { - var previousIsBindingElement = this.context.isBindingElement; - var previousIsAssignmentTarget = this.context.isAssignmentTarget; - var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError; - this.context.isBindingElement = true; - this.context.isAssignmentTarget = true; - this.context.firstCoverInitializedNameError = null; - var result = parseFunction.call(this); - - if (this.context.firstCoverInitializedNameError !== null) { - this.throwUnexpectedToken(this.context.firstCoverInitializedNameError); - } - - this.context.isBindingElement = previousIsBindingElement; - this.context.isAssignmentTarget = previousIsAssignmentTarget; - this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError; - return result; - }; - - Parser.prototype.inheritCoverGrammar = function (parseFunction) { - var previousIsBindingElement = this.context.isBindingElement; - var previousIsAssignmentTarget = this.context.isAssignmentTarget; - var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError; - this.context.isBindingElement = true; - this.context.isAssignmentTarget = true; - this.context.firstCoverInitializedNameError = null; - var result = parseFunction.call(this); - this.context.isBindingElement = this.context.isBindingElement && previousIsBindingElement; - this.context.isAssignmentTarget = this.context.isAssignmentTarget && previousIsAssignmentTarget; - this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError || this.context.firstCoverInitializedNameError; - return result; - }; - - Parser.prototype.consumeSemicolon = function () { - if (this.match(';')) { - this.nextToken(); - } else if (!this.hasLineTerminator) { - if (this.lookahead.type !== 2 - /* EOF */ - && !this.match('}')) { - this.throwUnexpectedToken(this.lookahead); - } - - this.lastMarker.index = this.startMarker.index; - this.lastMarker.line = this.startMarker.line; - this.lastMarker.column = this.startMarker.column; - } - }; // https://tc39.github.io/ecma262/#sec-primary-expression - - - Parser.prototype.parsePrimaryExpression = function () { - var node = this.createNode(); - var expr; - var token, raw; - - switch (this.lookahead.type) { - case 3 - /* Identifier */ - : - if ((this.context.isModule || this.context.await) && this.lookahead.value === 'await') { - this.tolerateUnexpectedToken(this.lookahead); - } - - expr = this.matchAsyncFunction() ? this.parseFunctionExpression() : this.finalize(node, new Node.Identifier(this.nextToken().value)); - break; - - case 6 - /* NumericLiteral */ - : - case 8 - /* StringLiteral */ - : - if (this.context.strict && this.lookahead.octal) { - this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.StrictOctalLiteral); - } - - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - token = this.nextToken(); - raw = this.getTokenRaw(token); - expr = this.finalize(node, new Node.Literal(token.value, raw)); - break; - - case 1 - /* BooleanLiteral */ - : - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - token = this.nextToken(); - raw = this.getTokenRaw(token); - expr = this.finalize(node, new Node.Literal(token.value === 'true', raw)); - break; - - case 5 - /* NullLiteral */ - : - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - token = this.nextToken(); - raw = this.getTokenRaw(token); - expr = this.finalize(node, new Node.Literal(null, raw)); - break; - - case 10 - /* Template */ - : - expr = this.parseTemplateLiteral(); - break; - - case 7 - /* Punctuator */ - : - switch (this.lookahead.value) { - case '(': - this.context.isBindingElement = false; - expr = this.inheritCoverGrammar(this.parseGroupExpression); - break; - - case '[': - expr = this.inheritCoverGrammar(this.parseArrayInitializer); - break; - - case '{': - expr = this.inheritCoverGrammar(this.parseObjectInitializer); - break; - - case '/': - case '/=': - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - this.scanner.index = this.startMarker.index; - token = this.nextRegexToken(); - raw = this.getTokenRaw(token); - expr = this.finalize(node, new Node.RegexLiteral(token.regex, raw, token.pattern, token.flags)); - break; - - default: - expr = this.throwUnexpectedToken(this.nextToken()); - } - - break; - - case 4 - /* Keyword */ - : - if (!this.context.strict && this.context.allowYield && this.matchKeyword('yield')) { - expr = this.parseIdentifierName(); - } else if (!this.context.strict && this.matchKeyword('let')) { - expr = this.finalize(node, new Node.Identifier(this.nextToken().value)); - } else { - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - - if (this.matchKeyword('function')) { - expr = this.parseFunctionExpression(); - } else if (this.matchKeyword('this')) { - this.nextToken(); - expr = this.finalize(node, new Node.ThisExpression()); - } else if (this.matchKeyword('class')) { - expr = this.parseClassExpression(); - } else { - expr = this.throwUnexpectedToken(this.nextToken()); - } - } - - break; - - default: - expr = this.throwUnexpectedToken(this.nextToken()); - } - - return expr; - }; // https://tc39.github.io/ecma262/#sec-array-initializer - - - Parser.prototype.parseSpreadElement = function () { - var node = this.createNode(); - this.expect('...'); - var arg = this.inheritCoverGrammar(this.parseAssignmentExpression); - return this.finalize(node, new Node.SpreadElement(arg)); - }; - - Parser.prototype.parseArrayInitializer = function () { - var node = this.createNode(); - var elements = []; - this.expect('['); - - while (!this.match(']')) { - if (this.match(',')) { - this.nextToken(); - elements.push(null); - } else if (this.match('...')) { - var element = this.parseSpreadElement(); - - if (!this.match(']')) { - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - this.expect(','); - } - - elements.push(element); - } else { - elements.push(this.inheritCoverGrammar(this.parseAssignmentExpression)); - - if (!this.match(']')) { - this.expect(','); - } - } - } - - this.expect(']'); - return this.finalize(node, new Node.ArrayExpression(elements)); - }; // https://tc39.github.io/ecma262/#sec-object-initializer - - - Parser.prototype.parsePropertyMethod = function (params) { - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - var previousStrict = this.context.strict; - var previousAllowStrictDirective = this.context.allowStrictDirective; - this.context.allowStrictDirective = params.simple; - var body = this.isolateCoverGrammar(this.parseFunctionSourceElements); - - if (this.context.strict && params.firstRestricted) { - this.tolerateUnexpectedToken(params.firstRestricted, params.message); - } - - if (this.context.strict && params.stricted) { - this.tolerateUnexpectedToken(params.stricted, params.message); - } - - this.context.strict = previousStrict; - this.context.allowStrictDirective = previousAllowStrictDirective; - return body; - }; - - Parser.prototype.parsePropertyMethodFunction = function () { - var isGenerator = false; - var node = this.createNode(); - var previousAllowYield = this.context.allowYield; - this.context.allowYield = true; - var params = this.parseFormalParameters(); - var method = this.parsePropertyMethod(params); - this.context.allowYield = previousAllowYield; - return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator)); - }; - - Parser.prototype.parsePropertyMethodAsyncFunction = function () { - var node = this.createNode(); - var previousAllowYield = this.context.allowYield; - var previousAwait = this.context.await; - this.context.allowYield = false; - this.context.await = true; - var params = this.parseFormalParameters(); - var method = this.parsePropertyMethod(params); - this.context.allowYield = previousAllowYield; - this.context.await = previousAwait; - return this.finalize(node, new Node.AsyncFunctionExpression(null, params.params, method)); - }; - - Parser.prototype.parseObjectPropertyKey = function () { - var node = this.createNode(); - var token = this.nextToken(); - var key; - - switch (token.type) { - case 8 - /* StringLiteral */ - : - case 6 - /* NumericLiteral */ - : - if (this.context.strict && token.octal) { - this.tolerateUnexpectedToken(token, messages_1.Messages.StrictOctalLiteral); - } - - var raw = this.getTokenRaw(token); - key = this.finalize(node, new Node.Literal(token.value, raw)); - break; - - case 3 - /* Identifier */ - : - case 1 - /* BooleanLiteral */ - : - case 5 - /* NullLiteral */ - : - case 4 - /* Keyword */ - : - key = this.finalize(node, new Node.Identifier(token.value)); - break; - - case 7 - /* Punctuator */ - : - if (token.value === '[') { - key = this.isolateCoverGrammar(this.parseAssignmentExpression); - this.expect(']'); - } else { - key = this.throwUnexpectedToken(token); - } - - break; - - default: - key = this.throwUnexpectedToken(token); - } - - return key; - }; - - Parser.prototype.isPropertyKey = function (key, value) { - return key.type === syntax_1.Syntax.Identifier && key.name === value || key.type === syntax_1.Syntax.Literal && key.value === value; - }; - - Parser.prototype.parseObjectProperty = function (hasProto) { - var node = this.createNode(); - var token = this.lookahead; - var kind; - var key = null; - var value = null; - var computed = false; - var method = false; - var shorthand = false; - var isAsync = false; - - if (token.type === 3 - /* Identifier */ - ) { - var id = token.value; - this.nextToken(); - computed = this.match('['); - isAsync = !this.hasLineTerminator && id === 'async' && !this.match(':') && !this.match('(') && !this.match('*') && !this.match(','); - key = isAsync ? this.parseObjectPropertyKey() : this.finalize(node, new Node.Identifier(id)); - } else if (this.match('*')) { - this.nextToken(); - } else { - computed = this.match('['); - key = this.parseObjectPropertyKey(); - } - - var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead); - - if (token.type === 3 - /* Identifier */ - && !isAsync && token.value === 'get' && lookaheadPropertyKey) { - kind = 'get'; - computed = this.match('['); - key = this.parseObjectPropertyKey(); - this.context.allowYield = false; - value = this.parseGetterMethod(); - } else if (token.type === 3 - /* Identifier */ - && !isAsync && token.value === 'set' && lookaheadPropertyKey) { - kind = 'set'; - computed = this.match('['); - key = this.parseObjectPropertyKey(); - value = this.parseSetterMethod(); - } else if (token.type === 7 - /* Punctuator */ - && token.value === '*' && lookaheadPropertyKey) { - kind = 'init'; - computed = this.match('['); - key = this.parseObjectPropertyKey(); - value = this.parseGeneratorMethod(); - method = true; - } else { - if (!key) { - this.throwUnexpectedToken(this.lookahead); - } - - kind = 'init'; - - if (this.match(':') && !isAsync) { - if (!computed && this.isPropertyKey(key, '__proto__')) { - if (hasProto.value) { - this.tolerateError(messages_1.Messages.DuplicateProtoProperty); - } - - hasProto.value = true; - } - - this.nextToken(); - value = this.inheritCoverGrammar(this.parseAssignmentExpression); - } else if (this.match('(')) { - value = isAsync ? this.parsePropertyMethodAsyncFunction() : this.parsePropertyMethodFunction(); - method = true; - } else if (token.type === 3 - /* Identifier */ - ) { - var id = this.finalize(node, new Node.Identifier(token.value)); - - if (this.match('=')) { - this.context.firstCoverInitializedNameError = this.lookahead; - this.nextToken(); - shorthand = true; - var init = this.isolateCoverGrammar(this.parseAssignmentExpression); - value = this.finalize(node, new Node.AssignmentPattern(id, init)); - } else { - shorthand = true; - value = id; - } - } else { - this.throwUnexpectedToken(this.nextToken()); - } - } - - return this.finalize(node, new Node.Property(kind, key, computed, value, method, shorthand)); - }; - - Parser.prototype.parseObjectInitializer = function () { - var node = this.createNode(); - this.expect('{'); - var properties = []; - var hasProto = { - value: false - }; - - while (!this.match('}')) { - properties.push(this.parseObjectProperty(hasProto)); - - if (!this.match('}')) { - this.expectCommaSeparator(); - } - } - - this.expect('}'); - return this.finalize(node, new Node.ObjectExpression(properties)); - }; // https://tc39.github.io/ecma262/#sec-template-literals - - - Parser.prototype.parseTemplateHead = function () { - assert_1.assert(this.lookahead.head, 'Template literal must start with a template head'); - var node = this.createNode(); - var token = this.nextToken(); - var raw = token.value; - var cooked = token.cooked; - return this.finalize(node, new Node.TemplateElement({ - raw: raw, - cooked: cooked - }, token.tail)); - }; - - Parser.prototype.parseTemplateElement = function () { - if (this.lookahead.type !== 10 - /* Template */ - ) { - this.throwUnexpectedToken(); - } - - var node = this.createNode(); - var token = this.nextToken(); - var raw = token.value; - var cooked = token.cooked; - return this.finalize(node, new Node.TemplateElement({ - raw: raw, - cooked: cooked - }, token.tail)); - }; - - Parser.prototype.parseTemplateLiteral = function () { - var node = this.createNode(); - var expressions = []; - var quasis = []; - var quasi = this.parseTemplateHead(); - quasis.push(quasi); - - while (!quasi.tail) { - expressions.push(this.parseExpression()); - quasi = this.parseTemplateElement(); - quasis.push(quasi); - } - - return this.finalize(node, new Node.TemplateLiteral(quasis, expressions)); - }; // https://tc39.github.io/ecma262/#sec-grouping-operator - - - Parser.prototype.reinterpretExpressionAsPattern = function (expr) { - switch (expr.type) { - case syntax_1.Syntax.Identifier: - case syntax_1.Syntax.MemberExpression: - case syntax_1.Syntax.RestElement: - case syntax_1.Syntax.AssignmentPattern: - break; - - case syntax_1.Syntax.SpreadElement: - expr.type = syntax_1.Syntax.RestElement; - this.reinterpretExpressionAsPattern(expr.argument); - break; - - case syntax_1.Syntax.ArrayExpression: - expr.type = syntax_1.Syntax.ArrayPattern; - - for (var i = 0; i < expr.elements.length; i++) { - if (expr.elements[i] !== null) { - this.reinterpretExpressionAsPattern(expr.elements[i]); - } - } - - break; - - case syntax_1.Syntax.ObjectExpression: - expr.type = syntax_1.Syntax.ObjectPattern; - - for (var i = 0; i < expr.properties.length; i++) { - this.reinterpretExpressionAsPattern(expr.properties[i].value); - } - - break; - - case syntax_1.Syntax.AssignmentExpression: - expr.type = syntax_1.Syntax.AssignmentPattern; - delete expr.operator; - this.reinterpretExpressionAsPattern(expr.left); - break; - - default: - // Allow other node type for tolerant parsing. - break; - } - }; - - Parser.prototype.parseGroupExpression = function () { - var expr; - this.expect('('); - - if (this.match(')')) { - this.nextToken(); - - if (!this.match('=>')) { - this.expect('=>'); - } - - expr = { - type: ArrowParameterPlaceHolder, - params: [], - async: false - }; - } else { - var startToken = this.lookahead; - var params = []; - - if (this.match('...')) { - expr = this.parseRestElement(params); - this.expect(')'); - - if (!this.match('=>')) { - this.expect('=>'); - } - - expr = { - type: ArrowParameterPlaceHolder, - params: [expr], - async: false - }; - } else { - var arrow = false; - this.context.isBindingElement = true; - expr = this.inheritCoverGrammar(this.parseAssignmentExpression); - - if (this.match(',')) { - var expressions = []; - this.context.isAssignmentTarget = false; - expressions.push(expr); - - while (this.lookahead.type !== 2 - /* EOF */ - ) { - if (!this.match(',')) { - break; - } - - this.nextToken(); - - if (this.match(')')) { - this.nextToken(); - - for (var i = 0; i < expressions.length; i++) { - this.reinterpretExpressionAsPattern(expressions[i]); - } - - arrow = true; - expr = { - type: ArrowParameterPlaceHolder, - params: expressions, - async: false - }; - } else if (this.match('...')) { - if (!this.context.isBindingElement) { - this.throwUnexpectedToken(this.lookahead); - } - - expressions.push(this.parseRestElement(params)); - this.expect(')'); - - if (!this.match('=>')) { - this.expect('=>'); - } - - this.context.isBindingElement = false; - - for (var i = 0; i < expressions.length; i++) { - this.reinterpretExpressionAsPattern(expressions[i]); - } - - arrow = true; - expr = { - type: ArrowParameterPlaceHolder, - params: expressions, - async: false - }; - } else { - expressions.push(this.inheritCoverGrammar(this.parseAssignmentExpression)); - } - - if (arrow) { - break; - } - } - - if (!arrow) { - expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions)); - } - } - - if (!arrow) { - this.expect(')'); - - if (this.match('=>')) { - if (expr.type === syntax_1.Syntax.Identifier && expr.name === 'yield') { - arrow = true; - expr = { - type: ArrowParameterPlaceHolder, - params: [expr], - async: false - }; - } - - if (!arrow) { - if (!this.context.isBindingElement) { - this.throwUnexpectedToken(this.lookahead); - } - - if (expr.type === syntax_1.Syntax.SequenceExpression) { - for (var i = 0; i < expr.expressions.length; i++) { - this.reinterpretExpressionAsPattern(expr.expressions[i]); - } - } else { - this.reinterpretExpressionAsPattern(expr); - } - - var parameters = expr.type === syntax_1.Syntax.SequenceExpression ? expr.expressions : [expr]; - expr = { - type: ArrowParameterPlaceHolder, - params: parameters, - async: false - }; - } - } - - this.context.isBindingElement = false; - } - } - } - - return expr; - }; // https://tc39.github.io/ecma262/#sec-left-hand-side-expressions - - - Parser.prototype.parseArguments = function () { - this.expect('('); - var args = []; - - if (!this.match(')')) { - while (true) { - var expr = this.match('...') ? this.parseSpreadElement() : this.isolateCoverGrammar(this.parseAssignmentExpression); - args.push(expr); - - if (this.match(')')) { - break; - } - - this.expectCommaSeparator(); - - if (this.match(')')) { - break; - } - } - } - - this.expect(')'); - return args; - }; - - Parser.prototype.isIdentifierName = function (token) { - return token.type === 3 - /* Identifier */ - || token.type === 4 - /* Keyword */ - || token.type === 1 - /* BooleanLiteral */ - || token.type === 5 - /* NullLiteral */ - ; - }; - - Parser.prototype.parseIdentifierName = function () { - var node = this.createNode(); - var token = this.nextToken(); - - if (!this.isIdentifierName(token)) { - this.throwUnexpectedToken(token); - } - - return this.finalize(node, new Node.Identifier(token.value)); - }; - - Parser.prototype.parseNewExpression = function () { - var node = this.createNode(); - var id = this.parseIdentifierName(); - assert_1.assert(id.name === 'new', 'New expression must start with `new`'); - var expr; - - if (this.match('.')) { - this.nextToken(); - - if (this.lookahead.type === 3 - /* Identifier */ - && this.context.inFunctionBody && this.lookahead.value === 'target') { - var property = this.parseIdentifierName(); - expr = new Node.MetaProperty(id, property); - } else { - this.throwUnexpectedToken(this.lookahead); - } - } else { - var callee = this.isolateCoverGrammar(this.parseLeftHandSideExpression); - var args = this.match('(') ? this.parseArguments() : []; - expr = new Node.NewExpression(callee, args); - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - } - - return this.finalize(node, expr); - }; - - Parser.prototype.parseAsyncArgument = function () { - var arg = this.parseAssignmentExpression(); - this.context.firstCoverInitializedNameError = null; - return arg; - }; - - Parser.prototype.parseAsyncArguments = function () { - this.expect('('); - var args = []; - - if (!this.match(')')) { - while (true) { - var expr = this.match('...') ? this.parseSpreadElement() : this.isolateCoverGrammar(this.parseAsyncArgument); - args.push(expr); - - if (this.match(')')) { - break; - } - - this.expectCommaSeparator(); - - if (this.match(')')) { - break; - } - } - } - - this.expect(')'); - return args; - }; - - Parser.prototype.parseLeftHandSideExpressionAllowCall = function () { - var startToken = this.lookahead; - var maybeAsync = this.matchContextualKeyword('async'); - var previousAllowIn = this.context.allowIn; - this.context.allowIn = true; - var expr; - - if (this.matchKeyword('super') && this.context.inFunctionBody) { - expr = this.createNode(); - this.nextToken(); - expr = this.finalize(expr, new Node.Super()); - - if (!this.match('(') && !this.match('.') && !this.match('[')) { - this.throwUnexpectedToken(this.lookahead); - } - } else { - expr = this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression); - } - - while (true) { - if (this.match('.')) { - this.context.isBindingElement = false; - this.context.isAssignmentTarget = true; - this.expect('.'); - var property = this.parseIdentifierName(); - expr = this.finalize(this.startNode(startToken), new Node.StaticMemberExpression(expr, property)); - } else if (this.match('(')) { - var asyncArrow = maybeAsync && startToken.lineNumber === this.lookahead.lineNumber; - this.context.isBindingElement = false; - this.context.isAssignmentTarget = false; - var args = asyncArrow ? this.parseAsyncArguments() : this.parseArguments(); - expr = this.finalize(this.startNode(startToken), new Node.CallExpression(expr, args)); - - if (asyncArrow && this.match('=>')) { - for (var i = 0; i < args.length; ++i) { - this.reinterpretExpressionAsPattern(args[i]); - } - - expr = { - type: ArrowParameterPlaceHolder, - params: args, - async: true - }; - } - } else if (this.match('[')) { - this.context.isBindingElement = false; - this.context.isAssignmentTarget = true; - this.expect('['); - var property = this.isolateCoverGrammar(this.parseExpression); - this.expect(']'); - expr = this.finalize(this.startNode(startToken), new Node.ComputedMemberExpression(expr, property)); - } else if (this.lookahead.type === 10 - /* Template */ - && this.lookahead.head) { - var quasi = this.parseTemplateLiteral(); - expr = this.finalize(this.startNode(startToken), new Node.TaggedTemplateExpression(expr, quasi)); - } else { - break; - } - } - - this.context.allowIn = previousAllowIn; - return expr; - }; - - Parser.prototype.parseSuper = function () { - var node = this.createNode(); - this.expectKeyword('super'); - - if (!this.match('[') && !this.match('.')) { - this.throwUnexpectedToken(this.lookahead); - } - - return this.finalize(node, new Node.Super()); - }; - - Parser.prototype.parseLeftHandSideExpression = function () { - assert_1.assert(this.context.allowIn, 'callee of new expression always allow in keyword.'); - var node = this.startNode(this.lookahead); - var expr = this.matchKeyword('super') && this.context.inFunctionBody ? this.parseSuper() : this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression); - - while (true) { - if (this.match('[')) { - this.context.isBindingElement = false; - this.context.isAssignmentTarget = true; - this.expect('['); - var property = this.isolateCoverGrammar(this.parseExpression); - this.expect(']'); - expr = this.finalize(node, new Node.ComputedMemberExpression(expr, property)); - } else if (this.match('.')) { - this.context.isBindingElement = false; - this.context.isAssignmentTarget = true; - this.expect('.'); - var property = this.parseIdentifierName(); - expr = this.finalize(node, new Node.StaticMemberExpression(expr, property)); - } else if (this.lookahead.type === 10 - /* Template */ - && this.lookahead.head) { - var quasi = this.parseTemplateLiteral(); - expr = this.finalize(node, new Node.TaggedTemplateExpression(expr, quasi)); - } else { - break; - } - } - - return expr; - }; // https://tc39.github.io/ecma262/#sec-update-expressions - - - Parser.prototype.parseUpdateExpression = function () { - var expr; - var startToken = this.lookahead; - - if (this.match('++') || this.match('--')) { - var node = this.startNode(startToken); - var token = this.nextToken(); - expr = this.inheritCoverGrammar(this.parseUnaryExpression); - - if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) { - this.tolerateError(messages_1.Messages.StrictLHSPrefix); - } - - if (!this.context.isAssignmentTarget) { - this.tolerateError(messages_1.Messages.InvalidLHSInAssignment); - } - - var prefix = true; - expr = this.finalize(node, new Node.UpdateExpression(token.value, expr, prefix)); - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - } else { - expr = this.inheritCoverGrammar(this.parseLeftHandSideExpressionAllowCall); - - if (!this.hasLineTerminator && this.lookahead.type === 7 - /* Punctuator */ - ) { - if (this.match('++') || this.match('--')) { - if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) { - this.tolerateError(messages_1.Messages.StrictLHSPostfix); - } - - if (!this.context.isAssignmentTarget) { - this.tolerateError(messages_1.Messages.InvalidLHSInAssignment); - } - - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - var operator = this.nextToken().value; - var prefix = false; - expr = this.finalize(this.startNode(startToken), new Node.UpdateExpression(operator, expr, prefix)); - } - } - } - - return expr; - }; // https://tc39.github.io/ecma262/#sec-unary-operators - - - Parser.prototype.parseAwaitExpression = function () { - var node = this.createNode(); - this.nextToken(); - var argument = this.parseUnaryExpression(); - return this.finalize(node, new Node.AwaitExpression(argument)); - }; - - Parser.prototype.parseUnaryExpression = function () { - var expr; - - if (this.match('+') || this.match('-') || this.match('~') || this.match('!') || this.matchKeyword('delete') || this.matchKeyword('void') || this.matchKeyword('typeof')) { - var node = this.startNode(this.lookahead); - var token = this.nextToken(); - expr = this.inheritCoverGrammar(this.parseUnaryExpression); - expr = this.finalize(node, new Node.UnaryExpression(token.value, expr)); - - if (this.context.strict && expr.operator === 'delete' && expr.argument.type === syntax_1.Syntax.Identifier) { - this.tolerateError(messages_1.Messages.StrictDelete); - } - - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - } else if (this.context.await && this.matchContextualKeyword('await')) { - expr = this.parseAwaitExpression(); - } else { - expr = this.parseUpdateExpression(); - } - - return expr; - }; - - Parser.prototype.parseExponentiationExpression = function () { - var startToken = this.lookahead; - var expr = this.inheritCoverGrammar(this.parseUnaryExpression); - - if (expr.type !== syntax_1.Syntax.UnaryExpression && this.match('**')) { - this.nextToken(); - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - var left = expr; - var right = this.isolateCoverGrammar(this.parseExponentiationExpression); - expr = this.finalize(this.startNode(startToken), new Node.BinaryExpression('**', left, right)); - } - - return expr; - }; // https://tc39.github.io/ecma262/#sec-exp-operator - // https://tc39.github.io/ecma262/#sec-multiplicative-operators - // https://tc39.github.io/ecma262/#sec-additive-operators - // https://tc39.github.io/ecma262/#sec-bitwise-shift-operators - // https://tc39.github.io/ecma262/#sec-relational-operators - // https://tc39.github.io/ecma262/#sec-equality-operators - // https://tc39.github.io/ecma262/#sec-binary-bitwise-operators - // https://tc39.github.io/ecma262/#sec-binary-logical-operators - - - Parser.prototype.binaryPrecedence = function (token) { - var op = token.value; - var precedence; - - if (token.type === 7 - /* Punctuator */ - ) { - precedence = this.operatorPrecedence[op] || 0; - } else if (token.type === 4 - /* Keyword */ - ) { - precedence = op === 'instanceof' || this.context.allowIn && op === 'in' ? 7 : 0; - } else { - precedence = 0; - } - - return precedence; - }; - - Parser.prototype.parseBinaryExpression = function () { - var startToken = this.lookahead; - var expr = this.inheritCoverGrammar(this.parseExponentiationExpression); - var token = this.lookahead; - var prec = this.binaryPrecedence(token); - - if (prec > 0) { - this.nextToken(); - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - var markers = [startToken, this.lookahead]; - var left = expr; - var right = this.isolateCoverGrammar(this.parseExponentiationExpression); - var stack = [left, token.value, right]; - var precedences = [prec]; - - while (true) { - prec = this.binaryPrecedence(this.lookahead); - - if (prec <= 0) { - break; - } // Reduce: make a binary expression from the three topmost entries. - - - while (stack.length > 2 && prec <= precedences[precedences.length - 1]) { - right = stack.pop(); - var operator = stack.pop(); - precedences.pop(); - left = stack.pop(); - markers.pop(); - var node = this.startNode(markers[markers.length - 1]); - stack.push(this.finalize(node, new Node.BinaryExpression(operator, left, right))); - } // Shift. - - - stack.push(this.nextToken().value); - precedences.push(prec); - markers.push(this.lookahead); - stack.push(this.isolateCoverGrammar(this.parseExponentiationExpression)); - } // Final reduce to clean-up the stack. - - - var i = stack.length - 1; - expr = stack[i]; - var lastMarker = markers.pop(); - - while (i > 1) { - var marker = markers.pop(); - var lastLineStart = lastMarker && lastMarker.lineStart; - var node = this.startNode(marker, lastLineStart); - var operator = stack[i - 1]; - expr = this.finalize(node, new Node.BinaryExpression(operator, stack[i - 2], expr)); - i -= 2; - lastMarker = marker; - } - } - - return expr; - }; // https://tc39.github.io/ecma262/#sec-conditional-operator - - - Parser.prototype.parseConditionalExpression = function () { - var startToken = this.lookahead; - var expr = this.inheritCoverGrammar(this.parseBinaryExpression); - - if (this.match('?')) { - this.nextToken(); - var previousAllowIn = this.context.allowIn; - this.context.allowIn = true; - var consequent = this.isolateCoverGrammar(this.parseAssignmentExpression); - this.context.allowIn = previousAllowIn; - this.expect(':'); - var alternate = this.isolateCoverGrammar(this.parseAssignmentExpression); - expr = this.finalize(this.startNode(startToken), new Node.ConditionalExpression(expr, consequent, alternate)); - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - } - - return expr; - }; // https://tc39.github.io/ecma262/#sec-assignment-operators - - - Parser.prototype.checkPatternParam = function (options, param) { - switch (param.type) { - case syntax_1.Syntax.Identifier: - this.validateParam(options, param, param.name); - break; - - case syntax_1.Syntax.RestElement: - this.checkPatternParam(options, param.argument); - break; - - case syntax_1.Syntax.AssignmentPattern: - this.checkPatternParam(options, param.left); - break; - - case syntax_1.Syntax.ArrayPattern: - for (var i = 0; i < param.elements.length; i++) { - if (param.elements[i] !== null) { - this.checkPatternParam(options, param.elements[i]); - } - } - - break; - - case syntax_1.Syntax.ObjectPattern: - for (var i = 0; i < param.properties.length; i++) { - this.checkPatternParam(options, param.properties[i].value); - } - - break; - - default: - break; - } - - options.simple = options.simple && param instanceof Node.Identifier; - }; - - Parser.prototype.reinterpretAsCoverFormalsList = function (expr) { - var params = [expr]; - var options; - var asyncArrow = false; - - switch (expr.type) { - case syntax_1.Syntax.Identifier: - break; - - case ArrowParameterPlaceHolder: - params = expr.params; - asyncArrow = expr.async; - break; - - default: - return null; - } - - options = { - simple: true, - paramSet: {} - }; - - for (var i = 0; i < params.length; ++i) { - var param = params[i]; - - if (param.type === syntax_1.Syntax.AssignmentPattern) { - if (param.right.type === syntax_1.Syntax.YieldExpression) { - if (param.right.argument) { - this.throwUnexpectedToken(this.lookahead); - } - - param.right.type = syntax_1.Syntax.Identifier; - param.right.name = 'yield'; - delete param.right.argument; - delete param.right.delegate; - } - } else if (asyncArrow && param.type === syntax_1.Syntax.Identifier && param.name === 'await') { - this.throwUnexpectedToken(this.lookahead); - } - - this.checkPatternParam(options, param); - params[i] = param; - } - - if (this.context.strict || !this.context.allowYield) { - for (var i = 0; i < params.length; ++i) { - var param = params[i]; - - if (param.type === syntax_1.Syntax.YieldExpression) { - this.throwUnexpectedToken(this.lookahead); - } - } - } - - if (options.message === messages_1.Messages.StrictParamDupe) { - var token = this.context.strict ? options.stricted : options.firstRestricted; - this.throwUnexpectedToken(token, options.message); - } - - return { - simple: options.simple, - params: params, - stricted: options.stricted, - firstRestricted: options.firstRestricted, - message: options.message - }; - }; - - Parser.prototype.parseAssignmentExpression = function () { - var expr; - - if (!this.context.allowYield && this.matchKeyword('yield')) { - expr = this.parseYieldExpression(); - } else { - var startToken = this.lookahead; - var token = startToken; - expr = this.parseConditionalExpression(); - - if (token.type === 3 - /* Identifier */ - && token.lineNumber === this.lookahead.lineNumber && token.value === 'async') { - if (this.lookahead.type === 3 - /* Identifier */ - || this.matchKeyword('yield')) { - var arg = this.parsePrimaryExpression(); - this.reinterpretExpressionAsPattern(arg); - expr = { - type: ArrowParameterPlaceHolder, - params: [arg], - async: true - }; - } - } - - if (expr.type === ArrowParameterPlaceHolder || this.match('=>')) { - // https://tc39.github.io/ecma262/#sec-arrow-function-definitions - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - var isAsync = expr.async; - var list = this.reinterpretAsCoverFormalsList(expr); - - if (list) { - if (this.hasLineTerminator) { - this.tolerateUnexpectedToken(this.lookahead); - } - - this.context.firstCoverInitializedNameError = null; - var previousStrict = this.context.strict; - var previousAllowStrictDirective = this.context.allowStrictDirective; - this.context.allowStrictDirective = list.simple; - var previousAllowYield = this.context.allowYield; - var previousAwait = this.context.await; - this.context.allowYield = true; - this.context.await = isAsync; - var node = this.startNode(startToken); - this.expect('=>'); - var body = void 0; - - if (this.match('{')) { - var previousAllowIn = this.context.allowIn; - this.context.allowIn = true; - body = this.parseFunctionSourceElements(); - this.context.allowIn = previousAllowIn; - } else { - body = this.isolateCoverGrammar(this.parseAssignmentExpression); - } - - var expression = body.type !== syntax_1.Syntax.BlockStatement; - - if (this.context.strict && list.firstRestricted) { - this.throwUnexpectedToken(list.firstRestricted, list.message); - } - - if (this.context.strict && list.stricted) { - this.tolerateUnexpectedToken(list.stricted, list.message); - } - - expr = isAsync ? this.finalize(node, new Node.AsyncArrowFunctionExpression(list.params, body, expression)) : this.finalize(node, new Node.ArrowFunctionExpression(list.params, body, expression)); - this.context.strict = previousStrict; - this.context.allowStrictDirective = previousAllowStrictDirective; - this.context.allowYield = previousAllowYield; - this.context.await = previousAwait; - } - } else { - if (this.matchAssign()) { - if (!this.context.isAssignmentTarget) { - this.tolerateError(messages_1.Messages.InvalidLHSInAssignment); - } - - if (this.context.strict && expr.type === syntax_1.Syntax.Identifier) { - var id = expr; - - if (this.scanner.isRestrictedWord(id.name)) { - this.tolerateUnexpectedToken(token, messages_1.Messages.StrictLHSAssignment); - } - - if (this.scanner.isStrictModeReservedWord(id.name)) { - this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord); - } - } - - if (!this.match('=')) { - this.context.isAssignmentTarget = false; - this.context.isBindingElement = false; - } else { - this.reinterpretExpressionAsPattern(expr); - } - - token = this.nextToken(); - var operator = token.value; - var right = this.isolateCoverGrammar(this.parseAssignmentExpression); - expr = this.finalize(this.startNode(startToken), new Node.AssignmentExpression(operator, expr, right)); - this.context.firstCoverInitializedNameError = null; - } - } - } - - return expr; - }; // https://tc39.github.io/ecma262/#sec-comma-operator - - - Parser.prototype.parseExpression = function () { - var startToken = this.lookahead; - var expr = this.isolateCoverGrammar(this.parseAssignmentExpression); - - if (this.match(',')) { - var expressions = []; - expressions.push(expr); - - while (this.lookahead.type !== 2 - /* EOF */ - ) { - if (!this.match(',')) { - break; - } - - this.nextToken(); - expressions.push(this.isolateCoverGrammar(this.parseAssignmentExpression)); - } - - expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions)); - } - - return expr; - }; // https://tc39.github.io/ecma262/#sec-block - - - Parser.prototype.parseStatementListItem = function () { - var statement; - this.context.isAssignmentTarget = true; - this.context.isBindingElement = true; - - if (this.lookahead.type === 4 - /* Keyword */ - ) { - switch (this.lookahead.value) { - case 'export': - if (!this.context.isModule) { - this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalExportDeclaration); - } - - statement = this.parseExportDeclaration(); - break; - - case 'import': - if (!this.context.isModule) { - this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalImportDeclaration); - } - - statement = this.parseImportDeclaration(); - break; - - case 'const': - statement = this.parseLexicalDeclaration({ - inFor: false - }); - break; - - case 'function': - statement = this.parseFunctionDeclaration(); - break; - - case 'class': - statement = this.parseClassDeclaration(); - break; - - case 'let': - statement = this.isLexicalDeclaration() ? this.parseLexicalDeclaration({ - inFor: false - }) : this.parseStatement(); - break; - - default: - statement = this.parseStatement(); - break; - } - } else { - statement = this.parseStatement(); - } - - return statement; - }; - - Parser.prototype.parseBlock = function () { - var node = this.createNode(); - this.expect('{'); - var block = []; - - while (true) { - if (this.match('}')) { - break; - } - - block.push(this.parseStatementListItem()); - } - - this.expect('}'); - return this.finalize(node, new Node.BlockStatement(block)); - }; // https://tc39.github.io/ecma262/#sec-let-and-const-declarations - - - Parser.prototype.parseLexicalBinding = function (kind, options) { - var node = this.createNode(); - var params = []; - var id = this.parsePattern(params, kind); - - if (this.context.strict && id.type === syntax_1.Syntax.Identifier) { - if (this.scanner.isRestrictedWord(id.name)) { - this.tolerateError(messages_1.Messages.StrictVarName); - } - } - - var init = null; - - if (kind === 'const') { - if (!this.matchKeyword('in') && !this.matchContextualKeyword('of')) { - if (this.match('=')) { - this.nextToken(); - init = this.isolateCoverGrammar(this.parseAssignmentExpression); - } else { - this.throwError(messages_1.Messages.DeclarationMissingInitializer, 'const'); - } - } - } else if (!options.inFor && id.type !== syntax_1.Syntax.Identifier || this.match('=')) { - this.expect('='); - init = this.isolateCoverGrammar(this.parseAssignmentExpression); - } - - return this.finalize(node, new Node.VariableDeclarator(id, init)); - }; - - Parser.prototype.parseBindingList = function (kind, options) { - var list = [this.parseLexicalBinding(kind, options)]; - - while (this.match(',')) { - this.nextToken(); - list.push(this.parseLexicalBinding(kind, options)); - } - - return list; - }; - - Parser.prototype.isLexicalDeclaration = function () { - var state = this.scanner.saveState(); - this.scanner.scanComments(); - var next = this.scanner.lex(); - this.scanner.restoreState(state); - return next.type === 3 - /* Identifier */ - || next.type === 7 - /* Punctuator */ - && next.value === '[' || next.type === 7 - /* Punctuator */ - && next.value === '{' || next.type === 4 - /* Keyword */ - && next.value === 'let' || next.type === 4 - /* Keyword */ - && next.value === 'yield'; - }; - - Parser.prototype.parseLexicalDeclaration = function (options) { - var node = this.createNode(); - var kind = this.nextToken().value; - assert_1.assert(kind === 'let' || kind === 'const', 'Lexical declaration must be either let or const'); - var declarations = this.parseBindingList(kind, options); - this.consumeSemicolon(); - return this.finalize(node, new Node.VariableDeclaration(declarations, kind)); - }; // https://tc39.github.io/ecma262/#sec-destructuring-binding-patterns - - - Parser.prototype.parseBindingRestElement = function (params, kind) { - var node = this.createNode(); - this.expect('...'); - var arg = this.parsePattern(params, kind); - return this.finalize(node, new Node.RestElement(arg)); - }; - - Parser.prototype.parseArrayPattern = function (params, kind) { - var node = this.createNode(); - this.expect('['); - var elements = []; - - while (!this.match(']')) { - if (this.match(',')) { - this.nextToken(); - elements.push(null); - } else { - if (this.match('...')) { - elements.push(this.parseBindingRestElement(params, kind)); - break; - } else { - elements.push(this.parsePatternWithDefault(params, kind)); - } - - if (!this.match(']')) { - this.expect(','); - } - } - } - - this.expect(']'); - return this.finalize(node, new Node.ArrayPattern(elements)); - }; - - Parser.prototype.parsePropertyPattern = function (params, kind) { - var node = this.createNode(); - var computed = false; - var shorthand = false; - var method = false; - var key; - var value; - - if (this.lookahead.type === 3 - /* Identifier */ - ) { - var keyToken = this.lookahead; - key = this.parseVariableIdentifier(); - var init = this.finalize(node, new Node.Identifier(keyToken.value)); - - if (this.match('=')) { - params.push(keyToken); - shorthand = true; - this.nextToken(); - var expr = this.parseAssignmentExpression(); - value = this.finalize(this.startNode(keyToken), new Node.AssignmentPattern(init, expr)); - } else if (!this.match(':')) { - params.push(keyToken); - shorthand = true; - value = init; - } else { - this.expect(':'); - value = this.parsePatternWithDefault(params, kind); - } - } else { - computed = this.match('['); - key = this.parseObjectPropertyKey(); - this.expect(':'); - value = this.parsePatternWithDefault(params, kind); - } - - return this.finalize(node, new Node.Property('init', key, computed, value, method, shorthand)); - }; - - Parser.prototype.parseObjectPattern = function (params, kind) { - var node = this.createNode(); - var properties = []; - this.expect('{'); - - while (!this.match('}')) { - properties.push(this.parsePropertyPattern(params, kind)); - - if (!this.match('}')) { - this.expect(','); - } - } - - this.expect('}'); - return this.finalize(node, new Node.ObjectPattern(properties)); - }; - - Parser.prototype.parsePattern = function (params, kind) { - var pattern; - - if (this.match('[')) { - pattern = this.parseArrayPattern(params, kind); - } else if (this.match('{')) { - pattern = this.parseObjectPattern(params, kind); - } else { - if (this.matchKeyword('let') && (kind === 'const' || kind === 'let')) { - this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.LetInLexicalBinding); - } - - params.push(this.lookahead); - pattern = this.parseVariableIdentifier(kind); - } - - return pattern; - }; - - Parser.prototype.parsePatternWithDefault = function (params, kind) { - var startToken = this.lookahead; - var pattern = this.parsePattern(params, kind); - - if (this.match('=')) { - this.nextToken(); - var previousAllowYield = this.context.allowYield; - this.context.allowYield = true; - var right = this.isolateCoverGrammar(this.parseAssignmentExpression); - this.context.allowYield = previousAllowYield; - pattern = this.finalize(this.startNode(startToken), new Node.AssignmentPattern(pattern, right)); - } - - return pattern; - }; // https://tc39.github.io/ecma262/#sec-variable-statement - - - Parser.prototype.parseVariableIdentifier = function (kind) { - var node = this.createNode(); - var token = this.nextToken(); - - if (token.type === 4 - /* Keyword */ - && token.value === 'yield') { - if (this.context.strict) { - this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord); - } else if (!this.context.allowYield) { - this.throwUnexpectedToken(token); - } - } else if (token.type !== 3 - /* Identifier */ - ) { - if (this.context.strict && token.type === 4 - /* Keyword */ - && this.scanner.isStrictModeReservedWord(token.value)) { - this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord); - } else { - if (this.context.strict || token.value !== 'let' || kind !== 'var') { - this.throwUnexpectedToken(token); - } - } - } else if ((this.context.isModule || this.context.await) && token.type === 3 - /* Identifier */ - && token.value === 'await') { - this.tolerateUnexpectedToken(token); - } - - return this.finalize(node, new Node.Identifier(token.value)); - }; - - Parser.prototype.parseVariableDeclaration = function (options) { - var node = this.createNode(); - var params = []; - var id = this.parsePattern(params, 'var'); - - if (this.context.strict && id.type === syntax_1.Syntax.Identifier) { - if (this.scanner.isRestrictedWord(id.name)) { - this.tolerateError(messages_1.Messages.StrictVarName); - } - } - - var init = null; - - if (this.match('=')) { - this.nextToken(); - init = this.isolateCoverGrammar(this.parseAssignmentExpression); - } else if (id.type !== syntax_1.Syntax.Identifier && !options.inFor) { - this.expect('='); - } - - return this.finalize(node, new Node.VariableDeclarator(id, init)); - }; - - Parser.prototype.parseVariableDeclarationList = function (options) { - var opt = { - inFor: options.inFor - }; - var list = []; - list.push(this.parseVariableDeclaration(opt)); - - while (this.match(',')) { - this.nextToken(); - list.push(this.parseVariableDeclaration(opt)); - } - - return list; - }; - - Parser.prototype.parseVariableStatement = function () { - var node = this.createNode(); - this.expectKeyword('var'); - var declarations = this.parseVariableDeclarationList({ - inFor: false - }); - this.consumeSemicolon(); - return this.finalize(node, new Node.VariableDeclaration(declarations, 'var')); - }; // https://tc39.github.io/ecma262/#sec-empty-statement - - - Parser.prototype.parseEmptyStatement = function () { - var node = this.createNode(); - this.expect(';'); - return this.finalize(node, new Node.EmptyStatement()); - }; // https://tc39.github.io/ecma262/#sec-expression-statement - - - Parser.prototype.parseExpressionStatement = function () { - var node = this.createNode(); - var expr = this.parseExpression(); - this.consumeSemicolon(); - return this.finalize(node, new Node.ExpressionStatement(expr)); - }; // https://tc39.github.io/ecma262/#sec-if-statement - - - Parser.prototype.parseIfClause = function () { - if (this.context.strict && this.matchKeyword('function')) { - this.tolerateError(messages_1.Messages.StrictFunction); - } - - return this.parseStatement(); - }; - - Parser.prototype.parseIfStatement = function () { - var node = this.createNode(); - var consequent; - var alternate = null; - this.expectKeyword('if'); - this.expect('('); - var test = this.parseExpression(); - - if (!this.match(')') && this.config.tolerant) { - this.tolerateUnexpectedToken(this.nextToken()); - consequent = this.finalize(this.createNode(), new Node.EmptyStatement()); - } else { - this.expect(')'); - consequent = this.parseIfClause(); - - if (this.matchKeyword('else')) { - this.nextToken(); - alternate = this.parseIfClause(); - } - } - - return this.finalize(node, new Node.IfStatement(test, consequent, alternate)); - }; // https://tc39.github.io/ecma262/#sec-do-while-statement - - - Parser.prototype.parseDoWhileStatement = function () { - var node = this.createNode(); - this.expectKeyword('do'); - var previousInIteration = this.context.inIteration; - this.context.inIteration = true; - var body = this.parseStatement(); - this.context.inIteration = previousInIteration; - this.expectKeyword('while'); - this.expect('('); - var test = this.parseExpression(); - - if (!this.match(')') && this.config.tolerant) { - this.tolerateUnexpectedToken(this.nextToken()); - } else { - this.expect(')'); - - if (this.match(';')) { - this.nextToken(); - } - } - - return this.finalize(node, new Node.DoWhileStatement(body, test)); - }; // https://tc39.github.io/ecma262/#sec-while-statement - - - Parser.prototype.parseWhileStatement = function () { - var node = this.createNode(); - var body; - this.expectKeyword('while'); - this.expect('('); - var test = this.parseExpression(); - - if (!this.match(')') && this.config.tolerant) { - this.tolerateUnexpectedToken(this.nextToken()); - body = this.finalize(this.createNode(), new Node.EmptyStatement()); - } else { - this.expect(')'); - var previousInIteration = this.context.inIteration; - this.context.inIteration = true; - body = this.parseStatement(); - this.context.inIteration = previousInIteration; - } - - return this.finalize(node, new Node.WhileStatement(test, body)); - }; // https://tc39.github.io/ecma262/#sec-for-statement - // https://tc39.github.io/ecma262/#sec-for-in-and-for-of-statements - - - Parser.prototype.parseForStatement = function () { - var init = null; - var test = null; - var update = null; - var forIn = true; - var left, right; - var node = this.createNode(); - this.expectKeyword('for'); - this.expect('('); - - if (this.match(';')) { - this.nextToken(); - } else { - if (this.matchKeyword('var')) { - init = this.createNode(); - this.nextToken(); - var previousAllowIn = this.context.allowIn; - this.context.allowIn = false; - var declarations = this.parseVariableDeclarationList({ - inFor: true - }); - this.context.allowIn = previousAllowIn; - - if (declarations.length === 1 && this.matchKeyword('in')) { - var decl = declarations[0]; - - if (decl.init && (decl.id.type === syntax_1.Syntax.ArrayPattern || decl.id.type === syntax_1.Syntax.ObjectPattern || this.context.strict)) { - this.tolerateError(messages_1.Messages.ForInOfLoopInitializer, 'for-in'); - } - - init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var')); - this.nextToken(); - left = init; - right = this.parseExpression(); - init = null; - } else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) { - init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var')); - this.nextToken(); - left = init; - right = this.parseAssignmentExpression(); - init = null; - forIn = false; - } else { - init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var')); - this.expect(';'); - } - } else if (this.matchKeyword('const') || this.matchKeyword('let')) { - init = this.createNode(); - var kind = this.nextToken().value; - - if (!this.context.strict && this.lookahead.value === 'in') { - init = this.finalize(init, new Node.Identifier(kind)); - this.nextToken(); - left = init; - right = this.parseExpression(); - init = null; - } else { - var previousAllowIn = this.context.allowIn; - this.context.allowIn = false; - var declarations = this.parseBindingList(kind, { - inFor: true - }); - this.context.allowIn = previousAllowIn; - - if (declarations.length === 1 && declarations[0].init === null && this.matchKeyword('in')) { - init = this.finalize(init, new Node.VariableDeclaration(declarations, kind)); - this.nextToken(); - left = init; - right = this.parseExpression(); - init = null; - } else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) { - init = this.finalize(init, new Node.VariableDeclaration(declarations, kind)); - this.nextToken(); - left = init; - right = this.parseAssignmentExpression(); - init = null; - forIn = false; - } else { - this.consumeSemicolon(); - init = this.finalize(init, new Node.VariableDeclaration(declarations, kind)); - } - } - } else { - var initStartToken = this.lookahead; - var previousAllowIn = this.context.allowIn; - this.context.allowIn = false; - init = this.inheritCoverGrammar(this.parseAssignmentExpression); - this.context.allowIn = previousAllowIn; - - if (this.matchKeyword('in')) { - if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) { - this.tolerateError(messages_1.Messages.InvalidLHSInForIn); - } - - this.nextToken(); - this.reinterpretExpressionAsPattern(init); - left = init; - right = this.parseExpression(); - init = null; - } else if (this.matchContextualKeyword('of')) { - if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) { - this.tolerateError(messages_1.Messages.InvalidLHSInForLoop); - } - - this.nextToken(); - this.reinterpretExpressionAsPattern(init); - left = init; - right = this.parseAssignmentExpression(); - init = null; - forIn = false; - } else { - if (this.match(',')) { - var initSeq = [init]; - - while (this.match(',')) { - this.nextToken(); - initSeq.push(this.isolateCoverGrammar(this.parseAssignmentExpression)); - } - - init = this.finalize(this.startNode(initStartToken), new Node.SequenceExpression(initSeq)); - } - - this.expect(';'); - } - } - } - - if (typeof left === 'undefined') { - if (!this.match(';')) { - test = this.parseExpression(); - } - - this.expect(';'); - - if (!this.match(')')) { - update = this.parseExpression(); - } - } - - var body; - - if (!this.match(')') && this.config.tolerant) { - this.tolerateUnexpectedToken(this.nextToken()); - body = this.finalize(this.createNode(), new Node.EmptyStatement()); - } else { - this.expect(')'); - var previousInIteration = this.context.inIteration; - this.context.inIteration = true; - body = this.isolateCoverGrammar(this.parseStatement); - this.context.inIteration = previousInIteration; - } - - return typeof left === 'undefined' ? this.finalize(node, new Node.ForStatement(init, test, update, body)) : forIn ? this.finalize(node, new Node.ForInStatement(left, right, body)) : this.finalize(node, new Node.ForOfStatement(left, right, body)); - }; // https://tc39.github.io/ecma262/#sec-continue-statement - - - Parser.prototype.parseContinueStatement = function () { - var node = this.createNode(); - this.expectKeyword('continue'); - var label = null; - - if (this.lookahead.type === 3 - /* Identifier */ - && !this.hasLineTerminator) { - var id = this.parseVariableIdentifier(); - label = id; - var key = '$' + id.name; - - if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) { - this.throwError(messages_1.Messages.UnknownLabel, id.name); - } - } - - this.consumeSemicolon(); - - if (label === null && !this.context.inIteration) { - this.throwError(messages_1.Messages.IllegalContinue); - } - - return this.finalize(node, new Node.ContinueStatement(label)); - }; // https://tc39.github.io/ecma262/#sec-break-statement - - - Parser.prototype.parseBreakStatement = function () { - var node = this.createNode(); - this.expectKeyword('break'); - var label = null; - - if (this.lookahead.type === 3 - /* Identifier */ - && !this.hasLineTerminator) { - var id = this.parseVariableIdentifier(); - var key = '$' + id.name; - - if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) { - this.throwError(messages_1.Messages.UnknownLabel, id.name); - } - - label = id; - } - - this.consumeSemicolon(); - - if (label === null && !this.context.inIteration && !this.context.inSwitch) { - this.throwError(messages_1.Messages.IllegalBreak); - } - - return this.finalize(node, new Node.BreakStatement(label)); - }; // https://tc39.github.io/ecma262/#sec-return-statement - - - Parser.prototype.parseReturnStatement = function () { - if (!this.context.inFunctionBody) { - this.tolerateError(messages_1.Messages.IllegalReturn); - } - - var node = this.createNode(); - this.expectKeyword('return'); - var hasArgument = !this.match(';') && !this.match('}') && !this.hasLineTerminator && this.lookahead.type !== 2 - /* EOF */ - || this.lookahead.type === 8 - /* StringLiteral */ - || this.lookahead.type === 10 - /* Template */ - ; - var argument = hasArgument ? this.parseExpression() : null; - this.consumeSemicolon(); - return this.finalize(node, new Node.ReturnStatement(argument)); - }; // https://tc39.github.io/ecma262/#sec-with-statement - - - Parser.prototype.parseWithStatement = function () { - if (this.context.strict) { - this.tolerateError(messages_1.Messages.StrictModeWith); - } - - var node = this.createNode(); - var body; - this.expectKeyword('with'); - this.expect('('); - var object = this.parseExpression(); - - if (!this.match(')') && this.config.tolerant) { - this.tolerateUnexpectedToken(this.nextToken()); - body = this.finalize(this.createNode(), new Node.EmptyStatement()); - } else { - this.expect(')'); - body = this.parseStatement(); - } - - return this.finalize(node, new Node.WithStatement(object, body)); - }; // https://tc39.github.io/ecma262/#sec-switch-statement - - - Parser.prototype.parseSwitchCase = function () { - var node = this.createNode(); - var test; - - if (this.matchKeyword('default')) { - this.nextToken(); - test = null; - } else { - this.expectKeyword('case'); - test = this.parseExpression(); - } - - this.expect(':'); - var consequent = []; - - while (true) { - if (this.match('}') || this.matchKeyword('default') || this.matchKeyword('case')) { - break; - } - - consequent.push(this.parseStatementListItem()); - } - - return this.finalize(node, new Node.SwitchCase(test, consequent)); - }; - - Parser.prototype.parseSwitchStatement = function () { - var node = this.createNode(); - this.expectKeyword('switch'); - this.expect('('); - var discriminant = this.parseExpression(); - this.expect(')'); - var previousInSwitch = this.context.inSwitch; - this.context.inSwitch = true; - var cases = []; - var defaultFound = false; - this.expect('{'); - - while (true) { - if (this.match('}')) { - break; - } - - var clause = this.parseSwitchCase(); - - if (clause.test === null) { - if (defaultFound) { - this.throwError(messages_1.Messages.MultipleDefaultsInSwitch); - } - - defaultFound = true; - } - - cases.push(clause); - } - - this.expect('}'); - this.context.inSwitch = previousInSwitch; - return this.finalize(node, new Node.SwitchStatement(discriminant, cases)); - }; // https://tc39.github.io/ecma262/#sec-labelled-statements - - - Parser.prototype.parseLabelledStatement = function () { - var node = this.createNode(); - var expr = this.parseExpression(); - var statement; - - if (expr.type === syntax_1.Syntax.Identifier && this.match(':')) { - this.nextToken(); - var id = expr; - var key = '$' + id.name; - - if (Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) { - this.throwError(messages_1.Messages.Redeclaration, 'Label', id.name); - } - - this.context.labelSet[key] = true; - var body = void 0; - - if (this.matchKeyword('class')) { - this.tolerateUnexpectedToken(this.lookahead); - body = this.parseClassDeclaration(); - } else if (this.matchKeyword('function')) { - var token = this.lookahead; - var declaration = this.parseFunctionDeclaration(); - - if (this.context.strict) { - this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunction); - } else if (declaration.generator) { - this.tolerateUnexpectedToken(token, messages_1.Messages.GeneratorInLegacyContext); - } - - body = declaration; - } else { - body = this.parseStatement(); - } - - delete this.context.labelSet[key]; - statement = new Node.LabeledStatement(id, body); - } else { - this.consumeSemicolon(); - statement = new Node.ExpressionStatement(expr); - } - - return this.finalize(node, statement); - }; // https://tc39.github.io/ecma262/#sec-throw-statement - - - Parser.prototype.parseThrowStatement = function () { - var node = this.createNode(); - this.expectKeyword('throw'); - - if (this.hasLineTerminator) { - this.throwError(messages_1.Messages.NewlineAfterThrow); - } - - var argument = this.parseExpression(); - this.consumeSemicolon(); - return this.finalize(node, new Node.ThrowStatement(argument)); - }; // https://tc39.github.io/ecma262/#sec-try-statement - - - Parser.prototype.parseCatchClause = function () { - var node = this.createNode(); - this.expectKeyword('catch'); - this.expect('('); - - if (this.match(')')) { - this.throwUnexpectedToken(this.lookahead); - } - - var params = []; - var param = this.parsePattern(params); - var paramMap = {}; - - for (var i = 0; i < params.length; i++) { - var key = '$' + params[i].value; - - if (Object.prototype.hasOwnProperty.call(paramMap, key)) { - this.tolerateError(messages_1.Messages.DuplicateBinding, params[i].value); - } - - paramMap[key] = true; - } - - if (this.context.strict && param.type === syntax_1.Syntax.Identifier) { - if (this.scanner.isRestrictedWord(param.name)) { - this.tolerateError(messages_1.Messages.StrictCatchVariable); - } - } - - this.expect(')'); - var body = this.parseBlock(); - return this.finalize(node, new Node.CatchClause(param, body)); - }; - - Parser.prototype.parseFinallyClause = function () { - this.expectKeyword('finally'); - return this.parseBlock(); - }; - - Parser.prototype.parseTryStatement = function () { - var node = this.createNode(); - this.expectKeyword('try'); - var block = this.parseBlock(); - var handler = this.matchKeyword('catch') ? this.parseCatchClause() : null; - var finalizer = this.matchKeyword('finally') ? this.parseFinallyClause() : null; - - if (!handler && !finalizer) { - this.throwError(messages_1.Messages.NoCatchOrFinally); - } - - return this.finalize(node, new Node.TryStatement(block, handler, finalizer)); - }; // https://tc39.github.io/ecma262/#sec-debugger-statement - - - Parser.prototype.parseDebuggerStatement = function () { - var node = this.createNode(); - this.expectKeyword('debugger'); - this.consumeSemicolon(); - return this.finalize(node, new Node.DebuggerStatement()); - }; // https://tc39.github.io/ecma262/#sec-ecmascript-language-statements-and-declarations - - - Parser.prototype.parseStatement = function () { - var statement; - - switch (this.lookahead.type) { - case 1 - /* BooleanLiteral */ - : - case 5 - /* NullLiteral */ - : - case 6 - /* NumericLiteral */ - : - case 8 - /* StringLiteral */ - : - case 10 - /* Template */ - : - case 9 - /* RegularExpression */ - : - statement = this.parseExpressionStatement(); - break; - - case 7 - /* Punctuator */ - : - var value = this.lookahead.value; - - if (value === '{') { - statement = this.parseBlock(); - } else if (value === '(') { - statement = this.parseExpressionStatement(); - } else if (value === ';') { - statement = this.parseEmptyStatement(); - } else { - statement = this.parseExpressionStatement(); - } - - break; - - case 3 - /* Identifier */ - : - statement = this.matchAsyncFunction() ? this.parseFunctionDeclaration() : this.parseLabelledStatement(); - break; - - case 4 - /* Keyword */ - : - switch (this.lookahead.value) { - case 'break': - statement = this.parseBreakStatement(); - break; - - case 'continue': - statement = this.parseContinueStatement(); - break; - - case 'debugger': - statement = this.parseDebuggerStatement(); - break; - - case 'do': - statement = this.parseDoWhileStatement(); - break; - - case 'for': - statement = this.parseForStatement(); - break; - - case 'function': - statement = this.parseFunctionDeclaration(); - break; - - case 'if': - statement = this.parseIfStatement(); - break; - - case 'return': - statement = this.parseReturnStatement(); - break; - - case 'switch': - statement = this.parseSwitchStatement(); - break; - - case 'throw': - statement = this.parseThrowStatement(); - break; - - case 'try': - statement = this.parseTryStatement(); - break; - - case 'var': - statement = this.parseVariableStatement(); - break; - - case 'while': - statement = this.parseWhileStatement(); - break; - - case 'with': - statement = this.parseWithStatement(); - break; - - default: - statement = this.parseExpressionStatement(); - break; - } - - break; - - default: - statement = this.throwUnexpectedToken(this.lookahead); - } - - return statement; - }; // https://tc39.github.io/ecma262/#sec-function-definitions - - - Parser.prototype.parseFunctionSourceElements = function () { - var node = this.createNode(); - this.expect('{'); - var body = this.parseDirectivePrologues(); - var previousLabelSet = this.context.labelSet; - var previousInIteration = this.context.inIteration; - var previousInSwitch = this.context.inSwitch; - var previousInFunctionBody = this.context.inFunctionBody; - this.context.labelSet = {}; - this.context.inIteration = false; - this.context.inSwitch = false; - this.context.inFunctionBody = true; - - while (this.lookahead.type !== 2 - /* EOF */ - ) { - if (this.match('}')) { - break; - } - - body.push(this.parseStatementListItem()); - } - - this.expect('}'); - this.context.labelSet = previousLabelSet; - this.context.inIteration = previousInIteration; - this.context.inSwitch = previousInSwitch; - this.context.inFunctionBody = previousInFunctionBody; - return this.finalize(node, new Node.BlockStatement(body)); - }; - - Parser.prototype.validateParam = function (options, param, name) { - var key = '$' + name; - - if (this.context.strict) { - if (this.scanner.isRestrictedWord(name)) { - options.stricted = param; - options.message = messages_1.Messages.StrictParamName; - } - - if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) { - options.stricted = param; - options.message = messages_1.Messages.StrictParamDupe; - } - } else if (!options.firstRestricted) { - if (this.scanner.isRestrictedWord(name)) { - options.firstRestricted = param; - options.message = messages_1.Messages.StrictParamName; - } else if (this.scanner.isStrictModeReservedWord(name)) { - options.firstRestricted = param; - options.message = messages_1.Messages.StrictReservedWord; - } else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) { - options.stricted = param; - options.message = messages_1.Messages.StrictParamDupe; - } - } - /* istanbul ignore next */ - - - if (typeof Object.defineProperty === 'function') { - Object.defineProperty(options.paramSet, key, { - value: true, - enumerable: true, - writable: true, - configurable: true - }); - } else { - options.paramSet[key] = true; - } - }; - - Parser.prototype.parseRestElement = function (params) { - var node = this.createNode(); - this.expect('...'); - var arg = this.parsePattern(params); - - if (this.match('=')) { - this.throwError(messages_1.Messages.DefaultRestParameter); - } - - if (!this.match(')')) { - this.throwError(messages_1.Messages.ParameterAfterRestParameter); - } - - return this.finalize(node, new Node.RestElement(arg)); - }; - - Parser.prototype.parseFormalParameter = function (options) { - var params = []; - var param = this.match('...') ? this.parseRestElement(params) : this.parsePatternWithDefault(params); - - for (var i = 0; i < params.length; i++) { - this.validateParam(options, params[i], params[i].value); - } - - options.simple = options.simple && param instanceof Node.Identifier; - options.params.push(param); - }; - - Parser.prototype.parseFormalParameters = function (firstRestricted) { - var options; - options = { - simple: true, - params: [], - firstRestricted: firstRestricted - }; - this.expect('('); - - if (!this.match(')')) { - options.paramSet = {}; - - while (this.lookahead.type !== 2 - /* EOF */ - ) { - this.parseFormalParameter(options); - - if (this.match(')')) { - break; - } - - this.expect(','); - - if (this.match(')')) { - break; - } - } - } - - this.expect(')'); - return { - simple: options.simple, - params: options.params, - stricted: options.stricted, - firstRestricted: options.firstRestricted, - message: options.message - }; - }; - - Parser.prototype.matchAsyncFunction = function () { - var match = this.matchContextualKeyword('async'); - - if (match) { - var state = this.scanner.saveState(); - this.scanner.scanComments(); - var next = this.scanner.lex(); - this.scanner.restoreState(state); - match = state.lineNumber === next.lineNumber && next.type === 4 - /* Keyword */ - && next.value === 'function'; - } - - return match; - }; - - Parser.prototype.parseFunctionDeclaration = function (identifierIsOptional) { - var node = this.createNode(); - var isAsync = this.matchContextualKeyword('async'); - - if (isAsync) { - this.nextToken(); - } - - this.expectKeyword('function'); - var isGenerator = isAsync ? false : this.match('*'); - - if (isGenerator) { - this.nextToken(); - } - - var message; - var id = null; - var firstRestricted = null; - - if (!identifierIsOptional || !this.match('(')) { - var token = this.lookahead; - id = this.parseVariableIdentifier(); - - if (this.context.strict) { - if (this.scanner.isRestrictedWord(token.value)) { - this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName); - } - } else { - if (this.scanner.isRestrictedWord(token.value)) { - firstRestricted = token; - message = messages_1.Messages.StrictFunctionName; - } else if (this.scanner.isStrictModeReservedWord(token.value)) { - firstRestricted = token; - message = messages_1.Messages.StrictReservedWord; - } - } - } - - var previousAllowAwait = this.context.await; - var previousAllowYield = this.context.allowYield; - this.context.await = isAsync; - this.context.allowYield = !isGenerator; - var formalParameters = this.parseFormalParameters(firstRestricted); - var params = formalParameters.params; - var stricted = formalParameters.stricted; - firstRestricted = formalParameters.firstRestricted; - - if (formalParameters.message) { - message = formalParameters.message; - } - - var previousStrict = this.context.strict; - var previousAllowStrictDirective = this.context.allowStrictDirective; - this.context.allowStrictDirective = formalParameters.simple; - var body = this.parseFunctionSourceElements(); - - if (this.context.strict && firstRestricted) { - this.throwUnexpectedToken(firstRestricted, message); - } - - if (this.context.strict && stricted) { - this.tolerateUnexpectedToken(stricted, message); - } - - this.context.strict = previousStrict; - this.context.allowStrictDirective = previousAllowStrictDirective; - this.context.await = previousAllowAwait; - this.context.allowYield = previousAllowYield; - return isAsync ? this.finalize(node, new Node.AsyncFunctionDeclaration(id, params, body)) : this.finalize(node, new Node.FunctionDeclaration(id, params, body, isGenerator)); - }; - - Parser.prototype.parseFunctionExpression = function () { - var node = this.createNode(); - var isAsync = this.matchContextualKeyword('async'); - - if (isAsync) { - this.nextToken(); - } - - this.expectKeyword('function'); - var isGenerator = isAsync ? false : this.match('*'); - - if (isGenerator) { - this.nextToken(); - } - - var message; - var id = null; - var firstRestricted; - var previousAllowAwait = this.context.await; - var previousAllowYield = this.context.allowYield; - this.context.await = isAsync; - this.context.allowYield = !isGenerator; - - if (!this.match('(')) { - var token = this.lookahead; - id = !this.context.strict && !isGenerator && this.matchKeyword('yield') ? this.parseIdentifierName() : this.parseVariableIdentifier(); - - if (this.context.strict) { - if (this.scanner.isRestrictedWord(token.value)) { - this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName); - } - } else { - if (this.scanner.isRestrictedWord(token.value)) { - firstRestricted = token; - message = messages_1.Messages.StrictFunctionName; - } else if (this.scanner.isStrictModeReservedWord(token.value)) { - firstRestricted = token; - message = messages_1.Messages.StrictReservedWord; - } - } - } - - var formalParameters = this.parseFormalParameters(firstRestricted); - var params = formalParameters.params; - var stricted = formalParameters.stricted; - firstRestricted = formalParameters.firstRestricted; - - if (formalParameters.message) { - message = formalParameters.message; - } - - var previousStrict = this.context.strict; - var previousAllowStrictDirective = this.context.allowStrictDirective; - this.context.allowStrictDirective = formalParameters.simple; - var body = this.parseFunctionSourceElements(); - - if (this.context.strict && firstRestricted) { - this.throwUnexpectedToken(firstRestricted, message); - } - - if (this.context.strict && stricted) { - this.tolerateUnexpectedToken(stricted, message); - } - - this.context.strict = previousStrict; - this.context.allowStrictDirective = previousAllowStrictDirective; - this.context.await = previousAllowAwait; - this.context.allowYield = previousAllowYield; - return isAsync ? this.finalize(node, new Node.AsyncFunctionExpression(id, params, body)) : this.finalize(node, new Node.FunctionExpression(id, params, body, isGenerator)); - }; // https://tc39.github.io/ecma262/#sec-directive-prologues-and-the-use-strict-directive - - - Parser.prototype.parseDirective = function () { - var token = this.lookahead; - var node = this.createNode(); - var expr = this.parseExpression(); - var directive = expr.type === syntax_1.Syntax.Literal ? this.getTokenRaw(token).slice(1, -1) : null; - this.consumeSemicolon(); - return this.finalize(node, directive ? new Node.Directive(expr, directive) : new Node.ExpressionStatement(expr)); - }; - - Parser.prototype.parseDirectivePrologues = function () { - var firstRestricted = null; - var body = []; - - while (true) { - var token = this.lookahead; - - if (token.type !== 8 - /* StringLiteral */ - ) { - break; - } - - var statement = this.parseDirective(); - body.push(statement); - var directive = statement.directive; - - if (typeof directive !== 'string') { - break; - } - - if (directive === 'use strict') { - this.context.strict = true; - - if (firstRestricted) { - this.tolerateUnexpectedToken(firstRestricted, messages_1.Messages.StrictOctalLiteral); - } - - if (!this.context.allowStrictDirective) { - this.tolerateUnexpectedToken(token, messages_1.Messages.IllegalLanguageModeDirective); - } - } else { - if (!firstRestricted && token.octal) { - firstRestricted = token; - } - } - } - - return body; - }; // https://tc39.github.io/ecma262/#sec-method-definitions - - - Parser.prototype.qualifiedPropertyName = function (token) { - switch (token.type) { - case 3 - /* Identifier */ - : - case 8 - /* StringLiteral */ - : - case 1 - /* BooleanLiteral */ - : - case 5 - /* NullLiteral */ - : - case 6 - /* NumericLiteral */ - : - case 4 - /* Keyword */ - : - return true; - - case 7 - /* Punctuator */ - : - return token.value === '['; - - default: - break; - } - - return false; - }; - - Parser.prototype.parseGetterMethod = function () { - var node = this.createNode(); - var isGenerator = false; - var previousAllowYield = this.context.allowYield; - this.context.allowYield = !isGenerator; - var formalParameters = this.parseFormalParameters(); - - if (formalParameters.params.length > 0) { - this.tolerateError(messages_1.Messages.BadGetterArity); - } - - var method = this.parsePropertyMethod(formalParameters); - this.context.allowYield = previousAllowYield; - return this.finalize(node, new Node.FunctionExpression(null, formalParameters.params, method, isGenerator)); - }; - - Parser.prototype.parseSetterMethod = function () { - var node = this.createNode(); - var isGenerator = false; - var previousAllowYield = this.context.allowYield; - this.context.allowYield = !isGenerator; - var formalParameters = this.parseFormalParameters(); - - if (formalParameters.params.length !== 1) { - this.tolerateError(messages_1.Messages.BadSetterArity); - } else if (formalParameters.params[0] instanceof Node.RestElement) { - this.tolerateError(messages_1.Messages.BadSetterRestParameter); - } - - var method = this.parsePropertyMethod(formalParameters); - this.context.allowYield = previousAllowYield; - return this.finalize(node, new Node.FunctionExpression(null, formalParameters.params, method, isGenerator)); - }; - - Parser.prototype.parseGeneratorMethod = function () { - var node = this.createNode(); - var isGenerator = true; - var previousAllowYield = this.context.allowYield; - this.context.allowYield = true; - var params = this.parseFormalParameters(); - this.context.allowYield = false; - var method = this.parsePropertyMethod(params); - this.context.allowYield = previousAllowYield; - return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator)); - }; // https://tc39.github.io/ecma262/#sec-generator-function-definitions - - - Parser.prototype.isStartOfExpression = function () { - var start = true; - var value = this.lookahead.value; - - switch (this.lookahead.type) { - case 7 - /* Punctuator */ - : - start = value === '[' || value === '(' || value === '{' || value === '+' || value === '-' || value === '!' || value === '~' || value === '++' || value === '--' || value === '/' || value === '/='; // regular expression literal - - break; - - case 4 - /* Keyword */ - : - start = value === 'class' || value === 'delete' || value === 'function' || value === 'let' || value === 'new' || value === 'super' || value === 'this' || value === 'typeof' || value === 'void' || value === 'yield'; - break; - - default: - break; - } - - return start; - }; - - Parser.prototype.parseYieldExpression = function () { - var node = this.createNode(); - this.expectKeyword('yield'); - var argument = null; - var delegate = false; - - if (!this.hasLineTerminator) { - var previousAllowYield = this.context.allowYield; - this.context.allowYield = false; - delegate = this.match('*'); - - if (delegate) { - this.nextToken(); - argument = this.parseAssignmentExpression(); - } else if (this.isStartOfExpression()) { - argument = this.parseAssignmentExpression(); - } - - this.context.allowYield = previousAllowYield; - } - - return this.finalize(node, new Node.YieldExpression(argument, delegate)); - }; // https://tc39.github.io/ecma262/#sec-class-definitions - - - Parser.prototype.parseClassElement = function (hasConstructor) { - var token = this.lookahead; - var node = this.createNode(); - var kind = ''; - var key = null; - var value = null; - var computed = false; - var method = false; - var isStatic = false; - var isAsync = false; - - if (this.match('*')) { - this.nextToken(); - } else { - computed = this.match('['); - key = this.parseObjectPropertyKey(); - var id = key; - - if (id.name === 'static' && (this.qualifiedPropertyName(this.lookahead) || this.match('*'))) { - token = this.lookahead; - isStatic = true; - computed = this.match('['); - - if (this.match('*')) { - this.nextToken(); - } else { - key = this.parseObjectPropertyKey(); - } - } - - if (token.type === 3 - /* Identifier */ - && !this.hasLineTerminator && token.value === 'async') { - var punctuator = this.lookahead.value; - - if (punctuator !== ':' && punctuator !== '(' && punctuator !== '*') { - isAsync = true; - token = this.lookahead; - key = this.parseObjectPropertyKey(); - - if (token.type === 3 - /* Identifier */ - && token.value === 'constructor') { - this.tolerateUnexpectedToken(token, messages_1.Messages.ConstructorIsAsync); - } - } - } - } - - var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead); - - if (token.type === 3 - /* Identifier */ - ) { - if (token.value === 'get' && lookaheadPropertyKey) { - kind = 'get'; - computed = this.match('['); - key = this.parseObjectPropertyKey(); - this.context.allowYield = false; - value = this.parseGetterMethod(); - } else if (token.value === 'set' && lookaheadPropertyKey) { - kind = 'set'; - computed = this.match('['); - key = this.parseObjectPropertyKey(); - value = this.parseSetterMethod(); - } - } else if (token.type === 7 - /* Punctuator */ - && token.value === '*' && lookaheadPropertyKey) { - kind = 'init'; - computed = this.match('['); - key = this.parseObjectPropertyKey(); - value = this.parseGeneratorMethod(); - method = true; - } - - if (!kind && key && this.match('(')) { - kind = 'init'; - value = isAsync ? this.parsePropertyMethodAsyncFunction() : this.parsePropertyMethodFunction(); - method = true; - } - - if (!kind) { - this.throwUnexpectedToken(this.lookahead); - } - - if (kind === 'init') { - kind = 'method'; - } - - if (!computed) { - if (isStatic && this.isPropertyKey(key, 'prototype')) { - this.throwUnexpectedToken(token, messages_1.Messages.StaticPrototype); - } - - if (!isStatic && this.isPropertyKey(key, 'constructor')) { - if (kind !== 'method' || !method || value && value.generator) { - this.throwUnexpectedToken(token, messages_1.Messages.ConstructorSpecialMethod); - } - - if (hasConstructor.value) { - this.throwUnexpectedToken(token, messages_1.Messages.DuplicateConstructor); - } else { - hasConstructor.value = true; - } - - kind = 'constructor'; - } - } - - return this.finalize(node, new Node.MethodDefinition(key, computed, value, kind, isStatic)); - }; - - Parser.prototype.parseClassElementList = function () { - var body = []; - var hasConstructor = { - value: false - }; - this.expect('{'); - - while (!this.match('}')) { - if (this.match(';')) { - this.nextToken(); - } else { - body.push(this.parseClassElement(hasConstructor)); - } - } - - this.expect('}'); - return body; - }; - - Parser.prototype.parseClassBody = function () { - var node = this.createNode(); - var elementList = this.parseClassElementList(); - return this.finalize(node, new Node.ClassBody(elementList)); - }; - - Parser.prototype.parseClassDeclaration = function (identifierIsOptional) { - var node = this.createNode(); - var previousStrict = this.context.strict; - this.context.strict = true; - this.expectKeyword('class'); - var id = identifierIsOptional && this.lookahead.type !== 3 - /* Identifier */ - ? null : this.parseVariableIdentifier(); - var superClass = null; - - if (this.matchKeyword('extends')) { - this.nextToken(); - superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall); - } - - var classBody = this.parseClassBody(); - this.context.strict = previousStrict; - return this.finalize(node, new Node.ClassDeclaration(id, superClass, classBody)); - }; - - Parser.prototype.parseClassExpression = function () { - var node = this.createNode(); - var previousStrict = this.context.strict; - this.context.strict = true; - this.expectKeyword('class'); - var id = this.lookahead.type === 3 - /* Identifier */ - ? this.parseVariableIdentifier() : null; - var superClass = null; - - if (this.matchKeyword('extends')) { - this.nextToken(); - superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall); - } - - var classBody = this.parseClassBody(); - this.context.strict = previousStrict; - return this.finalize(node, new Node.ClassExpression(id, superClass, classBody)); - }; // https://tc39.github.io/ecma262/#sec-scripts - // https://tc39.github.io/ecma262/#sec-modules - - - Parser.prototype.parseModule = function () { - this.context.strict = true; - this.context.isModule = true; - this.scanner.isModule = true; - var node = this.createNode(); - var body = this.parseDirectivePrologues(); - - while (this.lookahead.type !== 2 - /* EOF */ - ) { - body.push(this.parseStatementListItem()); - } - - return this.finalize(node, new Node.Module(body)); - }; - - Parser.prototype.parseScript = function () { - var node = this.createNode(); - var body = this.parseDirectivePrologues(); - - while (this.lookahead.type !== 2 - /* EOF */ - ) { - body.push(this.parseStatementListItem()); - } - - return this.finalize(node, new Node.Script(body)); - }; // https://tc39.github.io/ecma262/#sec-imports - - - Parser.prototype.parseModuleSpecifier = function () { - var node = this.createNode(); - - if (this.lookahead.type !== 8 - /* StringLiteral */ - ) { - this.throwError(messages_1.Messages.InvalidModuleSpecifier); - } - - var token = this.nextToken(); - var raw = this.getTokenRaw(token); - return this.finalize(node, new Node.Literal(token.value, raw)); - }; // import {} ...; - - - Parser.prototype.parseImportSpecifier = function () { - var node = this.createNode(); - var imported; - var local; - - if (this.lookahead.type === 3 - /* Identifier */ - ) { - imported = this.parseVariableIdentifier(); - local = imported; - - if (this.matchContextualKeyword('as')) { - this.nextToken(); - local = this.parseVariableIdentifier(); - } - } else { - imported = this.parseIdentifierName(); - local = imported; - - if (this.matchContextualKeyword('as')) { - this.nextToken(); - local = this.parseVariableIdentifier(); - } else { - this.throwUnexpectedToken(this.nextToken()); - } - } - - return this.finalize(node, new Node.ImportSpecifier(local, imported)); - }; // {foo, bar as bas} - - - Parser.prototype.parseNamedImports = function () { - this.expect('{'); - var specifiers = []; - - while (!this.match('}')) { - specifiers.push(this.parseImportSpecifier()); - - if (!this.match('}')) { - this.expect(','); - } - } - - this.expect('}'); - return specifiers; - }; // import ...; - - - Parser.prototype.parseImportDefaultSpecifier = function () { - var node = this.createNode(); - var local = this.parseIdentifierName(); - return this.finalize(node, new Node.ImportDefaultSpecifier(local)); - }; // import <* as foo> ...; - - - Parser.prototype.parseImportNamespaceSpecifier = function () { - var node = this.createNode(); - this.expect('*'); - - if (!this.matchContextualKeyword('as')) { - this.throwError(messages_1.Messages.NoAsAfterImportNamespace); - } - - this.nextToken(); - var local = this.parseIdentifierName(); - return this.finalize(node, new Node.ImportNamespaceSpecifier(local)); - }; - - Parser.prototype.parseImportDeclaration = function () { - if (this.context.inFunctionBody) { - this.throwError(messages_1.Messages.IllegalImportDeclaration); - } - - var node = this.createNode(); - this.expectKeyword('import'); - var src; - var specifiers = []; - - if (this.lookahead.type === 8 - /* StringLiteral */ - ) { - // import 'foo'; - src = this.parseModuleSpecifier(); - } else { - if (this.match('{')) { - // import {bar} - specifiers = specifiers.concat(this.parseNamedImports()); - } else if (this.match('*')) { - // import * as foo - specifiers.push(this.parseImportNamespaceSpecifier()); - } else if (this.isIdentifierName(this.lookahead) && !this.matchKeyword('default')) { - // import foo - specifiers.push(this.parseImportDefaultSpecifier()); - - if (this.match(',')) { - this.nextToken(); - - if (this.match('*')) { - // import foo, * as foo - specifiers.push(this.parseImportNamespaceSpecifier()); - } else if (this.match('{')) { - // import foo, {bar} - specifiers = specifiers.concat(this.parseNamedImports()); - } else { - this.throwUnexpectedToken(this.lookahead); - } - } - } else { - this.throwUnexpectedToken(this.nextToken()); - } - - if (!this.matchContextualKeyword('from')) { - var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause; - this.throwError(message, this.lookahead.value); - } - - this.nextToken(); - src = this.parseModuleSpecifier(); - } - - this.consumeSemicolon(); - return this.finalize(node, new Node.ImportDeclaration(specifiers, src)); - }; // https://tc39.github.io/ecma262/#sec-exports - - - Parser.prototype.parseExportSpecifier = function () { - var node = this.createNode(); - var local = this.parseIdentifierName(); - var exported = local; - - if (this.matchContextualKeyword('as')) { - this.nextToken(); - exported = this.parseIdentifierName(); - } - - return this.finalize(node, new Node.ExportSpecifier(local, exported)); - }; - - Parser.prototype.parseExportDeclaration = function () { - if (this.context.inFunctionBody) { - this.throwError(messages_1.Messages.IllegalExportDeclaration); - } - - var node = this.createNode(); - this.expectKeyword('export'); - var exportDeclaration; - - if (this.matchKeyword('default')) { - // export default ... - this.nextToken(); - - if (this.matchKeyword('function')) { - // export default function foo () {} - // export default function () {} - var declaration = this.parseFunctionDeclaration(true); - exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); - } else if (this.matchKeyword('class')) { - // export default class foo {} - var declaration = this.parseClassDeclaration(true); - exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); - } else if (this.matchContextualKeyword('async')) { - // export default async function f () {} - // export default async function () {} - // export default async x => x - var declaration = this.matchAsyncFunction() ? this.parseFunctionDeclaration(true) : this.parseAssignmentExpression(); - exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); - } else { - if (this.matchContextualKeyword('from')) { - this.throwError(messages_1.Messages.UnexpectedToken, this.lookahead.value); - } // export default {}; - // export default []; - // export default (1 + 2); - - - var declaration = this.match('{') ? this.parseObjectInitializer() : this.match('[') ? this.parseArrayInitializer() : this.parseAssignmentExpression(); - this.consumeSemicolon(); - exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration)); - } - } else if (this.match('*')) { - // export * from 'foo'; - this.nextToken(); - - if (!this.matchContextualKeyword('from')) { - var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause; - this.throwError(message, this.lookahead.value); - } - - this.nextToken(); - var src = this.parseModuleSpecifier(); - this.consumeSemicolon(); - exportDeclaration = this.finalize(node, new Node.ExportAllDeclaration(src)); - } else if (this.lookahead.type === 4 - /* Keyword */ - ) { - // export var f = 1; - var declaration = void 0; - - switch (this.lookahead.value) { - case 'let': - case 'const': - declaration = this.parseLexicalDeclaration({ - inFor: false - }); - break; - - case 'var': - case 'class': - case 'function': - declaration = this.parseStatementListItem(); - break; - - default: - this.throwUnexpectedToken(this.lookahead); - } - - exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null)); - } else if (this.matchAsyncFunction()) { - var declaration = this.parseFunctionDeclaration(); - exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null)); - } else { - var specifiers = []; - var source = null; - var isExportFromIdentifier = false; - this.expect('{'); - - while (!this.match('}')) { - isExportFromIdentifier = isExportFromIdentifier || this.matchKeyword('default'); - specifiers.push(this.parseExportSpecifier()); - - if (!this.match('}')) { - this.expect(','); - } - } - - this.expect('}'); - - if (this.matchContextualKeyword('from')) { - // export {default} from 'foo'; - // export {foo} from 'foo'; - this.nextToken(); - source = this.parseModuleSpecifier(); - this.consumeSemicolon(); - } else if (isExportFromIdentifier) { - // export {default}; // missing fromClause - var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause; - this.throwError(message, this.lookahead.value); - } else { - // export {foo}; - this.consumeSemicolon(); - } - - exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(null, specifiers, source)); - } - - return exportDeclaration; - }; - - return Parser; - }(); - - exports.Parser = Parser; - /***/ - }, - /* 9 */ - - /***/ - function (module, exports) { - "use strict"; // Ensure the condition is true, otherwise throw an error. - // This is only to have a better contract semantic, i.e. another safety net - // to catch a logic error. The condition shall be fulfilled in normal case. - // Do NOT use this to enforce a certain condition on any user input. - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - function assert(condition, message) { - /* istanbul ignore if */ - if (!condition) { - throw new Error('ASSERT: ' + message); - } - } - - exports.assert = assert; - /***/ - }, - /* 10 */ - - /***/ - function (module, exports) { - "use strict"; - /* tslint:disable:max-classes-per-file */ - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var ErrorHandler = function () { - function ErrorHandler() { - this.errors = []; - this.tolerant = false; - } - - ErrorHandler.prototype.recordError = function (error) { - this.errors.push(error); - }; - - ErrorHandler.prototype.tolerate = function (error) { - if (this.tolerant) { - this.recordError(error); - } else { - throw error; - } - }; - - ErrorHandler.prototype.constructError = function (msg, column) { - var error = new Error(msg); - - try { - throw error; - } catch (base) { - /* istanbul ignore else */ - if (Object.create && Object.defineProperty) { - error = Object.create(base); - Object.defineProperty(error, 'column', { - value: column - }); - } - } - /* istanbul ignore next */ - - - return error; - }; - - ErrorHandler.prototype.createError = function (index, line, col, description) { - var msg = 'Line ' + line + ': ' + description; - var error = this.constructError(msg, col); - error.index = index; - error.lineNumber = line; - error.description = description; - return error; - }; - - ErrorHandler.prototype.throwError = function (index, line, col, description) { - throw this.createError(index, line, col, description); - }; - - ErrorHandler.prototype.tolerateError = function (index, line, col, description) { - var error = this.createError(index, line, col, description); - - if (this.tolerant) { - this.recordError(error); - } else { - throw error; - } - }; - - return ErrorHandler; - }(); - - exports.ErrorHandler = ErrorHandler; - /***/ - }, - /* 11 */ - - /***/ - function (module, exports) { - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); // Error messages should be identical to V8. - - exports.Messages = { - BadGetterArity: 'Getter must not have any formal parameters', - BadSetterArity: 'Setter must have exactly one formal parameter', - BadSetterRestParameter: 'Setter function argument must not be a rest parameter', - ConstructorIsAsync: 'Class constructor may not be an async method', - ConstructorSpecialMethod: 'Class constructor may not be an accessor', - DeclarationMissingInitializer: 'Missing initializer in %0 declaration', - DefaultRestParameter: 'Unexpected token =', - DuplicateBinding: 'Duplicate binding %0', - DuplicateConstructor: 'A class may only have one constructor', - DuplicateProtoProperty: 'Duplicate __proto__ fields are not allowed in object literals', - ForInOfLoopInitializer: '%0 loop variable declaration may not have an initializer', - GeneratorInLegacyContext: 'Generator declarations are not allowed in legacy contexts', - IllegalBreak: 'Illegal break statement', - IllegalContinue: 'Illegal continue statement', - IllegalExportDeclaration: 'Unexpected token', - IllegalImportDeclaration: 'Unexpected token', - IllegalLanguageModeDirective: 'Illegal \'use strict\' directive in function with non-simple parameter list', - IllegalReturn: 'Illegal return statement', - InvalidEscapedReservedWord: 'Keyword must not contain escaped characters', - InvalidHexEscapeSequence: 'Invalid hexadecimal escape sequence', - InvalidLHSInAssignment: 'Invalid left-hand side in assignment', - InvalidLHSInForIn: 'Invalid left-hand side in for-in', - InvalidLHSInForLoop: 'Invalid left-hand side in for-loop', - InvalidModuleSpecifier: 'Unexpected token', - InvalidRegExp: 'Invalid regular expression', - LetInLexicalBinding: 'let is disallowed as a lexically bound name', - MissingFromClause: 'Unexpected token', - MultipleDefaultsInSwitch: 'More than one default clause in switch statement', - NewlineAfterThrow: 'Illegal newline after throw', - NoAsAfterImportNamespace: 'Unexpected token', - NoCatchOrFinally: 'Missing catch or finally after try', - ParameterAfterRestParameter: 'Rest parameter must be last formal parameter', - Redeclaration: '%0 \'%1\' has already been declared', - StaticPrototype: 'Classes may not have static property named prototype', - StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode', - StrictDelete: 'Delete of an unqualified identifier in strict mode.', - StrictFunction: 'In strict mode code, functions can only be declared at top level or inside a block', - StrictFunctionName: 'Function name may not be eval or arguments in strict mode', - StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode', - StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode', - StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode', - StrictModeWith: 'Strict mode code may not include a with statement', - StrictOctalLiteral: 'Octal literals are not allowed in strict mode.', - StrictParamDupe: 'Strict mode function may not have duplicate parameter names', - StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode', - StrictReservedWord: 'Use of future reserved word in strict mode', - StrictVarName: 'Variable name may not be eval or arguments in strict mode', - TemplateOctalLiteral: 'Octal literals are not allowed in template strings.', - UnexpectedEOS: 'Unexpected end of input', - UnexpectedIdentifier: 'Unexpected identifier', - UnexpectedNumber: 'Unexpected number', - UnexpectedReserved: 'Unexpected reserved word', - UnexpectedString: 'Unexpected string', - UnexpectedTemplate: 'Unexpected quasi %0', - UnexpectedToken: 'Unexpected token %0', - UnexpectedTokenIllegal: 'Unexpected token ILLEGAL', - UnknownLabel: 'Undefined label \'%0\'', - UnterminatedRegExp: 'Invalid regular expression: missing /' - }; - /***/ - }, - /* 12 */ - - /***/ - function (module, exports, __nested_webpack_require_228401__) { - "use strict"; - - Object.defineProperty(exports, "__esModule", { - value: true - }); - - var assert_1 = __nested_webpack_require_228401__(9); - - var character_1 = __nested_webpack_require_228401__(4); - - var messages_1 = __nested_webpack_require_228401__(11); - - function hexValue(ch) { - return '0123456789abcdef'.indexOf(ch.toLowerCase()); - } - - function octalValue(ch) { - return '01234567'.indexOf(ch); - } - - var Scanner = function () { - function Scanner(code, handler) { - this.source = code; - this.errorHandler = handler; - this.trackComment = false; - this.isModule = false; - this.length = code.length; - this.index = 0; - this.lineNumber = code.length > 0 ? 1 : 0; - this.lineStart = 0; - this.curlyStack = []; - } - - Scanner.prototype.saveState = function () { - return { - index: this.index, - lineNumber: this.lineNumber, - lineStart: this.lineStart - }; - }; - - Scanner.prototype.restoreState = function (state) { - this.index = state.index; - this.lineNumber = state.lineNumber; - this.lineStart = state.lineStart; - }; - - Scanner.prototype.eof = function () { - return this.index >= this.length; - }; - - Scanner.prototype.throwUnexpectedToken = function (message) { - if (message === void 0) { - message = messages_1.Messages.UnexpectedTokenIllegal; - } - - return this.errorHandler.throwError(this.index, this.lineNumber, this.index - this.lineStart + 1, message); - }; - - Scanner.prototype.tolerateUnexpectedToken = function (message) { - if (message === void 0) { - message = messages_1.Messages.UnexpectedTokenIllegal; - } - - this.errorHandler.tolerateError(this.index, this.lineNumber, this.index - this.lineStart + 1, message); - }; // https://tc39.github.io/ecma262/#sec-comments - - - Scanner.prototype.skipSingleLineComment = function (offset) { - var comments = []; - var start, loc; - - if (this.trackComment) { - comments = []; - start = this.index - offset; - loc = { - start: { - line: this.lineNumber, - column: this.index - this.lineStart - offset - }, - end: {} - }; - } - - while (!this.eof()) { - var ch = this.source.charCodeAt(this.index); - ++this.index; - - if (character_1.Character.isLineTerminator(ch)) { - if (this.trackComment) { - loc.end = { - line: this.lineNumber, - column: this.index - this.lineStart - 1 - }; - var entry = { - multiLine: false, - slice: [start + offset, this.index - 1], - range: [start, this.index - 1], - loc: loc - }; - comments.push(entry); - } - - if (ch === 13 && this.source.charCodeAt(this.index) === 10) { - ++this.index; - } - - ++this.lineNumber; - this.lineStart = this.index; - return comments; - } - } - - if (this.trackComment) { - loc.end = { - line: this.lineNumber, - column: this.index - this.lineStart - }; - var entry = { - multiLine: false, - slice: [start + offset, this.index], - range: [start, this.index], - loc: loc - }; - comments.push(entry); - } - - return comments; - }; - - Scanner.prototype.skipMultiLineComment = function () { - var comments = []; - var start, loc; - - if (this.trackComment) { - comments = []; - start = this.index - 2; - loc = { - start: { - line: this.lineNumber, - column: this.index - this.lineStart - 2 - }, - end: {} - }; - } - - while (!this.eof()) { - var ch = this.source.charCodeAt(this.index); - - if (character_1.Character.isLineTerminator(ch)) { - if (ch === 0x0D && this.source.charCodeAt(this.index + 1) === 0x0A) { - ++this.index; - } - - ++this.lineNumber; - ++this.index; - this.lineStart = this.index; - } else if (ch === 0x2A) { - // Block comment ends with '*/'. - if (this.source.charCodeAt(this.index + 1) === 0x2F) { - this.index += 2; - - if (this.trackComment) { - loc.end = { - line: this.lineNumber, - column: this.index - this.lineStart - }; - var entry = { - multiLine: true, - slice: [start + 2, this.index - 2], - range: [start, this.index], - loc: loc - }; - comments.push(entry); - } - - return comments; - } - - ++this.index; - } else { - ++this.index; - } - } // Ran off the end of the file - the whole thing is a comment - - - if (this.trackComment) { - loc.end = { - line: this.lineNumber, - column: this.index - this.lineStart - }; - var entry = { - multiLine: true, - slice: [start + 2, this.index], - range: [start, this.index], - loc: loc - }; - comments.push(entry); - } - - this.tolerateUnexpectedToken(); - return comments; - }; - - Scanner.prototype.scanComments = function () { - var comments; - - if (this.trackComment) { - comments = []; - } - - var start = this.index === 0; - - while (!this.eof()) { - var ch = this.source.charCodeAt(this.index); - - if (character_1.Character.isWhiteSpace(ch)) { - ++this.index; - } else if (character_1.Character.isLineTerminator(ch)) { - ++this.index; - - if (ch === 0x0D && this.source.charCodeAt(this.index) === 0x0A) { - ++this.index; - } - - ++this.lineNumber; - this.lineStart = this.index; - start = true; - } else if (ch === 0x2F) { - ch = this.source.charCodeAt(this.index + 1); - - if (ch === 0x2F) { - this.index += 2; - var comment = this.skipSingleLineComment(2); - - if (this.trackComment) { - comments = comments.concat(comment); - } - - start = true; - } else if (ch === 0x2A) { - this.index += 2; - var comment = this.skipMultiLineComment(); - - if (this.trackComment) { - comments = comments.concat(comment); - } - } else { - break; - } - } else if (start && ch === 0x2D) { - // U+003E is '>' - if (this.source.charCodeAt(this.index + 1) === 0x2D && this.source.charCodeAt(this.index + 2) === 0x3E) { - // '-->' is a single-line comment - this.index += 3; - var comment = this.skipSingleLineComment(3); - - if (this.trackComment) { - comments = comments.concat(comment); - } - } else { - break; - } - } else if (ch === 0x3C && !this.isModule) { - if (this.source.slice(this.index + 1, this.index + 4) === '!--') { - this.index += 4; // `