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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
use serde::Deserialize;
/// Compiler assumptions
///
/// For producing smaller output.
///
/// See <https://babeljs.io/docs/assumptions>
#[derive(Debug, Default, Clone, Copy, Deserialize)]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct CompilerAssumptions {
/// Assume array-like values are iterable.
#[serde(default)]
#[deprecated = "Not Implemented"]
pub array_like_is_iterable: bool,
/// Assume re-exported bindings are constant.
#[serde(default)]
#[deprecated = "Not Implemented"]
pub constant_reexports: bool,
/// Assume `super` property writes do not require runtime checks.
#[serde(default)]
#[deprecated = "Not Implemented"]
pub constant_super: bool,
/// Treat `import.meta` properties as enumerable.
#[serde(default)]
#[deprecated = "Not Implemented"]
pub enumerable_module_meta: bool,
/// Ignore `Function#length` when lowering function wrappers.
#[serde(default)]
pub ignore_function_length: bool,
/// Ignore the preferred hint passed to `Symbol.toPrimitive`.
#[serde(default)]
#[deprecated = "Not Implemented"]
pub ignore_to_primitive_hint: bool,
/// Assume iterable operations only receive arrays.
#[serde(default)]
#[deprecated = "Not Implemented"]
pub iterable_is_array: bool,
/// Emit mutable template objects.
#[serde(default)]
#[deprecated = "Not Implemented"]
pub mutable_template_object: bool,
/// Assume class constructors are never called without `new`.
#[serde(default)]
#[deprecated = "Not Implemented"]
pub no_class_calls: bool,
/// Assume `document.all` is not special-cased.
#[serde(default)]
pub no_document_all: bool,
/// Skip namespace import completeness checks.
#[serde(default)]
#[deprecated = "Not Implemented"]
pub no_incomplete_ns_import_detection: bool,
/// Assume no new `this` capture is needed for arrows.
#[serde(default)]
#[deprecated = "Not Implemented"]
pub no_new_arrows: bool,
/// Assume private fields are always initialized before access.
#[serde(default)]
#[deprecated = "Not Implemented"]
pub no_uninitialized_private_field_access: bool,
/// Assume object rest does not need to copy symbol properties.
#[serde(default)]
pub object_rest_no_symbols: bool,
/// Represent private fields as symbols.
#[serde(default)]
#[deprecated = "Not Implemented"]
pub private_fields_as_symbols: bool,
/// Represent private fields as string-keyed properties.
#[serde(default)]
pub private_fields_as_properties: bool,
/// Assume property reads can be treated as pure.
#[serde(default)]
pub pure_getters: bool,
/// Assume class methods can be assigned directly.
#[serde(default)]
#[deprecated = "Not Implemented"]
pub set_class_methods: bool,
/// Assume computed properties can be assigned directly.
#[serde(default)]
#[deprecated = "Not Implemented"]
pub set_computed_properties: bool,
/// When using public class fields, assume that they don't shadow any getter in the current class,
/// in its subclasses or in its superclass. Thus, it's safe to assign them rather than using
/// `Object.defineProperty`.
///
/// For example:
///
/// Input:
/// ```js
/// class Test {
/// field = 2;
///
/// static staticField = 3;
/// }
/// ```
///
/// When `set_public_class_fields` is `true`, the output will be:
/// ```js
/// class Test {
/// constructor() {
/// this.field = 2;
/// }
/// }
/// Test.staticField = 3;
/// ```
///
/// Otherwise, the output will be:
/// ```js
/// import _defineProperty from "@oxc-project/runtime/helpers/defineProperty";
/// class Test {
/// constructor() {
/// _defineProperty(this, "field", 2);
/// }
/// }
/// _defineProperty(Test, "staticField", 3);
/// ```
///
/// NOTE: For TypeScript, if you wanted behavior is equivalent to `useDefineForClassFields: false`, you should
/// set both `set_public_class_fields` and [`crate::TypeScriptOptions::remove_class_fields_without_initializer`]
/// to `true`.
#[serde(default)]
pub set_public_class_fields: bool,
/// Assume object spread can use direct assignment semantics.
#[serde(default)]
#[deprecated = "Not Implemented"]
pub set_spread_properties: bool,
/// Skip `for..of` iterator closing logic.
#[serde(default)]
#[deprecated = "Not Implemented"]
pub skip_for_of_iterator_closing: bool,
/// Assume `super` can be invoked as a normal callable constructor.
#[serde(default)]
#[deprecated = "Not Implemented"]
pub super_is_callable_constructor: bool,
}