oxc_transformer/env/
options.rs

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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
use oxc_diagnostics::Error;
use serde::Deserialize;
use serde_json::Value;

use super::targets::{query::Targets, Versions};

fn default_as_true() -> bool {
    true
}

#[derive(Default, Debug, Clone, Deserialize)]
#[serde(default, rename_all = "camelCase", deny_unknown_fields)]
pub struct EnvOptions {
    #[serde(default)]
    pub targets: Targets,

    #[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 {
    /// # Errors
    ///
    pub fn get_targets(&self) -> Result<Versions, Error> {
        self.targets.clone().get_targets()
    }
}