Support Import Assertions for re-export statement (#12249)

This commit is contained in:
Sosuke Suzuki
2020-10-26 23:18:45 +09:00
committed by GitHub
parent f5bd9f2013
commit faaebfe91f
33 changed files with 763 additions and 18 deletions

View File

@@ -1 +1,2 @@
import foo from "foo.json" assert { for: "for" }
export { foo } from "foo.json" assert { for: "for" }

View File

@@ -1,12 +1,13 @@
{
"type": "File",
"start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}},
"start":0,"end":101,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":52}},
"errors": [
"SyntaxError: The only accepted module attribute is `type` (1:36)"
"SyntaxError: The only accepted module attribute is `type` (1:36)",
"SyntaxError: The only accepted module attribute is `type` (2:40)"
],
"program": {
"type": "Program",
"start":0,"end":48,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":48}},
"start":0,"end":101,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":52}},
"sourceType": "module",
"interpreter": null,
"body": [
@@ -53,6 +54,56 @@
}
}
]
},
{
"type": "ExportNamedDeclaration",
"start":49,"end":101,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":52}},
"specifiers": [
{
"type": "ExportSpecifier",
"start":58,"end":61,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12}},
"local": {
"type": "Identifier",
"start":58,"end":61,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"foo"},
"name": "foo"
},
"exported": {
"type": "Identifier",
"start":58,"end":61,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"foo"},
"name": "foo"
}
}
],
"source": {
"type": "StringLiteral",
"start":69,"end":79,"loc":{"start":{"line":2,"column":20},"end":{"line":2,"column":30}},
"extra": {
"rawValue": "foo.json",
"raw": "\"foo.json\""
},
"value": "foo.json"
},
"declaration": null,
"assertions": [
{
"type": "ImportAttribute",
"start":89,"end":99,"loc":{"start":{"line":2,"column":40},"end":{"line":2,"column":50}},
"key": {
"type": "Identifier",
"start":89,"end":92,"loc":{"start":{"line":2,"column":40},"end":{"line":2,"column":43},"identifierName":"for"},
"name": "for"
},
"value": {
"type": "StringLiteral",
"start":94,"end":99,"loc":{"start":{"line":2,"column":45},"end":{"line":2,"column":50}},
"extra": {
"rawValue": "for",
"raw": "\"for\""
},
"value": "for"
}
}
]
}
],
"directives": []