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 let Output = compile_matches
41 .get_one::<String>("Output")
42 .expect("Cannot get Output.")
43 .to_owned();
44 let Target = compile_matches
45 .get_one::<String>("Target")
46 .cloned()
47 .unwrap_or_else(|| "es2024".to_string());
48 let Module = compile_matches
49 .get_one::<String>("Module")
50 .cloned()
51 .unwrap_or_else(|| "esmodule".to_string());
52 let _SourceMaps = compile_matches.get_flag("SourceMaps");
53 let UseDefineForClassFields = compile_matches.get_flag("UseDefineForClassFields");
54 let Parallel = compile_matches.get_flag("Parallel");
55
56 let Config = crate::Struct::SWC::CompilerConfig {
58 Target,
59 Module:Module.clone(),
60 Strict:true,
61 EmitDecoratorsMetadata:true,
62 TreeShaking:true,
63 Minify:false,
64 ModuleFormat:crate::Struct::SWC::ModuleFormat::from_str(&Module),
65 };
66
67 let _ = crate::Fn::SWC::Compile::Fn(
69 crate::Struct::SWC::Option {
70 entry:vec![vec![Input.clone()]],
71 separator:std::path::MAIN_SEPARATOR,
72 pattern:".ts".to_string(),
73 config:Config,
74 output:Output,
75 use_define_for_class_fields:UseDefineForClassFields,
76 },
77 Parallel,
78 )
79 .await;
80 } else {
81 let Option = Entry::Struct::Fn(&Option::Struct::Fn(Struct::Fn()));
83
84 match Option.Parallel {
85 true => {
86 Parallel::Fn(Option).await;
87 },
88
89 false => {
90 Sequential::Fn(Option).await;
91 },
92 };
93 }
94 })
95 }),
96 }
97 }
98}
99
100use std::pin::Pin;
101
102use futures::Future;
103
104pub mod Entry;
105
106pub mod Option;
107
108use crate::Fn::Binary::Command::{Parallel, Sequential};