-
-
Notifications
You must be signed in to change notification settings - Fork 337
/
options.rs
60 lines (54 loc) · 1.54 KB
/
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
use oxc_syntax::assumptions::CompilerAssumptions;
use crate::{
es2015::ArrowFunctionsOptions, es2020::NullishCoalescingOperatorOptions,
proposals::DecoratorsOptions, react_jsx::ReactJsxOptions, typescript::TypescriptOptions,
};
#[derive(Debug, Default, Clone)]
pub struct TransformOptions {
pub target: TransformTarget,
pub assumptions: CompilerAssumptions,
pub react_jsx: Option<ReactJsxOptions>,
pub typescript: Option<TypescriptOptions>,
// es2022
pub class_static_block: bool,
// es2021
pub logical_assignment_operators: bool,
pub numeric_separator: bool,
// es2020
pub nullish_coalescing_operator: Option<NullishCoalescingOperatorOptions>,
// es2019
pub optional_catch_binding: bool,
pub json_strings: bool,
// es2016
pub exponentiation_operator: bool,
// es2015
pub duplicate_keys: bool,
pub function_name: bool,
pub arrow_functions: Option<ArrowFunctionsOptions>,
pub shorthand_properties: bool,
pub literals: bool,
pub sticky_regex: bool,
pub template_literals: bool,
pub property_literals: bool,
pub babel_8_breaking: Option<bool>,
pub instanceof: bool,
pub new_target: bool,
// Proposal
pub decorators: Option<DecoratorsOptions>,
}
/// See <https://www.typescriptlang.org/tsconfig#target>
#[derive(Debug, Default, Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
pub enum TransformTarget {
ES3,
ES5,
ES2015,
ES2016,
ES2018,
ES2019,
ES2020,
ES2021,
ES2022,
ES2024,
#[default]
ESNext,
}