blob: fc1a9d72b647f0b34e58a6b213695230bc604926 [file] [log] [blame] [edit]
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
/***/ "./node_modules/acorn-jsx/index.js":
/*!*****************************************!*\
!*** ./node_modules/acorn-jsx/index.js ***!
\*****************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
const XHTMLEntities = __webpack_require__(/*! ./xhtml */ "./node_modules/acorn-jsx/xhtml.js");
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(__webpack_require__(/*! acorn */ "./node_modules/acorn/dist/acorn.js")).tokTypes;
},
configurable: true,
enumerable: true
}));
function plugin(options, Parser) {
const acorn = Parser.acorn || __webpack_require__(/*! acorn */ "./node_modules/acorn/dist/acorn.js");
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() {
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 += this.input.slice(chunkStart, this.pos);
return this.finishToken(tok.jsxText, out);
case 38: // '&'
out += this.input.slice(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 ? "&gt;" : "&rbrace;") + "` or " + "`{\"" + this.input[this.pos] + "\"}" + "`?"
);
default:
if (isNewLine(ch)) {
out += this.input.slice(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) {
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) { // '&'
out += this.input.slice(chunkStart, this.pos);
out += this.jsx_readEntity();
chunkStart = this.pos;
} else if (isNewLine(ch)) {
out += this.input.slice(chunkStart, this.pos);
out += this.jsx_readNewLine(false);
chunkStart = this.pos;
} else {
++this.pos;
}
}
out += this.input.slice(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() {
let ch, start = this.pos;
do {
ch = this.input.charCodeAt(++this.pos);
} while (isIdentifierChar(ch) || ch === 45); // '-'
return this.finishToken(tok.jsxName, this.input.slice(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);
}
}
};
}
/***/ }),
/***/ "./node_modules/acorn-jsx/xhtml.js":
/*!*****************************************!*\
!*** ./node_modules/acorn-jsx/xhtml.js ***!
\*****************************************/
/***/ ((module) => {
module.exports = {
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'
};
/***/ }),
/***/ "./node_modules/acorn/dist/acorn.js":
/*!******************************************!*\
!*** ./node_modules/acorn/dist/acorn.js ***!
\******************************************/
/***/ (function(__unused_webpack_module, exports) {
(function (global, factory) {
true ? factory(exports) :
0;
})(this, (function (exports) { 'use strict';
// 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 === void 0 ) 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 === void 0 ) 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 === void 0 ) 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_CLASS_FIELD_INIT = 512,
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) {
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) {
this.pos = startPos;
this.lineStart = this.input.lastIndexOf("\n", startPos - 1) + 1;
this.curLine = this.input.slice(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 && this.input.slice(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 (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
prototypeAccessors.inGenerator.get = function () { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0 };
prototypeAccessors.inAsync.get = function () { return (this.currentVarScope().flags & SCOPE_ASYNC) > 0 };
prototypeAccessors.canAwait.get = function () {
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
var ref = this.scopeStack[i];
var flags = ref.flags;
if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT)) { return false }
if (flags & SCOPE_FUNCTION) { return (flags & SCOPE_ASYNC) > 0 }
}
return (this.inModule && this.options.ecmaVersion >= 13) || this.options.allowAwaitOutsideFunction
};
prototypeAccessors.allowSuper.get = function () {
var ref = this.currentThisScope();
var flags = ref.flags;
return (flags & SCOPE_SUPER) > 0 || this.options.allowSuperOutsideMethod
};
prototypeAccessors.allowDirectSuper.get = function () { return (this.currentThisScope().flags & SCOPE_DIRECT_SUPER) > 0 };
prototypeAccessors.treatFunctionsAsVar.get = function () { return this.treatFunctionsAsVarInScope(this.currentScope()) };
prototypeAccessors.allowNewDotTarget.get = function () {
for (var i = this.scopeStack.length - 1; i >= 0; i--) {
var ref = this.scopeStack[i];
var flags = ref.flags;
if (flags & (SCOPE_CLASS_STATIC_BLOCK | SCOPE_CLASS_FIELD_INIT) ||
((flags & SCOPE_FUNCTION) && !(flags & SCOPE_ARROW))) { return true }
}
return false
};
prototypeAccessors.inClassStaticBlock.get = function () {
return (this.currentVarScope().flags & 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 (;;) {
// Try to find string literal.
skipWhiteSpace.lastIndex = start;
start += skipWhiteSpace.exec(this.input)[0].length;
var match = literal.exec(this.input.slice(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() {
return this.type === types$1.eof ||
this.type === types$1.braceR ||
lineBreak.test(this.input.slice(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 pos = next + 1;
while (isIdentifierChar(nextCh = this.input.charCodeAt(pos), true)) { ++pos; }
if (nextCh === 92 || nextCh > 0xd7ff && nextCh < 0xdc00) { return true }
var ident = this.input.slice(next, pos);
if (!keywordRelationalOperator.test(ident)) { return true }
}
return false
};
// check 'async [no LineTerminator here] function'
// - 'async /*foo*/ function' is OK.
// - 'async /*\n*/ function' is invalid.
pp$8.isAsyncFunction = function() {
if (this.options.ecmaVersion < 8 || !this.isContextual("async"))
{ return false }
skipWhiteSpace.lastIndex = this.pos;
var skip = skipWhiteSpace.exec(this.input);
var next = this.pos + skip[0].length, after;
return !lineBreak.test(this.input.slice(this.pos, next)) &&
this.input.slice(next, next + 8) === "function" &&
(next + 8 === this.input.length ||
!(isIdentifierChar(after = this.input.charCodeAt(next + 8)) || after > 0xd7ff && after < 0xdc00))
};
pp$8.isUsingKeyword = function(isAwaitUsing, isFor) {
if (this.options.ecmaVersion < 17 || !this.isContextual(isAwaitUsing ? "await" : "using"))
{ return false }
skipWhiteSpace.lastIndex = this.pos;
var skip = skipWhiteSpace.exec(this.input);
var next = this.pos + skip[0].length;
if (lineBreak.test(this.input.slice(this.pos, next))) { return false }
if (isAwaitUsing) {
var awaitEndPos = next + 5 /* await */, after;
if (this.input.slice(next, awaitEndPos) !== "using" ||
awaitEndPos === this.input.length ||
isIdentifierChar(after = this.input.charCodeAt(awaitEndPos)) ||
(after > 0xd7ff && after < 0xdc00)
) { return false }
skipWhiteSpace.lastIndex = awaitEndPos;
var skipAfterUsing = skipWhiteSpace.exec(this.input);
if (skipAfterUsing && lineBreak.test(this.input.slice(awaitEndPos, awaitEndPos + skipAfterUsing[0].length))) { return false }
}
if (isFor) {
var ofEndPos = next + 2 /* of */, after$1;
if (this.input.slice(next, ofEndPos) === "of") {
if (ofEndPos === this.input.length ||
(!isIdentifierChar(after$1 = this.input.charCodeAt(ofEndPos)) && !(after$1 > 0xd7ff && after$1 < 0xdc00))) { return false }
}
}
var ch = this.input.charCodeAt(next);
return isIdentifierStart(ch, true) || ch === 92 // '\'
};
pp$8.isAwaitUsing = function(isFor) {
return this.isUsingKeyword(true, isFor)
};
pp$8.isUsing = function(isFor) {
return this.isUsingKeyword(false, isFor)
};
// 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 usingKind = this.isAwaitUsing(false) ? "await using" : this.isUsing(false) ? "using" : null;
if (usingKind) {
if (topLevel && this.options.sourceType === "script") {
this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script`");
}
if (usingKind === "await using") {
if (!this.canAwait) {
this.raise(this.start, "Await using cannot appear outside of async function");
}
this.next();
}
this.next();
this.parseVar(node, false, usingKind);
this.semicolon();
return this.finishNode(node, "VariableDeclaration")
}
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");
return this.parseForAfterInit(node, init$1, awaitAt)
}
var startsWithLet = this.isContextual("let"), isForOf = false;
var usingKind = this.isUsing(true) ? "using" : this.isAwaitUsing(true) ? "await using" : null;
if (usingKind) {
var init$2 = this.startNode();
this.next();
if (usingKind === "await using") { this.next(); }
this.parseVar(init$2, true, usingKind);
this.finishNode(init$2, "VariableDeclaration");
return this.parseForAfterInit(node, init$2, awaitAt)
}
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)
};
// Helper method to parse for loop after variable initialization
pp$8.parseForAfterInit = function(node, init, awaitAt) {
if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init.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)
}
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) {
this.next();
if (lineBreak.test(this.input.slice(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 ? context.indexOf("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 === void 0 ) createNewLexicalScope = true;
if ( node === void 0 ) 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 && (kind === "using" || kind === "await using") && this.options.ecmaVersion >= 17 && this.type !== types$1._in && !this.isContextual("of")) {
this.raise(this.lastTokEnd, ("Missing initializer in " + kind + " declaration"));
} 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 = kind === "using" || kind === "await using"
? this.parseIdent()
: 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.
this.enterScope(SCOPE_CLASS_FIELD_INIT | SCOPE_SUPER);
field.value = this.parseMaybeAssign();
this.exitScope();
} 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;
if (this.options.ecmaVersion >= 16)
{ node.attributes = []; }
} 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;
if (this.options.ecmaVersion >= 16)
{ node.attributes = []; }
}
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) {
statements[i].directive = statements[i].expression.raw.slice(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 === void 0 ) 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 === void 0 ) bindingType = BIND_NONE;
switch (expr.type) {
case "ObjectPattern":
for (var i = 0, list = expr.properties; i < list.length; i += 1) {
var prop = list[i];
this.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 === void 0 ) 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)
{ return lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }
if (prevType === types$1._else || prevType === types$1.semi || prevType === types$1.eof || prevType === types$1.parenR || prevType === types$1.arrow)
{ return true }
if (prevType === types$1.braceL)
{ return parent === types.b_stat }
if (prevType === types$1._var || prevType === types$1._const || prevType === types$1.name)
{ return false }
return !this.exprAllowed
};
pp$6.inGeneratorContext = function() {
for (var i = this.context.length - 1; i >= 1; i--) {
var context = this.context[i];
if (context.token === "function")
{ return context.generator }
}
return false
};
pp$6.updateContext = function(prevType) {
var update, type = this.type;
if (type.keyword && prevType === types$1.dot)
{ this.exprAllowed = false; }
else if (update = type.updateContext)
{ update.call(this, prevType); }
else
{ this.exprAllowed = type.beforeExpr; }
};
// Used to handle 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) {
if (prevType.beforeExpr && prevType !== types$1._else &&
!(prevType === types$1.semi && this.curContext() !== types.p_stat) &&
!(prevType === types$1._return && lineBreak.test(this.input.slice(this.lastTokEnd, this.start))) &&
!((prevType === types$1.colon || prevType === types$1.braceL) && this.curContext() === types.b_stat))
{ this.context.push(types.f_expr); }
else
{ this.context.push(types.f_stat); }
this.exprAllowed = false;
};
types$1.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 startPos = this.start, startLoc = this.startLoc;
var expr = this.parseExprAtom(refDestructuringErrors, forInit);
if (expr.type === "ArrowFunctionExpression" && this.input.slice(this.lastTokStart, this.lastTokEnd) !== ")")
{ return expr }
var result = this.parseSubscripts(expr, startPos, startLoc, 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: value.flags};
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 node = this.startNode();
node.value = value;
node.raw = this.input.slice(this.start, this.end);
if (node.raw.charCodeAt(node.raw.length - 1) === 110)
{ node.bigint = node.value != null ? node.value.toString() : node.raw.slice(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 {
elem.value = {
raw: this.input.slice(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 === void 0 ) ref = {};
var isTagged = ref.isTagged; if ( isTagged === void 0 ) 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) {
return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" &&
(this.type === types$1.name || this.type === types$1.num || this.type === types$1.string || this.type === types$1.bracketL || this.type.keyword || (this.options.ecmaVersion >= 9 && this.type === types$1.star)) &&
!lineBreak.test(this.input.slice(this.lastTokEnd, this.start))
};
// Parse an object literal or binding pattern.
pp$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) {
var kind = prop.key.name;
this.parsePropertyName(prop);
prop.value = this.parseMethod(false);
prop.kind = kind;
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.method = true;
prop.value = this.parseMethod(isGenerator, isAsync);
prop.kind = "init";
} 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; }
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.kind = "init";
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 = (void 0);
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 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().flags & SCOPE_VAR) && 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 &&
this.input.slice(start, end).indexOf("\\") !== -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 + ")";
if (this.sourceFile) {
message += " in " + this.sourceFile;
}
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 = [];
};
// 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 (scope.flags & SCOPE_FUNCTION) || !this.inModule && (scope.flags & SCOPE_TOP)
};
pp$3.declareName = function(name, bindingType, pos) {
var redeclared = false;
if (bindingType === BIND_LEXICAL) {
var scope = this.currentScope();
redeclared = scope.lexical.indexOf(name) > -1 || scope.functions.indexOf(name) > -1 || scope.var.indexOf(name) > -1;
scope.lexical.push(name);
if (this.inModule && (scope.flags & 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)
{ redeclared = scope$2.lexical.indexOf(name) > -1; }
else
{ redeclared = scope$2.lexical.indexOf(name) > -1 || scope$2.var.indexOf(name) > -1; }
scope$2.functions.push(name);
} else {
for (var i = this.scopeStack.length - 1; i >= 0; --i) {
var scope$3 = this.scopeStack[i];
if (scope$3.lexical.indexOf(name) > -1 && !((scope$3.flags & SCOPE_SIMPLE_CATCH) && scope$3.lexical[0] === name) ||
!this.treatFunctionsAsVarInScope(scope$3) && scope$3.functions.indexOf(name) > -1) {
redeclared = true;
break
}
scope$3.var.push(name);
if (this.inModule && (scope$3.flags & SCOPE_TOP))
{ delete this.undefinedExports[name]; }
if (scope$3.flags & SCOPE_VAR) { break }
}
}
if (redeclared) { this.raiseRecoverable(pos, ("Identifier '" + name + "' has already been declared")); }
};
pp$3.checkLocalExport = function(id) {
// scope.functions must be empty as Module code is always strict.
if (this.scopeStack[0].lexical.indexOf(id.name) === -1 &&
this.scopeStack[0].var.indexOf(id.name) === -1) {
this.undefinedExports[id.name] = id;
}
};
pp$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 (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK)) { 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 (scope.flags & (SCOPE_VAR | SCOPE_CLASS_FIELD_INIT | SCOPE_CLASS_STATIC_BLOCK) &&
!(scope.flags & 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 = flags.indexOf("v") !== -1;
var unicode = flags.indexOf("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 === void 0 ) 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 === void 0 ) 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) {
if ( forceU === void 0 ) forceU = false;
return this.at(this.pos, forceU)
};
RegExpValidationState.prototype.lookahead = function lookahead (forceU) {
if ( forceU === void 0 ) forceU = false;
return this.at(this.nextIndex(this.pos, forceU), forceU)
};
RegExpValidationState.prototype.advance = function advance (forceU) {
if ( forceU === void 0 ) forceU = false;
this.pos = this.nextIndex(this.pos, forceU);
};
RegExpValidationState.prototype.eat = function eat (ch, forceU) {
if ( forceU === void 0 ) forceU = false;
if (this.current(forceU) === ch) {
this.advance(forceU);
return true
}
return false
};
RegExpValidationState.prototype.eatChars = function eatChars (chs, forceU) {
if ( forceU === void 0 ) forceU = false;
var pos = this.pos;
for (var i = 0, list = chs; i < list.length; i += 1) {
var ch = list[i];
var current = this.at(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 = state.flags;
var u = false;
var v = false;
for (var i = 0; i < flags.length; i++) {
var flag = flags.charAt(i);
if (validFlags.indexOf(flag) === -1) {
this.raise(state.start, "Invalid regular expression flag");
}
if (flags.indexOf(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 === void 0 ) 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 (addModifiers.indexOf(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 (
removeModifiers.indexOf(modifier$1, i$1 + 1) > -1 ||
addModifiers.indexOf(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 === void 0 ) 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 startLoc = this.options.onComment && this.curPosition();
var start = this.pos, end = this.input.indexOf("*/", this.pos += 2);
if (end === -1) { this.raise(this.pos - 2, "Unterminated comment"); }
this.pos = end + 2;
if (this.options.locations) {
for (var nextBreak = (void 0), pos = start; (nextBreak = nextLineBreak(this.input, pos, this.pos)) > -1;) {
++this.curLine;
pos = this.lineStart = nextBreak;
}
}
if (this.options.onComment)
{ this.options.onComment(true, this.input.slice(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)
{ this.options.onComment(false, this.input.slice(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) {
if (next === 45 && !this.inModule && this.input.charCodeAt(this.pos + 2) === 62 &&
(this.lastTokEnd === 0 || lineBreak.test(this.input.slice(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 str = this.input.slice(this.pos, this.pos + size);
this.pos += size;
return this.finishToken(type, str)
};
pp.readRegexp = function() {
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 = this.input.slice(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 = (void 0);
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) {
val = stringToBigInt(this.input.slice(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 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 val$1 = stringToBigInt(this.input.slice(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(this.input.slice(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(this.input.slice(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) { // '{'
if (this.options.ecmaVersion < 6) { this.unexpected(); }
var codePos = ++this.pos;
code = this.readHexChar(this.input.indexOf("}", 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 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) { // '\'
out += this.input.slice(chunkStart, this.pos);
out += this.readEscapedChar(false);
chunkStart = this.pos;
} else if (ch === 0x2028 || ch === 0x2029) {
if (this.options.ecmaVersion < 10) { this.raise(this.start, "Unterminated string constant"); }
++this.pos;
if (this.options.locations) {
this.curLine++;
this.lineStart = this.pos;
}
} else {
if (isNewLine(ch)) { this.raise(this.start, "Unterminated string constant"); }
++this.pos;
}
}
out += this.input.slice(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) { // '`', '${'
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 += this.input.slice(chunkStart, this.pos);
return this.finishToken(types$1.template, out)
}
if (ch === 92) { // '\'
out += this.input.slice(chunkStart, this.pos);
out += this.readEscapedChar(true);
chunkStart = this.pos;
} else if (isNewLine(ch)) {
out += this.input.slice(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() {
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, this.input.slice(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 = octalStr.slice(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() {
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) { // "\"
this.containsEsc = true;
word += this.input.slice(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 + this.input.slice(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
var version = "8.15.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;
}));
/***/ }),
/***/ "./node_modules/assert/build/assert.js":
/*!*********************************************!*\
!*** ./node_modules/assert/build/assert.js ***!
\*********************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
/* provided dependency */ var process = __webpack_require__(/*! process/browser.js */ "./node_modules/process/browser.js");
// Currently in sync with Node.js lib/assert.js
// https://github.com/nodejs/node/commit/2a51ae424a513ec9a6aa3466baa0cc1d55dd4f3b
// Originally from narwhal.js (http://narwhaljs.org)
// Copyright (c) 2009 Thomas Robinson <280north.com>
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the 'Software'), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
// ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var _require = __webpack_require__(/*! ./internal/errors */ "./node_modules/assert/build/internal/errors.js"),
_require$codes = _require.codes,
ERR_AMBIGUOUS_ARGUMENT = _require$codes.ERR_AMBIGUOUS_ARGUMENT,
ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
ERR_INVALID_ARG_VALUE = _require$codes.ERR_INVALID_ARG_VALUE,
ERR_INVALID_RETURN_VALUE = _require$codes.ERR_INVALID_RETURN_VALUE,
ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS;
var AssertionError = __webpack_require__(/*! ./internal/assert/assertion_error */ "./node_modules/assert/build/internal/assert/assertion_error.js");
var _require2 = __webpack_require__(/*! util/ */ "./node_modules/util/util.js"),
inspect = _require2.inspect;
var _require$types = (__webpack_require__(/*! util/ */ "./node_modules/util/util.js").types),
isPromise = _require$types.isPromise,
isRegExp = _require$types.isRegExp;
var objectAssign = __webpack_require__(/*! object.assign/polyfill */ "./node_modules/object.assign/polyfill.js")();
var objectIs = __webpack_require__(/*! object-is/polyfill */ "./node_modules/object-is/polyfill.js")();
var RegExpPrototypeTest = __webpack_require__(/*! call-bind/callBound */ "./node_modules/call-bind/callBound.js")('RegExp.prototype.test');
var errorCache = new Map();
var isDeepEqual;
var isDeepStrictEqual;
var parseExpressionAt;
var findNodeAround;
var decoder;
function lazyLoadComparison() {
var comparison = __webpack_require__(/*! ./internal/util/comparisons */ "./node_modules/assert/build/internal/util/comparisons.js");
isDeepEqual = comparison.isDeepEqual;
isDeepStrictEqual = comparison.isDeepStrictEqual;
}
// Escape control characters but not \n and \t to keep the line breaks and
// indentation intact.
// eslint-disable-next-line no-control-regex
var escapeSequencesRegExp = /[\x00-\x08\x0b\x0c\x0e-\x1f]/g;
var meta = ["\\u0000", "\\u0001", "\\u0002", "\\u0003", "\\u0004", "\\u0005", "\\u0006", "\\u0007", '\\b', '', '', "\\u000b", '\\f', '', "\\u000e", "\\u000f", "\\u0010", "\\u0011", "\\u0012", "\\u0013", "\\u0014", "\\u0015", "\\u0016", "\\u0017", "\\u0018", "\\u0019", "\\u001a", "\\u001b", "\\u001c", "\\u001d", "\\u001e", "\\u001f"];
var escapeFn = function escapeFn(str) {
return meta[str.charCodeAt(0)];
};
var warned = false;
// The assert module provides functions that throw
// AssertionError's when particular conditions are not met. The
// assert module must conform to the following interface.
var assert = module.exports = ok;
var NO_EXCEPTION_SENTINEL = {};
// All of the following functions must throw an AssertionError
// when a corresponding condition is not met, with a message that
// may be undefined if not provided. All assertion methods provide
// both the actual and expected values to the assertion error for
// display purposes.
function innerFail(obj) {
if (obj.message instanceof Error) throw obj.message;
throw new AssertionError(obj);
}
function fail(actual, expected, message, operator, stackStartFn) {
var argsLen = arguments.length;
var internalMessage;
if (argsLen === 0) {
internalMessage = 'Failed';
} else if (argsLen === 1) {
message = actual;
actual = undefined;
} else {
if (warned === false) {
warned = true;
var warn = process.emitWarning ? process.emitWarning : console.warn.bind(console);
warn('assert.fail() with more than one argument is deprecated. ' + 'Please use assert.strictEqual() instead or only pass a message.', 'DeprecationWarning', 'DEP0094');
}
if (argsLen === 2) operator = '!=';
}
if (message instanceof Error) throw message;
var errArgs = {
actual: actual,
expected: expected,
operator: operator === undefined ? 'fail' : operator,
stackStartFn: stackStartFn || fail
};
if (message !== undefined) {
errArgs.message = message;
}
var err = new AssertionError(errArgs);
if (internalMessage) {
err.message = internalMessage;
err.generatedMessage = true;
}
throw err;
}
assert.fail = fail;
// The AssertionError is defined in internal/error.
assert.AssertionError = AssertionError;
function innerOk(fn, argLen, value, message) {
if (!value) {
var generatedMessage = false;
if (argLen === 0) {
generatedMessage = true;
message = 'No value argument passed to `assert.ok()`';
} else if (message instanceof Error) {
throw message;
}
var err = new AssertionError({
actual: value,
expected: true,
message: message,
operator: '==',
stackStartFn: fn
});
err.generatedMessage = generatedMessage;
throw err;
}
}
// Pure assertion tests whether a value is truthy, as determined
// by !!value.
function ok() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
innerOk.apply(void 0, [ok, args.length].concat(args));
}
assert.ok = ok;
// The equality assertion tests shallow, coercive equality with ==.
/* eslint-disable no-restricted-properties */
assert.equal = function equal(actual, expected, message) {
if (arguments.length < 2) {
throw new ERR_MISSING_ARGS('actual', 'expected');
}
// eslint-disable-next-line eqeqeq
if (actual != expected) {
innerFail({
actual: actual,
expected: expected,
message: message,
operator: '==',
stackStartFn: equal
});
}
};
// The non-equality assertion tests for whether two objects are not
// equal with !=.
assert.notEqual = function notEqual(actual, expected, message) {
if (arguments.length < 2) {
throw new ERR_MISSING_ARGS('actual', 'expected');
}
// eslint-disable-next-line eqeqeq
if (actual == expected) {
innerFail({
actual: actual,
expected: expected,
message: message,
operator: '!=',
stackStartFn: notEqual
});
}
};
// The equivalence assertion tests a deep equality relation.
assert.deepEqual = function deepEqual(actual, expected, message) {
if (arguments.length < 2) {
throw new ERR_MISSING_ARGS('actual', 'expected');
}
if (isDeepEqual === undefined) lazyLoadComparison();
if (!isDeepEqual(actual, expected)) {
innerFail({
actual: actual,
expected: expected,
message: message,
operator: 'deepEqual',
stackStartFn: deepEqual
});
}
};
// The non-equivalence assertion tests for any deep inequality.
assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
if (arguments.length < 2) {
throw new ERR_MISSING_ARGS('actual', 'expected');
}
if (isDeepEqual === undefined) lazyLoadComparison();
if (isDeepEqual(actual, expected)) {
innerFail({
actual: actual,
expected: expected,
message: message,
operator: 'notDeepEqual',
stackStartFn: notDeepEqual
});
}
};
/* eslint-enable */
assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
if (arguments.length < 2) {
throw new ERR_MISSING_ARGS('actual', 'expected');
}
if (isDeepEqual === undefined) lazyLoadComparison();
if (!isDeepStrictEqual(actual, expected)) {
innerFail({
actual: actual,
expected: expected,
message: message,
operator: 'deepStrictEqual',
stackStartFn: deepStrictEqual
});
}
};
assert.notDeepStrictEqual = notDeepStrictEqual;
function notDeepStrictEqual(actual, expected, message) {
if (arguments.length < 2) {
throw new ERR_MISSING_ARGS('actual', 'expected');
}
if (isDeepEqual === undefined) lazyLoadComparison();
if (isDeepStrictEqual(actual, expected)) {
innerFail({
actual: actual,
expected: expected,
message: message,
operator: 'notDeepStrictEqual',
stackStartFn: notDeepStrictEqual
});
}
}
assert.strictEqual = function strictEqual(actual, expected, message) {
if (arguments.length < 2) {
throw new ERR_MISSING_ARGS('actual', 'expected');
}
if (!objectIs(actual, expected)) {
innerFail({
actual: actual,
expected: expected,
message: message,
operator: 'strictEqual',
stackStartFn: strictEqual
});
}
};
assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
if (arguments.length < 2) {
throw new ERR_MISSING_ARGS('actual', 'expected');
}
if (objectIs(actual, expected)) {
innerFail({
actual: actual,
expected: expected,
message: message,
operator: 'notStrictEqual',
stackStartFn: notStrictEqual
});
}
};
var Comparison = /*#__PURE__*/_createClass(function Comparison(obj, keys, actual) {
var _this = this;
_classCallCheck(this, Comparison);
keys.forEach(function (key) {
if (key in obj) {
if (actual !== undefined && typeof actual[key] === 'string' && isRegExp(obj[key]) && RegExpPrototypeTest(obj[key], actual[key])) {
_this[key] = actual[key];
} else {
_this[key] = obj[key];
}
}
});
});
function compareExceptionKey(actual, expected, key, message, keys, fn) {
if (!(key in actual) || !isDeepStrictEqual(actual[key], expected[key])) {
if (!message) {
// Create placeholder objects to create a nice output.
var a = new Comparison(actual, keys);
var b = new Comparison(expected, keys, actual);
var err = new AssertionError({
actual: a,
expected: b,
operator: 'deepStrictEqual',
stackStartFn: fn
});
err.actual = actual;
err.expected = expected;
err.operator = fn.name;
throw err;
}
innerFail({
actual: actual,
expected: expected,
message: message,
operator: fn.name,
stackStartFn: fn
});
}
}
function expectedException(actual, expected, msg, fn) {
if (typeof expected !== 'function') {
if (isRegExp(expected)) return RegExpPrototypeTest(expected, actual);
// assert.doesNotThrow does not accept objects.
if (arguments.length === 2) {
throw new ERR_INVALID_ARG_TYPE('expected', ['Function', 'RegExp'], expected);
}
// Handle primitives properly.
if (_typeof(actual) !== 'object' || actual === null) {
var err = new AssertionError({
actual: actual,
expected: expected,
message: msg,
operator: 'deepStrictEqual',
stackStartFn: fn
});
err.operator = fn.name;
throw err;
}
var keys = Object.keys(expected);
// Special handle errors to make sure the name and the message are compared
// as well.
if (expected instanceof Error) {
keys.push('name', 'message');
} else if (keys.length === 0) {
throw new ERR_INVALID_ARG_VALUE('error', expected, 'may not be an empty object');
}
if (isDeepEqual === undefined) lazyLoadComparison();
keys.forEach(function (key) {
if (typeof actual[key] === 'string' && isRegExp(expected[key]) && RegExpPrototypeTest(expected[key], actual[key])) {
return;
}
compareExceptionKey(actual, expected, key, msg, keys, fn);
});
return true;
}
// Guard instanceof against arrow functions as they don't have a prototype.
if (expected.prototype !== undefined && actual instanceof expected) {
return true;
}
if (Error.isPrototypeOf(expected)) {
return false;
}
return expected.call({}, actual) === true;
}
function getActual(fn) {
if (typeof fn !== 'function') {
throw new ERR_INVALID_ARG_TYPE('fn', 'Function', fn);
}
try {
fn();
} catch (e) {
return e;
}
return NO_EXCEPTION_SENTINEL;
}
function checkIsPromise(obj) {
// Accept native ES6 promises and promises that are implemented in a similar
// way. Do not accept thenables that use a function as `obj` and that have no
// `catch` handler.
// TODO: thenables are checked up until they have the correct methods,
// but according to documentation, the `then` method should receive
// the `fulfill` and `reject` arguments as well or it may be never resolved.
return isPromise(obj) || obj !== null && _typeof(obj) === 'object' && typeof obj.then === 'function' && typeof obj.catch === 'function';
}
function waitForActual(promiseFn) {
return Promise.resolve().then(function () {
var resultPromise;
if (typeof promiseFn === 'function') {
// Return a rejected promise if `promiseFn` throws synchronously.
resultPromise = promiseFn();
// Fail in case no promise is returned.
if (!checkIsPromise(resultPromise)) {
throw new ERR_INVALID_RETURN_VALUE('instance of Promise', 'promiseFn', resultPromise);
}
} else if (checkIsPromise(promiseFn)) {
resultPromise = promiseFn;
} else {
throw new ERR_INVALID_ARG_TYPE('promiseFn', ['Function', 'Promise'], promiseFn);
}
return Promise.resolve().then(function () {
return resultPromise;
}).then(function () {
return NO_EXCEPTION_SENTINEL;
}).catch(function (e) {
return e;
});
});
}
function expectsError(stackStartFn, actual, error, message) {
if (typeof error === 'string') {
if (arguments.length === 4) {
throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error);
}
if (_typeof(actual) === 'object' && actual !== null) {
if (actual.message === error) {
throw new ERR_AMBIGUOUS_ARGUMENT('error/message', "The error message \"".concat(actual.message, "\" is identical to the message."));
}
} else if (actual === error) {
throw new ERR_AMBIGUOUS_ARGUMENT('error/message', "The error \"".concat(actual, "\" is identical to the message."));
}
message = error;
error = undefined;
} else if (error != null && _typeof(error) !== 'object' && typeof error !== 'function') {
throw new ERR_INVALID_ARG_TYPE('error', ['Object', 'Error', 'Function', 'RegExp'], error);
}
if (actual === NO_EXCEPTION_SENTINEL) {
var details = '';
if (error && error.name) {
details += " (".concat(error.name, ")");
}
details += message ? ": ".concat(message) : '.';
var fnType = stackStartFn.name === 'rejects' ? 'rejection' : 'exception';
innerFail({
actual: undefined,
expected: error,
operator: stackStartFn.name,
message: "Missing expected ".concat(fnType).concat(details),
stackStartFn: stackStartFn
});
}
if (error && !expectedException(actual, error, message, stackStartFn)) {
throw actual;
}
}
function expectsNoError(stackStartFn, actual, error, message) {
if (actual === NO_EXCEPTION_SENTINEL) return;
if (typeof error === 'string') {
message = error;
error = undefined;
}
if (!error || expectedException(actual, error)) {
var details = message ? ": ".concat(message) : '.';
var fnType = stackStartFn.name === 'doesNotReject' ? 'rejection' : 'exception';
innerFail({
actual: actual,
expected: error,
operator: stackStartFn.name,
message: "Got unwanted ".concat(fnType).concat(details, "\n") + "Actual message: \"".concat(actual && actual.message, "\""),
stackStartFn: stackStartFn
});
}
throw actual;
}
assert.throws = function throws(promiseFn) {
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
args[_key2 - 1] = arguments[_key2];
}
expectsError.apply(void 0, [throws, getActual(promiseFn)].concat(args));
};
assert.rejects = function rejects(promiseFn) {
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
args[_key3 - 1] = arguments[_key3];
}
return waitForActual(promiseFn).then(function (result) {
return expectsError.apply(void 0, [rejects, result].concat(args));
});
};
assert.doesNotThrow = function doesNotThrow(fn) {
for (var _len4 = arguments.length, args = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
args[_key4 - 1] = arguments[_key4];
}
expectsNoError.apply(void 0, [doesNotThrow, getActual(fn)].concat(args));
};
assert.doesNotReject = function doesNotReject(fn) {
for (var _len5 = arguments.length, args = new Array(_len5 > 1 ? _len5 - 1 : 0), _key5 = 1; _key5 < _len5; _key5++) {
args[_key5 - 1] = arguments[_key5];
}
return waitForActual(fn).then(function (result) {
return expectsNoError.apply(void 0, [doesNotReject, result].concat(args));
});
};
assert.ifError = function ifError(err) {
if (err !== null && err !== undefined) {
var message = 'ifError got unwanted exception: ';
if (_typeof(err) === 'object' && typeof err.message === 'string') {
if (err.message.length === 0 && err.constructor) {
message += err.constructor.name;
} else {
message += err.message;
}
} else {
message += inspect(err);
}
var newErr = new AssertionError({
actual: err,
expected: null,
operator: 'ifError',
message: message,
stackStartFn: ifError
});
// Make sure we actually have a stack trace!
var origStack = err.stack;
if (typeof origStack === 'string') {
// This will remove any duplicated frames from the error frames taken
// from within `ifError` and add the original error frames to the newly
// created ones.
var tmp2 = origStack.split('\n');
tmp2.shift();
// Filter all frames existing in err.stack.
var tmp1 = newErr.stack.split('\n');
for (var i = 0; i < tmp2.length; i++) {
// Find the first occurrence of the frame.
var pos = tmp1.indexOf(tmp2[i]);
if (pos !== -1) {
// Only keep new frames.
tmp1 = tmp1.slice(0, pos);
break;
}
}
newErr.stack = "".concat(tmp1.join('\n'), "\n").concat(tmp2.join('\n'));
}
throw newErr;
}
};
// Currently in sync with Node.js lib/assert.js
// https://github.com/nodejs/node/commit/2a871df3dfb8ea663ef5e1f8f62701ec51384ecb
function internalMatch(string, regexp, message, fn, fnName) {
if (!isRegExp(regexp)) {
throw new ERR_INVALID_ARG_TYPE('regexp', 'RegExp', regexp);
}
var match = fnName === 'match';
if (typeof string !== 'string' || RegExpPrototypeTest(regexp, string) !== match) {
if (message instanceof Error) {
throw message;
}
var generatedMessage = !message;
// 'The input was expected to not match the regular expression ' +
message = message || (typeof string !== 'string' ? 'The "string" argument must be of type string. Received type ' + "".concat(_typeof(string), " (").concat(inspect(string), ")") : (match ? 'The input did not match the regular expression ' : 'The input was expected to not match the regular expression ') + "".concat(inspect(regexp), ". Input:\n\n").concat(inspect(string), "\n"));
var err = new AssertionError({
actual: string,
expected: regexp,
message: message,
operator: fnName,
stackStartFn: fn
});
err.generatedMessage = generatedMessage;
throw err;
}
}
assert.match = function match(string, regexp, message) {
internalMatch(string, regexp, message, match, 'match');
};
assert.doesNotMatch = function doesNotMatch(string, regexp, message) {
internalMatch(string, regexp, message, doesNotMatch, 'doesNotMatch');
};
// Expose a strict only variant of assert
function strict() {
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
args[_key6] = arguments[_key6];
}
innerOk.apply(void 0, [strict, args.length].concat(args));
}
assert.strict = objectAssign(strict, assert, {
equal: assert.strictEqual,
deepEqual: assert.deepStrictEqual,
notEqual: assert.notStrictEqual,
notDeepEqual: assert.notDeepStrictEqual
});
assert.strict.strict = assert.strict;
/***/ }),
/***/ "./node_modules/assert/build/internal/assert/assertion_error.js":
/*!**********************************************************************!*\
!*** ./node_modules/assert/build/internal/assert/assertion_error.js ***!
\**********************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
/* provided dependency */ var process = __webpack_require__(/*! process/browser.js */ "./node_modules/process/browser.js");
// Currently in sync with Node.js lib/internal/assert/assertion_error.js
// https://github.com/nodejs/node/commit/0817840f775032169ddd70c85ac059f18ffcc81c
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
var _require = __webpack_require__(/*! util/ */ "./node_modules/util/util.js"),
inspect = _require.inspect;
var _require2 = __webpack_require__(/*! ../errors */ "./node_modules/assert/build/internal/errors.js"),
ERR_INVALID_ARG_TYPE = _require2.codes.ERR_INVALID_ARG_TYPE;
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
function endsWith(str, search, this_len) {
if (this_len === undefined || this_len > str.length) {
this_len = str.length;
}
return str.substring(this_len - search.length, this_len) === search;
}
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/repeat
function repeat(str, count) {
count = Math.floor(count);
if (str.length == 0 || count == 0) return '';
var maxCount = str.length * count;
count = Math.floor(Math.log(count) / Math.log(2));
while (count) {
str += str;
count--;
}
str += str.substring(0, maxCount - str.length);
return str;
}
var blue = '';
var green = '';
var red = '';
var white = '';
var kReadableOperator = {
deepStrictEqual: 'Expected values to be strictly deep-equal:',
strictEqual: 'Expected values to be strictly equal:',
strictEqualObject: 'Expected "actual" to be reference-equal to "expected":',
deepEqual: 'Expected values to be loosely deep-equal:',
equal: 'Expected values to be loosely equal:',
notDeepStrictEqual: 'Expected "actual" not to be strictly deep-equal to:',
notStrictEqual: 'Expected "actual" to be strictly unequal to:',
notStrictEqualObject: 'Expected "actual" not to be reference-equal to "expected":',
notDeepEqual: 'Expected "actual" not to be loosely deep-equal to:',
notEqual: 'Expected "actual" to be loosely unequal to:',
notIdentical: 'Values identical but not reference-equal:'
};
// Comparing short primitives should just show === / !== instead of using the
// diff.
var kMaxShortLength = 10;
function copyError(source) {
var keys = Object.keys(source);
var target = Object.create(Object.getPrototypeOf(source));
keys.forEach(function (key) {
target[key] = source[key];
});
Object.defineProperty(target, 'message', {
value: source.message
});
return target;
}
function inspectValue(val) {
// The util.inspect default values could be changed. This makes sure the
// error messages contain the necessary information nevertheless.
return inspect(val, {
compact: false,
customInspect: false,
depth: 1000,
maxArrayLength: Infinity,
// Assert compares only enumerable properties (with a few exceptions).
showHidden: false,
// Having a long line as error is better than wrapping the line for
// comparison for now.
// TODO(BridgeAR): `breakLength` should be limited as soon as soon as we
// have meta information about the inspected properties (i.e., know where
// in what line the property starts and ends).
breakLength: Infinity,
// Assert does not detect proxies currently.
showProxy: false,
sorted: true,
// Inspect getters as we also check them when comparing entries.
getters: true
});
}
function createErrDiff(actual, expected, operator) {
var other = '';
var res = '';
var lastPos = 0;
var end = '';
var skipped = false;
var actualInspected = inspectValue(actual);
var actualLines = actualInspected.split('\n');
var expectedLines = inspectValue(expected).split('\n');
var i = 0;
var indicator = '';
// In case both values are objects explicitly mark them as not reference equal
// for the `strictEqual` operator.
if (operator === 'strictEqual' && _typeof(actual) === 'object' && _typeof(expected) === 'object' && actual !== null && expected !== null) {
operator = 'strictEqualObject';
}
// If "actual" and "expected" fit on a single line and they are not strictly
// equal, check further special handling.
if (actualLines.length === 1 && expectedLines.length === 1 && actualLines[0] !== expectedLines[0]) {
var inputLength = actualLines[0].length + expectedLines[0].length;
// If the character length of "actual" and "expected" together is less than
// kMaxShortLength and if neither is an object and at least one of them is
// not `zero`, use the strict equal comparison to visualize the output.
if (inputLength <= kMaxShortLength) {
if ((_typeof(actual) !== 'object' || actual === null) && (_typeof(expected) !== 'object' || expected === null) && (actual !== 0 || expected !== 0)) {
// -0 === +0
return "".concat(kReadableOperator[operator], "\n\n") + "".concat(actualLines[0], " !== ").concat(expectedLines[0], "\n");
}
} else if (operator !== 'strictEqualObject') {
// If the stderr is a tty and the input length is lower than the current
// columns per line, add a mismatch indicator below the output. If it is
// not a tty, use a default value of 80 characters.
var maxLength = process.stderr && process.stderr.isTTY ? process.stderr.columns : 80;
if (inputLength < maxLength) {
while (actualLines[0][i] === expectedLines[0][i]) {
i++;
}
// Ignore the first characters.
if (i > 2) {
// Add position indicator for the first mismatch in case it is a
// single line and the input length is less than the column length.
indicator = "\n ".concat(repeat(' ', i), "^");
i = 0;
}
}
}
}
// Remove all ending lines that match (this optimizes the output for
// readability by reducing the number of total changed lines).
var a = actualLines[actualLines.length - 1];
var b = expectedLines[expectedLines.length - 1];
while (a === b) {
if (i++ < 2) {
end = "\n ".concat(a).concat(end);
} else {
other = a;
}
actualLines.pop();
expectedLines.pop();
if (actualLines.length === 0 || expectedLines.length === 0) break;
a = actualLines[actualLines.length - 1];
b = expectedLines[expectedLines.length - 1];
}
var maxLines = Math.max(actualLines.length, expectedLines.length);
// Strict equal with identical objects that are not identical by reference.
// E.g., assert.deepStrictEqual({ a: Symbol() }, { a: Symbol() })
if (maxLines === 0) {
// We have to get the result again. The lines were all removed before.
var _actualLines = actualInspected.split('\n');
// Only remove lines in case it makes sense to collapse those.
// TODO: Accept env to always show the full error.
if (_actualLines.length > 30) {
_actualLines[26] = "".concat(blue, "...").concat(white);
while (_actualLines.length > 27) {
_actualLines.pop();
}
}
return "".concat(kReadableOperator.notIdentical, "\n\n").concat(_actualLines.join('\n'), "\n");
}
if (i > 3) {
end = "\n".concat(blue, "...").concat(white).concat(end);
skipped = true;
}
if (other !== '') {
end = "\n ".concat(other).concat(end);
other = '';
}
var printedLines = 0;
var msg = kReadableOperator[operator] + "\n".concat(green, "+ actual").concat(white, " ").concat(red, "- expected").concat(white);
var skippedMsg = " ".concat(blue, "...").concat(white, " Lines skipped");
for (i = 0; i < maxLines; i++) {
// Only extra expected lines exist
var cur = i - lastPos;
if (actualLines.length < i + 1) {
// If the last diverging line is more than one line above and the
// current line is at least line three, add some of the former lines and
// also add dots to indicate skipped entries.
if (cur > 1 && i > 2) {
if (cur > 4) {
res += "\n".concat(blue, "...").concat(white);
skipped = true;
} else if (cur > 3) {
res += "\n ".concat(expectedLines[i - 2]);
printedLines++;
}
res += "\n ".concat(expectedLines[i - 1]);
printedLines++;
}
// Mark the current line as the last diverging one.
lastPos = i;
// Add the expected line to the cache.
other += "\n".concat(red, "-").concat(white, " ").concat(expectedLines[i]);
printedLines++;
// Only extra actual lines exist
} else if (expectedLines.length < i + 1) {
// If the last diverging line is more than one line above and the
// current line is at least line three, add some of the former lines and
// also add dots to indicate skipped entries.
if (cur > 1 && i > 2) {
if (cur > 4) {
res += "\n".concat(blue, "...").concat(white);
skipped = true;
} else if (cur > 3) {
res += "\n ".concat(actualLines[i - 2]);
printedLines++;
}
res += "\n ".concat(actualLines[i - 1]);
printedLines++;
}
// Mark the current line as the last diverging one.
lastPos = i;
// Add the actual line to the result.
res += "\n".concat(green, "+").concat(white, " ").concat(actualLines[i]);
printedLines++;
// Lines diverge
} else {
var expectedLine = expectedLines[i];
var actualLine = actualLines[i];
// If the lines diverge, specifically check for lines that only diverge by
// a trailing comma. In that case it is actually identical and we should
// mark it as such.
var divergingLines = actualLine !== expectedLine && (!endsWith(actualLine, ',') || actualLine.slice(0, -1) !== expectedLine);
// If the expected line has a trailing comma but is otherwise identical,
// add a comma at the end of the actual line. Otherwise the output could
// look weird as in:
//
// [
// 1 // No comma at the end!
// + 2
// ]
//
if (divergingLines && endsWith(expectedLine, ',') && expectedLine.slice(0, -1) === actualLine) {
divergingLines = false;
actualLine += ',';
}
if (divergingLines) {
// If the last diverging line is more than one line above and the
// current line is at least line three, add some of the former lines and
// also add dots to indicate skipped entries.
if (cur > 1 && i > 2) {
if (cur > 4) {
res += "\n".concat(blue, "...").concat(white);
skipped = true;
} else if (cur > 3) {
res += "\n ".concat(actualLines[i - 2]);
printedLines++;
}
res += "\n ".concat(actualLines[i - 1]);
printedLines++;
}
// Mark the current line as the last diverging one.
lastPos = i;
// Add the actual line to the result and cache the expected diverging
// line so consecutive diverging lines show up as +++--- and not +-+-+-.
res += "\n".concat(green, "+").concat(white, " ").concat(actualLine);
other += "\n".concat(red, "-").concat(white, " ").concat(expectedLine);
printedLines += 2;
// Lines are identical
} else {
// Add all cached information to the result before adding other things
// and reset the cache.
res += other;
other = '';
// If the last diverging line is exactly one line above or if it is the
// very first line, add the line to the result.
if (cur === 1 || i === 0) {
res += "\n ".concat(actualLine);
printedLines++;
}
}
}
// Inspected object to big (Show ~20 rows max)
if (printedLines > 20 && i < maxLines - 2) {
return "".concat(msg).concat(skippedMsg, "\n").concat(res, "\n").concat(blue, "...").concat(white).concat(other, "\n") + "".concat(blue, "...").concat(white);
}
}
return "".concat(msg).concat(skipped ? skippedMsg : '', "\n").concat(res).concat(other).concat(end).concat(indicator);
}
var AssertionError = /*#__PURE__*/function (_Error, _inspect$custom) {
_inherits(AssertionError, _Error);
var _super = _createSuper(AssertionError);
function AssertionError(options) {
var _this;
_classCallCheck(this, AssertionError);
if (_typeof(options) !== 'object' || options === null) {
throw new ERR_INVALID_ARG_TYPE('options', 'Object', options);
}
var message = options.message,
operator = options.operator,
stackStartFn = options.stackStartFn;
var actual = options.actual,
expected = options.expected;
var limit = Error.stackTraceLimit;
Error.stackTraceLimit = 0;
if (message != null) {
_this = _super.call(this, String(message));
} else {
if (process.stderr && process.stderr.isTTY) {
// Reset on each call to make sure we handle dynamically set environment
// variables correct.
if (process.stderr && process.stderr.getColorDepth && process.stderr.getColorDepth() !== 1) {
blue = "\x1B[34m";
green = "\x1B[32m";
white = "\x1B[39m";
red = "\x1B[31m";
} else {
blue = '';
green = '';
white = '';
red = '';
}
}
// Prevent the error stack from being visible by duplicating the error
// in a very close way to the original in case both sides are actually
// instances of Error.
if (_typeof(actual) === 'object' && actual !== null && _typeof(expected) === 'object' && expected !== null && 'stack' in actual && actual instanceof Error && 'stack' in expected && expected instanceof Error) {
actual = copyError(actual);
expected = copyError(expected);
}
if (operator === 'deepStrictEqual' || operator === 'strictEqual') {
_this = _super.call(this, createErrDiff(actual, expected, operator));
} else if (operator === 'notDeepStrictEqual' || operator === 'notStrictEqual') {
// In case the objects are equal but the operator requires unequal, show
// the first object and say A equals B
var base = kReadableOperator[operator];
var res = inspectValue(actual).split('\n');
// In case "actual" is an object, it should not be reference equal.
if (operator === 'notStrictEqual' && _typeof(actual) === 'object' && actual !== null) {
base = kReadableOperator.notStrictEqualObject;
}
// Only remove lines in case it makes sense to collapse those.
// TODO: Accept env to always show the full error.
if (res.length > 30) {
res[26] = "".concat(blue, "...").concat(white);
while (res.length > 27) {
res.pop();
}
}
// Only print a single input.
if (res.length === 1) {
_this = _super.call(this, "".concat(base, " ").concat(res[0]));
} else {
_this = _super.call(this, "".concat(base, "\n\n").concat(res.join('\n'), "\n"));
}
} else {
var _res = inspectValue(actual);
var other = '';
var knownOperators = kReadableOperator[operator];
if (operator === 'notDeepEqual' || operator === 'notEqual') {
_res = "".concat(kReadableOperator[operator], "\n\n").concat(_res);
if (_res.length > 1024) {
_res = "".concat(_res.slice(0, 1021), "...");
}
} else {
other = "".concat(inspectValue(expected));
if (_res.length > 512) {
_res = "".concat(_res.slice(0, 509), "...");
}
if (other.length > 512) {
other = "".concat(other.slice(0, 509), "...");
}
if (operator === 'deepEqual' || operator === 'equal') {
_res = "".concat(knownOperators, "\n\n").concat(_res, "\n\nshould equal\n\n");
} else {
other = " ".concat(operator, " ").concat(other);
}
}
_this = _super.call(this, "".concat(_res).concat(other));
}
}
Error.stackTraceLimit = limit;
_this.generatedMessage = !message;
Object.defineProperty(_assertThisInitialized(_this), 'name', {
value: 'AssertionError [ERR_ASSERTION]',
enumerable: false,
writable: true,
configurable: true
});
_this.code = 'ERR_ASSERTION';
_this.actual = actual;
_this.expected = expected;
_this.operator = operator;
if (Error.captureStackTrace) {
// eslint-disable-next-line no-restricted-syntax
Error.captureStackTrace(_assertThisInitialized(_this), stackStartFn);
}
// Create error message including the error code in the name.
_this.stack;
// Reset the name.
_this.name = 'AssertionError';
return _possibleConstructorReturn(_this);
}
_createClass(AssertionError, [{
key: "toString",
value: function toString() {
return "".concat(this.name, " [").concat(this.code, "]: ").concat(this.message);
}
}, {
key: _inspect$custom,
value: function value(recurseTimes, ctx) {
// This limits the `actual` and `expected` property default inspection to
// the minimum depth. Otherwise those values would be too verbose compared
// to the actual error message which contains a combined view of these two
// input values.
return inspect(this, _objectSpread(_objectSpread({}, ctx), {}, {
customInspect: false,
depth: 0
}));
}
}]);
return AssertionError;
}( /*#__PURE__*/_wrapNativeSuper(Error), inspect.custom);
module.exports = AssertionError;
/***/ }),
/***/ "./node_modules/assert/build/internal/errors.js":
/*!******************************************************!*\
!*** ./node_modules/assert/build/internal/errors.js ***!
\******************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
// Currently in sync with Node.js lib/internal/errors.js
// https://github.com/nodejs/node/commit/3b044962c48fe313905877a96b5d0894a5404f6f
/* eslint node-core/documented-errors: "error" */
/* eslint node-core/alphabetize-errors: "error" */
/* eslint node-core/prefer-util-format-errors: "error" */
// The whole point behind this internal module is to allow Node.js to no
// longer be forced to treat every error message change as a semver-major
// change. The NodeError classes here all expose a `code` property whose
// value statically and permanently identifies the error. While the error
// message may change, the code should not.
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
var codes = {};
// Lazy loaded
var assert;
var util;
function createErrorType(code, message, Base) {
if (!Base) {
Base = Error;
}
function getMessage(arg1, arg2, arg3) {
if (typeof message === 'string') {
return message;
} else {
return message(arg1, arg2, arg3);
}
}
var NodeError = /*#__PURE__*/function (_Base) {
_inherits(NodeError, _Base);
var _super = _createSuper(NodeError);
function NodeError(arg1, arg2, arg3) {
var _this;
_classCallCheck(this, NodeError);
_this = _super.call(this, getMessage(arg1, arg2, arg3));
_this.code = code;
return _this;
}
return _createClass(NodeError);
}(Base);
codes[code] = NodeError;
}
// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js
function oneOf(expected, thing) {
if (Array.isArray(expected)) {
var len = expected.length;
expected = expected.map(function (i) {
return String(i);
});
if (len > 2) {
return "one of ".concat(thing, " ").concat(expected.slice(0, len - 1).join(', '), ", or ") + expected[len - 1];
} else if (len === 2) {
return "one of ".concat(thing, " ").concat(expected[0], " or ").concat(expected[1]);
} else {
return "of ".concat(thing, " ").concat(expected[0]);
}
} else {
return "of ".concat(thing, " ").concat(String(expected));
}
}
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith
function startsWith(str, search, pos) {
return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search;
}
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith
function endsWith(str, search, this_len) {
if (this_len === undefined || this_len > str.length) {
this_len = str.length;
}
return str.substring(this_len - search.length, this_len) === search;
}
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes
function includes(str, search, start) {
if (typeof start !== 'number') {
start = 0;
}
if (start + search.length > str.length) {
return false;
} else {
return str.indexOf(search, start) !== -1;
}
}
createErrorType('ERR_AMBIGUOUS_ARGUMENT', 'The "%s" argument is ambiguous. %s', TypeError);
createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) {
if (assert === undefined) assert = __webpack_require__(/*! ../assert */ "./node_modules/assert/build/assert.js");
assert(typeof name === 'string', "'name' must be a string");
// determiner: 'must be' or 'must not be'
var determiner;
if (typeof expected === 'string' && startsWith(expected, 'not ')) {
determiner = 'must not be';
expected = expected.replace(/^not /, '');
} else {
determiner = 'must be';
}
var msg;
if (endsWith(name, ' argument')) {
// For cases like 'first argument'
msg = "The ".concat(name, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
} else {
var type = includes(name, '.') ? 'property' : 'argument';
msg = "The \"".concat(name, "\" ").concat(type, " ").concat(determiner, " ").concat(oneOf(expected, 'type'));
}
// TODO(BridgeAR): Improve the output by showing `null` and similar.
msg += ". Received type ".concat(_typeof(actual));
return msg;
}, TypeError);
createErrorType('ERR_INVALID_ARG_VALUE', function (name, value) {
var reason = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'is invalid';
if (util === undefined) util = __webpack_require__(/*! util/ */ "./node_modules/util/util.js");
var inspected = util.inspect(value);
if (inspected.length > 128) {
inspected = "".concat(inspected.slice(0, 128), "...");
}
return "The argument '".concat(name, "' ").concat(reason, ". Received ").concat(inspected);
}, TypeError, RangeError);
createErrorType('ERR_INVALID_RETURN_VALUE', function (input, name, value) {
var type;
if (value && value.constructor && value.constructor.name) {
type = "instance of ".concat(value.constructor.name);
} else {
type = "type ".concat(_typeof(value));
}
return "Expected ".concat(input, " to be returned from the \"").concat(name, "\"") + " function but got ".concat(type, ".");
}, TypeError);
createErrorType('ERR_MISSING_ARGS', function () {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
if (assert === undefined) assert = __webpack_require__(/*! ../assert */ "./node_modules/assert/build/assert.js");
assert(args.length > 0, 'At least one arg needs to be specified');
var msg = 'The ';
var len = args.length;
args = args.map(function (a) {
return "\"".concat(a, "\"");
});
switch (len) {
case 1:
msg += "".concat(args[0], " argument");
break;
case 2:
msg += "".concat(args[0], " and ").concat(args[1], " arguments");
break;
default:
msg += args.slice(0, len - 1).join(', ');
msg += ", and ".concat(args[len - 1], " arguments");
break;
}
return "".concat(msg, " must be specified");
}, TypeError);
module.exports.codes = codes;
/***/ }),
/***/ "./node_modules/assert/build/internal/util/comparisons.js":
/*!****************************************************************!*\
!*** ./node_modules/assert/build/internal/util/comparisons.js ***!
\****************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
// Currently in sync with Node.js lib/internal/util/comparisons.js
// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
var regexFlagsSupported = /a/g.flags !== undefined;
var arrayFromSet = function arrayFromSet(set) {
var array = [];
set.forEach(function (value) {
return array.push(value);
});
return array;
};
var arrayFromMap = function arrayFromMap(map) {
var array = [];
map.forEach(function (value, key) {
return array.push([key, value]);
});
return array;
};
var objectIs = Object.is ? Object.is : __webpack_require__(/*! object-is */ "./node_modules/object-is/index.js");
var objectGetOwnPropertySymbols = Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols : function () {
return [];
};
var numberIsNaN = Number.isNaN ? Number.isNaN : __webpack_require__(/*! is-nan */ "./node_modules/is-nan/index.js");
function uncurryThis(f) {
return f.call.bind(f);
}
var hasOwnProperty = uncurryThis(Object.prototype.hasOwnProperty);
var propertyIsEnumerable = uncurryThis(Object.prototype.propertyIsEnumerable);
var objectToString = uncurryThis(Object.prototype.toString);
var _require$types = (__webpack_require__(/*! util/ */ "./node_modules/util/util.js").types),
isAnyArrayBuffer = _require$types.isAnyArrayBuffer,
isArrayBufferView = _require$types.isArrayBufferView,
isDate = _require$types.isDate,
isMap = _require$types.isMap,
isRegExp = _require$types.isRegExp,
isSet = _require$types.isSet,
isNativeError = _require$types.isNativeError,
isBoxedPrimitive = _require$types.isBoxedPrimitive,
isNumberObject = _require$types.isNumberObject,
isStringObject = _require$types.isStringObject,
isBooleanObject = _require$types.isBooleanObject,
isBigIntObject = _require$types.isBigIntObject,
isSymbolObject = _require$types.isSymbolObject,
isFloat32Array = _require$types.isFloat32Array,
isFloat64Array = _require$types.isFloat64Array;
function isNonIndex(key) {
if (key.length === 0 || key.length > 10) return true;
for (var i = 0; i < key.length; i++) {
var code = key.charCodeAt(i);
if (code < 48 || code > 57) return true;
}
// The maximum size for an array is 2 ** 32 -1.
return key.length === 10 && key >= Math.pow(2, 32);
}
function getOwnNonIndexProperties(value) {
return Object.keys(value).filter(isNonIndex).concat(objectGetOwnPropertySymbols(value).filter(Object.prototype.propertyIsEnumerable.bind(value)));
}
// Taken from https://github.com/feross/buffer/blob/680e9e5e488f22aac27599a57dc844a6315928dd/index.js
// original notice:
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <[email protected]> <http://feross.org>
* @license MIT
*/
function compare(a, b) {
if (a === b) {
return 0;
}
var x = a.length;
var y = b.length;
for (var i = 0, len = Math.min(x, y); i < len; ++i) {
if (a[i] !== b[i]) {
x = a[i];
y = b[i];
break;
}
}
if (x < y) {
return -1;
}
if (y < x) {
return 1;
}
return 0;
}
var ONLY_ENUMERABLE = undefined;
var kStrict = true;
var kLoose = false;
var kNoIterator = 0;
var kIsArray = 1;
var kIsSet = 2;
var kIsMap = 3;
// Check if they have the same source and flags
function areSimilarRegExps(a, b) {
return regexFlagsSupported ? a.source === b.source && a.flags === b.flags : RegExp.prototype.toString.call(a) === RegExp.prototype.toString.call(b);
}
function areSimilarFloatArrays(a, b) {
if (a.byteLength !== b.byteLength) {
return false;
}
for (var offset = 0; offset < a.byteLength; offset++) {
if (a[offset] !== b[offset]) {
return false;
}
}
return true;
}
function areSimilarTypedArrays(a, b) {
if (a.byteLength !== b.byteLength) {
return false;
}
return compare(new Uint8Array(a.buffer, a.byteOffset, a.byteLength), new Uint8Array(b.buffer, b.byteOffset, b.byteLength)) === 0;
}
function areEqualArrayBuffers(buf1, buf2) {
return buf1.byteLength === buf2.byteLength && compare(new Uint8Array(buf1), new Uint8Array(buf2)) === 0;
}
function isEqualBoxedPrimitive(val1, val2) {
if (isNumberObject(val1)) {
return isNumberObject(val2) && objectIs(Number.prototype.valueOf.call(val1), Number.prototype.valueOf.call(val2));
}
if (isStringObject(val1)) {
return isStringObject(val2) && String.prototype.valueOf.call(val1) === String.prototype.valueOf.call(val2);
}
if (isBooleanObject(val1)) {
return isBooleanObject(val2) && Boolean.prototype.valueOf.call(val1) === Boolean.prototype.valueOf.call(val2);
}
if (isBigIntObject(val1)) {
return isBigIntObject(val2) && BigInt.prototype.valueOf.call(val1) === BigInt.prototype.valueOf.call(val2);
}
return isSymbolObject(val2) && Symbol.prototype.valueOf.call(val1) === Symbol.prototype.valueOf.call(val2);
}
// Notes: Type tags are historical [[Class]] properties that can be set by
// FunctionTemplate::SetClassName() in C++ or Symbol.toStringTag in JS
// and retrieved using Object.prototype.toString.call(obj) in JS
// See https://tc39.github.io/ecma262/#sec-object.prototype.tostring
// for a list of tags pre-defined in the spec.
// There are some unspecified tags in the wild too (e.g. typed array tags).
// Since tags can be altered, they only serve fast failures
//
// Typed arrays and buffers are checked by comparing the content in their
// underlying ArrayBuffer. This optimization requires that it's
// reasonable to interpret their underlying memory in the same way,
// which is checked by comparing their type tags.
// (e.g. a Uint8Array and a Uint16Array with the same memory content
// could still be different because they will be interpreted differently).
//
// For strict comparison, objects should have
// a) The same built-in type tags
// b) The same prototypes.
function innerDeepEqual(val1, val2, strict, memos) {
// All identical values are equivalent, as determined by ===.
if (val1 === val2) {
if (val1 !== 0) return true;
return strict ? objectIs(val1, val2) : true;
}
// Check more closely if val1 and val2 are equal.
if (strict) {
if (_typeof(val1) !== 'object') {
return typeof val1 === 'number' && numberIsNaN(val1) && numberIsNaN(val2);
}
if (_typeof(val2) !== 'object' || val1 === null || val2 === null) {
return false;
}
if (Object.getPrototypeOf(val1) !== Object.getPrototypeOf(val2)) {
return false;
}
} else {
if (val1 === null || _typeof(val1) !== 'object') {
if (val2 === null || _typeof(val2) !== 'object') {
// eslint-disable-next-line eqeqeq
return val1 == val2;
}
return false;
}
if (val2 === null || _typeof(val2) !== 'object') {
return false;
}
}
var val1Tag = objectToString(val1);
var val2Tag = objectToString(val2);
if (val1Tag !== val2Tag) {
return false;
}
if (Array.isArray(val1)) {
// Check for sparse arrays and general fast path
if (val1.length !== val2.length) {
return false;
}
var keys1 = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE);
var keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE);
if (keys1.length !== keys2.length) {
return false;
}
return keyCheck(val1, val2, strict, memos, kIsArray, keys1);
}
// [browserify] This triggers on certain types in IE (Map/Set) so we don't
// wan't to early return out of the rest of the checks. However we can check
// if the second value is one of these values and the first isn't.
if (val1Tag === '[object Object]') {
// return keyCheck(val1, val2, strict, memos, kNoIterator);
if (!isMap(val1) && isMap(val2) || !isSet(val1) && isSet(val2)) {
return false;
}
}
if (isDate(val1)) {
if (!isDate(val2) || Date.prototype.getTime.call(val1) !== Date.prototype.getTime.call(val2)) {
return false;
}
} else if (isRegExp(val1)) {
if (!isRegExp(val2) || !areSimilarRegExps(val1, val2)) {
return false;
}
} else if (isNativeError(val1) || val1 instanceof Error) {
// Do not compare the stack as it might differ even though the error itself
// is otherwise identical.
if (val1.message !== val2.message || val1.name !== val2.name) {
return false;
}
} else if (isArrayBufferView(val1)) {
if (!strict && (isFloat32Array(val1) || isFloat64Array(val1))) {
if (!areSimilarFloatArrays(val1, val2)) {
return false;
}
} else if (!areSimilarTypedArrays(val1, val2)) {
return false;
}
// Buffer.compare returns true, so val1.length === val2.length. If they both
// only contain numeric keys, we don't need to exam further than checking
// the symbols.
var _keys = getOwnNonIndexProperties(val1, ONLY_ENUMERABLE);
var _keys2 = getOwnNonIndexProperties(val2, ONLY_ENUMERABLE);
if (_keys.length !== _keys2.length) {
return false;
}
return keyCheck(val1, val2, strict, memos, kNoIterator, _keys);
} else if (isSet(val1)) {
if (!isSet(val2) || val1.size !== val2.size) {
return false;
}
return keyCheck(val1, val2, strict, memos, kIsSet);
} else if (isMap(val1)) {
if (!isMap(val2) || val1.size !== val2.size) {
return false;
}
return keyCheck(val1, val2, strict, memos, kIsMap);
} else if (isAnyArrayBuffer(val1)) {
if (!areEqualArrayBuffers(val1, val2)) {
return false;
}
} else if (isBoxedPrimitive(val1) && !isEqualBoxedPrimitive(val1, val2)) {
return false;
}
return keyCheck(val1, val2, strict, memos, kNoIterator);
}
function getEnumerables(val, keys) {
return keys.filter(function (k) {
return propertyIsEnumerable(val, k);
});
}
function keyCheck(val1, val2, strict, memos, iterationType, aKeys) {
// For all remaining Object pairs, including Array, objects and Maps,
// equivalence is determined by having:
// a) The same number of owned enumerable properties
// b) The same set of keys/indexes (although not necessarily the same order)
// c) Equivalent values for every corresponding key/index
// d) For Sets and Maps, equal contents
// Note: this accounts for both named and indexed properties on Arrays.
if (arguments.length === 5) {
aKeys = Object.keys(val1);
var bKeys = Object.keys(val2);
// The pair must have the same number of owned properties.
if (aKeys.length !== bKeys.length) {
return false;
}
}
// Cheap key test
var i = 0;
for (; i < aKeys.length; i++) {
if (!hasOwnProperty(val2, aKeys[i])) {
return false;
}
}
if (strict && arguments.length === 5) {
var symbolKeysA = objectGetOwnPropertySymbols(val1);
if (symbolKeysA.length !== 0) {
var count = 0;
for (i = 0; i < symbolKeysA.length; i++) {
var key = symbolKeysA[i];
if (propertyIsEnumerable(val1, key)) {
if (!propertyIsEnumerable(val2, key)) {
return false;
}
aKeys.push(key);
count++;
} else if (propertyIsEnumerable(val2, key)) {
return false;
}
}
var symbolKeysB = objectGetOwnPropertySymbols(val2);
if (symbolKeysA.length !== symbolKeysB.length && getEnumerables(val2, symbolKeysB).length !== count) {
return false;
}
} else {
var _symbolKeysB = objectGetOwnPropertySymbols(val2);
if (_symbolKeysB.length !== 0 && getEnumerables(val2, _symbolKeysB).length !== 0) {
return false;
}
}
}
if (aKeys.length === 0 && (iterationType === kNoIterator || iterationType === kIsArray && val1.length === 0 || val1.size === 0)) {
return true;
}
// Use memos to handle cycles.
if (memos === undefined) {
memos = {
val1: new Map(),
val2: new Map(),
position: 0
};
} else {
// We prevent up to two map.has(x) calls by directly retrieving the value
// and checking for undefined. The map can only contain numbers, so it is
// safe to check for undefined only.
var val2MemoA = memos.val1.get(val1);
if (val2MemoA !== undefined) {
var val2MemoB = memos.val2.get(val2);
if (val2MemoB !== undefined) {
return val2MemoA === val2MemoB;
}
}
memos.position++;
}
memos.val1.set(val1, memos.position);
memos.val2.set(val2, memos.position);
var areEq = objEquiv(val1, val2, strict, aKeys, memos, iterationType);
memos.val1.delete(val1);
memos.val2.delete(val2);
return areEq;
}
function setHasEqualElement(set, val1, strict, memo) {
// Go looking.
var setValues = arrayFromSet(set);
for (var i = 0; i < setValues.length; i++) {
var val2 = setValues[i];
if (innerDeepEqual(val1, val2, strict, memo)) {
// Remove the matching element to make sure we do not check that again.
set.delete(val2);
return true;
}
}
return false;
}
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Equality_comparisons_and_sameness#Loose_equality_using
// Sadly it is not possible to detect corresponding values properly in case the
// type is a string, number, bigint or boolean. The reason is that those values
// can match lots of different string values (e.g., 1n == '+00001').
function findLooseMatchingPrimitives(prim) {
switch (_typeof(prim)) {
case 'undefined':
return null;
case 'object':
// Only pass in null as object!
return undefined;
case 'symbol':
return false;
case 'string':
prim = +prim;
// Loose equal entries exist only if the string is possible to convert to
// a regular number and not NaN.
// Fall through
case 'number':
if (numberIsNaN(prim)) {
return false;
}
}
return true;
}
function setMightHaveLoosePrim(a, b, prim) {
var altValue = findLooseMatchingPrimitives(prim);
if (altValue != null) return altValue;
return b.has(altValue) && !a.has(altValue);
}
function mapMightHaveLoosePrim(a, b, prim, item, memo) {
var altValue = findLooseMatchingPrimitives(prim);
if (altValue != null) {
return altValue;
}
var curB = b.get(altValue);
if (curB === undefined && !b.has(altValue) || !innerDeepEqual(item, curB, false, memo)) {
return false;
}
return !a.has(altValue) && innerDeepEqual(item, curB, false, memo);
}
function setEquiv(a, b, strict, memo) {
// This is a lazily initiated Set of entries which have to be compared
// pairwise.
var set = null;
var aValues = arrayFromSet(a);
for (var i = 0; i < aValues.length; i++) {
var val = aValues[i];
// Note: Checking for the objects first improves the performance for object
// heavy sets but it is a minor slow down for primitives. As they are fast
// to check this improves the worst case scenario instead.
if (_typeof(val) === 'object' && val !== null) {
if (set === null) {
set = new Set();
}
// If the specified value doesn't exist in the second set its an not null
// object (or non strict only: a not matching primitive) we'll need to go
// hunting for something thats deep-(strict-)equal to it. To make this
// O(n log n) complexity we have to copy these values in a new set first.
set.add(val);
} else if (!b.has(val)) {
if (strict) return false;
// Fast path to detect missing string, symbol, undefined and null values.
if (!setMightHaveLoosePrim(a, b, val)) {
return false;
}
if (set === null) {
set = new Set();
}
set.add(val);
}
}
if (set !== null) {
var bValues = arrayFromSet(b);
for (var _i = 0; _i < bValues.length; _i++) {
var _val = bValues[_i];
// We have to check if a primitive value is already
// matching and only if it's not, go hunting for it.
if (_typeof(_val) === 'object' && _val !== null) {
if (!setHasEqualElement(set, _val, strict, memo)) return false;
} else if (!strict && !a.has(_val) && !setHasEqualElement(set, _val, strict, memo)) {
return false;
}
}
return set.size === 0;
}
return true;
}
function mapHasEqualEntry(set, map, key1, item1, strict, memo) {
// To be able to handle cases like:
// Map([[{}, 'a'], [{}, 'b']]) vs Map([[{}, 'b'], [{}, 'a']])
// ... we need to consider *all* matching keys, not just the first we find.
var setValues = arrayFromSet(set);
for (var i = 0; i < setValues.length; i++) {
var key2 = setValues[i];
if (innerDeepEqual(key1, key2, strict, memo) && innerDeepEqual(item1, map.get(key2), strict, memo)) {
set.delete(key2);
return true;
}
}
return false;
}
function mapEquiv(a, b, strict, memo) {
var set = null;
var aEntries = arrayFromMap(a);
for (var i = 0; i < aEntries.length; i++) {
var _aEntries$i = _slicedToArray(aEntries[i], 2),
key = _aEntries$i[0],
item1 = _aEntries$i[1];
if (_typeof(key) === 'object' && key !== null) {
if (set === null) {
set = new Set();
}
set.add(key);
} else {
// By directly retrieving the value we prevent another b.has(key) check in
// almost all possible cases.
var item2 = b.get(key);
if (item2 === undefined && !b.has(key) || !innerDeepEqual(item1, item2, strict, memo)) {
if (strict) return false;
// Fast path to detect missing string, symbol, undefined and null
// keys.
if (!mapMightHaveLoosePrim(a, b, key, item1, memo)) return false;
if (set === null) {
set = new Set();
}
set.add(key);
}
}
}
if (set !== null) {
var bEntries = arrayFromMap(b);
for (var _i2 = 0; _i2 < bEntries.length; _i2++) {
var _bEntries$_i = _slicedToArray(bEntries[_i2], 2),
_key = _bEntries$_i[0],
item = _bEntries$_i[1];
if (_typeof(_key) === 'object' && _key !== null) {
if (!mapHasEqualEntry(set, a, _key, item, strict, memo)) return false;
} else if (!strict && (!a.has(_key) || !innerDeepEqual(a.get(_key), item, false, memo)) && !mapHasEqualEntry(set, a, _key, item, false, memo)) {
return false;
}
}
return set.size === 0;
}
return true;
}
function objEquiv(a, b, strict, keys, memos, iterationType) {
// Sets and maps don't have their entries accessible via normal object
// properties.
var i = 0;
if (iterationType === kIsSet) {
if (!setEquiv(a, b, strict, memos)) {
return false;
}
} else if (iterationType === kIsMap) {
if (!mapEquiv(a, b, strict, memos)) {
return false;
}
} else if (iterationType === kIsArray) {
for (; i < a.length; i++) {
if (hasOwnProperty(a, i)) {
if (!hasOwnProperty(b, i) || !innerDeepEqual(a[i], b[i], strict, memos)) {
return false;
}
} else if (hasOwnProperty(b, i)) {
return false;
} else {
// Array is sparse.
var keysA = Object.keys(a);
for (; i < keysA.length; i++) {
var key = keysA[i];
if (!hasOwnProperty(b, key) || !innerDeepEqual(a[key], b[key], strict, memos)) {
return false;
}
}
if (keysA.length !== Object.keys(b).length) {
return false;
}
return true;
}
}
}
// The pair must have equivalent values for every corresponding key.
// Possibly expensive deep test:
for (i = 0; i < keys.length; i++) {
var _key2 = keys[i];
if (!innerDeepEqual(a[_key2], b[_key2], strict, memos)) {
return false;
}
}
return true;
}
function isDeepEqual(val1, val2) {
return innerDeepEqual(val1, val2, kLoose);
}
function isDeepStrictEqual(val1, val2) {
return innerDeepEqual(val1, val2, kStrict);
}
module.exports = {
isDeepEqual: isDeepEqual,
isDeepStrictEqual: isDeepStrictEqual
};
/***/ }),
/***/ "./node_modules/ast-types/lib/def/babel-core.js":
/*!******************************************************!*\
!*** ./node_modules/ast-types/lib/def/babel-core.js ***!
\******************************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var es_proposals_1 = tslib_1.__importDefault(__webpack_require__(/*! ./es-proposals */ "./node_modules/ast-types/lib/def/es-proposals.js"));
var types_1 = tslib_1.__importDefault(__webpack_require__(/*! ../types */ "./node_modules/ast-types/lib/types.js"));
var shared_1 = tslib_1.__importStar(__webpack_require__(/*! ../shared */ "./node_modules/ast-types/lib/shared.js"));
function default_1(fork) {
var _a, _b, _c, _d, _e;
fork.use(es_proposals_1.default);
var types = fork.use(types_1.default);
var defaults = fork.use(shared_1.default).defaults;
var def = types.Type.def;
var or = types.Type.or;
var isUndefined = types.builtInTypes.undefined;
def("Noop")
.bases("Statement")
.build();
def("DoExpression")
.bases("Expression")
.build("body")
.field("body", [def("Statement")]);
def("BindExpression")
.bases("Expression")
.build("object", "callee")
.field("object", or(def("Expression"), null))
.field("callee", def("Expression"));
def("ParenthesizedExpression")
.bases("Expression")
.build("expression")
.field("expression", def("Expression"));
def("ExportNamespaceSpecifier")
.bases("Specifier")
.build("exported")
.field("exported", def("Identifier"));
def("ExportDefaultSpecifier")
.bases("Specifier")
.build("exported")
.field("exported", def("Identifier"));
def("CommentBlock")
.bases("Comment")
.build("value", /*optional:*/ "leading", "trailing");
def("CommentLine")
.bases("Comment")
.build("value", /*optional:*/ "leading", "trailing");
def("Directive")
.bases("Node")
.build("value")
.field("value", def("DirectiveLiteral"));
def("DirectiveLiteral")
.bases("Node", "Expression")
.build("value")
.field("value", String, defaults["use strict"]);
def("InterpreterDirective")
.bases("Node")
.build("value")
.field("value", String);
def("BlockStatement")
.bases("Statement")
.build("body")
.field("body", [def("Statement")])
.field("directives", [def("Directive")], defaults.emptyArray);
def("Program")
.bases("Node")
.build("body")
.field("body", [def("Statement")])
.field("directives", [def("Directive")], defaults.emptyArray)
.field("interpreter", or(def("InterpreterDirective"), null), defaults["null"]);
function makeLiteralExtra(rawValueType, toRaw) {
if (rawValueType === void 0) { rawValueType = String; }
return [
"extra",
{
rawValue: rawValueType,
raw: String,
},
function getDefault() {
var value = types.getFieldValue(this, "value");
return {
rawValue: value,
raw: toRaw ? toRaw(value) : String(value),
};
},
];
}
// Split Literal
(_a = def("StringLiteral")
.bases("Literal")
.build("value")
.field("value", String))
.field.apply(_a, makeLiteralExtra(String, function (val) { return JSON.stringify(val); }));
(_b = def("NumericLiteral")
.bases("Literal")
.build("value")
.field("value", Number)
.field("raw", or(String, null), defaults["null"]))
.field.apply(_b, makeLiteralExtra(Number));
(_c = def("BigIntLiteral")
.bases("Literal")
.build("value")
// Only String really seems appropriate here, since BigInt values
// often exceed the limits of JS numbers.
.field("value", or(String, Number)))
.field.apply(_c, makeLiteralExtra(String, function (val) { return val + "n"; }));
// https://github.com/tc39/proposal-decimal
// https://github.com/babel/babel/pull/11640
(_d = def("DecimalLiteral")
.bases("Literal")
.build("value")
.field("value", String))
.field.apply(_d, makeLiteralExtra(String, function (val) { return val + "m"; }));
def("NullLiteral")
.bases("Literal")
.build()
.field("value", null, defaults["null"]);
def("BooleanLiteral")
.bases("Literal")
.build("value")
.field("value", Boolean);
(_e = def("RegExpLiteral")
.bases("Literal")
.build("pattern", "flags")
.field("pattern", String)
.field("flags", String)
.field("value", RegExp, function () {
return new RegExp(this.pattern, this.flags);
}))
.field.apply(_e, makeLiteralExtra(or(RegExp, isUndefined), function (exp) { return "/".concat(exp.pattern, "/").concat(exp.flags || ""); })).field("regex", {
pattern: String,
flags: String
}, function () {
return {
pattern: this.pattern,
flags: this.flags,
};
});
var ObjectExpressionProperty = or(def("Property"), def("ObjectMethod"), def("ObjectProperty"), def("SpreadProperty"), def("SpreadElement"));
// Split Property -> ObjectProperty and ObjectMethod
def("ObjectExpression")
.bases("Expression")
.build("properties")
.field("properties", [ObjectExpressionProperty]);
// ObjectMethod hoist .value properties to own properties
def("ObjectMethod")
.bases("Node", "Function")
.build("kind", "key", "params", "body", "computed")
.field("kind", or("method", "get", "set"))
.field("key", or(def("Literal"), def("Identifier"), def("Expression")))
.field("params", [def("Pattern")])
.field("body", def("BlockStatement"))
.field("computed", Boolean, defaults["false"])
.field("generator", Boolean, defaults["false"])
.field("async", Boolean, defaults["false"])
.field("accessibility", // TypeScript
or(def("Literal"), null), defaults["null"])
.field("decorators", or([def("Decorator")], null), defaults["null"]);
def("ObjectProperty")
.bases("Node")
.build("key", "value")
.field("key", or(def("Literal"), def("Identifier"), def("Expression")))
.field("value", or(def("Expression"), def("Pattern")))
.field("accessibility", // TypeScript
or(def("Literal"), null), defaults["null"])
.field("computed", Boolean, defaults["false"]);
var ClassBodyElement = or(def("MethodDefinition"), def("VariableDeclarator"), def("ClassPropertyDefinition"), def("ClassProperty"), def("ClassPrivateProperty"), def("ClassMethod"), def("ClassPrivateMethod"), def("ClassAccessorProperty"), def("StaticBlock"));
// MethodDefinition -> ClassMethod
def("ClassBody")
.bases("Declaration")
.build("body")
.field("body", [ClassBodyElement]);
def("ClassMethod")
.bases("Declaration", "Function")
.build("kind", "key", "params", "body", "computed", "static")
.field("key", or(def("Literal"), def("Identifier"), def("Expression")));
def("ClassPrivateMethod")
.bases("Declaration", "Function")
.build("key", "params", "body", "kind", "computed", "static")
.field("key", def("PrivateName"));
def("ClassAccessorProperty")
.bases("Declaration")
.build("key", "value", "decorators", "computed", "static")
.field("key", or(def("Literal"), def("Identifier"), def("PrivateName"),
// Only when .computed is true (TODO enforce this)
def("Expression")))
.field("value", or(def("Expression"), null), defaults["null"]);
["ClassMethod",
"ClassPrivateMethod",
].forEach(function (typeName) {
def(typeName)
.field("kind", or("get", "set", "method", "constructor"), function () { return "method"; })
.field("body", def("BlockStatement"))
// For backwards compatibility only. Expect accessibility instead (see below).
.field("access", or("public", "private", "protected", null), defaults["null"]);
});
["ClassMethod",
"ClassPrivateMethod",
"ClassAccessorProperty",
].forEach(function (typeName) {
def(typeName)
.field("computed", Boolean, defaults["false"])
.field("static", Boolean, defaults["false"])
.field("abstract", Boolean, defaults["false"])
.field("accessibility", or("public", "private", "protected", null), defaults["null"])
.field("decorators", or([def("Decorator")], null), defaults["null"])
.field("definite", Boolean, defaults["false"])
.field("optional", Boolean, defaults["false"])
.field("override", Boolean, defaults["false"])
.field("readonly", Boolean, defaults["false"]);
});
var ObjectPatternProperty = or(def("Property"), def("PropertyPattern"), def("SpreadPropertyPattern"), def("SpreadProperty"), // Used by Esprima
def("ObjectProperty"), // Babel 6
def("RestProperty"), // Babel 6
def("RestElement"));
// Split into RestProperty and SpreadProperty
def("ObjectPattern")
.bases("Pattern")
.build("properties")
.field("properties", [ObjectPatternProperty])
.field("decorators", or([def("Decorator")], null), defaults["null"]);
def("SpreadProperty")
.bases("Node")
.build("argument")
.field("argument", def("Expression"));
def("RestProperty")
.bases("Node")
.build("argument")
.field("argument", def("Expression"));
def("ForAwaitStatement")
.bases("Statement")
.build("left", "right", "body")
.field("left", or(def("VariableDeclaration"), def("Expression")))
.field("right", def("Expression"))
.field("body", def("Statement"));
// The callee node of a dynamic import(...) expression.
def("Import")
.bases("Expression")
.build();
}
exports["default"] = default_1;
;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=babel-core.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/def/babel.js":
/*!*************************************************!*\
!*** ./node_modules/ast-types/lib/def/babel.js ***!
\*************************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var types_1 = tslib_1.__importDefault(__webpack_require__(/*! ../types */ "./node_modules/ast-types/lib/types.js"));
var babel_core_1 = tslib_1.__importDefault(__webpack_require__(/*! ./babel-core */ "./node_modules/ast-types/lib/def/babel-core.js"));
var flow_1 = tslib_1.__importDefault(__webpack_require__(/*! ./flow */ "./node_modules/ast-types/lib/def/flow.js"));
var shared_1 = __webpack_require__(/*! ../shared */ "./node_modules/ast-types/lib/shared.js");
function default_1(fork) {
var types = fork.use(types_1.default);
var def = types.Type.def;
fork.use(babel_core_1.default);
fork.use(flow_1.default);
// https://github.com/babel/babel/pull/10148
def("V8IntrinsicIdentifier")
.bases("Expression")
.build("name")
.field("name", String);
// https://github.com/babel/babel/pull/13191
// https://github.com/babel/website/pull/2541
def("TopicReference")
.bases("Expression")
.build();
}
exports["default"] = default_1;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=babel.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/def/core.js":
/*!************************************************!*\
!*** ./node_modules/ast-types/lib/def/core.js ***!
\************************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var core_1 = tslib_1.__importDefault(__webpack_require__(/*! ./operators/core */ "./node_modules/ast-types/lib/def/operators/core.js"));
var types_1 = tslib_1.__importDefault(__webpack_require__(/*! ../types */ "./node_modules/ast-types/lib/types.js"));
var shared_1 = tslib_1.__importStar(__webpack_require__(/*! ../shared */ "./node_modules/ast-types/lib/shared.js"));
function default_1(fork) {
var types = fork.use(types_1.default);
var Type = types.Type;
var def = Type.def;
var or = Type.or;
var shared = fork.use(shared_1.default);
var defaults = shared.defaults;
var geq = shared.geq;
var _a = fork.use(core_1.default), BinaryOperators = _a.BinaryOperators, AssignmentOperators = _a.AssignmentOperators, LogicalOperators = _a.LogicalOperators;
// Abstract supertype of all syntactic entities that are allowed to have a
// .loc field.
def("Printable")
.field("loc", or(def("SourceLocation"), null), defaults["null"], true);
def("Node")
.bases("Printable")
.field("type", String)
.field("comments", or([def("Comment")], null), defaults["null"], true);
def("SourceLocation")
.field("start", def("Position"))
.field("end", def("Position"))
.field("source", or(String, null), defaults["null"]);
def("Position")
.field("line", geq(1))
.field("column", geq(0));
def("File")
.bases("Node")
.build("program", "name")
.field("program", def("Program"))
.field("name", or(String, null), defaults["null"]);
def("Program")
.bases("Node")
.build("body")
.field("body", [def("Statement")]);
def("Function")
.bases("Node")
.field("id", or(def("Identifier"), null), defaults["null"])
.field("params", [def("Pattern")])
.field("body", def("BlockStatement"))
.field("generator", Boolean, defaults["false"])
.field("async", Boolean, defaults["false"]);
def("Statement").bases("Node");
// The empty .build() here means that an EmptyStatement can be constructed
// (i.e. it's not abstract) but that it needs no arguments.
def("EmptyStatement").bases("Statement").build();
def("BlockStatement")
.bases("Statement")
.build("body")
.field("body", [def("Statement")]);
// TODO Figure out how to silently coerce Expressions to
// ExpressionStatements where a Statement was expected.
def("ExpressionStatement")
.bases("Statement")
.build("expression")
.field("expression", def("Expression"));
def("IfStatement")
.bases("Statement")
.build("test", "consequent", "alternate")
.field("test", def("Expression"))
.field("consequent", def("Statement"))
.field("alternate", or(def("Statement"), null), defaults["null"]);
def("LabeledStatement")
.bases("Statement")
.build("label", "body")
.field("label", def("Identifier"))
.field("body", def("Statement"));
def("BreakStatement")
.bases("Statement")
.build("label")
.field("label", or(def("Identifier"), null), defaults["null"]);
def("ContinueStatement")
.bases("Statement")
.build("label")
.field("label", or(def("Identifier"), null), defaults["null"]);
def("WithStatement")
.bases("Statement")
.build("object", "body")
.field("object", def("Expression"))
.field("body", def("Statement"));
def("SwitchStatement")
.bases("Statement")
.build("discriminant", "cases", "lexical")
.field("discriminant", def("Expression"))
.field("cases", [def("SwitchCase")])
.field("lexical", Boolean, defaults["false"]);
def("ReturnStatement")
.bases("Statement")
.build("argument")
.field("argument", or(def("Expression"), null));
def("ThrowStatement")
.bases("Statement")
.build("argument")
.field("argument", def("Expression"));
def("TryStatement")
.bases("Statement")
.build("block", "handler", "finalizer")
.field("block", def("BlockStatement"))
.field("handler", or(def("CatchClause"), null), function () {
return this.handlers && this.handlers[0] || null;
})
.field("handlers", [def("CatchClause")], function () {
return this.handler ? [this.handler] : [];
}, true) // Indicates this field is hidden from eachField iteration.
.field("guardedHandlers", [def("CatchClause")], defaults.emptyArray)
.field("finalizer", or(def("BlockStatement"), null), defaults["null"]);
def("CatchClause")
.bases("Node")
.build("param", "guard", "body")
.field("param", def("Pattern"))
.field("guard", or(def("Expression"), null), defaults["null"])
.field("body", def("BlockStatement"));
def("WhileStatement")
.bases("Statement")
.build("test", "body")
.field("test", def("Expression"))
.field("body", def("Statement"));
def("DoWhileStatement")
.bases("Statement")
.build("body", "test")
.field("body", def("Statement"))
.field("test", def("Expression"));
def("ForStatement")
.bases("Statement")
.build("init", "test", "update", "body")
.field("init", or(def("VariableDeclaration"), def("Expression"), null))
.field("test", or(def("Expression"), null))
.field("update", or(def("Expression"), null))
.field("body", def("Statement"));
def("ForInStatement")
.bases("Statement")
.build("left", "right", "body")
.field("left", or(def("VariableDeclaration"), def("Expression")))
.field("right", def("Expression"))
.field("body", def("Statement"));
def("DebuggerStatement").bases("Statement").build();
def("Declaration").bases("Statement");
def("FunctionDeclaration")
.bases("Function", "Declaration")
.build("id", "params", "body")
.field("id", def("Identifier"));
def("FunctionExpression")
.bases("Function", "Expression")
.build("id", "params", "body");
def("VariableDeclaration")
.bases("Declaration")
.build("kind", "declarations")
.field("kind", or("var", "let", "const"))
.field("declarations", [def("VariableDeclarator")]);
def("VariableDeclarator")
.bases("Node")
.build("id", "init")
.field("id", def("Pattern"))
.field("init", or(def("Expression"), null), defaults["null"]);
def("Expression").bases("Node");
def("ThisExpression").bases("Expression").build();
def("ArrayExpression")
.bases("Expression")
.build("elements")
.field("elements", [or(def("Expression"), null)]);
def("ObjectExpression")
.bases("Expression")
.build("properties")
.field("properties", [def("Property")]);
// TODO Not in the Mozilla Parser API, but used by Esprima.
def("Property")
.bases("Node") // Want to be able to visit Property Nodes.
.build("kind", "key", "value")
.field("kind", or("init", "get", "set"))
.field("key", or(def("Literal"), def("Identifier")))
.field("value", def("Expression"));
def("SequenceExpression")
.bases("Expression")
.build("expressions")
.field("expressions", [def("Expression")]);
var UnaryOperator = or("-", "+", "!", "~", "typeof", "void", "delete");
def("UnaryExpression")
.bases("Expression")
.build("operator", "argument", "prefix")
.field("operator", UnaryOperator)
.field("argument", def("Expression"))
// Esprima doesn't bother with this field, presumably because it's
// always true for unary operators.
.field("prefix", Boolean, defaults["true"]);
var BinaryOperator = or.apply(void 0, BinaryOperators);
def("BinaryExpression")
.bases("Expression")
.build("operator", "left", "right")
.field("operator", BinaryOperator)
.field("left", def("Expression"))
.field("right", def("Expression"));
var AssignmentOperator = or.apply(void 0, AssignmentOperators);
def("AssignmentExpression")
.bases("Expression")
.build("operator", "left", "right")
.field("operator", AssignmentOperator)
.field("left", or(def("Pattern"), def("MemberExpression")))
.field("right", def("Expression"));
var UpdateOperator = or("++", "--");
def("UpdateExpression")
.bases("Expression")
.build("operator", "argument", "prefix")
.field("operator", UpdateOperator)
.field("argument", def("Expression"))
.field("prefix", Boolean);
var LogicalOperator = or.apply(void 0, LogicalOperators);
def("LogicalExpression")
.bases("Expression")
.build("operator", "left", "right")
.field("operator", LogicalOperator)
.field("left", def("Expression"))
.field("right", def("Expression"));
def("ConditionalExpression")
.bases("Expression")
.build("test", "consequent", "alternate")
.field("test", def("Expression"))
.field("consequent", def("Expression"))
.field("alternate", def("Expression"));
def("NewExpression")
.bases("Expression")
.build("callee", "arguments")
.field("callee", def("Expression"))
// The Mozilla Parser API gives this type as [or(def("Expression"),
// null)], but null values don't really make sense at the call site.
// TODO Report this nonsense.
.field("arguments", [def("Expression")]);
def("CallExpression")
.bases("Expression")
.build("callee", "arguments")
.field("callee", def("Expression"))
// See comment for NewExpression above.
.field("arguments", [def("Expression")]);
def("MemberExpression")
.bases("Expression")
.build("object", "property", "computed")
.field("object", def("Expression"))
.field("property", or(def("Identifier"), def("Expression")))
.field("computed", Boolean, function () {
var type = this.property.type;
if (type === 'Literal' ||
type === 'MemberExpression' ||
type === 'BinaryExpression') {
return true;
}
return false;
});
def("Pattern").bases("Node");
def("SwitchCase")
.bases("Node")
.build("test", "consequent")
.field("test", or(def("Expression"), null))
.field("consequent", [def("Statement")]);
def("Identifier")
.bases("Expression", "Pattern")
.build("name")
.field("name", String)
.field("optional", Boolean, defaults["false"]);
def("Literal")
.bases("Expression")
.build("value")
.field("value", or(String, Boolean, null, Number, RegExp, BigInt));
// Abstract (non-buildable) comment supertype. Not a Node.
def("Comment")
.bases("Printable")
.field("value", String)
// A .leading comment comes before the node, whereas a .trailing
// comment comes after it. These two fields should not both be true,
// but they might both be false when the comment falls inside a node
// and the node has no children for the comment to lead or trail,
// e.g. { /*dangling*/ }.
.field("leading", Boolean, defaults["true"])
.field("trailing", Boolean, defaults["false"]);
}
exports["default"] = default_1;
;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=core.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/def/es-proposals.js":
/*!********************************************************!*\
!*** ./node_modules/ast-types/lib/def/es-proposals.js ***!
\********************************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var types_1 = tslib_1.__importDefault(__webpack_require__(/*! ../types */ "./node_modules/ast-types/lib/types.js"));
var shared_1 = tslib_1.__importStar(__webpack_require__(/*! ../shared */ "./node_modules/ast-types/lib/shared.js"));
var es2022_1 = tslib_1.__importDefault(__webpack_require__(/*! ./es2022 */ "./node_modules/ast-types/lib/def/es2022.js"));
function default_1(fork) {
fork.use(es2022_1.default);
var types = fork.use(types_1.default);
var Type = types.Type;
var def = types.Type.def;
var or = Type.or;
var shared = fork.use(shared_1.default);
var defaults = shared.defaults;
def("AwaitExpression")
.build("argument", "all")
.field("argument", or(def("Expression"), null))
.field("all", Boolean, defaults["false"]);
// Decorators
def("Decorator")
.bases("Node")
.build("expression")
.field("expression", def("Expression"));
def("Property")
.field("decorators", or([def("Decorator")], null), defaults["null"]);
def("MethodDefinition")
.field("decorators", or([def("Decorator")], null), defaults["null"]);
// Private names
def("PrivateName")
.bases("Expression", "Pattern")
.build("id")
.field("id", def("Identifier"));
def("ClassPrivateProperty")
.bases("ClassProperty")
.build("key", "value")
.field("key", def("PrivateName"))
.field("value", or(def("Expression"), null), defaults["null"]);
// https://github.com/tc39/proposal-import-assertions
def("ImportAttribute")
.bases("Node")
.build("key", "value")
.field("key", or(def("Identifier"), def("Literal")))
.field("value", def("Expression"));
["ImportDeclaration",
"ExportAllDeclaration",
"ExportNamedDeclaration",
].forEach(function (decl) {
def(decl).field("assertions", [def("ImportAttribute")], defaults.emptyArray);
});
// https://github.com/tc39/proposal-record-tuple
// https://github.com/babel/babel/pull/10865
def("RecordExpression")
.bases("Expression")
.build("properties")
.field("properties", [or(def("ObjectProperty"), def("ObjectMethod"), def("SpreadElement"))]);
def("TupleExpression")
.bases("Expression")
.build("elements")
.field("elements", [or(def("Expression"), def("SpreadElement"), null)]);
// https://github.com/tc39/proposal-js-module-blocks
// https://github.com/babel/babel/pull/12469
def("ModuleExpression")
.bases("Node")
.build("body")
.field("body", def("Program"));
}
exports["default"] = default_1;
;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=es-proposals.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/def/es2016.js":
/*!**************************************************!*\
!*** ./node_modules/ast-types/lib/def/es2016.js ***!
\**************************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var es2016_1 = tslib_1.__importDefault(__webpack_require__(/*! ./operators/es2016 */ "./node_modules/ast-types/lib/def/operators/es2016.js"));
var es6_1 = tslib_1.__importDefault(__webpack_require__(/*! ./es6 */ "./node_modules/ast-types/lib/def/es6.js"));
var shared_1 = __webpack_require__(/*! ../shared */ "./node_modules/ast-types/lib/shared.js");
function default_1(fork) {
// The es2016OpsDef plugin comes before es6Def so BinaryOperators and
// AssignmentOperators will be appropriately augmented before they are first
// used in the core definitions for this fork.
fork.use(es2016_1.default);
fork.use(es6_1.default);
}
exports["default"] = default_1;
;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=es2016.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/def/es2017.js":
/*!**************************************************!*\
!*** ./node_modules/ast-types/lib/def/es2017.js ***!
\**************************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var es2016_1 = tslib_1.__importDefault(__webpack_require__(/*! ./es2016 */ "./node_modules/ast-types/lib/def/es2016.js"));
var types_1 = tslib_1.__importDefault(__webpack_require__(/*! ../types */ "./node_modules/ast-types/lib/types.js"));
var shared_1 = tslib_1.__importStar(__webpack_require__(/*! ../shared */ "./node_modules/ast-types/lib/shared.js"));
function default_1(fork) {
fork.use(es2016_1.default);
var types = fork.use(types_1.default);
var def = types.Type.def;
var defaults = fork.use(shared_1.default).defaults;
def("Function")
.field("async", Boolean, defaults["false"]);
def("AwaitExpression")
.bases("Expression")
.build("argument")
.field("argument", def("Expression"));
}
exports["default"] = default_1;
;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=es2017.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/def/es2018.js":
/*!**************************************************!*\
!*** ./node_modules/ast-types/lib/def/es2018.js ***!
\**************************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var es2017_1 = tslib_1.__importDefault(__webpack_require__(/*! ./es2017 */ "./node_modules/ast-types/lib/def/es2017.js"));
var types_1 = tslib_1.__importDefault(__webpack_require__(/*! ../types */ "./node_modules/ast-types/lib/types.js"));
var shared_1 = tslib_1.__importStar(__webpack_require__(/*! ../shared */ "./node_modules/ast-types/lib/shared.js"));
function default_1(fork) {
fork.use(es2017_1.default);
var types = fork.use(types_1.default);
var def = types.Type.def;
var or = types.Type.or;
var defaults = fork.use(shared_1.default).defaults;
def("ForOfStatement")
.field("await", Boolean, defaults["false"]);
// Legacy
def("SpreadProperty")
.bases("Node")
.build("argument")
.field("argument", def("Expression"));
def("ObjectExpression")
.field("properties", [or(def("Property"), def("SpreadProperty"), // Legacy
def("SpreadElement"))]);
def("TemplateElement")
.field("value", { "cooked": or(String, null), "raw": String });
// Legacy
def("SpreadPropertyPattern")
.bases("Pattern")
.build("argument")
.field("argument", def("Pattern"));
def("ObjectPattern")
.field("properties", [or(def("PropertyPattern"), def("Property"), def("RestElement"), def("SpreadPropertyPattern"))]);
}
exports["default"] = default_1;
;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=es2018.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/def/es2019.js":
/*!**************************************************!*\
!*** ./node_modules/ast-types/lib/def/es2019.js ***!
\**************************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var es2018_1 = tslib_1.__importDefault(__webpack_require__(/*! ./es2018 */ "./node_modules/ast-types/lib/def/es2018.js"));
var types_1 = tslib_1.__importDefault(__webpack_require__(/*! ../types */ "./node_modules/ast-types/lib/types.js"));
var shared_1 = tslib_1.__importStar(__webpack_require__(/*! ../shared */ "./node_modules/ast-types/lib/shared.js"));
function default_1(fork) {
fork.use(es2018_1.default);
var types = fork.use(types_1.default);
var def = types.Type.def;
var or = types.Type.or;
var defaults = fork.use(shared_1.default).defaults;
def("CatchClause")
.field("param", or(def("Pattern"), null), defaults["null"]);
}
exports["default"] = default_1;
;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=es2019.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/def/es2020.js":
/*!**************************************************!*\
!*** ./node_modules/ast-types/lib/def/es2020.js ***!
\**************************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var es2020_1 = tslib_1.__importDefault(__webpack_require__(/*! ./operators/es2020 */ "./node_modules/ast-types/lib/def/operators/es2020.js"));
var es2019_1 = tslib_1.__importDefault(__webpack_require__(/*! ./es2019 */ "./node_modules/ast-types/lib/def/es2019.js"));
var types_1 = tslib_1.__importDefault(__webpack_require__(/*! ../types */ "./node_modules/ast-types/lib/types.js"));
var shared_1 = tslib_1.__importStar(__webpack_require__(/*! ../shared */ "./node_modules/ast-types/lib/shared.js"));
function default_1(fork) {
// The es2020OpsDef plugin comes before es2019Def so LogicalOperators will be
// appropriately augmented before first used.
fork.use(es2020_1.default);
fork.use(es2019_1.default);
var types = fork.use(types_1.default);
var def = types.Type.def;
var or = types.Type.or;
var shared = fork.use(shared_1.default);
var defaults = shared.defaults;
def("ImportExpression")
.bases("Expression")
.build("source")
.field("source", def("Expression"));
def("ExportAllDeclaration")
.bases("Declaration")
.build("source", "exported")
.field("source", def("Literal"))
.field("exported", or(def("Identifier"), null, void 0), defaults["null"]);
// Optional chaining
def("ChainElement")
.bases("Node")
.field("optional", Boolean, defaults["false"]);
def("CallExpression")
.bases("Expression", "ChainElement");
def("MemberExpression")
.bases("Expression", "ChainElement");
def("ChainExpression")
.bases("Expression")
.build("expression")
.field("expression", def("ChainElement"));
def("OptionalCallExpression")
.bases("CallExpression")
.build("callee", "arguments", "optional")
.field("optional", Boolean, defaults["true"]);
// Deprecated optional chaining type, doesn't work with [email protected] or newer
def("OptionalMemberExpression")
.bases("MemberExpression")
.build("object", "property", "computed", "optional")
.field("optional", Boolean, defaults["true"]);
}
exports["default"] = default_1;
;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=es2020.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/def/es2021.js":
/*!**************************************************!*\
!*** ./node_modules/ast-types/lib/def/es2021.js ***!
\**************************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var es2021_1 = tslib_1.__importDefault(__webpack_require__(/*! ./operators/es2021 */ "./node_modules/ast-types/lib/def/operators/es2021.js"));
var es2020_1 = tslib_1.__importDefault(__webpack_require__(/*! ./es2020 */ "./node_modules/ast-types/lib/def/es2020.js"));
var shared_1 = __webpack_require__(/*! ../shared */ "./node_modules/ast-types/lib/shared.js");
function default_1(fork) {
// The es2021OpsDef plugin comes before es2020Def so AssignmentOperators will
// be appropriately augmented before first used.
fork.use(es2021_1.default);
fork.use(es2020_1.default);
}
exports["default"] = default_1;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=es2021.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/def/es2022.js":
/*!**************************************************!*\
!*** ./node_modules/ast-types/lib/def/es2022.js ***!
\**************************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var es2021_1 = tslib_1.__importDefault(__webpack_require__(/*! ./es2021 */ "./node_modules/ast-types/lib/def/es2021.js"));
var types_1 = tslib_1.__importDefault(__webpack_require__(/*! ../types */ "./node_modules/ast-types/lib/types.js"));
var shared_1 = __webpack_require__(/*! ../shared */ "./node_modules/ast-types/lib/shared.js");
function default_1(fork) {
fork.use(es2021_1.default);
var types = fork.use(types_1.default);
var def = types.Type.def;
def("StaticBlock")
.bases("Declaration")
.build("body")
.field("body", [def("Statement")]);
}
exports["default"] = default_1;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=es2022.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/def/es6.js":
/*!***********************************************!*\
!*** ./node_modules/ast-types/lib/def/es6.js ***!
\***********************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var core_1 = tslib_1.__importDefault(__webpack_require__(/*! ./core */ "./node_modules/ast-types/lib/def/core.js"));
var types_1 = tslib_1.__importDefault(__webpack_require__(/*! ../types */ "./node_modules/ast-types/lib/types.js"));
var shared_1 = tslib_1.__importStar(__webpack_require__(/*! ../shared */ "./node_modules/ast-types/lib/shared.js"));
function default_1(fork) {
fork.use(core_1.default);
var types = fork.use(types_1.default);
var def = types.Type.def;
var or = types.Type.or;
var defaults = fork.use(shared_1.default).defaults;
def("Function")
.field("generator", Boolean, defaults["false"])
.field("expression", Boolean, defaults["false"])
.field("defaults", [or(def("Expression"), null)], defaults.emptyArray)
// Legacy
.field("rest", or(def("Identifier"), null), defaults["null"]);
// The ESTree way of representing a ...rest parameter.
def("RestElement")
.bases("Pattern")
.build("argument")
.field("argument", def("Pattern"))
.field("typeAnnotation", // for Babylon. Flow parser puts it on the identifier
or(def("TypeAnnotation"), def("TSTypeAnnotation"), null), defaults["null"]);
def("SpreadElementPattern")
.bases("Pattern")
.build("argument")
.field("argument", def("Pattern"));
def("FunctionDeclaration")
.build("id", "params", "body", "generator", "expression")
// May be `null` in the context of `export default function () {}`
.field("id", or(def("Identifier"), null));
def("FunctionExpression")
.build("id", "params", "body", "generator", "expression");
def("ArrowFunctionExpression")
.bases("Function", "Expression")
.build("params", "body", "expression")
// The forced null value here is compatible with the overridden
// definition of the "id" field in the Function interface.
.field("id", null, defaults["null"])
// Arrow function bodies are allowed to be expressions.
.field("body", or(def("BlockStatement"), def("Expression")))
// The current spec forbids arrow generators, so I have taken the
// liberty of enforcing that. TODO Report this.
.field("generator", false, defaults["false"]);
def("ForOfStatement")
.bases("Statement")
.build("left", "right", "body")
.field("left", or(def("VariableDeclaration"), def("Pattern")))
.field("right", def("Expression"))
.field("body", def("Statement"));
def("YieldExpression")
.bases("Expression")
.build("argument", "delegate")
.field("argument", or(def("Expression"), null))
.field("delegate", Boolean, defaults["false"]);
def("GeneratorExpression")
.bases("Expression")
.build("body", "blocks", "filter")
.field("body", def("Expression"))
.field("blocks", [def("ComprehensionBlock")])
.field("filter", or(def("Expression"), null));
def("ComprehensionExpression")
.bases("Expression")
.build("body", "blocks", "filter")
.field("body", def("Expression"))
.field("blocks", [def("ComprehensionBlock")])
.field("filter", or(def("Expression"), null));
def("ComprehensionBlock")
.bases("Node")
.build("left", "right", "each")
.field("left", def("Pattern"))
.field("right", def("Expression"))
.field("each", Boolean);
def("Property")
.field("key", or(def("Literal"), def("Identifier"), def("Expression")))
.field("value", or(def("Expression"), def("Pattern")))
.field("method", Boolean, defaults["false"])
.field("shorthand", Boolean, defaults["false"])
.field("computed", Boolean, defaults["false"]);
def("ObjectProperty")
.field("shorthand", Boolean, defaults["false"]);
def("PropertyPattern")
.bases("Pattern")
.build("key", "pattern")
.field("key", or(def("Literal"), def("Identifier"), def("Expression")))
.field("pattern", def("Pattern"))
.field("computed", Boolean, defaults["false"]);
def("ObjectPattern")
.bases("Pattern")
.build("properties")
.field("properties", [or(def("PropertyPattern"), def("Property"))]);
def("ArrayPattern")
.bases("Pattern")
.build("elements")
.field("elements", [or(def("Pattern"), null)]);
def("SpreadElement")
.bases("Node")
.build("argument")
.field("argument", def("Expression"));
def("ArrayExpression")
.field("elements", [or(def("Expression"), def("SpreadElement"), def("RestElement"), null)]);
def("NewExpression")
.field("arguments", [or(def("Expression"), def("SpreadElement"))]);
def("CallExpression")
.field("arguments", [or(def("Expression"), def("SpreadElement"))]);
// Note: this node type is *not* an AssignmentExpression with a Pattern on
// the left-hand side! The existing AssignmentExpression type already
// supports destructuring assignments. AssignmentPattern nodes may appear
// wherever a Pattern is allowed, and the right-hand side represents a
// default value to be destructured against the left-hand side, if no
// value is otherwise provided. For example: default parameter values.
def("AssignmentPattern")
.bases("Pattern")
.build("left", "right")
.field("left", def("Pattern"))
.field("right", def("Expression"));
def("MethodDefinition")
.bases("Declaration")
.build("kind", "key", "value", "static")
.field("kind", or("constructor", "method", "get", "set"))
.field("key", def("Expression"))
.field("value", def("Function"))
.field("computed", Boolean, defaults["false"])
.field("static", Boolean, defaults["false"]);
var ClassBodyElement = or(def("MethodDefinition"), def("VariableDeclarator"), def("ClassPropertyDefinition"), def("ClassProperty"), def("StaticBlock"));
def("ClassProperty")
.bases("Declaration")
.build("key")
.field("key", or(def("Literal"), def("Identifier"), def("Expression")))
.field("computed", Boolean, defaults["false"]);
def("ClassPropertyDefinition") // static property
.bases("Declaration")
.build("definition")
// Yes, Virginia, circular definitions are permitted.
.field("definition", ClassBodyElement);
def("ClassBody")
.bases("Declaration")
.build("body")
.field("body", [ClassBodyElement]);
def("ClassDeclaration")
.bases("Declaration")
.build("id", "body", "superClass")
.field("id", or(def("Identifier"), null))
.field("body", def("ClassBody"))
.field("superClass", or(def("Expression"), null), defaults["null"]);
def("ClassExpression")
.bases("Expression")
.build("id", "body", "superClass")
.field("id", or(def("Identifier"), null), defaults["null"])
.field("body", def("ClassBody"))
.field("superClass", or(def("Expression"), null), defaults["null"]);
def("Super")
.bases("Expression")
.build();
// Specifier and ModuleSpecifier are abstract non-standard types
// introduced for definitional convenience.
def("Specifier").bases("Node");
// This supertype is shared/abused by both def/babel.js and
// def/esprima.js. In the future, it will be possible to load only one set
// of definitions appropriate for a given parser, but until then we must
// rely on default functions to reconcile the conflicting AST formats.
def("ModuleSpecifier")
.bases("Specifier")
// This local field is used by Babel/Acorn. It should not technically
// be optional in the Babel/Acorn AST format, but it must be optional
// in the Esprima AST format.
.field("local", or(def("Identifier"), null), defaults["null"])
// The id and name fields are used by Esprima. The id field should not
// technically be optional in the Esprima AST format, but it must be
// optional in the Babel/Acorn AST format.
.field("id", or(def("Identifier"), null), defaults["null"])
.field("name", or(def("Identifier"), null), defaults["null"]);
// import {<id [as name]>} from ...;
def("ImportSpecifier")
.bases("ModuleSpecifier")
.build("imported", "local")
.field("imported", def("Identifier"));
// import <id> from ...;
def("ImportDefaultSpecifier")
.bases("ModuleSpecifier")
.build("local");
// import <* as id> from ...;
def("ImportNamespaceSpecifier")
.bases("ModuleSpecifier")
.build("local");
def("ImportDeclaration")
.bases("Declaration")
.build("specifiers", "source", "importKind")
.field("specifiers", [or(def("ImportSpecifier"), def("ImportNamespaceSpecifier"), def("ImportDefaultSpecifier"))], defaults.emptyArray)
.field("source", def("Literal"))
.field("importKind", or("value", "type"), function () {
return "value";
});
def("ExportNamedDeclaration")
.bases("Declaration")
.build("declaration", "specifiers", "source")
.field("declaration", or(def("Declaration"), null))
.field("specifiers", [def("ExportSpecifier")], defaults.emptyArray)
.field("source", or(def("Literal"), null), defaults["null"]);
def("ExportSpecifier")
.bases("ModuleSpecifier")
.build("local", "exported")
.field("exported", def("Identifier"));
def("ExportDefaultDeclaration")
.bases("Declaration")
.build("declaration")
.field("declaration", or(def("Declaration"), def("Expression")));
def("ExportAllDeclaration")
.bases("Declaration")
.build("source")
.field("source", def("Literal"));
def("TaggedTemplateExpression")
.bases("Expression")
.build("tag", "quasi")
.field("tag", def("Expression"))
.field("quasi", def("TemplateLiteral"));
def("TemplateLiteral")
.bases("Expression")
.build("quasis", "expressions")
.field("quasis", [def("TemplateElement")])
.field("expressions", [def("Expression")]);
def("TemplateElement")
.bases("Node")
.build("value", "tail")
.field("value", { "cooked": String, "raw": String })
.field("tail", Boolean);
def("MetaProperty")
.bases("Expression")
.build("meta", "property")
.field("meta", def("Identifier"))
.field("property", def("Identifier"));
}
exports["default"] = default_1;
;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=es6.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/def/esprima.js":
/*!***************************************************!*\
!*** ./node_modules/ast-types/lib/def/esprima.js ***!
\***************************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var es_proposals_1 = tslib_1.__importDefault(__webpack_require__(/*! ./es-proposals */ "./node_modules/ast-types/lib/def/es-proposals.js"));
var types_1 = tslib_1.__importDefault(__webpack_require__(/*! ../types */ "./node_modules/ast-types/lib/types.js"));
var shared_1 = tslib_1.__importStar(__webpack_require__(/*! ../shared */ "./node_modules/ast-types/lib/shared.js"));
function default_1(fork) {
fork.use(es_proposals_1.default);
var types = fork.use(types_1.default);
var defaults = fork.use(shared_1.default).defaults;
var def = types.Type.def;
var or = types.Type.or;
def("VariableDeclaration")
.field("declarations", [or(def("VariableDeclarator"), def("Identifier") // Esprima deviation.
)]);
def("Property")
.field("value", or(def("Expression"), def("Pattern") // Esprima deviation.
));
def("ArrayPattern")
.field("elements", [or(def("Pattern"), def("SpreadElement"), null)]);
def("ObjectPattern")
.field("properties", [or(def("Property"), def("PropertyPattern"), def("SpreadPropertyPattern"), def("SpreadProperty") // Used by Esprima.
)]);
// Like ModuleSpecifier, except type:"ExportSpecifier" and buildable.
// export {<id [as name]>} [from ...];
def("ExportSpecifier")
.bases("ModuleSpecifier")
.build("id", "name");
// export <*> from ...;
def("ExportBatchSpecifier")
.bases("Specifier")
.build();
def("ExportDeclaration")
.bases("Declaration")
.build("default", "declaration", "specifiers", "source")
.field("default", Boolean)
.field("declaration", or(def("Declaration"), def("Expression"), // Implies default.
null))
.field("specifiers", [or(def("ExportSpecifier"), def("ExportBatchSpecifier"))], defaults.emptyArray)
.field("source", or(def("Literal"), null), defaults["null"]);
def("Block")
.bases("Comment")
.build("value", /*optional:*/ "leading", "trailing");
def("Line")
.bases("Comment")
.build("value", /*optional:*/ "leading", "trailing");
}
exports["default"] = default_1;
;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=esprima.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/def/flow.js":
/*!************************************************!*\
!*** ./node_modules/ast-types/lib/def/flow.js ***!
\************************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var es_proposals_1 = tslib_1.__importDefault(__webpack_require__(/*! ./es-proposals */ "./node_modules/ast-types/lib/def/es-proposals.js"));
var type_annotations_1 = tslib_1.__importDefault(__webpack_require__(/*! ./type-annotations */ "./node_modules/ast-types/lib/def/type-annotations.js"));
var types_1 = tslib_1.__importDefault(__webpack_require__(/*! ../types */ "./node_modules/ast-types/lib/types.js"));
var shared_1 = tslib_1.__importStar(__webpack_require__(/*! ../shared */ "./node_modules/ast-types/lib/shared.js"));
function default_1(fork) {
fork.use(es_proposals_1.default);
fork.use(type_annotations_1.default);
var types = fork.use(types_1.default);
var def = types.Type.def;
var or = types.Type.or;
var defaults = fork.use(shared_1.default).defaults;
// Base types
def("Flow").bases("Node");
def("FlowType").bases("Flow");
// Type annotations
def("AnyTypeAnnotation")
.bases("FlowType")
.build();
def("EmptyTypeAnnotation")
.bases("FlowType")
.build();
def("MixedTypeAnnotation")
.bases("FlowType")
.build();
def("VoidTypeAnnotation")
.bases("FlowType")
.build();
def("SymbolTypeAnnotation")
.bases("FlowType")
.build();
def("NumberTypeAnnotation")
.bases("FlowType")
.build();
def("BigIntTypeAnnotation")
.bases("FlowType")
.build();
def("NumberLiteralTypeAnnotation")
.bases("FlowType")
.build("value", "raw")
.field("value", Number)
.field("raw", String);
// Babylon 6 differs in AST from Flow
// same as NumberLiteralTypeAnnotation
def("NumericLiteralTypeAnnotation")
.bases("FlowType")
.build("value", "raw")
.field("value", Number)
.field("raw", String);
def("BigIntLiteralTypeAnnotation")
.bases("FlowType")
.build("value", "raw")
.field("value", null)
.field("raw", String);
def("StringTypeAnnotation")
.bases("FlowType")
.build();
def("StringLiteralTypeAnnotation")
.bases("FlowType")
.build("value", "raw")
.field("value", String)
.field("raw", String);
def("BooleanTypeAnnotation")
.bases("FlowType")
.build();
def("BooleanLiteralTypeAnnotation")
.bases("FlowType")
.build("value", "raw")
.field("value", Boolean)
.field("raw", String);
def("TypeAnnotation")
.bases("Node")
.build("typeAnnotation")
.field("typeAnnotation", def("FlowType"));
def("NullableTypeAnnotation")
.bases("FlowType")
.build("typeAnnotation")
.field("typeAnnotation", def("FlowType"));
def("NullLiteralTypeAnnotation")
.bases("FlowType")
.build();
def("NullTypeAnnotation")
.bases("FlowType")
.build();
def("ThisTypeAnnotation")
.bases("FlowType")
.build();
def("ExistsTypeAnnotation")
.bases("FlowType")
.build();
def("ExistentialTypeParam")
.bases("FlowType")
.build();
def("FunctionTypeAnnotation")
.bases("FlowType")
.build("params", "returnType", "rest", "typeParameters")
.field("params", [def("FunctionTypeParam")])
.field("returnType", def("FlowType"))
.field("rest", or(def("FunctionTypeParam"), null))
.field("typeParameters", or(def("TypeParameterDeclaration"), null));
def("FunctionTypeParam")
.bases("Node")
.build("name", "typeAnnotation", "optional")
.field("name", or(def("Identifier"), null))
.field("typeAnnotation", def("FlowType"))
.field("optional", Boolean);
def("ArrayTypeAnnotation")
.bases("FlowType")
.build("elementType")
.field("elementType", def("FlowType"));
def("ObjectTypeAnnotation")
.bases("FlowType")
.build("properties", "indexers", "callProperties")
.field("properties", [
or(def("ObjectTypeProperty"), def("ObjectTypeSpreadProperty"))
])
.field("indexers", [def("ObjectTypeIndexer")], defaults.emptyArray)
.field("callProperties", [def("ObjectTypeCallProperty")], defaults.emptyArray)
.field("inexact", or(Boolean, void 0), defaults["undefined"])
.field("exact", Boolean, defaults["false"])
.field("internalSlots", [def("ObjectTypeInternalSlot")], defaults.emptyArray);
def("Variance")
.bases("Node")
.build("kind")
.field("kind", or("plus", "minus"));
var LegacyVariance = or(def("Variance"), "plus", "minus", null);
def("ObjectTypeProperty")
.bases("Node")
.build("key", "value", "optional")
.field("key", or(def("Literal"), def("Identifier")))
.field("value", def("FlowType"))
.field("optional", Boolean)
.field("variance", LegacyVariance, defaults["null"]);
def("ObjectTypeIndexer")
.bases("Node")
.build("id", "key", "value")
.field("id", def("Identifier"))
.field("key", def("FlowType"))
.field("value", def("FlowType"))
.field("variance", LegacyVariance, defaults["null"])
.field("static", Boolean, defaults["false"]);
def("ObjectTypeCallProperty")
.bases("Node")
.build("value")
.field("value", def("FunctionTypeAnnotation"))
.field("static", Boolean, defaults["false"]);
def("QualifiedTypeIdentifier")
.bases("Node")
.build("qualification", "id")
.field("qualification", or(def("Identifier"), def("QualifiedTypeIdentifier")))
.field("id", def("Identifier"));
def("GenericTypeAnnotation")
.bases("FlowType")
.build("id", "typeParameters")
.field("id", or(def("Identifier"), def("QualifiedTypeIdentifier")))
.field("typeParameters", or(def("TypeParameterInstantiation"), null));
def("MemberTypeAnnotation")
.bases("FlowType")
.build("object", "property")
.field("object", def("Identifier"))
.field("property", or(def("MemberTypeAnnotation"), def("GenericTypeAnnotation")));
def("IndexedAccessType")
.bases("FlowType")
.build("objectType", "indexType")
.field("objectType", def("FlowType"))
.field("indexType", def("FlowType"));
def("OptionalIndexedAccessType")
.bases("FlowType")
.build("objectType", "indexType", "optional")
.field("objectType", def("FlowType"))
.field("indexType", def("FlowType"))
.field('optional', Boolean);
def("UnionTypeAnnotation")
.bases("FlowType")
.build("types")
.field("types", [def("FlowType")]);
def("IntersectionTypeAnnotation")
.bases("FlowType")
.build("types")
.field("types", [def("FlowType")]);
def("TypeofTypeAnnotation")
.bases("FlowType")
.build("argument")
.field("argument", def("FlowType"));
def("ObjectTypeSpreadProperty")
.bases("Node")
.build("argument")
.field("argument", def("FlowType"));
def("ObjectTypeInternalSlot")
.bases("Node")
.build("id", "value", "optional", "static", "method")
.field("id", def("Identifier"))
.field("value", def("FlowType"))
.field("optional", Boolean)
.field("static", Boolean)
.field("method", Boolean);
def("TypeParameterDeclaration")
.bases("Node")
.build("params")
.field("params", [def("TypeParameter")]);
def("TypeParameterInstantiation")
.bases("Node")
.build("params")
.field("params", [def("FlowType")]);
def("TypeParameter")
.bases("FlowType")
.build("name", "variance", "bound", "default")
.field("name", String)
.field("variance", LegacyVariance, defaults["null"])
.field("bound", or(def("TypeAnnotation"), null), defaults["null"])
.field("default", or(def("FlowType"), null), defaults["null"]);
def("ClassProperty")
.field("variance", LegacyVariance, defaults["null"]);
def("ClassImplements")
.bases("Node")
.build("id")
.field("id", def("Identifier"))
.field("superClass", or(def("Expression"), null), defaults["null"])
.field("typeParameters", or(def("TypeParameterInstantiation"), null), defaults["null"]);
def("InterfaceTypeAnnotation")
.bases("FlowType")
.build("body", "extends")
.field("body", def("ObjectTypeAnnotation"))
.field("extends", or([def("InterfaceExtends")], null), defaults["null"]);
def("InterfaceDeclaration")
.bases("Declaration")
.build("id", "body", "extends")
.field("id", def("Identifier"))
.field("typeParameters", or(def("TypeParameterDeclaration"), null), defaults["null"])
.field("body", def("ObjectTypeAnnotation"))
.field("extends", [def("InterfaceExtends")]);
def("DeclareInterface")
.bases("InterfaceDeclaration")
.build("id", "body", "extends");
def("InterfaceExtends")
.bases("Node")
.build("id")
.field("id", def("Identifier"))
.field("typeParameters", or(def("TypeParameterInstantiation"), null), defaults["null"]);
def("TypeAlias")
.bases("Declaration")
.build("id", "typeParameters", "right")
.field("id", def("Identifier"))
.field("typeParameters", or(def("TypeParameterDeclaration"), null))
.field("right", def("FlowType"));
def("DeclareTypeAlias")
.bases("TypeAlias")
.build("id", "typeParameters", "right");
def("OpaqueType")
.bases("Declaration")
.build("id", "typeParameters", "impltype", "supertype")
.field("id", def("Identifier"))
.field("typeParameters", or(def("TypeParameterDeclaration"), null))
.field("impltype", def("FlowType"))
.field("supertype", or(def("FlowType"), null));
def("DeclareOpaqueType")
.bases("OpaqueType")
.build("id", "typeParameters", "supertype")
.field("impltype", or(def("FlowType"), null));
def("TypeCastExpression")
.bases("Expression")
.build("expression", "typeAnnotation")
.field("expression", def("Expression"))
.field("typeAnnotation", def("TypeAnnotation"));
def("TupleTypeAnnotation")
.bases("FlowType")
.build("types")
.field("types", [def("FlowType")]);
def("DeclareVariable")
.bases("Statement")
.build("id")
.field("id", def("Identifier"));
def("DeclareFunction")
.bases("Statement")
.build("id")
.field("id", def("Identifier"))
.field("predicate", or(def("FlowPredicate"), null), defaults["null"]);
def("DeclareClass")
.bases("InterfaceDeclaration")
.build("id");
def("DeclareModule")
.bases("Statement")
.build("id", "body")
.field("id", or(def("Identifier"), def("Literal")))
.field("body", def("BlockStatement"));
def("DeclareModuleExports")
.bases("Statement")
.build("typeAnnotation")
.field("typeAnnotation", def("TypeAnnotation"));
def("DeclareExportDeclaration")
.bases("Declaration")
.build("default", "declaration", "specifiers", "source")
.field("default", Boolean)
.field("declaration", or(def("DeclareVariable"), def("DeclareFunction"), def("DeclareClass"), def("FlowType"), // Implies default.
def("TypeAlias"), // Implies named type
def("DeclareOpaqueType"), // Implies named opaque type
def("InterfaceDeclaration"), null))
.field("specifiers", [or(def("ExportSpecifier"), def("ExportBatchSpecifier"))], defaults.emptyArray)
.field("source", or(def("Literal"), null), defaults["null"]);
def("DeclareExportAllDeclaration")
.bases("Declaration")
.build("source")
.field("source", or(def("Literal"), null), defaults["null"]);
def("ImportDeclaration")
.field("importKind", or("value", "type", "typeof"), function () { return "value"; });
def("FlowPredicate").bases("Flow");
def("InferredPredicate")
.bases("FlowPredicate")
.build();
def("DeclaredPredicate")
.bases("FlowPredicate")
.build("value")
.field("value", def("Expression"));
def("Function")
.field("predicate", or(def("FlowPredicate"), null), defaults["null"]);
def("CallExpression")
.field("typeArguments", or(null, def("TypeParameterInstantiation")), defaults["null"]);
def("NewExpression")
.field("typeArguments", or(null, def("TypeParameterInstantiation")), defaults["null"]);
// Enums
def("EnumDeclaration")
.bases("Declaration")
.build("id", "body")
.field("id", def("Identifier"))
.field("body", or(def("EnumBooleanBody"), def("EnumNumberBody"), def("EnumStringBody"), def("EnumSymbolBody")));
def("EnumBooleanBody")
.build("members", "explicitType")
.field("members", [def("EnumBooleanMember")])
.field("explicitType", Boolean);
def("EnumNumberBody")
.build("members", "explicitType")
.field("members", [def("EnumNumberMember")])
.field("explicitType", Boolean);
def("EnumStringBody")
.build("members", "explicitType")
.field("members", or([def("EnumStringMember")], [def("EnumDefaultedMember")]))
.field("explicitType", Boolean);
def("EnumSymbolBody")
.build("members")
.field("members", [def("EnumDefaultedMember")]);
def("EnumBooleanMember")
.build("id", "init")
.field("id", def("Identifier"))
.field("init", or(def("Literal"), Boolean));
def("EnumNumberMember")
.build("id", "init")
.field("id", def("Identifier"))
.field("init", def("Literal"));
def("EnumStringMember")
.build("id", "init")
.field("id", def("Identifier"))
.field("init", def("Literal"));
def("EnumDefaultedMember")
.build("id")
.field("id", def("Identifier"));
}
exports["default"] = default_1;
;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=flow.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/def/jsx.js":
/*!***********************************************!*\
!*** ./node_modules/ast-types/lib/def/jsx.js ***!
\***********************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var es_proposals_1 = tslib_1.__importDefault(__webpack_require__(/*! ./es-proposals */ "./node_modules/ast-types/lib/def/es-proposals.js"));
var types_1 = tslib_1.__importDefault(__webpack_require__(/*! ../types */ "./node_modules/ast-types/lib/types.js"));
var shared_1 = tslib_1.__importStar(__webpack_require__(/*! ../shared */ "./node_modules/ast-types/lib/shared.js"));
function default_1(fork) {
fork.use(es_proposals_1.default);
var types = fork.use(types_1.default);
var def = types.Type.def;
var or = types.Type.or;
var defaults = fork.use(shared_1.default).defaults;
def("JSXAttribute")
.bases("Node")
.build("name", "value")
.field("name", or(def("JSXIdentifier"), def("JSXNamespacedName")))
.field("value", or(def("Literal"), // attr="value"
def("JSXExpressionContainer"), // attr={value}
def("JSXElement"), // attr=<div />
def("JSXFragment"), // attr=<></>
null // attr= or just attr
), defaults["null"]);
def("JSXIdentifier")
.bases("Identifier")
.build("name")
.field("name", String);
def("JSXNamespacedName")
.bases("Node")
.build("namespace", "name")
.field("namespace", def("JSXIdentifier"))
.field("name", def("JSXIdentifier"));
def("JSXMemberExpression")
.bases("MemberExpression")
.build("object", "property")
.field("object", or(def("JSXIdentifier"), def("JSXMemberExpression")))
.field("property", def("JSXIdentifier"))
.field("computed", Boolean, defaults.false);
var JSXElementName = or(def("JSXIdentifier"), def("JSXNamespacedName"), def("JSXMemberExpression"));
def("JSXSpreadAttribute")
.bases("Node")
.build("argument")
.field("argument", def("Expression"));
var JSXAttributes = [or(def("JSXAttribute"), def("JSXSpreadAttribute"))];
def("JSXExpressionContainer")
.bases("Expression")
.build("expression")
.field("expression", or(def("Expression"), def("JSXEmptyExpression")));
var JSXChildren = [or(def("JSXText"), def("JSXExpressionContainer"), def("JSXSpreadChild"), def("JSXElement"), def("JSXFragment"), def("Literal") // Legacy: Esprima should return JSXText instead.
)];
def("JSXElement")
.bases("Expression")
.build("openingElement", "closingElement", "children")
.field("openingElement", def("JSXOpeningElement"))
.field("closingElement", or(def("JSXClosingElement"), null), defaults["null"])
.field("children", JSXChildren, defaults.emptyArray)
.field("name", JSXElementName, function () {
// Little-known fact: the `this` object inside a default function
// is none other than the partially-built object itself, and any
// fields initialized directly from builder function arguments
// (like openingElement, closingElement, and children) are
// guaranteed to be available.
return this.openingElement.name;
}, true) // hidden from traversal
.field("selfClosing", Boolean, function () {
return this.openingElement.selfClosing;
}, true) // hidden from traversal
.field("attributes", JSXAttributes, function () {
return this.openingElement.attributes;
}, true); // hidden from traversal
def("JSXOpeningElement")
.bases("Node")
.build("name", "attributes", "selfClosing")
.field("name", JSXElementName)
.field("attributes", JSXAttributes, defaults.emptyArray)
.field("selfClosing", Boolean, defaults["false"]);
def("JSXClosingElement")
.bases("Node")
.build("name")
.field("name", JSXElementName);
def("JSXFragment")
.bases("Expression")
.build("openingFragment", "closingFragment", "children")
.field("openingFragment", def("JSXOpeningFragment"))
.field("closingFragment", def("JSXClosingFragment"))
.field("children", JSXChildren, defaults.emptyArray);
def("JSXOpeningFragment")
.bases("Node")
.build();
def("JSXClosingFragment")
.bases("Node")
.build();
def("JSXText")
.bases("Literal")
.build("value", "raw")
.field("value", String)
.field("raw", String, function () {
return this.value;
});
def("JSXEmptyExpression")
.bases("Node")
.build();
def("JSXSpreadChild")
.bases("Node")
.build("expression")
.field("expression", def("Expression"));
}
exports["default"] = default_1;
;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=jsx.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/def/operators/core.js":
/*!**********************************************************!*\
!*** ./node_modules/ast-types/lib/def/operators/core.js ***!
\**********************************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var shared_1 = __webpack_require__(/*! ../../shared */ "./node_modules/ast-types/lib/shared.js");
function default_1() {
return {
BinaryOperators: [
"==", "!=", "===", "!==",
"<", "<=", ">", ">=",
"<<", ">>", ">>>",
"+", "-", "*", "/", "%",
"&",
"|", "^", "in",
"instanceof",
],
AssignmentOperators: [
"=", "+=", "-=", "*=", "/=", "%=",
"<<=", ">>=", ">>>=",
"|=", "^=", "&=",
],
LogicalOperators: [
"||", "&&",
],
};
}
exports["default"] = default_1;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=core.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/def/operators/es2016.js":
/*!************************************************************!*\
!*** ./node_modules/ast-types/lib/def/operators/es2016.js ***!
\************************************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var shared_1 = __webpack_require__(/*! ../../shared */ "./node_modules/ast-types/lib/shared.js");
var core_1 = tslib_1.__importDefault(__webpack_require__(/*! ./core */ "./node_modules/ast-types/lib/def/operators/core.js"));
function default_1(fork) {
var result = fork.use(core_1.default);
// Exponentiation operators. Must run before BinaryOperators or
// AssignmentOperators are used (hence before fork.use(es6Def)).
// https://github.com/tc39/proposal-exponentiation-operator
if (result.BinaryOperators.indexOf("**") < 0) {
result.BinaryOperators.push("**");
}
if (result.AssignmentOperators.indexOf("**=") < 0) {
result.AssignmentOperators.push("**=");
}
return result;
}
exports["default"] = default_1;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=es2016.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/def/operators/es2020.js":
/*!************************************************************!*\
!*** ./node_modules/ast-types/lib/def/operators/es2020.js ***!
\************************************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var shared_1 = __webpack_require__(/*! ../../shared */ "./node_modules/ast-types/lib/shared.js");
var es2016_1 = tslib_1.__importDefault(__webpack_require__(/*! ./es2016 */ "./node_modules/ast-types/lib/def/operators/es2016.js"));
function default_1(fork) {
var result = fork.use(es2016_1.default);
// Nullish coalescing. Must run before LogicalOperators is used.
// https://github.com/tc39/proposal-nullish-coalescing
if (result.LogicalOperators.indexOf("??") < 0) {
result.LogicalOperators.push("??");
}
return result;
}
exports["default"] = default_1;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=es2020.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/def/operators/es2021.js":
/*!************************************************************!*\
!*** ./node_modules/ast-types/lib/def/operators/es2021.js ***!
\************************************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var shared_1 = __webpack_require__(/*! ../../shared */ "./node_modules/ast-types/lib/shared.js");
var es2020_1 = tslib_1.__importDefault(__webpack_require__(/*! ./es2020 */ "./node_modules/ast-types/lib/def/operators/es2020.js"));
function default_1(fork) {
var result = fork.use(es2020_1.default);
// Logical assignment operators. Must run before AssignmentOperators is used.
// https://github.com/tc39/proposal-logical-assignment
result.LogicalOperators.forEach(function (op) {
var assignOp = op + "=";
if (result.AssignmentOperators.indexOf(assignOp) < 0) {
result.AssignmentOperators.push(assignOp);
}
});
return result;
}
exports["default"] = default_1;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=es2021.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/def/type-annotations.js":
/*!************************************************************!*\
!*** ./node_modules/ast-types/lib/def/type-annotations.js ***!
\************************************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
/**
* Type annotation defs shared between Flow and TypeScript.
* These defs could not be defined in ./flow.ts or ./typescript.ts directly
* because they use the same name.
*/
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var types_1 = tslib_1.__importDefault(__webpack_require__(/*! ../types */ "./node_modules/ast-types/lib/types.js"));
var shared_1 = tslib_1.__importStar(__webpack_require__(/*! ../shared */ "./node_modules/ast-types/lib/shared.js"));
function default_1(fork) {
var types = fork.use(types_1.default);
var def = types.Type.def;
var or = types.Type.or;
var defaults = fork.use(shared_1.default).defaults;
var TypeAnnotation = or(def("TypeAnnotation"), def("TSTypeAnnotation"), null);
var TypeParamDecl = or(def("TypeParameterDeclaration"), def("TSTypeParameterDeclaration"), null);
def("Identifier")
.field("typeAnnotation", TypeAnnotation, defaults["null"]);
def("ObjectPattern")
.field("typeAnnotation", TypeAnnotation, defaults["null"]);
def("Function")
.field("returnType", TypeAnnotation, defaults["null"])
.field("typeParameters", TypeParamDecl, defaults["null"]);
def("ClassProperty")
.build("key", "value", "typeAnnotation", "static")
.field("value", or(def("Expression"), null))
.field("static", Boolean, defaults["false"])
.field("typeAnnotation", TypeAnnotation, defaults["null"]);
["ClassDeclaration",
"ClassExpression",
].forEach(function (typeName) {
def(typeName)
.field("typeParameters", TypeParamDecl, defaults["null"])
.field("superTypeParameters", or(def("TypeParameterInstantiation"), def("TSTypeParameterInstantiation"), null), defaults["null"])
.field("implements", or([def("ClassImplements")], [def("TSExpressionWithTypeArguments")]), defaults.emptyArray);
});
}
exports["default"] = default_1;
;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=type-annotations.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/def/typescript.js":
/*!******************************************************!*\
!*** ./node_modules/ast-types/lib/def/typescript.js ***!
\******************************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var babel_core_1 = tslib_1.__importDefault(__webpack_require__(/*! ./babel-core */ "./node_modules/ast-types/lib/def/babel-core.js"));
var type_annotations_1 = tslib_1.__importDefault(__webpack_require__(/*! ./type-annotations */ "./node_modules/ast-types/lib/def/type-annotations.js"));
var types_1 = tslib_1.__importDefault(__webpack_require__(/*! ../types */ "./node_modules/ast-types/lib/types.js"));
var shared_1 = tslib_1.__importStar(__webpack_require__(/*! ../shared */ "./node_modules/ast-types/lib/shared.js"));
function default_1(fork) {
// Since TypeScript is parsed by Babylon, include the core Babylon types
// but omit the Flow-related types.
fork.use(babel_core_1.default);
fork.use(type_annotations_1.default);
var types = fork.use(types_1.default);
var n = types.namedTypes;
var def = types.Type.def;
var or = types.Type.or;
var defaults = fork.use(shared_1.default).defaults;
var StringLiteral = types.Type.from(function (value, deep) {
if (n.StringLiteral &&
n.StringLiteral.check(value, deep)) {
return true;
}
if (n.Literal &&
n.Literal.check(value, deep) &&
typeof value.value === "string") {
return true;
}
return false;
}, "StringLiteral");
def("TSType")
.bases("Node");
var TSEntityName = or(def("Identifier"), def("TSQualifiedName"));
def("TSTypeReference")
.bases("TSType", "TSHasOptionalTypeParameterInstantiation")
.build("typeName", "typeParameters")
.field("typeName", TSEntityName);
// An abstract (non-buildable) base type that provide a commonly-needed
// optional .typeParameters field.
def("TSHasOptionalTypeParameterInstantiation")
.field("typeParameters", or(def("TSTypeParameterInstantiation"), null), defaults["null"]);
// An abstract (non-buildable) base type that provide a commonly-needed
// optional .typeParameters field.
def("TSHasOptionalTypeParameters")
.field("typeParameters", or(def("TSTypeParameterDeclaration"), null, void 0), defaults["null"]);
// An abstract (non-buildable) base type that provide a commonly-needed
// optional .typeAnnotation field.
def("TSHasOptionalTypeAnnotation")
.field("typeAnnotation", or(def("TSTypeAnnotation"), null), defaults["null"]);
def("TSQualifiedName")
.bases("Node")
.build("left", "right")
.field("left", TSEntityName)
.field("right", TSEntityName);
def("TSAsExpression")
.bases("Expression", "Pattern")
.build("expression", "typeAnnotation")
.field("expression", def("Expression"))
.field("typeAnnotation", def("TSType"))
.field("extra", or({ parenthesized: Boolean }, null), defaults["null"]);
def("TSTypeCastExpression")
.bases("Expression")
.build("expression", "typeAnnotation")
.field("expression", def("Expression"))
.field("typeAnnotation", def("TSType"));
def("TSSatisfiesExpression")
.bases("Expression", "Pattern")
.build("expression", "typeAnnotation")
.field("expression", def("Expression"))
.field("typeAnnotation", def("TSType"));
def("TSNonNullExpression")
.bases("Expression", "Pattern")
.build("expression")
.field("expression", def("Expression"));
[
"TSAnyKeyword",
"TSBigIntKeyword",
"TSBooleanKeyword",
"TSNeverKeyword",
"TSNullKeyword",
"TSNumberKeyword",
"TSObjectKeyword",
"TSStringKeyword",
"TSSymbolKeyword",
"TSUndefinedKeyword",
"TSUnknownKeyword",
"TSVoidKeyword",
"TSIntrinsicKeyword",
"TSThisType",
].forEach(function (keywordType) {
def(keywordType)
.bases("TSType")
.build();
});
def("TSArrayType")
.bases("TSType")
.build("elementType")
.field("elementType", def("TSType"));
def("TSLiteralType")
.bases("TSType")
.build("literal")
.field("literal", or(def("NumericLiteral"), def("StringLiteral"), def("BooleanLiteral"), def("TemplateLiteral"), def("UnaryExpression"), def("BigIntLiteral")));
def("TemplateLiteral")
// The TemplateLiteral type appears to be reused for TypeScript template
// literal types (instead of introducing a new TSTemplateLiteralType type),
// so we allow the templateLiteral.expressions array to be either all
// expressions or all TypeScript types.
.field("expressions", or([def("Expression")], [def("TSType")]));
["TSUnionType",
"TSIntersectionType",
].forEach(function (typeName) {
def(typeName)
.bases("TSType")
.build("types")
.field("types", [def("TSType")]);
});
def("TSConditionalType")
.bases("TSType")
.build("checkType", "extendsType", "trueType", "falseType")
.field("checkType", def("TSType"))
.field("extendsType", def("TSType"))
.field("trueType", def("TSType"))
.field("falseType", def("TSType"));
def("TSInferType")
.bases("TSType")
.build("typeParameter")
.field("typeParameter", def("TSTypeParameter"));
def("TSParenthesizedType")
.bases("TSType")
.build("typeAnnotation")
.field("typeAnnotation", def("TSType"));
var ParametersType = [or(def("Identifier"), def("RestElement"), def("ArrayPattern"), def("ObjectPattern"))];
["TSFunctionType",
"TSConstructorType",
].forEach(function (typeName) {
def(typeName)
.bases("TSType", "TSHasOptionalTypeParameters", "TSHasOptionalTypeAnnotation")
.build("parameters")
.field("parameters", ParametersType);
});
def("TSDeclareFunction")
.bases("Declaration", "TSHasOptionalTypeParameters")
.build("id", "params", "returnType")
.field("declare", Boolean, defaults["false"])
.field("async", Boolean, defaults["false"])
.field("generator", Boolean, defaults["false"])
.field("id", or(def("Identifier"), null), defaults["null"])
.field("params", [def("Pattern")])
// tSFunctionTypeAnnotationCommon
.field("returnType", or(def("TSTypeAnnotation"), def("Noop"), // Still used?
null), defaults["null"]);
def("TSDeclareMethod")
.bases("Declaration", "TSHasOptionalTypeParameters")
.build("key", "params", "returnType")
.field("async", Boolean, defaults["false"])
.field("generator", Boolean, defaults["false"])
.field("params", [def("Pattern")])
// classMethodOrPropertyCommon
.field("abstract", Boolean, defaults["false"])
.field("accessibility", or("public", "private", "protected", void 0), defaults["undefined"])
.field("static", Boolean, defaults["false"])
.field("computed", Boolean, defaults["false"])
.field("optional", Boolean, defaults["false"])
.field("key", or(def("Identifier"), def("StringLiteral"), def("NumericLiteral"),
// Only allowed if .computed is true.
def("Expression")))
// classMethodOrDeclareMethodCommon
.field("kind", or("get", "set", "method", "constructor"), function getDefault() { return "method"; })
.field("access", // Not "accessibility"?
or("public", "private", "protected", void 0), defaults["undefined"])
.field("decorators", or([def("Decorator")], null), defaults["null"])
// tSFunctionTypeAnnotationCommon
.field("returnType", or(def("TSTypeAnnotation"), def("Noop"), // Still used?
null), defaults["null"]);
def("TSMappedType")
.bases("TSType")
.build("typeParameter", "typeAnnotation")
.field("readonly", or(Boolean, "+", "-"), defaults["false"])
.field("typeParameter", def("TSTypeParameter"))
.field("optional", or(Boolean, "+", "-"), defaults["false"])
.field("typeAnnotation", or(def("TSType"), null), defaults["null"]);
def("TSTupleType")
.bases("TSType")
.build("elementTypes")
.field("elementTypes", [or(def("TSType"), def("TSNamedTupleMember"))]);
def("TSNamedTupleMember")
.bases("TSType")
.build("label", "elementType", "optional")
.field("label", def("Identifier"))
.field("optional", Boolean, defaults["false"])
.field("elementType", def("TSType"));
def("TSRestType")
.bases("TSType")
.build("typeAnnotation")
.field("typeAnnotation", def("TSType"));
def("TSOptionalType")
.bases("TSType")
.build("typeAnnotation")
.field("typeAnnotation", def("TSType"));
def("TSIndexedAccessType")
.bases("TSType")
.build("objectType", "indexType")
.field("objectType", def("TSType"))
.field("indexType", def("TSType"));
def("TSTypeOperator")
.bases("TSType")
.build("operator")
.field("operator", String)
.field("typeAnnotation", def("TSType"));
def("TSTypeAnnotation")
.bases("Node")
.build("typeAnnotation")
.field("typeAnnotation", or(def("TSType"), def("TSTypeAnnotation")));
def("TSIndexSignature")
.bases("Declaration", "TSHasOptionalTypeAnnotation")
.build("parameters", "typeAnnotation")
.field("parameters", [def("Identifier")]) // Length === 1
.field("readonly", Boolean, defaults["false"]);
def("TSPropertySignature")
.bases("Declaration", "TSHasOptionalTypeAnnotation")
.build("key", "typeAnnotation", "optional")
.field("key", def("Expression"))
.field("computed", Boolean, defaults["false"])
.field("readonly", Boolean, defaults["false"])
.field("optional", Boolean, defaults["false"])
.field("initializer", or(def("Expression"), null), defaults["null"]);
def("TSMethodSignature")
.bases("Declaration", "TSHasOptionalTypeParameters", "TSHasOptionalTypeAnnotation")
.build("key", "parameters", "typeAnnotation")
.field("key", def("Expression"))
.field("computed", Boolean, defaults["false"])
.field("optional", Boolean, defaults["false"])
.field("parameters", ParametersType);
def("TSTypePredicate")
.bases("TSTypeAnnotation", "TSType")
.build("parameterName", "typeAnnotation", "asserts")
.field("parameterName", or(def("Identifier"), def("TSThisType")))
.field("typeAnnotation", or(def("TSTypeAnnotation"), null), defaults["null"])
.field("asserts", Boolean, defaults["false"]);
["TSCallSignatureDeclaration",
"TSConstructSignatureDeclaration",
].forEach(function (typeName) {
def(typeName)
.bases("Declaration", "TSHasOptionalTypeParameters", "TSHasOptionalTypeAnnotation")
.build("parameters", "typeAnnotation")
.field("parameters", ParametersType);
});
def("TSEnumMember")
.bases("Node")
.build("id", "initializer")
.field("id", or(def("Identifier"), StringLiteral))
.field("initializer", or(def("Expression"), null), defaults["null"]);
def("TSTypeQuery")
.bases("TSType")
.build("exprName")
.field("exprName", or(TSEntityName, def("TSImportType")));
// Inferred from Babylon's tsParseTypeMember method.
var TSTypeMember = or(def("TSCallSignatureDeclaration"), def("TSConstructSignatureDeclaration"), def("TSIndexSignature"), def("TSMethodSignature"), def("TSPropertySignature"));
def("TSTypeLiteral")
.bases("TSType")
.build("members")
.field("members", [TSTypeMember]);
def("TSTypeParameter")
.bases("Identifier")
.build("name", "constraint", "default")
.field("name", or(def("Identifier"), String))
.field("constraint", or(def("TSType"), void 0), defaults["undefined"])
.field("default", or(def("TSType"), void 0), defaults["undefined"]);
def("TSTypeAssertion")
.bases("Expression", "Pattern")
.build("typeAnnotation", "expression")
.field("typeAnnotation", def("TSType"))
.field("expression", def("Expression"))
.field("extra", or({ parenthesized: Boolean }, null), defaults["null"]);
def("TSTypeParameterDeclaration")
.bases("Declaration")
.build("params")
.field("params", [def("TSTypeParameter")]);
def("TSInstantiationExpression")
.bases("Expression", "TSHasOptionalTypeParameterInstantiation")
.build("expression", "typeParameters")
.field("expression", def("Expression"));
def("TSTypeParameterInstantiation")
.bases("Node")
.build("params")
.field("params", [def("TSType")]);
def("TSEnumDeclaration")
.bases("Declaration")
.build("id", "members")
.field("id", def("Identifier"))
.field("const", Boolean, defaults["false"])
.field("declare", Boolean, defaults["false"])
.field("members", [def("TSEnumMember")])
.field("initializer", or(def("Expression"), null), defaults["null"]);
def("TSTypeAliasDeclaration")
.bases("Declaration", "TSHasOptionalTypeParameters")
.build("id", "typeAnnotation")
.field("id", def("Identifier"))
.field("declare", Boolean, defaults["false"])
.field("typeAnnotation", def("TSType"));
def("TSModuleBlock")
.bases("Node")
.build("body")
.field("body", [def("Statement")]);
def("TSModuleDeclaration")
.bases("Declaration")
.build("id", "body")
.field("id", or(StringLiteral, TSEntityName))
.field("declare", Boolean, defaults["false"])
.field("global", Boolean, defaults["false"])
.field("body", or(def("TSModuleBlock"), def("TSModuleDeclaration"), null), defaults["null"]);
def("TSImportType")
.bases("TSType", "TSHasOptionalTypeParameterInstantiation")
.build("argument", "qualifier", "typeParameters")
.field("argument", StringLiteral)
.field("qualifier", or(TSEntityName, void 0), defaults["undefined"]);
def("TSImportEqualsDeclaration")
.bases("Declaration")
.build("id", "moduleReference")
.field("id", def("Identifier"))
.field("isExport", Boolean, defaults["false"])
.field("moduleReference", or(TSEntityName, def("TSExternalModuleReference")));
def("TSExternalModuleReference")
.bases("Declaration")
.build("expression")
.field("expression", StringLiteral);
def("TSExportAssignment")
.bases("Statement")
.build("expression")
.field("expression", def("Expression"));
def("TSNamespaceExportDeclaration")
.bases("Declaration")
.build("id")
.field("id", def("Identifier"));
def("TSInterfaceBody")
.bases("Node")
.build("body")
.field("body", [TSTypeMember]);
def("TSExpressionWithTypeArguments")
.bases("TSType", "TSHasOptionalTypeParameterInstantiation")
.build("expression", "typeParameters")
.field("expression", TSEntityName);
def("TSInterfaceDeclaration")
.bases("Declaration", "TSHasOptionalTypeParameters")
.build("id", "body")
.field("id", TSEntityName)
.field("declare", Boolean, defaults["false"])
.field("extends", or([def("TSExpressionWithTypeArguments")], null), defaults["null"])
.field("body", def("TSInterfaceBody"));
def("TSParameterProperty")
.bases("Pattern")
.build("parameter")
.field("accessibility", or("public", "private", "protected", void 0), defaults["undefined"])
.field("readonly", Boolean, defaults["false"])
.field("parameter", or(def("Identifier"), def("AssignmentPattern")));
def("ClassProperty")
.field("access", // Not "accessibility"?
or("public", "private", "protected", void 0), defaults["undefined"]);
def("ClassAccessorProperty")
.bases("Declaration", "TSHasOptionalTypeAnnotation");
// Defined already in es6 and babel-core.
def("ClassBody")
.field("body", [or(def("MethodDefinition"), def("VariableDeclarator"), def("ClassPropertyDefinition"), def("ClassProperty"), def("ClassPrivateProperty"), def("ClassAccessorProperty"), def("ClassMethod"), def("ClassPrivateMethod"), def("StaticBlock"),
// Just need to add these types:
def("TSDeclareMethod"), TSTypeMember)]);
}
exports["default"] = default_1;
;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=typescript.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/equiv.js":
/*!*********************************************!*\
!*** ./node_modules/ast-types/lib/equiv.js ***!
\*********************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var shared_1 = __webpack_require__(/*! ./shared */ "./node_modules/ast-types/lib/shared.js");
var types_1 = tslib_1.__importDefault(__webpack_require__(/*! ./types */ "./node_modules/ast-types/lib/types.js"));
function default_1(fork) {
var types = fork.use(types_1.default);
var getFieldNames = types.getFieldNames;
var getFieldValue = types.getFieldValue;
var isArray = types.builtInTypes.array;
var isObject = types.builtInTypes.object;
var isDate = types.builtInTypes.Date;
var isRegExp = types.builtInTypes.RegExp;
var hasOwn = Object.prototype.hasOwnProperty;
function astNodesAreEquivalent(a, b, problemPath) {
if (isArray.check(problemPath)) {
problemPath.length = 0;
}
else {
problemPath = null;
}
return areEquivalent(a, b, problemPath);
}
astNodesAreEquivalent.assert = function (a, b) {
var problemPath = [];
if (!astNodesAreEquivalent(a, b, problemPath)) {
if (problemPath.length === 0) {
if (a !== b) {
throw new Error("Nodes must be equal");
}
}
else {
throw new Error("Nodes differ in the following path: " +
problemPath.map(subscriptForProperty).join(""));
}
}
};
function subscriptForProperty(property) {
if (/[_$a-z][_$a-z0-9]*/i.test(property)) {
return "." + property;
}
return "[" + JSON.stringify(property) + "]";
}
function areEquivalent(a, b, problemPath) {
if (a === b) {
return true;
}
if (isArray.check(a)) {
return arraysAreEquivalent(a, b, problemPath);
}
if (isObject.check(a)) {
return objectsAreEquivalent(a, b, problemPath);
}
if (isDate.check(a)) {
return isDate.check(b) && (+a === +b);
}
if (isRegExp.check(a)) {
return isRegExp.check(b) && (a.source === b.source &&
a.global === b.global &&
a.multiline === b.multiline &&
a.ignoreCase === b.ignoreCase);
}
return a == b;
}
function arraysAreEquivalent(a, b, problemPath) {
isArray.assert(a);
var aLength = a.length;
if (!isArray.check(b) || b.length !== aLength) {
if (problemPath) {
problemPath.push("length");
}
return false;
}
for (var i = 0; i < aLength; ++i) {
if (problemPath) {
problemPath.push(i);
}
if (i in a !== i in b) {
return false;
}
if (!areEquivalent(a[i], b[i], problemPath)) {
return false;
}
if (problemPath) {
var problemPathTail = problemPath.pop();
if (problemPathTail !== i) {
throw new Error("" + problemPathTail);
}
}
}
return true;
}
function objectsAreEquivalent(a, b, problemPath) {
isObject.assert(a);
if (!isObject.check(b)) {
return false;
}
// Fast path for a common property of AST nodes.
if (a.type !== b.type) {
if (problemPath) {
problemPath.push("type");
}
return false;
}
var aNames = getFieldNames(a);
var aNameCount = aNames.length;
var bNames = getFieldNames(b);
var bNameCount = bNames.length;
if (aNameCount === bNameCount) {
for (var i = 0; i < aNameCount; ++i) {
var name = aNames[i];
var aChild = getFieldValue(a, name);
var bChild = getFieldValue(b, name);
if (problemPath) {
problemPath.push(name);
}
if (!areEquivalent(aChild, bChild, problemPath)) {
return false;
}
if (problemPath) {
var problemPathTail = problemPath.pop();
if (problemPathTail !== name) {
throw new Error("" + problemPathTail);
}
}
}
return true;
}
if (!problemPath) {
return false;
}
// Since aNameCount !== bNameCount, we need to find some name that's
// missing in aNames but present in bNames, or vice-versa.
var seenNames = Object.create(null);
for (i = 0; i < aNameCount; ++i) {
seenNames[aNames[i]] = true;
}
for (i = 0; i < bNameCount; ++i) {
name = bNames[i];
if (!hasOwn.call(seenNames, name)) {
problemPath.push(name);
return false;
}
delete seenNames[name];
}
for (name in seenNames) {
problemPath.push(name);
break;
}
return false;
}
return astNodesAreEquivalent;
}
exports["default"] = default_1;
;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=equiv.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/fork.js":
/*!********************************************!*\
!*** ./node_modules/ast-types/lib/fork.js ***!
\********************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var types_1 = tslib_1.__importDefault(__webpack_require__(/*! ./types */ "./node_modules/ast-types/lib/types.js"));
var path_visitor_1 = tslib_1.__importDefault(__webpack_require__(/*! ./path-visitor */ "./node_modules/ast-types/lib/path-visitor.js"));
var equiv_1 = tslib_1.__importDefault(__webpack_require__(/*! ./equiv */ "./node_modules/ast-types/lib/equiv.js"));
var path_1 = tslib_1.__importDefault(__webpack_require__(/*! ./path */ "./node_modules/ast-types/lib/path.js"));
var node_path_1 = tslib_1.__importDefault(__webpack_require__(/*! ./node-path */ "./node_modules/ast-types/lib/node-path.js"));
var shared_1 = __webpack_require__(/*! ./shared */ "./node_modules/ast-types/lib/shared.js");
function default_1(plugins) {
var fork = createFork();
var types = fork.use(types_1.default);
plugins.forEach(fork.use);
types.finalize();
var PathVisitor = fork.use(path_visitor_1.default);
return {
Type: types.Type,
builtInTypes: types.builtInTypes,
namedTypes: types.namedTypes,
builders: types.builders,
defineMethod: types.defineMethod,
getFieldNames: types.getFieldNames,
getFieldValue: types.getFieldValue,
eachField: types.eachField,
someField: types.someField,
getSupertypeNames: types.getSupertypeNames,
getBuilderName: types.getBuilderName,
astNodesAreEquivalent: fork.use(equiv_1.default),
finalize: types.finalize,
Path: fork.use(path_1.default),
NodePath: fork.use(node_path_1.default),
PathVisitor: PathVisitor,
use: fork.use,
visit: PathVisitor.visit,
};
}
exports["default"] = default_1;
;
function createFork() {
var used = [];
var usedResult = [];
function use(plugin) {
var idx = used.indexOf(plugin);
if (idx === -1) {
idx = used.length;
used.push(plugin);
usedResult[idx] = plugin(fork);
}
return usedResult[idx];
}
var fork = { use: use };
return fork;
}
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=fork.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/gen/namedTypes.js":
/*!******************************************************!*\
!*** ./node_modules/ast-types/lib/gen/namedTypes.js ***!
\******************************************************/
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.namedTypes = void 0;
var namedTypes;
(function (namedTypes) {
})(namedTypes = exports.namedTypes || (exports.namedTypes = {}));
//# sourceMappingURL=namedTypes.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/main.js":
/*!********************************************!*\
!*** ./node_modules/ast-types/lib/main.js ***!
\********************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.visit = exports.use = exports.Type = exports.someField = exports.PathVisitor = exports.Path = exports.NodePath = exports.namedTypes = exports.getSupertypeNames = exports.getFieldValue = exports.getFieldNames = exports.getBuilderName = exports.finalize = exports.eachField = exports.defineMethod = exports.builtInTypes = exports.builders = exports.astNodesAreEquivalent = void 0;
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var fork_1 = tslib_1.__importDefault(__webpack_require__(/*! ./fork */ "./node_modules/ast-types/lib/fork.js"));
var es_proposals_1 = tslib_1.__importDefault(__webpack_require__(/*! ./def/es-proposals */ "./node_modules/ast-types/lib/def/es-proposals.js"));
var jsx_1 = tslib_1.__importDefault(__webpack_require__(/*! ./def/jsx */ "./node_modules/ast-types/lib/def/jsx.js"));
var flow_1 = tslib_1.__importDefault(__webpack_require__(/*! ./def/flow */ "./node_modules/ast-types/lib/def/flow.js"));
var esprima_1 = tslib_1.__importDefault(__webpack_require__(/*! ./def/esprima */ "./node_modules/ast-types/lib/def/esprima.js"));
var babel_1 = tslib_1.__importDefault(__webpack_require__(/*! ./def/babel */ "./node_modules/ast-types/lib/def/babel.js"));
var typescript_1 = tslib_1.__importDefault(__webpack_require__(/*! ./def/typescript */ "./node_modules/ast-types/lib/def/typescript.js"));
var namedTypes_1 = __webpack_require__(/*! ./gen/namedTypes */ "./node_modules/ast-types/lib/gen/namedTypes.js");
Object.defineProperty(exports, "namedTypes", ({ enumerable: true, get: function () { return namedTypes_1.namedTypes; } }));
var _a = (0, fork_1.default)([
// Feel free to add to or remove from this list of extension modules to
// configure the precise type hierarchy that you need.
es_proposals_1.default,
jsx_1.default,
flow_1.default,
esprima_1.default,
babel_1.default,
typescript_1.default,
]), astNodesAreEquivalent = _a.astNodesAreEquivalent, builders = _a.builders, builtInTypes = _a.builtInTypes, defineMethod = _a.defineMethod, eachField = _a.eachField, finalize = _a.finalize, getBuilderName = _a.getBuilderName, getFieldNames = _a.getFieldNames, getFieldValue = _a.getFieldValue, getSupertypeNames = _a.getSupertypeNames, n = _a.namedTypes, NodePath = _a.NodePath, Path = _a.Path, PathVisitor = _a.PathVisitor, someField = _a.someField, Type = _a.Type, use = _a.use, visit = _a.visit;
exports.astNodesAreEquivalent = astNodesAreEquivalent;
exports.builders = builders;
exports.builtInTypes = builtInTypes;
exports.defineMethod = defineMethod;
exports.eachField = eachField;
exports.finalize = finalize;
exports.getBuilderName = getBuilderName;
exports.getFieldNames = getFieldNames;
exports.getFieldValue = getFieldValue;
exports.getSupertypeNames = getSupertypeNames;
exports.NodePath = NodePath;
exports.Path = Path;
exports.PathVisitor = PathVisitor;
exports.someField = someField;
exports.Type = Type;
exports.use = use;
exports.visit = visit;
// Populate the exported fields of the namedTypes namespace, while still
// retaining its member types.
Object.assign(namedTypes_1.namedTypes, n);
//# sourceMappingURL=main.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/node-path.js":
/*!*************************************************!*\
!*** ./node_modules/ast-types/lib/node-path.js ***!
\*************************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var types_1 = tslib_1.__importDefault(__webpack_require__(/*! ./types */ "./node_modules/ast-types/lib/types.js"));
var path_1 = tslib_1.__importDefault(__webpack_require__(/*! ./path */ "./node_modules/ast-types/lib/path.js"));
var scope_1 = tslib_1.__importDefault(__webpack_require__(/*! ./scope */ "./node_modules/ast-types/lib/scope.js"));
var shared_1 = __webpack_require__(/*! ./shared */ "./node_modules/ast-types/lib/shared.js");
function nodePathPlugin(fork) {
var types = fork.use(types_1.default);
var n = types.namedTypes;
var b = types.builders;
var isNumber = types.builtInTypes.number;
var isArray = types.builtInTypes.array;
var Path = fork.use(path_1.default);
var Scope = fork.use(scope_1.default);
var NodePath = function NodePath(value, parentPath, name) {
if (!(this instanceof NodePath)) {
throw new Error("NodePath constructor cannot be invoked without 'new'");
}
Path.call(this, value, parentPath, name);
};
var NPp = NodePath.prototype = Object.create(Path.prototype, {
constructor: {
value: NodePath,
enumerable: false,
writable: true,
configurable: true
}
});
Object.defineProperties(NPp, {
node: {
get: function () {
Object.defineProperty(this, "node", {
configurable: true,
value: this._computeNode()
});
return this.node;
}
},
parent: {
get: function () {
Object.defineProperty(this, "parent", {
configurable: true,
value: this._computeParent()
});
return this.parent;
}
},
scope: {
get: function () {
Object.defineProperty(this, "scope", {
configurable: true,
value: this._computeScope()
});
return this.scope;
}
}
});
NPp.replace = function () {
delete this.node;
delete this.parent;
delete this.scope;
return Path.prototype.replace.apply(this, arguments);
};
NPp.prune = function () {
var remainingNodePath = this.parent;
this.replace();
return cleanUpNodesAfterPrune(remainingNodePath);
};
// The value of the first ancestor Path whose value is a Node.
NPp._computeNode = function () {
var value = this.value;
if (n.Node.check(value)) {
return value;
}
var pp = this.parentPath;
return pp && pp.node || null;
};
// The first ancestor Path whose value is a Node distinct from this.node.
NPp._computeParent = function () {
var value = this.value;
var pp = this.parentPath;
if (!n.Node.check(value)) {
while (pp && !n.Node.check(pp.value)) {
pp = pp.parentPath;
}
if (pp) {
pp = pp.parentPath;
}
}
while (pp && !n.Node.check(pp.value)) {
pp = pp.parentPath;
}
return pp || null;
};
// The closest enclosing scope that governs this node.
NPp._computeScope = function () {
var value = this.value;
var pp = this.parentPath;
var scope = pp && pp.scope;
if (n.Node.check(value) &&
Scope.isEstablishedBy(value)) {
scope = new Scope(this, scope);
}
return scope || null;
};
NPp.getValueProperty = function (name) {
return types.getFieldValue(this.value, name);
};
/**
* Determine whether this.node needs to be wrapped in parentheses in order
* for a parser to reproduce the same local AST structure.
*
* For instance, in the expression `(1 + 2) * 3`, the BinaryExpression
* whose operator is "+" needs parentheses, because `1 + 2 * 3` would
* parse differently.
*
* If assumeExpressionContext === true, we don't worry about edge cases
* like an anonymous FunctionExpression appearing lexically first in its
* enclosing statement and thus needing parentheses to avoid being parsed
* as a FunctionDeclaration with a missing name.
*/
NPp.needsParens = function (assumeExpressionContext) {
var pp = this.parentPath;
if (!pp) {
return false;
}
var node = this.value;
// Only expressions need parentheses.
if (!n.Expression.check(node)) {
return false;
}
// Identifiers never need parentheses.
if (node.type === "Identifier") {
return false;
}
while (!n.Node.check(pp.value)) {
pp = pp.parentPath;
if (!pp) {
return false;
}
}
var parent = pp.value;
switch (node.type) {
case "UnaryExpression":
case "SpreadElement":
case "SpreadProperty":
return parent.type === "MemberExpression"
&& this.name === "object"
&& parent.object === node;
case "BinaryExpression":
case "LogicalExpression":
switch (parent.type) {
case "CallExpression":
return this.name === "callee"
&& parent.callee === node;
case "UnaryExpression":
case "SpreadElement":
case "SpreadProperty":
return true;
case "MemberExpression":
return this.name === "object"
&& parent.object === node;
case "BinaryExpression":
case "LogicalExpression": {
var n_1 = node;
var po = parent.operator;
var pp_1 = PRECEDENCE[po];
var no = n_1.operator;
var np = PRECEDENCE[no];
if (pp_1 > np) {
return true;
}
if (pp_1 === np && this.name === "right") {
if (parent.right !== n_1) {
throw new Error("Nodes must be equal");
}
return true;
}
}
default:
return false;
}
case "SequenceExpression":
switch (parent.type) {
case "ForStatement":
// Although parentheses wouldn't hurt around sequence
// expressions in the head of for loops, traditional style
// dictates that e.g. i++, j++ should not be wrapped with
// parentheses.
return false;
case "ExpressionStatement":
return this.name !== "expression";
default:
// Otherwise err on the side of overparenthesization, adding
// explicit exceptions above if this proves overzealous.
return true;
}
case "YieldExpression":
switch (parent.type) {
case "BinaryExpression":
case "LogicalExpression":
case "UnaryExpression":
case "SpreadElement":
case "SpreadProperty":
case "CallExpression":
case "MemberExpression":
case "NewExpression":
case "ConditionalExpression":
case "YieldExpression":
return true;
default:
return false;
}
case "Literal":
return parent.type === "MemberExpression"
&& isNumber.check(node.value)
&& this.name === "object"
&& parent.object === node;
case "AssignmentExpression":
case "ConditionalExpression":
switch (parent.type) {
case "UnaryExpression":
case "SpreadElement":
case "SpreadProperty":
case "BinaryExpression":
case "LogicalExpression":
return true;
case "CallExpression":
return this.name === "callee"
&& parent.callee === node;
case "ConditionalExpression":
return this.name === "test"
&& parent.test === node;
case "MemberExpression":
return this.name === "object"
&& parent.object === node;
default:
return false;
}
default:
if (parent.type === "NewExpression" &&
this.name === "callee" &&
parent.callee === node) {
return containsCallExpression(node);
}
}
if (assumeExpressionContext !== true &&
!this.canBeFirstInStatement() &&
this.firstInStatement())
return true;
return false;
};
function isBinary(node) {
return n.BinaryExpression.check(node)
|| n.LogicalExpression.check(node);
}
// @ts-ignore 'isUnaryLike' is declared but its value is never read. [6133]
function isUnaryLike(node) {
return n.UnaryExpression.check(node)
// I considered making SpreadElement and SpreadProperty subtypes
// of UnaryExpression, but they're not really Expression nodes.
|| (n.SpreadElement && n.SpreadElement.check(node))
|| (n.SpreadProperty && n.SpreadProperty.check(node));
}
var PRECEDENCE = {};
[["||"],
["&&"],
["|"],
["^"],
["&"],
["==", "===", "!=", "!=="],
["<", ">", "<=", ">=", "in", "instanceof"],
[">>", "<<", ">>>"],
["+", "-"],
["*", "/", "%"]
].forEach(function (tier, i) {
tier.forEach(function (op) {
PRECEDENCE[op] = i;
});
});
function containsCallExpression(node) {
if (n.CallExpression.check(node)) {
return true;
}
if (isArray.check(node)) {
return node.some(containsCallExpression);
}
if (n.Node.check(node)) {
return types.someField(node, function (_name, child) {
return containsCallExpression(child);
});
}
return false;
}
NPp.canBeFirstInStatement = function () {
var node = this.node;
return !n.FunctionExpression.check(node)
&& !n.ObjectExpression.check(node);
};
NPp.firstInStatement = function () {
return firstInStatement(this);
};
function firstInStatement(path) {
for (var node, parent; path.parent; path = path.parent) {
node = path.node;
parent = path.parent.node;
if (n.BlockStatement.check(parent) &&
path.parent.name === "body" &&
path.name === 0) {
if (parent.body[0] !== node) {
throw new Error("Nodes must be equal");
}
return true;
}
if (n.ExpressionStatement.check(parent) &&
path.name === "expression") {
if (parent.expression !== node) {
throw new Error("Nodes must be equal");
}
return true;
}
if (n.SequenceExpression.check(parent) &&
path.parent.name === "expressions" &&
path.name === 0) {
if (parent.expressions[0] !== node) {
throw new Error("Nodes must be equal");
}
continue;
}
if (n.CallExpression.check(parent) &&
path.name === "callee") {
if (parent.callee !== node) {
throw new Error("Nodes must be equal");
}
continue;
}
if (n.MemberExpression.check(parent) &&
path.name === "object") {
if (parent.object !== node) {
throw new Error("Nodes must be equal");
}
continue;
}
if (n.ConditionalExpression.check(parent) &&
path.name === "test") {
if (parent.test !== node) {
throw new Error("Nodes must be equal");
}
continue;
}
if (isBinary(parent) &&
path.name === "left") {
if (parent.left !== node) {
throw new Error("Nodes must be equal");
}
continue;
}
if (n.UnaryExpression.check(parent) &&
!parent.prefix &&
path.name === "argument") {
if (parent.argument !== node) {
throw new Error("Nodes must be equal");
}
continue;
}
return false;
}
return true;
}
/**
* Pruning certain nodes will result in empty or incomplete nodes, here we clean those nodes up.
*/
function cleanUpNodesAfterPrune(remainingNodePath) {
if (n.VariableDeclaration.check(remainingNodePath.node)) {
var declarations = remainingNodePath.get('declarations').value;
if (!declarations || declarations.length === 0) {
return remainingNodePath.prune();
}
}
else if (n.ExpressionStatement.check(remainingNodePath.node)) {
if (!remainingNodePath.get('expression').value) {
return remainingNodePath.prune();
}
}
else if (n.IfStatement.check(remainingNodePath.node)) {
cleanUpIfStatementAfterPrune(remainingNodePath);
}
return remainingNodePath;
}
function cleanUpIfStatementAfterPrune(ifStatement) {
var testExpression = ifStatement.get('test').value;
var alternate = ifStatement.get('alternate').value;
var consequent = ifStatement.get('consequent').value;
if (!consequent && !alternate) {
var testExpressionStatement = b.expressionStatement(testExpression);
ifStatement.replace(testExpressionStatement);
}
else if (!consequent && alternate) {
var negatedTestExpression = b.unaryExpression('!', testExpression, true);
if (n.UnaryExpression.check(testExpression) && testExpression.operator === '!') {
negatedTestExpression = testExpression.argument;
}
ifStatement.get("test").replace(negatedTestExpression);
ifStatement.get("consequent").replace(alternate);
ifStatement.get("alternate").replace();
}
}
return NodePath;
}
exports["default"] = nodePathPlugin;
;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=node-path.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/path-visitor.js":
/*!****************************************************!*\
!*** ./node_modules/ast-types/lib/path-visitor.js ***!
\****************************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var types_1 = tslib_1.__importDefault(__webpack_require__(/*! ./types */ "./node_modules/ast-types/lib/types.js"));
var node_path_1 = tslib_1.__importDefault(__webpack_require__(/*! ./node-path */ "./node_modules/ast-types/lib/node-path.js"));
var shared_1 = __webpack_require__(/*! ./shared */ "./node_modules/ast-types/lib/shared.js");
var hasOwn = Object.prototype.hasOwnProperty;
function pathVisitorPlugin(fork) {
var types = fork.use(types_1.default);
var NodePath = fork.use(node_path_1.default);
var isArray = types.builtInTypes.array;
var isObject = types.builtInTypes.object;
var isFunction = types.builtInTypes.function;
var undefined;
var PathVisitor = function PathVisitor() {
if (!(this instanceof PathVisitor)) {
throw new Error("PathVisitor constructor cannot be invoked without 'new'");
}
// Permanent state.
this._reusableContextStack = [];
this._methodNameTable = computeMethodNameTable(this);
this._shouldVisitComments =
hasOwn.call(this._methodNameTable, "Block") ||
hasOwn.call(this._methodNameTable, "Line");
this.Context = makeContextConstructor(this);
// State reset every time PathVisitor.prototype.visit is called.
this._visiting = false;
this._changeReported = false;
};
function computeMethodNameTable(visitor) {
var typeNames = Object.create(null);
for (var methodName in visitor) {
if (/^visit[A-Z]/.test(methodName)) {
typeNames[methodName.slice("visit".length)] = true;
}
}
var supertypeTable = types.computeSupertypeLookupTable(typeNames);
var methodNameTable = Object.create(null);
var typeNameKeys = Object.keys(supertypeTable);
var typeNameCount = typeNameKeys.length;
for (var i = 0; i < typeNameCount; ++i) {
var typeName = typeNameKeys[i];
methodName = "visit" + supertypeTable[typeName];
if (isFunction.check(visitor[methodName])) {
methodNameTable[typeName] = methodName;
}
}
return methodNameTable;
}
PathVisitor.fromMethodsObject = function fromMethodsObject(methods) {
if (methods instanceof PathVisitor) {
return methods;
}
if (!isObject.check(methods)) {
// An empty visitor?
return new PathVisitor;
}
var Visitor = function Visitor() {
if (!(this instanceof Visitor)) {
throw new Error("Visitor constructor cannot be invoked without 'new'");
}
PathVisitor.call(this);
};
var Vp = Visitor.prototype = Object.create(PVp);
Vp.constructor = Visitor;
extend(Vp, methods);
extend(Visitor, PathVisitor);
isFunction.assert(Visitor.fromMethodsObject);
isFunction.assert(Visitor.visit);
return new Visitor;
};
function extend(target, source) {
for (var property in source) {
if (hasOwn.call(source, property)) {
target[property] = source[property];
}
}
return target;
}
PathVisitor.visit = function visit(node, methods) {
return PathVisitor.fromMethodsObject(methods).visit(node);
};
var PVp = PathVisitor.prototype;
PVp.visit = function () {
if (this._visiting) {
throw new Error("Recursively calling visitor.visit(path) resets visitor state. " +
"Try this.visit(path) or this.traverse(path) instead.");
}
// Private state that needs to be reset before every traversal.
this._visiting = true;
this._changeReported = false;
this._abortRequested = false;
var argc = arguments.length;
var args = new Array(argc);
for (var i = 0; i < argc; ++i) {
args[i] = arguments[i];
}
if (!(args[0] instanceof NodePath)) {
args[0] = new NodePath({ root: args[0] }).get("root");
}
// Called with the same arguments as .visit.
this.reset.apply(this, args);
var didNotThrow;
try {
var root = this.visitWithoutReset(args[0]);
didNotThrow = true;
}
finally {
this._visiting = false;
if (!didNotThrow && this._abortRequested) {
// If this.visitWithoutReset threw an exception and
// this._abortRequested was set to true, return the root of
// the AST instead of letting the exception propagate, so that
// client code does not have to provide a try-catch block to
// intercept the AbortRequest exception. Other kinds of
// exceptions will propagate without being intercepted and
// rethrown by a catch block, so their stacks will accurately
// reflect the original throwing context.
return args[0].value;
}
}
return root;
};
PVp.AbortRequest = function AbortRequest() { };
PVp.abort = function () {
var visitor = this;
visitor._abortRequested = true;
var request = new visitor.AbortRequest();
// If you decide to catch this exception and stop it from propagating,
// make sure to call its cancel method to avoid silencing other
// exceptions that might be thrown later in the traversal.
request.cancel = function () {
visitor._abortRequested = false;
};
throw request;
};
PVp.reset = function (_path /*, additional arguments */) {
// Empty stub; may be reassigned or overridden by subclasses.
};
PVp.visitWithoutReset = function (path) {
if (this instanceof this.Context) {
// Since this.Context.prototype === this, there's a chance we
// might accidentally call context.visitWithoutReset. If that
// happens, re-invoke the method against context.visitor.
return this.visitor.visitWithoutReset(path);
}
if (!(path instanceof NodePath)) {
throw new Error("");
}
var value = path.value;
var methodName = value &&
typeof value === "object" &&
typeof value.type === "string" &&
this._methodNameTable[value.type];
if (methodName) {
var context = this.acquireContext(path);
try {
return context.invokeVisitorMethod(methodName);
}
finally {
this.releaseContext(context);
}
}
else {
// If there was no visitor method to call, visit the children of
// this node generically.
return visitChildren(path, this);
}
};
function visitChildren(path, visitor) {
if (!(path instanceof NodePath)) {
throw new Error("");
}
if (!(visitor instanceof PathVisitor)) {
throw new Error("");
}
var value = path.value;
if (isArray.check(value)) {
path.each(visitor.visitWithoutReset, visitor);
}
else if (!isObject.check(value)) {
// No children to visit.
}
else {
var childNames = types.getFieldNames(value);
// The .comments field of the Node type is hidden, so we only
// visit it if the visitor defines visitBlock or visitLine, and
// value.comments is defined.
if (visitor._shouldVisitComments &&
value.comments &&
childNames.indexOf("comments") < 0) {
childNames.push("comments");
}
var childCount = childNames.length;
var childPaths = [];
for (var i = 0; i < childCount; ++i) {
var childName = childNames[i];
if (!hasOwn.call(value, childName)) {
value[childName] = types.getFieldValue(value, childName);
}
childPaths.push(path.get(childName));
}
for (var i = 0; i < childCount; ++i) {
visitor.visitWithoutReset(childPaths[i]);
}
}
return path.value;
}
PVp.acquireContext = function (path) {
if (this._reusableContextStack.length === 0) {
return new this.Context(path);
}
return this._reusableContextStack.pop().reset(path);
};
PVp.releaseContext = function (context) {
if (!(context instanceof this.Context)) {
throw new Error("");
}
this._reusableContextStack.push(context);
context.currentPath = null;
};
PVp.reportChanged = function () {
this._changeReported = true;
};
PVp.wasChangeReported = function () {
return this._changeReported;
};
function makeContextConstructor(visitor) {
function Context(path) {
if (!(this instanceof Context)) {
throw new Error("");
}
if (!(this instanceof PathVisitor)) {
throw new Error("");
}
if (!(path instanceof NodePath)) {
throw new Error("");
}
Object.defineProperty(this, "visitor", {
value: visitor,
writable: false,
enumerable: true,
configurable: false
});
this.currentPath = path;
this.needToCallTraverse = true;
Object.seal(this);
}
if (!(visitor instanceof PathVisitor)) {
throw new Error("");
}
// Note that the visitor object is the prototype of Context.prototype,
// so all visitor methods are inherited by context objects.
var Cp = Context.prototype = Object.create(visitor);
Cp.constructor = Context;
extend(Cp, sharedContextProtoMethods);
return Context;
}
// Every PathVisitor has a different this.Context constructor and
// this.Context.prototype object, but those prototypes can all use the
// same reset, invokeVisitorMethod, and traverse function objects.
var sharedContextProtoMethods = Object.create(null);
sharedContextProtoMethods.reset =
function reset(path) {
if (!(this instanceof this.Context)) {
throw new Error("");
}
if (!(path instanceof NodePath)) {
throw new Error("");
}
this.currentPath = path;
this.needToCallTraverse = true;
return this;
};
sharedContextProtoMethods.invokeVisitorMethod =
function invokeVisitorMethod(methodName) {
if (!(this instanceof this.Context)) {
throw new Error("");
}
if (!(this.currentPath instanceof NodePath)) {
throw new Error("");
}
var result = this.visitor[methodName].call(this, this.currentPath);
if (result === false) {
// Visitor methods return false to indicate that they have handled
// their own traversal needs, and we should not complain if
// this.needToCallTraverse is still true.
this.needToCallTraverse = false;
}
else if (result !== undefined) {
// Any other non-undefined value returned from the visitor method
// is interpreted as a replacement value.
this.currentPath = this.currentPath.replace(result)[0];
if (this.needToCallTraverse) {
// If this.traverse still hasn't been called, visit the
// children of the replacement node.
this.traverse(this.currentPath);
}
}
if (this.needToCallTraverse !== false) {
throw new Error("Must either call this.traverse or return false in " + methodName);
}
var path = this.currentPath;
return path && path.value;
};
sharedContextProtoMethods.traverse =
function traverse(path, newVisitor) {
if (!(this instanceof this.Context)) {
throw new Error("");
}
if (!(path instanceof NodePath)) {
throw new Error("");
}
if (!(this.currentPath instanceof NodePath)) {
throw new Error("");
}
this.needToCallTraverse = false;
return visitChildren(path, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
};
sharedContextProtoMethods.visit =
function visit(path, newVisitor) {
if (!(this instanceof this.Context)) {
throw new Error("");
}
if (!(path instanceof NodePath)) {
throw new Error("");
}
if (!(this.currentPath instanceof NodePath)) {
throw new Error("");
}
this.needToCallTraverse = false;
return PathVisitor.fromMethodsObject(newVisitor || this.visitor).visitWithoutReset(path);
};
sharedContextProtoMethods.reportChanged = function reportChanged() {
this.visitor.reportChanged();
};
sharedContextProtoMethods.abort = function abort() {
this.needToCallTraverse = false;
this.visitor.abort();
};
return PathVisitor;
}
exports["default"] = pathVisitorPlugin;
;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=path-visitor.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/path.js":
/*!********************************************!*\
!*** ./node_modules/ast-types/lib/path.js ***!
\********************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var shared_1 = __webpack_require__(/*! ./shared */ "./node_modules/ast-types/lib/shared.js");
var types_1 = tslib_1.__importDefault(__webpack_require__(/*! ./types */ "./node_modules/ast-types/lib/types.js"));
var Op = Object.prototype;
var hasOwn = Op.hasOwnProperty;
function pathPlugin(fork) {
var types = fork.use(types_1.default);
var isArray = types.builtInTypes.array;
var isNumber = types.builtInTypes.number;
var Path = function Path(value, parentPath, name) {
if (!(this instanceof Path)) {
throw new Error("Path constructor cannot be invoked without 'new'");
}
if (parentPath) {
if (!(parentPath instanceof Path)) {
throw new Error("");
}
}
else {
parentPath = null;
name = null;
}
// The value encapsulated by this Path, generally equal to
// parentPath.value[name] if we have a parentPath.
this.value = value;
// The immediate parent Path of this Path.
this.parentPath = parentPath;
// The name of the property of parentPath.value through which this
// Path's value was reached.
this.name = name;
// Calling path.get("child") multiple times always returns the same
// child Path object, for both performance and consistency reasons.
this.__childCache = null;
};
var Pp = Path.prototype;
function getChildCache(path) {
// Lazily create the child cache. This also cheapens cache
// invalidation, since you can just reset path.__childCache to null.
return path.__childCache || (path.__childCache = Object.create(null));
}
function getChildPath(path, name) {
var cache = getChildCache(path);
var actualChildValue = path.getValueProperty(name);
var childPath = cache[name];
if (!hasOwn.call(cache, name) ||
// Ensure consistency between cache and reality.
childPath.value !== actualChildValue) {
childPath = cache[name] = new path.constructor(actualChildValue, path, name);
}
return childPath;
}
// This method is designed to be overridden by subclasses that need to
// handle missing properties, etc.
Pp.getValueProperty = function getValueProperty(name) {
return this.value[name];
};
Pp.get = function get() {
var names = [];
for (var _i = 0; _i < arguments.length; _i++) {
names[_i] = arguments[_i];
}
var path = this;
var count = names.length;
for (var i = 0; i < count; ++i) {
path = getChildPath(path, names[i]);
}
return path;
};
Pp.each = function each(callback, context) {
var childPaths = [];
var len = this.value.length;
var i = 0;
// Collect all the original child paths before invoking the callback.
for (var i = 0; i < len; ++i) {
if (hasOwn.call(this.value, i)) {
childPaths[i] = this.get(i);
}
}
// Invoke the callback on just the original child paths, regardless of
// any modifications made to the array by the callback. I chose these
// semantics over cleverly invoking the callback on new elements because
// this way is much easier to reason about.
context = context || this;
for (i = 0; i < len; ++i) {
if (hasOwn.call(childPaths, i)) {
callback.call(context, childPaths[i]);
}
}
};
Pp.map = function map(callback, context) {
var result = [];
this.each(function (childPath) {
result.push(callback.call(this, childPath));
}, context);
return result;
};
Pp.filter = function filter(callback, context) {
var result = [];
this.each(function (childPath) {
if (callback.call(this, childPath)) {
result.push(childPath);
}
}, context);
return result;
};
function emptyMoves() { }
function getMoves(path, offset, start, end) {
isArray.assert(path.value);
if (offset === 0) {
return emptyMoves;
}
var length = path.value.length;
if (length < 1) {
return emptyMoves;
}
var argc = arguments.length;
if (argc === 2) {
start = 0;
end = length;
}
else if (argc === 3) {
start = Math.max(start, 0);
end = length;
}
else {
start = Math.max(start, 0);
end = Math.min(end, length);
}
isNumber.assert(start);
isNumber.assert(end);
var moves = Object.create(null);
var cache = getChildCache(path);
for (var i = start; i < end; ++i) {
if (hasOwn.call(path.value, i)) {
var childPath = path.get(i);
if (childPath.name !== i) {
throw new Error("");
}
var newIndex = i + offset;
childPath.name = newIndex;
moves[newIndex] = childPath;
delete cache[i];
}
}
delete cache.length;
return function () {
for (var newIndex in moves) {
var childPath = moves[newIndex];
if (childPath.name !== +newIndex) {
throw new Error("");
}
cache[newIndex] = childPath;
path.value[newIndex] = childPath.value;
}
};
}
Pp.shift = function shift() {
var move = getMoves(this, -1);
var result = this.value.shift();
move();
return result;
};
Pp.unshift = function unshift() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var move = getMoves(this, args.length);
var result = this.value.unshift.apply(this.value, args);
move();
return result;
};
Pp.push = function push() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
isArray.assert(this.value);
delete getChildCache(this).length;
return this.value.push.apply(this.value, args);
};
Pp.pop = function pop() {
isArray.assert(this.value);
var cache = getChildCache(this);
delete cache[this.value.length - 1];
delete cache.length;
return this.value.pop();
};
Pp.insertAt = function insertAt(index) {
var argc = arguments.length;
var move = getMoves(this, argc - 1, index);
if (move === emptyMoves && argc <= 1) {
return this;
}
index = Math.max(index, 0);
for (var i = 1; i < argc; ++i) {
this.value[index + i - 1] = arguments[i];
}
move();
return this;
};
Pp.insertBefore = function insertBefore() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var pp = this.parentPath;
var argc = args.length;
var insertAtArgs = [this.name];
for (var i = 0; i < argc; ++i) {
insertAtArgs.push(args[i]);
}
return pp.insertAt.apply(pp, insertAtArgs);
};
Pp.insertAfter = function insertAfter() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var pp = this.parentPath;
var argc = args.length;
var insertAtArgs = [this.name + 1];
for (var i = 0; i < argc; ++i) {
insertAtArgs.push(args[i]);
}
return pp.insertAt.apply(pp, insertAtArgs);
};
function repairRelationshipWithParent(path) {
if (!(path instanceof Path)) {
throw new Error("");
}
var pp = path.parentPath;
if (!pp) {
// Orphan paths have no relationship to repair.
return path;
}
var parentValue = pp.value;
var parentCache = getChildCache(pp);
// Make sure parentCache[path.name] is populated.
if (parentValue[path.name] === path.value) {
parentCache[path.name] = path;
}
else if (isArray.check(parentValue)) {
// Something caused path.name to become out of date, so attempt to
// recover by searching for path.value in parentValue.
var i = parentValue.indexOf(path.value);
if (i >= 0) {
parentCache[path.name = i] = path;
}
}
else {
// If path.value disagrees with parentValue[path.name], and
// path.name is not an array index, let path.value become the new
// parentValue[path.name] and update parentCache accordingly.
parentValue[path.name] = path.value;
parentCache[path.name] = path;
}
if (parentValue[path.name] !== path.value) {
throw new Error("");
}
if (path.parentPath.get(path.name) !== path) {
throw new Error("");
}
return path;
}
Pp.replace = function replace(replacement) {
var results = [];
var parentValue = this.parentPath.value;
var parentCache = getChildCache(this.parentPath);
var count = arguments.length;
repairRelationshipWithParent(this);
if (isArray.check(parentValue)) {
var originalLength = parentValue.length;
var move = getMoves(this.parentPath, count - 1, this.name + 1);
var spliceArgs = [this.name, 1];
for (var i = 0; i < count; ++i) {
spliceArgs.push(arguments[i]);
}
var splicedOut = parentValue.splice.apply(parentValue, spliceArgs);
if (splicedOut[0] !== this.value) {
throw new Error("");
}
if (parentValue.length !== (originalLength - 1 + count)) {
throw new Error("");
}
move();
if (count === 0) {
delete this.value;
delete parentCache[this.name];
this.__childCache = null;
}
else {
if (parentValue[this.name] !== replacement) {
throw new Error("");
}
if (this.value !== replacement) {
this.value = replacement;
this.__childCache = null;
}
for (i = 0; i < count; ++i) {
results.push(this.parentPath.get(this.name + i));
}
if (results[0] !== this) {
throw new Error("");
}
}
}
else if (count === 1) {
if (this.value !== replacement) {
this.__childCache = null;
}
this.value = parentValue[this.name] = replacement;
results.push(this);
}
else if (count === 0) {
delete parentValue[this.name];
delete this.value;
this.__childCache = null;
// Leave this path cached as parentCache[this.name], even though
// it no longer has a value defined.
}
else {
throw new Error("Could not replace path");
}
return results;
};
return Path;
}
exports["default"] = pathPlugin;
;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=path.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/scope.js":
/*!*********************************************!*\
!*** ./node_modules/ast-types/lib/scope.js ***!
\*********************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var shared_1 = __webpack_require__(/*! ./shared */ "./node_modules/ast-types/lib/shared.js");
var types_1 = tslib_1.__importDefault(__webpack_require__(/*! ./types */ "./node_modules/ast-types/lib/types.js"));
var hasOwn = Object.prototype.hasOwnProperty;
function scopePlugin(fork) {
var types = fork.use(types_1.default);
var Type = types.Type;
var namedTypes = types.namedTypes;
var Node = namedTypes.Node;
var Expression = namedTypes.Expression;
var isArray = types.builtInTypes.array;
var b = types.builders;
var Scope = function Scope(path, parentScope) {
if (!(this instanceof Scope)) {
throw new Error("Scope constructor cannot be invoked without 'new'");
}
if (!TypeParameterScopeType.check(path.value)) {
ScopeType.assert(path.value);
}
var depth;
if (parentScope) {
if (!(parentScope instanceof Scope)) {
throw new Error("");
}
depth = parentScope.depth + 1;
}
else {
parentScope = null;
depth = 0;
}
Object.defineProperties(this, {
path: { value: path },
node: { value: path.value },
isGlobal: { value: !parentScope, enumerable: true },
depth: { value: depth },
parent: { value: parentScope },
bindings: { value: {} },
types: { value: {} },
});
};
var ScopeType = Type.or(
// Program nodes introduce global scopes.
namedTypes.Program,
// Function is the supertype of FunctionExpression,
// FunctionDeclaration, ArrowExpression, etc.
namedTypes.Function,
// In case you didn't know, the caught parameter shadows any variable
// of the same name in an outer scope.
namedTypes.CatchClause);
// These types introduce scopes that are restricted to type parameters in
// Flow (this doesn't apply to ECMAScript).
var TypeParameterScopeType = Type.or(namedTypes.Function, namedTypes.ClassDeclaration, namedTypes.ClassExpression, namedTypes.InterfaceDeclaration, namedTypes.TSInterfaceDeclaration, namedTypes.TypeAlias, namedTypes.TSTypeAliasDeclaration);
var FlowOrTSTypeParameterType = Type.or(namedTypes.TypeParameter, namedTypes.TSTypeParameter);
Scope.isEstablishedBy = function (node) {
return ScopeType.check(node) || TypeParameterScopeType.check(node);
};
var Sp = Scope.prototype;
// Will be overridden after an instance lazily calls scanScope.
Sp.didScan = false;
Sp.declares = function (name) {
this.scan();
return hasOwn.call(this.bindings, name);
};
Sp.declaresType = function (name) {
this.scan();
return hasOwn.call(this.types, name);
};
Sp.declareTemporary = function (prefix) {
if (prefix) {
if (!/^[a-z$_]/i.test(prefix)) {
throw new Error("");
}
}
else {
prefix = "t$";
}
// Include this.depth in the name to make sure the name does not
// collide with any variables in nested/enclosing scopes.
prefix += this.depth.toString(36) + "$";
this.scan();
var index = 0;
while (this.declares(prefix + index)) {
++index;
}
var name = prefix + index;
return this.bindings[name] = types.builders.identifier(name);
};
Sp.injectTemporary = function (identifier, init) {
identifier || (identifier = this.declareTemporary());
var bodyPath = this.path.get("body");
if (namedTypes.BlockStatement.check(bodyPath.value)) {
bodyPath = bodyPath.get("body");
}
bodyPath.unshift(b.variableDeclaration("var", [b.variableDeclarator(identifier, init || null)]));
return identifier;
};
Sp.scan = function (force) {
if (force || !this.didScan) {
for (var name in this.bindings) {
// Empty out this.bindings, just in cases.
delete this.bindings[name];
}
for (var name in this.types) {
// Empty out this.types, just in cases.
delete this.types[name];
}
scanScope(this.path, this.bindings, this.types);
this.didScan = true;
}
};
Sp.getBindings = function () {
this.scan();
return this.bindings;
};
Sp.getTypes = function () {
this.scan();
return this.types;
};
function scanScope(path, bindings, scopeTypes) {
var node = path.value;
if (TypeParameterScopeType.check(node)) {
var params = path.get('typeParameters', 'params');
if (isArray.check(params.value)) {
params.each(function (childPath) {
addTypeParameter(childPath, scopeTypes);
});
}
}
if (ScopeType.check(node)) {
if (namedTypes.CatchClause.check(node)) {
// A catch clause establishes a new scope but the only variable
// bound in that scope is the catch parameter. Any other
// declarations create bindings in the outer scope.
addPattern(path.get("param"), bindings);
}
else {
recursiveScanScope(path, bindings, scopeTypes);
}
}
}
function recursiveScanScope(path, bindings, scopeTypes) {
var node = path.value;
if (path.parent &&
namedTypes.FunctionExpression.check(path.parent.node) &&
path.parent.node.id) {
addPattern(path.parent.get("id"), bindings);
}
if (!node) {
// None of the remaining cases matter if node is falsy.
}
else if (isArray.check(node)) {
path.each(function (childPath) {
recursiveScanChild(childPath, bindings, scopeTypes);
});
}
else if (namedTypes.Function.check(node)) {
path.get("params").each(function (paramPath) {
addPattern(paramPath, bindings);
});
recursiveScanChild(path.get("body"), bindings, scopeTypes);
recursiveScanScope(path.get("typeParameters"), bindings, scopeTypes);
}
else if ((namedTypes.TypeAlias && namedTypes.TypeAlias.check(node)) ||
(namedTypes.InterfaceDeclaration && namedTypes.InterfaceDeclaration.check(node)) ||
(namedTypes.TSTypeAliasDeclaration && namedTypes.TSTypeAliasDeclaration.check(node)) ||
(namedTypes.TSInterfaceDeclaration && namedTypes.TSInterfaceDeclaration.check(node))) {
addTypePattern(path.get("id"), scopeTypes);
}
else if (namedTypes.VariableDeclarator.check(node)) {
addPattern(path.get("id"), bindings);
recursiveScanChild(path.get("init"), bindings, scopeTypes);
}
else if (node.type === "ImportSpecifier" ||
node.type === "ImportNamespaceSpecifier" ||
node.type === "ImportDefaultSpecifier") {
addPattern(
// Esprima used to use the .name field to refer to the local
// binding identifier for ImportSpecifier nodes, but .id for
// ImportNamespaceSpecifier and ImportDefaultSpecifier nodes.
// ESTree/Acorn/ESpree use .local for all three node types.
path.get(node.local ? "local" :
node.name ? "name" : "id"), bindings);
}
else if (Node.check(node) && !Expression.check(node)) {
types.eachField(node, function (name, child) {
var childPath = path.get(name);
if (!pathHasValue(childPath, child)) {
throw new Error("");
}
recursiveScanChild(childPath, bindings, scopeTypes);
});
}
}
function pathHasValue(path, value) {
if (path.value === value) {
return true;
}
// Empty arrays are probably produced by defaults.emptyArray, in which
// case is makes sense to regard them as equivalent, if not ===.
if (Array.isArray(path.value) &&
path.value.length === 0 &&
Array.isArray(value) &&
value.length === 0) {
return true;
}
return false;
}
function recursiveScanChild(path, bindings, scopeTypes) {
var node = path.value;
if (!node || Expression.check(node)) {
// Ignore falsy values and Expressions.
}
else if (namedTypes.FunctionDeclaration.check(node) &&
node.id !== null) {
addPattern(path.get("id"), bindings);
}
else if (namedTypes.ClassDeclaration &&
namedTypes.ClassDeclaration.check(node) &&
node.id !== null) {
addPattern(path.get("id"), bindings);
recursiveScanScope(path.get("typeParameters"), bindings, scopeTypes);
}
else if ((namedTypes.InterfaceDeclaration &&
namedTypes.InterfaceDeclaration.check(node)) ||
(namedTypes.TSInterfaceDeclaration &&
namedTypes.TSInterfaceDeclaration.check(node))) {
addTypePattern(path.get("id"), scopeTypes);
}
else if (ScopeType.check(node)) {
if (namedTypes.CatchClause.check(node) &&
// TODO Broaden this to accept any pattern.
namedTypes.Identifier.check(node.param)) {
var catchParamName = node.param.name;
var hadBinding = hasOwn.call(bindings, catchParamName);
// Any declarations that occur inside the catch body that do
// not have the same name as the catch parameter should count
// as bindings in the outer scope.
recursiveScanScope(path.get("body"), bindings, scopeTypes);
// If a new binding matching the catch parameter name was
// created while scanning the catch body, ignore it because it
// actually refers to the catch parameter and not the outer
// scope that we're currently scanning.
if (!hadBinding) {
delete bindings[catchParamName];
}
}
}
else {
recursiveScanScope(path, bindings, scopeTypes);
}
}
function addPattern(patternPath, bindings) {
var pattern = patternPath.value;
namedTypes.Pattern.assert(pattern);
if (namedTypes.Identifier.check(pattern)) {
if (hasOwn.call(bindings, pattern.name)) {
bindings[pattern.name].push(patternPath);
}
else {
bindings[pattern.name] = [patternPath];
}
}
else if (namedTypes.AssignmentPattern &&
namedTypes.AssignmentPattern.check(pattern)) {
addPattern(patternPath.get('left'), bindings);
}
else if (namedTypes.ObjectPattern &&
namedTypes.ObjectPattern.check(pattern)) {
patternPath.get('properties').each(function (propertyPath) {
var property = propertyPath.value;
if (namedTypes.Pattern.check(property)) {
addPattern(propertyPath, bindings);
}
else if (namedTypes.Property.check(property) ||
(namedTypes.ObjectProperty &&
namedTypes.ObjectProperty.check(property))) {
addPattern(propertyPath.get('value'), bindings);
}
else if (namedTypes.SpreadProperty &&
namedTypes.SpreadProperty.check(property)) {
addPattern(propertyPath.get('argument'), bindings);
}
});
}
else if (namedTypes.ArrayPattern &&
namedTypes.ArrayPattern.check(pattern)) {
patternPath.get('elements').each(function (elementPath) {
var element = elementPath.value;
if (namedTypes.Pattern.check(element)) {
addPattern(elementPath, bindings);
}
else if (namedTypes.SpreadElement &&
namedTypes.SpreadElement.check(element)) {
addPattern(elementPath.get("argument"), bindings);
}
});
}
else if (namedTypes.PropertyPattern &&
namedTypes.PropertyPattern.check(pattern)) {
addPattern(patternPath.get('pattern'), bindings);
}
else if ((namedTypes.SpreadElementPattern &&
namedTypes.SpreadElementPattern.check(pattern)) ||
(namedTypes.RestElement &&
namedTypes.RestElement.check(pattern)) ||
(namedTypes.SpreadPropertyPattern &&
namedTypes.SpreadPropertyPattern.check(pattern))) {
addPattern(patternPath.get('argument'), bindings);
}
}
function addTypePattern(patternPath, types) {
var pattern = patternPath.value;
namedTypes.Pattern.assert(pattern);
if (namedTypes.Identifier.check(pattern)) {
if (hasOwn.call(types, pattern.name)) {
types[pattern.name].push(patternPath);
}
else {
types[pattern.name] = [patternPath];
}
}
}
function addTypeParameter(parameterPath, types) {
var parameter = parameterPath.value;
FlowOrTSTypeParameterType.assert(parameter);
if (hasOwn.call(types, parameter.name)) {
types[parameter.name].push(parameterPath);
}
else {
types[parameter.name] = [parameterPath];
}
}
Sp.lookup = function (name) {
for (var scope = this; scope; scope = scope.parent)
if (scope.declares(name))
break;
return scope;
};
Sp.lookupType = function (name) {
for (var scope = this; scope; scope = scope.parent)
if (scope.declaresType(name))
break;
return scope;
};
Sp.getGlobalScope = function () {
var scope = this;
while (!scope.isGlobal)
scope = scope.parent;
return scope;
};
return Scope;
}
exports["default"] = scopePlugin;
;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=scope.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/shared.js":
/*!**********************************************!*\
!*** ./node_modules/ast-types/lib/shared.js ***!
\**********************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.maybeSetModuleExports = void 0;
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var types_1 = tslib_1.__importDefault(__webpack_require__(/*! ./types */ "./node_modules/ast-types/lib/types.js"));
function default_1(fork) {
var types = fork.use(types_1.default);
var Type = types.Type;
var builtin = types.builtInTypes;
var isNumber = builtin.number;
// An example of constructing a new type with arbitrary constraints from
// an existing type.
function geq(than) {
return Type.from(function (value) { return isNumber.check(value) && value >= than; }, isNumber + " >= " + than);
}
;
// Default value-returning functions that may optionally be passed as a
// third argument to Def.prototype.field.
var defaults = {
// Functions were used because (among other reasons) that's the most
// elegant way to allow for the emptyArray one always to give a new
// array instance.
"null": function () { return null; },
"emptyArray": function () { return []; },
"false": function () { return false; },
"true": function () { return true; },
"undefined": function () { },
"use strict": function () { return "use strict"; }
};
var naiveIsPrimitive = Type.or(builtin.string, builtin.number, builtin.boolean, builtin.null, builtin.undefined);
var isPrimitive = Type.from(function (value) {
if (value === null)
return true;
var type = typeof value;
if (type === "object" ||
type === "function") {
return false;
}
return true;
}, naiveIsPrimitive.toString());
return {
geq: geq,
defaults: defaults,
isPrimitive: isPrimitive,
};
}
exports["default"] = default_1;
;
// This function accepts a getter function that should return an object
// conforming to the NodeModule interface above. Typically, this means calling
// maybeSetModuleExports(() => module) at the very end of any module that has a
// default export, so the default export value can replace module.exports and
// thus CommonJS consumers can continue to rely on require("./that/module")
// returning the default-exported value, rather than always returning an exports
// object with a default property equal to that value. This function should help
// preserve backwards compatibility for CommonJS consumers, as a replacement for
// the ts-add-module-exports package.
function maybeSetModuleExports(moduleGetter) {
try {
var nodeModule = moduleGetter();
var originalExports = nodeModule.exports;
var defaultExport = originalExports["default"];
}
catch (_a) {
// It's normal/acceptable for this code to throw a ReferenceError due to
// the moduleGetter function attempting to access a non-existent global
// `module` variable. That's the reason we use a getter function here:
// so the calling code doesn't have to do its own typeof module ===
// "object" checking (because it's always safe to pass `() => module` as
// an argument, even when `module` is not defined in the calling scope).
return;
}
if (defaultExport &&
defaultExport !== originalExports &&
typeof originalExports === "object") {
// Make all properties found in originalExports properties of the
// default export, including the default property itself, so that
// require(nodeModule.id).default === require(nodeModule.id).
Object.assign(defaultExport, originalExports, { "default": defaultExport });
// Object.assign only transfers enumerable properties, and
// __esModule is (and should remain) non-enumerable.
if (originalExports.__esModule) {
Object.defineProperty(defaultExport, "__esModule", { value: true });
}
// This line allows require(nodeModule.id) === defaultExport, rather
// than (only) require(nodeModule.id).default === defaultExport.
nodeModule.exports = defaultExport;
}
}
exports.maybeSetModuleExports = maybeSetModuleExports;
//# sourceMappingURL=shared.js.map
/***/ }),
/***/ "./node_modules/ast-types/lib/types.js":
/*!*********************************************!*\
!*** ./node_modules/ast-types/lib/types.js ***!
\*********************************************/
/***/ ((module, exports, __webpack_require__) => {
"use strict";
/* module decorator */ module = __webpack_require__.nmd(module);
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Def = void 0;
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var shared_1 = __webpack_require__(/*! ./shared */ "./node_modules/ast-types/lib/shared.js");
var Op = Object.prototype;
var objToStr = Op.toString;
var hasOwn = Op.hasOwnProperty;
var BaseType = /** @class */ (function () {
function BaseType() {
}
BaseType.prototype.assert = function (value, deep) {
if (!this.check(value, deep)) {
var str = shallowStringify(value);
throw new Error(str + " does not match type " + this);
}
return true;
};
BaseType.prototype.arrayOf = function () {
var elemType = this;
return new ArrayType(elemType);
};
return BaseType;
}());
var ArrayType = /** @class */ (function (_super) {
tslib_1.__extends(ArrayType, _super);
function ArrayType(elemType) {
var _this = _super.call(this) || this;
_this.elemType = elemType;
_this.kind = "ArrayType";
return _this;
}
ArrayType.prototype.toString = function () {
return "[" + this.elemType + "]";
};
ArrayType.prototype.check = function (value, deep) {
var _this = this;
return Array.isArray(value) && value.every(function (elem) { return _this.elemType.check(elem, deep); });
};
return ArrayType;
}(BaseType));
var IdentityType = /** @class */ (function (_super) {
tslib_1.__extends(IdentityType, _super);
function IdentityType(value) {
var _this = _super.call(this) || this;
_this.value = value;
_this.kind = "IdentityType";
return _this;
}
IdentityType.prototype.toString = function () {
return String(this.value);
};
IdentityType.prototype.check = function (value, deep) {
var result = value === this.value;
if (!result && typeof deep === "function") {
deep(this, value);
}
return result;
};
return IdentityType;
}(BaseType));
var ObjectType = /** @class */ (function (_super) {
tslib_1.__extends(ObjectType, _super);
function ObjectType(fields) {
var _this = _super.call(this) || this;
_this.fields = fields;
_this.kind = "ObjectType";
return _this;
}
ObjectType.prototype.toString = function () {
return "{ " + this.fields.join(", ") + " }";
};
ObjectType.prototype.check = function (value, deep) {
return (objToStr.call(value) === objToStr.call({}) &&
this.fields.every(function (field) {
return field.type.check(value[field.name], deep);
}));
};
return ObjectType;
}(BaseType));
var OrType = /** @class */ (function (_super) {
tslib_1.__extends(OrType, _super);
function OrType(types) {
var _this = _super.call(this) || this;
_this.types = types;
_this.kind = "OrType";
return _this;
}
OrType.prototype.toString = function () {
return this.types.join(" | ");
};
OrType.prototype.check = function (value, deep) {
if (this.types.some(function (type) { return type.check(value, !!deep); })) {
return true;
}
if (typeof deep === "function") {
deep(this, value);
}
return false;
};
return OrType;
}(BaseType));
var PredicateType = /** @class */ (function (_super) {
tslib_1.__extends(PredicateType, _super);
function PredicateType(name, predicate) {
var _this = _super.call(this) || this;
_this.name = name;
_this.predicate = predicate;
_this.kind = "PredicateType";
return _this;
}
PredicateType.prototype.toString = function () {
return this.name;
};
PredicateType.prototype.check = function (value, deep) {
var result = this.predicate(value, deep);
if (!result && typeof deep === "function") {
deep(this, value);
}
return result;
};
return PredicateType;
}(BaseType));
var Def = /** @class */ (function () {
function Def(type, typeName) {
this.type = type;
this.typeName = typeName;
this.baseNames = [];
this.ownFields = Object.create(null);
// Includes own typeName. Populated during finalization.
this.allSupertypes = Object.create(null);
// Linear inheritance hierarchy. Populated during finalization.
this.supertypeList = [];
// Includes inherited fields.
this.allFields = Object.create(null);
// Non-hidden keys of allFields.
this.fieldNames = [];
// This property will be overridden as true by individual Def instances
// when they are finalized.
this.finalized = false;
// False by default until .build(...) is called on an instance.
this.buildable = false;
this.buildParams = [];
}
Def.prototype.isSupertypeOf = function (that) {
if (that instanceof Def) {
if (this.finalized !== true ||
that.finalized !== true) {
throw new Error("");
}
return hasOwn.call(that.allSupertypes, this.typeName);
}
else {
throw new Error(that + " is not a Def");
}
};
Def.prototype.checkAllFields = function (value, deep) {
var allFields = this.allFields;
if (this.finalized !== true) {
throw new Error("" + this.typeName);
}
function checkFieldByName(name) {
var field = allFields[name];
var type = field.type;
var child = field.getValue(value);
return type.check(child, deep);
}
return value !== null &&
typeof value === "object" &&
Object.keys(allFields).every(checkFieldByName);
};
Def.prototype.bases = function () {
var supertypeNames = [];
for (var _i = 0; _i < arguments.length; _i++) {
supertypeNames[_i] = arguments[_i];
}
var bases = this.baseNames;
if (this.finalized) {
if (supertypeNames.length !== bases.length) {
throw new Error("");
}
for (var i = 0; i < supertypeNames.length; i++) {
if (supertypeNames[i] !== bases[i]) {
throw new Error("");
}
}
return this;
}
supertypeNames.forEach(function (baseName) {
// This indexOf lookup may be O(n), but the typical number of base
// names is very small, and indexOf is a native Array method.
if (bases.indexOf(baseName) < 0) {
bases.push(baseName);
}
});
return this; // For chaining.
};
return Def;
}());
exports.Def = Def;
var Field = /** @class */ (function () {
function Field(name, type, defaultFn, hidden) {
this.name = name;
this.type = type;
this.defaultFn = defaultFn;
this.hidden = !!hidden;
}
Field.prototype.toString = function () {
return JSON.stringify(this.name) + ": " + this.type;
};
Field.prototype.getValue = function (obj) {
var value = obj[this.name];
if (typeof value !== "undefined") {
return value;
}
if (typeof this.defaultFn === "function") {
value = this.defaultFn.call(obj);
}
return value;
};
return Field;
}());
function shallowStringify(value) {
if (Array.isArray(value)) {
return "[" + value.map(shallowStringify).join(", ") + "]";
}
if (value && typeof value === "object") {
return "{ " + Object.keys(value).map(function (key) {
return key + ": " + value[key];
}).join(", ") + " }";
}
return JSON.stringify(value);
}
function typesPlugin(_fork) {
var Type = {
or: function () {
var types = [];
for (var _i = 0; _i < arguments.length; _i++) {
types[_i] = arguments[_i];
}
return new OrType(types.map(function (type) { return Type.from(type); }));
},
from: function (value, name) {
if (value instanceof ArrayType ||
value instanceof IdentityType ||
value instanceof ObjectType ||
value instanceof OrType ||
value instanceof PredicateType) {
return value;
}
// The Def type is used as a helper for constructing compound
// interface types for AST nodes.
if (value instanceof Def) {
return value.type;
}
// Support [ElemType] syntax.
if (isArray.check(value)) {
if (value.length !== 1) {
throw new Error("only one element type is permitted for typed arrays");
}
return new ArrayType(Type.from(value[0]));
}
// Support { someField: FieldType, ... } syntax.
if (isObject.check(value)) {
return new ObjectType(Object.keys(value).map(function (name) {
return new Field(name, Type.from(value[name], name));
}));
}
if (typeof value === "function") {
var bicfIndex = builtInCtorFns.indexOf(value);
if (bicfIndex >= 0) {
return builtInCtorTypes[bicfIndex];
}
if (typeof name !== "string") {
throw new Error("missing name");
}
return new PredicateType(name, value);
}
// As a last resort, toType returns a type that matches any value that
// is === from. This is primarily useful for literal values like
// toType(null), but it has the additional advantage of allowing
// toType to be a total function.
return new IdentityType(value);
},
// Define a type whose name is registered in a namespace (the defCache) so
// that future definitions will return the same type given the same name.
// In particular, this system allows for circular and forward definitions.
// The Def object d returned from Type.def may be used to configure the
// type d.type by calling methods such as d.bases, d.build, and d.field.
def: function (typeName) {
return hasOwn.call(defCache, typeName)
? defCache[typeName]
: defCache[typeName] = new DefImpl(typeName);
},
hasDef: function (typeName) {
return hasOwn.call(defCache, typeName);
}
};
var builtInCtorFns = [];
var builtInCtorTypes = [];
function defBuiltInType(name, example) {
var objStr = objToStr.call(example);
var type = new PredicateType(name, function (value) { return objToStr.call(value) === objStr; });
if (example && typeof example.constructor === "function") {
builtInCtorFns.push(example.constructor);
builtInCtorTypes.push(type);
}
return type;
}
// These types check the underlying [[Class]] attribute of the given
// value, rather than using the problematic typeof operator. Note however
// that no subtyping is considered; so, for instance, isObject.check
// returns false for [], /./, new Date, and null.
var isString = defBuiltInType("string", "truthy");
var isFunction = defBuiltInType("function", function () { });
var isArray = defBuiltInType("array", []);
var isObject = defBuiltInType("object", {});
var isRegExp = defBuiltInType("RegExp", /./);
var isDate = defBuiltInType("Date", new Date());
var isNumber = defBuiltInType("number", 3);
var isBoolean = defBuiltInType("boolean", true);
var isNull = defBuiltInType("null", null);
var isUndefined = defBuiltInType("undefined", undefined);
var isBigInt = typeof BigInt === "function"
? defBuiltInType("BigInt", BigInt(1234))
: new PredicateType("BigInt", function () { return false; });
var builtInTypes = {
string: isString,
function: isFunction,
array: isArray,
object: isObject,
RegExp: isRegExp,
Date: isDate,
number: isNumber,
boolean: isBoolean,
null: isNull,
undefined: isUndefined,
BigInt: isBigInt,
};
// In order to return the same Def instance every time Type.def is called
// with a particular name, those instances need to be stored in a cache.
var defCache = Object.create(null);
function defFromValue(value) {
if (value && typeof value === "object") {
var type = value.type;
if (typeof type === "string" &&
hasOwn.call(defCache, type)) {
var d = defCache[type];
if (d.finalized) {
return d;
}
}
}
return null;
}
var DefImpl = /** @class */ (function (_super) {
tslib_1.__extends(DefImpl, _super);
function DefImpl(typeName) {
var _this = _super.call(this, new PredicateType(typeName, function (value, deep) { return _this.check(value, deep); }), typeName) || this;
return _this;
}
DefImpl.prototype.check = function (value, deep) {
if (this.finalized !== true) {
throw new Error("prematurely checking unfinalized type " + this.typeName);
}
// A Def type can only match an object value.
if (value === null || typeof value !== "object") {
return false;
}
var vDef = defFromValue(value);
if (!vDef) {
// If we couldn't infer the Def associated with the given value,
// and we expected it to be a SourceLocation or a Position, it was
// probably just missing a "type" field (because Esprima does not
// assign a type property to such nodes). Be optimistic and let
// this.checkAllFields make the final decision.
if (this.typeName === "SourceLocation" ||
this.typeName === "Position") {
return this.checkAllFields(value, deep);
}
// Calling this.checkAllFields for any other type of node is both
// bad for performance and way too forgiving.
return false;
}
// If checking deeply and vDef === this, then we only need to call
// checkAllFields once. Calling checkAllFields is too strict when deep
// is false, because then we only care about this.isSupertypeOf(vDef).
if (deep && vDef === this) {
return this.checkAllFields(value, deep);
}
// In most cases we rely exclusively on isSupertypeOf to make O(1)
// subtyping determinations. This suffices in most situations outside
// of unit tests, since interface conformance is checked whenever new
// instances are created using builder functions.
if (!this.isSupertypeOf(vDef)) {
return false;
}
// The exception is when deep is true; then, we recursively check all
// fields.
if (!deep) {
return true;
}
// Use the more specific Def (vDef) to perform the deep check, but
// shallow-check fields defined by the less specific Def (this).
return vDef.checkAllFields(value, deep)
&& this.checkAllFields(value, false);
};
DefImpl.prototype.build = function () {
var _this = this;
var buildParams = [];
for (var _i = 0; _i < arguments.length; _i++) {
buildParams[_i] = arguments[_i];
}
// Calling Def.prototype.build multiple times has the effect of merely
// redefining this property.
this.buildParams = buildParams;
if (this.buildable) {
// If this Def is already buildable, update self.buildParams and
// continue using the old builder function.
return this;
}
// Every buildable type will have its "type" field filled in
// automatically. This includes types that are not subtypes of Node,
// like SourceLocation, but that seems harmless (TODO?).
this.field("type", String, function () { return _this.typeName; });
// Override Dp.buildable for this Def instance.
this.buildable = true;
var addParam = function (built, param, arg, isArgAvailable) {
if (hasOwn.call(built, param))
return;
var all = _this.allFields;
if (!hasOwn.call(all, param)) {
throw new Error("" + param);
}
var field = all[param];
var type = field.type;
var value;
if (isArgAvailable) {
value = arg;
}
else if (field.defaultFn) {
// Expose the partially-built object to the default
// function as its `this` object.
value = field.defaultFn.call(built);
}
else {
var message = "no value or default function given for field " +
JSON.stringify(param) + " of " + _this.typeName + "(" +
_this.buildParams.map(function (name) {
return all[name];
}).join(", ") + ")";
throw new Error(message);
}
if (!type.check(value)) {
throw new Error(shallowStringify(value) +
" does not match field " + field +
" of type " + _this.typeName);
}
built[param] = value;
};
// Calling the builder function will construct an instance of the Def,
// with positional arguments mapped to the fields original passed to .build.
// If not enough arguments are provided, the default value for the remaining fields
// will be used.
var builder = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var argc = args.length;
if (!_this.finalized) {
throw new Error("attempting to instantiate unfinalized type " +
_this.typeName);
}
var built = Object.create(nodePrototype);
_this.buildParams.forEach(function (param, i) {
if (i < argc) {
addParam(built, param, args[i], true);
}
else {
addParam(built, param, null, false);
}
});
Object.keys(_this.allFields).forEach(function (param) {
// Use the default value.
addParam(built, param, null, false);
});
// Make sure that the "type" field was filled automatically.
if (built.type !== _this.typeName) {
throw new Error("");
}
return built;
};
// Calling .from on the builder function will construct an instance of the Def,
// using field values from the passed object. For fields missing from the passed object,
// their default value will be used.
builder.from = function (obj) {
if (!_this.finalized) {
throw new Error("attempting to instantiate unfinalized type " +
_this.typeName);
}
var built = Object.create(nodePrototype);
Object.keys(_this.allFields).forEach(function (param) {
if (hasOwn.call(obj, param)) {
addParam(built, param, obj[param], true);
}
else {
addParam(built, param, null, false);
}
});
// Make sure that the "type" field was filled automatically.
if (built.type !== _this.typeName) {
throw new Error("");
}
return built;
};
Object.defineProperty(builders, getBuilderName(this.typeName), {
enumerable: true,
value: builder
});
return this;
};
// The reason fields are specified using .field(...) instead of an object
// literal syntax is somewhat subtle: the object literal syntax would
// support only one key and one value, but with .field(...) we can pass
// any number of arguments to specify the field.
DefImpl.prototype.field = function (name, type, defaultFn, hidden) {
if (this.finalized) {
console.error("Ignoring attempt to redefine field " +
JSON.stringify(name) + " of finalized type " +
JSON.stringify(this.typeName));
return this;
}
this.ownFields[name] = new Field(name, Type.from(type), defaultFn, hidden);
return this; // For chaining.
};
DefImpl.prototype.finalize = function () {
var _this = this;
// It's not an error to finalize a type more than once, but only the
// first call to .finalize does anything.
if (!this.finalized) {
var allFields = this.allFields;
var allSupertypes = this.allSupertypes;
this.baseNames.forEach(function (name) {
var def = defCache[name];
if (def instanceof Def) {
def.finalize();
extend(allFields, def.allFields);
extend(allSupertypes, def.allSupertypes);
}
else {
var message = "unknown supertype name " +
JSON.stringify(name) +
" for subtype " +
JSON.stringify(_this.typeName);
throw new Error(message);
}
});
// TODO Warn if fields are overridden with incompatible types.
extend(allFields, this.ownFields);
allSupertypes[this.typeName] = this;
this.fieldNames.length = 0;
for (var fieldName in allFields) {
if (hasOwn.call(allFields, fieldName) &&
!allFields[fieldName].hidden) {
this.fieldNames.push(fieldName);
}
}
// Types are exported only once they have been finalized.
Object.defineProperty(namedTypes, this.typeName, {
enumerable: true,
value: this.type
});
this.finalized = true;
// A linearization of the inheritance hierarchy.
populateSupertypeList(this.typeName, this.supertypeList);
if (this.buildable &&
this.supertypeList.lastIndexOf("Expression") >= 0) {
wrapExpressionBuilderWithStatement(this.typeName);
}
}
};
return DefImpl;
}(Def));
// Note that the list returned by this function is a copy of the internal
// supertypeList, *without* the typeName itself as the first element.
function getSupertypeNames(typeName) {
if (!hasOwn.call(defCache, typeName)) {
throw new Error("");
}
var d = defCache[typeName];
if (d.finalized !== true) {
throw new Error("");
}
return d.supertypeList.slice(1);
}
// Returns an object mapping from every known type in the defCache to the
// most specific supertype whose name is an own property of the candidates
// object.
function computeSupertypeLookupTable(candidates) {
var table = {};
var typeNames = Object.keys(defCache);
var typeNameCount = typeNames.length;
for (var i = 0; i < typeNameCount; ++i) {
var typeName = typeNames[i];
var d = defCache[typeName];
if (d.finalized !== true) {
throw new Error("" + typeName);
}
for (var j = 0; j < d.supertypeList.length; ++j) {
var superTypeName = d.supertypeList[j];
if (hasOwn.call(candidates, superTypeName)) {
table[typeName] = superTypeName;
break;
}
}
}
return table;
}
var builders = Object.create(null);
// This object is used as prototype for any node created by a builder.
var nodePrototype = {};
// Call this function to define a new method to be shared by all AST
// nodes. The replaced method (if any) is returned for easy wrapping.
function defineMethod(name, func) {
var old = nodePrototype[name];
// Pass undefined as func to delete nodePrototype[name].
if (isUndefined.check(func)) {
delete nodePrototype[name];
}
else {
isFunction.assert(func);
Object.defineProperty(nodePrototype, name, {
enumerable: true,
configurable: true,
value: func
});
}
return old;
}
function getBuilderName(typeName) {
return typeName.replace(/^[A-Z]+/, function (upperCasePrefix) {
var len = upperCasePrefix.length;
switch (len) {
case 0: return "";
// If there's only one initial capital letter, just lower-case it.
case 1: return upperCasePrefix.toLowerCase();
default:
// If there's more than one initial capital letter, lower-case
// all but the last one, so that XMLDefaultDeclaration (for
// example) becomes xmlDefaultDeclaration.
return upperCasePrefix.slice(0, len - 1).toLowerCase() +
upperCasePrefix.charAt(len - 1);
}
});
}
function getStatementBuilderName(typeName) {
typeName = getBuilderName(typeName);
return typeName.replace(/(Expression)?$/, "Statement");
}
var namedTypes = {};
// Like Object.keys, but aware of what fields each AST type should have.
function getFieldNames(object) {
var d = defFromValue(object);
if (d) {
return d.fieldNames.slice(0);
}
if ("type" in object) {
throw new Error("did not recognize object of type " +
JSON.stringify(object.type));
}
return Object.keys(object);
}
// Get the value of an object property, taking object.type and default
// functions into account.
function getFieldValue(object, fieldName) {
var d = defFromValue(object);
if (d) {
var field = d.allFields[fieldName];
if (field) {
return field.getValue(object);
}
}
return object && object[fieldName];
}
// Iterate over all defined fields of an object, including those missing
// or undefined, passing each field name and effective value (as returned
// by getFieldValue) to the callback. If the object has no corresponding
// Def, the callback will never be called.
function eachField(object, callback, context) {
getFieldNames(object).forEach(function (name) {
callback.call(this, name, getFieldValue(object, name));
}, context);
}
// Similar to eachField, except that iteration stops as soon as the
// callback returns a truthy value. Like Array.prototype.some, the final
// result is either true or false to indicates whether the callback
// returned true for any element or not.
function someField(object, callback, context) {
return getFieldNames(object).some(function (name) {
return callback.call(this, name, getFieldValue(object, name));
}, context);
}
// Adds an additional builder for Expression subtypes
// that wraps the built Expression in an ExpressionStatements.
function wrapExpressionBuilderWithStatement(typeName) {
var wrapperName = getStatementBuilderName(typeName);
// skip if the builder already exists
if (builders[wrapperName])
return;
// the builder function to wrap with builders.ExpressionStatement
var wrapped = builders[getBuilderName(typeName)];
// skip if there is nothing to wrap
if (!wrapped)
return;
var builder = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return builders.expressionStatement(wrapped.apply(builders, args));
};
builder.from = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return builders.expressionStatement(wrapped.from.apply(builders, args));
};
builders[wrapperName] = builder;
}
function populateSupertypeList(typeName, list) {
list.length = 0;
list.push(typeName);
var lastSeen = Object.create(null);
for (var pos = 0; pos < list.length; ++pos) {
typeName = list[pos];
var d = defCache[typeName];
if (d.finalized !== true) {
throw new Error("");
}
// If we saw typeName earlier in the breadth-first traversal,
// delete the last-seen occurrence.
if (hasOwn.call(lastSeen, typeName)) {
delete list[lastSeen[typeName]];
}
// Record the new index of the last-seen occurrence of typeName.
lastSeen[typeName] = pos;
// Enqueue the base names of this type.
list.push.apply(list, d.baseNames);
}
// Compaction loop to remove array holes.
for (var to = 0, from = to, len = list.length; from < len; ++from) {
if (hasOwn.call(list, from)) {
list[to++] = list[from];
}
}
list.length = to;
}
function extend(into, from) {
Object.keys(from).forEach(function (name) {
into[name] = from[name];
});
return into;
}
function finalize() {
Object.keys(defCache).forEach(function (name) {
defCache[name].finalize();
});
}
return {
Type: Type,
builtInTypes: builtInTypes,
getSupertypeNames: getSupertypeNames,
computeSupertypeLookupTable: computeSupertypeLookupTable,
builders: builders,
defineMethod: defineMethod,
getBuilderName: getBuilderName,
getStatementBuilderName: getStatementBuilderName,
namedTypes: namedTypes,
getFieldNames: getFieldNames,
getFieldValue: getFieldValue,
eachField: eachField,
someField: someField,
finalize: finalize,
};
}
exports["default"] = typesPlugin;
;
(0, shared_1.maybeSetModuleExports)(function () { return module; });
//# sourceMappingURL=types.js.map
/***/ }),
/***/ "./node_modules/available-typed-arrays/index.js":
/*!******************************************************!*\
!*** ./node_modules/available-typed-arrays/index.js ***!
\******************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var possibleNames = __webpack_require__(/*! possible-typed-array-names */ "./node_modules/possible-typed-array-names/index.js");
var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis;
/** @type {import('.')} */
module.exports = function availableTypedArrays() {
var /** @type {ReturnType<typeof availableTypedArrays>} */ out = [];
for (var i = 0; i < possibleNames.length; i++) {
if (typeof g[possibleNames[i]] === 'function') {
// @ts-expect-error
out[out.length] = possibleNames[i];
}
}
return out;
};
/***/ }),
/***/ "./node_modules/call-bind-apply-helpers/actualApply.js":
/*!*************************************************************!*\
!*** ./node_modules/call-bind-apply-helpers/actualApply.js ***!
\*************************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var bind = __webpack_require__(/*! function-bind */ "./node_modules/function-bind/index.js");
var $apply = __webpack_require__(/*! ./functionApply */ "./node_modules/call-bind-apply-helpers/functionApply.js");
var $call = __webpack_require__(/*! ./functionCall */ "./node_modules/call-bind-apply-helpers/functionCall.js");
var $reflectApply = __webpack_require__(/*! ./reflectApply */ "./node_modules/call-bind-apply-helpers/reflectApply.js");
/** @type {import('./actualApply')} */
module.exports = $reflectApply || bind.call($call, $apply);
/***/ }),
/***/ "./node_modules/call-bind-apply-helpers/applyBind.js":
/*!***********************************************************!*\
!*** ./node_modules/call-bind-apply-helpers/applyBind.js ***!
\***********************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var bind = __webpack_require__(/*! function-bind */ "./node_modules/function-bind/index.js");
var $apply = __webpack_require__(/*! ./functionApply */ "./node_modules/call-bind-apply-helpers/functionApply.js");
var actualApply = __webpack_require__(/*! ./actualApply */ "./node_modules/call-bind-apply-helpers/actualApply.js");
/** @type {import('./applyBind')} */
module.exports = function applyBind() {
return actualApply(bind, $apply, arguments);
};
/***/ }),
/***/ "./node_modules/call-bind-apply-helpers/functionApply.js":
/*!***************************************************************!*\
!*** ./node_modules/call-bind-apply-helpers/functionApply.js ***!
\***************************************************************/
/***/ ((module) => {
"use strict";
/** @type {import('./functionApply')} */
module.exports = Function.prototype.apply;
/***/ }),
/***/ "./node_modules/call-bind-apply-helpers/functionCall.js":
/*!**************************************************************!*\
!*** ./node_modules/call-bind-apply-helpers/functionCall.js ***!
\**************************************************************/
/***/ ((module) => {
"use strict";
/** @type {import('./functionCall')} */
module.exports = Function.prototype.call;
/***/ }),
/***/ "./node_modules/call-bind-apply-helpers/index.js":
/*!*******************************************************!*\
!*** ./node_modules/call-bind-apply-helpers/index.js ***!
\*******************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var bind = __webpack_require__(/*! function-bind */ "./node_modules/function-bind/index.js");
var $TypeError = __webpack_require__(/*! es-errors/type */ "./node_modules/es-errors/type.js");
var $call = __webpack_require__(/*! ./functionCall */ "./node_modules/call-bind-apply-helpers/functionCall.js");
var $actualApply = __webpack_require__(/*! ./actualApply */ "./node_modules/call-bind-apply-helpers/actualApply.js");
/** @type {(args: [Function, thisArg?: unknown, ...args: unknown[]]) => Function} TODO FIXME, find a way to use import('.') */
module.exports = function callBindBasic(args) {
if (args.length < 1 || typeof args[0] !== 'function') {
throw new $TypeError('a function is required');
}
return $actualApply(bind, $call, args);
};
/***/ }),
/***/ "./node_modules/call-bind-apply-helpers/reflectApply.js":
/*!**************************************************************!*\
!*** ./node_modules/call-bind-apply-helpers/reflectApply.js ***!
\**************************************************************/
/***/ ((module) => {
"use strict";
/** @type {import('./reflectApply')} */
module.exports = typeof Reflect !== 'undefined' && Reflect && Reflect.apply;
/***/ }),
/***/ "./node_modules/call-bind/callBound.js":
/*!*********************************************!*\
!*** ./node_modules/call-bind/callBound.js ***!
\*********************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var GetIntrinsic = __webpack_require__(/*! get-intrinsic */ "./node_modules/get-intrinsic/index.js");
var callBind = __webpack_require__(/*! ./ */ "./node_modules/call-bind/index.js");
var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
module.exports = function callBoundIntrinsic(name, allowMissing) {
var intrinsic = GetIntrinsic(name, !!allowMissing);
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
return callBind(intrinsic);
}
return intrinsic;
};
/***/ }),
/***/ "./node_modules/call-bind/index.js":
/*!*****************************************!*\
!*** ./node_modules/call-bind/index.js ***!
\*****************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var setFunctionLength = __webpack_require__(/*! set-function-length */ "./node_modules/set-function-length/index.js");
var $defineProperty = __webpack_require__(/*! es-define-property */ "./node_modules/es-define-property/index.js");
var callBindBasic = __webpack_require__(/*! call-bind-apply-helpers */ "./node_modules/call-bind-apply-helpers/index.js");
var applyBind = __webpack_require__(/*! call-bind-apply-helpers/applyBind */ "./node_modules/call-bind-apply-helpers/applyBind.js");
module.exports = function callBind(originalFunction) {
var func = callBindBasic(arguments);
var adjustedLength = originalFunction.length - (arguments.length - 1);
return setFunctionLength(
func,
1 + (adjustedLength > 0 ? adjustedLength : 0),
true
);
};
if ($defineProperty) {
$defineProperty(module.exports, 'apply', { value: applyBind });
} else {
module.exports.apply = applyBind;
}
/***/ }),
/***/ "./node_modules/call-bound/index.js":
/*!******************************************!*\
!*** ./node_modules/call-bound/index.js ***!
\******************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var GetIntrinsic = __webpack_require__(/*! get-intrinsic */ "./node_modules/get-intrinsic/index.js");
var callBindBasic = __webpack_require__(/*! call-bind-apply-helpers */ "./node_modules/call-bind-apply-helpers/index.js");
/** @type {(thisArg: string, searchString: string, position?: number) => number} */
var $indexOf = callBindBasic([GetIntrinsic('%String.prototype.indexOf%')]);
/** @type {import('.')} */
module.exports = function callBoundIntrinsic(name, allowMissing) {
/* eslint no-extra-parens: 0 */
var intrinsic = /** @type {(this: unknown, ...args: unknown[]) => unknown} */ (GetIntrinsic(name, !!allowMissing));
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
return callBindBasic(/** @type {const} */ ([intrinsic]));
}
return intrinsic;
};
/***/ }),
/***/ "./node_modules/define-data-property/index.js":
/*!****************************************************!*\
!*** ./node_modules/define-data-property/index.js ***!
\****************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var $defineProperty = __webpack_require__(/*! es-define-property */ "./node_modules/es-define-property/index.js");
var $SyntaxError = __webpack_require__(/*! es-errors/syntax */ "./node_modules/es-errors/syntax.js");
var $TypeError = __webpack_require__(/*! es-errors/type */ "./node_modules/es-errors/type.js");
var gopd = __webpack_require__(/*! gopd */ "./node_modules/gopd/index.js");
/** @type {import('.')} */
module.exports = function defineDataProperty(
obj,
property,
value
) {
if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
throw new $TypeError('`obj` must be an object or a function`');
}
if (typeof property !== 'string' && typeof property !== 'symbol') {
throw new $TypeError('`property` must be a string or a symbol`');
}
if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) {
throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null');
}
if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) {
throw new $TypeError('`nonWritable`, if provided, must be a boolean or null');
}
if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) {
throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null');
}
if (arguments.length > 6 && typeof arguments[6] !== 'boolean') {
throw new $TypeError('`loose`, if provided, must be a boolean');
}
var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
var nonWritable = arguments.length > 4 ? arguments[4] : null;
var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
var loose = arguments.length > 6 ? arguments[6] : false;
/* @type {false | TypedPropertyDescriptor<unknown>} */
var desc = !!gopd && gopd(obj, property);
if ($defineProperty) {
$defineProperty(obj, property, {
configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
value: value,
writable: nonWritable === null && desc ? desc.writable : !nonWritable
});
} else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) {
// must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable
obj[property] = value; // eslint-disable-line no-param-reassign
} else {
throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.');
}
};
/***/ }),
/***/ "./node_modules/define-properties/index.js":
/*!*************************************************!*\
!*** ./node_modules/define-properties/index.js ***!
\*************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var keys = __webpack_require__(/*! object-keys */ "./node_modules/object-keys/index.js");
var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
var toStr = Object.prototype.toString;
var concat = Array.prototype.concat;
var defineDataProperty = __webpack_require__(/*! define-data-property */ "./node_modules/define-data-property/index.js");
var isFunction = function (fn) {
return typeof fn === 'function' && toStr.call(fn) === '[object Function]';
};
var supportsDescriptors = __webpack_require__(/*! has-property-descriptors */ "./node_modules/has-property-descriptors/index.js")();
var defineProperty = function (object, name, value, predicate) {
if (name in object) {
if (predicate === true) {
if (object[name] === value) {
return;
}
} else if (!isFunction(predicate) || !predicate()) {
return;
}
}
if (supportsDescriptors) {
defineDataProperty(object, name, value, true);
} else {
defineDataProperty(object, name, value);
}
};
var defineProperties = function (object, map) {
var predicates = arguments.length > 2 ? arguments[2] : {};
var props = keys(map);
if (hasSymbols) {
props = concat.call(props, Object.getOwnPropertySymbols(map));
}
for (var i = 0; i < props.length; i += 1) {
defineProperty(object, props[i], map[props[i]], predicates[props[i]]);
}
};
defineProperties.supportsDescriptors = !!supportsDescriptors;
module.exports = defineProperties;
/***/ }),
/***/ "./node_modules/dunder-proto/get.js":
/*!******************************************!*\
!*** ./node_modules/dunder-proto/get.js ***!
\******************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var callBind = __webpack_require__(/*! call-bind-apply-helpers */ "./node_modules/call-bind-apply-helpers/index.js");
var gOPD = __webpack_require__(/*! gopd */ "./node_modules/gopd/index.js");
var hasProtoAccessor;
try {
// eslint-disable-next-line no-extra-parens, no-proto
hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */ ([]).__proto__ === Array.prototype;
} catch (e) {
if (!e || typeof e !== 'object' || !('code' in e) || e.code !== 'ERR_PROTO_ACCESS') {
throw e;
}
}
// eslint-disable-next-line no-extra-parens
var desc = !!hasProtoAccessor && gOPD && gOPD(Object.prototype, /** @type {keyof typeof Object.prototype} */ ('__proto__'));
var $Object = Object;
var $getPrototypeOf = $Object.getPrototypeOf;
/** @type {import('./get')} */
module.exports = desc && typeof desc.get === 'function'
? callBind([desc.get])
: typeof $getPrototypeOf === 'function'
? /** @type {import('./get')} */ function getDunder(value) {
// eslint-disable-next-line eqeqeq
return $getPrototypeOf(value == null ? value : $Object(value));
}
: false;
/***/ }),
/***/ "./node_modules/es-define-property/index.js":
/*!**************************************************!*\
!*** ./node_modules/es-define-property/index.js ***!
\**************************************************/
/***/ ((module) => {
"use strict";
/** @type {import('.')} */
var $defineProperty = Object.defineProperty || false;
if ($defineProperty) {
try {
$defineProperty({}, 'a', { value: 1 });
} catch (e) {
// IE 8 has a broken defineProperty
$defineProperty = false;
}
}
module.exports = $defineProperty;
/***/ }),
/***/ "./node_modules/es-errors/eval.js":
/*!****************************************!*\
!*** ./node_modules/es-errors/eval.js ***!
\****************************************/
/***/ ((module) => {
"use strict";
/** @type {import('./eval')} */
module.exports = EvalError;
/***/ }),
/***/ "./node_modules/es-errors/index.js":
/*!*****************************************!*\
!*** ./node_modules/es-errors/index.js ***!
\*****************************************/
/***/ ((module) => {
"use strict";
/** @type {import('.')} */
module.exports = Error;
/***/ }),
/***/ "./node_modules/es-errors/range.js":
/*!*****************************************!*\
!*** ./node_modules/es-errors/range.js ***!
\*****************************************/
/***/ ((module) => {
"use strict";
/** @type {import('./range')} */
module.exports = RangeError;
/***/ }),
/***/ "./node_modules/es-errors/ref.js":
/*!***************************************!*\
!*** ./node_modules/es-errors/ref.js ***!
\***************************************/
/***/ ((module) => {
"use strict";
/** @type {import('./ref')} */
module.exports = ReferenceError;
/***/ }),
/***/ "./node_modules/es-errors/syntax.js":
/*!******************************************!*\
!*** ./node_modules/es-errors/syntax.js ***!
\******************************************/
/***/ ((module) => {
"use strict";
/** @type {import('./syntax')} */
module.exports = SyntaxError;
/***/ }),
/***/ "./node_modules/es-errors/type.js":
/*!****************************************!*\
!*** ./node_modules/es-errors/type.js ***!
\****************************************/
/***/ ((module) => {
"use strict";
/** @type {import('./type')} */
module.exports = TypeError;
/***/ }),
/***/ "./node_modules/es-errors/uri.js":
/*!***************************************!*\
!*** ./node_modules/es-errors/uri.js ***!
\***************************************/
/***/ ((module) => {
"use strict";
/** @type {import('./uri')} */
module.exports = URIError;
/***/ }),
/***/ "./node_modules/es-object-atoms/index.js":
/*!***********************************************!*\
!*** ./node_modules/es-object-atoms/index.js ***!
\***********************************************/
/***/ ((module) => {
"use strict";
/** @type {import('.')} */
module.exports = Object;
/***/ }),
/***/ "./node_modules/escope/lib/definition.js":
/*!***********************************************!*\
!*** ./node_modules/escope/lib/definition.js ***!
\***********************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.Definition = exports.ParameterDefinition = undefined;
var _variable = __webpack_require__(/*! ./variable */ "./node_modules/escope/lib/variable.js");
var _variable2 = _interopRequireDefault(_variable);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /*
Copyright (C) 2015 Yusuke Suzuki <[email protected]>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @class Definition
*/
var Definition = function Definition(type, name, node, parent, index, kind) {
_classCallCheck(this, Definition);
/**
* @member {String} Definition#type - type of the occurrence (e.g. "Parameter", "Variable", ...).
*/
this.type = type;
/**
* @member {esprima.Identifier} Definition#name - the identifier AST node of the occurrence.
*/
this.name = name;
/**
* @member {esprima.Node} Definition#node - the enclosing node of the identifier.
*/
this.node = node;
/**
* @member {esprima.Node?} Definition#parent - the enclosing statement node of the identifier.
*/
this.parent = parent;
/**
* @member {Number?} Definition#index - the index in the declaration statement.
*/
this.index = index;
/**
* @member {String?} Definition#kind - the kind of the declaration statement.
*/
this.kind = kind;
};
/**
* @class ParameterDefinition
*/
exports["default"] = Definition;
var ParameterDefinition = function (_Definition) {
_inherits(ParameterDefinition, _Definition);
function ParameterDefinition(name, node, index, rest) {
_classCallCheck(this, ParameterDefinition);
/**
* Whether the parameter definition is a part of a rest parameter.
* @member {boolean} ParameterDefinition#rest
*/
var _this = _possibleConstructorReturn(this, (ParameterDefinition.__proto__ || Object.getPrototypeOf(ParameterDefinition)).call(this, _variable2.default.Parameter, name, node, null, index, null));
_this.rest = rest;
return _this;
}
return ParameterDefinition;
}(Definition);
exports.ParameterDefinition = ParameterDefinition;
exports.Definition = Definition;
/* vim: set sw=4 ts=4 et tw=80 : */
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3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AvKipcbiAgICAgICAgICogQG1lbWJlciB7U3RyaW5nfSBEZWZpbml0aW9uI3R5cGUgLSB0eXBlIG9mIHRoZSBvY2N1cnJlbmNlIChlLmcuIFwiUGFyYW1ldGVyXCIsIFwiVmFyaWFibGVcIiwgLi4uKS5cbiAgICAgICAgICovXG4gICAgICAgIHRoaXMudHlwZSA9IHR5cGU7XG4gICAgICAgIC8qKlxuICAgICAgICAgKiBAbWVtYmVyIHtlc3ByaW1hLklkZW50aWZpZXJ9IERlZmluaXRpb24jbmFtZSAtIHRoZSBpZGVudGlmaWVyIEFTVCBub2RlIG9mIHRoZSBvY2N1cnJlbmNlLlxuICAgICAgICAgKi9cbiAgICAgICAgdGhpcy5uYW1lID0gbmFtZTtcbiAgICAgICAgLyoqXG4gICAgICAgICAqIEBtZW1iZXIge2VzcHJpbWEuTm9kZX0gRGVmaW5pdGlvbiNub2RlIC0gdGhlIGVuY2xvc2luZyBub2RlIG9mIHRoZSBpZGVudGlmaWVyLlxuICAgICAgICAgKi9cbiAgICAgICAgdGhpcy5ub2RlID0gbm9kZTtcbiAgICAgICAgLyoqXG4gICAgICAgICAqIEBtZW1iZXIge2VzcHJpbWEuTm9kZT99IERlZmluaXRpb24jcGFyZW50IC0gdGhlIGVuY2xvc2luZyBzdGF0ZW1lbnQgbm9kZSBvZiB0aGUgaWRlbnRpZmllci5cbiAgICAgICAgICovXG4gICAgICAgIHRoaXMucGFyZW50ID0gcGFyZW50O1xuICAgICAgICAvKipcbiAgICAgICAgICogQG1lbWJlciB7TnVtYmVyP30gRGVmaW5pdGlvbiNpbmRleCAtIHRoZSBpbmRleCBpbiB0aGUgZGVjbGFyYXRpb24gc3RhdGVtZW50LlxuICAgICAgICAgKi9cbiAgICAgICAgdGhpcy5pbmRleCA9IGluZGV4O1xuICAgICAgICAvKipcbiAgICAgICAgICogQG1lbWJlciB7U3RyaW5nP30gRGVmaW5pdGlvbiNraW5kIC0gdGhlIGtpbmQgb2YgdGhlIGRlY2xhcmF0aW9uIHN0YXRlbWVudC5cbiAgICAgICAgICovXG4gICAgICAgIHRoaXMua2luZCA9IGtpbmQ7XG4gICAgfVxufVxuXG4vKipcbiAqIEBjbGFzcyBQYXJhbWV0ZXJEZWZpbml0aW9uXG4gKi9cbmNsYXNzIFBhcmFtZXRlckRlZmluaXRpb24gZXh0ZW5kcyBEZWZpbml0aW9uIHtcbiAgICBjb25zdHJ1Y3RvcihuYW1lLCBub2RlLCBpbmRleCwgcmVzdCkge1xuICAgICAgICBzdXBlcihWYXJpYWJsZS5QYXJhbWV0ZXIsIG5hbWUsIG5vZGUsIG51bGwsIGluZGV4LCBudWxsKTtcbiAgICAgICAgLyoqXG4gICAgICAgICAqIFdoZXRoZXIgdGhlIHBhcmFtZXRlciBkZWZpbml0aW9uIGlzIGEgcGFydCBvZiBhIHJlc3QgcGFyYW1ldGVyLlxuICAgICAgICAgKiBAbWVtYmVyIHtib29sZWFufSBQYXJhbWV0ZXJEZWZpbml0aW9uI3Jlc3RcbiAgICAgICAgICovXG4gICAgICAgIHRoaXMucmVzdCA9IHJlc3Q7XG4gICAgfVxufVxuXG5leHBvcnQge1xuICAgIFBhcmFtZXRlckRlZmluaXRpb24sXG4gICAgRGVmaW5pdGlvblxufVxuXG4vKiB2aW06IHNldCBzdz00IHRzPTQgZXQgdHc9ODAgOiAqL1xuIl19
/***/ }),
/***/ "./node_modules/escope/lib/index.js":
/*!******************************************!*\
!*** ./node_modules/escope/lib/index.js ***!
\******************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.ScopeManager = exports.Scope = exports.Variable = exports.Reference = exports.version = undefined;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /*
Copyright (C) 2012-2014 Yusuke Suzuki <[email protected]>
Copyright (C) 2013 Alex Seville <[email protected]>
Copyright (C) 2014 Thiago de Arruda <[email protected]>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* Escope (<a href="http://github.com/estools/escope">escope</a>) is an <a
* href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMAScript</a>
* scope analyzer extracted from the <a
* href="http://github.com/estools/esmangle">esmangle project</a/>.
* <p>
* <em>escope</em> finds lexical scopes in a source program, i.e. areas of that
* program where different occurrences of the same identifier refer to the same
* variable. With each scope the contained variables are collected, and each
* identifier reference in code is linked to its corresponding variable (if
* possible).
* <p>
* <em>escope</em> works on a syntax tree of the parsed source code which has
* to adhere to the <a
* href="https://developer.mozilla.org/en-US/docs/SpiderMonkey/Parser_API">
* Mozilla Parser API</a>. E.g. <a href="http://esprima.org">esprima</a> is a parser
* that produces such syntax trees.
* <p>
* The main interface is the {@link analyze} function.
* @module escope
*/
/*jslint bitwise:true */
exports.analyze = analyze;
var _assert = __webpack_require__(/*! assert */ "./node_modules/assert/build/assert.js");
var _assert2 = _interopRequireDefault(_assert);
var _scopeManager = __webpack_require__(/*! ./scope-manager */ "./node_modules/escope/lib/scope-manager.js");
var _scopeManager2 = _interopRequireDefault(_scopeManager);
var _referencer = __webpack_require__(/*! ./referencer */ "./node_modules/escope/lib/referencer.js");
var _referencer2 = _interopRequireDefault(_referencer);
var _reference = __webpack_require__(/*! ./reference */ "./node_modules/escope/lib/reference.js");
var _reference2 = _interopRequireDefault(_reference);
var _variable = __webpack_require__(/*! ./variable */ "./node_modules/escope/lib/variable.js");
var _variable2 = _interopRequireDefault(_variable);
var _scope = __webpack_require__(/*! ./scope */ "./node_modules/escope/lib/scope.js");
var _scope2 = _interopRequireDefault(_scope);
var _package = __webpack_require__(/*! ../package.json */ "./node_modules/escope/package.json");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function defaultOptions() {
return {
optimistic: false,
directive: false,
nodejsScope: false,
impliedStrict: false,
sourceType: 'script', // one of ['script', 'module']
ecmaVersion: 5,
childVisitorKeys: null,
fallback: 'iteration'
};
}
function updateDeeply(target, override) {
var key, val;
function isHashObject(target) {
return (typeof target === 'undefined' ? 'undefined' : _typeof(target)) === 'object' && target instanceof Object && !(target instanceof Array) && !(target instanceof RegExp);
}
for (key in override) {
if (override.hasOwnProperty(key)) {
val = override[key];
if (isHashObject(val)) {
if (isHashObject(target[key])) {
updateDeeply(target[key], val);
} else {
target[key] = updateDeeply({}, val);
}
} else {
target[key] = val;
}
}
}
return target;
}
/**
* Main interface function. Takes an Esprima syntax tree and returns the
* analyzed scopes.
* @function analyze
* @param {esprima.Tree} tree
* @param {Object} providedOptions - Options that tailor the scope analysis
* @param {boolean} [providedOptions.optimistic=false] - the optimistic flag
* @param {boolean} [providedOptions.directive=false]- the directive flag
* @param {boolean} [providedOptions.ignoreEval=false]- whether to check 'eval()' calls
* @param {boolean} [providedOptions.nodejsScope=false]- whether the whole
* script is executed under node.js environment. When enabled, escope adds
* a function scope immediately following the global scope.
* @param {boolean} [providedOptions.impliedStrict=false]- implied strict mode
* (if ecmaVersion >= 5).
* @param {string} [providedOptions.sourceType='script']- the source type of the script. one of 'script' and 'module'
* @param {number} [providedOptions.ecmaVersion=5]- which ECMAScript version is considered
* @param {Object} [providedOptions.childVisitorKeys=null] - Additional known visitor keys. See [esrecurse](https://github.com/estools/esrecurse)'s the `childVisitorKeys` option.
* @param {string} [providedOptions.fallback='iteration'] - A kind of the fallback in order to encounter with unknown node. See [esrecurse](https://github.com/estools/esrecurse)'s the `fallback` option.
* @return {ScopeManager}
*/
function analyze(tree, providedOptions) {
var scopeManager, referencer, options;
options = updateDeeply(defaultOptions(), providedOptions);
scopeManager = new _scopeManager2.default(options);
referencer = new _referencer2.default(options, scopeManager);
referencer.visit(tree);
(0, _assert2.default)(scopeManager.__currentScope === null, 'currentScope should be null.');
return scopeManager;
}
exports.version = _package.version;
exports.Reference = _reference2.default;
exports.Variable = _variable2.default;
exports.Scope = _scope2.default;
exports.ScopeManager = _scopeManager2.default;
/* vim: set sw=4 ts=4 et tw=80 : */
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbImFuYWx5emUiLCJkZWZhdWx0T3B0aW9ucyIsIm9wdGltaXN0aWMiLCJkaXJlY3RpdmUiLCJub2RlanNTY29wZSIsImltcGxpZWRTdHJpY3QiLCJzb3VyY2VUeXBlIiwiZWNtYVZlcnNpb24iLCJjaGlsZFZpc2l0b3JLZXlzIiwiZmFsbGJhY2siLCJ1cGRhdGVEZWVwbHkiLCJ0YXJnZXQiLCJvdmVycmlkZSIsImtleSIsInZhbCIsImlzSGFzaE9iamVjdCIsIk9iamVjdCIsIkFycmF5Iiwi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mF0aW9uJ1xuICAgIH07XG59XG5cbmZ1bmN0aW9uIHVwZGF0ZURlZXBseSh0YXJnZXQsIG92ZXJyaWRlKSB7XG4gICAgdmFyIGtleSwgdmFsO1xuXG4gICAgZnVuY3Rpb24gaXNIYXNoT2JqZWN0KHRhcmdldCkge1xuICAgICAgICByZXR1cm4gdHlwZW9mIHRhcmdldCA9PT0gJ29iamVjdCcgJiYgdGFyZ2V0IGluc3RhbmNlb2YgT2JqZWN0ICYmICEodGFyZ2V0IGluc3RhbmNlb2YgQXJyYXkpICYmICEodGFyZ2V0IGluc3RhbmNlb2YgUmVnRXhwKTtcbiAgICB9XG5cbiAgICBmb3IgKGtleSBpbiBvdmVycmlkZSkge1xuICAgICAgICBpZiAob3ZlcnJpZGUuaGFzT3duUHJvcGVydHkoa2V5KSkge1xuICAgICAgICAgICAgdmFsID0gb3ZlcnJpZGVba2V5XTtcbiAgICAgICAgICAgIGlmIChpc0hhc2hPYmplY3QodmFsKSkge1xuICAgICAgICAgICAgICAgIGlmIChpc0hhc2hPYmplY3QodGFyZ2V0W2tleV0pKSB7XG4gICAgICAgICAgICAgICAgICAgIHVwZGF0ZURlZXBseSh0YXJnZXRba2V5XSwgdmFsKTtcbiAgICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgICAgICB0YXJnZXRba2V5XSA9IHVwZGF0ZURlZXBseSh7fSwgdmFsKTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHRhcmdldFtrZXldID0gdmFsO1xuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgfVxuICAgIHJldHVybiB0YXJnZXQ7XG59XG5cbi8qKlxuICogTWFpbiBpbnRlcmZhY2UgZnVuY3Rpb24uIFRha2VzIGFuIEVzcHJpbWEgc3ludGF4IHRyZWUgYW5kIHJldHVybnMgdGhlXG4gKiBhbmFseXplZCBzY29wZXMuXG4gKiBAZnVuY3Rpb24gYW5hb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blxuICAgIGFzc2VydChzY29wZU1hbmFnZXIuX19jdXJyZW50U2NvcGUgPT09IG51bGwsICdjdXJyZW50U2NvcGUgc2hvdWxkIGJlIG51bGwuJyk7XG5cbiAgICByZXR1cm4gc2NvcGVNYW5hZ2VyO1xufVxuXG5leHBvcnQge1xuICAgIC8qKiBAbmFtZSBtb2R1bGU6ZXNjb3BlLnZlcnNpb24gKi9cbiAgICB2ZXJzaW9uLFxuICAgIC8qKiBAbmFtZSBtb2R1bGU6ZXNjb3BlLlJlZmVyZW5jZSAqL1xuICAgIFJlZmVyZW5jZSxcbiAgICAvKiogQG5hbWUgbW9kdWxlOmVzY29wZS5WYXJpYWJsZSAqL1xuICAgIFZhcmlhYmxlLFxuICAgIC8qKiBAbmFtZSBtb2R1bGU6ZXNjb3BlLlNjb3BlICovXG4gICAgU2NvcGUsXG4gICAgLyoqIEBuYW1lIG1vZHVsZTplc2NvcGUuU2NvcGVNYW5hZ2VyICovXG4gICAgU2NvcGVNYW5hZ2VyXG59O1xuXG5cbi8qIHZpbTogc2V0IHN3PTQgdHM9NCBldCB0dz04MCA6ICovXG4iXX0=
/***/ }),
/***/ "./node_modules/escope/lib/pattern-visitor.js":
/*!****************************************************!*\
!*** ./node_modules/escope/lib/pattern-visitor.js ***!
\****************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _estraverse = __webpack_require__(/*! estraverse */ "./node_modules/escope/node_modules/estraverse/estraverse.js");
var _esrecurse = __webpack_require__(/*! esrecurse */ "./node_modules/esrecurse/esrecurse.js");
var _esrecurse2 = _interopRequireDefault(_esrecurse);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /*
Copyright (C) 2015 Yusuke Suzuki <[email protected]>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
function getLast(xs) {
return xs[xs.length - 1] || null;
}
var PatternVisitor = function (_esrecurse$Visitor) {
_inherits(PatternVisitor, _esrecurse$Visitor);
_createClass(PatternVisitor, null, [{
key: 'isPattern',
value: function isPattern(node) {
var nodeType = node.type;
return nodeType === _estraverse.Syntax.Identifier || nodeType === _estraverse.Syntax.ObjectPattern || nodeType === _estraverse.Syntax.ArrayPattern || nodeType === _estraverse.Syntax.SpreadElement || nodeType === _estraverse.Syntax.RestElement || nodeType === _estraverse.Syntax.AssignmentPattern;
}
}]);
function PatternVisitor(options, rootPattern, callback) {
_classCallCheck(this, PatternVisitor);
var _this = _possibleConstructorReturn(this, (PatternVisitor.__proto__ || Object.getPrototypeOf(PatternVisitor)).call(this, null, options));
_this.rootPattern = rootPattern;
_this.callback = callback;
_this.assignments = [];
_this.rightHandNodes = [];
_this.restElements = [];
return _this;
}
_createClass(PatternVisitor, [{
key: 'Identifier',
value: function Identifier(pattern) {
var lastRestElement = getLast(this.restElements);
this.callback(pattern, {
topLevel: pattern === this.rootPattern,
rest: lastRestElement != null && lastRestElement.argument === pattern,
assignments: this.assignments
});
}
}, {
key: 'Property',
value: function 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);
}
}, {
key: 'ArrayPattern',
value: function ArrayPattern(pattern) {
var i, iz, element;
for (i = 0, iz = pattern.elements.length; i < iz; ++i) {
element = pattern.elements[i];
this.visit(element);
}
}
}, {
key: 'AssignmentPattern',
value: function AssignmentPattern(pattern) {
this.assignments.push(pattern);
this.visit(pattern.left);
this.rightHandNodes.push(pattern.right);
this.assignments.pop();
}
}, {
key: 'RestElement',
value: function RestElement(pattern) {
this.restElements.push(pattern);
this.visit(pattern.argument);
this.restElements.pop();
}
}, {
key: 'MemberExpression',
value: function MemberExpression(node) {
// Computed property's key is a right hand node.
if (node.computed) {
this.rightHandNodes.push(node.property);
}
// the object is only read, write to its property.
this.rightHandNodes.push(node.object);
}
//
// ForInStatement.left and AssignmentExpression.left are LeftHandSideExpression.
// By spec, LeftHandSideExpression is Pattern or MemberExpression.
// (see also: https://github.com/estree/estree/pull/20#issuecomment-74584758)
// But espree 2.0 and esprima 2.0 parse to ArrayExpression, ObjectExpression, etc...
//
}, {
key: 'SpreadElement',
value: function SpreadElement(node) {
this.visit(node.argument);
}
}, {
key: 'ArrayExpression',
value: function ArrayExpression(node) {
node.elements.forEach(this.visit, this);
}
}, {
key: 'AssignmentExpression',
value: function AssignmentExpression(node) {
this.assignments.push(node);
this.visit(node.left);
this.rightHandNodes.push(node.right);
this.assignments.pop();
}
}, {
key: 'CallExpression',
value: function CallExpression(node) {
var _this2 = this;
// arguments are right hand nodes.
node.arguments.forEach(function (a) {
_this2.rightHandNodes.push(a);
});
this.visit(node.callee);
}
}]);
return PatternVisitor;
}(_esrecurse2.default.Visitor);
/* vim: set sw=4 ts=4 et tw=80 : */
exports["default"] = PatternVisitor;
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInBhdHRlcm4tdmlzaXRvci5qcyJdLCJuYW1lcyI6WyJnZXRMYXN0IiwieHMiLCJsZW5ndGgiLCJQYXR0ZXJuVmlzaXRvciIsIm5vZGUiLCJub2RlVHlwZSIsInR5cGUiLCJTeW50YXgiLCJJZGVudGlmaWVyIiwiT2JqZWN0UGF0dGVybiIsIkFycmF5UGF0dGVybiIsIlNwcmVhZEVsZW1lbnQiLCJSZXN0RWxlbWVudCIsIkFzc2lnbm1lbnRQYXR0ZXJuIiwib3B0aW9ucyIsInJvb3RQYXR0ZXJuIiwiY2FsbGJhY2siLCJhc3NpZ25tZW50cyIsInJpZ2h0SGFuZE5vZGVzIi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Z3VtZW50cyBhcmUgcmlnaHQgaGFuZCBub2Rlcy5cbiAgICAgICAgbm9kZS5hcmd1bWVudHMuZm9yRWFjaChhID0+IHsgdGhpcy5yaWdodEhhbmROb2Rlcy5wdXNoKGEpOyB9KTtcbiAgICAgICAgdGhpcy52aXNpdChub2RlLmNhbGxlZSk7XG4gICAgfVxufVxuXG4vKiB2aW06IHNldCBzdz00IHRzPTQgZXQgdHc9ODAgOiAqL1xuIl19
/***/ }),
/***/ "./node_modules/escope/lib/reference.js":
/*!**********************************************!*\
!*** ./node_modules/escope/lib/reference.js ***!
\**********************************************/
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/*
Copyright (C) 2015 Yusuke Suzuki <[email protected]>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
var READ = 0x1;
var WRITE = 0x2;
var RW = READ | WRITE;
/**
* A Reference represents a single occurrence of an identifier in code.
* @class Reference
*/
var Reference = function () {
function Reference(ident, scope, flag, writeExpr, maybeImplicitGlobal, partial, init) {
_classCallCheck(this, Reference);
/**
* Identifier syntax node.
* @member {esprima#Identifier} Reference#identifier
*/
this.identifier = ident;
/**
* Reference to the enclosing Scope.
* @member {Scope} Reference#from
*/
this.from = scope;
/**
* Whether the reference comes from a dynamic scope (such as 'eval',
* 'with', etc.), and may be trapped by dynamic scopes.
* @member {boolean} Reference#tainted
*/
this.tainted = false;
/**
* The variable this reference is resolved with.
* @member {Variable} Reference#resolved
*/
this.resolved = null;
/**
* The read-write mode of the reference. (Value is one of {@link
* Reference.READ}, {@link Reference.RW}, {@link Reference.WRITE}).
* @member {number} Reference#flag
* @private
*/
this.flag = flag;
if (this.isWrite()) {
/**
* If reference is writeable, this is the tree being written to it.
* @member {esprima#Node} Reference#writeExpr
*/
this.writeExpr = writeExpr;
/**
* Whether the Reference might refer to a partial value of writeExpr.
* @member {boolean} Reference#partial
*/
this.partial = partial;
/**
* Whether the Reference is to write of initialization.
* @member {boolean} Reference#init
*/
this.init = init;
}
this.__maybeImplicitGlobal = maybeImplicitGlobal;
}
/**
* Whether the reference is static.
* @method Reference#isStatic
* @return {boolean}
*/
_createClass(Reference, [{
key: "isStatic",
value: function isStatic() {
return !this.tainted && this.resolved && this.resolved.scope.isStatic();
}
/**
* Whether the reference is writeable.
* @method Reference#isWrite
* @return {boolean}
*/
}, {
key: "isWrite",
value: function isWrite() {
return !!(this.flag & Reference.WRITE);
}
/**
* Whether the reference is readable.
* @method Reference#isRead
* @return {boolean}
*/
}, {
key: "isRead",
value: function isRead() {
return !!(this.flag & Reference.READ);
}
/**
* Whether the reference is read-only.
* @method Reference#isReadOnly
* @return {boolean}
*/
}, {
key: "isReadOnly",
value: function isReadOnly() {
return this.flag === Reference.READ;
}
/**
* Whether the reference is write-only.
* @method Reference#isWriteOnly
* @return {boolean}
*/
}, {
key: "isWriteOnly",
value: function isWriteOnly() {
return this.flag === Reference.WRITE;
}
/**
* Whether the reference is read-write.
* @method Reference#isReadWrite
* @return {boolean}
*/
}, {
key: "isReadWrite",
value: function isReadWrite() {
return this.flag === Reference.RW;
}
}]);
return Reference;
}();
/**
* @constant Reference.READ
* @private
*/
exports["default"] = Reference;
Reference.READ = READ;
/**
* @constant Reference.WRITE
* @private
*/
Reference.WRITE = WRITE;
/**
* @constant Reference.RW
* @private
*/
Reference.RW = RW;
/* vim: set sw=4 ts=4 et tw=80 : */
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInJlZmVyZW5jZS5qcyJdLCJuYW1lcyI6WyJSRUFEIiwiV1JJVEUiLCJSVyIsIlJlZmVyZW5jZSIsImlkZW50Iiwic2NvcGUiLCJmbGFnIiwid3JpdGVFeHByIiwibWF5YmVJbXBsaWNpdEdsb2JhbCIsInBhcnRpYWwiLCJpbml0IiwiaWRlbnRpZmllciIsImZyb20iLCJ0YWludGVkIiwicmVzb2x2ZWQiLCJpc1dyaXRlIiwiX19tYXliZUltcGxpY2l0R2xvYmFsIiwiaXNTdGF0aWMiXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQTs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBd0JBLElBQU1BLE9BQU8sR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iAgICBpc1JlYWRXcml0ZSgpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuZmxhZyA9PT0gUmVmZXJlbmNlLlJXO1xuICAgIH1cbn1cblxuLyoqXG4gKiBAY29uc3RhbnQgUmVmZXJlbmNlLlJFQURcbiAqIEBwcml2YXRlXG4gKi9cblJlZmVyZW5jZS5SRUFEID0gUkVBRDtcbi8qKlxuICogQGNvbnN0YW50IFJlZmVyZW5jZS5XUklURVxuICogQHByaXZhdGVcbiAqL1xuUmVmZXJlbmNlLldSSVRFID0gV1JJVEU7XG4vKipcbiAqIEBjb25zdGFudCBSZWZlcmVuY2UuUldcbiAqIEBwcml2YXRlXG4gKi9cblJlZmVyZW5jZS5SVyA9IFJXO1xuXG4vKiB2aW06IHNldCBzdz00IHRzPTQgZXQgdHc9ODAgOiAqL1xuIl19
/***/ }),
/***/ "./node_modules/escope/lib/referencer.js":
/*!***********************************************!*\
!*** ./node_modules/escope/lib/referencer.js ***!
\***********************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _estraverse = __webpack_require__(/*! estraverse */ "./node_modules/escope/node_modules/estraverse/estraverse.js");
var _esrecurse = __webpack_require__(/*! esrecurse */ "./node_modules/esrecurse/esrecurse.js");
var _esrecurse2 = _interopRequireDefault(_esrecurse);
var _reference = __webpack_require__(/*! ./reference */ "./node_modules/escope/lib/reference.js");
var _reference2 = _interopRequireDefault(_reference);
var _variable = __webpack_require__(/*! ./variable */ "./node_modules/escope/lib/variable.js");
var _variable2 = _interopRequireDefault(_variable);
var _patternVisitor = __webpack_require__(/*! ./pattern-visitor */ "./node_modules/escope/lib/pattern-visitor.js");
var _patternVisitor2 = _interopRequireDefault(_patternVisitor);
var _definition = __webpack_require__(/*! ./definition */ "./node_modules/escope/lib/definition.js");
var _assert = __webpack_require__(/*! assert */ "./node_modules/assert/build/assert.js");
var _assert2 = _interopRequireDefault(_assert);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /*
Copyright (C) 2015 Yusuke Suzuki <[email protected]>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
function traverseIdentifierInPattern(options, rootPattern, referencer, callback) {
// Call the callback at left hand identifier nodes, and Collect right hand nodes.
var visitor = new _patternVisitor2.default(options, rootPattern, callback);
visitor.visit(rootPattern);
// Process the right hand nodes recursively.
if (referencer != null) {
visitor.rightHandNodes.forEach(referencer.visit, referencer);
}
}
// Importing ImportDeclaration.
// http://people.mozilla.org/~jorendorff/es6-draft.html#sec-moduledeclarationinstantiation
// https://github.com/estree/estree/blob/master/es6.md#importdeclaration
// FIXME: Now, we don't create module environment, because the context is
// implementation dependent.
var Importer = function (_esrecurse$Visitor) {
_inherits(Importer, _esrecurse$Visitor);
function Importer(declaration, referencer) {
_classCallCheck(this, Importer);
var _this = _possibleConstructorReturn(this, (Importer.__proto__ || Object.getPrototypeOf(Importer)).call(this, null, referencer.options));
_this.declaration = declaration;
_this.referencer = referencer;
return _this;
}
_createClass(Importer, [{
key: 'visitImport',
value: function visitImport(id, specifier) {
var _this2 = this;
this.referencer.visitPattern(id, function (pattern) {
_this2.referencer.currentScope().__define(pattern, new _definition.Definition(_variable2.default.ImportBinding, pattern, specifier, _this2.declaration, null, null));
});
}
}, {
key: 'ImportNamespaceSpecifier',
value: function ImportNamespaceSpecifier(node) {
var local = node.local || node.id;
if (local) {
this.visitImport(local, node);
}
}
}, {
key: 'ImportDefaultSpecifier',
value: function ImportDefaultSpecifier(node) {
var local = node.local || node.id;
this.visitImport(local, node);
}
}, {
key: 'ImportSpecifier',
value: function ImportSpecifier(node) {
var local = node.local || node.id;
if (node.name) {
this.visitImport(node.name, node);
} else {
this.visitImport(local, node);
}
}
}]);
return Importer;
}(_esrecurse2.default.Visitor);
// Referencing variables and creating bindings.
var Referencer = function (_esrecurse$Visitor2) {
_inherits(Referencer, _esrecurse$Visitor2);
function Referencer(options, scopeManager) {
_classCallCheck(this, Referencer);
var _this3 = _possibleConstructorReturn(this, (Referencer.__proto__ || Object.getPrototypeOf(Referencer)).call(this, null, options));
_this3.options = options;
_this3.scopeManager = scopeManager;
_this3.parent = null;
_this3.isInnerMethodDefinition = false;
return _this3;
}
_createClass(Referencer, [{
key: 'currentScope',
value: function currentScope() {
return this.scopeManager.__currentScope;
}
}, {
key: 'close',
value: function close(node) {
while (this.currentScope() && node === this.currentScope().block) {
this.scopeManager.__currentScope = this.currentScope().__close(this.scopeManager);
}
}
}, {
key: 'pushInnerMethodDefinition',
value: function pushInnerMethodDefinition(isInnerMethodDefinition) {
var previous = this.isInnerMethodDefinition;
this.isInnerMethodDefinition = isInnerMethodDefinition;
return previous;
}
}, {
key: 'popInnerMethodDefinition',
value: function popInnerMethodDefinition(isInnerMethodDefinition) {
this.isInnerMethodDefinition = isInnerMethodDefinition;
}
}, {
key: 'materializeTDZScope',
value: function materializeTDZScope(node, iterationNode) {
// http://people.mozilla.org/~jorendorff/es6-draft.html#sec-runtime-semantics-forin-div-ofexpressionevaluation-abstract-operation
// TDZ scope hides the declaration's names.
this.scopeManager.__nestTDZScope(node, iterationNode);
this.visitVariableDeclaration(this.currentScope(), _variable2.default.TDZ, iterationNode.left, 0, true);
}
}, {
key: 'materializeIterationScope',
value: function materializeIterationScope(node) {
var _this4 = this;
// Generate iteration scope for upper ForIn/ForOf Statements.
var letOrConstDecl;
this.scopeManager.__nestForScope(node);
letOrConstDecl = node.left;
this.visitVariableDeclaration(this.currentScope(), _variable2.default.Variable, letOrConstDecl, 0);
this.visitPattern(letOrConstDecl.declarations[0].id, function (pattern) {
_this4.currentScope().__referencing(pattern, _reference2.default.WRITE, node.right, null, true, true);
});
}
}, {
key: 'referencingDefaultValue',
value: function referencingDefaultValue(pattern, assignments, maybeImplicitGlobal, init) {
var scope = this.currentScope();
assignments.forEach(function (assignment) {
scope.__referencing(pattern, _reference2.default.WRITE, assignment.right, maybeImplicitGlobal, pattern !== assignment.left, init);
});
}
}, {
key: 'visitPattern',
value: function visitPattern(node, options, callback) {
if (typeof options === 'function') {
callback = options;
options = { processRightHandNodes: false };
}
traverseIdentifierInPattern(this.options, node, options.processRightHandNodes ? this : null, callback);
}
}, {
key: 'visitFunction',
value: function visitFunction(node) {
var _this5 = this;
var i, iz;
// FunctionDeclaration name is defined in upper scope
// NOTE: Not referring variableScope. It is intended.
// Since
// in ES5, FunctionDeclaration should be in FunctionBody.
// in ES6, FunctionDeclaration should be block scoped.
if (node.type === _estraverse.Syntax.FunctionDeclaration) {
// id is defined in upper scope
this.currentScope().__define(node.id, new _definition.Definition(_variable2.default.FunctionName, node.id, node, null, null, null));
}
// FunctionExpression with name creates its special scope;
// FunctionExpressionNameScope.
if (node.type === _estraverse.Syntax.FunctionExpression && node.id) {
this.scopeManager.__nestFunctionExpressionNameScope(node);
}
// Consider this function is in the MethodDefinition.
this.scopeManager.__nestFunctionScope(node, this.isInnerMethodDefinition);
// Process parameter declarations.
for (i = 0, iz = node.params.length; i < iz; ++i) {
this.visitPattern(node.params[i], { processRightHandNodes: true }, function (pattern, info) {
_this5.currentScope().__define(pattern, new _definition.ParameterDefinition(pattern, node, i, info.rest));
_this5.referencingDefaultValue(pattern, info.assignments, null, true);
});
}
// if there's a rest argument, add that
if (node.rest) {
this.visitPattern({
type: 'RestElement',
argument: node.rest
}, function (pattern) {
_this5.currentScope().__define(pattern, new _definition.ParameterDefinition(pattern, node, node.params.length, true));
});
}
// Skip BlockStatement to prevent creating BlockStatement scope.
if (node.body.type === _estraverse.Syntax.BlockStatement) {
this.visitChildren(node.body);
} else {
this.visit(node.body);
}
this.close(node);
}
}, {
key: 'visitClass',
value: function visitClass(node) {
if (node.type === _estraverse.Syntax.ClassDeclaration) {
this.currentScope().__define(node.id, new _definition.Definition(_variable2.default.ClassName, node.id, node, null, null, null));
}
// FIXME: Maybe consider TDZ.
this.visit(node.superClass);
this.scopeManager.__nestClassScope(node);
if (node.id) {
this.currentScope().__define(node.id, new _definition.Definition(_variable2.default.ClassName, node.id, node));
}
this.visit(node.body);
this.close(node);
}
}, {
key: 'visitProperty',
value: function visitProperty(node) {
var previous, isMethodDefinition;
if (node.computed) {
this.visit(node.key);
}
isMethodDefinition = node.type === _estraverse.Syntax.MethodDefinition;
if (isMethodDefinition) {
previous = this.pushInnerMethodDefinition(true);
}
this.visit(node.value);
if (isMethodDefinition) {
this.popInnerMethodDefinition(previous);
}
}
}, {
key: 'visitForIn',
value: function visitForIn(node) {
var _this6 = this;
if (node.left.type === _estraverse.Syntax.VariableDeclaration && node.left.kind !== 'var') {
this.materializeTDZScope(node.right, node);
this.visit(node.right);
this.close(node.right);
this.materializeIterationScope(node);
this.visit(node.body);
this.close(node);
} else {
if (node.left.type === _estraverse.Syntax.VariableDeclaration) {
this.visit(node.left);
this.visitPattern(node.left.declarations[0].id, function (pattern) {
_this6.currentScope().__referencing(pattern, _reference2.default.WRITE, node.right, null, true, true);
});
} else {
this.visitPattern(node.left, { processRightHandNodes: true }, function (pattern, info) {
var maybeImplicitGlobal = null;
if (!_this6.currentScope().isStrict) {
maybeImplicitGlobal = {
pattern: pattern,
node: node
};
}
_this6.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false);
_this6.currentScope().__referencing(pattern, _reference2.default.WRITE, node.right, maybeImplicitGlobal, true, false);
});
}
this.visit(node.right);
this.visit(node.body);
}
}
}, {
key: 'visitVariableDeclaration',
value: function visitVariableDeclaration(variableTargetScope, type, node, index, fromTDZ) {
var _this7 = this;
// If this was called to initialize a TDZ scope, this needs to make definitions, but doesn't make references.
var decl, init;
decl = node.declarations[index];
init = decl.init;
this.visitPattern(decl.id, { processRightHandNodes: !fromTDZ }, function (pattern, info) {
variableTargetScope.__define(pattern, new _definition.Definition(type, pattern, decl, node, index, node.kind));
if (!fromTDZ) {
_this7.referencingDefaultValue(pattern, info.assignments, null, true);
}
if (init) {
_this7.currentScope().__referencing(pattern, _reference2.default.WRITE, init, null, !info.topLevel, true);
}
});
}
}, {
key: 'AssignmentExpression',
value: function AssignmentExpression(node) {
var _this8 = this;
if (_patternVisitor2.default.isPattern(node.left)) {
if (node.operator === '=') {
this.visitPattern(node.left, { processRightHandNodes: true }, function (pattern, info) {
var maybeImplicitGlobal = null;
if (!_this8.currentScope().isStrict) {
maybeImplicitGlobal = {
pattern: pattern,
node: node
};
}
_this8.referencingDefaultValue(pattern, info.assignments, maybeImplicitGlobal, false);
_this8.currentScope().__referencing(pattern, _reference2.default.WRITE, node.right, maybeImplicitGlobal, !info.topLevel, false);
});
} else {
this.currentScope().__referencing(node.left, _reference2.default.RW, node.right);
}
} else {
this.visit(node.left);
}
this.visit(node.right);
}
}, {
key: 'CatchClause',
value: function CatchClause(node) {
var _this9 = this;
this.scopeManager.__nestCatchScope(node);
this.visitPattern(node.param, { processRightHandNodes: true }, function (pattern, info) {
_this9.currentScope().__define(pattern, new _definition.Definition(_variable2.default.CatchClause, node.param, node, null, null, null));
_this9.referencingDefaultValue(pattern, info.assignments, null, true);
});
this.visit(node.body);
this.close(node);
}
}, {
key: 'Program',
value: function Program(node) {
this.scopeManager.__nestGlobalScope(node);
if (this.scopeManager.__isNodejsScope()) {
// Force strictness of GlobalScope to false when using node.js scope.
this.currentScope().isStrict = false;
this.scopeManager.__nestFunctionScope(node, false);
}
if (this.scopeManager.__isES6() && this.scopeManager.isModule()) {
this.scopeManager.__nestModuleScope(node);
}
if (this.scopeManager.isStrictModeSupported() && this.scopeManager.isImpliedStrict()) {
this.currentScope().isStrict = true;
}
this.visitChildren(node);
this.close(node);
}
}, {
key: 'Identifier',
value: function Identifier(node) {
this.currentScope().__referencing(node);
}
}, {
key: 'UpdateExpression',
value: function UpdateExpression(node) {
if (_patternVisitor2.default.isPattern(node.argument)) {
this.currentScope().__referencing(node.argument, _reference2.default.RW, null);
} else {
this.visitChildren(node);
}
}
}, {
key: 'MemberExpression',
value: function MemberExpression(node) {
this.visit(node.object);
if (node.computed) {
this.visit(node.property);
}
}
}, {
key: 'Property',
value: function Property(node) {
this.visitProperty(node);
}
}, {
key: 'MethodDefinition',
value: function MethodDefinition(node) {
this.visitProperty(node);
}
}, {
key: 'BreakStatement',
value: function BreakStatement() {}
}, {
key: 'ContinueStatement',
value: function ContinueStatement() {}
}, {
key: 'LabeledStatement',
value: function LabeledStatement(node) {
this.visit(node.body);
}
}, {
key: 'ForStatement',
value: function ForStatement(node) {
// Create ForStatement declaration.
// NOTE: In ES6, ForStatement dynamically generates
// per iteration environment. However, escope is
// a static analyzer, we only generate one scope for ForStatement.
if (node.init && node.init.type === _estraverse.Syntax.VariableDeclaration && node.init.kind !== 'var') {
this.scopeManager.__nestForScope(node);
}
this.visitChildren(node);
this.close(node);
}
}, {
key: 'ClassExpression',
value: function ClassExpression(node) {
this.visitClass(node);
}
}, {
key: 'ClassDeclaration',
value: function ClassDeclaration(node) {
this.visitClass(node);
}
}, {
key: 'CallExpression',
value: function CallExpression(node) {
// Check this is direct call to eval
if (!this.scopeManager.__ignoreEval() && node.callee.type === _estraverse.Syntax.Identifier && node.callee.name === 'eval') {
// NOTE: This should be `variableScope`. Since direct eval call always creates Lexical environment and
// let / const should be enclosed into it. Only VariableDeclaration affects on the caller's environment.
this.currentScope().variableScope.__detectEval();
}
this.visitChildren(node);
}
}, {
key: 'BlockStatement',
value: function BlockStatement(node) {
if (this.scopeManager.__isES6()) {
this.scopeManager.__nestBlockScope(node);
}
this.visitChildren(node);
this.close(node);
}
}, {
key: 'ThisExpression',
value: function ThisExpression() {
this.currentScope().variableScope.__detectThis();
}
}, {
key: 'WithStatement',
value: function WithStatement(node) {
this.visit(node.object);
// Then nest scope for WithStatement.
this.scopeManager.__nestWithScope(node);
this.visit(node.body);
this.close(node);
}
}, {
key: 'VariableDeclaration',
value: function VariableDeclaration(node) {
var variableTargetScope, i, iz, decl;
variableTargetScope = node.kind === 'var' ? this.currentScope().variableScope : this.currentScope();
for (i = 0, iz = node.declarations.length; i < iz; ++i) {
decl = node.declarations[i];
this.visitVariableDeclaration(variableTargetScope, _variable2.default.Variable, node, i);
if (decl.init) {
this.visit(decl.init);
}
}
}
// sec 13.11.8
}, {
key: 'SwitchStatement',
value: function SwitchStatement(node) {
var i, iz;
this.visit(node.discriminant);
if (this.scopeManager.__isES6()) {
this.scopeManager.__nestSwitchScope(node);
}
for (i = 0, iz = node.cases.length; i < iz; ++i) {
this.visit(node.cases[i]);
}
this.close(node);
}
}, {
key: 'FunctionDeclaration',
value: function FunctionDeclaration(node) {
this.visitFunction(node);
}
}, {
key: 'FunctionExpression',
value: function FunctionExpression(node) {
this.visitFunction(node);
}
}, {
key: 'ForOfStatement',
value: function ForOfStatement(node) {
this.visitForIn(node);
}
}, {
key: 'ForInStatement',
value: function ForInStatement(node) {
this.visitForIn(node);
}
}, {
key: 'ArrowFunctionExpression',
value: function ArrowFunctionExpression(node) {
this.visitFunction(node);
}
}, {
key: 'ImportDeclaration',
value: function ImportDeclaration(node) {
var importer;
(0, _assert2.default)(this.scopeManager.__isES6() && this.scopeManager.isModule(), 'ImportDeclaration should appear when the mode is ES6 and in the module context.');
importer = new Importer(node, this);
importer.visit(node);
}
}, {
key: 'visitExportDeclaration',
value: function visitExportDeclaration(node) {
if (node.source) {
return;
}
if (node.declaration) {
this.visit(node.declaration);
return;
}
this.visitChildren(node);
}
}, {
key: 'ExportDeclaration',
value: function ExportDeclaration(node) {
this.visitExportDeclaration(node);
}
}, {
key: 'ExportNamedDeclaration',
value: function ExportNamedDeclaration(node) {
this.visitExportDeclaration(node);
}
}, {
key: 'ExportSpecifier',
value: function ExportSpecifier(node) {
var local = node.id || node.local;
this.visit(local);
}
}, {
key: 'MetaProperty',
value: function MetaProperty() {
// do nothing.
}
}]);
return Referencer;
}(_esrecurse2.default.Visitor);
/* vim: set sw=4 ts=4 et tw=80 : */
exports["default"] =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ICAgICAgICAgICAgICAgIG5ldyBEZWZpbml0aW9uKFxuICAgICAgICAgICAgICAgICAgICBWYXJpYWJsZS5JbXBvcnRCaW5kaW5nLFxuICAgICAgICAgICAgICAgICAgICBwYXR0ZXJuLFxuICAgICAgICAgICAgICAgICAgICBzcGVjaWZpZXIsXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuZGVjbGFyYXRpb24sXG4gICAgICAgICAgICAgICAgICAgIG51bGwsXG4gICAgICAgICAgICAgICAgICAgIG51bGxcbiAgICAgICAgICAgICAgICAgICAgKSk7XG4gICAgICAgIH0pO1xuICAgIH1cblxuICAgIEltcG9ydE5hbWVzcGFjZVNwZWNpZmllcihub2RlKSB7XG4gICAgICAgIGxldCBsb2NhbCA9IChub2RlLmxvY2FsIHx8IG5vZGUuaWQpO1xuICAgICAgICBpZiAobG9jYWwpIHtcbiAgICAgICAgICAgIHRoaXMudmlzaXRJbXBvcnQobG9jYWwsIG5vZGUpO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgSW1wb3J0RGVmYXVsdFNwZWNpZmllcihub2RlKSB7XG4gICAgICAgIGxldCBsb2NhbCA9IChub2RlLmxvY2FsIHx8IG5vZGUuaWQpO1xuICAgICAgICB0aGlzLnZpc2l0SW1wb3J0KGxvY2FsLCBub2RlKTtcbiAgICB9XG5cbiAgICBJbXBvcnRTcGVjaWZpZXIobm9kZSkge1xuICAgICAgICBsZXQgbG9jYWwgPSAobm9kZS5sb2NhbCB8fCBub2RlLmlkKTtcbiAgICAgICAgaWYgKG5vZGUubmFtZSkge1xuICAgICAgICAgICAgdGhpcy52aXNpdEltcG9ydChub2RlLm5hbWUsIG5vZGUpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhpcy52aXNpdEltcG9ydChsb2NhbCwgbm9kZSk7XG4gICAgICAgIH1cbiAgICB9XG59XG5cbi8vIFJlZmVyZW5jaW5nIHZhcmlhYmxlcyBhbmQgY3JlYXRpbmcgYmluZGluZ3MuXG5leH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ICAgICAgICB0aGlzLnZpc2l0UGF0dGVybihsZXRPckNvbnN0RGVjbC5kZWNsYXJhdGlvbnNbMF0uaWQsIChwYXR0ZXJuKSA9PiB7XG4gICAgICAgICAgICB0aGlzLmN1cnJlbnRTY29wZSgpLl9fcmVmZXJlbmNpbmcocGF0dGVybiwgUmVmZXJlbmNlLldSSVRFLCBub2RlLnJpZ2h0LCBudWxsLCB0cnVlLCB0cnVlKTtcbiAgICAgICAgfSk7XG4gICAgfVxuXG4gICAgcmVmZXJlbmNpbmdEZWZhdWx0VmFsdWUocGF0dGVybiwgYXNzaWdubWVudHMsIG1heWJlSW1wbGljaXRHbG9iYWwsIGluaXQpIHtcbiAgICAgICAgY29uc3Qgc2NvcGUgPSB0aGlzLmN1cnJlbnRTY29wZSgpO1xuICAgICAgICBhc3NpZ25tZW50cy5mb3JFYWNoKGFzc2lnbm1lbnQgPT4ge1xuICAgICAgICAgICAgc2NvcGUuX19yZWZlcmVuY2luZyhcbiAgICAgICAgICAgICAgICBwYXR0ZXJuLFxuICAgICAgICAgICAgICAgIFJlZmVyZW5jZS5XUklURSxcbiAgICAgICAgICAgICAgICBhc3NpZ25tZW50LnJpZ2h0LFxuICAgICAgICAgICAgICAgIG1heWJlSW1wbGljaXRHbG9iYWwsXG4gICAgICAgICAgICAgICAgcGF0dGVybiAhPT0gYXNzaWdubWVudC5sZWZ0LFxuICAgICAgICAgICAgICAgIGluaXQpO1xuICAgICAgICB9KTtcbiAgICB9XG5cbiAgICB2aXNpdFBhdHRlcm4obm9kZSwgb3B0aW9ucywgY2FsbGJhY2spIHtcbiAgICAgICAgaWYgKHR5cGVvZiBvcHRpb25zID09PSAnZnVuY3Rpb24nKSB7XG4gICAgICAgICAgICBjYWxsYmFjayA9IG9wdGlvbnM7XG4gICAgICAgICAgICBvcHRpb25zID0ge3Byb2Nlc3NSaWdodEhhbmROb2RlczogZmFsc2V9XG4gICAgICAgIH1cbiAgICAgICAgdHJhdmVyc2VJZGVudGlmaWVySW5QYXR0ZXJuKFxuICAgICAgICAgICAgdGhpcy5vcHRpb25zLFxuICAgICAgICAgICAgbm9kZSxcbiAgICAgICAgICAgIG9wdGlvbnMucHJvY2Vzc1JpZ2h0SGFuZE5vZGVzID8gdGhpcyA6IG51bGwsXG4gICAgICAgICAgICBjYWxsYmFjayk7XG4gICAgfVxuXG4gICAgdmlzaXRGdW5jdGlvbihub2RlKSB7XG4gICAgICAgIHZhciBpLCBpejtcbiAgICAgICAgLy8gRnVuY3Rpb25EZWNsYXJhdGlvbiBuYW1lIGlzIGRlZmluZWQgaW4gdXBwZXIgc2NvcGVcbiAgICAgICAgLy8gTk9URTogTm90IHJlZmVycmluZyB2YXJpYWJsZVNjb3BlLiBJdCBpcyBpbnRlbmRlZC5cbiAgICAgICAgLy8gU2luY2VcbiAgICAgICAgLy8gIGluIEVTNSwgRnVuY3Rpb25EZWNsYXJhdGlvbiBzaG91bGQgYmUgaW4gRnVuY3Rpb25Cb2R5LlxuICAgICAgICAvLyAgaW4gRVM2LCBGdW5jdGlvbkRlY2xhcmF0aW9uIHNob3VsZCBiZSBibG9jayBzY29wZWQuXG4gICAgICAgIGlmIChub2RlLnR5cGUgPT09IFN5bnRheC5GdW5jdGlvbkRlY2xhcmF0aW9uKSB7XG4gICAgICAgICAgICAvLyBpZCBpcyBkZWZpbmVkIGluIHVwcGVyIHNjb3BlXG4gICAgICAgICAgICB0aGlzLmN1cnJlbnRTY29wZSgpLl9fZGVmaW5lKG5vZGUuaWQsXG4gICAgICAgICAgICAgICAgICAgIG5ldyBEZWZpbml0aW9uKFxuICAgICAgICAgICAgICAgICAgICAgICAgVmFyaWFibGUuRnVuY3Rpb25OYW1lLFxuICAgICAgICAgICAgICAgICAgICAgICAgbm9kZS5pZCxcbiAgICAgICAgICAgICAgICAgICAgICAgIG5vZGUsXG4gICAgICAgICAgICAgICAgICAgICAgICBudWxsLFxuICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCxcbiAgICAgICAgICAgICAgICAgICAgICAgIG51bGxcbiAgICAgICAgICAgICAgICAgICAgKSk7XG4gICAgICAgIH1cblxuICAgICAgICAvLyBGdW5jdGlvbkV4cHJlc3Npb24gd2l0aCBuYW1lIGNyZWF0ZXMgaXRzIHNwZWNpYWwgc2NvcGU7XG4gICAgICAgIC8vIEZ1bmN0aW9uRXhwcmVzc2lvbk5hbWVTY29wZS5cbiAgICAgICAgaWYgKG5vZGUudHlwZSA9PT0gU3ludGF4LkZ1bmN0aW9uRXhwcmVzc2lvbiAmJiBub2RlLmlkKSB7XG4gICAgICAgICAgICB0aGlzLnNjb3BlTWFuYWdlci5fX25lc3RGdW5jdGlvbkV4cHJlc3Npb25OYW1lU2NvcGUobm9kZSk7XG4gICAgICAgIH1cblxuICAgICAgICAvLyBDb25zaWRlciB0aGlzIGZ1bmN0aW9uIGlzIGluIHRoZSBNZXRob2REZWZpbml0aW9uLlxuICAgICAgICB0aGlzLnNjb3BlTWFuYWdlci5fX25lc3RGdW5jdGlvblNjb3BlKG5vZGUsIHRoaXMuaXNJbm5lck1ldGhvZERlZmluaXRpb24pO1xuXG4gICAgICAgIC8vIFByb2Nlc3MgcGFyYW1ldGVyIGRlY2xhcmF0aW9ucy5cbiAgICAgICAgZm9yIChpID0gMCwgaXogPSBub2RlLnBhcmFtcy5sZW5ndGg7IGkgPCBpejsgKytpKSB7XG4gICAgICAgICAgICB0aGlzLnZpc2l0UGF0dGVybihub2RlLnBhcmFtc1tpXSwge3Byb2Nlc3NSaWdodEhhbmROb2RlczogdHJ1ZX0sIChwYXR0ZXJuLCBpbmZvKSA9PiB7XG4gICAgICAgICAgICAgICAgdGhpcy5jdXJyZW50U2NvcGUoKS5fX2RlZmluZShwYXR0ZXJuLFxuICAgICAgICAgICAgICAgICAgICBuZXcgUGFyYW1ldGVyRGVmaW5pdGlvbihcbiAgICAgICAgICAgICAgICAgICAgICAgIHBhdHRlcm4sXG4gICAgICAgICAgICAgICAgICAgICAgICBub2RlLFxuICAgICAgICAgICAgICAgICAgICAgICAgaSxcbiAgICAgICAgICAgICAgICAgICAgICAgIGluZm8ucmVzdFxuICAgICAgICAgICAgICAgICAgICApKTtcblxuICAgICAgICAgICAgICAgIHRoaXMucmVmZXJlbmNpbmdEZWZhdWx0VmFsdWUocGF0dGVybiwgaW5mby5hc3NpZ25tZW50cywgbnVsbCwgdHJ1ZSk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIGlmIHRoZXJlJ3MgYSByZXN0IGFyZ3VtZW50LCBhZGQgdGhhdFxuICAgICAgICBpZiAobm9kZS5yZXN0KSB7XG4gICAgICAgICAgICB0aGlzLnZpc2l0UGF0dGVybih7XG4gICAgICAgICAgICAgICAgdHlwZTogJ1Jlc3RFbGVtZW50JyxcbiAgICAgICAgICAgICAgICBhcmd1bWVudDogbm9kZS5yZXN0XG4gICAgICAgICAgICB9LCAocGF0dGVybikgPT4ge1xuICAgICAgICAgICAgICAgIHRoaXMuY3VycmVudFNjb3BlKCkuX19kZWZpbmUocGF0dGVybixcbiAgICAgICAgICAgICAgICAgICAgbmV3IFBhcmFtZXRlckRlZmluaXRpb24oXG4gICAgICAgICAgICAgICAgICAgICAgICBwYXR0ZXJuLFxuICAgICAgICAgICAgICAgICAgICAgICAgbm9kZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIG5vZGUucGFyYW1zLmxlbmd0aCxcbiAgICAgICAgICAgICAgICAgICAgICAgIHRydWVcbiAgICAgICAgICAgICAgICAgICAgKSk7XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIFNraXAgQmxvY2tTdGF0ZW1lbnQgdG8gcHJldmVudCBjcmVhdGluZyBCbG9ja1N0YXRlbWVudCBzY29wZS5cbiAgICAgICAgaWYgKG5vZGUuYm9keS50eXBlID09PSBTeW50YXguQmxvY2tTdGF0ZW1lbnQpIHtcbiAgICAgICAgICAgIHRoaXMudmlzaXRDaGlsZHJlbihub2RlLmJvZHkpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhpcy52aXNpdChub2RlLmJvZHkpO1xuICAgICAgICB9XG5cbiAgICAgICAgdGhpcy5jbG9zZShub2RlKTtcbiAgICB9XG5cbiAgICB2aXNpdENsYXNzKG5vZGUpIHtcbiAgICAgICAgaWYgKG5vZGUudHlwZSA9PT0gU3ludGF4LkNsYXNzRGVjbGFyYXRpb24pIHtcbiAgICAgICAgICAgIHRoaXMuY3VycmVudFNjb3BlKCkuX19kZWZpbmUobm9kZS5pZCxcbiAgICAgICAgICAgICAgICAgICAgbmV3IERlZmluaXRpb24oXG4gICAgICAgICAgICAgICAgICAgICAgICBWYXJpYWJsZS5DbGFzc05hbWUsXG4gICAgICAgICAgICAgICAgICAgICAgICBub2RlLmlkLFxuICAgICAgICAgICAgICAgICAgICAgICAgbm9kZSxcbiAgICAgICAgICAgICAgICAgICAgICAgIG51bGwsXG4gICAgICAgICAgICAgICAgICAgICAgICBudWxsLFxuICAgICAgICAgICAgICAgICAgICAgICAgbnVsbFxuICAgICAgICAgICAgICAgICAgICApKTtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIEZJWE1FOiBNYXliZSBjb25zaWRlciBURFouXG4gICAgICAgIHRoaXMudmlzaXQobm9kZS5zdXBlckNsYXNzKTtcblxuICAgICAgICB0aGlzLnNjb3BlTWFuYWdlci5fX25lc3RDbGFzc1Njb3BlKG5vZGUpO1xuXG4gICAgICAgIGlmIChub2RlLmlkKSB7XG4gICAgICAgICAgICB0aGlzLmN1cnJlbnRTY29wZSgpLl9fZGVmaW5lKG5vZGUuaWQsXG4gICAgICAgICAgICAgICAgICAgIG5ldyBEZWZpbml0aW9uKFxuICAgICAgICAgICAgICAgICAgICAgICAgVmFyaWFibGUuQ2xhc3NOYW1lLFxuICAgICAgICAgICAgICAgICAgICAgICAgbm9kZS5pZCxcbiAgICAgICAgICAgICAgICAgICAgICAgIG5vZGVcbiAgICAgICAgICAgICAgICAgICAgKSk7XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy52aXNpdChub2RlLmJvZHkpO1xuXG4gICAgICAgIHRoaXMuY2xvc2Uobm9kZSk7XG4gICAgfVxuXG4gICAgdmlzaXRQcm9wZXJ0eShub2RlKSB7XG4gICAgICAgIHZhciBwcmV2aW91cywgaXNNZXRob2REZWZpbml0aW9uO1xuICAgICAgICBpZiAobm9kZS5jb21wdXRlZCkge1xuICAgICAgICAgICAgdGhpcy52aXNpdChub2RlLmtleSk7XG4gICAgICAgIH1cblxuICAgICAgICBpc01ldGhvZERlZmluaXRpb24gPSBub2RlLnR5cGUgPT09IFN5bnRheC5NZXRob2REZWZpbml0aW9uO1xuICAgICAgICBpZiAoaXNNZXRob2REZWZpbml0aW9uKSB7XG4gICAgICAgICAgICBwcmV2aW91cyA9IHRoaXMucHVzaElubmVyTWV0aG9kRGVmaW5pdGlvbih0cnVlKTtcbiAgICAgICAgfVxuICAgICAgICB0aGlzLnZpc2l0KG5vZGUudmFsdWUpO1xuICAgICAgICBpZiAoaXNNZXRob2REZWZpbml0aW9uKSB7XG4gICAgICAgICAgICB0aGlzLnBvcElubmVyTWV0aG9kRGVmaW5pdGlvbihwcmV2aW91cyk7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICB2aXNpdEZvckluKG5vZGUpIHtcbiAgICAgICAgaWYgKG5vZGUubGVmdC50eXBlID09PSBTeW50YXguVmFyaWFibGVEZWNsYXJhdGlvbiAmJiBub2RlLmxlZnQua2luZCAhPT0gJ3ZhcicpIHtcbiAgICAgICAgICAgIHRoaXMubWF0ZXJpYWxpemVURFpTY29wZShub2RlLnJpZ2h0LCBub2RlKTtcbiAgICAgICAgICAgIHRoaXMudmlzaXQobm9kZS5yaWdodCk7XG4gICAgICAgICAgICB0aGlzLmNsb3NlKG5vZGUucmlnaHQpO1xuXG4gICAgICAgICAgICB0aGlzLm1hdGVyaWFsaXplSXRlcmF0aW9uU2NvcGUobm9kZSk7XG4gICAgICAgICAgICB0aGlzLnZpc2l0KG5vZGUuYm9keSk7XG4gICAgICAgICAgICB0aGlzLmNsb3NlKG5vZGUpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgaWYgKG5vZGUubGVmdC50eXBlID09PSBTeW50YXguVmFyaWFibGVEZWNsYXJhdGlvbikge1xuICAgICAgICAgICAgICAgIHRoaXMudmlzaXQobm9kZS5sZWZ0KTtcbiAgICAgICAgICAgICAgICB0aGlzLnZpc2l0UGF0dGVybihub2RlLmxlZnQuZGVjbGFyYXRpb25zWzBdLmlkLCAocGF0dGVybikgPT4ge1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmN1cnJlbnRTY29wZSgpLl9fcmVmZXJlbmNpbmcocGF0dGVybiwgUmVmZXJlbmNlLldSSVRFLCBub2RlLnJpZ2h0LCBudWxsLCB0cnVlLCB0cnVlKTtcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgdGhpcy52aXNpdFBhdHRlcm4obm9kZS5sZWZ0LCB7cHJvY2Vzc1JpZ2h0SGFuZE5vZGVzOiB0cnVlfSwgKHBhdHRlcm4sIGluZm8pID0+IHtcbiAgICAgICAgICAgICAgICAgICAgdmFyIG1heWJlSW1wbGljaXRHbG9iYWwgPSBudWxsO1xuICAgICAgICAgICAgICAgICAgICBpZiAoIXRoaXMuY3VycmVudFNjb3BlKCkuaXNTdHJpY3QpIHtcbiAgICAgICAgICAgICAgICAgICAgICAgIG1heWJlSW1wbGljaXRHbG9iYWwgPSB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgcGF0dGVybjogcGF0dGVybixcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBub2RlOiBub2RlXG4gICAgICAgICAgICAgICAgICAgICAgICB9O1xuICAgICAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgICAgICAgIHRoaXMucmVmZXJlbmNpbmdEZWZhdWx0VmFsdWUocGF0dGVybiwgaW5mby5hc3NpZ25tZW50cywgbWF5YmVJbXBsaWNpdEdsb2JhbCwgZmFsc2UpO1xuICAgICAgICAgICAgICAgICAgICB0aGlzLmN1cnJlbnRTY29wZSgpLl9fcmVmZXJlbmNpbmcocGF0dGVybiwgUmVmZXJlbmNlLldSSVRFLCBub2RlLnJpZ2h0LCBtYXliZUltcGxpY2l0R2xvYmFsLCB0cnVlLCBmYWxzZSk7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICB0aGlzLnZpc2l0KG5vZGUucmlnaHQpO1xuICAgICAgICAgICAgdGhpcy52aXNpdChub2RlLmJvZHkpO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgdmlzaXRWYXJpYWJsZURlY2xhcmF0aW9uKHZhcmlhYmxlVGFyZ2V0U2NvcGUsIHR5cGUsIG5vZGUsIGluZGV4LCBmcm9tVERaKSB7XG4gICAgICAgIC8vIElmIHRoaXMgd2FzIGNhbGxlZCB0byBpbml0aWFsaXplIGEgVERaIHNjb3BlLCB0aGlzIG5lZWRzIHRvIG1ha2UgZGVmaW5pdGlvbnMsIGJ1dCBkb2Vzbid0IG1ha2UgcmVmZXJlbmNlcy5cbiAgICAgICAgdmFyIGRlY2wsIGluaXQ7XG5cbiAgICAgICAgZGVjbCA9IG5vZGUuZGVjbGFyYXRpb25zW2luZGV4XTtcbiAgICAgICAgaW5pdCA9IGRlY2wuaW5pdDtcbiAgICAgICAgdGhpcy52aXNpdFBhdHRlcm4oZGVjbC5pZCwge3Byb2Nlc3NSaWdodEhhbmROb2RlczogIWZyb21URFp9LCAocGF0dGVybiwgaW5mbykgPT4ge1xuICAgICAgICAgICAgdmFyaWFibGVUYXJnZXRTY29wZS5fX2RlZmluZShwYXR0ZXJuLFxuICAgICAgICAgICAgICAgIG5ldyBEZWZpbml0aW9uKFxuICAgICAgICAgICAgICAgICAgICB0eXBlLFxuICAgICAgICAgICAgICAgICAgICBwYXR0ZXJuLFxuICAgICAgICAgICAgICAgICAgICBkZWNsLFxuICAgICAgICAgICAgICAgICAgICBub2RlLFxuICAgICAgICAgICAgICAgICAgICBpbmRleCxcbiAgICAgICAgICAgICAgICAgICAgbm9kZS5raW5kXG4gICAgICAgICAgICAgICAgKSk7XG5cbiAgICAgICAgICAgIGlmICghZnJvbVREWikge1xuICAgICAgICAgICAgICAgIHRoaXMucmVmZXJlbmNpbmdEZWZhdWx0VmFsdWUocGF0dGVybiwgaW5mby5hc3NpZ25tZW50cywgbnVsbCwgdHJ1ZSk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICBpZiAoaW5pdCkge1xuICAgICAgICAgICAgICAgIHRoaXMuY3VycmVudFNjb3BlKCkuX19yZWZlcmVuY2luZyhwYXR0ZXJuLCBSZWZlcmVuY2UuV1JJVEUsIGluaXQsIG51bGwsICFpbmZvLnRvcExldmVsLCB0cnVlKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgfSk7XG4gICAgfVxuXG4gICAgQXNzaWdubWVudEV4cHJlc3Npb24obm9kZSkge1xuICAgICAgICBpZiAoUGF0dGVyblZpc2l0b3IuaXNQYXR0ZXJuKG5vZGUubGVmdCkpIHtcbiAgICAgICAgICAgIGlmIChub2RlLm9wZXJhdG9yID09PSAnPScpIHtcbiAgICAgICAgICAgICAgICB0aGlzLnZpc2l0UGF0dGVybihub2RlLmxlZnQsIHtwcm9jZXNzUmlnaHRIYW5kTm9kZXM6IHRydWV9LCAocGF0dGVybiwgaW5mbykgPT4ge1xuICAgICAgICAgICAgICAgICAgICB2YXIgbWF5YmVJbXBsaWNpdEdsb2JhbCA9IG51bGw7XG4gICAgICAgICAgICAgICAgICAgIGlmICghdGhpcy5jdXJyZW50U2NvcGUoKS5pc1N0cmljdCkge1xuICAgICAgICAgICAgICAgICAgICAgICAgbWF5YmVJbXBsaWNpdEdsb2JhbCA9IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICBwYXR0ZXJuOiBwYXR0ZXJuLFxuICAgICAgICAgICAgICAgICAgICAgICAgICAgIG5vZGU6IG5vZGVcbiAgICAgICAgICAgICAgICAgICAgICAgIH07XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgICAgdGhpcy5yZWZlcmVuY2luZ0RlZmF1bHRWYWx1ZShwYXR0ZXJuLCBpbmZvLmFzc2lnbm1lbnRzLCBtYXliZUltcGxpY2l0R2xvYmFsLCBmYWxzZSk7XG4gICAgICAgICAgICAgICAgICAgIHRoaXMuY3VycmVudFNjb3BlKCkuX19yZWZlcmVuY2luZyhwYXR0ZXJuLCBSZWZlcmVuY2UuV1JJVEUsIG5vZGUucmlnaHQsIG1heWJlSW1wbGljaXRHbG9iYWwsICFpbmZvLnRvcExldmVsLCBmYWxzZSk7XG4gICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIHRoaXMuY3VycmVudFNjb3BlKCkuX19yZWZlcmVuY2luZyhub2RlLmxlZnQsIFJlZmVyZW5jZS5SVywgbm9kZS5yaWdodCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICB0aGlzLnZpc2l0KG5vZGUubGVmdCk7XG4gICAgICAgIH1cbiAgICAgICAgdGhpcy52aXNpdChub2RlLnJpZ2h0KTtcbiAgICB9XG5cbiAgICBDYXRjaENsYXVzZShub2RlKSB7XG4gICAgICAgIHRoaXMuc2NvcGVNYW5hZ2VyLl9fbmVzdENhdGNoU2NvcGUobm9kZSk7XG5cbiAgICAgICAgdGhpcy52aXNpdFBhdHRlcm4obm9kZS5wYXJhbSwge3Byb2Nlc3NSaWdodEhhbmROb2RlczogdHJ1ZX0sIChwYXR0ZXJuLCBpbmZvKSA9PiB7XG4gICAgICAgICAgICB0aGlzLmN1cnJlbnRTY29wZSgpLl9fZGVmaW5lKHBhdHRlcm4sXG4gICAgICAgICAgICAgICAgbmV3IERlZmluaXRpb24oXG4gICAgICAgICAgICAgICAgICAgIFZhcmlhYmxlLkNhdGNoQ2xhdXNlLFxuICAgICAgICAgICAgICAgICAgICBub2RlLnBhcmFtLFxuICAgICAgICAgICAgICAgICAgICBub2RlLFxuICAgICAgICAgICAgICAgICAgICBudWxsLFxuICAgICAgICAgICAgICAgICAgICBudWxsLFxuICAgICAgICAgICAgICAgICAgICBudWxsXG4gICAgICAgICAgICAgICAgKSk7XG4gICAgICAgICAgICB0aGlzLnJlZmVyZW5jaW5nRGVmYXVsdFZhbHVlKHBhdHRlcm4sIGluZm8uYXNzaWdubWVudHMsIG51bGwsIHRydWUpO1xuICAgICAgICB9KTtcbiAgICAgICAgdGhpcy52aXNpdChub2RlLmJvZHkpO1xuXG4gICAgICAgIHRoaXMuY2xvc2Uobm9kZSk7XG4gICAgfVxuXG4gICAgUHJvZ3JhbShub2RlKSB7XG4gICAgICAgIHRoaXMuc2NvcGVNYW5hZ2VyLl9fbmVzdEdsb2JhbFNjb3BlKG5vZGUpO1xuXG4gICAgICAgIGlmICh0aGlzLnNjb3BlTWFuYWdlci5fX2lzTm9kZWpzU2NvcGUoKSkge1xuICAgICAgICAgICAgLy8gRm9yY2Ugc3RyaWN0bmVzcyBvZiBHbG9iYWxTY29wZSB0byBmYWxzZSB3aGVuIHVzaW5nIG5vZGUuanMgc2NvcGUuXG4gICAgICAgICAgICB0aGlzLmN1cnJlbnRTY29wZSgpLmlzU3RyaWN0ID0gZmFsc2U7XG4gICAgICAgICAgICB0aGlzLnNjb3BlTWFuYWdlci5fX25lc3RGdW5jdGlvblNjb3BlKG5vZGUsIGZhbHNlKTtcbiAgICAgICAgfVxuXG4gICAgICAgIGlmICh0aGlzLnNjb3BlTWFuYWdlci5fX2lzRVM2KCkgJiYgdGhpcy5zY29wZU1hbmFnZXIuaXNNb2R1bGUoKSkge1xuICAgICAgICAgICAgdGhpcy5zY29wZU1hbmFnZXIuX19uZXN0TW9kdWxlU2NvcGUobm9kZSk7XG4gICAgICAgIH1cblxuICAgICAgICBpZiAodGhpcy5zY29wZU1hbmFnZXIuaXNTdHJpY3RNb2RlU3VwcG9ydGVkKCkgJiYgdGhpcy5zY29wZU1hbmFnZXIuaXNJbXBsaWVkU3RyaWN0KCkpIHtcbiAgICAgICAgICAgIHRoaXMuY3VycmVudFNjb3BlKCkuaXNTdHJpY3QgPSB0cnVlO1xuICAgICAgICB9XG5cbiAgICAgICAgdGhpcy52aXNpdENoaWxkcmVuKG5vZGUpO1xuICAgICAgICB0aGlzLmNsb3NlKG5vZGUpO1xuICAgIH1cblxuICAgIElkZW50aWZpZXIobm9kZSkge1xuICAgICAgICB0aGlzLmN1cnJlbnRTY29wZSgpLl9fcmVmZXJlbmNpbmcobm9kZSk7XG4gICAgfVxuXG4gICAgVXBkYXRlRXhwcmVzc2lvbihub2RlKSB7XG4gICAgICAgIGlmIChQYXR0ZXJuVmlzaXRvci5pc1BhdHRlcm4obm9kZS5hcmd1bWVudCkpIHtcbiAgICAgICAgICAgIHRoaXMuY3VycmVudFNjb3BlKCkuX19yZWZlcmVuY2luZyhub2RlLmFyZ3VtZW50LCBSZWZlcmVuY2UuUlcsIG51bGwpO1xuICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgdGhpcy52aXNpdENoaWxkcmVuKG5vZGUpO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgTWVtYmVyRXhwcmVzc2lvbihub2RlKSB7XG4gICAgICAgIHRoaXMudmlzaXQobm9kZS5vYmplY3QpO1xuICAgICAgICBpZiAobm9kZS5jb21wdXRlZCkge1xuICAgICAgICAgICAgdGhpcy52aXNpdChub2RlLnByb3BlcnR5KTtcbiAgICAgICAgfVxuICAgIH1cblxuICAgIFByb3BlcnR5KG5vZGUpIHtcbiAgICAgICAgdGhpcy52aXNpdFByb3BlcnR5KG5vZGUpO1xuICAgIH1cblxuICAgIE1ldGhvZERlZmluaXRpb24obm9kZSkge1xuICAgICAgICB0aGlzLnZpc2l0UHJvcGVydHkobm9kZSk7XG4gICAgfVxuXG4gICAgQnJlYWtTdGF0ZW1lbnQoKSB7fVxuXG4gICAgQ29udGludWVTdGF0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gIGltcG9ydGVyLnZpc2l0KG5vZGUpO1xuICAgIH1cblxuICAgIHZpc2l0RXhwb3J0RGVjbGFyYXRpb24obm9kZSkge1xuICAgICAgICBpZiAobm9kZS5zb3VyY2UpIHtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuICAgICAgICBpZiAobm9kZS5kZWNsYXJhdGlvbikge1xuICAgICAgICAgICAgdGhpcy52aXNpdChub2RlLmRlY2xhcmF0aW9uKTtcbiAgICAgICAgICAgIHJldHVybjtcbiAgICAgICAgfVxuXG4gICAgICAgIHRoaXMudmlzaXRDaGlsZHJlbihub2RlKTtcbiAgICB9XG5cbiAgICBFeHBvcnREZWNsYXJhdGlvbihub2RlKSB7XG4gICAgICAgIHRoaXMudmlzaXRFeHBvcnREZWNsYXJhdGlvbihub2RlKTtcbiAgICB9XG5cbiAgICBFeHBvcnROYW1lZERlY2xhcmF0aW9uKG5vZGUpIHtcbiAgICAgICAgdGhpcy52aXNpdEV4cG9ydERlY2xhcmF0aW9uKG5vZGUpO1xuICAgIH1cblxuICAgIEV4cG9ydFNwZWNpZmllcihub2RlKSB7XG4gICAgICAgIGxldCBsb2NhbCA9IChub2RlLmlkIHx8IG5vZGUubG9jYWwpO1xuICAgICAgICB0aGlzLnZpc2l0KGxvY2FsKTtcbiAgICB9XG5cbiAgICBNZXRhUHJvcGVydHkoKSB7XG4gICAgICAgIC8vIGRvIG5vdGhpbmcuXG4gICAgfVxufVxuXG4vKiB2aW06IHNldCBzdz00IHRzPTQgZXQgdHc9ODAgOiAqL1xuIl19
/***/ }),
/***/ "./node_modules/escope/lib/scope-manager.js":
/*!**************************************************!*\
!*** ./node_modules/escope/lib/scope-manager.js ***!
\**************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /*
Copyright (C) 2015 Yusuke Suzuki <[email protected]>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
var _scope = __webpack_require__(/*! ./scope */ "./node_modules/escope/lib/scope.js");
var _scope2 = _interopRequireDefault(_scope);
var _assert = __webpack_require__(/*! assert */ "./node_modules/assert/build/assert.js");
var _assert2 = _interopRequireDefault(_assert);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* @class ScopeManager
*/
var ScopeManager = function () {
function ScopeManager(options) {
_classCallCheck(this, ScopeManager);
this.scopes = [];
this.globalScope = null;
this.__nodeToScope = new WeakMap();
this.__currentScope = null;
this.__options = options;
this.__declaredVariables = new WeakMap();
}
_createClass(ScopeManager, [{
key: '__useDirective',
value: function __useDirective() {
return this.__options.directive;
}
}, {
key: '__isOptimistic',
value: function __isOptimistic() {
return this.__options.optimistic;
}
}, {
key: '__ignoreEval',
value: function __ignoreEval() {
return this.__options.ignoreEval;
}
}, {
key: '__isNodejsScope',
value: function __isNodejsScope() {
return this.__options.nodejsScope;
}
}, {
key: 'isModule',
value: function isModule() {
return this.__options.sourceType === 'module';
}
}, {
key: 'isImpliedStrict',
value: function isImpliedStrict() {
return this.__options.impliedStrict;
}
}, {
key: 'isStrictModeSupported',
value: function isStrictModeSupported() {
return this.__options.ecmaVersion >= 5;
}
// Returns appropriate scope for this node.
}, {
key: '__get',
value: function __get(node) {
return this.__nodeToScope.get(node);
}
/**
* Get variables that are declared by the node.
*
* "are declared by the node" means the node is same as `Variable.defs[].node` or `Variable.defs[].parent`.
* If the node declares nothing, this method returns an empty array.
* CAUTION: This API is experimental. See https://github.com/estools/escope/pull/69 for more details.
*
* @param {Esprima.Node} node - a node to get.
* @returns {Variable[]} variables that declared by the node.
*/
}, {
key: 'getDeclaredVariables',
value: function getDeclaredVariables(node) {
return this.__declaredVariables.get(node) || [];
}
/**
* acquire scope from node.
* @method ScopeManager#acquire
* @param {Esprima.Node} node - node for the acquired scope.
* @param {boolean=} inner - look up the most inner scope, default value is false.
* @return {Scope?}
*/
}, {
key: 'acquire',
value: function acquire(node, inner) {
var scopes, scope, i, iz;
function predicate(scope) {
if (scope.type === 'function' && scope.functionExpressionScope) {
return false;
}
if (scope.type === 'TDZ') {
return false;
}
return true;
}
scopes = this.__get(node);
if (!scopes || scopes.length === 0) {
return null;
}
// Heuristic selection from all scopes.
// If you would like to get all scopes, please use ScopeManager#acquireAll.
if (scopes.length === 1) {
return scopes[0];
}
if (inner) {
for (i = scopes.length - 1; i >= 0; --i) {
scope = scopes[i];
if (predicate(scope)) {
return scope;
}
}
} else {
for (i = 0, iz = scopes.length; i < iz; ++i) {
scope = scopes[i];
if (predicate(scope)) {
return scope;
}
}
}
return null;
}
/**
* acquire all scopes from node.
* @method ScopeManager#acquireAll
* @param {Esprima.Node} node - node for the acquired scope.
* @return {Scope[]?}
*/
}, {
key: 'acquireAll',
value: function acquireAll(node) {
return this.__get(node);
}
/**
* release the node.
* @method ScopeManager#release
* @param {Esprima.Node} node - releasing node.
* @param {boolean=} inner - look up the most inner scope, default value is false.
* @return {Scope?} upper scope for the node.
*/
}, {
key: 'release',
value: function release(node, inner) {
var scopes, scope;
scopes = this.__get(node);
if (scopes && scopes.length) {
scope = scopes[0].upper;
if (!scope) {
return null;
}
return this.acquire(scope.block, inner);
}
return null;
}
}, {
key: 'attach',
value: function attach() {}
}, {
key: 'detach',
value: function detach() {}
}, {
key: '__nestScope',
value: function __nestScope(scope) {
if (scope instanceof _scope.GlobalScope) {
(0, _assert2.default)(this.__currentScope === null);
this.globalScope = scope;
}
this.__currentScope = scope;
return scope;
}
}, {
key: '__nestGlobalScope',
value: function __nestGlobalScope(node) {
return this.__nestScope(new _scope.GlobalScope(this, node));
}
}, {
key: '__nestBlockScope',
value: function __nestBlockScope(node, isMethodDefinition) {
return this.__nestScope(new _scope.BlockScope(this, this.__currentScope, node));
}
}, {
key: '__nestFunctionScope',
value: function __nestFunctionScope(node, isMethodDefinition) {
return this.__nestScope(new _scope.FunctionScope(this, this.__currentScope, node, isMethodDefinition));
}
}, {
key: '__nestForScope',
value: function __nestForScope(node) {
return this.__nestScope(new _scope.ForScope(this, this.__currentScope, node));
}
}, {
key: '__nestCatchScope',
value: function __nestCatchScope(node) {
return this.__nestScope(new _scope.CatchScope(this, this.__currentScope, node));
}
}, {
key: '__nestWithScope',
value: function __nestWithScope(node) {
return this.__nestScope(new _scope.WithScope(this, this.__currentScope, node));
}
}, {
key: '__nestClassScope',
value: function __nestClassScope(node) {
return this.__nestScope(new _scope.ClassScope(this, this.__currentScope, node));
}
}, {
key: '__nestSwitchScope',
value: function __nestSwitchScope(node) {
return this.__nestScope(new _scope.SwitchScope(this, this.__currentScope, node));
}
}, {
key: '__nestModuleScope',
value: function __nestModuleScope(node) {
return this.__nestScope(new _scope.ModuleScope(this, this.__currentScope, node));
}
}, {
key: '__nestTDZScope',
value: function __nestTDZScope(node) {
return this.__nestScope(new _scope.TDZScope(this, this.__currentScope, node));
}
}, {
key: '__nestFunctionExpressionNameScope',
value: function __nestFunctionExpressionNameScope(node) {
return this.__nestScope(new _scope.FunctionExpressionNameScope(this, this.__currentScope, node));
}
}, {
key: '__isES6',
value: function __isES6() {
return this.__options.ecmaVersion >= 6;
}
}]);
return ScopeManager;
}();
/* vim: set sw=4 ts=4 et tw=80 : */
exports["default"] = ScopeManager;
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNjb3BlLW1hbmFnZXIuanMiXSwibmFtZXMiOlsiU2NvcGVNYW5hZ2VyIiwib3B0aW9ucyIsInNjb3BlcyIsImdsb2JhbFNjb3BlIiwiX19ub2RlVG9TY29wZSIsIldlYWtNYXAiLCJfX2N1cnJlbnRTY29wZSIsIl9fb3B0aW9ucyIsIl9fZGVjbGFyZWRWYXJpYWJsZXMiLCJkaXJlY3RpdmUiLCJvcHRpbWlzdGljIiwiaWdub3JlRXZhbCIsIm5vZGVqc1Njb3BlIiwic291cmNlVHlwZSIsImltcGxpZWRTdHJpY3QiLCJlY21hVmVyc2lvbiIsIm5vZGUiLCJnZXQiLCJpbm5lciIsInNjb3BlIiwiaSIsIml6IiwicHJlZGljYXRlIiwidHlwZSIsImZ1bmN0aW9uRXhwcmVzc2lvblNjb3BlIiwiX19nZXQiLCJsZW5ndGgiLCJ1cHBlciIsImFjcXVpcmUiLCJibG9jayIsIkdsb2JhbFNjb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uXG4gICAgICovXG4gICAgZ2V0RGVjbGFyZWRWYXJpYWJsZXMobm9kZSkge1xuICAgICAgICByZXR1cm4gdGhpcy5fX2RlY2xhcmVkVmFyaWFibGVzLmdldChub2RlKSB8fCBbXTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBhY3F1aXJlIHNjb3BlIGZyb20gbm9kZS5cbiAgICAgKiBAbWV0aG9kIFNjb3BlTWFuYWdlciNhY3F1aXJlXG4gICAgICogQHBhcmFtIHtFc3ByaW1hLk5vZGV9IG5vZGUgLSBub2RlIGZvciB0aGUgYWNxdWlyZWQgc2NvcGUuXG4gICAgICogQHBhcmFtIHtib29sZWFuPX0gaW5uZXIgLSBsb29rIHVwIHRoZSBtb3N0IGlubmVyIHNjb3BlLCBkZWZhdWx0IHZhbHVlIGlzIGZhbHNlLlxuICAgICAqIEByZXR1cm4ge1Njb3BlP31cbiAgICAgKi9cbiAgICBhY3F1aXJlKG5vZGUsIGlubmVyKSB7XG4gICAgICAgIHZhciBzY29wZXMsIHNjb3BlLCBpLCBpejtcblxuICAgICAgICBmdW5jdGlvbiBwcmVkaWNhdGUoc2NvcGUpIHtcbiAgICAgICAgICAgIGlmIChzY29wZS50eXBlID09PSAnZnVuY3Rpb24nICYmIHNjb3BlLmZ1bmN0aW9uRXhwcmVzc2lvblNjb3BlKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKHNjb3BlLnR5cGUgPT09ICdURFonKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgIH1cblxuICAgICAgICBzY29wZXMgPSB0aGlzLl9fZ2V0KG5vZGUpO1xuICAgICAgICBpZiAoIXNjb3BlcyB8fCBzY29wZXMubGVuZ3RoID09PSAwKSB7XG4gICAgICAgICAgICByZXR1cm4gbnVsbDtcbiAgICAgICAgfVxuXG4gICAgICAgIC8vIEhldXJpc3RpYyBzZWxlY3Rpb24gZnJvbSBhbGwgc2NvcGVzLlxuICAgICAgICAvLyBJZiB5b3Ugd291bGQgbGlrZSB0byBnZXQgYWxsIHNjb3BlcywgcGxlYXNlIHVzZSBTY29wZU1hbmFnZXIjYWNxdWlyZUFsbC5cbiAgICAgICAgaWYgKHNjb3Blcy5sZW5ndGggPT09IDEpIHtcbiAgICAgICAgICAgIHJldHVybiBzY29wZXNbMF07XG4gICAgICAgIH1cblxuICAgICAgICBpZiAoaW5uZXIpIHtcbiAgICAgICAgICAgIGZvciAoaSA9IHNjb3Blcy5sZW5ndGggLSAxOyBpID49IDA7IC0taSkge1xuICAgICAgICAgICAgICAgIHNjb3BlID0gc2NvcGVzW2ldO1xuICAgICAgICAgICAgICAgIGlmIChwcmVkaWNhdGUoc2NvcGUpKSB7XG4gICAgICAgICAgICAgICAgICAgIHJldHVybiBzY29wZTtcbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICB9XG4gICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBmb3IgKGkgPSAwLCBpeiA9IHNjb3Blcy5sZW5ndGg7IGkgPCBpejsgKytpKSB7XG4gICAgICAgICAgICAgICAgc2NvcGUgPSBzY29wZXNbaV07XG4gICAgICAgICAgICAgICAgaWYgKHByZWRpY2F0ZShzY29wZSkpIHtcbiAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHNjb3BlO1xuICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgfVxuXG4gICAgICAgIHJldHVybiBudWxsO1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIGFjcXVpcmUgYWxsIHNjb3BlcyBmcm9tIG5vZGUuXG4gICAgICogQG1ldGhvZCBTY29wZU1hbmFnZXIjYWNxdWlyZUFsbFxuICAgICAqIEBwYXJhbSB7RXNwcmltYS5Ob2RlfSBub2RlIC0gbm9kZSBmb3IgdGhlIGFjcXVpcmVkIHNjb3BlLlxuICAgICAqIEByZXR1cm4ge1Njb3BlW10/fVxuICAgICAqL1xuICAgIGFjcXVpcmVBbGwobm9kZSkge1xuICAgICAgICByZXR1cm4gdGhpcy5fX2dldChub2RlKTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiByZWxlYXNlIHRoZSBub2RlLlxuICAgICAqIEBtZXRob2QgU2NvcGVNYW5hZ2VyI3JlbGVhc2VcbiAgICAgKiBAcGFyYW0ge0VzcHJpbWEuTm9kZX0gbm9kZSAtIHJlbGVhc2luZyBub2RlLlxuICAgICAqIEBwYXJhbSB7Ym9vbGVhbj19IGlubmVyIC0gbG9vayB1cCB0aGUgbW9zdCBpbm5lciBzY29wZSwgZGVmYXVsdCB2YWx1ZSBpcyBmYWxzZS5cbiAgICAgKiBAcmV0dXJuIHtTY29wZT99IHVwcGVyIHNjb3BlIGZvciB0aGUgbm9kZS5cbiAgICAgKi9cbiAgICByZWxlYXNlKG5vZGUsIGlubmVyKSB7XG4gICAgICAgIHZhciBzY29wZXMsIHNjb3BlO1xuICAgICAgICBzY29wZXMgPSB0aGlzLl9fZ2V0KG5vZGUpO1xuICAgICAgICBpZiAoc2NvcGVzICYmIHNjb3Blcy5sZW5ndGgpIHtcbiAgICAgICAgICAgIHNjb3BlID0gc2NvcGVzWzBdLnVwcGVyO1xuICAgICAgICAgICAgaWYgKCFzY29wZSkge1xuICAgICAgICAgICAgICAgIHJldHVybiBudWxsO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmV0dXJuIHRoaXMuYWNxdWlyZShzY29wZS5ibG9jaywgaW5uZXIpO1xuICAgICAgICB9XG4gICAgICAgIHJldHVybiBudWxsO1xuICAgIH1cblxuICAgIGF0dGFjaCgpIHsgfVxuXG4gICAgZGV0YWNoKCkgeyB9XG5cbiAgICBfX25lc3RTY29wZShzY29wZSkge1xuICAgICAgICBpZiAoc2NvcGUgaW5zdGFuY2VvZiBHbG9iYWxTY29wZSkge1xuICAgICAgICAgICAgYXNzZ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M9NCBldCB0dz04MCA6ICovXG4iXX0=
/***/ }),
/***/ "./node_modules/escope/lib/scope.js":
/*!******************************************!*\
!*** ./node_modules/escope/lib/scope.js ***!
\******************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.ClassScope = exports.ForScope = exports.FunctionScope = exports.SwitchScope = exports.BlockScope = exports.TDZScope = exports.WithScope = exports.CatchScope = exports.FunctionExpressionNameScope = exports.ModuleScope = exports.GlobalScope = undefined;
var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /*
Copyright (C) 2015 Yusuke Suzuki <[email protected]>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
var _estraverse = __webpack_require__(/*! estraverse */ "./node_modules/escope/node_modules/estraverse/estraverse.js");
var _reference = __webpack_require__(/*! ./reference */ "./node_modules/escope/lib/reference.js");
var _reference2 = _interopRequireDefault(_reference);
var _variable = __webpack_require__(/*! ./variable */ "./node_modules/escope/lib/variable.js");
var _variable2 = _interopRequireDefault(_variable);
var _definition = __webpack_require__(/*! ./definition */ "./node_modules/escope/lib/definition.js");
var _definition2 = _interopRequireDefault(_definition);
var _assert = __webpack_require__(/*! assert */ "./node_modules/assert/build/assert.js");
var _assert2 = _interopRequireDefault(_assert);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function isStrictScope(scope, block, isMethodDefinition, useDirective) {
var body, i, iz, stmt, expr;
// When upper scope is exists and strict, inner scope is also strict.
if (scope.upper && scope.upper.isStrict) {
return true;
}
// ArrowFunctionExpression's scope is always strict scope.
if (block.type === _estraverse.Syntax.ArrowFunctionExpression) {
return true;
}
if (isMethodDefinition) {
return true;
}
if (scope.type === 'class' || scope.type === 'module') {
return true;
}
if (scope.type === 'block' || scope.type === 'switch') {
return false;
}
if (scope.type === 'function') {
if (block.type === _estraverse.Syntax.Program) {
body = block;
} else {
body = block.body;
}
} else if (scope.type === 'global') {
body = block;
} else {
return false;
}
// Search 'use strict' directive.
if (useDirective) {
for (i = 0, iz = body.body.length; i < iz; ++i) {
stmt = body.body[i];
if (stmt.type !== _estraverse.Syntax.DirectiveStatement) {
break;
}
if (stmt.raw === '"use strict"' || stmt.raw === '\'use strict\'') {
return true;
}
}
} else {
for (i = 0, iz = body.body.length; i < iz; ++i) {
stmt = body.body[i];
if (stmt.type !== _estraverse.Syntax.ExpressionStatement) {
break;
}
expr = stmt.expression;
if (expr.type !== _estraverse.Syntax.Literal || typeof expr.value !== 'string') {
break;
}
if (expr.raw != null) {
if (expr.raw === '"use strict"' || expr.raw === '\'use strict\'') {
return true;
}
} else {
if (expr.value === 'use strict') {
return true;
}
}
}
}
return false;
}
function registerScope(scopeManager, scope) {
var scopes;
scopeManager.scopes.push(scope);
scopes = scopeManager.__nodeToScope.get(scope.block);
if (scopes) {
scopes.push(scope);
} else {
scopeManager.__nodeToScope.set(scope.block, [scope]);
}
}
function shouldBeStatically(def) {
return def.type === _variable2.default.ClassName || def.type === _variable2.default.Variable && def.parent.kind !== 'var';
}
/**
* @class Scope
*/
var Scope = function () {
function Scope(scopeManager, type, upperScope, block, isMethodDefinition) {
_classCallCheck(this, Scope);
/**
* One of 'TDZ', 'module', 'block', 'switch', 'function', 'catch', 'with', 'function', 'class', 'global'.
* @member {String} Scope#type
*/
this.type = type;
/**
* The scoped {@link Variable}s of this scope, as <code>{ Variable.name
* : Variable }</code>.
* @member {Map} Scope#set
*/
this.set = new Map();
/**
* The tainted variables of this scope, as <code>{ Variable.name :
* boolean }</code>.
* @member {Map} Scope#taints */
this.taints = new Map();
/**
* Generally, through the lexical scoping of JS you can always know
* which variable an identifier in the source code refers to. There are
* a few exceptions to this rule. With 'global' and 'with' scopes you
* can only decide at runtime which variable a reference refers to.
* Moreover, if 'eval()' is used in a scope, it might introduce new
* bindings in this or its parent scopes.
* All those scopes are considered 'dynamic'.
* @member {boolean} Scope#dynamic
*/
this.dynamic = this.type === 'global' || this.type === 'with';
/**
* A reference to the scope-defining syntax node.
* @member {esprima.Node} Scope#block
*/
this.block = block;
/**
* The {@link Reference|references} that are not resolved with this scope.
* @member {Reference[]} Scope#through
*/
this.through = [];
/**
* The scoped {@link Variable}s of this scope. In the case of a
* 'function' scope this includes the automatic argument <em>arguments</em> as
* its first element, as well as all further formal arguments.
* @member {Variable[]} Scope#variables
*/
this.variables = [];
/**
* Any variable {@link Reference|reference} found in this scope. This
* includes occurrences of local variables as well as variables from
* parent scopes (including the global scope). For local variables
* this also includes defining occurrences (like in a 'var' statement).
* In a 'function' scope this does not include the occurrences of the
* formal parameter in the parameter list.
* @member {Reference[]} Scope#references
*/
this.references = [];
/**
* For 'global' and 'function' scopes, this is a self-reference. For
* other scope types this is the <em>variableScope</em> value of the
* parent scope.
* @member {Scope} Scope#variableScope
*/
this.variableScope = this.type === 'global' || this.type === 'function' || this.type === 'module' ? this : upperScope.variableScope;
/**
* Whether this scope is created by a FunctionExpression.
* @member {boolean} Scope#functionExpressionScope
*/
this.functionExpressionScope = false;
/**
* Whether this is a scope that contains an 'eval()' invocation.
* @member {boolean} Scope#directCallToEvalScope
*/
this.directCallToEvalScope = false;
/**
* @member {boolean} Scope#thisFound
*/
this.thisFound = false;
this.__left = [];
/**
* Reference to the parent {@link Scope|scope}.
* @member {Scope} Scope#upper
*/
this.upper = upperScope;
/**
* Whether 'use strict' is in effect in this scope.
* @member {boolean} Scope#isStrict
*/
this.isStrict = isStrictScope(this, block, isMethodDefinition, scopeManager.__useDirective());
/**
* List of nested {@link Scope}s.
* @member {Scope[]} Scope#childScopes
*/
this.childScopes = [];
if (this.upper) {
this.upper.childScopes.push(this);
}
this.__declaredVariables = scopeManager.__declaredVariables;
registerScope(scopeManager, this);
}
_createClass(Scope, [{
key: '__shouldStaticallyClose',
value: function __shouldStaticallyClose(scopeManager) {
return !this.dynamic || scopeManager.__isOptimistic();
}
}, {
key: '__shouldStaticallyCloseForGlobal',
value: function __shouldStaticallyCloseForGlobal(ref) {
// On global scope, let/const/class declarations should be resolved statically.
var name = ref.identifier.name;
if (!this.set.has(name)) {
return false;
}
var variable = this.set.get(name);
var defs = variable.defs;
return defs.length > 0 && defs.every(shouldBeStatically);
}
}, {
key: '__staticCloseRef',
value: function __staticCloseRef(ref) {
if (!this.__resolve(ref)) {
this.__delegateToUpperScope(ref);
}
}
}, {
key: '__dynamicCloseRef',
value: function __dynamicCloseRef(ref) {
// notify all names are through to global
var current = this;
do {
current.through.push(ref);
current = current.upper;
} while (current);
}
}, {
key: '__globalCloseRef',
value: function __globalCloseRef(ref) {
// let/const/class declarations should be resolved statically.
// others should be resolved dynamically.
if (this.__shouldStaticallyCloseForGlobal(ref)) {
this.__staticCloseRef(ref);
} else {
this.__dynamicCloseRef(ref);
}
}
}, {
key: '__close',
value: function __close(scopeManager) {
var closeRef;
if (this.__shouldStaticallyClose(scopeManager)) {
closeRef = this.__staticCloseRef;
} else if (this.type !== 'global') {
closeRef = this.__dynamicCloseRef;
} else {
closeRef = this.__globalCloseRef;
}
// Try Resolving all references in this scope.
for (var i = 0, iz = this.__left.length; i < iz; ++i) {
var ref = this.__left[i];
closeRef.call(this, ref);
}
this.__left = null;
return this.upper;
}
}, {
key: '__resolve',
value: function __resolve(ref) {
var variable, name;
name = ref.identifier.name;
if (this.set.has(name)) {
variable = this.set.get(name);
variable.references.push(ref);
variable.stack = variable.stack && ref.from.variableScope === this.variableScope;
if (ref.tainted) {
variable.tainted = true;
this.taints.set(variable.name, true);
}
ref.resolved = variable;
return true;
}
return false;
}
}, {
key: '__delegateToUpperScope',
value: function __delegateToUpperScope(ref) {
if (this.upper) {
this.upper.__left.push(ref);
}
this.through.push(ref);
}
}, {
key: '__addDeclaredVariablesOfNode',
value: function __addDeclaredVariablesOfNode(variable, node) {
if (node == null) {
return;
}
var variables = this.__declaredVariables.get(node);
if (variables == null) {
variables = [];
this.__declaredVariables.set(node, variables);
}
if (variables.indexOf(variable) === -1) {
variables.push(variable);
}
}
}, {
key: '__defineGeneric',
value: function __defineGeneric(name, set, variables, node, def) {
var variable;
variable = set.get(name);
if (!variable) {
variable = new _variable2.default(name, this);
set.set(name, variable);
variables.push(variable);
}
if (def) {
variable.defs.push(def);
if (def.type !== _variable2.default.TDZ) {
this.__addDeclaredVariablesOfNode(variable, def.node);
this.__addDeclaredVariablesOfNode(variable, def.parent);
}
}
if (node) {
variable.identifiers.push(node);
}
}
}, {
key: '__define',
value: function __define(node, def) {
if (node && node.type === _estraverse.Syntax.Identifier) {
this.__defineGeneric(node.name, this.set, this.variables, node, def);
}
}
}, {
key: '__referencing',
value: function __referencing(node, assign, writeExpr, maybeImplicitGlobal, partial, init) {
// because Array element may be null
if (!node || node.type !== _estraverse.Syntax.Identifier) {
return;
}
// Specially handle like `this`.
if (node.name === 'super') {
return;
}
var ref = new _reference2.default(node, this, assign || _reference2.default.READ, writeExpr, maybeImplicitGlobal, !!partial, !!init);
this.references.push(ref);
this.__left.push(ref);
}
}, {
key: '__detectEval',
value: function __detectEval() {
var current;
current = this;
this.directCallToEvalScope = true;
do {
current.dynamic = true;
current = current.upper;
} while (current);
}
}, {
key: '__detectThis',
value: function __detectThis() {
this.thisFound = true;
}
}, {
key: '__isClosed',
value: function __isClosed() {
return this.__left === null;
}
/**
* returns resolved {Reference}
* @method Scope#resolve
* @param {Esprima.Identifier} ident - identifier to be resolved.
* @return {Reference}
*/
}, {
key: 'resolve',
value: function resolve(ident) {
var ref, i, iz;
(0, _assert2.default)(this.__isClosed(), 'Scope should be closed.');
(0, _assert2.default)(ident.type === _estraverse.Syntax.Identifier, 'Target should be identifier.');
for (i = 0, iz = this.references.length; i < iz; ++i) {
ref = this.references[i];
if (ref.identifier === ident) {
return ref;
}
}
return null;
}
/**
* returns this scope is static
* @method Scope#isStatic
* @return {boolean}
*/
}, {
key: 'isStatic',
value: function isStatic() {
return !this.dynamic;
}
/**
* returns this scope has materialized arguments
* @method Scope#isArgumentsMaterialized
* @return {boolean}
*/
}, {
key: 'isArgumentsMaterialized',
value: function isArgumentsMaterialized() {
return true;
}
/**
* returns this scope has materialized `this` reference
* @method Scope#isThisMaterialized
* @return {boolean}
*/
}, {
key: 'isThisMaterialized',
value: function isThisMaterialized() {
return true;
}
}, {
key: 'isUsedName',
value: function isUsedName(name) {
if (this.set.has(name)) {
return true;
}
for (var i = 0, iz = this.through.length; i < iz; ++i) {
if (this.through[i].identifier.name === name) {
return true;
}
}
return false;
}
}]);
return Scope;
}();
exports["default"] = Scope;
var GlobalScope = exports.GlobalScope = function (_Scope) {
_inherits(GlobalScope, _Scope);
function GlobalScope(scopeManager, block) {
_classCallCheck(this, GlobalScope);
var _this = _possibleConstructorReturn(this, (GlobalScope.__proto__ || Object.getPrototypeOf(GlobalScope)).call(this, scopeManager, 'global', null, block, false));
_this.implicit = {
set: new Map(),
variables: [],
/**
* List of {@link Reference}s that are left to be resolved (i.e. which
* need to be linked to the variable they refer to).
* @member {Reference[]} Scope#implicit#left
*/
left: []
};
return _this;
}
_createClass(GlobalScope, [{
key: '__close',
value: function __close(scopeManager) {
var implicit = [];
for (var i = 0, iz = this.__left.length; i < iz; ++i) {
var ref = this.__left[i];
if (ref.__maybeImplicitGlobal && !this.set.has(ref.identifier.name)) {
implicit.push(ref.__maybeImplicitGlobal);
}
}
// create an implicit global variable from assignment expression
for (var _i = 0, _iz = implicit.length; _i < _iz; ++_i) {
var info = implicit[_i];
this.__defineImplicit(info.pattern, new _definition2.default(_variable2.default.ImplicitGlobalVariable, info.pattern, info.node, null, null, null));
}
this.implicit.left = this.__left;
return _get(GlobalScope.prototype.__proto__ || Object.getPrototypeOf(GlobalScope.prototype), '__close', this).call(this, scopeManager);
}
}, {
key: '__defineImplicit',
value: function __defineImplicit(node, def) {
if (node && node.type === _estraverse.Syntax.Identifier) {
this.__defineGeneric(node.name, this.implicit.set, this.implicit.variables, node, def);
}
}
}]);
return GlobalScope;
}(Scope);
var ModuleScope = exports.ModuleScope = function (_Scope2) {
_inherits(ModuleScope, _Scope2);
function ModuleScope(scopeManager, upperScope, block) {
_classCallCheck(this, ModuleScope);
return _possibleConstructorReturn(this, (ModuleScope.__proto__ || Object.getPrototypeOf(ModuleScope)).call(this, scopeManager, 'module', upperScope, block, false));
}
return ModuleScope;
}(Scope);
var FunctionExpressionNameScope = exports.FunctionExpressionNameScope = function (_Scope3) {
_inherits(FunctionExpressionNameScope, _Scope3);
function FunctionExpressionNameScope(scopeManager, upperScope, block) {
_classCallCheck(this, FunctionExpressionNameScope);
var _this3 = _possibleConstructorReturn(this, (FunctionExpressionNameScope.__proto__ || Object.getPrototypeOf(FunctionExpressionNameScope)).call(this, scopeManager, 'function-expression-name', upperScope, block, false));
_this3.__define(block.id, new _definition2.default(_variable2.default.FunctionName, block.id, block, null, null, null));
_this3.functionExpressionScope = true;
return _this3;
}
return FunctionExpressionNameScope;
}(Scope);
var CatchScope = exports.CatchScope = function (_Scope4) {
_inherits(CatchScope, _Scope4);
function CatchScope(scopeManager, upperScope, block) {
_classCallCheck(this, CatchScope);
return _possibleConstructorReturn(this, (CatchScope.__proto__ || Object.getPrototypeOf(CatchScope)).call(this, scopeManager, 'catch', upperScope, block, false));
}
return CatchScope;
}(Scope);
var WithScope = exports.WithScope = function (_Scope5) {
_inherits(WithScope, _Scope5);
function WithScope(scopeManager, upperScope, block) {
_classCallCheck(this, WithScope);
return _possibleConstructorReturn(this, (WithScope.__proto__ || Object.getPrototypeOf(WithScope)).call(this, scopeManager, 'with', upperScope, block, false));
}
_createClass(WithScope, [{
key: '__close',
value: function __close(scopeManager) {
if (this.__shouldStaticallyClose(scopeManager)) {
return _get(WithScope.prototype.__proto__ || Object.getPrototypeOf(WithScope.prototype), '__close', this).call(this, scopeManager);
}
for (var i = 0, iz = this.__left.length; i < iz; ++i) {
var ref = this.__left[i];
ref.tainted = true;
this.__delegateToUpperScope(ref);
}
this.__left = null;
return this.upper;
}
}]);
return WithScope;
}(Scope);
var TDZScope = exports.TDZScope = function (_Scope6) {
_inherits(TDZScope, _Scope6);
function TDZScope(scopeManager, upperScope, block) {
_classCallCheck(this, TDZScope);
return _possibleConstructorReturn(this, (TDZScope.__proto__ || Object.getPrototypeOf(TDZScope)).call(this, scopeManager, 'TDZ', upperScope, block, false));
}
return TDZScope;
}(Scope);
var BlockScope = exports.BlockScope = function (_Scope7) {
_inherits(BlockScope, _Scope7);
function BlockScope(scopeManager, upperScope, block) {
_classCallCheck(this, BlockScope);
return _possibleConstructorReturn(this, (BlockScope.__proto__ || Object.getPrototypeOf(BlockScope)).call(this, scopeManager, 'block', upperScope, block, false));
}
return BlockScope;
}(Scope);
var SwitchScope = exports.SwitchScope = function (_Scope8) {
_inherits(SwitchScope, _Scope8);
function SwitchScope(scopeManager, upperScope, block) {
_classCallCheck(this, SwitchScope);
return _possibleConstructorReturn(this, (SwitchScope.__proto__ || Object.getPrototypeOf(SwitchScope)).call(this, scopeManager, 'switch', upperScope, block, false));
}
return SwitchScope;
}(Scope);
var FunctionScope = exports.FunctionScope = function (_Scope9) {
_inherits(FunctionScope, _Scope9);
function FunctionScope(scopeManager, upperScope, block, isMethodDefinition) {
_classCallCheck(this, FunctionScope);
// section 9.2.13, FunctionDeclarationInstantiation.
// NOTE Arrow functions never have an arguments objects.
var _this9 = _possibleConstructorReturn(this, (FunctionScope.__proto__ || Object.getPrototypeOf(FunctionScope)).call(this, scopeManager, 'function', upperScope, block, isMethodDefinition));
if (_this9.block.type !== _estraverse.Syntax.ArrowFunctionExpression) {
_this9.__defineArguments();
}
return _this9;
}
_createClass(FunctionScope, [{
key: 'isArgumentsMaterialized',
value: function isArgumentsMaterialized() {
// TODO(Constellation)
// We can more aggressive on this condition like this.
//
// function t() {
// // arguments of t is always hidden.
// function arguments() {
// }
// }
if (this.block.type === _estraverse.Syntax.ArrowFunctionExpression) {
return false;
}
if (!this.isStatic()) {
return true;
}
var variable = this.set.get('arguments');
(0, _assert2.default)(variable, 'Always have arguments variable.');
return variable.tainted || variable.references.length !== 0;
}
}, {
key: 'isThisMaterialized',
value: function isThisMaterialized() {
if (!this.isStatic()) {
return true;
}
return this.thisFound;
}
}, {
key: '__defineArguments',
value: function __defineArguments() {
this.__defineGeneric('arguments', this.set, this.variables, null, null);
this.taints.set('arguments', true);
}
}]);
return FunctionScope;
}(Scope);
var ForScope = exports.ForScope = function (_Scope10) {
_inherits(ForScope, _Scope10);
function ForScope(scopeManager, upperScope, block) {
_classCallCheck(this, ForScope);
return _possibleConstructorReturn(this, (ForScope.__proto__ || Object.getPrototypeOf(ForScope)).call(this, scopeManager, 'for', upperScope, block, false));
}
return ForScope;
}(Scope);
var ClassScope = exports.ClassScope = function (_Scope11) {
_inherits(ClassScope, _Scope11);
function ClassScope(scopeManager, upperScope, block) {
_classCallCheck(this, ClassScope);
return _possibleConstructorReturn(this, (ClassScope.__proto__ || Object.getPrototypeOf(ClassScope)).call(this, scopeManager, 'class', upperScope, block, false));
}
return ClassScope;
}(Scope);
/* vim: set sw=4 ts=4 et tw=80 : */
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInNjb3BlLmpzIl0sIm5hbWVzIjpbImlzU3RyaWN0U2NvcGUiLCJzY29wZSIsImJsb2NrIiwiaXNNZXRob2REZWZpbml0aW9uIiwidXNlRGlyZWN0aXZlIiwiYm9keSIsImkiLCJpeiIsInN0bXQiLCJleHByIiwidXBwZXIiLCJpc1N0cmljdCIsInR5cGUiLCJTeW50YXgiLCJBcnJvd0Z1bmN0aW9uRXhwcmVzc2lvbiIsIlByb2dy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GJvZHkgPSBibG9jaztcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGJvZHkgPSBibG9jay5ib2R5O1xuICAgICAgICB9XG4gICAgfSBlbHNlIGlmIChzY29wZS50eXBlID09PSAnZ2xvYmFsJykge1xuICAgICAgICBib2R5ID0gYmxvY2s7XG4gICAgfSBlbHNlIHtcbiAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgIH1cblxuICAgIC8vIFNlYXJjaCAndXNlIHN0cmljdCcgZGlyZWN0aXZlLlxuICAgIGlmICh1c2VEaXJlY3RpdmUpIHtcbiAgICAgICAgZm9yIChpID0gMCwgaXogPSBib2R5LmJvZHkubGVuZ3RoOyBpIDwgaXo7ICsraSkge1xuICAgICAgICAgICAgc3RtdCA9IGJvZHkuYm9keVtpXTtcbiAgICAgICAgICAgIGlmIChzdG10LnR5cGUgIT09IFN5bnRheC5EaXJlY3RpdmVTdGF0ZW1lbnQpIHtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGlmIChzdG10LnJhdyA9PT0gJ1widXNlIHN0cmljdFwiJyB8fCBzdG10LnJhdyA9PT0gJ1xcJ3VzZSBzdHJpY3RcXCcnKSB7XG4gICAgICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICB9IGVsc2Uge1xuICAgICAgICBmb3IgKGkgPSAwLCBpeiA9IGJvZHkuYm9keS5sZW5ndGg7IGkgPCBpejsgKytpKSB7XG4gICAgICAgICAgICBzdG10ID0gYm9keS5ib2R5W2ldO1xuICAgICAgICAgICAgaWYgKHN0bXQudHlwZSAhPT0gU3ludGF4LkV4cHJlc3Npb25TdGF0ZW1lbnQpIHtcbiAgICAgICAgICAgICAgICBicmVhaztcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIGV4cHIgPSBzdG10LmV4cHJlc3Npb247XG4gICAgICAgICAgICBpZiAoZXhwci50eXBlICE9PSB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V0KG5hbWUpO1xuICAgICAgICBpZiAoIXZhcmlhYmxlKSB7XG4gICAgICAgICAgICB2YXJpYWJsZSA9IG5ldyBWYXJpYWJsZShuYW1lLCB0aGlzKTtcbiAgICAgICAgICAgIHNldC5zZXQobmFtZSwgdmFyaWFibGUpO1xuICAgICAgICAgICAgdmFyaWFibGVzLnB1c2godmFyaWFibGUpO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKGRlZikge1xuICAgICAgICAgICAgdmFyaWFibGUuZGVmcy5wdXNoKGRlZik7XG4gICAgICAgICAgICBpZiAoZGVmLnR5cGUgIT09IFZhcmlhYmxlLlREWikge1xuICAgICAgICAgICAgICAgIHRoaXMuX19hZGREZWNsYXJlZFZhcmlhYmxlc09mTm9kZSh2YXJpYWJsZSwgZGVmLm5vZGUpO1xuICAgICAgICAgICAgICAgIHRoaXMuX19hZGREZWNsYXJlZFZhcmlhYmxlc09mTm9kZSh2YXJpYWJsZSwgZGVmLnBhcmVudCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKG5vZGUpIHtcbiAgICAgICAgICAgIHZhcmlhYmxlLmlkZW50aWZpZXJzLnB1c2gobm9kZSk7XG4gICAgICAgIH1cbiAgICB9XG5cbiAgICBfX2RlZmluZShub2RlLCBkZWYpIHtcbiAgICAgICAgaWYgKG5vZGUgJiYgbm9kZS50eXBlID09PSBTeW50YXguSWRlbnRpZmllcikge1xuICAgICAgICAgICAgdGhpcy5fX2RlZmluZUdlbmVyaWMoXG4gICAgICAgICAgICAgICAgICAgIG5vZGUubmFtZSxcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5zZXQsXG4gICAgICAgICAgICAgICAgICAgIHRoaXMudmFyaWFibGVzLFxuICAgICAgICAgICAgICAgICAgICBub2RlLFxuICAgICAgICAgICAgICAgICAgICBkZWYpO1xuICAgICAgICB9XG4gICAgfVxuXG4gICAgX19yZWZlcmVuY2luZyhub2RlLCBhc3NpZ24sIHdyaXRlRXhwci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wbGljaXQgPSB7XG4gICAgICAgICAgICBzZXQ6IG5ldyBNYXAoKSxcbiAgICAgICAgICAgIHZhcmlhYmxlczogW10sXG4gICAgICAgICAgICAvKipcbiAgICAgICAgICAgICogTGlzdCBvZiB7QGxpbmsgUmVmZXJlbmNlfXMgdGhhdCBhcmUgbGVmdCB0byBiZSByZXNvbHZlZCAoaS5lLiB3aGljaFxuICAgICAgICAgICAgKiBuZWVkIHRvIGJlIGxpbmtlZCB0byB0aGUgdmFyaWFibGUgdGhleSByZWZlciB0bykuXG4gICAgICAgICAgICAqIEBtZW1iZXIge1JlZmVyZW5jZVtdfSBTY29wZSNpbXBsaWNpdCNsZWZ0XG4gICAgICAgICAgICAqL1xuICAgICAgICAgICAgbGVmdDogW11cbiAgICAgICAgfTtcbiAgICB9XG5cbiAgICBfX2Nsb3NlKHNjb3BlTWFuYWdlcikge1xuICAgICAgICBsZXQgaW1wbGljaXQgPSBbXTtcbiAgICAgICAgZm9yIChsZXQgaSA9IDAsIGl6ID0gdGhpcy5fX2xlZnQubGVuZ3RoOyBpIDwgaXo7ICsraSkge1xuICAgICAgICAgICAgbGV0IHJlZiA9IHRoaXMuX19sZWZ0W2ldO1xuICAgICAgICAgICAgaWYgKHJlZi5fX21heWJlSW1wbGljaXRHbG9iYWwgJiYgIXRoaXMuc2V0LmhhcyhyZWYuaWRlbnRpZmllci5uYW1lKSkge1xuICAgICAgICAgICAgICAgIGltcGxpY2l0LnB1c2gocmVmLl9fbWF5YmVJbXBsaWNpdEdsb2JhbCk7XG4gICAgICAgICAgICB9XG4gICAgICAgIH1cblxuICAgICAgICAvLyBjcmVhdGUgYW4gaW1wbGljaXQgZ2xvYmFsIHZhcmlhYmxlIGZyb20gYXNzaWdubWVudCBleHByZXNzaW9uXG4gICAgICAgIGZvciAobGV0IGkgPSAwLCBpeiA9IGltcGxpY2l0Lmxlbmd0aDsgaSA8IGl6OyArK2kpIHtcbiAgICAgICAgICAgIGxldCBpbmZvID0gaW1wbGljaXRbaV07XG4gICAgICAgICAgICB0aGlzLl9fZGVmaW5lSW1wbGljaXQoaW5mby5wYXR0ZXJuLFxuICAgICAgICAgICAgICAgICAgICBuZXcgRGVmaW5pdGlvbihcbiAgICAgICAgICAgICAgICAgICAgICAgIFZhcmlhYmxlLkltcGxpY2l0R2xvYmFsVmFyaWFibGUsXG4gICAgICAgICAgICAgICAgICAgICAgICBpbmZvLnBhdHRlcm4sXG4gICAgICAgICAgICAgICAgICAgICAgICBpbmZvLm5vZGUsXG4gICAgICAgICAgICAgICAgICAgICAgICBudWxsLFxuICAgICAgICAgICAgICAgICAgICAgICAgbnVsbCxcbiAgICAgICAgICAgICAgICAgICAgICAgIG51bGxcbiAgICAgICAgICAgICAgICAgICAgKSk7XG5cbiAgICAgICAgfVxuXG4gICAgICAgIHRoaXMuaW1wbGljaXQubGVmdCA9IHRoaXMuX19sZWZ0O1xuXG4gICAgICAgIHJldHVybiBzdXBlci5fX2Nsb3NlKHNjb3BlTWFuYWdlcik7XG4gICAgfVxuXG4gICAgX19kZWZpbmVJbXBsaWNpdChub2RlLCBkZWYpIHtcbiAgICAgICAgaWYgKG5vZGUgJiYgbm9kZS50eXBlID09PSBTeW50YXguSWRlbnRpZmllcikge1xuICAgICAgICAgICAgdGhpcy5fX2RlZmluZUdlbmVyaWMoXG4gICAgICAgICAgICAgICAgICAgIG5vZGUubmFtZSxcbiAgICAgICAgICAgICAgICAgICAgdGhpcy5pbXBsaWNpdC5zZXQsXG4gICAgICAgICAgICAgICAgICAgIHRoaXMuaW1wbGljaXQudmFyaWFibGVzLFxuICAgICAgICAgICAgICAgICAgICBub2RlLFxuICAgICAgICAgICAgICAgICAgICBkZWYpO1xuICAgICAgICB9XG4gICAgfVxufVxuXG5leHBvcnQgY2xhc3MgTW9kdWxlU2NvcGUgZXh0ZW5kcyBTY29wZSB7XG4gICAgY29uc3RydWN0b3Ioc2NvcGVNYW5hZ2VyLCB1cHBlclNjb3BlLCBibG9jaykge1xuICAgICAgICBzdXBl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AgICAgIC8vICAgICAvLyBhcmd1bWVudHMgb2YgdCBpcyBhbHdheXMgaGlkZGVuLlxuICAgICAgICAvLyAgICAgZnVuY3Rpb24gYXJndW1lbnRzKCkge1xuICAgICAgICAvLyAgICAgfVxuICAgICAgICAvLyB9XG4gICAgICAgIGlmICh0aGlzLmJsb2NrLnR5cGUgPT09IFN5bnRheC5BcnJvd0Z1bmN0aW9uRXhwcmVzc2lvbikge1xuICAgICAgICAgICAgcmV0dXJuIGZhbHNlO1xuICAgICAgICB9XG5cbiAgICAgICAgaWYgKCF0aGlzLmlzU3RhdGljKCkpIHtcbiAgICAgICAgICAgIHJldHVybiB0cnVlO1xuICAgICAgICB9XG5cbiAgICAgICAgbGV0IHZhcmlhYmxlID0gdGhpcy5zZXQuZ2V0KCdhcmd1bWVudHMnKTtcbiAgICAgICAgYXNzZXJ0KHZhcmlhYmxlLCAnQWx3YXlzIGhhdmUgYXJndW1lbnRzIHZhcmlhYmxlLicpO1xuICAgICAgICByZXR1cm4gdmFyaWFibGUudGFpbnRlZCB8fCB2YXJpYWJsZS5yZWZlcmVuY2VzLmxlbmd0aCAgIT09IDA7XG4gICAgfVxuXG4gICAgaXNUaGlzTWF0ZXJpYWxpemVkKCkge1xuICAgICAgICBpZiAoIXRoaXMuaXNTdGF0aWMoKSkge1xuICAgICAgICAgICAgcmV0dXJuIHRydWU7XG4gICAgICAgIH1cbiAgICAgICAgcmV0dXJuIHRoaXMudGhpc0ZvdW5kO1xuICAgIH1cblxuICAgIF9fZGVmaW5lQXJndW1lbnRzKCkge1xuICAgICAgICB0aGlzLl9fZGVmaW5lR2VuZXJpYyhcbiAgICAgICAgICAgICAgICAnYXJndW1lbnRzJyxcbiAgICAgICAgICAgICAgICB0aGlzLnNldCxcbiAgICAgICAgICAgICAgICB0aGlzLnZhcmlhYmxlcyxcbiAgICAgICAgICAgICAgICBudWxsLFxuICAgICAgICAgICAgICAgIG51bGwpO1xuICAgICAgICB0aGlzLnRhaW50cy5zZXQoJ2FyZ3VtZW50cycsIHRydWUpO1xuICAgIH1cbn1cblxuZXhwb3J0IGNsYXNzIEZvclNjb3BlIGV4dGVuZHMgU2NvcGUge1xuICAgIGNvbnN0cnVjdG9yKHNjb3BlTWFuYWdlciwgdXBwZXJTY29wZSwgYmxvY2spIHtcbiAgICAgICAgc3VwZXIoc2NvcGVNYW5hZ2VyLCAnZm9yJywgdXBwZXJTY29wZSwgYmxvY2ssIGZhbHNlKTtcbiAgICB9XG59XG5cbmV4cG9ydCBjbGFzcyBDbGFzc1Njb3BlIGV4dGVuZHMgU2NvcGUge1xuICAgIGNvbnN0cnVjdG9yKHNjb3BlTWFuYWdlciwgdXBwZXJTY29wZSwgYmxvY2spIHtcbiAgICAgICAgc3VwZXIoc2NvcGVNYW5hZ2VyLCAnY2xhc3MnLCB1cHBlclNjb3BlLCBibG9jaywgZmFsc2UpO1xuICAgIH1cbn1cblxuLyogdmltOiBzZXQgc3c9NCB0cz00IGV0IHR3PTgwIDogKi9cbiJdfQ==
/***/ }),
/***/ "./node_modules/escope/lib/variable.js":
/*!*********************************************!*\
!*** ./node_modules/escope/lib/variable.js ***!
\*********************************************/
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/*
Copyright (C) 2015 Yusuke Suzuki <[email protected]>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* A Variable represents a locally scoped identifier. These include arguments to
* functions.
* @class Variable
*/
var Variable = function Variable(name, scope) {
_classCallCheck(this, Variable);
/**
* The variable name, as given in the source code.
* @member {String} Variable#name
*/
this.name = name;
/**
* List of defining occurrences of this variable (like in 'var ...'
* statements or as parameter), as AST nodes.
* @member {esprima.Identifier[]} Variable#identifiers
*/
this.identifiers = [];
/**
* List of {@link Reference|references} of this variable (excluding parameter entries)
* in its defining scope and all nested scopes. For defining
* occurrences only see {@link Variable#defs}.
* @member {Reference[]} Variable#references
*/
this.references = [];
/**
* List of defining occurrences of this variable (like in 'var ...'
* statements or as parameter), as custom objects.
* @member {Definition[]} Variable#defs
*/
this.defs = [];
this.tainted = false;
/**
* Whether this is a stack variable.
* @member {boolean} Variable#stack
*/
this.stack = true;
/**
* Reference to the enclosing Scope.
* @member {Scope} Variable#scope
*/
this.scope = scope;
};
exports["default"] = Variable;
Variable.CatchClause = 'CatchClause';
Variable.Parameter = 'Parameter';
Variable.FunctionName = 'FunctionName';
Variable.ClassName = 'ClassName';
Variable.Variable = 'Variable';
Variable.ImportBinding = 'ImportBinding';
Variable.TDZ = 'TDZ';
Variable.ImplicitGlobalVariable = 'ImplicitGlobalVariable';
/* vim: set sw=4 ts=4 et tw=80 : */
//# s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pY2l0R2xvYmFsVmFyaWFibGUgPSAnSW1wbGljaXRHbG9iYWxWYXJpYWJsZSc7XG5cbi8qIHZpbTogc2V0IHN3PTQgdHM9NCBldCB0dz04MCA6ICovXG4iXX0=
/***/ }),
/***/ "./node_modules/escope/node_modules/estraverse/estraverse.js":
/*!*******************************************************************!*\
!*** ./node_modules/escope/node_modules/estraverse/estraverse.js ***!
\*******************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/*
Copyright (C) 2012-2013 Yusuke Suzuki <[email protected]>
Copyright (C) 2012 Ariya Hidayat <[email protected]>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*jslint vars:false, bitwise:true*/
/*jshint indent:4*/
/*global exports:true*/
(function clone(exports) {
'use strict';
var Syntax,
VisitorOption,
VisitorKeys,
BREAK,
SKIP,
REMOVE;
function deepCopy(obj) {
var ret = {}, key, val;
for (key in obj) {
if (obj.hasOwnProperty(key)) {
val = obj[key];
if (typeof val === 'object' && val !== null) {
ret[key] = deepCopy(val);
} else {
ret[key] = val;
}
}
}
return ret;
}
// based on LLVM libc++ upper_bound / lower_bound
// MIT License
function upperBound(array, func) {
var diff, len, i, current;
len = array.length;
i = 0;
while (len) {
diff = len >>> 1;
current = i + diff;
if (func(array[current])) {
len = diff;
} else {
i = current + 1;
len -= diff + 1;
}
}
return i;
}
Syntax = {
AssignmentExpression: 'AssignmentExpression',
AssignmentPattern: 'AssignmentPattern',
ArrayExpression: 'ArrayExpression',
ArrayPattern: 'ArrayPattern',
ArrowFunctionExpression: 'ArrowFunctionExpression',
AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7.
BlockStatement: 'BlockStatement',
BinaryExpression: 'BinaryExpression',
BreakStatement: 'BreakStatement',
CallExpression: 'CallExpression',
CatchClause: 'CatchClause',
ClassBody: 'ClassBody',
ClassDeclaration: 'ClassDeclaration',
ClassExpression: 'ClassExpression',
ComprehensionBlock: 'ComprehensionBlock', // CAUTION: It's deferred to ES7.
ComprehensionExpression: 'ComprehensionExpression', // CAUTION: It's deferred to ES7.
ConditionalExpression: 'ConditionalExpression',
ContinueStatement: 'ContinueStatement',
DebuggerStatement: 'DebuggerStatement',
DirectiveStatement: 'DirectiveStatement',
DoWhileStatement: 'DoWhileStatement',
EmptyStatement: 'EmptyStatement',
ExportAllDeclaration: 'ExportAllDeclaration',
ExportDefaultDeclaration: 'ExportDefaultDeclaration',
ExportNamedDeclaration: 'ExportNamedDeclaration',
ExportSpecifier: 'ExportSpecifier',
ExpressionStatement: 'ExpressionStatement',
ForStatement: 'ForStatement',
ForInStatement: 'ForInStatement',
ForOfStatement: 'ForOfStatement',
FunctionDeclaration: 'FunctionDeclaration',
FunctionExpression: 'FunctionExpression',
GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7.
Identifier: 'Identifier',
IfStatement: 'IfStatement',
ImportExpression: 'ImportExpression',
ImportDeclaration: 'ImportDeclaration',
ImportDefaultSpecifier: 'ImportDefaultSpecifier',
ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',
ImportSpecifier: 'ImportSpecifier',
Literal: 'Literal',
LabeledStatement: 'LabeledStatement',
LogicalExpression: 'LogicalExpression',
MemberExpression: 'MemberExpression',
MetaProperty: 'MetaProperty',
MethodDefinition: 'MethodDefinition',
ModuleSpecifier: 'ModuleSpecifier',
NewExpression: 'NewExpression',
ObjectExpression: 'ObjectExpression',
ObjectPattern: 'ObjectPattern',
Program: 'Program',
Property: 'Property',
RestElement: 'RestElement',
ReturnStatement: 'ReturnStatement',
SequenceExpression: 'SequenceExpression',
SpreadElement: 'SpreadElement',
Super: 'Super',
SwitchStatement: 'SwitchStatement',
SwitchCase: 'SwitchCase',
TaggedTemplateExpression: 'TaggedTemplateExpression',
TemplateElement: 'TemplateElement',
TemplateLiteral: 'TemplateLiteral',
ThisExpression: 'ThisExpression',
ThrowStatement: 'ThrowStatement',
TryStatement: 'TryStatement',
UnaryExpression: 'UnaryExpression',
UpdateExpression: 'UpdateExpression',
VariableDeclaration: 'VariableDeclaration',
VariableDeclarator: 'VariableDeclarator',
WhileStatement: 'WhileStatement',
WithStatement: 'WithStatement',
YieldExpression: 'YieldExpression'
};
VisitorKeys = {
AssignmentExpression: ['left', 'right'],
AssignmentPattern: ['left', 'right'],
ArrayExpression: ['elements'],
ArrayPattern: ['elements'],
ArrowFunctionExpression: ['params', 'body'],
AwaitExpression: ['argument'], // CAUTION: It's deferred to ES7.
BlockStatement: ['body'],
BinaryExpression: ['left', 'right'],
BreakStatement: ['label'],
CallExpression: ['callee', 'arguments'],
CatchClause: ['param', 'body'],
ClassBody: ['body'],
ClassDeclaration: ['id', 'superClass', 'body'],
ClassExpression: ['id', 'superClass', 'body'],
ComprehensionBlock: ['left', 'right'], // CAUTION: It's deferred to ES7.
ComprehensionExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7.
ConditionalExpression: ['test', 'consequent', 'alternate'],
ContinueStatement: ['label'],
DebuggerStatement: [],
DirectiveStatement: [],
DoWhileStatement: ['body', 'test'],
EmptyStatement: [],
ExportAllDeclaration: ['source'],
ExportDefaultDeclaration: ['declaration'],
ExportNamedDeclaration: ['declaration', 'specifiers', 'source'],
ExportSpecifier: ['exported', 'local'],
ExpressionStatement: ['expression'],
ForStatement: ['init', 'test', 'update', 'body'],
ForInStatement: ['left', 'right', 'body'],
ForOfStatement: ['left', 'right', 'body'],
FunctionDeclaration: ['id', 'params', 'body'],
FunctionExpression: ['id', 'params', 'body'],
GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7.
Identifier: [],
IfStatement: ['test', 'consequent', 'alternate'],
ImportExpression: ['source'],
ImportDeclaration: ['specifiers', 'source'],
ImportDefaultSpecifier: ['local'],
ImportNamespaceSpecifier: ['local'],
ImportSpecifier: ['imported', 'local'],
Literal: [],
LabeledStatement: ['label', 'body'],
LogicalExpression: ['left', 'right'],
MemberExpression: ['object', 'property'],
MetaProperty: ['meta', 'property'],
MethodDefinition: ['key', 'value'],
ModuleSpecifier: [],
NewExpression: ['callee', 'arguments'],
ObjectExpression: ['properties'],
ObjectPattern: ['properties'],
Program: ['body'],
Property: ['key', 'value'],
RestElement: [ 'argument' ],
ReturnStatement: ['argument'],
SequenceExpression: ['expressions'],
SpreadElement: ['argument'],
Super: [],
SwitchStatement: ['discriminant', 'cases'],
SwitchCase: ['test', 'consequent'],
TaggedTemplateExpression: ['tag', 'quasi'],
TemplateElement: [],
TemplateLiteral: ['quasis', 'expressions'],
ThisExpression: [],
ThrowStatement: ['argument'],
TryStatement: ['block', 'handler', 'finalizer'],
UnaryExpression: ['argument'],
UpdateExpression: ['argument'],
VariableDeclaration: ['declarations'],
VariableDeclarator: ['id', 'init'],
WhileStatement: ['test', 'body'],
WithStatement: ['object', 'body'],
YieldExpression: ['argument']
};
// unique id
BREAK = {};
SKIP = {};
REMOVE = {};
VisitorOption = {
Break: BREAK,
Skip: SKIP,
Remove: REMOVE
};
function Reference(parent, key) {
this.parent = parent;
this.key = key;
}
Reference.prototype.replace = function replace(node) {
this.parent[this.key] = node;
};
Reference.prototype.remove = function remove() {
if (Array.isArray(this.parent)) {
this.parent.splice(this.key, 1);
return true;
} else {
this.replace(null);
return false;
}
};
function Element(node, path, wrap, ref) {
this.node = node;
this.path = path;
this.wrap = wrap;
this.ref = ref;
}
function Controller() { }
// API:
// return property path array from root to current node
Controller.prototype.path = function path() {
var i, iz, j, jz, result, element;
function addToPath(result, path) {
if (Array.isArray(path)) {
for (j = 0, jz = path.length; j < jz; ++j) {
result.push(path[j]);
}
} else {
result.push(path);
}
}
// root node
if (!this.__current.path) {
return null;
}
// first node is sentinel, second node is root element
result = [];
for (i = 2, iz = this.__leavelist.length; i < iz; ++i) {
element = this.__leavelist[i];
addToPath(result, element.path);
}
addToPath(result, this.__current.path);
return result;
};
// API:
// return type of current node
Controller.prototype.type = function () {
var node = this.current();
return node.type || this.__current.wrap;
};
// API:
// return array of parent elements
Controller.prototype.parents = function parents() {
var i, iz, result;
// first node is sentinel
result = [];
for (i = 1, iz = this.__leavelist.length; i < iz; ++i) {
result.push(this.__leavelist[i].node);
}
return result;
};
// API:
// return current node
Controller.prototype.current = function current() {
return this.__current.node;
};
Controller.prototype.__execute = function __execute(callback, element) {
var previous, result;
result = undefined;
previous = this.__current;
this.__current = element;
this.__state = null;
if (callback) {
result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node);
}
this.__current = previous;
return result;
};
// API:
// notify control skip / break
Controller.prototype.notify = function notify(flag) {
this.__state = flag;
};
// API:
// skip child nodes of current node
Controller.prototype.skip = function () {
this.notify(SKIP);
};
// API:
// break traversals
Controller.prototype['break'] = function () {
this.notify(BREAK);
};
// API:
// remove node
Controller.prototype.remove = function () {
this.notify(REMOVE);
};
Controller.prototype.__initialize = function(root, visitor) {
this.visitor = visitor;
this.root = root;
this.__worklist = [];
this.__leavelist = [];
this.__current = null;
this.__state = null;
this.__fallback = null;
if (visitor.fallback === 'iteration') {
this.__fallback = Object.keys;
} else if (typeof visitor.fallback === 'function') {
this.__fallback = visitor.fallback;
}
this.__keys = VisitorKeys;
if (visitor.keys) {
this.__keys = Object.assign(Object.create(this.__keys), visitor.keys);
}
};
function isNode(node) {
if (node == null) {
return false;
}
return typeof node === 'object' && typeof node.type === 'string';
}
function isProperty(nodeType, key) {
return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key;
}
Controller.prototype.traverse = function traverse(root, visitor) {
var worklist,
leavelist,
element,
node,
nodeType,
ret,
key,
current,
current2,
candidates,
candidate,
sentinel;
this.__initialize(root, visitor);
sentinel = {};
// reference
worklist = this.__worklist;
leavelist = this.__leavelist;
// initialize
worklist.push(new Element(root, null, null, null));
leavelist.push(new Element(null, null, null, null));
while (worklist.length) {
element = worklist.pop();
if (element === sentinel) {
element = leavelist.pop();
ret = this.__execute(visitor.leave, element);
if (this.__state === BREAK || ret === BREAK) {
return;
}
continue;
}
if (element.node) {
ret = this.__execute(visitor.enter, element);
if (this.__state === BREAK || ret === BREAK) {
return;
}
worklist.push(sentinel);
leavelist.push(element);
if (this.__state === SKIP || ret === SKIP) {
continue;
}
node = element.node;
nodeType = node.type || element.wrap;
candidates = this.__keys[nodeType];
if (!candidates) {
if (this.__fallback) {
candidates = this.__fallback(node);
} else {
throw new Error('Unknown node type ' + nodeType + '.');
}
}
current = candidates.length;
while ((current -= 1) >= 0) {
key = candidates[current];
candidate = node[key];
if (!candidate) {
continue;
}
if (Array.isArray(candidate)) {
current2 = candidate.length;
while ((current2 -= 1) >= 0) {
if (!candidate[current2]) {
continue;
}
if (isProperty(nodeType, candidates[current])) {
element = new Element(candidate[current2], [key, current2], 'Property', null);
} else if (isNode(candidate[current2])) {
element = new Element(candidate[current2], [key, current2], null, null);
} else {
continue;
}
worklist.push(element);
}
} else if (isNode(candidate)) {
worklist.push(new Element(candidate, key, null, null));
}
}
}
}
};
Controller.prototype.replace = function replace(root, visitor) {
var worklist,
leavelist,
node,
nodeType,
target,
element,
current,
current2,
candidates,
candidate,
sentinel,
outer,
key;
function removeElem(element) {
var i,
key,
nextElem,
parent;
if (element.ref.remove()) {
// When the reference is an element of an array.
key = element.ref.key;
parent = element.ref.parent;
// If removed from array, then decrease following items' keys.
i = worklist.length;
while (i--) {
nextElem = worklist[i];
if (nextElem.ref && nextElem.ref.parent === parent) {
if (nextElem.ref.key < key) {
break;
}
--nextElem.ref.key;
}
}
}
}
this.__initialize(root, visitor);
sentinel = {};
// reference
worklist = this.__worklist;
leavelist = this.__leavelist;
// initialize
outer = {
root: root
};
element = new Element(root, null, null, new Reference(outer, 'root'));
worklist.push(element);
leavelist.push(element);
while (worklist.length) {
element = worklist.pop();
if (element === sentinel) {
element = leavelist.pop();
target = this.__execute(visitor.leave, element);
// node may be replaced with null,
// so distinguish between undefined and null in this place
if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) {
// replace
element.ref.replace(target);
}
if (this.__state === REMOVE || target === REMOVE) {
removeElem(element);
}
if (this.__state === BREAK || target === BREAK) {
return outer.root;
}
continue;
}
target = this.__execute(visitor.enter, element);
// node may be replaced with null,
// so distinguish between undefined and null in this place
if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) {
// replace
element.ref.replace(target);
element.node = target;
}
if (this.__state === REMOVE || target === REMOVE) {
removeElem(element);
element.node = null;
}
if (this.__state === BREAK || target === BREAK) {
return outer.root;
}
// node may be null
node = element.node;
if (!node) {
continue;
}
worklist.push(sentinel);
leavelist.push(element);
if (this.__state === SKIP || target === SKIP) {
continue;
}
nodeType = node.type || element.wrap;
candidates = this.__keys[nodeType];
if (!candidates) {
if (this.__fallback) {
candidates = this.__fallback(node);
} else {
throw new Error('Unknown node type ' + nodeType + '.');
}
}
current = candidates.length;
while ((current -= 1) >= 0) {
key = candidates[current];
candidate = node[key];
if (!candidate) {
continue;
}
if (Array.isArray(candidate)) {
current2 = candidate.length;
while ((current2 -= 1) >= 0) {
if (!candidate[current2]) {
continue;
}
if (isProperty(nodeType, candidates[current])) {
element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2));
} else if (isNode(candidate[current2])) {
element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2));
} else {
continue;
}
worklist.push(element);
}
} else if (isNode(candidate)) {
worklist.push(new Element(candidate, key, null, new Reference(node, key)));
}
}
}
return outer.root;
};
function traverse(root, visitor) {
var controller = new Controller();
return controller.traverse(root, visitor);
}
function replace(root, visitor) {
var controller = new Controller();
return controller.replace(root, visitor);
}
function extendCommentRange(comment, tokens) {
var target;
target = upperBound(tokens, function search(token) {
return token.range[0] > comment.range[0];
});
comment.extendedRange = [comment.range[0], comment.range[1]];
if (target !== tokens.length) {
comment.extendedRange[1] = tokens[target].range[0];
}
target -= 1;
if (target >= 0) {
comment.extendedRange[0] = tokens[target].range[1];
}
return comment;
}
function attachComments(tree, providedComments, tokens) {
// At first, we should calculate extended comment ranges.
var comments = [], comment, len, i, cursor;
if (!tree.range) {
throw new Error('attachComments needs range information');
}
// tokens array is empty, we attach comments to tree as 'leadingComments'
if (!tokens.length) {
if (providedComments.length) {
for (i = 0, len = providedComments.length; i < len; i += 1) {
comment = deepCopy(providedComments[i]);
comment.extendedRange = [0, tree.range[0]];
comments.push(comment);
}
tree.leadingComments = comments;
}
return tree;
}
for (i = 0, len = providedComments.length; i < len; i += 1) {
comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens));
}
// This is based on John Freeman's implementation.
cursor = 0;
traverse(tree, {
enter: function (node) {
var comment;
while (cursor < comments.length) {
comment = comments[cursor];
if (comment.extendedRange[1] > node.range[0]) {
break;
}
if (comment.extendedRange[1] === node.range[0]) {
if (!node.leadingComments) {
node.leadingComments = [];
}
node.leadingComments.push(comment);
comments.splice(cursor, 1);
} else {
cursor += 1;
}
}
// already out of owned node
if (cursor === comments.length) {
return VisitorOption.Break;
}
if (comments[cursor].extendedRange[0] > node.range[1]) {
return VisitorOption.Skip;
}
}
});
cursor = 0;
traverse(tree, {
leave: function (node) {
var comment;
while (cursor < comments.length) {
comment = comments[cursor];
if (node.range[1] < comment.extendedRange[0]) {
break;
}
if (node.range[1] === comment.extendedRange[0]) {
if (!node.trailingComments) {
node.trailingComments = [];
}
node.trailingComments.push(comment);
comments.splice(cursor, 1);
} else {
cursor += 1;
}
}
// already out of owned node
if (cursor === comments.length) {
return VisitorOption.Break;
}
if (comments[cursor].extendedRange[0] > node.range[1]) {
return VisitorOption.Skip;
}
}
});
return tree;
}
exports.version = (__webpack_require__(/*! ./package.json */ "./node_modules/escope/node_modules/estraverse/package.json").version);
exports.Syntax = Syntax;
exports.traverse = traverse;
exports.replace = replace;
exports.attachComments = attachComments;
exports.VisitorKeys = VisitorKeys;
exports.VisitorOption = VisitorOption;
exports.Controller = Controller;
exports.cloneEnvironment = function () { return clone({}); };
return exports;
}(exports));
/* vim: set sw=4 ts=4 et tw=80 : */
/***/ }),
/***/ "./node_modules/escope/node_modules/estraverse/package.json":
/*!******************************************************************!*\
!*** ./node_modules/escope/node_modules/estraverse/package.json ***!
\******************************************************************/
/***/ ((module) => {
"use strict";
module.exports = /*#__PURE__*/JSON.parse('{"name":"estraverse","description":"ECMAScript JS AST traversal functions","homepage":"https://github.com/estools/estraverse","main":"estraverse.js","version":"4.3.0","engines":{"node":">=4.0"},"maintainers":[{"name":"Yusuke Suzuki","email":"[email protected]","web":"http://github.com/Constellation"}],"repository":{"type":"git","url":"http://github.com/estools/estraverse.git"},"devDependencies":{"babel-preset-env":"^1.6.1","babel-register":"^6.3.13","chai":"^2.1.1","espree":"^1.11.0","gulp":"^3.8.10","gulp-bump":"^0.2.2","gulp-filter":"^2.0.0","gulp-git":"^1.0.1","gulp-tag-version":"^1.3.0","jshint":"^2.5.6","mocha":"^2.1.0"},"license":"BSD-2-Clause","scripts":{"test":"npm run-script lint && npm run-script unit-test","lint":"jshint estraverse.js","unit-test":"mocha --compilers js:babel-register"}}');
/***/ }),
/***/ "./node_modules/escope/package.json":
/*!******************************************!*\
!*** ./node_modules/escope/package.json ***!
\******************************************/
/***/ ((module) => {
"use strict";
module.exports = /*#__PURE__*/JSON.parse('{"name":"escope","description":"ECMAScript scope analyzer","homepage":"http://github.com/estools/escope","main":"lib/index.js","files":["lib"],"version":"4.0.0","engines":{"node":">=4.0"},"maintainers":[{"name":"Yusuke Suzuki","email":"[email protected]","web":"http://github.com/Constellation"}],"repository":{"type":"git","url":"https://github.com/estools/escope.git"},"dependencies":{"esrecurse":"^4.1.0","estraverse":"^4.1.1"},"devDependencies":{"babel":"^6.3.26","babel-preset-es2015":"^6.3.13","babel-register":"^6.3.13","browserify":"^14.4.0","chai":"^4.0.2","espree":"^3.1.1","esprima":"^3.0.0","gulp":"^3.9.0","gulp-babel":"^6.1.1","gulp-bump":"^2.7.0","gulp-eslint":"^4.0.0","gulp-espower":"^1.0.2","gulp-filter":"^5.0.0","gulp-git":"^2.4.1","gulp-mocha":"^3.0.0","gulp-plumber":"^1.0.1","gulp-sourcemaps":"^2.6.0","gulp-tag-version":"^1.3.0","jsdoc":"^3.4.0","lazypipe":"^1.0.1","vinyl-source-stream":"^1.1.0"},"license":"BSD-2-Clause","scripts":{"test":"gulp travis","unit-test":"gulp test","lint":"gulp lint","jsdoc":"jsdoc src/*.js README.md"}}');
/***/ }),
/***/ "./node_modules/esprima/dist/esprima.js":
/*!**********************************************!*\
!*** ./node_modules/esprima/dist/esprima.js ***!
\**********************************************/
/***/ (function(module) {
(function webpackUniversalModuleDefinition(root, factory) {
/* istanbul ignore next */
if(true)
module.exports = factory();
else // removed by dead control flow
{}
})(this, function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/ // The require function
/******/ function __nested_webpack_require_583__(moduleId) {
/******/ // Check if module is in cache
/* istanbul ignore if */
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __nested_webpack_require_583__);
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/ // expose the modules object (__webpack_modules__)
/******/ __nested_webpack_require_583__.m = modules;
/******/ // expose the module cache
/******/ __nested_webpack_require_583__.c = installedModules;
/******/ // __webpack_public_path__
/******/ __nested_webpack_require_583__.p = "";
/******/ // Load entry module and return exports
/******/ return __nested_webpack_require_583__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ function(module, exports, __nested_webpack_require_1808__) {
"use strict";
/*
Copyright JS Foundation and other contributors, https://js.foundation/
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
Object.defineProperty(exports, "__esModule", { value: true });
var comment_handler_1 = __nested_webpack_require_1808__(1);
var jsx_parser_1 = __nested_webpack_require_1808__(3);
var parser_1 = __nested_webpack_require_1808__(8);
var tokenizer_1 = __nested_webpack_require_1808__(15);
function parse(code, options, delegate) {
var commentHandler = null;
var proxyDelegate = function (node, metadata) {
if (delegate) {
delegate(node, metadata);
}
if (commentHandler) {
commentHandler.visit(node, metadata);
}
};
var parserDelegate = (typeof delegate === 'function') ? proxyDelegate : null;
var collectComment = false;
if (options) {
collectComment = (typeof options.comment === 'boolean' && options.comment);
var attachComment = (typeof options.attachComment === 'boolean' && options.attachComment);
if (collectComment || attachComment) {
commentHandler = new comment_handler_1.CommentHandler();
commentHandler.attach = attachComment;
options.comment = true;
parserDelegate = proxyDelegate;
}
}
var isModule = false;
if (options && typeof options.sourceType === 'string') {
isModule = (options.sourceType === 'module');
}
var parser;
if (options && typeof options.jsx === 'boolean' && options.jsx) {
parser = new jsx_parser_1.JSXParser(code, options, parserDelegate);
}
else {
parser = new parser_1.Parser(code, options, parserDelegate);
}
var program = isModule ? parser.parseModule() : parser.parseScript();
var ast = program;
if (collectComment && commentHandler) {
ast.comments = commentHandler.comments;
}
if (parser.config.tokens) {
ast.tokens = parser.tokens;
}
if (parser.config.tolerant) {
ast.errors = parser.errorHandler.errors;
}
return ast;
}
exports.parse = parse;
function parseModule(code, options, delegate) {
var parsingOptions = options || {};
parsingOptions.sourceType = 'module';
return parse(code, parsingOptions, delegate);
}
exports.parseModule = parseModule;
function parseScript(code, options, delegate) {
var parsingOptions = options || {};
parsingOptions.sourceType = 'script';
return parse(code, parsingOptions, delegate);
}
exports.parseScript = parseScript;
function tokenize(code, options, delegate) {
var tokenizer = new tokenizer_1.Tokenizer(code, options);
var tokens;
tokens = [];
try {
while (true) {
var token = tokenizer.getNextToken();
if (!token) {
break;
}
if (delegate) {
token = delegate(token);
}
tokens.push(token);
}
}
catch (e) {
tokenizer.errorHandler.tolerate(e);
}
if (tokenizer.errorHandler.tolerant) {
tokens.errors = tokenizer.errors();
}
return tokens;
}
exports.tokenize = tokenize;
var syntax_1 = __nested_webpack_require_1808__(2);
exports.Syntax = syntax_1.Syntax;
// Sync with *.json manifests.
exports.version = '4.0.1';
/***/ },
/* 1 */
/***/ function(module, exports, __nested_webpack_require_6456__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var syntax_1 = __nested_webpack_require_6456__(2);
var CommentHandler = (function () {
function CommentHandler() {
this.attach = false;
this.comments = [];
this.stack = [];
this.leading = [];
this.trailing = [];
}
CommentHandler.prototype.insertInnerComments = function (node, metadata) {
// innnerComments for properties empty block
// `function a() {/** comments **\/}`
if (node.type === syntax_1.Syntax.BlockStatement && node.body.length === 0) {
var innerComments = [];
for (var i = this.leading.length - 1; i >= 0; --i) {
var entry = this.leading[i];
if (metadata.end.offset >= entry.start) {
innerComments.unshift(entry.comment);
this.leading.splice(i, 1);
this.trailing.splice(i, 1);
}
}
if (innerComments.length) {
node.innerComments = innerComments;
}
}
};
CommentHandler.prototype.findTrailingComments = function (metadata) {
var trailingComments = [];
if (this.trailing.length > 0) {
for (var i = this.trailing.length - 1; i >= 0; --i) {
var entry_1 = this.trailing[i];
if (entry_1.start >= metadata.end.offset) {
trailingComments.unshift(entry_1.comment);
}
}
this.trailing.length = 0;
return trailingComments;
}
var entry = this.stack[this.stack.length - 1];
if (entry && entry.node.trailingComments) {
var firstComment = entry.node.trailingComments[0];
if (firstComment && firstComment.range[0] >= metadata.end.offset) {
trailingComments = entry.node.trailingComments;
delete entry.node.trailingComments;
}
}
return trailingComments;
};
CommentHandler.prototype.findLeadingComments = function (metadata) {
var leadingComments = [];
var target;
while (this.stack.length > 0) {
var entry = this.stack[this.stack.length - 1];
if (entry && entry.start >= metadata.start.offset) {
target = entry.node;
this.stack.pop();
}
else {
break;
}
}
if (target) {
var count = target.leadingComments ? target.leadingComments.length : 0;
for (var i = count - 1; i >= 0; --i) {
var comment = target.leadingComments[i];
if (comment.range[1] <= metadata.start.offset) {
leadingComments.unshift(comment);
target.leadingComments.splice(i, 1);
}
}
if (target.leadingComments && target.leadingComments.length === 0) {
delete target.leadingComments;
}
return leadingComments;
}
for (var i = this.leading.length - 1; i >= 0; --i) {
var entry = this.leading[i];
if (entry.start <= metadata.start.offset) {
leadingComments.unshift(entry.comment);
this.leading.splice(i, 1);
}
}
return leadingComments;
};
CommentHandler.prototype.visitNode = function (node, metadata) {
if (node.type === syntax_1.Syntax.Program && node.body.length > 0) {
return;
}
this.insertInnerComments(node, metadata);
var trailingComments = this.findTrailingComments(metadata);
var leadingComments = this.findLeadingComments(metadata);
if (leadingComments.length > 0) {
node.leadingComments = leadingComments;
}
if (trailingComments.length > 0) {
node.trailingComments = trailingComments;
}
this.stack.push({
node: node,
start: metadata.start.offset
});
};
CommentHandler.prototype.visitComment = function (node, metadata) {
var type = (node.type[0] === 'L') ? 'Line' : 'Block';
var comment = {
type: type,
value: node.value
};
if (node.range) {
comment.range = node.range;
}
if (node.loc) {
comment.loc = node.loc;
}
this.comments.push(comment);
if (this.attach) {
var entry = {
comment: {
type: type,
value: node.value,
range: [metadata.start.offset, metadata.end.offset]
},
start: metadata.start.offset
};
if (node.loc) {
entry.comment.loc = node.loc;
}
node.type = type;
this.leading.push(entry);
this.trailing.push(entry);
}
};
CommentHandler.prototype.visit = function (node, metadata) {
if (node.type === 'LineComment') {
this.visitComment(node, metadata);
}
else if (node.type === 'BlockComment') {
this.visitComment(node, metadata);
}
else if (this.attach) {
this.visitNode(node, metadata);
}
};
return CommentHandler;
}());
exports.CommentHandler = CommentHandler;
/***/ },
/* 2 */
/***/ function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Syntax = {
AssignmentExpression: 'AssignmentExpression',
AssignmentPattern: 'AssignmentPattern',
ArrayExpression: 'ArrayExpression',
ArrayPattern: 'ArrayPattern',
ArrowFunctionExpression: 'ArrowFunctionExpression',
AwaitExpression: 'AwaitExpression',
BlockStatement: 'BlockStatement',
BinaryExpression: 'BinaryExpression',
BreakStatement: 'BreakStatement',
CallExpression: 'CallExpression',
CatchClause: 'CatchClause',
ClassBody: 'ClassBody',
ClassDeclaration: 'ClassDeclaration',
ClassExpression: 'ClassExpression',
ConditionalExpression: 'ConditionalExpression',
ContinueStatement: 'ContinueStatement',
DoWhileStatement: 'DoWhileStatement',
DebuggerStatement: 'DebuggerStatement',
EmptyStatement: 'EmptyStatement',
ExportAllDeclaration: 'ExportAllDeclaration',
ExportDefaultDeclaration: 'ExportDefaultDeclaration',
ExportNamedDeclaration: 'ExportNamedDeclaration',
ExportSpecifier: 'ExportSpecifier',
ExpressionStatement: 'ExpressionStatement',
ForStatement: 'ForStatement',
ForOfStatement: 'ForOfStatement',
ForInStatement: 'ForInStatement',
FunctionDeclaration: 'FunctionDeclaration',
FunctionExpression: 'FunctionExpression',
Identifier: 'Identifier',
IfStatement: 'IfStatement',
ImportDeclaration: 'ImportDeclaration',
ImportDefaultSpecifier: 'ImportDefaultSpecifier',
ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',
ImportSpecifier: 'ImportSpecifier',
Literal: 'Literal',
LabeledStatement: 'LabeledStatement',
LogicalExpression: 'LogicalExpression',
MemberExpression: 'MemberExpression',
MetaProperty: 'MetaProperty',
MethodDefinition: 'MethodDefinition',
NewExpression: 'NewExpression',
ObjectExpression: 'ObjectExpression',
ObjectPattern: 'ObjectPattern',
Program: 'Program',
Property: 'Property',
RestElement: 'RestElement',
ReturnStatement: 'ReturnStatement',
SequenceExpression: 'SequenceExpression',
SpreadElement: 'SpreadElement',
Super: 'Super',
SwitchCase: 'SwitchCase',
SwitchStatement: 'SwitchStatement',
TaggedTemplateExpression: 'TaggedTemplateExpression',
TemplateElement: 'TemplateElement',
TemplateLiteral: 'TemplateLiteral',
ThisExpression: 'ThisExpression',
ThrowStatement: 'ThrowStatement',
TryStatement: 'TryStatement',
UnaryExpression: 'UnaryExpression',
UpdateExpression: 'UpdateExpression',
VariableDeclaration: 'VariableDeclaration',
VariableDeclarator: 'VariableDeclarator',
WhileStatement: 'WhileStatement',
WithStatement: 'WithStatement',
YieldExpression: 'YieldExpression'
};
/***/ },
/* 3 */
/***/ function(module, exports, __nested_webpack_require_15019__) {
"use strict";
/* istanbul ignore next */
var __extends = (this && this.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var character_1 = __nested_webpack_require_15019__(4);
var JSXNode = __nested_webpack_require_15019__(5);
var jsx_syntax_1 = __nested_webpack_require_15019__(6);
var Node = __nested_webpack_require_15019__(7);
var parser_1 = __nested_webpack_require_15019__(8);
var token_1 = __nested_webpack_require_15019__(13);
var xhtml_entities_1 = __nested_webpack_require_15019__(14);
token_1.TokenName[100 /* Identifier */] = 'JSXIdentifier';
token_1.TokenName[101 /* Text */] = 'JSXText';
// Fully qualified element name, e.g. <svg:path> returns "svg:path"
function getQualifiedElementName(elementName) {
var qualifiedName;
switch (elementName.type) {
case jsx_syntax_1.JSXSyntax.JSXIdentifier:
var id = elementName;
qualifiedName = id.name;
break;
case jsx_syntax_1.JSXSyntax.JSXNamespacedName:
var ns = elementName;
qualifiedName = getQualifiedElementName(ns.namespace) + ':' +
getQualifiedElementName(ns.name);
break;
case jsx_syntax_1.JSXSyntax.JSXMemberExpression:
var expr = elementName;
qualifiedName = getQualifiedElementName(expr.object) + '.' +
getQualifiedElementName(expr.property);
break;
/* istanbul ignore next */
default:
break;
}
return qualifiedName;
}
var JSXParser = (function (_super) {
__extends(JSXParser, _super);
function JSXParser(code, options, delegate) {
return _super.call(this, code, options, delegate) || this;
}
JSXParser.prototype.parsePrimaryExpression = function () {
return this.match('<') ? this.parseJSXRoot() : _super.prototype.parsePrimaryExpression.call(this);
};
JSXParser.prototype.startJSX = function () {
// Unwind the scanner before the lookahead token.
this.scanner.index = this.startMarker.index;
this.scanner.lineNumber = this.startMarker.line;
this.scanner.lineStart = this.startMarker.index - this.startMarker.column;
};
JSXParser.prototype.finishJSX = function () {
// Prime the next lookahead.
this.nextToken();
};
JSXParser.prototype.reenterJSX = function () {
this.startJSX();
this.expectJSX('}');
// Pop the closing '}' added from the lookahead.
if (this.config.tokens) {
this.tokens.pop();
}
};
JSXParser.prototype.createJSXNode = function () {
this.collectComments();
return {
index: this.scanner.index,
line: this.scanner.lineNumber,
column: this.scanner.index - this.scanner.lineStart
};
};
JSXParser.prototype.createJSXChildNode = function () {
return {
index: this.scanner.index,
line: this.scanner.lineNumber,
column: this.scanner.index - this.scanner.lineStart
};
};
JSXParser.prototype.scanXHTMLEntity = function (quote) {
var result = '&';
var valid = true;
var terminated = false;
var numeric = false;
var hex = false;
while (!this.scanner.eof() && valid && !terminated) {
var ch = this.scanner.source[this.scanner.index];
if (ch === quote) {
break;
}
terminated = (ch === ';');
result += ch;
++this.scanner.index;
if (!terminated) {
switch (result.length) {
case 2:
// e.g. '&#123;'
numeric = (ch === '#');
break;
case 3:
if (numeric) {
// e.g. '&#x41;'
hex = (ch === 'x');
valid = hex || character_1.Character.isDecimalDigit(ch.charCodeAt(0));
numeric = numeric && !hex;
}
break;
default:
valid = valid && !(numeric && !character_1.Character.isDecimalDigit(ch.charCodeAt(0)));
valid = valid && !(hex && !character_1.Character.isHexDigit(ch.charCodeAt(0)));
break;
}
}
}
if (valid && terminated && result.length > 2) {
// e.g. '&#x41;' becomes just '#x41'
var str = result.substr(1, result.length - 2);
if (numeric && str.length > 1) {
result = String.fromCharCode(parseInt(str.substr(1), 10));
}
else if (hex && str.length > 2) {
result = String.fromCharCode(parseInt('0' + str.substr(1), 16));
}
else if (!numeric && !hex && xhtml_entities_1.XHTMLEntities[str]) {
result = xhtml_entities_1.XHTMLEntities[str];
}
}
return result;
};
// Scan the next JSX token. This replaces Scanner#lex when in JSX mode.
JSXParser.prototype.lexJSX = function () {
var cp = this.scanner.source.charCodeAt(this.scanner.index);
// < > / : = { }
if (cp === 60 || cp === 62 || cp === 47 || cp === 58 || cp === 61 || cp === 123 || cp === 125) {
var value = this.scanner.source[this.scanner.index++];
return {
type: 7 /* Punctuator */,
value: value,
lineNumber: this.scanner.lineNumber,
lineStart: this.scanner.lineStart,
start: this.scanner.index - 1,
end: this.scanner.index
};
}
// " '
if (cp === 34 || cp === 39) {
var start = this.scanner.index;
var quote = this.scanner.source[this.scanner.index++];
var str = '';
while (!this.scanner.eof()) {
var ch = this.scanner.source[this.scanner.index++];
if (ch === quote) {
break;
}
else if (ch === '&') {
str += this.scanXHTMLEntity(quote);
}
else {
str += ch;
}
}
return {
type: 8 /* StringLiteral */,
value: str,
lineNumber: this.scanner.lineNumber,
lineStart: this.scanner.lineStart,
start: start,
end: this.scanner.index
};
}
// ... or .
if (cp === 46) {
var n1 = this.scanner.source.charCodeAt(this.scanner.index + 1);
var n2 = this.scanner.source.charCodeAt(this.scanner.index + 2);
var value = (n1 === 46 && n2 === 46) ? '...' : '.';
var start = this.scanner.index;
this.scanner.index += value.length;
return {
type: 7 /* Punctuator */,
value: value,
lineNumber: this.scanner.lineNumber,
lineStart: this.scanner.lineStart,
start: start,
end: this.scanner.index
};
}
// `
if (cp === 96) {
// Only placeholder, since it will be rescanned as a real assignment expression.
return {
type: 10 /* Template */,
value: '',
lineNumber: this.scanner.lineNumber,
lineStart: this.scanner.lineStart,
start: this.scanner.index,
end: this.scanner.index
};
}
// Identifer can not contain backslash (char code 92).
if (character_1.Character.isIdentifierStart(cp) && (cp !== 92)) {
var start = this.scanner.index;
++this.scanner.index;
while (!this.scanner.eof()) {
var ch = this.scanner.source.charCodeAt(this.scanner.index);
if (character_1.Character.isIdentifierPart(ch) && (ch !== 92)) {
++this.scanner.index;
}
else if (ch === 45) {
// Hyphen (char code 45) can be part of an identifier.
++this.scanner.index;
}
else {
break;
}
}
var id = this.scanner.source.slice(start, this.scanner.index);
return {
type: 100 /* Identifier */,
value: id,
lineNumber: this.scanner.lineNumber,
lineStart: this.scanner.lineStart,
start: start,
end: this.scanner.index
};
}
return this.scanner.lex();
};
JSXParser.prototype.nextJSXToken = function () {
this.collectComments();
this.startMarker.index = this.scanner.index;
this.startMarker.line = this.scanner.lineNumber;
this.startMarker.column = this.scanner.index - this.scanner.lineStart;
var token = this.lexJSX();
this.lastMarker.index = this.scanner.index;
this.lastMarker.line = this.scanner.lineNumber;
this.lastMarker.column = this.scanner.index - this.scanner.lineStart;
if (this.config.tokens) {
this.tokens.push(this.convertToken(token));
}
return token;
};
JSXParser.prototype.nextJSXText = function () {
this.startMarker.index = this.scanner.index;
this.startMarker.line = this.scanner.lineNumber;
this.startMarker.column = this.scanner.index - this.scanner.lineStart;
var start = this.scanner.index;
var text = '';
while (!this.scanner.eof()) {
var ch = this.scanner.source[this.scanner.index];
if (ch === '{' || ch === '<') {
break;
}
++this.scanner.index;
text += ch;
if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
++this.scanner.lineNumber;
if (ch === '\r' && this.scanner.source[this.scanner.index] === '\n') {
++this.scanner.index;
}
this.scanner.lineStart = this.scanner.index;
}
}
this.lastMarker.index = this.scanner.index;
this.lastMarker.line = this.scanner.lineNumber;
this.lastMarker.column = this.scanner.index - this.scanner.lineStart;
var token = {
type: 101 /* Text */,
value: text,
lineNumber: this.scanner.lineNumber,
lineStart: this.scanner.lineStart,
start: start,
end: this.scanner.index
};
if ((text.length > 0) && this.config.tokens) {
this.tokens.push(this.convertToken(token));
}
return token;
};
JSXParser.prototype.peekJSXToken = function () {
var state = this.scanner.saveState();
this.scanner.scanComments();
var next = this.lexJSX();
this.scanner.restoreState(state);
return next;
};
// Expect the next JSX token to match the specified punctuator.
// If not, an exception will be thrown.
JSXParser.prototype.expectJSX = function (value) {
var token = this.nextJSXToken();
if (token.type !== 7 /* Punctuator */ || token.value !== value) {
this.throwUnexpectedToken(token);
}
};
// Return true if the next JSX token matches the specified punctuator.
JSXParser.prototype.matchJSX = function (value) {
var next = this.peekJSXToken();
return next.type === 7 /* Punctuator */ && next.value === value;
};
JSXParser.prototype.parseJSXIdentifier = function () {
var node = this.createJSXNode();
var token = this.nextJSXToken();
if (token.type !== 100 /* Identifier */) {
this.throwUnexpectedToken(token);
}
return this.finalize(node, new JSXNode.JSXIdentifier(token.value));
};
JSXParser.prototype.parseJSXElementName = function () {
var node = this.createJSXNode();
var elementName = this.parseJSXIdentifier();
if (this.matchJSX(':')) {
var namespace = elementName;
this.expectJSX(':');
var name_1 = this.parseJSXIdentifier();
elementName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_1));
}
else if (this.matchJSX('.')) {
while (this.matchJSX('.')) {
var object = elementName;
this.expectJSX('.');
var property = this.parseJSXIdentifier();
elementName = this.finalize(node, new JSXNode.JSXMemberExpression(object, property));
}
}
return elementName;
};
JSXParser.prototype.parseJSXAttributeName = function () {
var node = this.createJSXNode();
var attributeName;
var identifier = this.parseJSXIdentifier();
if (this.matchJSX(':')) {
var namespace = identifier;
this.expectJSX(':');
var name_2 = this.parseJSXIdentifier();
attributeName = this.finalize(node, new JSXNode.JSXNamespacedName(namespace, name_2));
}
else {
attributeName = identifier;
}
return attributeName;
};
JSXParser.prototype.parseJSXStringLiteralAttribute = function () {
var node = this.createJSXNode();
var token = this.nextJSXToken();
if (token.type !== 8 /* StringLiteral */) {
this.throwUnexpectedToken(token);
}
var raw = this.getTokenRaw(token);
return this.finalize(node, new Node.Literal(token.value, raw));
};
JSXParser.prototype.parseJSXExpressionAttribute = function () {
var node = this.createJSXNode();
this.expectJSX('{');
this.finishJSX();
if (this.match('}')) {
this.tolerateError('JSX attributes must only be assigned a non-empty expression');
}
var expression = this.parseAssignmentExpression();
this.reenterJSX();
return this.finalize(node, new JSXNode.JSXExpressionContainer(expression));
};
JSXParser.prototype.parseJSXAttributeValue = function () {
return this.matchJSX('{') ? this.parseJSXExpressionAttribute() :
this.matchJSX('<') ? this.parseJSXElement() : this.parseJSXStringLiteralAttribute();
};
JSXParser.prototype.parseJSXNameValueAttribute = function () {
var node = this.createJSXNode();
var name = this.parseJSXAttributeName();
var value = null;
if (this.matchJSX('=')) {
this.expectJSX('=');
value = this.parseJSXAttributeValue();
}
return this.finalize(node, new JSXNode.JSXAttribute(name, value));
};
JSXParser.prototype.parseJSXSpreadAttribute = function () {
var node = this.createJSXNode();
this.expectJSX('{');
this.expectJSX('...');
this.finishJSX();
var argument = this.parseAssignmentExpression();
this.reenterJSX();
return this.finalize(node, new JSXNode.JSXSpreadAttribute(argument));
};
JSXParser.prototype.parseJSXAttributes = function () {
var attributes = [];
while (!this.matchJSX('/') && !this.matchJSX('>')) {
var attribute = this.matchJSX('{') ? this.parseJSXSpreadAttribute() :
this.parseJSXNameValueAttribute();
attributes.push(attribute);
}
return attributes;
};
JSXParser.prototype.parseJSXOpeningElement = function () {
var node = this.createJSXNode();
this.expectJSX('<');
var name = this.parseJSXElementName();
var attributes = this.parseJSXAttributes();
var selfClosing = this.matchJSX('/');
if (selfClosing) {
this.expectJSX('/');
}
this.expectJSX('>');
return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes));
};
JSXParser.prototype.parseJSXBoundaryElement = function () {
var node = this.createJSXNode();
this.expectJSX('<');
if (this.matchJSX('/')) {
this.expectJSX('/');
var name_3 = this.parseJSXElementName();
this.expectJSX('>');
return this.finalize(node, new JSXNode.JSXClosingElement(name_3));
}
var name = this.parseJSXElementName();
var attributes = this.parseJSXAttributes();
var selfClosing = this.matchJSX('/');
if (selfClosing) {
this.expectJSX('/');
}
this.expectJSX('>');
return this.finalize(node, new JSXNode.JSXOpeningElement(name, selfClosing, attributes));
};
JSXParser.prototype.parseJSXEmptyExpression = function () {
var node = this.createJSXChildNode();
this.collectComments();
this.lastMarker.index = this.scanner.index;
this.lastMarker.line = this.scanner.lineNumber;
this.lastMarker.column = this.scanner.index - this.scanner.lineStart;
return this.finalize(node, new JSXNode.JSXEmptyExpression());
};
JSXParser.prototype.parseJSXExpressionContainer = function () {
var node = this.createJSXNode();
this.expectJSX('{');
var expression;
if (this.matchJSX('}')) {
expression = this.parseJSXEmptyExpression();
this.expectJSX('}');
}
else {
this.finishJSX();
expression = this.parseAssignmentExpression();
this.reenterJSX();
}
return this.finalize(node, new JSXNode.JSXExpressionContainer(expression));
};
JSXParser.prototype.parseJSXChildren = function () {
var children = [];
while (!this.scanner.eof()) {
var node = this.createJSXChildNode();
var token = this.nextJSXText();
if (token.start < token.end) {
var raw = this.getTokenRaw(token);
var child = this.finalize(node, new JSXNode.JSXText(token.value, raw));
children.push(child);
}
if (this.scanner.source[this.scanner.index] === '{') {
var container = this.parseJSXExpressionContainer();
children.push(container);
}
else {
break;
}
}
return children;
};
JSXParser.prototype.parseComplexJSXElement = function (el) {
var stack = [];
while (!this.scanner.eof()) {
el.children = el.children.concat(this.parseJSXChildren());
var node = this.createJSXChildNode();
var element = this.parseJSXBoundaryElement();
if (element.type === jsx_syntax_1.JSXSyntax.JSXOpeningElement) {
var opening = element;
if (opening.selfClosing) {
var child = this.finalize(node, new JSXNode.JSXElement(opening, [], null));
el.children.push(child);
}
else {
stack.push(el);
el = { node: node, opening: opening, closing: null, children: [] };
}
}
if (element.type === jsx_syntax_1.JSXSyntax.JSXClosingElement) {
el.closing = element;
var open_1 = getQualifiedElementName(el.opening.name);
var close_1 = getQualifiedElementName(el.closing.name);
if (open_1 !== close_1) {
this.tolerateError('Expected corresponding JSX closing tag for %0', open_1);
}
if (stack.length > 0) {
var child = this.finalize(el.node, new JSXNode.JSXElement(el.opening, el.children, el.closing));
el = stack[stack.length - 1];
el.children.push(child);
stack.pop();
}
else {
break;
}
}
}
return el;
};
JSXParser.prototype.parseJSXElement = function () {
var node = this.createJSXNode();
var opening = this.parseJSXOpeningElement();
var children = [];
var closing = null;
if (!opening.selfClosing) {
var el = this.parseComplexJSXElement({ node: node, opening: opening, closing: closing, children: children });
children = el.children;
closing = el.closing;
}
return this.finalize(node, new JSXNode.JSXElement(opening, children, closing));
};
JSXParser.prototype.parseJSXRoot = function () {
// Pop the opening '<' added from the lookahead.
if (this.config.tokens) {
this.tokens.pop();
}
this.startJSX();
var element = this.parseJSXElement();
this.finishJSX();
return element;
};
JSXParser.prototype.isStartOfExpression = function () {
return _super.prototype.isStartOfExpression.call(this) || this.match('<');
};
return JSXParser;
}(parser_1.Parser));
exports.JSXParser = JSXParser;
/***/ },
/* 4 */
/***/ function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// See also tools/generate-unicode-regex.js.
var Regex = {
// Unicode v8.0.0 NonAsciiIdentifierStart:
NonAsciiIdentifierStart: /[\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u08A0-\u08B4\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309B-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD40-\uDD74\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF30-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1]|\uD87E[\uDC00-\uDE1D]/,
// Unicode v8.0.0 NonAsciiIdentifierPart:
NonAsciiIdentifierPart: /[\xAA\xB5\xB7\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0300-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u0483-\u0487\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u05D0-\u05EA\u05F0-\u05F2\u0610-\u061A\u0620-\u0669\u066E-\u06D3\u06D5-\u06DC\u06DF-\u06E8\u06EA-\u06FC\u06FF\u0710-\u074A\u074D-\u07B1\u07C0-\u07F5\u07FA\u0800-\u082D\u0840-\u085B\u08A0-\u08B4\u08E3-\u0963\u0966-\u096F\u0971-\u0983\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BC-\u09C4\u09C7\u09C8\u09CB-\u09CE\u09D7\u09DC\u09DD\u09DF-\u09E3\u09E6-\u09F1\u0A01-\u0A03\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A59-\u0A5C\u0A5E\u0A66-\u0A75\u0A81-\u0A83\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABC-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AD0\u0AE0-\u0AE3\u0AE6-\u0AEF\u0AF9\u0B01-\u0B03\u0B05-\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0EB9\u0EBB-\u0EBD\u0EC0-\u0EC4\u0EC6\u0EC8-\u0ECD\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F18\u0F19\u0F20-\u0F29\u0F35\u0F37\u0F39\u0F3E-\u0F47\u0F49-\u0F6C\u0F71-\u0F84\u0F86-\u0F97\u0F99-\u0FBC\u0FC6\u1000-\u1049\u1050-\u109D\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u135D-\u135F\u1369-\u1371\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u170C\u170E-\u1714\u1720-\u1734\u1740-\u1753\u1760-\u176C\u176E-\u1770\u1772\u1773\u1780-\u17D3\u17D7\u17DC\u17DD\u17E0-\u17E9\u180B-\u180D\u1810-\u1819\u1820-\u1877\u1880-\u18AA\u18B0-\u18F5\u1900-\u191E\u1920-\u192B\u1930-\u193B\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A1B\u1A20-\u1A5E\u1A60-\u1A7C\u1A7F-\u1A89\u1A90-\u1A99\u1AA7\u1AB0-\u1ABD\u1B00-\u1B4B\u1B50-\u1B59\u1B6B-\u1B73\u1B80-\u1BF3\u1C00-\u1C37\u1C40-\u1C49\u1C4D-\u1C7D\u1CD0-\u1CD2\u1CD4-\u1CF6\u1CF8\u1CF9\u1D00-\u1DF5\u1DFC-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u200C\u200D\u203F\u2040\u2054\u2071\u207F\u2090-\u209C\u20D0-\u20DC\u20E1\u20E5-\u20F0\u2102\u2107\u210A-\u2113\u2115\u2118-\u211D\u2124\u2126\u2128\u212A-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2160-\u2188\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D7F-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2DE0-\u2DFF\u3005-\u3007\u3021-\u302F\u3031-\u3035\u3038-\u303C\u3041-\u3096\u3099-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312D\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FD5\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66F\uA674-\uA67D\uA67F-\uA6F1\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AD\uA7B0-\uA7B7\uA7F7-\uA827\uA840-\uA873\uA880-\uA8C4\uA8D0-\uA8D9\uA8E0-\uA8F7\uA8FB\uA8FD\uA900-\uA92D\uA930-\uA953\uA960-\uA97C\uA980-\uA9C0\uA9CF-\uA9D9\uA9E0-\uA9FE\uAA00-\uAA36\uAA40-\uAA4D\uAA50-\uAA59\uAA60-\uAA76\uAA7A-\uAAC2\uAADB-\uAADD\uAAE0-\uAAEF\uAAF2-\uAAF6\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB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\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC00-\uDC46\uDC66-\uDC6F\uDC7F-\uDCBA\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD00-\uDD34\uDD36-\uDD3F\uDD50-\uDD73\uDD76\uDD80-\uDDC4\uDDCA-\uDDCC\uDDD0-\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE37\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEEA\uDEF0-\uDEF9\uDF00-\uDF03\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3C-\uDF44\uDF47\uDF48\uDF4B-\uDF4D\uDF50\uDF57\uDF5D-\uDF63\uDF66-\uDF6C\uDF70-\uDF74]|\uD805[\uDC80-\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDB5\uDDB8-\uDDC0\uDDD8-\uDDDD\uDE00-\uDE40\uDE44\uDE50-\uDE59\uDE80-\uDEB7\uDEC0-\uDEC9\uDF00-\uDF19\uDF1D-\uDF2B\uDF30-\uDF39]|\uD806[\uDCA0-\uDCE9\uDCFF\uDEC0-\uDEF8]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|[\uD80C\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDED0-\uDEED\uDEF0-\uDEF4\uDF00-\uDF36\uDF40-\uDF43\uDF50-\uDF59\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50-\uDF7E\uDF8F-\uDF9F]|\uD82C[\uDC00\uDC01]|\uD82F[\uDC00-\uD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40[\uDD00-\uDDEF]/
};
exports.Character = {
/* tslint:disable:no-bitwise */
fromCodePoint: function (cp) {
return (cp < 0x10000) ? String.fromCharCode(cp) :
String.fromCharCode(0xD800 + ((cp - 0x10000) >> 10)) +
String.fromCharCode(0xDC00 + ((cp - 0x10000) & 1023));
},
// https://tc39.github.io/ecma262/#sec-white-space
isWhiteSpace: function (cp) {
return (cp === 0x20) || (cp === 0x09) || (cp === 0x0B) || (cp === 0x0C) || (cp === 0xA0) ||
(cp >= 0x1680 && [0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x202F, 0x205F, 0x3000, 0xFEFF].indexOf(cp) >= 0);
},
// https://tc39.github.io/ecma262/#sec-line-terminators
isLineTerminator: function (cp) {
return (cp === 0x0A) || (cp === 0x0D) || (cp === 0x2028) || (cp === 0x2029);
},
// https://tc39.github.io/ecma262/#sec-names-and-keywords
isIdentifierStart: function (cp) {
return (cp === 0x24) || (cp === 0x5F) ||
(cp >= 0x41 && cp <= 0x5A) ||
(cp >= 0x61 && cp <= 0x7A) ||
(cp === 0x5C) ||
((cp >= 0x80) && Regex.NonAsciiIdentifierStart.test(exports.Character.fromCodePoint(cp)));
},
isIdentifierPart: function (cp) {
return (cp === 0x24) || (cp === 0x5F) ||
(cp >= 0x41 && cp <= 0x5A) ||
(cp >= 0x61 && cp <= 0x7A) ||
(cp >= 0x30 && cp <= 0x39) ||
(cp === 0x5C) ||
((cp >= 0x80) && Regex.NonAsciiIdentifierPart.test(exports.Character.fromCodePoint(cp)));
},
// https://tc39.github.io/ecma262/#sec-literals-numeric-literals
isDecimalDigit: function (cp) {
return (cp >= 0x30 && cp <= 0x39); // 0..9
},
isHexDigit: function (cp) {
return (cp >= 0x30 && cp <= 0x39) ||
(cp >= 0x41 && cp <= 0x46) ||
(cp >= 0x61 && cp <= 0x66); // a..f
},
isOctalDigit: function (cp) {
return (cp >= 0x30 && cp <= 0x37); // 0..7
}
};
/***/ },
/* 5 */
/***/ function(module, exports, __nested_webpack_require_54354__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var jsx_syntax_1 = __nested_webpack_require_54354__(6);
/* tslint:disable:max-classes-per-file */
var JSXClosingElement = (function () {
function JSXClosingElement(name) {
this.type = jsx_syntax_1.JSXSyntax.JSXClosingElement;
this.name = name;
}
return JSXClosingElement;
}());
exports.JSXClosingElement = JSXClosingElement;
var JSXElement = (function () {
function JSXElement(openingElement, children, closingElement) {
this.type = jsx_syntax_1.JSXSyntax.JSXElement;
this.openingElement = openingElement;
this.children = children;
this.closingElement = closingElement;
}
return JSXElement;
}());
exports.JSXElement = JSXElement;
var JSXEmptyExpression = (function () {
function JSXEmptyExpression() {
this.type = jsx_syntax_1.JSXSyntax.JSXEmptyExpression;
}
return JSXEmptyExpression;
}());
exports.JSXEmptyExpression = JSXEmptyExpression;
var JSXExpressionContainer = (function () {
function JSXExpressionContainer(expression) {
this.type = jsx_syntax_1.JSXSyntax.JSXExpressionContainer;
this.expression = expression;
}
return JSXExpressionContainer;
}());
exports.JSXExpressionContainer = JSXExpressionContainer;
var JSXIdentifier = (function () {
function JSXIdentifier(name) {
this.type = jsx_syntax_1.JSXSyntax.JSXIdentifier;
this.name = name;
}
return JSXIdentifier;
}());
exports.JSXIdentifier = JSXIdentifier;
var JSXMemberExpression = (function () {
function JSXMemberExpression(object, property) {
this.type = jsx_syntax_1.JSXSyntax.JSXMemberExpression;
this.object = object;
this.property = property;
}
return JSXMemberExpression;
}());
exports.JSXMemberExpression = JSXMemberExpression;
var JSXAttribute = (function () {
function JSXAttribute(name, value) {
this.type = jsx_syntax_1.JSXSyntax.JSXAttribute;
this.name = name;
this.value = value;
}
return JSXAttribute;
}());
exports.JSXAttribute = JSXAttribute;
var JSXNamespacedName = (function () {
function JSXNamespacedName(namespace, name) {
this.type = jsx_syntax_1.JSXSyntax.JSXNamespacedName;
this.namespace = namespace;
this.name = name;
}
return JSXNamespacedName;
}());
exports.JSXNamespacedName = JSXNamespacedName;
var JSXOpeningElement = (function () {
function JSXOpeningElement(name, selfClosing, attributes) {
this.type = jsx_syntax_1.JSXSyntax.JSXOpeningElement;
this.name = name;
this.selfClosing = selfClosing;
this.attributes = attributes;
}
return JSXOpeningElement;
}());
exports.JSXOpeningElement = JSXOpeningElement;
var JSXSpreadAttribute = (function () {
function JSXSpreadAttribute(argument) {
this.type = jsx_syntax_1.JSXSyntax.JSXSpreadAttribute;
this.argument = argument;
}
return JSXSpreadAttribute;
}());
exports.JSXSpreadAttribute = JSXSpreadAttribute;
var JSXText = (function () {
function JSXText(value, raw) {
this.type = jsx_syntax_1.JSXSyntax.JSXText;
this.value = value;
this.raw = raw;
}
return JSXText;
}());
exports.JSXText = JSXText;
/***/ },
/* 6 */
/***/ function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.JSXSyntax = {
JSXAttribute: 'JSXAttribute',
JSXClosingElement: 'JSXClosingElement',
JSXElement: 'JSXElement',
JSXEmptyExpression: 'JSXEmptyExpression',
JSXExpressionContainer: 'JSXExpressionContainer',
JSXIdentifier: 'JSXIdentifier',
JSXMemberExpression: 'JSXMemberExpression',
JSXNamespacedName: 'JSXNamespacedName',
JSXOpeningElement: 'JSXOpeningElement',
JSXSpreadAttribute: 'JSXSpreadAttribute',
JSXText: 'JSXText'
};
/***/ },
/* 7 */
/***/ function(module, exports, __nested_webpack_require_58416__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var syntax_1 = __nested_webpack_require_58416__(2);
/* tslint:disable:max-classes-per-file */
var ArrayExpression = (function () {
function ArrayExpression(elements) {
this.type = syntax_1.Syntax.ArrayExpression;
this.elements = elements;
}
return ArrayExpression;
}());
exports.ArrayExpression = ArrayExpression;
var ArrayPattern = (function () {
function ArrayPattern(elements) {
this.type = syntax_1.Syntax.ArrayPattern;
this.elements = elements;
}
return ArrayPattern;
}());
exports.ArrayPattern = ArrayPattern;
var ArrowFunctionExpression = (function () {
function ArrowFunctionExpression(params, body, expression) {
this.type = syntax_1.Syntax.ArrowFunctionExpression;
this.id = null;
this.params = params;
this.body = body;
this.generator = false;
this.expression = expression;
this.async = false;
}
return ArrowFunctionExpression;
}());
exports.ArrowFunctionExpression = ArrowFunctionExpression;
var AssignmentExpression = (function () {
function AssignmentExpression(operator, left, right) {
this.type = syntax_1.Syntax.AssignmentExpression;
this.operator = operator;
this.left = left;
this.right = right;
}
return AssignmentExpression;
}());
exports.AssignmentExpression = AssignmentExpression;
var AssignmentPattern = (function () {
function AssignmentPattern(left, right) {
this.type = syntax_1.Syntax.AssignmentPattern;
this.left = left;
this.right = right;
}
return AssignmentPattern;
}());
exports.AssignmentPattern = AssignmentPattern;
var AsyncArrowFunctionExpression = (function () {
function AsyncArrowFunctionExpression(params, body, expression) {
this.type = syntax_1.Syntax.ArrowFunctionExpression;
this.id = null;
this.params = params;
this.body = body;
this.generator = false;
this.expression = expression;
this.async = true;
}
return AsyncArrowFunctionExpression;
}());
exports.AsyncArrowFunctionExpression = AsyncArrowFunctionExpression;
var AsyncFunctionDeclaration = (function () {
function AsyncFunctionDeclaration(id, params, body) {
this.type = syntax_1.Syntax.FunctionDeclaration;
this.id = id;
this.params = params;
this.body = body;
this.generator = false;
this.expression = false;
this.async = true;
}
return AsyncFunctionDeclaration;
}());
exports.AsyncFunctionDeclaration = AsyncFunctionDeclaration;
var AsyncFunctionExpression = (function () {
function AsyncFunctionExpression(id, params, body) {
this.type = syntax_1.Syntax.FunctionExpression;
this.id = id;
this.params = params;
this.body = body;
this.generator = false;
this.expression = false;
this.async = true;
}
return AsyncFunctionExpression;
}());
exports.AsyncFunctionExpression = AsyncFunctionExpression;
var AwaitExpression = (function () {
function AwaitExpression(argument) {
this.type = syntax_1.Syntax.AwaitExpression;
this.argument = argument;
}
return AwaitExpression;
}());
exports.AwaitExpression = AwaitExpression;
var BinaryExpression = (function () {
function BinaryExpression(operator, left, right) {
var logical = (operator === '||' || operator === '&&');
this.type = logical ? syntax_1.Syntax.LogicalExpression : syntax_1.Syntax.BinaryExpression;
this.operator = operator;
this.left = left;
this.right = right;
}
return BinaryExpression;
}());
exports.BinaryExpression = BinaryExpression;
var BlockStatement = (function () {
function BlockStatement(body) {
this.type = syntax_1.Syntax.BlockStatement;
this.body = body;
}
return BlockStatement;
}());
exports.BlockStatement = BlockStatement;
var BreakStatement = (function () {
function BreakStatement(label) {
this.type = syntax_1.Syntax.BreakStatement;
this.label = label;
}
return BreakStatement;
}());
exports.BreakStatement = BreakStatement;
var CallExpression = (function () {
function CallExpression(callee, args) {
this.type = syntax_1.Syntax.CallExpression;
this.callee = callee;
this.arguments = args;
}
return CallExpression;
}());
exports.CallExpression = CallExpression;
var CatchClause = (function () {
function CatchClause(param, body) {
this.type = syntax_1.Syntax.CatchClause;
this.param = param;
this.body = body;
}
return CatchClause;
}());
exports.CatchClause = CatchClause;
var ClassBody = (function () {
function ClassBody(body) {
this.type = syntax_1.Syntax.ClassBody;
this.body = body;
}
return ClassBody;
}());
exports.ClassBody = ClassBody;
var ClassDeclaration = (function () {
function ClassDeclaration(id, superClass, body) {
this.type = syntax_1.Syntax.ClassDeclaration;
this.id = id;
this.superClass = superClass;
this.body = body;
}
return ClassDeclaration;
}());
exports.ClassDeclaration = ClassDeclaration;
var ClassExpression = (function () {
function ClassExpression(id, superClass, body) {
this.type = syntax_1.Syntax.ClassExpression;
this.id = id;
this.superClass = superClass;
this.body = body;
}
return ClassExpression;
}());
exports.ClassExpression = ClassExpression;
var ComputedMemberExpression = (function () {
function ComputedMemberExpression(object, property) {
this.type = syntax_1.Syntax.MemberExpression;
this.computed = true;
this.object = object;
this.property = property;
}
return ComputedMemberExpression;
}());
exports.ComputedMemberExpression = ComputedMemberExpression;
var ConditionalExpression = (function () {
function ConditionalExpression(test, consequent, alternate) {
this.type = syntax_1.Syntax.ConditionalExpression;
this.test = test;
this.consequent = consequent;
this.alternate = alternate;
}
return ConditionalExpression;
}());
exports.ConditionalExpression = ConditionalExpression;
var ContinueStatement = (function () {
function ContinueStatement(label) {
this.type = syntax_1.Syntax.ContinueStatement;
this.label = label;
}
return ContinueStatement;
}());
exports.ContinueStatement = ContinueStatement;
var DebuggerStatement = (function () {
function DebuggerStatement() {
this.type = syntax_1.Syntax.DebuggerStatement;
}
return DebuggerStatement;
}());
exports.DebuggerStatement = DebuggerStatement;
var Directive = (function () {
function Directive(expression, directive) {
this.type = syntax_1.Syntax.ExpressionStatement;
this.expression = expression;
this.directive = directive;
}
return Directive;
}());
exports.Directive = Directive;
var DoWhileStatement = (function () {
function DoWhileStatement(body, test) {
this.type = syntax_1.Syntax.DoWhileStatement;
this.body = body;
this.test = test;
}
return DoWhileStatement;
}());
exports.DoWhileStatement = DoWhileStatement;
var EmptyStatement = (function () {
function EmptyStatement() {
this.type = syntax_1.Syntax.EmptyStatement;
}
return EmptyStatement;
}());
exports.EmptyStatement = EmptyStatement;
var ExportAllDeclaration = (function () {
function ExportAllDeclaration(source) {
this.type = syntax_1.Syntax.ExportAllDeclaration;
this.source = source;
}
return ExportAllDeclaration;
}());
exports.ExportAllDeclaration = ExportAllDeclaration;
var ExportDefaultDeclaration = (function () {
function ExportDefaultDeclaration(declaration) {
this.type = syntax_1.Syntax.ExportDefaultDeclaration;
this.declaration = declaration;
}
return ExportDefaultDeclaration;
}());
exports.ExportDefaultDeclaration = ExportDefaultDeclaration;
var ExportNamedDeclaration = (function () {
function ExportNamedDeclaration(declaration, specifiers, source) {
this.type = syntax_1.Syntax.ExportNamedDeclaration;
this.declaration = declaration;
this.specifiers = specifiers;
this.source = source;
}
return ExportNamedDeclaration;
}());
exports.ExportNamedDeclaration = ExportNamedDeclaration;
var ExportSpecifier = (function () {
function ExportSpecifier(local, exported) {
this.type = syntax_1.Syntax.ExportSpecifier;
this.exported = exported;
this.local = local;
}
return ExportSpecifier;
}());
exports.ExportSpecifier = ExportSpecifier;
var ExpressionStatement = (function () {
function ExpressionStatement(expression) {
this.type = syntax_1.Syntax.ExpressionStatement;
this.expression = expression;
}
return ExpressionStatement;
}());
exports.ExpressionStatement = ExpressionStatement;
var ForInStatement = (function () {
function ForInStatement(left, right, body) {
this.type = syntax_1.Syntax.ForInStatement;
this.left = left;
this.right = right;
this.body = body;
this.each = false;
}
return ForInStatement;
}());
exports.ForInStatement = ForInStatement;
var ForOfStatement = (function () {
function ForOfStatement(left, right, body) {
this.type = syntax_1.Syntax.ForOfStatement;
this.left = left;
this.right = right;
this.body = body;
}
return ForOfStatement;
}());
exports.ForOfStatement = ForOfStatement;
var ForStatement = (function () {
function ForStatement(init, test, update, body) {
this.type = syntax_1.Syntax.ForStatement;
this.init = init;
this.test = test;
this.update = update;
this.body = body;
}
return ForStatement;
}());
exports.ForStatement = ForStatement;
var FunctionDeclaration = (function () {
function FunctionDeclaration(id, params, body, generator) {
this.type = syntax_1.Syntax.FunctionDeclaration;
this.id = id;
this.params = params;
this.body = body;
this.generator = generator;
this.expression = false;
this.async = false;
}
return FunctionDeclaration;
}());
exports.FunctionDeclaration = FunctionDeclaration;
var FunctionExpression = (function () {
function FunctionExpression(id, params, body, generator) {
this.type = syntax_1.Syntax.FunctionExpression;
this.id = id;
this.params = params;
this.body = body;
this.generator = generator;
this.expression = false;
this.async = false;
}
return FunctionExpression;
}());
exports.FunctionExpression = FunctionExpression;
var Identifier = (function () {
function Identifier(name) {
this.type = syntax_1.Syntax.Identifier;
this.name = name;
}
return Identifier;
}());
exports.Identifier = Identifier;
var IfStatement = (function () {
function IfStatement(test, consequent, alternate) {
this.type = syntax_1.Syntax.IfStatement;
this.test = test;
this.consequent = consequent;
this.alternate = alternate;
}
return IfStatement;
}());
exports.IfStatement = IfStatement;
var ImportDeclaration = (function () {
function ImportDeclaration(specifiers, source) {
this.type = syntax_1.Syntax.ImportDeclaration;
this.specifiers = specifiers;
this.source = source;
}
return ImportDeclaration;
}());
exports.ImportDeclaration = ImportDeclaration;
var ImportDefaultSpecifier = (function () {
function ImportDefaultSpecifier(local) {
this.type = syntax_1.Syntax.ImportDefaultSpecifier;
this.local = local;
}
return ImportDefaultSpecifier;
}());
exports.ImportDefaultSpecifier = ImportDefaultSpecifier;
var ImportNamespaceSpecifier = (function () {
function ImportNamespaceSpecifier(local) {
this.type = syntax_1.Syntax.ImportNamespaceSpecifier;
this.local = local;
}
return ImportNamespaceSpecifier;
}());
exports.ImportNamespaceSpecifier = ImportNamespaceSpecifier;
var ImportSpecifier = (function () {
function ImportSpecifier(local, imported) {
this.type = syntax_1.Syntax.ImportSpecifier;
this.local = local;
this.imported = imported;
}
return ImportSpecifier;
}());
exports.ImportSpecifier = ImportSpecifier;
var LabeledStatement = (function () {
function LabeledStatement(label, body) {
this.type = syntax_1.Syntax.LabeledStatement;
this.label = label;
this.body = body;
}
return LabeledStatement;
}());
exports.LabeledStatement = LabeledStatement;
var Literal = (function () {
function Literal(value, raw) {
this.type = syntax_1.Syntax.Literal;
this.value = value;
this.raw = raw;
}
return Literal;
}());
exports.Literal = Literal;
var MetaProperty = (function () {
function MetaProperty(meta, property) {
this.type = syntax_1.Syntax.MetaProperty;
this.meta = meta;
this.property = property;
}
return MetaProperty;
}());
exports.MetaProperty = MetaProperty;
var MethodDefinition = (function () {
function MethodDefinition(key, computed, value, kind, isStatic) {
this.type = syntax_1.Syntax.MethodDefinition;
this.key = key;
this.computed = computed;
this.value = value;
this.kind = kind;
this.static = isStatic;
}
return MethodDefinition;
}());
exports.MethodDefinition = MethodDefinition;
var Module = (function () {
function Module(body) {
this.type = syntax_1.Syntax.Program;
this.body = body;
this.sourceType = 'module';
}
return Module;
}());
exports.Module = Module;
var NewExpression = (function () {
function NewExpression(callee, args) {
this.type = syntax_1.Syntax.NewExpression;
this.callee = callee;
this.arguments = args;
}
return NewExpression;
}());
exports.NewExpression = NewExpression;
var ObjectExpression = (function () {
function ObjectExpression(properties) {
this.type = syntax_1.Syntax.ObjectExpression;
this.properties = properties;
}
return ObjectExpression;
}());
exports.ObjectExpression = ObjectExpression;
var ObjectPattern = (function () {
function ObjectPattern(properties) {
this.type = syntax_1.Syntax.ObjectPattern;
this.properties = properties;
}
return ObjectPattern;
}());
exports.ObjectPattern = ObjectPattern;
var Property = (function () {
function Property(kind, key, computed, value, method, shorthand) {
this.type = syntax_1.Syntax.Property;
this.key = key;
this.computed = computed;
this.value = value;
this.kind = kind;
this.method = method;
this.shorthand = shorthand;
}
return Property;
}());
exports.Property = Property;
var RegexLiteral = (function () {
function RegexLiteral(value, raw, pattern, flags) {
this.type = syntax_1.Syntax.Literal;
this.value = value;
this.raw = raw;
this.regex = { pattern: pattern, flags: flags };
}
return RegexLiteral;
}());
exports.RegexLiteral = RegexLiteral;
var RestElement = (function () {
function RestElement(argument) {
this.type = syntax_1.Syntax.RestElement;
this.argument = argument;
}
return RestElement;
}());
exports.RestElement = RestElement;
var ReturnStatement = (function () {
function ReturnStatement(argument) {
this.type = syntax_1.Syntax.ReturnStatement;
this.argument = argument;
}
return ReturnStatement;
}());
exports.ReturnStatement = ReturnStatement;
var Script = (function () {
function Script(body) {
this.type = syntax_1.Syntax.Program;
this.body = body;
this.sourceType = 'script';
}
return Script;
}());
exports.Script = Script;
var SequenceExpression = (function () {
function SequenceExpression(expressions) {
this.type = syntax_1.Syntax.SequenceExpression;
this.expressions = expressions;
}
return SequenceExpression;
}());
exports.SequenceExpression = SequenceExpression;
var SpreadElement = (function () {
function SpreadElement(argument) {
this.type = syntax_1.Syntax.SpreadElement;
this.argument = argument;
}
return SpreadElement;
}());
exports.SpreadElement = SpreadElement;
var StaticMemberExpression = (function () {
function StaticMemberExpression(object, property) {
this.type = syntax_1.Syntax.MemberExpression;
this.computed = false;
this.object = object;
this.property = property;
}
return StaticMemberExpression;
}());
exports.StaticMemberExpression = StaticMemberExpression;
var Super = (function () {
function Super() {
this.type = syntax_1.Syntax.Super;
}
return Super;
}());
exports.Super = Super;
var SwitchCase = (function () {
function SwitchCase(test, consequent) {
this.type = syntax_1.Syntax.SwitchCase;
this.test = test;
this.consequent = consequent;
}
return SwitchCase;
}());
exports.SwitchCase = SwitchCase;
var SwitchStatement = (function () {
function SwitchStatement(discriminant, cases) {
this.type = syntax_1.Syntax.SwitchStatement;
this.discriminant = discriminant;
this.cases = cases;
}
return SwitchStatement;
}());
exports.SwitchStatement = SwitchStatement;
var TaggedTemplateExpression = (function () {
function TaggedTemplateExpression(tag, quasi) {
this.type = syntax_1.Syntax.TaggedTemplateExpression;
this.tag = tag;
this.quasi = quasi;
}
return TaggedTemplateExpression;
}());
exports.TaggedTemplateExpression = TaggedTemplateExpression;
var TemplateElement = (function () {
function TemplateElement(value, tail) {
this.type = syntax_1.Syntax.TemplateElement;
this.value = value;
this.tail = tail;
}
return TemplateElement;
}());
exports.TemplateElement = TemplateElement;
var TemplateLiteral = (function () {
function TemplateLiteral(quasis, expressions) {
this.type = syntax_1.Syntax.TemplateLiteral;
this.quasis = quasis;
this.expressions = expressions;
}
return TemplateLiteral;
}());
exports.TemplateLiteral = TemplateLiteral;
var ThisExpression = (function () {
function ThisExpression() {
this.type = syntax_1.Syntax.ThisExpression;
}
return ThisExpression;
}());
exports.ThisExpression = ThisExpression;
var ThrowStatement = (function () {
function ThrowStatement(argument) {
this.type = syntax_1.Syntax.ThrowStatement;
this.argument = argument;
}
return ThrowStatement;
}());
exports.ThrowStatement = ThrowStatement;
var TryStatement = (function () {
function TryStatement(block, handler, finalizer) {
this.type = syntax_1.Syntax.TryStatement;
this.block = block;
this.handler = handler;
this.finalizer = finalizer;
}
return TryStatement;
}());
exports.TryStatement = TryStatement;
var UnaryExpression = (function () {
function UnaryExpression(operator, argument) {
this.type = syntax_1.Syntax.UnaryExpression;
this.operator = operator;
this.argument = argument;
this.prefix = true;
}
return UnaryExpression;
}());
exports.UnaryExpression = UnaryExpression;
var UpdateExpression = (function () {
function UpdateExpression(operator, argument, prefix) {
this.type = syntax_1.Syntax.UpdateExpression;
this.operator = operator;
this.argument = argument;
this.prefix = prefix;
}
return UpdateExpression;
}());
exports.UpdateExpression = UpdateExpression;
var VariableDeclaration = (function () {
function VariableDeclaration(declarations, kind) {
this.type = syntax_1.Syntax.VariableDeclaration;
this.declarations = declarations;
this.kind = kind;
}
return VariableDeclaration;
}());
exports.VariableDeclaration = VariableDeclaration;
var VariableDeclarator = (function () {
function VariableDeclarator(id, init) {
this.type = syntax_1.Syntax.VariableDeclarator;
this.id = id;
this.init = init;
}
return VariableDeclarator;
}());
exports.VariableDeclarator = VariableDeclarator;
var WhileStatement = (function () {
function WhileStatement(test, body) {
this.type = syntax_1.Syntax.WhileStatement;
this.test = test;
this.body = body;
}
return WhileStatement;
}());
exports.WhileStatement = WhileStatement;
var WithStatement = (function () {
function WithStatement(object, body) {
this.type = syntax_1.Syntax.WithStatement;
this.object = object;
this.body = body;
}
return WithStatement;
}());
exports.WithStatement = WithStatement;
var YieldExpression = (function () {
function YieldExpression(argument, delegate) {
this.type = syntax_1.Syntax.YieldExpression;
this.argument = argument;
this.delegate = delegate;
}
return YieldExpression;
}());
exports.YieldExpression = YieldExpression;
/***/ },
/* 8 */
/***/ function(module, exports, __nested_webpack_require_80491__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var assert_1 = __nested_webpack_require_80491__(9);
var error_handler_1 = __nested_webpack_require_80491__(10);
var messages_1 = __nested_webpack_require_80491__(11);
var Node = __nested_webpack_require_80491__(7);
var scanner_1 = __nested_webpack_require_80491__(12);
var syntax_1 = __nested_webpack_require_80491__(2);
var token_1 = __nested_webpack_require_80491__(13);
var ArrowParameterPlaceHolder = 'ArrowParameterPlaceHolder';
var Parser = (function () {
function Parser(code, options, delegate) {
if (options === void 0) { options = {}; }
this.config = {
range: (typeof options.range === 'boolean') && options.range,
loc: (typeof options.loc === 'boolean') && options.loc,
source: null,
tokens: (typeof options.tokens === 'boolean') && options.tokens,
comment: (typeof options.comment === 'boolean') && options.comment,
tolerant: (typeof options.tolerant === 'boolean') && options.tolerant
};
if (this.config.loc && options.source && options.source !== null) {
this.config.source = String(options.source);
}
this.delegate = delegate;
this.errorHandler = new error_handler_1.ErrorHandler();
this.errorHandler.tolerant = this.config.tolerant;
this.scanner = new scanner_1.Scanner(code, this.errorHandler);
this.scanner.trackComment = this.config.comment;
this.operatorPrecedence = {
')': 0,
';': 0,
',': 0,
'=': 0,
']': 0,
'||': 1,
'&&': 2,
'|': 3,
'^': 4,
'&': 5,
'==': 6,
'!=': 6,
'===': 6,
'!==': 6,
'<': 7,
'>': 7,
'<=': 7,
'>=': 7,
'<<': 8,
'>>': 8,
'>>>': 8,
'+': 9,
'-': 9,
'*': 11,
'/': 11,
'%': 11
};
this.lookahead = {
type: 2 /* EOF */,
value: '',
lineNumber: this.scanner.lineNumber,
lineStart: 0,
start: 0,
end: 0
};
this.hasLineTerminator = false;
this.context = {
isModule: false,
await: false,
allowIn: true,
allowStrictDirective: true,
allowYield: true,
firstCoverInitializedNameError: null,
isAssignmentTarget: false,
isBindingElement: false,
inFunctionBody: false,
inIteration: false,
inSwitch: false,
labelSet: {},
strict: false
};
this.tokens = [];
this.startMarker = {
index: 0,
line: this.scanner.lineNumber,
column: 0
};
this.lastMarker = {
index: 0,
line: this.scanner.lineNumber,
column: 0
};
this.nextToken();
this.lastMarker = {
index: this.scanner.index,
line: this.scanner.lineNumber,
column: this.scanner.index - this.scanner.lineStart
};
}
Parser.prototype.throwError = function (messageFormat) {
var values = [];
for (var _i = 1; _i < arguments.length; _i++) {
values[_i - 1] = arguments[_i];
}
var args = Array.prototype.slice.call(arguments, 1);
var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) {
assert_1.assert(idx < args.length, 'Message reference must be in range');
return args[idx];
});
var index = this.lastMarker.index;
var line = this.lastMarker.line;
var column = this.lastMarker.column + 1;
throw this.errorHandler.createError(index, line, column, msg);
};
Parser.prototype.tolerateError = function (messageFormat) {
var values = [];
for (var _i = 1; _i < arguments.length; _i++) {
values[_i - 1] = arguments[_i];
}
var args = Array.prototype.slice.call(arguments, 1);
var msg = messageFormat.replace(/%(\d)/g, function (whole, idx) {
assert_1.assert(idx < args.length, 'Message reference must be in range');
return args[idx];
});
var index = this.lastMarker.index;
var line = this.scanner.lineNumber;
var column = this.lastMarker.column + 1;
this.errorHandler.tolerateError(index, line, column, msg);
};
// Throw an exception because of the token.
Parser.prototype.unexpectedTokenError = function (token, message) {
var msg = message || messages_1.Messages.UnexpectedToken;
var value;
if (token) {
if (!message) {
msg = (token.type === 2 /* EOF */) ? messages_1.Messages.UnexpectedEOS :
(token.type === 3 /* Identifier */) ? messages_1.Messages.UnexpectedIdentifier :
(token.type === 6 /* NumericLiteral */) ? messages_1.Messages.UnexpectedNumber :
(token.type === 8 /* StringLiteral */) ? messages_1.Messages.UnexpectedString :
(token.type === 10 /* Template */) ? messages_1.Messages.UnexpectedTemplate :
messages_1.Messages.UnexpectedToken;
if (token.type === 4 /* Keyword */) {
if (this.scanner.isFutureReservedWord(token.value)) {
msg = messages_1.Messages.UnexpectedReserved;
}
else if (this.context.strict && this.scanner.isStrictModeReservedWord(token.value)) {
msg = messages_1.Messages.StrictReservedWord;
}
}
}
value = token.value;
}
else {
value = 'ILLEGAL';
}
msg = msg.replace('%0', value);
if (token && typeof token.lineNumber === 'number') {
var index = token.start;
var line = token.lineNumber;
var lastMarkerLineStart = this.lastMarker.index - this.lastMarker.column;
var column = token.start - lastMarkerLineStart + 1;
return this.errorHandler.createError(index, line, column, msg);
}
else {
var index = this.lastMarker.index;
var line = this.lastMarker.line;
var column = this.lastMarker.column + 1;
return this.errorHandler.createError(index, line, column, msg);
}
};
Parser.prototype.throwUnexpectedToken = function (token, message) {
throw this.unexpectedTokenError(token, message);
};
Parser.prototype.tolerateUnexpectedToken = function (token, message) {
this.errorHandler.tolerate(this.unexpectedTokenError(token, message));
};
Parser.prototype.collectComments = function () {
if (!this.config.comment) {
this.scanner.scanComments();
}
else {
var comments = this.scanner.scanComments();
if (comments.length > 0 && this.delegate) {
for (var i = 0; i < comments.length; ++i) {
var e = comments[i];
var node = void 0;
node = {
type: e.multiLine ? 'BlockComment' : 'LineComment',
value: this.scanner.source.slice(e.slice[0], e.slice[1])
};
if (this.config.range) {
node.range = e.range;
}
if (this.config.loc) {
node.loc = e.loc;
}
var metadata = {
start: {
line: e.loc.start.line,
column: e.loc.start.column,
offset: e.range[0]
},
end: {
line: e.loc.end.line,
column: e.loc.end.column,
offset: e.range[1]
}
};
this.delegate(node, metadata);
}
}
}
};
// From internal representation to an external structure
Parser.prototype.getTokenRaw = function (token) {
return this.scanner.source.slice(token.start, token.end);
};
Parser.prototype.convertToken = function (token) {
var t = {
type: token_1.TokenName[token.type],
value: this.getTokenRaw(token)
};
if (this.config.range) {
t.range = [token.start, token.end];
}
if (this.config.loc) {
t.loc = {
start: {
line: this.startMarker.line,
column: this.startMarker.column
},
end: {
line: this.scanner.lineNumber,
column: this.scanner.index - this.scanner.lineStart
}
};
}
if (token.type === 9 /* RegularExpression */) {
var pattern = token.pattern;
var flags = token.flags;
t.regex = { pattern: pattern, flags: flags };
}
return t;
};
Parser.prototype.nextToken = function () {
var token = this.lookahead;
this.lastMarker.index = this.scanner.index;
this.lastMarker.line = this.scanner.lineNumber;
this.lastMarker.column = this.scanner.index - this.scanner.lineStart;
this.collectComments();
if (this.scanner.index !== this.startMarker.index) {
this.startMarker.index = this.scanner.index;
this.startMarker.line = this.scanner.lineNumber;
this.startMarker.column = this.scanner.index - this.scanner.lineStart;
}
var next = this.scanner.lex();
this.hasLineTerminator = (token.lineNumber !== next.lineNumber);
if (next && this.context.strict && next.type === 3 /* Identifier */) {
if (this.scanner.isStrictModeReservedWord(next.value)) {
next.type = 4 /* Keyword */;
}
}
this.lookahead = next;
if (this.config.tokens && next.type !== 2 /* EOF */) {
this.tokens.push(this.convertToken(next));
}
return token;
};
Parser.prototype.nextRegexToken = function () {
this.collectComments();
var token = this.scanner.scanRegExp();
if (this.config.tokens) {
// Pop the previous token, '/' or '/='
// This is added from the lookahead token.
this.tokens.pop();
this.tokens.push(this.convertToken(token));
}
// Prime the next lookahead.
this.lookahead = token;
this.nextToken();
return token;
};
Parser.prototype.createNode = function () {
return {
index: this.startMarker.index,
line: this.startMarker.line,
column: this.startMarker.column
};
};
Parser.prototype.startNode = function (token, lastLineStart) {
if (lastLineStart === void 0) { lastLineStart = 0; }
var column = token.start - token.lineStart;
var line = token.lineNumber;
if (column < 0) {
column += lastLineStart;
line--;
}
return {
index: token.start,
line: line,
column: column
};
};
Parser.prototype.finalize = function (marker, node) {
if (this.config.range) {
node.range = [marker.index, this.lastMarker.index];
}
if (this.config.loc) {
node.loc = {
start: {
line: marker.line,
column: marker.column,
},
end: {
line: this.lastMarker.line,
column: this.lastMarker.column
}
};
if (this.config.source) {
node.loc.source = this.config.source;
}
}
if (this.delegate) {
var metadata = {
start: {
line: marker.line,
column: marker.column,
offset: marker.index
},
end: {
line: this.lastMarker.line,
column: this.lastMarker.column,
offset: this.lastMarker.index
}
};
this.delegate(node, metadata);
}
return node;
};
// Expect the next token to match the specified punctuator.
// If not, an exception will be thrown.
Parser.prototype.expect = function (value) {
var token = this.nextToken();
if (token.type !== 7 /* Punctuator */ || token.value !== value) {
this.throwUnexpectedToken(token);
}
};
// Quietly expect a comma when in tolerant mode, otherwise delegates to expect().
Parser.prototype.expectCommaSeparator = function () {
if (this.config.tolerant) {
var token = this.lookahead;
if (token.type === 7 /* Punctuator */ && token.value === ',') {
this.nextToken();
}
else if (token.type === 7 /* Punctuator */ && token.value === ';') {
this.nextToken();
this.tolerateUnexpectedToken(token);
}
else {
this.tolerateUnexpectedToken(token, messages_1.Messages.UnexpectedToken);
}
}
else {
this.expect(',');
}
};
// Expect the next token to match the specified keyword.
// If not, an exception will be thrown.
Parser.prototype.expectKeyword = function (keyword) {
var token = this.nextToken();
if (token.type !== 4 /* Keyword */ || token.value !== keyword) {
this.throwUnexpectedToken(token);
}
};
// Return true if the next token matches the specified punctuator.
Parser.prototype.match = function (value) {
return this.lookahead.type === 7 /* Punctuator */ && this.lookahead.value === value;
};
// Return true if the next token matches the specified keyword
Parser.prototype.matchKeyword = function (keyword) {
return this.lookahead.type === 4 /* Keyword */ && this.lookahead.value === keyword;
};
// Return true if the next token matches the specified contextual keyword
// (where an identifier is sometimes a keyword depending on the context)
Parser.prototype.matchContextualKeyword = function (keyword) {
return this.lookahead.type === 3 /* Identifier */ && this.lookahead.value === keyword;
};
// Return true if the next token is an assignment operator
Parser.prototype.matchAssign = function () {
if (this.lookahead.type !== 7 /* Punctuator */) {
return false;
}
var op = this.lookahead.value;
return op === '=' ||
op === '*=' ||
op === '**=' ||
op === '/=' ||
op === '%=' ||
op === '+=' ||
op === '-=' ||
op === '<<=' ||
op === '>>=' ||
op === '>>>=' ||
op === '&=' ||
op === '^=' ||
op === '|=';
};
// Cover grammar support.
//
// When an assignment expression position starts with an left parenthesis, the determination of the type
// of the syntax is to be deferred arbitrarily long until the end of the parentheses pair (plus a lookahead)
// or the first comma. This situation also defers the determination of all the expressions nested in the pair.
//
// There are three productions that can be parsed in a parentheses pair that needs to be determined
// after the outermost pair is closed. They are:
//
// 1. AssignmentExpression
// 2. BindingElements
// 3. AssignmentTargets
//
// In order to avoid exponential backtracking, we use two flags to denote if the production can be
// binding element or assignment target.
//
// The three productions have the relationship:
//
// BindingElements ⊆ AssignmentTargets ⊆ AssignmentExpression
//
// with a single exception that CoverInitializedName when used directly in an Expression, generates
// an early error. Therefore, we need the third state, firstCoverInitializedNameError, to track the
// first usage of CoverInitializedName and report it when we reached the end of the parentheses pair.
//
// isolateCoverGrammar function runs the given parser function with a new cover grammar context, and it does not
// effect the current flags. This means the production the parser parses is only used as an expression. Therefore
// the CoverInitializedName check is conducted.
//
// inheritCoverGrammar function runs the given parse function with a new cover grammar context, and it propagates
// the flags outside of the parser. This means the production the parser parses is used as a part of a potential
// pattern. The CoverInitializedName check is deferred.
Parser.prototype.isolateCoverGrammar = function (parseFunction) {
var previousIsBindingElement = this.context.isBindingElement;
var previousIsAssignmentTarget = this.context.isAssignmentTarget;
var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError;
this.context.isBindingElement = true;
this.context.isAssignmentTarget = true;
this.context.firstCoverInitializedNameError = null;
var result = parseFunction.call(this);
if (this.context.firstCoverInitializedNameError !== null) {
this.throwUnexpectedToken(this.context.firstCoverInitializedNameError);
}
this.context.isBindingElement = previousIsBindingElement;
this.context.isAssignmentTarget = previousIsAssignmentTarget;
this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError;
return result;
};
Parser.prototype.inheritCoverGrammar = function (parseFunction) {
var previousIsBindingElement = this.context.isBindingElement;
var previousIsAssignmentTarget = this.context.isAssignmentTarget;
var previousFirstCoverInitializedNameError = this.context.firstCoverInitializedNameError;
this.context.isBindingElement = true;
this.context.isAssignmentTarget = true;
this.context.firstCoverInitializedNameError = null;
var result = parseFunction.call(this);
this.context.isBindingElement = this.context.isBindingElement && previousIsBindingElement;
this.context.isAssignmentTarget = this.context.isAssignmentTarget && previousIsAssignmentTarget;
this.context.firstCoverInitializedNameError = previousFirstCoverInitializedNameError || this.context.firstCoverInitializedNameError;
return result;
};
Parser.prototype.consumeSemicolon = function () {
if (this.match(';')) {
this.nextToken();
}
else if (!this.hasLineTerminator) {
if (this.lookahead.type !== 2 /* EOF */ && !this.match('}')) {
this.throwUnexpectedToken(this.lookahead);
}
this.lastMarker.index = this.startMarker.index;
this.lastMarker.line = this.startMarker.line;
this.lastMarker.column = this.startMarker.column;
}
};
// https://tc39.github.io/ecma262/#sec-primary-expression
Parser.prototype.parsePrimaryExpression = function () {
var node = this.createNode();
var expr;
var token, raw;
switch (this.lookahead.type) {
case 3 /* Identifier */:
if ((this.context.isModule || this.context.await) && this.lookahead.value === 'await') {
this.tolerateUnexpectedToken(this.lookahead);
}
expr = this.matchAsyncFunction() ? this.parseFunctionExpression() : this.finalize(node, new Node.Identifier(this.nextToken().value));
break;
case 6 /* NumericLiteral */:
case 8 /* StringLiteral */:
if (this.context.strict && this.lookahead.octal) {
this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.StrictOctalLiteral);
}
this.context.isAssignmentTarget = false;
this.context.isBindingElement = false;
token = this.nextToken();
raw = this.getTokenRaw(token);
expr = this.finalize(node, new Node.Literal(token.value, raw));
break;
case 1 /* BooleanLiteral */:
this.context.isAssignmentTarget = false;
this.context.isBindingElement = false;
token = this.nextToken();
raw = this.getTokenRaw(token);
expr = this.finalize(node, new Node.Literal(token.value === 'true', raw));
break;
case 5 /* NullLiteral */:
this.context.isAssignmentTarget = false;
this.context.isBindingElement = false;
token = this.nextToken();
raw = this.getTokenRaw(token);
expr = this.finalize(node, new Node.Literal(null, raw));
break;
case 10 /* Template */:
expr = this.parseTemplateLiteral();
break;
case 7 /* Punctuator */:
switch (this.lookahead.value) {
case '(':
this.context.isBindingElement = false;
expr = this.inheritCoverGrammar(this.parseGroupExpression);
break;
case '[':
expr = this.inheritCoverGrammar(this.parseArrayInitializer);
break;
case '{':
expr = this.inheritCoverGrammar(this.parseObjectInitializer);
break;
case '/':
case '/=':
this.context.isAssignmentTarget = false;
this.context.isBindingElement = false;
this.scanner.index = this.startMarker.index;
token = this.nextRegexToken();
raw = this.getTokenRaw(token);
expr = this.finalize(node, new Node.RegexLiteral(token.regex, raw, token.pattern, token.flags));
break;
default:
expr = this.throwUnexpectedToken(this.nextToken());
}
break;
case 4 /* Keyword */:
if (!this.context.strict && this.context.allowYield && this.matchKeyword('yield')) {
expr = this.parseIdentifierName();
}
else if (!this.context.strict && this.matchKeyword('let')) {
expr = this.finalize(node, new Node.Identifier(this.nextToken().value));
}
else {
this.context.isAssignmentTarget = false;
this.context.isBindingElement = false;
if (this.matchKeyword('function')) {
expr = this.parseFunctionExpression();
}
else if (this.matchKeyword('this')) {
this.nextToken();
expr = this.finalize(node, new Node.ThisExpression());
}
else if (this.matchKeyword('class')) {
expr = this.parseClassExpression();
}
else {
expr = this.throwUnexpectedToken(this.nextToken());
}
}
break;
default:
expr = this.throwUnexpectedToken(this.nextToken());
}
return expr;
};
// https://tc39.github.io/ecma262/#sec-array-initializer
Parser.prototype.parseSpreadElement = function () {
var node = this.createNode();
this.expect('...');
var arg = this.inheritCoverGrammar(this.parseAssignmentExpression);
return this.finalize(node, new Node.SpreadElement(arg));
};
Parser.prototype.parseArrayInitializer = function () {
var node = this.createNode();
var elements = [];
this.expect('[');
while (!this.match(']')) {
if (this.match(',')) {
this.nextToken();
elements.push(null);
}
else if (this.match('...')) {
var element = this.parseSpreadElement();
if (!this.match(']')) {
this.context.isAssignmentTarget = false;
this.context.isBindingElement = false;
this.expect(',');
}
elements.push(element);
}
else {
elements.push(this.inheritCoverGrammar(this.parseAssignmentExpression));
if (!this.match(']')) {
this.expect(',');
}
}
}
this.expect(']');
return this.finalize(node, new Node.ArrayExpression(elements));
};
// https://tc39.github.io/ecma262/#sec-object-initializer
Parser.prototype.parsePropertyMethod = function (params) {
this.context.isAssignmentTarget = false;
this.context.isBindingElement = false;
var previousStrict = this.context.strict;
var previousAllowStrictDirective = this.context.allowStrictDirective;
this.context.allowStrictDirective = params.simple;
var body = this.isolateCoverGrammar(this.parseFunctionSourceElements);
if (this.context.strict && params.firstRestricted) {
this.tolerateUnexpectedToken(params.firstRestricted, params.message);
}
if (this.context.strict && params.stricted) {
this.tolerateUnexpectedToken(params.stricted, params.message);
}
this.context.strict = previousStrict;
this.context.allowStrictDirective = previousAllowStrictDirective;
return body;
};
Parser.prototype.parsePropertyMethodFunction = function () {
var isGenerator = false;
var node = this.createNode();
var previousAllowYield = this.context.allowYield;
this.context.allowYield = true;
var params = this.parseFormalParameters();
var method = this.parsePropertyMethod(params);
this.context.allowYield = previousAllowYield;
return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator));
};
Parser.prototype.parsePropertyMethodAsyncFunction = function () {
var node = this.createNode();
var previousAllowYield = this.context.allowYield;
var previousAwait = this.context.await;
this.context.allowYield = false;
this.context.await = true;
var params = this.parseFormalParameters();
var method = this.parsePropertyMethod(params);
this.context.allowYield = previousAllowYield;
this.context.await = previousAwait;
return this.finalize(node, new Node.AsyncFunctionExpression(null, params.params, method));
};
Parser.prototype.parseObjectPropertyKey = function () {
var node = this.createNode();
var token = this.nextToken();
var key;
switch (token.type) {
case 8 /* StringLiteral */:
case 6 /* NumericLiteral */:
if (this.context.strict && token.octal) {
this.tolerateUnexpectedToken(token, messages_1.Messages.StrictOctalLiteral);
}
var raw = this.getTokenRaw(token);
key = this.finalize(node, new Node.Literal(token.value, raw));
break;
case 3 /* Identifier */:
case 1 /* BooleanLiteral */:
case 5 /* NullLiteral */:
case 4 /* Keyword */:
key = this.finalize(node, new Node.Identifier(token.value));
break;
case 7 /* Punctuator */:
if (token.value === '[') {
key = this.isolateCoverGrammar(this.parseAssignmentExpression);
this.expect(']');
}
else {
key = this.throwUnexpectedToken(token);
}
break;
default:
key = this.throwUnexpectedToken(token);
}
return key;
};
Parser.prototype.isPropertyKey = function (key, value) {
return (key.type === syntax_1.Syntax.Identifier && key.name === value) ||
(key.type === syntax_1.Syntax.Literal && key.value === value);
};
Parser.prototype.parseObjectProperty = function (hasProto) {
var node = this.createNode();
var token = this.lookahead;
var kind;
var key = null;
var value = null;
var computed = false;
var method = false;
var shorthand = false;
var isAsync = false;
if (token.type === 3 /* Identifier */) {
var id = token.value;
this.nextToken();
computed = this.match('[');
isAsync = !this.hasLineTerminator && (id === 'async') &&
!this.match(':') && !this.match('(') && !this.match('*') && !this.match(',');
key = isAsync ? this.parseObjectPropertyKey() : this.finalize(node, new Node.Identifier(id));
}
else if (this.match('*')) {
this.nextToken();
}
else {
computed = this.match('[');
key = this.parseObjectPropertyKey();
}
var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead);
if (token.type === 3 /* Identifier */ && !isAsync && token.value === 'get' && lookaheadPropertyKey) {
kind = 'get';
computed = this.match('[');
key = this.parseObjectPropertyKey();
this.context.allowYield = false;
value = this.parseGetterMethod();
}
else if (token.type === 3 /* Identifier */ && !isAsync && token.value === 'set' && lookaheadPropertyKey) {
kind = 'set';
computed = this.match('[');
key = this.parseObjectPropertyKey();
value = this.parseSetterMethod();
}
else if (token.type === 7 /* Punctuator */ && token.value === '*' && lookaheadPropertyKey) {
kind = 'init';
computed = this.match('[');
key = this.parseObjectPropertyKey();
value = this.parseGeneratorMethod();
method = true;
}
else {
if (!key) {
this.throwUnexpectedToken(this.lookahead);
}
kind = 'init';
if (this.match(':') && !isAsync) {
if (!computed && this.isPropertyKey(key, '__proto__')) {
if (hasProto.value) {
this.tolerateError(messages_1.Messages.DuplicateProtoProperty);
}
hasProto.value = true;
}
this.nextToken();
value = this.inheritCoverGrammar(this.parseAssignmentExpression);
}
else if (this.match('(')) {
value = isAsync ? this.parsePropertyMethodAsyncFunction() : this.parsePropertyMethodFunction();
method = true;
}
else if (token.type === 3 /* Identifier */) {
var id = this.finalize(node, new Node.Identifier(token.value));
if (this.match('=')) {
this.context.firstCoverInitializedNameError = this.lookahead;
this.nextToken();
shorthand = true;
var init = this.isolateCoverGrammar(this.parseAssignmentExpression);
value = this.finalize(node, new Node.AssignmentPattern(id, init));
}
else {
shorthand = true;
value = id;
}
}
else {
this.throwUnexpectedToken(this.nextToken());
}
}
return this.finalize(node, new Node.Property(kind, key, computed, value, method, shorthand));
};
Parser.prototype.parseObjectInitializer = function () {
var node = this.createNode();
this.expect('{');
var properties = [];
var hasProto = { value: false };
while (!this.match('}')) {
properties.push(this.parseObjectProperty(hasProto));
if (!this.match('}')) {
this.expectCommaSeparator();
}
}
this.expect('}');
return this.finalize(node, new Node.ObjectExpression(properties));
};
// https://tc39.github.io/ecma262/#sec-template-literals
Parser.prototype.parseTemplateHead = function () {
assert_1.assert(this.lookahead.head, 'Template literal must start with a template head');
var node = this.createNode();
var token = this.nextToken();
var raw = token.value;
var cooked = token.cooked;
return this.finalize(node, new Node.TemplateElement({ raw: raw, cooked: cooked }, token.tail));
};
Parser.prototype.parseTemplateElement = function () {
if (this.lookahead.type !== 10 /* Template */) {
this.throwUnexpectedToken();
}
var node = this.createNode();
var token = this.nextToken();
var raw = token.value;
var cooked = token.cooked;
return this.finalize(node, new Node.TemplateElement({ raw: raw, cooked: cooked }, token.tail));
};
Parser.prototype.parseTemplateLiteral = function () {
var node = this.createNode();
var expressions = [];
var quasis = [];
var quasi = this.parseTemplateHead();
quasis.push(quasi);
while (!quasi.tail) {
expressions.push(this.parseExpression());
quasi = this.parseTemplateElement();
quasis.push(quasi);
}
return this.finalize(node, new Node.TemplateLiteral(quasis, expressions));
};
// https://tc39.github.io/ecma262/#sec-grouping-operator
Parser.prototype.reinterpretExpressionAsPattern = function (expr) {
switch (expr.type) {
case syntax_1.Syntax.Identifier:
case syntax_1.Syntax.MemberExpression:
case syntax_1.Syntax.RestElement:
case syntax_1.Syntax.AssignmentPattern:
break;
case syntax_1.Syntax.SpreadElement:
expr.type = syntax_1.Syntax.RestElement;
this.reinterpretExpressionAsPattern(expr.argument);
break;
case syntax_1.Syntax.ArrayExpression:
expr.type = syntax_1.Syntax.ArrayPattern;
for (var i = 0; i < expr.elements.length; i++) {
if (expr.elements[i] !== null) {
this.reinterpretExpressionAsPattern(expr.elements[i]);
}
}
break;
case syntax_1.Syntax.ObjectExpression:
expr.type = syntax_1.Syntax.ObjectPattern;
for (var i = 0; i < expr.properties.length; i++) {
this.reinterpretExpressionAsPattern(expr.properties[i].value);
}
break;
case syntax_1.Syntax.AssignmentExpression:
expr.type = syntax_1.Syntax.AssignmentPattern;
delete expr.operator;
this.reinterpretExpressionAsPattern(expr.left);
break;
default:
// Allow other node type for tolerant parsing.
break;
}
};
Parser.prototype.parseGroupExpression = function () {
var expr;
this.expect('(');
if (this.match(')')) {
this.nextToken();
if (!this.match('=>')) {
this.expect('=>');
}
expr = {
type: ArrowParameterPlaceHolder,
params: [],
async: false
};
}
else {
var startToken = this.lookahead;
var params = [];
if (this.match('...')) {
expr = this.parseRestElement(params);
this.expect(')');
if (!this.match('=>')) {
this.expect('=>');
}
expr = {
type: ArrowParameterPlaceHolder,
params: [expr],
async: false
};
}
else {
var arrow = false;
this.context.isBindingElement = true;
expr = this.inheritCoverGrammar(this.parseAssignmentExpression);
if (this.match(',')) {
var expressions = [];
this.context.isAssignmentTarget = false;
expressions.push(expr);
while (this.lookahead.type !== 2 /* EOF */) {
if (!this.match(',')) {
break;
}
this.nextToken();
if (this.match(')')) {
this.nextToken();
for (var i = 0; i < expressions.length; i++) {
this.reinterpretExpressionAsPattern(expressions[i]);
}
arrow = true;
expr = {
type: ArrowParameterPlaceHolder,
params: expressions,
async: false
};
}
else if (this.match('...')) {
if (!this.context.isBindingElement) {
this.throwUnexpectedToken(this.lookahead);
}
expressions.push(this.parseRestElement(params));
this.expect(')');
if (!this.match('=>')) {
this.expect('=>');
}
this.context.isBindingElement = false;
for (var i = 0; i < expressions.length; i++) {
this.reinterpretExpressionAsPattern(expressions[i]);
}
arrow = true;
expr = {
type: ArrowParameterPlaceHolder,
params: expressions,
async: false
};
}
else {
expressions.push(this.inheritCoverGrammar(this.parseAssignmentExpression));
}
if (arrow) {
break;
}
}
if (!arrow) {
expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions));
}
}
if (!arrow) {
this.expect(')');
if (this.match('=>')) {
if (expr.type === syntax_1.Syntax.Identifier && expr.name === 'yield') {
arrow = true;
expr = {
type: ArrowParameterPlaceHolder,
params: [expr],
async: false
};
}
if (!arrow) {
if (!this.context.isBindingElement) {
this.throwUnexpectedToken(this.lookahead);
}
if (expr.type === syntax_1.Syntax.SequenceExpression) {
for (var i = 0; i < expr.expressions.length; i++) {
this.reinterpretExpressionAsPattern(expr.expressions[i]);
}
}
else {
this.reinterpretExpressionAsPattern(expr);
}
var parameters = (expr.type === syntax_1.Syntax.SequenceExpression ? expr.expressions : [expr]);
expr = {
type: ArrowParameterPlaceHolder,
params: parameters,
async: false
};
}
}
this.context.isBindingElement = false;
}
}
}
return expr;
};
// https://tc39.github.io/ecma262/#sec-left-hand-side-expressions
Parser.prototype.parseArguments = function () {
this.expect('(');
var args = [];
if (!this.match(')')) {
while (true) {
var expr = this.match('...') ? this.parseSpreadElement() :
this.isolateCoverGrammar(this.parseAssignmentExpression);
args.push(expr);
if (this.match(')')) {
break;
}
this.expectCommaSeparator();
if (this.match(')')) {
break;
}
}
}
this.expect(')');
return args;
};
Parser.prototype.isIdentifierName = function (token) {
return token.type === 3 /* Identifier */ ||
token.type === 4 /* Keyword */ ||
token.type === 1 /* BooleanLiteral */ ||
token.type === 5 /* NullLiteral */;
};
Parser.prototype.parseIdentifierName = function () {
var node = this.createNode();
var token = this.nextToken();
if (!this.isIdentifierName(token)) {
this.throwUnexpectedToken(token);
}
return this.finalize(node, new Node.Identifier(token.value));
};
Parser.prototype.parseNewExpression = function () {
var node = this.createNode();
var id = this.parseIdentifierName();
assert_1.assert(id.name === 'new', 'New expression must start with `new`');
var expr;
if (this.match('.')) {
this.nextToken();
if (this.lookahead.type === 3 /* Identifier */ && this.context.inFunctionBody && this.lookahead.value === 'target') {
var property = this.parseIdentifierName();
expr = new Node.MetaProperty(id, property);
}
else {
this.throwUnexpectedToken(this.lookahead);
}
}
else {
var callee = this.isolateCoverGrammar(this.parseLeftHandSideExpression);
var args = this.match('(') ? this.parseArguments() : [];
expr = new Node.NewExpression(callee, args);
this.context.isAssignmentTarget = false;
this.context.isBindingElement = false;
}
return this.finalize(node, expr);
};
Parser.prototype.parseAsyncArgument = function () {
var arg = this.parseAssignmentExpression();
this.context.firstCoverInitializedNameError = null;
return arg;
};
Parser.prototype.parseAsyncArguments = function () {
this.expect('(');
var args = [];
if (!this.match(')')) {
while (true) {
var expr = this.match('...') ? this.parseSpreadElement() :
this.isolateCoverGrammar(this.parseAsyncArgument);
args.push(expr);
if (this.match(')')) {
break;
}
this.expectCommaSeparator();
if (this.match(')')) {
break;
}
}
}
this.expect(')');
return args;
};
Parser.prototype.parseLeftHandSideExpressionAllowCall = function () {
var startToken = this.lookahead;
var maybeAsync = this.matchContextualKeyword('async');
var previousAllowIn = this.context.allowIn;
this.context.allowIn = true;
var expr;
if (this.matchKeyword('super') && this.context.inFunctionBody) {
expr = this.createNode();
this.nextToken();
expr = this.finalize(expr, new Node.Super());
if (!this.match('(') && !this.match('.') && !this.match('[')) {
this.throwUnexpectedToken(this.lookahead);
}
}
else {
expr = this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression);
}
while (true) {
if (this.match('.')) {
this.context.isBindingElement = false;
this.context.isAssignmentTarget = true;
this.expect('.');
var property = this.parseIdentifierName();
expr = this.finalize(this.startNode(startToken), new Node.StaticMemberExpression(expr, property));
}
else if (this.match('(')) {
var asyncArrow = maybeAsync && (startToken.lineNumber === this.lookahead.lineNumber);
this.context.isBindingElement = false;
this.context.isAssignmentTarget = false;
var args = asyncArrow ? this.parseAsyncArguments() : this.parseArguments();
expr = this.finalize(this.startNode(startToken), new Node.CallExpression(expr, args));
if (asyncArrow && this.match('=>')) {
for (var i = 0; i < args.length; ++i) {
this.reinterpretExpressionAsPattern(args[i]);
}
expr = {
type: ArrowParameterPlaceHolder,
params: args,
async: true
};
}
}
else if (this.match('[')) {
this.context.isBindingElement = false;
this.context.isAssignmentTarget = true;
this.expect('[');
var property = this.isolateCoverGrammar(this.parseExpression);
this.expect(']');
expr = this.finalize(this.startNode(startToken), new Node.ComputedMemberExpression(expr, property));
}
else if (this.lookahead.type === 10 /* Template */ && this.lookahead.head) {
var quasi = this.parseTemplateLiteral();
expr = this.finalize(this.startNode(startToken), new Node.TaggedTemplateExpression(expr, quasi));
}
else {
break;
}
}
this.context.allowIn = previousAllowIn;
return expr;
};
Parser.prototype.parseSuper = function () {
var node = this.createNode();
this.expectKeyword('super');
if (!this.match('[') && !this.match('.')) {
this.throwUnexpectedToken(this.lookahead);
}
return this.finalize(node, new Node.Super());
};
Parser.prototype.parseLeftHandSideExpression = function () {
assert_1.assert(this.context.allowIn, 'callee of new expression always allow in keyword.');
var node = this.startNode(this.lookahead);
var expr = (this.matchKeyword('super') && this.context.inFunctionBody) ? this.parseSuper() :
this.inheritCoverGrammar(this.matchKeyword('new') ? this.parseNewExpression : this.parsePrimaryExpression);
while (true) {
if (this.match('[')) {
this.context.isBindingElement = false;
this.context.isAssignmentTarget = true;
this.expect('[');
var property = this.isolateCoverGrammar(this.parseExpression);
this.expect(']');
expr = this.finalize(node, new Node.ComputedMemberExpression(expr, property));
}
else if (this.match('.')) {
this.context.isBindingElement = false;
this.context.isAssignmentTarget = true;
this.expect('.');
var property = this.parseIdentifierName();
expr = this.finalize(node, new Node.StaticMemberExpression(expr, property));
}
else if (this.lookahead.type === 10 /* Template */ && this.lookahead.head) {
var quasi = this.parseTemplateLiteral();
expr = this.finalize(node, new Node.TaggedTemplateExpression(expr, quasi));
}
else {
break;
}
}
return expr;
};
// https://tc39.github.io/ecma262/#sec-update-expressions
Parser.prototype.parseUpdateExpression = function () {
var expr;
var startToken = this.lookahead;
if (this.match('++') || this.match('--')) {
var node = this.startNode(startToken);
var token = this.nextToken();
expr = this.inheritCoverGrammar(this.parseUnaryExpression);
if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) {
this.tolerateError(messages_1.Messages.StrictLHSPrefix);
}
if (!this.context.isAssignmentTarget) {
this.tolerateError(messages_1.Messages.InvalidLHSInAssignment);
}
var prefix = true;
expr = this.finalize(node, new Node.UpdateExpression(token.value, expr, prefix));
this.context.isAssignmentTarget = false;
this.context.isBindingElement = false;
}
else {
expr = this.inheritCoverGrammar(this.parseLeftHandSideExpressionAllowCall);
if (!this.hasLineTerminator && this.lookahead.type === 7 /* Punctuator */) {
if (this.match('++') || this.match('--')) {
if (this.context.strict && expr.type === syntax_1.Syntax.Identifier && this.scanner.isRestrictedWord(expr.name)) {
this.tolerateError(messages_1.Messages.StrictLHSPostfix);
}
if (!this.context.isAssignmentTarget) {
this.tolerateError(messages_1.Messages.InvalidLHSInAssignment);
}
this.context.isAssignmentTarget = false;
this.context.isBindingElement = false;
var operator = this.nextToken().value;
var prefix = false;
expr = this.finalize(this.startNode(startToken), new Node.UpdateExpression(operator, expr, prefix));
}
}
}
return expr;
};
// https://tc39.github.io/ecma262/#sec-unary-operators
Parser.prototype.parseAwaitExpression = function () {
var node = this.createNode();
this.nextToken();
var argument = this.parseUnaryExpression();
return this.finalize(node, new Node.AwaitExpression(argument));
};
Parser.prototype.parseUnaryExpression = function () {
var expr;
if (this.match('+') || this.match('-') || this.match('~') || this.match('!') ||
this.matchKeyword('delete') || this.matchKeyword('void') || this.matchKeyword('typeof')) {
var node = this.startNode(this.lookahead);
var token = this.nextToken();
expr = this.inheritCoverGrammar(this.parseUnaryExpression);
expr = this.finalize(node, new Node.UnaryExpression(token.value, expr));
if (this.context.strict && expr.operator === 'delete' && expr.argument.type === syntax_1.Syntax.Identifier) {
this.tolerateError(messages_1.Messages.StrictDelete);
}
this.context.isAssignmentTarget = false;
this.context.isBindingElement = false;
}
else if (this.context.await && this.matchContextualKeyword('await')) {
expr = this.parseAwaitExpression();
}
else {
expr = this.parseUpdateExpression();
}
return expr;
};
Parser.prototype.parseExponentiationExpression = function () {
var startToken = this.lookahead;
var expr = this.inheritCoverGrammar(this.parseUnaryExpression);
if (expr.type !== syntax_1.Syntax.UnaryExpression && this.match('**')) {
this.nextToken();
this.context.isAssignmentTarget = false;
this.context.isBindingElement = false;
var left = expr;
var right = this.isolateCoverGrammar(this.parseExponentiationExpression);
expr = this.finalize(this.startNode(startToken), new Node.BinaryExpression('**', left, right));
}
return expr;
};
// https://tc39.github.io/ecma262/#sec-exp-operator
// https://tc39.github.io/ecma262/#sec-multiplicative-operators
// https://tc39.github.io/ecma262/#sec-additive-operators
// https://tc39.github.io/ecma262/#sec-bitwise-shift-operators
// https://tc39.github.io/ecma262/#sec-relational-operators
// https://tc39.github.io/ecma262/#sec-equality-operators
// https://tc39.github.io/ecma262/#sec-binary-bitwise-operators
// https://tc39.github.io/ecma262/#sec-binary-logical-operators
Parser.prototype.binaryPrecedence = function (token) {
var op = token.value;
var precedence;
if (token.type === 7 /* Punctuator */) {
precedence = this.operatorPrecedence[op] || 0;
}
else if (token.type === 4 /* Keyword */) {
precedence = (op === 'instanceof' || (this.context.allowIn && op === 'in')) ? 7 : 0;
}
else {
precedence = 0;
}
return precedence;
};
Parser.prototype.parseBinaryExpression = function () {
var startToken = this.lookahead;
var expr = this.inheritCoverGrammar(this.parseExponentiationExpression);
var token = this.lookahead;
var prec = this.binaryPrecedence(token);
if (prec > 0) {
this.nextToken();
this.context.isAssignmentTarget = false;
this.context.isBindingElement = false;
var markers = [startToken, this.lookahead];
var left = expr;
var right = this.isolateCoverGrammar(this.parseExponentiationExpression);
var stack = [left, token.value, right];
var precedences = [prec];
while (true) {
prec = this.binaryPrecedence(this.lookahead);
if (prec <= 0) {
break;
}
// Reduce: make a binary expression from the three topmost entries.
while ((stack.length > 2) && (prec <= precedences[precedences.length - 1])) {
right = stack.pop();
var operator = stack.pop();
precedences.pop();
left = stack.pop();
markers.pop();
var node = this.startNode(markers[markers.length - 1]);
stack.push(this.finalize(node, new Node.BinaryExpression(operator, left, right)));
}
// Shift.
stack.push(this.nextToken().value);
precedences.push(prec);
markers.push(this.lookahead);
stack.push(this.isolateCoverGrammar(this.parseExponentiationExpression));
}
// Final reduce to clean-up the stack.
var i = stack.length - 1;
expr = stack[i];
var lastMarker = markers.pop();
while (i > 1) {
var marker = markers.pop();
var lastLineStart = lastMarker && lastMarker.lineStart;
var node = this.startNode(marker, lastLineStart);
var operator = stack[i - 1];
expr = this.finalize(node, new Node.BinaryExpression(operator, stack[i - 2], expr));
i -= 2;
lastMarker = marker;
}
}
return expr;
};
// https://tc39.github.io/ecma262/#sec-conditional-operator
Parser.prototype.parseConditionalExpression = function () {
var startToken = this.lookahead;
var expr = this.inheritCoverGrammar(this.parseBinaryExpression);
if (this.match('?')) {
this.nextToken();
var previousAllowIn = this.context.allowIn;
this.context.allowIn = true;
var consequent = this.isolateCoverGrammar(this.parseAssignmentExpression);
this.context.allowIn = previousAllowIn;
this.expect(':');
var alternate = this.isolateCoverGrammar(this.parseAssignmentExpression);
expr = this.finalize(this.startNode(startToken), new Node.ConditionalExpression(expr, consequent, alternate));
this.context.isAssignmentTarget = false;
this.context.isBindingElement = false;
}
return expr;
};
// https://tc39.github.io/ecma262/#sec-assignment-operators
Parser.prototype.checkPatternParam = function (options, param) {
switch (param.type) {
case syntax_1.Syntax.Identifier:
this.validateParam(options, param, param.name);
break;
case syntax_1.Syntax.RestElement:
this.checkPatternParam(options, param.argument);
break;
case syntax_1.Syntax.AssignmentPattern:
this.checkPatternParam(options, param.left);
break;
case syntax_1.Syntax.ArrayPattern:
for (var i = 0; i < param.elements.length; i++) {
if (param.elements[i] !== null) {
this.checkPatternParam(options, param.elements[i]);
}
}
break;
case syntax_1.Syntax.ObjectPattern:
for (var i = 0; i < param.properties.length; i++) {
this.checkPatternParam(options, param.properties[i].value);
}
break;
default:
break;
}
options.simple = options.simple && (param instanceof Node.Identifier);
};
Parser.prototype.reinterpretAsCoverFormalsList = function (expr) {
var params = [expr];
var options;
var asyncArrow = false;
switch (expr.type) {
case syntax_1.Syntax.Identifier:
break;
case ArrowParameterPlaceHolder:
params = expr.params;
asyncArrow = expr.async;
break;
default:
return null;
}
options = {
simple: true,
paramSet: {}
};
for (var i = 0; i < params.length; ++i) {
var param = params[i];
if (param.type === syntax_1.Syntax.AssignmentPattern) {
if (param.right.type === syntax_1.Syntax.YieldExpression) {
if (param.right.argument) {
this.throwUnexpectedToken(this.lookahead);
}
param.right.type = syntax_1.Syntax.Identifier;
param.right.name = 'yield';
delete param.right.argument;
delete param.right.delegate;
}
}
else if (asyncArrow && param.type === syntax_1.Syntax.Identifier && param.name === 'await') {
this.throwUnexpectedToken(this.lookahead);
}
this.checkPatternParam(options, param);
params[i] = param;
}
if (this.context.strict || !this.context.allowYield) {
for (var i = 0; i < params.length; ++i) {
var param = params[i];
if (param.type === syntax_1.Syntax.YieldExpression) {
this.throwUnexpectedToken(this.lookahead);
}
}
}
if (options.message === messages_1.Messages.StrictParamDupe) {
var token = this.context.strict ? options.stricted : options.firstRestricted;
this.throwUnexpectedToken(token, options.message);
}
return {
simple: options.simple,
params: params,
stricted: options.stricted,
firstRestricted: options.firstRestricted,
message: options.message
};
};
Parser.prototype.parseAssignmentExpression = function () {
var expr;
if (!this.context.allowYield && this.matchKeyword('yield')) {
expr = this.parseYieldExpression();
}
else {
var startToken = this.lookahead;
var token = startToken;
expr = this.parseConditionalExpression();
if (token.type === 3 /* Identifier */ && (token.lineNumber === this.lookahead.lineNumber) && token.value === 'async') {
if (this.lookahead.type === 3 /* Identifier */ || this.matchKeyword('yield')) {
var arg = this.parsePrimaryExpression();
this.reinterpretExpressionAsPattern(arg);
expr = {
type: ArrowParameterPlaceHolder,
params: [arg],
async: true
};
}
}
if (expr.type === ArrowParameterPlaceHolder || this.match('=>')) {
// https://tc39.github.io/ecma262/#sec-arrow-function-definitions
this.context.isAssignmentTarget = false;
this.context.isBindingElement = false;
var isAsync = expr.async;
var list = this.reinterpretAsCoverFormalsList(expr);
if (list) {
if (this.hasLineTerminator) {
this.tolerateUnexpectedToken(this.lookahead);
}
this.context.firstCoverInitializedNameError = null;
var previousStrict = this.context.strict;
var previousAllowStrictDirective = this.context.allowStrictDirective;
this.context.allowStrictDirective = list.simple;
var previousAllowYield = this.context.allowYield;
var previousAwait = this.context.await;
this.context.allowYield = true;
this.context.await = isAsync;
var node = this.startNode(startToken);
this.expect('=>');
var body = void 0;
if (this.match('{')) {
var previousAllowIn = this.context.allowIn;
this.context.allowIn = true;
body = this.parseFunctionSourceElements();
this.context.allowIn = previousAllowIn;
}
else {
body = this.isolateCoverGrammar(this.parseAssignmentExpression);
}
var expression = body.type !== syntax_1.Syntax.BlockStatement;
if (this.context.strict && list.firstRestricted) {
this.throwUnexpectedToken(list.firstRestricted, list.message);
}
if (this.context.strict && list.stricted) {
this.tolerateUnexpectedToken(list.stricted, list.message);
}
expr = isAsync ? this.finalize(node, new Node.AsyncArrowFunctionExpression(list.params, body, expression)) :
this.finalize(node, new Node.ArrowFunctionExpression(list.params, body, expression));
this.context.strict = previousStrict;
this.context.allowStrictDirective = previousAllowStrictDirective;
this.context.allowYield = previousAllowYield;
this.context.await = previousAwait;
}
}
else {
if (this.matchAssign()) {
if (!this.context.isAssignmentTarget) {
this.tolerateError(messages_1.Messages.InvalidLHSInAssignment);
}
if (this.context.strict && expr.type === syntax_1.Syntax.Identifier) {
var id = expr;
if (this.scanner.isRestrictedWord(id.name)) {
this.tolerateUnexpectedToken(token, messages_1.Messages.StrictLHSAssignment);
}
if (this.scanner.isStrictModeReservedWord(id.name)) {
this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord);
}
}
if (!this.match('=')) {
this.context.isAssignmentTarget = false;
this.context.isBindingElement = false;
}
else {
this.reinterpretExpressionAsPattern(expr);
}
token = this.nextToken();
var operator = token.value;
var right = this.isolateCoverGrammar(this.parseAssignmentExpression);
expr = this.finalize(this.startNode(startToken), new Node.AssignmentExpression(operator, expr, right));
this.context.firstCoverInitializedNameError = null;
}
}
}
return expr;
};
// https://tc39.github.io/ecma262/#sec-comma-operator
Parser.prototype.parseExpression = function () {
var startToken = this.lookahead;
var expr = this.isolateCoverGrammar(this.parseAssignmentExpression);
if (this.match(',')) {
var expressions = [];
expressions.push(expr);
while (this.lookahead.type !== 2 /* EOF */) {
if (!this.match(',')) {
break;
}
this.nextToken();
expressions.push(this.isolateCoverGrammar(this.parseAssignmentExpression));
}
expr = this.finalize(this.startNode(startToken), new Node.SequenceExpression(expressions));
}
return expr;
};
// https://tc39.github.io/ecma262/#sec-block
Parser.prototype.parseStatementListItem = function () {
var statement;
this.context.isAssignmentTarget = true;
this.context.isBindingElement = true;
if (this.lookahead.type === 4 /* Keyword */) {
switch (this.lookahead.value) {
case 'export':
if (!this.context.isModule) {
this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalExportDeclaration);
}
statement = this.parseExportDeclaration();
break;
case 'import':
if (!this.context.isModule) {
this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.IllegalImportDeclaration);
}
statement = this.parseImportDeclaration();
break;
case 'const':
statement = this.parseLexicalDeclaration({ inFor: false });
break;
case 'function':
statement = this.parseFunctionDeclaration();
break;
case 'class':
statement = this.parseClassDeclaration();
break;
case 'let':
statement = this.isLexicalDeclaration() ? this.parseLexicalDeclaration({ inFor: false }) : this.parseStatement();
break;
default:
statement = this.parseStatement();
break;
}
}
else {
statement = this.parseStatement();
}
return statement;
};
Parser.prototype.parseBlock = function () {
var node = this.createNode();
this.expect('{');
var block = [];
while (true) {
if (this.match('}')) {
break;
}
block.push(this.parseStatementListItem());
}
this.expect('}');
return this.finalize(node, new Node.BlockStatement(block));
};
// https://tc39.github.io/ecma262/#sec-let-and-const-declarations
Parser.prototype.parseLexicalBinding = function (kind, options) {
var node = this.createNode();
var params = [];
var id = this.parsePattern(params, kind);
if (this.context.strict && id.type === syntax_1.Syntax.Identifier) {
if (this.scanner.isRestrictedWord(id.name)) {
this.tolerateError(messages_1.Messages.StrictVarName);
}
}
var init = null;
if (kind === 'const') {
if (!this.matchKeyword('in') && !this.matchContextualKeyword('of')) {
if (this.match('=')) {
this.nextToken();
init = this.isolateCoverGrammar(this.parseAssignmentExpression);
}
else {
this.throwError(messages_1.Messages.DeclarationMissingInitializer, 'const');
}
}
}
else if ((!options.inFor && id.type !== syntax_1.Syntax.Identifier) || this.match('=')) {
this.expect('=');
init = this.isolateCoverGrammar(this.parseAssignmentExpression);
}
return this.finalize(node, new Node.VariableDeclarator(id, init));
};
Parser.prototype.parseBindingList = function (kind, options) {
var list = [this.parseLexicalBinding(kind, options)];
while (this.match(',')) {
this.nextToken();
list.push(this.parseLexicalBinding(kind, options));
}
return list;
};
Parser.prototype.isLexicalDeclaration = function () {
var state = this.scanner.saveState();
this.scanner.scanComments();
var next = this.scanner.lex();
this.scanner.restoreState(state);
return (next.type === 3 /* Identifier */) ||
(next.type === 7 /* Punctuator */ && next.value === '[') ||
(next.type === 7 /* Punctuator */ && next.value === '{') ||
(next.type === 4 /* Keyword */ && next.value === 'let') ||
(next.type === 4 /* Keyword */ && next.value === 'yield');
};
Parser.prototype.parseLexicalDeclaration = function (options) {
var node = this.createNode();
var kind = this.nextToken().value;
assert_1.assert(kind === 'let' || kind === 'const', 'Lexical declaration must be either let or const');
var declarations = this.parseBindingList(kind, options);
this.consumeSemicolon();
return this.finalize(node, new Node.VariableDeclaration(declarations, kind));
};
// https://tc39.github.io/ecma262/#sec-destructuring-binding-patterns
Parser.prototype.parseBindingRestElement = function (params, kind) {
var node = this.createNode();
this.expect('...');
var arg = this.parsePattern(params, kind);
return this.finalize(node, new Node.RestElement(arg));
};
Parser.prototype.parseArrayPattern = function (params, kind) {
var node = this.createNode();
this.expect('[');
var elements = [];
while (!this.match(']')) {
if (this.match(',')) {
this.nextToken();
elements.push(null);
}
else {
if (this.match('...')) {
elements.push(this.parseBindingRestElement(params, kind));
break;
}
else {
elements.push(this.parsePatternWithDefault(params, kind));
}
if (!this.match(']')) {
this.expect(',');
}
}
}
this.expect(']');
return this.finalize(node, new Node.ArrayPattern(elements));
};
Parser.prototype.parsePropertyPattern = function (params, kind) {
var node = this.createNode();
var computed = false;
var shorthand = false;
var method = false;
var key;
var value;
if (this.lookahead.type === 3 /* Identifier */) {
var keyToken = this.lookahead;
key = this.parseVariableIdentifier();
var init = this.finalize(node, new Node.Identifier(keyToken.value));
if (this.match('=')) {
params.push(keyToken);
shorthand = true;
this.nextToken();
var expr = this.parseAssignmentExpression();
value = this.finalize(this.startNode(keyToken), new Node.AssignmentPattern(init, expr));
}
else if (!this.match(':')) {
params.push(keyToken);
shorthand = true;
value = init;
}
else {
this.expect(':');
value = this.parsePatternWithDefault(params, kind);
}
}
else {
computed = this.match('[');
key = this.parseObjectPropertyKey();
this.expect(':');
value = this.parsePatternWithDefault(params, kind);
}
return this.finalize(node, new Node.Property('init', key, computed, value, method, shorthand));
};
Parser.prototype.parseObjectPattern = function (params, kind) {
var node = this.createNode();
var properties = [];
this.expect('{');
while (!this.match('}')) {
properties.push(this.parsePropertyPattern(params, kind));
if (!this.match('}')) {
this.expect(',');
}
}
this.expect('}');
return this.finalize(node, new Node.ObjectPattern(properties));
};
Parser.prototype.parsePattern = function (params, kind) {
var pattern;
if (this.match('[')) {
pattern = this.parseArrayPattern(params, kind);
}
else if (this.match('{')) {
pattern = this.parseObjectPattern(params, kind);
}
else {
if (this.matchKeyword('let') && (kind === 'const' || kind === 'let')) {
this.tolerateUnexpectedToken(this.lookahead, messages_1.Messages.LetInLexicalBinding);
}
params.push(this.lookahead);
pattern = this.parseVariableIdentifier(kind);
}
return pattern;
};
Parser.prototype.parsePatternWithDefault = function (params, kind) {
var startToken = this.lookahead;
var pattern = this.parsePattern(params, kind);
if (this.match('=')) {
this.nextToken();
var previousAllowYield = this.context.allowYield;
this.context.allowYield = true;
var right = this.isolateCoverGrammar(this.parseAssignmentExpression);
this.context.allowYield = previousAllowYield;
pattern = this.finalize(this.startNode(startToken), new Node.AssignmentPattern(pattern, right));
}
return pattern;
};
// https://tc39.github.io/ecma262/#sec-variable-statement
Parser.prototype.parseVariableIdentifier = function (kind) {
var node = this.createNode();
var token = this.nextToken();
if (token.type === 4 /* Keyword */ && token.value === 'yield') {
if (this.context.strict) {
this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord);
}
else if (!this.context.allowYield) {
this.throwUnexpectedToken(token);
}
}
else if (token.type !== 3 /* Identifier */) {
if (this.context.strict && token.type === 4 /* Keyword */ && this.scanner.isStrictModeReservedWord(token.value)) {
this.tolerateUnexpectedToken(token, messages_1.Messages.StrictReservedWord);
}
else {
if (this.context.strict || token.value !== 'let' || kind !== 'var') {
this.throwUnexpectedToken(token);
}
}
}
else if ((this.context.isModule || this.context.await) && token.type === 3 /* Identifier */ && token.value === 'await') {
this.tolerateUnexpectedToken(token);
}
return this.finalize(node, new Node.Identifier(token.value));
};
Parser.prototype.parseVariableDeclaration = function (options) {
var node = this.createNode();
var params = [];
var id = this.parsePattern(params, 'var');
if (this.context.strict && id.type === syntax_1.Syntax.Identifier) {
if (this.scanner.isRestrictedWord(id.name)) {
this.tolerateError(messages_1.Messages.StrictVarName);
}
}
var init = null;
if (this.match('=')) {
this.nextToken();
init = this.isolateCoverGrammar(this.parseAssignmentExpression);
}
else if (id.type !== syntax_1.Syntax.Identifier && !options.inFor) {
this.expect('=');
}
return this.finalize(node, new Node.VariableDeclarator(id, init));
};
Parser.prototype.parseVariableDeclarationList = function (options) {
var opt = { inFor: options.inFor };
var list = [];
list.push(this.parseVariableDeclaration(opt));
while (this.match(',')) {
this.nextToken();
list.push(this.parseVariableDeclaration(opt));
}
return list;
};
Parser.prototype.parseVariableStatement = function () {
var node = this.createNode();
this.expectKeyword('var');
var declarations = this.parseVariableDeclarationList({ inFor: false });
this.consumeSemicolon();
return this.finalize(node, new Node.VariableDeclaration(declarations, 'var'));
};
// https://tc39.github.io/ecma262/#sec-empty-statement
Parser.prototype.parseEmptyStatement = function () {
var node = this.createNode();
this.expect(';');
return this.finalize(node, new Node.EmptyStatement());
};
// https://tc39.github.io/ecma262/#sec-expression-statement
Parser.prototype.parseExpressionStatement = function () {
var node = this.createNode();
var expr = this.parseExpression();
this.consumeSemicolon();
return this.finalize(node, new Node.ExpressionStatement(expr));
};
// https://tc39.github.io/ecma262/#sec-if-statement
Parser.prototype.parseIfClause = function () {
if (this.context.strict && this.matchKeyword('function')) {
this.tolerateError(messages_1.Messages.StrictFunction);
}
return this.parseStatement();
};
Parser.prototype.parseIfStatement = function () {
var node = this.createNode();
var consequent;
var alternate = null;
this.expectKeyword('if');
this.expect('(');
var test = this.parseExpression();
if (!this.match(')') && this.config.tolerant) {
this.tolerateUnexpectedToken(this.nextToken());
consequent = this.finalize(this.createNode(), new Node.EmptyStatement());
}
else {
this.expect(')');
consequent = this.parseIfClause();
if (this.matchKeyword('else')) {
this.nextToken();
alternate = this.parseIfClause();
}
}
return this.finalize(node, new Node.IfStatement(test, consequent, alternate));
};
// https://tc39.github.io/ecma262/#sec-do-while-statement
Parser.prototype.parseDoWhileStatement = function () {
var node = this.createNode();
this.expectKeyword('do');
var previousInIteration = this.context.inIteration;
this.context.inIteration = true;
var body = this.parseStatement();
this.context.inIteration = previousInIteration;
this.expectKeyword('while');
this.expect('(');
var test = this.parseExpression();
if (!this.match(')') && this.config.tolerant) {
this.tolerateUnexpectedToken(this.nextToken());
}
else {
this.expect(')');
if (this.match(';')) {
this.nextToken();
}
}
return this.finalize(node, new Node.DoWhileStatement(body, test));
};
// https://tc39.github.io/ecma262/#sec-while-statement
Parser.prototype.parseWhileStatement = function () {
var node = this.createNode();
var body;
this.expectKeyword('while');
this.expect('(');
var test = this.parseExpression();
if (!this.match(')') && this.config.tolerant) {
this.tolerateUnexpectedToken(this.nextToken());
body = this.finalize(this.createNode(), new Node.EmptyStatement());
}
else {
this.expect(')');
var previousInIteration = this.context.inIteration;
this.context.inIteration = true;
body = this.parseStatement();
this.context.inIteration = previousInIteration;
}
return this.finalize(node, new Node.WhileStatement(test, body));
};
// https://tc39.github.io/ecma262/#sec-for-statement
// https://tc39.github.io/ecma262/#sec-for-in-and-for-of-statements
Parser.prototype.parseForStatement = function () {
var init = null;
var test = null;
var update = null;
var forIn = true;
var left, right;
var node = this.createNode();
this.expectKeyword('for');
this.expect('(');
if (this.match(';')) {
this.nextToken();
}
else {
if (this.matchKeyword('var')) {
init = this.createNode();
this.nextToken();
var previousAllowIn = this.context.allowIn;
this.context.allowIn = false;
var declarations = this.parseVariableDeclarationList({ inFor: true });
this.context.allowIn = previousAllowIn;
if (declarations.length === 1 && this.matchKeyword('in')) {
var decl = declarations[0];
if (decl.init && (decl.id.type === syntax_1.Syntax.ArrayPattern || decl.id.type === syntax_1.Syntax.ObjectPattern || this.context.strict)) {
this.tolerateError(messages_1.Messages.ForInOfLoopInitializer, 'for-in');
}
init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var'));
this.nextToken();
left = init;
right = this.parseExpression();
init = null;
}
else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) {
init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var'));
this.nextToken();
left = init;
right = this.parseAssignmentExpression();
init = null;
forIn = false;
}
else {
init = this.finalize(init, new Node.VariableDeclaration(declarations, 'var'));
this.expect(';');
}
}
else if (this.matchKeyword('const') || this.matchKeyword('let')) {
init = this.createNode();
var kind = this.nextToken().value;
if (!this.context.strict && this.lookahead.value === 'in') {
init = this.finalize(init, new Node.Identifier(kind));
this.nextToken();
left = init;
right = this.parseExpression();
init = null;
}
else {
var previousAllowIn = this.context.allowIn;
this.context.allowIn = false;
var declarations = this.parseBindingList(kind, { inFor: true });
this.context.allowIn = previousAllowIn;
if (declarations.length === 1 && declarations[0].init === null && this.matchKeyword('in')) {
init = this.finalize(init, new Node.VariableDeclaration(declarations, kind));
this.nextToken();
left = init;
right = this.parseExpression();
init = null;
}
else if (declarations.length === 1 && declarations[0].init === null && this.matchContextualKeyword('of')) {
init = this.finalize(init, new Node.VariableDeclaration(declarations, kind));
this.nextToken();
left = init;
right = this.parseAssignmentExpression();
init = null;
forIn = false;
}
else {
this.consumeSemicolon();
init = this.finalize(init, new Node.VariableDeclaration(declarations, kind));
}
}
}
else {
var initStartToken = this.lookahead;
var previousAllowIn = this.context.allowIn;
this.context.allowIn = false;
init = this.inheritCoverGrammar(this.parseAssignmentExpression);
this.context.allowIn = previousAllowIn;
if (this.matchKeyword('in')) {
if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) {
this.tolerateError(messages_1.Messages.InvalidLHSInForIn);
}
this.nextToken();
this.reinterpretExpressionAsPattern(init);
left = init;
right = this.parseExpression();
init = null;
}
else if (this.matchContextualKeyword('of')) {
if (!this.context.isAssignmentTarget || init.type === syntax_1.Syntax.AssignmentExpression) {
this.tolerateError(messages_1.Messages.InvalidLHSInForLoop);
}
this.nextToken();
this.reinterpretExpressionAsPattern(init);
left = init;
right = this.parseAssignmentExpression();
init = null;
forIn = false;
}
else {
if (this.match(',')) {
var initSeq = [init];
while (this.match(',')) {
this.nextToken();
initSeq.push(this.isolateCoverGrammar(this.parseAssignmentExpression));
}
init = this.finalize(this.startNode(initStartToken), new Node.SequenceExpression(initSeq));
}
this.expect(';');
}
}
}
if (typeof left === 'undefined') {
if (!this.match(';')) {
test = this.parseExpression();
}
this.expect(';');
if (!this.match(')')) {
update = this.parseExpression();
}
}
var body;
if (!this.match(')') && this.config.tolerant) {
this.tolerateUnexpectedToken(this.nextToken());
body = this.finalize(this.createNode(), new Node.EmptyStatement());
}
else {
this.expect(')');
var previousInIteration = this.context.inIteration;
this.context.inIteration = true;
body = this.isolateCoverGrammar(this.parseStatement);
this.context.inIteration = previousInIteration;
}
return (typeof left === 'undefined') ?
this.finalize(node, new Node.ForStatement(init, test, update, body)) :
forIn ? this.finalize(node, new Node.ForInStatement(left, right, body)) :
this.finalize(node, new Node.ForOfStatement(left, right, body));
};
// https://tc39.github.io/ecma262/#sec-continue-statement
Parser.prototype.parseContinueStatement = function () {
var node = this.createNode();
this.expectKeyword('continue');
var label = null;
if (this.lookahead.type === 3 /* Identifier */ && !this.hasLineTerminator) {
var id = this.parseVariableIdentifier();
label = id;
var key = '$' + id.name;
if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) {
this.throwError(messages_1.Messages.UnknownLabel, id.name);
}
}
this.consumeSemicolon();
if (label === null && !this.context.inIteration) {
this.throwError(messages_1.Messages.IllegalContinue);
}
return this.finalize(node, new Node.ContinueStatement(label));
};
// https://tc39.github.io/ecma262/#sec-break-statement
Parser.prototype.parseBreakStatement = function () {
var node = this.createNode();
this.expectKeyword('break');
var label = null;
if (this.lookahead.type === 3 /* Identifier */ && !this.hasLineTerminator) {
var id = this.parseVariableIdentifier();
var key = '$' + id.name;
if (!Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) {
this.throwError(messages_1.Messages.UnknownLabel, id.name);
}
label = id;
}
this.consumeSemicolon();
if (label === null && !this.context.inIteration && !this.context.inSwitch) {
this.throwError(messages_1.Messages.IllegalBreak);
}
return this.finalize(node, new Node.BreakStatement(label));
};
// https://tc39.github.io/ecma262/#sec-return-statement
Parser.prototype.parseReturnStatement = function () {
if (!this.context.inFunctionBody) {
this.tolerateError(messages_1.Messages.IllegalReturn);
}
var node = this.createNode();
this.expectKeyword('return');
var hasArgument = (!this.match(';') && !this.match('}') &&
!this.hasLineTerminator && this.lookahead.type !== 2 /* EOF */) ||
this.lookahead.type === 8 /* StringLiteral */ ||
this.lookahead.type === 10 /* Template */;
var argument = hasArgument ? this.parseExpression() : null;
this.consumeSemicolon();
return this.finalize(node, new Node.ReturnStatement(argument));
};
// https://tc39.github.io/ecma262/#sec-with-statement
Parser.prototype.parseWithStatement = function () {
if (this.context.strict) {
this.tolerateError(messages_1.Messages.StrictModeWith);
}
var node = this.createNode();
var body;
this.expectKeyword('with');
this.expect('(');
var object = this.parseExpression();
if (!this.match(')') && this.config.tolerant) {
this.tolerateUnexpectedToken(this.nextToken());
body = this.finalize(this.createNode(), new Node.EmptyStatement());
}
else {
this.expect(')');
body = this.parseStatement();
}
return this.finalize(node, new Node.WithStatement(object, body));
};
// https://tc39.github.io/ecma262/#sec-switch-statement
Parser.prototype.parseSwitchCase = function () {
var node = this.createNode();
var test;
if (this.matchKeyword('default')) {
this.nextToken();
test = null;
}
else {
this.expectKeyword('case');
test = this.parseExpression();
}
this.expect(':');
var consequent = [];
while (true) {
if (this.match('}') || this.matchKeyword('default') || this.matchKeyword('case')) {
break;
}
consequent.push(this.parseStatementListItem());
}
return this.finalize(node, new Node.SwitchCase(test, consequent));
};
Parser.prototype.parseSwitchStatement = function () {
var node = this.createNode();
this.expectKeyword('switch');
this.expect('(');
var discriminant = this.parseExpression();
this.expect(')');
var previousInSwitch = this.context.inSwitch;
this.context.inSwitch = true;
var cases = [];
var defaultFound = false;
this.expect('{');
while (true) {
if (this.match('}')) {
break;
}
var clause = this.parseSwitchCase();
if (clause.test === null) {
if (defaultFound) {
this.throwError(messages_1.Messages.MultipleDefaultsInSwitch);
}
defaultFound = true;
}
cases.push(clause);
}
this.expect('}');
this.context.inSwitch = previousInSwitch;
return this.finalize(node, new Node.SwitchStatement(discriminant, cases));
};
// https://tc39.github.io/ecma262/#sec-labelled-statements
Parser.prototype.parseLabelledStatement = function () {
var node = this.createNode();
var expr = this.parseExpression();
var statement;
if ((expr.type === syntax_1.Syntax.Identifier) && this.match(':')) {
this.nextToken();
var id = expr;
var key = '$' + id.name;
if (Object.prototype.hasOwnProperty.call(this.context.labelSet, key)) {
this.throwError(messages_1.Messages.Redeclaration, 'Label', id.name);
}
this.context.labelSet[key] = true;
var body = void 0;
if (this.matchKeyword('class')) {
this.tolerateUnexpectedToken(this.lookahead);
body = this.parseClassDeclaration();
}
else if (this.matchKeyword('function')) {
var token = this.lookahead;
var declaration = this.parseFunctionDeclaration();
if (this.context.strict) {
this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunction);
}
else if (declaration.generator) {
this.tolerateUnexpectedToken(token, messages_1.Messages.GeneratorInLegacyContext);
}
body = declaration;
}
else {
body = this.parseStatement();
}
delete this.context.labelSet[key];
statement = new Node.LabeledStatement(id, body);
}
else {
this.consumeSemicolon();
statement = new Node.ExpressionStatement(expr);
}
return this.finalize(node, statement);
};
// https://tc39.github.io/ecma262/#sec-throw-statement
Parser.prototype.parseThrowStatement = function () {
var node = this.createNode();
this.expectKeyword('throw');
if (this.hasLineTerminator) {
this.throwError(messages_1.Messages.NewlineAfterThrow);
}
var argument = this.parseExpression();
this.consumeSemicolon();
return this.finalize(node, new Node.ThrowStatement(argument));
};
// https://tc39.github.io/ecma262/#sec-try-statement
Parser.prototype.parseCatchClause = function () {
var node = this.createNode();
this.expectKeyword('catch');
this.expect('(');
if (this.match(')')) {
this.throwUnexpectedToken(this.lookahead);
}
var params = [];
var param = this.parsePattern(params);
var paramMap = {};
for (var i = 0; i < params.length; i++) {
var key = '$' + params[i].value;
if (Object.prototype.hasOwnProperty.call(paramMap, key)) {
this.tolerateError(messages_1.Messages.DuplicateBinding, params[i].value);
}
paramMap[key] = true;
}
if (this.context.strict && param.type === syntax_1.Syntax.Identifier) {
if (this.scanner.isRestrictedWord(param.name)) {
this.tolerateError(messages_1.Messages.StrictCatchVariable);
}
}
this.expect(')');
var body = this.parseBlock();
return this.finalize(node, new Node.CatchClause(param, body));
};
Parser.prototype.parseFinallyClause = function () {
this.expectKeyword('finally');
return this.parseBlock();
};
Parser.prototype.parseTryStatement = function () {
var node = this.createNode();
this.expectKeyword('try');
var block = this.parseBlock();
var handler = this.matchKeyword('catch') ? this.parseCatchClause() : null;
var finalizer = this.matchKeyword('finally') ? this.parseFinallyClause() : null;
if (!handler && !finalizer) {
this.throwError(messages_1.Messages.NoCatchOrFinally);
}
return this.finalize(node, new Node.TryStatement(block, handler, finalizer));
};
// https://tc39.github.io/ecma262/#sec-debugger-statement
Parser.prototype.parseDebuggerStatement = function () {
var node = this.createNode();
this.expectKeyword('debugger');
this.consumeSemicolon();
return this.finalize(node, new Node.DebuggerStatement());
};
// https://tc39.github.io/ecma262/#sec-ecmascript-language-statements-and-declarations
Parser.prototype.parseStatement = function () {
var statement;
switch (this.lookahead.type) {
case 1 /* BooleanLiteral */:
case 5 /* NullLiteral */:
case 6 /* NumericLiteral */:
case 8 /* StringLiteral */:
case 10 /* Template */:
case 9 /* RegularExpression */:
statement = this.parseExpressionStatement();
break;
case 7 /* Punctuator */:
var value = this.lookahead.value;
if (value === '{') {
statement = this.parseBlock();
}
else if (value === '(') {
statement = this.parseExpressionStatement();
}
else if (value === ';') {
statement = this.parseEmptyStatement();
}
else {
statement = this.parseExpressionStatement();
}
break;
case 3 /* Identifier */:
statement = this.matchAsyncFunction() ? this.parseFunctionDeclaration() : this.parseLabelledStatement();
break;
case 4 /* Keyword */:
switch (this.lookahead.value) {
case 'break':
statement = this.parseBreakStatement();
break;
case 'continue':
statement = this.parseContinueStatement();
break;
case 'debugger':
statement = this.parseDebuggerStatement();
break;
case 'do':
statement = this.parseDoWhileStatement();
break;
case 'for':
statement = this.parseForStatement();
break;
case 'function':
statement = this.parseFunctionDeclaration();
break;
case 'if':
statement = this.parseIfStatement();
break;
case 'return':
statement = this.parseReturnStatement();
break;
case 'switch':
statement = this.parseSwitchStatement();
break;
case 'throw':
statement = this.parseThrowStatement();
break;
case 'try':
statement = this.parseTryStatement();
break;
case 'var':
statement = this.parseVariableStatement();
break;
case 'while':
statement = this.parseWhileStatement();
break;
case 'with':
statement = this.parseWithStatement();
break;
default:
statement = this.parseExpressionStatement();
break;
}
break;
default:
statement = this.throwUnexpectedToken(this.lookahead);
}
return statement;
};
// https://tc39.github.io/ecma262/#sec-function-definitions
Parser.prototype.parseFunctionSourceElements = function () {
var node = this.createNode();
this.expect('{');
var body = this.parseDirectivePrologues();
var previousLabelSet = this.context.labelSet;
var previousInIteration = this.context.inIteration;
var previousInSwitch = this.context.inSwitch;
var previousInFunctionBody = this.context.inFunctionBody;
this.context.labelSet = {};
this.context.inIteration = false;
this.context.inSwitch = false;
this.context.inFunctionBody = true;
while (this.lookahead.type !== 2 /* EOF */) {
if (this.match('}')) {
break;
}
body.push(this.parseStatementListItem());
}
this.expect('}');
this.context.labelSet = previousLabelSet;
this.context.inIteration = previousInIteration;
this.context.inSwitch = previousInSwitch;
this.context.inFunctionBody = previousInFunctionBody;
return this.finalize(node, new Node.BlockStatement(body));
};
Parser.prototype.validateParam = function (options, param, name) {
var key = '$' + name;
if (this.context.strict) {
if (this.scanner.isRestrictedWord(name)) {
options.stricted = param;
options.message = messages_1.Messages.StrictParamName;
}
if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
options.stricted = param;
options.message = messages_1.Messages.StrictParamDupe;
}
}
else if (!options.firstRestricted) {
if (this.scanner.isRestrictedWord(name)) {
options.firstRestricted = param;
options.message = messages_1.Messages.StrictParamName;
}
else if (this.scanner.isStrictModeReservedWord(name)) {
options.firstRestricted = param;
options.message = messages_1.Messages.StrictReservedWord;
}
else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
options.stricted = param;
options.message = messages_1.Messages.StrictParamDupe;
}
}
/* istanbul ignore next */
if (typeof Object.defineProperty === 'function') {
Object.defineProperty(options.paramSet, key, { value: true, enumerable: true, writable: true, configurable: true });
}
else {
options.paramSet[key] = true;
}
};
Parser.prototype.parseRestElement = function (params) {
var node = this.createNode();
this.expect('...');
var arg = this.parsePattern(params);
if (this.match('=')) {
this.throwError(messages_1.Messages.DefaultRestParameter);
}
if (!this.match(')')) {
this.throwError(messages_1.Messages.ParameterAfterRestParameter);
}
return this.finalize(node, new Node.RestElement(arg));
};
Parser.prototype.parseFormalParameter = function (options) {
var params = [];
var param = this.match('...') ? this.parseRestElement(params) : this.parsePatternWithDefault(params);
for (var i = 0; i < params.length; i++) {
this.validateParam(options, params[i], params[i].value);
}
options.simple = options.simple && (param instanceof Node.Identifier);
options.params.push(param);
};
Parser.prototype.parseFormalParameters = function (firstRestricted) {
var options;
options = {
simple: true,
params: [],
firstRestricted: firstRestricted
};
this.expect('(');
if (!this.match(')')) {
options.paramSet = {};
while (this.lookahead.type !== 2 /* EOF */) {
this.parseFormalParameter(options);
if (this.match(')')) {
break;
}
this.expect(',');
if (this.match(')')) {
break;
}
}
}
this.expect(')');
return {
simple: options.simple,
params: options.params,
stricted: options.stricted,
firstRestricted: options.firstRestricted,
message: options.message
};
};
Parser.prototype.matchAsyncFunction = function () {
var match = this.matchContextualKeyword('async');
if (match) {
var state = this.scanner.saveState();
this.scanner.scanComments();
var next = this.scanner.lex();
this.scanner.restoreState(state);
match = (state.lineNumber === next.lineNumber) && (next.type === 4 /* Keyword */) && (next.value === 'function');
}
return match;
};
Parser.prototype.parseFunctionDeclaration = function (identifierIsOptional) {
var node = this.createNode();
var isAsync = this.matchContextualKeyword('async');
if (isAsync) {
this.nextToken();
}
this.expectKeyword('function');
var isGenerator = isAsync ? false : this.match('*');
if (isGenerator) {
this.nextToken();
}
var message;
var id = null;
var firstRestricted = null;
if (!identifierIsOptional || !this.match('(')) {
var token = this.lookahead;
id = this.parseVariableIdentifier();
if (this.context.strict) {
if (this.scanner.isRestrictedWord(token.value)) {
this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName);
}
}
else {
if (this.scanner.isRestrictedWord(token.value)) {
firstRestricted = token;
message = messages_1.Messages.StrictFunctionName;
}
else if (this.scanner.isStrictModeReservedWord(token.value)) {
firstRestricted = token;
message = messages_1.Messages.StrictReservedWord;
}
}
}
var previousAllowAwait = this.context.await;
var previousAllowYield = this.context.allowYield;
this.context.await = isAsync;
this.context.allowYield = !isGenerator;
var formalParameters = this.parseFormalParameters(firstRestricted);
var params = formalParameters.params;
var stricted = formalParameters.stricted;
firstRestricted = formalParameters.firstRestricted;
if (formalParameters.message) {
message = formalParameters.message;
}
var previousStrict = this.context.strict;
var previousAllowStrictDirective = this.context.allowStrictDirective;
this.context.allowStrictDirective = formalParameters.simple;
var body = this.parseFunctionSourceElements();
if (this.context.strict && firstRestricted) {
this.throwUnexpectedToken(firstRestricted, message);
}
if (this.context.strict && stricted) {
this.tolerateUnexpectedToken(stricted, message);
}
this.context.strict = previousStrict;
this.context.allowStrictDirective = previousAllowStrictDirective;
this.context.await = previousAllowAwait;
this.context.allowYield = previousAllowYield;
return isAsync ? this.finalize(node, new Node.AsyncFunctionDeclaration(id, params, body)) :
this.finalize(node, new Node.FunctionDeclaration(id, params, body, isGenerator));
};
Parser.prototype.parseFunctionExpression = function () {
var node = this.createNode();
var isAsync = this.matchContextualKeyword('async');
if (isAsync) {
this.nextToken();
}
this.expectKeyword('function');
var isGenerator = isAsync ? false : this.match('*');
if (isGenerator) {
this.nextToken();
}
var message;
var id = null;
var firstRestricted;
var previousAllowAwait = this.context.await;
var previousAllowYield = this.context.allowYield;
this.context.await = isAsync;
this.context.allowYield = !isGenerator;
if (!this.match('(')) {
var token = this.lookahead;
id = (!this.context.strict && !isGenerator && this.matchKeyword('yield')) ? this.parseIdentifierName() : this.parseVariableIdentifier();
if (this.context.strict) {
if (this.scanner.isRestrictedWord(token.value)) {
this.tolerateUnexpectedToken(token, messages_1.Messages.StrictFunctionName);
}
}
else {
if (this.scanner.isRestrictedWord(token.value)) {
firstRestricted = token;
message = messages_1.Messages.StrictFunctionName;
}
else if (this.scanner.isStrictModeReservedWord(token.value)) {
firstRestricted = token;
message = messages_1.Messages.StrictReservedWord;
}
}
}
var formalParameters = this.parseFormalParameters(firstRestricted);
var params = formalParameters.params;
var stricted = formalParameters.stricted;
firstRestricted = formalParameters.firstRestricted;
if (formalParameters.message) {
message = formalParameters.message;
}
var previousStrict = this.context.strict;
var previousAllowStrictDirective = this.context.allowStrictDirective;
this.context.allowStrictDirective = formalParameters.simple;
var body = this.parseFunctionSourceElements();
if (this.context.strict && firstRestricted) {
this.throwUnexpectedToken(firstRestricted, message);
}
if (this.context.strict && stricted) {
this.tolerateUnexpectedToken(stricted, message);
}
this.context.strict = previousStrict;
this.context.allowStrictDirective = previousAllowStrictDirective;
this.context.await = previousAllowAwait;
this.context.allowYield = previousAllowYield;
return isAsync ? this.finalize(node, new Node.AsyncFunctionExpression(id, params, body)) :
this.finalize(node, new Node.FunctionExpression(id, params, body, isGenerator));
};
// https://tc39.github.io/ecma262/#sec-directive-prologues-and-the-use-strict-directive
Parser.prototype.parseDirective = function () {
var token = this.lookahead;
var node = this.createNode();
var expr = this.parseExpression();
var directive = (expr.type === syntax_1.Syntax.Literal) ? this.getTokenRaw(token).slice(1, -1) : null;
this.consumeSemicolon();
return this.finalize(node, directive ? new Node.Directive(expr, directive) : new Node.ExpressionStatement(expr));
};
Parser.prototype.parseDirectivePrologues = function () {
var firstRestricted = null;
var body = [];
while (true) {
var token = this.lookahead;
if (token.type !== 8 /* StringLiteral */) {
break;
}
var statement = this.parseDirective();
body.push(statement);
var directive = statement.directive;
if (typeof directive !== 'string') {
break;
}
if (directive === 'use strict') {
this.context.strict = true;
if (firstRestricted) {
this.tolerateUnexpectedToken(firstRestricted, messages_1.Messages.StrictOctalLiteral);
}
if (!this.context.allowStrictDirective) {
this.tolerateUnexpectedToken(token, messages_1.Messages.IllegalLanguageModeDirective);
}
}
else {
if (!firstRestricted && token.octal) {
firstRestricted = token;
}
}
}
return body;
};
// https://tc39.github.io/ecma262/#sec-method-definitions
Parser.prototype.qualifiedPropertyName = function (token) {
switch (token.type) {
case 3 /* Identifier */:
case 8 /* StringLiteral */:
case 1 /* BooleanLiteral */:
case 5 /* NullLiteral */:
case 6 /* NumericLiteral */:
case 4 /* Keyword */:
return true;
case 7 /* Punctuator */:
return token.value === '[';
default:
break;
}
return false;
};
Parser.prototype.parseGetterMethod = function () {
var node = this.createNode();
var isGenerator = false;
var previousAllowYield = this.context.allowYield;
this.context.allowYield = !isGenerator;
var formalParameters = this.parseFormalParameters();
if (formalParameters.params.length > 0) {
this.tolerateError(messages_1.Messages.BadGetterArity);
}
var method = this.parsePropertyMethod(formalParameters);
this.context.allowYield = previousAllowYield;
return this.finalize(node, new Node.FunctionExpression(null, formalParameters.params, method, isGenerator));
};
Parser.prototype.parseSetterMethod = function () {
var node = this.createNode();
var isGenerator = false;
var previousAllowYield = this.context.allowYield;
this.context.allowYield = !isGenerator;
var formalParameters = this.parseFormalParameters();
if (formalParameters.params.length !== 1) {
this.tolerateError(messages_1.Messages.BadSetterArity);
}
else if (formalParameters.params[0] instanceof Node.RestElement) {
this.tolerateError(messages_1.Messages.BadSetterRestParameter);
}
var method = this.parsePropertyMethod(formalParameters);
this.context.allowYield = previousAllowYield;
return this.finalize(node, new Node.FunctionExpression(null, formalParameters.params, method, isGenerator));
};
Parser.prototype.parseGeneratorMethod = function () {
var node = this.createNode();
var isGenerator = true;
var previousAllowYield = this.context.allowYield;
this.context.allowYield = true;
var params = this.parseFormalParameters();
this.context.allowYield = false;
var method = this.parsePropertyMethod(params);
this.context.allowYield = previousAllowYield;
return this.finalize(node, new Node.FunctionExpression(null, params.params, method, isGenerator));
};
// https://tc39.github.io/ecma262/#sec-generator-function-definitions
Parser.prototype.isStartOfExpression = function () {
var start = true;
var value = this.lookahead.value;
switch (this.lookahead.type) {
case 7 /* Punctuator */:
start = (value === '[') || (value === '(') || (value === '{') ||
(value === '+') || (value === '-') ||
(value === '!') || (value === '~') ||
(value === '++') || (value === '--') ||
(value === '/') || (value === '/='); // regular expression literal
break;
case 4 /* Keyword */:
start = (value === 'class') || (value === 'delete') ||
(value === 'function') || (value === 'let') || (value === 'new') ||
(value === 'super') || (value === 'this') || (value === 'typeof') ||
(value === 'void') || (value === 'yield');
break;
default:
break;
}
return start;
};
Parser.prototype.parseYieldExpression = function () {
var node = this.createNode();
this.expectKeyword('yield');
var argument = null;
var delegate = false;
if (!this.hasLineTerminator) {
var previousAllowYield = this.context.allowYield;
this.context.allowYield = false;
delegate = this.match('*');
if (delegate) {
this.nextToken();
argument = this.parseAssignmentExpression();
}
else if (this.isStartOfExpression()) {
argument = this.parseAssignmentExpression();
}
this.context.allowYield = previousAllowYield;
}
return this.finalize(node, new Node.YieldExpression(argument, delegate));
};
// https://tc39.github.io/ecma262/#sec-class-definitions
Parser.prototype.parseClassElement = function (hasConstructor) {
var token = this.lookahead;
var node = this.createNode();
var kind = '';
var key = null;
var value = null;
var computed = false;
var method = false;
var isStatic = false;
var isAsync = false;
if (this.match('*')) {
this.nextToken();
}
else {
computed = this.match('[');
key = this.parseObjectPropertyKey();
var id = key;
if (id.name === 'static' && (this.qualifiedPropertyName(this.lookahead) || this.match('*'))) {
token = this.lookahead;
isStatic = true;
computed = this.match('[');
if (this.match('*')) {
this.nextToken();
}
else {
key = this.parseObjectPropertyKey();
}
}
if ((token.type === 3 /* Identifier */) && !this.hasLineTerminator && (token.value === 'async')) {
var punctuator = this.lookahead.value;
if (punctuator !== ':' && punctuator !== '(' && punctuator !== '*') {
isAsync = true;
token = this.lookahead;
key = this.parseObjectPropertyKey();
if (token.type === 3 /* Identifier */ && token.value === 'constructor') {
this.tolerateUnexpectedToken(token, messages_1.Messages.ConstructorIsAsync);
}
}
}
}
var lookaheadPropertyKey = this.qualifiedPropertyName(this.lookahead);
if (token.type === 3 /* Identifier */) {
if (token.value === 'get' && lookaheadPropertyKey) {
kind = 'get';
computed = this.match('[');
key = this.parseObjectPropertyKey();
this.context.allowYield = false;
value = this.parseGetterMethod();
}
else if (token.value === 'set' && lookaheadPropertyKey) {
kind = 'set';
computed = this.match('[');
key = this.parseObjectPropertyKey();
value = this.parseSetterMethod();
}
}
else if (token.type === 7 /* Punctuator */ && token.value === '*' && lookaheadPropertyKey) {
kind = 'init';
computed = this.match('[');
key = this.parseObjectPropertyKey();
value = this.parseGeneratorMethod();
method = true;
}
if (!kind && key && this.match('(')) {
kind = 'init';
value = isAsync ? this.parsePropertyMethodAsyncFunction() : this.parsePropertyMethodFunction();
method = true;
}
if (!kind) {
this.throwUnexpectedToken(this.lookahead);
}
if (kind === 'init') {
kind = 'method';
}
if (!computed) {
if (isStatic && this.isPropertyKey(key, 'prototype')) {
this.throwUnexpectedToken(token, messages_1.Messages.StaticPrototype);
}
if (!isStatic && this.isPropertyKey(key, 'constructor')) {
if (kind !== 'method' || !method || (value && value.generator)) {
this.throwUnexpectedToken(token, messages_1.Messages.ConstructorSpecialMethod);
}
if (hasConstructor.value) {
this.throwUnexpectedToken(token, messages_1.Messages.DuplicateConstructor);
}
else {
hasConstructor.value = true;
}
kind = 'constructor';
}
}
return this.finalize(node, new Node.MethodDefinition(key, computed, value, kind, isStatic));
};
Parser.prototype.parseClassElementList = function () {
var body = [];
var hasConstructor = { value: false };
this.expect('{');
while (!this.match('}')) {
if (this.match(';')) {
this.nextToken();
}
else {
body.push(this.parseClassElement(hasConstructor));
}
}
this.expect('}');
return body;
};
Parser.prototype.parseClassBody = function () {
var node = this.createNode();
var elementList = this.parseClassElementList();
return this.finalize(node, new Node.ClassBody(elementList));
};
Parser.prototype.parseClassDeclaration = function (identifierIsOptional) {
var node = this.createNode();
var previousStrict = this.context.strict;
this.context.strict = true;
this.expectKeyword('class');
var id = (identifierIsOptional && (this.lookahead.type !== 3 /* Identifier */)) ? null : this.parseVariableIdentifier();
var superClass = null;
if (this.matchKeyword('extends')) {
this.nextToken();
superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall);
}
var classBody = this.parseClassBody();
this.context.strict = previousStrict;
return this.finalize(node, new Node.ClassDeclaration(id, superClass, classBody));
};
Parser.prototype.parseClassExpression = function () {
var node = this.createNode();
var previousStrict = this.context.strict;
this.context.strict = true;
this.expectKeyword('class');
var id = (this.lookahead.type === 3 /* Identifier */) ? this.parseVariableIdentifier() : null;
var superClass = null;
if (this.matchKeyword('extends')) {
this.nextToken();
superClass = this.isolateCoverGrammar(this.parseLeftHandSideExpressionAllowCall);
}
var classBody = this.parseClassBody();
this.context.strict = previousStrict;
return this.finalize(node, new Node.ClassExpression(id, superClass, classBody));
};
// https://tc39.github.io/ecma262/#sec-scripts
// https://tc39.github.io/ecma262/#sec-modules
Parser.prototype.parseModule = function () {
this.context.strict = true;
this.context.isModule = true;
this.scanner.isModule = true;
var node = this.createNode();
var body = this.parseDirectivePrologues();
while (this.lookahead.type !== 2 /* EOF */) {
body.push(this.parseStatementListItem());
}
return this.finalize(node, new Node.Module(body));
};
Parser.prototype.parseScript = function () {
var node = this.createNode();
var body = this.parseDirectivePrologues();
while (this.lookahead.type !== 2 /* EOF */) {
body.push(this.parseStatementListItem());
}
return this.finalize(node, new Node.Script(body));
};
// https://tc39.github.io/ecma262/#sec-imports
Parser.prototype.parseModuleSpecifier = function () {
var node = this.createNode();
if (this.lookahead.type !== 8 /* StringLiteral */) {
this.throwError(messages_1.Messages.InvalidModuleSpecifier);
}
var token = this.nextToken();
var raw = this.getTokenRaw(token);
return this.finalize(node, new Node.Literal(token.value, raw));
};
// import {<foo as bar>} ...;
Parser.prototype.parseImportSpecifier = function () {
var node = this.createNode();
var imported;
var local;
if (this.lookahead.type === 3 /* Identifier */) {
imported = this.parseVariableIdentifier();
local = imported;
if (this.matchContextualKeyword('as')) {
this.nextToken();
local = this.parseVariableIdentifier();
}
}
else {
imported = this.parseIdentifierName();
local = imported;
if (this.matchContextualKeyword('as')) {
this.nextToken();
local = this.parseVariableIdentifier();
}
else {
this.throwUnexpectedToken(this.nextToken());
}
}
return this.finalize(node, new Node.ImportSpecifier(local, imported));
};
// {foo, bar as bas}
Parser.prototype.parseNamedImports = function () {
this.expect('{');
var specifiers = [];
while (!this.match('}')) {
specifiers.push(this.parseImportSpecifier());
if (!this.match('}')) {
this.expect(',');
}
}
this.expect('}');
return specifiers;
};
// import <foo> ...;
Parser.prototype.parseImportDefaultSpecifier = function () {
var node = this.createNode();
var local = this.parseIdentifierName();
return this.finalize(node, new Node.ImportDefaultSpecifier(local));
};
// import <* as foo> ...;
Parser.prototype.parseImportNamespaceSpecifier = function () {
var node = this.createNode();
this.expect('*');
if (!this.matchContextualKeyword('as')) {
this.throwError(messages_1.Messages.NoAsAfterImportNamespace);
}
this.nextToken();
var local = this.parseIdentifierName();
return this.finalize(node, new Node.ImportNamespaceSpecifier(local));
};
Parser.prototype.parseImportDeclaration = function () {
if (this.context.inFunctionBody) {
this.throwError(messages_1.Messages.IllegalImportDeclaration);
}
var node = this.createNode();
this.expectKeyword('import');
var src;
var specifiers = [];
if (this.lookahead.type === 8 /* StringLiteral */) {
// import 'foo';
src = this.parseModuleSpecifier();
}
else {
if (this.match('{')) {
// import {bar}
specifiers = specifiers.concat(this.parseNamedImports());
}
else if (this.match('*')) {
// import * as foo
specifiers.push(this.parseImportNamespaceSpecifier());
}
else if (this.isIdentifierName(this.lookahead) && !this.matchKeyword('default')) {
// import foo
specifiers.push(this.parseImportDefaultSpecifier());
if (this.match(',')) {
this.nextToken();
if (this.match('*')) {
// import foo, * as foo
specifiers.push(this.parseImportNamespaceSpecifier());
}
else if (this.match('{')) {
// import foo, {bar}
specifiers = specifiers.concat(this.parseNamedImports());
}
else {
this.throwUnexpectedToken(this.lookahead);
}
}
}
else {
this.throwUnexpectedToken(this.nextToken());
}
if (!this.matchContextualKeyword('from')) {
var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause;
this.throwError(message, this.lookahead.value);
}
this.nextToken();
src = this.parseModuleSpecifier();
}
this.consumeSemicolon();
return this.finalize(node, new Node.ImportDeclaration(specifiers, src));
};
// https://tc39.github.io/ecma262/#sec-exports
Parser.prototype.parseExportSpecifier = function () {
var node = this.createNode();
var local = this.parseIdentifierName();
var exported = local;
if (this.matchContextualKeyword('as')) {
this.nextToken();
exported = this.parseIdentifierName();
}
return this.finalize(node, new Node.ExportSpecifier(local, exported));
};
Parser.prototype.parseExportDeclaration = function () {
if (this.context.inFunctionBody) {
this.throwError(messages_1.Messages.IllegalExportDeclaration);
}
var node = this.createNode();
this.expectKeyword('export');
var exportDeclaration;
if (this.matchKeyword('default')) {
// export default ...
this.nextToken();
if (this.matchKeyword('function')) {
// export default function foo () {}
// export default function () {}
var declaration = this.parseFunctionDeclaration(true);
exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration));
}
else if (this.matchKeyword('class')) {
// export default class foo {}
var declaration = this.parseClassDeclaration(true);
exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration));
}
else if (this.matchContextualKeyword('async')) {
// export default async function f () {}
// export default async function () {}
// export default async x => x
var declaration = this.matchAsyncFunction() ? this.parseFunctionDeclaration(true) : this.parseAssignmentExpression();
exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration));
}
else {
if (this.matchContextualKeyword('from')) {
this.throwError(messages_1.Messages.UnexpectedToken, this.lookahead.value);
}
// export default {};
// export default [];
// export default (1 + 2);
var declaration = this.match('{') ? this.parseObjectInitializer() :
this.match('[') ? this.parseArrayInitializer() : this.parseAssignmentExpression();
this.consumeSemicolon();
exportDeclaration = this.finalize(node, new Node.ExportDefaultDeclaration(declaration));
}
}
else if (this.match('*')) {
// export * from 'foo';
this.nextToken();
if (!this.matchContextualKeyword('from')) {
var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause;
this.throwError(message, this.lookahead.value);
}
this.nextToken();
var src = this.parseModuleSpecifier();
this.consumeSemicolon();
exportDeclaration = this.finalize(node, new Node.ExportAllDeclaration(src));
}
else if (this.lookahead.type === 4 /* Keyword */) {
// export var f = 1;
var declaration = void 0;
switch (this.lookahead.value) {
case 'let':
case 'const':
declaration = this.parseLexicalDeclaration({ inFor: false });
break;
case 'var':
case 'class':
case 'function':
declaration = this.parseStatementListItem();
break;
default:
this.throwUnexpectedToken(this.lookahead);
}
exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null));
}
else if (this.matchAsyncFunction()) {
var declaration = this.parseFunctionDeclaration();
exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(declaration, [], null));
}
else {
var specifiers = [];
var source = null;
var isExportFromIdentifier = false;
this.expect('{');
while (!this.match('}')) {
isExportFromIdentifier = isExportFromIdentifier || this.matchKeyword('default');
specifiers.push(this.parseExportSpecifier());
if (!this.match('}')) {
this.expect(',');
}
}
this.expect('}');
if (this.matchContextualKeyword('from')) {
// export {default} from 'foo';
// export {foo} from 'foo';
this.nextToken();
source = this.parseModuleSpecifier();
this.consumeSemicolon();
}
else if (isExportFromIdentifier) {
// export {default}; // missing fromClause
var message = this.lookahead.value ? messages_1.Messages.UnexpectedToken : messages_1.Messages.MissingFromClause;
this.throwError(message, this.lookahead.value);
}
else {
// export {foo};
this.consumeSemicolon();
}
exportDeclaration = this.finalize(node, new Node.ExportNamedDeclaration(null, specifiers, source));
}
return exportDeclaration;
};
return Parser;
}());
exports.Parser = Parser;
/***/ },
/* 9 */
/***/ function(module, exports) {
"use strict";
// Ensure the condition is true, otherwise throw an error.
// This is only to have a better contract semantic, i.e. another safety net
// to catch a logic error. The condition shall be fulfilled in normal case.
// Do NOT use this to enforce a certain condition on any user input.
Object.defineProperty(exports, "__esModule", { value: true });
function assert(condition, message) {
/* istanbul ignore if */
if (!condition) {
throw new Error('ASSERT: ' + message);
}
}
exports.assert = assert;
/***/ },
/* 10 */
/***/ function(module, exports) {
"use strict";
/* tslint:disable:max-classes-per-file */
Object.defineProperty(exports, "__esModule", { value: true });
var ErrorHandler = (function () {
function ErrorHandler() {
this.errors = [];
this.tolerant = false;
}
ErrorHandler.prototype.recordError = function (error) {
this.errors.push(error);
};
ErrorHandler.prototype.tolerate = function (error) {
if (this.tolerant) {
this.recordError(error);
}
else {
throw error;
}
};
ErrorHandler.prototype.constructError = function (msg, column) {
var error = new Error(msg);
try {
throw error;
}
catch (base) {
/* istanbul ignore else */
if (Object.create && Object.defineProperty) {
error = Object.create(base);
Object.defineProperty(error, 'column', { value: column });
}
}
/* istanbul ignore next */
return error;
};
ErrorHandler.prototype.createError = function (index, line, col, description) {
var msg = 'Line ' + line + ': ' + description;
var error = this.constructError(msg, col);
error.index = index;
error.lineNumber = line;
error.description = description;
return error;
};
ErrorHandler.prototype.throwError = function (index, line, col, description) {
throw this.createError(index, line, col, description);
};
ErrorHandler.prototype.tolerateError = function (index, line, col, description) {
var error = this.createError(index, line, col, description);
if (this.tolerant) {
this.recordError(error);
}
else {
throw error;
}
};
return ErrorHandler;
}());
exports.ErrorHandler = ErrorHandler;
/***/ },
/* 11 */
/***/ function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
// Error messages should be identical to V8.
exports.Messages = {
BadGetterArity: 'Getter must not have any formal parameters',
BadSetterArity: 'Setter must have exactly one formal parameter',
BadSetterRestParameter: 'Setter function argument must not be a rest parameter',
ConstructorIsAsync: 'Class constructor may not be an async method',
ConstructorSpecialMethod: 'Class constructor may not be an accessor',
DeclarationMissingInitializer: 'Missing initializer in %0 declaration',
DefaultRestParameter: 'Unexpected token =',
DuplicateBinding: 'Duplicate binding %0',
DuplicateConstructor: 'A class may only have one constructor',
DuplicateProtoProperty: 'Duplicate __proto__ fields are not allowed in object literals',
ForInOfLoopInitializer: '%0 loop variable declaration may not have an initializer',
GeneratorInLegacyContext: 'Generator declarations are not allowed in legacy contexts',
IllegalBreak: 'Illegal break statement',
IllegalContinue: 'Illegal continue statement',
IllegalExportDeclaration: 'Unexpected token',
IllegalImportDeclaration: 'Unexpected token',
IllegalLanguageModeDirective: 'Illegal \'use strict\' directive in function with non-simple parameter list',
IllegalReturn: 'Illegal return statement',
InvalidEscapedReservedWord: 'Keyword must not contain escaped characters',
InvalidHexEscapeSequence: 'Invalid hexadecimal escape sequence',
InvalidLHSInAssignment: 'Invalid left-hand side in assignment',
InvalidLHSInForIn: 'Invalid left-hand side in for-in',
InvalidLHSInForLoop: 'Invalid left-hand side in for-loop',
InvalidModuleSpecifier: 'Unexpected token',
InvalidRegExp: 'Invalid regular expression',
LetInLexicalBinding: 'let is disallowed as a lexically bound name',
MissingFromClause: 'Unexpected token',
MultipleDefaultsInSwitch: 'More than one default clause in switch statement',
NewlineAfterThrow: 'Illegal newline after throw',
NoAsAfterImportNamespace: 'Unexpected token',
NoCatchOrFinally: 'Missing catch or finally after try',
ParameterAfterRestParameter: 'Rest parameter must be last formal parameter',
Redeclaration: '%0 \'%1\' has already been declared',
StaticPrototype: 'Classes may not have static property named prototype',
StrictCatchVariable: 'Catch variable may not be eval or arguments in strict mode',
StrictDelete: 'Delete of an unqualified identifier in strict mode.',
StrictFunction: 'In strict mode code, functions can only be declared at top level or inside a block',
StrictFunctionName: 'Function name may not be eval or arguments in strict mode',
StrictLHSAssignment: 'Assignment to eval or arguments is not allowed in strict mode',
StrictLHSPostfix: 'Postfix increment/decrement may not have eval or arguments operand in strict mode',
StrictLHSPrefix: 'Prefix increment/decrement may not have eval or arguments operand in strict mode',
StrictModeWith: 'Strict mode code may not include a with statement',
StrictOctalLiteral: 'Octal literals are not allowed in strict mode.',
StrictParamDupe: 'Strict mode function may not have duplicate parameter names',
StrictParamName: 'Parameter name eval or arguments is not allowed in strict mode',
StrictReservedWord: 'Use of future reserved word in strict mode',
StrictVarName: 'Variable name may not be eval or arguments in strict mode',
TemplateOctalLiteral: 'Octal literals are not allowed in template strings.',
UnexpectedEOS: 'Unexpected end of input',
UnexpectedIdentifier: 'Unexpected identifier',
UnexpectedNumber: 'Unexpected number',
UnexpectedReserved: 'Unexpected reserved word',
UnexpectedString: 'Unexpected string',
UnexpectedTemplate: 'Unexpected quasi %0',
UnexpectedToken: 'Unexpected token %0',
UnexpectedTokenIllegal: 'Unexpected token ILLEGAL',
UnknownLabel: 'Undefined label \'%0\'',
UnterminatedRegExp: 'Invalid regular expression: missing /'
};
/***/ },
/* 12 */
/***/ function(module, exports, __nested_webpack_require_226595__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var assert_1 = __nested_webpack_require_226595__(9);
var character_1 = __nested_webpack_require_226595__(4);
var messages_1 = __nested_webpack_require_226595__(11);
function hexValue(ch) {
return '0123456789abcdef'.indexOf(ch.toLowerCase());
}
function octalValue(ch) {
return '01234567'.indexOf(ch);
}
var Scanner = (function () {
function Scanner(code, handler) {
this.source = code;
this.errorHandler = handler;
this.trackComment = false;
this.isModule = false;
this.length = code.length;
this.index = 0;
this.lineNumber = (code.length > 0) ? 1 : 0;
this.lineStart = 0;
this.curlyStack = [];
}
Scanner.prototype.saveState = function () {
return {
index: this.index,
lineNumber: this.lineNumber,
lineStart: this.lineStart
};
};
Scanner.prototype.restoreState = function (state) {
this.index = state.index;
this.lineNumber = state.lineNumber;
this.lineStart = state.lineStart;
};
Scanner.prototype.eof = function () {
return this.index >= this.length;
};
Scanner.prototype.throwUnexpectedToken = function (message) {
if (message === void 0) { message = messages_1.Messages.UnexpectedTokenIllegal; }
return this.errorHandler.throwError(this.index, this.lineNumber, this.index - this.lineStart + 1, message);
};
Scanner.prototype.tolerateUnexpectedToken = function (message) {
if (message === void 0) { message = messages_1.Messages.UnexpectedTokenIllegal; }
this.errorHandler.tolerateError(this.index, this.lineNumber, this.index - this.lineStart + 1, message);
};
// https://tc39.github.io/ecma262/#sec-comments
Scanner.prototype.skipSingleLineComment = function (offset) {
var comments = [];
var start, loc;
if (this.trackComment) {
comments = [];
start = this.index - offset;
loc = {
start: {
line: this.lineNumber,
column: this.index - this.lineStart - offset
},
end: {}
};
}
while (!this.eof()) {
var ch = this.source.charCodeAt(this.index);
++this.index;
if (character_1.Character.isLineTerminator(ch)) {
if (this.trackComment) {
loc.end = {
line: this.lineNumber,
column: this.index - this.lineStart - 1
};
var entry = {
multiLine: false,
slice: [start + offset, this.index - 1],
range: [start, this.index - 1],
loc: loc
};
comments.push(entry);
}
if (ch === 13 && this.source.charCodeAt(this.index) === 10) {
++this.index;
}
++this.lineNumber;
this.lineStart = this.index;
return comments;
}
}
if (this.trackComment) {
loc.end = {
line: this.lineNumber,
column: this.index - this.lineStart
};
var entry = {
multiLine: false,
slice: [start + offset, this.index],
range: [start, this.index],
loc: loc
};
comments.push(entry);
}
return comments;
};
Scanner.prototype.skipMultiLineComment = function () {
var comments = [];
var start, loc;
if (this.trackComment) {
comments = [];
start = this.index - 2;
loc = {
start: {
line: this.lineNumber,
column: this.index - this.lineStart - 2
},
end: {}
};
}
while (!this.eof()) {
var ch = this.source.charCodeAt(this.index);
if (character_1.Character.isLineTerminator(ch)) {
if (ch === 0x0D && this.source.charCodeAt(this.index + 1) === 0x0A) {
++this.index;
}
++this.lineNumber;
++this.index;
this.lineStart = this.index;
}
else if (ch === 0x2A) {
// Block comment ends with '*/'.
if (this.source.charCodeAt(this.index + 1) === 0x2F) {
this.index += 2;
if (this.trackComment) {
loc.end = {
line: this.lineNumber,
column: this.index - this.lineStart
};
var entry = {
multiLine: true,
slice: [start + 2, this.index - 2],
range: [start, this.index],
loc: loc
};
comments.push(entry);
}
return comments;
}
++this.index;
}
else {
++this.index;
}
}
// Ran off the end of the file - the whole thing is a comment
if (this.trackComment) {
loc.end = {
line: this.lineNumber,
column: this.index - this.lineStart
};
var entry = {
multiLine: true,
slice: [start + 2, this.index],
range: [start, this.index],
loc: loc
};
comments.push(entry);
}
this.tolerateUnexpectedToken();
return comments;
};
Scanner.prototype.scanComments = function () {
var comments;
if (this.trackComment) {
comments = [];
}
var start = (this.index === 0);
while (!this.eof()) {
var ch = this.source.charCodeAt(this.index);
if (character_1.Character.isWhiteSpace(ch)) {
++this.index;
}
else if (character_1.Character.isLineTerminator(ch)) {
++this.index;
if (ch === 0x0D && this.source.charCodeAt(this.index) === 0x0A) {
++this.index;
}
++this.lineNumber;
this.lineStart = this.index;
start = true;
}
else if (ch === 0x2F) {
ch = this.source.charCodeAt(this.index + 1);
if (ch === 0x2F) {
this.index += 2;
var comment = this.skipSingleLineComment(2);
if (this.trackComment) {
comments = comments.concat(comment);
}
start = true;
}
else if (ch === 0x2A) {
this.index += 2;
var comment = this.skipMultiLineComment();
if (this.trackComment) {
comments = comments.concat(comment);
}
}
else {
break;
}
}
else if (start && ch === 0x2D) {
// U+003E is '>'
if ((this.source.charCodeAt(this.index + 1) === 0x2D) && (this.source.charCodeAt(this.index + 2) === 0x3E)) {
// '-->' is a single-line comment
this.index += 3;
var comment = this.skipSingleLineComment(3);
if (this.trackComment) {
comments = comments.concat(comment);
}
}
else {
break;
}
}
else if (ch === 0x3C && !this.isModule) {
if (this.source.slice(this.index + 1, this.index + 4) === '!--') {
this.index += 4; // `<!--`
var comment = this.skipSingleLineComment(4);
if (this.trackComment) {
comments = comments.concat(comment);
}
}
else {
break;
}
}
else {
break;
}
}
return comments;
};
// https://tc39.github.io/ecma262/#sec-future-reserved-words
Scanner.prototype.isFutureReservedWord = function (id) {
switch (id) {
case 'enum':
case 'export':
case 'import':
case 'super':
return true;
default:
return false;
}
};
Scanner.prototype.isStrictModeReservedWord = function (id) {
switch (id) {
case 'implements':
case 'interface':
case 'package':
case 'private':
case 'protected':
case 'public':
case 'static':
case 'yield':
case 'let':
return true;
default:
return false;
}
};
Scanner.prototype.isRestrictedWord = function (id) {
return id === 'eval' || id === 'arguments';
};
// https://tc39.github.io/ecma262/#sec-keywords
Scanner.prototype.isKeyword = function (id) {
switch (id.length) {
case 2:
return (id === 'if') || (id === 'in') || (id === 'do');
case 3:
return (id === 'var') || (id === 'for') || (id === 'new') ||
(id === 'try') || (id === 'let');
case 4:
return (id === 'this') || (id === 'else') || (id === 'case') ||
(id === 'void') || (id === 'with') || (id === 'enum');
case 5:
return (id === 'while') || (id === 'break') || (id === 'catch') ||
(id === 'throw') || (id === 'const') || (id === 'yield') ||
(id === 'class') || (id === 'super');
case 6:
return (id === 'return') || (id === 'typeof') || (id === 'delete') ||
(id === 'switch') || (id === 'export') || (id === 'import');
case 7:
return (id === 'default') || (id === 'finally') || (id === 'extends');
case 8:
return (id === 'function') || (id === 'continue') || (id === 'debugger');
case 10:
return (id === 'instanceof');
default:
return false;
}
};
Scanner.prototype.codePointAt = function (i) {
var cp = this.source.charCodeAt(i);
if (cp >= 0xD800 && cp <= 0xDBFF) {
var second = this.source.charCodeAt(i + 1);
if (second >= 0xDC00 && second <= 0xDFFF) {
var first = cp;
cp = (first - 0xD800) * 0x400 + second - 0xDC00 + 0x10000;
}
}
return cp;
};
Scanner.prototype.scanHexEscape = function (prefix) {
var len = (prefix === 'u') ? 4 : 2;
var code = 0;
for (var i = 0; i < len; ++i) {
if (!this.eof() && character_1.Character.isHexDigit(this.source.charCodeAt(this.index))) {
code = code * 16 + hexValue(this.source[this.index++]);
}
else {
return null;
}
}
return String.fromCharCode(code);
};
Scanner.prototype.scanUnicodeCodePointEscape = function () {
var ch = this.source[this.index];
var code = 0;
// At least, one hex digit is required.
if (ch === '}') {
this.throwUnexpectedToken();
}
while (!this.eof()) {
ch = this.source[this.index++];
if (!character_1.Character.isHexDigit(ch.charCodeAt(0))) {
break;
}
code = code * 16 + hexValue(ch);
}
if (code > 0x10FFFF || ch !== '}') {
this.throwUnexpectedToken();
}
return character_1.Character.fromCodePoint(code);
};
Scanner.prototype.getIdentifier = function () {
var start = this.index++;
while (!this.eof()) {
var ch = this.source.charCodeAt(this.index);
if (ch === 0x5C) {
// Blackslash (U+005C) marks Unicode escape sequence.
this.index = start;
return this.getComplexIdentifier();
}
else if (ch >= 0xD800 && ch < 0xDFFF) {
// Need to handle surrogate pairs.
this.index = start;
return this.getComplexIdentifier();
}
if (character_1.Character.isIdentifierPart(ch)) {
++this.index;
}
else {
break;
}
}
return this.source.slice(start, this.index);
};
Scanner.prototype.getComplexIdentifier = function () {
var cp = this.codePointAt(this.index);
var id = character_1.Character.fromCodePoint(cp);
this.index += id.length;
// '\u' (U+005C, U+0075) denotes an escaped character.
var ch;
if (cp === 0x5C) {
if (this.source.charCodeAt(this.index) !== 0x75) {
this.throwUnexpectedToken();
}
++this.index;
if (this.source[this.index] === '{') {
++this.index;
ch = this.scanUnicodeCodePointEscape();
}
else {
ch = this.scanHexEscape('u');
if (ch === null || ch === '\\' || !character_1.Character.isIdentifierStart(ch.charCodeAt(0))) {
this.throwUnexpectedToken();
}
}
id = ch;
}
while (!this.eof()) {
cp = this.codePointAt(this.index);
if (!character_1.Character.isIdentifierPart(cp)) {
break;
}
ch = character_1.Character.fromCodePoint(cp);
id += ch;
this.index += ch.length;
// '\u' (U+005C, U+0075) denotes an escaped character.
if (cp === 0x5C) {
id = id.substr(0, id.length - 1);
if (this.source.charCodeAt(this.index) !== 0x75) {
this.throwUnexpectedToken();
}
++this.index;
if (this.source[this.index] === '{') {
++this.index;
ch = this.scanUnicodeCodePointEscape();
}
else {
ch = this.scanHexEscape('u');
if (ch === null || ch === '\\' || !character_1.Character.isIdentifierPart(ch.charCodeAt(0))) {
this.throwUnexpectedToken();
}
}
id += ch;
}
}
return id;
};
Scanner.prototype.octalToDecimal = function (ch) {
// \0 is not octal escape sequence
var octal = (ch !== '0');
var code = octalValue(ch);
if (!this.eof() && character_1.Character.isOctalDigit(this.source.charCodeAt(this.index))) {
octal = true;
code = code * 8 + octalValue(this.source[this.index++]);
// 3 digits are only allowed when string starts
// with 0, 1, 2, 3
if ('0123'.indexOf(ch) >= 0 && !this.eof() && character_1.Character.isOctalDigit(this.source.charCodeAt(this.index))) {
code = code * 8 + octalValue(this.source[this.index++]);
}
}
return {
code: code,
octal: octal
};
};
// https://tc39.github.io/ecma262/#sec-names-and-keywords
Scanner.prototype.scanIdentifier = function () {
var type;
var start = this.index;
// Backslash (U+005C) starts an escaped character.
var id = (this.source.charCodeAt(start) === 0x5C) ? this.getComplexIdentifier() : this.getIdentifier();
// There is no keyword or literal with only one character.
// Thus, it must be an identifier.
if (id.length === 1) {
type = 3 /* Identifier */;
}
else if (this.isKeyword(id)) {
type = 4 /* Keyword */;
}
else if (id === 'null') {
type = 5 /* NullLiteral */;
}
else if (id === 'true' || id === 'false') {
type = 1 /* BooleanLiteral */;
}
else {
type = 3 /* Identifier */;
}
if (type !== 3 /* Identifier */ && (start + id.length !== this.index)) {
var restore = this.index;
this.index = start;
this.tolerateUnexpectedToken(messages_1.Messages.InvalidEscapedReservedWord);
this.index = restore;
}
return {
type: type,
value: id,
lineNumber: this.lineNumber,
lineStart: this.lineStart,
start: start,
end: this.index
};
};
// https://tc39.github.io/ecma262/#sec-punctuators
Scanner.prototype.scanPunctuator = function () {
var start = this.index;
// Check for most common single-character punctuators.
var str = this.source[this.index];
switch (str) {
case '(':
case '{':
if (str === '{') {
this.curlyStack.push('{');
}
++this.index;
break;
case '.':
++this.index;
if (this.source[this.index] === '.' && this.source[this.index + 1] === '.') {
// Spread operator: ...
this.index += 2;
str = '...';
}
break;
case '}':
++this.index;
this.curlyStack.pop();
break;
case ')':
case ';':
case ',':
case '[':
case ']':
case ':':
case '?':
case '~':
++this.index;
break;
default:
// 4-character punctuator.
str = this.source.substr(this.index, 4);
if (str === '>>>=') {
this.index += 4;
}
else {
// 3-character punctuators.
str = str.substr(0, 3);
if (str === '===' || str === '!==' || str === '>>>' ||
str === '<<=' || str === '>>=' || str === '**=') {
this.index += 3;
}
else {
// 2-character punctuators.
str = str.substr(0, 2);
if (str === '&&' || str === '||' || str === '==' || str === '!=' ||
str === '+=' || str === '-=' || str === '*=' || str === '/=' ||
str === '++' || str === '--' || str === '<<' || str === '>>' ||
str === '&=' || str === '|=' || str === '^=' || str === '%=' ||
str === '<=' || str === '>=' || str === '=>' || str === '**') {
this.index += 2;
}
else {
// 1-character punctuators.
str = this.source[this.index];
if ('<>=!+-*%&|^/'.indexOf(str) >= 0) {
++this.index;
}
}
}
}
}
if (this.index === start) {
this.throwUnexpectedToken();
}
return {
type: 7 /* Punctuator */,
value: str,
lineNumber: this.lineNumber,
lineStart: this.lineStart,
start: start,
end: this.index
};
};
// https://tc39.github.io/ecma262/#sec-literals-numeric-literals
Scanner.prototype.scanHexLiteral = function (start) {
var num = '';
while (!this.eof()) {
if (!character_1.Character.isHexDigit(this.source.charCodeAt(this.index))) {
break;
}
num += this.source[this.index++];
}
if (num.length === 0) {
this.throwUnexpectedToken();
}
if (character_1.Character.isIdentifierStart(this.source.charCodeAt(this.index))) {
this.throwUnexpectedToken();
}
return {
type: 6 /* NumericLiteral */,
value: parseInt('0x' + num, 16),
lineNumber: this.lineNumber,
lineStart: this.lineStart,
start: start,
end: this.index
};
};
Scanner.prototype.scanBinaryLiteral = function (start) {
var num = '';
var ch;
while (!this.eof()) {
ch = this.source[this.index];
if (ch !== '0' && ch !== '1') {
break;
}
num += this.source[this.index++];
}
if (num.length === 0) {
// only 0b or 0B
this.throwUnexpectedToken();
}
if (!this.eof()) {
ch = this.source.charCodeAt(this.index);
/* istanbul ignore else */
if (character_1.Character.isIdentifierStart(ch) || character_1.Character.isDecimalDigit(ch)) {
this.throwUnexpectedToken();
}
}
return {
type: 6 /* NumericLiteral */,
value: parseInt(num, 2),
lineNumber: this.lineNumber,
lineStart: this.lineStart,
start: start,
end: this.index
};
};
Scanner.prototype.scanOctalLiteral = function (prefix, start) {
var num = '';
var octal = false;
if (character_1.Character.isOctalDigit(prefix.charCodeAt(0))) {
octal = true;
num = '0' + this.source[this.index++];
}
else {
++this.index;
}
while (!this.eof()) {
if (!character_1.Character.isOctalDigit(this.source.charCodeAt(this.index))) {
break;
}
num += this.source[this.index++];
}
if (!octal && num.length === 0) {
// only 0o or 0O
this.throwUnexpectedToken();
}
if (character_1.Character.isIdentifierStart(this.source.charCodeAt(this.index)) || character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
this.throwUnexpectedToken();
}
return {
type: 6 /* NumericLiteral */,
value: parseInt(num, 8),
octal: octal,
lineNumber: this.lineNumber,
lineStart: this.lineStart,
start: start,
end: this.index
};
};
Scanner.prototype.isImplicitOctalLiteral = function () {
// Implicit octal, unless there is a non-octal digit.
// (Annex B.1.1 on Numeric Literals)
for (var i = this.index + 1; i < this.length; ++i) {
var ch = this.source[i];
if (ch === '8' || ch === '9') {
return false;
}
if (!character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
return true;
}
}
return true;
};
Scanner.prototype.scanNumericLiteral = function () {
var start = this.index;
var ch = this.source[start];
assert_1.assert(character_1.Character.isDecimalDigit(ch.charCodeAt(0)) || (ch === '.'), 'Numeric literal must start with a decimal digit or a decimal point');
var num = '';
if (ch !== '.') {
num = this.source[this.index++];
ch = this.source[this.index];
// Hex number starts with '0x'.
// Octal number starts with '0'.
// Octal number in ES6 starts with '0o'.
// Binary number in ES6 starts with '0b'.
if (num === '0') {
if (ch === 'x' || ch === 'X') {
++this.index;
return this.scanHexLiteral(start);
}
if (ch === 'b' || ch === 'B') {
++this.index;
return this.scanBinaryLiteral(start);
}
if (ch === 'o' || ch === 'O') {
return this.scanOctalLiteral(ch, start);
}
if (ch && character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
if (this.isImplicitOctalLiteral()) {
return this.scanOctalLiteral(ch, start);
}
}
}
while (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
num += this.source[this.index++];
}
ch = this.source[this.index];
}
if (ch === '.') {
num += this.source[this.index++];
while (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
num += this.source[this.index++];
}
ch = this.source[this.index];
}
if (ch === 'e' || ch === 'E') {
num += this.source[this.index++];
ch = this.source[this.index];
if (ch === '+' || ch === '-') {
num += this.source[this.index++];
}
if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
while (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
num += this.source[this.index++];
}
}
else {
this.throwUnexpectedToken();
}
}
if (character_1.Character.isIdentifierStart(this.source.charCodeAt(this.index))) {
this.throwUnexpectedToken();
}
return {
type: 6 /* NumericLiteral */,
value: parseFloat(num),
lineNumber: this.lineNumber,
lineStart: this.lineStart,
start: start,
end: this.index
};
};
// https://tc39.github.io/ecma262/#sec-literals-string-literals
Scanner.prototype.scanStringLiteral = function () {
var start = this.index;
var quote = this.source[start];
assert_1.assert((quote === '\'' || quote === '"'), 'String literal must starts with a quote');
++this.index;
var octal = false;
var str = '';
while (!this.eof()) {
var ch = this.source[this.index++];
if (ch === quote) {
quote = '';
break;
}
else if (ch === '\\') {
ch = this.source[this.index++];
if (!ch || !character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
switch (ch) {
case 'u':
if (this.source[this.index] === '{') {
++this.index;
str += this.scanUnicodeCodePointEscape();
}
else {
var unescaped_1 = this.scanHexEscape(ch);
if (unescaped_1 === null) {
this.throwUnexpectedToken();
}
str += unescaped_1;
}
break;
case 'x':
var unescaped = this.scanHexEscape(ch);
if (unescaped === null) {
this.throwUnexpectedToken(messages_1.Messages.InvalidHexEscapeSequence);
}
str += unescaped;
break;
case 'n':
str += '\n';
break;
case 'r':
str += '\r';
break;
case 't':
str += '\t';
break;
case 'b':
str += '\b';
break;
case 'f':
str += '\f';
break;
case 'v':
str += '\x0B';
break;
case '8':
case '9':
str += ch;
this.tolerateUnexpectedToken();
break;
default:
if (ch && character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
var octToDec = this.octalToDecimal(ch);
octal = octToDec.octal || octal;
str += String.fromCharCode(octToDec.code);
}
else {
str += ch;
}
break;
}
}
else {
++this.lineNumber;
if (ch === '\r' && this.source[this.index] === '\n') {
++this.index;
}
this.lineStart = this.index;
}
}
else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
break;
}
else {
str += ch;
}
}
if (quote !== '') {
this.index = start;
this.throwUnexpectedToken();
}
return {
type: 8 /* StringLiteral */,
value: str,
octal: octal,
lineNumber: this.lineNumber,
lineStart: this.lineStart,
start: start,
end: this.index
};
};
// https://tc39.github.io/ecma262/#sec-template-literal-lexical-components
Scanner.prototype.scanTemplate = function () {
var cooked = '';
var terminated = false;
var start = this.index;
var head = (this.source[start] === '`');
var tail = false;
var rawOffset = 2;
++this.index;
while (!this.eof()) {
var ch = this.source[this.index++];
if (ch === '`') {
rawOffset = 1;
tail = true;
terminated = true;
break;
}
else if (ch === '$') {
if (this.source[this.index] === '{') {
this.curlyStack.push('${');
++this.index;
terminated = true;
break;
}
cooked += ch;
}
else if (ch === '\\') {
ch = this.source[this.index++];
if (!character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
switch (ch) {
case 'n':
cooked += '\n';
break;
case 'r':
cooked += '\r';
break;
case 't':
cooked += '\t';
break;
case 'u':
if (this.source[this.index] === '{') {
++this.index;
cooked += this.scanUnicodeCodePointEscape();
}
else {
var restore = this.index;
var unescaped_2 = this.scanHexEscape(ch);
if (unescaped_2 !== null) {
cooked += unescaped_2;
}
else {
this.index = restore;
cooked += ch;
}
}
break;
case 'x':
var unescaped = this.scanHexEscape(ch);
if (unescaped === null) {
this.throwUnexpectedToken(messages_1.Messages.InvalidHexEscapeSequence);
}
cooked += unescaped;
break;
case 'b':
cooked += '\b';
break;
case 'f':
cooked += '\f';
break;
case 'v':
cooked += '\v';
break;
default:
if (ch === '0') {
if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index))) {
// Illegal: \01 \02 and so on
this.throwUnexpectedToken(messages_1.Messages.TemplateOctalLiteral);
}
cooked += '\0';
}
else if (character_1.Character.isOctalDigit(ch.charCodeAt(0))) {
// Illegal: \1 \2
this.throwUnexpectedToken(messages_1.Messages.TemplateOctalLiteral);
}
else {
cooked += ch;
}
break;
}
}
else {
++this.lineNumber;
if (ch === '\r' && this.source[this.index] === '\n') {
++this.index;
}
this.lineStart = this.index;
}
}
else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
++this.lineNumber;
if (ch === '\r' && this.source[this.index] === '\n') {
++this.index;
}
this.lineStart = this.index;
cooked += '\n';
}
else {
cooked += ch;
}
}
if (!terminated) {
this.throwUnexpectedToken();
}
if (!head) {
this.curlyStack.pop();
}
return {
type: 10 /* Template */,
value: this.source.slice(start + 1, this.index - rawOffset),
cooked: cooked,
head: head,
tail: tail,
lineNumber: this.lineNumber,
lineStart: this.lineStart,
start: start,
end: this.index
};
};
// https://tc39.github.io/ecma262/#sec-literals-regular-expression-literals
Scanner.prototype.testRegExp = function (pattern, flags) {
// The BMP character to use as a replacement for astral symbols when
// translating an ES6 "u"-flagged pattern to an ES5-compatible
// approximation.
// Note: replacing with '\uFFFF' enables false positives in unlikely
// scenarios. For example, `[\u{1044f}-\u{10440}]` is an invalid
// pattern that would not be detected by this substitution.
var astralSubstitute = '\uFFFF';
var tmp = pattern;
var self = this;
if (flags.indexOf('u') >= 0) {
tmp = tmp
.replace(/\\u\{([0-9a-fA-F]+)\}|\\u([a-fA-F0-9]{4})/g, function ($0, $1, $2) {
var codePoint = parseInt($1 || $2, 16);
if (codePoint > 0x10FFFF) {
self.throwUnexpectedToken(messages_1.Messages.InvalidRegExp);
}
if (codePoint <= 0xFFFF) {
return String.fromCharCode(codePoint);
}
return astralSubstitute;
})
.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, astralSubstitute);
}
// First, detect invalid regular expressions.
try {
RegExp(tmp);
}
catch (e) {
this.throwUnexpectedToken(messages_1.Messages.InvalidRegExp);
}
// Return a regular expression object for this pattern-flag pair, or
// `null` in case the current environment doesn't support the flags it
// uses.
try {
return new RegExp(pattern, flags);
}
catch (exception) {
/* istanbul ignore next */
return null;
}
};
Scanner.prototype.scanRegExpBody = function () {
var ch = this.source[this.index];
assert_1.assert(ch === '/', 'Regular expression literal must start with a slash');
var str = this.source[this.index++];
var classMarker = false;
var terminated = false;
while (!this.eof()) {
ch = this.source[this.index++];
str += ch;
if (ch === '\\') {
ch = this.source[this.index++];
// https://tc39.github.io/ecma262/#sec-literals-regular-expression-literals
if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp);
}
str += ch;
}
else if (character_1.Character.isLineTerminator(ch.charCodeAt(0))) {
this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp);
}
else if (classMarker) {
if (ch === ']') {
classMarker = false;
}
}
else {
if (ch === '/') {
terminated = true;
break;
}
else if (ch === '[') {
classMarker = true;
}
}
}
if (!terminated) {
this.throwUnexpectedToken(messages_1.Messages.UnterminatedRegExp);
}
// Exclude leading and trailing slash.
return str.substr(1, str.length - 2);
};
Scanner.prototype.scanRegExpFlags = function () {
var str = '';
var flags = '';
while (!this.eof()) {
var ch = this.source[this.index];
if (!character_1.Character.isIdentifierPart(ch.charCodeAt(0))) {
break;
}
++this.index;
if (ch === '\\' && !this.eof()) {
ch = this.source[this.index];
if (ch === 'u') {
++this.index;
var restore = this.index;
var char = this.scanHexEscape('u');
if (char !== null) {
flags += char;
for (str += '\\u'; restore < this.index; ++restore) {
str += this.source[restore];
}
}
else {
this.index = restore;
flags += 'u';
str += '\\u';
}
this.tolerateUnexpectedToken();
}
else {
str += '\\';
this.tolerateUnexpectedToken();
}
}
else {
flags += ch;
str += ch;
}
}
return flags;
};
Scanner.prototype.scanRegExp = function () {
var start = this.index;
var pattern = this.scanRegExpBody();
var flags = this.scanRegExpFlags();
var value = this.testRegExp(pattern, flags);
return {
type: 9 /* RegularExpression */,
value: '',
pattern: pattern,
flags: flags,
regex: value,
lineNumber: this.lineNumber,
lineStart: this.lineStart,
start: start,
end: this.index
};
};
Scanner.prototype.lex = function () {
if (this.eof()) {
return {
type: 2 /* EOF */,
value: '',
lineNumber: this.lineNumber,
lineStart: this.lineStart,
start: this.index,
end: this.index
};
}
var cp = this.source.charCodeAt(this.index);
if (character_1.Character.isIdentifierStart(cp)) {
return this.scanIdentifier();
}
// Very common: ( and ) and ;
if (cp === 0x28 || cp === 0x29 || cp === 0x3B) {
return this.scanPunctuator();
}
// String literal starts with single quote (U+0027) or double quote (U+0022).
if (cp === 0x27 || cp === 0x22) {
return this.scanStringLiteral();
}
// Dot (.) U+002E can also start a floating-point number, hence the need
// to check the next character.
if (cp === 0x2E) {
if (character_1.Character.isDecimalDigit(this.source.charCodeAt(this.index + 1))) {
return this.scanNumericLiteral();
}
return this.scanPunctuator();
}
if (character_1.Character.isDecimalDigit(cp)) {
return this.scanNumericLiteral();
}
// Template literals start with ` (U+0060) for template head
// or } (U+007D) for template middle or template tail.
if (cp === 0x60 || (cp === 0x7D && this.curlyStack[this.curlyStack.length - 1] === '${')) {
return this.scanTemplate();
}
// Possible identifier start in a surrogate pair.
if (cp >= 0xD800 && cp < 0xDFFF) {
if (character_1.Character.isIdentifierStart(this.codePointAt(this.index))) {
return this.scanIdentifier();
}
}
return this.scanPunctuator();
};
return Scanner;
}());
exports.Scanner = Scanner;
/***/ },
/* 13 */
/***/ function(module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TokenName = {};
exports.TokenName[1 /* BooleanLiteral */] = 'Boolean';
exports.TokenName[2 /* EOF */] = '<end>';
exports.TokenName[3 /* Identifier */] = 'Identifier';
exports.TokenName[4 /* Keyword */] = 'Keyword';
exports.TokenName[5 /* NullLiteral */] = 'Null';
exports.TokenName[6 /* NumericLiteral */] = 'Numeric';
exports.TokenName[7 /* Punctuator */] = 'Punctuator';
exports.TokenName[8 /* StringLiteral */] = 'String';
exports.TokenName[9 /* RegularExpression */] = 'RegularExpression';
exports.TokenName[10 /* Template */] = 'Template';
/***/ },
/* 14 */
/***/ function(module, exports) {
"use strict";
// Generated by generate-xhtml-entities.js. DO NOT MODIFY!
Object.defineProperty(exports, "__esModule", { value: true });
exports.XHTMLEntities = {
quot: '\u0022',
amp: '\u0026',
apos: '\u0027',
gt: '\u003E',
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',
loz: '\u25CA',
spades: '\u2660',
clubs: '\u2663',
hearts: '\u2665',
diams: '\u2666',
lang: '\u27E8',
rang: '\u27E9'
};
/***/ },
/* 15 */
/***/ function(module, exports, __nested_webpack_require_277122__) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var error_handler_1 = __nested_webpack_require_277122__(10);
var scanner_1 = __nested_webpack_require_277122__(12);
var token_1 = __nested_webpack_require_277122__(13);
var Reader = (function () {
function Reader() {
this.values = [];
this.curly = this.paren = -1;
}
// A function following one of those tokens is an expression.
Reader.prototype.beforeFunctionExpression = function (t) {
return ['(', '{', '[', 'in', 'typeof', 'instanceof', 'new',
'return', 'case', 'delete', 'throw', 'void',
// assignment operators
'=', '+=', '-=', '*=', '**=', '/=', '%=', '<<=', '>>=', '>>>=',
'&=', '|=', '^=', ',',
// binary/unary operators
'+', '-', '*', '**', '/', '%', '++', '--', '<<', '>>', '>>>', '&',
'|', '^', '!', '~', '&&', '||', '?', ':', '===', '==', '>=',
'<=', '<', '>', '!=', '!=='].indexOf(t) >= 0;
};
// Determine if forward slash (/) is an operator or part of a regular expression
// https://github.com/mozilla/sweet.js/wiki/design
Reader.prototype.isRegexStart = function () {
var previous = this.values[this.values.length - 1];
var regex = (previous !== null);
switch (previous) {
case 'this':
case ']':
regex = false;
break;
case ')':
var keyword = this.values[this.paren - 1];
regex = (keyword === 'if' || keyword === 'while' || keyword === 'for' || keyword === 'with');
break;
case '}':
// Dividing a function by anything makes little sense,
// but we have to check for that.
regex = false;
if (this.values[this.curly - 3] === 'function') {
// Anonymous function, e.g. function(){} /42
var check = this.values[this.curly - 4];
regex = check ? !this.beforeFunctionExpression(check) : false;
}
else if (this.values[this.curly - 4] === 'function') {
// Named function, e.g. function f(){} /42/
var check = this.values[this.curly - 5];
regex = check ? !this.beforeFunctionExpression(check) : true;
}
break;
default:
break;
}
return regex;
};
Reader.prototype.push = function (token) {
if (token.type === 7 /* Punctuator */ || token.type === 4 /* Keyword */) {
if (token.value === '{') {
this.curly = this.values.length;
}
else if (token.value === '(') {
this.paren = this.values.length;
}
this.values.push(token.value);
}
else {
this.values.push(null);
}
};
return Reader;
}());
var Tokenizer = (function () {
function Tokenizer(code, config) {
this.errorHandler = new error_handler_1.ErrorHandler();
this.errorHandler.tolerant = config ? (typeof config.tolerant === 'boolean' && config.tolerant) : false;
this.scanner = new scanner_1.Scanner(code, this.errorHandler);
this.scanner.trackComment = config ? (typeof config.comment === 'boolean' && config.comment) : false;
this.trackRange = config ? (typeof config.range === 'boolean' && config.range) : false;
this.trackLoc = config ? (typeof config.loc === 'boolean' && config.loc) : false;
this.buffer = [];
this.reader = new Reader();
}
Tokenizer.prototype.errors = function () {
return this.errorHandler.errors;
};
Tokenizer.prototype.getNextToken = function () {
if (this.buffer.length === 0) {
var comments = this.scanner.scanComments();
if (this.scanner.trackComment) {
for (var i = 0; i < comments.length; ++i) {
var e = comments[i];
var value = this.scanner.source.slice(e.slice[0], e.slice[1]);
var comment = {
type: e.multiLine ? 'BlockComment' : 'LineComment',
value: value
};
if (this.trackRange) {
comment.range = e.range;
}
if (this.trackLoc) {
comment.loc = e.loc;
}
this.buffer.push(comment);
}
}
if (!this.scanner.eof()) {
var loc = void 0;
if (this.trackLoc) {
loc = {
start: {
line: this.scanner.lineNumber,
column: this.scanner.index - this.scanner.lineStart
},
end: {}
};
}
var startRegex = (this.scanner.source[this.scanner.index] === '/') && this.reader.isRegexStart();
var token = startRegex ? this.scanner.scanRegExp() : this.scanner.lex();
this.reader.push(token);
var entry = {
type: token_1.TokenName[token.type],
value: this.scanner.source.slice(token.start, token.end)
};
if (this.trackRange) {
entry.range = [token.start, token.end];
}
if (this.trackLoc) {
loc.end = {
line: this.scanner.lineNumber,
column: this.scanner.index - this.scanner.lineStart
};
entry.loc = loc;
}
if (token.type === 9 /* RegularExpression */) {
var pattern = token.pattern;
var flags = token.flags;
entry.regex = { pattern: pattern, flags: flags };
}
this.buffer.push(entry);
}
}
return this.buffer.shift();
};
return Tokenizer;
}());
exports.Tokenizer = Tokenizer;
/***/ }
/******/ ])
});
;
/***/ }),
/***/ "./node_modules/esrecurse/esrecurse.js":
/*!*********************************************!*\
!*** ./node_modules/esrecurse/esrecurse.js ***!
\*********************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/*
Copyright (C) 2014 Yusuke Suzuki <[email protected]>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
(function () {
'use strict';
var estraverse = __webpack_require__(/*! estraverse */ "./node_modules/estraverse/estraverse.js");
function isNode(node) {
if (node == null) {
return false;
}
return typeof node === 'object' && typeof node.type === 'string';
}
function isProperty(nodeType, key) {
return (nodeType === estraverse.Syntax.ObjectExpression || nodeType === estraverse.Syntax.ObjectPattern) && key === 'properties';
}
function Visitor(visitor, options) {
options = options || {};
this.__visitor = visitor || this;
this.__childVisitorKeys = options.childVisitorKeys
? Object.assign({}, estraverse.VisitorKeys, options.childVisitorKeys)
: estraverse.VisitorKeys;
if (options.fallback === 'iteration') {
this.__fallback = Object.keys;
} else if (typeof options.fallback === 'function') {
this.__fallback = options.fallback;
}
}
/* Default method for visiting children.
* When you need to call default visiting operation inside custom visiting
* operation, you can use it with `this.visitChildren(node)`.
*/
Visitor.prototype.visitChildren = function (node) {
var type, children, i, iz, j, jz, child;
if (node == null) {
return;
}
type = node.type || estraverse.Syntax.Property;
children = this.__childVisitorKeys[type];
if (!children) {
if (this.__fallback) {
children = this.__fallback(node);
} else {
throw new Error('Unknown node type ' + type + '.');
}
}
for (i = 0, iz = children.length; i < iz; ++i) {
child = node[children[i]];
if (child) {
if (Array.isArray(child)) {
for (j = 0, jz = child.length; j < jz; ++j) {
if (child[j]) {
if (isNode(child[j]) || isProperty(type, children[i])) {
this.visit(child[j]);
}
}
}
} else if (isNode(child)) {
this.visit(child);
}
}
}
};
/* Dispatching node. */
Visitor.prototype.visit = function (node) {
var type;
if (node == null) {
return;
}
type = node.type || estraverse.Syntax.Property;
if (this.__visitor[type]) {
this.__visitor[type].call(this, node);
return;
}
this.visitChildren(node);
};
exports.version = __webpack_require__(/*! ./package.json */ "./node_modules/esrecurse/package.json").version;
exports.Visitor = Visitor;
exports.visit = function (node, visitor, options) {
var v = new Visitor(visitor, options);
v.visit(node);
};
}());
/* vim: set sw=4 ts=4 et tw=80 : */
/***/ }),
/***/ "./node_modules/esrecurse/package.json":
/*!*********************************************!*\
!*** ./node_modules/esrecurse/package.json ***!
\*********************************************/
/***/ ((module) => {
"use strict";
module.exports = /*#__PURE__*/JSON.parse('{"name":"esrecurse","description":"ECMAScript AST recursive visitor","homepage":"https://github.com/estools/esrecurse","main":"esrecurse.js","version":"4.3.0","engines":{"node":">=4.0"},"maintainers":[{"name":"Yusuke Suzuki","email":"[email protected]","web":"https://github.com/Constellation"}],"repository":{"type":"git","url":"https://github.com/estools/esrecurse.git"},"dependencies":{"estraverse":"^5.2.0"},"devDependencies":{"babel-cli":"^6.24.1","babel-eslint":"^7.2.3","babel-preset-es2015":"^6.24.1","babel-register":"^6.24.1","chai":"^4.0.2","esprima":"^4.0.0","gulp":"^3.9.0","gulp-bump":"^2.7.0","gulp-eslint":"^4.0.0","gulp-filter":"^5.0.0","gulp-git":"^2.4.1","gulp-mocha":"^4.3.1","gulp-tag-version":"^1.2.1","jsdoc":"^3.3.0-alpha10","minimist":"^1.1.0"},"license":"BSD-2-Clause","scripts":{"test":"gulp travis","unit-test":"gulp test","lint":"gulp lint"},"babel":{"presets":["es2015"]}}');
/***/ }),
/***/ "./node_modules/estraverse/estraverse.js":
/*!***********************************************!*\
!*** ./node_modules/estraverse/estraverse.js ***!
\***********************************************/
/***/ ((__unused_webpack_module, exports) => {
/*
Copyright (C) 2012-2013 Yusuke Suzuki <[email protected]>
Copyright (C) 2012 Ariya Hidayat <[email protected]>
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*jslint vars:false, bitwise:true*/
/*jshint indent:4*/
/*global exports:true*/
(function clone(exports) {
'use strict';
var Syntax,
VisitorOption,
VisitorKeys,
BREAK,
SKIP,
REMOVE;
function deepCopy(obj) {
var ret = {}, key, val;
for (key in obj) {
if (obj.hasOwnProperty(key)) {
val = obj[key];
if (typeof val === 'object' && val !== null) {
ret[key] = deepCopy(val);
} else {
ret[key] = val;
}
}
}
return ret;
}
// based on LLVM libc++ upper_bound / lower_bound
// MIT License
function upperBound(array, func) {
var diff, len, i, current;
len = array.length;
i = 0;
while (len) {
diff = len >>> 1;
current = i + diff;
if (func(array[current])) {
len = diff;
} else {
i = current + 1;
len -= diff + 1;
}
}
return i;
}
Syntax = {
AssignmentExpression: 'AssignmentExpression',
AssignmentPattern: 'AssignmentPattern',
ArrayExpression: 'ArrayExpression',
ArrayPattern: 'ArrayPattern',
ArrowFunctionExpression: 'ArrowFunctionExpression',
AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7.
BlockStatement: 'BlockStatement',
BinaryExpression: 'BinaryExpression',
BreakStatement: 'BreakStatement',
CallExpression: 'CallExpression',
CatchClause: 'CatchClause',
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)) {
this.parent.splice(this.key, 1);
return true;
} else {
this.replace(null);
return false;
}
};
function Element(node, path, wrap, ref) {
this.node = node;
this.path = path;
this.wrap = wrap;
this.ref = ref;
}
function Controller() { }
// API:
// return property path array from root to current node
Controller.prototype.path = function path() {
var i, iz, j, jz, result, element;
function addToPath(result, path) {
if (Array.isArray(path)) {
for (j = 0, jz = path.length; j < jz; ++j) {
result.push(path[j]);
}
} else {
result.push(path);
}
}
// root node
if (!this.__current.path) {
return null;
}
// first node is sentinel, second node is root element
result = [];
for (i = 2, iz = this.__leavelist.length; i < iz; ++i) {
element = this.__leavelist[i];
addToPath(result, element.path);
}
addToPath(result, this.__current.path);
return result;
};
// API:
// return type of current node
Controller.prototype.type = function () {
var node = this.current();
return node.type || this.__current.wrap;
};
// API:
// return array of parent elements
Controller.prototype.parents = function parents() {
var i, iz, result;
// first node is sentinel
result = [];
for (i = 1, iz = this.__leavelist.length; i < iz; ++i) {
result.push(this.__leavelist[i].node);
}
return result;
};
// API:
// return current node
Controller.prototype.current = function current() {
return this.__current.node;
};
Controller.prototype.__execute = function __execute(callback, element) {
var previous, result;
result = undefined;
previous = this.__current;
this.__current = element;
this.__state = null;
if (callback) {
result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node);
}
this.__current = previous;
return result;
};
// API:
// notify control skip / break
Controller.prototype.notify = function notify(flag) {
this.__state = flag;
};
// API:
// skip child nodes of current node
Controller.prototype.skip = function () {
this.notify(SKIP);
};
// API:
// break traversals
Controller.prototype['break'] = function () {
this.notify(BREAK);
};
// API:
// remove node
Controller.prototype.remove = function () {
this.notify(REMOVE);
};
Controller.prototype.__initialize = function(root, visitor) {
this.visitor = visitor;
this.root = root;
this.__worklist = [];
this.__leavelist = [];
this.__current = null;
this.__state = null;
this.__fallback = null;
if (visitor.fallback === 'iteration') {
this.__fallback = Object.keys;
} else if (typeof visitor.fallback === 'function') {
this.__fallback = visitor.fallback;
}
this.__keys = VisitorKeys;
if (visitor.keys) {
this.__keys = Object.assign(Object.create(this.__keys), visitor.keys);
}
};
function isNode(node) {
if (node == null) {
return false;
}
return typeof node === 'object' && typeof node.type === 'string';
}
function isProperty(nodeType, key) {
return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key;
}
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);
comments.splice(cursor, 1);
} else {
cursor += 1;
}
}
// already out of owned node
if (cursor === comments.length) {
return VisitorOption.Break;
}
if (comments[cursor].extendedRange[0] > node.range[1]) {
return VisitorOption.Skip;
}
}
});
cursor = 0;
traverse(tree, {
leave: function (node) {
var comment;
while (cursor < comments.length) {
comment = comments[cursor];
if (node.range[1] < comment.extendedRange[0]) {
break;
}
if (node.range[1] === comment.extendedRange[0]) {
if (!node.trailingComments) {
node.trailingComments = [];
}
node.trailingComments.push(comment);
comments.splice(cursor, 1);
} else {
cursor += 1;
}
}
// already out of owned node
if (cursor === comments.length) {
return VisitorOption.Break;
}
if (comments[cursor].extendedRange[0] > node.range[1]) {
return VisitorOption.Skip;
}
}
});
return tree;
}
exports.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 : */
/***/ }),
/***/ "./node_modules/f-matches/index.js":
/*!*****************************************!*\
!*** ./node_modules/f-matches/index.js ***!
\*****************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.matchesLength = exports.extractAny = exports.extract = exports.matches = undefined;
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
var _fp = __webpack_require__(/*! lodash/fp */ "./node_modules/lodash/fp.js");
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
/**
* Matches object against the given pattern.
*
* Similar to LoDash.matches(), but with the addition that a Function
* can be provided to assert various conditions e.g. checking that
* number is within a certain range.
*
* Additionally there are utility functions:
*
* - extract() can be used to give names to the parts of object -
* these are then returned as a map of key-value pairs.
*
* - matchesLength() ensures the exact array length is respected.
*
* @param {Object} pattern Pattern to test against
* @param {Object} obj The object to test
* @return {Object|Boolean} an object with extracted fields
* or false when no match found.
*/
var matches = exports.matches = (0, _fp.curry)(function (pattern, obj) {
var extractedFields = {};
var success = (0, _fp.isMatchWith)(function (value, matcher) {
if (typeof matcher === 'function') {
var result = matcher(value);
if ((typeof result === 'undefined' ? 'undefined' : _typeof(result)) === 'object') {
Object.assign(extractedFields, result);
}
return result;
}
}, pattern, obj);
return success ? extractedFields : false;
});
/**
* Utility for extracting values during matching with matches()
*
* @param {String} fieldName The name to give for the value
* @param {Function|Object} matcher Optional matching function or pattern for matches()
* @param {Object} obj The object to be tested and captured.
* @return {Boolean|Object} False when no match found.
*/
var extract = exports.extract = (0, _fp.curry)(function (fieldName, matcher, obj) {
var extractedFields = _defineProperty({}, fieldName, obj);
if ((typeof matcher === 'undefined' ? 'undefined' : _typeof(matcher)) === 'object') {
matcher = matches(matcher);
}
if (typeof matcher === 'function') {
var result = matcher(obj);
if ((typeof result === 'undefined' ? 'undefined' : _typeof(result)) === 'object') {
return Object.assign(extractedFields, result);
}
if (!result) {
return false;
}
}
return extractedFields;
});
/**
* Like extract, but does not take the matcher argument,
* matching anything instead.
*
* @param {String} fieldName The name to give for the value.
* @param {Object} obj The object to be tested and captured.
* @return {Boolean|Object} False when no match found.
*/
var extractAny = exports.extractAny = (0, _fp.curry)(function (fieldName, obj) {
return extract(fieldName, undefined, obj);
});
/**
* Utility for asserting that two arrays match,
* and their length also equals.
* (in addition to the normal behavior of matches()
* to simply compare the first items in the array).
*
* @param {Array} pattern
* @param {Array} array the array to match against
* @return {Boolean|Object} False on failure to match
*/
var matchesLength = exports.matchesLength = (0, _fp.curry)(function (pattern, array) {
if (array.length !== pattern.length) {
return false;
}
return matches(pattern, array);
});
/***/ }),
/***/ "./node_modules/for-each/index.js":
/*!****************************************!*\
!*** ./node_modules/for-each/index.js ***!
\****************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var isCallable = __webpack_require__(/*! is-callable */ "./node_modules/is-callable/index.js");
var toStr = Object.prototype.toString;
var hasOwnProperty = Object.prototype.hasOwnProperty;
/** @type {<This, A extends readonly unknown[]>(arr: A, iterator: (this: This | void, value: A[number], index: number, arr: A) => void, receiver: This | undefined) => void} */
var forEachArray = function forEachArray(array, iterator, receiver) {
for (var i = 0, len = array.length; i < len; i++) {
if (hasOwnProperty.call(array, i)) {
if (receiver == null) {
iterator(array[i], i, array);
} else {
iterator.call(receiver, array[i], i, array);
}
}
}
};
/** @type {<This, S extends string>(string: S, iterator: (this: This | void, value: S[number], index: number, string: S) => void, receiver: This | undefined) => void} */
var forEachString = function forEachString(string, iterator, receiver) {
for (var i = 0, len = string.length; i < len; i++) {
// no such thing as a sparse string.
if (receiver == null) {
iterator(string.charAt(i), i, string);
} else {
iterator.call(receiver, string.charAt(i), i, string);
}
}
};
/** @type {<This, O>(obj: O, iterator: (this: This | void, value: O[keyof O], index: keyof O, obj: O) => void, receiver: This | undefined) => void} */
var forEachObject = function forEachObject(object, iterator, receiver) {
for (var k in object) {
if (hasOwnProperty.call(object, k)) {
if (receiver == null) {
iterator(object[k], k, object);
} else {
iterator.call(receiver, object[k], k, object);
}
}
}
};
/** @type {(x: unknown) => x is readonly unknown[]} */
function isArray(x) {
return toStr.call(x) === '[object Array]';
}
/** @type {import('.')._internal} */
module.exports = function forEach(list, iterator, thisArg) {
if (!isCallable(iterator)) {
throw new TypeError('iterator must be a function');
}
var receiver;
if (arguments.length >= 3) {
receiver = thisArg;
}
if (isArray(list)) {
forEachArray(list, iterator, receiver);
} else if (typeof list === 'string') {
forEachString(list, iterator, receiver);
} else {
forEachObject(list, iterator, receiver);
}
};
/***/ }),
/***/ "./node_modules/function-bind/implementation.js":
/*!******************************************************!*\
!*** ./node_modules/function-bind/implementation.js ***!
\******************************************************/
/***/ ((module) => {
"use strict";
/* eslint no-invalid-this: 1 */
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
var toStr = Object.prototype.toString;
var max = Math.max;
var funcType = '[object Function]';
var concatty = function concatty(a, b) {
var arr = [];
for (var i = 0; i < a.length; i += 1) {
arr[i] = a[i];
}
for (var j = 0; j < b.length; j += 1) {
arr[j + a.length] = b[j];
}
return arr;
};
var slicy = function slicy(arrLike, offset) {
var arr = [];
for (var i = offset || 0, j = 0; i < arrLike.length; i += 1, j += 1) {
arr[j] = arrLike[i];
}
return arr;
};
var joiny = function (arr, joiner) {
var str = '';
for (var i = 0; i < arr.length; i += 1) {
str += arr[i];
if (i + 1 < arr.length) {
str += joiner;
}
}
return str;
};
module.exports = function bind(that) {
var target = this;
if (typeof target !== 'function' || toStr.apply(target) !== funcType) {
throw new TypeError(ERROR_MESSAGE + target);
}
var args = slicy(arguments, 1);
var bound;
var binder = function () {
if (this instanceof bound) {
var result = target.apply(
this,
concatty(args, arguments)
);
if (Object(result) === result) {
return result;
}
return this;
}
return target.apply(
that,
concatty(args, arguments)
);
};
var boundLength = max(0, target.length - args.length);
var boundArgs = [];
for (var i = 0; i < boundLength; i++) {
boundArgs[i] = '$' + i;
}
bound = Function('binder', 'return function (' + joiny(boundArgs, ',') + '){ return binder.apply(this,arguments); }')(binder);
if (target.prototype) {
var Empty = function Empty() {};
Empty.prototype = target.prototype;
bound.prototype = new Empty();
Empty.prototype = null;
}
return bound;
};
/***/ }),
/***/ "./node_modules/function-bind/index.js":
/*!*********************************************!*\
!*** ./node_modules/function-bind/index.js ***!
\*********************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var implementation = __webpack_require__(/*! ./implementation */ "./node_modules/function-bind/implementation.js");
module.exports = Function.prototype.bind || implementation;
/***/ }),
/***/ "./node_modules/get-intrinsic/index.js":
/*!*********************************************!*\
!*** ./node_modules/get-intrinsic/index.js ***!
\*********************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var undefined;
var $Object = __webpack_require__(/*! es-object-atoms */ "./node_modules/es-object-atoms/index.js");
var $Error = __webpack_require__(/*! es-errors */ "./node_modules/es-errors/index.js");
var $EvalError = __webpack_require__(/*! es-errors/eval */ "./node_modules/es-errors/eval.js");
var $RangeError = __webpack_require__(/*! es-errors/range */ "./node_modules/es-errors/range.js");
var $ReferenceError = __webpack_require__(/*! es-errors/ref */ "./node_modules/es-errors/ref.js");
var $SyntaxError = __webpack_require__(/*! es-errors/syntax */ "./node_modules/es-errors/syntax.js");
var $TypeError = __webpack_require__(/*! es-errors/type */ "./node_modules/es-errors/type.js");
var $URIError = __webpack_require__(/*! es-errors/uri */ "./node_modules/es-errors/uri.js");
var abs = __webpack_require__(/*! math-intrinsics/abs */ "./node_modules/math-intrinsics/abs.js");
var floor = __webpack_require__(/*! math-intrinsics/floor */ "./node_modules/math-intrinsics/floor.js");
var max = __webpack_require__(/*! math-intrinsics/max */ "./node_modules/math-intrinsics/max.js");
var min = __webpack_require__(/*! math-intrinsics/min */ "./node_modules/math-intrinsics/min.js");
var pow = __webpack_require__(/*! math-intrinsics/pow */ "./node_modules/math-intrinsics/pow.js");
var round = __webpack_require__(/*! math-intrinsics/round */ "./node_modules/math-intrinsics/round.js");
var sign = __webpack_require__(/*! math-intrinsics/sign */ "./node_modules/math-intrinsics/sign.js");
var $Function = Function;
// eslint-disable-next-line consistent-return
var getEvalledConstructor = function (expressionSyntax) {
try {
return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
} catch (e) {}
};
var $gOPD = __webpack_require__(/*! gopd */ "./node_modules/gopd/index.js");
var $defineProperty = __webpack_require__(/*! es-define-property */ "./node_modules/es-define-property/index.js");
var throwTypeError = function () {
throw new $TypeError();
};
var ThrowTypeError = $gOPD
? (function () {
try {
// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
arguments.callee; // IE 8 does not throw here
return throwTypeError;
} catch (calleeThrows) {
try {
// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
return $gOPD(arguments, 'callee').get;
} catch (gOPDthrows) {
return throwTypeError;
}
}
}())
: throwTypeError;
var hasSymbols = __webpack_require__(/*! has-symbols */ "./node_modules/has-symbols/index.js")();
var getProto = __webpack_require__(/*! get-proto */ "./node_modules/get-proto/index.js");
var $ObjectGPO = __webpack_require__(/*! get-proto/Object.getPrototypeOf */ "./node_modules/get-proto/Object.getPrototypeOf.js");
var $ReflectGPO = __webpack_require__(/*! get-proto/Reflect.getPrototypeOf */ "./node_modules/get-proto/Reflect.getPrototypeOf.js");
var $apply = __webpack_require__(/*! call-bind-apply-helpers/functionApply */ "./node_modules/call-bind-apply-helpers/functionApply.js");
var $call = __webpack_require__(/*! call-bind-apply-helpers/functionCall */ "./node_modules/call-bind-apply-helpers/functionCall.js");
var needsEval = {};
var TypedArray = typeof Uint8Array === 'undefined' || !getProto ? undefined : getProto(Uint8Array);
var INTRINSICS = {
__proto__: null,
'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
'%Array%': Array,
'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
'%ArrayIteratorPrototype%': hasSymbols && getProto ? getProto([][Symbol.iterator]()) : undefined,
'%AsyncFromSyncIteratorPrototype%': undefined,
'%AsyncFunction%': needsEval,
'%AsyncGenerator%': needsEval,
'%AsyncGeneratorFunction%': needsEval,
'%AsyncIteratorPrototype%': needsEval,
'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
'%BigInt64Array%': typeof BigInt64Array === 'undefined' ? undefined : BigInt64Array,
'%BigUint64Array%': typeof BigUint64Array === 'undefined' ? undefined : BigUint64Array,
'%Boolean%': Boolean,
'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
'%Date%': Date,
'%decodeURI%': decodeURI,
'%decodeURIComponent%': decodeURIComponent,
'%encodeURI%': encodeURI,
'%encodeURIComponent%': encodeURIComponent,
'%Error%': $Error,
'%eval%': eval, // eslint-disable-line no-eval
'%EvalError%': $EvalError,
'%Float16Array%': typeof Float16Array === 'undefined' ? undefined : Float16Array,
'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
'%Function%': $Function,
'%GeneratorFunction%': needsEval,
'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
'%isFinite%': isFinite,
'%isNaN%': isNaN,
'%IteratorPrototype%': hasSymbols && getProto ? getProto(getProto([][Symbol.iterator]())) : undefined,
'%JSON%': typeof JSON === 'object' ? JSON : undefined,
'%Map%': typeof Map === 'undefined' ? undefined : Map,
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Map()[Symbol.iterator]()),
'%Math%': Math,
'%Number%': Number,
'%Object%': $Object,
'%Object.getOwnPropertyDescriptor%': $gOPD,
'%parseFloat%': parseFloat,
'%parseInt%': parseInt,
'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
'%RangeError%': $RangeError,
'%ReferenceError%': $ReferenceError,
'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
'%RegExp%': RegExp,
'%Set%': typeof Set === 'undefined' ? undefined : Set,
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols || !getProto ? undefined : getProto(new Set()[Symbol.iterator]()),
'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
'%String%': String,
'%StringIteratorPrototype%': hasSymbols && getProto ? getProto(''[Symbol.iterator]()) : undefined,
'%Symbol%': hasSymbols ? Symbol : undefined,
'%SyntaxError%': $SyntaxError,
'%ThrowTypeError%': ThrowTypeError,
'%TypedArray%': TypedArray,
'%TypeError%': $TypeError,
'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
'%URIError%': $URIError,
'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet,
'%Function.prototype.call%': $call,
'%Function.prototype.apply%': $apply,
'%Object.defineProperty%': $defineProperty,
'%Object.getPrototypeOf%': $ObjectGPO,
'%Math.abs%': abs,
'%Math.floor%': floor,
'%Math.max%': max,
'%Math.min%': min,
'%Math.pow%': pow,
'%Math.round%': round,
'%Math.sign%': sign,
'%Reflect.getPrototypeOf%': $ReflectGPO
};
if (getProto) {
try {
null.error; // eslint-disable-line no-unused-expressions
} catch (e) {
// https://github.com/tc39/proposal-shadowrealm/pull/384#issuecomment-1364264229
var errorProto = getProto(getProto(e));
INTRINSICS['%Error.prototype%'] = errorProto;
}
}
var doEval = function doEval(name) {
var value;
if (name === '%AsyncFunction%') {
value = getEvalledConstructor('async function () {}');
} else if (name === '%GeneratorFunction%') {
value = getEvalledConstructor('function* () {}');
} else if (name === '%AsyncGeneratorFunction%') {
value = getEvalledConstructor('async function* () {}');
} else if (name === '%AsyncGenerator%') {
var fn = doEval('%AsyncGeneratorFunction%');
if (fn) {
value = fn.prototype;
}
} else if (name === '%AsyncIteratorPrototype%') {
var gen = doEval('%AsyncGenerator%');
if (gen && getProto) {
value = getProto(gen.prototype);
}
}
INTRINSICS[name] = value;
return value;
};
var LEGACY_ALIASES = {
__proto__: null,
'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
'%ArrayPrototype%': ['Array', 'prototype'],
'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
'%ArrayProto_values%': ['Array', 'prototype', 'values'],
'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
'%BooleanPrototype%': ['Boolean', 'prototype'],
'%DataViewPrototype%': ['DataView', 'prototype'],
'%DatePrototype%': ['Date', 'prototype'],
'%ErrorPrototype%': ['Error', 'prototype'],
'%EvalErrorPrototype%': ['EvalError', 'prototype'],
'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
'%FunctionPrototype%': ['Function', 'prototype'],
'%Generator%': ['GeneratorFunction', 'prototype'],
'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
'%JSONParse%': ['JSON', 'parse'],
'%JSONStringify%': ['JSON', 'stringify'],
'%MapPrototype%': ['Map', 'prototype'],
'%NumberPrototype%': ['Number', 'prototype'],
'%ObjectPrototype%': ['Object', 'prototype'],
'%ObjProto_toString%': ['Object', 'prototype', 'toString'],
'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
'%PromisePrototype%': ['Promise', 'prototype'],
'%PromiseProto_then%': ['Promise', 'prototype', 'then'],
'%Promise_all%': ['Promise', 'all'],
'%Promise_reject%': ['Promise', 'reject'],
'%Promise_resolve%': ['Promise', 'resolve'],
'%RangeErrorPrototype%': ['RangeError', 'prototype'],
'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
'%RegExpPrototype%': ['RegExp', 'prototype'],
'%SetPrototype%': ['Set', 'prototype'],
'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
'%StringPrototype%': ['String', 'prototype'],
'%SymbolPrototype%': ['Symbol', 'prototype'],
'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
'%TypedArrayPrototype%': ['TypedArray', 'prototype'],
'%TypeErrorPrototype%': ['TypeError', 'prototype'],
'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
'%URIErrorPrototype%': ['URIError', 'prototype'],
'%WeakMapPrototype%': ['WeakMap', 'prototype'],
'%WeakSetPrototype%': ['WeakSet', 'prototype']
};
var bind = __webpack_require__(/*! function-bind */ "./node_modules/function-bind/index.js");
var hasOwn = __webpack_require__(/*! hasown */ "./node_modules/hasown/index.js");
var $concat = bind.call($call, Array.prototype.concat);
var $spliceApply = bind.call($apply, Array.prototype.splice);
var $replace = bind.call($call, String.prototype.replace);
var $strSlice = bind.call($call, String.prototype.slice);
var $exec = bind.call($call, RegExp.prototype.exec);
/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
var stringToPath = function stringToPath(string) {
var first = $strSlice(string, 0, 1);
var last = $strSlice(string, -1);
if (first === '%' && last !== '%') {
throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
} else if (last === '%' && first !== '%') {
throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
}
var result = [];
$replace(string, rePropName, function (match, number, quote, subString) {
result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
});
return result;
};
/* end adaptation */
var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
var intrinsicName = name;
var alias;
if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
alias = LEGACY_ALIASES[intrinsicName];
intrinsicName = '%' + alias[0] + '%';
}
if (hasOwn(INTRINSICS, intrinsicName)) {
var value = INTRINSICS[intrinsicName];
if (value === needsEval) {
value = doEval(intrinsicName);
}
if (typeof value === 'undefined' && !allowMissing) {
throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
}
return {
alias: alias,
name: intrinsicName,
value: value
};
}
throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
};
module.exports = function GetIntrinsic(name, allowMissing) {
if (typeof name !== 'string' || name.length === 0) {
throw new $TypeError('intrinsic name must be a non-empty string');
}
if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
throw new $TypeError('"allowMissing" argument must be a boolean');
}
if ($exec(/^%?[^%]*%?$/, name) === null) {
throw new $SyntaxError('`%` may not be present anywhere but at the beginning and end of the intrinsic name');
}
var parts = stringToPath(name);
var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
var intrinsicRealName = intrinsic.name;
var value = intrinsic.value;
var skipFurtherCaching = false;
var alias = intrinsic.alias;
if (alias) {
intrinsicBaseName = alias[0];
$spliceApply(parts, $concat([0, 1], alias));
}
for (var i = 1, isOwn = true; i < parts.length; i += 1) {
var part = parts[i];
var first = $strSlice(part, 0, 1);
var last = $strSlice(part, -1);
if (
(
(first === '"' || first === "'" || first === '`')
|| (last === '"' || last === "'" || last === '`')
)
&& first !== last
) {
throw new $SyntaxError('property names with quotes must have matching quotes');
}
if (part === 'constructor' || !isOwn) {
skipFurtherCaching = true;
}
intrinsicBaseName += '.' + part;
intrinsicRealName = '%' + intrinsicBaseName + '%';
if (hasOwn(INTRINSICS, intrinsicRealName)) {
value = INTRINSICS[intrinsicRealName];
} else if (value != null) {
if (!(part in value)) {
if (!allowMissing) {
throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
}
return void undefined;
}
if ($gOPD && (i + 1) >= parts.length) {
var desc = $gOPD(value, part);
isOwn = !!desc;
// By convention, when a data property is converted to an accessor
// property to emulate a data property that does not suffer from
// the override mistake, that accessor's getter is marked with
// an `originalValue` property. Here, when we detect this, we
// uphold the illusion by pretending to see that original data
// property, i.e., returning the value rather than the getter
// itself.
if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
value = desc.get;
} else {
value = value[part];
}
} else {
isOwn = hasOwn(value, part);
value = value[part];
}
if (isOwn && !skipFurtherCaching) {
INTRINSICS[intrinsicRealName] = value;
}
}
}
return value;
};
/***/ }),
/***/ "./node_modules/get-proto/Object.getPrototypeOf.js":
/*!*********************************************************!*\
!*** ./node_modules/get-proto/Object.getPrototypeOf.js ***!
\*********************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var $Object = __webpack_require__(/*! es-object-atoms */ "./node_modules/es-object-atoms/index.js");
/** @type {import('./Object.getPrototypeOf')} */
module.exports = $Object.getPrototypeOf || null;
/***/ }),
/***/ "./node_modules/get-proto/Reflect.getPrototypeOf.js":
/*!**********************************************************!*\
!*** ./node_modules/get-proto/Reflect.getPrototypeOf.js ***!
\**********************************************************/
/***/ ((module) => {
"use strict";
/** @type {import('./Reflect.getPrototypeOf')} */
module.exports = (typeof Reflect !== 'undefined' && Reflect.getPrototypeOf) || null;
/***/ }),
/***/ "./node_modules/get-proto/index.js":
/*!*****************************************!*\
!*** ./node_modules/get-proto/index.js ***!
\*****************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var reflectGetProto = __webpack_require__(/*! ./Reflect.getPrototypeOf */ "./node_modules/get-proto/Reflect.getPrototypeOf.js");
var originalGetProto = __webpack_require__(/*! ./Object.getPrototypeOf */ "./node_modules/get-proto/Object.getPrototypeOf.js");
var getDunderProto = __webpack_require__(/*! dunder-proto/get */ "./node_modules/dunder-proto/get.js");
/** @type {import('.')} */
module.exports = reflectGetProto
? function getProto(O) {
// @ts-expect-error TS can't narrow inside a closure, for some reason
return reflectGetProto(O);
}
: originalGetProto
? function getProto(O) {
if (!O || (typeof O !== 'object' && typeof O !== 'function')) {
throw new TypeError('getProto: not an object');
}
// @ts-expect-error TS can't narrow inside a closure, for some reason
return originalGetProto(O);
}
: getDunderProto
? function getProto(O) {
// @ts-expect-error TS can't narrow inside a closure, for some reason
return getDunderProto(O);
}
: null;
/***/ }),
/***/ "./node_modules/gopd/gOPD.js":
/*!***********************************!*\
!*** ./node_modules/gopd/gOPD.js ***!
\***********************************/
/***/ ((module) => {
"use strict";
/** @type {import('./gOPD')} */
module.exports = Object.getOwnPropertyDescriptor;
/***/ }),
/***/ "./node_modules/gopd/index.js":
/*!************************************!*\
!*** ./node_modules/gopd/index.js ***!
\************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
/** @type {import('.')} */
var $gOPD = __webpack_require__(/*! ./gOPD */ "./node_modules/gopd/gOPD.js");
if ($gOPD) {
try {
$gOPD([], 'length');
} catch (e) {
// IE 8 has a broken gOPD
$gOPD = null;
}
}
module.exports = $gOPD;
/***/ }),
/***/ "./node_modules/has-property-descriptors/index.js":
/*!********************************************************!*\
!*** ./node_modules/has-property-descriptors/index.js ***!
\********************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var $defineProperty = __webpack_require__(/*! es-define-property */ "./node_modules/es-define-property/index.js");
var hasPropertyDescriptors = function hasPropertyDescriptors() {
return !!$defineProperty;
};
hasPropertyDescriptors.hasArrayLengthDefineBug = function hasArrayLengthDefineBug() {
// node v0.6 has a bug where array lengths can be Set but not Defined
if (!$defineProperty) {
return null;
}
try {
return $defineProperty([], 'length', { value: 1 }).length !== 1;
} catch (e) {
// In Firefox 4-22, defining length on an array throws an exception.
return true;
}
};
module.exports = hasPropertyDescriptors;
/***/ }),
/***/ "./node_modules/has-symbols/index.js":
/*!*******************************************!*\
!*** ./node_modules/has-symbols/index.js ***!
\*******************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var origSymbol = typeof Symbol !== 'undefined' && Symbol;
var hasSymbolSham = __webpack_require__(/*! ./shams */ "./node_modules/has-symbols/shams.js");
/** @type {import('.')} */
module.exports = function hasNativeSymbols() {
if (typeof origSymbol !== 'function') { return false; }
if (typeof Symbol !== 'function') { return false; }
if (typeof origSymbol('foo') !== 'symbol') { return false; }
if (typeof Symbol('bar') !== 'symbol') { return false; }
return hasSymbolSham();
};
/***/ }),
/***/ "./node_modules/has-symbols/shams.js":
/*!*******************************************!*\
!*** ./node_modules/has-symbols/shams.js ***!
\*******************************************/
/***/ ((module) => {
"use strict";
/** @type {import('./shams')} */
/* eslint complexity: [2, 18], max-statements: [2, 33] */
module.exports = function hasSymbols() {
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
if (typeof Symbol.iterator === 'symbol') { return true; }
/** @type {{ [k in symbol]?: unknown }} */
var obj = {};
var sym = Symbol('test');
var symObj = Object(sym);
if (typeof sym === 'string') { return false; }
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
// temp disabled per https://github.com/ljharb/object.assign/issues/17
// if (sym instanceof Symbol) { return false; }
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
// if (!(symObj instanceof Symbol)) { return false; }
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
var symVal = 42;
obj[sym] = symVal;
for (var _ in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
var syms = Object.getOwnPropertySymbols(obj);
if (syms.length !== 1 || syms[0] !== sym) { return false; }
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
if (typeof Object.getOwnPropertyDescriptor === 'function') {
// eslint-disable-next-line no-extra-parens
var descriptor = /** @type {PropertyDescriptor} */ (Object.getOwnPropertyDescriptor(obj, sym));
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
}
return true;
};
/***/ }),
/***/ "./node_modules/has-tostringtag/shams.js":
/*!***********************************************!*\
!*** ./node_modules/has-tostringtag/shams.js ***!
\***********************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var hasSymbols = __webpack_require__(/*! has-symbols/shams */ "./node_modules/has-symbols/shams.js");
/** @type {import('.')} */
module.exports = function hasToStringTagShams() {
return hasSymbols() && !!Symbol.toStringTag;
};
/***/ }),
/***/ "./node_modules/hasown/index.js":
/*!**************************************!*\
!*** ./node_modules/hasown/index.js ***!
\**************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var call = Function.prototype.call;
var $hasOwn = Object.prototype.hasOwnProperty;
var bind = __webpack_require__(/*! function-bind */ "./node_modules/function-bind/index.js");
/** @type {import('.')} */
module.exports = bind.call(call, $hasOwn);
/***/ }),
/***/ "./node_modules/inherits/inherits_browser.js":
/*!***************************************************!*\
!*** ./node_modules/inherits/inherits_browser.js ***!
\***************************************************/
/***/ ((module) => {
if (typeof Object.create === 'function') {
// implementation from standard node.js 'util' module
module.exports = function inherits(ctor, superCtor) {
if (superCtor) {
ctor.super_ = superCtor
ctor.prototype = Object.create(superCtor.prototype, {
constructor: {
value: ctor,
enumerable: false,
writable: true,
configurable: true
}
})
}
};
} else {
// old school shim for old browsers
module.exports = function inherits(ctor, superCtor) {
if (superCtor) {
ctor.super_ = superCtor
var TempCtor = function () {}
TempCtor.prototype = superCtor.prototype
ctor.prototype = new TempCtor()
ctor.prototype.constructor = ctor
}
}
}
/***/ }),
/***/ "./node_modules/is-arguments/index.js":
/*!********************************************!*\
!*** ./node_modules/is-arguments/index.js ***!
\********************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var hasToStringTag = __webpack_require__(/*! has-tostringtag/shams */ "./node_modules/has-tostringtag/shams.js")();
var callBound = __webpack_require__(/*! call-bound */ "./node_modules/call-bound/index.js");
var $toString = callBound('Object.prototype.toString');
/** @type {import('.')} */
var isStandardArguments = function isArguments(value) {
if (
hasToStringTag
&& value
&& typeof value === 'object'
&& Symbol.toStringTag in value
) {
return false;
}
return $toString(value) === '[object Arguments]';
};
/** @type {import('.')} */
var isLegacyArguments = function isArguments(value) {
if (isStandardArguments(value)) {
return true;
}
return value !== null
&& typeof value === 'object'
&& 'length' in value
&& typeof value.length === 'number'
&& value.length >= 0
&& $toString(value) !== '[object Array]'
&& 'callee' in value
&& $toString(value.callee) === '[object Function]';
};
var supportsStandardArguments = (function () {
return isStandardArguments(arguments);
}());
// @ts-expect-error TODO make this not error
isStandardArguments.isLegacyArguments = isLegacyArguments; // for tests
/** @type {import('.')} */
module.exports = supportsStandardArguments ? isStandardArguments : isLegacyArguments;
/***/ }),
/***/ "./node_modules/is-callable/index.js":
/*!*******************************************!*\
!*** ./node_modules/is-callable/index.js ***!
\*******************************************/
/***/ ((module) => {
"use strict";
var fnToStr = Function.prototype.toString;
var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;
var badArrayLike;
var isCallableMarker;
if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {
try {
badArrayLike = Object.defineProperty({}, 'length', {
get: function () {
throw isCallableMarker;
}
});
isCallableMarker = {};
// eslint-disable-next-line no-throw-literal
reflectApply(function () { throw 42; }, null, badArrayLike);
} catch (_) {
if (_ !== isCallableMarker) {
reflectApply = null;
}
}
} else {
reflectApply = null;
}
var constructorRegex = /^\s*class\b/;
var isES6ClassFn = function isES6ClassFunction(value) {
try {
var fnStr = fnToStr.call(value);
return constructorRegex.test(fnStr);
} catch (e) {
return false; // not a function
}
};
var tryFunctionObject = function tryFunctionToStr(value) {
try {
if (isES6ClassFn(value)) { return false; }
fnToStr.call(value);
return true;
} catch (e) {
return false;
}
};
var toStr = Object.prototype.toString;
var objectClass = '[object Object]';
var fnClass = '[object Function]';
var genClass = '[object GeneratorFunction]';
var ddaClass = '[object HTMLAllCollection]'; // IE 11
var ddaClass2 = '[object HTML document.all class]';
var ddaClass3 = '[object HTMLCollection]'; // IE 9-10
var hasToStringTag = typeof Symbol === 'function' && !!Symbol.toStringTag; // better: use `has-tostringtag`
var isIE68 = !(0 in [,]); // eslint-disable-line no-sparse-arrays, comma-spacing
var isDDA = function isDocumentDotAll() { return false; };
if (typeof document === 'object') {
// Firefox 3 canonicalizes DDA to undefined when it's not accessed directly
var all = document.all;
if (toStr.call(all) === toStr.call(document.all)) {
isDDA = function isDocumentDotAll(value) {
/* globals document: false */
// in IE 6-8, typeof document.all is "object" and it's truthy
if ((isIE68 || !value) && (typeof value === 'undefined' || typeof value === 'object')) {
try {
var str = toStr.call(value);
return (
str === ddaClass
|| str === ddaClass2
|| str === ddaClass3 // opera 12.16
|| str === objectClass // IE 6-8
) && value('') == null; // eslint-disable-line eqeqeq
} catch (e) { /**/ }
}
return false;
};
}
}
module.exports = reflectApply
? function isCallable(value) {
if (isDDA(value)) { return true; }
if (!value) { return false; }
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
try {
reflectApply(value, null, badArrayLike);
} catch (e) {
if (e !== isCallableMarker) { return false; }
}
return !isES6ClassFn(value) && tryFunctionObject(value);
}
: function isCallable(value) {
if (isDDA(value)) { return true; }
if (!value) { return false; }
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
if (hasToStringTag) { return tryFunctionObject(value); }
if (isES6ClassFn(value)) { return false; }
var strClass = toStr.call(value);
if (strClass !== fnClass && strClass !== genClass && !(/^\[object HTML/).test(strClass)) { return false; }
return tryFunctionObject(value);
};
/***/ }),
/***/ "./node_modules/is-generator-function/index.js":
/*!*****************************************************!*\
!*** ./node_modules/is-generator-function/index.js ***!
\*****************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var callBound = __webpack_require__(/*! call-bound */ "./node_modules/call-bound/index.js");
var safeRegexTest = __webpack_require__(/*! safe-regex-test */ "./node_modules/safe-regex-test/index.js");
var isFnRegex = safeRegexTest(/^\s*(?:function)?\*/);
var hasToStringTag = __webpack_require__(/*! has-tostringtag/shams */ "./node_modules/has-tostringtag/shams.js")();
var getProto = __webpack_require__(/*! get-proto */ "./node_modules/get-proto/index.js");
var toStr = callBound('Object.prototype.toString');
var fnToStr = callBound('Function.prototype.toString');
var getGeneratorFunc = function () { // eslint-disable-line consistent-return
if (!hasToStringTag) {
return false;
}
try {
return Function('return function*() {}')();
} catch (e) {
}
};
/** @type {undefined | false | null | GeneratorFunctionConstructor} */
var GeneratorFunction;
/** @type {import('.')} */
module.exports = function isGeneratorFunction(fn) {
if (typeof fn !== 'function') {
return false;
}
if (isFnRegex(fnToStr(fn))) {
return true;
}
if (!hasToStringTag) {
var str = toStr(fn);
return str === '[object GeneratorFunction]';
}
if (!getProto) {
return false;
}
if (typeof GeneratorFunction === 'undefined') {
var generatorFunc = getGeneratorFunc();
GeneratorFunction = generatorFunc
// eslint-disable-next-line no-extra-parens
? /** @type {GeneratorFunctionConstructor} */ (getProto(generatorFunc))
: false;
}
return getProto(fn) === GeneratorFunction;
};
/***/ }),
/***/ "./node_modules/is-nan/implementation.js":
/*!***********************************************!*\
!*** ./node_modules/is-nan/implementation.js ***!
\***********************************************/
/***/ ((module) => {
"use strict";
/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */
module.exports = function isNaN(value) {
return value !== value;
};
/***/ }),
/***/ "./node_modules/is-nan/index.js":
/*!**************************************!*\
!*** ./node_modules/is-nan/index.js ***!
\**************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var callBind = __webpack_require__(/*! call-bind */ "./node_modules/call-bind/index.js");
var define = __webpack_require__(/*! define-properties */ "./node_modules/define-properties/index.js");
var implementation = __webpack_require__(/*! ./implementation */ "./node_modules/is-nan/implementation.js");
var getPolyfill = __webpack_require__(/*! ./polyfill */ "./node_modules/is-nan/polyfill.js");
var shim = __webpack_require__(/*! ./shim */ "./node_modules/is-nan/shim.js");
var polyfill = callBind(getPolyfill(), Number);
/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */
define(polyfill, {
getPolyfill: getPolyfill,
implementation: implementation,
shim: shim
});
module.exports = polyfill;
/***/ }),
/***/ "./node_modules/is-nan/polyfill.js":
/*!*****************************************!*\
!*** ./node_modules/is-nan/polyfill.js ***!
\*****************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var implementation = __webpack_require__(/*! ./implementation */ "./node_modules/is-nan/implementation.js");
module.exports = function getPolyfill() {
if (Number.isNaN && Number.isNaN(NaN) && !Number.isNaN('a')) {
return Number.isNaN;
}
return implementation;
};
/***/ }),
/***/ "./node_modules/is-nan/shim.js":
/*!*************************************!*\
!*** ./node_modules/is-nan/shim.js ***!
\*************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var define = __webpack_require__(/*! define-properties */ "./node_modules/define-properties/index.js");
var getPolyfill = __webpack_require__(/*! ./polyfill */ "./node_modules/is-nan/polyfill.js");
/* http://www.ecma-international.org/ecma-262/6.0/#sec-number.isnan */
module.exports = function shimNumberIsNaN() {
var polyfill = getPolyfill();
define(Number, { isNaN: polyfill }, {
isNaN: function testIsNaN() {
return Number.isNaN !== polyfill;
}
});
return polyfill;
};
/***/ }),
/***/ "./node_modules/is-regex/index.js":
/*!****************************************!*\
!*** ./node_modules/is-regex/index.js ***!
\****************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var callBound = __webpack_require__(/*! call-bound */ "./node_modules/call-bound/index.js");
var hasToStringTag = __webpack_require__(/*! has-tostringtag/shams */ "./node_modules/has-tostringtag/shams.js")();
var hasOwn = __webpack_require__(/*! hasown */ "./node_modules/hasown/index.js");
var gOPD = __webpack_require__(/*! gopd */ "./node_modules/gopd/index.js");
/** @type {import('.')} */
var fn;
if (hasToStringTag) {
/** @type {(receiver: ThisParameterType<typeof RegExp.prototype.exec>, ...args: Parameters<typeof RegExp.prototype.exec>) => ReturnType<typeof RegExp.prototype.exec>} */
var $exec = callBound('RegExp.prototype.exec');
/** @type {object} */
var isRegexMarker = {};
var throwRegexMarker = function () {
throw isRegexMarker;
};
/** @type {{ toString(): never, valueOf(): never, [Symbol.toPrimitive]?(): never }} */
var badStringifier = {
toString: throwRegexMarker,
valueOf: throwRegexMarker
};
if (typeof Symbol.toPrimitive === 'symbol') {
badStringifier[Symbol.toPrimitive] = throwRegexMarker;
}
/** @type {import('.')} */
// @ts-expect-error TS can't figure out that the $exec call always throws
// eslint-disable-next-line consistent-return
fn = function isRegex(value) {
if (!value || typeof value !== 'object') {
return false;
}
// eslint-disable-next-line no-extra-parens
var descriptor = /** @type {NonNullable<typeof gOPD>} */ (gOPD)(/** @type {{ lastIndex?: unknown }} */ (value), 'lastIndex');
var hasLastIndexDataProperty = descriptor && hasOwn(descriptor, 'value');
if (!hasLastIndexDataProperty) {
return false;
}
try {
// eslint-disable-next-line no-extra-parens
$exec(value, /** @type {string} */ (/** @type {unknown} */ (badStringifier)));
} catch (e) {
return e === isRegexMarker;
}
};
} else {
/** @type {(receiver: ThisParameterType<typeof Object.prototype.toString>, ...args: Parameters<typeof Object.prototype.toString>) => ReturnType<typeof Object.prototype.toString>} */
var $toString = callBound('Object.prototype.toString');
/** @const @type {'[object RegExp]'} */
var regexClass = '[object RegExp]';
/** @type {import('.')} */
fn = function isRegex(value) {
// In older browsers, typeof regex incorrectly returns 'function'
if (!value || (typeof value !== 'object' && typeof value !== 'function')) {
return false;
}
return $toString(value) === regexClass;
};
}
module.exports = fn;
/***/ }),
/***/ "./node_modules/is-typed-array/index.js":
/*!**********************************************!*\
!*** ./node_modules/is-typed-array/index.js ***!
\**********************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var whichTypedArray = __webpack_require__(/*! which-typed-array */ "./node_modules/which-typed-array/index.js");
/** @type {import('.')} */
module.exports = function isTypedArray(value) {
return !!whichTypedArray(value);
};
/***/ }),
/***/ "./node_modules/lebab/index.js":
/*!*************************************!*\
!*** ./node_modules/lebab/index.js ***!
\*************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
const createTransformer = (__webpack_require__(/*! ./lib/createTransformer */ "./node_modules/lebab/lib/createTransformer.js")["default"]);
/**
* Exposes API similar to Babel:
*
* import lebab from "lebab";
* const {code, warnings} = lebab.transform('Some JS', ['let', 'arrow']);
*
* @param {String} code The code to transform
* @param {String[]} transformNames The transforms to apply
* @return {Object} An object with code and warnings props
*/
exports.transform = function(code, transformNames) {
return createTransformer(transformNames).run(code);
};
/***/ }),
/***/ "./node_modules/lebab/lib/Logger.js":
/*!******************************************!*\
!*** ./node_modules/lebab/lib/Logger.js ***!
\******************************************/
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/**
* Passed to transforms so they can log warnings.
*/
var Logger = /*#__PURE__*/function () {
function Logger() {
_classCallCheck(this, Logger);
this.warnings = [];
}
/**
* Logs a warning.
* @param {Object} node AAST node that caused the warning
* @param {String} msg Warning message itself
* @param {String} type Name of the transform
*/
_createClass(Logger, [{
key: "warn",
value: function warn(node, msg, type) {
this.warnings.push({
line: node.loc ? node.loc.start.line : 0,
msg: msg,
type: type
});
}
/**
* Returns list of all the warnings
* @return {Object[]}
*/
}, {
key: "getWarnings",
value: function getWarnings() {
return this.warnings;
}
}]);
return Logger;
}();
exports["default"] = Logger;
/***/ }),
/***/ "./node_modules/lebab/lib/Parser.js":
/*!******************************************!*\
!*** ./node_modules/lebab/lib/Parser.js ***!
\******************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var espree = _interopRequireWildcard(__webpack_require__(/*! espree */ "./node_modules/lebab/node_modules/espree/dist/espree.cjs"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
var ESPREE_OPTS = {
ecmaVersion: 2022,
ecmaFeatures: {
jsx: true
},
comment: true,
tokens: true
};
/**
* An Esprima-compatible parser with JSX and object rest/spread parsing enabled.
*/
var _default = {
parse: function parse(js, opts) {
return espree.parse(js, _objectSpread(_objectSpread({}, opts), ESPREE_OPTS));
},
tokenize: function tokenize(js, opts) {
return espree.tokenize(js, _objectSpread(_objectSpread({}, opts), ESPREE_OPTS));
}
};
exports["default"] = _default;
/***/ }),
/***/ "./node_modules/lebab/lib/Transformer.js":
/*!***********************************************!*\
!*** ./node_modules/lebab/lib/Transformer.js ***!
\***********************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _recast = __webpack_require__(/*! recast */ "./node_modules/recast/main.js");
var _Parser = _interopRequireDefault(__webpack_require__(/*! ./Parser */ "./node_modules/lebab/lib/Parser.js"));
var _Logger = _interopRequireDefault(__webpack_require__(/*! ./Logger */ "./node_modules/lebab/lib/Logger.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/**
* Runs transforms on code.
*/
var Transformer = /*#__PURE__*/function () {
/**
* @param {Function[]} transforms List of transforms to perform
*/
function Transformer() {
var transforms = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
_classCallCheck(this, Transformer);
this.transforms = transforms;
}
/**
* Tranforms code using all configured transforms.
*
* @param {String} code Input ES5 code
* @return {Object} Output ES6 code
*/
_createClass(Transformer, [{
key: "run",
value: function run(code) {
var logger = new _Logger["default"]();
return {
code: this.applyAllTransforms(code, logger),
warnings: logger.getWarnings()
};
}
}, {
key: "applyAllTransforms",
value: function applyAllTransforms(code, logger) {
var _this = this;
return this.ignoringHashBangComment(code, function (js) {
var ast = (0, _recast.parse)(js, {
parser: _Parser["default"]
});
_this.transforms.forEach(function (transformer) {
transformer(ast.program, logger);
});
return (0, _recast.print)(ast, {
lineTerminator: _this.detectLineTerminator(code),
objectCurlySpacing: false
}).code;
});
}
// strips hashBang comment,
// invokes callback with normal js,
// then re-adds the hashBang comment back
}, {
key: "ignoringHashBangComment",
value: function ignoringHashBangComment(code, callback) {
var _code$match = code.match(/^(\s*#!.*?\r?\n|)([\s\S]*)$/),
_code$match2 = _slicedToArray(_code$match, 3),
hashBang = _code$match2[1],
js = _code$match2[2];
return hashBang + callback(js);
}
}, {
key: "detectLineTerminator",
value: function detectLineTerminator(code) {
var hasCRLF = /\r\n/.test(code);
var hasLF = /[^\r]\n/.test(code);
return hasCRLF && !hasLF ? '\r\n' : '\n';
}
}]);
return Transformer;
}();
exports["default"] = Transformer;
/***/ }),
/***/ "./node_modules/lebab/lib/createTransformer.js":
/*!*****************************************************!*\
!*** ./node_modules/lebab/lib/createTransformer.js ***!
\*****************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = createTransformer;
var _Transformer = _interopRequireDefault(__webpack_require__(/*! ./Transformer */ "./node_modules/lebab/lib/Transformer.js"));
var _class = _interopRequireDefault(__webpack_require__(/*! ./transform/class */ "./node_modules/lebab/lib/transform/class/index.js"));
var _template = _interopRequireDefault(__webpack_require__(/*! ./transform/template */ "./node_modules/lebab/lib/transform/template.js"));
var _arrow = _interopRequireDefault(__webpack_require__(/*! ./transform/arrow */ "./node_modules/lebab/lib/transform/arrow.js"));
var _arrowReturn = _interopRequireDefault(__webpack_require__(/*! ./transform/arrowReturn */ "./node_modules/lebab/lib/transform/arrowReturn.js"));
var _let = _interopRequireDefault(__webpack_require__(/*! ./transform/let */ "./node_modules/lebab/lib/transform/let.js"));
var _defaultParam = _interopRequireDefault(__webpack_require__(/*! ./transform/defaultParam */ "./node_modules/lebab/lib/transform/defaultParam/index.js"));
var _destructParam = _interopRequireDefault(__webpack_require__(/*! ./transform/destructParam */ "./node_modules/lebab/lib/transform/destructParam.js"));
var _argSpread = _interopRequireDefault(__webpack_require__(/*! ./transform/argSpread */ "./node_modules/lebab/lib/transform/argSpread.js"));
var _argRest = _interopRequireDefault(__webpack_require__(/*! ./transform/argRest */ "./node_modules/lebab/lib/transform/argRest.js"));
var _objMethod = _interopRequireDefault(__webpack_require__(/*! ./transform/objMethod */ "./node_modules/lebab/lib/transform/objMethod.js"));
var _objShorthand = _interopRequireDefault(__webpack_require__(/*! ./transform/objShorthand */ "./node_modules/lebab/lib/transform/objShorthand.js"));
var _noStrict = _interopRequireDefault(__webpack_require__(/*! ./transform/noStrict */ "./node_modules/lebab/lib/transform/noStrict.js"));
var _commonjs = _interopRequireDefault(__webpack_require__(/*! ./transform/commonjs */ "./node_modules/lebab/lib/transform/commonjs/index.js"));
var _exponent = _interopRequireDefault(__webpack_require__(/*! ./transform/exponent */ "./node_modules/lebab/lib/transform/exponent.js"));
var _multiVar = _interopRequireDefault(__webpack_require__(/*! ./transform/multiVar */ "./node_modules/lebab/lib/transform/multiVar.js"));
var _forOf = _interopRequireDefault(__webpack_require__(/*! ./transform/forOf */ "./node_modules/lebab/lib/transform/forOf.js"));
var _forEach = _interopRequireDefault(__webpack_require__(/*! ./transform/forEach */ "./node_modules/lebab/lib/transform/forEach/index.js"));
var _includes = _interopRequireDefault(__webpack_require__(/*! ./transform/includes */ "./node_modules/lebab/lib/transform/includes/index.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var transformsMap = {
'class': _class["default"],
'template': _template["default"],
'arrow': _arrow["default"],
'arrow-return': _arrowReturn["default"],
'let': _let["default"],
'default-param': _defaultParam["default"],
'destruct-param': _destructParam["default"],
'arg-spread': _argSpread["default"],
'arg-rest': _argRest["default"],
'obj-method': _objMethod["default"],
'obj-shorthand': _objShorthand["default"],
'no-strict': _noStrict["default"],
'commonjs': _commonjs["default"],
'exponent': _exponent["default"],
'multi-var': _multiVar["default"],
'for-of': _forOf["default"],
'for-each': _forEach["default"],
'includes': _includes["default"]
};
/**
* Factory for creating a Transformer
* by just specifying the names of the transforms.
* @param {String[]} transformNames
* @return {Transformer}
*/
function createTransformer(transformNames) {
validate(transformNames);
return new _Transformer["default"](transformNames.map(function (name) {
return transformsMap[name];
}));
}
function validate(transformNames) {
transformNames.forEach(function (name) {
if (!transformsMap[name]) {
throw "Unknown transform \"".concat(name, "\".");
}
});
}
/***/ }),
/***/ "./node_modules/lebab/lib/scope/BlockScope.js":
/*!****************************************************!*\
!*** ./node_modules/lebab/lib/scope/BlockScope.js ***!
\****************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _Scope2 = _interopRequireDefault(__webpack_require__(/*! ./Scope */ "./node_modules/lebab/lib/scope/Scope.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
/**
* Container for block-scoped variables.
*/
var BlockScope = /*#__PURE__*/function (_Scope) {
_inherits(BlockScope, _Scope);
var _super = _createSuper(BlockScope);
function BlockScope() {
_classCallCheck(this, BlockScope);
return _super.apply(this, arguments);
}
_createClass(BlockScope, [{
key: "register",
value:
/**
* Registers variables in block scope.
*
* (All variables are first registered in function scope.)
*
* @param {String} name Variable name
* @param {Variable} variable Variable object
*/
function register(name, variable) {
if (!this.vars[name]) {
this.vars[name] = [];
}
this.vars[name].push(variable);
}
/**
* Looks up variables from function scope.
*
* Traveling up the scope chain until reaching a function scope.
*
* @param {String} name Variable name
* @return {Variable[]} The found variables (empty array if none found)
*/
}, {
key: "findFunctionScoped",
value: function findFunctionScoped(name) {
return this.parent.findFunctionScoped(name);
}
/**
* Looks up variables from block scope.
*
* Either from the current block, or any parent block.
* When variable found from function scope instead,
* returns empty array to signify it's not properly block-scoped.
*
* @param {String} name Variable name
* @return {Variable[]} The found variables (empty array if none found)
*/
}, {
key: "findBlockScoped",
value: function findBlockScoped(name) {
if (this.vars[name]) {
return this.vars[name];
}
return this.parent.findBlockScoped(name);
}
}]);
return BlockScope;
}(_Scope2["default"]);
exports["default"] = BlockScope;
/***/ }),
/***/ "./node_modules/lebab/lib/scope/FunctionHoister.js":
/*!*********************************************************!*\
!*** ./node_modules/lebab/lib/scope/FunctionHoister.js ***!
\*********************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _fp = __webpack_require__(/*! lodash/fp */ "./node_modules/lodash/fp.js");
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../traverser */ "./node_modules/lebab/lib/traverser.js"));
var functionType = _interopRequireWildcard(__webpack_require__(/*! ../utils/functionType */ "./node_modules/lebab/lib/utils/functionType.js"));
var destructuring = _interopRequireWildcard(__webpack_require__(/*! ../utils/destructuring.js */ "./node_modules/lebab/lib/utils/destructuring.js"));
var _Variable = _interopRequireDefault(__webpack_require__(/*! ../scope/Variable */ "./node_modules/lebab/lib/scope/Variable.js"));
var _VariableGroup = _interopRequireDefault(__webpack_require__(/*! ../scope/VariableGroup */ "./node_modules/lebab/lib/scope/VariableGroup.js"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/**
* Registers all variables defined inside a function.
* Emulating ECMAScript variable hoisting.
*/
var FunctionHoister = /*#__PURE__*/function () {
/**
* Instantiates hoister with a function scope where to
* register the variables that are found.
* @param {FunctionScope} functionScope
*/
function FunctionHoister(functionScope) {
_classCallCheck(this, FunctionHoister);
this.functionScope = functionScope;
}
/**
* Performs the hoisting of a function name, params and variables.
*
* @param {Object} cfg
* @param {Identifier} cfg.id Optional function name
* @param {Identifier[]} cfg.params Optional function parameters
* @param {Object} cfg.body Function body node or Program node to search variables from.
*/
_createClass(FunctionHoister, [{
key: "hoist",
value: function hoist(_ref) {
var id = _ref.id,
params = _ref.params,
body = _ref.body;
if (id) {
this.declareVariable(id, id.name);
}
if (params) {
this.hoistFunctionParams(params);
}
this.hoistVariables(body);
}
}, {
key: "hoistFunctionParams",
value: function hoistFunctionParams(params) {
var _this = this;
return (0, _fp.flow)((0, _fp.map)(destructuring.extractVariables), _fp.flatten, (0, _fp.forEach)(function (node) {
return _this.declareVariable(node, node.name);
}))(params);
}
}, {
key: "declareVariable",
value: function declareVariable(node, name) {
var variable = new _Variable["default"](node);
variable.markDeclared();
this.functionScope.register(name, variable);
}
}, {
key: "hoistVariables",
value: function hoistVariables(ast) {
var _this2 = this;
_traverser["default"].traverse(ast, {
// Use arrow-function here, so we can access outer `this`.
enter: function enter(node, parent) {
if (node.type === 'VariableDeclaration') {
_this2.hoistVariableDeclaration(node, parent);
} else if (functionType.isFunctionDeclaration(node)) {
// Register variable for the function if it has a name
if (node.id) {
_this2.declareVariable(node, node.id.name);
}
// Skip anything inside the nested function
return _traverser["default"].VisitorOption.Skip;
} else if (functionType.isFunctionExpression(node)) {
// Skip anything inside the nested function
return _traverser["default"].VisitorOption.Skip;
}
}
});
}
}, {
key: "hoistVariableDeclaration",
value: function hoistVariableDeclaration(node, parent) {
var _this3 = this;
var group = new _VariableGroup["default"](node, parent);
node.declarations.forEach(function (declaratorNode) {
var variable = new _Variable["default"](declaratorNode, group);
group.add(variable);
// All destructured variable names point to the same Variable instance,
// as we want to treat the destructured variables as one un-breakable
// unit - if one of them is modified and other one not, we cannot break
// them apart into const and let, but instead need to use let for both.
destructuring.extractVariableNames(declaratorNode.id).forEach(function (name) {
_this3.functionScope.register(name, variable);
});
});
}
}]);
return FunctionHoister;
}();
exports["default"] = FunctionHoister;
/***/ }),
/***/ "./node_modules/lebab/lib/scope/FunctionScope.js":
/*!*******************************************************!*\
!*** ./node_modules/lebab/lib/scope/FunctionScope.js ***!
\*******************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _Scope2 = _interopRequireDefault(__webpack_require__(/*! ./Scope */ "./node_modules/lebab/lib/scope/Scope.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
/**
* Container for function-scoped variables.
*/
var FunctionScope = /*#__PURE__*/function (_Scope) {
_inherits(FunctionScope, _Scope);
var _super = _createSuper(FunctionScope);
function FunctionScope() {
_classCallCheck(this, FunctionScope);
return _super.apply(this, arguments);
}
_createClass(FunctionScope, [{
key: "register",
value:
/**
* Registers variables in function scope.
*
* All variables (including function name and params) are first
* registered as function scoped, during hoisting phase.
* Later they can also be registered in block scope.
*
* @param {String} name Variable name
* @param {Variable} variable Variable object
*/
function register(name, variable) {
if (!this.vars[name]) {
this.vars[name] = [variable];
}
this.vars[name].push(variable);
}
/**
* Looks up variables from function scope.
* (Either from this function scope or from any parent function scope.)
*
* @param {String} name Variable name
* @return {Variable[]} The found variables (empty array if none found)
*/
}, {
key: "findFunctionScoped",
value: function findFunctionScoped(name) {
if (this.vars[name]) {
return this.vars[name];
}
if (this.parent) {
return this.parent.findFunctionScoped(name);
}
return [];
}
/**
* Looks up variables from block scope.
* (i.e. the parent block scope of the function scope.)
*
* When variable found from function scope instead,
* returns an empty array to signify it's not properly block-scoped.
*
* @param {String} name Variable name
* @return {Variable[]} The found variables (empty array if none found)
*/
}, {
key: "findBlockScoped",
value: function findBlockScoped(name) {
if (this.vars[name]) {
return [];
}
if (this.parent) {
return this.parent.findBlockScoped(name);
}
return [];
}
}]);
return FunctionScope;
}(_Scope2["default"]);
exports["default"] = FunctionScope;
/***/ }),
/***/ "./node_modules/lebab/lib/scope/Scope.js":
/*!***********************************************!*\
!*** ./node_modules/lebab/lib/scope/Scope.js ***!
\***********************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _fp = __webpack_require__(/*! lodash/fp */ "./node_modules/lodash/fp.js");
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/**
* Base class for Function- and BlockScope.
*
* Subclasses implement:
*
* - register() for adding variables to scope
* - findFunctionScoped() for finding function-scoped vars
* - findBlockScoped() for finding block-scoped vars
*/
var Scope = /*#__PURE__*/function () {
/**
* @param {Scope} parent Parent scope (if any).
*/
function Scope(parent) {
_classCallCheck(this, Scope);
this.parent = parent;
this.vars = Object.create(null); // eslint-disable-line no-null/no-null
}
/**
* Returns parent scope (possibly undefined).
* @return {Scope}
*/
_createClass(Scope, [{
key: "getParent",
value: function getParent() {
return this.parent;
}
/**
* Returns all variables registered in this scope.
* @return {Variable[]}
*/
}, {
key: "getVariables",
value: function getVariables() {
return (0, _fp.flatten)((0, _fp.values)(this.vars));
}
}]);
return Scope;
}();
exports["default"] = Scope;
/***/ }),
/***/ "./node_modules/lebab/lib/scope/ScopeManager.js":
/*!******************************************************!*\
!*** ./node_modules/lebab/lib/scope/ScopeManager.js ***!
\******************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _BlockScope = _interopRequireDefault(__webpack_require__(/*! ../scope/BlockScope */ "./node_modules/lebab/lib/scope/BlockScope.js"));
var _FunctionScope = _interopRequireDefault(__webpack_require__(/*! ../scope/FunctionScope */ "./node_modules/lebab/lib/scope/FunctionScope.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/**
* Keeps track of the current function/block scope.
*/
var ScopeManager = /*#__PURE__*/function () {
function ScopeManager() {
_classCallCheck(this, ScopeManager);
this.scope = undefined;
}
/**
* Enters new function scope
*/
_createClass(ScopeManager, [{
key: "enterFunction",
value: function enterFunction() {
this.scope = new _FunctionScope["default"](this.scope);
}
/**
* Enters new block scope
*/
}, {
key: "enterBlock",
value: function enterBlock() {
this.scope = new _BlockScope["default"](this.scope);
}
/**
* Leaves the current scope.
*/
}, {
key: "leaveScope",
value: function leaveScope() {
this.scope = this.scope.getParent();
}
/**
* Returns the current scope.
* @return {FunctionScope|BlockScope}
*/
}, {
key: "getScope",
value: function getScope() {
return this.scope;
}
}]);
return ScopeManager;
}();
exports["default"] = ScopeManager;
/***/ }),
/***/ "./node_modules/lebab/lib/scope/Variable.js":
/*!**************************************************!*\
!*** ./node_modules/lebab/lib/scope/Variable.js ***!
\**************************************************/
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/**
* Encapsulates a single variable declaring AST node.
*
* It might be the actual VariableDeclarator node,
* but it might also be a function parameter or -name.
*/
var Variable = /*#__PURE__*/function () {
/**
* @param {Object} node AST node declaring the variable.
* @param {VariableGroup} group The containing var-statement (if any).
*/
function Variable(node, group) {
_classCallCheck(this, Variable);
this.node = node;
this.group = group;
this.declared = false;
this.hoisted = false;
this.modified = false;
}
_createClass(Variable, [{
key: "markDeclared",
value: function markDeclared() {
this.declared = true;
}
}, {
key: "isDeclared",
value: function isDeclared() {
return this.declared;
}
/**
* Marks that the use of the variable is not block-scoped,
* so it cannot be simply converted to `let` or `const`.
*/
}, {
key: "markHoisted",
value: function markHoisted() {
this.hoisted = true;
}
/**
* Marks that the variable is assigned to,
* so it cannot be converted to `const`.
*/
}, {
key: "markModified",
value: function markModified() {
this.modified = true;
}
/**
* Returns the strictest possible kind-attribute value for this variable.
*
* @return {String} Either "var", "let" or "const".
*/
}, {
key: "getKind",
value: function getKind() {
if (this.hoisted) {
return 'var';
} else if (this.modified) {
return 'let';
} else {
return 'const';
}
}
/**
* Returns the AST node that declares this variable.
* @return {Object}
*/
}, {
key: "getNode",
value: function getNode() {
return this.node;
}
/**
* Returns the containing var-statement (if any).
* @return {VariableGroup}
*/
}, {
key: "getGroup",
value: function getGroup() {
return this.group;
}
}]);
return Variable;
}();
exports["default"] = Variable;
/***/ }),
/***/ "./node_modules/lebab/lib/scope/VariableGroup.js":
/*!*******************************************************!*\
!*** ./node_modules/lebab/lib/scope/VariableGroup.js ***!
\*******************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _fp = __webpack_require__(/*! lodash/fp */ "./node_modules/lodash/fp.js");
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/**
* Encapsulates a VariableDeclaration node
* and a list of Variable objects declared by it.
*
* PS. Named VariableGroup not VariableDeclaration to avoid confusion with syntax class.
*/
var VariableGroup = /*#__PURE__*/function () {
/**
* @param {VariableDeclaration} node AST node
* @param {Object} parentNode Parent AST node (pretty much any node)
*/
function VariableGroup(node, parentNode) {
_classCallCheck(this, VariableGroup);
this.node = node;
this.parentNode = parentNode;
this.variables = [];
}
/**
* Adds a variable to this group.
* @param {Variable} variable
*/
_createClass(VariableGroup, [{
key: "add",
value: function add(variable) {
this.variables.push(variable);
}
/**
* Returns all variables declared in this group.
* @return {Variable[]}
*/
}, {
key: "getVariables",
value: function getVariables() {
return this.variables;
}
/**
* Returns the `kind` value of variable defined in this group.
*
* When not all variables are of the same kind, returns undefined.
*
* @return {String} Either "var", "let", "const" or undefined.
*/
}, {
key: "getCommonKind",
value: function getCommonKind() {
var firstKind = this.variables[0].getKind();
if (this.variables.every(function (v) {
return v.getKind() === firstKind;
})) {
return firstKind;
} else {
return undefined;
}
}
/**
* Returns the most restrictive possible common `kind` value
* for variables defined in this group.
*
* - When all vars are const, return "const".
* - When some vars are "let" and some "const", returns "let".
* - When some vars are "var", return "var".
*
* @return {String} Either "var", "let" or "const".
*/
}, {
key: "getMostRestrictiveKind",
value: function getMostRestrictiveKind() {
var kindToVal = {
'var': 1,
'let': 2,
'const': 3
};
var valToKind = {
1: 'var',
2: 'let',
3: 'const'
};
var minVal = (0, _fp.min)(this.variables.map(function (v) {
return kindToVal[v.getKind()];
}));
return valToKind[minVal];
}
/**
* Returns the AST node
* @return {VariableDeclaration}
*/
}, {
key: "getNode",
value: function getNode() {
return this.node;
}
/**
* Returns the parent AST node (which can be pretty much anything)
* @return {Object}
*/
}, {
key: "getParentNode",
value: function getParentNode() {
return this.parentNode;
}
}]);
return VariableGroup;
}();
exports["default"] = VariableGroup;
/***/ }),
/***/ "./node_modules/lebab/lib/scope/VariableMarker.js":
/*!********************************************************!*\
!*** ./node_modules/lebab/lib/scope/VariableMarker.js ***!
\********************************************************/
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/**
* Labels variables in relation to their use in block scope.
*
* When variable is declared/modified/referenced not according to
* block scoping rules, it'll be marked hoisted.
*/
var VariableMarker = /*#__PURE__*/function () {
/**
* @param {ScopeManager} scopeManager
*/
function VariableMarker(scopeManager) {
_classCallCheck(this, VariableMarker);
this.scopeManager = scopeManager;
}
/**
* Marks set of variables declared in current block scope.
*
* Takes an array of variable names to support the case of declaring
* multiple variables at once with a destructuring operation.
*
* - Not valid block var when already declared before.
*
* @param {String[]} varNames
*/
_createClass(VariableMarker, [{
key: "markDeclared",
value: function markDeclared(varNames) {
var _this = this;
var alreadySeen = [];
varNames.forEach(function (varName) {
var blockVars = _this.getScope().findFunctionScoped(varName);
// all variable names declared with a destructuring operation
// reference the same Variable object, so when we mark the
// first variable in destructuring as declared, they all
// will be marked as declared, but this kind of re-declaring
// (which isn't actually real re-declaring) should not cause
// variable to be marked as declared multiple times and
// therefore marked as hoisted.
if (blockVars.some(function (v) {
return !alreadySeen.includes(v);
})) {
alreadySeen.push.apply(alreadySeen, _toConsumableArray(blockVars));
// Ignore repeated var declarations
if (blockVars.some(function (variable) {
return variable.isDeclared();
})) {
var _iterator = _createForOfIteratorHelper(blockVars),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var variable = _step.value;
variable.markHoisted();
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
return;
}
}
var _iterator2 = _createForOfIteratorHelper(blockVars),
_step2;
try {
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
var _variable = _step2.value;
// Remember that it's declared and register in current block scope
_variable.markDeclared();
}
} catch (err) {
_iterator2.e(err);
} finally {
_iterator2.f();
}
var scope = _this.getScope();
var _iterator3 = _createForOfIteratorHelper(blockVars),
_step3;
try {
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
var _variable2 = _step3.value;
scope.register(varName, _variable2);
}
} catch (err) {
_iterator3.e(err);
} finally {
_iterator3.f();
}
});
}
/**
* Marks variable modified in current block scope.
*
* - Not valid block var when not declared in current block scope.
*
* @param {String} varName
*/
}, {
key: "markModified",
value: function markModified(varName) {
var blockVars = this.getScope().findBlockScoped(varName);
if (blockVars.length > 0) {
var _iterator4 = _createForOfIteratorHelper(blockVars),
_step4;
try {
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
var variable = _step4.value;
variable.markModified();
}
} catch (err) {
_iterator4.e(err);
} finally {
_iterator4.f();
}
return;
}
var _iterator5 = _createForOfIteratorHelper(this.getScope().findFunctionScoped(varName)),
_step5;
try {
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
var _variable3 = _step5.value;
_variable3.markHoisted();
_variable3.markModified();
}
} catch (err) {
_iterator5.e(err);
} finally {
_iterator5.f();
}
}
/**
* Marks variable referenced in current block scope.
*
* - Not valid block var when not declared in current block scope.
*
* @param {String} varName
*/
}, {
key: "markReferenced",
value: function markReferenced(varName) {
var blockVars = this.getScope().findBlockScoped(varName);
if (blockVars.length > 0) {
return;
}
var _iterator6 = _createForOfIteratorHelper(this.getScope().findFunctionScoped(varName)),
_step6;
try {
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
var variable = _step6.value;
variable.markHoisted();
}
} catch (err) {
_iterator6.e(err);
} finally {
_iterator6.f();
}
}
}, {
key: "getScope",
value: function getScope() {
return this.scopeManager.getScope();
}
}]);
return VariableMarker;
}();
exports["default"] = VariableMarker;
/***/ }),
/***/ "./node_modules/lebab/lib/syntax/ArrowFunctionExpression.js":
/*!******************************************************************!*\
!*** ./node_modules/lebab/lib/syntax/ArrowFunctionExpression.js ***!
\******************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _BaseSyntax2 = _interopRequireDefault(__webpack_require__(/*! ./BaseSyntax */ "./node_modules/lebab/lib/syntax/BaseSyntax.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
/**
* The class to define the ArrowFunctionExpression syntax
*/
var ArrowFunctionExpression = /*#__PURE__*/function (_BaseSyntax) {
_inherits(ArrowFunctionExpression, _BaseSyntax);
var _super = _createSuper(ArrowFunctionExpression);
/**
* The constructor of ArrowFunctionExpression
*
* @param {Object} cfg
* @param {Node} cfg.body
* @param {Node[]} cfg.params
* @param {Node[]} cfg.defaults
* @param {Node} cfg.rest (optional)
*/
function ArrowFunctionExpression(_ref) {
var _this;
var body = _ref.body,
params = _ref.params,
defaults = _ref.defaults,
rest = _ref.rest,
async = _ref.async;
_classCallCheck(this, ArrowFunctionExpression);
_this = _super.call(this, 'ArrowFunctionExpression');
_this.body = body;
_this.params = params;
_this.defaults = defaults;
_this.rest = rest;
_this.async = async;
_this.generator = false;
_this.id = undefined;
return _this;
}
return _createClass(ArrowFunctionExpression);
}(_BaseSyntax2["default"]);
exports["default"] = ArrowFunctionExpression;
/***/ }),
/***/ "./node_modules/lebab/lib/syntax/BaseSyntax.js":
/*!*****************************************************!*\
!*** ./node_modules/lebab/lib/syntax/BaseSyntax.js ***!
\*****************************************************/
/***/ ((__unused_webpack_module, exports) => {
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* @abstract BaseSyntax
*/
var BaseSyntax = /*#__PURE__*/_createClass(
/**
* The constructor of BaseSyntax
*
* @param {String} type
*/
function BaseSyntax(type) {
_classCallCheck(this, BaseSyntax);
this.type = type;
});
exports["default"] = BaseSyntax;
/***/ }),
/***/ "./node_modules/lebab/lib/syntax/ExportNamedDeclaration.js":
/*!*****************************************************************!*\
!*** ./node_modules/lebab/lib/syntax/ExportNamedDeclaration.js ***!
\*****************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _BaseSyntax2 = _interopRequireDefault(__webpack_require__(/*! ./BaseSyntax */ "./node_modules/lebab/lib/syntax/BaseSyntax.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
/**
* The class to define the ExportNamedDeclaration syntax.
*/
var ExportNamedDeclaration = /*#__PURE__*/function (_BaseSyntax) {
_inherits(ExportNamedDeclaration, _BaseSyntax);
var _super = _createSuper(ExportNamedDeclaration);
/**
* Constructed with either declaration or specifiers.
* @param {Object} cfg
* @param {Object} cfg.declaration Any *Declaration node (optional)
* @param {Object[]} cfg.specifiers List of specifiers (optional)
* @param {Object[]} cfg.comments Comments data (optional)
*/
function ExportNamedDeclaration(_ref) {
var _this;
var declaration = _ref.declaration,
specifiers = _ref.specifiers,
comments = _ref.comments;
_classCallCheck(this, ExportNamedDeclaration);
_this = _super.call(this, 'ExportNamedDeclaration');
_this.declaration = declaration;
_this.specifiers = specifiers;
_this.comments = comments;
return _this;
}
return _createClass(ExportNamedDeclaration);
}(_BaseSyntax2["default"]);
exports["default"] = ExportNamedDeclaration;
/***/ }),
/***/ "./node_modules/lebab/lib/syntax/ImportDeclaration.js":
/*!************************************************************!*\
!*** ./node_modules/lebab/lib/syntax/ImportDeclaration.js ***!
\************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _BaseSyntax2 = _interopRequireDefault(__webpack_require__(/*! ./BaseSyntax */ "./node_modules/lebab/lib/syntax/BaseSyntax.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
/**
* The class to define the ImportDeclaration syntax
*/
var ImportDeclaration = /*#__PURE__*/function (_BaseSyntax) {
_inherits(ImportDeclaration, _BaseSyntax);
var _super = _createSuper(ImportDeclaration);
/**
* @param {Object} cfg
* @param {ImportSpecifier[]|ImportDefaultSpecifier[]} cfg.specifiers
* @param {Literal} cfg.source String literal containing library path
*/
function ImportDeclaration(_ref) {
var _this;
var specifiers = _ref.specifiers,
source = _ref.source;
_classCallCheck(this, ImportDeclaration);
_this = _super.call(this, 'ImportDeclaration');
_this.specifiers = specifiers;
_this.source = source;
return _this;
}
return _createClass(ImportDeclaration);
}(_BaseSyntax2["default"]);
exports["default"] = ImportDeclaration;
/***/ }),
/***/ "./node_modules/lebab/lib/syntax/ImportDefaultSpecifier.js":
/*!*****************************************************************!*\
!*** ./node_modules/lebab/lib/syntax/ImportDefaultSpecifier.js ***!
\*****************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _BaseSyntax2 = _interopRequireDefault(__webpack_require__(/*! ./BaseSyntax */ "./node_modules/lebab/lib/syntax/BaseSyntax.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
/**
* The class to define the ImportDefaultSpecifier syntax
*/
var ImportDefaultSpecifier = /*#__PURE__*/function (_BaseSyntax) {
_inherits(ImportDefaultSpecifier, _BaseSyntax);
var _super = _createSuper(ImportDefaultSpecifier);
/**
* @param {Identifier} local The local variable where to import
*/
function ImportDefaultSpecifier(local) {
var _this;
_classCallCheck(this, ImportDefaultSpecifier);
_this = _super.call(this, 'ImportDefaultSpecifier');
_this.local = local;
return _this;
}
return _createClass(ImportDefaultSpecifier);
}(_BaseSyntax2["default"]);
exports["default"] = ImportDefaultSpecifier;
/***/ }),
/***/ "./node_modules/lebab/lib/syntax/ImportSpecifier.js":
/*!**********************************************************!*\
!*** ./node_modules/lebab/lib/syntax/ImportSpecifier.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _BaseSyntax2 = _interopRequireDefault(__webpack_require__(/*! ./BaseSyntax */ "./node_modules/lebab/lib/syntax/BaseSyntax.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
/**
* The class to define the ImportSpecifier syntax
*/
var ImportSpecifier = /*#__PURE__*/function (_BaseSyntax) {
_inherits(ImportSpecifier, _BaseSyntax);
var _super = _createSuper(ImportSpecifier);
/**
* @param {Object} cfg
* @param {Identifier} cfg.local The local variable
* @param {Identifier} cfg.imported The imported variable
*/
function ImportSpecifier(_ref) {
var _this;
var local = _ref.local,
imported = _ref.imported;
_classCallCheck(this, ImportSpecifier);
_this = _super.call(this, 'ImportSpecifier');
_this.local = local;
_this.imported = imported;
return _this;
}
return _createClass(ImportSpecifier);
}(_BaseSyntax2["default"]);
exports["default"] = ImportSpecifier;
/***/ }),
/***/ "./node_modules/lebab/lib/syntax/TemplateElement.js":
/*!**********************************************************!*\
!*** ./node_modules/lebab/lib/syntax/TemplateElement.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _BaseSyntax2 = _interopRequireDefault(__webpack_require__(/*! ./BaseSyntax */ "./node_modules/lebab/lib/syntax/BaseSyntax.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
/**
* The class to define the TemplateElement syntax
*/
var TemplateElement = /*#__PURE__*/function (_BaseSyntax) {
_inherits(TemplateElement, _BaseSyntax);
var _super = _createSuper(TemplateElement);
/**
* Create a template literal
*
* @param {Object} cfg
* @param {String} cfg.raw As it looks in source, with escapes added
* @param {String} cfg.cooked The actual value
* @param {Boolean} cfg.tail True to signify the last element in TemplateLiteral
*/
function TemplateElement(_ref) {
var _this;
var _ref$raw = _ref.raw,
raw = _ref$raw === void 0 ? '' : _ref$raw,
_ref$cooked = _ref.cooked,
cooked = _ref$cooked === void 0 ? '' : _ref$cooked,
_ref$tail = _ref.tail,
tail = _ref$tail === void 0 ? false : _ref$tail;
_classCallCheck(this, TemplateElement);
_this = _super.call(this, 'TemplateElement');
_this.value = {
raw: raw,
cooked: cooked
};
_this.tail = tail;
return _this;
}
return _createClass(TemplateElement);
}(_BaseSyntax2["default"]);
exports["default"] = TemplateElement;
/***/ }),
/***/ "./node_modules/lebab/lib/syntax/TemplateLiteral.js":
/*!**********************************************************!*\
!*** ./node_modules/lebab/lib/syntax/TemplateLiteral.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _BaseSyntax2 = _interopRequireDefault(__webpack_require__(/*! ./BaseSyntax */ "./node_modules/lebab/lib/syntax/BaseSyntax.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
/**
* The class to define the TemplateLiteral syntax
*/
var TemplateLiteral = /*#__PURE__*/function (_BaseSyntax) {
_inherits(TemplateLiteral, _BaseSyntax);
var _super = _createSuper(TemplateLiteral);
/**
* Create a template literal
* @param {Object[]} quasis String parts
* @param {Object[]} expressions Expressions between string parts
*/
function TemplateLiteral(_ref) {
var _this;
var quasis = _ref.quasis,
expressions = _ref.expressions;
_classCallCheck(this, TemplateLiteral);
_this = _super.call(this, 'TemplateLiteral');
_this.quasis = quasis;
_this.expressions = expressions;
return _this;
}
return _createClass(TemplateLiteral);
}(_BaseSyntax2["default"]);
exports["default"] = TemplateLiteral;
/***/ }),
/***/ "./node_modules/lebab/lib/syntax/VariableDeclaration.js":
/*!**************************************************************!*\
!*** ./node_modules/lebab/lib/syntax/VariableDeclaration.js ***!
\**************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _BaseSyntax2 = _interopRequireDefault(__webpack_require__(/*! ./BaseSyntax */ "./node_modules/lebab/lib/syntax/BaseSyntax.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
/**
* The class to define the VariableDeclaration syntax
*/
var VariableDeclaration = /*#__PURE__*/function (_BaseSyntax) {
_inherits(VariableDeclaration, _BaseSyntax);
var _super = _createSuper(VariableDeclaration);
/**
* The constructor of VariableDeclaration
*
* @param {String} kind
* @param {VariableDeclarator[]} declarations
*/
function VariableDeclaration(kind, declarations) {
var _this;
_classCallCheck(this, VariableDeclaration);
_this = _super.call(this, 'VariableDeclaration');
_this.kind = kind;
_this.declarations = declarations;
return _this;
}
return _createClass(VariableDeclaration);
}(_BaseSyntax2["default"]);
exports["default"] = VariableDeclaration;
/***/ }),
/***/ "./node_modules/lebab/lib/transform/argRest.js":
/*!*****************************************************!*\
!*** ./node_modules/lebab/lib/transform/argRest.js ***!
\*****************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _fp = __webpack_require__(/*! lodash/fp */ "./node_modules/lodash/fp.js");
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../traverser */ "./node_modules/lebab/lib/traverser.js"));
var _withScope = _interopRequireDefault(__webpack_require__(/*! ../withScope */ "./node_modules/lebab/lib/withScope.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _default(ast) {
_traverser["default"].replace(ast, (0, _withScope["default"])(ast, {
enter: function enter(node, parent, scope) {
if (isES5Function(node) && node.params.length === 0) {
var argumentsVar = (0, _fp.find)(function (v) {
return v.name === 'arguments';
}, scope.variables);
// Look through all the places where arguments is used:
// Make sure none of these has access to some already existing `args` variable
if (argumentsVar && argumentsVar.references.length > 0 && !argumentsVar.references.some(function (ref) {
return hasArgs(ref.from);
})) {
// Change all arguments --> args
argumentsVar.references.forEach(function (ref) {
ref.identifier.name = 'args';
});
// Change function() --> function(...args)
node.params = [createRestElement()];
}
}
}
}));
}
function isES5Function(node) {
return node.type === 'FunctionDeclaration' || node.type === 'FunctionExpression';
}
function hasArgs(scope) {
if (!scope) {
return false;
}
if (scope.variables.some(function (v) {
return v.name === 'args';
})) {
return true;
}
return hasArgs(scope.upper);
}
function createRestElement() {
return {
type: 'RestElement',
argument: {
type: 'Identifier',
name: 'args'
}
};
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/argSpread.js":
/*!*******************************************************!*\
!*** ./node_modules/lebab/lib/transform/argSpread.js ***!
\*******************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _fp = __webpack_require__(/*! lodash/fp */ "./node_modules/lodash/fp.js");
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../traverser */ "./node_modules/lebab/lib/traverser.js"));
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _default(ast) {
_traverser["default"].replace(ast, {
enter: function enter(node) {
var _matchFunctionApplyCa = matchFunctionApplyCall(node),
func = _matchFunctionApplyCa.func,
array = _matchFunctionApplyCa.array;
if (func) {
return createCallWithSpread(func, array);
}
var _matchObjectApplyCall = matchObjectApplyCall(node),
memberExpr = _matchObjectApplyCall.memberExpr,
thisParam = _matchObjectApplyCall.thisParam,
arrayParam = _matchObjectApplyCall.arrayParam;
if (memberExpr && (0, _fp.isEqual)(omitLoc(memberExpr.object), omitLoc(thisParam))) {
return createCallWithSpread(memberExpr, arrayParam);
}
}
});
}
function createCallWithSpread(func, array) {
return {
type: 'CallExpression',
callee: func,
arguments: [{
type: 'SpreadElement',
argument: array
}]
};
}
// Recursively strips `loc`, `start` and `end` fields from given object and its nested objects,
// removing the location information that we don't care about when comparing
// AST nodes.
function omitLoc(obj) {
if ((0, _fp.isArray)(obj)) {
return obj.map(omitLoc);
} else if ((0, _fp.isObjectLike)(obj)) {
return (0, _fp.flow)((0, _fp.omit)(['loc', 'start', 'end']), (0, _fp.mapValues)(omitLoc))(obj);
} else {
return obj;
}
}
var isUndefined = (0, _fMatches.matches)({
type: 'Identifier',
name: 'undefined'
});
var isNull = (0, _fMatches.matches)({
type: 'Literal',
value: null,
// eslint-disable-line no-null/no-null
raw: 'null'
});
function matchFunctionApplyCall(node) {
return (0, _fMatches.matches)({
type: 'CallExpression',
callee: {
type: 'MemberExpression',
computed: false,
object: (0, _fMatches.extract)('func', {
type: 'Identifier'
}),
property: {
type: 'Identifier',
name: 'apply'
}
},
arguments: [function (arg) {
return isUndefined(arg) || isNull(arg);
}, (0, _fMatches.extractAny)('array')]
}, node);
}
function matchObjectApplyCall(node) {
return (0, _fMatches.matches)({
type: 'CallExpression',
callee: {
type: 'MemberExpression',
computed: false,
object: (0, _fMatches.extract)('memberExpr', {
type: 'MemberExpression'
}),
property: {
type: 'Identifier',
name: 'apply'
}
},
arguments: [(0, _fMatches.extractAny)('thisParam'), (0, _fMatches.extractAny)('arrayParam')]
}, node);
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/arrow.js":
/*!***************************************************!*\
!*** ./node_modules/lebab/lib/transform/arrow.js ***!
\***************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _fp = __webpack_require__(/*! lodash/fp */ "./node_modules/lodash/fp.js");
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../traverser */ "./node_modules/lebab/lib/traverser.js"));
var _ArrowFunctionExpression = _interopRequireDefault(__webpack_require__(/*! ../syntax/ArrowFunctionExpression */ "./node_modules/lebab/lib/syntax/ArrowFunctionExpression.js"));
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
var _copyComments = _interopRequireDefault(__webpack_require__(/*! ../utils/copyComments */ "./node_modules/lebab/lib/utils/copyComments.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _default(ast, logger) {
_traverser["default"].replace(ast, {
enter: function enter(node, parent) {
if (isFunctionConvertableToArrow(node, parent)) {
if (hasArguments(node.body)) {
logger.warn(node, 'Can not use arguments in arrow function', 'arrow');
return;
}
return functionToArrow(node, parent);
}
var _matchBoundFunction = matchBoundFunction(node),
func = _matchBoundFunction.func;
if (func) {
return functionToArrow(func, parent);
}
}
});
}
function isFunctionConvertableToArrow(node, parent) {
return node.type === 'FunctionExpression' && parent.type !== 'Property' && parent.type !== 'MethodDefinition' && !node.id && !node.generator && !hasThis(node.body);
}
// Matches: function(){}.bind(this)
function matchBoundFunction(node) {
return (0, _fMatches.matches)({
type: 'CallExpression',
callee: {
type: 'MemberExpression',
computed: false,
object: (0, _fMatches.extract)('func', {
type: 'FunctionExpression',
id: null,
// eslint-disable-line no-null/no-null
body: function body(_body) {
return !hasArguments(_body);
},
generator: false
}),
property: {
type: 'Identifier',
name: 'bind'
}
},
arguments: (0, _fMatches.matchesLength)([{
type: 'ThisExpression'
}])
}, node);
}
function hasThis(ast) {
return hasInFunctionBody(ast, {
type: 'ThisExpression'
});
}
function hasArguments(ast) {
return hasInFunctionBody(ast, {
type: 'Identifier',
name: 'arguments'
});
}
// Returns true when pattern matches any node in given function body,
// excluding any nested functions
function hasInFunctionBody(ast, pattern) {
return _traverser["default"].find(ast, (0, _fp.matches)(pattern), {
skipTypes: ['FunctionExpression', 'FunctionDeclaration']
});
}
function functionToArrow(func, parent) {
var arrow = new _ArrowFunctionExpression["default"]({
body: func.body,
params: func.params,
defaults: func.defaults,
rest: func.rest,
async: func.async
});
(0, _copyComments["default"])({
from: func,
to: arrow
});
// Get rid of extra parentheses around IIFE
// by forcing Recast to reformat the CallExpression
if (isIIFE(func, parent)) {
parent.original = null; // eslint-disable-line no-null/no-null
}
return arrow;
}
// Is it immediately invoked function expression?
function isIIFE(func, parent) {
return parent.type === 'CallExpression' && parent.callee === func;
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/arrowReturn.js":
/*!*********************************************************!*\
!*** ./node_modules/lebab/lib/transform/arrowReturn.js ***!
\*********************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../traverser */ "./node_modules/lebab/lib/traverser.js"));
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
var _copyComments = _interopRequireDefault(__webpack_require__(/*! ../utils/copyComments */ "./node_modules/lebab/lib/utils/copyComments.js"));
var _fp = __webpack_require__(/*! lodash/fp */ "./node_modules/lodash/fp.js");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _default(ast) {
_traverser["default"].replace(ast, {
enter: function enter(node) {
if (isShortenableArrowFunction(node)) {
return shortenReturn(node);
}
}
});
}
function shortenReturn(node) {
node.body = extractArrowBody(node.body);
return node;
}
var matchesReturnBlock = (0, _fMatches.matches)({
type: 'BlockStatement',
body: (0, _fMatches.matchesLength)([(0, _fMatches.extract)('returnStatement', {
type: 'ReturnStatement',
argument: (0, _fMatches.extract)('returnVal', (0, _fp.negate)(_fp.isNull))
})])
});
function isShortenableArrowFunction(node) {
return node.type === 'ArrowFunctionExpression' && matchesReturnBlock(node.body);
}
function extractArrowBody(block) {
var _matchesReturnBlock = matchesReturnBlock(block),
returnStatement = _matchesReturnBlock.returnStatement,
returnVal = _matchesReturnBlock.returnVal;
// preserve return statement comments
(0, _copyComments["default"])({
from: returnStatement,
to: returnVal
});
return returnVal;
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/class/PotentialClass.js":
/*!******************************************************************!*\
!*** ./node_modules/lebab/lib/transform/class/PotentialClass.js ***!
\******************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _fp = __webpack_require__(/*! lodash/fp */ "./node_modules/lodash/fp.js");
var _extractComments = _interopRequireDefault(__webpack_require__(/*! ./extractComments */ "./node_modules/lebab/lib/transform/class/extractComments.js"));
var _multiReplaceStatement = _interopRequireDefault(__webpack_require__(/*! ./../../utils/multiReplaceStatement */ "./node_modules/lebab/lib/utils/multiReplaceStatement.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/**
* Represents a potential class to be created.
*/
var PotentialClass = /*#__PURE__*/function () {
/**
* @param {Object} cfg
* @param {String} cfg.name Class name
* @param {Object} cfg.fullNode Node to remove after converting to class
* @param {Object[]} cfg.commentNodes Nodes to extract comments from
* @param {Object} cfg.parent
*/
function PotentialClass(_ref) {
var name = _ref.name,
fullNode = _ref.fullNode,
commentNodes = _ref.commentNodes,
parent = _ref.parent;
_classCallCheck(this, PotentialClass);
this.name = name;
this.constructor = undefined;
this.fullNode = fullNode;
this.superClass = undefined;
this.commentNodes = commentNodes;
this.parent = parent;
this.methods = [];
this.replacements = [];
}
/**
* Returns the name of the class.
* @return {String}
*/
_createClass(PotentialClass, [{
key: "getName",
value: function getName() {
return this.name;
}
/**
* Returns the AST node for the original function
* @return {Object}
*/
}, {
key: "getFullNode",
value: function getFullNode() {
return this.fullNode;
}
/**
* Set the constructor.
* @param {PotentialMethod} method.
*/
}, {
key: "setConstructor",
value: function setConstructor(method) {
this.constructor = method;
}
/**
* Set the superClass and set up the related assignment expressions to be
* removed during transformation.
* @param {Node} superClass The super class node.
* @param {Node[]} relatedExpressions The related expressions to be removed
* during transformation.
*/
}, {
key: "setSuperClass",
value: function setSuperClass(superClass, relatedExpressions) {
this.superClass = superClass;
var _iterator = _createForOfIteratorHelper(relatedExpressions),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var _step$value = _step.value,
parent = _step$value.parent,
node = _step$value.node;
this.replacements.push({
parent: parent,
node: node,
replacements: []
});
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
this.constructor.setSuperClass(superClass);
}
/**
* Adds method to class.
* @param {PotentialMethod} method
*/
}, {
key: "addMethod",
value: function addMethod(method) {
this.methods.push(method);
}
/**
* True when class has at least one method (besides constructor).
* @return {Boolean}
*/
}, {
key: "isTransformable",
value: function isTransformable() {
return this.methods.length > 0 || this.superClass !== undefined;
}
/**
* Replaces original constructor function and manual prototype assignments
* with ClassDeclaration.
*/
}, {
key: "transform",
value: function transform() {
(0, _multiReplaceStatement["default"])({
parent: this.parent,
node: this.fullNode,
replacements: [this.toClassDeclaration()]
});
this.replacements.forEach(_multiReplaceStatement["default"]);
this.methods.forEach(function (method) {
return method.remove();
});
}
}, {
key: "toClassDeclaration",
value: function toClassDeclaration() {
return {
type: 'ClassDeclaration',
superClass: this.superClass,
id: {
type: 'Identifier',
name: this.name
},
body: {
type: 'ClassBody',
body: this.createMethods()
},
comments: (0, _extractComments["default"])(this.commentNodes)
};
}
}, {
key: "createMethods",
value: function createMethods() {
var _this = this;
return (0, _fp.compact)([this.createConstructor()].concat(_toConsumableArray(this.methods.map(function (method) {
method.setSuperClass(_this.superClass);
return method.toMethodDefinition();
}))));
}
}, {
key: "createConstructor",
value: function createConstructor() {
return this.constructor.isEmpty() ? undefined : this.constructor.toMethodDefinition();
}
}]);
return PotentialClass;
}();
exports["default"] = PotentialClass;
/***/ }),
/***/ "./node_modules/lebab/lib/transform/class/PotentialConstructor.js":
/*!************************************************************************!*\
!*** ./node_modules/lebab/lib/transform/class/PotentialConstructor.js ***!
\************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../../traverser */ "./node_modules/lebab/lib/traverser.js"));
var _isEqualAst = _interopRequireDefault(__webpack_require__(/*! ./../../utils/isEqualAst */ "./node_modules/lebab/lib/utils/isEqualAst.js"));
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
var _PotentialMethod2 = _interopRequireDefault(__webpack_require__(/*! ./PotentialMethod */ "./node_modules/lebab/lib/transform/class/PotentialMethod.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
/**
* Represents a potential constructor method to be created.
*/
var PotentialConstructor = /*#__PURE__*/function (_PotentialMethod) {
_inherits(PotentialConstructor, _PotentialMethod);
var _super = _createSuper(PotentialConstructor);
function PotentialConstructor(cfg) {
_classCallCheck(this, PotentialConstructor);
cfg.name = 'constructor';
return _super.call(this, cfg);
}
// Override superclass method
_createClass(PotentialConstructor, [{
key: "getBody",
value: function getBody() {
if (this.superClass) {
return this.transformSuperCalls(this.getBodyBlock());
} else {
return this.getBodyBlock();
}
}
// Transforms constructor body by replacing
// SuperClass.call(this, ...args) --> super(...args)
}, {
key: "transformSuperCalls",
value: function transformSuperCalls(body) {
var _this = this;
return _traverser["default"].replace(body, {
enter: function enter(node) {
if (_this.isSuperConstructorCall(node)) {
node.expression.callee = {
type: 'Super'
};
node.expression.arguments = node.expression.arguments.slice(1);
}
}
});
}
}, {
key: "isSuperConstructorCall",
value: function isSuperConstructorCall(node) {
var _this2 = this;
return (0, _fMatches.matches)({
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'MemberExpression',
object: function object(obj) {
return (0, _isEqualAst["default"])(obj, _this2.superClass);
},
property: {
type: 'Identifier',
name: 'call'
}
},
arguments: [{
type: 'ThisExpression'
}]
}
}, node);
}
}]);
return PotentialConstructor;
}(_PotentialMethod2["default"]);
exports["default"] = PotentialConstructor;
/***/ }),
/***/ "./node_modules/lebab/lib/transform/class/PotentialMethod.js":
/*!*******************************************************************!*\
!*** ./node_modules/lebab/lib/transform/class/PotentialMethod.js ***!
\*******************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../../traverser */ "./node_modules/lebab/lib/traverser.js"));
var _isEqualAst = _interopRequireDefault(__webpack_require__(/*! ./../../utils/isEqualAst */ "./node_modules/lebab/lib/utils/isEqualAst.js"));
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
var _extractComments = _interopRequireDefault(__webpack_require__(/*! ./extractComments */ "./node_modules/lebab/lib/transform/class/extractComments.js"));
var _multiReplaceStatement = _interopRequireDefault(__webpack_require__(/*! ./../../utils/multiReplaceStatement */ "./node_modules/lebab/lib/utils/multiReplaceStatement.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/**
* Represents a potential class method to be created.
*/
var PotentialMethod = /*#__PURE__*/function () {
/**
* @param {Object} cfg
* @param {String} cfg.name Method name
* @param {Object} cfg.methodNode
* @param {Object} cfg.fullNode Node to remove after converting to class
* @param {Object[]} cfg.commentNodes Nodes to extract comments from
* @param {Object} cfg.parent
* @param {String} [cfg.kind] Either 'get' or 'set' (optional)
* @param {Boolean} [cfg.static] True to make static method (optional)
*/
function PotentialMethod(cfg) {
_classCallCheck(this, PotentialMethod);
this.name = cfg.name;
this.methodNode = cfg.methodNode;
this.fullNode = cfg.fullNode;
this.commentNodes = cfg.commentNodes || [];
this.parent = cfg.parent;
this.kind = cfg.kind || 'method';
this["static"] = cfg["static"] || false;
}
/**
* Sets the superClass node.
* @param {Node} superClass
*/
_createClass(PotentialMethod, [{
key: "setSuperClass",
value: function setSuperClass(superClass) {
this.superClass = superClass;
}
/**
* True when method body is empty.
* @return {Boolean}
*/
}, {
key: "isEmpty",
value: function isEmpty() {
return this.getBodyBlock().body.length === 0;
}
/**
* Transforms the potential method to actual MethodDefinition node.
* @return {MethodDefinition}
*/
}, {
key: "toMethodDefinition",
value: function toMethodDefinition() {
return {
type: 'MethodDefinition',
key: {
type: 'Identifier',
name: this.name
},
computed: false,
value: {
type: 'FunctionExpression',
async: this.methodNode.async,
params: this.methodNode.params,
defaults: this.methodNode.defaults,
body: this.getBody(),
generator: false,
expression: false
},
kind: this.kind,
"static": this["static"],
comments: (0, _extractComments["default"])(this.commentNodes)
};
}
/**
* Removes original prototype assignment node from AST.
*/
}, {
key: "remove",
value: function remove() {
(0, _multiReplaceStatement["default"])({
parent: this.parent,
node: this.fullNode,
replacements: []
});
}
// To be overridden in subclasses
}, {
key: "getBody",
value: function getBody() {
if (this.superClass) {
return this.transformSuperCalls(this.getBodyBlock());
} else {
return this.getBodyBlock();
}
}
}, {
key: "getBodyBlock",
value: function getBodyBlock() {
if (this.methodNode.body.type === 'BlockStatement') {
return this.methodNode.body;
} else {
return {
type: 'BlockStatement',
body: [{
type: 'ReturnStatement',
argument: this.methodNode.body
}]
};
}
}
// Transforms method body by replacing
// SuperClass.prototype.foo.call(this, ...args) --> super.foo(...args)
}, {
key: "transformSuperCalls",
value: function transformSuperCalls(body) {
var _this = this;
return _traverser["default"].replace(body, {
enter: function enter(node) {
var m = _this.matchSuperCall(node);
if (m) {
node.expression.callee = {
type: 'MemberExpression',
computed: false,
object: {
type: 'Super'
},
property: m.method
};
node.expression.arguments = node.expression.arguments.slice(1);
}
}
});
}
}, {
key: "matchSuperCall",
value: function matchSuperCall(node) {
var _this2 = this;
return (0, _fMatches.matches)({
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'MemberExpression',
computed: false,
object: {
type: 'MemberExpression',
computed: false,
object: {
type: 'MemberExpression',
computed: false,
object: function object(obj) {
return (0, _isEqualAst["default"])(obj, _this2.superClass);
},
property: {
type: 'Identifier',
name: 'prototype'
}
},
property: (0, _fMatches.extract)('method', {
type: 'Identifier'
})
},
property: {
type: 'Identifier',
name: 'call'
}
},
arguments: [{
type: 'ThisExpression'
}]
}
}, node);
}
}]);
return PotentialMethod;
}();
exports["default"] = PotentialMethod;
/***/ }),
/***/ "./node_modules/lebab/lib/transform/class/extractComments.js":
/*!*******************************************************************!*\
!*** ./node_modules/lebab/lib/transform/class/extractComments.js ***!
\*******************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = extractComments;
var _fp = __webpack_require__(/*! lodash/fp */ "./node_modules/lodash/fp.js");
/**
* Extracts comments from an array of nodes.
* @param {Object[]} nodes
* @param {Object[]} extracted comments
*/
function extractComments(nodes) {
return (0, _fp.flatMap)(function (n) {
return n.comments || [];
}, nodes);
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/class/index.js":
/*!*********************************************************!*\
!*** ./node_modules/lebab/lib/transform/class/index.js ***!
\*********************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _fp = __webpack_require__(/*! lodash/fp */ "./node_modules/lodash/fp.js");
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../../traverser */ "./node_modules/lebab/lib/traverser.js"));
var _PotentialClass = _interopRequireDefault(__webpack_require__(/*! ./PotentialClass */ "./node_modules/lebab/lib/transform/class/PotentialClass.js"));
var _PotentialMethod = _interopRequireDefault(__webpack_require__(/*! ./PotentialMethod */ "./node_modules/lebab/lib/transform/class/PotentialMethod.js"));
var _PotentialConstructor = _interopRequireDefault(__webpack_require__(/*! ./PotentialConstructor */ "./node_modules/lebab/lib/transform/class/PotentialConstructor.js"));
var _matchFunctionDeclaration = _interopRequireDefault(__webpack_require__(/*! ./matchFunctionDeclaration */ "./node_modules/lebab/lib/transform/class/matchFunctionDeclaration.js"));
var _matchFunctionVar = _interopRequireDefault(__webpack_require__(/*! ./matchFunctionVar */ "./node_modules/lebab/lib/transform/class/matchFunctionVar.js"));
var _matchFunctionAssignment = _interopRequireDefault(__webpack_require__(/*! ./matchFunctionAssignment */ "./node_modules/lebab/lib/transform/class/matchFunctionAssignment.js"));
var _matchPrototypeFunctionAssignment = _interopRequireDefault(__webpack_require__(/*! ./matchPrototypeFunctionAssignment */ "./node_modules/lebab/lib/transform/class/matchPrototypeFunctionAssignment.js"));
var _matchPrototypeObjectAssignment = _interopRequireDefault(__webpack_require__(/*! ./matchPrototypeObjectAssignment */ "./node_modules/lebab/lib/transform/class/matchPrototypeObjectAssignment.js"));
var _matchObjectDefinePropertyCall = _interopRequireWildcard(__webpack_require__(/*! ./matchObjectDefinePropertyCall */ "./node_modules/lebab/lib/transform/class/matchObjectDefinePropertyCall.js"));
var _Inheritance = _interopRequireDefault(__webpack_require__(/*! ./inheritance/Inheritance */ "./node_modules/lebab/lib/transform/class/inheritance/Inheritance.js"));
var _matchObjectDefinePropertiesCall = _interopRequireWildcard(__webpack_require__(/*! ./matchObjectDefinePropertiesCall.js */ "./node_modules/lebab/lib/transform/class/matchObjectDefinePropertiesCall.js"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _default(ast, logger) {
var potentialClasses = {};
var inheritance = new _Inheritance["default"]();
_traverser["default"].traverse(ast, {
enter: function enter(node, parent) {
var m;
if (m = (0, _matchFunctionDeclaration["default"])(node) || (0, _matchFunctionVar["default"])(node)) {
potentialClasses[m.className] = new _PotentialClass["default"]({
name: m.className,
fullNode: node,
commentNodes: [node],
parent: parent
});
potentialClasses[m.className].setConstructor(new _PotentialConstructor["default"]({
methodNode: m.constructorNode,
potentialClass: potentialClasses[m.className]
}));
} else if (m = (0, _matchFunctionAssignment["default"])(node)) {
if (potentialClasses[m.className]) {
potentialClasses[m.className].addMethod(new _PotentialMethod["default"]({
name: m.methodName,
methodNode: m.methodNode,
fullNode: node,
commentNodes: [node],
parent: parent,
"static": true
}));
}
} else if (m = (0, _matchPrototypeFunctionAssignment["default"])(node)) {
if (potentialClasses[m.className]) {
potentialClasses[m.className].addMethod(new _PotentialMethod["default"]({
name: m.methodName,
methodNode: m.methodNode,
fullNode: node,
commentNodes: [node],
parent: parent
}));
}
} else if (m = (0, _matchPrototypeObjectAssignment["default"])(node)) {
if (potentialClasses[m.className]) {
m.methods.forEach(function (method, i) {
var assignmentComments = i === 0 ? [node] : [];
potentialClasses[m.className].addMethod(new _PotentialMethod["default"]({
name: method.methodName,
methodNode: method.methodNode,
fullNode: node,
commentNodes: assignmentComments.concat([method.propertyNode]),
parent: parent,
kind: classMethodKind(method.kind)
}));
});
}
} else if (m = (0, _matchObjectDefinePropertyCall["default"])(node)) {
if (potentialClasses[m.className]) {
m.descriptors.forEach(function (desc, i) {
var parentComments = i === 0 ? [node] : [];
potentialClasses[m.className].addMethod(new _PotentialMethod["default"]({
name: m.methodName,
methodNode: desc.methodNode,
fullNode: node,
commentNodes: parentComments.concat([desc.propertyNode]),
parent: parent,
kind: desc.kind,
"static": m["static"]
}));
});
}
} else if (m = (0, _matchObjectDefinePropertiesCall["default"])(node)) {
// defineProperties allows mixing method definitions we CAN transform
// with ones we CANT. This check looks for whether every property is
// one we CAN transform and if they are it removes the whole call
// to defineProperties
var removeWholeNode = false;
if (node.expression.arguments[1].properties.every(function (propertyNode) {
var _matchDefinedProperti = (0, _matchObjectDefinePropertiesCall.matchDefinedProperties)(propertyNode),
properties = _matchDefinedProperti.properties;
return properties.some(_matchObjectDefinePropertyCall.isAccessorDescriptor);
})) {
removeWholeNode = true;
}
m.forEach(function (method, i) {
if (potentialClasses[method.className]) {
method.descriptors.forEach(function (desc, j) {
var parentComments = j === 0 ? [method.methodNode] : [];
// by default remove only the single method property of the object passed to defineProperties
// otherwise if they should all be remove AND this is the last descriptor set it up
// to remove the whole node that's calling defineProperties
var lastDescriptor = i === m.length - 1 && j === method.descriptors.length - 1;
var fullNode = lastDescriptor && removeWholeNode ? node : method.methodNode;
var parentNode = lastDescriptor && removeWholeNode ? parent : node.expression.arguments[1];
potentialClasses[method.className].addMethod(new _PotentialMethod["default"]({
name: method.methodName,
methodNode: desc.methodNode,
fullNode: fullNode,
commentNodes: parentComments.concat([desc.propertyNode]),
parent: parentNode,
kind: desc.kind,
"static": method["static"]
}));
});
}
});
} else if (m = inheritance.process(node, parent)) {
if (potentialClasses[m.className]) {
potentialClasses[m.className].setSuperClass(m.superClass, m.relatedExpressions);
}
}
},
leave: function leave(node) {
if (node.type === 'Program') {
(0, _fp.values)(potentialClasses).filter(function (cls) {
return cls.isTransformable() ? true : logWarning(cls);
}).forEach(function (cls) {
return cls.transform();
});
}
}
});
// Ordinary methods inside class use kind=method,
// unlike methods inside object literal, which use kind=init.
function classMethodKind(kind) {
return kind === 'init' ? 'method' : kind;
}
function logWarning(cls) {
if (/^[A-Z]/.test(cls.getName())) {
logger.warn(cls.getFullNode(), "Function ".concat(cls.getName(), " looks like class, but has no prototype"), 'class');
}
}
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/class/inheritance/ImportUtilDetector.js":
/*!**********************************************************************************!*\
!*** ./node_modules/lebab/lib/transform/class/inheritance/ImportUtilDetector.js ***!
\**********************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/**
* Detects variable name imported from: import <name> from "util"
*/
var ImportUtilDetector = /*#__PURE__*/function () {
function ImportUtilDetector() {
_classCallCheck(this, ImportUtilDetector);
}
_createClass(ImportUtilDetector, [{
key: "detect",
value:
/**
* Detects: import <identifier> from "util"
*
* @param {Object} node
* @return {Object} MemberExpression of <identifier>.inherits
*/
function detect(node) {
var m = this.matchImportUtil(node);
if (m) {
return {
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: m.name
},
property: {
type: 'Identifier',
name: 'inherits'
}
};
}
}
// Matches: import <name> from "util"
}, {
key: "matchImportUtil",
value: function matchImportUtil(node) {
return (0, _fMatches.matches)({
type: 'ImportDeclaration',
specifiers: (0, _fMatches.matchesLength)([{
type: 'ImportDefaultSpecifier',
local: {
type: 'Identifier',
name: (0, _fMatches.extractAny)('name')
}
}]),
source: {
type: 'Literal',
value: 'util'
}
}, node);
}
}]);
return ImportUtilDetector;
}();
exports["default"] = ImportUtilDetector;
/***/ }),
/***/ "./node_modules/lebab/lib/transform/class/inheritance/Inheritance.js":
/*!***************************************************************************!*\
!*** ./node_modules/lebab/lib/transform/class/inheritance/Inheritance.js ***!
\***************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _UtilInherits = _interopRequireDefault(__webpack_require__(/*! ./UtilInherits */ "./node_modules/lebab/lib/transform/class/inheritance/UtilInherits.js"));
var _Prototypal = _interopRequireDefault(__webpack_require__(/*! ./Prototypal */ "./node_modules/lebab/lib/transform/class/inheritance/Prototypal.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/**
* Processes nodes to detect super classes and return information for later
* transformation.
*/
var Inheritance = /*#__PURE__*/function () {
/**
* @param {Object} cfg
* @param {PotentialClass[]} cfg.potentialClasses Class name
*/
function Inheritance() {
_classCallCheck(this, Inheritance);
this.utilInherits = new _UtilInherits["default"]();
this.prototypal = new _Prototypal["default"]();
}
/**
* Process a node and return inheritance details if found.
* @param {Object} node
* @param {Object} parent
* @returns {Object}
* {String} className
* {Node} superClass
* {Object[]} relatedExpressions
*/
_createClass(Inheritance, [{
key: "process",
value: function process(node, parent) {
return this.utilInherits.process(node, parent) || this.prototypal.process(node, parent);
}
}]);
return Inheritance;
}();
exports["default"] = Inheritance;
/***/ }),
/***/ "./node_modules/lebab/lib/transform/class/inheritance/Prototypal.js":
/*!**************************************************************************!*\
!*** ./node_modules/lebab/lib/transform/class/inheritance/Prototypal.js ***!
\**************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/**
* Processes nodes to detect super classes and return information for later
* transformation.
*
* Detects:
*
* Class1.prototype = Object.create(Class2.prototype);
*
* or:
*
* Class1.prototype = new Class2();
*
* optionally followed by:
*
* Class1.prototype.constructor = Class1;
*/
var Prototypal = /*#__PURE__*/function () {
function Prototypal() {
_classCallCheck(this, Prototypal);
this.foundSuperclasses = {};
}
/**
* Process a node and return inheritance details if found.
* @param {Object} node
* @param {Object} parent
* @returns {Object/undefined} m
* {String} m.className
* {Node} m.superClass
* {Object[]} m.relatedExpressions
*/
_createClass(Prototypal, [{
key: "process",
value: function process(node, parent) {
var m;
if (m = this.matchNewAssignment(node) || this.matchObjectCreateAssignment(node)) {
this.foundSuperclasses[m.className] = m.superClass;
return {
className: m.className,
superClass: m.superClass,
relatedExpressions: [{
node: node,
parent: parent
}]
};
} else if (m = this.matchConstructorAssignment(node)) {
var superClass = this.foundSuperclasses[m.className];
if (superClass && m.className === m.constructorClassName) {
return {
className: m.className,
superClass: superClass,
relatedExpressions: [{
node: node,
parent: parent
}]
};
}
}
}
// Matches: <className>.prototype = new <superClass>();
}, {
key: "matchNewAssignment",
value: function matchNewAssignment(node) {
return (0, _fMatches.matches)({
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
left: {
type: 'MemberExpression',
object: {
type: 'Identifier',
name: (0, _fMatches.extractAny)('className')
},
property: {
type: 'Identifier',
name: 'prototype'
}
},
right: {
type: 'NewExpression',
callee: (0, _fMatches.extractAny)('superClass')
}
}
}, node);
}
// Matches: <className>.prototype = Object.create(<superClass>);
}, {
key: "matchObjectCreateAssignment",
value: function matchObjectCreateAssignment(node) {
return (0, _fMatches.matches)({
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
left: {
type: 'MemberExpression',
object: {
type: 'Identifier',
name: (0, _fMatches.extractAny)('className')
},
property: {
type: 'Identifier',
name: 'prototype'
}
},
right: {
type: 'CallExpression',
callee: {
type: 'MemberExpression',
object: {
type: 'Identifier',
name: 'Object'
},
property: {
type: 'Identifier',
name: 'create'
}
},
arguments: (0, _fMatches.matchesLength)([{
type: 'MemberExpression',
object: (0, _fMatches.extractAny)('superClass'),
property: {
type: 'Identifier',
name: 'prototype'
}
}])
}
}
}, node);
}
// Matches: <className>.prototype.constructor = <constructorClassName>;
}, {
key: "matchConstructorAssignment",
value: function matchConstructorAssignment(node) {
return (0, _fMatches.matches)({
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
left: {
type: 'MemberExpression',
object: {
type: 'MemberExpression',
object: {
type: 'Identifier',
name: (0, _fMatches.extractAny)('className')
},
property: {
type: 'Identifier',
name: 'prototype'
}
},
property: {
type: 'Identifier',
name: 'constructor'
}
},
right: {
type: 'Identifier',
name: (0, _fMatches.extractAny)('constructorClassName')
}
}
}, node);
}
}]);
return Prototypal;
}();
exports["default"] = Prototypal;
/***/ }),
/***/ "./node_modules/lebab/lib/transform/class/inheritance/RequireUtilDetector.js":
/*!***********************************************************************************!*\
!*** ./node_modules/lebab/lib/transform/class/inheritance/RequireUtilDetector.js ***!
\***********************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _fp = __webpack_require__(/*! lodash/fp */ "./node_modules/lodash/fp.js");
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/**
* Detects variable name imported from require("util")
*/
var RequireUtilDetector = /*#__PURE__*/function () {
function RequireUtilDetector() {
_classCallCheck(this, RequireUtilDetector);
}
_createClass(RequireUtilDetector, [{
key: "detect",
value:
/**
* Detects: var <identifier> = require("util")
*
* @param {Object} node
* @return {Object} MemberExpression of <identifier>.inherits
*/
function detect(node) {
var _this = this;
if (node.type !== 'VariableDeclaration') {
return;
}
var declaration = (0, _fp.find)(function (dec) {
return _this.isRequireUtil(dec);
}, node.declarations);
if (declaration) {
return {
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: declaration.id.name
},
property: {
type: 'Identifier',
name: 'inherits'
}
};
}
}
// Matches: <id> = require("util")
}, {
key: "isRequireUtil",
value: function isRequireUtil(dec) {
return (0, _fMatches.matches)({
type: 'VariableDeclarator',
id: {
type: 'Identifier'
},
init: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'require'
},
arguments: (0, _fMatches.matchesLength)([{
type: 'Literal',
value: 'util'
}])
}
}, dec);
}
}]);
return RequireUtilDetector;
}();
exports["default"] = RequireUtilDetector;
/***/ }),
/***/ "./node_modules/lebab/lib/transform/class/inheritance/RequireUtilInheritsDetector.js":
/*!*******************************************************************************************!*\
!*** ./node_modules/lebab/lib/transform/class/inheritance/RequireUtilInheritsDetector.js ***!
\*******************************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _fp = __webpack_require__(/*! lodash/fp */ "./node_modules/lodash/fp.js");
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/**
* Detects variable name imported from require("util").inherits
*/
var RequireUtilInheritsDetector = /*#__PURE__*/function () {
function RequireUtilInheritsDetector() {
_classCallCheck(this, RequireUtilInheritsDetector);
}
_createClass(RequireUtilInheritsDetector, [{
key: "detect",
value:
/**
* Detects: var <identifier> = require("util").inherits
*
* @param {Object} node
* @return {Object} Identifier
*/
function detect(node) {
var _this = this;
if (node.type !== 'VariableDeclaration') {
return;
}
var declaration = (0, _fp.find)(function (dec) {
return _this.isRequireUtilInherits(dec);
}, node.declarations);
if (declaration) {
return {
type: 'Identifier',
name: declaration.id.name
};
}
}
// Matches: <id> = require("util").inherits
}, {
key: "isRequireUtilInherits",
value: function isRequireUtilInherits(dec) {
return (0, _fMatches.matches)({
type: 'VariableDeclarator',
id: {
type: 'Identifier'
},
init: {
type: 'MemberExpression',
computed: false,
object: {
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'require'
},
arguments: (0, _fMatches.matchesLength)([{
type: 'Literal',
value: 'util'
}])
},
property: {
type: 'Identifier',
name: 'inherits'
}
}
}, dec);
}
}]);
return RequireUtilInheritsDetector;
}();
exports["default"] = RequireUtilInheritsDetector;
/***/ }),
/***/ "./node_modules/lebab/lib/transform/class/inheritance/UtilInherits.js":
/*!****************************************************************************!*\
!*** ./node_modules/lebab/lib/transform/class/inheritance/UtilInherits.js ***!
\****************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
var _RequireUtilDetector = _interopRequireDefault(__webpack_require__(/*! ./RequireUtilDetector */ "./node_modules/lebab/lib/transform/class/inheritance/RequireUtilDetector.js"));
var _RequireUtilInheritsDetector = _interopRequireDefault(__webpack_require__(/*! ./RequireUtilInheritsDetector */ "./node_modules/lebab/lib/transform/class/inheritance/RequireUtilInheritsDetector.js"));
var _ImportUtilDetector = _interopRequireDefault(__webpack_require__(/*! ./ImportUtilDetector */ "./node_modules/lebab/lib/transform/class/inheritance/ImportUtilDetector.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/**
* Processes nodes to detect super classes and return information for later
* transformation.
*
* Detects:
*
* var util = require('util');
* ...
* util.inherits(Class1, Class2);
*/
var UtilInherits = /*#__PURE__*/function () {
function UtilInherits() {
_classCallCheck(this, UtilInherits);
this.inheritsNode = undefined;
this.detectors = [new _RequireUtilDetector["default"](), new _RequireUtilInheritsDetector["default"](), new _ImportUtilDetector["default"]()];
}
/**
* Process a node and return inheritance details if found.
* @param {Object} node
* @param {Object} parent
* @returns {Object/undefined} m
* {String} m.className
* {Node} m.superClass
* {Object[]} m.relatedExpressions
*/
_createClass(UtilInherits, [{
key: "process",
value: function process(node, parent) {
var m;
if (parent && parent.type === 'Program' && (m = this.detectInheritsNode(node))) {
this.inheritsNode = m;
} else if (this.inheritsNode && (m = this.matchUtilInherits(node))) {
return {
className: m.className,
superClass: m.superClass,
relatedExpressions: [{
node: node,
parent: parent
}]
};
}
}
}, {
key: "detectInheritsNode",
value: function detectInheritsNode(node) {
var _iterator = _createForOfIteratorHelper(this.detectors),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var detector = _step.value;
var inheritsNode = void 0;
if (inheritsNode = detector.detect(node)) {
return inheritsNode;
}
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
}
// Discover usage of this.inheritsNode
//
// Matches: <this.utilInherits>(<className>, <superClass>);
}, {
key: "matchUtilInherits",
value: function matchUtilInherits(node) {
return (0, _fMatches.matches)({
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: this.inheritsNode,
arguments: [{
type: 'Identifier',
name: (0, _fMatches.extractAny)('className')
}, (0, _fMatches.extractAny)('superClass')]
}
}, node);
}
}]);
return UtilInherits;
}();
exports["default"] = UtilInherits;
/***/ }),
/***/ "./node_modules/lebab/lib/transform/class/isFunctionProperty.js":
/*!**********************************************************************!*\
!*** ./node_modules/lebab/lib/transform/class/isFunctionProperty.js ***!
\**********************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
var _isTransformableToMethod = _interopRequireDefault(__webpack_require__(/*! ./isTransformableToMethod */ "./node_modules/lebab/lib/transform/class/isTransformableToMethod.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Matches: <ident>: function() { ... }
*
* @param {Object} node
* @return {Boolean}
*/
var _default = (0, _fMatches.matches)({
type: 'Property',
key: {
type: 'Identifier'
// name: <ident>
},
computed: false,
value: _isTransformableToMethod["default"]
});
exports["default"] = _default;
/***/ }),
/***/ "./node_modules/lebab/lib/transform/class/isTransformableToMethod.js":
/*!***************************************************************************!*\
!*** ./node_modules/lebab/lib/transform/class/isTransformableToMethod.js ***!
\***************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = isTransformableToMethod;
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../../traverser */ "./node_modules/lebab/lib/traverser.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Detects if function can be transformed to class method
* @param {Object} node
* @return {Boolean}
*/
function isTransformableToMethod(node) {
if (node.type === 'FunctionExpression') {
return true;
}
if (node.type === 'ArrowFunctionExpression' && !usesThis(node)) {
return true;
}
}
function usesThis(ast) {
return _traverser["default"].find(ast, 'ThisExpression', {
skipTypes: ['FunctionExpression', 'FunctionDeclaration']
});
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/class/matchFunctionAssignment.js":
/*!***************************************************************************!*\
!*** ./node_modules/lebab/lib/transform/class/matchFunctionAssignment.js ***!
\***************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
/**
* Matches: <className>.<methodName> = function () { ... }
*
* When node matches returns the extracted fields:
*
* - className
* - methodName
* - methodNode
*
* @param {Object} node
* @return {Object}
*/
var _default = (0, _fMatches.matches)({
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
left: {
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: (0, _fMatches.extractAny)('className')
},
property: {
type: 'Identifier',
name: (0, _fMatches.extractAny)('methodName')
}
},
operator: '=',
right: (0, _fMatches.extract)('methodNode', {
type: 'FunctionExpression'
})
}
});
exports["default"] = _default;
/***/ }),
/***/ "./node_modules/lebab/lib/transform/class/matchFunctionDeclaration.js":
/*!****************************************************************************!*\
!*** ./node_modules/lebab/lib/transform/class/matchFunctionDeclaration.js ***!
\****************************************************************************/
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
/**
* Matches: function <className>() { ... }
*
* When node matches returns the extracted fields:
*
* - className
* - constructorNode
*
* @param {Object} node
* @return {Object}
*/
function _default(node) {
if (node.type === 'FunctionDeclaration' && node.id) {
return {
className: node.id.name,
constructorNode: node
};
}
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/class/matchFunctionVar.js":
/*!********************************************************************!*\
!*** ./node_modules/lebab/lib/transform/class/matchFunctionVar.js ***!
\********************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
var isFunctionExpression = (0, _fMatches.matches)({
type: 'FunctionExpression'
});
var isFunctionVariableDeclaration = (0, _fMatches.matches)({
type: 'VariableDeclaration',
declarations: function declarations(decs) {
return decs.length === 1 && isFunctionExpression(decs[0].init);
}
});
/**
* Matches: var <className> = function () { ... }
*
* When node matches returns the extracted fields:
*
* - className
* - constructorNode
*
* @param {Object} node
* @return {Object}
*/
function _default(node) {
if (isFunctionVariableDeclaration(node)) {
var _node$declarations = _slicedToArray(node.declarations, 1),
_node$declarations$ = _node$declarations[0],
className = _node$declarations$.id.name,
constructorNode = _node$declarations$.init;
return {
className: className,
constructorNode: constructorNode
};
}
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/class/matchObjectDefinePropertiesCall.js":
/*!***********************************************************************************!*\
!*** ./node_modules/lebab/lib/transform/class/matchObjectDefinePropertiesCall.js ***!
\***********************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
exports.matchDefinedProperties = void 0;
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
var _matchObjectDefinePropertyCall = __webpack_require__(/*! ./matchObjectDefinePropertyCall.js */ "./node_modules/lebab/lib/transform/class/matchObjectDefinePropertyCall.js");
var matchObjectDefinePropertiesCallOnPrototype = (0, _fMatches.matches)({
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: 'Object'
},
property: {
type: 'Identifier',
name: 'defineProperties'
}
},
arguments: [{
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: (0, _fMatches.extractAny)('className')
},
property: {
type: 'Identifier',
name: 'prototype'
}
}, {
type: 'ObjectExpression',
properties: (0, _fMatches.extractAny)('methods')
}]
}
});
var matchObjectDefinePropertiesCall = (0, _fMatches.matches)({
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: 'Object'
},
property: {
type: 'Identifier',
name: 'defineProperties'
}
},
arguments: [{
type: 'Identifier',
name: (0, _fMatches.extractAny)('className')
}, {
type: 'ObjectExpression',
properties: (0, _fMatches.extractAny)('methods')
}]
}
});
var matchDefinedProperties = (0, _fMatches.matches)({
type: 'Property',
key: {
type: 'Identifier',
name: (0, _fMatches.extractAny)('methodName')
},
computed: false,
value: {
type: 'ObjectExpression',
properties: (0, _fMatches.extractAny)('properties')
}
});
/**
* Matches: Object.defineProperties(<className>.prototype, {
* <methodName>: {
* <kind>: <methodNode>,
* }
* ...
* })
*
* When node matches returns an array of objects with the extracted fields for each method:
*
* [{
* - className
* - methodName
* - descriptors:
* - propertyNode
* - methodNode
* - kind
* }]
*
* @param {Object} node
* @return {Object[] | undefined}
*/
exports.matchDefinedProperties = matchDefinedProperties;
function _default(node) {
var _matchObjectDefinePro = matchObjectDefinePropertiesCallOnPrototype(node),
className = _matchObjectDefinePro.className,
methods = _matchObjectDefinePro.methods;
var isStatic = false;
if (!className) {
var _matchObjectDefinePro2 = matchObjectDefinePropertiesCall(node);
className = _matchObjectDefinePro2.className;
methods = _matchObjectDefinePro2.methods;
isStatic = true;
}
if (className) {
return methods.map(function (methodNode) {
var _matchDefinedProperti = matchDefinedProperties(methodNode),
methodName = _matchDefinedProperti.methodName,
properties = _matchDefinedProperti.properties;
return {
className: className,
methodName: methodName,
methodNode: methodNode,
descriptors: properties.filter(_matchObjectDefinePropertyCall.isAccessorDescriptor).map(function (prop) {
return {
propertyNode: prop,
methodNode: prop.value,
kind: prop.key.name
};
}),
"static": isStatic
};
});
}
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/class/matchObjectDefinePropertyCall.js":
/*!*********************************************************************************!*\
!*** ./node_modules/lebab/lib/transform/class/matchObjectDefinePropertyCall.js ***!
\*********************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
exports.isAccessorDescriptor = isAccessorDescriptor;
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
var _isFunctionProperty = _interopRequireDefault(__webpack_require__(/*! ./isFunctionProperty */ "./node_modules/lebab/lib/transform/class/isFunctionProperty.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var matchObjectDefinePropertyCallOnPrototype = (0, _fMatches.matches)({
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: 'Object'
},
property: {
type: 'Identifier',
name: 'defineProperty'
}
},
arguments: [{
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: (0, _fMatches.extractAny)('className')
},
property: {
type: 'Identifier',
name: 'prototype'
}
}, {
type: 'Literal',
value: (0, _fMatches.extractAny)('methodName')
}, {
type: 'ObjectExpression',
properties: (0, _fMatches.extractAny)('properties')
}]
}
});
var matchObjectDefinePropertyCall = (0, _fMatches.matches)({
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: 'Object'
},
property: {
type: 'Identifier',
name: 'defineProperty'
}
},
arguments: [{
type: 'Identifier',
name: (0, _fMatches.extractAny)('className')
}, {
type: 'Literal',
value: (0, _fMatches.extractAny)('methodName')
}, {
type: 'ObjectExpression',
properties: (0, _fMatches.extractAny)('properties')
}]
}
});
function isAccessorDescriptor(node) {
return (0, _isFunctionProperty["default"])(node) && (node.key.name === 'get' || node.key.name === 'set');
}
/**
* Matches: Object.defineProperty(<className>.prototype, "<methodName>", {
* <kind>: <methodNode>,
* ...
* })
*
* When node matches returns the extracted fields:
*
* - className
* - methodName
* - descriptors:
* - propertyNode
* - methodNode
* - kind
*
* @param {Object} node
* @return {Object}
*/
function _default(node) {
var _matchObjectDefinePro = matchObjectDefinePropertyCallOnPrototype(node),
className = _matchObjectDefinePro.className,
methodName = _matchObjectDefinePro.methodName,
properties = _matchObjectDefinePro.properties;
var isStatic = false;
if (!className) {
var _matchObjectDefinePro2 = matchObjectDefinePropertyCall(node);
className = _matchObjectDefinePro2.className;
methodName = _matchObjectDefinePro2.methodName;
properties = _matchObjectDefinePro2.properties;
isStatic = true;
}
if (className) {
return {
className: className,
methodName: methodName,
descriptors: properties.filter(isAccessorDescriptor).map(function (prop) {
return {
propertyNode: prop,
methodNode: prop.value,
kind: prop.key.name
};
}),
"static": isStatic
};
}
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/class/matchPrototypeFunctionAssignment.js":
/*!************************************************************************************!*\
!*** ./node_modules/lebab/lib/transform/class/matchPrototypeFunctionAssignment.js ***!
\************************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
var _isTransformableToMethod = _interopRequireDefault(__webpack_require__(/*! ./isTransformableToMethod */ "./node_modules/lebab/lib/transform/class/isTransformableToMethod.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Matches: <className>.prototype.<methodName> = function () { ... }
*
* When node matches returns the extracted fields:
*
* - className
* - methodName
* - methodNode
*
* @param {Object} node
* @return {Object}
*/
var _default = (0, _fMatches.matches)({
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
left: {
type: 'MemberExpression',
computed: false,
object: {
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: (0, _fMatches.extractAny)('className')
},
property: {
type: 'Identifier',
name: 'prototype'
}
},
property: {
type: 'Identifier',
name: (0, _fMatches.extractAny)('methodName')
}
},
operator: '=',
right: (0, _fMatches.extract)('methodNode', _isTransformableToMethod["default"])
}
});
exports["default"] = _default;
/***/ }),
/***/ "./node_modules/lebab/lib/transform/class/matchPrototypeObjectAssignment.js":
/*!**********************************************************************************!*\
!*** ./node_modules/lebab/lib/transform/class/matchPrototypeObjectAssignment.js ***!
\**********************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
var _isFunctionProperty = _interopRequireDefault(__webpack_require__(/*! ./isFunctionProperty */ "./node_modules/lebab/lib/transform/class/isFunctionProperty.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var matchPrototypeObjectAssignment = (0, _fMatches.matches)({
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
left: {
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: (0, _fMatches.extractAny)('className')
},
property: {
type: 'Identifier',
name: 'prototype'
}
},
operator: '=',
right: {
type: 'ObjectExpression',
properties: (0, _fMatches.extract)('properties', function (props) {
return props.every(_isFunctionProperty["default"]);
})
}
}
});
/**
* Matches: <className>.prototype = {
* <methodName>: <methodNode>,
* ...
* };
*
* When node matches returns the extracted fields:
*
* - className
* - methods
* - propertyNode
* - methodName
* - methodNode
* - kind
*
* @param {Object} node
* @return {Object}
*/
function _default(node) {
var _matchPrototypeObject = matchPrototypeObjectAssignment(node),
className = _matchPrototypeObject.className,
properties = _matchPrototypeObject.properties;
if (className) {
return {
className: className,
methods: properties.map(function (prop) {
return {
propertyNode: prop,
methodName: prop.key.name,
methodNode: prop.value,
kind: prop.kind
};
})
};
}
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/commonjs/exportCommonjs.js":
/*!*********************************************************************!*\
!*** ./node_modules/lebab/lib/transform/commonjs/exportCommonjs.js ***!
\*********************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../../traverser */ "./node_modules/lebab/lib/traverser.js"));
var _matchDefaultExport = _interopRequireDefault(__webpack_require__(/*! ./matchDefaultExport */ "./node_modules/lebab/lib/transform/commonjs/matchDefaultExport.js"));
var _matchNamedExport = _interopRequireDefault(__webpack_require__(/*! ./matchNamedExport */ "./node_modules/lebab/lib/transform/commonjs/matchNamedExport.js"));
var _functionType = __webpack_require__(/*! ../../utils/functionType */ "./node_modules/lebab/lib/utils/functionType.js");
var _ExportNamedDeclaration = _interopRequireDefault(__webpack_require__(/*! ../../syntax/ExportNamedDeclaration */ "./node_modules/lebab/lib/syntax/ExportNamedDeclaration.js"));
var _VariableDeclaration = _interopRequireDefault(__webpack_require__(/*! ../../syntax/VariableDeclaration */ "./node_modules/lebab/lib/syntax/VariableDeclaration.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _default(ast, logger) {
_traverser["default"].replace(ast, {
enter: function enter(node, parent) {
var m;
if (m = (0, _matchDefaultExport["default"])(node)) {
if (parent.type !== 'Program') {
logger.warn(node, 'export can only be at root level', 'commonjs');
return;
}
return exportDefault(m, node.comments);
} else if (m = (0, _matchNamedExport["default"])(node)) {
if (parent.type !== 'Program') {
logger.warn(node, 'export can only be at root level', 'commonjs');
return;
}
return exportNamed(m, node.comments);
}
}
});
}
function exportDefault(_ref, comments) {
var value = _ref.value;
return {
type: 'ExportDefaultDeclaration',
declaration: value,
comments: comments
};
}
function exportNamed(_ref2, comments) {
var id = _ref2.id,
value = _ref2.value;
if ((0, _functionType.isFunctionExpression)(value)) {
// Exclude functions with different name than the assigned property name
if (compatibleIdentifiers(id, value.id)) {
return new _ExportNamedDeclaration["default"]({
declaration: functionExpressionToDeclaration(value, id),
comments: comments
});
}
} else if (value.type === 'ClassExpression') {
// Exclude classes with different name than the assigned property name
if (compatibleIdentifiers(id, value.id)) {
return new _ExportNamedDeclaration["default"]({
declaration: classExpressionToDeclaration(value, id),
comments: comments
});
}
} else if (value.type === 'Identifier') {
return new _ExportNamedDeclaration["default"]({
specifiers: [{
type: 'ExportSpecifier',
exported: id,
local: value
}],
comments: comments
});
} else {
return new _ExportNamedDeclaration["default"]({
declaration: new _VariableDeclaration["default"]('var', [{
type: 'VariableDeclarator',
id: id,
init: value
}]),
comments: comments
});
}
}
// True when one of the identifiers is null or their names are equal.
function compatibleIdentifiers(id1, id2) {
return !id1 || !id2 || id1.name === id2.name;
}
function functionExpressionToDeclaration(func, id) {
func.type = 'FunctionDeclaration';
func.id = id;
// Transform <expression> to { return <expression>; }
if (func.body.type !== 'BlockStatement') {
func.body = {
type: 'BlockStatement',
body: [{
type: 'ReturnStatement',
argument: func.body
}]
};
}
return func;
}
function classExpressionToDeclaration(cls, id) {
cls.type = 'ClassDeclaration';
cls.id = id;
return cls;
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/commonjs/importCommonjs.js":
/*!*********************************************************************!*\
!*** ./node_modules/lebab/lib/transform/commonjs/importCommonjs.js ***!
\*********************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../../traverser */ "./node_modules/lebab/lib/traverser.js"));
var _isVarWithRequireCalls = _interopRequireDefault(__webpack_require__(/*! ./isVarWithRequireCalls */ "./node_modules/lebab/lib/transform/commonjs/isVarWithRequireCalls.js"));
var _matchRequire = __webpack_require__(/*! ./matchRequire */ "./node_modules/lebab/lib/transform/commonjs/matchRequire.js");
var _multiReplaceStatement = _interopRequireDefault(__webpack_require__(/*! ../../utils/multiReplaceStatement */ "./node_modules/lebab/lib/utils/multiReplaceStatement.js"));
var _ImportDeclaration = _interopRequireDefault(__webpack_require__(/*! ../../syntax/ImportDeclaration */ "./node_modules/lebab/lib/syntax/ImportDeclaration.js"));
var _ImportSpecifier = _interopRequireDefault(__webpack_require__(/*! ../../syntax/ImportSpecifier */ "./node_modules/lebab/lib/syntax/ImportSpecifier.js"));
var _ImportDefaultSpecifier = _interopRequireDefault(__webpack_require__(/*! ../../syntax/ImportDefaultSpecifier */ "./node_modules/lebab/lib/syntax/ImportDefaultSpecifier.js"));
var _VariableDeclaration = _interopRequireDefault(__webpack_require__(/*! ../../syntax/VariableDeclaration */ "./node_modules/lebab/lib/syntax/VariableDeclaration.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _default(ast, logger) {
_traverser["default"].replace(ast, {
enter: function enter(node, parent) {
if ((0, _isVarWithRequireCalls["default"])(node)) {
if (parent.type !== 'Program') {
logger.warn(node, 'import can only be at root level', 'commonjs');
return;
}
(0, _multiReplaceStatement["default"])({
parent: parent,
node: node,
replacements: node.declarations.map(function (dec) {
return varToImport(dec, node.kind);
}),
preserveComments: true
});
}
}
});
}
// Converts VariableDeclarator to ImportDeclaration when we recognize it
// as such, otherwise converts it to full VariableDeclaration (of original kind).
function varToImport(dec, kind) {
var m;
if (m = (0, _matchRequire.matchRequire)(dec)) {
if (m.id.type === 'ObjectPattern') {
return patternToNamedImport(m);
} else if (m.id.type === 'Identifier') {
return identifierToDefaultImport(m);
}
} else if (m = (0, _matchRequire.matchRequireWithProperty)(dec)) {
if (m.property.name === 'default') {
return identifierToDefaultImport(m);
}
return propertyToNamedImport(m);
} else {
return new _VariableDeclaration["default"](kind, [dec]);
}
}
function patternToNamedImport(_ref) {
var id = _ref.id,
sources = _ref.sources;
return new _ImportDeclaration["default"]({
specifiers: id.properties.map(function (_ref2) {
var key = _ref2.key,
value = _ref2.value;
return createImportSpecifier({
local: value,
imported: key
});
}),
source: sources[0]
});
}
function identifierToDefaultImport(_ref3) {
var id = _ref3.id,
sources = _ref3.sources;
return new _ImportDeclaration["default"]({
specifiers: [new _ImportDefaultSpecifier["default"](id)],
source: sources[0]
});
}
function propertyToNamedImport(_ref4) {
var id = _ref4.id,
property = _ref4.property,
sources = _ref4.sources;
return new _ImportDeclaration["default"]({
specifiers: [createImportSpecifier({
local: id,
imported: property
})],
source: sources[0]
});
}
function createImportSpecifier(_ref5) {
var local = _ref5.local,
imported = _ref5.imported;
if (imported.name === 'default') {
return new _ImportDefaultSpecifier["default"](local);
}
return new _ImportSpecifier["default"]({
local: local,
imported: imported
});
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/commonjs/index.js":
/*!************************************************************!*\
!*** ./node_modules/lebab/lib/transform/commonjs/index.js ***!
\************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _importCommonjs = _interopRequireDefault(__webpack_require__(/*! ./importCommonjs */ "./node_modules/lebab/lib/transform/commonjs/importCommonjs.js"));
var _exportCommonjs = _interopRequireDefault(__webpack_require__(/*! ./exportCommonjs */ "./node_modules/lebab/lib/transform/commonjs/exportCommonjs.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _default(ast, logger) {
(0, _importCommonjs["default"])(ast, logger);
(0, _exportCommonjs["default"])(ast, logger);
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/commonjs/isExports.js":
/*!****************************************************************!*\
!*** ./node_modules/lebab/lib/transform/commonjs/isExports.js ***!
\****************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
/**
* Matches just identifier `exports`
* @param {Object} node
* @return {Boolean}
*/
var _default = (0, _fMatches.matches)({
type: 'Identifier',
name: 'exports'
});
exports["default"] = _default;
/***/ }),
/***/ "./node_modules/lebab/lib/transform/commonjs/isModuleExports.js":
/*!**********************************************************************!*\
!*** ./node_modules/lebab/lib/transform/commonjs/isModuleExports.js ***!
\**********************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
var _isExports = _interopRequireDefault(__webpack_require__(/*! ./isExports */ "./node_modules/lebab/lib/transform/commonjs/isExports.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Matches: module.exports
* @param {Object} node
* @return {Boolean}
*/
var _default = (0, _fMatches.matches)({
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: 'module'
},
property: _isExports["default"]
});
exports["default"] = _default;
/***/ }),
/***/ "./node_modules/lebab/lib/transform/commonjs/isVarWithRequireCalls.js":
/*!****************************************************************************!*\
!*** ./node_modules/lebab/lib/transform/commonjs/isVarWithRequireCalls.js ***!
\****************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = isVarWithRequireCalls;
var _matchRequire = __webpack_require__(/*! ./matchRequire */ "./node_modules/lebab/lib/transform/commonjs/matchRequire.js");
/**
* Matches: var <id> = require(<source>);
* var <id> = require(<source>).<property>;
*/
function isVarWithRequireCalls(node) {
return node.type === 'VariableDeclaration' && node.declarations.some(function (dec) {
return (0, _matchRequire.matchRequire)(dec) || (0, _matchRequire.matchRequireWithProperty)(dec);
});
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/commonjs/matchDefaultExport.js":
/*!*************************************************************************!*\
!*** ./node_modules/lebab/lib/transform/commonjs/matchDefaultExport.js ***!
\*************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
var _isModuleExports = _interopRequireDefault(__webpack_require__(/*! ./isModuleExports */ "./node_modules/lebab/lib/transform/commonjs/isModuleExports.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Matches: module.exports = <value>
*
* When match found, return object with:
*
* - value
*
* @param {Object} node
* @return {Object|Boolean}
*/
var _default = (0, _fMatches.matches)({
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: _isModuleExports["default"],
right: (0, _fMatches.extractAny)('value')
}
});
exports["default"] = _default;
/***/ }),
/***/ "./node_modules/lebab/lib/transform/commonjs/matchNamedExport.js":
/*!***********************************************************************!*\
!*** ./node_modules/lebab/lib/transform/commonjs/matchNamedExport.js ***!
\***********************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
var _isExports = _interopRequireDefault(__webpack_require__(/*! ./isExports */ "./node_modules/lebab/lib/transform/commonjs/isExports.js"));
var _isModuleExports = _interopRequireDefault(__webpack_require__(/*! ./isModuleExports */ "./node_modules/lebab/lib/transform/commonjs/isModuleExports.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Matches: exports.<id> = <value>
* Matches: module.exports.<id> = <value>
*
* When match found, returns object with:
*
* - id
* - value
*
* @param {[type]} node [description]
* @return {[type]} [description]
*/
var _default = (0, _fMatches.matches)({
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
operator: '=',
left: {
type: 'MemberExpression',
computed: false,
object: function object(ast) {
return (0, _isExports["default"])(ast) || (0, _isModuleExports["default"])(ast);
},
property: (0, _fMatches.extract)('id', {
type: 'Identifier'
})
},
right: (0, _fMatches.extractAny)('value')
}
});
exports["default"] = _default;
/***/ }),
/***/ "./node_modules/lebab/lib/transform/commonjs/matchRequire.js":
/*!*******************************************************************!*\
!*** ./node_modules/lebab/lib/transform/commonjs/matchRequire.js ***!
\*******************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.matchRequireWithProperty = exports.matchRequire = void 0;
var _isString = _interopRequireDefault(__webpack_require__(/*! ../../utils/isString */ "./node_modules/lebab/lib/utils/isString.js"));
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var isIdentifier = (0, _fMatches.matches)({
type: 'Identifier'
});
// matches Property with Identifier key and value (possibly shorthand)
var isSimpleProperty = (0, _fMatches.matches)({
type: 'Property',
key: isIdentifier,
computed: false,
value: isIdentifier
});
// matches: {a, b: myB, c, ...}
var isObjectPattern = (0, _fMatches.matches)({
type: 'ObjectPattern',
properties: function properties(props) {
return props.every(isSimpleProperty);
}
});
// matches: require(<source>)
var matchRequireCall = (0, _fMatches.matches)({
type: 'CallExpression',
callee: {
type: 'Identifier',
name: 'require'
},
arguments: (0, _fMatches.extract)('sources', function (args) {
return args.length === 1 && (0, _isString["default"])(args[0]);
})
});
/**
* Matches: <id> = require(<source>);
*/
var matchRequire = (0, _fMatches.matches)({
type: 'VariableDeclarator',
id: (0, _fMatches.extract)('id', function (id) {
return isIdentifier(id) || isObjectPattern(id);
}),
init: matchRequireCall
});
/**
* Matches: <id> = require(<source>).<property>;
*/
exports.matchRequire = matchRequire;
var matchRequireWithProperty = (0, _fMatches.matches)({
type: 'VariableDeclarator',
id: (0, _fMatches.extract)('id', isIdentifier),
init: {
type: 'MemberExpression',
computed: false,
object: matchRequireCall,
property: (0, _fMatches.extract)('property', {
type: 'Identifier'
})
}
});
exports.matchRequireWithProperty = matchRequireWithProperty;
/***/ }),
/***/ "./node_modules/lebab/lib/transform/defaultParam/index.js":
/*!****************************************************************!*\
!*** ./node_modules/lebab/lib/transform/defaultParam/index.js ***!
\****************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
var _fp = __webpack_require__(/*! lodash/fp */ "./node_modules/lodash/fp.js");
var _destructuring = __webpack_require__(/*! ../../utils/destructuring */ "./node_modules/lebab/lib/utils/destructuring.js");
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../../traverser */ "./node_modules/lebab/lib/traverser.js"));
var _multiReplaceStatement = _interopRequireDefault(__webpack_require__(/*! ../../utils/multiReplaceStatement */ "./node_modules/lebab/lib/utils/multiReplaceStatement.js"));
var _functionType = __webpack_require__(/*! ../../utils/functionType */ "./node_modules/lebab/lib/utils/functionType.js");
var _matchOrAssignment = _interopRequireDefault(__webpack_require__(/*! ./matchOrAssignment */ "./node_modules/lebab/lib/transform/defaultParam/matchOrAssignment.js"));
var _matchTernaryAssignment = _interopRequireDefault(__webpack_require__(/*! ./matchTernaryAssignment */ "./node_modules/lebab/lib/transform/defaultParam/matchTernaryAssignment.js"));
var _matchIfUndefinedAssignment = _interopRequireDefault(__webpack_require__(/*! ./matchIfUndefinedAssignment */ "./node_modules/lebab/lib/transform/defaultParam/matchIfUndefinedAssignment.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _default(ast) {
_traverser["default"].replace(ast, {
enter: function enter(node) {
if ((0, _functionType.isFunction)(node) && node.body.type === 'BlockStatement') {
transformDefaultParams(node);
}
}
});
}
function transformDefaultParams(fn) {
var detectedDefaults = findDefaults(fn.body.body);
fn.params = fn.params.map(function (param, i) {
// Ignore params that use destructuring or already have a default
if (param.type !== 'Identifier') {
return param;
}
var detected = detectedDefaults[param.name];
// Transform when default value detected
// and default does not contain this or any of the remaining parameters
if (detected && !containsParams(detected.value, remainingParams(fn, i))) {
(0, _multiReplaceStatement["default"])({
parent: fn.body,
node: detected.node,
replacements: []
});
return withDefault(param, detected.value);
}
return param;
});
}
function withDefault(param, value) {
return {
type: 'AssignmentPattern',
left: param,
right: value
};
}
function remainingParams(fn, i) {
return fn.params.slice(i);
}
function containsParams(defaultValue, params) {
return (0, _fp.flow)((0, _fp.flatMap)(_destructuring.extractVariables), (0, _fp.some)(function (param) {
return _traverser["default"].find(defaultValue, (0, _fMatches.matches)({
type: 'Identifier',
name: param.name
}));
}))(params);
}
// Looks default value assignments at the beginning of a function
//
// Returns a map of variable-name:{name, value, node}
function findDefaults(fnBody) {
var defaults = {};
var _iterator = _createForOfIteratorHelper(fnBody),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var node = _step.value;
var def = matchDefaultAssignment(node);
if (!def) {
break;
}
defaults[def.name] = def;
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
return defaults;
}
function matchDefaultAssignment(node) {
return (0, _matchOrAssignment["default"])(node) || (0, _matchTernaryAssignment["default"])(node) || (0, _matchIfUndefinedAssignment["default"])(node);
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/defaultParam/matchIfUndefinedAssignment.js":
/*!*************************************************************************************!*\
!*** ./node_modules/lebab/lib/transform/defaultParam/matchIfUndefinedAssignment.js ***!
\*************************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
var matchEqualsUndefined = (0, _fMatches.matches)({
type: 'BinaryExpression',
left: {
type: 'Identifier',
name: (0, _fMatches.extractAny)('name2')
},
operator: (0, _fMatches.extractAny)('operator'),
right: {
type: 'Identifier',
name: 'undefined'
}
});
var matchTypeofUndefined = (0, _fMatches.matches)({
type: 'BinaryExpression',
left: {
type: 'UnaryExpression',
operator: 'typeof',
prefix: true,
argument: {
type: 'Identifier',
name: (0, _fMatches.extractAny)('name2')
}
},
operator: (0, _fMatches.extractAny)('operator'),
right: {
type: 'Literal',
value: 'undefined'
}
});
var matchIfUndefinedAssignment = (0, _fMatches.matches)({
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
left: {
type: 'Identifier',
name: (0, _fMatches.extractAny)('name')
},
operator: '=',
right: {
type: 'ConditionalExpression',
test: function test(ast) {
return matchEqualsUndefined(ast) || matchTypeofUndefined(ast);
},
consequent: (0, _fMatches.extractAny)('consequent'),
alternate: (0, _fMatches.extractAny)('alternate')
}
}
});
function isEquals(operator) {
return operator === '===' || operator === '==';
}
function isNotEquals(operator) {
return operator === '!==' || operator === '!=';
}
function isIdent(node, name) {
return node.type === 'Identifier' && node.name === name;
}
/**
* Matches: <name> = <name> === undefined ? <value> : <name>;
* Matches: <name> = typeof <name> === 'undefined' ? <value> : <name>;
*
* When node matches returns the extracted fields:
*
* - name
* - value
* - node (the entire node)
*
* @param {Object} node
* @return {Object}
*/
function _default(node) {
var _ref = matchIfUndefinedAssignment(node) || {},
name = _ref.name,
name2 = _ref.name2,
operator = _ref.operator,
consequent = _ref.consequent,
alternate = _ref.alternate;
if (name && name === name2) {
if (isEquals(operator) && isIdent(alternate, name)) {
return {
name: name,
value: consequent,
node: node
};
}
if (isNotEquals(operator) && isIdent(consequent, name)) {
return {
name: name,
value: alternate,
node: node
};
}
}
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/defaultParam/matchOrAssignment.js":
/*!****************************************************************************!*\
!*** ./node_modules/lebab/lib/transform/defaultParam/matchOrAssignment.js ***!
\****************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
var matchOrAssignment = (0, _fMatches.matches)({
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
left: {
type: 'Identifier',
name: (0, _fMatches.extractAny)('name')
},
operator: '=',
right: {
type: 'LogicalExpression',
left: {
type: 'Identifier',
name: (0, _fMatches.extractAny)('name2')
},
operator: '||',
right: (0, _fMatches.extractAny)('value')
}
}
});
/**
* Matches: <name> = <name> || <value>;
*
* When node matches returns the extracted fields:
*
* - name
* - value
* - node (the entire node)
*
* @param {Object} node
* @return {Object}
*/
function _default(node) {
var _ref = matchOrAssignment(node) || {},
name = _ref.name,
name2 = _ref.name2,
value = _ref.value;
if (name && name === name2) {
return {
name: name,
value: value,
node: node
};
}
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/defaultParam/matchTernaryAssignment.js":
/*!*********************************************************************************!*\
!*** ./node_modules/lebab/lib/transform/defaultParam/matchTernaryAssignment.js ***!
\*********************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
var matchTernaryAssignment = (0, _fMatches.matches)({
type: 'ExpressionStatement',
expression: {
type: 'AssignmentExpression',
left: {
type: 'Identifier',
name: (0, _fMatches.extractAny)('name')
},
operator: '=',
right: {
type: 'ConditionalExpression',
test: {
type: 'Identifier',
name: (0, _fMatches.extractAny)('name2')
},
consequent: {
type: 'Identifier',
name: (0, _fMatches.extractAny)('name3')
},
alternate: (0, _fMatches.extractAny)('value')
}
}
});
/**
* Matches: <name> = <name> ? <name> : <value>;
*
* When node matches returns the extracted fields:
*
* - name
* - value
* - node (the entire node)
*
* @param {Object} node
* @return {Object}
*/
function _default(node) {
var _ref = matchTernaryAssignment(node) || {},
name = _ref.name,
name2 = _ref.name2,
name3 = _ref.name3,
value = _ref.value;
if (name && name === name2 && name === name3) {
return {
name: name,
value: value,
node: node
};
}
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/destructParam.js":
/*!***********************************************************!*\
!*** ./node_modules/lebab/lib/transform/destructParam.js ***!
\***********************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _fp = __webpack_require__(/*! lodash/fp */ "./node_modules/lodash/fp.js");
var _recast = __webpack_require__(/*! recast */ "./node_modules/recast/main.js");
var _Parser = _interopRequireDefault(__webpack_require__(/*! ../Parser */ "./node_modules/lebab/lib/Parser.js"));
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../traverser */ "./node_modules/lebab/lib/traverser.js"));
var _withScope = _interopRequireDefault(__webpack_require__(/*! ../withScope */ "./node_modules/lebab/lib/withScope.js"));
var functionType = _interopRequireWildcard(__webpack_require__(/*! ../utils/functionType */ "./node_modules/lebab/lib/utils/functionType.js"));
var _Hierarchy = _interopRequireDefault(__webpack_require__(/*! ../utils/Hierarchy */ "./node_modules/lebab/lib/utils/Hierarchy.js"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
var MAX_PROPS = 4;
function _default(ast, logger) {
var hierarchy = new _Hierarchy["default"](ast);
_traverser["default"].traverse(ast, (0, _withScope["default"])(ast, {
enter: function enter(fnNode, parent, scope) {
if (functionType.isFunction(fnNode)) {
scope.variables.filter(isParameter).map(function (v) {
return {
variable: v,
exs: getMemberExpressions(v, hierarchy)
};
}).filter(function (_ref) {
var exs = _ref.exs;
return exs.length > 0;
}).forEach(function (_ref2) {
var variable = _ref2.variable,
exs = _ref2.exs;
// Replace parameter with destruct-pattern
var index = fnNode.params.findIndex(function (param) {
return param === variable.defs[0].name;
});
if (index === -1) {
return;
}
if (uniqPropNames(exs).length > MAX_PROPS) {
logger.warn(fnNode, "".concat(uniqPropNames(exs).length, " different props found, will not transform more than ").concat(MAX_PROPS), 'destruct-param');
return;
}
fnNode.params[index] = createDestructPattern(exs);
// Replace references of obj.foo with simply foo
exs.forEach(function (ex) {
ex.type = ex.property.type;
ex.name = ex.property.name;
});
});
}
}
}));
}
function isParameter(variable) {
return variable.defs.length === 1 && variable.defs[0].type === 'Parameter';
}
function getMemberExpressions(variable, hierarchy) {
var memberExpressions = [];
var _iterator = _createForOfIteratorHelper(variable.references),
_step;
try {
for (_iterator.s(); !(_step = _iterator.n()).done;) {
var ref = _step.value;
var memEx = hierarchy.getParent(ref.identifier);
if (!isMemberExpressionObject(memEx, ref.identifier)) {
return [];
}
var ex = hierarchy.getParent(memEx);
if (isAssignment(ex, memEx) || isUpdate(ex, memEx) || isMethodCall(ex, memEx)) {
return [];
}
if (isKeyword(memEx.property.name) || variableExists(memEx.property.name, ref.from)) {
return [];
}
memberExpressions.push(memEx);
}
} catch (err) {
_iterator.e(err);
} finally {
_iterator.f();
}
return memberExpressions;
}
function isMemberExpressionObject(memEx, object) {
return memEx.type === 'MemberExpression' && memEx.object === object && memEx.computed === false;
}
function isAssignment(ex, node) {
return ex.type === 'AssignmentExpression' && ex.left === node;
}
function isUpdate(ex, node) {
return ex.type === 'UpdateExpression' && ex.argument === node;
}
function isMethodCall(ex, node) {
return ex.type === 'CallExpression' && ex.callee === node;
}
function variableExists(variableName, scope) {
while (scope) {
if (scope.through.some(function (ref) {
return ref.identifier.name === variableName;
})) {
return true;
}
if (scope.set.get(variableName)) {
return true;
}
scope = scope.upper;
}
return false;
}
function isKeyword(name) {
return _Parser["default"].tokenize(name)[0].type === 'Keyword';
}
function uniqPropNames(exs) {
return (0, _fp.uniq)(exs.map(function (_ref3) {
var property = _ref3.property;
return property.name;
}));
}
// By default recast indents the ObjectPattern AST node
// See: https://github.com/benjamn/recast/issues/240
//
// To work around this, we're building the desired string by ourselves,
// and parsing it with Recast and extracting the ObjectPatter node.
// Feeding this back to Recast will preserve the formatting.
function createDestructPattern(exs) {
var props = uniqPropNames(exs).join(', ');
var js = "function foo({".concat(props, "}) {};");
var ast = (0, _recast.parse)(js, {
parser: _Parser["default"]
});
return ast.program.body[0].params[0];
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/exponent.js":
/*!******************************************************!*\
!*** ./node_modules/lebab/lib/transform/exponent.js ***!
\******************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../traverser */ "./node_modules/lebab/lib/traverser.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var isMathPow = (0, _fMatches.matches)({
type: 'CallExpression',
callee: {
type: 'MemberExpression',
computed: false,
object: {
type: 'Identifier',
name: 'Math'
},
property: {
type: 'Identifier',
name: 'pow'
}
},
arguments: function _arguments(args) {
return args.length === 2;
}
});
function _default(ast) {
_traverser["default"].replace(ast, {
enter: function enter(node) {
if (isMathPow(node)) {
return {
type: 'BinaryExpression',
operator: '**',
left: node.arguments[0],
right: node.arguments[1]
};
}
}
});
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/forEach/index.js":
/*!***********************************************************!*\
!*** ./node_modules/lebab/lib/transform/forEach/index.js ***!
\***********************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _fp = __webpack_require__(/*! lodash/fp */ "./node_modules/lodash/fp.js");
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../../traverser */ "./node_modules/lebab/lib/traverser.js"));
var _isEqualAst = _interopRequireDefault(__webpack_require__(/*! ../../utils/isEqualAst */ "./node_modules/lebab/lib/utils/isEqualAst.js"));
var _variableType = __webpack_require__(/*! ../../utils/variableType */ "./node_modules/lebab/lib/utils/variableType.js");
var _copyComments = _interopRequireDefault(__webpack_require__(/*! ../../utils/copyComments */ "./node_modules/lebab/lib/utils/copyComments.js"));
var _matchAliasedForLoop = _interopRequireDefault(__webpack_require__(/*! ../../utils/matchAliasedForLoop */ "./node_modules/lebab/lib/utils/matchAliasedForLoop.js"));
var _validateForLoop = _interopRequireDefault(__webpack_require__(/*! ./validateForLoop */ "./node_modules/lebab/lib/transform/forEach/validateForLoop.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
function _default(ast, logger) {
_traverser["default"].replace(ast, {
enter: function enter(node) {
var matches = (0, _matchAliasedForLoop["default"])(node);
if (matches) {
var warning = (0, _validateForLoop["default"])(node, matches);
if (warning) {
logger.warn.apply(logger, _toConsumableArray(warning).concat(['for-each']));
return;
}
return withComments(node, createForEach(matches));
}
if (node.type === 'ForStatement') {
logger.warn(node, 'Unable to transform for loop', 'for-each');
}
}
});
}
function withComments(node, forEach) {
(0, _copyComments["default"])({
from: node,
to: forEach
});
(0, _copyComments["default"])({
from: node.body.body[0],
to: forEach
});
return forEach;
}
function createForEach(_ref) {
var body = _ref.body,
item = _ref.item,
index = _ref.index,
array = _ref.array;
var newBody = removeFirstBodyElement(body);
var params = createForEachParams(newBody, item, index);
return {
type: 'ExpressionStatement',
expression: {
type: 'CallExpression',
callee: {
type: 'MemberExpression',
object: array,
property: {
type: 'Identifier',
name: 'forEach'
}
},
arguments: [{
type: 'ArrowFunctionExpression',
params: params,
body: newBody
}]
}
};
}
function removeFirstBodyElement(body) {
return _objectSpread(_objectSpread({}, body), {}, {
body: (0, _fp.tail)(body.body)
});
}
function createForEachParams(newBody, item, index) {
if (indexUsedInBody(newBody, index)) {
return [item, index];
}
return [item];
}
function indexUsedInBody(newBody, index) {
return _traverser["default"].find(newBody, function (node, parent) {
return (0, _isEqualAst["default"])(node, index) && (0, _variableType.isReference)(node, parent);
});
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/forEach/validateForLoop.js":
/*!*********************************************************************!*\
!*** ./node_modules/lebab/lib/transform/forEach/validateForLoop.js ***!
\*********************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = validateForLoop;
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../../traverser */ "./node_modules/lebab/lib/traverser.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
/**
* Checks that for-loop can be transformed to Array.forEach()
*
* Returns a warning message in case we can't transform.
*
* @param {Object} node The ForStatement
* @param {Object} body BlockStatement that's body of ForStatement
* @param {String} indexKind
* @param {String} itemKind
* @return {Array} Array of node and warnings message or undefined on success.
*/
function validateForLoop(node, _ref) {
var body = _ref.body,
indexKind = _ref.indexKind,
itemKind = _ref.itemKind;
var statement;
if (statement = returnUsed(body)) {
return [statement, 'Return statement used in for-loop body'];
} else if (statement = breakWithLabelUsed(body)) {
return [statement, 'Break statement with label used in for-loop body'];
} else if (statement = continueWithLabelUsed(body)) {
return [statement, 'Continue statement with label used in for-loop body'];
} else if (statement = breakUsed(body)) {
return [statement, 'Break statement used in for-loop body'];
} else if (statement = continueUsed(body)) {
return [statement, 'Continue statement used in for-loop body'];
} else if (indexKind !== 'let') {
return [node, 'Only for-loops with indexes declared as let can be transformed (use let transform first)'];
} else if (itemKind !== 'const') {
return [node, 'Only for-loops with const array items can be transformed (use let transform first)'];
}
}
var loopStatements = ['ForStatement', 'ForInStatement', 'ForOfStatement', 'DoWhileStatement', 'WhileStatement'];
function returnUsed(body) {
return _traverser["default"].find(body, 'ReturnStatement');
}
function breakWithLabelUsed(body) {
return _traverser["default"].find(body, function (_ref2) {
var type = _ref2.type,
label = _ref2.label;
return type === 'BreakStatement' && label;
});
}
function continueWithLabelUsed(body) {
return _traverser["default"].find(body, function (_ref3) {
var type = _ref3.type,
label = _ref3.label;
return type === 'ContinueStatement' && label;
});
}
function breakUsed(body) {
return _traverser["default"].find(body, 'BreakStatement', {
skipTypes: [].concat(loopStatements, ['SwitchStatement'])
});
}
function continueUsed(body) {
return _traverser["default"].find(body, 'ContinueStatement', {
skipTypes: loopStatements
});
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/forOf.js":
/*!***************************************************!*\
!*** ./node_modules/lebab/lib/transform/forOf.js ***!
\***************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _fp = __webpack_require__(/*! lodash/fp */ "./node_modules/lodash/fp.js");
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../traverser */ "./node_modules/lebab/lib/traverser.js"));
var _isEqualAst = _interopRequireDefault(__webpack_require__(/*! ../utils/isEqualAst */ "./node_modules/lebab/lib/utils/isEqualAst.js"));
var _variableType = __webpack_require__(/*! ../utils/variableType */ "./node_modules/lebab/lib/utils/variableType.js");
var _copyComments = _interopRequireDefault(__webpack_require__(/*! ../utils/copyComments */ "./node_modules/lebab/lib/utils/copyComments.js"));
var _matchAliasedForLoop = _interopRequireDefault(__webpack_require__(/*! ../utils/matchAliasedForLoop */ "./node_modules/lebab/lib/utils/matchAliasedForLoop.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
function _default(ast, logger) {
_traverser["default"].replace(ast, {
enter: function enter(node) {
var matches = (0, _matchAliasedForLoop["default"])(node);
if (matches) {
if (indexUsedInBody(matches)) {
logger.warn(node, 'Index variable used in for-loop body', 'for-of');
return;
}
if (matches.itemKind === 'var' || matches.indexKind === 'var') {
logger.warn(node, 'Only for-loops with let/const can be transformed (use let transform first)', 'for-of');
return;
}
return withComments(node, createForOf(matches));
}
if (node.type === 'ForStatement') {
logger.warn(node, 'Unable to transform for loop', 'for-of');
}
}
});
}
function indexUsedInBody(_ref) {
var body = _ref.body,
index = _ref.index;
return _traverser["default"].find(removeFirstBodyElement(body), function (node, parent) {
return (0, _isEqualAst["default"])(node, index) && (0, _variableType.isReference)(node, parent);
});
}
function withComments(node, forOf) {
(0, _copyComments["default"])({
from: node,
to: forOf
});
(0, _copyComments["default"])({
from: node.body.body[0],
to: forOf
});
return forOf;
}
function createForOf(_ref2) {
var item = _ref2.item,
itemKind = _ref2.itemKind,
array = _ref2.array,
body = _ref2.body;
return {
type: 'ForOfStatement',
left: {
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: item,
init: null // eslint-disable-line no-null/no-null
}],
kind: itemKind
},
right: array,
body: removeFirstBodyElement(body)
};
}
function removeFirstBodyElement(body) {
return _objectSpread(_objectSpread({}, body), {}, {
body: (0, _fp.tail)(body.body)
});
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/includes/comparison.js":
/*!*****************************************************************!*\
!*** ./node_modules/lebab/lib/transform/includes/comparison.js ***!
\*****************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.isIncludesComparison = isIncludesComparison;
exports.isNotIncludesComparison = isNotIncludesComparison;
var _matchesIndexOf = __webpack_require__(/*! ./matchesIndexOf */ "./node_modules/lebab/lib/transform/includes/matchesIndexOf.js");
/**
* True when indexOf() comparison can be translated to includes()
* @param {Object} matches
* @return {Boolean}
*/
function isIncludesComparison(_ref) {
var operator = _ref.operator,
index = _ref.index;
switch (operator) {
case '!==':
case '!=':
case '>':
return (0, _matchesIndexOf.isMinusOne)(index);
case '>=':
return (0, _matchesIndexOf.isZero)(index);
default:
return false;
}
}
/**
* True when indexOf() comparison can be translated to !includes()
* @param {Object} matches
* @return {Boolean}
*/
function isNotIncludesComparison(_ref2) {
var operator = _ref2.operator,
index = _ref2.index;
switch (operator) {
case '===':
case '==':
return (0, _matchesIndexOf.isMinusOne)(index);
case '<':
return (0, _matchesIndexOf.isZero)(index);
default:
return false;
}
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/includes/index.js":
/*!************************************************************!*\
!*** ./node_modules/lebab/lib/transform/includes/index.js ***!
\************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../../traverser */ "./node_modules/lebab/lib/traverser.js"));
var _matchesIndexOf = _interopRequireDefault(__webpack_require__(/*! ./matchesIndexOf */ "./node_modules/lebab/lib/transform/includes/matchesIndexOf.js"));
var _comparison = __webpack_require__(/*! ./comparison */ "./node_modules/lebab/lib/transform/includes/comparison.js");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _default(ast) {
_traverser["default"].replace(ast, {
enter: function enter(node) {
var matches = (0, _matchesIndexOf["default"])(node);
if (matches && (0, _comparison.isIncludesComparison)(matches)) {
return createIncludes(matches);
}
if (matches && (0, _comparison.isNotIncludesComparison)(matches)) {
return createNot(createIncludes(matches));
}
}
});
}
function createNot(argument) {
return {
type: 'UnaryExpression',
operator: '!',
prefix: true,
argument: argument
};
}
function createIncludes(_ref) {
var object = _ref.object,
searchElement = _ref.searchElement;
return {
type: 'CallExpression',
callee: {
type: 'MemberExpression',
computed: false,
object: object,
property: {
type: 'Identifier',
name: 'includes'
}
},
arguments: [searchElement]
};
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/includes/matchesIndexOf.js":
/*!*********************************************************************!*\
!*** ./node_modules/lebab/lib/transform/includes/matchesIndexOf.js ***!
\*********************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
exports.isZero = exports.isMinusOne = void 0;
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/**
* Matches: -1
*/
var isMinusOne = (0, _fMatches.matches)({
type: 'UnaryExpression',
operator: '-',
argument: {
type: 'Literal',
value: 1
},
prefix: true
});
/**
* Matches: 0
*/
exports.isMinusOne = isMinusOne;
var isZero = (0, _fMatches.matches)({
type: 'Literal',
value: 0
});
// Matches: object.indexOf(searchElement)
exports.isZero = isZero;
var matchesCallIndexOf = (0, _fMatches.matches)({
type: 'CallExpression',
callee: {
type: 'MemberExpression',
computed: false,
object: (0, _fMatches.extractAny)('object'),
property: {
type: 'Identifier',
name: 'indexOf'
}
},
arguments: (0, _fMatches.matchesLength)([(0, _fMatches.extractAny)('searchElement')])
});
// Matches: -1 or 0
var matchesIndex = (0, _fMatches.extract)('index', function (v) {
return isMinusOne(v) || isZero(v);
});
// Matches: object.indexOf(searchElement) <operator> index
var matchesIndexOfNormal = (0, _fMatches.matches)({
type: 'BinaryExpression',
operator: (0, _fMatches.extractAny)('operator'),
left: matchesCallIndexOf,
right: matchesIndex
});
// Matches: index <operator> object.indexOf(searchElement)
var matchesIndexOfReversed = (0, _fMatches.matches)({
type: 'BinaryExpression',
operator: (0, _fMatches.extractAny)('operator'),
left: matchesIndex,
right: matchesCallIndexOf
});
// Reverses the direction of comparison operator
function reverseOperator(operator) {
return operator.replace(/[><]/, function (op) {
return op === '>' ? '<' : '>';
});
}
function reverseOperatorField(match) {
if (!match) {
return false;
}
return _objectSpread(_objectSpread({}, match), {}, {
operator: reverseOperator(match.operator)
});
}
/**
* Matches:
*
* object.indexOf(searchElement) <operator> index
*
* or
*
* index <operator> object.indexOf(searchElement)
*
* On success returns object with keys:
*
* - object
* - searchElement
* - operator
* - index
*
* @param {Object} node
* @return {Object}
*/
function _default(node) {
return matchesIndexOfNormal(node) || reverseOperatorField(matchesIndexOfReversed(node));
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/let.js":
/*!*************************************************!*\
!*** ./node_modules/lebab/lib/transform/let.js ***!
\*************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _fp = __webpack_require__(/*! lodash/fp */ "./node_modules/lodash/fp.js");
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../traverser */ "./node_modules/lebab/lib/traverser.js"));
var functionType = _interopRequireWildcard(__webpack_require__(/*! ../utils/functionType */ "./node_modules/lebab/lib/utils/functionType.js"));
var variableType = _interopRequireWildcard(__webpack_require__(/*! ../utils/variableType */ "./node_modules/lebab/lib/utils/variableType.js"));
var destructuring = _interopRequireWildcard(__webpack_require__(/*! ../utils/destructuring.js */ "./node_modules/lebab/lib/utils/destructuring.js"));
var _multiReplaceStatement = _interopRequireDefault(__webpack_require__(/*! ../utils/multiReplaceStatement */ "./node_modules/lebab/lib/utils/multiReplaceStatement.js"));
var _ScopeManager = _interopRequireDefault(__webpack_require__(/*! ../scope/ScopeManager */ "./node_modules/lebab/lib/scope/ScopeManager.js"));
var _VariableMarker = _interopRequireDefault(__webpack_require__(/*! ../scope/VariableMarker */ "./node_modules/lebab/lib/scope/VariableMarker.js"));
var _FunctionHoister = _interopRequireDefault(__webpack_require__(/*! ../scope/FunctionHoister */ "./node_modules/lebab/lib/scope/FunctionHoister.js"));
var _VariableDeclaration = _interopRequireDefault(__webpack_require__(/*! ../syntax/VariableDeclaration */ "./node_modules/lebab/lib/syntax/VariableDeclaration.js"));
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var logger;
var scopeManager;
function _default(ast, loggerInstance) {
logger = loggerInstance;
scopeManager = new _ScopeManager["default"]();
var variableMarker = new _VariableMarker["default"](scopeManager);
_traverser["default"].traverse(ast, {
enter: function enter(node, parent) {
if (node.type === 'Program') {
enterProgram(node);
} else if (functionType.isFunctionDeclaration(node)) {
enterFunctionDeclaration(node);
} else if (functionType.isFunctionExpression(node)) {
enterFunctionExpression(node);
} else if (isBlockScopedStatement(node)) {
scopeManager.enterBlock();
} else if (node.type === 'VariableDeclaration') {
node.declarations.forEach(function (decl) {
variableMarker.markDeclared(destructuring.extractVariableNames(decl.id));
// Uninitialized variables can never be const.
// But variables in for-in/of loop heads are actually initialized (although init === null).
var inForLoopHead = isAnyForStatement(parent) && parent.left === node;
if (decl.init === null && !inForLoopHead) {
// eslint-disable-line no-null/no-null
variableMarker.markModified(decl.id.name);
}
});
} else if (node.type === 'AssignmentExpression') {
destructuring.extractVariableNames(node.left).forEach(function (name) {
variableMarker.markModified(name);
});
} else if (variableType.isUpdate(node)) {
variableMarker.markModified(node.argument.name);
} else if (variableType.isReference(node, parent)) {
variableMarker.markReferenced(node.name);
}
},
leave: function leave(node) {
if (node.type === 'Program') {
leaveProgram();
} else if (functionType.isFunction(node)) {
leaveFunction();
} else if (isBlockScopedStatement(node)) {
scopeManager.leaveScope();
}
}
});
}
// Block scope is usually delimited by { ... }
// But for-loop heads also constitute a block scope.
function isBlockScopedStatement(node) {
return node.type === 'BlockStatement' || isAnyForStatement(node);
}
// True when dealing with any kind of for-loop
function isAnyForStatement(node) {
return node.type === 'ForStatement' || node.type === 'ForInStatement' || node.type === 'ForOfStatement';
}
// True when dealing with any kind of while-loop
function isAnyWhileStatement(node) {
return node.type === 'WhileStatement' || node.type === 'DoWhileStatement';
}
// Program node works almost like a function:
// it hoists all variables which can be transformed to block-scoped let/const.
// It just doesn't have name and parameters.
// So we create an implied FunctionScope and BlockScope.
function enterProgram(node) {
scopeManager.enterFunction();
hoistFunction({
body: node
});
scopeManager.enterBlock();
}
// FunctionDeclaration has it's name visible outside the function,
// so we first register it in surrounding block-scope and
// after that enter new FunctionScope.
function enterFunctionDeclaration(func) {
if (func.id) {
getScope().register(func.id.name, getScope().findFunctionScoped(func.id.name));
}
scopeManager.enterFunction();
hoistFunction({
params: func.params,
body: func.body
});
}
// FunctionExpression has it's name visible only inside the function,
// so we first enter new FunctionScope and
// hoist function name and params variables inside it.
function enterFunctionExpression(func) {
scopeManager.enterFunction();
hoistFunction({
id: func.id,
params: func.params,
body: func.body
});
}
function hoistFunction(cfg) {
new _FunctionHoister["default"](getScope()).hoist(cfg);
}
// Exits the implied BlockScope and FunctionScope of Program node
function leaveProgram() {
scopeManager.leaveScope();
leaveFunction();
}
// Exits FunctionScope but first transforms all variables inside it
function leaveFunction() {
transformVarsToLetOrConst();
scopeManager.leaveScope();
}
// This is where the actual transform happens
function transformVarsToLetOrConst() {
getFunctionVariableGroups().forEach(function (group) {
// Do not modify existing let & const
if (group.getNode().kind !== 'var') {
return;
}
if (isLexicalVariableProhibited(group)) {
logWarningForVarKind(group.getNode());
return;
}
var commonKind = group.getCommonKind();
if (commonKind) {
// When all variables in group are of the same kind,
// just set appropriate `kind` value for the existing
// VariableDeclaration node.
group.getNode().kind = commonKind;
logWarningForVarKind(group.getNode());
} else if (hasMultiStatementBody(group.getParentNode())) {
// When some variables are of a different kind,
// create separate VariableDeclaration nodes for each
// VariableDeclarator and set their `kind` value appropriately.
var varNodes = group.getVariables().map(function (v) {
return new _VariableDeclaration["default"](v.getKind(), [v.getNode()]);
});
(0, _multiReplaceStatement["default"])({
parent: group.getParentNode(),
node: group.getNode(),
replacements: varNodes,
preserveComments: true
});
logWarningForVarKind(group.getNode());
} else {
// When parent node restricts breaking VariableDeclaration to multiple ones
// just change the kind of the declaration to the most restrictive possible
group.getNode().kind = group.getMostRestrictiveKind();
logWarningForVarKind(group.getNode());
}
});
}
// let and const declarations aren't allowed in all the same places where
// var declarations are allowed. Notably, only var-declaration can occur
// directlt in if-statement (and other similar statements) body:
//
// if (true) var x = 10;
//
// let or const can only be used when the variable is declared in inside
// a block-statement:
//
// if (true) { const x = 10; }
//
function isLexicalVariableProhibited(group) {
var node = group.getNode();
var parentNode = group.getParentNode();
if (parentNode.type === 'IfStatement') {
return parentNode.consequent === node || parentNode.alternate === node;
}
if (isAnyForStatement(parentNode) || isAnyWhileStatement(parentNode)) {
return parentNode.body === node;
}
return false;
}
function logWarningForVarKind(node) {
if (node.kind === 'var') {
logger.warn(node, 'Unable to transform var', 'let');
}
}
// Does a node have body that can contain an array of statements
function hasMultiStatementBody(node) {
return node.type === 'BlockStatement' || node.type === 'Program' || node.type === 'SwitchCase';
}
// Returns all VariableGroups of variables in current function scope,
// including from all the nested block-scopes (but not the nested
// functions).
function getFunctionVariableGroups() {
return (0, _fp.flow)((0, _fp.map)(function (v) {
return v.getGroup();
}), _fp.uniq, _fp.compact)(getScope().getVariables());
}
function getScope() {
return scopeManager.getScope();
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/multiVar.js":
/*!******************************************************!*\
!*** ./node_modules/lebab/lib/transform/multiVar.js ***!
\******************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../traverser */ "./node_modules/lebab/lib/traverser.js"));
var _multiReplaceStatement = _interopRequireDefault(__webpack_require__(/*! ../utils/multiReplaceStatement */ "./node_modules/lebab/lib/utils/multiReplaceStatement.js"));
var _VariableDeclaration = _interopRequireDefault(__webpack_require__(/*! ../syntax/VariableDeclaration */ "./node_modules/lebab/lib/syntax/VariableDeclaration.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _default(ast, logger) {
_traverser["default"].traverse(ast, {
enter: function enter(node, parent) {
if (node.type === 'VariableDeclaration' && node.declarations.length > 1) {
splitDeclaration(node, parent, logger);
return _traverser["default"].VisitorOption.Skip;
}
}
});
}
function splitDeclaration(node, parent, logger) {
var declNodes = node.declarations.map(function (declarator) {
return new _VariableDeclaration["default"](node.kind, [declarator]);
});
try {
(0, _multiReplaceStatement["default"])({
parent: parent,
node: node,
replacements: declNodes,
preserveComments: true
});
} catch (e) {
logger.warn(parent, "Unable to split var statement in a ".concat(parent.type), 'multi-var');
}
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/noStrict.js":
/*!******************************************************!*\
!*** ./node_modules/lebab/lib/transform/noStrict.js ***!
\******************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../traverser */ "./node_modules/lebab/lib/traverser.js"));
var _isString = _interopRequireDefault(__webpack_require__(/*! ../utils/isString */ "./node_modules/lebab/lib/utils/isString.js"));
var _copyComments = _interopRequireDefault(__webpack_require__(/*! ../utils/copyComments */ "./node_modules/lebab/lib/utils/copyComments.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _default(ast) {
_traverser["default"].replace(ast, {
enter: function enter(node, parent) {
if (node.type === 'ExpressionStatement' && isUseStrictString(node.expression)) {
(0, _copyComments["default"])({
from: node,
to: parent
});
this.remove();
}
}
});
}
function isUseStrictString(node) {
return (0, _isString["default"])(node) && node.value === 'use strict';
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/objMethod.js":
/*!*******************************************************!*\
!*** ./node_modules/lebab/lib/transform/objMethod.js ***!
\*******************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../traverser */ "./node_modules/lebab/lib/traverser.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var matchTransformableProperty = (0, _fMatches.matches)({
type: 'Property',
key: {
type: 'Identifier'
},
value: {
type: 'FunctionExpression',
id: (0, _fMatches.extractAny)('functionName')
},
method: false,
computed: false,
shorthand: false
});
function _default(ast, logger) {
_traverser["default"].replace(ast, {
enter: function enter(node) {
var match = matchTransformableProperty(node);
if (match) {
// Do not transform functions with name,
// as the name might be recursively referenced from inside.
if (match.functionName) {
logger.warn(node, 'Unable to transform named function', 'obj-method');
return;
}
node.method = true;
}
}
});
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/objShorthand.js":
/*!**********************************************************!*\
!*** ./node_modules/lebab/lib/transform/objShorthand.js ***!
\**********************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../traverser */ "./node_modules/lebab/lib/traverser.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _default(ast) {
_traverser["default"].replace(ast, {
enter: propertyToShorthand
});
}
function propertyToShorthand(node) {
if (node.type === 'Property' && equalIdentifiers(node.key, node.value)) {
node.shorthand = true;
}
}
function equalIdentifiers(a, b) {
return a.type === 'Identifier' && b.type === 'Identifier' && a.name === b.name;
}
/***/ }),
/***/ "./node_modules/lebab/lib/transform/template.js":
/*!******************************************************!*\
!*** ./node_modules/lebab/lib/transform/template.js ***!
\******************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../traverser */ "./node_modules/lebab/lib/traverser.js"));
var _TemplateLiteral = _interopRequireDefault(__webpack_require__(/*! ./../syntax/TemplateLiteral */ "./node_modules/lebab/lib/syntax/TemplateLiteral.js"));
var _TemplateElement = _interopRequireDefault(__webpack_require__(/*! ./../syntax/TemplateElement */ "./node_modules/lebab/lib/syntax/TemplateElement.js"));
var _isString = _interopRequireDefault(__webpack_require__(/*! ./../utils/isString */ "./node_modules/lebab/lib/utils/isString.js"));
var _fp = __webpack_require__(/*! lodash/fp */ "./node_modules/lodash/fp.js");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _default(ast) {
_traverser["default"].replace(ast, {
enter: function enter(node) {
if (isPlusExpression(node)) {
var plusExpr = flattenPlusExpression(node);
if (plusExpr.isString && !plusExpr.operands.every(_isString["default"])) {
var literal = new _TemplateLiteral["default"](splitQuasisAndExpressions(plusExpr.operands));
// Ensure correct order of comments by sorting them by their position in source
literal.comments = (0, _fp.sortBy)('start', plusExpr.comments);
return literal;
}
}
}
});
}
// Returns object of three fields:
// - operands: flat array of all the plus operation sub-expressions
// - comments: array of comments
// - isString: true when the result of the whole plus operation is a string
function flattenPlusExpression(node) {
if (isPlusExpression(node)) {
var left = flattenPlusExpression(node.left);
var right = flattenPlusExpression(node.right);
if (left.isString || right.isString) {
return {
operands: (0, _fp.flatten)([left.operands, right.operands]),
comments: (0, _fp.flatten)([node.comments || [], left.comments, right.comments]),
isString: true
};
} else {
return {
operands: [node],
comments: node.comments || [],
isString: false
};
}
} else {
return {
operands: [node],
comments: node.comments || [],
isString: (0, _isString["default"])(node)
};
}
}
function isPlusExpression(node) {
return node.type === 'BinaryExpression' && node.operator === '+';
}
function splitQuasisAndExpressions(operands) {
var quasis = [];
var expressions = [];
for (var i = 0; i < operands.length; i++) {
var curr = operands[i];
if ((0, _isString["default"])(curr)) {
var currVal = curr.value;
var currRaw = escapeForTemplate(curr.raw);
while ((0, _isString["default"])(operands[i + 1] || {})) {
i++;
currVal += operands[i].value;
currRaw += escapeForTemplate(operands[i].raw);
}
quasis.push(new _TemplateElement["default"]({
raw: currRaw,
cooked: currVal
}));
} else {
if (i === 0) {
quasis.push(new _TemplateElement["default"]({}));
}
if (!(0, _isString["default"])(operands[i + 1] || {})) {
quasis.push(new _TemplateElement["default"]({
tail: operands[i + 1] === undefined
}));
}
expressions.push(curr);
}
}
return {
quasis: quasis,
expressions: expressions
};
}
// Strip surrounding quotes, escape backticks and unescape escaped quotes
function escapeForTemplate(raw) {
return raw.replace(/^['"]|['"]$/g, '').replace(/`/g, '\\`').replace(/\\(['"])/g, '$1');
}
/***/ }),
/***/ "./node_modules/lebab/lib/traverser.js":
/*!*********************************************!*\
!*** ./node_modules/lebab/lib/traverser.js ***!
\*********************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _fp = __webpack_require__(/*! lodash/fp */ "./node_modules/lodash/fp.js");
var _estraverse = _interopRequireDefault(__webpack_require__(/*! estraverse */ "./node_modules/estraverse/estraverse.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
// JSX AST types, as documented in:
// https://github.com/facebook/jsx/blob/master/AST.md
var jsxExtensionKeys = {
keys: {
JSXIdentifier: [],
JSXMemberExpression: ['object', 'property'],
JSXNamespacedName: ['namespace', 'name'],
JSXEmptyExpression: [],
JSXExpressionContainer: ['expression'],
JSXOpeningElement: ['name', 'attributes'],
JSXClosingElement: ['name'],
JSXOpeningFragment: [],
JSXClosingFragment: [],
JSXAttribute: ['name', 'value'],
JSXSpreadAttribute: ['argument'],
JSXElement: ['openingElement', 'closingElement', 'children'],
JSXFragment: ['openingFragment', 'closingFragment', 'children'],
JSXText: []
}
};
/**
* Proxy for ESTraverse.
* Providing a single place to easily extend its functionality.
*
* Exposes the traverse() and replace() methods just like ESTraverse,
* plus some custom helpers.
*/
var _default = {
/**
* Traverses AST like ESTraverse.traverse()
* @param {Object} tree
* @param {Object} cfg Object with optional enter() and leave() methods.
* @return {Object} The transformed tree
*/
traverse: function traverse(tree, cfg) {
return _estraverse["default"].traverse(tree, Object.assign(cfg, jsxExtensionKeys));
},
/**
* Traverses AST like ESTraverse.replace()
* @param {Object} tree
* @param {Object} cfg Object with optional enter() and leave() methods.
* @return {Object} The transformed tree
*/
replace: function replace(tree, cfg) {
return _estraverse["default"].replace(tree, Object.assign(cfg, jsxExtensionKeys));
},
/**
* Constants to return from enter()/leave() to control traversal:
*
* - Skip - skips walking child nodes
* - Break - ends it all
* - Remove - removes the current node (only with replace())
*/
VisitorOption: _estraverse["default"].VisitorOption,
/**
* Searches in AST tree for node which satisfies the predicate.
* @param {Object} tree
* @param {Function|String} query Search function called with `node` and `parent`
* Alternatively it can be string: the node type to search for.
* @param {String[]} opts.skipTypes List of node types to skip (not traversing into these nodes)
* @return {Object} The found node or undefined when not found
*/
find: function find(tree, query) {
var _ref = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {},
_ref$skipTypes = _ref.skipTypes,
skipTypes = _ref$skipTypes === void 0 ? [] : _ref$skipTypes;
var predicate = this.createFindPredicate(query);
var found;
this.traverse(tree, {
enter: function enter(node, parent) {
if ((0, _fp.includes)(node.type, skipTypes)) {
return _estraverse["default"].VisitorOption.Skip;
}
if (predicate(node, parent)) {
found = node;
return _estraverse["default"].VisitorOption.Break;
}
}
});
return found;
},
createFindPredicate: function createFindPredicate(query) {
if ((0, _fp.isString)(query)) {
return function (node) {
return node.type === query;
};
} else {
return query;
}
}
};
exports["default"] = _default;
/***/ }),
/***/ "./node_modules/lebab/lib/utils/Hierarchy.js":
/*!***************************************************!*\
!*** ./node_modules/lebab/lib/utils/Hierarchy.js ***!
\***************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = void 0;
var _traverser = _interopRequireDefault(__webpack_require__(/*! ../traverser */ "./node_modules/lebab/lib/traverser.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
/**
* Provides a way to look up parent nodes.
*/
var Hierarchy = /*#__PURE__*/function () {
/**
* @param {Object} ast Root node
*/
function Hierarchy(ast) {
var _this = this;
_classCallCheck(this, Hierarchy);
this.parents = new Map();
_traverser["default"].traverse(ast, {
enter: function enter(node, parent) {
_this.parents.set(node, parent);
}
});
}
/**
* Returns parent node of given AST node.
* @param {Object} node
* @return {Object}
*/
_createClass(Hierarchy, [{
key: "getParent",
value: function getParent(node) {
return this.parents.get(node);
}
}]);
return Hierarchy;
}();
exports["default"] = Hierarchy;
/***/ }),
/***/ "./node_modules/lebab/lib/utils/copyComments.js":
/*!******************************************************!*\
!*** ./node_modules/lebab/lib/utils/copyComments.js ***!
\******************************************************/
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = copyComments;
/**
* Appends comments of one node to comments of another.
*
* - Modifies `to` node with added comments.
* - Does nothing when there are no comments to copy
* (ensuring we don't modify the `to` node when not needed).
*
* @param {Object} from Node to copy comments from
* @param {Object} to Node to copy comments to
*/
function copyComments(_ref) {
var from = _ref.from,
to = _ref.to;
if (from.comments && from.comments.length > 0) {
to.comments = (to.comments || []).concat(from.comments || []);
}
}
/***/ }),
/***/ "./node_modules/lebab/lib/utils/destructuring.js":
/*!*******************************************************!*\
!*** ./node_modules/lebab/lib/utils/destructuring.js ***!
\*******************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.extractVariableNames = extractVariableNames;
exports.extractVariables = extractVariables;
var _fp = __webpack_require__(/*! lodash/fp */ "./node_modules/lodash/fp.js");
/**
* Extracts all variables from from destructuring
* operation in assignment or variable declaration.
*
* Also works for a single identifier (so it generalizes
* for all assignments / variable declarations).
*
* @param {Object} node
* @return {Object[]} Identifiers
*/
function extractVariables(node) {
if (node.type === 'Identifier') {
return [node];
}
if (node.type === 'ArrayPattern') {
// Use compact() to ignore missing elements in ArrayPattern
return (0, _fp.flatMap)(extractVariables, (0, _fp.compact)(node.elements));
}
if (node.type === 'ObjectPattern') {
return (0, _fp.flatMap)(extractVariables, node.properties);
}
if (node.type === 'Property') {
return extractVariables(node.value);
}
if (node.type === 'AssignmentPattern') {
return extractVariables(node.left);
}
// Ignore stuff like MemberExpressions,
// we only care about variables.
return [];
}
/**
* Like extractVariables(), but returns the names of variables
* instead of Identifier objects.
*
* @param {Object} node
* @return {String[]} variable names
*/
function extractVariableNames(node) {
return extractVariables(node).map(function (v) {
return v.name;
});
}
/***/ }),
/***/ "./node_modules/lebab/lib/utils/functionType.js":
/*!******************************************************!*\
!*** ./node_modules/lebab/lib/utils/functionType.js ***!
\******************************************************/
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.isFunction = isFunction;
exports.isFunctionDeclaration = isFunctionDeclaration;
exports.isFunctionExpression = isFunctionExpression;
/**
* True when node is any kind of function.
*/
function isFunction(node) {
return isFunctionDeclaration(node) || isFunctionExpression(node);
}
/**
* True when node is (arrow) function expression.
*/
function isFunctionExpression(node) {
return node.type === 'FunctionExpression' || node.type === 'ArrowFunctionExpression';
}
/**
* True when node is function declaration.
*/
function isFunctionDeclaration(node) {
return node.type === 'FunctionDeclaration';
}
/***/ }),
/***/ "./node_modules/lebab/lib/utils/isEqualAst.js":
/*!****************************************************!*\
!*** ./node_modules/lebab/lib/utils/isEqualAst.js ***!
\****************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = isEqualAst;
var _fp = __webpack_require__(/*! lodash/fp */ "./node_modules/lodash/fp.js");
var metaDataFields = {
comments: true,
loc: true,
start: true,
end: true
};
/**
* True when two AST nodes are structurally equal.
* When comparing objects it ignores the meta-data fields for
* comments and source-code position.
* @param {Object} a
* @param {Object} b
* @return {Boolean}
*/
function isEqualAst(a, b) {
return (0, _fp.isEqualWith)(function (aValue, bValue, key) {
return metaDataFields[key];
}, a, b);
}
/***/ }),
/***/ "./node_modules/lebab/lib/utils/isString.js":
/*!**************************************************!*\
!*** ./node_modules/lebab/lib/utils/isString.js ***!
\**************************************************/
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = isString;
/**
* True when the given node is string literal.
* @param {Object} node
* @return {Boolean}
*/
function isString(node) {
return node.type === 'Literal' && typeof node.value === 'string';
}
/***/ }),
/***/ "./node_modules/lebab/lib/utils/matchAliasedForLoop.js":
/*!*************************************************************!*\
!*** ./node_modules/lebab/lib/utils/matchAliasedForLoop.js ***!
\*************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = _default;
var _isEqualAst = _interopRequireDefault(__webpack_require__(/*! ./isEqualAst */ "./node_modules/lebab/lib/utils/isEqualAst.js"));
var _fMatches = __webpack_require__(/*! f-matches */ "./node_modules/f-matches/index.js");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
// Matches <ident>++ or ++<ident>
var matchPlusPlus = (0, _fMatches.matches)({
type: 'UpdateExpression',
operator: '++',
argument: (0, _fMatches.extract)('indexIncrement', {
type: 'Identifier'
})
});
// Matches <ident>+=1
var matchPlusOne = (0, _fMatches.matches)({
type: 'AssignmentExpression',
operator: '+=',
left: (0, _fMatches.extract)('indexIncrement', {
type: 'Identifier'
}),
right: {
type: 'Literal',
value: 1
}
});
// Matches the first element in array pattern
// The default matches() tries to match against any array element.
var matchesFirst = function matchesFirst(patterns) {
return function (array) {
return (0, _fMatches.matches)(patterns[0], array[0]);
};
};
// Matches for-loop
// without checking the consistency of index and array variables:
//
// for (let index = 0; indexComparison < array.length; indexIncrement++) {
// let item = arrayReference[indexReference];
// ...
// }
var matchLooseForLoop = (0, _fMatches.matches)({
type: 'ForStatement',
init: {
type: 'VariableDeclaration',
declarations: (0, _fMatches.matchesLength)([{
type: 'VariableDeclarator',
id: (0, _fMatches.extract)('index', {
type: 'Identifier'
}),
init: {
type: 'Literal',
value: 0
}
}]),
kind: (0, _fMatches.extractAny)('indexKind')
},
test: {
type: 'BinaryExpression',
operator: '<',
left: (0, _fMatches.extract)('indexComparison', {
type: 'Identifier'
}),
right: {
type: 'MemberExpression',
computed: false,
object: (0, _fMatches.extractAny)('array'),
property: {
type: 'Identifier',
name: 'length'
}
}
},
update: function update(node) {
return matchPlusPlus(node) || matchPlusOne(node);
},
body: (0, _fMatches.extract)('body', {
type: 'BlockStatement',
body: matchesFirst([{
type: 'VariableDeclaration',
declarations: [{
type: 'VariableDeclarator',
id: (0, _fMatches.extract)('item', {
type: 'Identifier'
}),
init: {
type: 'MemberExpression',
computed: true,
object: (0, _fMatches.extractAny)('arrayReference'),
property: (0, _fMatches.extract)('indexReference', {
type: 'Identifier'
})
}
}],
kind: (0, _fMatches.extractAny)('itemKind')
}])
})
});
function isConsistentIndexVar(_ref) {
var index = _ref.index,
indexComparison = _ref.indexComparison,
indexIncrement = _ref.indexIncrement,
indexReference = _ref.indexReference;
return (0, _isEqualAst["default"])(index, indexComparison) && (0, _isEqualAst["default"])(index, indexIncrement) && (0, _isEqualAst["default"])(index, indexReference);
}
function isConsistentArrayVar(_ref2) {
var array = _ref2.array,
arrayReference = _ref2.arrayReference;
return (0, _isEqualAst["default"])(array, arrayReference);
}
/**
* Matches for-loop that aliases current array element
* in the first line of the loop body:
*
* for (let index = 0; index < array.length; index++) {
* let item = array[index];
* ...
* }
*
* Extracts the following fields:
*
* - index - loop index identifier
* - indexKind - the kind of <index>
* - array - array identifier or expression
* - item - identifier used to alias current array element
* - itemKind - the kind of <item>
* - body - the whole BlockStatement of for-loop body
*
* @param {Object} node
* @return {Object}
*/
function _default(ast) {
var match = matchLooseForLoop(ast);
if (match && isConsistentIndexVar(match) && isConsistentArrayVar(match)) {
return match;
}
}
/***/ }),
/***/ "./node_modules/lebab/lib/utils/multiReplaceStatement.js":
/*!***************************************************************!*\
!*** ./node_modules/lebab/lib/utils/multiReplaceStatement.js ***!
\***************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = multiReplaceStatement;
var _copyComments = _interopRequireDefault(__webpack_require__(/*! ./copyComments */ "./node_modules/lebab/lib/utils/copyComments.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
/**
* Replaces `node` inside `parent` with any number of `replacements`.
*
* ESTraverse only allows replacing one node with a single other node.
* This function overcomes this limitation, allowing to replace it with multiple nodes.
*
* NOTE: Only works for nodes that allow multiple elements in their body.
* When node doesn't exist inside parent, does nothing.
*
* @param {Object} cfg
* @param {Object} cfg.parent Parent node of the node to replace
* @param {Object} cfg.node The node to replace
* @param {Object[]} cfg.replacements Replacement nodes (can be empty array)
* @param {Boolean} [cfg.preserveComments] True to copy over comments from
* node to first replacement node
*/
function multiReplaceStatement(_ref) {
var parent = _ref.parent,
node = _ref.node,
replacements = _ref.replacements,
preserveComments = _ref.preserveComments;
var body = getBody(parent);
var index = body.indexOf(node);
if (preserveComments && replacements[0]) {
(0, _copyComments["default"])({
from: node,
to: replacements[0]
});
}
if (index !== -1) {
body.splice.apply(body, [index, 1].concat(_toConsumableArray(replacements)));
}
}
function getBody(node) {
switch (node.type) {
case 'BlockStatement':
case 'Program':
return node.body;
case 'SwitchCase':
return node.consequent;
case 'ObjectExpression':
return node.properties;
default:
throw "Unsupported node type '".concat(node.type, "' in multiReplaceStatement()");
}
}
/***/ }),
/***/ "./node_modules/lebab/lib/utils/variableType.js":
/*!******************************************************!*\
!*** ./node_modules/lebab/lib/utils/variableType.js ***!
\******************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports.isReference = isReference;
exports.isUpdate = isUpdate;
var _functionType = __webpack_require__(/*! ./functionType */ "./node_modules/lebab/lib/utils/functionType.js");
/**
* True when node is variable update expression (like x++).
*
* @param {Object} node
* @return {Boolean}
*/
function isUpdate(node) {
return node.type === 'UpdateExpression' && node.argument.type === 'Identifier';
}
/**
* True when node is reference to a variable.
*
* That is it's an identifier, that's not used:
*
* - as function name in function declaration/expression,
* - as parameter name in function declaration/expression,
* - as declared variable name in variable declaration,
* - as object property name in member expression.
* - as object property name in object literal.
*
* @param {Object} node
* @param {Object} parent Immediate parent node (to determine context)
* @return {Boolean}
*/
function isReference(node, parent) {
return node.type === 'Identifier' && !isFunctionName(node, parent) && !isFunctionParameter(node, parent) && !isDeclaredVariable(node, parent) && !isPropertyInMemberExpression(node, parent) && !isPropertyInObjectLiteral(node, parent);
}
function isFunctionName(node, parent) {
return (0, _functionType.isFunction)(parent) && parent.id === node;
}
function isFunctionParameter(node, parent) {
return (0, _functionType.isFunction)(parent) && parent.params.some(function (p) {
return p === node;
});
}
function isDeclaredVariable(node, parent) {
return parent.type === 'VariableDeclarator' && parent.id === node;
}
function isPropertyInMemberExpression(node, parent) {
return parent.type === 'MemberExpression' && parent.property === node && !parent.computed;
}
function isPropertyInObjectLiteral(node, parent) {
return parent.type === 'Property' && parent.key === node;
}
/***/ }),
/***/ "./node_modules/lebab/lib/withScope.js":
/*!*********************************************!*\
!*** ./node_modules/lebab/lib/withScope.js ***!
\*********************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({
value: true
}));
exports["default"] = withScope;
var _escope = __webpack_require__(/*! escope */ "./node_modules/escope/lib/index.js");
var _functionType = __webpack_require__(/*! ./utils/functionType */ "./node_modules/lebab/lib/utils/functionType.js");
var emptyFn = function emptyFn() {}; // eslint-disable-line no-empty-function
/**
* A helper for traversing with scope info from escope.
*
* Usage:
*
* traverser.traverse(ast, withScope(ast, {
* enter(node, parent, scope) {
* // do something with node and scope
* }
* }))
*
* @param {Object} ast The AST root node also passed to traverser.
* @param {Object} cfg Object with enter function as expected by traverser.
* @return {Object} Object with enter function to be passed to traverser.
*/
function withScope(ast, _ref) {
var _ref$enter = _ref.enter,
_enter = _ref$enter === void 0 ? emptyFn : _ref$enter;
var scopeManager = (0, _escope.analyze)(ast, {
ecmaVersion: 2022,
sourceType: 'module'
});
var currentScope = scopeManager.acquire(ast);
return {
enter: function enter(node, parent) {
if ((0, _functionType.isFunction)(node)) {
currentScope = scopeManager.acquire(node);
}
return _enter.call(this, node, parent, currentScope);
} // NOTE: leave() is currently not implemented.
// See escope docs for supporting it if need arises: https://github.com/estools/escope
};
}
/***/ }),
/***/ "./node_modules/lebab/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs":
/*!******************************************************************************************!*\
!*** ./node_modules/lebab/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs ***!
\******************************************************************************************/
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__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);
}
exports.KEYS = KEYS;
exports.getKeys = getKeys;
exports.unionWith = unionWith;
/***/ }),
/***/ "./node_modules/lebab/node_modules/espree/dist/espree.cjs":
/*!****************************************************************!*\
!*** ./node_modules/lebab/node_modules/espree/dist/espree.cjs ***!
\****************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
var acorn = __webpack_require__(/*! acorn */ "./node_modules/acorn/dist/acorn.js");
var jsx = __webpack_require__(/*! acorn-jsx */ "./node_modules/acorn-jsx/index.js");
var visitorKeys = __webpack_require__(/*! eslint-visitor-keys */ "./node_modules/lebab/node_modules/eslint-visitor-keys/dist/eslint-visitor-keys.cjs");
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n["default"] = e;
return Object.freeze(n);
}
var acorn__namespace = /*#__PURE__*/_interopNamespace(acorn);
var jsx__default = /*#__PURE__*/_interopDefaultLegacy(jsx);
var visitorKeys__namespace = /*#__PURE__*/_interopNamespace(visitorKeys);
/**
* @fileoverview 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 = tokens[tokens.length - 1];
const token = {
type: Token.Template,
value: code.slice(firstToken.start, lastTemplateToken.end)
};
if (firstToken.loc) {
token.loc = {
start: firstToken.loc.start,
end: lastTemplateToken.loc.end
};
}
if (firstToken.range) {
token.start = firstToken.range[0];
token.end = lastTemplateToken.range[1];
token.range = [token.start, token.end];
}
return token;
}
/**
* Contains logic to translate Acorn tokens into Esprima tokens.
* @param {Object} acornTokTypes The Acorn token types.
* @param {string} code The source code Acorn is parsing. This is necessary
* to correct the "value" property of some tokens.
* @constructor
*/
function TokenTranslator(acornTokTypes, code) {
// token types
this._acornTokTypes = acornTokTypes;
// token buffer for templates
this._tokens = [];
// track the last curly brace
this._curlyBrace = null;
// the source code
this._code = code;
}
TokenTranslator.prototype = {
constructor: TokenTranslator,
/**
* Translates a single Esprima token to a single Acorn token. This may be
* inaccurate due to how templates are handled differently in Esprima and
* Acorn, but should be accurate for all other tokens.
* @param {AcornToken} token The Acorn token to translate.
* @param {Object} extra Espree extra object.
* @returns {EsprimaToken} The Esprima version of the token.
*/
translate(token, extra) {
const type = token.type,
tt = this._acornTokTypes;
if (type === tt.name) {
token.type = Token.Identifier;
// TODO: See if this is an Acorn bug
if (token.value === "static") {
token.type = Token.Keyword;
}
if (extra.ecmaVersion > 5 && (token.value === "yield" || token.value === "let")) {
token.type = Token.Keyword;
}
} else if (type === tt.privateId) {
token.type = Token.PrivateIdentifier;
} else if (type === tt.semi || type === tt.comma ||
type === tt.parenL || type === tt.parenR ||
type === tt.braceL || type === tt.braceR ||
type === tt.dot || type === tt.bracketL ||
type === tt.colon || type === tt.question ||
type === tt.bracketR || type === tt.ellipsis ||
type === tt.arrow || type === tt.jsxTagStart ||
type === tt.incDec || type === tt.starstar ||
type === tt.jsxTagEnd || type === tt.prefix ||
type === tt.questionDot ||
(type.binop && !type.keyword) ||
type.isAssign) {
token.type = Token.Punctuator;
token.value = this._code.slice(token.start, token.end);
} else if (type === tt.jsxName) {
token.type = Token.JSXIdentifier;
} else if (type.label === "jsxText" || type === tt.jsxAttrValueToken) {
token.type = Token.JSXText;
} else if (type.keyword) {
if (type.keyword === "true" || type.keyword === "false") {
token.type = Token.Boolean;
} else if (type.keyword === "null") {
token.type = Token.Null;
} else {
token.type = Token.Keyword;
}
} else if (type === tt.num) {
token.type = Token.Numeric;
token.value = this._code.slice(token.start, token.end);
} else if (type === tt.string) {
if (extra.jsxAttrValueToken) {
extra.jsxAttrValueToken = false;
token.type = Token.JSXText;
} else {
token.type = Token.String;
}
token.value = this._code.slice(token.start, token.end);
} else if (type === tt.regexp) {
token.type = Token.RegularExpression;
const value = token.value;
token.regex = {
flags: value.flags,
pattern: value.pattern
};
token.value = `/${value.pattern}/${value.flags}`;
}
return token;
},
/**
* Function to call during Acorn's onToken handler.
* @param {AcornToken} token The Acorn token.
* @param {Object} extra The Espree extra object.
* @returns {void}
*/
onToken(token, extra) {
const 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
];
/**
* Get the latest ECMAScript version supported by Espree.
* @returns {number} The latest ECMAScript version.
*/
function getLatestEcmaVersion() {
return SUPPORTED_VERSIONS[SUPPORTED_VERSIONS.length - 1];
}
/**
* Get the list of ECMAScript versions supported by Espree.
* @returns {number[]} An array containing the supported ECMAScript versions.
*/
function getSupportedEcmaVersions() {
return [...SUPPORTED_VERSIONS];
}
/**
* Normalize ECMAScript version from the initial config
* @param {(number|"latest")} ecmaVersion ECMAScript version from the initial config
* @throws {Error} throws an error if the ecmaVersion is invalid.
* @returns {number} normalized ECMAScript version
*/
function normalizeEcmaVersion(ecmaVersion = 5) {
let version = ecmaVersion === "latest" ? getLatestEcmaVersion() : ecmaVersion;
if (typeof version !== "number") {
throw new Error(`ecmaVersion must be a number or "latest". Received value of type ${typeof ecmaVersion} instead.`);
}
// Calculate ECMAScript edition number from official year version starting with
// ES2015, which corresponds with ES6 (or a difference of 2009).
if (version >= 2015) {
version -= 2009;
}
if (!SUPPORTED_VERSIONS.includes(version)) {
throw new Error("Invalid ecmaVersion.");
}
return version;
}
/**
* Normalize sourceType from the initial config
* @param {string} sourceType to normalize
* @throws {Error} throw an error if sourceType is invalid
* @returns {string} normalized sourceType
*/
function normalizeSourceType(sourceType = "script") {
if (sourceType === "script" || sourceType === "module") {
return sourceType;
}
if (sourceType === "commonjs") {
return "script";
}
throw new Error("Invalid sourceType.");
}
/**
* Normalize parserOptions
* @param {Object} options the parser options to normalize
* @throws {Error} throw an error if found invalid option.
* @returns {Object} normalized options
*/
function normalizeOptions(options) {
const ecmaVersion = normalizeEcmaVersion(options.ecmaVersion);
const sourceType = normalizeSourceType(options.sourceType);
const ranges = options.range === true;
const locations = options.loc === true;
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
});
}
/* eslint no-param-reassign: 0 -- stylistic choice */
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 (code.slice(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() {
const extra = this[STATE];
const program = super.parse();
program.sourceType = extra.originalSourceType;
if (extra.comments) {
program.comments = extra.comments;
}
if (extra.tokens) {
program.tokens = extra.tokens;
}
/*
* Adjust opening and closing position of program to match Esprima.
* Acorn always starts programs at range 0 whereas Esprima starts at the
* first AST node's start (the only real difference is when there's leading
* whitespace or leading comments). Acorn also counts trailing whitespace
* as part of the program whereas Esprima only counts up to the last token.
*/
if (program.body.length) {
const [firstNode] = program.body;
if (program.range) {
program.range[0] = firstNode.range[0];
}
if (program.loc) {
program.loc.start = firstNode.loc.start;
}
program.start = firstNode.start;
}
if (extra.lastToken) {
if (program.range) {
program.range[1] = extra.lastToken.range[1];
}
if (program.loc) {
program.loc.end = extra.lastToken.loc.end;
}
program.end = extra.lastToken.end;
}
/*
* https://github.com/eslint/espree/issues/349
* Ensure that template elements have correct range information.
* This is one location where Acorn produces a different value
* for its start and end properties vs. the values present in the
* range property. In order to avoid confusion, we set the start
* and end properties to the values that are present in range.
* This is done here, instead of in finishNode(), because Acorn
* uses the values of start and end internally while parsing, making
* it dangerous to change those values while parsing is ongoing.
* By waiting until the end of parsing, we can safely change these
* values without affect any other part of the process.
*/
this[STATE].templateElements.forEach(templateElement => {
const startOffset = -1;
const endOffset = templateElement.tail ? 1 : 2;
templateElement.start += startOffset;
templateElement.end += endOffset;
if (templateElement.range) {
templateElement.range[0] += startOffset;
templateElement.range[1] += endOffset;
}
if (templateElement.loc) {
templateElement.loc.start.column += startOffset;
templateElement.loc.end.column += endOffset;
}
});
return program;
}
parseTopLevel(node) {
if (this[STATE].impliedStrict) {
this.strict = true;
}
return super.parseTopLevel(node);
}
/**
* Overwrites the default raise method to throw Esprima-style errors.
* @param {int} pos The position of the error.
* @param {string} message The error message.
* @throws {SyntaxError} A syntax error.
* @returns {void}
*/
raise(pos, message) {
const loc = Parser.acorn.getLineInfo(this.input, pos);
const err = new SyntaxError(message);
err.index = pos;
err.lineNumber = loc.line;
err.column = loc.column + 1; // acorn uses 0-based columns
throw err;
}
/**
* Overwrites the default raise method to throw Esprima-style errors.
* @param {int} pos The position of the error.
* @param {string} message The error message.
* @throws {SyntaxError} A syntax error.
* @returns {void}
*/
raiseRecoverable(pos, message) {
this.raise(pos, message);
}
/**
* Overwrites the default unexpected method to throw Esprima-style errors.
* @param {int} pos The position of the error.
* @throws {SyntaxError} A syntax error.
* @returns {void}
*/
unexpected(pos) {
let message = "Unexpected token";
if (pos !== null && pos !== void 0) {
this.pos = pos;
if (this.options.locations) {
while (this.pos < this.lineStart) {
this.lineStart = this.input.lastIndexOf("\n", this.lineStart - 2) + 1;
--this.curLine;
}
}
this.nextToken();
}
if (this.end > this.start) {
message += ` ${this.input.slice(this.start, this.end)}`;
}
this.raise(this.start, message);
}
/*
* Esprima-FB represents JSX strings as tokens called "JSXText", but Acorn-JSX
* uses regular tt.string without any distinction between this and regular JS
* strings. As such, we intercept an attempt to read a JSX string and set a flag
* on extra so that when tokens are converted, the next token will be switched
* to JSXText via onToken.
*/
jsx_readString(quote) { // eslint-disable-line camelcase -- 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) {
// Acorn doesn't count the opening and closing backticks as part of templates
// so we have to adjust ranges/locations appropriately.
if (result.type === "TemplateElement") {
// save template element references to fix start/end later
this[STATE].templateElements.push(result);
}
if (result.type.includes("Function") && !result.generator) {
result.generator = false;
}
return result;
}
};
};
const version$1 = "9.6.1";
/* eslint-disable jsdoc/no-multi-asterisks -- needed to preserve original formatting of licences */
// To initialize lazily.
const parsers = {
_regular: null,
_jsx: null,
get regular() {
if (this._regular === null) {
this._regular = acorn__namespace.Parser.extend(espree());
}
return this._regular;
},
get jsx() {
if (this._jsx === null) {
this._jsx = acorn__namespace.Parser.extend(jsx__default["default"](), espree());
}
return this._jsx;
},
get(options) {
const useJsx = Boolean(
options &&
options.ecmaFeatures &&
options.ecmaFeatures.jsx
);
return useJsx ? this.jsx : this.regular;
}
};
//------------------------------------------------------------------------------
// 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();
}
//------------------------------------------------------------------------------
// Parser
//------------------------------------------------------------------------------
/**
* Parses the given code.
* @param {string} code The code to tokenize.
* @param {Object} options Options defining how to tokenize.
* @returns {ASTNode} The "Program" AST node.
* @throws {SyntaxError} If the input code is invalid.
*/
function parse(code, options) {
const Parser = parsers.get(options);
return new Parser(options, code).parse();
}
//------------------------------------------------------------------------------
// Public
//------------------------------------------------------------------------------
const version = version$1;
const name = "espree";
/* istanbul ignore next */
const VisitorKeys = (function() {
return visitorKeys__namespace.KEYS;
}());
// Derive node types from VisitorKeys
/* istanbul ignore next */
const Syntax = (function() {
let key,
types = {};
if (typeof Object.create === "function") {
types = Object.create(null);
}
for (key in VisitorKeys) {
if (Object.hasOwnProperty.call(VisitorKeys, key)) {
types[key] = key;
}
}
if (typeof Object.freeze === "function") {
Object.freeze(types);
}
return types;
}());
const latestEcmaVersion = getLatestEcmaVersion();
const supportedEcmaVersions = getSupportedEcmaVersions();
exports.Syntax = Syntax;
exports.VisitorKeys = VisitorKeys;
exports.latestEcmaVersion = latestEcmaVersion;
exports.name = name;
exports.parse = parse;
exports.supportedEcmaVersions = supportedEcmaVersions;
exports.tokenize = tokenize;
exports.version = version;
/***/ }),
/***/ "./node_modules/lodash/fp.js":
/*!***********************************!*\
!*** ./node_modules/lodash/fp.js ***!
\***********************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var _ = (__webpack_require__(/*! ./lodash.min */ "./node_modules/lodash/lodash.min.js").runInContext)();
module.exports = __webpack_require__(/*! ./fp/_baseConvert */ "./node_modules/lodash/fp/_baseConvert.js")(_, _);
/***/ }),
/***/ "./node_modules/lodash/fp/_baseConvert.js":
/*!************************************************!*\
!*** ./node_modules/lodash/fp/_baseConvert.js ***!
\************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
var mapping = __webpack_require__(/*! ./_mapping */ "./node_modules/lodash/fp/_mapping.js"),
fallbackHolder = __webpack_require__(/*! ./placeholder */ "./node_modules/lodash/fp/placeholder.js");
/** Built-in value reference. */
var push = Array.prototype.push;
/**
* Creates a function, with an arity of `n`, that invokes `func` with the
* arguments it receives.
*
* @private
* @param {Function} func The function to wrap.
* @param {number} n The arity of the new function.
* @returns {Function} Returns the new function.
*/
function baseArity(func, n) {
return n == 2
? function(a, b) { return func.apply(undefined, arguments); }
: function(a) { return func.apply(undefined, arguments); };
}
/**
* Creates a function that invokes `func`, with up to `n` arguments, ignoring
* any additional arguments.
*
* @private
* @param {Function} func The function to cap arguments for.
* @param {number} n The arity cap.
* @returns {Function} Returns the new function.
*/
function baseAry(func, n) {
return n == 2
? function(a, b) { return func(a, b); }
: function(a) { return func(a); };
}
/**
* Creates a clone of `array`.
*
* @private
* @param {Array} array The array to clone.
* @returns {Array} Returns the cloned array.
*/
function cloneArray(array) {
var length = array ? array.length : 0,
result = Array(length);
while (length--) {
result[length] = array[length];
}
return result;
}
/**
* Creates a function that clones a given object using the assignment `func`.
*
* @private
* @param {Function} func The assignment function.
* @returns {Function} Returns the new cloner function.
*/
function createCloner(func) {
return function(object) {
return func({}, object);
};
}
/**
* A specialized version of `_.spread` which flattens the spread array into
* the arguments of the invoked `func`.
*
* @private
* @param {Function} func The function to spread arguments over.
* @param {number} start The start position of the spread.
* @returns {Function} Returns the new function.
*/
function flatSpread(func, start) {
return function() {
var length = arguments.length,
lastIndex = length - 1,
args = Array(length);
while (length--) {
args[length] = arguments[length];
}
var array = args[start],
otherArgs = args.slice(0, start);
if (array) {
push.apply(otherArgs, array);
}
if (start != lastIndex) {
push.apply(otherArgs, args.slice(start + 1));
}
return func.apply(this, otherArgs);
};
}
/**
* Creates a function that wraps `func` and uses `cloner` to clone the first
* argument it receives.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} cloner The function to clone arguments.
* @returns {Function} Returns the new immutable function.
*/
function wrapImmutable(func, cloner) {
return function() {
var length = arguments.length;
if (!length) {
return;
}
var args = Array(length);
while (length--) {
args[length] = arguments[length];
}
var result = args[0] = cloner.apply(undefined, args);
func.apply(undefined, args);
return result;
};
}
/**
* The base implementation of `convert` which accepts a `util` object of methods
* required to perform conversions.
*
* @param {Object} util The util object.
* @param {string} name The name of the function to convert.
* @param {Function} func The function to convert.
* @param {Object} [options] The options object.
* @param {boolean} [options.cap=true] Specify capping iteratee arguments.
* @param {boolean} [options.curry=true] Specify currying.
* @param {boolean} [options.fixed=true] Specify fixed arity.
* @param {boolean} [options.immutable=true] Specify immutable operations.
* @param {boolean} [options.rearg=true] Specify rearranging arguments.
* @returns {Function|Object} Returns the converted function or object.
*/
function baseConvert(util, name, func, options) {
var isLib = typeof name == 'function',
isObj = name === Object(name);
if (isObj) {
options = func;
func = name;
name = undefined;
}
if (func == null) {
throw new TypeError;
}
options || (options = {});
var config = {
'cap': 'cap' in options ? options.cap : true,
'curry': 'curry' in options ? options.curry : true,
'fixed': 'fixed' in options ? options.fixed : true,
'immutable': 'immutable' in options ? options.immutable : true,
'rearg': 'rearg' in options ? options.rearg : true
};
var defaultHolder = isLib ? func : fallbackHolder,
forceCurry = ('curry' in options) && options.curry,
forceFixed = ('fixed' in options) && options.fixed,
forceRearg = ('rearg' in options) && options.rearg,
pristine = isLib ? func.runInContext() : undefined;
var helpers = isLib ? func : {
'ary': util.ary,
'assign': util.assign,
'clone': util.clone,
'curry': util.curry,
'forEach': util.forEach,
'isArray': util.isArray,
'isError': util.isError,
'isFunction': util.isFunction,
'isWeakMap': util.isWeakMap,
'iteratee': util.iteratee,
'keys': util.keys,
'rearg': util.rearg,
'toInteger': util.toInteger,
'toPath': util.toPath
};
var ary = helpers.ary,
assign = helpers.assign,
clone = helpers.clone,
curry = helpers.curry,
each = helpers.forEach,
isArray = helpers.isArray,
isError = helpers.isError,
isFunction = helpers.isFunction,
isWeakMap = helpers.isWeakMap,
keys = helpers.keys,
rearg = helpers.rearg,
toInteger = helpers.toInteger,
toPath = helpers.toPath;
var aryMethodKeys = keys(mapping.aryMethod);
var wrappers = {
'castArray': function(castArray) {
return function() {
var value = arguments[0];
return isArray(value)
? castArray(cloneArray(value))
: castArray.apply(undefined, arguments);
};
},
'iteratee': function(iteratee) {
return function() {
var func = arguments[0],
arity = arguments[1],
result = iteratee(func, arity),
length = result.length;
if (config.cap && typeof arity == 'number') {
arity = arity > 2 ? (arity - 2) : 1;
return (length && length <= arity) ? result : baseAry(result, arity);
}
return result;
};
},
'mixin': function(mixin) {
return function(source) {
var func = this;
if (!isFunction(func)) {
return mixin(func, Object(source));
}
var pairs = [];
each(keys(source), function(key) {
if (isFunction(source[key])) {
pairs.push([key, func.prototype[key]]);
}
});
mixin(func, Object(source));
each(pairs, function(pair) {
var value = pair[1];
if (isFunction(value)) {
func.prototype[pair[0]] = value;
} else {
delete func.prototype[pair[0]];
}
});
return func;
};
},
'nthArg': function(nthArg) {
return function(n) {
var arity = n < 0 ? 1 : (toInteger(n) + 1);
return curry(nthArg(n), arity);
};
},
'rearg': function(rearg) {
return function(func, indexes) {
var arity = indexes ? indexes.length : 0;
return curry(rearg(func, indexes), arity);
};
},
'runInContext': function(runInContext) {
return function(context) {
return baseConvert(util, runInContext(context), options);
};
}
};
/*--------------------------------------------------------------------------*/
/**
* Casts `func` to a function with an arity capped iteratee if needed.
*
* @private
* @param {string} name The name of the function to inspect.
* @param {Function} func The function to inspect.
* @returns {Function} Returns the cast function.
*/
function castCap(name, func) {
if (config.cap) {
var indexes = mapping.iterateeRearg[name];
if (indexes) {
return iterateeRearg(func, indexes);
}
var n = !isLib && mapping.iterateeAry[name];
if (n) {
return iterateeAry(func, n);
}
}
return func;
}
/**
* Casts `func` to a curried function if needed.
*
* @private
* @param {string} name The name of the function to inspect.
* @param {Function} func The function to inspect.
* @param {number} n The arity of `func`.
* @returns {Function} Returns the cast function.
*/
function castCurry(name, func, n) {
return (forceCurry || (config.curry && n > 1))
? curry(func, n)
: func;
}
/**
* Casts `func` to a fixed arity function if needed.
*
* @private
* @param {string} name The name of the function to inspect.
* @param {Function} func The function to inspect.
* @param {number} n The arity cap.
* @returns {Function} Returns the cast function.
*/
function castFixed(name, func, n) {
if (config.fixed && (forceFixed || !mapping.skipFixed[name])) {
var data = mapping.methodSpread[name],
start = data && data.start;
return start === undefined ? ary(func, n) : flatSpread(func, start);
}
return func;
}
/**
* Casts `func` to an rearged function if needed.
*
* @private
* @param {string} name The name of the function to inspect.
* @param {Function} func The function to inspect.
* @param {number} n The arity of `func`.
* @returns {Function} Returns the cast function.
*/
function castRearg(name, func, n) {
return (config.rearg && n > 1 && (forceRearg || !mapping.skipRearg[name]))
? rearg(func, mapping.methodRearg[name] || mapping.aryRearg[n])
: func;
}
/**
* Creates a clone of `object` by `path`.
*
* @private
* @param {Object} object The object to clone.
* @param {Array|string} path The path to clone by.
* @returns {Object} Returns the cloned object.
*/
function cloneByPath(object, path) {
path = toPath(path);
var index = -1,
length = path.length,
lastIndex = length - 1,
result = clone(Object(object)),
nested = result;
while (nested != null && ++index < length) {
var key = path[index],
value = nested[key];
if (value != null &&
!(isFunction(value) || isError(value) || isWeakMap(value))) {
nested[key] = clone(index == lastIndex ? value : Object(value));
}
nested = nested[key];
}
return result;
}
/**
* Converts `lodash` to an immutable auto-curried iteratee-first data-last
* version with conversion `options` applied.
*
* @param {Object} [options] The options object. See `baseConvert` for more details.
* @returns {Function} Returns the converted `lodash`.
*/
function convertLib(options) {
return _.runInContext.convert(options)(undefined);
}
/**
* Create a converter function for `func` of `name`.
*
* @param {string} name The name of the function to convert.
* @param {Function} func The function to convert.
* @returns {Function} Returns the new converter function.
*/
function createConverter(name, func) {
var realName = mapping.aliasToReal[name] || name,
methodName = mapping.remap[realName] || realName,
oldOptions = options;
return function(options) {
var newUtil = isLib ? pristine : helpers,
newFunc = isLib ? pristine[methodName] : func,
newOptions = assign(assign({}, oldOptions), options);
return baseConvert(newUtil, realName, newFunc, newOptions);
};
}
/**
* Creates a function that wraps `func` to invoke its iteratee, with up to `n`
* arguments, ignoring any additional arguments.
*
* @private
* @param {Function} func The function to cap iteratee arguments for.
* @param {number} n The arity cap.
* @returns {Function} Returns the new function.
*/
function iterateeAry(func, n) {
return overArg(func, function(func) {
return typeof func == 'function' ? baseAry(func, n) : func;
});
}
/**
* Creates a function that wraps `func` to invoke its iteratee with arguments
* arranged according to the specified `indexes` where the argument value at
* the first index is provided as the first argument, the argument value at
* the second index is provided as the second argument, and so on.
*
* @private
* @param {Function} func The function to rearrange iteratee arguments for.
* @param {number[]} indexes The arranged argument indexes.
* @returns {Function} Returns the new function.
*/
function iterateeRearg(func, indexes) {
return overArg(func, function(func) {
var n = indexes.length;
return baseArity(rearg(baseAry(func, n), indexes), n);
});
}
/**
* Creates a function that invokes `func` with its first argument transformed.
*
* @private
* @param {Function} func The function to wrap.
* @param {Function} transform The argument transform.
* @returns {Function} Returns the new function.
*/
function overArg(func, transform) {
return function() {
var length = arguments.length;
if (!length) {
return func();
}
var args = Array(length);
while (length--) {
args[length] = arguments[length];
}
var index = config.rearg ? 0 : (length - 1);
args[index] = transform(args[index]);
return func.apply(undefined, args);
};
}
/**
* Creates a function that wraps `func` and applys the conversions
* rules by `name`.
*
* @private
* @param {string} name The name of the function to wrap.
* @param {Function} func The function to wrap.
* @returns {Function} Returns the converted function.
*/
function wrap(name, func, placeholder) {
var result,
realName = mapping.aliasToReal[name] || name,
wrapped = func,
wrapper = wrappers[realName];
if (wrapper) {
wrapped = wrapper(func);
}
else if (config.immutable) {
if (mapping.mutate.array[realName]) {
wrapped = wrapImmutable(func, cloneArray);
}
else if (mapping.mutate.object[realName]) {
wrapped = wrapImmutable(func, createCloner(func));
}
else if (mapping.mutate.set[realName]) {
wrapped = wrapImmutable(func, cloneByPath);
}
}
each(aryMethodKeys, function(aryKey) {
each(mapping.aryMethod[aryKey], function(otherName) {
if (realName == otherName) {
var data = mapping.methodSpread[realName],
afterRearg = data && data.afterRearg;
result = afterRearg
? castFixed(realName, castRearg(realName, wrapped, aryKey), aryKey)
: castRearg(realName, castFixed(realName, wrapped, aryKey), aryKey);
result = castCap(realName, result);
result = castCurry(realName, result, aryKey);
return false;
}
});
return !result;
});
result || (result = wrapped);
if (result == func) {
result = forceCurry ? curry(result, 1) : function() {
return func.apply(this, arguments);
};
}
result.convert = createConverter(realName, func);
result.placeholder = func.placeholder = placeholder;
return result;
}
/*--------------------------------------------------------------------------*/
if (!isObj) {
return wrap(name, func, defaultHolder);
}
var _ = func;
// Convert methods by ary cap.
var pairs = [];
each(aryMethodKeys, function(aryKey) {
each(mapping.aryMethod[aryKey], function(key) {
var func = _[mapping.remap[key] || key];
if (func) {
pairs.push([key, wrap(key, func, _)]);
}
});
});
// Convert remaining methods.
each(keys(_), function(key) {
var func = _[key];
if (typeof func == 'function') {
var length = pairs.length;
while (length--) {
if (pairs[length][0] == key) {
return;
}
}
func.convert = createConverter(key, func);
pairs.push([key, func]);
}
});
// Assign to `_` leaving `_.prototype` unchanged to allow chaining.
each(pairs, function(pair) {
_[pair[0]] = pair[1];
});
_.convert = convertLib;
_.placeholder = _;
// Assign aliases.
each(keys(_), function(key) {
each(mapping.realToAlias[key] || [], function(alias) {
_[alias] = _[key];
});
});
return _;
}
module.exports = baseConvert;
/***/ }),
/***/ "./node_modules/lodash/fp/_mapping.js":
/*!********************************************!*\
!*** ./node_modules/lodash/fp/_mapping.js ***!
\********************************************/
/***/ ((__unused_webpack_module, exports) => {
/** Used to map aliases to their real names. */
exports.aliasToReal = {
// Lodash aliases.
'each': 'forEach',
'eachRight': 'forEachRight',
'entries': 'toPairs',
'entriesIn': 'toPairsIn',
'extend': 'assignIn',
'extendAll': 'assignInAll',
'extendAllWith': 'assignInAllWith',
'extendWith': 'assignInWith',
'first': 'head',
// Methods that are curried variants of others.
'conforms': 'conformsTo',
'matches': 'isMatch',
'property': 'get',
// Ramda aliases.
'__': 'placeholder',
'F': 'stubFalse',
'T': 'stubTrue',
'all': 'every',
'allPass': 'overEvery',
'always': 'constant',
'any': 'some',
'anyPass': 'overSome',
'apply': 'spread',
'assoc': 'set',
'assocPath': 'set',
'complement': 'negate',
'compose': 'flowRight',
'contains': 'includes',
'dissoc': 'unset',
'dissocPath': 'unset',
'dropLast': 'dropRight',
'dropLastWhile': 'dropRightWhile',
'equals': 'isEqual',
'identical': 'eq',
'indexBy': 'keyBy',
'init': 'initial',
'invertObj': 'invert',
'juxt': 'over',
'omitAll': 'omit',
'nAry': 'ary',
'path': 'get',
'pathEq': 'matchesProperty',
'pathOr': 'getOr',
'paths': 'at',
'pickAll': 'pick',
'pipe': 'flow',
'pluck': 'map',
'prop': 'get',
'propEq': 'matchesProperty',
'propOr': 'getOr',
'props': 'at',
'symmetricDifference': 'xor',
'symmetricDifferenceBy': 'xorBy',
'symmetricDifferenceWith': 'xorWith',
'takeLast': 'takeRight',
'takeLastWhile': 'takeRightWhile',
'unapply': 'rest',
'unnest': 'flatten',
'useWith': 'overArgs',
'where': 'conformsTo',
'whereEq': 'isMatch',
'zipObj': 'zipObject'
};
/** Used to map ary to method names. */
exports.aryMethod = {
'1': [
'assignAll', 'assignInAll', 'attempt', 'castArray', 'ceil', 'create',
'curry', 'curryRight', 'defaultsAll', 'defaultsDeepAll', 'floor', 'flow',
'flowRight', 'fromPairs', 'invert', 'iteratee', 'memoize', 'method', 'mergeAll',
'methodOf', 'mixin', 'nthArg', 'over', 'overEvery', 'overSome','rest', 'reverse',
'round', 'runInContext', 'spread', 'template', 'trim', 'trimEnd', 'trimStart',
'uniqueId', 'words', 'zipAll'
],
'2': [
'add', 'after', 'ary', 'assign', 'assignAllWith', 'assignIn', 'assignInAllWith',
'at', 'before', 'bind', 'bindAll', 'bindKey', 'chunk', 'cloneDeepWith',
'cloneWith', 'concat', 'conformsTo', 'countBy', 'curryN', 'curryRightN',
'debounce', 'defaults', 'defaultsDeep', 'defaultTo', 'delay', 'difference',
'divide', 'drop', 'dropRight', 'dropRightWhile', 'dropWhile', 'endsWith', 'eq',
'every', 'filter', 'find', 'findIndex', 'findKey', 'findLast', 'findLastIndex',
'findLastKey', 'flatMap', 'flatMapDeep', 'flattenDepth', 'forEach',
'forEachRight', 'forIn', 'forInRight', 'forOwn', 'forOwnRight', 'get',
'groupBy', 'gt', 'gte', 'has', 'hasIn', 'includes', 'indexOf', 'intersection',
'invertBy', 'invoke', 'invokeMap', 'isEqual', 'isMatch', 'join', 'keyBy',
'lastIndexOf', 'lt', 'lte', 'map', 'mapKeys', 'mapValues', 'matchesProperty',
'maxBy', 'meanBy', 'merge', 'mergeAllWith', 'minBy', 'multiply', 'nth', 'omit',
'omitBy', 'overArgs', 'pad', 'padEnd', 'padStart', 'parseInt', 'partial',
'partialRight', 'partition', 'pick', 'pickBy', 'propertyOf', 'pull', 'pullAll',
'pullAt', 'random', 'range', 'rangeRight', 'rearg', 'reject', 'remove',
'repeat', 'restFrom', 'result', 'sampleSize', 'some', 'sortBy', 'sortedIndex',
'sortedIndexOf', 'sortedLastIndex', 'sortedLastIndexOf', 'sortedUniqBy',
'split', 'spreadFrom', 'startsWith', 'subtract', 'sumBy', 'take', 'takeRight',
'takeRightWhile', 'takeWhile', 'tap', 'throttle', 'thru', 'times', 'trimChars',
'trimCharsEnd', 'trimCharsStart', 'truncate', 'union', 'uniqBy', 'uniqWith',
'unset', 'unzipWith', 'without', 'wrap', 'xor', 'zip', 'zipObject',
'zipObjectDeep'
],
'3': [
'assignInWith', 'assignWith', 'clamp', 'differenceBy', 'differenceWith',
'findFrom', 'findIndexFrom', 'findLastFrom', 'findLastIndexFrom', 'getOr',
'includesFrom', 'indexOfFrom', 'inRange', 'intersectionBy', 'intersectionWith',
'invokeArgs', 'invokeArgsMap', 'isEqualWith', 'isMatchWith', 'flatMapDepth',
'lastIndexOfFrom', 'mergeWith', 'orderBy', 'padChars', 'padCharsEnd',
'padCharsStart', 'pullAllBy', 'pullAllWith', 'rangeStep', 'rangeStepRight',
'reduce', 'reduceRight', 'replace', 'set', 'slice', 'sortedIndexBy',
'sortedLastIndexBy', 'transform', 'unionBy', 'unionWith', 'update', 'xorBy',
'xorWith', 'zipWith'
],
'4': [
'fill', 'setWith', 'updateWith'
]
};
/** Used to map ary to rearg configs. */
exports.aryRearg = {
'2': [1, 0],
'3': [2, 0, 1],
'4': [3, 2, 0, 1]
};
/** Used to map method names to their iteratee ary. */
exports.iterateeAry = {
'dropRightWhile': 1,
'dropWhile': 1,
'every': 1,
'filter': 1,
'find': 1,
'findFrom': 1,
'findIndex': 1,
'findIndexFrom': 1,
'findKey': 1,
'findLast': 1,
'findLastFrom': 1,
'findLastIndex': 1,
'findLastIndexFrom': 1,
'findLastKey': 1,
'flatMap': 1,
'flatMapDeep': 1,
'flatMapDepth': 1,
'forEach': 1,
'forEachRight': 1,
'forIn': 1,
'forInRight': 1,
'forOwn': 1,
'forOwnRight': 1,
'map': 1,
'mapKeys': 1,
'mapValues': 1,
'partition': 1,
'reduce': 2,
'reduceRight': 2,
'reject': 1,
'remove': 1,
'some': 1,
'takeRightWhile': 1,
'takeWhile': 1,
'times': 1,
'transform': 2
};
/** Used to map method names to iteratee rearg configs. */
exports.iterateeRearg = {
'mapKeys': [1],
'reduceRight': [1, 0]
};
/** Used to map method names to rearg configs. */
exports.methodRearg = {
'assignInAllWith': [1, 0],
'assignInWith': [1, 2, 0],
'assignAllWith': [1, 0],
'assignWith': [1, 2, 0],
'differenceBy': [1, 2, 0],
'differenceWith': [1, 2, 0],
'getOr': [2, 1, 0],
'intersectionBy': [1, 2, 0],
'intersectionWith': [1, 2, 0],
'isEqualWith': [1, 2, 0],
'isMatchWith': [2, 1, 0],
'mergeAllWith': [1, 0],
'mergeWith': [1, 2, 0],
'padChars': [2, 1, 0],
'padCharsEnd': [2, 1, 0],
'padCharsStart': [2, 1, 0],
'pullAllBy': [2, 1, 0],
'pullAllWith': [2, 1, 0],
'rangeStep': [1, 2, 0],
'rangeStepRight': [1, 2, 0],
'setWith': [3, 1, 2, 0],
'sortedIndexBy': [2, 1, 0],
'sortedLastIndexBy': [2, 1, 0],
'unionBy': [1, 2, 0],
'unionWith': [1, 2, 0],
'updateWith': [3, 1, 2, 0],
'xorBy': [1, 2, 0],
'xorWith': [1, 2, 0],
'zipWith': [1, 2, 0]
};
/** Used to map method names to spread configs. */
exports.methodSpread = {
'assignAll': { 'start': 0 },
'assignAllWith': { 'start': 0 },
'assignInAll': { 'start': 0 },
'assignInAllWith': { 'start': 0 },
'defaultsAll': { 'start': 0 },
'defaultsDeepAll': { 'start': 0 },
'invokeArgs': { 'start': 2 },
'invokeArgsMap': { 'start': 2 },
'mergeAll': { 'start': 0 },
'mergeAllWith': { 'start': 0 },
'partial': { 'start': 1 },
'partialRight': { 'start': 1 },
'without': { 'start': 1 },
'zipAll': { 'start': 0 }
};
/** Used to identify methods which mutate arrays or objects. */
exports.mutate = {
'array': {
'fill': true,
'pull': true,
'pullAll': true,
'pullAllBy': true,
'pullAllWith': true,
'pullAt': true,
'remove': true,
'reverse': true
},
'object': {
'assign': true,
'assignAll': true,
'assignAllWith': true,
'assignIn': true,
'assignInAll': true,
'assignInAllWith': true,
'assignInWith': true,
'assignWith': true,
'defaults': true,
'defaultsAll': true,
'defaultsDeep': true,
'defaultsDeepAll': true,
'merge': true,
'mergeAll': true,
'mergeAllWith': true,
'mergeWith': true,
},
'set': {
'set': true,
'setWith': true,
'unset': true,
'update': true,
'updateWith': true
}
};
/** Used to map real names to their aliases. */
exports.realToAlias = (function() {
var hasOwnProperty = Object.prototype.hasOwnProperty,
object = exports.aliasToReal,
result = {};
for (var key in object) {
var value = object[key];
if (hasOwnProperty.call(result, value)) {
result[value].push(key);
} else {
result[value] = [key];
}
}
return result;
}());
/** Used to map method names to other names. */
exports.remap = {
'assignAll': 'assign',
'assignAllWith': 'assignWith',
'assignInAll': 'assignIn',
'assignInAllWith': 'assignInWith',
'curryN': 'curry',
'curryRightN': 'curryRight',
'defaultsAll': 'defaults',
'defaultsDeepAll': 'defaultsDeep',
'findFrom': 'find',
'findIndexFrom': 'findIndex',
'findLastFrom': 'findLast',
'findLastIndexFrom': 'findLastIndex',
'getOr': 'get',
'includesFrom': 'includes',
'indexOfFrom': 'indexOf',
'invokeArgs': 'invoke',
'invokeArgsMap': 'invokeMap',
'lastIndexOfFrom': 'lastIndexOf',
'mergeAll': 'merge',
'mergeAllWith': 'mergeWith',
'padChars': 'pad',
'padCharsEnd': 'padEnd',
'padCharsStart': 'padStart',
'propertyOf': 'get',
'rangeStep': 'range',
'rangeStepRight': 'rangeRight',
'restFrom': 'rest',
'spreadFrom': 'spread',
'trimChars': 'trim',
'trimCharsEnd': 'trimEnd',
'trimCharsStart': 'trimStart',
'zipAll': 'zip'
};
/** Used to track methods that skip fixing their arity. */
exports.skipFixed = {
'castArray': true,
'flow': true,
'flowRight': true,
'iteratee': true,
'mixin': true,
'rearg': true,
'runInContext': true
};
/** Used to track methods that skip rearranging arguments. */
exports.skipRearg = {
'add': true,
'assign': true,
'assignIn': true,
'bind': true,
'bindKey': true,
'concat': true,
'difference': true,
'divide': true,
'eq': true,
'gt': true,
'gte': true,
'isEqual': true,
'lt': true,
'lte': true,
'matchesProperty': true,
'merge': true,
'multiply': true,
'overArgs': true,
'partial': true,
'partialRight': true,
'propertyOf': true,
'random': true,
'range': true,
'rangeRight': true,
'subtract': true,
'zip': true,
'zipObject': true,
'zipObjectDeep': true
};
/***/ }),
/***/ "./node_modules/lodash/fp/placeholder.js":
/*!***********************************************!*\
!*** ./node_modules/lodash/fp/placeholder.js ***!
\***********************************************/
/***/ ((module) => {
/**
* The default argument placeholder value for methods.
*
* @type {Object}
*/
module.exports = {};
/***/ }),
/***/ "./node_modules/lodash/lodash.min.js":
/*!*******************************************!*\
!*** ./node_modules/lodash/lodash.min.js ***!
\*******************************************/
/***/ (function(module, exports, __webpack_require__) {
/* module decorator */ module = __webpack_require__.nmd(module);
var __WEBPACK_AMD_DEFINE_RESULT__;/**
* @license
* Lodash <https://lodash.com/>
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
* Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
(function(){function n(n,t,r){switch(r.length){case 0:return n.call(t);case 1:return n.call(t,r[0]);case 2:return n.call(t,r[0],r[1]);case 3:return n.call(t,r[0],r[1],r[2])}return n.apply(t,r)}function t(n,t,r,e){for(var u=-1,i=null==n?0:n.length;++u<i;){var o=n[u];t(e,o,r(o),n)}return e}function r(n,t){for(var r=-1,e=null==n?0:n.length;++r<e&&t(n[r],r,n)!==!1;);return n}function e(n,t){for(var r=null==n?0:n.length;r--&&t(n[r],r,n)!==!1;);return n}function u(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(!t(n[r],r,n))return!1;
return!0}function i(n,t){for(var r=-1,e=null==n?0:n.length,u=0,i=[];++r<e;){var o=n[r];t(o,r,n)&&(i[u++]=o)}return i}function o(n,t){return!!(null==n?0:n.length)&&y(n,t,0)>-1}function f(n,t,r){for(var e=-1,u=null==n?0:n.length;++e<u;)if(r(t,n[e]))return!0;return!1}function c(n,t){for(var r=-1,e=null==n?0:n.length,u=Array(e);++r<e;)u[r]=t(n[r],r,n);return u}function a(n,t){for(var r=-1,e=t.length,u=n.length;++r<e;)n[u+r]=t[r];return n}function l(n,t,r,e){var u=-1,i=null==n?0:n.length;for(e&&i&&(r=n[++u]);++u<i;)r=t(r,n[u],u,n);
return r}function s(n,t,r,e){var u=null==n?0:n.length;for(e&&u&&(r=n[--u]);u--;)r=t(r,n[u],u,n);return r}function h(n,t){for(var r=-1,e=null==n?0:n.length;++r<e;)if(t(n[r],r,n))return!0;return!1}function p(n){return n.split("")}function _(n){return n.match($t)||[]}function v(n,t,r){var e;return r(n,function(n,r,u){if(t(n,r,u))return e=r,!1}),e}function g(n,t,r,e){for(var u=n.length,i=r+(e?1:-1);e?i--:++i<u;)if(t(n[i],i,n))return i;return-1}function y(n,t,r){return t===t?Z(n,t,r):g(n,b,r)}function d(n,t,r,e){
for(var u=r-1,i=n.length;++u<i;)if(e(n[u],t))return u;return-1}function b(n){return n!==n}function w(n,t){var r=null==n?0:n.length;return r?k(n,t)/r:Cn}function m(n){return function(t){return null==t?X:t[n]}}function x(n){return function(t){return null==n?X:n[t]}}function j(n,t,r,e,u){return u(n,function(n,u,i){r=e?(e=!1,n):t(r,n,u,i)}),r}function A(n,t){var r=n.length;for(n.sort(t);r--;)n[r]=n[r].value;return n}function k(n,t){for(var r,e=-1,u=n.length;++e<u;){var i=t(n[e]);i!==X&&(r=r===X?i:r+i);
}return r}function O(n,t){for(var r=-1,e=Array(n);++r<n;)e[r]=t(r);return e}function I(n,t){return c(t,function(t){return[t,n[t]]})}function R(n){return n?n.slice(0,H(n)+1).replace(Lt,""):n}function z(n){return function(t){return n(t)}}function E(n,t){return c(t,function(t){return n[t]})}function S(n,t){return n.has(t)}function W(n,t){for(var r=-1,e=n.length;++r<e&&y(t,n[r],0)>-1;);return r}function L(n,t){for(var r=n.length;r--&&y(t,n[r],0)>-1;);return r}function C(n,t){for(var r=n.length,e=0;r--;)n[r]===t&&++e;
return e}function U(n){return"\\"+Yr[n]}function B(n,t){return null==n?X:n[t]}function T(n){return Nr.test(n)}function $(n){return Pr.test(n)}function D(n){for(var t,r=[];!(t=n.next()).done;)r.push(t.value);return r}function M(n){var t=-1,r=Array(n.size);return n.forEach(function(n,e){r[++t]=[e,n]}),r}function F(n,t){return function(r){return n(t(r))}}function N(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){var o=n[r];o!==t&&o!==cn||(n[r]=cn,i[u++]=r)}return i}function P(n){var t=-1,r=Array(n.size);
return n.forEach(function(n){r[++t]=n}),r}function q(n){var t=-1,r=Array(n.size);return n.forEach(function(n){r[++t]=[n,n]}),r}function Z(n,t,r){for(var e=r-1,u=n.length;++e<u;)if(n[e]===t)return e;return-1}function K(n,t,r){for(var e=r+1;e--;)if(n[e]===t)return e;return e}function V(n){return T(n)?J(n):_e(n)}function G(n){return T(n)?Y(n):p(n)}function H(n){for(var t=n.length;t--&&Ct.test(n.charAt(t)););return t}function J(n){for(var t=Mr.lastIndex=0;Mr.test(n);)++t;return t}function Y(n){return n.match(Mr)||[];
}function Q(n){return n.match(Fr)||[]}var X,nn="4.17.21",tn=200,rn="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",en="Expected a function",un="Invalid `variable` option passed into `_.template`",on="__lodash_hash_undefined__",fn=500,cn="__lodash_placeholder__",an=1,ln=2,sn=4,hn=1,pn=2,_n=1,vn=2,gn=4,yn=8,dn=16,bn=32,wn=64,mn=128,xn=256,jn=512,An=30,kn="...",On=800,In=16,Rn=1,zn=2,En=3,Sn=1/0,Wn=9007199254740991,Ln=1.7976931348623157e308,Cn=NaN,Un=4294967295,Bn=Un-1,Tn=Un>>>1,$n=[["ary",mn],["bind",_n],["bindKey",vn],["curry",yn],["curryRight",dn],["flip",jn],["partial",bn],["partialRight",wn],["rearg",xn]],Dn="[object Arguments]",Mn="[object Array]",Fn="[object AsyncFunction]",Nn="[object Boolean]",Pn="[object Date]",qn="[object DOMException]",Zn="[object Error]",Kn="[object Function]",Vn="[object GeneratorFunction]",Gn="[object Map]",Hn="[object Number]",Jn="[object Null]",Yn="[object Object]",Qn="[object Promise]",Xn="[object Proxy]",nt="[object RegExp]",tt="[object Set]",rt="[object String]",et="[object Symbol]",ut="[object Undefined]",it="[object WeakMap]",ot="[object WeakSet]",ft="[object ArrayBuffer]",ct="[object DataView]",at="[object Float32Array]",lt="[object Float64Array]",st="[object Int8Array]",ht="[object Int16Array]",pt="[object Int32Array]",_t="[object Uint8Array]",vt="[object Uint8ClampedArray]",gt="[object Uint16Array]",yt="[object Uint32Array]",dt=/\b__p \+= '';/g,bt=/\b(__p \+=) '' \+/g,wt=/(__e\(.*?\)|\b__t\)) \+\n'';/g,mt=/&(?:amp|lt|gt|quot|#39);/g,xt=/[&<>"']/g,jt=RegExp(mt.source),At=RegExp(xt.source),kt=/<%-([\s\S]+?)%>/g,Ot=/<%([\s\S]+?)%>/g,It=/<%=([\s\S]+?)%>/g,Rt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,zt=/^\w*$/,Et=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,St=/[\\^$.*+?()[\]{}|]/g,Wt=RegExp(St.source),Lt=/^\s+/,Ct=/\s/,Ut=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Bt=/\{\n\/\* \[wrapped with (.+)\] \*/,Tt=/,? & /,$t=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Dt=/[()=,{}\[\]\/\s]/,Mt=/\\(\\)?/g,Ft=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Nt=/\w*$/,Pt=/^[-+]0x[0-9a-f]+$/i,qt=/^0b[01]+$/i,Zt=/^\[object .+?Constructor\]$/,Kt=/^0o[0-7]+$/i,Vt=/^(?:0|[1-9]\d*)$/,Gt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Ht=/($^)/,Jt=/['\n\r\u2028\u2029\\]/g,Yt="\\ud800-\\udfff",Qt="\\u0300-\\u036f",Xt="\\ufe20-\\ufe2f",nr="\\u20d0-\\u20ff",tr=Qt+Xt+nr,rr="\\u2700-\\u27bf",er="a-z\\xdf-\\xf6\\xf8-\\xff",ur="\\xac\\xb1\\xd7\\xf7",ir="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",or="\\u2000-\\u206f",fr=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",cr="A-Z\\xc0-\\xd6\\xd8-\\xde",ar="\\ufe0e\\ufe0f",lr=ur+ir+or+fr,sr="['\u2019]",hr="["+Yt+"]",pr="["+lr+"]",_r="["+tr+"]",vr="\\d+",gr="["+rr+"]",yr="["+er+"]",dr="[^"+Yt+lr+vr+rr+er+cr+"]",br="\\ud83c[\\udffb-\\udfff]",wr="(?:"+_r+"|"+br+")",mr="[^"+Yt+"]",xr="(?:\\ud83c[\\udde6-\\uddff]){2}",jr="[\\ud800-\\udbff][\\udc00-\\udfff]",Ar="["+cr+"]",kr="\\u200d",Or="(?:"+yr+"|"+dr+")",Ir="(?:"+Ar+"|"+dr+")",Rr="(?:"+sr+"(?:d|ll|m|re|s|t|ve))?",zr="(?:"+sr+"(?:D|LL|M|RE|S|T|VE))?",Er=wr+"?",Sr="["+ar+"]?",Wr="(?:"+kr+"(?:"+[mr,xr,jr].join("|")+")"+Sr+Er+")*",Lr="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Cr="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",Ur=Sr+Er+Wr,Br="(?:"+[gr,xr,jr].join("|")+")"+Ur,Tr="(?:"+[mr+_r+"?",_r,xr,jr,hr].join("|")+")",$r=RegExp(sr,"g"),Dr=RegExp(_r,"g"),Mr=RegExp(br+"(?="+br+")|"+Tr+Ur,"g"),Fr=RegExp([Ar+"?"+yr+"+"+Rr+"(?="+[pr,Ar,"$"].join("|")+")",Ir+"+"+zr+"(?="+[pr,Ar+Or,"$"].join("|")+")",Ar+"?"+Or+"+"+Rr,Ar+"+"+zr,Cr,Lr,vr,Br].join("|"),"g"),Nr=RegExp("["+kr+Yt+tr+ar+"]"),Pr=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,qr=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Zr=-1,Kr={};
Kr[at]=Kr[lt]=Kr[st]=Kr[ht]=Kr[pt]=Kr[_t]=Kr[vt]=Kr[gt]=Kr[yt]=!0,Kr[Dn]=Kr[Mn]=Kr[ft]=Kr[Nn]=Kr[ct]=Kr[Pn]=Kr[Zn]=Kr[Kn]=Kr[Gn]=Kr[Hn]=Kr[Yn]=Kr[nt]=Kr[tt]=Kr[rt]=Kr[it]=!1;var Vr={};Vr[Dn]=Vr[Mn]=Vr[ft]=Vr[ct]=Vr[Nn]=Vr[Pn]=Vr[at]=Vr[lt]=Vr[st]=Vr[ht]=Vr[pt]=Vr[Gn]=Vr[Hn]=Vr[Yn]=Vr[nt]=Vr[tt]=Vr[rt]=Vr[et]=Vr[_t]=Vr[vt]=Vr[gt]=Vr[yt]=!0,Vr[Zn]=Vr[Kn]=Vr[it]=!1;var Gr={"\xc0":"A","\xc1":"A","\xc2":"A","\xc3":"A","\xc4":"A","\xc5":"A","\xe0":"a","\xe1":"a","\xe2":"a","\xe3":"a","\xe4":"a","\xe5":"a",
"\xc7":"C","\xe7":"c","\xd0":"D","\xf0":"d","\xc8":"E","\xc9":"E","\xca":"E","\xcb":"E","\xe8":"e","\xe9":"e","\xea":"e","\xeb":"e","\xcc":"I","\xcd":"I","\xce":"I","\xcf":"I","\xec":"i","\xed":"i","\xee":"i","\xef":"i","\xd1":"N","\xf1":"n","\xd2":"O","\xd3":"O","\xd4":"O","\xd5":"O","\xd6":"O","\xd8":"O","\xf2":"o","\xf3":"o","\xf4":"o","\xf5":"o","\xf6":"o","\xf8":"o","\xd9":"U","\xda":"U","\xdb":"U","\xdc":"U","\xf9":"u","\xfa":"u","\xfb":"u","\xfc":"u","\xdd":"Y","\xfd":"y","\xff":"y","\xc6":"Ae",
"\xe6":"ae","\xde":"Th","\xfe":"th","\xdf":"ss","\u0100":"A","\u0102":"A","\u0104":"A","\u0101":"a","\u0103":"a","\u0105":"a","\u0106":"C","\u0108":"C","\u010a":"C","\u010c":"C","\u0107":"c","\u0109":"c","\u010b":"c","\u010d":"c","\u010e":"D","\u0110":"D","\u010f":"d","\u0111":"d","\u0112":"E","\u0114":"E","\u0116":"E","\u0118":"E","\u011a":"E","\u0113":"e","\u0115":"e","\u0117":"e","\u0119":"e","\u011b":"e","\u011c":"G","\u011e":"G","\u0120":"G","\u0122":"G","\u011d":"g","\u011f":"g","\u0121":"g",
"\u0123":"g","\u0124":"H","\u0126":"H","\u0125":"h","\u0127":"h","\u0128":"I","\u012a":"I","\u012c":"I","\u012e":"I","\u0130":"I","\u0129":"i","\u012b":"i","\u012d":"i","\u012f":"i","\u0131":"i","\u0134":"J","\u0135":"j","\u0136":"K","\u0137":"k","\u0138":"k","\u0139":"L","\u013b":"L","\u013d":"L","\u013f":"L","\u0141":"L","\u013a":"l","\u013c":"l","\u013e":"l","\u0140":"l","\u0142":"l","\u0143":"N","\u0145":"N","\u0147":"N","\u014a":"N","\u0144":"n","\u0146":"n","\u0148":"n","\u014b":"n","\u014c":"O",
"\u014e":"O","\u0150":"O","\u014d":"o","\u014f":"o","\u0151":"o","\u0154":"R","\u0156":"R","\u0158":"R","\u0155":"r","\u0157":"r","\u0159":"r","\u015a":"S","\u015c":"S","\u015e":"S","\u0160":"S","\u015b":"s","\u015d":"s","\u015f":"s","\u0161":"s","\u0162":"T","\u0164":"T","\u0166":"T","\u0163":"t","\u0165":"t","\u0167":"t","\u0168":"U","\u016a":"U","\u016c":"U","\u016e":"U","\u0170":"U","\u0172":"U","\u0169":"u","\u016b":"u","\u016d":"u","\u016f":"u","\u0171":"u","\u0173":"u","\u0174":"W","\u0175":"w",
"\u0176":"Y","\u0177":"y","\u0178":"Y","\u0179":"Z","\u017b":"Z","\u017d":"Z","\u017a":"z","\u017c":"z","\u017e":"z","\u0132":"IJ","\u0133":"ij","\u0152":"Oe","\u0153":"oe","\u0149":"'n","\u017f":"s"},Hr={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},Jr={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#39;":"'"},Yr={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Qr=parseFloat,Xr=parseInt,ne="object"==typeof __webpack_require__.g&&__webpack_require__.g&&__webpack_require__.g.Object===Object&&__webpack_require__.g,te="object"==typeof self&&self&&self.Object===Object&&self,re=ne||te||Function("return this")(),ee= true&&exports&&!exports.nodeType&&exports,ue=ee&&"object"=="object"&&module&&!module.nodeType&&module,ie=ue&&ue.exports===ee,oe=ie&&ne.process,fe=function(){
try{var n=ue&&ue.require&&ue.require("util").types;return n?n:oe&&oe.binding&&oe.binding("util")}catch(n){}}(),ce=fe&&fe.isArrayBuffer,ae=fe&&fe.isDate,le=fe&&fe.isMap,se=fe&&fe.isRegExp,he=fe&&fe.isSet,pe=fe&&fe.isTypedArray,_e=m("length"),ve=x(Gr),ge=x(Hr),ye=x(Jr),de=function p(x){function Z(n){if(cc(n)&&!bh(n)&&!(n instanceof Ct)){if(n instanceof Y)return n;if(bl.call(n,"__wrapped__"))return eo(n)}return new Y(n)}function J(){}function Y(n,t){this.__wrapped__=n,this.__actions__=[],this.__chain__=!!t,
this.__index__=0,this.__values__=X}function Ct(n){this.__wrapped__=n,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=Un,this.__views__=[]}function $t(){var n=new Ct(this.__wrapped__);return n.__actions__=Tu(this.__actions__),n.__dir__=this.__dir__,n.__filtered__=this.__filtered__,n.__iteratees__=Tu(this.__iteratees__),n.__takeCount__=this.__takeCount__,n.__views__=Tu(this.__views__),n}function Yt(){if(this.__filtered__){var n=new Ct(this);n.__dir__=-1,
n.__filtered__=!0}else n=this.clone(),n.__dir__*=-1;return n}function Qt(){var n=this.__wrapped__.value(),t=this.__dir__,r=bh(n),e=t<0,u=r?n.length:0,i=Oi(0,u,this.__views__),o=i.start,f=i.end,c=f-o,a=e?f:o-1,l=this.__iteratees__,s=l.length,h=0,p=Hl(c,this.__takeCount__);if(!r||!e&&u==c&&p==c)return wu(n,this.__actions__);var _=[];n:for(;c--&&h<p;){a+=t;for(var v=-1,g=n[a];++v<s;){var y=l[v],d=y.iteratee,b=y.type,w=d(g);if(b==zn)g=w;else if(!w){if(b==Rn)continue n;break n}}_[h++]=g}return _}function Xt(n){
var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function nr(){this.__data__=is?is(null):{},this.size=0}function tr(n){var t=this.has(n)&&delete this.__data__[n];return this.size-=t?1:0,t}function rr(n){var t=this.__data__;if(is){var r=t[n];return r===on?X:r}return bl.call(t,n)?t[n]:X}function er(n){var t=this.__data__;return is?t[n]!==X:bl.call(t,n)}function ur(n,t){var r=this.__data__;return this.size+=this.has(n)?0:1,r[n]=is&&t===X?on:t,this}function ir(n){
var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){var e=n[t];this.set(e[0],e[1])}}function or(){this.__data__=[],this.size=0}function fr(n){var t=this.__data__,r=Wr(t,n);return!(r<0)&&(r==t.length-1?t.pop():Ll.call(t,r,1),--this.size,!0)}function cr(n){var t=this.__data__,r=Wr(t,n);return r<0?X:t[r][1]}function ar(n){return Wr(this.__data__,n)>-1}function lr(n,t){var r=this.__data__,e=Wr(r,n);return e<0?(++this.size,r.push([n,t])):r[e][1]=t,this}function sr(n){var t=-1,r=null==n?0:n.length;for(this.clear();++t<r;){
var e=n[t];this.set(e[0],e[1])}}function hr(){this.size=0,this.__data__={hash:new Xt,map:new(ts||ir),string:new Xt}}function pr(n){var t=xi(this,n).delete(n);return this.size-=t?1:0,t}function _r(n){return xi(this,n).get(n)}function vr(n){return xi(this,n).has(n)}function gr(n,t){var r=xi(this,n),e=r.size;return r.set(n,t),this.size+=r.size==e?0:1,this}function yr(n){var t=-1,r=null==n?0:n.length;for(this.__data__=new sr;++t<r;)this.add(n[t])}function dr(n){return this.__data__.set(n,on),this}function br(n){
return this.__data__.has(n)}function wr(n){this.size=(this.__data__=new ir(n)).size}function mr(){this.__data__=new ir,this.size=0}function xr(n){var t=this.__data__,r=t.delete(n);return this.size=t.size,r}function jr(n){return this.__data__.get(n)}function Ar(n){return this.__data__.has(n)}function kr(n,t){var r=this.__data__;if(r instanceof ir){var e=r.__data__;if(!ts||e.length<tn-1)return e.push([n,t]),this.size=++r.size,this;r=this.__data__=new sr(e)}return r.set(n,t),this.size=r.size,this}function Or(n,t){
var r=bh(n),e=!r&&dh(n),u=!r&&!e&&mh(n),i=!r&&!e&&!u&&Oh(n),o=r||e||u||i,f=o?O(n.length,hl):[],c=f.length;for(var a in n)!t&&!bl.call(n,a)||o&&("length"==a||u&&("offset"==a||"parent"==a)||i&&("buffer"==a||"byteLength"==a||"byteOffset"==a)||Ci(a,c))||f.push(a);return f}function Ir(n){var t=n.length;return t?n[tu(0,t-1)]:X}function Rr(n,t){return Xi(Tu(n),Mr(t,0,n.length))}function zr(n){return Xi(Tu(n))}function Er(n,t,r){(r===X||Gf(n[t],r))&&(r!==X||t in n)||Br(n,t,r)}function Sr(n,t,r){var e=n[t];
bl.call(n,t)&&Gf(e,r)&&(r!==X||t in n)||Br(n,t,r)}function Wr(n,t){for(var r=n.length;r--;)if(Gf(n[r][0],t))return r;return-1}function Lr(n,t,r,e){return ys(n,function(n,u,i){t(e,n,r(n),i)}),e}function Cr(n,t){return n&&$u(t,Pc(t),n)}function Ur(n,t){return n&&$u(t,qc(t),n)}function Br(n,t,r){"__proto__"==t&&Tl?Tl(n,t,{configurable:!0,enumerable:!0,value:r,writable:!0}):n[t]=r}function Tr(n,t){for(var r=-1,e=t.length,u=il(e),i=null==n;++r<e;)u[r]=i?X:Mc(n,t[r]);return u}function Mr(n,t,r){return n===n&&(r!==X&&(n=n<=r?n:r),
t!==X&&(n=n>=t?n:t)),n}function Fr(n,t,e,u,i,o){var f,c=t&an,a=t&ln,l=t&sn;if(e&&(f=i?e(n,u,i,o):e(n)),f!==X)return f;if(!fc(n))return n;var s=bh(n);if(s){if(f=zi(n),!c)return Tu(n,f)}else{var h=zs(n),p=h==Kn||h==Vn;if(mh(n))return Iu(n,c);if(h==Yn||h==Dn||p&&!i){if(f=a||p?{}:Ei(n),!c)return a?Mu(n,Ur(f,n)):Du(n,Cr(f,n))}else{if(!Vr[h])return i?n:{};f=Si(n,h,c)}}o||(o=new wr);var _=o.get(n);if(_)return _;o.set(n,f),kh(n)?n.forEach(function(r){f.add(Fr(r,t,e,r,n,o))}):jh(n)&&n.forEach(function(r,u){
f.set(u,Fr(r,t,e,u,n,o))});var v=l?a?di:yi:a?qc:Pc,g=s?X:v(n);return r(g||n,function(r,u){g&&(u=r,r=n[u]),Sr(f,u,Fr(r,t,e,u,n,o))}),f}function Nr(n){var t=Pc(n);return function(r){return Pr(r,n,t)}}function Pr(n,t,r){var e=r.length;if(null==n)return!e;for(n=ll(n);e--;){var u=r[e],i=t[u],o=n[u];if(o===X&&!(u in n)||!i(o))return!1}return!0}function Gr(n,t,r){if("function"!=typeof n)throw new pl(en);return Ws(function(){n.apply(X,r)},t)}function Hr(n,t,r,e){var u=-1,i=o,a=!0,l=n.length,s=[],h=t.length;
if(!l)return s;r&&(t=c(t,z(r))),e?(i=f,a=!1):t.length>=tn&&(i=S,a=!1,t=new yr(t));n:for(;++u<l;){var p=n[u],_=null==r?p:r(p);if(p=e||0!==p?p:0,a&&_===_){for(var v=h;v--;)if(t[v]===_)continue n;s.push(p)}else i(t,_,e)||s.push(p)}return s}function Jr(n,t){var r=!0;return ys(n,function(n,e,u){return r=!!t(n,e,u)}),r}function Yr(n,t,r){for(var e=-1,u=n.length;++e<u;){var i=n[e],o=t(i);if(null!=o&&(f===X?o===o&&!bc(o):r(o,f)))var f=o,c=i}return c}function ne(n,t,r,e){var u=n.length;for(r=kc(r),r<0&&(r=-r>u?0:u+r),
e=e===X||e>u?u:kc(e),e<0&&(e+=u),e=r>e?0:Oc(e);r<e;)n[r++]=t;return n}function te(n,t){var r=[];return ys(n,function(n,e,u){t(n,e,u)&&r.push(n)}),r}function ee(n,t,r,e,u){var i=-1,o=n.length;for(r||(r=Li),u||(u=[]);++i<o;){var f=n[i];t>0&&r(f)?t>1?ee(f,t-1,r,e,u):a(u,f):e||(u[u.length]=f)}return u}function ue(n,t){return n&&bs(n,t,Pc)}function oe(n,t){return n&&ws(n,t,Pc)}function fe(n,t){return i(t,function(t){return uc(n[t])})}function _e(n,t){t=ku(t,n);for(var r=0,e=t.length;null!=n&&r<e;)n=n[no(t[r++])];
return r&&r==e?n:X}function de(n,t,r){var e=t(n);return bh(n)?e:a(e,r(n))}function we(n){return null==n?n===X?ut:Jn:Bl&&Bl in ll(n)?ki(n):Ki(n)}function me(n,t){return n>t}function xe(n,t){return null!=n&&bl.call(n,t)}function je(n,t){return null!=n&&t in ll(n)}function Ae(n,t,r){return n>=Hl(t,r)&&n<Gl(t,r)}function ke(n,t,r){for(var e=r?f:o,u=n[0].length,i=n.length,a=i,l=il(i),s=1/0,h=[];a--;){var p=n[a];a&&t&&(p=c(p,z(t))),s=Hl(p.length,s),l[a]=!r&&(t||u>=120&&p.length>=120)?new yr(a&&p):X}p=n[0];
var _=-1,v=l[0];n:for(;++_<u&&h.length<s;){var g=p[_],y=t?t(g):g;if(g=r||0!==g?g:0,!(v?S(v,y):e(h,y,r))){for(a=i;--a;){var d=l[a];if(!(d?S(d,y):e(n[a],y,r)))continue n}v&&v.push(y),h.push(g)}}return h}function Oe(n,t,r,e){return ue(n,function(n,u,i){t(e,r(n),u,i)}),e}function Ie(t,r,e){r=ku(r,t),t=Gi(t,r);var u=null==t?t:t[no(jo(r))];return null==u?X:n(u,t,e)}function Re(n){return cc(n)&&we(n)==Dn}function ze(n){return cc(n)&&we(n)==ft}function Ee(n){return cc(n)&&we(n)==Pn}function Se(n,t,r,e,u){
return n===t||(null==n||null==t||!cc(n)&&!cc(t)?n!==n&&t!==t:We(n,t,r,e,Se,u))}function We(n,t,r,e,u,i){var o=bh(n),f=bh(t),c=o?Mn:zs(n),a=f?Mn:zs(t);c=c==Dn?Yn:c,a=a==Dn?Yn:a;var l=c==Yn,s=a==Yn,h=c==a;if(h&&mh(n)){if(!mh(t))return!1;o=!0,l=!1}if(h&&!l)return i||(i=new wr),o||Oh(n)?pi(n,t,r,e,u,i):_i(n,t,c,r,e,u,i);if(!(r&hn)){var p=l&&bl.call(n,"__wrapped__"),_=s&&bl.call(t,"__wrapped__");if(p||_){var v=p?n.value():n,g=_?t.value():t;return i||(i=new wr),u(v,g,r,e,i)}}return!!h&&(i||(i=new wr),vi(n,t,r,e,u,i));
}function Le(n){return cc(n)&&zs(n)==Gn}function Ce(n,t,r,e){var u=r.length,i=u,o=!e;if(null==n)return!i;for(n=ll(n);u--;){var f=r[u];if(o&&f[2]?f[1]!==n[f[0]]:!(f[0]in n))return!1}for(;++u<i;){f=r[u];var c=f[0],a=n[c],l=f[1];if(o&&f[2]){if(a===X&&!(c in n))return!1}else{var s=new wr;if(e)var h=e(a,l,c,n,t,s);if(!(h===X?Se(l,a,hn|pn,e,s):h))return!1}}return!0}function Ue(n){return!(!fc(n)||Di(n))&&(uc(n)?kl:Zt).test(to(n))}function Be(n){return cc(n)&&we(n)==nt}function Te(n){return cc(n)&&zs(n)==tt;
}function $e(n){return cc(n)&&oc(n.length)&&!!Kr[we(n)]}function De(n){return"function"==typeof n?n:null==n?La:"object"==typeof n?bh(n)?Ze(n[0],n[1]):qe(n):Fa(n)}function Me(n){if(!Mi(n))return Vl(n);var t=[];for(var r in ll(n))bl.call(n,r)&&"constructor"!=r&&t.push(r);return t}function Fe(n){if(!fc(n))return Zi(n);var t=Mi(n),r=[];for(var e in n)("constructor"!=e||!t&&bl.call(n,e))&&r.push(e);return r}function Ne(n,t){return n<t}function Pe(n,t){var r=-1,e=Hf(n)?il(n.length):[];return ys(n,function(n,u,i){
e[++r]=t(n,u,i)}),e}function qe(n){var t=ji(n);return 1==t.length&&t[0][2]?Ni(t[0][0],t[0][1]):function(r){return r===n||Ce(r,n,t)}}function Ze(n,t){return Bi(n)&&Fi(t)?Ni(no(n),t):function(r){var e=Mc(r,n);return e===X&&e===t?Nc(r,n):Se(t,e,hn|pn)}}function Ke(n,t,r,e,u){n!==t&&bs(t,function(i,o){if(u||(u=new wr),fc(i))Ve(n,t,o,r,Ke,e,u);else{var f=e?e(Ji(n,o),i,o+"",n,t,u):X;f===X&&(f=i),Er(n,o,f)}},qc)}function Ve(n,t,r,e,u,i,o){var f=Ji(n,r),c=Ji(t,r),a=o.get(c);if(a)return Er(n,r,a),X;var l=i?i(f,c,r+"",n,t,o):X,s=l===X;
if(s){var h=bh(c),p=!h&&mh(c),_=!h&&!p&&Oh(c);l=c,h||p||_?bh(f)?l=f:Jf(f)?l=Tu(f):p?(s=!1,l=Iu(c,!0)):_?(s=!1,l=Wu(c,!0)):l=[]:gc(c)||dh(c)?(l=f,dh(f)?l=Rc(f):fc(f)&&!uc(f)||(l=Ei(c))):s=!1}s&&(o.set(c,l),u(l,c,e,i,o),o.delete(c)),Er(n,r,l)}function Ge(n,t){var r=n.length;if(r)return t+=t<0?r:0,Ci(t,r)?n[t]:X}function He(n,t,r){t=t.length?c(t,function(n){return bh(n)?function(t){return _e(t,1===n.length?n[0]:n)}:n}):[La];var e=-1;return t=c(t,z(mi())),A(Pe(n,function(n,r,u){return{criteria:c(t,function(t){
return t(n)}),index:++e,value:n}}),function(n,t){return Cu(n,t,r)})}function Je(n,t){return Ye(n,t,function(t,r){return Nc(n,r)})}function Ye(n,t,r){for(var e=-1,u=t.length,i={};++e<u;){var o=t[e],f=_e(n,o);r(f,o)&&fu(i,ku(o,n),f)}return i}function Qe(n){return function(t){return _e(t,n)}}function Xe(n,t,r,e){var u=e?d:y,i=-1,o=t.length,f=n;for(n===t&&(t=Tu(t)),r&&(f=c(n,z(r)));++i<o;)for(var a=0,l=t[i],s=r?r(l):l;(a=u(f,s,a,e))>-1;)f!==n&&Ll.call(f,a,1),Ll.call(n,a,1);return n}function nu(n,t){for(var r=n?t.length:0,e=r-1;r--;){
var u=t[r];if(r==e||u!==i){var i=u;Ci(u)?Ll.call(n,u,1):yu(n,u)}}return n}function tu(n,t){return n+Nl(Ql()*(t-n+1))}function ru(n,t,r,e){for(var u=-1,i=Gl(Fl((t-n)/(r||1)),0),o=il(i);i--;)o[e?i:++u]=n,n+=r;return o}function eu(n,t){var r="";if(!n||t<1||t>Wn)return r;do t%2&&(r+=n),t=Nl(t/2),t&&(n+=n);while(t);return r}function uu(n,t){return Ls(Vi(n,t,La),n+"")}function iu(n){return Ir(ra(n))}function ou(n,t){var r=ra(n);return Xi(r,Mr(t,0,r.length))}function fu(n,t,r,e){if(!fc(n))return n;t=ku(t,n);
for(var u=-1,i=t.length,o=i-1,f=n;null!=f&&++u<i;){var c=no(t[u]),a=r;if("__proto__"===c||"constructor"===c||"prototype"===c)return n;if(u!=o){var l=f[c];a=e?e(l,c,f):X,a===X&&(a=fc(l)?l:Ci(t[u+1])?[]:{})}Sr(f,c,a),f=f[c]}return n}function cu(n){return Xi(ra(n))}function au(n,t,r){var e=-1,u=n.length;t<0&&(t=-t>u?0:u+t),r=r>u?u:r,r<0&&(r+=u),u=t>r?0:r-t>>>0,t>>>=0;for(var i=il(u);++e<u;)i[e]=n[e+t];return i}function lu(n,t){var r;return ys(n,function(n,e,u){return r=t(n,e,u),!r}),!!r}function su(n,t,r){
var e=0,u=null==n?e:n.length;if("number"==typeof t&&t===t&&u<=Tn){for(;e<u;){var i=e+u>>>1,o=n[i];null!==o&&!bc(o)&&(r?o<=t:o<t)?e=i+1:u=i}return u}return hu(n,t,La,r)}function hu(n,t,r,e){var u=0,i=null==n?0:n.length;if(0===i)return 0;t=r(t);for(var o=t!==t,f=null===t,c=bc(t),a=t===X;u<i;){var l=Nl((u+i)/2),s=r(n[l]),h=s!==X,p=null===s,_=s===s,v=bc(s);if(o)var g=e||_;else g=a?_&&(e||h):f?_&&h&&(e||!p):c?_&&h&&!p&&(e||!v):!p&&!v&&(e?s<=t:s<t);g?u=l+1:i=l}return Hl(i,Bn)}function pu(n,t){for(var r=-1,e=n.length,u=0,i=[];++r<e;){
var o=n[r],f=t?t(o):o;if(!r||!Gf(f,c)){var c=f;i[u++]=0===o?0:o}}return i}function _u(n){return"number"==typeof n?n:bc(n)?Cn:+n}function vu(n){if("string"==typeof n)return n;if(bh(n))return c(n,vu)+"";if(bc(n))return vs?vs.call(n):"";var t=n+"";return"0"==t&&1/n==-Sn?"-0":t}function gu(n,t,r){var e=-1,u=o,i=n.length,c=!0,a=[],l=a;if(r)c=!1,u=f;else if(i>=tn){var s=t?null:ks(n);if(s)return P(s);c=!1,u=S,l=new yr}else l=t?[]:a;n:for(;++e<i;){var h=n[e],p=t?t(h):h;if(h=r||0!==h?h:0,c&&p===p){for(var _=l.length;_--;)if(l[_]===p)continue n;
t&&l.push(p),a.push(h)}else u(l,p,r)||(l!==a&&l.push(p),a.push(h))}return a}function yu(n,t){return t=ku(t,n),n=Gi(n,t),null==n||delete n[no(jo(t))]}function du(n,t,r,e){return fu(n,t,r(_e(n,t)),e)}function bu(n,t,r,e){for(var u=n.length,i=e?u:-1;(e?i--:++i<u)&&t(n[i],i,n););return r?au(n,e?0:i,e?i+1:u):au(n,e?i+1:0,e?u:i)}function wu(n,t){var r=n;return r instanceof Ct&&(r=r.value()),l(t,function(n,t){return t.func.apply(t.thisArg,a([n],t.args))},r)}function mu(n,t,r){var e=n.length;if(e<2)return e?gu(n[0]):[];
for(var u=-1,i=il(e);++u<e;)for(var o=n[u],f=-1;++f<e;)f!=u&&(i[u]=Hr(i[u]||o,n[f],t,r));return gu(ee(i,1),t,r)}function xu(n,t,r){for(var e=-1,u=n.length,i=t.length,o={};++e<u;){r(o,n[e],e<i?t[e]:X)}return o}function ju(n){return Jf(n)?n:[]}function Au(n){return"function"==typeof n?n:La}function ku(n,t){return bh(n)?n:Bi(n,t)?[n]:Cs(Ec(n))}function Ou(n,t,r){var e=n.length;return r=r===X?e:r,!t&&r>=e?n:au(n,t,r)}function Iu(n,t){if(t)return n.slice();var r=n.length,e=zl?zl(r):new n.constructor(r);
return n.copy(e),e}function Ru(n){var t=new n.constructor(n.byteLength);return new Rl(t).set(new Rl(n)),t}function zu(n,t){return new n.constructor(t?Ru(n.buffer):n.buffer,n.byteOffset,n.byteLength)}function Eu(n){var t=new n.constructor(n.source,Nt.exec(n));return t.lastIndex=n.lastIndex,t}function Su(n){return _s?ll(_s.call(n)):{}}function Wu(n,t){return new n.constructor(t?Ru(n.buffer):n.buffer,n.byteOffset,n.length)}function Lu(n,t){if(n!==t){var r=n!==X,e=null===n,u=n===n,i=bc(n),o=t!==X,f=null===t,c=t===t,a=bc(t);
if(!f&&!a&&!i&&n>t||i&&o&&c&&!f&&!a||e&&o&&c||!r&&c||!u)return 1;if(!e&&!i&&!a&&n<t||a&&r&&u&&!e&&!i||f&&r&&u||!o&&u||!c)return-1}return 0}function Cu(n,t,r){for(var e=-1,u=n.criteria,i=t.criteria,o=u.length,f=r.length;++e<o;){var c=Lu(u[e],i[e]);if(c){if(e>=f)return c;return c*("desc"==r[e]?-1:1)}}return n.index-t.index}function Uu(n,t,r,e){for(var u=-1,i=n.length,o=r.length,f=-1,c=t.length,a=Gl(i-o,0),l=il(c+a),s=!e;++f<c;)l[f]=t[f];for(;++u<o;)(s||u<i)&&(l[r[u]]=n[u]);for(;a--;)l[f++]=n[u++];return l;
}function Bu(n,t,r,e){for(var u=-1,i=n.length,o=-1,f=r.length,c=-1,a=t.length,l=Gl(i-f,0),s=il(l+a),h=!e;++u<l;)s[u]=n[u];for(var p=u;++c<a;)s[p+c]=t[c];for(;++o<f;)(h||u<i)&&(s[p+r[o]]=n[u++]);return s}function Tu(n,t){var r=-1,e=n.length;for(t||(t=il(e));++r<e;)t[r]=n[r];return t}function $u(n,t,r,e){var u=!r;r||(r={});for(var i=-1,o=t.length;++i<o;){var f=t[i],c=e?e(r[f],n[f],f,r,n):X;c===X&&(c=n[f]),u?Br(r,f,c):Sr(r,f,c)}return r}function Du(n,t){return $u(n,Is(n),t)}function Mu(n,t){return $u(n,Rs(n),t);
}function Fu(n,r){return function(e,u){var i=bh(e)?t:Lr,o=r?r():{};return i(e,n,mi(u,2),o)}}function Nu(n){return uu(function(t,r){var e=-1,u=r.length,i=u>1?r[u-1]:X,o=u>2?r[2]:X;for(i=n.length>3&&"function"==typeof i?(u--,i):X,o&&Ui(r[0],r[1],o)&&(i=u<3?X:i,u=1),t=ll(t);++e<u;){var f=r[e];f&&n(t,f,e,i)}return t})}function Pu(n,t){return function(r,e){if(null==r)return r;if(!Hf(r))return n(r,e);for(var u=r.length,i=t?u:-1,o=ll(r);(t?i--:++i<u)&&e(o[i],i,o)!==!1;);return r}}function qu(n){return function(t,r,e){
for(var u=-1,i=ll(t),o=e(t),f=o.length;f--;){var c=o[n?f:++u];if(r(i[c],c,i)===!1)break}return t}}function Zu(n,t,r){function e(){return(this&&this!==re&&this instanceof e?i:n).apply(u?r:this,arguments)}var u=t&_n,i=Gu(n);return e}function Ku(n){return function(t){t=Ec(t);var r=T(t)?G(t):X,e=r?r[0]:t.charAt(0),u=r?Ou(r,1).join(""):t.slice(1);return e[n]()+u}}function Vu(n){return function(t){return l(Ra(ca(t).replace($r,"")),n,"")}}function Gu(n){return function(){var t=arguments;switch(t.length){
case 0:return new n;case 1:return new n(t[0]);case 2:return new n(t[0],t[1]);case 3:return new n(t[0],t[1],t[2]);case 4:return new n(t[0],t[1],t[2],t[3]);case 5:return new n(t[0],t[1],t[2],t[3],t[4]);case 6:return new n(t[0],t[1],t[2],t[3],t[4],t[5]);case 7:return new n(t[0],t[1],t[2],t[3],t[4],t[5],t[6])}var r=gs(n.prototype),e=n.apply(r,t);return fc(e)?e:r}}function Hu(t,r,e){function u(){for(var o=arguments.length,f=il(o),c=o,a=wi(u);c--;)f[c]=arguments[c];var l=o<3&&f[0]!==a&&f[o-1]!==a?[]:N(f,a);
return o-=l.length,o<e?oi(t,r,Qu,u.placeholder,X,f,l,X,X,e-o):n(this&&this!==re&&this instanceof u?i:t,this,f)}var i=Gu(t);return u}function Ju(n){return function(t,r,e){var u=ll(t);if(!Hf(t)){var i=mi(r,3);t=Pc(t),r=function(n){return i(u[n],n,u)}}var o=n(t,r,e);return o>-1?u[i?t[o]:o]:X}}function Yu(n){return gi(function(t){var r=t.length,e=r,u=Y.prototype.thru;for(n&&t.reverse();e--;){var i=t[e];if("function"!=typeof i)throw new pl(en);if(u&&!o&&"wrapper"==bi(i))var o=new Y([],!0)}for(e=o?e:r;++e<r;){
i=t[e];var f=bi(i),c="wrapper"==f?Os(i):X;o=c&&$i(c[0])&&c[1]==(mn|yn|bn|xn)&&!c[4].length&&1==c[9]?o[bi(c[0])].apply(o,c[3]):1==i.length&&$i(i)?o[f]():o.thru(i)}return function(){var n=arguments,e=n[0];if(o&&1==n.length&&bh(e))return o.plant(e).value();for(var u=0,i=r?t[u].apply(this,n):e;++u<r;)i=t[u].call(this,i);return i}})}function Qu(n,t,r,e,u,i,o,f,c,a){function l(){for(var y=arguments.length,d=il(y),b=y;b--;)d[b]=arguments[b];if(_)var w=wi(l),m=C(d,w);if(e&&(d=Uu(d,e,u,_)),i&&(d=Bu(d,i,o,_)),
y-=m,_&&y<a){return oi(n,t,Qu,l.placeholder,r,d,N(d,w),f,c,a-y)}var x=h?r:this,j=p?x[n]:n;return y=d.length,f?d=Hi(d,f):v&&y>1&&d.reverse(),s&&c<y&&(d.length=c),this&&this!==re&&this instanceof l&&(j=g||Gu(j)),j.apply(x,d)}var s=t&mn,h=t&_n,p=t&vn,_=t&(yn|dn),v=t&jn,g=p?X:Gu(n);return l}function Xu(n,t){return function(r,e){return Oe(r,n,t(e),{})}}function ni(n,t){return function(r,e){var u;if(r===X&&e===X)return t;if(r!==X&&(u=r),e!==X){if(u===X)return e;"string"==typeof r||"string"==typeof e?(r=vu(r),
e=vu(e)):(r=_u(r),e=_u(e)),u=n(r,e)}return u}}function ti(t){return gi(function(r){return r=c(r,z(mi())),uu(function(e){var u=this;return t(r,function(t){return n(t,u,e)})})})}function ri(n,t){t=t===X?" ":vu(t);var r=t.length;if(r<2)return r?eu(t,n):t;var e=eu(t,Fl(n/V(t)));return T(t)?Ou(G(e),0,n).join(""):e.slice(0,n)}function ei(t,r,e,u){function i(){for(var r=-1,c=arguments.length,a=-1,l=u.length,s=il(l+c),h=this&&this!==re&&this instanceof i?f:t;++a<l;)s[a]=u[a];for(;c--;)s[a++]=arguments[++r];
return n(h,o?e:this,s)}var o=r&_n,f=Gu(t);return i}function ui(n){return function(t,r,e){return e&&"number"!=typeof e&&Ui(t,r,e)&&(r=e=X),t=Ac(t),r===X?(r=t,t=0):r=Ac(r),e=e===X?t<r?1:-1:Ac(e),ru(t,r,e,n)}}function ii(n){return function(t,r){return"string"==typeof t&&"string"==typeof r||(t=Ic(t),r=Ic(r)),n(t,r)}}function oi(n,t,r,e,u,i,o,f,c,a){var l=t&yn,s=l?o:X,h=l?X:o,p=l?i:X,_=l?X:i;t|=l?bn:wn,t&=~(l?wn:bn),t&gn||(t&=~(_n|vn));var v=[n,t,u,p,s,_,h,f,c,a],g=r.apply(X,v);return $i(n)&&Ss(g,v),g.placeholder=e,
Yi(g,n,t)}function fi(n){var t=al[n];return function(n,r){if(n=Ic(n),r=null==r?0:Hl(kc(r),292),r&&Zl(n)){var e=(Ec(n)+"e").split("e");return e=(Ec(t(e[0]+"e"+(+e[1]+r)))+"e").split("e"),+(e[0]+"e"+(+e[1]-r))}return t(n)}}function ci(n){return function(t){var r=zs(t);return r==Gn?M(t):r==tt?q(t):I(t,n(t))}}function ai(n,t,r,e,u,i,o,f){var c=t&vn;if(!c&&"function"!=typeof n)throw new pl(en);var a=e?e.length:0;if(a||(t&=~(bn|wn),e=u=X),o=o===X?o:Gl(kc(o),0),f=f===X?f:kc(f),a-=u?u.length:0,t&wn){var l=e,s=u;
e=u=X}var h=c?X:Os(n),p=[n,t,r,e,u,l,s,i,o,f];if(h&&qi(p,h),n=p[0],t=p[1],r=p[2],e=p[3],u=p[4],f=p[9]=p[9]===X?c?0:n.length:Gl(p[9]-a,0),!f&&t&(yn|dn)&&(t&=~(yn|dn)),t&&t!=_n)_=t==yn||t==dn?Hu(n,t,f):t!=bn&&t!=(_n|bn)||u.length?Qu.apply(X,p):ei(n,t,r,e);else var _=Zu(n,t,r);return Yi((h?ms:Ss)(_,p),n,t)}function li(n,t,r,e){return n===X||Gf(n,gl[r])&&!bl.call(e,r)?t:n}function si(n,t,r,e,u,i){return fc(n)&&fc(t)&&(i.set(t,n),Ke(n,t,X,si,i),i.delete(t)),n}function hi(n){return gc(n)?X:n}function pi(n,t,r,e,u,i){
var o=r&hn,f=n.length,c=t.length;if(f!=c&&!(o&&c>f))return!1;var a=i.get(n),l=i.get(t);if(a&&l)return a==t&&l==n;var s=-1,p=!0,_=r&pn?new yr:X;for(i.set(n,t),i.set(t,n);++s<f;){var v=n[s],g=t[s];if(e)var y=o?e(g,v,s,t,n,i):e(v,g,s,n,t,i);if(y!==X){if(y)continue;p=!1;break}if(_){if(!h(t,function(n,t){if(!S(_,t)&&(v===n||u(v,n,r,e,i)))return _.push(t)})){p=!1;break}}else if(v!==g&&!u(v,g,r,e,i)){p=!1;break}}return i.delete(n),i.delete(t),p}function _i(n,t,r,e,u,i,o){switch(r){case ct:if(n.byteLength!=t.byteLength||n.byteOffset!=t.byteOffset)return!1;
n=n.buffer,t=t.buffer;case ft:return!(n.byteLength!=t.byteLength||!i(new Rl(n),new Rl(t)));case Nn:case Pn:case Hn:return Gf(+n,+t);case Zn:return n.name==t.name&&n.message==t.message;case nt:case rt:return n==t+"";case Gn:var f=M;case tt:var c=e&hn;if(f||(f=P),n.size!=t.size&&!c)return!1;var a=o.get(n);if(a)return a==t;e|=pn,o.set(n,t);var l=pi(f(n),f(t),e,u,i,o);return o.delete(n),l;case et:if(_s)return _s.call(n)==_s.call(t)}return!1}function vi(n,t,r,e,u,i){var o=r&hn,f=yi(n),c=f.length;if(c!=yi(t).length&&!o)return!1;
for(var a=c;a--;){var l=f[a];if(!(o?l in t:bl.call(t,l)))return!1}var s=i.get(n),h=i.get(t);if(s&&h)return s==t&&h==n;var p=!0;i.set(n,t),i.set(t,n);for(var _=o;++a<c;){l=f[a];var v=n[l],g=t[l];if(e)var y=o?e(g,v,l,t,n,i):e(v,g,l,n,t,i);if(!(y===X?v===g||u(v,g,r,e,i):y)){p=!1;break}_||(_="constructor"==l)}if(p&&!_){var d=n.constructor,b=t.constructor;d!=b&&"constructor"in n&&"constructor"in t&&!("function"==typeof d&&d instanceof d&&"function"==typeof b&&b instanceof b)&&(p=!1)}return i.delete(n),
i.delete(t),p}function gi(n){return Ls(Vi(n,X,_o),n+"")}function yi(n){return de(n,Pc,Is)}function di(n){return de(n,qc,Rs)}function bi(n){for(var t=n.name+"",r=fs[t],e=bl.call(fs,t)?r.length:0;e--;){var u=r[e],i=u.func;if(null==i||i==n)return u.name}return t}function wi(n){return(bl.call(Z,"placeholder")?Z:n).placeholder}function mi(){var n=Z.iteratee||Ca;return n=n===Ca?De:n,arguments.length?n(arguments[0],arguments[1]):n}function xi(n,t){var r=n.__data__;return Ti(t)?r["string"==typeof t?"string":"hash"]:r.map;
}function ji(n){for(var t=Pc(n),r=t.length;r--;){var e=t[r],u=n[e];t[r]=[e,u,Fi(u)]}return t}function Ai(n,t){var r=B(n,t);return Ue(r)?r:X}function ki(n){var t=bl.call(n,Bl),r=n[Bl];try{n[Bl]=X;var e=!0}catch(n){}var u=xl.call(n);return e&&(t?n[Bl]=r:delete n[Bl]),u}function Oi(n,t,r){for(var e=-1,u=r.length;++e<u;){var i=r[e],o=i.size;switch(i.type){case"drop":n+=o;break;case"dropRight":t-=o;break;case"take":t=Hl(t,n+o);break;case"takeRight":n=Gl(n,t-o)}}return{start:n,end:t}}function Ii(n){var t=n.match(Bt);
return t?t[1].split(Tt):[]}function Ri(n,t,r){t=ku(t,n);for(var e=-1,u=t.length,i=!1;++e<u;){var o=no(t[e]);if(!(i=null!=n&&r(n,o)))break;n=n[o]}return i||++e!=u?i:(u=null==n?0:n.length,!!u&&oc(u)&&Ci(o,u)&&(bh(n)||dh(n)))}function zi(n){var t=n.length,r=new n.constructor(t);return t&&"string"==typeof n[0]&&bl.call(n,"index")&&(r.index=n.index,r.input=n.input),r}function Ei(n){return"function"!=typeof n.constructor||Mi(n)?{}:gs(El(n))}function Si(n,t,r){var e=n.constructor;switch(t){case ft:return Ru(n);
case Nn:case Pn:return new e(+n);case ct:return zu(n,r);case at:case lt:case st:case ht:case pt:case _t:case vt:case gt:case yt:return Wu(n,r);case Gn:return new e;case Hn:case rt:return new e(n);case nt:return Eu(n);case tt:return new e;case et:return Su(n)}}function Wi(n,t){var r=t.length;if(!r)return n;var e=r-1;return t[e]=(r>1?"& ":"")+t[e],t=t.join(r>2?", ":" "),n.replace(Ut,"{\n/* [wrapped with "+t+"] */\n")}function Li(n){return bh(n)||dh(n)||!!(Cl&&n&&n[Cl])}function Ci(n,t){var r=typeof n;
return t=null==t?Wn:t,!!t&&("number"==r||"symbol"!=r&&Vt.test(n))&&n>-1&&n%1==0&&n<t}function Ui(n,t,r){if(!fc(r))return!1;var e=typeof t;return!!("number"==e?Hf(r)&&Ci(t,r.length):"string"==e&&t in r)&&Gf(r[t],n)}function Bi(n,t){if(bh(n))return!1;var r=typeof n;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=n&&!bc(n))||(zt.test(n)||!Rt.test(n)||null!=t&&n in ll(t))}function Ti(n){var t=typeof n;return"string"==t||"number"==t||"symbol"==t||"boolean"==t?"__proto__"!==n:null===n}function $i(n){
var t=bi(n),r=Z[t];if("function"!=typeof r||!(t in Ct.prototype))return!1;if(n===r)return!0;var e=Os(r);return!!e&&n===e[0]}function Di(n){return!!ml&&ml in n}function Mi(n){var t=n&&n.constructor;return n===("function"==typeof t&&t.prototype||gl)}function Fi(n){return n===n&&!fc(n)}function Ni(n,t){return function(r){return null!=r&&(r[n]===t&&(t!==X||n in ll(r)))}}function Pi(n){var t=Cf(n,function(n){return r.size===fn&&r.clear(),n}),r=t.cache;return t}function qi(n,t){var r=n[1],e=t[1],u=r|e,i=u<(_n|vn|mn),o=e==mn&&r==yn||e==mn&&r==xn&&n[7].length<=t[8]||e==(mn|xn)&&t[7].length<=t[8]&&r==yn;
if(!i&&!o)return n;e&_n&&(n[2]=t[2],u|=r&_n?0:gn);var f=t[3];if(f){var c=n[3];n[3]=c?Uu(c,f,t[4]):f,n[4]=c?N(n[3],cn):t[4]}return f=t[5],f&&(c=n[5],n[5]=c?Bu(c,f,t[6]):f,n[6]=c?N(n[5],cn):t[6]),f=t[7],f&&(n[7]=f),e&mn&&(n[8]=null==n[8]?t[8]:Hl(n[8],t[8])),null==n[9]&&(n[9]=t[9]),n[0]=t[0],n[1]=u,n}function Zi(n){var t=[];if(null!=n)for(var r in ll(n))t.push(r);return t}function Ki(n){return xl.call(n)}function Vi(t,r,e){return r=Gl(r===X?t.length-1:r,0),function(){for(var u=arguments,i=-1,o=Gl(u.length-r,0),f=il(o);++i<o;)f[i]=u[r+i];
i=-1;for(var c=il(r+1);++i<r;)c[i]=u[i];return c[r]=e(f),n(t,this,c)}}function Gi(n,t){return t.length<2?n:_e(n,au(t,0,-1))}function Hi(n,t){for(var r=n.length,e=Hl(t.length,r),u=Tu(n);e--;){var i=t[e];n[e]=Ci(i,r)?u[i]:X}return n}function Ji(n,t){if(("constructor"!==t||"function"!=typeof n[t])&&"__proto__"!=t)return n[t]}function Yi(n,t,r){var e=t+"";return Ls(n,Wi(e,ro(Ii(e),r)))}function Qi(n){var t=0,r=0;return function(){var e=Jl(),u=In-(e-r);if(r=e,u>0){if(++t>=On)return arguments[0]}else t=0;
return n.apply(X,arguments)}}function Xi(n,t){var r=-1,e=n.length,u=e-1;for(t=t===X?e:t;++r<t;){var i=tu(r,u),o=n[i];n[i]=n[r],n[r]=o}return n.length=t,n}function no(n){if("string"==typeof n||bc(n))return n;var t=n+"";return"0"==t&&1/n==-Sn?"-0":t}function to(n){if(null!=n){try{return dl.call(n)}catch(n){}try{return n+""}catch(n){}}return""}function ro(n,t){return r($n,function(r){var e="_."+r[0];t&r[1]&&!o(n,e)&&n.push(e)}),n.sort()}function eo(n){if(n instanceof Ct)return n.clone();var t=new Y(n.__wrapped__,n.__chain__);
return t.__actions__=Tu(n.__actions__),t.__index__=n.__index__,t.__values__=n.__values__,t}function uo(n,t,r){t=(r?Ui(n,t,r):t===X)?1:Gl(kc(t),0);var e=null==n?0:n.length;if(!e||t<1)return[];for(var u=0,i=0,o=il(Fl(e/t));u<e;)o[i++]=au(n,u,u+=t);return o}function io(n){for(var t=-1,r=null==n?0:n.length,e=0,u=[];++t<r;){var i=n[t];i&&(u[e++]=i)}return u}function oo(){var n=arguments.length;if(!n)return[];for(var t=il(n-1),r=arguments[0],e=n;e--;)t[e-1]=arguments[e];return a(bh(r)?Tu(r):[r],ee(t,1));
}function fo(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===X?1:kc(t),au(n,t<0?0:t,e)):[]}function co(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===X?1:kc(t),t=e-t,au(n,0,t<0?0:t)):[]}function ao(n,t){return n&&n.length?bu(n,mi(t,3),!0,!0):[]}function lo(n,t){return n&&n.length?bu(n,mi(t,3),!0):[]}function so(n,t,r,e){var u=null==n?0:n.length;return u?(r&&"number"!=typeof r&&Ui(n,t,r)&&(r=0,e=u),ne(n,t,r,e)):[]}function ho(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=null==r?0:kc(r);
return u<0&&(u=Gl(e+u,0)),g(n,mi(t,3),u)}function po(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e-1;return r!==X&&(u=kc(r),u=r<0?Gl(e+u,0):Hl(u,e-1)),g(n,mi(t,3),u,!0)}function _o(n){return(null==n?0:n.length)?ee(n,1):[]}function vo(n){return(null==n?0:n.length)?ee(n,Sn):[]}function go(n,t){return(null==n?0:n.length)?(t=t===X?1:kc(t),ee(n,t)):[]}function yo(n){for(var t=-1,r=null==n?0:n.length,e={};++t<r;){var u=n[t];e[u[0]]=u[1]}return e}function bo(n){return n&&n.length?n[0]:X}function wo(n,t,r){
var e=null==n?0:n.length;if(!e)return-1;var u=null==r?0:kc(r);return u<0&&(u=Gl(e+u,0)),y(n,t,u)}function mo(n){return(null==n?0:n.length)?au(n,0,-1):[]}function xo(n,t){return null==n?"":Kl.call(n,t)}function jo(n){var t=null==n?0:n.length;return t?n[t-1]:X}function Ao(n,t,r){var e=null==n?0:n.length;if(!e)return-1;var u=e;return r!==X&&(u=kc(r),u=u<0?Gl(e+u,0):Hl(u,e-1)),t===t?K(n,t,u):g(n,b,u,!0)}function ko(n,t){return n&&n.length?Ge(n,kc(t)):X}function Oo(n,t){return n&&n.length&&t&&t.length?Xe(n,t):n;
}function Io(n,t,r){return n&&n.length&&t&&t.length?Xe(n,t,mi(r,2)):n}function Ro(n,t,r){return n&&n.length&&t&&t.length?Xe(n,t,X,r):n}function zo(n,t){var r=[];if(!n||!n.length)return r;var e=-1,u=[],i=n.length;for(t=mi(t,3);++e<i;){var o=n[e];t(o,e,n)&&(r.push(o),u.push(e))}return nu(n,u),r}function Eo(n){return null==n?n:Xl.call(n)}function So(n,t,r){var e=null==n?0:n.length;return e?(r&&"number"!=typeof r&&Ui(n,t,r)?(t=0,r=e):(t=null==t?0:kc(t),r=r===X?e:kc(r)),au(n,t,r)):[]}function Wo(n,t){
return su(n,t)}function Lo(n,t,r){return hu(n,t,mi(r,2))}function Co(n,t){var r=null==n?0:n.length;if(r){var e=su(n,t);if(e<r&&Gf(n[e],t))return e}return-1}function Uo(n,t){return su(n,t,!0)}function Bo(n,t,r){return hu(n,t,mi(r,2),!0)}function To(n,t){if(null==n?0:n.length){var r=su(n,t,!0)-1;if(Gf(n[r],t))return r}return-1}function $o(n){return n&&n.length?pu(n):[]}function Do(n,t){return n&&n.length?pu(n,mi(t,2)):[]}function Mo(n){var t=null==n?0:n.length;return t?au(n,1,t):[]}function Fo(n,t,r){
return n&&n.length?(t=r||t===X?1:kc(t),au(n,0,t<0?0:t)):[]}function No(n,t,r){var e=null==n?0:n.length;return e?(t=r||t===X?1:kc(t),t=e-t,au(n,t<0?0:t,e)):[]}function Po(n,t){return n&&n.length?bu(n,mi(t,3),!1,!0):[]}function qo(n,t){return n&&n.length?bu(n,mi(t,3)):[]}function Zo(n){return n&&n.length?gu(n):[]}function Ko(n,t){return n&&n.length?gu(n,mi(t,2)):[]}function Vo(n,t){return t="function"==typeof t?t:X,n&&n.length?gu(n,X,t):[]}function Go(n){if(!n||!n.length)return[];var t=0;return n=i(n,function(n){
if(Jf(n))return t=Gl(n.length,t),!0}),O(t,function(t){return c(n,m(t))})}function Ho(t,r){if(!t||!t.length)return[];var e=Go(t);return null==r?e:c(e,function(t){return n(r,X,t)})}function Jo(n,t){return xu(n||[],t||[],Sr)}function Yo(n,t){return xu(n||[],t||[],fu)}function Qo(n){var t=Z(n);return t.__chain__=!0,t}function Xo(n,t){return t(n),n}function nf(n,t){return t(n)}function tf(){return Qo(this)}function rf(){return new Y(this.value(),this.__chain__)}function ef(){this.__values__===X&&(this.__values__=jc(this.value()));
var n=this.__index__>=this.__values__.length;return{done:n,value:n?X:this.__values__[this.__index__++]}}function uf(){return this}function of(n){for(var t,r=this;r instanceof J;){var e=eo(r);e.__index__=0,e.__values__=X,t?u.__wrapped__=e:t=e;var u=e;r=r.__wrapped__}return u.__wrapped__=n,t}function ff(){var n=this.__wrapped__;if(n instanceof Ct){var t=n;return this.__actions__.length&&(t=new Ct(this)),t=t.reverse(),t.__actions__.push({func:nf,args:[Eo],thisArg:X}),new Y(t,this.__chain__)}return this.thru(Eo);
}function cf(){return wu(this.__wrapped__,this.__actions__)}function af(n,t,r){var e=bh(n)?u:Jr;return r&&Ui(n,t,r)&&(t=X),e(n,mi(t,3))}function lf(n,t){return(bh(n)?i:te)(n,mi(t,3))}function sf(n,t){return ee(yf(n,t),1)}function hf(n,t){return ee(yf(n,t),Sn)}function pf(n,t,r){return r=r===X?1:kc(r),ee(yf(n,t),r)}function _f(n,t){return(bh(n)?r:ys)(n,mi(t,3))}function vf(n,t){return(bh(n)?e:ds)(n,mi(t,3))}function gf(n,t,r,e){n=Hf(n)?n:ra(n),r=r&&!e?kc(r):0;var u=n.length;return r<0&&(r=Gl(u+r,0)),
dc(n)?r<=u&&n.indexOf(t,r)>-1:!!u&&y(n,t,r)>-1}function yf(n,t){return(bh(n)?c:Pe)(n,mi(t,3))}function df(n,t,r,e){return null==n?[]:(bh(t)||(t=null==t?[]:[t]),r=e?X:r,bh(r)||(r=null==r?[]:[r]),He(n,t,r))}function bf(n,t,r){var e=bh(n)?l:j,u=arguments.length<3;return e(n,mi(t,4),r,u,ys)}function wf(n,t,r){var e=bh(n)?s:j,u=arguments.length<3;return e(n,mi(t,4),r,u,ds)}function mf(n,t){return(bh(n)?i:te)(n,Uf(mi(t,3)))}function xf(n){return(bh(n)?Ir:iu)(n)}function jf(n,t,r){return t=(r?Ui(n,t,r):t===X)?1:kc(t),
(bh(n)?Rr:ou)(n,t)}function Af(n){return(bh(n)?zr:cu)(n)}function kf(n){if(null==n)return 0;if(Hf(n))return dc(n)?V(n):n.length;var t=zs(n);return t==Gn||t==tt?n.size:Me(n).length}function Of(n,t,r){var e=bh(n)?h:lu;return r&&Ui(n,t,r)&&(t=X),e(n,mi(t,3))}function If(n,t){if("function"!=typeof t)throw new pl(en);return n=kc(n),function(){if(--n<1)return t.apply(this,arguments)}}function Rf(n,t,r){return t=r?X:t,t=n&&null==t?n.length:t,ai(n,mn,X,X,X,X,t)}function zf(n,t){var r;if("function"!=typeof t)throw new pl(en);
return n=kc(n),function(){return--n>0&&(r=t.apply(this,arguments)),n<=1&&(t=X),r}}function Ef(n,t,r){t=r?X:t;var e=ai(n,yn,X,X,X,X,X,t);return e.placeholder=Ef.placeholder,e}function Sf(n,t,r){t=r?X:t;var e=ai(n,dn,X,X,X,X,X,t);return e.placeholder=Sf.placeholder,e}function Wf(n,t,r){function e(t){var r=h,e=p;return h=p=X,d=t,v=n.apply(e,r)}function u(n){return d=n,g=Ws(f,t),b?e(n):v}function i(n){var r=n-y,e=n-d,u=t-r;return w?Hl(u,_-e):u}function o(n){var r=n-y,e=n-d;return y===X||r>=t||r<0||w&&e>=_;
}function f(){var n=fh();return o(n)?c(n):(g=Ws(f,i(n)),X)}function c(n){return g=X,m&&h?e(n):(h=p=X,v)}function a(){g!==X&&As(g),d=0,h=y=p=g=X}function l(){return g===X?v:c(fh())}function s(){var n=fh(),r=o(n);if(h=arguments,p=this,y=n,r){if(g===X)return u(y);if(w)return As(g),g=Ws(f,t),e(y)}return g===X&&(g=Ws(f,t)),v}var h,p,_,v,g,y,d=0,b=!1,w=!1,m=!0;if("function"!=typeof n)throw new pl(en);return t=Ic(t)||0,fc(r)&&(b=!!r.leading,w="maxWait"in r,_=w?Gl(Ic(r.maxWait)||0,t):_,m="trailing"in r?!!r.trailing:m),
s.cancel=a,s.flush=l,s}function Lf(n){return ai(n,jn)}function Cf(n,t){if("function"!=typeof n||null!=t&&"function"!=typeof t)throw new pl(en);var r=function(){var e=arguments,u=t?t.apply(this,e):e[0],i=r.cache;if(i.has(u))return i.get(u);var o=n.apply(this,e);return r.cache=i.set(u,o)||i,o};return r.cache=new(Cf.Cache||sr),r}function Uf(n){if("function"!=typeof n)throw new pl(en);return function(){var t=arguments;switch(t.length){case 0:return!n.call(this);case 1:return!n.call(this,t[0]);case 2:
return!n.call(this,t[0],t[1]);case 3:return!n.call(this,t[0],t[1],t[2])}return!n.apply(this,t)}}function Bf(n){return zf(2,n)}function Tf(n,t){if("function"!=typeof n)throw new pl(en);return t=t===X?t:kc(t),uu(n,t)}function $f(t,r){if("function"!=typeof t)throw new pl(en);return r=null==r?0:Gl(kc(r),0),uu(function(e){var u=e[r],i=Ou(e,0,r);return u&&a(i,u),n(t,this,i)})}function Df(n,t,r){var e=!0,u=!0;if("function"!=typeof n)throw new pl(en);return fc(r)&&(e="leading"in r?!!r.leading:e,u="trailing"in r?!!r.trailing:u),
Wf(n,t,{leading:e,maxWait:t,trailing:u})}function Mf(n){return Rf(n,1)}function Ff(n,t){return ph(Au(t),n)}function Nf(){if(!arguments.length)return[];var n=arguments[0];return bh(n)?n:[n]}function Pf(n){return Fr(n,sn)}function qf(n,t){return t="function"==typeof t?t:X,Fr(n,sn,t)}function Zf(n){return Fr(n,an|sn)}function Kf(n,t){return t="function"==typeof t?t:X,Fr(n,an|sn,t)}function Vf(n,t){return null==t||Pr(n,t,Pc(t))}function Gf(n,t){return n===t||n!==n&&t!==t}function Hf(n){return null!=n&&oc(n.length)&&!uc(n);
}function Jf(n){return cc(n)&&Hf(n)}function Yf(n){return n===!0||n===!1||cc(n)&&we(n)==Nn}function Qf(n){return cc(n)&&1===n.nodeType&&!gc(n)}function Xf(n){if(null==n)return!0;if(Hf(n)&&(bh(n)||"string"==typeof n||"function"==typeof n.splice||mh(n)||Oh(n)||dh(n)))return!n.length;var t=zs(n);if(t==Gn||t==tt)return!n.size;if(Mi(n))return!Me(n).length;for(var r in n)if(bl.call(n,r))return!1;return!0}function nc(n,t){return Se(n,t)}function tc(n,t,r){r="function"==typeof r?r:X;var e=r?r(n,t):X;return e===X?Se(n,t,X,r):!!e;
}function rc(n){if(!cc(n))return!1;var t=we(n);return t==Zn||t==qn||"string"==typeof n.message&&"string"==typeof n.name&&!gc(n)}function ec(n){return"number"==typeof n&&Zl(n)}function uc(n){if(!fc(n))return!1;var t=we(n);return t==Kn||t==Vn||t==Fn||t==Xn}function ic(n){return"number"==typeof n&&n==kc(n)}function oc(n){return"number"==typeof n&&n>-1&&n%1==0&&n<=Wn}function fc(n){var t=typeof n;return null!=n&&("object"==t||"function"==t)}function cc(n){return null!=n&&"object"==typeof n}function ac(n,t){
return n===t||Ce(n,t,ji(t))}function lc(n,t,r){return r="function"==typeof r?r:X,Ce(n,t,ji(t),r)}function sc(n){return vc(n)&&n!=+n}function hc(n){if(Es(n))throw new fl(rn);return Ue(n)}function pc(n){return null===n}function _c(n){return null==n}function vc(n){return"number"==typeof n||cc(n)&&we(n)==Hn}function gc(n){if(!cc(n)||we(n)!=Yn)return!1;var t=El(n);if(null===t)return!0;var r=bl.call(t,"constructor")&&t.constructor;return"function"==typeof r&&r instanceof r&&dl.call(r)==jl}function yc(n){
return ic(n)&&n>=-Wn&&n<=Wn}function dc(n){return"string"==typeof n||!bh(n)&&cc(n)&&we(n)==rt}function bc(n){return"symbol"==typeof n||cc(n)&&we(n)==et}function wc(n){return n===X}function mc(n){return cc(n)&&zs(n)==it}function xc(n){return cc(n)&&we(n)==ot}function jc(n){if(!n)return[];if(Hf(n))return dc(n)?G(n):Tu(n);if(Ul&&n[Ul])return D(n[Ul]());var t=zs(n);return(t==Gn?M:t==tt?P:ra)(n)}function Ac(n){if(!n)return 0===n?n:0;if(n=Ic(n),n===Sn||n===-Sn){return(n<0?-1:1)*Ln}return n===n?n:0}function kc(n){
var t=Ac(n),r=t%1;return t===t?r?t-r:t:0}function Oc(n){return n?Mr(kc(n),0,Un):0}function Ic(n){if("number"==typeof n)return n;if(bc(n))return Cn;if(fc(n)){var t="function"==typeof n.valueOf?n.valueOf():n;n=fc(t)?t+"":t}if("string"!=typeof n)return 0===n?n:+n;n=R(n);var r=qt.test(n);return r||Kt.test(n)?Xr(n.slice(2),r?2:8):Pt.test(n)?Cn:+n}function Rc(n){return $u(n,qc(n))}function zc(n){return n?Mr(kc(n),-Wn,Wn):0===n?n:0}function Ec(n){return null==n?"":vu(n)}function Sc(n,t){var r=gs(n);return null==t?r:Cr(r,t);
}function Wc(n,t){return v(n,mi(t,3),ue)}function Lc(n,t){return v(n,mi(t,3),oe)}function Cc(n,t){return null==n?n:bs(n,mi(t,3),qc)}function Uc(n,t){return null==n?n:ws(n,mi(t,3),qc)}function Bc(n,t){return n&&ue(n,mi(t,3))}function Tc(n,t){return n&&oe(n,mi(t,3))}function $c(n){return null==n?[]:fe(n,Pc(n))}function Dc(n){return null==n?[]:fe(n,qc(n))}function Mc(n,t,r){var e=null==n?X:_e(n,t);return e===X?r:e}function Fc(n,t){return null!=n&&Ri(n,t,xe)}function Nc(n,t){return null!=n&&Ri(n,t,je);
}function Pc(n){return Hf(n)?Or(n):Me(n)}function qc(n){return Hf(n)?Or(n,!0):Fe(n)}function Zc(n,t){var r={};return t=mi(t,3),ue(n,function(n,e,u){Br(r,t(n,e,u),n)}),r}function Kc(n,t){var r={};return t=mi(t,3),ue(n,function(n,e,u){Br(r,e,t(n,e,u))}),r}function Vc(n,t){return Gc(n,Uf(mi(t)))}function Gc(n,t){if(null==n)return{};var r=c(di(n),function(n){return[n]});return t=mi(t),Ye(n,r,function(n,r){return t(n,r[0])})}function Hc(n,t,r){t=ku(t,n);var e=-1,u=t.length;for(u||(u=1,n=X);++e<u;){var i=null==n?X:n[no(t[e])];
i===X&&(e=u,i=r),n=uc(i)?i.call(n):i}return n}function Jc(n,t,r){return null==n?n:fu(n,t,r)}function Yc(n,t,r,e){return e="function"==typeof e?e:X,null==n?n:fu(n,t,r,e)}function Qc(n,t,e){var u=bh(n),i=u||mh(n)||Oh(n);if(t=mi(t,4),null==e){var o=n&&n.constructor;e=i?u?new o:[]:fc(n)&&uc(o)?gs(El(n)):{}}return(i?r:ue)(n,function(n,r,u){return t(e,n,r,u)}),e}function Xc(n,t){return null==n||yu(n,t)}function na(n,t,r){return null==n?n:du(n,t,Au(r))}function ta(n,t,r,e){return e="function"==typeof e?e:X,
null==n?n:du(n,t,Au(r),e)}function ra(n){return null==n?[]:E(n,Pc(n))}function ea(n){return null==n?[]:E(n,qc(n))}function ua(n,t,r){return r===X&&(r=t,t=X),r!==X&&(r=Ic(r),r=r===r?r:0),t!==X&&(t=Ic(t),t=t===t?t:0),Mr(Ic(n),t,r)}function ia(n,t,r){return t=Ac(t),r===X?(r=t,t=0):r=Ac(r),n=Ic(n),Ae(n,t,r)}function oa(n,t,r){if(r&&"boolean"!=typeof r&&Ui(n,t,r)&&(t=r=X),r===X&&("boolean"==typeof t?(r=t,t=X):"boolean"==typeof n&&(r=n,n=X)),n===X&&t===X?(n=0,t=1):(n=Ac(n),t===X?(t=n,n=0):t=Ac(t)),n>t){
var e=n;n=t,t=e}if(r||n%1||t%1){var u=Ql();return Hl(n+u*(t-n+Qr("1e-"+((u+"").length-1))),t)}return tu(n,t)}function fa(n){return Qh(Ec(n).toLowerCase())}function ca(n){return n=Ec(n),n&&n.replace(Gt,ve).replace(Dr,"")}function aa(n,t,r){n=Ec(n),t=vu(t);var e=n.length;r=r===X?e:Mr(kc(r),0,e);var u=r;return r-=t.length,r>=0&&n.slice(r,u)==t}function la(n){return n=Ec(n),n&&At.test(n)?n.replace(xt,ge):n}function sa(n){return n=Ec(n),n&&Wt.test(n)?n.replace(St,"\\$&"):n}function ha(n,t,r){n=Ec(n),t=kc(t);
var e=t?V(n):0;if(!t||e>=t)return n;var u=(t-e)/2;return ri(Nl(u),r)+n+ri(Fl(u),r)}function pa(n,t,r){n=Ec(n),t=kc(t);var e=t?V(n):0;return t&&e<t?n+ri(t-e,r):n}function _a(n,t,r){n=Ec(n),t=kc(t);var e=t?V(n):0;return t&&e<t?ri(t-e,r)+n:n}function va(n,t,r){return r||null==t?t=0:t&&(t=+t),Yl(Ec(n).replace(Lt,""),t||0)}function ga(n,t,r){return t=(r?Ui(n,t,r):t===X)?1:kc(t),eu(Ec(n),t)}function ya(){var n=arguments,t=Ec(n[0]);return n.length<3?t:t.replace(n[1],n[2])}function da(n,t,r){return r&&"number"!=typeof r&&Ui(n,t,r)&&(t=r=X),
(r=r===X?Un:r>>>0)?(n=Ec(n),n&&("string"==typeof t||null!=t&&!Ah(t))&&(t=vu(t),!t&&T(n))?Ou(G(n),0,r):n.split(t,r)):[]}function ba(n,t,r){return n=Ec(n),r=null==r?0:Mr(kc(r),0,n.length),t=vu(t),n.slice(r,r+t.length)==t}function wa(n,t,r){var e=Z.templateSettings;r&&Ui(n,t,r)&&(t=X),n=Ec(n),t=Sh({},t,e,li);var u,i,o=Sh({},t.imports,e.imports,li),f=Pc(o),c=E(o,f),a=0,l=t.interpolate||Ht,s="__p += '",h=sl((t.escape||Ht).source+"|"+l.source+"|"+(l===It?Ft:Ht).source+"|"+(t.evaluate||Ht).source+"|$","g"),p="//# sourceURL="+(bl.call(t,"sourceURL")?(t.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Zr+"]")+"\n";
n.replace(h,function(t,r,e,o,f,c){return e||(e=o),s+=n.slice(a,c).replace(Jt,U),r&&(u=!0,s+="' +\n__e("+r+") +\n'"),f&&(i=!0,s+="';\n"+f+";\n__p += '"),e&&(s+="' +\n((__t = ("+e+")) == null ? '' : __t) +\n'"),a=c+t.length,t}),s+="';\n";var _=bl.call(t,"variable")&&t.variable;if(_){if(Dt.test(_))throw new fl(un)}else s="with (obj) {\n"+s+"\n}\n";s=(i?s.replace(dt,""):s).replace(bt,"$1").replace(wt,"$1;"),s="function("+(_||"obj")+") {\n"+(_?"":"obj || (obj = {});\n")+"var __t, __p = ''"+(u?", __e = _.escape":"")+(i?", __j = Array.prototype.join;\nfunction print() { __p += __j.call(arguments, '') }\n":";\n")+s+"return __p\n}";
var v=Xh(function(){return cl(f,p+"return "+s).apply(X,c)});if(v.source=s,rc(v))throw v;return v}function ma(n){return Ec(n).toLowerCase()}function xa(n){return Ec(n).toUpperCase()}function ja(n,t,r){if(n=Ec(n),n&&(r||t===X))return R(n);if(!n||!(t=vu(t)))return n;var e=G(n),u=G(t);return Ou(e,W(e,u),L(e,u)+1).join("")}function Aa(n,t,r){if(n=Ec(n),n&&(r||t===X))return n.slice(0,H(n)+1);if(!n||!(t=vu(t)))return n;var e=G(n);return Ou(e,0,L(e,G(t))+1).join("")}function ka(n,t,r){if(n=Ec(n),n&&(r||t===X))return n.replace(Lt,"");
if(!n||!(t=vu(t)))return n;var e=G(n);return Ou(e,W(e,G(t))).join("")}function Oa(n,t){var r=An,e=kn;if(fc(t)){var u="separator"in t?t.separator:u;r="length"in t?kc(t.length):r,e="omission"in t?vu(t.omission):e}n=Ec(n);var i=n.length;if(T(n)){var o=G(n);i=o.length}if(r>=i)return n;var f=r-V(e);if(f<1)return e;var c=o?Ou(o,0,f).join(""):n.slice(0,f);if(u===X)return c+e;if(o&&(f+=c.length-f),Ah(u)){if(n.slice(f).search(u)){var a,l=c;for(u.global||(u=sl(u.source,Ec(Nt.exec(u))+"g")),u.lastIndex=0;a=u.exec(l);)var s=a.index;
c=c.slice(0,s===X?f:s)}}else if(n.indexOf(vu(u),f)!=f){var h=c.lastIndexOf(u);h>-1&&(c=c.slice(0,h))}return c+e}function Ia(n){return n=Ec(n),n&&jt.test(n)?n.replace(mt,ye):n}function Ra(n,t,r){return n=Ec(n),t=r?X:t,t===X?$(n)?Q(n):_(n):n.match(t)||[]}function za(t){var r=null==t?0:t.length,e=mi();return t=r?c(t,function(n){if("function"!=typeof n[1])throw new pl(en);return[e(n[0]),n[1]]}):[],uu(function(e){for(var u=-1;++u<r;){var i=t[u];if(n(i[0],this,e))return n(i[1],this,e)}})}function Ea(n){
return Nr(Fr(n,an))}function Sa(n){return function(){return n}}function Wa(n,t){return null==n||n!==n?t:n}function La(n){return n}function Ca(n){return De("function"==typeof n?n:Fr(n,an))}function Ua(n){return qe(Fr(n,an))}function Ba(n,t){return Ze(n,Fr(t,an))}function Ta(n,t,e){var u=Pc(t),i=fe(t,u);null!=e||fc(t)&&(i.length||!u.length)||(e=t,t=n,n=this,i=fe(t,Pc(t)));var o=!(fc(e)&&"chain"in e&&!e.chain),f=uc(n);return r(i,function(r){var e=t[r];n[r]=e,f&&(n.prototype[r]=function(){var t=this.__chain__;
if(o||t){var r=n(this.__wrapped__);return(r.__actions__=Tu(this.__actions__)).push({func:e,args:arguments,thisArg:n}),r.__chain__=t,r}return e.apply(n,a([this.value()],arguments))})}),n}function $a(){return re._===this&&(re._=Al),this}function Da(){}function Ma(n){return n=kc(n),uu(function(t){return Ge(t,n)})}function Fa(n){return Bi(n)?m(no(n)):Qe(n)}function Na(n){return function(t){return null==n?X:_e(n,t)}}function Pa(){return[]}function qa(){return!1}function Za(){return{}}function Ka(){return"";
}function Va(){return!0}function Ga(n,t){if(n=kc(n),n<1||n>Wn)return[];var r=Un,e=Hl(n,Un);t=mi(t),n-=Un;for(var u=O(e,t);++r<n;)t(r);return u}function Ha(n){return bh(n)?c(n,no):bc(n)?[n]:Tu(Cs(Ec(n)))}function Ja(n){var t=++wl;return Ec(n)+t}function Ya(n){return n&&n.length?Yr(n,La,me):X}function Qa(n,t){return n&&n.length?Yr(n,mi(t,2),me):X}function Xa(n){return w(n,La)}function nl(n,t){return w(n,mi(t,2))}function tl(n){return n&&n.length?Yr(n,La,Ne):X}function rl(n,t){return n&&n.length?Yr(n,mi(t,2),Ne):X;
}function el(n){return n&&n.length?k(n,La):0}function ul(n,t){return n&&n.length?k(n,mi(t,2)):0}x=null==x?re:be.defaults(re.Object(),x,be.pick(re,qr));var il=x.Array,ol=x.Date,fl=x.Error,cl=x.Function,al=x.Math,ll=x.Object,sl=x.RegExp,hl=x.String,pl=x.TypeError,_l=il.prototype,vl=cl.prototype,gl=ll.prototype,yl=x["__core-js_shared__"],dl=vl.toString,bl=gl.hasOwnProperty,wl=0,ml=function(){var n=/[^.]+$/.exec(yl&&yl.keys&&yl.keys.IE_PROTO||"");return n?"Symbol(src)_1."+n:""}(),xl=gl.toString,jl=dl.call(ll),Al=re._,kl=sl("^"+dl.call(bl).replace(St,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ol=ie?x.Buffer:X,Il=x.Symbol,Rl=x.Uint8Array,zl=Ol?Ol.allocUnsafe:X,El=F(ll.getPrototypeOf,ll),Sl=ll.create,Wl=gl.propertyIsEnumerable,Ll=_l.splice,Cl=Il?Il.isConcatSpreadable:X,Ul=Il?Il.iterator:X,Bl=Il?Il.toStringTag:X,Tl=function(){
try{var n=Ai(ll,"defineProperty");return n({},"",{}),n}catch(n){}}(),$l=x.clearTimeout!==re.clearTimeout&&x.clearTimeout,Dl=ol&&ol.now!==re.Date.now&&ol.now,Ml=x.setTimeout!==re.setTimeout&&x.setTimeout,Fl=al.ceil,Nl=al.floor,Pl=ll.getOwnPropertySymbols,ql=Ol?Ol.isBuffer:X,Zl=x.isFinite,Kl=_l.join,Vl=F(ll.keys,ll),Gl=al.max,Hl=al.min,Jl=ol.now,Yl=x.parseInt,Ql=al.random,Xl=_l.reverse,ns=Ai(x,"DataView"),ts=Ai(x,"Map"),rs=Ai(x,"Promise"),es=Ai(x,"Set"),us=Ai(x,"WeakMap"),is=Ai(ll,"create"),os=us&&new us,fs={},cs=to(ns),as=to(ts),ls=to(rs),ss=to(es),hs=to(us),ps=Il?Il.prototype:X,_s=ps?ps.valueOf:X,vs=ps?ps.toString:X,gs=function(){
function n(){}return function(t){if(!fc(t))return{};if(Sl)return Sl(t);n.prototype=t;var r=new n;return n.prototype=X,r}}();Z.templateSettings={escape:kt,evaluate:Ot,interpolate:It,variable:"",imports:{_:Z}},Z.prototype=J.prototype,Z.prototype.constructor=Z,Y.prototype=gs(J.prototype),Y.prototype.constructor=Y,Ct.prototype=gs(J.prototype),Ct.prototype.constructor=Ct,Xt.prototype.clear=nr,Xt.prototype.delete=tr,Xt.prototype.get=rr,Xt.prototype.has=er,Xt.prototype.set=ur,ir.prototype.clear=or,ir.prototype.delete=fr,
ir.prototype.get=cr,ir.prototype.has=ar,ir.prototype.set=lr,sr.prototype.clear=hr,sr.prototype.delete=pr,sr.prototype.get=_r,sr.prototype.has=vr,sr.prototype.set=gr,yr.prototype.add=yr.prototype.push=dr,yr.prototype.has=br,wr.prototype.clear=mr,wr.prototype.delete=xr,wr.prototype.get=jr,wr.prototype.has=Ar,wr.prototype.set=kr;var ys=Pu(ue),ds=Pu(oe,!0),bs=qu(),ws=qu(!0),ms=os?function(n,t){return os.set(n,t),n}:La,xs=Tl?function(n,t){return Tl(n,"toString",{configurable:!0,enumerable:!1,value:Sa(t),
writable:!0})}:La,js=uu,As=$l||function(n){return re.clearTimeout(n)},ks=es&&1/P(new es([,-0]))[1]==Sn?function(n){return new es(n)}:Da,Os=os?function(n){return os.get(n)}:Da,Is=Pl?function(n){return null==n?[]:(n=ll(n),i(Pl(n),function(t){return Wl.call(n,t)}))}:Pa,Rs=Pl?function(n){for(var t=[];n;)a(t,Is(n)),n=El(n);return t}:Pa,zs=we;(ns&&zs(new ns(new ArrayBuffer(1)))!=ct||ts&&zs(new ts)!=Gn||rs&&zs(rs.resolve())!=Qn||es&&zs(new es)!=tt||us&&zs(new us)!=it)&&(zs=function(n){var t=we(n),r=t==Yn?n.constructor:X,e=r?to(r):"";
if(e)switch(e){case cs:return ct;case as:return Gn;case ls:return Qn;case ss:return tt;case hs:return it}return t});var Es=yl?uc:qa,Ss=Qi(ms),Ws=Ml||function(n,t){return re.setTimeout(n,t)},Ls=Qi(xs),Cs=Pi(function(n){var t=[];return 46===n.charCodeAt(0)&&t.push(""),n.replace(Et,function(n,r,e,u){t.push(e?u.replace(Mt,"$1"):r||n)}),t}),Us=uu(function(n,t){return Jf(n)?Hr(n,ee(t,1,Jf,!0)):[]}),Bs=uu(function(n,t){var r=jo(t);return Jf(r)&&(r=X),Jf(n)?Hr(n,ee(t,1,Jf,!0),mi(r,2)):[]}),Ts=uu(function(n,t){
var r=jo(t);return Jf(r)&&(r=X),Jf(n)?Hr(n,ee(t,1,Jf,!0),X,r):[]}),$s=uu(function(n){var t=c(n,ju);return t.length&&t[0]===n[0]?ke(t):[]}),Ds=uu(function(n){var t=jo(n),r=c(n,ju);return t===jo(r)?t=X:r.pop(),r.length&&r[0]===n[0]?ke(r,mi(t,2)):[]}),Ms=uu(function(n){var t=jo(n),r=c(n,ju);return t="function"==typeof t?t:X,t&&r.pop(),r.length&&r[0]===n[0]?ke(r,X,t):[]}),Fs=uu(Oo),Ns=gi(function(n,t){var r=null==n?0:n.length,e=Tr(n,t);return nu(n,c(t,function(n){return Ci(n,r)?+n:n}).sort(Lu)),e}),Ps=uu(function(n){
return gu(ee(n,1,Jf,!0))}),qs=uu(function(n){var t=jo(n);return Jf(t)&&(t=X),gu(ee(n,1,Jf,!0),mi(t,2))}),Zs=uu(function(n){var t=jo(n);return t="function"==typeof t?t:X,gu(ee(n,1,Jf,!0),X,t)}),Ks=uu(function(n,t){return Jf(n)?Hr(n,t):[]}),Vs=uu(function(n){return mu(i(n,Jf))}),Gs=uu(function(n){var t=jo(n);return Jf(t)&&(t=X),mu(i(n,Jf),mi(t,2))}),Hs=uu(function(n){var t=jo(n);return t="function"==typeof t?t:X,mu(i(n,Jf),X,t)}),Js=uu(Go),Ys=uu(function(n){var t=n.length,r=t>1?n[t-1]:X;return r="function"==typeof r?(n.pop(),
r):X,Ho(n,r)}),Qs=gi(function(n){var t=n.length,r=t?n[0]:0,e=this.__wrapped__,u=function(t){return Tr(t,n)};return!(t>1||this.__actions__.length)&&e instanceof Ct&&Ci(r)?(e=e.slice(r,+r+(t?1:0)),e.__actions__.push({func:nf,args:[u],thisArg:X}),new Y(e,this.__chain__).thru(function(n){return t&&!n.length&&n.push(X),n})):this.thru(u)}),Xs=Fu(function(n,t,r){bl.call(n,r)?++n[r]:Br(n,r,1)}),nh=Ju(ho),th=Ju(po),rh=Fu(function(n,t,r){bl.call(n,r)?n[r].push(t):Br(n,r,[t])}),eh=uu(function(t,r,e){var u=-1,i="function"==typeof r,o=Hf(t)?il(t.length):[];
return ys(t,function(t){o[++u]=i?n(r,t,e):Ie(t,r,e)}),o}),uh=Fu(function(n,t,r){Br(n,r,t)}),ih=Fu(function(n,t,r){n[r?0:1].push(t)},function(){return[[],[]]}),oh=uu(function(n,t){if(null==n)return[];var r=t.length;return r>1&&Ui(n,t[0],t[1])?t=[]:r>2&&Ui(t[0],t[1],t[2])&&(t=[t[0]]),He(n,ee(t,1),[])}),fh=Dl||function(){return re.Date.now()},ch=uu(function(n,t,r){var e=_n;if(r.length){var u=N(r,wi(ch));e|=bn}return ai(n,e,t,r,u)}),ah=uu(function(n,t,r){var e=_n|vn;if(r.length){var u=N(r,wi(ah));e|=bn;
}return ai(t,e,n,r,u)}),lh=uu(function(n,t){return Gr(n,1,t)}),sh=uu(function(n,t,r){return Gr(n,Ic(t)||0,r)});Cf.Cache=sr;var hh=js(function(t,r){r=1==r.length&&bh(r[0])?c(r[0],z(mi())):c(ee(r,1),z(mi()));var e=r.length;return uu(function(u){for(var i=-1,o=Hl(u.length,e);++i<o;)u[i]=r[i].call(this,u[i]);return n(t,this,u)})}),ph=uu(function(n,t){return ai(n,bn,X,t,N(t,wi(ph)))}),_h=uu(function(n,t){return ai(n,wn,X,t,N(t,wi(_h)))}),vh=gi(function(n,t){return ai(n,xn,X,X,X,t)}),gh=ii(me),yh=ii(function(n,t){
return n>=t}),dh=Re(function(){return arguments}())?Re:function(n){return cc(n)&&bl.call(n,"callee")&&!Wl.call(n,"callee")},bh=il.isArray,wh=ce?z(ce):ze,mh=ql||qa,xh=ae?z(ae):Ee,jh=le?z(le):Le,Ah=se?z(se):Be,kh=he?z(he):Te,Oh=pe?z(pe):$e,Ih=ii(Ne),Rh=ii(function(n,t){return n<=t}),zh=Nu(function(n,t){if(Mi(t)||Hf(t))return $u(t,Pc(t),n),X;for(var r in t)bl.call(t,r)&&Sr(n,r,t[r])}),Eh=Nu(function(n,t){$u(t,qc(t),n)}),Sh=Nu(function(n,t,r,e){$u(t,qc(t),n,e)}),Wh=Nu(function(n,t,r,e){$u(t,Pc(t),n,e);
}),Lh=gi(Tr),Ch=uu(function(n,t){n=ll(n);var r=-1,e=t.length,u=e>2?t[2]:X;for(u&&Ui(t[0],t[1],u)&&(e=1);++r<e;)for(var i=t[r],o=qc(i),f=-1,c=o.length;++f<c;){var a=o[f],l=n[a];(l===X||Gf(l,gl[a])&&!bl.call(n,a))&&(n[a]=i[a])}return n}),Uh=uu(function(t){return t.push(X,si),n(Mh,X,t)}),Bh=Xu(function(n,t,r){null!=t&&"function"!=typeof t.toString&&(t=xl.call(t)),n[t]=r},Sa(La)),Th=Xu(function(n,t,r){null!=t&&"function"!=typeof t.toString&&(t=xl.call(t)),bl.call(n,t)?n[t].push(r):n[t]=[r]},mi),$h=uu(Ie),Dh=Nu(function(n,t,r){
Ke(n,t,r)}),Mh=Nu(function(n,t,r,e){Ke(n,t,r,e)}),Fh=gi(function(n,t){var r={};if(null==n)return r;var e=!1;t=c(t,function(t){return t=ku(t,n),e||(e=t.length>1),t}),$u(n,di(n),r),e&&(r=Fr(r,an|ln|sn,hi));for(var u=t.length;u--;)yu(r,t[u]);return r}),Nh=gi(function(n,t){return null==n?{}:Je(n,t)}),Ph=ci(Pc),qh=ci(qc),Zh=Vu(function(n,t,r){return t=t.toLowerCase(),n+(r?fa(t):t)}),Kh=Vu(function(n,t,r){return n+(r?"-":"")+t.toLowerCase()}),Vh=Vu(function(n,t,r){return n+(r?" ":"")+t.toLowerCase()}),Gh=Ku("toLowerCase"),Hh=Vu(function(n,t,r){
return n+(r?"_":"")+t.toLowerCase()}),Jh=Vu(function(n,t,r){return n+(r?" ":"")+Qh(t)}),Yh=Vu(function(n,t,r){return n+(r?" ":"")+t.toUpperCase()}),Qh=Ku("toUpperCase"),Xh=uu(function(t,r){try{return n(t,X,r)}catch(n){return rc(n)?n:new fl(n)}}),np=gi(function(n,t){return r(t,function(t){t=no(t),Br(n,t,ch(n[t],n))}),n}),tp=Yu(),rp=Yu(!0),ep=uu(function(n,t){return function(r){return Ie(r,n,t)}}),up=uu(function(n,t){return function(r){return Ie(n,r,t)}}),ip=ti(c),op=ti(u),fp=ti(h),cp=ui(),ap=ui(!0),lp=ni(function(n,t){
return n+t},0),sp=fi("ceil"),hp=ni(function(n,t){return n/t},1),pp=fi("floor"),_p=ni(function(n,t){return n*t},1),vp=fi("round"),gp=ni(function(n,t){return n-t},0);return Z.after=If,Z.ary=Rf,Z.assign=zh,Z.assignIn=Eh,Z.assignInWith=Sh,Z.assignWith=Wh,Z.at=Lh,Z.before=zf,Z.bind=ch,Z.bindAll=np,Z.bindKey=ah,Z.castArray=Nf,Z.chain=Qo,Z.chunk=uo,Z.compact=io,Z.concat=oo,Z.cond=za,Z.conforms=Ea,Z.constant=Sa,Z.countBy=Xs,Z.create=Sc,Z.curry=Ef,Z.curryRight=Sf,Z.debounce=Wf,Z.defaults=Ch,Z.defaultsDeep=Uh,
Z.defer=lh,Z.delay=sh,Z.difference=Us,Z.differenceBy=Bs,Z.differenceWith=Ts,Z.drop=fo,Z.dropRight=co,Z.dropRightWhile=ao,Z.dropWhile=lo,Z.fill=so,Z.filter=lf,Z.flatMap=sf,Z.flatMapDeep=hf,Z.flatMapDepth=pf,Z.flatten=_o,Z.flattenDeep=vo,Z.flattenDepth=go,Z.flip=Lf,Z.flow=tp,Z.flowRight=rp,Z.fromPairs=yo,Z.functions=$c,Z.functionsIn=Dc,Z.groupBy=rh,Z.initial=mo,Z.intersection=$s,Z.intersectionBy=Ds,Z.intersectionWith=Ms,Z.invert=Bh,Z.invertBy=Th,Z.invokeMap=eh,Z.iteratee=Ca,Z.keyBy=uh,Z.keys=Pc,Z.keysIn=qc,
Z.map=yf,Z.mapKeys=Zc,Z.mapValues=Kc,Z.matches=Ua,Z.matchesProperty=Ba,Z.memoize=Cf,Z.merge=Dh,Z.mergeWith=Mh,Z.method=ep,Z.methodOf=up,Z.mixin=Ta,Z.negate=Uf,Z.nthArg=Ma,Z.omit=Fh,Z.omitBy=Vc,Z.once=Bf,Z.orderBy=df,Z.over=ip,Z.overArgs=hh,Z.overEvery=op,Z.overSome=fp,Z.partial=ph,Z.partialRight=_h,Z.partition=ih,Z.pick=Nh,Z.pickBy=Gc,Z.property=Fa,Z.propertyOf=Na,Z.pull=Fs,Z.pullAll=Oo,Z.pullAllBy=Io,Z.pullAllWith=Ro,Z.pullAt=Ns,Z.range=cp,Z.rangeRight=ap,Z.rearg=vh,Z.reject=mf,Z.remove=zo,Z.rest=Tf,
Z.reverse=Eo,Z.sampleSize=jf,Z.set=Jc,Z.setWith=Yc,Z.shuffle=Af,Z.slice=So,Z.sortBy=oh,Z.sortedUniq=$o,Z.sortedUniqBy=Do,Z.split=da,Z.spread=$f,Z.tail=Mo,Z.take=Fo,Z.takeRight=No,Z.takeRightWhile=Po,Z.takeWhile=qo,Z.tap=Xo,Z.throttle=Df,Z.thru=nf,Z.toArray=jc,Z.toPairs=Ph,Z.toPairsIn=qh,Z.toPath=Ha,Z.toPlainObject=Rc,Z.transform=Qc,Z.unary=Mf,Z.union=Ps,Z.unionBy=qs,Z.unionWith=Zs,Z.uniq=Zo,Z.uniqBy=Ko,Z.uniqWith=Vo,Z.unset=Xc,Z.unzip=Go,Z.unzipWith=Ho,Z.update=na,Z.updateWith=ta,Z.values=ra,Z.valuesIn=ea,
Z.without=Ks,Z.words=Ra,Z.wrap=Ff,Z.xor=Vs,Z.xorBy=Gs,Z.xorWith=Hs,Z.zip=Js,Z.zipObject=Jo,Z.zipObjectDeep=Yo,Z.zipWith=Ys,Z.entries=Ph,Z.entriesIn=qh,Z.extend=Eh,Z.extendWith=Sh,Ta(Z,Z),Z.add=lp,Z.attempt=Xh,Z.camelCase=Zh,Z.capitalize=fa,Z.ceil=sp,Z.clamp=ua,Z.clone=Pf,Z.cloneDeep=Zf,Z.cloneDeepWith=Kf,Z.cloneWith=qf,Z.conformsTo=Vf,Z.deburr=ca,Z.defaultTo=Wa,Z.divide=hp,Z.endsWith=aa,Z.eq=Gf,Z.escape=la,Z.escapeRegExp=sa,Z.every=af,Z.find=nh,Z.findIndex=ho,Z.findKey=Wc,Z.findLast=th,Z.findLastIndex=po,
Z.findLastKey=Lc,Z.floor=pp,Z.forEach=_f,Z.forEachRight=vf,Z.forIn=Cc,Z.forInRight=Uc,Z.forOwn=Bc,Z.forOwnRight=Tc,Z.get=Mc,Z.gt=gh,Z.gte=yh,Z.has=Fc,Z.hasIn=Nc,Z.head=bo,Z.identity=La,Z.includes=gf,Z.indexOf=wo,Z.inRange=ia,Z.invoke=$h,Z.isArguments=dh,Z.isArray=bh,Z.isArrayBuffer=wh,Z.isArrayLike=Hf,Z.isArrayLikeObject=Jf,Z.isBoolean=Yf,Z.isBuffer=mh,Z.isDate=xh,Z.isElement=Qf,Z.isEmpty=Xf,Z.isEqual=nc,Z.isEqualWith=tc,Z.isError=rc,Z.isFinite=ec,Z.isFunction=uc,Z.isInteger=ic,Z.isLength=oc,Z.isMap=jh,
Z.isMatch=ac,Z.isMatchWith=lc,Z.isNaN=sc,Z.isNative=hc,Z.isNil=_c,Z.isNull=pc,Z.isNumber=vc,Z.isObject=fc,Z.isObjectLike=cc,Z.isPlainObject=gc,Z.isRegExp=Ah,Z.isSafeInteger=yc,Z.isSet=kh,Z.isString=dc,Z.isSymbol=bc,Z.isTypedArray=Oh,Z.isUndefined=wc,Z.isWeakMap=mc,Z.isWeakSet=xc,Z.join=xo,Z.kebabCase=Kh,Z.last=jo,Z.lastIndexOf=Ao,Z.lowerCase=Vh,Z.lowerFirst=Gh,Z.lt=Ih,Z.lte=Rh,Z.max=Ya,Z.maxBy=Qa,Z.mean=Xa,Z.meanBy=nl,Z.min=tl,Z.minBy=rl,Z.stubArray=Pa,Z.stubFalse=qa,Z.stubObject=Za,Z.stubString=Ka,
Z.stubTrue=Va,Z.multiply=_p,Z.nth=ko,Z.noConflict=$a,Z.noop=Da,Z.now=fh,Z.pad=ha,Z.padEnd=pa,Z.padStart=_a,Z.parseInt=va,Z.random=oa,Z.reduce=bf,Z.reduceRight=wf,Z.repeat=ga,Z.replace=ya,Z.result=Hc,Z.round=vp,Z.runInContext=p,Z.sample=xf,Z.size=kf,Z.snakeCase=Hh,Z.some=Of,Z.sortedIndex=Wo,Z.sortedIndexBy=Lo,Z.sortedIndexOf=Co,Z.sortedLastIndex=Uo,Z.sortedLastIndexBy=Bo,Z.sortedLastIndexOf=To,Z.startCase=Jh,Z.startsWith=ba,Z.subtract=gp,Z.sum=el,Z.sumBy=ul,Z.template=wa,Z.times=Ga,Z.toFinite=Ac,Z.toInteger=kc,
Z.toLength=Oc,Z.toLower=ma,Z.toNumber=Ic,Z.toSafeInteger=zc,Z.toString=Ec,Z.toUpper=xa,Z.trim=ja,Z.trimEnd=Aa,Z.trimStart=ka,Z.truncate=Oa,Z.unescape=Ia,Z.uniqueId=Ja,Z.upperCase=Yh,Z.upperFirst=Qh,Z.each=_f,Z.eachRight=vf,Z.first=bo,Ta(Z,function(){var n={};return ue(Z,function(t,r){bl.call(Z.prototype,r)||(n[r]=t)}),n}(),{chain:!1}),Z.VERSION=nn,r(["bind","bindKey","curry","curryRight","partial","partialRight"],function(n){Z[n].placeholder=Z}),r(["drop","take"],function(n,t){Ct.prototype[n]=function(r){
r=r===X?1:Gl(kc(r),0);var e=this.__filtered__&&!t?new Ct(this):this.clone();return e.__filtered__?e.__takeCount__=Hl(r,e.__takeCount__):e.__views__.push({size:Hl(r,Un),type:n+(e.__dir__<0?"Right":"")}),e},Ct.prototype[n+"Right"]=function(t){return this.reverse()[n](t).reverse()}}),r(["filter","map","takeWhile"],function(n,t){var r=t+1,e=r==Rn||r==En;Ct.prototype[n]=function(n){var t=this.clone();return t.__iteratees__.push({iteratee:mi(n,3),type:r}),t.__filtered__=t.__filtered__||e,t}}),r(["head","last"],function(n,t){
var r="take"+(t?"Right":"");Ct.prototype[n]=function(){return this[r](1).value()[0]}}),r(["initial","tail"],function(n,t){var r="drop"+(t?"":"Right");Ct.prototype[n]=function(){return this.__filtered__?new Ct(this):this[r](1)}}),Ct.prototype.compact=function(){return this.filter(La)},Ct.prototype.find=function(n){return this.filter(n).head()},Ct.prototype.findLast=function(n){return this.reverse().find(n)},Ct.prototype.invokeMap=uu(function(n,t){return"function"==typeof n?new Ct(this):this.map(function(r){
return Ie(r,n,t)})}),Ct.prototype.reject=function(n){return this.filter(Uf(mi(n)))},Ct.prototype.slice=function(n,t){n=kc(n);var r=this;return r.__filtered__&&(n>0||t<0)?new Ct(r):(n<0?r=r.takeRight(-n):n&&(r=r.drop(n)),t!==X&&(t=kc(t),r=t<0?r.dropRight(-t):r.take(t-n)),r)},Ct.prototype.takeRightWhile=function(n){return this.reverse().takeWhile(n).reverse()},Ct.prototype.toArray=function(){return this.take(Un)},ue(Ct.prototype,function(n,t){var r=/^(?:filter|find|map|reject)|While$/.test(t),e=/^(?:head|last)$/.test(t),u=Z[e?"take"+("last"==t?"Right":""):t],i=e||/^find/.test(t);
u&&(Z.prototype[t]=function(){var t=this.__wrapped__,o=e?[1]:arguments,f=t instanceof Ct,c=o[0],l=f||bh(t),s=function(n){var t=u.apply(Z,a([n],o));return e&&h?t[0]:t};l&&r&&"function"==typeof c&&1!=c.length&&(f=l=!1);var h=this.__chain__,p=!!this.__actions__.length,_=i&&!h,v=f&&!p;if(!i&&l){t=v?t:new Ct(this);var g=n.apply(t,o);return g.__actions__.push({func:nf,args:[s],thisArg:X}),new Y(g,h)}return _&&v?n.apply(this,o):(g=this.thru(s),_?e?g.value()[0]:g.value():g)})}),r(["pop","push","shift","sort","splice","unshift"],function(n){
var t=_l[n],r=/^(?:push|sort|unshift)$/.test(n)?"tap":"thru",e=/^(?:pop|shift)$/.test(n);Z.prototype[n]=function(){var n=arguments;if(e&&!this.__chain__){var u=this.value();return t.apply(bh(u)?u:[],n)}return this[r](function(r){return t.apply(bh(r)?r:[],n)})}}),ue(Ct.prototype,function(n,t){var r=Z[t];if(r){var e=r.name+"";bl.call(fs,e)||(fs[e]=[]),fs[e].push({name:t,func:r})}}),fs[Qu(X,vn).name]=[{name:"wrapper",func:X}],Ct.prototype.clone=$t,Ct.prototype.reverse=Yt,Ct.prototype.value=Qt,Z.prototype.at=Qs,
Z.prototype.chain=tf,Z.prototype.commit=rf,Z.prototype.next=ef,Z.prototype.plant=of,Z.prototype.reverse=ff,Z.prototype.toJSON=Z.prototype.valueOf=Z.prototype.value=cf,Z.prototype.first=Z.prototype.head,Ul&&(Z.prototype[Ul]=uf),Z},be=de(); true?(re._=be,!(__WEBPACK_AMD_DEFINE_RESULT__ = (function(){return be}).call(exports, __webpack_require__, exports, module),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__))):0}).call(this);
/***/ }),
/***/ "./node_modules/math-intrinsics/abs.js":
/*!*********************************************!*\
!*** ./node_modules/math-intrinsics/abs.js ***!
\*********************************************/
/***/ ((module) => {
"use strict";
/** @type {import('./abs')} */
module.exports = Math.abs;
/***/ }),
/***/ "./node_modules/math-intrinsics/floor.js":
/*!***********************************************!*\
!*** ./node_modules/math-intrinsics/floor.js ***!
\***********************************************/
/***/ ((module) => {
"use strict";
/** @type {import('./floor')} */
module.exports = Math.floor;
/***/ }),
/***/ "./node_modules/math-intrinsics/isNaN.js":
/*!***********************************************!*\
!*** ./node_modules/math-intrinsics/isNaN.js ***!
\***********************************************/
/***/ ((module) => {
"use strict";
/** @type {import('./isNaN')} */
module.exports = Number.isNaN || function isNaN(a) {
return a !== a;
};
/***/ }),
/***/ "./node_modules/math-intrinsics/max.js":
/*!*********************************************!*\
!*** ./node_modules/math-intrinsics/max.js ***!
\*********************************************/
/***/ ((module) => {
"use strict";
/** @type {import('./max')} */
module.exports = Math.max;
/***/ }),
/***/ "./node_modules/math-intrinsics/min.js":
/*!*********************************************!*\
!*** ./node_modules/math-intrinsics/min.js ***!
\*********************************************/
/***/ ((module) => {
"use strict";
/** @type {import('./min')} */
module.exports = Math.min;
/***/ }),
/***/ "./node_modules/math-intrinsics/pow.js":
/*!*********************************************!*\
!*** ./node_modules/math-intrinsics/pow.js ***!
\*********************************************/
/***/ ((module) => {
"use strict";
/** @type {import('./pow')} */
module.exports = Math.pow;
/***/ }),
/***/ "./node_modules/math-intrinsics/round.js":
/*!***********************************************!*\
!*** ./node_modules/math-intrinsics/round.js ***!
\***********************************************/
/***/ ((module) => {
"use strict";
/** @type {import('./round')} */
module.exports = Math.round;
/***/ }),
/***/ "./node_modules/math-intrinsics/sign.js":
/*!**********************************************!*\
!*** ./node_modules/math-intrinsics/sign.js ***!
\**********************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var $isNaN = __webpack_require__(/*! ./isNaN */ "./node_modules/math-intrinsics/isNaN.js");
/** @type {import('./sign')} */
module.exports = function sign(number) {
if ($isNaN(number) || number === 0) {
return number;
}
return number < 0 ? -1 : +1;
};
/***/ }),
/***/ "./node_modules/object-is/implementation.js":
/*!**************************************************!*\
!*** ./node_modules/object-is/implementation.js ***!
\**************************************************/
/***/ ((module) => {
"use strict";
var numberIsNaN = function (value) {
return value !== value;
};
module.exports = function is(a, b) {
if (a === 0 && b === 0) {
return 1 / a === 1 / b;
}
if (a === b) {
return true;
}
if (numberIsNaN(a) && numberIsNaN(b)) {
return true;
}
return false;
};
/***/ }),
/***/ "./node_modules/object-is/index.js":
/*!*****************************************!*\
!*** ./node_modules/object-is/index.js ***!
\*****************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var define = __webpack_require__(/*! define-properties */ "./node_modules/define-properties/index.js");
var callBind = __webpack_require__(/*! call-bind */ "./node_modules/call-bind/index.js");
var implementation = __webpack_require__(/*! ./implementation */ "./node_modules/object-is/implementation.js");
var getPolyfill = __webpack_require__(/*! ./polyfill */ "./node_modules/object-is/polyfill.js");
var shim = __webpack_require__(/*! ./shim */ "./node_modules/object-is/shim.js");
var polyfill = callBind(getPolyfill(), Object);
define(polyfill, {
getPolyfill: getPolyfill,
implementation: implementation,
shim: shim
});
module.exports = polyfill;
/***/ }),
/***/ "./node_modules/object-is/polyfill.js":
/*!********************************************!*\
!*** ./node_modules/object-is/polyfill.js ***!
\********************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var implementation = __webpack_require__(/*! ./implementation */ "./node_modules/object-is/implementation.js");
module.exports = function getPolyfill() {
return typeof Object.is === 'function' ? Object.is : implementation;
};
/***/ }),
/***/ "./node_modules/object-is/shim.js":
/*!****************************************!*\
!*** ./node_modules/object-is/shim.js ***!
\****************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var getPolyfill = __webpack_require__(/*! ./polyfill */ "./node_modules/object-is/polyfill.js");
var define = __webpack_require__(/*! define-properties */ "./node_modules/define-properties/index.js");
module.exports = function shimObjectIs() {
var polyfill = getPolyfill();
define(Object, { is: polyfill }, {
is: function testObjectIs() {
return Object.is !== polyfill;
}
});
return polyfill;
};
/***/ }),
/***/ "./node_modules/object-keys/implementation.js":
/*!****************************************************!*\
!*** ./node_modules/object-keys/implementation.js ***!
\****************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var keysShim;
if (!Object.keys) {
// modified from https://github.com/es-shims/es5-shim
var has = Object.prototype.hasOwnProperty;
var toStr = Object.prototype.toString;
var isArgs = __webpack_require__(/*! ./isArguments */ "./node_modules/object-keys/isArguments.js"); // eslint-disable-line global-require
var isEnumerable = Object.prototype.propertyIsEnumerable;
var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
var dontEnums = [
'toString',
'toLocaleString',
'valueOf',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'constructor'
];
var equalsConstructorPrototype = function (o) {
var ctor = o.constructor;
return ctor && ctor.prototype === o;
};
var excludedKeys = {
$applicationCache: true,
$console: true,
$external: true,
$frame: true,
$frameElement: true,
$frames: true,
$innerHeight: true,
$innerWidth: true,
$onmozfullscreenchange: true,
$onmozfullscreenerror: true,
$outerHeight: true,
$outerWidth: true,
$pageXOffset: true,
$pageYOffset: true,
$parent: true,
$scrollLeft: true,
$scrollTop: true,
$scrollX: true,
$scrollY: true,
$self: true,
$webkitIndexedDB: true,
$webkitStorageInfo: true,
$window: true
};
var hasAutomationEqualityBug = (function () {
/* global window */
if (typeof window === 'undefined') { return false; }
for (var k in window) {
try {
if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
try {
equalsConstructorPrototype(window[k]);
} catch (e) {
return true;
}
}
} catch (e) {
return true;
}
}
return false;
}());
var equalsConstructorPrototypeIfNotBuggy = function (o) {
/* global window */
if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
return equalsConstructorPrototype(o);
}
try {
return equalsConstructorPrototype(o);
} catch (e) {
return false;
}
};
keysShim = function keys(object) {
var isObject = object !== null && typeof object === 'object';
var isFunction = toStr.call(object) === '[object Function]';
var isArguments = isArgs(object);
var isString = isObject && toStr.call(object) === '[object String]';
var theKeys = [];
if (!isObject && !isFunction && !isArguments) {
throw new TypeError('Object.keys called on a non-object');
}
var skipProto = hasProtoEnumBug && isFunction;
if (isString && object.length > 0 && !has.call(object, 0)) {
for (var i = 0; i < object.length; ++i) {
theKeys.push(String(i));
}
}
if (isArguments && object.length > 0) {
for (var j = 0; j < object.length; ++j) {
theKeys.push(String(j));
}
} else {
for (var name in object) {
if (!(skipProto && name === 'prototype') && has.call(object, name)) {
theKeys.push(String(name));
}
}
}
if (hasDontEnumBug) {
var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
for (var k = 0; k < dontEnums.length; ++k) {
if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
theKeys.push(dontEnums[k]);
}
}
}
return theKeys;
};
}
module.exports = keysShim;
/***/ }),
/***/ "./node_modules/object-keys/index.js":
/*!*******************************************!*\
!*** ./node_modules/object-keys/index.js ***!
\*******************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var slice = Array.prototype.slice;
var isArgs = __webpack_require__(/*! ./isArguments */ "./node_modules/object-keys/isArguments.js");
var origKeys = Object.keys;
var keysShim = origKeys ? function keys(o) { return origKeys(o); } : __webpack_require__(/*! ./implementation */ "./node_modules/object-keys/implementation.js");
var originalKeys = Object.keys;
keysShim.shim = function shimObjectKeys() {
if (Object.keys) {
var keysWorksWithArguments = (function () {
// Safari 5.0 bug
var args = Object.keys(arguments);
return args && args.length === arguments.length;
}(1, 2));
if (!keysWorksWithArguments) {
Object.keys = function keys(object) { // eslint-disable-line func-name-matching
if (isArgs(object)) {
return originalKeys(slice.call(object));
}
return originalKeys(object);
};
}
} else {
Object.keys = keysShim;
}
return Object.keys || keysShim;
};
module.exports = keysShim;
/***/ }),
/***/ "./node_modules/object-keys/isArguments.js":
/*!*************************************************!*\
!*** ./node_modules/object-keys/isArguments.js ***!
\*************************************************/
/***/ ((module) => {
"use strict";
var toStr = Object.prototype.toString;
module.exports = function isArguments(value) {
var str = toStr.call(value);
var isArgs = str === '[object Arguments]';
if (!isArgs) {
isArgs = str !== '[object Array]' &&
value !== null &&
typeof value === 'object' &&
typeof value.length === 'number' &&
value.length >= 0 &&
toStr.call(value.callee) === '[object Function]';
}
return isArgs;
};
/***/ }),
/***/ "./node_modules/object.assign/implementation.js":
/*!******************************************************!*\
!*** ./node_modules/object.assign/implementation.js ***!
\******************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
// modified from https://github.com/es-shims/es6-shim
var objectKeys = __webpack_require__(/*! object-keys */ "./node_modules/object-keys/index.js");
var hasSymbols = __webpack_require__(/*! has-symbols/shams */ "./node_modules/has-symbols/shams.js")();
var callBound = __webpack_require__(/*! call-bound */ "./node_modules/call-bound/index.js");
var $Object = __webpack_require__(/*! es-object-atoms */ "./node_modules/es-object-atoms/index.js");
var $push = callBound('Array.prototype.push');
var $propIsEnumerable = callBound('Object.prototype.propertyIsEnumerable');
var originalGetSymbols = hasSymbols ? $Object.getOwnPropertySymbols : null;
// eslint-disable-next-line no-unused-vars
module.exports = function assign(target, source1) {
if (target == null) { throw new TypeError('target must be an object'); }
var to = $Object(target); // step 1
if (arguments.length === 1) {
return to; // step 2
}
for (var s = 1; s < arguments.length; ++s) {
var from = $Object(arguments[s]); // step 3.a.i
// step 3.a.ii:
var keys = objectKeys(from);
var getSymbols = hasSymbols && ($Object.getOwnPropertySymbols || originalGetSymbols);
if (getSymbols) {
var syms = getSymbols(from);
for (var j = 0; j < syms.length; ++j) {
var key = syms[j];
if ($propIsEnumerable(from, key)) {
$push(keys, key);
}
}
}
// step 3.a.iii:
for (var i = 0; i < keys.length; ++i) {
var nextKey = keys[i];
if ($propIsEnumerable(from, nextKey)) { // step 3.a.iii.2
var propValue = from[nextKey]; // step 3.a.iii.2.a
to[nextKey] = propValue; // step 3.a.iii.2.b
}
}
}
return to; // step 4
};
/***/ }),
/***/ "./node_modules/object.assign/polyfill.js":
/*!************************************************!*\
!*** ./node_modules/object.assign/polyfill.js ***!
\************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var implementation = __webpack_require__(/*! ./implementation */ "./node_modules/object.assign/implementation.js");
var lacksProperEnumerationOrder = function () {
if (!Object.assign) {
return false;
}
/*
* v8, specifically in node 4.x, has a bug with incorrect property enumeration order
* note: this does not detect the bug unless there's 20 characters
*/
var str = 'abcdefghijklmnopqrst';
var letters = str.split('');
var map = {};
for (var i = 0; i < letters.length; ++i) {
map[letters[i]] = letters[i];
}
var obj = Object.assign({}, map);
var actual = '';
for (var k in obj) {
actual += k;
}
return str !== actual;
};
var assignHasPendingExceptions = function () {
if (!Object.assign || !Object.preventExtensions) {
return false;
}
/*
* Firefox 37 still has "pending exception" logic in its Object.assign implementation,
* which is 72% slower than our shim, and Firefox 40's native implementation.
*/
var thrower = Object.preventExtensions({ 1: 2 });
try {
Object.assign(thrower, 'xy');
} catch (e) {
return thrower[1] === 'y';
}
return false;
};
module.exports = function getPolyfill() {
if (!Object.assign) {
return implementation;
}
if (lacksProperEnumerationOrder()) {
return implementation;
}
if (assignHasPendingExceptions()) {
return implementation;
}
return Object.assign;
};
/***/ }),
/***/ "./node_modules/os-browserify/browser.js":
/*!***********************************************!*\
!*** ./node_modules/os-browserify/browser.js ***!
\***********************************************/
/***/ ((__unused_webpack_module, exports) => {
exports.endianness = function () { return 'LE' };
exports.hostname = function () {
if (typeof location !== 'undefined') {
return location.hostname
}
else return '';
};
exports.loadavg = function () { return [] };
exports.uptime = function () { return 0 };
exports.freemem = function () {
return Number.MAX_VALUE;
};
exports.totalmem = function () {
return Number.MAX_VALUE;
};
exports.cpus = function () { return [] };
exports.type = function () { return 'Browser' };
exports.release = function () {
if (typeof navigator !== 'undefined') {
return navigator.appVersion;
}
return '';
};
exports.networkInterfaces
= exports.getNetworkInterfaces
= function () { return {} };
exports.arch = function () { return 'javascript' };
exports.platform = function () { return 'browser' };
exports.tmpdir = exports.tmpDir = function () {
return '/tmp';
};
exports.EOL = '\n';
exports.homedir = function () {
return '/'
};
/***/ }),
/***/ "./node_modules/possible-typed-array-names/index.js":
/*!**********************************************************!*\
!*** ./node_modules/possible-typed-array-names/index.js ***!
\**********************************************************/
/***/ ((module) => {
"use strict";
/** @type {import('.')} */
module.exports = [
'Float16Array',
'Float32Array',
'Float64Array',
'Int8Array',
'Int16Array',
'Int32Array',
'Uint8Array',
'Uint8ClampedArray',
'Uint16Array',
'Uint32Array',
'BigInt64Array',
'BigUint64Array'
];
/***/ }),
/***/ "./node_modules/process/browser.js":
/*!*****************************************!*\
!*** ./node_modules/process/browser.js ***!
\*****************************************/
/***/ ((module) => {
// shim for using process in browser
var process = module.exports = {};
// cached from whatever global is present so that test runners that stub it
// don't break things. But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals. It's inside a
// function because try/catches deoptimize in certain engines.
var cachedSetTimeout;
var cachedClearTimeout;
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
throw new Error('clearTimeout has not been defined');
}
(function () {
try {
if (typeof setTimeout === 'function') {
cachedSetTimeout = setTimeout;
} else {
cachedSetTimeout = defaultSetTimout;
}
} catch (e) {
cachedSetTimeout = defaultSetTimout;
}
try {
if (typeof clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
} else {
cachedClearTimeout = defaultClearTimeout;
}
} catch (e) {
cachedClearTimeout = defaultClearTimeout;
}
} ())
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
// if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;
process.listeners = function (name) { return [] }
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
/***/ }),
/***/ "./node_modules/recast/lib/comments.js":
/*!*********************************************!*\
!*** ./node_modules/recast/lib/comments.js ***!
\*********************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.printComments = exports.attach = void 0;
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var tiny_invariant_1 = tslib_1.__importDefault(__webpack_require__(/*! tiny-invariant */ "./node_modules/tiny-invariant/dist/tiny-invariant.cjs.js"));
var types = tslib_1.__importStar(__webpack_require__(/*! ast-types */ "./node_modules/ast-types/lib/main.js"));
var n = types.namedTypes;
var isArray = types.builtInTypes.array;
var isObject = types.builtInTypes.object;
var lines_1 = __webpack_require__(/*! ./lines */ "./node_modules/recast/lib/lines.js");
var util_1 = __webpack_require__(/*! ./util */ "./node_modules/recast/lib/util.js");
var childNodesCache = new WeakMap();
// TODO Move a non-caching implementation of this function into ast-types,
// and implement a caching wrapper function here.
function getSortedChildNodes(node, lines, resultArray) {
if (!node) {
return resultArray;
}
// The .loc checks below are sensitive to some of the problems that
// are fixed by this utility function. Specifically, if it decides to
// set node.loc to null, indicating that the node's .loc information
// is unreliable, then we don't want to add node to the resultArray.
(0, util_1.fixFaultyLocations)(node, lines);
if (resultArray) {
if (n.Node.check(node) && n.SourceLocation.check(node.loc)) {
// This reverse insertion sort almost always takes constant
// time because we almost always (maybe always?) append the
// nodes in order anyway.
var i = resultArray.length - 1;
for (; i >= 0; --i) {
var child = resultArray[i];
if (child &&
child.loc &&
(0, util_1.comparePos)(child.loc.end, node.loc.start) <= 0) {
break;
}
}
resultArray.splice(i + 1, 0, node);
return resultArray;
}
}
else {
var childNodes = childNodesCache.get(node);
if (childNodes) {
return childNodes;
}
}
var names;
if (isArray.check(node)) {
names = Object.keys(node);
}
else if (isObject.check(node)) {
names = types.getFieldNames(node);
}
else {
return resultArray;
}
if (!resultArray) {
childNodesCache.set(node, (resultArray = []));
}
for (var i = 0, nameCount = names.length; i < nameCount; ++i) {
getSortedChildNodes(node[names[i]], lines, resultArray);
}
return resultArray;
}
// As efficiently as possible, decorate the comment object with
// .precedingNode, .enclosingNode, and/or .followingNode properties, at
// least one of which is guaranteed to be defined.
function decorateComment(node, comment, lines) {
var childNodes = getSortedChildNodes(node, lines);
// Time to dust off the old binary search robes and wizard hat.
var left = 0;
var right = childNodes && childNodes.length;
var precedingNode;
var followingNode;
while (typeof right === "number" && left < right) {
var middle = (left + right) >> 1;
var child = childNodes[middle];
if ((0, util_1.comparePos)(child.loc.start, comment.loc.start) <= 0 &&
(0, util_1.comparePos)(comment.loc.end, child.loc.end) <= 0) {
// The comment is completely contained by this child node.
decorateComment((comment.enclosingNode = child), comment, lines);
return; // Abandon the binary search at this level.
}
if ((0, util_1.comparePos)(child.loc.end, comment.loc.start) <= 0) {
// This child node falls completely before the comment.
// Because we will never consider this node or any nodes
// before it again, this node must be the closest preceding
// node we have encountered so far.
precedingNode = child;
left = middle + 1;
continue;
}
if ((0, util_1.comparePos)(comment.loc.end, child.loc.start) <= 0) {
// This child node falls completely after the comment.
// Because we will never consider this node or any nodes after
// it again, this node must be the closest following node we
// have encountered so far.
followingNode = child;
right = middle;
continue;
}
throw new Error("Comment location overlaps with node location");
}
if (precedingNode) {
comment.precedingNode = precedingNode;
}
if (followingNode) {
comment.followingNode = followingNode;
}
}
function attach(comments, ast, lines) {
if (!isArray.check(comments)) {
return;
}
var tiesToBreak = [];
comments.forEach(function (comment) {
comment.loc.lines = lines;
decorateComment(ast, comment, lines);
var pn = comment.precedingNode;
var en = comment.enclosingNode;
var fn = comment.followingNode;
if (pn && fn) {
var tieCount = tiesToBreak.length;
if (tieCount > 0) {
var lastTie = tiesToBreak[tieCount - 1];
(0, tiny_invariant_1.default)((lastTie.precedingNode === comment.precedingNode) ===
(lastTie.followingNode === comment.followingNode));
if (lastTie.followingNode !== comment.followingNode) {
breakTies(tiesToBreak, lines);
}
}
tiesToBreak.push(comment);
}
else if (pn) {
// No contest: we have a trailing comment.
breakTies(tiesToBreak, lines);
addTrailingComment(pn, comment);
}
else if (fn) {
// No contest: we have a leading comment.
breakTies(tiesToBreak, lines);
addLeadingComment(fn, comment);
}
else if (en) {
// The enclosing node has no child nodes at all, so what we
// have here is a dangling comment, e.g. [/* crickets */].
breakTies(tiesToBreak, lines);
addDanglingComment(en, comment);
}
else {
throw new Error("AST contains no nodes at all?");
}
});
breakTies(tiesToBreak, lines);
comments.forEach(function (comment) {
// These node references were useful for breaking ties, but we
// don't need them anymore, and they create cycles in the AST that
// may lead to infinite recursion if we don't delete them here.
delete comment.precedingNode;
delete comment.enclosingNode;
delete comment.followingNode;
});
}
exports.attach = attach;
function breakTies(tiesToBreak, lines) {
var tieCount = tiesToBreak.length;
if (tieCount === 0) {
return;
}
var pn = tiesToBreak[0].precedingNode;
var fn = tiesToBreak[0].followingNode;
var gapEndPos = fn.loc.start;
// Iterate backwards through tiesToBreak, examining the gaps
// between the tied comments. In order to qualify as leading, a
// comment must be separated from fn by an unbroken series of
// whitespace-only gaps (or other comments).
var indexOfFirstLeadingComment = tieCount;
var comment;
for (; indexOfFirstLeadingComment > 0; --indexOfFirstLeadingComment) {
comment = tiesToBreak[indexOfFirstLeadingComment - 1];
(0, tiny_invariant_1.default)(comment.precedingNode === pn);
(0, tiny_invariant_1.default)(comment.followingNode === fn);
var gap = lines.sliceString(comment.loc.end, gapEndPos);
if (/\S/.test(gap)) {
// The gap string contained something other than whitespace.
break;
}
gapEndPos = comment.loc.start;
}
while (indexOfFirstLeadingComment <= tieCount &&
(comment = tiesToBreak[indexOfFirstLeadingComment]) &&
// If the comment is a //-style comment and indented more
// deeply than the node itself, reconsider it as trailing.
(comment.type === "Line" || comment.type === "CommentLine") &&
comment.loc.start.column > fn.loc.start.column) {
++indexOfFirstLeadingComment;
}
if (indexOfFirstLeadingComment) {
var enclosingNode = tiesToBreak[indexOfFirstLeadingComment - 1].enclosingNode;
if ((enclosingNode === null || enclosingNode === void 0 ? void 0 : enclosingNode.type) === "CallExpression") {
--indexOfFirstLeadingComment;
}
}
tiesToBreak.forEach(function (comment, i) {
if (i < indexOfFirstLeadingComment) {
addTrailingComment(pn, comment);
}
else {
addLeadingComment(fn, comment);
}
});
tiesToBreak.length = 0;
}
function addCommentHelper(node, comment) {
var comments = node.comments || (node.comments = []);
comments.push(comment);
}
function addLeadingComment(node, comment) {
comment.leading = true;
comment.trailing = false;
addCommentHelper(node, comment);
}
function addDanglingComment(node, comment) {
comment.leading = false;
comment.trailing = false;
addCommentHelper(node, comment);
}
function addTrailingComment(node, comment) {
comment.leading = false;
comment.trailing = true;
addCommentHelper(node, comment);
}
function printLeadingComment(commentPath, print) {
var comment = commentPath.getValue();
n.Comment.assert(comment);
var loc = comment.loc;
var lines = loc && loc.lines;
var parts = [print(commentPath)];
if (comment.trailing) {
// When we print trailing comments as leading comments, we don't
// want to bring any trailing spaces along.
parts.push("\n");
}
else if (lines instanceof lines_1.Lines) {
var trailingSpace = lines.slice(loc.end, lines.skipSpaces(loc.end) || lines.lastPos());
if (trailingSpace.length === 1) {
// If the trailing space contains no newlines, then we want to
// preserve it exactly as we found it.
parts.push(trailingSpace);
}
else {
// If the trailing space contains newlines, then replace it
// with just that many newlines, with all other spaces removed.
parts.push(new Array(trailingSpace.length).join("\n"));
}
}
else {
parts.push("\n");
}
return (0, lines_1.concat)(parts);
}
function printTrailingComment(commentPath, print) {
var comment = commentPath.getValue(commentPath);
n.Comment.assert(comment);
var loc = comment.loc;
var lines = loc && loc.lines;
var parts = [];
if (lines instanceof lines_1.Lines) {
var fromPos = lines.skipSpaces(loc.start, true) || lines.firstPos();
var leadingSpace = lines.slice(fromPos, loc.start);
if (leadingSpace.length === 1) {
// If the leading space contains no newlines, then we want to
// preserve it exactly as we found it.
parts.push(leadingSpace);
}
else {
// If the leading space contains newlines, then replace it
// with just that many newlines, sans all other spaces.
parts.push(new Array(leadingSpace.length).join("\n"));
}
}
parts.push(print(commentPath));
return (0, lines_1.concat)(parts);
}
function printComments(path, print) {
var value = path.getValue();
var innerLines = print(path);
var comments = n.Node.check(value) && types.getFieldValue(value, "comments");
if (!comments || comments.length === 0) {
return innerLines;
}
var leadingParts = [];
var trailingParts = [innerLines];
path.each(function (commentPath) {
var comment = commentPath.getValue();
var leading = types.getFieldValue(comment, "leading");
var trailing = types.getFieldValue(comment, "trailing");
if (leading ||
(trailing &&
!(n.Statement.check(value) ||
comment.type === "Block" ||
comment.type === "CommentBlock"))) {
leadingParts.push(printLeadingComment(commentPath, print));
}
else if (trailing) {
trailingParts.push(printTrailingComment(commentPath, print));
}
}, "comments");
leadingParts.push.apply(leadingParts, trailingParts);
return (0, lines_1.concat)(leadingParts);
}
exports.printComments = printComments;
/***/ }),
/***/ "./node_modules/recast/lib/fast-path.js":
/*!**********************************************!*\
!*** ./node_modules/recast/lib/fast-path.js ***!
\**********************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var tiny_invariant_1 = tslib_1.__importDefault(__webpack_require__(/*! tiny-invariant */ "./node_modules/tiny-invariant/dist/tiny-invariant.cjs.js"));
var types = tslib_1.__importStar(__webpack_require__(/*! ast-types */ "./node_modules/ast-types/lib/main.js"));
var util = tslib_1.__importStar(__webpack_require__(/*! ./util */ "./node_modules/recast/lib/util.js"));
var n = types.namedTypes;
var isArray = types.builtInTypes.array;
var isNumber = types.builtInTypes.number;
var PRECEDENCE = {};
[
["??"],
["||"],
["&&"],
["|"],
["^"],
["&"],
["==", "===", "!=", "!=="],
["<", ">", "<=", ">=", "in", "instanceof"],
[">>", "<<", ">>>"],
["+", "-"],
["*", "/", "%"],
["**"],
].forEach(function (tier, i) {
tier.forEach(function (op) {
PRECEDENCE[op] = i;
});
});
var FastPath = function FastPath(value) {
(0, tiny_invariant_1.default)(this instanceof FastPath);
this.stack = [value];
};
var FPp = FastPath.prototype;
// Static convenience function for coercing a value to a FastPath.
FastPath.from = function (obj) {
if (obj instanceof FastPath) {
// Return a defensive copy of any existing FastPath instances.
return obj.copy();
}
if (obj instanceof types.NodePath) {
// For backwards compatibility, unroll NodePath instances into
// lightweight FastPath [..., name, value] stacks.
var copy = Object.create(FastPath.prototype);
var stack = [obj.value];
for (var pp = void 0; (pp = obj.parentPath); obj = pp)
stack.push(obj.name, pp.value);
copy.stack = stack.reverse();
return copy;
}
// Otherwise use obj as the value of the new FastPath instance.
return new FastPath(obj);
};
FPp.copy = function copy() {
var copy = Object.create(FastPath.prototype);
copy.stack = this.stack.slice(0);
return copy;
};
// The name of the current property is always the penultimate element of
// this.stack, and always a String.
FPp.getName = function getName() {
var s = this.stack;
var len = s.length;
if (len > 1) {
return s[len - 2];
}
// Since the name is always a string, null is a safe sentinel value to
// return if we do not know the name of the (root) value.
return null;
};
// The value of the current property is always the final element of
// this.stack.
FPp.getValue = function getValue() {
var s = this.stack;
return s[s.length - 1];
};
FPp.valueIsDuplicate = function () {
var s = this.stack;
var valueIndex = s.length - 1;
return s.lastIndexOf(s[valueIndex], valueIndex - 1) >= 0;
};
function getNodeHelper(path, count) {
var s = path.stack;
for (var i = s.length - 1; i >= 0; i -= 2) {
var value = s[i];
if (n.Node.check(value) && --count < 0) {
return value;
}
}
return null;
}
FPp.getNode = function getNode(count) {
if (count === void 0) { count = 0; }
return getNodeHelper(this, ~~count);
};
FPp.getParentNode = function getParentNode(count) {
if (count === void 0) { count = 0; }
return getNodeHelper(this, ~~count + 1);
};
// The length of the stack can be either even or odd, depending on whether
// or not we have a name for the root value. The difference between the
// index of the root value and the index of the final value is always
// even, though, which allows us to return the root value in constant time
// (i.e. without iterating backwards through the stack).
FPp.getRootValue = function getRootValue() {
var s = this.stack;
if (s.length % 2 === 0) {
return s[1];
}
return s[0];
};
// Temporarily push properties named by string arguments given after the
// callback function onto this.stack, then call the callback with a
// reference to this (modified) FastPath object. Note that the stack will
// be restored to its original state after the callback is finished, so it
// is probably a mistake to retain a reference to the path.
FPp.call = function call(callback /*, name1, name2, ... */) {
var s = this.stack;
var origLen = s.length;
var value = s[origLen - 1];
var argc = arguments.length;
for (var i = 1; i < argc; ++i) {
var name = arguments[i];
value = value[name];
s.push(name, value);
}
var result = callback(this);
s.length = origLen;
return result;
};
// Similar to FastPath.prototype.call, except that the value obtained by
// accessing this.getValue()[name1][name2]... should be array-like. The
// callback will be called with a reference to this path object for each
// element of the array.
FPp.each = function each(callback /*, name1, name2, ... */) {
var s = this.stack;
var origLen = s.length;
var value = s[origLen - 1];
var argc = arguments.length;
for (var i = 1; i < argc; ++i) {
var name = arguments[i];
value = value[name];
s.push(name, value);
}
for (var i = 0; i < value.length; ++i) {
if (i in value) {
s.push(i, value[i]);
// If the callback needs to know the value of i, call
// path.getName(), assuming path is the parameter name.
callback(this);
s.length -= 2;
}
}
s.length = origLen;
};
// Similar to FastPath.prototype.each, except that the results of the
// callback function invocations are stored in an array and returned at
// the end of the iteration.
FPp.map = function map(callback /*, name1, name2, ... */) {
var s = this.stack;
var origLen = s.length;
var value = s[origLen - 1];
var argc = arguments.length;
for (var i = 1; i < argc; ++i) {
var name = arguments[i];
value = value[name];
s.push(name, value);
}
var result = new Array(value.length);
for (var i = 0; i < value.length; ++i) {
if (i in value) {
s.push(i, value[i]);
result[i] = callback(this, i);
s.length -= 2;
}
}
s.length = origLen;
return result;
};
// Returns true if the node at the tip of the path is wrapped with
// parentheses, OR if the only reason the node needed parentheses was that
// it couldn't be the first expression in the enclosing statement (see
// FastPath#canBeFirstInStatement), and it has an opening `(` character.
// For example, the FunctionExpression in `(function(){}())` appears to
// need parentheses only because it's the first expression in the AST, but
// since it happens to be preceded by a `(` (which is not apparent from
// the AST but can be determined using FastPath#getPrevToken), there is no
// ambiguity about how to parse it, so it counts as having parentheses,
// even though it is not immediately followed by a `)`.
FPp.hasParens = function () {
var node = this.getNode();
var prevToken = this.getPrevToken(node);
if (!prevToken) {
return false;
}
var nextToken = this.getNextToken(node);
if (!nextToken) {
return false;
}
if (prevToken.value === "(") {
if (nextToken.value === ")") {
// If the node preceded by a `(` token and followed by a `)` token,
// then of course it has parentheses.
return true;
}
// If this is one of the few Expression types that can't come first in
// the enclosing statement because of parsing ambiguities (namely,
// FunctionExpression, ObjectExpression, and ClassExpression) and
// this.firstInStatement() returns true, and the node would not need
// parentheses in an expression context because this.needsParens(true)
// returns false, then it just needs an opening parenthesis to resolve
// the parsing ambiguity that made it appear to need parentheses.
var justNeedsOpeningParen = !this.canBeFirstInStatement() &&
this.firstInStatement() &&
!this.needsParens(true);
if (justNeedsOpeningParen) {
return true;
}
}
return false;
};
FPp.getPrevToken = function (node) {
node = node || this.getNode();
var loc = node && node.loc;
var tokens = loc && loc.tokens;
if (tokens && loc.start.token > 0) {
var token = tokens[loc.start.token - 1];
if (token) {
// Do not return tokens that fall outside the root subtree.
var rootLoc = this.getRootValue().loc;
if (util.comparePos(rootLoc.start, token.loc.start) <= 0) {
return token;
}
}
}
return null;
};
FPp.getNextToken = function (node) {
node = node || this.getNode();
var loc = node && node.loc;
var tokens = loc && loc.tokens;
if (tokens && loc.end.token < tokens.length) {
var token = tokens[loc.end.token];
if (token) {
// Do not return tokens that fall outside the root subtree.
var rootLoc = this.getRootValue().loc;
if (util.comparePos(token.loc.end, rootLoc.end) <= 0) {
return token;
}
}
}
return null;
};
// Inspired by require("ast-types").NodePath.prototype.needsParens, but
// more efficient because we're iterating backwards through a stack.
FPp.needsParens = function (assumeExpressionContext) {
var node = this.getNode();
// This needs to come before `if (!parent) { return false }` because
// an object destructuring assignment requires parens for
// correctness even when it's the topmost expression.
if (node.type === "AssignmentExpression" &&
node.left.type === "ObjectPattern") {
return true;
}
var parent = this.getParentNode();
var name = this.getName();
// If the value of this path is some child of a Node and not a Node
// itself, then it doesn't need parentheses. Only Node objects (in fact,
// only Expression nodes) need parentheses.
if (this.getValue() !== node) {
return false;
}
// Only statements don't need parentheses.
if (n.Statement.check(node)) {
return false;
}
// Identifiers never need parentheses.
if (node.type === "Identifier") {
return false;
}
if (parent && parent.type === "ParenthesizedExpression") {
return false;
}
if (node.extra && node.extra.parenthesized) {
return true;
}
if (!parent)
return false;
// Wrap e.g. `-1` in parentheses inside `(-1) ** 2`.
if (node.type === "UnaryExpression" &&
parent.type === "BinaryExpression" &&
name === "left" &&
parent.left === node &&
parent.operator === "**") {
return true;
}
switch (node.type) {
case "UnaryExpression":
case "SpreadElement":
case "SpreadProperty":
return (parent.type === "MemberExpression" &&
name === "object" &&
parent.object === node);
case "BinaryExpression":
case "LogicalExpression":
switch (parent.type) {
case "CallExpression":
return name === "callee" && parent.callee === node;
case "UnaryExpression":
case "SpreadElement":
case "SpreadProperty":
return true;
case "MemberExpression":
return name === "object" && parent.object === node;
case "BinaryExpression":
case "LogicalExpression": {
var po = parent.operator;
var pp = PRECEDENCE[po];
var no = node.operator;
var np = PRECEDENCE[no];
if (pp > np) {
return true;
}
if (pp === np && name === "right") {
(0, tiny_invariant_1.default)(parent.right === node);
return true;
}
break;
}
default:
return false;
}
break;
case "SequenceExpression":
switch (parent.type) {
case "ReturnStatement":
return false;
case "ForStatement":
// Although parentheses wouldn't hurt around sequence expressions in
// the head of for loops, traditional style dictates that e.g. i++,
// j++ should not be wrapped with parentheses.
return false;
case "ExpressionStatement":
return name !== "expression";
default:
// Otherwise err on the side of overparenthesization, adding
// explicit exceptions above if this proves overzealous.
return true;
}
case "OptionalIndexedAccessType":
return node.optional && parent.type === "IndexedAccessType";
case "IntersectionTypeAnnotation":
case "UnionTypeAnnotation":
return parent.type === "NullableTypeAnnotation";
case "Literal":
return (parent.type === "MemberExpression" &&
isNumber.check(node.value) &&
name === "object" &&
parent.object === node);
// Babel 6 Literal split
case "NumericLiteral":
return (parent.type === "MemberExpression" &&
name === "object" &&
parent.object === node);
case "YieldExpression":
case "AwaitExpression":
case "AssignmentExpression":
case "ConditionalExpression":
switch (parent.type) {
case "UnaryExpression":
case "SpreadElement":
case "SpreadProperty":
case "BinaryExpression":
case "LogicalExpression":
return true;
case "CallExpression":
case "NewExpression":
return name === "callee" && parent.callee === node;
case "ConditionalExpression":
return name === "test" && parent.test === node;
case "MemberExpression":
return name === "object" && parent.object === node;
default:
return false;
}
case "ArrowFunctionExpression":
if (n.CallExpression.check(parent) &&
name === "callee" &&
parent.callee === node) {
return true;
}
if (n.MemberExpression.check(parent) &&
name === "object" &&
parent.object === node) {
return true;
}
if (n.TSAsExpression &&
n.TSAsExpression.check(parent) &&
name === "expression" &&
parent.expression === node) {
return true;
}
return isBinary(parent);
case "ObjectExpression":
if (parent.type === "ArrowFunctionExpression" &&
name === "body" &&
parent.body === node) {
return true;
}
break;
case "TSAsExpression":
if (parent.type === "ArrowFunctionExpression" &&
name === "body" &&
parent.body === node &&
node.expression.type === "ObjectExpression") {
return true;
}
break;
case "CallExpression":
if (name === "declaration" &&
n.ExportDefaultDeclaration.check(parent) &&
n.FunctionExpression.check(node.callee)) {
return true;
}
}
if (parent.type === "NewExpression" &&
name === "callee" &&
parent.callee === node) {
return containsCallExpression(node);
}
if (assumeExpressionContext !== true &&
!this.canBeFirstInStatement() &&
this.firstInStatement()) {
return true;
}
return false;
};
function isBinary(node) {
return n.BinaryExpression.check(node) || n.LogicalExpression.check(node);
}
// @ts-ignore 'isUnaryLike' is declared but its value is never read. [6133]
function isUnaryLike(node) {
return (n.UnaryExpression.check(node) ||
// I considered making SpreadElement and SpreadProperty subtypes of
// UnaryExpression, but they're not really Expression nodes.
(n.SpreadElement && n.SpreadElement.check(node)) ||
(n.SpreadProperty && n.SpreadProperty.check(node)));
}
function containsCallExpression(node) {
if (n.CallExpression.check(node)) {
return true;
}
if (isArray.check(node)) {
return node.some(containsCallExpression);
}
if (n.Node.check(node)) {
return types.someField(node, function (_name, child) {
return containsCallExpression(child);
});
}
return false;
}
FPp.canBeFirstInStatement = function () {
var node = this.getNode();
if (n.FunctionExpression.check(node)) {
return false;
}
if (n.ObjectExpression.check(node)) {
return false;
}
if (n.ClassExpression.check(node)) {
return false;
}
return true;
};
FPp.firstInStatement = function () {
var s = this.stack;
var parentName, parent;
var childName, child;
for (var i = s.length - 1; i >= 0; i -= 2) {
if (n.Node.check(s[i])) {
childName = parentName;
child = parent;
parentName = s[i - 1];
parent = s[i];
}
if (!parent || !child) {
continue;
}
if (n.BlockStatement.check(parent) &&
parentName === "body" &&
childName === 0) {
(0, tiny_invariant_1.default)(parent.body[0] === child);
return true;
}
if (n.ExpressionStatement.check(parent) && childName === "expression") {
(0, tiny_invariant_1.default)(parent.expression === child);
return true;
}
if (n.AssignmentExpression.check(parent) && childName === "left") {
(0, tiny_invariant_1.default)(parent.left === child);
return true;
}
if (n.ArrowFunctionExpression.check(parent) && childName === "body") {
(0, tiny_invariant_1.default)(parent.body === child);
return true;
}
// s[i + 1] and s[i + 2] represent the array between the parent
// SequenceExpression node and its child nodes
if (n.SequenceExpression.check(parent) &&
s[i + 1] === "expressions" &&
childName === 0) {
(0, tiny_invariant_1.default)(parent.expressions[0] === child);
continue;
}
if (n.CallExpression.check(parent) && childName === "callee") {
(0, tiny_invariant_1.default)(parent.callee === child);
continue;
}
if (n.MemberExpression.check(parent) && childName === "object") {
(0, tiny_invariant_1.default)(parent.object === child);
continue;
}
if (n.ConditionalExpression.check(parent) && childName === "test") {
(0, tiny_invariant_1.default)(parent.test === child);
continue;
}
if (isBinary(parent) && childName === "left") {
(0, tiny_invariant_1.default)(parent.left === child);
continue;
}
if (n.UnaryExpression.check(parent) &&
!parent.prefix &&
childName === "argument") {
(0, tiny_invariant_1.default)(parent.argument === child);
continue;
}
return false;
}
return true;
};
exports["default"] = FastPath;
/***/ }),
/***/ "./node_modules/recast/lib/lines.js":
/*!******************************************!*\
!*** ./node_modules/recast/lib/lines.js ***!
\******************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.concat = exports.fromString = exports.countSpaces = exports.Lines = void 0;
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var tiny_invariant_1 = tslib_1.__importDefault(__webpack_require__(/*! tiny-invariant */ "./node_modules/tiny-invariant/dist/tiny-invariant.cjs.js"));
var source_map_1 = tslib_1.__importDefault(__webpack_require__(/*! source-map */ "./node_modules/recast/node_modules/source-map/source-map.js"));
var options_1 = __webpack_require__(/*! ./options */ "./node_modules/recast/lib/options.js");
var util_1 = __webpack_require__(/*! ./util */ "./node_modules/recast/lib/util.js");
var mapping_1 = tslib_1.__importDefault(__webpack_require__(/*! ./mapping */ "./node_modules/recast/lib/mapping.js"));
var Lines = /** @class */ (function () {
function Lines(infos, sourceFileName) {
if (sourceFileName === void 0) { sourceFileName = null; }
this.infos = infos;
this.mappings = [];
this.cachedSourceMap = null;
this.cachedTabWidth = void 0;
(0, tiny_invariant_1.default)(infos.length > 0);
this.length = infos.length;
this.name = sourceFileName || null;
if (this.name) {
this.mappings.push(new mapping_1.default(this, {
start: this.firstPos(),
end: this.lastPos(),
}));
}
}
Lines.prototype.toString = function (options) {
return this.sliceString(this.firstPos(), this.lastPos(), options);
};
Lines.prototype.getSourceMap = function (sourceMapName, sourceRoot) {
if (!sourceMapName) {
// Although we could make up a name or generate an anonymous
// source map, instead we assume that any consumer who does not
// provide a name does not actually want a source map.
return null;
}
var targetLines = this;
function updateJSON(json) {
json = json || {};
json.file = sourceMapName;
if (sourceRoot) {
json.sourceRoot = sourceRoot;
}
return json;
}
if (targetLines.cachedSourceMap) {
// Since Lines objects are immutable, we can reuse any source map
// that was previously generated. Nevertheless, we return a new
// JSON object here to protect the cached source map from outside
// modification.
return updateJSON(targetLines.cachedSourceMap.toJSON());
}
var smg = new source_map_1.default.SourceMapGenerator(updateJSON());
var sourcesToContents = {};
targetLines.mappings.forEach(function (mapping) {
var sourceCursor = mapping.sourceLines.skipSpaces(mapping.sourceLoc.start) ||
mapping.sourceLines.lastPos();
var targetCursor = targetLines.skipSpaces(mapping.targetLoc.start) ||
targetLines.lastPos();
while ((0, util_1.comparePos)(sourceCursor, mapping.sourceLoc.end) < 0 &&
(0, util_1.comparePos)(targetCursor, mapping.targetLoc.end) < 0) {
var sourceChar = mapping.sourceLines.charAt(sourceCursor);
var targetChar = targetLines.charAt(targetCursor);
(0, tiny_invariant_1.default)(sourceChar === targetChar);
var sourceName = mapping.sourceLines.name;
// Add mappings one character at a time for maximum resolution.
smg.addMapping({
source: sourceName,
original: { line: sourceCursor.line, column: sourceCursor.column },
generated: { line: targetCursor.line, column: targetCursor.column },
});
if (!hasOwn.call(sourcesToContents, sourceName)) {
var sourceContent = mapping.sourceLines.toString();
smg.setSourceContent(sourceName, sourceContent);
sourcesToContents[sourceName] = sourceContent;
}
targetLines.nextPos(targetCursor, true);
mapping.sourceLines.nextPos(sourceCursor, true);
}
});
targetLines.cachedSourceMap = smg;
return smg.toJSON();
};
Lines.prototype.bootstrapCharAt = function (pos) {
(0, tiny_invariant_1.default)(typeof pos === "object");
(0, tiny_invariant_1.default)(typeof pos.line === "number");
(0, tiny_invariant_1.default)(typeof pos.column === "number");
var line = pos.line, column = pos.column, strings = this.toString().split(lineTerminatorSeqExp), string = strings[line - 1];
if (typeof string === "undefined")
return "";
if (column === string.length && line < strings.length)
return "\n";
if (column >= string.length)
return "";
return string.charAt(column);
};
Lines.prototype.charAt = function (pos) {
(0, tiny_invariant_1.default)(typeof pos === "object");
(0, tiny_invariant_1.default)(typeof pos.line === "number");
(0, tiny_invariant_1.default)(typeof pos.column === "number");
var line = pos.line, column = pos.column, secret = this, infos = secret.infos, info = infos[line - 1], c = column;
if (typeof info === "undefined" || c < 0)
return "";
var indent = this.getIndentAt(line);
if (c < indent)
return " ";
c += info.sliceStart - indent;
if (c === info.sliceEnd && line < this.length)
return "\n";
if (c >= info.sliceEnd)
return "";
return info.line.charAt(c);
};
Lines.prototype.stripMargin = function (width, skipFirstLine) {
if (width === 0)
return this;
(0, tiny_invariant_1.default)(width > 0, "negative margin: " + width);
if (skipFirstLine && this.length === 1)
return this;
var lines = new Lines(this.infos.map(function (info, i) {
if (info.line && (i > 0 || !skipFirstLine)) {
info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: Math.max(0, info.indent - width) });
}
return info;
}));
if (this.mappings.length > 0) {
var newMappings_1 = lines.mappings;
(0, tiny_invariant_1.default)(newMappings_1.length === 0);
this.mappings.forEach(function (mapping) {
newMappings_1.push(mapping.indent(width, skipFirstLine, true));
});
}
return lines;
};
Lines.prototype.indent = function (by) {
if (by === 0) {
return this;
}
var lines = new Lines(this.infos.map(function (info) {
if (info.line && !info.locked) {
info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: info.indent + by });
}
return info;
}));
if (this.mappings.length > 0) {
var newMappings_2 = lines.mappings;
(0, tiny_invariant_1.default)(newMappings_2.length === 0);
this.mappings.forEach(function (mapping) {
newMappings_2.push(mapping.indent(by));
});
}
return lines;
};
Lines.prototype.indentTail = function (by) {
if (by === 0) {
return this;
}
if (this.length < 2) {
return this;
}
var lines = new Lines(this.infos.map(function (info, i) {
if (i > 0 && info.line && !info.locked) {
info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: info.indent + by });
}
return info;
}));
if (this.mappings.length > 0) {
var newMappings_3 = lines.mappings;
(0, tiny_invariant_1.default)(newMappings_3.length === 0);
this.mappings.forEach(function (mapping) {
newMappings_3.push(mapping.indent(by, true));
});
}
return lines;
};
Lines.prototype.lockIndentTail = function () {
if (this.length < 2) {
return this;
}
return new Lines(this.infos.map(function (info, i) { return (tslib_1.__assign(tslib_1.__assign({}, info), { locked: i > 0 })); }));
};
Lines.prototype.getIndentAt = function (line) {
(0, tiny_invariant_1.default)(line >= 1, "no line " + line + " (line numbers start from 1)");
return Math.max(this.infos[line - 1].indent, 0);
};
Lines.prototype.guessTabWidth = function () {
if (typeof this.cachedTabWidth === "number") {
return this.cachedTabWidth;
}
var counts = []; // Sparse array.
var lastIndent = 0;
for (var line = 1, last = this.length; line <= last; ++line) {
var info = this.infos[line - 1];
var sliced = info.line.slice(info.sliceStart, info.sliceEnd);
// Whitespace-only lines don't tell us much about the likely tab
// width of this code.
if (isOnlyWhitespace(sliced)) {
continue;
}
var diff = Math.abs(info.indent - lastIndent);
counts[diff] = ~~counts[diff] + 1;
lastIndent = info.indent;
}
var maxCount = -1;
var result = 2;
for (var tabWidth = 1; tabWidth < counts.length; tabWidth += 1) {
if (hasOwn.call(counts, tabWidth) && counts[tabWidth] > maxCount) {
maxCount = counts[tabWidth];
result = tabWidth;
}
}
return (this.cachedTabWidth = result);
};
// Determine if the list of lines has a first line that starts with a //
// or /* comment. If this is the case, the code may need to be wrapped in
// parens to avoid ASI issues.
Lines.prototype.startsWithComment = function () {
if (this.infos.length === 0) {
return false;
}
var firstLineInfo = this.infos[0], sliceStart = firstLineInfo.sliceStart, sliceEnd = firstLineInfo.sliceEnd, firstLine = firstLineInfo.line.slice(sliceStart, sliceEnd).trim();
return (firstLine.length === 0 ||
firstLine.slice(0, 2) === "//" ||
firstLine.slice(0, 2) === "/*");
};
Lines.prototype.isOnlyWhitespace = function () {
return isOnlyWhitespace(this.toString());
};
Lines.prototype.isPrecededOnlyByWhitespace = function (pos) {
var info = this.infos[pos.line - 1];
var indent = Math.max(info.indent, 0);
var diff = pos.column - indent;
if (diff <= 0) {
// If pos.column does not exceed the indentation amount, then
// there must be only whitespace before it.
return true;
}
var start = info.sliceStart;
var end = Math.min(start + diff, info.sliceEnd);
var prefix = info.line.slice(start, end);
return isOnlyWhitespace(prefix);
};
Lines.prototype.getLineLength = function (line) {
var info = this.infos[line - 1];
return this.getIndentAt(line) + info.sliceEnd - info.sliceStart;
};
Lines.prototype.nextPos = function (pos, skipSpaces) {
if (skipSpaces === void 0) { skipSpaces = false; }
var l = Math.max(pos.line, 0), c = Math.max(pos.column, 0);
if (c < this.getLineLength(l)) {
pos.column += 1;
return skipSpaces ? !!this.skipSpaces(pos, false, true) : true;
}
if (l < this.length) {
pos.line += 1;
pos.column = 0;
return skipSpaces ? !!this.skipSpaces(pos, false, true) : true;
}
return false;
};
Lines.prototype.prevPos = function (pos, skipSpaces) {
if (skipSpaces === void 0) { skipSpaces = false; }
var l = pos.line, c = pos.column;
if (c < 1) {
l -= 1;
if (l < 1)
return false;
c = this.getLineLength(l);
}
else {
c = Math.min(c - 1, this.getLineLength(l));
}
pos.line = l;
pos.column = c;
return skipSpaces ? !!this.skipSpaces(pos, true, true) : true;
};
Lines.prototype.firstPos = function () {
// Trivial, but provided for completeness.
return { line: 1, column: 0 };
};
Lines.prototype.lastPos = function () {
return {
line: this.length,
column: this.getLineLength(this.length),
};
};
Lines.prototype.skipSpaces = function (pos, backward, modifyInPlace) {
if (backward === void 0) { backward = false; }
if (modifyInPlace === void 0) { modifyInPlace = false; }
if (pos) {
pos = modifyInPlace
? pos
: {
line: pos.line,
column: pos.column,
};
}
else if (backward) {
pos = this.lastPos();
}
else {
pos = this.firstPos();
}
if (backward) {
while (this.prevPos(pos)) {
if (!isOnlyWhitespace(this.charAt(pos)) && this.nextPos(pos)) {
return pos;
}
}
return null;
}
else {
while (isOnlyWhitespace(this.charAt(pos))) {
if (!this.nextPos(pos)) {
return null;
}
}
return pos;
}
};
Lines.prototype.trimLeft = function () {
var pos = this.skipSpaces(this.firstPos(), false, true);
return pos ? this.slice(pos) : emptyLines;
};
Lines.prototype.trimRight = function () {
var pos = this.skipSpaces(this.lastPos(), true, true);
return pos ? this.slice(this.firstPos(), pos) : emptyLines;
};
Lines.prototype.trim = function () {
var start = this.skipSpaces(this.firstPos(), false, true);
if (start === null) {
return emptyLines;
}
var end = this.skipSpaces(this.lastPos(), true, true);
if (end === null) {
return emptyLines;
}
return this.slice(start, end);
};
Lines.prototype.eachPos = function (callback, startPos, skipSpaces) {
if (startPos === void 0) { startPos = this.firstPos(); }
if (skipSpaces === void 0) { skipSpaces = false; }
var pos = this.firstPos();
if (startPos) {
(pos.line = startPos.line), (pos.column = startPos.column);
}
if (skipSpaces && !this.skipSpaces(pos, false, true)) {
return; // Encountered nothing but spaces.
}
do
callback.call(this, pos);
while (this.nextPos(pos, skipSpaces));
};
Lines.prototype.bootstrapSlice = function (start, end) {
var strings = this.toString()
.split(lineTerminatorSeqExp)
.slice(start.line - 1, end.line);
if (strings.length > 0) {
strings.push(strings.pop().slice(0, end.column));
strings[0] = strings[0].slice(start.column);
}
return fromString(strings.join("\n"));
};
Lines.prototype.slice = function (start, end) {
if (!end) {
if (!start) {
// The client seems to want a copy of this Lines object, but
// Lines objects are immutable, so it's perfectly adequate to
// return the same object.
return this;
}
// Slice to the end if no end position was provided.
end = this.lastPos();
}
if (!start) {
throw new Error("cannot slice with end but not start");
}
var sliced = this.infos.slice(start.line - 1, end.line);
if (start.line === end.line) {
sliced[0] = sliceInfo(sliced[0], start.column, end.column);
}
else {
(0, tiny_invariant_1.default)(start.line < end.line);
sliced[0] = sliceInfo(sliced[0], start.column);
sliced.push(sliceInfo(sliced.pop(), 0, end.column));
}
var lines = new Lines(sliced);
if (this.mappings.length > 0) {
var newMappings_4 = lines.mappings;
(0, tiny_invariant_1.default)(newMappings_4.length === 0);
this.mappings.forEach(function (mapping) {
var sliced = mapping.slice(this, start, end);
if (sliced) {
newMappings_4.push(sliced);
}
}, this);
}
return lines;
};
Lines.prototype.bootstrapSliceString = function (start, end, options) {
return this.slice(start, end).toString(options);
};
Lines.prototype.sliceString = function (start, end, options) {
if (start === void 0) { start = this.firstPos(); }
if (end === void 0) { end = this.lastPos(); }
var _a = (0, options_1.normalize)(options), tabWidth = _a.tabWidth, useTabs = _a.useTabs, reuseWhitespace = _a.reuseWhitespace, lineTerminator = _a.lineTerminator;
var parts = [];
for (var line = start.line; line <= end.line; ++line) {
var info = this.infos[line - 1];
if (line === start.line) {
if (line === end.line) {
info = sliceInfo(info, start.column, end.column);
}
else {
info = sliceInfo(info, start.column);
}
}
else if (line === end.line) {
info = sliceInfo(info, 0, end.column);
}
var indent = Math.max(info.indent, 0);
var before_1 = info.line.slice(0, info.sliceStart);
if (reuseWhitespace &&
isOnlyWhitespace(before_1) &&
countSpaces(before_1, tabWidth) === indent) {
// Reuse original spaces if the indentation is correct.
parts.push(info.line.slice(0, info.sliceEnd));
continue;
}
var tabs = 0;
var spaces = indent;
if (useTabs) {
tabs = Math.floor(indent / tabWidth);
spaces -= tabs * tabWidth;
}
var result = "";
if (tabs > 0) {
result += new Array(tabs + 1).join("\t");
}
if (spaces > 0) {
result += new Array(spaces + 1).join(" ");
}
result += info.line.slice(info.sliceStart, info.sliceEnd);
parts.push(result);
}
return parts.join(lineTerminator);
};
Lines.prototype.isEmpty = function () {
return this.length < 2 && this.getLineLength(1) < 1;
};
Lines.prototype.join = function (elements) {
var separator = this;
var infos = [];
var mappings = [];
var prevInfo;
function appendLines(linesOrNull) {
if (linesOrNull === null) {
return;
}
if (prevInfo) {
var info = linesOrNull.infos[0];
var indent = new Array(info.indent + 1).join(" ");
var prevLine_1 = infos.length;
var prevColumn_1 = Math.max(prevInfo.indent, 0) +
prevInfo.sliceEnd -
prevInfo.sliceStart;
prevInfo.line =
prevInfo.line.slice(0, prevInfo.sliceEnd) +
indent +
info.line.slice(info.sliceStart, info.sliceEnd);
// If any part of a line is indentation-locked, the whole line
// will be indentation-locked.
prevInfo.locked = prevInfo.locked || info.locked;
prevInfo.sliceEnd = prevInfo.line.length;
if (linesOrNull.mappings.length > 0) {
linesOrNull.mappings.forEach(function (mapping) {
mappings.push(mapping.add(prevLine_1, prevColumn_1));
});
}
}
else if (linesOrNull.mappings.length > 0) {
mappings.push.apply(mappings, linesOrNull.mappings);
}
linesOrNull.infos.forEach(function (info, i) {
if (!prevInfo || i > 0) {
prevInfo = tslib_1.__assign({}, info);
infos.push(prevInfo);
}
});
}
function appendWithSeparator(linesOrNull, i) {
if (i > 0)
appendLines(separator);
appendLines(linesOrNull);
}
elements
.map(function (elem) {
var lines = fromString(elem);
if (lines.isEmpty())
return null;
return lines;
})
.forEach(function (linesOrNull, i) {
if (separator.isEmpty()) {
appendLines(linesOrNull);
}
else {
appendWithSeparator(linesOrNull, i);
}
});
if (infos.length < 1)
return emptyLines;
var lines = new Lines(infos);
lines.mappings = mappings;
return lines;
};
Lines.prototype.concat = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var list = [this];
list.push.apply(list, args);
(0, tiny_invariant_1.default)(list.length === args.length + 1);
return emptyLines.join(list);
};
return Lines;
}());
exports.Lines = Lines;
var fromStringCache = {};
var hasOwn = fromStringCache.hasOwnProperty;
var maxCacheKeyLen = 10;
function countSpaces(spaces, tabWidth) {
var count = 0;
var len = spaces.length;
for (var i = 0; i < len; ++i) {
switch (spaces.charCodeAt(i)) {
case 9: {
// '\t'
(0, tiny_invariant_1.default)(typeof tabWidth === "number");
(0, tiny_invariant_1.default)(tabWidth > 0);
var next = Math.ceil(count / tabWidth) * tabWidth;
if (next === count) {
count += tabWidth;
}
else {
count = next;
}
break;
}
case 11: // '\v'
case 12: // '\f'
case 13: // '\r'
case 0xfeff: // zero-width non-breaking space
// These characters contribute nothing to indentation.
break;
case 32: // ' '
default:
// Treat all other whitespace like ' '.
count += 1;
break;
}
}
return count;
}
exports.countSpaces = countSpaces;
var leadingSpaceExp = /^\s*/;
// As specified here: http://www.ecma-international.org/ecma-262/6.0/#sec-line-terminators
var lineTerminatorSeqExp = /\u000D\u000A|\u000D(?!\u000A)|\u000A|\u2028|\u2029/;
/**
* @param {Object} options - Options object that configures printing.
*/
function fromString(string, options) {
if (string instanceof Lines)
return string;
string += "";
var tabWidth = options && options.tabWidth;
var tabless = string.indexOf("\t") < 0;
var cacheable = !options && tabless && string.length <= maxCacheKeyLen;
(0, tiny_invariant_1.default)(tabWidth || tabless, "No tab width specified but encountered tabs in string\n" + string);
if (cacheable && hasOwn.call(fromStringCache, string))
return fromStringCache[string];
var lines = new Lines(string.split(lineTerminatorSeqExp).map(function (line) {
// TODO: handle null exec result
var spaces = leadingSpaceExp.exec(line)[0];
return {
line: line,
indent: countSpaces(spaces, tabWidth),
// Boolean indicating whether this line can be reindented.
locked: false,
sliceStart: spaces.length,
sliceEnd: line.length,
};
}), (0, options_1.normalize)(options).sourceFileName);
if (cacheable)
fromStringCache[string] = lines;
return lines;
}
exports.fromString = fromString;
function isOnlyWhitespace(string) {
return !/\S/.test(string);
}
function sliceInfo(info, startCol, endCol) {
var sliceStart = info.sliceStart;
var sliceEnd = info.sliceEnd;
var indent = Math.max(info.indent, 0);
var lineLength = indent + sliceEnd - sliceStart;
if (typeof endCol === "undefined") {
endCol = lineLength;
}
startCol = Math.max(startCol, 0);
endCol = Math.min(endCol, lineLength);
endCol = Math.max(endCol, startCol);
if (endCol < indent) {
indent = endCol;
sliceEnd = sliceStart;
}
else {
sliceEnd -= lineLength - endCol;
}
lineLength = endCol;
lineLength -= startCol;
if (startCol < indent) {
indent -= startCol;
}
else {
startCol -= indent;
indent = 0;
sliceStart += startCol;
}
(0, tiny_invariant_1.default)(indent >= 0);
(0, tiny_invariant_1.default)(sliceStart <= sliceEnd);
(0, tiny_invariant_1.default)(lineLength === indent + sliceEnd - sliceStart);
if (info.indent === indent &&
info.sliceStart === sliceStart &&
info.sliceEnd === sliceEnd) {
return info;
}
return {
line: info.line,
indent: indent,
// A destructive slice always unlocks indentation.
locked: false,
sliceStart: sliceStart,
sliceEnd: sliceEnd,
};
}
function concat(elements) {
return emptyLines.join(elements);
}
exports.concat = concat;
// The emptyLines object needs to be created all the way down here so that
// Lines.prototype will be fully populated.
var emptyLines = fromString("");
/***/ }),
/***/ "./node_modules/recast/lib/mapping.js":
/*!********************************************!*\
!*** ./node_modules/recast/lib/mapping.js ***!
\********************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var tiny_invariant_1 = tslib_1.__importDefault(__webpack_require__(/*! tiny-invariant */ "./node_modules/tiny-invariant/dist/tiny-invariant.cjs.js"));
var util_1 = __webpack_require__(/*! ./util */ "./node_modules/recast/lib/util.js");
var Mapping = /** @class */ (function () {
function Mapping(sourceLines, sourceLoc, targetLoc) {
if (targetLoc === void 0) { targetLoc = sourceLoc; }
this.sourceLines = sourceLines;
this.sourceLoc = sourceLoc;
this.targetLoc = targetLoc;
}
Mapping.prototype.slice = function (lines, start, end) {
if (end === void 0) { end = lines.lastPos(); }
var sourceLines = this.sourceLines;
var sourceLoc = this.sourceLoc;
var targetLoc = this.targetLoc;
function skip(name) {
var sourceFromPos = sourceLoc[name];
var targetFromPos = targetLoc[name];
var targetToPos = start;
if (name === "end") {
targetToPos = end;
}
else {
(0, tiny_invariant_1.default)(name === "start");
}
return skipChars(sourceLines, sourceFromPos, lines, targetFromPos, targetToPos);
}
if ((0, util_1.comparePos)(start, targetLoc.start) <= 0) {
if ((0, util_1.comparePos)(targetLoc.end, end) <= 0) {
targetLoc = {
start: subtractPos(targetLoc.start, start.line, start.column),
end: subtractPos(targetLoc.end, start.line, start.column),
};
// The sourceLoc can stay the same because the contents of the
// targetLoc have not changed.
}
else if ((0, util_1.comparePos)(end, targetLoc.start) <= 0) {
return null;
}
else {
sourceLoc = {
start: sourceLoc.start,
end: skip("end"),
};
targetLoc = {
start: subtractPos(targetLoc.start, start.line, start.column),
end: subtractPos(end, start.line, start.column),
};
}
}
else {
if ((0, util_1.comparePos)(targetLoc.end, start) <= 0) {
return null;
}
if ((0, util_1.comparePos)(targetLoc.end, end) <= 0) {
sourceLoc = {
start: skip("start"),
end: sourceLoc.end,
};
targetLoc = {
// Same as subtractPos(start, start.line, start.column):
start: { line: 1, column: 0 },
end: subtractPos(targetLoc.end, start.line, start.column),
};
}
else {
sourceLoc = {
start: skip("start"),
end: skip("end"),
};
targetLoc = {
// Same as subtractPos(start, start.line, start.column):
start: { line: 1, column: 0 },
end: subtractPos(end, start.line, start.column),
};
}
}
return new Mapping(this.sourceLines, sourceLoc, targetLoc);
};
Mapping.prototype.add = function (line, column) {
return new Mapping(this.sourceLines, this.sourceLoc, {
start: addPos(this.targetLoc.start, line, column),
end: addPos(this.targetLoc.end, line, column),
});
};
Mapping.prototype.subtract = function (line, column) {
return new Mapping(this.sourceLines, this.sourceLoc, {
start: subtractPos(this.targetLoc.start, line, column),
end: subtractPos(this.targetLoc.end, line, column),
});
};
Mapping.prototype.indent = function (by, skipFirstLine, noNegativeColumns) {
if (skipFirstLine === void 0) { skipFirstLine = false; }
if (noNegativeColumns === void 0) { noNegativeColumns = false; }
if (by === 0) {
return this;
}
var targetLoc = this.targetLoc;
var startLine = targetLoc.start.line;
var endLine = targetLoc.end.line;
if (skipFirstLine && startLine === 1 && endLine === 1) {
return this;
}
targetLoc = {
start: targetLoc.start,
end: targetLoc.end,
};
if (!skipFirstLine || startLine > 1) {
var startColumn = targetLoc.start.column + by;
targetLoc.start = {
line: startLine,
column: noNegativeColumns ? Math.max(0, startColumn) : startColumn,
};
}
if (!skipFirstLine || endLine > 1) {
var endColumn = targetLoc.end.column + by;
targetLoc.end = {
line: endLine,
column: noNegativeColumns ? Math.max(0, endColumn) : endColumn,
};
}
return new Mapping(this.sourceLines, this.sourceLoc, targetLoc);
};
return Mapping;
}());
exports["default"] = Mapping;
function addPos(toPos, line, column) {
return {
line: toPos.line + line - 1,
column: toPos.line === 1 ? toPos.column + column : toPos.column,
};
}
function subtractPos(fromPos, line, column) {
return {
line: fromPos.line - line + 1,
column: fromPos.line === line ? fromPos.column - column : fromPos.column,
};
}
function skipChars(sourceLines, sourceFromPos, targetLines, targetFromPos, targetToPos) {
var targetComparison = (0, util_1.comparePos)(targetFromPos, targetToPos);
if (targetComparison === 0) {
// Trivial case: no characters to skip.
return sourceFromPos;
}
var sourceCursor, targetCursor;
if (targetComparison < 0) {
// Skipping forward.
sourceCursor =
sourceLines.skipSpaces(sourceFromPos) || sourceLines.lastPos();
targetCursor =
targetLines.skipSpaces(targetFromPos) || targetLines.lastPos();
var lineDiff = targetToPos.line - targetCursor.line;
sourceCursor.line += lineDiff;
targetCursor.line += lineDiff;
if (lineDiff > 0) {
// If jumping to later lines, reset columns to the beginnings
// of those lines.
sourceCursor.column = 0;
targetCursor.column = 0;
}
else {
(0, tiny_invariant_1.default)(lineDiff === 0);
}
while ((0, util_1.comparePos)(targetCursor, targetToPos) < 0 &&
targetLines.nextPos(targetCursor, true)) {
(0, tiny_invariant_1.default)(sourceLines.nextPos(sourceCursor, true));
(0, tiny_invariant_1.default)(sourceLines.charAt(sourceCursor) === targetLines.charAt(targetCursor));
}
}
else {
// Skipping backward.
sourceCursor =
sourceLines.skipSpaces(sourceFromPos, true) || sourceLines.firstPos();
targetCursor =
targetLines.skipSpaces(targetFromPos, true) || targetLines.firstPos();
var lineDiff = targetToPos.line - targetCursor.line;
sourceCursor.line += lineDiff;
targetCursor.line += lineDiff;
if (lineDiff < 0) {
// If jumping to earlier lines, reset columns to the ends of
// those lines.
sourceCursor.column = sourceLines.getLineLength(sourceCursor.line);
targetCursor.column = targetLines.getLineLength(targetCursor.line);
}
else {
(0, tiny_invariant_1.default)(lineDiff === 0);
}
while ((0, util_1.comparePos)(targetToPos, targetCursor) < 0 &&
targetLines.prevPos(targetCursor, true)) {
(0, tiny_invariant_1.default)(sourceLines.prevPos(sourceCursor, true));
(0, tiny_invariant_1.default)(sourceLines.charAt(sourceCursor) === targetLines.charAt(targetCursor));
}
}
return sourceCursor;
}
/***/ }),
/***/ "./node_modules/recast/lib/options.js":
/*!********************************************!*\
!*** ./node_modules/recast/lib/options.js ***!
\********************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.normalize = void 0;
var util_1 = __webpack_require__(/*! ./util */ "./node_modules/recast/lib/util.js");
var defaults = {
parser: __webpack_require__(/*! ../parsers/esprima */ "./node_modules/recast/parsers/esprima.js"),
tabWidth: 4,
useTabs: false,
reuseWhitespace: true,
lineTerminator: (0, util_1.getLineTerminator)(),
wrapColumn: 74,
sourceFileName: null,
sourceMapName: null,
sourceRoot: null,
inputSourceMap: null,
range: false,
tolerant: true,
quote: null,
trailingComma: false,
arrayBracketSpacing: false,
objectCurlySpacing: true,
arrowParensAlways: false,
flowObjectCommas: true,
tokens: true,
};
var hasOwn = defaults.hasOwnProperty;
// Copy options and fill in default values.
function normalize(opts) {
var options = opts || defaults;
function get(key) {
return hasOwn.call(options, key) ? options[key] : defaults[key];
}
return {
tabWidth: +get("tabWidth"),
useTabs: !!get("useTabs"),
reuseWhitespace: !!get("reuseWhitespace"),
lineTerminator: get("lineTerminator"),
wrapColumn: Math.max(get("wrapColumn"), 0),
sourceFileName: get("sourceFileName"),
sourceMapName: get("sourceMapName"),
sourceRoot: get("sourceRoot"),
inputSourceMap: get("inputSourceMap"),
parser: get("esprima") || get("parser"),
range: get("range"),
tolerant: get("tolerant"),
quote: get("quote"),
trailingComma: get("trailingComma"),
arrayBracketSpacing: get("arrayBracketSpacing"),
objectCurlySpacing: get("objectCurlySpacing"),
arrowParensAlways: get("arrowParensAlways"),
flowObjectCommas: get("flowObjectCommas"),
tokens: !!get("tokens"),
};
}
exports.normalize = normalize;
/***/ }),
/***/ "./node_modules/recast/lib/parser.js":
/*!*******************************************!*\
!*** ./node_modules/recast/lib/parser.js ***!
\*******************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.parse = void 0;
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var tiny_invariant_1 = tslib_1.__importDefault(__webpack_require__(/*! tiny-invariant */ "./node_modules/tiny-invariant/dist/tiny-invariant.cjs.js"));
var types = tslib_1.__importStar(__webpack_require__(/*! ast-types */ "./node_modules/ast-types/lib/main.js"));
var b = types.builders;
var isObject = types.builtInTypes.object;
var isArray = types.builtInTypes.array;
var options_1 = __webpack_require__(/*! ./options */ "./node_modules/recast/lib/options.js");
var lines_1 = __webpack_require__(/*! ./lines */ "./node_modules/recast/lib/lines.js");
var comments_1 = __webpack_require__(/*! ./comments */ "./node_modules/recast/lib/comments.js");
var util = tslib_1.__importStar(__webpack_require__(/*! ./util */ "./node_modules/recast/lib/util.js"));
function parse(source, options) {
options = (0, options_1.normalize)(options);
var lines = (0, lines_1.fromString)(source, options);
var sourceWithoutTabs = lines.toString({
tabWidth: options.tabWidth,
reuseWhitespace: false,
useTabs: false,
});
var comments = [];
var ast = options.parser.parse(sourceWithoutTabs, {
jsx: true,
loc: true,
locations: true,
range: options.range,
comment: true,
onComment: comments,
tolerant: util.getOption(options, "tolerant", true),
ecmaVersion: 6,
sourceType: util.getOption(options, "sourceType", "module"),
});
// Use ast.tokens if possible, and otherwise fall back to the Esprima
// tokenizer. All the preconfigured ../parsers/* expose ast.tokens
// automatically, but custom parsers might need additional configuration
// to avoid this fallback.
var tokens = Array.isArray(ast.tokens)
? ast.tokens
: (__webpack_require__(/*! esprima */ "./node_modules/esprima/dist/esprima.js").tokenize)(sourceWithoutTabs, {
loc: true,
});
// We will reattach the tokens array to the file object below.
delete ast.tokens;
// Make sure every token has a token.value string.
tokens.forEach(function (token) {
if (typeof token.value !== "string") {
token.value = lines.sliceString(token.loc.start, token.loc.end);
}
});
if (Array.isArray(ast.comments)) {
comments = ast.comments;
delete ast.comments;
}
if (ast.loc) {
// If the source was empty, some parsers give loc.{start,end}.line
// values of 0, instead of the minimum of 1.
util.fixFaultyLocations(ast, lines);
}
else {
ast.loc = {
start: lines.firstPos(),
end: lines.lastPos(),
};
}
ast.loc.lines = lines;
ast.loc.indent = 0;
var file;
var program;
if (ast.type === "Program") {
program = ast;
// In order to ensure we reprint leading and trailing program
// comments, wrap the original Program node with a File node. Only
// ESTree parsers (Acorn and Esprima) return a Program as the root AST
// node. Most other (Babylon-like) parsers return a File.
file = b.file(ast, options.sourceFileName || null);
file.loc = {
start: lines.firstPos(),
end: lines.lastPos(),
lines: lines,
indent: 0,
};
}
else if (ast.type === "File") {
file = ast;
program = file.program;
}
// Expose file.tokens unless the caller passed false for options.tokens.
if (options.tokens) {
file.tokens = tokens;
}
// Expand the Program's .loc to include all comments (not just those
// attached to the Program node, as its children may have comments as
// well), since sometimes program.loc.{start,end} will coincide with the
// .loc.{start,end} of the first and last *statements*, mistakenly
// excluding comments that fall outside that region.
var trueProgramLoc = util.getTrueLoc({
type: program.type,
loc: program.loc,
body: [],
comments: comments,
}, lines);
program.loc.start = trueProgramLoc.start;
program.loc.end = trueProgramLoc.end;
// Passing file.program here instead of just file means that initial
// comments will be attached to program.body[0] instead of program.
(0, comments_1.attach)(comments, program.body.length ? file.program : file, lines);
// Return a copy of the original AST so that any changes made may be
// compared to the original.
return new TreeCopier(lines, tokens).copy(file);
}
exports.parse = parse;
var TreeCopier = function TreeCopier(lines, tokens) {
(0, tiny_invariant_1.default)(this instanceof TreeCopier);
this.lines = lines;
this.tokens = tokens;
this.startTokenIndex = 0;
this.endTokenIndex = tokens.length;
this.indent = 0;
this.seen = new Map();
};
var TCp = TreeCopier.prototype;
TCp.copy = function (node) {
if (this.seen.has(node)) {
return this.seen.get(node);
}
if (isArray.check(node)) {
var copy_1 = new Array(node.length);
this.seen.set(node, copy_1);
node.forEach(function (item, i) {
copy_1[i] = this.copy(item);
}, this);
return copy_1;
}
if (!isObject.check(node)) {
return node;
}
util.fixFaultyLocations(node, this.lines);
var copy = Object.create(Object.getPrototypeOf(node), {
original: {
// Provide a link from the copy to the original.
value: node,
configurable: false,
enumerable: false,
writable: true,
},
});
this.seen.set(node, copy);
var loc = node.loc;
var oldIndent = this.indent;
var newIndent = oldIndent;
var oldStartTokenIndex = this.startTokenIndex;
var oldEndTokenIndex = this.endTokenIndex;
if (loc) {
// When node is a comment, we set node.loc.indent to
// node.loc.start.column so that, when/if we print the comment by
// itself, we can strip that much whitespace from the left margin of
// the comment. This only really matters for multiline Block comments,
// but it doesn't hurt for Line comments.
if (node.type === "Block" ||
node.type === "Line" ||
node.type === "CommentBlock" ||
node.type === "CommentLine" ||
this.lines.isPrecededOnlyByWhitespace(loc.start)) {
newIndent = this.indent = loc.start.column;
}
// Every node.loc has a reference to the original source lines as well
// as a complete list of source tokens.
loc.lines = this.lines;
loc.tokens = this.tokens;
loc.indent = newIndent;
// Set loc.start.token and loc.end.token such that
// loc.tokens.slice(loc.start.token, loc.end.token) returns a list of
// all the tokens that make up this node.
this.findTokenRange(loc);
}
var keys = Object.keys(node);
var keyCount = keys.length;
for (var i = 0; i < keyCount; ++i) {
var key = keys[i];
if (key === "loc") {
copy[key] = node[key];
}
else if (key === "tokens" && node.type === "File") {
// Preserve file.tokens (uncopied) in case client code cares about
// it, even though Recast ignores it when reprinting.
copy[key] = node[key];
}
else {
copy[key] = this.copy(node[key]);
}
}
this.indent = oldIndent;
this.startTokenIndex = oldStartTokenIndex;
this.endTokenIndex = oldEndTokenIndex;
return copy;
};
// If we didn't have any idea where in loc.tokens to look for tokens
// contained by this loc, a binary search would be appropriate, but
// because we maintain this.startTokenIndex and this.endTokenIndex as we
// traverse the AST, we only need to make small (linear) adjustments to
// those indexes with each recursive iteration.
TCp.findTokenRange = function (loc) {
// In the unlikely event that loc.tokens[this.startTokenIndex] starts
// *after* loc.start, we need to rewind this.startTokenIndex first.
while (this.startTokenIndex > 0) {
var token = loc.tokens[this.startTokenIndex];
if (util.comparePos(loc.start, token.loc.start) < 0) {
--this.startTokenIndex;
}
else
break;
}
// In the unlikely event that loc.tokens[this.endTokenIndex - 1] ends
// *before* loc.end, we need to fast-forward this.endTokenIndex first.
while (this.endTokenIndex < loc.tokens.length) {
var token = loc.tokens[this.endTokenIndex];
if (util.comparePos(token.loc.end, loc.end) < 0) {
++this.endTokenIndex;
}
else
break;
}
// Increment this.startTokenIndex until we've found the first token
// contained by this node.
while (this.startTokenIndex < this.endTokenIndex) {
var token = loc.tokens[this.startTokenIndex];
if (util.comparePos(token.loc.start, loc.start) < 0) {
++this.startTokenIndex;
}
else
break;
}
// Index into loc.tokens of the first token within this node.
loc.start.token = this.startTokenIndex;
// Decrement this.endTokenIndex until we've found the first token after
// this node (not contained by the node).
while (this.endTokenIndex > this.startTokenIndex) {
var token = loc.tokens[this.endTokenIndex - 1];
if (util.comparePos(loc.end, token.loc.end) < 0) {
--this.endTokenIndex;
}
else
break;
}
// Index into loc.tokens of the first token *after* this node.
// If loc.start.token === loc.end.token, the node contains no tokens,
// and the index is that of the next token following this node.
loc.end.token = this.endTokenIndex;
};
/***/ }),
/***/ "./node_modules/recast/lib/patcher.js":
/*!********************************************!*\
!*** ./node_modules/recast/lib/patcher.js ***!
\********************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.getReprinter = exports.Patcher = void 0;
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var tiny_invariant_1 = tslib_1.__importDefault(__webpack_require__(/*! tiny-invariant */ "./node_modules/tiny-invariant/dist/tiny-invariant.cjs.js"));
var linesModule = tslib_1.__importStar(__webpack_require__(/*! ./lines */ "./node_modules/recast/lib/lines.js"));
var types = tslib_1.__importStar(__webpack_require__(/*! ast-types */ "./node_modules/ast-types/lib/main.js"));
var Printable = types.namedTypes.Printable;
var Expression = types.namedTypes.Expression;
var ReturnStatement = types.namedTypes.ReturnStatement;
var SourceLocation = types.namedTypes.SourceLocation;
var util_1 = __webpack_require__(/*! ./util */ "./node_modules/recast/lib/util.js");
var fast_path_1 = tslib_1.__importDefault(__webpack_require__(/*! ./fast-path */ "./node_modules/recast/lib/fast-path.js"));
var isObject = types.builtInTypes.object;
var isArray = types.builtInTypes.array;
var isString = types.builtInTypes.string;
var riskyAdjoiningCharExp = /[0-9a-z_$]/i;
var Patcher = function Patcher(lines) {
(0, tiny_invariant_1.default)(this instanceof Patcher);
(0, tiny_invariant_1.default)(lines instanceof linesModule.Lines);
var self = this, replacements = [];
self.replace = function (loc, lines) {
if (isString.check(lines))
lines = linesModule.fromString(lines);
replacements.push({
lines: lines,
start: loc.start,
end: loc.end,
});
};
self.get = function (loc) {
// If no location is provided, return the complete Lines object.
loc = loc || {
start: { line: 1, column: 0 },
end: { line: lines.length, column: lines.getLineLength(lines.length) },
};
var sliceFrom = loc.start, toConcat = [];
function pushSlice(from, to) {
(0, tiny_invariant_1.default)((0, util_1.comparePos)(from, to) <= 0);
toConcat.push(lines.slice(from, to));
}
replacements
.sort(function (a, b) { return (0, util_1.comparePos)(a.start, b.start); })
.forEach(function (rep) {
if ((0, util_1.comparePos)(sliceFrom, rep.start) > 0) {
// Ignore nested replacement ranges.
}
else {
pushSlice(sliceFrom, rep.start);
toConcat.push(rep.lines);
sliceFrom = rep.end;
}
});
pushSlice(sliceFrom, loc.end);
return linesModule.concat(toConcat);
};
};
exports.Patcher = Patcher;
var Pp = Patcher.prototype;
Pp.tryToReprintComments = function (newNode, oldNode, print) {
var patcher = this;
if (!newNode.comments && !oldNode.comments) {
// We were (vacuously) able to reprint all the comments!
return true;
}
var newPath = fast_path_1.default.from(newNode);
var oldPath = fast_path_1.default.from(oldNode);
newPath.stack.push("comments", getSurroundingComments(newNode));
oldPath.stack.push("comments", getSurroundingComments(oldNode));
var reprints = [];
var ableToReprintComments = findArrayReprints(newPath, oldPath, reprints);
// No need to pop anything from newPath.stack or oldPath.stack, since
// newPath and oldPath are fresh local variables.
if (ableToReprintComments && reprints.length > 0) {
reprints.forEach(function (reprint) {
var oldComment = reprint.oldPath.getValue();
(0, tiny_invariant_1.default)(oldComment.leading || oldComment.trailing);
patcher.replace(oldComment.loc,
// Comments can't have .comments, so it doesn't matter whether we
// print with comments or without.
print(reprint.newPath).indentTail(oldComment.loc.indent));
});
}
return ableToReprintComments;
};
// Get all comments that are either leading or trailing, ignoring any
// comments that occur inside node.loc. Returns an empty array for nodes
// with no leading or trailing comments.
function getSurroundingComments(node) {
var result = [];
if (node.comments && node.comments.length > 0) {
node.comments.forEach(function (comment) {
if (comment.leading || comment.trailing) {
result.push(comment);
}
});
}
return result;
}
Pp.deleteComments = function (node) {
if (!node.comments) {
return;
}
var patcher = this;
node.comments.forEach(function (comment) {
if (comment.leading) {
// Delete leading comments along with any trailing whitespace they
// might have.
patcher.replace({
start: comment.loc.start,
end: node.loc.lines.skipSpaces(comment.loc.end, false, false),
}, "");
}
else if (comment.trailing) {
// Delete trailing comments along with any leading whitespace they
// might have.
patcher.replace({
start: node.loc.lines.skipSpaces(comment.loc.start, true, false),
end: comment.loc.end,
}, "");
}
});
};
function getReprinter(path) {
(0, tiny_invariant_1.default)(path instanceof fast_path_1.default);
// Make sure that this path refers specifically to a Node, rather than
// some non-Node subproperty of a Node.
var node = path.getValue();
if (!Printable.check(node))
return;
var orig = node.original;
var origLoc = orig && orig.loc;
var lines = origLoc && origLoc.lines;
var reprints = [];
if (!lines || !findReprints(path, reprints))
return;
return function (print) {
var patcher = new Patcher(lines);
reprints.forEach(function (reprint) {
var newNode = reprint.newPath.getValue();
var oldNode = reprint.oldPath.getValue();
SourceLocation.assert(oldNode.loc, true);
var needToPrintNewPathWithComments = !patcher.tryToReprintComments(newNode, oldNode, print);
if (needToPrintNewPathWithComments) {
// Since we were not able to preserve all leading/trailing
// comments, we delete oldNode's comments, print newPath with
// comments, and then patch the resulting lines where oldNode used
// to be.
patcher.deleteComments(oldNode);
}
var newLines = print(reprint.newPath, {
includeComments: needToPrintNewPathWithComments,
// If the oldNode we're replacing already had parentheses, we may
// not need to print the new node with any extra parentheses,
// because the existing parentheses will suffice. However, if the
// newNode has a different type than the oldNode, let the printer
// decide if reprint.newPath needs parentheses, as usual.
avoidRootParens: oldNode.type === newNode.type && reprint.oldPath.hasParens(),
}).indentTail(oldNode.loc.indent);
var nls = needsLeadingSpace(lines, oldNode.loc, newLines);
var nts = needsTrailingSpace(lines, oldNode.loc, newLines);
// If we try to replace the argument of a ReturnStatement like
// return"asdf" with e.g. a literal null expression, we run the risk
// of ending up with returnnull, so we need to add an extra leading
// space in situations where that might happen. Likewise for
// "asdf"in obj. See #170.
if (nls || nts) {
var newParts = [];
nls && newParts.push(" ");
newParts.push(newLines);
nts && newParts.push(" ");
newLines = linesModule.concat(newParts);
}
patcher.replace(oldNode.loc, newLines);
});
// Recall that origLoc is the .loc of an ancestor node that is
// guaranteed to contain all the reprinted nodes and comments.
var patchedLines = patcher.get(origLoc).indentTail(-orig.loc.indent);
if (path.needsParens()) {
return linesModule.concat(["(", patchedLines, ")"]);
}
return patchedLines;
};
}
exports.getReprinter = getReprinter;
// If the last character before oldLoc and the first character of newLines
// are both identifier characters, they must be separated by a space,
// otherwise they will most likely get fused together into a single token.
function needsLeadingSpace(oldLines, oldLoc, newLines) {
var posBeforeOldLoc = (0, util_1.copyPos)(oldLoc.start);
// The character just before the location occupied by oldNode.
var charBeforeOldLoc = oldLines.prevPos(posBeforeOldLoc) && oldLines.charAt(posBeforeOldLoc);
// First character of the reprinted node.
var newFirstChar = newLines.charAt(newLines.firstPos());
return (charBeforeOldLoc &&
riskyAdjoiningCharExp.test(charBeforeOldLoc) &&
newFirstChar &&
riskyAdjoiningCharExp.test(newFirstChar));
}
// If the last character of newLines and the first character after oldLoc
// are both identifier characters, they must be separated by a space,
// otherwise they will most likely get fused together into a single token.
function needsTrailingSpace(oldLines, oldLoc, newLines) {
// The character just after the location occupied by oldNode.
var charAfterOldLoc = oldLines.charAt(oldLoc.end);
var newLastPos = newLines.lastPos();
// Last character of the reprinted node.
var newLastChar = newLines.prevPos(newLastPos) && newLines.charAt(newLastPos);
return (newLastChar &&
riskyAdjoiningCharExp.test(newLastChar) &&
charAfterOldLoc &&
riskyAdjoiningCharExp.test(charAfterOldLoc));
}
function findReprints(newPath, reprints) {
var newNode = newPath.getValue();
Printable.assert(newNode);
var oldNode = newNode.original;
Printable.assert(oldNode);
(0, tiny_invariant_1.default)(reprints.length === 0);
if (newNode.type !== oldNode.type) {
return false;
}
var oldPath = new fast_path_1.default(oldNode);
var canReprint = findChildReprints(newPath, oldPath, reprints);
if (!canReprint) {
// Make absolutely sure the calling code does not attempt to reprint
// any nodes.
reprints.length = 0;
}
return canReprint;
}
function findAnyReprints(newPath, oldPath, reprints) {
var newNode = newPath.getValue();
var oldNode = oldPath.getValue();
if (newNode === oldNode)
return true;
if (isArray.check(newNode))
return findArrayReprints(newPath, oldPath, reprints);
if (isObject.check(newNode))
return findObjectReprints(newPath, oldPath, reprints);
return false;
}
function findArrayReprints(newPath, oldPath, reprints) {
var newNode = newPath.getValue();
var oldNode = oldPath.getValue();
if (newNode === oldNode ||
newPath.valueIsDuplicate() ||
oldPath.valueIsDuplicate()) {
return true;
}
isArray.assert(newNode);
var len = newNode.length;
if (!(isArray.check(oldNode) && oldNode.length === len))
return false;
for (var i = 0; i < len; ++i) {
newPath.stack.push(i, newNode[i]);
oldPath.stack.push(i, oldNode[i]);
var canReprint = findAnyReprints(newPath, oldPath, reprints);
newPath.stack.length -= 2;
oldPath.stack.length -= 2;
if (!canReprint) {
return false;
}
}
return true;
}
function findObjectReprints(newPath, oldPath, reprints) {
var newNode = newPath.getValue();
isObject.assert(newNode);
if (newNode.original === null) {
// If newNode.original node was set to null, reprint the node.
return false;
}
var oldNode = oldPath.getValue();
if (!isObject.check(oldNode))
return false;
if (newNode === oldNode ||
newPath.valueIsDuplicate() ||
oldPath.valueIsDuplicate()) {
return true;
}
if (Printable.check(newNode)) {
if (!Printable.check(oldNode)) {
return false;
}
var newParentNode = newPath.getParentNode();
var oldParentNode = oldPath.getParentNode();
if (oldParentNode !== null &&
oldParentNode.type === "FunctionTypeAnnotation" &&
newParentNode !== null &&
newParentNode.type === "FunctionTypeAnnotation") {
var oldNeedsParens = oldParentNode.params.length !== 1 || !!oldParentNode.params[0].name;
var newNeedParens = newParentNode.params.length !== 1 || !!newParentNode.params[0].name;
if (!oldNeedsParens && newNeedParens) {
return false;
}
}
// Here we need to decide whether the reprinted code for newNode is
// appropriate for patching into the location of oldNode.
if (newNode.type === oldNode.type) {
var childReprints = [];
if (findChildReprints(newPath, oldPath, childReprints)) {
reprints.push.apply(reprints, childReprints);
}
else if (oldNode.loc) {
// If we have no .loc information for oldNode, then we won't be
// able to reprint it.
reprints.push({
oldPath: oldPath.copy(),
newPath: newPath.copy(),
});
}
else {
return false;
}
return true;
}
if (Expression.check(newNode) &&
Expression.check(oldNode) &&
// If we have no .loc information for oldNode, then we won't be
// able to reprint it.
oldNode.loc) {
// If both nodes are subtypes of Expression, then we should be able
// to fill the location occupied by the old node with code printed
// for the new node with no ill consequences.
reprints.push({
oldPath: oldPath.copy(),
newPath: newPath.copy(),
});
return true;
}
// The nodes have different types, and at least one of the types is
// not a subtype of the Expression type, so we cannot safely assume
// the nodes are syntactically interchangeable.
return false;
}
return findChildReprints(newPath, oldPath, reprints);
}
function findChildReprints(newPath, oldPath, reprints) {
var newNode = newPath.getValue();
var oldNode = oldPath.getValue();
isObject.assert(newNode);
isObject.assert(oldNode);
if (newNode.original === null) {
// If newNode.original node was set to null, reprint the node.
return false;
}
// If this node needs parentheses and will not be wrapped with
// parentheses when reprinted, then return false to skip reprinting and
// let it be printed generically.
if (newPath.needsParens() && !oldPath.hasParens()) {
return false;
}
var keys = (0, util_1.getUnionOfKeys)(oldNode, newNode);
if (oldNode.type === "File" || newNode.type === "File") {
// Don't bother traversing file.tokens, an often very large array
// returned by Babylon, and useless for our purposes.
delete keys.tokens;
}
// Don't bother traversing .loc objects looking for reprintable nodes.
delete keys.loc;
var originalReprintCount = reprints.length;
for (var k in keys) {
if (k.charAt(0) === "_") {
// Ignore "private" AST properties added by e.g. Babel plugins and
// parsers like Babylon.
continue;
}
newPath.stack.push(k, types.getFieldValue(newNode, k));
oldPath.stack.push(k, types.getFieldValue(oldNode, k));
var canReprint = findAnyReprints(newPath, oldPath, reprints);
newPath.stack.length -= 2;
oldPath.stack.length -= 2;
if (!canReprint) {
return false;
}
}
// Return statements might end up running into ASI issues due to
// comments inserted deep within the tree, so reprint them if anything
// changed within them.
if (ReturnStatement.check(newPath.getNode()) &&
reprints.length > originalReprintCount) {
return false;
}
return true;
}
/***/ }),
/***/ "./node_modules/recast/lib/printer.js":
/*!********************************************!*\
!*** ./node_modules/recast/lib/printer.js ***!
\********************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.Printer = void 0;
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var tiny_invariant_1 = tslib_1.__importDefault(__webpack_require__(/*! tiny-invariant */ "./node_modules/tiny-invariant/dist/tiny-invariant.cjs.js"));
var types = tslib_1.__importStar(__webpack_require__(/*! ast-types */ "./node_modules/ast-types/lib/main.js"));
var comments_1 = __webpack_require__(/*! ./comments */ "./node_modules/recast/lib/comments.js");
var fast_path_1 = tslib_1.__importDefault(__webpack_require__(/*! ./fast-path */ "./node_modules/recast/lib/fast-path.js"));
var lines_1 = __webpack_require__(/*! ./lines */ "./node_modules/recast/lib/lines.js");
var options_1 = __webpack_require__(/*! ./options */ "./node_modules/recast/lib/options.js");
var patcher_1 = __webpack_require__(/*! ./patcher */ "./node_modules/recast/lib/patcher.js");
var util = tslib_1.__importStar(__webpack_require__(/*! ./util */ "./node_modules/recast/lib/util.js"));
var namedTypes = types.namedTypes;
var isString = types.builtInTypes.string;
var isObject = types.builtInTypes.object;
var PrintResult = function PrintResult(code, sourceMap) {
(0, tiny_invariant_1.default)(this instanceof PrintResult);
isString.assert(code);
this.code = code;
if (sourceMap) {
isObject.assert(sourceMap);
this.map = sourceMap;
}
};
var PRp = PrintResult.prototype;
var warnedAboutToString = false;
PRp.toString = function () {
if (!warnedAboutToString) {
console.warn("Deprecation warning: recast.print now returns an object with " +
"a .code property. You appear to be treating the object as a " +
"string, which might still work but is strongly discouraged.");
warnedAboutToString = true;
}
return this.code;
};
var emptyPrintResult = new PrintResult("");
var Printer = function Printer(config) {
(0, tiny_invariant_1.default)(this instanceof Printer);
var explicitTabWidth = config && config.tabWidth;
config = (0, options_1.normalize)(config);
// It's common for client code to pass the same options into both
// recast.parse and recast.print, but the Printer doesn't need (and
// can be confused by) config.sourceFileName, so we null it out.
config.sourceFileName = null;
// Non-destructively modifies options with overrides, and returns a
// new print function that uses the modified options.
function makePrintFunctionWith(options, overrides) {
options = Object.assign({}, options, overrides);
return function (path) { return print(path, options); };
}
function print(path, options) {
(0, tiny_invariant_1.default)(path instanceof fast_path_1.default);
options = options || {};
if (options.includeComments) {
return (0, comments_1.printComments)(path, makePrintFunctionWith(options, {
includeComments: false,
}));
}
var oldTabWidth = config.tabWidth;
if (!explicitTabWidth) {
var loc = path.getNode().loc;
if (loc && loc.lines && loc.lines.guessTabWidth) {
config.tabWidth = loc.lines.guessTabWidth();
}
}
var reprinter = (0, patcher_1.getReprinter)(path);
var lines = reprinter
? // Since the print function that we pass to the reprinter will
// be used to print "new" nodes, it's tempting to think we
// should pass printRootGenerically instead of print, to avoid
// calling maybeReprint again, but that would be a mistake
// because the new nodes might not be entirely new, but merely
// moved from elsewhere in the AST. The print function is the
// right choice because it gives us the opportunity to reprint
// such nodes using their original source.
reprinter(print)
: genericPrint(path, config, options, makePrintFunctionWith(options, {
includeComments: true,
avoidRootParens: false,
}));
config.tabWidth = oldTabWidth;
return lines;
}
this.print = function (ast) {
if (!ast) {
return emptyPrintResult;
}
var lines = print(fast_path_1.default.from(ast), {
includeComments: true,
avoidRootParens: false,
});
return new PrintResult(lines.toString(config), util.composeSourceMaps(config.inputSourceMap, lines.getSourceMap(config.sourceMapName, config.sourceRoot)));
};
this.printGenerically = function (ast) {
if (!ast) {
return emptyPrintResult;
}
// Print the entire AST generically.
function printGenerically(path) {
return (0, comments_1.printComments)(path, function (path) {
return genericPrint(path, config, {
includeComments: true,
avoidRootParens: false,
}, printGenerically);
});
}
var path = fast_path_1.default.from(ast);
var oldReuseWhitespace = config.reuseWhitespace;
// Do not reuse whitespace (or anything else, for that matter)
// when printing generically.
config.reuseWhitespace = false;
// TODO Allow printing of comments?
var pr = new PrintResult(printGenerically(path).toString(config));
config.reuseWhitespace = oldReuseWhitespace;
return pr;
};
};
exports.Printer = Printer;
function genericPrint(path, config, options, printPath) {
(0, tiny_invariant_1.default)(path instanceof fast_path_1.default);
var node = path.getValue();
var parts = [];
var linesWithoutParens = genericPrintNoParens(path, config, printPath);
if (!node || linesWithoutParens.isEmpty()) {
return linesWithoutParens;
}
var shouldAddParens = false;
var decoratorsLines = printDecorators(path, printPath);
if (decoratorsLines.isEmpty()) {
// Nodes with decorators can't have parentheses, so we can avoid
// computing path.needsParens() except in this case.
if (!options.avoidRootParens) {
shouldAddParens = path.needsParens();
}
}
else {
parts.push(decoratorsLines);
}
if (shouldAddParens) {
parts.unshift("(");
}
parts.push(linesWithoutParens);
if (shouldAddParens) {
parts.push(")");
}
return (0, lines_1.concat)(parts);
}
// Note that the `options` parameter of this function is what other
// functions in this file call the `config` object (that is, the
// configuration object originally passed into the Printer constructor).
// Its properties are documented in lib/options.js.
function genericPrintNoParens(path, options, print) {
var _a, _b, _c;
var n = path.getValue();
if (!n) {
return (0, lines_1.fromString)("");
}
if (typeof n === "string") {
return (0, lines_1.fromString)(n, options);
}
namedTypes.Printable.assert(n);
var parts = [];
switch (n.type) {
case "File":
return path.call(print, "program");
case "Program":
// Babel 6
if (n.directives) {
path.each(function (childPath) {
parts.push(print(childPath), ";\n");
}, "directives");
}
if (n.interpreter) {
parts.push(path.call(print, "interpreter"));
}
parts.push(path.call(function (bodyPath) { return printStatementSequence(bodyPath, options, print); }, "body"));
return (0, lines_1.concat)(parts);
case "Noop": // Babel extension.
case "EmptyStatement":
return (0, lines_1.fromString)("");
case "ExpressionStatement":
return (0, lines_1.concat)([path.call(print, "expression"), ";"]);
case "ParenthesizedExpression": // Babel extension.
return (0, lines_1.concat)(["(", path.call(print, "expression"), ")"]);
case "BinaryExpression":
case "LogicalExpression":
case "AssignmentExpression":
return (0, lines_1.fromString)(" ").join([
path.call(print, "left"),
n.operator,
path.call(print, "right"),
]);
case "AssignmentPattern":
return (0, lines_1.concat)([
path.call(print, "left"),
" = ",
path.call(print, "right"),
]);
case "MemberExpression":
case "OptionalMemberExpression": {
parts.push(path.call(print, "object"));
var property = path.call(print, "property");
// Like n.optional, except with defaults applied, so optional
// defaults to true for OptionalMemberExpression nodes.
var optional = types.getFieldValue(n, "optional");
if (n.computed) {
parts.push(optional ? "?.[" : "[", property, "]");
}
else {
parts.push(optional ? "?." : ".", property);
}
return (0, lines_1.concat)(parts);
}
case "ChainExpression":
return path.call(print, "expression");
case "MetaProperty":
return (0, lines_1.concat)([
path.call(print, "meta"),
".",
path.call(print, "property"),
]);
case "BindExpression":
if (n.object) {
parts.push(path.call(print, "object"));
}
parts.push("::", path.call(print, "callee"));
return (0, lines_1.concat)(parts);
case "Path":
return (0, lines_1.fromString)(".").join(n.body);
case "Identifier":
return (0, lines_1.concat)([
(0, lines_1.fromString)(n.name, options),
n.optional ? "?" : "",
path.call(print, "typeAnnotation"),
]);
case "SpreadElement":
case "SpreadElementPattern":
case "RestProperty": // Babel 6 for ObjectPattern
case "SpreadProperty":
case "SpreadPropertyPattern":
case "ObjectTypeSpreadProperty":
case "RestElement":
return (0, lines_1.concat)([
"...",
path.call(print, "argument"),
path.call(print, "typeAnnotation"),
]);
case "FunctionDeclaration":
case "FunctionExpression":
case "TSDeclareFunction":
if (n.declare) {
parts.push("declare ");
}
if (n.async) {
parts.push("async ");
}
parts.push("function");
if (n.generator)
parts.push("*");
if (n.id) {
parts.push(" ", path.call(print, "id"), path.call(print, "typeParameters"));
}
else {
if (n.typeParameters) {
parts.push(path.call(print, "typeParameters"));
}
}
parts.push("(", printFunctionParams(path, options, print), ")", path.call(print, "returnType"));
if (n.body) {
parts.push(" ", path.call(print, "body"));
}
return (0, lines_1.concat)(parts);
case "ArrowFunctionExpression":
if (n.async) {
parts.push("async ");
}
if (n.typeParameters) {
parts.push(path.call(print, "typeParameters"));
}
if (!options.arrowParensAlways &&
n.params.length === 1 &&
!n.rest &&
n.params[0].type === "Identifier" &&
!n.params[0].typeAnnotation &&
!n.returnType) {
parts.push(path.call(print, "params", 0));
}
else {
parts.push("(", printFunctionParams(path, options, print), ")", path.call(print, "returnType"));
}
parts.push(" => ", path.call(print, "body"));
return (0, lines_1.concat)(parts);
case "MethodDefinition":
return printMethod(path, options, print);
case "YieldExpression":
parts.push("yield");
if (n.delegate)
parts.push("*");
if (n.argument)
parts.push(" ", path.call(print, "argument"));
return (0, lines_1.concat)(parts);
case "AwaitExpression":
parts.push("await");
if (n.all)
parts.push("*");
if (n.argument)
parts.push(" ", path.call(print, "argument"));
return (0, lines_1.concat)(parts);
case "ModuleExpression":
return (0, lines_1.concat)([
"module {\n",
path.call(print, "body").indent(options.tabWidth),
"\n}",
]);
case "ModuleDeclaration":
parts.push("module", path.call(print, "id"));
if (n.source) {
(0, tiny_invariant_1.default)(!n.body);
parts.push("from", path.call(print, "source"));
}
else {
parts.push(path.call(print, "body"));
}
return (0, lines_1.fromString)(" ").join(parts);
case "ImportSpecifier":
if (n.importKind && n.importKind !== "value") {
parts.push(n.importKind + " ");
}
if (n.imported) {
parts.push(path.call(print, "imported"));
if (n.local && n.local.name !== n.imported.name) {
parts.push(" as ", path.call(print, "local"));
}
}
else if (n.id) {
parts.push(path.call(print, "id"));
if (n.name) {
parts.push(" as ", path.call(print, "name"));
}
}
return (0, lines_1.concat)(parts);
case "ExportSpecifier":
if (n.exportKind && n.exportKind !== "value") {
parts.push(n.exportKind + " ");
}
if (n.local) {
parts.push(path.call(print, "local"));
if (n.exported && n.exported.name !== n.local.name) {
parts.push(" as ", path.call(print, "exported"));
}
}
else if (n.id) {
parts.push(path.call(print, "id"));
if (n.name) {
parts.push(" as ", path.call(print, "name"));
}
}
return (0, lines_1.concat)(parts);
case "ExportBatchSpecifier":
return (0, lines_1.fromString)("*");
case "ImportNamespaceSpecifier":
parts.push("* as ");
if (n.local) {
parts.push(path.call(print, "local"));
}
else if (n.id) {
parts.push(path.call(print, "id"));
}
return (0, lines_1.concat)(parts);
case "ImportDefaultSpecifier":
if (n.local) {
return path.call(print, "local");
}
return path.call(print, "id");
case "TSExportAssignment":
return (0, lines_1.concat)(["export = ", path.call(print, "expression")]);
case "ExportDeclaration":
case "ExportDefaultDeclaration":
case "ExportNamedDeclaration":
return printExportDeclaration(path, options, print);
case "ExportAllDeclaration":
parts.push("export *");
if (n.exported) {
parts.push(" as ", path.call(print, "exported"));
}
parts.push(" from ", path.call(print, "source"), ";");
return (0, lines_1.concat)(parts);
case "TSNamespaceExportDeclaration":
parts.push("export as namespace ", path.call(print, "id"));
return maybeAddSemicolon((0, lines_1.concat)(parts));
case "ExportNamespaceSpecifier":
return (0, lines_1.concat)(["* as ", path.call(print, "exported")]);
case "ExportDefaultSpecifier":
return path.call(print, "exported");
case "Import":
return (0, lines_1.fromString)("import", options);
// Recast and ast-types currently support dynamic import(...) using
// either this dedicated ImportExpression type or a CallExpression
// whose callee has type Import.
// https://github.com/benjamn/ast-types/pull/365#issuecomment-605214486
case "ImportExpression":
return (0, lines_1.concat)(["import(", path.call(print, "source"), ")"]);
case "ImportDeclaration": {
parts.push("import ");
if (n.importKind && n.importKind !== "value") {
parts.push(n.importKind + " ");
}
if (n.specifiers && n.specifiers.length > 0) {
var unbracedSpecifiers_1 = [];
var bracedSpecifiers_1 = [];
path.each(function (specifierPath) {
var spec = specifierPath.getValue();
if (spec.type === "ImportSpecifier") {
bracedSpecifiers_1.push(print(specifierPath));
}
else if (spec.type === "ImportDefaultSpecifier" ||
spec.type === "ImportNamespaceSpecifier") {
unbracedSpecifiers_1.push(print(specifierPath));
}
}, "specifiers");
unbracedSpecifiers_1.forEach(function (lines, i) {
if (i > 0) {
parts.push(", ");
}
parts.push(lines);
});
if (bracedSpecifiers_1.length > 0) {
var lines = (0, lines_1.fromString)(", ").join(bracedSpecifiers_1);
if (lines.getLineLength(1) > options.wrapColumn) {
lines = (0, lines_1.concat)([
(0, lines_1.fromString)(",\n").join(bracedSpecifiers_1).indent(options.tabWidth),
",",
]);
}
if (unbracedSpecifiers_1.length > 0) {
parts.push(", ");
}
if (lines.length > 1) {
parts.push("{\n", lines, "\n}");
}
else if (options.objectCurlySpacing) {
parts.push("{ ", lines, " }");
}
else {
parts.push("{", lines, "}");
}
}
parts.push(" from ");
}
parts.push(path.call(print, "source"), maybePrintImportAssertions(path, options, print), ";");
return (0, lines_1.concat)(parts);
}
case "ImportAttribute":
return (0, lines_1.concat)([path.call(print, "key"), ": ", path.call(print, "value")]);
case "StaticBlock":
parts.push("static ");
// Intentionally fall through to BlockStatement below.
case "BlockStatement": {
var naked_1 = path.call(function (bodyPath) { return printStatementSequence(bodyPath, options, print); }, "body");
if (naked_1.isEmpty()) {
if (!n.directives || n.directives.length === 0) {
parts.push("{}");
return (0, lines_1.concat)(parts);
}
}
parts.push("{\n");
// Babel 6
if (n.directives) {
path.each(function (childPath) {
parts.push(maybeAddSemicolon(print(childPath).indent(options.tabWidth)), n.directives.length > 1 || !naked_1.isEmpty() ? "\n" : "");
}, "directives");
}
parts.push(naked_1.indent(options.tabWidth));
parts.push("\n}");
return (0, lines_1.concat)(parts);
}
case "ReturnStatement": {
parts.push("return");
if (n.argument) {
var argIsJsxElement = ((_a = namedTypes.JSXElement) === null || _a === void 0 ? void 0 : _a.check(n.argument)) ||
((_b = namedTypes.JSXFragment) === null || _b === void 0 ? void 0 : _b.check(n.argument));
var argLines = path.call(print, "argument");
if (argLines.startsWithComment() ||
(argLines.length > 1 && argIsJsxElement)) {
// Babel: regenerate parenthesized jsxElements so we don't double parentheses
if (argIsJsxElement && ((_c = n.argument.extra) === null || _c === void 0 ? void 0 : _c.parenthesized)) {
n.argument.extra.parenthesized = false;
argLines = path.call(print, "argument");
n.argument.extra.parenthesized = true;
}
parts.push(" ", (0, lines_1.concat)(["(\n", argLines]).indentTail(options.tabWidth), "\n)");
}
else {
parts.push(" ", argLines);
}
}
parts.push(";");
return (0, lines_1.concat)(parts);
}
case "CallExpression":
case "OptionalCallExpression":
parts.push(path.call(print, "callee"));
if (n.typeParameters) {
parts.push(path.call(print, "typeParameters"));
}
if (n.typeArguments) {
parts.push(path.call(print, "typeArguments"));
}
// Like n.optional, but defaults to true for OptionalCallExpression
// nodes that are missing an n.optional property (unusual),
// according to the OptionalCallExpression definition in ast-types.
if (types.getFieldValue(n, "optional")) {
parts.push("?.");
}
parts.push(printArgumentsList(path, options, print));
return (0, lines_1.concat)(parts);
case "RecordExpression":
parts.push("#");
// Intentionally fall through to printing the object literal...
case "ObjectExpression":
case "ObjectPattern":
case "ObjectTypeAnnotation": {
var isTypeAnnotation_1 = n.type === "ObjectTypeAnnotation";
var separator_1 = options.flowObjectCommas
? ","
: isTypeAnnotation_1
? ";"
: ",";
var fields = [];
var allowBreak_1 = false;
if (isTypeAnnotation_1) {
fields.push("indexers", "callProperties");
if (n.internalSlots != null) {
fields.push("internalSlots");
}
}
fields.push("properties");
var len_1 = 0;
fields.forEach(function (field) {
len_1 += n[field].length;
});
var oneLine_1 = (isTypeAnnotation_1 && len_1 === 1) || len_1 === 0;
var leftBrace = n.exact ? "{|" : "{";
var rightBrace = n.exact ? "|}" : "}";
parts.push(oneLine_1 ? leftBrace : leftBrace + "\n");
var leftBraceIndex = parts.length - 1;
var i_1 = 0;
fields.forEach(function (field) {
path.each(function (childPath) {
var lines = print(childPath);
if (!oneLine_1) {
lines = lines.indent(options.tabWidth);
}
var multiLine = !isTypeAnnotation_1 && lines.length > 1;
if (multiLine && allowBreak_1) {
// Similar to the logic for BlockStatement.
parts.push("\n");
}
parts.push(lines);
if (i_1 < len_1 - 1) {
// Add an extra line break if the previous object property
// had a multi-line value.
parts.push(separator_1 + (multiLine ? "\n\n" : "\n"));
allowBreak_1 = !multiLine;
}
else if (len_1 !== 1 && isTypeAnnotation_1) {
parts.push(separator_1);
}
else if (!oneLine_1 &&
util.isTrailingCommaEnabled(options, "objects") &&
childPath.getValue().type !== "RestElement") {
parts.push(separator_1);
}
i_1++;
}, field);
});
if (n.inexact) {
var line = (0, lines_1.fromString)("...", options);
if (oneLine_1) {
if (len_1 > 0) {
parts.push(separator_1, " ");
}
parts.push(line);
}
else {
// No trailing separator after ... to maintain parity with prettier.
parts.push("\n", line.indent(options.tabWidth));
}
}
parts.push(oneLine_1 ? rightBrace : "\n" + rightBrace);
if (i_1 !== 0 && oneLine_1 && options.objectCurlySpacing) {
parts[leftBraceIndex] = leftBrace + " ";
parts[parts.length - 1] = " " + rightBrace;
}
if (n.typeAnnotation) {
parts.push(path.call(print, "typeAnnotation"));
}
return (0, lines_1.concat)(parts);
}
case "PropertyPattern":
return (0, lines_1.concat)([
path.call(print, "key"),
": ",
path.call(print, "pattern"),
]);
case "ObjectProperty": // Babel 6
case "Property": {
// Non-standard AST node type.
if (n.method || n.kind === "get" || n.kind === "set") {
return printMethod(path, options, print);
}
if (n.shorthand && n.value.type === "AssignmentPattern") {
return path.call(print, "value");
}
var key = path.call(print, "key");
if (n.computed) {
parts.push("[", key, "]");
}
else {
parts.push(key);
}
if (!n.shorthand || n.key.name !== n.value.name) {
parts.push(": ", path.call(print, "value"));
}
return (0, lines_1.concat)(parts);
}
case "ClassMethod": // Babel 6
case "ObjectMethod": // Babel 6
case "ClassPrivateMethod":
case "TSDeclareMethod":
return printMethod(path, options, print);
case "PrivateName":
return (0, lines_1.concat)(["#", path.call(print, "id")]);
case "Decorator":
return (0, lines_1.concat)(["@", path.call(print, "expression")]);
case "TupleExpression":
parts.push("#");
// Intentionally fall through to printing the tuple elements...
case "ArrayExpression":
case "ArrayPattern": {
var elems = n.elements;
var len_2 = elems.length;
var printed_1 = path.map(print, "elements");
var joined = (0, lines_1.fromString)(", ").join(printed_1);
var oneLine_2 = joined.getLineLength(1) <= options.wrapColumn;
if (oneLine_2) {
if (options.arrayBracketSpacing) {
parts.push("[ ");
}
else {
parts.push("[");
}
}
else {
parts.push("[\n");
}
path.each(function (elemPath) {
var i = elemPath.getName();
var elem = elemPath.getValue();
if (!elem) {
// If the array expression ends with a hole, that hole
// will be ignored by the interpreter, but if it ends with
// two (or more) holes, we need to write out two (or more)
// commas so that the resulting code is interpreted with
// both (all) of the holes.
parts.push(",");
}
else {
var lines = printed_1[i];
if (oneLine_2) {
if (i > 0)
parts.push(" ");
}
else {
lines = lines.indent(options.tabWidth);
}
parts.push(lines);
if (i < len_2 - 1 ||
(!oneLine_2 && util.isTrailingCommaEnabled(options, "arrays")))
parts.push(",");
if (!oneLine_2)
parts.push("\n");
}
}, "elements");
if (oneLine_2 && options.arrayBracketSpacing) {
parts.push(" ]");
}
else {
parts.push("]");
}
if (n.typeAnnotation) {
parts.push(path.call(print, "typeAnnotation"));
}
return (0, lines_1.concat)(parts);
}
case "SequenceExpression":
return (0, lines_1.fromString)(", ").join(path.map(print, "expressions"));
case "ThisExpression":
return (0, lines_1.fromString)("this");
case "Super":
return (0, lines_1.fromString)("super");
case "NullLiteral": // Babel 6 Literal split
return (0, lines_1.fromString)("null");
case "RegExpLiteral": // Babel 6 Literal split
return (0, lines_1.fromString)(getPossibleRaw(n) || "/".concat(n.pattern, "/").concat(n.flags || ""), options);
case "BigIntLiteral": // Babel 7 Literal split
return (0, lines_1.fromString)(getPossibleRaw(n) || n.value + "n", options);
case "NumericLiteral": // Babel 6 Literal Split
return (0, lines_1.fromString)(getPossibleRaw(n) || n.value, options);
case "DecimalLiteral":
return (0, lines_1.fromString)(getPossibleRaw(n) || n.value + "m", options);
case "StringLiteral":
return (0, lines_1.fromString)(nodeStr(n.value, options));
case "BooleanLiteral": // Babel 6 Literal split
case "Literal":
return (0, lines_1.fromString)(getPossibleRaw(n) ||
(typeof n.value === "string" ? nodeStr(n.value, options) : n.value), options);
case "Directive": // Babel 6
return path.call(print, "value");
case "DirectiveLiteral": // Babel 6
return (0, lines_1.fromString)(getPossibleRaw(n) || nodeStr(n.value, options), options);
case "InterpreterDirective":
return (0, lines_1.fromString)("#!".concat(n.value, "\n"), options);
case "ModuleSpecifier":
if (n.local) {
throw new Error("The ESTree ModuleSpecifier type should be abstract");
}
// The Esprima ModuleSpecifier type is just a string-valued
// Literal identifying the imported-from module.
return (0, lines_1.fromString)(nodeStr(n.value, options), options);
case "UnaryExpression":
parts.push(n.operator);
if (/[a-z]$/.test(n.operator))
parts.push(" ");
parts.push(path.call(print, "argument"));
return (0, lines_1.concat)(parts);
case "UpdateExpression":
parts.push(path.call(print, "argument"), n.operator);
if (n.prefix)
parts.reverse();
return (0, lines_1.concat)(parts);
case "ConditionalExpression":
return (0, lines_1.concat)([
path.call(print, "test"),
" ? ",
path.call(print, "consequent"),
" : ",
path.call(print, "alternate"),
]);
case "NewExpression": {
parts.push("new ", path.call(print, "callee"));
if (n.typeParameters) {
parts.push(path.call(print, "typeParameters"));
}
if (n.typeArguments) {
parts.push(path.call(print, "typeArguments"));
}
var args = n.arguments;
if (args) {
parts.push(printArgumentsList(path, options, print));
}
return (0, lines_1.concat)(parts);
}
case "VariableDeclaration": {
if (n.declare) {
parts.push("declare ");
}
parts.push(n.kind, " ");
var maxLen_1 = 0;
var printed = path.map(function (childPath) {
var lines = print(childPath);
maxLen_1 = Math.max(lines.length, maxLen_1);
return lines;
}, "declarations");
if (maxLen_1 === 1) {
parts.push((0, lines_1.fromString)(", ").join(printed));
}
else if (printed.length > 1) {
parts.push((0, lines_1.fromString)(",\n")
.join(printed)
.indentTail(n.kind.length + 1));
}
else {
parts.push(printed[0]);
}
// We generally want to terminate all variable declarations with a
// semicolon, except when they are children of for loops.
var parentNode = path.getParentNode();
if (!namedTypes.ForStatement.check(parentNode) &&
!namedTypes.ForInStatement.check(parentNode) &&
!(namedTypes.ForOfStatement &&
namedTypes.ForOfStatement.check(parentNode)) &&
!(namedTypes.ForAwaitStatement &&
namedTypes.ForAwaitStatement.check(parentNode))) {
parts.push(";");
}
return (0, lines_1.concat)(parts);
}
case "VariableDeclarator":
return n.init
? (0, lines_1.fromString)(" = ").join([
path.call(print, "id"),
path.call(print, "init"),
])
: path.call(print, "id");
case "WithStatement":
return (0, lines_1.concat)([
"with (",
path.call(print, "object"),
") ",
path.call(print, "body"),
]);
case "IfStatement": {
var con = adjustClause(path.call(print, "consequent"), options);
parts.push("if (", path.call(print, "test"), ")", con);
if (n.alternate)
parts.push(endsWithBrace(con) ? " else" : "\nelse", adjustClause(path.call(print, "alternate"), options));
return (0, lines_1.concat)(parts);
}
case "ForStatement": {
// TODO Get the for (;;) case right.
var init = path.call(print, "init");
var sep = init.length > 1 ? ";\n" : "; ";
var forParen = "for (";
var indented = (0, lines_1.fromString)(sep)
.join([init, path.call(print, "test"), path.call(print, "update")])
.indentTail(forParen.length);
var head = (0, lines_1.concat)([forParen, indented, ")"]);
var clause = adjustClause(path.call(print, "body"), options);
parts.push(head);
if (head.length > 1) {
parts.push("\n");
clause = clause.trimLeft();
}
parts.push(clause);
return (0, lines_1.concat)(parts);
}
case "WhileStatement":
return (0, lines_1.concat)([
"while (",
path.call(print, "test"),
")",
adjustClause(path.call(print, "body"), options),
]);
case "ForInStatement":
// Note: esprima can't actually parse "for each (".
return (0, lines_1.concat)([
n.each ? "for each (" : "for (",
path.call(print, "left"),
" in ",
path.call(print, "right"),
")",
adjustClause(path.call(print, "body"), options),
]);
case "ForOfStatement":
case "ForAwaitStatement":
parts.push("for ");
if (n.await || n.type === "ForAwaitStatement") {
parts.push("await ");
}
parts.push("(", path.call(print, "left"), " of ", path.call(print, "right"), ")", adjustClause(path.call(print, "body"), options));
return (0, lines_1.concat)(parts);
case "DoWhileStatement": {
var doBody = (0, lines_1.concat)([
"do",
adjustClause(path.call(print, "body"), options),
]);
parts.push(doBody);
if (endsWithBrace(doBody))
parts.push(" while");
else
parts.push("\nwhile");
parts.push(" (", path.call(print, "test"), ");");
return (0, lines_1.concat)(parts);
}
case "DoExpression": {
var statements = path.call(function (bodyPath) { return printStatementSequence(bodyPath, options, print); }, "body");
return (0, lines_1.concat)(["do {\n", statements.indent(options.tabWidth), "\n}"]);
}
case "BreakStatement":
parts.push("break");
if (n.label)
parts.push(" ", path.call(print, "label"));
parts.push(";");
return (0, lines_1.concat)(parts);
case "ContinueStatement":
parts.push("continue");
if (n.label)
parts.push(" ", path.call(print, "label"));
parts.push(";");
return (0, lines_1.concat)(parts);
case "LabeledStatement":
return (0, lines_1.concat)([
path.call(print, "label"),
":\n",
path.call(print, "body"),
]);
case "TryStatement":
parts.push("try ", path.call(print, "block"));
if (n.handler) {
parts.push(" ", path.call(print, "handler"));
}
else if (n.handlers) {
path.each(function (handlerPath) {
parts.push(" ", print(handlerPath));
}, "handlers");
}
if (n.finalizer) {
parts.push(" finally ", path.call(print, "finalizer"));
}
return (0, lines_1.concat)(parts);
case "CatchClause":
parts.push("catch ");
if (n.param) {
parts.push("(", path.call(print, "param"));
}
if (n.guard) {
// Note: esprima does not recognize conditional catch clauses.
parts.push(" if ", path.call(print, "guard"));
}
if (n.param) {
parts.push(") ");
}
parts.push(path.call(print, "body"));
return (0, lines_1.concat)(parts);
case "ThrowStatement":
return (0, lines_1.concat)(["throw ", path.call(print, "argument"), ";"]);
case "SwitchStatement":
return (0, lines_1.concat)([
"switch (",
path.call(print, "discriminant"),
") {\n",
(0, lines_1.fromString)("\n").join(path.map(print, "cases")),
"\n}",
]);
// Note: ignoring n.lexical because it has no printing consequences.
case "SwitchCase":
if (n.test)
parts.push("case ", path.call(print, "test"), ":");
else
parts.push("default:");
if (n.consequent.length > 0) {
parts.push("\n", path
.call(function (consequentPath) {
return printStatementSequence(consequentPath, options, print);
}, "consequent")
.indent(options.tabWidth));
}
return (0, lines_1.concat)(parts);
case "DebuggerStatement":
return (0, lines_1.fromString)("debugger;");
// JSX extensions below.
case "JSXAttribute":
parts.push(path.call(print, "name"));
if (n.value)
parts.push("=", path.call(print, "value"));
return (0, lines_1.concat)(parts);
case "JSXIdentifier":
return (0, lines_1.fromString)(n.name, options);
case "JSXNamespacedName":
return (0, lines_1.fromString)(":").join([
path.call(print, "namespace"),
path.call(print, "name"),
]);
case "JSXMemberExpression":
return (0, lines_1.fromString)(".").join([
path.call(print, "object"),
path.call(print, "property"),
]);
case "JSXSpreadAttribute":
return (0, lines_1.concat)(["{...", path.call(print, "argument"), "}"]);
case "JSXSpreadChild":
return (0, lines_1.concat)(["{...", path.call(print, "expression"), "}"]);
case "JSXExpressionContainer":
return (0, lines_1.concat)(["{", path.call(print, "expression"), "}"]);
case "JSXElement":
case "JSXFragment": {
var openingPropName = "opening" + (n.type === "JSXElement" ? "Element" : "Fragment");
var closingPropName = "closing" + (n.type === "JSXElement" ? "Element" : "Fragment");
var openingLines = path.call(print, openingPropName);
if (n[openingPropName].selfClosing) {
(0, tiny_invariant_1.default)(!n[closingPropName], "unexpected " +
closingPropName +
" element in self-closing " +
n.type);
return openingLines;
}
var childLines = (0, lines_1.concat)(path.map(function (childPath) {
var child = childPath.getValue();
if (namedTypes.Literal.check(child) &&
typeof child.value === "string") {
if (/\S/.test(child.value)) {
return child.value.replace(/^\s+/g, "");
}
else if (/\n/.test(child.value)) {
return "\n";
}
}
return print(childPath);
}, "children")).indentTail(options.tabWidth);
var closingLines = path.call(print, closingPropName);
return (0, lines_1.concat)([openingLines, childLines, closingLines]);
}
case "JSXOpeningElement": {
parts.push("<", path.call(print, "name"));
var typeDefPart = path.call(print, "typeParameters");
if (typeDefPart.length)
parts.push(typeDefPart);
var attrParts_1 = [];
path.each(function (attrPath) {
attrParts_1.push(" ", print(attrPath));
}, "attributes");
var attrLines = (0, lines_1.concat)(attrParts_1);
var needLineWrap = attrLines.length > 1 || attrLines.getLineLength(1) > options.wrapColumn;
if (needLineWrap) {
attrParts_1.forEach(function (part, i) {
if (part === " ") {
(0, tiny_invariant_1.default)(i % 2 === 0);
attrParts_1[i] = "\n";
}
});
attrLines = (0, lines_1.concat)(attrParts_1).indentTail(options.tabWidth);
}
parts.push(attrLines, n.selfClosing ? " />" : ">");
return (0, lines_1.concat)(parts);
}
case "JSXClosingElement":
return (0, lines_1.concat)(["</", path.call(print, "name"), ">"]);
case "JSXOpeningFragment":
return (0, lines_1.fromString)("<>");
case "JSXClosingFragment":
return (0, lines_1.fromString)("</>");
case "JSXText":
return (0, lines_1.fromString)(n.value, options);
case "JSXEmptyExpression":
return (0, lines_1.fromString)("");
case "TypeAnnotatedIdentifier":
return (0, lines_1.concat)([
path.call(print, "annotation"),
" ",
path.call(print, "identifier"),
]);
case "ClassBody":
if (n.body.length === 0) {
return (0, lines_1.fromString)("{}");
}
return (0, lines_1.concat)([
"{\n",
path
.call(function (bodyPath) { return printStatementSequence(bodyPath, options, print); }, "body")
.indent(options.tabWidth),
"\n}",
]);
case "ClassPropertyDefinition":
parts.push("static ", path.call(print, "definition"));
if (!namedTypes.MethodDefinition.check(n.definition))
parts.push(";");
return (0, lines_1.concat)(parts);
case "ClassProperty": {
if (n.declare) {
parts.push("declare ");
}
var access = n.accessibility || n.access;
if (typeof access === "string") {
parts.push(access, " ");
}
if (n.static) {
parts.push("static ");
}
if (n.abstract) {
parts.push("abstract ");
}
if (n.readonly) {
parts.push("readonly ");
}
var key = path.call(print, "key");
if (n.computed) {
key = (0, lines_1.concat)(["[", key, "]"]);
}
if (n.variance) {
key = (0, lines_1.concat)([printVariance(path, print), key]);
}
parts.push(key);
if (n.optional) {
parts.push("?");
}
if (n.definite) {
parts.push("!");
}
if (n.typeAnnotation) {
parts.push(path.call(print, "typeAnnotation"));
}
if (n.value) {
parts.push(" = ", path.call(print, "value"));
}
parts.push(";");
return (0, lines_1.concat)(parts);
}
case "ClassPrivateProperty":
if (n.static) {
parts.push("static ");
}
parts.push(path.call(print, "key"));
if (n.typeAnnotation) {
parts.push(path.call(print, "typeAnnotation"));
}
if (n.value) {
parts.push(" = ", path.call(print, "value"));
}
parts.push(";");
return (0, lines_1.concat)(parts);
case "ClassAccessorProperty": {
parts.push.apply(parts, tslib_1.__spreadArray(tslib_1.__spreadArray([], printClassMemberModifiers(n), false), ["accessor "], false));
if (n.computed) {
parts.push("[", path.call(print, "key"), "]");
}
else {
parts.push(path.call(print, "key"));
}
if (n.optional) {
parts.push("?");
}
if (n.definite) {
parts.push("!");
}
if (n.typeAnnotation) {
parts.push(path.call(print, "typeAnnotation"));
}
if (n.value) {
parts.push(" = ", path.call(print, "value"));
}
parts.push(";");
return (0, lines_1.concat)(parts);
}
case "ClassDeclaration":
case "ClassExpression":
case "DeclareClass":
if (n.declare) {
parts.push("declare ");
}
if (n.abstract) {
parts.push("abstract ");
}
parts.push("class");
if (n.id) {
parts.push(" ", path.call(print, "id"));
}
if (n.typeParameters) {
parts.push(path.call(print, "typeParameters"));
}
if (n.superClass) {
// ClassDeclaration and ClassExpression only
parts.push(" extends ", path.call(print, "superClass"), path.call(print, "superTypeParameters"));
}
if (n.extends && n.extends.length > 0) {
// DeclareClass only
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path.map(print, "extends")));
}
if (n["implements"] && n["implements"].length > 0) {
parts.push(" implements ", (0, lines_1.fromString)(", ").join(path.map(print, "implements")));
}
parts.push(" ", path.call(print, "body"));
if (n.type === "DeclareClass") {
return printFlowDeclaration(path, parts);
}
else {
return (0, lines_1.concat)(parts);
}
case "TemplateElement":
return (0, lines_1.fromString)(n.value.raw, options).lockIndentTail();
case "TemplateLiteral": {
var expressions_1 = path.map(print, "expressions");
parts.push("`");
path.each(function (childPath) {
var i = childPath.getName();
parts.push(print(childPath));
if (i < expressions_1.length) {
parts.push("${", expressions_1[i], "}");
}
}, "quasis");
parts.push("`");
return (0, lines_1.concat)(parts).lockIndentTail();
}
case "TaggedTemplateExpression":
parts.push(path.call(print, "tag"));
if (n.typeParameters) {
parts.push(path.call(print, "typeParameters"));
}
parts.push(path.call(print, "quasi"));
return (0, lines_1.concat)(parts);
// These types are unprintable because they serve as abstract
// supertypes for other (printable) types.
case "Node":
case "Printable":
case "SourceLocation":
case "Position":
case "Statement":
case "Function":
case "Pattern":
case "Expression":
case "Declaration":
case "Specifier":
case "NamedSpecifier":
case "Comment": // Supertype of Block and Line
case "Flow": // Supertype of all Flow AST node types
case "FlowType": // Supertype of all Flow types
case "FlowPredicate": // Supertype of InferredPredicate and DeclaredPredicate
case "MemberTypeAnnotation": // Flow
case "Type": // Flow
case "TSHasOptionalTypeParameterInstantiation":
case "TSHasOptionalTypeParameters":
case "TSHasOptionalTypeAnnotation":
case "ChainElement": // Supertype of MemberExpression and CallExpression
throw new Error("unprintable type: " + JSON.stringify(n.type));
case "CommentBlock": // Babel block comment.
case "Block": // Esprima block comment.
return (0, lines_1.concat)(["/*", (0, lines_1.fromString)(n.value, options), "*/"]);
case "CommentLine": // Babel line comment.
case "Line": // Esprima line comment.
return (0, lines_1.concat)(["//", (0, lines_1.fromString)(n.value, options)]);
// Type Annotations for Facebook Flow, typically stripped out or
// transformed away before printing.
case "TypeAnnotation":
if (n.typeAnnotation) {
if (n.typeAnnotation.type !== "FunctionTypeAnnotation") {
parts.push(": ");
}
parts.push(path.call(print, "typeAnnotation"));
return (0, lines_1.concat)(parts);
}
return (0, lines_1.fromString)("");
case "ExistentialTypeParam":
case "ExistsTypeAnnotation":
return (0, lines_1.fromString)("*", options);
case "EmptyTypeAnnotation":
return (0, lines_1.fromString)("empty", options);
case "AnyTypeAnnotation":
return (0, lines_1.fromString)("any", options);
case "MixedTypeAnnotation":
return (0, lines_1.fromString)("mixed", options);
case "ArrayTypeAnnotation":
return (0, lines_1.concat)([path.call(print, "elementType"), "[]"]);
case "TupleTypeAnnotation": {
var printed_2 = path.map(print, "types");
var joined = (0, lines_1.fromString)(", ").join(printed_2);
var oneLine_3 = joined.getLineLength(1) <= options.wrapColumn;
if (oneLine_3) {
if (options.arrayBracketSpacing) {
parts.push("[ ");
}
else {
parts.push("[");
}
}
else {
parts.push("[\n");
}
path.each(function (elemPath) {
var i = elemPath.getName();
var elem = elemPath.getValue();
if (!elem) {
// If the array expression ends with a hole, that hole
// will be ignored by the interpreter, but if it ends with
// two (or more) holes, we need to write out two (or more)
// commas so that the resulting code is interpreted with
// both (all) of the holes.
parts.push(",");
}
else {
var lines = printed_2[i];
if (oneLine_3) {
if (i > 0)
parts.push(" ");
}
else {
lines = lines.indent(options.tabWidth);
}
parts.push(lines);
if (i < n.types.length - 1 ||
(!oneLine_3 && util.isTrailingCommaEnabled(options, "arrays")))
parts.push(",");
if (!oneLine_3)
parts.push("\n");
}
}, "types");
if (oneLine_3 && options.arrayBracketSpacing) {
parts.push(" ]");
}
else {
parts.push("]");
}
return (0, lines_1.concat)(parts);
}
case "BooleanTypeAnnotation":
return (0, lines_1.fromString)("boolean", options);
case "BooleanLiteralTypeAnnotation":
(0, tiny_invariant_1.default)(typeof n.value === "boolean");
return (0, lines_1.fromString)("" + n.value, options);
case "InterfaceTypeAnnotation":
parts.push("interface");
if (n.extends && n.extends.length > 0) {
parts.push(" extends ", (0, lines_1.fromString)(", ").join(path.map(print, "extends")));
}
parts.push(" ", path.call(print, "body"));
return (0, lines_1.concat)(parts);
case "DeclareFunction":
return printFlowDeclaration(path, [
"function ",
path.call(print, "id"),
";",
]);
case "DeclareModule":
return printFlowDeclaration(path, [
"module ",
path.call(print, "id"),
" ",
path.call(print, "body"),
]);
case "DeclareModuleExports":
return printFlowDeclaration(path, [
"module.exports",
path.call(print, "typeAnnotation"),
]);
case "DeclareVariable":
return printFlowDeclaration(path, ["var ", path.call(print, "id"), ";"]);
case "DeclareExportDeclaration":
case "DeclareExportAllDeclaration":
return (0, lines_1.concat)(["declare ", printExportDeclaration(path, options, print)]);
case "EnumDeclaration":
return (0, lines_1.concat)([
"enum ",
path.call(print, "id"),
path.call(print, "body"),
]);
case "EnumBooleanBody":
case "EnumNumberBody":
case "EnumStringBody":
case "EnumSymbolBody": {
if (n.type === "EnumSymbolBody" || n.explicitType) {
parts.push(" of ",
// EnumBooleanBody => boolean, etc.
n.type.slice(4, -4).toLowerCase());
}
parts.push(" {\n", (0, lines_1.fromString)("\n")
.join(path.map(print, "members"))
.indent(options.tabWidth), "\n}");
return (0, lines_1.concat)(parts);
}
case "EnumDefaultedMember":
return (0, lines_1.concat)([path.call(print, "id"), ","]);
case "EnumBooleanMember":
case "EnumNumberMember":
case "EnumStringMember":
return (0, lines_1.concat)([
path.call(print, "id"),
" = ",
path.call(print, "init"),
",",
]);
case "InferredPredicate":
return (0, lines_1.fromString)("%checks", options);
case "DeclaredPredicate":
return (0, lines_1.concat)(["%checks(", path.call(print, "value"), ")"]);
case "FunctionTypeAnnotation": {
// FunctionTypeAnnotation is ambiguous:
// declare function(a: B): void; OR
// const A: (a: B) => void;
var parent = path.getParentNode(0);
var isArrowFunctionTypeAnnotation = !(namedTypes.ObjectTypeCallProperty.check(parent) ||
(namedTypes.ObjectTypeInternalSlot.check(parent) && parent.method) ||
namedTypes.DeclareFunction.check(path.getParentNode(2)));
var needsColon = isArrowFunctionTypeAnnotation &&
!namedTypes.FunctionTypeParam.check(parent) &&
!namedTypes.TypeAlias.check(parent);
if (needsColon) {
parts.push(": ");
}
var hasTypeParameters = !!n.typeParameters;
var needsParens = hasTypeParameters || n.params.length !== 1 || n.params[0].name;
parts.push(hasTypeParameters ? path.call(print, "typeParameters") : "", needsParens ? "(" : "", printFunctionParams(path, options, print), needsParens ? ")" : "");
// The returnType is not wrapped in a TypeAnnotation, so the colon
// needs to be added separately.
if (n.returnType) {
parts.push(isArrowFunctionTypeAnnotation ? " => " : ": ", path.call(print, "returnType"));
}
return (0, lines_1.concat)(parts);
}
case "FunctionTypeParam": {
var name = path.call(print, "name");
parts.push(name);
if (n.optional) {
parts.push("?");
}
if (name.infos[0].line) {
parts.push(": ");
}
parts.push(path.call(print, "typeAnnotation"));
return (0, lines_1.concat)(parts);
}
case "GenericTypeAnnotation":
return (0, lines_1.concat)([
path.call(print, "id"),
path.call(print, "typeParameters"),
]);
case "DeclareInterface":
parts.push("declare ");
// Fall through to InterfaceDeclaration...
case "InterfaceDeclaration":
case "TSInterfaceDeclaration":
if (n.declare) {
parts.push("declare ");
}
parts.push("interface ", path.call(print, "id"), path.call(print, "typeParameters"), " ");
if (n["extends"] && n["extends"].length > 0) {
parts.push("extends ", (0, lines_1.fromString)(", ").join(path.map(print, "extends")), " ");
}
if (n.body) {
parts.push(path.call(print, "body"));
}
return (0, lines_1.concat)(parts);
case "ClassImplements":
case "InterfaceExtends":
return (0, lines_1.concat)([
path.call(print, "id"),
path.call(print, "typeParameters"),
]);
case "IntersectionTypeAnnotation":
return (0, lines_1.fromString)(" & ").join(path.map(print, "types"));
case "NullableTypeAnnotation":
return (0, lines_1.concat)(["?", path.call(print, "typeAnnotation")]);
case "NullLiteralTypeAnnotation":
return (0, lines_1.fromString)("null", options);
case "ThisTypeAnnotation":
return (0, lines_1.fromString)("this", options);
case "NumberTypeAnnotation":
return (0, lines_1.fromString)("number", options);
case "ObjectTypeCallProperty":
return path.call(print, "value");
case "ObjectTypeIndexer":
if (n.static) {
parts.push("static ");
}
parts.push(printVariance(path, print), "[");
if (n.id) {
parts.push(path.call(print, "id"), ": ");
}
parts.push(path.call(print, "key"), "]: ", path.call(print, "value"));
return (0, lines_1.concat)(parts);
case "ObjectTypeProperty":
return (0, lines_1.concat)([
printVariance(path, print),
path.call(print, "key"),
n.optional ? "?" : "",
": ",
path.call(print, "value"),
]);
case "ObjectTypeInternalSlot":
return (0, lines_1.concat)([
n.static ? "static " : "",
"[[",
path.call(print, "id"),
"]]",
n.optional ? "?" : "",
n.value.type !== "FunctionTypeAnnotation" ? ": " : "",
path.call(print, "value"),
]);
case "QualifiedTypeIdentifier":
return (0, lines_1.concat)([
path.call(print, "qualification"),
".",
path.call(print, "id"),
]);
case "StringLiteralTypeAnnotation":
return (0, lines_1.fromString)(nodeStr(n.value, options), options);
case "NumberLiteralTypeAnnotation":
case "NumericLiteralTypeAnnotation":
(0, tiny_invariant_1.default)(typeof n.value === "number");
return (0, lines_1.fromString)(JSON.stringify(n.value), options);
case "BigIntLiteralTypeAnnotation":
return (0, lines_1.fromString)(n.raw, options);
case "StringTypeAnnotation":
return (0, lines_1.fromString)("string", options);
case "DeclareTypeAlias":
parts.push("declare ");
// Fall through to TypeAlias...
case "TypeAlias":
return (0, lines_1.concat)([
"type ",
path.call(print, "id"),
path.call(print, "typeParameters"),
" = ",
path.call(print, "right"),
";",
]);
case "DeclareOpaqueType":
parts.push("declare ");
// Fall through to OpaqueType...
case "OpaqueType":
parts.push("opaque type ", path.call(print, "id"), path.call(print, "typeParameters"));
if (n["supertype"]) {
parts.push(": ", path.call(print, "supertype"));
}
if (n["impltype"]) {
parts.push(" = ", path.call(print, "impltype"));
}
parts.push(";");
return (0, lines_1.concat)(parts);
case "TypeCastExpression":
return (0, lines_1.concat)([
"(",
path.call(print, "expression"),
path.call(print, "typeAnnotation"),
")",
]);
case "TypeParameterDeclaration":
case "TypeParameterInstantiation":
return (0, lines_1.concat)([
"<",
(0, lines_1.fromString)(", ").join(path.map(print, "params")),
">",
]);
case "Variance":
if (n.kind === "plus") {
return (0, lines_1.fromString)("+");
}
if (n.kind === "minus") {
return (0, lines_1.fromString)("-");
}
return (0, lines_1.fromString)("");
case "TypeParameter":
if (n.variance) {
parts.push(printVariance(path, print));
}
parts.push(path.call(print, "name"));
if (n.bound) {
parts.push(path.call(print, "bound"));
}
if (n["default"]) {
parts.push("=", path.call(print, "default"));
}
return (0, lines_1.concat)(parts);
case "TypeofTypeAnnotation":
return (0, lines_1.concat)([
(0, lines_1.fromString)("typeof ", options),
path.call(print, "argument"),
]);
case "IndexedAccessType":
case "OptionalIndexedAccessType":
return (0, lines_1.concat)([
path.call(print, "objectType"),
n.optional ? "?." : "",
"[",
path.call(print, "indexType"),
"]",
]);
case "UnionTypeAnnotation":
return (0, lines_1.fromString)(" | ").join(path.map(print, "types"));
case "VoidTypeAnnotation":
return (0, lines_1.fromString)("void", options);
case "NullTypeAnnotation":
return (0, lines_1.fromString)("null", options);
case "SymbolTypeAnnotation":
return (0, lines_1.fromString)("symbol", options);
case "BigIntTypeAnnotation":
return (0, lines_1.fromString)("bigint", options);
// Type Annotations for TypeScript (when using Babylon as parser)
case "TSType":
throw new Error("unprintable type: " + JSON.stringify(n.type));
case "TSNumberKeyword":
return (0, lines_1.fromString)("number", options);
case "TSBigIntKeyword":
return (0, lines_1.fromString)("bigint", options);
case "TSObjectKeyword":
return (0, lines_1.fromString)("object", options);
case "TSBooleanKeyword":
return (0, lines_1.fromString)("boolean", options);
case "TSStringKeyword":
return (0, lines_1.fromString)("string", options);
case "TSSymbolKeyword":
return (0, lines_1.fromString)("symbol", options);
case "TSAnyKeyword":
return (0, lines_1.fromString)("any", options);
case "TSVoidKeyword":
return (0, lines_1.fromString)("void", options);
case "TSIntrinsicKeyword":
return (0, lines_1.fromString)("intrinsic", options);
case "TSThisType":
return (0, lines_1.fromString)("this", options);
case "TSNullKeyword":
return (0, lines_1.fromString)("null", options);
case "TSUndefinedKeyword":
return (0, lines_1.fromString)("undefined", options);
case "TSUnknownKeyword":
return (0, lines_1.fromString)("unknown", options);
case "TSNeverKeyword":
return (0, lines_1.fromString)("never", options);
case "TSArrayType":
return (0, lines_1.concat)([path.call(print, "elementType"), "[]"]);
case "TSLiteralType":
return path.call(print, "literal");
case "TSUnionType":
return (0, lines_1.fromString)(" | ").join(path.map(print, "types"));
case "TSIntersectionType":
return (0, lines_1.fromString)(" & ").join(path.map(print, "types"));
case "TSConditionalType":
parts.push(path.call(print, "checkType"), " extends ", path.call(print, "extendsType"), " ? ", path.call(print, "trueType"), " : ", path.call(print, "falseType"));
return (0, lines_1.concat)(parts);
case "TSInferType":
parts.push("infer ", path.call(print, "typeParameter"));
return (0, lines_1.concat)(parts);
case "TSParenthesizedType":
return (0, lines_1.concat)(["(", path.call(print, "typeAnnotation"), ")"]);
case "TSFunctionType":
return (0, lines_1.concat)([
path.call(print, "typeParameters"),
"(",
printFunctionParams(path, options, print),
") => ",
path.call(print, "typeAnnotation", "typeAnnotation"),
]);
case "TSConstructorType":
return (0, lines_1.concat)([
"new ",
path.call(print, "typeParameters"),
"(",
printFunctionParams(path, options, print),
") => ",
path.call(print, "typeAnnotation", "typeAnnotation"),
]);
case "TSMappedType": {
parts.push(n.readonly ? "readonly " : "", "[", path.call(print, "typeParameter"), "]", n.optional ? "?" : "");
if (n.typeAnnotation) {
parts.push(": ", path.call(print, "typeAnnotation"), ";");
}
return (0, lines_1.concat)(["{\n", (0, lines_1.concat)(parts).indent(options.tabWidth), "\n}"]);
}
case "TSTupleType":
return (0, lines_1.concat)([
"[",
(0, lines_1.fromString)(", ").join(path.map(print, "elementTypes")),
"]",
]);
case "TSNamedTupleMember":
parts.push(path.call(print, "label"));
if (n.optional) {
parts.push("?");
}
parts.push(": ", path.call(print, "elementType"));
return (0, lines_1.concat)(parts);
case "TSRestType":
return (0, lines_1.concat)(["...", path.call(print, "typeAnnotation")]);
case "TSOptionalType":
return (0, lines_1.concat)([path.call(print, "typeAnnotation"), "?"]);
case "TSIndexedAccessType":
return (0, lines_1.concat)([
path.call(print, "objectType"),
"[",
path.call(print, "indexType"),
"]",
]);
case "TSTypeOperator":
return (0, lines_1.concat)([
path.call(print, "operator"),
" ",
path.call(print, "typeAnnotation"),
]);
case "TSTypeLiteral": {
var members = (0, lines_1.fromString)("\n").join(path.map(print, "members").map(function (member) {
if (lastNonSpaceCharacter(member) !== ";") {
return member.concat(";");
}
return member;
}));
if (members.isEmpty()) {
return (0, lines_1.fromString)("{}", options);
}
parts.push("{\n", members.indent(options.tabWidth), "\n}");
return (0, lines_1.concat)(parts);
}
case "TSEnumMember":
parts.push(path.call(print, "id"));
if (n.initializer) {
parts.push(" = ", path.call(print, "initializer"));
}
return (0, lines_1.concat)(parts);
case "TSTypeQuery":
return (0, lines_1.concat)(["typeof ", path.call(print, "exprName")]);
case "TSParameterProperty":
if (n.accessibility) {
parts.push(n.accessibility, " ");
}
if (n.export) {
parts.push("export ");
}
if (n.static) {
parts.push("static ");
}
if (n.readonly) {
parts.push("readonly ");
}
parts.push(path.call(print, "parameter"));
return (0, lines_1.concat)(parts);
case "TSTypeReference":
return (0, lines_1.concat)([
path.call(print, "typeName"),
path.call(print, "typeParameters"),
]);
case "TSQualifiedName":
return (0, lines_1.concat)([path.call(print, "left"), ".", path.call(print, "right")]);
case "TSAsExpression":
case "TSSatisfiesExpression": {
var expression = path.call(print, "expression");
parts.push(expression, n.type === "TSSatisfiesExpression" ? " satisfies " : " as ", path.call(print, "typeAnnotation"));
return (0, lines_1.concat)(parts);
}
case "TSTypeCastExpression":
return (0, lines_1.concat)([
path.call(print, "expression"),
path.call(print, "typeAnnotation"),
]);
case "TSNonNullExpression":
return (0, lines_1.concat)([path.call(print, "expression"), "!"]);
case "TSTypeAnnotation":
return (0, lines_1.concat)([": ", path.call(print, "typeAnnotation")]);
case "TSIndexSignature":
return (0, lines_1.concat)([
n.readonly ? "readonly " : "",
"[",
path.map(print, "parameters"),
"]",
path.call(print, "typeAnnotation"),
]);
case "TSPropertySignature":
parts.push(printVariance(path, print), n.readonly ? "readonly " : "");
if (n.computed) {
parts.push("[", path.call(print, "key"), "]");
}
else {
parts.push(path.call(print, "key"));
}
parts.push(n.optional ? "?" : "", path.call(print, "typeAnnotation"));
return (0, lines_1.concat)(parts);
case "TSMethodSignature":
if (n.kind === "get") {
parts.push("get ");
}
else if (n.kind === "set") {
parts.push("set ");
}
if (n.computed) {
parts.push("[", path.call(print, "key"), "]");
}
else {
parts.push(path.call(print, "key"));
}
if (n.optional) {
parts.push("?");
}
parts.push(path.call(print, "typeParameters"), "(", printFunctionParams(path, options, print), ")", path.call(print, "typeAnnotation"));
return (0, lines_1.concat)(parts);
case "TSTypePredicate":
if (n.asserts) {
parts.push("asserts ");
}
parts.push(path.call(print, "parameterName"));
if (n.typeAnnotation) {
parts.push(" is ", path.call(print, "typeAnnotation", "typeAnnotation"));
}
return (0, lines_1.concat)(parts);
case "TSCallSignatureDeclaration":
return (0, lines_1.concat)([
path.call(print, "typeParameters"),
"(",
printFunctionParams(path, options, print),
")",
path.call(print, "typeAnnotation"),
]);
case "TSConstructSignatureDeclaration":
if (n.typeParameters) {
parts.push("new", path.call(print, "typeParameters"));
}
else {
parts.push("new ");
}
parts.push("(", printFunctionParams(path, options, print), ")", path.call(print, "typeAnnotation"));
return (0, lines_1.concat)(parts);
case "TSTypeAliasDeclaration":
return (0, lines_1.concat)([
n.declare ? "declare " : "",
"type ",
path.call(print, "id"),
path.call(print, "typeParameters"),
" = ",
path.call(print, "typeAnnotation"),
";",
]);
case "TSTypeParameter": {
parts.push(path.call(print, "name"));
// ambiguous because of TSMappedType
var parent = path.getParentNode(0);
var isInMappedType = namedTypes.TSMappedType.check(parent);
if (n.constraint) {
parts.push(isInMappedType ? " in " : " extends ", path.call(print, "constraint"));
}
if (n["default"]) {
parts.push(" = ", path.call(print, "default"));
}
return (0, lines_1.concat)(parts);
}
case "TSTypeAssertion": {
parts.push("<", path.call(print, "typeAnnotation"), "> ", path.call(print, "expression"));
return (0, lines_1.concat)(parts);
}
case "TSTypeParameterDeclaration":
case "TSTypeParameterInstantiation":
return (0, lines_1.concat)([
"<",
(0, lines_1.fromString)(", ").join(path.map(print, "params")),
">",
]);
case "TSEnumDeclaration": {
parts.push(n.declare ? "declare " : "", n.const ? "const " : "", "enum ", path.call(print, "id"));
var memberLines = (0, lines_1.fromString)(",\n").join(path.map(print, "members"));
if (memberLines.isEmpty()) {
parts.push(" {}");
}
else {
parts.push(" {\n", memberLines.indent(options.tabWidth), "\n}");
}
return (0, lines_1.concat)(parts);
}
case "TSExpressionWithTypeArguments":
return (0, lines_1.concat)([
path.call(print, "expression"),
path.call(print, "typeParameters"),
]);
case "TSInterfaceBody": {
var lines = (0, lines_1.fromString)("\n").join(path.map(print, "body").map(function (element) {
if (lastNonSpaceCharacter(element) !== ";") {
return element.concat(";");
}
return element;
}));
if (lines.isEmpty()) {
return (0, lines_1.fromString)("{}", options);
}
return (0, lines_1.concat)(["{\n", lines.indent(options.tabWidth), "\n}"]);
}
case "TSImportType":
parts.push("import(", path.call(print, "argument"), ")");
if (n.qualifier) {
parts.push(".", path.call(print, "qualifier"));
}
if (n.typeParameters) {
parts.push(path.call(print, "typeParameters"));
}
return (0, lines_1.concat)(parts);
case "TSImportEqualsDeclaration":
if (n.isExport) {
parts.push("export ");
}
parts.push("import ", path.call(print, "id"), " = ", path.call(print, "moduleReference"));
return maybeAddSemicolon((0, lines_1.concat)(parts));
case "TSExternalModuleReference":
return (0, lines_1.concat)(["require(", path.call(print, "expression"), ")"]);
case "TSModuleDeclaration": {
var parent = path.getParentNode();
if (parent.type === "TSModuleDeclaration") {
parts.push(".");
}
else {
if (n.declare) {
parts.push("declare ");
}
if (!n.global) {
var isExternal = n.id.type === "StringLiteral" ||
(n.id.type === "Literal" && typeof n.id.value === "string");
if (isExternal) {
parts.push("module ");
}
else if (n.loc && n.loc.lines && n.id.loc) {
var prefix = n.loc.lines.sliceString(n.loc.start, n.id.loc.start);
// These keywords are fundamentally ambiguous in the
// Babylon parser, and not reflected in the AST, so
// the best we can do is to match the original code,
// when possible.
if (prefix.indexOf("module") >= 0) {
parts.push("module ");
}
else {
parts.push("namespace ");
}
}
else {
parts.push("namespace ");
}
}
}
parts.push(path.call(print, "id"));
if (n.body) {
parts.push(" ");
parts.push(path.call(print, "body"));
}
return (0, lines_1.concat)(parts);
}
case "TSModuleBlock": {
var naked = path.call(function (bodyPath) { return printStatementSequence(bodyPath, options, print); }, "body");
if (naked.isEmpty()) {
parts.push("{}");
}
else {
parts.push("{\n", naked.indent(options.tabWidth), "\n}");
}
return (0, lines_1.concat)(parts);
}
case "TSInstantiationExpression": {
parts.push(path.call(print, "expression"), path.call(print, "typeParameters"));
return (0, lines_1.concat)(parts);
}
// https://github.com/babel/babel/pull/10148
case "V8IntrinsicIdentifier":
return (0, lines_1.concat)(["%", path.call(print, "name")]);
// https://github.com/babel/babel/pull/13191
case "TopicReference":
return (0, lines_1.fromString)("#");
// Unhandled types below. If encountered, nodes of these types should
// be either left alone or desugared into AST types that are fully
// supported by the pretty-printer.
case "ClassHeritage": // TODO
case "ComprehensionBlock": // TODO
case "ComprehensionExpression": // TODO
case "Glob": // TODO
case "GeneratorExpression": // TODO
case "LetStatement": // TODO
case "LetExpression": // TODO
case "GraphExpression": // TODO
case "GraphIndexExpression": // TODO
case "XMLDefaultDeclaration":
case "XMLAnyName":
case "XMLQualifiedIdentifier":
case "XMLFunctionQualifiedIdentifier":
case "XMLAttributeSelector":
case "XMLFilterExpression":
case "XML":
case "XMLElement":
case "XMLList":
case "XMLEscape":
case "XMLText":
case "XMLStartTag":
case "XMLEndTag":
case "XMLPointTag":
case "XMLName":
case "XMLAttribute":
case "XMLCdata":
case "XMLComment":
case "XMLProcessingInstruction":
default:
debugger;
throw new Error("unknown type: " + JSON.stringify(n.type));
}
}
function printDecorators(path, printPath) {
var parts = [];
var node = path.getValue();
if (node.decorators &&
node.decorators.length > 0 &&
// If the parent node is an export declaration, it will be
// responsible for printing node.decorators.
!util.getParentExportDeclaration(path)) {
path.each(function (decoratorPath) {
parts.push(printPath(decoratorPath), "\n");
}, "decorators");
}
else if (util.isExportDeclaration(node) &&
node.declaration &&
node.declaration.decorators) {
// Export declarations are responsible for printing any decorators
// that logically apply to node.declaration.
path.each(function (decoratorPath) {
parts.push(printPath(decoratorPath), "\n");
}, "declaration", "decorators");
}
return (0, lines_1.concat)(parts);
}
function printStatementSequence(path, options, print) {
var filtered = [];
var sawComment = false;
var sawStatement = false;
path.each(function (stmtPath) {
var stmt = stmtPath.getValue();
// Just in case the AST has been modified to contain falsy
// "statements," it's safer simply to skip them.
if (!stmt) {
return;
}
// Skip printing EmptyStatement nodes to avoid leaving stray
// semicolons lying around.
if (stmt.type === "EmptyStatement" &&
!(stmt.comments && stmt.comments.length > 0)) {
return;
}
if (namedTypes.Comment.check(stmt)) {
// The pretty printer allows a dangling Comment node to act as
// a Statement when the Comment can't be attached to any other
// non-Comment node in the tree.
sawComment = true;
}
else if (namedTypes.Statement.check(stmt)) {
sawStatement = true;
}
else {
// When the pretty printer encounters a string instead of an
// AST node, it just prints the string. This behavior can be
// useful for fine-grained formatting decisions like inserting
// blank lines.
isString.assert(stmt);
}
// We can't hang onto stmtPath outside of this function, because
// it's just a reference to a mutable FastPath object, so we have
// to go ahead and print it here.
filtered.push({
node: stmt,
printed: print(stmtPath),
});
});
if (sawComment) {
(0, tiny_invariant_1.default)(sawStatement === false, "Comments may appear as statements in otherwise empty statement " +
"lists, but may not coexist with non-Comment nodes.");
}
var prevTrailingSpace = null;
var len = filtered.length;
var parts = [];
filtered.forEach(function (info, i) {
var printed = info.printed;
var stmt = info.node;
var multiLine = printed.length > 1;
var notFirst = i > 0;
var notLast = i < len - 1;
var leadingSpace;
var trailingSpace;
var lines = stmt && stmt.loc && stmt.loc.lines;
var trueLoc = lines && options.reuseWhitespace && util.getTrueLoc(stmt, lines);
if (notFirst) {
if (trueLoc) {
var beforeStart = lines.skipSpaces(trueLoc.start, true);
var beforeStartLine = beforeStart ? beforeStart.line : 1;
var leadingGap = trueLoc.start.line - beforeStartLine;
leadingSpace = Array(leadingGap + 1).join("\n");
}
else {
leadingSpace = multiLine ? "\n\n" : "\n";
}
}
else {
leadingSpace = "";
}
if (notLast) {
if (trueLoc) {
var afterEnd = lines.skipSpaces(trueLoc.end);
var afterEndLine = afterEnd ? afterEnd.line : lines.length;
var trailingGap = afterEndLine - trueLoc.end.line;
trailingSpace = Array(trailingGap + 1).join("\n");
}
else {
trailingSpace = multiLine ? "\n\n" : "\n";
}
}
else {
trailingSpace = "";
}
parts.push(maxSpace(prevTrailingSpace, leadingSpace), printed);
if (notLast) {
prevTrailingSpace = trailingSpace;
}
else if (trailingSpace) {
parts.push(trailingSpace);
}
});
return (0, lines_1.concat)(parts);
}
function maxSpace(s1, s2) {
if (!s1 && !s2) {
return (0, lines_1.fromString)("");
}
if (!s1) {
return (0, lines_1.fromString)(s2);
}
if (!s2) {
return (0, lines_1.fromString)(s1);
}
var spaceLines1 = (0, lines_1.fromString)(s1);
var spaceLines2 = (0, lines_1.fromString)(s2);
if (spaceLines2.length > spaceLines1.length) {
return spaceLines2;
}
return spaceLines1;
}
function printClassMemberModifiers(node) {
var parts = [];
if (node.declare) {
parts.push("declare ");
}
var access = node.accessibility || node.access;
if (typeof access === "string") {
parts.push(access, " ");
}
if (node.static) {
parts.push("static ");
}
if (node.override) {
parts.push("override ");
}
if (node.abstract) {
parts.push("abstract ");
}
if (node.readonly) {
parts.push("readonly ");
}
return parts;
}
function printMethod(path, options, print) {
var node = path.getNode();
var kind = node.kind;
var parts = [];
var nodeValue = node.value;
if (!namedTypes.FunctionExpression.check(nodeValue)) {
nodeValue = node;
}
parts.push.apply(parts, printClassMemberModifiers(node));
if (nodeValue.async) {
parts.push("async ");
}
if (nodeValue.generator) {
parts.push("*");
}
if (kind === "get" || kind === "set") {
parts.push(kind, " ");
}
var key = path.call(print, "key");
if (node.computed) {
key = (0, lines_1.concat)(["[", key, "]"]);
}
parts.push(key);
if (node.optional) {
parts.push("?");
}
if (node === nodeValue) {
parts.push(path.call(print, "typeParameters"), "(", printFunctionParams(path, options, print), ")", path.call(print, "returnType"));
if (node.body) {
parts.push(" ", path.call(print, "body"));
}
else {
parts.push(";");
}
}
else {
parts.push(path.call(print, "value", "typeParameters"), "(", path.call(function (valuePath) { return printFunctionParams(valuePath, options, print); }, "value"), ")", path.call(print, "value", "returnType"));
if (nodeValue.body) {
parts.push(" ", path.call(print, "value", "body"));
}
else {
parts.push(";");
}
}
return (0, lines_1.concat)(parts);
}
function printArgumentsList(path, options, print) {
var printed = path.map(print, "arguments");
var trailingComma = util.isTrailingCommaEnabled(options, "parameters");
var joined = (0, lines_1.fromString)(", ").join(printed);
if (joined.getLineLength(1) > options.wrapColumn) {
joined = (0, lines_1.fromString)(",\n").join(printed);
return (0, lines_1.concat)([
"(\n",
joined.indent(options.tabWidth),
trailingComma ? ",\n)" : "\n)",
]);
}
return (0, lines_1.concat)(["(", joined, ")"]);
}
function printFunctionParams(path, options, print) {
var fun = path.getValue();
var params;
var printed = [];
if (fun.params) {
params = fun.params;
printed = path.map(print, "params");
}
else if (fun.parameters) {
params = fun.parameters;
printed = path.map(print, "parameters");
}
if (fun.defaults) {
path.each(function (defExprPath) {
var i = defExprPath.getName();
var p = printed[i];
if (p && defExprPath.getValue()) {
printed[i] = (0, lines_1.concat)([p, " = ", print(defExprPath)]);
}
}, "defaults");
}
if (fun.rest) {
printed.push((0, lines_1.concat)(["...", path.call(print, "rest")]));
}
var joined = (0, lines_1.fromString)(", ").join(printed);
if (joined.length > 1 || joined.getLineLength(1) > options.wrapColumn) {
joined = (0, lines_1.fromString)(",\n").join(printed);
if (util.isTrailingCommaEnabled(options, "parameters") &&
!fun.rest &&
params[params.length - 1].type !== "RestElement") {
joined = (0, lines_1.concat)([joined, ",\n"]);
}
else {
joined = (0, lines_1.concat)([joined, "\n"]);
}
return (0, lines_1.concat)(["\n", joined.indent(options.tabWidth)]);
}
return joined;
}
function maybePrintImportAssertions(path, options, print) {
var n = path.getValue();
if (n.assertions && n.assertions.length > 0) {
var parts = [" assert {"];
var printed = path.map(print, "assertions");
var flat = (0, lines_1.fromString)(", ").join(printed);
if (flat.length > 1 || flat.getLineLength(1) > options.wrapColumn) {
parts.push("\n", (0, lines_1.fromString)(",\n").join(printed).indent(options.tabWidth), "\n}");
}
else {
parts.push(" ", flat, " }");
}
return (0, lines_1.concat)(parts);
}
return (0, lines_1.fromString)("");
}
function printExportDeclaration(path, options, print) {
var decl = path.getValue();
var parts = ["export "];
if (decl.exportKind && decl.exportKind === "type") {
if (!decl.declaration) {
parts.push("type ");
}
}
var shouldPrintSpaces = options.objectCurlySpacing;
namedTypes.Declaration.assert(decl);
if (decl["default"] || decl.type === "ExportDefaultDeclaration") {
parts.push("default ");
}
if (decl.declaration) {
parts.push(path.call(print, "declaration"));
}
else if (decl.specifiers) {
if (decl.specifiers.length === 1 &&
decl.specifiers[0].type === "ExportBatchSpecifier") {
parts.push("*");
}
else if (decl.specifiers.length === 0) {
parts.push("{}");
}
else if (decl.specifiers[0].type === "ExportDefaultSpecifier" ||
decl.specifiers[0].type === "ExportNamespaceSpecifier") {
var unbracedSpecifiers_2 = [];
var bracedSpecifiers_2 = [];
path.each(function (specifierPath) {
var spec = specifierPath.getValue();
if (spec.type === "ExportDefaultSpecifier" ||
spec.type === "ExportNamespaceSpecifier") {
unbracedSpecifiers_2.push(print(specifierPath));
}
else {
bracedSpecifiers_2.push(print(specifierPath));
}
}, "specifiers");
unbracedSpecifiers_2.forEach(function (lines, i) {
if (i > 0) {
parts.push(", ");
}
parts.push(lines);
});
if (bracedSpecifiers_2.length > 0) {
var lines_2 = (0, lines_1.fromString)(", ").join(bracedSpecifiers_2);
if (lines_2.getLineLength(1) > options.wrapColumn) {
lines_2 = (0, lines_1.concat)([
(0, lines_1.fromString)(",\n").join(bracedSpecifiers_2).indent(options.tabWidth),
",",
]);
}
if (unbracedSpecifiers_2.length > 0) {
parts.push(", ");
}
if (lines_2.length > 1) {
parts.push("{\n", lines_2, "\n}");
}
else if (options.objectCurlySpacing) {
parts.push("{ ", lines_2, " }");
}
else {
parts.push("{", lines_2, "}");
}
}
}
else {
parts.push(shouldPrintSpaces ? "{ " : "{", (0, lines_1.fromString)(", ").join(path.map(print, "specifiers")), shouldPrintSpaces ? " }" : "}");
}
if (decl.source) {
parts.push(" from ", path.call(print, "source"), maybePrintImportAssertions(path, options, print));
}
}
var lines = (0, lines_1.concat)(parts);
if (lastNonSpaceCharacter(lines) !== ";" &&
!(decl.declaration &&
(decl.declaration.type === "FunctionDeclaration" ||
decl.declaration.type === "ClassDeclaration" ||
decl.declaration.type === "TSModuleDeclaration" ||
decl.declaration.type === "TSInterfaceDeclaration" ||
decl.declaration.type === "TSEnumDeclaration"))) {
lines = (0, lines_1.concat)([lines, ";"]);
}
return lines;
}
function printFlowDeclaration(path, parts) {
var parentExportDecl = util.getParentExportDeclaration(path);
if (parentExportDecl) {
(0, tiny_invariant_1.default)(parentExportDecl.type === "DeclareExportDeclaration");
}
else {
// If the parent node has type DeclareExportDeclaration, then it
// will be responsible for printing the "declare" token. Otherwise
// it needs to be printed with this non-exported declaration node.
parts.unshift("declare ");
}
return (0, lines_1.concat)(parts);
}
function printVariance(path, print) {
return path.call(function (variancePath) {
var value = variancePath.getValue();
if (value) {
if (value === "plus") {
return (0, lines_1.fromString)("+");
}
if (value === "minus") {
return (0, lines_1.fromString)("-");
}
return print(variancePath);
}
return (0, lines_1.fromString)("");
}, "variance");
}
function adjustClause(clause, options) {
if (clause.length > 1)
return (0, lines_1.concat)([" ", clause]);
return (0, lines_1.concat)(["\n", maybeAddSemicolon(clause).indent(options.tabWidth)]);
}
function lastNonSpaceCharacter(lines) {
var pos = lines.lastPos();
do {
var ch = lines.charAt(pos);
if (/\S/.test(ch))
return ch;
} while (lines.prevPos(pos));
}
function endsWithBrace(lines) {
return lastNonSpaceCharacter(lines) === "}";
}
function swapQuotes(str) {
return str.replace(/['"]/g, function (m) { return (m === '"' ? "'" : '"'); });
}
function getPossibleRaw(node) {
var value = types.getFieldValue(node, "value");
var extra = types.getFieldValue(node, "extra");
if (extra && typeof extra.raw === "string" && value == extra.rawValue) {
return extra.raw;
}
if (node.type === "Literal") {
var raw = node.raw;
if (typeof raw === "string" && value == raw) {
return raw;
}
}
}
function jsSafeStringify(str) {
return JSON.stringify(str).replace(/[\u2028\u2029]/g, function (m) {
return "\\u" + m.charCodeAt(0).toString(16);
});
}
function nodeStr(str, options) {
isString.assert(str);
switch (options.quote) {
case "auto": {
var double = jsSafeStringify(str);
var single = swapQuotes(jsSafeStringify(swapQuotes(str)));
return double.length > single.length ? single : double;
}
case "single":
return swapQuotes(jsSafeStringify(swapQuotes(str)));
case "double":
default:
return jsSafeStringify(str);
}
}
function maybeAddSemicolon(lines) {
var eoc = lastNonSpaceCharacter(lines);
if (!eoc || "\n};".indexOf(eoc) < 0)
return (0, lines_1.concat)([lines, ";"]);
return lines;
}
/***/ }),
/***/ "./node_modules/recast/lib/util.js":
/*!*****************************************!*\
!*** ./node_modules/recast/lib/util.js ***!
\*****************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.isTrailingCommaEnabled = exports.getParentExportDeclaration = exports.isExportDeclaration = exports.fixFaultyLocations = exports.getTrueLoc = exports.composeSourceMaps = exports.copyPos = exports.comparePos = exports.getUnionOfKeys = exports.getOption = exports.isBrowser = exports.getLineTerminator = void 0;
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var tiny_invariant_1 = tslib_1.__importDefault(__webpack_require__(/*! tiny-invariant */ "./node_modules/tiny-invariant/dist/tiny-invariant.cjs.js"));
var types = tslib_1.__importStar(__webpack_require__(/*! ast-types */ "./node_modules/ast-types/lib/main.js"));
var n = types.namedTypes;
var source_map_1 = tslib_1.__importDefault(__webpack_require__(/*! source-map */ "./node_modules/recast/node_modules/source-map/source-map.js"));
var SourceMapConsumer = source_map_1.default.SourceMapConsumer;
var SourceMapGenerator = source_map_1.default.SourceMapGenerator;
var hasOwn = Object.prototype.hasOwnProperty;
function getLineTerminator() {
return isBrowser() ? "\n" : (__webpack_require__(/*! os */ "./node_modules/os-browserify/browser.js").EOL) || "\n";
}
exports.getLineTerminator = getLineTerminator;
function isBrowser() {
return (typeof window !== "undefined" && typeof window.document !== "undefined");
}
exports.isBrowser = isBrowser;
function getOption(options, key, defaultValue) {
if (options && hasOwn.call(options, key)) {
return options[key];
}
return defaultValue;
}
exports.getOption = getOption;
function getUnionOfKeys() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
var result = {};
var argc = args.length;
for (var i = 0; i < argc; ++i) {
var keys = Object.keys(args[i]);
var keyCount = keys.length;
for (var j = 0; j < keyCount; ++j) {
result[keys[j]] = true;
}
}
return result;
}
exports.getUnionOfKeys = getUnionOfKeys;
function comparePos(pos1, pos2) {
return pos1.line - pos2.line || pos1.column - pos2.column;
}
exports.comparePos = comparePos;
function copyPos(pos) {
return {
line: pos.line,
column: pos.column,
};
}
exports.copyPos = copyPos;
function composeSourceMaps(formerMap, latterMap) {
if (formerMap) {
if (!latterMap) {
return formerMap;
}
}
else {
return latterMap || null;
}
var smcFormer = new SourceMapConsumer(formerMap);
var smcLatter = new SourceMapConsumer(latterMap);
var smg = new SourceMapGenerator({
file: latterMap.file,
sourceRoot: latterMap.sourceRoot,
});
var sourcesToContents = {};
smcLatter.eachMapping(function (mapping) {
var origPos = smcFormer.originalPositionFor({
line: mapping.originalLine,
column: mapping.originalColumn,
});
var sourceName = origPos.source;
if (sourceName === null) {
return;
}
smg.addMapping({
source: sourceName,
original: copyPos(origPos),
generated: {
line: mapping.generatedLine,
column: mapping.generatedColumn,
},
name: mapping.name,
});
var sourceContent = smcFormer.sourceContentFor(sourceName);
if (sourceContent && !hasOwn.call(sourcesToContents, sourceName)) {
sourcesToContents[sourceName] = sourceContent;
smg.setSourceContent(sourceName, sourceContent);
}
});
return smg.toJSON();
}
exports.composeSourceMaps = composeSourceMaps;
function getTrueLoc(node, lines) {
// It's possible that node is newly-created (not parsed by Esprima),
// in which case it probably won't have a .loc property (or an
// .original property for that matter). That's fine; we'll just
// pretty-print it as usual.
if (!node.loc) {
return null;
}
var result = {
start: node.loc.start,
end: node.loc.end,
};
function include(node) {
expandLoc(result, node.loc);
}
// If the node is an export declaration and its .declaration has any
// decorators, their locations might contribute to the true start/end
// positions of the export declaration node.
if (node.declaration &&
node.declaration.decorators &&
isExportDeclaration(node)) {
node.declaration.decorators.forEach(include);
}
if (comparePos(result.start, result.end) < 0) {
// Trim leading whitespace.
result.start = copyPos(result.start);
lines.skipSpaces(result.start, false, true);
if (comparePos(result.start, result.end) < 0) {
// Trim trailing whitespace, if the end location is not already the
// same as the start location.
result.end = copyPos(result.end);
lines.skipSpaces(result.end, true, true);
}
}
// If the node has any comments, their locations might contribute to
// the true start/end positions of the node.
if (node.comments) {
node.comments.forEach(include);
}
return result;
}
exports.getTrueLoc = getTrueLoc;
function expandLoc(parentLoc, childLoc) {
if (parentLoc && childLoc) {
if (comparePos(childLoc.start, parentLoc.start) < 0) {
parentLoc.start = childLoc.start;
}
if (comparePos(parentLoc.end, childLoc.end) < 0) {
parentLoc.end = childLoc.end;
}
}
}
function fixFaultyLocations(node, lines) {
var loc = node.loc;
if (loc) {
if (loc.start.line < 1) {
loc.start.line = 1;
}
if (loc.end.line < 1) {
loc.end.line = 1;
}
}
if (node.type === "File") {
// Babylon returns File nodes whose .loc.{start,end} do not include
// leading or trailing whitespace.
loc.start = lines.firstPos();
loc.end = lines.lastPos();
}
fixForLoopHead(node, lines);
fixTemplateLiteral(node, lines);
if (loc && node.decorators) {
// Expand the .loc of the node responsible for printing the decorators
// (here, the decorated node) so that it includes node.decorators.
node.decorators.forEach(function (decorator) {
expandLoc(loc, decorator.loc);
});
}
else if (node.declaration && isExportDeclaration(node)) {
// Nullify .loc information for the child declaration so that we never
// try to reprint it without also reprinting the export declaration.
node.declaration.loc = null;
// Expand the .loc of the node responsible for printing the decorators
// (here, the export declaration) so that it includes node.decorators.
var decorators = node.declaration.decorators;
if (decorators) {
decorators.forEach(function (decorator) {
expandLoc(loc, decorator.loc);
});
}
}
else if ((n.MethodDefinition && n.MethodDefinition.check(node)) ||
(n.Property.check(node) && (node.method || node.shorthand))) {
// If the node is a MethodDefinition or a .method or .shorthand
// Property, then the location information stored in
// node.value.loc is very likely untrustworthy (just the {body}
// part of a method, or nothing in the case of shorthand
// properties), so we null out that information to prevent
// accidental reuse of bogus source code during reprinting.
node.value.loc = null;
if (n.FunctionExpression.check(node.value)) {
// FunctionExpression method values should be anonymous,
// because their .id fields are ignored anyway.
node.value.id = null;
}
}
else if (node.type === "ObjectTypeProperty") {
var loc_1 = node.loc;
var end = loc_1 && loc_1.end;
if (end) {
end = copyPos(end);
if (lines.prevPos(end) && lines.charAt(end) === ",") {
// Some parsers accidentally include trailing commas in the
// .loc.end information for ObjectTypeProperty nodes.
if ((end = lines.skipSpaces(end, true, true))) {
loc_1.end = end;
}
}
}
}
}
exports.fixFaultyLocations = fixFaultyLocations;
function fixForLoopHead(node, lines) {
if (node.type !== "ForStatement") {
return;
}
function fix(child) {
var loc = child && child.loc;
var start = loc && loc.start;
var end = loc && copyPos(loc.end);
while (start && end && comparePos(start, end) < 0) {
lines.prevPos(end);
if (lines.charAt(end) === ";") {
// Update child.loc.end to *exclude* the ';' character.
loc.end.line = end.line;
loc.end.column = end.column;
}
else {
break;
}
}
}
fix(node.init);
fix(node.test);
fix(node.update);
}
function fixTemplateLiteral(node, lines) {
if (node.type !== "TemplateLiteral") {
return;
}
if (node.quasis.length === 0) {
// If there are no quasi elements, then there is nothing to fix.
return;
}
// node.loc is not present when using export default with a template literal
if (node.loc) {
// First we need to exclude the opening ` from the .loc of the first
// quasi element, in case the parser accidentally decided to include it.
var afterLeftBackTickPos = copyPos(node.loc.start);
(0, tiny_invariant_1.default)(lines.charAt(afterLeftBackTickPos) === "`");
(0, tiny_invariant_1.default)(lines.nextPos(afterLeftBackTickPos));
var firstQuasi = node.quasis[0];
if (comparePos(firstQuasi.loc.start, afterLeftBackTickPos) < 0) {
firstQuasi.loc.start = afterLeftBackTickPos;
}
// Next we need to exclude the closing ` from the .loc of the last quasi
// element, in case the parser accidentally decided to include it.
var rightBackTickPos = copyPos(node.loc.end);
(0, tiny_invariant_1.default)(lines.prevPos(rightBackTickPos));
(0, tiny_invariant_1.default)(lines.charAt(rightBackTickPos) === "`");
var lastQuasi = node.quasis[node.quasis.length - 1];
if (comparePos(rightBackTickPos, lastQuasi.loc.end) < 0) {
lastQuasi.loc.end = rightBackTickPos;
}
}
// Now we need to exclude ${ and } characters from the .loc's of all
// quasi elements, since some parsers accidentally include them.
node.expressions.forEach(function (expr, i) {
// Rewind from expr.loc.start over any whitespace and the ${ that
// precedes the expression. The position of the $ should be the same
// as the .loc.end of the preceding quasi element, but some parsers
// accidentally include the ${ in the .loc of the quasi element.
var dollarCurlyPos = lines.skipSpaces(expr.loc.start, true, false);
if (lines.prevPos(dollarCurlyPos) &&
lines.charAt(dollarCurlyPos) === "{" &&
lines.prevPos(dollarCurlyPos) &&
lines.charAt(dollarCurlyPos) === "$") {
var quasiBefore = node.quasis[i];
if (comparePos(dollarCurlyPos, quasiBefore.loc.end) < 0) {
quasiBefore.loc.end = dollarCurlyPos;
}
}
// Likewise, some parsers accidentally include the } that follows
// the expression in the .loc of the following quasi element.
var rightCurlyPos = lines.skipSpaces(expr.loc.end, false, false);
if (lines.charAt(rightCurlyPos) === "}") {
(0, tiny_invariant_1.default)(lines.nextPos(rightCurlyPos));
// Now rightCurlyPos is technically the position just after the }.
var quasiAfter = node.quasis[i + 1];
if (comparePos(quasiAfter.loc.start, rightCurlyPos) < 0) {
quasiAfter.loc.start = rightCurlyPos;
}
}
});
}
function isExportDeclaration(node) {
if (node)
switch (node.type) {
case "ExportDeclaration":
case "ExportDefaultDeclaration":
case "ExportDefaultSpecifier":
case "DeclareExportDeclaration":
case "ExportNamedDeclaration":
case "ExportAllDeclaration":
return true;
}
return false;
}
exports.isExportDeclaration = isExportDeclaration;
function getParentExportDeclaration(path) {
var parentNode = path.getParentNode();
if (path.getName() === "declaration" && isExportDeclaration(parentNode)) {
return parentNode;
}
return null;
}
exports.getParentExportDeclaration = getParentExportDeclaration;
function isTrailingCommaEnabled(options, context) {
var trailingComma = options.trailingComma;
if (typeof trailingComma === "object") {
return !!trailingComma[context];
}
return !!trailingComma;
}
exports.isTrailingCommaEnabled = isTrailingCommaEnabled;
/***/ }),
/***/ "./node_modules/recast/main.js":
/*!*************************************!*\
!*** ./node_modules/recast/main.js ***!
\*************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
/* provided dependency */ var process = __webpack_require__(/*! process/browser.js */ "./node_modules/process/browser.js");
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.run = exports.prettyPrint = exports.print = exports.visit = exports.types = exports.parse = void 0;
var tslib_1 = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.mjs");
var fs_1 = tslib_1.__importDefault(__webpack_require__(/*! fs */ "?5042"));
var types = tslib_1.__importStar(__webpack_require__(/*! ast-types */ "./node_modules/ast-types/lib/main.js"));
exports.types = types;
var parser_1 = __webpack_require__(/*! ./lib/parser */ "./node_modules/recast/lib/parser.js");
Object.defineProperty(exports, "parse", ({ enumerable: true, get: function () { return parser_1.parse; } }));
var printer_1 = __webpack_require__(/*! ./lib/printer */ "./node_modules/recast/lib/printer.js");
/**
* Traverse and potentially modify an abstract syntax tree using a
* convenient visitor syntax:
*
* recast.visit(ast, {
* names: [],
* visitIdentifier: function(path) {
* var node = path.value;
* this.visitor.names.push(node.name);
* this.traverse(path);
* }
* });
*/
var ast_types_1 = __webpack_require__(/*! ast-types */ "./node_modules/ast-types/lib/main.js");
Object.defineProperty(exports, "visit", ({ enumerable: true, get: function () { return ast_types_1.visit; } }));
/**
* Reprint a modified syntax tree using as much of the original source
* code as possible.
*/
function print(node, options) {
return new printer_1.Printer(options).print(node);
}
exports.print = print;
/**
* Print without attempting to reuse any original source code.
*/
function prettyPrint(node, options) {
return new printer_1.Printer(options).printGenerically(node);
}
exports.prettyPrint = prettyPrint;
/**
* Convenient command-line interface (see e.g. example/add-braces).
*/
function run(transformer, options) {
return runFile(process.argv[2], transformer, options);
}
exports.run = run;
function runFile(path, transformer, options) {
fs_1.default.readFile(path, "utf-8", function (err, code) {
if (err) {
console.error(err);
return;
}
runString(code, transformer, options);
});
}
function defaultWriteback(output) {
process.stdout.write(output);
}
function runString(code, transformer, options) {
var writeback = (options && options.writeback) || defaultWriteback;
transformer((0, parser_1.parse)(code, options), function (node) {
writeback(print(node, options).code);
});
}
/***/ }),
/***/ "./node_modules/recast/node_modules/source-map/lib/array-set.js":
/*!**********************************************************************!*\
!*** ./node_modules/recast/node_modules/source-map/lib/array-set.js ***!
\**********************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var util = __webpack_require__(/*! ./util */ "./node_modules/recast/node_modules/source-map/lib/util.js");
var has = Object.prototype.hasOwnProperty;
var hasNativeMap = typeof Map !== "undefined";
/**
* A data structure which is a combination of an array and a set. Adding a new
* member is O(1), testing for membership is O(1), and finding the index of an
* element is O(1). Removing elements from the set is not supported. Only
* strings are supported for membership.
*/
function ArraySet() {
this._array = [];
this._set = hasNativeMap ? new Map() : Object.create(null);
}
/**
* Static method for creating ArraySet instances from an existing array.
*/
ArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {
var set = new ArraySet();
for (var i = 0, len = aArray.length; i < len; i++) {
set.add(aArray[i], aAllowDuplicates);
}
return set;
};
/**
* Return how many unique items are in this ArraySet. If duplicates have been
* added, than those do not count towards the size.
*
* @returns Number
*/
ArraySet.prototype.size = function ArraySet_size() {
return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;
};
/**
* Add the given string to this set.
*
* @param String aStr
*/
ArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {
var sStr = hasNativeMap ? aStr : util.toSetString(aStr);
var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);
var idx = this._array.length;
if (!isDuplicate || aAllowDuplicates) {
this._array.push(aStr);
}
if (!isDuplicate) {
if (hasNativeMap) {
this._set.set(aStr, idx);
} else {
this._set[sStr] = idx;
}
}
};
/**
* Is the given string a member of this set?
*
* @param String aStr
*/
ArraySet.prototype.has = function ArraySet_has(aStr) {
if (hasNativeMap) {
return this._set.has(aStr);
} else {
var sStr = util.toSetString(aStr);
return has.call(this._set, sStr);
}
};
/**
* What is the index of the given string in the array?
*
* @param String aStr
*/
ArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {
if (hasNativeMap) {
var idx = this._set.get(aStr);
if (idx >= 0) {
return idx;
}
} else {
var sStr = util.toSetString(aStr);
if (has.call(this._set, sStr)) {
return this._set[sStr];
}
}
throw new Error('"' + aStr + '" is not in the set.');
};
/**
* What is the element at the given index?
*
* @param Number aIdx
*/
ArraySet.prototype.at = function ArraySet_at(aIdx) {
if (aIdx >= 0 && aIdx < this._array.length) {
return this._array[aIdx];
}
throw new Error('No element indexed by ' + aIdx);
};
/**
* Returns the array representation of this set (which has the proper indices
* indicated by indexOf). Note that this is a copy of the internal array used
* for storing the members so that no one can mess with internal state.
*/
ArraySet.prototype.toArray = function ArraySet_toArray() {
return this._array.slice();
};
exports.ArraySet = ArraySet;
/***/ }),
/***/ "./node_modules/recast/node_modules/source-map/lib/base64-vlq.js":
/*!***********************************************************************!*\
!*** ./node_modules/recast/node_modules/source-map/lib/base64-vlq.js ***!
\***********************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*
* Based on the Base 64 VLQ implementation in Closure Compiler:
* https://code.google.com/p/closure-compiler/source/browse/trunk/src/com/google/debugging/sourcemap/Base64VLQ.java
*
* Copyright 2011 The Closure Compiler Authors. All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
var base64 = __webpack_require__(/*! ./base64 */ "./node_modules/recast/node_modules/source-map/lib/base64.js");
// A single base 64 digit can contain 6 bits of data. For the base 64 variable
// length quantities we use in the source map spec, the first bit is the sign,
// the next four bits are the actual value, and the 6th bit is the
// continuation bit. The continuation bit tells us whether there are more
// digits in this value following this digit.
//
// Continuation
// | Sign
// | |
// V V
// 101011
var VLQ_BASE_SHIFT = 5;
// binary: 100000
var VLQ_BASE = 1 << VLQ_BASE_SHIFT;
// binary: 011111
var VLQ_BASE_MASK = VLQ_BASE - 1;
// binary: 100000
var VLQ_CONTINUATION_BIT = VLQ_BASE;
/**
* Converts from a two-complement value to a value where the sign bit is
* placed in the least significant bit. For example, as decimals:
* 1 becomes 2 (10 binary), -1 becomes 3 (11 binary)
* 2 becomes 4 (100 binary), -2 becomes 5 (101 binary)
*/
function toVLQSigned(aValue) {
return aValue < 0
? ((-aValue) << 1) + 1
: (aValue << 1) + 0;
}
/**
* Converts to a two-complement value from a value where the sign bit is
* placed in the least significant bit. For example, as decimals:
* 2 (10 binary) becomes 1, 3 (11 binary) becomes -1
* 4 (100 binary) becomes 2, 5 (101 binary) becomes -2
*/
function fromVLQSigned(aValue) {
var isNegative = (aValue & 1) === 1;
var shifted = aValue >> 1;
return isNegative
? -shifted
: shifted;
}
/**
* Returns the base 64 VLQ encoded value.
*/
exports.encode = function base64VLQ_encode(aValue) {
var encoded = "";
var digit;
var vlq = toVLQSigned(aValue);
do {
digit = vlq & VLQ_BASE_MASK;
vlq >>>= VLQ_BASE_SHIFT;
if (vlq > 0) {
// There are still more digits in this value, so we must make sure the
// continuation bit is marked.
digit |= VLQ_CONTINUATION_BIT;
}
encoded += base64.encode(digit);
} while (vlq > 0);
return encoded;
};
/**
* Decodes the next base 64 VLQ value from the given string and returns the
* value and the rest of the string via the out parameter.
*/
exports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {
var strLen = aStr.length;
var result = 0;
var shift = 0;
var continuation, digit;
do {
if (aIndex >= strLen) {
throw new Error("Expected more digits in base 64 VLQ value.");
}
digit = base64.decode(aStr.charCodeAt(aIndex++));
if (digit === -1) {
throw new Error("Invalid base64 digit: " + aStr.charAt(aIndex - 1));
}
continuation = !!(digit & VLQ_CONTINUATION_BIT);
digit &= VLQ_BASE_MASK;
result = result + (digit << shift);
shift += VLQ_BASE_SHIFT;
} while (continuation);
aOutParam.value = fromVLQSigned(result);
aOutParam.rest = aIndex;
};
/***/ }),
/***/ "./node_modules/recast/node_modules/source-map/lib/base64.js":
/*!*******************************************************************!*\
!*** ./node_modules/recast/node_modules/source-map/lib/base64.js ***!
\*******************************************************************/
/***/ ((__unused_webpack_module, exports) => {
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var intToCharMap = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'.split('');
/**
* Encode an integer in the range of 0 to 63 to a single base 64 digit.
*/
exports.encode = function (number) {
if (0 <= number && number < intToCharMap.length) {
return intToCharMap[number];
}
throw new TypeError("Must be between 0 and 63: " + number);
};
/**
* Decode a single base 64 character code digit to an integer. Returns -1 on
* failure.
*/
exports.decode = function (charCode) {
var bigA = 65; // 'A'
var bigZ = 90; // 'Z'
var littleA = 97; // 'a'
var littleZ = 122; // 'z'
var zero = 48; // '0'
var nine = 57; // '9'
var plus = 43; // '+'
var slash = 47; // '/'
var littleOffset = 26;
var numberOffset = 52;
// 0 - 25: ABCDEFGHIJKLMNOPQRSTUVWXYZ
if (bigA <= charCode && charCode <= bigZ) {
return (charCode - bigA);
}
// 26 - 51: abcdefghijklmnopqrstuvwxyz
if (littleA <= charCode && charCode <= littleZ) {
return (charCode - littleA + littleOffset);
}
// 52 - 61: 0123456789
if (zero <= charCode && charCode <= nine) {
return (charCode - zero + numberOffset);
}
// 62: +
if (charCode == plus) {
return 62;
}
// 63: /
if (charCode == slash) {
return 63;
}
// Invalid base64 digit.
return -1;
};
/***/ }),
/***/ "./node_modules/recast/node_modules/source-map/lib/binary-search.js":
/*!**************************************************************************!*\
!*** ./node_modules/recast/node_modules/source-map/lib/binary-search.js ***!
\**************************************************************************/
/***/ ((__unused_webpack_module, exports) => {
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
exports.GREATEST_LOWER_BOUND = 1;
exports.LEAST_UPPER_BOUND = 2;
/**
* Recursive implementation of binary search.
*
* @param aLow Indices here and lower do not contain the needle.
* @param aHigh Indices here and higher do not contain the needle.
* @param aNeedle The element being searched for.
* @param aHaystack The non-empty array being searched.
* @param aCompare Function which takes two elements and returns -1, 0, or 1.
* @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
* 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
* closest element that is smaller than or greater than the one we are
* searching for, respectively, if the exact element cannot be found.
*/
function recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {
// This function terminates when one of the following is true:
//
// 1. We find the exact element we are looking for.
//
// 2. We did not find the exact element, but we can return the index of
// the next-closest element.
//
// 3. We did not find the exact element, and there is no next-closest
// element than the one we are searching for, so we return -1.
var mid = Math.floor((aHigh - aLow) / 2) + aLow;
var cmp = aCompare(aNeedle, aHaystack[mid], true);
if (cmp === 0) {
// Found the element we are looking for.
return mid;
}
else if (cmp > 0) {
// Our needle is greater than aHaystack[mid].
if (aHigh - mid > 1) {
// The element is in the upper half.
return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);
}
// The exact needle element was not found in this haystack. Determine if
// we are in termination case (3) or (2) and return the appropriate thing.
if (aBias == exports.LEAST_UPPER_BOUND) {
return aHigh < aHaystack.length ? aHigh : -1;
} else {
return mid;
}
}
else {
// Our needle is less than aHaystack[mid].
if (mid - aLow > 1) {
// The element is in the lower half.
return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);
}
// we are in termination case (3) or (2) and return the appropriate thing.
if (aBias == exports.LEAST_UPPER_BOUND) {
return mid;
} else {
return aLow < 0 ? -1 : aLow;
}
}
}
/**
* This is an implementation of binary search which will always try and return
* the index of the closest element if there is no exact hit. This is because
* mappings between original and generated line/col pairs are single points,
* and there is an implicit region between each of them, so a miss just means
* that you aren't on the very start of a region.
*
* @param aNeedle The element you are looking for.
* @param aHaystack The array that is being searched.
* @param aCompare A function which takes the needle and an element in the
* array and returns -1, 0, or 1 depending on whether the needle is less
* than, equal to, or greater than the element, respectively.
* @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or
* 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the
* closest element that is smaller than or greater than the one we are
* searching for, respectively, if the exact element cannot be found.
* Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.
*/
exports.search = function search(aNeedle, aHaystack, aCompare, aBias) {
if (aHaystack.length === 0) {
return -1;
}
var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,
aCompare, aBias || exports.GREATEST_LOWER_BOUND);
if (index < 0) {
return -1;
}
// We have found either the exact element, or the next-closest element than
// the one we are searching for. However, there may be more than one such
// element. Make sure we always return the smallest of these.
while (index - 1 >= 0) {
if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {
break;
}
--index;
}
return index;
};
/***/ }),
/***/ "./node_modules/recast/node_modules/source-map/lib/mapping-list.js":
/*!*************************************************************************!*\
!*** ./node_modules/recast/node_modules/source-map/lib/mapping-list.js ***!
\*************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2014 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var util = __webpack_require__(/*! ./util */ "./node_modules/recast/node_modules/source-map/lib/util.js");
/**
* Determine whether mappingB is after mappingA with respect to generated
* position.
*/
function generatedPositionAfter(mappingA, mappingB) {
// Optimized for most common case
var lineA = mappingA.generatedLine;
var lineB = mappingB.generatedLine;
var columnA = mappingA.generatedColumn;
var columnB = mappingB.generatedColumn;
return lineB > lineA || lineB == lineA && columnB >= columnA ||
util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;
}
/**
* A data structure to provide a sorted view of accumulated mappings in a
* performance conscious manner. It trades a neglibable overhead in general
* case for a large speedup in case of mappings being added in order.
*/
function MappingList() {
this._array = [];
this._sorted = true;
// Serves as infimum
this._last = {generatedLine: -1, generatedColumn: 0};
}
/**
* Iterate through internal items. This method takes the same arguments that
* `Array.prototype.forEach` takes.
*
* NOTE: The order of the mappings is NOT guaranteed.
*/
MappingList.prototype.unsortedForEach =
function MappingList_forEach(aCallback, aThisArg) {
this._array.forEach(aCallback, aThisArg);
};
/**
* Add the given source mapping.
*
* @param Object aMapping
*/
MappingList.prototype.add = function MappingList_add(aMapping) {
if (generatedPositionAfter(this._last, aMapping)) {
this._last = aMapping;
this._array.push(aMapping);
} else {
this._sorted = false;
this._array.push(aMapping);
}
};
/**
* Returns the flat, sorted array of mappings. The mappings are sorted by
* generated position.
*
* WARNING: This method returns internal data without copying, for
* performance. The return value must NOT be mutated, and should be treated as
* an immutable borrow. If you want to take ownership, you must make your own
* copy.
*/
MappingList.prototype.toArray = function MappingList_toArray() {
if (!this._sorted) {
this._array.sort(util.compareByGeneratedPositionsInflated);
this._sorted = true;
}
return this._array;
};
exports.MappingList = MappingList;
/***/ }),
/***/ "./node_modules/recast/node_modules/source-map/lib/quick-sort.js":
/*!***********************************************************************!*\
!*** ./node_modules/recast/node_modules/source-map/lib/quick-sort.js ***!
\***********************************************************************/
/***/ ((__unused_webpack_module, exports) => {
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
// It turns out that some (most?) JavaScript engines don't self-host
// `Array.prototype.sort`. This makes sense because C++ will likely remain
// faster than JS when doing raw CPU-intensive sorting. However, when using a
// custom comparator function, calling back and forth between the VM's C++ and
// JIT'd JS is rather slow *and* loses JIT type information, resulting in
// worse generated code for the comparator function than would be optimal. In
// fact, when sorting with a comparator, these costs outweigh the benefits of
// sorting in C++. By using our own JS-implemented Quick Sort (below), we get
// a ~3500ms mean speed-up in `bench/bench.html`.
/**
* Swap the elements indexed by `x` and `y` in the array `ary`.
*
* @param {Array} ary
* The array.
* @param {Number} x
* The index of the first item.
* @param {Number} y
* The index of the second item.
*/
function swap(ary, x, y) {
var temp = ary[x];
ary[x] = ary[y];
ary[y] = temp;
}
/**
* Returns a random integer within the range `low .. high` inclusive.
*
* @param {Number} low
* The lower bound on the range.
* @param {Number} high
* The upper bound on the range.
*/
function randomIntInRange(low, high) {
return Math.round(low + (Math.random() * (high - low)));
}
/**
* The Quick Sort algorithm.
*
* @param {Array} ary
* An array to sort.
* @param {function} comparator
* Function to use to compare two items.
* @param {Number} p
* Start index of the array
* @param {Number} r
* End index of the array
*/
function doQuickSort(ary, comparator, p, r) {
// If our lower bound is less than our upper bound, we (1) partition the
// array into two pieces and (2) recurse on each half. If it is not, this is
// the empty array and our base case.
if (p < r) {
// (1) Partitioning.
//
// The partitioning chooses a pivot between `p` and `r` and moves all
// elements that are less than or equal to the pivot to the before it, and
// all the elements that are greater than it after it. The effect is that
// once partition is done, the pivot is in the exact place it will be when
// the array is put in sorted order, and it will not need to be moved
// again. This runs in O(n) time.
// Always choose a random pivot so that an input array which is reverse
// sorted does not cause O(n^2) running time.
var pivotIndex = randomIntInRange(p, r);
var i = p - 1;
swap(ary, pivotIndex, r);
var pivot = ary[r];
// Immediately after `j` is incremented in this loop, the following hold
// true:
//
// * Every element in `ary[p .. i]` is less than or equal to the pivot.
//
// * Every element in `ary[i+1 .. j-1]` is greater than the pivot.
for (var j = p; j < r; j++) {
if (comparator(ary[j], pivot) <= 0) {
i += 1;
swap(ary, i, j);
}
}
swap(ary, i + 1, j);
var q = i + 1;
// (2) Recurse on each half.
doQuickSort(ary, comparator, p, q - 1);
doQuickSort(ary, comparator, q + 1, r);
}
}
/**
* Sort the given array in-place with the given comparator function.
*
* @param {Array} ary
* An array to sort.
* @param {function} comparator
* Function to use to compare two items.
*/
exports.quickSort = function (ary, comparator) {
doQuickSort(ary, comparator, 0, ary.length - 1);
};
/***/ }),
/***/ "./node_modules/recast/node_modules/source-map/lib/source-map-consumer.js":
/*!********************************************************************************!*\
!*** ./node_modules/recast/node_modules/source-map/lib/source-map-consumer.js ***!
\********************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var util = __webpack_require__(/*! ./util */ "./node_modules/recast/node_modules/source-map/lib/util.js");
var binarySearch = __webpack_require__(/*! ./binary-search */ "./node_modules/recast/node_modules/source-map/lib/binary-search.js");
var ArraySet = (__webpack_require__(/*! ./array-set */ "./node_modules/recast/node_modules/source-map/lib/array-set.js").ArraySet);
var base64VLQ = __webpack_require__(/*! ./base64-vlq */ "./node_modules/recast/node_modules/source-map/lib/base64-vlq.js");
var quickSort = (__webpack_require__(/*! ./quick-sort */ "./node_modules/recast/node_modules/source-map/lib/quick-sort.js").quickSort);
function SourceMapConsumer(aSourceMap, aSourceMapURL) {
var sourceMap = aSourceMap;
if (typeof aSourceMap === 'string') {
sourceMap = util.parseSourceMapInput(aSourceMap);
}
return sourceMap.sections != null
? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL)
: new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
}
SourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) {
return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
}
/**
* The version of the source mapping spec that we are consuming.
*/
SourceMapConsumer.prototype._version = 3;
// `__generatedMappings` and `__originalMappings` are arrays that hold the
// parsed mapping coordinates from the source map's "mappings" attribute. They
// are lazily instantiated, accessed via the `_generatedMappings` and
// `_originalMappings` getters respectively, and we only parse the mappings
// and create these arrays once queried for a source location. We jump through
// these hoops because there can be many thousands of mappings, and parsing
// them is expensive, so we only want to do it if we must.
//
// Each object in the arrays is of the form:
//
// {
// generatedLine: The line number in the generated code,
// generatedColumn: The column number in the generated code,
// source: The path to the original source file that generated this
// chunk of code,
// originalLine: The line number in the original source that
// corresponds to this chunk of generated code,
// originalColumn: The column number in the original source that
// corresponds to this chunk of generated code,
// name: The name of the original symbol which generated this chunk of
// code.
// }
//
// All properties except for `generatedLine` and `generatedColumn` can be
// `null`.
//
// `_generatedMappings` is ordered by the generated positions.
//
// `_originalMappings` is ordered by the original positions.
SourceMapConsumer.prototype.__generatedMappings = null;
Object.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {
configurable: true,
enumerable: true,
get: function () {
if (!this.__generatedMappings) {
this._parseMappings(this._mappings, this.sourceRoot);
}
return this.__generatedMappings;
}
});
SourceMapConsumer.prototype.__originalMappings = null;
Object.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {
configurable: true,
enumerable: true,
get: function () {
if (!this.__originalMappings) {
this._parseMappings(this._mappings, this.sourceRoot);
}
return this.__originalMappings;
}
});
SourceMapConsumer.prototype._charIsMappingSeparator =
function SourceMapConsumer_charIsMappingSeparator(aStr, index) {
var c = aStr.charAt(index);
return c === ";" || c === ",";
};
/**
* Parse the mappings in a string in to a data structure which we can easily
* query (the ordered arrays in the `this.__generatedMappings` and
* `this.__originalMappings` properties).
*/
SourceMapConsumer.prototype._parseMappings =
function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
throw new Error("Subclasses must implement _parseMappings");
};
SourceMapConsumer.GENERATED_ORDER = 1;
SourceMapConsumer.ORIGINAL_ORDER = 2;
SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
SourceMapConsumer.LEAST_UPPER_BOUND = 2;
/**
* Iterate over each mapping between an original source/line/column and a
* generated line/column in this source map.
*
* @param Function aCallback
* The function that is called with each mapping.
* @param Object aContext
* Optional. If specified, this object will be the value of `this` every
* time that `aCallback` is called.
* @param aOrder
* Either `SourceMapConsumer.GENERATED_ORDER` or
* `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
* iterate over the mappings sorted by the generated file's line/column
* order or the original's source/line/column order, respectively. Defaults to
* `SourceMapConsumer.GENERATED_ORDER`.
*/
SourceMapConsumer.prototype.eachMapping =
function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {
var context = aContext || null;
var order = aOrder || SourceMapConsumer.GENERATED_ORDER;
var mappings;
switch (order) {
case SourceMapConsumer.GENERATED_ORDER:
mappings = this._generatedMappings;
break;
case SourceMapConsumer.ORIGINAL_ORDER:
mappings = this._originalMappings;
break;
default:
throw new Error("Unknown order of iteration.");
}
var sourceRoot = this.sourceRoot;
mappings.map(function (mapping) {
var source = mapping.source === null ? null : this._sources.at(mapping.source);
source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL);
return {
source: source,
generatedLine: mapping.generatedLine,
generatedColumn: mapping.generatedColumn,
originalLine: mapping.originalLine,
originalColumn: mapping.originalColumn,
name: mapping.name === null ? null : this._names.at(mapping.name)
};
}, this).forEach(aCallback, context);
};
/**
* Returns all generated line and column information for the original source,
* line, and column provided. If no column is provided, returns all mappings
* corresponding to a either the line we are searching for or the next
* closest line that has any mappings. Otherwise, returns all mappings
* corresponding to the given line and either the column we are searching for
* or the next closest column that has any offsets.
*
* The only argument is an object with the following properties:
*
* - source: The filename of the original source.
* - line: The line number in the original source. The line number is 1-based.
* - column: Optional. the column number in the original source.
* The column number is 0-based.
*
* and an array of objects is returned, each with the following properties:
*
* - line: The line number in the generated source, or null. The
* line number is 1-based.
* - column: The column number in the generated source, or null.
* The column number is 0-based.
*/
SourceMapConsumer.prototype.allGeneratedPositionsFor =
function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {
var line = util.getArg(aArgs, 'line');
// When there is no exact match, BasicSourceMapConsumer.prototype._findMapping
// returns the index of the closest mapping less than the needle. By
// setting needle.originalColumn to 0, we thus find the last mapping for
// the given line, provided such a mapping exists.
var needle = {
source: util.getArg(aArgs, 'source'),
originalLine: line,
originalColumn: util.getArg(aArgs, 'column', 0)
};
needle.source = this._findSourceIndex(needle.source);
if (needle.source < 0) {
return [];
}
var mappings = [];
var index = this._findMapping(needle,
this._originalMappings,
"originalLine",
"originalColumn",
util.compareByOriginalPositions,
binarySearch.LEAST_UPPER_BOUND);
if (index >= 0) {
var mapping = this._originalMappings[index];
if (aArgs.column === undefined) {
var originalLine = mapping.originalLine;
// Iterate until either we run out of mappings, or we run into
// a mapping for a different line than the one we found. Since
// mappings are sorted, this is guaranteed to find all mappings for
// the line we found.
while (mapping && mapping.originalLine === originalLine) {
mappings.push({
line: util.getArg(mapping, 'generatedLine', null),
column: util.getArg(mapping, 'generatedColumn', null),
lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
});
mapping = this._originalMappings[++index];
}
} else {
var originalColumn = mapping.originalColumn;
// Iterate until either we run out of mappings, or we run into
// a mapping for a different line than the one we were searching for.
// Since mappings are sorted, this is guaranteed to find all mappings for
// the line we are searching for.
while (mapping &&
mapping.originalLine === line &&
mapping.originalColumn == originalColumn) {
mappings.push({
line: util.getArg(mapping, 'generatedLine', null),
column: util.getArg(mapping, 'generatedColumn', null),
lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
});
mapping = this._originalMappings[++index];
}
}
}
return mappings;
};
exports.SourceMapConsumer = SourceMapConsumer;
/**
* A BasicSourceMapConsumer instance represents a parsed source map which we can
* query for information about the original file positions by giving it a file
* position in the generated source.
*
* The first parameter is the raw source map (either as a JSON string, or
* already parsed to an object). According to the spec, source maps have the
* following attributes:
*
* - version: Which version of the source map spec this map is following.
* - sources: An array of URLs to the original source files.
* - names: An array of identifiers which can be referrenced by individual mappings.
* - sourceRoot: Optional. The URL root from which all sources are relative.
* - sourcesContent: Optional. An array of contents of the original source files.
* - mappings: A string of base64 VLQs which contain the actual mappings.
* - file: Optional. The generated file this source map is associated with.
*
* Here is an example source map, taken from the source map spec[0]:
*
* {
* version : 3,
* file: "out.js",
* sourceRoot : "",
* sources: ["foo.js", "bar.js"],
* names: ["src", "maps", "are", "fun"],
* mappings: "AA,AB;;ABCDE;"
* }
*
* The second parameter, if given, is a string whose value is the URL
* at which the source map was found. This URL is used to compute the
* sources array.
*
* [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
*/
function BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {
var sourceMap = aSourceMap;
if (typeof aSourceMap === 'string') {
sourceMap = util.parseSourceMapInput(aSourceMap);
}
var version = util.getArg(sourceMap, 'version');
var sources = util.getArg(sourceMap, 'sources');
// Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
// requires the array) to play nice here.
var names = util.getArg(sourceMap, 'names', []);
var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);
var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);
var mappings = util.getArg(sourceMap, 'mappings');
var file = util.getArg(sourceMap, 'file', null);
// Once again, Sass deviates from the spec and supplies the version as a
// string rather than a number, so we use loose equality checking here.
if (version != this._version) {
throw new Error('Unsupported version: ' + version);
}
if (sourceRoot) {
sourceRoot = util.normalize(sourceRoot);
}
sources = sources
.map(String)
// Some source maps produce relative source paths like "./foo.js" instead of
// "foo.js". Normalize these first so that future comparisons will succeed.
// See bugzil.la/1090768.
.map(util.normalize)
// Always ensure that absolute sources are internally stored relative to
// the source root, if the source root is absolute. Not doing this would
// be particularly problematic when the source root is a prefix of the
// source (valid, but why??). See github issue #199 and bugzil.la/1188982.
.map(function (source) {
return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)
? util.relative(sourceRoot, source)
: source;
});
// Pass `true` below to allow duplicate names and sources. While source maps
// are intended to be compressed and deduplicated, the TypeScript compiler
// sometimes generates source maps with duplicates in them. See Github issue
// #72 and bugzil.la/889492.
this._names = ArraySet.fromArray(names.map(String), true);
this._sources = ArraySet.fromArray(sources, true);
this._absoluteSources = this._sources.toArray().map(function (s) {
return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
});
this.sourceRoot = sourceRoot;
this.sourcesContent = sourcesContent;
this._mappings = mappings;
this._sourceMapURL = aSourceMapURL;
this.file = file;
}
BasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
/**
* Utility function to find the index of a source. Returns -1 if not
* found.
*/
BasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {
var relativeSource = aSource;
if (this.sourceRoot != null) {
relativeSource = util.relative(this.sourceRoot, relativeSource);
}
if (this._sources.has(relativeSource)) {
return this._sources.indexOf(relativeSource);
}
// Maybe aSource is an absolute URL as returned by |sources|. In
// this case we can't simply undo the transform.
var i;
for (i = 0; i < this._absoluteSources.length; ++i) {
if (this._absoluteSources[i] == aSource) {
return i;
}
}
return -1;
};
/**
* Create a BasicSourceMapConsumer from a SourceMapGenerator.
*
* @param SourceMapGenerator aSourceMap
* The source map that will be consumed.
* @param String aSourceMapURL
* The URL at which the source map can be found (optional)
* @returns BasicSourceMapConsumer
*/
BasicSourceMapConsumer.fromSourceMap =
function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {
var smc = Object.create(BasicSourceMapConsumer.prototype);
var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);
var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);
smc.sourceRoot = aSourceMap._sourceRoot;
smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),
smc.sourceRoot);
smc.file = aSourceMap._file;
smc._sourceMapURL = aSourceMapURL;
smc._absoluteSources = smc._sources.toArray().map(function (s) {
return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);
});
// Because we are modifying the entries (by converting string sources and
// names to indices into the sources and names ArraySets), we have to make
// a copy of the entry or else bad things happen. Shared mutable state
// strikes again! See github issue #191.
var generatedMappings = aSourceMap._mappings.toArray().slice();
var destGeneratedMappings = smc.__generatedMappings = [];
var destOriginalMappings = smc.__originalMappings = [];
for (var i = 0, length = generatedMappings.length; i < length; i++) {
var srcMapping = generatedMappings[i];
var destMapping = new Mapping;
destMapping.generatedLine = srcMapping.generatedLine;
destMapping.generatedColumn = srcMapping.generatedColumn;
if (srcMapping.source) {
destMapping.source = sources.indexOf(srcMapping.source);
destMapping.originalLine = srcMapping.originalLine;
destMapping.originalColumn = srcMapping.originalColumn;
if (srcMapping.name) {
destMapping.name = names.indexOf(srcMapping.name);
}
destOriginalMappings.push(destMapping);
}
destGeneratedMappings.push(destMapping);
}
quickSort(smc.__originalMappings, util.compareByOriginalPositions);
return smc;
};
/**
* The version of the source mapping spec that we are consuming.
*/
BasicSourceMapConsumer.prototype._version = 3;
/**
* The list of original sources.
*/
Object.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {
get: function () {
return this._absoluteSources.slice();
}
});
/**
* Provide the JIT with a nice shape / hidden class.
*/
function Mapping() {
this.generatedLine = 0;
this.generatedColumn = 0;
this.source = null;
this.originalLine = null;
this.originalColumn = null;
this.name = null;
}
/**
* Parse the mappings in a string in to a data structure which we can easily
* query (the ordered arrays in the `this.__generatedMappings` and
* `this.__originalMappings` properties).
*/
BasicSourceMapConsumer.prototype._parseMappings =
function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {
var generatedLine = 1;
var previousGeneratedColumn = 0;
var previousOriginalLine = 0;
var previousOriginalColumn = 0;
var previousSource = 0;
var previousName = 0;
var length = aStr.length;
var index = 0;
var cachedSegments = {};
var temp = {};
var originalMappings = [];
var generatedMappings = [];
var mapping, str, segment, end, value;
while (index < length) {
if (aStr.charAt(index) === ';') {
generatedLine++;
index++;
previousGeneratedColumn = 0;
}
else if (aStr.charAt(index) === ',') {
index++;
}
else {
mapping = new Mapping();
mapping.generatedLine = generatedLine;
// Because each offset is encoded relative to the previous one,
// many segments often have the same encoding. We can exploit this
// fact by caching the parsed variable length fields of each segment,
// allowing us to avoid a second parse if we encounter the same
// segment again.
for (end = index; end < length; end++) {
if (this._charIsMappingSeparator(aStr, end)) {
break;
}
}
str = aStr.slice(index, end);
segment = cachedSegments[str];
if (segment) {
index += str.length;
} else {
segment = [];
while (index < end) {
base64VLQ.decode(aStr, index, temp);
value = temp.value;
index = temp.rest;
segment.push(value);
}
if (segment.length === 2) {
throw new Error('Found a source, but no line and column');
}
if (segment.length === 3) {
throw new Error('Found a source and line, but no column');
}
cachedSegments[str] = segment;
}
// Generated column.
mapping.generatedColumn = previousGeneratedColumn + segment[0];
previousGeneratedColumn = mapping.generatedColumn;
if (segment.length > 1) {
// Original source.
mapping.source = previousSource + segment[1];
previousSource += segment[1];
// Original line.
mapping.originalLine = previousOriginalLine + segment[2];
previousOriginalLine = mapping.originalLine;
// Lines are stored 0-based
mapping.originalLine += 1;
// Original column.
mapping.originalColumn = previousOriginalColumn + segment[3];
previousOriginalColumn = mapping.originalColumn;
if (segment.length > 4) {
// Original name.
mapping.name = previousName + segment[4];
previousName += segment[4];
}
}
generatedMappings.push(mapping);
if (typeof mapping.originalLine === 'number') {
originalMappings.push(mapping);
}
}
}
quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);
this.__generatedMappings = generatedMappings;
quickSort(originalMappings, util.compareByOriginalPositions);
this.__originalMappings = originalMappings;
};
/**
* Find the mapping that best matches the hypothetical "needle" mapping that
* we are searching for in the given "haystack" of mappings.
*/
BasicSourceMapConsumer.prototype._findMapping =
function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,
aColumnName, aComparator, aBias) {
// To return the position we are searching for, we must first find the
// mapping for the given position and then return the opposite position it
// points to. Because the mappings are sorted, we can use binary search to
// find the best mapping.
if (aNeedle[aLineName] <= 0) {
throw new TypeError('Line must be greater than or equal to 1, got '
+ aNeedle[aLineName]);
}
if (aNeedle[aColumnName] < 0) {
throw new TypeError('Column must be greater than or equal to 0, got '
+ aNeedle[aColumnName]);
}
return binarySearch.search(aNeedle, aMappings, aComparator, aBias);
};
/**
* Compute the last column for each generated mapping. The last column is
* inclusive.
*/
BasicSourceMapConsumer.prototype.computeColumnSpans =
function SourceMapConsumer_computeColumnSpans() {
for (var index = 0; index < this._generatedMappings.length; ++index) {
var mapping = this._generatedMappings[index];
// Mappings do not contain a field for the last generated columnt. We
// can come up with an optimistic estimate, however, by assuming that
// mappings are contiguous (i.e. given two consecutive mappings, the
// first mapping ends where the second one starts).
if (index + 1 < this._generatedMappings.length) {
var nextMapping = this._generatedMappings[index + 1];
if (mapping.generatedLine === nextMapping.generatedLine) {
mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;
continue;
}
}
// The last mapping for each line spans the entire line.
mapping.lastGeneratedColumn = Infinity;
}
};
/**
* Returns the original source, line, and column information for the generated
* source's line and column positions provided. The only argument is an object
* with the following properties:
*
* - line: The line number in the generated source. The line number
* is 1-based.
* - column: The column number in the generated source. The column
* number is 0-based.
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
* closest element that is smaller than or greater than the one we are
* searching for, respectively, if the exact element cannot be found.
* Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
*
* and an object is returned with the following properties:
*
* - source: The original source file, or null.
* - line: The line number in the original source, or null. The
* line number is 1-based.
* - column: The column number in the original source, or null. The
* column number is 0-based.
* - name: The original identifier, or null.
*/
BasicSourceMapConsumer.prototype.originalPositionFor =
function SourceMapConsumer_originalPositionFor(aArgs) {
var needle = {
generatedLine: util.getArg(aArgs, 'line'),
generatedColumn: util.getArg(aArgs, 'column')
};
var index = this._findMapping(
needle,
this._generatedMappings,
"generatedLine",
"generatedColumn",
util.compareByGeneratedPositionsDeflated,
util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
);
if (index >= 0) {
var mapping = this._generatedMappings[index];
if (mapping.generatedLine === needle.generatedLine) {
var source = util.getArg(mapping, 'source', null);
if (source !== null) {
source = this._sources.at(source);
source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);
}
var name = util.getArg(mapping, 'name', null);
if (name !== null) {
name = this._names.at(name);
}
return {
source: source,
line: util.getArg(mapping, 'originalLine', null),
column: util.getArg(mapping, 'originalColumn', null),
name: name
};
}
}
return {
source: null,
line: null,
column: null,
name: null
};
};
/**
* Return true if we have the source content for every source in the source
* map, false otherwise.
*/
BasicSourceMapConsumer.prototype.hasContentsOfAllSources =
function BasicSourceMapConsumer_hasContentsOfAllSources() {
if (!this.sourcesContent) {
return false;
}
return this.sourcesContent.length >= this._sources.size() &&
!this.sourcesContent.some(function (sc) { return sc == null; });
};
/**
* Returns the original source content. The only argument is the url of the
* original source file. Returns null if no original source content is
* available.
*/
BasicSourceMapConsumer.prototype.sourceContentFor =
function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
if (!this.sourcesContent) {
return null;
}
var index = this._findSourceIndex(aSource);
if (index >= 0) {
return this.sourcesContent[index];
}
var relativeSource = aSource;
if (this.sourceRoot != null) {
relativeSource = util.relative(this.sourceRoot, relativeSource);
}
var url;
if (this.sourceRoot != null
&& (url = util.urlParse(this.sourceRoot))) {
// XXX: file:// URIs and absolute paths lead to unexpected behavior for
// many users. We can help them out when they expect file:// URIs to
// behave like it would if they were running a local HTTP server. See
// https://bugzilla.mozilla.org/show_bug.cgi?id=885597.
var fileUriAbsPath = relativeSource.replace(/^file:\/\//, "");
if (url.scheme == "file"
&& this._sources.has(fileUriAbsPath)) {
return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]
}
if ((!url.path || url.path == "/")
&& this._sources.has("/" + relativeSource)) {
return this.sourcesContent[this._sources.indexOf("/" + relativeSource)];
}
}
// This function is used recursively from
// IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we
// don't want to throw if we can't find the source - we just want to
// return null, so we provide a flag to exit gracefully.
if (nullOnMissing) {
return null;
}
else {
throw new Error('"' + relativeSource + '" is not in the SourceMap.');
}
};
/**
* Returns the generated line and column information for the original source,
* line, and column positions provided. The only argument is an object with
* the following properties:
*
* - source: The filename of the original source.
* - line: The line number in the original source. The line number
* is 1-based.
* - column: The column number in the original source. The column
* number is 0-based.
* - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
* 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
* closest element that is smaller than or greater than the one we are
* searching for, respectively, if the exact element cannot be found.
* Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
*
* and an object is returned with the following properties:
*
* - line: The line number in the generated source, or null. The
* line number is 1-based.
* - column: The column number in the generated source, or null.
* The column number is 0-based.
*/
BasicSourceMapConsumer.prototype.generatedPositionFor =
function SourceMapConsumer_generatedPositionFor(aArgs) {
var source = util.getArg(aArgs, 'source');
source = this._findSourceIndex(source);
if (source < 0) {
return {
line: null,
column: null,
lastColumn: null
};
}
var needle = {
source: source,
originalLine: util.getArg(aArgs, 'line'),
originalColumn: util.getArg(aArgs, 'column')
};
var index = this._findMapping(
needle,
this._originalMappings,
"originalLine",
"originalColumn",
util.compareByOriginalPositions,
util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)
);
if (index >= 0) {
var mapping = this._originalMappings[index];
if (mapping.source === needle.source) {
return {
line: util.getArg(mapping, 'generatedLine', null),
column: util.getArg(mapping, 'generatedColumn', null),
lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)
};
}
}
return {
line: null,
column: null,
lastColumn: null
};
};
exports.BasicSourceMapConsumer = BasicSourceMapConsumer;
/**
* An IndexedSourceMapConsumer instance represents a parsed source map which
* we can query for information. It differs from BasicSourceMapConsumer in
* that it takes "indexed" source maps (i.e. ones with a "sections" field) as
* input.
*
* The first parameter is a raw source map (either as a JSON string, or already
* parsed to an object). According to the spec for indexed source maps, they
* have the following attributes:
*
* - version: Which version of the source map spec this map is following.
* - file: Optional. The generated file this source map is associated with.
* - sections: A list of section definitions.
*
* Each value under the "sections" field has two fields:
* - offset: The offset into the original specified at which this section
* begins to apply, defined as an object with a "line" and "column"
* field.
* - map: A source map definition. This source map could also be indexed,
* but doesn't have to be.
*
* Instead of the "map" field, it's also possible to have a "url" field
* specifying a URL to retrieve a source map from, but that's currently
* unsupported.
*
* Here's an example source map, taken from the source map spec[0], but
* modified to omit a section which uses the "url" field.
*
* {
* version : 3,
* file: "app.js",
* sections: [{
* offset: {line:100, column:10},
* map: {
* version : 3,
* file: "section.js",
* sources: ["foo.js", "bar.js"],
* names: ["src", "maps", "are", "fun"],
* mappings: "AAAA,E;;ABCDE;"
* }
* }],
* }
*
* The second parameter, if given, is a string whose value is the URL
* at which the source map was found. This URL is used to compute the
* sources array.
*
* [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt
*/
function IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {
var sourceMap = aSourceMap;
if (typeof aSourceMap === 'string') {
sourceMap = util.parseSourceMapInput(aSourceMap);
}
var version = util.getArg(sourceMap, 'version');
var sections = util.getArg(sourceMap, 'sections');
if (version != this._version) {
throw new Error('Unsupported version: ' + version);
}
this._sources = new ArraySet();
this._names = new ArraySet();
var lastOffset = {
line: -1,
column: 0
};
this._sections = sections.map(function (s) {
if (s.url) {
// The url field will require support for asynchronicity.
// See https://github.com/mozilla/source-map/issues/16
throw new Error('Support for url field in sections not implemented.');
}
var offset = util.getArg(s, 'offset');
var offsetLine = util.getArg(offset, 'line');
var offsetColumn = util.getArg(offset, 'column');
if (offsetLine < lastOffset.line ||
(offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {
throw new Error('Section offsets must be ordered and non-overlapping.');
}
lastOffset = offset;
return {
generatedOffset: {
// The offset fields are 0-based, but we use 1-based indices when
// encoding/decoding from VLQ.
generatedLine: offsetLine + 1,
generatedColumn: offsetColumn + 1
},
consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL)
}
});
}
IndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);
IndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;
/**
* The version of the source mapping spec that we are consuming.
*/
IndexedSourceMapConsumer.prototype._version = 3;
/**
* The list of original sources.
*/
Object.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {
get: function () {
var sources = [];
for (var i = 0; i < this._sections.length; i++) {
for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {
sources.push(this._sections[i].consumer.sources[j]);
}
}
return sources;
}
});
/**
* Returns the original source, line, and column information for the generated
* source's line and column positions provided. The only argument is an object
* with the following properties:
*
* - line: The line number in the generated source. The line number
* is 1-based.
* - column: The column number in the generated source. The column
* number is 0-based.
*
* and an object is returned with the following properties:
*
* - source: The original source file, or null.
* - line: The line number in the original source, or null. The
* line number is 1-based.
* - column: The column number in the original source, or null. The
* column number is 0-based.
* - name: The original identifier, or null.
*/
IndexedSourceMapConsumer.prototype.originalPositionFor =
function IndexedSourceMapConsumer_originalPositionFor(aArgs) {
var needle = {
generatedLine: util.getArg(aArgs, 'line'),
generatedColumn: util.getArg(aArgs, 'column')
};
// Find the section containing the generated position we're trying to map
// to an original position.
var sectionIndex = binarySearch.search(needle, this._sections,
function(needle, section) {
var cmp = needle.generatedLine - section.generatedOffset.generatedLine;
if (cmp) {
return cmp;
}
return (needle.generatedColumn -
section.generatedOffset.generatedColumn);
});
var section = this._sections[sectionIndex];
if (!section) {
return {
source: null,
line: null,
column: null,
name: null
};
}
return section.consumer.originalPositionFor({
line: needle.generatedLine -
(section.generatedOffset.generatedLine - 1),
column: needle.generatedColumn -
(section.generatedOffset.generatedLine === needle.generatedLine
? section.generatedOffset.generatedColumn - 1
: 0),
bias: aArgs.bias
});
};
/**
* Return true if we have the source content for every source in the source
* map, false otherwise.
*/
IndexedSourceMapConsumer.prototype.hasContentsOfAllSources =
function IndexedSourceMapConsumer_hasContentsOfAllSources() {
return this._sections.every(function (s) {
return s.consumer.hasContentsOfAllSources();
});
};
/**
* Returns the original source content. The only argument is the url of the
* original source file. Returns null if no original source content is
* available.
*/
IndexedSourceMapConsumer.prototype.sourceContentFor =
function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {
for (var i = 0; i < this._sections.length; i++) {
var section = this._sections[i];
var content = section.consumer.sourceContentFor(aSource, true);
if (content) {
return content;
}
}
if (nullOnMissing) {
return null;
}
else {
throw new Error('"' + aSource + '" is not in the SourceMap.');
}
};
/**
* Returns the generated line and column information for the original source,
* line, and column positions provided. The only argument is an object with
* the following properties:
*
* - source: The filename of the original source.
* - line: The line number in the original source. The line number
* is 1-based.
* - column: The column number in the original source. The column
* number is 0-based.
*
* and an object is returned with the following properties:
*
* - line: The line number in the generated source, or null. The
* line number is 1-based.
* - column: The column number in the generated source, or null.
* The column number is 0-based.
*/
IndexedSourceMapConsumer.prototype.generatedPositionFor =
function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {
for (var i = 0; i < this._sections.length; i++) {
var section = this._sections[i];
// Only consider this section if the requested source is in the list of
// sources of the consumer.
if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) {
continue;
}
var generatedPosition = section.consumer.generatedPositionFor(aArgs);
if (generatedPosition) {
var ret = {
line: generatedPosition.line +
(section.generatedOffset.generatedLine - 1),
column: generatedPosition.column +
(section.generatedOffset.generatedLine === generatedPosition.line
? section.generatedOffset.generatedColumn - 1
: 0)
};
return ret;
}
}
return {
line: null,
column: null
};
};
/**
* Parse the mappings in a string in to a data structure which we can easily
* query (the ordered arrays in the `this.__generatedMappings` and
* `this.__originalMappings` properties).
*/
IndexedSourceMapConsumer.prototype._parseMappings =
function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {
this.__generatedMappings = [];
this.__originalMappings = [];
for (var i = 0; i < this._sections.length; i++) {
var section = this._sections[i];
var sectionMappings = section.consumer._generatedMappings;
for (var j = 0; j < sectionMappings.length; j++) {
var mapping = sectionMappings[j];
var source = section.consumer._sources.at(mapping.source);
source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);
this._sources.add(source);
source = this._sources.indexOf(source);
var name = null;
if (mapping.name) {
name = section.consumer._names.at(mapping.name);
this._names.add(name);
name = this._names.indexOf(name);
}
// The mappings coming from the consumer for the section have
// generated positions relative to the start of the section, so we
// need to offset them to be relative to the start of the concatenated
// generated file.
var adjustedMapping = {
source: source,
generatedLine: mapping.generatedLine +
(section.generatedOffset.generatedLine - 1),
generatedColumn: mapping.generatedColumn +
(section.generatedOffset.generatedLine === mapping.generatedLine
? section.generatedOffset.generatedColumn - 1
: 0),
originalLine: mapping.originalLine,
originalColumn: mapping.originalColumn,
name: name
};
this.__generatedMappings.push(adjustedMapping);
if (typeof adjustedMapping.originalLine === 'number') {
this.__originalMappings.push(adjustedMapping);
}
}
}
quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);
quickSort(this.__originalMappings, util.compareByOriginalPositions);
};
exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
/***/ }),
/***/ "./node_modules/recast/node_modules/source-map/lib/source-map-generator.js":
/*!*********************************************************************************!*\
!*** ./node_modules/recast/node_modules/source-map/lib/source-map-generator.js ***!
\*********************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var base64VLQ = __webpack_require__(/*! ./base64-vlq */ "./node_modules/recast/node_modules/source-map/lib/base64-vlq.js");
var util = __webpack_require__(/*! ./util */ "./node_modules/recast/node_modules/source-map/lib/util.js");
var ArraySet = (__webpack_require__(/*! ./array-set */ "./node_modules/recast/node_modules/source-map/lib/array-set.js").ArraySet);
var MappingList = (__webpack_require__(/*! ./mapping-list */ "./node_modules/recast/node_modules/source-map/lib/mapping-list.js").MappingList);
/**
* An instance of the SourceMapGenerator represents a source map which is
* being built incrementally. You may pass an object with the following
* properties:
*
* - file: The filename of the generated source.
* - sourceRoot: A root for all relative URLs in this source map.
*/
function SourceMapGenerator(aArgs) {
if (!aArgs) {
aArgs = {};
}
this._file = util.getArg(aArgs, 'file', null);
this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);
this._skipValidation = util.getArg(aArgs, 'skipValidation', false);
this._sources = new ArraySet();
this._names = new ArraySet();
this._mappings = new MappingList();
this._sourcesContents = null;
}
SourceMapGenerator.prototype._version = 3;
/**
* Creates a new SourceMapGenerator based on a SourceMapConsumer
*
* @param aSourceMapConsumer The SourceMap.
*/
SourceMapGenerator.fromSourceMap =
function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {
var sourceRoot = aSourceMapConsumer.sourceRoot;
var generator = new SourceMapGenerator({
file: aSourceMapConsumer.file,
sourceRoot: sourceRoot
});
aSourceMapConsumer.eachMapping(function (mapping) {
var newMapping = {
generated: {
line: mapping.generatedLine,
column: mapping.generatedColumn
}
};
if (mapping.source != null) {
newMapping.source = mapping.source;
if (sourceRoot != null) {
newMapping.source = util.relative(sourceRoot, newMapping.source);
}
newMapping.original = {
line: mapping.originalLine,
column: mapping.originalColumn
};
if (mapping.name != null) {
newMapping.name = mapping.name;
}
}
generator.addMapping(newMapping);
});
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var sourceRelative = sourceFile;
if (sourceRoot !== null) {
sourceRelative = util.relative(sourceRoot, sourceFile);
}
if (!generator._sources.has(sourceRelative)) {
generator._sources.add(sourceRelative);
}
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content != null) {
generator.setSourceContent(sourceFile, content);
}
});
return generator;
};
/**
* Add a single mapping from original source line and column to the generated
* source's line and column for this source map being created. The mapping
* object should have the following properties:
*
* - generated: An object with the generated line and column positions.
* - original: An object with the original line and column positions.
* - source: The original source file (relative to the sourceRoot).
* - name: An optional original token name for this mapping.
*/
SourceMapGenerator.prototype.addMapping =
function SourceMapGenerator_addMapping(aArgs) {
var generated = util.getArg(aArgs, 'generated');
var original = util.getArg(aArgs, 'original', null);
var source = util.getArg(aArgs, 'source', null);
var name = util.getArg(aArgs, 'name', null);
if (!this._skipValidation) {
this._validateMapping(generated, original, source, name);
}
if (source != null) {
source = String(source);
if (!this._sources.has(source)) {
this._sources.add(source);
}
}
if (name != null) {
name = String(name);
if (!this._names.has(name)) {
this._names.add(name);
}
}
this._mappings.add({
generatedLine: generated.line,
generatedColumn: generated.column,
originalLine: original != null && original.line,
originalColumn: original != null && original.column,
source: source,
name: name
});
};
/**
* Set the source content for a source file.
*/
SourceMapGenerator.prototype.setSourceContent =
function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {
var source = aSourceFile;
if (this._sourceRoot != null) {
source = util.relative(this._sourceRoot, source);
}
if (aSourceContent != null) {
// Add the source content to the _sourcesContents map.
// Create a new _sourcesContents map if the property is null.
if (!this._sourcesContents) {
this._sourcesContents = Object.create(null);
}
this._sourcesContents[util.toSetString(source)] = aSourceContent;
} else if (this._sourcesContents) {
// Remove the source file from the _sourcesContents map.
// If the _sourcesContents map is empty, set the property to null.
delete this._sourcesContents[util.toSetString(source)];
if (Object.keys(this._sourcesContents).length === 0) {
this._sourcesContents = null;
}
}
};
/**
* Applies the mappings of a sub-source-map for a specific source file to the
* source map being generated. Each mapping to the supplied source file is
* rewritten using the supplied source map. Note: The resolution for the
* resulting mappings is the minimium of this map and the supplied map.
*
* @param aSourceMapConsumer The source map to be applied.
* @param aSourceFile Optional. The filename of the source file.
* If omitted, SourceMapConsumer's file property will be used.
* @param aSourceMapPath Optional. The dirname of the path to the source map
* to be applied. If relative, it is relative to the SourceMapConsumer.
* This parameter is needed when the two source maps aren't in the same
* directory, and the source map to be applied contains relative source
* paths. If so, those relative source paths need to be rewritten
* relative to the SourceMapGenerator.
*/
SourceMapGenerator.prototype.applySourceMap =
function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {
var sourceFile = aSourceFile;
// If aSourceFile is omitted, we will use the file property of the SourceMap
if (aSourceFile == null) {
if (aSourceMapConsumer.file == null) {
throw new Error(
'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +
'or the source map\'s "file" property. Both were omitted.'
);
}
sourceFile = aSourceMapConsumer.file;
}
var sourceRoot = this._sourceRoot;
// Make "sourceFile" relative if an absolute Url is passed.
if (sourceRoot != null) {
sourceFile = util.relative(sourceRoot, sourceFile);
}
// Applying the SourceMap can add and remove items from the sources and
// the names array.
var newSources = new ArraySet();
var newNames = new ArraySet();
// Find mappings for the "sourceFile"
this._mappings.unsortedForEach(function (mapping) {
if (mapping.source === sourceFile && mapping.originalLine != null) {
// Check if it can be mapped by the source map, then update the mapping.
var original = aSourceMapConsumer.originalPositionFor({
line: mapping.originalLine,
column: mapping.originalColumn
});
if (original.source != null) {
// Copy mapping
mapping.source = original.source;
if (aSourceMapPath != null) {
mapping.source = util.join(aSourceMapPath, mapping.source)
}
if (sourceRoot != null) {
mapping.source = util.relative(sourceRoot, mapping.source);
}
mapping.originalLine = original.line;
mapping.originalColumn = original.column;
if (original.name != null) {
mapping.name = original.name;
}
}
}
var source = mapping.source;
if (source != null && !newSources.has(source)) {
newSources.add(source);
}
var name = mapping.name;
if (name != null && !newNames.has(name)) {
newNames.add(name);
}
}, this);
this._sources = newSources;
this._names = newNames;
// Copy sourcesContents of applied map.
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content != null) {
if (aSourceMapPath != null) {
sourceFile = util.join(aSourceMapPath, sourceFile);
}
if (sourceRoot != null) {
sourceFile = util.relative(sourceRoot, sourceFile);
}
this.setSourceContent(sourceFile, content);
}
}, this);
};
/**
* A mapping can have one of the three levels of data:
*
* 1. Just the generated position.
* 2. The Generated position, original position, and original source.
* 3. Generated and original position, original source, as well as a name
* token.
*
* To maintain consistency, we validate that any new mapping being added falls
* in to one of these categories.
*/
SourceMapGenerator.prototype._validateMapping =
function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,
aName) {
// When aOriginal is truthy but has empty values for .line and .column,
// it is most likely a programmer error. In this case we throw a very
// specific error message to try to guide them the right way.
// For example: https://github.com/Polymer/polymer-bundler/pull/519
if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {
throw new Error(
'original.line and original.column are not numbers -- you probably meant to omit ' +
'the original mapping entirely and only map the generated position. If so, pass ' +
'null for the original mapping instead of an object with empty or null values.'
);
}
if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
&& aGenerated.line > 0 && aGenerated.column >= 0
&& !aOriginal && !aSource && !aName) {
// Case 1.
return;
}
else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated
&& aOriginal && 'line' in aOriginal && 'column' in aOriginal
&& aGenerated.line > 0 && aGenerated.column >= 0
&& aOriginal.line > 0 && aOriginal.column >= 0
&& aSource) {
// Cases 2 and 3.
return;
}
else {
throw new Error('Invalid mapping: ' + JSON.stringify({
generated: aGenerated,
source: aSource,
original: aOriginal,
name: aName
}));
}
};
/**
* Serialize the accumulated mappings in to the stream of base 64 VLQs
* specified by the source map format.
*/
SourceMapGenerator.prototype._serializeMappings =
function SourceMapGenerator_serializeMappings() {
var previousGeneratedColumn = 0;
var previousGeneratedLine = 1;
var previousOriginalColumn = 0;
var previousOriginalLine = 0;
var previousName = 0;
var previousSource = 0;
var result = '';
var next;
var mapping;
var nameIdx;
var sourceIdx;
var mappings = this._mappings.toArray();
for (var i = 0, len = mappings.length; i < len; i++) {
mapping = mappings[i];
next = ''
if (mapping.generatedLine !== previousGeneratedLine) {
previousGeneratedColumn = 0;
while (mapping.generatedLine !== previousGeneratedLine) {
next += ';';
previousGeneratedLine++;
}
}
else {
if (i > 0) {
if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {
continue;
}
next += ',';
}
}
next += base64VLQ.encode(mapping.generatedColumn
- previousGeneratedColumn);
previousGeneratedColumn = mapping.generatedColumn;
if (mapping.source != null) {
sourceIdx = this._sources.indexOf(mapping.source);
next += base64VLQ.encode(sourceIdx - previousSource);
previousSource = sourceIdx;
// lines are stored 0-based in SourceMap spec version 3
next += base64VLQ.encode(mapping.originalLine - 1
- previousOriginalLine);
previousOriginalLine = mapping.originalLine - 1;
next += base64VLQ.encode(mapping.originalColumn
- previousOriginalColumn);
previousOriginalColumn = mapping.originalColumn;
if (mapping.name != null) {
nameIdx = this._names.indexOf(mapping.name);
next += base64VLQ.encode(nameIdx - previousName);
previousName = nameIdx;
}
}
result += next;
}
return result;
};
SourceMapGenerator.prototype._generateSourcesContent =
function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {
return aSources.map(function (source) {
if (!this._sourcesContents) {
return null;
}
if (aSourceRoot != null) {
source = util.relative(aSourceRoot, source);
}
var key = util.toSetString(source);
return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)
? this._sourcesContents[key]
: null;
}, this);
};
/**
* Externalize the source map.
*/
SourceMapGenerator.prototype.toJSON =
function SourceMapGenerator_toJSON() {
var map = {
version: this._version,
sources: this._sources.toArray(),
names: this._names.toArray(),
mappings: this._serializeMappings()
};
if (this._file != null) {
map.file = this._file;
}
if (this._sourceRoot != null) {
map.sourceRoot = this._sourceRoot;
}
if (this._sourcesContents) {
map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);
}
return map;
};
/**
* Render the source map being generated to a string.
*/
SourceMapGenerator.prototype.toString =
function SourceMapGenerator_toString() {
return JSON.stringify(this.toJSON());
};
exports.SourceMapGenerator = SourceMapGenerator;
/***/ }),
/***/ "./node_modules/recast/node_modules/source-map/lib/source-node.js":
/*!************************************************************************!*\
!*** ./node_modules/recast/node_modules/source-map/lib/source-node.js ***!
\************************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
var SourceMapGenerator = (__webpack_require__(/*! ./source-map-generator */ "./node_modules/recast/node_modules/source-map/lib/source-map-generator.js").SourceMapGenerator);
var util = __webpack_require__(/*! ./util */ "./node_modules/recast/node_modules/source-map/lib/util.js");
// Matches a Windows-style `\r\n` newline or a `\n` newline used by all other
// operating systems these days (capturing the result).
var REGEX_NEWLINE = /(\r?\n)/;
// Newline character code for charCodeAt() comparisons
var NEWLINE_CODE = 10;
// Private symbol for identifying `SourceNode`s when multiple versions of
// the source-map library are loaded. This MUST NOT CHANGE across
// versions!
var isSourceNode = "$$$isSourceNode$$$";
/**
* SourceNodes provide a way to abstract over interpolating/concatenating
* snippets of generated JavaScript source code while maintaining the line and
* column information associated with the original source code.
*
* @param aLine The original line number.
* @param aColumn The original column number.
* @param aSource The original source's filename.
* @param aChunks Optional. An array of strings which are snippets of
* generated JS, or other SourceNodes.
* @param aName The original identifier.
*/
function SourceNode(aLine, aColumn, aSource, aChunks, aName) {
this.children = [];
this.sourceContents = {};
this.line = aLine == null ? null : aLine;
this.column = aColumn == null ? null : aColumn;
this.source = aSource == null ? null : aSource;
this.name = aName == null ? null : aName;
this[isSourceNode] = true;
if (aChunks != null) this.add(aChunks);
}
/**
* Creates a SourceNode from generated code and a SourceMapConsumer.
*
* @param aGeneratedCode The generated code
* @param aSourceMapConsumer The SourceMap for the generated code
* @param aRelativePath Optional. The path that relative sources in the
* SourceMapConsumer should be relative to.
*/
SourceNode.fromStringWithSourceMap =
function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {
// The SourceNode we want to fill with the generated code
// and the SourceMap
var node = new SourceNode();
// All even indices of this array are one line of the generated code,
// while all odd indices are the newlines between two adjacent lines
// (since `REGEX_NEWLINE` captures its match).
// Processed fragments are accessed by calling `shiftNextLine`.
var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);
var remainingLinesIndex = 0;
var shiftNextLine = function() {
var lineContents = getNextLine();
// The last line of a file might not have a newline.
var newLine = getNextLine() || "";
return lineContents + newLine;
function getNextLine() {
return remainingLinesIndex < remainingLines.length ?
remainingLines[remainingLinesIndex++] : undefined;
}
};
// We need to remember the position of "remainingLines"
var lastGeneratedLine = 1, lastGeneratedColumn = 0;
// The generate SourceNodes we need a code range.
// To extract it current and last mapping is used.
// Here we store the last mapping.
var lastMapping = null;
aSourceMapConsumer.eachMapping(function (mapping) {
if (lastMapping !== null) {
// We add the code from "lastMapping" to "mapping":
// First check if there is a new line in between.
if (lastGeneratedLine < mapping.generatedLine) {
// Associate first line with "lastMapping"
addMappingWithCode(lastMapping, shiftNextLine());
lastGeneratedLine++;
lastGeneratedColumn = 0;
// The remaining code is added without mapping
} else {
// There is no new line in between.
// Associate the code between "lastGeneratedColumn" and
// "mapping.generatedColumn" with "lastMapping"
var nextLine = remainingLines[remainingLinesIndex] || '';
var code = nextLine.substr(0, mapping.generatedColumn -
lastGeneratedColumn);
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -
lastGeneratedColumn);
lastGeneratedColumn = mapping.generatedColumn;
addMappingWithCode(lastMapping, code);
// No more remaining code, continue
lastMapping = mapping;
return;
}
}
// We add the generated code until the first mapping
// to the SourceNode without any mapping.
// Each line is added as separate string.
while (lastGeneratedLine < mapping.generatedLine) {
node.add(shiftNextLine());
lastGeneratedLine++;
}
if (lastGeneratedColumn < mapping.generatedColumn) {
var nextLine = remainingLines[remainingLinesIndex] || '';
node.add(nextLine.substr(0, mapping.generatedColumn));
remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);
lastGeneratedColumn = mapping.generatedColumn;
}
lastMapping = mapping;
}, this);
// We have processed all mappings.
if (remainingLinesIndex < remainingLines.length) {
if (lastMapping) {
// Associate the remaining code in the current line with "lastMapping"
addMappingWithCode(lastMapping, shiftNextLine());
}
// and add the remaining lines without any mapping
node.add(remainingLines.splice(remainingLinesIndex).join(""));
}
// Copy sourcesContent into SourceNode
aSourceMapConsumer.sources.forEach(function (sourceFile) {
var content = aSourceMapConsumer.sourceContentFor(sourceFile);
if (content != null) {
if (aRelativePath != null) {
sourceFile = util.join(aRelativePath, sourceFile);
}
node.setSourceContent(sourceFile, content);
}
});
return node;
function addMappingWithCode(mapping, code) {
if (mapping === null || mapping.source === undefined) {
node.add(code);
} else {
var source = aRelativePath
? util.join(aRelativePath, mapping.source)
: mapping.source;
node.add(new SourceNode(mapping.originalLine,
mapping.originalColumn,
source,
code,
mapping.name));
}
}
};
/**
* Add a chunk of generated JS to this source node.
*
* @param aChunk A string snippet of generated JS code, another instance of
* SourceNode, or an array where each member is one of those things.
*/
SourceNode.prototype.add = function SourceNode_add(aChunk) {
if (Array.isArray(aChunk)) {
aChunk.forEach(function (chunk) {
this.add(chunk);
}, this);
}
else if (aChunk[isSourceNode] || typeof aChunk === "string") {
if (aChunk) {
this.children.push(aChunk);
}
}
else {
throw new TypeError(
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
);
}
return this;
};
/**
* Add a chunk of generated JS to the beginning of this source node.
*
* @param aChunk A string snippet of generated JS code, another instance of
* SourceNode, or an array where each member is one of those things.
*/
SourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {
if (Array.isArray(aChunk)) {
for (var i = aChunk.length-1; i >= 0; i--) {
this.prepend(aChunk[i]);
}
}
else if (aChunk[isSourceNode] || typeof aChunk === "string") {
this.children.unshift(aChunk);
}
else {
throw new TypeError(
"Expected a SourceNode, string, or an array of SourceNodes and strings. Got " + aChunk
);
}
return this;
};
/**
* Walk over the tree of JS snippets in this node and its children. The
* walking function is called once for each snippet of JS and is passed that
* snippet and the its original associated source's line/column location.
*
* @param aFn The traversal function.
*/
SourceNode.prototype.walk = function SourceNode_walk(aFn) {
var chunk;
for (var i = 0, len = this.children.length; i < len; i++) {
chunk = this.children[i];
if (chunk[isSourceNode]) {
chunk.walk(aFn);
}
else {
if (chunk !== '') {
aFn(chunk, { source: this.source,
line: this.line,
column: this.column,
name: this.name });
}
}
}
};
/**
* Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between
* each of `this.children`.
*
* @param aSep The separator.
*/
SourceNode.prototype.join = function SourceNode_join(aSep) {
var newChildren;
var i;
var len = this.children.length;
if (len > 0) {
newChildren = [];
for (i = 0; i < len-1; i++) {
newChildren.push(this.children[i]);
newChildren.push(aSep);
}
newChildren.push(this.children[i]);
this.children = newChildren;
}
return this;
};
/**
* Call String.prototype.replace on the very right-most source snippet. Useful
* for trimming whitespace from the end of a source node, etc.
*
* @param aPattern The pattern to replace.
* @param aReplacement The thing to replace the pattern with.
*/
SourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {
var lastChild = this.children[this.children.length - 1];
if (lastChild[isSourceNode]) {
lastChild.replaceRight(aPattern, aReplacement);
}
else if (typeof lastChild === 'string') {
this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);
}
else {
this.children.push(''.replace(aPattern, aReplacement));
}
return this;
};
/**
* Set the source content for a source file. This will be added to the SourceMapGenerator
* in the sourcesContent field.
*
* @param aSourceFile The filename of the source file
* @param aSourceContent The content of the source file
*/
SourceNode.prototype.setSourceContent =
function SourceNode_setSourceContent(aSourceFile, aSourceContent) {
this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;
};
/**
* Walk over the tree of SourceNodes. The walking function is called for each
* source file content and is passed the filename and source content.
*
* @param aFn The traversal function.
*/
SourceNode.prototype.walkSourceContents =
function SourceNode_walkSourceContents(aFn) {
for (var i = 0, len = this.children.length; i < len; i++) {
if (this.children[i][isSourceNode]) {
this.children[i].walkSourceContents(aFn);
}
}
var sources = Object.keys(this.sourceContents);
for (var i = 0, len = sources.length; i < len; i++) {
aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);
}
};
/**
* Return the string representation of this source node. Walks over the tree
* and concatenates all the various snippets together to one string.
*/
SourceNode.prototype.toString = function SourceNode_toString() {
var str = "";
this.walk(function (chunk) {
str += chunk;
});
return str;
};
/**
* Returns the string representation of this source node along with a source
* map.
*/
SourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {
var generated = {
code: "",
line: 1,
column: 0
};
var map = new SourceMapGenerator(aArgs);
var sourceMappingActive = false;
var lastOriginalSource = null;
var lastOriginalLine = null;
var lastOriginalColumn = null;
var lastOriginalName = null;
this.walk(function (chunk, original) {
generated.code += chunk;
if (original.source !== null
&& original.line !== null
&& original.column !== null) {
if(lastOriginalSource !== original.source
|| lastOriginalLine !== original.line
|| lastOriginalColumn !== original.column
|| lastOriginalName !== original.name) {
map.addMapping({
source: original.source,
original: {
line: original.line,
column: original.column
},
generated: {
line: generated.line,
column: generated.column
},
name: original.name
});
}
lastOriginalSource = original.source;
lastOriginalLine = original.line;
lastOriginalColumn = original.column;
lastOriginalName = original.name;
sourceMappingActive = true;
} else if (sourceMappingActive) {
map.addMapping({
generated: {
line: generated.line,
column: generated.column
}
});
lastOriginalSource = null;
sourceMappingActive = false;
}
for (var idx = 0, length = chunk.length; idx < length; idx++) {
if (chunk.charCodeAt(idx) === NEWLINE_CODE) {
generated.line++;
generated.column = 0;
// Mappings end at eol
if (idx + 1 === length) {
lastOriginalSource = null;
sourceMappingActive = false;
} else if (sourceMappingActive) {
map.addMapping({
source: original.source,
original: {
line: original.line,
column: original.column
},
generated: {
line: generated.line,
column: generated.column
},
name: original.name
});
}
} else {
generated.column++;
}
}
});
this.walkSourceContents(function (sourceFile, sourceContent) {
map.setSourceContent(sourceFile, sourceContent);
});
return { code: generated.code, map: map };
};
exports.SourceNode = SourceNode;
/***/ }),
/***/ "./node_modules/recast/node_modules/source-map/lib/util.js":
/*!*****************************************************************!*\
!*** ./node_modules/recast/node_modules/source-map/lib/util.js ***!
\*****************************************************************/
/***/ ((__unused_webpack_module, exports) => {
/* -*- Mode: js; js-indent-level: 2; -*- */
/*
* Copyright 2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE or:
* http://opensource.org/licenses/BSD-3-Clause
*/
/**
* This is a helper function for getting values from parameter/options
* objects.
*
* @param args The object we are extracting values from
* @param name The name of the property we are getting.
* @param defaultValue An optional value to return if the property is missing
* from the object. If this is not specified and the property is missing, an
* error will be thrown.
*/
function getArg(aArgs, aName, aDefaultValue) {
if (aName in aArgs) {
return aArgs[aName];
} else if (arguments.length === 3) {
return aDefaultValue;
} else {
throw new Error('"' + aName + '" is a required argument.');
}
}
exports.getArg = getArg;
var urlRegexp = /^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/;
var dataUrlRegexp = /^data:.+\,.+$/;
function urlParse(aUrl) {
var match = aUrl.match(urlRegexp);
if (!match) {
return null;
}
return {
scheme: match[1],
auth: match[2],
host: match[3],
port: match[4],
path: match[5]
};
}
exports.urlParse = urlParse;
function urlGenerate(aParsedUrl) {
var url = '';
if (aParsedUrl.scheme) {
url += aParsedUrl.scheme + ':';
}
url += '//';
if (aParsedUrl.auth) {
url += aParsedUrl.auth + '@';
}
if (aParsedUrl.host) {
url += aParsedUrl.host;
}
if (aParsedUrl.port) {
url += ":" + aParsedUrl.port
}
if (aParsedUrl.path) {
url += aParsedUrl.path;
}
return url;
}
exports.urlGenerate = urlGenerate;
/**
* Normalizes a path, or the path portion of a URL:
*
* - Replaces consecutive slashes with one slash.
* - Removes unnecessary '.' parts.
* - Removes unnecessary '<dir>/..' parts.
*
* Based on code in the Node.js 'path' core module.
*
* @param aPath The path or url to normalize.
*/
function normalize(aPath) {
var path = aPath;
var url = urlParse(aPath);
if (url) {
if (!url.path) {
return aPath;
}
path = url.path;
}
var isAbsolute = exports.isAbsolute(path);
var parts = path.split(/\/+/);
for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {
part = parts[i];
if (part === '.') {
parts.splice(i, 1);
} else if (part === '..') {
up++;
} else if (up > 0) {
if (part === '') {
// The first part is blank if the path is absolute. Trying to go
// above the root is a no-op. Therefore we can remove all '..' parts
// directly after the root.
parts.splice(i + 1, up);
up = 0;
} else {
parts.splice(i, 2);
up--;
}
}
}
path = parts.join('/');
if (path === '') {
path = isAbsolute ? '/' : '.';
}
if (url) {
url.path = path;
return urlGenerate(url);
}
return path;
}
exports.normalize = normalize;
/**
* Joins two paths/URLs.
*
* @param aRoot The root path or URL.
* @param aPath The path or URL to be joined with the root.
*
* - If aPath is a URL or a data URI, aPath is returned, unless aPath is a
* scheme-relative URL: Then the scheme of aRoot, if any, is prepended
* first.
* - Otherwise aPath is a path. If aRoot is a URL, then its path portion
* is updated with the result and aRoot is returned. Otherwise the result
* is returned.
* - If aPath is absolute, the result is aPath.
* - Otherwise the two paths are joined with a slash.
* - Joining for example 'http://' and 'www.example.com' is also supported.
*/
function join(aRoot, aPath) {
if (aRoot === "") {
aRoot = ".";
}
if (aPath === "") {
aPath = ".";
}
var aPathUrl = urlParse(aPath);
var aRootUrl = urlParse(aRoot);
if (aRootUrl) {
aRoot = aRootUrl.path || '/';
}
// `join(foo, '//www.example.org')`
if (aPathUrl && !aPathUrl.scheme) {
if (aRootUrl) {
aPathUrl.scheme = aRootUrl.scheme;
}
return urlGenerate(aPathUrl);
}
if (aPathUrl || aPath.match(dataUrlRegexp)) {
return aPath;
}
// `join('http://', 'www.example.com')`
if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {
aRootUrl.host = aPath;
return urlGenerate(aRootUrl);
}
var joined = aPath.charAt(0) === '/'
? aPath
: normalize(aRoot.replace(/\/+$/, '') + '/' + aPath);
if (aRootUrl) {
aRootUrl.path = joined;
return urlGenerate(aRootUrl);
}
return joined;
}
exports.join = join;
exports.isAbsolute = function (aPath) {
return aPath.charAt(0) === '/' || urlRegexp.test(aPath);
};
/**
* Make a path relative to a URL or another path.
*
* @param aRoot The root path or URL.
* @param aPath The path or URL to be made relative to aRoot.
*/
function relative(aRoot, aPath) {
if (aRoot === "") {
aRoot = ".";
}
aRoot = aRoot.replace(/\/$/, '');
// It is possible for the path to be above the root. In this case, simply
// checking whether the root is a prefix of the path won't work. Instead, we
// need to remove components from the root one by one, until either we find
// a prefix that fits, or we run out of components to remove.
var level = 0;
while (aPath.indexOf(aRoot + '/') !== 0) {
var index = aRoot.lastIndexOf("/");
if (index < 0) {
return aPath;
}
// If the only part of the root that is left is the scheme (i.e. http://,
// file:///, etc.), one or more slashes (/), or simply nothing at all, we
// have exhausted all components, so the path is not relative to the root.
aRoot = aRoot.slice(0, index);
if (aRoot.match(/^([^\/]+:\/)?\/*$/)) {
return aPath;
}
++level;
}
// Make sure we add a "../" for each component we removed from the root.
return Array(level + 1).join("../") + aPath.substr(aRoot.length + 1);
}
exports.relative = relative;
var supportsNullProto = (function () {
var obj = Object.create(null);
return !('__proto__' in obj);
}());
function identity (s) {
return s;
}
/**
* Because behavior goes wacky when you set `__proto__` on objects, we
* have to prefix all the strings in our set with an arbitrary character.
*
* See https://github.com/mozilla/source-map/pull/31 and
* https://github.com/mozilla/source-map/issues/30
*
* @param String aStr
*/
function toSetString(aStr) {
if (isProtoString(aStr)) {
return '$' + aStr;
}
return aStr;
}
exports.toSetString = supportsNullProto ? identity : toSetString;
function fromSetString(aStr) {
if (isProtoString(aStr)) {
return aStr.slice(1);
}
return aStr;
}
exports.fromSetString = supportsNullProto ? identity : fromSetString;
function isProtoString(s) {
if (!s) {
return false;
}
var length = s.length;
if (length < 9 /* "__proto__".length */) {
return false;
}
if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||
s.charCodeAt(length - 2) !== 95 /* '_' */ ||
s.charCodeAt(length - 3) !== 111 /* 'o' */ ||
s.charCodeAt(length - 4) !== 116 /* 't' */ ||
s.charCodeAt(length - 5) !== 111 /* 'o' */ ||
s.charCodeAt(length - 6) !== 114 /* 'r' */ ||
s.charCodeAt(length - 7) !== 112 /* 'p' */ ||
s.charCodeAt(length - 8) !== 95 /* '_' */ ||
s.charCodeAt(length - 9) !== 95 /* '_' */) {
return false;
}
for (var i = length - 10; i >= 0; i--) {
if (s.charCodeAt(i) !== 36 /* '$' */) {
return false;
}
}
return true;
}
/**
* Comparator between two mappings where the original positions are compared.
*
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
* mappings with the same original source/line/column, but different generated
* line and column the same. Useful when searching for a mapping with a
* stubbed out mapping.
*/
function compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {
var cmp = strcmp(mappingA.source, mappingB.source);
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0 || onlyCompareOriginal) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
return strcmp(mappingA.name, mappingB.name);
}
exports.compareByOriginalPositions = compareByOriginalPositions;
/**
* Comparator between two mappings with deflated source and name indices where
* the generated positions are compared.
*
* Optionally pass in `true` as `onlyCompareGenerated` to consider two
* mappings with the same generated line and column, but different
* source/name/original line and column the same. Useful when searching for a
* mapping with a stubbed out mapping.
*/
function compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {
var cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0 || onlyCompareGenerated) {
return cmp;
}
cmp = strcmp(mappingA.source, mappingB.source);
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0) {
return cmp;
}
return strcmp(mappingA.name, mappingB.name);
}
exports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;
function strcmp(aStr1, aStr2) {
if (aStr1 === aStr2) {
return 0;
}
if (aStr1 === null) {
return 1; // aStr2 !== null
}
if (aStr2 === null) {
return -1; // aStr1 !== null
}
if (aStr1 > aStr2) {
return 1;
}
return -1;
}
/**
* Comparator between two mappings with inflated source and name strings where
* the generated positions are compared.
*/
function compareByGeneratedPositionsInflated(mappingA, mappingB) {
var cmp = mappingA.generatedLine - mappingB.generatedLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.generatedColumn - mappingB.generatedColumn;
if (cmp !== 0) {
return cmp;
}
cmp = strcmp(mappingA.source, mappingB.source);
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalLine - mappingB.originalLine;
if (cmp !== 0) {
return cmp;
}
cmp = mappingA.originalColumn - mappingB.originalColumn;
if (cmp !== 0) {
return cmp;
}
return strcmp(mappingA.name, mappingB.name);
}
exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;
/**
* Strip any JSON XSSI avoidance prefix from the string (as documented
* in the source maps specification), and then parse the string as
* JSON.
*/
function parseSourceMapInput(str) {
return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
}
exports.parseSourceMapInput = parseSourceMapInput;
/**
* Compute the URL of a source given the the source root, the source's
* URL, and the source map's URL.
*/
function computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {
sourceURL = sourceURL || '';
if (sourceRoot) {
// This follows what Chrome does.
if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {
sourceRoot += '/';
}
// The spec says:
// Line 4: An optional source root, useful for relocating source
// files on a server or removing repeated values in the
// “sources” entry. This value is prepended to the individual
// entries in the “source” field.
sourceURL = sourceRoot + sourceURL;
}
// Historically, SourceMapConsumer did not take the sourceMapURL as
// a parameter. This mode is still somewhat supported, which is why
// this code block is conditional. However, it's preferable to pass
// the source map URL to SourceMapConsumer, so that this function
// can implement the source URL resolution algorithm as outlined in
// the spec. This block is basically the equivalent of:
// new URL(sourceURL, sourceMapURL).toString()
// ... except it avoids using URL, which wasn't available in the
// older releases of node still supported by this library.
//
// The spec says:
// If the sources are not absolute URLs after prepending of the
// “sourceRoot”, the sources are resolved relative to the
// SourceMap (like resolving script src in a html document).
if (sourceMapURL) {
var parsed = urlParse(sourceMapURL);
if (!parsed) {
throw new Error("sourceMapURL could not be parsed");
}
if (parsed.path) {
// Strip the last path component, but keep the "/".
var index = parsed.path.lastIndexOf('/');
if (index >= 0) {
parsed.path = parsed.path.substring(0, index + 1);
}
}
sourceURL = join(urlGenerate(parsed), sourceURL);
}
return normalize(sourceURL);
}
exports.computeSourceURL = computeSourceURL;
/***/ }),
/***/ "./node_modules/recast/node_modules/source-map/source-map.js":
/*!*******************************************************************!*\
!*** ./node_modules/recast/node_modules/source-map/source-map.js ***!
\*******************************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/*
* Copyright 2009-2011 Mozilla Foundation and contributors
* Licensed under the New BSD license. See LICENSE.txt or:
* http://opensource.org/licenses/BSD-3-Clause
*/
exports.SourceMapGenerator = __webpack_require__(/*! ./lib/source-map-generator */ "./node_modules/recast/node_modules/source-map/lib/source-map-generator.js").SourceMapGenerator;
exports.SourceMapConsumer = __webpack_require__(/*! ./lib/source-map-consumer */ "./node_modules/recast/node_modules/source-map/lib/source-map-consumer.js").SourceMapConsumer;
exports.SourceNode = __webpack_require__(/*! ./lib/source-node */ "./node_modules/recast/node_modules/source-map/lib/source-node.js").SourceNode;
/***/ }),
/***/ "./node_modules/recast/parsers/esprima.js":
/*!************************************************!*\
!*** ./node_modules/recast/parsers/esprima.js ***!
\************************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.parse = void 0;
// This module is suitable for passing as options.parser when calling
// recast.parse to process ECMAScript code with Esprima:
//
// const ast = recast.parse(source, {
// parser: require("recast/parsers/esprima")
// });
//
var util_1 = __webpack_require__(/*! ../lib/util */ "./node_modules/recast/lib/util.js");
function parse(source, options) {
var comments = [];
var ast = (__webpack_require__(/*! esprima */ "./node_modules/esprima/dist/esprima.js").parse)(source, {
loc: true,
locations: true,
comment: true,
onComment: comments,
range: (0, util_1.getOption)(options, "range", false),
tolerant: (0, util_1.getOption)(options, "tolerant", true),
tokens: true,
jsx: (0, util_1.getOption)(options, "jsx", false),
sourceType: (0, util_1.getOption)(options, "sourceType", "module"),
});
if (!Array.isArray(ast.comments)) {
ast.comments = comments;
}
return ast;
}
exports.parse = parse;
/***/ }),
/***/ "./node_modules/safe-regex-test/index.js":
/*!***********************************************!*\
!*** ./node_modules/safe-regex-test/index.js ***!
\***********************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var callBound = __webpack_require__(/*! call-bound */ "./node_modules/call-bound/index.js");
var isRegex = __webpack_require__(/*! is-regex */ "./node_modules/is-regex/index.js");
var $exec = callBound('RegExp.prototype.exec');
var $TypeError = __webpack_require__(/*! es-errors/type */ "./node_modules/es-errors/type.js");
/** @type {import('.')} */
module.exports = function regexTester(regex) {
if (!isRegex(regex)) {
throw new $TypeError('`regex` must be a RegExp');
}
return function test(s) {
return $exec(regex, s) !== null;
};
};
/***/ }),
/***/ "./node_modules/set-function-length/index.js":
/*!***************************************************!*\
!*** ./node_modules/set-function-length/index.js ***!
\***************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var GetIntrinsic = __webpack_require__(/*! get-intrinsic */ "./node_modules/get-intrinsic/index.js");
var define = __webpack_require__(/*! define-data-property */ "./node_modules/define-data-property/index.js");
var hasDescriptors = __webpack_require__(/*! has-property-descriptors */ "./node_modules/has-property-descriptors/index.js")();
var gOPD = __webpack_require__(/*! gopd */ "./node_modules/gopd/index.js");
var $TypeError = __webpack_require__(/*! es-errors/type */ "./node_modules/es-errors/type.js");
var $floor = GetIntrinsic('%Math.floor%');
/** @type {import('.')} */
module.exports = function setFunctionLength(fn, length) {
if (typeof fn !== 'function') {
throw new $TypeError('`fn` is not a function');
}
if (typeof length !== 'number' || length < 0 || length > 0xFFFFFFFF || $floor(length) !== length) {
throw new $TypeError('`length` must be a positive 32-bit integer');
}
var loose = arguments.length > 2 && !!arguments[2];
var functionLengthIsConfigurable = true;
var functionLengthIsWritable = true;
if ('length' in fn && gOPD) {
var desc = gOPD(fn, 'length');
if (desc && !desc.configurable) {
functionLengthIsConfigurable = false;
}
if (desc && !desc.writable) {
functionLengthIsWritable = false;
}
}
if (functionLengthIsConfigurable || functionLengthIsWritable || !loose) {
if (hasDescriptors) {
define(/** @type {Parameters<define>[0]} */ (fn), 'length', length, true, true);
} else {
define(/** @type {Parameters<define>[0]} */ (fn), 'length', length);
}
}
return fn;
};
/***/ }),
/***/ "./node_modules/tiny-invariant/dist/tiny-invariant.cjs.js":
/*!****************************************************************!*\
!*** ./node_modules/tiny-invariant/dist/tiny-invariant.cjs.js ***!
\****************************************************************/
/***/ ((module) => {
"use strict";
var isProduction = "development" === 'production';
var prefix = 'Invariant failed';
function invariant(condition, message) {
if (condition) {
return;
}
if (isProduction) {
throw new Error(prefix);
}
var provided = typeof message === 'function' ? message() : message;
var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
throw new Error(value);
}
module.exports = invariant;
/***/ }),
/***/ "./node_modules/tslib/tslib.es6.mjs":
/*!******************************************!*\
!*** ./node_modules/tslib/tslib.es6.mjs ***!
\******************************************/
/***/ ((__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) => {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ __addDisposableResource: () => (/* binding */ __addDisposableResource),
/* harmony export */ __assign: () => (/* binding */ __assign),
/* harmony export */ __asyncDelegator: () => (/* binding */ __asyncDelegator),
/* harmony export */ __asyncGenerator: () => (/* binding */ __asyncGenerator),
/* harmony export */ __asyncValues: () => (/* binding */ __asyncValues),
/* harmony export */ __await: () => (/* binding */ __await),
/* harmony export */ __awaiter: () => (/* binding */ __awaiter),
/* harmony export */ __classPrivateFieldGet: () => (/* binding */ __classPrivateFieldGet),
/* harmony export */ __classPrivateFieldIn: () => (/* binding */ __classPrivateFieldIn),
/* harmony export */ __classPrivateFieldSet: () => (/* binding */ __classPrivateFieldSet),
/* harmony export */ __createBinding: () => (/* binding */ __createBinding),
/* harmony export */ __decorate: () => (/* binding */ __decorate),
/* harmony export */ __disposeResources: () => (/* binding */ __disposeResources),
/* harmony export */ __esDecorate: () => (/* binding */ __esDecorate),
/* harmony export */ __exportStar: () => (/* binding */ __exportStar),
/* harmony export */ __extends: () => (/* binding */ __extends),
/* harmony export */ __generator: () => (/* binding */ __generator),
/* harmony export */ __importDefault: () => (/* binding */ __importDefault),
/* harmony export */ __importStar: () => (/* binding */ __importStar),
/* harmony export */ __makeTemplateObject: () => (/* binding */ __makeTemplateObject),
/* harmony export */ __metadata: () => (/* binding */ __metadata),
/* harmony export */ __param: () => (/* binding */ __param),
/* harmony export */ __propKey: () => (/* binding */ __propKey),
/* harmony export */ __read: () => (/* binding */ __read),
/* harmony export */ __rest: () => (/* binding */ __rest),
/* harmony export */ __rewriteRelativeImportExtension: () => (/* binding */ __rewriteRelativeImportExtension),
/* harmony export */ __runInitializers: () => (/* binding */ __runInitializers),
/* harmony export */ __setFunctionName: () => (/* binding */ __setFunctionName),
/* harmony export */ __spread: () => (/* binding */ __spread),
/* harmony export */ __spreadArray: () => (/* binding */ __spreadArray),
/* harmony export */ __spreadArrays: () => (/* binding */ __spreadArrays),
/* harmony export */ __values: () => (/* binding */ __values),
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/******************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
}
return __assign.apply(this, arguments);
}
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function __param(paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
}
function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
var _, done = false;
for (var i = decorators.length - 1; i >= 0; i--) {
var context = {};
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
if (kind === "accessor") {
if (result === void 0) continue;
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
if (_ = accept(result.get)) descriptor.get = _;
if (_ = accept(result.set)) descriptor.set = _;
if (_ = accept(result.init)) initializers.unshift(_);
}
else if (_ = accept(result)) {
if (kind === "field") initializers.unshift(_);
else descriptor[key] = _;
}
}
if (target) Object.defineProperty(target, contextIn.name, descriptor);
done = true;
};
function __runInitializers(thisArg, initializers, value) {
var useValue = arguments.length > 2;
for (var i = 0; i < initializers.length; i++) {
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
}
return useValue ? value : void 0;
};
function __propKey(x) {
return typeof x === "symbol" ? x : "".concat(x);
};
function __setFunctionName(f, name, prefix) {
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
};
function __metadata(metadataKey, metadataValue) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
}
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
var __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];
});
function __exportStar(m, o) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);
}
function __values(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
}
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
/** @deprecated */
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
/** @deprecated */
function __spreadArrays() {
for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
for (var r = Array(s), k = 0, i = 0; i < il; i++)
for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
r[k] = a[j];
return r;
}
function __spreadArray(to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
}
function __await(v) {
return this instanceof __await ? (this.v = v, this) : new __await(v);
}
function __asyncGenerator(thisArg, _arguments, generator) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var g = generator.apply(thisArg, _arguments || []), i, q = [];
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
function fulfill(value) { resume("next", value); }
function reject(value) { resume("throw", value); }
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
}
function __asyncDelegator(o) {
var i, p;
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
}
function __asyncValues(o) {
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
var m = o[Symbol.asyncIterator], i;
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
}
function __makeTemplateObject(cooked, raw) {
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
return cooked;
};
var __setModuleDefault = Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
};
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
function __importStar(mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
}
function __importDefault(mod) {
return (mod && mod.__esModule) ? mod : { default: mod };
}
function __classPrivateFieldGet(receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
}
function __classPrivateFieldSet(receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
}
function __classPrivateFieldIn(state, receiver) {
if (receiver === null || (typeof receiver !== "object" && typeof receiver !== "function")) throw new TypeError("Cannot use 'in' operator on non-object");
return typeof state === "function" ? receiver === state : state.has(receiver);
}
function __addDisposableResource(env, value, async) {
if (value !== null && value !== void 0) {
if (typeof value !== "object" && typeof value !== "function") throw new TypeError("Object expected.");
var dispose, inner;
if (async) {
if (!Symbol.asyncDispose) throw new TypeError("Symbol.asyncDispose is not defined.");
dispose = value[Symbol.asyncDispose];
}
if (dispose === void 0) {
if (!Symbol.dispose) throw new TypeError("Symbol.dispose is not defined.");
dispose = value[Symbol.dispose];
if (async) inner = dispose;
}
if (typeof dispose !== "function") throw new TypeError("Object not disposable.");
if (inner) dispose = function() { try { inner.call(this); } catch (e) { return Promise.reject(e); } };
env.stack.push({ value: value, dispose: dispose, async: async });
}
else if (async) {
env.stack.push({ async: true });
}
return value;
}
var _SuppressedError = typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
var e = new Error(message);
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};
function __disposeResources(env) {
function fail(e) {
env.error = env.hasError ? new _SuppressedError(e, env.error, "An error was suppressed during disposal.") : e;
env.hasError = true;
}
var r, s = 0;
function next() {
while (r = env.stack.pop()) {
try {
if (!r.async && s === 1) return s = 0, env.stack.push(r), Promise.resolve().then(next);
if (r.dispose) {
var result = r.dispose.call(r.value);
if (r.async) return s |= 2, Promise.resolve(result).then(next, function(e) { fail(e); return next(); });
}
else s |= 1;
}
catch (e) {
fail(e);
}
}
if (s === 1) return env.hasError ? Promise.reject(env.error) : Promise.resolve();
if (env.hasError) throw env.error;
}
return next();
}
function __rewriteRelativeImportExtension(path, preserveJsx) {
if (typeof path === "string" && /^\.\.?\//.test(path)) {
return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
});
}
return path;
}
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
__extends,
__assign,
__rest,
__decorate,
__param,
__esDecorate,
__runInitializers,
__propKey,
__setFunctionName,
__metadata,
__awaiter,
__generator,
__createBinding,
__exportStar,
__values,
__read,
__spread,
__spreadArrays,
__spreadArray,
__await,
__asyncGenerator,
__asyncDelegator,
__asyncValues,
__makeTemplateObject,
__importStar,
__importDefault,
__classPrivateFieldGet,
__classPrivateFieldSet,
__classPrivateFieldIn,
__addDisposableResource,
__disposeResources,
__rewriteRelativeImportExtension,
});
/***/ }),
/***/ "./node_modules/util/support/isBufferBrowser.js":
/*!******************************************************!*\
!*** ./node_modules/util/support/isBufferBrowser.js ***!
\******************************************************/
/***/ ((module) => {
module.exports = function isBuffer(arg) {
return arg && typeof arg === 'object'
&& typeof arg.copy === 'function'
&& typeof arg.fill === 'function'
&& typeof arg.readUInt8 === 'function';
}
/***/ }),
/***/ "./node_modules/util/support/types.js":
/*!********************************************!*\
!*** ./node_modules/util/support/types.js ***!
\********************************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
"use strict";
// Currently in sync with Node.js lib/internal/util/types.js
// https://github.com/nodejs/node/commit/112cc7c27551254aa2b17098fb774867f05ed0d9
var isArgumentsObject = __webpack_require__(/*! is-arguments */ "./node_modules/is-arguments/index.js");
var isGeneratorFunction = __webpack_require__(/*! is-generator-function */ "./node_modules/is-generator-function/index.js");
var whichTypedArray = __webpack_require__(/*! which-typed-array */ "./node_modules/which-typed-array/index.js");
var isTypedArray = __webpack_require__(/*! is-typed-array */ "./node_modules/is-typed-array/index.js");
function uncurryThis(f) {
return f.call.bind(f);
}
var BigIntSupported = typeof BigInt !== 'undefined';
var SymbolSupported = typeof Symbol !== 'undefined';
var ObjectToString = uncurryThis(Object.prototype.toString);
var numberValue = uncurryThis(Number.prototype.valueOf);
var stringValue = uncurryThis(String.prototype.valueOf);
var booleanValue = uncurryThis(Boolean.prototype.valueOf);
if (BigIntSupported) {
var bigIntValue = uncurryThis(BigInt.prototype.valueOf);
}
if (SymbolSupported) {
var symbolValue = uncurryThis(Symbol.prototype.valueOf);
}
function checkBoxedPrimitive(value, prototypeValueOf) {
if (typeof value !== 'object') {
return false;
}
try {
prototypeValueOf(value);
return true;
} catch(e) {
return false;
}
}
exports.isArgumentsObject = isArgumentsObject;
exports.isGeneratorFunction = isGeneratorFunction;
exports.isTypedArray = isTypedArray;
// Taken from here and modified for better browser support
// https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js
function isPromise(input) {
return (
(
typeof Promise !== 'undefined' &&
input instanceof Promise
) ||
(
input !== null &&
typeof input === 'object' &&
typeof input.then === 'function' &&
typeof input.catch === 'function'
)
);
}
exports.isPromise = isPromise;
function isArrayBufferView(value) {
if (typeof ArrayBuffer !== 'undefined' && ArrayBuffer.isView) {
return ArrayBuffer.isView(value);
}
return (
isTypedArray(value) ||
isDataView(value)
);
}
exports.isArrayBufferView = isArrayBufferView;
function isUint8Array(value) {
return whichTypedArray(value) === 'Uint8Array';
}
exports.isUint8Array = isUint8Array;
function isUint8ClampedArray(value) {
return whichTypedArray(value) === 'Uint8ClampedArray';
}
exports.isUint8ClampedArray = isUint8ClampedArray;
function isUint16Array(value) {
return whichTypedArray(value) === 'Uint16Array';
}
exports.isUint16Array = isUint16Array;
function isUint32Array(value) {
return whichTypedArray(value) === 'Uint32Array';
}
exports.isUint32Array = isUint32Array;
function isInt8Array(value) {
return whichTypedArray(value) === 'Int8Array';
}
exports.isInt8Array = isInt8Array;
function isInt16Array(value) {
return whichTypedArray(value) === 'Int16Array';
}
exports.isInt16Array = isInt16Array;
function isInt32Array(value) {
return whichTypedArray(value) === 'Int32Array';
}
exports.isInt32Array = isInt32Array;
function isFloat32Array(value) {
return whichTypedArray(value) === 'Float32Array';
}
exports.isFloat32Array = isFloat32Array;
function isFloat64Array(value) {
return whichTypedArray(value) === 'Float64Array';
}
exports.isFloat64Array = isFloat64Array;
function isBigInt64Array(value) {
return whichTypedArray(value) === 'BigInt64Array';
}
exports.isBigInt64Array = isBigInt64Array;
function isBigUint64Array(value) {
return whichTypedArray(value) === 'BigUint64Array';
}
exports.isBigUint64Array = isBigUint64Array;
function isMapToString(value) {
return ObjectToString(value) === '[object Map]';
}
isMapToString.working = (
typeof Map !== 'undefined' &&
isMapToString(new Map())
);
function isMap(value) {
if (typeof Map === 'undefined') {
return false;
}
return isMapToString.working
? isMapToString(value)
: value instanceof Map;
}
exports.isMap = isMap;
function isSetToString(value) {
return ObjectToString(value) === '[object Set]';
}
isSetToString.working = (
typeof Set !== 'undefined' &&
isSetToString(new Set())
);
function isSet(value) {
if (typeof Set === 'undefined') {
return false;
}
return isSetToString.working
? isSetToString(value)
: value instanceof Set;
}
exports.isSet = isSet;
function isWeakMapToString(value) {
return ObjectToString(value) === '[object WeakMap]';
}
isWeakMapToString.working = (
typeof WeakMap !== 'undefined' &&
isWeakMapToString(new WeakMap())
);
function isWeakMap(value) {
if (typeof WeakMap === 'undefined') {
return false;
}
return isWeakMapToString.working
? isWeakMapToString(value)
: value instanceof WeakMap;
}
exports.isWeakMap = isWeakMap;
function isWeakSetToString(value) {
return ObjectToString(value) === '[object WeakSet]';
}
isWeakSetToString.working = (
typeof WeakSet !== 'undefined' &&
isWeakSetToString(new WeakSet())
);
function isWeakSet(value) {
return isWeakSetToString(value);
}
exports.isWeakSet = isWeakSet;
function isArrayBufferToString(value) {
return ObjectToString(value) === '[object ArrayBuffer]';
}
isArrayBufferToString.working = (
typeof ArrayBuffer !== 'undefined' &&
isArrayBufferToString(new ArrayBuffer())
);
function isArrayBuffer(value) {
if (typeof ArrayBuffer === 'undefined') {
return false;
}
return isArrayBufferToString.working
? isArrayBufferToString(value)
: value instanceof ArrayBuffer;
}
exports.isArrayBuffer = isArrayBuffer;
function isDataViewToString(value) {
return ObjectToString(value) === '[object DataView]';
}
isDataViewToString.working = (
typeof ArrayBuffer !== 'undefined' &&
typeof DataView !== 'undefined' &&
isDataViewToString(new DataView(new ArrayBuffer(1), 0, 1))
);
function isDataView(value) {
if (typeof DataView === 'undefined') {
return false;
}
return isDataViewToString.working
? isDataViewToString(value)
: value instanceof DataView;
}
exports.isDataView = isDataView;
// Store a copy of SharedArrayBuffer in case it's deleted elsewhere
var SharedArrayBufferCopy = typeof SharedArrayBuffer !== 'undefined' ? SharedArrayBuffer : undefined;
function isSharedArrayBufferToString(value) {
return ObjectToString(value) === '[object SharedArrayBuffer]';
}
function isSharedArrayBuffer(value) {
if (typeof SharedArrayBufferCopy === 'undefined') {
return false;
}
if (typeof isSharedArrayBufferToString.working === 'undefined') {
isSharedArrayBufferToString.working = isSharedArrayBufferToString(new SharedArrayBufferCopy());
}
return isSharedArrayBufferToString.working
? isSharedArrayBufferToString(value)
: value instanceof SharedArrayBufferCopy;
}
exports.isSharedArrayBuffer = isSharedArrayBuffer;
function isAsyncFunction(value) {
return ObjectToString(value) === '[object AsyncFunction]';
}
exports.isAsyncFunction = isAsyncFunction;
function isMapIterator(value) {
return ObjectToString(value) === '[object Map Iterator]';
}
exports.isMapIterator = isMapIterator;
function isSetIterator(value) {
return ObjectToString(value) === '[object Set Iterator]';
}
exports.isSetIterator = isSetIterator;
function isGeneratorObject(value) {
return ObjectToString(value) === '[object Generator]';
}
exports.isGeneratorObject = isGeneratorObject;
function isWebAssemblyCompiledModule(value) {
return ObjectToString(value) === '[object WebAssembly.Module]';
}
exports.isWebAssemblyCompiledModule = isWebAssemblyCompiledModule;
function isNumberObject(value) {
return checkBoxedPrimitive(value, numberValue);
}
exports.isNumberObject = isNumberObject;
function isStringObject(value) {
return checkBoxedPrimitive(value, stringValue);
}
exports.isStringObject = isStringObject;
function isBooleanObject(value) {
return checkBoxedPrimitive(value, booleanValue);
}
exports.isBooleanObject = isBooleanObject;
function isBigIntObject(value) {
return BigIntSupported && checkBoxedPrimitive(value, bigIntValue);
}
exports.isBigIntObject = isBigIntObject;
function isSymbolObject(value) {
return SymbolSupported && checkBoxedPrimitive(value, symbolValue);
}
exports.isSymbolObject = isSymbolObject;
function isBoxedPrimitive(value) {
return (
isNumberObject(value) ||
isStringObject(value) ||
isBooleanObject(value) ||
isBigIntObject(value) ||
isSymbolObject(value)
);
}
exports.isBoxedPrimitive = isBoxedPrimitive;
function isAnyArrayBuffer(value) {
return typeof Uint8Array !== 'undefined' && (
isArrayBuffer(value) ||
isSharedArrayBuffer(value)
);
}
exports.isAnyArrayBuffer = isAnyArrayBuffer;
['isProxy', 'isExternal', 'isModuleNamespaceObject'].forEach(function(method) {
Object.defineProperty(exports, method, {
enumerable: false,
value: function() {
throw new Error(method + ' is not supported in userland');
}
});
});
/***/ }),
/***/ "./node_modules/util/util.js":
/*!***********************************!*\
!*** ./node_modules/util/util.js ***!
\***********************************/
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
/* provided dependency */ var process = __webpack_require__(/*! process/browser.js */ "./node_modules/process/browser.js");
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors ||
function getOwnPropertyDescriptors(obj) {
var keys = Object.keys(obj);
var descriptors = {};
for (var i = 0; i < keys.length; i++) {
descriptors[keys[i]] = Object.getOwnPropertyDescriptor(obj, keys[i]);
}
return descriptors;
};
var formatRegExp = /%[sdj%]/g;
exports.format = function(f) {
if (!isString(f)) {
var objects = [];
for (var i = 0; i < arguments.length; i++) {
objects.push(inspect(arguments[i]));
}
return objects.join(' ');
}
var i = 1;
var args = arguments;
var len = args.length;
var str = String(f).replace(formatRegExp, function(x) {
if (x === '%%') return '%';
if (i >= len) return x;
switch (x) {
case '%s': return String(args[i++]);
case '%d': return Number(args[i++]);
case '%j':
try {
return JSON.stringify(args[i++]);
} catch (_) {
return '[Circular]';
}
default:
return x;
}
});
for (var x = args[i]; i < len; x = args[++i]) {
if (isNull(x) || !isObject(x)) {
str += ' ' + x;
} else {
str += ' ' + inspect(x);
}
}
return str;
};
// Mark that a method should not be used.
// Returns a modified function which warns once by default.
// If --no-deprecation is set, then it is a no-op.
exports.deprecate = function(fn, msg) {
if (typeof process !== 'undefined' && process.noDeprecation === true) {
return fn;
}
// Allow for deprecating things in the process of starting up.
if (typeof process === 'undefined') {
return function() {
return exports.deprecate(fn, msg).apply(this, arguments);
};
}
var warned = false;
function deprecated() {
if (!warned) {
if (process.throwDeprecation) {
throw new Error(msg);
} else if (process.traceDeprecation) {
console.trace(msg);
} else {
console.error(msg);
}
warned = true;
}
return fn.apply(this, arguments);
}
return deprecated;
};
var debugs = {};
var debugEnvRegex = /^$/;
if (process.env.NODE_DEBUG) {
var debugEnv = process.env.NODE_DEBUG;
debugEnv = debugEnv.replace(/[|\\{}()[\]^$+?.]/g, '\\$&')
.replace(/\*/g, '.*')
.replace(/,/g, '$|^')
.toUpperCase();
debugEnvRegex = new RegExp('^' + debugEnv + '$', 'i');
}
exports.debuglog = function(set) {
set = set.toUpperCase();
if (!debugs[set]) {
if (debugEnvRegex.test(set)) {
var pid = process.pid;
debugs[set] = function() {
var msg = exports.format.apply(exports, arguments);
console.error('%s %d: %s', set, pid, msg);
};
} else {
debugs[set] = function() {};
}
}
return debugs[set];
};
/**
* Echos the value of a value. Trys to print the value out
* in the best way possible given the different types.
*
* @param {Object} obj The object to print out.
* @param {Object} opts Optional options object that alters the output.
*/
/* legacy: obj, showHidden, depth, colors*/
function inspect(obj, opts) {
// default options
var ctx = {
seen: [],
stylize: stylizeNoColor
};
// legacy...
if (arguments.length >= 3) ctx.depth = arguments[2];
if (arguments.length >= 4) ctx.colors = arguments[3];
if (isBoolean(opts)) {
// legacy...
ctx.showHidden = opts;
} else if (opts) {
// got an "options" object
exports._extend(ctx, opts);
}
// set default options
if (isUndefined(ctx.showHidden)) ctx.showHidden = false;
if (isUndefined(ctx.depth)) ctx.depth = 2;
if (isUndefined(ctx.colors)) ctx.colors = false;
if (isUndefined(ctx.customInspect)) ctx.customInspect = true;
if (ctx.colors) ctx.stylize = stylizeWithColor;
return formatValue(ctx, obj, ctx.depth);
}
exports.inspect = inspect;
// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics
inspect.colors = {
'bold' : [1, 22],
'italic' : [3, 23],
'underline' : [4, 24],
'inverse' : [7, 27],
'white' : [37, 39],
'grey' : [90, 39],
'black' : [30, 39],
'blue' : [34, 39],
'cyan' : [36, 39],
'green' : [32, 39],
'magenta' : [35, 39],
'red' : [31, 39],
'yellow' : [33, 39]
};
// Don't use 'blue' not visible on cmd.exe
inspect.styles = {
'special': 'cyan',
'number': 'yellow',
'boolean': 'yellow',
'undefined': 'grey',
'null': 'bold',
'string': 'green',
'date': 'magenta',
// "name": intentionally not styling
'regexp': 'red'
};
function stylizeWithColor(str, styleType) {
var style = inspect.styles[styleType];
if (style) {
return '\u001b[' + inspect.colors[style][0] + 'm' + str +
'\u001b[' + inspect.colors[style][1] + 'm';
} else {
return str;
}
}
function stylizeNoColor(str, styleType) {
return str;
}
function arrayToHash(array) {
var hash = {};
array.forEach(function(val, idx) {
hash[val] = true;
});
return hash;
}
function formatValue(ctx, value, recurseTimes) {
// Provide a hook for user-specified inspect functions.
// Check that value is an object with an inspect function on it
if (ctx.customInspect &&
value &&
isFunction(value.inspect) &&
// Filter out the util module, it's inspect function is special
value.inspect !== exports.inspect &&
// Also filter out any prototype objects using the circular check.
!(value.constructor && value.constructor.prototype === value)) {
var ret = value.inspect(recurseTimes, ctx);
if (!isString(ret)) {
ret = formatValue(ctx, ret, recurseTimes);
}
return ret;
}
// Primitive types cannot have properties
var primitive = formatPrimitive(ctx, value);
if (primitive) {
return primitive;
}
// Look up the keys of the object.
var keys = Object.keys(value);
var visibleKeys = arrayToHash(keys);
if (ctx.showHidden) {
keys = Object.getOwnPropertyNames(value);
}
// IE doesn't make error fields non-enumerable
// http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
if (isError(value)
&& (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
return formatError(value);
}
// Some type of object without properties can be shortcutted.
if (keys.length === 0) {
if (isFunction(value)) {
var name = value.name ? ': ' + value.name : '';
return ctx.stylize('[Function' + name + ']', 'special');
}
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
}
if (isDate(value)) {
return ctx.stylize(Date.prototype.toString.call(value), 'date');
}
if (isError(value)) {
return formatError(value);
}
}
var base = '', array = false, braces = ['{', '}'];
// Make Array say that they are Array
if (isArray(value)) {
array = true;
braces = ['[', ']'];
}
// Make functions say that they are functions
if (isFunction(value)) {
var n = value.name ? ': ' + value.name : '';
base = ' [Function' + n + ']';
}
// Make RegExps say that they are RegExps
if (isRegExp(value)) {
base = ' ' + RegExp.prototype.toString.call(value);
}
// Make dates with properties first say the date
if (isDate(value)) {
base = ' ' + Date.prototype.toUTCString.call(value);
}
// Make error with message first say the error
if (isError(value)) {
base = ' ' + formatError(value);
}
if (keys.length === 0 && (!array || value.length == 0)) {
return braces[0] + base + braces[1];
}
if (recurseTimes < 0) {
if (isRegExp(value)) {
return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
} else {
return ctx.stylize('[Object]', 'special');
}
}
ctx.seen.push(value);
var output;
if (array) {
output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
} else {
output = keys.map(function(key) {
return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
});
}
ctx.seen.pop();
return reduceToSingleString(output, base, braces);
}
function formatPrimitive(ctx, value) {
if (isUndefined(value))
return ctx.stylize('undefined', 'undefined');
if (isString(value)) {
var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
.replace(/'/g, "\\'")
.replace(/\\"/g, '"') + '\'';
return ctx.stylize(simple, 'string');
}
if (isNumber(value))
return ctx.stylize('' + value, 'number');
if (isBoolean(value))
return ctx.stylize('' + value, 'boolean');
// For some reason typeof null is "object", so special case here.
if (isNull(value))
return ctx.stylize('null', 'null');
}
function formatError(value) {
return '[' + Error.prototype.toString.call(value) + ']';
}
function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
var output = [];
for (var i = 0, l = value.length; i < l; ++i) {
if (hasOwnProperty(value, String(i))) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
String(i), true));
} else {
output.push('');
}
}
keys.forEach(function(key) {
if (!key.match(/^\d+$/)) {
output.push(formatProperty(ctx, value, recurseTimes, visibleKeys,
key, true));
}
});
return output;
}
function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
var name, str, desc;
desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] };
if (desc.get) {
if (desc.set) {
str = ctx.stylize('[Getter/Setter]', 'special');
} else {
str = ctx.stylize('[Getter]', 'special');
}
} else {
if (desc.set) {
str = ctx.stylize('[Setter]', 'special');
}
}
if (!hasOwnProperty(visibleKeys, key)) {
name = '[' + key + ']';
}
if (!str) {
if (ctx.seen.indexOf(desc.value) < 0) {
if (isNull(recurseTimes)) {
str = formatValue(ctx, desc.value, null);
} else {
str = formatValue(ctx, desc.value, recurseTimes - 1);
}
if (str.indexOf('\n') > -1) {
if (array) {
str = str.split('\n').map(function(line) {
return ' ' + line;
}).join('\n').slice(2);
} else {
str = '\n' + str.split('\n').map(function(line) {
return ' ' + line;
}).join('\n');
}
}
} else {
str = ctx.stylize('[Circular]', 'special');
}
}
if (isUndefined(name)) {
if (array && key.match(/^\d+$/)) {
return str;
}
name = JSON.stringify('' + key);
if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
name = name.slice(1, -1);
name = ctx.stylize(name, 'name');
} else {
name = name.replace(/'/g, "\\'")
.replace(/\\"/g, '"')
.replace(/(^"|"$)/g, "'");
name = ctx.stylize(name, 'string');
}
}
return name + ': ' + str;
}
function reduceToSingleString(output, base, braces) {
var numLinesEst = 0;
var length = output.reduce(function(prev, cur) {
numLinesEst++;
if (cur.indexOf('\n') >= 0) numLinesEst++;
return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
}, 0);
if (length > 60) {
return braces[0] +
(base === '' ? '' : base + '\n ') +
' ' +
output.join(',\n ') +
' ' +
braces[1];
}
return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
}
// NOTE: These type checking functions intentionally don't use `instanceof`
// because it is fragile and can be easily faked with `Object.create()`.
exports.types = __webpack_require__(/*! ./support/types */ "./node_modules/util/support/types.js");
function isArray(ar) {
return Array.isArray(ar);
}
exports.isArray = isArray;
function isBoolean(arg) {
return typeof arg === 'boolean';
}
exports.isBoolean = isBoolean;
function isNull(arg) {
return arg === null;
}
exports.isNull = isNull;
function isNullOrUndefined(arg) {
return arg == null;
}
exports.isNullOrUndefined = isNullOrUndefined;
function isNumber(arg) {
return typeof arg === 'number';
}
exports.isNumber = isNumber;
function isString(arg) {
return typeof arg === 'string';
}
exports.isString = isString;
function isSymbol(arg) {
return typeof arg === 'symbol';
}
exports.isSymbol = isSymbol;
function isUndefined(arg) {
return arg === void 0;
}
exports.isUndefined = isUndefined;
function isRegExp(re) {
return isObject(re) && objectToString(re) === '[object RegExp]';
}
exports.isRegExp = isRegExp;
exports.types.isRegExp = isRegExp;
function isObject(arg) {
return typeof arg === 'object' && arg !== null;
}
exports.isObject = isObject;
function isDate(d) {
return isObject(d) && objectToString(d) === '[object Date]';
}
exports.isDate = isDate;
exports.types.isDate = isDate;
function isError(e) {
return isObject(e) &&
(objectToString(e) === '[object Error]' || e instanceof Error);
}
exports.isError = isError;
exports.types.isNativeError = isError;
function isFunction(arg) {
return typeof arg === 'function';
}
exports.isFunction = isFunction;
function isPrimitive(arg) {
return arg === null ||
typeof arg === 'boolean' ||
typeof arg === 'number' ||
typeof arg === 'string' ||
typeof arg === 'symbol' || // ES6 symbol
typeof arg === 'undefined';
}
exports.isPrimitive = isPrimitive;
exports.isBuffer = __webpack_require__(/*! ./support/isBuffer */ "./node_modules/util/support/isBufferBrowser.js");
function objectToString(o) {
return Object.prototype.toString.call(o);
}
function pad(n) {
return n < 10 ? '0' + n.toString(10) : n.toString(10);
}
var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
'Oct', 'Nov', 'Dec'];
// 26 Feb 16:19:34
function timestamp() {
var d = new Date();
var time = [pad(d.getHours()),
pad(d.getMinutes()),
pad(d.getSeconds())].join(':');
return [d.getDate(), months[d.getMonth()], time].join(' ');
}
// log is just a thin wrapper to console.log that prepends a timestamp
exports.log = function() {
console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments));
};
/**
* Inherit the prototype methods from one constructor into another.
*
* The Function.prototype.inherits from lang.js rewritten as a standalone
* function (not on Function.prototype). NOTE: If this file is to be loaded
* during bootstrapping this function needs to be rewritten using some native
* functions as prototype setup using normal JavaScript does not work as
* expected during bootstrapping (see mirror.js in r114903).
*
* @param {function} ctor Constructor function which needs to inherit the
* prototype.
* @param {function} superCtor Constructor function to inherit prototype from.
*/
exports.inherits = __webpack_require__(/*! inherits */ "./node_modules/inherits/inherits_browser.js");
exports._extend = function(origin, add) {
// Don't do anything if add isn't an object
if (!add || !isObject(add)) return origin;
var keys = Object.keys(add);
var i = keys.length;
while (i--) {
origin[keys[i]] = add[keys[i]];
}
return origin;
};
function hasOwnProperty(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
}
var kCustomPromisifiedSymbol = typeof Symbol !== 'undefined' ? Symbol('util.promisify.custom') : undefined;
exports.promisify = function promisify(original) {
if (typeof original !== 'function')
throw new TypeError('The "original" argument must be of type Function');
if (kCustomPromisifiedSymbol && original[kCustomPromisifiedSymbol]) {
var fn = original[kCustomPromisifiedSymbol];
if (typeof fn !== 'function') {
throw new TypeError('The "util.promisify.custom" argument must be of type Function');
}
Object.defineProperty(fn, kCustomPromisifiedSymbol, {
value: fn, enumerable: false, writable: false, configurable: true
});
return fn;
}
function fn() {
var promiseResolve, promiseReject;
var promise = new Promise(function (resolve, reject) {
promiseResolve = resolve;
promiseReject = reject;
});
var args = [];
for (var i = 0; i < arguments.length; i++) {
args.push(arguments[i]);
}
args.push(function (err, value) {
if (err) {
promiseReject(err);
} else {
promiseResolve(value);
}
});
try {
original.apply(this, args);
} catch (err) {
promiseReject(err);
}
return promise;
}
Object.setPrototypeOf(fn, Object.getPrototypeOf(original));
if (kCustomPromisifiedSymbol) Object.defineProperty(fn, kCustomPromisifiedSymbol, {
value: fn, enumerable: false, writable: false, configurable: true
});
return Object.defineProperties(
fn,
getOwnPropertyDescriptors(original)
);
}
exports.promisify.custom = kCustomPromisifiedSymbol
function callbackifyOnRejected(reason, cb) {
// `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).
// Because `null` is a special error value in callbacks which means "no error
// occurred", we error-wrap so the callback consumer can distinguish between
// "the promise rejected with null" or "the promise fulfilled with undefined".
if (!reason) {
var newReason = new Error('Promise was rejected with a falsy value');
newReason.reason = reason;
reason = newReason;
}
return cb(reason);
}
function callbackify(original) {
if (typeof original !== 'function') {
throw new TypeError('The "original" argument must be of type Function');
}
// We DO NOT return the promise as it gives the user a false sense that
// the promise is actually somehow related to the callback's execution
// and that the callback throwing will reject the promise.
function callbackified() {
var args = [];
for (var i = 0; i < arguments.length; i++) {
args.push(arguments[i]);
}
var maybeCb = args.pop();
if (typeof maybeCb !== 'function') {
throw new TypeError('The last argument must be of type Function');
}
var self = this;
var cb = function() {
return maybeCb.apply(self, arguments);
};
// In true node style we process the callback on `nextTick` with all the
// implications (stack, `uncaughtException`, `async_hooks`)
original.apply(this, args)
.then(function(ret) { process.nextTick(cb.bind(null, null, ret)) },
function(rej) { process.nextTick(callbackifyOnRejected.bind(null, rej, cb)) });
}
Object.setPrototypeOf(callbackified, Object.getPrototypeOf(original));
Object.defineProperties(callbackified,
getOwnPropertyDescriptors(original));
return callbackified;
}
exports.callbackify = callbackify;
/***/ }),
/***/ "./node_modules/which-typed-array/index.js":
/*!*************************************************!*\
!*** ./node_modules/which-typed-array/index.js ***!
\*************************************************/
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
var forEach = __webpack_require__(/*! for-each */ "./node_modules/for-each/index.js");
var availableTypedArrays = __webpack_require__(/*! available-typed-arrays */ "./node_modules/available-typed-arrays/index.js");
var callBind = __webpack_require__(/*! call-bind */ "./node_modules/call-bind/index.js");
var callBound = __webpack_require__(/*! call-bound */ "./node_modules/call-bound/index.js");
var gOPD = __webpack_require__(/*! gopd */ "./node_modules/gopd/index.js");
var getProto = __webpack_require__(/*! get-proto */ "./node_modules/get-proto/index.js");
var $toString = callBound('Object.prototype.toString');
var hasToStringTag = __webpack_require__(/*! has-tostringtag/shams */ "./node_modules/has-tostringtag/shams.js")();
var g = typeof globalThis === 'undefined' ? __webpack_require__.g : globalThis;
var typedArrays = availableTypedArrays();
var $slice = callBound('String.prototype.slice');
/** @type {<T = unknown>(array: readonly T[], value: unknown) => number} */
var $indexOf = callBound('Array.prototype.indexOf', true) || function indexOf(array, value) {
for (var i = 0; i < array.length; i += 1) {
if (array[i] === value) {
return i;
}
}
return -1;
};
/** @typedef {import('./types').Getter} Getter */
/** @type {import('./types').Cache} */
var cache = { __proto__: null };
if (hasToStringTag && gOPD && getProto) {
forEach(typedArrays, function (typedArray) {
var arr = new g[typedArray]();
if (Symbol.toStringTag in arr && getProto) {
var proto = getProto(arr);
// @ts-expect-error TS won't narrow inside a closure
var descriptor = gOPD(proto, Symbol.toStringTag);
if (!descriptor && proto) {
var superProto = getProto(proto);
// @ts-expect-error TS won't narrow inside a closure
descriptor = gOPD(superProto, Symbol.toStringTag);
}
// @ts-expect-error TODO: fix
cache['$' + typedArray] = callBind(descriptor.get);
}
});
} else {
forEach(typedArrays, function (typedArray) {
var arr = new g[typedArray]();
var fn = arr.slice || arr.set;
if (fn) {
cache[
/** @type {`$${import('.').TypedArrayName}`} */ ('$' + typedArray)
] = /** @type {import('./types').BoundSlice | import('./types').BoundSet} */ (
// @ts-expect-error TODO FIXME
callBind(fn)
);
}
});
}
/** @type {(value: object) => false | import('.').TypedArrayName} */
var tryTypedArrays = function tryAllTypedArrays(value) {
/** @type {ReturnType<typeof tryAllTypedArrays>} */ var found = false;
forEach(
/** @type {Record<`\$${import('.').TypedArrayName}`, Getter>} */ (cache),
/** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */
function (getter, typedArray) {
if (!found) {
try {
// @ts-expect-error a throw is fine here
if ('$' + getter(value) === typedArray) {
found = /** @type {import('.').TypedArrayName} */ ($slice(typedArray, 1));
}
} catch (e) { /**/ }
}
}
);
return found;
};
/** @type {(value: object) => false | import('.').TypedArrayName} */
var trySlices = function tryAllSlices(value) {
/** @type {ReturnType<typeof tryAllSlices>} */ var found = false;
forEach(
/** @type {Record<`\$${import('.').TypedArrayName}`, Getter>} */(cache),
/** @type {(getter: Getter, name: `\$${import('.').TypedArrayName}`) => void} */ function (getter, name) {
if (!found) {
try {
// @ts-expect-error a throw is fine here
getter(value);
found = /** @type {import('.').TypedArrayName} */ ($slice(name, 1));
} catch (e) { /**/ }
}
}
);
return found;
};
/** @type {import('.')} */
module.exports = function whichTypedArray(value) {
if (!value || typeof value !== 'object') { return false; }
if (!hasToStringTag) {
/** @type {string} */
var tag = $slice($toString(value), 8, -1);
if ($indexOf(typedArrays, tag) > -1) {
return tag;
}
if (tag !== 'Object') {
return false;
}
// node < 0.6 hits here on real Typed Arrays
return trySlices(value);
}
if (!gOPD) { return null; } // unknown engine
return tryTypedArrays(value);
};
/***/ }),
/***/ "?5042":
/*!********************!*\
!*** fs (ignored) ***!
\********************/
/***/ (() => {
/* (ignored) */
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ id: moduleId,
/******/ loaded: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/global */
/******/ (() => {
/******/ __webpack_require__.g = (function() {
/******/ if (typeof globalThis === 'object') return globalThis;
/******/ try {
/******/ return this || new Function('return this')();
/******/ } catch (e) {
/******/ if (typeof window === 'object') return window;
/******/ }
/******/ })();
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
/******/ (() => {
/******/ // define __esModule on exports
/******/ __webpack_require__.r = (exports) => {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/node module decorator */
/******/ (() => {
/******/ __webpack_require__.nmd = (module) => {
/******/ module.paths = [];
/******/ if (!module.children) module.children = [];
/******/ return module;
/******/ };
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
(() => {
"use strict";
/*!***********************!*\
!*** ./src/lebab.mjs ***!
\***********************/
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ runTest: () => (/* binding */ runTest)
/* harmony export */ });
/* harmony import */ var lebab__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! lebab */ "./node_modules/lebab/index.js");
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
const payloads = [
{
name: "preact-8.2.5.js",
options: [
"arg-rest",
"arg-spread",
"arrow",
"class",
"for-of",
"let",
"template",
"includes",
"obj-method",
"obj-shorthand",
],
},
];
function runTest(fileData) {
const testData = payloads.map(({ name, options }) => ({
payload: fileData[name],
options,
}));
return testData.map(({ payload, options }) =>
lebab__WEBPACK_IMPORTED_MODULE_0__.transform(payload, options)
);
}
})();
self.WTBenchmark = __webpack_exports__;
/******/ })()
;