File tree 4 files changed +20
-11
lines changed
4 files changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ impl FromStr for ESTarget {
27
27
fn from_str ( s : & str ) -> Result < Self , Self :: Err > {
28
28
match s. cow_to_lowercase ( ) . as_ref ( ) {
29
29
"es5" => Ok ( Self :: ES5 ) ,
30
- "es2015" => Ok ( Self :: ES2015 ) ,
30
+ "es6" | " es2015" => Ok ( Self :: ES2015 ) ,
31
31
"es2016" => Ok ( Self :: ES2016 ) ,
32
32
"es2017" => Ok ( Self :: ES2017 ) ,
33
33
"es2018" => Ok ( Self :: ES2018 ) ,
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ fn es_target() {
10
10
11
11
let cases = [
12
12
( "es5" , "() => {}" ) ,
13
+ ( "es6" , "a ** b" ) ,
13
14
( "es2015" , "a ** b" ) ,
14
15
( "es2016" , "async function foo() {}" ) ,
15
16
( "es2017" , "({ ...x })" ) ,
Original file line number Diff line number Diff line change 1
1
-- -
2
2
source : crates / oxc_transformer / tests / integrations / es_target .rs
3
+ assertion_line : 50
3
4
snapshot_kind : text
4
5
-- -
5
6
########## 0 es5
6
7
() => {}
7
8
----------
8
9
(function () {});
9
10
10
- ########## 1 es2015
11
+ ########## 1 es6
11
12
a ** b
12
13
----------
13
14
Math .pow (a , b );
14
15
15
- ########## 2 es2016
16
+ ########## 2 es2015
17
+ a ** b
18
+ ----------
19
+ Math .pow (a , b );
20
+
21
+ ########## 3 es2016
16
22
async function foo() {}
17
23
----------
18
24
import _asyncToGenerator from ' @babel/runtime/helpers/asyncToGenerator' ;
@@ -24,35 +30,35 @@ function _foo() {
24
30
return _foo .apply (this , arguments );
25
31
}
26
32
27
- ########## 3 es2017
33
+ ########## 4 es2017
28
34
({ ... x })
29
35
----------
30
36
import _objectSpread from ' @babel/runtime/helpers/objectSpread2' ;
31
37
_objectSpread ({}, x );
32
38
33
- ########## 4 es2018
39
+ ########## 5 es2018
34
40
try {} catch {}
35
41
----------
36
42
try {} catch (_unused ) {}
37
43
38
- ########## 5 es2019
44
+ ########## 6 es2019
39
45
a ? .b
40
46
----------
41
47
var _a ;
42
48
(_a = a ) === null || _a === void 0 ? void 0 : _a .b ;
43
49
44
- ########## 6 es2019
50
+ ########## 7 es2019
45
51
a ?? b
46
52
----------
47
53
var _a ;
48
54
(_a = a ) !== null && _a !== void 0 ? _a : b ;
49
55
50
- ########## 7 es2020
56
+ ########## 8 es2020
51
57
a || = b
52
58
----------
53
59
a || (a = b );
54
60
55
- ########## 8 es2019
61
+ ########## 9 es2019
56
62
1n ** 2n
57
63
----------
58
64
@@ -71,14 +77,14 @@ a || (a = b);
71
77
: ^^
72
78
` ----
73
79
74
- ########## 9 es2021
80
+ ########## 10 es2021
75
81
class foo { static {} }
76
82
----------
77
83
class foo {
78
84
static #_ = (() => {})();
79
85
}
80
86
81
- ########## 10 es2021
87
+ ########## 11 es2021
82
88
class Foo { #a ; }
83
89
----------
84
90
class Foo {
Original file line number Diff line number Diff line change @@ -57,6 +57,8 @@ describe('transform', () => {
57
57
58
58
describe ( 'target' , ( ) => {
59
59
const data = [
60
+ [ 'es5' , '() => {};\n' ] ,
61
+ [ 'es6' , 'a ** b;\n' ] ,
60
62
[ 'es2015' , 'a ** b;\n' ] ,
61
63
[ 'es2016' , 'async function foo() {}\n' ] ,
62
64
[ 'es2017' , '({ ...x });\n' ] ,
You can’t perform that action at this time.
0 commit comments