swc_ecma_transforms_inferno/
lib.rs1#![deny(clippy::all)]
2#![allow(clippy::arc_with_non_send_sync)]
3
4use swc_common::{chain, comments::Comments, sync::Lrc, Mark, SourceMap};
5use swc_ecma_visit::{Fold, VisitMut};
6
7pub use self::{
8 jsx::*,
9 pure_annotations::pure_annotations,
10 refresh::{options::RefreshOptions, refresh},
11};
12
13mod inferno_flags;
14mod jsx;
15mod pure_annotations;
16mod refresh;
17mod vnode_types;
18mod atoms;
19
20pub fn inferno<C>(
30 cm: Lrc<SourceMap>,
31 comments: Option<C>,
32 mut options: Options,
33 top_level_mark: Mark,
34 unresolved_mark: Mark,
35) -> impl Fold + VisitMut
36where
37 C: Comments + Clone,
38{
39 let Options { development, .. } = options;
40 let development = development.unwrap_or(false);
41
42 let refresh_options = options.refresh.take();
43
44 chain!(
45 refresh(
46 development,
47 refresh_options,
48 cm.clone(),
49 comments.clone(),
50 top_level_mark
51 ),
52 jsx(
53 cm,
54 comments.clone(),
55 options,
56 top_level_mark,
57 unresolved_mark
58 ),
59 pure_annotations(comments),
60 )
61}