Modules

September 22, 2015 ยท View on GitHub

This document specifies the extensions to the ESTree ES6 AST types to support this module export extensions proposal.

Modules

ExportNamedDeclaration

extend interface ExportNamedDeclaration {
    specifiers: [ ExportSpecifier | ExportDefaultSpecifier | ExportNamespaceSpecifier ];
}

Extends the ExportNamedDeclaration, e.g., export {foo} from "mod"; to allow two new types of specifiers: ExportDefaultSpecifier and ExportNamespaceSpecifier.

Note: When source is null, having specifiers include either ExportDefaultSpecifier or ExportNamespaceSpecifier results in an invalid state.

Note: Having specifiers include more than one of either ExportDefaultSpecifier or ExportNamespaceSpecifier results in an invalid state.

Note: Having specifiers include both ExportNamespaceSpecifier and ExportSpecifier results in an invalid state.

ExportDefaultSpecifier

interface ExportDefaultSpecifier <: Node {
    type: "ExportDefaultSpecifier";
    exported: Identifier;
}

An exported binding foo in export foo from "mod";. The exported field refers to the name exported in this module. That name is bound to the "default" export from the source of the parent ExportNamedDeclaration.

ExportNamespaceSpecifier

interface ExportNamespaceSpecifier <: Node {
    type: "ExportNamespaceSpecifier";
    exported: Identifier;
}

An exported binding * as ns in export * as ns from "mod";. The exported field refers to the name exported in this module. That name is bound to the ModuleNameSpace exotic object from the source of the parent ExportNamedDeclaration.