1#[path = "Config.rs"]
9pub mod Config;
10#[path = "Builder.rs"]
11pub mod Builder;
12#[path = "ESBuild.rs"]
13pub mod ESBuild;
14
15pub use Config::BundleConfig;
16pub use Builder::BundleBuilder;
17pub use ESBuild::EsbuildWrapper;
18
19#[derive(Debug, Clone)]
21pub struct BundleResult {
22 pub output_path:String,
24 pub source_map_path:Option<String>,
26 pub bundled_files:Vec<String>,
28 pub hash:String,
30}
31
32#[derive(Debug, Clone)]
34pub struct BundleEntry {
35 pub source:String,
37 pub module_name:Option<String>,
39 pub is_entry:bool,
41}
42
43impl BundleEntry {
44 pub fn new(source:impl Into<String>) -> Self { Self { source:source.into(), module_name:None, is_entry:false } }
45
46 pub fn entry(source:impl Into<String>) -> Self { Self { source:source.into(), module_name:None, is_entry:true } }
47
48 pub fn with_module_name(mut self, name:impl Into<String>) -> Self {
49 self.module_name = Some(name.into());
50 self
51 }
52}
53
54#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
56pub enum BundleMode {
57 #[default]
59 SingleFile,
60 Bundle,
62 Watch,
64 Esbuild,
66}
67
68impl BundleMode {
69 pub fn requires_bundle(&self) -> bool {
70 matches!(self, BundleMode::Bundle | BundleMode::Esbuild | BundleMode::Watch)
71 }
72}