Compare commits
978 Commits
v7.0.0-alp
...
v7.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94da889ab7 | ||
|
|
0951720a81 | ||
|
|
4a4c2f37bd | ||
|
|
5f285c1034 | ||
|
|
bfa167cc21 | ||
|
|
613b1bc192 | ||
|
|
35b111325e | ||
|
|
d7fd8888fa | ||
|
|
be58de2b62 | ||
|
|
fcdfc61bdb | ||
|
|
d89063bb32 | ||
|
|
e52f6caa18 | ||
|
|
7d6b15bba9 | ||
|
|
a69d75bdcb | ||
|
|
b4ba3cf2fa | ||
|
|
e522dd8a3c | ||
|
|
ef467a3887 | ||
|
|
35646f15a4 | ||
|
|
6298bcde03 | ||
|
|
d511cfc0e2 | ||
|
|
586a738053 | ||
|
|
841e8e9c80 | ||
|
|
b3331c0217 | ||
|
|
ca4460c0b8 | ||
|
|
597f1a12cf | ||
|
|
e01ac56b1c | ||
|
|
1e12bb6a23 | ||
|
|
2ee45bd04d | ||
|
|
38355d9230 | ||
|
|
2d6606fd5a | ||
|
|
714456f191 | ||
|
|
70a5b77943 | ||
|
|
36d8a13f4d | ||
|
|
02d0b74d37 | ||
|
|
93c3c147d6 | ||
|
|
5ea54f6cac | ||
|
|
68182bd69f | ||
|
|
4f3e633fd0 | ||
|
|
91cde0148d | ||
|
|
18dcdc958b | ||
|
|
3d43a6edb4 | ||
|
|
35312dc3d2 | ||
|
|
f9bac2a358 | ||
|
|
cc8109cdc3 | ||
|
|
f02e6847cf | ||
|
|
eae76e5b89 | ||
|
|
c1df126b83 | ||
|
|
4a8137c6b4 | ||
|
|
9f90b6f140 | ||
|
|
db6626718f | ||
|
|
73fba55c9f | ||
|
|
977c72250a | ||
|
|
9cd4716cb4 | ||
|
|
6816b26994 | ||
|
|
b492f452ce | ||
|
|
d8d35ac0c4 | ||
|
|
789ce386ed | ||
|
|
ae168edcfa | ||
|
|
6230855b71 | ||
|
|
aaeebfaf00 | ||
|
|
7c8a6cb461 | ||
|
|
0e432f0e0d | ||
|
|
e58409b144 | ||
|
|
4b440110a1 | ||
|
|
60335ce1ad | ||
|
|
81496ab7b1 | ||
|
|
3746273eda | ||
|
|
828aec757a | ||
|
|
a85a404175 | ||
|
|
a390a92d6a | ||
|
|
f20f8b164f | ||
|
|
3bac67b4b9 | ||
|
|
8339e036bf | ||
|
|
655d1cc91b | ||
|
|
258e3383bd | ||
|
|
9418945a1f | ||
|
|
f48e32bab7 | ||
|
|
832408e85d | ||
|
|
455cb5b8d8 | ||
|
|
c8835cbbee | ||
|
|
1938f490b3 | ||
|
|
f0ab0f81d3 | ||
|
|
048a5b8021 | ||
|
|
23f98a753a | ||
|
|
fc448ca8f2 | ||
|
|
c4696a5bd2 | ||
|
|
a599c49436 | ||
|
|
7455e58270 | ||
|
|
9a4b764bde | ||
|
|
2d7cda4d28 | ||
|
|
073a0dc823 | ||
|
|
508597aadc | ||
|
|
0368d41441 | ||
|
|
e65994e43d | ||
|
|
b79df60fe6 | ||
|
|
9dfcf0f116 | ||
|
|
0125c03303 | ||
|
|
14ace422c3 | ||
|
|
f11cce1d7c | ||
|
|
9b0f509433 | ||
|
|
8bea5f4f16 | ||
|
|
ed6e6fd7dd | ||
|
|
5eda451fb8 | ||
|
|
ed3603ef44 | ||
|
|
11715cb7af | ||
|
|
ec9754bc40 | ||
|
|
84184e2ddd | ||
|
|
a1c268667a | ||
|
|
d159c468b2 | ||
|
|
a9dd7d970f | ||
|
|
e7aaf1f361 | ||
|
|
70547efcc1 | ||
|
|
195745f25f | ||
|
|
c821d3a591 | ||
|
|
5a2a5fb411 | ||
|
|
0379060f8a | ||
|
|
8aabbbc822 | ||
|
|
314bd31b85 | ||
|
|
4c517a8912 | ||
|
|
4bd9d751f4 | ||
|
|
413ffe6639 | ||
|
|
6012c5bedb | ||
|
|
2374062bbd | ||
|
|
b115ea5da7 | ||
|
|
d8b7bc39af | ||
|
|
0f8c4dc5a1 | ||
|
|
69f237b743 | ||
|
|
72da5e1d02 | ||
|
|
9159323b1e | ||
|
|
88b7983e4f | ||
|
|
2b88e079ef | ||
|
|
8e6b5de042 | ||
|
|
aebebd3dde | ||
|
|
f23dd3a04c | ||
|
|
fec79e358c | ||
|
|
7c971f3d4d | ||
|
|
03d7089b43 | ||
|
|
b83fa26937 | ||
|
|
23121d2bd3 | ||
|
|
5b9112c794 | ||
|
|
8597219ce5 | ||
|
|
5c824273bc | ||
|
|
8dffbf19d0 | ||
|
|
27b155aa71 | ||
|
|
57584268cd | ||
|
|
174eaa058a | ||
|
|
4519f95a29 | ||
|
|
fc1e1c5668 | ||
|
|
bd734f03fb | ||
|
|
9f0f8d99d5 | ||
|
|
8b97a8acf9 | ||
|
|
e98bb3dc60 | ||
|
|
24713e5040 | ||
|
|
51b0b06a25 | ||
|
|
3cdb7d7f0f | ||
|
|
f5ad86c5c6 | ||
|
|
c815cf554f | ||
|
|
745c4740af | ||
|
|
5fae81f43f | ||
|
|
efe5c7928a | ||
|
|
1c14fb1227 | ||
|
|
41f419a2fc | ||
|
|
4df876b4b5 | ||
|
|
9a0dd4e001 | ||
|
|
583a875d22 | ||
|
|
5f5ad940ed | ||
|
|
f35cf8185b | ||
|
|
7f390b0282 | ||
|
|
bf93be47c2 | ||
|
|
cdb34c3aa2 | ||
|
|
3c93189fce | ||
|
|
b6ae55153c | ||
|
|
2801bfe35c | ||
|
|
637bba542a | ||
|
|
c65742602b | ||
|
|
18f77b3aa9 | ||
|
|
f3fe5001e6 | ||
|
|
0ea295e83b | ||
|
|
634c750558 | ||
|
|
158e9fbfd7 | ||
|
|
0c5fae2faa | ||
|
|
7179136401 | ||
|
|
5bb6a83fa8 | ||
|
|
5006c81b77 | ||
|
|
1e750a945c | ||
|
|
f17d30692c | ||
|
|
95e08b6d2a | ||
|
|
47a254025a | ||
|
|
20679979fc | ||
|
|
feed22c822 | ||
|
|
a381f9b5f0 | ||
|
|
1cdacf85ae | ||
|
|
1c13250807 | ||
|
|
8742012b5e | ||
|
|
4daf11528c | ||
|
|
c47258d68c | ||
|
|
c4f6a7a06f | ||
|
|
1341e4163b | ||
|
|
b6467a68ca | ||
|
|
5565e1b406 | ||
|
|
6560a29c36 | ||
|
|
4e612058c0 | ||
|
|
4e7961dcf8 | ||
|
|
bbac1ebe45 | ||
|
|
7c70b27b53 | ||
|
|
777a9ae6e4 | ||
|
|
3a2b7fe3cd | ||
|
|
d6ba4d0a24 | ||
|
|
5df70e6a94 | ||
|
|
ca117e08cb | ||
|
|
2dd03e3ee9 | ||
|
|
4f441ff27e | ||
|
|
f7109658f9 | ||
|
|
f39811d271 | ||
|
|
fad9345c85 | ||
|
|
1797ac5015 | ||
|
|
76161e0a73 | ||
|
|
ab30fa54cb | ||
|
|
44f6ff5e85 | ||
|
|
6108bee4f9 | ||
|
|
0189b38702 | ||
|
|
22ff8be4a7 | ||
|
|
39bd9b58e1 | ||
|
|
b82b65a31e | ||
|
|
5196b94fa5 | ||
|
|
5e7fce3fe0 | ||
|
|
84580cc2d1 | ||
|
|
d70603ffa9 | ||
|
|
d79a7920a1 | ||
|
|
2846e06db1 | ||
|
|
beff7809ea | ||
|
|
0a4f1b0a6e | ||
|
|
75861fac87 | ||
|
|
b2b3d7944a | ||
|
|
827d84536a | ||
|
|
3e487f89ab | ||
|
|
40805894c5 | ||
|
|
95dd16aeeb | ||
|
|
ac6eda2709 | ||
|
|
7af44fce75 | ||
|
|
960151c876 | ||
|
|
7795750862 | ||
|
|
2d8fdf3045 | ||
|
|
a70cda812c | ||
|
|
4b297907d1 | ||
|
|
48c114169f | ||
|
|
68786c4f0f | ||
|
|
1ef5871300 | ||
|
|
c3e8715010 | ||
|
|
d8b4073536 | ||
|
|
3c4f19a28d | ||
|
|
2db0c3ad1d | ||
|
|
f0e49dceb5 | ||
|
|
93ebb58e28 | ||
|
|
0507c067f4 | ||
|
|
4577bd1b7c | ||
|
|
93cf26abca | ||
|
|
62c22c7b5d | ||
|
|
63baaa7148 | ||
|
|
7e726a81e6 | ||
|
|
9e4e64dac9 | ||
|
|
3569cb9922 | ||
|
|
c6a094a9d2 | ||
|
|
879bd8f850 | ||
|
|
cee4cde53e | ||
|
|
aa330999d0 | ||
|
|
5749276d7e | ||
|
|
7b30f77954 | ||
|
|
6ab3b4c0e3 | ||
|
|
70ab2e0620 | ||
|
|
0d16499fc0 | ||
|
|
77bbe20352 | ||
|
|
bd569433c4 | ||
|
|
fffa604023 | ||
|
|
e08ff8e650 | ||
|
|
b660f61b92 | ||
|
|
5fb282f73f | ||
|
|
7cc5580c71 | ||
|
|
2eaff3d01c | ||
|
|
b684699f79 | ||
|
|
f4716dc816 | ||
|
|
d375d80001 | ||
|
|
98824e7cb7 | ||
|
|
c28465e03e | ||
|
|
4ca686b7be | ||
|
|
b84f8e9234 | ||
|
|
9e51038ad9 | ||
|
|
777a8e2bb4 | ||
|
|
ad1f87cf07 | ||
|
|
bd915ad8dc | ||
|
|
a04c18af71 | ||
|
|
0538c3cd8c | ||
|
|
cd66657f34 | ||
|
|
9243c78ea2 | ||
|
|
218f191a59 | ||
|
|
3154c2c114 | ||
|
|
4fdd75695b | ||
|
|
9c91e35ce4 | ||
|
|
3a55e1326c | ||
|
|
370559c62f | ||
|
|
a74b307752 | ||
|
|
b41fe4efb1 | ||
|
|
68d2f8d161 | ||
|
|
1c1ce5a9e4 | ||
|
|
ab76cb6b53 | ||
|
|
009d7f0b76 | ||
|
|
48a4675fed | ||
|
|
f667f07d82 | ||
|
|
dbd65d93bb | ||
|
|
75f11cfec9 | ||
|
|
94f54da30b | ||
|
|
d85c642617 | ||
|
|
79f4956948 | ||
|
|
7f92e1d9dd | ||
|
|
e37a5eb5eb | ||
|
|
66ec5263a4 | ||
|
|
13d931c417 | ||
|
|
47a9ba3440 | ||
|
|
a1debae8f0 | ||
|
|
30c4d6b456 | ||
|
|
0e58007264 | ||
|
|
577173cc02 | ||
|
|
8c457e9283 | ||
|
|
2a83867436 | ||
|
|
9dd65c809f | ||
|
|
af5f34ace5 | ||
|
|
57da9bdbed | ||
|
|
d86ae2fb84 | ||
|
|
18084db7cf | ||
|
|
8e19a5b057 | ||
|
|
95882d4e5a | ||
|
|
99ab2b206c | ||
|
|
77cfa94682 | ||
|
|
78157ebabd | ||
|
|
e5fd7407c9 | ||
|
|
79c6814d65 | ||
|
|
d479673074 | ||
|
|
6630ae9794 | ||
|
|
6bb1486405 | ||
|
|
75808a2d14 | ||
|
|
4e9a25e34a | ||
|
|
0f823beeb1 | ||
|
|
829c75a866 | ||
|
|
9d7c82d869 | ||
|
|
21eeed8a8c | ||
|
|
889f4e7791 | ||
|
|
f7a096b08e | ||
|
|
1dd3d14a2f | ||
|
|
bba7be20d2 | ||
|
|
c5e81516dd | ||
|
|
6d965c0926 | ||
|
|
2dba910b9e | ||
|
|
e32042f353 | ||
|
|
c1d07fd6db | ||
|
|
f83c83d49c | ||
|
|
605adc922d | ||
|
|
593cbc1d53 | ||
|
|
5c45753cd6 | ||
|
|
1563221171 | ||
|
|
c8d2361897 | ||
|
|
c92846d623 | ||
|
|
b242e0d946 | ||
|
|
9322fd0458 | ||
|
|
f01438e9b1 | ||
|
|
9f8de8f542 | ||
|
|
18afff2f85 | ||
|
|
ce5d1d0f59 | ||
|
|
7f1cd44d60 | ||
|
|
2841945095 | ||
|
|
76060bb2c7 | ||
|
|
84dfa659e7 | ||
|
|
e0b4543601 | ||
|
|
248743e6c5 | ||
|
|
9a1b8ea443 | ||
|
|
55aea26f13 | ||
|
|
fb9a752262 | ||
|
|
4a35243118 | ||
|
|
9fc910d8c0 | ||
|
|
51a293601b | ||
|
|
4d51052037 | ||
|
|
5fa460ff2a | ||
|
|
19c4dd2d8c | ||
|
|
2225892348 | ||
|
|
677160385c | ||
|
|
9b04cbbc4f | ||
|
|
4aca487b6d | ||
|
|
5afe40b095 | ||
|
|
b081f68e87 | ||
|
|
c9ed159a18 | ||
|
|
b9ed9919c1 | ||
|
|
04b4e414ad | ||
|
|
d156afff2e | ||
|
|
0b890ced19 | ||
|
|
c60bf9a897 | ||
|
|
245c78dcdc | ||
|
|
8a98141b60 | ||
|
|
78544417fc | ||
|
|
c6edce115c | ||
|
|
fe13ba8fc2 | ||
|
|
579499c66d | ||
|
|
36dc6ee5dc | ||
|
|
827c70e015 | ||
|
|
8a5488e59f | ||
|
|
63204ae51e | ||
|
|
28ae47a174 | ||
|
|
fa0b73ba33 | ||
|
|
aa684d1b0c | ||
|
|
6ae350773e | ||
|
|
1fdec955f8 | ||
|
|
213ad1ed7a | ||
|
|
797fb3c2e4 | ||
|
|
9d612e717e | ||
|
|
e919c6e6eb | ||
|
|
8e8ddc3ccb | ||
|
|
d82afb407e | ||
|
|
b858d7ce5e | ||
|
|
b83e0ec7b0 | ||
|
|
a0f0411abf | ||
|
|
8decefe8bc | ||
|
|
650cd43096 | ||
|
|
03f249430a | ||
|
|
8460b4c62f | ||
|
|
4710b8a5ba | ||
|
|
81e87b0838 | ||
|
|
465c087ac0 | ||
|
|
bc123ad02a | ||
|
|
e170e6d760 | ||
|
|
960e1708a1 | ||
|
|
2ce5f166d7 | ||
|
|
a7a9e7ae17 | ||
|
|
51ff4dd936 | ||
|
|
628061c501 | ||
|
|
003b8918c2 | ||
|
|
72183ff2e9 | ||
|
|
f70c9f11fc | ||
|
|
a99f77a211 | ||
|
|
9f8a44ab7a | ||
|
|
65fa461a59 | ||
|
|
eff645a900 | ||
|
|
b73dac4f63 | ||
|
|
7e718e1e46 | ||
|
|
51ace73e7c | ||
|
|
47cec5439a | ||
|
|
ca37d4919d | ||
|
|
5152b370e7 | ||
|
|
899c57b960 | ||
|
|
0c847c4571 | ||
|
|
9ad660bbe1 | ||
|
|
58ec149c52 | ||
|
|
b3372a572d | ||
|
|
bc29145465 | ||
|
|
48c770e4bb | ||
|
|
3cf4cee40a | ||
|
|
ed0de70656 | ||
|
|
9a75916012 | ||
|
|
a4080dc095 | ||
|
|
4e50b2d9d9 | ||
|
|
e4b35f680d | ||
|
|
93cc22dae1 | ||
|
|
89d8f70fcd | ||
|
|
f363ec6b99 | ||
|
|
b3183b1198 | ||
|
|
892377ae57 | ||
|
|
95b3c8a16a | ||
|
|
12e39116f0 | ||
|
|
0005b9e4cf | ||
|
|
1fb3d5b0f6 | ||
|
|
bd9e1860d0 | ||
|
|
692e51609c | ||
|
|
bb5528b414 | ||
|
|
033bad3098 | ||
|
|
2cfd01aeb6 | ||
|
|
ddba7ba89f | ||
|
|
851d2cb6e0 | ||
|
|
a330cf2b09 | ||
|
|
b6b69c615a | ||
|
|
4fdff567c6 | ||
|
|
622672d397 | ||
|
|
64eafad472 | ||
|
|
1ea3b0601c | ||
|
|
5492fe130a | ||
|
|
8a4ab088e4 | ||
|
|
ba671d0a66 | ||
|
|
4595729cbb | ||
|
|
3b28bd2cb1 | ||
|
|
5387d9f903 | ||
|
|
fea3a72838 | ||
|
|
ac99d73e88 | ||
|
|
05726a976e | ||
|
|
070662e381 | ||
|
|
cdca54aed3 | ||
|
|
4081f3e23e | ||
|
|
1b29ab1289 | ||
|
|
cce83a0cea | ||
|
|
f1303aa54c | ||
|
|
dd82d7a653 | ||
|
|
ac33b1be27 | ||
|
|
ccd314cba7 | ||
|
|
82f37841f5 | ||
|
|
36ab72f095 | ||
|
|
bc013e6d34 | ||
|
|
0c8fdc381d | ||
|
|
9b05b0df5c | ||
|
|
119d5c5871 | ||
|
|
0740e61131 | ||
|
|
97f4d31192 | ||
|
|
9850f82351 | ||
|
|
97d0ab78cb | ||
|
|
f537fc7da7 | ||
|
|
462825b15a | ||
|
|
9e91ac54d3 | ||
|
|
54d9732d0b | ||
|
|
d92309f0db | ||
|
|
faa6c9f708 | ||
|
|
6cc2f5dc78 | ||
|
|
a62cb9281e | ||
|
|
ef87acc389 | ||
|
|
1f22ac353a | ||
|
|
0e5f597ee6 | ||
|
|
899634d20b | ||
|
|
b048bff77d | ||
|
|
9ce797dd34 | ||
|
|
acdd3637bc | ||
|
|
85b6b4b1b2 | ||
|
|
5fe4803562 | ||
|
|
30ee87159d | ||
|
|
2a496890ff | ||
|
|
3fae121460 | ||
|
|
750b03a22f | ||
|
|
98487b5a15 | ||
|
|
a9d8040c0f | ||
|
|
3faca62a77 | ||
|
|
cc6959e1fa | ||
|
|
6bd3bf4d2f | ||
|
|
ed15443dba | ||
|
|
64ff5a080d | ||
|
|
72259ca5d3 | ||
|
|
00f58b9bfa | ||
|
|
5cc1cbf3bc | ||
|
|
8df5514083 | ||
|
|
123dce5fcd | ||
|
|
783d85ee4b | ||
|
|
b0524427c1 | ||
|
|
53e3f0dbdc | ||
|
|
c4fd05c0c2 | ||
|
|
c568150759 | ||
|
|
1e55653ac1 | ||
|
|
272209ace5 | ||
|
|
794a522fb6 | ||
|
|
ed80a4e84d | ||
|
|
d6245af802 | ||
|
|
b2102baaae | ||
|
|
41b0a79837 | ||
|
|
36e017b427 | ||
|
|
7e739f954d | ||
|
|
bf9b434736 | ||
|
|
819056e94a | ||
|
|
432495752d | ||
|
|
c5bad22767 | ||
|
|
68ed633175 | ||
|
|
489cf90d23 | ||
|
|
0230dc5067 | ||
|
|
dcbb6c5ce5 | ||
|
|
b296759852 | ||
|
|
51f3ab45c4 | ||
|
|
7945c53389 | ||
|
|
9062995324 | ||
|
|
eaf8d4589a | ||
|
|
6ad103b756 | ||
|
|
fa69bfc755 | ||
|
|
5b261849e0 | ||
|
|
0fcfcc5bf2 | ||
|
|
3b4c36f9e4 | ||
|
|
08d397af14 | ||
|
|
842d0540a4 | ||
|
|
58c686378d | ||
|
|
9a92933589 | ||
|
|
9b9318493e | ||
|
|
a3654478df | ||
|
|
a4e6f90d06 | ||
|
|
0781f711d0 | ||
|
|
72591a0ebd | ||
|
|
5f866f2d92 | ||
|
|
37c8da674a | ||
|
|
ddd6d66bc6 | ||
|
|
d320d0c587 | ||
|
|
4d96adaf3c | ||
|
|
b0ff26985f | ||
|
|
84c38182ad | ||
|
|
14e9fbf345 | ||
|
|
0667160b11 | ||
|
|
e1cb75989f | ||
|
|
ea22361673 | ||
|
|
d6202dc741 | ||
|
|
782d933d5f | ||
|
|
3570ba7c28 | ||
|
|
60adcd68a0 | ||
|
|
e54c30c285 | ||
|
|
aad13388c7 | ||
|
|
285b35e8b3 | ||
|
|
7624648623 | ||
|
|
ccc31f7878 | ||
|
|
2b9b69dc32 | ||
|
|
50539f86c0 | ||
|
|
79a0f8c458 | ||
|
|
ba6fa252c0 | ||
|
|
a35684988b | ||
|
|
e54cef60a5 | ||
|
|
2c5ff923d1 | ||
|
|
c478c429ea | ||
|
|
88856fc1f2 | ||
|
|
75db91940e | ||
|
|
64cfc43883 | ||
|
|
1e11a32c44 | ||
|
|
7acf4a46f0 | ||
|
|
1fca73a1b7 | ||
|
|
e4d2c4e346 | ||
|
|
4648bb6022 | ||
|
|
a139b12a86 | ||
|
|
f9517db461 | ||
|
|
f51e082687 | ||
|
|
9abd056ccd | ||
|
|
d60cd65213 | ||
|
|
3dee64d1e1 | ||
|
|
2f28de5d70 | ||
|
|
de29bb374f | ||
|
|
1d8b6b043f | ||
|
|
243d5d1a02 | ||
|
|
9732524aaf | ||
|
|
444025a764 | ||
|
|
5d8a091336 | ||
|
|
412180e203 | ||
|
|
a1a795321a | ||
|
|
11b7db05fb | ||
|
|
2e231bb976 | ||
|
|
ca435b6d48 | ||
|
|
982aba38e4 | ||
|
|
c1b3740707 | ||
|
|
e9bc213b14 | ||
|
|
e2c2d7d742 | ||
|
|
2cb4d08d19 | ||
|
|
149acc40bd | ||
|
|
d40cb31685 | ||
|
|
5248f499b3 | ||
|
|
3f5b1490c2 | ||
|
|
d7c18cf9fa | ||
|
|
3c8eeec515 | ||
|
|
5b64743864 | ||
|
|
88f18f5482 | ||
|
|
adf5045e66 | ||
|
|
4ed8904205 | ||
|
|
f2de82a368 | ||
|
|
b2524770f9 | ||
|
|
3c1836ab43 | ||
|
|
bfe22a945a | ||
|
|
79573baa16 | ||
|
|
1e4e071c25 | ||
|
|
556b3743f6 | ||
|
|
d71169f3b0 | ||
|
|
f8da5e3457 | ||
|
|
c63c2fc49b | ||
|
|
afa3ad97d1 | ||
|
|
5cbe963dde | ||
|
|
200edc8e8c | ||
|
|
88d4df437e | ||
|
|
fd3a2c285a | ||
|
|
a48cf8b53f | ||
|
|
cb1c5eaf97 | ||
|
|
3534bc872d | ||
|
|
66f8546107 | ||
|
|
bf31fff83e | ||
|
|
38fa457a88 | ||
|
|
f1bf68364c | ||
|
|
016c9ad94c | ||
|
|
f33bea1363 | ||
|
|
7df557a269 | ||
|
|
c10528254b | ||
|
|
cf5ea69073 | ||
|
|
804329e221 | ||
|
|
624c2868c0 | ||
|
|
9b4c33d44e | ||
|
|
83b85a3609 | ||
|
|
af2b162175 | ||
|
|
60df9f3cad | ||
|
|
db1fd15616 | ||
|
|
9733e89cd8 | ||
|
|
234568cd51 | ||
|
|
8663c37888 | ||
|
|
4ffe1f2e52 | ||
|
|
da97567ee9 | ||
|
|
bd944ccf56 | ||
|
|
ae3e7cb4a9 | ||
|
|
0052e16853 | ||
|
|
c4c9a7fc88 | ||
|
|
9a5ab8cfea | ||
|
|
0443dcd7cd | ||
|
|
ae3dfda1d6 | ||
|
|
fc03259a2b | ||
|
|
a9f7c7db4c | ||
|
|
b3bfd40195 | ||
|
|
03de20f043 | ||
|
|
8e528fdacf | ||
|
|
f2f226b4f2 | ||
|
|
ddfb6f2c44 | ||
|
|
70354013f1 | ||
|
|
c42e027602 | ||
|
|
18d6ba9947 | ||
|
|
c82b084927 | ||
|
|
45b41740d8 | ||
|
|
b608e28aa7 | ||
|
|
06f67e1ad3 | ||
|
|
b5bb89b30a | ||
|
|
cd3dbe700c | ||
|
|
b7c04d43ca | ||
|
|
040404085b | ||
|
|
f77b875875 | ||
|
|
d309b25b19 | ||
|
|
9237206337 | ||
|
|
9565dfed54 | ||
|
|
35068a6626 | ||
|
|
41ddbc03c9 | ||
|
|
1fe146f274 | ||
|
|
6babbd981a | ||
|
|
d71cee8fa1 | ||
|
|
8b99386491 | ||
|
|
0c2e3b1045 | ||
|
|
9b410be61c | ||
|
|
f81d7496b1 | ||
|
|
1b5df314d9 | ||
|
|
dde487a0c6 | ||
|
|
9f74e10959 | ||
|
|
8b19c74606 | ||
|
|
f9f31c2120 | ||
|
|
9d890f57bb | ||
|
|
72b1f38f91 | ||
|
|
22dab1fa95 | ||
|
|
32ebccd050 | ||
|
|
f81aef3c22 | ||
|
|
ce78265443 | ||
|
|
1e9cf572a8 | ||
|
|
337da3c641 | ||
|
|
88cfe1b635 | ||
|
|
f521884d01 | ||
|
|
4312ad922b | ||
|
|
07e18669af | ||
|
|
1738cb6690 | ||
|
|
7d7f06c10e | ||
|
|
4cf4ac6cbb | ||
|
|
ded253f1ad | ||
|
|
3a9f6e93c4 | ||
|
|
5537635175 | ||
|
|
37bd909e15 | ||
|
|
1584fbe176 | ||
|
|
d6a6ee4045 | ||
|
|
fe6a606c58 | ||
|
|
ba2b58e57f | ||
|
|
84d4b9de5d | ||
|
|
7dfcba6f16 | ||
|
|
8f0e70bad4 | ||
|
|
970f8ebaf8 | ||
|
|
7348637a1e | ||
|
|
6c20876fd2 | ||
|
|
0ede95a640 | ||
|
|
cd0c019b24 | ||
|
|
6ee5b0c5ac | ||
|
|
349e31b665 | ||
|
|
4966544002 | ||
|
|
a68d98d1a5 | ||
|
|
6a2b6fc0e0 | ||
|
|
7e622940a4 | ||
|
|
7d00281b2b | ||
|
|
6edae49d4d | ||
|
|
b5af93f348 | ||
|
|
ed14b86fe3 | ||
|
|
71e4767014 | ||
|
|
c2c96995a1 | ||
|
|
8d96bd2378 | ||
|
|
09c84a379f | ||
|
|
984df9c96a | ||
|
|
c468d68cb8 | ||
|
|
55ccfbf6a0 | ||
|
|
540c382637 | ||
|
|
5233afabd9 | ||
|
|
f6db04d8db | ||
|
|
ecfcb31bf6 | ||
|
|
393746d781 | ||
|
|
68c2a725c6 | ||
|
|
2e0f64256f | ||
|
|
93b8b0735b | ||
|
|
1bc8325679 | ||
|
|
2d1768209d | ||
|
|
8e05140280 | ||
|
|
1bb8f30b24 | ||
|
|
ab87ff071c | ||
|
|
70817b1fe4 | ||
|
|
3384e36671 | ||
|
|
ea417727dc | ||
|
|
058c86715d | ||
|
|
a9c31797dc | ||
|
|
fcf1d7a33a | ||
|
|
4367fba31e | ||
|
|
1092dde11c | ||
|
|
bc02c95ef0 | ||
|
|
963249fc4b | ||
|
|
33b8cc5cbb | ||
|
|
3e41a2dacb | ||
|
|
4cefa5bcc0 | ||
|
|
235b1ba264 | ||
|
|
69870774e7 | ||
|
|
80f93f3d87 | ||
|
|
05353d5392 | ||
|
|
960ca93b7f | ||
|
|
ad5698ed19 | ||
|
|
da75840794 | ||
|
|
2450f7a5ae | ||
|
|
5fe1ee3a6a | ||
|
|
28e54d4d5f | ||
|
|
cb260bff06 | ||
|
|
7552cb5b0a | ||
|
|
6edb5a46a1 | ||
|
|
70bebfae93 | ||
|
|
fa8f09bc6e | ||
|
|
74f2fb17a1 | ||
|
|
e56c318eed | ||
|
|
db7e87b219 | ||
|
|
9031ea073c | ||
|
|
7ef4313141 | ||
|
|
1815ffab14 | ||
|
|
dc46adf519 | ||
|
|
0ac127ce60 | ||
|
|
a9181a218c | ||
|
|
76e12a3cae | ||
|
|
ec99493e53 | ||
|
|
ad23d2ee39 | ||
|
|
1fa3916f75 | ||
|
|
63c0931340 | ||
|
|
c0b8f5b604 | ||
|
|
6cb4e8ddcc | ||
|
|
783a0bdc9c | ||
|
|
44b140af23 | ||
|
|
da8ed9643b | ||
|
|
e3abd80927 | ||
|
|
c6afaa74d4 | ||
|
|
dabac6ed5f | ||
|
|
a6cbb76a0b | ||
|
|
72f2cc59ed | ||
|
|
4760d2ed09 | ||
|
|
88227f0677 | ||
|
|
bf9ff5c4e6 | ||
|
|
f4788264c5 | ||
|
|
dbcd9f4ad6 | ||
|
|
01415d3fd8 | ||
|
|
7e8fbd5177 | ||
|
|
c9ff11ccb8 | ||
|
|
206f60767b | ||
|
|
b5e00eeb5b | ||
|
|
45370e3553 | ||
|
|
0ad9b7a177 | ||
|
|
81c157b285 | ||
|
|
3ef4001521 | ||
|
|
e379681b58 | ||
|
|
8622d0af39 | ||
|
|
635e76c85a | ||
|
|
823facba3f | ||
|
|
9439b7fe1a | ||
|
|
4a27c280ba | ||
|
|
a9d99fd135 | ||
|
|
51fd3dafd1 | ||
|
|
69161decd3 | ||
|
|
8346c0db41 | ||
|
|
a98e1a0604 | ||
|
|
37c1e40e5c | ||
|
|
b78eb34fa6 | ||
|
|
21dfdd8bbb | ||
|
|
3b60dc5444 | ||
|
|
9a69fff935 | ||
|
|
f1619e9b16 | ||
|
|
44c40cf7ab | ||
|
|
b8f03ee09d | ||
|
|
552f587082 | ||
|
|
64ed1ba167 | ||
|
|
a38f07181d | ||
|
|
b44949025a | ||
|
|
08cd975eb4 | ||
|
|
d2976bed13 | ||
|
|
66ab523dd6 | ||
|
|
d318916416 | ||
|
|
541ebb5e5f | ||
|
|
8e2aa82991 | ||
|
|
5d32ca6bb3 | ||
|
|
69e9138637 | ||
|
|
771e5d2cd6 | ||
|
|
bd1ed28242 | ||
|
|
4d40b6ab5b | ||
|
|
99c078e92a | ||
|
|
6ffd13af85 | ||
|
|
a238bf368a | ||
|
|
7a18a01411 | ||
|
|
066445ca30 | ||
|
|
d06270498b | ||
|
|
3a7a1b9221 | ||
|
|
36c6fcaf23 | ||
|
|
7afe25bda1 | ||
|
|
c09532f035 | ||
|
|
6c58d93602 | ||
|
|
60efc0dd10 | ||
|
|
457131f219 | ||
|
|
bcc2ddbf4e | ||
|
|
b03180a26c | ||
|
|
56817f8e7c | ||
|
|
54ce049760 | ||
|
|
5739755a48 | ||
|
|
7f93092bdc | ||
|
|
cf8591543d | ||
|
|
38340777d6 | ||
|
|
713ef4427d | ||
|
|
1115bec3c3 | ||
|
|
d42c6ea3d2 | ||
|
|
9ca27436a9 | ||
|
|
ac26f3cdfb | ||
|
|
d407ddc00c | ||
|
|
cbd827b9db | ||
|
|
f8a02a8a9f | ||
|
|
4019d20945 | ||
|
|
d8b3447766 | ||
|
|
bbeb311aa0 | ||
|
|
4b08a02b22 | ||
|
|
fd0821563e | ||
|
|
f6a8d5eff2 | ||
|
|
a5daad4d32 | ||
|
|
d40c684723 | ||
|
|
9e97b59a2f | ||
|
|
414acf5fda | ||
|
|
aa61aabb82 | ||
|
|
69e93fdb89 | ||
|
|
85b5141cee | ||
|
|
8356dd18a2 | ||
|
|
a47341930a | ||
|
|
dcb9e9dd66 | ||
|
|
8af614022c | ||
|
|
520d69b125 | ||
|
|
5ab09c9617 | ||
|
|
d84ea7f478 | ||
|
|
3604ff24c3 | ||
|
|
63d4aecf89 | ||
|
|
a082a73869 | ||
|
|
3df730b490 | ||
|
|
208e0ed4a4 | ||
|
|
15f05c0e9e | ||
|
|
da318cd209 | ||
|
|
03f6cae25f | ||
|
|
4a3893a49e | ||
|
|
417a9c8dc3 | ||
|
|
efbeb06c63 | ||
|
|
d11eace18c | ||
|
|
4903395cbf | ||
|
|
d11c2af388 | ||
|
|
d221bfba91 | ||
|
|
a665d4a5ae | ||
|
|
46a4d9c22d | ||
|
|
fb60b88601 | ||
|
|
6b9404ab52 | ||
|
|
77a6d686ba | ||
|
|
655ae2cada | ||
|
|
1bf315d388 | ||
|
|
b4acfc31d9 | ||
|
|
7f24f0966b | ||
|
|
e2a4738020 | ||
|
|
989211b914 | ||
|
|
143e2d3cbf | ||
|
|
1d1efe3205 | ||
|
|
4997e184d5 | ||
|
|
ba5aa48b0c | ||
|
|
2c97212fd4 | ||
|
|
78c21a282a | ||
|
|
d32e7413ab | ||
|
|
dbe48b5157 | ||
|
|
d034c24b8e |
@@ -1,3 +1,4 @@
|
||||
# Ensure babel-register won't compile fixtures, or try to recompile compiled code.
|
||||
packages/*/test/fixtures
|
||||
packages/*/lib
|
||||
packages/babel-standalone/babel.js
|
||||
|
||||
42
.babelrc.js
42
.babelrc.js
@@ -1,5 +1,35 @@
|
||||
"use strict";
|
||||
|
||||
// Blame Logan for this.
|
||||
// This works around https://github.com/istanbuljs/istanbuljs/issues/92 until
|
||||
// we have a version of Istanbul that actually works with 7.x.
|
||||
function istanbulHacks() {
|
||||
return {
|
||||
inherits: require("babel-plugin-istanbul").default,
|
||||
visitor: {
|
||||
Program: {
|
||||
exit: function(path) {
|
||||
if (!this.__dv__) return
|
||||
|
||||
const node = path.node.body[0];
|
||||
if (
|
||||
node.type !== "VariableDeclaration" ||
|
||||
node.declarations[0].id.type !== "Identifier" ||
|
||||
!node.declarations[0].id.name.match(/cov_/) ||
|
||||
node._blockHoist !== 3
|
||||
) {
|
||||
throw new Error("Something has gone wrong in Logan's hacks.");
|
||||
}
|
||||
|
||||
// Gross hacks to put the code coverage block above all compiled
|
||||
// import statement output.
|
||||
node._blockHoist = 5;
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
let envOpts = {
|
||||
loose: true
|
||||
};
|
||||
@@ -7,23 +37,21 @@ let envOpts = {
|
||||
module.exports = {
|
||||
comments: false,
|
||||
presets: [
|
||||
[
|
||||
"env", envOpts
|
||||
],
|
||||
["env", envOpts],
|
||||
"stage-0",
|
||||
"flow",
|
||||
"flow"
|
||||
],
|
||||
env: {
|
||||
cov: {
|
||||
auxiliaryCommentBefore: "istanbul ignore next",
|
||||
plugins: ["istanbul"]
|
||||
plugins: [istanbulHacks]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
if (process.env.BABEL_ENV === 'development') {
|
||||
if (process.env.BABEL_ENV === "development") {
|
||||
envOpts.targets = {
|
||||
node: "current"
|
||||
};
|
||||
envOpts.debug = true;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,3 +7,20 @@ packages/*/lib
|
||||
packages/*/dist
|
||||
packages/*/test/fixtures
|
||||
packages/*/test/tmp
|
||||
codemods/*/node_modules
|
||||
codemods/*/lib
|
||||
codemods/*/dist
|
||||
codemods/*/test/fixtures
|
||||
codemods/*/test/tmp
|
||||
experimental/*/lib
|
||||
experimental/*/node_modules
|
||||
experimental/*/test/fixtures
|
||||
experimental/*/test/tmp
|
||||
experimental/babel-preset-env/data
|
||||
experimental/babel-preset-env/test/debug-fixtures
|
||||
packages/babel-standalone/babel.js
|
||||
packages/babel-standalone/babel.min.js
|
||||
|
||||
# Prettier tries to insert trailing commas in function calls, which Node.js
|
||||
# doesn't natively support. This causes an error when loading the Gulp tasks.
|
||||
packages/babel-standalone/src/gulpTasks.js
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"extends": "babel",
|
||||
"plugins": [
|
||||
"prettier"
|
||||
],
|
||||
"rules": {
|
||||
"comma-dangle": ["error", "always-multiline"],
|
||||
"curly": ["error", "multi-line"],
|
||||
"func-call-spacing": "error",
|
||||
"key-spacing": "error",
|
||||
"no-multi-spaces": "error"
|
||||
"prettier/prettier": ["error", { "trailingComma": "es5" }]
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
[ignore]
|
||||
.*/packages/.*/lib
|
||||
.*/packages/.*/test
|
||||
.*/codemods/.*/lib
|
||||
.*/codemods/.*/test
|
||||
.*/experimental/.*/lib
|
||||
.*/experimental/.*/test
|
||||
.*/node_modules/conventional-changelog-core/
|
||||
|
||||
[include]
|
||||
packages/*/src
|
||||
codemods/*/src
|
||||
experimental/*/src
|
||||
|
||||
[libs]
|
||||
lib/file.js
|
||||
@@ -13,6 +19,6 @@ lib/types.js
|
||||
lib/third-party-libs.js.flow
|
||||
|
||||
[options]
|
||||
strip_root=true
|
||||
suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe
|
||||
suppress_comment= \\(.\\|\n\\)*\\$FlowIssue
|
||||
esproposal.export_star_as=enable
|
||||
|
||||
15
.github/PULL_REQUEST_TEMPLATE.md
vendored
15
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -2,20 +2,17 @@
|
||||
Before making a PR please make sure to read our contributing guidelines
|
||||
https://github.com/babel/babel/blob/master/CONTRIBUTING.md
|
||||
|
||||
For any issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR
|
||||
For issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. It should be underlined in the preview if done correctly.
|
||||
-->
|
||||
|
||||
| Q | A <!--(yes/no) -->
|
||||
| Q | A <!--(Can use an emoji 👍) -->
|
||||
| ------------------------ | ---
|
||||
| Fixed Issues? | `Fixes #1, Fixes #2` <!-- remove the (`) quotes to link the issues -->
|
||||
| Patch: Bug Fix? |
|
||||
| Major: Breaking Change? |
|
||||
| Minor: New Feature? |
|
||||
| Deprecations? |
|
||||
| Spec Compliancy? |
|
||||
| Tests Added/Pass? |
|
||||
| Fixed Tickets | `Fixes #1, Fixes #2` <!-- rm the quotes to link the issues -->
|
||||
| License | MIT
|
||||
| Doc PR | <!-- if yes, add `[skip ci]` to your commit message to skip CI builds -->
|
||||
| Dependency Changes |
|
||||
| Tests Added + Pass? | Yes
|
||||
| Documentation PR | <!-- If so, add `[skip ci]` to your commit message to skip CI -->
|
||||
| Any Dependency Changes? |
|
||||
|
||||
<!-- Describe your changes below in as much detail as possible -->
|
||||
|
||||
7
.gitignore
vendored
7
.gitignore
vendored
@@ -10,6 +10,7 @@
|
||||
/coverage
|
||||
dist
|
||||
/.package.json
|
||||
package-lock.json
|
||||
/packages/babel-runtime/core-js/**/*.js
|
||||
!/packages/babel-runtime/core-js/map.js
|
||||
/packages/babel-runtime/helpers/*.js
|
||||
@@ -21,6 +22,12 @@ dist
|
||||
/packages/babel-runtime/helpers/es6/*.js
|
||||
!/packages/babel-runtime/helpers/es6/toArray.js
|
||||
/packages/babel-register/test/.babel
|
||||
/packages/babel-cli/test/tmp
|
||||
/packages/babel-node/test/tmp
|
||||
/packages/*/lib
|
||||
.nyc_output
|
||||
/babel.sublime-workspace
|
||||
packages/babel-standalone/babel.js
|
||||
packages/babel-standalone/babel.min.js
|
||||
/codemods/*/lib
|
||||
/codemods/*/node_modules
|
||||
|
||||
12
.mention-bot
12
.mention-bot
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"userBlacklist": [
|
||||
"amasad",
|
||||
"greenkeeperio-bot",
|
||||
"jmm",
|
||||
"kittens",
|
||||
"thejameskyle"
|
||||
],
|
||||
"fileBlacklist": ["*.md"],
|
||||
"skipAlreadyAssignedPR": true,
|
||||
"createReviewRequest": true
|
||||
}
|
||||
13
.travis.yml
13
.travis.yml
@@ -7,12 +7,17 @@ cache:
|
||||
directories:
|
||||
- node_modules
|
||||
node_js:
|
||||
- '7'
|
||||
- '8'
|
||||
- '6'
|
||||
- '4'
|
||||
|
||||
env:
|
||||
- JOB=test
|
||||
global:
|
||||
- PATH=$HOME/.yarn/bin:$PATH
|
||||
- JOB=test
|
||||
|
||||
before_install:
|
||||
- curl -o- -L https://yarnpkg.com/install.sh | bash
|
||||
|
||||
script:
|
||||
- 'if [ "$JOB" = "test" ]; then make test-ci; fi'
|
||||
@@ -33,3 +38,7 @@ notifications:
|
||||
# travis encrypt "babeljs:<token>#activity" --add notifications.slack.rooms
|
||||
# where <token> is from the Slack integration settings.
|
||||
secure: SrwPKRe2AiNAKRo/+2yW/x4zxbWf2FBXuBuuPkdTJVTpWe++Jin1lXYJWTKP1a1i/IbmhffBO9YZcUFbeuXJpRM083vO8VYpyuBMQRqWD+Z3o+ttPlHGOJgnj0nkIcGRk6k7PpyHNnIkixfEJDvbbg9lN1Jswb3xkL8iYIHpuFE=
|
||||
|
||||
branches:
|
||||
except:
|
||||
- /^v\d+\.\d+\.\d+$/
|
||||
|
||||
139
CHANGELOG.md
139
CHANGELOG.md
@@ -11,7 +11,94 @@
|
||||
|
||||
_Note: Gaps between patch versions are faulty, broken or test releases._
|
||||
|
||||
See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
|
||||
See [CHANGELOG - 6to5](/.github/CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
|
||||
|
||||
## 6.26.0 (2017-08-16)
|
||||
|
||||
> Backports for some folks (also other's when we accidently merged PRs from both 6.x/master)
|
||||
> Lesson learned: just use `master` and backport on another branch.
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
* `babel-core`, `babel-generator`, `babel-plugin-transform-flow-comments`, `babel-plugin-transform-flow-strip-types`, `babel-traverse`, `babel-types`
|
||||
* [#6081](https://github.com/babel/babel/pull/6081) Flow opaque type 6.x backport. ([@jbrown215](https://github.com/jbrown215))
|
||||
|
||||
#### :rocket: New Feature
|
||||
* `babel-cli`
|
||||
* [#5796](https://github.com/babel/babel/pull/5796) Allow --inspect-brk option to be used with babel-node [6.x backport]. ([@noinkling](https://github.com/noinkling))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-plugin-transform-es2015-modules-commonjs`
|
||||
* [#5811](https://github.com/babel/babel/pull/5811) Fix 5768. ([@joshwnj](https://github.com/joshwnj))
|
||||
* [#5469](https://github.com/babel/babel/pull/5469) Fix commonjs exports with destructuring.. ([@yavorsky](https://github.com/yavorsky))
|
||||
* `babel-types`
|
||||
* [#5693](https://github.com/babel/babel/pull/5693) Hoist toSequenceExpression's convert helper. ([@jridgewell](https://github.com/jridgewell))
|
||||
|
||||
#### :memo: Documentation
|
||||
* `babel-plugin-transform-class-properties`
|
||||
* [#6005](https://github.com/babel/babel/pull/6005) FIX access to the prototype of an instance. ([@shuaibird](https://github.com/shuaibird))
|
||||
* `babel-plugin-transform-runtime`
|
||||
* [#5857](https://github.com/babel/babel/pull/5857) Fix typos in README.md. ([@danny-andrews](https://github.com/danny-andrews))
|
||||
* `babel-plugin-transform-regenerator`
|
||||
* [#5852](https://github.com/babel/babel/pull/5852) Fix babel-plugin-transform-regenerator README. ([@k15a](https://github.com/k15a))
|
||||
* Other
|
||||
* [#5788](https://github.com/babel/babel/pull/5788) Add a section on troubleshooting [skip ci]. ([@peey](https://github.com/peey))
|
||||
* [#5755](https://github.com/babel/babel/pull/5755) Fix broken tables in README.md. ([@u9lyfish](https://github.com/u9lyfish))
|
||||
* `babel-generator`, `babel-plugin-transform-es2015-arrow-functions`, `babel-plugin-transform-es2015-modules-commonjs`, `babel-plugin-transform-es2015-spread`, `babel-plugin-transform-runtime`, `babel-register`
|
||||
* [#5613](https://github.com/babel/babel/pull/5613) Backport doc changes. ([@xtuc](https://github.com/xtuc))
|
||||
|
||||
#### :house: Internal
|
||||
* `babel-traverse`
|
||||
* [#5965](https://github.com/babel/babel/pull/5965) Remove unused functions from renamer.js.. ([@mcav](https://github.com/mcav))
|
||||
* [#5363](https://github.com/babel/babel/pull/5363) Increase the code coverage for traverse evaluation. ([@ssuman](https://github.com/ssuman))
|
||||
* Other
|
||||
* [#5938](https://github.com/babel/babel/pull/5938) Remove codecov node package and use bash uploader. ([@existentialism](https://github.com/existentialism))
|
||||
|
||||
#### Committers: 19
|
||||
- Artem Yavorsky ([yavorsky](https://github.com/yavorsky))
|
||||
- Brian Ng ([existentialism](https://github.com/existentialism))
|
||||
- Danny Andrews ([danny-andrews](https://github.com/danny-andrews))
|
||||
- Henry Zhu ([hzoo](https://github.com/hzoo))
|
||||
- Jeffrey Wear ([wearhere](https://github.com/wearhere))
|
||||
- Jordan Brown ([jbrown215](https://github.com/jbrown215))
|
||||
- Josh Johnston ([joshwnj](https://github.com/joshwnj))
|
||||
- Justin Ridgewell ([jridgewell](https://github.com/jridgewell))
|
||||
- Konstantin Pschera ([k15a](https://github.com/k15a))
|
||||
- Malcolm ([noinkling](https://github.com/noinkling))
|
||||
- Marcus Cavanaugh ([mcav](https://github.com/mcav))
|
||||
- Peeyush Kushwaha ([peey](https://github.com/peey))
|
||||
- Philipp Friedenberger ([MrSpider](https://github.com/MrSpider))
|
||||
- Samuel Reed ([STRML](https://github.com/STRML))
|
||||
- Shuaibird Hwang ([shuaibird](https://github.com/shuaibird))
|
||||
- Suman ([ssuman](https://github.com/ssuman))
|
||||
- Sven SAULEAU ([xtuc](https://github.com/xtuc))
|
||||
- jonathan schatz ([modosc](https://github.com/modosc))
|
||||
- u9lyfish@gmail.com ([u9lyfish](https://github.com/u9lyfish))
|
||||
|
||||
## 6.25.0 (2017-06-08)
|
||||
|
||||
Just backporting a few things.
|
||||
|
||||
#### :rocket: New Feature
|
||||
* `babel-plugin-transform-react-display-name`
|
||||
* [#5780](https://github.com/babel/babel/pull/5780) Backport support for createReactClass with transform-react-display-name. ([@kentor](https://github.com/kentor))
|
||||
* [#5554](https://github.com/babel/babel/pull/5554) Updated transform-react-display-name for createReactClass addon. ([@bvaughn](https://github.com/bvaughn))
|
||||
* `babel-generator`, `babel-plugin-transform-flow-strip-types`, `babel-types`
|
||||
* [#5653](https://github.com/babel/babel/pull/5653) Port flow object spread from #418 to 6.x. ([@kittens](https://github.com/kittens))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-types`
|
||||
* [#5770](https://github.com/babel/babel/pull/5770) Backport array & object pattern fixes to 6.x. ([@citycide](https://github.com/citycide))
|
||||
|
||||
#### :nail_care: Polish
|
||||
* `babel-traverse`
|
||||
* [#5615](https://github.com/babel/babel/pull/5615) Update deprecation warning on flow bindings. ([@kassens](https://github.com/kassens))
|
||||
|
||||
#### Committers: 5
|
||||
- Bo Lingen ([citycide](https://github.com/citycide))
|
||||
- Brian Vaughn ([bvaughn](https://github.com/bvaughn))
|
||||
- Jan Kassens ([kassens](https://github.com/kassens))
|
||||
- Kenneth Chung ([kentor](https://github.com/kentor))
|
||||
- Sebastian McKenzie ([kittens](https://github.com/kittens))
|
||||
|
||||
## 6.24.0 (2017-03-13)
|
||||
|
||||
@@ -263,7 +350,7 @@ New/Expected Behavior
|
||||
|
||||
```js
|
||||
const _ref = foo(); // should only be called once
|
||||
const { x } = _ref;
|
||||
const { x } = _ref;
|
||||
const y = _objectWithoutProperties(_ref, ["x"]);
|
||||
```
|
||||
|
||||
@@ -279,7 +366,7 @@ function fn({a = 1, ...b} = {}) {
|
||||
return {a, b};
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
* `babel-plugin-transform-es2015-destructuring`
|
||||
* [#5093](https://github.com/babel/babel/pull/5093) Ensure array is always copied during destructure. ([@existentialism](https://github.com/existentialism))
|
||||
|
||||
@@ -293,7 +380,7 @@ const arr = [1, 2, 3]
|
||||
assign(arr, 1, 42)
|
||||
console.log(arr) // [1, 2, 3]
|
||||
```
|
||||
|
||||
|
||||
* `babel-plugin-transform-es2015-function-name`
|
||||
* [#5008](https://github.com/babel/babel/pull/5008) Don't try to visit ArrowFunctionExpression, they cannot be named. ([@Kovensky](https://github.com/Kovensky))
|
||||
|
||||
@@ -308,9 +395,9 @@ Output
|
||||
|
||||
```js
|
||||
export const x = ({ x }) => x;
|
||||
export const y = function y() {};
|
||||
export const y = function y() {};
|
||||
```
|
||||
|
||||
|
||||
* `babel-types`
|
||||
* [#5068](https://github.com/babel/babel/pull/5068) Fix getBindingIdentifiers in babel-types. ([@rtsao](https://github.com/rtsao))
|
||||
* `babel-cli`
|
||||
@@ -460,7 +547,7 @@ Will still error with `Spread children are not supported.`
|
||||
```js
|
||||
<div>{...this.props.children}</div>;
|
||||
```
|
||||
|
||||
|
||||
* `babel-plugin-transform-es2015-block-scoping`, `babel-plugin-transform-react-constant-elements`, `babel-traverse`
|
||||
* [#4940](https://github.com/babel/babel/pull/4940) Fix React constant element bugs. ([@appden](https://github.com/appden))
|
||||
|
||||
@@ -469,7 +556,7 @@ When multiple declarators are present in a declaration, we want to insert the co
|
||||
```js
|
||||
function render() {
|
||||
const bar = "bar", renderFoo = () => <foo bar={bar} baz={baz} />, baz = "baz";
|
||||
|
||||
|
||||
return renderFoo();
|
||||
}
|
||||
```
|
||||
@@ -480,12 +567,12 @@ When block scoped variables caused the block to be wrapped in a closure, the var
|
||||
function render(flag) {
|
||||
if (flag) {
|
||||
let bar = "bar";
|
||||
|
||||
|
||||
[].map(() => bar);
|
||||
|
||||
|
||||
return <foo bar={bar} />;
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
```
|
||||
@@ -526,7 +613,7 @@ for (let a of b) {
|
||||
* [#4999](https://github.com/babel/babel/pull/4999) babel-helper-transform-fixture-test-runner: pass require as a global. ([@hzoo](https://github.com/hzoo))
|
||||
|
||||
Allows running `require()` in exec.js tests like for [babel/babel-preset-env#95](https://github.com/babel/babel-preset-env/pull/95)
|
||||
|
||||
|
||||
* Other
|
||||
* [#5005](https://github.com/babel/babel/pull/5005) internal: don't run watch with the test env (skip building with code …. ([@hzoo](https://github.com/hzoo))
|
||||
|
||||
@@ -648,8 +735,8 @@ try {
|
||||
return x;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
* `babel-helper-remap-async-to-generator`, `babel-plugin-transform-async-generator-functions`, `babel-plugin-transform-async-to-generator`
|
||||
* [#4901](https://github.com/babel/babel/pull/4901) Only base async fn arity on non-default/non-rest params - Closes [#4891](https://github.com/babel/babel/issues/4891). ([@loganfsmyth](https://github.com/loganfsmyth))
|
||||
|
||||
@@ -660,7 +747,7 @@ console.log(foo.length) // 0
|
||||
const asyncFoo = async (...args) => { }
|
||||
console.log(asyncFoo.length) // 0
|
||||
```
|
||||
|
||||
|
||||
* `babel-generator`, `babel-types`
|
||||
* [#4945](https://github.com/babel/babel/pull/4945) Add `babel-generator` support for `Import`. ([@TheLarkInn](https://github.com/TheLarkInn))
|
||||
|
||||
@@ -669,14 +756,14 @@ console.log(asyncFoo.length) // 0
|
||||
```js
|
||||
import("module.js");
|
||||
```
|
||||
|
||||
|
||||
* `babel-plugin-transform-object-rest-spread`
|
||||
* [#4883](https://github.com/babel/babel/pull/4883) Fix for object-rest with parameters destructuring nested rest. ([@christophehurpeau](https://github.com/christophehurpeau))
|
||||
|
||||
```js
|
||||
function a5({a3, b2: { ba1, ...ba2 }, ...c3}) {}
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
* `babel-traverse`
|
||||
* [#4875](https://github.com/babel/babel/pull/4875) Fix `path.evaluate` for references before declarations. ([@boopathi](https://github.com/boopathi))
|
||||
|
||||
@@ -981,7 +1068,7 @@ function render(_ref) {
|
||||
- Scott Stern ([sstern6](https://github.com/sstern6))
|
||||
- Shine Wang ([shinew](https://github.com/shinew))
|
||||
- lion ([lion-man44](https://github.com/lion-man44))
|
||||
|
||||
|
||||
## v6.18.2 (2016-11-01)
|
||||
|
||||
Weird publishing issue with v6.18.1, same release.
|
||||
@@ -1666,7 +1753,7 @@ export default {
|
||||
#### :bug: Bug Fix
|
||||
* `babel-helpers`, `babel-plugin-transform-es2015-typeof-symbol`
|
||||
* [#3686](https://github.com/babel/babel/pull/3686) Fix `typeof Symbol.prototype`. ([@brainlock](https://github.com/brainlock))
|
||||
|
||||
|
||||
```js
|
||||
// `typeof Symbol.prototype` should be 'object'
|
||||
typeof Symbol.prototype === 'object'
|
||||
@@ -1675,7 +1762,7 @@ typeof Symbol.prototype === 'object'
|
||||
* `babel-cli`
|
||||
* [#3456](https://github.com/babel/babel/pull/3456) Use the real sourcemap API and handle input sourcemaps - Fixes [#7259](https://github.com/babel/babel/issues/7259). ([@loganfsmyth](https://github.com/loganfsmyth))
|
||||
* [#4507](https://github.com/babel/babel/pull/4507) Only set options in cli if different from default. ([@danez](https://github.com/danez))
|
||||
|
||||
|
||||
Fix an issue with defaults not being overidden. This was causing options like `comments: false` not to work correctly.
|
||||
|
||||
* [#4508](https://github.com/babel/babel/pull/4508) Support custom ports for V8 --inspect. ([@andykant](https://github.com/andykant))
|
||||
@@ -1730,7 +1817,7 @@ We noticed that we can not make this optimizations if there are function calls o
|
||||
// was tranforming to
|
||||
x = a();
|
||||
y = obj.x;
|
||||
// now transforms to
|
||||
// now transforms to
|
||||
var _ref = [a(), obj.x];
|
||||
x = _ref[0];
|
||||
y = _ref[1];
|
||||
@@ -1796,7 +1883,7 @@ Cleanup tests, remove various unused dependencies, do not run CI with only readm
|
||||
#### Commiters: 20
|
||||
|
||||
First PRs!
|
||||
- Alberto Piai ([brainlock](https://github.com/brainlock))
|
||||
- Alberto Piai ([brainlock](https://github.com/brainlock))
|
||||
- Andy Kant ([andykant](https://github.com/andykant))
|
||||
- Basil Hosmer ([bhosmer](https://github.com/bhosmer))
|
||||
- Bo Borgerson ([gigabo](https://github.com/gigabo))
|
||||
@@ -1879,7 +1966,7 @@ npm install babel-preset-latest --save-dev
|
||||
{ "presets": [
|
||||
["latest", {
|
||||
"es2015": {
|
||||
"modules": false
|
||||
"modules": false
|
||||
}
|
||||
}]
|
||||
] }
|
||||
@@ -2117,7 +2204,7 @@ Can be `false` to not transform modules, or one of `["amd", "umd", "systemjs", "
|
||||
|
||||
## v6.11.5 (2016-07-23)
|
||||
|
||||
Thanks to Rob Eisenberg ([EisenbergEffect](https://github.com/EisenbergEffect)), Keyan Zhang ([keyanzhang](https://github.com/keyanzhang)), Rolf Timmermans ([rolftimmermans](https://github.com/rolftimmermans)), Thomas Grainger ([graingert](https://github.com/graingert)),
|
||||
Thanks to Rob Eisenberg ([EisenbergEffect](https://github.com/EisenbergEffect)), Keyan Zhang ([keyanzhang](https://github.com/keyanzhang)), Rolf Timmermans ([rolftimmermans](https://github.com/rolftimmermans)), Thomas Grainger ([graingert](https://github.com/graingert)),
|
||||
|
||||
we have few fixes: fix `babel-register` file paths on error, infer class name for classes with class properties, fix `export *` to account for previously compiled modules.
|
||||
|
||||
@@ -2165,7 +2252,7 @@ In this release among other things are some more optimizations for babel-generat
|
||||
|
||||
## v6.11.3 (2016-07-13)
|
||||
|
||||
The main fix is @loganfsmyth's changes of some parts in babel-generator in [#3565](https://github.com/babel/babel/pull/3565) to fix issues with exponential code generation times in certain cases.
|
||||
The main fix is @loganfsmyth's changes of some parts in babel-generator in [#3565](https://github.com/babel/babel/pull/3565) to fix issues with exponential code generation times in certain cases.
|
||||
|
||||
Items: the size of the array being generated
|
||||
Time: The time in ms to generate the code
|
||||
|
||||
@@ -30,7 +30,9 @@ Contributions are always welcome, no matter how large or small.
|
||||
- Check out [`/doc`](https://github.com/babel/babel/tree/master/doc) for information about Babel's internals
|
||||
- Check out [the Babel Plugin Handbook](https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-plugin-handbook) - core plugins are written the same way as any other plugin!
|
||||
- Check out [AST Explorer](http://astexplorer.net/#/scUfOmVOG5) to learn more about ASTs or make your own plugin in the browser
|
||||
- When you feel ready to jump into the Babel source code, a good place to start is to look for issues tagged with [help-wanted](https://github.com/babel/babel/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) and/or [beginner-friendly](https://github.com/babel/babel/issues?q=is%3Aissue+is%3Aopen+label%3A%22beginner-friendly%22).
|
||||
- When you feel ready to jump into the Babel source code, a good place to start is to look for issues tagged with [help wanted](https://github.com/babel/babel/labels/help%20wanted) and/or [good first issue](https://github.com/babel/babel/labels/good%20first%20issue).
|
||||
- Follow along with what we are working on by joining our Slack, following our announcements on [Twitter](https://twitter.com/babeljs), and reading (or participating!) in our [meeting notes](https://github.com/babel/notes).
|
||||
- Check out our [website](http://babeljs.io/) and the [repo](https://github.com/babel/website)
|
||||
|
||||
## Chat
|
||||
|
||||
@@ -40,11 +42,9 @@ Feel free to check out the `#discussion`/`#development` channels on our [Slack](
|
||||
|
||||
**Note:** Versions `< 5.1.10` can't be built.
|
||||
|
||||
Babel is built for Node.js 4 and up but we develop using Node.js 6. Make sure you are on npm 3.
|
||||
Babel is built for Node 4 and up but we develop using Node 8 and yarn. You can check this with `node -v`.
|
||||
|
||||
You can check this with `node -v` and `npm -v`.
|
||||
|
||||
In addition, make sure that Yarn is installed.
|
||||
Make sure that Yarn is installed with version >= `0.28.0`.
|
||||
Installation instructions can be found here: https://yarnpkg.com/en/docs/install.
|
||||
|
||||
### Setup
|
||||
@@ -114,12 +114,25 @@ To run tests for a specific package in [packages](https://github.com/babel/babel
|
||||
$ TEST_ONLY=babel-cli make test
|
||||
```
|
||||
|
||||
`TEST_ONLY` will also match substrings of the package name:
|
||||
|
||||
```sh
|
||||
# Run tests for the babel-plugin-transform-es2015-classes package.
|
||||
$ TEST_ONLY=es2015-class make test
|
||||
```
|
||||
|
||||
Use the `TEST_GREP` variable to run a subset of tests by name:
|
||||
|
||||
```sh
|
||||
$ TEST_GREP=transformation make test
|
||||
```
|
||||
|
||||
Substitute spaces for hyphens and forward slashes when targeting specific test names:
|
||||
|
||||
```sh
|
||||
$ TEST_GREP="arrow functions destructuring parameters" make test
|
||||
```
|
||||
|
||||
To enable the Node.js debugger added in v6.3.0, set the `TEST_DEBUG` environment variable:
|
||||
|
||||
```sh
|
||||
@@ -138,15 +151,15 @@ $ ./scripts/test-cov.sh
|
||||
|
||||
#### Troubleshooting Tests
|
||||
|
||||
In case you're not able to reproduce an error on CI locally, it may be due to
|
||||
In case you're not able to reproduce an error on CI locally, it may be due to
|
||||
|
||||
- Node Version: Travis CI runs the tests against all major node versions. If your tests use JavaScript features unsupported by lower versions of node, then use [minNodeVersion option](#writing-tests) in options.json.
|
||||
- Timeout: Check the CI log and if the only errors are timeout errors and you are sure that it's not related to the changes you made, ask someone in the slack channel to trigger rebuild on the CI build and it might be resolved
|
||||
|
||||
|
||||
In case you're locally getting errors which are not on the CI, it may be due to
|
||||
|
||||
- Updates in Dependencies: Make sure you run `make bootstrap` before you run `make build` or `make watch` before you run the tests.
|
||||
|
||||
|
||||
### Writing tests
|
||||
|
||||
Most packages in [`/packages`](https://github.com/babel/babel/tree/master/packages) have a `test` folder, however some tests might be in other packages or in [`/packages/babel-core`](https://github.com/babel/babel/tree/master/packages/babel-core/test/fixtures).
|
||||
@@ -261,7 +274,7 @@ To start the debugging in Chrome DevTools, open the given URL.
|
||||
The debugger starts at the first executed line of code, which is Mocha's first line by default.
|
||||
Click _Resume script execution_ <img src="https://i.imgur.com/TmYBn9d.png" alt="Resume script execution button." width="16"> to jump to the set breakpoint.
|
||||
Note that the code shown in Chrome DevTools is compiled code and therefore differs.
|
||||
|
||||
|
||||
## Internals
|
||||
- AST spec ([babylon/ast/spec.md](https://github.com/babel/babylon/blob/master/ast/spec.md))
|
||||
- Versioning ([doc/design/versioning.md](https://github.com/babel/babel/blob/master/doc/design/versioning.md)
|
||||
|
||||
172
Gulpfile.js
172
Gulpfile.js
@@ -3,15 +3,22 @@
|
||||
const plumber = require("gulp-plumber");
|
||||
const through = require("through2");
|
||||
const chalk = require("chalk");
|
||||
const pump = require("pump");
|
||||
const uglify = require("gulp-uglify");
|
||||
const rename = require("gulp-rename");
|
||||
const newer = require("gulp-newer");
|
||||
const babel = require("gulp-babel");
|
||||
const watch = require("gulp-watch");
|
||||
const gutil = require("gulp-util");
|
||||
const gulp = require("gulp");
|
||||
const path = require("path");
|
||||
const merge = require("merge-stream");
|
||||
const RootMostResolvePlugin = require("webpack-dependency-suite")
|
||||
.RootMostResolvePlugin;
|
||||
const webpack = require("webpack");
|
||||
const webpackStream = require("webpack-stream");
|
||||
|
||||
const base = path.join(__dirname, "packages");
|
||||
const scripts = "./packages/*/src/**/*.js";
|
||||
const sources = ["codemods", "packages", "experimental"];
|
||||
|
||||
function swapSrcWithLib(srcPath) {
|
||||
const parts = srcPath.split(path.sep);
|
||||
@@ -19,34 +26,147 @@ function swapSrcWithLib(srcPath) {
|
||||
return parts.join(path.sep);
|
||||
}
|
||||
|
||||
function getGlobFromSource(source) {
|
||||
return `./${source}/*/src/**/*.js`;
|
||||
}
|
||||
|
||||
gulp.task("default", ["build"]);
|
||||
|
||||
gulp.task("build", function () {
|
||||
return gulp.src(scripts, { base: base })
|
||||
.pipe(plumber({
|
||||
errorHandler: function (err) {
|
||||
gutil.log(err.stack);
|
||||
},
|
||||
}))
|
||||
.pipe(newer({
|
||||
dest: base,
|
||||
map: swapSrcWithLib,
|
||||
}))
|
||||
.pipe(through.obj(function (file, enc, callback) {
|
||||
gutil.log("Compiling", "'" + chalk.cyan(file.relative) + "'...");
|
||||
callback(null, file);
|
||||
}))
|
||||
.pipe(babel())
|
||||
.pipe(through.obj(function (file, enc, callback) {
|
||||
// Passing 'file.relative' because newer() above uses a relative path and this keeps it consistent.
|
||||
file.path = path.resolve(file.base, swapSrcWithLib(file.relative));
|
||||
callback(null, file);
|
||||
}))
|
||||
.pipe(gulp.dest(base));
|
||||
gulp.task("build", function() {
|
||||
return merge(
|
||||
sources.map(source => {
|
||||
const base = path.join(__dirname, source);
|
||||
|
||||
return gulp
|
||||
.src(getGlobFromSource(source), { base: base })
|
||||
.pipe(
|
||||
plumber({
|
||||
errorHandler: function(err) {
|
||||
gutil.log(err.stack);
|
||||
},
|
||||
})
|
||||
)
|
||||
.pipe(
|
||||
newer({
|
||||
dest: base,
|
||||
map: swapSrcWithLib,
|
||||
})
|
||||
)
|
||||
.pipe(
|
||||
through.obj(function(file, enc, callback) {
|
||||
gutil.log("Compiling", "'" + chalk.cyan(file.relative) + "'...");
|
||||
callback(null, file);
|
||||
})
|
||||
)
|
||||
.pipe(babel())
|
||||
.pipe(
|
||||
through.obj(function(file, enc, callback) {
|
||||
// Passing 'file.relative' because newer() above uses a relative
|
||||
// path and this keeps it consistent.
|
||||
file.path = path.resolve(file.base, swapSrcWithLib(file.relative));
|
||||
callback(null, file);
|
||||
})
|
||||
)
|
||||
.pipe(gulp.dest(base));
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
gulp.task("watch", ["build"], function () {
|
||||
watch(scripts, { debounceDelay: 200 }, function () {
|
||||
gulp.task("watch", ["build"], function() {
|
||||
watch(sources.map(getGlobFromSource), { debounceDelay: 200 }, function() {
|
||||
gulp.start("build");
|
||||
});
|
||||
});
|
||||
|
||||
gulp.task("build-babel-standalone", cb => {
|
||||
pump(
|
||||
[
|
||||
gulp.src(__dirname + "/packages/babel-standalone/src/index.js"),
|
||||
webpackBuild(),
|
||||
gulp.dest(__dirname + "/packages/babel-standalone"),
|
||||
uglify(),
|
||||
rename({ extname: ".min.js" }),
|
||||
gulp.dest(__dirname + "/packages/babel-standalone"),
|
||||
],
|
||||
cb
|
||||
);
|
||||
});
|
||||
|
||||
function webpackBuild() {
|
||||
let version = require("./packages/babel-core/package.json").version;
|
||||
|
||||
// If this build is part of a pull request, include the pull request number in
|
||||
// the version number.
|
||||
if (process.env.CIRCLE_PR_NUMBER) {
|
||||
version += "+pr." + process.env.CIRCLE_PR_NUMBER;
|
||||
}
|
||||
|
||||
const config = {
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
include: /node_modules/,
|
||||
loader: "babel-loader",
|
||||
options: {
|
||||
// Some of the node_modules may have their own "babel" section in
|
||||
// their project.json (or a ".babelrc" file). We need to ignore
|
||||
// those as we're using our own Babel options.
|
||||
babelrc: false,
|
||||
presets: ["env"],
|
||||
},
|
||||
},
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
loader: "babel-loader",
|
||||
options: {
|
||||
// Some of the node_modules may have their own "babel" section in
|
||||
// their project.json (or a ".babelrc" file). We need to ignore
|
||||
// those as we're using our own Babel options.
|
||||
babelrc: false,
|
||||
presets: ["env", "stage-0"],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
node: {
|
||||
// Mock Node.js modules that Babel require()s but that we don't
|
||||
// particularly care about.
|
||||
fs: "empty",
|
||||
module: "empty",
|
||||
net: "empty",
|
||||
},
|
||||
output: {
|
||||
filename: "babel.js",
|
||||
library: "Babel",
|
||||
libraryTarget: "umd",
|
||||
},
|
||||
plugins: [
|
||||
new webpack.DefinePlugin({
|
||||
"process.env.NODE_ENV": '"production"',
|
||||
BABEL_VERSION: JSON.stringify(version),
|
||||
VERSION: JSON.stringify(version),
|
||||
}),
|
||||
/*new webpack.NormalModuleReplacementPlugin(
|
||||
/..\/..\/package/,
|
||||
"../../../../src/babel-package-shim"
|
||||
),*/
|
||||
new webpack.optimize.ModuleConcatenationPlugin(),
|
||||
],
|
||||
resolve: {
|
||||
plugins: [
|
||||
// Dedupe packages that are used across multiple plugins.
|
||||
// This replaces DedupePlugin from Webpack 1.x
|
||||
new RootMostResolvePlugin(__dirname, true),
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
return webpackStream(config, webpack);
|
||||
// To write JSON for debugging:
|
||||
/*return webpackStream(config, webpack, (err, stats) => {
|
||||
require('gulp-util').log(stats.toString({colors: true}));
|
||||
require('fs').writeFileSync('webpack-debug.json', JSON.stringify(stats.toJson()));
|
||||
});*/
|
||||
}
|
||||
|
||||
72
Makefile
72
Makefile
@@ -2,10 +2,22 @@ MAKEFLAGS = -j1
|
||||
|
||||
export NODE_ENV = test
|
||||
|
||||
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
|
||||
export FORCE_COLOR = true
|
||||
|
||||
SOURCES = packages codemods experimental
|
||||
|
||||
.PHONY: build build-dist watch lint fix clean test-clean test-only test test-ci publish bootstrap
|
||||
|
||||
build: clean
|
||||
make clean-lib
|
||||
./node_modules/.bin/gulp build
|
||||
ifneq ("$(BABEL_ENV)", "cov")
|
||||
make build-standalone
|
||||
endif
|
||||
|
||||
build-standalone:
|
||||
./node_modules/.bin/gulp build-babel-standalone
|
||||
|
||||
build-dist: build
|
||||
cd packages/babel-polyfill; \
|
||||
@@ -15,17 +27,17 @@ build-dist: build
|
||||
node scripts/generate-babel-types-docs.js
|
||||
|
||||
watch: clean
|
||||
rm -rf packages/*/lib
|
||||
make clean-lib
|
||||
BABEL_ENV=development ./node_modules/.bin/gulp watch
|
||||
|
||||
lint:
|
||||
./node_modules/.bin/eslint scripts packages *.js --format=codeframe
|
||||
|
||||
flow:
|
||||
./node_modules/.bin/flow check
|
||||
./node_modules/.bin/flow check --strip-root
|
||||
|
||||
lint:
|
||||
./node_modules/.bin/eslint scripts $(SOURCES) *.js --format=codeframe --rulesdir="./scripts/eslint_rules"
|
||||
|
||||
fix:
|
||||
./node_modules/.bin/eslint scripts packages *.js --format=codeframe --fix
|
||||
./node_modules/.bin/eslint scripts $(SOURCES) *.js --format=codeframe --fix --rulesdir="./scripts/eslint_rules"
|
||||
|
||||
clean: test-clean
|
||||
rm -rf packages/babel-polyfill/browser*
|
||||
@@ -36,14 +48,8 @@ clean: test-clean
|
||||
rm -rf packages/*/npm-debug*
|
||||
|
||||
test-clean:
|
||||
rm -rf packages/*/test/tmp
|
||||
rm -rf packages/*/test-fixtures.json
|
||||
|
||||
clean-all:
|
||||
rm -rf packages/*/lib
|
||||
rm -rf node_modules
|
||||
rm -rf packages/*/node_modules
|
||||
make clean
|
||||
$(foreach source, $(SOURCES), \
|
||||
$(call clean-source-test, $(source)))
|
||||
|
||||
test-only:
|
||||
./scripts/test.sh
|
||||
@@ -55,19 +61,20 @@ test-ci:
|
||||
make bootstrap
|
||||
make test-only
|
||||
|
||||
test-ci-coverage: SHELL:=/bin/bash
|
||||
test-ci-coverage:
|
||||
BABEL_ENV=cov make bootstrap
|
||||
./scripts/test-cov.sh
|
||||
./node_modules/.bin/codecov -f coverage/coverage-final.json
|
||||
bash <(curl -s https://codecov.io/bash) -f coverage/coverage-final.json
|
||||
|
||||
publish:
|
||||
git pull --rebase
|
||||
rm -rf packages/*/lib
|
||||
make clean-lib
|
||||
BABEL_ENV=production make build-dist
|
||||
make test
|
||||
# not using lerna independent mode atm, so only update packages that have changed since we use ^
|
||||
# --only-explicit-updates
|
||||
./node_modules/.bin/lerna publish --npm-tag=next --exact --skip-temp-tag
|
||||
./node_modules/.bin/lerna publish --force-publish=* --npm-tag=next --exact --skip-temp-tag
|
||||
make clean
|
||||
|
||||
bootstrap:
|
||||
@@ -77,3 +84,34 @@ bootstrap:
|
||||
make build
|
||||
cd packages/babel-runtime; \
|
||||
node scripts/build-dist.js
|
||||
|
||||
clean-lib:
|
||||
$(foreach source, $(SOURCES), \
|
||||
$(call clean-source-lib, $(source)))
|
||||
|
||||
clean-all:
|
||||
rm -rf node_modules
|
||||
rm -rf package-lock.json
|
||||
|
||||
$(foreach source, $(SOURCES), \
|
||||
$(call clean-source-all, $(source)))
|
||||
|
||||
make clean
|
||||
|
||||
define clean-source-lib
|
||||
rm -rf $(1)/*/lib
|
||||
|
||||
endef
|
||||
|
||||
define clean-source-test
|
||||
rm -rf $(1)/*/test/tmp
|
||||
rm -rf $(1)/*/test-fixtures.json
|
||||
|
||||
endef
|
||||
|
||||
define clean-source-all
|
||||
rm -rf $(1)/*/lib
|
||||
rm -rf $(1)/*/node_modules
|
||||
rm -rf $(1)/*/package-lock.json
|
||||
|
||||
endef
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
sebmck
|
||||
thejameskyle
|
||||
amasad
|
||||
hzoo
|
||||
loganfsmyth
|
||||
jmm
|
||||
152
README.md
152
README.md
@@ -16,15 +16,22 @@
|
||||
<a href="https://www.npmjs.com/package/babel-core"><img alt="npm Downloads" src="https://img.shields.io/npm/dm/babel-core.svg?maxAge=43200"></a>
|
||||
</p>
|
||||
|
||||
<h2 align="center">Supporting Babel</h2>
|
||||
|
||||
<p align="center">
|
||||
<a href="#backers"><img alt="Backers on Open Collective" src="https://opencollective.com/babel/backers/badge.svg" /></a>
|
||||
<a href="#sponsors"><img alt="Sponsors on Open Collective" src="https://opencollective.com/babel/sponsors/badge.svg" /></a>
|
||||
<a href="https://medium.com/friendship-dot-js/i-peeked-into-my-node-modules-directory-and-you-wont-believe-what-happened-next-b89f63d21558"><img alt="Business Strategy Status" src="https://img.shields.io/badge/business%20model-flavortown-green.svg"></a>
|
||||
<a href="https://medium.com/friendship-dot-js/i-peeked-into-my-node-modules-directory-and-you-wont-believe-what-happened-next-b89f63d21558"><img alt="Business Strategy Status" src="https://img.shields.io/badge/business%20model-flavortown-green.svg"></a>
|
||||
</p>
|
||||
|
||||
Babel is a community-driven tool that helps you write code in the latest version of JavaScript.
|
||||
Babel is community-driven and thus mostly maintained by a group of volunteers. It has a lot of [companies and projects](http://babeljs.io/users) using it but almost no sponsors/people funded to work on it. If you'd like to help maintain the future of the project, please consider:
|
||||
|
||||
When your supported environments don't support certain features natively, Babel will help you compile those features down to a supported version.
|
||||
- Giving developer time on the project. (Message us on [Twitter](https://twitter.com/babeljs) or [Slack](slack.babeljs.io))
|
||||
- [Giving funds by becoming a backer/sponsor on OpenCollective](https://opencollective.com/babel)
|
||||
|
||||
## Intro
|
||||
|
||||
Babel is a tool that helps you write code in the latest version of JavaScript. When your supported environments don't support certain features natively, Babel will help you compile those features down to a supported version.
|
||||
|
||||
**In**
|
||||
|
||||
@@ -41,136 +48,50 @@ When your supported environments don't support certain features natively, Babel
|
||||
});
|
||||
```
|
||||
|
||||
Try it out at our [REPL](https://babeljs.io/repl/#?babili=false&evaluate=true&lineWrap=false&presets=latest&code=%5B1%2C2%2C3%5D.map(n%20%3D%3E%20n%20%2B%201)%3B&experimental=true&loose=true&spec=false&playground=false&stage=0) and follow us at [@babeljs](https://twitter.com/babeljs).
|
||||
Try it out at our [REPL](https://babeljs.io/repl/build/master#?code_lz=NoRgNATGDMC6B0BbAhgBwBQDsAEBeAfNjgNTYgCUA3EA&lineWrap=true&presets=es2015%2Ces2016%2Ces2017&version=7.0.0-beta.2).
|
||||
|
||||
- [FAQ](#faq)
|
||||
- [Packages](#packages)
|
||||
- [Core Packages](#core-packages)
|
||||
- [Other](#other)
|
||||
- [Presets](#presets)
|
||||
- [Plugins](#plugins)
|
||||
- [Transform Plugins](#transform-plugins)
|
||||
- [Syntax Plugins](#syntax-plugins)
|
||||
- [Misc Packages](#misc-packages)
|
||||
- [Team](#team)
|
||||
- [Backers](#backers)
|
||||
- [Sponsors](#sponsors)
|
||||
- [License](#license)
|
||||
|
||||
# FAQ
|
||||
## FAQ
|
||||
|
||||
## Docs?
|
||||
### Docs?
|
||||
|
||||
Check out our website: [babeljs.io](http://babeljs.io/)
|
||||
|
||||
## Looking for support?
|
||||
### Looking for support?
|
||||
|
||||
For questions and support please visit our [discussion forum](https://discuss.babeljs.io/), sign up for our [Slack community](https://slack.babeljs.io/), or [StackOverflow](http://stackoverflow.com/questions/tagged/babeljs).
|
||||
For questions and support please visit join our [Slack Community](https://slack.babeljs.io/), ask a question on [Stack Overflow](http://stackoverflow.com/questions/tagged/babeljs), or ping us on [Twitter](https://twitter.com/babeljs/).
|
||||
|
||||
## Want to report a bug or request a feature?
|
||||
### Want to report a bug or request a feature?
|
||||
|
||||
Bugs and feature requests can be posted at https://github.com/babel/babel/issues.
|
||||
Please read through our [CONTRIBUTING.md](https://github.com/babel/babel/blob/master/CONTRIBUTING.md) and fill out the issue template at [babel/issues](https://github.com/babel/babel/issues)!
|
||||
|
||||
> We've moved our issues from phabricator back to github issues!
|
||||
### Want to report an issue with our website ([babeljs.io](https://babeljs.io))?
|
||||
|
||||
Former phabricator issue URLs now automatically redirect to their corresponding Github issue:
|
||||
For docs/website issues please visit the [babel/website](https://github.com/babel/website/issues).
|
||||
|
||||
https://phabricator.babeljs.io/T2168 mostly corresponds to https://github.com/babel/babel/issues/2168.
|
||||
### Want to contribute to Babel?
|
||||
|
||||
## Want to report an issue with [babeljs.io](https://babeljs.io) (the website)?
|
||||
Check out our [CONTRIBUTING.md](https://github.com/babel/babel/blob/master/CONTRIBUTING.md) to get started with setting up the repo.
|
||||
|
||||
For documentation and website issues please visit the [babel/babel.github.io](https://github.com/babel/babel.github.io) repo.
|
||||
- If you have already joined Slack, join our [#development](https://babeljs.slack.com/messages/development) channel and say hi!
|
||||
- Check out the issues with the [good first issue](https://github.com/babel/babel/labels/good%20first%20issue) and [help wanted](https://github.com/babel/babel/labels/help%20wanted) label.
|
||||
- Our discussions/notes/roadmap: [babel/notes](https://github.com/babel/notes)
|
||||
- Our progress on TC39 proposals: [babel/proposals](https://github.com/babel/proposals)
|
||||
|
||||
## Want to contribute to Babel?
|
||||
### How is the repo structured?
|
||||
|
||||
Check out our [CONTRIBUTING.md](https://github.com/babel/babel/blob/master/CONTRIBUTING.md). If you have already joined Slack, join our [#development](https://babeljs.slack.com/messages/development) channel!
|
||||
|
||||
You can also start by checking out the issues with the [help-wanted](https://github.com/babel/babel/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) label.
|
||||
|
||||
Our discussions/notes/roadmap: [babel/notes](https://github.com/babel/notes)
|
||||
|
||||
## Packages
|
||||
|
||||
The Babel repo is managed as a [monorepo](https://github.com/babel/babel/blob/master/doc/design/monorepo.md) that is composed of many npm packages.
|
||||
|
||||
### Core Packages
|
||||
|
||||
| Package | Version | Dependencies |
|
||||
|--------|-------|------------|
|
||||
| [`babel-core`](/packages/babel-core) | [](https://www.npmjs.com/package/babel-core) | [](https://david-dm.org/babel/babel?path=packages/babel-core) |
|
||||
| [`babylon`](https://github.com/babel/babylon) | [](https://www.npmjs.com/package/babylon) | [](https://david-dm.org/babel/babylon) |
|
||||
| [`babel-traverse`](/packages/babel-traverse) | [](https://www.npmjs.com/package/babel-traverse) | [](https://david-dm.org/babel/babel?path=packages/babel-traverse) |
|
||||
| [`babel-generator`](/packages/babel-generator) | [](https://www.npmjs.com/package/babel-generator) | [](https://david-dm.org/babel/babel?path=packages/babel-generator) |
|
||||
|
||||
[`babel-core`](/packages/babel-core) is the Babel compiler itself; it exposes the `babel.transform` method, where `transformedCode = transform(src).code`.
|
||||
|
||||
The compiler can be broken down into 3 parts:
|
||||
- The parser: [`babylon`](https://github.com/babel/babylon) (moved to a separate repo and versioned independently)
|
||||
- The transformer[s]: All the plugins/presets
|
||||
- These all use [`babel-traverse`](/packages/babel-traverse) to traverse through the AST
|
||||
- The generator: [`babel-generator`](/packages/babel-generator)
|
||||
|
||||
The flow goes like this:
|
||||
|
||||
input string -> `babylon` parser -> `AST` -> transformer[s] -> `AST` -> `babel-generator` -> output string
|
||||
|
||||
Check out the [`babel-handbook`](https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#introduction) for more information on this.
|
||||
|
||||
#### Other
|
||||
|
||||
| Package | Version | Dependencies |
|
||||
|--------|-------|------------|
|
||||
| [`babel-cli`](/packages/babel-cli) | [](https://www.npmjs.com/package/babel-cli) | [](https://david-dm.org/babel/babel?path=packages/babel-cli) |
|
||||
| [`babel-types`](/packages/babel-types) | [](https://www.npmjs.com/package/babel-types) | [](https://david-dm.org/babel/babel?path=packages/babel-types) |
|
||||
| [`babel-polyfill`](/packages/babel-polyfill) | [](https://www.npmjs.com/package/babel-polyfill) | [](https://david-dm.org/babel/babel?path=packages/babel-polyfill) |
|
||||
| [`babel-runtime`](/packages/babel-runtime) | [](https://www.npmjs.com/package/babel-runtime) | [](https://david-dm.org/babel/babel?path=packages/babel-runtime) |
|
||||
| [`babel-register`](/packages/babel-register) | [](https://www.npmjs.com/package/babel-register) | [](https://david-dm.org/babel/babel?path=packages/babel-register) |
|
||||
| [`babel-template`](/packages/babel-template) | [](https://www.npmjs.com/package/babel-template) | [](https://david-dm.org/babel/babel?path=packages/babel-template) |
|
||||
| [`babel-helpers`](/packages/babel-helpers) | [](https://www.npmjs.com/package/babel-helpers) | [](https://david-dm.org/babel/babel?path=packages/babel-helpers) |
|
||||
| [`babel-code-frame`](/packages/babel-code-frame) | [](https://www.npmjs.com/package/babel-code-frame) | [](https://david-dm.org/babel/babel?path=packages/babel-code-frame) |
|
||||
|
||||
- [`babel-cli`](/packages/babel-cli) is the CLI tool that runs `babel-core` and helps with outputting to a directory, a file, stdout and more (also includes `babel-node`). Check out the [docs](https://babeljs.io/docs/usage/cli/).
|
||||
- [`babel-types`](/packages/babel-types) is used to validate, build and change AST nodes.
|
||||
- [`babel-polyfill`](/packages/babel-polyfill) is [literally a wrapper](https://github.com/babel/babel/blob/master/packages/babel-polyfill/src/index.js) around [`core-js`](https://github.com/zloirock/core-js) and [regenerator-runtime](https://github.com/facebook/regenerator/tree/master/packages/regenerator-runtime). Check out the [docs](https://babeljs.io/docs/usage/polyfill/).
|
||||
- [`babel-runtime`](/packages/babel-runtime) is similar to the polyfill except that it doesn't modify the global scope and is to be used with [`babel-plugin-transform-runtime`](/packages/babel-plugin-transform-runtime) (usually in library/plugin code). Check out the [docs](https://babeljs.io/docs/plugins/transform-runtime/).
|
||||
- [`babel-register`](/packages/babel-register) is a way to automatically compile files with Babel on the fly by binding to Node.js `require`. Check out the [docs](http://babeljs.io/docs/usage/require/).
|
||||
- [`babel-template`](/packages/babel-template) is a helper function that allows constructing AST nodes from a string presentation of the code; this eliminates the tedium of using `babel-types` for building AST nodes.
|
||||
- [`babel-helpers`](/packages/babel-helpers) is a set of pre-made `babel-template` functions that are used in some Babel plugins.
|
||||
- [`babel-code-frame`](/packages/babel-code-frame) is a standalone package used to generate errors that print the source code and point to error locations.
|
||||
|
||||
### [Presets](http://babeljs.io/docs/plugins/#presets)
|
||||
|
||||
After Babel 6, the default transforms were removed; if you don't specify any plugins/presets, Babel will just return the original source code.
|
||||
|
||||
The transformer[s] used in Babel are the independent pieces of code that transform specific things. For example: the [`es2015-arrow-functions`](/packages/babel-plugin-transform-es2015-arrow-functions) transform specifically changes arrow functions into regular functions. A preset is simply an array of plugins that make it easier to run a whole a set of transforms without specifying each one manually.
|
||||
|
||||
| Package | Version | Dependencies | Description |
|
||||
|--------|-------|------------|---|
|
||||
| [`babel-preset-env`](https://github.com/babel/babel-preset-env) | [](https://www.npmjs.com/package/babel-preset-env) | [](https://david-dm.org/babel/babel-preset-env) | automatically determines plugins and polyfills you need based on your supported environments |
|
||||
|
||||
> You can find community maintained presets on [npm](https://www.npmjs.com/search?q=babel-preset)
|
||||
|
||||
### [Plugins](http://babeljs.io/docs/plugins)
|
||||
|
||||
Plugins are the heart of Babel and what make it work.
|
||||
|
||||
> You can find community plugins on [npm](https://www.npmjs.com/search?q=babel-plugin).
|
||||
|
||||
#### Transform Plugins
|
||||
|
||||
There are many kinds of plugins: ones that convert ES6/ES2015 to ES5, transform to ES3, minification, JSX, flow, experimental features, and more. Check out our [website for more](http://babeljs.io/docs/plugins/#transform-plugins).
|
||||
|
||||
#### Syntax Plugins
|
||||
|
||||
These just enable the transform plugins to be able to parse certain features (the transform plugins already include the syntax plugins so you don't need both): `babel-plugin-syntax-x`. Check out our [website for more](http://babeljs.io/docs/plugins/#syntax-plugins).
|
||||
|
||||
### Helpers
|
||||
|
||||
These are mostly for internal use in various plugins: `babel-helper-x`.
|
||||
The Babel repo is managed as a [monorepo](https://github.com/babel/babel/blob/master/doc/design/monorepo.md) that is composed of many [npm packages](/packages#readme).
|
||||
|
||||
## Team
|
||||
|
||||
### Core members
|
||||
|
||||
[](https://github.com/babel) | [](https://github.com/danez) | [](https://github.com/loganfsmyth) | [](https://github.com/hzoo) |
|
||||
[](https://github.com/babel) | [](https://github.com/danez) | [](https://github.com/loganfsmyth) | [](https://github.com/hzoo) |
|
||||
|---|---|---|---|
|
||||
Babel | Daniel Tschinder | Logan Smyth | Henry Zhu |
|
||||
:octocat: [@babel](https://github.com/babel) | [@danez](https://github.com/danez) | [@loganfsmyth](https://github.com/loganfsmyth) | [@hzoo](https://github.com/hzoo) |
|
||||
@@ -192,7 +113,7 @@ Babel | Daniel Tschinder | Logan Smyth | Henry Zhu |
|
||||
|
||||
### Non-Human Members
|
||||
|
||||
[<img src="https://github.com/babel/babel-bot/raw/master/babel-bot.png" height="64">](https://github.com/babel-bot) |
|
||||
[<img src="https://github.com/babel/babel-bot/raw/master/babel-bot.png" height="64">](https://github.com/babel-bot) |
|
||||
|---|
|
||||
| Babel Bot |
|
||||
| [@babel-bot](https://github.com/babel-bot) |
|
||||
@@ -200,14 +121,13 @@ Babel | Daniel Tschinder | Logan Smyth | Henry Zhu |
|
||||
|
||||
### Inactive members
|
||||
|
||||
[](https://github.com/amasad) | [](https://github.com/thejameskyle) | [](https://github.com/jmm) | [](https://github.com/kittens) (Creator) |
|
||||
[](https://github.com/amasad) | [](https://github.com/thejameskyle) | [](https://github.com/jmm) | [](https://github.com/kittens) (Creator) |
|
||||
|---|---|---|---|
|
||||
Amjad Masad | James Kyle | Jesse McCarthy | Sebastian McKenzie |
|
||||
Amjad Masad | James Kyle | Jesse McCarthy | Sebastian McKenzie |
|
||||
[@amasad](https://github.com/amasad) | [@thejameskyle](https://github.com/thejameskyle) | [@jmm](https://github.com/jmm) | [@sebmck](https://twitter.com/sebmck) |
|
||||
| [@amasad](https://twitter.com/amasad) | [@thejameskyle](https://twitter.com/thejameskyle) | [@mccjm](https://twitter.com/mccjm) | [@kittens](https://github.com/kittens)
|
||||
| [@amasad](https://twitter.com/amasad) | [@thejameskyle](https://twitter.com/thejameskyle) | [@mccjm](https://twitter.com/mccjm) | [@kittens](https://github.com/kittens)
|
||||
|
||||
|
||||
# Backers
|
||||
## Backers
|
||||
|
||||
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/babel#backer)]
|
||||
|
||||
@@ -242,7 +162,7 @@ Support us with a monthly donation and help us continue our activities. [[Become
|
||||
<a href="https://opencollective.com/babel/backer/28/website" target="_blank"><img src="https://opencollective.com/babel/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/29/website" target="_blank"><img src="https://opencollective.com/babel/backer/29/avatar.svg"></a>
|
||||
|
||||
# Sponsors
|
||||
## Sponsors
|
||||
|
||||
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/babel#sponsor)]
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"settings": {
|
||||
"rulers": [
|
||||
110
|
||||
80
|
||||
],
|
||||
|
||||
// Set to false to disable detection of tabs vs. spaces on load
|
||||
|
||||
13
circle.yml
13
circle.yml
@@ -1,7 +1,12 @@
|
||||
general:
|
||||
artifacts:
|
||||
- "packages/babel-standalone/babel.js"
|
||||
- "packages/babel-standalone/babel.min.js"
|
||||
|
||||
machine:
|
||||
node:
|
||||
version:
|
||||
6
|
||||
8
|
||||
|
||||
dependencies:
|
||||
pre:
|
||||
@@ -14,3 +19,9 @@ dependencies:
|
||||
test:
|
||||
override:
|
||||
- make test-ci-coverage
|
||||
# Builds babel-standalone with the regular Babel config
|
||||
- make build
|
||||
# test-ci-coverage doesn't test babel-standalone, as trying to gather coverage
|
||||
# data for a JS file that's several megabytes large is bound to fail. Here,
|
||||
# we just run the babel-standalone test separately.
|
||||
- ./node_modules/mocha/bin/_mocha packages/babel-standalone/test/ --opts test/mocha.opts
|
||||
|
||||
6
codemods/.eslintrc
Normal file
6
codemods/.eslintrc
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"rules": {
|
||||
"prettier/prettier": ["error", { "trailingComma": "all" }],
|
||||
"no-undefined-identifier": 2
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
# babel-plugin-codemod-optional-catch-binding
|
||||
|
||||
> If the argument bound to the catch block is not referenced in the catch block, that argument and the catch binding is removed.
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
```js
|
||||
try {
|
||||
throw 0;
|
||||
} catch (err) {
|
||||
console.log("it failed, but this code executes");
|
||||
}
|
||||
```
|
||||
Is transformed to:
|
||||
|
||||
```js
|
||||
try {
|
||||
throw 0;
|
||||
} catch {
|
||||
console.log("it failed, but this code executes");
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install --save-dev babel-plugin-codemod-optional-catch-binding
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Via `.babelrc` (Recommended)
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["codemod-optional-catch-binding"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins codemod-optional-catch-binding script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("babel-core").transform("code", {
|
||||
plugins: ["codemod-optional-catch-binding"]
|
||||
});
|
||||
```
|
||||
|
||||
## References
|
||||
This codemod updates your source code in line with the following proposal:
|
||||
- [Proposal: Optional Catch Binding for ECMAScript](https://github.com/babel/proposals/issues/7)
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "babel-plugin-codemod-optional-catch-binding",
|
||||
"version": "7.0.0-beta.3",
|
||||
"description": "Remove unused catch bindings",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-remove-unused-catch-binding",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"keywords": [
|
||||
"babel-plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"babel-plugin-syntax-optional-catch-binding": "7.0.0-beta.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-helper-plugin-test-runner": "7.0.0-beta.3"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import syntaxOptionalCatchBinding from "babel-plugin-syntax-optional-catch-binding";
|
||||
|
||||
export default function(babel) {
|
||||
const { types: t } = babel;
|
||||
return {
|
||||
inherits: syntaxOptionalCatchBinding,
|
||||
|
||||
visitor: {
|
||||
CatchClause(path) {
|
||||
if (path.node.param === null || !t.isIdentifier(path.node.param)) {
|
||||
return;
|
||||
}
|
||||
const binding = path.scope.getOwnBinding(path.node.param.name);
|
||||
if (binding.constantViolations.length > 0) {
|
||||
return;
|
||||
}
|
||||
if (!binding.referenced) {
|
||||
const paramPath = path.get("param");
|
||||
paramPath.remove();
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch (e) {
|
||||
let e = new TypeError('Duplicate variable declaration; will throw an error.');
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"plugins": ["../../../../lib"],
|
||||
"throws": "Duplicate declaration \"e\""
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch {
|
||||
console.log("it failed, but this code executes");
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch {
|
||||
console.log("it failed, but this code executes");
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["../../../../lib"]
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch ([message]) {
|
||||
console.log("it failed, but this code executes");
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch ([message]) {
|
||||
console.log("it failed, but this code executes");
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["../../../../lib"]
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch (err) {
|
||||
console.log("it failed, but this code executes");
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch {
|
||||
console.log("it failed, but this code executes");
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["../../../../lib"]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch ({
|
||||
message
|
||||
}) {
|
||||
console.log("it failed, but this code executes");
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch ({
|
||||
message
|
||||
}) {
|
||||
console.log("it failed, but this code executes");
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["../../../../lib"]
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch ([message]) {
|
||||
console.log(message);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch ([message]) {
|
||||
console.log(message);
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["../../../../lib"]
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch (e) {
|
||||
e = new TypeError('A new variable is not being declared or initialized; the catch binding is being referenced and cannot be removed.');
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch (e) {
|
||||
e = new TypeError('A new variable is not being declared or initialized; the catch binding is being referenced and cannot be removed.');
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["../../../../lib"]
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch (err) {
|
||||
console.log(err, "it failed, but this code executes");
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch (err) {
|
||||
console.log(err, "it failed, but this code executes");
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["../../../../lib"]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch ({
|
||||
message
|
||||
}) {
|
||||
console.log(message);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch ({
|
||||
message
|
||||
}) {
|
||||
console.log(message);
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["../../../../lib"]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch (err) {
|
||||
console.log("it failed, but this code executes");
|
||||
} finally {
|
||||
console.log("this code also executes");
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch {
|
||||
console.log("it failed, but this code executes");
|
||||
} finally {
|
||||
console.log("this code also executes");
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["../../../../lib"]
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch (err) {
|
||||
console.log(err, "it failed, but this code executes");
|
||||
} finally {
|
||||
console.log("this code also executes");
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch (err) {
|
||||
console.log(err, "it failed, but this code executes");
|
||||
} finally {
|
||||
console.log("this code also executes");
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["../../../../lib"]
|
||||
}
|
||||
@@ -21,7 +21,7 @@ This is quite taboo but let's look at the pros and cons:
|
||||
|
||||
* Codebase looks more intimidating.
|
||||
* Repo is bigger in size.
|
||||
* Lower ranking in [npms](https://npms.io/) results. At least until [npms-io/npms-analyzer#83](https://github.com/npms-io/npms-analyzer/issues/83) is fixed.
|
||||
* [Can't `npm install` modules directly from GitHub](https://github.com/npm/npm/issues/2974)
|
||||
* ???
|
||||
|
||||
## This is dumb! Nobody in open source does this!
|
||||
|
||||
6
experimental/.eslintrc
Normal file
6
experimental/.eslintrc
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"rules": {
|
||||
"prettier/prettier": ["error", { "trailingComma": "all" }],
|
||||
"no-undefined-identifier": 2
|
||||
}
|
||||
}
|
||||
6
experimental/babel-preset-env/.eslintignore
Normal file
6
experimental/babel-preset-env/.eslintignore
Normal file
@@ -0,0 +1,6 @@
|
||||
/lib
|
||||
debug-fixtures
|
||||
fixtures
|
||||
/data
|
||||
/flow-typed
|
||||
test/tmp
|
||||
10
experimental/babel-preset-env/.gitignore
vendored
Normal file
10
experimental/babel-preset-env/.gitignore
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
node_modules
|
||||
coverage
|
||||
lib
|
||||
test/tmp
|
||||
.DS_Store
|
||||
*.log
|
||||
.vscode
|
||||
.nyc_output
|
||||
tmp
|
||||
babel-preset-env-*.tgz
|
||||
15
experimental/babel-preset-env/.npmignore
Normal file
15
experimental/babel-preset-env/.npmignore
Normal file
@@ -0,0 +1,15 @@
|
||||
coverage
|
||||
src
|
||||
test
|
||||
lib/types.js
|
||||
node_modules
|
||||
scripts
|
||||
.eslintignore
|
||||
.travis.yml
|
||||
codecov.yml
|
||||
yarn.lock
|
||||
.nyc_output
|
||||
.vscode
|
||||
.eslintrc
|
||||
babel-preset-env-*.tgz
|
||||
flow-typed
|
||||
654
experimental/babel-preset-env/CHANGELOG.md
Normal file
654
experimental/babel-preset-env/CHANGELOG.md
Normal file
@@ -0,0 +1,654 @@
|
||||
# Changelog
|
||||
|
||||
## v1.6.0 (2017-07-04)
|
||||
|
||||
### :rocket: New Feature
|
||||
|
||||
- Bump compat-table for node8 support ([#363](https://github.com/babel/babel-preset-env/pull/363)) (@existentialism)
|
||||
|
||||
We updated our mappings to support native trailing function commas and string paddings in Node.js 8+.
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Handle `chromeandroid` browserslist value ([#367](https://github.com/babel/babel-preset-env/pull/367)) (@yavorsky)
|
||||
|
||||
We added support for using browserslist's `chromeandroid` in `targets`.
|
||||
|
||||
### :memo: Documentation
|
||||
|
||||
- Tweak uglify option docs ([#368](https://github.com/babel/babel-preset-env/pull/368)) (@existentialism)
|
||||
|
||||
Thanks to @graingert and @pfiaux for pointing out some needed updates to the `uglify-js`-related docs.
|
||||
|
||||
## v1.5.2 (2017-06-07)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Ensure explicit targets always override browsers key targets ([#346](https://github.com/babel/babel-preset-env/pull/346)) (@existentialism)
|
||||
|
||||
`browser` targets should be overridden by explicit targets, and we inadvertently broke this when we landed string version support.
|
||||
|
||||
## v1.5.1 (2017-05-22)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Compile with loose mode ([#322](https://github.com/babel/babel-preset-env/pull/332)) (@existentialism)
|
||||
|
||||
## v1.5.0 (2017-05-19)
|
||||
|
||||
### :rocket: New Feature
|
||||
|
||||
- Support target versions as strings ([#321](https://github.com/babel/babel-preset-env/pull/321)) (@existentialism)
|
||||
|
||||
We were originally waiting on 2.x for a breaking change, but since node v7.10
|
||||
and other targets are causing some pain, we decided to land a backwards
|
||||
compatible version.
|
||||
|
||||
### :house: Internal
|
||||
|
||||
- Backport: use preset-env and remove flow-strip-types ([#324](https://github.com/babel/babel-preset-env/pull/324)) (@yavorsky)
|
||||
- Bump electron-to-chromium ([#329](https://github.com/babel/babel-preset-env/pull/329)) (@existentialism)
|
||||
- Tweak version mappings to match compat-table updates ([#323](https://github.com/babel/babel-preset-env/pull/323)) (@existentialism)
|
||||
- Bump browserslist ([#319](https://github.com/babel/babel-preset-env/pull/319)) (@existentialism)
|
||||
- Bump compat-table ([#307](https://github.com/babel/babel-preset-env/pull/307)) (@existentialism)
|
||||
- Add debug-fixtures and test/tmp to .eslintignore ([#305](https://github.com/babel/babel-preset-env/pull/305)) (@yavorsky)
|
||||
|
||||
## v1.4.0 (2017-04-14)
|
||||
|
||||
### :rocket: New Feature
|
||||
|
||||
- Support `spec` option ([#98](https://github.com/babel/babel-preset-env/pull/98)) (@Kovensky)
|
||||
|
||||
Added an option to enable more spec compliant, but potentially slower, transformations for any plugins in this preset that support them.
|
||||
|
||||
- Bump compat-table for Edge 15 support ([#273](https://github.com/babel/babel-preset-env/pull/273)) (@existentialism)
|
||||
|
||||
We updated our mappings so that you can get native support for async/await and other goodies when targeting Edge 15!
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Add Android browser to name map ([#270](https://github.com/babel/babel-preset-env/pull/270)) (@existentialism)
|
||||
|
||||
Fixed a bug that was ignoring Android targets in browserslist queries (for example: "Android >= 4").
|
||||
|
||||
### :memo: Documentation
|
||||
|
||||
- Clarify note about loading polyfills only once ([#282](https://github.com/babel/babel-preset-env/pull/282)) (@darahak)
|
||||
- Add a reminder about include/exclude options ([#275](https://github.com/babel/babel-preset-env/pull/275)) (@existentialism)
|
||||
|
||||
### :house: Internal
|
||||
|
||||
- Chore: reduce package size. ([#281](https://github.com/babel/babel-preset-env/pull/281)) (@evilebottnawi)
|
||||
- Remove deprecated comment ([#271](https://github.com/babel/babel-preset-env/pull/271)) (@yavorsky)
|
||||
|
||||
## v1.3.3 (2017-04-07)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Support electron version in a string format ([#252](https://github.com/babel/babel-preset-env/pull/252)) (@yavorsky)
|
||||
|
||||
Adding electron as a target was an inadvertent breaking change as it no longer
|
||||
allowed string versions. We added an exception for now, even though it is
|
||||
inconsistent with other versions. Just as a note, the upcoming version 2.x will
|
||||
allow _both_ number and string versions.
|
||||
|
||||
- Ensure const-check plugin order ([#257](https://github.com/babel/babel-preset-env/pull/257)) (@existentialism)
|
||||
|
||||
We now force the `const-es2015-check` plugin to run first (so that it can
|
||||
correctly report issues before they get transpiled away).
|
||||
|
||||
### :rocket: New Feature
|
||||
|
||||
- Allow use `babel-plugin-` prefix for include and exclude ([#242](https://github.com/babel/babel-preset-env/pull/242)) (@yavorsky)
|
||||
|
||||
The `include` and `exclude` options now allow both prefixed (`babel-plugin-transform-es2015-spread`)
|
||||
and prefix-less (`transform-es2015-spread`) plugin names.
|
||||
|
||||
### :memo: Documentation
|
||||
|
||||
- Note babel plugin prefix handling in include/exclude ([#245](https://github.com/babel/babel-preset-env/pull/245)) (@existentialism)
|
||||
- Fix README: debug option shows info in stdout. ([#236](https://github.com/babel/babel-preset-env/pull/236)) (@Gerhut)
|
||||
|
||||
### :house: Internal
|
||||
|
||||
- Add simple smoke-test ([#240](https://github.com/babel/babel-preset-env/pull/240)) (@existentialism)
|
||||
- Add prepublish script (@existentialism)
|
||||
|
||||
## v1.3.2 (2017-03-30)
|
||||
|
||||
- Fixed an issue with a broken publish
|
||||
|
||||
## v1.3.1 (2017-03-30)
|
||||
|
||||
- Fixed a regression with missing files due to `.npmignore`.
|
||||
|
||||
## v1.3.0 (2017-03-30)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Add check for ArrayBuffer[Symbol.species] ([#233](https://github.com/babel/babel-preset-env/pull/233)) (@existentialism)
|
||||
|
||||
We now properly check for `Symbol.species` support in ArrayBuffer and include the
|
||||
polyfill if necessary. This should, as a side effect, fix ArrayBuffer-related
|
||||
errors on IE9.
|
||||
|
||||
### :nail_care: Polish
|
||||
|
||||
- Fill data with electron as a target. ([#229](https://github.com/babel/babel-preset-env/pull/229)) (@yavorsky)
|
||||
|
||||
We've simplified things by adding `electron` as a target instead of doing a bunch of
|
||||
things at runtime. Electron targets should now also be displayed in the debug output.
|
||||
|
||||
- separate default builtins for platforms ([#226](https://github.com/babel/babel-preset-env/pull/226)) (@restrry)
|
||||
|
||||
If you are targeting the `node` environment exclusively, the always-included web polyfills
|
||||
(like `dom.iterable`, and a few others) will now no longer be included.
|
||||
|
||||
### :memo: Documentation
|
||||
|
||||
* remove deprecated projects ([#223](https://github.com/babel/babel-preset-env/pull/223)) [skip ci] (@stevemao)
|
||||
|
||||
### :house: Internal
|
||||
|
||||
* npmignore: Add related to build data and codecov. ([#216](https://github.com/babel/babel-preset-env/pull/216)) (@yavorsky)
|
||||
|
||||
## v1.2.2 (2017-03-14)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Refactor browser data parsing to handle families ([#208](https://github.com/babel/babel-preset-env/pull/208)) (@existentialism)
|
||||
|
||||
When parsing plugin data, we weren't properly handling browser families. This caused
|
||||
`transform-es2015-block-scoping` and other plugins to be incorrectly added for Edge >= 12.
|
||||
(s/o to @mgol for the the report and review!)
|
||||
|
||||
- Add typed array methods to built-ins features. ([#198](https://github.com/babel/babel-preset-env/pull/198)) (@yavorsky)
|
||||
|
||||
Fixes an issue where some TypedArray features were not being polyfilled properly. (s/o to @alippai for the report!)
|
||||
|
||||
### :memo: Documentation
|
||||
|
||||
- Fixed minor typo in readme ([#199](https://github.com/babel/babel-preset-env/pull/199)) (@bl4ckdu5t)
|
||||
- Add built-ins, better links, compat-table url, etc ([#195](https://github.com/babel/babel-preset-env/pull/195)) (@yavorsky)
|
||||
- Change CONTRIBUTING.md to use absolute paths ([#194](https://github.com/babel/babel-preset-env/pull/194)) (@aaronang)
|
||||
|
||||
### :house: Internal
|
||||
|
||||
- Bump plugins ([#201](https://github.com/babel/babel-preset-env/pull/201)) (@yavorsky)
|
||||
- Enable code coverage ([#200](https://github.com/babel/babel-preset-env/pull/200)) (@alxpy)
|
||||
- Increase mocha timeout to 10s ([#202](https://github.com/babel/babel-preset-env/pull/202)) (@yavorsky)
|
||||
|
||||
## v1.2.1 (2017-03-06)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Add transform-duplicate-keys mapping ([#192](https://github.com/babel/babel-preset-env/pull/192)) (@existentialism)
|
||||
|
||||
Our plugin data was missing a mapping for the `transform-duplicate-keys` plugin which caused it to never be included. (s/o to @Timer for the report!)
|
||||
|
||||
### :memo: Documentation
|
||||
|
||||
- Clarify reasons for the uglify option in README.md ([#188](https://github.com/babel/babel-preset-env/pull/188)) (@mikegreiling)
|
||||
|
||||
## v1.2.0 (2017-03-03)
|
||||
|
||||
### :rocket: New Feature
|
||||
|
||||
- Add uglify as a target ([#178](https://github.com/babel/babel-preset-env/pull/178)) (@yavorsky)
|
||||
|
||||
Support for `uglify` as a target is now available! This will enable all plugins and, as a result, fully compiles your code to ES5. Note, that useBuiltIns will work as before, and only the polyfills that your other target(s) need will be included.
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"chrome": 55,
|
||||
"uglify": true
|
||||
},
|
||||
"useBuiltIns": true,
|
||||
"modules": false
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Respect older versions in invert equals map ([#180](https://github.com/babel/babel-preset-env/pull/180)) (@danez)
|
||||
|
||||
Fixes a number of bugs that caused some incorrect and/or missing environment data when parsing `compat-table`.
|
||||
|
||||
## v1.1.11 (2017-03-01)
|
||||
|
||||
This release primarily upgrades `compat-table`, which adds support for async on Node 7.6!
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Fix hasBeenWarned condition. ([#175](https://github.com/babel/babel-preset-env/pull/175)) (@yavorsky)
|
||||
|
||||
### :memo: Documentation
|
||||
|
||||
- Add yarn example. ([#174](https://github.com/babel/babel-preset-env/pull/174)) (@yavorsky)
|
||||
|
||||
### :house: Internal
|
||||
|
||||
- Bump compat-table ([#177](https://github.com/babel/babel-preset-env/pull/177)) (@existentialism)
|
||||
- Add electron version exception test ([#176](https://github.com/babel/babel-preset-env/pull/176)) (@existentialism)
|
||||
|
||||
## v1.1.10 (2017-02-24)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Drop use of lodash/intersection from checkDuplicateIncludeExcludes ([#173](https://github.com/babel/babel-preset-env/pull/173)) (@existentialism)
|
||||
|
||||
## v1.1.9 (2017-02-24)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Add tests for debug output ([#156](https://github.com/babel/babel-preset-env/pull/156)) (@existentialism)
|
||||
|
||||
Since we've (mostly @yavorsky) have fixed a number of bugs recently with the `debug` option output, we added the ability to assert stdout matches what we expect. Read the updated [CONTRIBUTING.md](https://github.com/babel/babel-preset-env/blob/master/CONTRIBUTING.md#testing-the-debug-option) for more info.
|
||||
|
||||
- Fixes #143. Log correct targets. ([#155](https://github.com/babel/babel-preset-env/pull/155)) (@yavorsky)
|
||||
|
||||
This fixes a bug in the `debug` output where incorrect target(s) were being displayed for why a particular plugin/preset was being included.
|
||||
|
||||
Given targets:
|
||||
|
||||
```txt
|
||||
{
|
||||
"firefox": 52,
|
||||
"node": 7.4
|
||||
}
|
||||
```
|
||||
|
||||
Before:
|
||||
|
||||
```txt
|
||||
Using plugins:
|
||||
transform-es2015-destructuring {"node":6.5}
|
||||
transform-es2015-for-of {"node":6.5}
|
||||
transform-es2015-function-name {"node":6.5}
|
||||
transform-es2015-literals {"node":4}
|
||||
transform-exponentiation-operator {"firefox":52}
|
||||
syntax-trailing-function-commas {"firefox":52}
|
||||
```
|
||||
|
||||
After:
|
||||
|
||||
```txt
|
||||
Using plugins:
|
||||
transform-es2015-destructuring {"firefox":52}
|
||||
transform-es2015-for-of {"firefox":52}
|
||||
transform-es2015-function-name {"firefox":52}
|
||||
transform-es2015-literals {"firefox":52}
|
||||
transform-exponentiation-operator {"node":7.4}
|
||||
syntax-trailing-function-commas {"node":7.4}
|
||||
```
|
||||
|
||||
### :memo: Documentation
|
||||
|
||||
- Fix compat-table link in contributing.md (@existentialism)
|
||||
- Update README examples to fix website ([#151](https://github.com/babel/babel-preset-env/pull/)) (@existentialism)
|
||||
- Fix few typos ([#146](https://github.com/babel/babel-preset-env/pull/146)) (@existentialism)
|
||||
- Add configuration example to clarify `debug: true` ([#138](https://github.com/babel/babel-preset-env/pull/138)) (@yavorsky)
|
||||
- Fix CHANGELOG’s v1.1.8 updates typo. ([#136](https://github.com/babel/babel-preset-env/pull/136)) (@yavorsky)
|
||||
- README: Update `debug: true` example. ([#138](https://github.com/babel/babel-preset-env/pull/138)) (@yavorsky)
|
||||
|
||||
### :house: Internal
|
||||
|
||||
- update compat ([#169](https://github.com/babel/babel-preset-env/pull/169)) (@hzoo)
|
||||
- Use external Electron to Chromium library ([#144](https://github.com/babel/babel-preset-env/pull/144)) (@Kilian)
|
||||
- Update yarn lockfile ([#152](https://github.com/babel/babel-preset-env/pull/152)) (@existentialism)
|
||||
- Extract option normalization into independant file ([#125](https://github.com/babel/babel-preset-env/pull/125)) (@baer)
|
||||
- Update yarnfile ([#145](https://github.com/babel/babel-preset-env/pull/145)) (@baer)
|
||||
- devDeps: eslint-config-babel v5.0.0 ([#139](https://github.com/babel/babel-preset-env/pull/139)) (@kaicataldo)
|
||||
- Update compat-table, build data ([#135](https://github.com/babel/babel-preset-env/pull/135)) (@hzoo)
|
||||
|
||||
## v1.1.8 (2017-01-10)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Debug: Transformations before logs. ([#128](https://github.com/babel/babel-preset-env/pull/128)) (@yavorsky)
|
||||
|
||||
Makes sure that all transformations on `targets` (such as `exclude`/`include`) are run before logging out with the `debug` option. Fixes ([#127](https://github.com/babel/babel-preset-env/issues/127)).
|
||||
|
||||
### :house: Internal
|
||||
|
||||
- Remove unnecessary extension. ([#131](https://github.com/babel/babel-preset-env/pull/131)) (@roman-yakobnyuk)
|
||||
- Include yarn.lock and update CI. ([#124](https://github.com/babel/babel-preset-env/pull/124)) (@existentialism)
|
||||
|
||||
## v1.1.7 (2017-01-09)
|
||||
|
||||
Had a publishing issue in the previous release.
|
||||
|
||||
## v1.1.6 (2017-01-06)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Explicitly resolve lowest browser version. ([#121](https://github.com/babel/babel-preset-env/pull/121)) (@brokenmass)
|
||||
|
||||
```js
|
||||
{
|
||||
"targets": {
|
||||
"browsers": ["ios >= 6"] // was resolving to {ios: 10} rather than {ios: 6}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## v1.1.5 (2017-01-04)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
- Show error if target version is not a number. ([#107](https://github.com/babel/babel-preset-env/pull/107)) (@existentialism)
|
||||
|
||||
```js
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"chrome": "52", // will error since it's not a number,
|
||||
"chrome": 52 // correct!
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
- Fix targets for the `debug` option. ([#109](https://github.com/babel/babel-preset-env/pull/109)) (@yavorsky)
|
||||
|
||||
Now it prints the transformed targets/environments rather than the browsers query.
|
||||
|
||||
```txt
|
||||
Using targets:
|
||||
{
|
||||
"chrome": 53,
|
||||
"ie": 10,
|
||||
"node": 6
|
||||
}
|
||||
|
||||
Modules transform: false
|
||||
|
||||
Using plugins:
|
||||
transform-es2015-arrow-functions {"chrome":47,"node":6}
|
||||
transform-es2015-block-scoped-functions {"chrome":41,"ie":11,"node":4}
|
||||
|
||||
Using polyfills:
|
||||
es6.typed.uint8-clamped-array {"chrome":5,"node":0.12}
|
||||
es6.map {"chrome":51,"node":6.5}
|
||||
```
|
||||
|
||||
## v1.1.4 (2016-12-16)
|
||||
|
||||
v1.1.2-v1.1.4
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
The new `exclude`/`include` options weren't working correctly for built-ins. ([#102](https://github.com/babel/babel-preset-env/pull/102)).
|
||||
|
||||
Also fixes an issue with debug option.
|
||||
|
||||
## v1.1.1 (2016-12-13)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
Regression with the previous release due to using `Object.values` (ES2017). This wasn't caught because we are using babel-register to run tests and includes polyfills so it didn't fail on CI even though we have Node 0.10 as an env. Looking into fixing this to prevent future issues.
|
||||
|
||||
## v1.1.0 (2016-12-13)
|
||||
|
||||
### :rocket: New Feature
|
||||
|
||||
- Add `exclude` option, rename `whitelist` to `include` ([#89](https://github.com/babel/babel-preset-env/pull/89)) (@hzoo)
|
||||
|
||||
Example:
|
||||
|
||||
```js
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"browsers": ["last 2 versions", "safari >= 7"]
|
||||
},
|
||||
"include": ["transform-es2015-arrow-functions"],
|
||||
"exclude": [
|
||||
"transform-regenerator",
|
||||
"transform-async-to-generator",
|
||||
"map"
|
||||
],
|
||||
"useBuiltIns": true
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
`"exclude": ["transform-regenerator"]` doesn't transform generators and removes `regeneratorRuntime` from being imported.
|
||||
|
||||
`"exclude": ["transform-async-to-generator"]` doesn't use the built-in async-to-gen transform so you can use something like [fast-async](https://github.com/MatAtBread/fast-async).
|
||||
|
||||
`"exclude": ["map"]` doesn't include the `Map` polyfill if you know you aren't using it in your code (w/ `useBuiltIns`). (We will figure out a way to automatically do this [#84](https://github.com/babel/babel-preset-env/issues/84)).
|
||||
|
||||
If you pass a wrong plugin it will error: valid options for `include/exclude` are in [/data/plugin-features.js](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js) and [/data/built-in-features.js](https://github.com/babel/babel-preset-env/blob/master/data/built-in-features.js) (without the `es6.`)
|
||||
|
||||
### :house: Internal
|
||||
|
||||
- Optimize result filtration. ([#77](https://github.com/babel/babel-preset-env/pull/77)) (@yavorsky)
|
||||
- Update eslint config to align with other babel projects ([#79](https://github.com/babel/babel-preset-env/pull/79)) (@baer)
|
||||
- Update pathnames to avoid uppercase ([#80](https://github.com/babel/babel-preset-env/pull/80)) (@baer)
|
||||
- Refactor build data for clarity/consistency ([#81](https://github.com/babel/babel-preset-env/pull/81)) (@baer)
|
||||
- Update linting rules to cover all js ([#82](https://github.com/babel/babel-preset-env/pull/82)) (@baer)
|
||||
- Cleanup lib before rebuilding ([#87](https://github.com/babel/babel-preset-env/pull/87)) (@baer)
|
||||
- Move linting dependency to be dev only ([#88](https://github.com/babel/babel-preset-env/pull/88)) (@baer)
|
||||
|
||||
### :memo: Documentation
|
||||
|
||||
- Fix typo ([#78](https://github.com/babel/babel-preset-env/pull/78)) (@rohmanhm)
|
||||
- Fix PR link in changelog. ([#75](https://github.com/babel/babel-preset-env/pull/75)) (@nhajidin)
|
||||
|
||||
## v1.0.2 (2016-12-10)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
* Fix issue with Object.getOwnPropertySymbols ([#71](https://github.com/babel/babel-preset-env/pull/71)) ([@existentialism](https://github.com/existentialism))
|
||||
|
||||
Was requiring the wrong module kinda of like in v1.0.1:
|
||||
|
||||
https://github.com/zloirock/core-js#ecmascript-6-symbol
|
||||
|
||||
```diff
|
||||
-import "core-js/modules/es6.object.get-own-property-symbols";
|
||||
```
|
||||
|
||||
The test is just a part of `Symbol`.
|
||||
|
||||
## v1.0.1 (2016-12-10)
|
||||
|
||||
### :bug: Bug Fix
|
||||
|
||||
* Fix regenerator import ([#68](https://github.com/babel/babel-preset-env/pull/68)) ([@hzoo](https://github.com/hzoo))
|
||||
|
||||
We were outputting an invalid path for `regenerator`!
|
||||
|
||||
```diff
|
||||
+import "regenerator-runtime/runtime";
|
||||
-import "core-js/modules/regenerator-runtime/runtime"-
|
||||
```
|
||||
|
||||
## v1.0.0 (2016-12-09)
|
||||
|
||||
### :rocket: New Feature
|
||||
|
||||
* Add `useBuiltIns` option ([#56](https://github.com/babel/babel-preset-env/pull/56)) ([@hzoo](https://github.com/hzoo)), ([@yavorsky](https://github.com/yavorsky)), ([@existentialism](https://github.com/existentialism))
|
||||
|
||||
A way to apply `babel-preset-env` for polyfills (via `"babel-polyfill"``).
|
||||
|
||||
> This option will apply a new Babel plugin that replaces `require("babel-polyfill")` with the individual requires for `babel-polyfill` based on the target environments.
|
||||
|
||||
Install
|
||||
|
||||
```
|
||||
npm install babel-polyfill --save
|
||||
```
|
||||
|
||||
In
|
||||
|
||||
```js
|
||||
import "babel-polyfill"; // create an entry js file that contains this
|
||||
// or
|
||||
import "core-js";
|
||||
```
|
||||
|
||||
Out (different based on environment)
|
||||
|
||||
```js
|
||||
// chrome 55
|
||||
import "core-js/modules/es7.string.pad-start"; // haha left_pad
|
||||
import "core-js/modules/es7.string.pad-end";
|
||||
import "core-js/modules/web.timers";
|
||||
import "core-js/modules/web.immediate";
|
||||
import "core-js/modules/web.dom.iterable";
|
||||
```
|
||||
|
||||
`.babelrc` Usage
|
||||
|
||||
```js
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"electron": 1.4
|
||||
},
|
||||
"modules": false, // webpack 2
|
||||
"useBuiltIns": true // new option
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
> Also looking to make an easier integration point via Webpack with this method. Please reach out if you have ideas!
|
||||
|
||||
---
|
||||
|
||||
* Support [Electron](http://electron.atom.io/) ([#55](https://github.com/babel/babel-preset-env/pull/55)) ([@paulcbetts](https://github.com/paulcbetts))
|
||||
|
||||
Electron is also an environment, so [Paul went ahead](https://twitter.com/paulcbetts/status/804507070103851008) and added support for this!
|
||||
|
||||
`.babelrc` Usage
|
||||
|
||||
```js
|
||||
{
|
||||
"presets": [ ["env", {"targets": { "electron": 1.4 }}]]
|
||||
}
|
||||
```
|
||||
|
||||
> Currently we are manually updating the data in [/data/electron-to-chromium.js](https://github.com/babel/babel-preset-env/blob/master/data/electron-to-chromium.js), but [@kevinsawicki](https://github.com/kevinsawicki) says we could generate the data from [atom-shell/dist/index.json](https://gh-contractor-zcbenz.s3.amazonaws.com/atom-shell/dist/index.json) as well! (Someone should make a PR :smile:)
|
||||
|
||||
|
||||
|
||||
## v0.0.9 (2016-11-24)
|
||||
|
||||
### :rocket: New Feature
|
||||
|
||||
* Support Opera ([#48](https://github.com/babel/babel-preset-env/pull/48)) (Henry Zhu)
|
||||
|
||||
Was as simple as modifying the chrome version and subtracting 13! (so chrome 54 = opera 41)
|
||||
|
||||
```js
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"opera": 41
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## v0.0.8 (2016-11-16)
|
||||
|
||||
### :nail_care: Polish
|
||||
|
||||
* Only print the debug info once ([#46](https://github.com/babel/babel-preset-env/pull/46) (Henry Zhu)
|
||||
|
||||
When using the `debug` option it was printing the data for each file processed rather than once.
|
||||
|
||||
```js
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"debug": true
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## v0.0.7 (2016-11-02)
|
||||
|
||||
### :rocket: New Feature
|
||||
|
||||
* hardcode a current node version option ([#35](https://github.com/babel/babel-preset-env/pull/35)) (Henry Zhu)
|
||||
|
||||
```js
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"node": "current" // parseFloat(process.versions.node)
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
* add 'whitelist' option ([#31](https://github.com/babel/babel-preset-env/pull/31)) (Henry Zhu)
|
||||
|
||||
```js
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"chrome": 52
|
||||
},
|
||||
"whitelist": ["transform-es2015-arrow-functions"]
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
* Add more aliases (Henry Zhu)
|
||||
* Update plugin data: firefox 52 supports async/await! ([#29](https://github.com/babel/babel-preset-env/pull/29)) (Henry Zhu)
|
||||
|
||||
### :bug: Bug Fixes
|
||||
|
||||
* Use compat-table equals option ([#36](https://github.com/babel/babel-preset-env/pull/36)) (Henry Zhu)
|
||||
|
||||
Compute and use `compat-table` equivalents
|
||||
|
||||
```js
|
||||
{
|
||||
"safari6": "phantom",
|
||||
"chrome44": "iojs",
|
||||
"chrome50": "node64",
|
||||
"chrome51": "node65",
|
||||
"chrome54": "node7",
|
||||
"chrome30": "android44",
|
||||
"chrome37": "android50",
|
||||
"chrome39": "android51",
|
||||
"safari7": "ios7",
|
||||
"safari71_8": "ios8",
|
||||
"safari9": "ios9",
|
||||
"safari10": "ios10",
|
||||
"chrome50": "node6"
|
||||
}
|
||||
```
|
||||
|
||||
* Change default behavior to act the same as babel-preset-latest ([#33](https://github.com/babel/babel-preset-env/pull/33)) (Henry Zhu)
|
||||
|
||||
```js
|
||||
{ "presets": ["env"] } // should act the same as babel-preset-latest
|
||||
```
|
||||
|
||||
## Internal
|
||||
|
||||
* Add fixture helper for tests ([#28](https://github.com/babel/babel-preset-env/pull/28)) (Henry Zhu)
|
||||
93
experimental/babel-preset-env/CONTRIBUTING.md
Normal file
93
experimental/babel-preset-env/CONTRIBUTING.md
Normal file
@@ -0,0 +1,93 @@
|
||||
# Contributing
|
||||
|
||||
## Adding a new plugin to support (when approved in the next ECMAScript version)
|
||||
|
||||
### Update [`plugin-features.js`](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js)
|
||||
|
||||
*Example:*
|
||||
|
||||
If you were going to add `**` which is in ES2016:
|
||||
|
||||
Find the relevant entries on [compat-table](https://kangax.github.io/compat-table/es2016plus/#test-exponentiation_(**)_operator):
|
||||
|
||||
`exponentiation (**) operator`
|
||||
|
||||
Find the corresponding babel plugin:
|
||||
|
||||
`transform-exponentiation-operator`
|
||||
|
||||
And add them in this structure:
|
||||
|
||||
```js
|
||||
// es2016
|
||||
"transform-exponentiation-operator": {
|
||||
features: [
|
||||
"exponentiation (**) operator",
|
||||
],
|
||||
},
|
||||
```
|
||||
|
||||
### Update [`built-in-features.js`](https://github.com/babel/babel-preset-env/blob/master/data/built-in-features.js)
|
||||
|
||||
*Example:*
|
||||
|
||||
In case you want to add `Object.values` which is in ES2017:
|
||||
|
||||
Find the relevant feature and subfeature on [compat-table](https://kangax.github.io/compat-table/es2016plus/#test-Object_static_methods_Object.values)
|
||||
and split it with `/`:
|
||||
|
||||
`Object static methods / Object.values`
|
||||
|
||||
Find the corresponding module on [core-js](https://github.com/zloirock/core-js/tree/master/modules):
|
||||
|
||||
`es7.object.values.js`
|
||||
|
||||
Find required ES version in [`built-in-features.js`](https://github.com/babel/babel-preset-env/blob/master/data/built-in-features.js) and add the new feature:
|
||||
|
||||
```js
|
||||
const es2017 = {
|
||||
//...
|
||||
"es7.object.values": "Object static methods / Object.values"
|
||||
}
|
||||
```
|
||||
|
||||
### Update [`plugins.json`](https://github.com/babel/babel-preset-env/blob/master/data/plugins.json)
|
||||
|
||||
Until `compat-table` is a standalone npm module for data we are using the git url
|
||||
|
||||
`"compat-table": "kangax/compat-table#[latest-commit-hash]"`,
|
||||
|
||||
So we update and then run `npm run build-data`. If there are no changes, then `plugins.json` will be the same.
|
||||
|
||||
## Tests
|
||||
|
||||
### Running tests locally
|
||||
|
||||
```bash
|
||||
npm test
|
||||
```
|
||||
|
||||
### Checking code coverage locally
|
||||
|
||||
```bash
|
||||
npm run coverage
|
||||
```
|
||||
|
||||
### Writing tests
|
||||
|
||||
#### General
|
||||
|
||||
All the tests for `babel-preset-env` exist in the `test/fixtures` folder. The
|
||||
test setup and conventions are exactly the same as testing a Babel plugin, so
|
||||
please read our [documentation on writing tests](https://github.com/babel/babel/blob/master/CONTRIBUTING.md#babel-plugin-x).
|
||||
|
||||
#### Testing the `debug` option
|
||||
|
||||
Testing debug output to `stdout` is similar. Under the `test/debug-fixtures`,
|
||||
create a folder with a descriptive name of your test, and add the following:
|
||||
|
||||
* Add a `options.json` file (just as the other tests, this is essentially a
|
||||
`.babelrc`) with the desired test configuration (required)
|
||||
* Add a `stdout.txt` file with the expected debug output. For added
|
||||
convenience, if there is no `stdout.txt` present, the test runner will
|
||||
generate one for you.
|
||||
572
experimental/babel-preset-env/README.md
Normal file
572
experimental/babel-preset-env/README.md
Normal file
@@ -0,0 +1,572 @@
|
||||
# babel-preset-env [](https://www.npmjs.com/package/babel-preset-env) [](https://travis-ci.org/babel/babel-preset-env) [](https://www.npmjs.com/package/babel-preset-env) [](https://codecov.io/github/babel/babel-preset-env)
|
||||
|
||||
> A Babel preset that compiles [ES2015+](https://github.com/tc39/proposals/blob/master/finished-proposals.md) down to ES5 by automatically determining the Babel plugins and polyfills you need based on your targeted browser or runtime environments.
|
||||
|
||||
```sh
|
||||
npm install babel-preset-env --save-dev
|
||||
```
|
||||
|
||||
Without any configuration options, babel-preset-env behaves exactly the same as babel-preset-latest (or babel-preset-es2015, babel-preset-es2016, and babel-preset-es2017 together).
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": ["env"]
|
||||
}
|
||||
```
|
||||
|
||||
You can also configure it to only include the polyfills and transforms needed for the browsers you support. Compiling only what's needed can make your bundles smaller and your life easier.
|
||||
|
||||
This example only includes the polyfills and code transforms needed for the last two versions of each browser, and versions of Safari greater than or equal to 7. We use [browserslist](https://github.com/ai/browserslist) to parse this information, so you can use [any valid query format supported by browserslist](https://github.com/ai/browserslist#queries).
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"browsers": ["last 2 versions", "safari >= 7"]
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Similarly, if you're targeting Node.js instead of the browser, you can configure babel-preset-env to only include the polyfills and transforms necessary for a particular version:
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"node": "6.10"
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
For convenience, you can use `"node": "current"` to only include the necessary polyfills and transforms for the Node.js version that you use to run Babel:
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"node": "current"
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
- [How it Works](#how-it-works)
|
||||
- [Install](#install)
|
||||
- [Usage](#usage)
|
||||
- [Options](#options)
|
||||
- [Examples](#examples)
|
||||
- [Issues](#issues)
|
||||
|
||||
## How it Works
|
||||
|
||||
### Determine environment support for ECMAScript features
|
||||
|
||||
Use external data such as [`compat-table`](https://github.com/kangax/compat-table) to determine browser support. (We should create PRs there when necessary)
|
||||
|
||||

|
||||
|
||||
We can periodically run [build-data.js](https://github.com/babel/babel-preset-env/blob/master/scripts/build-data.js) which generates [plugins.json](https://github.com/babel/babel-preset-env/blob/master/data/plugins.json).
|
||||
|
||||
Ref: [#7](https://github.com/babel/babel-preset-env/issues/7)
|
||||
|
||||
### Maintain a mapping between JavaScript features and Babel plugins
|
||||
|
||||
> Currently located at [plugin-features.js](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js).
|
||||
|
||||
This should be straightforward to do in most cases. There might be cases where plugins should be split up more or certain plugins aren't standalone enough (or impossible to do).
|
||||
|
||||
### Support all plugins in Babel that are considered `latest`
|
||||
|
||||
> Default behavior without options is the same as `babel-preset-latest`.
|
||||
|
||||
It won't include `stage-x` plugins. env will support all plugins in what we consider the latest version of JavaScript (by matching what we do in [`babel-preset-latest`](http://babeljs.io/docs/plugins/preset-latest/)).
|
||||
|
||||
Ref: [#14](https://github.com/babel/babel-preset-env/issues/14)
|
||||
|
||||
### Determine the lowest common denominator of plugins to be included in the preset
|
||||
|
||||
If you are targeting IE 8 and Chrome 55 it will include all plugins required by IE 8 since you would need to support both still.
|
||||
|
||||
### Support a target option `"node": "current"` to compile for the currently running node version.
|
||||
|
||||
For example, if you are building on Node 6, arrow functions won't be converted, but they will if you build on Node 0.12.
|
||||
|
||||
### Support a `browsers` option like autoprefixer.
|
||||
|
||||
Use [browserslist](https://github.com/ai/browserslist) to declare supported environments by performing queries like `> 1%, last 2 versions`.
|
||||
|
||||
Ref: [#19](https://github.com/babel/babel-preset-env/pull/19)
|
||||
|
||||
### Browserslist support.
|
||||
|
||||
[Browserslist](https://github.com/ai/browserslist) is a library used to share a supported list of browsers between different front-end tools like [autoprefixer](https://github.com/postcss/autoprefixer), [stylelint](https://stylelint.io/), [eslint-plugin-compat](https://github.com/amilajack/eslint-plugin-compat) and many others.
|
||||
|
||||
By default, babel-preset-env will use [browserslist config sources](https://github.com/ai/browserslist#queries).
|
||||
|
||||
For example, to enable only the polyfills and plugins needed for a project targeting *last 2 versions* and *IE10*:
|
||||
|
||||
**.babelrc**
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"useBuiltIns": true
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**browserslist**
|
||||
```
|
||||
Last 2 versions
|
||||
IE 10
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
**package.json**
|
||||
```
|
||||
"browserslist": "last 2 versions, ie 10"
|
||||
```
|
||||
|
||||
Browserslist config will be ignored if: 1) `targets.browsers` was specified 2) or with `ignoreBrowserslistConfig: true` option ([see more](#ignoreBrowserslistConfig)):
|
||||
|
||||
#### Targets merging.
|
||||
|
||||
1. If [targets.browsers](#targetsbrowsers) is defined - the browserslist config will be ignored. The browsers specified in `targets` will be merged with [any other explicitly defined targets](#targets). If merged, targets defined explicitly will override the same targets received from `targets.browsers`.
|
||||
|
||||
2. If [targets.browsers](#targetsbrowsers) is _not_ defined - the program will search browserslist file or `package.json` with `browserslist` field. The search will start from the working directory of the process or from the path specified by the `configPath` option, and go up to the system root. If both a browserslist file and configuration inside a `package.json` are found, an exception will be thrown.
|
||||
|
||||
3. If a browserslist config was found and other targets are defined (but not [targets.browsers](#targetsbrowsers)), the targets will be merged in the same way as `targets` defined explicitly with `targets.browsers`.
|
||||
|
||||
## Install
|
||||
|
||||
With [npm](https://www.npmjs.com):
|
||||
|
||||
```sh
|
||||
npm install --save-dev babel-preset-env
|
||||
```
|
||||
|
||||
Or [yarn](https://yarnpkg.com):
|
||||
|
||||
```sh
|
||||
yarn add babel-preset-env --dev
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
The default behavior without options runs all transforms (behaves the same as [babel-preset-latest](https://babeljs.io/docs/plugins/preset-latest/)).
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": ["env"]
|
||||
}
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
For more information on setting options for a preset, refer to the [plugin/preset options](http://babeljs.io/docs/plugins/#plugin-preset-options) documentation.
|
||||
|
||||
### `targets`
|
||||
|
||||
`{ [string]: number | string }`, defaults to `{}`.
|
||||
|
||||
Takes an object of environment versions to support.
|
||||
|
||||
Each target environment takes a number or a string (we recommend using a string when specifying minor versions like `node: "6.10"`).
|
||||
|
||||
Example environments: `chrome`, `opera`, `edge`, `firefox`, `safari`, `ie`, `ios`, `android`, `node`, `electron`.
|
||||
|
||||
The [data](https://github.com/babel/babel-preset-env/blob/master/data/plugins.json) for this is generated by running the [build-data script](https://github.com/babel/babel-preset-env/blob/master/scripts/build-data.js) which pulls in data from [compat-table](https://kangax.github.io/compat-table).
|
||||
|
||||
### `targets.node`
|
||||
|
||||
`number | string | "current" | true`
|
||||
|
||||
If you want to compile against the current node version, you can specify `"node": true` or `"node": "current"`, which would be the same as `"node": process.versions.node`.
|
||||
|
||||
### `targets.browsers`
|
||||
|
||||
`Array<string> | string`
|
||||
|
||||
A query to select browsers (ex: last 2 versions, > 5%) using [browserslist](https://github.com/ai/browserslist).
|
||||
|
||||
Note, browsers' results are overridden by explicit items from `targets`.
|
||||
|
||||
### `spec`
|
||||
|
||||
`boolean`, defaults to `false`.
|
||||
|
||||
Enable more spec compliant, but potentially slower, transformations for any plugins in this preset that support them.
|
||||
|
||||
### `loose`
|
||||
|
||||
`boolean`, defaults to `false`.
|
||||
|
||||
Enable "loose" transformations for any plugins in this preset that allow them.
|
||||
|
||||
### `modules`
|
||||
|
||||
`"amd" | "umd" | "systemjs" | "commonjs" | false`, defaults to `"commonjs"`.
|
||||
|
||||
Enable transformation of ES6 module syntax to another module type.
|
||||
|
||||
Setting this to `false` will not transform modules.
|
||||
|
||||
### `debug`
|
||||
|
||||
`boolean`, defaults to `false`.
|
||||
|
||||
Outputs the targets/plugins used and the version specified in [plugin data version](https://github.com/babel/babel-preset-env/blob/master/data/plugins.json) to `console.log`.
|
||||
|
||||
### `include`
|
||||
|
||||
`Array<string>`, defaults to `[]`.
|
||||
|
||||
An array of plugins to always include.
|
||||
|
||||
Valid options include any:
|
||||
|
||||
- [Babel plugins](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js) - both with (`babel-plugin-transform-es2015-spread`) and without prefix (`transform-es2015-spread`) are supported.
|
||||
|
||||
- [Built-ins](https://github.com/babel/babel-preset-env/blob/master/data/built-in-features.js), such as `map`, `set`, or `object.assign`.
|
||||
|
||||
This option is useful if there is a bug in a native implementation, or a combination of a non-supported feature + a supported one doesn't work.
|
||||
|
||||
For example, Node 4 supports native classes but not spread. If `super` is used with a spread argument, then the `transform-es2015-classes` transform needs to be `include`d, as it is not possible to transpile a spread with `super` otherwise.
|
||||
|
||||
> NOTE: The `include` and `exclude` options _only_ work with the [plugins included with this preset](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js); so, for example, including `transform-do-expressions` or excluding `transform-function-bind` will throw errors. To use a plugin _not_ included with this preset, add them to your [config](https://babeljs.io/docs/usage/babelrc/) directly.
|
||||
|
||||
### `exclude`
|
||||
|
||||
`Array<string>`, defaults to `[]`.
|
||||
|
||||
An array of plugins to always exclude/remove.
|
||||
|
||||
The possible options are the same as the `include` option.
|
||||
|
||||
This option is useful for "blacklisting" a transform like `transform-regenerator` if you don't use generators and don't want to include `regeneratorRuntime` (when using `useBuiltIns`) or for using another plugin like [fast-async](https://github.com/MatAtBread/fast-async) instead of [Babel's async-to-gen](http://babeljs.io/docs/plugins/transform-async-generator-functions/).
|
||||
|
||||
### `useBuiltIns`
|
||||
|
||||
`"usage"` | `"entry"` | `false`, defaults to `false`.
|
||||
|
||||
A way to apply `babel-preset-env` for polyfills (via `babel-polyfill`).
|
||||
|
||||
```sh
|
||||
npm install babel-polyfill --save
|
||||
```
|
||||
|
||||
#### `useBuiltIns: 'usage'`
|
||||
|
||||
Adds specific imports for polyfills when they are used in each file. We take advantage of the fact that a bundler will load the same polyfill only once.
|
||||
|
||||
**In**
|
||||
|
||||
a.js
|
||||
|
||||
```js
|
||||
var a = new Promise();
|
||||
```
|
||||
|
||||
b.js
|
||||
|
||||
```js
|
||||
var b = new Map();
|
||||
```
|
||||
|
||||
**Out (if environment doesn't support it)**
|
||||
|
||||
```js
|
||||
import "babel-polyfill/core-js/modules/es6.promise";
|
||||
var a = new Promise();
|
||||
```
|
||||
|
||||
```js
|
||||
import "babel-polyfill/core-js/modules/es6.map";
|
||||
var b = new Map();
|
||||
```
|
||||
|
||||
**Out (if environment supports it)**
|
||||
|
||||
```js
|
||||
var a = new Promise();
|
||||
```
|
||||
|
||||
```js
|
||||
var b = new Map();
|
||||
```
|
||||
|
||||
#### `useBuiltIns: 'entry'`
|
||||
|
||||
> NOTE: Only use `require("babel-polyfill");` once in your whole app.
|
||||
> Multiple imports or requires of `babel-polyfill` will throw an error since it can cause global collisions and other issues that are hard to trace.
|
||||
> We recommend creating a single entry file that only contains the `require` statement.
|
||||
|
||||
This option enables a new plugin that replaces the statement `import "babel-polyfill"` or `require("babel-polyfill")` with individual requires for `babel-polyfill` based on environment.
|
||||
|
||||
**In**
|
||||
|
||||
```js
|
||||
import "babel-polyfill";
|
||||
```
|
||||
|
||||
**Out (different based on environment)**
|
||||
|
||||
```js
|
||||
import "babel-polyfill/core-js/modules/es7.string.pad-start";
|
||||
import "babel-polyfill/core-js/modules/es7.string.pad-end";
|
||||
```
|
||||
|
||||
#### `useBuiltIns: false`
|
||||
|
||||
Don't add polyfills automatically per file, or transform `import "babel-polyfill"` to individual polyfills.
|
||||
|
||||
### `forceAllTransforms`
|
||||
|
||||
`boolean`, defaults to `false`.
|
||||
|
||||
<p><details>
|
||||
<summary><b>Example</b></summary>
|
||||
|
||||
With Babel 7's .babelrc.js support, you can force all transforms to be run if env is set to `production`.
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
presets: [
|
||||
["env", {
|
||||
targets: {
|
||||
chrome: 59,
|
||||
edge: 13,
|
||||
firefox: 50,
|
||||
},
|
||||
// for uglifyjs...
|
||||
forceAllTransforms: process.env === "production"
|
||||
}],
|
||||
],
|
||||
};
|
||||
```
|
||||
</details></p>
|
||||
|
||||
|
||||
> NOTE: `targets.uglify` is deprecated and will be removed in the next major in
|
||||
favor of this.
|
||||
|
||||
By default, this preset will run all the transforms needed for the targeted
|
||||
environment(s). Enable this option if you want to force running _all_
|
||||
transforms, which is useful if the output will be run through UglifyJS or an
|
||||
environment that only supports ES5.
|
||||
|
||||
> NOTE: Uglify has a work-in-progress "Harmony" branch to address the lack of
|
||||
ES6 support, but it is not yet stable. You can follow its progress in
|
||||
[UglifyJS2 issue #448](https://github.com/mishoo/UglifyJS2/issues/448). If you
|
||||
require an alternative minifier which _does_ support ES6 syntax, we recommend
|
||||
using [babel-minify](https://github.com/babel/minify).
|
||||
|
||||
### `configPath`
|
||||
|
||||
`string`, defaults to `process.cwd()`
|
||||
|
||||
The starting point where the config search for browserslist will start, and ascend to the system root until found.
|
||||
|
||||
### `ignoreBrowserslistConfig`
|
||||
|
||||
`boolean`, defaults to `false`
|
||||
|
||||
Toggles whether or not [browserslist config sources](https://github.com/ai/browserslist#queries) are used, which includes searching for any browserslist files or referencing the browserslist key inside package.json. This is useful for projects that use a browserslist config for files that won't be compiled with Babel.
|
||||
|
||||
### `shippedProposals`
|
||||
|
||||
`boolean`, defaults to `false`
|
||||
|
||||
Toggles enabling support for builtin/feature proposals that have shipped in browsers. If your target environments have native support for a feature proposal, its matching parser syntax plugin is enabled instead of performing any transform. Note that this _does not_ enable the same transformations as [`babel-preset-stage3`](https://babeljs.io/docs/plugins/preset-stage-3/), since proposals can continue to change before landing in browsers.
|
||||
|
||||
The following are currently supported:
|
||||
|
||||
**Builtins**
|
||||
|
||||
- [Promise.prototype.finally](https://github.com/tc39/proposal-promise-finally)
|
||||
|
||||
**Features**
|
||||
|
||||
- [Asynchronous Iterators](https://github.com/tc39/proposal-async-iteration)
|
||||
- [Object rest/spread properties](https://github.com/tc39/proposal-object-rest-spread)
|
||||
- [Optional catch binding](https://github.com/tc39/proposal-optional-catch-binding)
|
||||
- [Unicode property escapes in regular expressions](https://github.com/tc39/proposal-regexp-unicode-property-escapes)
|
||||
|
||||
---
|
||||
|
||||
## Examples
|
||||
|
||||
### Export with various targets
|
||||
|
||||
```js
|
||||
export class A {}
|
||||
```
|
||||
|
||||
#### Target only Chrome 52
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"chrome": 52
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```js
|
||||
class A {}
|
||||
exports.A = A;
|
||||
```
|
||||
|
||||
#### Target Chrome 52 with webpack 2/rollup and loose mode
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"chrome": 52
|
||||
},
|
||||
"modules": false,
|
||||
"loose": true
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```js
|
||||
export class A {}
|
||||
```
|
||||
|
||||
#### Target specific browsers via browserslist
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"chrome": 52,
|
||||
"browsers": ["last 2 versions", "safari 7"]
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```js
|
||||
export var A = function A() {
|
||||
_classCallCheck(this, A);
|
||||
};
|
||||
```
|
||||
|
||||
#### Target latest node via `node: true` or `node: "current"`
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"node": "current"
|
||||
}
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```js
|
||||
class A {}
|
||||
exports.A = A;
|
||||
```
|
||||
|
||||
### Show debug output
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
[ "env", {
|
||||
"targets": {
|
||||
"safari": 10
|
||||
},
|
||||
"modules": false,
|
||||
"useBuiltIns": true,
|
||||
"debug": true
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
**stdout**
|
||||
|
||||
```sh
|
||||
Using targets:
|
||||
{
|
||||
"safari": 10
|
||||
}
|
||||
|
||||
Modules transform: false
|
||||
|
||||
Using plugins:
|
||||
transform-exponentiation-operator {}
|
||||
transform-async-to-generator {}
|
||||
|
||||
Using polyfills:
|
||||
es7.object.values {}
|
||||
es7.object.entries {}
|
||||
es7.object.get-own-property-descriptors {}
|
||||
web.timers {}
|
||||
web.immediate {}
|
||||
web.dom.iterable {}
|
||||
```
|
||||
|
||||
### Include and exclude specific plugins/built-ins
|
||||
|
||||
> always include arrow functions, explicitly exclude generators
|
||||
|
||||
```json
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
"targets": {
|
||||
"browsers": ["last 2 versions", "safari >= 7"]
|
||||
},
|
||||
"include": ["transform-es2015-arrow-functions", "es6.map"],
|
||||
"exclude": ["transform-regenerator", "es6.set"]
|
||||
}]
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Issues
|
||||
|
||||
If you get a `SyntaxError: Unexpected token ...` error when using the [object-rest-spread](https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-object-rest-spread) transform then make sure the plugin has been updated to, at least, `v6.19.0`.
|
||||
194
experimental/babel-preset-env/data/built-in-features.js
Normal file
194
experimental/babel-preset-env/data/built-in-features.js
Normal file
@@ -0,0 +1,194 @@
|
||||
const typedArrayMethods = [
|
||||
"typed arrays / %TypedArray%.from",
|
||||
"typed arrays / %TypedArray%.of",
|
||||
"typed arrays / %TypedArray%.prototype.subarray",
|
||||
"typed arrays / %TypedArray%.prototype.join",
|
||||
"typed arrays / %TypedArray%.prototype.indexOf",
|
||||
"typed arrays / %TypedArray%.prototype.lastIndexOf",
|
||||
"typed arrays / %TypedArray%.prototype.slice",
|
||||
"typed arrays / %TypedArray%.prototype.every",
|
||||
"typed arrays / %TypedArray%.prototype.filter",
|
||||
"typed arrays / %TypedArray%.prototype.forEach",
|
||||
"typed arrays / %TypedArray%.prototype.map",
|
||||
"typed arrays / %TypedArray%.prototype.reduce",
|
||||
"typed arrays / %TypedArray%.prototype.reduceRight",
|
||||
"typed arrays / %TypedArray%.prototype.reverse",
|
||||
"typed arrays / %TypedArray%.prototype.some",
|
||||
"typed arrays / %TypedArray%.prototype.sort",
|
||||
"typed arrays / %TypedArray%.prototype.copyWithin",
|
||||
"typed arrays / %TypedArray%.prototype.find",
|
||||
"typed arrays / %TypedArray%.prototype.findIndex",
|
||||
"typed arrays / %TypedArray%.prototype.fill",
|
||||
"typed arrays / %TypedArray%.prototype.keys",
|
||||
"typed arrays / %TypedArray%.prototype.values",
|
||||
"typed arrays / %TypedArray%.prototype.entries",
|
||||
"typed arrays / %TypedArray%.prototype[Symbol.iterator]",
|
||||
"typed arrays / %TypedArray%[Symbol.species]",
|
||||
];
|
||||
|
||||
const es2015 = {
|
||||
"es6.typed.array-buffer": "typed arrays / ArrayBuffer[Symbol.species]",
|
||||
"es6.typed.data-view": "typed arrays / DataView",
|
||||
"es6.typed.int8-array": {
|
||||
features: ["typed arrays / Int8Array"].concat(typedArrayMethods)
|
||||
},
|
||||
"es6.typed.uint8-array": {
|
||||
features: ["typed arrays / Uint8Array"].concat(typedArrayMethods)
|
||||
},
|
||||
"es6.typed.uint8-clamped-array": {
|
||||
features: ["typed arrays / Uint8ClampedArray"].concat(typedArrayMethods)
|
||||
},
|
||||
"es6.typed.int16-array": {
|
||||
features: ["typed arrays / Int16Array"].concat(typedArrayMethods)
|
||||
},
|
||||
"es6.typed.uint16-array": {
|
||||
features: ["typed arrays / Uint16Array"].concat(typedArrayMethods)
|
||||
},
|
||||
"es6.typed.int32-array": {
|
||||
features: ["typed arrays / Int32Array"].concat(typedArrayMethods)
|
||||
},
|
||||
"es6.typed.uint32-array": {
|
||||
features: ["typed arrays / Uint32Array"].concat(typedArrayMethods)
|
||||
},
|
||||
"es6.typed.float32-array": {
|
||||
features: ["typed arrays / Float32Array"].concat(typedArrayMethods)
|
||||
},
|
||||
"es6.typed.float64-array": {
|
||||
features: ["typed arrays / Float64Array"].concat(typedArrayMethods)
|
||||
},
|
||||
|
||||
"es6.map": "Map",
|
||||
"es6.set": "Set",
|
||||
"es6.weak-map": "WeakMap",
|
||||
"es6.weak-set": "WeakSet",
|
||||
|
||||
// Proxy not implementable
|
||||
|
||||
"es6.reflect.apply": "Reflect / Reflect.apply",
|
||||
"es6.reflect.construct": "Reflect / Reflect.construct",
|
||||
"es6.reflect.define-property": "Reflect / Reflect.defineProperty",
|
||||
"es6.reflect.delete-property": "Reflect / Reflect.deleteProperty",
|
||||
"es6.reflect.get": "Reflect / Reflect.get",
|
||||
"es6.reflect.get-own-property-descriptor": "Reflect / Reflect.getOwnPropertyDescriptor",
|
||||
"es6.reflect.get-prototype-of": "Reflect / Reflect.getPrototypeOf",
|
||||
"es6.reflect.has": "Reflect / Reflect.has",
|
||||
"es6.reflect.is-extensible": "Reflect / Reflect.isExtensible",
|
||||
"es6.reflect.own-keys": "Reflect / Reflect.ownKeys",
|
||||
"es6.reflect.prevent-extensions": "Reflect / Reflect.preventExtensions",
|
||||
"es6.reflect.set": "Reflect / Reflect.set",
|
||||
"es6.reflect.set-prototype-of": "Reflect / Reflect.setPrototypeOf",
|
||||
|
||||
"es6.promise": {
|
||||
features: [
|
||||
"Promise / basic functionality",
|
||||
"Promise / constructor requires new",
|
||||
"Promise / Promise.prototype isn\'t an instance",
|
||||
"Promise / Promise.all",
|
||||
"Promise / Promise.all, generic iterables",
|
||||
"Promise / Promise.race",
|
||||
"Promise / Promise.race, generic iterables",
|
||||
"Promise / Promise[Symbol.species]"
|
||||
]
|
||||
},
|
||||
|
||||
"es6.symbol": {
|
||||
features: [
|
||||
"Symbol",
|
||||
"Object static methods / Object.getOwnPropertySymbols",
|
||||
"well-known symbols / Symbol.hasInstance",
|
||||
"well-known symbols / Symbol.isConcatSpreadable",
|
||||
"well-known symbols / Symbol.iterator",
|
||||
"well-known symbols / Symbol.match",
|
||||
"well-known symbols / Symbol.replace",
|
||||
"well-known symbols / Symbol.search",
|
||||
"well-known symbols / Symbol.species",
|
||||
"well-known symbols / Symbol.split",
|
||||
"well-known symbols / Symbol.toPrimitive",
|
||||
"well-known symbols / Symbol.toStringTag",
|
||||
"well-known symbols / Symbol.unscopables",
|
||||
]
|
||||
},
|
||||
|
||||
"es6.object.assign": "Object static methods / Object.assign",
|
||||
"es6.object.is": "Object static methods / Object.is",
|
||||
"es6.object.set-prototype-of": "Object static methods / Object.setPrototypeOf",
|
||||
|
||||
"es6.function.name": "function \"name\" property",
|
||||
|
||||
"es6.string.raw": "String static methods / String.raw",
|
||||
"es6.string.from-code-point": "String static methods / String.fromCodePoint",
|
||||
|
||||
"es6.string.code-point-at": "String.prototype methods / String.prototype.codePointAt",
|
||||
// "String.prototype methods / String.prototype.normalize" not implemented
|
||||
"es6.string.repeat": "String.prototype methods / String.prototype.repeat",
|
||||
"es6.string.starts-with": "String.prototype methods / String.prototype.startsWith",
|
||||
"es6.string.ends-with": "String.prototype methods / String.prototype.endsWith",
|
||||
"es6.string.includes": "String.prototype methods / String.prototype.includes",
|
||||
|
||||
"es6.regexp.flags": "RegExp.prototype properties / RegExp.prototype.flags",
|
||||
"es6.regexp.match": "RegExp.prototype properties / RegExp.prototype[Symbol.match]",
|
||||
"es6.regexp.replace": "RegExp.prototype properties / RegExp.prototype[Symbol.replace]",
|
||||
"es6.regexp.split": "RegExp.prototype properties / RegExp.prototype[Symbol.split]",
|
||||
"es6.regexp.search": "RegExp.prototype properties / RegExp.prototype[Symbol.search]",
|
||||
|
||||
"es6.array.from": "Array static methods / Array.from",
|
||||
"es6.array.of": "Array static methods / Array.of",
|
||||
|
||||
"es6.array.copy-within": "Array.prototype methods / Array.prototype.copyWithin",
|
||||
"es6.array.find": "Array.prototype methods / Array.prototype.find",
|
||||
"es6.array.find-index": "Array.prototype methods / Array.prototype.findIndex",
|
||||
"es6.array.fill": "Array.prototype methods / Array.prototype.fill",
|
||||
|
||||
"es6.array.iterator": {
|
||||
features: [
|
||||
"Array.prototype methods / Array.prototype.keys",
|
||||
// can use Symbol.iterator, not implemented in many environments
|
||||
// "Array.prototype methods / Array.prototype.values",
|
||||
"Array.prototype methods / Array.prototype.entries",
|
||||
]
|
||||
},
|
||||
|
||||
"es6.number.is-finite": "Number properties / Number.isFinite",
|
||||
"es6.number.is-integer": "Number properties / Number.isInteger",
|
||||
"es6.number.is-safe-integer": "Number properties / Number.isSafeInteger",
|
||||
"es6.number.is-nan": "Number properties / Number.isNaN",
|
||||
"es6.number.epsilon": "Number properties / Number.EPSILON",
|
||||
"es6.number.min-safe-integer": "Number properties / Number.MIN_SAFE_INTEGER",
|
||||
"es6.number.max-safe-integer": "Number properties / Number.MAX_SAFE_INTEGER",
|
||||
"es6.number.parse-float": "Number properties / Number.parseFloat",
|
||||
"es6.number.parse-int": "Number properties / Number.parseInt",
|
||||
|
||||
"es6.math.acosh": "Math methods / Math.acosh",
|
||||
"es6.math.asinh": "Math methods / Math.asinh",
|
||||
"es6.math.atanh": "Math methods / Math.atanh",
|
||||
"es6.math.cbrt": "Math methods / Math.cbrt",
|
||||
"es6.math.clz32": "Math methods / Math.clz32",
|
||||
"es6.math.cosh": "Math methods / Math.cosh",
|
||||
"es6.math.expm1": "Math methods / Math.expm1",
|
||||
"es6.math.fround": "Math methods / Math.fround",
|
||||
"es6.math.hypot": "Math methods / Math.hypot",
|
||||
"es6.math.imul": "Math methods / Math.imul",
|
||||
"es6.math.log1p": "Math methods / Math.log1p",
|
||||
"es6.math.log10": "Math methods / Math.log10",
|
||||
"es6.math.log2": "Math methods / Math.log2",
|
||||
"es6.math.sign": "Math methods / Math.sign",
|
||||
"es6.math.sinh": "Math methods / Math.sinh",
|
||||
"es6.math.tanh": "Math methods / Math.tanh",
|
||||
"es6.math.trunc": "Math methods / Math.trunc",
|
||||
};
|
||||
|
||||
const es2016 = {
|
||||
"es7.array.includes": "Array.prototype.includes",
|
||||
};
|
||||
|
||||
const es2017 = {
|
||||
"es7.object.values": "Object static methods / Object.values",
|
||||
"es7.object.entries": "Object static methods / Object.entries",
|
||||
"es7.object.get-own-property-descriptors": "Object static methods / Object.getOwnPropertyDescriptors",
|
||||
"es7.string.pad-start": "String padding / String.prototype.padStart",
|
||||
"es7.string.pad-end": "String padding / String.prototype.padEnd",
|
||||
};
|
||||
|
||||
const proposals = require("./shipped-proposals").builtIns;
|
||||
|
||||
module.exports = Object.assign({}, es2015, es2016, es2017, proposals);
|
||||
853
experimental/babel-preset-env/data/built-ins.json
Normal file
853
experimental/babel-preset-env/data/built-ins.json
Normal file
@@ -0,0 +1,853 @@
|
||||
{
|
||||
"es6.typed.array-buffer": {
|
||||
"chrome": "51",
|
||||
"edge": "13",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.typed.data-view": {
|
||||
"chrome": "5",
|
||||
"opera": "12",
|
||||
"edge": "12",
|
||||
"firefox": "15",
|
||||
"safari": "5.1",
|
||||
"node": "0.12",
|
||||
"ie": "10",
|
||||
"android": "4",
|
||||
"ios": "6",
|
||||
"electron": "1.1"
|
||||
},
|
||||
"es6.typed.int8-array": {
|
||||
"chrome": "51",
|
||||
"edge": "13",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.typed.uint8-array": {
|
||||
"chrome": "51",
|
||||
"edge": "13",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.typed.uint8-clamped-array": {
|
||||
"chrome": "51",
|
||||
"edge": "13",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.typed.int16-array": {
|
||||
"chrome": "51",
|
||||
"edge": "13",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.typed.uint16-array": {
|
||||
"chrome": "51",
|
||||
"edge": "13",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.typed.int32-array": {
|
||||
"chrome": "51",
|
||||
"edge": "13",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.typed.uint32-array": {
|
||||
"chrome": "51",
|
||||
"edge": "13",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.typed.float32-array": {
|
||||
"chrome": "51",
|
||||
"edge": "13",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.typed.float64-array": {
|
||||
"chrome": "51",
|
||||
"edge": "13",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.map": {
|
||||
"chrome": "51",
|
||||
"edge": "15",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.set": {
|
||||
"chrome": "51",
|
||||
"edge": "15",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.weak-map": {
|
||||
"chrome": "51",
|
||||
"edge": "15",
|
||||
"firefox": "53",
|
||||
"safari": "9",
|
||||
"node": "6.5",
|
||||
"ios": "9",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.weak-set": {
|
||||
"chrome": "51",
|
||||
"edge": "15",
|
||||
"firefox": "53",
|
||||
"safari": "9",
|
||||
"node": "6.5",
|
||||
"ios": "9",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.reflect.apply": {
|
||||
"chrome": "49",
|
||||
"edge": "12",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.construct": {
|
||||
"chrome": "49",
|
||||
"edge": "13",
|
||||
"firefox": "44",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.define-property": {
|
||||
"chrome": "49",
|
||||
"edge": "13",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.delete-property": {
|
||||
"chrome": "49",
|
||||
"edge": "12",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.get": {
|
||||
"chrome": "49",
|
||||
"edge": "12",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.get-own-property-descriptor": {
|
||||
"chrome": "49",
|
||||
"edge": "12",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.get-prototype-of": {
|
||||
"chrome": "49",
|
||||
"edge": "12",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.has": {
|
||||
"chrome": "49",
|
||||
"edge": "12",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.is-extensible": {
|
||||
"chrome": "49",
|
||||
"edge": "12",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.own-keys": {
|
||||
"chrome": "49",
|
||||
"edge": "12",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.prevent-extensions": {
|
||||
"chrome": "49",
|
||||
"edge": "12",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.set": {
|
||||
"chrome": "49",
|
||||
"edge": "12",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.reflect.set-prototype-of": {
|
||||
"chrome": "49",
|
||||
"edge": "12",
|
||||
"firefox": "42",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.promise": {
|
||||
"chrome": "51",
|
||||
"edge": "13",
|
||||
"firefox": "45",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.symbol": {
|
||||
"chrome": "51",
|
||||
"firefox": "51",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.object.assign": {
|
||||
"chrome": "45",
|
||||
"edge": "12",
|
||||
"firefox": "34",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "32",
|
||||
"electron": "0.35"
|
||||
},
|
||||
"es6.object.is": {
|
||||
"chrome": "19",
|
||||
"edge": "12",
|
||||
"firefox": "22",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"android": "4.1",
|
||||
"ios": "9",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.object.set-prototype-of": {
|
||||
"chrome": "34",
|
||||
"edge": "12",
|
||||
"firefox": "31",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"ie": "11",
|
||||
"ios": "9",
|
||||
"opera": "21",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.function.name": {
|
||||
"chrome": "51",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.string.raw": {
|
||||
"chrome": "41",
|
||||
"edge": "12",
|
||||
"firefox": "34",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "28",
|
||||
"electron": "0.24"
|
||||
},
|
||||
"es6.string.from-code-point": {
|
||||
"chrome": "41",
|
||||
"edge": "12",
|
||||
"firefox": "29",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "28",
|
||||
"electron": "0.24"
|
||||
},
|
||||
"es6.string.code-point-at": {
|
||||
"chrome": "41",
|
||||
"edge": "12",
|
||||
"firefox": "29",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "28",
|
||||
"electron": "0.24"
|
||||
},
|
||||
"es6.string.repeat": {
|
||||
"chrome": "41",
|
||||
"edge": "12",
|
||||
"firefox": "24",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "28",
|
||||
"electron": "0.24"
|
||||
},
|
||||
"es6.string.starts-with": {
|
||||
"chrome": "41",
|
||||
"edge": "12",
|
||||
"firefox": "29",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "28",
|
||||
"electron": "0.24"
|
||||
},
|
||||
"es6.string.ends-with": {
|
||||
"chrome": "41",
|
||||
"edge": "12",
|
||||
"firefox": "29",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "28",
|
||||
"electron": "0.24"
|
||||
},
|
||||
"es6.string.includes": {
|
||||
"chrome": "41",
|
||||
"edge": "12",
|
||||
"firefox": "40",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "28",
|
||||
"electron": "0.24"
|
||||
},
|
||||
"es6.regexp.flags": {
|
||||
"chrome": "49",
|
||||
"firefox": "37",
|
||||
"safari": "9",
|
||||
"node": "6",
|
||||
"ios": "9",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"es6.regexp.match": {
|
||||
"chrome": "50",
|
||||
"firefox": "49",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "37",
|
||||
"electron": "1.1"
|
||||
},
|
||||
"es6.regexp.replace": {
|
||||
"chrome": "50",
|
||||
"firefox": "49",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "37",
|
||||
"electron": "1.1"
|
||||
},
|
||||
"es6.regexp.split": {
|
||||
"chrome": "50",
|
||||
"firefox": "49",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "37",
|
||||
"electron": "1.1"
|
||||
},
|
||||
"es6.regexp.search": {
|
||||
"chrome": "50",
|
||||
"firefox": "49",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "37",
|
||||
"electron": "1.1"
|
||||
},
|
||||
"es6.array.from": {
|
||||
"chrome": "51",
|
||||
"edge": "15",
|
||||
"firefox": "36",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"es6.array.of": {
|
||||
"chrome": "45",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "32",
|
||||
"electron": "0.35"
|
||||
},
|
||||
"es6.array.copy-within": {
|
||||
"chrome": "45",
|
||||
"edge": "12",
|
||||
"firefox": "32",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "32",
|
||||
"electron": "0.35"
|
||||
},
|
||||
"es6.array.find": {
|
||||
"chrome": "45",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "4",
|
||||
"ios": "8",
|
||||
"opera": "32",
|
||||
"electron": "0.35"
|
||||
},
|
||||
"es6.array.find-index": {
|
||||
"chrome": "45",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "4",
|
||||
"ios": "8",
|
||||
"opera": "32",
|
||||
"electron": "0.35"
|
||||
},
|
||||
"es6.array.fill": {
|
||||
"chrome": "45",
|
||||
"edge": "12",
|
||||
"firefox": "31",
|
||||
"safari": "7.1",
|
||||
"node": "4",
|
||||
"ios": "8",
|
||||
"opera": "32",
|
||||
"electron": "0.35"
|
||||
},
|
||||
"es6.array.iterator": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "28",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.number.is-finite": {
|
||||
"chrome": "19",
|
||||
"edge": "12",
|
||||
"firefox": "16",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"android": "4.1",
|
||||
"ios": "9",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.number.is-integer": {
|
||||
"chrome": "34",
|
||||
"edge": "12",
|
||||
"firefox": "16",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"ios": "9",
|
||||
"opera": "21",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.number.is-safe-integer": {
|
||||
"chrome": "34",
|
||||
"edge": "12",
|
||||
"firefox": "32",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"ios": "9",
|
||||
"opera": "21",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.number.is-nan": {
|
||||
"chrome": "19",
|
||||
"edge": "12",
|
||||
"firefox": "15",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"android": "4.1",
|
||||
"ios": "9",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.number.epsilon": {
|
||||
"chrome": "34",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"ios": "9",
|
||||
"opera": "21",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.number.min-safe-integer": {
|
||||
"chrome": "34",
|
||||
"edge": "12",
|
||||
"firefox": "31",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"ios": "9",
|
||||
"opera": "21",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.number.max-safe-integer": {
|
||||
"chrome": "34",
|
||||
"edge": "12",
|
||||
"firefox": "31",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"ios": "9",
|
||||
"opera": "21",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.number.parse-float": {
|
||||
"chrome": "34",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"ios": "9",
|
||||
"opera": "21",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.number.parse-int": {
|
||||
"chrome": "34",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"ios": "9",
|
||||
"opera": "21",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.acosh": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.asinh": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.atanh": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.cbrt": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.clz32": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "31",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"ios": "9",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.cosh": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.expm1": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.fround": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "26",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.hypot": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "27",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.imul": {
|
||||
"chrome": "30",
|
||||
"edge": "12",
|
||||
"firefox": "23",
|
||||
"safari": "7",
|
||||
"node": "0.12",
|
||||
"android": "4.4",
|
||||
"ios": "7",
|
||||
"opera": "17",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.log1p": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.log10": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.log2": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.sign": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"ios": "9",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.sinh": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.tanh": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es6.math.trunc": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "25",
|
||||
"safari": "7.1",
|
||||
"node": "0.12",
|
||||
"ios": "8",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"es7.array.includes": {
|
||||
"chrome": "47",
|
||||
"edge": "14",
|
||||
"firefox": "43",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "34",
|
||||
"electron": "0.36"
|
||||
},
|
||||
"es7.object.values": {
|
||||
"chrome": "54",
|
||||
"edge": "14",
|
||||
"firefox": "47",
|
||||
"safari": "10.1",
|
||||
"node": "7",
|
||||
"ios": "10.3",
|
||||
"opera": "41",
|
||||
"electron": "1.5"
|
||||
},
|
||||
"es7.object.entries": {
|
||||
"chrome": "54",
|
||||
"edge": "14",
|
||||
"firefox": "47",
|
||||
"safari": "10.1",
|
||||
"node": "7",
|
||||
"ios": "10.3",
|
||||
"opera": "41",
|
||||
"electron": "1.5"
|
||||
},
|
||||
"es7.object.get-own-property-descriptors": {
|
||||
"chrome": "54",
|
||||
"edge": "15",
|
||||
"firefox": "50",
|
||||
"safari": "10.1",
|
||||
"node": "7",
|
||||
"ios": "10.3",
|
||||
"opera": "41",
|
||||
"electron": "1.5"
|
||||
},
|
||||
"es7.string.pad-start": {
|
||||
"chrome": "57",
|
||||
"edge": "15",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "8",
|
||||
"ios": "10",
|
||||
"opera": "44",
|
||||
"electron": "1.7"
|
||||
},
|
||||
"es7.string.pad-end": {
|
||||
"chrome": "57",
|
||||
"edge": "15",
|
||||
"firefox": "48",
|
||||
"safari": "10",
|
||||
"node": "8",
|
||||
"ios": "10",
|
||||
"opera": "44",
|
||||
"electron": "1.7"
|
||||
},
|
||||
"es7.promise.finally": {
|
||||
"chrome": "63",
|
||||
"opera": "50"
|
||||
}
|
||||
}
|
||||
140
experimental/babel-preset-env/data/plugin-features.js
Normal file
140
experimental/babel-preset-env/data/plugin-features.js
Normal file
@@ -0,0 +1,140 @@
|
||||
const es2015 = {
|
||||
"check-es2015-constants": {
|
||||
features: [
|
||||
"const",
|
||||
],
|
||||
},
|
||||
"transform-es2015-arrow-functions": {
|
||||
features: [
|
||||
"arrow functions",
|
||||
],
|
||||
},
|
||||
"transform-es2015-block-scoped-functions": {
|
||||
features: [
|
||||
"block-level function declaration"
|
||||
],
|
||||
},
|
||||
"transform-es2015-block-scoping": {
|
||||
features: [
|
||||
"const",
|
||||
"let",
|
||||
],
|
||||
},
|
||||
"transform-es2015-classes": {
|
||||
features: [
|
||||
"class",
|
||||
"super",
|
||||
],
|
||||
},
|
||||
"transform-es2015-computed-properties": {
|
||||
features: [
|
||||
"object literal extensions / computed properties",
|
||||
],
|
||||
},
|
||||
"transform-es2015-destructuring": {
|
||||
features: [
|
||||
"destructuring, assignment",
|
||||
"destructuring, declarations",
|
||||
"destructuring, parameters",
|
||||
],
|
||||
},
|
||||
"transform-es2015-duplicate-keys": {
|
||||
features: [
|
||||
"miscellaneous / duplicate property names in strict mode",
|
||||
],
|
||||
},
|
||||
"transform-es2015-for-of": {
|
||||
features: [
|
||||
"for..of loops",
|
||||
],
|
||||
},
|
||||
"transform-es2015-function-name": {
|
||||
features: [
|
||||
"function \"name\" property",
|
||||
]
|
||||
},
|
||||
"transform-es2015-literals": {
|
||||
features: [
|
||||
"Unicode code point escapes",
|
||||
],
|
||||
},
|
||||
"transform-es2015-object-super": {
|
||||
features: [
|
||||
"super",
|
||||
],
|
||||
},
|
||||
"transform-es2015-parameters": {
|
||||
features: [
|
||||
"default function parameters",
|
||||
"rest parameters",
|
||||
],
|
||||
},
|
||||
"transform-es2015-shorthand-properties": {
|
||||
features: [
|
||||
"object literal extensions / shorthand properties",
|
||||
],
|
||||
},
|
||||
"transform-es2015-spread": {
|
||||
features: [
|
||||
"spread (...) operator",
|
||||
],
|
||||
},
|
||||
"transform-es2015-sticky-regex": {
|
||||
features: [
|
||||
"RegExp \"y\" and \"u\" flags / \"y\" flag, lastIndex",
|
||||
"RegExp \"y\" and \"u\" flags / \"y\" flag",
|
||||
],
|
||||
},
|
||||
"transform-es2015-template-literals": {
|
||||
features: [
|
||||
"template literals",
|
||||
],
|
||||
},
|
||||
"transform-es2015-typeof-symbol": {
|
||||
features: [
|
||||
"Symbol / typeof support"
|
||||
],
|
||||
},
|
||||
"transform-es2015-unicode-regex": {
|
||||
features: [
|
||||
"RegExp \"y\" and \"u\" flags / \"u\" flag, case folding",
|
||||
"RegExp \"y\" and \"u\" flags / \"u\" flag, Unicode code point escapes",
|
||||
"RegExp \"y\" and \"u\" flags / \"u\" flag",
|
||||
],
|
||||
},
|
||||
"transform-new-target": {
|
||||
features: [
|
||||
"new.target",
|
||||
],
|
||||
},
|
||||
"transform-regenerator": {
|
||||
features: [
|
||||
"generators",
|
||||
],
|
||||
}
|
||||
};
|
||||
|
||||
const es2016 = {
|
||||
"transform-exponentiation-operator": {
|
||||
features: [
|
||||
"exponentiation (**) operator",
|
||||
],
|
||||
}
|
||||
};
|
||||
|
||||
const es2017 = {
|
||||
"transform-async-to-generator": {
|
||||
features: [
|
||||
"async functions",
|
||||
],
|
||||
},
|
||||
"syntax-trailing-function-commas": {
|
||||
features: [
|
||||
"trailing commas in function syntax",
|
||||
],
|
||||
}
|
||||
};
|
||||
|
||||
const proposals = require("./shipped-proposals").features;
|
||||
|
||||
module.exports = Object.assign({}, es2015, es2016, es2017, proposals);
|
||||
253
experimental/babel-preset-env/data/plugins.json
Normal file
253
experimental/babel-preset-env/data/plugins.json
Normal file
@@ -0,0 +1,253 @@
|
||||
{
|
||||
"check-es2015-constants": {
|
||||
"chrome": "49",
|
||||
"edge": "14",
|
||||
"firefox": "51",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"transform-es2015-arrow-functions": {
|
||||
"chrome": "47",
|
||||
"edge": "13",
|
||||
"firefox": "45",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "34",
|
||||
"electron": "0.36"
|
||||
},
|
||||
"transform-es2015-block-scoped-functions": {
|
||||
"chrome": "41",
|
||||
"edge": "12",
|
||||
"firefox": "46",
|
||||
"safari": "10",
|
||||
"node": "4",
|
||||
"ie": "11",
|
||||
"ios": "10",
|
||||
"opera": "28",
|
||||
"electron": "0.24"
|
||||
},
|
||||
"transform-es2015-block-scoping": {
|
||||
"chrome": "49",
|
||||
"edge": "14",
|
||||
"firefox": "51",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"transform-es2015-classes": {
|
||||
"chrome": "46",
|
||||
"edge": "13",
|
||||
"firefox": "45",
|
||||
"safari": "10",
|
||||
"node": "5",
|
||||
"ios": "10",
|
||||
"opera": "33",
|
||||
"electron": "0.36"
|
||||
},
|
||||
"transform-es2015-computed-properties": {
|
||||
"chrome": "44",
|
||||
"edge": "12",
|
||||
"firefox": "34",
|
||||
"safari": "7.1",
|
||||
"node": "4",
|
||||
"ios": "8",
|
||||
"opera": "31",
|
||||
"electron": "0.31"
|
||||
},
|
||||
"transform-es2015-destructuring": {
|
||||
"chrome": "51",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"transform-es2015-duplicate-keys": {
|
||||
"chrome": "42",
|
||||
"edge": "12",
|
||||
"firefox": "34",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "29",
|
||||
"electron": "0.27"
|
||||
},
|
||||
"transform-es2015-for-of": {
|
||||
"chrome": "51",
|
||||
"edge": "15",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"transform-es2015-function-name": {
|
||||
"chrome": "51",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6.5",
|
||||
"ios": "10",
|
||||
"opera": "38",
|
||||
"electron": "1.2"
|
||||
},
|
||||
"transform-es2015-literals": {
|
||||
"chrome": "44",
|
||||
"edge": "12",
|
||||
"firefox": "53",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "31",
|
||||
"electron": "0.31"
|
||||
},
|
||||
"transform-es2015-object-super": {
|
||||
"chrome": "46",
|
||||
"edge": "13",
|
||||
"firefox": "45",
|
||||
"safari": "10",
|
||||
"node": "5",
|
||||
"ios": "10",
|
||||
"opera": "33",
|
||||
"electron": "0.36"
|
||||
},
|
||||
"transform-es2015-parameters": {
|
||||
"chrome": "49",
|
||||
"edge": "14",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"transform-es2015-shorthand-properties": {
|
||||
"chrome": "43",
|
||||
"edge": "12",
|
||||
"firefox": "33",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "30",
|
||||
"electron": "0.29"
|
||||
},
|
||||
"transform-es2015-spread": {
|
||||
"chrome": "46",
|
||||
"edge": "13",
|
||||
"firefox": "36",
|
||||
"safari": "10",
|
||||
"node": "5",
|
||||
"ios": "10",
|
||||
"opera": "33",
|
||||
"electron": "0.36"
|
||||
},
|
||||
"transform-es2015-sticky-regex": {
|
||||
"chrome": "49",
|
||||
"edge": "13",
|
||||
"firefox": "3",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "36",
|
||||
"electron": "1"
|
||||
},
|
||||
"transform-es2015-template-literals": {
|
||||
"chrome": "41",
|
||||
"edge": "13",
|
||||
"firefox": "34",
|
||||
"safari": "9",
|
||||
"node": "4",
|
||||
"ios": "9",
|
||||
"opera": "28",
|
||||
"electron": "0.24"
|
||||
},
|
||||
"transform-es2015-typeof-symbol": {
|
||||
"chrome": "38",
|
||||
"edge": "12",
|
||||
"firefox": "36",
|
||||
"safari": "9",
|
||||
"node": "0.12",
|
||||
"ios": "9",
|
||||
"opera": "25",
|
||||
"electron": "0.2"
|
||||
},
|
||||
"transform-es2015-unicode-regex": {
|
||||
"chrome": "50",
|
||||
"edge": "13",
|
||||
"firefox": "46",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "37",
|
||||
"electron": "1.1"
|
||||
},
|
||||
"transform-new-target": {
|
||||
"chrome": "46",
|
||||
"edge": "14",
|
||||
"firefox": "41",
|
||||
"safari": "10",
|
||||
"node": "5",
|
||||
"ios": "10",
|
||||
"opera": "33",
|
||||
"electron": "0.36"
|
||||
},
|
||||
"transform-regenerator": {
|
||||
"chrome": "50",
|
||||
"edge": "13",
|
||||
"firefox": "53",
|
||||
"safari": "10",
|
||||
"node": "6",
|
||||
"ios": "10",
|
||||
"opera": "37",
|
||||
"electron": "1.1"
|
||||
},
|
||||
"transform-exponentiation-operator": {
|
||||
"chrome": "52",
|
||||
"edge": "14",
|
||||
"firefox": "52",
|
||||
"safari": "10.1",
|
||||
"node": "7",
|
||||
"ios": "10.3",
|
||||
"opera": "39",
|
||||
"electron": "1.3"
|
||||
},
|
||||
"transform-async-to-generator": {
|
||||
"chrome": "55",
|
||||
"edge": "15",
|
||||
"firefox": "52",
|
||||
"safari": "10.1",
|
||||
"node": "7.6",
|
||||
"ios": "10.3",
|
||||
"opera": "42",
|
||||
"electron": "1.6"
|
||||
},
|
||||
"syntax-trailing-function-commas": {
|
||||
"chrome": "58",
|
||||
"edge": "14",
|
||||
"firefox": "52",
|
||||
"safari": "10",
|
||||
"node": "8",
|
||||
"ios": "10",
|
||||
"opera": "45",
|
||||
"electron": "1.7"
|
||||
},
|
||||
"transform-async-generator-functions": {
|
||||
"chrome": "63",
|
||||
"opera": "50"
|
||||
},
|
||||
"transform-object-rest-spread": {
|
||||
"chrome": "60",
|
||||
"firefox": "55",
|
||||
"node": "8.3",
|
||||
"opera": "47"
|
||||
},
|
||||
"transform-optional-catch-binding": {},
|
||||
"transform-unicode-property-regex": {}
|
||||
}
|
||||
22
experimental/babel-preset-env/data/shipped-proposals.js
Normal file
22
experimental/babel-preset-env/data/shipped-proposals.js
Normal file
@@ -0,0 +1,22 @@
|
||||
// These mappings represent the builtin/feature proposals that have been
|
||||
// shipped by browsers, and are enabled by the `shippedProposals` option.
|
||||
|
||||
const builtIns = {
|
||||
"es7.promise.finally": "Promise.prototype.finally"
|
||||
};
|
||||
|
||||
const features = {
|
||||
"transform-async-generator-functions": "Asynchronous Iterators",
|
||||
"transform-object-rest-spread": "object rest/spread properties",
|
||||
"transform-optional-catch-binding": "optional catch binding",
|
||||
"transform-unicode-property-regex": "RegExp Unicode Property Escapes",
|
||||
};
|
||||
|
||||
const pluginSyntaxMap = new Map([
|
||||
["transform-async-generator-functions", "syntax-async-generators"],
|
||||
["transform-object-rest-spread", "syntax-object-rest-spread"],
|
||||
["transform-optional-catch-binding", "syntax-optional-catch-binding"],
|
||||
["transform-unicode-property-regex", null],
|
||||
]);
|
||||
|
||||
module.exports = { builtIns, features, pluginSyntaxMap };
|
||||
59
experimental/babel-preset-env/package.json
Normal file
59
experimental/babel-preset-env/package.json
Normal file
@@ -0,0 +1,59 @@
|
||||
{
|
||||
"name": "babel-preset-env",
|
||||
"version": "7.0.0-beta.3",
|
||||
"description": "A Babel preset for each environment.",
|
||||
"author": "Henry Zhu <hi@henryzoo.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
"license": "MIT",
|
||||
"repository": "https://github.com/babel/babel/tree/master/experimental/babel-preset-env",
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
"build-data": "node ./scripts/build-data.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"babel-plugin-check-es2015-constants": "7.0.0-beta.3",
|
||||
"babel-plugin-syntax-async-generators": "7.0.0-beta.3",
|
||||
"babel-plugin-syntax-object-rest-spread": "7.0.0-beta.3",
|
||||
"babel-plugin-syntax-optional-catch-binding": "7.0.0-beta.3",
|
||||
"babel-plugin-syntax-trailing-function-commas": "7.0.0-beta.0",
|
||||
"babel-plugin-transform-async-generator-functions": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-async-to-generator": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-es2015-arrow-functions": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-es2015-block-scoped-functions": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-es2015-block-scoping": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-es2015-classes": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-es2015-computed-properties": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-es2015-destructuring": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-es2015-duplicate-keys": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-es2015-for-of": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-es2015-function-name": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-es2015-literals": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-es2015-modules-amd": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-es2015-modules-commonjs": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-es2015-modules-systemjs": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-es2015-modules-umd": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-es2015-object-super": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-es2015-parameters": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-es2015-shorthand-properties": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-es2015-spread": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-es2015-sticky-regex": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-es2015-template-literals": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-es2015-typeof-symbol": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-es2015-unicode-regex": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-exponentiation-operator": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-new-target": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-object-rest-spread": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-optional-catch-binding": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-regenerator": "7.0.0-beta.3",
|
||||
"babel-plugin-transform-unicode-property-regex": "^2.0.5",
|
||||
"browserslist": "^2.4.0",
|
||||
"invariant": "^2.2.2",
|
||||
"semver": "^5.3.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-cli": "7.0.0-beta.3",
|
||||
"babel-helper-fixtures": "7.0.0-beta.3",
|
||||
"babel-helper-plugin-test-runner": "7.0.0-beta.3",
|
||||
"compat-table": "kangax/compat-table#07dce174cc63f2b15b5f86b99cdfc89358dd072a"
|
||||
}
|
||||
}
|
||||
5
experimental/babel-preset-env/scripts/.eslintrc
Normal file
5
experimental/babel-preset-env/scripts/.eslintrc
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"rules": {
|
||||
"prettier/prettier": ["error", { "trailingComma": "es5" }]
|
||||
}
|
||||
}
|
||||
287
experimental/babel-preset-env/scripts/build-data.js
Normal file
287
experimental/babel-preset-env/scripts/build-data.js
Normal file
@@ -0,0 +1,287 @@
|
||||
"use strict";
|
||||
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const flattenDeep = require("lodash/flattenDeep");
|
||||
const isEqual = require("lodash/isEqual");
|
||||
const mapValues = require("lodash/mapValues");
|
||||
const pickBy = require("lodash/pickBy");
|
||||
const electronToChromiumVersions = require("electron-to-chromium").versions;
|
||||
|
||||
const electronToChromiumKeys = Object.keys(
|
||||
electronToChromiumVersions
|
||||
).reverse();
|
||||
|
||||
const chromiumToElectronMap = electronToChromiumKeys.reduce((all, electron) => {
|
||||
all[electronToChromiumVersions[electron]] = +electron;
|
||||
return all;
|
||||
}, {});
|
||||
const chromiumToElectronVersions = Object.keys(chromiumToElectronMap);
|
||||
|
||||
const findClosestElectronVersion = targetVersion => {
|
||||
const chromiumVersionsLength = chromiumToElectronVersions.length;
|
||||
const maxChromium = +chromiumToElectronVersions[chromiumVersionsLength - 1];
|
||||
if (targetVersion > maxChromium) return null;
|
||||
|
||||
const closestChrome = chromiumToElectronVersions.find(
|
||||
version => targetVersion <= version
|
||||
);
|
||||
return chromiumToElectronMap[closestChrome];
|
||||
};
|
||||
|
||||
const chromiumToElectron = chromium =>
|
||||
chromiumToElectronMap[chromium] || findClosestElectronVersion(chromium);
|
||||
|
||||
const renameTests = (tests, getName, category) =>
|
||||
tests.map(test =>
|
||||
Object.assign({}, test, { name: getName(test.name), category })
|
||||
);
|
||||
|
||||
// The following is adapted from compat-table:
|
||||
// https://github.com/kangax/compat-table/blob/gh-pages/build.js
|
||||
//
|
||||
// It parses and interpolates data so environments that "equal" other
|
||||
// environments (node4 and chrome45), as well as familial relationships (edge
|
||||
// and ie11) can be handled properly.
|
||||
|
||||
const envs = require("compat-table/environments");
|
||||
|
||||
const byTestSuite = suite => browser => {
|
||||
return Array.isArray(browser.test_suites)
|
||||
? browser.test_suites.indexOf(suite) > -1
|
||||
: true;
|
||||
};
|
||||
|
||||
const compatSources = [
|
||||
"es6",
|
||||
"es2016plus",
|
||||
"esnext",
|
||||
].reduce((result, source) => {
|
||||
const data = require(`compat-table/data-${source}`);
|
||||
data.browsers = pickBy(envs, byTestSuite(source));
|
||||
result.push(data);
|
||||
return result;
|
||||
}, []);
|
||||
|
||||
const interpolateAllResults = (rawBrowsers, tests) => {
|
||||
const interpolateResults = res => {
|
||||
let browser;
|
||||
let prevBrowser;
|
||||
let result;
|
||||
let prevResult;
|
||||
let prevBid;
|
||||
|
||||
for (const bid in rawBrowsers) {
|
||||
// For browsers that are essentially equal to other browsers,
|
||||
// copy over the results.
|
||||
browser = rawBrowsers[bid];
|
||||
if (browser.equals && res[bid] === undefined) {
|
||||
result = res[browser.equals];
|
||||
res[bid] =
|
||||
browser.ignore_flagged && result === "flagged" ? false : result;
|
||||
// For each browser, check if the previous browser has the same
|
||||
// browser full name (e.g. Firefox) or family name (e.g. Chakra) as this one.
|
||||
} else if (
|
||||
prevBrowser &&
|
||||
(prevBrowser.full.replace(/,.+$/, "") ===
|
||||
browser.full.replace(/,.+$/, "") ||
|
||||
(browser.family !== undefined &&
|
||||
prevBrowser.family === browser.family))
|
||||
) {
|
||||
// For each test, check if the previous browser has a result
|
||||
// that this browser lacks.
|
||||
result = res[bid];
|
||||
prevResult = res[prevBid];
|
||||
if (prevResult !== undefined && result === undefined) {
|
||||
res[bid] = prevResult;
|
||||
}
|
||||
}
|
||||
prevBrowser = browser;
|
||||
prevBid = bid;
|
||||
}
|
||||
};
|
||||
|
||||
// Now print the results.
|
||||
tests.forEach(function(t) {
|
||||
// Calculate the result totals for tests which consist solely of subtests.
|
||||
if ("subtests" in t) {
|
||||
t.subtests.forEach(function(e) {
|
||||
interpolateResults(e.res);
|
||||
});
|
||||
} else {
|
||||
interpolateResults(t.res);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
compatSources.forEach(({ browsers, tests }) =>
|
||||
interpolateAllResults(browsers, tests)
|
||||
);
|
||||
|
||||
// End of compat-table code adaptation
|
||||
|
||||
const environments = [
|
||||
"chrome",
|
||||
"opera",
|
||||
"edge",
|
||||
"firefox",
|
||||
"safari",
|
||||
"node",
|
||||
"ie",
|
||||
"android",
|
||||
"ios",
|
||||
"phantom",
|
||||
];
|
||||
|
||||
const compatibilityTests = flattenDeep(
|
||||
compatSources.map(data =>
|
||||
data.tests.map(test => {
|
||||
return test.subtests
|
||||
? [
|
||||
test,
|
||||
renameTests(
|
||||
test.subtests,
|
||||
name => test.name + " / " + name,
|
||||
test.category
|
||||
),
|
||||
]
|
||||
: test;
|
||||
})
|
||||
)
|
||||
);
|
||||
|
||||
const getLowestImplementedVersion = ({ features }, env) => {
|
||||
const tests = compatibilityTests
|
||||
.filter(test => {
|
||||
return (
|
||||
features.indexOf(test.name) >= 0 ||
|
||||
// for features === ["DataView"]
|
||||
// it covers "DataView (Int8)" and "DataView (UInt8)"
|
||||
(features.length === 1 && test.name.indexOf(features[0]) === 0)
|
||||
);
|
||||
})
|
||||
.reduce((result, test) => {
|
||||
const isBuiltIn =
|
||||
test.category === "built-ins" ||
|
||||
test.category === "built-in extensions";
|
||||
|
||||
if (!test.subtests) {
|
||||
result.push({
|
||||
name: test.name,
|
||||
res: test.res,
|
||||
isBuiltIn,
|
||||
});
|
||||
} else {
|
||||
test.subtests.forEach(subtest =>
|
||||
result.push({
|
||||
name: `${test.name}/${subtest.name}`,
|
||||
res: subtest.res,
|
||||
isBuiltIn,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
return result;
|
||||
}, []);
|
||||
|
||||
const envTests = tests.map(({ res: test, isBuiltIn }, i) => {
|
||||
// Babel itself doesn't implement the feature correctly,
|
||||
// don't count against it
|
||||
// only doing this for built-ins atm
|
||||
if (!test.babel && isBuiltIn) {
|
||||
return "-1";
|
||||
}
|
||||
|
||||
return (
|
||||
Object.keys(test)
|
||||
.filter(t => t.startsWith(env))
|
||||
// Babel assumes strict mode
|
||||
.filter(
|
||||
test => tests[i].res[test] === true || tests[i].res[test] === "strict"
|
||||
)
|
||||
// normalize some keys
|
||||
.map(test => test.replace("_", "."))
|
||||
.filter(test => !isNaN(parseFloat(test.replace(env, ""))))
|
||||
.shift()
|
||||
);
|
||||
});
|
||||
|
||||
const envFiltered = envTests.filter(t => t);
|
||||
if (envTests.length > envFiltered.length || envTests.length === 0) {
|
||||
// envTests.forEach((test, i) => {
|
||||
// if (!test) {
|
||||
// // print unsupported features
|
||||
// if (env === 'node') {
|
||||
// console.log(`ENV(${env}): ${tests[i].name}`);
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
return null;
|
||||
}
|
||||
|
||||
return envTests.map(str => Number(str.replace(env, ""))).reduce((a, b) => {
|
||||
return a < b ? b : a;
|
||||
});
|
||||
};
|
||||
|
||||
const generateData = (environments, features) => {
|
||||
return mapValues(features, options => {
|
||||
if (!options.features) {
|
||||
options = {
|
||||
features: [options],
|
||||
};
|
||||
}
|
||||
|
||||
const plugin = {};
|
||||
|
||||
environments.forEach(env => {
|
||||
const version = getLowestImplementedVersion(options, env);
|
||||
|
||||
if (version !== null) {
|
||||
plugin[env] = version.toString();
|
||||
}
|
||||
});
|
||||
|
||||
if (plugin.chrome) {
|
||||
// add opera
|
||||
if (plugin.chrome >= 28) {
|
||||
plugin.opera = (plugin.chrome - 13).toString();
|
||||
} else if (plugin.chrome === 5) {
|
||||
plugin.opera = "12";
|
||||
}
|
||||
|
||||
// add electron
|
||||
const electronVersion = chromiumToElectron(plugin.chrome);
|
||||
if (electronVersion) {
|
||||
plugin.electron = electronVersion.toString();
|
||||
}
|
||||
}
|
||||
|
||||
return plugin;
|
||||
});
|
||||
};
|
||||
|
||||
["plugin", "built-in"].forEach(target => {
|
||||
const newData = generateData(
|
||||
environments,
|
||||
require(`../data/${target}-features`)
|
||||
);
|
||||
const dataPath = path.join(__dirname, `../data/${target}s.json`);
|
||||
|
||||
if (process.argv[2] === "--check") {
|
||||
const currentData = require(dataPath);
|
||||
|
||||
if (!isEqual(currentData, newData)) {
|
||||
console.error(
|
||||
"The newly generated plugin/built-in data does not match the current " +
|
||||
"files. Re-run `npm run build-data`."
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
fs.writeFileSync(dataPath, `${JSON.stringify(newData, null, 2)}\n`);
|
||||
});
|
||||
111
experimental/babel-preset-env/scripts/smoke-test.js
Executable file
111
experimental/babel-preset-env/scripts/smoke-test.js
Executable file
@@ -0,0 +1,111 @@
|
||||
const fs = require("fs-extra");
|
||||
const execSync = require("child_process").execSync;
|
||||
const path = require("path");
|
||||
const pkg = require("../package.json");
|
||||
|
||||
let errorOccurred = false;
|
||||
|
||||
const tempFolderPath = path.join(__dirname, "../tmp");
|
||||
const packPath = path.join(__dirname, `../babel-preset-env-${pkg.version}.tgz`);
|
||||
|
||||
try {
|
||||
console.log("Creating package");
|
||||
execSync("npm pack");
|
||||
|
||||
console.log("Setting up smoke test dependencies");
|
||||
|
||||
fs.ensureDirSync(tempFolderPath);
|
||||
process.chdir(tempFolderPath);
|
||||
|
||||
const babelCliVersion = pkg.devDependencies["babel-cli"];
|
||||
|
||||
if (!babelCliVersion) {
|
||||
throw new Error("Could not read version of babel-cli from package.json");
|
||||
}
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(tempFolderPath, "package.json"),
|
||||
`
|
||||
{
|
||||
"name": "babel-preset-env-smoke-test",
|
||||
"private": true,
|
||||
"version": "1.0.0",
|
||||
"scripts": {
|
||||
"build": "babel index.js --out-file index.es6"
|
||||
},
|
||||
"dependencies": {
|
||||
"babel-cli": "${babelCliVersion}",
|
||||
"babel-preset-env": "${packPath}"
|
||||
}
|
||||
}
|
||||
`
|
||||
);
|
||||
|
||||
execSync("npm install");
|
||||
|
||||
console.log("Setting up 'usage' smoke test");
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(tempFolderPath, ".babelrc"),
|
||||
`
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
modules: false,
|
||||
useBuiltIns: "usage"
|
||||
}]
|
||||
]
|
||||
}
|
||||
`
|
||||
);
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(tempFolderPath, "index.js"),
|
||||
`
|
||||
const foo = new Promise((resolve) => {
|
||||
resolve(new Map());
|
||||
});
|
||||
`
|
||||
);
|
||||
|
||||
console.log("Running 'usage' smoke test");
|
||||
|
||||
execSync("npm run build");
|
||||
|
||||
console.log("Setting up 'entry' smoke test");
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(tempFolderPath, ".babelrc"),
|
||||
`
|
||||
{
|
||||
"presets": [
|
||||
["env", {
|
||||
modules: false,
|
||||
useBuiltIns: "entry"
|
||||
}]
|
||||
]
|
||||
}
|
||||
`
|
||||
);
|
||||
|
||||
fs.writeFileSync(
|
||||
path.join(tempFolderPath, "index.js"),
|
||||
`
|
||||
import "babel-polyfill";
|
||||
1 ** 2;
|
||||
`
|
||||
);
|
||||
|
||||
console.log("Running 'entry' smoke test");
|
||||
|
||||
execSync("npm run build");
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
errorOccurred = true;
|
||||
}
|
||||
|
||||
console.log("Cleaning up");
|
||||
fs.removeSync(tempFolderPath);
|
||||
fs.removeSync(packPath);
|
||||
|
||||
process.exit(errorOccurred ? 1 : 0);
|
||||
37
experimental/babel-preset-env/src/available-plugins.js
Normal file
37
experimental/babel-preset-env/src/available-plugins.js
Normal file
@@ -0,0 +1,37 @@
|
||||
export default {
|
||||
"check-es2015-constants": require("babel-plugin-check-es2015-constants"),
|
||||
"syntax-async-generators": require("babel-plugin-syntax-async-generators"),
|
||||
"syntax-object-rest-spread": require("babel-plugin-syntax-object-rest-spread"),
|
||||
"syntax-optional-catch-binding": require("babel-plugin-syntax-optional-catch-binding"),
|
||||
"syntax-trailing-function-commas": require("babel-plugin-syntax-trailing-function-commas"),
|
||||
"transform-async-to-generator": require("babel-plugin-transform-async-to-generator"),
|
||||
"transform-async-generator-functions": require("babel-plugin-transform-async-generator-functions"),
|
||||
"transform-es2015-arrow-functions": require("babel-plugin-transform-es2015-arrow-functions"),
|
||||
"transform-es2015-block-scoped-functions": require("babel-plugin-transform-es2015-block-scoped-functions"),
|
||||
"transform-es2015-block-scoping": require("babel-plugin-transform-es2015-block-scoping"),
|
||||
"transform-es2015-classes": require("babel-plugin-transform-es2015-classes"),
|
||||
"transform-es2015-computed-properties": require("babel-plugin-transform-es2015-computed-properties"),
|
||||
"transform-es2015-destructuring": require("babel-plugin-transform-es2015-destructuring"),
|
||||
"transform-es2015-duplicate-keys": require("babel-plugin-transform-es2015-duplicate-keys"),
|
||||
"transform-es2015-for-of": require("babel-plugin-transform-es2015-for-of"),
|
||||
"transform-es2015-function-name": require("babel-plugin-transform-es2015-function-name"),
|
||||
"transform-es2015-literals": require("babel-plugin-transform-es2015-literals"),
|
||||
"transform-es2015-modules-amd": require("babel-plugin-transform-es2015-modules-amd"),
|
||||
"transform-es2015-modules-commonjs": require("babel-plugin-transform-es2015-modules-commonjs"),
|
||||
"transform-es2015-modules-systemjs": require("babel-plugin-transform-es2015-modules-systemjs"),
|
||||
"transform-es2015-modules-umd": require("babel-plugin-transform-es2015-modules-umd"),
|
||||
"transform-es2015-object-super": require("babel-plugin-transform-es2015-object-super"),
|
||||
"transform-es2015-parameters": require("babel-plugin-transform-es2015-parameters"),
|
||||
"transform-es2015-shorthand-properties": require("babel-plugin-transform-es2015-shorthand-properties"),
|
||||
"transform-es2015-spread": require("babel-plugin-transform-es2015-spread"),
|
||||
"transform-es2015-sticky-regex": require("babel-plugin-transform-es2015-sticky-regex"),
|
||||
"transform-es2015-template-literals": require("babel-plugin-transform-es2015-template-literals"),
|
||||
"transform-es2015-typeof-symbol": require("babel-plugin-transform-es2015-typeof-symbol"),
|
||||
"transform-es2015-unicode-regex": require("babel-plugin-transform-es2015-unicode-regex"),
|
||||
"transform-exponentiation-operator": require("babel-plugin-transform-exponentiation-operator"),
|
||||
"transform-new-target": require("babel-plugin-transform-new-target"),
|
||||
"transform-object-rest-spread": require("babel-plugin-transform-object-rest-spread"),
|
||||
"transform-optional-catch-binding": require("babel-plugin-transform-optional-catch-binding"),
|
||||
"transform-regenerator": require("babel-plugin-transform-regenerator"),
|
||||
"transform-unicode-property-regex": require("babel-plugin-transform-unicode-property-regex"),
|
||||
};
|
||||
109
experimental/babel-preset-env/src/built-in-definitions.js
Normal file
109
experimental/babel-preset-env/src/built-in-definitions.js
Normal file
@@ -0,0 +1,109 @@
|
||||
// TODO: this is the opposite of built-in-features so maybe generate one from the other?
|
||||
export const definitions = {
|
||||
builtins: {
|
||||
DataView: "es6.typed.data-view",
|
||||
Int8Array: "es6.typed.int8-array",
|
||||
Uint8Array: "es6.typed.uint8-array",
|
||||
Uint8ClampedArray: "es6.typed.uint8-clamped-array",
|
||||
Int16Array: "es6.typed.int16-array",
|
||||
Uint16Array: "es6.typed.uint16-array",
|
||||
Int32Array: "es6.typed.int32-array",
|
||||
Uint32Array: "es6.typed.uint32-array",
|
||||
Float32Array: "es6.typed.float32-array",
|
||||
Float64Array: "es6.typed.float64-array",
|
||||
Map: "es6.map",
|
||||
Set: "es6.set",
|
||||
WeakMap: "es6.weak-map",
|
||||
WeakSet: "es6.weak-set",
|
||||
Promise: "es6.promise",
|
||||
Symbol: "es6.symbol",
|
||||
},
|
||||
|
||||
instanceMethods: {
|
||||
name: ["es6.function.name"],
|
||||
fromCodePoint: ["es6.string.from-code-point"],
|
||||
codePointAt: ["es6.string.code-point-at"],
|
||||
repeat: ["es6.string.repeat"],
|
||||
startsWith: ["es6.string.starts-with"],
|
||||
endsWith: ["es6.string.ends-with"],
|
||||
includes: ["es6.string.includes", "es7.array.includes"],
|
||||
flags: ["es6.regexp.flags"],
|
||||
match: ["es6.regexp.match"],
|
||||
replace: ["es6.regexp.replace"],
|
||||
split: ["es6.regexp.split"],
|
||||
search: ["es6.regexp.search"],
|
||||
copyWithin: ["es6.array.copy-within"],
|
||||
find: ["es6.array.find"],
|
||||
findIndex: ["es6.array.find-index"],
|
||||
fill: ["es6.array.fill"],
|
||||
padStart: ["es7.string.pad-start"],
|
||||
padEnd: ["es7.string.pad-end"],
|
||||
},
|
||||
|
||||
staticMethods: {
|
||||
Array: {
|
||||
from: "es6.array.from",
|
||||
of: "es6.array.of",
|
||||
},
|
||||
|
||||
Object: {
|
||||
assign: "es6.object.assign",
|
||||
is: "es6.object.is",
|
||||
getOwnPropertySymbols: "es6.object.get-own-property-symbols",
|
||||
setPrototypeOf: "es6.object.set-prototype-of",
|
||||
values: "es7.object.values",
|
||||
entries: "es7.object.entries",
|
||||
getOwnPropertyDescriptors: "es7.object.get-own-property-descriptors",
|
||||
},
|
||||
|
||||
Math: {
|
||||
acosh: "es6.math.acosh",
|
||||
asinh: "es6.math.asinh",
|
||||
atanh: "es6.math.atanh",
|
||||
cbrt: "es6.math.cbrt",
|
||||
clz32: "es6.math.clz32",
|
||||
cosh: "es6.math.cosh",
|
||||
expm1: "es6.math.expm1",
|
||||
fround: "es6.math.fround",
|
||||
hypot: "es6.math.hypot",
|
||||
imul: "es6.math.imul",
|
||||
log1p: "es6.math.log1p",
|
||||
log10: "es6.math.log10",
|
||||
log2: "es6.math.log2",
|
||||
sign: "es6.math.sign",
|
||||
sinh: "es6.math.sinh",
|
||||
tanh: "es6.math.tanh",
|
||||
trunc: "es6.math.trunc",
|
||||
},
|
||||
|
||||
String: {
|
||||
raw: "es6.string.raw",
|
||||
},
|
||||
|
||||
Number: {
|
||||
isFinite: "es6.number.is-finite",
|
||||
isInteger: "es6.number.is-integer",
|
||||
isSafeInteger: "es6.number.is-safe-integer",
|
||||
isNaN: "es6.number.is-nan",
|
||||
EPSILON: "es6.number.epsilon",
|
||||
MIN_SAFE_INTEGER: "es6.number.min-safe-integer",
|
||||
MAX_SAFE_INTEGER: "es6.number.max-safe-integer",
|
||||
},
|
||||
|
||||
Reflect: {
|
||||
apply: "es6.reflect.apply",
|
||||
construct: "es6.reflect.construct",
|
||||
defineProperty: "es6.reflect.define-property",
|
||||
deleteProperty: "es6.reflect.delete-property",
|
||||
get: "es6.reflect.get",
|
||||
getOwnPropertyDescriptor: "es6.reflect.get-own-property-descriptor",
|
||||
getPrototypeOf: "es6.reflect.get-prototype-of",
|
||||
has: "es6.reflect.has",
|
||||
isExtensible: "es6.reflect.is-extensible",
|
||||
ownKeys: "es6.reflect.own-keys",
|
||||
preventExtensions: "es6.reflect.prevent-extensions",
|
||||
set: "es6.reflect.set",
|
||||
setPrototypeOf: "es6.reflect.set-prototype-of",
|
||||
},
|
||||
},
|
||||
};
|
||||
75
experimental/babel-preset-env/src/debug.js
Normal file
75
experimental/babel-preset-env/src/debug.js
Normal file
@@ -0,0 +1,75 @@
|
||||
/*eslint quotes: ["error", "double", { "avoidEscape": true }]*/
|
||||
import semver from "semver";
|
||||
import { prettifyVersion, semverify } from "./utils";
|
||||
|
||||
const wordEnds = size => {
|
||||
return size > 1 ? "s" : "";
|
||||
};
|
||||
|
||||
export const logMessage = (message, context) => {
|
||||
const pre = context ? `[${context}] ` : "";
|
||||
const logStr = ` ${pre}${message}`;
|
||||
console.log(logStr);
|
||||
};
|
||||
|
||||
export const logPlugin = (plugin, targets, list, context) => {
|
||||
const envList = list[plugin] || {};
|
||||
const filteredList = Object.keys(targets).reduce((a, b) => {
|
||||
if (!envList[b] || semver.lt(targets[b], semverify(envList[b]))) {
|
||||
a[b] = prettifyVersion(targets[b]);
|
||||
}
|
||||
return a;
|
||||
}, {});
|
||||
|
||||
const formattedTargets = JSON.stringify(filteredList)
|
||||
.replace(/,/g, ", ")
|
||||
.replace(/^\{"/, '{ "')
|
||||
.replace(/"\}$/, '" }');
|
||||
|
||||
logMessage(`${plugin} ${formattedTargets}`, context);
|
||||
};
|
||||
|
||||
export const logEntryPolyfills = (
|
||||
importPolyfillIncluded,
|
||||
polyfills,
|
||||
filename,
|
||||
onDebug,
|
||||
) => {
|
||||
if (!importPolyfillIncluded) {
|
||||
console.log(
|
||||
`
|
||||
[${filename}] \`import 'babel-polyfill'\` was not found.`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (!polyfills.size) {
|
||||
console.log(
|
||||
`
|
||||
[${filename}] Based on your targets, none were added.`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log(
|
||||
`
|
||||
[${filename}] Replaced \`babel-polyfill\` with the following polyfill${wordEnds(
|
||||
polyfills.size,
|
||||
)}:`,
|
||||
);
|
||||
onDebug(polyfills);
|
||||
};
|
||||
|
||||
export const logUsagePolyfills = (polyfills, filename, onDebug) => {
|
||||
if (!polyfills.size) {
|
||||
console.log(
|
||||
`
|
||||
[${filename}] Based on your code and targets, none were added.`,
|
||||
);
|
||||
return;
|
||||
}
|
||||
console.log(
|
||||
`
|
||||
[${filename}] Added following polyfill${wordEnds(polyfills.size)}:`,
|
||||
);
|
||||
onDebug(polyfills);
|
||||
};
|
||||
5
experimental/babel-preset-env/src/default-includes.js
Normal file
5
experimental/babel-preset-env/src/default-includes.js
Normal file
@@ -0,0 +1,5 @@
|
||||
export const defaultWebIncludes = [
|
||||
"web.timers",
|
||||
"web.immediate",
|
||||
"web.dom.iterable",
|
||||
];
|
||||
272
experimental/babel-preset-env/src/index.js
Normal file
272
experimental/babel-preset-env/src/index.js
Normal file
@@ -0,0 +1,272 @@
|
||||
//@flow
|
||||
|
||||
import semver from "semver";
|
||||
import builtInsList from "../data/built-ins.json";
|
||||
import { logPlugin } from "./debug";
|
||||
import { defaultWebIncludes } from "./default-includes";
|
||||
import moduleTransformations from "./module-transformations";
|
||||
import normalizeOptions from "./normalize-options.js";
|
||||
import pluginList from "../data/plugins.json";
|
||||
import {
|
||||
builtIns as proposalBuiltIns,
|
||||
features as proposalPlugins,
|
||||
pluginSyntaxMap,
|
||||
} from "../data/shipped-proposals.js";
|
||||
import useBuiltInsEntryPlugin from "./use-built-ins-entry-plugin";
|
||||
import addUsedBuiltInsPlugin from "./use-built-ins-plugin";
|
||||
import getTargets from "./targets-parser";
|
||||
import availablePlugins from "./available-plugins";
|
||||
import { filterStageFromList, prettifyTargets, semverify } from "./utils";
|
||||
import type { Plugin, Targets } from "./types";
|
||||
|
||||
const getPlugin = (pluginName: string) => {
|
||||
const plugin = availablePlugins[pluginName];
|
||||
|
||||
if (!plugin) {
|
||||
throw new Error(
|
||||
`Could not find plugin "${pluginName}". Ensure there is an entry in ./available-plugins.js for it.`,
|
||||
);
|
||||
}
|
||||
|
||||
return plugin;
|
||||
};
|
||||
|
||||
const builtInsListWithoutProposals = filterStageFromList(
|
||||
builtInsList,
|
||||
proposalBuiltIns,
|
||||
);
|
||||
|
||||
const pluginListWithoutProposals = filterStageFromList(
|
||||
pluginList,
|
||||
proposalPlugins,
|
||||
);
|
||||
|
||||
export const isPluginRequired = (
|
||||
supportedEnvironments: Targets,
|
||||
plugin: Targets,
|
||||
): boolean => {
|
||||
const targetEnvironments: Array<string> = Object.keys(supportedEnvironments);
|
||||
|
||||
if (targetEnvironments.length === 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const isRequiredForEnvironments: Array<
|
||||
string,
|
||||
> = targetEnvironments.filter(environment => {
|
||||
// Feature is not implemented in that environment
|
||||
if (!plugin[environment]) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const lowestImplementedVersion: string = plugin[environment];
|
||||
const lowestTargetedVersion: string = supportedEnvironments[environment];
|
||||
|
||||
if (!semver.valid(lowestTargetedVersion)) {
|
||||
throw new Error(
|
||||
// eslint-disable-next-line max-len
|
||||
`Invalid version passed for target "${environment}": "${lowestTargetedVersion}". Versions must be in semver format (major.minor.patch)`,
|
||||
);
|
||||
}
|
||||
|
||||
return semver.gt(
|
||||
semverify(lowestImplementedVersion),
|
||||
lowestTargetedVersion,
|
||||
);
|
||||
});
|
||||
|
||||
return isRequiredForEnvironments.length > 0;
|
||||
};
|
||||
|
||||
let hasBeenLogged = false;
|
||||
|
||||
const getBuiltInTargets = targets => {
|
||||
const builtInTargets = Object.assign({}, targets);
|
||||
if (builtInTargets.uglify != null) {
|
||||
delete builtInTargets.uglify;
|
||||
}
|
||||
return builtInTargets;
|
||||
};
|
||||
|
||||
export const transformIncludesAndExcludes = (opts: Array<string>): Object => {
|
||||
return opts.reduce(
|
||||
(result, opt) => {
|
||||
const target = opt.match(/^(es\d+|web)\./) ? "builtIns" : "plugins";
|
||||
result[target].add(opt);
|
||||
return result;
|
||||
},
|
||||
{
|
||||
all: opts,
|
||||
plugins: new Set(),
|
||||
builtIns: new Set(),
|
||||
},
|
||||
);
|
||||
};
|
||||
|
||||
const getPlatformSpecificDefaultFor = (targets: Targets): ?Array<string> => {
|
||||
const targetNames = Object.keys(targets);
|
||||
const isAnyTarget = !targetNames.length;
|
||||
const isWebTarget = targetNames.some(name => name !== "node");
|
||||
|
||||
return isAnyTarget || isWebTarget ? defaultWebIncludes : null;
|
||||
};
|
||||
|
||||
const filterItems = (
|
||||
list,
|
||||
includes,
|
||||
excludes,
|
||||
targets,
|
||||
defaultItems,
|
||||
): Set<string> => {
|
||||
const result = new Set();
|
||||
|
||||
for (const item in list) {
|
||||
const excluded = excludes.has(item);
|
||||
|
||||
if (!excluded) {
|
||||
if (isPluginRequired(targets, list[item])) {
|
||||
result.add(item);
|
||||
} else {
|
||||
const shippedProposalsSyntax = pluginSyntaxMap.get(item);
|
||||
|
||||
if (shippedProposalsSyntax) {
|
||||
result.add(shippedProposalsSyntax);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (defaultItems) {
|
||||
defaultItems.forEach(item => !excludes.has(item) && result.add(item));
|
||||
}
|
||||
|
||||
includes.forEach(item => result.add(item));
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
export default function buildPreset(
|
||||
context: Object,
|
||||
opts: Object = {},
|
||||
): { plugins: Array<Plugin> } {
|
||||
const {
|
||||
configPath,
|
||||
debug,
|
||||
exclude: optionsExclude,
|
||||
forceAllTransforms,
|
||||
ignoreBrowserslistConfig,
|
||||
include: optionsInclude,
|
||||
loose,
|
||||
modules,
|
||||
shippedProposals,
|
||||
spec,
|
||||
targets: optionsTargets,
|
||||
useBuiltIns,
|
||||
} = normalizeOptions(opts);
|
||||
// TODO: remove this in next major
|
||||
let hasUglifyTarget = false;
|
||||
|
||||
if (optionsTargets && optionsTargets.uglify) {
|
||||
hasUglifyTarget = true;
|
||||
delete optionsTargets.uglify;
|
||||
|
||||
console.log("");
|
||||
console.log("The uglify target has been deprecated. Set the top level");
|
||||
console.log("option `forceAllTransforms: true` instead.");
|
||||
console.log("");
|
||||
}
|
||||
|
||||
const targets = getTargets(optionsTargets, {
|
||||
ignoreBrowserslistConfig,
|
||||
configPath,
|
||||
});
|
||||
const include = transformIncludesAndExcludes(optionsInclude);
|
||||
const exclude = transformIncludesAndExcludes(optionsExclude);
|
||||
|
||||
const transformTargets = forceAllTransforms || hasUglifyTarget ? {} : targets;
|
||||
|
||||
const transformations = filterItems(
|
||||
shippedProposals ? pluginList : pluginListWithoutProposals,
|
||||
include.plugins,
|
||||
exclude.plugins,
|
||||
transformTargets,
|
||||
);
|
||||
|
||||
let polyfills;
|
||||
let polyfillTargets;
|
||||
|
||||
if (useBuiltIns) {
|
||||
polyfillTargets = getBuiltInTargets(targets);
|
||||
|
||||
polyfills = filterItems(
|
||||
shippedProposals ? builtInsList : builtInsListWithoutProposals,
|
||||
include.builtIns,
|
||||
exclude.builtIns,
|
||||
polyfillTargets,
|
||||
getPlatformSpecificDefaultFor(polyfillTargets),
|
||||
);
|
||||
}
|
||||
|
||||
const plugins = [];
|
||||
const pluginUseBuiltIns = useBuiltIns !== false;
|
||||
|
||||
// NOTE: not giving spec here yet to avoid compatibility issues when
|
||||
// babel-plugin-transform-es2015-modules-commonjs gets its spec mode
|
||||
if (modules !== false && moduleTransformations[modules]) {
|
||||
plugins.push([getPlugin(moduleTransformations[modules]), { loose }]);
|
||||
}
|
||||
|
||||
transformations.forEach(pluginName =>
|
||||
plugins.push([
|
||||
getPlugin(pluginName),
|
||||
{ spec, loose, useBuiltIns: pluginUseBuiltIns },
|
||||
]),
|
||||
);
|
||||
|
||||
const regenerator = transformations.has("transform-regenerator");
|
||||
|
||||
if (debug && !hasBeenLogged) {
|
||||
hasBeenLogged = true;
|
||||
console.log("babel-preset-env: `DEBUG` option");
|
||||
console.log("\nUsing targets:");
|
||||
console.log(JSON.stringify(prettifyTargets(targets), null, 2));
|
||||
console.log(`\nUsing modules transform: ${modules.toString()}`);
|
||||
console.log("\nUsing plugins:");
|
||||
transformations.forEach(transform => {
|
||||
logPlugin(transform, targets, pluginList);
|
||||
});
|
||||
|
||||
if (!useBuiltIns) {
|
||||
console.log(
|
||||
"\nUsing polyfills: No polyfills were added, since the `useBuiltIns` option was not set.",
|
||||
);
|
||||
} else {
|
||||
console.log(
|
||||
`
|
||||
Using polyfills with \`${useBuiltIns}\` option:`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (useBuiltIns === "usage" || useBuiltIns === "entry") {
|
||||
const pluginOptions = {
|
||||
debug,
|
||||
polyfills,
|
||||
regenerator,
|
||||
onDebug: (polyfills, context) => {
|
||||
polyfills.forEach(polyfill =>
|
||||
logPlugin(polyfill, polyfillTargets, builtInsList, context),
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
plugins.push([
|
||||
useBuiltIns === "usage" ? addUsedBuiltInsPlugin : useBuiltInsEntryPlugin,
|
||||
pluginOptions,
|
||||
]);
|
||||
}
|
||||
|
||||
return {
|
||||
plugins,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
export default {
|
||||
amd: "transform-es2015-modules-amd",
|
||||
commonjs: "transform-es2015-modules-commonjs",
|
||||
systemjs: "transform-es2015-modules-systemjs",
|
||||
umd: "transform-es2015-modules-umd",
|
||||
};
|
||||
175
experimental/babel-preset-env/src/normalize-options.js
Normal file
175
experimental/babel-preset-env/src/normalize-options.js
Normal file
@@ -0,0 +1,175 @@
|
||||
//@flow
|
||||
|
||||
import invariant from "invariant";
|
||||
import browserslist from "browserslist";
|
||||
import builtInsList from "../data/built-ins.json";
|
||||
import { defaultWebIncludes } from "./default-includes";
|
||||
import moduleTransformations from "./module-transformations";
|
||||
import pluginsList from "../data/plugins.json";
|
||||
import type { Targets, Options, ModuleOption, BuiltInsOption } from "./types";
|
||||
|
||||
const validIncludesAndExcludes = new Set([
|
||||
...Object.keys(pluginsList),
|
||||
...Object.keys(moduleTransformations).map(m => moduleTransformations[m]),
|
||||
...Object.keys(builtInsList),
|
||||
...defaultWebIncludes,
|
||||
]);
|
||||
|
||||
export const validateIncludesAndExcludes = (
|
||||
opts: Array<string> = [],
|
||||
type: string,
|
||||
): Array<string> => {
|
||||
invariant(
|
||||
Array.isArray(opts),
|
||||
`Invalid Option: The '${type}' option must be an Array<String> of plugins/built-ins`,
|
||||
);
|
||||
|
||||
const unknownOpts = opts.filter(opt => !validIncludesAndExcludes.has(opt));
|
||||
|
||||
invariant(
|
||||
unknownOpts.length === 0,
|
||||
`Invalid Option: The plugins/built-ins '${unknownOpts.join(
|
||||
", ",
|
||||
)}' passed to the '${type}' option are not
|
||||
valid. Please check data/[plugin-features|built-in-features].js in babel-preset-env`,
|
||||
);
|
||||
|
||||
return opts;
|
||||
};
|
||||
|
||||
const validBrowserslistTargets = [
|
||||
...Object.keys(browserslist.data),
|
||||
...Object.keys(browserslist.aliases),
|
||||
];
|
||||
|
||||
export const normalizePluginName = (plugin: string): string =>
|
||||
plugin.replace(/^babel-plugin-/, "");
|
||||
|
||||
export const normalizePluginNames = (plugins: Array<string>): Array<string> =>
|
||||
plugins.map(normalizePluginName);
|
||||
|
||||
export const checkDuplicateIncludeExcludes = (
|
||||
include: Array<string> = [],
|
||||
exclude: Array<string> = [],
|
||||
): void => {
|
||||
const duplicates: Array<string> = include.filter(
|
||||
opt => exclude.indexOf(opt) >= 0,
|
||||
);
|
||||
|
||||
invariant(
|
||||
duplicates.length === 0,
|
||||
`Invalid Option: The plugins/built-ins '${duplicates.join(
|
||||
", ",
|
||||
)}' were found in both the "include" and
|
||||
"exclude" options.`,
|
||||
);
|
||||
};
|
||||
|
||||
export const validateConfigPathOption = (
|
||||
configPath: string = process.cwd(),
|
||||
) => {
|
||||
invariant(
|
||||
typeof configPath === "string",
|
||||
`Invalid Option: The configPath option '${configPath}' is invalid, only strings are allowed.`,
|
||||
);
|
||||
return configPath;
|
||||
};
|
||||
|
||||
export const validateBoolOption = (
|
||||
name: string,
|
||||
value: ?boolean,
|
||||
defaultValue: boolean,
|
||||
) => {
|
||||
if (typeof value === "undefined") {
|
||||
value = defaultValue;
|
||||
}
|
||||
|
||||
if (typeof value !== "boolean") {
|
||||
throw new Error(`Preset env: '${name}' option must be a boolean.`);
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
|
||||
export const validateIgnoreBrowserslistConfig = (
|
||||
ignoreBrowserslistConfig: boolean,
|
||||
) =>
|
||||
validateBoolOption(
|
||||
"ignoreBrowserslistConfig",
|
||||
ignoreBrowserslistConfig,
|
||||
false,
|
||||
);
|
||||
|
||||
export const validateModulesOption = (
|
||||
modulesOpt: ModuleOption = "commonjs",
|
||||
) => {
|
||||
invariant(
|
||||
modulesOpt === false ||
|
||||
Object.keys(moduleTransformations).indexOf(modulesOpt) > -1,
|
||||
`Invalid Option: The 'modules' option must be either 'false' to indicate no modules, or a
|
||||
module type which can be be one of: 'commonjs' (default), 'amd', 'umd', 'systemjs'.`,
|
||||
);
|
||||
|
||||
return modulesOpt;
|
||||
};
|
||||
|
||||
export const objectToBrowserslist = (object: Targets) => {
|
||||
return Object.keys(object).reduce((list, targetName) => {
|
||||
if (validBrowserslistTargets.indexOf(targetName) >= 0) {
|
||||
const targetVersion = object[targetName];
|
||||
return list.concat(`${targetName} ${targetVersion}`);
|
||||
}
|
||||
return list;
|
||||
}, []);
|
||||
};
|
||||
|
||||
export const validateUseBuiltInsOption = (
|
||||
builtInsOpt: BuiltInsOption = false,
|
||||
): BuiltInsOption => {
|
||||
invariant(
|
||||
builtInsOpt === "usage" || builtInsOpt === false || builtInsOpt === "entry",
|
||||
`Invalid Option: The 'useBuiltIns' option must be either
|
||||
'false' (default) to indicate no polyfill,
|
||||
'"entry"' to indicate replacing the entry polyfill, or
|
||||
'"usage"' to import only used polyfills per file`,
|
||||
);
|
||||
|
||||
return builtInsOpt;
|
||||
};
|
||||
|
||||
export default function normalizeOptions(opts: Options) {
|
||||
if (opts.exclude) {
|
||||
opts.exclude = normalizePluginNames(opts.exclude);
|
||||
}
|
||||
|
||||
if (opts.include) {
|
||||
opts.include = normalizePluginNames(opts.include);
|
||||
}
|
||||
|
||||
checkDuplicateIncludeExcludes(opts.include, opts.exclude);
|
||||
|
||||
return {
|
||||
configPath: validateConfigPathOption(opts.configPath),
|
||||
debug: opts.debug,
|
||||
exclude: validateIncludesAndExcludes(opts.exclude, "exclude"),
|
||||
forceAllTransforms: validateBoolOption(
|
||||
"forceAllTransforms",
|
||||
opts.forceAllTransforms,
|
||||
false,
|
||||
),
|
||||
ignoreBrowserslistConfig: validateIgnoreBrowserslistConfig(
|
||||
opts.ignoreBrowserslistConfig,
|
||||
),
|
||||
include: validateIncludesAndExcludes(opts.include, "include"),
|
||||
loose: validateBoolOption("loose", opts.loose, false),
|
||||
modules: validateModulesOption(opts.modules),
|
||||
shippedProposals: validateBoolOption(
|
||||
"shippedProposals",
|
||||
opts.shippedProposals,
|
||||
false,
|
||||
),
|
||||
spec: validateBoolOption("loose", opts.spec, false),
|
||||
targets: opts.targets,
|
||||
useBuiltIns: validateUseBuiltInsOption(opts.useBuiltIns),
|
||||
};
|
||||
}
|
||||
144
experimental/babel-preset-env/src/targets-parser.js
Normal file
144
experimental/babel-preset-env/src/targets-parser.js
Normal file
@@ -0,0 +1,144 @@
|
||||
// @flow
|
||||
|
||||
import browserslist from "browserslist";
|
||||
import semver from "semver";
|
||||
import { semverify } from "./utils";
|
||||
import { objectToBrowserslist } from "./normalize-options";
|
||||
import type { Targets } from "./types";
|
||||
|
||||
const browserNameMap = {
|
||||
android: "android",
|
||||
chrome: "chrome",
|
||||
and_chr: "chrome",
|
||||
edge: "edge",
|
||||
firefox: "firefox",
|
||||
ie: "ie",
|
||||
ios_saf: "ios",
|
||||
safari: "safari",
|
||||
};
|
||||
|
||||
const isBrowsersQueryValid = (browsers: string | Array<string>): boolean =>
|
||||
typeof browsers === "string" || Array.isArray(browsers);
|
||||
|
||||
const semverMin = (first: ?string, second: string): string => {
|
||||
return first && semver.lt(first, second) ? first : second;
|
||||
};
|
||||
|
||||
const mergeBrowsers = (fromQuery: Targets, fromTarget: Targets) => {
|
||||
return Object.keys(fromTarget).reduce((queryObj, targKey) => {
|
||||
if (targKey !== "browsers") {
|
||||
queryObj[targKey] = fromTarget[targKey];
|
||||
}
|
||||
return queryObj;
|
||||
}, fromQuery);
|
||||
};
|
||||
|
||||
const getLowestVersions = (browsers: Array<string>): Targets => {
|
||||
return browsers.reduce((all: Object, browser: string): Object => {
|
||||
const [browserName, browserVersion] = browser.split(" ");
|
||||
const normalizedBrowserName = browserNameMap[browserName];
|
||||
|
||||
if (!normalizedBrowserName) {
|
||||
return all;
|
||||
}
|
||||
|
||||
try {
|
||||
// Browser version can return as "10.0-10.2"
|
||||
const splitVersion = browserVersion.split("-")[0];
|
||||
const parsedBrowserVersion = semverify(splitVersion);
|
||||
|
||||
all[normalizedBrowserName] = semverMin(
|
||||
all[normalizedBrowserName],
|
||||
parsedBrowserVersion,
|
||||
);
|
||||
} catch (e) {}
|
||||
|
||||
return all;
|
||||
}, {});
|
||||
};
|
||||
|
||||
const outputDecimalWarning = (decimalTargets: Array<Object>): void => {
|
||||
if (!decimalTargets || !decimalTargets.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("Warning, the following targets are using a decimal version:");
|
||||
console.log("");
|
||||
decimalTargets.forEach(({ target, value }) =>
|
||||
console.log(` ${target}: ${value}`),
|
||||
);
|
||||
console.log("");
|
||||
console.log(
|
||||
"We recommend using a string for minor/patch versions to avoid numbers like 6.10",
|
||||
);
|
||||
console.log("getting parsed as 6.1, which can lead to unexpected behavior.");
|
||||
console.log("");
|
||||
};
|
||||
|
||||
const targetParserMap = {
|
||||
__default: (target, value) => [target, semverify(value)],
|
||||
|
||||
// Parse `node: true` and `node: "current"` to version
|
||||
node: (target, value) => {
|
||||
const parsed =
|
||||
value === true || value === "current"
|
||||
? process.versions.node
|
||||
: semverify(value);
|
||||
|
||||
return [target, parsed];
|
||||
},
|
||||
};
|
||||
|
||||
type ParsedResult = {
|
||||
targets: Targets,
|
||||
decimalWarnings: Array<Object>,
|
||||
};
|
||||
const getTargets = (targets: Object = {}, options: Object = {}): Targets => {
|
||||
const targetOpts: Targets = {};
|
||||
// Parse browsers target via browserslist;
|
||||
const queryIsValid = isBrowsersQueryValid(targets.browsers);
|
||||
const browsersquery = queryIsValid ? targets.browsers : null;
|
||||
if (queryIsValid || !options.ignoreBrowserslistConfig) {
|
||||
browserslist.defaults = objectToBrowserslist(targets);
|
||||
|
||||
const browsers = browserslist(browsersquery, { path: options.configPath });
|
||||
const queryBrowsers = getLowestVersions(browsers);
|
||||
targets = mergeBrowsers(queryBrowsers, targets);
|
||||
}
|
||||
// Parse remaining targets
|
||||
const parsed = Object.keys(targets)
|
||||
.sort()
|
||||
.reduce(
|
||||
(results: ParsedResult, target: string): ParsedResult => {
|
||||
if (target !== "browsers") {
|
||||
const value = targets[target];
|
||||
|
||||
// Warn when specifying minor/patch as a decimal
|
||||
if (typeof value === "number" && value % 1 !== 0) {
|
||||
results.decimalWarnings.push({ target, value });
|
||||
}
|
||||
|
||||
// Check if we have a target parser?
|
||||
const parser = targetParserMap[target] || targetParserMap.__default;
|
||||
const [parsedTarget, parsedValue] = parser(target, value);
|
||||
|
||||
if (parsedValue) {
|
||||
// Merge (lowest wins)
|
||||
results.targets[parsedTarget] = parsedValue;
|
||||
}
|
||||
}
|
||||
|
||||
return results;
|
||||
},
|
||||
{
|
||||
targets: targetOpts,
|
||||
decimalWarnings: [],
|
||||
},
|
||||
);
|
||||
|
||||
outputDecimalWarning(parsed.decimalWarnings);
|
||||
|
||||
return parsed.targets;
|
||||
};
|
||||
|
||||
export default getTargets;
|
||||
30
experimental/babel-preset-env/src/types.js
Normal file
30
experimental/babel-preset-env/src/types.js
Normal file
@@ -0,0 +1,30 @@
|
||||
//@flow
|
||||
|
||||
// Targets
|
||||
export type Target = string;
|
||||
export type Targets = {
|
||||
[target: string]: Target,
|
||||
};
|
||||
|
||||
// Options
|
||||
// Use explicit modules to prevent typo errors.
|
||||
export type ModuleOption = false | "amd" | "commonjs" | "systemjs" | "umd";
|
||||
export type BuiltInsOption = false | "entry" | "usage";
|
||||
|
||||
export type Options = {
|
||||
configPath: string,
|
||||
debug: boolean,
|
||||
exclude: Array<string>,
|
||||
forceAllTransforms: boolean,
|
||||
ignoreBrowserslistConfig: boolean,
|
||||
include: Array<string>,
|
||||
loose: boolean,
|
||||
modules: ModuleOption,
|
||||
shippedProposals: boolean,
|
||||
spec: boolean,
|
||||
targets: Targets,
|
||||
useBuiltIns: BuiltInsOption,
|
||||
};
|
||||
|
||||
// Babel
|
||||
export type Plugin = [Object, Object];
|
||||
126
experimental/babel-preset-env/src/use-built-ins-entry-plugin.js
Normal file
126
experimental/babel-preset-env/src/use-built-ins-entry-plugin.js
Normal file
@@ -0,0 +1,126 @@
|
||||
//@flow
|
||||
import { logEntryPolyfills } from "./debug";
|
||||
|
||||
type Plugin = {
|
||||
visitor: Object,
|
||||
pre: Function,
|
||||
post: Function,
|
||||
name: string,
|
||||
};
|
||||
|
||||
type RequireType = "require" | "import";
|
||||
|
||||
function isPolyfillSource(value: string): boolean {
|
||||
return value === "babel-polyfill";
|
||||
}
|
||||
|
||||
export default function({ types: t }: { types: Object }): Plugin {
|
||||
function createImportDeclaration(polyfill: string): Object {
|
||||
const declar = t.importDeclaration([], t.stringLiteral(polyfill));
|
||||
declar._blockHoist = 3;
|
||||
return declar;
|
||||
}
|
||||
|
||||
function createRequireStatement(polyfill: string): Object {
|
||||
return t.expressionStatement(
|
||||
t.callExpression(t.identifier("require"), [t.stringLiteral(polyfill)]),
|
||||
);
|
||||
}
|
||||
|
||||
function isRequire(path: Object): boolean {
|
||||
return (
|
||||
t.isExpressionStatement(path.node) &&
|
||||
t.isCallExpression(path.node.expression) &&
|
||||
t.isIdentifier(path.node.expression.callee) &&
|
||||
path.node.expression.callee.name === "require" &&
|
||||
path.node.expression.arguments.length === 1 &&
|
||||
t.isStringLiteral(path.node.expression.arguments[0]) &&
|
||||
isPolyfillSource(path.node.expression.arguments[0].value)
|
||||
);
|
||||
}
|
||||
|
||||
function createImport(
|
||||
polyfill: string,
|
||||
requireType: RequireType,
|
||||
core: ?boolean,
|
||||
): Object {
|
||||
if (core) {
|
||||
polyfill = `babel-polyfill/lib/core-js/modules/${polyfill}`;
|
||||
}
|
||||
|
||||
if (requireType === "import") {
|
||||
return createImportDeclaration(polyfill);
|
||||
}
|
||||
return createRequireStatement(polyfill);
|
||||
}
|
||||
|
||||
function createImports(
|
||||
polyfills: Array<string>,
|
||||
requireType: RequireType,
|
||||
regenerator: boolean,
|
||||
): Array<Object> {
|
||||
const items = Array.isArray(polyfills) ? new Set(polyfills) : polyfills;
|
||||
const imports = [];
|
||||
|
||||
items.forEach(p => imports.push(createImport(p, requireType, true)));
|
||||
|
||||
if (regenerator) {
|
||||
imports.push(
|
||||
createImport(
|
||||
"babel-polyfill/lib/regenerator-runtime/runtime",
|
||||
requireType,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return imports;
|
||||
}
|
||||
|
||||
const isPolyfillImport = {
|
||||
ImportDeclaration(path, state) {
|
||||
if (
|
||||
path.node.specifiers.length === 0 &&
|
||||
isPolyfillSource(path.node.source.value)
|
||||
) {
|
||||
this.importPolyfillIncluded = true;
|
||||
path.replaceWithMultiple(
|
||||
createImports(state.opts.polyfills, "import", state.opts.regenerator),
|
||||
);
|
||||
}
|
||||
},
|
||||
Program(path, state) {
|
||||
path.get("body").forEach(bodyPath => {
|
||||
if (isRequire(bodyPath)) {
|
||||
bodyPath.replaceWithMultiple(
|
||||
createImports(
|
||||
state.opts.polyfills,
|
||||
"require",
|
||||
state.opts.regenerator,
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
name: "transform-polyfill-require",
|
||||
visitor: isPolyfillImport,
|
||||
pre() {
|
||||
this.numPolyfillImports = 0;
|
||||
this.importPolyfillIncluded = false;
|
||||
},
|
||||
post() {
|
||||
const { debug, onDebug, polyfills } = this.opts;
|
||||
|
||||
if (debug) {
|
||||
logEntryPolyfills(
|
||||
this.importPolyfillIncluded,
|
||||
polyfills,
|
||||
this.file.opts.filename,
|
||||
onDebug,
|
||||
);
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
303
experimental/babel-preset-env/src/use-built-ins-plugin.js
Normal file
303
experimental/babel-preset-env/src/use-built-ins-plugin.js
Normal file
@@ -0,0 +1,303 @@
|
||||
//@flow
|
||||
|
||||
import { definitions } from "./built-in-definitions";
|
||||
import { logUsagePolyfills } from "./debug";
|
||||
|
||||
type Plugin = {
|
||||
visitor: Object,
|
||||
pre: Function,
|
||||
name: string,
|
||||
};
|
||||
|
||||
function isPolyfillSource(value: string): boolean {
|
||||
return value === "babel-polyfill";
|
||||
}
|
||||
|
||||
// function warnOnInstanceMethod() {
|
||||
// state.opts.debug &&
|
||||
// console.warn(
|
||||
// `Adding a polyfill: An instance method may have been used: ${details}`,
|
||||
// );
|
||||
// }
|
||||
|
||||
function has(obj: Object, key: string): boolean {
|
||||
return Object.prototype.hasOwnProperty.call(obj, key);
|
||||
}
|
||||
|
||||
// function getObjectString(node: Object): string {
|
||||
// if (node.type === "Identifier") {
|
||||
// return node.name;
|
||||
// } else if (node.type === "MemberExpression") {
|
||||
// return `${getObjectString(node.object)}.${getObjectString(node.property)}`;
|
||||
// }
|
||||
// return node.name;
|
||||
// }
|
||||
|
||||
const modulePathMap = {
|
||||
"regenerator-runtime": "babel-polyfill/lib/regenerator-runtime/runtime",
|
||||
};
|
||||
|
||||
const getModulePath = module => {
|
||||
return (
|
||||
modulePathMap[module] || `babel-polyfill/lib/core-js/modules/${module}`
|
||||
);
|
||||
};
|
||||
|
||||
export default function({ types: t }: { types: Object }): Plugin {
|
||||
function addImport(
|
||||
path: Object,
|
||||
builtIn: string,
|
||||
builtIns: Set<string>,
|
||||
): void {
|
||||
if (builtIn && !builtIns.has(builtIn)) {
|
||||
builtIns.add(builtIn);
|
||||
|
||||
const importDec = t.importDeclaration(
|
||||
[],
|
||||
t.stringLiteral(getModulePath(builtIn)),
|
||||
);
|
||||
|
||||
importDec._blockHoist = 3;
|
||||
const programPath = path.find(path => path.isProgram());
|
||||
programPath.unshiftContainer("body", importDec);
|
||||
}
|
||||
}
|
||||
|
||||
function addUnsupported(
|
||||
path: Object,
|
||||
polyfills: Set<string>,
|
||||
builtIn: Array<string> | string,
|
||||
builtIns: Set<string>,
|
||||
): void {
|
||||
if (Array.isArray(builtIn)) {
|
||||
for (const i of builtIn) {
|
||||
if (polyfills.has(i)) {
|
||||
addImport(path, i, builtIns);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (polyfills.has(builtIn)) {
|
||||
addImport(path, builtIn, builtIns);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function isRequire(path: Object): boolean {
|
||||
return (
|
||||
t.isExpressionStatement(path.node) &&
|
||||
t.isCallExpression(path.node.expression) &&
|
||||
t.isIdentifier(path.node.expression.callee) &&
|
||||
path.node.expression.callee.name === "require" &&
|
||||
path.node.expression.arguments.length === 1 &&
|
||||
t.isStringLiteral(path.node.expression.arguments[0]) &&
|
||||
isPolyfillSource(path.node.expression.arguments[0].value)
|
||||
);
|
||||
}
|
||||
|
||||
const addAndRemovePolyfillImports = {
|
||||
ImportDeclaration(path) {
|
||||
if (
|
||||
path.node.specifiers.length === 0 &&
|
||||
isPolyfillSource(path.node.source.value)
|
||||
) {
|
||||
console.warn(
|
||||
`
|
||||
When setting \`useBuiltIns: 'usage'\`, polyfills are automatically imported when needed.
|
||||
Please remove the \`import 'babel-polyfill'\` call or use \`useBuiltIns: 'entry'\` instead.`,
|
||||
);
|
||||
path.remove();
|
||||
}
|
||||
},
|
||||
Program: {
|
||||
enter(path) {
|
||||
path.get("body").forEach(bodyPath => {
|
||||
if (isRequire(bodyPath)) {
|
||||
console.warn(
|
||||
`
|
||||
When setting \`useBuiltIns: 'usage'\`, polyfills are automatically imported when needed.
|
||||
Please remove the \`require('babel-polyfill')\` call or use \`useBuiltIns: 'entry'\` instead.`,
|
||||
);
|
||||
bodyPath.remove();
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
|
||||
// Symbol()
|
||||
// new Promise
|
||||
ReferencedIdentifier(path, state) {
|
||||
const { node, parent, scope } = path;
|
||||
|
||||
if (t.isMemberExpression(parent)) return;
|
||||
if (!has(definitions.builtins, node.name)) return;
|
||||
if (scope.getBindingIdentifier(node.name)) return;
|
||||
|
||||
const builtIn = definitions.builtins[node.name];
|
||||
addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns);
|
||||
},
|
||||
|
||||
// arr[Symbol.iterator]()
|
||||
CallExpression(path) {
|
||||
// we can't compile this
|
||||
if (path.node.arguments.length) return;
|
||||
|
||||
const callee = path.node.callee;
|
||||
if (!t.isMemberExpression(callee)) return;
|
||||
if (!callee.computed) return;
|
||||
if (!path.get("callee.property").matchesPattern("Symbol.iterator")) {
|
||||
return;
|
||||
}
|
||||
|
||||
addImport(path, "web.dom.iterable", this.builtIns);
|
||||
},
|
||||
|
||||
// Symbol.iterator in arr
|
||||
BinaryExpression(path) {
|
||||
if (path.node.operator !== "in") return;
|
||||
if (!path.get("left").matchesPattern("Symbol.iterator")) return;
|
||||
|
||||
addImport(path, "web.dom.iterable", this.builtIns);
|
||||
},
|
||||
|
||||
// yield*
|
||||
YieldExpression(path) {
|
||||
if (!path.node.delegate) return;
|
||||
|
||||
addImport(path, "web.dom.iterable", this.builtIns);
|
||||
},
|
||||
|
||||
// Array.from
|
||||
MemberExpression: {
|
||||
enter(path, state) {
|
||||
if (!path.isReferenced()) return;
|
||||
|
||||
const { node } = path;
|
||||
const obj = node.object;
|
||||
const prop = node.property;
|
||||
|
||||
if (!t.isReferenced(obj, node)) return;
|
||||
|
||||
// doesn't reference the global
|
||||
if (path.scope.getBindingIdentifier(obj.name)) return;
|
||||
|
||||
if (has(definitions.staticMethods, obj.name)) {
|
||||
const staticMethods = definitions.staticMethods[obj.name];
|
||||
if (has(staticMethods, prop.name)) {
|
||||
const builtIn = staticMethods[prop.name];
|
||||
addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns);
|
||||
// if (obj.name === "Array" && prop.name === "from") {
|
||||
// addImport(
|
||||
// path,
|
||||
// "babel-polyfill/lib/core-js/modules/web.dom.iterable",
|
||||
// this.builtIns,
|
||||
// );
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
!node.computed &&
|
||||
t.isIdentifier(prop) &&
|
||||
has(definitions.instanceMethods, prop.name)
|
||||
) {
|
||||
//warnOnInstanceMethod(state, getObjectString(node));
|
||||
const builtIn = definitions.instanceMethods[prop.name];
|
||||
addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns);
|
||||
} else if (node.computed) {
|
||||
if (
|
||||
t.isStringLiteral(prop) &&
|
||||
has(definitions.instanceMethods, prop.value)
|
||||
) {
|
||||
const builtIn = definitions.instanceMethods[prop.value];
|
||||
//warnOnInstanceMethod(state, `${obj.name}['${prop.value}']`);
|
||||
addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns);
|
||||
} else {
|
||||
const res = path.get("property").evaluate();
|
||||
if (res.confident) {
|
||||
const builtIn = definitions.instanceMethods[res.value];
|
||||
//warnOnInstanceMethod(state, `${obj.name}['${res.value}']`);
|
||||
addUnsupported(
|
||||
path.get("property"),
|
||||
state.opts.polyfills,
|
||||
builtIn,
|
||||
this.builtIns,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// Symbol.match
|
||||
exit(path, state) {
|
||||
if (!path.isReferenced()) return;
|
||||
|
||||
const { node } = path;
|
||||
const obj = node.object;
|
||||
|
||||
if (!has(definitions.builtins, obj.name)) return;
|
||||
if (path.scope.getBindingIdentifier(obj.name)) return;
|
||||
|
||||
const builtIn = definitions.builtins[obj.name];
|
||||
addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns);
|
||||
},
|
||||
},
|
||||
|
||||
// var { repeat, startsWith } = String
|
||||
VariableDeclarator(path, state) {
|
||||
if (!path.isReferenced()) return;
|
||||
|
||||
const { node } = path;
|
||||
const obj = node.init;
|
||||
|
||||
if (!t.isObjectPattern(node.id)) return;
|
||||
const props = node.id.properties;
|
||||
|
||||
if (!t.isReferenced(obj, node)) return;
|
||||
|
||||
// doesn't reference the global
|
||||
if (path.scope.getBindingIdentifier(obj.name)) return;
|
||||
|
||||
for (let prop of props) {
|
||||
prop = prop.key;
|
||||
if (
|
||||
!node.computed &&
|
||||
t.isIdentifier(prop) &&
|
||||
has(definitions.instanceMethods, prop.name)
|
||||
) {
|
||||
// warnOnInstanceMethod(
|
||||
// state,
|
||||
// `${path.parentPath.node.kind} { ${prop.name} } = ${obj.name}`,
|
||||
// );
|
||||
|
||||
const builtIn = definitions.instanceMethods[prop.name];
|
||||
addUnsupported(path, state.opts.polyfills, builtIn, this.builtIns);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Function(path, state) {
|
||||
if (!this.usesRegenerator && (path.node.generator || path.node.async)) {
|
||||
this.usesRegenerator = true;
|
||||
if (state.opts.regenerator) {
|
||||
addImport(path, "regenerator-runtime", this.builtIns);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
name: "use-built-ins",
|
||||
pre() {
|
||||
this.builtIns = new Set();
|
||||
this.usesRegenerator = false;
|
||||
},
|
||||
post() {
|
||||
const { debug, onDebug } = this.opts;
|
||||
|
||||
if (debug) {
|
||||
logUsagePolyfills(this.builtIns, this.file.opts.filename, onDebug);
|
||||
}
|
||||
},
|
||||
visitor: addAndRemovePolyfillImports,
|
||||
};
|
||||
}
|
||||
63
experimental/babel-preset-env/src/utils.js
Normal file
63
experimental/babel-preset-env/src/utils.js
Normal file
@@ -0,0 +1,63 @@
|
||||
// @flow
|
||||
|
||||
import semver from "semver";
|
||||
import type { Targets } from "./types";
|
||||
|
||||
// Convert version to a semver value.
|
||||
// 2.5 -> 2.5.0; 1 -> 1.0.0;
|
||||
export const semverify = (version: string | number): string => {
|
||||
if (typeof version === "string" && semver.valid(version)) {
|
||||
return version;
|
||||
}
|
||||
|
||||
const split = version.toString().split(".");
|
||||
|
||||
while (split.length < 3) {
|
||||
split.push("0");
|
||||
}
|
||||
|
||||
return split.join(".");
|
||||
};
|
||||
|
||||
export const prettifyVersion = (version: string): string => {
|
||||
if (typeof version !== "string") {
|
||||
return version;
|
||||
}
|
||||
|
||||
const parts = [semver.major(version)];
|
||||
const minor = semver.minor(version);
|
||||
const patch = semver.patch(version);
|
||||
|
||||
if (minor || patch) {
|
||||
parts.push(minor);
|
||||
}
|
||||
|
||||
if (patch) {
|
||||
parts.push(patch);
|
||||
}
|
||||
|
||||
return parts.join(".");
|
||||
};
|
||||
|
||||
export const prettifyTargets = (targets: Targets): Object => {
|
||||
return Object.keys(targets).reduce((results, target) => {
|
||||
let value = targets[target];
|
||||
|
||||
if (typeof value === "string") {
|
||||
value = prettifyVersion(value);
|
||||
}
|
||||
|
||||
results[target] = value;
|
||||
return results;
|
||||
}, {});
|
||||
};
|
||||
|
||||
export const filterStageFromList = (list: any, stageList: any) => {
|
||||
return Object.keys(list).reduce((result, item) => {
|
||||
if (!stageList[item]) {
|
||||
result[item] = list[item];
|
||||
}
|
||||
|
||||
return result;
|
||||
}, {});
|
||||
};
|
||||
8
experimental/babel-preset-env/test/.eslintrc
Normal file
8
experimental/babel-preset-env/test/.eslintrc
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"env": {
|
||||
"mocha": true
|
||||
},
|
||||
"rules": {
|
||||
"max-len": 0
|
||||
}
|
||||
}
|
||||
125
experimental/babel-preset-env/test/debug-fixtures.js
Normal file
125
experimental/babel-preset-env/test/debug-fixtures.js
Normal file
@@ -0,0 +1,125 @@
|
||||
const chai = require("chai");
|
||||
const child = require("child_process");
|
||||
const fs = require("fs-extra");
|
||||
const helper = require("babel-helper-fixtures");
|
||||
const path = require("path");
|
||||
|
||||
const fixtureLoc = path.join(__dirname, "debug-fixtures");
|
||||
const tmpLoc = path.join(__dirname, "tmp");
|
||||
|
||||
const clear = () => {
|
||||
process.chdir(__dirname);
|
||||
if (fs.existsSync(tmpLoc)) fs.removeSync(tmpLoc);
|
||||
fs.mkdirSync(tmpLoc);
|
||||
process.chdir(tmpLoc);
|
||||
};
|
||||
|
||||
const saveInFiles = files => {
|
||||
Object.keys(files).forEach(filename => {
|
||||
const content = files[filename];
|
||||
fs.outputFileSync(filename, content);
|
||||
});
|
||||
};
|
||||
|
||||
const testOutputType = (type, stdTarg, opts) => {
|
||||
stdTarg = stdTarg.trim();
|
||||
stdTarg = stdTarg.replace(/\\/g, "/");
|
||||
const optsTarg = opts[type];
|
||||
|
||||
if (optsTarg) {
|
||||
const expectStdout = optsTarg.trim();
|
||||
chai.expect(stdTarg).to.equal(expectStdout, `${type} didn't match`);
|
||||
} else {
|
||||
const file = path.join(opts.testLoc, `${type}.txt`);
|
||||
console.log(`New test file created: ${file}`);
|
||||
fs.outputFileSync(file, stdTarg);
|
||||
}
|
||||
};
|
||||
|
||||
const assertTest = (stdout, stderr, opts) => {
|
||||
testOutputType("stdout", stdout, opts);
|
||||
if (stderr) {
|
||||
testOutputType("stderr", stderr, opts);
|
||||
}
|
||||
};
|
||||
|
||||
const buildTest = opts => {
|
||||
const binLoc = require.resolve("babel-cli/bin/babel");
|
||||
|
||||
return callback => {
|
||||
clear();
|
||||
saveInFiles(opts.inFiles);
|
||||
|
||||
let args = [binLoc];
|
||||
args = args.concat(opts.args);
|
||||
|
||||
const spawn = child.spawn(process.execPath, args);
|
||||
|
||||
let stdout = "";
|
||||
let stderr = "";
|
||||
|
||||
spawn.stdout.on("data", chunk => (stdout += chunk));
|
||||
spawn.stderr.on("data", chunk => (stderr += chunk));
|
||||
|
||||
spawn.on("close", () => {
|
||||
let err;
|
||||
|
||||
try {
|
||||
assertTest(stdout, stderr, opts);
|
||||
} catch (e) {
|
||||
err = e;
|
||||
}
|
||||
|
||||
callback(err);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
describe("debug output", () => {
|
||||
fs.readdirSync(fixtureLoc).forEach(testName => {
|
||||
if (testName.slice(0, 1) === ".") return;
|
||||
const testLoc = path.join(fixtureLoc, testName);
|
||||
if (testName.slice(0, 1) === ".") return;
|
||||
|
||||
const opts = {
|
||||
args: ["src", "--out-dir", "lib"],
|
||||
testLoc: testLoc,
|
||||
};
|
||||
|
||||
const stdoutLoc = path.join(testLoc, "stdout.txt");
|
||||
const stderrLoc = path.join(testLoc, "stderr.txt");
|
||||
|
||||
if (fs.existsSync(stdoutLoc)) {
|
||||
opts.stdout = helper.readFile(stdoutLoc);
|
||||
}
|
||||
|
||||
if (fs.existsSync(stderrLoc)) {
|
||||
opts.stderr = helper.readFile(stderrLoc);
|
||||
}
|
||||
|
||||
const optionsLoc = path.join(testLoc, "options.json");
|
||||
|
||||
if (!fs.existsSync(optionsLoc)) {
|
||||
throw new Error(
|
||||
`Debug test '${testName}' is missing an options.json file`,
|
||||
);
|
||||
}
|
||||
|
||||
const inFilesFolderLoc = path.join(testLoc, "in");
|
||||
|
||||
opts.inFiles = {
|
||||
".babelrc": helper.readFile(optionsLoc),
|
||||
};
|
||||
|
||||
if (!fs.existsSync(inFilesFolderLoc)) {
|
||||
opts.inFiles["src/in.js"] = "";
|
||||
} else {
|
||||
fs.readdirSync(inFilesFolderLoc).forEach(filename => {
|
||||
opts.inFiles[`src/${filename}`] = helper.readFile(
|
||||
path.join(inFilesFolderLoc, filename),
|
||||
);
|
||||
});
|
||||
}
|
||||
it(testName, buildTest(opts));
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
import 'babel-polyfill';
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../lib", {
|
||||
"debug": true,
|
||||
"targets": {
|
||||
"browsers": [ "Android >= 4" ]
|
||||
},
|
||||
"useBuiltIns": "entry"
|
||||
}]
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
babel-preset-env: `DEBUG` option
|
||||
|
||||
Using targets:
|
||||
{
|
||||
"android": "4"
|
||||
}
|
||||
|
||||
Using modules transform: commonjs
|
||||
|
||||
Using plugins:
|
||||
check-es2015-constants { "android":"4" }
|
||||
transform-es2015-arrow-functions { "android":"4" }
|
||||
transform-es2015-block-scoped-functions { "android":"4" }
|
||||
transform-es2015-block-scoping { "android":"4" }
|
||||
transform-es2015-classes { "android":"4" }
|
||||
transform-es2015-computed-properties { "android":"4" }
|
||||
transform-es2015-destructuring { "android":"4" }
|
||||
transform-es2015-duplicate-keys { "android":"4" }
|
||||
transform-es2015-for-of { "android":"4" }
|
||||
transform-es2015-function-name { "android":"4" }
|
||||
transform-es2015-literals { "android":"4" }
|
||||
transform-es2015-object-super { "android":"4" }
|
||||
transform-es2015-parameters { "android":"4" }
|
||||
transform-es2015-shorthand-properties { "android":"4" }
|
||||
transform-es2015-spread { "android":"4" }
|
||||
transform-es2015-sticky-regex { "android":"4" }
|
||||
transform-es2015-template-literals { "android":"4" }
|
||||
transform-es2015-typeof-symbol { "android":"4" }
|
||||
transform-es2015-unicode-regex { "android":"4" }
|
||||
transform-new-target { "android":"4" }
|
||||
transform-regenerator { "android":"4" }
|
||||
transform-exponentiation-operator { "android":"4" }
|
||||
transform-async-to-generator { "android":"4" }
|
||||
syntax-trailing-function-commas { "android":"4" }
|
||||
|
||||
Using polyfills with `entry` option:
|
||||
|
||||
[src/in.js] Replaced `babel-polyfill` with the following polyfills:
|
||||
es6.typed.array-buffer { "android":"4" }
|
||||
es6.typed.int8-array { "android":"4" }
|
||||
es6.typed.uint8-array { "android":"4" }
|
||||
es6.typed.uint8-clamped-array { "android":"4" }
|
||||
es6.typed.int16-array { "android":"4" }
|
||||
es6.typed.uint16-array { "android":"4" }
|
||||
es6.typed.int32-array { "android":"4" }
|
||||
es6.typed.uint32-array { "android":"4" }
|
||||
es6.typed.float32-array { "android":"4" }
|
||||
es6.typed.float64-array { "android":"4" }
|
||||
es6.map { "android":"4" }
|
||||
es6.set { "android":"4" }
|
||||
es6.weak-map { "android":"4" }
|
||||
es6.weak-set { "android":"4" }
|
||||
es6.reflect.apply { "android":"4" }
|
||||
es6.reflect.construct { "android":"4" }
|
||||
es6.reflect.define-property { "android":"4" }
|
||||
es6.reflect.delete-property { "android":"4" }
|
||||
es6.reflect.get { "android":"4" }
|
||||
es6.reflect.get-own-property-descriptor { "android":"4" }
|
||||
es6.reflect.get-prototype-of { "android":"4" }
|
||||
es6.reflect.has { "android":"4" }
|
||||
es6.reflect.is-extensible { "android":"4" }
|
||||
es6.reflect.own-keys { "android":"4" }
|
||||
es6.reflect.prevent-extensions { "android":"4" }
|
||||
es6.reflect.set { "android":"4" }
|
||||
es6.reflect.set-prototype-of { "android":"4" }
|
||||
es6.promise { "android":"4" }
|
||||
es6.symbol { "android":"4" }
|
||||
es6.object.assign { "android":"4" }
|
||||
es6.object.is { "android":"4" }
|
||||
es6.object.set-prototype-of { "android":"4" }
|
||||
es6.function.name { "android":"4" }
|
||||
es6.string.raw { "android":"4" }
|
||||
es6.string.from-code-point { "android":"4" }
|
||||
es6.string.code-point-at { "android":"4" }
|
||||
es6.string.repeat { "android":"4" }
|
||||
es6.string.starts-with { "android":"4" }
|
||||
es6.string.ends-with { "android":"4" }
|
||||
es6.string.includes { "android":"4" }
|
||||
es6.regexp.flags { "android":"4" }
|
||||
es6.regexp.match { "android":"4" }
|
||||
es6.regexp.replace { "android":"4" }
|
||||
es6.regexp.split { "android":"4" }
|
||||
es6.regexp.search { "android":"4" }
|
||||
es6.array.from { "android":"4" }
|
||||
es6.array.of { "android":"4" }
|
||||
es6.array.copy-within { "android":"4" }
|
||||
es6.array.find { "android":"4" }
|
||||
es6.array.find-index { "android":"4" }
|
||||
es6.array.fill { "android":"4" }
|
||||
es6.array.iterator { "android":"4" }
|
||||
es6.number.is-finite { "android":"4" }
|
||||
es6.number.is-integer { "android":"4" }
|
||||
es6.number.is-safe-integer { "android":"4" }
|
||||
es6.number.is-nan { "android":"4" }
|
||||
es6.number.epsilon { "android":"4" }
|
||||
es6.number.min-safe-integer { "android":"4" }
|
||||
es6.number.max-safe-integer { "android":"4" }
|
||||
es6.number.parse-float { "android":"4" }
|
||||
es6.number.parse-int { "android":"4" }
|
||||
es6.math.acosh { "android":"4" }
|
||||
es6.math.asinh { "android":"4" }
|
||||
es6.math.atanh { "android":"4" }
|
||||
es6.math.cbrt { "android":"4" }
|
||||
es6.math.clz32 { "android":"4" }
|
||||
es6.math.cosh { "android":"4" }
|
||||
es6.math.expm1 { "android":"4" }
|
||||
es6.math.fround { "android":"4" }
|
||||
es6.math.hypot { "android":"4" }
|
||||
es6.math.imul { "android":"4" }
|
||||
es6.math.log1p { "android":"4" }
|
||||
es6.math.log10 { "android":"4" }
|
||||
es6.math.log2 { "android":"4" }
|
||||
es6.math.sign { "android":"4" }
|
||||
es6.math.sinh { "android":"4" }
|
||||
es6.math.tanh { "android":"4" }
|
||||
es6.math.trunc { "android":"4" }
|
||||
es7.array.includes { "android":"4" }
|
||||
es7.object.values { "android":"4" }
|
||||
es7.object.entries { "android":"4" }
|
||||
es7.object.get-own-property-descriptors { "android":"4" }
|
||||
es7.string.pad-start { "android":"4" }
|
||||
es7.string.pad-end { "android":"4" }
|
||||
web.timers { "android":"4" }
|
||||
web.immediate { "android":"4" }
|
||||
web.dom.iterable { "android":"4" }
|
||||
src/in.js -> lib/in.js
|
||||
@@ -0,0 +1 @@
|
||||
function hasAnyoneSeenImportBabelPolyfill() { return false };
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../lib", {
|
||||
"debug": true,
|
||||
"targets": {
|
||||
"node": 6
|
||||
},
|
||||
"useBuiltIns": "entry"
|
||||
}]
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
babel-preset-env: `DEBUG` option
|
||||
|
||||
Using targets:
|
||||
{
|
||||
"node": "6"
|
||||
}
|
||||
|
||||
Using modules transform: commonjs
|
||||
|
||||
Using plugins:
|
||||
transform-es2015-destructuring { "node":"6" }
|
||||
transform-es2015-for-of { "node":"6" }
|
||||
transform-es2015-function-name { "node":"6" }
|
||||
transform-exponentiation-operator { "node":"6" }
|
||||
transform-async-to-generator { "node":"6" }
|
||||
syntax-trailing-function-commas { "node":"6" }
|
||||
|
||||
Using polyfills with `entry` option:
|
||||
|
||||
[src/in.js] `import 'babel-polyfill'` was not found.
|
||||
src/in.js -> lib/in.js
|
||||
@@ -0,0 +1 @@
|
||||
import 'babel-polyfill';
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../lib", {
|
||||
"debug": true,
|
||||
"targets": {
|
||||
"chrome": 55,
|
||||
"uglify": true
|
||||
},
|
||||
"useBuiltIns": "entry",
|
||||
"modules": false
|
||||
}]
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
The uglify target has been deprecated. Set the top level
|
||||
option `forceAllTransforms: true` instead.
|
||||
|
||||
babel-preset-env: `DEBUG` option
|
||||
|
||||
Using targets:
|
||||
{
|
||||
"chrome": "55"
|
||||
}
|
||||
|
||||
Using modules transform: false
|
||||
|
||||
Using plugins:
|
||||
check-es2015-constants {}
|
||||
transform-es2015-arrow-functions {}
|
||||
transform-es2015-block-scoped-functions {}
|
||||
transform-es2015-block-scoping {}
|
||||
transform-es2015-classes {}
|
||||
transform-es2015-computed-properties {}
|
||||
transform-es2015-destructuring {}
|
||||
transform-es2015-duplicate-keys {}
|
||||
transform-es2015-for-of {}
|
||||
transform-es2015-function-name {}
|
||||
transform-es2015-literals {}
|
||||
transform-es2015-object-super {}
|
||||
transform-es2015-parameters {}
|
||||
transform-es2015-shorthand-properties {}
|
||||
transform-es2015-spread {}
|
||||
transform-es2015-sticky-regex {}
|
||||
transform-es2015-template-literals {}
|
||||
transform-es2015-typeof-symbol {}
|
||||
transform-es2015-unicode-regex {}
|
||||
transform-new-target {}
|
||||
transform-regenerator {}
|
||||
transform-exponentiation-operator {}
|
||||
transform-async-to-generator {}
|
||||
syntax-trailing-function-commas { "chrome":"55" }
|
||||
|
||||
Using polyfills with `entry` option:
|
||||
|
||||
[src/in.js] Replaced `babel-polyfill` with the following polyfills:
|
||||
es7.string.pad-start { "chrome":"55" }
|
||||
es7.string.pad-end { "chrome":"55" }
|
||||
web.timers { "chrome":"55" }
|
||||
web.immediate { "chrome":"55" }
|
||||
web.dom.iterable { "chrome":"55" }
|
||||
src/in.js -> lib/in.js
|
||||
@@ -0,0 +1 @@
|
||||
import 'babel-polyfill';
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"presets": [
|
||||
["../../lib", {
|
||||
"debug": true,
|
||||
"targets": {
|
||||
"browsers": "chrome >= 54, ie 10",
|
||||
"node": 6
|
||||
},
|
||||
"useBuiltIns": "entry"
|
||||
}]
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
babel-preset-env: `DEBUG` option
|
||||
|
||||
Using targets:
|
||||
{
|
||||
"chrome": "54",
|
||||
"ie": "10",
|
||||
"node": "6"
|
||||
}
|
||||
|
||||
Using modules transform: commonjs
|
||||
|
||||
Using plugins:
|
||||
check-es2015-constants { "ie":"10" }
|
||||
transform-es2015-arrow-functions { "ie":"10" }
|
||||
transform-es2015-block-scoped-functions { "ie":"10" }
|
||||
transform-es2015-block-scoping { "ie":"10" }
|
||||
transform-es2015-classes { "ie":"10" }
|
||||
transform-es2015-computed-properties { "ie":"10" }
|
||||
transform-es2015-destructuring { "ie":"10", "node":"6" }
|
||||
transform-es2015-duplicate-keys { "ie":"10" }
|
||||
transform-es2015-for-of { "ie":"10", "node":"6" }
|
||||
transform-es2015-function-name { "ie":"10", "node":"6" }
|
||||
transform-es2015-literals { "ie":"10" }
|
||||
transform-es2015-object-super { "ie":"10" }
|
||||
transform-es2015-parameters { "ie":"10" }
|
||||
transform-es2015-shorthand-properties { "ie":"10" }
|
||||
transform-es2015-spread { "ie":"10" }
|
||||
transform-es2015-sticky-regex { "ie":"10" }
|
||||
transform-es2015-template-literals { "ie":"10" }
|
||||
transform-es2015-typeof-symbol { "ie":"10" }
|
||||
transform-es2015-unicode-regex { "ie":"10" }
|
||||
transform-new-target { "ie":"10" }
|
||||
transform-regenerator { "ie":"10" }
|
||||
transform-exponentiation-operator { "ie":"10", "node":"6" }
|
||||
transform-async-to-generator { "chrome":"54", "ie":"10", "node":"6" }
|
||||
syntax-trailing-function-commas { "chrome":"54", "ie":"10", "node":"6" }
|
||||
|
||||
Using polyfills with `entry` option:
|
||||
|
||||
[src/in.js] Replaced `babel-polyfill` with the following polyfills:
|
||||
es6.typed.array-buffer { "ie":"10", "node":"6" }
|
||||
es6.typed.int8-array { "ie":"10", "node":"6" }
|
||||
es6.typed.uint8-array { "ie":"10", "node":"6" }
|
||||
es6.typed.uint8-clamped-array { "ie":"10", "node":"6" }
|
||||
es6.typed.int16-array { "ie":"10", "node":"6" }
|
||||
es6.typed.uint16-array { "ie":"10", "node":"6" }
|
||||
es6.typed.int32-array { "ie":"10", "node":"6" }
|
||||
es6.typed.uint32-array { "ie":"10", "node":"6" }
|
||||
es6.typed.float32-array { "ie":"10", "node":"6" }
|
||||
es6.typed.float64-array { "ie":"10", "node":"6" }
|
||||
es6.map { "ie":"10", "node":"6" }
|
||||
es6.set { "ie":"10", "node":"6" }
|
||||
es6.weak-map { "ie":"10", "node":"6" }
|
||||
es6.weak-set { "ie":"10", "node":"6" }
|
||||
es6.reflect.apply { "ie":"10" }
|
||||
es6.reflect.construct { "ie":"10" }
|
||||
es6.reflect.define-property { "ie":"10" }
|
||||
es6.reflect.delete-property { "ie":"10" }
|
||||
es6.reflect.get { "ie":"10" }
|
||||
es6.reflect.get-own-property-descriptor { "ie":"10" }
|
||||
es6.reflect.get-prototype-of { "ie":"10" }
|
||||
es6.reflect.has { "ie":"10" }
|
||||
es6.reflect.is-extensible { "ie":"10" }
|
||||
es6.reflect.own-keys { "ie":"10" }
|
||||
es6.reflect.prevent-extensions { "ie":"10" }
|
||||
es6.reflect.set { "ie":"10" }
|
||||
es6.reflect.set-prototype-of { "ie":"10" }
|
||||
es6.promise { "ie":"10", "node":"6" }
|
||||
es6.symbol { "ie":"10", "node":"6" }
|
||||
es6.object.assign { "ie":"10" }
|
||||
es6.object.is { "ie":"10" }
|
||||
es6.object.set-prototype-of { "ie":"10" }
|
||||
es6.function.name { "ie":"10", "node":"6" }
|
||||
es6.string.raw { "ie":"10" }
|
||||
es6.string.from-code-point { "ie":"10" }
|
||||
es6.string.code-point-at { "ie":"10" }
|
||||
es6.string.repeat { "ie":"10" }
|
||||
es6.string.starts-with { "ie":"10" }
|
||||
es6.string.ends-with { "ie":"10" }
|
||||
es6.string.includes { "ie":"10" }
|
||||
es6.regexp.flags { "ie":"10" }
|
||||
es6.regexp.match { "ie":"10" }
|
||||
es6.regexp.replace { "ie":"10" }
|
||||
es6.regexp.split { "ie":"10" }
|
||||
es6.regexp.search { "ie":"10" }
|
||||
es6.array.from { "ie":"10", "node":"6" }
|
||||
es6.array.of { "ie":"10" }
|
||||
es6.array.copy-within { "ie":"10" }
|
||||
es6.array.find { "ie":"10" }
|
||||
es6.array.find-index { "ie":"10" }
|
||||
es6.array.fill { "ie":"10" }
|
||||
es6.array.iterator { "ie":"10" }
|
||||
es6.number.is-finite { "ie":"10" }
|
||||
es6.number.is-integer { "ie":"10" }
|
||||
es6.number.is-safe-integer { "ie":"10" }
|
||||
es6.number.is-nan { "ie":"10" }
|
||||
es6.number.epsilon { "ie":"10" }
|
||||
es6.number.min-safe-integer { "ie":"10" }
|
||||
es6.number.max-safe-integer { "ie":"10" }
|
||||
es6.number.parse-float { "ie":"10" }
|
||||
es6.number.parse-int { "ie":"10" }
|
||||
es6.math.acosh { "ie":"10" }
|
||||
es6.math.asinh { "ie":"10" }
|
||||
es6.math.atanh { "ie":"10" }
|
||||
es6.math.cbrt { "ie":"10" }
|
||||
es6.math.clz32 { "ie":"10" }
|
||||
es6.math.cosh { "ie":"10" }
|
||||
es6.math.expm1 { "ie":"10" }
|
||||
es6.math.fround { "ie":"10" }
|
||||
es6.math.hypot { "ie":"10" }
|
||||
es6.math.imul { "ie":"10" }
|
||||
es6.math.log1p { "ie":"10" }
|
||||
es6.math.log10 { "ie":"10" }
|
||||
es6.math.log2 { "ie":"10" }
|
||||
es6.math.sign { "ie":"10" }
|
||||
es6.math.sinh { "ie":"10" }
|
||||
es6.math.tanh { "ie":"10" }
|
||||
es6.math.trunc { "ie":"10" }
|
||||
es7.array.includes { "ie":"10" }
|
||||
es7.object.values { "ie":"10", "node":"6" }
|
||||
es7.object.entries { "ie":"10", "node":"6" }
|
||||
es7.object.get-own-property-descriptors { "ie":"10", "node":"6" }
|
||||
es7.string.pad-start { "chrome":"54", "ie":"10", "node":"6" }
|
||||
es7.string.pad-end { "chrome":"54", "ie":"10", "node":"6" }
|
||||
web.timers { "chrome":"54", "ie":"10", "node":"6" }
|
||||
web.immediate { "chrome":"54", "ie":"10", "node":"6" }
|
||||
web.dom.iterable { "chrome":"54", "ie":"10", "node":"6" }
|
||||
src/in.js -> lib/in.js
|
||||
@@ -0,0 +1 @@
|
||||
import 'babel-polyfill';
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user