@@ -11,7 +11,7 @@ use serde::Deserialize;
1111use swc_atoms:: { atom, Atom } ;
1212use swc_common:: { comments:: Comments , pass:: Optional , FromVariant , Mark , SyntaxContext , DUMMY_SP } ;
1313use swc_ecma_ast:: * ;
14- use swc_ecma_compiler:: compat :: { CompatCompiler , HelperLoaderMode , TransformOptions } ;
14+ use swc_ecma_compiler:: { HelperLoaderMode , TransformOptions , Transformer } ;
1515use swc_ecma_transforms:: {
1616 compat:: {
1717 bugfixes,
6969 } } ;
7070 }
7171
72- macro_rules! add_compiler {
73- ( $( $feature: ident) |* ) => { {
74- let mut feature = swc_ecma_compiler:: Features :: empty( ) ;
75- $(
76- {
77- let f = transform_data:: Feature :: $feature;
78- let enable = !caniuse( f) ;
79-
80- if debug {
81- println!( "{}: {:?}" , f. as_str( ) , enable) ;
82- }
83-
84- if enable {
85- feature |= swc_ecma_compiler:: Features :: from( f) ;
86- }
87- }
88- ) *
89- feature
90- } } ;
91- ( | $( $feature: ident) |* ) => { {
92- add_compiler!( $( $feature) |* )
93- } } ;
94- ( $prev: expr, $( $feature: ident) |* ) => { {
95- let feature = add_compiler!( $( $feature) |* ) ;
96- (
97- $prev,
98- swc_ecma_compiler:: Compiler :: new( swc_ecma_compiler:: Config {
99- includes: feature,
100- assumptions,
101- ..Default :: default ( )
102- } ) ,
103- )
104- } } ;
105- ( $prev: expr, | $( $feature: ident) |* ) => { {
106- add_compiler!( $prev, $( $feature) |* )
107- } } ;
108- }
109-
11072 compiler_options. assumptions . set_public_class_fields = assumptions. set_public_class_fields ;
11173
11274 {
@@ -151,7 +113,7 @@ where
151113 )
152114 ) ;
153115
154- let pass = add_compiler ! ( pass, /* ES2022 */ PrivatePropertyInObject ) ;
116+ // let pass = add_compiler!(pass, /* ES2022 */ PrivatePropertyInObject);
155117
156118 if !caniuse ( Feature :: LogicalAssignmentOperators ) {
157119 compiler_options. env . es2021 . logical_assignment_operators = true ;
@@ -319,7 +281,7 @@ where
319281 bugfixes:: safari_id_destructuring_collision_in_function_expression( )
320282 ) ;
321283
322- ( visit_mut_pass ( CompatCompiler :: new ( & compiler_options) ) , pass)
284+ ( Transformer :: new ( "" . as_ref ( ) , & compiler_options) , pass)
323285}
324286
325287pub fn transform_from_env < C > (
0 commit comments