From 34a9653281812b21e2044e0180a69229d226aeae Mon Sep 17 00:00:00 2001 From: Sven Sauleau Date: Fri, 17 Jan 2020 19:58:30 +0000 Subject: [PATCH] add AST for the module attribute proposal (#11015) Introduce a `ImportAttribute` structure and add an `attributes` key on the `ImportDeclaration` node. [skip ci] --- packages/babel-parser/ast/spec.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/babel-parser/ast/spec.md b/packages/babel-parser/ast/spec.md index d1b1a51ca7..52272d2d0a 100644 --- a/packages/babel-parser/ast/spec.md +++ b/packages/babel-parser/ast/spec.md @@ -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