Parse import-assertions (#12139)

Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
This commit is contained in:
Sven Sauleau
2020-10-14 20:18:16 +01:00
committed by GitHub
parent 59d97d9bca
commit af8e0facc1
71 changed files with 1199 additions and 112 deletions

View File

@@ -180,7 +180,19 @@ export function ImportDeclaration(node: Object) {
this.print(node.source, node);
if (node.attributes?.length) {
if (node.assertions?.length) {
this.space();
this.word("assert");
this.space();
this.token("{");
this.space();
this.printList(node.assertions, node);
this.space();
this.token("}");
}
// todo(Babel 8): remove this if branch
// `module-attributes` support is discontinued, use `import-assertions` instead.
else if (node.attributes?.length) {
this.space();
this.word("with");
this.space();