@@ -7,7 +7,7 @@ pub mod oxc {
7
7
parser:: Parser ,
8
8
semantic:: SemanticBuilder ,
9
9
span:: SourceType ,
10
- transformer:: { JsxOptions , TransformOptions , Transformer , TypeScriptOptions } ,
10
+ transformer:: { TransformOptions , Transformer } ,
11
11
} ;
12
12
13
13
pub fn transform ( path : & Path , source_text : & str ) -> ( Allocator , String ) {
@@ -16,11 +16,7 @@ pub mod oxc {
16
16
let printed = {
17
17
let ret = Parser :: new ( & allocator, source_text, source_type) . parse ( ) ;
18
18
let mut program = ret. program ;
19
- let transform_options = TransformOptions {
20
- typescript : TypeScriptOptions :: default ( ) ,
21
- jsx : JsxOptions :: default ( ) ,
22
- ..TransformOptions :: default ( )
23
- } ;
19
+ let transform_options = TransformOptions :: from_target ( "es2015" ) . unwrap ( ) ;
24
20
let ( symbols, scopes) = SemanticBuilder :: new ( )
25
21
. build ( & program)
26
22
. semantic
@@ -42,7 +38,10 @@ pub mod swc {
42
38
use swc_common:: { source_map:: SourceMap , sync:: Lrc , Mark , GLOBALS } ;
43
39
use swc_ecma_ast:: Program ;
44
40
use swc_ecma_parser:: { EsSyntax , Parser , StringInput , Syntax , TsSyntax } ;
45
- use swc_ecma_transforms:: resolver;
41
+ use swc_ecma_transforms:: {
42
+ compat:: { es2016, es2017, es2018, es2019, es2020, es2021, es2022} ,
43
+ resolver,
44
+ } ;
46
45
use swc_ecma_transforms_react:: { react, Options , Runtime } ;
47
46
use swc_ecma_transforms_typescript:: strip;
48
47
use swc_ecma_visit:: VisitMutWith ;
@@ -87,6 +86,13 @@ pub mod swc {
87
86
top_level_mark,
88
87
unresolved_mark,
89
88
) ,
89
+ es2022 ( Default :: default ( ) , unresolved_mark) ,
90
+ es2021 ( ) ,
91
+ es2020 ( Default :: default ( ) , unresolved_mark) ,
92
+ es2019 ( ) ,
93
+ es2018 ( Default :: default ( ) ) ,
94
+ es2017 ( Default :: default ( ) , unresolved_mark) ,
95
+ es2016 ( ) ,
90
96
) ;
91
97
let program = program. apply ( & mut ast_pass) ;
92
98
0 commit comments