Library/Struct/Binary/
Command.rs1pub struct Struct {
7 pub Separator:Option::Separator,
9
10 pub Fn:Box<dyn Fn() -> Pin<Box<dyn Future<Output = ()> + Send + 'static>> + Send + 'static>,
12}
13
14impl Struct {
15 pub fn Fn() -> Self {
27 Self {
28 Separator:std::path::MAIN_SEPARATOR,
29
30 Fn:Box::new(|| {
31 Box::pin(async move {
32 let Command = crate::Fn::Binary::Command::Fn();
33
34 if let Some(compile_matches) = Command.subcommand_matches("compile") {
36 let Input = compile_matches
37 .get_one::<String>("Input")
38 .expect("Cannot get Input.")
39 .to_owned();
40
41 let Output = compile_matches
42 .get_one::<String>("Output")
43 .expect("Cannot get Output.")
44 .to_owned();
45
46 let Target = compile_matches
47 .get_one::<String>("Target")
48 .cloned()
49 .unwrap_or_else(|| "es2024".to_string());
50
51 let Module = compile_matches
52 .get_one::<String>("Module")
53 .cloned()
54 .unwrap_or_else(|| "esmodule".to_string());
55
56 let _SourceMaps = compile_matches.get_flag("SourceMaps");
57
58 let UseDefineForClassFields = compile_matches.get_flag("UseDefineForClassFields");
59
60 let Parallel = compile_matches.get_flag("Parallel");
61
62 let Config = crate::Struct::SWC::CompilerConfig {
64 Target,
65 Module:Module.clone(),
66 Strict:true,
67 EmitDecoratorsMetadata:true,
68 TreeShaking:true,
69 Minify:false,
70 ModuleFormat:crate::Struct::SWC::ModuleFormat::from_str(&Module),
71 };
72
73 let _ = crate::Fn::SWC::Compile::Fn(
75 crate::Struct::SWC::Option {
76 entry:vec![vec![Input.clone()]],
77 separator:std::path::MAIN_SEPARATOR,
78 pattern:".ts".to_string(),
79 config:Config,
80 output:Output,
81 use_define_for_class_fields:UseDefineForClassFields,
82 },
83 Parallel,
84 )
85 .await;
86 } else {
87 let Option = Entry::Struct::Fn(&Option::Struct::Fn(Struct::Fn()));
89
90 match Option.Parallel {
91 true => {
92 Parallel::Fn(Option).await;
93 },
94
95 false => {
96 Sequential::Fn(Option).await;
97 },
98 };
99 }
100 })
101 }),
102 }
103 }
104}
105
106use std::pin::Pin;
107
108use futures::Future;
109
110pub mod Entry;
111
112pub mod Option;
113
114use crate::Fn::Binary::Command::{Parallel, Sequential};