1pub mod config;
9pub mod builder;
10pub mod esbuild;
11
12pub use config::BundleConfig;
13pub use builder::BundleBuilder;
14pub use esbuild::EsbuildWrapper;
15
16#[derive(Debug, Clone)]
18pub struct BundleResult {
19 pub output_path:String,
21 pub source_map_path:Option<String>,
23 pub bundled_files:Vec<String>,
25 pub hash:String,
27}
28
29#[derive(Debug, Clone)]
31pub struct BundleEntry {
32 pub source:String,
34 pub module_name:Option<String>,
36 pub is_entry:bool,
38}
39
40impl BundleEntry {
41 pub fn new(source:impl Into<String>) -> Self { Self { source:source.into(), module_name:None, is_entry:false } }
42
43 pub fn entry(source:impl Into<String>) -> Self { Self { source:source.into(), module_name:None, is_entry:true } }
44
45 pub fn with_module_name(mut self, name:impl Into<String>) -> Self {
46 self.module_name = Some(name.into());
47 self
48 }
49}
50
51#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
53pub enum BundleMode {
54 #[default]
56 SingleFile,
57 Bundle,
59 Watch,
61 Esbuild,
63}
64
65impl BundleMode {
66 pub fn requires_bundle(&self) -> bool {
67 matches!(self, BundleMode::Bundle | BundleMode::Esbuild | BundleMode::Watch)
68 }
69}