Compare commits
415 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
@@ -34,7 +34,7 @@ jobs:
|
||||
build:
|
||||
working_directory: ~/babel
|
||||
docker:
|
||||
- image: circleci/node:11
|
||||
- image: circleci/node:12
|
||||
steps:
|
||||
- checkout
|
||||
- restore-cache: *restore-yarn-cache
|
||||
@@ -42,7 +42,7 @@ jobs:
|
||||
- run: yarn --version
|
||||
- run: make test-ci-coverage
|
||||
# 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
|
||||
# data for a JS file that's several megabytes large is bound to fail. Here,
|
||||
# we just run the babel-standalone test separately.
|
||||
|
||||
@@ -6,9 +6,12 @@ charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
end_of_line = lf
|
||||
|
||||
[*.{js,json}]
|
||||
[*.{js,json,ts,tsx}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[Makefile]
|
||||
indent_style = tab
|
||||
|
||||
[*.{md,markdown}]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
@@ -5,8 +5,8 @@ package.json
|
||||
lerna.json
|
||||
packages/babel-runtime
|
||||
!packages/babel-plugin-transform-runtime/scripts
|
||||
!packages/babel-runtime-corejs2/core-js.js
|
||||
packages/babel-runtime-corejs2
|
||||
packages/babel-runtime-corejs3
|
||||
packages/*/node_modules
|
||||
packages/*/lib
|
||||
packages/*/dist
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"root": true,
|
||||
"plugins": ["prettier", "@babel/development", "import"],
|
||||
"extends": "babel",
|
||||
"plugins": ["prettier", "@babel/development"],
|
||||
"rules": {
|
||||
"prettier/prettier": "error"
|
||||
},
|
||||
@@ -13,7 +13,9 @@
|
||||
"files": ["packages/*/src/**/*.js", "codemods/*/src/**/*.js"],
|
||||
"rules": {
|
||||
"@babel/development/no-undefined-identifier": "error",
|
||||
"@babel/development/no-deprecated-clone": "error"
|
||||
"@babel/development/no-deprecated-clone": "error",
|
||||
"import/no-extraneous-dependencies": "error",
|
||||
"guard-for-in": "error"
|
||||
}
|
||||
},
|
||||
{
|
||||
@@ -31,7 +33,8 @@
|
||||
"files": ["packages/babel-plugin-*/src/index.js"],
|
||||
"excludedFiles": ["packages/babel-plugin-transform-regenerator/**/*.js"],
|
||||
"rules": {
|
||||
"@babel/development/plugin-name": "error"
|
||||
"@babel/development/plugin-name": "error",
|
||||
"eqeqeq": ["error", "always", { "null": "ignore" }]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
22
.github/CHANGELOG-6to5.md
vendored
22
.github/CHANGELOG-6to5.md
vendored
@@ -84,7 +84,7 @@
|
||||
* More performance improvements.
|
||||
* Parsing is now ~30% faster thanks to [marijnh/acorn@7264bc0178e7e6af7cfe02e9e0c6b26ee0e6007f](https://github.com/marijnh/acorn/commit/7264bc0178e7e6af7cfe02e9e0c6b26ee0e6007f).
|
||||
* **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.
|
||||
* 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.
|
||||
* **Bug Fix**
|
||||
* 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.
|
||||
* **Polish**
|
||||
* Force the `es6.destructuring` transformer to be whitelisted when the `es7.objectSpread` transformer is.
|
||||
@@ -474,12 +474,12 @@
|
||||
* **Polish**
|
||||
* Rest parameters now allocate the array before populating.
|
||||
* **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).
|
||||
|
||||
## 2.12.3
|
||||
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Optional `typeof` transformer checks for `undefined` before passing it to the helper.
|
||||
* Class methods are now named.
|
||||
|
||||
@@ -551,7 +551,7 @@
|
||||
* 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 `--react-compat` to `bin/6to5`.
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Disallow setters without a single parameter.
|
||||
* Add `configurable` and `writable` to defined properties.
|
||||
* Use define instead of assignment for class methods.
|
||||
@@ -619,7 +619,7 @@
|
||||
|
||||
## 2.7.0
|
||||
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Disallow reassignments of imports.
|
||||
* **New Feature**
|
||||
* `reactCompat` option to enable pre-v0.12 react components.
|
||||
@@ -643,7 +643,7 @@
|
||||
|
||||
* **Bug Fix**
|
||||
* Better handling of number literal property keys.
|
||||
* Handle `NewExpression` paren insertion edegcases better.
|
||||
* Handle `NewExpression` paren insertion edge cases better.
|
||||
* **Internal**
|
||||
* Fix incorrect AST node `identifier("this")`.
|
||||
* Better `toIdentifier` method that handles reserved words.
|
||||
@@ -662,7 +662,7 @@
|
||||
* **Polish**
|
||||
* Move `"use strict";` to inside module bodies instead of at the top of the file.
|
||||
* Better handling of dynamic imports.
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Class inheritance now has a `function` or `null` type check.
|
||||
* Add `interopRequireWildcard` around wildcard imports and exports to handle non-object exports.
|
||||
|
||||
@@ -850,7 +850,7 @@
|
||||
|
||||
## 1.14.10
|
||||
|
||||
* Fix let scoping unneccesary override.
|
||||
* Fix let scoping unnecessary override.
|
||||
|
||||
## 1.14.6
|
||||
|
||||
@@ -973,7 +973,7 @@
|
||||
|
||||
## 1.12.21
|
||||
|
||||
* Fix unneccesary let scoping replacement.
|
||||
* Fix unnecessary let scoping replacement.
|
||||
* Add `commonInterop` module formatter. Thanks [@Naddiseo](https://github.com/Naddiseo).
|
||||
* Fix `return` outside of function body bug. Thanks [@brentburg](https://github.com/brentburg).
|
||||
* Add more flexible option types.
|
||||
@@ -1020,7 +1020,7 @@
|
||||
|
||||
## 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
|
||||
|
||||
|
||||
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.
|
||||
* Replicate module environment for `babel-node` eval.
|
||||
* Clean up classes output.
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Make it illegal to use a rest parameter on a setter.
|
||||
|
||||
## 4.6.6
|
||||
@@ -127,7 +127,7 @@
|
||||
## 4.6.4
|
||||
|
||||
* **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.
|
||||
* **New Feature**
|
||||
* New `utility.inlineEnvironmentVariables` and `utility.inlineExpression` transformers.
|
||||
@@ -150,10 +150,10 @@
|
||||
|
||||
* **New Feature**
|
||||
* Desugar sticky regexes to a new constructor expression so it can be handled by a polyfill.
|
||||
* **Spec Compliancy**
|
||||
* `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.
|
||||
* **Spec Compliance**
|
||||
* `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**
|
||||
* 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.
|
||||
* **Internal**
|
||||
* Upgrade `browserify`.
|
||||
|
||||
21
.github/CHANGELOG-v5.md
vendored
21
.github/CHANGELOG-v5.md
vendored
@@ -12,7 +12,7 @@
|
||||
|
||||
## 5.8.24
|
||||
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Updated `optimisation.react.inlineElements` transformer to React 0.14 output. Thanks [@spicyj](https://github.com/spicyj)!
|
||||
* **Polish**
|
||||
* 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.
|
||||
* **Polish**
|
||||
* Remove unnecessary string binary expressions when transforming template literals.
|
||||
* Support module live bindings in arbitary positions not in Program statement position.
|
||||
* Throw error when attemping to replace a `Program` root node with another node not of type `Program`.
|
||||
* Support module live bindings in arbitrary positions not in Program statement position.
|
||||
* 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.
|
||||
* Generate original number representation when value was not changed.
|
||||
* 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.
|
||||
* **Bug Fix**
|
||||
* 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 incorrect extensions reference causing weird issues when using the Babel CLI.
|
||||
* Fix destructuring param reference replacements not inheriting from their original param.
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Fix order that method decorators are ran in.
|
||||
|
||||
## 5.2.15
|
||||
@@ -543,12 +543,12 @@ Issues with publish process.
|
||||
* **Internal**
|
||||
* Removed native inheritance support from classes.
|
||||
* 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
|
||||
|
||||
* **Internal**
|
||||
* Fix transformer aliases being accidently set as deprecated ones.
|
||||
* Fix transformer aliases being accidentally set as deprecated ones.
|
||||
* Expose `Pipeline` as `TransformerPipeline` instead.
|
||||
|
||||
## 5.2.5
|
||||
@@ -616,7 +616,7 @@ Issues with publish process.
|
||||
* Fix `externalHelpers` option being incorrectly listed as type `string`.
|
||||
* **Internal**
|
||||
* Upgrade `core-js` to `0.9.0`.
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Fix object decorators not using the `initializer` pattern.
|
||||
* Remove property initializer descriptor reflection.
|
||||
|
||||
@@ -824,10 +824,10 @@ Issues with publish process.
|
||||
* Save register cache on tick instead of `SIGINT`.
|
||||
* Enable strict mode on babel-node eval flag.
|
||||
* **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.
|
||||
* 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.
|
||||
* Call `resolveModuleSource` on dynamic imports.
|
||||
* Added `param` to list of duplicate declaration kinds.
|
||||
@@ -836,4 +836,3 @@ Issues with publish process.
|
||||
* ES7 Abstract References have been removed.
|
||||
* Experimental option has been removed in favor of a stage option.
|
||||
* 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)
|
||||
|
||||
> 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.
|
||||
|
||||
#### :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`
|
||||
* [#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)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `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))
|
||||
|
||||
@@ -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
|
||||
|
||||
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
|
||||
// async generator syntax
|
||||
@@ -1569,7 +1569,7 @@ First PR!
|
||||
|
||||
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`, ...
|
||||
* [#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))
|
||||
* [#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))
|
||||
* [#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`
|
||||
* [#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`
|
||||
* [#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)
|
||||
|
||||
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
|
||||
* `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)
|
||||
|
||||
> 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:
|
||||
|
||||
@@ -2332,7 +2332,7 @@ Length: The number of characters in the output code
|
||||
* `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))
|
||||
|
||||
#### Spec Compliancy
|
||||
#### Spec Compliance
|
||||
* `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))
|
||||
|
||||
@@ -3206,7 +3206,7 @@ Changes to note:
|
||||
- Reverting the class properties semicolon parser error.
|
||||
- Fix regression with plugin ordering with `babel-register`.
|
||||
|
||||
#### Spec Compliancy
|
||||
#### Spec Compliance
|
||||
* `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))
|
||||
|
||||
@@ -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-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)).
|
||||
|
||||
* **Internal**
|
||||
@@ -3817,7 +3817,7 @@ Thanks to @samwgoldman for all the new flow support!
|
||||
* **New Feature**
|
||||
* Add support for `function.sent`.
|
||||
* **Internal**
|
||||
* Bump `invariant` depenency version.
|
||||
* Bump `invariant` dependency version.
|
||||
* **Polish**
|
||||
* Infer filename from the base directory when resolving plugins and presets.
|
||||
* 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.
|
||||
* Fix `buildExternalHelpers` script ignoring non-underscored helpers.
|
||||
* Fix exported classes with static class properties.
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Add support for computed mutators in `babel-plugin-transform-es2015-computed-properties`.
|
||||
* **Polish**
|
||||
* 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
|
||||
|
||||
* **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.
|
||||
* Protect against replacing a class expression with a name inferred version that would
|
||||
result in it never being transformed.
|
||||
@@ -3904,7 +3904,7 @@ Thanks to @samwgoldman for all the new flow support!
|
||||
* **Polish**
|
||||
* Add npm 3 check to `babel-doctor`.
|
||||
* Autoclear the `babel/register` cache when it gets too big to be serialised.
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Add support for flow existential type parameters.
|
||||
|
||||
## 6.1.1
|
||||
@@ -3969,14 +3969,14 @@ Thanks to @samwgoldman for all the new flow support!
|
||||
|
||||
## 6.0.14
|
||||
|
||||
* **Spec Compliancy**
|
||||
* **Spec Compliance**
|
||||
* Update exponentiation operator precedence.
|
||||
* Fix parser bug where arrow functions have a higher precedence than they should.
|
||||
* **Bug Fix**
|
||||
* Fix SystemJS module formatter exporting function parameters.
|
||||
* Ensure that invalid identifier JSX attribute keys are quoted when transforming to calls.
|
||||
* 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
|
||||
|
||||
|
||||
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
|
||||
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)
|
||||
|
||||
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 👍) -->
|
||||
| ------------------------ | ---
|
||||
| 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? |
|
||||
| Major: Breaking Change? |
|
||||
| Minor: New Feature? |
|
||||
|
||||
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
|
||||
9
.gitignore
vendored
9
.gitignore
vendored
@@ -1,5 +1,8 @@
|
||||
.npmrc
|
||||
|
||||
.DS_Store
|
||||
/node_modules
|
||||
/.github/actions/*/node_modules
|
||||
/packages/*/node_modules
|
||||
/packages/*/LICENSE
|
||||
!/packages/babel-parser/LICENSE
|
||||
@@ -15,6 +18,7 @@ coverage
|
||||
dist
|
||||
/.package.json
|
||||
package-lock.json
|
||||
!/.github/actions/*/package-lock.json
|
||||
|
||||
/packages/babel-runtime/helpers/*.js
|
||||
!/packages/babel-runtime/helpers/toArray.js
|
||||
@@ -36,6 +40,11 @@ package-lock.json
|
||||
/packages/babel-runtime-corejs2/core-js/**/*.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-cli/test/tmp
|
||||
/packages/babel-node/test/tmp
|
||||
|
||||
@@ -5,6 +5,7 @@ cache:
|
||||
yarn: true
|
||||
node_js:
|
||||
# We test the latest version on circleci
|
||||
- '11'
|
||||
- '10'
|
||||
- '8'
|
||||
- '6'
|
||||
|
||||
712
CHANGELOG.md
712
CHANGELOG.md
@@ -2,7 +2,7 @@
|
||||
|
||||
> **Tags:**
|
||||
> - :boom: [Breaking Change]
|
||||
> - :eyeglasses: [Spec Compliancy]
|
||||
> - :eyeglasses: [Spec Compliance]
|
||||
> - :rocket: [New Feature]
|
||||
> - :bug: [Bug Fix]
|
||||
> - :memo: [Documentation]
|
||||
@@ -15,6 +15,674 @@ See [CHANGELOG - v4](/.github/CHANGELOG-v4.md), [CHANGELOG - v5](/.github/CHANGE
|
||||
See [CHANGELOG - 6to5](/.github/CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
|
||||
See [Babylon's CHANGELOG](packages/babylon/CHANGELOG.md) for the Babylon pre-7.0.0-beta.29 version changelog.
|
||||
|
||||
<!-- DO NOT CHANGE THESE COMMENTS - See .github/actions/trigger-github-release/update-changelog.js -->
|
||||
<!-- insert-new-changelog-here -->
|
||||
|
||||
## v7.6.1 (2019-09-06)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-types`
|
||||
* [#10404](https://github.com/babel/babel/pull/10404) fix(types): correct typescript function headers ([@forstermatth](https://github.com/forstermatth))
|
||||
* `babel-node`
|
||||
* [#9758](https://github.com/babel/babel/pull/9758) Remove process.exit(1) from babel-node ([@dword-design](https://github.com/dword-design))
|
||||
|
||||
## v7.6.0 (2019-09-06)
|
||||
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-generator`, `babel-parser`
|
||||
* [#10269](https://github.com/babel/babel/pull/10269) Fix parenthesis for nullish coalescing ([@vivek12345](https://github.com/vivek12345))
|
||||
* `babel-helpers`, `babel-plugin-transform-block-scoping`, `babel-traverse`
|
||||
* [#9498](https://github.com/babel/babel/pull/9498) Fix tdz checks in transform-block-scoping plugin ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
#### :rocket: New Feature
|
||||
* `babel-core`
|
||||
* [#10181](https://github.com/babel/babel/pull/10181) feat(errors): validate preset when filename is absent ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-helper-create-class-features-plugin`, `babel-helpers`, `babel-plugin-proposal-private-methods`
|
||||
* [#10217](https://github.com/babel/babel/pull/10217) Class Private Static Accessors ([@tim-mc](https://github.com/tim-mc))
|
||||
* `babel-generator`, `babel-parser`, `babel-types`
|
||||
* [#10148](https://github.com/babel/babel/pull/10148) V8intrinsic syntax plugin ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-preset-typescript`
|
||||
* [#10382](https://github.com/babel/babel/pull/10382) Allow setting 'allowNamespaces' in typescript preset ([@dsgkirkby](https://github.com/dsgkirkby))
|
||||
* `babel-parser`
|
||||
* [#10352](https://github.com/babel/babel/pull/10352) Do not register ambient classes to the TS scope ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-types`
|
||||
* [#10248](https://github.com/babel/babel/pull/10248) Add static to class property builder ([@yuri-karadzhov](https://github.com/yuri-karadzhov))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-helpers`, `babel-plugin-transform-destructuring`, `babel-plugin-transform-modules-commonjs`, `babel-preset-env`
|
||||
* [#10396](https://github.com/babel/babel/pull/10396) fix: early return when instance is not iterable ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-plugin-transform-runtime`
|
||||
* [#10398](https://github.com/babel/babel/pull/10398) Add supports for polyfill computed methods ([@rhyzx](https://github.com/rhyzx))
|
||||
* `babel-preset-env`
|
||||
* [#10397](https://github.com/babel/babel/pull/10397) Don't polyfill when evaluation is not confident ([@rhyzx](https://github.com/rhyzx))
|
||||
* [#10218](https://github.com/babel/babel/pull/10218) [preset-env] Include / exclude module plugins properly ([@AdamRamberg](https://github.com/AdamRamberg))
|
||||
* [#10284](https://github.com/babel/babel/pull/10284) Replace es.string.reverse with es.array.reverse ([@epicfaace](https://github.com/epicfaace))
|
||||
* `babel-plugin-transform-named-capturing-groups-regex`
|
||||
* [#10395](https://github.com/babel/babel/pull/10395) fix: transform name capturing regex once ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-types`
|
||||
* [#10098](https://github.com/babel/babel/pull/10098) fix typescript for babel-types ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* [#10319](https://github.com/babel/babel/pull/10319) Add a builder definition including name for tsTypeParameter ([@deificx](https://github.com/deificx))
|
||||
* `babel-parser`
|
||||
* [#10380](https://github.com/babel/babel/pull/10380) Refactor trailing comment adjustment ([@banga](https://github.com/banga))
|
||||
* [#10369](https://github.com/babel/babel/pull/10369) Retain trailing comments in array expressions ([@banga](https://github.com/banga))
|
||||
* [#10292](https://github.com/babel/babel/pull/10292) fix: assign trailing comment to ObjectProperty only when inside an ObjectExpression ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-parser`, `babel-types`
|
||||
* [#10366](https://github.com/babel/babel/pull/10366) Don't allow JSXNamespacedName to chain ([@jridgewell](https://github.com/jridgewell))
|
||||
* `babel-generator`, `babel-plugin-transform-typescript`, `babel-types`
|
||||
* [#10341](https://github.com/babel/babel/pull/10341) Add TSBigIntKeyword to @babel/types ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-core`, `babel-types`
|
||||
* [#9960](https://github.com/babel/babel/pull/9960) Do not delete "fake" source map comments from strings ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-plugin-transform-flow-comments`
|
||||
* [#10329](https://github.com/babel/babel/pull/10329) Fix flow comments plugin issues ([@zaygraveyard](https://github.com/zaygraveyard))
|
||||
* `babel-helpers`, `babel-plugin-transform-react-constant-elements`
|
||||
* [#10307](https://github.com/babel/babel/pull/10307) [fix] jsx helper calls order ([@Sinewyk](https://github.com/Sinewyk))
|
||||
* `babel-plugin-proposal-decorators`
|
||||
* [#10302](https://github.com/babel/babel/pull/10302) fix: register inserted class declaration ([@thiagoarrais](https://github.com/thiagoarrais))
|
||||
* `babel-plugin-proposal-do-expressions`, `babel-traverse`
|
||||
* [#10070](https://github.com/babel/babel/pull/10070) Do expressions transform for switch statements ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* [#10277](https://github.com/babel/babel/pull/10277) remove finally from completion record in try statement ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-helpers`, `babel-plugin-transform-named-capturing-groups-regex`
|
||||
* [#10136](https://github.com/babel/babel/pull/10136) fix capturing group for matchAll ([@tanhauhau](https://github.com/tanhauhau))
|
||||
|
||||
#### :nail_care: Polish
|
||||
* `babel-plugin-transform-runtime`, `babel-preset-env`
|
||||
* [#10372](https://github.com/babel/babel/pull/10372) Don't allow instance properties transformation on namespace ([@rhyzx](https://github.com/rhyzx))
|
||||
|
||||
#### :memo: Documentation
|
||||
* [#10313](https://github.com/babel/babel/pull/10313) Adds note about two approval policy to PR template ([@thiagoarrais](https://github.com/thiagoarrais))
|
||||
|
||||
#### :house: Internal
|
||||
* `babel-register`
|
||||
* [#9847](https://github.com/babel/babel/pull/9847) Remove core-js dependency from @babel/register ([@coreyfarrell](https://github.com/coreyfarrell))
|
||||
* `babel-helper-fixtures`, `babel-helper-transform-fixture-test-runner`, `babel-preset-env`
|
||||
* [#10401](https://github.com/babel/babel/pull/10401) Use "validateLogs" for preset-env's debug fixtures ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-parser`
|
||||
* [#10380](https://github.com/babel/babel/pull/10380) Refactor trailing comment adjustment ([@banga](https://github.com/banga))
|
||||
* `babel-helper-fixtures`, `babel-helper-transform-fixture-test-runner`, `babel-plugin-proposal-dynamic-import`, `babel-preset-env`
|
||||
* [#10326](https://github.com/babel/babel/pull/10326) Allow testing logs with `@babel/helper-transform-fixture-test-runner` ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-runtime-corejs2`, `babel-runtime`, `babel-types`
|
||||
* [#10331](https://github.com/babel/babel/pull/10331) Commit generated code ([@JLHwung](https://github.com/JLHwung))
|
||||
* `babel-cli`, `babel-core`, `babel-generator`, `babel-helper-create-class-features-plugin`, `babel-helper-fixtures`, `babel-node`, `babel-parser`, `babel-plugin-proposal-do-expressions`, `babel-plugin-proposal-pipeline-operator`, `babel-plugin-transform-modules-commonjs`, `babel-plugin-transform-runtime`, `babel-preset-env`, `babel-standalone`, `babel-template`, `babel-traverse`, `babel-types`
|
||||
* [#10228](https://github.com/babel/babel/pull/10228) Update dev dependencies and fix linting errors ([@danez](https://github.com/danez))
|
||||
* `babel-cli`
|
||||
* [#10244](https://github.com/babel/babel/pull/10244) added flow to babel cli ([@Letladi](https://github.com/Letladi))
|
||||
|
||||
#### :running_woman: Performance
|
||||
* `babel-helpers`, `babel-plugin-transform-modules-commonjs`, `babel-preset-env`
|
||||
* [#10161](https://github.com/babel/babel/pull/10161) Improves the logic to import objects in helpers ([@ifsnow](https://github.com/ifsnow))
|
||||
* `babel-traverse`
|
||||
* [#10243](https://github.com/babel/babel/pull/10243) perf: always return `void 0` as undefined node ([@JLHwung](https://github.com/JLHwung))
|
||||
|
||||
## v7.5.5 (2019-07-17)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-code-frame`
|
||||
* [#10211](https://github.com/babel/babel/pull/10211) fix code-frame marker with highlighting ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-plugin-proposal-object-rest-spread`
|
||||
* [#10200](https://github.com/babel/babel/pull/10200) Workaround #10179 in proposal-object-rest-spread ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-types`
|
||||
* [#10198](https://github.com/babel/babel/pull/10198) add assertShape to validate templateElement ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-helper-create-class-features-plugin`, `babel-helper-member-expression-to-functions`, `babel-helper-replace-supers`, `babel-helpers`, `babel-plugin-proposal-class-properties`, `babel-plugin-transform-classes`, `babel-plugin-transform-object-super`, `babel-types`
|
||||
* [#10017](https://github.com/babel/babel/pull/10017) destructuring private fields with array pattern / object pattern ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-plugin-transform-flow-comments`
|
||||
* [#9901](https://github.com/babel/babel/pull/9901) fix transform-flow-comments for import types ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-core`, `babel-helpers`
|
||||
* [#10208](https://github.com/babel/babel/pull/10208) always throw when add missing helpers ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-plugin-transform-runtime`
|
||||
* [#10207](https://github.com/babel/babel/pull/10207) Closes [#10205](https://github.com/babel/babel/issues/10205) ([@sag1v](https://github.com/sag1v))
|
||||
* `babel-helpers`, `babel-plugin-transform-instanceof`
|
||||
* [#10197](https://github.com/babel/babel/pull/10197) fix: custom instOfHandler result should be cast to boolean ([@JLHwung](https://github.com/JLHwung))
|
||||
|
||||
#### :house: Internal
|
||||
* `babel-parser`, `babel-plugin-transform-typescript`
|
||||
* [#10014](https://github.com/babel/babel/pull/10014) Use correct extension for typescript fixtures ([@danez](https://github.com/danez))
|
||||
|
||||
#### :running_woman: Performance
|
||||
* `babel-helpers`, `babel-plugin-proposal-object-rest-spread`, `babel-preset-env`
|
||||
* [#10189](https://github.com/babel/babel/pull/10189) perf: match ownKeys perf to the one of objectSpread ([@JLHwung](https://github.com/JLHwung))
|
||||
|
||||
## v7.5.4 (2019-07-09)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-helpers`, `babel-plugin-proposal-object-rest-spread`, `babel-preset-env`
|
||||
* [#10188](https://github.com/babel/babel/pull/10188) Fix _objectSpread2 for real ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
## v7.5.3 (2019-07-09)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-helpers`, `babel-plugin-proposal-object-rest-spread`, `babel-preset-env`
|
||||
* [#10180](https://github.com/babel/babel/pull/10180) [_objectSpread2] Do not use hoisted var from prev iteration ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
## v7.5.2 (2019-07-08)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-plugin-transform-typescript`
|
||||
* [#10174](https://github.com/babel/babel/pull/10174) Do not trust Scope when removing TypeScript types ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-helpers`, `babel-plugin-proposal-object-rest-spread`, `babel-preset-env`
|
||||
* [#10171](https://github.com/babel/babel/pull/10171) Don't rely on getOwnPropertyDescriptors in objectSpread2 ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-plugin-proposal-export-default-from`, `babel-plugin-proposal-export-namespace-from`
|
||||
* [#10172](https://github.com/babel/babel/pull/10172) fix: register injected importDeclaration ([@JLHwung](https://github.com/JLHwung))
|
||||
|
||||
## v7.5.1 (2019-07-06)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-helpers`, `babel-plugin-proposal-object-rest-spread`
|
||||
* [#10170](https://github.com/babel/babel/pull/10170) Fix objectSpread2 backward compatibility ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-plugin-transform-typescript`
|
||||
* [#10167](https://github.com/babel/babel/pull/10167) Retain typescript export-from-source ([@Wolvereness](https://github.com/Wolvereness))
|
||||
|
||||
## v7.5.0 (2019-07-04)
|
||||
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-parser`
|
||||
* [#10099](https://github.com/babel/babel/pull/10099) Disallow "let" as name at lexical bindings ([@g-plane](https://github.com/g-plane))
|
||||
|
||||
#### :rocket: New Feature
|
||||
* `babel-parser`
|
||||
* [#10091](https://github.com/babel/babel/pull/10091) BigInt type for Flow ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* [#9450](https://github.com/babel/babel/pull/9450) Implement f# pipeline in parser ([@mAAdhaTTah](https://github.com/mAAdhaTTah))
|
||||
* [#9912](https://github.com/babel/babel/pull/9912) [legacy decorators] Allow decorating generator methods ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* [#9864](https://github.com/babel/babel/pull/9864) [@babel/parser] Add "allowUndeclaredExports" option ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-plugin-proposal-dynamic-import`, `babel-preset-env-standalone`, `babel-preset-env`
|
||||
* [#10109](https://github.com/babel/babel/pull/10109) Add @babel/plugin-proposal-dynamic-import to @babel/preset-env ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-plugin-proposal-dynamic-import`, `babel-plugin-transform-modules-amd`, `babel-plugin-transform-modules-commonjs`, `babel-plugin-transform-modules-systemjs`
|
||||
* [#9552](https://github.com/babel/babel/pull/9552) Create @babel/plugin-proposal-dynamic-import ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-plugin-proposal-pipeline-operator`, `babel-plugin-syntax-pipeline-operator`
|
||||
* [#9984](https://github.com/babel/babel/pull/9984) Transform for F# Pipeline ([@thiagoarrais](https://github.com/thiagoarrais))
|
||||
* `babel-plugin-transform-typescript`, `babel-types`
|
||||
* [#9785](https://github.com/babel/babel/pull/9785) Implement TypeScript namespace support ([@Wolvereness](https://github.com/Wolvereness))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-plugin-proposal-do-expressions`, `babel-traverse`
|
||||
* [#10072](https://github.com/babel/babel/pull/10072) fix await and yield for do expression ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-helpers`, `babel-plugin-transform-react-constant-elements`
|
||||
* [#10155](https://github.com/babel/babel/pull/10155) Added es3 backward compatibility for react helper code ([@sormy](https://github.com/sormy))
|
||||
* `babel-preset-env`
|
||||
* [#10127](https://github.com/babel/babel/pull/10127) Bump compat-table and updating preset-env mappings ([@existentialism](https://github.com/existentialism))
|
||||
* [#8897](https://github.com/babel/babel/pull/8897) Allow `defaults` query in preset-env ([@existentialism](https://github.com/existentialism))
|
||||
* `babel-parser`
|
||||
* [#10132](https://github.com/babel/babel/pull/10132) fix import typeof in declare module ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* [#10084](https://github.com/babel/babel/pull/10084) flow - allow type parameter defaults in function declarations ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-types`
|
||||
* [#10126](https://github.com/babel/babel/pull/10126) fix exportKind declaration in babel-types ([@zxbodya](https://github.com/zxbodya))
|
||||
* `babel-node`
|
||||
* [#9951](https://github.com/babel/babel/pull/9951) Prevents exception on PnP ([@arcanis](https://github.com/arcanis))
|
||||
* `babel-generator`
|
||||
* [#10041](https://github.com/babel/babel/pull/10041) Fix printer for explicitly inexact Flow types ([@mrtnzlml](https://github.com/mrtnzlml))
|
||||
* `babel-plugin-transform-typescript`
|
||||
* [#10034](https://github.com/babel/babel/pull/10034) Use scope for typescript export removals ([@Wolvereness](https://github.com/Wolvereness))
|
||||
* [#10019](https://github.com/babel/babel/pull/10019) fix(typescript): erase default export if exporting a TS type ([@airato](https://github.com/airato))
|
||||
* `babel-helper-create-class-features-plugin`, `babel-plugin-proposal-class-properties`, `babel-traverse`
|
||||
* [#10029](https://github.com/babel/babel/pull/10029) Fixed computed keys for class expression ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-helpers`, `babel-plugin-proposal-object-rest-spread`, `babel-preset-env`
|
||||
* [#9384](https://github.com/babel/babel/pull/9384) Retry to fix object spread helper compatibility ([@saschanaz](https://github.com/saschanaz))
|
||||
* `babel-plugin-transform-destructuring`
|
||||
* [#10013](https://github.com/babel/babel/pull/10013) fix destructuring rest with template literal ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-helper-create-class-features-plugin`, `babel-plugin-transform-typescript`
|
||||
* [#9610](https://github.com/babel/babel/pull/9610) Use `injectInitialization` to generate ts parameter properties ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
#### :nail_care: Polish
|
||||
* `babel-core`
|
||||
* [#10157](https://github.com/babel/babel/pull/10157) Fix incorrect usage of $o instead of %o in debug ([@ChlorideCull](https://github.com/ChlorideCull))
|
||||
* `babel-helpers`
|
||||
* [#10117](https://github.com/babel/babel/pull/10117) Simplify the helpers for classPrivateField{Get,Set} ([@arv](https://github.com/arv))
|
||||
* `babel-plugin-transform-typescript`
|
||||
* [#10047](https://github.com/babel/babel/pull/10047) Refactor isImportTypeOnly helper function ([@Andarist](https://github.com/Andarist))
|
||||
|
||||
#### :memo: Documentation
|
||||
* `babel-plugin-proposal-partial-application`, `babel-plugin-syntax-partial-application`
|
||||
* [#10103](https://github.com/babel/babel/pull/10103) docs: update readmes ([@xtuc](https://github.com/xtuc))
|
||||
|
||||
## v7.4.5 (2019-05-21)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-parser`
|
||||
* [#9998](https://github.com/babel/babel/pull/9998) Fix location for optional params in arrow functions ([@danez](https://github.com/danez))
|
||||
* [#9982](https://github.com/babel/babel/pull/9982) Avoid unnecessary work during lookahead ([@danez](https://github.com/danez))
|
||||
* [#9922](https://github.com/babel/babel/pull/9922) fix: allow shebang directive ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-preset-env`
|
||||
* [#10002](https://github.com/babel/babel/pull/10002) Update preset-env dependencies and fix fixtures ([@danez](https://github.com/danez))
|
||||
* [#9978](https://github.com/babel/babel/pull/9978) Fix mobile browsers support in preset-env ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* [#9902](https://github.com/babel/babel/pull/9902) Fix destructuring assignments being transpiled for edge 15 ([@eps1lon](https://github.com/eps1lon))
|
||||
* `babel-plugin-transform-typescript`
|
||||
* [#9944](https://github.com/babel/babel/pull/9944) fix(typescript): erase type exports ([@airato](https://github.com/airato))
|
||||
|
||||
#### :nail_care: Polish
|
||||
* `babel-parser`
|
||||
* [#9995](https://github.com/babel/babel/pull/9995) Do not use lookahead when parsing construct signature declarations in TS ([@danez](https://github.com/danez))
|
||||
* [#9989](https://github.com/babel/babel/pull/9989) Only compute Position if not already in state ([@danez](https://github.com/danez))
|
||||
* [#9988](https://github.com/babel/babel/pull/9988) Do not use lookahead when parsing jsx expression containers ([@danez](https://github.com/danez))
|
||||
* [#9987](https://github.com/babel/babel/pull/9987) Do not use lookahead when parsing imports in declare module in flow ([@danez](https://github.com/danez))
|
||||
* [#9985](https://github.com/babel/babel/pull/9985) Do not use lookahead when parsing declare module or declare module.exports in flow ([@danez](https://github.com/danez))
|
||||
* [#9983](https://github.com/babel/babel/pull/9983) Do not use lookahead when parsing dynamic import or import.meta ([@danez](https://github.com/danez))
|
||||
* [#9979](https://github.com/babel/babel/pull/9979) Remove guardedHandlers from ASTs ([@danez](https://github.com/danez))
|
||||
* `babel-preset-env`
|
||||
* [#9992](https://github.com/babel/babel/pull/9992) use console.warn for warning ([@schu34](https://github.com/schu34))
|
||||
* `babel-core`
|
||||
* [#9945](https://github.com/babel/babel/pull/9945) Fixed null error in plugin opts and added a test for it ([@divbhasin](https://github.com/divbhasin))
|
||||
* `babel-core`, `babel-traverse`
|
||||
* [#9909](https://github.com/babel/babel/pull/9909) Add missing space in error messages ([@pnavarrc](https://github.com/pnavarrc))
|
||||
|
||||
#### :house: Internal
|
||||
* `babel-node`
|
||||
* [#9914](https://github.com/babel/babel/pull/9914) [babel-node] Do not hardcode node flags ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
## v7.4.4 (2019-04-26)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-plugin-transform-flow-comments`
|
||||
* [#9897](https://github.com/babel/babel/pull/9897) fix flow-comments - class type paramters and implements ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* [#9893](https://github.com/babel/babel/pull/9893) fix flow-comment - object destructuring ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-parser`
|
||||
* [#9766](https://github.com/babel/babel/pull/9766) Add TS support to @babel/parser's Scope ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* [#9865](https://github.com/babel/babel/pull/9865) Always register global bindings as exportable ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* [#9887](https://github.com/babel/babel/pull/9887) Fix TypeScript readonly error location ([@existentialism](https://github.com/existentialism))
|
||||
* [#9869](https://github.com/babel/babel/pull/9869) ! remove constant context assertions ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* [#9890](https://github.com/babel/babel/pull/9890) Fix parsing typescript bodiless methods with the estree plugin also enabled ([@devongovett](https://github.com/devongovett))
|
||||
* `babel-traverse`
|
||||
* [#9870](https://github.com/babel/babel/pull/9870) Fix flow types in traverse/path/family and enable flow ([@danez](https://github.com/danez))
|
||||
* `babel-plugin-proposal-class-properties`, `babel-plugin-transform-modules-commonjs`, `babel-types`
|
||||
* [#9861](https://github.com/babel/babel/pull/9861) Fix: PrivateName Identifier should not be isReferenced. ([@coreyfarrell](https://github.com/coreyfarrell))
|
||||
* `babel-types`
|
||||
* [#9832](https://github.com/babel/babel/pull/9832) Fix typo in cloneNode. ([@evandervalk](https://github.com/evandervalk))
|
||||
|
||||
|
||||
## v7.4.3 (2019-04-02)
|
||||
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-parser`
|
||||
* [#9769](https://github.com/babel/babel/pull/9769) Don't accept '\08' or '\09' in strict mode. ([@danez](https://github.com/danez))
|
||||
* [#9768](https://github.com/babel/babel/pull/9768) Correctly check for-in and for-of loop for invalid left-hand side. ([@danez](https://github.com/danez))
|
||||
* [#9767](https://github.com/babel/babel/pull/9767) Parse right-hand-side of for/of as an assignment expression. ([@danez](https://github.com/danez))
|
||||
* [#9748](https://github.com/babel/babel/pull/9748) [typescript] parsing template literal as type . ([@tanhauhau](https://github.com/tanhauhau))
|
||||
|
||||
#### :rocket: New Feature
|
||||
* `babel-plugin-transform-runtime`
|
||||
* [#9754](https://github.com/babel/babel/pull/9754) [runtime-corejs3] Only polyfill instance methods when it might be needed. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-polyfill`
|
||||
* [#9780](https://github.com/babel/babel/pull/9780) Closes [#9232](https://github.com/babel/babel/issues/9232), add some missed modules to `@babel/polyfill/noConflict`. ([@zloirock](https://github.com/zloirock))
|
||||
* `babel-cli`
|
||||
* [#9807](https://github.com/babel/babel/pull/9807) Upgrade lodash to 4.17.11. ([@danez](https://github.com/danez))
|
||||
* `babel-helper-module-transforms`, `babel-plugin-transform-modules-commonjs`
|
||||
* [#9802](https://github.com/babel/babel/pull/9802) Fix lazy option of babel-plugin-transform-modules-commonjs. ([@AndreasCag](https://github.com/AndreasCag))
|
||||
* `babel-helper-create-class-features-plugin`, `babel-plugin-proposal-private-methods`
|
||||
* [#9801](https://github.com/babel/babel/pull/9801) Fix super method call in private instance method calling overridden method. ([@MattiasBuelens](https://github.com/MattiasBuelens))
|
||||
* `babel-plugin-proposal-object-rest-spread`, `babel-plugin-transform-destructuring`
|
||||
* [#9416](https://github.com/babel/babel/pull/9416) Destructuring: Fix handling of impure computed keys with object rest. ([@motiz88](https://github.com/motiz88))
|
||||
* `babel-plugin-transform-destructuring`
|
||||
* [#9412](https://github.com/babel/babel/pull/9412) Destructuring: Fix array unpacking assignments with holes on RHS. ([@motiz88](https://github.com/motiz88))
|
||||
* `babel-traverse`
|
||||
* [#9415](https://github.com/babel/babel/pull/9415) @babel/traverse: Fix NodePath.getData. ([@71](https://github.com/71))
|
||||
* `babel-parser`
|
||||
* [#9760](https://github.com/babel/babel/pull/9760) Allow HTML comments on first line. ([@danez](https://github.com/danez))
|
||||
* [#9700](https://github.com/babel/babel/pull/9700) Fix compatibility between estree and TS plugin. ([@danez](https://github.com/danez))
|
||||
* `babel-helpers`
|
||||
* [#9756](https://github.com/babel/babel/pull/9756) Allow coreJS Symbol to be type object. ([@conartist6](https://github.com/conartist6))
|
||||
* `babel-preset-env`
|
||||
* [#9752](https://github.com/babel/babel/pull/9752) Normalize `core-js` entry points. ([@zloirock](https://github.com/zloirock))
|
||||
|
||||
#### :nail_care: Polish
|
||||
* `babel-parser`
|
||||
* [#9762](https://github.com/babel/babel/pull/9762) Optimize parseBindingAtom code to get better error messages. ([@danez](https://github.com/danez))
|
||||
* `babel-core`, `babel-plugin-transform-for-of`
|
||||
* [#9698](https://github.com/babel/babel/pull/9698) Move array reference into `for` head initializer. ([@danez](https://github.com/danez))
|
||||
|
||||
#### :house: Internal
|
||||
* Other
|
||||
* [#9806](https://github.com/babel/babel/pull/9806) Update test262. ([@danez](https://github.com/danez))
|
||||
* `babel-parser`, `babel-preset-typescript`
|
||||
* [#9761](https://github.com/babel/babel/pull/9761) Explicit labels for tokenTypes. ([@danez](https://github.com/danez))
|
||||
|
||||
|
||||
## v7.4.2 (2019-03-21)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-parser`
|
||||
* [#9725](https://github.com/babel/babel/pull/9725) Modules might be in loose mode when checking for undecl exports ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* [#9719](https://github.com/babel/babel/pull/9719) Fix scope checks with enabled flow plugin ([@danez](https://github.com/danez))
|
||||
* `babel-helpers`, `babel-plugin-transform-named-capturing-groups-regex`
|
||||
* [#9726](https://github.com/babel/babel/pull/9726) Fix typo in wrapRegExp helper ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-preset-env`
|
||||
* [#9724](https://github.com/babel/babel/pull/9724) Closes [#9713](https://github.com/babel/babel/issues/9713) ([@zloirock](https://github.com/zloirock))
|
||||
|
||||
#### :nail_care: Polish
|
||||
* `babel-preset-env`
|
||||
* [#9732](https://github.com/babel/babel/pull/9732) Mark the core-js warning as such ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* [#9716](https://github.com/babel/babel/pull/9716) Tweak preset-env corejs/useBuiltIns warning and error messages ([@existentialism](https://github.com/existentialism))
|
||||
|
||||
#### :house: Internal
|
||||
* [#9718](https://github.com/babel/babel/pull/9718) Bump Babel deps ([@existentialism](https://github.com/existentialism))
|
||||
|
||||
## v7.4.1 (2019-03-20)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-preset-env`
|
||||
* [#9711](https://github.com/babel/babel/pull/9711) Alias @babel/preset-env/data/built-ins.json.js ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* [#9709](https://github.com/babel/babel/pull/9709) Bring back isPluginRequired ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
## v7.4.0 (2019-03-19)
|
||||
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-parser`
|
||||
* [#9529](https://github.com/babel/babel/pull/9529) Add `readonly` to TypeScript type modifier ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* [#9534](https://github.com/babel/babel/pull/9534) TypeScript Constant contexts ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* [#9637](https://github.com/babel/babel/pull/9637) Update identifier parsing per Unicode v12 ([@mathiasbynens](https://github.com/mathiasbynens))
|
||||
* [#9616](https://github.com/babel/babel/pull/9616) Allow any reserved word in `export {} from` specifiers ([@danez](https://github.com/danez))
|
||||
* [#9612](https://github.com/babel/babel/pull/9612) [TS] Disallow type casts in arrow parameters ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* [#9607](https://github.com/babel/babel/pull/9607) Refactor parsing object members ([@danez](https://github.com/danez))
|
||||
* [#9599](https://github.com/babel/babel/pull/9599) Disallow duplicate params in methods ([@danez](https://github.com/danez))
|
||||
* [#9586](https://github.com/babel/babel/pull/9586) Treat for loop body as part of loop scope ([@danez](https://github.com/danez))
|
||||
* `babel-parser`, `babel-plugin-transform-typescript`
|
||||
* [#9641](https://github.com/babel/babel/pull/9641) Allow context type annotation on getters/setters ([@matt-tingen](https://github.com/matt-tingen))
|
||||
* `babel-plugin-proposal-unicode-property-regex`, `babel-plugin-transform-dotall-regex`, `babel-plugin-transform-unicode-regex`
|
||||
* [#9636](https://github.com/babel/babel/pull/9636) Update babel-plugin-proposal-unicode-property-regex for Unicode v12 ([@mathiasbynens](https://github.com/mathiasbynens))
|
||||
* `babel-generator`, `babel-parser`, `babel-plugin-transform-flow-strip-types`, `babel-plugin-transform-modules-systemjs`
|
||||
* [#9589](https://github.com/babel/babel/pull/9589) Check exported bindings are defined ([@danez](https://github.com/danez))
|
||||
* `babel-generator`, `babel-parser`, `babel-plugin-transform-classes`, `babel-plugin-transform-flow-comments`, `babel-plugin-transform-flow-strip-types`, `babel-plugin-transform-new-target`
|
||||
* [#9493](https://github.com/babel/babel/pull/9493) Introduce scope tracking in the parser ([@danez](https://github.com/danez))
|
||||
|
||||
#### :rocket: New Feature
|
||||
* `babel-helpers`, `babel-plugin-proposal-class-properties`, `babel-plugin-proposal-decorators`, `babel-plugin-proposal-object-rest-spread`, `babel-plugin-transform-runtime`, `babel-plugin-transform-typescript`, `babel-polyfill`, `babel-preset-env`, `babel-register`, `babel-runtime-corejs2`, `babel-runtime-corejs3`
|
||||
* [#7646](https://github.com/babel/babel/pull/7646) Update to `core-js@3` ([@zloirock](https://github.com/zloirock))
|
||||
* `babel-template`
|
||||
* [#9648](https://github.com/babel/babel/pull/9648) Add %%placeholders%% support to @babel/template ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-parser`, `babel-plugin-proposal-partial-application`
|
||||
* [#9474](https://github.com/babel/babel/pull/9474) Partial application plugin ([@byara](https://github.com/byara))
|
||||
* `babel-generator`, `babel-helper-create-class-features-plugin`, `babel-helpers`, `babel-plugin-proposal-private-methods`
|
||||
* [#9446](https://github.com/babel/babel/pull/9446) Private Static Class Methods (Stage 3) ([@tim-mc](https://github.com/tim-mc))
|
||||
* `babel-generator`, `babel-types`
|
||||
* [#9542](https://github.com/babel/babel/pull/9542) Add placeholders support to @babel/types and @babel/generator ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-parser`
|
||||
* [#9364](https://github.com/babel/babel/pull/9364) Add parser support for placeholders ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-generator`, `babel-parser`, `babel-plugin-syntax-partial-application`, `babel-types`
|
||||
* [#9343](https://github.com/babel/babel/pull/9343) Partial Application Syntax: Stage 1 ([@byara](https://github.com/byara))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-helper-create-class-features-plugin`, `babel-helper-replace-supers`, `babel-plugin-proposal-private-methods`
|
||||
* [#9704](https://github.com/babel/babel/pull/9704) Fix `super` Method Calls in Class Private Methods ([@tim-mc](https://github.com/tim-mc))
|
||||
* `babel-parser`
|
||||
* [#9699](https://github.com/babel/babel/pull/9699) Correctly parse TS TypeAssertions around arrow functions ([@danez](https://github.com/danez))
|
||||
* [#9600](https://github.com/babel/babel/pull/9600) Fix scope check for 2nd+ lexical bindings ([@danez](https://github.com/danez))
|
||||
* [#9593](https://github.com/babel/babel/pull/9593) [TS] Correctly forget `await`s after parsing async arrows with type args ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* [#9585](https://github.com/babel/babel/pull/9585) Fix strict mode prescanning with EmptyStatement ([@danez](https://github.com/danez))
|
||||
* `babel-core`, `babel-plugin-transform-for-of`
|
||||
* [#9697](https://github.com/babel/babel/pull/9697) Correctly preserve reference to array in for-of loop ([@danez](https://github.com/danez))
|
||||
* `babel-plugin-transform-typescript`
|
||||
* [#9693](https://github.com/babel/babel/pull/9693) [plugin-transform-typescript] Fix transpiling of TS abstract classes with decorators ([@agoldis](https://github.com/agoldis))
|
||||
* `babel-traverse`, `babel-types`
|
||||
* [#9692](https://github.com/babel/babel/pull/9692) Fix TSFunctionType visitors definition ([@penielse](https://github.com/penielse))
|
||||
* `babel-plugin-proposal-object-rest-spread`
|
||||
* [#9628](https://github.com/babel/babel/pull/9628) [proposal-object-rest-spread] fix templateLiteral in extractNormalizedKeys ([@pnowak](https://github.com/pnowak))
|
||||
* `babel-plugin-transform-modules-systemjs`
|
||||
* [#9639](https://github.com/babel/babel/pull/9639) System modules - Hoist classes like other variables ([@guybedford](https://github.com/guybedford))
|
||||
* `babel-generator`, `babel-parser`
|
||||
* [#9618](https://github.com/babel/babel/pull/9618) Disallow escape sequences in contextual keywords ([@danez](https://github.com/danez))
|
||||
* `babel-helper-split-export-declaration`, `babel-plugin-transform-modules-commonjs`, `babel-traverse`
|
||||
* [#9613](https://github.com/babel/babel/pull/9613) Don't add params of anonymous exported function decls to the outer scope ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-plugin-transform-parameters`, `babel-plugin-transform-typescript`, `babel-types`
|
||||
* [#9605](https://github.com/babel/babel/pull/9605) [plugin-transform-typescript] Strip type imports used in Enums and object types ([@echenley](https://github.com/echenley))
|
||||
* `babel-helper-call-delegate`, `babel-plugin-transform-parameters`
|
||||
* [#9601](https://github.com/babel/babel/pull/9601) Don't loose "this" in helper-call-delegate ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-plugin-proposal-object-rest-spread`, `babel-plugin-transform-modules-commonjs`, `babel-traverse`, `babel-types`
|
||||
* [#9492](https://github.com/babel/babel/pull/9492) Mark FOO in "var { x: FOO }˝ as a binding, not as a reference ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-preset-env`
|
||||
* [#9595](https://github.com/babel/babel/pull/9595) preset-env: Sort versions before determining lowest ([@jridgewell](https://github.com/jridgewell))
|
||||
* `babel-helper-define-map`, `babel-helper-hoist-variables`, `babel-parser`, `babel-plugin-proposal-object-rest-spread`, `babel-plugin-transform-block-scoping`, `babel-plugin-transform-destructuring`, `babel-plugin-transform-modules-systemjs`, `babel-traverse`, `babel-types`
|
||||
* [#9518](https://github.com/babel/babel/pull/9518) Use `for..of Object.keys` instead of `for..in` ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
#### :nail_care: Polish
|
||||
* `babel-parser`
|
||||
* [#9646](https://github.com/babel/babel/pull/9646) Remove input and length from state ([@danez](https://github.com/danez))
|
||||
* [#9645](https://github.com/babel/babel/pull/9645) Reorganize token types and use a map for them ([@danez](https://github.com/danez))
|
||||
* [#9591](https://github.com/babel/babel/pull/9591) Remove always false param allowExpressionBody ([@danez](https://github.com/danez))
|
||||
* `babel-standalone`, `babel-types`
|
||||
* [#9025](https://github.com/babel/babel/pull/9025) Make babel-standalone an ESModule and enable flow ([@danez](https://github.com/danez))
|
||||
* `babel-generator`
|
||||
* [#9579](https://github.com/babel/babel/pull/9579) change var name for coherence ([@tanohzana](https://github.com/tanohzana))
|
||||
|
||||
#### :house: Internal
|
||||
* Other
|
||||
* [#9588](https://github.com/babel/babel/pull/9588) Publish to npm using a GitHub action ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* [#9640](https://github.com/babel/babel/pull/9640) Switch from rollup-stream to rollup ([@danez](https://github.com/danez))
|
||||
* [#9647](https://github.com/babel/babel/pull/9647) Add WarningsToErrorsPlugin to webpack to avoid missing build problems on CI ([@danez](https://github.com/danez))
|
||||
* [#9624](https://github.com/babel/babel/pull/9624) Update dependencies ([@danez](https://github.com/danez))
|
||||
* [#9623](https://github.com/babel/babel/pull/9623) Add editorconfig for Makefile ([@danez](https://github.com/danez))
|
||||
* [#9587](https://github.com/babel/babel/pull/9587) Update test262 ([@danez](https://github.com/danez))
|
||||
* [#9582](https://github.com/babel/babel/pull/9582) Minify bundles on circle for repl ([@danez](https://github.com/danez))
|
||||
* `babel-register`
|
||||
* [#9678](https://github.com/babel/babel/pull/9678) Remove dependency on home-or-tmp package ([@AmirS](https://github.com/AmirS))
|
||||
|
||||
## v7.3.4 (2019-02-25)
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-parser`
|
||||
* [#9572](https://github.com/babel/babel/pull/9572) Fix TypeScript parsers missing token check (#9571) ([@elevatebart](https://github.com/elevatebart))
|
||||
* [#9521](https://github.com/babel/babel/pull/9521) Also check AssignmentPatterns for duplicate export name ([@danez](https://github.com/danez))
|
||||
* `babel-helper-create-class-features-plugin`, `babel-helper-replace-supers`, `babel-plugin-proposal-class-properties`, `babel-traverse`
|
||||
* [#9508](https://github.com/babel/babel/pull/9508) Use correct "this" in static fields ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-preset-env`
|
||||
* [#9566](https://github.com/babel/babel/pull/9566) Closes [#9465](https://github.com/babel/babel/issues/9465) ([@zloirock](https://github.com/zloirock))
|
||||
* `babel-types`
|
||||
* [#9539](https://github.com/babel/babel/pull/9539) babel-types is* type checks accept null | undefiend as value TS type ([@ian-craig](https://github.com/ian-craig))
|
||||
* `babel-plugin-transform-block-scoping`, `babel-traverse`
|
||||
* [#9532](https://github.com/babel/babel/pull/9532) Migrate some duplicate binding tests to traverse ([@danez](https://github.com/danez))
|
||||
* `babel-generator`
|
||||
* [#9524](https://github.com/babel/babel/pull/9524) Fix typescript generator params ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* [#9523](https://github.com/babel/babel/pull/9523) Fix flow babel-generator function parantheses ([@tanhauhau](https://github.com/tanhauhau))
|
||||
|
||||
#### :house: Internal
|
||||
* Other
|
||||
* [#9561](https://github.com/babel/babel/pull/9561) Update CHANGELOG.md using the "Trigger GitHub release" action ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-plugin-proposal-object-rest-spread`, `babel-plugin-transform-modules-systemjs`
|
||||
* [#9541](https://github.com/babel/babel/pull/9541) Enable eqeqeq rule in eslint ([@danez](https://github.com/danez))
|
||||
* `babel-generator`, `babel-parser`, `babel-plugin-transform-flow-strip-types`, `babel-traverse`
|
||||
* [#9522](https://github.com/babel/babel/pull/9522) Make tests spec compliant by avoiding duplicate declarations in input files ([@danez](https://github.com/danez))
|
||||
* `babel-plugin-transform-proto-to-assign`
|
||||
* [#9533](https://github.com/babel/babel/pull/9533) Add import/no-extraneous-dependencies to ESLint ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
## v7.3.3 (2019-02-15)
|
||||
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-generator`
|
||||
* [#9501](https://github.com/babel/babel/pull/9501) Correctly output escapes in directives ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-parser`
|
||||
* [#9477](https://github.com/babel/babel/pull/9477) Fix regression with let ([@danez](https://github.com/danez))
|
||||
* [#9431](https://github.com/babel/babel/pull/9431) Typescript function destructured params ([@mhcgrq](https://github.com/mhcgrq))
|
||||
* [#9463](https://github.com/babel/babel/pull/9463) Fix range for TypeScript optional parameter in arrow function ([@existentialism](https://github.com/existentialism))
|
||||
|
||||
#### :nail_care: Polish
|
||||
* `babel-plugin-proposal-class-properties`, `babel-plugin-transform-classes`, `babel-plugin-transform-parameters`
|
||||
* [#9458](https://github.com/babel/babel/pull/9458) Fix duplicated assertThisInitialized calls in constructors ([@rubennorte](https://github.com/rubennorte))
|
||||
|
||||
#### :house: Internal
|
||||
* Other
|
||||
* [#9517](https://github.com/babel/babel/pull/9517) Add duplicate-package-checker-webpack-plugin ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* [#9469](https://github.com/babel/babel/pull/9469) Exclude generate @babel/types files from coverage report ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-parser`
|
||||
* [#9491](https://github.com/babel/babel/pull/9491) Better error output in parser tests ([@danez](https://github.com/danez))
|
||||
## v7.3.2 (2019-02-04)
|
||||
|
||||
Various spec compliance fixes and better support for smart pipelines and private methods.
|
||||
|
||||
Thanks @gverni, @naffiq, @spondbob and @dstaley for their first PRs!
|
||||
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-parser`
|
||||
* [#9403](https://github.com/babel/babel/pull/9403) Fix line continuation with Unicode line terminators. ([@danez](https://github.com/danez))
|
||||
* [#9400](https://github.com/babel/babel/pull/9400) Make yield a contextual keyword. ([@danez](https://github.com/danez))
|
||||
* [#9398](https://github.com/babel/babel/pull/9398) Correctly fail for invalid yield in for. ([@danez](https://github.com/danez))
|
||||
* [#9375](https://github.com/babel/babel/pull/9375) Make let a contextual keyword. ([@danez](https://github.com/danez))
|
||||
|
||||
#### :rocket: New Feature
|
||||
* `babel-plugin-proposal-pipeline-operator`
|
||||
* [#9401](https://github.com/babel/babel/pull/9401) Support for await and yield in pipelines. ([@thiagoarrais](https://github.com/thiagoarrais))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-plugin-proposal-private-methods`, `babel-types`
|
||||
* [#9453](https://github.com/babel/babel/pull/9453) Fix duplicate definition error in private class methods. ([@gverni](https://github.com/gverni))
|
||||
* `babel-helper-create-class-features-plugin`, `babel-plugin-proposal-private-methods`
|
||||
* [#9423](https://github.com/babel/babel/pull/9423) Transform private async and generator functions. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-plugin-proposal-object-rest-spread`, `babel-plugin-transform-destructuring`
|
||||
* [#9414](https://github.com/babel/babel/pull/9414) Destructuring: Create assignments from ForX non-declaration patterns. ([@motiz88](https://github.com/motiz88))
|
||||
* `babel-plugin-transform-typescript`
|
||||
* [#9095](https://github.com/babel/babel/pull/9095) Retain JSX pragma if defined as a comment. ([@dstaley](https://github.com/dstaley))
|
||||
* `babel-parser`
|
||||
* [#9406](https://github.com/babel/babel/pull/9406) Fix location/range on TypeScript ExportNamedDeclarations. ([@existentialism](https://github.com/existentialism))
|
||||
* [#9371](https://github.com/babel/babel/pull/9371) Allow toplevel await with option and correctly mark await keyword as unexpected. ([@danez](https://github.com/danez))
|
||||
* `babel-plugin-transform-typescript`, `babel-types`
|
||||
* [#8738](https://github.com/babel/babel/pull/8738) Fix typescript side effects. ([@yuri-karadzhov](https://github.com/yuri-karadzhov))
|
||||
* `babel-generator`, `babel-types`
|
||||
* [#9396](https://github.com/babel/babel/pull/9396) Fix support for Flow's QualifiedTypeIdentifier. ([@existentialism](https://github.com/existentialism))
|
||||
|
||||
#### :nail_care: Polish
|
||||
* `babel-parser`
|
||||
* [#9405](https://github.com/babel/babel/pull/9405) Simplify await and yield tracking in params. ([@danez](https://github.com/danez))
|
||||
* `babel-parser`, `babel-preset-typescript`
|
||||
* [#9402](https://github.com/babel/babel/pull/9402) Unify reserved word checking and update error messages. ([@danez](https://github.com/danez))
|
||||
|
||||
## v7.3.1 (2019-01-22)
|
||||
|
||||
This release fixes some regressions introduced in v7.3.0
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-helpers`, `babel-plugin-proposal-object-rest-spread`, `babel-preset-env`
|
||||
* [#9379](https://github.com/babel/babel/pull/9379) Revert "Differentiate object spread and non-spread properties (#9341)". ([@danez](https://github.com/danez))
|
||||
* `babel-parser`
|
||||
* [#9377](https://github.com/babel/babel/pull/9377) fix new keyword broken by recent refactoring. ([@danez](https://github.com/danez))
|
||||
|
||||
## v7.3.0 (2019-01-21)
|
||||
|
||||
Thanks to @jamesgeorge007 and @armano2 for their first PR!
|
||||
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-parser`
|
||||
* [#9314](https://github.com/babel/babel/pull/9314) Disallow async functions as loop body. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* [#9315](https://github.com/babel/babel/pull/9315) Parse class heritage as strict mode code. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* [#9313](https://github.com/babel/babel/pull/9313) Disallow `new import(x)` and `import(x,)`. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* [#9311](https://github.com/babel/babel/pull/9311) Disallow trailing comma after rest. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
#### :rocket: New Feature
|
||||
* `babel-helper-create-class-features-plugin`, `babel-helpers`, `babel-plugin-proposal-private-methods`
|
||||
* [#9101](https://github.com/babel/babel/pull/9101) Private Class Methods Stage 3: Private Accessors. ([@tim-mc](https://github.com/tim-mc))
|
||||
* `babel-plugin-proposal-pipeline-operator`, `babel-plugin-syntax-pipeline-operator`
|
||||
* [#9179](https://github.com/babel/babel/pull/9179) Transform for the smart pipeline operator proposal. ([@thiagoarrais](https://github.com/thiagoarrais))
|
||||
* `babel-preset-env-standalone`, `babel-preset-env`
|
||||
* [#9345](https://github.com/babel/babel/pull/9345) Add support for transform-named-capturing-groups-regex in preset-env. ([@existentialism](https://github.com/existentialism))
|
||||
* `babel-helpers`, `babel-plugin-transform-named-capturing-groups-regex`
|
||||
* [#7105](https://github.com/babel/babel/pull/7105) Add @babel/plugin-transform-named-capturing-groups-regex. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-preset-env`
|
||||
* [#9323](https://github.com/babel/babel/pull/9323) Add support for proposal-json-strings in preset-env. ([@existentialism](https://github.com/existentialism))
|
||||
* `babel-generator`, `babel-types`
|
||||
* [#9309](https://github.com/babel/babel/pull/9309) Add emit and builder for TSImportType. ([@hzoo](https://github.com/hzoo))
|
||||
* `babel-parser`
|
||||
* [#9302](https://github.com/babel/babel/pull/9302) @babel/parser(ts): Add parsing of type import. ([@armano2](https://github.com/armano2))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-parser`
|
||||
* [#9336](https://github.com/babel/babel/pull/9336) Disallow usage of invalid keyword after export abstract statement in Typescript. ([@armano2](https://github.com/armano2))
|
||||
* [#9328](https://github.com/babel/babel/pull/9328) Fix handling newline with TypeScript declare and abstract classes. ([@existentialism](https://github.com/existentialism))
|
||||
* [#9335](https://github.com/babel/babel/pull/9335) Fix range on TypeScript index signature parameters. ([@existentialism](https://github.com/existentialism))
|
||||
* [#9292](https://github.com/babel/babel/pull/9292) Throw error if TypeScript class has empty implements. ([@existentialism](https://github.com/existentialism))
|
||||
* [#9284](https://github.com/babel/babel/pull/9284) Fix location for typescript type assertions in AST. ([@danez](https://github.com/danez))
|
||||
* [#9276](https://github.com/babel/babel/pull/9276) Ensure modifiers are included in TSParameterProperty ranges. ([@existentialism](https://github.com/existentialism))
|
||||
* [#9230](https://github.com/babel/babel/pull/9230) babel-parser: typescript: add missing bigint keyword. ([@armano2](https://github.com/armano2))
|
||||
* `babel-types`
|
||||
* [#9333](https://github.com/babel/babel/pull/9333) Copy "optional" property when cloning Identifier node. ([@unconfident](https://github.com/unconfident))
|
||||
* `babel-helper-create-class-features-plugin`, `babel-helpers`, `babel-plugin-proposal-decorators`
|
||||
* [#9244](https://github.com/babel/babel/pull/9244) [decorators] Set method names at compile time instead of at runtime. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-helper-builder-react-jsx`, `babel-plugin-transform-react-jsx`
|
||||
* [#9119](https://github.com/babel/babel/pull/9119) Revert "Revert babel-helper-builder-react-jsx change from #4988". ([@danez](https://github.com/danez))
|
||||
* `babel-helper-create-class-features-plugin`, `babel-plugin-proposal-private-methods`
|
||||
* [#9248](https://github.com/babel/babel/pull/9248) [private methods] Define private methods before executing initializers. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-preset-env`
|
||||
* [#9219](https://github.com/babel/babel/pull/9219) Fix handling scoped packages in preset-env include/exclude options. ([@existentialism](https://github.com/existentialism))
|
||||
|
||||
#### :nail_care: Polish
|
||||
* `babel-parser`
|
||||
* [#9348](https://github.com/babel/babel/pull/9348) Parser Performance Collection. ([@danez](https://github.com/danez))
|
||||
|
||||
#### :memo: Documentation
|
||||
* [#9370](https://github.com/babel/babel/pull/9370) add v7 downloads [skip ci]. ([@hzoo](https://github.com/hzoo))
|
||||
|
||||
#### :house: Internal
|
||||
* `babel-parser`
|
||||
* [#9312](https://github.com/babel/babel/pull/9312) Merge declaration and init of props in parser's state. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-types`
|
||||
* [#9245](https://github.com/babel/babel/pull/9245) [@babel/types] Moved generators related to babel-types into the babel-types package directory.. ([@cameron-martin](https://github.com/cameron-martin))
|
||||
* Other
|
||||
* [#9288](https://github.com/babel/babel/pull/9288) Test262 update. ([@existentialism](https://github.com/existentialism))
|
||||
* [#9290](https://github.com/babel/babel/pull/9290) Use 2014-present in license. ([@xtuc](https://github.com/xtuc))
|
||||
* [#9271](https://github.com/babel/babel/pull/9271) Bump license years for 2019. ([@berlamhenderson](https://github.com/berlamhenderson))
|
||||
* `babel-helpers`
|
||||
* [#9166](https://github.com/babel/babel/pull/9166) Add mixins support to the _decorate helper. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
## v7.2.5 (2018-12-21)
|
||||
|
||||
`@babel/polyfill` didn't get published correctly in v7.2.3 (#9227).
|
||||
|
||||
## v7.2.4 (2018-12-20)
|
||||
|
||||
Minify `@babel/standalone` and `@babel/preset-env-standalone`.
|
||||
|
||||
## v7.2.3 (2018-12-20)
|
||||
|
||||
This is a small release, mainly to test Lerna 3.
|
||||
We force-published `@babel/polyfill` and `@babel/preset-env`, since they should have been released respectively in v7.1.0 and v7.2.2 but for different reasons they didn't get updated.
|
||||
|
||||
Half of the commits in this release are made by first time contributors! Thanks to @cameron-martin, @cphamlet, @tanhauhau and @jedwards1211. :tada:
|
||||
|
||||
#### :rocket: New Feature
|
||||
* [#9110](https://github.com/babel/babel/pull/9110) Added type-level mapping between aliases and nodes that have that alias. ([@cameron-martin](https://github.com/cameron-martin))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-plugin-transform-flow-strip-types`
|
||||
* [#9197](https://github.com/babel/babel/pull/9197) Strips flow directive fully. ([@tanhauhau](https://github.com/tanhauhau))
|
||||
* `babel-parser`
|
||||
* [#9184](https://github.com/babel/babel/pull/9184) Allow keywords to be used in type annotations. ([@danez](https://github.com/danez))
|
||||
|
||||
#### :house: Internal
|
||||
* `babel-plugin-proposal-class-properties`, `babel-plugin-proposal-decorators`, `babel-plugin-proposal-private-methods`, `babel-traverse`
|
||||
* [#9206](https://github.com/babel/babel/pull/9206) Use @babel/eslint-plugin-developement. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
## v7.2.2 (2018-12-15)
|
||||
|
||||
Mostly bug fixes and internal changes.
|
||||
Thanks to @paleite, @saschanaz and @joeldenning for their first PRs!
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-plugin-transform-destructuring`, `babel-plugin-transform-spread`
|
||||
* [#9108](https://github.com/babel/babel/pull/9108) Correctly transform spreads to use proper concat method. ([@danez](https://github.com/danez))
|
||||
* `babel-parser`
|
||||
* [#9168](https://github.com/babel/babel/pull/9168) [parser] Handle flow comments with leading spaces. ([@vikr01](https://github.com/vikr01))
|
||||
* `babel-helper-module-transforms`, `babel-plugin-transform-modules-commonjs`
|
||||
* [#9171](https://github.com/babel/babel/pull/9171) Fix transforming empty export statement. ([@danez](https://github.com/danez))
|
||||
* `babel-node`
|
||||
* [#9148](https://github.com/babel/babel/pull/9148) Fix --root-mode option in babel-node. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-plugin-transform-classes`
|
||||
* [#9135](https://github.com/babel/babel/pull/9135) Inherit properties in function from method in loose mode. ([@rubennorte](https://github.com/rubennorte))
|
||||
* `babel-preset-env`
|
||||
* [#9140](https://github.com/babel/babel/pull/9140) Disable parameter-destructuring in Edge 18. ([@saschanaz](https://github.com/saschanaz))
|
||||
* `babel-plugin-transform-arrow-functions`, `babel-traverse`
|
||||
* [#9060](https://github.com/babel/babel/pull/9060) Not depending on return value of super(). Closes [#9020](https://github.com/babel/babel/issues/9020).. ([@joeldenning](https://github.com/joeldenning))
|
||||
|
||||
#### :house: Internal
|
||||
* `babel-helper-create-class-features-plugin`, `babel-plugin-proposal-nullish-coalescing-operator`, `babel-plugin-syntax-bigint`, `babel-plugin-transform-dotall-regex`
|
||||
* [#9176](https://github.com/babel/babel/pull/9176) Fix package.json repository URLs. ([@paleite](https://github.com/paleite))
|
||||
* Other
|
||||
* [#9158](https://github.com/babel/babel/pull/9158) add triage label to new issues [skip ci]. ([@danez](https://github.com/danez))
|
||||
* [#9143](https://github.com/babel/babel/pull/9143) Fix a typo from the issue template for bugs. ([@saschanaz](https://github.com/saschanaz))
|
||||
* [#9133](https://github.com/babel/babel/pull/9133) Move to travis vm based builds. ([@danez](https://github.com/danez))
|
||||
* [#9132](https://github.com/babel/babel/pull/9132) Ensure we always use repository versions of babel dependencies in tests. ([@danez](https://github.com/danez))
|
||||
* [#9131](https://github.com/babel/babel/pull/9131) Update issue templates [skip ci]. ([@hzoo](https://github.com/hzoo))
|
||||
* `babel-helper-create-class-features-plugin`, `babel-plugin-proposal-class-properties`, `babel-plugin-proposal-decorators`
|
||||
* [#9059](https://github.com/babel/babel/pull/9059) Move decorators transform to @babel/helper-create-class-features-plugin. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
* `babel-core`, `babel-parser`, `babel-template`
|
||||
* [#9128](https://github.com/babel/babel/pull/9128) Fix running flow on travis and update flow. ([@danez](https://github.com/danez))
|
||||
|
||||
## v7.2.1 (2018-12-04)
|
||||
|
||||
This release fixes a regression introduced in v7.2.0 (https://github.com/babel/babel/issues/9120)
|
||||
@@ -111,7 +779,7 @@ You can read more about this release at https://babeljs.io/blog/2018/12/03/7.2.0
|
||||
|
||||
## v7.1.5 (2018-11-06)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-parser`, `babylon`
|
||||
* [#7727](https://github.com/babel/babel/pull/7727) Fix await in function name and parameters. ([@nicolo-ribaudo](https://github.com/nicolo-ribaudo))
|
||||
|
||||
@@ -324,7 +992,7 @@ No change from rc.4. Finally released as https://babeljs.io/blog/2018/08/27/7.0.
|
||||
|
||||
## v7.0.0-rc.2 (2018-08-21)
|
||||
|
||||
A notable change is the addition of https://github.com/babel/babel/pull/8485 which enables https://github.com/babel/babel-loader/pull/660 (automatically doing `modules: false` for `@babel/preset-env` when using `babel-loader`.
|
||||
A notable change is the addition of https://github.com/babel/babel/pull/8485 which enables https://github.com/babel/babel-loader/pull/660 (automatically doing `modules: false` for `@babel/preset-env` when using `babel-loader`.
|
||||
|
||||
#### :boom: Breaking Change
|
||||
* `babel-core`
|
||||
@@ -479,7 +1147,7 @@ Breaking Change in beta:
|
||||
## v7.0.0-beta.53 (2018-07-11)
|
||||
|
||||
- Fix for regression with paths on windows due to micromatch upgrade, remove yearly presets (not published)
|
||||
- (There was an issue with the Stage presets in this release, but it is also deprecated)
|
||||
- (There was an issue with the Stage presets in this release, but it is also deprecated)
|
||||
|
||||
#### :boom: Breaking Change
|
||||
* `babel-*`
|
||||
@@ -574,7 +1242,7 @@ Fixed a peerDep issue
|
||||
|
||||
Mostly bug fixes and some decorator updates
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-plugin-proposal-unicode-property-regex`
|
||||
* [#8127](https://github.com/babel/babel/pull/8127) Update plugin-proposal-unicode-property-regex for Unicode v11. ([@mathiasbynens](https://github.com/mathiasbynens))
|
||||
* `babel-parser`
|
||||
@@ -674,7 +1342,7 @@ Mostly bugfix release for a regression in decorators, and a quick fix for some n
|
||||
- Fix IE10 class regression
|
||||
- Various fixes, many TS fixes
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-parser`, `babel-plugin-proposal-json-strings`, `babel-plugin-syntax-json-strings`, `babel-preset-stage-3`
|
||||
* [#7985](https://github.com/babel/babel/pull/7985) Subsume json. ([@jridgewell](https://github.com/jridgewell))
|
||||
|
||||
@@ -864,7 +1532,7 @@ Mostly bugfix release for a regression in decorators, and a quick fix for some n
|
||||
* `babel-generator`, `babel-helper-define-map`, `babel-plugin-syntax-class-properties`, `babel-plugin-transform-parameters`, `babel-plugin-transform-react-constant-elements`, `babel-traverse`, `babel-types`
|
||||
* [#7666](https://github.com/babel/babel/pull/7666) Private Properties phase 1. ([@jridgewell](https://github.com/jridgewell))
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-helper-simple-access`, `babel-plugin-transform-modules-commonjs`, `babel-plugin-transform-modules-systemjs`
|
||||
* [#7766](https://github.com/babel/babel/pull/7766) Correct update expression Number coercion. ([@jridgewell](https://github.com/jridgewell))
|
||||
* `babel-core`, `babel-generator`, `babel-plugin-proposal-decorators`, `babel-types`, `babylon`
|
||||
@@ -952,7 +1620,7 @@ Mostly bugfix release for a regression in decorators, and a quick fix for some n
|
||||
|
||||
Various fixes, also lazy-load `@babel/core` dependencies (should make config lookup and other API methods fast for other projects to use).
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-plugin-proposal-logical-assignment-operators`
|
||||
* [#7604](https://github.com/babel/babel/pull/7604) Logical Assignment: ensure computed key isn't recomputed. ([@jridgewell](https://github.com/jridgewell))
|
||||
|
||||
@@ -1051,7 +1719,7 @@ We'll need to update tooling for this ^. Also published `gulp-babel@8.0.0-beta.2
|
||||
* `babel-register`
|
||||
* [#7416](https://github.com/babel/babel/pull/7416) Replace instead of merging babel-register options, and resolve cwd up front. ([@loganfsmyth](https://github.com/loganfsmyth))
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babylon`
|
||||
* [#7503](https://github.com/babel/babel/pull/7503) Update test262 test script and a few keyword escape fixes. ([@existentialism](https://github.com/existentialism))
|
||||
* [#7498](https://github.com/babel/babel/pull/7498) Disallow setters to have RestElement. ([@danez](https://github.com/danez))
|
||||
@@ -1199,7 +1867,7 @@ We'll need to update tooling for this ^. Also published `gulp-babel@8.0.0-beta.2
|
||||
|
||||
## v7.0.0-beta.39 (2018-01-30)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-plugin-proposal-optional-chaining`
|
||||
* [#6345](https://github.com/babel/babel/pull/6345) Remove old optional chain features. ([@jridgewell](https://github.com/jridgewell))
|
||||
|
||||
@@ -1412,7 +2080,7 @@ Fixes + [overrides](https://github.com/babel/babel/pull/7091) config feature
|
||||
|
||||
Various bug fixes, first version of Babel to use the MIT version of `regenerator`
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babylon`
|
||||
* [#6986](https://github.com/babel/babel/pull/6986) Fix destructuring assignment spec violation. ([@ksashikumar](https://github.com/ksashikumar))
|
||||
* `babel-helper-replace-supers`, `babel-helpers`, `babel-plugin-proposal-class-properties`, `babel-plugin-transform-classes`, `babel-plugin-transform-parameters`
|
||||
@@ -1465,7 +2133,7 @@ Various bug fixes, first version of Babel to use the MIT version of `regenerator
|
||||
* `babel-preset-stage-1`, `babel-preset-stage-2`
|
||||
* [#6949](https://github.com/babel/babel/pull/6949) Fix stage refs to exportNamespaceFrom and exportDefaultFrom. ([@existentialism](https://github.com/existentialism))
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-preset-stage-0`, `babel-preset-stage-1`
|
||||
* [#6943](https://github.com/babel/babel/pull/6943) Moving Do expression to stage 1. ([@rajzshkr](https://github.com/rajzshkr))
|
||||
|
||||
@@ -1479,7 +2147,7 @@ Various bug fixes, first version of Babel to use the MIT version of `regenerator
|
||||
|
||||
## v7.0.0-beta.33 (2017-12-01)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-generator`, `babel-plugin-proposal-export-default-from`, `babel-plugin-proposal-export-default`, `babel-plugin-proposal-export-namespace-from`, `babel-plugin-proposal-export-namespace`, `babel-plugin-syntax-export-default-from`, `babel-plugin-syntax-export-extensions`, `babel-plugin-syntax-export-namespace-from`, `babel-standalone`, `babylon`
|
||||
* [#6920](https://github.com/babel/babel/pull/6920) Split exportExtensions into exportDefault and exportNamespace plugins…. ([@existentialism](https://github.com/existentialism))
|
||||
* `babylon`
|
||||
@@ -1664,7 +2332,7 @@ Various bug fixes, first version of Babel to use the MIT version of `regenerator
|
||||
|
||||
> Note: don't use ^ in your dependencies when using a beta. It can still break between (we should try not to do it but it can), so pin all the packages like `"@babel/cli" : "7.0.0-beta.4"`
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-plugin-transform-optional-chaining`
|
||||
* [#6525](https://github.com/babel/babel/pull/6525) Optional Chaining: Account for document.all. ([@azz](https://github.com/azz))
|
||||
* `babel-preset-env`, `babel-helper-remap-async-to-generator`, `babel-helpers`, `babel-plugin-transform-async-generator-functions`, `babel-plugin-transform-async-to-generator`, `babel-plugin-transform-function-sent`
|
||||
@@ -1944,7 +2612,7 @@ let {...{}} = {}; let {...[]} = {};
|
||||
- Add `--config-file` CLI flag to explicitly pass a config location
|
||||
- Move `babel-standalone` into the repo (another form of this used to be `babel-browser`)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-plugin-transform-async-to-generator`, `babel-*`
|
||||
* [#6094](https://github.com/babel/babel/pull/6094) Spec compatibility for iteratorClose condition.. ([@yavorsky](https://github.com/yavorsky))
|
||||
* `babel-helpers`, `babel-plugin-transform-es2015-computed-properties`
|
||||
@@ -2080,7 +2748,7 @@ Initial release of typescript equivalent of how Babel handles flow with a new `b
|
||||
|
||||
## v7.0.0-alpha.18 (2017-08-03)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-generator`, `babel-plugin-transform-flow-comments`, `babel-plugin-transform-flow-strip-types`, `babel-types`
|
||||
* [#5990](https://github.com/babel/babel/pull/5990) Flow opaque type aliases. ([@jbrown215](https://github.com/jbrown215))
|
||||
* `babel-preset-stage-3`
|
||||
@@ -2129,11 +2797,11 @@ Initial release of typescript equivalent of how Babel handles flow with a new `b
|
||||
- Optional catch binding `try {} catch {}`: `babel-plugin-transform-optional-catch-binding`
|
||||
- es2015-parameters `loose` mode that doesn't use `arguments`
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-plugin-check-es2015-constants`
|
||||
* [#5930](https://github.com/babel/babel/pull/5930) Spec compliancy of check-es2015-constants plugin. ([@maurobringolf](https://github.com/maurobringolf))
|
||||
* [#5930](https://github.com/babel/babel/pull/5930) Spec compliance of check-es2015-constants plugin. ([@maurobringolf](https://github.com/maurobringolf))
|
||||
|
||||
> Instead of throwing a compile time error when const is violated, Babel should insert a throw statement before the violation.
|
||||
> Instead of throwing a compile time error when const is violated, Babel should insert a throw statement before the violation.
|
||||
|
||||
#### :boom: Breaking Change
|
||||
* `babel-plugin-transform-flow-comments`
|
||||
@@ -2436,7 +3104,7 @@ var A = function A() {
|
||||
|
||||
## v7.0.0-alpha.12 (2017-05-31)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-core`, `babel-generator`, `babel-plugin-syntax-numeric-separator`, `babel-plugin-transform-numeric-separator`, `babel-preset-stage-1`, `babel-template`, `babel-traverse`, `babel-types`
|
||||
* [#5793](https://github.com/babel/babel/pull/5793) Support for NumericLiteralSeparator, Stage 1 feature. ([@rwaldron](https://github.com/rwaldron))
|
||||
|
||||
@@ -2477,7 +3145,7 @@ var A = function A() {
|
||||
|
||||
Update Babylon: https://github.com/babel/babylon/releases/tag/v7.0.0-beta.9, https://github.com/babel/babylon/releases/tag/v7.0.0-beta.10
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-generator`, `babel-plugin-transform-flow-strip-types`, `babel-types`
|
||||
* [#5525](https://github.com/babel/babel/pull/5525) Add support for object type spread. ([@conartist6](https://github.com/conartist6))
|
||||
|
||||
@@ -2551,7 +3219,7 @@ Update Babylon: https://github.com/babel/babylon/releases/tag/v7.0.0-beta.9, htt
|
||||
|
||||
## v7.0.0-alpha.8 (2017-04-17)
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
#### :eyeglasses: Spec Compliance
|
||||
* `babel-preset-stage-2`, `babel-preset-stage-3`
|
||||
* [#5610](https://github.com/babel/babel/pull/5610) Move syntax-dynamic-import to stage-3. ([@dkaoster](https://github.com/dkaoster))
|
||||
|
||||
|
||||
@@ -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/)
|
||||
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)
|
||||
- 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
|
||||
|
||||
|
||||
72
Gulpfile.js
72
Gulpfile.js
@@ -6,19 +6,17 @@ const chalk = require("chalk");
|
||||
const newer = require("gulp-newer");
|
||||
const babel = require("gulp-babel");
|
||||
const gulpWatch = require("gulp-watch");
|
||||
const gutil = require("gulp-util");
|
||||
const fancyLog = require("fancy-log");
|
||||
const filter = require("gulp-filter");
|
||||
const gulp = require("gulp");
|
||||
const path = require("path");
|
||||
const webpack = require("webpack");
|
||||
const merge = require("merge-stream");
|
||||
const rollup = require("rollup-stream");
|
||||
const source = require("vinyl-source-stream");
|
||||
const buffer = require("vinyl-buffer");
|
||||
const rollup = require("rollup");
|
||||
const rollupBabel = require("rollup-plugin-babel");
|
||||
const rollupNodeResolve = require("rollup-plugin-node-resolve");
|
||||
const registerStandalonePackageTask = require("./scripts/gulp-tasks")
|
||||
.registerStandalonePackageTask;
|
||||
const rollupReplace = require("rollup-plugin-replace");
|
||||
const { registerStandalonePackageTask } = require("./scripts/gulp-tasks");
|
||||
|
||||
const sources = ["codemods", "packages"];
|
||||
|
||||
@@ -36,13 +34,9 @@ function getIndexFromPackage(name) {
|
||||
return `${name}/src/index.js`;
|
||||
}
|
||||
|
||||
function compilationLogger(rollup) {
|
||||
function compilationLogger() {
|
||||
return through.obj(function(file, enc, callback) {
|
||||
gutil.log(
|
||||
`Compiling '${chalk.cyan(file.relative)}'${
|
||||
rollup ? " with rollup " : ""
|
||||
}...`
|
||||
);
|
||||
fancyLog(`Compiling '${chalk.cyan(file.relative)}'...`);
|
||||
callback(null, file);
|
||||
});
|
||||
}
|
||||
@@ -50,7 +44,7 @@ function compilationLogger(rollup) {
|
||||
function errorsLogger() {
|
||||
return plumber({
|
||||
errorHandler(err) {
|
||||
gutil.log(err.stack);
|
||||
fancyLog(err.stack);
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -91,32 +85,40 @@ function buildBabel(exclude) {
|
||||
}
|
||||
|
||||
function buildRollup(packages) {
|
||||
return merge(
|
||||
return Promise.all(
|
||||
packages.map(pkg => {
|
||||
return rollup({
|
||||
input: getIndexFromPackage(pkg),
|
||||
format: "cjs",
|
||||
plugins: [
|
||||
rollupBabel({
|
||||
envName: "babel-parser",
|
||||
}),
|
||||
rollupNodeResolve(),
|
||||
],
|
||||
})
|
||||
.pipe(source("index.js"))
|
||||
.pipe(buffer())
|
||||
.pipe(errorsLogger())
|
||||
.pipe(compilationLogger(/* rollup */ true))
|
||||
.pipe(gulp.dest(path.join(pkg, "lib")));
|
||||
const input = getIndexFromPackage(pkg);
|
||||
fancyLog(`Compiling '${chalk.cyan(input)}' with rollup ...`);
|
||||
return rollup
|
||||
.rollup({
|
||||
input,
|
||||
plugins: [
|
||||
rollupReplace({
|
||||
"process.env.NODE_ENV": JSON.stringify(process.env.NODE_ENV),
|
||||
}),
|
||||
rollupBabel({
|
||||
envName: "babel-parser",
|
||||
}),
|
||||
rollupNodeResolve(),
|
||||
],
|
||||
})
|
||||
.then(bundle => {
|
||||
return bundle.write({
|
||||
file: path.join(pkg, "lib/index.js"),
|
||||
format: "cjs",
|
||||
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", gulp.parallel("build-rollup", "build-babel"));
|
||||
|
||||
gulp.task("default", gulp.series("build"));
|
||||
|
||||
@@ -138,7 +140,7 @@ registerStandalonePackageTask(
|
||||
"babel",
|
||||
"Babel",
|
||||
path.join(__dirname, "packages"),
|
||||
require("./packages/babel-core/package.json").version
|
||||
require("./packages/babel-standalone/package.json").version
|
||||
);
|
||||
|
||||
const presetEnvWebpackPlugins = [
|
||||
@@ -167,6 +169,6 @@ registerStandalonePackageTask(
|
||||
"babel-preset-env",
|
||||
"babelPresetEnv",
|
||||
path.join(__dirname, "packages"),
|
||||
require("./packages/babel-preset-env/package.json").version,
|
||||
require("./packages/babel-preset-env-standalone/package.json").version,
|
||||
presetEnvWebpackPlugins
|
||||
);
|
||||
|
||||
41
Makefile
41
Makefile
@@ -1,6 +1,6 @@
|
||||
MAKEFLAGS = -j1
|
||||
FLOW_COMMIT = 2ac56861e3ceff9ca406ae586fbafb3480c6c0b7
|
||||
TEST262_COMMIT = 4f1155c566a222238fd86f179c6635ecb4c289bb
|
||||
FLOW_COMMIT = 09669846b7a7ca5a6c23c12d56bb3bebdafd67e9
|
||||
TEST262_COMMIT = ef7fd2bc27e7c10b4a71d2edc632a2934742a13e
|
||||
|
||||
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
|
||||
export FORCE_COLOR = true
|
||||
@@ -11,6 +11,7 @@ SOURCES = packages codemods
|
||||
|
||||
build: clean clean-lib
|
||||
./node_modules/.bin/gulp build
|
||||
node ./packages/babel-standalone/scripts/generate.js
|
||||
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
|
||||
@@ -53,9 +54,14 @@ watch: clean clean-lib
|
||||
flow:
|
||||
./node_modules/.bin/flow check --strip-root
|
||||
|
||||
lint:
|
||||
lint: lint-js lint-ts
|
||||
|
||||
lint-js:
|
||||
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe
|
||||
|
||||
lint-ts:
|
||||
./scripts/tests/typescript/lint.sh
|
||||
|
||||
fix: fix-json
|
||||
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' --format=codeframe --fix
|
||||
|
||||
@@ -63,6 +69,7 @@ fix-json:
|
||||
./node_modules/.bin/prettier "{packages,codemod}/*/test/fixtures/**/options.json" --write --loglevel warn
|
||||
|
||||
clean: test-clean
|
||||
rm -f .npmrc
|
||||
rm -rf packages/babel-polyfill/browser*
|
||||
rm -rf packages/babel-polyfill/dist
|
||||
rm -rf coverage
|
||||
@@ -103,7 +110,7 @@ test-flow-update-whitelist:
|
||||
bootstrap-test262:
|
||||
rm -rf ./build/test262
|
||||
mkdir -p ./build
|
||||
git clone --branch=master --single-branch --shallow-since=2010-01-10 https://github.com/tc39/test262.git ./build/test262
|
||||
git clone --branch=master --single-branch --shallow-since=2019-01-01 https://github.com/tc39/test262.git ./build/test262
|
||||
cd build/test262 && git checkout $(TEST262_COMMIT)
|
||||
|
||||
test-test262:
|
||||
@@ -122,21 +129,39 @@ prepublish-build:
|
||||
rm -rf packages/babel-runtime/helpers
|
||||
rm -rf packages/babel-runtime-corejs2/helpers
|
||||
rm -rf packages/babel-runtime-corejs2/core-js
|
||||
BABEL_ENV=production make build-dist
|
||||
NODE_ENV=production BABEL_ENV=production make build-dist
|
||||
make clone-license
|
||||
|
||||
prepublish:
|
||||
git pull --rebase
|
||||
make bootstrap-only
|
||||
make prepublish-build
|
||||
make test
|
||||
|
||||
new-version:
|
||||
git pull --rebase
|
||||
./node_modules/.bin/lerna version --force-publish="@babel/runtime,@babel/runtime-corejs2,@babel/runtime-corejs3,@babel/standalone,@babel/preset-env-standalone"
|
||||
|
||||
# NOTE: Run make new-version first
|
||||
publish: prepublish
|
||||
./node_modules/.bin/lerna publish --force-publish="@babel/runtime,@babel/runtime-corejs2,@babel/standalone,@babel/preset-env-standalone" --require-scripts
|
||||
./node_modules/.bin/lerna publish from-git --require-scripts
|
||||
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
|
||||
./node_modules/.bin/lerna publish from-git --require-scripts --yes
|
||||
rm -f .npmrc
|
||||
make clean
|
||||
|
||||
bootstrap-only: clean-all
|
||||
yarn --ignore-engines
|
||||
./node_modules/.bin/lerna bootstrap -- --ignore-engines
|
||||
|
||||
bootstrap: bootstrap-only
|
||||
make build
|
||||
cd packages/babel-plugin-transform-runtime; \
|
||||
node scripts/build-dist.js
|
||||
|
||||
36
README.md
36
README.md
@@ -31,11 +31,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:
|
||||
|
||||
- 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/1/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/1/avatar.svg"></a>
|
||||
@@ -53,15 +53,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/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>
|
||||
|
||||
## 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)]
|
||||
|
||||
## Bronze
|
||||
|
||||
<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>
|
||||
<a href="https://issuehunt.io" target="_blank"><img src="https://github.com/BoostIO/issuehunt-materials/blob/master/v1/issuehunt-logo-and-word-v1.png?raw=true" height="64"></a>
|
||||
|
||||
## Intro
|
||||
|
||||
Babel is a tool that helps you write code in the latest version of JavaScript. When your supported environments don't support certain features natively, Babel will help you compile those features down to a supported version.
|
||||
@@ -89,14 +80,14 @@ Try it out at our [REPL](https://babeljs.io/repl/build/master#?code_lz=NoRgNATGD
|
||||
|
||||
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 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?
|
||||
|
||||
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?
|
||||
|
||||
Check out our website: [babeljs.io](https://babeljs.io/), and report issues/features at [babel/website](https://github.com/babel/website/issues).
|
||||
@@ -107,12 +98,19 @@ Please read through our [CONTRIBUTING.md](CONTRIBUTING.md) and fill out the issu
|
||||
|
||||
### 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!
|
||||
- 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.
|
||||
- Our [#development](https://babeljs.slack.com/messages/development) Slack channel and say hi ([signup](https://slack.babeljs.io))!
|
||||
- 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 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?
|
||||
|
||||
|
||||
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
|
||||
And it’s a terse and a destructured Hallelujah
|
||||
|
||||
Hallelujah etc.
|
||||
Hallelujah, Hallelujah
|
||||
Hallelujah, Hallelujah
|
||||
|
||||
Well my faith was strong but I needed proof
|
||||
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
|
||||
And it’s a more-or-less compliant Hallelujah
|
||||
|
||||
Hallelujah etc.
|
||||
|
||||
Hallelujah, Hallelujah
|
||||
Hallelujah, Hallelujah
|
||||
|
||||
Now you say the build step’s too complex
|
||||
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 threnody for a bygone Hallelujah
|
||||
|
||||
Hallelujah etc.
|
||||
|
||||
Hallelujah, Hallelujah
|
||||
Hallelujah, Hallelujah
|
||||
|
||||
Yes I learned about the danger signs
|
||||
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
|
||||
And it’s a slow and unresponsive Hallelujah
|
||||
|
||||
Hallelujah etc.
|
||||
|
||||
Hallelujah, Hallelujah
|
||||
Hallelujah, Hallelujah
|
||||
|
||||
There was a time when they let me know
|
||||
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 labyrinthine search for Hallelujah
|
||||
|
||||
Hallelujah etc.
|
||||
|
||||
Hallelujah, Hallelujah
|
||||
Hallelujah, Hallelujah
|
||||
|
||||
Well, maybe there’s a god up there
|
||||
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
|
||||
It’s a cold and it’s a broken Hallelujah
|
||||
|
||||
Hallelujah etc.
|
||||
|
||||
Hallelujah, Hallelujah
|
||||
Hallelujah, Hallelujah
|
||||
|
||||
[Angus Croll](https://github.com/angus-c)
|
||||
|
||||
@@ -5,11 +5,12 @@ module.exports = function(api) {
|
||||
|
||||
const includeCoverage = process.env.BABEL_COVERAGE === "true";
|
||||
|
||||
const envOpts = {
|
||||
const envOptsNoTargets = {
|
||||
loose: true,
|
||||
modules: false,
|
||||
exclude: ["transform-typeof-symbol"],
|
||||
};
|
||||
const envOpts = Object.assign({}, envOptsNoTargets);
|
||||
|
||||
let convertESM = true;
|
||||
let ignoreLib = true;
|
||||
@@ -97,6 +98,11 @@ module.exports = function(api) {
|
||||
convertESM ? "@babel/transform-modules-commonjs" : null,
|
||||
].filter(Boolean),
|
||||
},
|
||||
{
|
||||
test: "./packages/babel-polyfill",
|
||||
presets: [["@babel/env", envOptsNoTargets]],
|
||||
plugins: [["@babel/transform-modules-commonjs", { lazy: false }]],
|
||||
},
|
||||
{
|
||||
// The vast majority of our src files are modules, but we use
|
||||
// unambiguous to keep things simple until we get around to renaming
|
||||
@@ -115,9 +121,11 @@ module.exports = function(api) {
|
||||
"packages/babel-runtime",
|
||||
/[\\/]node_modules[\\/](?:@babel\/runtime|babel-runtime|core-js)[\\/]/,
|
||||
],
|
||||
plugins: [includeRuntime ? "@babel/transform-runtime" : null].filter(
|
||||
Boolean
|
||||
),
|
||||
plugins: [
|
||||
includeRuntime
|
||||
? ["@babel/transform-runtime", { version: "7.4.4" }]
|
||||
: null,
|
||||
].filter(Boolean),
|
||||
},
|
||||
].filter(Boolean),
|
||||
};
|
||||
|
||||
@@ -8,3 +8,5 @@ coverage:
|
||||
target: "80%"
|
||||
patch:
|
||||
enabled: false
|
||||
ignore:
|
||||
- packages/babel-types/src/*/generated/index.js
|
||||
|
||||
@@ -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\""
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
const noDeprecatedClone = require("./scripts/eslint_rules/no-deprecated-clone");
|
||||
const noUndefinedIdentifier = require("./scripts/eslint_rules/no-undefined-identifier");
|
||||
const pluginName = require("./scripts/eslint_rules/plugin-name");
|
||||
|
||||
module.exports = {
|
||||
"no-deprecated-clone": noDeprecatedClone,
|
||||
"no-undefined-identifier": noUndefinedIdentifier,
|
||||
"plugin-name": pluginName,
|
||||
};
|
||||
@@ -1,16 +1,17 @@
|
||||
{
|
||||
"version": "7.3.1",
|
||||
"version": "7.6.2",
|
||||
"changelog": {
|
||||
"repo": "babel/babel",
|
||||
"cacheDir": ".changelog",
|
||||
"labels": {
|
||||
"PR: Spec Compliancy :eyeglasses:": ":eyeglasses: Spec Compliancy",
|
||||
"PR: Spec Compliance :eyeglasses:": ":eyeglasses: Spec Compliance",
|
||||
"PR: Breaking Change :boom:": ":boom: Breaking Change",
|
||||
"PR: New Feature :rocket:": ":rocket: New Feature",
|
||||
"PR: Bug Fix :bug:": ":bug: Bug Fix",
|
||||
"PR: Polish :nail_care:": ":nail_care: Polish",
|
||||
"PR: Docs :memo:": ":memo: Documentation",
|
||||
"PR: Internal :house:": ":house: Internal"
|
||||
"PR: Internal :house:": ":house: Internal",
|
||||
"PR: Performance :running_woman:": ":running_woman: Performance"
|
||||
}
|
||||
},
|
||||
"command": {
|
||||
@@ -21,7 +22,7 @@
|
||||
"test/**",
|
||||
"codemods/**",
|
||||
"# 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)).json"
|
||||
"@(!(built-in-modules|built-ins|plugins|package)).json"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
@@ -27,16 +27,31 @@ declare module "lodash/merge" {
|
||||
}
|
||||
|
||||
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: {
|
||||
valid(v: string): boolean;
|
||||
SemVer: SemVer;
|
||||
|
||||
coerce(version: string | SemVer): SemVer | null;
|
||||
gt(v1: string, v2: string): boolean;
|
||||
intersects(r1: string, r2: string): boolean;
|
||||
lt(v1: string, v2: string): boolean;
|
||||
major(v: string): number;
|
||||
minor(v: string): number;
|
||||
patch(v: string): number;
|
||||
satisfies(v1: string, r1: string): boolean;
|
||||
|
||||
intersects(r1: string, r2: string): boolean;
|
||||
valid(v: string): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,7 +165,7 @@ declare module "source-map" {
|
||||
}
|
||||
|
||||
declare module "convert-source-map" {
|
||||
import type { SourceMap } from "source-map";
|
||||
import type { SourceMap, SourceMapGenerator } from "source-map";
|
||||
|
||||
declare class Converter {
|
||||
toJSON(): string;
|
||||
@@ -162,11 +177,11 @@ declare module "convert-source-map" {
|
||||
declare module.exports: {
|
||||
SourceMap: SourceMap,
|
||||
Converter: Converter,
|
||||
fromObject(obj: SourceMap): Converter,
|
||||
fromObject(obj: SourceMap | SourceMapGenerator): Converter,
|
||||
fromJSON(str: string): Converter,
|
||||
fromBase64(str: string): Converter,
|
||||
fromComment(str: string): Converter,
|
||||
fromMapFileComment(str: string): Converter,
|
||||
fromMapFileComment(str: string, dir: string): Converter,
|
||||
fromSource(str: string): Converter,
|
||||
fromMapFileSource(str: string, dir: string): Converter,
|
||||
removeComments(str: string): string,
|
||||
@@ -180,3 +195,13 @@ declare module "js-levenshtein" {
|
||||
(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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
90
package.json
90
package.json
@@ -9,71 +9,73 @@
|
||||
"test": "make test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.2.0",
|
||||
"@babel/core": "^7.2.0",
|
||||
"@babel/cli": "^7.6.0",
|
||||
"@babel/core": "^7.6.0",
|
||||
"@babel/eslint-plugin-development": "^1.0.1",
|
||||
"@babel/plugin-proposal-class-properties": "^7.2.1",
|
||||
"@babel/plugin-proposal-export-namespace-from": "^7.2.0",
|
||||
"@babel/plugin-proposal-class-properties": "^7.5.5",
|
||||
"@babel/plugin-proposal-export-namespace-from": "^7.5.2",
|
||||
"@babel/plugin-proposal-numeric-separator": "^7.2.0",
|
||||
"@babel/plugin-transform-modules-commonjs": "^7.2.0",
|
||||
"@babel/plugin-transform-runtime": "^7.2.0",
|
||||
"@babel/preset-env": "^7.2.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/register": "^7.0.0",
|
||||
"@babel/runtime": "^7.2.0",
|
||||
"babel-core": "^7.0.0-0",
|
||||
"babel-eslint": "^10.0.1",
|
||||
"babel-jest": "^23.6.0",
|
||||
"babel-loader": "^8.0.4",
|
||||
"babel-plugin-transform-charcodes": "^0.1.1",
|
||||
"browserify": "^16.2.2",
|
||||
"@babel/register": "^7.6.0",
|
||||
"@babel/runtime": "^7.6.0",
|
||||
"babel-eslint": "^11.0.0-beta.0",
|
||||
"babel-jest": "^24.8.0",
|
||||
"babel-loader": "^8.0.6",
|
||||
"babel-plugin-transform-charcodes": "^0.2.0",
|
||||
"browserify": "^16.2.3",
|
||||
"bundle-collapser": "^1.2.1",
|
||||
"chalk": "^2.3.2",
|
||||
"charcodes": "^0.1.1",
|
||||
"chalk": "^2.4.2",
|
||||
"charcodes": "^0.2.0",
|
||||
"derequire": "^2.0.2",
|
||||
"duplicate-package-checker-webpack-plugin": "^2.1.0",
|
||||
"enhanced-resolve": "^3.0.0",
|
||||
"eslint": "^5.9.0",
|
||||
"eslint-config-babel": "^8.0.2",
|
||||
"eslint-plugin-flowtype": "^3.2.0",
|
||||
"eslint-plugin-prettier": "^3.0.0",
|
||||
"flow-bin": "^0.87.0",
|
||||
"graceful-fs": "^4.1.11",
|
||||
"gulp": "^4.0.0",
|
||||
"eslint": "^6.0.1",
|
||||
"eslint-config-babel": "^9.0.0",
|
||||
"eslint-plugin-flowtype": "^3.8.2",
|
||||
"eslint-plugin-import": "^2.17.2",
|
||||
"eslint-plugin-prettier": "^3.1.0",
|
||||
"fancy-log": "^1.3.3",
|
||||
"flow-bin": "^0.102.0",
|
||||
"graceful-fs": "^4.1.15",
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-babel": "^8.0.0",
|
||||
"gulp-filter": "^5.1.0",
|
||||
"gulp-newer": "^1.0.0",
|
||||
"gulp-plumber": "^1.2.0",
|
||||
"gulp-plumber": "^1.2.1",
|
||||
"gulp-rename": "^1.4.0",
|
||||
"gulp-uglify": "^3.0.1",
|
||||
"gulp-util": "^3.0.7",
|
||||
"gulp-uglify": "^3.0.2",
|
||||
"gulp-watch": "^5.0.1",
|
||||
"husky": "^1.2.0",
|
||||
"jest": "^23.6.0",
|
||||
"lerna": "^3.6.0",
|
||||
"husky": "^3.0.0",
|
||||
"jest": "^24.8.0",
|
||||
"lerna": "^3.16.0",
|
||||
"lerna-changelog": "^0.5.0",
|
||||
"lint-staged": "^8.1.0",
|
||||
"lodash": "^4.17.10",
|
||||
"lint-staged": "^9.2.0",
|
||||
"lodash": "^4.17.13",
|
||||
"merge-stream": "^1.0.1",
|
||||
"output-file-sync": "^2.0.0",
|
||||
"prettier": "^1.15.2",
|
||||
"prettier": "^1.17.1",
|
||||
"pump": "^3.0.0",
|
||||
"rimraf": "^2.4.3",
|
||||
"rollup-plugin-babel": "^4.0.0-beta.0",
|
||||
"rollup-plugin-node-resolve": "^3.0.2",
|
||||
"rollup-stream": "^1.24.1",
|
||||
"test262-stream": "^1.2.0",
|
||||
"rimraf": "^2.6.3",
|
||||
"rollup": "^1.12.0",
|
||||
"rollup-plugin-babel": "^4.0.0",
|
||||
"rollup-plugin-node-resolve": "^5.0.0",
|
||||
"rollup-plugin-replace": "^2.2.0",
|
||||
"test262-stream": "^1.3.0",
|
||||
"through2": "^2.0.0",
|
||||
"vinyl-buffer": "^1.0.1",
|
||||
"vinyl-source-stream": "^2.0.0",
|
||||
"typescript": "^3.6.3",
|
||||
"warnings-to-errors-webpack-plugin": "^2.0.0",
|
||||
"webpack": "^3.4.1",
|
||||
"webpack-dependency-suite": "^2.4.4",
|
||||
"webpack-stream": "^4.0.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"@lerna/**/@lerna/collect-updates": "https://github.com/nicolo-ribaudo/lerna.git#babel-collect-updates"
|
||||
"@lerna/**/@lerna/collect-updates": "https://github.com/babel/lerna.git#babel-collect-updates"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6.9.0 < 12.0.0",
|
||||
"node": ">= 6.9.0 < 13.0.0",
|
||||
"npm": ">= 3.x <= 6.x",
|
||||
"yarn": ">=0.27.5 || >=1.0.0-20170811"
|
||||
},
|
||||
@@ -108,7 +110,9 @@
|
||||
"_browser\\.js"
|
||||
],
|
||||
"testEnvironment": "node",
|
||||
"setupTestFrameworkScriptFile": "<rootDir>/test/testSetupFile.js",
|
||||
"setupFilesAfterEnv": [
|
||||
"<rootDir>/test/testSetupFile.js"
|
||||
],
|
||||
"transformIgnorePatterns": [
|
||||
"/node_modules/",
|
||||
"<rootDir>/packages/babel-standalone/babel(\\.min)?\\.js",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/cli",
|
||||
"version": "7.2.3",
|
||||
"version": "7.6.2",
|
||||
"description": "Babel command line.",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -23,21 +23,21 @@
|
||||
"convert-source-map": "^1.1.0",
|
||||
"fs-readdir-recursive": "^1.1.0",
|
||||
"glob": "^7.0.0",
|
||||
"lodash": "^4.17.10",
|
||||
"lodash": "^4.17.13",
|
||||
"mkdirp": "^0.5.1",
|
||||
"output-file-sync": "^2.0.0",
|
||||
"slash": "^2.0.0",
|
||||
"source-map": "^0.5.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"chokidar": "^2.0.3"
|
||||
"chokidar": "^2.1.8"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "^7.0.0-0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.2.0",
|
||||
"@babel/helper-fixtures": "^7.2.0"
|
||||
"@babel/core": "^7.6.2",
|
||||
"@babel/helper-fixtures": "^7.6.2"
|
||||
},
|
||||
"bin": {
|
||||
"babel": "./bin/babel.js",
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
// @flow
|
||||
|
||||
import commander from "commander";
|
||||
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 (typeof value !== "string") return previousValue;
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @flow
|
||||
|
||||
import defaults from "lodash/defaults";
|
||||
import outputFileSync from "output-file-sync";
|
||||
import { sync as mkdirpSync } from "mkdirp";
|
||||
@@ -6,11 +8,15 @@ import path from "path";
|
||||
import fs from "fs";
|
||||
|
||||
import * as util from "./util";
|
||||
import { type CmdOptions } from "./options";
|
||||
|
||||
export default async function({ cliOptions, babelOptions }) {
|
||||
export default async function({
|
||||
cliOptions,
|
||||
babelOptions,
|
||||
}: CmdOptions): Promise<void> {
|
||||
const filenames = cliOptions.filenames;
|
||||
|
||||
async function write(src, base) {
|
||||
async function write(src: string, base: string): Promise<boolean> {
|
||||
let relative = path.relative(base, src);
|
||||
|
||||
if (!util.isCompilableExtension(relative, cliOptions.extensions)) {
|
||||
@@ -65,14 +71,14 @@ export default async function({ cliOptions, babelOptions }) {
|
||||
}
|
||||
}
|
||||
|
||||
function getDest(filename, base) {
|
||||
function getDest(filename: string, base: string): string {
|
||||
if (cliOptions.relative) {
|
||||
return path.join(base, 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);
|
||||
|
||||
if (!written && cliOptions.copyFiles) {
|
||||
@@ -84,7 +90,7 @@ export default async function({ cliOptions, babelOptions }) {
|
||||
return written;
|
||||
}
|
||||
|
||||
async function handle(filenameOrDir) {
|
||||
async function handle(filenameOrDir: string): Promise<number> {
|
||||
if (!fs.existsSync(filenameOrDir)) return 0;
|
||||
|
||||
const stat = fs.statSync(filenameOrDir);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @flow
|
||||
|
||||
import convertSourceMap from "convert-source-map";
|
||||
import defaults from "lodash/defaults";
|
||||
import sourceMap from "source-map";
|
||||
@@ -6,9 +8,18 @@ import path from "path";
|
||||
import fs from "fs";
|
||||
|
||||
import * as util from "./util";
|
||||
import { type CmdOptions } from "./options";
|
||||
|
||||
export default async function({ cliOptions, babelOptions }) {
|
||||
function buildResult(fileResults) {
|
||||
type CompilationOutput = {
|
||||
code: string,
|
||||
map: Object,
|
||||
};
|
||||
|
||||
export default async function({
|
||||
cliOptions,
|
||||
babelOptions,
|
||||
}: CmdOptions): Promise<void> {
|
||||
function buildResult(fileResults: Array<Object>): CompilationOutput {
|
||||
const map = new sourceMap.SourceMapGenerator({
|
||||
file:
|
||||
cliOptions.sourceMapTarget ||
|
||||
@@ -74,7 +85,7 @@ export default async function({ cliOptions, babelOptions }) {
|
||||
};
|
||||
}
|
||||
|
||||
function output(fileResults) {
|
||||
function output(fileResults: Array<string>): void {
|
||||
const result = buildResult(fileResults);
|
||||
|
||||
if (cliOptions.outFile) {
|
||||
@@ -91,14 +102,15 @@ export default async function({ cliOptions, babelOptions }) {
|
||||
}
|
||||
}
|
||||
|
||||
function readStdin() {
|
||||
return new Promise((resolve, reject) => {
|
||||
function readStdin(): Promise<string> {
|
||||
return new Promise((resolve: Function, reject: Function): void => {
|
||||
let code = "";
|
||||
|
||||
process.stdin.setEncoding("utf8");
|
||||
|
||||
process.stdin.on("readable", function() {
|
||||
const chunk = process.stdin.read();
|
||||
// $FlowIgnore
|
||||
if (chunk !== null) code += chunk;
|
||||
});
|
||||
|
||||
@@ -109,7 +121,7 @@ export default async function({ cliOptions, babelOptions }) {
|
||||
});
|
||||
}
|
||||
|
||||
async function stdin() {
|
||||
async function stdin(): Promise<void> {
|
||||
const code = await readStdin();
|
||||
|
||||
const res = await util.transform(
|
||||
@@ -126,7 +138,7 @@ export default async function({ cliOptions, babelOptions }) {
|
||||
output([res]);
|
||||
}
|
||||
|
||||
async function walk(filenames) {
|
||||
async function walk(filenames: Array<string>): Promise<void> {
|
||||
const _filenames = [];
|
||||
|
||||
filenames.forEach(function(filename) {
|
||||
@@ -151,7 +163,7 @@ export default async function({ cliOptions, babelOptions }) {
|
||||
});
|
||||
|
||||
const results = await Promise.all(
|
||||
_filenames.map(async function(filename) {
|
||||
_filenames.map(async function(filename: string): Promise<Object> {
|
||||
let sourceFilename = filename;
|
||||
if (cliOptions.outFile) {
|
||||
sourceFilename = path.relative(
|
||||
@@ -168,7 +180,7 @@ export default async function({ cliOptions, babelOptions }) {
|
||||
{
|
||||
sourceFileName: sourceFilename,
|
||||
// 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.
|
||||
sourceMaps:
|
||||
babelOptions.sourceMaps === "inline"
|
||||
@@ -192,7 +204,7 @@ export default async function({ cliOptions, babelOptions }) {
|
||||
output(results);
|
||||
}
|
||||
|
||||
async function files(filenames) {
|
||||
async function files(filenames: Array<string>): Promise<void> {
|
||||
if (!cliOptions.skipInitialBuild) {
|
||||
await walk(filenames);
|
||||
}
|
||||
@@ -208,7 +220,7 @@ export default async function({ cliOptions, babelOptions }) {
|
||||
pollInterval: 10,
|
||||
},
|
||||
})
|
||||
.on("all", function(type, filename) {
|
||||
.on("all", function(type: string, filename: string) {
|
||||
if (!util.isCompilableExtension(filename, cliOptions.extensions)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -6,8 +6,12 @@ import fileCommand from "./file";
|
||||
|
||||
const opts = parseArgv(process.argv);
|
||||
|
||||
const fn = opts.cliOptions.outDir ? dirCommand : fileCommand;
|
||||
fn(opts).catch(err => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
if (opts) {
|
||||
const fn = opts.cliOptions.outDir ? dirCommand : fileCommand;
|
||||
fn(opts).catch(err => {
|
||||
console.error(err);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
} else {
|
||||
process.exitCode = 2;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
// @flow
|
||||
|
||||
import fs from "fs";
|
||||
|
||||
import commander from "commander";
|
||||
@@ -151,7 +153,12 @@ commander.option(
|
||||
commander.version(pkg.version + " (@babel/core " + version + ")");
|
||||
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);
|
||||
|
||||
@@ -216,7 +223,7 @@ export default function parseArgv(args: Array<string>) {
|
||||
errors.forEach(function(e) {
|
||||
console.error(" " + e);
|
||||
});
|
||||
process.exit(2);
|
||||
return null;
|
||||
}
|
||||
|
||||
const opts = commander.opts();
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
// @flow
|
||||
|
||||
import readdirRecursive from "fs-readdir-recursive";
|
||||
import * as babel from "@babel/core";
|
||||
import includes from "lodash/includes";
|
||||
import path from "path";
|
||||
import fs from "fs";
|
||||
|
||||
export function chmod(src, dest) {
|
||||
export function chmod(src: string, dest: string): void {
|
||||
fs.chmodSync(dest, fs.statSync(src).mode);
|
||||
}
|
||||
|
||||
@@ -13,8 +15,8 @@ type ReaddirFilter = (filename: string) => boolean;
|
||||
export function readdir(
|
||||
dirname: string,
|
||||
includeDotfiles: boolean,
|
||||
filter: ReaddirFilter,
|
||||
) {
|
||||
filter?: ReaddirFilter,
|
||||
): Array<string> {
|
||||
return readdirRecursive(dirname, (filename, _index, currentDirectory) => {
|
||||
const stat = fs.statSync(path.join(currentDirectory, filename));
|
||||
|
||||
@@ -30,7 +32,7 @@ export function readdirForCompilable(
|
||||
dirname: string,
|
||||
includeDotfiles: boolean,
|
||||
altExts?: Array<string>,
|
||||
) {
|
||||
): Array<string> {
|
||||
return readdir(dirname, includeDotfiles, function(filename) {
|
||||
return isCompilableExtension(filename, altExts);
|
||||
});
|
||||
@@ -48,7 +50,7 @@ export function isCompilableExtension(
|
||||
return includes(exts, ext);
|
||||
}
|
||||
|
||||
export function addSourceMappingUrl(code, loc) {
|
||||
export function addSourceMappingUrl(code: string, loc: string): string {
|
||||
return code + "\n//# sourceMappingURL=" + path.basename(loc);
|
||||
}
|
||||
|
||||
@@ -56,7 +58,11 @@ const CALLER = {
|
||||
name: "@babel/cli",
|
||||
};
|
||||
|
||||
export function transform(filename, code, opts) {
|
||||
export function transform(
|
||||
filename: string,
|
||||
code: string,
|
||||
opts: Object,
|
||||
): Promise<Object> {
|
||||
opts = {
|
||||
...opts,
|
||||
caller: CALLER,
|
||||
@@ -71,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,
|
||||
caller: CALLER,
|
||||
@@ -85,7 +94,7 @@ export function compile(filename, opts) {
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteDir(path) {
|
||||
export function deleteDir(path: string): void {
|
||||
if (fs.existsSync(path)) {
|
||||
fs.readdirSync(path).forEach(function(file) {
|
||||
const curPath = path + "/" + file;
|
||||
@@ -103,10 +112,10 @@ export function deleteDir(path) {
|
||||
|
||||
process.on("uncaughtException", function(err) {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
process.exitCode = 1;
|
||||
});
|
||||
|
||||
export function requireChokidar() {
|
||||
export function requireChokidar(): Object {
|
||||
try {
|
||||
return require("chokidar");
|
||||
} catch (err) {
|
||||
@@ -118,7 +127,10 @@ export function requireChokidar() {
|
||||
}
|
||||
}
|
||||
|
||||
export function adjustRelative(relative, keepFileExtension) {
|
||||
export function adjustRelative(
|
||||
relative: string,
|
||||
keepFileExtension: boolean,
|
||||
): string {
|
||||
if (keepFileExtension) {
|
||||
return relative;
|
||||
}
|
||||
|
||||
@@ -86,13 +86,13 @@ const assertTest = function(stdout, stderr, opts, cwd) {
|
||||
}
|
||||
|
||||
if (opts.outFiles) {
|
||||
const actualFiles = readDir(path.join(tmpLoc), fileFilter);
|
||||
const actualFiles = readDir(tmpLoc, fileFilter);
|
||||
|
||||
Object.keys(actualFiles).forEach(function(filename) {
|
||||
if (
|
||||
// saveInFiles always creates an empty .babelrc, so lets exclude for now
|
||||
filename !== ".babelrc" &&
|
||||
!opts.inFiles.hasOwnProperty(filename)
|
||||
!Object.prototype.hasOwnProperty.call(opts.inFiles, filename)
|
||||
) {
|
||||
const expected = opts.outFiles[filename];
|
||||
const actual = actualFiles[filename];
|
||||
@@ -171,12 +171,12 @@ const buildTest = function(binName, testName, opts) {
|
||||
};
|
||||
|
||||
fs.readdirSync(fixtureLoc).forEach(function(binName) {
|
||||
if (binName[0] === ".") return;
|
||||
if (binName.startsWith(".")) return;
|
||||
|
||||
const suiteLoc = path.join(fixtureLoc, binName);
|
||||
describe("bin/" + binName, function() {
|
||||
fs.readdirSync(suiteLoc).forEach(function(testName) {
|
||||
if (testName[0] === ".") return;
|
||||
if (testName.startsWith(".")) return;
|
||||
|
||||
const testLoc = path.join(suiteLoc, testName);
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"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.",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
|
||||
@@ -76,7 +76,7 @@ function getMarkerLines(
|
||||
} else if (i === 0) {
|
||||
const sourceLength = source[lineNumber - 1].length;
|
||||
|
||||
markerLines[lineNumber] = [startColumn, sourceLength - startColumn];
|
||||
markerLines[lineNumber] = [startColumn, sourceLength - startColumn + 1];
|
||||
} else if (i === lineDiff) {
|
||||
markerLines[lineNumber] = [0, endColumn];
|
||||
} else {
|
||||
@@ -112,15 +112,16 @@ export function codeFrameColumns(
|
||||
const maybeHighlight = (chalkFn, string) => {
|
||||
return highlighted ? chalkFn(string) : string;
|
||||
};
|
||||
if (highlighted) rawLines = highlight(rawLines, opts);
|
||||
|
||||
const lines = rawLines.split(NEWLINE);
|
||||
const { start, end, markerLines } = getMarkerLines(loc, lines, opts);
|
||||
const hasColumns = loc.start && typeof loc.start.column === "number";
|
||||
|
||||
const numberMaxWidth = String(end).length;
|
||||
|
||||
let frame = lines
|
||||
const highlightedLines = highlighted ? highlight(rawLines, opts) : rawLines;
|
||||
|
||||
let frame = highlightedLines
|
||||
.split(NEWLINE)
|
||||
.slice(start, end)
|
||||
.map((line, 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() {
|
||||
const rawLines = [
|
||||
"/**",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/core",
|
||||
"version": "7.2.2",
|
||||
"version": "7.6.2",
|
||||
"description": "Babel compiler core.",
|
||||
"main": "lib/index.js",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
@@ -33,23 +33,22 @@
|
||||
"./lib/transform-file.js": "./lib/transform-file-browser.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@babel/code-frame": "^7.0.0",
|
||||
"@babel/generator": "^7.2.2",
|
||||
"@babel/helpers": "^7.2.0",
|
||||
"@babel/parser": "^7.2.2",
|
||||
"@babel/template": "^7.2.2",
|
||||
"@babel/traverse": "^7.2.2",
|
||||
"@babel/types": "^7.2.2",
|
||||
"@babel/code-frame": "^7.5.5",
|
||||
"@babel/generator": "^7.6.2",
|
||||
"@babel/helpers": "^7.6.2",
|
||||
"@babel/parser": "^7.6.2",
|
||||
"@babel/template": "^7.6.0",
|
||||
"@babel/traverse": "^7.6.2",
|
||||
"@babel/types": "^7.6.0",
|
||||
"convert-source-map": "^1.1.0",
|
||||
"debug": "^4.1.0",
|
||||
"json5": "^2.1.0",
|
||||
"lodash": "^4.17.10",
|
||||
"lodash": "^4.17.13",
|
||||
"resolve": "^1.3.2",
|
||||
"semver": "^5.4.1",
|
||||
"source-map": "^0.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/helper-transform-fixture-test-runner": "^7.0.0",
|
||||
"@babel/register": "^7.0.0"
|
||||
"@babel/helper-transform-fixture-test-runner": "^7.6.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,6 @@ export function makeWeakCache<
|
||||
>(
|
||||
handler: (ArgT, CacheConfigurator<SideChannel>) => ResultT,
|
||||
): (ArgT, SideChannel) => ResultT {
|
||||
// $FlowIssue https://github.com/facebook/flow/issues/4528
|
||||
return makeCachedFunction(new WeakMap(), handler);
|
||||
}
|
||||
|
||||
|
||||
@@ -268,13 +268,11 @@ function babelrcLoadEnabled(
|
||||
});
|
||||
}
|
||||
|
||||
const validateConfigFile = makeWeakCache(
|
||||
(file: ConfigFile): ValidatedFile => ({
|
||||
filepath: file.filepath,
|
||||
dirname: file.dirname,
|
||||
options: validate("configfile", file.options),
|
||||
}),
|
||||
);
|
||||
const validateConfigFile = makeWeakCache((file: ConfigFile): ValidatedFile => ({
|
||||
filepath: file.filepath,
|
||||
dirname: file.dirname,
|
||||
options: validate("configfile", file.options),
|
||||
}));
|
||||
|
||||
const validateBabelrcFile = makeWeakCache(
|
||||
(file: ConfigFile): ValidatedFile => ({
|
||||
@@ -284,13 +282,11 @@ const validateBabelrcFile = makeWeakCache(
|
||||
}),
|
||||
);
|
||||
|
||||
const validateExtendFile = makeWeakCache(
|
||||
(file: ConfigFile): ValidatedFile => ({
|
||||
filepath: file.filepath,
|
||||
dirname: file.dirname,
|
||||
options: validate("extendsfile", file.options),
|
||||
}),
|
||||
);
|
||||
const validateExtendFile = makeWeakCache((file: ConfigFile): ValidatedFile => ({
|
||||
filepath: file.filepath,
|
||||
dirname: file.dirname,
|
||||
options: validate("extendsfile", file.options),
|
||||
}));
|
||||
|
||||
/**
|
||||
* Build a config chain for just the programmatic options passed into Babel.
|
||||
@@ -549,7 +545,7 @@ function normalizeOptions(opts: ValidatedOptions): ValidatedOptions {
|
||||
|
||||
// "sourceMap" is just aliased to sourceMap, so copy it over as
|
||||
// we merge the options together.
|
||||
if (options.hasOwnProperty("sourceMap")) {
|
||||
if (Object.prototype.hasOwnProperty.call(options, "sourceMap")) {
|
||||
options.sourceMaps = options.sourceMap;
|
||||
delete options.sourceMap;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
makeWeakCache,
|
||||
type CacheConfigurator,
|
||||
} from "../caching";
|
||||
import makeAPI from "../helpers/config-api";
|
||||
import makeAPI, { type PluginAPI } from "../helpers/config-api";
|
||||
import { makeStaticFileCache } from "./utils";
|
||||
import pathPatternToRegex from "../pattern-to-regex";
|
||||
import type { FilePackageData, RelativeConfig, ConfigFile } from "./types";
|
||||
@@ -114,7 +114,7 @@ export function findRootConfig(
|
||||
|
||||
const conf = readConfig(filepath, envName, caller);
|
||||
if (conf) {
|
||||
debug("Found root config %o in $o.", BABEL_CONFIG_JS_FILENAME, dirname);
|
||||
debug("Found root config %o in %o.", BABEL_CONFIG_JS_FILENAME, dirname);
|
||||
}
|
||||
return conf;
|
||||
}
|
||||
@@ -132,7 +132,7 @@ export function loadConfig(
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ const LOADING_CONFIGS = new Set();
|
||||
|
||||
const readConfigJS = makeStrongCache(
|
||||
(
|
||||
filepath,
|
||||
filepath: string,
|
||||
cache: CacheConfigurator<{
|
||||
envName: string,
|
||||
caller: CallerMetadata | void,
|
||||
@@ -193,7 +193,7 @@ const readConfigJS = makeStrongCache(
|
||||
}
|
||||
|
||||
if (typeof options === "function") {
|
||||
options = options(makeAPI(cache));
|
||||
options = ((options: any): (api: PluginAPI) => {})(makeAPI(cache));
|
||||
|
||||
if (!cache.configured()) throwConfigError();
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import { validatePluginObject } from "./validation/plugins";
|
||||
import makeAPI from "./helpers/config-api";
|
||||
|
||||
import loadPrivatePartialConfig from "./partial";
|
||||
import type { ValidatedOptions } from "./validation/options";
|
||||
|
||||
type LoadedDescriptor = {
|
||||
value: {},
|
||||
@@ -202,7 +203,7 @@ const loadDescriptor = makeWeakCache(
|
||||
if (typeof item.then === "function") {
|
||||
throw new Error(
|
||||
`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, ` +
|
||||
`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.
|
||||
*/
|
||||
@@ -285,10 +322,9 @@ const loadPresetDescriptor = (
|
||||
descriptor: UnloadedDescriptor,
|
||||
context: ConfigContext,
|
||||
): ConfigChain | null => {
|
||||
return buildPresetChain(
|
||||
instantiatePreset(loadDescriptor(descriptor, context)),
|
||||
context,
|
||||
);
|
||||
const preset = instantiatePreset(loadDescriptor(descriptor, context));
|
||||
validatePreset(preset, context, descriptor);
|
||||
return buildPresetChain(preset, context);
|
||||
};
|
||||
|
||||
const instantiatePreset = makeWeakCache(
|
||||
|
||||
@@ -231,7 +231,7 @@ function assertIgnoreItem(loc: GeneralPath, value: mixed): IgnoreItem {
|
||||
throw new Error(
|
||||
`${msg(
|
||||
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;
|
||||
@@ -278,7 +278,7 @@ export function assertConfigFileSearch(
|
||||
) {
|
||||
throw new Error(
|
||||
`${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)) {
|
||||
throw new Error(
|
||||
`${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);
|
||||
@@ -337,7 +337,7 @@ function assertPluginItem(loc: GeneralPath, value: mixed): PluginItem {
|
||||
if (
|
||||
opts !== undefined &&
|
||||
opts !== false &&
|
||||
(typeof opts !== "object" || Array.isArray(opts))
|
||||
(typeof opts !== "object" || Array.isArray(opts) || opts === null)
|
||||
) {
|
||||
throw new Error(
|
||||
`${msg(access(loc, 1))} must be an object, false, or undefined`,
|
||||
|
||||
@@ -272,7 +272,8 @@ export type OptionsSource =
|
||||
| "configfile"
|
||||
| "babelrcfile"
|
||||
| "extendsfile"
|
||||
| "preset";
|
||||
| "preset"
|
||||
| "plugin";
|
||||
|
||||
type RootPath = $ReadOnly<{
|
||||
type: "root",
|
||||
|
||||
@@ -84,10 +84,19 @@ export type PluginObject = {
|
||||
};
|
||||
|
||||
export function validatePluginObject(obj: {}): PluginObject {
|
||||
const rootPath: RootPath = {
|
||||
type: "root",
|
||||
source: "plugin",
|
||||
};
|
||||
Object.keys(obj).forEach(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`);
|
||||
});
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ export default class File {
|
||||
// and this fails because a prerelease version can only satisfy a 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.
|
||||
if (semver.valid(versionRange)) versionRange = `^${versionRange}`;
|
||||
|
||||
@@ -203,6 +203,9 @@ export default class File {
|
||||
if (res) return res;
|
||||
}
|
||||
|
||||
// make sure that the helper exists
|
||||
helpers.ensure(name);
|
||||
|
||||
const uid = (this.declarations[name] = this.scope.generateUidIdentifier(
|
||||
name,
|
||||
));
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// @flow
|
||||
|
||||
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 type File from "./file";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @flow
|
||||
|
||||
import type { SourceMap } from "convert-source-map";
|
||||
import typeof { SourceMap } from "convert-source-map";
|
||||
import sourceMap from "source-map";
|
||||
|
||||
export default function mergeSourceMap(
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @flow
|
||||
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";
|
||||
|
||||
@@ -93,7 +93,7 @@ function transformFile(file: File, pluginPasses: PluginPasses): void {
|
||||
if (isThenable(result)) {
|
||||
throw new Error(
|
||||
`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 ` +
|
||||
`your @babel/core version.`,
|
||||
);
|
||||
@@ -117,7 +117,7 @@ function transformFile(file: File, pluginPasses: PluginPasses): void {
|
||||
if (isThenable(result)) {
|
||||
throw new Error(
|
||||
`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 ` +
|
||||
`your @babel/core version.`,
|
||||
);
|
||||
@@ -131,6 +131,7 @@ function isThenable(val: mixed): boolean {
|
||||
return (
|
||||
!!val &&
|
||||
(typeof val === "object" || typeof val === "function") &&
|
||||
!!val.then &&
|
||||
typeof val.then === "function"
|
||||
);
|
||||
}
|
||||
|
||||
@@ -27,49 +27,6 @@ export default function normalizeFile(
|
||||
): File {
|
||||
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.type === "Program") {
|
||||
ast = t.file(ast, [], []);
|
||||
@@ -84,6 +41,42 @@ export default function normalizeFile(
|
||||
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(
|
||||
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, {
|
||||
code,
|
||||
ast,
|
||||
@@ -156,3 +149,48 @@ function parser(
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -788,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();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1049,5 +1049,27 @@ describe("buildConfigChain", function() {
|
||||
loadOptions({ filename, cwd: path.dirname(filename) }),
|
||||
).toThrow(/Error while parsing JSON - /);
|
||||
});
|
||||
|
||||
it("should throw when `test` presents but `filename` is not passed", () => {
|
||||
expect(() => loadOptions({ test: /\.ts$/, plugins: [] })).toThrow(
|
||||
/Configuration contains string\/RegExp pattern/,
|
||||
);
|
||||
});
|
||||
|
||||
it("should throw when `preset` requires `filename` but it was not passed", () => {
|
||||
expect(() => {
|
||||
loadOptions({
|
||||
presets: [require("./fixtures/config-loading/preset4")],
|
||||
});
|
||||
}).toThrow(/Preset \/\* your preset \*\/ requires a filename/);
|
||||
});
|
||||
|
||||
it("should throw when `preset.overrides` requires `filename` but it was not passed", () => {
|
||||
expect(() => {
|
||||
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", () => {
|
||||
|
||||
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: []
|
||||
}]
|
||||
}
|
||||
};
|
||||
@@ -2,8 +2,8 @@ function foo() {
|
||||
var input = ['a', 'b', 'c'];
|
||||
var output = {};
|
||||
|
||||
for (var _i = 0; _i < input.length; _i++) {
|
||||
var c = input[_i];
|
||||
for (var _i = 0, _input = input; _i < _input.length; _i++) {
|
||||
var c = _input[_i];
|
||||
var name = c;
|
||||
output[name] = name;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
exports["default"] = void 0;
|
||||
|
||||
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
||||
|
||||
@@ -40,7 +40,7 @@ function () {
|
||||
return _context.stop();
|
||||
}
|
||||
}
|
||||
}, _callee, this);
|
||||
}, _callee);
|
||||
}));
|
||||
|
||||
function bar() {
|
||||
@@ -54,7 +54,7 @@ function () {
|
||||
return Foo;
|
||||
}();
|
||||
|
||||
exports.default = Foo;
|
||||
exports["default"] = Foo;
|
||||
|
||||
function foo() {
|
||||
return _foo.apply(this, arguments);
|
||||
@@ -86,7 +86,7 @@ function _foo() {
|
||||
return _context2.stop();
|
||||
}
|
||||
}
|
||||
}, _callee2, this);
|
||||
}, _callee2);
|
||||
}));
|
||||
return _bar2.apply(this, arguments);
|
||||
};
|
||||
@@ -100,7 +100,7 @@ function _foo() {
|
||||
return _context3.stop();
|
||||
}
|
||||
}
|
||||
}, _callee3, this);
|
||||
}, _callee3);
|
||||
}));
|
||||
return _foo.apply(this, arguments);
|
||||
}
|
||||
|
||||
8
packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/input.js
vendored
Normal file
8
packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/input.js
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
// https://github.com/babel/babel/issues/9790
|
||||
const comment = `//# sourceMappingURL=${path.basename(
|
||||
sourceMapFilename
|
||||
)}`
|
||||
|
||||
// https://github.com/babel/babel/issues/9956
|
||||
this.shadowRoot.innerHTML = `<style>div{display:block}
|
||||
/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmllbGQuaHRtbCIsInNvdXJjZXMiOlsiZmllbGQuaHRtbCJdLCJzb3VyY2VzQ29udGVudCI6WyI8c3ZlbHRlOm9wdGlvbnMgdGFnPVwiZGxzLWZpZWxkXCIgLz5cblxuPHN0eWxlPlxuICBkaXYgeyBkaXNwbGF5OiBibG9jazsgfVxuPC9zdHlsZT5cblxuPGRpdiBjbGFzcz1cImZpZWxkXCI+XG4gIDxkaXYgY2xhc3M9XCJfZmllbGRMYWJlbExheW91dFwiPlxuICAgIDxkaXYgY2xhc3M9XCJmaWVsZExhYmVsXCI+XG4gICAgICA8c2xvdCBuYW1lPVwiZmllbGQtbGFiZWxcIj48L3Nsb3Q+XG4gICAgPC9kaXY+XG4gICAgPGRpdiBjbGFzcz1cImZpZWxkT3B0aW9uYWxcIiBjbGFzczpvcHRpb25hbD5cbiAgICAgIE9wdGlvbmFsXG4gICAgPC9kaXY+XG4gIDwvZGl2PlxuICA8ZGl2IGNsYXNzPVwiZmllbGREZXRhaWxcIj5cbiAgICA8c2xvdCBuYW1lPVwiZmllbGQtZGV0YWlsXCI+PC9zbG90PlxuICA8L2Rpdj5cbiAgPGRpdiBjbGFzcz1cImZpZWxkQ29udHJvbFwiPlxuICAgIDxzbG90IG5hbWU9XCJmaWVsZC1jb250cm9sXCI+PC9zbG90PlxuICAgIDxzbG90Pjwvc2xvdD5cbiAgPC9kaXY+XG4gIDxkaXYgY2xhc3M9XCJmaWVsZE1lc3NhZ2VcIj5cbiAgICA8c2xvdCBuYW1lPVwiZmllbGQtbWVzc2FnZVwiPjwvc2xvdD5cbiAgPC9kaXY+XG48L2Rpdj5cblxuPHNjcmlwdD5cbiAgZXhwb3J0IGxldCB0aGVtZSA9ICcnO1xuICBleHBvcnQgbGV0IG9wdGlvbmFsID0gZmFsc2U7XG48L3NjcmlwdD5cbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFHRSxHQUFHLEFBQUMsQ0FBQyxBQUFDLE9BQU8sQ0FBRSxLQUFLLEFBQUUsQ0FBQyJ9 */</style>`;
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"inputSourceMap": true
|
||||
}
|
||||
5
packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/output.js
vendored
Normal file
5
packages/babel-core/test/fixtures/transformation/source-maps/comment-inside-string/output.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
// https://github.com/babel/babel/issues/9790
|
||||
const comment = `//# sourceMappingURL=${path.basename(sourceMapFilename)}`; // https://github.com/babel/babel/issues/9956
|
||||
|
||||
this.shadowRoot.innerHTML = `<style>div{display:block}
|
||||
/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZmllbGQuaHRtbCIsInNvdXJjZXMiOlsiZmllbGQuaHRtbCJdLCJzb3VyY2VzQ29udGVudCI6WyI8c3ZlbHRlOm9wdGlvbnMgdGFnPVwiZGxzLWZpZWxkXCIgLz5cblxuPHN0eWxlPlxuICBkaXYgeyBkaXNwbGF5OiBibG9jazsgfVxuPC9zdHlsZT5cblxuPGRpdiBjbGFzcz1cImZpZWxkXCI+XG4gIDxkaXYgY2xhc3M9XCJfZmllbGRMYWJlbExheW91dFwiPlxuICAgIDxkaXYgY2xhc3M9XCJmaWVsZExhYmVsXCI+XG4gICAgICA8c2xvdCBuYW1lPVwiZmllbGQtbGFiZWxcIj48L3Nsb3Q+XG4gICAgPC9kaXY+XG4gICAgPGRpdiBjbGFzcz1cImZpZWxkT3B0aW9uYWxcIiBjbGFzczpvcHRpb25hbD5cbiAgICAgIE9wdGlvbmFsXG4gICAgPC9kaXY+XG4gIDwvZGl2PlxuICA8ZGl2IGNsYXNzPVwiZmllbGREZXRhaWxcIj5cbiAgICA8c2xvdCBuYW1lPVwiZmllbGQtZGV0YWlsXCI+PC9zbG90PlxuICA8L2Rpdj5cbiAgPGRpdiBjbGFzcz1cImZpZWxkQ29udHJvbFwiPlxuICAgIDxzbG90IG5hbWU9XCJmaWVsZC1jb250cm9sXCI+PC9zbG90PlxuICAgIDxzbG90Pjwvc2xvdD5cbiAgPC9kaXY+XG4gIDxkaXYgY2xhc3M9XCJmaWVsZE1lc3NhZ2VcIj5cbiAgICA8c2xvdCBuYW1lPVwiZmllbGQtbWVzc2FnZVwiPjwvc2xvdD5cbiAgPC9kaXY+XG48L2Rpdj5cblxuPHNjcmlwdD5cbiAgZXhwb3J0IGxldCB0aGVtZSA9ICcnO1xuICBleHBvcnQgbGV0IG9wdGlvbmFsID0gZmFsc2U7XG48L3NjcmlwdD5cbiJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFHRSxHQUFHLEFBQUMsQ0FBQyxBQUFDLE9BQU8sQ0FBRSxLQUFLLEFBQUUsQ0FBQyJ9 */</style>`;
|
||||
@@ -38,6 +38,17 @@ describe("option-manager", () => {
|
||||
expect(calls).toEqual([]);
|
||||
});
|
||||
|
||||
it("throws for null options", () => {
|
||||
const { calls, plugin } = makePlugin();
|
||||
expect(() => {
|
||||
loadOptions({
|
||||
plugins: [[plugin, null]],
|
||||
}).toThrow(/.plugins[0][1] must be an object, false, or undefined/);
|
||||
});
|
||||
|
||||
expect(calls).toEqual([]);
|
||||
});
|
||||
|
||||
it("should not throw if a repeated plugin has a different name", () => {
|
||||
const { calls: calls1, plugin: plugin1 } = makePlugin();
|
||||
const { calls: calls2, plugin: plugin2 } = makePlugin();
|
||||
@@ -87,7 +98,6 @@ describe("option-manager", () => {
|
||||
expect(calls1).toEqual([{ arg: 1 }]);
|
||||
expect(calls2).toEqual([{ arg: 2 }]);
|
||||
});
|
||||
|
||||
it("should merge .env[] presets with parent presets", () => {
|
||||
const { calls: calls1, plugin: preset1 } = makePlugin();
|
||||
const { calls: calls2, plugin: preset2 } = makePlugin();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/generator",
|
||||
"version": "7.3.0",
|
||||
"version": "7.6.2",
|
||||
"description": "Turns an AST into code.",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -14,14 +14,13 @@
|
||||
"lib"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.3.0",
|
||||
"@babel/types": "^7.6.0",
|
||||
"jsesc": "^2.5.1",
|
||||
"lodash": "^4.17.10",
|
||||
"source-map": "^0.5.0",
|
||||
"trim-right": "^1.0.1"
|
||||
"lodash": "^4.17.13",
|
||||
"source-map": "^0.5.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/helper-fixtures": "^7.2.0",
|
||||
"@babel/parser": "^7.3.0"
|
||||
"@babel/helper-fixtures": "^7.6.2",
|
||||
"@babel/parser": "^7.6.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type SourceMap from "./source-map";
|
||||
import trimRight from "trim-right";
|
||||
|
||||
const SPACES_RE = /^[ \t]+$/;
|
||||
|
||||
@@ -43,7 +42,7 @@ export default class Buffer {
|
||||
const result = {
|
||||
// Whatever trim is used here should not execute a regex against the
|
||||
// source string since it may be arbitrarily large after all transformations
|
||||
code: trimRight(this._buf.join("")),
|
||||
code: this._buf.join("").trimRight(),
|
||||
map: null,
|
||||
rawMappings: map && map.getRawMappings(),
|
||||
};
|
||||
@@ -235,7 +234,7 @@ export default class Buffer {
|
||||
source(prop: string, loc: Location, force?: boolean): void {
|
||||
if (prop && !loc) return;
|
||||
|
||||
// Since this is called extremly often, we re-use the same _sourcePosition
|
||||
// Since this is called extremely often, we re-use the same _sourcePosition
|
||||
// object for the whole lifetime of the buffer.
|
||||
this._normalizePosition(prop, loc, this._sourcePosition, force);
|
||||
}
|
||||
|
||||
@@ -50,8 +50,45 @@ export function Directive(node: Object) {
|
||||
this.semicolon();
|
||||
}
|
||||
|
||||
// These regexes match an even number of \ followed by a quote
|
||||
const unescapedSingleQuoteRE = /(?:^|[^\\])(?:\\\\)*'/;
|
||||
const unescapedDoubleQuoteRE = /(?:^|[^\\])(?:\\\\)*"/;
|
||||
|
||||
export function DirectiveLiteral(node: Object) {
|
||||
const raw = this.getPossibleRaw(node);
|
||||
if (raw != null) {
|
||||
this.token(raw);
|
||||
return;
|
||||
}
|
||||
|
||||
const { value } = node;
|
||||
|
||||
// NOTE: In directives we can't change escapings,
|
||||
// because they change the behavior.
|
||||
// e.g. "us\x65 string" (\x65 is e) is not a "use strict" directive.
|
||||
|
||||
if (!unescapedDoubleQuoteRE.test(value)) {
|
||||
this.token(`"${value}"`);
|
||||
} else if (!unescapedSingleQuoteRE.test(value)) {
|
||||
this.token(`'${value}'`);
|
||||
} else {
|
||||
throw new Error(
|
||||
"Malformed AST: it is not possible to print a directive containing" +
|
||||
" both unescaped single and double quotes.",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export function InterpreterDirective(node: Object) {
|
||||
this.token(`#!${node.value}\n`);
|
||||
}
|
||||
|
||||
export { StringLiteral as DirectiveLiteral } from "./types";
|
||||
export function Placeholder(node: Object) {
|
||||
this.token("%%");
|
||||
this.print(node.name);
|
||||
this.token("%%");
|
||||
|
||||
if (node.expectedNode === "Statement") {
|
||||
this.semicolon();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,3 +264,8 @@ export function PrivateName(node: Object) {
|
||||
this.token("#");
|
||||
this.print(node.id, node);
|
||||
}
|
||||
|
||||
export function V8IntrinsicIdentifier(node: Object) {
|
||||
this.token("%");
|
||||
this.word(node.name);
|
||||
}
|
||||
|
||||
@@ -409,7 +409,7 @@ export function ObjectTypeAnnotation(node: Object) {
|
||||
indent: true,
|
||||
statement: true,
|
||||
iterator: () => {
|
||||
if (props.length !== 1) {
|
||||
if (props.length !== 1 || node.inexact) {
|
||||
this.token(",");
|
||||
this.space();
|
||||
}
|
||||
@@ -419,6 +419,15 @@ export function ObjectTypeAnnotation(node: Object) {
|
||||
this.space();
|
||||
}
|
||||
|
||||
if (node.inexact) {
|
||||
this.indent();
|
||||
this.token("...");
|
||||
if (props.length) {
|
||||
this.newline();
|
||||
}
|
||||
this.dedent();
|
||||
}
|
||||
|
||||
if (node.exact) {
|
||||
this.token("|}");
|
||||
} else {
|
||||
|
||||
@@ -7,6 +7,10 @@ export function Identifier(node: Object) {
|
||||
});
|
||||
}
|
||||
|
||||
export function ArgumentPlaceholder() {
|
||||
this.token("?");
|
||||
}
|
||||
|
||||
export function RestElement(node: Object) {
|
||||
this.token("...");
|
||||
this.print(node.argument, node);
|
||||
|
||||
@@ -67,12 +67,14 @@ export function TSQualifiedName(node) {
|
||||
|
||||
export function TSCallSignatureDeclaration(node) {
|
||||
this.tsPrintSignatureDeclarationBase(node);
|
||||
this.token(";");
|
||||
}
|
||||
|
||||
export function TSConstructSignatureDeclaration(node) {
|
||||
this.word("new");
|
||||
this.space();
|
||||
this.tsPrintSignatureDeclarationBase(node);
|
||||
this.token(";");
|
||||
}
|
||||
|
||||
export function TSPropertySignature(node) {
|
||||
@@ -127,6 +129,9 @@ export function TSIndexSignature(node) {
|
||||
export function TSAnyKeyword() {
|
||||
this.word("any");
|
||||
}
|
||||
export function TSBigIntKeyword() {
|
||||
this.word("bigint");
|
||||
}
|
||||
export function TSUnknownKeyword() {
|
||||
this.word("unknown");
|
||||
}
|
||||
@@ -231,7 +236,7 @@ export function tsPrintBraced(members, node) {
|
||||
}
|
||||
|
||||
export function TSArrayType(node) {
|
||||
this.print(node.elementType);
|
||||
this.print(node.elementType, node);
|
||||
this.token("[]");
|
||||
}
|
||||
|
||||
|
||||
@@ -97,5 +97,18 @@ export function needsParens(node, parent, printStack) {
|
||||
if (isOrHasCallExpression(node)) return true;
|
||||
}
|
||||
|
||||
/* this check is for NullishCoalescing being used with LogicalOperators like && and ||
|
||||
* For example when someone creates an ast programmaticaly like this
|
||||
* t.logicalExpression(
|
||||
* "??",
|
||||
* t.logicalExpression("||", t.identifier("a"), t.identifier("b")),
|
||||
* t.identifier("c"),
|
||||
* );
|
||||
* In the example above the AST is equivalent to writing a || b ?? c
|
||||
* This is incorrect because NullishCoalescing when used with LogicalExpressions should have parenthesis
|
||||
* The correct syntax is (a || b) ?? c, that is why we need parenthesis in this case
|
||||
*/
|
||||
if (t.isLogicalExpression(node) && parent.operator === "??") return true;
|
||||
|
||||
return find(expandedParens, node, parent, printStack);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,16 @@ export function NullableTypeAnnotation(node: Object, parent: Object): boolean {
|
||||
return t.isArrayTypeAnnotation(parent);
|
||||
}
|
||||
|
||||
export { NullableTypeAnnotation as FunctionTypeAnnotation };
|
||||
export function FunctionTypeAnnotation(node: Object, parent: Object): boolean {
|
||||
return (
|
||||
// (() => A) | (() => B)
|
||||
t.isUnionTypeAnnotation(parent) ||
|
||||
// (() => A) & (() => B)
|
||||
t.isIntersectionTypeAnnotation(parent) ||
|
||||
// (() => A)[]
|
||||
t.isArrayTypeAnnotation(parent)
|
||||
);
|
||||
}
|
||||
|
||||
export function UpdateExpression(node: Object, parent: Object): boolean {
|
||||
return (
|
||||
@@ -127,6 +136,18 @@ export function TSTypeAssertion() {
|
||||
return true;
|
||||
}
|
||||
|
||||
export function TSUnionType(node: Object, parent: Object): boolean {
|
||||
return (
|
||||
t.isTSArrayType(parent) ||
|
||||
t.isTSOptionalType(parent) ||
|
||||
t.isTSIntersectionType(parent) ||
|
||||
t.isTSUnionType(parent) ||
|
||||
t.isTSRestType(parent)
|
||||
);
|
||||
}
|
||||
|
||||
export { TSUnionType as TSIntersectionType };
|
||||
|
||||
export function BinaryExpression(node: Object, parent: Object): boolean {
|
||||
// let i = (1 in []);
|
||||
// for ((1 in []);;);
|
||||
|
||||
@@ -367,7 +367,7 @@ export default class Printer {
|
||||
|
||||
const loc = t.isProgram(node) || t.isFile(node) ? null : node.loc;
|
||||
this.withSource("start", loc, () => {
|
||||
this[node.type](node, parent);
|
||||
printMethod.call(this, node, parent);
|
||||
});
|
||||
|
||||
this._printTrailingComments(node);
|
||||
|
||||
12
packages/babel-generator/test/fixtures/comments/create-parenthesized-expressions/input.js
vendored
Normal file
12
packages/babel-generator/test/fixtures/comments/create-parenthesized-expressions/input.js
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
// One
|
||||
(1);
|
||||
|
||||
/* Two */
|
||||
(2);
|
||||
|
||||
(
|
||||
// Three
|
||||
3
|
||||
);
|
||||
|
||||
(/* Four */ 4);
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"parserOpts": { "createParenthesizedExpressions": true }
|
||||
}
|
||||
10
packages/babel-generator/test/fixtures/comments/create-parenthesized-expressions/output.js
vendored
Normal file
10
packages/babel-generator/test/fixtures/comments/create-parenthesized-expressions/output.js
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
// One
|
||||
(1);
|
||||
/* Two */
|
||||
|
||||
(2);
|
||||
( // Three
|
||||
3);
|
||||
(
|
||||
/* Four */
|
||||
4);
|
||||
@@ -4,7 +4,7 @@ function foo(l) {
|
||||
);
|
||||
}
|
||||
|
||||
function foo() {
|
||||
function foo2() {
|
||||
return (
|
||||
1 && 2
|
||||
) || 3;
|
||||
|
||||
@@ -4,7 +4,7 @@ function foo(l) {
|
||||
|
||||
}
|
||||
|
||||
function foo() {
|
||||
function foo2() {
|
||||
return (
|
||||
1 && 2 ||
|
||||
3);
|
||||
|
||||
@@ -2,8 +2,8 @@ var fn = async (
|
||||
arg
|
||||
) => {}
|
||||
|
||||
async (x)
|
||||
=> {}
|
||||
async (x) =>
|
||||
{}
|
||||
|
||||
async x => {}
|
||||
|
||||
|
||||
3
packages/babel-generator/test/fixtures/edgecase/unary-op/options.json
vendored
Normal file
3
packages/babel-generator/test/fixtures/edgecase/unary-op/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"strictMode": false
|
||||
}
|
||||
@@ -1 +1,2 @@
|
||||
0; // Not a directive
|
||||
"©";
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
0;// Not a directive
|
||||
"\u00A9";
|
||||
@@ -17,6 +17,7 @@ declare export * from 'asd';
|
||||
declare export { a, b };
|
||||
declare export {};
|
||||
declare export { c, d } from 'bar';
|
||||
var a, b;
|
||||
|
||||
declare module B {
|
||||
declare export type B = {};
|
||||
@@ -24,9 +25,9 @@ declare module B {
|
||||
}
|
||||
|
||||
declare module "foo" { declare export type * from "bar"; }
|
||||
declare export opaque type Foo;
|
||||
declare export opaque type Foo1;
|
||||
declare export opaque type Bar<T>;
|
||||
declare export opaque type Baz: Foo;
|
||||
declare export opaque type Foo<T>: Bar<T>;
|
||||
declare export opaque type Foo<T>: Bar;
|
||||
declare export opaque type Foo: Bar<T>;
|
||||
declare export opaque type Foo3<T>: Bar<T>;
|
||||
declare export opaque type Foo4<T>: Bar;
|
||||
declare export opaque type Foo5: Bar<T>;
|
||||
|
||||
@@ -26,6 +26,7 @@ declare export * from 'asd';
|
||||
declare export { a, b };
|
||||
declare export {};
|
||||
declare export { c, d } from 'bar';
|
||||
var a, b;
|
||||
declare module B {
|
||||
declare export type B = {};
|
||||
declare export interface Moon {}
|
||||
@@ -33,9 +34,9 @@ declare module B {
|
||||
declare module "foo" {
|
||||
declare export type * from "bar";
|
||||
}
|
||||
declare export opaque type Foo;
|
||||
declare export opaque type Foo1;
|
||||
declare export opaque type Bar<T>;
|
||||
declare export opaque type Baz: Foo;
|
||||
declare export opaque type Foo<T>: Bar<T>;
|
||||
declare export opaque type Foo<T>: Bar;
|
||||
declare export opaque type Foo: Bar<T>;
|
||||
declare export opaque type Foo3<T>: Bar<T>;
|
||||
declare export opaque type Foo4<T>: Bar;
|
||||
declare export opaque type Foo5: Bar<T>;
|
||||
@@ -1,10 +1,10 @@
|
||||
class C1<+T, -U> {}
|
||||
function f<+T, -U>() {}
|
||||
type T<+T, -U> = {};
|
||||
type T = { +p: T };
|
||||
type T = { -p: T };
|
||||
type T = { +[k:K]: V };
|
||||
type T = { -[k:K]: V };
|
||||
type T2 = { +p: T };
|
||||
type T3 = { -p: T };
|
||||
type T4 = { +[k:K]: V };
|
||||
type T5 = { -[k:K]: V };
|
||||
interface I { +p: T }
|
||||
interface I { -p: T }
|
||||
interface I { +[k:K]: V }
|
||||
|
||||
@@ -3,16 +3,16 @@ class C1<+T, -U> {}
|
||||
function f<+T, -U>() {}
|
||||
|
||||
type T<+T, -U> = {};
|
||||
type T = {
|
||||
type T2 = {
|
||||
+p: T
|
||||
};
|
||||
type T = {
|
||||
type T3 = {
|
||||
-p: T
|
||||
};
|
||||
type T = {
|
||||
type T4 = {
|
||||
+[k: K]: V
|
||||
};
|
||||
type T = {
|
||||
type T5 = {
|
||||
-[k: K]: V
|
||||
};
|
||||
interface I {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class A implements B {}
|
||||
class A implements B, C {}
|
||||
declare class A implements B {}
|
||||
declare class A mixins B implements C {}
|
||||
declare class A implements B, C {}
|
||||
class A1 implements B {}
|
||||
class A2 implements B, C {}
|
||||
declare class A3 implements B {}
|
||||
declare class A4 mixins B implements C {}
|
||||
declare class A5 implements B, C {}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class A implements B {}
|
||||
class A1 implements B {}
|
||||
|
||||
class A implements B, C {}
|
||||
class A2 implements B, C {}
|
||||
|
||||
declare class A implements B {}
|
||||
declare class A mixins B implements C {}
|
||||
declare class A implements B, C {}
|
||||
declare class A3 implements B {}
|
||||
declare class A4 mixins B implements C {}
|
||||
declare class A5 implements B, C {}
|
||||
@@ -1,3 +1,4 @@
|
||||
type A = interface { p: string };
|
||||
type B = interface extends X { p: string };
|
||||
type C = interface extends X, Y { p: string };
|
||||
type D = interface extends X.Y<Z> { p: string };
|
||||
|
||||
@@ -6,4 +6,7 @@ type B = interface extends X {
|
||||
};
|
||||
type C = interface extends X, Y {
|
||||
p: string
|
||||
};
|
||||
};
|
||||
type D = interface extends X.Y<Z> {
|
||||
p: string
|
||||
};
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
interface A {}
|
||||
interface A extends B {}
|
||||
interface A<T> extends B<T>, C<T> {}
|
||||
interface A { foo: () => number; }
|
||||
interface A1 {}
|
||||
interface A2 extends B {}
|
||||
interface A3<T> extends B<T>, C<T> {}
|
||||
interface A4 { foo: () => number; }
|
||||
interface Dictionary { [index: string]: string; length: number; }
|
||||
class Foo implements Bar {}
|
||||
class Foo extends Bar implements Bat, Man<number> {}
|
||||
class Foo extends class Bar implements Bat {} {}
|
||||
class Foo extends class Bar implements Bat {} implements Man {}
|
||||
class Foo1 implements Bar {}
|
||||
class Foo2 extends Bar implements Bat, Man<number> {}
|
||||
class Foo3 extends class Bar implements Bat {} {}
|
||||
class Foo4 extends class Bar implements Bat {} implements Man {}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
interface A {}
|
||||
interface A extends B {}
|
||||
interface A<T> extends B<T>, C<T> {}
|
||||
interface A {
|
||||
interface A1 {}
|
||||
interface A2 extends B {}
|
||||
interface A3<T> extends B<T>, C<T> {}
|
||||
interface A4 {
|
||||
foo: () => number
|
||||
}
|
||||
interface Dictionary {
|
||||
@@ -9,10 +9,10 @@ interface Dictionary {
|
||||
[index: string]: string,
|
||||
}
|
||||
|
||||
class Foo implements Bar {}
|
||||
class Foo1 implements Bar {}
|
||||
|
||||
class Foo extends Bar implements Bat, Man<number> {}
|
||||
class Foo2 extends Bar implements Bat, Man<number> {}
|
||||
|
||||
class Foo extends class Bar implements Bat {} {}
|
||||
class Foo3 extends class Bar implements Bat {} {}
|
||||
|
||||
class Foo extends class Bar implements Bat {} implements Man {}
|
||||
class Foo4 extends class Bar implements Bat {} implements Man {}
|
||||
@@ -1,7 +1,7 @@
|
||||
declare class C { static [[foo]]: T }
|
||||
declare class C { [[foo]]: T }
|
||||
interface T { [[foo]]: X }
|
||||
interface T { [[foo]](): X }
|
||||
type T = { [[foo]]: X }
|
||||
type T = { [[foo]](): X }
|
||||
type T = { [[foo]]?: X }
|
||||
interface I { [[foo]]: X }
|
||||
interface I { [[foo]](): X }
|
||||
type T1 = { [[foo]]: X }
|
||||
type T2 = { [[foo]](): X }
|
||||
type T3 = { [[foo]]?: X }
|
||||
|
||||
@@ -4,18 +4,18 @@ declare class C {
|
||||
declare class C {
|
||||
[[foo]]: T
|
||||
}
|
||||
interface T {
|
||||
interface I {
|
||||
[[foo]]: X
|
||||
}
|
||||
interface T {
|
||||
interface I {
|
||||
[[foo]]() => X
|
||||
}
|
||||
type T = {
|
||||
type T1 = {
|
||||
[[foo]]: X
|
||||
};
|
||||
type T = {
|
||||
type T2 = {
|
||||
[[foo]]() => X
|
||||
};
|
||||
type T = {
|
||||
type T3 = {
|
||||
[[foo]]?: X
|
||||
};
|
||||
};
|
||||
4
packages/babel-generator/test/fixtures/flow/object-literal-types-compact/input.js
vendored
Normal file
4
packages/babel-generator/test/fixtures/flow/object-literal-types-compact/input.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
type T1 = { ... };
|
||||
type T2 = { a: { b: { c: {...}, ... }, ... } }
|
||||
type T3 = { foo: number, ... };
|
||||
type T4 = { foo: number, bar: string, ... };
|
||||
3
packages/babel-generator/test/fixtures/flow/object-literal-types-compact/options.json
vendored
Normal file
3
packages/babel-generator/test/fixtures/flow/object-literal-types-compact/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"compact": true
|
||||
}
|
||||
1
packages/babel-generator/test/fixtures/flow/object-literal-types-compact/output.js
vendored
Normal file
1
packages/babel-generator/test/fixtures/flow/object-literal-types-compact/output.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
type T1={...};type T2={a:{b:{c:{...},...},...}};type T3={foo:number,...};type T4={foo:number,bar:string,...};
|
||||
@@ -1,11 +1,15 @@
|
||||
type U = {};
|
||||
type V = {};
|
||||
type T = { ...U, };
|
||||
type T = { ...U, ...V };
|
||||
type T = { p: V, ...U };
|
||||
type T = { ...U, p: V, };
|
||||
type T = { ...{}|{ p: V, }};
|
||||
type T = { foo(): number }
|
||||
type T = { foo: () => number }
|
||||
type T = { [string]: U };
|
||||
type T = { [param: string]: U };
|
||||
type T1 = { ...U, };
|
||||
type T2 = { ...U, ...V };
|
||||
type T3 = { p: V, ...U };
|
||||
type T4 = { ...U, p: V, };
|
||||
type T5 = { ...{}|{ p: V, }};
|
||||
type T6 = { foo(): number }
|
||||
type T7 = { foo: () => number }
|
||||
type T8 = { [string]: U };
|
||||
type T9 = { [param: string]: U };
|
||||
type T10 = { ... };
|
||||
type T11 = { a: { b: { c: {...}, ... }, ... } }
|
||||
type T12 = { foo: number, ... };
|
||||
type T13 = { foo: number, bar: string, ... };
|
||||
|
||||
@@ -1,30 +1,49 @@
|
||||
type U = {};
|
||||
type V = {};
|
||||
type T = { ...U
|
||||
type T1 = { ...U
|
||||
};
|
||||
type T = { ...U,
|
||||
type T2 = { ...U,
|
||||
...V,
|
||||
};
|
||||
type T = {
|
||||
type T3 = {
|
||||
p: V,
|
||||
...U,
|
||||
};
|
||||
type T = { ...U,
|
||||
type T4 = { ...U,
|
||||
p: V,
|
||||
};
|
||||
type T = { ...{} | {
|
||||
type T5 = { ...{} | {
|
||||
p: V
|
||||
}
|
||||
};
|
||||
type T = {
|
||||
type T6 = {
|
||||
foo(): number
|
||||
};
|
||||
type T = {
|
||||
type T7 = {
|
||||
foo: () => number
|
||||
};
|
||||
type T = {
|
||||
type T8 = {
|
||||
[string]: U
|
||||
};
|
||||
type T = {
|
||||
type T9 = {
|
||||
[param: string]: U
|
||||
};
|
||||
};
|
||||
type T10 = {...};
|
||||
type T11 = {
|
||||
a: {
|
||||
b: {
|
||||
c: {...},
|
||||
...
|
||||
},
|
||||
...
|
||||
}
|
||||
};
|
||||
type T12 = {
|
||||
foo: number,
|
||||
...
|
||||
};
|
||||
type T13 = {
|
||||
foo: number,
|
||||
bar: string,
|
||||
...
|
||||
};
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user