diff --git a/src/parser/statement.js b/src/parser/statement.js index 3a1eafa407..08885a009c 100644 --- a/src/parser/statement.js +++ b/src/parser/statement.js @@ -816,7 +816,7 @@ pp.parseExport = function (node) { const specifier = this.startNode(); this.next(); if (this.hasPlugin("exportExtensions") && this.eatContextual("as")) { - specifier.exported = this.parseIdentifier(); + specifier.exported = this.parseIdentifier(true); node.specifiers = [this.finishNode(specifier, "ExportNamespaceSpecifier")]; this.parseExportSpecifiersMaybe(node); this.parseExportFrom(node, true); diff --git a/test/fixtures/experimental/export-extensions/ns-default/actual.js b/test/fixtures/experimental/export-extensions/ns-default/actual.js new file mode 100644 index 0000000000..871cd28fa8 --- /dev/null +++ b/test/fixtures/experimental/export-extensions/ns-default/actual.js @@ -0,0 +1 @@ +export * as default from "foo"; diff --git a/test/fixtures/experimental/export-extensions/ns-default/expected.json b/test/fixtures/experimental/export-extensions/ns-default/expected.json new file mode 100644 index 0000000000..38c5f40bd5 --- /dev/null +++ b/test/fixtures/experimental/export-extensions/ns-default/expected.json @@ -0,0 +1,103 @@ +{ + "type": "File", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "program": { + "type": "Program", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "sourceType": "module", + "body": [ + { + "type": "ExportNamedDeclaration", + "start": 0, + "end": 31, + "loc": { + "start": { + "line": 1, + "column": 0 + }, + "end": { + "line": 1, + "column": 31 + } + }, + "specifiers": [ + { + "type": "ExportNamespaceSpecifier", + "start": 7, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 7 + }, + "end": { + "line": 1, + "column": 19 + } + }, + "exported": { + "type": "Identifier", + "start": 12, + "end": 19, + "loc": { + "start": { + "line": 1, + "column": 12 + }, + "end": { + "line": 1, + "column": 19 + }, + "identifierName": "default" + }, + "name": "default" + } + } + ], + "source": { + "type": "StringLiteral", + "start": 25, + "end": 30, + "loc": { + "start": { + "line": 1, + "column": 25 + }, + "end": { + "line": 1, + "column": 30 + } + }, + "extra": { + "rawValue": "foo", + "raw": "\"foo\"" + }, + "value": "foo" + } + } + ], + "directives": [] + } +} \ No newline at end of file