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