fix(codegen): print necessary spaces for ExportAllDeclaration (#2190)

This commit is contained in:
Yunfei He 2024-01-28 17:05:09 +00:00 committed by GitHub
parent 41fb7ef7e7
commit d34650a1ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 3 deletions

View file

@ -805,15 +805,15 @@ impl<'a, const MINIFY: bool> Gen<MINIFY> for ExportAllDeclaration<'a> {
if self.is_typescript_syntax() {
return;
}
p.print_str(b"export");
p.print_str(b"export ");
p.print(b'*');
if let Some(exported) = &self.exported {
p.print_str(b"as ");
p.print_str(b" as ");
exported.gen(p, ctx);
}
p.print_str(b" from");
p.print_str(b" from ");
self.source.gen(p, ctx);
self.with_clause.gen(p, ctx);

View file

@ -100,3 +100,8 @@ fn template() {
test("new tag()`${x}`", "new tag()`${x}`;\n");
test("(new tag)`${x}`", "new tag()`${x}`;\n");
}
#[test]
fn module_decl() {
test("export * as foo from 'foo'", "export * as foo from 'foo';\n");
}