Allow namespace exotic to be exported as default (#474)

This commit is contained in:
Brian Ng 2017-04-19 06:59:49 -05:00 committed by Daniel Tschinder
parent 482b8155a3
commit 17f2a2036c
3 changed files with 105 additions and 1 deletions

View File

@ -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);

View File

@ -0,0 +1 @@
export * as default from "foo";

View File

@ -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": []
}
}