Skip to main content

stylex_transform/transform/fold/
fold_named_export.rs

1use swc_core::{
2  common::comments::Comments,
3  ecma::{ast::NamedExport, visit::FoldWith},
4};
5
6use crate::StyleXTransform;
7use stylex_enums::core::TransformationCycle;
8
9impl<C> StyleXTransform<C>
10where
11  C: Comments,
12{
13  pub(crate) fn fold_named_export_impl(&mut self, named_export: NamedExport) -> NamedExport {
14    if self.state.cycle == TransformationCycle::Skip {
15      return named_export;
16    }
17
18    if self.state.cycle == TransformationCycle::StateFilling {
19      self.state.named_exports.insert(named_export.clone());
20    }
21
22    named_export.fold_children_with(self)
23  }
24}