Huáng Jùnliàng 21d7ee2610 String import/export specifier (#12091)
* feat: parse moduleExportName
* feat: add validators
* Support string specifier name in commonjs transform
* Support string specifier name in export-ns-from
* test: add loose testcases
* test: add testcases for amd and umd
* feat: support systemjs
* test: update fixtures fixed in #12110
* add plugin name typings
* test: rename test layout
* feat: implement under moduleStringNames flag
* chore: add plugin syntax module string names
* feat: support ModuleExportName as ModuleExportName
* test: update test fixtures
* fix flow errors
* docs: update AST spec
* feat: support { "some imports" as "some exports" }
* feat: support { "some imports" as "some exports" } in systemjs
* test: add test on `import { "foo" }`
* Address review comments
* add moduleStringNames to missing plugin helpers
* Apply suggestions from code review
* update test fixtures
* Update packages/babel-parser/src/parser/error-message.js
* update test fixtures

Co-Authored-By: Kai Cataldo <kai@kaicataldo.com>
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-10-14 20:01:37 +02:00

111 lines
3.9 KiB
JSON

{
"type": "File",
"start":0,"end":116,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":57}},
"program": {
"type": "Program",
"start":0,"end":116,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":57}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "ImportDeclaration",
"start":0,"end":58,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":58}},
"specifiers": [
{
"type": "ImportSpecifier",
"start":9,"end":21,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":21}},
"imported": {
"type": "StringLiteral",
"start":9,"end":14,"loc":{"start":{"line":1,"column":9},"end":{"line":1,"column":14}},
"extra": {
"rawValue": "foo",
"raw": "\"foo\""
},
"value": "foo"
},
"local": {
"type": "Identifier",
"start":18,"end":21,"loc":{"start":{"line":1,"column":18},"end":{"line":1,"column":21},"identifierName":"bar"},
"name": "bar"
}
},
{
"type": "ImportSpecifier",
"start":23,"end":39,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":39}},
"imported": {
"type": "StringLiteral",
"start":23,"end":32,"loc":{"start":{"line":1,"column":23},"end":{"line":1,"column":32}},
"extra": {
"rawValue": "default",
"raw": "\"default\""
},
"value": "default"
},
"local": {
"type": "Identifier",
"start":36,"end":39,"loc":{"start":{"line":1,"column":36},"end":{"line":1,"column":39},"identifierName":"qux"},
"name": "qux"
}
}
],
"source": {
"type": "StringLiteral",
"start":47,"end":57,"loc":{"start":{"line":1,"column":47},"end":{"line":1,"column":57}},
"extra": {
"rawValue": "module-a",
"raw": "\"module-a\""
},
"value": "module-a"
}
},
{
"type": "ExportNamedDeclaration",
"start":59,"end":116,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":57}},
"specifiers": [
{
"type": "ExportNamespaceSpecifier",
"start":66,"end":76,"loc":{"start":{"line":2,"column":7},"end":{"line":2,"column":17}},
"exported": {
"type": "StringLiteral",
"start":71,"end":76,"loc":{"start":{"line":2,"column":12},"end":{"line":2,"column":17}},
"extra": {
"rawValue": "foo",
"raw": "\"foo\""
},
"value": "foo"
}
},
{
"type": "ExportSpecifier",
"start":80,"end":97,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":38}},
"local": {
"type": "Identifier",
"start":80,"end":87,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":28},"identifierName":"default"},
"name": "default"
},
"exported": {
"type": "StringLiteral",
"start":91,"end":97,"loc":{"start":{"line":2,"column":32},"end":{"line":2,"column":38}},
"extra": {
"rawValue": "quux",
"raw": "\"quux\""
},
"value": "quux"
}
}
],
"source": {
"type": "StringLiteral",
"start":105,"end":115,"loc":{"start":{"line":2,"column":46},"end":{"line":2,"column":56}},
"extra": {
"rawValue": "module-b",
"raw": "\"module-b\""
},
"value": "module-b"
},
"declaration": null
}
],
"directives": []
}
}