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

99 lines
3.5 KiB
JSON

{
"type": "File",
"start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":28}},
"errors": [
"SyntaxError: `foo` has already been exported. Exported identifiers must be unique. (2:14)"
],
"program": {
"type": "Program",
"start":0,"end":54,"loc":{"start":{"line":1,"column":0},"end":{"line":2,"column":28}},
"sourceType": "module",
"interpreter": null,
"body": [
{
"type": "VariableDeclaration",
"start":0,"end":25,"loc":{"start":{"line":1,"column":0},"end":{"line":1,"column":25}},
"declarations": [
{
"type": "VariableDeclarator",
"start":6,"end":14,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":14}},
"id": {
"type": "Identifier",
"start":6,"end":9,"loc":{"start":{"line":1,"column":6},"end":{"line":1,"column":9},"identifierName":"foo"},
"name": "foo"
},
"init": {
"type": "NumericLiteral",
"start":12,"end":14,"loc":{"start":{"line":1,"column":12},"end":{"line":1,"column":14}},
"extra": {
"rawValue": 42,
"raw": "42"
},
"value": 42
}
},
{
"type": "VariableDeclarator",
"start":16,"end":24,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":24}},
"id": {
"type": "Identifier",
"start":16,"end":19,"loc":{"start":{"line":1,"column":16},"end":{"line":1,"column":19},"identifierName":"bar"},
"name": "bar"
},
"init": {
"type": "NumericLiteral",
"start":22,"end":24,"loc":{"start":{"line":1,"column":22},"end":{"line":1,"column":24}},
"extra": {
"rawValue": 42,
"raw": "42"
},
"value": 42
}
}
],
"kind": "const"
},
{
"type": "ExportNamedDeclaration",
"start":26,"end":54,"loc":{"start":{"line":2,"column":0},"end":{"line":2,"column":28}},
"specifiers": [
{
"type": "ExportSpecifier",
"start":35,"end":38,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12}},
"local": {
"type": "Identifier",
"start":35,"end":38,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"foo"},
"name": "foo"
},
"exported": {
"type": "Identifier",
"start":35,"end":38,"loc":{"start":{"line":2,"column":9},"end":{"line":2,"column":12},"identifierName":"foo"},
"name": "foo"
}
},
{
"type": "ExportSpecifier",
"start":40,"end":52,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":26}},
"local": {
"type": "Identifier",
"start":40,"end":43,"loc":{"start":{"line":2,"column":14},"end":{"line":2,"column":17},"identifierName":"bar"},
"name": "bar"
},
"exported": {
"type": "StringLiteral",
"start":47,"end":52,"loc":{"start":{"line":2,"column":21},"end":{"line":2,"column":26}},
"extra": {
"rawValue": "foo",
"raw": "\"foo\""
},
"value": "foo"
}
}
],
"source": null,
"declaration": null
}
],
"directives": []
}
}