pub mod runtime_mode {
use std::fmt;
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
pub enum RuntimeMode {
#[default]
Webpack,
Rspack,
}
impl fmt::Display for RuntimeMode {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
RuntimeMode::Webpack => f.write_str("webpack"),
RuntimeMode::Rspack => f.write_str("rspack"),
}
}
}
}
use runtime_mode::RuntimeMode;
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq)]
pub struct NewCacheOptions {
pub code_generation: bool,
pub devtool: bool,
pub loader: bool,
pub minimize: bool,
}
impl NewCacheOptions {
pub const fn all() -> Self {
Self {
code_generation: true,
devtool: true,
loader: true,
minimize: true,
}
}
pub const fn is_enabled(self) -> bool {
self.code_generation || self.devtool || self.loader || self.minimize
}
}
#[derive(Debug)]
pub struct Experiments {
pub css: bool,
pub new_cache: NewCacheOptions,
pub defer_import: bool,
pub source_import: bool,
pub pure_functions: bool,
pub runtime_mode: RuntimeMode,
}