1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use std::sync::Arc;
use deno_ast::swc;
use deno_utils::FsModuleStore;
use crate::{
config::{get_ts_config, ConfigType},
BundleOptions, BundleType,
};
impl Default for BundleType {
fn default() -> Self {
BundleType::Module
}
}
impl From<BundleType> for swc::bundler::ModuleType {
fn from(bundle_type: BundleType) -> Self {
match bundle_type {
BundleType::Classic => Self::Iife,
BundleType::Module => Self::Es,
BundleType::MainModule => Self::Es,
}
}
}
impl Default for BundleOptions {
fn default() -> Self {
Self {
bundle_type: BundleType::Module,
ts_config: get_ts_config(ConfigType::Bundle).unwrap(),
emit_ignore_directives: false,
module_store: Some(Arc::new(FsModuleStore::default())),
minify: true,
}
}
}