eslint-plugin-stylistic-compat
Version:
Compatibility version of @stylistic/eslint-plugin for Node.js >= 12 and ESLint v8
30,075 lines • 1.12 MB
JavaScript
'use strict';
var _Object$assign = require('@babel/runtime-corejs3/core-js/object/assign');
var _Object$create = require('@babel/runtime-corejs3/core-js/object/create');
var _Object$freeze = require('@babel/runtime-corejs3/core-js/object/freeze');
var _Array$isArray = require('@babel/runtime-corejs3/core-js/array/is-array');
var _lastIndexOfInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/last-index-of');
var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/slice');
var _flagsInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/flags');
var _Object$defineProperties = require('@babel/runtime-corejs3/core-js/object/define-properties');
var _Object$keys = require('@babel/runtime-corejs3/core-js/object/keys');
var _indexOfInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/index-of');
var _atInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/at');
var _Symbol = require('@babel/runtime-corejs3/core-js/symbol');
var _Symbol$iterator = require('@babel/runtime-corejs3/core-js/symbol/iterator');
var _parseInt = require('@babel/runtime-corejs3/core-js/parse-int');
var _parseFloat = require('@babel/runtime-corejs3/core-js/parse-float');
var _WeakMap = require('@babel/runtime-corejs3/core-js/weak-map');
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js/object/define-property');
var _globalThis = require('@babel/runtime-corejs3/core-js/global-this');
var _forEachInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/for-each');
var _includesInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/includes');
var _Set = require('@babel/runtime-corejs3/core-js/set');
var _filterInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/filter');
require('@babel/runtime-corejs3/core-js/array/from');
var require$$0 = require('eslint/use-at-your-own-risk');
var require$$0$1 = require('eslint');
var _Object$getOwnPropertyDescriptor = require('@babel/runtime-corejs3/core-js/object/get-own-property-descriptor');
var _Object$fromEntries = require('@babel/runtime-corejs3/core-js/object/from-entries');
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/map');
var _Object$entries = require('@babel/runtime-corejs3/core-js/object/entries');
var _Map = require('@babel/runtime-corejs3/core-js/map');
var _someInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/some');
var _findInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/find');
var _everyInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/every');
var _sortInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/sort');
var _Array$of = require('@babel/runtime-corejs3/core-js/array/of');
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/concat');
var _entriesInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/entries');
var _findIndexInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/find-index');
var _flatInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/flat');
var _keysInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/keys');
var _valuesInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/values');
var _Object$getOwnPropertyNames = require('@babel/runtime-corejs3/core-js/object/get-own-property-names');
var _Number$isFinite = require('@babel/runtime-corejs3/core-js/number/is-finite');
var _Number$isNaN = require('@babel/runtime-corejs3/core-js/number/is-nan');
var _Number$parseFloat = require('@babel/runtime-corejs3/core-js/number/parse-float');
var _Number$parseInt = require('@babel/runtime-corejs3/core-js/number/parse-int');
var _Object$is = require('@babel/runtime-corejs3/core-js/object/is');
var _Object$isExtensible = require('@babel/runtime-corejs3/core-js/object/is-extensible');
var _Object$isFrozen = require('@babel/runtime-corejs3/core-js/object/is-frozen');
var _Object$isSealed = require('@babel/runtime-corejs3/core-js/object/is-sealed');
var _Object$values = require('@babel/runtime-corejs3/core-js/object/values');
var _String$fromCodePoint = require('@babel/runtime-corejs3/core-js/string/from-code-point');
var _String$raw = require('@babel/runtime-corejs3/core-js/string/raw');
var _codePointAtInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/code-point-at');
var _endsWithInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/ends-with');
var _padEndInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/pad-end');
var _padStartInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/pad-start');
var _startsWithInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/starts-with');
var _trimInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/trim');
var _trimEndInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/trim-end');
var _trimLeftInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/trim-left');
var _trimRightInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/trim-right');
var _trimStartInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/trim-start');
var _Symbol$for = require('@babel/runtime-corejs3/core-js/symbol/for');
var _Symbol$keyFor = require('@babel/runtime-corejs3/core-js/symbol/key-for');
var _Object$preventExtensions = require('@babel/runtime-corejs3/core-js/object/prevent-extensions');
var _Object$seal = require('@babel/runtime-corejs3/core-js/object/seal');
var _Object$getPrototypeOf = require('@babel/runtime-corejs3/core-js/object/get-prototype-of');
var _Symbol$replace = require('@babel/runtime-corejs3/core-js/symbol/replace');
var _bindInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/bind');
var _spliceInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/splice');
var _repeatInstanceProperty = require('@babel/runtime-corejs3/core-js/instance/repeat');
/* eslint-disable jsdoc/valid-types -- doesn't allow `readonly`.
TODO: remove eslint-disable when https://github.com/jsdoc-type-pratt-parser/jsdoc-type-pratt-parser/issues/164 is fixed
*/
/**
* @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys
*/
/* eslint-enable jsdoc/valid-types -- doesn't allow `readonly string[]`. TODO: check why */
/**
* @type {VisitorKeys}
*/
const KEYS = {
ArrayExpression: ["elements"],
ArrayPattern: ["elements"],
ArrowFunctionExpression: ["params", "body"],
AssignmentExpression: ["left", "right"],
AssignmentPattern: ["left", "right"],
AwaitExpression: ["argument"],
BinaryExpression: ["left", "right"],
BlockStatement: ["body"],
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: [],
ExperimentalRestProperty: ["argument"],
ExperimentalSpreadProperty: ["argument"],
ExportAllDeclaration: ["exported", "source", "attributes"],
ExportDefaultDeclaration: ["declaration"],
ExportNamedDeclaration: ["declaration", "specifiers", "source", "attributes"],
ExportSpecifier: ["exported", "local"],
ExpressionStatement: ["expression"],
ForInStatement: ["left", "right", "body"],
ForOfStatement: ["left", "right", "body"],
ForStatement: ["init", "test", "update", "body"],
FunctionDeclaration: ["id", "params", "body"],
FunctionExpression: ["id", "params", "body"],
Identifier: [],
IfStatement: ["test", "consequent", "alternate"],
ImportAttribute: ["key", "value"],
ImportDeclaration: ["specifiers", "source", "attributes"],
ImportDefaultSpecifier: ["local"],
ImportExpression: ["source", "options"],
ImportNamespaceSpecifier: ["local"],
ImportSpecifier: ["imported", "local"],
JSXAttribute: ["name", "value"],
JSXClosingElement: ["name"],
JSXClosingFragment: [],
JSXElement: ["openingElement", "children", "closingElement"],
JSXEmptyExpression: [],
JSXExpressionContainer: ["expression"],
JSXFragment: ["openingFragment", "children", "closingFragment"],
JSXIdentifier: [],
JSXMemberExpression: ["object", "property"],
JSXNamespacedName: ["namespace", "name"],
JSXOpeningElement: ["name", "attributes"],
JSXOpeningFragment: [],
JSXSpreadAttribute: ["argument"],
JSXSpreadChild: ["expression"],
JSXText: [],
LabeledStatement: ["label", "body"],
Literal: [],
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: [],
SwitchCase: ["test", "consequent"],
SwitchStatement: ["discriminant", "cases"],
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);
/**
* @typedef {import('./visitor-keys.js').VisitorKeys} VisitorKeys
*/
// List to ignore keys.
new _Set(["parent", "leadingComments", "trailingComments"]);
// This file was generated. Do not modify manually!
var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 80, 3, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 343, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 726, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
// This file was generated. Do not modify manually!
var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 2, 60, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 42, 9, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 496, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 4191];
// This file was generated. Do not modify manually!
var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65";
// This file was generated. Do not modify manually!
var nonASCIIidentifierStartChars = "\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\u0560-\u0588\u05d0-\u05ea\u05ef-\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\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\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\u09fc\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\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\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-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\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-\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-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7cd\ua7d0\ua7d1\ua7d3\ua7d5-\ua7dc\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\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-\uab69\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";
// These are a run-length and offset encoded representation of the
// >0xffff code points that are a valid part of identifiers. The
// offset starts at 0x10000, and each pair of numbers represents an
// offset to the next range, and then a size of the range.
// Reserved word lists for various dialects of the language
var reservedWords = {
3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",
5: "class enum extends super const export import",
6: "enum",
strict: "implements interface let package private protected public static yield",
strictBind: "eval arguments"
};
// 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$1 = {
5: ecma5AndLessKeywords,
"5module": ecma5AndLessKeywords + " export import",
6: ecma5AndLessKeywords + " const class extends export import super"
};
var keywordRelationalOperator = /^in(stanceof)?$/;
// ## Character categories
var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
// This has a complexity linear to the value of the code. The
// assumption is that looking up astral identifier characters is
// rare.
function isInAstralSet(code, set) {
var pos = 0x10000;
for (var i = 0; i < set.length; i += 2) {
pos += set[i];
if (pos > code) {
return false;
}
pos += set[i + 1];
if (pos >= code) {
return true;
}
}
return false;
}
// Test whether a given character code starts an identifier.
function isIdentifierStart(code, astral) {
if (code < 65) {
return code === 36;
}
if (code < 91) {
return true;
}
if (code < 97) {
return code === 95;
}
if (code < 123) {
return true;
}
if (code <= 0xffff) {
return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
}
if (astral === false) {
return false;
}
return isInAstralSet(code, astralIdentifierStartCodes);
}
// Test whether a given character is part of an identifier.
function isIdentifierChar(code, astral) {
if (code < 48) {
return code === 36;
}
if (code < 58) {
return true;
}
if (code < 65) {
return false;
}
if (code < 91) {
return true;
}
if (code < 97) {
return code === 95;
}
if (code < 123) {
return true;
}
if (code <= 0xffff) {
return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
}
if (astral === false) {
return false;
}
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
}
// ## Token types
// The assignment of fine-grained, information-carrying type objects
// allows the tokenizer to store the information it has about a
// token in a way that is very cheap for the parser to look up.
// All token type variables start with an underscore, to make them
// easy to recognize.
// The `beforeExpr` property is used to disambiguate between regular
// expressions and divisions. It is set on all token types that can
// be followed by an expression (thus, a slash after them would be a
// regular expression).
//
// The `startsExpr` property is used to check if the token ends a
// `yield` expression. It is set on all token types that either can
// directly start an expression (like a quotation mark) or can
// continue an expression (like the body of a string).
//
// `isLoop` marks a keyword as starting a loop, which is important
// to know when parsing a label, in order to allow or disallow
// continue jumps to that label.
var TokenType = function TokenType(label, conf) {
if (conf === undefined) conf = {};
this.label = label;
this.keyword = conf.keyword;
this.beforeExpr = !!conf.beforeExpr;
this.startsExpr = !!conf.startsExpr;
this.isLoop = !!conf.isLoop;
this.isAssign = !!conf.isAssign;
this.prefix = !!conf.prefix;
this.postfix = !!conf.postfix;
this.binop = conf.binop || null;
this.updateContext = null;
};
function binop(name, prec) {
return new TokenType(name, {
beforeExpr: true,
binop: prec
});
}
var beforeExpr = {
beforeExpr: true
},
startsExpr = {
startsExpr: true
};
// Map keyword names to token types.
var keywords = {};
// Succinct definitions of keyword token types
function kw(name, options) {
if (options === undefined) options = {};
options.keyword = name;
return keywords[name] = new TokenType(name, options);
}
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("[", {
beforeExpr: true,
startsExpr: true
}),
bracketR: new TokenType("]"),
braceL: new TokenType("{", {
beforeExpr: true,
startsExpr: true
}),
braceR: new TokenType("}"),
parenL: new TokenType("(", {
beforeExpr: true,
startsExpr: true
}),
parenR: new TokenType(")"),
comma: new TokenType(",", beforeExpr),
semi: new TokenType(";", beforeExpr),
colon: new TokenType(":", beforeExpr),
dot: new TokenType("."),
question: new TokenType("?", beforeExpr),
questionDot: new TokenType("?."),
arrow: new TokenType("=>", beforeExpr),
template: new TokenType("template"),
invalidTemplate: new TokenType("invalidTemplate"),
ellipsis: new TokenType("...", beforeExpr),
backQuote: new TokenType("`", startsExpr),
dollarBraceL: new TokenType("${", {
beforeExpr: true,
startsExpr: true
}),
// Operators. These carry several kinds of properties to help the
// parser use them properly (the presence of these properties is
// what categorizes them as operators).
//
// `binop`, when present, specifies that this operator is a binary
// operator, and will refer to its precedence.
//
// `prefix` and `postfix` mark the operator as a prefix or postfix
// unary operator.
//
// `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as
// binary operators with a very low precedence, that should result
// in AssignmentExpression nodes.
eq: new TokenType("=", {
beforeExpr: true,
isAssign: true
}),
assign: new TokenType("_=", {
beforeExpr: true,
isAssign: true
}),
incDec: new TokenType("++/--", {
prefix: true,
postfix: true,
startsExpr: true
}),
prefix: new TokenType("!/~", {
beforeExpr: true,
prefix: true,
startsExpr: true
}),
logicalOR: binop("||", 1),
logicalAND: binop("&&", 2),
bitwiseOR: binop("|", 3),
bitwiseXOR: binop("^", 4),
bitwiseAND: binop("&", 5),
equality: binop("==/!=/===/!==", 6),
relational: binop("</>/<=/>=", 7),
bitShift: binop("<</>>/>>>", 8),
plusMin: new TokenType("+/-", {
beforeExpr: true,
binop: 9,
prefix: true,
startsExpr: true
}),
modulo: binop("%", 10),
star: binop("*", 10),
slash: binop("/", 10),
starstar: new TokenType("**", {
beforeExpr: true
}),
coalesce: binop("??", 1),
// Keyword token types.
_break: kw("break"),
_case: kw("case", beforeExpr),
_catch: kw("catch"),
_continue: kw("continue"),
_debugger: kw("debugger"),
_default: kw("default", beforeExpr),
_do: kw("do", {
isLoop: true,
beforeExpr: true
}),
_else: kw("else", beforeExpr),
_finally: kw("finally"),
_for: kw("for", {
isLoop: true
}),
_function: kw("function", startsExpr),
_if: kw("if"),
_return: kw("return", beforeExpr),
_switch: kw("switch"),
_throw: kw("throw", beforeExpr),
_try: kw("try"),
_var: kw("var"),
_const: kw("const"),
_while: kw("while", {
isLoop: true
}),
_with: kw("with"),
_new: kw("new", {
beforeExpr: true,
startsExpr: true
}),
_this: kw("this", startsExpr),
_super: kw("super", startsExpr),
_class: kw("class", startsExpr),
_extends: kw("extends", beforeExpr),
_export: kw("export"),
_import: kw("import", startsExpr),
_null: kw("null", startsExpr),
_true: kw("true", startsExpr),
_false: kw("false", startsExpr),
_in: kw("in", {
beforeExpr: true,
binop: 7
}),
_instanceof: kw("instanceof", {
beforeExpr: true,
binop: 7
}),
_typeof: kw("typeof", {
beforeExpr: true,
prefix: true,
startsExpr: true
}),
_void: kw("void", {
beforeExpr: true,
prefix: true,
startsExpr: true
}),
_delete: kw("delete", {
beforeExpr: true,
prefix: true,
startsExpr: true
})
};
// Matches a whole line break (where CRLF is considered a single
// line break). Used to count lines.
var lineBreak = /\r\n?|\n|\u2028|\u2029/;
var lineBreakG = new RegExp(lineBreak.source, "g");
function isNewLine(code) {
return code === 10 || code === 13 || code === 0x2028 || code === 0x2029;
}
function nextLineBreak(code, from, end) {
if (end === undefined) end = code.length;
for (var i = from; i < end; i++) {
var next = code.charCodeAt(i);
if (isNewLine(next)) {
return i < end - 1 && next === 13 && code.charCodeAt(i + 1) === 10 ? i + 2 : i + 1;
}
}
return -1;
}
var nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
var ref = Object.prototype;
var hasOwnProperty = ref.hasOwnProperty;
var toString = ref.toString;
var hasOwn = Object.hasOwn || function (obj, propName) {
return hasOwnProperty.call(obj, propName);
};
var isArray$1 = _Array$isArray || function (obj) {
return toString.call(obj) === "[object Array]";
};
var regexpCache = _Object$create(null);
function wordsRegexp(words) {
return regexpCache[words] || (regexpCache[words] = new RegExp("^(?:" + words.replace(/ /g, "|") + ")$"));
}
function codePointToString(code) {
// UTF-16 Decoding
if (code <= 0xFFFF) {
return String.fromCharCode(code);
}
code -= 0x10000;
return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00);
}
var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/;
// These are used when `options.locations` is on, for the
// `startLoc` and `endLoc` properties.
var Position = function Position(line, col) {
this.line = line;
this.column = col;
};
Position.prototype.offset = function offset(n) {
return new Position(this.line, this.column + n);
};
var SourceLocation = function SourceLocation(p, start, end) {
this.start = start;
this.end = end;
if (p.sourceFile !== null) {
this.source = p.sourceFile;
}
};
// The `getLineInfo` function is mostly useful when the
// `locations` option is off (for performance reasons) and you
// want to find the line/column position for a given character
// offset. `input` should be the code string that the offset refers
// into.
function getLineInfo(input, offset) {
for (var line = 1, cur = 0;;) {
var nextBreak = nextLineBreak(input, cur, offset);
if (nextBreak < 0) {
return new Position(line, offset - cur);
}
++line;
cur = nextBreak;
}
}
// 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 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10
// (2019), 11 (2020), 12 (2021), 13 (2022), 14 (2023), 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.
sourceType: "script",
// `onInsertedSemicolon` can be a callback that will be called when
// a semicolon is automatically inserted. It will be passed the
// position of the inserted semicolon as an offset, and if
// `locations` is enabled, it is given the location as a `{line,
// column}` object as second argument.
onInsertedSemicolon: null,
// `onTrailingComma` is similar to `onInsertedSemicolon`, but for
// trailing commas.
onTrailingComma: null,
// By default, reserved words are only enforced if ecmaVersion >= 5.
// Set `allowReserved` to a boolean value to explicitly turn this on
// an off. When this option has the value "never", reserved words
// and keywords can also not be used as property names.
allowReserved: null,
// When enabled, a return at the top level is not considered an
// error.
allowReturnOutsideFunction: false,
// When enabled, import/export statements are not constrained to
// 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: 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. Enabled by default when
// `ecmaVersion` >= 2023.
allowHashBang: false,
// By default, the parser will verify that private properties are
// only used in places where they are valid and have been declared.
// Set this to false to turn such checks off.
checkPrivateFields: true,
// When `locations` is on, `loc` properties holding objects with
// `start` and `end` properties in `{line, column}` form (with
// line being 1-based and column 0-based) will be attached to the
// nodes.
locations: false,
// A function can be passed as `onToken` option, which will
// cause Acorn to call that function with object in the same
// format as tokens returned from `tokenizer().getToken()`. Note
// that you are not allowed to call the parser from the
// callback—that will corrupt its internal state.
onToken: null,
// A function can be passed as `onComment` option, which will
// cause Acorn to call that function with `(block, text, start,
// end)` parameters whenever a comment is skipped. `block` is a
// boolean indicating whether this is a block (`/* */`) comment,
// `text` is the content of the comment, and `start` and `end` are
// character offsets that denote the start and end of the comment.
// When the `locations` option is on, two more parameters are
// passed, the full `{line, column}` locations of the start and
// end of the comments. Note that you are not allowed to call the
// parser from the callback—that will corrupt its internal state.
// When this option has an array as value, objects representing the
// comments are pushed to it.
onComment: null,
// Nodes have their start and end characters offsets recorded in
// `start` and `end` properties (directly on the node, rather than
// the `loc` object, which holds line/column data. To also add a
// [semi-standardized][range] `range` property holding a `[start,
// end]` array with the same numbers, set the `ranges` option to
// `true`.
//
// [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678
ranges: false,
// It is possible to parse multiple files into a single AST by
// passing the tree produced by parsing the first file as
// `program` option in subsequent parses. This will add the
// toplevel forms of the parsed file to the `Program` (top) node
// of an existing parse tree.
program: null,
// When `locations` is on, you can pass this to record the source
// file in every node's `loc` object.
sourceFile: null,
// This value, if given, is stored in every node, whether
// `locations` is on or off.
directSourceFile: null,
// When enabled, parenthesized expressions are represented by
// (non-standard) ParenthesizedExpression nodes
preserveParens: false
};
// Interpret and default an options object
var warnedAboutEcmaVersion = false;
function getOptions(opts) {
var options = {};
for (var opt in defaultOptions) {
options[opt] = opts && hasOwn(opts, opt) ? opts[opt] : defaultOptions[opt];
}
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;
}
if (options.allowReserved == null) {
options.allowReserved = options.ecmaVersion < 5;
}
if (!opts || opts.allowHashBang == null) {
options.allowHashBang = options.ecmaVersion >= 14;
}
if (isArray$1(options.onToken)) {
var tokens = options.onToken;
options.onToken = function (token) {
return tokens.push(token);
};
}
if (isArray$1(options.onComment)) {
options.onComment = pushComment(options, options.onComment);
}
return options;
}
function pushComment(options, array) {
return function (block, text, start, end, startLoc, endLoc) {
var comment = {
type: block ? "Block" : "Line",
value: text,
start: start,
end: end
};
if (options.locations) {
comment.loc = new SourceLocation(this, startLoc, endLoc);
}
if (options.ranges) {
comment.range = [start, end];
}
array.push(comment);
};
}
// Each scope gets a bitset that may contain these flags
var SCOPE_TOP = 1,
SCOPE_FUNCTION = 2,
SCOPE_ASYNC = 4,
SCOPE_GENERATOR = 8,
SCOPE_ARROW = 16,
SCOPE_SIMPLE_CATCH = 32,
SCOPE_SUPER = 64,
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
var BIND_NONE = 0,
// Not a binding
BIND_VAR = 1,
// Var-style binding
BIND_LEXICAL = 2,
// Let- or const-style binding
BIND_FUNCTION = 3,
// Function declaration
BIND_SIMPLE_CATCH = 4,
// Simple (identifier pattern) catch binding
BIND_OUTSIDE = 5; // Special case for function names as bound inside the function
var Parser$1 = function Parser(options, input, startPos) {
var _context3;
this.options = options = getOptions(options);
this.sourceFile = options.sourceFile;
this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
var reserved = "";
if (options.allowReserved !== true) {
reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
if (options.sourceType === "module") {
reserved += " await";
}
}
this.reservedWords = wordsRegexp(reserved);
var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict;
this.reservedWordsStrict = wordsRegexp(reservedStrict);
this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind);
this.input = String(input);
// Used to signal to callers of `readWord1` whether the word
// contained any escape sequences. This is needed because words with
// escape sequences must not be interpreted as keywords.
this.containsEsc = false;
// Set up token state
// The current position of the tokenizer in the input.
if (startPos) {
var _context, _context2;
this.pos = startPos;
this.lineStart = _lastIndexOfInstanceProperty(_context = this.input).call(_context, "\n", startPos - 1) + 1;
this.curLine = _sliceInstanceProperty(_context2 = this.input).call(_context2, 0, this.lineStart).split(lineBreak).length;
} else {
this.pos = this.lineStart = 0;
this.curLine = 1;
}
// Properties of the current token:
// Its type
this.type = types$1.eof;
// For tokens that include more information than their type, the value
this.value = null;
// Its start and end offset
this.start = this.end = this.pos;
// And, if locations are used, the {line, column} object
// corresponding to those offsets
this.startLoc = this.endLoc = this.curPosition();
// Position information for the previous token
this.lastTokEndLoc = this.lastTokStartLoc = null;
this.lastTokStart = this.lastTokEnd = this.pos;
// The context stack is used to superficially track syntactic
// context to predict whether a regular expression is allowed in a
// given position.
this.context = this.initialContext();
this.exprAllowed = true;
// Figure out if it's a module code.
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;
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 = _Object$create(null);
// If enabled, skip leading hashbang line.
if (this.pos === 0 && options.allowHashBang && _sliceInstanceProperty(_context3 = this.input).call(_context3, 0, 2) === "#!") {
this.skipLineComment(2);
}
// Scope tracking for duplicate variable names (see scope.js)
this.scopeStack = [];
this.enterScope(SCOPE_TOP);
// For RegExp validation
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 = {
inFunction: {
configurable: true
},
inGenerator: {
configurable: true
},
inAsync: {
configurable: true
},
canAwait: {
configurable: true
},
allowSuper: {
configurable: true
},
allowDirectSuper: {
configurable: true
},
treatFunctionsAsVar: {
configurable: true
},
allowNewDotTarget: {
configurable: true
},
inClassStaticBlock: {
configurable: true
}
};
Parser$1.prototype.parse = function parse() {
var node = this.options.program || this.startNode();
this.nextToken();
return this.parseTopLevel(node);
};
prototypeAccessors.inFunction.get = function () {
return (_flagsInstanceProperty(this.currentVarScope()) & SCOPE_FUNCTION) > 0;
};
prototypeAccessors.inGenerator.get = function () {
return (_flagsInstanceProperty(this.currentVarScope()) & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit;
};
prototypeAccessors.inAsync.get = function () {
return (_flagsInstanceProperty(this.currentVarScope()) & 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 || _flagsInstanceProperty(scope) & SCOPE_CLASS_STATIC_BLOCK) {
return false;
}
if (_flagsInstanceProperty(scope) & SCOPE_FUNCTION) {
return (_flagsInstanceProperty(scope) & SCOPE_ASYNC) > 0;
}
}
return this.inModule && this.options.ecmaVersion >= 13 || this.options.allowAwaitOutsideFunction;
};
prototypeAccessors.allowSuper.get = function () {
var ref = this.currentThisScope();
var flags = _flagsInstanceProperty(ref);
var inClassFieldInit = ref.inClassFieldInit;
return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod;
};
prototypeAccessors.allowDirectSuper.get = function () {
return (_flagsInstanceProperty(this.currentThisScope()) & SCOPE_DIRECT_SUPER) > 0;
};
prototypeAccessors.treatFunctionsAsVar.get = function () {
return this.treatFunctionsAsVarInScope(this.currentScope());
};
prototypeAccessors.allowNewDotTarget.get = function () {
var ref = this.currentThisScope();
var flags = _flagsInstanceProperty(ref);
var inClassFieldInit = ref.inClassFieldInit;
return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit;
};
prototypeAccessors.inClassStaticBlock.get = function () {
return (_flagsInstanceProperty(this.currentVarScope()) & SCOPE_CLASS_STATIC_BLOCK) > 0;
};
Parser$1.extend = function extend() {
var plugins = [],
len = arguments.length;
while (len--) plugins[len] = arguments[len];
var cls = this;
for (var i = 0; i < plugins.length; i++) {
cls = plugins[i](cls);
}
return cls;
};
Parser$1.parse = function parse(input, options) {
return new this(options, input).parse();
};
Parser$1.parseExpressionAt = function parseExpressionAt(input, pos, options) {
var parser = new this(options, input, pos);
parser.nextToken();
return parser.parseExpression();
};
Parser$1.tokenizer = function tokenizer(input, options) {
return new this(options, input);
};
_Object$defineProperties(Parser$1.prototype, prototypeAccessors);
var pp$9 = Parser$1.prototype;
// ## Parser utilities
var literal = /^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;
pp$9.strictDirective = function (start) {
if (this.options.ecmaVersion < 5) {
return false;
}
for (;;) {
var _context4;
// Try to find string literal.
skipWhiteSpace.lastIndex = start;
start += skipWhiteSpace.exec(this.input)[0].length;
var match = literal.exec(_sliceInstanceProperty(_context4 = this.input).call(_context4, start));
if (!match) {
return false;
}
if ((match[1] || match[2]) === "use strict") {
skipWhiteSpace.lastIndex = start + match[0].length;
var spaceAfter = skipWhiteSpace.exec(this.input),
end = spaceAfter.index + spaceAfter[0].length;
var next = this.input.charAt(end);
return next === ";" || next === "}" || lineBreak.test(spaceAfter[0]) && !(/[(`.[+\-/*%<>=,?^&]/.test(next) || next === "!" && this.input.charAt(end + 1) === "=");
}
start += match[0].length;
// Skip semicolon, if any.
skipWhiteSpace.lastIndex = start;
start += skipWhiteSpace.exec(this.input)[0].length;
if (this.input[start] === ";") {
start++;
}
}
};
// Predicate that tests whether the next token is of the given
// type, and if yes, consumes it as a side effect.
pp$9.eat = function (type) {
if (this.type === type) {
this.next();
return true;
} else {
return false;
}
};
// Tests whether parsed token is a contextual keyword.
pp$9.isContextual = function (name) {
return this.type === types$1.name && this.value === name && !this.containsEsc;
};
// Consumes contextual keyword if possible.
pp$9.eatContextual = function (name) {
if (!this.isContextual(name)) {
return false;
}
this.next();
return true;
};
// Asserts that following token is given contextual keyword.
pp$9.expectContextual = function (name) {
if (!this.eatContextual(name)) {
this.unexpected();
}
};
// Test whether a semicolon can be inserted at the current position.
pp$9.canInsertSemicolon = function () {
var _context5;
return this.type === types$1.eof || this.type === types$1.braceR || lineBreak.test(_sliceInstanceProperty(_context5 = this.input).call(_context5, this.lastTokEnd, this.start));
};
pp$9.insertSemicolon = function () {
if (this.canInsertSemicolon()) {
if (this.options.onInsertedSemicolon) {
this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc);
}
return true;
}
};
// Consume a semicolon, or, failing that, see if we are allowed to
// pretend that there is a semicolon at this position.
pp$9.semicolon = function () {
if (!this.eat(types$1.semi) && !this.insertSemicolon()) {
this.unexpected();
}
};
pp$9.afterTrailingComma = function (tokType, notNext) {
if (this.type === tokType) {
if (this.options.onTrailingComma) {
this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc);
}
if (!notNext) {
this.next();
}
return true;
}
};
// Expect a token of a given type. If found, consume it, otherwise,
// raise an unexpected token error.
pp$9.expect = function (type) {
this.eat(type) || this.unexpected();
};
// Raise an unexpected token error.
pp$9.unexpected = function (pos) {
this.raise(pos != null ? pos : this.start, "Unexpected token");
};
var DestructuringErrors = function DestructuringErrors() {
this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = this.doubleProto = -1;
};
pp$9.checkPatternErrors = function (refDestructuringErrors, isAssign) {
if (!refDestructuringErrors) {
return;
}
if (refDestructuringErrors.trailingComma > -1) {
this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element");
}
var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind;
if (parens > -1) {
this.raiseRecoverable(parens, isAssign ? "Assigning to rvalue" : "Parenthesized pattern");
}
};
pp$9.checkExpressionErrors = function (refDestructuringErrors, andThrow) {
if (!refDestructuringErrors) {
return false;
}
var shorthandAssign = refDestructuringErrors.shorthandAssign;
var doubleProto = refDestructuringErrors.doubleProto;
if (!andThrow) {
return shorthandAssign >= 0 || doubleProto >= 0;
}
if (shorthandAssign >= 0) {
this.raise(shorthandAssign, "Shorthand property assignments are valid only in destructuring patterns");
}
if (doubleProto >= 0) {
this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property");
}
};
pp$9.checkYieldAwaitInDefaultParams = function () {
if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos)) {
this.raise(this.yieldPos, "Yield expression cannot be a default value");
}
if (this.awaitPos) {
this.raise(this.awaitPos, "Await expression cannot be a default value");
}
};
pp$9.isSimpleAssignTarget = function (expr) {
if (expr.type === "ParenthesizedExpression") {
return this.isSimpleAssignTarget(expr.expression);
}
return expr.type === "Identifier" || expr.type === "MemberExpression";
};
var pp$8 = Parser$1.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$8.parseTopLevel = function (node) {
var exports = _Object$create(null);
if (!node.body) {
node.body = [];
}
while (this.type !== types$1.eof) {
var stmt = this.parseStatement(null, true, exports);
node.body.push(stmt);
}
if (this.inModule) {
for (var i = 0, list = _Object$keys(this.undefinedExports); i < list.length; i += 1) {
var name = list[i];
this.raiseRecoverable(this.undefinedExports[name].start, "Export '" + name + "' is not defined");
}
}
this.adaptDirectivePrologue(node.body);
this.next();
node.sourceType = this.options.sourceType;
return this.finishNode(node, "Program");
};
var loopLabel = {
kind: "loop"
},
switchLabel = {
kind: "switch"
};
pp$8.isLet = function (context) {
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) {
return false;
}
skipWhiteSpace.lastIndex = this.pos;
var skip = skipWhiteSpace.exec(this.input);
var next = this.pos + skip[0].length,
nextCh = this.input.charCodeAt(next);
// For ambiguous cases, determine if a LexicalDeclaration (or only a
// Statement) is allowed here. If context is not empty then only a Statement
// is allowed. However, `let [` is an explicit negative lookahead for
// ExpressionStatement, so special-case it first.
if (nextCh === 91 || nextCh === 92) {
return true;
} // '[', '\'
if (context) {
return false;
}
if (nextCh === 123 || nextCh > 0xd7ff && nextCh < 0xdc00) {
return true;
} // '{', astral
if (isIdentifierStart(nextCh, true)) {
var _context6;
var pos = next + 1;
while (isIdentifierChar(nextCh = this.input.charCodeAt(pos), true)) {
++pos;
}
if (nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) {
return true;
}
var ident = _sliceInstanceProperty(_context6 = this.input).call(_context6, next, pos);
if (!keywordRelationalOperator.test(ident)) {
return true;
}
}
return false;
};
// check 'async [no LineTerminator here] function'
// - 'async /*foo*/ function' is OK.
// - 'async /*\n*/ function' is invalid.
pp$8.isAsyncFunction = function () {
var _context7, _context8;
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,
after;
return !lineBreak.test(_sliceInstanceProperty(_context7 = this.input).call(_context7, this.pos, next)) && _sliceInstanceProperty(_context8 = this.input).call(_context8, 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
// regular expression literal. This is to handle cases like
// `if (foo) /blah/.exec(foo)`, where looking at the previous token
// does not help.
pp$8.parseStatement = function (context, topLevel, exports) {
var starttype = this.type,
node = this.startNode(),
kind;
if (this.isLet(context)) {
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
// complexity.
switch (starttype) {
case types$1._break:
case types$1._continue:
return this.parseBreakContinueStatement(node, starttype.keyword);
case types$1._debugger:
return this.parseDebuggerStatement(node);
case types$1._do:
return this.parseDoStatement(node);
case types$1._for:
return this.parseForStatement(node);
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.
if (context && (this.strict || context !== "if" && context !== "label") && this.options.ecmaVersion >= 6) {
this.unexpected();
}
return this.parseFunctionStatement(node, false, !context);
case types$1._class:
if (context) {
this.unexpected();
}
return this.parseClass(node, true);
case types$1._if:
return this.parseIfStatement(node);
case types$1._return:
return this.parseReturnStatement(node);
case types$1._switch:
return this.parseSwitchStatement(node);
case types$1._throw:
return this.parseThrowStatement(node);
case types$1._try:
return this.parseTryStatement(node);
case types$1._const:
case types$1._var:
kind = kind || this.value;
if (context && kind !== "var") {
this.unexpected();
}
return this.parseVarStatement(node, kind);
case types$1._while:
return this.parseWhileStatement(node);
case types$1._with:
return this.parseWithStatement(node);
case types$1.braceL:
return this.parseBlock(true, node);
case types$1.semi:
return this.parseEmptyStatement(node);
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,
nextCh = this.input.charCodeAt(next);
if (nextCh === 40 || nextCh === 46)
// '(' or '.'
{
return this.parseExpressionStatement(node, this.parseExpression());
}
}
if (!this.options.allowImportExportEverywhere) {
if (!topLevel) {
this.raise(this.start, "'import' and 'export' may only appear at the top level");
}
if (!this.inModule) {
this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'");
}
}
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
// next token is a colon and the expression was a simple
// Identifier node, we switch to interpreting it as a label.
default:
if (this.isAsyncFunction()) {
if (context) {
this.unexpected();
}
this.next();
return this.parseFunctionStatement(node, true, !context);
}
var maybeName = this.value,
expr = this.parseExpression();
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);
}
}
};
pp$8.parseBreakContinueStatement = function (node, keyword) {
var isBreak = keyword === "break";
this.next();
if (this.eat(types$1.semi) || this.insertSemicolon()) {
node.label = null;
} else if (this.type !== types$1.name) {
this.unexpected();
} else {
node.label = this.parseIdent();
this.semicolon();
}
// Verify that there is an actual destination to break or
// continue to.
var i = 0;
for (; i < this.labels.length; ++i) {
var lab = this.labels[i];
if (node.label == null || lab.name === node.label.name) {
if (lab.kind != null && (isBreak || lab.kind === "loop")) {
break;
}
if (node.label && isBreak) {
break;
}
}
}
if (i === this.labels.length) {
this.raise(node.start, "Unsyntactic " + keyword);
}
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
};
pp$8.parseDebuggerStatement = function (node) {
this.next();
this.semicolon();
return this.finishNode(node, "DebuggerStatement");
};
pp$8.parseDoStatement = function (node) {
this.next();
this.labels.push(loopLabel);
node.body = this.parseStatement("do");
this.labels.pop();
this.expect(types$1._while);
node.test = this.parseParenExpression();
if (this.options.ecmaVersion >= 6) {
this.eat(types$1.semi);
} else {
this.semicolon();
}
return this.finishNode(node, "DoWhileStatement");
};
// Disambiguating between a `for` and a `for`/`in` or `for`/`of`
// loop is non-trivial. Basically, we have to parse the init `var`
// statement or expression, disallowing the `in` operator (see
// the second parameter to `parseExpression`), and then check
// whether the next token is `in` or `of`. When there is no init
// part (semicolon immediately after the opening parenthesis), it
// is a regular `for` loop.
pp$8.parseForStatement = function (node) {
this.next();
var awaitAt = this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await") ? this.lastTokStart : -1;
this.labels.push(loopLabel);
this.enterScope(0);
this.expect(types$1.parenL);
if (this.type === types$1.semi) {
if (awaitAt > -1) {
this.unexpected(awaitAt);
}
return this.parseFor(node, null);
}
var isLet = this.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$1._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && init$1.declarations.length === 1) {
if (this.options.ecmaVersion >= 9) {
if (this.type === types$1._in) {
if (awaitAt > -1) {
this.unexpected(awaitAt);
}
} else {
node.await = awaitAt > -1;
}
}
return this.parseForIn(node, init$1);
}
if (awaitAt > -1) {
this.unexpected(awaitAt);
}
return this.parseFor(node, init$1);
}
var startsWithLet = this.isContextual("let"),
isForOf = false;
var containsEsc = this.containsEsc;
var refDestructuringErrors = new DestructuringErrors();
var initPos = this.start;
var init = awaitAt > -1 ? this.parseExprSubscripts(refDestructuringErrors, "await") : this.parseExpression(true, refDestructuringErrors);
if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
if (awaitAt > -1) {
// implies `ecmaVersion >= 9` (see declaration of awaitAt)
if (this.type === types$1._in) {
this.unexpected(awaitAt);
}
node.await = true;
} else if (isForOf && this.options.ecmaVersion >= 8) {
if (init.start === initPos && !containsEsc && init.type === "Identifier" && init.name === "async") {
this.unexpected();
} else if (this.options.ecmaVersion >= 9) {
node.await = false;
}
}
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.checkLValPattern(init);
return this.parseForIn(node, init);
} else {
this.checkExpressionErrors(refDestructuringErrors, true);
}
if (awaitAt > -1) {
this.unexpected(awaitAt);
}
return this.parseFor(node, init);
};
pp$8.parseFunctionStatement = function (node, isAsync, declarationPosition) {
this.next();
return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync);
};
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$1._else) ? this.parseStatement("if") : null;
return this.finishNode(node, "IfStatement");
};
pp$8.parseReturnStatement = function (node) {
if (!this.inFunction && !this.options.allowReturnOutsideFunction) {
this.raise(this.start, "'return' outside of function");
}
this.next();
// In `return` (and `break`/`continue`), the keywords with
// optional arguments, we eagerly look for a semicolon or the
// possibility to insert one.
if (this.eat(types$1.semi) || this.insertSemicolon()) {
node.argument = null;
} else {
node.argument = this.parseExpression();
this.semicolon();
}
return this.finishNode(node, "ReturnStatement");
};
pp$8.parseSwitchStatement = function (node) {
this.next();
node.discriminant = this.parseParenExpression();
node.cases = [];
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
// adding statements to.
var cur;
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");
}
node.cases.push(cur = this.startNode());
cur.consequent = [];
this.next();
if (isCase) {
cur.test = this.parseExpression();
} else {
if (sawDefault) {
this.raiseRecoverable(this.lastTokStart, "Multiple default clauses");
}
sawDefault = true;
cur.test = null;
}
this.expect(types$1.colon);
} else {
if (!cur) {
this.unexpected();
}
cur.consequent.push(this.parseStatement(null));
}
}
this.exitScope();
if (cur) {
this.finishNode(cur, "SwitchCase");
}
this.next(); // Closing brace
this.labels.pop();
return this.finishNode(node, "SwitchStatement");
};
pp$8.parseThrowStatement = function (node) {
var _context9;
this.next();
if (lineBreak.test(_sliceInstanceProperty(_context9 = this.input).call(_context9, this.lastTokEnd, this.start))) {
this.raise(this.lastTokEnd, "Illegal newline after throw");
}
node.argument = this.parseExpression();
this.semicolon();
return this.finishNode(node, "ThrowStatement");
};
// Reused empty array added for node fields that are always empty.
var empty$1 = [];
pp$8.parseCatchClauseParam = function () {
var param = this.parseBindingAtom();
var simple = param.type === "Identifier";
this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
this.checkLValPattern(param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
this.expect(types$1.parenR);
return param;
};
pp$8.parseTryStatement = function (node) {
this.next();
node.block = this.parseBlock();
node.handler = null;
if (this.type === types$1._catch) {
var clause = this.startNode();
this.next();
if (this.eat(types$1.parenL)) {
clause.param = this.parseCatchClauseParam();
} else {
if (this.options.ecmaVersion < 10) {
this.unexpected();
}
clause.param = null;
this.enterScope(0);
}
clause.body = this.parseBlock(false);
this.exitScope();
node.handler = this.finishNode(clause, "CatchClause");
}
node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;
if (!node.handler && !node.finalizer) {
this.raise(node.start, "Missing catch or finally clause");
}
return this.finishNode(node, "TryStatement");
};
pp$8.parseVarStatement = function (node, kind, allowMissingInitializer) {
this.next();
this.parseVar(node, false, kind, allowMissingInitializer);
this.semicolon();
return this.finishNode(node, "VariableDeclaration");
};
pp$8.parseWhileStatement = function (node) {
this.next();
node.test = this.parseParenExpression();
this.labels.push(loopLabel);
node.body = this.parseStatement("while");
this.labels.pop();
return this.finishNode(node, "WhileStatement");
};
pp$8.parseWithStatement = function (node) {
if (this.strict) {
this.raise(this.start, "'with' in strict mode");
}
this.next();
node.object = this.parseParenExpression();
node.body = this.parseStatement("with");
return this.finishNode(node, "WithStatement");
};
pp$8.parseEmptyStatement = function (node) {
this.next();
return this.finishNode(node, "EmptyStatement");
};
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];
if (label.name === maybeName) {
this.raise(expr.start, "Label '" + maybeName + "' is already declared");
}
}
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];
if (label$1.statementStart === node.start) {
// Update information about previous labels on this node
label$1.statementStart = this.start;
label$1.kind = kind;
} else {
break;
}
}
this.labels.push({
name: maybeName,
kind: kind,
statementStart: this.start
});
node.body = this.parseStatement(context ? _indexOfInstanceProperty(context).call(context, "label") === -1 ? context + "label" : context : "label");
this.labels.pop();
node.label = expr;
return this.finishNode(node, "LabeledStatement");
};
pp$8.parseExpressionStatement = function (node, expr) {
node.expression = expr;
this.semicolon();
return this.finishNode(node, "ExpressionStatement");
};
// Parse a semicolon-enclosed block of statements, handling `"use
// strict"` declarations when `allowStrict` is true (used for
// function bodies).
pp$8.parseBlock = function (createNewLexicalScope, node, exitStrict) {
if (createNewLexicalScope === undefined) createNewLexicalScope = true;
if (node === undefined) node = this.startNode();
node.body = [];
this.expect(types$1.braceL);
if (createNewLexicalScope) {
this.enterScope(0);
}
while (this.type !== types$1.braceR) {
var stmt = this.parseStatement(null);
node.body.push(stmt);
}
if (exitStrict) {
this.strict = false;
}
this.next();
if (createNewLexicalScope) {
this.exitScope();
}
return this.finishNode(node, "BlockStatement");
};
// Parse a regular `for` loop. The disambiguation code in
// `parseStatement` will already have parsed the init statement or
// expression.
pp$8.parseFor = function (node, init) {
node.init = init;
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();
return this.finishNode(node, "ForStatement");
};
// Parse a `for`/`in` and `for`/`of` loop, which are almost
// same from parser's perspective.
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");
}
node.left = init;
node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
this.expect(types$1.parenR);
node.body = this.parseStatement("for");
this.exitScope();
this.labels.pop();
return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement");
};
// Parse a list of variable declarations.
pp$8.parseVar = function (node, isFor, kind, allowMissingInitializer) {
node.declarations = [];
node.kind = kind;
for (;;) {
var decl = this.startNode();
this.parseVarId(decl, kind);
if (this.eat(types$1.eq)) {
decl.init = this.parseMaybeAssign(isFor);
} else if (!allowMissingInitializer && kind === "const" && !(this.type === types$1._in || this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
this.unexpected();
} else if (!allowMissingInitializer && 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;
}
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
if (!this.eat(types$1.comma)) {
break;
}
}
return node;
};
pp$8.parseVarId = function (decl, kind) {
decl.id = this.parseBindingAtom();
this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
};
var FUNC_STATEMENT = 1,
FUNC_HANGING_STATEMENT = 2,
FUNC_NULLABLE_ID = 4;
// Parse a function declaration or literal (depending on the
// `statement & FUNC_STATEMENT`).
// Remove `allowExpressionBody` for 7.0.0, as it is only called with false
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$1.star && statement & FUNC_HANGING_STATEMENT) {
this.unexpected();
}
node.generator = this.eat(types$1.star);
}
if (this.options.ecmaVersion >= 8) {
node.async = !!isAsync;
}
if (statement & FUNC_STATEMENT) {
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.checkLValSimple(node.id, this.strict || node.generator || node.async ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION);
}
}
var oldYieldPos = this.yieldPos,
oldAwaitPos = this.awaitPos,
oldAwaitIdentPos = this.awaitIdentPos;
this.yieldPos = 0;
this.awaitPos = 0;
this.awaitIdentPos = 0;
this.enterScope(functionFlags(node.async, node.generator));
if (!(statement & FUNC_STATEMENT)) {
node.id = this.type === types$1.name ? this.parseIdent() : null;
}
this.parseFunctionParams(node);
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$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$8.parseClass = function (node, isStatement) {
this.next();
// ecma-262 14.6 Class Definitions
// A class definition is always strict mode code.
var oldStrict = this.strict;
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$1.braceL);
while (this.type !== types$1.braceR) {
var element = this.parseClassElement(node.superClass !== null);
if (element) {
classBody.body.push(element);
if (element.type === "MethodDefinition" && element.kind === "constructor") {
if (hadConstructor) {
this.raiseRecoverable(element.start, "Duplicate constructor in the same class");
}
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");
}
}
}
this.strict = oldStrict;
this.next();
node.body = this.finishNode(classBody, "ClassBody");
this.exitClassBody();
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
};
pp$8.parseClassElement = function (constructorAllowsSuper) {
if (this.eat(types$1.semi)) {
return null;
}
var ecmaVersion = this.options.ecmaVersion;
var node = this.startNode();
var keyName = "";
var isGenerator = false;
var isAsync = false;
var kind = "method";
var isStatic = false;
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;
} else {
keyName = "async";
}
}
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;
if (method.kind === "constructor") {
if (isGenerator) {
this.raise(key.start, "Constructor can't be a generator");
}
if (isAsync) {
this.raise(key.start, "Constructor can't be an async method");
}
} 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");
}
if (method.kind === "set" && value.params.length !== 1) {
this.raiseRecoverable(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");
}
return this.finishNode(method, "MethodDefinition");
};
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.checkLValSimple(node.id, BIND_LEXICAL, false);
}
} else {
if (isStatement === true) {
this.unexpected();
}
node.id = null;
}
};
pp$8.parseClassSuper = function (node) {
node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(null, 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;
if (!this.options.checkPrivateFields) {
return;
}
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 (!hasOwn(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.
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.parseExportAllDeclaration = function (node, exports) {
if (this.options.ecmaVersion >= 11) {
if (this.eatContextual("as")) {
node.exported = this.parseModuleExportName();
this.checkExport(exports, node.exported, this.lastTokStart);
} else {
node.exported = null;
}
}
this.expectContextual("from");
if (this.type !== types$1.string) {
this.unexpected();
}
node.source = this.parseExprAtom();
if (this.options.ecmaVersion >= 16) {
node.attributes = this.parseWithClause();
}
this.semicolon();
return this.finishNode(node, "ExportAllDeclaration");
};
pp$8.parseExport = function (node, exports) {
this.next();
// export * from '...'
if (this.eat(types$1.star)) {
return this.parseExportAllDeclaration(node, exports);
}
if (this.eat(types$1._default)) {
// export default ...
this.checkExport(exports, "default", this.lastTokStart);
node.declaration = this.parseExportDefaultDeclaration();
return this.finishNode(node, "ExportDefaultDeclaration");
}
// export var|const|let|function|class ...
if (this.shouldParseExportStatement()) {
node.declaration = this.parseExportDeclaration(node);
if (node.declaration.type === "VariableDeclaration") {
this.checkVariableExport(exports, node.declaration.declarations);
} else {
this.checkExport(exports, node.declaration.id, node.declaration.id.start);
}
node.specifiers = [];
node.source = null;
} else {
// export { x, y as z } [from '...']
node.declaration = null;
node.specifiers = this.parseExportSpecifiers(exports);
if (this.eatContextual("from")) {
if (this.type !== types$1.string) {
this.unexpected();
}
node.source = this.parseExprAtom();
if (this.options.ecmaVersion >= 16) {
node.attributes = this.parseWithClause();
}
} else {
for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
// check for keywords used as local names
var spec = list[i];
this.checkUnreserved(spec.local);
// check if export is defined
this.checkLocalExport(spec.local);
if (spec.local.type === "Literal") {
this.raise(spec.local.start, "A string literal cannot be used as an exported binding without `from`.");
}
}
node.source = null;
}
this.semicolon();
}
return this.finishNode(node, "ExportNamedDeclaration");
};
pp$8.parseExportDeclaration = function (node) {
return this.parseStatement(null);
};
pp$8.parseExportDefaultDeclaration = function () {
var isAsync;
if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
var fNode = this.startNode();
this.next();
if (isAsync) {
this.next();
}
return this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
} else if (this.type === types$1._class) {
var cNode = this.startNode();
return this.parseClass(cNode, "nullableID");
} else {
var declaration = this.parseMaybeAssign();
this.semicolon();
return declaration;
}
};
pp$8.checkExport = function (exports, name, pos) {
if (!exports) {
return;
}
if (typeof name !== "string") {
name = name.type === "Identifier" ? name.name : name.value;
}
if (hasOwn(exports, name)) {
this.raiseRecoverable(pos, "Duplicate export '" + name + "'");
}
exports[name] = true;
};
pp$8.checkPatternExport = function (exports, pat) {
var type = pat.type;
if (type === "Identifier") {
this.checkExport(exports, pat, pat.start);
} else if (type === "ObjectPattern") {
for (var i = 0, list = pat.properties; i < list.length; i += 1) {
var prop = list[i];
this.checkPatternExport(exports, prop);
}
} else if (type === "ArrayPattern") {
for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
var elt = list$1[i$1];
if (elt) {
this.checkPatternExport(exports, elt);
}
}
} else if (type === "Property") {
this.checkPatternExport(exports, pat.value);
} else if (type === "AssignmentPattern") {
this.checkPatternExport(exports, pat.left);
} else if (type === "RestElement") {
this.checkPatternExport(exports, pat.argument);
}
};
pp$8.checkVariableExport = function (exports, decls) {
if (!exports) {
return;
}
for (var i = 0, list = decls; i < list.length; i += 1) {
var decl = list[i];
this.checkPatternExport(exports, decl.id);
}
};
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$8.parseExportSpecifier = function (exports) {
var node = this.startNode();
node.local = this.parseModuleExportName();
node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
this.checkExport(exports, node.exported, node.exported.start);
return this.finishNode(node, "ExportSpecifier");
};
pp$8.parseExportSpecifiers = function (exports) {
var nodes = [],
first = true;
// export { x, y as z } [from '...']
this.expect(types$1.braceL);
while (!this.eat(types$1.braceR)) {
if (!first) {
this.expect(types$1.comma);
if (this.afterTrailingComma(types$1.braceR)) {
break;
}
} else {
first = false;
}
nodes.push(this.parseExportSpecifier(exports));
}
return nodes;
};
// Parses import declaration.
pp$8.parseImport = function (node) {
this.next();
// import '...'
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$1.string ? this.parseExprAtom() : this.unexpected();
}
if (this.options.ecmaVersion >= 16) {
node.attributes = this.parseWithClause();
}
this.semicolon();
return this.finishNode(node, "ImportDeclaration");
};
// Parses a comma-separated list of module imports.
pp$8.parseImportSpecifier = function () {
var node = this.startNode();
node.imported = this.parseModuleExportName();
if (this.eatContextual("as")) {
node.local = this.parseIdent();
} else {
this.checkUnreserved(node.imported);
node.local = node.imported;
}
this.checkLValSimple(node.local, BIND_LEXICAL);
return this.finishNode(node, "ImportSpecifier");
};
pp$8.parseImportDefaultSpecifier = function () {
// import defaultObj, { x, y as z } from '...'
var node = this.startNode();
node.local = this.parseIdent();
this.checkLValSimple(node.local, BIND_LEXICAL);
return this.finishNode(node, "ImportDefaultSpecifier");
};
pp$8.parseImportNamespaceSpecifier = function () {
var node = this.startNode();
this.next();
this.expectContextual("as");
node.local = this.parseIdent();
this.checkLValSimple(node.local, BIND_LEXICAL);
return this.finishNode(node, "ImportNamespaceSpecifier");
};
pp$8.parseImportSpecifiers = function () {
var nodes = [],
first = true;
if (this.type === types$1.name) {
nodes.push(this.parseImportDefaultSpecifier());
if (!this.eat(types$1.comma)) {
return nodes;
}
}
if (this.type === types$1.star) {
nodes.push(this.parseImportNamespaceSpecifier());
return nodes;
}
this.expect(types$1.braceL);
while (!this.eat(types$1.braceR)) {
if (!first) {
this.expect(types$1.comma);
if (this.afterTrailingComma(types$1.braceR)) {
break;
}
} else {
first = false;
}
nodes.push(this.parseImportSpecifier());
}
return nodes;
};
pp$8.parseWithClause = function () {
var nodes = [];
if (!this.eat(types$1._with)) {
return nodes;
}
this.expect(types$1.braceL);
var attributeKeys = {};
var first = true;
while (!this.eat(types$1.braceR)) {
if (!first) {
this.expect(types$1.comma);
if (this.afterTrailingComma(types$1.braceR)) {
break;
}
} else {
first = false;
}
var attr = this.parseImportAttribute();
var keyName = attr.key.type === "Identifier" ? attr.key.name : attr.key.value;
if (hasOwn(attributeKeys, keyName)) {
this.raiseRecoverable(attr.key.start, "Duplicate attribute key '" + keyName + "'");
}
attributeKeys[keyName] = true;
nodes.push(attr);
}
return nodes;
};
pp$8.parseImportAttribute = function () {
var node = this.startNode();
node.key = this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never");
this.expect(types$1.colon);
if (this.type !== types$1.string) {
this.unexpected();
}
node.value = this.parseExprAtom();
return this.finishNode(node, "ImportAttribute");
};
pp$8.parseModuleExportName = function () {
if (this.options.ecmaVersion >= 13 && this.type === types$1.string) {
var stringLiteral = this.parseLiteral(this.value);
if (loneSurrogate.test(stringLiteral.value)) {
this.raise(stringLiteral.start, "An export name cannot include a lone surrogate.");
}
return stringLiteral;
}
return this.parseIdent(true);
};
// Set `ExpressionStatement#directive` property for directive prologues.
pp$8.adaptDirectivePrologue = function (statements) {
for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {
var _context0;
statements[i].directive = _sliceInstanceProperty(_context0 = statements[i].expression.raw).call(_context0, 1, -1);
}
};
pp$8.isDirectiveCandidate = function (statement) {
return this.options.ecmaVersion >= 5 && 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$7 = Parser$1.prototype;
// Convert existing expression atom to assignable pattern
// if possible.
pp$7.toAssignable = function (node, isBinding, refDestructuringErrors) {
if (this.options.ecmaVersion >= 6 && node) {
switch (node.type) {
case "Identifier":
if (this.inAsync && node.name === "await") {
this.raise(node.start, "Cannot use 'await' as identifier inside an async function");
}
break;
case "ObjectPattern":
case "ArrayPattern":
case "AssignmentPattern":
case "RestElement":
break;
case "ObjectExpression":
node.type = "ObjectPattern";
if (refDestructuringErrors) {
this.checkPatternErrors(refDestructuringErrors, true);
}
for (var i = 0, list = node.properties; i < list.length; i += 1) {
var prop = list[i];
this.toAssignable(prop, isBinding);
// Early error:
// AssignmentRestProperty[Yield, Await] :
// `...` DestructuringAssignmentTarget[Yield, Await]
//
// It is a Syntax Error if |DestructuringAssignmentTarget| is an |ArrayLiteral| or an |ObjectLiteral|.
if (prop.type === "RestElement" && (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern")) {
this.raise(prop.argument.start, "Unexpected token");
}
}
break;
case "Property":
// AssignmentProperty has type === "Property"
if (node.kind !== "init") {
this.raise(node.key.start, "Object pattern can't contain getter or setter");
}
this.toAssignable(node.value, isBinding);
break;
case "ArrayExpression":
node.type = "ArrayPattern";
if (refDestructuringErrors) {
this.checkPatternErrors(refDestructuringErrors, true);
}
this.toAssignableList(node.elements, isBinding);
break;
case "SpreadElement":
node.type = "RestElement";
this.toAssignable(node.argument, isBinding);
if (node.argument.type === "AssignmentPattern") {
this.raise(node.argument.start, "Rest elements cannot have a default value");
}
break;
case "AssignmentExpression":
if (node.operator !== "=") {
this.raise(node.left.end, "Only '=' operator can be used for specifying default value.");
}
node.type = "AssignmentPattern";
delete node.operator;
this.toAssignable(node.left, isBinding);
break;
case "ParenthesizedExpression":
this.toAssignable(node.expression, isBinding, refDestructuringErrors);
break;
case "ChainExpression":
this.raiseRecoverable(node.start, "Optional chaining cannot appear in left-hand side");
break;
case "MemberExpression":
if (!isBinding) {
break;
}
default:
this.raise(node.start, "Assigning to rvalue");
}
} else if (refDestructuringErrors) {
this.checkPatternErrors(refDestructuringErrors, true);
}
return node;
};
// Convert list of expression atoms to binding list.
pp$7.toAssignableList = function (exprList, isBinding) {
var end = exprList.length;
for (var i = 0; i < end; i++) {
var elt = exprList[i];
if (elt) {
this.toAssignable(elt, isBinding);
}
}
if (end) {
var last = exprList[end - 1];
if (this.options.ecmaVersion === 6 && isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier") {
this.unexpected(last.argument.start);
}
}
return exprList;
};
// Parses spread element.
pp$7.parseSpread = function (refDestructuringErrors) {
var node = this.startNode();
this.next();
node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
return this.finishNode(node, "SpreadElement");
};
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$1.name) {
this.unexpected();
}
node.argument = this.parseBindingAtom();
return this.finishNode(node, "RestElement");
};
// Parses lvalue (assignable) atom.
pp$7.parseBindingAtom = function () {
if (this.options.ecmaVersion >= 6) {
switch (this.type) {
case types$1.bracketL:
var node = this.startNode();
this.next();
node.elements = this.parseBindingList(types$1.bracketR, true, true);
return this.finishNode(node, "ArrayPattern");
case types$1.braceL:
return this.parseObj(true);
}
}
return this.parseIdent();
};
pp$7.parseBindingList = function (close, allowEmpty, allowTrailingComma, allowModifiers) {
var elts = [],
first = true;
while (!this.eat(close)) {
if (first) {
first = false;
} else {
this.expect(types$1.comma);
}
if (allowEmpty && this.type === types$1.comma) {
elts.push(null);
} else if (allowTrailingComma && this.afterTrailingComma(close)) {
break;
} else if (this.type === types$1.ellipsis) {
var rest = this.parseRestBinding();
this.parseBindingListItem(rest);
elts.push(rest);
if (this.type === types$1.comma) {
this.raiseRecoverable(this.start, "Comma is not permitted after the rest element");
}
this.expect(close);
break;
} else {
elts.push(this.parseAssignableListItem(allowModifiers));
}
}
return elts;
};
pp$7.parseAssignableListItem = function (allowModifiers) {
var elem = this.parseMaybeDefault(this.start, this.startLoc);
this.parseBindingListItem(elem);
return elem;
};
pp$7.parseBindingListItem = function (param) {
return param;
};
// Parses assignment pattern around given atom if possible.
pp$7.parseMaybeDefault = function (startPos, startLoc, left) {
left = left || this.parseBindingAtom();
if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) {
return left;
}
var node = this.startNodeAt(startPos, startLoc);
node.left = left;
node.right = this.parseMaybeAssign();
return this.finishNode(node, "AssignmentPattern");
};
// 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$7.checkLValSimple = function (expr, bindingType, checkClashes) {
if (bindingType === undefined) bindingType = BIND_NONE;
var isBind = bindingType !== BIND_NONE;
switch (expr.type) {
case "Identifier":
if (this.strict && this.reservedWordsStrictBind.test(expr.name)) {
this.raiseRecoverable(expr.start, (isBind ? "Binding " : "Assigning to ") + expr.name + " in strict mode");
}
if (isBind) {
if (bindingType === BIND_LEXICAL && expr.name === "let") {
this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name");
}
if (checkClashes) {
if (hasOwn(checkClashes, expr.name)) {
this.raiseRecoverable(expr.start, "Argument name clash");
}
checkClashes[expr.name] = true;
}
if (bindingType !== BIND_OUTSIDE) {
this.declareName(expr.name, bindingType, expr.start);
}
}
break;
case "ChainExpression":
this.raiseRecoverable(expr.start, "Optional chaining cannot appear in left-hand side");
break;
case "MemberExpression":
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 === undefined) 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.checkLValInnerPattern(prop, 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.checkLValInnerPattern(elem, bindingType, checkClashes);
}
}
break;
default:
this.checkLValSimple(expr, bindingType, checkClashes);
}
};
pp$7.checkLValInnerPattern = function (expr, bindingType, checkClashes) {
if (bindingType === undefined) bindingType = BIND_NONE;
switch (expr.type) {
case "Property":
// AssignmentProperty has type === "Property"
this.checkLValInnerPattern(expr.value, bindingType, checkClashes);
break;
case "AssignmentPattern":
this.checkLValPattern(expr.left, bindingType, checkClashes);
break;
case "RestElement":
this.checkLValPattern(expr.argument, bindingType, checkClashes);
break;
default:
this.checkLValPattern(expr, bindingType, checkClashes);
}
};
// The algorithm used to determine whether a regexp can appear at a
// given point in the program is loosely based on sweet.js' approach.
// See https://github.com/mozilla/sweet.js/wiki/design
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$1.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) {
var _context1;
return lineBreak.test(_sliceInstanceProperty(_context1 = this.input).call(_context1, 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 edge cases when token context could not be inferred correctly during tokenization 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) {
var _context10;
if (prevType.beforeExpr && prevType !== types$1._else && !(prevType === types$1.semi && this.curContext() !== types.p_stat) && !(prevType === types$1._return && lineBreak.test(_sliceInstanceProperty(_context10 = this.input).call(_context10, 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.colon.updateContext = function () {
if (this.curContext().token === "function") {
this.context.pop();
}
this.exprAllowed = true;
};
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
// syntactic elements, and recursively calling those, each function
// advancing the input stream and returning an AST node. Precedence
// of constructs (for example, the fact that `!x[1]` means `!(x[1])`
// instead of `(!x)[1]` is handled by the fact that the parser
// function that parses unary prefix operators is called first, and
// in turn calls the function that parses `[]` subscripts — that
// way, it'll receive the node for `x[1]` already parsed, and wraps
// *that* in the unary operator node.
//
// Acorn uses an [operator precedence parser][opp] to handle binary
// operator precedence, because it is much more compact than using
// the technique outlined above, which uses different, nesting
// functions to specify precedence, for all of the ten binary
// precedence levels that JavaScript defines.
//
// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser
var pp$5 = Parser$1.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$5.checkPropClash = function (prop, propHash, refDestructuringErrors) {
if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement") {
return;
}
if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand)) {
return;
}
var key = prop.key;
var name;
switch (key.type) {
case "Identifier":
name = key.name;
break;
case "Literal":
name = String(key.value);
break;
default:
return;
}
var kind = prop.kind;
if (this.options.ecmaVersion >= 6) {
if (name === "__proto__" && kind === "init") {
if (propHash.proto) {
if (refDestructuringErrors) {
if (refDestructuringErrors.doubleProto < 0) {
refDestructuringErrors.doubleProto = key.start;
}
} else {
this.raiseRecoverable(key.start, "Redefinition of __proto__ property");
}
}
propHash.proto = true;
}
return;
}
name = "$" + name;
var other = propHash[name];
if (other) {
var redefinition;
if (kind === "init") {
redefinition = this.strict && other.init || other.get || other.set;
} else {
redefinition = other.init || other[kind];
}
if (redefinition) {
this.raiseRecoverable(key.start, "Redefinition of property");
}
} else {
other = propHash[name] = {
init: false,
get: false,
set: false
};
}
other[kind] = true;
};
// ### Expression parsing
// These nest, from the most general expression type at the top to
// 'atomic', nondivisible expression types at the bottom. Most of
// the functions will simply let the function(s) below them parse,
// and, *if* the syntactic construct they handle is present, wrap
// the AST node that the inner parser gave them in another node.
// Parse a full expression. The optional arguments are used to
// forbid the `in` operator (in for loops initalization expressions)
// and provide reference for storing '=' operator inside shorthand
// property assignment in contexts where both object expression
// and object pattern might appear (so it's possible to raise
// delayed syntax error at correct position).
pp$5.parseExpression = function (forInit, refDestructuringErrors) {
var startPos = this.start,
startLoc = this.startLoc;
var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
if (this.type === types$1.comma) {
var node = this.startNodeAt(startPos, startLoc);
node.expressions = [expr];
while (this.eat(types$1.comma)) {
node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors));
}
return this.finishNode(node, "SequenceExpression");
}
return expr;
};
// Parse an assignment expression. This includes applications of
// operators like `+=`.
pp$5.parseMaybeAssign = function (forInit, refDestructuringErrors, afterLeftParse) {
if (this.isContextual("yield")) {
if (this.inGenerator) {
return this.parseYield(forInit);
}
// The tokenizer will assume an expression is allowed after
// `yield`, but this isn't that kind of yield
else {
this.exprAllowed = false;
}
}
var ownDestructuringErrors = false,
oldParenAssign = -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();
ownDestructuringErrors = true;
}
var startPos = this.start,
startLoc = this.startLoc;
if (this.type === types$1.parenL || this.type === types$1.name) {
this.potentialArrowAt = this.start;
this.potentialArrowInForAwait = forInit === "await";
}
var left = this.parseMaybeConditional(forInit, refDestructuringErrors);
if (afterLeftParse) {
left = afterLeftParse.call(this, left, startPos, startLoc);
}
if (this.type.isAssign) {
var node = this.startNodeAt(startPos, startLoc);
node.operator = this.value;
if (this.type === types$1.eq) {
left = this.toAssignable(left, false, refDestructuringErrors);
}
if (!ownDestructuringErrors) {
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;
}
if (refDestructuringErrors.shorthandAssign >= left.start) {
refDestructuringErrors.shorthandAssign = -1;
} // reset because shorthand default was used correctly
if (this.type === types$1.eq) {
this.checkLValPattern(left);
} else {
this.checkLValSimple(left);
}
node.left = left;
this.next();
node.right = this.parseMaybeAssign(forInit);
if (oldDoubleProto > -1) {
refDestructuringErrors.doubleProto = oldDoubleProto;
}
return this.finishNode(node, "AssignmentExpression");
} else {
if (ownDestructuringErrors) {
this.checkExpressionErrors(refDestructuringErrors, true);
}
}
if (oldParenAssign > -1) {
refDestructuringErrors.parenthesizedAssign = oldParenAssign;
}
if (oldTrailingComma > -1) {
refDestructuringErrors.trailingComma = oldTrailingComma;
}
return left;
};
// Parse a ternary conditional (`?:`) operator.
pp$5.parseMaybeConditional = function (forInit, refDestructuringErrors) {
var startPos = this.start,
startLoc = this.startLoc;
var expr = this.parseExprOps(forInit, refDestructuringErrors);
if (this.checkExpressionErrors(refDestructuringErrors)) {
return expr;
}
if (this.eat(types$1.question)) {
var node = this.startNodeAt(startPos, startLoc);
node.test = expr;
node.consequent = this.parseMaybeAssign();
this.expect(types$1.colon);
node.alternate = this.parseMaybeAssign(forInit);
return this.finishNode(node, "ConditionalExpression");
}
return expr;
};
// Start the precedence parser.
pp$5.parseExprOps = function (forInit, refDestructuringErrors) {
var startPos = this.start,
startLoc = this.startLoc;
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, 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
// defer further parser to one of its callers when it encounters an
// operator that has a lower precedence than the set it is parsing.
pp$5.parseExprOp = function (left, leftStartPos, leftStartLoc, minPrec, forInit) {
var prec = this.type.binop;
if (prec != null && (!forInit || this.type !== types$1._in)) {
if (prec > minPrec) {
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$1.logicalAND.binop;
}
var op = this.value;
this.next();
var startPos = this.start,
startLoc = this.startLoc;
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$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, forInit);
}
}
return left;
};
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;
node.right = right;
return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression");
};
// Parse unary operators, both prefix and postfix.
pp$5.parseMaybeUnary = function (refDestructuringErrors, sawUnary, incDec, forInit) {
var startPos = this.start,
startLoc = this.startLoc,
expr;
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$1.incDec;
node.operator = this.value;
node.prefix = true;
this.next();
node.argument = this.parseMaybeUnary(null, true, update, forInit);
this.checkExpressionErrors(refDestructuringErrors, true);
if (update) {
this.checkLValSimple(node.argument);
} else if (this.strict && node.operator === "delete" && isLocalVariableAccess(node.argument)) {
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.options.checkPrivateFields) {
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, forInit);
if (this.checkExpressionErrors(refDestructuringErrors)) {
return expr;
}
while (this.type.postfix && !this.canInsertSemicolon()) {
var node$1 = this.startNodeAt(startPos, startLoc);
node$1.operator = this.value;
node$1.prefix = false;
node$1.argument = expr;
this.checkLValSimple(expr);
this.next();
expr = this.finishNode(node$1, "UpdateExpression");
}
}
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;
}
};
function isLocalVariableAccess(node) {
return node.type === "Identifier" || node.type === "ParenthesizedExpression" && isLocalVariableAccess(node.expression);
}
function isPrivateFieldAccess(node) {
return node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" || node.type === "ChainExpression" && isPrivateFieldAccess(node.expression) || node.type === "ParenthesizedExpression" && isPrivateFieldAccess(node.expression);
}
// Parse call, dot, and `[]`-subscript expressions.
pp$5.parseExprSubscripts = function (refDestructuringErrors, forInit) {
var _context11;
var startPos = this.start,
startLoc = this.startLoc;
var expr = this.parseExprAtom(refDestructuringErrors, forInit);
if (expr.type === "ArrowFunctionExpression" && _sliceInstanceProperty(_context11 = this.input).call(_context11, this.lastTokStart, this.lastTokEnd) !== ")") {
return expr;
}
var result = this.parseSubscripts(expr, startPos, startLoc, false, forInit);
if (refDestructuringErrors && result.type === "MemberExpression") {
if (refDestructuringErrors.parenthesizedAssign >= result.start) {
refDestructuringErrors.parenthesizedAssign = -1;
}
if (refDestructuringErrors.parenthesizedBind >= result.start) {
refDestructuringErrors.parenthesizedBind = -1;
}
if (refDestructuringErrors.trailingComma >= result.start) {
refDestructuringErrors.trailingComma = -1;
}
}
return result;
};
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, forInit);
if (element.optional) {
optionalChained = true;
}
if (element === base || element.type === "ArrowFunctionExpression") {
if (optionalChained) {
var chainNode = this.startNodeAt(startPos, startLoc);
chainNode.expression = element;
element = this.finishNode(chainNode, "ChainExpression");
}
return element;
}
base = element;
}
};
pp$5.shouldParseAsyncArrow = function () {
return !this.canInsertSemicolon() && this.eat(types$1.arrow);
};
pp$5.parseSubscriptAsyncArrow = function (startPos, startLoc, exprList, forInit) {
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit);
};
pp$5.parseSubscript = function (base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
var optionalSupported = this.options.ecmaVersion >= 11;
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$1.bracketL);
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;
if (computed) {
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$1.parenL)) {
var refDestructuringErrors = new DestructuringErrors(),
oldYieldPos = this.yieldPos,
oldAwaitPos = this.awaitPos,
oldAwaitIdentPos = this.awaitIdentPos;
this.yieldPos = 0;
this.awaitPos = 0;
this.awaitIdentPos = 0;
var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
if (maybeAsyncArrow && !optional && this.shouldParseAsyncArrow()) {
this.checkPatternErrors(refDestructuringErrors, false);
this.checkYieldAwaitInDefaultParams();
if (this.awaitIdentPos > 0) {
this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function");
}
this.yieldPos = oldYieldPos;
this.awaitPos = oldAwaitPos;
this.awaitIdentPos = oldAwaitIdentPos;
return this.parseSubscriptAsyncArrow(startPos, startLoc, exprList, forInit);
}
this.checkExpressionErrors(refDestructuringErrors, true);
this.yieldPos = oldYieldPos || this.yieldPos;
this.awaitPos = oldAwaitPos || this.awaitPos;
this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos;
var node$1 = this.startNodeAt(startPos, startLoc);
node$1.callee = base;
node$1.arguments = exprList;
if (optionalSupported) {
node$1.optional = optional;
}
base = this.finishNode(node$1, "CallExpression");
} 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");
}
var node$2 = this.startNodeAt(startPos, startLoc);
node$2.tag = base;
node$2.quasi = this.parseTemplate({
isTagged: true
});
base = this.finishNode(node$2, "TaggedTemplateExpression");
}
return base;
};
// Parse an atomic expression — either a single token that is an
// expression, an expression started by a keyword like `function` or
// `new`, or an expression wrapped in punctuation like `()`, `[]`,
// or `{}`.
pp$5.parseExprAtom = function (refDestructuringErrors, forInit, forNew) {
// 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$1.slash) {
this.readRegexp();
}
var node,
canBeArrow = this.potentialArrowAt === this.start;
switch (this.type) {
case types$1._super:
if (!this.allowSuper) {
this.raise(this.start, "'super' keyword outside a method");
}
node = this.startNode();
this.next();
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:
// super [ Expression ]
// super . IdentifierName
// SuperCall:
// super ( Arguments )
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$1._this:
node = this.startNode();
this.next();
return this.finishNode(node, "ThisExpression");
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$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$1.arrow)) {
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit);
}
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$1.arrow)) {
this.unexpected();
}
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit);
}
}
return id;
case types$1.regexp:
var value = this.value;
node = this.parseLiteral(value.value);
node.regex = {
pattern: value.pattern,
flags: _flagsInstanceProperty(value)
};
return node;
case types$1.num:
case types$1.string:
return this.parseLiteral(this.value);
case types$1._null:
case types$1._true:
case types$1._false:
node = this.startNode();
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$1.parenL:
var start = this.start,
expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit);
if (refDestructuringErrors) {
if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr)) {
refDestructuringErrors.parenthesizedAssign = start;
}
if (refDestructuringErrors.parenthesizedBind < 0) {
refDestructuringErrors.parenthesizedBind = start;
}
}
return expr;
case types$1.bracketL:
node = this.startNode();
this.next();
node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors);
return this.finishNode(node, "ArrayExpression");
case types$1.braceL:
this.overrideContext(types.b_expr);
return this.parseObj(false, refDestructuringErrors);
case types$1._function:
node = this.startNode();
this.next();
return this.parseFunction(node, 0);
case types$1._class:
return this.parseClass(this.startNode(), false);
case types$1._new:
return this.parseNew();
case types$1.backQuote:
return this.parseTemplate();
case types$1._import:
if (this.options.ecmaVersion >= 11) {
return this.parseExprImport(forNew);
} else {
return this.unexpected();
}
default:
return this.parseExprAtomDefault();
}
};
pp$5.parseExprAtomDefault = function () {
this.unexpected();
};
pp$5.parseExprImport = function (forNew) {
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`.
if (this.containsEsc) {
this.raiseRecoverable(this.start, "Escape sequence in keyword import");
}
this.next();
if (this.type === types$1.parenL && !forNew) {
return this.parseDynamicImport(node);
} else if (this.type === types$1.dot) {
var meta = this.startNodeAt(node.start, node.loc && node.loc.start);
meta.name = "import";
node.meta = this.finishNode(meta, "Identifier");
return this.parseImportMeta(node);
} else {
this.unexpected();
}
};
pp$5.parseDynamicImport = function (node) {
this.next(); // skip `(`
// Parse node.source.
node.source = this.parseMaybeAssign();
if (this.options.ecmaVersion >= 16) {
if (!this.eat(types$1.parenR)) {
this.expect(types$1.comma);
if (!this.afterTrailingComma(types$1.parenR)) {
node.options = this.parseMaybeAssign();
if (!this.eat(types$1.parenR)) {
this.expect(types$1.comma);
if (!this.afterTrailingComma(types$1.parenR)) {
this.unexpected();
}
}
} else {
node.options = null;
}
} else {
node.options = null;
}
} else {
// Verify ending.
if (!this.eat(types$1.parenR)) {
var errorPos = this.start;
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);
}
}
}
return this.finishNode(node, "ImportExpression");
};
pp$5.parseImportMeta = function (node) {
this.next(); // skip `.`
var containsEsc = this.containsEsc;
node.property = this.parseIdent(true);
if (node.property.name !== "meta") {
this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'");
}
if (containsEsc) {
this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters");
}
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$5.parseLiteral = function (value) {
var _context12;
var node = this.startNode();
node.value = value;
node.raw = _sliceInstanceProperty(_context12 = this.input).call(_context12, this.start, this.end);
if (node.raw.charCodeAt(node.raw.length - 1) === 110) {
var _context13;
node.bigint = _sliceInstanceProperty(_context13 = node.raw).call(_context13, 0, -1).replace(/_/g, "");
}
this.next();
return this.finishNode(node, "Literal");
};
pp$5.parseParenExpression = function () {
this.expect(types$1.parenL);
var val = this.parseExpression();
this.expect(types$1.parenR);
return val;
};
pp$5.shouldParseArrow = function (exprList) {
return !this.canInsertSemicolon();
};
pp$5.parseParenAndDistinguishExpression = function (canBeArrow, forInit) {
var startPos = this.start,
startLoc = this.startLoc,
val,
allowTrailingComma = this.options.ecmaVersion >= 8;
if (this.options.ecmaVersion >= 6) {
this.next();
var innerStartPos = this.start,
innerStartLoc = this.startLoc;
var exprList = [],
first = true,
lastIsComma = false;
var refDestructuringErrors = new DestructuringErrors(),
oldYieldPos = this.yieldPos,
oldAwaitPos = this.awaitPos,
spreadStart;
this.yieldPos = 0;
this.awaitPos = 0;
// Do not save awaitIdentPos to allow checking awaits nested in parameters
while (this.type !== types$1.parenR) {
first ? first = false : this.expect(types$1.comma);
if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) {
lastIsComma = true;
break;
} else if (this.type === types$1.ellipsis) {
spreadStart = this.start;
exprList.push(this.parseParenItem(this.parseRestBinding()));
if (this.type === types$1.comma) {
this.raiseRecoverable(this.start, "Comma is not permitted after the rest element");
}
break;
} else {
exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
}
}
var innerEndPos = this.lastTokEnd,
innerEndLoc = this.lastTokEndLoc;
this.expect(types$1.parenR);
if (canBeArrow && this.shouldParseArrow(exprList) && this.eat(types$1.arrow)) {
this.checkPatternErrors(refDestructuringErrors, false);
this.checkYieldAwaitInDefaultParams();
this.yieldPos = oldYieldPos;
this.awaitPos = oldAwaitPos;
return this.parseParenArrowList(startPos, startLoc, exprList, forInit);
}
if (!exprList.length || lastIsComma) {
this.unexpected(this.lastTokStart);
}
if (spreadStart) {
this.unexpected(spreadStart);
}
this.checkExpressionErrors(refDestructuringErrors, true);
this.yieldPos = oldYieldPos || this.yieldPos;
this.awaitPos = oldAwaitPos || this.awaitPos;
if (exprList.length > 1) {
val = this.startNodeAt(innerStartPos, innerStartLoc);
val.expressions = exprList;
this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc);
} else {
val = exprList[0];
}
} else {
val = this.parseParenExpression();
}
if (this.options.preserveParens) {
var par = this.startNodeAt(startPos, startLoc);
par.expression = val;
return this.finishNode(par, "ParenthesizedExpression");
} else {
return val;
}
};
pp$5.parseParenItem = function (item) {
return item;
};
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
// argument to parseSubscripts to prevent it from consuming the
// argument list.
var empty = [];
pp$5.parseNew = function () {
if (this.containsEsc) {
this.raiseRecoverable(this.start, "Escape sequence in keyword new");
}
var node = this.startNode();
this.next();
if (this.options.ecmaVersion >= 6 && this.type === types$1.dot) {
var meta = this.startNodeAt(node.start, node.loc && node.loc.start);
meta.name = "new";
node.meta = this.finishNode(meta, "Identifier");
this.next();
var containsEsc = this.containsEsc;
node.property = this.parseIdent(true);
if (node.property.name !== "target") {
this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'");
}
if (containsEsc) {
this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters");
}
if (!this.allowNewDotTarget) {
this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block");
}
return this.finishNode(node, "MetaProperty");
}
var startPos = this.start,
startLoc = this.startLoc;
node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
if (this.eat(types$1.parenL)) {
node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false);
} else {
node.arguments = empty;
}
return this.finishNode(node, "NewExpression");
};
// Parse template expression.
pp$5.parseTemplateElement = function (ref) {
var isTagged = ref.isTagged;
var elem = this.startNode();
if (this.type === types$1.invalidTemplate) {
if (!isTagged) {
this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
}
elem.value = {
raw: this.value.replace(/\r\n?/g, "\n"),
cooked: null
};
} else {
var _context14;
elem.value = {
raw: _sliceInstanceProperty(_context14 = this.input).call(_context14, this.start, this.end).replace(/\r\n?/g, "\n"),
cooked: this.value
};
}
this.next();
elem.tail = this.type === types$1.backQuote;
return this.finishNode(elem, "TemplateElement");
};
pp$5.parseTemplate = function (ref) {
if (ref === undefined) ref = {};
var isTagged = ref.isTagged;
if (isTagged === undefined) isTagged = false;
var node = this.startNode();
this.next();
node.expressions = [];
var curElt = this.parseTemplateElement({
isTagged: isTagged
});
node.quasis = [curElt];
while (!curElt.tail) {
if (this.type === types$1.eof) {
this.raise(this.pos, "Unterminated template literal");
}
this.expect(types$1.dollarBraceL);
node.expressions.push(this.parseExpression());
this.expect(types$1.braceR);
node.quasis.push(curElt = this.parseTemplateElement({
isTagged: isTagged
}));
}
this.next();
return this.finishNode(node, "TemplateLiteral");
};
pp$5.isAsyncProp = function (prop) {
var _context15;
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(_sliceInstanceProperty(_context15 = this.input).call(_context15, this.lastTokEnd, this.start));
};
// Parse an object literal or binding pattern.
pp$5.parseObj = function (isPattern, refDestructuringErrors) {
var node = this.startNode(),
first = true,
propHash = {};
node.properties = [];
this.next();
while (!this.eat(types$1.braceR)) {
if (!first) {
this.expect(types$1.comma);
if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) {
break;
}
} else {
first = false;
}
var prop = this.parseProperty(isPattern, refDestructuringErrors);
if (!isPattern) {
this.checkPropClash(prop, propHash, refDestructuringErrors);
}
node.properties.push(prop);
}
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression");
};
pp$5.parseProperty = function (isPattern, refDestructuringErrors) {
var prop = this.startNode(),
isGenerator,
isAsync,
startPos,
startLoc;
if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) {
if (isPattern) {
prop.argument = this.parseIdent(false);
if (this.type === types$1.comma) {
this.raiseRecoverable(this.start, "Comma is not permitted after the rest element");
}
return this.finishNode(prop, "RestElement");
}
// Parse argument.
prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
// To disallow trailing comma via `this.toAssignable()`.
if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
refDestructuringErrors.trailingComma = this.start;
}
// Finish
return this.finishNode(prop, "SpreadElement");
}
if (this.options.ecmaVersion >= 6) {
prop.method = false;
prop.shorthand = false;
if (isPattern || refDestructuringErrors) {
startPos = this.start;
startLoc = this.startLoc;
}
if (!isPattern) {
isGenerator = this.eat(types$1.star);
}
}
var containsEsc = this.containsEsc;
this.parsePropertyName(prop);
if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
isAsync = true;
isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star);
this.parsePropertyName(prop);
} else {
isAsync = false;
}
this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc);
return this.finishNode(prop, "Property");
};
pp$5.parseGetterSetter = function (prop) {
prop.kind = prop.key.name;
this.parsePropertyName(prop);
prop.value = this.parseMethod(false);
var paramCount = prop.kind === "get" ? 0 : 1;
if (prop.value.params.length !== paramCount) {
var start = prop.value.start;
if (prop.kind === "get") {
this.raiseRecoverable(start, "getter should have no params");
} else {
this.raiseRecoverable(start, "setter should have exactly one param");
}
} else {
if (prop.kind === "set" && prop.value.params[0].type === "RestElement") {
this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params");
}
}
};
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$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$1.parenL) {
if (isPattern) {
this.unexpected();
}
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$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq) {
if (isGenerator || isAsync) {
this.unexpected();
}
this.parseGetterSetter(prop);
} else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
if (isGenerator || isAsync) {
this.unexpected();
}
this.checkUnreserved(prop.key);
if (prop.key.name === "await" && !this.awaitIdentPos) {
this.awaitIdentPos = startPos;
}
prop.kind = "init";
if (isPattern) {
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, this.copyNode(prop.key));
} else {
prop.value = this.copyNode(prop.key);
}
prop.shorthand = true;
} else {
this.unexpected();
}
};
pp$5.parsePropertyName = function (prop) {
if (this.options.ecmaVersion >= 6) {
if (this.eat(types$1.bracketL)) {
prop.computed = true;
prop.key = this.parseMaybeAssign();
this.expect(types$1.bracketR);
return prop.key;
} else {
prop.computed = false;
}
}
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$5.initFunction = function (node) {
node.id = null;
if (this.options.ecmaVersion >= 6) {
node.generator = node.expression = false;
}
if (this.options.ecmaVersion >= 8) {
node.async = false;
}
};
// Parse object or class method.
pp$5.parseMethod = function (isGenerator, isAsync, allowDirectSuper) {
var node = this.startNode(),
oldYieldPos = this.yieldPos,
oldAwaitPos = this.awaitPos,
oldAwaitIdentPos = this.awaitIdentPos;
this.initFunction(node);
if (this.options.ecmaVersion >= 6) {
node.generator = isGenerator;
}
if (this.options.ecmaVersion >= 8) {
node.async = !!isAsync;
}
this.yieldPos = 0;
this.awaitPos = 0;
this.awaitIdentPos = 0;
this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
this.expect(types$1.parenL);
node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
this.checkYieldAwaitInDefaultParams();
this.parseFunctionBody(node, false, true, false);
this.yieldPos = oldYieldPos;
this.awaitPos = oldAwaitPos;
this.awaitIdentPos = oldAwaitIdentPos;
return this.finishNode(node, "FunctionExpression");
};
// Parse arrow function expression with given parameters.
pp$5.parseArrowExpression = function (node, params, isAsync, forInit) {
var oldYieldPos = this.yieldPos,
oldAwaitPos = this.awaitPos,
oldAwaitIdentPos = this.awaitIdentPos;
this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);
this.initFunction(node);
if (this.options.ecmaVersion >= 8) {
node.async = !!isAsync;
}
this.yieldPos = 0;
this.awaitPos = 0;
this.awaitIdentPos = 0;
node.params = this.toAssignableList(params, true);
this.parseFunctionBody(node, true, false, forInit);
this.yieldPos = oldYieldPos;
this.awaitPos = oldAwaitPos;
this.awaitIdentPos = oldAwaitIdentPos;
return this.finishNode(node, "ArrowFunctionExpression");
};
// Parse function body and check parameters.
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(forInit);
node.expression = true;
this.checkParams(node, false);
} else {
var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params);
if (!oldStrict || nonSimple) {
useStrict = this.strictDirective(this.end);
// If this is a strict mode function, verify that argument names
// are not repeated, and it does not try to bind the words `eval`
// or `arguments`.
if (useStrict && nonSimple) {
this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list");
}
}
// Start a new scope with regard to labels and the `inFunction`
// flag (restore them to their old value afterwards).
var oldLabels = this.labels;
this.labels = [];
if (useStrict) {
this.strict = true;
}
// Add the params to varDeclaredNames to ensure that an error is thrown
// if a let/const declaration in the function clashes with one of the params.
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.checkLValSimple(node.id, BIND_OUTSIDE);
}
node.body = this.parseBlock(false, undefined, useStrict && !oldStrict);
node.expression = false;
this.adaptDirectivePrologue(node.body.body);
this.labels = oldLabels;
}
this.exitScope();
};
pp$5.isSimpleParamList = function (params) {
for (var i = 0, list = params; i < list.length; i += 1) {
var param = list[i];
if (param.type !== "Identifier") {
return false;
}
}
return true;
};
// Checks function params for various disallowed patterns such as using "eval"
// or "arguments" and duplicate parameters.
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.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
// `allowEmpty` can be turned on to allow subsequent commas with
// nothing in between them to be parsed as `null` (which is needed
// for array literals).
pp$5.parseExprList = function (close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
var elts = [],
first = true;
while (!this.eat(close)) {
if (!first) {
this.expect(types$1.comma);
if (allowTrailingComma && this.afterTrailingComma(close)) {
break;
}
} else {
first = false;
}
var elt = undefined;
if (allowEmpty && this.type === types$1.comma) {
elt = null;
} else if (this.type === types$1.ellipsis) {
elt = this.parseSpread(refDestructuringErrors);
if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0) {
refDestructuringErrors.trailingComma = this.start;
}
} else {
elt = this.parseMaybeAssign(false, refDestructuringErrors);
}
elts.push(elt);
}
return elts;
};
pp$5.checkUnreserved = function (ref) {
var _context16, _context17;
var start = ref.start;
var end = ref.end;
var name = ref.name;
if (this.inGenerator && name === "yield") {
this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator");
}
if (this.inAsync && name === "await") {
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 + "'");
}
if (this.options.ecmaVersion < 6 && _indexOfInstanceProperty(_context16 = _sliceInstanceProperty(_context17 = this.input).call(_context17, start, end)).call(_context16, "\\") !== -1) {
return;
}
var re = this.strict ? this.reservedWordsStrict : this.reservedWords;
if (re.test(name)) {
if (!this.inAsync && name === "await") {
this.raiseRecoverable(start, "Cannot use keyword 'await' outside an async function");
}
this.raiseRecoverable(start, "The keyword '" + name + "' is reserved");
}
};
// Parse the next token as an identifier. If `liberal` is true (used
// when parsing properties), it will also convert keywords into
// identifiers.
pp$5.parseIdent = function (liberal) {
var node = this.parseIdentNode();
this.next(!!liberal);
this.finishNode(node, "Identifier");
if (!liberal) {
this.checkUnreserved(node);
if (node.name === "await" && !this.awaitIdentPos) {
this.awaitIdentPos = node.start;
}
}
return node;
};
pp$5.parseIdentNode = function () {
var node = this.startNode();
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
// `class` and `function` keywords push new context into this.context.
// But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.
// If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword
if ((node.name === "class" || node.name === "function") && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
this.context.pop();
}
this.type = types$1.name;
} else {
this.unexpected();
}
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.options.checkPrivateFields) {
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$5.parseYield = function (forInit) {
if (!this.yieldPos) {
this.yieldPos = this.start;
}
var node = this.startNode();
this.next();
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$1.star);
node.argument = this.parseMaybeAssign(forInit);
}
return this.finishNode(node, "YieldExpression");
};
pp$5.parseAwait = function (forInit) {
if (!this.awaitPos) {
this.awaitPos = this.start;
}
var node = this.startNode();
this.next();
node.argument = this.parseMaybeUnary(null, true, false, forInit);
return this.finishNode(node, "AwaitExpression");
};
var pp$4 = Parser$1.prototype;
// This function is used to raise exceptions on parse errors. It
// takes an offset integer (into the current `input`) to indicate
// the location of the error, attaches the position to the end
// of the error message, and then raises a `SyntaxError` with that
// message.
pp$4.raise = function (pos, message) {
var loc = getLineInfo(this.input, pos);
message += " (" + loc.line + ":" + loc.column + ")";
var err = new SyntaxError(message);
err.pos = pos;
err.loc = loc;
err.raisedAt = this.pos;
throw err;
};
pp$4.raiseRecoverable = pp$4.raise;
pp$4.curPosition = function () {
if (this.options.locations) {
return new Position(this.curLine, this.pos - this.lineStart);
}
};
var pp$3 = Parser$1.prototype;
var Scope$2 = function Scope(flags) {
this.flags = flags;
// A list of var-declared names in the current lexical scope
this.var = [];
// A list of lexically-declared names in the current lexical scope
this.lexical = [];
// A list of lexically-declared FunctionDeclaration names in the current lexical scope
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$3.enterScope = function (flags) {
this.scopeStack.push(new Scope$2(flags));
};
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$3.treatFunctionsAsVarInScope = function (scope) {
return _flagsInstanceProperty(scope) & SCOPE_FUNCTION || !this.inModule && _flagsInstanceProperty(scope) & SCOPE_TOP;
};
pp$3.declareName = function (name, bindingType, pos) {
var redeclared = false;
if (bindingType === BIND_LEXICAL) {
var _context18, _context19, _context20;
var scope = this.currentScope();
redeclared = _indexOfInstanceProperty(_context18 = scope.lexical).call(_context18, name) > -1 || _indexOfInstanceProperty(_context19 = scope.functions).call(_context19, name) > -1 || _indexOfInstanceProperty(_context20 = scope.var).call(_context20, name) > -1;
scope.lexical.push(name);
if (this.inModule && _flagsInstanceProperty(scope) & SCOPE_TOP) {
delete this.undefinedExports[name];
}
} else if (bindingType === BIND_SIMPLE_CATCH) {
var scope$1 = this.currentScope();
scope$1.lexical.push(name);
} else if (bindingType === BIND_FUNCTION) {
var scope$2 = this.currentScope();
if (this.treatFunctionsAsVar) {
var _context21;
redeclared = _indexOfInstanceProperty(_context21 = scope$2.lexical).call(_context21, name) > -1;
} else {
var _context22, _context23;
redeclared = _indexOfInstanceProperty(_context22 = scope$2.lexical).call(_context22, name) > -1 || _indexOfInstanceProperty(_context23 = scope$2.var).call(_context23, name) > -1;
}
scope$2.functions.push(name);
} else {
for (var i = this.scopeStack.length - 1; i >= 0; --i) {
var _context24, _context25;
var scope$3 = this.scopeStack[i];
if (_indexOfInstanceProperty(_context24 = scope$3.lexical).call(_context24, name) > -1 && !(_flagsInstanceProperty(scope$3) & SCOPE_SIMPLE_CATCH && scope$3.lexical[0] === name) || !this.treatFunctionsAsVarInScope(scope$3) && _indexOfInstanceProperty(_context25 = scope$3.functions).call(_context25, name) > -1) {
redeclared = true;
break;
}
scope$3.var.push(name);
if (this.inModule && _flagsInstanceProperty(scope$3) & SCOPE_TOP) {
delete this.undefinedExports[name];
}
if (_flagsInstanceProperty(scope$3) & SCOPE_VAR) {
break;
}
}
}
if (redeclared) {
this.raiseRecoverable(pos, "Identifier '" + name + "' has already been declared");
}
};
pp$3.checkLocalExport = function (id) {
var _context26, _context27;
// scope.functions must be empty as Module code is always strict.
if (_indexOfInstanceProperty(_context26 = this.scopeStack[0].lexical).call(_context26, id.name) === -1 && _indexOfInstanceProperty(_context27 = this.scopeStack[0].var).call(_context27, id.name) === -1) {
this.undefinedExports[id.name] = id;
}
};
pp$3.currentScope = function () {
return this.scopeStack[this.scopeStack.length - 1];
};
pp$3.currentVarScope = function () {
for (var i = this.scopeStack.length - 1;; i--) {
var scope = this.scopeStack[i];
if (_flagsInstanceProperty(scope) & SCOPE_VAR) {
return scope;
}
}
};
// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.
pp$3.currentThisScope = function () {
for (var i = this.scopeStack.length - 1;; i--) {
var scope = this.scopeStack[i];
if (_flagsInstanceProperty(scope) & SCOPE_VAR && !(_flagsInstanceProperty(scope) & SCOPE_ARROW)) {
return scope;
}
}
};
var Node = function Node(parser, pos, loc) {
this.type = "";
this.start = pos;
this.end = 0;
if (parser.options.locations) {
this.loc = new SourceLocation(parser, loc);
}
if (parser.options.directSourceFile) {
this.sourceFile = parser.options.directSourceFile;
}
if (parser.options.ranges) {
this.range = [pos, 0];
}
};
// Start an AST node, attaching a start offset.
var pp$2 = Parser$1.prototype;
pp$2.startNode = function () {
return new Node(this, this.start, this.startLoc);
};
pp$2.startNodeAt = function (pos, loc) {
return new Node(this, pos, loc);
};
// Finish an AST node, adding `type` and `end` properties.
function finishNodeAt(node, type, pos, loc) {
node.type = type;
node.end = pos;
if (this.options.locations) {
node.loc.end = loc;
}
if (this.options.ranges) {
node.range[1] = pos;
}
return node;
}
pp$2.finishNode = function (node, type) {
return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc);
};
// Finish node at given position
pp$2.finishNodeAt = function (node, type, pos, loc) {
return finishNodeAt.call(this, node, type, pos, loc);
};
pp$2.copyNode = function (node) {
var newNode = new Node(this, node.start, this.startLoc);
for (var prop in node) {
newNode[prop] = node[prop];
}
return newNode;
};
// This file was generated by "bin/generate-unicode-script-values.js". Do not modify manually!
var scriptValuesAddedInUnicode = "Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz";
// 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)
// #table-binary-unicode-properties
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 ecma13BinaryProperties = ecma12BinaryProperties;
var ecma14BinaryProperties = ecma13BinaryProperties;
var unicodeBinaryProperties = {
9: ecma9BinaryProperties,
10: ecma10BinaryProperties,
11: ecma11BinaryProperties,
12: ecma12BinaryProperties,
13: ecma13BinaryProperties,
14: ecma14BinaryProperties
};
// #table-binary-unicode-properties-of-strings
var ecma14BinaryPropertiesOfStrings = "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji";
var unicodeBinaryPropertiesOfStrings = {
9: "",
10: "",
11: "",
12: "",
13: "",
14: ecma14BinaryPropertiesOfStrings
};
// #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
var ecma9ScriptValues = "Adlam Adlm 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 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 ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith";
var ecma14ScriptValues = ecma13ScriptValues + " " + scriptValuesAddedInUnicode;
var unicodeScriptValues = {
9: ecma9ScriptValues,
10: ecma10ScriptValues,
11: ecma11ScriptValues,
12: ecma12ScriptValues,
13: ecma13ScriptValues,
14: ecma14ScriptValues
};
var data = {};
function buildUnicodeData(ecmaVersion) {
var d = data[ecmaVersion] = {
binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues),
binaryOfStrings: wordsRegexp(unicodeBinaryPropertiesOfStrings[ecmaVersion]),
nonBinary: {
General_Category: wordsRegexp(unicodeGeneralCategoryValues),
Script: wordsRegexp(unicodeScriptValues[ecmaVersion])
}
};
d.nonBinary.Script_Extensions = d.nonBinary.Script;
d.nonBinary.gc = d.nonBinary.General_Category;
d.nonBinary.sc = d.nonBinary.Script;
d.nonBinary.scx = d.nonBinary.Script_Extensions;
}
for (var i = 0, list = [9, 10, 11, 12, 13, 14]; i < list.length; i += 1) {
var ecmaVersion = list[i];
buildUnicodeData(ecmaVersion);
}
var pp$1 = Parser$1.prototype;
// Track disjunction structure to determine whether a duplicate
// capture group name is allowed because it is in a separate branch.
var BranchID = function BranchID(parent, base) {
// Parent disjunction branch
this.parent = parent;
// Identifies this set of sibling branches
this.base = base || this;
};
BranchID.prototype.separatedFrom = function separatedFrom(alt) {
// A branch is separate from another branch if they or any of
// their parents are siblings in a given disjunction
for (var self = this; self; self = self.parent) {
for (var other = alt; other; other = other.parent) {
if (self.base === other.base && self !== other) {
return true;
}
}
}
return false;
};
BranchID.prototype.sibling = function sibling() {
return new BranchID(this.parent, this.base);
};
var RegExpValidationState = function RegExpValidationState(parser) {
this.parser = parser;
this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "") + (parser.options.ecmaVersion >= 15 ? "v" : "");
this.unicodeProperties = data[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion];
this.source = "";
this.flags = "";
this.start = 0;
this.switchU = false;
this.switchV = false;
this.switchN = false;
this.pos = 0;
this.lastIntValue = 0;
this.lastStringValue = "";
this.lastAssertionIsQuantifiable = false;
this.numCapturingParens = 0;
this.maxBackReference = 0;
this.groupNames = _Object$create(null);
this.backReferenceNames = [];
this.branchID = null;
};
RegExpValidationState.prototype.reset = function reset(start, pattern, flags) {
var unicodeSets = _indexOfInstanceProperty(flags).call(flags, "v") !== -1;
var unicode = _indexOfInstanceProperty(flags).call(flags, "u") !== -1;
this.start = start | 0;
this.source = pattern + "";
this.flags = flags;
if (unicodeSets && this.parser.options.ecmaVersion >= 15) {
this.switchU = true;
this.switchV = true;
this.switchN = true;
} else {
this.switchU = unicode && this.parser.options.ecmaVersion >= 6;
this.switchV = false;
this.switchN = unicode && this.parser.options.ecmaVersion >= 9;
}
};
RegExpValidationState.prototype.raise = function raise(message) {
this.parser.raiseRecoverable(this.start, "Invalid regular expression: /" + this.source + "/: " + message);
};
// If u flag is given, this returns the code point at the index (it combines a surrogate pair).
// Otherwise, this returns the code unit of the index (can be a part of a surrogate pair).
RegExpValidationState.prototype.at = function at(i, forceU) {
if (forceU === undefined) forceU = false;
var s = this.source;
var l = s.length;
if (i >= l) {
return -1;
}
var c = s.charCodeAt(i);
if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {
return c;
}
var next = s.charCodeAt(i + 1);
return next >= 0xDC00 && next <= 0xDFFF ? (c << 10) + next - 0x35FDC00 : c;
};
RegExpValidationState.prototype.nextIndex = function nextIndex(i, forceU) {
if (forceU === undefined) forceU = false;
var s = this.source;
var l = s.length;
if (i >= l) {
return l;
}
var c = s.charCodeAt(i),
next;
if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l || (next = s.charCodeAt(i + 1)) < 0xDC00 || next > 0xDFFF) {
return i + 1;
}
return i + 2;
};
RegExpValidationState.prototype.current = function current(forceU) {
var _context28;
if (forceU === undefined) forceU = false;
return _atInstanceProperty(_context28 = this).call(_context28, this.pos, forceU);
};
RegExpValidationState.prototype.lookahead = function lookahead(forceU) {
var _context29;
if (forceU === undefined) forceU = false;
return _atInstanceProperty(_context29 = this).call(_context29, this.nextIndex(this.pos, forceU), forceU);
};
RegExpValidationState.prototype.advance = function advance(forceU) {
if (forceU === undefined) forceU = false;
this.pos = this.nextIndex(this.pos, forceU);
};
RegExpValidationState.prototype.eat = function eat(ch, forceU) {
if (forceU === undefined) forceU = false;
if (this.current(forceU) === ch) {
this.advance(forceU);
return true;
}
return false;
};
RegExpValidationState.prototype.eatChars = function eatChars(chs, forceU) {
if (forceU === undefined) forceU = false;
var pos = this.pos;
for (var i = 0, list = chs; i < list.length; i += 1) {
var _context30;
var ch = list[i];
var current = _atInstanceProperty(_context30 = this).call(_context30, pos, forceU);
if (current === -1 || current !== ch) {
return false;
}
pos = this.nextIndex(pos, forceU);
}
this.pos = pos;
return true;
};
/**
* Validate the flags part of a given RegExpLiteral.
*
* @param {RegExpValidationState} state The state to validate RegExp.
* @returns {void}
*/
pp$1.validateRegExpFlags = function (state) {
var validFlags = state.validFlags;
var flags = _flagsInstanceProperty(state);
var u = false;
var v = false;
for (var i = 0; i < flags.length; i++) {
var flag = flags.charAt(i);
if (_indexOfInstanceProperty(validFlags).call(validFlags, flag) === -1) {
this.raise(state.start, "Invalid regular expression flag");
}
if (_indexOfInstanceProperty(flags).call(flags, flag, i + 1) > -1) {
this.raise(state.start, "Duplicate regular expression flag");
}
if (flag === "u") {
u = true;
}
if (flag === "v") {
v = true;
}
}
if (this.options.ecmaVersion >= 15 && u && v) {
this.raise(state.start, "Invalid regular expression flag");
}
};
function hasProp(obj) {
for (var _ in obj) {
return true;
}
return false;
}
/**
* Validate the pattern part of a given RegExpLiteral.
*
* @param {RegExpValidationState} state The state to validate RegExp.
* @returns {void}
*/
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*
// exception if _P_ did not conform to the grammar, if any elements of _P_
// were not matched by the parse, or if any Early Error conditions exist.
if (!state.switchN && this.options.ecmaVersion >= 9 && hasProp(state.groupNames)) {
state.switchN = true;
this.regexp_pattern(state);
}
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern
pp$1.regexp_pattern = function (state) {
state.pos = 0;
state.lastIntValue = 0;
state.lastStringValue = "";
state.lastAssertionIsQuantifiable = false;
state.numCapturingParens = 0;
state.maxBackReference = 0;
state.groupNames = _Object$create(null);
state.backReferenceNames.length = 0;
state.branchID = null;
this.regexp_disjunction(state);
if (state.pos !== state.source.length) {
// Make the same messages as V8.
if (state.eat(0x29 /* ) */)) {
state.raise("Unmatched ')'");
}
if (state.eat(0x5D /* ] */) || state.eat(0x7D /* } */)) {
state.raise("Lone quantifier brackets");
}
}
if (state.maxBackReference > state.numCapturingParens) {
state.raise("Invalid escape");
}
for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) {
var name = list[i];
if (!state.groupNames[name]) {
state.raise("Invalid named capture referenced");
}
}
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction
pp$1.regexp_disjunction = function (state) {
var trackDisjunction = this.options.ecmaVersion >= 16;
if (trackDisjunction) {
state.branchID = new BranchID(state.branchID, null);
}
this.regexp_alternative(state);
while (state.eat(0x7C /* | */)) {
if (trackDisjunction) {
state.branchID = state.branchID.sibling();
}
this.regexp_alternative(state);
}
if (trackDisjunction) {
state.branchID = state.branchID.parent;
}
// Make the same message as V8.
if (this.regexp_eatQuantifier(state, true)) {
state.raise("Nothing to repeat");
}
if (state.eat(0x7B /* { */)) {
state.raise("Lone quantifier brackets");
}
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative
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$1.regexp_eatTerm = function (state) {
if (this.regexp_eatAssertion(state)) {
// Handle `QuantifiableAssertion Quantifier` alternative.
// `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion
// is a QuantifiableAssertion.
if (state.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state)) {
// Make the same message as V8.
if (state.switchU) {
state.raise("Invalid quantifier");
}
}
return true;
}
if (state.switchU ? this.regexp_eatAtom(state) : this.regexp_eatExtendedAtom(state)) {
this.regexp_eatQuantifier(state);
return true;
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion
pp$1.regexp_eatAssertion = function (state) {
var start = state.pos;
state.lastAssertionIsQuantifiable = false;
// ^, $
if (state.eat(0x5E /* ^ */) || state.eat(0x24 /* $ */)) {
return true;
}
// \b \B
if (state.eat(0x5C /* \ */)) {
if (state.eat(0x42 /* B */) || state.eat(0x62 /* b */)) {
return true;
}
state.pos = start;
}
// Lookahead / Lookbehind
if (state.eat(0x28 /* ( */) && state.eat(0x3F /* ? */)) {
var lookbehind = false;
if (this.options.ecmaVersion >= 9) {
lookbehind = state.eat(0x3C /* < */);
}
if (state.eat(0x3D /* = */) || state.eat(0x21 /* ! */)) {
this.regexp_disjunction(state);
if (!state.eat(0x29 /* ) */)) {
state.raise("Unterminated group");
}
state.lastAssertionIsQuantifiable = !lookbehind;
return true;
}
}
state.pos = start;
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier
pp$1.regexp_eatQuantifier = function (state, noError) {
if (noError === undefined) noError = false;
if (this.regexp_eatQuantifierPrefix(state, noError)) {
state.eat(0x3F /* ? */);
return true;
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix
pp$1.regexp_eatQuantifierPrefix = function (state, noError) {
return state.eat(0x2A /* * */) || state.eat(0x2B /* + */) || state.eat(0x3F /* ? */) || this.regexp_eatBracedQuantifier(state, noError);
};
pp$1.regexp_eatBracedQuantifier = function (state, noError) {
var start = state.pos;
if (state.eat(0x7B /* { */)) {
var min = 0,
max = -1;
if (this.regexp_eatDecimalDigits(state)) {
min = state.lastIntValue;
if (state.eat(0x2C /* , */) && this.regexp_eatDecimalDigits(state)) {
max = state.lastIntValue;
}
if (state.eat(0x7D /* } */)) {
// SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-term
if (max !== -1 && max < min && !noError) {
state.raise("numbers out of order in {} quantifier");
}
return true;
}
}
if (state.switchU && !noError) {
state.raise("Incomplete quantifier");
}
state.pos = start;
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-Atom
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$1.regexp_eatReverseSolidusAtomEscape = function (state) {
var start = state.pos;
if (state.eat(0x5C /* \ */)) {
if (this.regexp_eatAtomEscape(state)) {
return true;
}
state.pos = start;
}
return false;
};
pp$1.regexp_eatUncapturingGroup = function (state) {
var start = state.pos;
if (state.eat(0x28 /* ( */)) {
if (state.eat(0x3F /* ? */)) {
if (this.options.ecmaVersion >= 16) {
var addModifiers = this.regexp_eatModifiers(state);
var hasHyphen = state.eat(0x2D /* - */);
if (addModifiers || hasHyphen) {
for (var i = 0; i < addModifiers.length; i++) {
var modifier = addModifiers.charAt(i);
if (_indexOfInstanceProperty(addModifiers).call(addModifiers, modifier, i + 1) > -1) {
state.raise("Duplicate regular expression modifiers");
}
}
if (hasHyphen) {
var removeModifiers = this.regexp_eatModifiers(state);
if (!addModifiers && !removeModifiers && state.current() === 0x3A /* : */) {
state.raise("Invalid regular expression modifiers");
}
for (var i$1 = 0; i$1 < removeModifiers.length; i$1++) {
var modifier$1 = removeModifiers.charAt(i$1);
if (_indexOfInstanceProperty(removeModifiers).call(removeModifiers, modifier$1, i$1 + 1) > -1 || _indexOfInstanceProperty(addModifiers).call(addModifiers, modifier$1) > -1) {
state.raise("Duplicate regular expression modifiers");
}
}
}
}
}
if (state.eat(0x3A /* : */)) {
this.regexp_disjunction(state);
if (state.eat(0x29 /* ) */)) {
return true;
}
state.raise("Unterminated group");
}
}
state.pos = start;
}
return false;
};
pp$1.regexp_eatCapturingGroup = function (state) {
if (state.eat(0x28 /* ( */)) {
if (this.options.ecmaVersion >= 9) {
this.regexp_groupSpecifier(state);
} else if (state.current() === 0x3F /* ? */) {
state.raise("Invalid group");
}
this.regexp_disjunction(state);
if (state.eat(0x29 /* ) */)) {
state.numCapturingParens += 1;
return true;
}
state.raise("Unterminated group");
}
return false;
};
// RegularExpressionModifiers ::
// [empty]
// RegularExpressionModifiers RegularExpressionModifier
pp$1.regexp_eatModifiers = function (state) {
var modifiers = "";
var ch = 0;
while ((ch = state.current()) !== -1 && isRegularExpressionModifier(ch)) {
modifiers += codePointToString(ch);
state.advance();
}
return modifiers;
};
// RegularExpressionModifier :: one of
// `i` `m` `s`
function isRegularExpressionModifier(ch) {
return ch === 0x69 /* i */ || ch === 0x6d /* m */ || ch === 0x73; /* s */
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom
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$1.regexp_eatInvalidBracedQuantifier = function (state) {
if (this.regexp_eatBracedQuantifier(state, true)) {
state.raise("Nothing to repeat");
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter
pp$1.regexp_eatSyntaxCharacter = function (state) {
var ch = state.current();
if (isSyntaxCharacter(ch)) {
state.lastIntValue = ch;
state.advance();
return true;
}
return false;
};
function isSyntaxCharacter(ch) {
return ch === 0x24 /* $ */ || ch >= 0x28 /* ( */ && ch <= 0x2B /* + */ || ch === 0x2E /* . */ || ch === 0x3F /* ? */ || ch >= 0x5B /* [ */ && ch <= 0x5E /* ^ */ || ch >= 0x7B /* { */ && ch <= 0x7D /* } */;
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter
// But eat eager.
pp$1.regexp_eatPatternCharacters = function (state) {
var start = state.pos;
var ch = 0;
while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {
state.advance();
}
return state.pos !== start;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter
pp$1.regexp_eatExtendedPatternCharacter = function (state) {
var ch = state.current();
if (ch !== -1 && ch !== 0x24 /* $ */ && !(ch >= 0x28 /* ( */ && ch <= 0x2B /* + */) && ch !== 0x2E /* . */ && ch !== 0x3F /* ? */ && ch !== 0x5B /* [ */ && ch !== 0x5E /* ^ */ && ch !== 0x7C /* | */) {
state.advance();
return true;
}
return false;
};
// GroupSpecifier ::
// [empty]
// `?` GroupName
pp$1.regexp_groupSpecifier = function (state) {
if (state.eat(0x3F /* ? */)) {
if (!this.regexp_eatGroupName(state)) {
state.raise("Invalid group");
}
var trackDisjunction = this.options.ecmaVersion >= 16;
var known = state.groupNames[state.lastStringValue];
if (known) {
if (trackDisjunction) {
for (var i = 0, list = known; i < list.length; i += 1) {
var altID = list[i];
if (!altID.separatedFrom(state.branchID)) {
state.raise("Duplicate capture group name");
}
}
} else {
state.raise("Duplicate capture group name");
}
}
if (trackDisjunction) {
(known || (state.groupNames[state.lastStringValue] = [])).push(state.branchID);
} else {
state.groupNames[state.lastStringValue] = true;
}
}
};
// GroupName ::
// `<` RegExpIdentifierName `>`
// Note: this updates `state.lastStringValue` property with the eaten name.
pp$1.regexp_eatGroupName = function (state) {
state.lastStringValue = "";
if (state.eat(0x3C /* < */)) {
if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {
return true;
}
state.raise("Invalid capture group name");
}
return false;
};
// RegExpIdentifierName ::
// RegExpIdentifierStart
// RegExpIdentifierName RegExpIdentifierPart
// Note: this updates `state.lastStringValue` property with the eaten name.
pp$1.regexp_eatRegExpIdentifierName = function (state) {
state.lastStringValue = "";
if (this.regexp_eatRegExpIdentifierStart(state)) {
state.lastStringValue += codePointToString(state.lastIntValue);
while (this.regexp_eatRegExpIdentifierPart(state)) {
state.lastStringValue += codePointToString(state.lastIntValue);
}
return true;
}
return false;
};
// RegExpIdentifierStart ::
// UnicodeIDStart
// `$`
// `_`
// `\` RegExpUnicodeEscapeSequence[+U]
pp$1.regexp_eatRegExpIdentifierStart = function (state) {
var start = state.pos;
var forceU = this.options.ecmaVersion >= 11;
var ch = state.current(forceU);
state.advance(forceU);
if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {
ch = state.lastIntValue;
}
if (isRegExpIdentifierStart(ch)) {
state.lastIntValue = ch;
return true;
}
state.pos = start;
return false;
};
function isRegExpIdentifierStart(ch) {
return isIdentifierStart(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F; /* _ */
}
// RegExpIdentifierPart ::
// UnicodeIDContinue
// `$`
// `_`
// `\` RegExpUnicodeEscapeSequence[+U]
// <ZWNJ>
// <ZWJ>
pp$1.regexp_eatRegExpIdentifierPart = function (state) {
var start = state.pos;
var forceU = this.options.ecmaVersion >= 11;
var ch = state.current(forceU);
state.advance(forceU);
if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {
ch = state.lastIntValue;
}
if (isRegExpIdentifierPart(ch)) {
state.lastIntValue = ch;
return true;
}
state.pos = start;
return false;
};
function isRegExpIdentifierPart(ch) {
return isIdentifierChar(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */ || ch === 0x200C /* <ZWNJ> */ || ch === 0x200D; /* <ZWJ> */
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape
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;
}
if (state.switchU) {
// Make the same message as V8.
if (state.current() === 0x63 /* c */) {
state.raise("Invalid unicode escape");
}
state.raise("Invalid escape");
}
return false;
};
pp$1.regexp_eatBackReference = function (state) {
var start = state.pos;
if (this.regexp_eatDecimalEscape(state)) {
var n = state.lastIntValue;
if (state.switchU) {
// For SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-atomescape
if (n > state.maxBackReference) {
state.maxBackReference = n;
}
return true;
}
if (n <= state.numCapturingParens) {
return true;
}
state.pos = start;
}
return false;
};
pp$1.regexp_eatKGroupName = function (state) {
if (state.eat(0x6B /* k */)) {
if (this.regexp_eatGroupName(state)) {
state.backReferenceNames.push(state.lastStringValue);
return true;
}
state.raise("Invalid named reference");
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape
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$1.regexp_eatCControlLetter = function (state) {
var start = state.pos;
if (state.eat(0x63 /* c */)) {
if (this.regexp_eatControlLetter(state)) {
return true;
}
state.pos = start;
}
return false;
};
pp$1.regexp_eatZero = function (state) {
if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {
state.lastIntValue = 0;
state.advance();
return true;
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape
pp$1.regexp_eatControlEscape = function (state) {
var ch = state.current();
if (ch === 0x74 /* t */) {
state.lastIntValue = 0x09; /* \t */
state.advance();
return true;
}
if (ch === 0x6E /* n */) {
state.lastIntValue = 0x0A; /* \n */
state.advance();
return true;
}
if (ch === 0x76 /* v */) {
state.lastIntValue = 0x0B; /* \v */
state.advance();
return true;
}
if (ch === 0x66 /* f */) {
state.lastIntValue = 0x0C; /* \f */
state.advance();
return true;
}
if (ch === 0x72 /* r */) {
state.lastIntValue = 0x0D; /* \r */
state.advance();
return true;
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter
pp$1.regexp_eatControlLetter = function (state) {
var ch = state.current();
if (isControlLetter(ch)) {
state.lastIntValue = ch % 0x20;
state.advance();
return true;
}
return false;
};
function isControlLetter(ch) {
return ch >= 0x41 /* A */ && ch <= 0x5A /* Z */ || ch >= 0x61 /* a */ && ch <= 0x7A /* z */;
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
pp$1.regexp_eatRegExpUnicodeEscapeSequence = function (state, forceU) {
if (forceU === undefined) forceU = false;
var start = state.pos;
var switchU = forceU || state.switchU;
if (state.eat(0x75 /* u */)) {
if (this.regexp_eatFixedHexDigits(state, 4)) {
var lead = state.lastIntValue;
if (switchU && lead >= 0xD800 && lead <= 0xDBFF) {
var leadSurrogateEnd = state.pos;
if (state.eat(0x5C /* \ */) && state.eat(0x75 /* u */) && this.regexp_eatFixedHexDigits(state, 4)) {
var trail = state.lastIntValue;
if (trail >= 0xDC00 && trail <= 0xDFFF) {
state.lastIntValue = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
return true;
}
}
state.pos = leadSurrogateEnd;
state.lastIntValue = lead;
}
return true;
}
if (switchU && state.eat(0x7B /* { */) && this.regexp_eatHexDigits(state) && state.eat(0x7D /* } */) && isValidUnicode(state.lastIntValue)) {
return true;
}
if (switchU) {
state.raise("Invalid unicode escape");
}
state.pos = start;
}
return false;
};
function isValidUnicode(ch) {
return ch >= 0 && ch <= 0x10FFFF;
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape
pp$1.regexp_eatIdentityEscape = function (state) {
if (state.switchU) {
if (this.regexp_eatSyntaxCharacter(state)) {
return true;
}
if (state.eat(0x2F /* / */)) {
state.lastIntValue = 0x2F; /* / */
return true;
}
return false;
}
var ch = state.current();
if (ch !== 0x63 /* c */ && (!state.switchN || ch !== 0x6B /* k */)) {
state.lastIntValue = ch;
state.advance();
return true;
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape
pp$1.regexp_eatDecimalEscape = function (state) {
state.lastIntValue = 0;
var ch = state.current();
if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {
do {
state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);
state.advance();
} while ((ch = state.current()) >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */);
return true;
}
return false;
};
// Return values used by character set parsing methods, needed to
// forbid negation of sets that can match strings.
var CharSetNone = 0; // Nothing parsed
var CharSetOk = 1; // Construct parsed, cannot contain strings
var CharSetString = 2; // Construct parsed, can contain strings
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
pp$1.regexp_eatCharacterClassEscape = function (state) {
var ch = state.current();
if (isCharacterClassEscape(ch)) {
state.lastIntValue = -1;
state.advance();
return CharSetOk;
}
var negate = false;
if (state.switchU && this.options.ecmaVersion >= 9 && ((negate = ch === 0x50 /* P */) || ch === 0x70 /* p */)) {
state.lastIntValue = -1;
state.advance();
var result;
if (state.eat(0x7B /* { */) && (result = this.regexp_eatUnicodePropertyValueExpression(state)) && state.eat(0x7D /* } */)) {
if (negate && result === CharSetString) {
state.raise("Invalid property name");
}
return result;
}
state.raise("Invalid property name");
}
return CharSetNone;
};
function isCharacterClassEscape(ch) {
return ch === 0x64 /* d */ || ch === 0x44 /* D */ || ch === 0x73 /* s */ || ch === 0x53 /* S */ || ch === 0x77 /* w */ || ch === 0x57 /* W */;
}
// UnicodePropertyValueExpression ::
// UnicodePropertyName `=` UnicodePropertyValue
// LoneUnicodePropertyNameOrValue
pp$1.regexp_eatUnicodePropertyValueExpression = function (state) {
var start = state.pos;
// UnicodePropertyName `=` UnicodePropertyValue
if (this.regexp_eatUnicodePropertyName(state) && state.eat(0x3D /* = */)) {
var name = state.lastStringValue;
if (this.regexp_eatUnicodePropertyValue(state)) {
var value = state.lastStringValue;
this.regexp_validateUnicodePropertyNameAndValue(state, name, value);
return CharSetOk;
}
}
state.pos = start;
// LoneUnicodePropertyNameOrValue
if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) {
var nameOrValue = state.lastStringValue;
return this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue);
}
return CharSetNone;
};
pp$1.regexp_validateUnicodePropertyNameAndValue = function (state, name, value) {
if (!hasOwn(state.unicodeProperties.nonBinary, name)) {
state.raise("Invalid property name");
}
if (!state.unicodeProperties.nonBinary[name].test(value)) {
state.raise("Invalid property value");
}
};
pp$1.regexp_validateUnicodePropertyNameOrValue = function (state, nameOrValue) {
if (state.unicodeProperties.binary.test(nameOrValue)) {
return CharSetOk;
}
if (state.switchV && state.unicodeProperties.binaryOfStrings.test(nameOrValue)) {
return CharSetString;
}
state.raise("Invalid property name");
};
// UnicodePropertyName ::
// UnicodePropertyNameCharacters
pp$1.regexp_eatUnicodePropertyName = function (state) {
var ch = 0;
state.lastStringValue = "";
while (isUnicodePropertyNameCharacter(ch = state.current())) {
state.lastStringValue += codePointToString(ch);
state.advance();
}
return state.lastStringValue !== "";
};
function isUnicodePropertyNameCharacter(ch) {
return isControlLetter(ch) || ch === 0x5F; /* _ */
}
// UnicodePropertyValue ::
// UnicodePropertyValueCharacters
pp$1.regexp_eatUnicodePropertyValue = function (state) {
var ch = 0;
state.lastStringValue = "";
while (isUnicodePropertyValueCharacter(ch = state.current())) {
state.lastStringValue += codePointToString(ch);
state.advance();
}
return state.lastStringValue !== "";
};
function isUnicodePropertyValueCharacter(ch) {
return isUnicodePropertyNameCharacter(ch) || isDecimalDigit(ch);
}
// LoneUnicodePropertyNameOrValue ::
// UnicodePropertyValueCharacters
pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function (state) {
return this.regexp_eatUnicodePropertyValue(state);
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
pp$1.regexp_eatCharacterClass = function (state) {
if (state.eat(0x5B /* [ */)) {
var negate = state.eat(0x5E /* ^ */);
var result = this.regexp_classContents(state);
if (!state.eat(0x5D /* ] */)) {
state.raise("Unterminated character class");
}
if (negate && result === CharSetString) {
state.raise("Negated character class may contain strings");
}
return true;
}
return false;
};
// https://tc39.es/ecma262/#prod-ClassContents
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
pp$1.regexp_classContents = function (state) {
if (state.current() === 0x5D /* ] */) {
return CharSetOk;
}
if (state.switchV) {
return this.regexp_classSetExpression(state);
}
this.regexp_nonEmptyClassRanges(state);
return CharSetOk;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
pp$1.regexp_nonEmptyClassRanges = function (state) {
while (this.regexp_eatClassAtom(state)) {
var left = state.lastIntValue;
if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
var right = state.lastIntValue;
if (state.switchU && (left === -1 || right === -1)) {
state.raise("Invalid character class");
}
if (left !== -1 && right !== -1 && left > right) {
state.raise("Range out of order in character class");
}
}
}
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash
pp$1.regexp_eatClassAtom = function (state) {
var start = state.pos;
if (state.eat(0x5C /* \ */)) {
if (this.regexp_eatClassEscape(state)) {
return true;
}
if (state.switchU) {
// Make the same message as V8.
var ch$1 = state.current();
if (ch$1 === 0x63 /* c */ || isOctalDigit(ch$1)) {
state.raise("Invalid class escape");
}
state.raise("Invalid escape");
}
state.pos = start;
}
var ch = state.current();
if (ch !== 0x5D /* ] */) {
state.lastIntValue = ch;
state.advance();
return true;
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape
pp$1.regexp_eatClassEscape = function (state) {
var start = state.pos;
if (state.eat(0x62 /* b */)) {
state.lastIntValue = 0x08; /* <BS> */
return true;
}
if (state.switchU && state.eat(0x2D /* - */)) {
state.lastIntValue = 0x2D; /* - */
return true;
}
if (!state.switchU && state.eat(0x63 /* c */)) {
if (this.regexp_eatClassControlLetter(state)) {
return true;
}
state.pos = start;
}
return this.regexp_eatCharacterClassEscape(state) || this.regexp_eatCharacterEscape(state);
};
// https://tc39.es/ecma262/#prod-ClassSetExpression
// https://tc39.es/ecma262/#prod-ClassUnion
// https://tc39.es/ecma262/#prod-ClassIntersection
// https://tc39.es/ecma262/#prod-ClassSubtraction
pp$1.regexp_classSetExpression = function (state) {
var result = CharSetOk,
subResult;
if (this.regexp_eatClassSetRange(state)) ;else if (subResult = this.regexp_eatClassSetOperand(state)) {
if (subResult === CharSetString) {
result = CharSetString;
}
// https://tc39.es/ecma262/#prod-ClassIntersection
var start = state.pos;
while (state.eatChars([0x26, 0x26] /* && */)) {
if (state.current() !== 0x26 /* & */ && (subResult = this.regexp_eatClassSetOperand(state))) {
if (subResult !== CharSetString) {
result = CharSetOk;
}
continue;
}
state.raise("Invalid character in character class");
}
if (start !== state.pos) {
return result;
}
// https://tc39.es/ecma262/#prod-ClassSubtraction
while (state.eatChars([0x2D, 0x2D] /* -- */)) {
if (this.regexp_eatClassSetOperand(state)) {
continue;
}
state.raise("Invalid character in character class");
}
if (start !== state.pos) {
return result;
}
} else {
state.raise("Invalid character in character class");
}
// https://tc39.es/ecma262/#prod-ClassUnion
for (;;) {
if (this.regexp_eatClassSetRange(state)) {
continue;
}
subResult = this.regexp_eatClassSetOperand(state);
if (!subResult) {
return result;
}
if (subResult === CharSetString) {
result = CharSetString;
}
}
};
// https://tc39.es/ecma262/#prod-ClassSetRange
pp$1.regexp_eatClassSetRange = function (state) {
var start = state.pos;
if (this.regexp_eatClassSetCharacter(state)) {
var left = state.lastIntValue;
if (state.eat(0x2D /* - */) && this.regexp_eatClassSetCharacter(state)) {
var right = state.lastIntValue;
if (left !== -1 && right !== -1 && left > right) {
state.raise("Range out of order in character class");
}
return true;
}
state.pos = start;
}
return false;
};
// https://tc39.es/ecma262/#prod-ClassSetOperand
pp$1.regexp_eatClassSetOperand = function (state) {
if (this.regexp_eatClassSetCharacter(state)) {
return CharSetOk;
}
return this.regexp_eatClassStringDisjunction(state) || this.regexp_eatNestedClass(state);
};
// https://tc39.es/ecma262/#prod-NestedClass
pp$1.regexp_eatNestedClass = function (state) {
var start = state.pos;
if (state.eat(0x5B /* [ */)) {
var negate = state.eat(0x5E /* ^ */);
var result = this.regexp_classContents(state);
if (state.eat(0x5D /* ] */)) {
if (negate && result === CharSetString) {
state.raise("Negated character class may contain strings");
}
return result;
}
state.pos = start;
}
if (state.eat(0x5C /* \ */)) {
var result$1 = this.regexp_eatCharacterClassEscape(state);
if (result$1) {
return result$1;
}
state.pos = start;
}
return null;
};
// https://tc39.es/ecma262/#prod-ClassStringDisjunction
pp$1.regexp_eatClassStringDisjunction = function (state) {
var start = state.pos;
if (state.eatChars([0x5C, 0x71] /* \q */)) {
if (state.eat(0x7B /* { */)) {
var result = this.regexp_classStringDisjunctionContents(state);
if (state.eat(0x7D /* } */)) {
return result;
}
} else {
// Make the same message as V8.
state.raise("Invalid escape");
}
state.pos = start;
}
return null;
};
// https://tc39.es/ecma262/#prod-ClassStringDisjunctionContents
pp$1.regexp_classStringDisjunctionContents = function (state) {
var result = this.regexp_classString(state);
while (state.eat(0x7C /* | */)) {
if (this.regexp_classString(state) === CharSetString) {
result = CharSetString;
}
}
return result;
};
// https://tc39.es/ecma262/#prod-ClassString
// https://tc39.es/ecma262/#prod-NonEmptyClassString
pp$1.regexp_classString = function (state) {
var count = 0;
while (this.regexp_eatClassSetCharacter(state)) {
count++;
}
return count === 1 ? CharSetOk : CharSetString;
};
// https://tc39.es/ecma262/#prod-ClassSetCharacter
pp$1.regexp_eatClassSetCharacter = function (state) {
var start = state.pos;
if (state.eat(0x5C /* \ */)) {
if (this.regexp_eatCharacterEscape(state) || this.regexp_eatClassSetReservedPunctuator(state)) {
return true;
}
if (state.eat(0x62 /* b */)) {
state.lastIntValue = 0x08; /* <BS> */
return true;
}
state.pos = start;
return false;
}
var ch = state.current();
if (ch < 0 || ch === state.lookahead() && isClassSetReservedDoublePunctuatorCharacter(ch)) {
return false;
}
if (isClassSetSyntaxCharacter(ch)) {
return false;
}
state.advance();
state.lastIntValue = ch;
return true;
};
// https://tc39.es/ecma262/#prod-ClassSetReservedDoublePunctuator
function isClassSetReservedDoublePunctuatorCharacter(ch) {
return ch === 0x21 /* ! */ || ch >= 0x23 /* # */ && ch <= 0x26 /* & */ || ch >= 0x2A /* * */ && ch <= 0x2C /* , */ || ch === 0x2E /* . */ || ch >= 0x3A /* : */ && ch <= 0x40 /* @ */ || ch === 0x5E /* ^ */ || ch === 0x60 /* ` */ || ch === 0x7E /* ~ */;
}
// https://tc39.es/ecma262/#prod-ClassSetSyntaxCharacter
function isClassSetSyntaxCharacter(ch) {
return ch === 0x28 /* ( */ || ch === 0x29 /* ) */ || ch === 0x2D /* - */ || ch === 0x2F /* / */ || ch >= 0x5B /* [ */ && ch <= 0x5D /* ] */ || ch >= 0x7B /* { */ && ch <= 0x7D /* } */;
}
// https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator
pp$1.regexp_eatClassSetReservedPunctuator = function (state) {
var ch = state.current();
if (isClassSetReservedPunctuator(ch)) {
state.lastIntValue = ch;
state.advance();
return true;
}
return false;
};
// https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator
function isClassSetReservedPunctuator(ch) {
return ch === 0x21 /* ! */ || ch === 0x23 /* # */ || ch === 0x25 /* % */ || ch === 0x26 /* & */ || ch === 0x2C /* , */ || ch === 0x2D /* - */ || ch >= 0x3A /* : */ && ch <= 0x3E /* > */ || ch === 0x40 /* @ */ || ch === 0x60 /* ` */ || ch === 0x7E /* ~ */;
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
pp$1.regexp_eatClassControlLetter = function (state) {
var ch = state.current();
if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {
state.lastIntValue = ch % 0x20;
state.advance();
return true;
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
pp$1.regexp_eatHexEscapeSequence = function (state) {
var start = state.pos;
if (state.eat(0x78 /* x */)) {
if (this.regexp_eatFixedHexDigits(state, 2)) {
return true;
}
if (state.switchU) {
state.raise("Invalid escape");
}
state.pos = start;
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits
pp$1.regexp_eatDecimalDigits = function (state) {
var start = state.pos;
var ch = 0;
state.lastIntValue = 0;
while (isDecimalDigit(ch = state.current())) {
state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);
state.advance();
}
return state.pos !== start;
};
function isDecimalDigit(ch) {
return ch >= 0x30 /* 0 */ && ch <= 0x39; /* 9 */
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits
pp$1.regexp_eatHexDigits = function (state) {
var start = state.pos;
var ch = 0;
state.lastIntValue = 0;
while (isHexDigit(ch = state.current())) {
state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);
state.advance();
}
return state.pos !== start;
};
function isHexDigit(ch) {
return ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */ || ch >= 0x41 /* A */ && ch <= 0x46 /* F */ || ch >= 0x61 /* a */ && ch <= 0x66 /* f */;
}
function hexToInt(ch) {
if (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) {
return 10 + (ch - 0x41 /* A */);
}
if (ch >= 0x61 /* a */ && ch <= 0x66 /* f */) {
return 10 + (ch - 0x61 /* a */);
}
return ch - 0x30; /* 0 */
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence
// Allows only 0-377(octal) i.e. 0-255(decimal).
pp$1.regexp_eatLegacyOctalEscapeSequence = function (state) {
if (this.regexp_eatOctalDigit(state)) {
var n1 = state.lastIntValue;
if (this.regexp_eatOctalDigit(state)) {
var n2 = state.lastIntValue;
if (n1 <= 3 && this.regexp_eatOctalDigit(state)) {
state.lastIntValue = n1 * 64 + n2 * 8 + state.lastIntValue;
} else {
state.lastIntValue = n1 * 8 + n2;
}
} else {
state.lastIntValue = n1;
}
return true;
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit
pp$1.regexp_eatOctalDigit = function (state) {
var ch = state.current();
if (isOctalDigit(ch)) {
state.lastIntValue = ch - 0x30; /* 0 */
state.advance();
return true;
}
state.lastIntValue = 0;
return false;
};
function isOctalDigit(ch) {
return ch >= 0x30 /* 0 */ && ch <= 0x37; /* 7 */
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit
// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
pp$1.regexp_eatFixedHexDigits = function (state, length) {
var start = state.pos;
state.lastIntValue = 0;
for (var i = 0; i < length; ++i) {
var ch = state.current();
if (!isHexDigit(ch)) {
state.pos = start;
return false;
}
state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);
state.advance();
}
return true;
};
// Object type used to represent tokens. Note that normally, tokens
// simply exist as properties on the parser object. This is only
// used for the onToken callback and the external tokenizer.
var Token$1 = function Token(p) {
this.type = p.type;
this.value = p.value;
this.start = p.start;
this.end = p.end;
if (p.options.locations) {
this.loc = new SourceLocation(p, p.startLoc, p.endLoc);
}
if (p.options.ranges) {
this.range = [p.start, p.end];
}
};
// ## Tokenizer
var pp = Parser$1.prototype;
// Move to the next token
pp.next = function (ignoreEscapeSequenceInKeyword) {
if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc) {
this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword);
}
if (this.options.onToken) {
this.options.onToken(new Token$1(this));
}
this.lastTokEnd = this.end;
this.lastTokStart = this.start;
this.lastTokEndLoc = this.endLoc;
this.lastTokStartLoc = this.startLoc;
this.nextToken();
};
pp.getToken = function () {
this.next();
return new Token$1(this);
};
// If we're in an ES6 environment, make parsers iterable
if (typeof _Symbol !== "undefined") {
pp[_Symbol$iterator] = function () {
var this$1$1 = this;
return {
next: function () {
var token = this$1$1.getToken();
return {
done: token.type === types$1.eof,
value: token
};
}
};
};
}
// Toggle strict mode. Re-reads the next number or string to please
// pedantic tests (`"use strict"; 010;` should fail).
// Read a single token, updating the parser object's token-related
// properties.
pp.nextToken = function () {
var curContext = this.curContext();
if (!curContext || !curContext.preserveSpace) {
this.skipSpace();
}
this.start = this.pos;
if (this.options.locations) {
this.startLoc = this.curPosition();
}
if (this.pos >= this.input.length) {
return this.finishToken(types$1.eof);
}
if (curContext.override) {
return curContext.override(this);
} else {
this.readToken(this.fullCharCodeAtPos());
}
};
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 /* '\' */) {
return this.readWord();
}
return this.getTokenFromCode(code);
};
pp.fullCharCodeAtPos = function () {
var code = this.input.charCodeAt(this.pos);
if (code <= 0xd7ff || code >= 0xdc00) {
return code;
}
var next = this.input.charCodeAt(this.pos + 1);
return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00;
};
pp.skipBlockComment = function () {
var _context31;
var startLoc = this.options.onComment && this.curPosition();
var start = this.pos,
end = _indexOfInstanceProperty(_context31 = this.input).call(_context31, "*/", this.pos += 2);
if (end === -1) {
this.raise(this.pos - 2, "Unterminated comment");
}
this.pos = end + 2;
if (this.options.locations) {
for (var nextBreak = undefined, pos = start; (nextBreak = nextLineBreak(this.input, pos, this.pos)) > -1;) {
++this.curLine;
pos = this.lineStart = nextBreak;
}
}
if (this.options.onComment) {
var _context32;
this.options.onComment(true, _sliceInstanceProperty(_context32 = this.input).call(_context32, start + 2, end), start, this.pos, startLoc, this.curPosition());
}
};
pp.skipLineComment = function (startSkip) {
var start = this.pos;
var startLoc = this.options.onComment && this.curPosition();
var ch = this.input.charCodeAt(this.pos += startSkip);
while (this.pos < this.input.length && !isNewLine(ch)) {
ch = this.input.charCodeAt(++this.pos);
}
if (this.options.onComment) {
var _context33;
this.options.onComment(false, _sliceInstanceProperty(_context33 = this.input).call(_context33, start + startSkip, this.pos), start, this.pos, startLoc, this.curPosition());
}
};
// Called at the start of the parse and after every token. Skips
// whitespace and comments, and.
pp.skipSpace = function () {
loop: while (this.pos < this.input.length) {
var ch = this.input.charCodeAt(this.pos);
switch (ch) {
case 32:
case 160:
// ' '
++this.pos;
break;
case 13:
if (this.input.charCodeAt(this.pos + 1) === 10) {
++this.pos;
}
case 10:
case 8232:
case 8233:
++this.pos;
if (this.options.locations) {
++this.curLine;
this.lineStart = this.pos;
}
break;
case 47:
// '/'
switch (this.input.charCodeAt(this.pos + 1)) {
case 42:
// '*'
this.skipBlockComment();
break;
case 47:
this.skipLineComment(2);
break;
default:
break loop;
}
break;
default:
if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {
++this.pos;
} else {
break loop;
}
}
}
};
// Called at the end of every token. Sets `end`, `val`, and
// maintains `context` and `exprAllowed`, and skips the space after
// the token, so that the next one's `start` will point at the
// right position.
pp.finishToken = function (type, val) {
this.end = this.pos;
if (this.options.locations) {
this.endLoc = this.curPosition();
}
var prevType = this.type;
this.type = type;
this.value = val;
this.updateContext(prevType);
};
// ### Token reading
// This is the function that is called to fetch the next token. It
// is somewhat obscure, because it works in character codes rather
// than characters, and because operator parsing has been inlined
// into it.
//
// All in the name of speed.
//
pp.readToken_dot = function () {
var next = this.input.charCodeAt(this.pos + 1);
if (next >= 48 && next <= 57) {
return this.readNumber(true);
}
var next2 = this.input.charCodeAt(this.pos + 2);
if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) {
// 46 = dot '.'
this.pos += 3;
return this.finishToken(types$1.ellipsis);
} else {
++this.pos;
return this.finishToken(types$1.dot);
}
};
pp.readToken_slash = function () {
// '/'
var next = this.input.charCodeAt(this.pos + 1);
if (this.exprAllowed) {
++this.pos;
return this.readRegexp();
}
if (next === 61) {
return this.finishOp(types$1.assign, 2);
}
return this.finishOp(types$1.slash, 1);
};
pp.readToken_mult_modulo_exp = function (code) {
// '%*'
var next = this.input.charCodeAt(this.pos + 1);
var size = 1;
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$1.starstar;
next = this.input.charCodeAt(this.pos + 2);
}
if (next === 61) {
return this.finishOp(types$1.assign, size + 1);
}
return this.finishOp(tokentype, size);
};
pp.readToken_pipe_amp = function (code) {
// '|&'
var next = this.input.charCodeAt(this.pos + 1);
if (next === code) {
if (this.options.ecmaVersion >= 12) {
var next2 = this.input.charCodeAt(this.pos + 2);
if (next2 === 61) {
return this.finishOp(types$1.assign, 3);
}
}
return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2);
}
if (next === 61) {
return this.finishOp(types$1.assign, 2);
}
return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1);
};
pp.readToken_caret = function () {
// '^'
var next = this.input.charCodeAt(this.pos + 1);
if (next === 61) {
return this.finishOp(types$1.assign, 2);
}
return this.finishOp(types$1.bitwiseXOR, 1);
};
pp.readToken_plus_min = function (code) {
// '+-'
var next = this.input.charCodeAt(this.pos + 1);
if (next === code) {
var _context34;
if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 && (this.lastTokEnd === 0 || lineBreak.test(_sliceInstanceProperty(_context34 = this.input).call(_context34, this.lastTokEnd, this.pos)))) {
// A `-->` line comment
this.skipLineComment(3);
this.skipSpace();
return this.nextToken();
}
return this.finishOp(types$1.incDec, 2);
}
if (next === 61) {
return this.finishOp(types$1.assign, 2);
}
return this.finishOp(types$1.plusMin, 1);
};
pp.readToken_lt_gt = function (code) {
// '<>'
var next = this.input.charCodeAt(this.pos + 1);
var size = 1;
if (next === code) {
size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
if (this.input.charCodeAt(this.pos + size) === 61) {
return this.finishOp(types$1.assign, size + 1);
}
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) {
// `<!--`, an XML-style comment that should be interpreted as a line comment
this.skipLineComment(4);
this.skipSpace();
return this.nextToken();
}
if (next === 61) {
size = 2;
}
return this.finishOp(types$1.relational, size);
};
pp.readToken_eq_excl = function (code) {
// '=!'
var next = this.input.charCodeAt(this.pos + 1);
if (next === 61) {
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$1.arrow);
}
return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1);
};
pp.readToken_question = function () {
// '?'
var ecmaVersion = this.options.ecmaVersion;
if (ecmaVersion >= 11) {
var next = this.input.charCodeAt(this.pos + 1);
if (next === 46) {
var next2 = this.input.charCodeAt(this.pos + 2);
if (next2 < 48 || next2 > 57) {
return this.finishOp(types$1.questionDot, 2);
}
}
if (next === 63) {
if (ecmaVersion >= 12) {
var next2$1 = this.input.charCodeAt(this.pos + 2);
if (next2$1 === 61) {
return this.finishOp(types$1.assign, 3);
}
}
return this.finishOp(types$1.coalesce, 2);
}
}
return this.finishOp(types$1.question, 1);
};
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.
case 46:
// '.'
return this.readToken_dot();
// Punctuation tokens.
case 40:
++this.pos;
return this.finishToken(types$1.parenL);
case 41:
++this.pos;
return this.finishToken(types$1.parenR);
case 59:
++this.pos;
return this.finishToken(types$1.semi);
case 44:
++this.pos;
return this.finishToken(types$1.comma);
case 91:
++this.pos;
return this.finishToken(types$1.bracketL);
case 93:
++this.pos;
return this.finishToken(types$1.bracketR);
case 123:
++this.pos;
return this.finishToken(types$1.braceL);
case 125:
++this.pos;
return this.finishToken(types$1.braceR);
case 58:
++this.pos;
return this.finishToken(types$1.colon);
case 96:
// '`'
if (this.options.ecmaVersion < 6) {
break;
}
++this.pos;
return this.finishToken(types$1.backQuote);
case 48:
// '0'
var next = this.input.charCodeAt(this.pos + 1);
if (next === 120 || next === 88) {
return this.readRadixNumber(16);
} // '0x', '0X' - hex number
if (this.options.ecmaVersion >= 6) {
if (next === 111 || next === 79) {
return this.readRadixNumber(8);
} // '0o', '0O' - octal number
if (next === 98 || next === 66) {
return this.readRadixNumber(2);
} // '0b', '0B' - binary number
}
// Anything else beginning with a digit is an integer, octal
// number, or float.
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57:
// 1-9
return this.readNumber(false);
// Quotes produce strings.
case 34:
case 39:
// '"', "'"
return this.readString(code);
// Operators are parsed inline in tiny state machines. '=' (61) is
// often referred to. `finishOp` simply skips the amount of
// characters it is given as second argument, and returns a token
// of the type given by its first argument.
case 47:
// '/'
return this.readToken_slash();
case 37:
case 42:
// '%*'
return this.readToken_mult_modulo_exp(code);
case 124:
case 38:
// '|&'
return this.readToken_pipe_amp(code);
case 94:
// '^'
return this.readToken_caret();
case 43:
case 45:
// '+-'
return this.readToken_plus_min(code);
case 60:
case 62:
// '<>'
return this.readToken_lt_gt(code);
case 61:
case 33:
// '=!'
return this.readToken_eq_excl(code);
case 63:
// '?'
return this.readToken_question();
case 126:
// '~'
return this.finishOp(types$1.prefix, 1);
case 35:
// '#'
return this.readToken_numberSign();
}
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
};
pp.finishOp = function (type, size) {
var _context35;
var str = _sliceInstanceProperty(_context35 = this.input).call(_context35, this.pos, this.pos + size);
this.pos += size;
return this.finishToken(type, str);
};
pp.readRegexp = function () {
var _context36;
var escaped,
inClass,
start = this.pos;
for (;;) {
if (this.pos >= this.input.length) {
this.raise(start, "Unterminated regular expression");
}
var ch = this.input.charAt(this.pos);
if (lineBreak.test(ch)) {
this.raise(start, "Unterminated regular expression");
}
if (!escaped) {
if (ch === "[") {
inClass = true;
} else if (ch === "]" && inClass) {
inClass = false;
} else if (ch === "/" && !inClass) {
break;
}
escaped = ch === "\\";
} else {
escaped = false;
}
++this.pos;
}
var pattern = _sliceInstanceProperty(_context36 = this.input).call(_context36, start, this.pos);
++this.pos;
var flagsStart = this.pos;
var flags = this.readWord1();
if (this.containsEsc) {
this.unexpected(flagsStart);
}
// Validate pattern
var state = this.regexpState || (this.regexpState = new RegExpValidationState(this));
state.reset(start, pattern, flags);
this.validateRegExpFlags(state);
this.validateRegExpPattern(state);
// Create Literal#value property value.
var value = null;
try {
value = new RegExp(pattern, flags);
} catch (e) {
// ESTree requires null if it failed to instantiate RegExp object.
// https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral
}
return this.finishToken(types$1.regexp, {
pattern: pattern,
flags: flags,
value: value
});
};
// Read an integer in the given radix. Return null if zero digits
// were read, the integer value otherwise. When `len` is given, this
// will return `null` unless the integer has exactly `len` digits.
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
// is zero then disallow separators.
var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48;
var start = this.pos,
total = 0,
lastCode = 0;
for (var i = 0, e = len == null ? Infinity : len; i < e; ++i, ++this.pos) {
var code = this.input.charCodeAt(this.pos),
val = undefined;
if (allowSeparators && code === 95) {
if (isLegacyOctalNumericLiteral) {
this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals");
}
if (lastCode === 95) {
this.raiseRecoverable(this.pos, "Numeric separator must be exactly one underscore");
}
if (i === 0) {
this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits");
}
lastCode = code;
continue;
}
if (code >= 97) {
val = code - 97 + 10;
} // a
else if (code >= 65) {
val = code - 65 + 10;
} // A
else if (code >= 48 && code <= 57) {
val = code - 48;
} // 0-9
else {
val = Infinity;
}
if (val >= radix) {
break;
}
lastCode = code;
total = total * radix + val;
}
if (allowSeparators && lastCode === 95) {
this.raiseRecoverable(this.pos - 1, "Numeric separator is not allowed at the last of digits");
}
if (this.pos === start || len != null && this.pos - start !== len) {
return null;
}
return total;
};
function stringToNumber(str, isLegacyOctalNumericLiteral) {
if (isLegacyOctalNumericLiteral) {
return _parseInt(str, 8);
}
// `parseFloat(value)` stops parsing at the first numeric separator then returns a wrong value.
return _parseFloat(str.replace(/_/g, ""));
}
function stringToBigInt(str) {
if (typeof BigInt !== "function") {
return null;
}
// `BigInt(value)` throws syntax error if the string contains numeric separators.
return BigInt(str.replace(/_/g, ""));
}
pp.readRadixNumber = function (radix) {
var start = this.pos;
this.pos += 2; // 0x
var val = this.readInt(radix);
if (val == null) {
this.raise(this.start + 2, "Expected number in radix " + radix);
}
if (this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110) {
var _context37;
val = stringToBigInt(_sliceInstanceProperty(_context37 = this.input).call(_context37, start, this.pos));
++this.pos;
} else if (isIdentifierStart(this.fullCharCodeAtPos())) {
this.raise(this.pos, "Identifier directly after number");
}
return this.finishToken(types$1.num, val);
};
// Read an integer, octal integer, or floating-point number.
pp.readNumber = function (startsWithDot) {
var _context39, _context40;
var start = this.pos;
if (!startsWithDot && this.readInt(10, undefined, true) === null) {
this.raise(start, "Invalid number");
}
var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
if (octal && this.strict) {
this.raise(start, "Invalid number");
}
var next = this.input.charCodeAt(this.pos);
if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) {
var _context38;
var val$1 = stringToBigInt(_sliceInstanceProperty(_context38 = this.input).call(_context38, start, this.pos));
++this.pos;
if (isIdentifierStart(this.fullCharCodeAtPos())) {
this.raise(this.pos, "Identifier directly after number");
}
return this.finishToken(types$1.num, val$1);
}
if (octal && /[89]/.test(_sliceInstanceProperty(_context39 = this.input).call(_context39, start, this.pos))) {
octal = false;
}
if (next === 46 && !octal) {
// '.'
++this.pos;
this.readInt(10);
next = this.input.charCodeAt(this.pos);
}
if ((next === 69 || next === 101) && !octal) {
// 'eE'
next = this.input.charCodeAt(++this.pos);
if (next === 43 || next === 45) {
++this.pos;
} // '+-'
if (this.readInt(10) === null) {
this.raise(start, "Invalid number");
}
}
if (isIdentifierStart(this.fullCharCodeAtPos())) {
this.raise(this.pos, "Identifier directly after number");
}
var val = stringToNumber(_sliceInstanceProperty(_context40 = this.input).call(_context40, start, this.pos), octal);
return this.finishToken(types$1.num, val);
};
// Read a string value, interpreting backslash-escapes.
pp.readCodePoint = function () {
var ch = this.input.charCodeAt(this.pos),
code;
if (ch === 123) {
var _context41;
// '{'
if (this.options.ecmaVersion < 6) {
this.unexpected();
}
var codePos = ++this.pos;
code = this.readHexChar(_indexOfInstanceProperty(_context41 = this.input).call(_context41, "}", this.pos) - this.pos);
++this.pos;
if (code > 0x10FFFF) {
this.invalidStringToken(codePos, "Code point out of bounds");
}
} else {
code = this.readHexChar(4);
}
return code;
};
pp.readString = function (quote) {
var _context43;
var out = "",
chunkStart = ++this.pos;
for (;;) {
if (this.pos >= this.input.length) {
this.raise(this.start, "Unterminated string constant");
}
var ch = this.input.charCodeAt(this.pos);
if (ch === quote) {
break;
}
if (ch === 92) {
var _context42;
// '\'
out += _sliceInstanceProperty(_context42 = this.input).call(_context42, 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.raise(this.start, "Unterminated string constant");
}
++this.pos;
}
}
out += _sliceInstanceProperty(_context43 = this.input).call(_context43, chunkStart, this.pos++);
return this.finishToken(types$1.string, out);
};
// Reads template string tokens.
var INVALID_TEMPLATE_ESCAPE_ERROR = {};
pp.tryReadTemplateToken = function () {
this.inTemplateElement = true;
try {
this.readTmplToken();
} catch (err) {
if (err === INVALID_TEMPLATE_ESCAPE_ERROR) {
this.readInvalidTemplateToken();
} else {
throw err;
}
}
this.inTemplateElement = false;
};
pp.invalidStringToken = function (position, message) {
if (this.inTemplateElement && this.options.ecmaVersion >= 9) {
throw INVALID_TEMPLATE_ESCAPE_ERROR;
} else {
this.raise(position, message);
}
};
pp.readTmplToken = function () {
var out = "",
chunkStart = this.pos;
for (;;) {
if (this.pos >= this.input.length) {
this.raise(this.start, "Unterminated template");
}
var ch = this.input.charCodeAt(this.pos);
if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) {
var _context44;
// '`', '${'
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$1.dollarBraceL);
} else {
++this.pos;
return this.finishToken(types$1.backQuote);
}
}
out += _sliceInstanceProperty(_context44 = this.input).call(_context44, chunkStart, this.pos);
return this.finishToken(types$1.template, out);
}
if (ch === 92) {
var _context45;
// '\'
out += _sliceInstanceProperty(_context45 = this.input).call(_context45, chunkStart, this.pos);
out += this.readEscapedChar(true);
chunkStart = this.pos;
} else if (isNewLine(ch)) {
var _context46;
out += _sliceInstanceProperty(_context46 = this.input).call(_context46, chunkStart, this.pos);
++this.pos;
switch (ch) {
case 13:
if (this.input.charCodeAt(this.pos) === 10) {
++this.pos;
}
case 10:
out += "\n";
break;
default:
out += String.fromCharCode(ch);
break;
}
if (this.options.locations) {
++this.curLine;
this.lineStart = this.pos;
}
chunkStart = this.pos;
} else {
++this.pos;
}
}
};
// Reads a template token to search for the end, without validating any escape sequences
pp.readInvalidTemplateToken = function () {
var _context47;
for (; this.pos < this.input.length; this.pos++) {
switch (this.input[this.pos]) {
case "\\":
++this.pos;
break;
case "$":
if (this.input[this.pos + 1] !== "{") {
break;
}
// fall through
case "`":
return this.finishToken(types$1.invalidTemplate, _sliceInstanceProperty(_context47 = this.input).call(_context47, this.start, this.pos));
case "\r":
if (this.input[this.pos + 1] === "\n") {
++this.pos;
}
// fall through
case "\n":
case "\u2028":
case "\u2029":
++this.curLine;
this.lineStart = this.pos + 1;
break;
}
}
this.raise(this.start, "Unterminated template");
};
// Used to read escaped characters
pp.readEscapedChar = function (inTemplate) {
var ch = this.input.charCodeAt(++this.pos);
++this.pos;
switch (ch) {
case 110:
return "\n";
// 'n' -> '\n'
case 114:
return "\r";
// 'r' -> '\r'
case 120:
return String.fromCharCode(this.readHexChar(2));
// 'x'
case 117:
return codePointToString(this.readCodePoint());
// 'u'
case 116:
return "\t";
// 't' -> '\t'
case 98:
return "\b";
// 'b' -> '\b'
case 118:
return "\u000b";
// 'v' -> '\u000b'
case 102:
return "\f";
// 'f' -> '\f'
case 13:
if (this.input.charCodeAt(this.pos) === 10) {
++this.pos;
}
// '\r\n'
case 10:
// ' \n'
if (this.options.locations) {
this.lineStart = this.pos;
++this.curLine;
}
return "";
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");
}
default:
if (ch >= 48 && ch <= 55) {
var octalStr = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0];
var octal = _parseInt(octalStr, 8);
if (octal > 255) {
octalStr = _sliceInstanceProperty(octalStr).call(octalStr, 0, -1);
octal = _parseInt(octalStr, 8);
}
this.pos += octalStr.length - 1;
ch = this.input.charCodeAt(this.pos);
if ((octalStr !== "0" || ch === 56 || ch === 57) && (this.strict || inTemplate)) {
this.invalidStringToken(this.pos - 1 - octalStr.length, inTemplate ? "Octal literal in template string" : "Octal literal in strict mode");
}
return String.fromCharCode(octal);
}
if (isNewLine(ch)) {
// Unicode new line characters after \ get removed from output in both
// template literals and strings
if (this.options.locations) {
this.lineStart = this.pos;
++this.curLine;
}
return "";
}
return String.fromCharCode(ch);
}
};
// Used to read character escape sequences ('\x', '\u', '\U').
pp.readHexChar = function (len) {
var codePos = this.pos;
var n = this.readInt(16, len);
if (n === null) {
this.invalidStringToken(codePos, "Bad character escape sequence");
}
return n;
};
// Read an identifier, and return it as a string. Sets `this.containsEsc`
// to whether the word contained a '\u' escape.
//
// Incrementally adds only escaped chars, adding other chunks as-is
// as a micro-optimization.
pp.readWord1 = function () {
var _context49;
this.containsEsc = false;
var word = "",
first = true,
chunkStart = this.pos;
var astral = this.options.ecmaVersion >= 6;
while (this.pos < this.input.length) {
var ch = this.fullCharCodeAtPos();
if (isIdentifierChar(ch, astral)) {
this.pos += ch <= 0xffff ? 1 : 2;
} else if (ch === 92) {
var _context48;
// "\"
this.containsEsc = true;
word += _sliceInstanceProperty(_context48 = this.input).call(_context48, chunkStart, this.pos);
var escStart = this.pos;
if (this.input.charCodeAt(++this.pos) !== 117)
// "u"
{
this.invalidStringToken(this.pos, "Expecting Unicode escape sequence \\uXXXX");
}
++this.pos;
var esc = this.readCodePoint();
if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral)) {
this.invalidStringToken(escStart, "Invalid Unicode escape");
}
word += codePointToString(esc);
chunkStart = this.pos;
} else {
break;
}
first = false;
}
return word + _sliceInstanceProperty(_context49 = this.input).call(_context49, chunkStart, this.pos);
};
// Read an identifier or keyword token. Will check for reserved
// words when necessary.
pp.readWord = function () {
var word = this.readWord1();
var type = types$1.name;
if (this.keywords.test(word)) {
type = keywords[word];
}
return this.finishToken(type, word);
};
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
//
// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and
// various contributors and released under an MIT license.
//
// Git repositories for Acorn are available at
//
// http://marijnhaverbeke.nl/git/acorn
// https://github.com/acornjs/acorn.git
//
// Please use the [github bug tracker][ghbt] to report issues.
//
// [ghbt]: https://github.com/acornjs/acorn/issues
//
// [walk]: util/walk.js
var version = "8.14.0";
Parser$1.acorn = {
Parser: Parser$1,
version: version,
defaultOptions: defaultOptions,
Position: Position,
SourceLocation: SourceLocation,
getLineInfo: getLineInfo,
Node: Node,
TokenType: TokenType,
tokTypes: types$1,
keywordTypes: keywords,
TokContext: TokContext,
tokContexts: types,
isIdentifierChar: isIdentifierChar,
isIdentifierStart: isIdentifierStart,
Token: Token$1,
isNewLine: isNewLine,
lineBreak: lineBreak,
lineBreakG: lineBreakG,
nonASCIIwhitespace: nonASCIIwhitespace
};
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
function getDefaultExportFromCjs (x) {
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}
var acornJsx = {exports: {}};
var xhtml;
var hasRequiredXhtml;
function requireXhtml() {
if (hasRequiredXhtml) return xhtml;
hasRequiredXhtml = 1;
xhtml = {
quot: '\u0022',
amp: '&',
apos: '\u0027',
lt: '<',
gt: '>',
nbsp: '\u00A0',
iexcl: '\u00A1',
cent: '\u00A2',
pound: '\u00A3',
curren: '\u00A4',
yen: '\u00A5',
brvbar: '\u00A6',
sect: '\u00A7',
uml: '\u00A8',
copy: '\u00A9',
ordf: '\u00AA',
laquo: '\u00AB',
not: '\u00AC',
shy: '\u00AD',
reg: '\u00AE',
macr: '\u00AF',
deg: '\u00B0',
plusmn: '\u00B1',
sup2: '\u00B2',
sup3: '\u00B3',
acute: '\u00B4',
micro: '\u00B5',
para: '\u00B6',
middot: '\u00B7',
cedil: '\u00B8',
sup1: '\u00B9',
ordm: '\u00BA',
raquo: '\u00BB',
frac14: '\u00BC',
frac12: '\u00BD',
frac34: '\u00BE',
iquest: '\u00BF',
Agrave: '\u00C0',
Aacute: '\u00C1',
Acirc: '\u00C2',
Atilde: '\u00C3',
Auml: '\u00C4',
Aring: '\u00C5',
AElig: '\u00C6',
Ccedil: '\u00C7',
Egrave: '\u00C8',
Eacute: '\u00C9',
Ecirc: '\u00CA',
Euml: '\u00CB',
Igrave: '\u00CC',
Iacute: '\u00CD',
Icirc: '\u00CE',
Iuml: '\u00CF',
ETH: '\u00D0',
Ntilde: '\u00D1',
Ograve: '\u00D2',
Oacute: '\u00D3',
Ocirc: '\u00D4',
Otilde: '\u00D5',
Ouml: '\u00D6',
times: '\u00D7',
Oslash: '\u00D8',
Ugrave: '\u00D9',
Uacute: '\u00DA',
Ucirc: '\u00DB',
Uuml: '\u00DC',
Yacute: '\u00DD',
THORN: '\u00DE',
szlig: '\u00DF',
agrave: '\u00E0',
aacute: '\u00E1',
acirc: '\u00E2',
atilde: '\u00E3',
auml: '\u00E4',
aring: '\u00E5',
aelig: '\u00E6',
ccedil: '\u00E7',
egrave: '\u00E8',
eacute: '\u00E9',
ecirc: '\u00EA',
euml: '\u00EB',
igrave: '\u00EC',
iacute: '\u00ED',
icirc: '\u00EE',
iuml: '\u00EF',
eth: '\u00F0',
ntilde: '\u00F1',
ograve: '\u00F2',
oacute: '\u00F3',
ocirc: '\u00F4',
otilde: '\u00F5',
ouml: '\u00F6',
divide: '\u00F7',
oslash: '\u00F8',
ugrave: '\u00F9',
uacute: '\u00FA',
ucirc: '\u00FB',
uuml: '\u00FC',
yacute: '\u00FD',
thorn: '\u00FE',
yuml: '\u00FF',
OElig: '\u0152',
oelig: '\u0153',
Scaron: '\u0160',
scaron: '\u0161',
Yuml: '\u0178',
fnof: '\u0192',
circ: '\u02C6',
tilde: '\u02DC',
Alpha: '\u0391',
Beta: '\u0392',
Gamma: '\u0393',
Delta: '\u0394',
Epsilon: '\u0395',
Zeta: '\u0396',
Eta: '\u0397',
Theta: '\u0398',
Iota: '\u0399',
Kappa: '\u039A',
Lambda: '\u039B',
Mu: '\u039C',
Nu: '\u039D',
Xi: '\u039E',
Omicron: '\u039F',
Pi: '\u03A0',
Rho: '\u03A1',
Sigma: '\u03A3',
Tau: '\u03A4',
Upsilon: '\u03A5',
Phi: '\u03A6',
Chi: '\u03A7',
Psi: '\u03A8',
Omega: '\u03A9',
alpha: '\u03B1',
beta: '\u03B2',
gamma: '\u03B3',
delta: '\u03B4',
epsilon: '\u03B5',
zeta: '\u03B6',
eta: '\u03B7',
theta: '\u03B8',
iota: '\u03B9',
kappa: '\u03BA',
lambda: '\u03BB',
mu: '\u03BC',
nu: '\u03BD',
xi: '\u03BE',
omicron: '\u03BF',
pi: '\u03C0',
rho: '\u03C1',
sigmaf: '\u03C2',
sigma: '\u03C3',
tau: '\u03C4',
upsilon: '\u03C5',
phi: '\u03C6',
chi: '\u03C7',
psi: '\u03C8',
omega: '\u03C9',
thetasym: '\u03D1',
upsih: '\u03D2',
piv: '\u03D6',
ensp: '\u2002',
emsp: '\u2003',
thinsp: '\u2009',
zwnj: '\u200C',
zwj: '\u200D',
lrm: '\u200E',
rlm: '\u200F',
ndash: '\u2013',
mdash: '\u2014',
lsquo: '\u2018',
rsquo: '\u2019',
sbquo: '\u201A',
ldquo: '\u201C',
rdquo: '\u201D',
bdquo: '\u201E',
dagger: '\u2020',
Dagger: '\u2021',
bull: '\u2022',
hellip: '\u2026',
permil: '\u2030',
prime: '\u2032',
Prime: '\u2033',
lsaquo: '\u2039',
rsaquo: '\u203A',
oline: '\u203E',
frasl: '\u2044',
euro: '\u20AC',
image: '\u2111',
weierp: '\u2118',
real: '\u211C',
trade: '\u2122',
alefsym: '\u2135',
larr: '\u2190',
uarr: '\u2191',
rarr: '\u2192',
darr: '\u2193',
harr: '\u2194',
crarr: '\u21B5',
lArr: '\u21D0',
uArr: '\u21D1',
rArr: '\u21D2',
dArr: '\u21D3',
hArr: '\u21D4',
forall: '\u2200',
part: '\u2202',
exist: '\u2203',
empty: '\u2205',
nabla: '\u2207',
isin: '\u2208',
notin: '\u2209',
ni: '\u220B',
prod: '\u220F',
sum: '\u2211',
minus: '\u2212',
lowast: '\u2217',
radic: '\u221A',
prop: '\u221D',
infin: '\u221E',
ang: '\u2220',
and: '\u2227',
or: '\u2228',
cap: '\u2229',
cup: '\u222A',
'int': '\u222B',
there4: '\u2234',
sim: '\u223C',
cong: '\u2245',
asymp: '\u2248',
ne: '\u2260',
equiv: '\u2261',
le: '\u2264',
ge: '\u2265',
sub: '\u2282',
sup: '\u2283',
nsub: '\u2284',
sube: '\u2286',
supe: '\u2287',
oplus: '\u2295',
otimes: '\u2297',
perp: '\u22A5',
sdot: '\u22C5',
lceil: '\u2308',
rceil: '\u2309',
lfloor: '\u230A',
rfloor: '\u230B',
lang: '\u2329',
rang: '\u232A',
loz: '\u25CA',
spades: '\u2660',
clubs: '\u2663',
hearts: '\u2665',
diams: '\u2666'
};
return xhtml;
}
var acorn$1 = {exports: {}};
var acorn = acorn$1.exports;
var hasRequiredAcorn;
function requireAcorn() {
if (hasRequiredAcorn) return acorn$1.exports;
hasRequiredAcorn = 1;
(function (module, exports) {
(function (global, factory) {
factory(exports) ;
})(acorn, function (exports) {
// This file was generated. Do not modify manually!
var astralIdentifierCodes = [509, 0, 227, 0, 150, 4, 294, 9, 1368, 2, 2, 1, 6, 3, 41, 2, 5, 0, 166, 1, 574, 3, 9, 9, 7, 9, 32, 4, 318, 1, 80, 3, 71, 10, 50, 3, 123, 2, 54, 14, 32, 10, 3, 1, 11, 3, 46, 10, 8, 0, 46, 9, 7, 2, 37, 13, 2, 9, 6, 1, 45, 0, 13, 2, 49, 13, 9, 3, 2, 11, 83, 11, 7, 0, 3, 0, 158, 11, 6, 9, 7, 3, 56, 1, 2, 6, 3, 1, 3, 2, 10, 0, 11, 1, 3, 6, 4, 4, 68, 8, 2, 0, 3, 0, 2, 3, 2, 4, 2, 0, 15, 1, 83, 17, 10, 9, 5, 0, 82, 19, 13, 9, 214, 6, 3, 8, 28, 1, 83, 16, 16, 9, 82, 12, 9, 9, 7, 19, 58, 14, 5, 9, 243, 14, 166, 9, 71, 5, 2, 1, 3, 3, 2, 0, 2, 1, 13, 9, 120, 6, 3, 6, 4, 0, 29, 9, 41, 6, 2, 3, 9, 0, 10, 10, 47, 15, 343, 9, 54, 7, 2, 7, 17, 9, 57, 21, 2, 13, 123, 5, 4, 0, 2, 1, 2, 6, 2, 0, 9, 9, 49, 4, 2, 1, 2, 4, 9, 9, 330, 3, 10, 1, 2, 0, 49, 6, 4, 4, 14, 10, 5350, 0, 7, 14, 11465, 27, 2343, 9, 87, 9, 39, 4, 60, 6, 26, 9, 535, 9, 470, 0, 2, 54, 8, 3, 82, 0, 12, 1, 19628, 1, 4178, 9, 519, 45, 3, 22, 543, 4, 4, 5, 9, 7, 3, 6, 31, 3, 149, 2, 1418, 49, 513, 54, 5, 49, 9, 0, 15, 0, 23, 4, 2, 14, 1361, 6, 2, 16, 3, 6, 2, 1, 2, 4, 101, 0, 161, 6, 10, 9, 357, 0, 62, 13, 499, 13, 245, 1, 2, 9, 726, 6, 110, 6, 6, 9, 4759, 9, 787719, 239];
// This file was generated. Do not modify manually!
var astralIdentifierStartCodes = [0, 11, 2, 25, 2, 18, 2, 1, 2, 14, 3, 13, 35, 122, 70, 52, 268, 28, 4, 48, 48, 31, 14, 29, 6, 37, 11, 29, 3, 35, 5, 7, 2, 4, 43, 157, 19, 35, 5, 35, 5, 39, 9, 51, 13, 10, 2, 14, 2, 6, 2, 1, 2, 10, 2, 14, 2, 6, 2, 1, 4, 51, 13, 310, 10, 21, 11, 7, 25, 5, 2, 41, 2, 8, 70, 5, 3, 0, 2, 43, 2, 1, 4, 0, 3, 22, 11, 22, 10, 30, 66, 18, 2, 1, 11, 21, 11, 25, 71, 55, 7, 1, 65, 0, 16, 3, 2, 2, 2, 28, 43, 28, 4, 28, 36, 7, 2, 27, 28, 53, 11, 21, 11, 18, 14, 17, 111, 72, 56, 50, 14, 50, 14, 35, 39, 27, 10, 22, 251, 41, 7, 1, 17, 2, 60, 28, 11, 0, 9, 21, 43, 17, 47, 20, 28, 22, 13, 52, 58, 1, 3, 0, 14, 44, 33, 24, 27, 35, 30, 0, 3, 0, 9, 34, 4, 0, 13, 47, 15, 3, 22, 0, 2, 0, 36, 17, 2, 24, 20, 1, 64, 6, 2, 0, 2, 3, 2, 14, 2, 9, 8, 46, 39, 7, 3, 1, 3, 21, 2, 6, 2, 1, 2, 4, 4, 0, 19, 0, 13, 4, 31, 9, 2, 0, 3, 0, 2, 37, 2, 0, 26, 0, 2, 0, 45, 52, 19, 3, 21, 2, 31, 47, 21, 1, 2, 0, 185, 46, 42, 3, 37, 47, 21, 0, 60, 42, 14, 0, 72, 26, 38, 6, 186, 43, 117, 63, 32, 7, 3, 0, 3, 7, 2, 1, 2, 23, 16, 0, 2, 0, 95, 7, 3, 38, 17, 0, 2, 0, 29, 0, 11, 39, 8, 0, 22, 0, 12, 45, 20, 0, 19, 72, 200, 32, 32, 8, 2, 36, 18, 0, 50, 29, 113, 6, 2, 1, 2, 37, 22, 0, 26, 5, 2, 1, 2, 31, 15, 0, 328, 18, 16, 0, 2, 12, 2, 33, 125, 0, 80, 921, 103, 110, 18, 195, 2637, 96, 16, 1071, 18, 5, 26, 3994, 6, 582, 6842, 29, 1763, 568, 8, 30, 18, 78, 18, 29, 19, 47, 17, 3, 32, 20, 6, 18, 433, 44, 212, 63, 129, 74, 6, 0, 67, 12, 65, 1, 2, 0, 29, 6135, 9, 1237, 42, 9, 8936, 3, 2, 6, 2, 1, 2, 290, 16, 0, 30, 2, 3, 0, 15, 3, 9, 395, 2309, 106, 6, 12, 4, 8, 8, 9, 5991, 84, 2, 70, 2, 1, 3, 0, 3, 1, 3, 3, 2, 11, 2, 0, 2, 6, 2, 64, 2, 3, 3, 7, 2, 6, 2, 27, 2, 3, 2, 4, 2, 0, 4, 6, 2, 339, 3, 24, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 30, 2, 24, 2, 7, 1845, 30, 7, 5, 262, 61, 147, 44, 11, 6, 17, 0, 322, 29, 19, 43, 485, 27, 229, 29, 3, 0, 496, 6, 2, 3, 2, 1, 2, 14, 2, 196, 60, 67, 8, 0, 1205, 3, 2, 26, 2, 1, 2, 0, 3, 0, 2, 9, 2, 3, 2, 0, 2, 0, 7, 0, 5, 0, 2, 0, 2, 0, 2, 2, 2, 1, 2, 0, 3, 0, 2, 0, 2, 0, 2, 0, 2, 0, 2, 1, 2, 0, 3, 3, 2, 6, 2, 3, 2, 3, 2, 0, 2, 9, 2, 16, 6, 2, 2, 4, 2, 16, 4421, 42719, 33, 4153, 7, 221, 3, 5761, 15, 7472, 16, 621, 2467, 541, 1507, 4938, 6, 4191];
// This file was generated. Do not modify manually!
var nonASCIIidentifierChars = "\u200c\u200d\xb7\u0300-\u036f\u0387\u0483-\u0487\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u0669\u0670\u06d6-\u06dc\u06df-\u06e4\u06e7\u06e8\u06ea-\u06ed\u06f0-\u06f9\u0711\u0730-\u074a\u07a6-\u07b0\u07c0-\u07c9\u07eb-\u07f3\u07fd\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0859-\u085b\u0897-\u089f\u08ca-\u08e1\u08e3-\u0903\u093a-\u093c\u093e-\u094f\u0951-\u0957\u0962\u0963\u0966-\u096f\u0981-\u0983\u09bc\u09be-\u09c4\u09c7\u09c8\u09cb-\u09cd\u09d7\u09e2\u09e3\u09e6-\u09ef\u09fe\u0a01-\u0a03\u0a3c\u0a3e-\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a66-\u0a71\u0a75\u0a81-\u0a83\u0abc\u0abe-\u0ac5\u0ac7-\u0ac9\u0acb-\u0acd\u0ae2\u0ae3\u0ae6-\u0aef\u0afa-\u0aff\u0b01-\u0b03\u0b3c\u0b3e-\u0b44\u0b47\u0b48\u0b4b-\u0b4d\u0b55-\u0b57\u0b62\u0b63\u0b66-\u0b6f\u0b82\u0bbe-\u0bc2\u0bc6-\u0bc8\u0bca-\u0bcd\u0bd7\u0be6-\u0bef\u0c00-\u0c04\u0c3c\u0c3e-\u0c44\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0c66-\u0c6f\u0c81-\u0c83\u0cbc\u0cbe-\u0cc4\u0cc6-\u0cc8\u0cca-\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0ce6-\u0cef\u0cf3\u0d00-\u0d03\u0d3b\u0d3c\u0d3e-\u0d44\u0d46-\u0d48\u0d4a-\u0d4d\u0d57\u0d62\u0d63\u0d66-\u0d6f\u0d81-\u0d83\u0dca\u0dcf-\u0dd4\u0dd6\u0dd8-\u0ddf\u0de6-\u0def\u0df2\u0df3\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0e50-\u0e59\u0eb1\u0eb4-\u0ebc\u0ec8-\u0ece\u0ed0-\u0ed9\u0f18\u0f19\u0f20-\u0f29\u0f35\u0f37\u0f39\u0f3e\u0f3f\u0f71-\u0f84\u0f86\u0f87\u0f8d-\u0f97\u0f99-\u0fbc\u0fc6\u102b-\u103e\u1040-\u1049\u1056-\u1059\u105e-\u1060\u1062-\u1064\u1067-\u106d\u1071-\u1074\u1082-\u108d\u108f-\u109d\u135d-\u135f\u1369-\u1371\u1712-\u1715\u1732-\u1734\u1752\u1753\u1772\u1773\u17b4-\u17d3\u17dd\u17e0-\u17e9\u180b-\u180d\u180f-\u1819\u18a9\u1920-\u192b\u1930-\u193b\u1946-\u194f\u19d0-\u19da\u1a17-\u1a1b\u1a55-\u1a5e\u1a60-\u1a7c\u1a7f-\u1a89\u1a90-\u1a99\u1ab0-\u1abd\u1abf-\u1ace\u1b00-\u1b04\u1b34-\u1b44\u1b50-\u1b59\u1b6b-\u1b73\u1b80-\u1b82\u1ba1-\u1bad\u1bb0-\u1bb9\u1be6-\u1bf3\u1c24-\u1c37\u1c40-\u1c49\u1c50-\u1c59\u1cd0-\u1cd2\u1cd4-\u1ce8\u1ced\u1cf4\u1cf7-\u1cf9\u1dc0-\u1dff\u200c\u200d\u203f\u2040\u2054\u20d0-\u20dc\u20e1\u20e5-\u20f0\u2cef-\u2cf1\u2d7f\u2de0-\u2dff\u302a-\u302f\u3099\u309a\u30fb\ua620-\ua629\ua66f\ua674-\ua67d\ua69e\ua69f\ua6f0\ua6f1\ua802\ua806\ua80b\ua823-\ua827\ua82c\ua880\ua881\ua8b4-\ua8c5\ua8d0-\ua8d9\ua8e0-\ua8f1\ua8ff-\ua909\ua926-\ua92d\ua947-\ua953\ua980-\ua983\ua9b3-\ua9c0\ua9d0-\ua9d9\ua9e5\ua9f0-\ua9f9\uaa29-\uaa36\uaa43\uaa4c\uaa4d\uaa50-\uaa59\uaa7b-\uaa7d\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uaaeb-\uaaef\uaaf5\uaaf6\uabe3-\uabea\uabec\uabed\uabf0-\uabf9\ufb1e\ufe00-\ufe0f\ufe20-\ufe2f\ufe33\ufe34\ufe4d-\ufe4f\uff10-\uff19\uff3f\uff65";
// This file was generated. Do not modify manually!
var nonASCIIidentifierStartChars = "\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\u0560-\u0588\u05d0-\u05ea\u05ef-\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\u0860-\u086a\u0870-\u0887\u0889-\u088e\u08a0-\u08c9\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\u09fc\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\u0c5d\u0c60\u0c61\u0c80\u0c85-\u0c8c\u0c8e-\u0c90\u0c92-\u0ca8\u0caa-\u0cb3\u0cb5-\u0cb9\u0cbd\u0cdd\u0cde\u0ce0\u0ce1\u0cf1\u0cf2\u0d04-\u0d0c\u0d0e-\u0d10\u0d12-\u0d3a\u0d3d\u0d4e\u0d54-\u0d56\u0d5f-\u0d61\u0d7a-\u0d7f\u0d85-\u0d96\u0d9a-\u0db1\u0db3-\u0dbb\u0dbd\u0dc0-\u0dc6\u0e01-\u0e30\u0e32\u0e33\u0e40-\u0e46\u0e81\u0e82\u0e84\u0e86-\u0e8a\u0e8c-\u0ea3\u0ea5\u0ea7-\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-\u1711\u171f-\u1731\u1740-\u1751\u1760-\u176c\u176e-\u1770\u1780-\u17b3\u17d7\u17dc\u1820-\u1878\u1880-\u18a8\u18aa\u18b0-\u18f5\u1900-\u191e\u1950-\u196d\u1970-\u1974\u1980-\u19ab\u19b0-\u19c9\u1a00-\u1a16\u1a20-\u1a54\u1aa7\u1b05-\u1b33\u1b45-\u1b4c\u1b83-\u1ba0\u1bae\u1baf\u1bba-\u1be5\u1c00-\u1c23\u1c4d-\u1c4f\u1c5a-\u1c7d\u1c80-\u1c8a\u1c90-\u1cba\u1cbd-\u1cbf\u1ce9-\u1cec\u1cee-\u1cf3\u1cf5\u1cf6\u1cfa\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-\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-\u312f\u3131-\u318e\u31a0-\u31bf\u31f0-\u31ff\u3400-\u4dbf\u4e00-\ua48c\ua4d0-\ua4fd\ua500-\ua60c\ua610-\ua61f\ua62a\ua62b\ua640-\ua66e\ua67f-\ua69d\ua6a0-\ua6ef\ua717-\ua71f\ua722-\ua788\ua78b-\ua7cd\ua7d0\ua7d1\ua7d3\ua7d5-\ua7dc\ua7f2-\ua801\ua803-\ua805\ua807-\ua80a\ua80c-\ua822\ua840-\ua873\ua882-\ua8b3\ua8f2-\ua8f7\ua8fb\ua8fd\ua8fe\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-\uab69\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";
// These are a run-length and offset encoded representation of the
// >0xffff code points that are a valid part of identifiers. The
// offset starts at 0x10000, and each pair of numbers represents an
// offset to the next range, and then a size of the range.
// Reserved word lists for various dialects of the language
var reservedWords = {
3: "abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",
5: "class enum extends super const export import",
6: "enum",
strict: "implements interface let package private protected public static yield",
strictBind: "eval arguments"
};
// 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$1 = {
5: ecma5AndLessKeywords,
"5module": ecma5AndLessKeywords + " export import",
6: ecma5AndLessKeywords + " const class extends export import super"
};
var keywordRelationalOperator = /^in(stanceof)?$/;
// ## Character categories
var nonASCIIidentifierStart = new RegExp("[" + nonASCIIidentifierStartChars + "]");
var nonASCIIidentifier = new RegExp("[" + nonASCIIidentifierStartChars + nonASCIIidentifierChars + "]");
// This has a complexity linear to the value of the code. The
// assumption is that looking up astral identifier characters is
// rare.
function isInAstralSet(code, set) {
var pos = 0x10000;
for (var i = 0; i < set.length; i += 2) {
pos += set[i];
if (pos > code) {
return false;
}
pos += set[i + 1];
if (pos >= code) {
return true;
}
}
return false;
}
// Test whether a given character code starts an identifier.
function isIdentifierStart(code, astral) {
if (code < 65) {
return code === 36;
}
if (code < 91) {
return true;
}
if (code < 97) {
return code === 95;
}
if (code < 123) {
return true;
}
if (code <= 0xffff) {
return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
}
if (astral === false) {
return false;
}
return isInAstralSet(code, astralIdentifierStartCodes);
}
// Test whether a given character is part of an identifier.
function isIdentifierChar(code, astral) {
if (code < 48) {
return code === 36;
}
if (code < 58) {
return true;
}
if (code < 65) {
return false;
}
if (code < 91) {
return true;
}
if (code < 97) {
return code === 95;
}
if (code < 123) {
return true;
}
if (code <= 0xffff) {
return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
}
if (astral === false) {
return false;
}
return isInAstralSet(code, astralIdentifierStartCodes) || isInAstralSet(code, astralIdentifierCodes);
}
// ## Token types
// The assignment of fine-grained, information-carrying type objects
// allows the tokenizer to store the information it has about a
// token in a way that is very cheap for the parser to look up.
// All token type variables start with an underscore, to make them
// easy to recognize.
// The `beforeExpr` property is used to disambiguate between regular
// expressions and divisions. It is set on all token types that can
// be followed by an expression (thus, a slash after them would be a
// regular expression).
//
// The `startsExpr` property is used to check if the token ends a
// `yield` expression. It is set on all token types that either can
// directly start an expression (like a quotation mark) or can
// continue an expression (like the body of a string).
//
// `isLoop` marks a keyword as starting a loop, which is important
// to know when parsing a label, in order to allow or disallow
// continue jumps to that label.
var TokenType = function TokenType(label, conf) {
if (conf === undefined) conf = {};
this.label = label;
this.keyword = conf.keyword;
this.beforeExpr = !!conf.beforeExpr;
this.startsExpr = !!conf.startsExpr;
this.isLoop = !!conf.isLoop;
this.isAssign = !!conf.isAssign;
this.prefix = !!conf.prefix;
this.postfix = !!conf.postfix;
this.binop = conf.binop || null;
this.updateContext = null;
};
function binop(name, prec) {
return new TokenType(name, {
beforeExpr: true,
binop: prec
});
}
var beforeExpr = {
beforeExpr: true
},
startsExpr = {
startsExpr: true
};
// Map keyword names to token types.
var keywords = {};
// Succinct definitions of keyword token types
function kw(name, options) {
if (options === undefined) options = {};
options.keyword = name;
return keywords[name] = new TokenType(name, options);
}
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("[", {
beforeExpr: true,
startsExpr: true
}),
bracketR: new TokenType("]"),
braceL: new TokenType("{", {
beforeExpr: true,
startsExpr: true
}),
braceR: new TokenType("}"),
parenL: new TokenType("(", {
beforeExpr: true,
startsExpr: true
}),
parenR: new TokenType(")"),
comma: new TokenType(",", beforeExpr),
semi: new TokenType(";", beforeExpr),
colon: new TokenType(":", beforeExpr),
dot: new TokenType("."),
question: new TokenType("?", beforeExpr),
questionDot: new TokenType("?."),
arrow: new TokenType("=>", beforeExpr),
template: new TokenType("template"),
invalidTemplate: new TokenType("invalidTemplate"),
ellipsis: new TokenType("...", beforeExpr),
backQuote: new TokenType("`", startsExpr),
dollarBraceL: new TokenType("${", {
beforeExpr: true,
startsExpr: true
}),
// Operators. These carry several kinds of properties to help the
// parser use them properly (the presence of these properties is
// what categorizes them as operators).
//
// `binop`, when present, specifies that this operator is a binary
// operator, and will refer to its precedence.
//
// `prefix` and `postfix` mark the operator as a prefix or postfix
// unary operator.
//
// `isAssign` marks all of `=`, `+=`, `-=` etcetera, which act as
// binary operators with a very low precedence, that should result
// in AssignmentExpression nodes.
eq: new TokenType("=", {
beforeExpr: true,
isAssign: true
}),
assign: new TokenType("_=", {
beforeExpr: true,
isAssign: true
}),
incDec: new TokenType("++/--", {
prefix: true,
postfix: true,
startsExpr: true
}),
prefix: new TokenType("!/~", {
beforeExpr: true,
prefix: true,
startsExpr: true
}),
logicalOR: binop("||", 1),
logicalAND: binop("&&", 2),
bitwiseOR: binop("|", 3),
bitwiseXOR: binop("^", 4),
bitwiseAND: binop("&", 5),
equality: binop("==/!=/===/!==", 6),
relational: binop("</>/<=/>=", 7),
bitShift: binop("<</>>/>>>", 8),
plusMin: new TokenType("+/-", {
beforeExpr: true,
binop: 9,
prefix: true,
startsExpr: true
}),
modulo: binop("%", 10),
star: binop("*", 10),
slash: binop("/", 10),
starstar: new TokenType("**", {
beforeExpr: true
}),
coalesce: binop("??", 1),
// Keyword token types.
_break: kw("break"),
_case: kw("case", beforeExpr),
_catch: kw("catch"),
_continue: kw("continue"),
_debugger: kw("debugger"),
_default: kw("default", beforeExpr),
_do: kw("do", {
isLoop: true,
beforeExpr: true
}),
_else: kw("else", beforeExpr),
_finally: kw("finally"),
_for: kw("for", {
isLoop: true
}),
_function: kw("function", startsExpr),
_if: kw("if"),
_return: kw("return", beforeExpr),
_switch: kw("switch"),
_throw: kw("throw", beforeExpr),
_try: kw("try"),
_var: kw("var"),
_const: kw("const"),
_while: kw("while", {
isLoop: true
}),
_with: kw("with"),
_new: kw("new", {
beforeExpr: true,
startsExpr: true
}),
_this: kw("this", startsExpr),
_super: kw("super", startsExpr),
_class: kw("class", startsExpr),
_extends: kw("extends", beforeExpr),
_export: kw("export"),
_import: kw("import", startsExpr),
_null: kw("null", startsExpr),
_true: kw("true", startsExpr),
_false: kw("false", startsExpr),
_in: kw("in", {
beforeExpr: true,
binop: 7
}),
_instanceof: kw("instanceof", {
beforeExpr: true,
binop: 7
}),
_typeof: kw("typeof", {
beforeExpr: true,
prefix: true,
startsExpr: true
}),
_void: kw("void", {
beforeExpr: true,
prefix: true,
startsExpr: true
}),
_delete: kw("delete", {
beforeExpr: true,
prefix: true,
startsExpr: true
})
};
// Matches a whole line break (where CRLF is considered a single
// line break). Used to count lines.
var lineBreak = /\r\n?|\n|\u2028|\u2029/;
var lineBreakG = new RegExp(lineBreak.source, "g");
function isNewLine(code) {
return code === 10 || code === 13 || code === 0x2028 || code === 0x2029;
}
function nextLineBreak(code, from, end) {
if (end === undefined) end = code.length;
for (var i = from; i < end; i++) {
var next = code.charCodeAt(i);
if (isNewLine(next)) {
return i < end - 1 && next === 13 && code.charCodeAt(i + 1) === 10 ? i + 2 : i + 1;
}
}
return -1;
}
var nonASCIIwhitespace = /[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/;
var skipWhiteSpace = /(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g;
var ref = Object.prototype;
var hasOwnProperty = ref.hasOwnProperty;
var toString = ref.toString;
var hasOwn = Object.hasOwn || function (obj, propName) {
return hasOwnProperty.call(obj, propName);
};
var isArray = _Array$isArray || function (obj) {
return toString.call(obj) === "[object Array]";
};
var regexpCache = _Object$create(null);
function wordsRegexp(words) {
return regexpCache[words] || (regexpCache[words] = new RegExp("^(?:" + words.replace(/ /g, "|") + ")$"));
}
function codePointToString(code) {
// UTF-16 Decoding
if (code <= 0xFFFF) {
return String.fromCharCode(code);
}
code -= 0x10000;
return String.fromCharCode((code >> 10) + 0xD800, (code & 1023) + 0xDC00);
}
var loneSurrogate = /(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/;
// These are used when `options.locations` is on, for the
// `startLoc` and `endLoc` properties.
var Position = function Position(line, col) {
this.line = line;
this.column = col;
};
Position.prototype.offset = function offset(n) {
return new Position(this.line, this.column + n);
};
var SourceLocation = function SourceLocation(p, start, end) {
this.start = start;
this.end = end;
if (p.sourceFile !== null) {
this.source = p.sourceFile;
}
};
// The `getLineInfo` function is mostly useful when the
// `locations` option is off (for performance reasons) and you
// want to find the line/column position for a given character
// offset. `input` should be the code string that the offset refers
// into.
function getLineInfo(input, offset) {
for (var line = 1, cur = 0;;) {
var nextBreak = nextLineBreak(input, cur, offset);
if (nextBreak < 0) {
return new Position(line, offset - cur);
}
++line;
cur = nextBreak;
}
}
// 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 (or 2015), 7 (2016), 8 (2017), 9 (2018), 10
// (2019), 11 (2020), 12 (2021), 13 (2022), 14 (2023), 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.
sourceType: "script",
// `onInsertedSemicolon` can be a callback that will be called when
// a semicolon is automatically inserted. It will be passed the
// position of the inserted semicolon as an offset, and if
// `locations` is enabled, it is given the location as a `{line,
// column}` object as second argument.
onInsertedSemicolon: null,
// `onTrailingComma` is similar to `onInsertedSemicolon`, but for
// trailing commas.
onTrailingComma: null,
// By default, reserved words are only enforced if ecmaVersion >= 5.
// Set `allowReserved` to a boolean value to explicitly turn this on
// an off. When this option has the value "never", reserved words
// and keywords can also not be used as property names.
allowReserved: null,
// When enabled, a return at the top level is not considered an
// error.
allowReturnOutsideFunction: false,
// When enabled, import/export statements are not constrained to
// 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: 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. Enabled by default when
// `ecmaVersion` >= 2023.
allowHashBang: false,
// By default, the parser will verify that private properties are
// only used in places where they are valid and have been declared.
// Set this to false to turn such checks off.
checkPrivateFields: true,
// When `locations` is on, `loc` properties holding objects with
// `start` and `end` properties in `{line, column}` form (with
// line being 1-based and column 0-based) will be attached to the
// nodes.
locations: false,
// A function can be passed as `onToken` option, which will
// cause Acorn to call that function with object in the same
// format as tokens returned from `tokenizer().getToken()`. Note
// that you are not allowed to call the parser from the
// callback—that will corrupt its internal state.
onToken: null,
// A function can be passed as `onComment` option, which will
// cause Acorn to call that function with `(block, text, start,
// end)` parameters whenever a comment is skipped. `block` is a
// boolean indicating whether this is a block (`/* */`) comment,
// `text` is the content of the comment, and `start` and `end` are
// character offsets that denote the start and end of the comment.
// When the `locations` option is on, two more parameters are
// passed, the full `{line, column}` locations of the start and
// end of the comments. Note that you are not allowed to call the
// parser from the callback—that will corrupt its internal state.
// When this option has an array as value, objects representing the
// comments are pushed to it.
onComment: null,
// Nodes have their start and end characters offsets recorded in
// `start` and `end` properties (directly on the node, rather than
// the `loc` object, which holds line/column data. To also add a
// [semi-standardized][range] `range` property holding a `[start,
// end]` array with the same numbers, set the `ranges` option to
// `true`.
//
// [range]: https://bugzilla.mozilla.org/show_bug.cgi?id=745678
ranges: false,
// It is possible to parse multiple files into a single AST by
// passing the tree produced by parsing the first file as
// `program` option in subsequent parses. This will add the
// toplevel forms of the parsed file to the `Program` (top) node
// of an existing parse tree.
program: null,
// When `locations` is on, you can pass this to record the source
// file in every node's `loc` object.
sourceFile: null,
// This value, if given, is stored in every node, whether
// `locations` is on or off.
directSourceFile: null,
// When enabled, parenthesized expressions are represented by
// (non-standard) ParenthesizedExpression nodes
preserveParens: false
};
// Interpret and default an options object
var warnedAboutEcmaVersion = false;
function getOptions(opts) {
var options = {};
for (var opt in defaultOptions) {
options[opt] = opts && hasOwn(opts, opt) ? opts[opt] : defaultOptions[opt];
}
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;
}
if (options.allowReserved == null) {
options.allowReserved = options.ecmaVersion < 5;
}
if (!opts || opts.allowHashBang == null) {
options.allowHashBang = options.ecmaVersion >= 14;
}
if (isArray(options.onToken)) {
var tokens = options.onToken;
options.onToken = function (token) {
return tokens.push(token);
};
}
if (isArray(options.onComment)) {
options.onComment = pushComment(options, options.onComment);
}
return options;
}
function pushComment(options, array) {
return function (block, text, start, end, startLoc, endLoc) {
var comment = {
type: block ? "Block" : "Line",
value: text,
start: start,
end: end
};
if (options.locations) {
comment.loc = new SourceLocation(this, startLoc, endLoc);
}
if (options.ranges) {
comment.range = [start, end];
}
array.push(comment);
};
}
// Each scope gets a bitset that may contain these flags
var SCOPE_TOP = 1,
SCOPE_FUNCTION = 2,
SCOPE_ASYNC = 4,
SCOPE_GENERATOR = 8,
SCOPE_ARROW = 16,
SCOPE_SIMPLE_CATCH = 32,
SCOPE_SUPER = 64,
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
var BIND_NONE = 0,
// Not a binding
BIND_VAR = 1,
// Var-style binding
BIND_LEXICAL = 2,
// Let- or const-style binding
BIND_FUNCTION = 3,
// Function declaration
BIND_SIMPLE_CATCH = 4,
// Simple (identifier pattern) catch binding
BIND_OUTSIDE = 5; // Special case for function names as bound inside the function
var Parser = function Parser(options, input, startPos) {
var _context3;
this.options = options = getOptions(options);
this.sourceFile = options.sourceFile;
this.keywords = wordsRegexp(keywords$1[options.ecmaVersion >= 6 ? 6 : options.sourceType === "module" ? "5module" : 5]);
var reserved = "";
if (options.allowReserved !== true) {
reserved = reservedWords[options.ecmaVersion >= 6 ? 6 : options.ecmaVersion === 5 ? 5 : 3];
if (options.sourceType === "module") {
reserved += " await";
}
}
this.reservedWords = wordsRegexp(reserved);
var reservedStrict = (reserved ? reserved + " " : "") + reservedWords.strict;
this.reservedWordsStrict = wordsRegexp(reservedStrict);
this.reservedWordsStrictBind = wordsRegexp(reservedStrict + " " + reservedWords.strictBind);
this.input = String(input);
// Used to signal to callers of `readWord1` whether the word
// contained any escape sequences. This is needed because words with
// escape sequences must not be interpreted as keywords.
this.containsEsc = false;
// Set up token state
// The current position of the tokenizer in the input.
if (startPos) {
var _context, _context2;
this.pos = startPos;
this.lineStart = _lastIndexOfInstanceProperty(_context = this.input).call(_context, "\n", startPos - 1) + 1;
this.curLine = _sliceInstanceProperty(_context2 = this.input).call(_context2, 0, this.lineStart).split(lineBreak).length;
} else {
this.pos = this.lineStart = 0;
this.curLine = 1;
}
// Properties of the current token:
// Its type
this.type = types$1.eof;
// For tokens that include more information than their type, the value
this.value = null;
// Its start and end offset
this.start = this.end = this.pos;
// And, if locations are used, the {line, column} object
// corresponding to those offsets
this.startLoc = this.endLoc = this.curPosition();
// Position information for the previous token
this.lastTokEndLoc = this.lastTokStartLoc = null;
this.lastTokStart = this.lastTokEnd = this.pos;
// The context stack is used to superficially track syntactic
// context to predict whether a regular expression is allowed in a
// given position.
this.context = this.initialContext();
this.exprAllowed = true;
// Figure out if it's a module code.
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;
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 = _Object$create(null);
// If enabled, skip leading hashbang line.
if (this.pos === 0 && options.allowHashBang && _sliceInstanceProperty(_context3 = this.input).call(_context3, 0, 2) === "#!") {
this.skipLineComment(2);
}
// Scope tracking for duplicate variable names (see scope.js)
this.scopeStack = [];
this.enterScope(SCOPE_TOP);
// For RegExp validation
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 = {
inFunction: {
configurable: true
},
inGenerator: {
configurable: true
},
inAsync: {
configurable: true
},
canAwait: {
configurable: true
},
allowSuper: {
configurable: true
},
allowDirectSuper: {
configurable: true
},
treatFunctionsAsVar: {
configurable: true
},
allowNewDotTarget: {
configurable: true
},
inClassStaticBlock: {
configurable: true
}
};
Parser.prototype.parse = function parse() {
var node = this.options.program || this.startNode();
this.nextToken();
return this.parseTopLevel(node);
};
prototypeAccessors.inFunction.get = function () {
return (_flagsInstanceProperty(this.currentVarScope()) & SCOPE_FUNCTION) > 0;
};
prototypeAccessors.inGenerator.get = function () {
return (_flagsInstanceProperty(this.currentVarScope()) & SCOPE_GENERATOR) > 0 && !this.currentVarScope().inClassFieldInit;
};
prototypeAccessors.inAsync.get = function () {
return (_flagsInstanceProperty(this.currentVarScope()) & 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 || _flagsInstanceProperty(scope) & SCOPE_CLASS_STATIC_BLOCK) {
return false;
}
if (_flagsInstanceProperty(scope) & SCOPE_FUNCTION) {
return (_flagsInstanceProperty(scope) & SCOPE_ASYNC) > 0;
}
}
return this.inModule && this.options.ecmaVersion >= 13 || this.options.allowAwaitOutsideFunction;
};
prototypeAccessors.allowSuper.get = function () {
var ref = this.currentThisScope();
var flags = _flagsInstanceProperty(ref);
var inClassFieldInit = ref.inClassFieldInit;
return (flags & SCOPE_SUPER) > 0 || inClassFieldInit || this.options.allowSuperOutsideMethod;
};
prototypeAccessors.allowDirectSuper.get = function () {
return (_flagsInstanceProperty(this.currentThisScope()) & SCOPE_DIRECT_SUPER) > 0;
};
prototypeAccessors.treatFunctionsAsVar.get = function () {
return this.treatFunctionsAsVarInScope(this.currentScope());
};
prototypeAccessors.allowNewDotTarget.get = function () {
var ref = this.currentThisScope();
var flags = _flagsInstanceProperty(ref);
var inClassFieldInit = ref.inClassFieldInit;
return (flags & (SCOPE_FUNCTION | SCOPE_CLASS_STATIC_BLOCK)) > 0 || inClassFieldInit;
};
prototypeAccessors.inClassStaticBlock.get = function () {
return (_flagsInstanceProperty(this.currentVarScope()) & SCOPE_CLASS_STATIC_BLOCK) > 0;
};
Parser.extend = function extend() {
var plugins = [],
len = arguments.length;
while (len--) plugins[len] = arguments[len];
var cls = this;
for (var i = 0; i < plugins.length; i++) {
cls = plugins[i](cls);
}
return cls;
};
Parser.parse = function parse(input, options) {
return new this(options, input).parse();
};
Parser.parseExpressionAt = function parseExpressionAt(input, pos, options) {
var parser = new this(options, input, pos);
parser.nextToken();
return parser.parseExpression();
};
Parser.tokenizer = function tokenizer(input, options) {
return new this(options, input);
};
_Object$defineProperties(Parser.prototype, prototypeAccessors);
var pp$9 = Parser.prototype;
// ## Parser utilities
var literal = /^(?:'((?:\\[^]|[^'\\])*?)'|"((?:\\[^]|[^"\\])*?)")/;
pp$9.strictDirective = function (start) {
if (this.options.ecmaVersion < 5) {
return false;
}
for (;;) {
var _context4;
// Try to find string literal.
skipWhiteSpace.lastIndex = start;
start += skipWhiteSpace.exec(this.input)[0].length;
var match = literal.exec(_sliceInstanceProperty(_context4 = this.input).call(_context4, start));
if (!match) {
return false;
}
if ((match[1] || match[2]) === "use strict") {
skipWhiteSpace.lastIndex = start + match[0].length;
var spaceAfter = skipWhiteSpace.exec(this.input),
end = spaceAfter.index + spaceAfter[0].length;
var next = this.input.charAt(end);
return next === ";" || next === "}" || lineBreak.test(spaceAfter[0]) && !(/[(`.[+\-/*%<>=,?^&]/.test(next) || next === "!" && this.input.charAt(end + 1) === "=");
}
start += match[0].length;
// Skip semicolon, if any.
skipWhiteSpace.lastIndex = start;
start += skipWhiteSpace.exec(this.input)[0].length;
if (this.input[start] === ";") {
start++;
}
}
};
// Predicate that tests whether the next token is of the given
// type, and if yes, consumes it as a side effect.
pp$9.eat = function (type) {
if (this.type === type) {
this.next();
return true;
} else {
return false;
}
};
// Tests whether parsed token is a contextual keyword.
pp$9.isContextual = function (name) {
return this.type === types$1.name && this.value === name && !this.containsEsc;
};
// Consumes contextual keyword if possible.
pp$9.eatContextual = function (name) {
if (!this.isContextual(name)) {
return false;
}
this.next();
return true;
};
// Asserts that following token is given contextual keyword.
pp$9.expectContextual = function (name) {
if (!this.eatContextual(name)) {
this.unexpected();
}
};
// Test whether a semicolon can be inserted at the current position.
pp$9.canInsertSemicolon = function () {
var _context5;
return this.type === types$1.eof || this.type === types$1.braceR || lineBreak.test(_sliceInstanceProperty(_context5 = this.input).call(_context5, this.lastTokEnd, this.start));
};
pp$9.insertSemicolon = function () {
if (this.canInsertSemicolon()) {
if (this.options.onInsertedSemicolon) {
this.options.onInsertedSemicolon(this.lastTokEnd, this.lastTokEndLoc);
}
return true;
}
};
// Consume a semicolon, or, failing that, see if we are allowed to
// pretend that there is a semicolon at this position.
pp$9.semicolon = function () {
if (!this.eat(types$1.semi) && !this.insertSemicolon()) {
this.unexpected();
}
};
pp$9.afterTrailingComma = function (tokType, notNext) {
if (this.type === tokType) {
if (this.options.onTrailingComma) {
this.options.onTrailingComma(this.lastTokStart, this.lastTokStartLoc);
}
if (!notNext) {
this.next();
}
return true;
}
};
// Expect a token of a given type. If found, consume it, otherwise,
// raise an unexpected token error.
pp$9.expect = function (type) {
this.eat(type) || this.unexpected();
};
// Raise an unexpected token error.
pp$9.unexpected = function (pos) {
this.raise(pos != null ? pos : this.start, "Unexpected token");
};
var DestructuringErrors = function DestructuringErrors() {
this.shorthandAssign = this.trailingComma = this.parenthesizedAssign = this.parenthesizedBind = this.doubleProto = -1;
};
pp$9.checkPatternErrors = function (refDestructuringErrors, isAssign) {
if (!refDestructuringErrors) {
return;
}
if (refDestructuringErrors.trailingComma > -1) {
this.raiseRecoverable(refDestructuringErrors.trailingComma, "Comma is not permitted after the rest element");
}
var parens = isAssign ? refDestructuringErrors.parenthesizedAssign : refDestructuringErrors.parenthesizedBind;
if (parens > -1) {
this.raiseRecoverable(parens, isAssign ? "Assigning to rvalue" : "Parenthesized pattern");
}
};
pp$9.checkExpressionErrors = function (refDestructuringErrors, andThrow) {
if (!refDestructuringErrors) {
return false;
}
var shorthandAssign = refDestructuringErrors.shorthandAssign;
var doubleProto = refDestructuringErrors.doubleProto;
if (!andThrow) {
return shorthandAssign >= 0 || doubleProto >= 0;
}
if (shorthandAssign >= 0) {
this.raise(shorthandAssign, "Shorthand property assignments are valid only in destructuring patterns");
}
if (doubleProto >= 0) {
this.raiseRecoverable(doubleProto, "Redefinition of __proto__ property");
}
};
pp$9.checkYieldAwaitInDefaultParams = function () {
if (this.yieldPos && (!this.awaitPos || this.yieldPos < this.awaitPos)) {
this.raise(this.yieldPos, "Yield expression cannot be a default value");
}
if (this.awaitPos) {
this.raise(this.awaitPos, "Await expression cannot be a default value");
}
};
pp$9.isSimpleAssignTarget = function (expr) {
if (expr.type === "ParenthesizedExpression") {
return this.isSimpleAssignTarget(expr.expression);
}
return expr.type === "Identifier" || expr.type === "MemberExpression";
};
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$8.parseTopLevel = function (node) {
var exports = _Object$create(null);
if (!node.body) {
node.body = [];
}
while (this.type !== types$1.eof) {
var stmt = this.parseStatement(null, true, exports);
node.body.push(stmt);
}
if (this.inModule) {
for (var i = 0, list = _Object$keys(this.undefinedExports); i < list.length; i += 1) {
var name = list[i];
this.raiseRecoverable(this.undefinedExports[name].start, "Export '" + name + "' is not defined");
}
}
this.adaptDirectivePrologue(node.body);
this.next();
node.sourceType = this.options.sourceType;
return this.finishNode(node, "Program");
};
var loopLabel = {
kind: "loop"
},
switchLabel = {
kind: "switch"
};
pp$8.isLet = function (context) {
if (this.options.ecmaVersion < 6 || !this.isContextual("let")) {
return false;
}
skipWhiteSpace.lastIndex = this.pos;
var skip = skipWhiteSpace.exec(this.input);
var next = this.pos + skip[0].length,
nextCh = this.input.charCodeAt(next);
// For ambiguous cases, determine if a LexicalDeclaration (or only a
// Statement) is allowed here. If context is not empty then only a Statement
// is allowed. However, `let [` is an explicit negative lookahead for
// ExpressionStatement, so special-case it first.
if (nextCh === 91 || nextCh === 92) {
return true;
} // '[', '\'
if (context) {
return false;
}
if (nextCh === 123 || nextCh > 0xd7ff && nextCh < 0xdc00) {
return true;
} // '{', astral
if (isIdentifierStart(nextCh, true)) {
var _context6;
var pos = next + 1;
while (isIdentifierChar(nextCh = this.input.charCodeAt(pos), true)) {
++pos;
}
if (nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) {
return true;
}
var ident = _sliceInstanceProperty(_context6 = this.input).call(_context6, next, pos);
if (!keywordRelationalOperator.test(ident)) {
return true;
}
}
return false;
};
// check 'async [no LineTerminator here] function'
// - 'async /*foo*/ function' is OK.
// - 'async /*\n*/ function' is invalid.
pp$8.isAsyncFunction = function () {
var _context7, _context8;
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,
after;
return !lineBreak.test(_sliceInstanceProperty(_context7 = this.input).call(_context7, this.pos, next)) && _sliceInstanceProperty(_context8 = this.input).call(_context8, 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
// regular expression literal. This is to handle cases like
// `if (foo) /blah/.exec(foo)`, where looking at the previous token
// does not help.
pp$8.parseStatement = function (context, topLevel, exports) {
var starttype = this.type,
node = this.startNode(),
kind;
if (this.isLet(context)) {
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
// complexity.
switch (starttype) {
case types$1._break:
case types$1._continue:
return this.parseBreakContinueStatement(node, starttype.keyword);
case types$1._debugger:
return this.parseDebuggerStatement(node);
case types$1._do:
return this.parseDoStatement(node);
case types$1._for:
return this.parseForStatement(node);
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.
if (context && (this.strict || context !== "if" && context !== "label") && this.options.ecmaVersion >= 6) {
this.unexpected();
}
return this.parseFunctionStatement(node, false, !context);
case types$1._class:
if (context) {
this.unexpected();
}
return this.parseClass(node, true);
case types$1._if:
return this.parseIfStatement(node);
case types$1._return:
return this.parseReturnStatement(node);
case types$1._switch:
return this.parseSwitchStatement(node);
case types$1._throw:
return this.parseThrowStatement(node);
case types$1._try:
return this.parseTryStatement(node);
case types$1._const:
case types$1._var:
kind = kind || this.value;
if (context && kind !== "var") {
this.unexpected();
}
return this.parseVarStatement(node, kind);
case types$1._while:
return this.parseWhileStatement(node);
case types$1._with:
return this.parseWithStatement(node);
case types$1.braceL:
return this.parseBlock(true, node);
case types$1.semi:
return this.parseEmptyStatement(node);
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,
nextCh = this.input.charCodeAt(next);
if (nextCh === 40 || nextCh === 46)
// '(' or '.'
{
return this.parseExpressionStatement(node, this.parseExpression());
}
}
if (!this.options.allowImportExportEverywhere) {
if (!topLevel) {
this.raise(this.start, "'import' and 'export' may only appear at the top level");
}
if (!this.inModule) {
this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'");
}
}
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
// next token is a colon and the expression was a simple
// Identifier node, we switch to interpreting it as a label.
default:
if (this.isAsyncFunction()) {
if (context) {
this.unexpected();
}
this.next();
return this.parseFunctionStatement(node, true, !context);
}
var maybeName = this.value,
expr = this.parseExpression();
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);
}
}
};
pp$8.parseBreakContinueStatement = function (node, keyword) {
var isBreak = keyword === "break";
this.next();
if (this.eat(types$1.semi) || this.insertSemicolon()) {
node.label = null;
} else if (this.type !== types$1.name) {
this.unexpected();
} else {
node.label = this.parseIdent();
this.semicolon();
}
// Verify that there is an actual destination to break or
// continue to.
var i = 0;
for (; i < this.labels.length; ++i) {
var lab = this.labels[i];
if (node.label == null || lab.name === node.label.name) {
if (lab.kind != null && (isBreak || lab.kind === "loop")) {
break;
}
if (node.label && isBreak) {
break;
}
}
}
if (i === this.labels.length) {
this.raise(node.start, "Unsyntactic " + keyword);
}
return this.finishNode(node, isBreak ? "BreakStatement" : "ContinueStatement");
};
pp$8.parseDebuggerStatement = function (node) {
this.next();
this.semicolon();
return this.finishNode(node, "DebuggerStatement");
};
pp$8.parseDoStatement = function (node) {
this.next();
this.labels.push(loopLabel);
node.body = this.parseStatement("do");
this.labels.pop();
this.expect(types$1._while);
node.test = this.parseParenExpression();
if (this.options.ecmaVersion >= 6) {
this.eat(types$1.semi);
} else {
this.semicolon();
}
return this.finishNode(node, "DoWhileStatement");
};
// Disambiguating between a `for` and a `for`/`in` or `for`/`of`
// loop is non-trivial. Basically, we have to parse the init `var`
// statement or expression, disallowing the `in` operator (see
// the second parameter to `parseExpression`), and then check
// whether the next token is `in` or `of`. When there is no init
// part (semicolon immediately after the opening parenthesis), it
// is a regular `for` loop.
pp$8.parseForStatement = function (node) {
this.next();
var awaitAt = this.options.ecmaVersion >= 9 && this.canAwait && this.eatContextual("await") ? this.lastTokStart : -1;
this.labels.push(loopLabel);
this.enterScope(0);
this.expect(types$1.parenL);
if (this.type === types$1.semi) {
if (awaitAt > -1) {
this.unexpected(awaitAt);
}
return this.parseFor(node, null);
}
var isLet = this.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$1._in || this.options.ecmaVersion >= 6 && this.isContextual("of")) && init$1.declarations.length === 1) {
if (this.options.ecmaVersion >= 9) {
if (this.type === types$1._in) {
if (awaitAt > -1) {
this.unexpected(awaitAt);
}
} else {
node.await = awaitAt > -1;
}
}
return this.parseForIn(node, init$1);
}
if (awaitAt > -1) {
this.unexpected(awaitAt);
}
return this.parseFor(node, init$1);
}
var startsWithLet = this.isContextual("let"),
isForOf = false;
var containsEsc = this.containsEsc;
var refDestructuringErrors = new DestructuringErrors();
var initPos = this.start;
var init = awaitAt > -1 ? this.parseExprSubscripts(refDestructuringErrors, "await") : this.parseExpression(true, refDestructuringErrors);
if (this.type === types$1._in || (isForOf = this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
if (awaitAt > -1) {
// implies `ecmaVersion >= 9` (see declaration of awaitAt)
if (this.type === types$1._in) {
this.unexpected(awaitAt);
}
node.await = true;
} else if (isForOf && this.options.ecmaVersion >= 8) {
if (init.start === initPos && !containsEsc && init.type === "Identifier" && init.name === "async") {
this.unexpected();
} else if (this.options.ecmaVersion >= 9) {
node.await = false;
}
}
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.checkLValPattern(init);
return this.parseForIn(node, init);
} else {
this.checkExpressionErrors(refDestructuringErrors, true);
}
if (awaitAt > -1) {
this.unexpected(awaitAt);
}
return this.parseFor(node, init);
};
pp$8.parseFunctionStatement = function (node, isAsync, declarationPosition) {
this.next();
return this.parseFunction(node, FUNC_STATEMENT | (declarationPosition ? 0 : FUNC_HANGING_STATEMENT), false, isAsync);
};
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$1._else) ? this.parseStatement("if") : null;
return this.finishNode(node, "IfStatement");
};
pp$8.parseReturnStatement = function (node) {
if (!this.inFunction && !this.options.allowReturnOutsideFunction) {
this.raise(this.start, "'return' outside of function");
}
this.next();
// In `return` (and `break`/`continue`), the keywords with
// optional arguments, we eagerly look for a semicolon or the
// possibility to insert one.
if (this.eat(types$1.semi) || this.insertSemicolon()) {
node.argument = null;
} else {
node.argument = this.parseExpression();
this.semicolon();
}
return this.finishNode(node, "ReturnStatement");
};
pp$8.parseSwitchStatement = function (node) {
this.next();
node.discriminant = this.parseParenExpression();
node.cases = [];
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
// adding statements to.
var cur;
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");
}
node.cases.push(cur = this.startNode());
cur.consequent = [];
this.next();
if (isCase) {
cur.test = this.parseExpression();
} else {
if (sawDefault) {
this.raiseRecoverable(this.lastTokStart, "Multiple default clauses");
}
sawDefault = true;
cur.test = null;
}
this.expect(types$1.colon);
} else {
if (!cur) {
this.unexpected();
}
cur.consequent.push(this.parseStatement(null));
}
}
this.exitScope();
if (cur) {
this.finishNode(cur, "SwitchCase");
}
this.next(); // Closing brace
this.labels.pop();
return this.finishNode(node, "SwitchStatement");
};
pp$8.parseThrowStatement = function (node) {
var _context9;
this.next();
if (lineBreak.test(_sliceInstanceProperty(_context9 = this.input).call(_context9, this.lastTokEnd, this.start))) {
this.raise(this.lastTokEnd, "Illegal newline after throw");
}
node.argument = this.parseExpression();
this.semicolon();
return this.finishNode(node, "ThrowStatement");
};
// Reused empty array added for node fields that are always empty.
var empty$1 = [];
pp$8.parseCatchClauseParam = function () {
var param = this.parseBindingAtom();
var simple = param.type === "Identifier";
this.enterScope(simple ? SCOPE_SIMPLE_CATCH : 0);
this.checkLValPattern(param, simple ? BIND_SIMPLE_CATCH : BIND_LEXICAL);
this.expect(types$1.parenR);
return param;
};
pp$8.parseTryStatement = function (node) {
this.next();
node.block = this.parseBlock();
node.handler = null;
if (this.type === types$1._catch) {
var clause = this.startNode();
this.next();
if (this.eat(types$1.parenL)) {
clause.param = this.parseCatchClauseParam();
} else {
if (this.options.ecmaVersion < 10) {
this.unexpected();
}
clause.param = null;
this.enterScope(0);
}
clause.body = this.parseBlock(false);
this.exitScope();
node.handler = this.finishNode(clause, "CatchClause");
}
node.finalizer = this.eat(types$1._finally) ? this.parseBlock() : null;
if (!node.handler && !node.finalizer) {
this.raise(node.start, "Missing catch or finally clause");
}
return this.finishNode(node, "TryStatement");
};
pp$8.parseVarStatement = function (node, kind, allowMissingInitializer) {
this.next();
this.parseVar(node, false, kind, allowMissingInitializer);
this.semicolon();
return this.finishNode(node, "VariableDeclaration");
};
pp$8.parseWhileStatement = function (node) {
this.next();
node.test = this.parseParenExpression();
this.labels.push(loopLabel);
node.body = this.parseStatement("while");
this.labels.pop();
return this.finishNode(node, "WhileStatement");
};
pp$8.parseWithStatement = function (node) {
if (this.strict) {
this.raise(this.start, "'with' in strict mode");
}
this.next();
node.object = this.parseParenExpression();
node.body = this.parseStatement("with");
return this.finishNode(node, "WithStatement");
};
pp$8.parseEmptyStatement = function (node) {
this.next();
return this.finishNode(node, "EmptyStatement");
};
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];
if (label.name === maybeName) {
this.raise(expr.start, "Label '" + maybeName + "' is already declared");
}
}
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];
if (label$1.statementStart === node.start) {
// Update information about previous labels on this node
label$1.statementStart = this.start;
label$1.kind = kind;
} else {
break;
}
}
this.labels.push({
name: maybeName,
kind: kind,
statementStart: this.start
});
node.body = this.parseStatement(context ? _indexOfInstanceProperty(context).call(context, "label") === -1 ? context + "label" : context : "label");
this.labels.pop();
node.label = expr;
return this.finishNode(node, "LabeledStatement");
};
pp$8.parseExpressionStatement = function (node, expr) {
node.expression = expr;
this.semicolon();
return this.finishNode(node, "ExpressionStatement");
};
// Parse a semicolon-enclosed block of statements, handling `"use
// strict"` declarations when `allowStrict` is true (used for
// function bodies).
pp$8.parseBlock = function (createNewLexicalScope, node, exitStrict) {
if (createNewLexicalScope === undefined) createNewLexicalScope = true;
if (node === undefined) node = this.startNode();
node.body = [];
this.expect(types$1.braceL);
if (createNewLexicalScope) {
this.enterScope(0);
}
while (this.type !== types$1.braceR) {
var stmt = this.parseStatement(null);
node.body.push(stmt);
}
if (exitStrict) {
this.strict = false;
}
this.next();
if (createNewLexicalScope) {
this.exitScope();
}
return this.finishNode(node, "BlockStatement");
};
// Parse a regular `for` loop. The disambiguation code in
// `parseStatement` will already have parsed the init statement or
// expression.
pp$8.parseFor = function (node, init) {
node.init = init;
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();
return this.finishNode(node, "ForStatement");
};
// Parse a `for`/`in` and `for`/`of` loop, which are almost
// same from parser's perspective.
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");
}
node.left = init;
node.right = isForIn ? this.parseExpression() : this.parseMaybeAssign();
this.expect(types$1.parenR);
node.body = this.parseStatement("for");
this.exitScope();
this.labels.pop();
return this.finishNode(node, isForIn ? "ForInStatement" : "ForOfStatement");
};
// Parse a list of variable declarations.
pp$8.parseVar = function (node, isFor, kind, allowMissingInitializer) {
node.declarations = [];
node.kind = kind;
for (;;) {
var decl = this.startNode();
this.parseVarId(decl, kind);
if (this.eat(types$1.eq)) {
decl.init = this.parseMaybeAssign(isFor);
} else if (!allowMissingInitializer && kind === "const" && !(this.type === types$1._in || this.options.ecmaVersion >= 6 && this.isContextual("of"))) {
this.unexpected();
} else if (!allowMissingInitializer && 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;
}
node.declarations.push(this.finishNode(decl, "VariableDeclarator"));
if (!this.eat(types$1.comma)) {
break;
}
}
return node;
};
pp$8.parseVarId = function (decl, kind) {
decl.id = this.parseBindingAtom();
this.checkLValPattern(decl.id, kind === "var" ? BIND_VAR : BIND_LEXICAL, false);
};
var FUNC_STATEMENT = 1,
FUNC_HANGING_STATEMENT = 2,
FUNC_NULLABLE_ID = 4;
// Parse a function declaration or literal (depending on the
// `statement & FUNC_STATEMENT`).
// Remove `allowExpressionBody` for 7.0.0, as it is only called with false
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$1.star && statement & FUNC_HANGING_STATEMENT) {
this.unexpected();
}
node.generator = this.eat(types$1.star);
}
if (this.options.ecmaVersion >= 8) {
node.async = !!isAsync;
}
if (statement & FUNC_STATEMENT) {
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.checkLValSimple(node.id, this.strict || node.generator || node.async ? this.treatFunctionsAsVar ? BIND_VAR : BIND_LEXICAL : BIND_FUNCTION);
}
}
var oldYieldPos = this.yieldPos,
oldAwaitPos = this.awaitPos,
oldAwaitIdentPos = this.awaitIdentPos;
this.yieldPos = 0;
this.awaitPos = 0;
this.awaitIdentPos = 0;
this.enterScope(functionFlags(node.async, node.generator));
if (!(statement & FUNC_STATEMENT)) {
node.id = this.type === types$1.name ? this.parseIdent() : null;
}
this.parseFunctionParams(node);
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$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$8.parseClass = function (node, isStatement) {
this.next();
// ecma-262 14.6 Class Definitions
// A class definition is always strict mode code.
var oldStrict = this.strict;
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$1.braceL);
while (this.type !== types$1.braceR) {
var element = this.parseClassElement(node.superClass !== null);
if (element) {
classBody.body.push(element);
if (element.type === "MethodDefinition" && element.kind === "constructor") {
if (hadConstructor) {
this.raiseRecoverable(element.start, "Duplicate constructor in the same class");
}
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");
}
}
}
this.strict = oldStrict;
this.next();
node.body = this.finishNode(classBody, "ClassBody");
this.exitClassBody();
return this.finishNode(node, isStatement ? "ClassDeclaration" : "ClassExpression");
};
pp$8.parseClassElement = function (constructorAllowsSuper) {
if (this.eat(types$1.semi)) {
return null;
}
var ecmaVersion = this.options.ecmaVersion;
var node = this.startNode();
var keyName = "";
var isGenerator = false;
var isAsync = false;
var kind = "method";
var isStatic = false;
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;
} else {
keyName = "async";
}
}
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;
if (method.kind === "constructor") {
if (isGenerator) {
this.raise(key.start, "Constructor can't be a generator");
}
if (isAsync) {
this.raise(key.start, "Constructor can't be an async method");
}
} 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");
}
if (method.kind === "set" && value.params.length !== 1) {
this.raiseRecoverable(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");
}
return this.finishNode(method, "MethodDefinition");
};
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.checkLValSimple(node.id, BIND_LEXICAL, false);
}
} else {
if (isStatement === true) {
this.unexpected();
}
node.id = null;
}
};
pp$8.parseClassSuper = function (node) {
node.superClass = this.eat(types$1._extends) ? this.parseExprSubscripts(null, 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;
if (!this.options.checkPrivateFields) {
return;
}
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 (!hasOwn(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.
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.parseExportAllDeclaration = function (node, exports) {
if (this.options.ecmaVersion >= 11) {
if (this.eatContextual("as")) {
node.exported = this.parseModuleExportName();
this.checkExport(exports, node.exported, this.lastTokStart);
} else {
node.exported = null;
}
}
this.expectContextual("from");
if (this.type !== types$1.string) {
this.unexpected();
}
node.source = this.parseExprAtom();
if (this.options.ecmaVersion >= 16) {
node.attributes = this.parseWithClause();
}
this.semicolon();
return this.finishNode(node, "ExportAllDeclaration");
};
pp$8.parseExport = function (node, exports) {
this.next();
// export * from '...'
if (this.eat(types$1.star)) {
return this.parseExportAllDeclaration(node, exports);
}
if (this.eat(types$1._default)) {
// export default ...
this.checkExport(exports, "default", this.lastTokStart);
node.declaration = this.parseExportDefaultDeclaration();
return this.finishNode(node, "ExportDefaultDeclaration");
}
// export var|const|let|function|class ...
if (this.shouldParseExportStatement()) {
node.declaration = this.parseExportDeclaration(node);
if (node.declaration.type === "VariableDeclaration") {
this.checkVariableExport(exports, node.declaration.declarations);
} else {
this.checkExport(exports, node.declaration.id, node.declaration.id.start);
}
node.specifiers = [];
node.source = null;
} else {
// export { x, y as z } [from '...']
node.declaration = null;
node.specifiers = this.parseExportSpecifiers(exports);
if (this.eatContextual("from")) {
if (this.type !== types$1.string) {
this.unexpected();
}
node.source = this.parseExprAtom();
if (this.options.ecmaVersion >= 16) {
node.attributes = this.parseWithClause();
}
} else {
for (var i = 0, list = node.specifiers; i < list.length; i += 1) {
// check for keywords used as local names
var spec = list[i];
this.checkUnreserved(spec.local);
// check if export is defined
this.checkLocalExport(spec.local);
if (spec.local.type === "Literal") {
this.raise(spec.local.start, "A string literal cannot be used as an exported binding without `from`.");
}
}
node.source = null;
}
this.semicolon();
}
return this.finishNode(node, "ExportNamedDeclaration");
};
pp$8.parseExportDeclaration = function (node) {
return this.parseStatement(null);
};
pp$8.parseExportDefaultDeclaration = function () {
var isAsync;
if (this.type === types$1._function || (isAsync = this.isAsyncFunction())) {
var fNode = this.startNode();
this.next();
if (isAsync) {
this.next();
}
return this.parseFunction(fNode, FUNC_STATEMENT | FUNC_NULLABLE_ID, false, isAsync);
} else if (this.type === types$1._class) {
var cNode = this.startNode();
return this.parseClass(cNode, "nullableID");
} else {
var declaration = this.parseMaybeAssign();
this.semicolon();
return declaration;
}
};
pp$8.checkExport = function (exports, name, pos) {
if (!exports) {
return;
}
if (typeof name !== "string") {
name = name.type === "Identifier" ? name.name : name.value;
}
if (hasOwn(exports, name)) {
this.raiseRecoverable(pos, "Duplicate export '" + name + "'");
}
exports[name] = true;
};
pp$8.checkPatternExport = function (exports, pat) {
var type = pat.type;
if (type === "Identifier") {
this.checkExport(exports, pat, pat.start);
} else if (type === "ObjectPattern") {
for (var i = 0, list = pat.properties; i < list.length; i += 1) {
var prop = list[i];
this.checkPatternExport(exports, prop);
}
} else if (type === "ArrayPattern") {
for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
var elt = list$1[i$1];
if (elt) {
this.checkPatternExport(exports, elt);
}
}
} else if (type === "Property") {
this.checkPatternExport(exports, pat.value);
} else if (type === "AssignmentPattern") {
this.checkPatternExport(exports, pat.left);
} else if (type === "RestElement") {
this.checkPatternExport(exports, pat.argument);
}
};
pp$8.checkVariableExport = function (exports, decls) {
if (!exports) {
return;
}
for (var i = 0, list = decls; i < list.length; i += 1) {
var decl = list[i];
this.checkPatternExport(exports, decl.id);
}
};
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$8.parseExportSpecifier = function (exports) {
var node = this.startNode();
node.local = this.parseModuleExportName();
node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
this.checkExport(exports, node.exported, node.exported.start);
return this.finishNode(node, "ExportSpecifier");
};
pp$8.parseExportSpecifiers = function (exports) {
var nodes = [],
first = true;
// export { x, y as z } [from '...']
this.expect(types$1.braceL);
while (!this.eat(types$1.braceR)) {
if (!first) {
this.expect(types$1.comma);
if (this.afterTrailingComma(types$1.braceR)) {
break;
}
} else {
first = false;
}
nodes.push(this.parseExportSpecifier(exports));
}
return nodes;
};
// Parses import declaration.
pp$8.parseImport = function (node) {
this.next();
// import '...'
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$1.string ? this.parseExprAtom() : this.unexpected();
}
if (this.options.ecmaVersion >= 16) {
node.attributes = this.parseWithClause();
}
this.semicolon();
return this.finishNode(node, "ImportDeclaration");
};
// Parses a comma-separated list of module imports.
pp$8.parseImportSpecifier = function () {
var node = this.startNode();
node.imported = this.parseModuleExportName();
if (this.eatContextual("as")) {
node.local = this.parseIdent();
} else {
this.checkUnreserved(node.imported);
node.local = node.imported;
}
this.checkLValSimple(node.local, BIND_LEXICAL);
return this.finishNode(node, "ImportSpecifier");
};
pp$8.parseImportDefaultSpecifier = function () {
// import defaultObj, { x, y as z } from '...'
var node = this.startNode();
node.local = this.parseIdent();
this.checkLValSimple(node.local, BIND_LEXICAL);
return this.finishNode(node, "ImportDefaultSpecifier");
};
pp$8.parseImportNamespaceSpecifier = function () {
var node = this.startNode();
this.next();
this.expectContextual("as");
node.local = this.parseIdent();
this.checkLValSimple(node.local, BIND_LEXICAL);
return this.finishNode(node, "ImportNamespaceSpecifier");
};
pp$8.parseImportSpecifiers = function () {
var nodes = [],
first = true;
if (this.type === types$1.name) {
nodes.push(this.parseImportDefaultSpecifier());
if (!this.eat(types$1.comma)) {
return nodes;
}
}
if (this.type === types$1.star) {
nodes.push(this.parseImportNamespaceSpecifier());
return nodes;
}
this.expect(types$1.braceL);
while (!this.eat(types$1.braceR)) {
if (!first) {
this.expect(types$1.comma);
if (this.afterTrailingComma(types$1.braceR)) {
break;
}
} else {
first = false;
}
nodes.push(this.parseImportSpecifier());
}
return nodes;
};
pp$8.parseWithClause = function () {
var nodes = [];
if (!this.eat(types$1._with)) {
return nodes;
}
this.expect(types$1.braceL);
var attributeKeys = {};
var first = true;
while (!this.eat(types$1.braceR)) {
if (!first) {
this.expect(types$1.comma);
if (this.afterTrailingComma(types$1.braceR)) {
break;
}
} else {
first = false;
}
var attr = this.parseImportAttribute();
var keyName = attr.key.type === "Identifier" ? attr.key.name : attr.key.value;
if (hasOwn(attributeKeys, keyName)) {
this.raiseRecoverable(attr.key.start, "Duplicate attribute key '" + keyName + "'");
}
attributeKeys[keyName] = true;
nodes.push(attr);
}
return nodes;
};
pp$8.parseImportAttribute = function () {
var node = this.startNode();
node.key = this.type === types$1.string ? this.parseExprAtom() : this.parseIdent(this.options.allowReserved !== "never");
this.expect(types$1.colon);
if (this.type !== types$1.string) {
this.unexpected();
}
node.value = this.parseExprAtom();
return this.finishNode(node, "ImportAttribute");
};
pp$8.parseModuleExportName = function () {
if (this.options.ecmaVersion >= 13 && this.type === types$1.string) {
var stringLiteral = this.parseLiteral(this.value);
if (loneSurrogate.test(stringLiteral.value)) {
this.raise(stringLiteral.start, "An export name cannot include a lone surrogate.");
}
return stringLiteral;
}
return this.parseIdent(true);
};
// Set `ExpressionStatement#directive` property for directive prologues.
pp$8.adaptDirectivePrologue = function (statements) {
for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) {
var _context0;
statements[i].directive = _sliceInstanceProperty(_context0 = statements[i].expression.raw).call(_context0, 1, -1);
}
};
pp$8.isDirectiveCandidate = function (statement) {
return this.options.ecmaVersion >= 5 && 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$7 = Parser.prototype;
// Convert existing expression atom to assignable pattern
// if possible.
pp$7.toAssignable = function (node, isBinding, refDestructuringErrors) {
if (this.options.ecmaVersion >= 6 && node) {
switch (node.type) {
case "Identifier":
if (this.inAsync && node.name === "await") {
this.raise(node.start, "Cannot use 'await' as identifier inside an async function");
}
break;
case "ObjectPattern":
case "ArrayPattern":
case "AssignmentPattern":
case "RestElement":
break;
case "ObjectExpression":
node.type = "ObjectPattern";
if (refDestructuringErrors) {
this.checkPatternErrors(refDestructuringErrors, true);
}
for (var i = 0, list = node.properties; i < list.length; i += 1) {
var prop = list[i];
this.toAssignable(prop, isBinding);
// Early error:
// AssignmentRestProperty[Yield, Await] :
// `...` DestructuringAssignmentTarget[Yield, Await]
//
// It is a Syntax Error if |DestructuringAssignmentTarget| is an |ArrayLiteral| or an |ObjectLiteral|.
if (prop.type === "RestElement" && (prop.argument.type === "ArrayPattern" || prop.argument.type === "ObjectPattern")) {
this.raise(prop.argument.start, "Unexpected token");
}
}
break;
case "Property":
// AssignmentProperty has type === "Property"
if (node.kind !== "init") {
this.raise(node.key.start, "Object pattern can't contain getter or setter");
}
this.toAssignable(node.value, isBinding);
break;
case "ArrayExpression":
node.type = "ArrayPattern";
if (refDestructuringErrors) {
this.checkPatternErrors(refDestructuringErrors, true);
}
this.toAssignableList(node.elements, isBinding);
break;
case "SpreadElement":
node.type = "RestElement";
this.toAssignable(node.argument, isBinding);
if (node.argument.type === "AssignmentPattern") {
this.raise(node.argument.start, "Rest elements cannot have a default value");
}
break;
case "AssignmentExpression":
if (node.operator !== "=") {
this.raise(node.left.end, "Only '=' operator can be used for specifying default value.");
}
node.type = "AssignmentPattern";
delete node.operator;
this.toAssignable(node.left, isBinding);
break;
case "ParenthesizedExpression":
this.toAssignable(node.expression, isBinding, refDestructuringErrors);
break;
case "ChainExpression":
this.raiseRecoverable(node.start, "Optional chaining cannot appear in left-hand side");
break;
case "MemberExpression":
if (!isBinding) {
break;
}
default:
this.raise(node.start, "Assigning to rvalue");
}
} else if (refDestructuringErrors) {
this.checkPatternErrors(refDestructuringErrors, true);
}
return node;
};
// Convert list of expression atoms to binding list.
pp$7.toAssignableList = function (exprList, isBinding) {
var end = exprList.length;
for (var i = 0; i < end; i++) {
var elt = exprList[i];
if (elt) {
this.toAssignable(elt, isBinding);
}
}
if (end) {
var last = exprList[end - 1];
if (this.options.ecmaVersion === 6 && isBinding && last && last.type === "RestElement" && last.argument.type !== "Identifier") {
this.unexpected(last.argument.start);
}
}
return exprList;
};
// Parses spread element.
pp$7.parseSpread = function (refDestructuringErrors) {
var node = this.startNode();
this.next();
node.argument = this.parseMaybeAssign(false, refDestructuringErrors);
return this.finishNode(node, "SpreadElement");
};
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$1.name) {
this.unexpected();
}
node.argument = this.parseBindingAtom();
return this.finishNode(node, "RestElement");
};
// Parses lvalue (assignable) atom.
pp$7.parseBindingAtom = function () {
if (this.options.ecmaVersion >= 6) {
switch (this.type) {
case types$1.bracketL:
var node = this.startNode();
this.next();
node.elements = this.parseBindingList(types$1.bracketR, true, true);
return this.finishNode(node, "ArrayPattern");
case types$1.braceL:
return this.parseObj(true);
}
}
return this.parseIdent();
};
pp$7.parseBindingList = function (close, allowEmpty, allowTrailingComma, allowModifiers) {
var elts = [],
first = true;
while (!this.eat(close)) {
if (first) {
first = false;
} else {
this.expect(types$1.comma);
}
if (allowEmpty && this.type === types$1.comma) {
elts.push(null);
} else if (allowTrailingComma && this.afterTrailingComma(close)) {
break;
} else if (this.type === types$1.ellipsis) {
var rest = this.parseRestBinding();
this.parseBindingListItem(rest);
elts.push(rest);
if (this.type === types$1.comma) {
this.raiseRecoverable(this.start, "Comma is not permitted after the rest element");
}
this.expect(close);
break;
} else {
elts.push(this.parseAssignableListItem(allowModifiers));
}
}
return elts;
};
pp$7.parseAssignableListItem = function (allowModifiers) {
var elem = this.parseMaybeDefault(this.start, this.startLoc);
this.parseBindingListItem(elem);
return elem;
};
pp$7.parseBindingListItem = function (param) {
return param;
};
// Parses assignment pattern around given atom if possible.
pp$7.parseMaybeDefault = function (startPos, startLoc, left) {
left = left || this.parseBindingAtom();
if (this.options.ecmaVersion < 6 || !this.eat(types$1.eq)) {
return left;
}
var node = this.startNodeAt(startPos, startLoc);
node.left = left;
node.right = this.parseMaybeAssign();
return this.finishNode(node, "AssignmentPattern");
};
// 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$7.checkLValSimple = function (expr, bindingType, checkClashes) {
if (bindingType === undefined) bindingType = BIND_NONE;
var isBind = bindingType !== BIND_NONE;
switch (expr.type) {
case "Identifier":
if (this.strict && this.reservedWordsStrictBind.test(expr.name)) {
this.raiseRecoverable(expr.start, (isBind ? "Binding " : "Assigning to ") + expr.name + " in strict mode");
}
if (isBind) {
if (bindingType === BIND_LEXICAL && expr.name === "let") {
this.raiseRecoverable(expr.start, "let is disallowed as a lexically bound name");
}
if (checkClashes) {
if (hasOwn(checkClashes, expr.name)) {
this.raiseRecoverable(expr.start, "Argument name clash");
}
checkClashes[expr.name] = true;
}
if (bindingType !== BIND_OUTSIDE) {
this.declareName(expr.name, bindingType, expr.start);
}
}
break;
case "ChainExpression":
this.raiseRecoverable(expr.start, "Optional chaining cannot appear in left-hand side");
break;
case "MemberExpression":
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 === undefined) 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.checkLValInnerPattern(prop, 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.checkLValInnerPattern(elem, bindingType, checkClashes);
}
}
break;
default:
this.checkLValSimple(expr, bindingType, checkClashes);
}
};
pp$7.checkLValInnerPattern = function (expr, bindingType, checkClashes) {
if (bindingType === undefined) bindingType = BIND_NONE;
switch (expr.type) {
case "Property":
// AssignmentProperty has type === "Property"
this.checkLValInnerPattern(expr.value, bindingType, checkClashes);
break;
case "AssignmentPattern":
this.checkLValPattern(expr.left, bindingType, checkClashes);
break;
case "RestElement":
this.checkLValPattern(expr.argument, bindingType, checkClashes);
break;
default:
this.checkLValPattern(expr, bindingType, checkClashes);
}
};
// The algorithm used to determine whether a regexp can appear at a
// given point in the program is loosely based on sweet.js' approach.
// See https://github.com/mozilla/sweet.js/wiki/design
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) {
var _context1;
return lineBreak.test(_sliceInstanceProperty(_context1 = this.input).call(_context1, 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 edge cases when token context could not be inferred correctly during tokenization 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) {
var _context10;
if (prevType.beforeExpr && prevType !== types$1._else && !(prevType === types$1.semi && this.curContext() !== types.p_stat) && !(prevType === types$1._return && lineBreak.test(_sliceInstanceProperty(_context10 = this.input).call(_context10, 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.colon.updateContext = function () {
if (this.curContext().token === "function") {
this.context.pop();
}
this.exprAllowed = true;
};
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
// syntactic elements, and recursively calling those, each function
// advancing the input stream and returning an AST node. Precedence
// of constructs (for example, the fact that `!x[1]` means `!(x[1])`
// instead of `(!x)[1]` is handled by the fact that the parser
// function that parses unary prefix operators is called first, and
// in turn calls the function that parses `[]` subscripts — that
// way, it'll receive the node for `x[1]` already parsed, and wraps
// *that* in the unary operator node.
//
// Acorn uses an [operator precedence parser][opp] to handle binary
// operator precedence, because it is much more compact than using
// the technique outlined above, which uses different, nesting
// functions to specify precedence, for all of the ten binary
// precedence levels that JavaScript defines.
//
// [opp]: http://en.wikipedia.org/wiki/Operator-precedence_parser
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$5.checkPropClash = function (prop, propHash, refDestructuringErrors) {
if (this.options.ecmaVersion >= 9 && prop.type === "SpreadElement") {
return;
}
if (this.options.ecmaVersion >= 6 && (prop.computed || prop.method || prop.shorthand)) {
return;
}
var key = prop.key;
var name;
switch (key.type) {
case "Identifier":
name = key.name;
break;
case "Literal":
name = String(key.value);
break;
default:
return;
}
var kind = prop.kind;
if (this.options.ecmaVersion >= 6) {
if (name === "__proto__" && kind === "init") {
if (propHash.proto) {
if (refDestructuringErrors) {
if (refDestructuringErrors.doubleProto < 0) {
refDestructuringErrors.doubleProto = key.start;
}
} else {
this.raiseRecoverable(key.start, "Redefinition of __proto__ property");
}
}
propHash.proto = true;
}
return;
}
name = "$" + name;
var other = propHash[name];
if (other) {
var redefinition;
if (kind === "init") {
redefinition = this.strict && other.init || other.get || other.set;
} else {
redefinition = other.init || other[kind];
}
if (redefinition) {
this.raiseRecoverable(key.start, "Redefinition of property");
}
} else {
other = propHash[name] = {
init: false,
get: false,
set: false
};
}
other[kind] = true;
};
// ### Expression parsing
// These nest, from the most general expression type at the top to
// 'atomic', nondivisible expression types at the bottom. Most of
// the functions will simply let the function(s) below them parse,
// and, *if* the syntactic construct they handle is present, wrap
// the AST node that the inner parser gave them in another node.
// Parse a full expression. The optional arguments are used to
// forbid the `in` operator (in for loops initalization expressions)
// and provide reference for storing '=' operator inside shorthand
// property assignment in contexts where both object expression
// and object pattern might appear (so it's possible to raise
// delayed syntax error at correct position).
pp$5.parseExpression = function (forInit, refDestructuringErrors) {
var startPos = this.start,
startLoc = this.startLoc;
var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
if (this.type === types$1.comma) {
var node = this.startNodeAt(startPos, startLoc);
node.expressions = [expr];
while (this.eat(types$1.comma)) {
node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors));
}
return this.finishNode(node, "SequenceExpression");
}
return expr;
};
// Parse an assignment expression. This includes applications of
// operators like `+=`.
pp$5.parseMaybeAssign = function (forInit, refDestructuringErrors, afterLeftParse) {
if (this.isContextual("yield")) {
if (this.inGenerator) {
return this.parseYield(forInit);
}
// The tokenizer will assume an expression is allowed after
// `yield`, but this isn't that kind of yield
else {
this.exprAllowed = false;
}
}
var ownDestructuringErrors = false,
oldParenAssign = -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();
ownDestructuringErrors = true;
}
var startPos = this.start,
startLoc = this.startLoc;
if (this.type === types$1.parenL || this.type === types$1.name) {
this.potentialArrowAt = this.start;
this.potentialArrowInForAwait = forInit === "await";
}
var left = this.parseMaybeConditional(forInit, refDestructuringErrors);
if (afterLeftParse) {
left = afterLeftParse.call(this, left, startPos, startLoc);
}
if (this.type.isAssign) {
var node = this.startNodeAt(startPos, startLoc);
node.operator = this.value;
if (this.type === types$1.eq) {
left = this.toAssignable(left, false, refDestructuringErrors);
}
if (!ownDestructuringErrors) {
refDestructuringErrors.parenthesizedAssign = refDestructuringErrors.trailingComma = refDestructuringErrors.doubleProto = -1;
}
if (refDestructuringErrors.shorthandAssign >= left.start) {
refDestructuringErrors.shorthandAssign = -1;
} // reset because shorthand default was used correctly
if (this.type === types$1.eq) {
this.checkLValPattern(left);
} else {
this.checkLValSimple(left);
}
node.left = left;
this.next();
node.right = this.parseMaybeAssign(forInit);
if (oldDoubleProto > -1) {
refDestructuringErrors.doubleProto = oldDoubleProto;
}
return this.finishNode(node, "AssignmentExpression");
} else {
if (ownDestructuringErrors) {
this.checkExpressionErrors(refDestructuringErrors, true);
}
}
if (oldParenAssign > -1) {
refDestructuringErrors.parenthesizedAssign = oldParenAssign;
}
if (oldTrailingComma > -1) {
refDestructuringErrors.trailingComma = oldTrailingComma;
}
return left;
};
// Parse a ternary conditional (`?:`) operator.
pp$5.parseMaybeConditional = function (forInit, refDestructuringErrors) {
var startPos = this.start,
startLoc = this.startLoc;
var expr = this.parseExprOps(forInit, refDestructuringErrors);
if (this.checkExpressionErrors(refDestructuringErrors)) {
return expr;
}
if (this.eat(types$1.question)) {
var node = this.startNodeAt(startPos, startLoc);
node.test = expr;
node.consequent = this.parseMaybeAssign();
this.expect(types$1.colon);
node.alternate = this.parseMaybeAssign(forInit);
return this.finishNode(node, "ConditionalExpression");
}
return expr;
};
// Start the precedence parser.
pp$5.parseExprOps = function (forInit, refDestructuringErrors) {
var startPos = this.start,
startLoc = this.startLoc;
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, 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
// defer further parser to one of its callers when it encounters an
// operator that has a lower precedence than the set it is parsing.
pp$5.parseExprOp = function (left, leftStartPos, leftStartLoc, minPrec, forInit) {
var prec = this.type.binop;
if (prec != null && (!forInit || this.type !== types$1._in)) {
if (prec > minPrec) {
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$1.logicalAND.binop;
}
var op = this.value;
this.next();
var startPos = this.start,
startLoc = this.startLoc;
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$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, forInit);
}
}
return left;
};
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;
node.right = right;
return this.finishNode(node, logical ? "LogicalExpression" : "BinaryExpression");
};
// Parse unary operators, both prefix and postfix.
pp$5.parseMaybeUnary = function (refDestructuringErrors, sawUnary, incDec, forInit) {
var startPos = this.start,
startLoc = this.startLoc,
expr;
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$1.incDec;
node.operator = this.value;
node.prefix = true;
this.next();
node.argument = this.parseMaybeUnary(null, true, update, forInit);
this.checkExpressionErrors(refDestructuringErrors, true);
if (update) {
this.checkLValSimple(node.argument);
} else if (this.strict && node.operator === "delete" && isLocalVariableAccess(node.argument)) {
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.options.checkPrivateFields) {
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, forInit);
if (this.checkExpressionErrors(refDestructuringErrors)) {
return expr;
}
while (this.type.postfix && !this.canInsertSemicolon()) {
var node$1 = this.startNodeAt(startPos, startLoc);
node$1.operator = this.value;
node$1.prefix = false;
node$1.argument = expr;
this.checkLValSimple(expr);
this.next();
expr = this.finishNode(node$1, "UpdateExpression");
}
}
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;
}
};
function isLocalVariableAccess(node) {
return node.type === "Identifier" || node.type === "ParenthesizedExpression" && isLocalVariableAccess(node.expression);
}
function isPrivateFieldAccess(node) {
return node.type === "MemberExpression" && node.property.type === "PrivateIdentifier" || node.type === "ChainExpression" && isPrivateFieldAccess(node.expression) || node.type === "ParenthesizedExpression" && isPrivateFieldAccess(node.expression);
}
// Parse call, dot, and `[]`-subscript expressions.
pp$5.parseExprSubscripts = function (refDestructuringErrors, forInit) {
var _context11;
var startPos = this.start,
startLoc = this.startLoc;
var expr = this.parseExprAtom(refDestructuringErrors, forInit);
if (expr.type === "ArrowFunctionExpression" && _sliceInstanceProperty(_context11 = this.input).call(_context11, this.lastTokStart, this.lastTokEnd) !== ")") {
return expr;
}
var result = this.parseSubscripts(expr, startPos, startLoc, false, forInit);
if (refDestructuringErrors && result.type === "MemberExpression") {
if (refDestructuringErrors.parenthesizedAssign >= result.start) {
refDestructuringErrors.parenthesizedAssign = -1;
}
if (refDestructuringErrors.parenthesizedBind >= result.start) {
refDestructuringErrors.parenthesizedBind = -1;
}
if (refDestructuringErrors.trailingComma >= result.start) {
refDestructuringErrors.trailingComma = -1;
}
}
return result;
};
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, forInit);
if (element.optional) {
optionalChained = true;
}
if (element === base || element.type === "ArrowFunctionExpression") {
if (optionalChained) {
var chainNode = this.startNodeAt(startPos, startLoc);
chainNode.expression = element;
element = this.finishNode(chainNode, "ChainExpression");
}
return element;
}
base = element;
}
};
pp$5.shouldParseAsyncArrow = function () {
return !this.canInsertSemicolon() && this.eat(types$1.arrow);
};
pp$5.parseSubscriptAsyncArrow = function (startPos, startLoc, exprList, forInit) {
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), exprList, true, forInit);
};
pp$5.parseSubscript = function (base, startPos, startLoc, noCalls, maybeAsyncArrow, optionalChained, forInit) {
var optionalSupported = this.options.ecmaVersion >= 11;
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$1.bracketL);
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;
if (computed) {
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$1.parenL)) {
var refDestructuringErrors = new DestructuringErrors(),
oldYieldPos = this.yieldPos,
oldAwaitPos = this.awaitPos,
oldAwaitIdentPos = this.awaitIdentPos;
this.yieldPos = 0;
this.awaitPos = 0;
this.awaitIdentPos = 0;
var exprList = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false, refDestructuringErrors);
if (maybeAsyncArrow && !optional && this.shouldParseAsyncArrow()) {
this.checkPatternErrors(refDestructuringErrors, false);
this.checkYieldAwaitInDefaultParams();
if (this.awaitIdentPos > 0) {
this.raise(this.awaitIdentPos, "Cannot use 'await' as identifier inside an async function");
}
this.yieldPos = oldYieldPos;
this.awaitPos = oldAwaitPos;
this.awaitIdentPos = oldAwaitIdentPos;
return this.parseSubscriptAsyncArrow(startPos, startLoc, exprList, forInit);
}
this.checkExpressionErrors(refDestructuringErrors, true);
this.yieldPos = oldYieldPos || this.yieldPos;
this.awaitPos = oldAwaitPos || this.awaitPos;
this.awaitIdentPos = oldAwaitIdentPos || this.awaitIdentPos;
var node$1 = this.startNodeAt(startPos, startLoc);
node$1.callee = base;
node$1.arguments = exprList;
if (optionalSupported) {
node$1.optional = optional;
}
base = this.finishNode(node$1, "CallExpression");
} 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");
}
var node$2 = this.startNodeAt(startPos, startLoc);
node$2.tag = base;
node$2.quasi = this.parseTemplate({
isTagged: true
});
base = this.finishNode(node$2, "TaggedTemplateExpression");
}
return base;
};
// Parse an atomic expression — either a single token that is an
// expression, an expression started by a keyword like `function` or
// `new`, or an expression wrapped in punctuation like `()`, `[]`,
// or `{}`.
pp$5.parseExprAtom = function (refDestructuringErrors, forInit, forNew) {
// 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$1.slash) {
this.readRegexp();
}
var node,
canBeArrow = this.potentialArrowAt === this.start;
switch (this.type) {
case types$1._super:
if (!this.allowSuper) {
this.raise(this.start, "'super' keyword outside a method");
}
node = this.startNode();
this.next();
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:
// super [ Expression ]
// super . IdentifierName
// SuperCall:
// super ( Arguments )
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$1._this:
node = this.startNode();
this.next();
return this.finishNode(node, "ThisExpression");
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$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$1.arrow)) {
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], false, forInit);
}
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$1.arrow)) {
this.unexpected();
}
return this.parseArrowExpression(this.startNodeAt(startPos, startLoc), [id], true, forInit);
}
}
return id;
case types$1.regexp:
var value = this.value;
node = this.parseLiteral(value.value);
node.regex = {
pattern: value.pattern,
flags: _flagsInstanceProperty(value)
};
return node;
case types$1.num:
case types$1.string:
return this.parseLiteral(this.value);
case types$1._null:
case types$1._true:
case types$1._false:
node = this.startNode();
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$1.parenL:
var start = this.start,
expr = this.parseParenAndDistinguishExpression(canBeArrow, forInit);
if (refDestructuringErrors) {
if (refDestructuringErrors.parenthesizedAssign < 0 && !this.isSimpleAssignTarget(expr)) {
refDestructuringErrors.parenthesizedAssign = start;
}
if (refDestructuringErrors.parenthesizedBind < 0) {
refDestructuringErrors.parenthesizedBind = start;
}
}
return expr;
case types$1.bracketL:
node = this.startNode();
this.next();
node.elements = this.parseExprList(types$1.bracketR, true, true, refDestructuringErrors);
return this.finishNode(node, "ArrayExpression");
case types$1.braceL:
this.overrideContext(types.b_expr);
return this.parseObj(false, refDestructuringErrors);
case types$1._function:
node = this.startNode();
this.next();
return this.parseFunction(node, 0);
case types$1._class:
return this.parseClass(this.startNode(), false);
case types$1._new:
return this.parseNew();
case types$1.backQuote:
return this.parseTemplate();
case types$1._import:
if (this.options.ecmaVersion >= 11) {
return this.parseExprImport(forNew);
} else {
return this.unexpected();
}
default:
return this.parseExprAtomDefault();
}
};
pp$5.parseExprAtomDefault = function () {
this.unexpected();
};
pp$5.parseExprImport = function (forNew) {
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`.
if (this.containsEsc) {
this.raiseRecoverable(this.start, "Escape sequence in keyword import");
}
this.next();
if (this.type === types$1.parenL && !forNew) {
return this.parseDynamicImport(node);
} else if (this.type === types$1.dot) {
var meta = this.startNodeAt(node.start, node.loc && node.loc.start);
meta.name = "import";
node.meta = this.finishNode(meta, "Identifier");
return this.parseImportMeta(node);
} else {
this.unexpected();
}
};
pp$5.parseDynamicImport = function (node) {
this.next(); // skip `(`
// Parse node.source.
node.source = this.parseMaybeAssign();
if (this.options.ecmaVersion >= 16) {
if (!this.eat(types$1.parenR)) {
this.expect(types$1.comma);
if (!this.afterTrailingComma(types$1.parenR)) {
node.options = this.parseMaybeAssign();
if (!this.eat(types$1.parenR)) {
this.expect(types$1.comma);
if (!this.afterTrailingComma(types$1.parenR)) {
this.unexpected();
}
}
} else {
node.options = null;
}
} else {
node.options = null;
}
} else {
// Verify ending.
if (!this.eat(types$1.parenR)) {
var errorPos = this.start;
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);
}
}
}
return this.finishNode(node, "ImportExpression");
};
pp$5.parseImportMeta = function (node) {
this.next(); // skip `.`
var containsEsc = this.containsEsc;
node.property = this.parseIdent(true);
if (node.property.name !== "meta") {
this.raiseRecoverable(node.property.start, "The only valid meta property for import is 'import.meta'");
}
if (containsEsc) {
this.raiseRecoverable(node.start, "'import.meta' must not contain escaped characters");
}
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$5.parseLiteral = function (value) {
var _context12;
var node = this.startNode();
node.value = value;
node.raw = _sliceInstanceProperty(_context12 = this.input).call(_context12, this.start, this.end);
if (node.raw.charCodeAt(node.raw.length - 1) === 110) {
var _context13;
node.bigint = _sliceInstanceProperty(_context13 = node.raw).call(_context13, 0, -1).replace(/_/g, "");
}
this.next();
return this.finishNode(node, "Literal");
};
pp$5.parseParenExpression = function () {
this.expect(types$1.parenL);
var val = this.parseExpression();
this.expect(types$1.parenR);
return val;
};
pp$5.shouldParseArrow = function (exprList) {
return !this.canInsertSemicolon();
};
pp$5.parseParenAndDistinguishExpression = function (canBeArrow, forInit) {
var startPos = this.start,
startLoc = this.startLoc,
val,
allowTrailingComma = this.options.ecmaVersion >= 8;
if (this.options.ecmaVersion >= 6) {
this.next();
var innerStartPos = this.start,
innerStartLoc = this.startLoc;
var exprList = [],
first = true,
lastIsComma = false;
var refDestructuringErrors = new DestructuringErrors(),
oldYieldPos = this.yieldPos,
oldAwaitPos = this.awaitPos,
spreadStart;
this.yieldPos = 0;
this.awaitPos = 0;
// Do not save awaitIdentPos to allow checking awaits nested in parameters
while (this.type !== types$1.parenR) {
first ? first = false : this.expect(types$1.comma);
if (allowTrailingComma && this.afterTrailingComma(types$1.parenR, true)) {
lastIsComma = true;
break;
} else if (this.type === types$1.ellipsis) {
spreadStart = this.start;
exprList.push(this.parseParenItem(this.parseRestBinding()));
if (this.type === types$1.comma) {
this.raiseRecoverable(this.start, "Comma is not permitted after the rest element");
}
break;
} else {
exprList.push(this.parseMaybeAssign(false, refDestructuringErrors, this.parseParenItem));
}
}
var innerEndPos = this.lastTokEnd,
innerEndLoc = this.lastTokEndLoc;
this.expect(types$1.parenR);
if (canBeArrow && this.shouldParseArrow(exprList) && this.eat(types$1.arrow)) {
this.checkPatternErrors(refDestructuringErrors, false);
this.checkYieldAwaitInDefaultParams();
this.yieldPos = oldYieldPos;
this.awaitPos = oldAwaitPos;
return this.parseParenArrowList(startPos, startLoc, exprList, forInit);
}
if (!exprList.length || lastIsComma) {
this.unexpected(this.lastTokStart);
}
if (spreadStart) {
this.unexpected(spreadStart);
}
this.checkExpressionErrors(refDestructuringErrors, true);
this.yieldPos = oldYieldPos || this.yieldPos;
this.awaitPos = oldAwaitPos || this.awaitPos;
if (exprList.length > 1) {
val = this.startNodeAt(innerStartPos, innerStartLoc);
val.expressions = exprList;
this.finishNodeAt(val, "SequenceExpression", innerEndPos, innerEndLoc);
} else {
val = exprList[0];
}
} else {
val = this.parseParenExpression();
}
if (this.options.preserveParens) {
var par = this.startNodeAt(startPos, startLoc);
par.expression = val;
return this.finishNode(par, "ParenthesizedExpression");
} else {
return val;
}
};
pp$5.parseParenItem = function (item) {
return item;
};
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
// argument to parseSubscripts to prevent it from consuming the
// argument list.
var empty = [];
pp$5.parseNew = function () {
if (this.containsEsc) {
this.raiseRecoverable(this.start, "Escape sequence in keyword new");
}
var node = this.startNode();
this.next();
if (this.options.ecmaVersion >= 6 && this.type === types$1.dot) {
var meta = this.startNodeAt(node.start, node.loc && node.loc.start);
meta.name = "new";
node.meta = this.finishNode(meta, "Identifier");
this.next();
var containsEsc = this.containsEsc;
node.property = this.parseIdent(true);
if (node.property.name !== "target") {
this.raiseRecoverable(node.property.start, "The only valid meta property for new is 'new.target'");
}
if (containsEsc) {
this.raiseRecoverable(node.start, "'new.target' must not contain escaped characters");
}
if (!this.allowNewDotTarget) {
this.raiseRecoverable(node.start, "'new.target' can only be used in functions and class static block");
}
return this.finishNode(node, "MetaProperty");
}
var startPos = this.start,
startLoc = this.startLoc;
node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
if (this.eat(types$1.parenL)) {
node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false);
} else {
node.arguments = empty;
}
return this.finishNode(node, "NewExpression");
};
// Parse template expression.
pp$5.parseTemplateElement = function (ref) {
var isTagged = ref.isTagged;
var elem = this.startNode();
if (this.type === types$1.invalidTemplate) {
if (!isTagged) {
this.raiseRecoverable(this.start, "Bad escape sequence in untagged template literal");
}
elem.value = {
raw: this.value.replace(/\r\n?/g, "\n"),
cooked: null
};
} else {
var _context14;
elem.value = {
raw: _sliceInstanceProperty(_context14 = this.input).call(_context14, this.start, this.end).replace(/\r\n?/g, "\n"),
cooked: this.value
};
}
this.next();
elem.tail = this.type === types$1.backQuote;
return this.finishNode(elem, "TemplateElement");
};
pp$5.parseTemplate = function (ref) {
if (ref === undefined) ref = {};
var isTagged = ref.isTagged;
if (isTagged === undefined) isTagged = false;
var node = this.startNode();
this.next();
node.expressions = [];
var curElt = this.parseTemplateElement({
isTagged: isTagged
});
node.quasis = [curElt];
while (!curElt.tail) {
if (this.type === types$1.eof) {
this.raise(this.pos, "Unterminated template literal");
}
this.expect(types$1.dollarBraceL);
node.expressions.push(this.parseExpression());
this.expect(types$1.braceR);
node.quasis.push(curElt = this.parseTemplateElement({
isTagged: isTagged
}));
}
this.next();
return this.finishNode(node, "TemplateLiteral");
};
pp$5.isAsyncProp = function (prop) {
var _context15;
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(_sliceInstanceProperty(_context15 = this.input).call(_context15, this.lastTokEnd, this.start));
};
// Parse an object literal or binding pattern.
pp$5.parseObj = function (isPattern, refDestructuringErrors) {
var node = this.startNode(),
first = true,
propHash = {};
node.properties = [];
this.next();
while (!this.eat(types$1.braceR)) {
if (!first) {
this.expect(types$1.comma);
if (this.options.ecmaVersion >= 5 && this.afterTrailingComma(types$1.braceR)) {
break;
}
} else {
first = false;
}
var prop = this.parseProperty(isPattern, refDestructuringErrors);
if (!isPattern) {
this.checkPropClash(prop, propHash, refDestructuringErrors);
}
node.properties.push(prop);
}
return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression");
};
pp$5.parseProperty = function (isPattern, refDestructuringErrors) {
var prop = this.startNode(),
isGenerator,
isAsync,
startPos,
startLoc;
if (this.options.ecmaVersion >= 9 && this.eat(types$1.ellipsis)) {
if (isPattern) {
prop.argument = this.parseIdent(false);
if (this.type === types$1.comma) {
this.raiseRecoverable(this.start, "Comma is not permitted after the rest element");
}
return this.finishNode(prop, "RestElement");
}
// Parse argument.
prop.argument = this.parseMaybeAssign(false, refDestructuringErrors);
// To disallow trailing comma via `this.toAssignable()`.
if (this.type === types$1.comma && refDestructuringErrors && refDestructuringErrors.trailingComma < 0) {
refDestructuringErrors.trailingComma = this.start;
}
// Finish
return this.finishNode(prop, "SpreadElement");
}
if (this.options.ecmaVersion >= 6) {
prop.method = false;
prop.shorthand = false;
if (isPattern || refDestructuringErrors) {
startPos = this.start;
startLoc = this.startLoc;
}
if (!isPattern) {
isGenerator = this.eat(types$1.star);
}
}
var containsEsc = this.containsEsc;
this.parsePropertyName(prop);
if (!isPattern && !containsEsc && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) {
isAsync = true;
isGenerator = this.options.ecmaVersion >= 9 && this.eat(types$1.star);
this.parsePropertyName(prop);
} else {
isAsync = false;
}
this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors, containsEsc);
return this.finishNode(prop, "Property");
};
pp$5.parseGetterSetter = function (prop) {
prop.kind = prop.key.name;
this.parsePropertyName(prop);
prop.value = this.parseMethod(false);
var paramCount = prop.kind === "get" ? 0 : 1;
if (prop.value.params.length !== paramCount) {
var start = prop.value.start;
if (prop.kind === "get") {
this.raiseRecoverable(start, "getter should have no params");
} else {
this.raiseRecoverable(start, "setter should have exactly one param");
}
} else {
if (prop.kind === "set" && prop.value.params[0].type === "RestElement") {
this.raiseRecoverable(prop.value.params[0].start, "Setter cannot use rest params");
}
}
};
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$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$1.parenL) {
if (isPattern) {
this.unexpected();
}
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$1.comma && this.type !== types$1.braceR && this.type !== types$1.eq) {
if (isGenerator || isAsync) {
this.unexpected();
}
this.parseGetterSetter(prop);
} else if (this.options.ecmaVersion >= 6 && !prop.computed && prop.key.type === "Identifier") {
if (isGenerator || isAsync) {
this.unexpected();
}
this.checkUnreserved(prop.key);
if (prop.key.name === "await" && !this.awaitIdentPos) {
this.awaitIdentPos = startPos;
}
prop.kind = "init";
if (isPattern) {
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, this.copyNode(prop.key));
} else {
prop.value = this.copyNode(prop.key);
}
prop.shorthand = true;
} else {
this.unexpected();
}
};
pp$5.parsePropertyName = function (prop) {
if (this.options.ecmaVersion >= 6) {
if (this.eat(types$1.bracketL)) {
prop.computed = true;
prop.key = this.parseMaybeAssign();
this.expect(types$1.bracketR);
return prop.key;
} else {
prop.computed = false;
}
}
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$5.initFunction = function (node) {
node.id = null;
if (this.options.ecmaVersion >= 6) {
node.generator = node.expression = false;
}
if (this.options.ecmaVersion >= 8) {
node.async = false;
}
};
// Parse object or class method.
pp$5.parseMethod = function (isGenerator, isAsync, allowDirectSuper) {
var node = this.startNode(),
oldYieldPos = this.yieldPos,
oldAwaitPos = this.awaitPos,
oldAwaitIdentPos = this.awaitIdentPos;
this.initFunction(node);
if (this.options.ecmaVersion >= 6) {
node.generator = isGenerator;
}
if (this.options.ecmaVersion >= 8) {
node.async = !!isAsync;
}
this.yieldPos = 0;
this.awaitPos = 0;
this.awaitIdentPos = 0;
this.enterScope(functionFlags(isAsync, node.generator) | SCOPE_SUPER | (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0));
this.expect(types$1.parenL);
node.params = this.parseBindingList(types$1.parenR, false, this.options.ecmaVersion >= 8);
this.checkYieldAwaitInDefaultParams();
this.parseFunctionBody(node, false, true, false);
this.yieldPos = oldYieldPos;
this.awaitPos = oldAwaitPos;
this.awaitIdentPos = oldAwaitIdentPos;
return this.finishNode(node, "FunctionExpression");
};
// Parse arrow function expression with given parameters.
pp$5.parseArrowExpression = function (node, params, isAsync, forInit) {
var oldYieldPos = this.yieldPos,
oldAwaitPos = this.awaitPos,
oldAwaitIdentPos = this.awaitIdentPos;
this.enterScope(functionFlags(isAsync, false) | SCOPE_ARROW);
this.initFunction(node);
if (this.options.ecmaVersion >= 8) {
node.async = !!isAsync;
}
this.yieldPos = 0;
this.awaitPos = 0;
this.awaitIdentPos = 0;
node.params = this.toAssignableList(params, true);
this.parseFunctionBody(node, true, false, forInit);
this.yieldPos = oldYieldPos;
this.awaitPos = oldAwaitPos;
this.awaitIdentPos = oldAwaitIdentPos;
return this.finishNode(node, "ArrowFunctionExpression");
};
// Parse function body and check parameters.
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(forInit);
node.expression = true;
this.checkParams(node, false);
} else {
var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params);
if (!oldStrict || nonSimple) {
useStrict = this.strictDirective(this.end);
// If this is a strict mode function, verify that argument names
// are not repeated, and it does not try to bind the words `eval`
// or `arguments`.
if (useStrict && nonSimple) {
this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list");
}
}
// Start a new scope with regard to labels and the `inFunction`
// flag (restore them to their old value afterwards).
var oldLabels = this.labels;
this.labels = [];
if (useStrict) {
this.strict = true;
}
// Add the params to varDeclaredNames to ensure that an error is thrown
// if a let/const declaration in the function clashes with one of the params.
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.checkLValSimple(node.id, BIND_OUTSIDE);
}
node.body = this.parseBlock(false, undefined, useStrict && !oldStrict);
node.expression = false;
this.adaptDirectivePrologue(node.body.body);
this.labels = oldLabels;
}
this.exitScope();
};
pp$5.isSimpleParamList = function (params) {
for (var i = 0, list = params; i < list.length; i += 1) {
var param = list[i];
if (param.type !== "Identifier") {
return false;
}
}
return true;
};
// Checks function params for various disallowed patterns such as using "eval"
// or "arguments" and duplicate parameters.
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.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
// `allowEmpty` can be turned on to allow subsequent commas with
// nothing in between them to be parsed as `null` (which is needed
// for array literals).
pp$5.parseExprList = function (close, allowTrailingComma, allowEmpty, refDestructuringErrors) {
var elts = [],
first = true;
while (!this.eat(close)) {
if (!first) {
this.expect(types$1.comma);
if (allowTrailingComma && this.afterTrailingComma(close)) {
break;
}
} else {
first = false;
}
var elt = undefined;
if (allowEmpty && this.type === types$1.comma) {
elt = null;
} else if (this.type === types$1.ellipsis) {
elt = this.parseSpread(refDestructuringErrors);
if (refDestructuringErrors && this.type === types$1.comma && refDestructuringErrors.trailingComma < 0) {
refDestructuringErrors.trailingComma = this.start;
}
} else {
elt = this.parseMaybeAssign(false, refDestructuringErrors);
}
elts.push(elt);
}
return elts;
};
pp$5.checkUnreserved = function (ref) {
var _context16, _context17;
var start = ref.start;
var end = ref.end;
var name = ref.name;
if (this.inGenerator && name === "yield") {
this.raiseRecoverable(start, "Cannot use 'yield' as identifier inside a generator");
}
if (this.inAsync && name === "await") {
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 + "'");
}
if (this.options.ecmaVersion < 6 && _indexOfInstanceProperty(_context16 = _sliceInstanceProperty(_context17 = this.input).call(_context17, start, end)).call(_context16, "\\") !== -1) {
return;
}
var re = this.strict ? this.reservedWordsStrict : this.reservedWords;
if (re.test(name)) {
if (!this.inAsync && name === "await") {
this.raiseRecoverable(start, "Cannot use keyword 'await' outside an async function");
}
this.raiseRecoverable(start, "The keyword '" + name + "' is reserved");
}
};
// Parse the next token as an identifier. If `liberal` is true (used
// when parsing properties), it will also convert keywords into
// identifiers.
pp$5.parseIdent = function (liberal) {
var node = this.parseIdentNode();
this.next(!!liberal);
this.finishNode(node, "Identifier");
if (!liberal) {
this.checkUnreserved(node);
if (node.name === "await" && !this.awaitIdentPos) {
this.awaitIdentPos = node.start;
}
}
return node;
};
pp$5.parseIdentNode = function () {
var node = this.startNode();
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
// `class` and `function` keywords push new context into this.context.
// But there is no chance to pop the context if the keyword is consumed as an identifier such as a property name.
// If the previous token is a dot, this does not apply because the context-managing code already ignored the keyword
if ((node.name === "class" || node.name === "function") && (this.lastTokEnd !== this.lastTokStart + 1 || this.input.charCodeAt(this.lastTokStart) !== 46)) {
this.context.pop();
}
this.type = types$1.name;
} else {
this.unexpected();
}
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.options.checkPrivateFields) {
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$5.parseYield = function (forInit) {
if (!this.yieldPos) {
this.yieldPos = this.start;
}
var node = this.startNode();
this.next();
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$1.star);
node.argument = this.parseMaybeAssign(forInit);
}
return this.finishNode(node, "YieldExpression");
};
pp$5.parseAwait = function (forInit) {
if (!this.awaitPos) {
this.awaitPos = this.start;
}
var node = this.startNode();
this.next();
node.argument = this.parseMaybeUnary(null, true, false, forInit);
return this.finishNode(node, "AwaitExpression");
};
var pp$4 = Parser.prototype;
// This function is used to raise exceptions on parse errors. It
// takes an offset integer (into the current `input`) to indicate
// the location of the error, attaches the position to the end
// of the error message, and then raises a `SyntaxError` with that
// message.
pp$4.raise = function (pos, message) {
var loc = getLineInfo(this.input, pos);
message += " (" + loc.line + ":" + loc.column + ")";
var err = new SyntaxError(message);
err.pos = pos;
err.loc = loc;
err.raisedAt = this.pos;
throw err;
};
pp$4.raiseRecoverable = pp$4.raise;
pp$4.curPosition = function () {
if (this.options.locations) {
return new Position(this.curLine, this.pos - this.lineStart);
}
};
var pp$3 = Parser.prototype;
var Scope = function Scope(flags) {
this.flags = flags;
// A list of var-declared names in the current lexical scope
this.var = [];
// A list of lexically-declared names in the current lexical scope
this.lexical = [];
// A list of lexically-declared FunctionDeclaration names in the current lexical scope
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$3.enterScope = function (flags) {
this.scopeStack.push(new Scope(flags));
};
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$3.treatFunctionsAsVarInScope = function (scope) {
return _flagsInstanceProperty(scope) & SCOPE_FUNCTION || !this.inModule && _flagsInstanceProperty(scope) & SCOPE_TOP;
};
pp$3.declareName = function (name, bindingType, pos) {
var redeclared = false;
if (bindingType === BIND_LEXICAL) {
var _context18, _context19, _context20;
var scope = this.currentScope();
redeclared = _indexOfInstanceProperty(_context18 = scope.lexical).call(_context18, name) > -1 || _indexOfInstanceProperty(_context19 = scope.functions).call(_context19, name) > -1 || _indexOfInstanceProperty(_context20 = scope.var).call(_context20, name) > -1;
scope.lexical.push(name);
if (this.inModule && _flagsInstanceProperty(scope) & SCOPE_TOP) {
delete this.undefinedExports[name];
}
} else if (bindingType === BIND_SIMPLE_CATCH) {
var scope$1 = this.currentScope();
scope$1.lexical.push(name);
} else if (bindingType === BIND_FUNCTION) {
var scope$2 = this.currentScope();
if (this.treatFunctionsAsVar) {
var _context21;
redeclared = _indexOfInstanceProperty(_context21 = scope$2.lexical).call(_context21, name) > -1;
} else {
var _context22, _context23;
redeclared = _indexOfInstanceProperty(_context22 = scope$2.lexical).call(_context22, name) > -1 || _indexOfInstanceProperty(_context23 = scope$2.var).call(_context23, name) > -1;
}
scope$2.functions.push(name);
} else {
for (var i = this.scopeStack.length - 1; i >= 0; --i) {
var _context24, _context25;
var scope$3 = this.scopeStack[i];
if (_indexOfInstanceProperty(_context24 = scope$3.lexical).call(_context24, name) > -1 && !(_flagsInstanceProperty(scope$3) & SCOPE_SIMPLE_CATCH && scope$3.lexical[0] === name) || !this.treatFunctionsAsVarInScope(scope$3) && _indexOfInstanceProperty(_context25 = scope$3.functions).call(_context25, name) > -1) {
redeclared = true;
break;
}
scope$3.var.push(name);
if (this.inModule && _flagsInstanceProperty(scope$3) & SCOPE_TOP) {
delete this.undefinedExports[name];
}
if (_flagsInstanceProperty(scope$3) & SCOPE_VAR) {
break;
}
}
}
if (redeclared) {
this.raiseRecoverable(pos, "Identifier '" + name + "' has already been declared");
}
};
pp$3.checkLocalExport = function (id) {
var _context26, _context27;
// scope.functions must be empty as Module code is always strict.
if (_indexOfInstanceProperty(_context26 = this.scopeStack[0].lexical).call(_context26, id.name) === -1 && _indexOfInstanceProperty(_context27 = this.scopeStack[0].var).call(_context27, id.name) === -1) {
this.undefinedExports[id.name] = id;
}
};
pp$3.currentScope = function () {
return this.scopeStack[this.scopeStack.length - 1];
};
pp$3.currentVarScope = function () {
for (var i = this.scopeStack.length - 1;; i--) {
var scope = this.scopeStack[i];
if (_flagsInstanceProperty(scope) & SCOPE_VAR) {
return scope;
}
}
};
// Could be useful for `this`, `new.target`, `super()`, `super.property`, and `super[property]`.
pp$3.currentThisScope = function () {
for (var i = this.scopeStack.length - 1;; i--) {
var scope = this.scopeStack[i];
if (_flagsInstanceProperty(scope) & SCOPE_VAR && !(_flagsInstanceProperty(scope) & SCOPE_ARROW)) {
return scope;
}
}
};
var Node = function Node(parser, pos, loc) {
this.type = "";
this.start = pos;
this.end = 0;
if (parser.options.locations) {
this.loc = new SourceLocation(parser, loc);
}
if (parser.options.directSourceFile) {
this.sourceFile = parser.options.directSourceFile;
}
if (parser.options.ranges) {
this.range = [pos, 0];
}
};
// Start an AST node, attaching a start offset.
var pp$2 = Parser.prototype;
pp$2.startNode = function () {
return new Node(this, this.start, this.startLoc);
};
pp$2.startNodeAt = function (pos, loc) {
return new Node(this, pos, loc);
};
// Finish an AST node, adding `type` and `end` properties.
function finishNodeAt(node, type, pos, loc) {
node.type = type;
node.end = pos;
if (this.options.locations) {
node.loc.end = loc;
}
if (this.options.ranges) {
node.range[1] = pos;
}
return node;
}
pp$2.finishNode = function (node, type) {
return finishNodeAt.call(this, node, type, this.lastTokEnd, this.lastTokEndLoc);
};
// Finish node at given position
pp$2.finishNodeAt = function (node, type, pos, loc) {
return finishNodeAt.call(this, node, type, pos, loc);
};
pp$2.copyNode = function (node) {
var newNode = new Node(this, node.start, this.startLoc);
for (var prop in node) {
newNode[prop] = node[prop];
}
return newNode;
};
// This file was generated by "bin/generate-unicode-script-values.js". Do not modify manually!
var scriptValuesAddedInUnicode = "Gara Garay Gukh Gurung_Khema Hrkt Katakana_Or_Hiragana Kawi Kirat_Rai Krai Nag_Mundari Nagm Ol_Onal Onao Sunu Sunuwar Todhri Todr Tulu_Tigalari Tutg Unknown Zzzz";
// 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)
// #table-binary-unicode-properties
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 ecma13BinaryProperties = ecma12BinaryProperties;
var ecma14BinaryProperties = ecma13BinaryProperties;
var unicodeBinaryProperties = {
9: ecma9BinaryProperties,
10: ecma10BinaryProperties,
11: ecma11BinaryProperties,
12: ecma12BinaryProperties,
13: ecma13BinaryProperties,
14: ecma14BinaryProperties
};
// #table-binary-unicode-properties-of-strings
var ecma14BinaryPropertiesOfStrings = "Basic_Emoji Emoji_Keycap_Sequence RGI_Emoji_Modifier_Sequence RGI_Emoji_Flag_Sequence RGI_Emoji_Tag_Sequence RGI_Emoji_ZWJ_Sequence RGI_Emoji";
var unicodeBinaryPropertiesOfStrings = {
9: "",
10: "",
11: "",
12: "",
13: "",
14: ecma14BinaryPropertiesOfStrings
};
// #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
var ecma9ScriptValues = "Adlam Adlm 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 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 ecma13ScriptValues = ecma12ScriptValues + " Cypro_Minoan Cpmn Old_Uyghur Ougr Tangsa Tnsa Toto Vithkuqi Vith";
var ecma14ScriptValues = ecma13ScriptValues + " " + scriptValuesAddedInUnicode;
var unicodeScriptValues = {
9: ecma9ScriptValues,
10: ecma10ScriptValues,
11: ecma11ScriptValues,
12: ecma12ScriptValues,
13: ecma13ScriptValues,
14: ecma14ScriptValues
};
var data = {};
function buildUnicodeData(ecmaVersion) {
var d = data[ecmaVersion] = {
binary: wordsRegexp(unicodeBinaryProperties[ecmaVersion] + " " + unicodeGeneralCategoryValues),
binaryOfStrings: wordsRegexp(unicodeBinaryPropertiesOfStrings[ecmaVersion]),
nonBinary: {
General_Category: wordsRegexp(unicodeGeneralCategoryValues),
Script: wordsRegexp(unicodeScriptValues[ecmaVersion])
}
};
d.nonBinary.Script_Extensions = d.nonBinary.Script;
d.nonBinary.gc = d.nonBinary.General_Category;
d.nonBinary.sc = d.nonBinary.Script;
d.nonBinary.scx = d.nonBinary.Script_Extensions;
}
for (var i = 0, list = [9, 10, 11, 12, 13, 14]; i < list.length; i += 1) {
var ecmaVersion = list[i];
buildUnicodeData(ecmaVersion);
}
var pp$1 = Parser.prototype;
// Track disjunction structure to determine whether a duplicate
// capture group name is allowed because it is in a separate branch.
var BranchID = function BranchID(parent, base) {
// Parent disjunction branch
this.parent = parent;
// Identifies this set of sibling branches
this.base = base || this;
};
BranchID.prototype.separatedFrom = function separatedFrom(alt) {
// A branch is separate from another branch if they or any of
// their parents are siblings in a given disjunction
for (var self = this; self; self = self.parent) {
for (var other = alt; other; other = other.parent) {
if (self.base === other.base && self !== other) {
return true;
}
}
}
return false;
};
BranchID.prototype.sibling = function sibling() {
return new BranchID(this.parent, this.base);
};
var RegExpValidationState = function RegExpValidationState(parser) {
this.parser = parser;
this.validFlags = "gim" + (parser.options.ecmaVersion >= 6 ? "uy" : "") + (parser.options.ecmaVersion >= 9 ? "s" : "") + (parser.options.ecmaVersion >= 13 ? "d" : "") + (parser.options.ecmaVersion >= 15 ? "v" : "");
this.unicodeProperties = data[parser.options.ecmaVersion >= 14 ? 14 : parser.options.ecmaVersion];
this.source = "";
this.flags = "";
this.start = 0;
this.switchU = false;
this.switchV = false;
this.switchN = false;
this.pos = 0;
this.lastIntValue = 0;
this.lastStringValue = "";
this.lastAssertionIsQuantifiable = false;
this.numCapturingParens = 0;
this.maxBackReference = 0;
this.groupNames = _Object$create(null);
this.backReferenceNames = [];
this.branchID = null;
};
RegExpValidationState.prototype.reset = function reset(start, pattern, flags) {
var unicodeSets = _indexOfInstanceProperty(flags).call(flags, "v") !== -1;
var unicode = _indexOfInstanceProperty(flags).call(flags, "u") !== -1;
this.start = start | 0;
this.source = pattern + "";
this.flags = flags;
if (unicodeSets && this.parser.options.ecmaVersion >= 15) {
this.switchU = true;
this.switchV = true;
this.switchN = true;
} else {
this.switchU = unicode && this.parser.options.ecmaVersion >= 6;
this.switchV = false;
this.switchN = unicode && this.parser.options.ecmaVersion >= 9;
}
};
RegExpValidationState.prototype.raise = function raise(message) {
this.parser.raiseRecoverable(this.start, "Invalid regular expression: /" + this.source + "/: " + message);
};
// If u flag is given, this returns the code point at the index (it combines a surrogate pair).
// Otherwise, this returns the code unit of the index (can be a part of a surrogate pair).
RegExpValidationState.prototype.at = function at(i, forceU) {
if (forceU === undefined) forceU = false;
var s = this.source;
var l = s.length;
if (i >= l) {
return -1;
}
var c = s.charCodeAt(i);
if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l) {
return c;
}
var next = s.charCodeAt(i + 1);
return next >= 0xDC00 && next <= 0xDFFF ? (c << 10) + next - 0x35FDC00 : c;
};
RegExpValidationState.prototype.nextIndex = function nextIndex(i, forceU) {
if (forceU === undefined) forceU = false;
var s = this.source;
var l = s.length;
if (i >= l) {
return l;
}
var c = s.charCodeAt(i),
next;
if (!(forceU || this.switchU) || c <= 0xD7FF || c >= 0xE000 || i + 1 >= l || (next = s.charCodeAt(i + 1)) < 0xDC00 || next > 0xDFFF) {
return i + 1;
}
return i + 2;
};
RegExpValidationState.prototype.current = function current(forceU) {
var _context28;
if (forceU === undefined) forceU = false;
return _atInstanceProperty(_context28 = this).call(_context28, this.pos, forceU);
};
RegExpValidationState.prototype.lookahead = function lookahead(forceU) {
var _context29;
if (forceU === undefined) forceU = false;
return _atInstanceProperty(_context29 = this).call(_context29, this.nextIndex(this.pos, forceU), forceU);
};
RegExpValidationState.prototype.advance = function advance(forceU) {
if (forceU === undefined) forceU = false;
this.pos = this.nextIndex(this.pos, forceU);
};
RegExpValidationState.prototype.eat = function eat(ch, forceU) {
if (forceU === undefined) forceU = false;
if (this.current(forceU) === ch) {
this.advance(forceU);
return true;
}
return false;
};
RegExpValidationState.prototype.eatChars = function eatChars(chs, forceU) {
if (forceU === undefined) forceU = false;
var pos = this.pos;
for (var i = 0, list = chs; i < list.length; i += 1) {
var _context30;
var ch = list[i];
var current = _atInstanceProperty(_context30 = this).call(_context30, pos, forceU);
if (current === -1 || current !== ch) {
return false;
}
pos = this.nextIndex(pos, forceU);
}
this.pos = pos;
return true;
};
/**
* Validate the flags part of a given RegExpLiteral.
*
* @param {RegExpValidationState} state The state to validate RegExp.
* @returns {void}
*/
pp$1.validateRegExpFlags = function (state) {
var validFlags = state.validFlags;
var flags = _flagsInstanceProperty(state);
var u = false;
var v = false;
for (var i = 0; i < flags.length; i++) {
var flag = flags.charAt(i);
if (_indexOfInstanceProperty(validFlags).call(validFlags, flag) === -1) {
this.raise(state.start, "Invalid regular expression flag");
}
if (_indexOfInstanceProperty(flags).call(flags, flag, i + 1) > -1) {
this.raise(state.start, "Duplicate regular expression flag");
}
if (flag === "u") {
u = true;
}
if (flag === "v") {
v = true;
}
}
if (this.options.ecmaVersion >= 15 && u && v) {
this.raise(state.start, "Invalid regular expression flag");
}
};
function hasProp(obj) {
for (var _ in obj) {
return true;
}
return false;
}
/**
* Validate the pattern part of a given RegExpLiteral.
*
* @param {RegExpValidationState} state The state to validate RegExp.
* @returns {void}
*/
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*
// exception if _P_ did not conform to the grammar, if any elements of _P_
// were not matched by the parse, or if any Early Error conditions exist.
if (!state.switchN && this.options.ecmaVersion >= 9 && hasProp(state.groupNames)) {
state.switchN = true;
this.regexp_pattern(state);
}
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-Pattern
pp$1.regexp_pattern = function (state) {
state.pos = 0;
state.lastIntValue = 0;
state.lastStringValue = "";
state.lastAssertionIsQuantifiable = false;
state.numCapturingParens = 0;
state.maxBackReference = 0;
state.groupNames = _Object$create(null);
state.backReferenceNames.length = 0;
state.branchID = null;
this.regexp_disjunction(state);
if (state.pos !== state.source.length) {
// Make the same messages as V8.
if (state.eat(0x29 /* ) */)) {
state.raise("Unmatched ')'");
}
if (state.eat(0x5D /* ] */) || state.eat(0x7D /* } */)) {
state.raise("Lone quantifier brackets");
}
}
if (state.maxBackReference > state.numCapturingParens) {
state.raise("Invalid escape");
}
for (var i = 0, list = state.backReferenceNames; i < list.length; i += 1) {
var name = list[i];
if (!state.groupNames[name]) {
state.raise("Invalid named capture referenced");
}
}
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-Disjunction
pp$1.regexp_disjunction = function (state) {
var trackDisjunction = this.options.ecmaVersion >= 16;
if (trackDisjunction) {
state.branchID = new BranchID(state.branchID, null);
}
this.regexp_alternative(state);
while (state.eat(0x7C /* | */)) {
if (trackDisjunction) {
state.branchID = state.branchID.sibling();
}
this.regexp_alternative(state);
}
if (trackDisjunction) {
state.branchID = state.branchID.parent;
}
// Make the same message as V8.
if (this.regexp_eatQuantifier(state, true)) {
state.raise("Nothing to repeat");
}
if (state.eat(0x7B /* { */)) {
state.raise("Lone quantifier brackets");
}
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-Alternative
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$1.regexp_eatTerm = function (state) {
if (this.regexp_eatAssertion(state)) {
// Handle `QuantifiableAssertion Quantifier` alternative.
// `state.lastAssertionIsQuantifiable` is true if the last eaten Assertion
// is a QuantifiableAssertion.
if (state.lastAssertionIsQuantifiable && this.regexp_eatQuantifier(state)) {
// Make the same message as V8.
if (state.switchU) {
state.raise("Invalid quantifier");
}
}
return true;
}
if (state.switchU ? this.regexp_eatAtom(state) : this.regexp_eatExtendedAtom(state)) {
this.regexp_eatQuantifier(state);
return true;
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-Assertion
pp$1.regexp_eatAssertion = function (state) {
var start = state.pos;
state.lastAssertionIsQuantifiable = false;
// ^, $
if (state.eat(0x5E /* ^ */) || state.eat(0x24 /* $ */)) {
return true;
}
// \b \B
if (state.eat(0x5C /* \ */)) {
if (state.eat(0x42 /* B */) || state.eat(0x62 /* b */)) {
return true;
}
state.pos = start;
}
// Lookahead / Lookbehind
if (state.eat(0x28 /* ( */) && state.eat(0x3F /* ? */)) {
var lookbehind = false;
if (this.options.ecmaVersion >= 9) {
lookbehind = state.eat(0x3C /* < */);
}
if (state.eat(0x3D /* = */) || state.eat(0x21 /* ! */)) {
this.regexp_disjunction(state);
if (!state.eat(0x29 /* ) */)) {
state.raise("Unterminated group");
}
state.lastAssertionIsQuantifiable = !lookbehind;
return true;
}
}
state.pos = start;
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-Quantifier
pp$1.regexp_eatQuantifier = function (state, noError) {
if (noError === undefined) noError = false;
if (this.regexp_eatQuantifierPrefix(state, noError)) {
state.eat(0x3F /* ? */);
return true;
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-QuantifierPrefix
pp$1.regexp_eatQuantifierPrefix = function (state, noError) {
return state.eat(0x2A /* * */) || state.eat(0x2B /* + */) || state.eat(0x3F /* ? */) || this.regexp_eatBracedQuantifier(state, noError);
};
pp$1.regexp_eatBracedQuantifier = function (state, noError) {
var start = state.pos;
if (state.eat(0x7B /* { */)) {
var min = 0,
max = -1;
if (this.regexp_eatDecimalDigits(state)) {
min = state.lastIntValue;
if (state.eat(0x2C /* , */) && this.regexp_eatDecimalDigits(state)) {
max = state.lastIntValue;
}
if (state.eat(0x7D /* } */)) {
// SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-term
if (max !== -1 && max < min && !noError) {
state.raise("numbers out of order in {} quantifier");
}
return true;
}
}
if (state.switchU && !noError) {
state.raise("Incomplete quantifier");
}
state.pos = start;
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-Atom
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$1.regexp_eatReverseSolidusAtomEscape = function (state) {
var start = state.pos;
if (state.eat(0x5C /* \ */)) {
if (this.regexp_eatAtomEscape(state)) {
return true;
}
state.pos = start;
}
return false;
};
pp$1.regexp_eatUncapturingGroup = function (state) {
var start = state.pos;
if (state.eat(0x28 /* ( */)) {
if (state.eat(0x3F /* ? */)) {
if (this.options.ecmaVersion >= 16) {
var addModifiers = this.regexp_eatModifiers(state);
var hasHyphen = state.eat(0x2D /* - */);
if (addModifiers || hasHyphen) {
for (var i = 0; i < addModifiers.length; i++) {
var modifier = addModifiers.charAt(i);
if (_indexOfInstanceProperty(addModifiers).call(addModifiers, modifier, i + 1) > -1) {
state.raise("Duplicate regular expression modifiers");
}
}
if (hasHyphen) {
var removeModifiers = this.regexp_eatModifiers(state);
if (!addModifiers && !removeModifiers && state.current() === 0x3A /* : */) {
state.raise("Invalid regular expression modifiers");
}
for (var i$1 = 0; i$1 < removeModifiers.length; i$1++) {
var modifier$1 = removeModifiers.charAt(i$1);
if (_indexOfInstanceProperty(removeModifiers).call(removeModifiers, modifier$1, i$1 + 1) > -1 || _indexOfInstanceProperty(addModifiers).call(addModifiers, modifier$1) > -1) {
state.raise("Duplicate regular expression modifiers");
}
}
}
}
}
if (state.eat(0x3A /* : */)) {
this.regexp_disjunction(state);
if (state.eat(0x29 /* ) */)) {
return true;
}
state.raise("Unterminated group");
}
}
state.pos = start;
}
return false;
};
pp$1.regexp_eatCapturingGroup = function (state) {
if (state.eat(0x28 /* ( */)) {
if (this.options.ecmaVersion >= 9) {
this.regexp_groupSpecifier(state);
} else if (state.current() === 0x3F /* ? */) {
state.raise("Invalid group");
}
this.regexp_disjunction(state);
if (state.eat(0x29 /* ) */)) {
state.numCapturingParens += 1;
return true;
}
state.raise("Unterminated group");
}
return false;
};
// RegularExpressionModifiers ::
// [empty]
// RegularExpressionModifiers RegularExpressionModifier
pp$1.regexp_eatModifiers = function (state) {
var modifiers = "";
var ch = 0;
while ((ch = state.current()) !== -1 && isRegularExpressionModifier(ch)) {
modifiers += codePointToString(ch);
state.advance();
}
return modifiers;
};
// RegularExpressionModifier :: one of
// `i` `m` `s`
function isRegularExpressionModifier(ch) {
return ch === 0x69 /* i */ || ch === 0x6d /* m */ || ch === 0x73; /* s */
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedAtom
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$1.regexp_eatInvalidBracedQuantifier = function (state) {
if (this.regexp_eatBracedQuantifier(state, true)) {
state.raise("Nothing to repeat");
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-SyntaxCharacter
pp$1.regexp_eatSyntaxCharacter = function (state) {
var ch = state.current();
if (isSyntaxCharacter(ch)) {
state.lastIntValue = ch;
state.advance();
return true;
}
return false;
};
function isSyntaxCharacter(ch) {
return ch === 0x24 /* $ */ || ch >= 0x28 /* ( */ && ch <= 0x2B /* + */ || ch === 0x2E /* . */ || ch === 0x3F /* ? */ || ch >= 0x5B /* [ */ && ch <= 0x5E /* ^ */ || ch >= 0x7B /* { */ && ch <= 0x7D /* } */;
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-PatternCharacter
// But eat eager.
pp$1.regexp_eatPatternCharacters = function (state) {
var start = state.pos;
var ch = 0;
while ((ch = state.current()) !== -1 && !isSyntaxCharacter(ch)) {
state.advance();
}
return state.pos !== start;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ExtendedPatternCharacter
pp$1.regexp_eatExtendedPatternCharacter = function (state) {
var ch = state.current();
if (ch !== -1 && ch !== 0x24 /* $ */ && !(ch >= 0x28 /* ( */ && ch <= 0x2B /* + */) && ch !== 0x2E /* . */ && ch !== 0x3F /* ? */ && ch !== 0x5B /* [ */ && ch !== 0x5E /* ^ */ && ch !== 0x7C /* | */) {
state.advance();
return true;
}
return false;
};
// GroupSpecifier ::
// [empty]
// `?` GroupName
pp$1.regexp_groupSpecifier = function (state) {
if (state.eat(0x3F /* ? */)) {
if (!this.regexp_eatGroupName(state)) {
state.raise("Invalid group");
}
var trackDisjunction = this.options.ecmaVersion >= 16;
var known = state.groupNames[state.lastStringValue];
if (known) {
if (trackDisjunction) {
for (var i = 0, list = known; i < list.length; i += 1) {
var altID = list[i];
if (!altID.separatedFrom(state.branchID)) {
state.raise("Duplicate capture group name");
}
}
} else {
state.raise("Duplicate capture group name");
}
}
if (trackDisjunction) {
(known || (state.groupNames[state.lastStringValue] = [])).push(state.branchID);
} else {
state.groupNames[state.lastStringValue] = true;
}
}
};
// GroupName ::
// `<` RegExpIdentifierName `>`
// Note: this updates `state.lastStringValue` property with the eaten name.
pp$1.regexp_eatGroupName = function (state) {
state.lastStringValue = "";
if (state.eat(0x3C /* < */)) {
if (this.regexp_eatRegExpIdentifierName(state) && state.eat(0x3E /* > */)) {
return true;
}
state.raise("Invalid capture group name");
}
return false;
};
// RegExpIdentifierName ::
// RegExpIdentifierStart
// RegExpIdentifierName RegExpIdentifierPart
// Note: this updates `state.lastStringValue` property with the eaten name.
pp$1.regexp_eatRegExpIdentifierName = function (state) {
state.lastStringValue = "";
if (this.regexp_eatRegExpIdentifierStart(state)) {
state.lastStringValue += codePointToString(state.lastIntValue);
while (this.regexp_eatRegExpIdentifierPart(state)) {
state.lastStringValue += codePointToString(state.lastIntValue);
}
return true;
}
return false;
};
// RegExpIdentifierStart ::
// UnicodeIDStart
// `$`
// `_`
// `\` RegExpUnicodeEscapeSequence[+U]
pp$1.regexp_eatRegExpIdentifierStart = function (state) {
var start = state.pos;
var forceU = this.options.ecmaVersion >= 11;
var ch = state.current(forceU);
state.advance(forceU);
if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {
ch = state.lastIntValue;
}
if (isRegExpIdentifierStart(ch)) {
state.lastIntValue = ch;
return true;
}
state.pos = start;
return false;
};
function isRegExpIdentifierStart(ch) {
return isIdentifierStart(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F; /* _ */
}
// RegExpIdentifierPart ::
// UnicodeIDContinue
// `$`
// `_`
// `\` RegExpUnicodeEscapeSequence[+U]
// <ZWNJ>
// <ZWJ>
pp$1.regexp_eatRegExpIdentifierPart = function (state) {
var start = state.pos;
var forceU = this.options.ecmaVersion >= 11;
var ch = state.current(forceU);
state.advance(forceU);
if (ch === 0x5C /* \ */ && this.regexp_eatRegExpUnicodeEscapeSequence(state, forceU)) {
ch = state.lastIntValue;
}
if (isRegExpIdentifierPart(ch)) {
state.lastIntValue = ch;
return true;
}
state.pos = start;
return false;
};
function isRegExpIdentifierPart(ch) {
return isIdentifierChar(ch, true) || ch === 0x24 /* $ */ || ch === 0x5F /* _ */ || ch === 0x200C /* <ZWNJ> */ || ch === 0x200D; /* <ZWJ> */
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-AtomEscape
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;
}
if (state.switchU) {
// Make the same message as V8.
if (state.current() === 0x63 /* c */) {
state.raise("Invalid unicode escape");
}
state.raise("Invalid escape");
}
return false;
};
pp$1.regexp_eatBackReference = function (state) {
var start = state.pos;
if (this.regexp_eatDecimalEscape(state)) {
var n = state.lastIntValue;
if (state.switchU) {
// For SyntaxError in https://www.ecma-international.org/ecma-262/8.0/#sec-atomescape
if (n > state.maxBackReference) {
state.maxBackReference = n;
}
return true;
}
if (n <= state.numCapturingParens) {
return true;
}
state.pos = start;
}
return false;
};
pp$1.regexp_eatKGroupName = function (state) {
if (state.eat(0x6B /* k */)) {
if (this.regexp_eatGroupName(state)) {
state.backReferenceNames.push(state.lastStringValue);
return true;
}
state.raise("Invalid named reference");
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-CharacterEscape
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$1.regexp_eatCControlLetter = function (state) {
var start = state.pos;
if (state.eat(0x63 /* c */)) {
if (this.regexp_eatControlLetter(state)) {
return true;
}
state.pos = start;
}
return false;
};
pp$1.regexp_eatZero = function (state) {
if (state.current() === 0x30 /* 0 */ && !isDecimalDigit(state.lookahead())) {
state.lastIntValue = 0;
state.advance();
return true;
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlEscape
pp$1.regexp_eatControlEscape = function (state) {
var ch = state.current();
if (ch === 0x74 /* t */) {
state.lastIntValue = 0x09; /* \t */
state.advance();
return true;
}
if (ch === 0x6E /* n */) {
state.lastIntValue = 0x0A; /* \n */
state.advance();
return true;
}
if (ch === 0x76 /* v */) {
state.lastIntValue = 0x0B; /* \v */
state.advance();
return true;
}
if (ch === 0x66 /* f */) {
state.lastIntValue = 0x0C; /* \f */
state.advance();
return true;
}
if (ch === 0x72 /* r */) {
state.lastIntValue = 0x0D; /* \r */
state.advance();
return true;
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-ControlLetter
pp$1.regexp_eatControlLetter = function (state) {
var ch = state.current();
if (isControlLetter(ch)) {
state.lastIntValue = ch % 0x20;
state.advance();
return true;
}
return false;
};
function isControlLetter(ch) {
return ch >= 0x41 /* A */ && ch <= 0x5A /* Z */ || ch >= 0x61 /* a */ && ch <= 0x7A /* z */;
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-RegExpUnicodeEscapeSequence
pp$1.regexp_eatRegExpUnicodeEscapeSequence = function (state, forceU) {
if (forceU === undefined) forceU = false;
var start = state.pos;
var switchU = forceU || state.switchU;
if (state.eat(0x75 /* u */)) {
if (this.regexp_eatFixedHexDigits(state, 4)) {
var lead = state.lastIntValue;
if (switchU && lead >= 0xD800 && lead <= 0xDBFF) {
var leadSurrogateEnd = state.pos;
if (state.eat(0x5C /* \ */) && state.eat(0x75 /* u */) && this.regexp_eatFixedHexDigits(state, 4)) {
var trail = state.lastIntValue;
if (trail >= 0xDC00 && trail <= 0xDFFF) {
state.lastIntValue = (lead - 0xD800) * 0x400 + (trail - 0xDC00) + 0x10000;
return true;
}
}
state.pos = leadSurrogateEnd;
state.lastIntValue = lead;
}
return true;
}
if (switchU && state.eat(0x7B /* { */) && this.regexp_eatHexDigits(state) && state.eat(0x7D /* } */) && isValidUnicode(state.lastIntValue)) {
return true;
}
if (switchU) {
state.raise("Invalid unicode escape");
}
state.pos = start;
}
return false;
};
function isValidUnicode(ch) {
return ch >= 0 && ch <= 0x10FFFF;
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-IdentityEscape
pp$1.regexp_eatIdentityEscape = function (state) {
if (state.switchU) {
if (this.regexp_eatSyntaxCharacter(state)) {
return true;
}
if (state.eat(0x2F /* / */)) {
state.lastIntValue = 0x2F; /* / */
return true;
}
return false;
}
var ch = state.current();
if (ch !== 0x63 /* c */ && (!state.switchN || ch !== 0x6B /* k */)) {
state.lastIntValue = ch;
state.advance();
return true;
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalEscape
pp$1.regexp_eatDecimalEscape = function (state) {
state.lastIntValue = 0;
var ch = state.current();
if (ch >= 0x31 /* 1 */ && ch <= 0x39 /* 9 */) {
do {
state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);
state.advance();
} while ((ch = state.current()) >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */);
return true;
}
return false;
};
// Return values used by character set parsing methods, needed to
// forbid negation of sets that can match strings.
var CharSetNone = 0; // Nothing parsed
var CharSetOk = 1; // Construct parsed, cannot contain strings
var CharSetString = 2; // Construct parsed, can contain strings
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClassEscape
pp$1.regexp_eatCharacterClassEscape = function (state) {
var ch = state.current();
if (isCharacterClassEscape(ch)) {
state.lastIntValue = -1;
state.advance();
return CharSetOk;
}
var negate = false;
if (state.switchU && this.options.ecmaVersion >= 9 && ((negate = ch === 0x50 /* P */) || ch === 0x70 /* p */)) {
state.lastIntValue = -1;
state.advance();
var result;
if (state.eat(0x7B /* { */) && (result = this.regexp_eatUnicodePropertyValueExpression(state)) && state.eat(0x7D /* } */)) {
if (negate && result === CharSetString) {
state.raise("Invalid property name");
}
return result;
}
state.raise("Invalid property name");
}
return CharSetNone;
};
function isCharacterClassEscape(ch) {
return ch === 0x64 /* d */ || ch === 0x44 /* D */ || ch === 0x73 /* s */ || ch === 0x53 /* S */ || ch === 0x77 /* w */ || ch === 0x57 /* W */;
}
// UnicodePropertyValueExpression ::
// UnicodePropertyName `=` UnicodePropertyValue
// LoneUnicodePropertyNameOrValue
pp$1.regexp_eatUnicodePropertyValueExpression = function (state) {
var start = state.pos;
// UnicodePropertyName `=` UnicodePropertyValue
if (this.regexp_eatUnicodePropertyName(state) && state.eat(0x3D /* = */)) {
var name = state.lastStringValue;
if (this.regexp_eatUnicodePropertyValue(state)) {
var value = state.lastStringValue;
this.regexp_validateUnicodePropertyNameAndValue(state, name, value);
return CharSetOk;
}
}
state.pos = start;
// LoneUnicodePropertyNameOrValue
if (this.regexp_eatLoneUnicodePropertyNameOrValue(state)) {
var nameOrValue = state.lastStringValue;
return this.regexp_validateUnicodePropertyNameOrValue(state, nameOrValue);
}
return CharSetNone;
};
pp$1.regexp_validateUnicodePropertyNameAndValue = function (state, name, value) {
if (!hasOwn(state.unicodeProperties.nonBinary, name)) {
state.raise("Invalid property name");
}
if (!state.unicodeProperties.nonBinary[name].test(value)) {
state.raise("Invalid property value");
}
};
pp$1.regexp_validateUnicodePropertyNameOrValue = function (state, nameOrValue) {
if (state.unicodeProperties.binary.test(nameOrValue)) {
return CharSetOk;
}
if (state.switchV && state.unicodeProperties.binaryOfStrings.test(nameOrValue)) {
return CharSetString;
}
state.raise("Invalid property name");
};
// UnicodePropertyName ::
// UnicodePropertyNameCharacters
pp$1.regexp_eatUnicodePropertyName = function (state) {
var ch = 0;
state.lastStringValue = "";
while (isUnicodePropertyNameCharacter(ch = state.current())) {
state.lastStringValue += codePointToString(ch);
state.advance();
}
return state.lastStringValue !== "";
};
function isUnicodePropertyNameCharacter(ch) {
return isControlLetter(ch) || ch === 0x5F; /* _ */
}
// UnicodePropertyValue ::
// UnicodePropertyValueCharacters
pp$1.regexp_eatUnicodePropertyValue = function (state) {
var ch = 0;
state.lastStringValue = "";
while (isUnicodePropertyValueCharacter(ch = state.current())) {
state.lastStringValue += codePointToString(ch);
state.advance();
}
return state.lastStringValue !== "";
};
function isUnicodePropertyValueCharacter(ch) {
return isUnicodePropertyNameCharacter(ch) || isDecimalDigit(ch);
}
// LoneUnicodePropertyNameOrValue ::
// UnicodePropertyValueCharacters
pp$1.regexp_eatLoneUnicodePropertyNameOrValue = function (state) {
return this.regexp_eatUnicodePropertyValue(state);
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-CharacterClass
pp$1.regexp_eatCharacterClass = function (state) {
if (state.eat(0x5B /* [ */)) {
var negate = state.eat(0x5E /* ^ */);
var result = this.regexp_classContents(state);
if (!state.eat(0x5D /* ] */)) {
state.raise("Unterminated character class");
}
if (negate && result === CharSetString) {
state.raise("Negated character class may contain strings");
}
return true;
}
return false;
};
// https://tc39.es/ecma262/#prod-ClassContents
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassRanges
pp$1.regexp_classContents = function (state) {
if (state.current() === 0x5D /* ] */) {
return CharSetOk;
}
if (state.switchV) {
return this.regexp_classSetExpression(state);
}
this.regexp_nonEmptyClassRanges(state);
return CharSetOk;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRanges
// https://www.ecma-international.org/ecma-262/8.0/#prod-NonemptyClassRangesNoDash
pp$1.regexp_nonEmptyClassRanges = function (state) {
while (this.regexp_eatClassAtom(state)) {
var left = state.lastIntValue;
if (state.eat(0x2D /* - */) && this.regexp_eatClassAtom(state)) {
var right = state.lastIntValue;
if (state.switchU && (left === -1 || right === -1)) {
state.raise("Invalid character class");
}
if (left !== -1 && right !== -1 && left > right) {
state.raise("Range out of order in character class");
}
}
}
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtom
// https://www.ecma-international.org/ecma-262/8.0/#prod-ClassAtomNoDash
pp$1.regexp_eatClassAtom = function (state) {
var start = state.pos;
if (state.eat(0x5C /* \ */)) {
if (this.regexp_eatClassEscape(state)) {
return true;
}
if (state.switchU) {
// Make the same message as V8.
var ch$1 = state.current();
if (ch$1 === 0x63 /* c */ || isOctalDigit(ch$1)) {
state.raise("Invalid class escape");
}
state.raise("Invalid escape");
}
state.pos = start;
}
var ch = state.current();
if (ch !== 0x5D /* ] */) {
state.lastIntValue = ch;
state.advance();
return true;
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassEscape
pp$1.regexp_eatClassEscape = function (state) {
var start = state.pos;
if (state.eat(0x62 /* b */)) {
state.lastIntValue = 0x08; /* <BS> */
return true;
}
if (state.switchU && state.eat(0x2D /* - */)) {
state.lastIntValue = 0x2D; /* - */
return true;
}
if (!state.switchU && state.eat(0x63 /* c */)) {
if (this.regexp_eatClassControlLetter(state)) {
return true;
}
state.pos = start;
}
return this.regexp_eatCharacterClassEscape(state) || this.regexp_eatCharacterEscape(state);
};
// https://tc39.es/ecma262/#prod-ClassSetExpression
// https://tc39.es/ecma262/#prod-ClassUnion
// https://tc39.es/ecma262/#prod-ClassIntersection
// https://tc39.es/ecma262/#prod-ClassSubtraction
pp$1.regexp_classSetExpression = function (state) {
var result = CharSetOk,
subResult;
if (this.regexp_eatClassSetRange(state)) ;else if (subResult = this.regexp_eatClassSetOperand(state)) {
if (subResult === CharSetString) {
result = CharSetString;
}
// https://tc39.es/ecma262/#prod-ClassIntersection
var start = state.pos;
while (state.eatChars([0x26, 0x26] /* && */)) {
if (state.current() !== 0x26 /* & */ && (subResult = this.regexp_eatClassSetOperand(state))) {
if (subResult !== CharSetString) {
result = CharSetOk;
}
continue;
}
state.raise("Invalid character in character class");
}
if (start !== state.pos) {
return result;
}
// https://tc39.es/ecma262/#prod-ClassSubtraction
while (state.eatChars([0x2D, 0x2D] /* -- */)) {
if (this.regexp_eatClassSetOperand(state)) {
continue;
}
state.raise("Invalid character in character class");
}
if (start !== state.pos) {
return result;
}
} else {
state.raise("Invalid character in character class");
}
// https://tc39.es/ecma262/#prod-ClassUnion
for (;;) {
if (this.regexp_eatClassSetRange(state)) {
continue;
}
subResult = this.regexp_eatClassSetOperand(state);
if (!subResult) {
return result;
}
if (subResult === CharSetString) {
result = CharSetString;
}
}
};
// https://tc39.es/ecma262/#prod-ClassSetRange
pp$1.regexp_eatClassSetRange = function (state) {
var start = state.pos;
if (this.regexp_eatClassSetCharacter(state)) {
var left = state.lastIntValue;
if (state.eat(0x2D /* - */) && this.regexp_eatClassSetCharacter(state)) {
var right = state.lastIntValue;
if (left !== -1 && right !== -1 && left > right) {
state.raise("Range out of order in character class");
}
return true;
}
state.pos = start;
}
return false;
};
// https://tc39.es/ecma262/#prod-ClassSetOperand
pp$1.regexp_eatClassSetOperand = function (state) {
if (this.regexp_eatClassSetCharacter(state)) {
return CharSetOk;
}
return this.regexp_eatClassStringDisjunction(state) || this.regexp_eatNestedClass(state);
};
// https://tc39.es/ecma262/#prod-NestedClass
pp$1.regexp_eatNestedClass = function (state) {
var start = state.pos;
if (state.eat(0x5B /* [ */)) {
var negate = state.eat(0x5E /* ^ */);
var result = this.regexp_classContents(state);
if (state.eat(0x5D /* ] */)) {
if (negate && result === CharSetString) {
state.raise("Negated character class may contain strings");
}
return result;
}
state.pos = start;
}
if (state.eat(0x5C /* \ */)) {
var result$1 = this.regexp_eatCharacterClassEscape(state);
if (result$1) {
return result$1;
}
state.pos = start;
}
return null;
};
// https://tc39.es/ecma262/#prod-ClassStringDisjunction
pp$1.regexp_eatClassStringDisjunction = function (state) {
var start = state.pos;
if (state.eatChars([0x5C, 0x71] /* \q */)) {
if (state.eat(0x7B /* { */)) {
var result = this.regexp_classStringDisjunctionContents(state);
if (state.eat(0x7D /* } */)) {
return result;
}
} else {
// Make the same message as V8.
state.raise("Invalid escape");
}
state.pos = start;
}
return null;
};
// https://tc39.es/ecma262/#prod-ClassStringDisjunctionContents
pp$1.regexp_classStringDisjunctionContents = function (state) {
var result = this.regexp_classString(state);
while (state.eat(0x7C /* | */)) {
if (this.regexp_classString(state) === CharSetString) {
result = CharSetString;
}
}
return result;
};
// https://tc39.es/ecma262/#prod-ClassString
// https://tc39.es/ecma262/#prod-NonEmptyClassString
pp$1.regexp_classString = function (state) {
var count = 0;
while (this.regexp_eatClassSetCharacter(state)) {
count++;
}
return count === 1 ? CharSetOk : CharSetString;
};
// https://tc39.es/ecma262/#prod-ClassSetCharacter
pp$1.regexp_eatClassSetCharacter = function (state) {
var start = state.pos;
if (state.eat(0x5C /* \ */)) {
if (this.regexp_eatCharacterEscape(state) || this.regexp_eatClassSetReservedPunctuator(state)) {
return true;
}
if (state.eat(0x62 /* b */)) {
state.lastIntValue = 0x08; /* <BS> */
return true;
}
state.pos = start;
return false;
}
var ch = state.current();
if (ch < 0 || ch === state.lookahead() && isClassSetReservedDoublePunctuatorCharacter(ch)) {
return false;
}
if (isClassSetSyntaxCharacter(ch)) {
return false;
}
state.advance();
state.lastIntValue = ch;
return true;
};
// https://tc39.es/ecma262/#prod-ClassSetReservedDoublePunctuator
function isClassSetReservedDoublePunctuatorCharacter(ch) {
return ch === 0x21 /* ! */ || ch >= 0x23 /* # */ && ch <= 0x26 /* & */ || ch >= 0x2A /* * */ && ch <= 0x2C /* , */ || ch === 0x2E /* . */ || ch >= 0x3A /* : */ && ch <= 0x40 /* @ */ || ch === 0x5E /* ^ */ || ch === 0x60 /* ` */ || ch === 0x7E /* ~ */;
}
// https://tc39.es/ecma262/#prod-ClassSetSyntaxCharacter
function isClassSetSyntaxCharacter(ch) {
return ch === 0x28 /* ( */ || ch === 0x29 /* ) */ || ch === 0x2D /* - */ || ch === 0x2F /* / */ || ch >= 0x5B /* [ */ && ch <= 0x5D /* ] */ || ch >= 0x7B /* { */ && ch <= 0x7D /* } */;
}
// https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator
pp$1.regexp_eatClassSetReservedPunctuator = function (state) {
var ch = state.current();
if (isClassSetReservedPunctuator(ch)) {
state.lastIntValue = ch;
state.advance();
return true;
}
return false;
};
// https://tc39.es/ecma262/#prod-ClassSetReservedPunctuator
function isClassSetReservedPunctuator(ch) {
return ch === 0x21 /* ! */ || ch === 0x23 /* # */ || ch === 0x25 /* % */ || ch === 0x26 /* & */ || ch === 0x2C /* , */ || ch === 0x2D /* - */ || ch >= 0x3A /* : */ && ch <= 0x3E /* > */ || ch === 0x40 /* @ */ || ch === 0x60 /* ` */ || ch === 0x7E /* ~ */;
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-ClassControlLetter
pp$1.regexp_eatClassControlLetter = function (state) {
var ch = state.current();
if (isDecimalDigit(ch) || ch === 0x5F /* _ */) {
state.lastIntValue = ch % 0x20;
state.advance();
return true;
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
pp$1.regexp_eatHexEscapeSequence = function (state) {
var start = state.pos;
if (state.eat(0x78 /* x */)) {
if (this.regexp_eatFixedHexDigits(state, 2)) {
return true;
}
if (state.switchU) {
state.raise("Invalid escape");
}
state.pos = start;
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-DecimalDigits
pp$1.regexp_eatDecimalDigits = function (state) {
var start = state.pos;
var ch = 0;
state.lastIntValue = 0;
while (isDecimalDigit(ch = state.current())) {
state.lastIntValue = 10 * state.lastIntValue + (ch - 0x30 /* 0 */);
state.advance();
}
return state.pos !== start;
};
function isDecimalDigit(ch) {
return ch >= 0x30 /* 0 */ && ch <= 0x39; /* 9 */
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigits
pp$1.regexp_eatHexDigits = function (state) {
var start = state.pos;
var ch = 0;
state.lastIntValue = 0;
while (isHexDigit(ch = state.current())) {
state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);
state.advance();
}
return state.pos !== start;
};
function isHexDigit(ch) {
return ch >= 0x30 /* 0 */ && ch <= 0x39 /* 9 */ || ch >= 0x41 /* A */ && ch <= 0x46 /* F */ || ch >= 0x61 /* a */ && ch <= 0x66 /* f */;
}
function hexToInt(ch) {
if (ch >= 0x41 /* A */ && ch <= 0x46 /* F */) {
return 10 + (ch - 0x41 /* A */);
}
if (ch >= 0x61 /* a */ && ch <= 0x66 /* f */) {
return 10 + (ch - 0x61 /* a */);
}
return ch - 0x30; /* 0 */
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-annexB-LegacyOctalEscapeSequence
// Allows only 0-377(octal) i.e. 0-255(decimal).
pp$1.regexp_eatLegacyOctalEscapeSequence = function (state) {
if (this.regexp_eatOctalDigit(state)) {
var n1 = state.lastIntValue;
if (this.regexp_eatOctalDigit(state)) {
var n2 = state.lastIntValue;
if (n1 <= 3 && this.regexp_eatOctalDigit(state)) {
state.lastIntValue = n1 * 64 + n2 * 8 + state.lastIntValue;
} else {
state.lastIntValue = n1 * 8 + n2;
}
} else {
state.lastIntValue = n1;
}
return true;
}
return false;
};
// https://www.ecma-international.org/ecma-262/8.0/#prod-OctalDigit
pp$1.regexp_eatOctalDigit = function (state) {
var ch = state.current();
if (isOctalDigit(ch)) {
state.lastIntValue = ch - 0x30; /* 0 */
state.advance();
return true;
}
state.lastIntValue = 0;
return false;
};
function isOctalDigit(ch) {
return ch >= 0x30 /* 0 */ && ch <= 0x37; /* 7 */
}
// https://www.ecma-international.org/ecma-262/8.0/#prod-Hex4Digits
// https://www.ecma-international.org/ecma-262/8.0/#prod-HexDigit
// And HexDigit HexDigit in https://www.ecma-international.org/ecma-262/8.0/#prod-HexEscapeSequence
pp$1.regexp_eatFixedHexDigits = function (state, length) {
var start = state.pos;
state.lastIntValue = 0;
for (var i = 0; i < length; ++i) {
var ch = state.current();
if (!isHexDigit(ch)) {
state.pos = start;
return false;
}
state.lastIntValue = 16 * state.lastIntValue + hexToInt(ch);
state.advance();
}
return true;
};
// Object type used to represent tokens. Note that normally, tokens
// simply exist as properties on the parser object. This is only
// used for the onToken callback and the external tokenizer.
var Token = function Token(p) {
this.type = p.type;
this.value = p.value;
this.start = p.start;
this.end = p.end;
if (p.options.locations) {
this.loc = new SourceLocation(p, p.startLoc, p.endLoc);
}
if (p.options.ranges) {
this.range = [p.start, p.end];
}
};
// ## Tokenizer
var pp = Parser.prototype;
// Move to the next token
pp.next = function (ignoreEscapeSequenceInKeyword) {
if (!ignoreEscapeSequenceInKeyword && this.type.keyword && this.containsEsc) {
this.raiseRecoverable(this.start, "Escape sequence in keyword " + this.type.keyword);
}
if (this.options.onToken) {
this.options.onToken(new Token(this));
}
this.lastTokEnd = this.end;
this.lastTokStart = this.start;
this.lastTokEndLoc = this.endLoc;
this.lastTokStartLoc = this.startLoc;
this.nextToken();
};
pp.getToken = function () {
this.next();
return new Token(this);
};
// If we're in an ES6 environment, make parsers iterable
if (typeof _Symbol !== "undefined") {
pp[_Symbol$iterator] = function () {
var this$1$1 = this;
return {
next: function () {
var token = this$1$1.getToken();
return {
done: token.type === types$1.eof,
value: token
};
}
};
};
}
// Toggle strict mode. Re-reads the next number or string to please
// pedantic tests (`"use strict"; 010;` should fail).
// Read a single token, updating the parser object's token-related
// properties.
pp.nextToken = function () {
var curContext = this.curContext();
if (!curContext || !curContext.preserveSpace) {
this.skipSpace();
}
this.start = this.pos;
if (this.options.locations) {
this.startLoc = this.curPosition();
}
if (this.pos >= this.input.length) {
return this.finishToken(types$1.eof);
}
if (curContext.override) {
return curContext.override(this);
} else {
this.readToken(this.fullCharCodeAtPos());
}
};
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 /* '\' */) {
return this.readWord();
}
return this.getTokenFromCode(code);
};
pp.fullCharCodeAtPos = function () {
var code = this.input.charCodeAt(this.pos);
if (code <= 0xd7ff || code >= 0xdc00) {
return code;
}
var next = this.input.charCodeAt(this.pos + 1);
return next <= 0xdbff || next >= 0xe000 ? code : (code << 10) + next - 0x35fdc00;
};
pp.skipBlockComment = function () {
var _context31;
var startLoc = this.options.onComment && this.curPosition();
var start = this.pos,
end = _indexOfInstanceProperty(_context31 = this.input).call(_context31, "*/", this.pos += 2);
if (end === -1) {
this.raise(this.pos - 2, "Unterminated comment");
}
this.pos = end + 2;
if (this.options.locations) {
for (var nextBreak = undefined, pos = start; (nextBreak = nextLineBreak(this.input, pos, this.pos)) > -1;) {
++this.curLine;
pos = this.lineStart = nextBreak;
}
}
if (this.options.onComment) {
var _context32;
this.options.onComment(true, _sliceInstanceProperty(_context32 = this.input).call(_context32, start + 2, end), start, this.pos, startLoc, this.curPosition());
}
};
pp.skipLineComment = function (startSkip) {
var start = this.pos;
var startLoc = this.options.onComment && this.curPosition();
var ch = this.input.charCodeAt(this.pos += startSkip);
while (this.pos < this.input.length && !isNewLine(ch)) {
ch = this.input.charCodeAt(++this.pos);
}
if (this.options.onComment) {
var _context33;
this.options.onComment(false, _sliceInstanceProperty(_context33 = this.input).call(_context33, start + startSkip, this.pos), start, this.pos, startLoc, this.curPosition());
}
};
// Called at the start of the parse and after every token. Skips
// whitespace and comments, and.
pp.skipSpace = function () {
loop: while (this.pos < this.input.length) {
var ch = this.input.charCodeAt(this.pos);
switch (ch) {
case 32:
case 160:
// ' '
++this.pos;
break;
case 13:
if (this.input.charCodeAt(this.pos + 1) === 10) {
++this.pos;
}
case 10:
case 8232:
case 8233:
++this.pos;
if (this.options.locations) {
++this.curLine;
this.lineStart = this.pos;
}
break;
case 47:
// '/'
switch (this.input.charCodeAt(this.pos + 1)) {
case 42:
// '*'
this.skipBlockComment();
break;
case 47:
this.skipLineComment(2);
break;
default:
break loop;
}
break;
default:
if (ch > 8 && ch < 14 || ch >= 5760 && nonASCIIwhitespace.test(String.fromCharCode(ch))) {
++this.pos;
} else {
break loop;
}
}
}
};
// Called at the end of every token. Sets `end`, `val`, and
// maintains `context` and `exprAllowed`, and skips the space after
// the token, so that the next one's `start` will point at the
// right position.
pp.finishToken = function (type, val) {
this.end = this.pos;
if (this.options.locations) {
this.endLoc = this.curPosition();
}
var prevType = this.type;
this.type = type;
this.value = val;
this.updateContext(prevType);
};
// ### Token reading
// This is the function that is called to fetch the next token. It
// is somewhat obscure, because it works in character codes rather
// than characters, and because operator parsing has been inlined
// into it.
//
// All in the name of speed.
//
pp.readToken_dot = function () {
var next = this.input.charCodeAt(this.pos + 1);
if (next >= 48 && next <= 57) {
return this.readNumber(true);
}
var next2 = this.input.charCodeAt(this.pos + 2);
if (this.options.ecmaVersion >= 6 && next === 46 && next2 === 46) {
// 46 = dot '.'
this.pos += 3;
return this.finishToken(types$1.ellipsis);
} else {
++this.pos;
return this.finishToken(types$1.dot);
}
};
pp.readToken_slash = function () {
// '/'
var next = this.input.charCodeAt(this.pos + 1);
if (this.exprAllowed) {
++this.pos;
return this.readRegexp();
}
if (next === 61) {
return this.finishOp(types$1.assign, 2);
}
return this.finishOp(types$1.slash, 1);
};
pp.readToken_mult_modulo_exp = function (code) {
// '%*'
var next = this.input.charCodeAt(this.pos + 1);
var size = 1;
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$1.starstar;
next = this.input.charCodeAt(this.pos + 2);
}
if (next === 61) {
return this.finishOp(types$1.assign, size + 1);
}
return this.finishOp(tokentype, size);
};
pp.readToken_pipe_amp = function (code) {
// '|&'
var next = this.input.charCodeAt(this.pos + 1);
if (next === code) {
if (this.options.ecmaVersion >= 12) {
var next2 = this.input.charCodeAt(this.pos + 2);
if (next2 === 61) {
return this.finishOp(types$1.assign, 3);
}
}
return this.finishOp(code === 124 ? types$1.logicalOR : types$1.logicalAND, 2);
}
if (next === 61) {
return this.finishOp(types$1.assign, 2);
}
return this.finishOp(code === 124 ? types$1.bitwiseOR : types$1.bitwiseAND, 1);
};
pp.readToken_caret = function () {
// '^'
var next = this.input.charCodeAt(this.pos + 1);
if (next === 61) {
return this.finishOp(types$1.assign, 2);
}
return this.finishOp(types$1.bitwiseXOR, 1);
};
pp.readToken_plus_min = function (code) {
// '+-'
var next = this.input.charCodeAt(this.pos + 1);
if (next === code) {
var _context34;
if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 && (this.lastTokEnd === 0 || lineBreak.test(_sliceInstanceProperty(_context34 = this.input).call(_context34, this.lastTokEnd, this.pos)))) {
// A `-->` line comment
this.skipLineComment(3);
this.skipSpace();
return this.nextToken();
}
return this.finishOp(types$1.incDec, 2);
}
if (next === 61) {
return this.finishOp(types$1.assign, 2);
}
return this.finishOp(types$1.plusMin, 1);
};
pp.readToken_lt_gt = function (code) {
// '<>'
var next = this.input.charCodeAt(this.pos + 1);
var size = 1;
if (next === code) {
size = code === 62 && this.input.charCodeAt(this.pos + 2) === 62 ? 3 : 2;
if (this.input.charCodeAt(this.pos + size) === 61) {
return this.finishOp(types$1.assign, size + 1);
}
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) {
// `<!--`, an XML-style comment that should be interpreted as a line comment
this.skipLineComment(4);
this.skipSpace();
return this.nextToken();
}
if (next === 61) {
size = 2;
}
return this.finishOp(types$1.relational, size);
};
pp.readToken_eq_excl = function (code) {
// '=!'
var next = this.input.charCodeAt(this.pos + 1);
if (next === 61) {
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$1.arrow);
}
return this.finishOp(code === 61 ? types$1.eq : types$1.prefix, 1);
};
pp.readToken_question = function () {
// '?'
var ecmaVersion = this.options.ecmaVersion;
if (ecmaVersion >= 11) {
var next = this.input.charCodeAt(this.pos + 1);
if (next === 46) {
var next2 = this.input.charCodeAt(this.pos + 2);
if (next2 < 48 || next2 > 57) {
return this.finishOp(types$1.questionDot, 2);
}
}
if (next === 63) {
if (ecmaVersion >= 12) {
var next2$1 = this.input.charCodeAt(this.pos + 2);
if (next2$1 === 61) {
return this.finishOp(types$1.assign, 3);
}
}
return this.finishOp(types$1.coalesce, 2);
}
}
return this.finishOp(types$1.question, 1);
};
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.
case 46:
// '.'
return this.readToken_dot();
// Punctuation tokens.
case 40:
++this.pos;
return this.finishToken(types$1.parenL);
case 41:
++this.pos;
return this.finishToken(types$1.parenR);
case 59:
++this.pos;
return this.finishToken(types$1.semi);
case 44:
++this.pos;
return this.finishToken(types$1.comma);
case 91:
++this.pos;
return this.finishToken(types$1.bracketL);
case 93:
++this.pos;
return this.finishToken(types$1.bracketR);
case 123:
++this.pos;
return this.finishToken(types$1.braceL);
case 125:
++this.pos;
return this.finishToken(types$1.braceR);
case 58:
++this.pos;
return this.finishToken(types$1.colon);
case 96:
// '`'
if (this.options.ecmaVersion < 6) {
break;
}
++this.pos;
return this.finishToken(types$1.backQuote);
case 48:
// '0'
var next = this.input.charCodeAt(this.pos + 1);
if (next === 120 || next === 88) {
return this.readRadixNumber(16);
} // '0x', '0X' - hex number
if (this.options.ecmaVersion >= 6) {
if (next === 111 || next === 79) {
return this.readRadixNumber(8);
} // '0o', '0O' - octal number
if (next === 98 || next === 66) {
return this.readRadixNumber(2);
} // '0b', '0B' - binary number
}
// Anything else beginning with a digit is an integer, octal
// number, or float.
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57:
// 1-9
return this.readNumber(false);
// Quotes produce strings.
case 34:
case 39:
// '"', "'"
return this.readString(code);
// Operators are parsed inline in tiny state machines. '=' (61) is
// often referred to. `finishOp` simply skips the amount of
// characters it is given as second argument, and returns a token
// of the type given by its first argument.
case 47:
// '/'
return this.readToken_slash();
case 37:
case 42:
// '%*'
return this.readToken_mult_modulo_exp(code);
case 124:
case 38:
// '|&'
return this.readToken_pipe_amp(code);
case 94:
// '^'
return this.readToken_caret();
case 43:
case 45:
// '+-'
return this.readToken_plus_min(code);
case 60:
case 62:
// '<>'
return this.readToken_lt_gt(code);
case 61:
case 33:
// '=!'
return this.readToken_eq_excl(code);
case 63:
// '?'
return this.readToken_question();
case 126:
// '~'
return this.finishOp(types$1.prefix, 1);
case 35:
// '#'
return this.readToken_numberSign();
}
this.raise(this.pos, "Unexpected character '" + codePointToString(code) + "'");
};
pp.finishOp = function (type, size) {
var _context35;
var str = _sliceInstanceProperty(_context35 = this.input).call(_context35, this.pos, this.pos + size);
this.pos += size;
return this.finishToken(type, str);
};
pp.readRegexp = function () {
var _context36;
var escaped,
inClass,
start = this.pos;
for (;;) {
if (this.pos >= this.input.length) {
this.raise(start, "Unterminated regular expression");
}
var ch = this.input.charAt(this.pos);
if (lineBreak.test(ch)) {
this.raise(start, "Unterminated regular expression");
}
if (!escaped) {
if (ch === "[") {
inClass = true;
} else if (ch === "]" && inClass) {
inClass = false;
} else if (ch === "/" && !inClass) {
break;
}
escaped = ch === "\\";
} else {
escaped = false;
}
++this.pos;
}
var pattern = _sliceInstanceProperty(_context36 = this.input).call(_context36, start, this.pos);
++this.pos;
var flagsStart = this.pos;
var flags = this.readWord1();
if (this.containsEsc) {
this.unexpected(flagsStart);
}
// Validate pattern
var state = this.regexpState || (this.regexpState = new RegExpValidationState(this));
state.reset(start, pattern, flags);
this.validateRegExpFlags(state);
this.validateRegExpPattern(state);
// Create Literal#value property value.
var value = null;
try {
value = new RegExp(pattern, flags);
} catch (e) {
// ESTree requires null if it failed to instantiate RegExp object.
// https://github.com/estree/estree/blob/a27003adf4fd7bfad44de9cef372a2eacd527b1c/es5.md#regexpliteral
}
return this.finishToken(types$1.regexp, {
pattern: pattern,
flags: flags,
value: value
});
};
// Read an integer in the given radix. Return null if zero digits
// were read, the integer value otherwise. When `len` is given, this
// will return `null` unless the integer has exactly `len` digits.
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
// is zero then disallow separators.
var isLegacyOctalNumericLiteral = maybeLegacyOctalNumericLiteral && this.input.charCodeAt(this.pos) === 48;
var start = this.pos,
total = 0,
lastCode = 0;
for (var i = 0, e = len == null ? Infinity : len; i < e; ++i, ++this.pos) {
var code = this.input.charCodeAt(this.pos),
val = undefined;
if (allowSeparators && code === 95) {
if (isLegacyOctalNumericLiteral) {
this.raiseRecoverable(this.pos, "Numeric separator is not allowed in legacy octal numeric literals");
}
if (lastCode === 95) {
this.raiseRecoverable(this.pos, "Numeric separator must be exactly one underscore");
}
if (i === 0) {
this.raiseRecoverable(this.pos, "Numeric separator is not allowed at the first of digits");
}
lastCode = code;
continue;
}
if (code >= 97) {
val = code - 97 + 10;
} // a
else if (code >= 65) {
val = code - 65 + 10;
} // A
else if (code >= 48 && code <= 57) {
val = code - 48;
} // 0-9
else {
val = Infinity;
}
if (val >= radix) {
break;
}
lastCode = code;
total = total * radix + val;
}
if (allowSeparators && lastCode === 95) {
this.raiseRecoverable(this.pos - 1, "Numeric separator is not allowed at the last of digits");
}
if (this.pos === start || len != null && this.pos - start !== len) {
return null;
}
return total;
};
function stringToNumber(str, isLegacyOctalNumericLiteral) {
if (isLegacyOctalNumericLiteral) {
return _parseInt(str, 8);
}
// `parseFloat(value)` stops parsing at the first numeric separator then returns a wrong value.
return _parseFloat(str.replace(/_/g, ""));
}
function stringToBigInt(str) {
if (typeof BigInt !== "function") {
return null;
}
// `BigInt(value)` throws syntax error if the string contains numeric separators.
return BigInt(str.replace(/_/g, ""));
}
pp.readRadixNumber = function (radix) {
var start = this.pos;
this.pos += 2; // 0x
var val = this.readInt(radix);
if (val == null) {
this.raise(this.start + 2, "Expected number in radix " + radix);
}
if (this.options.ecmaVersion >= 11 && this.input.charCodeAt(this.pos) === 110) {
var _context37;
val = stringToBigInt(_sliceInstanceProperty(_context37 = this.input).call(_context37, start, this.pos));
++this.pos;
} else if (isIdentifierStart(this.fullCharCodeAtPos())) {
this.raise(this.pos, "Identifier directly after number");
}
return this.finishToken(types$1.num, val);
};
// Read an integer, octal integer, or floating-point number.
pp.readNumber = function (startsWithDot) {
var _context39, _context40;
var start = this.pos;
if (!startsWithDot && this.readInt(10, undefined, true) === null) {
this.raise(start, "Invalid number");
}
var octal = this.pos - start >= 2 && this.input.charCodeAt(start) === 48;
if (octal && this.strict) {
this.raise(start, "Invalid number");
}
var next = this.input.charCodeAt(this.pos);
if (!octal && !startsWithDot && this.options.ecmaVersion >= 11 && next === 110) {
var _context38;
var val$1 = stringToBigInt(_sliceInstanceProperty(_context38 = this.input).call(_context38, start, this.pos));
++this.pos;
if (isIdentifierStart(this.fullCharCodeAtPos())) {
this.raise(this.pos, "Identifier directly after number");
}
return this.finishToken(types$1.num, val$1);
}
if (octal && /[89]/.test(_sliceInstanceProperty(_context39 = this.input).call(_context39, start, this.pos))) {
octal = false;
}
if (next === 46 && !octal) {
// '.'
++this.pos;
this.readInt(10);
next = this.input.charCodeAt(this.pos);
}
if ((next === 69 || next === 101) && !octal) {
// 'eE'
next = this.input.charCodeAt(++this.pos);
if (next === 43 || next === 45) {
++this.pos;
} // '+-'
if (this.readInt(10) === null) {
this.raise(start, "Invalid number");
}
}
if (isIdentifierStart(this.fullCharCodeAtPos())) {
this.raise(this.pos, "Identifier directly after number");
}
var val = stringToNumber(_sliceInstanceProperty(_context40 = this.input).call(_context40, start, this.pos), octal);
return this.finishToken(types$1.num, val);
};
// Read a string value, interpreting backslash-escapes.
pp.readCodePoint = function () {
var ch = this.input.charCodeAt(this.pos),
code;
if (ch === 123) {
var _context41;
// '{'
if (this.options.ecmaVersion < 6) {
this.unexpected();
}
var codePos = ++this.pos;
code = this.readHexChar(_indexOfInstanceProperty(_context41 = this.input).call(_context41, "}", this.pos) - this.pos);
++this.pos;
if (code > 0x10FFFF) {
this.invalidStringToken(codePos, "Code point out of bounds");
}
} else {
code = this.readHexChar(4);
}
return code;
};
pp.readString = function (quote) {
var _context43;
var out = "",
chunkStart = ++this.pos;
for (;;) {
if (this.pos >= this.input.length) {
this.raise(this.start, "Unterminated string constant");
}
var ch = this.input.charCodeAt(this.pos);
if (ch === quote) {
break;
}
if (ch === 92) {
var _context42;
// '\'
out += _sliceInstanceProperty(_context42 = this.input).call(_context42, 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.raise(this.start, "Unterminated string constant");
}
++this.pos;
}
}
out += _sliceInstanceProperty(_context43 = this.input).call(_context43, chunkStart, this.pos++);
return this.finishToken(types$1.string, out);
};
// Reads template string tokens.
var INVALID_TEMPLATE_ESCAPE_ERROR = {};
pp.tryReadTemplateToken = function () {
this.inTemplateElement = true;
try {
this.readTmplToken();
} catch (err) {
if (err === INVALID_TEMPLATE_ESCAPE_ERROR) {
this.readInvalidTemplateToken();
} else {
throw err;
}
}
this.inTemplateElement = false;
};
pp.invalidStringToken = function (position, message) {
if (this.inTemplateElement && this.options.ecmaVersion >= 9) {
throw INVALID_TEMPLATE_ESCAPE_ERROR;
} else {
this.raise(position, message);
}
};
pp.readTmplToken = function () {
var out = "",
chunkStart = this.pos;
for (;;) {
if (this.pos >= this.input.length) {
this.raise(this.start, "Unterminated template");
}
var ch = this.input.charCodeAt(this.pos);
if (ch === 96 || ch === 36 && this.input.charCodeAt(this.pos + 1) === 123) {
var _context44;
// '`', '${'
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$1.dollarBraceL);
} else {
++this.pos;
return this.finishToken(types$1.backQuote);
}
}
out += _sliceInstanceProperty(_context44 = this.input).call(_context44, chunkStart, this.pos);
return this.finishToken(types$1.template, out);
}
if (ch === 92) {
var _context45;
// '\'
out += _sliceInstanceProperty(_context45 = this.input).call(_context45, chunkStart, this.pos);
out += this.readEscapedChar(true);
chunkStart = this.pos;
} else if (isNewLine(ch)) {
var _context46;
out += _sliceInstanceProperty(_context46 = this.input).call(_context46, chunkStart, this.pos);
++this.pos;
switch (ch) {
case 13:
if (this.input.charCodeAt(this.pos) === 10) {
++this.pos;
}
case 10:
out += "\n";
break;
default:
out += String.fromCharCode(ch);
break;
}
if (this.options.locations) {
++this.curLine;
this.lineStart = this.pos;
}
chunkStart = this.pos;
} else {
++this.pos;
}
}
};
// Reads a template token to search for the end, without validating any escape sequences
pp.readInvalidTemplateToken = function () {
var _context47;
for (; this.pos < this.input.length; this.pos++) {
switch (this.input[this.pos]) {
case "\\":
++this.pos;
break;
case "$":
if (this.input[this.pos + 1] !== "{") {
break;
}
// fall through
case "`":
return this.finishToken(types$1.invalidTemplate, _sliceInstanceProperty(_context47 = this.input).call(_context47, this.start, this.pos));
case "\r":
if (this.input[this.pos + 1] === "\n") {
++this.pos;
}
// fall through
case "\n":
case "\u2028":
case "\u2029":
++this.curLine;
this.lineStart = this.pos + 1;
break;
}
}
this.raise(this.start, "Unterminated template");
};
// Used to read escaped characters
pp.readEscapedChar = function (inTemplate) {
var ch = this.input.charCodeAt(++this.pos);
++this.pos;
switch (ch) {
case 110:
return "\n";
// 'n' -> '\n'
case 114:
return "\r";
// 'r' -> '\r'
case 120:
return String.fromCharCode(this.readHexChar(2));
// 'x'
case 117:
return codePointToString(this.readCodePoint());
// 'u'
case 116:
return "\t";
// 't' -> '\t'
case 98:
return "\b";
// 'b' -> '\b'
case 118:
return "\u000b";
// 'v' -> '\u000b'
case 102:
return "\f";
// 'f' -> '\f'
case 13:
if (this.input.charCodeAt(this.pos) === 10) {
++this.pos;
}
// '\r\n'
case 10:
// ' \n'
if (this.options.locations) {
this.lineStart = this.pos;
++this.curLine;
}
return "";
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");
}
default:
if (ch >= 48 && ch <= 55) {
var octalStr = this.input.substr(this.pos - 1, 3).match(/^[0-7]+/)[0];
var octal = _parseInt(octalStr, 8);
if (octal > 255) {
octalStr = _sliceInstanceProperty(octalStr).call(octalStr, 0, -1);
octal = _parseInt(octalStr, 8);
}
this.pos += octalStr.length - 1;
ch = this.input.charCodeAt(this.pos);
if ((octalStr !== "0" || ch === 56 || ch === 57) && (this.strict || inTemplate)) {
this.invalidStringToken(this.pos - 1 - octalStr.length, inTemplate ? "Octal literal in template string" : "Octal literal in strict mode");
}
return String.fromCharCode(octal);
}
if (isNewLine(ch)) {
// Unicode new line characters after \ get removed from output in both
// template literals and strings
if (this.options.locations) {
this.lineStart = this.pos;
++this.curLine;
}
return "";
}
return String.fromCharCode(ch);
}
};
// Used to read character escape sequences ('\x', '\u', '\U').
pp.readHexChar = function (len) {
var codePos = this.pos;
var n = this.readInt(16, len);
if (n === null) {
this.invalidStringToken(codePos, "Bad character escape sequence");
}
return n;
};
// Read an identifier, and return it as a string. Sets `this.containsEsc`
// to whether the word contained a '\u' escape.
//
// Incrementally adds only escaped chars, adding other chunks as-is
// as a micro-optimization.
pp.readWord1 = function () {
var _context49;
this.containsEsc = false;
var word = "",
first = true,
chunkStart = this.pos;
var astral = this.options.ecmaVersion >= 6;
while (this.pos < this.input.length) {
var ch = this.fullCharCodeAtPos();
if (isIdentifierChar(ch, astral)) {
this.pos += ch <= 0xffff ? 1 : 2;
} else if (ch === 92) {
var _context48;
// "\"
this.containsEsc = true;
word += _sliceInstanceProperty(_context48 = this.input).call(_context48, chunkStart, this.pos);
var escStart = this.pos;
if (this.input.charCodeAt(++this.pos) !== 117)
// "u"
{
this.invalidStringToken(this.pos, "Expecting Unicode escape sequence \\uXXXX");
}
++this.pos;
var esc = this.readCodePoint();
if (!(first ? isIdentifierStart : isIdentifierChar)(esc, astral)) {
this.invalidStringToken(escStart, "Invalid Unicode escape");
}
word += codePointToString(esc);
chunkStart = this.pos;
} else {
break;
}
first = false;
}
return word + _sliceInstanceProperty(_context49 = this.input).call(_context49, chunkStart, this.pos);
};
// Read an identifier or keyword token. Will check for reserved
// words when necessary.
pp.readWord = function () {
var word = this.readWord1();
var type = types$1.name;
if (this.keywords.test(word)) {
type = keywords[word];
}
return this.finishToken(type, word);
};
// Acorn is a tiny, fast JavaScript parser written in JavaScript.
//
// Acorn was written by Marijn Haverbeke, Ingvar Stepanyan, and
// various contributors and released under an MIT license.
//
// Git repositories for Acorn are available at
//
// http://marijnhaverbeke.nl/git/acorn
// https://github.com/acornjs/acorn.git
//
// Please use the [github bug tracker][ghbt] to report issues.
//
// [ghbt]: https://github.com/acornjs/acorn/issues
//
// [walk]: util/walk.js
var version = "8.14.0";
Parser.acorn = {
Parser: Parser,
version: version,
defaultOptions: defaultOptions,
Position: Position,
SourceLocation: SourceLocation,
getLineInfo: getLineInfo,
Node: Node,
TokenType: TokenType,
tokTypes: types$1,
keywordTypes: keywords,
TokContext: TokContext,
tokContexts: types,
isIdentifierChar: isIdentifierChar,
isIdentifierStart: isIdentifierStart,
Token: Token,
isNewLine: isNewLine,
lineBreak: lineBreak,
lineBreakG: lineBreakG,
nonASCIIwhitespace: nonASCIIwhitespace
};
// The main exported interface (under `self.acorn` when in the
// browser) is a `parse` function that takes a code string and returns
// an abstract syntax tree as specified by the [ESTree spec][estree].
//
// [estree]: https://github.com/estree/estree
function parse(input, options) {
return Parser.parse(input, options);
}
// This function tries to parse a single expression at a given
// offset in a string. Useful for parsing mixed-language formats
// that embed JavaScript expressions.
function parseExpressionAt(input, pos, options) {
return Parser.parseExpressionAt(input, pos, options);
}
// Acorn is organized as a tokenizer and a recursive-descent parser.
// The `tokenizer` export provides an interface to the tokenizer.
function tokenizer(input, options) {
return Parser.tokenizer(input, options);
}
exports.Node = Node;
exports.Parser = Parser;
exports.Position = Position;
exports.SourceLocation = SourceLocation;
exports.TokContext = TokContext;
exports.Token = Token;
exports.TokenType = TokenType;
exports.defaultOptions = defaultOptions;
exports.getLineInfo = getLineInfo;
exports.isIdentifierChar = isIdentifierChar;
exports.isIdentifierStart = isIdentifierStart;
exports.isNewLine = isNewLine;
exports.keywordTypes = keywords;
exports.lineBreak = lineBreak;
exports.lineBreakG = lineBreakG;
exports.nonASCIIwhitespace = nonASCIIwhitespace;
exports.parse = parse;
exports.parseExpressionAt = parseExpressionAt;
exports.tokContexts = types;
exports.tokTypes = types$1;
exports.tokenizer = tokenizer;
exports.version = version;
});
})(acorn$1, acorn$1.exports);
return acorn$1.exports;
}
var hasRequiredAcornJsx;
function requireAcornJsx() {
if (hasRequiredAcornJsx) return acornJsx.exports;
hasRequiredAcornJsx = 1;
(function (module) {
const XHTMLEntities = requireXhtml();
const hexNumber = /^[\da-fA-F]+$/;
const decimalNumber = /^\d+$/;
// The map to `acorn-jsx` tokens from `acorn` namespace objects.
const acornJsxMap = new _WeakMap();
// Get the original tokens for the given `acorn` namespace object.
function getJsxTokens(acorn) {
acorn = acorn.Parser.acorn || acorn;
let acornJsx = acornJsxMap.get(acorn);
if (!acornJsx) {
const tt = acorn.tokTypes;
const TokContext = acorn.TokContext;
const TokenType = acorn.TokenType;
const tc_oTag = new TokContext('<tag', false);
const tc_cTag = new TokContext('</tag', false);
const tc_expr = new TokContext('<tag>...</tag>', true, true);
const tokContexts = {
tc_oTag: tc_oTag,
tc_cTag: tc_cTag,
tc_expr: tc_expr
};
const tokTypes = {
jsxName: new TokenType('jsxName'),
jsxText: new TokenType('jsxText', {
beforeExpr: true
}),
jsxTagStart: new TokenType('jsxTagStart', {
startsExpr: true
}),
jsxTagEnd: new TokenType('jsxTagEnd')
};
tokTypes.jsxTagStart.updateContext = function () {
this.context.push(tc_expr); // treat as beginning of JSX expression
this.context.push(tc_oTag); // start opening tag context
this.exprAllowed = false;
};
tokTypes.jsxTagEnd.updateContext = function (prevType) {
let out = this.context.pop();
if (out === tc_oTag && prevType === tt.slash || out === tc_cTag) {
this.context.pop();
this.exprAllowed = this.curContext() === tc_expr;
} else {
this.exprAllowed = true;
}
};
acornJsx = {
tokContexts: tokContexts,
tokTypes: tokTypes
};
acornJsxMap.set(acorn, acornJsx);
}
return acornJsx;
}
// Transforms JSX element name to string.
function getQualifiedJSXName(object) {
if (!object) return object;
if (object.type === 'JSXIdentifier') return object.name;
if (object.type === 'JSXNamespacedName') return object.namespace.name + ':' + object.name.name;
if (object.type === 'JSXMemberExpression') return getQualifiedJSXName(object.object) + '.' + getQualifiedJSXName(object.property);
}
module.exports = function (options) {
options = options || {};
return function (Parser) {
return plugin({
allowNamespaces: options.allowNamespaces !== false,
allowNamespacedObjects: !!options.allowNamespacedObjects
}, Parser);
};
};
// This is `tokTypes` of the peer dep.
// This can be different instances from the actual `tokTypes` this plugin uses.
_Object$defineProperty(module.exports, "tokTypes", {
get: function get_tokTypes() {
return getJsxTokens(requireAcorn()).tokTypes;
},
configurable: true,
enumerable: true
});
function plugin(options, Parser) {
const acorn = Parser.acorn || requireAcorn();
const acornJsx = getJsxTokens(acorn);
const tt = acorn.tokTypes;
const tok = acornJsx.tokTypes;
const tokContexts = acorn.tokContexts;
const tc_oTag = acornJsx.tokContexts.tc_oTag;
const tc_cTag = acornJsx.tokContexts.tc_cTag;
const tc_expr = acornJsx.tokContexts.tc_expr;
const isNewLine = acorn.isNewLine;
const isIdentifierStart = acorn.isIdentifierStart;
const isIdentifierChar = acorn.isIdentifierChar;
return class extends Parser {
// Expose actual `tokTypes` and `tokContexts` to other plugins.
static get acornJsx() {
return acornJsx;
}
// Reads inline JSX contents token.
jsx_readToken() {
var _context, _context2;
let out = '',
chunkStart = this.pos;
for (;;) {
if (this.pos >= this.input.length) this.raise(this.start, 'Unterminated JSX contents');
let ch = this.input.charCodeAt(this.pos);
switch (ch) {
case 60: // '<'
case 123:
// '{'
if (this.pos === this.start) {
if (ch === 60 && this.exprAllowed) {
++this.pos;
return this.finishToken(tok.jsxTagStart);
}
return this.getTokenFromCode(ch);
}
out += _sliceInstanceProperty(_context = this.input).call(_context, chunkStart, this.pos);
return this.finishToken(tok.jsxText, out);
case 38:
// '&'
out += _sliceInstanceProperty(_context2 = this.input).call(_context2, chunkStart, this.pos);
out += this.jsx_readEntity();
chunkStart = this.pos;
break;
case 62: // '>'
case 125:
// '}'
this.raise(this.pos, "Unexpected token `" + this.input[this.pos] + "`. Did you mean `" + (ch === 62 ? ">" : "}") + "` or " + "`{\"" + this.input[this.pos] + "\"}" + "`?");
default:
if (isNewLine(ch)) {
var _context3;
out += _sliceInstanceProperty(_context3 = this.input).call(_context3, chunkStart, this.pos);
out += this.jsx_readNewLine(true);
chunkStart = this.pos;
} else {
++this.pos;
}
}
}
}
jsx_readNewLine(normalizeCRLF) {
let ch = this.input.charCodeAt(this.pos);
let out;
++this.pos;
if (ch === 13 && this.input.charCodeAt(this.pos) === 10) {
++this.pos;
out = normalizeCRLF ? '\n' : '\r\n';
} else {
out = String.fromCharCode(ch);
}
if (this.options.locations) {
++this.curLine;
this.lineStart = this.pos;
}
return out;
}
jsx_readString(quote) {
var _context6;
let out = '',
chunkStart = ++this.pos;
for (;;) {
if (this.pos >= this.input.length) this.raise(this.start, 'Unterminated string constant');
let ch = this.input.charCodeAt(this.pos);
if (ch === quote) break;
if (ch === 38) {
var _context4;
// '&'
out += _sliceInstanceProperty(_context4 = this.input).call(_context4, chunkStart, this.pos);
out += this.jsx_readEntity();
chunkStart = this.pos;
} else if (isNewLine(ch)) {
var _context5;
out += _sliceInstanceProperty(_context5 = this.input).call(_context5, chunkStart, this.pos);
out += this.jsx_readNewLine(false);
chunkStart = this.pos;
} else {
++this.pos;
}
}
out += _sliceInstanceProperty(_context6 = this.input).call(_context6, chunkStart, this.pos++);
return this.finishToken(tt.string, out);
}
jsx_readEntity() {
let str = '',
count = 0,
entity;
let ch = this.input[this.pos];
if (ch !== '&') this.raise(this.pos, 'Entity must start with an ampersand');
let startPos = ++this.pos;
while (this.pos < this.input.length && count++ < 10) {
ch = this.input[this.pos++];
if (ch === ';') {
if (str[0] === '#') {
if (str[1] === 'x') {
str = str.substr(2);
if (hexNumber.test(str)) entity = String.fromCharCode(_parseInt(str, 16));
} else {
str = str.substr(1);
if (decimalNumber.test(str)) entity = String.fromCharCode(_parseInt(str, 10));
}
} else {
entity = XHTMLEntities[str];
}
break;
}
str += ch;
}
if (!entity) {
this.pos = startPos;
return '&';
}
return entity;
}
// Read a JSX identifier (valid tag or attribute name).
//
// Optimized version since JSX identifiers can't contain
// escape characters and so can be read as single slice.
// Also assumes that first character was already checked
// by isIdentifierStart in readToken.
jsx_readWord() {
var _context7;
let ch,
start = this.pos;
do {
ch = this.input.charCodeAt(++this.pos);
} while (isIdentifierChar(ch) || ch === 45); // '-'
return this.finishToken(tok.jsxName, _sliceInstanceProperty(_context7 = this.input).call(_context7, start, this.pos));
}
// Parse next token as JSX identifier
jsx_parseIdentifier() {
let node = this.startNode();
if (this.type === tok.jsxName) node.name = this.value;else if (this.type.keyword) node.name = this.type.keyword;else this.unexpected();
this.next();
return this.finishNode(node, 'JSXIdentifier');
}
// Parse namespaced identifier.
jsx_parseNamespacedName() {
let startPos = this.start,
startLoc = this.startLoc;
let name = this.jsx_parseIdentifier();
if (!options.allowNamespaces || !this.eat(tt.colon)) return name;
var node = this.startNodeAt(startPos, startLoc);
node.namespace = name;
node.name = this.jsx_parseIdentifier();
return this.finishNode(node, 'JSXNamespacedName');
}
// Parses element name in any form - namespaced, member
// or single identifier.
jsx_parseElementName() {
if (this.type === tok.jsxTagEnd) return '';
let startPos = this.start,
startLoc = this.startLoc;
let node = this.jsx_parseNamespacedName();
if (this.type === tt.dot && node.type === 'JSXNamespacedName' && !options.allowNamespacedObjects) {
this.unexpected();
}
while (this.eat(tt.dot)) {
let newNode = this.startNodeAt(startPos, startLoc);
newNode.object = node;
newNode.property = this.jsx_parseIdentifier();
node = this.finishNode(newNode, 'JSXMemberExpression');
}
return node;
}
// Parses any type of JSX attribute value.
jsx_parseAttributeValue() {
switch (this.type) {
case tt.braceL:
let node = this.jsx_parseExpressionContainer();
if (node.expression.type === 'JSXEmptyExpression') this.raise(node.start, 'JSX attributes must only be assigned a non-empty expression');
return node;
case tok.jsxTagStart:
case tt.string:
return this.parseExprAtom();
default:
this.raise(this.start, 'JSX value should be either an expression or a quoted JSX text');
}
}
// JSXEmptyExpression is unique type since it doesn't actually parse anything,
// and so it should start at the end of last read token (left brace) and finish
// at the beginning of the next one (right brace).
jsx_parseEmptyExpression() {
let node = this.startNodeAt(this.lastTokEnd, this.lastTokEndLoc);
return this.finishNodeAt(node, 'JSXEmptyExpression', this.start, this.startLoc);
}
// Parses JSX expression enclosed into curly brackets.
jsx_parseExpressionContainer() {
let node = this.startNode();
this.next();
node.expression = this.type === tt.braceR ? this.jsx_parseEmptyExpression() : this.parseExpression();
this.expect(tt.braceR);
return this.finishNode(node, 'JSXExpressionContainer');
}
// Parses following JSX attribute name-value pair.
jsx_parseAttribute() {
let node = this.startNode();
if (this.eat(tt.braceL)) {
this.expect(tt.ellipsis);
node.argument = this.parseMaybeAssign();
this.expect(tt.braceR);
return this.finishNode(node, 'JSXSpreadAttribute');
}
node.name = this.jsx_parseNamespacedName();
node.value = this.eat(tt.eq) ? this.jsx_parseAttributeValue() : null;
return this.finishNode(node, 'JSXAttribute');
}
// Parses JSX opening tag starting after '<'.
jsx_parseOpeningElementAt(startPos, startLoc) {
let node = this.startNodeAt(startPos, startLoc);
node.attributes = [];
let nodeName = this.jsx_parseElementName();
if (nodeName) node.name = nodeName;
while (this.type !== tt.slash && this.type !== tok.jsxTagEnd) node.attributes.push(this.jsx_parseAttribute());
node.selfClosing = this.eat(tt.slash);
this.expect(tok.jsxTagEnd);
return this.finishNode(node, nodeName ? 'JSXOpeningElement' : 'JSXOpeningFragment');
}
// Parses JSX closing tag starting after '</'.
jsx_parseClosingElementAt(startPos, startLoc) {
let node = this.startNodeAt(startPos, startLoc);
let nodeName = this.jsx_parseElementName();
if (nodeName) node.name = nodeName;
this.expect(tok.jsxTagEnd);
return this.finishNode(node, nodeName ? 'JSXClosingElement' : 'JSXClosingFragment');
}
// Parses entire JSX element, including it's opening tag
// (starting after '<'), attributes, contents and closing tag.
jsx_parseElementAt(startPos, startLoc) {
let node = this.startNodeAt(startPos, startLoc);
let children = [];
let openingElement = this.jsx_parseOpeningElementAt(startPos, startLoc);
let closingElement = null;
if (!openingElement.selfClosing) {
contents: for (;;) {
switch (this.type) {
case tok.jsxTagStart:
startPos = this.start;
startLoc = this.startLoc;
this.next();
if (this.eat(tt.slash)) {
closingElement = this.jsx_parseClosingElementAt(startPos, startLoc);
break contents;
}
children.push(this.jsx_parseElementAt(startPos, startLoc));
break;
case tok.jsxText:
children.push(this.parseExprAtom());
break;
case tt.braceL:
children.push(this.jsx_parseExpressionContainer());
break;
default:
this.unexpected();
}
}
if (getQualifiedJSXName(closingElement.name) !== getQualifiedJSXName(openingElement.name)) {
this.raise(closingElement.start, 'Expected corresponding JSX closing tag for <' + getQualifiedJSXName(openingElement.name) + '>');
}
}
let fragmentOrElement = openingElement.name ? 'Element' : 'Fragment';
node['opening' + fragmentOrElement] = openingElement;
node['closing' + fragmentOrElement] = closingElement;
node.children = children;
if (this.type === tt.relational && this.value === "<") {
this.raise(this.start, "Adjacent JSX elements must be wrapped in an enclosing tag");
}
return this.finishNode(node, 'JSX' + fragmentOrElement);
}
// Parse JSX text
jsx_parseText() {
let node = this.parseLiteral(this.value);
node.type = "JSXText";
return node;
}
// Parses entire JSX element from current position.
jsx_parseElement() {
let startPos = this.start,
startLoc = this.startLoc;
this.next();
return this.jsx_parseElementAt(startPos, startLoc);
}
parseExprAtom(refShortHandDefaultPos) {
if (this.type === tok.jsxText) return this.jsx_parseText();else if (this.type === tok.jsxTagStart) return this.jsx_parseElement();else return super.parseExprAtom(refShortHandDefaultPos);
}
readToken(code) {
let context = this.curContext();
if (context === tc_expr) return this.jsx_readToken();
if (context === tc_oTag || context === tc_cTag) {
if (isIdentifierStart(code)) return this.jsx_readWord();
if (code == 62) {
++this.pos;
return this.finishToken(tok.jsxTagEnd);
}
if ((code === 34 || code === 39) && context == tc_oTag) return this.jsx_readString(code);
}
if (code === 60 && this.exprAllowed && this.input.charCodeAt(this.pos + 1) !== 33) {
++this.pos;
return this.finishToken(tok.jsxTagStart);
}
return super.readToken(code);
}
updateContext(prevType) {
if (this.type == tt.braceL) {
var curContext = this.curContext();
if (curContext == tc_oTag) this.context.push(tokContexts.b_expr);else if (curContext == tc_expr) this.context.push(tokContexts.b_tmpl);else super.updateContext(prevType);
this.exprAllowed = true;
} else if (this.type === tt.slash && prevType === tok.jsxTagStart) {
this.context.length -= 2; // do not consider JSX expr -> JSX open tag -> ... anymore
this.context.push(tc_cTag); // reconsider as closing tag context
this.exprAllowed = false;
} else {
return super.updateContext(prevType);
}
}
};
}
})(acornJsx);
return acornJsx.exports;
}
var acornJsxExports = requireAcornJsx();
var jsx = /*@__PURE__*/getDefaultExportFromCjs(acornJsxExports);
/**
* @fileoverview Translates tokens between Acorn format and Esprima format.
* @author Nicholas C. Zakas
*/
//------------------------------------------------------------------------------
// Requirements
//------------------------------------------------------------------------------
// none!
//------------------------------------------------------------------------------
// Private
//------------------------------------------------------------------------------
// Esprima Token Types
const Token = {
Boolean: "Boolean",
EOF: "<end>",
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 = _atInstanceProperty(tokens).call(tokens, -1);
const token = {
type: Token.Template,
value: _sliceInstanceProperty(code).call(code, 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) {
var _context;
token.type = Token.Punctuator;
token.value = _sliceInstanceProperty(_context = this._code).call(_context, 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) {
var _context2;
token.type = Token.Numeric;
token.value = _sliceInstanceProperty(_context2 = this._code).call(_context2, token.start, token.end);
} else if (type === tt.string) {
var _context3;
if (extra.jsxAttrValueToken) {
extra.jsxAttrValueToken = false;
token.type = Token.JSXText;
} else {
token.type = Token.String;
}
token.value = _sliceInstanceProperty(_context3 = this._code).call(_context3, token.start, token.end);
} else if (type === tt.regexp) {
token.type = Token.RegularExpression;
const value = token.value;
token.regex = {
flags: _flagsInstanceProperty(value),
pattern: value.pattern
};
token.value = `/${value.pattern}/${_flagsInstanceProperty(value)}`;
}
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 tt = this._acornTokTypes,
tokens = extra.tokens,
templateTokens = this._tokens;
/**
* Flushes the buffered template tokens and resets the template
* tracking.
* @returns {void}
* @private
*/
const translateTemplateTokens = () => {
tokens.push(convertTemplatePart(this._tokens, this._code));
this._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,
// 2015
7,
// 2016
8,
// 2017
9,
// 2018
10,
// 2019
11,
// 2020
12,
// 2021
13,
// 2022
14,
// 2023
15,
// 2024
16 // 2025
];
/**
* Get the latest ECMAScript version supported by Espree.
* @returns {number} The latest ECMAScript version.
*/
function getLatestEcmaVersion() {
return _atInstanceProperty(SUPPORTED_VERSIONS).call(SUPPORTED_VERSIONS, -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 (!_includesInstanceProperty(SUPPORTED_VERSIONS).call(SUPPORTED_VERSIONS, 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;
if (ecmaVersion !== 3 && options.allowReserved) {
// a value of `false` is intentionally allowed here, so a shared config can overwrite it when needed
throw new Error("`allowReserved` is only supported when ecmaVersion is 3");
}
if (typeof options.allowReserved !== "undefined" && typeof options.allowReserved !== "boolean") {
throw new Error("`allowReserved`, when present, must be `true` or `false`");
}
const allowReserved = ecmaVersion === 3 ? options.allowReserved || "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
});
}
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.
* @param {string} code The source code being parsed.
* @returns {Object} The comment object.
* @private
*/
function convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc, code) {
let type;
if (block) {
type = "Block";
} else if (_sliceInstanceProperty(code).call(code, start, start + 2) === "#!") {
type = "Hashbang";
} else {
type = "Line";
}
const comment = {
type,
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;
/*
* Data that is unique to Espree and is not represented internally
* in Acorn.
*
* For ES2023 hashbangs, Espree will call `onComment()` during the
* constructor, so we must define state before having access to
* `this`.
*/
const state = {
originalSourceType: originalSourceType || options.sourceType,
tokens: tokenTranslator ? [] : null,
comments: options.comment === true ? [] : null,
impliedStrict: ecmaFeatures.impliedStrict === true && options.ecmaVersion >= 5,
ecmaVersion: options.ecmaVersion,
jsxAttrValueToken: false,
lastToken: null,
templateElements: []
};
// 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, state);
}
if (token.type !== tokTypes.eof) {
state.lastToken = token;
}
},
// Collect comments
onComment(block, text, start, end, startLoc, endLoc) {
if (state.comments) {
const comment = convertAcornCommentToEsprimaComment(block, text, start, end, startLoc, endLoc, code);
state.comments.push(comment);
}
}
}, code);
/*
* 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] = state;
}
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() {
var _context;
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.
*/
_forEachInstanceProperty(_context = this[STATE].templateElements).call(_context, 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 !== undefined) {
this.pos = pos;
if (this.options.locations) {
while (this.pos < this.lineStart) {
var _context2;
this.lineStart = _lastIndexOfInstanceProperty(_context2 = this.input).call(_context2, "\n", this.lineStart - 2) + 1;
--this.curLine;
}
}
this.nextToken();
}
if (this.end > this.start) {
var _context3;
message += ` ${_sliceInstanceProperty(_context3 = this.input).call(_context3, 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 -- required by API
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) {
var _context4;
// 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 (_includesInstanceProperty(_context4 = result.type).call(_context4, "Function") && !result.generator) {
result.generator = false;
}
return result;
}
};
};
var _objectHasOwn = function (object, property) {
if (typeof object === 'undefined' || object === null) {
throw new TypeError('Cannot convert undefined or null to object');
}
return Object.prototype.hasOwnProperty.call(Object(object), property);
};
// To initialize lazily.
const parsers = {
_regular: null,
_jsx: null,
get regular() {
if (this._regular === null) {
this._regular = Parser$1.extend(espree());
}
return this._regular;
},
get jsx() {
if (this._jsx === null) {
this._jsx = Parser$1.extend(jsx(), espree());
}
return this._jsx;
},
get(options) {
const useJsx = Boolean(options && options.ecmaFeatures && options.ecmaFeatures.jsx);
return useJsx ? this.jsx : this.regular;
}
};
//------------------------------------------------------------------------------
// Tokenizer
//------------------------------------------------------------------------------
/**
* Tokenizes the given code.
* @param {string} code The code to tokenize.
* @param {Object} options Options defining how to tokenize.
* @returns {Token[]} An array of tokens.
* @throws {SyntaxError} If the input code is invalid.
* @private
*/
function tokenize(code, options) {
const Parser = parsers.get(options);
// Ensure to collect tokens.
if (!options || options.tokens !== true) {
options = _Object$assign({}, options, {
tokens: true
}); // eslint-disable-line no-param-reassign -- stylistic choice
}
return new Parser(options, code).tokenize();
}
/* istanbul ignore next */
const VisitorKeys = function () {
return KEYS;
}();
// Derive node types from VisitorKeys
/* istanbul ignore next */
(function () {
let key,
types = {};
if (typeof _Object$create === "function") {
types = _Object$create(null);
}
for (key in VisitorKeys) {
if (_objectHasOwn(VisitorKeys, key)) {
types[key] = key;
}
}
if (typeof _Object$freeze === "function") {
_Object$freeze(types);
}
return types;
})();
const latestEcmaVersion = getLatestEcmaVersion();
getSupportedEcmaVersions();
var dist$3 = {};
var astUtils = {};
var eslintUtils$2 = {};
var astUtilities = {};
var eslintUtils$1 = {};
var eslintVisitorKeys = {};
var hasRequiredEslintVisitorKeys;
function requireEslintVisitorKeys () {
if (hasRequiredEslintVisitorKeys) return eslintVisitorKeys;
hasRequiredEslintVisitorKeys = 1;
Object.defineProperty(eslintVisitorKeys, '__esModule', { value: true });
/**
* @typedef {{ readonly [type: string]: ReadonlyArray<string> }} VisitorKeys
*/
/**
* @type {VisitorKeys}
*/
const KEYS = {
ArrayExpression: [
"elements"
],
ArrayPattern: [
"elements"
],
ArrowFunctionExpression: [
"params",
"body"
],
AssignmentExpression: [
"left",
"right"
],
AssignmentPattern: [
"left",
"right"
],
AwaitExpression: [
"argument"
],
BinaryExpression: [
"left",
"right"
],
BlockStatement: [
"body"
],
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: [],
ExperimentalRestProperty: [
"argument"
],
ExperimentalSpreadProperty: [
"argument"
],
ExportAllDeclaration: [
"exported",
"source"
],
ExportDefaultDeclaration: [
"declaration"
],
ExportNamedDeclaration: [
"declaration",
"specifiers",
"source"
],
ExportSpecifier: [
"exported",
"local"
],
ExpressionStatement: [
"expression"
],
ForInStatement: [
"left",
"right",
"body"
],
ForOfStatement: [
"left",
"right",
"body"
],
ForStatement: [
"init",
"test",
"update",
"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"
],
JSXClosingFragment: [],
JSXElement: [
"openingElement",
"children",
"closingElement"
],
JSXEmptyExpression: [],
JSXExpressionContainer: [
"expression"
],
JSXFragment: [
"openingFragment",
"children",
"closingFragment"
],
JSXIdentifier: [],
JSXMemberExpression: [
"object",
"property"
],
JSXNamespacedName: [
"namespace",
"name"
],
JSXOpeningElement: [
"name",
"attributes"
],
JSXOpeningFragment: [],
JSXSpreadAttribute: [
"argument"
],
JSXSpreadChild: [
"expression"
],
JSXText: [],
LabeledStatement: [
"label",
"body"
],
Literal: [],
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: [],
SwitchCase: [
"test",
"consequent"
],
SwitchStatement: [
"discriminant",
"cases"
],
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 <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
/**
* @typedef {import('./visitor-keys.js').VisitorKeys} VisitorKeys
*/
// 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] !== "_";
}
/**
* Get visitor keys of a given node.
* @param {object} node The AST node to get keys.
* @returns {readonly 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 {VisitorKeys} additionalKeys The additional keys.
* @returns {VisitorKeys} The union set.
*/
function unionWith(additionalKeys) {
const retv = /** @type {{
[type: string]: ReadonlyArray<string>
}} */ (Object.assign({}, KEYS));
for (const type of Object.keys(additionalKeys)) {
if (Object.prototype.hasOwnProperty.call(retv, 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);
}
eslintVisitorKeys.KEYS = KEYS;
eslintVisitorKeys.getKeys = getKeys;
eslintVisitorKeys.unionWith = unionWith;
return eslintVisitorKeys;
}
var hasRequiredEslintUtils$2;
function requireEslintUtils$2() {
if (hasRequiredEslintUtils$2) return eslintUtils$1;
hasRequiredEslintUtils$2 = 1;
(function (exports, _context2, _context3, _context4, _context5, _context9) {
_Object$defineProperty(exports, '__esModule', {
value: true
});
var eslintVisitorKeys = requireEslintVisitorKeys();
/**
* Get the innermost scope which contains a given location.
* @param {Scope} initialScope The initial scope to search.
* @param {Node} node The location to search.
* @returns {Scope} The innermost scope.
*/
function getInnermostScope(initialScope, node) {
const location = node.range[0];
let scope = initialScope;
let found = false;
do {
found = false;
for (const childScope of scope.childScopes) {
const range = childScope.block.range;
if (range[0] <= location && location < range[1]) {
scope = childScope;
found = true;
break;
}
}
} while (found);
return scope;
}
/**
* Find the variable of a given name.
* @param {Scope} initialScope The scope to start finding.
* @param {string|Node} nameOrNode The variable name to find. If this is a Node object then it should be an Identifier node.
* @returns {Variable|null} The found variable or null.
*/
function findVariable(initialScope, nameOrNode) {
let name = "";
let scope = initialScope;
if (typeof nameOrNode === "string") {
name = nameOrNode;
} else {
name = nameOrNode.name;
scope = getInnermostScope(scope, nameOrNode);
}
while (scope != null) {
const variable = scope.set.get(name);
if (variable != null) {
return variable;
}
scope = scope.upper;
}
return null;
}
/**
* Creates the negate function of the given function.
* @param {function(Token):boolean} f - The function to negate.
* @returns {function(Token):boolean} Negated function.
*/
function negate(f) {
return token => !f(token);
}
/**
* 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.
* @returns {boolean} `true` if the token is an arrow token.
*/
function isArrowToken(token) {
return isPunctuatorTokenWithValue(token, "=>");
}
/**
* Checks if the given token is a comma token or not.
* @param {Token} token - The token to check.
* @returns {boolean} `true` if the token is a comma token.
*/
function isCommaToken(token) {
return isPunctuatorTokenWithValue(token, ",");
}
/**
* Checks if the given token is a semicolon token or not.
* @param {Token} token - The token to check.
* @returns {boolean} `true` if the token is a semicolon token.
*/
function isSemicolonToken(token) {
return isPunctuatorTokenWithValue(token, ";");
}
/**
* Checks if the given token is a colon token or not.
* @param {Token} token - The token to check.
* @returns {boolean} `true` if the token is a colon token.
*/
function isColonToken(token) {
return isPunctuatorTokenWithValue(token, ":");
}
/**
* Checks if the given token is an opening parenthesis token or not.
* @param {Token} token - The token to check.
* @returns {boolean} `true` if the token is an opening parenthesis token.
*/
function isOpeningParenToken(token) {
return isPunctuatorTokenWithValue(token, "(");
}
/**
* Checks if the given token is a closing parenthesis token or not.
* @param {Token} token - The token to check.
* @returns {boolean} `true` if the token is a closing parenthesis token.
*/
function isClosingParenToken(token) {
return isPunctuatorTokenWithValue(token, ")");
}
/**
* Checks if the given token is an opening square bracket token or not.
* @param {Token} token - The token to check.
* @returns {boolean} `true` if the token is an opening square bracket token.
*/
function isOpeningBracketToken(token) {
return isPunctuatorTokenWithValue(token, "[");
}
/**
* Checks if the given token is a closing square bracket token or not.
* @param {Token} token - The token to check.
* @returns {boolean} `true` if the token is a closing square bracket token.
*/
function isClosingBracketToken(token) {
return isPunctuatorTokenWithValue(token, "]");
}
/**
* Checks if the given token is an opening brace token or not.
* @param {Token} token - The token to check.
* @returns {boolean} `true` if the token is an opening brace token.
*/
function isOpeningBraceToken(token) {
return isPunctuatorTokenWithValue(token, "{");
}
/**
* Checks if the given token is a closing brace token or not.
* @param {Token} token - The token to check.
* @returns {boolean} `true` if the token is a closing brace token.
*/
function isClosingBraceToken(token) {
return isPunctuatorTokenWithValue(token, "}");
}
/**
* Checks if the given token is a comment token or not.
* @param {Token} token - The token to check.
* @returns {boolean} `true` if the token is a comment token.
*/
function isCommentToken(token) {
var _context;
return _includesInstanceProperty(_context = ["Block", "Line", "Shebang"]).call(_context, token.type);
}
const isNotArrowToken = negate(isArrowToken);
const isNotCommaToken = negate(isCommaToken);
const isNotSemicolonToken = negate(isSemicolonToken);
const isNotColonToken = negate(isColonToken);
const isNotOpeningParenToken = negate(isOpeningParenToken);
const isNotClosingParenToken = negate(isClosingParenToken);
const isNotOpeningBracketToken = negate(isOpeningBracketToken);
const isNotClosingBracketToken = negate(isClosingBracketToken);
const isNotOpeningBraceToken = negate(isOpeningBraceToken);
const isNotClosingBraceToken = negate(isClosingBraceToken);
const isNotCommentToken = negate(isCommentToken);
/**
* Get the `(` token of the given function node.
* @param {Node} node - The function node to get.
* @param {SourceCode} sourceCode - The source code object to get tokens.
* @returns {Token} `(` token.
*/
function getOpeningParenOfParams(node, sourceCode) {
return node.id ? sourceCode.getTokenAfter(node.id, isOpeningParenToken) : sourceCode.getFirstToken(node, isOpeningParenToken);
}
/**
* Get the location of the given function node for reporting.
* @param {Node} 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.
*/
function getFunctionHeadLocation(node, sourceCode) {
const parent = node.parent;
let start = null;
let end = null;
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" || parent.type === "PropertyDefinition") {
start = parent.loc.start;
end = getOpeningParenOfParams(node, sourceCode).loc.start;
} else {
start = node.loc.start;
end = getOpeningParenOfParams(node, sourceCode).loc.start;
}
return {
start: {
...start
},
end: {
...end
}
};
}
/* globals globalThis, global, self, window */
const globalObject = typeof _globalThis !== "undefined" ? _globalThis : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : typeof commonjsGlobal !== "undefined" ? commonjsGlobal : {};
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(_filterInstanceProperty(_context2 = [_Array$isArray, _Array$of, _atInstanceProperty(Array.prototype), _concatInstanceProperty(Array.prototype), _entriesInstanceProperty(Array.prototype), _everyInstanceProperty(Array.prototype), _filterInstanceProperty(Array.prototype), _findInstanceProperty(Array.prototype), _findIndexInstanceProperty(Array.prototype), _flatInstanceProperty(Array.prototype), _includesInstanceProperty(Array.prototype), _indexOfInstanceProperty(Array.prototype), Array.prototype.join, _keysInstanceProperty(Array.prototype), _lastIndexOfInstanceProperty(Array.prototype), _sliceInstanceProperty(Array.prototype), _someInstanceProperty(Array.prototype), Array.prototype.toString, _valuesInstanceProperty(Array.prototype), typeof BigInt === "function" ? BigInt : undefined, Boolean, Date, Date.parse, decodeURI, decodeURIComponent, encodeURI, encodeURIComponent, escape, isFinite, isNaN, isPrototypeOf, _Map, _entriesInstanceProperty(_Map.prototype), _Map.prototype.get, _Map.prototype.has, _keysInstanceProperty(_Map.prototype), _valuesInstanceProperty(_Map.prototype), ..._filterInstanceProperty(_context3 = _mapInstanceProperty(_context4 = _filterInstanceProperty(_context5 = _Object$getOwnPropertyNames(Math)).call(_context5, k => k !== "random")).call(_context4, k => Math[k])).call(_context3, f => typeof f === "function"), Number, _Number$isFinite, _Number$isNaN, _Number$parseFloat, _Number$parseInt, Number.prototype.toExponential, Number.prototype.toFixed, Number.prototype.toPrecision, Number.prototype.toString, Object, _Object$entries, _Object$is, _Object$isExtensible, _Object$isFrozen, _Object$isSealed, _Object$keys, _Object$values, _parseFloat, _parseInt, RegExp, _Set, _entriesInstanceProperty(_Set.prototype), _Set.prototype.has, _keysInstanceProperty(_Set.prototype), _valuesInstanceProperty(_Set.prototype), String, String.fromCharCode, _String$fromCodePoint, _String$raw, _atInstanceProperty(String.prototype), String.prototype.charAt, String.prototype.charCodeAt, _codePointAtInstanceProperty(String.prototype), String.prototype.concat, _endsWithInstanceProperty(String.prototype), _includesInstanceProperty(String.prototype), _indexOfInstanceProperty(String.prototype), _lastIndexOfInstanceProperty(String.prototype), String.prototype.normalize, _padEndInstanceProperty(String.prototype), _padStartInstanceProperty(String.prototype), _sliceInstanceProperty(String.prototype), _startsWithInstanceProperty(String.prototype), String.prototype.substr, String.prototype.substring, String.prototype.toLowerCase, String.prototype.toString, String.prototype.toUpperCase, _trimInstanceProperty(String.prototype), _trimEndInstanceProperty(String.prototype), _trimLeftInstanceProperty(String.prototype), _trimRightInstanceProperty(String.prototype), _trimStartInstanceProperty(String.prototype), _Symbol$for, _Symbol$keyFor, unescape]).call(_context2, f => typeof f === "function"));
const callPassThrough = new _Set([_Object$freeze, _Object$preventExtensions, _Object$seal]);
/** @type {ReadonlyArray<readonly [Function, ReadonlySet<string>]>} */
const getterAllowed = [[_Map, new _Set(["size"])], [RegExp, new _Set(["dotAll", "flags", "global", "hasIndices", "ignoreCase", "multiline", "source", "sticky", "unicode"])], [_Set, new _Set(["size"])]];
/**
* Get the property descriptor.
* @param {object} object The object to get.
* @param {string|number|symbol} name The property name to get.
*/
function getPropertyDescriptor(object, name) {
let x = object;
while ((typeof x === "object" || typeof x === "function") && x !== null) {
const d = _Object$getOwnPropertyDescriptor(x, name);
if (d) {
return d;
}
x = _Object$getPrototypeOf(x);
}
return null;
}
/**
* Check if a property is getter or not.
* @param {object} object The object to check.
* @param {string|number|symbol} name The property name to check.
*/
function isGetter(object, name) {
const d = getPropertyDescriptor(object, name);
return d != null && d.get != null;
}
/**
* Get the element values of a given node list.
* @param {Node[]} nodeList The node list to get values.
* @param {Scope|undefined} initialScope The initial scope to find variables.
* @returns {any[]|null} The value list if all nodes are constant. Otherwise, null.
*/
function getElementValues(nodeList, initialScope) {
const valueList = [];
for (let i = 0; i < nodeList.length; ++i) {
const elementNode = nodeList[i];
if (elementNode == null) {
valueList.length = i + 1;
} else if (elementNode.type === "SpreadElement") {
const argument = getStaticValueR(elementNode.argument, initialScope);
if (argument == null) {
return null;
}
valueList.push(...argument.value);
} else {
const element = getStaticValueR(elementNode, initialScope);
if (element == null) {
return null;
}
valueList.push(element.value);
}
}
return valueList;
}
/**
* Returns whether the given variable is never written to after initialization.
* @param {import("eslint").Scope.Variable} variable
* @returns {boolean}
*/
function isEffectivelyConst(variable) {
const refs = variable.references;
const inits = _filterInstanceProperty(refs).call(refs, r => r.init).length;
const reads = _filterInstanceProperty(refs).call(refs, r => r.isReadOnly()).length;
if (inits === 1 && reads + inits === refs.length) {
// there is only one init and all other references only read
return true;
}
return false;
}
const operations = _Object$freeze({
ArrayExpression(node, initialScope) {
const elements = getElementValues(node.elements, initialScope);
return elements != null ? {
value: elements
} : null;
},
AssignmentExpression(node, initialScope) {
if (node.operator === "=") {
return getStaticValueR(node.right, initialScope);
}
return null;
},
//eslint-disable-next-line complexity
BinaryExpression(node, initialScope) {
if (node.operator === "in" || node.operator === "instanceof") {
// Not supported.
return null;
}
const left = getStaticValueR(node.left, initialScope);
const right = getStaticValueR(node.right, initialScope);
if (left != null && right != null) {
switch (node.operator) {
case "==":
return {
value: left.value == right.value
};
//eslint-disable-line eqeqeq
case "!=":
return {
value: left.value != right.value
};
//eslint-disable-line eqeqeq
case "===":
return {
value: left.value === right.value
};
case "!==":
return {
value: left.value !== right.value
};
case "<":
return {
value: left.value < right.value
};
case "<=":
return {
value: left.value <= right.value
};
case ">":
return {
value: left.value > right.value
};
case ">=":
return {
value: left.value >= right.value
};
case "<<":
return {
value: left.value << right.value
};
case ">>":
return {
value: left.value >> right.value
};
case ">>>":
return {
value: left.value >>> right.value
};
case "+":
return {
value: left.value + right.value
};
case "-":
return {
value: left.value - right.value
};
case "*":
return {
value: left.value * right.value
};
case "/":
return {
value: left.value / right.value
};
case "%":
return {
value: left.value % right.value
};
case "**":
return {
value: left.value ** right.value
};
case "|":
return {
value: left.value | right.value
};
case "^":
return {
value: left.value ^ right.value
};
case "&":
return {
value: left.value & right.value
};
// no default
}
}
return null;
},
CallExpression(node, initialScope) {
const calleeNode = node.callee;
const args = getElementValues(node.arguments, initialScope);
if (args != null) {
if (calleeNode.type === "MemberExpression") {
if (calleeNode.property.type === "PrivateIdentifier") {
return null;
}
const object = getStaticValueR(calleeNode.object, initialScope);
if (object != null) {
if (object.value == null && (object.optional || node.optional)) {
return {
value: undefined,
optional: true
};
}
const property = getStaticPropertyNameValue(calleeNode, initialScope);
if (property != null) {
const receiver = object.value;
const methodName = property.value;
if (callAllowed.has(receiver[methodName])) {
return {
value: receiver[methodName](...args)
};
}
if (callPassThrough.has(receiver[methodName])) {
return {
value: args[0]
};
}
}
}
} else {
const callee = getStaticValueR(calleeNode, initialScope);
if (callee != null) {
if (callee.value == null && node.optional) {
return {
value: undefined,
optional: true
};
}
const func = callee.value;
if (callAllowed.has(func)) {
return {
value: func(...args)
};
}
if (callPassThrough.has(func)) {
return {
value: args[0]
};
}
}
}
}
return null;
},
ConditionalExpression(node, initialScope) {
const test = getStaticValueR(node.test, initialScope);
if (test != null) {
return test.value ? getStaticValueR(node.consequent, initialScope) : getStaticValueR(node.alternate, initialScope);
}
return null;
},
ExpressionStatement(node, initialScope) {
return getStaticValueR(node.expression, initialScope);
},
Identifier(node, initialScope) {
if (initialScope != null) {
const variable = findVariable(initialScope, node);
// Built-in globals.
if (variable != null && variable.defs.length === 0 && builtinNames.has(variable.name) && variable.name in globalObject) {
return {
value: globalObject[variable.name]
};
}
// Constants.
if (variable != null && variable.defs.length === 1) {
const def = variable.defs[0];
if (def.parent && def.type === "Variable" && (def.parent.kind === "const" || isEffectivelyConst(variable)) &&
// TODO(mysticatea): don't support destructuring here.
def.node.id.type === "Identifier") {
return getStaticValueR(def.node.init, initialScope);
}
}
}
return null;
},
Literal(node) {
//istanbul ignore if : this is implementation-specific behavior.
if ((node.regex != null || node.bigint != null) && node.value == null) {
// It was a RegExp/BigInt literal, but Node.js didn't support it.
return null;
}
return {
value: node.value
};
},
LogicalExpression(node, initialScope) {
const left = getStaticValueR(node.left, initialScope);
if (left != null) {
if (node.operator === "||" && Boolean(left.value) === true || node.operator === "&&" && Boolean(left.value) === false || node.operator === "??" && left.value != null) {
return left;
}
const right = getStaticValueR(node.right, initialScope);
if (right != null) {
return right;
}
}
return null;
},
MemberExpression(node, initialScope) {
if (node.property.type === "PrivateIdentifier") {
return null;
}
const object = getStaticValueR(node.object, initialScope);
if (object != null) {
if (object.value == null && (object.optional || node.optional)) {
return {
value: undefined,
optional: true
};
}
const property = getStaticPropertyNameValue(node, initialScope);
if (property != null) {
if (!isGetter(object.value, property.value)) {
return {
value: object.value[property.value]
};
}
for (const [classFn, allowed] of getterAllowed) {
if (object.value instanceof classFn && allowed.has(property.value)) {
return {
value: object.value[property.value]
};
}
}
}
}
return null;
},
ChainExpression(node, initialScope) {
const expression = getStaticValueR(node.expression, initialScope);
if (expression != null) {
return {
value: expression.value
};
}
return null;
},
NewExpression(node, initialScope) {
const callee = getStaticValueR(node.callee, initialScope);
const args = getElementValues(node.arguments, initialScope);
if (callee != null && args != null) {
const Func = callee.value;
if (callAllowed.has(Func)) {
return {
value: new Func(...args)
};
}
}
return null;
},
ObjectExpression(node, initialScope) {
const object = {};
for (const propertyNode of node.properties) {
if (propertyNode.type === "Property") {
if (propertyNode.kind !== "init") {
return null;
}
const key = getStaticPropertyNameValue(propertyNode, initialScope);
const value = getStaticValueR(propertyNode.value, initialScope);
if (key == null || value == null) {
return null;
}
object[key.value] = value.value;
} else if (propertyNode.type === "SpreadElement" || propertyNode.type === "ExperimentalSpreadProperty") {
const argument = getStaticValueR(propertyNode.argument, initialScope);
if (argument == null) {
return null;
}
_Object$assign(object, argument.value);
} else {
return null;
}
}
return {
value: object
};
},
SequenceExpression(node, initialScope) {
const last = node.expressions[node.expressions.length - 1];
return getStaticValueR(last, initialScope);
},
TaggedTemplateExpression(node, initialScope) {
const tag = getStaticValueR(node.tag, initialScope);
const expressions = getElementValues(node.quasi.expressions, initialScope);
if (tag != null && expressions != null) {
var _context6, _context7;
const func = tag.value;
const strings = _mapInstanceProperty(_context6 = node.quasi.quasis).call(_context6, q => q.value.cooked);
strings.raw = _mapInstanceProperty(_context7 = node.quasi.quasis).call(_context7, q => q.value.raw);
if (func === _String$raw) {
return {
value: func(strings, ...expressions)
};
}
}
return null;
},
TemplateLiteral(node, initialScope) {
const expressions = getElementValues(node.expressions, initialScope);
if (expressions != null) {
let value = node.quasis[0].value.cooked;
for (let i = 0; i < expressions.length; ++i) {
value += expressions[i];
value += node.quasis[i + 1].value.cooked;
}
return {
value
};
}
return null;
},
UnaryExpression(node, initialScope) {
if (node.operator === "delete") {
// Not supported.
return null;
}
if (node.operator === "void") {
return {
value: undefined
};
}
const arg = getStaticValueR(node.argument, initialScope);
if (arg != null) {
switch (node.operator) {
case "-":
return {
value: -arg.value
};
case "+":
return {
value: +arg.value
};
//eslint-disable-line no-implicit-coercion
case "!":
return {
value: !arg.value
};
case "~":
return {
value: ~arg.value
};
case "typeof":
return {
value: typeof arg.value
};
// no default
}
}
return null;
}
});
/**
* Get the value of a given node if it's a static value.
* @param {Node} node The node to get.
* @param {Scope|undefined} initialScope The scope to start finding variable.
* @returns {{value:any}|{value:undefined,optional?:true}|null} The static value of the node, or `null`.
*/
function getStaticValueR(node, initialScope) {
if (node != null && Object.hasOwnProperty.call(operations, node.type)) {
return operations[node.type](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.
* @param {Scope} [initialScope] The scope to start finding variable. Optional. If this scope was given, this tries to resolve identifier references which are in the given node as much as possible.
* @returns {{value:any}|{value:undefined,optional?:true}|null} The static value of the node, or `null`.
*/
function getStaticValue(node, initialScope = null) {
try {
return getStaticValueR(node, initialScope);
} catch (_error) {
return null;
}
}
/**
* Get the value of a given node if it's a literal or a template literal.
* @param {Node} node The node to get.
* @param {Scope} [initialScope] The scope to start finding variable. Optional. If the node is an Identifier node and this scope was given, this checks the variable of the identifier, and returns the value of it if the variable is a constant.
* @returns {string|null} The value of the node, or `null`.
*/
function getStringIfConstant(node, initialScope = 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}/${_flagsInstanceProperty(node.regex)}`;
}
if (node.bigint) {
return node.bigint;
}
}
const evaluated = getStaticValue(node, initialScope);
return evaluated && String(evaluated.value);
}
/**
* Get the 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 {string|null} The property name of the node.
*/
function getPropertyName(node, initialScope) {
switch (node.type) {
case "MemberExpression":
if (node.computed) {
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);
}
if (node.key.type === "Literal") {
return String(node.key.value);
}
if (node.key.type === "PrivateIdentifier") {
return null;
}
return node.key.name;
// no default
}
return null;
}
/**
* 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, 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 (isClassMethod || isClassFieldMethod) {
if (parent.static) {
tokens.push("static");
}
if (parent.key.type === "PrivateIdentifier") {
tokens.push("private");
}
}
if (node.async) {
tokens.push("async");
}
if (node.generator) {
tokens.push("generator");
}
// Kinds.
if (isObjectMethod || isClassMethod) {
if (parent.kind === "constructor") {
return "constructor";
}
if (parent.kind === "get") {
tokens.push("getter");
} else if (parent.kind === "set") {
tokens.push("setter");
} else {
tokens.push("method");
}
} else if (isClassFieldMethod) {
tokens.push("method");
} else {
if (node.type === "ArrowFunctionExpression") {
tokens.push("arrow");
}
tokens.push("function");
}
// Names.
if (isObjectMethod || isClassMethod || isClassFieldMethod) {
if (parent.key.type === "PrivateIdentifier") {
tokens.push(`#${parent.key.name}`);
} else {
const name = getPropertyName(parent);
if (name) {
tokens.push(`'${name}'`);
} else if (sourceCode) {
const keyText = sourceCode.getText(parent.key);
if (!_includesInstanceProperty(keyText).call(keyText, "\n")) {
tokens.push(`[${keyText}]`);
}
}
}
} else if (node.id) {
tokens.push(`'${node.id.name}'`);
} else if (parent.type === "VariableDeclarator" && parent.id && parent.id.type === "Identifier") {
tokens.push(`'${parent.id.name}'`);
} else if ((parent.type === "AssignmentExpression" || parent.type === "AssignmentPattern") && parent.left && parent.left.type === "Identifier") {
tokens.push(`'${parent.left.name}'`);
} else if (parent.type === "ExportDefaultDeclaration" && parent.declaration === node) {
tokens.push("'default'");
}
return tokens.join(" ");
}
const typeConversionBinaryOps = _Object$freeze(new _Set(["==", "!=", "<", "<=", ">", ">=", "<<", ">>", ">>>", "+", "-", "*", "/", "%", "|", "^", "&", "in"]));
const typeConversionUnaryOps = _Object$freeze(new _Set(["-", "+", "!", "~"]));
/**
* Check whether the given value is an ASTNode or not.
* @param {any} x The value to check.
* @returns {boolean} `true` if the value is an ASTNode.
*/
function isNode(x) {
return x !== null && typeof x === "object" && typeof x.type === "string";
}
const visitor = _Object$freeze(_Object$assign(_Object$create(null), {
$visit(node, options, visitorKeys) {
const {
type
} = node;
if (typeof this[type] === "function") {
return this[type](node, options, visitorKeys);
}
return this.$visitChildren(node, options, visitorKeys);
},
$visitChildren(node, options, visitorKeys) {
const {
type
} = node;
for (const key of visitorKeys[type] || eslintVisitorKeys.getKeys(node)) {
const value = node[key];
if (_Array$isArray(value)) {
for (const element of value) {
if (isNode(element) && this.$visit(element, options, visitorKeys)) {
return true;
}
}
} else if (isNode(value) && this.$visit(value, options, visitorKeys)) {
return true;
}
}
return false;
},
ArrowFunctionExpression() {
return false;
},
AssignmentExpression() {
return true;
},
AwaitExpression() {
return true;
},
BinaryExpression(node, options, visitorKeys) {
if (options.considerImplicitTypeConversion && typeConversionBinaryOps.has(node.operator) && (node.left.type !== "Literal" || node.right.type !== "Literal")) {
return true;
}
return this.$visitChildren(node, options, visitorKeys);
},
CallExpression() {
return true;
},
FunctionExpression() {
return false;
},
ImportExpression() {
return true;
},
MemberExpression(node, options, visitorKeys) {
if (options.considerGetters) {
return true;
}
if (options.considerImplicitTypeConversion && node.computed && node.property.type !== "Literal") {
return true;
}
return this.$visitChildren(node, options, visitorKeys);
},
MethodDefinition(node, options, visitorKeys) {
if (options.considerImplicitTypeConversion && node.computed && node.key.type !== "Literal") {
return true;
}
return this.$visitChildren(node, options, visitorKeys);
},
NewExpression() {
return true;
},
Property(node, options, visitorKeys) {
if (options.considerImplicitTypeConversion && node.computed && node.key.type !== "Literal") {
return true;
}
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;
}
if (options.considerImplicitTypeConversion && typeConversionUnaryOps.has(node.operator) && node.argument.type !== "Literal") {
return true;
}
return this.$visitChildren(node, options, visitorKeys);
},
UpdateExpression() {
return true;
},
YieldExpression() {
return true;
}
}));
/**
* Check whether a given node has any side effect or not.
* @param {Node} node The node to get.
* @param {SourceCode} sourceCode The source code object.
* @param {object} [options] The option object.
* @param {boolean} [options.considerGetters=false] If `true` then it considers member accesses as the node which has side effects.
* @param {boolean} [options.considerImplicitTypeConversion=false] If `true` then it considers implicit type conversion as the node which has side effects.
* @param {object} [options.visitorKeys=KEYS] The keys to traverse nodes. Use `context.getSourceCode().visitorKeys`.
* @returns {boolean} `true` if the node has a certain side effect.
*/
function hasSideEffect(node, sourceCode, {
considerGetters = false,
considerImplicitTypeConversion = false
} = {}) {
return visitor.$visit(node, {
considerGetters,
considerImplicitTypeConversion
}, sourceCode.visitorKeys || eslintVisitorKeys.KEYS);
}
/**
* Get the left parenthesis of the parent node syntax if it exists.
* E.g., `if (a) {}` then the `(`.
* @param {Node} node The AST node to check.
* @param {SourceCode} sourceCode The source code object to get tokens.
* @returns {Token|null} The left parenthesis of the parent node syntax
*/
function getParentSyntaxParen(node, sourceCode) {
const parent = node.parent;
switch (parent.type) {
case "CallExpression":
case "NewExpression":
if (parent.arguments.length === 1 && parent.arguments[0] === node) {
return sourceCode.getTokenAfter(parent.callee, isOpeningParenToken);
}
return null;
case "DoWhileStatement":
if (parent.test === node) {
return sourceCode.getTokenAfter(parent.body, isOpeningParenToken);
}
return null;
case "IfStatement":
case "WhileStatement":
if (parent.test === node) {
return sourceCode.getFirstToken(parent, 1);
}
return null;
case "ImportExpression":
if (parent.source === node) {
return sourceCode.getFirstToken(parent, 1);
}
return null;
case "SwitchStatement":
if (parent.discriminant === node) {
return sourceCode.getFirstToken(parent, 1);
}
return null;
case "WithStatement":
if (parent.object === node) {
return sourceCode.getFirstToken(parent, 1);
}
return null;
default:
return null;
}
}
/**
* Check whether a given node is parenthesized or not.
* @param {number} times The number of parantheses.
* @param {Node} node The AST node to check.
* @param {SourceCode} sourceCode The source code object to get tokens.
* @returns {boolean} `true` if the node is parenthesized the given times.
*/
/**
* Check whether a given node is parenthesized or not.
* @param {Node} node The AST node to check.
* @param {SourceCode} sourceCode The source code object to get tokens.
* @returns {boolean} `true` if the node is parenthesized.
*/
function isParenthesized(timesOrNode, nodeOrSourceCode, optionalSourceCode) {
let times, node, sourceCode, maybeLeftParen, maybeRightParen;
if (typeof timesOrNode === "number") {
times = timesOrNode | 0;
node = nodeOrSourceCode;
sourceCode = optionalSourceCode;
if (!(times >= 1)) {
throw new TypeError("'times' should be a positive integer.");
}
} else {
times = 1;
node = timesOrNode;
sourceCode = nodeOrSourceCode;
}
if (node == null ||
// `Program` can't be parenthesized
node.parent == null ||
// `CatchClause.param` can't be parenthesized, example `try {} catch (error) {}`
node.parent.type === "CatchClause" && node.parent.param === node) {
return false;
}
maybeLeftParen = maybeRightParen = node;
do {
maybeLeftParen = sourceCode.getTokenBefore(maybeLeftParen);
maybeRightParen = sourceCode.getTokenAfter(maybeRightParen);
} while (maybeLeftParen != null && maybeRightParen != null && isOpeningParenToken(maybeLeftParen) && isClosingParenToken(maybeRightParen) &&
// Avoid false positive such as `if (a) {}`
maybeLeftParen !== getParentSyntaxParen(node, sourceCode) && --times > 0);
return times === 0;
}
/**
* @author Toru Nagashima <https://github.com/mysticatea>
* See LICENSE file in root directory for full license.
*/
const placeholder = /\$(?:[$&`']|[1-9][0-9]?)/gu;
/** @type {WeakMap<PatternMatcher, {pattern:RegExp,escaped:boolean}>} */
const internal = new _WeakMap();
/**
* Check whether a given character is escaped or not.
* @param {string} str The string to check.
* @param {number} index The location of the character to check.
* @returns {boolean} `true` if the character is escaped.
*/
function isEscaped(str, index) {
let escaped = false;
for (let i = index - 1; i >= 0 && str.charCodeAt(i) === 0x5c; --i) {
escaped = !escaped;
}
return escaped;
}
/**
* Replace a given string by a given matcher.
* @param {PatternMatcher} matcher The pattern matcher.
* @param {string} str The string to be replaced.
* @param {string} replacement The new substring to replace each matched part.
* @returns {string} The replaced string.
*/
function replaceS(matcher, str, replacement) {
const chunks = [];
let index = 0;
/** @type {RegExpExecArray} */
let match = null;
/**
* @param {string} key The placeholder.
* @returns {string} The replaced string.
*/
function replacer(key) {
switch (key) {
case "$$":
return "$";
case "$&":
return match[0];
case "$`":
return _sliceInstanceProperty(str).call(str, 0, match.index);
case "$'":
return _sliceInstanceProperty(str).call(str, match.index + match[0].length);
default:
{
const i = _sliceInstanceProperty(key).call(key, 1);
if (i in match) {
return match[i];
}
return key;
}
}
}
for (match of matcher.execAll(str)) {
chunks.push(_sliceInstanceProperty(str).call(str, index, match.index));
chunks.push(replacement.replace(placeholder, replacer));
index = match.index + match[0].length;
}
chunks.push(_sliceInstanceProperty(str).call(str, index));
return chunks.join("");
}
/**
* Replace a given string by a given matcher.
* @param {PatternMatcher} matcher The pattern matcher.
* @param {string} str The string to be replaced.
* @param {(...strs[])=>string} replace The function to replace each matched part.
* @returns {string} The replaced string.
*/
function replaceF(matcher, str, replace) {
const chunks = [];
let index = 0;
for (const match of matcher.execAll(str)) {
chunks.push(_sliceInstanceProperty(str).call(str, index, match.index));
chunks.push(String(replace(...match, match.index, match.input)));
index = match.index + match[0].length;
}
chunks.push(_sliceInstanceProperty(str).call(str, index));
return chunks.join("");
}
/**
* The class to find patterns as considering escape sequences.
*/
class PatternMatcher {
/**
* Initialize this matcher.
* @param {RegExp} pattern The pattern to match.
* @param {{escaped:boolean}} options The options.
*/
constructor(pattern, {
escaped = false
} = {}) {
var _context8;
if (!(pattern instanceof RegExp)) {
throw new TypeError("'pattern' should be a RegExp instance.");
}
if (!_includesInstanceProperty(_context8 = _flagsInstanceProperty(pattern)).call(_context8, "g")) {
throw new Error("'pattern' should contains 'g' flag.");
}
internal.set(this, {
pattern: new RegExp(pattern.source, _flagsInstanceProperty(pattern)),
escaped: Boolean(escaped)
});
}
/**
* Find the pattern in a given string.
* @param {string} str The string to find.
* @returns {IterableIterator<RegExpExecArray>} The iterator which iterate the matched information.
*/
*execAll(str) {
const {
pattern,
escaped
} = internal.get(this);
let match = null;
let lastIndex = 0;
pattern.lastIndex = 0;
while ((match = pattern.exec(str)) != null) {
if (escaped || !isEscaped(str, match.index)) {
lastIndex = pattern.lastIndex;
yield match;
pattern.lastIndex = lastIndex;
}
}
}
/**
* Check whether the pattern is found in a given string.
* @param {string} str The string to check.
* @returns {boolean} `true` if the pattern was found in the string.
*/
test(str) {
const it = this.execAll(str);
const ret = it.next();
return !ret.done;
}
/**
* Replace a given string.
* @param {string} str The string to be replaced.
* @param {(string|((...strs:string[])=>string))} replacer The string or function to replace. This is the same as the 2nd argument of `String.prototype.replace`.
* @returns {string} The replaced string.
*/
[_Symbol$replace](str, replacer) {
return typeof replacer === "function" ? replaceF(this, String(str), replacer) : replaceS(this, String(str), String(replacer));
}
}
const IMPORT_TYPE = /^(?:Import|Export(?:All|Default|Named))Declaration$/u;
const has = _bindInstanceProperty(_context9 = Function.call).call(_context9, Object.hasOwnProperty);
const READ = _Symbol("read");
const CALL = _Symbol("call");
const CONSTRUCT = _Symbol("construct");
const ESM = _Symbol("esm");
const requireCall = {
require: {
[CALL]: true
}
};
/**
* Check whether a given variable is modified or not.
* @param {Variable} variable The variable to check.
* @returns {boolean} `true` if the variable is modified.
*/
function isModifiedGlobal(variable) {
var _context0;
return variable == null || variable.defs.length !== 0 || _someInstanceProperty(_context0 = variable.references).call(_context0, r => r.isWrite());
}
/**
* Check if the value of a given node is passed through to the parent syntax as-is.
* For example, `a` and `b` in (`a || b` and `c ? a : b`) are passed through.
* @param {Node} node A node to check.
* @returns {boolean} `true` if the node is passed through.
*/
function isPassThrough(node) {
const parent = node.parent;
switch (parent && parent.type) {
case "ConditionalExpression":
return parent.consequent === node || parent.alternate === node;
case "LogicalExpression":
return true;
case "SequenceExpression":
return parent.expressions[parent.expressions.length - 1] === node;
case "ChainExpression":
return true;
default:
return false;
}
}
/**
* The reference tracker.
*/
class ReferenceTracker {
/**
* Initialize this tracker.
* @param {Scope} globalScope The global scope.
* @param {object} [options] The options.
* @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"]
} = {}) {
this.variableStack = [];
this.globalScope = globalScope;
this.mode = mode;
this.globalObjectNames = _sliceInstanceProperty(globalObjectNames).call(globalObjectNames, 0);
}
/**
* Iterate the references of global variables.
* @param {object} traceMap The trace map.
* @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references.
*/
*iterateGlobalReferences(traceMap) {
for (const key of _Object$keys(traceMap)) {
const nextTraceMap = traceMap[key];
const path = [key];
const variable = this.globalScope.set.get(key);
if (isModifiedGlobal(variable)) {
continue;
}
yield* this._iterateVariableReferences(variable, path, nextTraceMap, true);
}
for (const key of this.globalObjectNames) {
const path = [];
const variable = this.globalScope.set.get(key);
if (isModifiedGlobal(variable)) {
continue;
}
yield* this._iterateVariableReferences(variable, path, traceMap, false);
}
}
/**
* Iterate the references of CommonJS modules.
* @param {object} traceMap The trace map.
* @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references.
*/
*iterateCjsReferences(traceMap) {
for (const {
node
} of this.iterateGlobalReferences(requireCall)) {
const key = getStringIfConstant(node.arguments[0]);
if (key == null || !has(traceMap, key)) {
continue;
}
const nextTraceMap = traceMap[key];
const path = [key];
if (nextTraceMap[READ]) {
yield {
node,
path,
type: READ,
info: nextTraceMap[READ]
};
}
yield* this._iteratePropertyReferences(node, path, nextTraceMap);
}
}
/**
* Iterate the references of ES modules.
* @param {object} traceMap The trace map.
* @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references.
*/
*iterateEsmReferences(traceMap) {
const programNode = this.globalScope.block;
for (const node of programNode.body) {
if (!IMPORT_TYPE.test(node.type) || node.source == null) {
continue;
}
const moduleId = node.source.value;
if (!has(traceMap, moduleId)) {
continue;
}
const nextTraceMap = traceMap[moduleId];
const path = [moduleId];
if (nextTraceMap[READ]) {
yield {
node,
path,
type: READ,
info: nextTraceMap[READ]
};
}
if (node.type === "ExportAllDeclaration") {
for (const key of _Object$keys(nextTraceMap)) {
const exportTraceMap = nextTraceMap[key];
if (exportTraceMap[READ]) {
yield {
node,
path: _concatInstanceProperty(path).call(path, key),
type: READ,
info: exportTraceMap[READ]
};
}
}
} else {
for (const specifier of node.specifiers) {
const esm = has(nextTraceMap, ESM);
const it = this._iterateImportReferences(specifier, path, esm ? nextTraceMap : this.mode === "legacy" ? {
default: nextTraceMap,
...nextTraceMap
} : {
default: nextTraceMap
});
if (esm) {
yield* it;
} else {
for (const report of it) {
var _context1;
report.path = _filterInstanceProperty(_context1 = report.path).call(_context1, exceptDefault);
if (report.path.length >= 2 || report.type !== READ) {
yield report;
}
}
}
}
}
}
}
/**
* Iterate the references for a given variable.
* @param {Variable} variable The variable to iterate that references.
* @param {string[]} path The current path.
* @param {object} traceMap The trace map.
* @param {boolean} shouldReport = The flag to report those references.
* @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references.
*/
*_iterateVariableReferences(variable, path, traceMap, shouldReport) {
var _context10;
if (_includesInstanceProperty(_context10 = this.variableStack).call(_context10, variable)) {
return;
}
this.variableStack.push(variable);
try {
for (const reference of variable.references) {
if (!reference.isRead()) {
continue;
}
const node = reference.identifier;
if (shouldReport && traceMap[READ]) {
yield {
node,
path,
type: READ,
info: traceMap[READ]
};
}
yield* this._iteratePropertyReferences(node, path, traceMap);
}
} finally {
this.variableStack.pop();
}
}
/**
* Iterate the references for a given AST node.
* @param rootNode The AST node to iterate references.
* @param {string[]} path The current path.
* @param {object} traceMap The trace map.
* @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references.
*/
//eslint-disable-next-line complexity
*_iteratePropertyReferences(rootNode, path, traceMap) {
let node = rootNode;
while (isPassThrough(node)) {
node = node.parent;
}
const parent = node.parent;
if (parent.type === "MemberExpression") {
if (parent.object === node) {
const key = getPropertyName(parent);
if (key == null || !has(traceMap, key)) {
return;
}
path = _concatInstanceProperty(path).call(path, key); //eslint-disable-line no-param-reassign
const nextTraceMap = traceMap[key];
if (nextTraceMap[READ]) {
yield {
node: parent,
path,
type: READ,
info: nextTraceMap[READ]
};
}
yield* this._iteratePropertyReferences(parent, path, nextTraceMap);
}
return;
}
if (parent.type === "CallExpression") {
if (parent.callee === node && traceMap[CALL]) {
yield {
node: parent,
path,
type: CALL,
info: traceMap[CALL]
};
}
return;
}
if (parent.type === "NewExpression") {
if (parent.callee === node && traceMap[CONSTRUCT]) {
yield {
node: parent,
path,
type: CONSTRUCT,
info: traceMap[CONSTRUCT]
};
}
return;
}
if (parent.type === "AssignmentExpression") {
if (parent.right === node) {
yield* this._iterateLhsReferences(parent.left, path, traceMap);
yield* this._iteratePropertyReferences(parent, path, traceMap);
}
return;
}
if (parent.type === "AssignmentPattern") {
if (parent.right === node) {
yield* this._iterateLhsReferences(parent.left, path, traceMap);
}
return;
}
if (parent.type === "VariableDeclarator") {
if (parent.init === node) {
yield* this._iterateLhsReferences(parent.id, path, traceMap);
}
}
}
/**
* Iterate the references for a given Pattern node.
* @param {Node} patternNode The Pattern node to iterate references.
* @param {string[]} path The current path.
* @param {object} traceMap The trace map.
* @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references.
*/
*_iterateLhsReferences(patternNode, path, traceMap) {
if (patternNode.type === "Identifier") {
const variable = findVariable(this.globalScope, patternNode);
if (variable != null) {
yield* this._iterateVariableReferences(variable, path, traceMap, false);
}
return;
}
if (patternNode.type === "ObjectPattern") {
for (const property of patternNode.properties) {
const key = getPropertyName(property);
if (key == null || !has(traceMap, key)) {
continue;
}
const nextPath = _concatInstanceProperty(path).call(path, key);
const nextTraceMap = traceMap[key];
if (nextTraceMap[READ]) {
yield {
node: property,
path: nextPath,
type: READ,
info: nextTraceMap[READ]
};
}
yield* this._iterateLhsReferences(property.value, nextPath, nextTraceMap);
}
return;
}
if (patternNode.type === "AssignmentPattern") {
yield* this._iterateLhsReferences(patternNode.left, path, traceMap);
}
}
/**
* Iterate the references for a given ModuleSpecifier node.
* @param {Node} specifierNode The ModuleSpecifier node to iterate references.
* @param {string[]} path The current path.
* @param {object} traceMap The trace map.
* @returns {IterableIterator<{node:Node,path:string[],type:symbol,info:any}>} The iterator to iterate references.
*/
*_iterateImportReferences(specifierNode, path, traceMap) {
const type = specifierNode.type;
if (type === "ImportSpecifier" || type === "ImportDefaultSpecifier") {
const key = type === "ImportDefaultSpecifier" ? "default" : specifierNode.imported.name;
if (!has(traceMap, key)) {
return;
}
path = _concatInstanceProperty(path).call(path, key); //eslint-disable-line no-param-reassign
const nextTraceMap = traceMap[key];
if (nextTraceMap[READ]) {
yield {
node: specifierNode,
path,
type: READ,
info: nextTraceMap[READ]
};
}
yield* this._iterateVariableReferences(findVariable(this.globalScope, specifierNode.local), path, nextTraceMap, false);
return;
}
if (type === "ImportNamespaceSpecifier") {
yield* this._iterateVariableReferences(findVariable(this.globalScope, specifierNode.local), path, traceMap, false);
return;
}
if (type === "ExportSpecifier") {
const key = specifierNode.local.name;
if (!has(traceMap, key)) {
return;
}
path = _concatInstanceProperty(path).call(path, key); //eslint-disable-line no-param-reassign
const nextTraceMap = traceMap[key];
if (nextTraceMap[READ]) {
yield {
node: specifierNode,
path,
type: READ,
info: nextTraceMap[READ]
};
}
}
}
}
ReferenceTracker.READ = READ;
ReferenceTracker.CALL = CALL;
ReferenceTracker.CONSTRUCT = CONSTRUCT;
ReferenceTracker.ESM = ESM;
/**
* This is a predicate function for Array#filter.
* @param {string} name A name part.
* @param {number} index The index of the name.
* @returns {boolean} `false` if it's default.
*/
function exceptDefault(name, index) {
return !(index === 1 && name === "default");
}
var index = {
CALL,
CONSTRUCT,
ESM,
findVariable,
getFunctionHeadLocation,
getFunctionNameWithKind,
getInnermostScope,
getPropertyName,
getStaticValue,
getStringIfConstant,
hasSideEffect,
isArrowToken,
isClosingBraceToken,
isClosingBracketToken,
isClosingParenToken,
isColonToken,
isCommaToken,
isCommentToken,
isNotArrowToken,
isNotClosingBraceToken,
isNotClosingBracketToken,
isNotClosingParenToken,
isNotColonToken,
isNotCommaToken,
isNotCommentToken,
isNotOpeningBraceToken,
isNotOpeningBracketToken,
isNotOpeningParenToken,
isNotSemicolonToken,
isOpeningBraceToken,
isOpeningBracketToken,
isOpeningParenToken,
isParenthesized,
isSemicolonToken,
PatternMatcher,
READ,
ReferenceTracker
};
exports.CALL = CALL;
exports.CONSTRUCT = CONSTRUCT;
exports.ESM = ESM;
exports.PatternMatcher = PatternMatcher;
exports.READ = READ;
exports.ReferenceTracker = ReferenceTracker;
exports["default"] = index;
exports.findVariable = findVariable;
exports.getFunctionHeadLocation = getFunctionHeadLocation;
exports.getFunctionNameWithKind = getFunctionNameWithKind;
exports.getInnermostScope = getInnermostScope;
exports.getPropertyName = getPropertyName;
exports.getStaticValue = getStaticValue;
exports.getStringIfConstant = getStringIfConstant;
exports.hasSideEffect = hasSideEffect;
exports.isArrowToken = isArrowToken;
exports.isClosingBraceToken = isClosingBraceToken;
exports.isClosingBracketToken = isClosingBracketToken;
exports.isClosingParenToken = isClosingParenToken;
exports.isColonToken = isColonToken;
exports.isCommaToken = isCommaToken;
exports.isCommentToken = isCommentToken;
exports.isNotArrowToken = isNotArrowToken;
exports.isNotClosingBraceToken = isNotClosingBraceToken;
exports.isNotClosingBracketToken = isNotClosingBracketToken;
exports.isNotClosingParenToken = isNotClosingParenToken;
exports.isNotColonToken = isNotColonToken;
exports.isNotCommaToken = isNotCommaToken;
exports.isNotCommentToken = isNotCommentToken;
exports.isNotOpeningBraceToken = isNotOpeningBraceToken;
exports.isNotOpeningBracketToken = isNotOpeningBracketToken;
exports.isNotOpeningParenToken = isNotOpeningParenToken;
exports.isNotSemicolonToken = isNotSemicolonToken;
exports.isOpeningBraceToken = isOpeningBraceToken;
exports.isOpeningBracketToken = isOpeningBracketToken;
exports.isOpeningParenToken = isOpeningParenToken;
exports.isParenthesized = isParenthesized;
exports.isSemicolonToken = isSemicolonToken;
})(eslintUtils$1);
return eslintUtils$1;
}
var hasRequiredAstUtilities;
function requireAstUtilities() {
if (hasRequiredAstUtilities) return astUtilities;
hasRequiredAstUtilities = 1;
var __createBinding = astUtilities.__createBinding || (_Object$create ? function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = _Object$getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = {
enumerable: true,
get: function () {
return m[k];
}
};
}
_Object$defineProperty(o, k2, desc);
} : function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
var __setModuleDefault = astUtilities.__setModuleDefault || (_Object$create ? function (o, v) {
_Object$defineProperty(o, "default", {
enumerable: true,
value: v
});
} : function (o, v) {
o["default"] = v;
});
var __importStar = astUtilities.__importStar || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
_Object$defineProperty(astUtilities, "__esModule", {
value: true
});
astUtilities.isParenthesized = astUtilities.hasSideEffect = astUtilities.getStringIfConstant = astUtilities.getStaticValue = astUtilities.getPropertyName = astUtilities.getFunctionNameWithKind = astUtilities.getFunctionHeadLocation = undefined;
const eslintUtils = __importStar(/*@__PURE__*/requireEslintUtils$2());
/**
* Get the proper location of a given function node to report.
*
* @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#getfunctionheadlocation}
*/
const getFunctionHeadLocation = eslintUtils.getFunctionHeadLocation;
astUtilities.getFunctionHeadLocation = getFunctionHeadLocation;
/**
* Get the name and kind of a given function node.
*
* @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#getfunctionnamewithkind}
*/
const getFunctionNameWithKind = eslintUtils.getFunctionNameWithKind;
astUtilities.getFunctionNameWithKind = getFunctionNameWithKind;
/**
* Get the property name of a given property node.
* If the node is a computed property, this tries to compute the property name by the getStringIfConstant function.
*
* @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#getpropertyname}
* @returns The property name of the node. If the property name is not constant then it returns `null`.
*/
const getPropertyName = eslintUtils.getPropertyName;
astUtilities.getPropertyName = getPropertyName;
/**
* Get the value of a given node if it can decide the value statically.
* If the 2nd parameter `initialScope` was given, this function tries to resolve identifier references which are in the
* given node as much as possible. In the resolving way, it does on the assumption that built-in global objects have
* not been modified.
* For example, it considers `Symbol.iterator`, `Symbol.for('k')`, ` String.raw``hello`` `, and `Object.freeze({a: 1}).a` as static, but `Symbol('k')` is not static.
*
* @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#getstaticvalue}
* @returns The `{ value: any }` shaped object. The `value` property is the static value. If it couldn't compute the
* static value of the node, it returns `null`.
*/
const getStaticValue = eslintUtils.getStaticValue;
astUtilities.getStaticValue = getStaticValue;
/**
* Get the string value of a given node.
* This function is a tiny wrapper of the getStaticValue function.
*
* @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#getstringifconstant}
*/
const getStringIfConstant = eslintUtils.getStringIfConstant;
astUtilities.getStringIfConstant = getStringIfConstant;
/**
* Check whether a given node has any side effect or not.
* The side effect means that it may modify a certain variable or object member. This function considers the node which
* contains the following types as the node which has side effects:
* - `AssignmentExpression`
* - `AwaitExpression`
* - `CallExpression`
* - `ImportExpression`
* - `NewExpression`
* - `UnaryExpression([operator = "delete"])`
* - `UpdateExpression`
* - `YieldExpression`
* - When `options.considerGetters` is `true`:
* - `MemberExpression`
* - When `options.considerImplicitTypeConversion` is `true`:
* - `BinaryExpression([operator = "==" | "!=" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "|" | "^" | "&" | "in"])`
* - `MemberExpression([computed = true])`
* - `MethodDefinition([computed = true])`
* - `Property([computed = true])`
* - `UnaryExpression([operator = "-" | "+" | "!" | "~"])`
*
* @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#hassideeffect}
*/
const hasSideEffect = eslintUtils.hasSideEffect;
astUtilities.hasSideEffect = hasSideEffect;
const isParenthesized = eslintUtils.isParenthesized;
astUtilities.isParenthesized = isParenthesized;
return astUtilities;
}
var PatternMatcher = {};
var hasRequiredPatternMatcher;
function requirePatternMatcher() {
if (hasRequiredPatternMatcher) return PatternMatcher;
hasRequiredPatternMatcher = 1;
var __createBinding = PatternMatcher.__createBinding || (_Object$create ? function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = _Object$getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = {
enumerable: true,
get: function () {
return m[k];
}
};
}
_Object$defineProperty(o, k2, desc);
} : function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
var __setModuleDefault = PatternMatcher.__setModuleDefault || (_Object$create ? function (o, v) {
_Object$defineProperty(o, "default", {
enumerable: true,
value: v
});
} : function (o, v) {
o["default"] = v;
});
var __importStar = PatternMatcher.__importStar || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
_Object$defineProperty(PatternMatcher, "__esModule", {
value: true
});
PatternMatcher.PatternMatcher = undefined;
const eslintUtils = __importStar(/*@__PURE__*/requireEslintUtils$2());
/**
* The class to find a pattern in strings as handling escape sequences.
* It ignores the found pattern if it's escaped with `\`.
*
* @see {@link https://eslint-community.github.io/eslint-utils/api/ast-utils.html#patternmatcher-class}
*/
const PatternMatcher$1 = eslintUtils.PatternMatcher;
PatternMatcher.PatternMatcher = PatternMatcher$1;
return PatternMatcher;
}
var predicates$1 = {};
var hasRequiredPredicates$1;
function requirePredicates$1() {
if (hasRequiredPredicates$1) return predicates$1;
hasRequiredPredicates$1 = 1;
var __createBinding = predicates$1.__createBinding || (_Object$create ? function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = _Object$getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = {
enumerable: true,
get: function () {
return m[k];
}
};
}
_Object$defineProperty(o, k2, desc);
} : function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
var __setModuleDefault = predicates$1.__setModuleDefault || (_Object$create ? function (o, v) {
_Object$defineProperty(o, "default", {
enumerable: true,
value: v
});
} : function (o, v) {
o["default"] = v;
});
var __importStar = predicates$1.__importStar || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
_Object$defineProperty(predicates$1, "__esModule", {
value: true
});
predicates$1.isSemicolonToken = predicates$1.isOpeningParenToken = predicates$1.isOpeningBracketToken = predicates$1.isOpeningBraceToken = predicates$1.isNotSemicolonToken = predicates$1.isNotOpeningParenToken = predicates$1.isNotOpeningBracketToken = predicates$1.isNotOpeningBraceToken = predicates$1.isNotCommentToken = predicates$1.isNotCommaToken = predicates$1.isNotColonToken = predicates$1.isNotClosingParenToken = predicates$1.isNotClosingBracketToken = predicates$1.isNotClosingBraceToken = predicates$1.isNotArrowToken = predicates$1.isCommentToken = predicates$1.isCommaToken = predicates$1.isColonToken = predicates$1.isClosingParenToken = predicates$1.isClosingBracketToken = predicates$1.isClosingBraceToken = predicates$1.isArrowToken = undefined;
const eslintUtils = __importStar(/*@__PURE__*/requireEslintUtils$2());
const isArrowToken = eslintUtils.isArrowToken;
predicates$1.isArrowToken = isArrowToken;
const isNotArrowToken = eslintUtils.isNotArrowToken;
predicates$1.isNotArrowToken = isNotArrowToken;
const isClosingBraceToken = eslintUtils.isClosingBraceToken;
predicates$1.isClosingBraceToken = isClosingBraceToken;
const isNotClosingBraceToken = eslintUtils.isNotClosingBraceToken;
predicates$1.isNotClosingBraceToken = isNotClosingBraceToken;
const isClosingBracketToken = eslintUtils.isClosingBracketToken;
predicates$1.isClosingBracketToken = isClosingBracketToken;
const isNotClosingBracketToken = eslintUtils.isNotClosingBracketToken;
predicates$1.isNotClosingBracketToken = isNotClosingBracketToken;
const isClosingParenToken = eslintUtils.isClosingParenToken;
predicates$1.isClosingParenToken = isClosingParenToken;
const isNotClosingParenToken = eslintUtils.isNotClosingParenToken;
predicates$1.isNotClosingParenToken = isNotClosingParenToken;
const isColonToken = eslintUtils.isColonToken;
predicates$1.isColonToken = isColonToken;
const isNotColonToken = eslintUtils.isNotColonToken;
predicates$1.isNotColonToken = isNotColonToken;
const isCommaToken = eslintUtils.isCommaToken;
predicates$1.isCommaToken = isCommaToken;
const isNotCommaToken = eslintUtils.isNotCommaToken;
predicates$1.isNotCommaToken = isNotCommaToken;
const isCommentToken = eslintUtils.isCommentToken;
predicates$1.isCommentToken = isCommentToken;
const isNotCommentToken = eslintUtils.isNotCommentToken;
predicates$1.isNotCommentToken = isNotCommentToken;
const isOpeningBraceToken = eslintUtils.isOpeningBraceToken;
predicates$1.isOpeningBraceToken = isOpeningBraceToken;
const isNotOpeningBraceToken = eslintUtils.isNotOpeningBraceToken;
predicates$1.isNotOpeningBraceToken = isNotOpeningBraceToken;
const isOpeningBracketToken = eslintUtils.isOpeningBracketToken;
predicates$1.isOpeningBracketToken = isOpeningBracketToken;
const isNotOpeningBracketToken = eslintUtils.isNotOpeningBracketToken;
predicates$1.isNotOpeningBracketToken = isNotOpeningBracketToken;
const isOpeningParenToken = eslintUtils.isOpeningParenToken;
predicates$1.isOpeningParenToken = isOpeningParenToken;
const isNotOpeningParenToken = eslintUtils.isNotOpeningParenToken;
predicates$1.isNotOpeningParenToken = isNotOpeningParenToken;
const isSemicolonToken = eslintUtils.isSemicolonToken;
predicates$1.isSemicolonToken = isSemicolonToken;
const isNotSemicolonToken = eslintUtils.isNotSemicolonToken;
predicates$1.isNotSemicolonToken = isNotSemicolonToken;
return predicates$1;
}
var ReferenceTracker = {};
var hasRequiredReferenceTracker;
function requireReferenceTracker() {
if (hasRequiredReferenceTracker) return ReferenceTracker;
hasRequiredReferenceTracker = 1;
var __createBinding = ReferenceTracker.__createBinding || (_Object$create ? function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = _Object$getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = {
enumerable: true,
get: function () {
return m[k];
}
};
}
_Object$defineProperty(o, k2, desc);
} : function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
var __setModuleDefault = ReferenceTracker.__setModuleDefault || (_Object$create ? function (o, v) {
_Object$defineProperty(o, "default", {
enumerable: true,
value: v
});
} : function (o, v) {
o["default"] = v;
});
var __importStar = ReferenceTracker.__importStar || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
_Object$defineProperty(ReferenceTracker, "__esModule", {
value: true
});
ReferenceTracker.ReferenceTracker = undefined;
/* eslint-disable @typescript-eslint/no-namespace */
const eslintUtils = __importStar(/*@__PURE__*/requireEslintUtils$2());
eslintUtils.ReferenceTracker.READ;
eslintUtils.ReferenceTracker.CALL;
eslintUtils.ReferenceTracker.CONSTRUCT;
eslintUtils.ReferenceTracker.ESM;
/**
* The tracker for references. This provides reference tracking for global variables, CommonJS modules, and ES modules.
*
* @see {@link https://eslint-community.github.io/eslint-utils/api/scope-utils.html#referencetracker-class}
*/
const ReferenceTracker$1 = eslintUtils.ReferenceTracker;
ReferenceTracker.ReferenceTracker = ReferenceTracker$1;
return ReferenceTracker;
}
var scopeAnalysis = {};
var hasRequiredScopeAnalysis;
function requireScopeAnalysis() {
if (hasRequiredScopeAnalysis) return scopeAnalysis;
hasRequiredScopeAnalysis = 1;
var __createBinding = scopeAnalysis.__createBinding || (_Object$create ? function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = _Object$getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = {
enumerable: true,
get: function () {
return m[k];
}
};
}
_Object$defineProperty(o, k2, desc);
} : function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
var __setModuleDefault = scopeAnalysis.__setModuleDefault || (_Object$create ? function (o, v) {
_Object$defineProperty(o, "default", {
enumerable: true,
value: v
});
} : function (o, v) {
o["default"] = v;
});
var __importStar = scopeAnalysis.__importStar || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
_Object$defineProperty(scopeAnalysis, "__esModule", {
value: true
});
scopeAnalysis.getInnermostScope = scopeAnalysis.findVariable = undefined;
const eslintUtils = __importStar(/*@__PURE__*/requireEslintUtils$2());
/**
* Get the variable of a given name.
*
* @see {@link https://eslint-community.github.io/eslint-utils/api/scope-utils.html#findvariable}
*/
const findVariable = eslintUtils.findVariable;
scopeAnalysis.findVariable = findVariable;
/**
* Get the innermost scope which contains a given node.
*
* @see {@link https://eslint-community.github.io/eslint-utils/api/scope-utils.html#getinnermostscope}
* @returns The innermost scope which contains the given node.
* If such scope doesn't exist then it returns the 1st argument `initialScope`.
*/
const getInnermostScope = eslintUtils.getInnermostScope;
scopeAnalysis.getInnermostScope = getInnermostScope;
return scopeAnalysis;
}
var hasRequiredEslintUtils$1;
function requireEslintUtils$1() {
if (hasRequiredEslintUtils$1) return eslintUtils$2;
hasRequiredEslintUtils$1 = 1;
(function (exports) {
var __createBinding = eslintUtils$2.__createBinding || (_Object$create ? function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = _Object$getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = {
enumerable: true,
get: function () {
return m[k];
}
};
}
_Object$defineProperty(o, k2, desc);
} : function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
var __exportStar = eslintUtils$2.__exportStar || function (m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
_Object$defineProperty(exports, "__esModule", {
value: true
});
__exportStar(requireAstUtilities(), exports);
__exportStar(requirePatternMatcher(), exports);
__exportStar(requirePredicates$1(), exports);
__exportStar(requireReferenceTracker(), exports);
__exportStar(requireScopeAnalysis(), exports);
})(eslintUtils$2);
return eslintUtils$2;
}
var helpers = {};
var hasRequiredHelpers;
function requireHelpers() {
if (hasRequiredHelpers) return helpers;
hasRequiredHelpers = 1;
(function (exports) {
_Object$defineProperty(exports, "__esModule", {
value: true
});
exports.isNotTokenOfTypeWithConditions = exports.isTokenOfTypeWithConditions = exports.isNodeOfTypeWithConditions = exports.isNodeOfTypes = exports.isNodeOfType = undefined;
const isNodeOfType = nodeType => node => (node == null ? undefined : node.type) === nodeType;
exports.isNodeOfType = isNodeOfType;
const isNodeOfTypes = nodeTypes => node => !!node && _includesInstanceProperty(nodeTypes).call(nodeTypes, node.type);
exports.isNodeOfTypes = isNodeOfTypes;
const isNodeOfTypeWithConditions = (nodeType, conditions) => {
const entries = _Object$entries(conditions);
return node => (node == null ? undefined : node.type) === nodeType && _everyInstanceProperty(entries).call(entries, ([key, value]) => node[key] === value);
};
exports.isNodeOfTypeWithConditions = isNodeOfTypeWithConditions;
const isTokenOfTypeWithConditions = (tokenType, conditions) => {
const entries = _Object$entries(conditions);
return token => (token == null ? undefined : token.type) === tokenType && _everyInstanceProperty(entries).call(entries, ([key, value]) => token[key] === value);
};
exports.isTokenOfTypeWithConditions = isTokenOfTypeWithConditions;
const isNotTokenOfTypeWithConditions = (tokenType, conditions) => token => !(0, exports.isTokenOfTypeWithConditions)(tokenType, conditions)(token);
exports.isNotTokenOfTypeWithConditions = isNotTokenOfTypeWithConditions;
})(helpers);
return helpers;
}
var misc = {};
var hasRequiredMisc;
function requireMisc() {
if (hasRequiredMisc) return misc;
hasRequiredMisc = 1;
_Object$defineProperty(misc, "__esModule", {
value: true
});
misc.LINEBREAK_MATCHER = undefined;
misc.isTokenOnSameLine = isTokenOnSameLine;
const LINEBREAK_MATCHER = /\r\n|[\r\n\u2028\u2029]/;
misc.LINEBREAK_MATCHER = LINEBREAK_MATCHER;
/**
* Determines whether two adjacent tokens are on the same line
*/
function isTokenOnSameLine(left, right) {
return left.loc.end.line === right.loc.start.line;
}
return misc;
}
var predicates = {};
var tsEstree$1 = {};
var dist$2 = {};
var astSpec = {};
var hasRequiredAstSpec;
function requireAstSpec() {
if (hasRequiredAstSpec) return astSpec;
hasRequiredAstSpec = 1;
/**********************************************
* DO NOT MODIFY THIS FILE MANUALLY *
* *
* THIS FILE HAS BEEN COPIED FROM ast-spec. *
* ANY CHANGES WILL BE LOST ON THE NEXT BUILD *
* *
* MAKE CHANGES TO ast-spec AND THEN RUN *
* yarn build *
**********************************************/
_Object$defineProperty(astSpec, "__esModule", {
value: true
});
astSpec.AST_TOKEN_TYPES = astSpec.AST_NODE_TYPES = undefined;
var AST_NODE_TYPES;
(function (AST_NODE_TYPES) {
AST_NODE_TYPES["AccessorProperty"] = "AccessorProperty";
AST_NODE_TYPES["ArrayExpression"] = "ArrayExpression";
AST_NODE_TYPES["ArrayPattern"] = "ArrayPattern";
AST_NODE_TYPES["ArrowFunctionExpression"] = "ArrowFunctionExpression";
AST_NODE_TYPES["AssignmentExpression"] = "AssignmentExpression";
AST_NODE_TYPES["AssignmentPattern"] = "AssignmentPattern";
AST_NODE_TYPES["AwaitExpression"] = "AwaitExpression";
AST_NODE_TYPES["BinaryExpression"] = "BinaryExpression";
AST_NODE_TYPES["BlockStatement"] = "BlockStatement";
AST_NODE_TYPES["BreakStatement"] = "BreakStatement";
AST_NODE_TYPES["CallExpression"] = "CallExpression";
AST_NODE_TYPES["CatchClause"] = "CatchClause";
AST_NODE_TYPES["ChainExpression"] = "ChainExpression";
AST_NODE_TYPES["ClassBody"] = "ClassBody";
AST_NODE_TYPES["ClassDeclaration"] = "ClassDeclaration";
AST_NODE_TYPES["ClassExpression"] = "ClassExpression";
AST_NODE_TYPES["ConditionalExpression"] = "ConditionalExpression";
AST_NODE_TYPES["ContinueStatement"] = "ContinueStatement";
AST_NODE_TYPES["DebuggerStatement"] = "DebuggerStatement";
AST_NODE_TYPES["Decorator"] = "Decorator";
AST_NODE_TYPES["DoWhileStatement"] = "DoWhileStatement";
AST_NODE_TYPES["EmptyStatement"] = "EmptyStatement";
AST_NODE_TYPES["ExportAllDeclaration"] = "ExportAllDeclaration";
AST_NODE_TYPES["ExportDefaultDeclaration"] = "ExportDefaultDeclaration";
AST_NODE_TYPES["ExportNamedDeclaration"] = "ExportNamedDeclaration";
AST_NODE_TYPES["ExportSpecifier"] = "ExportSpecifier";
AST_NODE_TYPES["ExpressionStatement"] = "ExpressionStatement";
AST_NODE_TYPES["ForInStatement"] = "ForInStatement";
AST_NODE_TYPES["ForOfStatement"] = "ForOfStatement";
AST_NODE_TYPES["ForStatement"] = "ForStatement";
AST_NODE_TYPES["FunctionDeclaration"] = "FunctionDeclaration";
AST_NODE_TYPES["FunctionExpression"] = "FunctionExpression";
AST_NODE_TYPES["Identifier"] = "Identifier";
AST_NODE_TYPES["IfStatement"] = "IfStatement";
AST_NODE_TYPES["ImportAttribute"] = "ImportAttribute";
AST_NODE_TYPES["ImportDeclaration"] = "ImportDeclaration";
AST_NODE_TYPES["ImportDefaultSpecifier"] = "ImportDefaultSpecifier";
AST_NODE_TYPES["ImportExpression"] = "ImportExpression";
AST_NODE_TYPES["ImportNamespaceSpecifier"] = "ImportNamespaceSpecifier";
AST_NODE_TYPES["ImportSpecifier"] = "ImportSpecifier";
AST_NODE_TYPES["JSXAttribute"] = "JSXAttribute";
AST_NODE_TYPES["JSXClosingElement"] = "JSXClosingElement";
AST_NODE_TYPES["JSXClosingFragment"] = "JSXClosingFragment";
AST_NODE_TYPES["JSXElement"] = "JSXElement";
AST_NODE_TYPES["JSXEmptyExpression"] = "JSXEmptyExpression";
AST_NODE_TYPES["JSXExpressionContainer"] = "JSXExpressionContainer";
AST_NODE_TYPES["JSXFragment"] = "JSXFragment";
AST_NODE_TYPES["JSXIdentifier"] = "JSXIdentifier";
AST_NODE_TYPES["JSXMemberExpression"] = "JSXMemberExpression";
AST_NODE_TYPES["JSXNamespacedName"] = "JSXNamespacedName";
AST_NODE_TYPES["JSXOpeningElement"] = "JSXOpeningElement";
AST_NODE_TYPES["JSXOpeningFragment"] = "JSXOpeningFragment";
AST_NODE_TYPES["JSXSpreadAttribute"] = "JSXSpreadAttribute";
AST_NODE_TYPES["JSXSpreadChild"] = "JSXSpreadChild";
AST_NODE_TYPES["JSXText"] = "JSXText";
AST_NODE_TYPES["LabeledStatement"] = "LabeledStatement";
AST_NODE_TYPES["Literal"] = "Literal";
AST_NODE_TYPES["LogicalExpression"] = "LogicalExpression";
AST_NODE_TYPES["MemberExpression"] = "MemberExpression";
AST_NODE_TYPES["MetaProperty"] = "MetaProperty";
AST_NODE_TYPES["MethodDefinition"] = "MethodDefinition";
AST_NODE_TYPES["NewExpression"] = "NewExpression";
AST_NODE_TYPES["ObjectExpression"] = "ObjectExpression";
AST_NODE_TYPES["ObjectPattern"] = "ObjectPattern";
AST_NODE_TYPES["PrivateIdentifier"] = "PrivateIdentifier";
AST_NODE_TYPES["Program"] = "Program";
AST_NODE_TYPES["Property"] = "Property";
AST_NODE_TYPES["PropertyDefinition"] = "PropertyDefinition";
AST_NODE_TYPES["RestElement"] = "RestElement";
AST_NODE_TYPES["ReturnStatement"] = "ReturnStatement";
AST_NODE_TYPES["SequenceExpression"] = "SequenceExpression";
AST_NODE_TYPES["SpreadElement"] = "SpreadElement";
AST_NODE_TYPES["StaticBlock"] = "StaticBlock";
AST_NODE_TYPES["Super"] = "Super";
AST_NODE_TYPES["SwitchCase"] = "SwitchCase";
AST_NODE_TYPES["SwitchStatement"] = "SwitchStatement";
AST_NODE_TYPES["TaggedTemplateExpression"] = "TaggedTemplateExpression";
AST_NODE_TYPES["TemplateElement"] = "TemplateElement";
AST_NODE_TYPES["TemplateLiteral"] = "TemplateLiteral";
AST_NODE_TYPES["ThisExpression"] = "ThisExpression";
AST_NODE_TYPES["ThrowStatement"] = "ThrowStatement";
AST_NODE_TYPES["TryStatement"] = "TryStatement";
AST_NODE_TYPES["UnaryExpression"] = "UnaryExpression";
AST_NODE_TYPES["UpdateExpression"] = "UpdateExpression";
AST_NODE_TYPES["VariableDeclaration"] = "VariableDeclaration";
AST_NODE_TYPES["VariableDeclarator"] = "VariableDeclarator";
AST_NODE_TYPES["WhileStatement"] = "WhileStatement";
AST_NODE_TYPES["WithStatement"] = "WithStatement";
AST_NODE_TYPES["YieldExpression"] = "YieldExpression";
AST_NODE_TYPES["TSAbstractAccessorProperty"] = "TSAbstractAccessorProperty";
AST_NODE_TYPES["TSAbstractKeyword"] = "TSAbstractKeyword";
AST_NODE_TYPES["TSAbstractMethodDefinition"] = "TSAbstractMethodDefinition";
AST_NODE_TYPES["TSAbstractPropertyDefinition"] = "TSAbstractPropertyDefinition";
AST_NODE_TYPES["TSAnyKeyword"] = "TSAnyKeyword";
AST_NODE_TYPES["TSArrayType"] = "TSArrayType";
AST_NODE_TYPES["TSAsExpression"] = "TSAsExpression";
AST_NODE_TYPES["TSAsyncKeyword"] = "TSAsyncKeyword";
AST_NODE_TYPES["TSBigIntKeyword"] = "TSBigIntKeyword";
AST_NODE_TYPES["TSBooleanKeyword"] = "TSBooleanKeyword";
AST_NODE_TYPES["TSCallSignatureDeclaration"] = "TSCallSignatureDeclaration";
AST_NODE_TYPES["TSClassImplements"] = "TSClassImplements";
AST_NODE_TYPES["TSConditionalType"] = "TSConditionalType";
AST_NODE_TYPES["TSConstructorType"] = "TSConstructorType";
AST_NODE_TYPES["TSConstructSignatureDeclaration"] = "TSConstructSignatureDeclaration";
AST_NODE_TYPES["TSDeclareFunction"] = "TSDeclareFunction";
AST_NODE_TYPES["TSDeclareKeyword"] = "TSDeclareKeyword";
AST_NODE_TYPES["TSEmptyBodyFunctionExpression"] = "TSEmptyBodyFunctionExpression";
AST_NODE_TYPES["TSEnumBody"] = "TSEnumBody";
AST_NODE_TYPES["TSEnumDeclaration"] = "TSEnumDeclaration";
AST_NODE_TYPES["TSEnumMember"] = "TSEnumMember";
AST_NODE_TYPES["TSExportAssignment"] = "TSExportAssignment";
AST_NODE_TYPES["TSExportKeyword"] = "TSExportKeyword";
AST_NODE_TYPES["TSExternalModuleReference"] = "TSExternalModuleReference";
AST_NODE_TYPES["TSFunctionType"] = "TSFunctionType";
AST_NODE_TYPES["TSImportEqualsDeclaration"] = "TSImportEqualsDeclaration";
AST_NODE_TYPES["TSImportType"] = "TSImportType";
AST_NODE_TYPES["TSIndexedAccessType"] = "TSIndexedAccessType";
AST_NODE_TYPES["TSIndexSignature"] = "TSIndexSignature";
AST_NODE_TYPES["TSInferType"] = "TSInferType";
AST_NODE_TYPES["TSInstantiationExpression"] = "TSInstantiationExpression";
AST_NODE_TYPES["TSInterfaceBody"] = "TSInterfaceBody";
AST_NODE_TYPES["TSInterfaceDeclaration"] = "TSInterfaceDeclaration";
AST_NODE_TYPES["TSInterfaceHeritage"] = "TSInterfaceHeritage";
AST_NODE_TYPES["TSIntersectionType"] = "TSIntersectionType";
AST_NODE_TYPES["TSIntrinsicKeyword"] = "TSIntrinsicKeyword";
AST_NODE_TYPES["TSLiteralType"] = "TSLiteralType";
AST_NODE_TYPES["TSMappedType"] = "TSMappedType";
AST_NODE_TYPES["TSMethodSignature"] = "TSMethodSignature";
AST_NODE_TYPES["TSModuleBlock"] = "TSModuleBlock";
AST_NODE_TYPES["TSModuleDeclaration"] = "TSModuleDeclaration";
AST_NODE_TYPES["TSNamedTupleMember"] = "TSNamedTupleMember";
AST_NODE_TYPES["TSNamespaceExportDeclaration"] = "TSNamespaceExportDeclaration";
AST_NODE_TYPES["TSNeverKeyword"] = "TSNeverKeyword";
AST_NODE_TYPES["TSNonNullExpression"] = "TSNonNullExpression";
AST_NODE_TYPES["TSNullKeyword"] = "TSNullKeyword";
AST_NODE_TYPES["TSNumberKeyword"] = "TSNumberKeyword";
AST_NODE_TYPES["TSObjectKeyword"] = "TSObjectKeyword";
AST_NODE_TYPES["TSOptionalType"] = "TSOptionalType";
AST_NODE_TYPES["TSParameterProperty"] = "TSParameterProperty";
AST_NODE_TYPES["TSPrivateKeyword"] = "TSPrivateKeyword";
AST_NODE_TYPES["TSPropertySignature"] = "TSPropertySignature";
AST_NODE_TYPES["TSProtectedKeyword"] = "TSProtectedKeyword";
AST_NODE_TYPES["TSPublicKeyword"] = "TSPublicKeyword";
AST_NODE_TYPES["TSQualifiedName"] = "TSQualifiedName";
AST_NODE_TYPES["TSReadonlyKeyword"] = "TSReadonlyKeyword";
AST_NODE_TYPES["TSRestType"] = "TSRestType";
AST_NODE_TYPES["TSSatisfiesExpression"] = "TSSatisfiesExpression";
AST_NODE_TYPES["TSStaticKeyword"] = "TSStaticKeyword";
AST_NODE_TYPES["TSStringKeyword"] = "TSStringKeyword";
AST_NODE_TYPES["TSSymbolKeyword"] = "TSSymbolKeyword";
AST_NODE_TYPES["TSTemplateLiteralType"] = "TSTemplateLiteralType";
AST_NODE_TYPES["TSThisType"] = "TSThisType";
AST_NODE_TYPES["TSTupleType"] = "TSTupleType";
AST_NODE_TYPES["TSTypeAliasDeclaration"] = "TSTypeAliasDeclaration";
AST_NODE_TYPES["TSTypeAnnotation"] = "TSTypeAnnotation";
AST_NODE_TYPES["TSTypeAssertion"] = "TSTypeAssertion";
AST_NODE_TYPES["TSTypeLiteral"] = "TSTypeLiteral";
AST_NODE_TYPES["TSTypeOperator"] = "TSTypeOperator";
AST_NODE_TYPES["TSTypeParameter"] = "TSTypeParameter";
AST_NODE_TYPES["TSTypeParameterDeclaration"] = "TSTypeParameterDeclaration";
AST_NODE_TYPES["TSTypeParameterInstantiation"] = "TSTypeParameterInstantiation";
AST_NODE_TYPES["TSTypePredicate"] = "TSTypePredicate";
AST_NODE_TYPES["TSTypeQuery"] = "TSTypeQuery";
AST_NODE_TYPES["TSTypeReference"] = "TSTypeReference";
AST_NODE_TYPES["TSUndefinedKeyword"] = "TSUndefinedKeyword";
AST_NODE_TYPES["TSUnionType"] = "TSUnionType";
AST_NODE_TYPES["TSUnknownKeyword"] = "TSUnknownKeyword";
AST_NODE_TYPES["TSVoidKeyword"] = "TSVoidKeyword";
})(AST_NODE_TYPES || (astSpec.AST_NODE_TYPES = AST_NODE_TYPES = {}));
var AST_TOKEN_TYPES;
(function (AST_TOKEN_TYPES) {
AST_TOKEN_TYPES["Boolean"] = "Boolean";
AST_TOKEN_TYPES["Identifier"] = "Identifier";
AST_TOKEN_TYPES["JSXIdentifier"] = "JSXIdentifier";
AST_TOKEN_TYPES["JSXText"] = "JSXText";
AST_TOKEN_TYPES["Keyword"] = "Keyword";
AST_TOKEN_TYPES["Null"] = "Null";
AST_TOKEN_TYPES["Numeric"] = "Numeric";
AST_TOKEN_TYPES["Punctuator"] = "Punctuator";
AST_TOKEN_TYPES["RegularExpression"] = "RegularExpression";
AST_TOKEN_TYPES["String"] = "String";
AST_TOKEN_TYPES["Template"] = "Template";
AST_TOKEN_TYPES["Block"] = "Block";
AST_TOKEN_TYPES["Line"] = "Line";
})(AST_TOKEN_TYPES || (astSpec.AST_TOKEN_TYPES = AST_TOKEN_TYPES = {}));
return astSpec;
}
var lib$2 = {};
var hasRequiredLib$2;
function requireLib$2() {
if (hasRequiredLib$2) return lib$2;
hasRequiredLib$2 = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(lib$2, "__esModule", {
value: true
});
return lib$2;
}
var parserOptions = {};
var hasRequiredParserOptions$1;
function requireParserOptions$1() {
if (hasRequiredParserOptions$1) return parserOptions;
hasRequiredParserOptions$1 = 1;
_Object$defineProperty(parserOptions, "__esModule", {
value: true
});
return parserOptions;
}
var tsEstree = {};
var hasRequiredTsEstree$1;
function requireTsEstree$1() {
if (hasRequiredTsEstree$1) return tsEstree;
hasRequiredTsEstree$1 = 1;
var __createBinding = tsEstree.__createBinding || (_Object$create ? function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = _Object$getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = {
enumerable: true,
get: function () {
return m[k];
}
};
}
_Object$defineProperty(o, k2, desc);
} : function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
var __setModuleDefault = tsEstree.__setModuleDefault || (_Object$create ? function (o, v) {
_Object$defineProperty(o, "default", {
enumerable: true,
value: v
});
} : function (o, v) {
o["default"] = v;
});
var __importStar = tsEstree.__importStar || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
_Object$defineProperty(tsEstree, "__esModule", {
value: true
});
tsEstree.TSESTree = undefined;
tsEstree.TSESTree = __importStar(requireAstSpec());
return tsEstree;
}
var hasRequiredDist$3;
function requireDist$3() {
if (hasRequiredDist$3) return dist$2;
hasRequiredDist$3 = 1;
(function (exports) {
var __createBinding = dist$2.__createBinding || (_Object$create ? function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = _Object$getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = {
enumerable: true,
get: function () {
return m[k];
}
};
}
_Object$defineProperty(o, k2, desc);
} : function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
var __exportStar = dist$2.__exportStar || function (m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
_Object$defineProperty(exports, "__esModule", {
value: true
});
exports.AST_TOKEN_TYPES = exports.AST_NODE_TYPES = undefined;
var ast_spec_1 = requireAstSpec();
_Object$defineProperty(exports, "AST_NODE_TYPES", {
enumerable: true,
get: function () {
return ast_spec_1.AST_NODE_TYPES;
}
});
_Object$defineProperty(exports, "AST_TOKEN_TYPES", {
enumerable: true,
get: function () {
return ast_spec_1.AST_TOKEN_TYPES;
}
});
__exportStar(requireLib$2(), exports);
__exportStar(requireParserOptions$1(), exports);
__exportStar(requireTsEstree$1(), exports);
})(dist$2);
return dist$2;
}
var hasRequiredTsEstree;
function requireTsEstree() {
if (hasRequiredTsEstree) return tsEstree$1;
hasRequiredTsEstree = 1;
(function (exports) {
// for convenience's sake - export the types directly from here so consumers
// don't need to reference/install both packages in their code
_Object$defineProperty(exports, "__esModule", {
value: true
});
exports.TSESTree = exports.AST_TOKEN_TYPES = exports.AST_NODE_TYPES = undefined;
var types_1 = requireDist$3();
_Object$defineProperty(exports, "AST_NODE_TYPES", {
enumerable: true,
get: function () {
return types_1.AST_NODE_TYPES;
}
});
_Object$defineProperty(exports, "AST_TOKEN_TYPES", {
enumerable: true,
get: function () {
return types_1.AST_TOKEN_TYPES;
}
});
_Object$defineProperty(exports, "TSESTree", {
enumerable: true,
get: function () {
return types_1.TSESTree;
}
});
})(tsEstree$1);
return tsEstree$1;
}
var hasRequiredPredicates;
function requirePredicates() {
if (hasRequiredPredicates) return predicates;
hasRequiredPredicates = 1;
_Object$defineProperty(predicates, "__esModule", {
value: true
});
predicates.isVariableDeclarator = predicates.isTypeKeyword = predicates.isTypeAssertion = predicates.isTSFunctionType = predicates.isTSConstructorType = predicates.isOptionalChainPunctuator = predicates.isOptionalCallExpression = predicates.isNotOptionalChainPunctuator = predicates.isNotNonNullAssertionPunctuator = predicates.isNonNullAssertionPunctuator = predicates.isLoop = predicates.isLogicalOrOperator = predicates.isImportKeyword = predicates.isIdentifier = predicates.isFunctionType = predicates.isFunctionOrFunctionType = predicates.isFunction = predicates.isConstructor = predicates.isClassOrTypeElement = predicates.isAwaitKeyword = predicates.isAwaitExpression = undefined;
predicates.isSetter = isSetter;
const ts_estree_1 = requireTsEstree();
const helpers_1 = requireHelpers();
const isOptionalChainPunctuator = (0, helpers_1.isTokenOfTypeWithConditions)(ts_estree_1.AST_TOKEN_TYPES.Punctuator, {
value: '?.'
});
predicates.isOptionalChainPunctuator = isOptionalChainPunctuator;
const isNotOptionalChainPunctuator = (0, helpers_1.isNotTokenOfTypeWithConditions)(ts_estree_1.AST_TOKEN_TYPES.Punctuator, {
value: '?.'
});
predicates.isNotOptionalChainPunctuator = isNotOptionalChainPunctuator;
const isNonNullAssertionPunctuator = (0, helpers_1.isTokenOfTypeWithConditions)(ts_estree_1.AST_TOKEN_TYPES.Punctuator, {
value: '!'
});
predicates.isNonNullAssertionPunctuator = isNonNullAssertionPunctuator;
const isNotNonNullAssertionPunctuator = (0, helpers_1.isNotTokenOfTypeWithConditions)(ts_estree_1.AST_TOKEN_TYPES.Punctuator, {
value: '!'
});
predicates.isNotNonNullAssertionPunctuator = isNotNonNullAssertionPunctuator;
/**
* Returns true if and only if the node represents: foo?.() or foo.bar?.()
*/
const isOptionalCallExpression = (0, helpers_1.isNodeOfTypeWithConditions)(ts_estree_1.AST_NODE_TYPES.CallExpression,
// this flag means the call expression itself is option
// i.e. it is foo.bar?.() and not foo?.bar()
{
optional: true
});
predicates.isOptionalCallExpression = isOptionalCallExpression;
/**
* Returns true if and only if the node represents logical OR
*/
const isLogicalOrOperator = (0, helpers_1.isNodeOfTypeWithConditions)(ts_estree_1.AST_NODE_TYPES.LogicalExpression, {
operator: '||'
});
predicates.isLogicalOrOperator = isLogicalOrOperator;
/**
* Checks if a node is a type assertion:
* ```
* x as foo
* <foo>x
* ```
*/
const isTypeAssertion = (0, helpers_1.isNodeOfTypes)([ts_estree_1.AST_NODE_TYPES.TSAsExpression, ts_estree_1.AST_NODE_TYPES.TSTypeAssertion]);
predicates.isTypeAssertion = isTypeAssertion;
const isVariableDeclarator = (0, helpers_1.isNodeOfType)(ts_estree_1.AST_NODE_TYPES.VariableDeclarator);
predicates.isVariableDeclarator = isVariableDeclarator;
const functionTypes = [ts_estree_1.AST_NODE_TYPES.ArrowFunctionExpression, ts_estree_1.AST_NODE_TYPES.FunctionDeclaration, ts_estree_1.AST_NODE_TYPES.FunctionExpression];
const isFunction = (0, helpers_1.isNodeOfTypes)(functionTypes);
predicates.isFunction = isFunction;
const functionTypeTypes = [ts_estree_1.AST_NODE_TYPES.TSCallSignatureDeclaration, ts_estree_1.AST_NODE_TYPES.TSConstructorType, ts_estree_1.AST_NODE_TYPES.TSConstructSignatureDeclaration, ts_estree_1.AST_NODE_TYPES.TSDeclareFunction, ts_estree_1.AST_NODE_TYPES.TSEmptyBodyFunctionExpression, ts_estree_1.AST_NODE_TYPES.TSFunctionType, ts_estree_1.AST_NODE_TYPES.TSMethodSignature];
const isFunctionType = (0, helpers_1.isNodeOfTypes)(functionTypeTypes);
predicates.isFunctionType = isFunctionType;
const isFunctionOrFunctionType = (0, helpers_1.isNodeOfTypes)([...functionTypes, ...functionTypeTypes]);
predicates.isFunctionOrFunctionType = isFunctionOrFunctionType;
const isTSFunctionType = (0, helpers_1.isNodeOfType)(ts_estree_1.AST_NODE_TYPES.TSFunctionType);
predicates.isTSFunctionType = isTSFunctionType;
const isTSConstructorType = (0, helpers_1.isNodeOfType)(ts_estree_1.AST_NODE_TYPES.TSConstructorType);
predicates.isTSConstructorType = isTSConstructorType;
const isClassOrTypeElement = (0, helpers_1.isNodeOfTypes)([
// ClassElement
ts_estree_1.AST_NODE_TYPES.PropertyDefinition, ts_estree_1.AST_NODE_TYPES.FunctionExpression, ts_estree_1.AST_NODE_TYPES.MethodDefinition, ts_estree_1.AST_NODE_TYPES.TSAbstractPropertyDefinition, ts_estree_1.AST_NODE_TYPES.TSAbstractMethodDefinition, ts_estree_1.AST_NODE_TYPES.TSEmptyBodyFunctionExpression, ts_estree_1.AST_NODE_TYPES.TSIndexSignature,
// TypeElement
ts_estree_1.AST_NODE_TYPES.TSCallSignatureDeclaration, ts_estree_1.AST_NODE_TYPES.TSConstructSignatureDeclaration,
// AST_NODE_TYPES.TSIndexSignature,
ts_estree_1.AST_NODE_TYPES.TSMethodSignature, ts_estree_1.AST_NODE_TYPES.TSPropertySignature]);
predicates.isClassOrTypeElement = isClassOrTypeElement;
/**
* Checks if a node is a constructor method.
*/
const isConstructor = (0, helpers_1.isNodeOfTypeWithConditions)(ts_estree_1.AST_NODE_TYPES.MethodDefinition, {
kind: 'constructor'
});
predicates.isConstructor = isConstructor;
/**
* Checks if a node is a setter method.
*/
function isSetter(node) {
return !!node && (node.type === ts_estree_1.AST_NODE_TYPES.MethodDefinition || node.type === ts_estree_1.AST_NODE_TYPES.Property) && node.kind === 'set';
}
const isIdentifier = (0, helpers_1.isNodeOfType)(ts_estree_1.AST_NODE_TYPES.Identifier);
predicates.isIdentifier = isIdentifier;
/**
* Checks if a node represents an `await …` expression.
*/
const isAwaitExpression = (0, helpers_1.isNodeOfType)(ts_estree_1.AST_NODE_TYPES.AwaitExpression);
predicates.isAwaitExpression = isAwaitExpression;
/**
* Checks if a possible token is the `await` keyword.
*/
const isAwaitKeyword = (0, helpers_1.isTokenOfTypeWithConditions)(ts_estree_1.AST_TOKEN_TYPES.Identifier, {
value: 'await'
});
predicates.isAwaitKeyword = isAwaitKeyword;
/**
* Checks if a possible token is the `type` keyword.
*/
const isTypeKeyword = (0, helpers_1.isTokenOfTypeWithConditions)(ts_estree_1.AST_TOKEN_TYPES.Identifier, {
value: 'type'
});
predicates.isTypeKeyword = isTypeKeyword;
/**
* Checks if a possible token is the `import` keyword.
*/
const isImportKeyword = (0, helpers_1.isTokenOfTypeWithConditions)(ts_estree_1.AST_TOKEN_TYPES.Keyword, {
value: 'import'
});
predicates.isImportKeyword = isImportKeyword;
const isLoop = (0, helpers_1.isNodeOfTypes)([ts_estree_1.AST_NODE_TYPES.DoWhileStatement, ts_estree_1.AST_NODE_TYPES.ForStatement, ts_estree_1.AST_NODE_TYPES.ForInStatement, ts_estree_1.AST_NODE_TYPES.ForOfStatement, ts_estree_1.AST_NODE_TYPES.WhileStatement]);
predicates.isLoop = isLoop;
return predicates;
}
var hasRequiredAstUtils;
function requireAstUtils() {
if (hasRequiredAstUtils) return astUtils;
hasRequiredAstUtils = 1;
(function (exports) {
var __createBinding = astUtils.__createBinding || (_Object$create ? function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = _Object$getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = {
enumerable: true,
get: function () {
return m[k];
}
};
}
_Object$defineProperty(o, k2, desc);
} : function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
var __exportStar = astUtils.__exportStar || function (m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
_Object$defineProperty(exports, "__esModule", {
value: true
});
__exportStar(requireEslintUtils$1(), exports);
__exportStar(requireHelpers(), exports);
__exportStar(requireMisc(), exports);
__exportStar(requirePredicates(), exports);
})(astUtils);
return astUtils;
}
var eslintUtils = {};
var applyDefault = {};
var deepMerge = {};
var hasRequiredDeepMerge;
function requireDeepMerge() {
if (hasRequiredDeepMerge) return deepMerge;
hasRequiredDeepMerge = 1;
_Object$defineProperty(deepMerge, "__esModule", {
value: true
});
deepMerge.deepMerge = deepMerge$1;
deepMerge.isObjectNotArray = isObjectNotArray;
/**
* Check if the variable contains an object strictly rejecting arrays
* @returns `true` if obj is an object
*/
function isObjectNotArray(obj) {
return typeof obj === 'object' && obj != null && !_Array$isArray(obj);
}
/**
* Pure function - doesn't mutate either parameter!
* Merges two objects together deeply, overwriting the properties in first with the properties in second
* @param first The first object
* @param second The second object
* @returns a new object
*/
function deepMerge$1(first = {}, second = {}) {
var _context;
// get the unique set of keys across both objects
const keys = new _Set([..._Object$keys(first), ..._Object$keys(second)]);
return _Object$fromEntries(_mapInstanceProperty(_context = [...keys]).call(_context, key => {
const firstHasKey = key in first;
const secondHasKey = key in second;
const firstValue = first[key];
const secondValue = second[key];
let value;
if (firstHasKey && secondHasKey) {
if (isObjectNotArray(firstValue) && isObjectNotArray(secondValue)) {
// object type
value = deepMerge$1(firstValue, secondValue);
} else {
// value type
value = secondValue;
}
} else if (firstHasKey) {
value = firstValue;
} else {
value = secondValue;
}
return [key, value];
}));
}
return deepMerge;
}
var hasRequiredApplyDefault;
function requireApplyDefault() {
if (hasRequiredApplyDefault) return applyDefault;
hasRequiredApplyDefault = 1;
_Object$defineProperty(applyDefault, "__esModule", {
value: true
});
applyDefault.applyDefault = applyDefault$1;
const deepMerge_1 = requireDeepMerge();
/**
* Pure function - doesn't mutate either parameter!
* Uses the default options and overrides with the options provided by the user
* @param defaultOptions the defaults
* @param userOptions the user opts
* @returns the options with defaults
*/
function applyDefault$1(defaultOptions, userOptions) {
// clone defaults
const options = structuredClone(defaultOptions);
if (userOptions == null) {
return options;
}
// For avoiding the type error
// `This expression is not callable. Type 'unknown' has no call signatures.ts(2349)`
_forEachInstanceProperty(options).call(options, (opt, i) => {
if (userOptions[i] !== undefined) {
const userOpt = userOptions[i];
if ((0, deepMerge_1.isObjectNotArray)(userOpt) && (0, deepMerge_1.isObjectNotArray)(opt)) {
options[i] = (0, deepMerge_1.deepMerge)(opt, userOpt);
} else {
options[i] = userOpt;
}
}
});
return options;
}
return applyDefault;
}
var getParserServices = {};
var parserSeemsToBeTSESLint = {};
var hasRequiredParserSeemsToBeTSESLint;
function requireParserSeemsToBeTSESLint() {
if (hasRequiredParserSeemsToBeTSESLint) return parserSeemsToBeTSESLint;
hasRequiredParserSeemsToBeTSESLint = 1;
_Object$defineProperty(parserSeemsToBeTSESLint, "__esModule", {
value: true
});
parserSeemsToBeTSESLint.parserSeemsToBeTSESLint = parserSeemsToBeTSESLint$1;
function parserSeemsToBeTSESLint$1(parser) {
return !!parser && /(?:typescript-eslint|\.\.)[\w/\\]*parser/.test(parser);
}
return parserSeemsToBeTSESLint;
}
var hasRequiredGetParserServices;
function requireGetParserServices() {
if (hasRequiredGetParserServices) return getParserServices;
hasRequiredGetParserServices = 1;
_Object$defineProperty(getParserServices, "__esModule", {
value: true
});
getParserServices.getParserServices = getParserServices$1;
const parserSeemsToBeTSESLint_1 = requireParserSeemsToBeTSESLint();
const ERROR_MESSAGE_REQUIRES_PARSER_SERVICES = "You have used a rule which requires type information, but don't have parserOptions set to generate type information for this file. See https://typescript-eslint.io/getting-started/typed-linting for enabling linting with type information.";
const ERROR_MESSAGE_UNKNOWN_PARSER = 'Note: detected a parser other than @typescript-eslint/parser. Make sure the parser is configured to forward "parserOptions.project" to @typescript-eslint/parser.';
function getParserServices$1(context, allowWithoutFullTypeInformation = false) {
var _context$languageOpti, _context$sourceCode$p;
const parser = context.parserPath || ((_context$languageOpti = context.languageOptions.parser) == null || (_context$languageOpti = _context$languageOpti.meta) == null ? undefined : _context$languageOpti.name);
// This check is unnecessary if the user is using the latest version of our parser.
//
// However the world isn't perfect:
// - Users often use old parser versions.
// Old versions of the parser would not return any parserServices unless parserOptions.project was set.
// - Users sometimes use parsers that aren't @typescript-eslint/parser
// Other parsers won't return the parser services we expect (if they return any at all).
//
// This check allows us to handle bad user setups whilst providing a nice user-facing
// error message explaining the problem.
if (((_context$sourceCode$p = context.sourceCode.parserServices) == null ? undefined : _context$sourceCode$p.esTreeNodeToTSNodeMap) == null || context.sourceCode.parserServices.tsNodeToESTreeNodeMap == null) {
throwError(parser);
}
// if a rule requires full type information, then hard fail if it doesn't exist
// this forces the user to supply parserOptions.project
if (context.sourceCode.parserServices.program == null && !allowWithoutFullTypeInformation) {
throwError(parser);
}
return context.sourceCode.parserServices;
}
/* eslint-enable @typescript-eslint/unified-signatures */
function throwError(parser) {
var _context;
const messages = _filterInstanceProperty(_context = [ERROR_MESSAGE_REQUIRES_PARSER_SERVICES, `Parser: ${parser || '(unknown)'}`, !(0, parserSeemsToBeTSESLint_1.parserSeemsToBeTSESLint)(parser) && ERROR_MESSAGE_UNKNOWN_PARSER]).call(_context, Boolean);
throw new Error(messages.join('\n'));
}
return getParserServices;
}
var InferTypesFromRule = {};
var hasRequiredInferTypesFromRule;
function requireInferTypesFromRule() {
if (hasRequiredInferTypesFromRule) return InferTypesFromRule;
hasRequiredInferTypesFromRule = 1;
_Object$defineProperty(InferTypesFromRule, "__esModule", {
value: true
});
return InferTypesFromRule;
}
var nullThrows = {};
var hasRequiredNullThrows;
function requireNullThrows() {
if (hasRequiredNullThrows) return nullThrows;
hasRequiredNullThrows = 1;
_Object$defineProperty(nullThrows, "__esModule", {
value: true
});
nullThrows.NullThrowsReasons = undefined;
nullThrows.nullThrows = nullThrows$1;
/**
* A set of common reasons for calling nullThrows
*/
const NullThrowsReasons = {
MissingParent: 'Expected node to have a parent.',
MissingToken: (token, thing) => `Expected to find a ${token} for the ${thing}.`
};
nullThrows.NullThrowsReasons = NullThrowsReasons;
/**
* Assert that a value must not be null or undefined.
* This is a nice explicit alternative to the non-null assertion operator.
*/
function nullThrows$1(value, message) {
if (value == null) {
throw new Error(`Non-null Assertion Failed: ${message}`);
}
return value;
}
return nullThrows;
}
var RuleCreator = {};
var hasRequiredRuleCreator;
function requireRuleCreator() {
if (hasRequiredRuleCreator) return RuleCreator;
hasRequiredRuleCreator = 1;
_Object$defineProperty(RuleCreator, "__esModule", {
value: true
});
RuleCreator.RuleCreator = RuleCreator$1;
const applyDefault_1 = requireApplyDefault();
/**
* Creates reusable function to create rules with default options and docs URLs.
*
* @param urlCreator Creates a documentation URL for a given rule name.
* @returns Function to create a rule with the docs URL format.
*/
function RuleCreator$1(urlCreator) {
// This function will get much easier to call when this is merged https://github.com/Microsoft/TypeScript/pull/26349
// TODO - when the above PR lands; add type checking for the context.report `data` property
return function createNamedRule({
meta,
name,
...rule
}) {
return createRule({
meta: {
...meta,
docs: {
...meta.docs,
url: urlCreator(name)
}
},
...rule
});
};
}
function createRule({
create,
defaultOptions,
meta
}) {
return {
create(context) {
const optionsWithDefault = (0, applyDefault_1.applyDefault)(defaultOptions, context.options);
return create(context, optionsWithDefault);
},
defaultOptions,
meta
};
}
/**
* Creates a well-typed TSESLint custom ESLint rule without a docs URL.
*
* @returns Well-typed TSESLint custom ESLint rule.
* @remarks It is generally better to provide a docs URL function to RuleCreator.
*/
RuleCreator$1.withoutDocs = function withoutDocs(args) {
return createRule(args);
};
return RuleCreator;
}
var hasRequiredEslintUtils;
function requireEslintUtils() {
if (hasRequiredEslintUtils) return eslintUtils;
hasRequiredEslintUtils = 1;
(function (exports) {
var __createBinding = eslintUtils.__createBinding || (_Object$create ? function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = _Object$getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = {
enumerable: true,
get: function () {
return m[k];
}
};
}
_Object$defineProperty(o, k2, desc);
} : function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
var __exportStar = eslintUtils.__exportStar || function (m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
_Object$defineProperty(exports, "__esModule", {
value: true
});
__exportStar(requireApplyDefault(), exports);
__exportStar(requireDeepMerge(), exports);
__exportStar(requireGetParserServices(), exports);
__exportStar(requireInferTypesFromRule(), exports);
__exportStar(requireNullThrows(), exports);
__exportStar(requireRuleCreator(), exports);
})(eslintUtils);
return eslintUtils;
}
var jsonSchema = {};
var hasRequiredJsonSchema;
function requireJsonSchema() {
if (hasRequiredJsonSchema) return jsonSchema;
hasRequiredJsonSchema = 1;
/**
* This is a fork of https://github.com/DefinitelyTyped/DefinitelyTyped/blob/13f63c2eb8d7479caf01ab8d72f9e3683368a8f5/types/json-schema/index.d.ts
* We intentionally fork this because:
* - ESLint ***ONLY*** supports JSONSchema v4
* - We want to provide stricter types
*/
_Object$defineProperty(jsonSchema, "__esModule", {
value: true
});
return jsonSchema;
}
var tsEslint = {};
var AST = {};
var hasRequiredAST;
function requireAST() {
if (hasRequiredAST) return AST;
hasRequiredAST = 1;
/* eslint-disable @typescript-eslint/no-namespace */
_Object$defineProperty(AST, "__esModule", {
value: true
});
return AST;
}
var Config = {};
var hasRequiredConfig;
function requireConfig() {
if (hasRequiredConfig) return Config;
hasRequiredConfig = 1;
/* eslint-disable @typescript-eslint/consistent-indexed-object-style, @typescript-eslint/no-namespace */
_Object$defineProperty(Config, "__esModule", {
value: true
});
return Config;
}
var ESLint = {};
var FlatESLint = {};
var hasRequiredFlatESLint;
function requireFlatESLint() {
if (hasRequiredFlatESLint) return FlatESLint;
hasRequiredFlatESLint = 1;
_Object$defineProperty(FlatESLint, "__esModule", {
value: true
});
FlatESLint.FlatESLint = undefined;
/* eslint-disable @typescript-eslint/no-namespace */
const use_at_your_own_risk_1 = require$$0;
/**
* The ESLint class is the primary class to use in Node.js applications.
* This class depends on the Node.js fs module and the file system, so you cannot use it in browsers.
*
* If you want to lint code on browsers, use the Linter class instead.
*/
let FlatESLint$1 = class FlatESLint extends use_at_your_own_risk_1.FlatESLint {};
FlatESLint.FlatESLint = FlatESLint$1;
return FlatESLint;
}
var LegacyESLint = {};
var hasRequiredLegacyESLint;
function requireLegacyESLint() {
if (hasRequiredLegacyESLint) return LegacyESLint;
hasRequiredLegacyESLint = 1;
/* eslint-disable @typescript-eslint/no-namespace */
_Object$defineProperty(LegacyESLint, "__esModule", {
value: true
});
LegacyESLint.LegacyESLint = undefined;
const use_at_your_own_risk_1 = require$$0;
/**
* The ESLint class is the primary class to use in Node.js applications.
* This class depends on the Node.js fs module and the file system, so you cannot use it in browsers.
*
* If you want to lint code on browsers, use the Linter class instead.
*/
let LegacyESLint$1 = class LegacyESLint extends use_at_your_own_risk_1.LegacyESLint {};
LegacyESLint.LegacyESLint = LegacyESLint$1;
return LegacyESLint;
}
var hasRequiredESLint;
function requireESLint() {
if (hasRequiredESLint) return ESLint;
hasRequiredESLint = 1;
(function (exports) {
_Object$defineProperty(exports, "__esModule", {
value: true
});
exports.LegacyESLint = exports.ESLint = exports.FlatESLint = undefined;
var FlatESLint_1 = requireFlatESLint();
_Object$defineProperty(exports, "FlatESLint", {
enumerable: true,
get: function () {
return FlatESLint_1.FlatESLint;
}
});
var FlatESLint_2 = requireFlatESLint();
_Object$defineProperty(exports, "ESLint", {
enumerable: true,
get: function () {
return FlatESLint_2.FlatESLint;
}
});
var LegacyESLint_1 = requireLegacyESLint();
// TODO(eslint@v10) - remove this in the next major
/**
* @deprecated - use ESLint instead
*/
_Object$defineProperty(exports, "LegacyESLint", {
enumerable: true,
get: function () {
return LegacyESLint_1.LegacyESLint;
}
});
})(ESLint);
return ESLint;
}
var Linter = {};
var hasRequiredLinter;
function requireLinter() {
if (hasRequiredLinter) return Linter;
hasRequiredLinter = 1;
/* eslint-disable @typescript-eslint/no-namespace */
_Object$defineProperty(Linter, "__esModule", {
value: true
});
Linter.Linter = undefined;
const eslint_1 = require$$0$1;
/**
* The Linter object does the actual evaluation of the JavaScript code. It doesn't do any filesystem operations, it
* simply parses and reports on the code. In particular, the Linter object does not process configuration objects
* or files.
*/
let Linter$1 = class Linter extends eslint_1.Linter {};
Linter.Linter = Linter$1;
return Linter;
}
var Parser = {};
var hasRequiredParser;
function requireParser() {
if (hasRequiredParser) return Parser;
hasRequiredParser = 1;
/* eslint-disable @typescript-eslint/no-namespace */
_Object$defineProperty(Parser, "__esModule", {
value: true
});
return Parser;
}
var ParserOptions = {};
var hasRequiredParserOptions;
function requireParserOptions() {
if (hasRequiredParserOptions) return ParserOptions;
hasRequiredParserOptions = 1;
_Object$defineProperty(ParserOptions, "__esModule", {
value: true
});
return ParserOptions;
}
var Processor = {};
var hasRequiredProcessor;
function requireProcessor() {
if (hasRequiredProcessor) return Processor;
hasRequiredProcessor = 1;
/* eslint-disable @typescript-eslint/no-namespace */
_Object$defineProperty(Processor, "__esModule", {
value: true
});
return Processor;
}
var Rule = {};
var hasRequiredRule;
function requireRule() {
if (hasRequiredRule) return Rule;
hasRequiredRule = 1;
_Object$defineProperty(Rule, "__esModule", {
value: true
});
return Rule;
}
var RuleTester = {};
var hasRequiredRuleTester;
function requireRuleTester() {
if (hasRequiredRuleTester) return RuleTester;
hasRequiredRuleTester = 1;
_Object$defineProperty(RuleTester, "__esModule", {
value: true
});
RuleTester.RuleTester = undefined;
/* eslint-disable @typescript-eslint/no-deprecated */
const eslint_1 = require$$0$1;
/**
* @deprecated Use `@typescript-eslint/rule-tester` instead.
*/
let RuleTester$1 = class RuleTester extends eslint_1.RuleTester {};
RuleTester.RuleTester = RuleTester$1;
return RuleTester;
}
var Scope$1 = {};
var dist$1 = {};
var analyze = {};
var dist = {};
var getKeys = {};
var hasRequiredGetKeys;
function requireGetKeys() {
if (hasRequiredGetKeys) return getKeys;
hasRequiredGetKeys = 1;
_Object$defineProperty(getKeys, "__esModule", {
value: true
});
getKeys.getKeys = undefined;
const eslint_visitor_keys_1 = requireEslintVisitorKeys();
const getKeys$1 = eslint_visitor_keys_1.getKeys;
getKeys.getKeys = getKeys$1;
return getKeys;
}
var visitorKeys = {};
var hasRequiredVisitorKeys;
function requireVisitorKeys() {
if (hasRequiredVisitorKeys) return visitorKeys;
hasRequiredVisitorKeys = 1;
var __createBinding = visitorKeys.__createBinding || (_Object$create ? function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = _Object$getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = {
enumerable: true,
get: function () {
return m[k];
}
};
}
_Object$defineProperty(o, k2, desc);
} : function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
var __setModuleDefault = visitorKeys.__setModuleDefault || (_Object$create ? function (o, v) {
_Object$defineProperty(o, "default", {
enumerable: true,
value: v
});
} : function (o, v) {
o["default"] = v;
});
var __importStar = visitorKeys.__importStar || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
_Object$defineProperty(visitorKeys, "__esModule", {
value: true
});
visitorKeys.visitorKeys = undefined;
const eslintVisitorKeys = __importStar(requireEslintVisitorKeys());
/*
********************************** IMPORTANT NOTE ********************************
* *
* The key arrays should be sorted in the order in which you would want to visit *
* the child keys. *
* *
* DO NOT SORT THEM ALPHABETICALLY! *
* *
* They should be sorted in the order that they appear in the source code. *
* For example: *
* *
* class Foo extends Bar { prop: 1 } *
* ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ClassDeclaration *
* ^^^ id ^^^ superClass *
* ^^^^^^^^^^^ body *
* *
* It would be incorrect to provide the visitor keys ['body', 'id', 'superClass'] *
* because the body comes AFTER everything else in the source code. *
* Instead the correct ordering would be ['id', 'superClass', 'body']. *
* *
**********************************************************************************
*/
const SharedVisitorKeys = (() => {
const FunctionType = ['typeParameters', 'params', 'returnType'];
const AnonymousFunction = [...FunctionType, 'body'];
const AbstractPropertyDefinition = ['decorators', 'key', 'typeAnnotation'];
return {
AbstractPropertyDefinition: ['decorators', 'key', 'typeAnnotation'],
AnonymousFunction,
AsExpression: ['expression', 'typeAnnotation'],
ClassDeclaration: ['decorators', 'id', 'typeParameters', 'superClass', 'superTypeArguments', 'implements', 'body'],
Function: ['id', ...AnonymousFunction],
FunctionType,
PropertyDefinition: [...AbstractPropertyDefinition, 'value']
};
})();
const additionalKeys = {
AccessorProperty: SharedVisitorKeys.PropertyDefinition,
ArrayPattern: ['decorators', 'elements', 'typeAnnotation'],
ArrowFunctionExpression: SharedVisitorKeys.AnonymousFunction,
AssignmentPattern: ['decorators', 'left', 'right', 'typeAnnotation'],
CallExpression: ['callee', 'typeArguments', 'arguments'],
ClassDeclaration: SharedVisitorKeys.ClassDeclaration,
ClassExpression: SharedVisitorKeys.ClassDeclaration,
Decorator: ['expression'],
ExportAllDeclaration: ['exported', 'source', 'assertions'],
ExportNamedDeclaration: ['declaration', 'specifiers', 'source', 'assertions'],
FunctionDeclaration: SharedVisitorKeys.Function,
FunctionExpression: SharedVisitorKeys.Function,
Identifier: ['decorators', 'typeAnnotation'],
ImportAttribute: ['key', 'value'],
ImportDeclaration: ['specifiers', 'source', 'assertions'],
ImportExpression: ['source', 'options'],
JSXClosingFragment: [],
JSXOpeningElement: ['name', 'typeArguments', 'attributes'],
JSXOpeningFragment: [],
JSXSpreadChild: ['expression'],
MethodDefinition: ['decorators', 'key', 'value'],
NewExpression: ['callee', 'typeArguments', 'arguments'],
ObjectPattern: ['decorators', 'properties', 'typeAnnotation'],
PropertyDefinition: SharedVisitorKeys.PropertyDefinition,
RestElement: ['decorators', 'argument', 'typeAnnotation'],
StaticBlock: ['body'],
TaggedTemplateExpression: ['tag', 'typeArguments', 'quasi'],
TSAbstractAccessorProperty: SharedVisitorKeys.AbstractPropertyDefinition,
TSAbstractKeyword: [],
TSAbstractMethodDefinition: ['key', 'value'],
TSAbstractPropertyDefinition: SharedVisitorKeys.AbstractPropertyDefinition,
TSAnyKeyword: [],
TSArrayType: ['elementType'],
TSAsExpression: SharedVisitorKeys.AsExpression,
TSAsyncKeyword: [],
TSBigIntKeyword: [],
TSBooleanKeyword: [],
TSCallSignatureDeclaration: SharedVisitorKeys.FunctionType,
TSClassImplements: ['expression', 'typeArguments'],
TSConditionalType: ['checkType', 'extendsType', 'trueType', 'falseType'],
TSConstructorType: SharedVisitorKeys.FunctionType,
TSConstructSignatureDeclaration: SharedVisitorKeys.FunctionType,
TSDeclareFunction: SharedVisitorKeys.Function,
TSDeclareKeyword: [],
TSEmptyBodyFunctionExpression: ['id', ...SharedVisitorKeys.FunctionType],
TSEnumBody: ['members'],
TSEnumDeclaration: ['id', 'body'],
TSEnumMember: ['id', 'initializer'],
TSExportAssignment: ['expression'],
TSExportKeyword: [],
TSExternalModuleReference: ['expression'],
TSFunctionType: SharedVisitorKeys.FunctionType,
TSImportEqualsDeclaration: ['id', 'moduleReference'],
TSImportType: ['argument', 'qualifier', 'typeArguments'],
TSIndexedAccessType: ['indexType', 'objectType'],
TSIndexSignature: ['parameters', 'typeAnnotation'],
TSInferType: ['typeParameter'],
TSInstantiationExpression: ['expression', 'typeArguments'],
TSInterfaceBody: ['body'],
TSInterfaceDeclaration: ['id', 'typeParameters', 'extends', 'body'],
TSInterfaceHeritage: ['expression', 'typeArguments'],
TSIntersectionType: ['types'],
TSIntrinsicKeyword: [],
TSLiteralType: ['literal'],
TSMappedType: ['key', 'constraint', 'nameType', 'typeAnnotation'],
TSMethodSignature: ['typeParameters', 'key', 'params', 'returnType'],
TSModuleBlock: ['body'],
TSModuleDeclaration: ['id', 'body'],
TSNamedTupleMember: ['label', 'elementType'],
TSNamespaceExportDeclaration: ['id'],
TSNeverKeyword: [],
TSNonNullExpression: ['expression'],
TSNullKeyword: [],
TSNumberKeyword: [],
TSObjectKeyword: [],
TSOptionalType: ['typeAnnotation'],
TSParameterProperty: ['decorators', 'parameter'],
TSPrivateKeyword: [],
TSPropertySignature: ['typeAnnotation', 'key'],
TSProtectedKeyword: [],
TSPublicKeyword: [],
TSQualifiedName: ['left', 'right'],
TSReadonlyKeyword: [],
TSRestType: ['typeAnnotation'],
TSSatisfiesExpression: SharedVisitorKeys.AsExpression,
TSStaticKeyword: [],
TSStringKeyword: [],
TSSymbolKeyword: [],
TSTemplateLiteralType: ['quasis', 'types'],
TSThisType: [],
TSTupleType: ['elementTypes'],
TSTypeAliasDeclaration: ['id', 'typeParameters', 'typeAnnotation'],
TSTypeAnnotation: ['typeAnnotation'],
TSTypeAssertion: ['typeAnnotation', 'expression'],
TSTypeLiteral: ['members'],
TSTypeOperator: ['typeAnnotation'],
TSTypeParameter: ['name', 'constraint', 'default'],
TSTypeParameterDeclaration: ['params'],
TSTypeParameterInstantiation: ['params'],
TSTypePredicate: ['typeAnnotation', 'parameterName'],
TSTypeQuery: ['exprName', 'typeArguments'],
TSTypeReference: ['typeName', 'typeArguments'],
TSUndefinedKeyword: [],
TSUnionType: ['types'],
TSUnknownKeyword: [],
TSVoidKeyword: []
};
const visitorKeys$1 = eslintVisitorKeys.unionWith(additionalKeys);
visitorKeys.visitorKeys = visitorKeys$1;
return visitorKeys;
}
var hasRequiredDist$2;
function requireDist$2() {
if (hasRequiredDist$2) return dist;
hasRequiredDist$2 = 1;
(function (exports) {
_Object$defineProperty(exports, "__esModule", {
value: true
});
exports.visitorKeys = exports.getKeys = undefined;
var get_keys_1 = requireGetKeys();
_Object$defineProperty(exports, "getKeys", {
enumerable: true,
get: function () {
return get_keys_1.getKeys;
}
});
var visitor_keys_1 = requireVisitorKeys();
_Object$defineProperty(exports, "visitorKeys", {
enumerable: true,
get: function () {
return visitor_keys_1.visitorKeys;
}
});
})(dist);
return dist;
}
var referencer = {};
var Referencer = {};
var assert = {};
var hasRequiredAssert;
function requireAssert() {
if (hasRequiredAssert) return assert;
hasRequiredAssert = 1;
_Object$defineProperty(assert, "__esModule", {
value: true
});
assert.assert = assert$1;
// the base assert module doesn't use ts assertion syntax
function assert$1(value, message) {
if (value == null) {
throw new Error(message);
}
}
return assert;
}
var definition = {};
var CatchClauseDefinition = {};
var DefinitionBase = {};
var ID = {};
var hasRequiredID;
function requireID() {
if (hasRequiredID) return ID;
hasRequiredID = 1;
_Object$defineProperty(ID, "__esModule", {
value: true
});
ID.createIdGenerator = createIdGenerator;
ID.resetIds = resetIds;
const ID_CACHE = new _Map();
let NEXT_KEY = 0;
function createIdGenerator() {
const key = NEXT_KEY += 1;
ID_CACHE.set(key, 0);
return () => {
var _ID_CACHE$get;
const current = (_ID_CACHE$get = ID_CACHE.get(key)) != null ? _ID_CACHE$get : 0;
const next = current + 1;
ID_CACHE.set(key, next);
return next;
};
}
function resetIds() {
ID_CACHE.clear();
}
return ID;
}
var hasRequiredDefinitionBase;
function requireDefinitionBase() {
if (hasRequiredDefinitionBase) return DefinitionBase;
hasRequiredDefinitionBase = 1;
_Object$defineProperty(DefinitionBase, "__esModule", {
value: true
});
DefinitionBase.DefinitionBase = undefined;
const ID_1 = requireID();
const generator = (0, ID_1.createIdGenerator)();
let DefinitionBase$1 = class DefinitionBase {
/**
* A unique ID for this instance - primarily used to help debugging and testing
*/
$id = generator();
type;
/**
* The `Identifier` node of this definition
* @public
*/
name;
/**
* The enclosing node of the name.
* @public
*/
node;
/**
* the enclosing statement node of the identifier.
* @public
*/
parent;
constructor(type, name, node, parent) {
this.type = type;
this.name = name;
this.node = node;
this.parent = parent;
}
};
DefinitionBase.DefinitionBase = DefinitionBase$1;
return DefinitionBase;
}
var DefinitionType = {};
var hasRequiredDefinitionType;
function requireDefinitionType() {
if (hasRequiredDefinitionType) return DefinitionType;
hasRequiredDefinitionType = 1;
_Object$defineProperty(DefinitionType, "__esModule", {
value: true
});
DefinitionType.DefinitionType = undefined;
var DefinitionType$1;
(function (DefinitionType) {
DefinitionType["CatchClause"] = "CatchClause";
DefinitionType["ClassName"] = "ClassName";
DefinitionType["FunctionName"] = "FunctionName";
DefinitionType["ImplicitGlobalVariable"] = "ImplicitGlobalVariable";
DefinitionType["ImportBinding"] = "ImportBinding";
DefinitionType["Parameter"] = "Parameter";
DefinitionType["TSEnumName"] = "TSEnumName";
DefinitionType["TSEnumMember"] = "TSEnumMemberName";
DefinitionType["TSModuleName"] = "TSModuleName";
DefinitionType["Type"] = "Type";
DefinitionType["Variable"] = "Variable";
})(DefinitionType$1 || (DefinitionType.DefinitionType = DefinitionType$1 = {}));
return DefinitionType;
}
var hasRequiredCatchClauseDefinition;
function requireCatchClauseDefinition() {
if (hasRequiredCatchClauseDefinition) return CatchClauseDefinition;
hasRequiredCatchClauseDefinition = 1;
_Object$defineProperty(CatchClauseDefinition, "__esModule", {
value: true
});
CatchClauseDefinition.CatchClauseDefinition = undefined;
const DefinitionBase_1 = requireDefinitionBase();
const DefinitionType_1 = requireDefinitionType();
let CatchClauseDefinition$1 = class CatchClauseDefinition extends DefinitionBase_1.DefinitionBase {
isTypeDefinition = false;
isVariableDefinition = true;
constructor(name, node) {
super(DefinitionType_1.DefinitionType.CatchClause, name, node, null);
}
};
CatchClauseDefinition.CatchClauseDefinition = CatchClauseDefinition$1;
return CatchClauseDefinition;
}
var ClassNameDefinition = {};
var hasRequiredClassNameDefinition;
function requireClassNameDefinition() {
if (hasRequiredClassNameDefinition) return ClassNameDefinition;
hasRequiredClassNameDefinition = 1;
_Object$defineProperty(ClassNameDefinition, "__esModule", {
value: true
});
ClassNameDefinition.ClassNameDefinition = undefined;
const DefinitionBase_1 = requireDefinitionBase();
const DefinitionType_1 = requireDefinitionType();
let ClassNameDefinition$1 = class ClassNameDefinition extends DefinitionBase_1.DefinitionBase {
isTypeDefinition = true;
isVariableDefinition = true;
constructor(name, node) {
super(DefinitionType_1.DefinitionType.ClassName, name, node, null);
}
};
ClassNameDefinition.ClassNameDefinition = ClassNameDefinition$1;
return ClassNameDefinition;
}
var Definition = {};
var hasRequiredDefinition$1;
function requireDefinition$1() {
if (hasRequiredDefinition$1) return Definition;
hasRequiredDefinition$1 = 1;
_Object$defineProperty(Definition, "__esModule", {
value: true
});
return Definition;
}
var FunctionNameDefinition = {};
var hasRequiredFunctionNameDefinition;
function requireFunctionNameDefinition() {
if (hasRequiredFunctionNameDefinition) return FunctionNameDefinition;
hasRequiredFunctionNameDefinition = 1;
_Object$defineProperty(FunctionNameDefinition, "__esModule", {
value: true
});
FunctionNameDefinition.FunctionNameDefinition = undefined;
const DefinitionBase_1 = requireDefinitionBase();
const DefinitionType_1 = requireDefinitionType();
let FunctionNameDefinition$1 = class FunctionNameDefinition extends DefinitionBase_1.DefinitionBase {
isTypeDefinition = false;
isVariableDefinition = true;
constructor(name, node) {
super(DefinitionType_1.DefinitionType.FunctionName, name, node, null);
}
};
FunctionNameDefinition.FunctionNameDefinition = FunctionNameDefinition$1;
return FunctionNameDefinition;
}
var ImplicitGlobalVariableDefinition = {};
var hasRequiredImplicitGlobalVariableDefinition;
function requireImplicitGlobalVariableDefinition() {
if (hasRequiredImplicitGlobalVariableDefinition) return ImplicitGlobalVariableDefinition;
hasRequiredImplicitGlobalVariableDefinition = 1;
_Object$defineProperty(ImplicitGlobalVariableDefinition, "__esModule", {
value: true
});
ImplicitGlobalVariableDefinition.ImplicitGlobalVariableDefinition = undefined;
const DefinitionBase_1 = requireDefinitionBase();
const DefinitionType_1 = requireDefinitionType();
let ImplicitGlobalVariableDefinition$1 = class ImplicitGlobalVariableDefinition extends DefinitionBase_1.DefinitionBase {
isTypeDefinition = false;
isVariableDefinition = true;
constructor(name, node) {
super(DefinitionType_1.DefinitionType.ImplicitGlobalVariable, name, node, null);
}
};
ImplicitGlobalVariableDefinition.ImplicitGlobalVariableDefinition = ImplicitGlobalVariableDefinition$1;
return ImplicitGlobalVariableDefinition;
}
var ImportBindingDefinition = {};
var hasRequiredImportBindingDefinition;
function requireImportBindingDefinition() {
if (hasRequiredImportBindingDefinition) return ImportBindingDefinition;
hasRequiredImportBindingDefinition = 1;
_Object$defineProperty(ImportBindingDefinition, "__esModule", {
value: true
});
ImportBindingDefinition.ImportBindingDefinition = undefined;
const DefinitionBase_1 = requireDefinitionBase();
const DefinitionType_1 = requireDefinitionType();
let ImportBindingDefinition$1 = class ImportBindingDefinition extends DefinitionBase_1.DefinitionBase {
isTypeDefinition = true;
isVariableDefinition = true;
constructor(name, node, decl) {
super(DefinitionType_1.DefinitionType.ImportBinding, name, node, decl);
}
};
ImportBindingDefinition.ImportBindingDefinition = ImportBindingDefinition$1;
return ImportBindingDefinition;
}
var ParameterDefinition = {};
var hasRequiredParameterDefinition;
function requireParameterDefinition() {
if (hasRequiredParameterDefinition) return ParameterDefinition;
hasRequiredParameterDefinition = 1;
_Object$defineProperty(ParameterDefinition, "__esModule", {
value: true
});
ParameterDefinition.ParameterDefinition = undefined;
const DefinitionBase_1 = requireDefinitionBase();
const DefinitionType_1 = requireDefinitionType();
let ParameterDefinition$1 = class ParameterDefinition extends DefinitionBase_1.DefinitionBase {
/**
* Whether the parameter definition is a part of a rest parameter.
*/
isTypeDefinition = false;
isVariableDefinition = true;
rest;
constructor(name, node, rest) {
super(DefinitionType_1.DefinitionType.Parameter, name, node, null);
this.rest = rest;
}
};
ParameterDefinition.ParameterDefinition = ParameterDefinition$1;
return ParameterDefinition;
}
var TSEnumMemberDefinition = {};
var hasRequiredTSEnumMemberDefinition;
function requireTSEnumMemberDefinition() {
if (hasRequiredTSEnumMemberDefinition) return TSEnumMemberDefinition;
hasRequiredTSEnumMemberDefinition = 1;
_Object$defineProperty(TSEnumMemberDefinition, "__esModule", {
value: true
});
TSEnumMemberDefinition.TSEnumMemberDefinition = undefined;
const DefinitionBase_1 = requireDefinitionBase();
const DefinitionType_1 = requireDefinitionType();
let TSEnumMemberDefinition$1 = class TSEnumMemberDefinition extends DefinitionBase_1.DefinitionBase {
isTypeDefinition = true;
isVariableDefinition = true;
constructor(name, node) {
super(DefinitionType_1.DefinitionType.TSEnumMember, name, node, null);
}
};
TSEnumMemberDefinition.TSEnumMemberDefinition = TSEnumMemberDefinition$1;
return TSEnumMemberDefinition;
}
var TSEnumNameDefinition = {};
var hasRequiredTSEnumNameDefinition;
function requireTSEnumNameDefinition() {
if (hasRequiredTSEnumNameDefinition) return TSEnumNameDefinition;
hasRequiredTSEnumNameDefinition = 1;
_Object$defineProperty(TSEnumNameDefinition, "__esModule", {
value: true
});
TSEnumNameDefinition.TSEnumNameDefinition = undefined;
const DefinitionBase_1 = requireDefinitionBase();
const DefinitionType_1 = requireDefinitionType();
let TSEnumNameDefinition$1 = class TSEnumNameDefinition extends DefinitionBase_1.DefinitionBase {
isTypeDefinition = true;
isVariableDefinition = true;
constructor(name, node) {
super(DefinitionType_1.DefinitionType.TSEnumName, name, node, null);
}
};
TSEnumNameDefinition.TSEnumNameDefinition = TSEnumNameDefinition$1;
return TSEnumNameDefinition;
}
var TSModuleNameDefinition = {};
var hasRequiredTSModuleNameDefinition;
function requireTSModuleNameDefinition() {
if (hasRequiredTSModuleNameDefinition) return TSModuleNameDefinition;
hasRequiredTSModuleNameDefinition = 1;
_Object$defineProperty(TSModuleNameDefinition, "__esModule", {
value: true
});
TSModuleNameDefinition.TSModuleNameDefinition = undefined;
const DefinitionBase_1 = requireDefinitionBase();
const DefinitionType_1 = requireDefinitionType();
let TSModuleNameDefinition$1 = class TSModuleNameDefinition extends DefinitionBase_1.DefinitionBase {
isTypeDefinition = true;
isVariableDefinition = true;
constructor(name, node) {
super(DefinitionType_1.DefinitionType.TSModuleName, name, node, null);
}
};
TSModuleNameDefinition.TSModuleNameDefinition = TSModuleNameDefinition$1;
return TSModuleNameDefinition;
}
var TypeDefinition = {};
var hasRequiredTypeDefinition;
function requireTypeDefinition() {
if (hasRequiredTypeDefinition) return TypeDefinition;
hasRequiredTypeDefinition = 1;
_Object$defineProperty(TypeDefinition, "__esModule", {
value: true
});
TypeDefinition.TypeDefinition = undefined;
const DefinitionBase_1 = requireDefinitionBase();
const DefinitionType_1 = requireDefinitionType();
let TypeDefinition$1 = class TypeDefinition extends DefinitionBase_1.DefinitionBase {
isTypeDefinition = true;
isVariableDefinition = false;
constructor(name, node) {
super(DefinitionType_1.DefinitionType.Type, name, node, null);
}
};
TypeDefinition.TypeDefinition = TypeDefinition$1;
return TypeDefinition;
}
var VariableDefinition = {};
var hasRequiredVariableDefinition;
function requireVariableDefinition() {
if (hasRequiredVariableDefinition) return VariableDefinition;
hasRequiredVariableDefinition = 1;
_Object$defineProperty(VariableDefinition, "__esModule", {
value: true
});
VariableDefinition.VariableDefinition = undefined;
const DefinitionBase_1 = requireDefinitionBase();
const DefinitionType_1 = requireDefinitionType();
let VariableDefinition$1 = class VariableDefinition extends DefinitionBase_1.DefinitionBase {
isTypeDefinition = false;
isVariableDefinition = true;
constructor(name, node, decl) {
super(DefinitionType_1.DefinitionType.Variable, name, node, decl);
}
};
VariableDefinition.VariableDefinition = VariableDefinition$1;
return VariableDefinition;
}
var hasRequiredDefinition;
function requireDefinition() {
if (hasRequiredDefinition) return definition;
hasRequiredDefinition = 1;
(function (exports) {
var __createBinding = definition.__createBinding || (_Object$create ? function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = _Object$getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = {
enumerable: true,
get: function () {
return m[k];
}
};
}
_Object$defineProperty(o, k2, desc);
} : function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
var __exportStar = definition.__exportStar || function (m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
_Object$defineProperty(exports, "__esModule", {
value: true
});
__exportStar(requireCatchClauseDefinition(), exports);
__exportStar(requireClassNameDefinition(), exports);
__exportStar(requireDefinition$1(), exports);
__exportStar(requireDefinitionType(), exports);
__exportStar(requireFunctionNameDefinition(), exports);
__exportStar(requireImplicitGlobalVariableDefinition(), exports);
__exportStar(requireImportBindingDefinition(), exports);
__exportStar(requireParameterDefinition(), exports);
__exportStar(requireTSEnumMemberDefinition(), exports);
__exportStar(requireTSEnumNameDefinition(), exports);
__exportStar(requireTSModuleNameDefinition(), exports);
__exportStar(requireTypeDefinition(), exports);
__exportStar(requireVariableDefinition(), exports);
})(definition);
return definition;
}
var lib$1 = {};
var decorators = {};
var baseConfig = {};
var hasRequiredBaseConfig;
function requireBaseConfig() {
if (hasRequiredBaseConfig) return baseConfig;
hasRequiredBaseConfig = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(baseConfig, "__esModule", {
value: true
});
baseConfig.TYPE_VALUE = baseConfig.VALUE = baseConfig.TYPE = undefined;
baseConfig.TYPE = _Object$freeze({
eslintImplicitGlobalSetting: 'readonly',
isTypeVariable: true,
isValueVariable: false
});
baseConfig.VALUE = _Object$freeze({
eslintImplicitGlobalSetting: 'readonly',
isTypeVariable: false,
isValueVariable: true
});
baseConfig.TYPE_VALUE = _Object$freeze({
eslintImplicitGlobalSetting: 'readonly',
isTypeVariable: true,
isValueVariable: true
});
return baseConfig;
}
var hasRequiredDecorators;
function requireDecorators() {
if (hasRequiredDecorators) return decorators;
hasRequiredDecorators = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(decorators, "__esModule", {
value: true
});
decorators.decorators = undefined;
const base_config_1 = requireBaseConfig();
decorators.decorators = {
ClassAccessorDecoratorContext: base_config_1.TYPE,
ClassAccessorDecoratorResult: base_config_1.TYPE,
ClassAccessorDecoratorTarget: base_config_1.TYPE,
ClassDecoratorContext: base_config_1.TYPE,
ClassFieldDecoratorContext: base_config_1.TYPE,
ClassGetterDecoratorContext: base_config_1.TYPE,
ClassMemberDecoratorContext: base_config_1.TYPE,
ClassMethodDecoratorContext: base_config_1.TYPE,
ClassSetterDecoratorContext: base_config_1.TYPE,
DecoratorContext: base_config_1.TYPE,
DecoratorMetadata: base_config_1.TYPE,
DecoratorMetadataObject: base_config_1.TYPE
};
return decorators;
}
var decorators_legacy = {};
var hasRequiredDecorators_legacy;
function requireDecorators_legacy() {
if (hasRequiredDecorators_legacy) return decorators_legacy;
hasRequiredDecorators_legacy = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(decorators_legacy, "__esModule", {
value: true
});
decorators_legacy.decorators_legacy = undefined;
const base_config_1 = requireBaseConfig();
decorators_legacy.decorators_legacy = {
ClassDecorator: base_config_1.TYPE,
MethodDecorator: base_config_1.TYPE,
ParameterDecorator: base_config_1.TYPE,
PropertyDecorator: base_config_1.TYPE
};
return decorators_legacy;
}
var dom = {};
var hasRequiredDom;
function requireDom() {
if (hasRequiredDom) return dom;
hasRequiredDom = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(dom, "__esModule", {
value: true
});
dom.dom = undefined;
const base_config_1 = requireBaseConfig();
dom.dom = {
AbortController: base_config_1.TYPE_VALUE,
AbortSignal: base_config_1.TYPE_VALUE,
AbortSignalEventMap: base_config_1.TYPE,
AbstractRange: base_config_1.TYPE_VALUE,
AbstractWorker: base_config_1.TYPE,
AbstractWorkerEventMap: base_config_1.TYPE,
AddEventListenerOptions: base_config_1.TYPE,
AesCbcParams: base_config_1.TYPE,
AesCtrParams: base_config_1.TYPE,
AesDerivedKeyParams: base_config_1.TYPE,
AesGcmParams: base_config_1.TYPE,
AesKeyAlgorithm: base_config_1.TYPE,
AesKeyGenParams: base_config_1.TYPE,
Algorithm: base_config_1.TYPE,
AlgorithmIdentifier: base_config_1.TYPE,
AlignSetting: base_config_1.TYPE,
AllowSharedBufferSource: base_config_1.TYPE,
AlphaOption: base_config_1.TYPE,
AnalyserNode: base_config_1.TYPE_VALUE,
AnalyserOptions: base_config_1.TYPE,
ANGLE_instanced_arrays: base_config_1.TYPE,
Animatable: base_config_1.TYPE,
Animation: base_config_1.TYPE_VALUE,
AnimationEffect: base_config_1.TYPE_VALUE,
AnimationEvent: base_config_1.TYPE_VALUE,
AnimationEventInit: base_config_1.TYPE,
AnimationEventMap: base_config_1.TYPE,
AnimationFrameProvider: base_config_1.TYPE,
AnimationPlaybackEvent: base_config_1.TYPE_VALUE,
AnimationPlaybackEventInit: base_config_1.TYPE,
AnimationPlayState: base_config_1.TYPE,
AnimationReplaceState: base_config_1.TYPE,
AnimationTimeline: base_config_1.TYPE_VALUE,
AppendMode: base_config_1.TYPE,
ARIAMixin: base_config_1.TYPE,
AssignedNodesOptions: base_config_1.TYPE,
AttestationConveyancePreference: base_config_1.TYPE,
Attr: base_config_1.TYPE_VALUE,
AudioBuffer: base_config_1.TYPE_VALUE,
AudioBufferOptions: base_config_1.TYPE,
AudioBufferSourceNode: base_config_1.TYPE_VALUE,
AudioBufferSourceOptions: base_config_1.TYPE,
AudioConfiguration: base_config_1.TYPE,
AudioContext: base_config_1.TYPE_VALUE,
AudioContextLatencyCategory: base_config_1.TYPE,
AudioContextOptions: base_config_1.TYPE,
AudioContextState: base_config_1.TYPE,
AudioDestinationNode: base_config_1.TYPE_VALUE,
AudioListener: base_config_1.TYPE_VALUE,
AudioNode: base_config_1.TYPE_VALUE,
AudioNodeOptions: base_config_1.TYPE,
AudioParam: base_config_1.TYPE_VALUE,
AudioParamMap: base_config_1.TYPE_VALUE,
AudioProcessingEvent: base_config_1.TYPE_VALUE,
AudioProcessingEventInit: base_config_1.TYPE,
AudioScheduledSourceNode: base_config_1.TYPE_VALUE,
AudioScheduledSourceNodeEventMap: base_config_1.TYPE,
AudioTimestamp: base_config_1.TYPE,
AudioWorklet: base_config_1.TYPE_VALUE,
AudioWorkletNode: base_config_1.TYPE_VALUE,
AudioWorkletNodeEventMap: base_config_1.TYPE,
AudioWorkletNodeOptions: base_config_1.TYPE,
AuthenticationExtensionsClientInputs: base_config_1.TYPE,
AuthenticationExtensionsClientOutputs: base_config_1.TYPE,
AuthenticatorAssertionResponse: base_config_1.TYPE_VALUE,
AuthenticatorAttachment: base_config_1.TYPE,
AuthenticatorAttestationResponse: base_config_1.TYPE_VALUE,
AuthenticatorResponse: base_config_1.TYPE_VALUE,
AuthenticatorSelectionCriteria: base_config_1.TYPE,
AuthenticatorTransport: base_config_1.TYPE,
AutoFill: base_config_1.TYPE,
AutoFillAddressKind: base_config_1.TYPE,
AutoFillBase: base_config_1.TYPE,
AutoFillContactField: base_config_1.TYPE,
AutoFillContactKind: base_config_1.TYPE,
AutoFillCredentialField: base_config_1.TYPE,
AutoFillField: base_config_1.TYPE,
AutoFillNormalField: base_config_1.TYPE,
AutoFillSection: base_config_1.TYPE,
AutoKeyword: base_config_1.TYPE,
AutomationRate: base_config_1.TYPE,
AvcBitstreamFormat: base_config_1.TYPE,
AvcEncoderConfig: base_config_1.TYPE,
BarProp: base_config_1.TYPE_VALUE,
BaseAudioContext: base_config_1.TYPE_VALUE,
BaseAudioContextEventMap: base_config_1.TYPE,
BeforeUnloadEvent: base_config_1.TYPE_VALUE,
BigInteger: base_config_1.TYPE,
BinaryData: base_config_1.TYPE,
BinaryType: base_config_1.TYPE,
BiquadFilterNode: base_config_1.TYPE_VALUE,
BiquadFilterOptions: base_config_1.TYPE,
BiquadFilterType: base_config_1.TYPE,
Blob: base_config_1.TYPE_VALUE,
BlobCallback: base_config_1.TYPE,
BlobEvent: base_config_1.TYPE_VALUE,
BlobEventInit: base_config_1.TYPE,
BlobPart: base_config_1.TYPE,
BlobPropertyBag: base_config_1.TYPE,
Body: base_config_1.TYPE,
BodyInit: base_config_1.TYPE,
BroadcastChannel: base_config_1.TYPE_VALUE,
BroadcastChannelEventMap: base_config_1.TYPE,
BufferSource: base_config_1.TYPE,
ByteLengthQueuingStrategy: base_config_1.TYPE_VALUE,
Cache: base_config_1.TYPE_VALUE,
CacheQueryOptions: base_config_1.TYPE,
CacheStorage: base_config_1.TYPE_VALUE,
CanPlayTypeResult: base_config_1.TYPE,
CanvasCaptureMediaStreamTrack: base_config_1.TYPE_VALUE,
CanvasCompositing: base_config_1.TYPE,
CanvasDirection: base_config_1.TYPE,
CanvasDrawImage: base_config_1.TYPE,
CanvasDrawPath: base_config_1.TYPE,
CanvasFillRule: base_config_1.TYPE,
CanvasFillStrokeStyles: base_config_1.TYPE,
CanvasFilters: base_config_1.TYPE,
CanvasFontKerning: base_config_1.TYPE,
CanvasFontStretch: base_config_1.TYPE,
CanvasFontVariantCaps: base_config_1.TYPE,
CanvasGradient: base_config_1.TYPE_VALUE,
CanvasImageData: base_config_1.TYPE,
CanvasImageSmoothing: base_config_1.TYPE,
CanvasImageSource: base_config_1.TYPE,
CanvasLineCap: base_config_1.TYPE,
CanvasLineJoin: base_config_1.TYPE,
CanvasPath: base_config_1.TYPE,
CanvasPathDrawingStyles: base_config_1.TYPE,
CanvasPattern: base_config_1.TYPE_VALUE,
CanvasRect: base_config_1.TYPE,
CanvasRenderingContext2D: base_config_1.TYPE_VALUE,
CanvasRenderingContext2DSettings: base_config_1.TYPE,
CanvasShadowStyles: base_config_1.TYPE,
CanvasState: base_config_1.TYPE,
CanvasText: base_config_1.TYPE,
CanvasTextAlign: base_config_1.TYPE,
CanvasTextBaseline: base_config_1.TYPE,
CanvasTextDrawingStyles: base_config_1.TYPE,
CanvasTextRendering: base_config_1.TYPE,
CanvasTransform: base_config_1.TYPE,
CanvasUserInterface: base_config_1.TYPE,
CDATASection: base_config_1.TYPE_VALUE,
ChannelCountMode: base_config_1.TYPE,
ChannelInterpretation: base_config_1.TYPE,
ChannelMergerNode: base_config_1.TYPE_VALUE,
ChannelMergerOptions: base_config_1.TYPE,
ChannelSplitterNode: base_config_1.TYPE_VALUE,
ChannelSplitterOptions: base_config_1.TYPE,
CharacterData: base_config_1.TYPE_VALUE,
CheckVisibilityOptions: base_config_1.TYPE,
ChildNode: base_config_1.TYPE,
ClientQueryOptions: base_config_1.TYPE,
ClientRect: base_config_1.TYPE,
ClientTypes: base_config_1.TYPE,
Clipboard: base_config_1.TYPE_VALUE,
ClipboardEvent: base_config_1.TYPE_VALUE,
ClipboardEventInit: base_config_1.TYPE,
ClipboardItem: base_config_1.TYPE_VALUE,
ClipboardItemData: base_config_1.TYPE,
ClipboardItemOptions: base_config_1.TYPE,
ClipboardItems: base_config_1.TYPE,
CloseEvent: base_config_1.TYPE_VALUE,
CloseEventInit: base_config_1.TYPE,
CodecState: base_config_1.TYPE,
ColorGamut: base_config_1.TYPE,
ColorSpaceConversion: base_config_1.TYPE,
Comment: base_config_1.TYPE_VALUE,
CompositeOperation: base_config_1.TYPE,
CompositeOperationOrAuto: base_config_1.TYPE,
CompositionEvent: base_config_1.TYPE_VALUE,
CompositionEventInit: base_config_1.TYPE,
CompressionFormat: base_config_1.TYPE,
CompressionStream: base_config_1.TYPE_VALUE,
ComputedEffectTiming: base_config_1.TYPE,
ComputedKeyframe: base_config_1.TYPE,
Console: base_config_1.TYPE,
ConstantSourceNode: base_config_1.TYPE_VALUE,
ConstantSourceOptions: base_config_1.TYPE,
ConstrainBoolean: base_config_1.TYPE,
ConstrainBooleanParameters: base_config_1.TYPE,
ConstrainDOMString: base_config_1.TYPE,
ConstrainDOMStringParameters: base_config_1.TYPE,
ConstrainDouble: base_config_1.TYPE,
ConstrainDoubleRange: base_config_1.TYPE,
ConstrainULong: base_config_1.TYPE,
ConstrainULongRange: base_config_1.TYPE,
ContentVisibilityAutoStateChangeEvent: base_config_1.TYPE_VALUE,
ContentVisibilityAutoStateChangeEventInit: base_config_1.TYPE,
ConvolverNode: base_config_1.TYPE_VALUE,
ConvolverOptions: base_config_1.TYPE,
COSEAlgorithmIdentifier: base_config_1.TYPE,
CountQueuingStrategy: base_config_1.TYPE_VALUE,
Credential: base_config_1.TYPE_VALUE,
CredentialCreationOptions: base_config_1.TYPE,
CredentialMediationRequirement: base_config_1.TYPE,
CredentialPropertiesOutput: base_config_1.TYPE,
CredentialRequestOptions: base_config_1.TYPE,
CredentialsContainer: base_config_1.TYPE_VALUE,
Crypto: base_config_1.TYPE_VALUE,
CryptoKey: base_config_1.TYPE_VALUE,
CryptoKeyPair: base_config_1.TYPE,
CSS: base_config_1.TYPE_VALUE,
CSSAnimation: base_config_1.TYPE_VALUE,
CSSConditionRule: base_config_1.TYPE_VALUE,
CSSContainerRule: base_config_1.TYPE_VALUE,
CSSCounterStyleRule: base_config_1.TYPE_VALUE,
CSSFontFaceRule: base_config_1.TYPE_VALUE,
CSSFontFeatureValuesRule: base_config_1.TYPE_VALUE,
CSSFontPaletteValuesRule: base_config_1.TYPE_VALUE,
CSSGroupingRule: base_config_1.TYPE_VALUE,
CSSImageValue: base_config_1.TYPE_VALUE,
CSSImportRule: base_config_1.TYPE_VALUE,
CSSKeyframeRule: base_config_1.TYPE_VALUE,
CSSKeyframesRule: base_config_1.TYPE_VALUE,
CSSKeywordish: base_config_1.TYPE,
CSSKeywordValue: base_config_1.TYPE_VALUE,
CSSLayerBlockRule: base_config_1.TYPE_VALUE,
CSSLayerStatementRule: base_config_1.TYPE_VALUE,
CSSMathClamp: base_config_1.TYPE_VALUE,
CSSMathInvert: base_config_1.TYPE_VALUE,
CSSMathMax: base_config_1.TYPE_VALUE,
CSSMathMin: base_config_1.TYPE_VALUE,
CSSMathNegate: base_config_1.TYPE_VALUE,
CSSMathOperator: base_config_1.TYPE,
CSSMathProduct: base_config_1.TYPE_VALUE,
CSSMathSum: base_config_1.TYPE_VALUE,
CSSMathValue: base_config_1.TYPE_VALUE,
CSSMatrixComponent: base_config_1.TYPE_VALUE,
CSSMatrixComponentOptions: base_config_1.TYPE,
CSSMediaRule: base_config_1.TYPE_VALUE,
CSSNamespaceRule: base_config_1.TYPE_VALUE,
CSSNumberish: base_config_1.TYPE,
CSSNumericArray: base_config_1.TYPE_VALUE,
CSSNumericBaseType: base_config_1.TYPE,
CSSNumericType: base_config_1.TYPE,
CSSNumericValue: base_config_1.TYPE_VALUE,
CSSPageRule: base_config_1.TYPE_VALUE,
CSSPerspective: base_config_1.TYPE_VALUE,
CSSPerspectiveValue: base_config_1.TYPE,
CSSPropertyRule: base_config_1.TYPE_VALUE,
CSSRotate: base_config_1.TYPE_VALUE,
CSSRule: base_config_1.TYPE_VALUE,
CSSRuleList: base_config_1.TYPE_VALUE,
CSSScale: base_config_1.TYPE_VALUE,
CSSScopeRule: base_config_1.TYPE_VALUE,
CSSSkew: base_config_1.TYPE_VALUE,
CSSSkewX: base_config_1.TYPE_VALUE,
CSSSkewY: base_config_1.TYPE_VALUE,
CSSStartingStyleRule: base_config_1.TYPE_VALUE,
CSSStyleDeclaration: base_config_1.TYPE_VALUE,
CSSStyleRule: base_config_1.TYPE_VALUE,
CSSStyleSheet: base_config_1.TYPE_VALUE,
CSSStyleSheetInit: base_config_1.TYPE,
CSSStyleValue: base_config_1.TYPE_VALUE,
CSSSupportsRule: base_config_1.TYPE_VALUE,
CSSTransformComponent: base_config_1.TYPE_VALUE,
CSSTransformValue: base_config_1.TYPE_VALUE,
CSSTransition: base_config_1.TYPE_VALUE,
CSSTranslate: base_config_1.TYPE_VALUE,
CSSUnitValue: base_config_1.TYPE_VALUE,
CSSUnparsedSegment: base_config_1.TYPE,
CSSUnparsedValue: base_config_1.TYPE_VALUE,
CSSVariableReferenceValue: base_config_1.TYPE_VALUE,
CustomElementConstructor: base_config_1.TYPE,
CustomElementRegistry: base_config_1.TYPE_VALUE,
CustomEvent: base_config_1.TYPE_VALUE,
CustomEventInit: base_config_1.TYPE,
CustomStateSet: base_config_1.TYPE_VALUE,
DataTransfer: base_config_1.TYPE_VALUE,
DataTransferItem: base_config_1.TYPE_VALUE,
DataTransferItemList: base_config_1.TYPE_VALUE,
DecodeErrorCallback: base_config_1.TYPE,
DecodeSuccessCallback: base_config_1.TYPE,
DecompressionStream: base_config_1.TYPE_VALUE,
DelayNode: base_config_1.TYPE_VALUE,
DelayOptions: base_config_1.TYPE,
DeviceMotionEvent: base_config_1.TYPE_VALUE,
DeviceMotionEventAcceleration: base_config_1.TYPE,
DeviceMotionEventAccelerationInit: base_config_1.TYPE,
DeviceMotionEventInit: base_config_1.TYPE,
DeviceMotionEventRotationRate: base_config_1.TYPE,
DeviceMotionEventRotationRateInit: base_config_1.TYPE,
DeviceOrientationEvent: base_config_1.TYPE_VALUE,
DeviceOrientationEventInit: base_config_1.TYPE,
DirectionSetting: base_config_1.TYPE,
DisplayCaptureSurfaceType: base_config_1.TYPE,
DisplayMediaStreamOptions: base_config_1.TYPE,
DistanceModelType: base_config_1.TYPE,
Document: base_config_1.TYPE_VALUE,
DocumentEventMap: base_config_1.TYPE,
DocumentFragment: base_config_1.TYPE_VALUE,
DocumentOrShadowRoot: base_config_1.TYPE,
DocumentReadyState: base_config_1.TYPE,
DocumentTimeline: base_config_1.TYPE_VALUE,
DocumentTimelineOptions: base_config_1.TYPE,
DocumentType: base_config_1.TYPE_VALUE,
DocumentVisibilityState: base_config_1.TYPE,
DOMException: base_config_1.TYPE_VALUE,
DOMHighResTimeStamp: base_config_1.TYPE,
DOMImplementation: base_config_1.TYPE_VALUE,
DOMMatrix: base_config_1.TYPE_VALUE,
DOMMatrix2DInit: base_config_1.TYPE,
DOMMatrixInit: base_config_1.TYPE,
DOMMatrixReadOnly: base_config_1.TYPE_VALUE,
DOMParser: base_config_1.TYPE_VALUE,
DOMParserSupportedType: base_config_1.TYPE,
DOMPoint: base_config_1.TYPE_VALUE,
DOMPointInit: base_config_1.TYPE,
DOMPointReadOnly: base_config_1.TYPE_VALUE,
DOMQuad: base_config_1.TYPE_VALUE,
DOMQuadInit: base_config_1.TYPE,
DOMRect: base_config_1.TYPE_VALUE,
DOMRectInit: base_config_1.TYPE,
DOMRectList: base_config_1.TYPE_VALUE,
DOMRectReadOnly: base_config_1.TYPE_VALUE,
DOMStringList: base_config_1.TYPE_VALUE,
DOMStringMap: base_config_1.TYPE_VALUE,
DOMTokenList: base_config_1.TYPE_VALUE,
DoubleRange: base_config_1.TYPE,
DragEvent: base_config_1.TYPE_VALUE,
DragEventInit: base_config_1.TYPE,
DynamicsCompressorNode: base_config_1.TYPE_VALUE,
DynamicsCompressorOptions: base_config_1.TYPE,
EcdhKeyDeriveParams: base_config_1.TYPE,
EcdsaParams: base_config_1.TYPE,
EcKeyAlgorithm: base_config_1.TYPE,
EcKeyGenParams: base_config_1.TYPE,
EcKeyImportParams: base_config_1.TYPE,
EffectTiming: base_config_1.TYPE,
Element: base_config_1.TYPE_VALUE,
ElementContentEditable: base_config_1.TYPE,
ElementCreationOptions: base_config_1.TYPE,
ElementCSSInlineStyle: base_config_1.TYPE,
ElementDefinitionOptions: base_config_1.TYPE,
ElementEventMap: base_config_1.TYPE,
ElementInternals: base_config_1.TYPE_VALUE,
ElementTagNameMap: base_config_1.TYPE,
EncodedVideoChunk: base_config_1.TYPE_VALUE,
EncodedVideoChunkInit: base_config_1.TYPE,
EncodedVideoChunkMetadata: base_config_1.TYPE,
EncodedVideoChunkOutputCallback: base_config_1.TYPE,
EncodedVideoChunkType: base_config_1.TYPE,
EndingType: base_config_1.TYPE,
EndOfStreamError: base_config_1.TYPE,
EpochTimeStamp: base_config_1.TYPE,
ErrorCallback: base_config_1.TYPE,
ErrorEvent: base_config_1.TYPE_VALUE,
ErrorEventInit: base_config_1.TYPE,
Event: base_config_1.TYPE_VALUE,
EventCounts: base_config_1.TYPE_VALUE,
EventInit: base_config_1.TYPE,
EventListener: base_config_1.TYPE,
EventListenerObject: base_config_1.TYPE,
EventListenerOptions: base_config_1.TYPE,
EventListenerOrEventListenerObject: base_config_1.TYPE,
EventModifierInit: base_config_1.TYPE,
EventSource: base_config_1.TYPE_VALUE,
EventSourceEventMap: base_config_1.TYPE,
EventSourceInit: base_config_1.TYPE,
EventTarget: base_config_1.TYPE_VALUE,
EXT_blend_minmax: base_config_1.TYPE,
EXT_color_buffer_float: base_config_1.TYPE,
EXT_color_buffer_half_float: base_config_1.TYPE,
EXT_float_blend: base_config_1.TYPE,
EXT_frag_depth: base_config_1.TYPE,
EXT_shader_texture_lod: base_config_1.TYPE,
EXT_sRGB: base_config_1.TYPE,
EXT_texture_compression_bptc: base_config_1.TYPE,
EXT_texture_compression_rgtc: base_config_1.TYPE,
EXT_texture_filter_anisotropic: base_config_1.TYPE,
EXT_texture_norm16: base_config_1.TYPE,
External: base_config_1.TYPE_VALUE,
File: base_config_1.TYPE_VALUE,
FileCallback: base_config_1.TYPE,
FileList: base_config_1.TYPE_VALUE,
FilePropertyBag: base_config_1.TYPE,
FileReader: base_config_1.TYPE_VALUE,
FileReaderEventMap: base_config_1.TYPE,
FileSystem: base_config_1.TYPE_VALUE,
FileSystemCreateWritableOptions: base_config_1.TYPE,
FileSystemDirectoryEntry: base_config_1.TYPE_VALUE,
FileSystemDirectoryHandle: base_config_1.TYPE_VALUE,
FileSystemDirectoryReader: base_config_1.TYPE_VALUE,
FileSystemEntriesCallback: base_config_1.TYPE,
FileSystemEntry: base_config_1.TYPE_VALUE,
FileSystemEntryCallback: base_config_1.TYPE,
FileSystemFileEntry: base_config_1.TYPE_VALUE,
FileSystemFileHandle: base_config_1.TYPE_VALUE,
FileSystemFlags: base_config_1.TYPE,
FileSystemGetDirectoryOptions: base_config_1.TYPE,
FileSystemGetFileOptions: base_config_1.TYPE,
FileSystemHandle: base_config_1.TYPE_VALUE,
FileSystemHandleKind: base_config_1.TYPE,
FileSystemRemoveOptions: base_config_1.TYPE,
FileSystemWritableFileStream: base_config_1.TYPE_VALUE,
FileSystemWriteChunkType: base_config_1.TYPE,
FillMode: base_config_1.TYPE,
Float32List: base_config_1.TYPE,
FocusEvent: base_config_1.TYPE_VALUE,
FocusEventInit: base_config_1.TYPE,
FocusOptions: base_config_1.TYPE,
FontDisplay: base_config_1.TYPE,
FontFace: base_config_1.TYPE_VALUE,
FontFaceDescriptors: base_config_1.TYPE,
FontFaceLoadStatus: base_config_1.TYPE,
FontFaceSet: base_config_1.TYPE_VALUE,
FontFaceSetEventMap: base_config_1.TYPE,
FontFaceSetLoadEvent: base_config_1.TYPE_VALUE,
FontFaceSetLoadEventInit: base_config_1.TYPE,
FontFaceSetLoadStatus: base_config_1.TYPE,
FontFaceSource: base_config_1.TYPE,
FormData: base_config_1.TYPE_VALUE,
FormDataEntryValue: base_config_1.TYPE,
FormDataEvent: base_config_1.TYPE_VALUE,
FormDataEventInit: base_config_1.TYPE,
FrameRequestCallback: base_config_1.TYPE,
FullscreenNavigationUI: base_config_1.TYPE,
FullscreenOptions: base_config_1.TYPE,
FunctionStringCallback: base_config_1.TYPE,
GainNode: base_config_1.TYPE_VALUE,
GainOptions: base_config_1.TYPE,
Gamepad: base_config_1.TYPE_VALUE,
GamepadButton: base_config_1.TYPE_VALUE,
GamepadEffectParameters: base_config_1.TYPE,
GamepadEvent: base_config_1.TYPE_VALUE,
GamepadEventInit: base_config_1.TYPE,
GamepadHapticActuator: base_config_1.TYPE_VALUE,
GamepadHapticEffectType: base_config_1.TYPE,
GamepadHapticsResult: base_config_1.TYPE,
GamepadMappingType: base_config_1.TYPE,
GenericTransformStream: base_config_1.TYPE,
Geolocation: base_config_1.TYPE_VALUE,
GeolocationCoordinates: base_config_1.TYPE_VALUE,
GeolocationPosition: base_config_1.TYPE_VALUE,
GeolocationPositionError: base_config_1.TYPE_VALUE,
GetAnimationsOptions: base_config_1.TYPE,
GetHTMLOptions: base_config_1.TYPE,
GetNotificationOptions: base_config_1.TYPE,
GetRootNodeOptions: base_config_1.TYPE,
GLbitfield: base_config_1.TYPE,
GLboolean: base_config_1.TYPE,
GLclampf: base_config_1.TYPE,
GLenum: base_config_1.TYPE,
GLfloat: base_config_1.TYPE,
GLint: base_config_1.TYPE,
GLint64: base_config_1.TYPE,
GLintptr: base_config_1.TYPE,
GlobalCompositeOperation: base_config_1.TYPE,
GlobalEventHandlers: base_config_1.TYPE,
GlobalEventHandlersEventMap: base_config_1.TYPE,
GLsizei: base_config_1.TYPE,
GLsizeiptr: base_config_1.TYPE,
GLuint: base_config_1.TYPE,
GLuint64: base_config_1.TYPE,
HardwareAcceleration: base_config_1.TYPE,
HashAlgorithmIdentifier: base_config_1.TYPE,
HashChangeEvent: base_config_1.TYPE_VALUE,
HashChangeEventInit: base_config_1.TYPE,
HdrMetadataType: base_config_1.TYPE,
Headers: base_config_1.TYPE_VALUE,
HeadersInit: base_config_1.TYPE,
Highlight: base_config_1.TYPE_VALUE,
HighlightRegistry: base_config_1.TYPE_VALUE,
HighlightType: base_config_1.TYPE,
History: base_config_1.TYPE_VALUE,
HkdfParams: base_config_1.TYPE,
HmacImportParams: base_config_1.TYPE,
HmacKeyAlgorithm: base_config_1.TYPE,
HmacKeyGenParams: base_config_1.TYPE,
HTMLAllCollection: base_config_1.TYPE_VALUE,
HTMLAnchorElement: base_config_1.TYPE_VALUE,
HTMLAreaElement: base_config_1.TYPE_VALUE,
HTMLAudioElement: base_config_1.TYPE_VALUE,
HTMLBaseElement: base_config_1.TYPE_VALUE,
HTMLBodyElement: base_config_1.TYPE_VALUE,
HTMLBodyElementEventMap: base_config_1.TYPE,
HTMLBRElement: base_config_1.TYPE_VALUE,
HTMLButtonElement: base_config_1.TYPE_VALUE,
HTMLCanvasElement: base_config_1.TYPE_VALUE,
HTMLCollection: base_config_1.TYPE_VALUE,
HTMLCollectionBase: base_config_1.TYPE,
HTMLCollectionOf: base_config_1.TYPE,
HTMLDataElement: base_config_1.TYPE_VALUE,
HTMLDataListElement: base_config_1.TYPE_VALUE,
HTMLDetailsElement: base_config_1.TYPE_VALUE,
HTMLDialogElement: base_config_1.TYPE_VALUE,
HTMLDirectoryElement: base_config_1.TYPE_VALUE,
HTMLDivElement: base_config_1.TYPE_VALUE,
HTMLDListElement: base_config_1.TYPE_VALUE,
HTMLDocument: base_config_1.TYPE_VALUE,
HTMLElement: base_config_1.TYPE_VALUE,
HTMLElementDeprecatedTagNameMap: base_config_1.TYPE,
HTMLElementEventMap: base_config_1.TYPE,
HTMLElementTagNameMap: base_config_1.TYPE,
HTMLEmbedElement: base_config_1.TYPE_VALUE,
HTMLFieldSetElement: base_config_1.TYPE_VALUE,
HTMLFontElement: base_config_1.TYPE_VALUE,
HTMLFormControlsCollection: base_config_1.TYPE_VALUE,
HTMLFormElement: base_config_1.TYPE_VALUE,
HTMLFrameElement: base_config_1.TYPE_VALUE,
HTMLFrameSetElement: base_config_1.TYPE_VALUE,
HTMLFrameSetElementEventMap: base_config_1.TYPE,
HTMLHeadElement: base_config_1.TYPE_VALUE,
HTMLHeadingElement: base_config_1.TYPE_VALUE,
HTMLHRElement: base_config_1.TYPE_VALUE,
HTMLHtmlElement: base_config_1.TYPE_VALUE,
HTMLHyperlinkElementUtils: base_config_1.TYPE,
HTMLIFrameElement: base_config_1.TYPE_VALUE,
HTMLImageElement: base_config_1.TYPE_VALUE,
HTMLInputElement: base_config_1.TYPE_VALUE,
HTMLLabelElement: base_config_1.TYPE_VALUE,
HTMLLegendElement: base_config_1.TYPE_VALUE,
HTMLLIElement: base_config_1.TYPE_VALUE,
HTMLLinkElement: base_config_1.TYPE_VALUE,
HTMLMapElement: base_config_1.TYPE_VALUE,
HTMLMarqueeElement: base_config_1.TYPE_VALUE,
HTMLMediaElement: base_config_1.TYPE_VALUE,
HTMLMediaElementEventMap: base_config_1.TYPE,
HTMLMenuElement: base_config_1.TYPE_VALUE,
HTMLMetaElement: base_config_1.TYPE_VALUE,
HTMLMeterElement: base_config_1.TYPE_VALUE,
HTMLModElement: base_config_1.TYPE_VALUE,
HTMLObjectElement: base_config_1.TYPE_VALUE,
HTMLOListElement: base_config_1.TYPE_VALUE,
HTMLOptGroupElement: base_config_1.TYPE_VALUE,
HTMLOptionElement: base_config_1.TYPE_VALUE,
HTMLOptionsCollection: base_config_1.TYPE_VALUE,
HTMLOrSVGElement: base_config_1.TYPE,
HTMLOrSVGImageElement: base_config_1.TYPE,
HTMLOrSVGScriptElement: base_config_1.TYPE,
HTMLOutputElement: base_config_1.TYPE_VALUE,
HTMLParagraphElement: base_config_1.TYPE_VALUE,
HTMLParamElement: base_config_1.TYPE_VALUE,
HTMLPictureElement: base_config_1.TYPE_VALUE,
HTMLPreElement: base_config_1.TYPE_VALUE,
HTMLProgressElement: base_config_1.TYPE_VALUE,
HTMLQuoteElement: base_config_1.TYPE_VALUE,
HTMLScriptElement: base_config_1.TYPE_VALUE,
HTMLSelectElement: base_config_1.TYPE_VALUE,
HTMLSlotElement: base_config_1.TYPE_VALUE,
HTMLSourceElement: base_config_1.TYPE_VALUE,
HTMLSpanElement: base_config_1.TYPE_VALUE,
HTMLStyleElement: base_config_1.TYPE_VALUE,
HTMLTableCaptionElement: base_config_1.TYPE_VALUE,
HTMLTableCellElement: base_config_1.TYPE_VALUE,
HTMLTableColElement: base_config_1.TYPE_VALUE,
HTMLTableDataCellElement: base_config_1.TYPE,
HTMLTableElement: base_config_1.TYPE_VALUE,
HTMLTableHeaderCellElement: base_config_1.TYPE,
HTMLTableRowElement: base_config_1.TYPE_VALUE,
HTMLTableSectionElement: base_config_1.TYPE_VALUE,
HTMLTemplateElement: base_config_1.TYPE_VALUE,
HTMLTextAreaElement: base_config_1.TYPE_VALUE,
HTMLTimeElement: base_config_1.TYPE_VALUE,
HTMLTitleElement: base_config_1.TYPE_VALUE,
HTMLTrackElement: base_config_1.TYPE_VALUE,
HTMLUListElement: base_config_1.TYPE_VALUE,
HTMLUnknownElement: base_config_1.TYPE_VALUE,
HTMLVideoElement: base_config_1.TYPE_VALUE,
HTMLVideoElementEventMap: base_config_1.TYPE,
IDBCursor: base_config_1.TYPE_VALUE,
IDBCursorDirection: base_config_1.TYPE,
IDBCursorWithValue: base_config_1.TYPE_VALUE,
IDBDatabase: base_config_1.TYPE_VALUE,
IDBDatabaseEventMap: base_config_1.TYPE,
IDBDatabaseInfo: base_config_1.TYPE,
IDBFactory: base_config_1.TYPE_VALUE,
IDBIndex: base_config_1.TYPE_VALUE,
IDBIndexParameters: base_config_1.TYPE,
IDBKeyRange: base_config_1.TYPE_VALUE,
IDBObjectStore: base_config_1.TYPE_VALUE,
IDBObjectStoreParameters: base_config_1.TYPE,
IDBOpenDBRequest: base_config_1.TYPE_VALUE,
IDBOpenDBRequestEventMap: base_config_1.TYPE,
IDBRequest: base_config_1.TYPE_VALUE,
IDBRequestEventMap: base_config_1.TYPE,
IDBRequestReadyState: base_config_1.TYPE,
IDBTransaction: base_config_1.TYPE_VALUE,
IDBTransactionDurability: base_config_1.TYPE,
IDBTransactionEventMap: base_config_1.TYPE,
IDBTransactionMode: base_config_1.TYPE,
IDBTransactionOptions: base_config_1.TYPE,
IDBValidKey: base_config_1.TYPE,
IDBVersionChangeEvent: base_config_1.TYPE_VALUE,
IDBVersionChangeEventInit: base_config_1.TYPE,
IdleDeadline: base_config_1.TYPE_VALUE,
IdleRequestCallback: base_config_1.TYPE,
IdleRequestOptions: base_config_1.TYPE,
IIRFilterNode: base_config_1.TYPE_VALUE,
IIRFilterOptions: base_config_1.TYPE,
ImageBitmap: base_config_1.TYPE_VALUE,
ImageBitmapOptions: base_config_1.TYPE,
ImageBitmapRenderingContext: base_config_1.TYPE_VALUE,
ImageBitmapRenderingContextSettings: base_config_1.TYPE,
ImageBitmapSource: base_config_1.TYPE,
ImageData: base_config_1.TYPE_VALUE,
ImageDataSettings: base_config_1.TYPE,
ImageEncodeOptions: base_config_1.TYPE,
ImageOrientation: base_config_1.TYPE,
ImageSmoothingQuality: base_config_1.TYPE,
ImportMeta: base_config_1.TYPE,
InputDeviceInfo: base_config_1.TYPE_VALUE,
InputEvent: base_config_1.TYPE_VALUE,
InputEventInit: base_config_1.TYPE,
InsertPosition: base_config_1.TYPE,
Int32List: base_config_1.TYPE,
IntersectionObserver: base_config_1.TYPE_VALUE,
IntersectionObserverCallback: base_config_1.TYPE,
IntersectionObserverEntry: base_config_1.TYPE_VALUE,
IntersectionObserverEntryInit: base_config_1.TYPE,
IntersectionObserverInit: base_config_1.TYPE,
IterationCompositeOperation: base_config_1.TYPE,
JsonWebKey: base_config_1.TYPE,
KeyAlgorithm: base_config_1.TYPE,
KeyboardEvent: base_config_1.TYPE_VALUE,
KeyboardEventInit: base_config_1.TYPE,
KeyFormat: base_config_1.TYPE,
Keyframe: base_config_1.TYPE,
KeyframeAnimationOptions: base_config_1.TYPE,
KeyframeEffect: base_config_1.TYPE_VALUE,
KeyframeEffectOptions: base_config_1.TYPE,
KeyType: base_config_1.TYPE,
KeyUsage: base_config_1.TYPE,
KHR_parallel_shader_compile: base_config_1.TYPE,
LargestContentfulPaint: base_config_1.TYPE_VALUE,
LatencyMode: base_config_1.TYPE,
LineAlignSetting: base_config_1.TYPE,
LineAndPositionSetting: base_config_1.TYPE,
LinkStyle: base_config_1.TYPE,
Location: base_config_1.TYPE_VALUE,
Lock: base_config_1.TYPE_VALUE,
LockGrantedCallback: base_config_1.TYPE,
LockInfo: base_config_1.TYPE,
LockManager: base_config_1.TYPE_VALUE,
LockManagerSnapshot: base_config_1.TYPE,
LockMode: base_config_1.TYPE,
LockOptions: base_config_1.TYPE,
MathMLElement: base_config_1.TYPE_VALUE,
MathMLElementEventMap: base_config_1.TYPE,
MathMLElementTagNameMap: base_config_1.TYPE,
MediaCapabilities: base_config_1.TYPE_VALUE,
MediaCapabilitiesDecodingInfo: base_config_1.TYPE,
MediaCapabilitiesEncodingInfo: base_config_1.TYPE,
MediaCapabilitiesInfo: base_config_1.TYPE,
MediaConfiguration: base_config_1.TYPE,
MediaDecodingConfiguration: base_config_1.TYPE,
MediaDecodingType: base_config_1.TYPE,
MediaDeviceInfo: base_config_1.TYPE_VALUE,
MediaDeviceKind: base_config_1.TYPE,
MediaDevices: base_config_1.TYPE_VALUE,
MediaDevicesEventMap: base_config_1.TYPE,
MediaElementAudioSourceNode: base_config_1.TYPE_VALUE,
MediaElementAudioSourceOptions: base_config_1.TYPE,
MediaEncodingConfiguration: base_config_1.TYPE,
MediaEncodingType: base_config_1.TYPE,
MediaEncryptedEvent: base_config_1.TYPE_VALUE,
MediaEncryptedEventInit: base_config_1.TYPE,
MediaError: base_config_1.TYPE_VALUE,
MediaImage: base_config_1.TYPE,
MediaKeyMessageEvent: base_config_1.TYPE_VALUE,
MediaKeyMessageEventInit: base_config_1.TYPE,
MediaKeyMessageType: base_config_1.TYPE,
MediaKeys: base_config_1.TYPE_VALUE,
MediaKeySession: base_config_1.TYPE_VALUE,
MediaKeySessionClosedReason: base_config_1.TYPE,
MediaKeySessionEventMap: base_config_1.TYPE,
MediaKeySessionType: base_config_1.TYPE,
MediaKeysPolicy: base_config_1.TYPE,
MediaKeysRequirement: base_config_1.TYPE,
MediaKeyStatus: base_config_1.TYPE,
MediaKeyStatusMap: base_config_1.TYPE_VALUE,
MediaKeySystemAccess: base_config_1.TYPE_VALUE,
MediaKeySystemConfiguration: base_config_1.TYPE,
MediaKeySystemMediaCapability: base_config_1.TYPE,
MediaList: base_config_1.TYPE_VALUE,
MediaMetadata: base_config_1.TYPE_VALUE,
MediaMetadataInit: base_config_1.TYPE,
MediaPositionState: base_config_1.TYPE,
MediaProvider: base_config_1.TYPE,
MediaQueryList: base_config_1.TYPE_VALUE,
MediaQueryListEvent: base_config_1.TYPE_VALUE,
MediaQueryListEventInit: base_config_1.TYPE,
MediaQueryListEventMap: base_config_1.TYPE,
MediaRecorder: base_config_1.TYPE_VALUE,
MediaRecorderEventMap: base_config_1.TYPE,
MediaRecorderOptions: base_config_1.TYPE,
MediaSession: base_config_1.TYPE_VALUE,
MediaSessionAction: base_config_1.TYPE,
MediaSessionActionDetails: base_config_1.TYPE,
MediaSessionActionHandler: base_config_1.TYPE,
MediaSessionPlaybackState: base_config_1.TYPE,
MediaSource: base_config_1.TYPE_VALUE,
MediaSourceEventMap: base_config_1.TYPE,
MediaSourceHandle: base_config_1.TYPE_VALUE,
MediaStream: base_config_1.TYPE_VALUE,
MediaStreamAudioDestinationNode: base_config_1.TYPE_VALUE,
MediaStreamAudioSourceNode: base_config_1.TYPE_VALUE,
MediaStreamAudioSourceOptions: base_config_1.TYPE,
MediaStreamConstraints: base_config_1.TYPE,
MediaStreamEventMap: base_config_1.TYPE,
MediaStreamTrack: base_config_1.TYPE_VALUE,
MediaStreamTrackEvent: base_config_1.TYPE_VALUE,
MediaStreamTrackEventInit: base_config_1.TYPE,
MediaStreamTrackEventMap: base_config_1.TYPE,
MediaStreamTrackState: base_config_1.TYPE,
MediaTrackCapabilities: base_config_1.TYPE,
MediaTrackConstraints: base_config_1.TYPE,
MediaTrackConstraintSet: base_config_1.TYPE,
MediaTrackSettings: base_config_1.TYPE,
MediaTrackSupportedConstraints: base_config_1.TYPE,
MessageChannel: base_config_1.TYPE_VALUE,
MessageEvent: base_config_1.TYPE_VALUE,
MessageEventInit: base_config_1.TYPE,
MessageEventSource: base_config_1.TYPE,
MessagePort: base_config_1.TYPE_VALUE,
MessagePortEventMap: base_config_1.TYPE,
MIDIAccess: base_config_1.TYPE_VALUE,
MIDIAccessEventMap: base_config_1.TYPE,
MIDIConnectionEvent: base_config_1.TYPE_VALUE,
MIDIConnectionEventInit: base_config_1.TYPE,
MIDIInput: base_config_1.TYPE_VALUE,
MIDIInputEventMap: base_config_1.TYPE,
MIDIInputMap: base_config_1.TYPE_VALUE,
MIDIMessageEvent: base_config_1.TYPE_VALUE,
MIDIMessageEventInit: base_config_1.TYPE,
MIDIOptions: base_config_1.TYPE,
MIDIOutput: base_config_1.TYPE_VALUE,
MIDIOutputMap: base_config_1.TYPE_VALUE,
MIDIPort: base_config_1.TYPE_VALUE,
MIDIPortConnectionState: base_config_1.TYPE,
MIDIPortDeviceState: base_config_1.TYPE,
MIDIPortEventMap: base_config_1.TYPE,
MIDIPortType: base_config_1.TYPE,
MimeType: base_config_1.TYPE_VALUE,
MimeTypeArray: base_config_1.TYPE_VALUE,
MouseEvent: base_config_1.TYPE_VALUE,
MouseEventInit: base_config_1.TYPE,
MultiCacheQueryOptions: base_config_1.TYPE,
MutationCallback: base_config_1.TYPE,
MutationEvent: base_config_1.TYPE_VALUE,
MutationObserver: base_config_1.TYPE_VALUE,
MutationObserverInit: base_config_1.TYPE,
MutationRecord: base_config_1.TYPE_VALUE,
MutationRecordType: base_config_1.TYPE,
NamedCurve: base_config_1.TYPE,
NamedNodeMap: base_config_1.TYPE_VALUE,
NavigationPreloadManager: base_config_1.TYPE_VALUE,
NavigationPreloadState: base_config_1.TYPE,
NavigationTimingType: base_config_1.TYPE,
Navigator: base_config_1.TYPE_VALUE,
NavigatorAutomationInformation: base_config_1.TYPE,
NavigatorBadge: base_config_1.TYPE,
NavigatorConcurrentHardware: base_config_1.TYPE,
NavigatorContentUtils: base_config_1.TYPE,
NavigatorCookies: base_config_1.TYPE,
NavigatorID: base_config_1.TYPE,
NavigatorLanguage: base_config_1.TYPE,
NavigatorLocks: base_config_1.TYPE,
NavigatorOnLine: base_config_1.TYPE,
NavigatorPlugins: base_config_1.TYPE,
NavigatorStorage: base_config_1.TYPE,
Node: base_config_1.TYPE_VALUE,
NodeFilter: base_config_1.TYPE_VALUE,
NodeIterator: base_config_1.TYPE_VALUE,
NodeList: base_config_1.TYPE_VALUE,
NodeListOf: base_config_1.TYPE,
NonDocumentTypeChildNode: base_config_1.TYPE,
NonElementParentNode: base_config_1.TYPE,
Notification: base_config_1.TYPE_VALUE,
NotificationDirection: base_config_1.TYPE,
NotificationEventMap: base_config_1.TYPE,
NotificationOptions: base_config_1.TYPE,
NotificationPermission: base_config_1.TYPE,
NotificationPermissionCallback: base_config_1.TYPE,
OES_draw_buffers_indexed: base_config_1.TYPE,
OES_element_index_uint: base_config_1.TYPE,
OES_fbo_render_mipmap: base_config_1.TYPE,
OES_standard_derivatives: base_config_1.TYPE,
OES_texture_float: base_config_1.TYPE,
OES_texture_float_linear: base_config_1.TYPE,
OES_texture_half_float: base_config_1.TYPE,
OES_texture_half_float_linear: base_config_1.TYPE,
OES_vertex_array_object: base_config_1.TYPE,
OfflineAudioCompletionEvent: base_config_1.TYPE_VALUE,
OfflineAudioCompletionEventInit: base_config_1.TYPE,
OfflineAudioContext: base_config_1.TYPE_VALUE,
OfflineAudioContextEventMap: base_config_1.TYPE,
OfflineAudioContextOptions: base_config_1.TYPE,
OffscreenCanvas: base_config_1.TYPE_VALUE,
OffscreenCanvasEventMap: base_config_1.TYPE,
OffscreenCanvasRenderingContext2D: base_config_1.TYPE_VALUE,
OffscreenRenderingContext: base_config_1.TYPE,
OffscreenRenderingContextId: base_config_1.TYPE,
OnBeforeUnloadEventHandler: base_config_1.TYPE,
OnBeforeUnloadEventHandlerNonNull: base_config_1.TYPE,
OnErrorEventHandler: base_config_1.TYPE,
OnErrorEventHandlerNonNull: base_config_1.TYPE,
OptionalEffectTiming: base_config_1.TYPE,
OptionalPostfixToken: base_config_1.TYPE,
OptionalPrefixToken: base_config_1.TYPE,
OrientationType: base_config_1.TYPE,
OscillatorNode: base_config_1.TYPE_VALUE,
OscillatorOptions: base_config_1.TYPE,
OscillatorType: base_config_1.TYPE,
OverconstrainedError: base_config_1.TYPE_VALUE,
OverSampleType: base_config_1.TYPE,
OVR_multiview2: base_config_1.TYPE,
PageTransitionEvent: base_config_1.TYPE_VALUE,
PageTransitionEventInit: base_config_1.TYPE,
PannerNode: base_config_1.TYPE_VALUE,
PannerOptions: base_config_1.TYPE,
PanningModelType: base_config_1.TYPE,
ParentNode: base_config_1.TYPE,
Path2D: base_config_1.TYPE_VALUE,
PaymentComplete: base_config_1.TYPE,
PaymentCurrencyAmount: base_config_1.TYPE,
PaymentDetailsBase: base_config_1.TYPE,
PaymentDetailsInit: base_config_1.TYPE,
PaymentDetailsModifier: base_config_1.TYPE,
PaymentDetailsUpdate: base_config_1.TYPE,
PaymentItem: base_config_1.TYPE,
PaymentMethodChangeEvent: base_config_1.TYPE_VALUE,
PaymentMethodChangeEventInit: base_config_1.TYPE,
PaymentMethodData: base_config_1.TYPE,
PaymentRequest: base_config_1.TYPE_VALUE,
PaymentRequestEventMap: base_config_1.TYPE,
PaymentRequestUpdateEvent: base_config_1.TYPE_VALUE,
PaymentRequestUpdateEventInit: base_config_1.TYPE,
PaymentResponse: base_config_1.TYPE_VALUE,
PaymentValidationErrors: base_config_1.TYPE,
Pbkdf2Params: base_config_1.TYPE,
Performance: base_config_1.TYPE_VALUE,
PerformanceEntry: base_config_1.TYPE_VALUE,
PerformanceEntryList: base_config_1.TYPE,
PerformanceEventMap: base_config_1.TYPE,
PerformanceEventTiming: base_config_1.TYPE_VALUE,
PerformanceMark: base_config_1.TYPE_VALUE,
PerformanceMarkOptions: base_config_1.TYPE,
PerformanceMeasure: base_config_1.TYPE_VALUE,
PerformanceMeasureOptions: base_config_1.TYPE,
PerformanceNavigation: base_config_1.TYPE_VALUE,
PerformanceNavigationTiming: base_config_1.TYPE_VALUE,
PerformanceObserver: base_config_1.TYPE_VALUE,
PerformanceObserverCallback: base_config_1.TYPE,
PerformanceObserverEntryList: base_config_1.TYPE_VALUE,
PerformanceObserverInit: base_config_1.TYPE,
PerformancePaintTiming: base_config_1.TYPE_VALUE,
PerformanceResourceTiming: base_config_1.TYPE_VALUE,
PerformanceServerTiming: base_config_1.TYPE_VALUE,
PerformanceTiming: base_config_1.TYPE_VALUE,
PeriodicWave: base_config_1.TYPE_VALUE,
PeriodicWaveConstraints: base_config_1.TYPE,
PeriodicWaveOptions: base_config_1.TYPE,
PermissionDescriptor: base_config_1.TYPE,
PermissionName: base_config_1.TYPE,
Permissions: base_config_1.TYPE_VALUE,
PermissionState: base_config_1.TYPE,
PermissionStatus: base_config_1.TYPE_VALUE,
PermissionStatusEventMap: base_config_1.TYPE,
PictureInPictureEvent: base_config_1.TYPE_VALUE,
PictureInPictureEventInit: base_config_1.TYPE,
PictureInPictureWindow: base_config_1.TYPE_VALUE,
PictureInPictureWindowEventMap: base_config_1.TYPE,
PlaneLayout: base_config_1.TYPE,
PlaybackDirection: base_config_1.TYPE,
Plugin: base_config_1.TYPE_VALUE,
PluginArray: base_config_1.TYPE_VALUE,
PointerEvent: base_config_1.TYPE_VALUE,
PointerEventInit: base_config_1.TYPE,
PointerLockOptions: base_config_1.TYPE,
PopoverInvokerElement: base_config_1.TYPE,
PopStateEvent: base_config_1.TYPE_VALUE,
PopStateEventInit: base_config_1.TYPE,
PositionAlignSetting: base_config_1.TYPE,
PositionCallback: base_config_1.TYPE,
PositionErrorCallback: base_config_1.TYPE,
PositionOptions: base_config_1.TYPE,
PredefinedColorSpace: base_config_1.TYPE,
PremultiplyAlpha: base_config_1.TYPE,
PresentationStyle: base_config_1.TYPE,
ProcessingInstruction: base_config_1.TYPE_VALUE,
ProgressEvent: base_config_1.TYPE_VALUE,
ProgressEventInit: base_config_1.TYPE,
PromiseRejectionEvent: base_config_1.TYPE_VALUE,
PromiseRejectionEventInit: base_config_1.TYPE,
PropertyDefinition: base_config_1.TYPE,
PropertyIndexedKeyframes: base_config_1.TYPE,
PublicKeyCredential: base_config_1.TYPE_VALUE,
PublicKeyCredentialCreationOptions: base_config_1.TYPE,
PublicKeyCredentialDescriptor: base_config_1.TYPE,
PublicKeyCredentialEntity: base_config_1.TYPE,
PublicKeyCredentialParameters: base_config_1.TYPE,
PublicKeyCredentialRequestOptions: base_config_1.TYPE,
PublicKeyCredentialRpEntity: base_config_1.TYPE,
PublicKeyCredentialType: base_config_1.TYPE,
PublicKeyCredentialUserEntity: base_config_1.TYPE,
PushEncryptionKeyName: base_config_1.TYPE,
PushManager: base_config_1.TYPE_VALUE,
PushSubscription: base_config_1.TYPE_VALUE,
PushSubscriptionJSON: base_config_1.TYPE,
PushSubscriptionOptions: base_config_1.TYPE_VALUE,
PushSubscriptionOptionsInit: base_config_1.TYPE,
QueuingStrategy: base_config_1.TYPE,
QueuingStrategyInit: base_config_1.TYPE,
QueuingStrategySize: base_config_1.TYPE,
RadioNodeList: base_config_1.TYPE_VALUE,
Range: base_config_1.TYPE_VALUE,
ReadableByteStreamController: base_config_1.TYPE_VALUE,
ReadableStream: base_config_1.TYPE_VALUE,
ReadableStreamBYOBReader: base_config_1.TYPE_VALUE,
ReadableStreamBYOBRequest: base_config_1.TYPE_VALUE,
ReadableStreamController: base_config_1.TYPE,
ReadableStreamDefaultController: base_config_1.TYPE_VALUE,
ReadableStreamDefaultReader: base_config_1.TYPE_VALUE,
ReadableStreamGenericReader: base_config_1.TYPE,
ReadableStreamGetReaderOptions: base_config_1.TYPE,
ReadableStreamIteratorOptions: base_config_1.TYPE,
ReadableStreamReadDoneResult: base_config_1.TYPE,
ReadableStreamReader: base_config_1.TYPE,
ReadableStreamReaderMode: base_config_1.TYPE,
ReadableStreamReadResult: base_config_1.TYPE,
ReadableStreamReadValueResult: base_config_1.TYPE,
ReadableStreamType: base_config_1.TYPE,
ReadableWritablePair: base_config_1.TYPE,
ReadyState: base_config_1.TYPE,
RecordingState: base_config_1.TYPE,
ReferrerPolicy: base_config_1.TYPE,
RegistrationOptions: base_config_1.TYPE,
RemotePlayback: base_config_1.TYPE_VALUE,
RemotePlaybackAvailabilityCallback: base_config_1.TYPE,
RemotePlaybackEventMap: base_config_1.TYPE,
RemotePlaybackState: base_config_1.TYPE,
RenderingContext: base_config_1.TYPE,
Report: base_config_1.TYPE_VALUE,
ReportBody: base_config_1.TYPE_VALUE,
ReportingObserver: base_config_1.TYPE_VALUE,
ReportingObserverCallback: base_config_1.TYPE,
ReportingObserverOptions: base_config_1.TYPE,
ReportList: base_config_1.TYPE,
Request: base_config_1.TYPE_VALUE,
RequestCache: base_config_1.TYPE,
RequestCredentials: base_config_1.TYPE,
RequestDestination: base_config_1.TYPE,
RequestInfo: base_config_1.TYPE,
RequestInit: base_config_1.TYPE,
RequestMode: base_config_1.TYPE,
RequestPriority: base_config_1.TYPE,
RequestRedirect: base_config_1.TYPE,
ResidentKeyRequirement: base_config_1.TYPE,
ResizeObserver: base_config_1.TYPE_VALUE,
ResizeObserverBoxOptions: base_config_1.TYPE,
ResizeObserverCallback: base_config_1.TYPE,
ResizeObserverEntry: base_config_1.TYPE_VALUE,
ResizeObserverOptions: base_config_1.TYPE,
ResizeObserverSize: base_config_1.TYPE_VALUE,
ResizeQuality: base_config_1.TYPE,
Response: base_config_1.TYPE_VALUE,
ResponseInit: base_config_1.TYPE,
ResponseType: base_config_1.TYPE,
RsaHashedImportParams: base_config_1.TYPE,
RsaHashedKeyAlgorithm: base_config_1.TYPE,
RsaHashedKeyGenParams: base_config_1.TYPE,
RsaKeyAlgorithm: base_config_1.TYPE,
RsaKeyGenParams: base_config_1.TYPE,
RsaOaepParams: base_config_1.TYPE,
RsaOtherPrimesInfo: base_config_1.TYPE,
RsaPssParams: base_config_1.TYPE,
RTCAnswerOptions: base_config_1.TYPE,
RTCBundlePolicy: base_config_1.TYPE,
RTCCertificate: base_config_1.TYPE_VALUE,
RTCCertificateExpiration: base_config_1.TYPE,
RTCConfiguration: base_config_1.TYPE,
RTCDataChannel: base_config_1.TYPE_VALUE,
RTCDataChannelEvent: base_config_1.TYPE_VALUE,
RTCDataChannelEventInit: base_config_1.TYPE,
RTCDataChannelEventMap: base_config_1.TYPE,
RTCDataChannelInit: base_config_1.TYPE,
RTCDataChannelState: base_config_1.TYPE,
RTCDegradationPreference: base_config_1.TYPE,
RTCDtlsFingerprint: base_config_1.TYPE,
RTCDtlsTransport: base_config_1.TYPE_VALUE,
RTCDtlsTransportEventMap: base_config_1.TYPE,
RTCDtlsTransportState: base_config_1.TYPE,
RTCDTMFSender: base_config_1.TYPE_VALUE,
RTCDTMFSenderEventMap: base_config_1.TYPE,
RTCDTMFToneChangeEvent: base_config_1.TYPE_VALUE,
RTCDTMFToneChangeEventInit: base_config_1.TYPE,
RTCEncodedAudioFrame: base_config_1.TYPE_VALUE,
RTCEncodedAudioFrameMetadata: base_config_1.TYPE,
RTCEncodedVideoFrame: base_config_1.TYPE_VALUE,
RTCEncodedVideoFrameMetadata: base_config_1.TYPE,
RTCEncodedVideoFrameType: base_config_1.TYPE,
RTCError: base_config_1.TYPE_VALUE,
RTCErrorDetailType: base_config_1.TYPE,
RTCErrorEvent: base_config_1.TYPE_VALUE,
RTCErrorEventInit: base_config_1.TYPE,
RTCErrorInit: base_config_1.TYPE,
RTCIceCandidate: base_config_1.TYPE_VALUE,
RTCIceCandidateInit: base_config_1.TYPE,
RTCIceCandidatePair: base_config_1.TYPE,
RTCIceCandidatePairStats: base_config_1.TYPE,
RTCIceCandidateType: base_config_1.TYPE,
RTCIceComponent: base_config_1.TYPE,
RTCIceConnectionState: base_config_1.TYPE,
RTCIceGathererState: base_config_1.TYPE,
RTCIceGatheringState: base_config_1.TYPE,
RTCIceProtocol: base_config_1.TYPE,
RTCIceServer: base_config_1.TYPE,
RTCIceTcpCandidateType: base_config_1.TYPE,
RTCIceTransport: base_config_1.TYPE_VALUE,
RTCIceTransportEventMap: base_config_1.TYPE,
RTCIceTransportPolicy: base_config_1.TYPE,
RTCIceTransportState: base_config_1.TYPE,
RTCInboundRtpStreamStats: base_config_1.TYPE,
RTCLocalSessionDescriptionInit: base_config_1.TYPE,
RTCOfferAnswerOptions: base_config_1.TYPE,
RTCOfferOptions: base_config_1.TYPE,
RTCOutboundRtpStreamStats: base_config_1.TYPE,
RTCPeerConnection: base_config_1.TYPE_VALUE,
RTCPeerConnectionErrorCallback: base_config_1.TYPE,
RTCPeerConnectionEventMap: base_config_1.TYPE,
RTCPeerConnectionIceErrorEvent: base_config_1.TYPE_VALUE,
RTCPeerConnectionIceErrorEventInit: base_config_1.TYPE,
RTCPeerConnectionIceEvent: base_config_1.TYPE_VALUE,
RTCPeerConnectionIceEventInit: base_config_1.TYPE,
RTCPeerConnectionState: base_config_1.TYPE,
RTCPriorityType: base_config_1.TYPE,
RTCReceivedRtpStreamStats: base_config_1.TYPE,
RTCRtcpMuxPolicy: base_config_1.TYPE,
RTCRtcpParameters: base_config_1.TYPE,
RTCRtpCapabilities: base_config_1.TYPE,
RTCRtpCodec: base_config_1.TYPE,
RTCRtpCodecParameters: base_config_1.TYPE,
RTCRtpCodingParameters: base_config_1.TYPE,
RTCRtpContributingSource: base_config_1.TYPE,
RTCRtpEncodingParameters: base_config_1.TYPE,
RTCRtpHeaderExtensionCapability: base_config_1.TYPE,
RTCRtpHeaderExtensionParameters: base_config_1.TYPE,
RTCRtpParameters: base_config_1.TYPE,
RTCRtpReceiveParameters: base_config_1.TYPE,
RTCRtpReceiver: base_config_1.TYPE_VALUE,
RTCRtpScriptTransform: base_config_1.TYPE_VALUE,
RTCRtpSender: base_config_1.TYPE_VALUE,
RTCRtpSendParameters: base_config_1.TYPE,
RTCRtpStreamStats: base_config_1.TYPE,
RTCRtpSynchronizationSource: base_config_1.TYPE,
RTCRtpTransceiver: base_config_1.TYPE_VALUE,
RTCRtpTransceiverDirection: base_config_1.TYPE,
RTCRtpTransceiverInit: base_config_1.TYPE,
RTCRtpTransform: base_config_1.TYPE,
RTCSctpTransport: base_config_1.TYPE_VALUE,
RTCSctpTransportEventMap: base_config_1.TYPE,
RTCSctpTransportState: base_config_1.TYPE,
RTCSdpType: base_config_1.TYPE,
RTCSentRtpStreamStats: base_config_1.TYPE,
RTCSessionDescription: base_config_1.TYPE_VALUE,
RTCSessionDescriptionCallback: base_config_1.TYPE,
RTCSessionDescriptionInit: base_config_1.TYPE,
RTCSetParameterOptions: base_config_1.TYPE,
RTCSignalingState: base_config_1.TYPE,
RTCStats: base_config_1.TYPE,
RTCStatsIceCandidatePairState: base_config_1.TYPE,
RTCStatsReport: base_config_1.TYPE_VALUE,
RTCStatsType: base_config_1.TYPE,
RTCTrackEvent: base_config_1.TYPE_VALUE,
RTCTrackEventInit: base_config_1.TYPE,
RTCTransportStats: base_config_1.TYPE,
Screen: base_config_1.TYPE_VALUE,
ScreenOrientation: base_config_1.TYPE_VALUE,
ScreenOrientationEventMap: base_config_1.TYPE,
ScriptProcessorNode: base_config_1.TYPE_VALUE,
ScriptProcessorNodeEventMap: base_config_1.TYPE,
ScrollBehavior: base_config_1.TYPE,
ScrollIntoViewOptions: base_config_1.TYPE,
ScrollLogicalPosition: base_config_1.TYPE,
ScrollOptions: base_config_1.TYPE,
ScrollRestoration: base_config_1.TYPE,
ScrollSetting: base_config_1.TYPE,
ScrollToOptions: base_config_1.TYPE,
SecurityPolicyViolationEvent: base_config_1.TYPE_VALUE,
SecurityPolicyViolationEventDisposition: base_config_1.TYPE,
SecurityPolicyViolationEventInit: base_config_1.TYPE,
Selection: base_config_1.TYPE_VALUE,
SelectionMode: base_config_1.TYPE,
ServiceWorker: base_config_1.TYPE_VALUE,
ServiceWorkerContainer: base_config_1.TYPE_VALUE,
ServiceWorkerContainerEventMap: base_config_1.TYPE,
ServiceWorkerEventMap: base_config_1.TYPE,
ServiceWorkerRegistration: base_config_1.TYPE_VALUE,
ServiceWorkerRegistrationEventMap: base_config_1.TYPE,
ServiceWorkerState: base_config_1.TYPE,
ServiceWorkerUpdateViaCache: base_config_1.TYPE,
ShadowRoot: base_config_1.TYPE_VALUE,
ShadowRootEventMap: base_config_1.TYPE,
ShadowRootInit: base_config_1.TYPE,
ShadowRootMode: base_config_1.TYPE,
ShareData: base_config_1.TYPE,
SharedWorker: base_config_1.TYPE_VALUE,
SlotAssignmentMode: base_config_1.TYPE,
Slottable: base_config_1.TYPE,
SourceBuffer: base_config_1.TYPE_VALUE,
SourceBufferEventMap: base_config_1.TYPE,
SourceBufferList: base_config_1.TYPE_VALUE,
SourceBufferListEventMap: base_config_1.TYPE,
SpeechRecognitionAlternative: base_config_1.TYPE_VALUE,
SpeechRecognitionResult: base_config_1.TYPE_VALUE,
SpeechRecognitionResultList: base_config_1.TYPE_VALUE,
SpeechSynthesis: base_config_1.TYPE_VALUE,
SpeechSynthesisErrorCode: base_config_1.TYPE,
SpeechSynthesisErrorEvent: base_config_1.TYPE_VALUE,
SpeechSynthesisErrorEventInit: base_config_1.TYPE,
SpeechSynthesisEvent: base_config_1.TYPE_VALUE,
SpeechSynthesisEventInit: base_config_1.TYPE,
SpeechSynthesisEventMap: base_config_1.TYPE,
SpeechSynthesisUtterance: base_config_1.TYPE_VALUE,
SpeechSynthesisUtteranceEventMap: base_config_1.TYPE,
SpeechSynthesisVoice: base_config_1.TYPE_VALUE,
StaticRange: base_config_1.TYPE_VALUE,
StaticRangeInit: base_config_1.TYPE,
StereoPannerNode: base_config_1.TYPE_VALUE,
StereoPannerOptions: base_config_1.TYPE,
Storage: base_config_1.TYPE_VALUE,
StorageEstimate: base_config_1.TYPE,
StorageEvent: base_config_1.TYPE_VALUE,
StorageEventInit: base_config_1.TYPE,
StorageManager: base_config_1.TYPE_VALUE,
StreamPipeOptions: base_config_1.TYPE,
StructuredSerializeOptions: base_config_1.TYPE,
StyleMedia: base_config_1.TYPE,
StylePropertyMap: base_config_1.TYPE_VALUE,
StylePropertyMapReadOnly: base_config_1.TYPE_VALUE,
StyleSheet: base_config_1.TYPE_VALUE,
StyleSheetList: base_config_1.TYPE_VALUE,
SubmitEvent: base_config_1.TYPE_VALUE,
SubmitEventInit: base_config_1.TYPE,
SubtleCrypto: base_config_1.TYPE_VALUE,
SVGAElement: base_config_1.TYPE_VALUE,
SVGAngle: base_config_1.TYPE_VALUE,
SVGAnimatedAngle: base_config_1.TYPE_VALUE,
SVGAnimatedBoolean: base_config_1.TYPE_VALUE,
SVGAnimatedEnumeration: base_config_1.TYPE_VALUE,
SVGAnimatedInteger: base_config_1.TYPE_VALUE,
SVGAnimatedLength: base_config_1.TYPE_VALUE,
SVGAnimatedLengthList: base_config_1.TYPE_VALUE,
SVGAnimatedNumber: base_config_1.TYPE_VALUE,
SVGAnimatedNumberList: base_config_1.TYPE_VALUE,
SVGAnimatedPoints: base_config_1.TYPE,
SVGAnimatedPreserveAspectRatio: base_config_1.TYPE_VALUE,
SVGAnimatedRect: base_config_1.TYPE_VALUE,
SVGAnimatedString: base_config_1.TYPE_VALUE,
SVGAnimatedTransformList: base_config_1.TYPE_VALUE,
SVGAnimateElement: base_config_1.TYPE_VALUE,
SVGAnimateMotionElement: base_config_1.TYPE_VALUE,
SVGAnimateTransformElement: base_config_1.TYPE_VALUE,
SVGAnimationElement: base_config_1.TYPE_VALUE,
SVGBoundingBoxOptions: base_config_1.TYPE,
SVGCircleElement: base_config_1.TYPE_VALUE,
SVGClipPathElement: base_config_1.TYPE_VALUE,
SVGComponentTransferFunctionElement: base_config_1.TYPE_VALUE,
SVGDefsElement: base_config_1.TYPE_VALUE,
SVGDescElement: base_config_1.TYPE_VALUE,
SVGElement: base_config_1.TYPE_VALUE,
SVGElementEventMap: base_config_1.TYPE,
SVGElementTagNameMap: base_config_1.TYPE,
SVGEllipseElement: base_config_1.TYPE_VALUE,
SVGFEBlendElement: base_config_1.TYPE_VALUE,
SVGFEColorMatrixElement: base_config_1.TYPE_VALUE,
SVGFEComponentTransferElement: base_config_1.TYPE_VALUE,
SVGFECompositeElement: base_config_1.TYPE_VALUE,
SVGFEConvolveMatrixElement: base_config_1.TYPE_VALUE,
SVGFEDiffuseLightingElement: base_config_1.TYPE_VALUE,
SVGFEDisplacementMapElement: base_config_1.TYPE_VALUE,
SVGFEDistantLightElement: base_config_1.TYPE_VALUE,
SVGFEDropShadowElement: base_config_1.TYPE_VALUE,
SVGFEFloodElement: base_config_1.TYPE_VALUE,
SVGFEFuncAElement: base_config_1.TYPE_VALUE,
SVGFEFuncBElement: base_config_1.TYPE_VALUE,
SVGFEFuncGElement: base_config_1.TYPE_VALUE,
SVGFEFuncRElement: base_config_1.TYPE_VALUE,
SVGFEGaussianBlurElement: base_config_1.TYPE_VALUE,
SVGFEImageElement: base_config_1.TYPE_VALUE,
SVGFEMergeElement: base_config_1.TYPE_VALUE,
SVGFEMergeNodeElement: base_config_1.TYPE_VALUE,
SVGFEMorphologyElement: base_config_1.TYPE_VALUE,
SVGFEOffsetElement: base_config_1.TYPE_VALUE,
SVGFEPointLightElement: base_config_1.TYPE_VALUE,
SVGFESpecularLightingElement: base_config_1.TYPE_VALUE,
SVGFESpotLightElement: base_config_1.TYPE_VALUE,
SVGFETileElement: base_config_1.TYPE_VALUE,
SVGFETurbulenceElement: base_config_1.TYPE_VALUE,
SVGFilterElement: base_config_1.TYPE_VALUE,
SVGFilterPrimitiveStandardAttributes: base_config_1.TYPE,
SVGFitToViewBox: base_config_1.TYPE,
SVGForeignObjectElement: base_config_1.TYPE_VALUE,
SVGGElement: base_config_1.TYPE_VALUE,
SVGGeometryElement: base_config_1.TYPE_VALUE,
SVGGradientElement: base_config_1.TYPE_VALUE,
SVGGraphicsElement: base_config_1.TYPE_VALUE,
SVGImageElement: base_config_1.TYPE_VALUE,
SVGLength: base_config_1.TYPE_VALUE,
SVGLengthList: base_config_1.TYPE_VALUE,
SVGLinearGradientElement: base_config_1.TYPE_VALUE,
SVGLineElement: base_config_1.TYPE_VALUE,
SVGMarkerElement: base_config_1.TYPE_VALUE,
SVGMaskElement: base_config_1.TYPE_VALUE,
SVGMatrix: base_config_1.TYPE_VALUE,
SVGMetadataElement: base_config_1.TYPE_VALUE,
SVGMPathElement: base_config_1.TYPE_VALUE,
SVGNumber: base_config_1.TYPE_VALUE,
SVGNumberList: base_config_1.TYPE_VALUE,
SVGPathElement: base_config_1.TYPE_VALUE,
SVGPatternElement: base_config_1.TYPE_VALUE,
SVGPoint: base_config_1.TYPE_VALUE,
SVGPointList: base_config_1.TYPE_VALUE,
SVGPolygonElement: base_config_1.TYPE_VALUE,
SVGPolylineElement: base_config_1.TYPE_VALUE,
SVGPreserveAspectRatio: base_config_1.TYPE_VALUE,
SVGRadialGradientElement: base_config_1.TYPE_VALUE,
SVGRect: base_config_1.TYPE_VALUE,
SVGRectElement: base_config_1.TYPE_VALUE,
SVGScriptElement: base_config_1.TYPE_VALUE,
SVGSetElement: base_config_1.TYPE_VALUE,
SVGStopElement: base_config_1.TYPE_VALUE,
SVGStringList: base_config_1.TYPE_VALUE,
SVGStyleElement: base_config_1.TYPE_VALUE,
SVGSVGElement: base_config_1.TYPE_VALUE,
SVGSVGElementEventMap: base_config_1.TYPE,
SVGSwitchElement: base_config_1.TYPE_VALUE,
SVGSymbolElement: base_config_1.TYPE_VALUE,
SVGTests: base_config_1.TYPE,
SVGTextContentElement: base_config_1.TYPE_VALUE,
SVGTextElement: base_config_1.TYPE_VALUE,
SVGTextPathElement: base_config_1.TYPE_VALUE,
SVGTextPositioningElement: base_config_1.TYPE_VALUE,
SVGTitleElement: base_config_1.TYPE_VALUE,
SVGTransform: base_config_1.TYPE_VALUE,
SVGTransformList: base_config_1.TYPE_VALUE,
SVGTSpanElement: base_config_1.TYPE_VALUE,
SVGUnitTypes: base_config_1.TYPE_VALUE,
SVGURIReference: base_config_1.TYPE,
SVGUseElement: base_config_1.TYPE_VALUE,
SVGViewElement: base_config_1.TYPE_VALUE,
TexImageSource: base_config_1.TYPE,
Text: base_config_1.TYPE_VALUE,
TextDecodeOptions: base_config_1.TYPE,
TextDecoder: base_config_1.TYPE_VALUE,
TextDecoderCommon: base_config_1.TYPE,
TextDecoderOptions: base_config_1.TYPE,
TextDecoderStream: base_config_1.TYPE_VALUE,
TextEncoder: base_config_1.TYPE_VALUE,
TextEncoderCommon: base_config_1.TYPE,
TextEncoderEncodeIntoResult: base_config_1.TYPE,
TextEncoderStream: base_config_1.TYPE_VALUE,
TextEvent: base_config_1.TYPE_VALUE,
TextMetrics: base_config_1.TYPE_VALUE,
TextTrack: base_config_1.TYPE_VALUE,
TextTrackCue: base_config_1.TYPE_VALUE,
TextTrackCueEventMap: base_config_1.TYPE,
TextTrackCueList: base_config_1.TYPE_VALUE,
TextTrackEventMap: base_config_1.TYPE,
TextTrackKind: base_config_1.TYPE,
TextTrackList: base_config_1.TYPE_VALUE,
TextTrackListEventMap: base_config_1.TYPE,
TextTrackMode: base_config_1.TYPE,
TimeRanges: base_config_1.TYPE_VALUE,
TimerHandler: base_config_1.TYPE,
ToggleEvent: base_config_1.TYPE_VALUE,
ToggleEventInit: base_config_1.TYPE,
Touch: base_config_1.TYPE_VALUE,
TouchEvent: base_config_1.TYPE_VALUE,
TouchEventInit: base_config_1.TYPE,
TouchInit: base_config_1.TYPE,
TouchList: base_config_1.TYPE_VALUE,
TouchType: base_config_1.TYPE,
TrackEvent: base_config_1.TYPE_VALUE,
TrackEventInit: base_config_1.TYPE,
Transferable: base_config_1.TYPE,
TransferFunction: base_config_1.TYPE,
Transformer: base_config_1.TYPE,
TransformerFlushCallback: base_config_1.TYPE,
TransformerStartCallback: base_config_1.TYPE,
TransformerTransformCallback: base_config_1.TYPE,
TransformStream: base_config_1.TYPE_VALUE,
TransformStreamDefaultController: base_config_1.TYPE_VALUE,
TransitionEvent: base_config_1.TYPE_VALUE,
TransitionEventInit: base_config_1.TYPE,
TreeWalker: base_config_1.TYPE_VALUE,
UIEvent: base_config_1.TYPE_VALUE,
UIEventInit: base_config_1.TYPE,
Uint32List: base_config_1.TYPE,
ULongRange: base_config_1.TYPE,
UnderlyingByteSource: base_config_1.TYPE,
UnderlyingDefaultSource: base_config_1.TYPE,
UnderlyingSink: base_config_1.TYPE,
UnderlyingSinkAbortCallback: base_config_1.TYPE,
UnderlyingSinkCloseCallback: base_config_1.TYPE,
UnderlyingSinkStartCallback: base_config_1.TYPE,
UnderlyingSinkWriteCallback: base_config_1.TYPE,
UnderlyingSource: base_config_1.TYPE,
UnderlyingSourceCancelCallback: base_config_1.TYPE,
UnderlyingSourcePullCallback: base_config_1.TYPE,
UnderlyingSourceStartCallback: base_config_1.TYPE,
UpdateCallback: base_config_1.TYPE,
URL: base_config_1.TYPE_VALUE,
URLSearchParams: base_config_1.TYPE_VALUE,
UserActivation: base_config_1.TYPE_VALUE,
UserVerificationRequirement: base_config_1.TYPE,
ValidityState: base_config_1.TYPE_VALUE,
ValidityStateFlags: base_config_1.TYPE,
VibratePattern: base_config_1.TYPE,
VideoColorPrimaries: base_config_1.TYPE,
VideoColorSpace: base_config_1.TYPE_VALUE,
VideoColorSpaceInit: base_config_1.TYPE,
VideoConfiguration: base_config_1.TYPE,
VideoDecoder: base_config_1.TYPE_VALUE,
VideoDecoderConfig: base_config_1.TYPE,
VideoDecoderEventMap: base_config_1.TYPE,
VideoDecoderInit: base_config_1.TYPE,
VideoDecoderSupport: base_config_1.TYPE,
VideoEncoder: base_config_1.TYPE_VALUE,
VideoEncoderBitrateMode: base_config_1.TYPE,
VideoEncoderConfig: base_config_1.TYPE,
VideoEncoderEncodeOptions: base_config_1.TYPE,
VideoEncoderEventMap: base_config_1.TYPE,
VideoEncoderInit: base_config_1.TYPE,
VideoEncoderSupport: base_config_1.TYPE,
VideoFacingModeEnum: base_config_1.TYPE,
VideoFrame: base_config_1.TYPE_VALUE,
VideoFrameBufferInit: base_config_1.TYPE,
VideoFrameCallbackMetadata: base_config_1.TYPE,
VideoFrameCopyToOptions: base_config_1.TYPE,
VideoFrameInit: base_config_1.TYPE,
VideoFrameOutputCallback: base_config_1.TYPE,
VideoFrameRequestCallback: base_config_1.TYPE,
VideoMatrixCoefficients: base_config_1.TYPE,
VideoPixelFormat: base_config_1.TYPE,
VideoPlaybackQuality: base_config_1.TYPE_VALUE,
VideoTransferCharacteristics: base_config_1.TYPE,
ViewTransition: base_config_1.TYPE_VALUE,
VisualViewport: base_config_1.TYPE_VALUE,
VisualViewportEventMap: base_config_1.TYPE,
VoidFunction: base_config_1.TYPE,
VTTCue: base_config_1.TYPE_VALUE,
VTTRegion: base_config_1.TYPE_VALUE,
WakeLock: base_config_1.TYPE_VALUE,
WakeLockSentinel: base_config_1.TYPE_VALUE,
WakeLockSentinelEventMap: base_config_1.TYPE,
WakeLockType: base_config_1.TYPE,
WaveShaperNode: base_config_1.TYPE_VALUE,
WaveShaperOptions: base_config_1.TYPE,
WebAssembly: base_config_1.TYPE_VALUE,
WebCodecsErrorCallback: base_config_1.TYPE,
WEBGL_color_buffer_float: base_config_1.TYPE,
WEBGL_compressed_texture_astc: base_config_1.TYPE,
WEBGL_compressed_texture_etc: base_config_1.TYPE,
WEBGL_compressed_texture_etc1: base_config_1.TYPE,
WEBGL_compressed_texture_pvrtc: base_config_1.TYPE,
WEBGL_compressed_texture_s3tc: base_config_1.TYPE,
WEBGL_compressed_texture_s3tc_srgb: base_config_1.TYPE,
WEBGL_debug_renderer_info: base_config_1.TYPE,
WEBGL_debug_shaders: base_config_1.TYPE,
WEBGL_depth_texture: base_config_1.TYPE,
WEBGL_draw_buffers: base_config_1.TYPE,
WEBGL_lose_context: base_config_1.TYPE,
WEBGL_multi_draw: base_config_1.TYPE,
WebGL2RenderingContext: base_config_1.TYPE_VALUE,
WebGL2RenderingContextBase: base_config_1.TYPE,
WebGL2RenderingContextOverloads: base_config_1.TYPE,
WebGLActiveInfo: base_config_1.TYPE_VALUE,
WebGLBuffer: base_config_1.TYPE_VALUE,
WebGLContextAttributes: base_config_1.TYPE,
WebGLContextEvent: base_config_1.TYPE_VALUE,
WebGLContextEventInit: base_config_1.TYPE,
WebGLFramebuffer: base_config_1.TYPE_VALUE,
WebGLPowerPreference: base_config_1.TYPE,
WebGLProgram: base_config_1.TYPE_VALUE,
WebGLQuery: base_config_1.TYPE_VALUE,
WebGLRenderbuffer: base_config_1.TYPE_VALUE,
WebGLRenderingContext: base_config_1.TYPE_VALUE,
WebGLRenderingContextBase: base_config_1.TYPE,
WebGLRenderingContextOverloads: base_config_1.TYPE,
WebGLSampler: base_config_1.TYPE_VALUE,
WebGLShader: base_config_1.TYPE_VALUE,
WebGLShaderPrecisionFormat: base_config_1.TYPE_VALUE,
WebGLSync: base_config_1.TYPE_VALUE,
WebGLTexture: base_config_1.TYPE_VALUE,
WebGLTransformFeedback: base_config_1.TYPE_VALUE,
WebGLUniformLocation: base_config_1.TYPE_VALUE,
WebGLVertexArrayObject: base_config_1.TYPE_VALUE,
WebGLVertexArrayObjectOES: base_config_1.TYPE,
WebKitCSSMatrix: base_config_1.TYPE_VALUE,
webkitURL: base_config_1.TYPE_VALUE,
WebSocket: base_config_1.TYPE_VALUE,
WebSocketEventMap: base_config_1.TYPE,
WebTransport: base_config_1.TYPE_VALUE,
WebTransportBidirectionalStream: base_config_1.TYPE_VALUE,
WebTransportCloseInfo: base_config_1.TYPE,
WebTransportCongestionControl: base_config_1.TYPE,
WebTransportDatagramDuplexStream: base_config_1.TYPE_VALUE,
WebTransportError: base_config_1.TYPE_VALUE,
WebTransportErrorOptions: base_config_1.TYPE,
WebTransportErrorSource: base_config_1.TYPE,
WebTransportHash: base_config_1.TYPE,
WebTransportOptions: base_config_1.TYPE,
WebTransportSendStreamOptions: base_config_1.TYPE,
WheelEvent: base_config_1.TYPE_VALUE,
WheelEventInit: base_config_1.TYPE,
Window: base_config_1.TYPE_VALUE,
WindowEventHandlers: base_config_1.TYPE,
WindowEventHandlersEventMap: base_config_1.TYPE,
WindowEventMap: base_config_1.TYPE,
WindowLocalStorage: base_config_1.TYPE,
WindowOrWorkerGlobalScope: base_config_1.TYPE,
WindowPostMessageOptions: base_config_1.TYPE,
WindowProxy: base_config_1.TYPE,
WindowSessionStorage: base_config_1.TYPE,
Worker: base_config_1.TYPE_VALUE,
WorkerEventMap: base_config_1.TYPE,
WorkerOptions: base_config_1.TYPE,
WorkerType: base_config_1.TYPE,
Worklet: base_config_1.TYPE_VALUE,
WorkletOptions: base_config_1.TYPE,
WritableStream: base_config_1.TYPE_VALUE,
WritableStreamDefaultController: base_config_1.TYPE_VALUE,
WritableStreamDefaultWriter: base_config_1.TYPE_VALUE,
WriteCommandType: base_config_1.TYPE,
WriteParams: base_config_1.TYPE,
XMLDocument: base_config_1.TYPE_VALUE,
XMLHttpRequest: base_config_1.TYPE_VALUE,
XMLHttpRequestBodyInit: base_config_1.TYPE,
XMLHttpRequestEventMap: base_config_1.TYPE,
XMLHttpRequestEventTarget: base_config_1.TYPE_VALUE,
XMLHttpRequestEventTargetEventMap: base_config_1.TYPE,
XMLHttpRequestResponseType: base_config_1.TYPE,
XMLHttpRequestUpload: base_config_1.TYPE_VALUE,
XMLSerializer: base_config_1.TYPE_VALUE,
XPathEvaluator: base_config_1.TYPE_VALUE,
XPathEvaluatorBase: base_config_1.TYPE,
XPathExpression: base_config_1.TYPE_VALUE,
XPathNSResolver: base_config_1.TYPE,
XPathResult: base_config_1.TYPE_VALUE,
XSLTProcessor: base_config_1.TYPE_VALUE
};
return dom;
}
var dom_asynciterable = {};
var hasRequiredDom_asynciterable;
function requireDom_asynciterable() {
if (hasRequiredDom_asynciterable) return dom_asynciterable;
hasRequiredDom_asynciterable = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(dom_asynciterable, "__esModule", {
value: true
});
dom_asynciterable.dom_asynciterable = undefined;
const base_config_1 = requireBaseConfig();
dom_asynciterable.dom_asynciterable = {
FileSystemDirectoryHandle: base_config_1.TYPE,
FileSystemDirectoryHandleAsyncIterator: base_config_1.TYPE,
ReadableStream: base_config_1.TYPE,
ReadableStreamAsyncIterator: base_config_1.TYPE
};
return dom_asynciterable;
}
var dom_iterable = {};
var hasRequiredDom_iterable;
function requireDom_iterable() {
if (hasRequiredDom_iterable) return dom_iterable;
hasRequiredDom_iterable = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(dom_iterable, "__esModule", {
value: true
});
dom_iterable.dom_iterable = undefined;
const base_config_1 = requireBaseConfig();
dom_iterable.dom_iterable = {
AbortSignal: base_config_1.TYPE,
AudioParam: base_config_1.TYPE,
AudioParamMap: base_config_1.TYPE,
BaseAudioContext: base_config_1.TYPE,
Cache: base_config_1.TYPE,
CanvasPath: base_config_1.TYPE,
CanvasPathDrawingStyles: base_config_1.TYPE,
CSSKeyframesRule: base_config_1.TYPE,
CSSNumericArray: base_config_1.TYPE,
CSSRuleList: base_config_1.TYPE,
CSSStyleDeclaration: base_config_1.TYPE,
CSSTransformValue: base_config_1.TYPE,
CSSUnparsedValue: base_config_1.TYPE,
CustomStateSet: base_config_1.TYPE,
DataTransferItemList: base_config_1.TYPE,
DOMRectList: base_config_1.TYPE,
DOMStringList: base_config_1.TYPE,
DOMTokenList: base_config_1.TYPE,
EventCounts: base_config_1.TYPE,
FileList: base_config_1.TYPE,
FontFaceSet: base_config_1.TYPE,
FormData: base_config_1.TYPE,
FormDataIterator: base_config_1.TYPE,
Headers: base_config_1.TYPE,
HeadersIterator: base_config_1.TYPE,
Highlight: base_config_1.TYPE,
HighlightRegistry: base_config_1.TYPE,
HTMLAllCollection: base_config_1.TYPE,
HTMLCollectionBase: base_config_1.TYPE,
HTMLCollectionOf: base_config_1.TYPE,
HTMLFormElement: base_config_1.TYPE,
HTMLSelectElement: base_config_1.TYPE,
IDBDatabase: base_config_1.TYPE,
IDBObjectStore: base_config_1.TYPE,
MediaKeyStatusMap: base_config_1.TYPE,
MediaKeyStatusMapIterator: base_config_1.TYPE,
MediaList: base_config_1.TYPE,
MessageEvent: base_config_1.TYPE,
MIDIInputMap: base_config_1.TYPE,
MIDIOutput: base_config_1.TYPE,
MIDIOutputMap: base_config_1.TYPE,
MimeTypeArray: base_config_1.TYPE,
NamedNodeMap: base_config_1.TYPE,
Navigator: base_config_1.TYPE,
NodeList: base_config_1.TYPE,
NodeListOf: base_config_1.TYPE,
Plugin: base_config_1.TYPE,
PluginArray: base_config_1.TYPE,
RTCRtpTransceiver: base_config_1.TYPE,
RTCStatsReport: base_config_1.TYPE,
SourceBufferList: base_config_1.TYPE,
SpeechRecognitionResult: base_config_1.TYPE,
SpeechRecognitionResultList: base_config_1.TYPE,
StylePropertyMapReadOnly: base_config_1.TYPE,
StylePropertyMapReadOnlyIterator: base_config_1.TYPE,
StyleSheetList: base_config_1.TYPE,
SubtleCrypto: base_config_1.TYPE,
SVGLengthList: base_config_1.TYPE,
SVGNumberList: base_config_1.TYPE,
SVGPointList: base_config_1.TYPE,
SVGStringList: base_config_1.TYPE,
SVGTransformList: base_config_1.TYPE,
TextTrackCueList: base_config_1.TYPE,
TextTrackList: base_config_1.TYPE,
TouchList: base_config_1.TYPE,
URLSearchParams: base_config_1.TYPE,
URLSearchParamsIterator: base_config_1.TYPE,
WEBGL_draw_buffers: base_config_1.TYPE,
WEBGL_multi_draw: base_config_1.TYPE,
WebGL2RenderingContextBase: base_config_1.TYPE,
WebGL2RenderingContextOverloads: base_config_1.TYPE,
WebGLRenderingContextBase: base_config_1.TYPE,
WebGLRenderingContextOverloads: base_config_1.TYPE
};
return dom_iterable;
}
var es5 = {};
var hasRequiredEs5;
function requireEs5() {
if (hasRequiredEs5) return es5;
hasRequiredEs5 = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es5, "__esModule", {
value: true
});
es5.es5 = undefined;
const base_config_1 = requireBaseConfig();
const decorators_1 = requireDecorators();
const decorators_legacy_1 = requireDecorators_legacy();
es5.es5 = {
...decorators_1.decorators,
...decorators_legacy_1.decorators_legacy,
Array: base_config_1.TYPE_VALUE,
ArrayBuffer: base_config_1.TYPE_VALUE,
ArrayBufferConstructor: base_config_1.TYPE,
ArrayBufferLike: base_config_1.TYPE,
ArrayBufferTypes: base_config_1.TYPE,
ArrayBufferView: base_config_1.TYPE,
ArrayConstructor: base_config_1.TYPE,
ArrayLike: base_config_1.TYPE,
Awaited: base_config_1.TYPE,
Boolean: base_config_1.TYPE_VALUE,
BooleanConstructor: base_config_1.TYPE,
CallableFunction: base_config_1.TYPE,
Capitalize: base_config_1.TYPE,
ConcatArray: base_config_1.TYPE,
ConstructorParameters: base_config_1.TYPE,
DataView: base_config_1.TYPE_VALUE,
DataViewConstructor: base_config_1.TYPE,
Date: base_config_1.TYPE_VALUE,
DateConstructor: base_config_1.TYPE,
Error: base_config_1.TYPE_VALUE,
ErrorConstructor: base_config_1.TYPE,
EvalError: base_config_1.TYPE_VALUE,
EvalErrorConstructor: base_config_1.TYPE,
Exclude: base_config_1.TYPE,
Extract: base_config_1.TYPE,
Float32Array: base_config_1.TYPE_VALUE,
Float32ArrayConstructor: base_config_1.TYPE,
Float64Array: base_config_1.TYPE_VALUE,
Float64ArrayConstructor: base_config_1.TYPE,
Function: base_config_1.TYPE_VALUE,
FunctionConstructor: base_config_1.TYPE,
IArguments: base_config_1.TYPE,
ImportAssertions: base_config_1.TYPE,
ImportAttributes: base_config_1.TYPE,
ImportCallOptions: base_config_1.TYPE,
ImportMeta: base_config_1.TYPE,
InstanceType: base_config_1.TYPE,
Int8Array: base_config_1.TYPE_VALUE,
Int8ArrayConstructor: base_config_1.TYPE,
Int16Array: base_config_1.TYPE_VALUE,
Int16ArrayConstructor: base_config_1.TYPE,
Int32Array: base_config_1.TYPE_VALUE,
Int32ArrayConstructor: base_config_1.TYPE,
Intl: base_config_1.TYPE_VALUE,
JSON: base_config_1.TYPE_VALUE,
Lowercase: base_config_1.TYPE,
Math: base_config_1.TYPE_VALUE,
NewableFunction: base_config_1.TYPE,
NoInfer: base_config_1.TYPE,
NonNullable: base_config_1.TYPE,
Number: base_config_1.TYPE_VALUE,
NumberConstructor: base_config_1.TYPE,
Object: base_config_1.TYPE_VALUE,
ObjectConstructor: base_config_1.TYPE,
Omit: base_config_1.TYPE,
OmitThisParameter: base_config_1.TYPE,
Parameters: base_config_1.TYPE,
Partial: base_config_1.TYPE,
Pick: base_config_1.TYPE,
Promise: base_config_1.TYPE,
PromiseConstructorLike: base_config_1.TYPE,
PromiseLike: base_config_1.TYPE,
PropertyDescriptor: base_config_1.TYPE,
PropertyDescriptorMap: base_config_1.TYPE,
PropertyKey: base_config_1.TYPE,
RangeError: base_config_1.TYPE_VALUE,
RangeErrorConstructor: base_config_1.TYPE,
Readonly: base_config_1.TYPE,
ReadonlyArray: base_config_1.TYPE,
Record: base_config_1.TYPE,
ReferenceError: base_config_1.TYPE_VALUE,
ReferenceErrorConstructor: base_config_1.TYPE,
RegExp: base_config_1.TYPE_VALUE,
RegExpConstructor: base_config_1.TYPE,
RegExpExecArray: base_config_1.TYPE,
RegExpMatchArray: base_config_1.TYPE,
Required: base_config_1.TYPE,
ReturnType: base_config_1.TYPE,
String: base_config_1.TYPE_VALUE,
StringConstructor: base_config_1.TYPE,
Symbol: base_config_1.TYPE,
SyntaxError: base_config_1.TYPE_VALUE,
SyntaxErrorConstructor: base_config_1.TYPE,
TemplateStringsArray: base_config_1.TYPE,
ThisParameterType: base_config_1.TYPE,
ThisType: base_config_1.TYPE,
TypedPropertyDescriptor: base_config_1.TYPE,
TypeError: base_config_1.TYPE_VALUE,
TypeErrorConstructor: base_config_1.TYPE,
Uint8Array: base_config_1.TYPE_VALUE,
Uint8ArrayConstructor: base_config_1.TYPE,
Uint8ClampedArray: base_config_1.TYPE_VALUE,
Uint8ClampedArrayConstructor: base_config_1.TYPE,
Uint16Array: base_config_1.TYPE_VALUE,
Uint16ArrayConstructor: base_config_1.TYPE,
Uint32Array: base_config_1.TYPE_VALUE,
Uint32ArrayConstructor: base_config_1.TYPE,
Uncapitalize: base_config_1.TYPE,
Uppercase: base_config_1.TYPE,
URIError: base_config_1.TYPE_VALUE,
URIErrorConstructor: base_config_1.TYPE,
WeakKey: base_config_1.TYPE,
WeakKeyTypes: base_config_1.TYPE
};
return es5;
}
var es6 = {};
var es2015_collection = {};
var hasRequiredEs2015_collection;
function requireEs2015_collection() {
if (hasRequiredEs2015_collection) return es2015_collection;
hasRequiredEs2015_collection = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2015_collection, "__esModule", {
value: true
});
es2015_collection.es2015_collection = undefined;
const base_config_1 = requireBaseConfig();
es2015_collection.es2015_collection = {
Map: base_config_1.TYPE_VALUE,
MapConstructor: base_config_1.TYPE,
ReadonlyMap: base_config_1.TYPE,
ReadonlySet: base_config_1.TYPE,
Set: base_config_1.TYPE_VALUE,
SetConstructor: base_config_1.TYPE,
WeakMap: base_config_1.TYPE_VALUE,
WeakMapConstructor: base_config_1.TYPE,
WeakSet: base_config_1.TYPE_VALUE,
WeakSetConstructor: base_config_1.TYPE
};
return es2015_collection;
}
var es2015_core = {};
var hasRequiredEs2015_core;
function requireEs2015_core() {
if (hasRequiredEs2015_core) return es2015_core;
hasRequiredEs2015_core = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2015_core, "__esModule", {
value: true
});
es2015_core.es2015_core = undefined;
const base_config_1 = requireBaseConfig();
es2015_core.es2015_core = {
Array: base_config_1.TYPE,
ArrayConstructor: base_config_1.TYPE,
DateConstructor: base_config_1.TYPE,
Float32Array: base_config_1.TYPE,
Float64Array: base_config_1.TYPE,
Function: base_config_1.TYPE,
Int8Array: base_config_1.TYPE,
Int16Array: base_config_1.TYPE,
Int32Array: base_config_1.TYPE,
Math: base_config_1.TYPE,
NumberConstructor: base_config_1.TYPE,
ObjectConstructor: base_config_1.TYPE,
ReadonlyArray: base_config_1.TYPE,
RegExp: base_config_1.TYPE,
RegExpConstructor: base_config_1.TYPE,
String: base_config_1.TYPE,
StringConstructor: base_config_1.TYPE,
Uint8Array: base_config_1.TYPE,
Uint8ClampedArray: base_config_1.TYPE,
Uint16Array: base_config_1.TYPE,
Uint32Array: base_config_1.TYPE
};
return es2015_core;
}
var es2015_generator = {};
var es2015_iterable = {};
var es2015_symbol = {};
var hasRequiredEs2015_symbol;
function requireEs2015_symbol() {
if (hasRequiredEs2015_symbol) return es2015_symbol;
hasRequiredEs2015_symbol = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2015_symbol, "__esModule", {
value: true
});
es2015_symbol.es2015_symbol = undefined;
const base_config_1 = requireBaseConfig();
es2015_symbol.es2015_symbol = {
SymbolConstructor: base_config_1.TYPE
};
return es2015_symbol;
}
var hasRequiredEs2015_iterable;
function requireEs2015_iterable() {
if (hasRequiredEs2015_iterable) return es2015_iterable;
hasRequiredEs2015_iterable = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2015_iterable, "__esModule", {
value: true
});
es2015_iterable.es2015_iterable = undefined;
const base_config_1 = requireBaseConfig();
const es2015_symbol_1 = requireEs2015_symbol();
es2015_iterable.es2015_iterable = {
...es2015_symbol_1.es2015_symbol,
Array: base_config_1.TYPE,
ArrayConstructor: base_config_1.TYPE,
ArrayIterator: base_config_1.TYPE,
BuiltinIteratorReturn: base_config_1.TYPE,
Float32Array: base_config_1.TYPE,
Float32ArrayConstructor: base_config_1.TYPE,
Float64Array: base_config_1.TYPE,
Float64ArrayConstructor: base_config_1.TYPE,
IArguments: base_config_1.TYPE,
Int8Array: base_config_1.TYPE,
Int8ArrayConstructor: base_config_1.TYPE,
Int16Array: base_config_1.TYPE,
Int16ArrayConstructor: base_config_1.TYPE,
Int32Array: base_config_1.TYPE,
Int32ArrayConstructor: base_config_1.TYPE,
Iterable: base_config_1.TYPE,
IterableIterator: base_config_1.TYPE,
Iterator: base_config_1.TYPE,
IteratorObject: base_config_1.TYPE,
IteratorResult: base_config_1.TYPE,
IteratorReturnResult: base_config_1.TYPE,
IteratorYieldResult: base_config_1.TYPE,
Map: base_config_1.TYPE,
MapConstructor: base_config_1.TYPE,
MapIterator: base_config_1.TYPE,
Promise: base_config_1.TYPE,
PromiseConstructor: base_config_1.TYPE,
ReadonlyArray: base_config_1.TYPE,
ReadonlyMap: base_config_1.TYPE,
ReadonlySet: base_config_1.TYPE,
Set: base_config_1.TYPE,
SetConstructor: base_config_1.TYPE,
SetIterator: base_config_1.TYPE,
String: base_config_1.TYPE,
StringIterator: base_config_1.TYPE,
SymbolConstructor: base_config_1.TYPE,
Uint8Array: base_config_1.TYPE,
Uint8ArrayConstructor: base_config_1.TYPE,
Uint8ClampedArray: base_config_1.TYPE,
Uint8ClampedArrayConstructor: base_config_1.TYPE,
Uint16Array: base_config_1.TYPE,
Uint16ArrayConstructor: base_config_1.TYPE,
Uint32Array: base_config_1.TYPE,
Uint32ArrayConstructor: base_config_1.TYPE,
WeakMap: base_config_1.TYPE,
WeakMapConstructor: base_config_1.TYPE,
WeakSet: base_config_1.TYPE,
WeakSetConstructor: base_config_1.TYPE
};
return es2015_iterable;
}
var hasRequiredEs2015_generator;
function requireEs2015_generator() {
if (hasRequiredEs2015_generator) return es2015_generator;
hasRequiredEs2015_generator = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2015_generator, "__esModule", {
value: true
});
es2015_generator.es2015_generator = undefined;
const base_config_1 = requireBaseConfig();
const es2015_iterable_1 = requireEs2015_iterable();
es2015_generator.es2015_generator = {
...es2015_iterable_1.es2015_iterable,
Generator: base_config_1.TYPE,
GeneratorFunction: base_config_1.TYPE,
GeneratorFunctionConstructor: base_config_1.TYPE
};
return es2015_generator;
}
var es2015_promise = {};
var hasRequiredEs2015_promise;
function requireEs2015_promise() {
if (hasRequiredEs2015_promise) return es2015_promise;
hasRequiredEs2015_promise = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2015_promise, "__esModule", {
value: true
});
es2015_promise.es2015_promise = undefined;
const base_config_1 = requireBaseConfig();
es2015_promise.es2015_promise = {
PromiseConstructor: base_config_1.TYPE
};
return es2015_promise;
}
var es2015_proxy = {};
var hasRequiredEs2015_proxy;
function requireEs2015_proxy() {
if (hasRequiredEs2015_proxy) return es2015_proxy;
hasRequiredEs2015_proxy = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2015_proxy, "__esModule", {
value: true
});
es2015_proxy.es2015_proxy = undefined;
const base_config_1 = requireBaseConfig();
es2015_proxy.es2015_proxy = {
ProxyConstructor: base_config_1.TYPE,
ProxyHandler: base_config_1.TYPE
};
return es2015_proxy;
}
var es2015_reflect = {};
var hasRequiredEs2015_reflect;
function requireEs2015_reflect() {
if (hasRequiredEs2015_reflect) return es2015_reflect;
hasRequiredEs2015_reflect = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2015_reflect, "__esModule", {
value: true
});
es2015_reflect.es2015_reflect = undefined;
const base_config_1 = requireBaseConfig();
es2015_reflect.es2015_reflect = {
Reflect: base_config_1.TYPE_VALUE
};
return es2015_reflect;
}
var es2015_symbol_wellknown = {};
var hasRequiredEs2015_symbol_wellknown;
function requireEs2015_symbol_wellknown() {
if (hasRequiredEs2015_symbol_wellknown) return es2015_symbol_wellknown;
hasRequiredEs2015_symbol_wellknown = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2015_symbol_wellknown, "__esModule", {
value: true
});
es2015_symbol_wellknown.es2015_symbol_wellknown = undefined;
const base_config_1 = requireBaseConfig();
const es2015_symbol_1 = requireEs2015_symbol();
es2015_symbol_wellknown.es2015_symbol_wellknown = {
...es2015_symbol_1.es2015_symbol,
Array: base_config_1.TYPE,
ArrayBuffer: base_config_1.TYPE,
ArrayBufferConstructor: base_config_1.TYPE,
ArrayConstructor: base_config_1.TYPE,
DataView: base_config_1.TYPE,
Date: base_config_1.TYPE,
Float32Array: base_config_1.TYPE,
Float64Array: base_config_1.TYPE,
Function: base_config_1.TYPE,
GeneratorFunction: base_config_1.TYPE,
Int8Array: base_config_1.TYPE,
Int16Array: base_config_1.TYPE,
Int32Array: base_config_1.TYPE,
JSON: base_config_1.TYPE,
Map: base_config_1.TYPE,
MapConstructor: base_config_1.TYPE,
Math: base_config_1.TYPE,
Promise: base_config_1.TYPE,
PromiseConstructor: base_config_1.TYPE,
ReadonlyArray: base_config_1.TYPE,
RegExp: base_config_1.TYPE,
RegExpConstructor: base_config_1.TYPE,
Set: base_config_1.TYPE,
SetConstructor: base_config_1.TYPE,
String: base_config_1.TYPE,
Symbol: base_config_1.TYPE,
SymbolConstructor: base_config_1.TYPE,
Uint8Array: base_config_1.TYPE,
Uint8ClampedArray: base_config_1.TYPE,
Uint16Array: base_config_1.TYPE,
Uint32Array: base_config_1.TYPE,
WeakMap: base_config_1.TYPE,
WeakSet: base_config_1.TYPE
};
return es2015_symbol_wellknown;
}
var hasRequiredEs6;
function requireEs6() {
if (hasRequiredEs6) return es6;
hasRequiredEs6 = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es6, "__esModule", {
value: true
});
es6.es6 = undefined;
const es5_1 = requireEs5();
const es2015_collection_1 = requireEs2015_collection();
const es2015_core_1 = requireEs2015_core();
const es2015_generator_1 = requireEs2015_generator();
const es2015_iterable_1 = requireEs2015_iterable();
const es2015_promise_1 = requireEs2015_promise();
const es2015_proxy_1 = requireEs2015_proxy();
const es2015_reflect_1 = requireEs2015_reflect();
const es2015_symbol_1 = requireEs2015_symbol();
const es2015_symbol_wellknown_1 = requireEs2015_symbol_wellknown();
es6.es6 = {
...es5_1.es5,
...es2015_core_1.es2015_core,
...es2015_collection_1.es2015_collection,
...es2015_iterable_1.es2015_iterable,
...es2015_generator_1.es2015_generator,
...es2015_promise_1.es2015_promise,
...es2015_proxy_1.es2015_proxy,
...es2015_reflect_1.es2015_reflect,
...es2015_symbol_1.es2015_symbol,
...es2015_symbol_wellknown_1.es2015_symbol_wellknown
};
return es6;
}
var es7 = {};
var es2015 = {};
var hasRequiredEs2015;
function requireEs2015() {
if (hasRequiredEs2015) return es2015;
hasRequiredEs2015 = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2015, "__esModule", {
value: true
});
es2015.es2015 = undefined;
const es5_1 = requireEs5();
const es2015_collection_1 = requireEs2015_collection();
const es2015_core_1 = requireEs2015_core();
const es2015_generator_1 = requireEs2015_generator();
const es2015_iterable_1 = requireEs2015_iterable();
const es2015_promise_1 = requireEs2015_promise();
const es2015_proxy_1 = requireEs2015_proxy();
const es2015_reflect_1 = requireEs2015_reflect();
const es2015_symbol_1 = requireEs2015_symbol();
const es2015_symbol_wellknown_1 = requireEs2015_symbol_wellknown();
es2015.es2015 = {
...es5_1.es5,
...es2015_core_1.es2015_core,
...es2015_collection_1.es2015_collection,
...es2015_iterable_1.es2015_iterable,
...es2015_generator_1.es2015_generator,
...es2015_promise_1.es2015_promise,
...es2015_proxy_1.es2015_proxy,
...es2015_reflect_1.es2015_reflect,
...es2015_symbol_1.es2015_symbol,
...es2015_symbol_wellknown_1.es2015_symbol_wellknown
};
return es2015;
}
var es2016_array_include = {};
var hasRequiredEs2016_array_include;
function requireEs2016_array_include() {
if (hasRequiredEs2016_array_include) return es2016_array_include;
hasRequiredEs2016_array_include = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2016_array_include, "__esModule", {
value: true
});
es2016_array_include.es2016_array_include = undefined;
const base_config_1 = requireBaseConfig();
es2016_array_include.es2016_array_include = {
Array: base_config_1.TYPE,
Float32Array: base_config_1.TYPE,
Float64Array: base_config_1.TYPE,
Int8Array: base_config_1.TYPE,
Int16Array: base_config_1.TYPE,
Int32Array: base_config_1.TYPE,
ReadonlyArray: base_config_1.TYPE,
Uint8Array: base_config_1.TYPE,
Uint8ClampedArray: base_config_1.TYPE,
Uint16Array: base_config_1.TYPE,
Uint32Array: base_config_1.TYPE
};
return es2016_array_include;
}
var es2016_intl = {};
var hasRequiredEs2016_intl;
function requireEs2016_intl() {
if (hasRequiredEs2016_intl) return es2016_intl;
hasRequiredEs2016_intl = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2016_intl, "__esModule", {
value: true
});
es2016_intl.es2016_intl = undefined;
const base_config_1 = requireBaseConfig();
es2016_intl.es2016_intl = {
Intl: base_config_1.TYPE_VALUE
};
return es2016_intl;
}
var hasRequiredEs7;
function requireEs7() {
if (hasRequiredEs7) return es7;
hasRequiredEs7 = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es7, "__esModule", {
value: true
});
es7.es7 = undefined;
const es2015_1 = requireEs2015();
const es2016_array_include_1 = requireEs2016_array_include();
const es2016_intl_1 = requireEs2016_intl();
es7.es7 = {
...es2015_1.es2015,
...es2016_array_include_1.es2016_array_include,
...es2016_intl_1.es2016_intl
};
return es7;
}
var es2016 = {};
var hasRequiredEs2016;
function requireEs2016() {
if (hasRequiredEs2016) return es2016;
hasRequiredEs2016 = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2016, "__esModule", {
value: true
});
es2016.es2016 = undefined;
const es2015_1 = requireEs2015();
const es2016_array_include_1 = requireEs2016_array_include();
const es2016_intl_1 = requireEs2016_intl();
es2016.es2016 = {
...es2015_1.es2015,
...es2016_array_include_1.es2016_array_include,
...es2016_intl_1.es2016_intl
};
return es2016;
}
var es2016_full = {};
var scripthost = {};
var hasRequiredScripthost;
function requireScripthost() {
if (hasRequiredScripthost) return scripthost;
hasRequiredScripthost = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(scripthost, "__esModule", {
value: true
});
scripthost.scripthost = undefined;
const base_config_1 = requireBaseConfig();
scripthost.scripthost = {
ActiveXObject: base_config_1.TYPE_VALUE,
Date: base_config_1.TYPE,
DateConstructor: base_config_1.TYPE,
Enumerator: base_config_1.TYPE_VALUE,
EnumeratorConstructor: base_config_1.TYPE,
ITextWriter: base_config_1.TYPE,
SafeArray: base_config_1.TYPE_VALUE,
TextStreamBase: base_config_1.TYPE,
TextStreamReader: base_config_1.TYPE,
TextStreamWriter: base_config_1.TYPE,
VarDate: base_config_1.TYPE_VALUE,
VBArray: base_config_1.TYPE_VALUE,
VBArrayConstructor: base_config_1.TYPE
};
return scripthost;
}
var webworker_importscripts = {};
var hasRequiredWebworker_importscripts;
function requireWebworker_importscripts() {
if (hasRequiredWebworker_importscripts) return webworker_importscripts;
hasRequiredWebworker_importscripts = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(webworker_importscripts, "__esModule", {
value: true
});
webworker_importscripts.webworker_importscripts = undefined;
webworker_importscripts.webworker_importscripts = {};
return webworker_importscripts;
}
var hasRequiredEs2016_full;
function requireEs2016_full() {
if (hasRequiredEs2016_full) return es2016_full;
hasRequiredEs2016_full = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2016_full, "__esModule", {
value: true
});
es2016_full.es2016_full = undefined;
const dom_1 = requireDom();
const dom_iterable_1 = requireDom_iterable();
const es2016_1 = requireEs2016();
const scripthost_1 = requireScripthost();
const webworker_importscripts_1 = requireWebworker_importscripts();
es2016_full.es2016_full = {
...es2016_1.es2016,
...dom_1.dom,
...webworker_importscripts_1.webworker_importscripts,
...scripthost_1.scripthost,
...dom_iterable_1.dom_iterable
};
return es2016_full;
}
var es2017 = {};
var es2017_date = {};
var hasRequiredEs2017_date;
function requireEs2017_date() {
if (hasRequiredEs2017_date) return es2017_date;
hasRequiredEs2017_date = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2017_date, "__esModule", {
value: true
});
es2017_date.es2017_date = undefined;
const base_config_1 = requireBaseConfig();
es2017_date.es2017_date = {
DateConstructor: base_config_1.TYPE
};
return es2017_date;
}
var es2017_intl = {};
var hasRequiredEs2017_intl;
function requireEs2017_intl() {
if (hasRequiredEs2017_intl) return es2017_intl;
hasRequiredEs2017_intl = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2017_intl, "__esModule", {
value: true
});
es2017_intl.es2017_intl = undefined;
const base_config_1 = requireBaseConfig();
es2017_intl.es2017_intl = {
Intl: base_config_1.TYPE_VALUE
};
return es2017_intl;
}
var es2017_object = {};
var hasRequiredEs2017_object;
function requireEs2017_object() {
if (hasRequiredEs2017_object) return es2017_object;
hasRequiredEs2017_object = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2017_object, "__esModule", {
value: true
});
es2017_object.es2017_object = undefined;
const base_config_1 = requireBaseConfig();
es2017_object.es2017_object = {
ObjectConstructor: base_config_1.TYPE
};
return es2017_object;
}
var es2017_sharedmemory = {};
var hasRequiredEs2017_sharedmemory;
function requireEs2017_sharedmemory() {
if (hasRequiredEs2017_sharedmemory) return es2017_sharedmemory;
hasRequiredEs2017_sharedmemory = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2017_sharedmemory, "__esModule", {
value: true
});
es2017_sharedmemory.es2017_sharedmemory = undefined;
const base_config_1 = requireBaseConfig();
const es2015_symbol_1 = requireEs2015_symbol();
const es2015_symbol_wellknown_1 = requireEs2015_symbol_wellknown();
es2017_sharedmemory.es2017_sharedmemory = {
...es2015_symbol_1.es2015_symbol,
...es2015_symbol_wellknown_1.es2015_symbol_wellknown,
ArrayBufferTypes: base_config_1.TYPE,
Atomics: base_config_1.TYPE_VALUE,
SharedArrayBuffer: base_config_1.TYPE_VALUE,
SharedArrayBufferConstructor: base_config_1.TYPE
};
return es2017_sharedmemory;
}
var es2017_string = {};
var hasRequiredEs2017_string;
function requireEs2017_string() {
if (hasRequiredEs2017_string) return es2017_string;
hasRequiredEs2017_string = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2017_string, "__esModule", {
value: true
});
es2017_string.es2017_string = undefined;
const base_config_1 = requireBaseConfig();
es2017_string.es2017_string = {
String: base_config_1.TYPE
};
return es2017_string;
}
var es2017_typedarrays = {};
var hasRequiredEs2017_typedarrays;
function requireEs2017_typedarrays() {
if (hasRequiredEs2017_typedarrays) return es2017_typedarrays;
hasRequiredEs2017_typedarrays = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2017_typedarrays, "__esModule", {
value: true
});
es2017_typedarrays.es2017_typedarrays = undefined;
const base_config_1 = requireBaseConfig();
es2017_typedarrays.es2017_typedarrays = {
Float32ArrayConstructor: base_config_1.TYPE,
Float64ArrayConstructor: base_config_1.TYPE,
Int8ArrayConstructor: base_config_1.TYPE,
Int16ArrayConstructor: base_config_1.TYPE,
Int32ArrayConstructor: base_config_1.TYPE,
Uint8ArrayConstructor: base_config_1.TYPE,
Uint8ClampedArrayConstructor: base_config_1.TYPE,
Uint16ArrayConstructor: base_config_1.TYPE,
Uint32ArrayConstructor: base_config_1.TYPE
};
return es2017_typedarrays;
}
var hasRequiredEs2017;
function requireEs2017() {
if (hasRequiredEs2017) return es2017;
hasRequiredEs2017 = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2017, "__esModule", {
value: true
});
es2017.es2017 = undefined;
const es2016_1 = requireEs2016();
const es2017_date_1 = requireEs2017_date();
const es2017_intl_1 = requireEs2017_intl();
const es2017_object_1 = requireEs2017_object();
const es2017_sharedmemory_1 = requireEs2017_sharedmemory();
const es2017_string_1 = requireEs2017_string();
const es2017_typedarrays_1 = requireEs2017_typedarrays();
es2017.es2017 = {
...es2016_1.es2016,
...es2017_object_1.es2017_object,
...es2017_sharedmemory_1.es2017_sharedmemory,
...es2017_string_1.es2017_string,
...es2017_intl_1.es2017_intl,
...es2017_typedarrays_1.es2017_typedarrays,
...es2017_date_1.es2017_date
};
return es2017;
}
var es2017_full = {};
var hasRequiredEs2017_full;
function requireEs2017_full() {
if (hasRequiredEs2017_full) return es2017_full;
hasRequiredEs2017_full = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2017_full, "__esModule", {
value: true
});
es2017_full.es2017_full = undefined;
const dom_1 = requireDom();
const dom_iterable_1 = requireDom_iterable();
const es2017_1 = requireEs2017();
const scripthost_1 = requireScripthost();
const webworker_importscripts_1 = requireWebworker_importscripts();
es2017_full.es2017_full = {
...es2017_1.es2017,
...dom_1.dom,
...webworker_importscripts_1.webworker_importscripts,
...scripthost_1.scripthost,
...dom_iterable_1.dom_iterable
};
return es2017_full;
}
var es2018 = {};
var es2018_asyncgenerator = {};
var es2018_asynciterable = {};
var hasRequiredEs2018_asynciterable;
function requireEs2018_asynciterable() {
if (hasRequiredEs2018_asynciterable) return es2018_asynciterable;
hasRequiredEs2018_asynciterable = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2018_asynciterable, "__esModule", {
value: true
});
es2018_asynciterable.es2018_asynciterable = undefined;
const base_config_1 = requireBaseConfig();
const es2015_iterable_1 = requireEs2015_iterable();
const es2015_symbol_1 = requireEs2015_symbol();
es2018_asynciterable.es2018_asynciterable = {
...es2015_symbol_1.es2015_symbol,
...es2015_iterable_1.es2015_iterable,
AsyncIterable: base_config_1.TYPE,
AsyncIterableIterator: base_config_1.TYPE,
AsyncIterator: base_config_1.TYPE,
AsyncIteratorObject: base_config_1.TYPE,
SymbolConstructor: base_config_1.TYPE
};
return es2018_asynciterable;
}
var hasRequiredEs2018_asyncgenerator;
function requireEs2018_asyncgenerator() {
if (hasRequiredEs2018_asyncgenerator) return es2018_asyncgenerator;
hasRequiredEs2018_asyncgenerator = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2018_asyncgenerator, "__esModule", {
value: true
});
es2018_asyncgenerator.es2018_asyncgenerator = undefined;
const base_config_1 = requireBaseConfig();
const es2018_asynciterable_1 = requireEs2018_asynciterable();
es2018_asyncgenerator.es2018_asyncgenerator = {
...es2018_asynciterable_1.es2018_asynciterable,
AsyncGenerator: base_config_1.TYPE,
AsyncGeneratorFunction: base_config_1.TYPE,
AsyncGeneratorFunctionConstructor: base_config_1.TYPE
};
return es2018_asyncgenerator;
}
var es2018_intl = {};
var hasRequiredEs2018_intl;
function requireEs2018_intl() {
if (hasRequiredEs2018_intl) return es2018_intl;
hasRequiredEs2018_intl = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2018_intl, "__esModule", {
value: true
});
es2018_intl.es2018_intl = undefined;
const base_config_1 = requireBaseConfig();
es2018_intl.es2018_intl = {
Intl: base_config_1.TYPE_VALUE
};
return es2018_intl;
}
var es2018_promise = {};
var hasRequiredEs2018_promise;
function requireEs2018_promise() {
if (hasRequiredEs2018_promise) return es2018_promise;
hasRequiredEs2018_promise = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2018_promise, "__esModule", {
value: true
});
es2018_promise.es2018_promise = undefined;
const base_config_1 = requireBaseConfig();
es2018_promise.es2018_promise = {
Promise: base_config_1.TYPE
};
return es2018_promise;
}
var es2018_regexp = {};
var hasRequiredEs2018_regexp;
function requireEs2018_regexp() {
if (hasRequiredEs2018_regexp) return es2018_regexp;
hasRequiredEs2018_regexp = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2018_regexp, "__esModule", {
value: true
});
es2018_regexp.es2018_regexp = undefined;
const base_config_1 = requireBaseConfig();
es2018_regexp.es2018_regexp = {
RegExp: base_config_1.TYPE,
RegExpExecArray: base_config_1.TYPE,
RegExpMatchArray: base_config_1.TYPE
};
return es2018_regexp;
}
var hasRequiredEs2018;
function requireEs2018() {
if (hasRequiredEs2018) return es2018;
hasRequiredEs2018 = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2018, "__esModule", {
value: true
});
es2018.es2018 = undefined;
const es2017_1 = requireEs2017();
const es2018_asyncgenerator_1 = requireEs2018_asyncgenerator();
const es2018_asynciterable_1 = requireEs2018_asynciterable();
const es2018_intl_1 = requireEs2018_intl();
const es2018_promise_1 = requireEs2018_promise();
const es2018_regexp_1 = requireEs2018_regexp();
es2018.es2018 = {
...es2017_1.es2017,
...es2018_asynciterable_1.es2018_asynciterable,
...es2018_asyncgenerator_1.es2018_asyncgenerator,
...es2018_promise_1.es2018_promise,
...es2018_regexp_1.es2018_regexp,
...es2018_intl_1.es2018_intl
};
return es2018;
}
var es2018_full = {};
var hasRequiredEs2018_full;
function requireEs2018_full() {
if (hasRequiredEs2018_full) return es2018_full;
hasRequiredEs2018_full = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2018_full, "__esModule", {
value: true
});
es2018_full.es2018_full = undefined;
const dom_1 = requireDom();
const dom_asynciterable_1 = requireDom_asynciterable();
const dom_iterable_1 = requireDom_iterable();
const es2018_1 = requireEs2018();
const scripthost_1 = requireScripthost();
const webworker_importscripts_1 = requireWebworker_importscripts();
es2018_full.es2018_full = {
...es2018_1.es2018,
...dom_1.dom,
...webworker_importscripts_1.webworker_importscripts,
...scripthost_1.scripthost,
...dom_iterable_1.dom_iterable,
...dom_asynciterable_1.dom_asynciterable
};
return es2018_full;
}
var es2019 = {};
var es2019_array = {};
var hasRequiredEs2019_array;
function requireEs2019_array() {
if (hasRequiredEs2019_array) return es2019_array;
hasRequiredEs2019_array = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2019_array, "__esModule", {
value: true
});
es2019_array.es2019_array = undefined;
const base_config_1 = requireBaseConfig();
es2019_array.es2019_array = {
Array: base_config_1.TYPE,
FlatArray: base_config_1.TYPE,
ReadonlyArray: base_config_1.TYPE
};
return es2019_array;
}
var es2019_intl = {};
var hasRequiredEs2019_intl;
function requireEs2019_intl() {
if (hasRequiredEs2019_intl) return es2019_intl;
hasRequiredEs2019_intl = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2019_intl, "__esModule", {
value: true
});
es2019_intl.es2019_intl = undefined;
const base_config_1 = requireBaseConfig();
es2019_intl.es2019_intl = {
Intl: base_config_1.TYPE_VALUE
};
return es2019_intl;
}
var es2019_object = {};
var hasRequiredEs2019_object;
function requireEs2019_object() {
if (hasRequiredEs2019_object) return es2019_object;
hasRequiredEs2019_object = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2019_object, "__esModule", {
value: true
});
es2019_object.es2019_object = undefined;
const base_config_1 = requireBaseConfig();
const es2015_iterable_1 = requireEs2015_iterable();
es2019_object.es2019_object = {
...es2015_iterable_1.es2015_iterable,
ObjectConstructor: base_config_1.TYPE
};
return es2019_object;
}
var es2019_string = {};
var hasRequiredEs2019_string;
function requireEs2019_string() {
if (hasRequiredEs2019_string) return es2019_string;
hasRequiredEs2019_string = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2019_string, "__esModule", {
value: true
});
es2019_string.es2019_string = undefined;
const base_config_1 = requireBaseConfig();
es2019_string.es2019_string = {
String: base_config_1.TYPE
};
return es2019_string;
}
var es2019_symbol = {};
var hasRequiredEs2019_symbol;
function requireEs2019_symbol() {
if (hasRequiredEs2019_symbol) return es2019_symbol;
hasRequiredEs2019_symbol = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2019_symbol, "__esModule", {
value: true
});
es2019_symbol.es2019_symbol = undefined;
const base_config_1 = requireBaseConfig();
es2019_symbol.es2019_symbol = {
Symbol: base_config_1.TYPE
};
return es2019_symbol;
}
var hasRequiredEs2019;
function requireEs2019() {
if (hasRequiredEs2019) return es2019;
hasRequiredEs2019 = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2019, "__esModule", {
value: true
});
es2019.es2019 = undefined;
const es2018_1 = requireEs2018();
const es2019_array_1 = requireEs2019_array();
const es2019_intl_1 = requireEs2019_intl();
const es2019_object_1 = requireEs2019_object();
const es2019_string_1 = requireEs2019_string();
const es2019_symbol_1 = requireEs2019_symbol();
es2019.es2019 = {
...es2018_1.es2018,
...es2019_array_1.es2019_array,
...es2019_object_1.es2019_object,
...es2019_string_1.es2019_string,
...es2019_symbol_1.es2019_symbol,
...es2019_intl_1.es2019_intl
};
return es2019;
}
var es2019_full = {};
var hasRequiredEs2019_full;
function requireEs2019_full() {
if (hasRequiredEs2019_full) return es2019_full;
hasRequiredEs2019_full = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2019_full, "__esModule", {
value: true
});
es2019_full.es2019_full = undefined;
const dom_1 = requireDom();
const dom_asynciterable_1 = requireDom_asynciterable();
const dom_iterable_1 = requireDom_iterable();
const es2019_1 = requireEs2019();
const scripthost_1 = requireScripthost();
const webworker_importscripts_1 = requireWebworker_importscripts();
es2019_full.es2019_full = {
...es2019_1.es2019,
...dom_1.dom,
...webworker_importscripts_1.webworker_importscripts,
...scripthost_1.scripthost,
...dom_iterable_1.dom_iterable,
...dom_asynciterable_1.dom_asynciterable
};
return es2019_full;
}
var es2020 = {};
var es2020_bigint = {};
var es2020_intl = {};
var hasRequiredEs2020_intl;
function requireEs2020_intl() {
if (hasRequiredEs2020_intl) return es2020_intl;
hasRequiredEs2020_intl = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2020_intl, "__esModule", {
value: true
});
es2020_intl.es2020_intl = undefined;
const base_config_1 = requireBaseConfig();
const es2018_intl_1 = requireEs2018_intl();
es2020_intl.es2020_intl = {
...es2018_intl_1.es2018_intl,
Intl: base_config_1.TYPE_VALUE
};
return es2020_intl;
}
var hasRequiredEs2020_bigint;
function requireEs2020_bigint() {
if (hasRequiredEs2020_bigint) return es2020_bigint;
hasRequiredEs2020_bigint = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2020_bigint, "__esModule", {
value: true
});
es2020_bigint.es2020_bigint = undefined;
const base_config_1 = requireBaseConfig();
const es2020_intl_1 = requireEs2020_intl();
es2020_bigint.es2020_bigint = {
...es2020_intl_1.es2020_intl,
BigInt: base_config_1.TYPE_VALUE,
BigInt64Array: base_config_1.TYPE_VALUE,
BigInt64ArrayConstructor: base_config_1.TYPE,
BigIntConstructor: base_config_1.TYPE,
BigIntToLocaleStringOptions: base_config_1.TYPE,
BigUint64Array: base_config_1.TYPE_VALUE,
BigUint64ArrayConstructor: base_config_1.TYPE,
DataView: base_config_1.TYPE,
Intl: base_config_1.TYPE_VALUE
};
return es2020_bigint;
}
var es2020_date = {};
var hasRequiredEs2020_date;
function requireEs2020_date() {
if (hasRequiredEs2020_date) return es2020_date;
hasRequiredEs2020_date = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2020_date, "__esModule", {
value: true
});
es2020_date.es2020_date = undefined;
const base_config_1 = requireBaseConfig();
const es2020_intl_1 = requireEs2020_intl();
es2020_date.es2020_date = {
...es2020_intl_1.es2020_intl,
Date: base_config_1.TYPE
};
return es2020_date;
}
var es2020_number = {};
var hasRequiredEs2020_number;
function requireEs2020_number() {
if (hasRequiredEs2020_number) return es2020_number;
hasRequiredEs2020_number = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2020_number, "__esModule", {
value: true
});
es2020_number.es2020_number = undefined;
const base_config_1 = requireBaseConfig();
const es2020_intl_1 = requireEs2020_intl();
es2020_number.es2020_number = {
...es2020_intl_1.es2020_intl,
Number: base_config_1.TYPE
};
return es2020_number;
}
var es2020_promise = {};
var hasRequiredEs2020_promise;
function requireEs2020_promise() {
if (hasRequiredEs2020_promise) return es2020_promise;
hasRequiredEs2020_promise = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2020_promise, "__esModule", {
value: true
});
es2020_promise.es2020_promise = undefined;
const base_config_1 = requireBaseConfig();
es2020_promise.es2020_promise = {
PromiseConstructor: base_config_1.TYPE,
PromiseFulfilledResult: base_config_1.TYPE,
PromiseRejectedResult: base_config_1.TYPE,
PromiseSettledResult: base_config_1.TYPE
};
return es2020_promise;
}
var es2020_sharedmemory = {};
var hasRequiredEs2020_sharedmemory;
function requireEs2020_sharedmemory() {
if (hasRequiredEs2020_sharedmemory) return es2020_sharedmemory;
hasRequiredEs2020_sharedmemory = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2020_sharedmemory, "__esModule", {
value: true
});
es2020_sharedmemory.es2020_sharedmemory = undefined;
const base_config_1 = requireBaseConfig();
es2020_sharedmemory.es2020_sharedmemory = {
Atomics: base_config_1.TYPE
};
return es2020_sharedmemory;
}
var es2020_string = {};
var es2020_symbol_wellknown = {};
var hasRequiredEs2020_symbol_wellknown;
function requireEs2020_symbol_wellknown() {
if (hasRequiredEs2020_symbol_wellknown) return es2020_symbol_wellknown;
hasRequiredEs2020_symbol_wellknown = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2020_symbol_wellknown, "__esModule", {
value: true
});
es2020_symbol_wellknown.es2020_symbol_wellknown = undefined;
const base_config_1 = requireBaseConfig();
const es2015_iterable_1 = requireEs2015_iterable();
const es2015_symbol_1 = requireEs2015_symbol();
es2020_symbol_wellknown.es2020_symbol_wellknown = {
...es2015_iterable_1.es2015_iterable,
...es2015_symbol_1.es2015_symbol,
RegExp: base_config_1.TYPE,
RegExpStringIterator: base_config_1.TYPE,
SymbolConstructor: base_config_1.TYPE
};
return es2020_symbol_wellknown;
}
var hasRequiredEs2020_string;
function requireEs2020_string() {
if (hasRequiredEs2020_string) return es2020_string;
hasRequiredEs2020_string = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2020_string, "__esModule", {
value: true
});
es2020_string.es2020_string = undefined;
const base_config_1 = requireBaseConfig();
const es2020_symbol_wellknown_1 = requireEs2020_symbol_wellknown();
es2020_string.es2020_string = {
...es2020_symbol_wellknown_1.es2020_symbol_wellknown,
String: base_config_1.TYPE
};
return es2020_string;
}
var hasRequiredEs2020;
function requireEs2020() {
if (hasRequiredEs2020) return es2020;
hasRequiredEs2020 = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2020, "__esModule", {
value: true
});
es2020.es2020 = undefined;
const es2019_1 = requireEs2019();
const es2020_bigint_1 = requireEs2020_bigint();
const es2020_date_1 = requireEs2020_date();
const es2020_intl_1 = requireEs2020_intl();
const es2020_number_1 = requireEs2020_number();
const es2020_promise_1 = requireEs2020_promise();
const es2020_sharedmemory_1 = requireEs2020_sharedmemory();
const es2020_string_1 = requireEs2020_string();
const es2020_symbol_wellknown_1 = requireEs2020_symbol_wellknown();
es2020.es2020 = {
...es2019_1.es2019,
...es2020_bigint_1.es2020_bigint,
...es2020_date_1.es2020_date,
...es2020_number_1.es2020_number,
...es2020_promise_1.es2020_promise,
...es2020_sharedmemory_1.es2020_sharedmemory,
...es2020_string_1.es2020_string,
...es2020_symbol_wellknown_1.es2020_symbol_wellknown,
...es2020_intl_1.es2020_intl
};
return es2020;
}
var es2020_full = {};
var hasRequiredEs2020_full;
function requireEs2020_full() {
if (hasRequiredEs2020_full) return es2020_full;
hasRequiredEs2020_full = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2020_full, "__esModule", {
value: true
});
es2020_full.es2020_full = undefined;
const dom_1 = requireDom();
const dom_asynciterable_1 = requireDom_asynciterable();
const dom_iterable_1 = requireDom_iterable();
const es2020_1 = requireEs2020();
const scripthost_1 = requireScripthost();
const webworker_importscripts_1 = requireWebworker_importscripts();
es2020_full.es2020_full = {
...es2020_1.es2020,
...dom_1.dom,
...webworker_importscripts_1.webworker_importscripts,
...scripthost_1.scripthost,
...dom_iterable_1.dom_iterable,
...dom_asynciterable_1.dom_asynciterable
};
return es2020_full;
}
var es2021 = {};
var es2021_intl = {};
var hasRequiredEs2021_intl;
function requireEs2021_intl() {
if (hasRequiredEs2021_intl) return es2021_intl;
hasRequiredEs2021_intl = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2021_intl, "__esModule", {
value: true
});
es2021_intl.es2021_intl = undefined;
const base_config_1 = requireBaseConfig();
es2021_intl.es2021_intl = {
Intl: base_config_1.TYPE_VALUE
};
return es2021_intl;
}
var es2021_promise = {};
var hasRequiredEs2021_promise;
function requireEs2021_promise() {
if (hasRequiredEs2021_promise) return es2021_promise;
hasRequiredEs2021_promise = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2021_promise, "__esModule", {
value: true
});
es2021_promise.es2021_promise = undefined;
const base_config_1 = requireBaseConfig();
es2021_promise.es2021_promise = {
AggregateError: base_config_1.TYPE_VALUE,
AggregateErrorConstructor: base_config_1.TYPE,
PromiseConstructor: base_config_1.TYPE
};
return es2021_promise;
}
var es2021_string = {};
var hasRequiredEs2021_string;
function requireEs2021_string() {
if (hasRequiredEs2021_string) return es2021_string;
hasRequiredEs2021_string = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2021_string, "__esModule", {
value: true
});
es2021_string.es2021_string = undefined;
const base_config_1 = requireBaseConfig();
es2021_string.es2021_string = {
String: base_config_1.TYPE
};
return es2021_string;
}
var es2021_weakref = {};
var hasRequiredEs2021_weakref;
function requireEs2021_weakref() {
if (hasRequiredEs2021_weakref) return es2021_weakref;
hasRequiredEs2021_weakref = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2021_weakref, "__esModule", {
value: true
});
es2021_weakref.es2021_weakref = undefined;
const base_config_1 = requireBaseConfig();
es2021_weakref.es2021_weakref = {
FinalizationRegistry: base_config_1.TYPE_VALUE,
FinalizationRegistryConstructor: base_config_1.TYPE,
WeakRef: base_config_1.TYPE_VALUE,
WeakRefConstructor: base_config_1.TYPE
};
return es2021_weakref;
}
var hasRequiredEs2021;
function requireEs2021() {
if (hasRequiredEs2021) return es2021;
hasRequiredEs2021 = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2021, "__esModule", {
value: true
});
es2021.es2021 = undefined;
const es2020_1 = requireEs2020();
const es2021_intl_1 = requireEs2021_intl();
const es2021_promise_1 = requireEs2021_promise();
const es2021_string_1 = requireEs2021_string();
const es2021_weakref_1 = requireEs2021_weakref();
es2021.es2021 = {
...es2020_1.es2020,
...es2021_promise_1.es2021_promise,
...es2021_string_1.es2021_string,
...es2021_weakref_1.es2021_weakref,
...es2021_intl_1.es2021_intl
};
return es2021;
}
var es2021_full = {};
var hasRequiredEs2021_full;
function requireEs2021_full() {
if (hasRequiredEs2021_full) return es2021_full;
hasRequiredEs2021_full = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2021_full, "__esModule", {
value: true
});
es2021_full.es2021_full = undefined;
const dom_1 = requireDom();
const dom_asynciterable_1 = requireDom_asynciterable();
const dom_iterable_1 = requireDom_iterable();
const es2021_1 = requireEs2021();
const scripthost_1 = requireScripthost();
const webworker_importscripts_1 = requireWebworker_importscripts();
es2021_full.es2021_full = {
...es2021_1.es2021,
...dom_1.dom,
...webworker_importscripts_1.webworker_importscripts,
...scripthost_1.scripthost,
...dom_iterable_1.dom_iterable,
...dom_asynciterable_1.dom_asynciterable
};
return es2021_full;
}
var es2022 = {};
var es2022_array = {};
var hasRequiredEs2022_array;
function requireEs2022_array() {
if (hasRequiredEs2022_array) return es2022_array;
hasRequiredEs2022_array = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2022_array, "__esModule", {
value: true
});
es2022_array.es2022_array = undefined;
const base_config_1 = requireBaseConfig();
es2022_array.es2022_array = {
Array: base_config_1.TYPE,
BigInt64Array: base_config_1.TYPE,
BigUint64Array: base_config_1.TYPE,
Float32Array: base_config_1.TYPE,
Float64Array: base_config_1.TYPE,
Int8Array: base_config_1.TYPE,
Int16Array: base_config_1.TYPE,
Int32Array: base_config_1.TYPE,
ReadonlyArray: base_config_1.TYPE,
Uint8Array: base_config_1.TYPE,
Uint8ClampedArray: base_config_1.TYPE,
Uint16Array: base_config_1.TYPE,
Uint32Array: base_config_1.TYPE
};
return es2022_array;
}
var es2022_error = {};
var hasRequiredEs2022_error;
function requireEs2022_error() {
if (hasRequiredEs2022_error) return es2022_error;
hasRequiredEs2022_error = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2022_error, "__esModule", {
value: true
});
es2022_error.es2022_error = undefined;
const base_config_1 = requireBaseConfig();
es2022_error.es2022_error = {
AggregateErrorConstructor: base_config_1.TYPE,
Error: base_config_1.TYPE,
ErrorConstructor: base_config_1.TYPE,
ErrorOptions: base_config_1.TYPE,
EvalErrorConstructor: base_config_1.TYPE,
RangeErrorConstructor: base_config_1.TYPE,
ReferenceErrorConstructor: base_config_1.TYPE,
SyntaxErrorConstructor: base_config_1.TYPE,
TypeErrorConstructor: base_config_1.TYPE,
URIErrorConstructor: base_config_1.TYPE
};
return es2022_error;
}
var es2022_intl = {};
var hasRequiredEs2022_intl;
function requireEs2022_intl() {
if (hasRequiredEs2022_intl) return es2022_intl;
hasRequiredEs2022_intl = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2022_intl, "__esModule", {
value: true
});
es2022_intl.es2022_intl = undefined;
const base_config_1 = requireBaseConfig();
es2022_intl.es2022_intl = {
Intl: base_config_1.TYPE_VALUE
};
return es2022_intl;
}
var es2022_object = {};
var hasRequiredEs2022_object;
function requireEs2022_object() {
if (hasRequiredEs2022_object) return es2022_object;
hasRequiredEs2022_object = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2022_object, "__esModule", {
value: true
});
es2022_object.es2022_object = undefined;
const base_config_1 = requireBaseConfig();
es2022_object.es2022_object = {
ObjectConstructor: base_config_1.TYPE
};
return es2022_object;
}
var es2022_regexp = {};
var hasRequiredEs2022_regexp;
function requireEs2022_regexp() {
if (hasRequiredEs2022_regexp) return es2022_regexp;
hasRequiredEs2022_regexp = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2022_regexp, "__esModule", {
value: true
});
es2022_regexp.es2022_regexp = undefined;
const base_config_1 = requireBaseConfig();
es2022_regexp.es2022_regexp = {
RegExp: base_config_1.TYPE,
RegExpExecArray: base_config_1.TYPE,
RegExpIndicesArray: base_config_1.TYPE,
RegExpMatchArray: base_config_1.TYPE
};
return es2022_regexp;
}
var es2022_sharedmemory = {};
var hasRequiredEs2022_sharedmemory;
function requireEs2022_sharedmemory() {
if (hasRequiredEs2022_sharedmemory) return es2022_sharedmemory;
hasRequiredEs2022_sharedmemory = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2022_sharedmemory, "__esModule", {
value: true
});
es2022_sharedmemory.es2022_sharedmemory = undefined;
const base_config_1 = requireBaseConfig();
es2022_sharedmemory.es2022_sharedmemory = {
Atomics: base_config_1.TYPE
};
return es2022_sharedmemory;
}
var es2022_string = {};
var hasRequiredEs2022_string;
function requireEs2022_string() {
if (hasRequiredEs2022_string) return es2022_string;
hasRequiredEs2022_string = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2022_string, "__esModule", {
value: true
});
es2022_string.es2022_string = undefined;
const base_config_1 = requireBaseConfig();
es2022_string.es2022_string = {
String: base_config_1.TYPE
};
return es2022_string;
}
var hasRequiredEs2022;
function requireEs2022() {
if (hasRequiredEs2022) return es2022;
hasRequiredEs2022 = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2022, "__esModule", {
value: true
});
es2022.es2022 = undefined;
const es2021_1 = requireEs2021();
const es2022_array_1 = requireEs2022_array();
const es2022_error_1 = requireEs2022_error();
const es2022_intl_1 = requireEs2022_intl();
const es2022_object_1 = requireEs2022_object();
const es2022_regexp_1 = requireEs2022_regexp();
const es2022_sharedmemory_1 = requireEs2022_sharedmemory();
const es2022_string_1 = requireEs2022_string();
es2022.es2022 = {
...es2021_1.es2021,
...es2022_array_1.es2022_array,
...es2022_error_1.es2022_error,
...es2022_intl_1.es2022_intl,
...es2022_object_1.es2022_object,
...es2022_sharedmemory_1.es2022_sharedmemory,
...es2022_string_1.es2022_string,
...es2022_regexp_1.es2022_regexp
};
return es2022;
}
var es2022_full = {};
var hasRequiredEs2022_full;
function requireEs2022_full() {
if (hasRequiredEs2022_full) return es2022_full;
hasRequiredEs2022_full = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2022_full, "__esModule", {
value: true
});
es2022_full.es2022_full = undefined;
const dom_1 = requireDom();
const dom_asynciterable_1 = requireDom_asynciterable();
const dom_iterable_1 = requireDom_iterable();
const es2022_1 = requireEs2022();
const scripthost_1 = requireScripthost();
const webworker_importscripts_1 = requireWebworker_importscripts();
es2022_full.es2022_full = {
...es2022_1.es2022,
...dom_1.dom,
...webworker_importscripts_1.webworker_importscripts,
...scripthost_1.scripthost,
...dom_iterable_1.dom_iterable,
...dom_asynciterable_1.dom_asynciterable
};
return es2022_full;
}
var es2023 = {};
var es2023_array = {};
var hasRequiredEs2023_array;
function requireEs2023_array() {
if (hasRequiredEs2023_array) return es2023_array;
hasRequiredEs2023_array = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2023_array, "__esModule", {
value: true
});
es2023_array.es2023_array = undefined;
const base_config_1 = requireBaseConfig();
es2023_array.es2023_array = {
Array: base_config_1.TYPE,
BigInt64Array: base_config_1.TYPE,
BigUint64Array: base_config_1.TYPE,
Float32Array: base_config_1.TYPE,
Float64Array: base_config_1.TYPE,
Int8Array: base_config_1.TYPE,
Int16Array: base_config_1.TYPE,
Int32Array: base_config_1.TYPE,
ReadonlyArray: base_config_1.TYPE,
Uint8Array: base_config_1.TYPE,
Uint8ClampedArray: base_config_1.TYPE,
Uint16Array: base_config_1.TYPE,
Uint32Array: base_config_1.TYPE
};
return es2023_array;
}
var es2023_collection = {};
var hasRequiredEs2023_collection;
function requireEs2023_collection() {
if (hasRequiredEs2023_collection) return es2023_collection;
hasRequiredEs2023_collection = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2023_collection, "__esModule", {
value: true
});
es2023_collection.es2023_collection = undefined;
const base_config_1 = requireBaseConfig();
es2023_collection.es2023_collection = {
WeakKeyTypes: base_config_1.TYPE
};
return es2023_collection;
}
var es2023_intl = {};
var hasRequiredEs2023_intl;
function requireEs2023_intl() {
if (hasRequiredEs2023_intl) return es2023_intl;
hasRequiredEs2023_intl = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2023_intl, "__esModule", {
value: true
});
es2023_intl.es2023_intl = undefined;
const base_config_1 = requireBaseConfig();
es2023_intl.es2023_intl = {
Intl: base_config_1.TYPE_VALUE
};
return es2023_intl;
}
var hasRequiredEs2023;
function requireEs2023() {
if (hasRequiredEs2023) return es2023;
hasRequiredEs2023 = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2023, "__esModule", {
value: true
});
es2023.es2023 = undefined;
const es2022_1 = requireEs2022();
const es2023_array_1 = requireEs2023_array();
const es2023_collection_1 = requireEs2023_collection();
const es2023_intl_1 = requireEs2023_intl();
es2023.es2023 = {
...es2022_1.es2022,
...es2023_array_1.es2023_array,
...es2023_collection_1.es2023_collection,
...es2023_intl_1.es2023_intl
};
return es2023;
}
var es2023_full = {};
var hasRequiredEs2023_full;
function requireEs2023_full() {
if (hasRequiredEs2023_full) return es2023_full;
hasRequiredEs2023_full = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(es2023_full, "__esModule", {
value: true
});
es2023_full.es2023_full = undefined;
const dom_1 = requireDom();
const dom_asynciterable_1 = requireDom_asynciterable();
const dom_iterable_1 = requireDom_iterable();
const es2023_1 = requireEs2023();
const scripthost_1 = requireScripthost();
const webworker_importscripts_1 = requireWebworker_importscripts();
es2023_full.es2023_full = {
...es2023_1.es2023,
...dom_1.dom,
...webworker_importscripts_1.webworker_importscripts,
...scripthost_1.scripthost,
...dom_iterable_1.dom_iterable,
...dom_asynciterable_1.dom_asynciterable
};
return es2023_full;
}
var esnext = {};
var esnext_array = {};
var hasRequiredEsnext_array;
function requireEsnext_array() {
if (hasRequiredEsnext_array) return esnext_array;
hasRequiredEsnext_array = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(esnext_array, "__esModule", {
value: true
});
esnext_array.esnext_array = undefined;
const base_config_1 = requireBaseConfig();
esnext_array.esnext_array = {
ArrayConstructor: base_config_1.TYPE
};
return esnext_array;
}
var esnext_collection = {};
var hasRequiredEsnext_collection;
function requireEsnext_collection() {
if (hasRequiredEsnext_collection) return esnext_collection;
hasRequiredEsnext_collection = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(esnext_collection, "__esModule", {
value: true
});
esnext_collection.esnext_collection = undefined;
const base_config_1 = requireBaseConfig();
esnext_collection.esnext_collection = {
MapConstructor: base_config_1.TYPE,
ReadonlySet: base_config_1.TYPE,
ReadonlySetLike: base_config_1.TYPE,
Set: base_config_1.TYPE
};
return esnext_collection;
}
var esnext_decorators = {};
var hasRequiredEsnext_decorators;
function requireEsnext_decorators() {
if (hasRequiredEsnext_decorators) return esnext_decorators;
hasRequiredEsnext_decorators = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(esnext_decorators, "__esModule", {
value: true
});
esnext_decorators.esnext_decorators = undefined;
const base_config_1 = requireBaseConfig();
const decorators_1 = requireDecorators();
const es2015_symbol_1 = requireEs2015_symbol();
esnext_decorators.esnext_decorators = {
...es2015_symbol_1.es2015_symbol,
...decorators_1.decorators,
Function: base_config_1.TYPE,
SymbolConstructor: base_config_1.TYPE
};
return esnext_decorators;
}
var esnext_disposable = {};
var hasRequiredEsnext_disposable;
function requireEsnext_disposable() {
if (hasRequiredEsnext_disposable) return esnext_disposable;
hasRequiredEsnext_disposable = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(esnext_disposable, "__esModule", {
value: true
});
esnext_disposable.esnext_disposable = undefined;
const base_config_1 = requireBaseConfig();
const es2015_iterable_1 = requireEs2015_iterable();
const es2015_symbol_1 = requireEs2015_symbol();
const es2018_asynciterable_1 = requireEs2018_asynciterable();
esnext_disposable.esnext_disposable = {
...es2015_symbol_1.es2015_symbol,
...es2015_iterable_1.es2015_iterable,
...es2018_asynciterable_1.es2018_asynciterable,
AsyncDisposable: base_config_1.TYPE,
AsyncDisposableStack: base_config_1.TYPE_VALUE,
AsyncDisposableStackConstructor: base_config_1.TYPE,
AsyncIteratorObject: base_config_1.TYPE,
Disposable: base_config_1.TYPE,
DisposableStack: base_config_1.TYPE_VALUE,
DisposableStackConstructor: base_config_1.TYPE,
IteratorObject: base_config_1.TYPE,
SuppressedError: base_config_1.TYPE_VALUE,
SuppressedErrorConstructor: base_config_1.TYPE,
SymbolConstructor: base_config_1.TYPE
};
return esnext_disposable;
}
var esnext_intl = {};
var hasRequiredEsnext_intl;
function requireEsnext_intl() {
if (hasRequiredEsnext_intl) return esnext_intl;
hasRequiredEsnext_intl = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(esnext_intl, "__esModule", {
value: true
});
esnext_intl.esnext_intl = undefined;
const base_config_1 = requireBaseConfig();
esnext_intl.esnext_intl = {
Intl: base_config_1.TYPE_VALUE
};
return esnext_intl;
}
var esnext_iterator = {};
var hasRequiredEsnext_iterator;
function requireEsnext_iterator() {
if (hasRequiredEsnext_iterator) return esnext_iterator;
hasRequiredEsnext_iterator = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(esnext_iterator, "__esModule", {
value: true
});
esnext_iterator.esnext_iterator = undefined;
const base_config_1 = requireBaseConfig();
const es2015_iterable_1 = requireEs2015_iterable();
esnext_iterator.esnext_iterator = {
...es2015_iterable_1.es2015_iterable,
Iterator: base_config_1.TYPE_VALUE,
IteratorObjectConstructor: base_config_1.TYPE
};
return esnext_iterator;
}
var esnext_object = {};
var hasRequiredEsnext_object;
function requireEsnext_object() {
if (hasRequiredEsnext_object) return esnext_object;
hasRequiredEsnext_object = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(esnext_object, "__esModule", {
value: true
});
esnext_object.esnext_object = undefined;
const base_config_1 = requireBaseConfig();
esnext_object.esnext_object = {
ObjectConstructor: base_config_1.TYPE
};
return esnext_object;
}
var esnext_promise = {};
var hasRequiredEsnext_promise;
function requireEsnext_promise() {
if (hasRequiredEsnext_promise) return esnext_promise;
hasRequiredEsnext_promise = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(esnext_promise, "__esModule", {
value: true
});
esnext_promise.esnext_promise = undefined;
const base_config_1 = requireBaseConfig();
esnext_promise.esnext_promise = {
PromiseConstructor: base_config_1.TYPE,
PromiseWithResolvers: base_config_1.TYPE
};
return esnext_promise;
}
var esnext_regexp = {};
var hasRequiredEsnext_regexp;
function requireEsnext_regexp() {
if (hasRequiredEsnext_regexp) return esnext_regexp;
hasRequiredEsnext_regexp = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(esnext_regexp, "__esModule", {
value: true
});
esnext_regexp.esnext_regexp = undefined;
const base_config_1 = requireBaseConfig();
esnext_regexp.esnext_regexp = {
RegExp: base_config_1.TYPE
};
return esnext_regexp;
}
var esnext_string = {};
var hasRequiredEsnext_string;
function requireEsnext_string() {
if (hasRequiredEsnext_string) return esnext_string;
hasRequiredEsnext_string = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(esnext_string, "__esModule", {
value: true
});
esnext_string.esnext_string = undefined;
const base_config_1 = requireBaseConfig();
esnext_string.esnext_string = {
String: base_config_1.TYPE
};
return esnext_string;
}
var hasRequiredEsnext;
function requireEsnext() {
if (hasRequiredEsnext) return esnext;
hasRequiredEsnext = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(esnext, "__esModule", {
value: true
});
esnext.esnext = undefined;
const es2023_1 = requireEs2023();
const esnext_array_1 = requireEsnext_array();
const esnext_collection_1 = requireEsnext_collection();
const esnext_decorators_1 = requireEsnext_decorators();
const esnext_disposable_1 = requireEsnext_disposable();
const esnext_intl_1 = requireEsnext_intl();
const esnext_iterator_1 = requireEsnext_iterator();
const esnext_object_1 = requireEsnext_object();
const esnext_promise_1 = requireEsnext_promise();
const esnext_regexp_1 = requireEsnext_regexp();
const esnext_string_1 = requireEsnext_string();
esnext.esnext = {
...es2023_1.es2023,
...esnext_intl_1.esnext_intl,
...esnext_decorators_1.esnext_decorators,
...esnext_disposable_1.esnext_disposable,
...esnext_promise_1.esnext_promise,
...esnext_object_1.esnext_object,
...esnext_collection_1.esnext_collection,
...esnext_array_1.esnext_array,
...esnext_regexp_1.esnext_regexp,
...esnext_string_1.esnext_string,
...esnext_iterator_1.esnext_iterator
};
return esnext;
}
var esnext_asynciterable = {};
var hasRequiredEsnext_asynciterable;
function requireEsnext_asynciterable() {
if (hasRequiredEsnext_asynciterable) return esnext_asynciterable;
hasRequiredEsnext_asynciterable = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(esnext_asynciterable, "__esModule", {
value: true
});
esnext_asynciterable.esnext_asynciterable = undefined;
const base_config_1 = requireBaseConfig();
const es2015_iterable_1 = requireEs2015_iterable();
const es2015_symbol_1 = requireEs2015_symbol();
esnext_asynciterable.esnext_asynciterable = {
...es2015_symbol_1.es2015_symbol,
...es2015_iterable_1.es2015_iterable,
AsyncIterable: base_config_1.TYPE,
AsyncIterableIterator: base_config_1.TYPE,
AsyncIterator: base_config_1.TYPE,
AsyncIteratorObject: base_config_1.TYPE,
SymbolConstructor: base_config_1.TYPE
};
return esnext_asynciterable;
}
var esnext_bigint = {};
var hasRequiredEsnext_bigint;
function requireEsnext_bigint() {
if (hasRequiredEsnext_bigint) return esnext_bigint;
hasRequiredEsnext_bigint = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(esnext_bigint, "__esModule", {
value: true
});
esnext_bigint.esnext_bigint = undefined;
const base_config_1 = requireBaseConfig();
const es2020_intl_1 = requireEs2020_intl();
esnext_bigint.esnext_bigint = {
...es2020_intl_1.es2020_intl,
BigInt: base_config_1.TYPE_VALUE,
BigInt64Array: base_config_1.TYPE_VALUE,
BigInt64ArrayConstructor: base_config_1.TYPE,
BigIntConstructor: base_config_1.TYPE,
BigIntToLocaleStringOptions: base_config_1.TYPE,
BigUint64Array: base_config_1.TYPE_VALUE,
BigUint64ArrayConstructor: base_config_1.TYPE,
DataView: base_config_1.TYPE,
Intl: base_config_1.TYPE_VALUE
};
return esnext_bigint;
}
var esnext_full = {};
var hasRequiredEsnext_full;
function requireEsnext_full() {
if (hasRequiredEsnext_full) return esnext_full;
hasRequiredEsnext_full = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(esnext_full, "__esModule", {
value: true
});
esnext_full.esnext_full = undefined;
const dom_1 = requireDom();
const dom_asynciterable_1 = requireDom_asynciterable();
const dom_iterable_1 = requireDom_iterable();
const esnext_1 = requireEsnext();
const scripthost_1 = requireScripthost();
const webworker_importscripts_1 = requireWebworker_importscripts();
esnext_full.esnext_full = {
...esnext_1.esnext,
...dom_1.dom,
...webworker_importscripts_1.webworker_importscripts,
...scripthost_1.scripthost,
...dom_iterable_1.dom_iterable,
...dom_asynciterable_1.dom_asynciterable
};
return esnext_full;
}
var esnext_symbol = {};
var hasRequiredEsnext_symbol;
function requireEsnext_symbol() {
if (hasRequiredEsnext_symbol) return esnext_symbol;
hasRequiredEsnext_symbol = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(esnext_symbol, "__esModule", {
value: true
});
esnext_symbol.esnext_symbol = undefined;
const base_config_1 = requireBaseConfig();
esnext_symbol.esnext_symbol = {
Symbol: base_config_1.TYPE
};
return esnext_symbol;
}
var esnext_weakref = {};
var hasRequiredEsnext_weakref;
function requireEsnext_weakref() {
if (hasRequiredEsnext_weakref) return esnext_weakref;
hasRequiredEsnext_weakref = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(esnext_weakref, "__esModule", {
value: true
});
esnext_weakref.esnext_weakref = undefined;
const base_config_1 = requireBaseConfig();
esnext_weakref.esnext_weakref = {
FinalizationRegistry: base_config_1.TYPE_VALUE,
FinalizationRegistryConstructor: base_config_1.TYPE,
WeakRef: base_config_1.TYPE_VALUE,
WeakRefConstructor: base_config_1.TYPE
};
return esnext_weakref;
}
var lib = {};
var hasRequiredLib$1;
function requireLib$1() {
if (hasRequiredLib$1) return lib;
hasRequiredLib$1 = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(lib, "__esModule", {
value: true
});
lib.lib = undefined;
const dom_1 = requireDom();
const es5_1 = requireEs5();
const scripthost_1 = requireScripthost();
const webworker_importscripts_1 = requireWebworker_importscripts();
lib.lib = {
...es5_1.es5,
...dom_1.dom,
...webworker_importscripts_1.webworker_importscripts,
...scripthost_1.scripthost
};
return lib;
}
var webworker = {};
var hasRequiredWebworker;
function requireWebworker() {
if (hasRequiredWebworker) return webworker;
hasRequiredWebworker = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(webworker, "__esModule", {
value: true
});
webworker.webworker = undefined;
const base_config_1 = requireBaseConfig();
webworker.webworker = {
AbortController: base_config_1.TYPE_VALUE,
AbortSignal: base_config_1.TYPE_VALUE,
AbortSignalEventMap: base_config_1.TYPE,
AbstractWorker: base_config_1.TYPE,
AbstractWorkerEventMap: base_config_1.TYPE,
AddEventListenerOptions: base_config_1.TYPE,
AesCbcParams: base_config_1.TYPE,
AesCtrParams: base_config_1.TYPE,
AesDerivedKeyParams: base_config_1.TYPE,
AesGcmParams: base_config_1.TYPE,
AesKeyAlgorithm: base_config_1.TYPE,
AesKeyGenParams: base_config_1.TYPE,
Algorithm: base_config_1.TYPE,
AlgorithmIdentifier: base_config_1.TYPE,
AllowSharedBufferSource: base_config_1.TYPE,
AlphaOption: base_config_1.TYPE,
ANGLE_instanced_arrays: base_config_1.TYPE,
AnimationFrameProvider: base_config_1.TYPE,
AudioConfiguration: base_config_1.TYPE,
AvcBitstreamFormat: base_config_1.TYPE,
AvcEncoderConfig: base_config_1.TYPE,
BigInteger: base_config_1.TYPE,
BinaryData: base_config_1.TYPE,
BinaryType: base_config_1.TYPE,
Blob: base_config_1.TYPE_VALUE,
BlobPart: base_config_1.TYPE,
BlobPropertyBag: base_config_1.TYPE,
Body: base_config_1.TYPE,
BodyInit: base_config_1.TYPE,
BroadcastChannel: base_config_1.TYPE_VALUE,
BroadcastChannelEventMap: base_config_1.TYPE,
BufferSource: base_config_1.TYPE,
ByteLengthQueuingStrategy: base_config_1.TYPE_VALUE,
Cache: base_config_1.TYPE_VALUE,
CacheQueryOptions: base_config_1.TYPE,
CacheStorage: base_config_1.TYPE_VALUE,
CanvasCompositing: base_config_1.TYPE,
CanvasDirection: base_config_1.TYPE,
CanvasDrawImage: base_config_1.TYPE,
CanvasDrawPath: base_config_1.TYPE,
CanvasFillRule: base_config_1.TYPE,
CanvasFillStrokeStyles: base_config_1.TYPE,
CanvasFilters: base_config_1.TYPE,
CanvasFontKerning: base_config_1.TYPE,
CanvasFontStretch: base_config_1.TYPE,
CanvasFontVariantCaps: base_config_1.TYPE,
CanvasGradient: base_config_1.TYPE_VALUE,
CanvasImageData: base_config_1.TYPE,
CanvasImageSmoothing: base_config_1.TYPE,
CanvasImageSource: base_config_1.TYPE,
CanvasLineCap: base_config_1.TYPE,
CanvasLineJoin: base_config_1.TYPE,
CanvasPath: base_config_1.TYPE,
CanvasPathDrawingStyles: base_config_1.TYPE,
CanvasPattern: base_config_1.TYPE_VALUE,
CanvasRect: base_config_1.TYPE,
CanvasShadowStyles: base_config_1.TYPE,
CanvasState: base_config_1.TYPE,
CanvasText: base_config_1.TYPE,
CanvasTextAlign: base_config_1.TYPE,
CanvasTextBaseline: base_config_1.TYPE,
CanvasTextDrawingStyles: base_config_1.TYPE,
CanvasTextRendering: base_config_1.TYPE,
CanvasTransform: base_config_1.TYPE,
Client: base_config_1.TYPE_VALUE,
ClientQueryOptions: base_config_1.TYPE,
Clients: base_config_1.TYPE_VALUE,
ClientTypes: base_config_1.TYPE,
CloseEvent: base_config_1.TYPE_VALUE,
CloseEventInit: base_config_1.TYPE,
CodecState: base_config_1.TYPE,
ColorGamut: base_config_1.TYPE,
ColorSpaceConversion: base_config_1.TYPE,
CompressionFormat: base_config_1.TYPE,
CompressionStream: base_config_1.TYPE_VALUE,
Console: base_config_1.TYPE,
CountQueuingStrategy: base_config_1.TYPE_VALUE,
Crypto: base_config_1.TYPE_VALUE,
CryptoKey: base_config_1.TYPE_VALUE,
CryptoKeyPair: base_config_1.TYPE,
CSSImageValue: base_config_1.TYPE_VALUE,
CSSKeywordish: base_config_1.TYPE,
CSSKeywordValue: base_config_1.TYPE_VALUE,
CSSMathClamp: base_config_1.TYPE_VALUE,
CSSMathInvert: base_config_1.TYPE_VALUE,
CSSMathMax: base_config_1.TYPE_VALUE,
CSSMathMin: base_config_1.TYPE_VALUE,
CSSMathNegate: base_config_1.TYPE_VALUE,
CSSMathOperator: base_config_1.TYPE,
CSSMathProduct: base_config_1.TYPE_VALUE,
CSSMathSum: base_config_1.TYPE_VALUE,
CSSMathValue: base_config_1.TYPE_VALUE,
CSSMatrixComponent: base_config_1.TYPE_VALUE,
CSSMatrixComponentOptions: base_config_1.TYPE,
CSSNumberish: base_config_1.TYPE,
CSSNumericArray: base_config_1.TYPE_VALUE,
CSSNumericBaseType: base_config_1.TYPE,
CSSNumericType: base_config_1.TYPE,
CSSNumericValue: base_config_1.TYPE_VALUE,
CSSPerspective: base_config_1.TYPE_VALUE,
CSSPerspectiveValue: base_config_1.TYPE,
CSSRotate: base_config_1.TYPE_VALUE,
CSSScale: base_config_1.TYPE_VALUE,
CSSSkew: base_config_1.TYPE_VALUE,
CSSSkewX: base_config_1.TYPE_VALUE,
CSSSkewY: base_config_1.TYPE_VALUE,
CSSStyleValue: base_config_1.TYPE_VALUE,
CSSTransformComponent: base_config_1.TYPE_VALUE,
CSSTransformValue: base_config_1.TYPE_VALUE,
CSSTranslate: base_config_1.TYPE_VALUE,
CSSUnitValue: base_config_1.TYPE_VALUE,
CSSUnparsedSegment: base_config_1.TYPE,
CSSUnparsedValue: base_config_1.TYPE_VALUE,
CSSVariableReferenceValue: base_config_1.TYPE_VALUE,
CustomEvent: base_config_1.TYPE_VALUE,
CustomEventInit: base_config_1.TYPE,
DecompressionStream: base_config_1.TYPE_VALUE,
DedicatedWorkerGlobalScope: base_config_1.TYPE_VALUE,
DedicatedWorkerGlobalScopeEventMap: base_config_1.TYPE,
DocumentVisibilityState: base_config_1.TYPE,
DOMException: base_config_1.TYPE_VALUE,
DOMHighResTimeStamp: base_config_1.TYPE,
DOMMatrix: base_config_1.TYPE_VALUE,
DOMMatrix2DInit: base_config_1.TYPE,
DOMMatrixInit: base_config_1.TYPE,
DOMMatrixReadOnly: base_config_1.TYPE_VALUE,
DOMPoint: base_config_1.TYPE_VALUE,
DOMPointInit: base_config_1.TYPE,
DOMPointReadOnly: base_config_1.TYPE_VALUE,
DOMQuad: base_config_1.TYPE_VALUE,
DOMQuadInit: base_config_1.TYPE,
DOMRect: base_config_1.TYPE_VALUE,
DOMRectInit: base_config_1.TYPE,
DOMRectReadOnly: base_config_1.TYPE_VALUE,
DOMStringList: base_config_1.TYPE_VALUE,
EcdhKeyDeriveParams: base_config_1.TYPE,
EcdsaParams: base_config_1.TYPE,
EcKeyGenParams: base_config_1.TYPE,
EcKeyImportParams: base_config_1.TYPE,
EncodedVideoChunk: base_config_1.TYPE_VALUE,
EncodedVideoChunkInit: base_config_1.TYPE,
EncodedVideoChunkMetadata: base_config_1.TYPE,
EncodedVideoChunkOutputCallback: base_config_1.TYPE,
EncodedVideoChunkType: base_config_1.TYPE,
EndingType: base_config_1.TYPE,
EpochTimeStamp: base_config_1.TYPE,
ErrorEvent: base_config_1.TYPE_VALUE,
ErrorEventInit: base_config_1.TYPE,
Event: base_config_1.TYPE_VALUE,
EventInit: base_config_1.TYPE,
EventListener: base_config_1.TYPE,
EventListenerObject: base_config_1.TYPE,
EventListenerOptions: base_config_1.TYPE,
EventListenerOrEventListenerObject: base_config_1.TYPE,
EventSource: base_config_1.TYPE_VALUE,
EventSourceEventMap: base_config_1.TYPE,
EventSourceInit: base_config_1.TYPE,
EventTarget: base_config_1.TYPE_VALUE,
EXT_blend_minmax: base_config_1.TYPE,
EXT_color_buffer_float: base_config_1.TYPE,
EXT_color_buffer_half_float: base_config_1.TYPE,
EXT_float_blend: base_config_1.TYPE,
EXT_frag_depth: base_config_1.TYPE,
EXT_shader_texture_lod: base_config_1.TYPE,
EXT_sRGB: base_config_1.TYPE,
EXT_texture_compression_bptc: base_config_1.TYPE,
EXT_texture_compression_rgtc: base_config_1.TYPE,
EXT_texture_filter_anisotropic: base_config_1.TYPE,
EXT_texture_norm16: base_config_1.TYPE,
ExtendableEvent: base_config_1.TYPE_VALUE,
ExtendableEventInit: base_config_1.TYPE,
ExtendableMessageEvent: base_config_1.TYPE_VALUE,
ExtendableMessageEventInit: base_config_1.TYPE,
FetchEvent: base_config_1.TYPE_VALUE,
FetchEventInit: base_config_1.TYPE,
File: base_config_1.TYPE_VALUE,
FileList: base_config_1.TYPE_VALUE,
FilePropertyBag: base_config_1.TYPE,
FileReader: base_config_1.TYPE_VALUE,
FileReaderEventMap: base_config_1.TYPE,
FileReaderSync: base_config_1.TYPE_VALUE,
FileSystemCreateWritableOptions: base_config_1.TYPE,
FileSystemDirectoryHandle: base_config_1.TYPE_VALUE,
FileSystemFileHandle: base_config_1.TYPE_VALUE,
FileSystemGetDirectoryOptions: base_config_1.TYPE,
FileSystemGetFileOptions: base_config_1.TYPE,
FileSystemHandle: base_config_1.TYPE_VALUE,
FileSystemHandleKind: base_config_1.TYPE,
FileSystemReadWriteOptions: base_config_1.TYPE,
FileSystemRemoveOptions: base_config_1.TYPE,
FileSystemSyncAccessHandle: base_config_1.TYPE_VALUE,
FileSystemWritableFileStream: base_config_1.TYPE_VALUE,
FileSystemWriteChunkType: base_config_1.TYPE,
Float32List: base_config_1.TYPE,
FontDisplay: base_config_1.TYPE,
FontFace: base_config_1.TYPE_VALUE,
FontFaceDescriptors: base_config_1.TYPE,
FontFaceLoadStatus: base_config_1.TYPE,
FontFaceSet: base_config_1.TYPE_VALUE,
FontFaceSetEventMap: base_config_1.TYPE,
FontFaceSetLoadEvent: base_config_1.TYPE_VALUE,
FontFaceSetLoadEventInit: base_config_1.TYPE,
FontFaceSetLoadStatus: base_config_1.TYPE,
FontFaceSource: base_config_1.TYPE,
FormData: base_config_1.TYPE_VALUE,
FormDataEntryValue: base_config_1.TYPE,
FrameRequestCallback: base_config_1.TYPE,
FrameType: base_config_1.TYPE,
GenericTransformStream: base_config_1.TYPE,
GetNotificationOptions: base_config_1.TYPE,
GLbitfield: base_config_1.TYPE,
GLboolean: base_config_1.TYPE,
GLclampf: base_config_1.TYPE,
GLenum: base_config_1.TYPE,
GLfloat: base_config_1.TYPE,
GLint: base_config_1.TYPE,
GLint64: base_config_1.TYPE,
GLintptr: base_config_1.TYPE,
GlobalCompositeOperation: base_config_1.TYPE,
GLsizei: base_config_1.TYPE,
GLsizeiptr: base_config_1.TYPE,
GLuint: base_config_1.TYPE,
GLuint64: base_config_1.TYPE,
HardwareAcceleration: base_config_1.TYPE,
HashAlgorithmIdentifier: base_config_1.TYPE,
HdrMetadataType: base_config_1.TYPE,
Headers: base_config_1.TYPE_VALUE,
HeadersInit: base_config_1.TYPE,
HkdfParams: base_config_1.TYPE,
HmacImportParams: base_config_1.TYPE,
HmacKeyGenParams: base_config_1.TYPE,
IDBCursor: base_config_1.TYPE_VALUE,
IDBCursorDirection: base_config_1.TYPE,
IDBCursorWithValue: base_config_1.TYPE_VALUE,
IDBDatabase: base_config_1.TYPE_VALUE,
IDBDatabaseEventMap: base_config_1.TYPE,
IDBDatabaseInfo: base_config_1.TYPE,
IDBFactory: base_config_1.TYPE_VALUE,
IDBIndex: base_config_1.TYPE_VALUE,
IDBIndexParameters: base_config_1.TYPE,
IDBKeyRange: base_config_1.TYPE_VALUE,
IDBObjectStore: base_config_1.TYPE_VALUE,
IDBObjectStoreParameters: base_config_1.TYPE,
IDBOpenDBRequest: base_config_1.TYPE_VALUE,
IDBOpenDBRequestEventMap: base_config_1.TYPE,
IDBRequest: base_config_1.TYPE_VALUE,
IDBRequestEventMap: base_config_1.TYPE,
IDBRequestReadyState: base_config_1.TYPE,
IDBTransaction: base_config_1.TYPE_VALUE,
IDBTransactionDurability: base_config_1.TYPE,
IDBTransactionEventMap: base_config_1.TYPE,
IDBTransactionMode: base_config_1.TYPE,
IDBTransactionOptions: base_config_1.TYPE,
IDBValidKey: base_config_1.TYPE,
IDBVersionChangeEvent: base_config_1.TYPE_VALUE,
IDBVersionChangeEventInit: base_config_1.TYPE,
ImageBitmap: base_config_1.TYPE_VALUE,
ImageBitmapOptions: base_config_1.TYPE,
ImageBitmapRenderingContext: base_config_1.TYPE_VALUE,
ImageBitmapRenderingContextSettings: base_config_1.TYPE,
ImageBitmapSource: base_config_1.TYPE,
ImageData: base_config_1.TYPE_VALUE,
ImageDataSettings: base_config_1.TYPE,
ImageEncodeOptions: base_config_1.TYPE,
ImageOrientation: base_config_1.TYPE,
ImageSmoothingQuality: base_config_1.TYPE,
ImportMeta: base_config_1.TYPE,
Int32List: base_config_1.TYPE,
JsonWebKey: base_config_1.TYPE,
KeyAlgorithm: base_config_1.TYPE,
KeyFormat: base_config_1.TYPE,
KeyType: base_config_1.TYPE,
KeyUsage: base_config_1.TYPE,
KHR_parallel_shader_compile: base_config_1.TYPE,
LatencyMode: base_config_1.TYPE,
Lock: base_config_1.TYPE_VALUE,
LockGrantedCallback: base_config_1.TYPE,
LockInfo: base_config_1.TYPE,
LockManager: base_config_1.TYPE_VALUE,
LockManagerSnapshot: base_config_1.TYPE,
LockMode: base_config_1.TYPE,
LockOptions: base_config_1.TYPE,
MediaCapabilities: base_config_1.TYPE_VALUE,
MediaCapabilitiesDecodingInfo: base_config_1.TYPE,
MediaCapabilitiesEncodingInfo: base_config_1.TYPE,
MediaCapabilitiesInfo: base_config_1.TYPE,
MediaConfiguration: base_config_1.TYPE,
MediaDecodingConfiguration: base_config_1.TYPE,
MediaDecodingType: base_config_1.TYPE,
MediaEncodingConfiguration: base_config_1.TYPE,
MediaEncodingType: base_config_1.TYPE,
MediaSourceHandle: base_config_1.TYPE_VALUE,
MediaStreamTrackProcessor: base_config_1.TYPE_VALUE,
MediaStreamTrackProcessorInit: base_config_1.TYPE,
MessageChannel: base_config_1.TYPE_VALUE,
MessageEvent: base_config_1.TYPE_VALUE,
MessageEventInit: base_config_1.TYPE,
MessageEventSource: base_config_1.TYPE,
MessagePort: base_config_1.TYPE_VALUE,
MessagePortEventMap: base_config_1.TYPE,
MultiCacheQueryOptions: base_config_1.TYPE,
NamedCurve: base_config_1.TYPE,
NavigationPreloadManager: base_config_1.TYPE_VALUE,
NavigationPreloadState: base_config_1.TYPE,
NavigatorBadge: base_config_1.TYPE,
NavigatorConcurrentHardware: base_config_1.TYPE,
NavigatorID: base_config_1.TYPE,
NavigatorLanguage: base_config_1.TYPE,
NavigatorLocks: base_config_1.TYPE,
NavigatorOnLine: base_config_1.TYPE,
NavigatorStorage: base_config_1.TYPE,
Notification: base_config_1.TYPE_VALUE,
NotificationDirection: base_config_1.TYPE,
NotificationEvent: base_config_1.TYPE_VALUE,
NotificationEventInit: base_config_1.TYPE,
NotificationEventMap: base_config_1.TYPE,
NotificationOptions: base_config_1.TYPE,
NotificationPermission: base_config_1.TYPE,
OES_draw_buffers_indexed: base_config_1.TYPE,
OES_element_index_uint: base_config_1.TYPE,
OES_fbo_render_mipmap: base_config_1.TYPE,
OES_standard_derivatives: base_config_1.TYPE,
OES_texture_float: base_config_1.TYPE,
OES_texture_float_linear: base_config_1.TYPE,
OES_texture_half_float: base_config_1.TYPE,
OES_texture_half_float_linear: base_config_1.TYPE,
OES_vertex_array_object: base_config_1.TYPE,
OffscreenCanvas: base_config_1.TYPE_VALUE,
OffscreenCanvasEventMap: base_config_1.TYPE,
OffscreenCanvasRenderingContext2D: base_config_1.TYPE_VALUE,
OffscreenRenderingContext: base_config_1.TYPE,
OffscreenRenderingContextId: base_config_1.TYPE,
OnErrorEventHandler: base_config_1.TYPE,
OnErrorEventHandlerNonNull: base_config_1.TYPE,
OVR_multiview2: base_config_1.TYPE,
Path2D: base_config_1.TYPE_VALUE,
Pbkdf2Params: base_config_1.TYPE,
Performance: base_config_1.TYPE_VALUE,
PerformanceEntry: base_config_1.TYPE_VALUE,
PerformanceEntryList: base_config_1.TYPE,
PerformanceEventMap: base_config_1.TYPE,
PerformanceMark: base_config_1.TYPE_VALUE,
PerformanceMarkOptions: base_config_1.TYPE,
PerformanceMeasure: base_config_1.TYPE_VALUE,
PerformanceMeasureOptions: base_config_1.TYPE,
PerformanceObserver: base_config_1.TYPE_VALUE,
PerformanceObserverCallback: base_config_1.TYPE,
PerformanceObserverEntryList: base_config_1.TYPE_VALUE,
PerformanceObserverInit: base_config_1.TYPE,
PerformanceResourceTiming: base_config_1.TYPE_VALUE,
PerformanceServerTiming: base_config_1.TYPE_VALUE,
PermissionDescriptor: base_config_1.TYPE,
PermissionName: base_config_1.TYPE,
Permissions: base_config_1.TYPE_VALUE,
PermissionState: base_config_1.TYPE,
PermissionStatus: base_config_1.TYPE_VALUE,
PermissionStatusEventMap: base_config_1.TYPE,
PlaneLayout: base_config_1.TYPE,
PredefinedColorSpace: base_config_1.TYPE,
PremultiplyAlpha: base_config_1.TYPE,
ProgressEvent: base_config_1.TYPE_VALUE,
ProgressEventInit: base_config_1.TYPE,
PromiseRejectionEvent: base_config_1.TYPE_VALUE,
PromiseRejectionEventInit: base_config_1.TYPE,
PushEncryptionKeyName: base_config_1.TYPE,
PushEvent: base_config_1.TYPE_VALUE,
PushEventInit: base_config_1.TYPE,
PushManager: base_config_1.TYPE_VALUE,
PushMessageData: base_config_1.TYPE_VALUE,
PushMessageDataInit: base_config_1.TYPE,
PushSubscription: base_config_1.TYPE_VALUE,
PushSubscriptionJSON: base_config_1.TYPE,
PushSubscriptionOptions: base_config_1.TYPE_VALUE,
PushSubscriptionOptionsInit: base_config_1.TYPE,
QueuingStrategy: base_config_1.TYPE,
QueuingStrategyInit: base_config_1.TYPE,
QueuingStrategySize: base_config_1.TYPE,
ReadableByteStreamController: base_config_1.TYPE_VALUE,
ReadableStream: base_config_1.TYPE_VALUE,
ReadableStreamBYOBReader: base_config_1.TYPE_VALUE,
ReadableStreamBYOBRequest: base_config_1.TYPE_VALUE,
ReadableStreamController: base_config_1.TYPE,
ReadableStreamDefaultController: base_config_1.TYPE_VALUE,
ReadableStreamDefaultReader: base_config_1.TYPE_VALUE,
ReadableStreamGenericReader: base_config_1.TYPE,
ReadableStreamGetReaderOptions: base_config_1.TYPE,
ReadableStreamIteratorOptions: base_config_1.TYPE,
ReadableStreamReadDoneResult: base_config_1.TYPE,
ReadableStreamReader: base_config_1.TYPE,
ReadableStreamReaderMode: base_config_1.TYPE,
ReadableStreamReadResult: base_config_1.TYPE,
ReadableStreamReadValueResult: base_config_1.TYPE,
ReadableStreamType: base_config_1.TYPE,
ReadableWritablePair: base_config_1.TYPE,
ReferrerPolicy: base_config_1.TYPE,
RegistrationOptions: base_config_1.TYPE,
Report: base_config_1.TYPE_VALUE,
ReportBody: base_config_1.TYPE_VALUE,
ReportingObserver: base_config_1.TYPE_VALUE,
ReportingObserverCallback: base_config_1.TYPE,
ReportingObserverOptions: base_config_1.TYPE,
ReportList: base_config_1.TYPE,
Request: base_config_1.TYPE_VALUE,
RequestCache: base_config_1.TYPE,
RequestCredentials: base_config_1.TYPE,
RequestDestination: base_config_1.TYPE,
RequestInfo: base_config_1.TYPE,
RequestInit: base_config_1.TYPE,
RequestMode: base_config_1.TYPE,
RequestPriority: base_config_1.TYPE,
RequestRedirect: base_config_1.TYPE,
ResizeQuality: base_config_1.TYPE,
Response: base_config_1.TYPE_VALUE,
ResponseInit: base_config_1.TYPE,
ResponseType: base_config_1.TYPE,
RsaHashedImportParams: base_config_1.TYPE,
RsaHashedKeyGenParams: base_config_1.TYPE,
RsaKeyGenParams: base_config_1.TYPE,
RsaOaepParams: base_config_1.TYPE,
RsaOtherPrimesInfo: base_config_1.TYPE,
RsaPssParams: base_config_1.TYPE,
RTCEncodedAudioFrame: base_config_1.TYPE_VALUE,
RTCEncodedAudioFrameMetadata: base_config_1.TYPE,
RTCEncodedVideoFrame: base_config_1.TYPE_VALUE,
RTCEncodedVideoFrameMetadata: base_config_1.TYPE,
RTCEncodedVideoFrameType: base_config_1.TYPE,
RTCRtpScriptTransformer: base_config_1.TYPE_VALUE,
RTCTransformEvent: base_config_1.TYPE_VALUE,
SecurityPolicyViolationEvent: base_config_1.TYPE_VALUE,
SecurityPolicyViolationEventDisposition: base_config_1.TYPE,
SecurityPolicyViolationEventInit: base_config_1.TYPE,
ServiceWorker: base_config_1.TYPE_VALUE,
ServiceWorkerContainer: base_config_1.TYPE_VALUE,
ServiceWorkerContainerEventMap: base_config_1.TYPE,
ServiceWorkerEventMap: base_config_1.TYPE,
ServiceWorkerGlobalScope: base_config_1.TYPE_VALUE,
ServiceWorkerGlobalScopeEventMap: base_config_1.TYPE,
ServiceWorkerRegistration: base_config_1.TYPE_VALUE,
ServiceWorkerRegistrationEventMap: base_config_1.TYPE,
ServiceWorkerState: base_config_1.TYPE,
ServiceWorkerUpdateViaCache: base_config_1.TYPE,
SharedWorkerGlobalScope: base_config_1.TYPE_VALUE,
SharedWorkerGlobalScopeEventMap: base_config_1.TYPE,
StorageEstimate: base_config_1.TYPE,
StorageManager: base_config_1.TYPE_VALUE,
StreamPipeOptions: base_config_1.TYPE,
StructuredSerializeOptions: base_config_1.TYPE,
StylePropertyMapReadOnly: base_config_1.TYPE_VALUE,
SubtleCrypto: base_config_1.TYPE_VALUE,
TexImageSource: base_config_1.TYPE,
TextDecodeOptions: base_config_1.TYPE,
TextDecoder: base_config_1.TYPE_VALUE,
TextDecoderCommon: base_config_1.TYPE,
TextDecoderOptions: base_config_1.TYPE,
TextDecoderStream: base_config_1.TYPE_VALUE,
TextEncoder: base_config_1.TYPE_VALUE,
TextEncoderCommon: base_config_1.TYPE,
TextEncoderEncodeIntoResult: base_config_1.TYPE,
TextEncoderStream: base_config_1.TYPE_VALUE,
TextMetrics: base_config_1.TYPE_VALUE,
TimerHandler: base_config_1.TYPE,
Transferable: base_config_1.TYPE,
TransferFunction: base_config_1.TYPE,
Transformer: base_config_1.TYPE,
TransformerFlushCallback: base_config_1.TYPE,
TransformerStartCallback: base_config_1.TYPE,
TransformerTransformCallback: base_config_1.TYPE,
TransformStream: base_config_1.TYPE_VALUE,
TransformStreamDefaultController: base_config_1.TYPE_VALUE,
Uint32List: base_config_1.TYPE,
UnderlyingByteSource: base_config_1.TYPE,
UnderlyingDefaultSource: base_config_1.TYPE,
UnderlyingSink: base_config_1.TYPE,
UnderlyingSinkAbortCallback: base_config_1.TYPE,
UnderlyingSinkCloseCallback: base_config_1.TYPE,
UnderlyingSinkStartCallback: base_config_1.TYPE,
UnderlyingSinkWriteCallback: base_config_1.TYPE,
UnderlyingSource: base_config_1.TYPE,
UnderlyingSourceCancelCallback: base_config_1.TYPE,
UnderlyingSourcePullCallback: base_config_1.TYPE,
UnderlyingSourceStartCallback: base_config_1.TYPE,
URL: base_config_1.TYPE_VALUE,
URLSearchParams: base_config_1.TYPE_VALUE,
VideoColorPrimaries: base_config_1.TYPE,
VideoColorSpace: base_config_1.TYPE_VALUE,
VideoColorSpaceInit: base_config_1.TYPE,
VideoConfiguration: base_config_1.TYPE,
VideoDecoder: base_config_1.TYPE_VALUE,
VideoDecoderConfig: base_config_1.TYPE,
VideoDecoderEventMap: base_config_1.TYPE,
VideoDecoderInit: base_config_1.TYPE,
VideoDecoderSupport: base_config_1.TYPE,
VideoEncoder: base_config_1.TYPE_VALUE,
VideoEncoderBitrateMode: base_config_1.TYPE,
VideoEncoderConfig: base_config_1.TYPE,
VideoEncoderEncodeOptions: base_config_1.TYPE,
VideoEncoderEventMap: base_config_1.TYPE,
VideoEncoderInit: base_config_1.TYPE,
VideoEncoderSupport: base_config_1.TYPE,
VideoFrame: base_config_1.TYPE_VALUE,
VideoFrameBufferInit: base_config_1.TYPE,
VideoFrameCopyToOptions: base_config_1.TYPE,
VideoFrameInit: base_config_1.TYPE,
VideoFrameOutputCallback: base_config_1.TYPE,
VideoMatrixCoefficients: base_config_1.TYPE,
VideoPixelFormat: base_config_1.TYPE,
VideoTransferCharacteristics: base_config_1.TYPE,
VoidFunction: base_config_1.TYPE,
WebAssembly: base_config_1.TYPE_VALUE,
WebCodecsErrorCallback: base_config_1.TYPE,
WEBGL_color_buffer_float: base_config_1.TYPE,
WEBGL_compressed_texture_astc: base_config_1.TYPE,
WEBGL_compressed_texture_etc: base_config_1.TYPE,
WEBGL_compressed_texture_etc1: base_config_1.TYPE,
WEBGL_compressed_texture_pvrtc: base_config_1.TYPE,
WEBGL_compressed_texture_s3tc: base_config_1.TYPE,
WEBGL_compressed_texture_s3tc_srgb: base_config_1.TYPE,
WEBGL_debug_renderer_info: base_config_1.TYPE,
WEBGL_debug_shaders: base_config_1.TYPE,
WEBGL_depth_texture: base_config_1.TYPE,
WEBGL_draw_buffers: base_config_1.TYPE,
WEBGL_lose_context: base_config_1.TYPE,
WEBGL_multi_draw: base_config_1.TYPE,
WebGL2RenderingContext: base_config_1.TYPE_VALUE,
WebGL2RenderingContextBase: base_config_1.TYPE,
WebGL2RenderingContextOverloads: base_config_1.TYPE,
WebGLActiveInfo: base_config_1.TYPE_VALUE,
WebGLBuffer: base_config_1.TYPE_VALUE,
WebGLContextAttributes: base_config_1.TYPE,
WebGLContextEvent: base_config_1.TYPE_VALUE,
WebGLContextEventInit: base_config_1.TYPE,
WebGLFramebuffer: base_config_1.TYPE_VALUE,
WebGLPowerPreference: base_config_1.TYPE,
WebGLProgram: base_config_1.TYPE_VALUE,
WebGLQuery: base_config_1.TYPE_VALUE,
WebGLRenderbuffer: base_config_1.TYPE_VALUE,
WebGLRenderingContext: base_config_1.TYPE_VALUE,
WebGLRenderingContextBase: base_config_1.TYPE,
WebGLRenderingContextOverloads: base_config_1.TYPE,
WebGLSampler: base_config_1.TYPE_VALUE,
WebGLShader: base_config_1.TYPE_VALUE,
WebGLShaderPrecisionFormat: base_config_1.TYPE_VALUE,
WebGLSync: base_config_1.TYPE_VALUE,
WebGLTexture: base_config_1.TYPE_VALUE,
WebGLTransformFeedback: base_config_1.TYPE_VALUE,
WebGLUniformLocation: base_config_1.TYPE_VALUE,
WebGLVertexArrayObject: base_config_1.TYPE_VALUE,
WebGLVertexArrayObjectOES: base_config_1.TYPE,
WebSocket: base_config_1.TYPE_VALUE,
WebSocketEventMap: base_config_1.TYPE,
WebTransport: base_config_1.TYPE_VALUE,
WebTransportBidirectionalStream: base_config_1.TYPE_VALUE,
WebTransportCloseInfo: base_config_1.TYPE,
WebTransportCongestionControl: base_config_1.TYPE,
WebTransportDatagramDuplexStream: base_config_1.TYPE_VALUE,
WebTransportError: base_config_1.TYPE_VALUE,
WebTransportErrorOptions: base_config_1.TYPE,
WebTransportErrorSource: base_config_1.TYPE,
WebTransportHash: base_config_1.TYPE,
WebTransportOptions: base_config_1.TYPE,
WebTransportSendStreamOptions: base_config_1.TYPE,
WindowClient: base_config_1.TYPE_VALUE,
WindowOrWorkerGlobalScope: base_config_1.TYPE,
Worker: base_config_1.TYPE_VALUE,
WorkerEventMap: base_config_1.TYPE,
WorkerGlobalScope: base_config_1.TYPE_VALUE,
WorkerGlobalScopeEventMap: base_config_1.TYPE,
WorkerLocation: base_config_1.TYPE_VALUE,
WorkerNavigator: base_config_1.TYPE_VALUE,
WorkerOptions: base_config_1.TYPE,
WorkerType: base_config_1.TYPE,
WritableStream: base_config_1.TYPE_VALUE,
WritableStreamDefaultController: base_config_1.TYPE_VALUE,
WritableStreamDefaultWriter: base_config_1.TYPE_VALUE,
WriteCommandType: base_config_1.TYPE,
WriteParams: base_config_1.TYPE,
XMLHttpRequest: base_config_1.TYPE_VALUE,
XMLHttpRequestBodyInit: base_config_1.TYPE,
XMLHttpRequestEventMap: base_config_1.TYPE,
XMLHttpRequestEventTarget: base_config_1.TYPE_VALUE,
XMLHttpRequestEventTargetEventMap: base_config_1.TYPE,
XMLHttpRequestResponseType: base_config_1.TYPE,
XMLHttpRequestUpload: base_config_1.TYPE_VALUE
};
return webworker;
}
var webworker_asynciterable = {};
var hasRequiredWebworker_asynciterable;
function requireWebworker_asynciterable() {
if (hasRequiredWebworker_asynciterable) return webworker_asynciterable;
hasRequiredWebworker_asynciterable = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(webworker_asynciterable, "__esModule", {
value: true
});
webworker_asynciterable.webworker_asynciterable = undefined;
const base_config_1 = requireBaseConfig();
webworker_asynciterable.webworker_asynciterable = {
FileSystemDirectoryHandle: base_config_1.TYPE,
FileSystemDirectoryHandleAsyncIterator: base_config_1.TYPE,
ReadableStream: base_config_1.TYPE,
ReadableStreamAsyncIterator: base_config_1.TYPE
};
return webworker_asynciterable;
}
var webworker_iterable = {};
var hasRequiredWebworker_iterable;
function requireWebworker_iterable() {
if (hasRequiredWebworker_iterable) return webworker_iterable;
hasRequiredWebworker_iterable = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(webworker_iterable, "__esModule", {
value: true
});
webworker_iterable.webworker_iterable = undefined;
const base_config_1 = requireBaseConfig();
webworker_iterable.webworker_iterable = {
AbortSignal: base_config_1.TYPE,
Cache: base_config_1.TYPE,
CanvasPath: base_config_1.TYPE,
CanvasPathDrawingStyles: base_config_1.TYPE,
CSSNumericArray: base_config_1.TYPE,
CSSTransformValue: base_config_1.TYPE,
CSSUnparsedValue: base_config_1.TYPE,
DOMStringList: base_config_1.TYPE,
FileList: base_config_1.TYPE,
FontFaceSet: base_config_1.TYPE,
FormData: base_config_1.TYPE,
FormDataIterator: base_config_1.TYPE,
Headers: base_config_1.TYPE,
HeadersIterator: base_config_1.TYPE,
IDBDatabase: base_config_1.TYPE,
IDBObjectStore: base_config_1.TYPE,
MessageEvent: base_config_1.TYPE,
StylePropertyMapReadOnly: base_config_1.TYPE,
StylePropertyMapReadOnlyIterator: base_config_1.TYPE,
SubtleCrypto: base_config_1.TYPE,
URLSearchParams: base_config_1.TYPE,
URLSearchParamsIterator: base_config_1.TYPE,
WEBGL_draw_buffers: base_config_1.TYPE,
WEBGL_multi_draw: base_config_1.TYPE,
WebGL2RenderingContextBase: base_config_1.TYPE,
WebGL2RenderingContextOverloads: base_config_1.TYPE,
WebGLRenderingContextBase: base_config_1.TYPE,
WebGLRenderingContextOverloads: base_config_1.TYPE
};
return webworker_iterable;
}
var hasRequiredLib;
function requireLib() {
if (hasRequiredLib) return lib$1;
hasRequiredLib = 1;
// THIS CODE WAS AUTOMATICALLY GENERATED
// DO NOT EDIT THIS CODE BY HAND
// RUN THE FOLLOWING COMMAND FROM THE WORKSPACE ROOT TO REGENERATE:
// npx nx generate-lib repo
_Object$defineProperty(lib$1, "__esModule", {
value: true
});
lib$1.lib = undefined;
const decorators_1 = requireDecorators();
const decorators_legacy_1 = requireDecorators_legacy();
const dom_1 = requireDom();
const dom_asynciterable_1 = requireDom_asynciterable();
const dom_iterable_1 = requireDom_iterable();
const es5_1 = requireEs5();
const es6_1 = requireEs6();
const es7_1 = requireEs7();
const es2015_1 = requireEs2015();
const es2015_collection_1 = requireEs2015_collection();
const es2015_core_1 = requireEs2015_core();
const es2015_generator_1 = requireEs2015_generator();
const es2015_iterable_1 = requireEs2015_iterable();
const es2015_promise_1 = requireEs2015_promise();
const es2015_proxy_1 = requireEs2015_proxy();
const es2015_reflect_1 = requireEs2015_reflect();
const es2015_symbol_1 = requireEs2015_symbol();
const es2015_symbol_wellknown_1 = requireEs2015_symbol_wellknown();
const es2016_1 = requireEs2016();
const es2016_array_include_1 = requireEs2016_array_include();
const es2016_full_1 = requireEs2016_full();
const es2016_intl_1 = requireEs2016_intl();
const es2017_1 = requireEs2017();
const es2017_date_1 = requireEs2017_date();
const es2017_full_1 = requireEs2017_full();
const es2017_intl_1 = requireEs2017_intl();
const es2017_object_1 = requireEs2017_object();
const es2017_sharedmemory_1 = requireEs2017_sharedmemory();
const es2017_string_1 = requireEs2017_string();
const es2017_typedarrays_1 = requireEs2017_typedarrays();
const es2018_1 = requireEs2018();
const es2018_asyncgenerator_1 = requireEs2018_asyncgenerator();
const es2018_asynciterable_1 = requireEs2018_asynciterable();
const es2018_full_1 = requireEs2018_full();
const es2018_intl_1 = requireEs2018_intl();
const es2018_promise_1 = requireEs2018_promise();
const es2018_regexp_1 = requireEs2018_regexp();
const es2019_1 = requireEs2019();
const es2019_array_1 = requireEs2019_array();
const es2019_full_1 = requireEs2019_full();
const es2019_intl_1 = requireEs2019_intl();
const es2019_object_1 = requireEs2019_object();
const es2019_string_1 = requireEs2019_string();
const es2019_symbol_1 = requireEs2019_symbol();
const es2020_1 = requireEs2020();
const es2020_bigint_1 = requireEs2020_bigint();
const es2020_date_1 = requireEs2020_date();
const es2020_full_1 = requireEs2020_full();
const es2020_intl_1 = requireEs2020_intl();
const es2020_number_1 = requireEs2020_number();
const es2020_promise_1 = requireEs2020_promise();
const es2020_sharedmemory_1 = requireEs2020_sharedmemory();
const es2020_string_1 = requireEs2020_string();
const es2020_symbol_wellknown_1 = requireEs2020_symbol_wellknown();
const es2021_1 = requireEs2021();
const es2021_full_1 = requireEs2021_full();
const es2021_intl_1 = requireEs2021_intl();
const es2021_promise_1 = requireEs2021_promise();
const es2021_string_1 = requireEs2021_string();
const es2021_weakref_1 = requireEs2021_weakref();
const es2022_1 = requireEs2022();
const es2022_array_1 = requireEs2022_array();
const es2022_error_1 = requireEs2022_error();
const es2022_full_1 = requireEs2022_full();
const es2022_intl_1 = requireEs2022_intl();
const es2022_object_1 = requireEs2022_object();
const es2022_regexp_1 = requireEs2022_regexp();
const es2022_sharedmemory_1 = requireEs2022_sharedmemory();
const es2022_string_1 = requireEs2022_string();
const es2023_1 = requireEs2023();
const es2023_array_1 = requireEs2023_array();
const es2023_collection_1 = requireEs2023_collection();
const es2023_full_1 = requireEs2023_full();
const es2023_intl_1 = requireEs2023_intl();
const esnext_1 = requireEsnext();
const esnext_array_1 = requireEsnext_array();
const esnext_asynciterable_1 = requireEsnext_asynciterable();
const esnext_bigint_1 = requireEsnext_bigint();
const esnext_collection_1 = requireEsnext_collection();
const esnext_decorators_1 = requireEsnext_decorators();
const esnext_disposable_1 = requireEsnext_disposable();
const esnext_full_1 = requireEsnext_full();
const esnext_intl_1 = requireEsnext_intl();
const esnext_iterator_1 = requireEsnext_iterator();
const esnext_object_1 = requireEsnext_object();
const esnext_promise_1 = requireEsnext_promise();
const esnext_regexp_1 = requireEsnext_regexp();
const esnext_string_1 = requireEsnext_string();
const esnext_symbol_1 = requireEsnext_symbol();
const esnext_weakref_1 = requireEsnext_weakref();
const lib_1 = requireLib$1();
const scripthost_1 = requireScripthost();
const webworker_1 = requireWebworker();
const webworker_asynciterable_1 = requireWebworker_asynciterable();
const webworker_importscripts_1 = requireWebworker_importscripts();
const webworker_iterable_1 = requireWebworker_iterable();
const lib = {
decorators: decorators_1.decorators,
'decorators.legacy': decorators_legacy_1.decorators_legacy,
dom: dom_1.dom,
'dom.asynciterable': dom_asynciterable_1.dom_asynciterable,
'dom.iterable': dom_iterable_1.dom_iterable,
es5: es5_1.es5,
es6: es6_1.es6,
es7: es7_1.es7,
es2015: es2015_1.es2015,
'es2015.collection': es2015_collection_1.es2015_collection,
'es2015.core': es2015_core_1.es2015_core,
'es2015.generator': es2015_generator_1.es2015_generator,
'es2015.iterable': es2015_iterable_1.es2015_iterable,
'es2015.promise': es2015_promise_1.es2015_promise,
'es2015.proxy': es2015_proxy_1.es2015_proxy,
'es2015.reflect': es2015_reflect_1.es2015_reflect,
'es2015.symbol': es2015_symbol_1.es2015_symbol,
'es2015.symbol.wellknown': es2015_symbol_wellknown_1.es2015_symbol_wellknown,
es2016: es2016_1.es2016,
'es2016.array.include': es2016_array_include_1.es2016_array_include,
'es2016.full': es2016_full_1.es2016_full,
'es2016.intl': es2016_intl_1.es2016_intl,
es2017: es2017_1.es2017,
'es2017.date': es2017_date_1.es2017_date,
'es2017.full': es2017_full_1.es2017_full,
'es2017.intl': es2017_intl_1.es2017_intl,
'es2017.object': es2017_object_1.es2017_object,
'es2017.sharedmemory': es2017_sharedmemory_1.es2017_sharedmemory,
'es2017.string': es2017_string_1.es2017_string,
'es2017.typedarrays': es2017_typedarrays_1.es2017_typedarrays,
es2018: es2018_1.es2018,
'es2018.asyncgenerator': es2018_asyncgenerator_1.es2018_asyncgenerator,
'es2018.asynciterable': es2018_asynciterable_1.es2018_asynciterable,
'es2018.full': es2018_full_1.es2018_full,
'es2018.intl': es2018_intl_1.es2018_intl,
'es2018.promise': es2018_promise_1.es2018_promise,
'es2018.regexp': es2018_regexp_1.es2018_regexp,
es2019: es2019_1.es2019,
'es2019.array': es2019_array_1.es2019_array,
'es2019.full': es2019_full_1.es2019_full,
'es2019.intl': es2019_intl_1.es2019_intl,
'es2019.object': es2019_object_1.es2019_object,
'es2019.string': es2019_string_1.es2019_string,
'es2019.symbol': es2019_symbol_1.es2019_symbol,
es2020: es2020_1.es2020,
'es2020.bigint': es2020_bigint_1.es2020_bigint,
'es2020.date': es2020_date_1.es2020_date,
'es2020.full': es2020_full_1.es2020_full,
'es2020.intl': es2020_intl_1.es2020_intl,
'es2020.number': es2020_number_1.es2020_number,
'es2020.promise': es2020_promise_1.es2020_promise,
'es2020.sharedmemory': es2020_sharedmemory_1.es2020_sharedmemory,
'es2020.string': es2020_string_1.es2020_string,
'es2020.symbol.wellknown': es2020_symbol_wellknown_1.es2020_symbol_wellknown,
es2021: es2021_1.es2021,
'es2021.full': es2021_full_1.es2021_full,
'es2021.intl': es2021_intl_1.es2021_intl,
'es2021.promise': es2021_promise_1.es2021_promise,
'es2021.string': es2021_string_1.es2021_string,
'es2021.weakref': es2021_weakref_1.es2021_weakref,
es2022: es2022_1.es2022,
'es2022.array': es2022_array_1.es2022_array,
'es2022.error': es2022_error_1.es2022_error,
'es2022.full': es2022_full_1.es2022_full,
'es2022.intl': es2022_intl_1.es2022_intl,
'es2022.object': es2022_object_1.es2022_object,
'es2022.regexp': es2022_regexp_1.es2022_regexp,
'es2022.sharedmemory': es2022_sharedmemory_1.es2022_sharedmemory,
'es2022.string': es2022_string_1.es2022_string,
es2023: es2023_1.es2023,
'es2023.array': es2023_array_1.es2023_array,
'es2023.collection': es2023_collection_1.es2023_collection,
'es2023.full': es2023_full_1.es2023_full,
'es2023.intl': es2023_intl_1.es2023_intl,
esnext: esnext_1.esnext,
'esnext.array': esnext_array_1.esnext_array,
'esnext.asynciterable': esnext_asynciterable_1.esnext_asynciterable,
'esnext.bigint': esnext_bigint_1.esnext_bigint,
'esnext.collection': esnext_collection_1.esnext_collection,
'esnext.decorators': esnext_decorators_1.esnext_decorators,
'esnext.disposable': esnext_disposable_1.esnext_disposable,
'esnext.full': esnext_full_1.esnext_full,
'esnext.intl': esnext_intl_1.esnext_intl,
'esnext.iterator': esnext_iterator_1.esnext_iterator,
'esnext.object': esnext_object_1.esnext_object,
'esnext.promise': esnext_promise_1.esnext_promise,
'esnext.regexp': esnext_regexp_1.esnext_regexp,
'esnext.string': esnext_string_1.esnext_string,
'esnext.symbol': esnext_symbol_1.esnext_symbol,
'esnext.weakref': esnext_weakref_1.esnext_weakref,
lib: lib_1.lib,
scripthost: scripthost_1.scripthost,
webworker: webworker_1.webworker,
'webworker.asynciterable': webworker_asynciterable_1.webworker_asynciterable,
'webworker.importscripts': webworker_importscripts_1.webworker_importscripts,
'webworker.iterable': webworker_iterable_1.webworker_iterable
};
lib$1.lib = lib;
return lib$1;
}
var ClassVisitor = {};
var TypeVisitor = {};
var scope = {};
var BlockScope = {};
var ScopeBase = {};
var Reference = {};
var hasRequiredReference;
function requireReference() {
if (hasRequiredReference) return Reference;
hasRequiredReference = 1;
_Object$defineProperty(Reference, "__esModule", {
value: true
});
Reference.ReferenceTypeFlag = Reference.ReferenceFlag = Reference.Reference = undefined;
const ID_1 = requireID();
var ReferenceFlag;
(function (ReferenceFlag) {
ReferenceFlag[ReferenceFlag["Read"] = 1] = "Read";
ReferenceFlag[ReferenceFlag["Write"] = 2] = "Write";
ReferenceFlag[ReferenceFlag["ReadWrite"] = 3] = "ReadWrite";
})(ReferenceFlag || (Reference.ReferenceFlag = ReferenceFlag = {}));
const generator = (0, ID_1.createIdGenerator)();
var ReferenceTypeFlag;
(function (ReferenceTypeFlag) {
ReferenceTypeFlag[ReferenceTypeFlag["Value"] = 1] = "Value";
ReferenceTypeFlag[ReferenceTypeFlag["Type"] = 2] = "Type";
})(ReferenceTypeFlag || (Reference.ReferenceTypeFlag = ReferenceTypeFlag = {}));
/**
* A Reference represents a single occurrence of an identifier in code.
*/
let Reference$1 = class Reference {
/**
* A unique ID for this instance - primarily used to help debugging and testing
*/
$id = generator();
/**
* The read-write mode of the reference.
*/
#flag;
/**
* Reference to the enclosing Scope.
* @public
*/
from;
/**
* Identifier syntax node.
* @public
*/
identifier;
/**
* `true` if this writing reference is a variable initializer or a default value.
* @public
*/
init;
maybeImplicitGlobal;
/**
* The {@link Variable} object that this reference refers to. If such variable was not defined, this is `null`.
* @public
*/
resolved;
/**
* If reference is writeable, this is the node being written to it.
* @public
*/
writeExpr;
/**
* In some cases, a reference may be a type, value or both a type and value reference.
*/
#referenceType;
constructor(identifier, scope, flag, writeExpr, maybeImplicitGlobal, init, referenceType = ReferenceTypeFlag.Value) {
this.identifier = identifier;
this.from = scope;
this.resolved = null;
this.#flag = flag;
if (this.isWrite()) {
this.writeExpr = writeExpr;
this.init = init;
}
this.maybeImplicitGlobal = maybeImplicitGlobal;
this.#referenceType = referenceType;
}
/**
* True if this reference can reference types
*/
get isTypeReference() {
return (this.#referenceType & ReferenceTypeFlag.Type) !== 0;
}
/**
* True if this reference can reference values
*/
get isValueReference() {
return (this.#referenceType & ReferenceTypeFlag.Value) !== 0;
}
/**
* Whether the reference is writeable.
* @public
*/
isWrite() {
return !!(this.#flag & ReferenceFlag.Write);
}
/**
* Whether the reference is readable.
* @public
*/
isRead() {
return !!(this.#flag & ReferenceFlag.Read);
}
/**
* Whether the reference is read-only.
* @public
*/
isReadOnly() {
return this.#flag === ReferenceFlag.Read;
}
/**
* Whether the reference is write-only.
* @public
*/
isWriteOnly() {
return this.#flag === ReferenceFlag.Write;
}
/**
* Whether the reference is read-write.
* @public
*/
isReadWrite() {
return this.#flag === ReferenceFlag.ReadWrite;
}
};
Reference.Reference = Reference$1;
return Reference;
}
var variable = {};
var ESLintScopeVariable = {};
var VariableBase = {};
var hasRequiredVariableBase;
function requireVariableBase() {
if (hasRequiredVariableBase) return VariableBase;
hasRequiredVariableBase = 1;
_Object$defineProperty(VariableBase, "__esModule", {
value: true
});
VariableBase.VariableBase = undefined;
const ID_1 = requireID();
const generator = (0, ID_1.createIdGenerator)();
let VariableBase$1 = class VariableBase {
/**
* A unique ID for this instance - primarily used to help debugging and testing
*/
$id = generator();
/**
* The array of the definitions of this variable.
* @public
*/
defs = [];
/**
* True if the variable is considered used for the purposes of `no-unused-vars`, false otherwise.
* @public
*/
eslintUsed = false;
/**
* The array of `Identifier` nodes which define this variable.
* If this variable is redeclared, this array includes two or more nodes.
* @public
*/
identifiers = [];
/**
* The variable name, as given in the source code.
* @public
*/
name;
/**
* List of {@link Reference} of this variable (excluding parameter entries) in its defining scope and all nested scopes.
* For defining occurrences only see {@link Variable#defs}.
* @public
*/
references = [];
/**
* Reference to the enclosing Scope.
*/
scope;
constructor(name, scope) {
this.name = name;
this.scope = scope;
}
};
VariableBase.VariableBase = VariableBase$1;
return VariableBase;
}
var hasRequiredESLintScopeVariable;
function requireESLintScopeVariable() {
if (hasRequiredESLintScopeVariable) return ESLintScopeVariable;
hasRequiredESLintScopeVariable = 1;
_Object$defineProperty(ESLintScopeVariable, "__esModule", {
value: true
});
ESLintScopeVariable.ESLintScopeVariable = undefined;
const VariableBase_1 = requireVariableBase();
/**
* ESLint defines global variables using the eslint-scope Variable class
* This is declared her for consumers to use
*/
let ESLintScopeVariable$1 = class ESLintScopeVariable extends VariableBase_1.VariableBase {
/**
* Written to by ESLint.
* If this key exists, this variable is a global variable added by ESLint.
* If this is `true`, this variable can be assigned arbitrary values.
* If this is `false`, this variable is readonly.
*/
writeable; // note that this isn't a typo - ESlint uses this spelling here
/**
* Written to by ESLint.
* This property is undefined if there are no globals directive comments.
* The array of globals directive comments which defined this global variable in the source code file.
*/
eslintExplicitGlobal;
/**
* Written to by ESLint.
* The configured value in config files. This can be different from `variable.writeable` if there are globals directive comments.
*/
eslintImplicitGlobalSetting;
/**
* Written to by ESLint.
* If this key exists, it is a global variable added by ESLint.
* If `true`, this global variable was defined by a globals directive comment in the source code file.
*/
eslintExplicitGlobalComments;
};
ESLintScopeVariable.ESLintScopeVariable = ESLintScopeVariable$1;
return ESLintScopeVariable;
}
var ImplicitLibVariable = {};
var hasRequiredImplicitLibVariable;
function requireImplicitLibVariable() {
if (hasRequiredImplicitLibVariable) return ImplicitLibVariable;
hasRequiredImplicitLibVariable = 1;
_Object$defineProperty(ImplicitLibVariable, "__esModule", {
value: true
});
ImplicitLibVariable.ImplicitLibVariable = undefined;
const ESLintScopeVariable_1 = requireESLintScopeVariable();
/**
* An variable implicitly defined by the TS Lib
*/
let ImplicitLibVariable$1 = class ImplicitLibVariable extends ESLintScopeVariable_1.ESLintScopeVariable {
/**
* `true` if the variable is valid in a type context, false otherwise
*/
isTypeVariable;
/**
* `true` if the variable is valid in a value context, false otherwise
*/
isValueVariable;
constructor(scope, name, {
eslintImplicitGlobalSetting,
isTypeVariable,
isValueVariable,
writeable
}) {
super(name, scope);
this.isTypeVariable = isTypeVariable != null ? isTypeVariable : false;
this.isValueVariable = isValueVariable != null ? isValueVariable : false;
this.writeable = writeable != null ? writeable : false;
this.eslintImplicitGlobalSetting = eslintImplicitGlobalSetting != null ? eslintImplicitGlobalSetting : 'readonly';
}
};
ImplicitLibVariable.ImplicitLibVariable = ImplicitLibVariable$1;
return ImplicitLibVariable;
}
var Variable = {};
var hasRequiredVariable$1;
function requireVariable$1() {
if (hasRequiredVariable$1) return Variable;
hasRequiredVariable$1 = 1;
_Object$defineProperty(Variable, "__esModule", {
value: true
});
Variable.Variable = undefined;
const VariableBase_1 = requireVariableBase();
/**
* A Variable represents a locally scoped identifier. These include arguments to functions.
*/
let Variable$1 = class Variable extends VariableBase_1.VariableBase {
/**
* `true` if the variable is valid in a type context, false otherwise
* @public
*/
get isTypeVariable() {
var _context;
if (this.defs.length === 0) {
// we don't statically know whether this is a type or a value
return true;
}
return _someInstanceProperty(_context = this.defs).call(_context, def => def.isTypeDefinition);
}
/**
* `true` if the variable is valid in a value context, false otherwise
* @public
*/
get isValueVariable() {
var _context2;
if (this.defs.length === 0) {
// we don't statically know whether this is a type or a value
return true;
}
return _someInstanceProperty(_context2 = this.defs).call(_context2, def => def.isVariableDefinition);
}
};
Variable.Variable = Variable$1;
return Variable;
}
var hasRequiredVariable;
function requireVariable() {
if (hasRequiredVariable) return variable;
hasRequiredVariable = 1;
(function (exports) {
_Object$defineProperty(exports, "__esModule", {
value: true
});
exports.Variable = exports.ImplicitLibVariable = exports.ESLintScopeVariable = undefined;
var ESLintScopeVariable_1 = requireESLintScopeVariable();
_Object$defineProperty(exports, "ESLintScopeVariable", {
enumerable: true,
get: function () {
return ESLintScopeVariable_1.ESLintScopeVariable;
}
});
var ImplicitLibVariable_1 = requireImplicitLibVariable();
_Object$defineProperty(exports, "ImplicitLibVariable", {
enumerable: true,
get: function () {
return ImplicitLibVariable_1.ImplicitLibVariable;
}
});
var Variable_1 = requireVariable$1();
_Object$defineProperty(exports, "Variable", {
enumerable: true,
get: function () {
return Variable_1.Variable;
}
});
})(variable);
return variable;
}
var ScopeType = {};
var hasRequiredScopeType;
function requireScopeType() {
if (hasRequiredScopeType) return ScopeType;
hasRequiredScopeType = 1;
_Object$defineProperty(ScopeType, "__esModule", {
value: true
});
ScopeType.ScopeType = undefined;
var ScopeType$1;
(function (ScopeType) {
ScopeType["block"] = "block";
ScopeType["catch"] = "catch";
ScopeType["class"] = "class";
ScopeType["classFieldInitializer"] = "class-field-initializer";
ScopeType["classStaticBlock"] = "class-static-block";
ScopeType["conditionalType"] = "conditionalType";
ScopeType["for"] = "for";
ScopeType["function"] = "function";
ScopeType["functionExpressionName"] = "function-expression-name";
ScopeType["functionType"] = "functionType";
ScopeType["global"] = "global";
ScopeType["mappedType"] = "mappedType";
ScopeType["module"] = "module";
ScopeType["switch"] = "switch";
ScopeType["tsEnum"] = "tsEnum";
ScopeType["tsModule"] = "tsModule";
ScopeType["type"] = "type";
ScopeType["with"] = "with";
})(ScopeType$1 || (ScopeType.ScopeType = ScopeType$1 = {}));
return ScopeType;
}
var hasRequiredScopeBase;
function requireScopeBase() {
if (hasRequiredScopeBase) return ScopeBase;
hasRequiredScopeBase = 1;
_Object$defineProperty(ScopeBase, "__esModule", {
value: true
});
ScopeBase.ScopeBase = undefined;
const types_1 = requireDist$3();
const assert_1 = requireAssert();
const definition_1 = requireDefinition();
const ID_1 = requireID();
const Reference_1 = requireReference();
const variable_1 = requireVariable();
const ScopeType_1 = requireScopeType();
/**
* Test if scope is strict
*/
function isStrictScope(scope, block, isMethodDefinition) {
var _scope$upper;
let body;
// When upper scope is exists and strict, inner scope is also strict.
if ((_scope$upper = scope.upper) != null && _scope$upper.isStrict) {
return true;
}
if (isMethodDefinition) {
return true;
}
if (scope.type === ScopeType_1.ScopeType.class || scope.type === ScopeType_1.ScopeType.conditionalType || scope.type === ScopeType_1.ScopeType.functionType || scope.type === ScopeType_1.ScopeType.mappedType || scope.type === ScopeType_1.ScopeType.module || scope.type === ScopeType_1.ScopeType.tsEnum || scope.type === ScopeType_1.ScopeType.tsModule || scope.type === ScopeType_1.ScopeType.type) {
return true;
}
if (scope.type === ScopeType_1.ScopeType.block || scope.type === ScopeType_1.ScopeType.switch) {
return false;
}
if (scope.type === ScopeType_1.ScopeType.function) {
const functionBody = block;
switch (functionBody.type) {
case types_1.AST_NODE_TYPES.ArrowFunctionExpression:
if (functionBody.body.type !== types_1.AST_NODE_TYPES.BlockStatement) {
return false;
}
body = functionBody.body;
break;
case types_1.AST_NODE_TYPES.Program:
body = functionBody;
break;
default:
body = functionBody.body;
}
if (!body) {
return false;
}
} else if (scope.type === ScopeType_1.ScopeType.global) {
body = block;
} else {
return false;
}
// Search 'use strict' directive.
for (const stmt of body.body) {
if (stmt.type !== types_1.AST_NODE_TYPES.ExpressionStatement) {
break;
}
if (stmt.directive === 'use strict') {
return true;
}
const expr = stmt.expression;
if (expr.type !== types_1.AST_NODE_TYPES.Literal) {
break;
}
if (expr.raw === '"use strict"' || expr.raw === "'use strict'") {
return true;
}
if (expr.value === 'use strict') {
return true;
}
}
return false;
}
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]);
}
}
const generator = (0, ID_1.createIdGenerator)();
const VARIABLE_SCOPE_TYPES = new _Set([ScopeType_1.ScopeType.classFieldInitializer, ScopeType_1.ScopeType.classStaticBlock, ScopeType_1.ScopeType.function, ScopeType_1.ScopeType.global, ScopeType_1.ScopeType.module, ScopeType_1.ScopeType.tsModule]);
let ScopeBase$1 = class ScopeBase {
/**
* A unique ID for this instance - primarily used to help debugging and testing
*/
$id = generator();
/**
* The AST node which created this scope.
* @public
*/
block;
/**
* The array of child scopes. This does not include grandchild scopes.
* @public
*/
childScopes = [];
/**
* A map of the variables for each node in this scope.
* This is map is a pointer to the one in the parent ScopeManager instance
*/
#declaredVariables;
/**
* 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.
* All those scopes are considered "dynamic".
*/
#dynamic;
/**
* Whether this scope is created by a FunctionExpression.
* @public
*/
functionExpressionScope = false;
/**
* Whether 'use strict' is in effect in this scope.
* @public
*/
isStrict;
/**
* List of {@link Reference}s that are left to be resolved (i.e. which
* need to be linked to the variable they refer to).
*/
leftToResolve = [];
/**
* Any variable {@link 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.
* @public
*/
references = [];
/**
* The map from variable names to variable objects.
* @public
*/
set = new _Map();
/**
* The {@link Reference}s that are not resolved with this scope.
* @public
*/
through = [];
type;
/**
* Reference to the parent {@link Scope}.
* @public
*/
upper;
/**
* 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.
* This does not include variables which are defined in child scopes.
* @public
*/
variables = [];
/**
* For scopes that can contain variable declarations, this is a self-reference.
* For other scope types this is the *variableScope* value of the parent scope.
* @public
*/
#dynamicCloseRef = ref => {
// notify all names are through to global
let current = this;
do {
/* eslint-disable @typescript-eslint/no-non-null-assertion */
current.through.push(ref);
current = current.upper;
/* eslint-enable @typescript-eslint/no-non-null-assertion */
} while (current);
};
#globalCloseRef = (ref, scopeManager) => {
// let/const/class declarations should be resolved statically.
// others should be resolved dynamically.
if (this.shouldStaticallyCloseForGlobal(ref, scopeManager)) {
this.#staticCloseRef(ref);
} else {
this.#dynamicCloseRef(ref);
}
};
#staticCloseRef = ref => {
const resolve = () => {
const name = ref.identifier.name;
const variable = this.set.get(name);
if (!variable) {
return false;
}
if (!this.isValidResolution(ref, variable)) {
return false;
}
// make sure we don't match a type reference to a value variable
const isValidTypeReference = ref.isTypeReference && variable.isTypeVariable;
const isValidValueReference = ref.isValueReference && variable.isValueVariable;
if (!isValidTypeReference && !isValidValueReference) {
return false;
}
variable.references.push(ref);
ref.resolved = variable;
return true;
};
if (!resolve()) {
this.delegateToUpperScope(ref);
}
};
variableScope;
constructor(scopeManager, type, upperScope, block, isMethodDefinition) {
const upperScopeAsScopeBase = upperScope;
this.type = type;
this.#dynamic = this.type === ScopeType_1.ScopeType.global || this.type === ScopeType_1.ScopeType.with;
this.block = block;
this.variableScope = this.isVariableScope() ? this :
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
upperScopeAsScopeBase.variableScope;
this.upper = upperScope;
/**
* Whether 'use strict' is in effect in this scope.
* @member {boolean} Scope#isStrict
*/
this.isStrict = isStrictScope(this, block, isMethodDefinition);
// this is guaranteed to be correct at runtime
upperScopeAsScopeBase == null || upperScopeAsScopeBase.childScopes.push(this);
this.#declaredVariables = scopeManager.declaredVariables;
registerScope(scopeManager, this);
}
isVariableScope() {
return VARIABLE_SCOPE_TYPES.has(this.type);
}
shouldStaticallyCloseForGlobal(ref, scopeManager) {
// On global scope, let/const/class declarations should be resolved statically.
const name = ref.identifier.name;
const variable = this.set.get(name);
if (!variable) {
return false;
}
// variable exists on the scope
// in module mode, we can statically resolve everything, regardless of its decl type
if (scopeManager.isModule()) {
return true;
}
// in script mode, only certain cases should be statically resolved
// Example:
// a `var` decl is ignored by the runtime if it clashes with a global name
// this means that we should not resolve the reference to the variable
const defs = variable.defs;
return defs.length > 0 && _everyInstanceProperty(defs).call(defs, def => {
if (def.type === definition_1.DefinitionType.Variable && def.parent.kind === 'var') {
return false;
}
return true;
});
}
close(scopeManager) {
var _context;
let closeRef;
if (this.shouldStaticallyClose()) {
closeRef = this.#staticCloseRef;
} else if (this.type !== 'global') {
closeRef = this.#dynamicCloseRef;
} else {
closeRef = this.#globalCloseRef;
}
// Try Resolving all references in this scope.
(0, assert_1.assert)(this.leftToResolve);
_forEachInstanceProperty(_context = this.leftToResolve).call(_context, ref => closeRef(ref, scopeManager));
this.leftToResolve = null;
return this.upper;
}
shouldStaticallyClose() {
return !this.#dynamic;
}
/**
* To override by function scopes.
* References in default parameters isn't resolved to variables which are in their function body.
*/
defineVariable(nameOrVariable, set, variables, node, def) {
const name = typeof nameOrVariable === 'string' ? nameOrVariable : nameOrVariable.name;
let variable = set.get(name);
if (!variable) {
variable = typeof nameOrVariable === 'string' ? new variable_1.Variable(name, this) : nameOrVariable;
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);
}
}
delegateToUpperScope(ref) {
var _this$upper;
(_this$upper = this.upper) == null || (_this$upper = _this$upper.leftToResolve) == null || _this$upper.push(ref);
this.through.push(ref);
}
isValidResolution(_ref, _variable) {
return true;
}
addDeclaredVariablesOfNode(variable, node) {
if (node == null) {
return;
}
let variables = this.#declaredVariables.get(node);
if (variables == null) {
variables = [];
this.#declaredVariables.set(node, variables);
}
if (!_includesInstanceProperty(variables).call(variables, variable)) {
variables.push(variable);
}
}
defineIdentifier(node, def) {
this.defineVariable(node.name, this.set, this.variables, node, def);
}
defineLiteralIdentifier(node, def) {
this.defineVariable(node.value, this.set, this.variables, null, def);
}
referenceDualValueType(node) {
var _this$leftToResolve;
const ref = new Reference_1.Reference(node, this, Reference_1.ReferenceFlag.Read, null, null, false, Reference_1.ReferenceTypeFlag.Type | Reference_1.ReferenceTypeFlag.Value);
this.references.push(ref);
(_this$leftToResolve = this.leftToResolve) == null || _this$leftToResolve.push(ref);
}
referenceType(node) {
var _this$leftToResolve2;
const ref = new Reference_1.Reference(node, this, Reference_1.ReferenceFlag.Read, null, null, false, Reference_1.ReferenceTypeFlag.Type);
this.references.push(ref);
(_this$leftToResolve2 = this.leftToResolve) == null || _this$leftToResolve2.push(ref);
}
referenceValue(node, assign = Reference_1.ReferenceFlag.Read, writeExpr, maybeImplicitGlobal, init = false) {
var _this$leftToResolve3;
const ref = new Reference_1.Reference(node, this, assign, writeExpr, maybeImplicitGlobal, init, Reference_1.ReferenceTypeFlag.Value);
this.references.push(ref);
(_this$leftToResolve3 = this.leftToResolve) == null || _this$leftToResolve3.push(ref);
}
};
ScopeBase.ScopeBase = ScopeBase$1;
return ScopeBase;
}
var hasRequiredBlockScope;
function requireBlockScope() {
if (hasRequiredBlockScope) return BlockScope;
hasRequiredBlockScope = 1;
_Object$defineProperty(BlockScope, "__esModule", {
value: true
});
BlockScope.BlockScope = undefined;
const ScopeBase_1 = requireScopeBase();
const ScopeType_1 = requireScopeType();
let BlockScope$1 = class BlockScope extends ScopeBase_1.ScopeBase {
constructor(scopeManager, upperScope, block) {
super(scopeManager, ScopeType_1.ScopeType.block, upperScope, block, false);
}
};
BlockScope.BlockScope = BlockScope$1;
return BlockScope;
}
var CatchScope = {};
var hasRequiredCatchScope;
function requireCatchScope() {
if (hasRequiredCatchScope) return CatchScope;
hasRequiredCatchScope = 1;
_Object$defineProperty(CatchScope, "__esModule", {
value: true
});
CatchScope.CatchScope = undefined;
const ScopeBase_1 = requireScopeBase();
const ScopeType_1 = requireScopeType();
let CatchScope$1 = class CatchScope extends ScopeBase_1.ScopeBase {
constructor(scopeManager, upperScope, block) {
super(scopeManager, ScopeType_1.ScopeType.catch, upperScope, block, false);
}
};
CatchScope.CatchScope = CatchScope$1;
return CatchScope;
}
var ClassFieldInitializerScope = {};
var hasRequiredClassFieldInitializerScope;
function requireClassFieldInitializerScope() {
if (hasRequiredClassFieldInitializerScope) return ClassFieldInitializerScope;
hasRequiredClassFieldInitializerScope = 1;
_Object$defineProperty(ClassFieldInitializerScope, "__esModule", {
value: true
});
ClassFieldInitializerScope.ClassFieldInitializerScope = undefined;
const ScopeBase_1 = requireScopeBase();
const ScopeType_1 = requireScopeType();
let ClassFieldInitializerScope$1 = class ClassFieldInitializerScope extends ScopeBase_1.ScopeBase {
constructor(scopeManager, upperScope, block) {
super(scopeManager, ScopeType_1.ScopeType.classFieldInitializer, upperScope, block, false);
}
};
ClassFieldInitializerScope.ClassFieldInitializerScope = ClassFieldInitializerScope$1;
return ClassFieldInitializerScope;
}
var ClassScope = {};
var hasRequiredClassScope;
function requireClassScope() {
if (hasRequiredClassScope) return ClassScope;
hasRequiredClassScope = 1;
_Object$defineProperty(ClassScope, "__esModule", {
value: true
});
ClassScope.ClassScope = undefined;
const ScopeBase_1 = requireScopeBase();
const ScopeType_1 = requireScopeType();
let ClassScope$1 = class ClassScope extends ScopeBase_1.ScopeBase {
constructor(scopeManager, upperScope, block) {
super(scopeManager, ScopeType_1.ScopeType.class, upperScope, block, false);
}
};
ClassScope.ClassScope = ClassScope$1;
return ClassScope;
}
var ConditionalTypeScope = {};
var hasRequiredConditionalTypeScope;
function requireConditionalTypeScope() {
if (hasRequiredConditionalTypeScope) return ConditionalTypeScope;
hasRequiredConditionalTypeScope = 1;
_Object$defineProperty(ConditionalTypeScope, "__esModule", {
value: true
});
ConditionalTypeScope.ConditionalTypeScope = undefined;
const ScopeBase_1 = requireScopeBase();
const ScopeType_1 = requireScopeType();
let ConditionalTypeScope$1 = class ConditionalTypeScope extends ScopeBase_1.ScopeBase {
constructor(scopeManager, upperScope, block) {
super(scopeManager, ScopeType_1.ScopeType.conditionalType, upperScope, block, false);
}
};
ConditionalTypeScope.ConditionalTypeScope = ConditionalTypeScope$1;
return ConditionalTypeScope;
}
var ForScope = {};
var hasRequiredForScope;
function requireForScope() {
if (hasRequiredForScope) return ForScope;
hasRequiredForScope = 1;
_Object$defineProperty(ForScope, "__esModule", {
value: true
});
ForScope.ForScope = undefined;
const ScopeBase_1 = requireScopeBase();
const ScopeType_1 = requireScopeType();
let ForScope$1 = class ForScope extends ScopeBase_1.ScopeBase {
constructor(scopeManager, upperScope, block) {
super(scopeManager, ScopeType_1.ScopeType.for, upperScope, block, false);
}
};
ForScope.ForScope = ForScope$1;
return ForScope;
}
var FunctionExpressionNameScope = {};
var hasRequiredFunctionExpressionNameScope;
function requireFunctionExpressionNameScope() {
if (hasRequiredFunctionExpressionNameScope) return FunctionExpressionNameScope;
hasRequiredFunctionExpressionNameScope = 1;
_Object$defineProperty(FunctionExpressionNameScope, "__esModule", {
value: true
});
FunctionExpressionNameScope.FunctionExpressionNameScope = undefined;
const definition_1 = requireDefinition();
const ScopeBase_1 = requireScopeBase();
const ScopeType_1 = requireScopeType();
let FunctionExpressionNameScope$1 = class FunctionExpressionNameScope extends ScopeBase_1.ScopeBase {
functionExpressionScope;
constructor(scopeManager, upperScope, block) {
super(scopeManager, ScopeType_1.ScopeType.functionExpressionName, upperScope, block, false);
if (block.id) {
this.defineIdentifier(block.id, new definition_1.FunctionNameDefinition(block.id, block));
}
this.functionExpressionScope = true;
}
};
FunctionExpressionNameScope.FunctionExpressionNameScope = FunctionExpressionNameScope$1;
return FunctionExpressionNameScope;
}
var FunctionScope = {};
var hasRequiredFunctionScope;
function requireFunctionScope() {
if (hasRequiredFunctionScope) return FunctionScope;
hasRequiredFunctionScope = 1;
_Object$defineProperty(FunctionScope, "__esModule", {
value: true
});
FunctionScope.FunctionScope = undefined;
const types_1 = requireDist$3();
const ScopeBase_1 = requireScopeBase();
const ScopeType_1 = requireScopeType();
let FunctionScope$1 = class FunctionScope extends ScopeBase_1.ScopeBase {
constructor(scopeManager, upperScope, block, isMethodDefinition) {
super(scopeManager, ScopeType_1.ScopeType.function, upperScope, block, isMethodDefinition);
// section 9.2.13, FunctionDeclarationInstantiation.
// NOTE Arrow functions never have an arguments objects.
if (this.block.type !== types_1.AST_NODE_TYPES.ArrowFunctionExpression) {
this.defineVariable('arguments', this.set, this.variables, null, null);
}
}
// 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) {
var _this$block$body$rang, _this$block$body, _context;
// If `options.globalReturn` is true, `this.block` becomes a Program node.
if (this.block.type === types_1.AST_NODE_TYPES.Program) {
return true;
}
const bodyStart = (_this$block$body$rang = (_this$block$body = this.block.body) == null ? undefined : _this$block$body.range[0]) != null ? _this$block$body$rang : -1;
// It's invalid resolution in the following case:
return !(variable.scope === this && ref.identifier.range[0] < bodyStart &&
// the reference is in the parameter part.
_everyInstanceProperty(_context = variable.defs).call(_context, d => d.name.range[0] >= bodyStart) // the variable is in the body.
);
}
};
FunctionScope.FunctionScope = FunctionScope$1;
return FunctionScope;
}
var FunctionTypeScope = {};
var hasRequiredFunctionTypeScope;
function requireFunctionTypeScope() {
if (hasRequiredFunctionTypeScope) return FunctionTypeScope;
hasRequiredFunctionTypeScope = 1;
_Object$defineProperty(FunctionTypeScope, "__esModule", {
value: true
});
FunctionTypeScope.FunctionTypeScope = undefined;
const ScopeBase_1 = requireScopeBase();
const ScopeType_1 = requireScopeType();
let FunctionTypeScope$1 = class FunctionTypeScope extends ScopeBase_1.ScopeBase {
constructor(scopeManager, upperScope, block) {
super(scopeManager, ScopeType_1.ScopeType.functionType, upperScope, block, false);
}
};
FunctionTypeScope.FunctionTypeScope = FunctionTypeScope$1;
return FunctionTypeScope;
}
var GlobalScope = {};
var hasRequiredGlobalScope;
function requireGlobalScope() {
if (hasRequiredGlobalScope) return GlobalScope;
hasRequiredGlobalScope = 1;
_Object$defineProperty(GlobalScope, "__esModule", {
value: true
});
GlobalScope.GlobalScope = undefined;
const types_1 = requireDist$3();
const assert_1 = requireAssert();
const ImplicitGlobalVariableDefinition_1 = requireImplicitGlobalVariableDefinition();
const variable_1 = requireVariable();
const ScopeBase_1 = requireScopeBase();
const ScopeType_1 = requireScopeType();
let GlobalScope$1 = class GlobalScope extends ScopeBase_1.ScopeBase {
// note this is accessed in used in the legacy eslint-scope tests, so it can't be true private
implicit;
constructor(scopeManager, block) {
super(scopeManager, ScopeType_1.ScopeType.global, null, block, false);
this.implicit = {
leftToBeResolved: [],
set: new _Map(),
variables: []
};
}
close(scopeManager) {
(0, assert_1.assert)(this.leftToResolve);
for (const ref of this.leftToResolve) {
if (ref.maybeImplicitGlobal && !this.set.has(ref.identifier.name)) {
// create an implicit global variable from assignment expression
const info = ref.maybeImplicitGlobal;
const node = info.pattern;
if (node.type === types_1.AST_NODE_TYPES.Identifier) {
this.defineVariable(node.name, this.implicit.set, this.implicit.variables, node, new ImplicitGlobalVariableDefinition_1.ImplicitGlobalVariableDefinition(info.pattern, info.node));
}
}
}
this.implicit.leftToBeResolved = this.leftToResolve;
return super.close(scopeManager);
}
defineImplicitVariable(name, options) {
this.defineVariable(new variable_1.ImplicitLibVariable(this, name, options), this.set, this.variables, null, null);
}
};
GlobalScope.GlobalScope = GlobalScope$1;
return GlobalScope;
}
var MappedTypeScope = {};
var hasRequiredMappedTypeScope;
function requireMappedTypeScope() {
if (hasRequiredMappedTypeScope) return MappedTypeScope;
hasRequiredMappedTypeScope = 1;
_Object$defineProperty(MappedTypeScope, "__esModule", {
value: true
});
MappedTypeScope.MappedTypeScope = undefined;
const ScopeBase_1 = requireScopeBase();
const ScopeType_1 = requireScopeType();
let MappedTypeScope$1 = class MappedTypeScope extends ScopeBase_1.ScopeBase {
constructor(scopeManager, upperScope, block) {
super(scopeManager, ScopeType_1.ScopeType.mappedType, upperScope, block, false);
}
};
MappedTypeScope.MappedTypeScope = MappedTypeScope$1;
return MappedTypeScope;
}
var ModuleScope = {};
var hasRequiredModuleScope;
function requireModuleScope() {
if (hasRequiredModuleScope) return ModuleScope;
hasRequiredModuleScope = 1;
_Object$defineProperty(ModuleScope, "__esModule", {
value: true
});
ModuleScope.ModuleScope = undefined;
const ScopeBase_1 = requireScopeBase();
const ScopeType_1 = requireScopeType();
let ModuleScope$1 = class ModuleScope extends ScopeBase_1.ScopeBase {
constructor(scopeManager, upperScope, block) {
super(scopeManager, ScopeType_1.ScopeType.module, upperScope, block, false);
}
};
ModuleScope.ModuleScope = ModuleScope$1;
return ModuleScope;
}
var Scope = {};
var hasRequiredScope$2;
function requireScope$2() {
if (hasRequiredScope$2) return Scope;
hasRequiredScope$2 = 1;
_Object$defineProperty(Scope, "__esModule", {
value: true
});
return Scope;
}
var SwitchScope = {};
var hasRequiredSwitchScope;
function requireSwitchScope() {
if (hasRequiredSwitchScope) return SwitchScope;
hasRequiredSwitchScope = 1;
_Object$defineProperty(SwitchScope, "__esModule", {
value: true
});
SwitchScope.SwitchScope = undefined;
const ScopeBase_1 = requireScopeBase();
const ScopeType_1 = requireScopeType();
let SwitchScope$1 = class SwitchScope extends ScopeBase_1.ScopeBase {
constructor(scopeManager, upperScope, block) {
super(scopeManager, ScopeType_1.ScopeType.switch, upperScope, block, false);
}
};
SwitchScope.SwitchScope = SwitchScope$1;
return SwitchScope;
}
var TSEnumScope = {};
var hasRequiredTSEnumScope;
function requireTSEnumScope() {
if (hasRequiredTSEnumScope) return TSEnumScope;
hasRequiredTSEnumScope = 1;
_Object$defineProperty(TSEnumScope, "__esModule", {
value: true
});
TSEnumScope.TSEnumScope = undefined;
const ScopeBase_1 = requireScopeBase();
const ScopeType_1 = requireScopeType();
let TSEnumScope$1 = class TSEnumScope extends ScopeBase_1.ScopeBase {
constructor(scopeManager, upperScope, block) {
super(scopeManager, ScopeType_1.ScopeType.tsEnum, upperScope, block, false);
}
};
TSEnumScope.TSEnumScope = TSEnumScope$1;
return TSEnumScope;
}
var TSModuleScope = {};
var hasRequiredTSModuleScope;
function requireTSModuleScope() {
if (hasRequiredTSModuleScope) return TSModuleScope;
hasRequiredTSModuleScope = 1;
_Object$defineProperty(TSModuleScope, "__esModule", {
value: true
});
TSModuleScope.TSModuleScope = undefined;
const ScopeBase_1 = requireScopeBase();
const ScopeType_1 = requireScopeType();
let TSModuleScope$1 = class TSModuleScope extends ScopeBase_1.ScopeBase {
constructor(scopeManager, upperScope, block) {
super(scopeManager, ScopeType_1.ScopeType.tsModule, upperScope, block, false);
}
};
TSModuleScope.TSModuleScope = TSModuleScope$1;
return TSModuleScope;
}
var TypeScope = {};
var hasRequiredTypeScope;
function requireTypeScope() {
if (hasRequiredTypeScope) return TypeScope;
hasRequiredTypeScope = 1;
_Object$defineProperty(TypeScope, "__esModule", {
value: true
});
TypeScope.TypeScope = undefined;
const ScopeBase_1 = requireScopeBase();
const ScopeType_1 = requireScopeType();
let TypeScope$1 = class TypeScope extends ScopeBase_1.ScopeBase {
constructor(scopeManager, upperScope, block) {
super(scopeManager, ScopeType_1.ScopeType.type, upperScope, block, false);
}
};
TypeScope.TypeScope = TypeScope$1;
return TypeScope;
}
var WithScope = {};
var hasRequiredWithScope;
function requireWithScope() {
if (hasRequiredWithScope) return WithScope;
hasRequiredWithScope = 1;
_Object$defineProperty(WithScope, "__esModule", {
value: true
});
WithScope.WithScope = undefined;
const assert_1 = requireAssert();
const ScopeBase_1 = requireScopeBase();
const ScopeType_1 = requireScopeType();
let WithScope$1 = class WithScope extends ScopeBase_1.ScopeBase {
constructor(scopeManager, upperScope, block) {
super(scopeManager, ScopeType_1.ScopeType.with, upperScope, block, false);
}
close(scopeManager) {
var _context;
if (this.shouldStaticallyClose()) {
return super.close(scopeManager);
}
(0, assert_1.assert)(this.leftToResolve);
_forEachInstanceProperty(_context = this.leftToResolve).call(_context, ref => this.delegateToUpperScope(ref));
this.leftToResolve = null;
return this.upper;
}
};
WithScope.WithScope = WithScope$1;
return WithScope;
}
var hasRequiredScope$1;
function requireScope$1() {
if (hasRequiredScope$1) return scope;
hasRequiredScope$1 = 1;
(function (exports) {
var __createBinding = scope.__createBinding || (_Object$create ? function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = _Object$getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = {
enumerable: true,
get: function () {
return m[k];
}
};
}
_Object$defineProperty(o, k2, desc);
} : function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
var __exportStar = scope.__exportStar || function (m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
_Object$defineProperty(exports, "__esModule", {
value: true
});
__exportStar(requireBlockScope(), exports);
__exportStar(requireCatchScope(), exports);
__exportStar(requireClassFieldInitializerScope(), exports);
__exportStar(requireClassScope(), exports);
__exportStar(requireConditionalTypeScope(), exports);
__exportStar(requireForScope(), exports);
__exportStar(requireFunctionExpressionNameScope(), exports);
__exportStar(requireFunctionScope(), exports);
__exportStar(requireFunctionTypeScope(), exports);
__exportStar(requireGlobalScope(), exports);
__exportStar(requireMappedTypeScope(), exports);
__exportStar(requireModuleScope(), exports);
__exportStar(requireScope$2(), exports);
__exportStar(requireScopeType(), exports);
__exportStar(requireSwitchScope(), exports);
__exportStar(requireTSEnumScope(), exports);
__exportStar(requireTSModuleScope(), exports);
__exportStar(requireTypeScope(), exports);
__exportStar(requireWithScope(), exports);
})(scope);
return scope;
}
var Visitor = {};
var PatternVisitor = {};
var VisitorBase = {};
var hasRequiredVisitorBase;
function requireVisitorBase() {
if (hasRequiredVisitorBase) return VisitorBase;
hasRequiredVisitorBase = 1;
_Object$defineProperty(VisitorBase, "__esModule", {
value: true
});
VisitorBase.VisitorBase = undefined;
const visitor_keys_1 = requireDist$2();
function isObject(obj) {
return typeof obj === 'object' && obj != null;
}
function isNode(node) {
return isObject(node) && typeof node.type === 'string';
}
let VisitorBase$1 = class VisitorBase {
#childVisitorKeys;
#visitChildrenEvenIfSelectorExists;
constructor(options) {
var _options$childVisitor, _options$visitChildre;
this.#childVisitorKeys = (_options$childVisitor = options.childVisitorKeys) != null ? _options$childVisitor : visitor_keys_1.visitorKeys;
this.#visitChildrenEvenIfSelectorExists = (_options$visitChildre = options.visitChildrenEvenIfSelectorExists) != null ? _options$visitChildre : false;
}
/**
* Default method for visiting children.
* @param node the node whose children should be visited
* @param excludeArr a list of keys to not visit
*/
visitChildren(node, excludeArr = []) {
var _this$childVisitorKey;
if ((node == null ? undefined : node.type) == null) {
return;
}
const exclude = new _Set([...excludeArr, 'parent']);
const children = (_this$childVisitorKey = this.#childVisitorKeys[node.type]) != null ? _this$childVisitorKey : _Object$keys(node);
for (const key of children) {
if (exclude.has(key)) {
continue;
}
const child = node[key];
if (!child) {
continue;
}
if (_Array$isArray(child)) {
for (const subChild of child) {
if (isNode(subChild)) {
this.visit(subChild);
}
}
} else if (isNode(child)) {
this.visit(child);
}
}
}
/**
* Dispatching node.
*/
visit(node) {
if ((node == null ? undefined : node.type) == null) {
return;
}
const visitor = this[node.type];
if (visitor) {
visitor.call(this, node);
if (!this.#visitChildrenEvenIfSelectorExists) {
return;
}
}
this.visitChildren(node);
}
};
VisitorBase.VisitorBase = VisitorBase$1;
return VisitorBase;
}
var hasRequiredPatternVisitor;
function requirePatternVisitor() {
if (hasRequiredPatternVisitor) return PatternVisitor;
hasRequiredPatternVisitor = 1;
_Object$defineProperty(PatternVisitor, "__esModule", {
value: true
});
PatternVisitor.PatternVisitor = undefined;
const types_1 = requireDist$3();
const VisitorBase_1 = requireVisitorBase();
let PatternVisitor$1 = class PatternVisitor extends VisitorBase_1.VisitorBase {
#assignments = [];
#callback;
#restElements = [];
#rootPattern;
rightHandNodes = [];
constructor(options, rootPattern, callback) {
super(options);
this.#rootPattern = rootPattern;
this.#callback = callback;
}
static isPattern(node) {
const nodeType = node.type;
return nodeType === types_1.AST_NODE_TYPES.Identifier || nodeType === types_1.AST_NODE_TYPES.ObjectPattern || nodeType === types_1.AST_NODE_TYPES.ArrayPattern || nodeType === types_1.AST_NODE_TYPES.SpreadElement || nodeType === types_1.AST_NODE_TYPES.RestElement || nodeType === types_1.AST_NODE_TYPES.AssignmentPattern;
}
ArrayExpression(node) {
var _context;
_forEachInstanceProperty(_context = node.elements).call(_context, this.visit, this);
}
ArrayPattern(pattern) {
for (const element of pattern.elements) {
this.visit(element);
}
}
AssignmentExpression(node) {
this.#assignments.push(node);
this.visit(node.left);
this.rightHandNodes.push(node.right);
this.#assignments.pop();
}
AssignmentPattern(pattern) {
this.#assignments.push(pattern);
this.visit(pattern.left);
this.rightHandNodes.push(pattern.right);
this.#assignments.pop();
}
CallExpression(node) {
var _context2;
// arguments are right hand nodes.
_forEachInstanceProperty(_context2 = node.arguments).call(_context2, a => {
this.rightHandNodes.push(a);
});
this.visit(node.callee);
}
Decorator() {
// don't visit any decorators when exploring a pattern
}
Identifier(pattern) {
var _context3;
const lastRestElement = _atInstanceProperty(_context3 = this.#restElements).call(_context3, -1);
this.#callback(pattern, {
assignments: this.#assignments,
rest: (lastRestElement == null ? undefined : lastRestElement.argument) === pattern,
topLevel: pattern === this.#rootPattern
});
}
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);
}
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);
}
RestElement(pattern) {
this.#restElements.push(pattern);
this.visit(pattern.argument);
this.#restElements.pop();
}
SpreadElement(node) {
this.visit(node.argument);
}
TSTypeAnnotation() {
// we don't want to visit types
}
};
PatternVisitor.PatternVisitor = PatternVisitor$1;
return PatternVisitor;
}
var hasRequiredVisitor;
function requireVisitor() {
if (hasRequiredVisitor) return Visitor;
hasRequiredVisitor = 1;
(function (exports) {
_Object$defineProperty(exports, "__esModule", {
value: true
});
exports.VisitorBase = exports.Visitor = undefined;
const PatternVisitor_1 = requirePatternVisitor();
const VisitorBase_1 = requireVisitorBase();
class Visitor extends VisitorBase_1.VisitorBase {
#options;
constructor(optionsOrVisitor) {
super(optionsOrVisitor instanceof Visitor ? optionsOrVisitor.#options : optionsOrVisitor);
this.#options = optionsOrVisitor instanceof Visitor ? optionsOrVisitor.#options : optionsOrVisitor;
}
visitPattern(node, callback, options = {
processRightHandNodes: false
}) {
// Call the callback at left hand identifier nodes, and Collect right hand nodes.
const visitor = new PatternVisitor_1.PatternVisitor(this.#options, node, callback);
visitor.visit(node);
// Process the right hand nodes recursively.
if (options.processRightHandNodes) {
var _context;
_forEachInstanceProperty(_context = visitor.rightHandNodes).call(_context, this.visit, this);
}
}
}
exports.Visitor = Visitor;
var VisitorBase_2 = requireVisitorBase();
_Object$defineProperty(exports, "VisitorBase", {
enumerable: true,
get: function () {
return VisitorBase_2.VisitorBase;
}
});
})(Visitor);
return Visitor;
}
var hasRequiredTypeVisitor;
function requireTypeVisitor() {
if (hasRequiredTypeVisitor) return TypeVisitor;
hasRequiredTypeVisitor = 1;
_Object$defineProperty(TypeVisitor, "__esModule", {
value: true
});
TypeVisitor.TypeVisitor = undefined;
const types_1 = requireDist$3();
const definition_1 = requireDefinition();
const scope_1 = requireScope$1();
const Visitor_1 = requireVisitor();
let TypeVisitor$1 = class TypeVisitor extends Visitor_1.Visitor {
#referencer;
constructor(referencer) {
super(referencer);
this.#referencer = referencer;
}
static visit(referencer, node) {
const typeReferencer = new TypeVisitor(referencer);
typeReferencer.visit(node);
}
///////////////////
// Visit helpers //
///////////////////
visitFunctionType(node) {
// arguments and type parameters can only be referenced from within the function
this.#referencer.scopeManager.nestFunctionTypeScope(node);
this.visit(node.typeParameters);
for (const param of node.params) {
let didVisitAnnotation = false;
this.visitPattern(param, (pattern, info) => {
// a parameter name creates a value type variable which can be referenced later via typeof arg
this.#referencer.currentScope().defineIdentifier(pattern, new definition_1.ParameterDefinition(pattern, node, info.rest));
if (pattern.typeAnnotation) {
this.visit(pattern.typeAnnotation);
didVisitAnnotation = true;
}
});
// there are a few special cases where the type annotation is owned by the parameter, not the pattern
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
if (!didVisitAnnotation && 'typeAnnotation' in param) {
this.visit(param.typeAnnotation);
}
}
this.visit(node.returnType);
this.#referencer.close(node);
}
visitPropertyKey(node) {
if (!node.computed) {
return;
}
// computed members are treated as value references, and TS expects they have a literal type
this.#referencer.visit(node.key);
}
/////////////////////
// Visit selectors //
/////////////////////
Identifier(node) {
this.#referencer.currentScope().referenceType(node);
}
MemberExpression(node) {
this.visit(node.object);
// don't visit the property
}
TSCallSignatureDeclaration(node) {
this.visitFunctionType(node);
}
TSConditionalType(node) {
// conditional types can define inferred type parameters
// which are only accessible from inside the conditional parameter
this.#referencer.scopeManager.nestConditionalTypeScope(node);
// type parameters inferred in the condition clause are not accessible within the false branch
this.visitChildren(node, ['falseType']);
this.#referencer.close(node);
this.visit(node.falseType);
}
TSConstructorType(node) {
this.visitFunctionType(node);
}
TSConstructSignatureDeclaration(node) {
this.visitFunctionType(node);
}
TSFunctionType(node) {
this.visitFunctionType(node);
}
TSImportType(node) {
// the TS parser allows any type to be the parameter, but it's a syntax error - so we can ignore it
this.visit(node.typeArguments);
// the qualifier is just part of a standard EntityName, so it should not be visited
}
TSIndexSignature(node) {
for (const param of node.parameters) {
if (param.type === types_1.AST_NODE_TYPES.Identifier) {
this.visit(param.typeAnnotation);
}
}
this.visit(node.typeAnnotation);
}
TSInferType(node) {
const typeParameter = node.typeParameter;
let scope = this.#referencer.currentScope();
/*
In cases where there is a sub-type scope created within a conditional type, then the generic should be defined in the
conditional type's scope, not the child type scope.
If we define it within the child type's scope then it won't be able to be referenced outside the child type
*/
if (scope.type === scope_1.ScopeType.functionType || scope.type === scope_1.ScopeType.mappedType) {
// search up the scope tree to figure out if we're in a nested type scope
let currentScope = scope.upper;
while (currentScope) {
if (currentScope.type === scope_1.ScopeType.functionType || currentScope.type === scope_1.ScopeType.mappedType) {
// ensure valid type parents only
currentScope = currentScope.upper;
continue;
}
if (currentScope.type === scope_1.ScopeType.conditionalType) {
scope = currentScope;
break;
}
break;
}
}
scope.defineIdentifier(typeParameter.name, new definition_1.TypeDefinition(typeParameter.name, typeParameter));
this.visit(typeParameter.constraint);
}
TSInterfaceDeclaration(node) {
var _context;
this.#referencer.currentScope().defineIdentifier(node.id, new definition_1.TypeDefinition(node.id, node));
if (node.typeParameters) {
// type parameters cannot be referenced from outside their current scope
this.#referencer.scopeManager.nestTypeScope(node);
this.visit(node.typeParameters);
}
_forEachInstanceProperty(_context = node.extends).call(_context, this.visit, this);
this.visit(node.body);
if (node.typeParameters) {
this.#referencer.close(node);
}
}
TSMappedType(node) {
// mapped types key can only be referenced within their return value
this.#referencer.scopeManager.nestMappedTypeScope(node);
this.#referencer.currentScope().defineIdentifier(node.key, new definition_1.TypeDefinition(node.key, node));
this.visit(node.constraint);
this.visit(node.nameType);
this.visit(node.typeAnnotation);
this.#referencer.close(node);
}
TSMethodSignature(node) {
this.visitPropertyKey(node);
this.visitFunctionType(node);
}
TSNamedTupleMember(node) {
this.visit(node.elementType);
// we don't visit the label as the label only exists for the purposes of documentation
}
TSPropertySignature(node) {
this.visitPropertyKey(node);
this.visit(node.typeAnnotation);
}
TSQualifiedName(node) {
this.visit(node.left);
// we don't visit the right as it a name on the thing, not a name to reference
}
TSTypeAliasDeclaration(node) {
this.#referencer.currentScope().defineIdentifier(node.id, new definition_1.TypeDefinition(node.id, node));
if (node.typeParameters) {
// type parameters cannot be referenced from outside their current scope
this.#referencer.scopeManager.nestTypeScope(node);
this.visit(node.typeParameters);
}
this.visit(node.typeAnnotation);
if (node.typeParameters) {
this.#referencer.close(node);
}
}
TSTypeParameter(node) {
this.#referencer.currentScope().defineIdentifier(node.name, new definition_1.TypeDefinition(node.name, node));
this.visit(node.constraint);
this.visit(node.default);
}
TSTypePredicate(node) {
if (node.parameterName.type !== types_1.AST_NODE_TYPES.TSThisType) {
this.#referencer.currentScope().referenceValue(node.parameterName);
}
this.visit(node.typeAnnotation);
}
// a type query `typeof foo` is a special case that references a _non-type_ variable,
TSTypeAnnotation(node) {
// check
this.visitChildren(node);
}
TSTypeQuery(node) {
let entityName;
if (node.exprName.type === types_1.AST_NODE_TYPES.TSQualifiedName) {
let iter = node.exprName;
while (iter.left.type === types_1.AST_NODE_TYPES.TSQualifiedName) {
iter = iter.left;
}
entityName = iter.left;
} else {
entityName = node.exprName;
if (node.exprName.type === types_1.AST_NODE_TYPES.TSImportType) {
this.visit(node.exprName);
}
}
if (entityName.type === types_1.AST_NODE_TYPES.Identifier) {
this.#referencer.currentScope().referenceValue(entityName);
}
this.visit(node.typeArguments);
}
};
TypeVisitor.TypeVisitor = TypeVisitor$1;
return TypeVisitor;
}
var hasRequiredClassVisitor;
function requireClassVisitor() {
if (hasRequiredClassVisitor) return ClassVisitor;
hasRequiredClassVisitor = 1;
_Object$defineProperty(ClassVisitor, "__esModule", {
value: true
});
ClassVisitor.ClassVisitor = undefined;
const types_1 = requireDist$3();
const definition_1 = requireDefinition();
const TypeVisitor_1 = requireTypeVisitor();
const Visitor_1 = requireVisitor();
let ClassVisitor$1 = class ClassVisitor extends Visitor_1.Visitor {
#classNode;
#referencer;
constructor(referencer, node) {
super(referencer);
this.#referencer = referencer;
this.#classNode = node;
}
static visit(referencer, node) {
const classVisitor = new ClassVisitor(referencer, node);
classVisitor.visitClass(node);
}
visit(node) {
// make sure we only handle the nodes we are designed to handle
if (node && node.type in this) {
super.visit(node);
} else {
this.#referencer.visit(node);
}
}
///////////////////
// Visit helpers //
///////////////////
visitClass(node) {
var _context, _context2;
if (node.type === types_1.AST_NODE_TYPES.ClassDeclaration && node.id) {
this.#referencer.currentScope().defineIdentifier(node.id, new definition_1.ClassNameDefinition(node.id, node));
}
_forEachInstanceProperty(_context = node.decorators).call(_context, d => this.#referencer.visit(d));
this.#referencer.scopeManager.nestClassScope(node);
if (node.id) {
// define the class name again inside the new scope
// references to the class should not resolve directly to the parent class
this.#referencer.currentScope().defineIdentifier(node.id, new definition_1.ClassNameDefinition(node.id, node));
}
this.#referencer.visit(node.superClass);
// visit the type param declarations
this.visitType(node.typeParameters);
// then the usages
this.visitType(node.superTypeArguments);
_forEachInstanceProperty(_context2 = node.implements).call(_context2, imp => this.visitType(imp));
this.visit(node.body);
this.#referencer.close(node);
}
visitFunctionParameterTypeAnnotation(node) {
switch (node.type) {
case types_1.AST_NODE_TYPES.AssignmentPattern:
this.visitType(node.left.typeAnnotation);
break;
case types_1.AST_NODE_TYPES.TSParameterProperty:
this.visitFunctionParameterTypeAnnotation(node.parameter);
break;
default:
this.visitType(node.typeAnnotation);
}
}
visitMethod(node) {
var _context3;
if (node.computed) {
this.#referencer.visit(node.key);
}
if (node.value.type === types_1.AST_NODE_TYPES.FunctionExpression) {
this.visitMethodFunction(node.value, node);
} else {
this.#referencer.visit(node.value);
}
_forEachInstanceProperty(_context3 = node.decorators).call(_context3, d => this.#referencer.visit(d));
}
visitMethodFunction(node, methodNode) {
var _context4;
if (node.id) {
// FunctionExpression with name creates its special scope;
// FunctionExpressionNameScope.
this.#referencer.scopeManager.nestFunctionExpressionNameScope(node);
}
// Consider this function is in the MethodDefinition.
this.#referencer.scopeManager.nestFunctionScope(node, true);
/**
* class A {
* @meta // <--- check this
* foo(a: Type) {}
*
* @meta // <--- check this
* foo(): Type {}
* }
*/
let withMethodDecorators = !!methodNode.decorators.length;
/**
* class A {
* foo(
* @meta // <--- check this
* a: Type
* ) {}
*
* set foo(
* @meta // <--- EXCEPT this. TS do nothing for this
* a: Type
* ) {}
* }
*/
withMethodDecorators || (withMethodDecorators = methodNode.kind !== 'set' && _someInstanceProperty(_context4 = node.params).call(_context4, param => param.decorators.length));
if (!withMethodDecorators && methodNode.kind === 'set') {
var _this$classNode$body$, _context5;
const keyName = getLiteralMethodKeyName(methodNode);
/**
* class A {
* @meta // <--- check this
* get a() {}
* set ['a'](v: Type) {}
* }
*/
if (keyName != null && (_this$classNode$body$ = _findInstanceProperty(_context5 = this.#classNode.body.body).call(_context5, node => node !== methodNode && node.type === types_1.AST_NODE_TYPES.MethodDefinition &&
// Node must both be static or not
node.static === methodNode.static && getLiteralMethodKeyName(node) === keyName)) != null && _this$classNode$body$.decorators.length) {
withMethodDecorators = true;
}
}
/**
* @meta // <--- check this
* class A {
* constructor(a: Type) {}
* }
*/
if (!withMethodDecorators && methodNode.kind === 'constructor' && this.#classNode.decorators.length) {
withMethodDecorators = true;
}
// Process parameter declarations.
for (const param of node.params) {
var _context6;
this.visitPattern(param, (pattern, info) => {
this.#referencer.currentScope().defineIdentifier(pattern, new definition_1.ParameterDefinition(pattern, node, info.rest));
this.#referencer.referencingDefaultValue(pattern, info.assignments, null, true);
}, {
processRightHandNodes: true
});
this.visitFunctionParameterTypeAnnotation(param);
_forEachInstanceProperty(_context6 = param.decorators).call(_context6, d => this.visit(d));
}
this.visitType(node.returnType);
this.visitType(node.typeParameters);
this.#referencer.visitChildren(node.body);
this.#referencer.close(node);
}
visitPropertyBase(node) {
var _context7;
if (node.computed) {
this.#referencer.visit(node.key);
}
if (node.value) {
if (node.type === types_1.AST_NODE_TYPES.PropertyDefinition || node.type === types_1.AST_NODE_TYPES.AccessorProperty) {
this.#referencer.scopeManager.nestClassFieldInitializerScope(node.value);
}
this.#referencer.visit(node.value);
if (node.type === types_1.AST_NODE_TYPES.PropertyDefinition || node.type === types_1.AST_NODE_TYPES.AccessorProperty) {
this.#referencer.close(node.value);
}
}
_forEachInstanceProperty(_context7 = node.decorators).call(_context7, d => this.#referencer.visit(d));
}
visitPropertyDefinition(node) {
this.visitPropertyBase(node);
/**
* class A {
* @meta // <--- check this
* foo: Type;
* }
*/
this.visitType(node.typeAnnotation);
}
visitType(node) {
if (!node) {
return;
}
TypeVisitor_1.TypeVisitor.visit(this.#referencer, node);
}
/////////////////////
// Visit selectors //
/////////////////////
AccessorProperty(node) {
this.visitPropertyDefinition(node);
}
ClassBody(node) {
// this is here on purpose so that this visitor explicitly declares visitors
// for all nodes it cares about (see the instance visit method above)
this.visitChildren(node);
}
Identifier(node) {
this.#referencer.visit(node);
}
MethodDefinition(node) {
this.visitMethod(node);
}
PrivateIdentifier() {
// intentionally skip
}
PropertyDefinition(node) {
this.visitPropertyDefinition(node);
}
StaticBlock(node) {
var _context8;
this.#referencer.scopeManager.nestClassStaticBlockScope(node);
_forEachInstanceProperty(_context8 = node.body).call(_context8, b => this.visit(b));
this.#referencer.close(node);
}
TSAbstractAccessorProperty(node) {
this.visitPropertyDefinition(node);
}
TSAbstractMethodDefinition(node) {
this.visitPropertyBase(node);
}
TSAbstractPropertyDefinition(node) {
this.visitPropertyDefinition(node);
}
TSIndexSignature(node) {
this.visitType(node);
}
};
ClassVisitor.ClassVisitor = ClassVisitor$1;
/**
* Only if key is one of [identifier, string, number], ts will combine metadata of accessors .
* class A {
* get a() {}
* set ['a'](v: Type) {}
*
* get [1]() {}
* set [1](v: Type) {}
*
* // Following won't be combined
* get [key]() {}
* set [key](v: Type) {}
*
* get [true]() {}
* set [true](v: Type) {}
*
* get ['a'+'b']() {}
* set ['a'+'b']() {}
* }
*/
function getLiteralMethodKeyName(node) {
if (node.computed && node.key.type === types_1.AST_NODE_TYPES.Literal) {
if (typeof node.key.value === 'string' || typeof node.key.value === 'number') {
return node.key.value;
}
} else if (!node.computed && node.key.type === types_1.AST_NODE_TYPES.Identifier) {
return node.key.name;
}
return null;
}
return ClassVisitor;
}
var ExportVisitor = {};
var hasRequiredExportVisitor;
function requireExportVisitor() {
if (hasRequiredExportVisitor) return ExportVisitor;
hasRequiredExportVisitor = 1;
_Object$defineProperty(ExportVisitor, "__esModule", {
value: true
});
ExportVisitor.ExportVisitor = undefined;
const types_1 = requireDist$3();
const Visitor_1 = requireVisitor();
let ExportVisitor$1 = class ExportVisitor extends Visitor_1.Visitor {
#exportNode;
#referencer;
constructor(node, referencer) {
super(referencer);
this.#exportNode = node;
this.#referencer = referencer;
}
static visit(referencer, node) {
const exportReferencer = new ExportVisitor(node, referencer);
exportReferencer.visit(node);
}
ExportDefaultDeclaration(node) {
if (node.declaration.type === types_1.AST_NODE_TYPES.Identifier) {
// export default A;
// this could be a type or a variable
this.visit(node.declaration);
}
}
ExportNamedDeclaration(node) {
if (node.source) {
// export ... from 'foo';
// these are external identifiers so there shouldn't be references or defs
return;
}
if (!node.declaration) {
// export { x };
this.visitChildren(node);
}
}
ExportSpecifier(node) {
if (node.exportKind === 'type' && node.local.type === types_1.AST_NODE_TYPES.Identifier) {
// export { type T };
// type exports can only reference types
//
// we can't let this fall through to the Identifier selector because the exportKind is on this node
// and we don't have access to the `.parent` during scope analysis
this.#referencer.currentScope().referenceType(node.local);
} else {
this.visit(node.local);
}
}
Identifier(node) {
if (this.#exportNode.exportKind === 'type') {
// export type { T };
// type exports can only reference types
this.#referencer.currentScope().referenceType(node);
} else {
this.#referencer.currentScope().referenceDualValueType(node);
}
}
};
ExportVisitor.ExportVisitor = ExportVisitor$1;
return ExportVisitor;
}
var ImportVisitor = {};
var hasRequiredImportVisitor;
function requireImportVisitor() {
if (hasRequiredImportVisitor) return ImportVisitor;
hasRequiredImportVisitor = 1;
_Object$defineProperty(ImportVisitor, "__esModule", {
value: true
});
ImportVisitor.ImportVisitor = undefined;
const definition_1 = requireDefinition();
const Visitor_1 = requireVisitor();
let ImportVisitor$1 = class ImportVisitor extends Visitor_1.Visitor {
#declaration;
#referencer;
constructor(declaration, referencer) {
super(referencer);
this.#declaration = declaration;
this.#referencer = referencer;
}
static visit(referencer, declaration) {
const importReferencer = new ImportVisitor(declaration, referencer);
importReferencer.visit(declaration);
}
ImportDefaultSpecifier(node) {
const local = node.local;
this.visitImport(local, node);
}
ImportNamespaceSpecifier(node) {
const local = node.local;
this.visitImport(local, node);
}
ImportSpecifier(node) {
const local = node.local;
this.visitImport(local, node);
}
visitImport(id, specifier) {
this.#referencer.currentScope().defineIdentifier(id, new definition_1.ImportBindingDefinition(id, specifier, this.#declaration));
}
};
ImportVisitor.ImportVisitor = ImportVisitor$1;
return ImportVisitor;
}
var hasRequiredReferencer$1;
function requireReferencer$1() {
if (hasRequiredReferencer$1) return Referencer;
hasRequiredReferencer$1 = 1;
_Object$defineProperty(Referencer, "__esModule", {
value: true
});
Referencer.Referencer = undefined;
const types_1 = requireDist$3();
const assert_1 = requireAssert();
const definition_1 = requireDefinition();
const lib_1 = requireLib();
const ClassVisitor_1 = requireClassVisitor();
const ExportVisitor_1 = requireExportVisitor();
const ImportVisitor_1 = requireImportVisitor();
const PatternVisitor_1 = requirePatternVisitor();
const Reference_1 = requireReference();
const TypeVisitor_1 = requireTypeVisitor();
const Visitor_1 = requireVisitor();
// Referencing variables and creating bindings.
let Referencer$1 = class Referencer extends Visitor_1.Visitor {
#hasReferencedJsxFactory = false;
#hasReferencedJsxFragmentFactory = false;
#jsxFragmentName;
#jsxPragma;
#lib;
scopeManager;
constructor(options, scopeManager) {
super(options);
this.scopeManager = scopeManager;
this.#jsxPragma = options.jsxPragma;
this.#jsxFragmentName = options.jsxFragmentName;
this.#lib = options.lib;
}
populateGlobalsFromLib(globalScope) {
for (const lib of this.#lib) {
const variables = lib_1.lib[lib];
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
/* istanbul ignore if */
if (!variables) {
throw new Error(`Invalid value for lib provided: ${lib}`);
}
for (const [name, variable] of _Object$entries(variables)) {
globalScope.defineImplicitVariable(name, variable);
}
}
// for const assertions (`{} as const` / `<const>{}`)
globalScope.defineImplicitVariable('const', {
eslintImplicitGlobalSetting: 'readonly',
isTypeVariable: true,
isValueVariable: false
});
}
close(node) {
while (this.currentScope(true) && node === this.currentScope().block) {
this.scopeManager.currentScope = this.currentScope().close(this.scopeManager);
}
}
currentScope(dontThrowOnNull) {
if (!dontThrowOnNull) {
(0, assert_1.assert)(this.scopeManager.currentScope, 'aaa');
}
return this.scopeManager.currentScope;
}
referencingDefaultValue(pattern, assignments, maybeImplicitGlobal, init) {
_forEachInstanceProperty(assignments).call(assignments, assignment => {
this.currentScope().referenceValue(pattern, Reference_1.ReferenceFlag.Write, assignment.right, maybeImplicitGlobal, init);
});
}
/**
* Searches for a variable named "name" in the upper scopes and adds a pseudo-reference from itself to itself
*/
referenceInSomeUpperScope(name) {
let scope = this.scopeManager.currentScope;
while (scope) {
const variable = scope.set.get(name);
if (!variable) {
scope = scope.upper;
continue;
}
scope.referenceValue(variable.identifiers[0]);
return true;
}
return false;
}
referenceJsxFragment() {
if (this.#jsxFragmentName == null || this.#hasReferencedJsxFragmentFactory) {
return;
}
this.#hasReferencedJsxFragmentFactory = this.referenceInSomeUpperScope(this.#jsxFragmentName);
}
referenceJsxPragma() {
if (this.#jsxPragma == null || this.#hasReferencedJsxFactory) {
return;
}
this.#hasReferencedJsxFactory = this.referenceInSomeUpperScope(this.#jsxPragma);
}
///////////////////
// Visit helpers //
///////////////////
visitClass(node) {
ClassVisitor_1.ClassVisitor.visit(this, node);
}
visitForIn(node) {
if (node.left.type === types_1.AST_NODE_TYPES.VariableDeclaration && node.left.kind !== 'var') {
this.scopeManager.nestForScope(node);
}
if (node.left.type === types_1.AST_NODE_TYPES.VariableDeclaration) {
this.visit(node.left);
this.visitPattern(node.left.declarations[0].id, pattern => {
this.currentScope().referenceValue(pattern, Reference_1.ReferenceFlag.Write, node.right, null, true);
});
} else {
this.visitPattern(node.left, (pattern, info) => {
const maybeImplicitGlobal = !this.currentScope().isStrict ? {
node,
pattern
} : null;
this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false);
this.currentScope().referenceValue(pattern, Reference_1.ReferenceFlag.Write, node.right, maybeImplicitGlobal, false);
}, {
processRightHandNodes: true
});
}
this.visit(node.right);
this.visit(node.body);
this.close(node);
}
visitFunction(node) {
// 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 === types_1.AST_NODE_TYPES.FunctionExpression) {
if (node.id) {
// FunctionExpression with name creates its special scope;
// FunctionExpressionNameScope.
this.scopeManager.nestFunctionExpressionNameScope(node);
}
} else if (node.id) {
// id is defined in upper scope
this.currentScope().defineIdentifier(node.id, new definition_1.FunctionNameDefinition(node.id, node));
}
// Consider this function is in the MethodDefinition.
this.scopeManager.nestFunctionScope(node, false);
// Process parameter declarations.
for (const param of node.params) {
var _context;
this.visitPattern(param, (pattern, info) => {
this.currentScope().defineIdentifier(pattern, new definition_1.ParameterDefinition(pattern, node, info.rest));
this.referencingDefaultValue(pattern, info.assignments, null, true);
}, {
processRightHandNodes: true
});
this.visitFunctionParameterTypeAnnotation(param);
_forEachInstanceProperty(_context = param.decorators).call(_context, d => this.visit(d));
}
this.visitType(node.returnType);
this.visitType(node.typeParameters);
// 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 === types_1.AST_NODE_TYPES.BlockStatement) {
this.visitChildren(node.body);
} else {
this.visit(node.body);
}
}
this.close(node);
}
visitFunctionParameterTypeAnnotation(node) {
switch (node.type) {
case types_1.AST_NODE_TYPES.AssignmentPattern:
this.visitType(node.left.typeAnnotation);
break;
case types_1.AST_NODE_TYPES.TSParameterProperty:
this.visitFunctionParameterTypeAnnotation(node.parameter);
break;
default:
this.visitType(node.typeAnnotation);
break;
}
}
visitProperty(node) {
if (node.computed) {
this.visit(node.key);
}
this.visit(node.value);
}
visitType(node) {
if (!node) {
return;
}
TypeVisitor_1.TypeVisitor.visit(this, node);
}
visitTypeAssertion(node) {
this.visit(node.expression);
this.visitType(node.typeAnnotation);
}
/////////////////////
// Visit selectors //
/////////////////////
ArrowFunctionExpression(node) {
this.visitFunction(node);
}
AssignmentExpression(node) {
let left = node.left;
switch (left.type) {
case types_1.AST_NODE_TYPES.TSAsExpression:
case types_1.AST_NODE_TYPES.TSTypeAssertion:
// explicitly visit the type annotation
this.visitType(left.typeAnnotation);
// intentional fallthrough
case types_1.AST_NODE_TYPES.TSNonNullExpression:
// unwrap the expression
left = left.expression;
}
if (PatternVisitor_1.PatternVisitor.isPattern(left)) {
if (node.operator === '=') {
this.visitPattern(left, (pattern, info) => {
const maybeImplicitGlobal = !this.currentScope().isStrict ? {
node,
pattern
} : null;
this.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false);
this.currentScope().referenceValue(pattern, Reference_1.ReferenceFlag.Write, node.right, maybeImplicitGlobal, false);
}, {
processRightHandNodes: true
});
} else if (left.type === types_1.AST_NODE_TYPES.Identifier) {
this.currentScope().referenceValue(left, Reference_1.ReferenceFlag.ReadWrite, node.right);
}
} else {
this.visit(left);
}
this.visit(node.right);
}
BlockStatement(node) {
this.scopeManager.nestBlockScope(node);
this.visitChildren(node);
this.close(node);
}
BreakStatement() {
// don't reference the break statement's label
}
CallExpression(node) {
this.visitChildren(node, ['typeArguments']);
this.visitType(node.typeArguments);
}
CatchClause(node) {
this.scopeManager.nestCatchScope(node);
if (node.param) {
const param = node.param;
this.visitPattern(param, (pattern, info) => {
this.currentScope().defineIdentifier(pattern, new definition_1.CatchClauseDefinition(param, node));
this.referencingDefaultValue(pattern, info.assignments, null, true);
}, {
processRightHandNodes: true
});
}
this.visit(node.body);
this.close(node);
}
ClassDeclaration(node) {
this.visitClass(node);
}
ClassExpression(node) {
this.visitClass(node);
}
ContinueStatement() {
// don't reference the continue statement's label
}
ExportAllDeclaration() {
// this defines no local variables
}
ExportDefaultDeclaration(node) {
if (node.declaration.type === types_1.AST_NODE_TYPES.Identifier) {
ExportVisitor_1.ExportVisitor.visit(this, node);
} else {
this.visit(node.declaration);
}
}
ExportNamedDeclaration(node) {
if (node.declaration) {
this.visit(node.declaration);
} else {
ExportVisitor_1.ExportVisitor.visit(this, node);
}
}
ForInStatement(node) {
this.visitForIn(node);
}
ForOfStatement(node) {
this.visitForIn(node);
}
ForStatement(node) {
// Create ForStatement declaration.
// NOTE: In ES6, ForStatement dynamically generates per iteration environment. However, this is
// a static analyzer, we only generate one scope for ForStatement.
if (node.init && node.init.type === types_1.AST_NODE_TYPES.VariableDeclaration && node.init.kind !== 'var') {
this.scopeManager.nestForScope(node);
}
this.visitChildren(node);
this.close(node);
}
FunctionDeclaration(node) {
this.visitFunction(node);
}
FunctionExpression(node) {
this.visitFunction(node);
}
Identifier(node) {
this.currentScope().referenceValue(node);
this.visitType(node.typeAnnotation);
}
ImportAttribute() {
// import assertions are module metadata and thus have no variables to reference
}
ImportDeclaration(node) {
(0, assert_1.assert)(this.scopeManager.isModule(), 'ImportDeclaration should appear when the mode is ES6 and in the module context.');
ImportVisitor_1.ImportVisitor.visit(this, node);
}
JSXAttribute(node) {
this.visit(node.value);
}
JSXClosingElement() {
// should not be counted as a reference
}
JSXFragment(node) {
this.referenceJsxPragma();
this.referenceJsxFragment();
this.visitChildren(node);
}
JSXIdentifier(node) {
this.currentScope().referenceValue(node);
}
JSXMemberExpression(node) {
if (node.object.type !== types_1.AST_NODE_TYPES.JSXIdentifier || node.object.name !== 'this') {
this.visit(node.object);
}
// we don't ever reference the property as it's always going to be a property on the thing
}
JSXOpeningElement(node) {
this.referenceJsxPragma();
if (node.name.type === types_1.AST_NODE_TYPES.JSXIdentifier) {
if (node.name.name[0].toUpperCase() === node.name.name[0] || node.name.name === 'this') {
// lower cased component names are always treated as "intrinsic" names, and are converted to a string,
// not a variable by JSX transforms:
// <div /> => React.createElement("div", null)
// the only case we want to visit a lower-cased component has its name as "this",
this.visit(node.name);
}
} else {
this.visit(node.name);
}
this.visitType(node.typeArguments);
for (const attr of node.attributes) {
this.visit(attr);
}
}
LabeledStatement(node) {
this.visit(node.body);
}
MemberExpression(node) {
this.visit(node.object);
if (node.computed) {
this.visit(node.property);
}
}
MetaProperty() {
// meta properties all builtin globals
}
NewExpression(node) {
this.visitChildren(node, ['typeArguments']);
this.visitType(node.typeArguments);
}
PrivateIdentifier() {
// private identifiers are members on classes and thus have no variables to reference
}
Program(node) {
const globalScope = this.scopeManager.nestGlobalScope(node);
this.populateGlobalsFromLib(globalScope);
if (this.scopeManager.isGlobalReturn()) {
// Force strictness of GlobalScope to false when using node.js scope.
this.currentScope().isStrict = false;
this.scopeManager.nestFunctionScope(node, false);
}
if (this.scopeManager.isModule()) {
this.scopeManager.nestModuleScope(node);
}
if (this.scopeManager.isImpliedStrict()) {
this.currentScope().isStrict = true;
}
this.visitChildren(node);
this.close(node);
}
Property(node) {
this.visitProperty(node);
}
SwitchStatement(node) {
this.visit(node.discriminant);
this.scopeManager.nestSwitchScope(node);
for (const switchCase of node.cases) {
this.visit(switchCase);
}
this.close(node);
}
TaggedTemplateExpression(node) {
this.visit(node.tag);
this.visit(node.quasi);
this.visitType(node.typeArguments);
}
TSAsExpression(node) {
this.visitTypeAssertion(node);
}
TSDeclareFunction(node) {
this.visitFunction(node);
}
TSEmptyBodyFunctionExpression(node) {
this.visitFunction(node);
}
TSEnumDeclaration(node) {
this.currentScope().defineIdentifier(node.id, new definition_1.TSEnumNameDefinition(node.id, node));
// enum members can be referenced within the enum body
this.scopeManager.nestTSEnumScope(node);
for (const member of node.body.members) {
// TS resolves literal named members to be actual names
// enum Foo {
// 'a' = 1,
// b = a, // this references the 'a' member
// }
if (member.id.type === types_1.AST_NODE_TYPES.Literal && typeof member.id.value === 'string') {
const name = member.id;
this.currentScope().defineLiteralIdentifier(name, new definition_1.TSEnumMemberDefinition(name, member));
} else if (!member.computed && member.id.type === types_1.AST_NODE_TYPES.Identifier) {
this.currentScope().defineIdentifier(member.id, new definition_1.TSEnumMemberDefinition(member.id, member));
}
this.visit(member.initializer);
}
this.close(node);
}
TSExportAssignment(node) {
if (node.expression.type === types_1.AST_NODE_TYPES.Identifier) {
// this is a special case - you can `export = T` where `T` is a type OR a
// value however `T[U]` is illegal when `T` is a type and `T.U` is illegal
// when `T.U` is a type
// i.e. if the expression is JUST an Identifier - it could be either ref
// kind; otherwise the standard rules apply
this.currentScope().referenceDualValueType(node.expression);
} else {
this.visit(node.expression);
}
}
TSImportEqualsDeclaration(node) {
this.currentScope().defineIdentifier(node.id, new definition_1.ImportBindingDefinition(node.id, node, node));
if (node.moduleReference.type === types_1.AST_NODE_TYPES.TSQualifiedName) {
let moduleIdentifier = node.moduleReference.left;
while (moduleIdentifier.type === types_1.AST_NODE_TYPES.TSQualifiedName) {
moduleIdentifier = moduleIdentifier.left;
}
this.visit(moduleIdentifier);
} else {
this.visit(node.moduleReference);
}
}
TSInstantiationExpression(node) {
this.visitChildren(node, ['typeArguments']);
this.visitType(node.typeArguments);
}
TSInterfaceDeclaration(node) {
this.visitType(node);
}
TSModuleDeclaration(node) {
if (node.id.type === types_1.AST_NODE_TYPES.Identifier && node.kind !== 'global') {
this.currentScope().defineIdentifier(node.id, new definition_1.TSModuleNameDefinition(node.id, node));
}
this.scopeManager.nestTSModuleScope(node);
this.visit(node.body);
this.close(node);
}
TSSatisfiesExpression(node) {
this.visitTypeAssertion(node);
}
TSTypeAliasDeclaration(node) {
this.visitType(node);
}
TSTypeAssertion(node) {
this.visitTypeAssertion(node);
}
UpdateExpression(node) {
if (PatternVisitor_1.PatternVisitor.isPattern(node.argument)) {
this.visitPattern(node.argument, pattern => {
this.currentScope().referenceValue(pattern, Reference_1.ReferenceFlag.ReadWrite, null);
});
} else {
this.visitChildren(node);
}
}
VariableDeclaration(node) {
const variableTargetScope = node.kind === 'var' ? this.currentScope().variableScope : this.currentScope();
for (const decl of node.declarations) {
const init = decl.init;
this.visitPattern(decl.id, (pattern, info) => {
variableTargetScope.defineIdentifier(pattern, new definition_1.VariableDefinition(pattern, decl, node));
this.referencingDefaultValue(pattern, info.assignments, null, true);
if (init) {
this.currentScope().referenceValue(pattern, Reference_1.ReferenceFlag.Write, init, null, true);
}
}, {
processRightHandNodes: true
});
this.visit(decl.init);
this.visitType(decl.id.typeAnnotation);
}
}
WithStatement(node) {
this.visit(node.object);
// Then nest scope for WithStatement.
this.scopeManager.nestWithScope(node);
this.visit(node.body);
this.close(node);
}
};
Referencer.Referencer = Referencer$1;
return Referencer;
}
var hasRequiredReferencer;
function requireReferencer() {
if (hasRequiredReferencer) return referencer;
hasRequiredReferencer = 1;
(function (exports) {
_Object$defineProperty(exports, "__esModule", {
value: true
});
exports.Referencer = undefined;
var Referencer_1 = requireReferencer$1();
_Object$defineProperty(exports, "Referencer", {
enumerable: true,
get: function () {
return Referencer_1.Referencer;
}
});
})(referencer);
return referencer;
}
var ScopeManager = {};
var ClassStaticBlockScope = {};
var hasRequiredClassStaticBlockScope;
function requireClassStaticBlockScope() {
if (hasRequiredClassStaticBlockScope) return ClassStaticBlockScope;
hasRequiredClassStaticBlockScope = 1;
_Object$defineProperty(ClassStaticBlockScope, "__esModule", {
value: true
});
ClassStaticBlockScope.ClassStaticBlockScope = undefined;
const ScopeBase_1 = requireScopeBase();
const ScopeType_1 = requireScopeType();
let ClassStaticBlockScope$1 = class ClassStaticBlockScope extends ScopeBase_1.ScopeBase {
constructor(scopeManager, upperScope, block) {
super(scopeManager, ScopeType_1.ScopeType.classStaticBlock, upperScope, block, false);
}
};
ClassStaticBlockScope.ClassStaticBlockScope = ClassStaticBlockScope$1;
return ClassStaticBlockScope;
}
var hasRequiredScopeManager;
function requireScopeManager() {
if (hasRequiredScopeManager) return ScopeManager;
hasRequiredScopeManager = 1;
_Object$defineProperty(ScopeManager, "__esModule", {
value: true
});
ScopeManager.ScopeManager = undefined;
const assert_1 = requireAssert();
const scope_1 = requireScope$1();
const ClassFieldInitializerScope_1 = requireClassFieldInitializerScope();
const ClassStaticBlockScope_1 = requireClassStaticBlockScope();
/**
* @see https://eslint.org/docs/latest/developer-guide/scope-manager-interface#scopemanager-interface
*/
let ScopeManager$1 = class ScopeManager {
#options;
currentScope;
declaredVariables;
/**
* The root scope
*/
globalScope;
nodeToScope;
/**
* All scopes
* @public
*/
scopes;
constructor(options) {
this.scopes = [];
this.globalScope = null;
this.nodeToScope = new _WeakMap();
this.currentScope = null;
this.#options = options;
this.declaredVariables = new _WeakMap();
}
isES6() {
return true;
}
isGlobalReturn() {
return this.#options.globalReturn === true;
}
isImpliedStrict() {
return this.#options.impliedStrict === true;
}
isModule() {
return this.#options.sourceType === 'module';
}
isStrictModeSupported() {
return true;
}
get variables() {
var _context3, _context4;
const variables = new _Set();
function recurse(scope) {
var _context, _context2;
_forEachInstanceProperty(_context = scope.variables).call(_context, v => variables.add(v));
_forEachInstanceProperty(_context2 = scope.childScopes).call(_context2, recurse);
}
_forEachInstanceProperty(_context3 = this.scopes).call(_context3, recurse);
return _sortInstanceProperty(_context4 = [...variables]).call(_context4, (a, b) => a.$id - b.$id);
}
/**
* Get the variables that a given AST node defines. The gotten variables' `def[].node`/`def[].parent` property is the node.
* If the node does not define any variable, this returns an empty array.
* @param node An AST node to get their variables.
*/
getDeclaredVariables(node) {
var _this$declaredVariabl;
return (_this$declaredVariabl = this.declaredVariables.get(node)) != null ? _this$declaredVariabl : [];
}
/**
* Get the scope of a given AST node. The gotten scope's `block` property is the node.
* This method never returns `function-expression-name` scope. If the node does not have their scope, this returns `null`.
*
* @param node An AST node to get their scope.
* @param inner If the node has multiple scopes, this returns the outermost scope normally.
* If `inner` is `true` then this returns the innermost scope.
*/
acquire(node, inner = false) {
var _scopes$find;
function predicate(testScope) {
if (testScope.type === scope_1.ScopeType.function && testScope.functionExpressionScope) {
return false;
}
return true;
}
const scopes = this.nodeToScope.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;
}
}
return null;
}
return (_scopes$find = _findInstanceProperty(scopes).call(scopes, predicate)) != null ? _scopes$find : null;
}
nestBlockScope(node) {
(0, assert_1.assert)(this.currentScope);
return this.nestScope(new scope_1.BlockScope(this, this.currentScope, node));
}
nestCatchScope(node) {
(0, assert_1.assert)(this.currentScope);
return this.nestScope(new scope_1.CatchScope(this, this.currentScope, node));
}
nestClassFieldInitializerScope(node) {
(0, assert_1.assert)(this.currentScope);
return this.nestScope(new ClassFieldInitializerScope_1.ClassFieldInitializerScope(this, this.currentScope, node));
}
nestClassScope(node) {
(0, assert_1.assert)(this.currentScope);
return this.nestScope(new scope_1.ClassScope(this, this.currentScope, node));
}
nestClassStaticBlockScope(node) {
(0, assert_1.assert)(this.currentScope);
return this.nestScope(new ClassStaticBlockScope_1.ClassStaticBlockScope(this, this.currentScope, node));
}
nestConditionalTypeScope(node) {
(0, assert_1.assert)(this.currentScope);
return this.nestScope(new scope_1.ConditionalTypeScope(this, this.currentScope, node));
}
nestForScope(node) {
(0, assert_1.assert)(this.currentScope);
return this.nestScope(new scope_1.ForScope(this, this.currentScope, node));
}
nestFunctionExpressionNameScope(node) {
(0, assert_1.assert)(this.currentScope);
return this.nestScope(new scope_1.FunctionExpressionNameScope(this, this.currentScope, node));
}
nestFunctionScope(node, isMethodDefinition) {
(0, assert_1.assert)(this.currentScope);
return this.nestScope(new scope_1.FunctionScope(this, this.currentScope, node, isMethodDefinition));
}
nestFunctionTypeScope(node) {
(0, assert_1.assert)(this.currentScope);
return this.nestScope(new scope_1.FunctionTypeScope(this, this.currentScope, node));
}
nestGlobalScope(node) {
return this.nestScope(new scope_1.GlobalScope(this, node));
}
nestMappedTypeScope(node) {
(0, assert_1.assert)(this.currentScope);
return this.nestScope(new scope_1.MappedTypeScope(this, this.currentScope, node));
}
nestModuleScope(node) {
(0, assert_1.assert)(this.currentScope);
return this.nestScope(new scope_1.ModuleScope(this, this.currentScope, node));
}
nestSwitchScope(node) {
(0, assert_1.assert)(this.currentScope);
return this.nestScope(new scope_1.SwitchScope(this, this.currentScope, node));
}
nestTSEnumScope(node) {
(0, assert_1.assert)(this.currentScope);
return this.nestScope(new scope_1.TSEnumScope(this, this.currentScope, node));
}
nestTSModuleScope(node) {
(0, assert_1.assert)(this.currentScope);
return this.nestScope(new scope_1.TSModuleScope(this, this.currentScope, node));
}
nestTypeScope(node) {
(0, assert_1.assert)(this.currentScope);
return this.nestScope(new scope_1.TypeScope(this, this.currentScope, node));
}
nestWithScope(node) {
(0, assert_1.assert)(this.currentScope);
return this.nestScope(new scope_1.WithScope(this, this.currentScope, node));
}
nestScope(scope) {
if (scope instanceof scope_1.GlobalScope) {
(0, assert_1.assert)(this.currentScope == null);
this.globalScope = scope;
}
this.currentScope = scope;
return scope;
}
};
ScopeManager.ScopeManager = ScopeManager$1;
return ScopeManager;
}
var hasRequiredAnalyze;
function requireAnalyze() {
if (hasRequiredAnalyze) return analyze;
hasRequiredAnalyze = 1;
_Object$defineProperty(analyze, "__esModule", {
value: true
});
analyze.analyze = analyze$1;
const visitor_keys_1 = requireDist$2();
const referencer_1 = requireReferencer();
const ScopeManager_1 = requireScopeManager();
const DEFAULT_OPTIONS = {
childVisitorKeys: visitor_keys_1.visitorKeys,
emitDecoratorMetadata: false,
globalReturn: false,
impliedStrict: false,
jsxFragmentName: null,
jsxPragma: 'React',
lib: ['es2018'],
sourceType: 'script'
};
/**
* Takes an AST and returns the analyzed scopes.
*/
function analyze$1(tree, providedOptions) {
var _providedOptions$chil, _providedOptions$glob, _providedOptions$impl, _providedOptions$jsxF, _providedOptions$lib, _providedOptions$sour, _context;
const options = {
childVisitorKeys: (_providedOptions$chil = providedOptions == null ? undefined : providedOptions.childVisitorKeys) != null ? _providedOptions$chil : DEFAULT_OPTIONS.childVisitorKeys,
emitDecoratorMetadata: false,
globalReturn: (_providedOptions$glob = providedOptions == null ? undefined : providedOptions.globalReturn) != null ? _providedOptions$glob : DEFAULT_OPTIONS.globalReturn,
impliedStrict: (_providedOptions$impl = providedOptions == null ? undefined : providedOptions.impliedStrict) != null ? _providedOptions$impl : DEFAULT_OPTIONS.impliedStrict,
jsxFragmentName: (_providedOptions$jsxF = providedOptions == null ? undefined : providedOptions.jsxFragmentName) != null ? _providedOptions$jsxF : DEFAULT_OPTIONS.jsxFragmentName,
jsxPragma: (providedOptions == null ? undefined : providedOptions.jsxPragma) === undefined ? DEFAULT_OPTIONS.jsxPragma : providedOptions.jsxPragma,
lib: (_providedOptions$lib = providedOptions == null ? undefined : providedOptions.lib) != null ? _providedOptions$lib : ['esnext'],
sourceType: (_providedOptions$sour = providedOptions == null ? undefined : providedOptions.sourceType) != null ? _providedOptions$sour : DEFAULT_OPTIONS.sourceType
};
// ensure the option is lower cased
options.lib = _mapInstanceProperty(_context = options.lib).call(_context, l => l.toLowerCase());
const scopeManager = new ScopeManager_1.ScopeManager(options);
const referencer = new referencer_1.Referencer(options, scopeManager);
referencer.visit(tree);
return scopeManager;
}
return analyze;
}
var hasRequiredDist$1;
function requireDist$1() {
if (hasRequiredDist$1) return dist$1;
hasRequiredDist$1 = 1;
(function (exports) {
var __createBinding = dist$1.__createBinding || (_Object$create ? function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = _Object$getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = {
enumerable: true,
get: function () {
return m[k];
}
};
}
_Object$defineProperty(o, k2, desc);
} : function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
var __exportStar = dist$1.__exportStar || function (m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
_Object$defineProperty(exports, "__esModule", {
value: true
});
exports.ScopeManager = exports.Visitor = exports.Reference = exports.PatternVisitor = exports.analyze = undefined;
var analyze_1 = requireAnalyze();
_Object$defineProperty(exports, "analyze", {
enumerable: true,
get: function () {
return analyze_1.analyze;
}
});
__exportStar(requireDefinition(), exports);
var PatternVisitor_1 = requirePatternVisitor();
_Object$defineProperty(exports, "PatternVisitor", {
enumerable: true,
get: function () {
return PatternVisitor_1.PatternVisitor;
}
});
var Reference_1 = requireReference();
_Object$defineProperty(exports, "Reference", {
enumerable: true,
get: function () {
return Reference_1.Reference;
}
});
var Visitor_1 = requireVisitor();
_Object$defineProperty(exports, "Visitor", {
enumerable: true,
get: function () {
return Visitor_1.Visitor;
}
});
__exportStar(requireScope$1(), exports);
var ScopeManager_1 = requireScopeManager();
_Object$defineProperty(exports, "ScopeManager", {
enumerable: true,
get: function () {
return ScopeManager_1.ScopeManager;
}
});
__exportStar(requireVariable(), exports);
})(dist$1);
return dist$1;
}
var hasRequiredScope;
function requireScope() {
if (hasRequiredScope) return Scope$1;
hasRequiredScope = 1;
/* eslint-disable @typescript-eslint/no-namespace */
var __createBinding = Scope$1.__createBinding || (_Object$create ? function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = _Object$getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = {
enumerable: true,
get: function () {
return m[k];
}
};
}
_Object$defineProperty(o, k2, desc);
} : function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
var __setModuleDefault = Scope$1.__setModuleDefault || (_Object$create ? function (o, v) {
_Object$defineProperty(o, "default", {
enumerable: true,
value: v
});
} : function (o, v) {
o["default"] = v;
});
var __importStar = Scope$1.__importStar || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
_Object$defineProperty(Scope$1, "__esModule", {
value: true
});
Scope$1.Scope = undefined;
const scopeManager = __importStar(requireDist$1());
var Scope;
(function (Scope) {
Scope.ScopeType = scopeManager.ScopeType;
Scope.DefinitionType = scopeManager.DefinitionType;
})(Scope || (Scope$1.Scope = Scope = {}));
return Scope$1;
}
var SourceCode = {};
var hasRequiredSourceCode;
function requireSourceCode() {
if (hasRequiredSourceCode) return SourceCode;
hasRequiredSourceCode = 1;
/* eslint-disable @typescript-eslint/no-namespace */
_Object$defineProperty(SourceCode, "__esModule", {
value: true
});
SourceCode.SourceCode = undefined;
const eslint_1 = require$$0$1;
let SourceCode$1 = class SourceCode extends eslint_1.SourceCode {};
SourceCode.SourceCode = SourceCode$1;
return SourceCode;
}
var hasRequiredTsEslint;
function requireTsEslint() {
if (hasRequiredTsEslint) return tsEslint;
hasRequiredTsEslint = 1;
(function (exports) {
var __createBinding = tsEslint.__createBinding || (_Object$create ? function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = _Object$getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = {
enumerable: true,
get: function () {
return m[k];
}
};
}
_Object$defineProperty(o, k2, desc);
} : function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
var __exportStar = tsEslint.__exportStar || function (m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
_Object$defineProperty(exports, "__esModule", {
value: true
});
__exportStar(requireAST(), exports);
__exportStar(requireConfig(), exports);
__exportStar(requireESLint(), exports);
__exportStar(requireLinter(), exports);
__exportStar(requireParser(), exports);
__exportStar(requireParserOptions(), exports);
__exportStar(requireProcessor(), exports);
__exportStar(requireRule(), exports);
__exportStar(requireRuleTester(), exports);
__exportStar(requireScope(), exports);
__exportStar(requireSourceCode(), exports);
})(tsEslint);
return tsEslint;
}
var tsUtils = {};
var isArray = {};
var hasRequiredIsArray;
function requireIsArray() {
if (hasRequiredIsArray) return isArray;
hasRequiredIsArray = 1;
_Object$defineProperty(isArray, "__esModule", {
value: true
});
isArray.isArray = isArray$1;
// https://github.com/microsoft/TypeScript/issues/17002
function isArray$1(arg) {
return _Array$isArray(arg);
}
return isArray;
}
var hasRequiredTsUtils;
function requireTsUtils() {
if (hasRequiredTsUtils) return tsUtils;
hasRequiredTsUtils = 1;
(function (exports) {
var __createBinding = tsUtils.__createBinding || (_Object$create ? function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = _Object$getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = {
enumerable: true,
get: function () {
return m[k];
}
};
}
_Object$defineProperty(o, k2, desc);
} : function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
var __exportStar = tsUtils.__exportStar || function (m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
_Object$defineProperty(exports, "__esModule", {
value: true
});
__exportStar(requireIsArray(), exports);
})(tsUtils);
return tsUtils;
}
var hasRequiredDist;
function requireDist() {
if (hasRequiredDist) return dist$3;
hasRequiredDist = 1;
(function (exports) {
var __createBinding = dist$3.__createBinding || (_Object$create ? function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = _Object$getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = {
enumerable: true,
get: function () {
return m[k];
}
};
}
_Object$defineProperty(o, k2, desc);
} : function (o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
});
var __setModuleDefault = dist$3.__setModuleDefault || (_Object$create ? function (o, v) {
_Object$defineProperty(o, "default", {
enumerable: true,
value: v
});
} : function (o, v) {
o["default"] = v;
});
var __importStar = dist$3.__importStar || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __exportStar = dist$3.__exportStar || function (m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
_Object$defineProperty(exports, "__esModule", {
value: true
});
exports.TSUtils = exports.TSESLint = exports.JSONSchema = exports.ESLintUtils = exports.ASTUtils = undefined;
exports.ASTUtils = __importStar(requireAstUtils());
exports.ESLintUtils = __importStar(requireEslintUtils());
exports.JSONSchema = __importStar(requireJsonSchema());
exports.TSESLint = __importStar(requireTsEslint());
__exportStar(requireTsEstree(), exports);
exports.TSUtils = __importStar(requireTsUtils());
})(dist$3);
return dist$3;
}
var distExports = requireDist();
var astUtilsExports = requireAstUtils();
var estraverse = {};
var hasRequiredEstraverse;
function requireEstraverse() {
if (hasRequiredEstraverse) return estraverse;
hasRequiredEstraverse = 1;
(function (exports) {
/*jslint vars:false, bitwise:true*/
/*jshint indent:4*/
/*global exports:true*/
(function clone(exports) {
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',
ChainExpression: 'ChainExpression',
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',
PrivateIdentifier: 'PrivateIdentifier',
Program: 'Program',
Property: 'Property',
PropertyDefinition: 'PropertyDefinition',
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'],
ChainExpression: ['expression'],
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'],
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']
};
// 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)) {
var _context;
_spliceInstanceProperty(_context = this.parent).call(_context, 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 (_keysInstanceProperty(visitor)) {
this.__keys = _Object$assign(_Object$create(this.__keys), _keysInstanceProperty(visitor));
}
};
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;
}
function candidateExistsInLeaveList(leavelist, candidate) {
for (var i = leavelist.length - 1; i >= 0; --i) {
if (leavelist[i].node === candidate) {
return true;
}
}
return false;
}
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 (candidateExistsInLeaveList(leavelist, 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)) {
if (candidateExistsInLeaveList(leavelist, candidate)) {
continue;
}
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);
_spliceInstanceProperty(comments).call(comments, 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);
_spliceInstanceProperty(comments).call(comments, 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.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 : */
})(estraverse);
return estraverse;
}
var estraverseExports = requireEstraverse();
var utils = {};
var constants;
var hasRequiredConstants;
function requireConstants() {
if (hasRequiredConstants) return constants;
hasRequiredConstants = 1;
const WIN_SLASH = '\\\\/';
const WIN_NO_SLASH = `[^${WIN_SLASH}]`;
/**
* Posix glob regex
*/
const DOT_LITERAL = '\\.';
const PLUS_LITERAL = '\\+';
const QMARK_LITERAL = '\\?';
const SLASH_LITERAL = '\\/';
const ONE_CHAR = '(?=.)';
const QMARK = '[^/]';
const END_ANCHOR = `(?:${SLASH_LITERAL}|$)`;
const START_ANCHOR = `(?:^|${SLASH_LITERAL})`;
const DOTS_SLASH = `${DOT_LITERAL}{1,2}${END_ANCHOR}`;
const NO_DOT = `(?!${DOT_LITERAL})`;
const NO_DOTS = `(?!${START_ANCHOR}${DOTS_SLASH})`;
const NO_DOT_SLASH = `(?!${DOT_LITERAL}{0,1}${END_ANCHOR})`;
const NO_DOTS_SLASH = `(?!${DOTS_SLASH})`;
const QMARK_NO_DOT = `[^.${SLASH_LITERAL}]`;
const STAR = `${QMARK}*?`;
const SEP = '/';
const POSIX_CHARS = {
DOT_LITERAL,
PLUS_LITERAL,
QMARK_LITERAL,
SLASH_LITERAL,
ONE_CHAR,
QMARK,
END_ANCHOR,
DOTS_SLASH,
NO_DOT,
NO_DOTS,
NO_DOT_SLASH,
NO_DOTS_SLASH,
QMARK_NO_DOT,
STAR,
START_ANCHOR,
SEP
};
/**
* Windows glob regex
*/
const WINDOWS_CHARS = {
...POSIX_CHARS,
SLASH_LITERAL: `[${WIN_SLASH}]`,
QMARK: WIN_NO_SLASH,
STAR: `${WIN_NO_SLASH}*?`,
DOTS_SLASH: `${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$)`,
NO_DOT: `(?!${DOT_LITERAL})`,
NO_DOTS: `(?!(?:^|[${WIN_SLASH}])${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
NO_DOT_SLASH: `(?!${DOT_LITERAL}{0,1}(?:[${WIN_SLASH}]|$))`,
NO_DOTS_SLASH: `(?!${DOT_LITERAL}{1,2}(?:[${WIN_SLASH}]|$))`,
QMARK_NO_DOT: `[^.${WIN_SLASH}]`,
START_ANCHOR: `(?:^|[${WIN_SLASH}])`,
END_ANCHOR: `(?:[${WIN_SLASH}]|$)`,
SEP: '\\'
};
/**
* POSIX Bracket Regex
*/
const POSIX_REGEX_SOURCE = {
alnum: 'a-zA-Z0-9',
alpha: 'a-zA-Z',
ascii: '\\x00-\\x7F',
blank: ' \\t',
cntrl: '\\x00-\\x1F\\x7F',
digit: '0-9',
graph: '\\x21-\\x7E',
lower: 'a-z',
print: '\\x20-\\x7E ',
punct: '\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~',
space: ' \\t\\r\\n\\v\\f',
upper: 'A-Z',
word: 'A-Za-z0-9_',
xdigit: 'A-Fa-f0-9'
};
constants = {
MAX_LENGTH: 1024 * 64,
POSIX_REGEX_SOURCE,
// regular expressions
REGEX_BACKSLASH: /\\(?![*+?^${}(|)[\]])/g,
REGEX_NON_SPECIAL_CHARS: /^[^@![\].,$*+?^{}()|\\/]+/,
REGEX_SPECIAL_CHARS: /[-*+?.^${}(|)[\]]/,
REGEX_SPECIAL_CHARS_BACKREF: /(\\?)((\W)(\3*))/g,
REGEX_SPECIAL_CHARS_GLOBAL: /([-*+?.^${}(|)[\]])/g,
REGEX_REMOVE_BACKSLASH: /(?:\[.*?[^\\]\]|\\(?=.))/g,
// Replace globs with equivalent patterns to reduce parsing time.
REPLACEMENTS: {
'***': '*',
'**/**': '**',
'**/**/**': '**'
},
// Digits
CHAR_0: 48,
/* 0 */
CHAR_9: 57,
/* 9 */
// Alphabet chars.
CHAR_UPPERCASE_A: 65,
/* A */
CHAR_LOWERCASE_A: 97,
/* a */
CHAR_UPPERCASE_Z: 90,
/* Z */
CHAR_LOWERCASE_Z: 122,
/* z */
CHAR_LEFT_PARENTHESES: 40,
/* ( */
CHAR_RIGHT_PARENTHESES: 41,
/* ) */
CHAR_ASTERISK: 42,
/* * */
// Non-alphabetic chars.
CHAR_AMPERSAND: 38,
/* & */
CHAR_AT: 64,
/* @ */
CHAR_BACKWARD_SLASH: 92,
/* \ */
CHAR_CARRIAGE_RETURN: 13,
/* \r */
CHAR_CIRCUMFLEX_ACCENT: 94,
/* ^ */
CHAR_COLON: 58,
/* : */
CHAR_COMMA: 44,
/* , */
CHAR_DOT: 46,
/* . */
CHAR_DOUBLE_QUOTE: 34,
/* " */
CHAR_EQUAL: 61,
/* = */
CHAR_EXCLAMATION_MARK: 33,
/* ! */
CHAR_FORM_FEED: 12,
/* \f */
CHAR_FORWARD_SLASH: 47,
/* / */
CHAR_GRAVE_ACCENT: 96,
/* ` */
CHAR_HASH: 35,
/* # */
CHAR_HYPHEN_MINUS: 45,
/* - */
CHAR_LEFT_ANGLE_BRACKET: 60,
/* < */
CHAR_LEFT_CURLY_BRACE: 123,
/* { */
CHAR_LEFT_SQUARE_BRACKET: 91,
/* [ */
CHAR_LINE_FEED: 10,
/* \n */
CHAR_NO_BREAK_SPACE: 160,
/* \u00A0 */
CHAR_PERCENT: 37,
/* % */
CHAR_PLUS: 43,
/* + */
CHAR_QUESTION_MARK: 63,
/* ? */
CHAR_RIGHT_ANGLE_BRACKET: 62,
/* > */
CHAR_RIGHT_CURLY_BRACE: 125,
/* } */
CHAR_RIGHT_SQUARE_BRACKET: 93,
/* ] */
CHAR_SEMICOLON: 59,
/* ; */
CHAR_SINGLE_QUOTE: 39,
/* ' */
CHAR_SPACE: 32,
/* */
CHAR_TAB: 9,
/* \t */
CHAR_UNDERSCORE: 95,
/* _ */
CHAR_VERTICAL_LINE: 124,
/* | */
CHAR_ZERO_WIDTH_NOBREAK_SPACE: 65279,
/* \uFEFF */
/**
* Create EXTGLOB_CHARS
*/
extglobChars(chars) {
return {
'!': {
type: 'negate',
open: '(?:(?!(?:',
close: `))${chars.STAR})`
},
'?': {
type: 'qmark',
open: '(?:',
close: ')?'
},
'+': {
type: 'plus',
open: '(?:',
close: ')+'
},
'*': {
type: 'star',
open: '(?:',
close: ')*'
},
'@': {
type: 'at',
open: '(?:',
close: ')'
}
};
},
/**
* Create GLOB_CHARS
*/
globChars(win32) {
return win32 === true ? WINDOWS_CHARS : POSIX_CHARS;
}
};
return constants;
}
var hasRequiredUtils;
function requireUtils() {
if (hasRequiredUtils) return utils;
hasRequiredUtils = 1;
(function (exports) {
const {
REGEX_BACKSLASH,
REGEX_REMOVE_BACKSLASH,
REGEX_SPECIAL_CHARS,
REGEX_SPECIAL_CHARS_GLOBAL
} = requireConstants();
exports.isObject = val => val !== null && typeof val === 'object' && !_Array$isArray(val);
exports.hasRegexChars = str => REGEX_SPECIAL_CHARS.test(str);
exports.isRegexChar = str => str.length === 1 && exports.hasRegexChars(str);
exports.escapeRegex = str => str.replace(REGEX_SPECIAL_CHARS_GLOBAL, '\\$1');
exports.toPosixSlashes = str => str.replace(REGEX_BACKSLASH, '/');
exports.isWindows = () => {
if (typeof navigator !== 'undefined' && navigator.platform) {
const platform = navigator.platform.toLowerCase();
return platform === 'win32' || platform === 'windows';
}
if (typeof process !== 'undefined' && process.platform) {
return process.platform === 'win32';
}
return false;
};
exports.removeBackslashes = str => {
return str.replace(REGEX_REMOVE_BACKSLASH, match => {
return match === '\\' ? '' : match;
});
};
exports.escapeLast = (input, char, lastIdx) => {
const idx = _lastIndexOfInstanceProperty(input).call(input, char, lastIdx);
if (idx === -1) return input;
if (input[idx - 1] === '\\') return exports.escapeLast(input, char, idx - 1);
return `${_sliceInstanceProperty(input).call(input, 0, idx)}\\${_sliceInstanceProperty(input).call(input, idx)}`;
};
exports.removePrefix = (input, state = {}) => {
let output = input;
if (_startsWithInstanceProperty(output).call(output, './')) {
output = _sliceInstanceProperty(output).call(output, 2);
state.prefix = './';
}
return output;
};
exports.wrapOutput = (input, state = {}, options = {}) => {
const prepend = options.contains ? '' : '^';
const append = options.contains ? '' : '$';
let output = `${prepend}(?:${input})${append}`;
if (state.negated === true) {
output = `(?:^(?!${output}).*$)`;
}
return output;
};
exports.basename = (path, {
windows
} = {}) => {
const segs = path.split(windows ? /[\\/]/ : '/');
const last = segs[segs.length - 1];
if (last === '') {
return segs[segs.length - 2];
}
return last;
};
})(utils);
return utils;
}
var scan_1;
var hasRequiredScan;
function requireScan() {
if (hasRequiredScan) return scan_1;
hasRequiredScan = 1;
const utils = requireUtils();
const {
CHAR_ASTERISK,
/* * */
CHAR_AT,
/* @ */
CHAR_BACKWARD_SLASH,
/* \ */
CHAR_COMMA,
/* , */
CHAR_DOT,
/* . */
CHAR_EXCLAMATION_MARK,
/* ! */
CHAR_FORWARD_SLASH,
/* / */
CHAR_LEFT_CURLY_BRACE,
/* { */
CHAR_LEFT_PARENTHESES,
/* ( */
CHAR_LEFT_SQUARE_BRACKET,
/* [ */
CHAR_PLUS,
/* + */
CHAR_QUESTION_MARK,
/* ? */
CHAR_RIGHT_CURLY_BRACE,
/* } */
CHAR_RIGHT_PARENTHESES,
/* ) */
CHAR_RIGHT_SQUARE_BRACKET /* ] */
} = requireConstants();
const isPathSeparator = code => {
return code === CHAR_FORWARD_SLASH || code === CHAR_BACKWARD_SLASH;
};
const depth = token => {
if (token.isPrefix !== true) {
token.depth = token.isGlobstar ? Infinity : 1;
}
};
/**
* Quickly scans a glob pattern and returns an object with a handful of
* useful properties, like `isGlob`, `path` (the leading non-glob, if it exists),
* `glob` (the actual pattern), `negated` (true if the path starts with `!` but not
* with `!(`) and `negatedExtglob` (true if the path starts with `!(`).
*
* ```js
* const pm = require('picomatch');
* console.log(pm.scan('foo/bar/*.js'));
* { isGlob: true, input: 'foo/bar/*.js', base: 'foo/bar', glob: '*.js' }
* ```
* @param {String} `str`
* @param {Object} `options`
* @return {Object} Returns an object with tokens and regex source string.
* @api public
*/
const scan = (input, options) => {
const opts = options || {};
const length = input.length - 1;
const scanToEnd = opts.parts === true || opts.scanToEnd === true;
const slashes = [];
const tokens = [];
const parts = [];
let str = input;
let index = -1;
let start = 0;
let lastIndex = 0;
let isBrace = false;
let isBracket = false;
let isGlob = false;
let isExtglob = false;
let isGlobstar = false;
let braceEscaped = false;
let backslashes = false;
let negated = false;
let negatedExtglob = false;
let finished = false;
let braces = 0;
let prev;
let code;
let token = {
value: '',
depth: 0,
isGlob: false
};
const eos = () => index >= length;
const peek = () => str.charCodeAt(index + 1);
const advance = () => {
prev = code;
return str.charCodeAt(++index);
};
while (index < length) {
code = advance();
let next;
if (code === CHAR_BACKWARD_SLASH) {
backslashes = token.backslashes = true;
code = advance();
if (code === CHAR_LEFT_CURLY_BRACE) {
braceEscaped = true;
}
continue;
}
if (braceEscaped === true || code === CHAR_LEFT_CURLY_BRACE) {
braces++;
while (eos() !== true && (code = advance())) {
if (code === CHAR_BACKWARD_SLASH) {
backslashes = token.backslashes = true;
advance();
continue;
}
if (code === CHAR_LEFT_CURLY_BRACE) {
braces++;
continue;
}
if (braceEscaped !== true && code === CHAR_DOT && (code = advance()) === CHAR_DOT) {
isBrace = token.isBrace = true;
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
if (braceEscaped !== true && code === CHAR_COMMA) {
isBrace = token.isBrace = true;
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
if (code === CHAR_RIGHT_CURLY_BRACE) {
braces--;
if (braces === 0) {
braceEscaped = false;
isBrace = token.isBrace = true;
finished = true;
break;
}
}
}
if (scanToEnd === true) {
continue;
}
break;
}
if (code === CHAR_FORWARD_SLASH) {
slashes.push(index);
tokens.push(token);
token = {
value: '',
depth: 0,
isGlob: false
};
if (finished === true) continue;
if (prev === CHAR_DOT && index === start + 1) {
start += 2;
continue;
}
lastIndex = index + 1;
continue;
}
if (opts.noext !== true) {
const isExtglobChar = code === CHAR_PLUS || code === CHAR_AT || code === CHAR_ASTERISK || code === CHAR_QUESTION_MARK || code === CHAR_EXCLAMATION_MARK;
if (isExtglobChar === true && peek() === CHAR_LEFT_PARENTHESES) {
isGlob = token.isGlob = true;
isExtglob = token.isExtglob = true;
finished = true;
if (code === CHAR_EXCLAMATION_MARK && index === start) {
negatedExtglob = true;
}
if (scanToEnd === true) {
while (eos() !== true && (code = advance())) {
if (code === CHAR_BACKWARD_SLASH) {
backslashes = token.backslashes = true;
code = advance();
continue;
}
if (code === CHAR_RIGHT_PARENTHESES) {
isGlob = token.isGlob = true;
finished = true;
break;
}
}
continue;
}
break;
}
}
if (code === CHAR_ASTERISK) {
if (prev === CHAR_ASTERISK) isGlobstar = token.isGlobstar = true;
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
if (code === CHAR_QUESTION_MARK) {
isGlob = token.isGlob = true;
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
if (code === CHAR_LEFT_SQUARE_BRACKET) {
while (eos() !== true && (next = advance())) {
if (next === CHAR_BACKWARD_SLASH) {
backslashes = token.backslashes = true;
advance();
continue;
}
if (next === CHAR_RIGHT_SQUARE_BRACKET) {
isBracket = token.isBracket = true;
isGlob = token.isGlob = true;
finished = true;
break;
}
}
if (scanToEnd === true) {
continue;
}
break;
}
if (opts.nonegate !== true && code === CHAR_EXCLAMATION_MARK && index === start) {
negated = token.negated = true;
start++;
continue;
}
if (opts.noparen !== true && code === CHAR_LEFT_PARENTHESES) {
isGlob = token.isGlob = true;
if (scanToEnd === true) {
while (eos() !== true && (code = advance())) {
if (code === CHAR_LEFT_PARENTHESES) {
backslashes = token.backslashes = true;
code = advance();
continue;
}
if (code === CHAR_RIGHT_PARENTHESES) {
finished = true;
break;
}
}
continue;
}
break;
}
if (isGlob === true) {
finished = true;
if (scanToEnd === true) {
continue;
}
break;
}
}
if (opts.noext === true) {
isExtglob = false;
isGlob = false;
}
let base = str;
let prefix = '';
let glob = '';
if (start > 0) {
prefix = _sliceInstanceProperty(str).call(str, 0, start);
str = _sliceInstanceProperty(str).call(str, start);
lastIndex -= start;
}
if (base && isGlob === true && lastIndex > 0) {
base = _sliceInstanceProperty(str).call(str, 0, lastIndex);
glob = _sliceInstanceProperty(str).call(str, lastIndex);
} else if (isGlob === true) {
base = '';
glob = str;
} else {
base = str;
}
if (base && base !== '' && base !== '/' && base !== str) {
if (isPathSeparator(base.charCodeAt(base.length - 1))) {
base = _sliceInstanceProperty(base).call(base, 0, -1);
}
}
if (opts.unescape === true) {
if (glob) glob = utils.removeBackslashes(glob);
if (base && backslashes === true) {
base = utils.removeBackslashes(base);
}
}
const state = {
prefix,
input,
start,
base,
glob,
isBrace,
isBracket,
isGlob,
isExtglob,
isGlobstar,
negated,
negatedExtglob
};
if (opts.tokens === true) {
state.maxDepth = 0;
if (!isPathSeparator(code)) {
tokens.push(token);
}
state.tokens = tokens;
}
if (opts.parts === true || opts.tokens === true) {
let prevIndex;
for (let idx = 0; idx < slashes.length; idx++) {
const n = prevIndex ? prevIndex + 1 : start;
const i = slashes[idx];
const value = _sliceInstanceProperty(input).call(input, n, i);
if (opts.tokens) {
if (idx === 0 && start !== 0) {
tokens[idx].isPrefix = true;
tokens[idx].value = prefix;
} else {
tokens[idx].value = value;
}
depth(tokens[idx]);
state.maxDepth += tokens[idx].depth;
}
if (idx !== 0 || value !== '') {
parts.push(value);
}
prevIndex = i;
}
if (prevIndex && prevIndex + 1 < input.length) {
const value = _sliceInstanceProperty(input).call(input, prevIndex + 1);
parts.push(value);
if (opts.tokens) {
tokens[tokens.length - 1].value = value;
depth(tokens[tokens.length - 1]);
state.maxDepth += tokens[tokens.length - 1].depth;
}
}
state.slashes = slashes;
state.parts = parts;
}
return state;
};
scan_1 = scan;
return scan_1;
}
var parse_1;
var hasRequiredParse;
function requireParse() {
if (hasRequiredParse) return parse_1;
hasRequiredParse = 1;
const constants = requireConstants();
const utils = requireUtils();
/**
* Constants
*/
const {
MAX_LENGTH,
POSIX_REGEX_SOURCE,
REGEX_NON_SPECIAL_CHARS,
REGEX_SPECIAL_CHARS_BACKREF,
REPLACEMENTS
} = constants;
/**
* Helpers
*/
const expandRange = (args, options) => {
if (typeof options.expandRange === 'function') {
return options.expandRange(...args, options);
}
_sortInstanceProperty(args).call(args);
const value = `[${args.join('-')}]`;
try {
/* eslint-disable-next-line no-new */
new RegExp(value);
} catch (ex) {
return _mapInstanceProperty(args).call(args, v => utils.escapeRegex(v)).join('..');
}
return value;
};
/**
* Create the message for a syntax error
*/
const syntaxError = (type, char) => {
return `Missing ${type}: "${char}" - use "\\\\${char}" to match literal characters`;
};
/**
* Parse the given input string.
* @param {String} input
* @param {Object} options
* @return {Object}
*/
const parse = (input, options) => {
if (typeof input !== 'string') {
throw new TypeError('Expected a string');
}
input = REPLACEMENTS[input] || input;
const opts = {
...options
};
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
let len = input.length;
if (len > max) {
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
}
const bos = {
type: 'bos',
value: '',
output: opts.prepend || ''
};
const tokens = [bos];
const capture = opts.capture ? '' : '?:';
// create constants based on platform, for windows or posix
const PLATFORM_CHARS = constants.globChars(opts.windows);
const EXTGLOB_CHARS = constants.extglobChars(PLATFORM_CHARS);
const {
DOT_LITERAL,
PLUS_LITERAL,
SLASH_LITERAL,
ONE_CHAR,
DOTS_SLASH,
NO_DOT,
NO_DOT_SLASH,
NO_DOTS_SLASH,
QMARK,
QMARK_NO_DOT,
STAR,
START_ANCHOR
} = PLATFORM_CHARS;
const globstar = opts => {
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
};
const nodot = opts.dot ? '' : NO_DOT;
const qmarkNoDot = opts.dot ? QMARK : QMARK_NO_DOT;
let star = opts.bash === true ? globstar(opts) : STAR;
if (opts.capture) {
star = `(${star})`;
}
// minimatch options support
if (typeof opts.noext === 'boolean') {
opts.noextglob = opts.noext;
}
const state = {
input,
index: -1,
start: 0,
dot: opts.dot === true,
consumed: '',
output: '',
prefix: '',
backtrack: false,
negated: false,
brackets: 0,
braces: 0,
parens: 0,
quotes: 0,
globstar: false,
tokens
};
input = utils.removePrefix(input, state);
len = input.length;
const extglobs = [];
const braces = [];
const stack = [];
let prev = bos;
let value;
/**
* Tokenizing helpers
*/
const eos = () => state.index === len - 1;
const peek = state.peek = (n = 1) => input[state.index + n];
const advance = state.advance = () => input[++state.index] || '';
const remaining = () => _sliceInstanceProperty(input).call(input, state.index + 1);
const consume = (value = '', num = 0) => {
state.consumed += value;
state.index += num;
};
const append = token => {
state.output += token.output != null ? token.output : token.value;
consume(token.value);
};
const negate = () => {
let count = 1;
while (peek() === '!' && (peek(2) !== '(' || peek(3) === '?')) {
advance();
state.start++;
count++;
}
if (count % 2 === 0) {
return false;
}
state.negated = true;
state.start++;
return true;
};
const increment = type => {
state[type]++;
stack.push(type);
};
const decrement = type => {
state[type]--;
stack.pop();
};
/**
* Push tokens onto the tokens array. This helper speeds up
* tokenizing by 1) helping us avoid backtracking as much as possible,
* and 2) helping us avoid creating extra tokens when consecutive
* characters are plain text. This improves performance and simplifies
* lookbehinds.
*/
const push = tok => {
if (prev.type === 'globstar') {
const isBrace = state.braces > 0 && (tok.type === 'comma' || tok.type === 'brace');
const isExtglob = tok.extglob === true || extglobs.length && (tok.type === 'pipe' || tok.type === 'paren');
if (tok.type !== 'slash' && tok.type !== 'paren' && !isBrace && !isExtglob) {
var _context;
state.output = _sliceInstanceProperty(_context = state.output).call(_context, 0, -prev.output.length);
prev.type = 'star';
prev.value = '*';
prev.output = star;
state.output += prev.output;
}
}
if (extglobs.length && tok.type !== 'paren') {
extglobs[extglobs.length - 1].inner += tok.value;
}
if (tok.value || tok.output) append(tok);
if (prev && prev.type === 'text' && tok.type === 'text') {
prev.output = (prev.output || prev.value) + tok.value;
prev.value += tok.value;
return;
}
tok.prev = prev;
tokens.push(tok);
prev = tok;
};
const extglobOpen = (type, value) => {
const token = {
...EXTGLOB_CHARS[value],
conditions: 1,
inner: ''
};
token.prev = prev;
token.parens = state.parens;
token.output = state.output;
const output = (opts.capture ? '(' : '') + token.open;
increment('parens');
push({
type,
value,
output: state.output ? '' : ONE_CHAR
});
push({
type: 'paren',
extglob: true,
value: advance(),
output
});
extglobs.push(token);
};
const extglobClose = token => {
let output = token.close + (opts.capture ? ')' : '');
let rest;
if (token.type === 'negate') {
var _context2, _context3;
let extglobStar = star;
if (token.inner && token.inner.length > 1 && _includesInstanceProperty(_context2 = token.inner).call(_context2, '/')) {
extglobStar = globstar(opts);
}
if (extglobStar !== star || eos() || /^\)+$/.test(remaining())) {
output = token.close = `)$))${extglobStar}`;
}
if (_includesInstanceProperty(_context3 = token.inner).call(_context3, '*') && (rest = remaining()) && /^\.[^\\/.]+$/.test(rest)) {
// Any non-magical string (`.ts`) or even nested expression (`.{ts,tsx}`) can follow after the closing parenthesis.
// In this case, we need to parse the string and use it in the output of the original pattern.
// Suitable patterns: `/!(*.d).ts`, `/!(*.d).{ts,tsx}`, `**/!(*-dbg).@(js)`.
//
// Disabling the `fastpaths` option due to a problem with parsing strings as `.ts` in the pattern like `**/!(*.d).ts`.
const expression = parse(rest, {
...options,
fastpaths: false
}).output;
output = token.close = `)${expression})${extglobStar})`;
}
if (token.prev.type === 'bos') {
state.negatedExtglob = true;
}
}
push({
type: 'paren',
extglob: true,
value,
output
});
decrement('parens');
};
/**
* Fast paths
*/
if (opts.fastpaths !== false && !/(^[*!]|[/()[\]{}"])/.test(input)) {
let backslashes = false;
let output = input.replace(REGEX_SPECIAL_CHARS_BACKREF, (m, esc, chars, first, rest, index) => {
if (first === '\\') {
backslashes = true;
return m;
}
if (first === '?') {
if (esc) {
return esc + first + (rest ? _repeatInstanceProperty(QMARK).call(QMARK, rest.length) : '');
}
if (index === 0) {
return qmarkNoDot + (rest ? _repeatInstanceProperty(QMARK).call(QMARK, rest.length) : '');
}
return _repeatInstanceProperty(QMARK).call(QMARK, chars.length);
}
if (first === '.') {
return _repeatInstanceProperty(DOT_LITERAL).call(DOT_LITERAL, chars.length);
}
if (first === '*') {
if (esc) {
return esc + first + (rest ? star : '');
}
return star;
}
return esc ? m : `\\${m}`;
});
if (backslashes === true) {
if (opts.unescape === true) {
output = output.replace(/\\/g, '');
} else {
output = output.replace(/\\+/g, m => {
return m.length % 2 === 0 ? '\\\\' : m ? '\\' : '';
});
}
}
if (output === input && opts.contains === true) {
state.output = input;
return state;
}
state.output = utils.wrapOutput(output, state, options);
return state;
}
/**
* Tokenize input until we reach end-of-string
*/
while (!eos()) {
value = advance();
if (value === '\u0000') {
continue;
}
/**
* Escaped characters
*/
if (value === '\\') {
const next = peek();
if (next === '/' && opts.bash !== true) {
continue;
}
if (next === '.' || next === ';') {
continue;
}
if (!next) {
value += '\\';
push({
type: 'text',
value
});
continue;
}
// collapse slashes to reduce potential for exploits
const match = /^\\+/.exec(remaining());
let slashes = 0;
if (match && match[0].length > 2) {
slashes = match[0].length;
state.index += slashes;
if (slashes % 2 !== 0) {
value += '\\';
}
}
if (opts.unescape === true) {
value = advance();
} else {
value += advance();
}
if (state.brackets === 0) {
push({
type: 'text',
value
});
continue;
}
}
/**
* If we're inside a regex character class, continue
* until we reach the closing bracket.
*/
if (state.brackets > 0 && (value !== ']' || prev.value === '[' || prev.value === '[^')) {
if (opts.posix !== false && value === ':') {
var _context4;
const inner = _sliceInstanceProperty(_context4 = prev.value).call(_context4, 1);
if (_includesInstanceProperty(inner).call(inner, '[')) {
prev.posix = true;
if (_includesInstanceProperty(inner).call(inner, ':')) {
var _context5, _context6, _context7;
const idx = _lastIndexOfInstanceProperty(_context5 = prev.value).call(_context5, '[');
const pre = _sliceInstanceProperty(_context6 = prev.value).call(_context6, 0, idx);
const rest = _sliceInstanceProperty(_context7 = prev.value).call(_context7, idx + 2);
const posix = POSIX_REGEX_SOURCE[rest];
if (posix) {
prev.value = pre + posix;
state.backtrack = true;
advance();
if (!bos.output && _indexOfInstanceProperty(tokens).call(tokens, prev) === 1) {
bos.output = ONE_CHAR;
}
continue;
}
}
}
}
if (value === '[' && peek() !== ':' || value === '-' && peek() === ']') {
value = `\\${value}`;
}
if (value === ']' && (prev.value === '[' || prev.value === '[^')) {
value = `\\${value}`;
}
if (opts.posix === true && value === '!' && prev.value === '[') {
value = '^';
}
prev.value += value;
append({
value
});
continue;
}
/**
* If we're inside a quoted string, continue
* until we reach the closing double quote.
*/
if (state.quotes === 1 && value !== '"') {
value = utils.escapeRegex(value);
prev.value += value;
append({
value
});
continue;
}
/**
* Double quotes
*/
if (value === '"') {
state.quotes = state.quotes === 1 ? 0 : 1;
if (opts.keepQuotes === true) {
push({
type: 'text',
value
});
}
continue;
}
/**
* Parentheses
*/
if (value === '(') {
increment('parens');
push({
type: 'paren',
value
});
continue;
}
if (value === ')') {
if (state.parens === 0 && opts.strictBrackets === true) {
throw new SyntaxError(syntaxError('opening', '('));
}
const extglob = extglobs[extglobs.length - 1];
if (extglob && state.parens === extglob.parens + 1) {
extglobClose(extglobs.pop());
continue;
}
push({
type: 'paren',
value,
output: state.parens ? ')' : '\\)'
});
decrement('parens');
continue;
}
/**
* Square brackets
*/
if (value === '[') {
var _context8;
if (opts.nobracket === true || !_includesInstanceProperty(_context8 = remaining()).call(_context8, ']')) {
if (opts.nobracket !== true && opts.strictBrackets === true) {
throw new SyntaxError(syntaxError('closing', ']'));
}
value = `\\${value}`;
} else {
increment('brackets');
}
push({
type: 'bracket',
value
});
continue;
}
if (value === ']') {
var _context9, _context0;
if (opts.nobracket === true || prev && prev.type === 'bracket' && prev.value.length === 1) {
push({
type: 'text',
value,
output: `\\${value}`
});
continue;
}
if (state.brackets === 0) {
if (opts.strictBrackets === true) {
throw new SyntaxError(syntaxError('opening', '['));
}
push({
type: 'text',
value,
output: `\\${value}`
});
continue;
}
decrement('brackets');
const prevValue = _sliceInstanceProperty(_context9 = prev.value).call(_context9, 1);
if (prev.posix !== true && prevValue[0] === '^' && !_includesInstanceProperty(prevValue).call(prevValue, '/')) {
value = `/${value}`;
}
prev.value += value;
append({
value
});
// when literal brackets are explicitly disabled
// assume we should match with a regex character class
if (opts.literalBrackets === false || utils.hasRegexChars(prevValue)) {
continue;
}
const escaped = utils.escapeRegex(prev.value);
state.output = _sliceInstanceProperty(_context0 = state.output).call(_context0, 0, -prev.value.length);
// when literal brackets are explicitly enabled
// assume we should escape the brackets to match literal characters
if (opts.literalBrackets === true) {
state.output += escaped;
prev.value = escaped;
continue;
}
// when the user specifies nothing, try to match both
prev.value = `(${capture}${escaped}|${prev.value})`;
state.output += prev.value;
continue;
}
/**
* Braces
*/
if (value === '{' && opts.nobrace !== true) {
increment('braces');
const open = {
type: 'brace',
value,
output: '(',
outputIndex: state.output.length,
tokensIndex: state.tokens.length
};
braces.push(open);
push(open);
continue;
}
if (value === '}') {
const brace = braces[braces.length - 1];
if (opts.nobrace === true || !brace) {
push({
type: 'text',
value,
output: value
});
continue;
}
let output = ')';
if (brace.dots === true) {
const arr = _sliceInstanceProperty(tokens).call(tokens);
const range = [];
for (let i = arr.length - 1; i >= 0; i--) {
tokens.pop();
if (arr[i].type === 'brace') {
break;
}
if (arr[i].type !== 'dots') {
range.unshift(arr[i].value);
}
}
output = expandRange(range, opts);
state.backtrack = true;
}
if (brace.comma !== true && brace.dots !== true) {
var _context1, _context10;
const out = _sliceInstanceProperty(_context1 = state.output).call(_context1, 0, brace.outputIndex);
const toks = _sliceInstanceProperty(_context10 = state.tokens).call(_context10, brace.tokensIndex);
brace.value = brace.output = '\\{';
value = output = '\\}';
state.output = out;
for (const t of toks) {
state.output += t.output || t.value;
}
}
push({
type: 'brace',
value,
output
});
decrement('braces');
braces.pop();
continue;
}
/**
* Pipes
*/
if (value === '|') {
if (extglobs.length > 0) {
extglobs[extglobs.length - 1].conditions++;
}
push({
type: 'text',
value
});
continue;
}
/**
* Commas
*/
if (value === ',') {
let output = value;
const brace = braces[braces.length - 1];
if (brace && stack[stack.length - 1] === 'braces') {
brace.comma = true;
output = '|';
}
push({
type: 'comma',
value,
output
});
continue;
}
/**
* Slashes
*/
if (value === '/') {
// if the beginning of the glob is "./", advance the start
// to the current index, and don't add the "./" characters
// to the state. This greatly simplifies lookbehinds when
// checking for BOS characters like "!" and "." (not "./")
if (prev.type === 'dot' && state.index === state.start + 1) {
state.start = state.index + 1;
state.consumed = '';
state.output = '';
tokens.pop();
prev = bos; // reset "prev" to the first token
continue;
}
push({
type: 'slash',
value,
output: SLASH_LITERAL
});
continue;
}
/**
* Dots
*/
if (value === '.') {
if (state.braces > 0 && prev.type === 'dot') {
if (prev.value === '.') prev.output = DOT_LITERAL;
const brace = braces[braces.length - 1];
prev.type = 'dots';
prev.output += value;
prev.value += value;
brace.dots = true;
continue;
}
if (state.braces + state.parens === 0 && prev.type !== 'bos' && prev.type !== 'slash') {
push({
type: 'text',
value,
output: DOT_LITERAL
});
continue;
}
push({
type: 'dot',
value,
output: DOT_LITERAL
});
continue;
}
/**
* Question marks
*/
if (value === '?') {
const isGroup = prev && prev.value === '(';
if (!isGroup && opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
extglobOpen('qmark', value);
continue;
}
if (prev && prev.type === 'paren') {
const next = peek();
let output = value;
if (prev.value === '(' && !/[!=<:]/.test(next) || next === '<' && !/<([!=]|\w+>)/.test(remaining())) {
output = `\\${value}`;
}
push({
type: 'text',
value,
output
});
continue;
}
if (opts.dot !== true && (prev.type === 'slash' || prev.type === 'bos')) {
push({
type: 'qmark',
value,
output: QMARK_NO_DOT
});
continue;
}
push({
type: 'qmark',
value,
output: QMARK
});
continue;
}
/**
* Exclamation
*/
if (value === '!') {
if (opts.noextglob !== true && peek() === '(') {
if (peek(2) !== '?' || !/[!=<:]/.test(peek(3))) {
extglobOpen('negate', value);
continue;
}
}
if (opts.nonegate !== true && state.index === 0) {
negate();
continue;
}
}
/**
* Plus
*/
if (value === '+') {
if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
extglobOpen('plus', value);
continue;
}
if (prev && prev.value === '(' || opts.regex === false) {
push({
type: 'plus',
value,
output: PLUS_LITERAL
});
continue;
}
if (prev && (prev.type === 'bracket' || prev.type === 'paren' || prev.type === 'brace') || state.parens > 0) {
push({
type: 'plus',
value
});
continue;
}
push({
type: 'plus',
value: PLUS_LITERAL
});
continue;
}
/**
* Plain text
*/
if (value === '@') {
if (opts.noextglob !== true && peek() === '(' && peek(2) !== '?') {
push({
type: 'at',
extglob: true,
value,
output: ''
});
continue;
}
push({
type: 'text',
value
});
continue;
}
/**
* Plain text
*/
if (value !== '*') {
if (value === '$' || value === '^') {
value = `\\${value}`;
}
const match = REGEX_NON_SPECIAL_CHARS.exec(remaining());
if (match) {
value += match[0];
state.index += match[0].length;
}
push({
type: 'text',
value
});
continue;
}
/**
* Stars
*/
if (prev && (prev.type === 'globstar' || prev.star === true)) {
prev.type = 'star';
prev.star = true;
prev.value += value;
prev.output = star;
state.backtrack = true;
state.globstar = true;
consume(value);
continue;
}
let rest = remaining();
if (opts.noextglob !== true && /^\([^?]/.test(rest)) {
extglobOpen('star', value);
continue;
}
if (prev.type === 'star') {
var _context13;
if (opts.noglobstar === true) {
consume(value);
continue;
}
const prior = prev.prev;
const before = prior.prev;
const isStart = prior.type === 'slash' || prior.type === 'bos';
const afterStar = before && (before.type === 'star' || before.type === 'globstar');
if (opts.bash === true && (!isStart || rest[0] && rest[0] !== '/')) {
push({
type: 'star',
value,
output: ''
});
continue;
}
const isBrace = state.braces > 0 && (prior.type === 'comma' || prior.type === 'brace');
const isExtglob = extglobs.length && (prior.type === 'pipe' || prior.type === 'paren');
if (!isStart && prior.type !== 'paren' && !isBrace && !isExtglob) {
push({
type: 'star',
value,
output: ''
});
continue;
}
// strip consecutive `/**/`
while (_sliceInstanceProperty(rest).call(rest, 0, 3) === '/**') {
const after = input[state.index + 4];
if (after && after !== '/') {
break;
}
rest = _sliceInstanceProperty(rest).call(rest, 3);
consume('/**', 3);
}
if (prior.type === 'bos' && eos()) {
prev.type = 'globstar';
prev.value += value;
prev.output = globstar(opts);
state.output = prev.output;
state.globstar = true;
consume(value);
continue;
}
if (prior.type === 'slash' && prior.prev.type !== 'bos' && !afterStar && eos()) {
var _context11;
state.output = _sliceInstanceProperty(_context11 = state.output).call(_context11, 0, -(prior.output + prev.output).length);
prior.output = `(?:${prior.output}`;
prev.type = 'globstar';
prev.output = globstar(opts) + (opts.strictSlashes ? ')' : '|$)');
prev.value += value;
state.globstar = true;
state.output += prior.output + prev.output;
consume(value);
continue;
}
if (prior.type === 'slash' && prior.prev.type !== 'bos' && rest[0] === '/') {
var _context12;
const end = rest[1] !== undefined ? '|$' : '';
state.output = _sliceInstanceProperty(_context12 = state.output).call(_context12, 0, -(prior.output + prev.output).length);
prior.output = `(?:${prior.output}`;
prev.type = 'globstar';
prev.output = `${globstar(opts)}${SLASH_LITERAL}|${SLASH_LITERAL}${end})`;
prev.value += value;
state.output += prior.output + prev.output;
state.globstar = true;
consume(value + advance());
push({
type: 'slash',
value: '/',
output: ''
});
continue;
}
if (prior.type === 'bos' && rest[0] === '/') {
prev.type = 'globstar';
prev.value += value;
prev.output = `(?:^|${SLASH_LITERAL}|${globstar(opts)}${SLASH_LITERAL})`;
state.output = prev.output;
state.globstar = true;
consume(value + advance());
push({
type: 'slash',
value: '/',
output: ''
});
continue;
}
// remove single star from output
state.output = _sliceInstanceProperty(_context13 = state.output).call(_context13, 0, -prev.output.length);
// reset previous token to globstar
prev.type = 'globstar';
prev.output = globstar(opts);
prev.value += value;
// reset output with globstar
state.output += prev.output;
state.globstar = true;
consume(value);
continue;
}
const token = {
type: 'star',
value,
output: star
};
if (opts.bash === true) {
token.output = '.*?';
if (prev.type === 'bos' || prev.type === 'slash') {
token.output = nodot + token.output;
}
push(token);
continue;
}
if (prev && (prev.type === 'bracket' || prev.type === 'paren') && opts.regex === true) {
token.output = value;
push(token);
continue;
}
if (state.index === state.start || prev.type === 'slash' || prev.type === 'dot') {
if (prev.type === 'dot') {
state.output += NO_DOT_SLASH;
prev.output += NO_DOT_SLASH;
} else if (opts.dot === true) {
state.output += NO_DOTS_SLASH;
prev.output += NO_DOTS_SLASH;
} else {
state.output += nodot;
prev.output += nodot;
}
if (peek() !== '*') {
state.output += ONE_CHAR;
prev.output += ONE_CHAR;
}
}
push(token);
}
while (state.brackets > 0) {
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ']'));
state.output = utils.escapeLast(state.output, '[');
decrement('brackets');
}
while (state.parens > 0) {
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', ')'));
state.output = utils.escapeLast(state.output, '(');
decrement('parens');
}
while (state.braces > 0) {
if (opts.strictBrackets === true) throw new SyntaxError(syntaxError('closing', '}'));
state.output = utils.escapeLast(state.output, '{');
decrement('braces');
}
if (opts.strictSlashes !== true && (prev.type === 'star' || prev.type === 'bracket')) {
push({
type: 'maybe_slash',
value: '',
output: `${SLASH_LITERAL}?`
});
}
// rebuild the output if we had to backtrack at any point
if (state.backtrack === true) {
state.output = '';
for (const token of state.tokens) {
state.output += token.output != null ? token.output : token.value;
if (token.suffix) {
state.output += token.suffix;
}
}
}
return state;
};
/**
* Fast paths for creating regular expressions for common glob patterns.
* This can significantly speed up processing and has very little downside
* impact when none of the fast paths match.
*/
parse.fastpaths = (input, options) => {
const opts = {
...options
};
const max = typeof opts.maxLength === 'number' ? Math.min(MAX_LENGTH, opts.maxLength) : MAX_LENGTH;
const len = input.length;
if (len > max) {
throw new SyntaxError(`Input length: ${len}, exceeds maximum allowed length: ${max}`);
}
input = REPLACEMENTS[input] || input;
// create constants based on platform, for windows or posix
const {
DOT_LITERAL,
SLASH_LITERAL,
ONE_CHAR,
DOTS_SLASH,
NO_DOT,
NO_DOTS,
NO_DOTS_SLASH,
STAR,
START_ANCHOR
} = constants.globChars(opts.windows);
const nodot = opts.dot ? NO_DOTS : NO_DOT;
const slashDot = opts.dot ? NO_DOTS_SLASH : NO_DOT;
const capture = opts.capture ? '' : '?:';
const state = {
negated: false,
prefix: ''
};
let star = opts.bash === true ? '.*?' : STAR;
if (opts.capture) {
star = `(${star})`;
}
const globstar = opts => {
if (opts.noglobstar === true) return star;
return `(${capture}(?:(?!${START_ANCHOR}${opts.dot ? DOTS_SLASH : DOT_LITERAL}).)*?)`;
};
const create = str => {
switch (str) {
case '*':
return `${nodot}${ONE_CHAR}${star}`;
case '.*':
return `${DOT_LITERAL}${ONE_CHAR}${star}`;
case '*.*':
return `${nodot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
case '*/*':
return `${nodot}${star}${SLASH_LITERAL}${ONE_CHAR}${slashDot}${star}`;
case '**':
return nodot + globstar(opts);
case '**/*':
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${ONE_CHAR}${star}`;
case '**/*.*':
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${slashDot}${star}${DOT_LITERAL}${ONE_CHAR}${star}`;
case '**/.*':
return `(?:${nodot}${globstar(opts)}${SLASH_LITERAL})?${DOT_LITERAL}${ONE_CHAR}${star}`;
default:
{
const match = /^(.*?)\.(\w+)$/.exec(str);
if (!match) return;
const source = create(match[1]);
if (!source) return;
return source + DOT_LITERAL + match[2];
}
}
};
const output = utils.removePrefix(input, state);
let source = create(output);
if (source && opts.strictSlashes !== true) {
source += `${SLASH_LITERAL}?`;
}
return source;
};
parse_1 = parse;
return parse_1;
}
var picomatch_1$1;
var hasRequiredPicomatch$1;
function requirePicomatch$1() {
if (hasRequiredPicomatch$1) return picomatch_1$1;
hasRequiredPicomatch$1 = 1;
const scan = requireScan();
const parse = requireParse();
const utils = requireUtils();
const constants = requireConstants();
const isObject = val => val && typeof val === 'object' && !_Array$isArray(val);
/**
* Creates a matcher function from one or more glob patterns. The
* returned function takes a string to match as its first argument,
* and returns true if the string is a match. The returned matcher
* function also takes a boolean as the second argument that, when true,
* returns an object with additional information.
*
* ```js
* const picomatch = require('picomatch');
* // picomatch(glob[, options]);
*
* const isMatch = picomatch('*.!(*a)');
* console.log(isMatch('a.a')); //=> false
* console.log(isMatch('a.b')); //=> true
* ```
* @name picomatch
* @param {String|Array} `globs` One or more glob patterns.
* @param {Object=} `options`
* @return {Function=} Returns a matcher function.
* @api public
*/
const picomatch = (glob, options, returnState = false) => {
if (_Array$isArray(glob)) {
const fns = _mapInstanceProperty(glob).call(glob, input => picomatch(input, options, returnState));
const arrayMatcher = str => {
for (const isMatch of fns) {
const state = isMatch(str);
if (state) return state;
}
return false;
};
return arrayMatcher;
}
const isState = isObject(glob) && glob.tokens && glob.input;
if (glob === '' || typeof glob !== 'string' && !isState) {
throw new TypeError('Expected pattern to be a non-empty string');
}
const opts = options || {};
const posix = opts.windows;
const regex = isState ? picomatch.compileRe(glob, options) : picomatch.makeRe(glob, options, false, true);
const state = regex.state;
delete regex.state;
let isIgnored = () => false;
if (opts.ignore) {
const ignoreOpts = {
...options,
ignore: null,
onMatch: null,
onResult: null
};
isIgnored = picomatch(opts.ignore, ignoreOpts, returnState);
}
const matcher = (input, returnObject = false) => {
const {
isMatch,
match,
output
} = picomatch.test(input, regex, options, {
glob,
posix
});
const result = {
glob,
state,
regex,
posix,
input,
output,
match,
isMatch
};
if (typeof opts.onResult === 'function') {
opts.onResult(result);
}
if (isMatch === false) {
result.isMatch = false;
return returnObject ? result : false;
}
if (isIgnored(input)) {
if (typeof opts.onIgnore === 'function') {
opts.onIgnore(result);
}
result.isMatch = false;
return returnObject ? result : false;
}
if (typeof opts.onMatch === 'function') {
opts.onMatch(result);
}
return returnObject ? result : true;
};
if (returnState) {
matcher.state = state;
}
return matcher;
};
/**
* Test `input` with the given `regex`. This is used by the main
* `picomatch()` function to test the input string.
*
* ```js
* const picomatch = require('picomatch');
* // picomatch.test(input, regex[, options]);
*
* console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
* // { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
* ```
* @param {String} `input` String to test.
* @param {RegExp} `regex`
* @return {Object} Returns an object with matching info.
* @api public
*/
picomatch.test = (input, regex, options, {
glob,
posix
} = {}) => {
if (typeof input !== 'string') {
throw new TypeError('Expected input to be a string');
}
if (input === '') {
return {
isMatch: false,
output: ''
};
}
const opts = options || {};
const format = opts.format || (posix ? utils.toPosixSlashes : null);
let match = input === glob;
let output = match && format ? format(input) : input;
if (match === false) {
output = format ? format(input) : input;
match = output === glob;
}
if (match === false || opts.capture === true) {
if (opts.matchBase === true || opts.basename === true) {
match = picomatch.matchBase(input, regex, options, posix);
} else {
match = regex.exec(output);
}
}
return {
isMatch: Boolean(match),
match,
output
};
};
/**
* Match the basename of a filepath.
*
* ```js
* const picomatch = require('picomatch');
* // picomatch.matchBase(input, glob[, options]);
* console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
* ```
* @param {String} `input` String to test.
* @param {RegExp|String} `glob` Glob pattern or regex created by [.makeRe](#makeRe).
* @return {Boolean}
* @api public
*/
picomatch.matchBase = (input, glob, options) => {
const regex = glob instanceof RegExp ? glob : picomatch.makeRe(glob, options);
return regex.test(utils.basename(input));
};
/**
* Returns true if **any** of the given glob `patterns` match the specified `string`.
*
* ```js
* const picomatch = require('picomatch');
* // picomatch.isMatch(string, patterns[, options]);
*
* console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
* console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
* ```
* @param {String|Array} str The string to test.
* @param {String|Array} patterns One or more glob patterns to use for matching.
* @param {Object} [options] See available [options](#options).
* @return {Boolean} Returns true if any patterns match `str`
* @api public
*/
picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
/**
* Parse a glob pattern to create the source string for a regular
* expression.
*
* ```js
* const picomatch = require('picomatch');
* const result = picomatch.parse(pattern[, options]);
* ```
* @param {String} `pattern`
* @param {Object} `options`
* @return {Object} Returns an object with useful properties and output to be used as a regex source string.
* @api public
*/
picomatch.parse = (pattern, options) => {
if (_Array$isArray(pattern)) return _mapInstanceProperty(pattern).call(pattern, p => picomatch.parse(p, options));
return parse(pattern, {
...options,
fastpaths: false
});
};
/**
* Scan a glob pattern to separate the pattern into segments.
*
* ```js
* const picomatch = require('picomatch');
* // picomatch.scan(input[, options]);
*
* const result = picomatch.scan('!./foo/*.js');
* console.log(result);
* { prefix: '!./',
* input: '!./foo/*.js',
* start: 3,
* base: 'foo',
* glob: '*.js',
* isBrace: false,
* isBracket: false,
* isGlob: true,
* isExtglob: false,
* isGlobstar: false,
* negated: true }
* ```
* @param {String} `input` Glob pattern to scan.
* @param {Object} `options`
* @return {Object} Returns an object with
* @api public
*/
picomatch.scan = (input, options) => scan(input, options);
/**
* Compile a regular expression from the `state` object returned by the
* [parse()](#parse) method.
*
* @param {Object} `state`
* @param {Object} `options`
* @param {Boolean} `returnOutput` Intended for implementors, this argument allows you to return the raw output from the parser.
* @param {Boolean} `returnState` Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
* @return {RegExp}
* @api public
*/
picomatch.compileRe = (state, options, returnOutput = false, returnState = false) => {
if (returnOutput === true) {
return state.output;
}
const opts = options || {};
const prepend = opts.contains ? '' : '^';
const append = opts.contains ? '' : '$';
let source = `${prepend}(?:${state.output})${append}`;
if (state && state.negated === true) {
source = `^(?!${source}).*$`;
}
const regex = picomatch.toRegex(source, options);
if (returnState === true) {
regex.state = state;
}
return regex;
};
/**
* Create a regular expression from a parsed glob pattern.
*
* ```js
* const picomatch = require('picomatch');
* const state = picomatch.parse('*.js');
* // picomatch.compileRe(state[, options]);
*
* console.log(picomatch.compileRe(state));
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
* ```
* @param {String} `state` The object returned from the `.parse` method.
* @param {Object} `options`
* @param {Boolean} `returnOutput` Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
* @param {Boolean} `returnState` Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
* @return {RegExp} Returns a regex created from the given pattern.
* @api public
*/
picomatch.makeRe = (input, options = {}, returnOutput = false, returnState = false) => {
if (!input || typeof input !== 'string') {
throw new TypeError('Expected a non-empty string');
}
let parsed = {
negated: false,
fastpaths: true
};
if (options.fastpaths !== false && (input[0] === '.' || input[0] === '*')) {
parsed.output = parse.fastpaths(input, options);
}
if (!parsed.output) {
parsed = parse(input, options);
}
return picomatch.compileRe(parsed, options, returnOutput, returnState);
};
/**
* Create a regular expression from the given regex source string.
*
* ```js
* const picomatch = require('picomatch');
* // picomatch.toRegex(source[, options]);
*
* const { output } = picomatch.parse('*.js');
* console.log(picomatch.toRegex(output));
* //=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
* ```
* @param {String} `source` Regular expression source string.
* @param {Object} `options`
* @return {RegExp}
* @api public
*/
picomatch.toRegex = (source, options) => {
try {
const opts = options || {};
return new RegExp(source, _flagsInstanceProperty(opts) || (opts.nocase ? 'i' : ''));
} catch (err) {
if (options && options.debug === true) throw err;
return /$^/;
}
};
/**
* Picomatch constants.
* @return {Object}
*/
picomatch.constants = constants;
/**
* Expose "picomatch"
*/
picomatch_1$1 = picomatch;
return picomatch_1$1;
}
var picomatch_1;
var hasRequiredPicomatch;
function requirePicomatch() {
if (hasRequiredPicomatch) return picomatch_1;
hasRequiredPicomatch = 1;
const pico = requirePicomatch$1();
const utils = requireUtils();
function picomatch(glob, options, returnState = false) {
// default to os.platform()
if (options && (options.windows === null || options.windows === undefined)) {
// don't mutate the original options object
options = {
...options,
windows: utils.isWindows()
};
}
return pico(glob, options, returnState);
}
_Object$assign(picomatch, pico);
picomatch_1 = picomatch;
return picomatch_1;
}
var picomatchExports = /*@__PURE__*/ requirePicomatch();
var picomatch = /*@__PURE__*/getDefaultExportFromCjs(picomatchExports);
function escapeStringRegexp(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 `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
return string.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d');
}
exports.KEYS = KEYS;
exports.astUtilsExports = astUtilsExports;
exports.distExports = distExports;
exports.escapeStringRegexp = escapeStringRegexp;
exports.estraverseExports = estraverseExports;
exports.latestEcmaVersion = latestEcmaVersion;
exports.picomatch = picomatch;
exports.tokenize = tokenize;