Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add missing ExportNamespaceSpecifier in spec.md #13691

Merged
merged 2 commits into from Aug 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 14 additions & 1 deletion packages/babel-parser/ast/spec.md
Expand Up @@ -119,6 +119,7 @@ These are the core @babel/parser (babylon) AST node types.
- [Exports](#exports)
- [ExportNamedDeclaration](#exportnameddeclaration)
- [ExportSpecifier](#exportspecifier)
- [ExportNamespaceSpecifier](#exportnamespacespecifier)
- [ExportDefaultDeclaration](#exportdefaultdeclaration)
- [ExportAllDeclaration](#exportalldeclaration)

Expand Down Expand Up @@ -1339,7 +1340,7 @@ An attribute specified on the ImportDeclaration.
interface ExportNamedDeclaration <: ModuleDeclaration {
type: "ExportNamedDeclaration";
declaration: Declaration | null;
specifiers: [ ExportSpecifier ];
specifiers: [ ExportSpecifier | ExportNamespaceSpecifier ];
flyinox marked this conversation as resolved.
Show resolved Hide resolved
source: StringLiteral | null;
assertions?: [ ImportAttribute ];
}
Expand All @@ -1351,6 +1352,7 @@ Note:

- Having `declaration` populated with non-empty `specifiers` or non-null `source` results in an invalid state.
- If `source` is `null`, for each `specifier` of `specifiers`, `specifier.local` can not be a `StringLiteral`.
- If `specifiers` contains `ExportNamespaceSpecifier`, it must have only one `ExportNamespaceSpecifier`.

### ExportSpecifier

Expand All @@ -1364,6 +1366,17 @@ interface ExportSpecifier <: ModuleSpecifier {

An exported variable binding, e.g., `{foo}` in `export {foo}` or `{bar as foo}` in `export {bar as foo}`. The `exported` field refers to the name exported in the module. The `local` field refers to the binding into the local module scope. If it is a basic named export, such as in `export {foo}`, both `exported` and `local` are equivalent `Identifier` nodes; in this case an `Identifier` node representing `foo`. If it is an aliased export, such as in `export {bar as foo}`, the `exported` field is an `Identifier` node representing `foo`, and the `local` field is an `Identifier` node representing `bar`.

### ExportNamespaceSpecifier

```js
interface ExportNamespaceSpecifier <: ModuleSpecifier {
type: "ExportNamespaceSpecifier";
exported: Identifier;
}
```

A namespace export specifier, e.g., `* as foo` in `export * as foo from "mod.js"`.
fedeci marked this conversation as resolved.
Show resolved Hide resolved

### ExportDefaultDeclaration

```js
Expand Down