swc_ecma_transforms_base/assumptions.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 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
use serde::{Deserialize, Serialize};
/// Alternative for https://babeljs.io/docs/en/assumptions
///
/// All fields default to `false`.
#[derive(
Debug, Default, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize,
)]
#[non_exhaustive]
#[serde(rename_all = "camelCase", deny_unknown_fields)]
pub struct Assumptions {
/// https://babeljs.io/docs/en/assumptions#arraylikeisiterable
#[serde(default)]
pub array_like_is_iterable: bool,
/// https://babeljs.io/docs/en/assumptions#constantreexports
#[serde(default)]
pub constant_reexports: bool,
/// https://babeljs.io/docs/en/assumptions#constantsuper
#[serde(default)]
pub constant_super: bool,
/// https://babeljs.io/docs/en/assumptions#enumerablemodulemeta
#[serde(default)]
pub enumerable_module_meta: bool,
/// https://babeljs.io/docs/en/assumptions#ignorefunctionlength
#[serde(default)]
pub ignore_function_length: bool,
#[serde(default)]
pub ignore_function_name: bool,
/// https://babeljs.io/docs/en/assumptions#ignoretoprimitivehint
#[serde(default)]
pub ignore_to_primitive_hint: bool,
/// https://babeljs.io/docs/en/assumptions#iterableisarray
#[serde(default)]
pub iterable_is_array: bool,
/// https://babeljs.io/docs/en/assumptions#mutabletemplateobject
#[serde(default)]
pub mutable_template_object: bool,
/// https://babeljs.io/docs/en/assumptions#noclasscalls
#[serde(default)]
pub no_class_calls: bool,
/// https://babeljs.io/docs/en/assumptions#nodocumentall
#[serde(default)]
pub no_document_all: bool,
/// https://babeljs.io/docs/en/assumptions#noincompletensimportdetection
#[serde(default)]
pub no_incomplete_ns_import_detection: bool,
/// https://babeljs.io/docs/en/assumptions#nonewarrows
#[serde(default)]
pub no_new_arrows: bool,
/// https://babeljs.io/docs/en/assumptions#objectrestnosymbols
#[serde(default)]
pub object_rest_no_symbols: bool,
/// https://babeljs.io/docs/en/assumptions#privatefieldsasproperties
#[serde(default)]
pub private_fields_as_properties: bool,
/// https://babeljs.io/docs/en/assumptions#puregetters
#[serde(default)]
pub pure_getters: bool,
/// https://babeljs.io/docs/en/assumptions#setclassmethods
#[serde(default)]
pub set_class_methods: bool,
/// https://babeljs.io/docs/en/assumptions#setcomputedproperties
#[serde(default)]
pub set_computed_properties: bool,
/// https://babeljs.io/docs/en/assumptions#setpublicclassfields
#[serde(default)]
pub set_public_class_fields: bool,
/// https://babeljs.io/docs/en/assumptions#setspreadproperties
#[serde(default)]
pub set_spread_properties: bool,
/// https://babeljs.io/docs/en/assumptions#skipforofiteratorclosing
#[serde(default)]
pub skip_for_of_iterator_closing: bool,
/// https://babeljs.io/docs/en/assumptions#superiscallableconstructor
#[serde(default)]
pub super_is_callable_constructor: bool,
#[serde(default)]
#[deprecated(note = "This value will be always true")]
pub ts_enum_is_readonly: bool,
}
#[allow(deprecated)]
impl Assumptions {
pub fn all() -> Self {
Self {
array_like_is_iterable: true,
constant_reexports: true,
constant_super: true,
enumerable_module_meta: true,
ignore_function_length: true,
ignore_function_name: true,
ignore_to_primitive_hint: true,
iterable_is_array: true,
mutable_template_object: true,
no_class_calls: true,
no_document_all: true,
no_incomplete_ns_import_detection: true,
no_new_arrows: true,
object_rest_no_symbols: true,
private_fields_as_properties: true,
pure_getters: true,
set_class_methods: true,
set_computed_properties: true,
set_public_class_fields: true,
set_spread_properties: true,
skip_for_of_iterator_closing: true,
super_is_callable_constructor: true,
ts_enum_is_readonly: true,
}
}
}