diff --git a/.circleci/config.yml b/.circleci/config.yml index 5d6df0a9428e..edf8c3c68d42 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -48,6 +48,11 @@ executors: docker: - image: circleci/node:13 working_directory: ~/babel + # e2e-vue-cli test requires chromium + node-browsers-executor: + docker: + - image: circleci/node:13-browsers + working_directory: ~/babel jobs: build-standalone: @@ -153,6 +158,14 @@ jobs: at: /tmp/verdaccio-workspace - run: ./scripts/integration-tests/e2e-create-react-app.sh + e2e-vue-cli: + executor: node-browsers-executor + steps: + - checkout + - attach_workspace: + at: /tmp/verdaccio-workspace + - run: ./scripts/integration-tests/e2e-vue-cli.sh + workflows: version: 2 build-standalone: @@ -189,3 +202,7 @@ workflows: - e2e-create-react-app: requires: - publish-verdaccio + - e2e-vue-cli: + requires: + - publish-verdaccio + diff --git a/Makefile b/Makefile index acd9ed6df669..f7806f3af7b8 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ FLOW_COMMIT = 09669846b7a7ca5a6c23c12d56bb3bebdafd67e9 -TEST262_COMMIT = 8688c4ab79059c3097098605e69f1ee5eda6c409 +TEST262_COMMIT = 157b18d16b5d52501c4d75ac422d3a80bfad1c17 TYPESCRIPT_COMMIT = 038d95144d8b93c2799d1732181c89c3d84362d5 FORCE_PUBLISH = "@babel/runtime,@babel/runtime-corejs2,@babel/runtime-corejs3,@babel/standalone,@babel/preset-env-standalone" @@ -189,7 +189,7 @@ test-typescript-update-whitelist: bootstrap-test262: rm -rf build/test262 mkdir -p build - git clone --branch=master --single-branch --shallow-since=2019-09-01 https://github.com/tc39/test262.git build/test262 + git clone --branch=master --single-branch --shallow-since=2019-12-01 https://github.com/tc39/test262.git build/test262 cd build/test262 && git checkout $(TEST262_COMMIT) test-test262: diff --git a/eslint/babel-eslint-parser/package.json b/eslint/babel-eslint-parser/package.json index 0205facb646d..b64d7a051af3 100644 --- a/eslint/babel-eslint-parser/package.json +++ b/eslint/babel-eslint-parser/package.json @@ -34,6 +34,7 @@ "@babel/plugin-proposal-nullish-coalescing-operator": "^7.0.0", "@babel/plugin-proposal-optional-chaining": "^7.0.0", "@babel/plugin-proposal-pipeline-operator": "^7.0.0", + "@babel/plugin-proposal-private-methods": "^7.7.4", "@babel/plugin-syntax-bigint": "^7.7.4", "@babel/plugin-syntax-dynamic-import": "^7.0.0", "@babel/plugin-syntax-export-default-from": "^7.0.0", diff --git a/eslint/babel-eslint-parser/src/analyze-scope.js b/eslint/babel-eslint-parser/src/analyze-scope.js index 24a1b5491c12..ffb9eb95ba82 100644 --- a/eslint/babel-eslint-parser/src/analyze-scope.js +++ b/eslint/babel-eslint-parser/src/analyze-scope.js @@ -16,16 +16,16 @@ const flowFlippedAliasKeys = t.FLIPPED_ALIAS_KEYS.Flow.concat([ "ObjectPattern", "RestElement", ]); -const visitorKeysMap = Object.entries(t.VISITOR_KEYS).reduce(function( - acc, - [key, value], -) { - if (flowFlippedAliasKeys.indexOf(value) === -1) { - acc[key] = value; - } - return acc; -}, -{}); + +const visitorKeysMap = Object.entries(t.VISITOR_KEYS).reduce( + (acc, [key, value]) => { + if (!flowFlippedAliasKeys.includes(value)) { + acc[key] = value; + } + return acc; + }, + {}, +); const propertyTypes = { // loops @@ -166,6 +166,11 @@ class Referencer extends OriginalReferencer { this._visitClassProperty(node); } + // TODO: Update to visit type annotations when TypeScript/Flow support this syntax. + ClassPrivateMethod(node) { + super.MethodDefinition(node); + } + DeclareModule(node) { this._visitDeclareX(node); } diff --git a/eslint/babel-eslint-parser/test/babel-eslint-parser.js b/eslint/babel-eslint-parser/test/babel-eslint-parser.js index fb75112dc966..3924875d38d5 100644 --- a/eslint/babel-eslint-parser/test/babel-eslint-parser.js +++ b/eslint/babel-eslint-parser/test/babel-eslint-parser.js @@ -270,7 +270,7 @@ describe("babylon-to-espree", () => { assert.strictEqual(babylonAST.tokens[1].type, "Punctuator"); }); - // Espree doesn't support the private fields yet + // Espree doesn't support private fields yet it("hash (token)", () => { const code = "class A { #x }"; const babylonAST = parseForESLint(code, { diff --git a/eslint/babel-eslint-parser/test/fixtures/config/babel.config.js b/eslint/babel-eslint-parser/test/fixtures/config/babel.config.js index 56a2f07d9707..b84b8d0b3cca 100644 --- a/eslint/babel-eslint-parser/test/fixtures/config/babel.config.js +++ b/eslint/babel-eslint-parser/test/fixtures/config/babel.config.js @@ -18,5 +18,6 @@ module.exports = { ["@babel/plugin-proposal-decorators", { decoratorsBeforeExport: false }], ["@babel/plugin-proposal-pipeline-operator", { proposal: "minimal" }], "@babel/plugin-syntax-bigint", + "@babel/plugin-proposal-private-methods", ], }; diff --git a/eslint/babel-eslint-parser/test/non-regression.js b/eslint/babel-eslint-parser/test/non-regression.js index dca0b489d9ec..418c651d1640 100644 --- a/eslint/babel-eslint-parser/test/non-regression.js +++ b/eslint/babel-eslint-parser/test/non-regression.js @@ -1763,27 +1763,77 @@ describe("verify", () => { ); }); - describe("private class properties", () => { - it("should not be undefined", () => { - verifyAndAssertMessages( - ` - class C { - #d = 1; - } - `, - { "no-undef": 1 }, - ); + describe("class field declarations", () => { + describe("field declarations", () => { + it("should not be undefined", () => { + verifyAndAssertMessages( + ` + class C { + d = 1; + } + `, + { "no-undef": 1 }, + ); + }); + + it("should not be unused", () => { + verifyAndAssertMessages( + ` + export class C { + d = 1; + } + `, + { "no-unused-vars": 1 }, + ); + }); }); - it("should not be unused", () => { - verifyAndAssertMessages( - ` - export class C { - #d = 1; - } - `, - { "no-unused-vars": 1 }, - ); + describe("private field declarations", () => { + it("should not be undefined", () => { + verifyAndAssertMessages( + ` + class C { + #d = 1; + } + `, + { "no-undef": 1 }, + ); + }); + + it("should not be unused", () => { + verifyAndAssertMessages( + ` + export class C { + #d = 1; + } + `, + { "no-unused-vars": 1 }, + ); + }); + }); + + describe("private methods", () => { + it("should not be undefined", () => { + verifyAndAssertMessages( + ` + class C { + #d() {}; + } + `, + { "no-undef": 1 }, + ); + }); + + it("should not be unused", () => { + verifyAndAssertMessages( + ` + export class C { + #d() {}; + } + `, + { "no-unused-vars": 1 }, + ); + }); }); }); @@ -1853,6 +1903,22 @@ describe("verify", () => { ); }); + it("works with classPrivateMethods", () => { + verifyAndAssertMessages( + ` + class A { #a(b, c) {} } + `, + ); + }); + + it("works with arrow function classPrivateProperties", () => { + verifyAndAssertMessages( + ` + class A { #a = (a, b) => {}; } + `, + ); + }); + it("works with optionalCatchBinding", () => { verifyAndAssertMessages( ` diff --git a/packages/babel-helper-module-transforms/src/rewrite-live-references.js b/packages/babel-helper-module-transforms/src/rewrite-live-references.js index f665926decb2..95f1daadd158 100644 --- a/packages/babel-helper-module-transforms/src/rewrite-live-references.js +++ b/packages/babel-helper-module-transforms/src/rewrite-live-references.js @@ -182,7 +182,9 @@ const rewriteReferencesVisitor = { ref.loc = path.node.loc; if ( - path.parentPath.isCallExpression({ callee: path.node }) && + (path.parentPath.isCallExpression({ callee: path.node }) || + path.parentPath.isOptionalCallExpression({ callee: path.node }) || + path.parentPath.isTaggedTemplateExpression({ tag: path.node })) && t.isMemberExpression(ref) ) { path.replaceWith(t.sequenceExpression([t.numericLiteral(0), ref])); diff --git a/packages/babel-parser/src/parser/expression.js b/packages/babel-parser/src/parser/expression.js index 4660d3cc0797..19fb4011276b 100644 --- a/packages/babel-parser/src/parser/expression.js +++ b/packages/babel-parser/src/parser/expression.js @@ -39,6 +39,7 @@ import { SCOPE_DIRECT_SUPER, SCOPE_SUPER, SCOPE_PROGRAM, + SCOPE_ASYNC, } from "../util/scopeflags"; export default class ExpressionParser extends LValParser { @@ -96,7 +97,11 @@ export default class ExpressionParser extends LValParser { // Convenience method to parse an Expression only getExpression(): N.Expression { - this.scope.enter(SCOPE_PROGRAM); + let scopeFlags = SCOPE_PROGRAM; + if (this.hasPlugin("topLevelAwait") && this.inModule) { + scopeFlags |= SCOPE_ASYNC; + } + this.scope.enter(scopeFlags); this.nextToken(); const expr = this.parseExpression(); if (!this.match(tt.eof)) { @@ -582,63 +587,45 @@ export default class ExpressionParser extends LValParser { startLoc, noCalls, ); - } else if (this.match(tt.questionDot)) { - this.expectPlugin("optionalChaining"); - state.optionalChainMember = true; + } + let optional = false; + if (this.match(tt.questionDot)) { + state.optionalChainMember = optional = true; if (noCalls && this.lookaheadCharCode() === charCodes.leftParenthesis) { state.stop = true; return base; } this.next(); - - const node = this.startNodeAt(startPos, startLoc); - - if (this.eat(tt.bracketL)) { - node.object = base; - node.property = this.parseExpression(); - node.computed = true; - node.optional = true; - this.expect(tt.bracketR); - return this.finishNode(node, "OptionalMemberExpression"); - } else if (this.eat(tt.parenL)) { - node.callee = base; - node.arguments = this.parseCallExpressionArguments(tt.parenR, false); - node.optional = true; - return this.finishCallExpression(node, /* optional */ true); - } else { - node.object = base; - node.property = this.parseIdentifier(true); - node.computed = false; - node.optional = true; - return this.finishNode(node, "OptionalMemberExpression"); - } - } else if (this.eat(tt.dot)) { + } + const computed = this.eat(tt.bracketL); + if ( + (optional && !this.match(tt.parenL) && !this.match(tt.backQuote)) || + computed || + this.eat(tt.dot) + ) { const node = this.startNodeAt(startPos, startLoc); node.object = base; - node.property = this.parseMaybePrivateName(); - node.computed = false; + node.property = computed + ? this.parseExpression() + : optional + ? this.parseIdentifier(true) + : this.parseMaybePrivateName(); + node.computed = computed; if ( node.property.type === "PrivateName" && node.object.type === "Super" ) { this.raise(startPos, "Private fields can't be accessed on super"); } - if (state.optionalChainMember) { - node.optional = false; - return this.finishNode(node, "OptionalMemberExpression"); + if (computed) { + this.expect(tt.bracketR); } - return this.finishNode(node, "MemberExpression"); - } else if (this.eat(tt.bracketL)) { - const node = this.startNodeAt(startPos, startLoc); - node.object = base; - node.property = this.parseExpression(); - node.computed = true; - this.expect(tt.bracketR); if (state.optionalChainMember) { - node.optional = false; + node.optional = optional; return this.finishNode(node, "OptionalMemberExpression"); + } else { + return this.finishNode(node, "MemberExpression"); } - return this.finishNode(node, "MemberExpression"); } else if (!noCalls && this.match(tt.parenL)) { const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; const oldYieldPos = this.state.yieldPos; @@ -652,16 +639,21 @@ export default class ExpressionParser extends LValParser { let node = this.startNodeAt(startPos, startLoc); node.callee = base; - node.arguments = this.parseCallExpressionArguments( - tt.parenR, - state.maybeAsyncArrow, - base.type === "Import", - base.type !== "Super", - node, - ); + if (optional) { + node.optional = true; + node.arguments = this.parseCallExpressionArguments(tt.parenR, false); + } else { + node.arguments = this.parseCallExpressionArguments( + tt.parenR, + state.maybeAsyncArrow, + base.type === "Import", + base.type !== "Super", + node, + ); + } this.finishCallExpression(node, state.optionalChainMember); - if (state.maybeAsyncArrow && this.shouldParseAsyncArrow()) { + if (state.maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional) { state.stop = true; node = this.parseAsyncArrowFromCallExpression( @@ -926,7 +918,10 @@ export default class ExpressionParser extends LValParser { this.expectPlugin("dynamicImport", node.start); if (!this.match(tt.parenL)) { - this.unexpected(null, tt.parenL); + this.raise( + this.state.lastTokStart, + "import can only be used in import() or import.meta", + ); } return this.finishNode(node, "Import"); case tt._this: @@ -967,8 +962,18 @@ export default class ExpressionParser extends LValParser { this.match(tt.name) && !this.canInsertSemicolon() ) { + const oldMaybeInArrowParameters = this.state.maybeInArrowParameters; + const oldYieldPos = this.state.yieldPos; + const oldAwaitPos = this.state.awaitPos; + this.state.maybeInArrowParameters = true; + this.state.yieldPos = -1; + this.state.awaitPos = -1; const params = [this.parseIdentifier()]; this.expect(tt.arrow); + this.checkYieldAwaitInDefaultParams(); + this.state.maybeInArrowParameters = oldMaybeInArrowParameters; + this.state.yieldPos = oldYieldPos; + this.state.awaitPos = oldAwaitPos; // let foo = async bar => {}; this.parseArrowExpression(node, params, true); return node; @@ -1442,13 +1447,7 @@ export default class ExpressionParser extends LValParser { const elem = this.startNode(); if (this.state.value === null) { if (!isTagged) { - // TODO: fix this - this.raise( - this.state.invalidTemplateEscapePosition || 0, - "Invalid escape sequence in template", - ); - } else { - this.state.invalidTemplateEscapePosition = null; + this.raise(this.state.start + 1, "Invalid escape sequence in template"); } } elem.value = { @@ -1839,7 +1838,6 @@ export default class ExpressionParser extends LValParser { (allowDirectSuper ? SCOPE_DIRECT_SUPER : 0), ); this.parseFunctionParams((node: any), allowModifiers); - this.checkYieldAwaitInDefaultParams(); this.parseFunctionBodyAndFinish(node, type, true); this.scope.exit(); @@ -1892,20 +1890,6 @@ export default class ExpressionParser extends LValParser { ); } - isStrictBody(node: { body: N.BlockStatement }): boolean { - const isBlockStatement = node.body.type === "BlockStatement"; - - if (isBlockStatement && node.body.directives.length) { - for (const directive of node.body.directives) { - if (directive.value.value === "use strict") { - return true; - } - } - } - - return false; - } - parseFunctionBodyAndFinish( node: N.BodilessFunctionOrMethodBase, type: string, @@ -2219,7 +2203,9 @@ export default class ExpressionParser extends LValParser { isAwaitAllowed(): boolean { if (this.scope.inFunction) return this.scope.inAsync; if (this.options.allowAwaitOutsideFunction) return true; - if (this.hasPlugin("topLevelAwait")) return this.inModule; + if (this.hasPlugin("topLevelAwait")) { + return this.inModule && this.scope.inAsync; + } return false; } diff --git a/packages/babel-parser/src/parser/index.js b/packages/babel-parser/src/parser/index.js index 2c96336f1c13..681de32d0560 100644 --- a/packages/babel-parser/src/parser/index.js +++ b/packages/babel-parser/src/parser/index.js @@ -5,7 +5,7 @@ import type { File, JSXOpeningElement } from "../types"; import type { PluginList } from "../plugin-utils"; import { getOptions } from "../options"; import StatementParser from "./statement"; -import { SCOPE_PROGRAM } from "../util/scopeflags"; +import { SCOPE_ASYNC, SCOPE_PROGRAM } from "../util/scopeflags"; import ScopeHandler from "../util/scope"; export type PluginsMap = Map; @@ -35,7 +35,11 @@ export default class Parser extends StatementParser { } parse(): File { - this.scope.enter(SCOPE_PROGRAM); + let scopeFlags = SCOPE_PROGRAM; + if (this.hasPlugin("topLevelAwait") && this.inModule) { + scopeFlags |= SCOPE_ASYNC; + } + this.scope.enter(scopeFlags); const file = this.startNode(); const program = this.startNode(); this.nextToken(); diff --git a/packages/babel-parser/src/parser/util.js b/packages/babel-parser/src/parser/util.js index f1093f31b57f..e37becfa1a73 100644 --- a/packages/babel-parser/src/parser/util.js +++ b/packages/babel-parser/src/parser/util.js @@ -58,16 +58,6 @@ export default class UtilParser extends Tokenizer { } } - // eat() for relational operators. - - eatRelational(op: "<" | ">"): boolean { - if (this.isRelational(op)) { - this.next(); - return true; - } - return false; - } - // Tests whether parsed token is a contextual keyword. isContextual(name: string): boolean { diff --git a/packages/babel-parser/src/plugins/estree.js b/packages/babel-parser/src/plugins/estree.js index fc7640de1764..5fd0ab11350c 100644 --- a/packages/babel-parser/src/plugins/estree.js +++ b/packages/babel-parser/src/plugins/estree.js @@ -174,26 +174,6 @@ export default (superClass: Class): Class => } } - isStrictBody(node: { body: N.BlockStatement }): boolean { - const isBlockStatement = node.body.type === "BlockStatement"; - - if (isBlockStatement && node.body.body.length > 0) { - for (const directive of node.body.body) { - if ( - directive.type === "ExpressionStatement" && - directive.expression.type === "Literal" - ) { - if (directive.expression.value === "use strict") return true; - } else { - // Break for the first non literal expression - break; - } - } - } - - return false; - } - isValidDirective(stmt: N.Statement): boolean { return ( stmt.type === "ExpressionStatement" && diff --git a/packages/babel-parser/src/plugins/flow.js b/packages/babel-parser/src/plugins/flow.js index 96a5feac5d37..72ed92b6c276 100644 --- a/packages/babel-parser/src/plugins/flow.js +++ b/packages/babel-parser/src/plugins/flow.js @@ -2801,7 +2801,6 @@ export default (superClass: Class): Class => subscriptState: N.ParseSubscriptState, ): N.Expression { if (this.match(tt.questionDot) && this.isLookaheadRelational("<")) { - this.expectPlugin("optionalChaining"); subscriptState.optionalChainMember = true; if (noCalls) { subscriptState.stop = true; diff --git a/packages/babel-parser/src/plugins/typescript/index.js b/packages/babel-parser/src/plugins/typescript/index.js index 2b442620a507..0c740b2c9bdd 100644 --- a/packages/babel-parser/src/plugins/typescript/index.js +++ b/packages/babel-parser/src/plugins/typescript/index.js @@ -2568,11 +2568,7 @@ export default (superClass: Class): Class => ): $ReadOnlyArray { for (let i = 0; i < exprList.length; i++) { const expr = exprList[i]; - if ( - expr && - expr._exprListItem && - expr.type === "TsTypeCastExpression" - ) { + if (expr && expr.type === "TSTypeCastExpression") { this.raise(expr.start, "Did not expect a type annotation here."); } } diff --git a/packages/babel-parser/src/tokenizer/index.js b/packages/babel-parser/src/tokenizer/index.js index 32c8a03fc0b9..27f1aaa15f96 100644 --- a/packages/babel-parser/src/tokenizer/index.js +++ b/packages/babel-parser/src/tokenizer/index.js @@ -1122,14 +1122,10 @@ export default class Tokenizer extends LocationParser { throwOnInvalid, ); ++this.state.pos; - if (code === null) { - // $FlowFixMe (is this always non-null?) - --this.state.invalidTemplateEscapePosition; // to point to the '\'' instead of the 'u' - } else if (code > 0x10ffff) { + if (code !== null && code > 0x10ffff) { if (throwOnInvalid) { this.raise(codePos, "Code point out of bounds"); } else { - this.state.invalidTemplateEscapePosition = codePos - 2; return null; } } @@ -1159,6 +1155,7 @@ export default class Tokenizer extends LocationParser { ) { ++this.state.pos; ++this.state.curLine; + this.state.lineStart = this.state.pos; } else if (isNewLine(ch)) { throw this.raise(this.state.start, "Unterminated string constant"); } else { @@ -1274,9 +1271,6 @@ export default class Tokenizer extends LocationParser { case charCodes.digit8: case charCodes.digit9: if (inTemplate) { - const codePos = this.state.pos - 1; - - this.state.invalidTemplateEscapePosition = codePos; return null; } default: @@ -1299,7 +1293,6 @@ export default class Tokenizer extends LocationParser { next === charCodes.digit9 ) { if (inTemplate) { - this.state.invalidTemplateEscapePosition = codePos; return null; } else if (this.state.strict) { this.raise(codePos, "Octal literal in strict mode"); @@ -1332,7 +1325,6 @@ export default class Tokenizer extends LocationParser { this.raise(codePos, "Bad character escape sequence"); } else { this.state.pos = codePos - 1; - this.state.invalidTemplateEscapePosition = codePos - 1; } } return n; diff --git a/packages/babel-parser/src/tokenizer/state.js b/packages/babel-parser/src/tokenizer/state.js index d3f370df1473..874b5cbdfcad 100644 --- a/packages/babel-parser/src/tokenizer/state.js +++ b/packages/babel-parser/src/tokenizer/state.js @@ -156,8 +156,6 @@ export default class State { // `export default foo;` and `export { foo as default };`. exportedIdentifiers: Array = []; - invalidTemplateEscapePosition: ?number = null; - curPosition(): Position { return new Position(this.curLine, this.pos - this.lineStart); } diff --git a/packages/babel-parser/src/util/scope.js b/packages/babel-parser/src/util/scope.js index f367ae5e76b6..bc90be4d03cb 100644 --- a/packages/babel-parser/src/util/scope.js +++ b/packages/babel-parser/src/util/scope.js @@ -55,8 +55,21 @@ export default class ScopeHandler { get inGenerator() { return (this.currentVarScope().flags & SCOPE_GENERATOR) > 0; } + // the following loop always exit because SCOPE_PROGRAM is SCOPE_VAR + // $FlowIgnore get inAsync() { - return (this.currentVarScope().flags & SCOPE_ASYNC) > 0; + for (let i = this.scopeStack.length - 1; ; i--) { + const scope = this.scopeStack[i]; + const isVarScope = scope.flags & SCOPE_VAR; + const isClassScope = scope.flags & SCOPE_CLASS; + if (isClassScope && !isVarScope) { + // If it meets a class scope before a var scope, it means it is a class property initializer + // which does not have an [Await] parameter in its grammar + return false; + } else if (isVarScope) { + return (scope.flags & SCOPE_ASYNC) > 0; + } + } } get allowSuper() { return (this.currentThisScope().flags & SCOPE_SUPER) > 0; diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/async-await-as-arrow-binding-identifier/input.js b/packages/babel-parser/test/fixtures/es2017/async-functions/async-await-as-arrow-binding-identifier/input.js new file mode 100644 index 000000000000..769cb1594534 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/async-await-as-arrow-binding-identifier/input.js @@ -0,0 +1 @@ +async await => {} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/async-await-as-arrow-binding-identifier/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/async-await-as-arrow-binding-identifier/output.json new file mode 100644 index 000000000000..b264aa447eeb --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/async-await-as-arrow-binding-identifier/output.json @@ -0,0 +1,107 @@ +{ + "type": "File", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "errors": [ + "SyntaxError: Await cannot be used as name inside an async function (1:6)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [ + { + "type": "Identifier", + "start": 6, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 11 + }, + "identifierName": "await" + }, + "name": "await" + } + ], + "body": { + "type": "BlockStatement", + "start": 15, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 17 + } + }, + "body": [], + "directives": [] + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-class-methods/input.js b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-class-methods/input.js new file mode 100644 index 000000000000..7a48dfc20087 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-class-methods/input.js @@ -0,0 +1,3 @@ +() => class { + async m() { await 42 } +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-class-methods/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-class-methods/output.json new file mode 100644 index 000000000000..04024e014271 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-class-methods/output.json @@ -0,0 +1,210 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "ClassExpression", + "start": 6, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 12, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 16, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "m" + }, + "name": "m" + }, + "computed": false, + "kind": "method", + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 26, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 12 + }, + "end": { + "line": 2, + "column": 24 + } + }, + "body": [ + { + "type": "ExpressionStatement", + "start": 28, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "expression": { + "type": "AwaitExpression", + "start": 28, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 14 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 34, + "end": 36, + "loc": { + "start": { + "line": 2, + "column": 20 + }, + "end": { + "line": 2, + "column": 22 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + ], + "directives": [] + } + } + ] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/input.js b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/input.js new file mode 100644 index 000000000000..d18a372142f7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/input.js @@ -0,0 +1,3 @@ +async () => class { + [await 42]() { } +} diff --git a/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/output.json b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/output.json new file mode 100644 index 000000000000..2518cd543d0f --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2017/async-functions/await-inside-computed-class-property/output.json @@ -0,0 +1,177 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "ClassExpression", + "start": 12, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": null, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 18, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 18 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassMethod", + "start": 22, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "static": false, + "computed": true, + "key": { + "type": "AwaitExpression", + "start": 23, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 29, + "end": 31, + "loc": { + "start": { + "line": 2, + "column": 9 + }, + "end": { + "line": 2, + "column": 11 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + }, + "kind": "method", + "id": null, + "generator": false, + "async": false, + "params": [], + "body": { + "type": "BlockStatement", + "start": 35, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 15 + }, + "end": { + "line": 2, + "column": 18 + } + }, + "body": [], + "directives": [] + } + } + ] + } + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/directive-line-separator/output.json b/packages/babel-parser/test/fixtures/es2019/json-strings/directive-line-separator/output.json index 8bf9f02e8706..503c5e4d17c2 100644 --- a/packages/babel-parser/test/fixtures/es2019/json-strings/directive-line-separator/output.json +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/directive-line-separator/output.json @@ -41,7 +41,7 @@ }, "end": { "line": 2, - "column": 15 + "column": 7 } }, "value": { @@ -55,7 +55,7 @@ }, "end": { "line": 2, - "column": 14 + "column": 6 } }, "value": "before
after", diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/directive-paragraph-separator/output.json b/packages/babel-parser/test/fixtures/es2019/json-strings/directive-paragraph-separator/output.json index f83d867447e7..ac843e7faa2c 100644 --- a/packages/babel-parser/test/fixtures/es2019/json-strings/directive-paragraph-separator/output.json +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/directive-paragraph-separator/output.json @@ -41,7 +41,7 @@ }, "end": { "line": 2, - "column": 15 + "column": 7 } }, "value": { @@ -55,7 +55,7 @@ }, "end": { "line": 2, - "column": 14 + "column": 6 } }, "value": "before
after", diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/string-line-separator/output.json b/packages/babel-parser/test/fixtures/es2019/json-strings/string-line-separator/output.json index 388733cc206a..9ac309222fd1 100644 --- a/packages/babel-parser/test/fixtures/es2019/json-strings/string-line-separator/output.json +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/string-line-separator/output.json @@ -40,7 +40,7 @@ }, "end": { "line": 2, - "column": 17 + "column": 8 } }, "expression": { @@ -54,7 +54,7 @@ }, "end": { "line": 2, - "column": 15 + "column": 6 } }, "extra": { diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/string-paragraph-separator/output.json b/packages/babel-parser/test/fixtures/es2019/json-strings/string-paragraph-separator/output.json index a482ccfb266a..edf8712a70d2 100644 --- a/packages/babel-parser/test/fixtures/es2019/json-strings/string-paragraph-separator/output.json +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/string-paragraph-separator/output.json @@ -40,7 +40,7 @@ }, "end": { "line": 2, - "column": 17 + "column": 8 } }, "expression": { @@ -54,7 +54,7 @@ }, "end": { "line": 2, - "column": 15 + "column": 6 } }, "extra": { diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/template-line-separator/input.js b/packages/babel-parser/test/fixtures/es2019/json-strings/template-line-separator/input.js new file mode 100644 index 000000000000..73604d9cd234 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/template-line-separator/input.js @@ -0,0 +1,2 @@ +(`before
after`); +// ^ That's a U+2028 LINE SEPARATOR UTF-16 char (between 'before' and 'after') diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/template-line-separator/output.json b/packages/babel-parser/test/fixtures/es2019/json-strings/template-line-separator/output.json new file mode 100644 index 000000000000..603b0c53b682 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/template-line-separator/output.json @@ -0,0 +1,128 @@ +{ + "type": "File", + "start": 0, + "end": 101, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 83 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 101, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 83 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 1, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 2, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "value": { + "raw": "before
after", + "cooked": "before
after" + }, + "tail": true + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " ^ That's a U+2028 LINE SEPARATOR UTF-16 char (between 'before' and 'after')", + "start": 18, + "end": 101, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 83 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " ^ That's a U+2028 LINE SEPARATOR UTF-16 char (between 'before' and 'after')", + "start": 18, + "end": 101, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 83 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/template-paragraph-separator/input.js b/packages/babel-parser/test/fixtures/es2019/json-strings/template-paragraph-separator/input.js new file mode 100644 index 000000000000..9272512911d9 --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/template-paragraph-separator/input.js @@ -0,0 +1,2 @@ +(`before
after`); +// ^ That's a U+2029 PARAGRAPH SEPARATOR UTF-16 char (between 'before' and 'after') diff --git a/packages/babel-parser/test/fixtures/es2019/json-strings/template-paragraph-separator/output.json b/packages/babel-parser/test/fixtures/es2019/json-strings/template-paragraph-separator/output.json new file mode 100644 index 000000000000..d1d7e83639aa --- /dev/null +++ b/packages/babel-parser/test/fixtures/es2019/json-strings/template-paragraph-separator/output.json @@ -0,0 +1,128 @@ +{ + "type": "File", + "start": 0, + "end": 106, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 88 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 106, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 88 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 17, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 2, + "column": 8 + } + }, + "expression": { + "type": "TemplateLiteral", + "start": 1, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 2, + "column": 6 + } + }, + "expressions": [], + "quasis": [ + { + "type": "TemplateElement", + "start": 2, + "end": 14, + "loc": { + "start": { + "line": 1, + "column": 2 + }, + "end": { + "line": 2, + "column": 5 + } + }, + "value": { + "raw": "before
after", + "cooked": "before
after" + }, + "tail": true + } + ], + "extra": { + "parenthesized": true, + "parenStart": 0 + } + }, + "trailingComments": [ + { + "type": "CommentLine", + "value": " ^ That's a U+2029 PARAGRAPH SEPARATOR UTF-16 char (between 'before' and 'after')", + "start": 18, + "end": 106, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 88 + } + } + } + ] + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " ^ That's a U+2029 PARAGRAPH SEPARATOR UTF-16 char (between 'before' and 'after')", + "start": 18, + "end": 106, + "loc": { + "start": { + "line": 3, + "column": 0 + }, + "end": { + "line": 3, + "column": 88 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/class-contructor-call/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/class-contructor-call/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/class-contructor-call/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/output.json rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/class-contructor-call/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/conditional-decimal/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/conditional-decimal/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/conditional-decimal/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/conditional-decimal/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/conditional-decimal/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/conditional-decimal/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/conditional-decimal/output.json rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/conditional-decimal/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/function-call/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/function-call/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/function-call/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/function-call/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/function-call/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/function-call/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/function-call/output.json rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/function-call/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access-bracket/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access-bracket/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access-bracket/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access-bracket/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access-bracket/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access-bracket/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access-bracket/output.json rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access-bracket/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access/output.json rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/member-access/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optioanl-chain-expression/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optioanl-chain-expression/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/optioanl-chain-expression/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/optioanl-chain-expression/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optioanl-chain-expression/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optioanl-chain-expression/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/optioanl-chain-expression/output.json rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/optioanl-chain-expression/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-constructor/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-constructor/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-constructor/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/output.json rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-constructor/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property-class/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property-class/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property-class/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/output.json rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property-class/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/output.json rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-super-property/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-tagged-template-literals/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-tagged-template-literals/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-tagged-template-literals/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/output.json rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/optional-tagged-template-literals/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/parenthised-chain/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/parenthised-chain/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/parenthised-chain/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/parenthised-chain/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/parenthised-chain/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/parenthised-chain/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/parenthised-chain/output.json rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/parenthised-chain/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/separated-chaining/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/separated-chaining/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/separated-chaining/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/separated-chaining/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/separated-chaining/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/separated-chaining/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/separated-chaining/output.json rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/separated-chaining/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/super-method-class/input.js b/packages/babel-parser/test/fixtures/es2020/optional-chaining/super-method-class/input.js similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/super-method-class/input.js rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/super-method-class/input.js diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/super-method-class/output.json b/packages/babel-parser/test/fixtures/es2020/optional-chaining/super-method-class/output.json similarity index 100% rename from packages/babel-parser/test/fixtures/experimental/optional-chaining/super-method-class/output.json rename to packages/babel-parser/test/fixtures/es2020/optional-chaining/super-method-class/output.json diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/optional-chaining/input.js b/packages/babel-parser/test/fixtures/experimental/_no-plugin/optional-chaining/input.js deleted file mode 100644 index 280754611364..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/_no-plugin/optional-chaining/input.js +++ /dev/null @@ -1 +0,0 @@ -a?.b diff --git a/packages/babel-parser/test/fixtures/experimental/_no-plugin/optional-chaining/options.json b/packages/babel-parser/test/fixtures/experimental/_no-plugin/optional-chaining/options.json deleted file mode 100644 index b8e170c94adb..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/_no-plugin/optional-chaining/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "throws": "This experimental syntax requires enabling the parser plugin: 'optionalChaining' (1:1)" -} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/input.js new file mode 100644 index 000000000000..f01601af7a3a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/input.js @@ -0,0 +1,3 @@ +class C { + #p = async () => await 42; +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/options.json new file mode 100644 index 000000000000..f26e916957c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/output.json new file mode 100644 index 000000000000..ebac6a0e3b90 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-async-in-private-property/output.json @@ -0,0 +1,187 @@ +{ + "type": "File", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 40, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 12, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 12, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 4 + } + }, + "id": { + "type": "Identifier", + "start": 13, + "end": 14, + "loc": { + "start": { + "line": 2, + "column": 3 + }, + "end": { + "line": 2, + "column": 4 + }, + "identifierName": "p" + }, + "name": "p" + } + }, + "value": { + "type": "ArrowFunctionExpression", + "start": 17, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 7 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "AwaitExpression", + "start": 29, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 19 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "argument": { + "type": "NumericLiteral", + "start": 35, + "end": 37, + "loc": { + "start": { + "line": 2, + "column": 25 + }, + "end": { + "line": 2, + "column": 27 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/input.js b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/input.js new file mode 100644 index 000000000000..f2cbab75f49c --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/input.js @@ -0,0 +1,6 @@ +async () => { + class C { + // here await is an identifier reference + #p = await + 42; + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/options.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/options.json new file mode 100644 index 000000000000..f26e916957c8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classPrivateProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/output.json b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/output.json new file mode 100644 index 000000000000..cc5429e9fce3 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-private-properties/await-in-private-property-in-async/output.json @@ -0,0 +1,274 @@ +{ + "type": "File", + "start": 0, + "end": 97, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 97, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 97, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 97, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 12, + "end": 97, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "start": 16, + "end": 95, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 24, + "end": 95, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "body": [ + { + "type": "ClassPrivateProperty", + "start": 75, + "end": 91, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 20 + } + }, + "static": false, + "key": { + "type": "PrivateName", + "start": 75, + "end": 77, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 6 + } + }, + "id": { + "type": "Identifier", + "start": 76, + "end": 77, + "loc": { + "start": { + "line": 4, + "column": 5 + }, + "end": { + "line": 4, + "column": 6 + }, + "identifierName": "p" + }, + "name": "p" + } + }, + "value": { + "type": "BinaryExpression", + "start": 80, + "end": 90, + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 19 + } + }, + "left": { + "type": "Identifier", + "start": 80, + "end": 85, + "loc": { + "start": { + "line": 4, + "column": 9 + }, + "end": { + "line": 4, + "column": 14 + }, + "identifierName": "await" + }, + "name": "await" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 88, + "end": 90, + "loc": { + "start": { + "line": 4, + "column": 17 + }, + "end": { + "line": 4, + "column": 19 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " here await is an identifier reference", + "start": 30, + "end": 70, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 44 + } + } + } + ] + } + ] + } + } + ], + "directives": [] + } + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " here await is an identifier reference", + "start": 30, + "end": 70, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 44 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/input.js b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/input.js new file mode 100644 index 000000000000..388ae60d9f00 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/input.js @@ -0,0 +1,3 @@ +class C { + p = async () => await + 42; +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/options.json new file mode 100644 index 000000000000..9c27576d4ad0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/output.json new file mode 100644 index 000000000000..0031d27b4529 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-async-in-class-property/output.json @@ -0,0 +1,190 @@ +{ + "type": "File", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ClassDeclaration", + "start": 0, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "id": { + "type": "Identifier", + "start": 6, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 7 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 8, + "end": 41, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 3, + "column": 1 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 12, + "end": 39, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 29 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 12, + "end": 13, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 2, + "column": 3 + }, + "identifierName": "p" + }, + "name": "p" + }, + "computed": false, + "value": { + "type": "ArrowFunctionExpression", + "start": 16, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 6 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "AwaitExpression", + "start": 28, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 18 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "argument": { + "type": "UnaryExpression", + "start": 34, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 24 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "operator": "+", + "prefix": true, + "argument": { + "type": "NumericLiteral", + "start": 36, + "end": 38, + "loc": { + "start": { + "line": 2, + "column": 26 + }, + "end": { + "line": 2, + "column": 28 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + } + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/input.js b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/input.js new file mode 100644 index 000000000000..84a94bd55ed8 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/input.js @@ -0,0 +1,6 @@ +async () => { + class C { + // here await is an identifier reference + p = await + 42; + } +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/options.json b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/options.json new file mode 100644 index 000000000000..9c27576d4ad0 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["classProperties"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/output.json b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/output.json new file mode 100644 index 000000000000..34bc34826eca --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/class-properties/await-in-class-property-in-async/output.json @@ -0,0 +1,260 @@ +{ + "type": "File", + "start": 0, + "end": 96, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 96, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 96, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "expression": { + "type": "ArrowFunctionExpression", + "start": 0, + "end": 96, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "id": null, + "generator": false, + "async": true, + "params": [], + "body": { + "type": "BlockStatement", + "start": 12, + "end": 96, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 6, + "column": 1 + } + }, + "body": [ + { + "type": "ClassDeclaration", + "start": 16, + "end": 94, + "loc": { + "start": { + "line": 2, + "column": 2 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "id": { + "type": "Identifier", + "start": 22, + "end": 23, + "loc": { + "start": { + "line": 2, + "column": 8 + }, + "end": { + "line": 2, + "column": 9 + }, + "identifierName": "C" + }, + "name": "C" + }, + "superClass": null, + "body": { + "type": "ClassBody", + "start": 24, + "end": 94, + "loc": { + "start": { + "line": 2, + "column": 10 + }, + "end": { + "line": 5, + "column": 3 + } + }, + "body": [ + { + "type": "ClassProperty", + "start": 75, + "end": 90, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 19 + } + }, + "static": false, + "key": { + "type": "Identifier", + "start": 75, + "end": 76, + "loc": { + "start": { + "line": 4, + "column": 4 + }, + "end": { + "line": 4, + "column": 5 + }, + "identifierName": "p" + }, + "name": "p" + }, + "computed": false, + "value": { + "type": "BinaryExpression", + "start": 79, + "end": 89, + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "left": { + "type": "Identifier", + "start": 79, + "end": 84, + "loc": { + "start": { + "line": 4, + "column": 8 + }, + "end": { + "line": 4, + "column": 13 + }, + "identifierName": "await" + }, + "name": "await" + }, + "operator": "+", + "right": { + "type": "NumericLiteral", + "start": 87, + "end": 89, + "loc": { + "start": { + "line": 4, + "column": 16 + }, + "end": { + "line": 4, + "column": 18 + } + }, + "extra": { + "rawValue": 42, + "raw": "42" + }, + "value": 42 + } + }, + "leadingComments": [ + { + "type": "CommentLine", + "value": " here await is an identifier reference", + "start": 30, + "end": 70, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 44 + } + } + } + ] + } + ] + } + } + ], + "directives": [] + } + } + } + ], + "directives": [] + }, + "comments": [ + { + "type": "CommentLine", + "value": " here await is an identifier reference", + "start": 30, + "end": 70, + "loc": { + "start": { + "line": 3, + "column": 4 + }, + "end": { + "line": 3, + "column": 44 + } + } + } + ] +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/input.js b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/input.js new file mode 100644 index 000000000000..477eec265426 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/input.js @@ -0,0 +1 @@ +(import) diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/options.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/options.json new file mode 100644 index 000000000000..1629df1f3678 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/options.json @@ -0,0 +1,3 @@ +{ + "plugins": ["dynamicImport"] +} diff --git a/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/output.json b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/output.json new file mode 100644 index 000000000000..fe56e0811a5a --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/dynamic-import/invalid-lone-import/output.json @@ -0,0 +1,72 @@ +{ + "type": "File", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "errors": [ + "SyntaxError: import can only be used in import() or import.meta (1:1)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "sourceType": "script", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + } + }, + "expression": { + "type": "Import", + "start": 1, + "end": 7, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 7 + } + }, + "extra": { + "parenthesized": true, + "parenStart": 0 + } + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/class-contructor-call/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/conditional-decimal/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/conditional-decimal/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/conditional-decimal/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/function-call/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/function-call/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/function-call/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access-bracket/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access-bracket/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access-bracket/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/member-access/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optioanl-chain-expression/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optioanl-chain-expression/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optioanl-chain-expression/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-constructor/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-super-property/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/optional-tagged-template-literals/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/parenthised-chain/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/parenthised-chain/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/parenthised-chain/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/separated-chaining/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/separated-chaining/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/separated-chaining/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/optional-chaining/super-method-class/options.json b/packages/babel-parser/test/fixtures/experimental/optional-chaining/super-method-class/options.json deleted file mode 100644 index fd201c1bdb02..000000000000 --- a/packages/babel-parser/test/fixtures/experimental/optional-chaining/super-method-class/options.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "plugins": ["optionalChaining"] -} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-class-property/input.js b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-class-property/input.js new file mode 100644 index 000000000000..d17e57ee1081 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-class-property/input.js @@ -0,0 +1,3 @@ +export class C { + p = await 0; +} diff --git a/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-class-property/options.json b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-class-property/options.json new file mode 100644 index 000000000000..0688c012b357 --- /dev/null +++ b/packages/babel-parser/test/fixtures/experimental/top-level-await/inside-class-property/options.json @@ -0,0 +1,8 @@ +{ + "plugins": [ + "topLevelAwait", + "classProperties" + ], + "sourceType": "module", + "throws": "Unexpected token, expected \";\" (2:12)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call-optional/options.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call-optional/options.json index 05e42d81055f..698e7668500f 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call-optional/options.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/function-call-optional/options.json @@ -1,3 +1,3 @@ { - "plugins": ["jsx", "flow", "optionalChaining"] + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional/options.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional/options.json index 05e42d81055f..698e7668500f 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional/options.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional/options.json @@ -1,3 +1,3 @@ { - "plugins": ["jsx", "flow", "optionalChaining"] + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional2/options.json b/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional2/options.json index 05e42d81055f..698e7668500f 100644 --- a/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional2/options.json +++ b/packages/babel-parser/test/fixtures/flow/typeapp-call/method-call-optional2/options.json @@ -1,3 +1,3 @@ { - "plugins": ["jsx", "flow", "optionalChaining"] + "plugins": ["jsx", "flow"] } diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-async-optional-calls/input.js b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-async-optional-calls/input.js new file mode 100644 index 000000000000..961846976c7a --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-async-optional-calls/input.js @@ -0,0 +1 @@ +async?.(bar: string) => {} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-async-optional-calls/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-async-optional-calls/options.json new file mode 100644 index 000000000000..3c7c9c589b44 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-async-optional-calls/options.json @@ -0,0 +1,8 @@ +{ + "sourceType": "module", + "plugins": [ + "flow", + "optionalChaining" + ], + "throws": "Unexpected token, expected \";\" (1:21)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/input.js b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/input.js new file mode 100644 index 000000000000..14df4e2b16c7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/input.js @@ -0,0 +1 @@ +funccall?.(a, b: string); diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/options.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/options.json new file mode 100644 index 000000000000..0e7765c73ae7 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/options.json @@ -0,0 +1,7 @@ +{ + "sourceType": "module", + "plugins": [ + "flow", + "optionalChaining" + ] +} diff --git a/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/output.json b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/output.json new file mode 100644 index 000000000000..84fcef591c74 --- /dev/null +++ b/packages/babel-parser/test/fixtures/flow/typecasts/fail-in-optional-calls/output.json @@ -0,0 +1,167 @@ +{ + "type": "File", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "errors": [ + "SyntaxError: The type cast expression is expected to be wrapped with parenthesis (1:15)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 25, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 25 + } + }, + "expression": { + "type": "OptionalCallExpression", + "start": 0, + "end": 24, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 24 + } + }, + "callee": { + "type": "Identifier", + "start": 0, + "end": 8, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 8 + }, + "identifierName": "funccall" + }, + "name": "funccall" + }, + "optional": true, + "arguments": [ + { + "type": "Identifier", + "start": 11, + "end": 12, + "loc": { + "start": { + "line": 1, + "column": 11 + }, + "end": { + "line": 1, + "column": 12 + }, + "identifierName": "a" + }, + "name": "a" + }, + { + "type": "TypeCastExpression", + "start": 14, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "expression": { + "type": "Identifier", + "start": 14, + "end": 15, + "loc": { + "start": { + "line": 1, + "column": 14 + }, + "end": { + "line": 1, + "column": 15 + }, + "identifierName": "b" + }, + "name": "b" + }, + "typeAnnotation": { + "type": "TypeAnnotation", + "start": 15, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 15 + }, + "end": { + "line": 1, + "column": 23 + } + }, + "typeAnnotation": { + "type": "StringTypeAnnotation", + "start": 17, + "end": 23, + "loc": { + "start": { + "line": 1, + "column": 17 + }, + "end": { + "line": 1, + "column": 23 + } + } + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/cast/parameter-typecast/input.ts b/packages/babel-parser/test/fixtures/typescript/cast/parameter-typecast/input.ts new file mode 100644 index 000000000000..c494cc00bc39 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/parameter-typecast/input.ts @@ -0,0 +1 @@ +func(a: T); diff --git a/packages/babel-parser/test/fixtures/typescript/cast/parameter-typecast/output.json b/packages/babel-parser/test/fixtures/typescript/cast/parameter-typecast/output.json new file mode 100644 index 000000000000..d815e81603d1 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/cast/parameter-typecast/output.json @@ -0,0 +1,166 @@ +{ + "type": "File", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "errors": [ + "SyntaxError: Did not expect a type annotation here. (1:5)" + ], + "program": { + "type": "Program", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "sourceType": "module", + "interpreter": null, + "body": [ + { + "type": "ExpressionStatement", + "start": 0, + "end": 11, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 11 + } + }, + "expression": { + "type": "CallExpression", + "start": 0, + "end": 10, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 10 + } + }, + "callee": { + "type": "Identifier", + "start": 0, + "end": 4, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 4 + }, + "identifierName": "func" + }, + "name": "func" + }, + "arguments": [ + { + "type": "TSTypeCastExpression", + "start": 5, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "expression": { + "type": "Identifier", + "start": 5, + "end": 6, + "loc": { + "start": { + "line": 1, + "column": 5 + }, + "end": { + "line": 1, + "column": 6 + }, + "identifierName": "a" + }, + "name": "a" + }, + "typeAnnotation": { + "type": "TSTypeAnnotation", + "start": 6, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 6 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "typeAnnotation": { + "type": "TSTypeReference", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + } + }, + "typeName": { + "type": "Identifier", + "start": 8, + "end": 9, + "loc": { + "start": { + "line": 1, + "column": 8 + }, + "end": { + "line": 1, + "column": 9 + }, + "identifierName": "T" + }, + "name": "T" + } + } + } + } + ] + } + } + ], + "directives": [] + } +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/module-namespace/top-level-await/input.ts b/packages/babel-parser/test/fixtures/typescript/module-namespace/top-level-await/input.ts new file mode 100644 index 000000000000..9302309c5933 --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/module-namespace/top-level-await/input.ts @@ -0,0 +1,3 @@ +namespace N { + const x = await 42; +} diff --git a/packages/babel-parser/test/fixtures/typescript/module-namespace/top-level-await/options.json b/packages/babel-parser/test/fixtures/typescript/module-namespace/top-level-await/options.json new file mode 100644 index 000000000000..ba579946562a --- /dev/null +++ b/packages/babel-parser/test/fixtures/typescript/module-namespace/top-level-await/options.json @@ -0,0 +1,8 @@ +{ + "sourceType": "module", + "plugins": [ + "typescript", + "topLevelAwait" + ], + "throws": "Unexpected token, expected \";\" (2:20)" +} \ No newline at end of file diff --git a/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/options.json b/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/options.json index ccc6341666b4..fe9bffaa5e1a 100644 --- a/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/options.json +++ b/packages/babel-parser/test/fixtures/typescript/optional-chaining/type-arguments/options.json @@ -1,4 +1,4 @@ { "sourceType": "module", - "plugins": ["typescript", "optionalChaining"] + "plugins": ["typescript"] } diff --git a/packages/babel-parser/test/fixtures/v8intrinsic/_errors/optional-call-expression/options.json b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/optional-call-expression/options.json index cd2dad552c15..f388c1ba2b25 100644 --- a/packages/babel-parser/test/fixtures/v8intrinsic/_errors/optional-call-expression/options.json +++ b/packages/babel-parser/test/fixtures/v8intrinsic/_errors/optional-call-expression/options.json @@ -1,4 +1,4 @@ { - "plugins": ["optionalChaining", "v8intrinsic"], + "plugins": ["v8intrinsic"], "throws": "Unexpected token (1:0)" } diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/input.mjs b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/input.mjs index 5b84f44e6659..0195246aa49c 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/input.mjs +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/input.mjs @@ -7,3 +7,5 @@ foo; foo2; foo3; foo3(); +foo3``; +foo3?.(); diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/output.js b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/output.js index 1c2bc5f8e059..445e5f55895c 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/output.js +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/import/output.js @@ -5,3 +5,5 @@ foo4.default; foo4.default; foo4.foo3; (0, foo4.foo3)(); +(0, foo4.foo3)``; +(0, foo4.foo3)?.(); diff --git a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/options.json b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/options.json index caedc022efa4..39f3a7421118 100644 --- a/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/options.json +++ b/packages/babel-plugin-transform-modules-commonjs/test/fixtures/strict/options.json @@ -2,6 +2,7 @@ "plugins": [ "external-helpers", "syntax-object-rest-spread", + "syntax-optional-chaining", [ "transform-modules-commonjs", { "strict": true, "mjsStrictNamespace": false } diff --git a/packages/babel-preset-env/src/polyfills/corejs3/built-in-definitions.js b/packages/babel-preset-env/src/polyfills/corejs3/built-in-definitions.js index f3de8ef83733..2ed1915d87c5 100644 --- a/packages/babel-preset-env/src/polyfills/corejs3/built-in-definitions.js +++ b/packages/babel-preset-env/src/polyfills/corejs3/built-in-definitions.js @@ -358,7 +358,11 @@ export const StaticProperties: ObjectMap> = { "esnext.promise.all-settled", ...PromiseDependenciesWithIterators, ], - any: ["esnext.promise.any", ...PromiseDependenciesWithIterators], + any: [ + "esnext.promise.any", + "esnext.aggregate-error", + ...PromiseDependenciesWithIterators, + ], race: PromiseDependenciesWithIterators, try: ["esnext.promise.try", ...PromiseDependenciesWithIterators], }, diff --git a/packages/babel-traverse/src/visitors.js b/packages/babel-traverse/src/visitors.js index 77c1488d5d55..eb8516a451fa 100644 --- a/packages/babel-traverse/src/visitors.js +++ b/packages/babel-traverse/src/visitors.js @@ -227,6 +227,11 @@ function wrapWithStateOrWrapper(oldVisitor, state, wrapper: ?Function) { newFn = wrapper(state.key, key, newFn); } + // Override toString in case this function is printed, we want to print the wrapped function, same as we do in `wrapCheck` + if (newFn !== fn) { + newFn.toString = () => fn.toString(); + } + return newFn; }); diff --git a/scripts/integration-tests/e2e-vue-cli.sh b/scripts/integration-tests/e2e-vue-cli.sh new file mode 100755 index 000000000000..c640661652a9 --- /dev/null +++ b/scripts/integration-tests/e2e-vue-cli.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +#==============================================================================# +# SETUP # +#==============================================================================# + +# Start in scripts/integration-tests/ even if run from root directory +cd "$(dirname "$0")" || exit + +source utils/local-registry.sh +source utils/cleanup.sh + +# Echo every command being executed +set -x + +# Clone vue-cli +git clone --depth=1 https://github.com/vuejs/vue-cli tmp/vue-cli +cd tmp/vue-cli || exit + +#==============================================================================# +# TEST # +#==============================================================================# + +startLocalRegistry "$PWD"/../../verdaccio-config.yml +yarn install +# "yarn upgrade --scope @babel --latest" doesn't seem to work. +# a means "all", while \n is the enter needed to confirm the selection. +printf "a\n" | yarn upgrade-interactive --scope @babel --latest + +# Test +CI=true yarn test -p babel + +cleanup diff --git a/scripts/parser-tests/test262/index.js b/scripts/parser-tests/test262/index.js index 0fd8eb229c42..e2f8b08fcae0 100644 --- a/scripts/parser-tests/test262/index.js +++ b/scripts/parser-tests/test262/index.js @@ -3,6 +3,7 @@ const TestStream = require("test262-stream"); const TestRunner = require("../utils/parser-test-runner"); const ignoredFeatures = [ + "AggregateError", "Array.prototype.flat", "Array.prototype.flatMap", "Array.prototype.values", @@ -31,6 +32,7 @@ const ignoredFeatures = [ "FinalizationGroup", "Float32Array", "Float64Array", + "for-in-order", "for-of", "generators", "globalThis", @@ -42,6 +44,7 @@ const ignoredFeatures = [ "Intl.DateTimeFormat-dayPeriod", "Intl.DateTimeFormat-fractionalSecondDigits", "Intl.DateTimeFormat-formatRange", + "Intl.DisplayNames", "Intl.ListFormat", "Intl.Locale", "Intl.NumberFormat-unified", @@ -76,6 +79,7 @@ const ignoredFeatures = [ "String.prototype.endsWith", "String.prototype.includes", "String.prototype.matchAll", + "String.prototype.replaceAll", "String.prototype.trimEnd", "String.prototype.trimStart", "string-trimming", @@ -118,6 +122,7 @@ const featuresToPlugins = { "class-static-fields-public": "classProperties", "class-static-fields-private": "classPrivateProperties", "class-static-methods-private": "classPrivateMethods", + "coalesce-expression": "nullishCoalescingOperator", "dynamic-import": "dynamicImport", "export-star-as-namespace-from-module": "exportNamespaceFrom", "import.meta": "importMeta",