feat(transformer): add remaining options to transformer options (#5169)

closes #5168
This commit is contained in:
Boshen 2024-08-24 14:52:03 +00:00
parent ba62a71975
commit 01c0c3e4b2
4 changed files with 654 additions and 667 deletions

View file

@ -1,5 +1,6 @@
use oxc_diagnostics::Error;
use serde::Deserialize;
use serde_json::Value;
use super::targets::{query::Targets, Versions};
@ -15,6 +16,42 @@ pub struct EnvOptions {
#[serde(default = "default_as_true")]
pub bugfixes: bool,
/// Unused.
pub spec: bool,
/// Unused.
pub loose: bool,
/// Unused.
pub modules: Option<Value>,
/// Unused.
pub debug: bool,
/// Unused.
pub include: Option<Value>,
/// Unused.
pub exclude: Option<Value>,
/// Unused.
pub use_built_ins: Option<Value>,
/// Unused.
pub corejs: Option<Value>,
/// Unused.
pub force_all_transforms: bool,
/// Unused.
pub config_path: Option<String>,
/// Unused.
pub ignore_browserslist_config: bool,
/// Unused.
pub shipped_proposals: bool,
}
impl EnvOptions {

View file

@ -42,6 +42,9 @@ pub struct TypeScriptOptions {
// When enabled, type-only class fields are only removed if they are prefixed with the declare modifier:
#[serde(default = "default_as_true")]
pub allow_declare_fields: bool,
/// Unused.
pub optimize_const_enums: bool,
}
impl TypeScriptOptions {
@ -89,6 +92,7 @@ impl Default for TypeScriptOptions {
only_remove_type_imports: false,
allow_namespaces: default_as_true(),
allow_declare_fields: default_as_true(),
optimize_const_enums: false,
}
}
}

View file

@ -35,6 +35,7 @@ impl From<TypeScriptBindingOptions> for TypeScriptOptions {
.unwrap_or(ops.only_remove_type_imports),
allow_namespaces: options.allow_namespaces.unwrap_or(ops.allow_namespaces),
allow_declare_fields: options.allow_declare_fields.unwrap_or(ops.allow_declare_fields),
optimize_const_enums: false,
}
}
}

File diff suppressed because it is too large Load diff