swc_ecma_minifier::option

Struct CompressOptions

source
pub struct CompressOptions {
Show 55 fields pub arguments: bool, pub arrows: bool, pub bools: bool, pub bools_as_ints: bool, pub collapse_vars: bool, pub comparisons: bool, pub computed_props: bool, pub conditionals: bool, pub dead_code: bool, pub directives: bool, pub drop_console: bool, pub drop_debugger: bool, pub ecma: EsVersion, pub evaluate: bool, pub expr: bool, pub global_defs: AHashMap<Box<Expr>, Box<Expr>>, pub hoist_fns: bool, pub hoist_props: bool, pub hoist_vars: bool, pub ie8: bool, pub if_return: bool, pub inline: u8, pub join_vars: bool, pub keep_classnames: bool, pub keep_fargs: bool, pub keep_fnames: bool, pub keep_infinity: bool, pub loops: bool, pub module: bool, pub negate_iife: bool, pub passes: usize, pub props: bool, pub pure_getters: PureGetterOption, pub pure_funcs: Vec<Box<Expr>>, pub reduce_fns: bool, pub reduce_vars: bool, pub sequences: u8, pub side_effects: bool, pub switches: bool, pub top_retain: Vec<JsWord>, pub top_level: Option<TopLevelOptions>, pub typeofs: bool, pub unsafe_passes: bool, pub unsafe_arrows: bool, pub unsafe_comps: bool, pub unsafe_function: bool, pub unsafe_math: bool, pub unsafe_symbols: bool, pub unsafe_methods: bool, pub unsafe_proto: bool, pub unsafe_regexp: bool, pub unsafe_undefined: bool, pub unused: bool, pub const_to_let: bool, pub pristine_globals: bool,
}
Expand description

https://terser.org/docs/api-reference.html#compress-options

Fields§

§arguments: bool§arrows: bool§bools: bool§bools_as_ints: bool§collapse_vars: bool§comparisons: bool§computed_props: bool§conditionals: bool§dead_code: bool§directives: bool§drop_console: bool§drop_debugger: bool§ecma: EsVersion§evaluate: bool§expr: bool

Should we simplify expressions?

§global_defs: AHashMap<Box<Expr>, Box<Expr>>

All expressions should have dummy span. Use swc_ecma_utils::drop_span to remove spans.

§hoist_fns: bool§hoist_props: bool§hoist_vars: bool§ie8: bool

No effect.

§if_return: bool§inline: u8
  • 0: disabled inlining
  • 1: inline simple functions
  • 2: inline functions with arguments
  • 3: inline functions with arguments and variables
§join_vars: bool§keep_classnames: bool§keep_fargs: bool§keep_fnames: bool§keep_infinity: bool§loops: bool§module: bool§negate_iife: bool§passes: usize

If this value is zero, the minifier will repeat work until the ast node is settled.

§props: bool§pure_getters: PureGetterOption§pure_funcs: Vec<Box<Expr>>§reduce_fns: bool§reduce_vars: bool§sequences: u8§side_effects: bool§switches: bool§top_retain: Vec<JsWord>

Top level symbols to retain.

§top_level: Option<TopLevelOptions>§typeofs: bool§unsafe_passes: bool§unsafe_arrows: bool§unsafe_comps: bool§unsafe_function: bool§unsafe_math: bool§unsafe_symbols: bool§unsafe_methods: bool§unsafe_proto: bool§unsafe_regexp: bool§unsafe_undefined: bool§unused: bool§const_to_let: bool§pristine_globals: bool

If you modified globals, set this to false.

Defaults to true.

Trait Implementations§

source§

impl Clone for CompressOptions

source§

fn clone(&self) -> CompressOptions

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for CompressOptions

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for CompressOptions

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for CompressOptions

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Serialize for CompressOptions

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T