dbg_swc/es/minifier/
mod.rs1use std::sync::Arc;
2
3use anyhow::Result;
4use clap::Subcommand;
5use swc_common::SourceMap;
6
7use self::{
8 compare::CompareCommand, compare_opts::CompareOptsCommand, ensure_size::EnsureSize,
9 next::NextCommand, reduce::ReduceCommand,
10};
11
12mod compare;
13mod compare_opts;
14mod ensure_size;
15mod next;
16mod reduce;
17
18#[derive(Debug, Subcommand)]
20pub enum MinifierCommand {
21 #[clap(subcommand)]
22 Next(NextCommand),
23 Reduce(ReduceCommand),
24 Compare(CompareCommand),
25 CompareOpts(CompareOptsCommand),
26 EnsureSize(EnsureSize),
27}
28
29impl MinifierCommand {
30 pub fn run(self, cm: Arc<SourceMap>) -> Result<()> {
31 match self {
32 MinifierCommand::Next(cmd) => cmd.run(cm),
33 MinifierCommand::Reduce(cmd) => cmd.run(cm),
34 MinifierCommand::EnsureSize(cmd) => cmd.run(cm),
35 MinifierCommand::Compare(cmd) => cmd.run(cm),
36 MinifierCommand::CompareOpts(cmd) => cmd.run(cm),
37 }
38 }
39}