add AST for the module attribute proposal (#11015)

Introduce a `ImportAttribute` structure and add an `attributes` key on
the `ImportDeclaration` node.

[skip ci]
This commit is contained in:
Sven Sauleau 2020-01-17 19:58:30 +00:00 committed by Nicolò Ribaudo
parent 45301c5304
commit 34a9653281

View File

@ -107,6 +107,7 @@ These are the core @babel/parser (babylon) AST node types.
- [ImportSpecifier](#importspecifier)
- [ImportDefaultSpecifier](#importdefaultspecifier)
- [ImportNamespaceSpecifier](#importnamespacespecifier)
- [ImportAttribute](#importattribute)
- [Exports](#exports)
- [ExportNamedDeclaration](#exportnameddeclaration)
- [ExportSpecifier](#exportspecifier)
@ -1221,6 +1222,7 @@ interface ImportDeclaration <: ModuleDeclaration {
importKind: null | "type" | "typeof" | "value";
specifiers: [ ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier ];
source: Literal;
attributes?: [ ImportAttribute ];
}
```
@ -1259,6 +1261,18 @@ interface ImportNamespaceSpecifier <: ModuleSpecifier {
A namespace import specifier, e.g., `* as foo` in `import * as foo from "mod.js"`.
### ImportAttribute
```js
interface ImportAttribute <: Node {
type: "ImportAttribute";
key: Identifier;
value: StringLiteral;
}
```
An attribute specified on the ImportDeclaration.
## Exports
### ExportNamedDeclaration