From 0469abd4a9c9270a1fdc962969e36e63699af8b4 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Sun, 10 Dec 2017 21:51:33 +0100 Subject: upgrade dependencies --- node_modules/acorn/.npmignore | 11 --- node_modules/acorn/AUTHORS | 1 + node_modules/acorn/CHANGELOG.md | 32 +++++++ node_modules/acorn/README.md | 4 +- node_modules/acorn/bin/acorn | 2 +- node_modules/acorn/dist/acorn.es.js | 152 +++++++++++++++++++----------- node_modules/acorn/dist/acorn.js | 152 +++++++++++++++++++----------- node_modules/acorn/dist/acorn_loose.es.js | 16 +++- node_modules/acorn/dist/acorn_loose.js | 16 +++- node_modules/acorn/dist/walk.es.js | 4 +- node_modules/acorn/dist/walk.js | 4 +- node_modules/acorn/package.json | 2 +- 12 files changed, 253 insertions(+), 143 deletions(-) delete mode 100644 node_modules/acorn/.npmignore (limited to 'node_modules/acorn') diff --git a/node_modules/acorn/.npmignore b/node_modules/acorn/.npmignore deleted file mode 100644 index 243d17d19..000000000 --- a/node_modules/acorn/.npmignore +++ /dev/null @@ -1,11 +0,0 @@ -/.tern-port -/test -/local -/rollup -/bin/generate-identifier-regex.js -/bin/update_authors.sh -.editorconfig -.gitattributes -.tern-project -.travis.yml -/src diff --git a/node_modules/acorn/AUTHORS b/node_modules/acorn/AUTHORS index 7b9f6a14b..78437f610 100644 --- a/node_modules/acorn/AUTHORS +++ b/node_modules/acorn/AUTHORS @@ -59,6 +59,7 @@ r-e-d Richard Gibson Rich Harris Sebastian McKenzie +Shahar Soel Simen Bekkhus Teddy Katz Timothy Gu diff --git a/node_modules/acorn/CHANGELOG.md b/node_modules/acorn/CHANGELOG.md index 34d1ac780..3003a04a9 100644 --- a/node_modules/acorn/CHANGELOG.md +++ b/node_modules/acorn/CHANGELOG.md @@ -1,3 +1,35 @@ +## 5.2.1 (2017-10-30) + +### Bug fixes + +Fix a token context corruption bug. + +## 5.2.0 (2017-10-30) + +### Bug fixes + +Fix token context tracking for `class` and `function` in property-name position. + +Make sure `%*` isn't parsed as a valid operator. + +The `full` and `fullAncestor` walkers no longer visit nodes multiple times. + +Allow shorthand properties `get` and `set` to be followed by default values. + +Disallow `super` when not in callee or object position. + +### New features + +Support [`directive` property](https://github.com/estree/estree/compare/b3de58c9997504d6fba04b72f76e6dd1619ee4eb...1da8e603237144f44710360f8feb7a9977e905e0) on directive expression statements. + +## 5.1.2 (2017-09-04) + +### Bug fixes + +Disable parsing of legacy HTML-style comments in modules. + +Fix parsing of async methods whose names are keywords. + ## 5.1.1 (2017-07-06) ### Bug fixes diff --git a/node_modules/acorn/README.md b/node_modules/acorn/README.md index bd853c43b..ab2c12ea5 100644 --- a/node_modules/acorn/README.md +++ b/node_modules/acorn/README.md @@ -351,8 +351,8 @@ The `bin/acorn` utility can be used to parse a file from the command line. It accepts as arguments its input file and the following options: -- `--ecma3|--ecma5|--ecma6|--ecma7`: Sets the ECMAScript version to parse. Default is - version 5. +- `--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9`: Sets the ECMAScript version + to parse. Default is version 7. - `--module`: Sets the parsing mode to `"module"`. Is set to `"script"` otherwise. diff --git a/node_modules/acorn/bin/acorn b/node_modules/acorn/bin/acorn index 257195780..830c38964 100755 --- a/node_modules/acorn/bin/acorn +++ b/node_modules/acorn/bin/acorn @@ -14,7 +14,7 @@ var options = {}; function help(status) { var print = (status == 0) ? console.log : console.error; - print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7|...|--ecma2015|--ecma2016|...]"); + print("usage: " + path.basename(process.argv[1]) + " [--ecma3|--ecma5|--ecma6|--ecma7|--ecma8|--ecma9|...|--ecma2015|--ecma2016|--ecma2017|--ecma2018|...]"); print(" [--tokenize] [--locations] [---allow-hash-bang] [--compact] [--silent] [--module] [--help] [--] [infile]"); process.exit(status); } diff --git a/node_modules/acorn/dist/acorn.es.js b/node_modules/acorn/dist/acorn.es.js index 5b5977671..d7289102c 100644 --- a/node_modules/acorn/dist/acorn.es.js +++ b/node_modules/acorn/dist/acorn.es.js @@ -183,15 +183,15 @@ var types = { 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("prefix", {beforeExpr: true, prefix: 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), + 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), @@ -541,7 +541,7 @@ var pp = Parser.prototype; // ## Parser utilities -var literal = /^(?:'((?:[^']|\.)*)'|"((?:[^"]|\.)*)"|;)/; +var literal = /^(?:'((?:\\.|[^'])*?)'|"((?:\\.|[^"])*?)"|;)/; pp.strictDirective = function(start) { var this$1 = this; @@ -684,6 +684,7 @@ pp$1.parseTopLevel = function(node) { var stmt = this$1.parseStatement(true, true, exports); node.body.push(stmt); } + this.adaptDirectivePrologue(node.body); this.next(); if (this.options.ecmaVersion >= 6) { node.sourceType = this.options.sourceType; @@ -1464,6 +1465,22 @@ pp$1.parseImportSpecifiers = function() { return nodes }; +// Set `ExpressionStatement#directive` property for directive prologues. +pp$1.adaptDirectivePrologue = function(statements) { + for (var i = 0; i < statements.length && this.isDirectiveCandidate(statements[i]); ++i) { + statements[i].directive = statements[i].expression.raw.slice(1, -1); + } +}; +pp$1.isDirectiveCandidate = function(statement) { + return ( + statement.type === "ExpressionStatement" && + statement.expression.type === "Literal" && + typeof statement.expression.value === "string" && + // Reject parenthesized strings. + (this.input[statement.start] === "\"" || this.input[statement.start] === "'") + ) +}; + var pp$2 = Parser.prototype; // Convert existing expression atom to assignable pattern @@ -1578,23 +1595,19 @@ pp$2.parseRestBinding = function() { // Parses lvalue (assignable) atom. pp$2.parseBindingAtom = function() { - if (this.options.ecmaVersion < 6) { return this.parseIdent() } - switch (this.type) { - case types.name: - return this.parseIdent() - - case types.bracketL: - var node = this.startNode(); - this.next(); - node.elements = this.parseBindingList(types.bracketR, true, true); - return this.finishNode(node, "ArrayPattern") - - case types.braceL: - return this.parseObj(true) + if (this.options.ecmaVersion >= 6) { + switch (this.type) { + case types.bracketL: + var node = this.startNode(); + this.next(); + node.elements = this.parseBindingList(types.bracketR, true, true); + return this.finishNode(node, "ArrayPattern") - default: - this.unexpected(); + case types.braceL: + return this.parseObj(true) + } } + return this.parseIdent() }; pp$2.parseBindingList = function(close, allowEmpty, allowTrailingComma) { @@ -1907,7 +1920,7 @@ pp$3.parseMaybeUnary = function(refDestructuringErrors, sawUnary) { var startPos = this.start, startLoc = this.startLoc, expr; if (this.inAsync && this.isContextual("await")) { - expr = this.parseAwait(refDestructuringErrors); + expr = this.parseAwait(); sawUnary = true; } else if (this.type.prefix) { var node = this.startNode(), update = this.type === types.incDec; @@ -2011,12 +2024,22 @@ pp$3.parseExprAtom = function(refDestructuringErrors) { case types._super: if (!this.inFunction) { this.raise(this.start, "'super' outside of function or class"); } + node = this.startNode(); + this.next(); + // The `super` keyword can appear at below: + // SuperProperty: + // super [ Expression ] + // super . IdentifierName + // SuperCall: + // super Arguments + if (this.type !== types.dot && this.type !== types.bracketL && this.type !== types.parenL) + { this.unexpected(); } + return this.finishNode(node, "Super") case types._this: - var type = this.type === types._this ? "ThisExpression" : "Super"; node = this.startNode(); this.next(); - return this.finishNode(node, type) + return this.finishNode(node, "ThisExpression") case types.name: var startPos = this.start, startLoc = this.startLoc; @@ -2251,14 +2274,14 @@ pp$3.parseTemplate = function(ref) { return this.finishNode(node, "TemplateLiteral") }; -// Parse an object literal or binding pattern. - pp$3.isAsyncProp = function(prop) { return !prop.computed && prop.key.type === "Identifier" && prop.key.name === "async" && - (this.type === types.name || this.type === types.num || this.type === types.string || this.type === types.bracketL) && + (this.type === types.name || this.type === types.num || this.type === types.string || this.type === types.bracketL || this.type.keyword) && !lineBreak.test(this.input.slice(this.lastTokEnd, this.start)) }; +// Parse an object literal or binding pattern. + pp$3.parseObj = function(isPattern, refDestructuringErrors) { var this$1 = this; @@ -2271,31 +2294,36 @@ pp$3.parseObj = function(isPattern, refDestructuringErrors) { if (this$1.afterTrailingComma(types.braceR)) { break } } else { first = false; } - var prop = this$1.startNode(), isGenerator = (void 0), isAsync = (void 0), startPos = (void 0), startLoc = (void 0); - if (this$1.options.ecmaVersion >= 6) { - prop.method = false; - prop.shorthand = false; - if (isPattern || refDestructuringErrors) { - startPos = this$1.start; - startLoc = this$1.startLoc; - } - if (!isPattern) - { isGenerator = this$1.eat(types.star); } - } - this$1.parsePropertyName(prop); - if (!isPattern && this$1.options.ecmaVersion >= 8 && !isGenerator && this$1.isAsyncProp(prop)) { - isAsync = true; - this$1.parsePropertyName(prop, refDestructuringErrors); - } else { - isAsync = false; - } - this$1.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors); + var prop = this$1.parseProperty(isPattern, refDestructuringErrors); this$1.checkPropClash(prop, propHash); - node.properties.push(this$1.finishNode(prop, "Property")); + node.properties.push(prop); } return this.finishNode(node, isPattern ? "ObjectPattern" : "ObjectExpression") }; +pp$3.parseProperty = function(isPattern, refDestructuringErrors) { + var prop = this.startNode(), isGenerator, isAsync, startPos, startLoc; + 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.star); } + } + this.parsePropertyName(prop); + if (!isPattern && this.options.ecmaVersion >= 8 && !isGenerator && this.isAsyncProp(prop)) { + isAsync = true; + this.parsePropertyName(prop, refDestructuringErrors); + } else { + isAsync = false; + } + this.parsePropertyValue(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors); + return this.finishNode(prop, "Property") +}; + pp$3.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startPos, startLoc, refDestructuringErrors) { if ((isGenerator || isAsync) && this.type === types.colon) { this.unexpected(); } @@ -2308,10 +2336,11 @@ pp$3.parsePropertyValue = function(prop, isPattern, isGenerator, isAsync, startP prop.kind = "init"; prop.method = true; prop.value = this.parseMethod(isGenerator, isAsync); - } else if (this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && + } else if (!isPattern && + this.options.ecmaVersion >= 5 && !prop.computed && prop.key.type === "Identifier" && (prop.key.name === "get" || prop.key.name === "set") && (this.type != types.comma && this.type != types.braceR)) { - if (isGenerator || isAsync || isPattern) { this.unexpected(); } + if (isGenerator || isAsync) { this.unexpected(); } prop.kind = prop.key.name; this.parsePropertyName(prop); prop.value = this.parseMethod(false); @@ -2459,6 +2488,7 @@ pp$3.parseFunctionBody = function(node, isArrowFunction) { this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && this.isSimpleParamList(node.params)); node.body = this.parseBlock(false); node.expression = false; + this.adaptDirectivePrologue(node.body.body); this.labels = oldLabels; } this.exitFunctionScope(); @@ -2526,10 +2556,6 @@ pp$3.parseExprList = function(close, allowTrailingComma, allowEmpty, refDestruct return elts }; -// Parse the next token as an identifier. If `liberal` is true (used -// when parsing properties), it will also convert keywords into -// identifiers. - pp$3.checkUnreserved = function(ref) { var start = ref.start; var end = ref.end; @@ -2548,6 +2574,10 @@ pp$3.checkUnreserved = function(ref) { { 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$3.parseIdent = function(liberal, isBinding) { var node = this.startNode(); if (liberal && this.options.allowReserved == "never") { liberal = false; } @@ -2555,6 +2585,15 @@ pp$3.parseIdent = function(liberal, isBinding) { node.name = this.value; } else if (this.type.keyword) { node.name = this.type.keyword; + + // To fix https://github.com/ternjs/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(); + } } else { this.unexpected(); } @@ -3105,7 +3144,7 @@ pp$8.readToken_mult_modulo_exp = function(code) { // '%*' var tokentype = code === 42 ? types.star : types.modulo; // exponentiation operator ** and **= - if (this.options.ecmaVersion >= 7 && next === 42) { + if (this.options.ecmaVersion >= 7 && code == 42 && next === 42) { ++size; tokentype = types.starstar; next = this.input.charCodeAt(this.pos + 2); @@ -3131,7 +3170,7 @@ pp$8.readToken_caret = function() { // '^' pp$8.readToken_plus_min = function(code) { // '+-' var next = this.input.charCodeAt(this.pos + 1); if (next === code) { - if (next == 45 && this.input.charCodeAt(this.pos + 2) == 62 && + 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); @@ -3152,9 +3191,8 @@ pp$8.readToken_lt_gt = function(code) { // '<>' if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types.assign, size + 1) } return this.finishOp(types.bitShift, size) } - if (next == 33 && code == 60 && this.input.charCodeAt(this.pos + 2) == 45 && + if (next == 33 && code == 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) == 45 && this.input.charCodeAt(this.pos + 3) == 45) { - if (this.inModule) { this.unexpected(); } // `` line comment this.skipLineComment(3); @@ -3158,9 +3197,8 @@ pp$8.readToken_lt_gt = function(code) { // '<>' if (this.input.charCodeAt(this.pos + size) === 61) { return this.finishOp(types.assign, size + 1) } return this.finishOp(types.bitShift, size) } - if (next == 33 && code == 60 && this.input.charCodeAt(this.pos + 2) == 45 && + if (next == 33 && code == 60 && !this.inModule && this.input.charCodeAt(this.pos + 2) == 45 && this.input.charCodeAt(this.pos + 3) == 45) { - if (this.inModule) { this.unexpected(); } // `