mirror of
https://github.com/danbulant/oxc
synced 2026-05-25 12:51:57 +00:00
29 lines
908 B
Rust
29 lines
908 B
Rust
#[allow(clippy::wildcard_imports)]
|
|
use oxc_ast::ast::*;
|
|
|
|
use crate::{doc::Doc, ss, Format, Prettier};
|
|
|
|
pub(super) fn print_export_declaration<'a>(
|
|
p: &mut Prettier<'a>,
|
|
decl: &ModuleDeclaration<'a>,
|
|
) -> Doc<'a> {
|
|
debug_assert!(decl.is_export());
|
|
|
|
let mut parts = p.vec();
|
|
parts.push(ss!("export"));
|
|
|
|
if decl.is_default_export() {
|
|
parts.push(ss!(" default "));
|
|
}
|
|
|
|
parts.push(match decl {
|
|
ModuleDeclaration::ImportDeclaration(decl) => unreachable!(),
|
|
ModuleDeclaration::ExportAllDeclaration(decl) => decl.format(p),
|
|
ModuleDeclaration::ExportDefaultDeclaration(decl) => decl.format(p),
|
|
ModuleDeclaration::ExportNamedDeclaration(decl) => decl.format(p),
|
|
ModuleDeclaration::TSExportAssignment(decl) => decl.format(p),
|
|
ModuleDeclaration::TSNamespaceExportDeclaration(decl) => decl.format(p),
|
|
});
|
|
|
|
Doc::Array(parts)
|
|
}
|