swc_ecma_transforms_proposal/
import_attributes.rs1use swc_ecma_ast::{ExportAll, ImportDecl, NamedExport, Pass};
2use swc_ecma_visit::{noop_visit_mut_type, visit_mut_pass, VisitMut};
3
4pub fn import_attributes() -> impl Pass {
5 visit_mut_pass(ImportAssertions)
6}
7
8struct ImportAssertions;
9
10impl VisitMut for ImportAssertions {
11 noop_visit_mut_type!();
12
13 fn visit_mut_import_decl(&mut self, n: &mut ImportDecl) {
14 n.with = None;
15 }
16
17 fn visit_mut_export_all(&mut self, n: &mut ExportAll) {
18 n.with = None;
19 }
20
21 fn visit_mut_named_export(&mut self, n: &mut NamedExport) {
22 n.with = None;
23 }
24}