Support Import Assertions for re-export statement (#12249)

This commit is contained in:
Sosuke Suzuki
2020-10-26 23:18:45 +09:00
committed by GitHub
parent f5bd9f2013
commit faaebfe91f
33 changed files with 763 additions and 18 deletions

View File

@@ -1924,6 +1924,11 @@ export default class StatementParser extends ExpressionParser {
}
}
const assertions = this.maybeParseImportAssertions();
if (assertions) {
node.assertions = assertions;
}
this.semicolon();
}

View File

@@ -360,6 +360,12 @@ export type Directive = NodeBase & {
export type DirectiveLiteral = StringLiteral & { type: "DirectiveLiteral" };
export type ImportAttribute = NodeBase & {
type: "ImportAttribute",
key: Identifier | StringLiteral,
value: StringLiteral,
};
// Expressions
export type Super = NodeBase & { type: "Super" };
@@ -867,6 +873,8 @@ export type ExportNamedDeclaration = NodeBase & {
source: ?Literal,
exportKind?: "type" | "value", // TODO: Not in spec
assertions?: $ReadOnlyArray<ImportAttribute>,
};
export type ExportSpecifier = NodeBase & {