Skip to content

Latest commit

 

History

History
58 lines (41 loc) · 1.37 KB

File metadata and controls

58 lines (41 loc) · 1.37 KB

This document specifies the extensions to the core ESTree AST types to support the ES2025 grammar.

Modules

Imports

ImportDeclaration

extend interface ImportDeclaration {
    attributes: [ ImportAttribute ] | null;
}

The attributes is non-empty when import attributes present, e.g., import foo from "./foo.json" with { type: "json" }.

ImportAttribute

interface ImportAttribute <: Node {
    type: "ImportAttribute";
    key: Identifier | Literal;
    value: Literal;
}

An import attribute is an object-like key value pair, e.g. type: "json" in import foo from "./foo.json" with { type: "json" }. The value must be a string literal, that said, value.value is always string-type. If key is a Literal, it must be a string literal.

Exports

ExportNamedDeclaration

extend interface ExportNamedDeclaration {
    attributes: [ ImportAttribute ] | null;
}
  • attributes must be an empty array when source is null.

ExportAllDeclaration

extend interface ExportAllDeclaration {
    attributes: [ ImportAttribute ] | null;
}

Expressions

ImportExpression

extend interface ImportExpression {
    options: Expression | null;
}

The options property contains an Expression when import attributes presents, e.g., { with: { type: "json" } } in import(jsonModuleName, { with: { type: "json" } }).