Compare commits
768 Commits
v7.1.4
...
initialize
| Author | SHA1 | Date | |
|---|---|---|---|
| 4fd9f6e6a2 | |||
| 08550a076c | |||
| d50037be8f | |||
| fd2c2f61bb | |||
| 0e5c224ff1 | |||
| b0b6a92b90 | |||
| a5c141ea85 | |||
| e488c32244 | |||
| 0febc4f55f | |||
| 5415a390a9 | |||
| 7dd772001d | |||
| d314e28457 | |||
| b248b3f4e9 | |||
| c8c6ff7c4c | |||
|
|
8e5f2dc929 | ||
|
|
2b082601a7 | ||
|
|
70c0ed512a | ||
|
|
8c2ed89aaa | ||
|
|
e315d65a7a | ||
|
|
0287c0f02f | ||
|
|
c2bace4b73 | ||
|
|
35f4d12763 | ||
|
|
9082e68d6f | ||
|
|
bdb4318f47 | ||
|
|
3ab035bab6 | ||
|
|
2cd5ad0c80 | ||
|
|
2640e5a27c | ||
|
|
0f949990c3 | ||
|
|
f544753bb8 | ||
|
|
d3db02da30 | ||
|
|
42c8e0fb2f | ||
|
|
bf48fca6a0 | ||
|
|
f8eb290da1 | ||
|
|
5f2240e7ab | ||
|
|
97faa83953 | ||
|
|
cdbffe3990 | ||
|
|
b114486bc1 | ||
|
|
e9c1bce50f | ||
|
|
87feda7c2a | ||
|
|
d25262ec4b | ||
|
|
861844761f | ||
|
|
43aa7e262c | ||
|
|
5e24016623 | ||
|
|
d023e105b7 | ||
|
|
abce0ef49d | ||
|
|
5c0d8a9de7 | ||
|
|
bea1b0d0af | ||
|
|
58a646be59 | ||
|
|
c7d8b8a377 | ||
|
|
d08702c9d2 | ||
|
|
a2b5437b01 | ||
|
|
0b0edc3e3d | ||
|
|
e419e5fe42 | ||
|
|
4e6a4b08bb | ||
|
|
3d2f365074 | ||
|
|
8ffca0475a | ||
|
|
ec3345bb57 | ||
|
|
4b3a19ea9f | ||
|
|
198b4a0fbd | ||
|
|
143d159982 | ||
|
|
63f9a3c946 | ||
|
|
3a5e8a8dd4 | ||
|
|
38a3063111 | ||
|
|
4cd93ab5f3 | ||
|
|
d248e2d188 | ||
|
|
f47fbd5f39 | ||
|
|
be0fcaaf49 | ||
|
|
4e5ac1fd5c | ||
|
|
1d1fab4ea2 | ||
|
|
f1bc6c4e18 | ||
|
|
b6ef9689b2 | ||
|
|
01927babe2 | ||
|
|
9ada30c207 | ||
|
|
43065a9e24 | ||
|
|
fce1b74105 | ||
|
|
562b6c3bbb | ||
|
|
1770dace34 | ||
|
|
5b40845afe | ||
|
|
fe258dec04 | ||
|
|
78cd63d9cf | ||
|
|
43b623c1f1 | ||
|
|
b5b8055cc0 | ||
|
|
da9c9a64c2 | ||
|
|
8c94b3f209 | ||
|
|
095f28a913 | ||
|
|
487f10f84d | ||
|
|
5800fc97b3 | ||
|
|
2254542010 | ||
|
|
d234ff6572 | ||
|
|
800eccc046 | ||
|
|
cd5d3abc32 | ||
|
|
272d85d0ad | ||
|
|
686186cabc | ||
|
|
06313a6288 | ||
|
|
dcf7d89b8e | ||
|
|
1b19608a5a | ||
|
|
e28c8ac612 | ||
|
|
99035ca96e | ||
|
|
c455d2af86 | ||
|
|
a422ea64ee | ||
|
|
34d30e28d6 | ||
|
|
3ad4c70d3a | ||
|
|
34937f13d5 | ||
|
|
c7add11fdc | ||
|
|
d329156ebc | ||
|
|
25b35261ca | ||
|
|
563874c06c | ||
|
|
b0acfb24dd | ||
|
|
599d2ff324 | ||
|
|
0856618ed5 | ||
|
|
bc0966a46f | ||
|
|
3498195ae2 | ||
|
|
fbf3cb0ac4 | ||
|
|
e6264a0992 | ||
|
|
0b37ab0362 | ||
|
|
57ae306457 | ||
|
|
fa5a40c8d5 | ||
|
|
a219b6de7a | ||
|
|
fa5057f9fb | ||
|
|
02f2d17e83 | ||
|
|
b351f29033 | ||
|
|
298c9a6c33 | ||
|
|
80d99b4d4e | ||
|
|
94fcabc4e3 | ||
|
|
5f1970433d | ||
|
|
b459f6a0a4 | ||
|
|
66062c2a8c | ||
|
|
8d4f95de45 | ||
|
|
d0f093e716 | ||
|
|
490798a26d | ||
|
|
eaa1474541 | ||
|
|
0e9502685a | ||
|
|
26be14b24d | ||
|
|
6f3460c767 | ||
|
|
cc080417b9 | ||
|
|
a00f371610 | ||
|
|
af66d521bd | ||
|
|
b9cb4af953 | ||
|
|
69d00dc5b0 | ||
|
|
f339d2d034 | ||
|
|
3069747a81 | ||
|
|
962015f7e7 | ||
|
|
b7333ea97a | ||
|
|
46c70ad734 | ||
|
|
3a7b6e1c22 | ||
|
|
9c1ad0a9f7 | ||
|
|
87dc201411 | ||
|
|
0ef4972295 | ||
|
|
cb881e6b3f | ||
|
|
45a484f0a2 | ||
|
|
99f4f6c3b0 | ||
|
|
e4b4831100 | ||
|
|
256fa5aa04 | ||
|
|
0ee2c42b55 | ||
|
|
1b352ca8a1 | ||
|
|
53af9e8b7a | ||
|
|
af04f40ee0 | ||
|
|
98b14843ba | ||
|
|
4395c22f3a | ||
|
|
610d6bdc62 | ||
|
|
8027dca501 | ||
|
|
81831032c3 | ||
|
|
daf25af47c | ||
|
|
6a5cee8f27 | ||
|
|
2096d0cfcb | ||
|
|
a79fbe62e4 | ||
|
|
381b066bd0 | ||
|
|
15b63bc89e | ||
|
|
fc8e14264c | ||
|
|
7e4f48139c | ||
|
|
cbd5a26e57 | ||
|
|
42e5974fd4 | ||
|
|
735abc0ed8 | ||
|
|
aa7678f32a | ||
|
|
b64cb9aaf1 | ||
|
|
8da9d8b4b8 | ||
|
|
3e4889d649 | ||
|
|
da0af5fd99 | ||
|
|
b02e35c19a | ||
|
|
3e8a5c5e28 | ||
|
|
8769903284 | ||
|
|
5c859b1117 | ||
|
|
2e7bea4a6a | ||
|
|
29734b924a | ||
|
|
6813ee02d7 | ||
|
|
fcb77de901 | ||
|
|
d05bd9edc8 | ||
|
|
27ba292774 | ||
|
|
a08e856804 | ||
|
|
c0e3fa0081 | ||
|
|
e5afa57cca | ||
|
|
e7fa566442 | ||
|
|
7c0333e12a | ||
|
|
8a775a32ba | ||
|
|
94e47c30a9 | ||
|
|
1664cce681 | ||
|
|
a2bf68981f | ||
|
|
15aa511b8e | ||
|
|
11ed2e2bf5 | ||
|
|
eb3767d58b | ||
|
|
f0c2364d01 | ||
|
|
ee344c3e4c | ||
|
|
64041e1669 | ||
|
|
469a5a71cd | ||
|
|
75090f10e5 | ||
|
|
22df2ae244 | ||
|
|
051965052c | ||
|
|
ee397ff107 | ||
|
|
15535cf52c | ||
|
|
682d9f9f09 | ||
|
|
a112be2fa0 | ||
|
|
9ec26a7d3e | ||
|
|
ba2c0f7adf | ||
|
|
5fb4d84a33 | ||
|
|
3e4a9d588b | ||
|
|
be2cbde560 | ||
|
|
66727632e8 | ||
|
|
ba28f462bc | ||
|
|
f08062b1de | ||
|
|
4f0840ab88 | ||
|
|
6a9d2538e0 | ||
|
|
f160522ab0 | ||
|
|
4d30379d36 | ||
|
|
4d12c8971b | ||
|
|
4506590557 | ||
|
|
1e7ed5c461 | ||
|
|
fced5cea43 | ||
|
|
9bc9571381 | ||
|
|
fb910e063c | ||
|
|
3b4a86aea4 | ||
|
|
94b678c949 | ||
|
|
c84a4c8bfa | ||
|
|
dfd59c183e | ||
|
|
718017d896 | ||
|
|
a0cb7b1ab1 | ||
|
|
0b886418c8 | ||
|
|
0371979a3e | ||
|
|
0407f034f0 | ||
|
|
d919ecd254 | ||
|
|
d8da63c929 | ||
|
|
eb3230f9db | ||
|
|
7dc5fdb390 | ||
|
|
ee68d6d1b0 | ||
|
|
d3fe22f0e1 | ||
|
|
7f47cb65d0 | ||
|
|
8b9af1be2f | ||
|
|
f5ca0587d1 | ||
|
|
a9660cf559 | ||
|
|
8107a6faa2 | ||
|
|
42000b9907 | ||
|
|
5d9a786b2f | ||
|
|
e88a569e83 | ||
|
|
4eab157502 | ||
|
|
a9a7f4e690 | ||
|
|
fa5ec75c43 | ||
|
|
b961d39a4d | ||
|
|
759ff4d6df | ||
|
|
9e65472377 | ||
|
|
25f040caa4 | ||
|
|
0dbf99bedb | ||
|
|
f48b47c1f7 | ||
|
|
406a65c894 | ||
|
|
075a50242d | ||
|
|
c777e81e06 | ||
|
|
d0519fa907 | ||
|
|
019fbca3f6 | ||
|
|
24dde2e8e8 | ||
|
|
bff79e198a | ||
|
|
106bb41d47 | ||
|
|
d19f053482 | ||
|
|
49da9a07c8 | ||
|
|
b06663320e | ||
|
|
d50e78d45b | ||
|
|
5b86353b35 | ||
|
|
f588e4ec47 | ||
|
|
cbb482e2f9 | ||
|
|
595a349174 | ||
|
|
0bf0ae3410 | ||
|
|
ef3f555be9 | ||
|
|
38f8bbac1a | ||
|
|
a4170b5e32 | ||
|
|
6b8a37c413 | ||
|
|
0a98814329 | ||
|
|
8bf9714d69 | ||
|
|
ca67637da4 | ||
|
|
77fd7cd4c4 | ||
|
|
1d3f9815df | ||
|
|
31fc1d06bc | ||
|
|
b8bb93a838 | ||
|
|
8f8a457798 | ||
|
|
11fa2461ce | ||
|
|
505b2cc18d | ||
|
|
dcdf7c8fdd | ||
|
|
fdbbb743b6 | ||
|
|
6852bf6415 | ||
|
|
f92c2ae830 | ||
|
|
d7801c644c | ||
|
|
84961ebb05 | ||
|
|
3144ed131a | ||
|
|
ce4c374924 | ||
|
|
8d492b159b | ||
|
|
b4c9cb0222 | ||
|
|
a596da2822 | ||
|
|
1cfb92d66a | ||
|
|
888b9f6940 | ||
|
|
b6486a22cb | ||
|
|
a6392bd636 | ||
|
|
9dd8825eff | ||
|
|
ecf4667305 | ||
|
|
87fb6c4a8b | ||
|
|
58cf1a7d48 | ||
|
|
c96aef17e1 | ||
|
|
fc38638aeb | ||
|
|
33ab4f1661 | ||
|
|
54d257c105 | ||
|
|
9c06e4ed4d | ||
|
|
f5b8140580 | ||
|
|
0430a48775 | ||
|
|
45ca6751fa | ||
|
|
b1826bf0a0 | ||
|
|
2080042808 | ||
|
|
3f0590de2a | ||
|
|
5661de5908 | ||
|
|
c2d303f8be | ||
|
|
4da7a01aa9 | ||
|
|
47eb1ddfe0 | ||
|
|
9febf63882 | ||
|
|
85432e2c44 | ||
|
|
1969e6b6aa | ||
|
|
7942dc0f07 | ||
|
|
354666aa17 | ||
|
|
9e9b62f77a | ||
|
|
5da94bff87 | ||
|
|
eae7a33316 | ||
|
|
16e17c560b | ||
|
|
555d50a08c | ||
|
|
18ace84b88 | ||
|
|
2c88694388 | ||
|
|
4b8546c07d | ||
|
|
c5b5c83398 | ||
|
|
277a2620c6 | ||
|
|
ca3c53ae0b | ||
|
|
71013088ef | ||
|
|
80a5a2e7dd | ||
|
|
8ca323e810 | ||
|
|
30d507c915 | ||
|
|
293f3c98d2 | ||
|
|
cf3668779c | ||
|
|
d7757f6d08 | ||
|
|
bf17871b82 | ||
|
|
4198d91b89 | ||
|
|
338853b5d3 | ||
|
|
8ca99b9f09 | ||
|
|
66be4aa5e3 | ||
|
|
f31c72f310 | ||
|
|
e4072752bc | ||
|
|
165ef29416 | ||
|
|
b4224ed8f3 | ||
|
|
9f5f688385 | ||
|
|
3edd4e1a82 | ||
|
|
f994d6f3ae | ||
|
|
508fde4009 | ||
|
|
e82169dcab | ||
|
|
00cae77ec7 | ||
|
|
e03eb17c08 | ||
|
|
9a8a7316ae | ||
|
|
557a8af3bc | ||
|
|
53e0622b54 | ||
|
|
17e10509c0 | ||
|
|
491b0a8e33 | ||
|
|
bac2781a20 | ||
|
|
c7587c016e | ||
|
|
123fdfd314 | ||
|
|
3c11a4a930 | ||
|
|
ae9b25ac69 | ||
|
|
1f5444e96a | ||
|
|
f7bfc774ba | ||
|
|
72161a64b2 | ||
|
|
60d7e940e2 | ||
|
|
6bc9e7ebda | ||
|
|
7f4427432c | ||
|
|
2867bbf195 | ||
|
|
444daf9224 | ||
|
|
d720c6cfff | ||
|
|
aaefc83a6c | ||
|
|
3aaafae053 | ||
|
|
ff04d3535c | ||
|
|
a559397feb | ||
|
|
d610289812 | ||
|
|
adb4701e00 | ||
|
|
ef0722b4b2 | ||
|
|
419d8052d3 | ||
|
|
998024e913 | ||
|
|
596eedd3e7 | ||
|
|
e93cd9ff50 | ||
|
|
7dea0f23de | ||
|
|
de7dd7f015 | ||
|
|
f2c55d01c4 | ||
|
|
2201fd839b | ||
|
|
7f8ded9851 | ||
|
|
bf94bb9d43 | ||
|
|
ab41cb2cda | ||
|
|
92fcd31eac | ||
|
|
c259ec5408 | ||
|
|
4cf7d0c828 | ||
|
|
94d1a5e8d7 | ||
|
|
6402d8d58c | ||
|
|
c548e789bb | ||
|
|
8476cf692f | ||
|
|
f1328fb913 | ||
|
|
3303b079c5 | ||
|
|
7df0d16131 | ||
|
|
f2ee84b6a3 | ||
|
|
60005b35e4 | ||
|
|
e068281e28 | ||
|
|
48d66eb648 | ||
|
|
c285d5409e | ||
|
|
f36a6987e4 | ||
|
|
efd2ca9040 | ||
|
|
a35e5a314a | ||
|
|
cc45608423 | ||
|
|
25a3825a1d | ||
|
|
0a69b45126 | ||
|
|
a64bf63639 | ||
|
|
29cd27b545 | ||
|
|
a6cb24fa1a | ||
|
|
81c130ffc9 | ||
|
|
db669a0c6e | ||
|
|
2f9c4d0045 | ||
|
|
0bf6091305 | ||
|
|
ad2c969097 | ||
|
|
b7fb71ffe2 | ||
|
|
cf4bd8bb8d | ||
|
|
ec318d01fa | ||
|
|
a891b73401 | ||
|
|
dd2ffda387 | ||
|
|
b2b96e0b15 | ||
|
|
7c909e822f | ||
|
|
15dfce33df | ||
|
|
095e5c0e09 | ||
|
|
fb81e8f8b4 | ||
|
|
d8a5329834 | ||
|
|
e53be4b387 | ||
|
|
fba5655a44 | ||
|
|
28c71e88e2 | ||
|
|
29999007f6 | ||
|
|
349c0d4836 | ||
|
|
54ba6d80c0 | ||
|
|
d832c0f434 | ||
|
|
c60c4dd375 | ||
|
|
37a427f692 | ||
|
|
38ef4b7467 | ||
|
|
f195daa092 | ||
|
|
17f4195bcc | ||
|
|
f13f4adcbb | ||
|
|
d72f3aa758 | ||
|
|
98ab1b6428 | ||
|
|
208195f425 | ||
|
|
5cb280f986 | ||
|
|
9aec606c69 | ||
|
|
5c8cc0d536 | ||
|
|
43eed1ac92 | ||
|
|
e883ff295d | ||
|
|
c1e51e08d3 | ||
|
|
039a74a8b9 | ||
|
|
a029071b8f | ||
|
|
244e4580e9 | ||
|
|
e1ff4c47b9 | ||
|
|
0345c1bc1d | ||
|
|
f1ab6120d2 | ||
|
|
8f26f6df83 | ||
|
|
d0e196d210 | ||
|
|
e6c1065d19 | ||
|
|
45c96908e9 | ||
|
|
434fd32c90 | ||
|
|
0e3968124c | ||
|
|
632552f55d | ||
|
|
a7391144b3 | ||
|
|
918f149a63 | ||
|
|
1f6454cc90 | ||
|
|
4540f2653b | ||
|
|
fc1ea7f496 | ||
|
|
9f3457797f | ||
|
|
0b01b5217b | ||
|
|
cade33c647 | ||
|
|
dd8b700a2c | ||
|
|
417e72ebfd | ||
|
|
b8d045f5cf | ||
|
|
879a59085b | ||
|
|
b32d271fee | ||
|
|
21eb0837e8 | ||
|
|
b78fdc0cb1 | ||
|
|
a1ea765b95 | ||
|
|
39af228ac4 | ||
|
|
7c0549a923 | ||
|
|
f44b29522c | ||
|
|
682534e475 | ||
|
|
bbb4d7b6d7 | ||
|
|
5bb1bb080f | ||
|
|
058f057426 | ||
|
|
d1fe2d05f4 | ||
|
|
b9a3806f9e | ||
|
|
b25fea49fe | ||
|
|
83cbc11d46 | ||
|
|
0f685d9b42 | ||
|
|
d86b831364 | ||
|
|
0050266a50 | ||
|
|
b6300a0869 | ||
|
|
4ba998c5db | ||
|
|
2fb1f9aed3 | ||
|
|
85ea5b0b50 | ||
|
|
d349b74a4f | ||
|
|
3a9743fce4 | ||
|
|
2817844e89 | ||
|
|
7943a48cc3 | ||
|
|
953182d44a | ||
|
|
045d019149 | ||
|
|
d1514f57bd | ||
|
|
fdb65ab8b1 | ||
|
|
81123fb972 | ||
|
|
738060ebfa | ||
|
|
07b0f22a3f | ||
|
|
e03e5ba01d | ||
|
|
d896ce2b53 | ||
|
|
44d8a59361 | ||
|
|
344d35bbe9 | ||
|
|
fe71154626 | ||
|
|
65cbbc1ef8 | ||
|
|
d37c958637 | ||
|
|
9eb010da50 | ||
|
|
7e9029e337 | ||
|
|
00c3e3c8e0 | ||
|
|
7192546eb8 | ||
|
|
4c4c22a316 | ||
|
|
56044c7851 | ||
|
|
828169e611 | ||
|
|
1452e977a0 | ||
|
|
ede69eef7f | ||
|
|
03230eaa9c | ||
|
|
7dc157f9be | ||
|
|
854313a759 | ||
|
|
46ba5940c2 | ||
|
|
42c5d3fc4b | ||
|
|
d4e045ac24 | ||
|
|
8bc9f9a05f | ||
|
|
93e1b5e612 | ||
|
|
4f69699b71 | ||
|
|
f4f5ca2aaa | ||
|
|
8071dca9ad | ||
|
|
178f2d7949 | ||
|
|
65febdd13a | ||
|
|
f77c450cda | ||
|
|
f2af6c1170 | ||
|
|
43b83f8ed7 | ||
|
|
af88e63dff | ||
|
|
f6ee26c3da | ||
|
|
e8de6fa5d4 | ||
|
|
3ae5e79ec8 | ||
|
|
e9331aa0c0 | ||
|
|
ba4141934f | ||
|
|
96a7343142 | ||
|
|
a2e6d8e968 | ||
|
|
4ce37b7aca | ||
|
|
b92ad318f1 | ||
|
|
2d6231fd3d | ||
|
|
4e5e319d5b | ||
|
|
b66d921053 | ||
|
|
f12905b531 | ||
|
|
f216975378 | ||
|
|
3a3d5cbe9c | ||
|
|
10555c719e | ||
|
|
58768072ef | ||
|
|
455e003567 | ||
|
|
49f7bcf271 | ||
|
|
c2e41588aa | ||
|
|
a1eac37bd2 | ||
|
|
0370af58f1 | ||
|
|
8df0500f55 | ||
|
|
e4b8cfc768 | ||
|
|
a7757ec4d0 | ||
|
|
25a8db2a29 | ||
|
|
48fd387779 | ||
|
|
59c4bbb4ab | ||
|
|
2dc1c91955 | ||
|
|
ae154c86ed | ||
|
|
e9588061d7 | ||
|
|
0a88230ec4 | ||
|
|
a27b9b4299 | ||
|
|
aaec2cd51d | ||
|
|
34c9890f41 | ||
|
|
e8038863c3 | ||
|
|
694e3fd8cf | ||
|
|
40ae6568a4 | ||
|
|
4944e9e180 | ||
|
|
a24206eb96 | ||
|
|
d6b4ab75ee | ||
|
|
3e4b608a80 | ||
|
|
28319eb07e | ||
|
|
5889620a6a | ||
|
|
9764718c32 | ||
|
|
28b70e5910 | ||
|
|
4c2f8d9337 | ||
|
|
2cc0376756 | ||
|
|
8e051cae46 | ||
|
|
778a61a3c2 | ||
|
|
46e3f6df1f | ||
|
|
03022d169e | ||
|
|
9803253363 | ||
|
|
a55382e4ad | ||
|
|
b211b810d1 | ||
|
|
25e880d355 | ||
|
|
e43777bb5f | ||
|
|
efc60a1703 | ||
|
|
54f072991d | ||
|
|
a58893d1e3 | ||
|
|
865eb93c2d | ||
|
|
49f52bbcb3 | ||
|
|
9d1d0fe57a | ||
|
|
ea1c436ea1 | ||
|
|
3f9a1c08cc | ||
|
|
c586d4e8ca | ||
|
|
60ffe1d103 | ||
|
|
b5177ce290 | ||
|
|
d1aa665657 | ||
|
|
f130981546 | ||
|
|
bc347bab7a | ||
|
|
21228abfde | ||
|
|
e417437355 | ||
|
|
0bb720401b | ||
|
|
d35f2ad92b | ||
|
|
57759cb1a1 | ||
|
|
9e95da4eaa | ||
|
|
911c2d0bf4 | ||
|
|
116ca22def | ||
|
|
52fb884550 | ||
|
|
5cb38995c0 | ||
|
|
3c8e15dbc1 | ||
|
|
c1499b13ac | ||
|
|
7bcd62cfee | ||
|
|
47da5cf75a | ||
|
|
72471aff63 | ||
|
|
b9340bc597 | ||
|
|
731182eee4 | ||
|
|
f4eec5ca79 | ||
|
|
b60adce4cb | ||
|
|
66c4bc8f64 | ||
|
|
d2dc28ed2b | ||
|
|
0514a9f903 | ||
|
|
d1d3c823cc | ||
|
|
9b005dedfd | ||
|
|
4fdb71151f | ||
|
|
f611bb016b | ||
|
|
4dff205dc1 | ||
|
|
72fd2d192c | ||
|
|
35815832b5 | ||
|
|
9c45b8faf7 | ||
|
|
ca2918ab13 | ||
|
|
d915f31bcb | ||
|
|
4ca35ef8b9 | ||
|
|
4b73818c87 | ||
|
|
d305419da6 | ||
|
|
8b132c0889 | ||
|
|
b927fb2a7e | ||
|
|
282129ea66 | ||
|
|
fc5d49b6f6 | ||
|
|
6c2771c116 | ||
|
|
fdc869ce16 | ||
|
|
fa9df678ac | ||
|
|
3932830535 | ||
|
|
07eaa3c63f | ||
|
|
3530d11418 | ||
|
|
806e133473 | ||
|
|
2bf8dde782 | ||
|
|
4e28459a2f | ||
|
|
c4d6f6dcce | ||
|
|
0859535b62 | ||
|
|
6e39b58f8a | ||
|
|
559d649994 | ||
|
|
3fda01b185 | ||
|
|
4f2eacf615 | ||
|
|
0047ae84b3 | ||
|
|
2bb24f996f | ||
|
|
61f2aed5b0 | ||
|
|
9308c870f5 | ||
|
|
1b8d664bbe | ||
|
|
844dd33f3d | ||
|
|
856edbf95f | ||
|
|
100b38784d | ||
|
|
4cbd22a15f | ||
|
|
d2971a1959 | ||
|
|
4f16a12c03 | ||
|
|
e7f0c065cf | ||
|
|
70318c9413 | ||
|
|
6e84352b51 | ||
|
|
0eb9b2463d | ||
|
|
445b14148e | ||
|
|
61c1c77a28 | ||
|
|
5979b0669b | ||
|
|
a2afb974be | ||
|
|
c11cdcb6d8 | ||
|
|
8c7d4b55c9 | ||
|
|
88696601e1 | ||
|
|
20a9d71016 | ||
|
|
1af57e6f71 | ||
|
|
4e1d6e7ff4 | ||
|
|
efb71ea12b | ||
|
|
cbbb3c7962 | ||
|
|
4fcee1751a | ||
|
|
efa571a42c | ||
|
|
bf8c4785f2 | ||
|
|
4f206b2416 | ||
|
|
504b331da4 | ||
|
|
74f969b603 | ||
|
|
4dfd801887 | ||
|
|
62233ed7c9 | ||
|
|
7b54ab620b | ||
|
|
343f776ca5 | ||
|
|
756ded4d64 | ||
|
|
b706e34fc8 | ||
|
|
5d5cd8612f | ||
|
|
afe67a7035 | ||
|
|
2fa1984635 | ||
|
|
2194842d11 | ||
|
|
e3b2c1afff | ||
|
|
b95cbc4a8e | ||
|
|
24c4901ff5 | ||
|
|
c125b1dd74 | ||
|
|
f216a7b06f | ||
|
|
c6d2f45cab | ||
|
|
1d4d760ffc | ||
|
|
a0e94ec24d | ||
|
|
b593af17a9 | ||
|
|
4521204ea0 | ||
|
|
d35563ee1a | ||
|
|
38397ce11f | ||
|
|
cd81b079ee | ||
|
|
e85faec47d | ||
|
|
0d9e77f559 | ||
|
|
c82750a48a | ||
|
|
de80aefece | ||
|
|
e4929e11f6 | ||
|
|
d942d47e10 | ||
|
|
84e7884d9c | ||
|
|
9d0dcedb2b | ||
|
|
b576bf4b41 | ||
|
|
e541d6031a | ||
|
|
5fa3628506 | ||
|
|
f71e4660d4 | ||
|
|
929567523c | ||
|
|
122906d525 | ||
|
|
25d01460fd | ||
|
|
ba5642d4ee | ||
|
|
15e6d844ae | ||
|
|
d1cae2dec2 | ||
|
|
11aee13ff2 | ||
|
|
39e7ee6e65 | ||
|
|
094ef31c01 | ||
|
|
afd0638b74 | ||
|
|
6e41edb90f | ||
|
|
7931f4c241 | ||
|
|
b847d40842 | ||
|
|
e91a02cc49 | ||
|
|
cc526940ee | ||
|
|
7188820151 | ||
|
|
00845709ce | ||
|
|
b50fdc191e | ||
|
|
ef0f723fc5 | ||
|
|
fbf62b4830 |
@ -30,11 +30,20 @@ aliases:
|
|||||||
- &artifact_env_min
|
- &artifact_env_min
|
||||||
path: ~/babel/packages/babel-preset-env-standalone/babel-preset-env.min.js
|
path: ~/babel/packages/babel-preset-env-standalone/babel-preset-env.min.js
|
||||||
|
|
||||||
|
- &test262_workdir
|
||||||
|
working_directory: ~/babel/babel-test262-runner
|
||||||
|
|
||||||
|
- &artifact_test262_tap
|
||||||
|
path: ~/test262.tap
|
||||||
|
|
||||||
|
- &artifact_test262_xunit
|
||||||
|
path: ~/test-results
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
test:
|
||||||
working_directory: ~/babel
|
working_directory: ~/babel
|
||||||
docker:
|
docker:
|
||||||
- image: circleci/node:10
|
- image: circleci/node:13
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- restore-cache: *restore-yarn-cache
|
- restore-cache: *restore-yarn-cache
|
||||||
@ -42,7 +51,7 @@ jobs:
|
|||||||
- run: yarn --version
|
- run: yarn --version
|
||||||
- run: make test-ci-coverage
|
- run: make test-ci-coverage
|
||||||
# Builds babel-standalone with the regular Babel config
|
# Builds babel-standalone with the regular Babel config
|
||||||
- run: make build
|
- run: IS_PUBLISH=true make build
|
||||||
# test-ci-coverage doesn't test babel-standalone, as trying to gather coverage
|
# 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,
|
# data for a JS file that's several megabytes large is bound to fail. Here,
|
||||||
# we just run the babel-standalone test separately.
|
# we just run the babel-standalone test separately.
|
||||||
@ -54,3 +63,59 @@ jobs:
|
|||||||
- store_artifacts: *artifact_env_min
|
- store_artifacts: *artifact_env_min
|
||||||
- save_cache: *save-node-modules-cache
|
- save_cache: *save-node-modules-cache
|
||||||
- save_cache: *save-yarn-cache
|
- save_cache: *save-yarn-cache
|
||||||
|
test262:
|
||||||
|
working_directory: ~/babel
|
||||||
|
docker:
|
||||||
|
- image: circleci/node:12
|
||||||
|
steps:
|
||||||
|
- checkout
|
||||||
|
- restore-cache: *restore-yarn-cache
|
||||||
|
- restore-cache: *restore-node-modules-cache
|
||||||
|
- run:
|
||||||
|
name: Build Babel
|
||||||
|
command: BABEL_ENV=test make bootstrap
|
||||||
|
- run:
|
||||||
|
name: Link Babel
|
||||||
|
command: |
|
||||||
|
cd packages
|
||||||
|
for package in */; do
|
||||||
|
cd $package
|
||||||
|
yarn link
|
||||||
|
cd ..
|
||||||
|
done
|
||||||
|
- run:
|
||||||
|
name: Setup Test Runner
|
||||||
|
command: |
|
||||||
|
git clone --recurse-submodules https://github.com/babel/babel-test262-runner
|
||||||
|
cd babel-test262-runner
|
||||||
|
yarn
|
||||||
|
yarn add tap-mocha-reporter --dev
|
||||||
|
curl -L https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 > jq
|
||||||
|
chmod +x ./jq
|
||||||
|
for package in ../packages/*/package.json; do
|
||||||
|
yarn link $(./jq -j ".name" $package)
|
||||||
|
done
|
||||||
|
node lib/download-node
|
||||||
|
- run:
|
||||||
|
name: Run Test262
|
||||||
|
command: node lib/run-tests I_AM_SURE | tee ~/test262.tap
|
||||||
|
<<: *test262_workdir
|
||||||
|
- store_artifacts: *artifact_test262_tap
|
||||||
|
- run:
|
||||||
|
name: Output test262 results
|
||||||
|
command: |
|
||||||
|
cat ~/test262.tap | $(npm bin)/tap-mocha-reporter spec || true
|
||||||
|
<<: *test262_workdir
|
||||||
|
|
||||||
|
workflows:
|
||||||
|
version: 2
|
||||||
|
test:
|
||||||
|
jobs:
|
||||||
|
- test
|
||||||
|
master:
|
||||||
|
jobs:
|
||||||
|
- test262:
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
|||||||
@ -6,9 +6,12 @@ charset = utf-8
|
|||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
|
|
||||||
[*.{js,json}]
|
[*.{js,json,ts,tsx}]
|
||||||
indent_style = space
|
indent_style = space
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|
||||||
|
[Makefile]
|
||||||
|
indent_style = tab
|
||||||
|
|
||||||
[*.{md,markdown}]
|
[*.{md,markdown}]
|
||||||
trim_trailing_whitespace = false
|
trim_trailing_whitespace = false
|
||||||
|
|||||||
@ -5,8 +5,8 @@ package.json
|
|||||||
lerna.json
|
lerna.json
|
||||||
packages/babel-runtime
|
packages/babel-runtime
|
||||||
!packages/babel-plugin-transform-runtime/scripts
|
!packages/babel-plugin-transform-runtime/scripts
|
||||||
!packages/babel-runtime-corejs2/core-js.js
|
|
||||||
packages/babel-runtime-corejs2
|
packages/babel-runtime-corejs2
|
||||||
|
packages/babel-runtime-corejs3
|
||||||
packages/*/node_modules
|
packages/*/node_modules
|
||||||
packages/*/lib
|
packages/*/lib
|
||||||
packages/*/dist
|
packages/*/dist
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"root": true,
|
"root": true,
|
||||||
|
"plugins": ["prettier", "@babel/development", "import"],
|
||||||
"extends": "babel",
|
"extends": "babel",
|
||||||
"plugins": ["local-rules", "prettier"],
|
|
||||||
"rules": {
|
"rules": {
|
||||||
"prettier/prettier": "error"
|
"prettier/prettier": "error"
|
||||||
},
|
},
|
||||||
@ -12,8 +12,10 @@
|
|||||||
{
|
{
|
||||||
"files": ["packages/*/src/**/*.js", "codemods/*/src/**/*.js"],
|
"files": ["packages/*/src/**/*.js", "codemods/*/src/**/*.js"],
|
||||||
"rules": {
|
"rules": {
|
||||||
"local-rules/no-undefined-identifier": "error",
|
"@babel/development/no-undefined-identifier": "error",
|
||||||
"local-rules/no-deprecated-clone": "error"
|
"@babel/development/no-deprecated-clone": "error",
|
||||||
|
"import/no-extraneous-dependencies": "error",
|
||||||
|
"guard-for-in": "error"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -26,6 +28,14 @@
|
|||||||
"env": {
|
"env": {
|
||||||
"jest": true
|
"jest": true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"files": ["packages/babel-plugin-*/src/index.js"],
|
||||||
|
"excludedFiles": ["packages/babel-plugin-transform-regenerator/**/*.js"],
|
||||||
|
"rules": {
|
||||||
|
"@babel/development/plugin-name": "error",
|
||||||
|
"eqeqeq": ["error", "always", { "null": "ignore" }]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
15
.flowconfig
15
.flowconfig
@ -1,11 +1,10 @@
|
|||||||
[ignore]
|
[ignore]
|
||||||
.*/build/.*
|
<PROJECT_ROOT>/build/.*
|
||||||
.*/packages/.*/lib
|
<PROJECT_ROOT>/packages/.*/lib
|
||||||
.*/packages/.*/test
|
<PROJECT_ROOT>/packages/.*/test
|
||||||
.*/codemods/.*/lib
|
<PROJECT_ROOT>/codemods/.*/lib
|
||||||
.*/codemods/.*/test
|
<PROJECT_ROOT>/codemods/.*/test
|
||||||
.*/node_modules/conventional-changelog-core/
|
<PROJECT_ROOT>/node_modules/module-deps/
|
||||||
.*/node_modules/module-deps/
|
|
||||||
|
|
||||||
[include]
|
[include]
|
||||||
packages/*/src
|
packages/*/src
|
||||||
@ -25,4 +24,6 @@ suppress_comment= \\(.\\|\n\\)*\\$FlowIgnore
|
|||||||
suppress_type=$FlowFixMe
|
suppress_type=$FlowFixMe
|
||||||
suppress_type=$FlowSubtype
|
suppress_type=$FlowSubtype
|
||||||
esproposal.export_star_as=enable
|
esproposal.export_star_as=enable
|
||||||
|
esproposal.optional_chaining=enable
|
||||||
|
esproposal.nullish_coalescing=enable
|
||||||
module.name_mapper='^@babel\/\([a-zA-Z0-9_\-]+\)$' -> '<PROJECT_ROOT>/packages/babel-\1/src/index'
|
module.name_mapper='^@babel\/\([a-zA-Z0-9_\-]+\)$' -> '<PROJECT_ROOT>/packages/babel-\1/src/index'
|
||||||
|
|||||||
22
.github/CHANGELOG-6to5.md
vendored
22
.github/CHANGELOG-6to5.md
vendored
@ -84,7 +84,7 @@
|
|||||||
* More performance improvements.
|
* More performance improvements.
|
||||||
* Parsing is now ~30% faster thanks to [marijnh/acorn@7264bc0178e7e6af7cfe02e9e0c6b26ee0e6007f](https://github.com/marijnh/acorn/commit/7264bc0178e7e6af7cfe02e9e0c6b26ee0e6007f).
|
* Parsing is now ~30% faster thanks to [marijnh/acorn@7264bc0178e7e6af7cfe02e9e0c6b26ee0e6007f](https://github.com/marijnh/acorn/commit/7264bc0178e7e6af7cfe02e9e0c6b26ee0e6007f).
|
||||||
* **New Feature**
|
* **New Feature**
|
||||||
* Optional `es6.blockScopingTDZ` is now completely functional and handles all edgecases.
|
* Optional `es6.blockScopingTDZ` is now completely functional and handles all edge cases.
|
||||||
* `super` in object literals.
|
* `super` in object literals.
|
||||||
* Tail call optimisation. Thanks [@RReverser](https://github.com/RReverser)!
|
* Tail call optimisation. Thanks [@RReverser](https://github.com/RReverser)!
|
||||||
|
|
||||||
@ -122,7 +122,7 @@
|
|||||||
* Restructure transformers so they're only ran if the AST contains nodes that they need to worry about. Improves transpilation speed significantly.
|
* Restructure transformers so they're only ran if the AST contains nodes that they need to worry about. Improves transpilation speed significantly.
|
||||||
* **Bug Fix**
|
* **Bug Fix**
|
||||||
* Fix source maps not tracking end of node locations.
|
* Fix source maps not tracking end of node locations.
|
||||||
* **Spec Compliancy**
|
* **Spec Compliance**
|
||||||
* Use static super references as the home object is actually done at definition time.
|
* Use static super references as the home object is actually done at definition time.
|
||||||
* **Polish**
|
* **Polish**
|
||||||
* Force the `es6.destructuring` transformer to be whitelisted when the `es7.objectSpread` transformer is.
|
* Force the `es6.destructuring` transformer to be whitelisted when the `es7.objectSpread` transformer is.
|
||||||
@ -474,12 +474,12 @@
|
|||||||
* **Polish**
|
* **Polish**
|
||||||
* Rest parameters now allocate the array before populating.
|
* Rest parameters now allocate the array before populating.
|
||||||
* **Internal**
|
* **Internal**
|
||||||
* `for...in` loops have been changed to optimized `for` loops - better performance and no enumeration of protoype keys.
|
* `for...in` loops have been changed to optimized `for` loops - better performance and no enumeration of prototype keys.
|
||||||
* Parts of the code generator have now been optimized thanks to [gaearon](https://github.com/gaearon).
|
* Parts of the code generator have now been optimized thanks to [gaearon](https://github.com/gaearon).
|
||||||
|
|
||||||
## 2.12.3
|
## 2.12.3
|
||||||
|
|
||||||
* **Spec Compliancy**
|
* **Spec Compliance**
|
||||||
* Optional `typeof` transformer checks for `undefined` before passing it to the helper.
|
* Optional `typeof` transformer checks for `undefined` before passing it to the helper.
|
||||||
* Class methods are now named.
|
* Class methods are now named.
|
||||||
|
|
||||||
@ -551,7 +551,7 @@
|
|||||||
* Add `classesFastSuper` optional transformer that doesn't support parent getters and prototype changing.
|
* Add `classesFastSuper` optional transformer that doesn't support parent getters and prototype changing.
|
||||||
* Add `forOfFast` transformer that speeds up `for...of` on arrays but produces more code.
|
* Add `forOfFast` transformer that speeds up `for...of` on arrays but produces more code.
|
||||||
* Add `--react-compat` to `bin/6to5`.
|
* Add `--react-compat` to `bin/6to5`.
|
||||||
* **Spec Compliancy**
|
* **Spec Compliance**
|
||||||
* Disallow setters without a single parameter.
|
* Disallow setters without a single parameter.
|
||||||
* Add `configurable` and `writable` to defined properties.
|
* Add `configurable` and `writable` to defined properties.
|
||||||
* Use define instead of assignment for class methods.
|
* Use define instead of assignment for class methods.
|
||||||
@ -619,7 +619,7 @@
|
|||||||
|
|
||||||
## 2.7.0
|
## 2.7.0
|
||||||
|
|
||||||
* **Spec Compliancy**
|
* **Spec Compliance**
|
||||||
* Disallow reassignments of imports.
|
* Disallow reassignments of imports.
|
||||||
* **New Feature**
|
* **New Feature**
|
||||||
* `reactCompat` option to enable pre-v0.12 react components.
|
* `reactCompat` option to enable pre-v0.12 react components.
|
||||||
@ -643,7 +643,7 @@
|
|||||||
|
|
||||||
* **Bug Fix**
|
* **Bug Fix**
|
||||||
* Better handling of number literal property keys.
|
* Better handling of number literal property keys.
|
||||||
* Handle `NewExpression` paren insertion edegcases better.
|
* Handle `NewExpression` paren insertion edge cases better.
|
||||||
* **Internal**
|
* **Internal**
|
||||||
* Fix incorrect AST node `identifier("this")`.
|
* Fix incorrect AST node `identifier("this")`.
|
||||||
* Better `toIdentifier` method that handles reserved words.
|
* Better `toIdentifier` method that handles reserved words.
|
||||||
@ -662,7 +662,7 @@
|
|||||||
* **Polish**
|
* **Polish**
|
||||||
* Move `"use strict";` to inside module bodies instead of at the top of the file.
|
* Move `"use strict";` to inside module bodies instead of at the top of the file.
|
||||||
* Better handling of dynamic imports.
|
* Better handling of dynamic imports.
|
||||||
* **Spec Compliancy**
|
* **Spec Compliance**
|
||||||
* Class inheritance now has a `function` or `null` type check.
|
* Class inheritance now has a `function` or `null` type check.
|
||||||
* Add `interopRequireWildcard` around wildcard imports and exports to handle non-object exports.
|
* Add `interopRequireWildcard` around wildcard imports and exports to handle non-object exports.
|
||||||
|
|
||||||
@ -850,7 +850,7 @@
|
|||||||
|
|
||||||
## 1.14.10
|
## 1.14.10
|
||||||
|
|
||||||
* Fix let scoping unneccesary override.
|
* Fix let scoping unnecessary override.
|
||||||
|
|
||||||
## 1.14.6
|
## 1.14.6
|
||||||
|
|
||||||
@ -973,7 +973,7 @@
|
|||||||
|
|
||||||
## 1.12.21
|
## 1.12.21
|
||||||
|
|
||||||
* Fix unneccesary let scoping replacement.
|
* Fix unnecessary let scoping replacement.
|
||||||
* Add `commonInterop` module formatter. Thanks [@Naddiseo](https://github.com/Naddiseo).
|
* Add `commonInterop` module formatter. Thanks [@Naddiseo](https://github.com/Naddiseo).
|
||||||
* Fix `return` outside of function body bug. Thanks [@brentburg](https://github.com/brentburg).
|
* Fix `return` outside of function body bug. Thanks [@brentburg](https://github.com/brentburg).
|
||||||
* Add more flexible option types.
|
* Add more flexible option types.
|
||||||
@ -1020,7 +1020,7 @@
|
|||||||
|
|
||||||
## 1.12.12
|
## 1.12.12
|
||||||
|
|
||||||
* Make scope tracker more reliable to handle all edgecases.
|
* Make scope tracker more reliable to handle all edge cases.
|
||||||
|
|
||||||
## 1.12.11
|
## 1.12.11
|
||||||
|
|
||||||
|
|||||||
10
.github/CHANGELOG-v4.md
vendored
10
.github/CHANGELOG-v4.md
vendored
@ -110,7 +110,7 @@
|
|||||||
* Throw an error on different `babel` and `babel-runtime` versions.
|
* Throw an error on different `babel` and `babel-runtime` versions.
|
||||||
* Replicate module environment for `babel-node` eval.
|
* Replicate module environment for `babel-node` eval.
|
||||||
* Clean up classes output.
|
* Clean up classes output.
|
||||||
* **Spec Compliancy**
|
* **Spec Compliance**
|
||||||
* Make it illegal to use a rest parameter on a setter.
|
* Make it illegal to use a rest parameter on a setter.
|
||||||
|
|
||||||
## 4.6.6
|
## 4.6.6
|
||||||
@ -127,7 +127,7 @@
|
|||||||
## 4.6.4
|
## 4.6.4
|
||||||
|
|
||||||
* **Bug Fix**
|
* **Bug Fix**
|
||||||
* Fix `ForOfStatement` not proplery inheriting labels.
|
* Fix `ForOfStatement` not properly inheriting labels.
|
||||||
* When in closure mode in block scoping transformer, properly check for variable shadowing.
|
* When in closure mode in block scoping transformer, properly check for variable shadowing.
|
||||||
* **New Feature**
|
* **New Feature**
|
||||||
* New `utility.inlineEnvironmentVariables` and `utility.inlineExpression` transformers.
|
* New `utility.inlineEnvironmentVariables` and `utility.inlineExpression` transformers.
|
||||||
@ -150,10 +150,10 @@
|
|||||||
|
|
||||||
* **New Feature**
|
* **New Feature**
|
||||||
* Desugar sticky regexes to a new constructor expression so it can be handled by a polyfill.
|
* Desugar sticky regexes to a new constructor expression so it can be handled by a polyfill.
|
||||||
* **Spec Compliancy**
|
* **Spec Compliance**
|
||||||
* `for...of` now outputs in a lengthy `try...catch` this is to ensure spec compliancy in regards to iterator returns and abrupt completions. See [google/traceur-compiler#1773](https://github.com/google/traceur-compiler/issues/1773) and [babel/babel/#838](https://github.com/babel/babel/issues/838) for more information.
|
* `for...of` now outputs in a lengthy `try...catch` this is to ensure spec compliance in regards to iterator returns and abrupt completions. See [google/traceur-compiler#1773](https://github.com/google/traceur-compiler/issues/1773) and [babel/babel/#838](https://github.com/babel/babel/issues/838) for more information.
|
||||||
* **Polish**
|
* **Polish**
|
||||||
* Rest parameters that are only refered to via number properties on member expressions are desugared into a direct `arguments` reference. Thanks [@neVERberleRfellerER](https://github.com/neVERberleRfellerER)!
|
* Rest parameters that are only referred to via number properties on member expressions are desugared into a direct `arguments` reference. Thanks [@neVERberleRfellerER](https://github.com/neVERberleRfellerER)!
|
||||||
* `$ babel` no longer exits on syntax errors.
|
* `$ babel` no longer exits on syntax errors.
|
||||||
* **Internal**
|
* **Internal**
|
||||||
* Upgrade `browserify`.
|
* Upgrade `browserify`.
|
||||||
|
|||||||
21
.github/CHANGELOG-v5.md
vendored
21
.github/CHANGELOG-v5.md
vendored
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
## 5.8.24
|
## 5.8.24
|
||||||
|
|
||||||
* **Spec Compliancy**
|
* **Spec Compliance**
|
||||||
* Updated `optimisation.react.inlineElements` transformer to React 0.14 output. Thanks [@spicyj](https://github.com/spicyj)!
|
* Updated `optimisation.react.inlineElements` transformer to React 0.14 output. Thanks [@spicyj](https://github.com/spicyj)!
|
||||||
* **Polish**
|
* **Polish**
|
||||||
* Add support for evaluating more static nodes. Thanks [@hzoo](https://github.com/hzoo)!
|
* Add support for evaluating more static nodes. Thanks [@hzoo](https://github.com/hzoo)!
|
||||||
@ -262,8 +262,8 @@ Issues with publish process.
|
|||||||
* Register labels as bindings to fix undeclared variable checks.
|
* Register labels as bindings to fix undeclared variable checks.
|
||||||
* **Polish**
|
* **Polish**
|
||||||
* Remove unnecessary string binary expressions when transforming template literals.
|
* Remove unnecessary string binary expressions when transforming template literals.
|
||||||
* Support module live bindings in arbitary positions not in Program statement position.
|
* Support module live bindings in arbitrary positions not in Program statement position.
|
||||||
* Throw error when attemping to replace a `Program` root node with another node not of type `Program`.
|
* Throw error when attempting to replace a `Program` root node with another node not of type `Program`.
|
||||||
* Optimise rest parameters in spread element position and allocate rest array at the earliest common ancestor of all references.
|
* Optimise rest parameters in spread element position and allocate rest array at the earliest common ancestor of all references.
|
||||||
* Generate original number representation when value was not changed.
|
* Generate original number representation when value was not changed.
|
||||||
* Check for invalid binding identifiers when generating inferred method names.
|
* Check for invalid binding identifiers when generating inferred method names.
|
||||||
@ -451,7 +451,7 @@ Issues with publish process.
|
|||||||
|
|
||||||

|

|
||||||
|
|
||||||
* **Spec Compliancy**
|
* **Spec Compliance**
|
||||||
* Allow trailing param commas for methods when using the `es7.trailingCommas` transformer.
|
* Allow trailing param commas for methods when using the `es7.trailingCommas` transformer.
|
||||||
* **Bug Fix**
|
* **Bug Fix**
|
||||||
* Fix `es6.blockScoping` transformer not properly ignoring `break` in `SwitchCase`.
|
* Fix `es6.blockScoping` transformer not properly ignoring `break` in `SwitchCase`.
|
||||||
@ -481,7 +481,7 @@ Issues with publish process.
|
|||||||
* Fix correct function scope being passed to `nameMethod.property` when inferring the function name for class methods.
|
* Fix correct function scope being passed to `nameMethod.property` when inferring the function name for class methods.
|
||||||
* Fix incorrect extensions reference causing weird issues when using the Babel CLI.
|
* Fix incorrect extensions reference causing weird issues when using the Babel CLI.
|
||||||
* Fix destructuring param reference replacements not inheriting from their original param.
|
* Fix destructuring param reference replacements not inheriting from their original param.
|
||||||
* **Spec Compliancy**
|
* **Spec Compliance**
|
||||||
* Fix order that method decorators are ran in.
|
* Fix order that method decorators are ran in.
|
||||||
|
|
||||||
## 5.2.15
|
## 5.2.15
|
||||||
@ -543,12 +543,12 @@ Issues with publish process.
|
|||||||
* **Internal**
|
* **Internal**
|
||||||
* Removed native inheritance support from classes.
|
* Removed native inheritance support from classes.
|
||||||
* Added `replaceWithSourceString` path API.
|
* Added `replaceWithSourceString` path API.
|
||||||
* Split up `es3.propertyLiterals` and `es3.memberExpressionLiterals` transformers to `minfication.propertyLiterals` and `es3.memberExpressionLiterals`.
|
* Split up `es3.propertyLiterals` and `es3.memberExpressionLiterals` transformers to `minification.propertyLiterals` and `es3.memberExpressionLiterals`.
|
||||||
|
|
||||||
## 5.2.6
|
## 5.2.6
|
||||||
|
|
||||||
* **Internal**
|
* **Internal**
|
||||||
* Fix transformer aliases being accidently set as deprecated ones.
|
* Fix transformer aliases being accidentally set as deprecated ones.
|
||||||
* Expose `Pipeline` as `TransformerPipeline` instead.
|
* Expose `Pipeline` as `TransformerPipeline` instead.
|
||||||
|
|
||||||
## 5.2.5
|
## 5.2.5
|
||||||
@ -616,7 +616,7 @@ Issues with publish process.
|
|||||||
* Fix `externalHelpers` option being incorrectly listed as type `string`.
|
* Fix `externalHelpers` option being incorrectly listed as type `string`.
|
||||||
* **Internal**
|
* **Internal**
|
||||||
* Upgrade `core-js` to `0.9.0`.
|
* Upgrade `core-js` to `0.9.0`.
|
||||||
* **Spec Compliancy**
|
* **Spec Compliance**
|
||||||
* Fix object decorators not using the `initializer` pattern.
|
* Fix object decorators not using the `initializer` pattern.
|
||||||
* Remove property initializer descriptor reflection.
|
* Remove property initializer descriptor reflection.
|
||||||
|
|
||||||
@ -824,10 +824,10 @@ Issues with publish process.
|
|||||||
* Save register cache on tick instead of `SIGINT`.
|
* Save register cache on tick instead of `SIGINT`.
|
||||||
* Enable strict mode on babel-node eval flag.
|
* Enable strict mode on babel-node eval flag.
|
||||||
* **Bug Fixes**
|
* **Bug Fixes**
|
||||||
* Add support for live bindings. This change also increases the reliablity of export specifier renaming.
|
* Add support for live bindings. This change also increases the reliability of export specifier renaming.
|
||||||
* Add support for super update and non equals assignment expressions.
|
* Add support for super update and non equals assignment expressions.
|
||||||
* Rename shadow constructor binding in classes.
|
* Rename shadow constructor binding in classes.
|
||||||
* Seed next iteration bindings with previous fresh bindings when reassinging loop block scoped variables.
|
* Seed next iteration bindings with previous fresh bindings when reassigning loop block scoped variables.
|
||||||
* Fix new expression spread referencing the wrong constructor.
|
* Fix new expression spread referencing the wrong constructor.
|
||||||
* Call `resolveModuleSource` on dynamic imports.
|
* Call `resolveModuleSource` on dynamic imports.
|
||||||
* Added `param` to list of duplicate declaration kinds.
|
* Added `param` to list of duplicate declaration kinds.
|
||||||
@ -836,4 +836,3 @@ Issues with publish process.
|
|||||||
* ES7 Abstract References have been removed.
|
* ES7 Abstract References have been removed.
|
||||||
* Experimental option has been removed in favor of a stage option.
|
* Experimental option has been removed in favor of a stage option.
|
||||||
* Rename `returnUsedHelpers` to `metadataUsedHelpers`.
|
* Rename `returnUsedHelpers` to `metadataUsedHelpers`.
|
||||||
|
|
||||||
36
.github/CHANGELOG-v6.md
vendored
36
.github/CHANGELOG-v6.md
vendored
@ -19,10 +19,10 @@
|
|||||||
|
|
||||||
## 6.26.0 (2017-08-16)
|
## 6.26.0 (2017-08-16)
|
||||||
|
|
||||||
> Backports for some folks (also other's when we accidently merged PRs from both 6.x/master)
|
> Backports for some folks (also other's when we accidentally merged PRs from both 6.x/master)
|
||||||
> Lesson learned: just use `master` and backport on another branch.
|
> Lesson learned: just use `master` and backport on another branch.
|
||||||
|
|
||||||
#### :eyeglasses: Spec Compliancy
|
#### :eyeglasses: Spec Compliance
|
||||||
* `babel-core`, `babel-generator`, `babel-plugin-transform-flow-comments`, `babel-plugin-transform-flow-strip-types`, `babel-traverse`, `babel-types`
|
* `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))
|
* [#6081](https://github.com/babel/babel/pull/6081) Flow opaque type 6.x backport. ([@jbrown215](https://github.com/jbrown215))
|
||||||
|
|
||||||
@ -1468,7 +1468,7 @@ It's a one-time use tool (helpful after the initial release when upgrading from
|
|||||||
|
|
||||||
## v6.17.0 (2016-10-01)
|
## v6.17.0 (2016-10-01)
|
||||||
|
|
||||||
#### :eyeglasses: Spec Compliancy
|
#### :eyeglasses: Spec Compliance
|
||||||
* `babel-preset-stage-2`, `babel-preset-stage-3`
|
* `babel-preset-stage-2`, `babel-preset-stage-3`
|
||||||
* [#4617](https://github.com/babel/babel/pull/4617) Move async-generators to stage-3. ([@hzoo](https://github.com/hzoo))
|
* [#4617](https://github.com/babel/babel/pull/4617) Move async-generators to stage-3. ([@hzoo](https://github.com/hzoo))
|
||||||
|
|
||||||
@ -1476,7 +1476,7 @@ It's a one-time use tool (helpful after the initial release when upgrading from
|
|||||||
|
|
||||||
Specification repo: https://github.com/tc39/proposal-async-iteration
|
Specification repo: https://github.com/tc39/proposal-async-iteration
|
||||||
|
|
||||||
Asynchronous Iteration was already added in [6.16.0](http://babeljs.io/blog/2016/09/28/6.16.0#spec-compliancy) under stage-2 but it was moved to stage-3 at the [latest TC-39 meeting](https://github.com/tc39/agendas/blob/master/2016/09.md#agenda-for-the-54th-meeting-of-ecma-tc39).
|
Asynchronous Iteration was already added in [6.16.0](http://babeljs.io/blog/2016/09/28/6.16.0#spec-compliance) under stage-2 but it was moved to stage-3 at the [latest TC-39 meeting](https://github.com/tc39/agendas/blob/master/2016/09.md#agenda-for-the-54th-meeting-of-ecma-tc39).
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// async generator syntax
|
// async generator syntax
|
||||||
@ -1569,7 +1569,7 @@ First PR!
|
|||||||
|
|
||||||
Babel 6.16: Happy 2nd Birthday 🎂!
|
Babel 6.16: Happy 2nd Birthday 🎂!
|
||||||
|
|
||||||
#### :eyeglasses: Spec Compliancy
|
#### :eyeglasses: Spec Compliance
|
||||||
|
|
||||||
* `babel-core`, `babel-generator`, `babel-helper-remap-async-to-generator`, `babel-helpers`, `babel-plugin-transform-async-generator-functions`, `babel-types`, `babel-preset-stage-2`, ...
|
* `babel-core`, `babel-generator`, `babel-helper-remap-async-to-generator`, `babel-helpers`, `babel-plugin-transform-async-generator-functions`, `babel-types`, `babel-preset-stage-2`, ...
|
||||||
* [#3473](https://github.com/babel/babel/pull/3473) via [#4576](https://github.com/babel/babel/pull/4576) Implement support for async generator functions and for-await statements. ([@zenparsing](https://github.com/zenparsing))
|
* [#3473](https://github.com/babel/babel/pull/3473) via [#4576](https://github.com/babel/babel/pull/4576) Implement support for async generator functions and for-await statements. ([@zenparsing](https://github.com/zenparsing))
|
||||||
@ -1767,7 +1767,7 @@ typeof Symbol.prototype === 'object'
|
|||||||
* [#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))
|
* [#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))
|
* [#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.
|
Fix an issue with defaults not being overridden. 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))
|
* [#4508](https://github.com/babel/babel/pull/4508) Support custom ports for V8 --inspect. ([@andykant](https://github.com/andykant))
|
||||||
* [#4562](https://github.com/babel/babel/pull/4562) Fixes [#2299](https://github.com/babel/babel/issues/2299): Prevent REPL from printing implicit 'use strict'. ([@hzoo](https://github.com/hzoo))
|
* [#4562](https://github.com/babel/babel/pull/4562) Fixes [#2299](https://github.com/babel/babel/issues/2299): Prevent REPL from printing implicit 'use strict'. ([@hzoo](https://github.com/hzoo))
|
||||||
@ -2036,7 +2036,7 @@ It's also a lot folk's first PR (or first code PR)!
|
|||||||
* `babel-generator`, `babel-types`
|
* `babel-generator`, `babel-types`
|
||||||
* [#3570](https://github.com/babel/babel/pull/3570) Add support for the new declare module.exports of flow. ([@danez](https://github.com/danez))
|
* [#3570](https://github.com/babel/babel/pull/3570) Add support for the new declare module.exports of flow. ([@danez](https://github.com/danez))
|
||||||
|
|
||||||
#### Spec Compliancy
|
#### Spec Compliance
|
||||||
* `babel-plugin-transform-es2015-modules-amd`, `babel-plugin-transform-es2015-modules-commonjs`, `babel-plugin-transform-es2015-modules-umd`
|
* `babel-plugin-transform-es2015-modules-amd`, `babel-plugin-transform-es2015-modules-commonjs`, `babel-plugin-transform-es2015-modules-umd`
|
||||||
* [#3518](https://github.com/babel/babel/pull/3518) Throw error for multiple exports default. ([@kaicataldo](https://github.com/kaicataldo))
|
* [#3518](https://github.com/babel/babel/pull/3518) Throw error for multiple exports default. ([@kaicataldo](https://github.com/kaicataldo))
|
||||||
|
|
||||||
@ -2084,7 +2084,7 @@ Also added more tests and will update Babel to use the new preset options after
|
|||||||
|
|
||||||
## v6.13.1 (2016-08-04)
|
## v6.13.1 (2016-08-04)
|
||||||
|
|
||||||
We had a regression in our new babel-preset-es2015@6.13.0 that made it unexpectedly backward-incompatible. This release introduces a new alternative plugin-options approach that is uglier but supports backward-compatiblity. Ideally new plugins would use the new `module.exports = function(babel, options){ }` approach and simple skip supporting `babel-core@<6.13.x`.
|
We had a regression in our new babel-preset-es2015@6.13.0 that made it unexpectedly backward-incompatible. This release introduces a new alternative plugin-options approach that is uglier but supports backward-compatibility. Ideally new plugins would use the new `module.exports = function(babel, options){ }` approach and simple skip supporting `babel-core@<6.13.x`.
|
||||||
|
|
||||||
#### Bug Fix
|
#### Bug Fix
|
||||||
* `babel-core`, `babel-preset-es2015`
|
* `babel-core`, `babel-preset-es2015`
|
||||||
@ -2092,7 +2092,7 @@ We had a regression in our new babel-preset-es2015@6.13.0 that made it unexpecte
|
|||||||
|
|
||||||
## v6.13.0 (2016-08-04)
|
## v6.13.0 (2016-08-04)
|
||||||
|
|
||||||
> Since the last release we've created https://github.com/babel/notes to track discussions on our slack and high level features/changes that could be added - definetely check it out if you're interested in Babel's development!
|
> Since the last release we've created https://github.com/babel/notes to track discussions on our slack and high level features/changes that could be added - definitely check it out if you're interested in Babel's development!
|
||||||
|
|
||||||
Some small but very important additions in this release:
|
Some small but very important additions in this release:
|
||||||
|
|
||||||
@ -2332,7 +2332,7 @@ Length: The number of characters in the output code
|
|||||||
* `babel-plugin-transform-react-jsx-self`, `babel-preset-react`
|
* `babel-plugin-transform-react-jsx-self`, `babel-preset-react`
|
||||||
* [#3540](https://github.com/babel/babel/pull/3540) Added jsx-self babel transform plugin. ([@jimfb](https://github.com/jimfb))
|
* [#3540](https://github.com/babel/babel/pull/3540) Added jsx-self babel transform plugin. ([@jimfb](https://github.com/jimfb))
|
||||||
|
|
||||||
#### Spec Compliancy
|
#### Spec Compliance
|
||||||
* `babel-plugin-transform-es2015-unicode-regex`
|
* `babel-plugin-transform-es2015-unicode-regex`
|
||||||
* [#3338](https://github.com/babel/babel/pull/3338) Update to `regexpu-core@2.0.0` for ES2016 compliance. ([@mathiasbynens](https://github.com/mathiasbynens))
|
* [#3338](https://github.com/babel/babel/pull/3338) Update to `regexpu-core@2.0.0` for ES2016 compliance. ([@mathiasbynens](https://github.com/mathiasbynens))
|
||||||
|
|
||||||
@ -3206,7 +3206,7 @@ Changes to note:
|
|||||||
- Reverting the class properties semicolon parser error.
|
- Reverting the class properties semicolon parser error.
|
||||||
- Fix regression with plugin ordering with `babel-register`.
|
- Fix regression with plugin ordering with `babel-register`.
|
||||||
|
|
||||||
#### Spec Compliancy
|
#### Spec Compliance
|
||||||
* `babel-plugin-transform-class-properties`, `babylon`
|
* `babel-plugin-transform-class-properties`, `babylon`
|
||||||
* [#3332](https://github.com/babel/babel/pull/3332) Revert to standard ASI behavior for class properties. ([@loganfsmyth](https://github.com/loganfsmyth))
|
* [#3332](https://github.com/babel/babel/pull/3332) Revert to standard ASI behavior for class properties. ([@loganfsmyth](https://github.com/loganfsmyth))
|
||||||
|
|
||||||
@ -3628,7 +3628,7 @@ Thanks to @samwgoldman for all the new flow support!
|
|||||||
* `babel-plugin-transform-es2015-parameters`: [#3191](https://github.com/babel/babel/pull/3191) Fix the order of arguments initialization (fixes [T6809](http://phabricator.babeljs.io/T6809))
|
* `babel-plugin-transform-es2015-parameters`: [#3191](https://github.com/babel/babel/pull/3191) Fix the order of arguments initialization (fixes [T6809](http://phabricator.babeljs.io/T6809))
|
||||||
* `babel-traverse`: [#3198](https://github.com/babel/babel/pull/3198) In `evaluate()`, it should not mistake lack of confidence for falsy
|
* `babel-traverse`: [#3198](https://github.com/babel/babel/pull/3198) In `evaluate()`, it should not mistake lack of confidence for falsy
|
||||||
|
|
||||||
* **Spec Compliancy**
|
* **Spec Compliance**
|
||||||
* `babylon`, `babel-generator`, `babel-plugin-transform-regenerator`: [#3190](https://github.com/babel/babel/pull/3190): Remove `await *` from `babylon` and raise an error for that syntax since it was removed from the proposal and was causing an issue at runtime but not at compile time (fixes [T6688](http://phabricator.babeljs.io/T6688)).
|
* `babylon`, `babel-generator`, `babel-plugin-transform-regenerator`: [#3190](https://github.com/babel/babel/pull/3190): Remove `await *` from `babylon` and raise an error for that syntax since it was removed from the proposal and was causing an issue at runtime but not at compile time (fixes [T6688](http://phabricator.babeljs.io/T6688)).
|
||||||
|
|
||||||
* **Internal**
|
* **Internal**
|
||||||
@ -3817,7 +3817,7 @@ Thanks to @samwgoldman for all the new flow support!
|
|||||||
* **New Feature**
|
* **New Feature**
|
||||||
* Add support for `function.sent`.
|
* Add support for `function.sent`.
|
||||||
* **Internal**
|
* **Internal**
|
||||||
* Bump `invariant` depenency version.
|
* Bump `invariant` dependency version.
|
||||||
* **Polish**
|
* **Polish**
|
||||||
* Infer filename from the base directory when resolving plugins and presets.
|
* Infer filename from the base directory when resolving plugins and presets.
|
||||||
* Allow JSX pragma to be specified in line comments.
|
* Allow JSX pragma to be specified in line comments.
|
||||||
@ -3863,7 +3863,7 @@ Thanks to @samwgoldman for all the new flow support!
|
|||||||
* Move `children` prop pushing to after props to ensure correct order in the react inline elements plugin.
|
* Move `children` prop pushing to after props to ensure correct order in the react inline elements plugin.
|
||||||
* Fix `buildExternalHelpers` script ignoring non-underscored helpers.
|
* Fix `buildExternalHelpers` script ignoring non-underscored helpers.
|
||||||
* Fix exported classes with static class properties.
|
* Fix exported classes with static class properties.
|
||||||
* **Spec Compliancy**
|
* **Spec Compliance**
|
||||||
* Add support for computed mutators in `babel-plugin-transform-es2015-computed-properties`.
|
* Add support for computed mutators in `babel-plugin-transform-es2015-computed-properties`.
|
||||||
* **Polish**
|
* **Polish**
|
||||||
* Make interop for plugins with the `__esModule` work for all plugins no matter how they're imported/specified.
|
* Make interop for plugins with the `__esModule` work for all plugins no matter how they're imported/specified.
|
||||||
@ -3887,7 +3887,7 @@ Thanks to @samwgoldman for all the new flow support!
|
|||||||
## 6.1.2
|
## 6.1.2
|
||||||
|
|
||||||
* **Bug Fix**
|
* **Bug Fix**
|
||||||
* Fix bug where the parser wouldn't allow typed annotated default parametesr in arrow functions.
|
* Fix bug where the parser wouldn't allow typed annotated default parameters in arrow functions.
|
||||||
* Add existence check to `NodePath#has` to ensure safeness when making comparisons.
|
* Add existence check to `NodePath#has` to ensure safeness when making comparisons.
|
||||||
* Protect against replacing a class expression with a name inferred version that would
|
* Protect against replacing a class expression with a name inferred version that would
|
||||||
result in it never being transformed.
|
result in it never being transformed.
|
||||||
@ -3904,7 +3904,7 @@ Thanks to @samwgoldman for all the new flow support!
|
|||||||
* **Polish**
|
* **Polish**
|
||||||
* Add npm 3 check to `babel-doctor`.
|
* Add npm 3 check to `babel-doctor`.
|
||||||
* Autoclear the `babel/register` cache when it gets too big to be serialised.
|
* Autoclear the `babel/register` cache when it gets too big to be serialised.
|
||||||
* **Spec Compliancy**
|
* **Spec Compliance**
|
||||||
* Add support for flow existential type parameters.
|
* Add support for flow existential type parameters.
|
||||||
|
|
||||||
## 6.1.1
|
## 6.1.1
|
||||||
@ -3969,14 +3969,14 @@ Thanks to @samwgoldman for all the new flow support!
|
|||||||
|
|
||||||
## 6.0.14
|
## 6.0.14
|
||||||
|
|
||||||
* **Spec Compliancy**
|
* **Spec Compliance**
|
||||||
* Update exponentiation operator precedence.
|
* Update exponentiation operator precedence.
|
||||||
* Fix parser bug where arrow functions have a higher precedence than they should.
|
* Fix parser bug where arrow functions have a higher precedence than they should.
|
||||||
* **Bug Fix**
|
* **Bug Fix**
|
||||||
* Fix SystemJS module formatter exporting function parameters.
|
* Fix SystemJS module formatter exporting function parameters.
|
||||||
* Ensure that invalid identifier JSX attribute keys are quoted when transforming to calls.
|
* Ensure that invalid identifier JSX attribute keys are quoted when transforming to calls.
|
||||||
* Fix ES3 property literal plugin.
|
* Fix ES3 property literal plugin.
|
||||||
* Fix parameters after defaults in arrow functions refering to the wrong `arguments`.
|
* Fix parameters after defaults in arrow functions referring to the wrong `arguments`.
|
||||||
|
|
||||||
## 6.0.13
|
## 6.0.13
|
||||||
|
|
||||||
|
|||||||
9
.github/ISSUE_TEMPLATE/Bug_report.md
vendored
9
.github/ISSUE_TEMPLATE/Bug_report.md
vendored
@ -1,6 +1,9 @@
|
|||||||
---
|
---
|
||||||
name: 🐛 Bug Report
|
name: "\U0001F41B Bug Report"
|
||||||
about: If something isn't working as expected 🤔.
|
about: "If something isn't working as expected \U0001F914."
|
||||||
|
title: ''
|
||||||
|
labels: 'i: bug, i: needs triage'
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -31,7 +34,7 @@ A clear and concise description of what you expected to happen (or code).
|
|||||||
- Babel version(s): [e.g. v6.0.0, v7.0.0-beta.34]
|
- Babel version(s): [e.g. v6.0.0, v7.0.0-beta.34]
|
||||||
- Node/npm version: [e.g. Node 8/npm 5]
|
- Node/npm version: [e.g. Node 8/npm 5]
|
||||||
- OS: [e.g. OSX 10.13.4, Windows 10]
|
- OS: [e.g. OSX 10.13.4, Windows 10]
|
||||||
- Monorepo [e.g. yes/no/Lerna]
|
- Monorepo: [e.g. yes/no/Lerna]
|
||||||
- How you are using Babel: [e.g. `cli`, `register`, `loader`]
|
- How you are using Babel: [e.g. `cli`, `register`, `loader`]
|
||||||
|
|
||||||
**Possible Solution**
|
**Possible Solution**
|
||||||
|
|||||||
7
.github/ISSUE_TEMPLATE/Feature_request.md
vendored
7
.github/ISSUE_TEMPLATE/Feature_request.md
vendored
@ -1,6 +1,9 @@
|
|||||||
---
|
---
|
||||||
name: 🚀 Feature Request
|
name: "\U0001F680 Feature Request"
|
||||||
about: I have a suggestion (and may want to implement it 🙂)!
|
about: "I have a suggestion (and may want to implement it \U0001F642)!"
|
||||||
|
title: ''
|
||||||
|
labels: 'i: enhancement, i: needs triage'
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
10
.github/ISSUE_TEMPLATE/Regression-v7.md
vendored
10
.github/ISSUE_TEMPLATE/Regression-v7.md
vendored
@ -1,12 +1,16 @@
|
|||||||
---
|
---
|
||||||
name: 💥 v7 Regression
|
name: "\U0001F4A5 v7 Regression"
|
||||||
about: Report an unexpected behavior in v7 from v6 (Check the upgrade guide first ✌️)
|
about: Report an unexpected behavior in v7 from v6 (Check the upgrade guide first
|
||||||
|
✌️)
|
||||||
|
title: ''
|
||||||
|
labels: 'i: bug, 7.x: regression, i: needs triage'
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
# v7 Regression
|
# v7 Regression
|
||||||
|
|
||||||
> First check out: https://new.babeljs.io/docs/en/next/v7-migration.html
|
> First check out: https://babeljs.io/docs/en/v7-migration
|
||||||
> Also a partial upgrade tool: https://github.com/babel/babel-upgrade
|
> Also a partial upgrade tool: https://github.com/babel/babel-upgrade
|
||||||
|
|
||||||
**Potential Commit/PR that introduced the regression**
|
**Potential Commit/PR that introduced the regression**
|
||||||
|
|||||||
7
.github/ISSUE_TEMPLATE/Support_question.md
vendored
7
.github/ISSUE_TEMPLATE/Support_question.md
vendored
@ -1,6 +1,9 @@
|
|||||||
---
|
---
|
||||||
name: 🤗 Support Question
|
name: "\U0001F917 Support Question"
|
||||||
about: If you have a question 💬, please check out our Slack or StackOverflow!
|
about: "If you have a question \U0001F4AC, please check out our Slack or StackOverflow!"
|
||||||
|
title: ''
|
||||||
|
labels: 'i: question, i: needs triage'
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
8
.github/ISSUE_TEMPLATE/Support_us.md
vendored
8
.github/ISSUE_TEMPLATE/Support_us.md
vendored
@ -1,6 +1,10 @@
|
|||||||
---
|
---
|
||||||
name: 🤝 Support us on Babel
|
name: "\U0001F91D Support us on Babel"
|
||||||
about: If you would like to support our efforts in maintaining this community-driven project 🙌!
|
about: "If you would like to support our efforts in maintaining this community-driven
|
||||||
|
project \U0001F64C!"
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
4
.github/PULL_REQUEST_TEMPLATE.md
vendored
4
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -2,6 +2,8 @@
|
|||||||
Before making a PR, please read our contributing guidelines
|
Before making a PR, please read our contributing guidelines
|
||||||
https://github.com/babel/babel/blob/master/CONTRIBUTING.md
|
https://github.com/babel/babel/blob/master/CONTRIBUTING.md
|
||||||
|
|
||||||
|
Please note that the Babel Team requires two approvals before merging most PRs.
|
||||||
|
|
||||||
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)
|
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)
|
||||||
|
|
||||||
If you are making a change that should have a docs update: submit another PR to https://github.com/babel/website
|
If you are making a change that should have a docs update: submit another PR to https://github.com/babel/website
|
||||||
@ -9,7 +11,7 @@ If you are making a change that should have a docs update: submit another PR to
|
|||||||
|
|
||||||
| Q | A <!--(Can use an emoji 👍) -->
|
| Q | A <!--(Can use an emoji 👍) -->
|
||||||
| ------------------------ | ---
|
| ------------------------ | ---
|
||||||
| Fixed Issues? | `Fixes #1, Fixes #2` <!-- remove the (`) quotes to link the issues -->
|
| Fixed Issues? | `Fixes #1, Fixes #2` <!-- remove the (`) quotes and write "Fixes" before the number to link the issues -->
|
||||||
| Patch: Bug Fix? |
|
| Patch: Bug Fix? |
|
||||||
| Major: Breaking Change? |
|
| Major: Breaking Change? |
|
||||||
| Minor: New Feature? |
|
| Minor: New Feature? |
|
||||||
|
|||||||
2
.github/lock.yml
vendored
2
.github/lock.yml
vendored
@ -4,7 +4,7 @@
|
|||||||
daysUntilLock: 91
|
daysUntilLock: 91
|
||||||
# Comment to post before locking. Set to `false` to disable
|
# Comment to post before locking. Set to `false` to disable
|
||||||
lockComment: false
|
lockComment: false
|
||||||
only: issues
|
# The label to be applied when an issue is locked
|
||||||
lockLabel: 'outdated'
|
lockLabel: 'outdated'
|
||||||
|
|
||||||
# Issues or pull requests with these labels will not be locked
|
# Issues or pull requests with these labels will not be locked
|
||||||
|
|||||||
81
.github/workflows/issue-triage.yml
vendored
Normal file
81
.github/workflows/issue-triage.yml
vendored
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
name: Issue Triage
|
||||||
|
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [opened, labeled]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
welcome:
|
||||||
|
name: Welcome comment
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Check if Babel member
|
||||||
|
id: is_babel_member
|
||||||
|
if: github.event.action == 'opened'
|
||||||
|
uses: babel/actions/is-org-member@v2
|
||||||
|
with:
|
||||||
|
org: babel
|
||||||
|
username: ${{ github.event.issue.user.login }}
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
- name: Create Welcome Comment
|
||||||
|
uses: babel/actions/create-comment@v2
|
||||||
|
if: |
|
||||||
|
github.event.action == 'opened' &&
|
||||||
|
steps.is_babel_member.outputs.result == 0
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.BOT_TOKEN }}
|
||||||
|
issue: ${{ github.event.issue.number }}
|
||||||
|
comment: >
|
||||||
|
Hey @${{ github.event.issue.user.login }}!
|
||||||
|
We really appreciate you taking the time to report an issue. The
|
||||||
|
collaborators on this project attempt to help as many people as
|
||||||
|
possible, but we're a limited number of volunteers, so it's
|
||||||
|
possible this won't be addressed swiftly.
|
||||||
|
|
||||||
|
|
||||||
|
If you need any help, or just have general Babel or JavaScript questions, we have a
|
||||||
|
vibrant [Slack community](https://babeljs.slack.com) that typically always has someone
|
||||||
|
willing to help. You can sign-up [here](https://slack.babeljs.io/) for an invite."
|
||||||
|
|
||||||
|
needs_info:
|
||||||
|
name: Needs Info
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Create Needs Info Comment
|
||||||
|
uses: babel/actions/create-comment@v2
|
||||||
|
if: |
|
||||||
|
github.event.action == 'labeled' &&
|
||||||
|
github.event.label.name == 'Needs Info'
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.BOT_TOKEN }}
|
||||||
|
issue: ${{ github.event.issue.number }}
|
||||||
|
comment: >
|
||||||
|
Hi @${{ github.event.issue.user.login }}!
|
||||||
|
This issue is missing some important information we'll need
|
||||||
|
to be able to reproduce this issue.
|
||||||
|
|
||||||
|
|
||||||
|
Please understand that we receive a high volume of issues,
|
||||||
|
and there are only a limited number of volunteers that help
|
||||||
|
maintain this project. The easier it is for us to decipher an
|
||||||
|
issue with the info provided, the more likely it is that we'll
|
||||||
|
be able to help.
|
||||||
|
|
||||||
|
|
||||||
|
Please make sure you have the following information documented in
|
||||||
|
this ticket:
|
||||||
|
|
||||||
|
1. Your Babel configuration (typically from `.babelrc` or `babel.config.js`)
|
||||||
|
|
||||||
|
2. The current (incorrect) behavior you're seeing
|
||||||
|
|
||||||
|
3. The behavior you expect
|
||||||
|
|
||||||
|
4. A [short, self-contained example](http://sscce.org/)
|
||||||
|
|
||||||
|
|
||||||
|
Please provide either a link to the problem via the
|
||||||
|
[`repl`](https://babeljs.io/repl/), or if the `repl` is
|
||||||
|
insufficient, a new and minimal repository with instructions on
|
||||||
|
how to build/replicate the issue.
|
||||||
|
|
||||||
53
.github/workflows/release.yml
vendored
Normal file
53
.github/workflows/release.yml
vendored
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
name: Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: ["v*"]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
github_release:
|
||||||
|
name: Trigger GitHub release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout the new tag
|
||||||
|
uses: actions/checkout@v1.0.0
|
||||||
|
|
||||||
|
- name: Get tag info
|
||||||
|
id: tags
|
||||||
|
uses: babel/actions/get-release-tags@v2
|
||||||
|
|
||||||
|
- name: Generate the changelog
|
||||||
|
id: changelog
|
||||||
|
uses: babel/actions/generate-lerna-changelog@v2
|
||||||
|
with:
|
||||||
|
from: ${{ steps.tags.outputs.old }}
|
||||||
|
to: ${{ steps.tags.outputs.new }}
|
||||||
|
env:
|
||||||
|
GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Create a draft GitHub release
|
||||||
|
uses: babel/actions/publish-github-release@v2
|
||||||
|
with:
|
||||||
|
tag: ${{ steps.tags.outputs.new }}
|
||||||
|
changelog: ${{ steps.changelog.outputs.changelog }}
|
||||||
|
token: ${{ secrets.BOT_TOKEN }}
|
||||||
|
|
||||||
|
- name: Check if releasing from master
|
||||||
|
id: is_master
|
||||||
|
uses: babel/actions/ref-matches-branch@v2
|
||||||
|
with:
|
||||||
|
name: master
|
||||||
|
|
||||||
|
- name: Update CHANGELOG.md
|
||||||
|
if: steps.is_master.outputs.result == 1
|
||||||
|
uses: babel/actions/update-changelog@v2
|
||||||
|
with:
|
||||||
|
changelog: ${{ steps.changelog.outputs.changelog }}
|
||||||
|
|
||||||
|
- name: Commit CHANGELOG.md
|
||||||
|
if: steps.is_master.outputs.result == 1
|
||||||
|
run: |
|
||||||
|
git add CHANGELOG.md
|
||||||
|
git -c user.name="Babel Bot" -c user.email="babel-bot@users.noreply.github.com" \
|
||||||
|
commit -m "Add ${{ steps.tags.outputs.new }} to CHANGELOG.md [skip ci]" --no-verify --quiet
|
||||||
|
git push "https://babel-bot:${{ secrets.BOT_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" master
|
||||||
11
.gitignore
vendored
11
.gitignore
vendored
@ -1,5 +1,8 @@
|
|||||||
|
.npmrc
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
/node_modules
|
/node_modules
|
||||||
|
/.github/actions/*/node_modules
|
||||||
/packages/*/node_modules
|
/packages/*/node_modules
|
||||||
/packages/*/LICENSE
|
/packages/*/LICENSE
|
||||||
!/packages/babel-parser/LICENSE
|
!/packages/babel-parser/LICENSE
|
||||||
@ -15,6 +18,7 @@ coverage
|
|||||||
dist
|
dist
|
||||||
/.package.json
|
/.package.json
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
!/.github/actions/*/package-lock.json
|
||||||
|
|
||||||
/packages/babel-runtime/helpers/*.js
|
/packages/babel-runtime/helpers/*.js
|
||||||
!/packages/babel-runtime/helpers/toArray.js
|
!/packages/babel-runtime/helpers/toArray.js
|
||||||
@ -31,11 +35,16 @@ package-lock.json
|
|||||||
!/packages/babel-runtime-corejs2/helpers/temporalRef.js
|
!/packages/babel-runtime-corejs2/helpers/temporalRef.js
|
||||||
/packages/babel-runtime-corejs2/helpers/esm/*.js
|
/packages/babel-runtime-corejs2/helpers/esm/*.js
|
||||||
!/packages/babel-runtime-corejs2/helpers/esm/toArray.js
|
!/packages/babel-runtime-corejs2/helpers/esm/toArray.js
|
||||||
!/packages/babel-runtime-corejs2/helpers/esm/iterableToArray.js
|
/packages/babel-runtime-corejs2/helpers/esm/iterableToArray.js
|
||||||
!/packages/babel-runtime-corejs2/helpers/esm/temporalRef.js
|
!/packages/babel-runtime-corejs2/helpers/esm/temporalRef.js
|
||||||
/packages/babel-runtime-corejs2/core-js/**/*.js
|
/packages/babel-runtime-corejs2/core-js/**/*.js
|
||||||
!/packages/babel-runtime-corejs2/core-js/map.js
|
!/packages/babel-runtime-corejs2/core-js/map.js
|
||||||
|
|
||||||
|
/packages/babel-runtime-corejs3/helpers/*.js
|
||||||
|
/packages/babel-runtime-corejs3/helpers/esm/*.js
|
||||||
|
/packages/babel-runtime-corejs3/core-js/**/*.js
|
||||||
|
/packages/babel-runtime-corejs3/core-js-stable/**/*.js
|
||||||
|
|
||||||
/packages/babel-register/test/.babel
|
/packages/babel-register/test/.babel
|
||||||
/packages/babel-cli/test/tmp
|
/packages/babel-cli/test/tmp
|
||||||
/packages/babel-node/test/tmp
|
/packages/babel-node/test/tmp
|
||||||
|
|||||||
@ -1,2 +1,5 @@
|
|||||||
package.json
|
package.json
|
||||||
packages/babel-preset-env/data
|
packages/babel-preset-env/data
|
||||||
|
packages/*/test/fixtures/**/input.*
|
||||||
|
packages/*/test/fixtures/**/exec.*
|
||||||
|
packages/*/test/fixtures/**/output.*
|
||||||
|
|||||||
43
.travis.yml
43
.travis.yml
@ -1,42 +1,45 @@
|
|||||||
git:
|
git:
|
||||||
depth: 10
|
depth: 5
|
||||||
sudo: false
|
|
||||||
language: node_js
|
language: node_js
|
||||||
cache:
|
cache:
|
||||||
yarn: true
|
yarn: true
|
||||||
directories:
|
|
||||||
- node_modules
|
os: linux
|
||||||
node_js:
|
|
||||||
# We test the latest version on circleci
|
|
||||||
- '9'
|
|
||||||
- '8'
|
|
||||||
- '6'
|
|
||||||
|
|
||||||
env:
|
env:
|
||||||
global:
|
global:
|
||||||
- PATH=$HOME/.yarn/bin:$PATH
|
- PATH=$HOME/.yarn/bin:$PATH
|
||||||
- JOB=test
|
- JOB=test
|
||||||
|
|
||||||
before_install:
|
install: skip
|
||||||
- curl -o- -L https://yarnpkg.com/install.sh | bash
|
|
||||||
|
|
||||||
install: yarn --ignore-engines
|
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- 'if [ "$JOB" = "babel-parser-flow-tests" ]; then make bootstrap-flow; fi'
|
- curl -o- -L https://yarnpkg.com/install.sh | bash
|
||||||
- 'if [ "$JOB" = "babel-parser-test262-tests" ]; then make bootstrap-test262; fi'
|
- if [ "$TRAVIS_OS_NAME" = "windows" ]; then choco install make; fi
|
||||||
|
|
||||||
script:
|
script:
|
||||||
- 'if [ "$JOB" = "test" ]; then make test-ci; fi'
|
- if [ "$JOB" = "test" ]; then make -j test-ci; fi
|
||||||
- 'if [ "$JOB" = "lint" ]; then make lint && make flow; fi'
|
- if [ "$JOB" = "lint" ]; then make -j code-quality-ci; fi
|
||||||
- 'if [ "$JOB" = "babel-parser-flow-tests" ]; then make test-flow-ci; fi'
|
- if [ "$JOB" = "babel-parser-flow-tests" ]; then make -j test-flow-ci; fi
|
||||||
- 'if [ "$JOB" = "babel-parser-test262-tests" ]; then make test-test262-ci; fi'
|
- if [ "$JOB" = "babel-parser-test262-tests" ]; then make -j test-test262-ci; fi
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
fast_finish: true
|
fast_finish: true
|
||||||
include:
|
include:
|
||||||
- node_js: "node"
|
- node_js: "node"
|
||||||
env: JOB=lint
|
env: JOB=lint
|
||||||
|
# We test the latest version on circleci
|
||||||
|
- node_js: "12"
|
||||||
|
# Move `windows` build to be the third since it is slow
|
||||||
|
- os: windows
|
||||||
|
node_js: "node"
|
||||||
|
env:
|
||||||
|
- JOB=test
|
||||||
|
# https://travis-ci.community/t/build-doesnt-finish-after-completing-tests/288/9
|
||||||
|
- YARN_GPG=no
|
||||||
|
# Continue node_js matrix
|
||||||
|
- node_js: "6"
|
||||||
|
- node_js: "10"
|
||||||
|
- node_js: "8"
|
||||||
- node_js: "node"
|
- node_js: "node"
|
||||||
env: JOB=babel-parser-flow-tests
|
env: JOB=babel-parser-flow-tests
|
||||||
- node_js: "node"
|
- node_js: "node"
|
||||||
|
|||||||
1077
CHANGELOG.md
1077
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@ -32,6 +32,7 @@ contributing, please read the
|
|||||||
- Follow along with what we are working on by joining our [Slack](https://babeljs.slack.com) (you can sign-up [here](https://slack.babeljs.io/)
|
- Follow along with what we are working on by joining our [Slack](https://babeljs.slack.com) (you can sign-up [here](https://slack.babeljs.io/)
|
||||||
for an invite), following our announcements on [Twitter](https://twitter.com/babeljs), and reading (or participating!) in our [meeting notes](https://github.com/babel/notes).
|
for an invite), 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)
|
- Check out our [website](http://babeljs.io/) and the [repo](https://github.com/babel/website)
|
||||||
|
- You can contribute by triaging issues which may include reproducing bug reports or asking for vital information, such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to [subscribe to babel on CodeTriage](https://www.codetriage.com/babel/babel). [](https://www.codetriage.com/babel/babel)
|
||||||
|
|
||||||
## Chat
|
## Chat
|
||||||
|
|
||||||
@ -310,7 +311,7 @@ Note that the code shown in Chrome DevTools is compiled code and therefore diffe
|
|||||||
- Create a new issue that describes the proposal (ex: [#538](https://github.com/babel/babylon/issues/538)). Include any relevant information like proposal repo/author, examples, parsing approaches, meeting notes, presentation slides, and more.
|
- Create a new issue that describes the proposal (ex: [#538](https://github.com/babel/babylon/issues/538)). Include any relevant information like proposal repo/author, examples, parsing approaches, meeting notes, presentation slides, and more.
|
||||||
- The pull request should include:
|
- The pull request should include:
|
||||||
- [ ] An update to the [plugins](https://github.com/babel/babel/tree/master/packages/babel-parser#plugins) part of the readme. Add a new entry to that list for the new plugin flag (and link to the proposal)
|
- [ ] An update to the [plugins](https://github.com/babel/babel/tree/master/packages/babel-parser#plugins) part of the readme. Add a new entry to that list for the new plugin flag (and link to the proposal)
|
||||||
- [ ] If any new nodes or modifications need to be added to the AST, update [ast/spec.md](https://github.com/babel/babel/bloc/master/packages/babel-parser/ast/spec.md)
|
- [ ] If any new nodes or modifications need to be added to the AST, update [ast/spec.md](https://github.com/babel/babel/blob/master/packages/babel-parser/ast/spec.md)
|
||||||
- [ ] Make sure you use the `this.hasPlugin("plugin-name-here")` check in the babel parser so that your new plugin code only runs when that flag is turned on (not default behavior)
|
- [ ] Make sure you use the `this.hasPlugin("plugin-name-here")` check in the babel parser so that your new plugin code only runs when that flag is turned on (not default behavior)
|
||||||
- [ ] Add failing/passing tests according to spec behavior
|
- [ ] Add failing/passing tests according to spec behavior
|
||||||
- Start working about the Babel transform itself!
|
- Start working about the Babel transform itself!
|
||||||
|
|||||||
82
Gulpfile.js
82
Gulpfile.js
@ -6,43 +6,32 @@ const chalk = require("chalk");
|
|||||||
const newer = require("gulp-newer");
|
const newer = require("gulp-newer");
|
||||||
const babel = require("gulp-babel");
|
const babel = require("gulp-babel");
|
||||||
const gulpWatch = require("gulp-watch");
|
const gulpWatch = require("gulp-watch");
|
||||||
const gutil = require("gulp-util");
|
const fancyLog = require("fancy-log");
|
||||||
const filter = require("gulp-filter");
|
const filter = require("gulp-filter");
|
||||||
const gulp = require("gulp");
|
const gulp = require("gulp");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const webpack = require("webpack");
|
const webpack = require("webpack");
|
||||||
const merge = require("merge-stream");
|
const rollup = require("rollup");
|
||||||
const rollup = require("rollup-stream");
|
|
||||||
const source = require("vinyl-source-stream");
|
|
||||||
const buffer = require("vinyl-buffer");
|
|
||||||
const rollupBabel = require("rollup-plugin-babel");
|
const rollupBabel = require("rollup-plugin-babel");
|
||||||
const rollupNodeResolve = require("rollup-plugin-node-resolve");
|
const rollupNodeResolve = require("rollup-plugin-node-resolve");
|
||||||
const registerStandalonePackageTask = require("./scripts/gulp-tasks")
|
const rollupReplace = require("rollup-plugin-replace");
|
||||||
.registerStandalonePackageTask;
|
const { registerStandalonePackageTask } = require("./scripts/gulp-tasks");
|
||||||
|
|
||||||
const sources = ["codemods", "packages"];
|
const defaultSourcesGlob = "./@(codemods|packages)/*/src/**/*.js";
|
||||||
|
|
||||||
function swapSrcWithLib(srcPath) {
|
function swapSrcWithLib(srcPath) {
|
||||||
const parts = srcPath.split(path.sep);
|
const parts = srcPath.split(path.sep);
|
||||||
parts[1] = "lib";
|
parts[2] = "lib";
|
||||||
return parts.join(path.sep);
|
return parts.join(path.sep);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getGlobFromSource(source) {
|
|
||||||
return `./${source}/*/src/**/*.js`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getIndexFromPackage(name) {
|
function getIndexFromPackage(name) {
|
||||||
return `${name}/src/index.js`;
|
return `${name}/src/index.js`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function compilationLogger(rollup) {
|
function compilationLogger() {
|
||||||
return through.obj(function(file, enc, callback) {
|
return through.obj(function(file, enc, callback) {
|
||||||
gutil.log(
|
fancyLog(`Compiling '${chalk.cyan(file.relative)}'...`);
|
||||||
`Compiling '${chalk.cyan(file.relative)}'${
|
|
||||||
rollup ? " with rollup " : ""
|
|
||||||
}...`
|
|
||||||
);
|
|
||||||
callback(null, file);
|
callback(null, file);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -50,7 +39,7 @@ function compilationLogger(rollup) {
|
|||||||
function errorsLogger() {
|
function errorsLogger() {
|
||||||
return plumber({
|
return plumber({
|
||||||
errorHandler(err) {
|
errorHandler(err) {
|
||||||
gutil.log(err.stack);
|
fancyLog(err.stack);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -62,12 +51,10 @@ function rename(fn) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildBabel(exclude) {
|
function buildBabel(exclude, sourcesGlob = defaultSourcesGlob) {
|
||||||
return merge(
|
const base = __dirname;
|
||||||
sources.map(source => {
|
|
||||||
const base = path.join(__dirname, source);
|
|
||||||
|
|
||||||
let stream = gulp.src(getGlobFromSource(source), { base: base });
|
let stream = gulp.src(sourcesGlob, { base: __dirname });
|
||||||
|
|
||||||
if (exclude) {
|
if (exclude) {
|
||||||
const filters = exclude.map(p => `!**/${p}/**`);
|
const filters = exclude.map(p => `!**/${p}/**`);
|
||||||
@ -86,37 +73,46 @@ function buildBabel(exclude) {
|
|||||||
rename(file => path.resolve(file.base, swapSrcWithLib(file.relative)))
|
rename(file => path.resolve(file.base, swapSrcWithLib(file.relative)))
|
||||||
)
|
)
|
||||||
.pipe(gulp.dest(base));
|
.pipe(gulp.dest(base));
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildRollup(packages) {
|
function buildRollup(packages) {
|
||||||
return merge(
|
return Promise.all(
|
||||||
packages.map(pkg => {
|
packages.map(pkg => {
|
||||||
return rollup({
|
const input = getIndexFromPackage(pkg);
|
||||||
input: getIndexFromPackage(pkg),
|
fancyLog(`Compiling '${chalk.cyan(input)}' with rollup ...`);
|
||||||
format: "cjs",
|
return rollup
|
||||||
|
.rollup({
|
||||||
|
input,
|
||||||
plugins: [
|
plugins: [
|
||||||
|
rollupReplace({
|
||||||
|
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV),
|
||||||
|
}),
|
||||||
rollupBabel({
|
rollupBabel({
|
||||||
envName: "babel-parser",
|
envName: "babel-parser",
|
||||||
}),
|
}),
|
||||||
rollupNodeResolve(),
|
rollupNodeResolve(),
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
.pipe(source("index.js"))
|
.then(bundle => {
|
||||||
.pipe(buffer())
|
return bundle.write({
|
||||||
.pipe(errorsLogger())
|
file: path.join(pkg, "lib/index.js"),
|
||||||
.pipe(compilationLogger(/* rollup */ true))
|
format: "cjs",
|
||||||
.pipe(gulp.dest(path.join(pkg, "lib")));
|
name: "babel-parser",
|
||||||
|
sourcemap: process.env.NODE_ENV !== "production",
|
||||||
|
});
|
||||||
|
});
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
gulp.task("build", function() {
|
const bundles = ["packages/babel-parser"];
|
||||||
const bundles = ["packages/babel-parser"];
|
|
||||||
|
|
||||||
return merge([buildBabel(/* exclude */ bundles), buildRollup(bundles)]);
|
gulp.task("build-rollup", () => buildRollup(bundles));
|
||||||
});
|
gulp.task("build-babel", () => buildBabel(/* exclude */ bundles));
|
||||||
|
gulp.task("build-babel-types", () =>
|
||||||
|
buildBabel(/* exclude */ bundles, "packages/babel-types/src/**/*.js")
|
||||||
|
);
|
||||||
|
gulp.task("build", gulp.parallel("build-rollup", "build-babel"));
|
||||||
|
|
||||||
gulp.task("default", gulp.series("build"));
|
gulp.task("default", gulp.series("build"));
|
||||||
|
|
||||||
@ -126,7 +122,7 @@ gulp.task(
|
|||||||
"watch",
|
"watch",
|
||||||
gulp.series("build-no-bundle", function watch() {
|
gulp.series("build-no-bundle", function watch() {
|
||||||
gulpWatch(
|
gulpWatch(
|
||||||
sources.map(getGlobFromSource),
|
defaultSourcesGlob,
|
||||||
{ debounceDelay: 200 },
|
{ debounceDelay: 200 },
|
||||||
gulp.task("build-no-bundle")
|
gulp.task("build-no-bundle")
|
||||||
);
|
);
|
||||||
@ -138,7 +134,7 @@ registerStandalonePackageTask(
|
|||||||
"babel",
|
"babel",
|
||||||
"Babel",
|
"Babel",
|
||||||
path.join(__dirname, "packages"),
|
path.join(__dirname, "packages"),
|
||||||
require("./packages/babel-core/package.json").version
|
require("./packages/babel-standalone/package.json").version
|
||||||
);
|
);
|
||||||
|
|
||||||
const presetEnvWebpackPlugins = [
|
const presetEnvWebpackPlugins = [
|
||||||
@ -167,6 +163,6 @@ registerStandalonePackageTask(
|
|||||||
"babel-preset-env",
|
"babel-preset-env",
|
||||||
"babelPresetEnv",
|
"babelPresetEnv",
|
||||||
path.join(__dirname, "packages"),
|
path.join(__dirname, "packages"),
|
||||||
require("./packages/babel-preset-env/package.json").version,
|
require("./packages/babel-preset-env-standalone/package.json").version,
|
||||||
presetEnvWebpackPlugins
|
presetEnvWebpackPlugins
|
||||||
);
|
);
|
||||||
|
|||||||
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
|||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2014-2018 Sebastian McKenzie and other contributors
|
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
a copy of this software and associated documentation files (the
|
a copy of this software and associated documentation files (the
|
||||||
|
|||||||
207
Makefile
207
Makefile
@ -1,6 +1,5 @@
|
|||||||
MAKEFLAGS = -j1
|
FLOW_COMMIT = 09669846b7a7ca5a6c23c12d56bb3bebdafd67e9
|
||||||
FLOW_COMMIT = bea8b83f50f597454941d2a7ecef6e93a881e576
|
TEST262_COMMIT = 8688c4ab79059c3097098605e69f1ee5eda6c409
|
||||||
TEST262_COMMIT = 06c2f019019cf7850923de4d56828e6dfd9212b8
|
|
||||||
|
|
||||||
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
|
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
|
||||||
export FORCE_COLOR = true
|
export FORCE_COLOR = true
|
||||||
@ -9,53 +8,113 @@ SOURCES = packages codemods
|
|||||||
|
|
||||||
.PHONY: build build-dist watch lint fix clean test-clean test-only test test-ci publish bootstrap
|
.PHONY: build build-dist watch lint fix clean test-clean test-only test test-ci publish bootstrap
|
||||||
|
|
||||||
build: clean clean-lib
|
build: build-bundle
|
||||||
./node_modules/.bin/gulp build
|
|
||||||
node ./packages/babel-types/scripts/generateTypeHelpers.js
|
|
||||||
# call build again as the generated files might need to be compiled again.
|
|
||||||
./node_modules/.bin/gulp build
|
|
||||||
# generate flow and typescript typings
|
|
||||||
node scripts/generators/flow.js > ./packages/babel-types/lib/index.js.flow
|
|
||||||
node scripts/generators/typescript.js > ./packages/babel-types/lib/index.d.ts
|
|
||||||
ifneq ("$(BABEL_COVERAGE)", "true")
|
ifneq ("$(BABEL_COVERAGE)", "true")
|
||||||
make build-standalone
|
$(MAKE) build-standalone
|
||||||
make build-preset-env-standalone
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
build-standalone:
|
build-bundle: clean clean-lib
|
||||||
./node_modules/.bin/gulp build-babel-standalone
|
yarn gulp build
|
||||||
|
$(MAKE) generate-standalone generate-type-helpers
|
||||||
|
# call build again as the generated files might need to be compiled again.
|
||||||
|
yarn gulp build
|
||||||
|
$(MAKE) build-typings
|
||||||
|
$(MAKE) build-dist
|
||||||
|
|
||||||
|
build-bundle-ci: bootstrap-only
|
||||||
|
$(MAKE) build-bundle
|
||||||
|
|
||||||
|
generate-standalone:
|
||||||
|
node packages/babel-standalone/scripts/generate.js
|
||||||
|
|
||||||
|
generate-type-helpers:
|
||||||
|
node packages/babel-types/scripts/generateTypeHelpers.js
|
||||||
|
|
||||||
|
build-typings: build-flow-typings build-typescript-typings
|
||||||
|
|
||||||
|
build-flow-typings:
|
||||||
|
node packages/babel-types/scripts/generators/flow.js > packages/babel-types/lib/index.js.flow
|
||||||
|
|
||||||
|
build-typescript-typings:
|
||||||
|
node packages/babel-types/scripts/generators/typescript.js > packages/babel-types/lib/index.d.ts
|
||||||
|
|
||||||
|
build-standalone: build-babel-standalone build-preset-env-standalone
|
||||||
|
|
||||||
|
build-standalone-ci: build-bundle-ci
|
||||||
|
$(MAKE) build-standalone
|
||||||
|
|
||||||
|
build-babel-standalone:
|
||||||
|
yarn gulp build-babel-standalone
|
||||||
|
|
||||||
build-preset-env-standalone:
|
build-preset-env-standalone:
|
||||||
./node_modules/.bin/gulp build-babel-preset-env-standalone
|
yarn gulp build-babel-preset-env-standalone
|
||||||
|
|
||||||
build-dist: build
|
prepublish-build-standalone:
|
||||||
|
BABEL_ENV=production IS_PUBLISH=true yarn gulp build-babel-standalone
|
||||||
|
|
||||||
|
prepublish-build-preset-env-standalone:
|
||||||
|
BABEL_ENV=production IS_PUBLISH=true yarn gulp build-babel-preset-env-standalone
|
||||||
|
|
||||||
|
build-dist: build-polyfill-dist build-plugin-transform-runtime-dist
|
||||||
|
|
||||||
|
build-polyfill-dist:
|
||||||
cd packages/babel-polyfill; \
|
cd packages/babel-polyfill; \
|
||||||
scripts/build-dist.sh
|
scripts/build-dist.sh
|
||||||
|
|
||||||
|
build-plugin-transform-runtime-dist:
|
||||||
cd packages/babel-plugin-transform-runtime; \
|
cd packages/babel-plugin-transform-runtime; \
|
||||||
node scripts/build-dist.js
|
node scripts/build-dist.js
|
||||||
|
|
||||||
watch: clean clean-lib
|
build-no-bundle: clean clean-lib
|
||||||
|
BABEL_ENV=development yarn gulp build-no-bundle
|
||||||
# Ensure that build artifacts for types are created during local
|
# Ensure that build artifacts for types are created during local
|
||||||
# development too.
|
# development too.
|
||||||
BABEL_ENV=development ./node_modules/.bin/gulp build-no-bundle
|
$(MAKE) generate-type-helpers
|
||||||
node ./packages/babel-types/scripts/generateTypeHelpers.js
|
$(MAKE) build-typings
|
||||||
node scripts/generators/flow.js > ./packages/babel-types/lib/index.js.flow
|
|
||||||
BABEL_ENV=development ./node_modules/.bin/gulp watch
|
watch: build-no-bundle
|
||||||
|
BABEL_ENV=development yarn gulp watch
|
||||||
|
|
||||||
|
code-quality-ci: flowcheck-ci lint-ci
|
||||||
|
|
||||||
|
flowcheck-ci: bootstrap-flowcheck
|
||||||
|
$(MAKE) flow
|
||||||
|
|
||||||
|
code-quality: flow lint
|
||||||
|
|
||||||
flow:
|
flow:
|
||||||
./node_modules/.bin/flow check --strip-root
|
yarn flow check --strip-root
|
||||||
|
|
||||||
lint:
|
bootstrap-flowcheck: bootstrap-only
|
||||||
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe
|
yarn gulp build-babel-types
|
||||||
|
$(MAKE) build-typings
|
||||||
|
|
||||||
fix: fix-json
|
lint-ci: lint-js-ci lint-ts-ci
|
||||||
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe --fix
|
|
||||||
|
lint-js-ci: bootstrap-only
|
||||||
|
$(MAKE) lint-js
|
||||||
|
|
||||||
|
lint-ts-ci: bootstrap-flowcheck
|
||||||
|
$(MAKE) lint-ts
|
||||||
|
|
||||||
|
lint: lint-js lint-ts
|
||||||
|
|
||||||
|
lint-js:
|
||||||
|
yarn eslint scripts $(SOURCES) '*.js' --format=codeframe
|
||||||
|
|
||||||
|
lint-ts:
|
||||||
|
scripts/tests/typescript/lint.sh
|
||||||
|
|
||||||
|
fix: fix-json fix-js
|
||||||
|
|
||||||
|
fix-js:
|
||||||
|
yarn eslint scripts $(SOURCES) '*.js' --format=codeframe --fix
|
||||||
|
|
||||||
fix-json:
|
fix-json:
|
||||||
./node_modules/.bin/prettier "{packages,codemod}/*/test/fixtures/**/options.json" --write --loglevel warn
|
yarn prettier "{packages,codemod}/*/test/fixtures/**/options.json" --write --loglevel warn
|
||||||
|
|
||||||
clean: test-clean
|
clean: test-clean
|
||||||
|
rm -f .npmrc
|
||||||
rm -rf packages/babel-polyfill/browser*
|
rm -rf packages/babel-polyfill/browser*
|
||||||
rm -rf packages/babel-polyfill/dist
|
rm -rf packages/babel-polyfill/dist
|
||||||
rm -rf coverage
|
rm -rf coverage
|
||||||
@ -65,80 +124,112 @@ test-clean:
|
|||||||
$(foreach source, $(SOURCES), \
|
$(foreach source, $(SOURCES), \
|
||||||
$(call clean-source-test, $(source)))
|
$(call clean-source-test, $(source)))
|
||||||
|
|
||||||
|
# Does not work on Windows; use "yarn jest" instead
|
||||||
test-only:
|
test-only:
|
||||||
BABEL_ENV=test ./scripts/test.sh
|
BABEL_ENV=test ./scripts/test.sh
|
||||||
make test-clean
|
$(MAKE) test-clean
|
||||||
|
|
||||||
test: lint test-only
|
test: lint test-only
|
||||||
|
|
||||||
test-ci: bootstrap test-only
|
test-ci: jest-ci
|
||||||
|
|
||||||
|
jest-ci: build-standalone-ci
|
||||||
|
BABEL_ENV=test yarn jest --maxWorkers=4 --ci
|
||||||
|
$(MAKE) test-clean
|
||||||
|
|
||||||
|
# Does not work on Windows
|
||||||
test-ci-coverage: SHELL:=/bin/bash
|
test-ci-coverage: SHELL:=/bin/bash
|
||||||
test-ci-coverage:
|
test-ci-coverage:
|
||||||
BABEL_COVERAGE=true BABEL_ENV=test make bootstrap
|
BABEL_COVERAGE=true BABEL_ENV=test $(MAKE) bootstrap
|
||||||
BABEL_ENV=test TEST_TYPE=cov ./scripts/test-cov.sh
|
BABEL_ENV=test TEST_TYPE=cov ./scripts/test-cov.sh
|
||||||
bash <(curl -s https://codecov.io/bash) -f coverage/coverage-final.json
|
bash <(curl -s https://codecov.io/bash) -f coverage/coverage-final.json
|
||||||
|
|
||||||
bootstrap-flow:
|
bootstrap-flow:
|
||||||
rm -rf ./build/flow
|
rm -rf build/flow
|
||||||
mkdir -p ./build
|
mkdir -p build
|
||||||
git clone --branch=master --single-branch --shallow-since=2017-01-01 https://github.com/facebook/flow.git ./build/flow
|
git clone --branch=master --single-branch --shallow-since=2018-11-01 https://github.com/facebook/flow.git build/flow
|
||||||
cd build/flow && git checkout $(FLOW_COMMIT)
|
cd build/flow && git checkout $(FLOW_COMMIT)
|
||||||
|
|
||||||
test-flow:
|
test-flow:
|
||||||
node scripts/tests/flow/run_babel_parser_flow_tests.js
|
node scripts/tests/flow/run_babel_parser_flow_tests.js
|
||||||
|
|
||||||
test-flow-ci: bootstrap test-flow
|
test-flow-ci: build-bundle-ci bootstrap-flow
|
||||||
|
$(MAKE) test-flow
|
||||||
|
|
||||||
test-flow-update-whitelist:
|
test-flow-update-whitelist:
|
||||||
node scripts/tests/flow/run_babel_parser_flow_tests.js --update-whitelist
|
node scripts/tests/flow/run_babel_parser_flow_tests.js --update-whitelist
|
||||||
|
|
||||||
bootstrap-test262:
|
bootstrap-test262:
|
||||||
rm -rf ./build/test262
|
rm -rf build/test262
|
||||||
mkdir -p ./build
|
mkdir -p build
|
||||||
git clone --branch=master --single-branch --shallow-since=2017-01-01 https://github.com/tc39/test262.git ./build/test262
|
git clone --branch=master --single-branch --shallow-since=2019-09-01 https://github.com/tc39/test262.git build/test262
|
||||||
cd build/test262 && git checkout $(TEST262_COMMIT)
|
cd build/test262 && git checkout $(TEST262_COMMIT)
|
||||||
|
|
||||||
test-test262:
|
test-test262:
|
||||||
node scripts/tests/test262/run_babel_parser_test262.js
|
node scripts/tests/test262/run_babel_parser_test262.js
|
||||||
|
|
||||||
test-test262-ci: bootstrap test-test262
|
test-test262-ci: build-bundle-ci bootstrap-test262
|
||||||
|
$(MAKE) test-test262
|
||||||
|
|
||||||
test-test262-update-whitelist:
|
test-test262-update-whitelist:
|
||||||
node scripts/tests/test262/run_babel_parser_test262.js --update-whitelist
|
node scripts/tests/test262/run_babel_parser_test262.js --update-whitelist
|
||||||
|
|
||||||
|
# Does not work on Windows
|
||||||
clone-license:
|
clone-license:
|
||||||
./scripts/clone-license.sh
|
./scripts/clone-license.sh
|
||||||
|
|
||||||
prepublish-build:
|
prepublish-build: clean-lib clean-runtime-helpers
|
||||||
make clean-lib
|
NODE_ENV=production BABEL_ENV=production $(MAKE) build
|
||||||
rm -rf packages/babel-runtime/helpers
|
$(MAKE) clone-license
|
||||||
rm -rf packages/babel-runtime-corejs2/helpers
|
|
||||||
rm -rf packages/babel-runtime-corejs2/core-js
|
|
||||||
BABEL_ENV=production make build-dist
|
|
||||||
make clone-license
|
|
||||||
|
|
||||||
prepublish:
|
prepublish:
|
||||||
|
$(MAKE) bootstrap-only
|
||||||
|
$(MAKE) prepublish-build
|
||||||
|
$(MAKE) test
|
||||||
|
|
||||||
|
new-version:
|
||||||
git pull --rebase
|
git pull --rebase
|
||||||
make prepublish-build
|
yarn lerna version --force-publish="@babel/runtime,@babel/runtime-corejs2,@babel/runtime-corejs3,@babel/standalone,@babel/preset-env-standalone"
|
||||||
make test
|
|
||||||
|
|
||||||
|
publish-cerxes: prepublish
|
||||||
|
yarn lerna publish --registry="https://npm.cerxes.net" --force-publish --allow-branch initializers-fix --canary --preid csx --dist-tag csx
|
||||||
|
|
||||||
|
# NOTE: Run make new-version first
|
||||||
publish: prepublish
|
publish: prepublish
|
||||||
# --only-explicit-updates
|
yarn lerna publish from-git
|
||||||
./node_modules/.bin/lerna publish
|
$(MAKE) clean
|
||||||
make clean
|
|
||||||
|
|
||||||
bootstrap: clean-all
|
publish-ci: prepublish
|
||||||
|
ifneq ("$(NPM_TOKEN)", "")
|
||||||
|
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
|
||||||
|
else
|
||||||
|
echo "Missing NPM_TOKEN env var"
|
||||||
|
exit 1
|
||||||
|
endif
|
||||||
|
yarn lerna publish from-git --yes
|
||||||
|
rm -f .npmrc
|
||||||
|
$(MAKE) clean
|
||||||
|
|
||||||
|
bootstrap-only: lerna-bootstrap
|
||||||
|
|
||||||
|
yarn-install: clean-all
|
||||||
yarn --ignore-engines
|
yarn --ignore-engines
|
||||||
./node_modules/.bin/lerna bootstrap -- --ignore-engines
|
|
||||||
make build
|
lerna-bootstrap: yarn-install
|
||||||
cd packages/babel-plugin-transform-runtime; \
|
yarn lerna bootstrap
|
||||||
node scripts/build-dist.js
|
|
||||||
|
bootstrap: bootstrap-only
|
||||||
|
$(MAKE) build
|
||||||
|
|
||||||
clean-lib:
|
clean-lib:
|
||||||
$(foreach source, $(SOURCES), \
|
$(foreach source, $(SOURCES), \
|
||||||
$(call clean-source-lib, $(source)))
|
$(call clean-source-lib, $(source)))
|
||||||
|
|
||||||
|
clean-runtime-helpers:
|
||||||
|
rm -rf packages/babel-runtime/helpers
|
||||||
|
rm -rf packages/babel-runtime-corejs2/helpers
|
||||||
|
rm -rf packages/babel-runtime-corejs2/core-js
|
||||||
|
|
||||||
clean-all:
|
clean-all:
|
||||||
rm -rf node_modules
|
rm -rf node_modules
|
||||||
rm -rf package-lock.json
|
rm -rf package-lock.json
|
||||||
@ -147,7 +238,7 @@ clean-all:
|
|||||||
$(foreach source, $(SOURCES), \
|
$(foreach source, $(SOURCES), \
|
||||||
$(call clean-source-all, $(source)))
|
$(call clean-source-all, $(source)))
|
||||||
|
|
||||||
make clean
|
$(MAKE) clean
|
||||||
|
|
||||||
define clean-source-lib
|
define clean-source-lib
|
||||||
rm -rf $(1)/*/lib
|
rm -rf $(1)/*/lib
|
||||||
|
|||||||
75
README.md
75
README.md
@ -5,15 +5,26 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
The compiler for writing next generation JavaScript.
|
<span style="color:darkred">
|
||||||
|
<b><i>WARNING</i> This is a fork of babel to test a fix for initializer-variables with class-properties (proposals-stuff)</b>
|
||||||
|
</span>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://travis-ci.org/babel/babel"><img alt="Travis Status" src="https://img.shields.io/travis/babel/babel/master.svg?label=travis&maxAge=43200"></a>
|
The compiler for writing next generation JavaScript.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://www.npmjs.com/package/@babel/core"><img alt="v7 npm Downloads" src="https://img.shields.io/npm/dm/@babel/core.svg?maxAge=43200&label=v7%20downloads"></a>
|
||||||
|
<a href="https://www.npmjs.com/package/babel-core"><img alt="v6 npm Downloads" src="https://img.shields.io/npm/dm/babel-core.svg?maxAge=43200&label=v6%20downloads"></a>
|
||||||
|
</p>
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://travis-ci.com/babel/babel"><img alt="Travis Status" src="https://img.shields.io/travis/com/babel/babel/master.svg?label=travis&maxAge=43200"></a>
|
||||||
<a href="https://circleci.com/gh/babel/babel"><img alt="CircleCI Status" src="https://img.shields.io/circleci/project/github/babel/babel/master.svg?label=circle&maxAge=43200"></a>
|
<a href="https://circleci.com/gh/babel/babel"><img alt="CircleCI Status" src="https://img.shields.io/circleci/project/github/babel/babel/master.svg?label=circle&maxAge=43200"></a>
|
||||||
<a href="https://codecov.io/github/babel/babel"><img alt="Coverage Status" src="https://img.shields.io/codecov/c/github/babel/babel/master.svg?maxAge=43200"></a>
|
<a href="https://codecov.io/github/babel/babel"><img alt="Coverage Status" src="https://img.shields.io/codecov/c/github/babel/babel/master.svg?maxAge=43200"></a>
|
||||||
<a href="https://slack.babeljs.io/"><img alt="Slack Status" src="https://slack.babeljs.io/badge.svg"></a>
|
<a href="https://slack.babeljs.io/"><img alt="Slack Status" src="https://slack.babeljs.io/badge.svg"></a>
|
||||||
<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>
|
<a href="https://twitter.com/intent/follow?screen_name=babeljs"><img alt="Follow on Twitter" src="https://img.shields.io/twitter/follow/babeljs.svg?style=social&label=Follow"></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<h2 align="center">Supporting Babel</h2>
|
<h2 align="center">Supporting Babel</h2>
|
||||||
@ -27,11 +38,11 @@
|
|||||||
Babel (pronounced ["babble"](https://soundcloud.com/sebmck/how-to-pronounce-babel)) is a community-driven project used by many companies and projects, and is maintained by a group of [volunteers](https://babeljs.io/team). If you'd like to help support the future of the project, please consider:
|
Babel (pronounced ["babble"](https://soundcloud.com/sebmck/how-to-pronounce-babel)) is a community-driven project used by many companies and projects, and is maintained by a group of [volunteers](https://babeljs.io/team). If you'd like to help support the future of the project, please consider:
|
||||||
|
|
||||||
- Giving developer time on the project. (Message us on [Twitter](https://twitter.com/babeljs) or [Slack](https://slack.babeljs.io/) for guidance!)
|
- Giving developer time on the project. (Message us on [Twitter](https://twitter.com/babeljs) or [Slack](https://slack.babeljs.io/) for guidance!)
|
||||||
- Giving funds by becoming a sponsor (see below)!
|
- Giving funds by becoming a sponsor on [Open Collective](https://opencollective.com/babel) or [Patreon](https://www.patreon.com/henryzhu)!
|
||||||
|
|
||||||
## Open Collective 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)]
|
Our top sponsors are shown below! [[Become a sponsor](https://opencollective.com/babel#sponsor)]
|
||||||
|
|
||||||
<a href="https://opencollective.com/babel/sponsor/0/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/0/avatar.svg"></a>
|
<a href="https://opencollective.com/babel/sponsor/0/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/0/avatar.svg"></a>
|
||||||
<a href="https://opencollective.com/babel/sponsor/1/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/1/avatar.svg"></a>
|
<a href="https://opencollective.com/babel/sponsor/1/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/1/avatar.svg"></a>
|
||||||
@ -48,35 +59,6 @@ Become a sponsor and get your logo on our README on Github with a link to your s
|
|||||||
<a href="https://opencollective.com/babel/sponsor/12/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/12/avatar.svg"></a>
|
<a href="https://opencollective.com/babel/sponsor/12/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/12/avatar.svg"></a>
|
||||||
<a href="https://opencollective.com/babel/sponsor/13/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/13/avatar.svg"></a>
|
<a href="https://opencollective.com/babel/sponsor/13/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/13/avatar.svg"></a>
|
||||||
<a href="https://opencollective.com/babel/sponsor/14/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/14/avatar.svg"></a>
|
<a href="https://opencollective.com/babel/sponsor/14/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/14/avatar.svg"></a>
|
||||||
<a href="https://opencollective.com/babel/sponsor/15/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/15/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/babel/sponsor/16/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/16/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/babel/sponsor/17/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/17/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/babel/sponsor/18/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/18/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/babel/sponsor/19/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/19/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/babel/sponsor/20/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/20/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/babel/sponsor/21/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/21/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/babel/sponsor/22/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/22/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/babel/sponsor/23/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/23/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/babel/sponsor/24/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/24/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/babel/sponsor/25/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/25/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/babel/sponsor/26/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/26/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/babel/sponsor/27/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/27/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/babel/sponsor/28/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/28/avatar.svg"></a>
|
|
||||||
<a href="https://opencollective.com/babel/sponsor/29/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/29/avatar.svg"></a>
|
|
||||||
|
|
||||||
## Patreon Sponsors
|
|
||||||
|
|
||||||
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://www.patreon.com/henryzhu)]
|
|
||||||
|
|
||||||
## Silver
|
|
||||||
|
|
||||||
<a href="https://issue.sh/?utm_medium=github&utm_campaign=babel" target="_blank"><img src="https://user-images.githubusercontent.com/5557143/43912065-c8cdff78-9c33-11e8-829a-0b4166ccc215.png"></a>
|
|
||||||
|
|
||||||
## Bronze
|
|
||||||
|
|
||||||
<a href="http://teamextension.io/" target="_blank"><img src="https://teamextension.io/dist/img/logo/te-logo-compact.png" height="64"></a>
|
|
||||||
<a href="https://webflow.com/" target="_blank"><img src="https://opencollective.com/proxy/images/?src=https%3A%2F%2Fopencollective-production.s3-us-west-1.amazonaws.com%2F4a5024b0-8cf2-11e7-b1a2-b30b1de1463c.png&height=64"></a>
|
|
||||||
<p><a href="https://twitter.com/mikesherov">Mike Sherov</a></p>
|
|
||||||
|
|
||||||
## Intro
|
## Intro
|
||||||
|
|
||||||
@ -103,16 +85,16 @@ Try it out at our [REPL](https://babeljs.io/repl/build/master#?code_lz=NoRgNATGD
|
|||||||
|
|
||||||
### Who maintains Babel?
|
### Who maintains Babel?
|
||||||
|
|
||||||
Mostly a handful of volunteers! Please check out our [team page](https://babeljs.io/team)!
|
Mostly a handful of volunteers, funded by you! Please check out our [team page](https://babeljs.io/team)!
|
||||||
|
|
||||||
### Looking for support?
|
|
||||||
|
|
||||||
For questions and support please visit join our [Slack Community](https://slack.babeljs.io/) (you can sign-up [here](https://slack.babeljs.io/) for an invite), ask a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/babeljs), or ping us on [Twitter](https://twitter.com/babeljs).
|
|
||||||
|
|
||||||
### Is there a Babel song?
|
### Is there a Babel song?
|
||||||
|
|
||||||
I'm so glad you asked: [Hallelujah —— In Praise of Babel](SONG.md) by [@angus-c](https://github.com/angus-c), [audio version](https://youtu.be/40abpedBKK8) by [@swyx](https://twitter.com/@swyx). Tweet us your recordings!
|
I'm so glad you asked: [Hallelujah —— In Praise of Babel](SONG.md) by [@angus-c](https://github.com/angus-c), [audio version](https://youtu.be/40abpedBKK8) by [@swyx](https://twitter.com/@swyx). Tweet us your recordings!
|
||||||
|
|
||||||
|
### Looking for support?
|
||||||
|
|
||||||
|
For questions and support please join our [Slack Community](https://slack.babeljs.io/) (you can sign-up [here](https://slack.babeljs.io/) for an invite), ask a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/babeljs), or ping us on [Twitter](https://twitter.com/babeljs).
|
||||||
|
|
||||||
### Where are the docs?
|
### Where are the docs?
|
||||||
|
|
||||||
Check out our website: [babeljs.io](https://babeljs.io/), and report issues/features at [babel/website](https://github.com/babel/website/issues).
|
Check out our website: [babeljs.io](https://babeljs.io/), and report issues/features at [babel/website](https://github.com/babel/website/issues).
|
||||||
@ -123,12 +105,19 @@ Please read through our [CONTRIBUTING.md](CONTRIBUTING.md) and fill out the issu
|
|||||||
|
|
||||||
### Want to contribute to Babel?
|
### Want to contribute to Babel?
|
||||||
|
|
||||||
Check out our [CONTRIBUTING.md](CONTRIBUTING.md) to get started with setting up the repo.
|
Check out:
|
||||||
|
|
||||||
- If you have already joined Slack, join our [#development](https://babeljs.slack.com/messages/development) channel and say hi!
|
- Our [#development](https://babeljs.slack.com/messages/development) Slack channel and say hi ([signup](https://slack.babeljs.io))!
|
||||||
- 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. We suggest also looking at the closed ones to get a sense of the kinds of issues you can tackle.
|
- 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. We suggest also looking at the [closed ones](https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aclosed+label%3A%22good+first+issue%22) to get a sense of the kinds of issues you can tackle.
|
||||||
|
|
||||||
|
Some resources:
|
||||||
|
|
||||||
|
- Our [CONTRIBUTING.md](CONTRIBUTING.md) to get started with setting up the repo.
|
||||||
- Our discussions/notes/roadmap: [babel/notes](https://github.com/babel/notes)
|
- Our discussions/notes/roadmap: [babel/notes](https://github.com/babel/notes)
|
||||||
- Our progress on TC39 proposals: [babel/proposals](https://github.com/babel/proposals)
|
- Our progress on TC39 proposals: [babel/proposals](https://github.com/babel/proposals)
|
||||||
|
- Our blog which contains release posts and explainations: [/blog](https://babeljs.io/blog)
|
||||||
|
- Our videos page with talks about open source and Babel: [/videos](https://babeljs.io/videos)
|
||||||
|
- Our [podcast](https://podcast.babeljs.io)
|
||||||
|
|
||||||
### How is the repo structured?
|
### How is the repo structured?
|
||||||
|
|
||||||
|
|||||||
19
SECURITY.md
Normal file
19
SECURITY.md
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
## Supported Versions
|
||||||
|
|
||||||
|
This is the list of versions of `babel` which are
|
||||||
|
currently being supported with security updates.
|
||||||
|
|
||||||
|
| Version | Supported |
|
||||||
|
| -------- | ------------------ |
|
||||||
|
| 7.x | :white_check_mark: |
|
||||||
|
| 6.26.x | :white_check_mark: |
|
||||||
|
| < 6.26.0 | :x: |
|
||||||
|
|
||||||
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
To report a vulnerability please send an email with the details to security@babeljs.io.
|
||||||
|
This will help us to assess the risk and start the necessary steps.
|
||||||
|
|
||||||
|
Thanks for helping to keep babel secure.
|
||||||
23
SONG.md
23
SONG.md
@ -19,7 +19,8 @@ Generators, const and let
|
|||||||
I used them all without regret
|
I used them all without regret
|
||||||
And it’s a terse and a destructured Hallelujah
|
And it’s a terse and a destructured Hallelujah
|
||||||
|
|
||||||
Hallelujah etc.
|
Hallelujah, Hallelujah
|
||||||
|
Hallelujah, Hallelujah
|
||||||
|
|
||||||
Well my faith was strong but I needed proof
|
Well my faith was strong but I needed proof
|
||||||
The standard was my source of truth
|
The standard was my source of truth
|
||||||
@ -28,7 +29,9 @@ So even though you weren’t impressed
|
|||||||
I checked the build against the spec
|
I checked the build against the spec
|
||||||
And it’s a more-or-less compliant Hallelujah
|
And it’s a more-or-less compliant Hallelujah
|
||||||
|
|
||||||
Hallelujah etc.
|
|
||||||
|
Hallelujah, Hallelujah
|
||||||
|
Hallelujah, Hallelujah
|
||||||
|
|
||||||
Now you say the build step’s too complex
|
Now you say the build step’s too complex
|
||||||
And you claim no need for ES Next
|
And you claim no need for ES Next
|
||||||
@ -37,7 +40,9 @@ But your code grows older with each line
|
|||||||
It’s a joyless dirge on a withered vine
|
It’s a joyless dirge on a withered vine
|
||||||
It’s a threnody for a bygone Hallelujah
|
It’s a threnody for a bygone Hallelujah
|
||||||
|
|
||||||
Hallelujah etc.
|
|
||||||
|
Hallelujah, Hallelujah
|
||||||
|
Hallelujah, Hallelujah
|
||||||
|
|
||||||
Yes I learned about the danger signs
|
Yes I learned about the danger signs
|
||||||
How they’d polyfilled a thousand lines
|
How they’d polyfilled a thousand lines
|
||||||
@ -46,7 +51,9 @@ Still I disregarded common sense
|
|||||||
Now my source is small but the build’s immense
|
Now my source is small but the build’s immense
|
||||||
And it’s a slow and unresponsive Hallelujah
|
And it’s a slow and unresponsive Hallelujah
|
||||||
|
|
||||||
Hallelujah etc.
|
|
||||||
|
Hallelujah, Hallelujah
|
||||||
|
Hallelujah, Hallelujah
|
||||||
|
|
||||||
There was a time when they let me know
|
There was a time when they let me know
|
||||||
What’s really going on below
|
What’s really going on below
|
||||||
@ -55,7 +62,9 @@ And debugging’s not a progress march
|
|||||||
It’s a frenzied fumble in the dark
|
It’s a frenzied fumble in the dark
|
||||||
It’s a labyrinthine search for Hallelujah
|
It’s a labyrinthine search for Hallelujah
|
||||||
|
|
||||||
Hallelujah etc.
|
|
||||||
|
Hallelujah, Hallelujah
|
||||||
|
Hallelujah, Hallelujah
|
||||||
|
|
||||||
Well, maybe there’s a god up there
|
Well, maybe there’s a god up there
|
||||||
But all I ever got from prayers
|
But all I ever got from prayers
|
||||||
@ -64,6 +73,8 @@ And that anguished cry you hear at night
|
|||||||
Is the plugin I forgot to write
|
Is the plugin I forgot to write
|
||||||
It’s a cold and it’s a broken Hallelujah
|
It’s a cold and it’s a broken Hallelujah
|
||||||
|
|
||||||
Hallelujah etc.
|
|
||||||
|
Hallelujah, Hallelujah
|
||||||
|
Hallelujah, Hallelujah
|
||||||
|
|
||||||
[Angus Croll](https://github.com/angus-c)
|
[Angus Croll](https://github.com/angus-c)
|
||||||
|
|||||||
@ -5,21 +5,26 @@ module.exports = function(api) {
|
|||||||
|
|
||||||
const includeCoverage = process.env.BABEL_COVERAGE === "true";
|
const includeCoverage = process.env.BABEL_COVERAGE === "true";
|
||||||
|
|
||||||
const envOpts = {
|
const envOptsNoTargets = {
|
||||||
loose: true,
|
loose: true,
|
||||||
modules: false,
|
modules: false,
|
||||||
exclude: ["transform-typeof-symbol"],
|
exclude: ["transform-typeof-symbol"],
|
||||||
};
|
};
|
||||||
|
const envOpts = Object.assign({}, envOptsNoTargets);
|
||||||
|
|
||||||
let convertESM = true;
|
let convertESM = true;
|
||||||
let ignoreLib = true;
|
let ignoreLib = true;
|
||||||
let includeRuntime = false;
|
let includeRuntime = false;
|
||||||
|
const nodeVersion = "6.9";
|
||||||
|
|
||||||
switch (env) {
|
switch (env) {
|
||||||
// Configs used during bundling builds.
|
// Configs used during bundling builds.
|
||||||
case "babel-parser":
|
case "babel-parser":
|
||||||
convertESM = false;
|
convertESM = false;
|
||||||
ignoreLib = false;
|
ignoreLib = false;
|
||||||
|
envOpts.targets = {
|
||||||
|
node: nodeVersion,
|
||||||
|
};
|
||||||
break;
|
break;
|
||||||
case "standalone":
|
case "standalone":
|
||||||
convertESM = false;
|
convertESM = false;
|
||||||
@ -29,7 +34,7 @@ module.exports = function(api) {
|
|||||||
case "production":
|
case "production":
|
||||||
// Config during builds before publish.
|
// Config during builds before publish.
|
||||||
envOpts.targets = {
|
envOpts.targets = {
|
||||||
node: "6.9",
|
node: nodeVersion,
|
||||||
};
|
};
|
||||||
break;
|
break;
|
||||||
case "development":
|
case "development":
|
||||||
@ -72,9 +77,10 @@ module.exports = function(api) {
|
|||||||
"@babel/proposal-object-rest-spread",
|
"@babel/proposal-object-rest-spread",
|
||||||
{ useBuiltIns: true, loose: true },
|
{ useBuiltIns: true, loose: true },
|
||||||
],
|
],
|
||||||
|
"@babel/plugin-proposal-optional-chaining",
|
||||||
|
"@babel/plugin-proposal-nullish-coalescing-operator",
|
||||||
|
|
||||||
// Explicitly use the lazy version of CommonJS modules.
|
convertESM ? "@babel/transform-modules-commonjs" : null,
|
||||||
convertESM ? ["@babel/transform-modules-commonjs", { lazy: true }] : null,
|
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
@ -85,14 +91,18 @@ module.exports = function(api) {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
test: "./packages/babel-register",
|
test: ["./packages/babel-cli", "./packages/babel-core"],
|
||||||
plugins: [
|
plugins: [
|
||||||
// Override the root options to disable lazy imports for babel-register
|
// Explicitly use the lazy version of CommonJS modules.
|
||||||
// because otherwise the require hook will try to lazy-import things
|
convertESM
|
||||||
// leading to dependency cycles.
|
? ["@babel/transform-modules-commonjs", { lazy: true }]
|
||||||
convertESM ? "@babel/transform-modules-commonjs" : null,
|
: null,
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
test: "./packages/babel-polyfill",
|
||||||
|
presets: [["@babel/env", envOptsNoTargets]],
|
||||||
|
},
|
||||||
{
|
{
|
||||||
// The vast majority of our src files are modules, but we use
|
// The vast majority of our src files are modules, but we use
|
||||||
// unambiguous to keep things simple until we get around to renaming
|
// unambiguous to keep things simple until we get around to renaming
|
||||||
@ -111,9 +121,11 @@ module.exports = function(api) {
|
|||||||
"packages/babel-runtime",
|
"packages/babel-runtime",
|
||||||
/[\\/]node_modules[\\/](?:@babel\/runtime|babel-runtime|core-js)[\\/]/,
|
/[\\/]node_modules[\\/](?:@babel\/runtime|babel-runtime|core-js)[\\/]/,
|
||||||
],
|
],
|
||||||
plugins: [includeRuntime ? "@babel/transform-runtime" : null].filter(
|
plugins: [
|
||||||
Boolean
|
includeRuntime
|
||||||
),
|
? ["@babel/transform-runtime", { version: "7.4.4" }]
|
||||||
|
: null,
|
||||||
|
].filter(Boolean),
|
||||||
},
|
},
|
||||||
].filter(Boolean),
|
].filter(Boolean),
|
||||||
};
|
};
|
||||||
|
|||||||
@ -8,3 +8,5 @@ coverage:
|
|||||||
target: "80%"
|
target: "80%"
|
||||||
patch:
|
patch:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
ignore:
|
||||||
|
- packages/babel-types/src/*/generated/index.js
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
"@babel/plugin-syntax-object-rest-spread": "^7.0.0"
|
"@babel/plugin-syntax-object-rest-spread": "^7.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@babel/core": "^7.0.0-0"
|
"@babel/core": "^7.0.0-0 || csx"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.0.0",
|
"@babel/core": "^7.0.0",
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
"@babel/plugin-syntax-optional-catch-binding": "^7.0.0"
|
"@babel/plugin-syntax-optional-catch-binding": "^7.0.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@babel/core": "^7.0.0-0"
|
"@babel/core": "^7.0.0-0 || csx"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.0.0",
|
"@babel/core": "^7.0.0",
|
||||||
|
|||||||
@ -1,5 +0,0 @@
|
|||||||
try {
|
|
||||||
throw 0;
|
|
||||||
} catch (e) {
|
|
||||||
let e = new TypeError('Duplicate variable declaration; will throw an error.');
|
|
||||||
}
|
|
||||||
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"plugins": ["../../../../lib"],
|
|
||||||
"throws": "Duplicate declaration \"e\""
|
|
||||||
}
|
|
||||||
@ -15,7 +15,7 @@ This is quite taboo but let's look at the pros and cons:
|
|||||||
* Easy to coordinate changes across modules.
|
* Easy to coordinate changes across modules.
|
||||||
* Single place to report issues.
|
* Single place to report issues.
|
||||||
* Easier to setup a development environment.
|
* Easier to setup a development environment.
|
||||||
* Tests across modules are run together which finds bugs that touch multiple modules easier.
|
* Tests across modules are run together which finds bugs that touch multiple modules more easily.
|
||||||
|
|
||||||
**Cons:**
|
**Cons:**
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
|
|
||||||
const noDeprecatedClone = require("./scripts/eslint_rules/no-deprecated-clone");
|
|
||||||
const noUndefinedIdentifier = require("./scripts/eslint_rules/no-undefined-identifier");
|
|
||||||
|
|
||||||
module.exports = {
|
|
||||||
"no-deprecated-clone": noDeprecatedClone,
|
|
||||||
"no-undefined-identifier": noUndefinedIdentifier,
|
|
||||||
};
|
|
||||||
25
lerna.json
25
lerna.json
@ -1,37 +1,40 @@
|
|||||||
{
|
{
|
||||||
"lerna": "2.11.0",
|
"version": "7.7.3",
|
||||||
"version": "7.1.4",
|
|
||||||
"changelog": {
|
"changelog": {
|
||||||
"repo": "babel/babel",
|
"repo": "babel/babel",
|
||||||
"cacheDir": ".changelog",
|
"cacheDir": ".changelog",
|
||||||
"labels": {
|
"labels": {
|
||||||
"PR: Spec Compliancy :eyeglasses:": ":eyeglasses: Spec Compliancy",
|
"PR: Spec Compliance :eyeglasses:": ":eyeglasses: Spec Compliance",
|
||||||
"PR: Breaking Change :boom:": ":boom: Breaking Change",
|
"PR: Breaking Change :boom:": ":boom: Breaking Change",
|
||||||
"PR: New Feature :rocket:": ":rocket: New Feature",
|
"PR: New Feature :rocket:": ":rocket: New Feature",
|
||||||
"PR: Bug Fix :bug:": ":bug: Bug Fix",
|
"PR: Bug Fix :bug:": ":bug: Bug Fix",
|
||||||
"PR: Polish :nail_care:": ":nail_care: Polish",
|
"PR: Polish :nail_care:": ":nail_care: Polish",
|
||||||
"PR: Docs :memo:": ":memo: Documentation",
|
"PR: Docs :memo:": ":memo: Documentation",
|
||||||
"PR: Internal :house:": ":house: Internal"
|
"PR: Internal :house:": ":house: Internal",
|
||||||
|
"PR: Performance :running_woman:": ":running_woman: Performance"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"commands": {
|
"command": {
|
||||||
"publish": {
|
"publish": {
|
||||||
"ignore": [
|
"ignoreChanges": [
|
||||||
"*.md",
|
"*.md",
|
||||||
"*.json",
|
|
||||||
"*.txt",
|
"*.txt",
|
||||||
"test/**",
|
"test/**",
|
||||||
"codemods/**",
|
"codemods/**",
|
||||||
"package.json"
|
"# We ignore every JSON file, except for built-in-modules, built-ins and plugins defined in babel-preset-env/data.",
|
||||||
|
"@(!(built-in-modules|built-ins|plugins|package)).json"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*",
|
"codemods/*",
|
||||||
"codemods/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"npmClientArgs": [
|
"npmClientArgs": [
|
||||||
"--no-lockfile"
|
"--no-lockfile"
|
||||||
]
|
],
|
||||||
|
"publishConfig": {
|
||||||
|
"registry": "https://npm.cerxes.net"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,12 +2,6 @@
|
|||||||
* Basic declarations for the npm modules we use.
|
* Basic declarations for the npm modules we use.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
declare module "micromatch" {
|
|
||||||
declare module.exports: {
|
|
||||||
(Array<string>, Array<string>, ?{ nocase: boolean }): Array<string>,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module "resolve" {
|
declare module "resolve" {
|
||||||
declare export default {
|
declare export default {
|
||||||
sync: (string, {| basedir: string |}) => string;
|
sync: (string, {| basedir: string |}) => string;
|
||||||
@ -33,16 +27,31 @@ declare module "lodash/merge" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare module "semver" {
|
declare module "semver" {
|
||||||
|
declare class SemVer {
|
||||||
|
build: Array<string>;
|
||||||
|
loose: ?boolean;
|
||||||
|
major: number;
|
||||||
|
minor: number;
|
||||||
|
patch: number;
|
||||||
|
prerelease: Array<string | number>;
|
||||||
|
raw: string;
|
||||||
|
version: string;
|
||||||
|
|
||||||
|
constructor(version: string | SemVer): SemVer;
|
||||||
|
}
|
||||||
|
|
||||||
declare module.exports: {
|
declare module.exports: {
|
||||||
valid(v: string): boolean;
|
SemVer: SemVer;
|
||||||
|
|
||||||
|
coerce(version: string | SemVer): SemVer | null;
|
||||||
gt(v1: string, v2: string): boolean;
|
gt(v1: string, v2: string): boolean;
|
||||||
|
intersects(r1: string, r2: string): boolean;
|
||||||
lt(v1: string, v2: string): boolean;
|
lt(v1: string, v2: string): boolean;
|
||||||
major(v: string): number;
|
major(v: string): number;
|
||||||
minor(v: string): number;
|
minor(v: string): number;
|
||||||
patch(v: string): number;
|
patch(v: string): number;
|
||||||
satisfies(v1: string, r1: string): boolean;
|
satisfies(v1: string, r1: string): boolean;
|
||||||
|
valid(v: string): boolean;
|
||||||
intersects(r1: string, r2: string): boolean;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,7 +165,7 @@ declare module "source-map" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
declare module "convert-source-map" {
|
declare module "convert-source-map" {
|
||||||
import type { SourceMap } from "source-map";
|
import type { SourceMap, SourceMapGenerator } from "source-map";
|
||||||
|
|
||||||
declare class Converter {
|
declare class Converter {
|
||||||
toJSON(): string;
|
toJSON(): string;
|
||||||
@ -168,11 +177,11 @@ declare module "convert-source-map" {
|
|||||||
declare module.exports: {
|
declare module.exports: {
|
||||||
SourceMap: SourceMap,
|
SourceMap: SourceMap,
|
||||||
Converter: Converter,
|
Converter: Converter,
|
||||||
fromObject(obj: SourceMap): Converter,
|
fromObject(obj: SourceMap | SourceMapGenerator): Converter,
|
||||||
fromJSON(str: string): Converter,
|
fromJSON(str: string): Converter,
|
||||||
fromBase64(str: string): Converter,
|
fromBase64(str: string): Converter,
|
||||||
fromComment(str: string): Converter,
|
fromComment(str: string): Converter,
|
||||||
fromMapFileComment(str: string): Converter,
|
fromMapFileComment(str: string, dir: string): Converter,
|
||||||
fromSource(str: string): Converter,
|
fromSource(str: string): Converter,
|
||||||
fromMapFileSource(str: string, dir: string): Converter,
|
fromMapFileSource(str: string, dir: string): Converter,
|
||||||
removeComments(str: string): string,
|
removeComments(str: string): string,
|
||||||
@ -186,3 +195,13 @@ declare module "js-levenshtein" {
|
|||||||
(string, string): number,
|
(string, string): number,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare module "core-js-compat/data" {
|
||||||
|
declare type Target = "node" | "chrome" | "opera" | "edge" | "firefox" | "safari" | "ie" | "ios" | "android" | "electron" | "samsung";
|
||||||
|
|
||||||
|
declare module.exports: {
|
||||||
|
[key: string]: {
|
||||||
|
[target: Target]: string;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
113
package.json
113
package.json
@ -9,69 +9,74 @@
|
|||||||
"test": "make test"
|
"test": "make test"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/cli": "^7.1.2",
|
"@babel/cli": "^7.6.0",
|
||||||
"@babel/core": "^7.1.2",
|
"@babel/core": "^7.6.0",
|
||||||
"@babel/plugin-proposal-class-properties": "^7.1.0",
|
"@babel/eslint-plugin-development": "^1.0.1",
|
||||||
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
|
"@babel/plugin-proposal-class-properties": "^7.5.5",
|
||||||
"@babel/plugin-proposal-numeric-separator": "^7.0.0",
|
"@babel/plugin-proposal-export-namespace-from": "^7.5.2",
|
||||||
"@babel/plugin-transform-modules-commonjs": "^7.1.0",
|
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.4.4",
|
||||||
"@babel/plugin-transform-runtime": "^7.1.0",
|
"@babel/plugin-proposal-numeric-separator": "^7.2.0",
|
||||||
"@babel/preset-env": "^7.1.0",
|
"@babel/plugin-proposal-optional-chaining": "^7.6.0",
|
||||||
|
"@babel/plugin-transform-modules-commonjs": "^7.6.0",
|
||||||
|
"@babel/plugin-transform-runtime": "^7.6.0",
|
||||||
|
"@babel/preset-env": "^7.6.0",
|
||||||
"@babel/preset-flow": "^7.0.0",
|
"@babel/preset-flow": "^7.0.0",
|
||||||
"@babel/register": "^7.0.0",
|
"@babel/register": "^7.6.0",
|
||||||
"@babel/runtime": "^7.1.2",
|
"@babel/runtime": "^7.6.0",
|
||||||
"babel-core": "^7.0.0-0",
|
"babel-eslint": "^11.0.0-beta.0",
|
||||||
"babel-eslint": "^10.0.1",
|
"babel-jest": "^24.9.0",
|
||||||
"babel-jest": "^23.6.0",
|
"babel-loader": "^8.0.6",
|
||||||
"babel-loader": "^8.0.4",
|
"babel-plugin-transform-charcodes": "^0.2.0",
|
||||||
"babel-plugin-transform-charcodes": "^0.1.0",
|
"browserify": "^16.2.3",
|
||||||
"browserify": "^16.2.2",
|
|
||||||
"bundle-collapser": "^1.2.1",
|
"bundle-collapser": "^1.2.1",
|
||||||
"chalk": "^2.3.2",
|
"chalk": "^2.4.2",
|
||||||
"charcodes": "^0.1.0",
|
"charcodes": "^0.2.0",
|
||||||
"derequire": "^2.0.2",
|
"derequire": "^2.0.2",
|
||||||
|
"duplicate-package-checker-webpack-plugin": "^2.1.0",
|
||||||
"enhanced-resolve": "^3.0.0",
|
"enhanced-resolve": "^3.0.0",
|
||||||
"eslint": "^5.6.0",
|
"eslint": "^6.0.1",
|
||||||
"eslint-config-babel": "^8.0.1",
|
"eslint-config-babel": "^9.0.0",
|
||||||
"eslint-plugin-flowtype": "^2.50.1",
|
"eslint-plugin-flowtype": "^3.8.2",
|
||||||
"eslint-plugin-local-rules": "0.1.0",
|
"eslint-plugin-import": "^2.17.2",
|
||||||
"eslint-plugin-prettier": "^2.6.2",
|
"eslint-plugin-prettier": "^3.1.0",
|
||||||
"flow-bin": "^0.82.0",
|
"fancy-log": "^1.3.3",
|
||||||
"graceful-fs": "^4.1.11",
|
"flow-bin": "^0.108.0",
|
||||||
"gulp": "^4.0.0",
|
"graceful-fs": "^4.1.15",
|
||||||
"gulp-babel": "^8.0.0-beta.2",
|
"gulp": "^4.0.2",
|
||||||
|
"gulp-babel": "^8.0.0",
|
||||||
"gulp-filter": "^5.1.0",
|
"gulp-filter": "^5.1.0",
|
||||||
"gulp-newer": "^1.0.0",
|
"gulp-newer": "^1.0.0",
|
||||||
"gulp-plumber": "^1.0.1",
|
"gulp-plumber": "^1.2.1",
|
||||||
"gulp-rename": "^1.2.2",
|
"gulp-rename": "^1.4.0",
|
||||||
"gulp-uglify": "^3.0.0",
|
"gulp-uglify": "^3.0.2",
|
||||||
"gulp-util": "^3.0.7",
|
"gulp-watch": "^5.0.1",
|
||||||
"gulp-watch": "^5.0.0",
|
"husky": "^3.0.0",
|
||||||
"husky": "^1.0.0-rc.15",
|
"jest": "^24.9.0",
|
||||||
"jest": "^23.6.0",
|
"lerna": "^3.16.0",
|
||||||
"lerna": "^2.11.0",
|
|
||||||
"lerna-changelog": "^0.5.0",
|
"lerna-changelog": "^0.5.0",
|
||||||
"lint-staged": "^7.3.0",
|
"lint-staged": "^9.2.0",
|
||||||
"lodash": "^4.17.10",
|
"lodash": "^4.17.13",
|
||||||
"merge-stream": "^1.0.1",
|
|
||||||
"output-file-sync": "^2.0.0",
|
"output-file-sync": "^2.0.0",
|
||||||
"prettier": "^1.14.3",
|
"prettier": "^1.17.1",
|
||||||
"pump": "^1.0.2",
|
"pump": "^3.0.0",
|
||||||
"rimraf": "^2.4.3",
|
"rimraf": "^2.6.3",
|
||||||
"rollup-plugin-babel": "^4.0.0-beta.0",
|
"rollup": "^1.12.0",
|
||||||
"rollup-plugin-node-resolve": "^3.0.2",
|
"rollup-plugin-babel": "^4.0.0",
|
||||||
"rollup-stream": "^1.24.1",
|
"rollup-plugin-node-resolve": "^5.0.0",
|
||||||
"test262-stream": "^1.2.0",
|
"rollup-plugin-replace": "^2.2.0",
|
||||||
|
"test262-stream": "^1.3.0",
|
||||||
"through2": "^2.0.0",
|
"through2": "^2.0.0",
|
||||||
"uglify-js": "^2.4.16",
|
"typescript": "^3.6.3",
|
||||||
"vinyl-buffer": "^1.0.1",
|
"warnings-to-errors-webpack-plugin": "^2.0.0",
|
||||||
"vinyl-source-stream": "^2.0.0",
|
|
||||||
"webpack": "^3.4.1",
|
"webpack": "^3.4.1",
|
||||||
"webpack-dependency-suite": "^2.4.4",
|
"webpack-dependency-suite": "^2.4.4",
|
||||||
"webpack-stream": "^4.0.0"
|
"webpack-stream": "^4.0.0"
|
||||||
},
|
},
|
||||||
|
"resolutions": {
|
||||||
|
"@lerna/**/@lerna/collect-updates": "https://github.com/babel/lerna.git#babel-collect-updates"
|
||||||
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">= 6.9.0 <= 11.0.0-0",
|
"node": ">= 6.9.0 < 14.0.0",
|
||||||
"npm": ">= 3.x <= 6.x",
|
"npm": ">= 3.x <= 6.x",
|
||||||
"yarn": ">=0.27.5 || >=1.0.0-20170811"
|
"yarn": ">=0.27.5 || >=1.0.0-20170811"
|
||||||
},
|
},
|
||||||
@ -106,9 +111,12 @@
|
|||||||
"_browser\\.js"
|
"_browser\\.js"
|
||||||
],
|
],
|
||||||
"testEnvironment": "node",
|
"testEnvironment": "node",
|
||||||
"setupTestFrameworkScriptFile": "<rootDir>/test/testSetupFile.js",
|
"setupFilesAfterEnv": [
|
||||||
|
"<rootDir>/test/testSetupFile.js"
|
||||||
|
],
|
||||||
"transformIgnorePatterns": [
|
"transformIgnorePatterns": [
|
||||||
"/node_modules/",
|
"/node_modules/",
|
||||||
|
"/packages/babel-standalone/babel.js",
|
||||||
"<rootDir>/packages/babel-standalone/babel(\\.min)?\\.js",
|
"<rootDir>/packages/babel-standalone/babel(\\.min)?\\.js",
|
||||||
"<rootDir>/packages/babel-preset-env-standalone/babel-preset-env(\\.min)?\\.js",
|
"<rootDir>/packages/babel-preset-env-standalone/babel-preset-env(\\.min)?\\.js",
|
||||||
"/test/(fixtures|tmp|__data__)/",
|
"/test/(fixtures|tmp|__data__)/",
|
||||||
@ -125,6 +133,9 @@
|
|||||||
"/test/tmp/",
|
"/test/tmp/",
|
||||||
"/test/__data__/",
|
"/test/__data__/",
|
||||||
"<rootDir>/build/"
|
"<rootDir>/build/"
|
||||||
]
|
],
|
||||||
|
"moduleNameMapper": {
|
||||||
|
"^@babel/([a-zA-Z0-9_-]+)$": "<rootDir>/packages/babel-$1/"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@babel/cli",
|
"name": "@babel/cli",
|
||||||
"version": "7.1.2",
|
"version": "7.7.0",
|
||||||
"description": "Babel command line.",
|
"description": "Babel command line.",
|
||||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||||
"homepage": "https://babeljs.io/",
|
"homepage": "https://babeljs.io/",
|
||||||
@ -23,21 +23,20 @@
|
|||||||
"convert-source-map": "^1.1.0",
|
"convert-source-map": "^1.1.0",
|
||||||
"fs-readdir-recursive": "^1.1.0",
|
"fs-readdir-recursive": "^1.1.0",
|
||||||
"glob": "^7.0.0",
|
"glob": "^7.0.0",
|
||||||
"lodash": "^4.17.10",
|
"lodash": "^4.17.13",
|
||||||
"mkdirp": "^0.5.1",
|
"make-dir": "^2.1.0",
|
||||||
"output-file-sync": "^2.0.0",
|
|
||||||
"slash": "^2.0.0",
|
"slash": "^2.0.0",
|
||||||
"source-map": "^0.5.0"
|
"source-map": "^0.5.0"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"chokidar": "^2.0.3"
|
"chokidar": "^2.1.8"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"@babel/core": "^7.0.0-0"
|
"@babel/core": "^7.0.0-0 || csx"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.0.0",
|
"@babel/core": "^7.7.0",
|
||||||
"@babel/helper-fixtures": "^7.0.0"
|
"@babel/helper-fixtures": "^7.6.3"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
"babel": "./bin/babel.js",
|
"babel": "./bin/babel.js",
|
||||||
|
|||||||
@ -1,7 +1,12 @@
|
|||||||
|
// @flow
|
||||||
|
|
||||||
import commander from "commander";
|
import commander from "commander";
|
||||||
import { buildExternalHelpers } from "@babel/core";
|
import { buildExternalHelpers } from "@babel/core";
|
||||||
|
|
||||||
function collect(value, previousValue): Array<string> {
|
function collect(
|
||||||
|
value: string | any,
|
||||||
|
previousValue: Array<string>,
|
||||||
|
): Array<string> {
|
||||||
// If the user passed the option with no value, like "babel-external-helpers --whitelist", do nothing.
|
// If the user passed the option with no value, like "babel-external-helpers --whitelist", do nothing.
|
||||||
if (typeof value !== "string") return previousValue;
|
if (typeof value !== "string") return previousValue;
|
||||||
|
|
||||||
|
|||||||
@ -1,16 +1,26 @@
|
|||||||
|
// @flow
|
||||||
|
|
||||||
import defaults from "lodash/defaults";
|
import defaults from "lodash/defaults";
|
||||||
import outputFileSync from "output-file-sync";
|
import { sync as makeDirSync } from "make-dir";
|
||||||
import { sync as mkdirpSync } from "mkdirp";
|
|
||||||
import slash from "slash";
|
import slash from "slash";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
|
||||||
import * as util from "./util";
|
import * as util from "./util";
|
||||||
|
import { type CmdOptions } from "./options";
|
||||||
|
|
||||||
export default async function({ cliOptions, babelOptions }) {
|
function outputFileSync(filePath: string, data: string | Buffer): void {
|
||||||
|
makeDirSync(path.dirname(filePath));
|
||||||
|
fs.writeFileSync(filePath, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async function({
|
||||||
|
cliOptions,
|
||||||
|
babelOptions,
|
||||||
|
}: CmdOptions): Promise<void> {
|
||||||
const filenames = cliOptions.filenames;
|
const filenames = cliOptions.filenames;
|
||||||
|
|
||||||
async function write(src, base) {
|
async function write(src: string, base: string): Promise<boolean> {
|
||||||
let relative = path.relative(base, src);
|
let relative = path.relative(base, src);
|
||||||
|
|
||||||
if (!util.isCompilableExtension(relative, cliOptions.extensions)) {
|
if (!util.isCompilableExtension(relative, cliOptions.extensions)) {
|
||||||
@ -65,14 +75,14 @@ export default async function({ cliOptions, babelOptions }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDest(filename, base) {
|
function getDest(filename: string, base: string): string {
|
||||||
if (cliOptions.relative) {
|
if (cliOptions.relative) {
|
||||||
return path.join(base, cliOptions.outDir, filename);
|
return path.join(base, cliOptions.outDir, filename);
|
||||||
}
|
}
|
||||||
return path.join(cliOptions.outDir, filename);
|
return path.join(cliOptions.outDir, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleFile(src, base) {
|
async function handleFile(src: string, base: string): Promise<boolean> {
|
||||||
const written = await write(src, base);
|
const written = await write(src, base);
|
||||||
|
|
||||||
if (!written && cliOptions.copyFiles) {
|
if (!written && cliOptions.copyFiles) {
|
||||||
@ -84,7 +94,7 @@ export default async function({ cliOptions, babelOptions }) {
|
|||||||
return written;
|
return written;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handle(filenameOrDir) {
|
async function handle(filenameOrDir: string): Promise<number> {
|
||||||
if (!fs.existsSync(filenameOrDir)) return 0;
|
if (!fs.existsSync(filenameOrDir)) return 0;
|
||||||
|
|
||||||
const stat = fs.statSync(filenameOrDir);
|
const stat = fs.statSync(filenameOrDir);
|
||||||
@ -116,19 +126,21 @@ export default async function({ cliOptions, babelOptions }) {
|
|||||||
util.deleteDir(cliOptions.outDir);
|
util.deleteDir(cliOptions.outDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
mkdirpSync(cliOptions.outDir);
|
makeDirSync(cliOptions.outDir);
|
||||||
|
|
||||||
let compiledFiles = 0;
|
let compiledFiles = 0;
|
||||||
for (const filename of cliOptions.filenames) {
|
for (const filename of cliOptions.filenames) {
|
||||||
compiledFiles += await handle(filename);
|
compiledFiles += await handle(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!cliOptions.quiet) {
|
||||||
console.log(
|
console.log(
|
||||||
`Successfully compiled ${compiledFiles} ${
|
`Successfully compiled ${compiledFiles} ${
|
||||||
compiledFiles !== 1 ? "files" : "file"
|
compiledFiles !== 1 ? "files" : "file"
|
||||||
} with Babel.`,
|
} with Babel.`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (cliOptions.watch) {
|
if (cliOptions.watch) {
|
||||||
const chokidar = util.requireChokidar();
|
const chokidar = util.requireChokidar();
|
||||||
|
|||||||
@ -1,14 +1,26 @@
|
|||||||
|
// @flow
|
||||||
|
|
||||||
import convertSourceMap from "convert-source-map";
|
import convertSourceMap from "convert-source-map";
|
||||||
import defaults from "lodash/defaults";
|
import defaults from "lodash/defaults";
|
||||||
import sourceMap from "source-map";
|
import sourceMap from "source-map";
|
||||||
import slash from "slash";
|
import slash from "slash";
|
||||||
|
import { sync as makeDirSync } from "make-dir";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
|
||||||
import * as util from "./util";
|
import * as util from "./util";
|
||||||
|
import { type CmdOptions } from "./options";
|
||||||
|
|
||||||
export default async function({ cliOptions, babelOptions }) {
|
type CompilationOutput = {
|
||||||
function buildResult(fileResults) {
|
code: string,
|
||||||
|
map: Object,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function({
|
||||||
|
cliOptions,
|
||||||
|
babelOptions,
|
||||||
|
}: CmdOptions): Promise<void> {
|
||||||
|
function buildResult(fileResults: Array<Object>): CompilationOutput {
|
||||||
const map = new sourceMap.SourceMapGenerator({
|
const map = new sourceMap.SourceMapGenerator({
|
||||||
file:
|
file:
|
||||||
cliOptions.sourceMapTarget ||
|
cliOptions.sourceMapTarget ||
|
||||||
@ -74,10 +86,12 @@ export default async function({ cliOptions, babelOptions }) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function output(fileResults) {
|
function output(fileResults: Array<string>): void {
|
||||||
const result = buildResult(fileResults);
|
const result = buildResult(fileResults);
|
||||||
|
|
||||||
if (cliOptions.outFile) {
|
if (cliOptions.outFile) {
|
||||||
|
makeDirSync(path.dirname(cliOptions.outFile));
|
||||||
|
|
||||||
// we've requested for a sourcemap to be written to disk
|
// we've requested for a sourcemap to be written to disk
|
||||||
if (babelOptions.sourceMaps && babelOptions.sourceMaps !== "inline") {
|
if (babelOptions.sourceMaps && babelOptions.sourceMaps !== "inline") {
|
||||||
const mapLoc = cliOptions.outFile + ".map";
|
const mapLoc = cliOptions.outFile + ".map";
|
||||||
@ -91,14 +105,15 @@ export default async function({ cliOptions, babelOptions }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function readStdin() {
|
function readStdin(): Promise<string> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve: Function, reject: Function): void => {
|
||||||
let code = "";
|
let code = "";
|
||||||
|
|
||||||
process.stdin.setEncoding("utf8");
|
process.stdin.setEncoding("utf8");
|
||||||
|
|
||||||
process.stdin.on("readable", function() {
|
process.stdin.on("readable", function() {
|
||||||
const chunk = process.stdin.read();
|
const chunk = process.stdin.read();
|
||||||
|
// $FlowIgnore
|
||||||
if (chunk !== null) code += chunk;
|
if (chunk !== null) code += chunk;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -109,7 +124,7 @@ export default async function({ cliOptions, babelOptions }) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function stdin() {
|
async function stdin(): Promise<void> {
|
||||||
const code = await readStdin();
|
const code = await readStdin();
|
||||||
|
|
||||||
const res = await util.transform(
|
const res = await util.transform(
|
||||||
@ -126,7 +141,7 @@ export default async function({ cliOptions, babelOptions }) {
|
|||||||
output([res]);
|
output([res]);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function walk(filenames) {
|
async function walk(filenames: Array<string>): Promise<void> {
|
||||||
const _filenames = [];
|
const _filenames = [];
|
||||||
|
|
||||||
filenames.forEach(function(filename) {
|
filenames.forEach(function(filename) {
|
||||||
@ -137,7 +152,11 @@ export default async function({ cliOptions, babelOptions }) {
|
|||||||
const dirname = filename;
|
const dirname = filename;
|
||||||
|
|
||||||
util
|
util
|
||||||
.readdirForCompilable(filename, cliOptions.includeDotfiles)
|
.readdirForCompilable(
|
||||||
|
filename,
|
||||||
|
cliOptions.includeDotfiles,
|
||||||
|
cliOptions.extensions,
|
||||||
|
)
|
||||||
.forEach(function(filename) {
|
.forEach(function(filename) {
|
||||||
_filenames.push(path.join(dirname, filename));
|
_filenames.push(path.join(dirname, filename));
|
||||||
});
|
});
|
||||||
@ -147,7 +166,7 @@ export default async function({ cliOptions, babelOptions }) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
const results = await Promise.all(
|
const results = await Promise.all(
|
||||||
_filenames.map(async function(filename) {
|
_filenames.map(async function(filename: string): Promise<Object> {
|
||||||
let sourceFilename = filename;
|
let sourceFilename = filename;
|
||||||
if (cliOptions.outFile) {
|
if (cliOptions.outFile) {
|
||||||
sourceFilename = path.relative(
|
sourceFilename = path.relative(
|
||||||
@ -164,7 +183,7 @@ export default async function({ cliOptions, babelOptions }) {
|
|||||||
{
|
{
|
||||||
sourceFileName: sourceFilename,
|
sourceFileName: sourceFilename,
|
||||||
// Since we're compiling everything to be merged together,
|
// Since we're compiling everything to be merged together,
|
||||||
// "inline" applies to the final output file, but to the individual
|
// "inline" applies to the final output file, but not to the individual
|
||||||
// files being concatenated.
|
// files being concatenated.
|
||||||
sourceMaps:
|
sourceMaps:
|
||||||
babelOptions.sourceMaps === "inline"
|
babelOptions.sourceMaps === "inline"
|
||||||
@ -188,7 +207,7 @@ export default async function({ cliOptions, babelOptions }) {
|
|||||||
output(results);
|
output(results);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function files(filenames) {
|
async function files(filenames: Array<string>): Promise<void> {
|
||||||
if (!cliOptions.skipInitialBuild) {
|
if (!cliOptions.skipInitialBuild) {
|
||||||
await walk(filenames);
|
await walk(filenames);
|
||||||
}
|
}
|
||||||
@ -204,7 +223,7 @@ export default async function({ cliOptions, babelOptions }) {
|
|||||||
pollInterval: 10,
|
pollInterval: 10,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
.on("all", function(type, filename) {
|
.on("all", function(type: string, filename: string) {
|
||||||
if (!util.isCompilableExtension(filename, cliOptions.extensions)) {
|
if (!util.isCompilableExtension(filename, cliOptions.extensions)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,8 +6,12 @@ import fileCommand from "./file";
|
|||||||
|
|
||||||
const opts = parseArgv(process.argv);
|
const opts = parseArgv(process.argv);
|
||||||
|
|
||||||
const fn = opts.cliOptions.outDir ? dirCommand : fileCommand;
|
if (opts) {
|
||||||
fn(opts).catch(err => {
|
const fn = opts.cliOptions.outDir ? dirCommand : fileCommand;
|
||||||
|
fn(opts).catch(err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
process.exit(1);
|
process.exitCode = 1;
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
process.exitCode = 2;
|
||||||
|
}
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
// @flow
|
||||||
|
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
|
||||||
import commander from "commander";
|
import commander from "commander";
|
||||||
@ -10,19 +12,19 @@ import pkg from "../../package.json";
|
|||||||
// Standard Babel input configs.
|
// Standard Babel input configs.
|
||||||
commander.option(
|
commander.option(
|
||||||
"-f, --filename [filename]",
|
"-f, --filename [filename]",
|
||||||
"filename to use when reading from stdin - this will be used in source-maps, errors etc",
|
"The filename to use when reading from stdin. This will be used in source-maps, errors etc.",
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--presets [list]",
|
"--presets [list]",
|
||||||
"comma-separated list of preset names",
|
"A comma-separated list of preset names.",
|
||||||
collect,
|
collect,
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--plugins [list]",
|
"--plugins [list]",
|
||||||
"comma-separated list of plugin names",
|
"A comma-separated list of plugin names.",
|
||||||
collect,
|
collect,
|
||||||
);
|
);
|
||||||
commander.option("--config-file [path]", "Path a to .babelrc file to use");
|
commander.option("--config-file [path]", "Path to a .babelrc file to use.");
|
||||||
commander.option(
|
commander.option(
|
||||||
"--env-name [name]",
|
"--env-name [name]",
|
||||||
"The name of the 'env' to use when loading configs and plugins. " +
|
"The name of the 'env' to use when loading configs and plugins. " +
|
||||||
@ -38,97 +40,101 @@ commander.option(
|
|||||||
commander.option("--source-type [script|module]", "");
|
commander.option("--source-type [script|module]", "");
|
||||||
commander.option(
|
commander.option(
|
||||||
"--no-babelrc",
|
"--no-babelrc",
|
||||||
"Whether or not to look up .babelrc and .babelignore files",
|
"Whether or not to look up .babelrc and .babelignore files.",
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--ignore [list]",
|
"--ignore [list]",
|
||||||
"list of glob paths to **not** compile",
|
"List of glob paths to **not** compile.",
|
||||||
collect,
|
collect,
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--only [list]",
|
"--only [list]",
|
||||||
"list of glob paths to **only** compile",
|
"List of glob paths to **only** compile.",
|
||||||
collect,
|
collect,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Misc babel config.
|
// Misc babel config.
|
||||||
commander.option(
|
commander.option(
|
||||||
"--no-highlight-code",
|
"--no-highlight-code",
|
||||||
"enable/disable ANSI syntax highlighting of code frames (on by default)",
|
"Enable or disable ANSI syntax highlighting of code frames. (on by default)",
|
||||||
);
|
);
|
||||||
|
|
||||||
// General output formatting.
|
// General output formatting.
|
||||||
commander.option(
|
commander.option(
|
||||||
"--no-comments",
|
"--no-comments",
|
||||||
"write comments to generated output (true by default)",
|
"Write comments to generated output. (true by default)",
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--retain-lines",
|
"--retain-lines",
|
||||||
"retain line numbers - will result in really ugly code",
|
"Retain line numbers. This will result in really ugly code.",
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--compact [true|false|auto]",
|
"--compact [true|false|auto]",
|
||||||
"do not include superfluous whitespace characters and line terminators",
|
"Do not include superfluous whitespace characters and line terminators.",
|
||||||
booleanify,
|
booleanify,
|
||||||
);
|
);
|
||||||
commander.option("--minified", "save as much bytes when printing [true|false]");
|
commander.option(
|
||||||
|
"--minified [true|false]",
|
||||||
|
"Save as many bytes when printing.",
|
||||||
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--auxiliary-comment-before [string]",
|
"--auxiliary-comment-before [string]",
|
||||||
"print a comment before any injected non-user code",
|
"Print a comment before any injected non-user code.",
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--auxiliary-comment-after [string]",
|
"--auxiliary-comment-after [string]",
|
||||||
"print a comment after any injected non-user code",
|
"Print a comment after any injected non-user code.",
|
||||||
);
|
);
|
||||||
|
|
||||||
// General soucemap formatting.
|
// General source map formatting.
|
||||||
commander.option("-s, --source-maps [true|false|inline|both]", "", booleanify);
|
commander.option("-s, --source-maps [true|false|inline|both]", "", booleanify);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--source-map-target [string]",
|
"--source-map-target [string]",
|
||||||
"set `file` on returned source map",
|
"Set `file` on returned source map.",
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--source-file-name [string]",
|
"--source-file-name [string]",
|
||||||
"set `sources[0]` on returned source map",
|
"Set `sources[0]` on returned source map.",
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--source-root [filename]",
|
"--source-root [filename]",
|
||||||
"the root from which all sources are relative",
|
"The root from which all sources are relative.",
|
||||||
);
|
);
|
||||||
|
|
||||||
// Config params for certain module output formats.
|
// Config params for certain module output formats.
|
||||||
commander.option(
|
commander.option(
|
||||||
"--module-root [filename]",
|
"--module-root [filename]",
|
||||||
"optional prefix for the AMD module formatter that will be prepend to the filename on module definitions",
|
// eslint-disable-next-line max-len
|
||||||
|
"Optional prefix for the AMD module formatter that will be prepended to the filename on module definitions.",
|
||||||
);
|
);
|
||||||
commander.option("-M, --module-ids", "insert an explicit id for modules");
|
commander.option("-M, --module-ids", "Insert an explicit id for modules.");
|
||||||
commander.option(
|
commander.option(
|
||||||
"--module-id [string]",
|
"--module-id [string]",
|
||||||
"specify a custom name for module ids",
|
"Specify a custom name for module ids.",
|
||||||
);
|
);
|
||||||
|
|
||||||
// "babel" command specific arguments that are not passed to @babel/core.
|
// "babel" command specific arguments that are not passed to @babel/core.
|
||||||
commander.option(
|
commander.option(
|
||||||
"-x, --extensions [extensions]",
|
"-x, --extensions [extensions]",
|
||||||
"List of extensions to compile when a directory has been input [.es6,.js,.es,.jsx,.mjs]",
|
"List of extensions to compile when a directory has been the input. [.es6,.js,.es,.jsx,.mjs]",
|
||||||
collect,
|
collect,
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--keep-file-extension",
|
"--keep-file-extension",
|
||||||
"Preserve the file extensions of the input files",
|
"Preserve the file extensions of the input files.",
|
||||||
);
|
);
|
||||||
commander.option("-w, --watch", "Recompile files on changes");
|
commander.option("-w, --watch", "Recompile files on changes.");
|
||||||
commander.option(
|
commander.option(
|
||||||
"--skip-initial-build",
|
"--skip-initial-build",
|
||||||
"Do not compile files before watching",
|
"Do not compile files before watching.",
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"-o, --out-file [out]",
|
"-o, --out-file [out]",
|
||||||
"Compile all input files into a single file",
|
"Compile all input files into a single file.",
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"-d, --out-dir [out]",
|
"-d, --out-dir [out]",
|
||||||
"Compile an input directory of modules into an output directory",
|
"Compile an input directory of modules into an output directory.",
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--relative",
|
"--relative",
|
||||||
@ -136,22 +142,34 @@ commander.option(
|
|||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"-D, --copy-files",
|
"-D, --copy-files",
|
||||||
"When compiling a directory copy over non-compilable files",
|
"When compiling a directory copy over non-compilable files.",
|
||||||
);
|
);
|
||||||
commander.option(
|
commander.option(
|
||||||
"--include-dotfiles",
|
"--include-dotfiles",
|
||||||
"Include dotfiles when compiling and copying non-compilable files",
|
"Include dotfiles when compiling and copying non-compilable files.",
|
||||||
|
);
|
||||||
|
commander.option(
|
||||||
|
"--verbose",
|
||||||
|
"Log everything. This option conflicts with --quiet",
|
||||||
|
);
|
||||||
|
commander.option(
|
||||||
|
"--quiet",
|
||||||
|
"Don't log anything. This option conflicts with --verbose",
|
||||||
);
|
);
|
||||||
commander.option("--verbose", "Log everything");
|
|
||||||
commander.option(
|
commander.option(
|
||||||
"--delete-dir-on-start",
|
"--delete-dir-on-start",
|
||||||
"Delete the out directory before compilation",
|
"Delete the out directory before compilation.",
|
||||||
);
|
);
|
||||||
|
|
||||||
commander.version(pkg.version + " (@babel/core " + version + ")");
|
commander.version(pkg.version + " (@babel/core " + version + ")");
|
||||||
commander.usage("[options] <files ...>");
|
commander.usage("[options] <files ...>");
|
||||||
|
|
||||||
export default function parseArgv(args: Array<string>) {
|
export type CmdOptions = {
|
||||||
|
babelOptions: Object,
|
||||||
|
cliOptions: Object,
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function parseArgv(args: Array<string>): CmdOptions | null {
|
||||||
//
|
//
|
||||||
commander.parse(args);
|
commander.parse(args);
|
||||||
|
|
||||||
@ -200,6 +218,10 @@ export default function parseArgv(args: Array<string>) {
|
|||||||
errors.push("--delete-dir-on-start requires --out-dir");
|
errors.push("--delete-dir-on-start requires --out-dir");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (commander.verbose && commander.quiet) {
|
||||||
|
errors.push("--verbose and --quiet cannot be used together");
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!commander.outDir &&
|
!commander.outDir &&
|
||||||
filenames.length === 0 &&
|
filenames.length === 0 &&
|
||||||
@ -216,7 +238,7 @@ export default function parseArgv(args: Array<string>) {
|
|||||||
errors.forEach(function(e) {
|
errors.forEach(function(e) {
|
||||||
console.error(" " + e);
|
console.error(" " + e);
|
||||||
});
|
});
|
||||||
process.exit(2);
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const opts = commander.opts();
|
const opts = commander.opts();
|
||||||
@ -275,6 +297,7 @@ export default function parseArgv(args: Array<string>) {
|
|||||||
copyFiles: opts.copyFiles,
|
copyFiles: opts.copyFiles,
|
||||||
includeDotfiles: opts.includeDotfiles,
|
includeDotfiles: opts.includeDotfiles,
|
||||||
verbose: opts.verbose,
|
verbose: opts.verbose,
|
||||||
|
quiet: opts.quiet,
|
||||||
deleteDirOnStart: opts.deleteDirOnStart,
|
deleteDirOnStart: opts.deleteDirOnStart,
|
||||||
sourceMapTarget: opts.sourceMapTarget,
|
sourceMapTarget: opts.sourceMapTarget,
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,10 +1,12 @@
|
|||||||
|
// @flow
|
||||||
|
|
||||||
import readdirRecursive from "fs-readdir-recursive";
|
import readdirRecursive from "fs-readdir-recursive";
|
||||||
import * as babel from "@babel/core";
|
import * as babel from "@babel/core";
|
||||||
import includes from "lodash/includes";
|
import includes from "lodash/includes";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
|
||||||
export function chmod(src, dest) {
|
export function chmod(src: string, dest: string): void {
|
||||||
fs.chmodSync(dest, fs.statSync(src).mode);
|
fs.chmodSync(dest, fs.statSync(src).mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -13,8 +15,8 @@ type ReaddirFilter = (filename: string) => boolean;
|
|||||||
export function readdir(
|
export function readdir(
|
||||||
dirname: string,
|
dirname: string,
|
||||||
includeDotfiles: boolean,
|
includeDotfiles: boolean,
|
||||||
filter: ReaddirFilter,
|
filter?: ReaddirFilter,
|
||||||
) {
|
): Array<string> {
|
||||||
return readdirRecursive(dirname, (filename, _index, currentDirectory) => {
|
return readdirRecursive(dirname, (filename, _index, currentDirectory) => {
|
||||||
const stat = fs.statSync(path.join(currentDirectory, filename));
|
const stat = fs.statSync(path.join(currentDirectory, filename));
|
||||||
|
|
||||||
@ -29,8 +31,11 @@ export function readdir(
|
|||||||
export function readdirForCompilable(
|
export function readdirForCompilable(
|
||||||
dirname: string,
|
dirname: string,
|
||||||
includeDotfiles: boolean,
|
includeDotfiles: boolean,
|
||||||
) {
|
altExts?: Array<string>,
|
||||||
return readdir(dirname, includeDotfiles, isCompilableExtension);
|
): Array<string> {
|
||||||
|
return readdir(dirname, includeDotfiles, function(filename) {
|
||||||
|
return isCompilableExtension(filename, altExts);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,7 +50,7 @@ export function isCompilableExtension(
|
|||||||
return includes(exts, ext);
|
return includes(exts, ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function addSourceMappingUrl(code, loc) {
|
export function addSourceMappingUrl(code: string, loc: string): string {
|
||||||
return code + "\n//# sourceMappingURL=" + path.basename(loc);
|
return code + "\n//# sourceMappingURL=" + path.basename(loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,7 +58,11 @@ const CALLER = {
|
|||||||
name: "@babel/cli",
|
name: "@babel/cli",
|
||||||
};
|
};
|
||||||
|
|
||||||
export function transform(filename, code, opts) {
|
export function transform(
|
||||||
|
filename: string,
|
||||||
|
code: string,
|
||||||
|
opts: Object,
|
||||||
|
): Promise<Object> {
|
||||||
opts = {
|
opts = {
|
||||||
...opts,
|
...opts,
|
||||||
caller: CALLER,
|
caller: CALLER,
|
||||||
@ -68,7 +77,10 @@ export function transform(filename, code, opts) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function compile(filename, opts) {
|
export function compile(
|
||||||
|
filename: string,
|
||||||
|
opts: Object | Function,
|
||||||
|
): Promise<Object> {
|
||||||
opts = {
|
opts = {
|
||||||
...opts,
|
...opts,
|
||||||
caller: CALLER,
|
caller: CALLER,
|
||||||
@ -82,7 +94,7 @@ export function compile(filename, opts) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function deleteDir(path) {
|
export function deleteDir(path: string): void {
|
||||||
if (fs.existsSync(path)) {
|
if (fs.existsSync(path)) {
|
||||||
fs.readdirSync(path).forEach(function(file) {
|
fs.readdirSync(path).forEach(function(file) {
|
||||||
const curPath = path + "/" + file;
|
const curPath = path + "/" + file;
|
||||||
@ -100,10 +112,10 @@ export function deleteDir(path) {
|
|||||||
|
|
||||||
process.on("uncaughtException", function(err) {
|
process.on("uncaughtException", function(err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
process.exit(1);
|
process.exitCode = 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
export function requireChokidar() {
|
export function requireChokidar(): Object {
|
||||||
try {
|
try {
|
||||||
return require("chokidar");
|
return require("chokidar");
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@ -115,7 +127,10 @@ export function requireChokidar() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function adjustRelative(relative, keepFileExtension) {
|
export function adjustRelative(
|
||||||
|
relative: string,
|
||||||
|
keepFileExtension: boolean,
|
||||||
|
): string {
|
||||||
if (keepFileExtension) {
|
if (keepFileExtension) {
|
||||||
return relative;
|
return relative;
|
||||||
}
|
}
|
||||||
|
|||||||
1
packages/babel-cli/test/fixtures/babel/dir --out-file --extensions/in-files/src/bar/bar.es
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/dir --out-file --extensions/in-files/src/bar/bar.es
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
(() => 42)
|
||||||
1
packages/babel-cli/test/fixtures/babel/dir --out-file --extensions/in-files/src/foo.es
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/dir --out-file --extensions/in-files/src/foo.es
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
arr.map(x => x * MULTIPLIER);
|
||||||
3
packages/babel-cli/test/fixtures/babel/dir --out-file --extensions/options.json
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/dir --out-file --extensions/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"args": ["src", "--out-file", "test.js", "--extensions", ".es"]
|
||||||
|
}
|
||||||
10
packages/babel-cli/test/fixtures/babel/dir --out-file --extensions/out-files/test.js
vendored
Normal file
10
packages/babel-cli/test/fixtures/babel/dir --out-file --extensions/out-files/test.js
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
return 42;
|
||||||
|
});
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
arr.map(function (x) {
|
||||||
|
return x * MULTIPLIER;
|
||||||
|
});
|
||||||
0
packages/babel-cli/test/fixtures/babel/dir --out-file --extensions/stdout.txt
vendored
Normal file
0
packages/babel-cli/test/fixtures/babel/dir --out-file --extensions/stdout.txt
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/filename --out-file deep/in-files/script.js
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/filename --out-file deep/in-files/script.js
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
arr.map(x => x * MULTIPLIER);
|
||||||
3
packages/babel-cli/test/fixtures/babel/filename --out-file deep/options.json
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/filename --out-file deep/options.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"args": ["script.js", "--out-file", "folder/nested/script.js"]
|
||||||
|
}
|
||||||
@ -0,0 +1,5 @@
|
|||||||
|
"use strict";
|
||||||
|
|
||||||
|
arr.map(function (x) {
|
||||||
|
return x * MULTIPLIER;
|
||||||
|
});
|
||||||
5
packages/babel-cli/test/fixtures/babel/stdin --filename windows/options.json
vendored
Normal file
5
packages/babel-cli/test/fixtures/babel/stdin --filename windows/options.json
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"args": ["--filename", "test.js"],
|
||||||
|
"stderrContains": true,
|
||||||
|
"os": ["win32"]
|
||||||
|
}
|
||||||
1
packages/babel-cli/test/fixtures/babel/stdin --filename windows/stderr.txt
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/stdin --filename windows/stderr.txt
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
SyntaxError: <CWD>\test.js: Unexpected token, expected ";" (2:10)
|
||||||
3
packages/babel-cli/test/fixtures/babel/stdin --filename windows/stdin.txt
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/stdin --filename windows/stdin.txt
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
arr.map(function () {
|
||||||
|
return $]!;
|
||||||
|
});
|
||||||
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
"args": ["--filename", "test.js"],
|
"args": ["--filename", "test.js"],
|
||||||
"stderrContains": true
|
"stderrContains": true,
|
||||||
|
"os": ["linux", "darwin"]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
const readdir = require("fs-readdir-recursive");
|
const readdir = require("fs-readdir-recursive");
|
||||||
const helper = require("@babel/helper-fixtures");
|
const helper = require("@babel/helper-fixtures");
|
||||||
const rimraf = require("rimraf");
|
const rimraf = require("rimraf");
|
||||||
const outputFileSync = require("output-file-sync");
|
const { sync: makeDirSync } = require("make-dir");
|
||||||
const child = require("child_process");
|
const child = require("child_process");
|
||||||
const merge = require("lodash/merge");
|
const merge = require("lodash/merge");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
@ -14,6 +14,11 @@ const fileFilter = function(x) {
|
|||||||
return x !== ".DS_Store";
|
return x !== ".DS_Store";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const outputFileSync = function(filePath, data) {
|
||||||
|
makeDirSync(path.dirname(filePath));
|
||||||
|
fs.writeFileSync(filePath, data);
|
||||||
|
};
|
||||||
|
|
||||||
const presetLocs = [path.join(__dirname, "../../babel-preset-react")];
|
const presetLocs = [path.join(__dirname, "../../babel-preset-react")];
|
||||||
|
|
||||||
const pluginLocs = [
|
const pluginLocs = [
|
||||||
@ -86,13 +91,13 @@ const assertTest = function(stdout, stderr, opts, cwd) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (opts.outFiles) {
|
if (opts.outFiles) {
|
||||||
const actualFiles = readDir(path.join(tmpLoc), fileFilter);
|
const actualFiles = readDir(tmpLoc, fileFilter);
|
||||||
|
|
||||||
Object.keys(actualFiles).forEach(function(filename) {
|
Object.keys(actualFiles).forEach(function(filename) {
|
||||||
if (
|
if (
|
||||||
// saveInFiles always creates an empty .babelrc, so lets exclude for now
|
// saveInFiles always creates an empty .babelrc, so lets exclude for now
|
||||||
filename !== ".babelrc" &&
|
filename !== ".babelrc" &&
|
||||||
!opts.inFiles.hasOwnProperty(filename)
|
!Object.prototype.hasOwnProperty.call(opts.inFiles, filename)
|
||||||
) {
|
) {
|
||||||
const expected = opts.outFiles[filename];
|
const expected = opts.outFiles[filename];
|
||||||
const actual = actualFiles[filename];
|
const actual = actualFiles[filename];
|
||||||
@ -115,13 +120,6 @@ const buildTest = function(binName, testName, opts) {
|
|||||||
const binLoc = path.join(__dirname, "../lib", binName);
|
const binLoc = path.join(__dirname, "../lib", binName);
|
||||||
|
|
||||||
return function(callback) {
|
return function(callback) {
|
||||||
const dir = process.cwd();
|
|
||||||
|
|
||||||
process.chdir(__dirname);
|
|
||||||
if (fs.existsSync(tmpLoc)) rimraf.sync(tmpLoc);
|
|
||||||
fs.mkdirSync(tmpLoc);
|
|
||||||
process.chdir(tmpLoc);
|
|
||||||
|
|
||||||
saveInFiles(opts.inFiles);
|
saveInFiles(opts.inFiles);
|
||||||
|
|
||||||
let args = [binLoc];
|
let args = [binLoc];
|
||||||
@ -159,7 +157,6 @@ const buildTest = function(binName, testName, opts) {
|
|||||||
args.map(arg => `"${arg}"`).join(" ") + ": " + err.message;
|
args.map(arg => `"${arg}"`).join(" ") + ": " + err.message;
|
||||||
}
|
}
|
||||||
|
|
||||||
process.chdir(dir);
|
|
||||||
callback(err);
|
callback(err);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -171,12 +168,32 @@ const buildTest = function(binName, testName, opts) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
fs.readdirSync(fixtureLoc).forEach(function(binName) {
|
fs.readdirSync(fixtureLoc).forEach(function(binName) {
|
||||||
if (binName[0] === ".") return;
|
if (binName.startsWith(".")) return;
|
||||||
|
|
||||||
const suiteLoc = path.join(fixtureLoc, binName);
|
const suiteLoc = path.join(fixtureLoc, binName);
|
||||||
describe("bin/" + binName, function() {
|
describe("bin/" + binName, function() {
|
||||||
|
let cwd;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
cwd = process.cwd();
|
||||||
|
|
||||||
|
if (fs.existsSync(tmpLoc)) {
|
||||||
|
for (const child of fs.readdirSync(tmpLoc)) {
|
||||||
|
rimraf.sync(path.join(tmpLoc, child));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fs.mkdirSync(tmpLoc);
|
||||||
|
}
|
||||||
|
|
||||||
|
process.chdir(tmpLoc);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
process.chdir(cwd);
|
||||||
|
});
|
||||||
|
|
||||||
fs.readdirSync(suiteLoc).forEach(function(testName) {
|
fs.readdirSync(suiteLoc).forEach(function(testName) {
|
||||||
if (testName[0] === ".") return;
|
if (testName.startsWith(".")) return;
|
||||||
|
|
||||||
const testLoc = path.join(suiteLoc, testName);
|
const testLoc = path.join(suiteLoc, testName);
|
||||||
|
|
||||||
@ -185,7 +202,29 @@ fs.readdirSync(fixtureLoc).forEach(function(binName) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const optionsLoc = path.join(testLoc, "options.json");
|
const optionsLoc = path.join(testLoc, "options.json");
|
||||||
if (fs.existsSync(optionsLoc)) merge(opts, require(optionsLoc));
|
if (fs.existsSync(optionsLoc)) {
|
||||||
|
const taskOpts = require(optionsLoc);
|
||||||
|
if (taskOpts.os) {
|
||||||
|
let os = taskOpts.os;
|
||||||
|
|
||||||
|
if (!Array.isArray(os) && typeof os !== "string") {
|
||||||
|
throw new Error(
|
||||||
|
`'os' should be either string or string array: ${taskOpts.os}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (typeof os === "string") {
|
||||||
|
os = [os];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!os.includes(process.platform)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete taskOpts.os;
|
||||||
|
}
|
||||||
|
merge(opts, taskOpts);
|
||||||
|
}
|
||||||
|
|
||||||
["stdout", "stdin", "stderr"].forEach(function(key) {
|
["stdout", "stdin", "stderr"].forEach(function(key) {
|
||||||
const loc = path.join(testLoc, key + ".txt");
|
const loc = path.join(testLoc, key + ".txt");
|
||||||
@ -205,7 +244,7 @@ fs.readdirSync(fixtureLoc).forEach(function(binName) {
|
|||||||
opts.inFiles[".babelrc"] = helper.readFile(babelrcLoc);
|
opts.inFiles[".babelrc"] = helper.readFile(babelrcLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
it(testName, buildTest(binName, testName, opts));
|
it(testName, buildTest(binName, testName, opts), 20000);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@babel/code-frame",
|
"name": "@babel/code-frame",
|
||||||
"version": "7.0.0",
|
"version": "7.5.5",
|
||||||
"description": "Generate errors that contain a code frame that point to source locations.",
|
"description": "Generate errors that contain a code frame that point to source locations.",
|
||||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||||
"homepage": "https://babeljs.io/",
|
"homepage": "https://babeljs.io/",
|
||||||
|
|||||||
@ -76,7 +76,7 @@ function getMarkerLines(
|
|||||||
} else if (i === 0) {
|
} else if (i === 0) {
|
||||||
const sourceLength = source[lineNumber - 1].length;
|
const sourceLength = source[lineNumber - 1].length;
|
||||||
|
|
||||||
markerLines[lineNumber] = [startColumn, sourceLength - startColumn];
|
markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
|
||||||
} else if (i === lineDiff) {
|
} else if (i === lineDiff) {
|
||||||
markerLines[lineNumber] = [0, endColumn];
|
markerLines[lineNumber] = [0, endColumn];
|
||||||
} else {
|
} else {
|
||||||
@ -112,15 +112,16 @@ export function codeFrameColumns(
|
|||||||
const maybeHighlight = (chalkFn, string) => {
|
const maybeHighlight = (chalkFn, string) => {
|
||||||
return highlighted ? chalkFn(string) : string;
|
return highlighted ? chalkFn(string) : string;
|
||||||
};
|
};
|
||||||
if (highlighted) rawLines = highlight(rawLines, opts);
|
|
||||||
|
|
||||||
const lines = rawLines.split(NEWLINE);
|
const lines = rawLines.split(NEWLINE);
|
||||||
const { start, end, markerLines } = getMarkerLines(loc, lines, opts);
|
const { start, end, markerLines } = getMarkerLines(loc, lines, opts);
|
||||||
const hasColumns = loc.start && typeof loc.start.column === "number";
|
const hasColumns = loc.start && typeof loc.start.column === "number";
|
||||||
|
|
||||||
const numberMaxWidth = String(end).length;
|
const numberMaxWidth = String(end).length;
|
||||||
|
|
||||||
let frame = lines
|
const highlightedLines = highlighted ? highlight(rawLines, opts) : rawLines;
|
||||||
|
|
||||||
|
let frame = highlightedLines
|
||||||
|
.split(NEWLINE)
|
||||||
.slice(start, end)
|
.slice(start, end)
|
||||||
.map((line, index) => {
|
.map((line, index) => {
|
||||||
const number = start + 1 + index;
|
const number = start + 1 + index;
|
||||||
|
|||||||
@ -102,6 +102,45 @@ describe("@babel/code-frame", function() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("opts.highlightCode with multiple columns and lines", function() {
|
||||||
|
// prettier-ignore
|
||||||
|
const rawLines = [
|
||||||
|
"function a(b, c) {",
|
||||||
|
" return b + c;",
|
||||||
|
"}"
|
||||||
|
].join("\n");
|
||||||
|
|
||||||
|
const result = codeFrameColumns(
|
||||||
|
rawLines,
|
||||||
|
{
|
||||||
|
start: {
|
||||||
|
line: 1,
|
||||||
|
column: 1,
|
||||||
|
},
|
||||||
|
end: {
|
||||||
|
line: 3,
|
||||||
|
column: 1,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
highlightCode: true,
|
||||||
|
message: "Message about things",
|
||||||
|
},
|
||||||
|
);
|
||||||
|
const stripped = stripAnsi(result);
|
||||||
|
expect(stripped).toEqual(
|
||||||
|
// prettier-ignore
|
||||||
|
[
|
||||||
|
"> 1 | function a(b, c) {",
|
||||||
|
" | ^^^^^^^^^^^^^^^^^^",
|
||||||
|
"> 2 | return b + c;",
|
||||||
|
" | ^^^^^^^^^^^^^^^",
|
||||||
|
"> 3 | }",
|
||||||
|
" | ^ Message about things",
|
||||||
|
].join('\n'),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
test("opts.linesAbove", function() {
|
test("opts.linesAbove", function() {
|
||||||
const rawLines = [
|
const rawLines = [
|
||||||
"/**",
|
"/**",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@babel/core",
|
"name": "@babel/core",
|
||||||
"version": "7.1.2",
|
"version": "7.7.2",
|
||||||
"description": "Babel compiler core.",
|
"description": "Babel compiler core.",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||||
@ -33,23 +33,22 @@
|
|||||||
"./lib/transform-file.js": "./lib/transform-file-browser.js"
|
"./lib/transform-file.js": "./lib/transform-file-browser.js"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/code-frame": "^7.0.0",
|
"@babel/code-frame": "^7.5.5",
|
||||||
"@babel/generator": "^7.1.2",
|
"@babel/generator": "^7.7.2",
|
||||||
"@babel/helpers": "^7.1.2",
|
"@babel/helpers": "^7.7.0",
|
||||||
"@babel/parser": "^7.1.2",
|
"@babel/parser": "^7.7.2",
|
||||||
"@babel/template": "^7.1.2",
|
"@babel/template": "^7.7.0",
|
||||||
"@babel/traverse": "^7.1.0",
|
"@babel/traverse": "^7.7.2",
|
||||||
"@babel/types": "^7.1.2",
|
"@babel/types": "^7.7.2",
|
||||||
"convert-source-map": "^1.1.0",
|
"convert-source-map": "^1.7.0",
|
||||||
"debug": "^3.1.0",
|
"debug": "^4.1.0",
|
||||||
"json5": "^0.5.0",
|
"json5": "^2.1.0",
|
||||||
"lodash": "^4.17.10",
|
"lodash": "^4.17.13",
|
||||||
"resolve": "^1.3.2",
|
"resolve": "^1.3.2",
|
||||||
"semver": "^5.4.1",
|
"semver": "^5.4.1",
|
||||||
"source-map": "^0.5.0"
|
"source-map": "^0.5.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/helper-transform-fixture-test-runner": "^7.0.0",
|
"@babel/helper-transform-fixture-test-runner": "^7.6.4"
|
||||||
"@babel/register": "^7.0.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,6 +54,7 @@ function makeCachedFunction<
|
|||||||
ArgT,
|
ArgT,
|
||||||
ResultT,
|
ResultT,
|
||||||
SideChannel,
|
SideChannel,
|
||||||
|
// $FlowIssue https://github.com/facebook/flow/issues/4528
|
||||||
Cache: CacheMap<ArgT, ResultT, SideChannel>,
|
Cache: CacheMap<ArgT, ResultT, SideChannel>,
|
||||||
>(
|
>(
|
||||||
callCache: Cache,
|
callCache: Cache,
|
||||||
|
|||||||
@ -67,7 +67,7 @@ export function buildPresetChain(
|
|||||||
return {
|
return {
|
||||||
plugins: dedupDescriptors(chain.plugins),
|
plugins: dedupDescriptors(chain.plugins),
|
||||||
presets: dedupDescriptors(chain.presets),
|
presets: dedupDescriptors(chain.presets),
|
||||||
options: chain.options,
|
options: chain.options.map(o => normalizeOptions(o)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,6 +155,7 @@ export function buildRootChain(
|
|||||||
}
|
}
|
||||||
|
|
||||||
let { babelrc, babelrcRoots } = opts;
|
let { babelrc, babelrcRoots } = opts;
|
||||||
|
let babelrcRootsDirectory = context.cwd;
|
||||||
|
|
||||||
const configFileChain = emptyChain();
|
const configFileChain = emptyChain();
|
||||||
if (configFile) {
|
if (configFile) {
|
||||||
@ -168,6 +169,7 @@ export function buildRootChain(
|
|||||||
babelrc = validatedFile.options.babelrc;
|
babelrc = validatedFile.options.babelrc;
|
||||||
}
|
}
|
||||||
if (babelrcRoots === undefined) {
|
if (babelrcRoots === undefined) {
|
||||||
|
babelrcRootsDirectory = validatedFile.dirname;
|
||||||
babelrcRoots = validatedFile.options.babelrcRoots;
|
babelrcRoots = validatedFile.options.babelrcRoots;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +187,7 @@ export function buildRootChain(
|
|||||||
if (
|
if (
|
||||||
(babelrc === true || babelrc === undefined) &&
|
(babelrc === true || babelrc === undefined) &&
|
||||||
pkgData &&
|
pkgData &&
|
||||||
babelrcLoadEnabled(context, pkgData, babelrcRoots)
|
babelrcLoadEnabled(context, pkgData, babelrcRoots, babelrcRootsDirectory)
|
||||||
) {
|
) {
|
||||||
({ ignore: ignoreFile, config: babelrcFile } = findRelativeConfig(
|
({ ignore: ignoreFile, config: babelrcFile } = findRelativeConfig(
|
||||||
pkgData,
|
pkgData,
|
||||||
@ -229,6 +231,7 @@ function babelrcLoadEnabled(
|
|||||||
context: ConfigContext,
|
context: ConfigContext,
|
||||||
pkgData: FilePackageData,
|
pkgData: FilePackageData,
|
||||||
babelrcRoots: BabelrcSearch | void,
|
babelrcRoots: BabelrcSearch | void,
|
||||||
|
babelrcRootsDirectory: string,
|
||||||
): boolean {
|
): boolean {
|
||||||
if (typeof babelrcRoots === "boolean") return babelrcRoots;
|
if (typeof babelrcRoots === "boolean") return babelrcRoots;
|
||||||
|
|
||||||
@ -243,7 +246,9 @@ function babelrcLoadEnabled(
|
|||||||
let babelrcPatterns = babelrcRoots;
|
let babelrcPatterns = babelrcRoots;
|
||||||
if (!Array.isArray(babelrcPatterns)) babelrcPatterns = [babelrcPatterns];
|
if (!Array.isArray(babelrcPatterns)) babelrcPatterns = [babelrcPatterns];
|
||||||
babelrcPatterns = babelrcPatterns.map(pat => {
|
babelrcPatterns = babelrcPatterns.map(pat => {
|
||||||
return typeof pat === "string" ? path.resolve(context.cwd, pat) : pat;
|
return typeof pat === "string"
|
||||||
|
? path.resolve(babelrcRootsDirectory, pat)
|
||||||
|
: pat;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Fast path to avoid having to match patterns if the babelrc is just
|
// Fast path to avoid having to match patterns if the babelrc is just
|
||||||
@ -253,21 +258,21 @@ function babelrcLoadEnabled(
|
|||||||
}
|
}
|
||||||
|
|
||||||
return babelrcPatterns.some(pat => {
|
return babelrcPatterns.some(pat => {
|
||||||
if (typeof pat === "string") pat = pathPatternToRegex(pat, context.cwd);
|
if (typeof pat === "string") {
|
||||||
|
pat = pathPatternToRegex(pat, babelrcRootsDirectory);
|
||||||
|
}
|
||||||
|
|
||||||
return pkgData.directories.some(directory => {
|
return pkgData.directories.some(directory => {
|
||||||
return matchPattern(pat, context.cwd, directory, context);
|
return matchPattern(pat, babelrcRootsDirectory, directory, context);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const validateConfigFile = makeWeakCache(
|
const validateConfigFile = makeWeakCache((file: ConfigFile): ValidatedFile => ({
|
||||||
(file: ConfigFile): ValidatedFile => ({
|
|
||||||
filepath: file.filepath,
|
filepath: file.filepath,
|
||||||
dirname: file.dirname,
|
dirname: file.dirname,
|
||||||
options: validate("configfile", file.options),
|
options: validate("configfile", file.options),
|
||||||
}),
|
}));
|
||||||
);
|
|
||||||
|
|
||||||
const validateBabelrcFile = makeWeakCache(
|
const validateBabelrcFile = makeWeakCache(
|
||||||
(file: ConfigFile): ValidatedFile => ({
|
(file: ConfigFile): ValidatedFile => ({
|
||||||
@ -277,13 +282,11 @@ const validateBabelrcFile = makeWeakCache(
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
const validateExtendFile = makeWeakCache(
|
const validateExtendFile = makeWeakCache((file: ConfigFile): ValidatedFile => ({
|
||||||
(file: ConfigFile): ValidatedFile => ({
|
|
||||||
filepath: file.filepath,
|
filepath: file.filepath,
|
||||||
dirname: file.dirname,
|
dirname: file.dirname,
|
||||||
options: validate("extendsfile", file.options),
|
options: validate("extendsfile", file.options),
|
||||||
}),
|
}));
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build a config chain for just the programmatic options passed into Babel.
|
* Build a config chain for just the programmatic options passed into Babel.
|
||||||
@ -542,7 +545,7 @@ function normalizeOptions(opts: ValidatedOptions): ValidatedOptions {
|
|||||||
|
|
||||||
// "sourceMap" is just aliased to sourceMap, so copy it over as
|
// "sourceMap" is just aliased to sourceMap, so copy it over as
|
||||||
// we merge the options together.
|
// we merge the options together.
|
||||||
if (options.hasOwnProperty("sourceMap")) {
|
if (Object.prototype.hasOwnProperty.call(options, "sourceMap")) {
|
||||||
options.sourceMaps = options.sourceMap;
|
options.sourceMaps = options.sourceMap;
|
||||||
delete options.sourceMap;
|
delete options.sourceMap;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -345,6 +345,7 @@ function assertNoDuplicates(items: Array<UnloadedDescriptor>): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (nameMap.has(item.name)) {
|
if (nameMap.has(item.name)) {
|
||||||
|
const conflicts = items.filter(i => i.value === item.value);
|
||||||
throw new Error(
|
throw new Error(
|
||||||
[
|
[
|
||||||
`Duplicate plugin/preset detected.`,
|
`Duplicate plugin/preset detected.`,
|
||||||
@ -355,6 +356,9 @@ function assertNoDuplicates(items: Array<UnloadedDescriptor>): void {
|
|||||||
` ['some-plugin', {}],`,
|
` ['some-plugin', {}],`,
|
||||||
` ['some-plugin', {}, 'some unique name'],`,
|
` ['some-plugin', {}, 'some unique name'],`,
|
||||||
` ]`,
|
` ]`,
|
||||||
|
``,
|
||||||
|
`Duplicates detected are:`,
|
||||||
|
`${JSON.stringify(conflicts, null, 2)}`,
|
||||||
].join("\n"),
|
].join("\n"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import {
|
|||||||
makeWeakCache,
|
makeWeakCache,
|
||||||
type CacheConfigurator,
|
type CacheConfigurator,
|
||||||
} from "../caching";
|
} from "../caching";
|
||||||
import makeAPI from "../helpers/config-api";
|
import makeAPI, { type PluginAPI } from "../helpers/config-api";
|
||||||
import { makeStaticFileCache } from "./utils";
|
import { makeStaticFileCache } from "./utils";
|
||||||
import pathPatternToRegex from "../pattern-to-regex";
|
import pathPatternToRegex from "../pattern-to-regex";
|
||||||
import type { FilePackageData, RelativeConfig, ConfigFile } from "./types";
|
import type { FilePackageData, RelativeConfig, ConfigFile } from "./types";
|
||||||
@ -18,18 +18,22 @@ import type { CallerMetadata } from "../validation/options";
|
|||||||
|
|
||||||
const debug = buildDebug("babel:config:loading:files:configuration");
|
const debug = buildDebug("babel:config:loading:files:configuration");
|
||||||
|
|
||||||
const BABEL_CONFIG_JS_FILENAME = "babel.config.js";
|
const ROOT_CONFIG_FILENAMES = [
|
||||||
|
"babel.config.js",
|
||||||
|
"babel.config.cjs",
|
||||||
|
"babel.config.json",
|
||||||
|
];
|
||||||
|
const RELATIVE_CONFIG_FILENAMES = [".babelrc", ".babelrc.js", ".babelrc.cjs"];
|
||||||
|
|
||||||
const BABELRC_FILENAME = ".babelrc";
|
|
||||||
const BABELRC_JS_FILENAME = ".babelrc.js";
|
|
||||||
const BABELIGNORE_FILENAME = ".babelignore";
|
const BABELIGNORE_FILENAME = ".babelignore";
|
||||||
|
|
||||||
export function findConfigUpwards(rootDir: string): string | null {
|
export function findConfigUpwards(rootDir: string): string | null {
|
||||||
let dirname = rootDir;
|
let dirname = rootDir;
|
||||||
while (true) {
|
while (true) {
|
||||||
if (fs.existsSync(path.join(dirname, BABEL_CONFIG_JS_FILENAME))) {
|
const configFileFound = ROOT_CONFIG_FILENAMES.some(filename =>
|
||||||
return dirname;
|
fs.existsSync(path.join(dirname, filename)),
|
||||||
}
|
);
|
||||||
|
if (configFileFound) return dirname;
|
||||||
|
|
||||||
const nextDir = path.dirname(dirname);
|
const nextDir = path.dirname(dirname);
|
||||||
if (dirname === nextDir) break;
|
if (dirname === nextDir) break;
|
||||||
@ -51,46 +55,16 @@ export function findRelativeConfig(
|
|||||||
|
|
||||||
for (const loc of packageData.directories) {
|
for (const loc of packageData.directories) {
|
||||||
if (!config) {
|
if (!config) {
|
||||||
config = [BABELRC_FILENAME, BABELRC_JS_FILENAME].reduce(
|
config = loadOneConfig(
|
||||||
(previousConfig: ConfigFile | null, name) => {
|
RELATIVE_CONFIG_FILENAMES,
|
||||||
const filepath = path.join(loc, name);
|
loc,
|
||||||
const config = readConfig(filepath, envName, caller);
|
envName,
|
||||||
|
caller,
|
||||||
if (config && previousConfig) {
|
|
||||||
throw new Error(
|
|
||||||
`Multiple configuration files found. Please remove one:\n` +
|
|
||||||
` - ${path.basename(previousConfig.filepath)}\n` +
|
|
||||||
` - ${name}\n` +
|
|
||||||
`from ${loc}`,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return config || previousConfig;
|
|
||||||
},
|
|
||||||
null,
|
|
||||||
);
|
|
||||||
|
|
||||||
const pkgConfig =
|
|
||||||
packageData.pkg && packageData.pkg.dirname === loc
|
packageData.pkg && packageData.pkg.dirname === loc
|
||||||
? packageToBabelConfig(packageData.pkg)
|
? packageToBabelConfig(packageData.pkg)
|
||||||
: null;
|
: null,
|
||||||
|
|
||||||
if (pkgConfig) {
|
|
||||||
if (config) {
|
|
||||||
throw new Error(
|
|
||||||
`Multiple configuration files found. Please remove one:\n` +
|
|
||||||
` - ${path.basename(pkgConfig.filepath)}#babel\n` +
|
|
||||||
` - ${path.basename(config.filepath)}\n` +
|
|
||||||
`from ${loc}`,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
config = pkgConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config) {
|
|
||||||
debug("Found configuration %o from %o.", config.filepath, dirname);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ignore) {
|
if (!ignore) {
|
||||||
const ignoreLoc = path.join(loc, BABELIGNORE_FILENAME);
|
const ignoreLoc = path.join(loc, BABELIGNORE_FILENAME);
|
||||||
@ -110,13 +84,36 @@ export function findRootConfig(
|
|||||||
envName: string,
|
envName: string,
|
||||||
caller: CallerMetadata | void,
|
caller: CallerMetadata | void,
|
||||||
): ConfigFile | null {
|
): ConfigFile | null {
|
||||||
const filepath = path.resolve(dirname, BABEL_CONFIG_JS_FILENAME);
|
return loadOneConfig(ROOT_CONFIG_FILENAMES, dirname, envName, caller);
|
||||||
|
}
|
||||||
|
|
||||||
const conf = readConfig(filepath, envName, caller);
|
function loadOneConfig(
|
||||||
if (conf) {
|
names: string[],
|
||||||
debug("Found root config %o in $o.", BABEL_CONFIG_JS_FILENAME, dirname);
|
dirname: string,
|
||||||
|
envName: string,
|
||||||
|
caller: CallerMetadata | void,
|
||||||
|
previousConfig?: ConfigFile | null = null,
|
||||||
|
): ConfigFile | null {
|
||||||
|
const config = names.reduce((previousConfig: ConfigFile | null, name) => {
|
||||||
|
const filepath = path.resolve(dirname, name);
|
||||||
|
const config = readConfig(filepath, envName, caller);
|
||||||
|
|
||||||
|
if (config && previousConfig) {
|
||||||
|
throw new Error(
|
||||||
|
`Multiple configuration files found. Please remove one:\n` +
|
||||||
|
` - ${path.basename(previousConfig.filepath)}\n` +
|
||||||
|
` - ${name}\n` +
|
||||||
|
`from ${dirname}`,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return conf;
|
|
||||||
|
return config || previousConfig;
|
||||||
|
}, previousConfig);
|
||||||
|
|
||||||
|
if (config) {
|
||||||
|
debug("Found configuration %o from %o.", config.filepath, dirname);
|
||||||
|
}
|
||||||
|
return config;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loadConfig(
|
export function loadConfig(
|
||||||
@ -132,7 +129,7 @@ export function loadConfig(
|
|||||||
throw new Error(`Config file ${filepath} contains no configuration data`);
|
throw new Error(`Config file ${filepath} contains no configuration data`);
|
||||||
}
|
}
|
||||||
|
|
||||||
debug("Loaded config %o from $o.", name, dirname);
|
debug("Loaded config %o from %o.", name, dirname);
|
||||||
return conf;
|
return conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +138,8 @@ export function loadConfig(
|
|||||||
* throw if there are parsing errors while loading a config.
|
* throw if there are parsing errors while loading a config.
|
||||||
*/
|
*/
|
||||||
function readConfig(filepath, envName, caller): ConfigFile | null {
|
function readConfig(filepath, envName, caller): ConfigFile | null {
|
||||||
return path.extname(filepath) === ".js"
|
const ext = path.extname(filepath);
|
||||||
|
return ext === ".js" || ext === ".cjs"
|
||||||
? readConfigJS(filepath, { envName, caller })
|
? readConfigJS(filepath, { envName, caller })
|
||||||
: readConfigJSON5(filepath);
|
: readConfigJSON5(filepath);
|
||||||
}
|
}
|
||||||
@ -150,7 +148,7 @@ const LOADING_CONFIGS = new Set();
|
|||||||
|
|
||||||
const readConfigJS = makeStrongCache(
|
const readConfigJS = makeStrongCache(
|
||||||
(
|
(
|
||||||
filepath,
|
filepath: string,
|
||||||
cache: CacheConfigurator<{
|
cache: CacheConfigurator<{
|
||||||
envName: string,
|
envName: string,
|
||||||
caller: CallerMetadata | void,
|
caller: CallerMetadata | void,
|
||||||
@ -193,7 +191,7 @@ const readConfigJS = makeStrongCache(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (typeof options === "function") {
|
if (typeof options === "function") {
|
||||||
options = options(makeAPI(cache));
|
options = ((options: any): (api: PluginAPI) => {})(makeAPI(cache));
|
||||||
|
|
||||||
if (!cache.configured()) throwConfigError();
|
if (!cache.configured()) throwConfigError();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -132,7 +132,7 @@ function resolveStandardizedName(
|
|||||||
} catch (e2) {}
|
} catch (e2) {}
|
||||||
|
|
||||||
if (resolvedOppositeType) {
|
if (resolvedOppositeType) {
|
||||||
e.message += `\n- Did you accidentally pass a ${type} as a ${oppositeType}?`;
|
e.message += `\n- Did you accidentally pass a ${oppositeType} as a ${type}?`;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw e;
|
throw e;
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import { validatePluginObject } from "./validation/plugins";
|
|||||||
import makeAPI from "./helpers/config-api";
|
import makeAPI from "./helpers/config-api";
|
||||||
|
|
||||||
import loadPrivatePartialConfig from "./partial";
|
import loadPrivatePartialConfig from "./partial";
|
||||||
|
import type { ValidatedOptions } from "./validation/options";
|
||||||
|
|
||||||
type LoadedDescriptor = {
|
type LoadedDescriptor = {
|
||||||
value: {},
|
value: {},
|
||||||
@ -202,7 +203,7 @@ const loadDescriptor = makeWeakCache(
|
|||||||
if (typeof item.then === "function") {
|
if (typeof item.then === "function") {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`You appear to be using an async plugin, ` +
|
`You appear to be using an async plugin, ` +
|
||||||
`which your current version of Babel does not support.` +
|
`which your current version of Babel does not support. ` +
|
||||||
`If you're using a published plugin, ` +
|
`If you're using a published plugin, ` +
|
||||||
`you may need to upgrade your @babel/core version.`,
|
`you may need to upgrade your @babel/core version.`,
|
||||||
);
|
);
|
||||||
@ -278,6 +279,42 @@ const instantiatePlugin = makeWeakCache(
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const validateIfOptionNeedsFilename = (
|
||||||
|
options: ValidatedOptions,
|
||||||
|
descriptor: UnloadedDescriptor,
|
||||||
|
): void => {
|
||||||
|
if (options.test || options.include || options.exclude) {
|
||||||
|
const formattedPresetName = descriptor.name
|
||||||
|
? `"${descriptor.name}"`
|
||||||
|
: "/* your preset */";
|
||||||
|
throw new Error(
|
||||||
|
[
|
||||||
|
`Preset ${formattedPresetName} requires a filename to be set when babel is called directly,`,
|
||||||
|
`\`\`\``,
|
||||||
|
`babel.transform(code, { filename: 'file.ts', presets: [${formattedPresetName}] });`,
|
||||||
|
`\`\`\``,
|
||||||
|
`See https://babeljs.io/docs/en/options#filename for more information.`,
|
||||||
|
].join("\n"),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const validatePreset = (
|
||||||
|
preset: PresetInstance,
|
||||||
|
context: ConfigContext,
|
||||||
|
descriptor: UnloadedDescriptor,
|
||||||
|
): void => {
|
||||||
|
if (!context.filename) {
|
||||||
|
const { options } = preset;
|
||||||
|
validateIfOptionNeedsFilename(options, descriptor);
|
||||||
|
if (options.overrides) {
|
||||||
|
options.overrides.forEach(overrideOptions =>
|
||||||
|
validateIfOptionNeedsFilename(overrideOptions, descriptor),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a config object that will act as the root of a new nested config.
|
* Generate a config object that will act as the root of a new nested config.
|
||||||
*/
|
*/
|
||||||
@ -285,10 +322,9 @@ const loadPresetDescriptor = (
|
|||||||
descriptor: UnloadedDescriptor,
|
descriptor: UnloadedDescriptor,
|
||||||
context: ConfigContext,
|
context: ConfigContext,
|
||||||
): ConfigChain | null => {
|
): ConfigChain | null => {
|
||||||
return buildPresetChain(
|
const preset = instantiatePreset(loadDescriptor(descriptor, context));
|
||||||
instantiatePreset(loadDescriptor(descriptor, context)),
|
validatePreset(preset, context, descriptor);
|
||||||
context,
|
return buildPresetChain(preset, context);
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const instantiatePreset = makeWeakCache(
|
const instantiatePreset = makeWeakCache(
|
||||||
|
|||||||
@ -55,6 +55,7 @@ export default function makeAPI(
|
|||||||
async: () => false,
|
async: () => false,
|
||||||
caller,
|
caller,
|
||||||
assertVersion,
|
assertVersion,
|
||||||
|
tokTypes: undefined,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +70,7 @@ function assertVersion(range: string | number): void {
|
|||||||
throw new Error("Expected string or integer value.");
|
throw new Error("Expected string or integer value.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (semver.satisfies(coreVersion, range)) return;
|
if (semver.satisfies(semver.coerce(coreVersion).raw, range)) return;
|
||||||
|
|
||||||
const limit = Error.stackTraceLimit;
|
const limit = Error.stackTraceLimit;
|
||||||
|
|
||||||
|
|||||||
@ -231,7 +231,7 @@ function assertIgnoreItem(loc: GeneralPath, value: mixed): IgnoreItem {
|
|||||||
throw new Error(
|
throw new Error(
|
||||||
`${msg(
|
`${msg(
|
||||||
loc,
|
loc,
|
||||||
)} must be an array of string/Funtion/RegExp values, or undefined`,
|
)} must be an array of string/Function/RegExp values, or undefined`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
@ -278,7 +278,7 @@ export function assertConfigFileSearch(
|
|||||||
) {
|
) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`${msg(loc)} must be a undefined, a boolean, a string, ` +
|
`${msg(loc)} must be a undefined, a boolean, a string, ` +
|
||||||
`got ${JSON.stringify(value)}`,
|
`got ${JSON.stringify((value: any))}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -302,7 +302,7 @@ export function assertBabelrcSearch(
|
|||||||
} else if (!checkValidTest(value)) {
|
} else if (!checkValidTest(value)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`${msg(loc)} must be a undefined, a boolean, a string/Function/RegExp ` +
|
`${msg(loc)} must be a undefined, a boolean, a string/Function/RegExp ` +
|
||||||
`or an array of those, got ${JSON.stringify(value)}`,
|
`or an array of those, got ${JSON.stringify((value: any))}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return (value: any);
|
return (value: any);
|
||||||
@ -337,7 +337,7 @@ function assertPluginItem(loc: GeneralPath, value: mixed): PluginItem {
|
|||||||
if (
|
if (
|
||||||
opts !== undefined &&
|
opts !== undefined &&
|
||||||
opts !== false &&
|
opts !== false &&
|
||||||
(typeof opts !== "object" || Array.isArray(opts))
|
(typeof opts !== "object" || Array.isArray(opts) || opts === null)
|
||||||
) {
|
) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`${msg(access(loc, 1))} must be an object, false, or undefined`,
|
`${msg(access(loc, 1))} must be an object, false, or undefined`,
|
||||||
|
|||||||
@ -272,7 +272,8 @@ export type OptionsSource =
|
|||||||
| "configfile"
|
| "configfile"
|
||||||
| "babelrcfile"
|
| "babelrcfile"
|
||||||
| "extendsfile"
|
| "extendsfile"
|
||||||
| "preset";
|
| "preset"
|
||||||
|
| "plugin";
|
||||||
|
|
||||||
type RootPath = $ReadOnly<{
|
type RootPath = $ReadOnly<{
|
||||||
type: "root",
|
type: "root",
|
||||||
@ -350,7 +351,7 @@ function validateNested(loc: NestingPath, opts: {}) {
|
|||||||
NONPRESET_VALIDATORS[key] ||
|
NONPRESET_VALIDATORS[key] ||
|
||||||
BABELRC_VALIDATORS[key] ||
|
BABELRC_VALIDATORS[key] ||
|
||||||
ROOT_VALIDATORS[key] ||
|
ROOT_VALIDATORS[key] ||
|
||||||
throwUnknownError;
|
(throwUnknownError: Validator<void>);
|
||||||
|
|
||||||
validator(optLoc, opts[key]);
|
validator(optLoc, opts[key]);
|
||||||
});
|
});
|
||||||
|
|||||||
@ -84,10 +84,19 @@ export type PluginObject = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export function validatePluginObject(obj: {}): PluginObject {
|
export function validatePluginObject(obj: {}): PluginObject {
|
||||||
|
const rootPath: RootPath = {
|
||||||
|
type: "root",
|
||||||
|
source: "plugin",
|
||||||
|
};
|
||||||
Object.keys(obj).forEach(key => {
|
Object.keys(obj).forEach(key => {
|
||||||
const validator = VALIDATORS[key];
|
const validator = VALIDATORS[key];
|
||||||
|
const optLoc = {
|
||||||
|
type: "option",
|
||||||
|
name: key,
|
||||||
|
parent: rootPath,
|
||||||
|
};
|
||||||
|
|
||||||
if (validator) validator(key, obj[key]);
|
if (validator) validator(optLoc, obj[key]);
|
||||||
else throw new Error(`.${key} is not a valid Plugin property`);
|
else throw new Error(`.${key} is not a valid Plugin property`);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -10,6 +10,8 @@ export { version } from "../package.json";
|
|||||||
export { getEnv } from "./config/helpers/environment";
|
export { getEnv } from "./config/helpers/environment";
|
||||||
|
|
||||||
export * as types from "@babel/types";
|
export * as types from "@babel/types";
|
||||||
|
export { tokTypes } from "@babel/parser";
|
||||||
|
|
||||||
export { default as traverse } from "@babel/traverse";
|
export { default as traverse } from "@babel/traverse";
|
||||||
export { default as template } from "@babel/template";
|
export { default as template } from "@babel/template";
|
||||||
|
|
||||||
|
|||||||
@ -1,14 +1,29 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import type { FileResult } from "./transformation";
|
|
||||||
|
|
||||||
export default function transformFile(
|
// duplicated from transform-file so we do not have to import anything here
|
||||||
filename: string,
|
type TransformFile = {
|
||||||
opts?: Object = {},
|
(filename: string, callback: Function): void,
|
||||||
callback: (?Error, FileResult | null) => void,
|
(filename: string, opts: ?Object, callback: Function): void,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const transformFile: TransformFile = (function transformFile(
|
||||||
|
filename,
|
||||||
|
opts,
|
||||||
|
callback,
|
||||||
) {
|
) {
|
||||||
if (typeof opts === "function") {
|
if (typeof opts === "function") {
|
||||||
callback = opts;
|
callback = opts;
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(new Error("Transforming files is not supported in browsers"), null);
|
callback(new Error("Transforming files is not supported in browsers"), null);
|
||||||
|
}: Function);
|
||||||
|
|
||||||
|
export function transformFileSync() {
|
||||||
|
throw new Error("Transforming files is not supported in browsers");
|
||||||
|
}
|
||||||
|
|
||||||
|
export function transformFileAsync() {
|
||||||
|
return Promise.reject(
|
||||||
|
new Error("Transforming files is not supported in browsers"),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +0,0 @@
|
|||||||
// @flow
|
|
||||||
|
|
||||||
export default function transformFileSync() {
|
|
||||||
throw new Error("Transforming files is not supported in browsers");
|
|
||||||
}
|
|
||||||
@ -9,6 +9,14 @@ import {
|
|||||||
type FileResultCallback,
|
type FileResultCallback,
|
||||||
} from "./transformation";
|
} from "./transformation";
|
||||||
|
|
||||||
|
import typeof * as transformFileBrowserType from "./transform-file-browser";
|
||||||
|
import typeof * as transformFileType from "./transform-file";
|
||||||
|
|
||||||
|
// Kind of gross, but essentially asserting that the exports of this module are the same as the
|
||||||
|
// exports of transform-file-browser, since this file may be replaced at bundle time with
|
||||||
|
// transform-file-browser.
|
||||||
|
((({}: any): $Exact<transformFileBrowserType>): $Exact<transformFileType>);
|
||||||
|
|
||||||
type TransformFile = {
|
type TransformFile = {
|
||||||
(filename: string, callback: FileResultCallback): void,
|
(filename: string, callback: FileResultCallback): void,
|
||||||
(filename: string, opts: ?InputOptions, callback: FileResultCallback): void,
|
(filename: string, opts: ?InputOptions, callback: FileResultCallback): void,
|
||||||
|
|||||||
@ -19,6 +19,17 @@ const errorVisitor = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type NodeLocation = {
|
||||||
|
loc?: {
|
||||||
|
end?: { line: number, column: number },
|
||||||
|
start: { line: number, column: number },
|
||||||
|
},
|
||||||
|
_loc?: {
|
||||||
|
end?: { line: number, column: number },
|
||||||
|
start: { line: number, column: number },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
export default class File {
|
export default class File {
|
||||||
_map: Map<any, any> = new Map();
|
_map: Map<any, any> = new Map();
|
||||||
opts: Object;
|
opts: Object;
|
||||||
@ -183,7 +194,7 @@ export default class File {
|
|||||||
// and this fails because a prerelease version can only satisfy a range
|
// and this fails because a prerelease version can only satisfy a range
|
||||||
// if it is a prerelease within the same major/minor/patch range.
|
// if it is a prerelease within the same major/minor/patch range.
|
||||||
//
|
//
|
||||||
// Note: If this is found to have issues, please also revist the logic in
|
// Note: If this is found to have issues, please also revisit the logic in
|
||||||
// transform-runtime's definitions.js file.
|
// transform-runtime's definitions.js file.
|
||||||
if (semver.valid(versionRange)) versionRange = `^${versionRange}`;
|
if (semver.valid(versionRange)) versionRange = `^${versionRange}`;
|
||||||
|
|
||||||
@ -203,6 +214,9 @@ export default class File {
|
|||||||
if (res) return res;
|
if (res) return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// make sure that the helper exists
|
||||||
|
helpers.ensure(name);
|
||||||
|
|
||||||
const uid = (this.declarations[name] = this.scope.generateUidIdentifier(
|
const uid = (this.declarations[name] = this.scope.generateUidIdentifier(
|
||||||
name,
|
name,
|
||||||
));
|
));
|
||||||
@ -247,17 +261,12 @@ export default class File {
|
|||||||
}
|
}
|
||||||
|
|
||||||
buildCodeFrameError(
|
buildCodeFrameError(
|
||||||
node: ?{
|
node: ?NodeLocation,
|
||||||
loc?: { start: { line: number, column: number } },
|
|
||||||
_loc?: { start: { line: number, column: number } },
|
|
||||||
},
|
|
||||||
msg: string,
|
msg: string,
|
||||||
Error: typeof Error = SyntaxError,
|
Error: typeof Error = SyntaxError,
|
||||||
): Error {
|
): Error {
|
||||||
let loc = node && (node.loc || node._loc);
|
let loc = node && (node.loc || node._loc);
|
||||||
|
|
||||||
msg = `${this.opts.filename}: ${msg}`;
|
|
||||||
|
|
||||||
if (!loc && node) {
|
if (!loc && node) {
|
||||||
const state = {
|
const state = {
|
||||||
loc: null,
|
loc: null,
|
||||||
@ -284,6 +293,13 @@ export default class File {
|
|||||||
line: loc.start.line,
|
line: loc.start.line,
|
||||||
column: loc.start.column + 1,
|
column: loc.start.column + 1,
|
||||||
},
|
},
|
||||||
|
end:
|
||||||
|
loc.end && loc.start.line === loc.end.line
|
||||||
|
? {
|
||||||
|
line: loc.end.line,
|
||||||
|
column: loc.end.column + 1,
|
||||||
|
}
|
||||||
|
: undefined,
|
||||||
},
|
},
|
||||||
{ highlightCode },
|
{ highlightCode },
|
||||||
);
|
);
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import type { PluginPasses } from "../../config";
|
import type { PluginPasses } from "../../config";
|
||||||
import convertSourceMap, { type SourceMap } from "convert-source-map";
|
import convertSourceMap, { typeof SourceMap } from "convert-source-map";
|
||||||
import generate from "@babel/generator";
|
import generate from "@babel/generator";
|
||||||
|
|
||||||
import type File from "./file";
|
import type File from "./file";
|
||||||
@ -41,7 +41,7 @@ export default function generateCode(
|
|||||||
|
|
||||||
if (typeof result.then === "function") {
|
if (typeof result.then === "function") {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`You appear to be using an async parser plugin, ` +
|
`You appear to be using an async codegen plugin, ` +
|
||||||
`which your current version of Babel does not support. ` +
|
`which your current version of Babel does not support. ` +
|
||||||
`If you're using a published plugin, ` +
|
`If you're using a published plugin, ` +
|
||||||
`you may need to upgrade your @babel/core version.`,
|
`you may need to upgrade your @babel/core version.`,
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import type { SourceMap } from "convert-source-map";
|
import typeof { SourceMap } from "convert-source-map";
|
||||||
import sourceMap from "source-map";
|
import sourceMap from "source-map";
|
||||||
|
|
||||||
export default function mergeSourceMap(
|
export default function mergeSourceMap(
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
// @flow
|
// @flow
|
||||||
import traverse from "@babel/traverse";
|
import traverse from "@babel/traverse";
|
||||||
import type { SourceMap } from "convert-source-map";
|
import typeof { SourceMap } from "convert-source-map";
|
||||||
|
|
||||||
import type { ResolvedConfig, PluginPasses } from "../config";
|
import type { ResolvedConfig, PluginPasses } from "../config";
|
||||||
|
|
||||||
@ -55,11 +55,29 @@ export function runSync(
|
|||||||
ast,
|
ast,
|
||||||
);
|
);
|
||||||
|
|
||||||
transformFile(file, config.passes);
|
|
||||||
|
|
||||||
const opts = file.opts;
|
const opts = file.opts;
|
||||||
const { outputCode, outputMap } =
|
try {
|
||||||
opts.code !== false ? generateCode(config.passes, file) : {};
|
transformFile(file, config.passes);
|
||||||
|
} catch (e) {
|
||||||
|
e.message = `${opts.filename ?? "unknown"}: ${e.message}`;
|
||||||
|
if (!e.code) {
|
||||||
|
e.code = "BABEL_TRANSFORM_ERROR";
|
||||||
|
}
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
let outputCode, outputMap;
|
||||||
|
try {
|
||||||
|
if (opts.code !== false) {
|
||||||
|
({ outputCode, outputMap } = generateCode(config.passes, file));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
e.message = `${opts.filename ?? "unknown"}: ${e.message}`;
|
||||||
|
if (!e.code) {
|
||||||
|
e.code = "BABEL_GENERATE_ERROR";
|
||||||
|
}
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
metadata: file.metadata,
|
metadata: file.metadata,
|
||||||
@ -93,7 +111,7 @@ function transformFile(file: File, pluginPasses: PluginPasses): void {
|
|||||||
if (isThenable(result)) {
|
if (isThenable(result)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`You appear to be using an plugin with an async .pre, ` +
|
`You appear to be using an plugin with an async .pre, ` +
|
||||||
`which your current version of Babel does not support.` +
|
`which your current version of Babel does not support. ` +
|
||||||
`If you're using a published plugin, you may need to upgrade ` +
|
`If you're using a published plugin, you may need to upgrade ` +
|
||||||
`your @babel/core version.`,
|
`your @babel/core version.`,
|
||||||
);
|
);
|
||||||
@ -117,7 +135,7 @@ function transformFile(file: File, pluginPasses: PluginPasses): void {
|
|||||||
if (isThenable(result)) {
|
if (isThenable(result)) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`You appear to be using an plugin with an async .post, ` +
|
`You appear to be using an plugin with an async .post, ` +
|
||||||
`which your current version of Babel does not support.` +
|
`which your current version of Babel does not support. ` +
|
||||||
`If you're using a published plugin, you may need to upgrade ` +
|
`If you're using a published plugin, you may need to upgrade ` +
|
||||||
`your @babel/core version.`,
|
`your @babel/core version.`,
|
||||||
);
|
);
|
||||||
@ -131,6 +149,7 @@ function isThenable(val: mixed): boolean {
|
|||||||
return (
|
return (
|
||||||
!!val &&
|
!!val &&
|
||||||
(typeof val === "object" || typeof val === "function") &&
|
(typeof val === "object" || typeof val === "function") &&
|
||||||
|
!!val.then &&
|
||||||
typeof val.then === "function"
|
typeof val.then === "function"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -27,49 +27,6 @@ export default function normalizeFile(
|
|||||||
): File {
|
): File {
|
||||||
code = `${code || ""}`;
|
code = `${code || ""}`;
|
||||||
|
|
||||||
let inputMap = null;
|
|
||||||
if (options.inputSourceMap !== false) {
|
|
||||||
// If an explicit object is passed in, it overrides the processing of
|
|
||||||
// source maps that may be in the file itself.
|
|
||||||
if (typeof options.inputSourceMap === "object") {
|
|
||||||
inputMap = convertSourceMap.fromObject(options.inputSourceMap);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!inputMap) {
|
|
||||||
try {
|
|
||||||
inputMap = convertSourceMap.fromSource(code);
|
|
||||||
|
|
||||||
if (inputMap) {
|
|
||||||
code = convertSourceMap.removeComments(code);
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
debug("discarding unknown inline input sourcemap", err);
|
|
||||||
code = convertSourceMap.removeComments(code);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!inputMap) {
|
|
||||||
if (typeof options.filename === "string") {
|
|
||||||
try {
|
|
||||||
inputMap = convertSourceMap.fromMapFileSource(
|
|
||||||
code,
|
|
||||||
path.dirname(options.filename),
|
|
||||||
);
|
|
||||||
|
|
||||||
if (inputMap) {
|
|
||||||
code = convertSourceMap.removeMapFileComments(code);
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
debug("discarding unknown file input sourcemap", err);
|
|
||||||
code = convertSourceMap.removeMapFileComments(code);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
debug("discarding un-loadable file input sourcemap");
|
|
||||||
code = convertSourceMap.removeMapFileComments(code);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ast) {
|
if (ast) {
|
||||||
if (ast.type === "Program") {
|
if (ast.type === "Program") {
|
||||||
ast = t.file(ast, [], []);
|
ast = t.file(ast, [], []);
|
||||||
@ -84,6 +41,43 @@ export default function normalizeFile(
|
|||||||
ast = parser(pluginPasses, options, code);
|
ast = parser(pluginPasses, options, code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let inputMap = null;
|
||||||
|
if (options.inputSourceMap !== false) {
|
||||||
|
// If an explicit object is passed in, it overrides the processing of
|
||||||
|
// source maps that may be in the file itself.
|
||||||
|
if (typeof options.inputSourceMap === "object") {
|
||||||
|
inputMap = convertSourceMap.fromObject(options.inputSourceMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!inputMap) {
|
||||||
|
const lastComment = extractComments(INLINE_SOURCEMAP_REGEX, ast);
|
||||||
|
if (lastComment) {
|
||||||
|
try {
|
||||||
|
inputMap = convertSourceMap.fromComment(lastComment);
|
||||||
|
} catch (err) {
|
||||||
|
debug("discarding unknown inline input sourcemap", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!inputMap) {
|
||||||
|
const lastComment = extractComments(EXTERNAL_SOURCEMAP_REGEX, ast);
|
||||||
|
if (typeof options.filename === "string" && lastComment) {
|
||||||
|
try {
|
||||||
|
inputMap = convertSourceMap.fromMapFileComment(
|
||||||
|
// fromMapFileComment requires the whole comment block
|
||||||
|
`//${lastComment}`,
|
||||||
|
path.dirname(options.filename),
|
||||||
|
);
|
||||||
|
} catch (err) {
|
||||||
|
debug("discarding unknown file input sourcemap", err);
|
||||||
|
}
|
||||||
|
} else if (lastComment) {
|
||||||
|
debug("discarding un-loadable file input sourcemap");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return new File(options, {
|
return new File(options, {
|
||||||
code,
|
code,
|
||||||
ast,
|
ast,
|
||||||
@ -114,7 +108,7 @@ function parser(
|
|||||||
} else if (results.length === 1) {
|
} else if (results.length === 1) {
|
||||||
if (typeof results[0].then === "function") {
|
if (typeof results[0].then === "function") {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`You appear to be using an async codegen plugin, ` +
|
`You appear to be using an async parser plugin, ` +
|
||||||
`which your current version of Babel does not support. ` +
|
`which your current version of Babel does not support. ` +
|
||||||
`If you're using a published plugin, you may need to upgrade ` +
|
`If you're using a published plugin, you may need to upgrade ` +
|
||||||
`your @babel/core version.`,
|
`your @babel/core version.`,
|
||||||
@ -128,6 +122,7 @@ function parser(
|
|||||||
err.message +=
|
err.message +=
|
||||||
"\nConsider renaming the file to '.mjs', or setting sourceType:module " +
|
"\nConsider renaming the file to '.mjs', or setting sourceType:module " +
|
||||||
"or sourceType:unambiguous in your Babel config for this file.";
|
"or sourceType:unambiguous in your Babel config for this file.";
|
||||||
|
// err.code will be changed to BABEL_PARSE_ERROR later.
|
||||||
}
|
}
|
||||||
|
|
||||||
const { loc, missingPlugin } = err;
|
const { loc, missingPlugin } = err;
|
||||||
@ -156,3 +151,48 @@ function parser(
|
|||||||
throw err;
|
throw err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// These regexps are copied from the convert-source-map package,
|
||||||
|
// but without // or /* at the beginning of the comment.
|
||||||
|
|
||||||
|
// eslint-disable-next-line max-len
|
||||||
|
const INLINE_SOURCEMAP_REGEX = /^[@#]\s+sourceMappingURL=data:(?:application|text)\/json;(?:charset[:=]\S+?;)?base64,(?:.*)$/;
|
||||||
|
const EXTERNAL_SOURCEMAP_REGEX = /^[@#][ \t]+sourceMappingURL=(?:[^\s'"`]+?)[ \t]*$/;
|
||||||
|
|
||||||
|
function extractCommentsFromList(regex, comments, lastComment) {
|
||||||
|
if (comments) {
|
||||||
|
comments = comments.filter(({ value }) => {
|
||||||
|
if (regex.test(value)) {
|
||||||
|
lastComment = value;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return [comments, lastComment];
|
||||||
|
}
|
||||||
|
|
||||||
|
function extractComments(regex, ast) {
|
||||||
|
let lastComment = null;
|
||||||
|
t.traverseFast(ast, node => {
|
||||||
|
// $FlowIgnore destructuring with expressions is not supported
|
||||||
|
[node.leadingComments, lastComment] = extractCommentsFromList(
|
||||||
|
regex,
|
||||||
|
node.leadingComments,
|
||||||
|
lastComment,
|
||||||
|
);
|
||||||
|
// $FlowIgnore destructuring with expressions is not supported
|
||||||
|
[node.innerComments, lastComment] = extractCommentsFromList(
|
||||||
|
regex,
|
||||||
|
node.innerComments,
|
||||||
|
lastComment,
|
||||||
|
);
|
||||||
|
// $FlowIgnore destructuring with expressions is not supported
|
||||||
|
[node.trailingComments, lastComment] = extractCommentsFromList(
|
||||||
|
regex,
|
||||||
|
node.trailingComments,
|
||||||
|
lastComment,
|
||||||
|
);
|
||||||
|
});
|
||||||
|
return lastComment;
|
||||||
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import type File from "./file/file";
|
import type File from "./file/file";
|
||||||
|
import type NodeLocation from "./file/file";
|
||||||
|
|
||||||
export default class PluginPass {
|
export default class PluginPass {
|
||||||
_map: Map<mixed, mixed> = new Map();
|
_map: Map<mixed, mixed> = new Map();
|
||||||
@ -47,14 +48,7 @@ export default class PluginPass {
|
|||||||
return this.file.getModuleName();
|
return this.file.getModuleName();
|
||||||
}
|
}
|
||||||
|
|
||||||
buildCodeFrameError(
|
buildCodeFrameError(node: ?NodeLocation, msg: string, Error?: typeof Error) {
|
||||||
node: ?{
|
|
||||||
loc?: { start: { line: number, column: number } },
|
|
||||||
_loc?: { start: { line: number, column: number } },
|
|
||||||
},
|
|
||||||
msg: string,
|
|
||||||
Error?: typeof Error,
|
|
||||||
) {
|
|
||||||
return this.file.buildCodeFrameError(node, msg, Error);
|
return this.file.buildCodeFrameError(node, msg, Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,16 +1,6 @@
|
|||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
const pluginNameMap = {
|
const pluginNameMap = {
|
||||||
asyncGenerators: {
|
|
||||||
syntax: {
|
|
||||||
name: "@babel/plugin-syntax-async-generators",
|
|
||||||
url: "https://git.io/vb4SY",
|
|
||||||
},
|
|
||||||
transform: {
|
|
||||||
name: "@babel/plugin-proposal-async-generator-functions",
|
|
||||||
url: "https://git.io/vb4yp",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
classProperties: {
|
classProperties: {
|
||||||
syntax: {
|
syntax: {
|
||||||
name: "@babel/plugin-syntax-class-properties",
|
name: "@babel/plugin-syntax-class-properties",
|
||||||
@ -143,26 +133,6 @@ const pluginNameMap = {
|
|||||||
url: "https://git.io/vb4yS",
|
url: "https://git.io/vb4yS",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
objectRestSpread: {
|
|
||||||
syntax: {
|
|
||||||
name: "@babel/plugin-syntax-object-rest-spread",
|
|
||||||
url: "https://git.io/vb4y5",
|
|
||||||
},
|
|
||||||
transform: {
|
|
||||||
name: "@babel/plugin-proposal-object-rest-spread",
|
|
||||||
url: "https://git.io/vb4Ss",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
optionalCatchBinding: {
|
|
||||||
syntax: {
|
|
||||||
name: "@babel/plugin-syntax-optional-catch-binding",
|
|
||||||
url: "https://git.io/vb4Sn",
|
|
||||||
},
|
|
||||||
transform: {
|
|
||||||
name: "@babel/plugin-proposal-optional-catch-binding",
|
|
||||||
url: "https://git.io/vb4SI",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
optionalChaining: {
|
optionalChaining: {
|
||||||
syntax: {
|
syntax: {
|
||||||
name: "@babel/plugin-syntax-optional-chaining",
|
name: "@babel/plugin-syntax-optional-chaining",
|
||||||
@ -203,6 +173,41 @@ const pluginNameMap = {
|
|||||||
url: "https://git.io/vb4Sm",
|
url: "https://git.io/vb4Sm",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// TODO: This plugins are now supported by default by @babel/parser: they can
|
||||||
|
// be removed from this list. Although removing them isn't a breaking change,
|
||||||
|
// it's better to keep a nice error message for users using older versions of
|
||||||
|
// the parser. They can be removed in Babel 8.
|
||||||
|
asyncGenerators: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-async-generators",
|
||||||
|
url: "https://git.io/vb4SY",
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/plugin-proposal-async-generator-functions",
|
||||||
|
url: "https://git.io/vb4yp",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
objectRestSpread: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-object-rest-spread",
|
||||||
|
url: "https://git.io/vb4y5",
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/plugin-proposal-object-rest-spread",
|
||||||
|
url: "https://git.io/vb4Ss",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
optionalCatchBinding: {
|
||||||
|
syntax: {
|
||||||
|
name: "@babel/plugin-syntax-optional-catch-binding",
|
||||||
|
url: "https://git.io/vb4Sn",
|
||||||
|
},
|
||||||
|
transform: {
|
||||||
|
name: "@babel/plugin-proposal-optional-catch-binding",
|
||||||
|
url: "https://git.io/vb4SI",
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const getNameURLCombination = ({ name, url }) => `${name} (${url})`;
|
const getNameURLCombination = ({ name, url }) => `${name} (${url})`;
|
||||||
|
|||||||
@ -154,6 +154,14 @@ describe("api", function() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("exposes types", function() {
|
||||||
|
expect(babel.types).toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("exposes the parser's token types", function() {
|
||||||
|
expect(babel.tokTypes).toBeDefined();
|
||||||
|
});
|
||||||
|
|
||||||
it("transformFile", function(done) {
|
it("transformFile", function(done) {
|
||||||
const options = {
|
const options = {
|
||||||
babelrc: false,
|
babelrc: false,
|
||||||
@ -769,10 +777,10 @@ describe("api", function() {
|
|||||||
options,
|
options,
|
||||||
function(err) {
|
function(err) {
|
||||||
expect(err.message).toMatch(
|
expect(err.message).toMatch(
|
||||||
"Support for the experimental syntax 'asyncGenerators' isn't currently enabled (1:15):",
|
"Support for the experimental syntax 'logicalAssignment' isn't currently enabled (1:3):",
|
||||||
);
|
);
|
||||||
expect(err.message).toMatch(
|
expect(err.message).toMatch(
|
||||||
"Add @babel/plugin-proposal-async-generator-functions (https://git.io/vb4yp) to the " +
|
"Add @babel/plugin-proposal-logical-assignment-operators (https://git.io/vAlRe) to the " +
|
||||||
"'plugins' section of your Babel config to enable transformation.",
|
"'plugins' section of your Babel config to enable transformation.",
|
||||||
);
|
);
|
||||||
done();
|
done();
|
||||||
@ -780,4 +788,28 @@ describe("api", function() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("missing helpers", function() {
|
||||||
|
it("should always throw", function() {
|
||||||
|
expect(() =>
|
||||||
|
babel.transformSync(``, {
|
||||||
|
configFile: false,
|
||||||
|
plugins: [
|
||||||
|
function() {
|
||||||
|
return {
|
||||||
|
visitor: {
|
||||||
|
Program(path) {
|
||||||
|
try {
|
||||||
|
path.pushContainer("body", this.addHelper("fooBar"));
|
||||||
|
} catch {}
|
||||||
|
path.pushContainer("body", this.addHelper("fooBar"));
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
).toThrow();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,7 +1,44 @@
|
|||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
|
import os from "os";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
import escapeRegExp from "lodash/escapeRegExp";
|
||||||
import { loadOptions as loadOptionsOrig } from "../lib";
|
import { loadOptions as loadOptionsOrig } from "../lib";
|
||||||
|
|
||||||
|
// TODO: In Babel 8, we can directly uses fs.promises which is supported by
|
||||||
|
// node 8+
|
||||||
|
const pfs =
|
||||||
|
fs.promises ??
|
||||||
|
new Proxy(fs, {
|
||||||
|
get(target, name) {
|
||||||
|
if (name === "copyFile") {
|
||||||
|
// fs.copyFile is only supported since node 8.5
|
||||||
|
// https://stackoverflow.com/a/30405105/2359289
|
||||||
|
return function copyFile(source, target) {
|
||||||
|
const rd = fs.createReadStream(source);
|
||||||
|
const wr = fs.createWriteStream(target);
|
||||||
|
return new Promise(function(resolve, reject) {
|
||||||
|
rd.on("error", reject);
|
||||||
|
wr.on("error", reject);
|
||||||
|
wr.on("finish", resolve);
|
||||||
|
rd.pipe(wr);
|
||||||
|
}).catch(function(error) {
|
||||||
|
rd.destroy();
|
||||||
|
wr.end();
|
||||||
|
throw error;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return (...args) =>
|
||||||
|
new Promise((resolve, reject) =>
|
||||||
|
target[name](...args, (error, result) => {
|
||||||
|
if (error) reject(error);
|
||||||
|
else resolve(result);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
function fixture(...args) {
|
function fixture(...args) {
|
||||||
return path.join(__dirname, "fixtures", "config", ...args);
|
return path.join(__dirname, "fixtures", "config", ...args);
|
||||||
}
|
}
|
||||||
@ -13,6 +50,24 @@ function loadOptions(opts) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function pairs(items) {
|
||||||
|
const pairs = [];
|
||||||
|
for (let i = 0; i < items.length - 1; i++) {
|
||||||
|
for (let j = i + 1; j < items.length; j++) {
|
||||||
|
pairs.push([items[i], items[j]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pairs;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function getTemp(name) {
|
||||||
|
const cwd = await pfs.mkdtemp(os.tmpdir() + path.sep + name);
|
||||||
|
const tmp = name => path.join(cwd, name);
|
||||||
|
const config = name =>
|
||||||
|
pfs.copyFile(fixture("config-files-templates", name), tmp(name));
|
||||||
|
return { cwd, tmp, config };
|
||||||
|
}
|
||||||
|
|
||||||
describe("buildConfigChain", function() {
|
describe("buildConfigChain", function() {
|
||||||
describe("test", () => {
|
describe("test", () => {
|
||||||
describe("single", () => {
|
describe("single", () => {
|
||||||
@ -33,7 +88,7 @@ describe("buildConfigChain", function() {
|
|||||||
cwd: fixture("nonexistant-fake"),
|
cwd: fixture("nonexistant-fake"),
|
||||||
filename: fixture("nonexistant-fake", "src.js"),
|
filename: fixture("nonexistant-fake", "src.js"),
|
||||||
babelrc: false,
|
babelrc: false,
|
||||||
test: new RegExp(fixture("nonexistant-fake")),
|
test: new RegExp(escapeRegExp(fixture("nonexistant-fake"))),
|
||||||
comments: true,
|
comments: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -69,7 +124,7 @@ describe("buildConfigChain", function() {
|
|||||||
cwd: fixture("nonexistant-fake"),
|
cwd: fixture("nonexistant-fake"),
|
||||||
filename: fixture("nonexistant-fake", "src.js"),
|
filename: fixture("nonexistant-fake", "src.js"),
|
||||||
babelrc: false,
|
babelrc: false,
|
||||||
test: new RegExp(fixture("nonexistant-unknown")),
|
test: new RegExp(escapeRegExp(fixture("nonexistant-unknown"))),
|
||||||
comments: true,
|
comments: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -107,7 +162,7 @@ describe("buildConfigChain", function() {
|
|||||||
cwd: fixture("nonexistant-fake"),
|
cwd: fixture("nonexistant-fake"),
|
||||||
filename: fixture("nonexistant-fake", "src.js"),
|
filename: fixture("nonexistant-fake", "src.js"),
|
||||||
babelrc: false,
|
babelrc: false,
|
||||||
test: [new RegExp(fixture("nonexistant-fake"))],
|
test: [new RegExp(escapeRegExp(fixture("nonexistant-fake")))],
|
||||||
comments: true,
|
comments: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -143,7 +198,7 @@ describe("buildConfigChain", function() {
|
|||||||
cwd: fixture("nonexistant-fake"),
|
cwd: fixture("nonexistant-fake"),
|
||||||
filename: fixture("nonexistant-fake", "src.js"),
|
filename: fixture("nonexistant-fake", "src.js"),
|
||||||
babelrc: false,
|
babelrc: false,
|
||||||
test: [new RegExp(fixture("nonexistant-unknown"))],
|
test: [new RegExp(escapeRegExp(fixture("nonexistant-unknown")))],
|
||||||
comments: true,
|
comments: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -183,7 +238,7 @@ describe("buildConfigChain", function() {
|
|||||||
cwd: fixture("nonexistant-fake"),
|
cwd: fixture("nonexistant-fake"),
|
||||||
filename: fixture("nonexistant-fake", "src.js"),
|
filename: fixture("nonexistant-fake", "src.js"),
|
||||||
babelrc: false,
|
babelrc: false,
|
||||||
include: new RegExp(fixture("nonexistant-fake")),
|
include: new RegExp(escapeRegExp(fixture("nonexistant-fake"))),
|
||||||
comments: true,
|
comments: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -219,7 +274,7 @@ describe("buildConfigChain", function() {
|
|||||||
cwd: fixture("nonexistant-fake"),
|
cwd: fixture("nonexistant-fake"),
|
||||||
filename: fixture("nonexistant-fake", "src.js"),
|
filename: fixture("nonexistant-fake", "src.js"),
|
||||||
babelrc: false,
|
babelrc: false,
|
||||||
include: new RegExp(fixture("nonexistant-unknown")),
|
include: new RegExp(escapeRegExp(fixture("nonexistant-unknown"))),
|
||||||
comments: true,
|
comments: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -257,7 +312,7 @@ describe("buildConfigChain", function() {
|
|||||||
cwd: fixture("nonexistant-fake"),
|
cwd: fixture("nonexistant-fake"),
|
||||||
filename: fixture("nonexistant-fake", "src.js"),
|
filename: fixture("nonexistant-fake", "src.js"),
|
||||||
babelrc: false,
|
babelrc: false,
|
||||||
include: [new RegExp(fixture("nonexistant-fake"))],
|
include: [new RegExp(escapeRegExp(fixture("nonexistant-fake")))],
|
||||||
comments: true,
|
comments: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -293,7 +348,7 @@ describe("buildConfigChain", function() {
|
|||||||
cwd: fixture("nonexistant-fake"),
|
cwd: fixture("nonexistant-fake"),
|
||||||
filename: fixture("nonexistant-fake", "src.js"),
|
filename: fixture("nonexistant-fake", "src.js"),
|
||||||
babelrc: false,
|
babelrc: false,
|
||||||
include: [new RegExp(fixture("nonexistant-unknown"))],
|
include: [new RegExp(escapeRegExp(fixture("nonexistant-unknown")))],
|
||||||
comments: true,
|
comments: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -333,7 +388,7 @@ describe("buildConfigChain", function() {
|
|||||||
cwd: fixture("nonexistant-fake"),
|
cwd: fixture("nonexistant-fake"),
|
||||||
filename: fixture("nonexistant-fake", "src.js"),
|
filename: fixture("nonexistant-fake", "src.js"),
|
||||||
babelrc: false,
|
babelrc: false,
|
||||||
exclude: new RegExp(fixture("nonexistant-fake")),
|
exclude: new RegExp(escapeRegExp(fixture("nonexistant-fake"))),
|
||||||
comments: true,
|
comments: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -369,7 +424,7 @@ describe("buildConfigChain", function() {
|
|||||||
cwd: fixture("nonexistant-fake"),
|
cwd: fixture("nonexistant-fake"),
|
||||||
filename: fixture("nonexistant-fake", "src.js"),
|
filename: fixture("nonexistant-fake", "src.js"),
|
||||||
babelrc: false,
|
babelrc: false,
|
||||||
exclude: new RegExp(fixture("nonexistant-unknown")),
|
exclude: new RegExp(escapeRegExp(fixture("nonexistant-unknown"))),
|
||||||
comments: true,
|
comments: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -407,7 +462,7 @@ describe("buildConfigChain", function() {
|
|||||||
cwd: fixture("nonexistant-fake"),
|
cwd: fixture("nonexistant-fake"),
|
||||||
filename: fixture("nonexistant-fake", "src.js"),
|
filename: fixture("nonexistant-fake", "src.js"),
|
||||||
babelrc: false,
|
babelrc: false,
|
||||||
exclude: [new RegExp(fixture("nonexistant-fake"))],
|
exclude: [new RegExp(escapeRegExp(fixture("nonexistant-fake")))],
|
||||||
comments: true,
|
comments: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -443,7 +498,7 @@ describe("buildConfigChain", function() {
|
|||||||
cwd: fixture("nonexistant-fake"),
|
cwd: fixture("nonexistant-fake"),
|
||||||
filename: fixture("nonexistant-fake", "src.js"),
|
filename: fixture("nonexistant-fake", "src.js"),
|
||||||
babelrc: false,
|
babelrc: false,
|
||||||
exclude: [new RegExp(fixture("nonexistant-unknown"))],
|
exclude: [new RegExp(escapeRegExp(fixture("nonexistant-unknown")))],
|
||||||
comments: true,
|
comments: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -943,75 +998,93 @@ describe("buildConfigChain", function() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should load .babelrc", () => {
|
describe("root", () => {
|
||||||
const filename = fixture("config-files", "babelrc", "src.js");
|
test.each(["babel.config.json", "babel.config.js", "babel.config.cjs"])(
|
||||||
|
"should load %s",
|
||||||
|
async name => {
|
||||||
|
const { cwd, tmp, config } = await getTemp(
|
||||||
|
`babel-test-load-config-${name}`,
|
||||||
|
);
|
||||||
|
const filename = tmp("src.js");
|
||||||
|
|
||||||
|
await config(name);
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
loadOptions({
|
loadOptions({
|
||||||
filename,
|
filename,
|
||||||
cwd: path.dirname(filename),
|
cwd,
|
||||||
}),
|
}),
|
||||||
).toEqual({
|
).toEqual({
|
||||||
...getDefaults(),
|
...getDefaults(),
|
||||||
filename: filename,
|
filename,
|
||||||
cwd: path.dirname(filename),
|
cwd,
|
||||||
root: path.dirname(filename),
|
root: cwd,
|
||||||
comments: true,
|
comments: true,
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
test.each(
|
||||||
|
pairs(["babel.config.json", "babel.config.js", "babel.config.cjs"]),
|
||||||
|
)("should throw if both %s and %s are used", async (name1, name2) => {
|
||||||
|
const { cwd, tmp, config } = await getTemp(
|
||||||
|
`babel-test-dup-config-${name1}-${name2}`,
|
||||||
|
);
|
||||||
|
|
||||||
|
await Promise.all([config(name1), config(name2)]);
|
||||||
|
|
||||||
|
expect(() => loadOptions({ filename: tmp("src.js"), cwd })).toThrow(
|
||||||
|
/Multiple configuration files found/,
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should load .babelrc.js", () => {
|
describe("relative", () => {
|
||||||
const filename = fixture("config-files", "babelrc-js", "src.js");
|
test.each(["package.json", ".babelrc", ".babelrc.js", ".babelrc.cjs"])(
|
||||||
|
"should load %s",
|
||||||
|
async name => {
|
||||||
|
const { cwd, tmp, config } = await getTemp(
|
||||||
|
`babel-test-load-config-${name}`,
|
||||||
|
);
|
||||||
|
const filename = tmp("src.js");
|
||||||
|
|
||||||
expect(loadOptions({ filename, cwd: path.dirname(filename) })).toEqual({
|
await config(name);
|
||||||
|
|
||||||
|
expect(
|
||||||
|
loadOptions({
|
||||||
|
filename,
|
||||||
|
cwd,
|
||||||
|
}),
|
||||||
|
).toEqual({
|
||||||
...getDefaults(),
|
...getDefaults(),
|
||||||
filename: filename,
|
filename,
|
||||||
cwd: path.dirname(filename),
|
cwd,
|
||||||
root: path.dirname(filename),
|
root: cwd,
|
||||||
comments: true,
|
comments: true,
|
||||||
});
|
});
|
||||||
});
|
},
|
||||||
|
);
|
||||||
it("should load package.json#babel", () => {
|
|
||||||
const filename = fixture("config-files", "pkg", "src.js");
|
|
||||||
|
|
||||||
expect(loadOptions({ filename, cwd: path.dirname(filename) })).toEqual({
|
|
||||||
...getDefaults(),
|
|
||||||
filename: filename,
|
|
||||||
cwd: path.dirname(filename),
|
|
||||||
root: path.dirname(filename),
|
|
||||||
comments: true,
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should load .babelignore", () => {
|
it("should load .babelignore", () => {
|
||||||
const filename = fixture("config-files", "babelignore", "src.js");
|
const filename = fixture("config-files", "babelignore", "src.js");
|
||||||
|
|
||||||
expect(loadOptions({ filename, cwd: path.dirname(filename) })).toBeNull();
|
expect(
|
||||||
|
loadOptions({ filename, cwd: path.dirname(filename) }),
|
||||||
|
).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should throw if there are both .babelrc and .babelrc.js", () => {
|
test.each(
|
||||||
const filename = fixture("config-files", "both-babelrc", "src.js");
|
pairs(["package.json", ".babelrc", ".babelrc.js", ".babelrc.cjs"]),
|
||||||
|
)("should throw if both %s and %s are used", async (name1, name2) => {
|
||||||
|
const { cwd, tmp, config } = await getTemp(
|
||||||
|
`babel-test-dup-config-${name1}-${name2}`,
|
||||||
|
);
|
||||||
|
|
||||||
expect(() =>
|
await Promise.all([config(name1), config(name2)]);
|
||||||
loadOptions({ filename, cwd: path.dirname(filename) }),
|
|
||||||
).toThrow(/Multiple configuration files found/);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should throw if there are both .babelrc and package.json", () => {
|
expect(() => loadOptions({ filename: tmp("src.js"), cwd })).toThrow(
|
||||||
const filename = fixture("config-files", "pkg-babelrc", "src.js");
|
/Multiple configuration files found/,
|
||||||
|
);
|
||||||
expect(() =>
|
|
||||||
loadOptions({ filename, cwd: path.dirname(filename) }),
|
|
||||||
).toThrow(/Multiple configuration files found/);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("should throw if there are both .babelrc.js and package.json", () => {
|
|
||||||
const filename = fixture("config-files", "pkg-babelrc-js", "src.js");
|
|
||||||
|
|
||||||
expect(() =>
|
|
||||||
loadOptions({ filename, cwd: path.dirname(filename) }),
|
|
||||||
).toThrow(/Multiple configuration files found/);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should ignore package.json without a 'babel' property", () => {
|
it("should ignore package.json without a 'babel' property", () => {
|
||||||
@ -1026,28 +1099,41 @@ describe("buildConfigChain", function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should show helpful errors for .babelrc", () => {
|
test.each`
|
||||||
const filename = fixture("config-files", "babelrc-error", "src.js");
|
config | dir | error
|
||||||
|
${".babelrc"} | ${"babelrc-error"} | ${/Error while parsing config - /}
|
||||||
|
${".babelrc.js"} | ${"babelrc-js-error"} | ${/Babelrc threw an error/}
|
||||||
|
${".babelrc.cjs"} | ${"babelrc-cjs-error"} | ${/Babelrc threw an error/}
|
||||||
|
${"package.json"} | ${"pkg-error"} | ${/Error while parsing JSON - /}
|
||||||
|
`("should show helpful errors for $config", ({ dir, error }) => {
|
||||||
|
const filename = fixture("config-files", dir, "src.js");
|
||||||
|
|
||||||
expect(() =>
|
expect(() =>
|
||||||
loadOptions({ filename, cwd: path.dirname(filename) }),
|
loadOptions({ filename, cwd: path.dirname(filename) }),
|
||||||
).toThrow(/Error while parsing config - /);
|
).toThrow(error);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should show helpful errors for .babelrc.js", () => {
|
it("should throw when `test` presents but `filename` is not passed", () => {
|
||||||
const filename = fixture("config-files", "babelrc-js-error", "src.js");
|
expect(() => loadOptions({ test: /\.ts$/, plugins: [] })).toThrow(
|
||||||
|
/Configuration contains string\/RegExp pattern/,
|
||||||
expect(() =>
|
);
|
||||||
loadOptions({ filename, cwd: path.dirname(filename) }),
|
|
||||||
).toThrow(/Babelrc threw an error/);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should show helpful errors for package.json", () => {
|
it("should throw when `preset` requires `filename` but it was not passed", () => {
|
||||||
const filename = fixture("config-files", "pkg-error", "src.js");
|
expect(() => {
|
||||||
|
loadOptions({
|
||||||
|
presets: [require("./fixtures/config-loading/preset4")],
|
||||||
|
});
|
||||||
|
}).toThrow(/Preset \/\* your preset \*\/ requires a filename/);
|
||||||
|
});
|
||||||
|
|
||||||
expect(() =>
|
it("should throw when `preset.overrides` requires `filename` but it was not passed", () => {
|
||||||
loadOptions({ filename, cwd: path.dirname(filename) }),
|
expect(() => {
|
||||||
).toThrow(/Error while parsing JSON - /);
|
loadOptions({
|
||||||
|
presets: [require("./fixtures/config-loading/preset5")],
|
||||||
|
});
|
||||||
|
}).toThrow(/Preset \/\* your preset \*\/ requires a filename/);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@ -322,6 +322,21 @@ describe("@babel/core config loading", () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("should thrown when plugin is not valid", () => {
|
||||||
|
const fooPlugin = {
|
||||||
|
inherits: "inhertis-should-not-be-string",
|
||||||
|
};
|
||||||
|
const opts = {
|
||||||
|
cwd: path.dirname(FILEPATH),
|
||||||
|
filename: FILEPATH,
|
||||||
|
plugins: [fooPlugin],
|
||||||
|
};
|
||||||
|
|
||||||
|
expect(() => loadConfig(opts)).toThrow(
|
||||||
|
/\.inherits must be a function, or undefined/,
|
||||||
|
);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("caller metadata", () => {
|
describe("caller metadata", () => {
|
||||||
|
|||||||
@ -1,4 +1 @@
|
|||||||
async function* agf() {
|
a ||= 2;
|
||||||
await 1;
|
|
||||||
yield 2;
|
|
||||||
}
|
|
||||||
|
|||||||
6
packages/babel-core/test/fixtures/config-loading/preset4.js
vendored
Normal file
6
packages/babel-core/test/fixtures/config-loading/preset4.js
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
module.exports = function() {
|
||||||
|
return {
|
||||||
|
test: /\.ts$/,
|
||||||
|
plugins: []
|
||||||
|
}
|
||||||
|
};
|
||||||
8
packages/babel-core/test/fixtures/config-loading/preset5.js
vendored
Normal file
8
packages/babel-core/test/fixtures/config-loading/preset5.js
vendored
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
module.exports = function() {
|
||||||
|
return {
|
||||||
|
overrides: [{
|
||||||
|
test: /\.ts$/,
|
||||||
|
plugins: []
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
};
|
||||||
3
packages/babel-core/test/fixtures/config/config-files-templates/.babelrc
vendored
Normal file
3
packages/babel-core/test/fixtures/config/config-files-templates/.babelrc
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"comments": true
|
||||||
|
}
|
||||||
3
packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.cjs
vendored
Normal file
3
packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.cjs
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module.exports = {
|
||||||
|
comments: true
|
||||||
|
};
|
||||||
3
packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.js
vendored
Normal file
3
packages/babel-core/test/fixtures/config/config-files-templates/.babelrc.js
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module.exports = {
|
||||||
|
comments: true
|
||||||
|
};
|
||||||
3
packages/babel-core/test/fixtures/config/config-files-templates/babel.config.cjs
vendored
Normal file
3
packages/babel-core/test/fixtures/config/config-files-templates/babel.config.cjs
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module.exports = {
|
||||||
|
comments: true
|
||||||
|
};
|
||||||
3
packages/babel-core/test/fixtures/config/config-files-templates/babel.config.js
vendored
Normal file
3
packages/babel-core/test/fixtures/config/config-files-templates/babel.config.js
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module.exports = {
|
||||||
|
comments: true
|
||||||
|
};
|
||||||
3
packages/babel-core/test/fixtures/config/config-files-templates/babel.config.json
vendored
Normal file
3
packages/babel-core/test/fixtures/config/config-files-templates/babel.config.json
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"comments": true
|
||||||
|
}
|
||||||
3
packages/babel-core/test/fixtures/config/config-files/babelrc-cjs-error/.babelrc.cjs
vendored
Normal file
3
packages/babel-core/test/fixtures/config/config-files/babelrc-cjs-error/.babelrc.cjs
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
module.exports = function() {
|
||||||
|
throw new Error("Babelrc threw an error");
|
||||||
|
};
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user