Compare commits
400 Commits
v7.0.0-alp
...
v7.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
23121d2bd3 | ||
|
|
5b9112c794 | ||
|
|
8597219ce5 | ||
|
|
5c824273bc | ||
|
|
8dffbf19d0 | ||
|
|
57584268cd | ||
|
|
174eaa058a | ||
|
|
4519f95a29 | ||
|
|
fc1e1c5668 | ||
|
|
bd734f03fb | ||
|
|
e98bb3dc60 | ||
|
|
24713e5040 | ||
|
|
51b0b06a25 | ||
|
|
3cdb7d7f0f | ||
|
|
f5ad86c5c6 | ||
|
|
c815cf554f | ||
|
|
745c4740af | ||
|
|
5fae81f43f | ||
|
|
efe5c7928a | ||
|
|
1c14fb1227 | ||
|
|
9a0dd4e001 | ||
|
|
583a875d22 | ||
|
|
5f5ad940ed | ||
|
|
f35cf8185b | ||
|
|
7f390b0282 | ||
|
|
bf93be47c2 | ||
|
|
3c93189fce | ||
|
|
b6ae55153c | ||
|
|
2801bfe35c | ||
|
|
637bba542a | ||
|
|
c65742602b | ||
|
|
18f77b3aa9 | ||
|
|
0ea295e83b | ||
|
|
634c750558 | ||
|
|
158e9fbfd7 | ||
|
|
0c5fae2faa | ||
|
|
7179136401 | ||
|
|
5bb6a83fa8 | ||
|
|
5006c81b77 | ||
|
|
1e750a945c | ||
|
|
f17d30692c | ||
|
|
95e08b6d2a | ||
|
|
47a254025a | ||
|
|
20679979fc | ||
|
|
1cdacf85ae | ||
|
|
1c13250807 | ||
|
|
8742012b5e | ||
|
|
4daf11528c | ||
|
|
c47258d68c | ||
|
|
c4f6a7a06f | ||
|
|
1341e4163b | ||
|
|
b6467a68ca | ||
|
|
5565e1b406 | ||
|
|
6560a29c36 | ||
|
|
4e612058c0 | ||
|
|
4e7961dcf8 | ||
|
|
777a9ae6e4 | ||
|
|
3a2b7fe3cd | ||
|
|
d6ba4d0a24 | ||
|
|
5df70e6a94 | ||
|
|
ca117e08cb | ||
|
|
2dd03e3ee9 | ||
|
|
4f441ff27e | ||
|
|
f7109658f9 | ||
|
|
f39811d271 | ||
|
|
fad9345c85 | ||
|
|
1797ac5015 | ||
|
|
76161e0a73 | ||
|
|
ab30fa54cb | ||
|
|
44f6ff5e85 | ||
|
|
6108bee4f9 | ||
|
|
0189b38702 | ||
|
|
b82b65a31e | ||
|
|
5e7fce3fe0 | ||
|
|
84580cc2d1 | ||
|
|
d70603ffa9 | ||
|
|
d79a7920a1 | ||
|
|
2846e06db1 | ||
|
|
beff7809ea | ||
|
|
0a4f1b0a6e | ||
|
|
75861fac87 | ||
|
|
b2b3d7944a | ||
|
|
827d84536a | ||
|
|
3e487f89ab | ||
|
|
40805894c5 | ||
|
|
95dd16aeeb | ||
|
|
ac6eda2709 | ||
|
|
960151c876 | ||
|
|
7795750862 | ||
|
|
2d8fdf3045 | ||
|
|
a70cda812c | ||
|
|
4b297907d1 | ||
|
|
48c114169f | ||
|
|
68786c4f0f | ||
|
|
1ef5871300 | ||
|
|
c3e8715010 | ||
|
|
d8b4073536 | ||
|
|
3c4f19a28d | ||
|
|
2db0c3ad1d | ||
|
|
4577bd1b7c | ||
|
|
93cf26abca | ||
|
|
62c22c7b5d | ||
|
|
63baaa7148 | ||
|
|
7e726a81e6 | ||
|
|
9e4e64dac9 | ||
|
|
3569cb9922 | ||
|
|
c6a094a9d2 | ||
|
|
cee4cde53e | ||
|
|
aa330999d0 | ||
|
|
5749276d7e | ||
|
|
7b30f77954 | ||
|
|
6ab3b4c0e3 | ||
|
|
70ab2e0620 | ||
|
|
0d16499fc0 | ||
|
|
77bbe20352 | ||
|
|
bd569433c4 | ||
|
|
fffa604023 | ||
|
|
e08ff8e650 | ||
|
|
b660f61b92 | ||
|
|
5fb282f73f | ||
|
|
7cc5580c71 | ||
|
|
2eaff3d01c | ||
|
|
b684699f79 | ||
|
|
f4716dc816 | ||
|
|
d375d80001 | ||
|
|
98824e7cb7 | ||
|
|
c28465e03e | ||
|
|
4ca686b7be | ||
|
|
b84f8e9234 | ||
|
|
9e51038ad9 | ||
|
|
777a8e2bb4 | ||
|
|
ad1f87cf07 | ||
|
|
a04c18af71 | ||
|
|
0538c3cd8c | ||
|
|
cd66657f34 | ||
|
|
9243c78ea2 | ||
|
|
218f191a59 | ||
|
|
3154c2c114 | ||
|
|
4fdd75695b | ||
|
|
9c91e35ce4 | ||
|
|
3a55e1326c | ||
|
|
370559c62f | ||
|
|
a74b307752 | ||
|
|
b41fe4efb1 | ||
|
|
68d2f8d161 | ||
|
|
1c1ce5a9e4 | ||
|
|
ab76cb6b53 | ||
|
|
009d7f0b76 | ||
|
|
f667f07d82 | ||
|
|
94f54da30b | ||
|
|
d85c642617 | ||
|
|
79f4956948 | ||
|
|
7f92e1d9dd | ||
|
|
e37a5eb5eb | ||
|
|
66ec5263a4 | ||
|
|
13d931c417 | ||
|
|
47a9ba3440 | ||
|
|
a1debae8f0 | ||
|
|
30c4d6b456 | ||
|
|
0e58007264 | ||
|
|
577173cc02 | ||
|
|
8c457e9283 | ||
|
|
2a83867436 | ||
|
|
9dd65c809f | ||
|
|
af5f34ace5 | ||
|
|
57da9bdbed | ||
|
|
d86ae2fb84 | ||
|
|
18084db7cf | ||
|
|
8e19a5b057 | ||
|
|
95882d4e5a | ||
|
|
99ab2b206c | ||
|
|
77cfa94682 | ||
|
|
79c6814d65 | ||
|
|
d479673074 | ||
|
|
6630ae9794 | ||
|
|
6bb1486405 | ||
|
|
75808a2d14 | ||
|
|
4e9a25e34a | ||
|
|
0f823beeb1 | ||
|
|
829c75a866 | ||
|
|
9d7c82d869 | ||
|
|
21eeed8a8c | ||
|
|
889f4e7791 | ||
|
|
c5e81516dd | ||
|
|
6d965c0926 | ||
|
|
2dba910b9e | ||
|
|
e32042f353 | ||
|
|
c1d07fd6db | ||
|
|
f83c83d49c | ||
|
|
605adc922d | ||
|
|
593cbc1d53 | ||
|
|
5c45753cd6 | ||
|
|
1563221171 | ||
|
|
b242e0d946 | ||
|
|
9322fd0458 | ||
|
|
f01438e9b1 | ||
|
|
ce5d1d0f59 | ||
|
|
7f1cd44d60 | ||
|
|
2841945095 | ||
|
|
76060bb2c7 | ||
|
|
84dfa659e7 | ||
|
|
e0b4543601 | ||
|
|
248743e6c5 | ||
|
|
9a1b8ea443 | ||
|
|
55aea26f13 | ||
|
|
fb9a752262 | ||
|
|
4a35243118 | ||
|
|
9fc910d8c0 | ||
|
|
51a293601b | ||
|
|
4d51052037 | ||
|
|
19c4dd2d8c | ||
|
|
2225892348 | ||
|
|
677160385c | ||
|
|
9b04cbbc4f | ||
|
|
4aca487b6d | ||
|
|
5afe40b095 | ||
|
|
b081f68e87 | ||
|
|
c9ed159a18 | ||
|
|
b9ed9919c1 | ||
|
|
04b4e414ad | ||
|
|
0b890ced19 | ||
|
|
c60bf9a897 | ||
|
|
245c78dcdc | ||
|
|
8a98141b60 | ||
|
|
78544417fc | ||
|
|
c6edce115c | ||
|
|
fe13ba8fc2 | ||
|
|
579499c66d | ||
|
|
827c70e015 | ||
|
|
8a5488e59f | ||
|
|
63204ae51e | ||
|
|
28ae47a174 | ||
|
|
aa684d1b0c | ||
|
|
1fdec955f8 | ||
|
|
213ad1ed7a | ||
|
|
797fb3c2e4 | ||
|
|
9d612e717e | ||
|
|
e919c6e6eb | ||
|
|
d82afb407e | ||
|
|
b858d7ce5e | ||
|
|
b83e0ec7b0 | ||
|
|
a0f0411abf | ||
|
|
8decefe8bc | ||
|
|
650cd43096 | ||
|
|
03f249430a | ||
|
|
8460b4c62f | ||
|
|
4710b8a5ba | ||
|
|
81e87b0838 | ||
|
|
465c087ac0 | ||
|
|
bc123ad02a | ||
|
|
e170e6d760 | ||
|
|
960e1708a1 | ||
|
|
2ce5f166d7 | ||
|
|
a7a9e7ae17 | ||
|
|
51ff4dd936 | ||
|
|
628061c501 | ||
|
|
003b8918c2 | ||
|
|
72183ff2e9 | ||
|
|
9ad660bbe1 | ||
|
|
58ec149c52 | ||
|
|
b3372a572d | ||
|
|
bc29145465 | ||
|
|
48c770e4bb | ||
|
|
3cf4cee40a | ||
|
|
ed0de70656 | ||
|
|
9a75916012 | ||
|
|
a4080dc095 | ||
|
|
4e50b2d9d9 | ||
|
|
e4b35f680d | ||
|
|
93cc22dae1 | ||
|
|
89d8f70fcd | ||
|
|
f363ec6b99 | ||
|
|
b3183b1198 | ||
|
|
892377ae57 | ||
|
|
95b3c8a16a | ||
|
|
12e39116f0 | ||
|
|
0005b9e4cf | ||
|
|
1fb3d5b0f6 | ||
|
|
bd9e1860d0 | ||
|
|
692e51609c | ||
|
|
bb5528b414 | ||
|
|
033bad3098 | ||
|
|
2cfd01aeb6 | ||
|
|
ddba7ba89f | ||
|
|
851d2cb6e0 | ||
|
|
a330cf2b09 | ||
|
|
b6b69c615a | ||
|
|
4fdff567c6 | ||
|
|
622672d397 | ||
|
|
64eafad472 | ||
|
|
1ea3b0601c | ||
|
|
5492fe130a | ||
|
|
8a4ab088e4 | ||
|
|
ba671d0a66 | ||
|
|
4595729cbb | ||
|
|
3b28bd2cb1 | ||
|
|
5387d9f903 | ||
|
|
fea3a72838 | ||
|
|
05726a976e | ||
|
|
070662e381 | ||
|
|
cdca54aed3 | ||
|
|
4081f3e23e | ||
|
|
1b29ab1289 | ||
|
|
cce83a0cea | ||
|
|
f1303aa54c | ||
|
|
dd82d7a653 | ||
|
|
ac33b1be27 | ||
|
|
ccd314cba7 | ||
|
|
82f37841f5 | ||
|
|
36ab72f095 | ||
|
|
bc013e6d34 | ||
|
|
0c8fdc381d | ||
|
|
9b05b0df5c | ||
|
|
119d5c5871 | ||
|
|
0740e61131 | ||
|
|
97d0ab78cb | ||
|
|
f537fc7da7 | ||
|
|
462825b15a | ||
|
|
9e91ac54d3 | ||
|
|
54d9732d0b | ||
|
|
d92309f0db | ||
|
|
faa6c9f708 | ||
|
|
6cc2f5dc78 | ||
|
|
a62cb9281e | ||
|
|
ef87acc389 | ||
|
|
1f22ac353a | ||
|
|
0e5f597ee6 | ||
|
|
899634d20b | ||
|
|
b048bff77d | ||
|
|
9ce797dd34 | ||
|
|
acdd3637bc | ||
|
|
85b6b4b1b2 | ||
|
|
5fe4803562 | ||
|
|
30ee87159d | ||
|
|
2a496890ff | ||
|
|
3fae121460 | ||
|
|
750b03a22f | ||
|
|
98487b5a15 | ||
|
|
a9d8040c0f | ||
|
|
3faca62a77 | ||
|
|
cc6959e1fa | ||
|
|
6bd3bf4d2f | ||
|
|
ed15443dba | ||
|
|
64ff5a080d | ||
|
|
72259ca5d3 | ||
|
|
00f58b9bfa | ||
|
|
5cc1cbf3bc | ||
|
|
8df5514083 | ||
|
|
123dce5fcd | ||
|
|
783d85ee4b | ||
|
|
b0524427c1 | ||
|
|
53e3f0dbdc | ||
|
|
c4fd05c0c2 | ||
|
|
1e55653ac1 | ||
|
|
272209ace5 | ||
|
|
7e739f954d | ||
|
|
bf9b434736 | ||
|
|
819056e94a | ||
|
|
489cf90d23 | ||
|
|
0230dc5067 | ||
|
|
dcbb6c5ce5 | ||
|
|
b296759852 | ||
|
|
51f3ab45c4 | ||
|
|
5b261849e0 | ||
|
|
58c686378d | ||
|
|
9a92933589 | ||
|
|
5f866f2d92 | ||
|
|
0667160b11 | ||
|
|
3570ba7c28 | ||
|
|
60adcd68a0 | ||
|
|
412180e203 | ||
|
|
a1a795321a | ||
|
|
11b7db05fb | ||
|
|
ca435b6d48 | ||
|
|
982aba38e4 | ||
|
|
c1b3740707 | ||
|
|
e9bc213b14 | ||
|
|
e2c2d7d742 | ||
|
|
2cb4d08d19 | ||
|
|
149acc40bd | ||
|
|
d40cb31685 | ||
|
|
f8da5e3457 | ||
|
|
fd3a2c285a | ||
|
|
3534bc872d | ||
|
|
66f8546107 | ||
|
|
9b4c33d44e | ||
|
|
60df9f3cad | ||
|
|
f2f226b4f2 | ||
|
|
ddfb6f2c44 | ||
|
|
70354013f1 | ||
|
|
c42e027602 | ||
|
|
18d6ba9947 | ||
|
|
c82b084927 | ||
|
|
45b41740d8 | ||
|
|
b608e28aa7 | ||
|
|
06f67e1ad3 | ||
|
|
b5bb89b30a | ||
|
|
0c2e3b1045 | ||
|
|
9b410be61c | ||
|
|
f81d7496b1 |
@@ -1,3 +1,4 @@
|
||||
# Ensure babel-register won't compile fixtures, or try to recompile compiled code.
|
||||
packages/*/test/fixtures
|
||||
packages/*/lib
|
||||
packages/babel-standalone/babel.js
|
||||
|
||||
28
.babelrc.js
28
.babelrc.js
@@ -6,12 +6,28 @@ let envOpts = {
|
||||
|
||||
module.exports = {
|
||||
comments: false,
|
||||
plugins: [
|
||||
// temp until next release
|
||||
function() {
|
||||
return {
|
||||
visitor: {
|
||||
"Function": function(path) {
|
||||
const node = path.node;
|
||||
for (let i = 0; i < node.params.length; i++) {
|
||||
const param = node.params[i];
|
||||
if (param.type === "AssignmentPattern") {
|
||||
param.left.optional = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
],
|
||||
presets: [
|
||||
[
|
||||
"env", envOpts
|
||||
],
|
||||
["env", envOpts],
|
||||
"stage-0",
|
||||
"flow",
|
||||
"flow"
|
||||
],
|
||||
env: {
|
||||
cov: {
|
||||
@@ -21,9 +37,9 @@ module.exports = {
|
||||
}
|
||||
};
|
||||
|
||||
if (process.env.BABEL_ENV === 'development') {
|
||||
if (process.env.BABEL_ENV === "development") {
|
||||
envOpts.targets = {
|
||||
node: "current"
|
||||
};
|
||||
envOpts.debug = true;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -7,3 +7,14 @@ packages/*/lib
|
||||
packages/*/dist
|
||||
packages/*/test/fixtures
|
||||
packages/*/test/tmp
|
||||
codemods/*/node_modules
|
||||
codemods/*/lib
|
||||
codemods/*/dist
|
||||
codemods/*/test/fixtures
|
||||
codemods/*/test/tmp
|
||||
packages/babel-standalone/babel.js
|
||||
packages/babel-standalone/babel.min.js
|
||||
|
||||
# Prettier tries to insert trailing commas in function calls, which Node.js
|
||||
# doesn't natively support. This causes an error when loading the Gulp tasks.
|
||||
packages/babel-standalone/src/gulpTasks.js
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{
|
||||
"extends": "babel",
|
||||
"plugins": [
|
||||
"prettier"
|
||||
],
|
||||
"rules": {
|
||||
"comma-dangle": ["error", "always-multiline"],
|
||||
"curly": ["error", "multi-line"],
|
||||
"func-call-spacing": "error",
|
||||
"key-spacing": "error",
|
||||
"no-multi-spaces": "error"
|
||||
"prettier/prettier": ["error", { "trailingComma": "es5" }]
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
|
||||
@@ -13,6 +13,5 @@ lib/types.js
|
||||
lib/third-party-libs.js.flow
|
||||
|
||||
[options]
|
||||
strip_root=true
|
||||
suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe
|
||||
suppress_comment= \\(.\\|\n\\)*\\$FlowIssue
|
||||
|
||||
13
.github/PULL_REQUEST_TEMPLATE.md
vendored
13
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -2,20 +2,19 @@
|
||||
Before making a PR please make sure to read our contributing guidelines
|
||||
https://github.com/babel/babel/blob/master/CONTRIBUTING.md
|
||||
|
||||
For any issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR
|
||||
For any issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. It should be underlined in the preview if done correctly.
|
||||
-->
|
||||
|
||||
| Q | A <!--(yes/no) -->
|
||||
| Q | A <!--(can use an emoji 👍 ) -->
|
||||
| ------------------------ | ---
|
||||
| Fixed Issues | `Fixes #1, Fixes #2` <!-- rm the quotes to link the issues -->
|
||||
| Patch: Bug Fix? |
|
||||
| Major: Breaking Change? |
|
||||
| Minor: New Feature? |
|
||||
| Deprecations? |
|
||||
| Spec Compliancy? |
|
||||
| Tests Added/Pass? |
|
||||
| Fixed Tickets | `Fixes #1, Fixes #2` <!-- rm the quotes to link the issues -->
|
||||
| Spec Compliancy? |
|
||||
| License | MIT
|
||||
| Doc PR | <!-- if yes, add `[skip ci]` to your commit message to skip CI builds -->
|
||||
| Dependency Changes |
|
||||
| Doc PR | <!-- if yes, can add `[skip ci]` to your commit message to skip CI builds -->
|
||||
| Any Dependency Changes? |
|
||||
|
||||
<!-- Describe your changes below in as much detail as possible -->
|
||||
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -10,6 +10,7 @@
|
||||
/coverage
|
||||
dist
|
||||
/.package.json
|
||||
package-lock.json
|
||||
/packages/babel-runtime/core-js/**/*.js
|
||||
!/packages/babel-runtime/core-js/map.js
|
||||
/packages/babel-runtime/helpers/*.js
|
||||
@@ -21,6 +22,10 @@ dist
|
||||
/packages/babel-runtime/helpers/es6/*.js
|
||||
!/packages/babel-runtime/helpers/es6/toArray.js
|
||||
/packages/babel-register/test/.babel
|
||||
/packages/babel-cli/test/tmp
|
||||
/packages/babel-node/test/tmp
|
||||
/packages/*/lib
|
||||
.nyc_output
|
||||
/babel.sublime-workspace
|
||||
packages/babel-standalone/babel.js
|
||||
packages/babel-standalone/babel.min.js
|
||||
|
||||
12
.mention-bot
12
.mention-bot
@@ -1,12 +0,0 @@
|
||||
{
|
||||
"userBlacklist": [
|
||||
"amasad",
|
||||
"greenkeeperio-bot",
|
||||
"jmm",
|
||||
"kittens",
|
||||
"thejameskyle"
|
||||
],
|
||||
"fileBlacklist": ["*.md"],
|
||||
"skipAlreadyAssignedPR": true,
|
||||
"createReviewRequest": true
|
||||
}
|
||||
12
.travis.yml
12
.travis.yml
@@ -7,14 +7,22 @@ cache:
|
||||
directories:
|
||||
- node_modules
|
||||
node_js:
|
||||
- '7'
|
||||
- '8'
|
||||
- '6'
|
||||
- '4'
|
||||
|
||||
env:
|
||||
- JOB=test
|
||||
global:
|
||||
- PATH=$HOME/.yarn/bin:$PATH
|
||||
- JOB=test
|
||||
|
||||
before_install:
|
||||
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 0.28.1
|
||||
|
||||
script:
|
||||
# Babel doesn't build correctly with npm v2 (which comes bundled with Node v4)
|
||||
# so we manually upgrade to a known working npm version.
|
||||
- npm install --global npm@4
|
||||
- 'if [ "$JOB" = "test" ]; then make test-ci; fi'
|
||||
- 'if [ "$JOB" = "lint" ]; then make lint && make flow; fi'
|
||||
|
||||
|
||||
139
CHANGELOG.md
139
CHANGELOG.md
@@ -11,7 +11,94 @@
|
||||
|
||||
_Note: Gaps between patch versions are faulty, broken or test releases._
|
||||
|
||||
See [CHANGELOG - 6to5](CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
|
||||
See [CHANGELOG - 6to5](/.github/CHANGELOG-6to5.md) for the pre-4.0.0 version changelog.
|
||||
|
||||
## 6.26.0 (2017-08-16)
|
||||
|
||||
> Backports for some folks (also other's when we accidently merged PRs from both 6.x/master)
|
||||
> Lesson learned: just use `master` and backport on another branch.
|
||||
|
||||
#### :eyeglasses: Spec Compliancy
|
||||
* `babel-core`, `babel-generator`, `babel-plugin-transform-flow-comments`, `babel-plugin-transform-flow-strip-types`, `babel-traverse`, `babel-types`
|
||||
* [#6081](https://github.com/babel/babel/pull/6081) Flow opaque type 6.x backport. ([@jbrown215](https://github.com/jbrown215))
|
||||
|
||||
#### :rocket: New Feature
|
||||
* `babel-cli`
|
||||
* [#5796](https://github.com/babel/babel/pull/5796) Allow --inspect-brk option to be used with babel-node [6.x backport]. ([@noinkling](https://github.com/noinkling))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-plugin-transform-es2015-modules-commonjs`
|
||||
* [#5811](https://github.com/babel/babel/pull/5811) Fix 5768. ([@joshwnj](https://github.com/joshwnj))
|
||||
* [#5469](https://github.com/babel/babel/pull/5469) Fix commonjs exports with destructuring.. ([@yavorsky](https://github.com/yavorsky))
|
||||
* `babel-types`
|
||||
* [#5693](https://github.com/babel/babel/pull/5693) Hoist toSequenceExpression's convert helper. ([@jridgewell](https://github.com/jridgewell))
|
||||
|
||||
#### :memo: Documentation
|
||||
* `babel-plugin-transform-class-properties`
|
||||
* [#6005](https://github.com/babel/babel/pull/6005) FIX access to the prototype of an instance. ([@shuaibird](https://github.com/shuaibird))
|
||||
* `babel-plugin-transform-runtime`
|
||||
* [#5857](https://github.com/babel/babel/pull/5857) Fix typos in README.md. ([@danny-andrews](https://github.com/danny-andrews))
|
||||
* `babel-plugin-transform-regenerator`
|
||||
* [#5852](https://github.com/babel/babel/pull/5852) Fix babel-plugin-transform-regenerator README. ([@k15a](https://github.com/k15a))
|
||||
* Other
|
||||
* [#5788](https://github.com/babel/babel/pull/5788) Add a section on troubleshooting [skip ci]. ([@peey](https://github.com/peey))
|
||||
* [#5755](https://github.com/babel/babel/pull/5755) Fix broken tables in README.md. ([@u9lyfish](https://github.com/u9lyfish))
|
||||
* `babel-generator`, `babel-plugin-transform-es2015-arrow-functions`, `babel-plugin-transform-es2015-modules-commonjs`, `babel-plugin-transform-es2015-spread`, `babel-plugin-transform-runtime`, `babel-register`
|
||||
* [#5613](https://github.com/babel/babel/pull/5613) Backport doc changes. ([@xtuc](https://github.com/xtuc))
|
||||
|
||||
#### :house: Internal
|
||||
* `babel-traverse`
|
||||
* [#5965](https://github.com/babel/babel/pull/5965) Remove unused functions from renamer.js.. ([@mcav](https://github.com/mcav))
|
||||
* [#5363](https://github.com/babel/babel/pull/5363) Increase the code coverage for traverse evaluation. ([@ssuman](https://github.com/ssuman))
|
||||
* Other
|
||||
* [#5938](https://github.com/babel/babel/pull/5938) Remove codecov node package and use bash uploader. ([@existentialism](https://github.com/existentialism))
|
||||
|
||||
#### Committers: 19
|
||||
- Artem Yavorsky ([yavorsky](https://github.com/yavorsky))
|
||||
- Brian Ng ([existentialism](https://github.com/existentialism))
|
||||
- Danny Andrews ([danny-andrews](https://github.com/danny-andrews))
|
||||
- Henry Zhu ([hzoo](https://github.com/hzoo))
|
||||
- Jeffrey Wear ([wearhere](https://github.com/wearhere))
|
||||
- Jordan Brown ([jbrown215](https://github.com/jbrown215))
|
||||
- Josh Johnston ([joshwnj](https://github.com/joshwnj))
|
||||
- Justin Ridgewell ([jridgewell](https://github.com/jridgewell))
|
||||
- Konstantin Pschera ([k15a](https://github.com/k15a))
|
||||
- Malcolm ([noinkling](https://github.com/noinkling))
|
||||
- Marcus Cavanaugh ([mcav](https://github.com/mcav))
|
||||
- Peeyush Kushwaha ([peey](https://github.com/peey))
|
||||
- Philipp Friedenberger ([MrSpider](https://github.com/MrSpider))
|
||||
- Samuel Reed ([STRML](https://github.com/STRML))
|
||||
- Shuaibird Hwang ([shuaibird](https://github.com/shuaibird))
|
||||
- Suman ([ssuman](https://github.com/ssuman))
|
||||
- Sven SAULEAU ([xtuc](https://github.com/xtuc))
|
||||
- jonathan schatz ([modosc](https://github.com/modosc))
|
||||
- u9lyfish@gmail.com ([u9lyfish](https://github.com/u9lyfish))
|
||||
|
||||
## 6.25.0 (2017-06-08)
|
||||
|
||||
Just backporting a few things.
|
||||
|
||||
#### :rocket: New Feature
|
||||
* `babel-plugin-transform-react-display-name`
|
||||
* [#5780](https://github.com/babel/babel/pull/5780) Backport support for createReactClass with transform-react-display-name. ([@kentor](https://github.com/kentor))
|
||||
* [#5554](https://github.com/babel/babel/pull/5554) Updated transform-react-display-name for createReactClass addon. ([@bvaughn](https://github.com/bvaughn))
|
||||
* `babel-generator`, `babel-plugin-transform-flow-strip-types`, `babel-types`
|
||||
* [#5653](https://github.com/babel/babel/pull/5653) Port flow object spread from #418 to 6.x. ([@kittens](https://github.com/kittens))
|
||||
|
||||
#### :bug: Bug Fix
|
||||
* `babel-types`
|
||||
* [#5770](https://github.com/babel/babel/pull/5770) Backport array & object pattern fixes to 6.x. ([@citycide](https://github.com/citycide))
|
||||
|
||||
#### :nail_care: Polish
|
||||
* `babel-traverse`
|
||||
* [#5615](https://github.com/babel/babel/pull/5615) Update deprecation warning on flow bindings. ([@kassens](https://github.com/kassens))
|
||||
|
||||
#### Committers: 5
|
||||
- Bo Lingen ([citycide](https://github.com/citycide))
|
||||
- Brian Vaughn ([bvaughn](https://github.com/bvaughn))
|
||||
- Jan Kassens ([kassens](https://github.com/kassens))
|
||||
- Kenneth Chung ([kentor](https://github.com/kentor))
|
||||
- Sebastian McKenzie ([kittens](https://github.com/kittens))
|
||||
|
||||
## 6.24.0 (2017-03-13)
|
||||
|
||||
@@ -263,7 +350,7 @@ New/Expected Behavior
|
||||
|
||||
```js
|
||||
const _ref = foo(); // should only be called once
|
||||
const { x } = _ref;
|
||||
const { x } = _ref;
|
||||
const y = _objectWithoutProperties(_ref, ["x"]);
|
||||
```
|
||||
|
||||
@@ -279,7 +366,7 @@ function fn({a = 1, ...b} = {}) {
|
||||
return {a, b};
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
* `babel-plugin-transform-es2015-destructuring`
|
||||
* [#5093](https://github.com/babel/babel/pull/5093) Ensure array is always copied during destructure. ([@existentialism](https://github.com/existentialism))
|
||||
|
||||
@@ -293,7 +380,7 @@ const arr = [1, 2, 3]
|
||||
assign(arr, 1, 42)
|
||||
console.log(arr) // [1, 2, 3]
|
||||
```
|
||||
|
||||
|
||||
* `babel-plugin-transform-es2015-function-name`
|
||||
* [#5008](https://github.com/babel/babel/pull/5008) Don't try to visit ArrowFunctionExpression, they cannot be named. ([@Kovensky](https://github.com/Kovensky))
|
||||
|
||||
@@ -308,9 +395,9 @@ Output
|
||||
|
||||
```js
|
||||
export const x = ({ x }) => x;
|
||||
export const y = function y() {};
|
||||
export const y = function y() {};
|
||||
```
|
||||
|
||||
|
||||
* `babel-types`
|
||||
* [#5068](https://github.com/babel/babel/pull/5068) Fix getBindingIdentifiers in babel-types. ([@rtsao](https://github.com/rtsao))
|
||||
* `babel-cli`
|
||||
@@ -460,7 +547,7 @@ Will still error with `Spread children are not supported.`
|
||||
```js
|
||||
<div>{...this.props.children}</div>;
|
||||
```
|
||||
|
||||
|
||||
* `babel-plugin-transform-es2015-block-scoping`, `babel-plugin-transform-react-constant-elements`, `babel-traverse`
|
||||
* [#4940](https://github.com/babel/babel/pull/4940) Fix React constant element bugs. ([@appden](https://github.com/appden))
|
||||
|
||||
@@ -469,7 +556,7 @@ When multiple declarators are present in a declaration, we want to insert the co
|
||||
```js
|
||||
function render() {
|
||||
const bar = "bar", renderFoo = () => <foo bar={bar} baz={baz} />, baz = "baz";
|
||||
|
||||
|
||||
return renderFoo();
|
||||
}
|
||||
```
|
||||
@@ -480,12 +567,12 @@ When block scoped variables caused the block to be wrapped in a closure, the var
|
||||
function render(flag) {
|
||||
if (flag) {
|
||||
let bar = "bar";
|
||||
|
||||
|
||||
[].map(() => bar);
|
||||
|
||||
|
||||
return <foo bar={bar} />;
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
```
|
||||
@@ -526,7 +613,7 @@ for (let a of b) {
|
||||
* [#4999](https://github.com/babel/babel/pull/4999) babel-helper-transform-fixture-test-runner: pass require as a global. ([@hzoo](https://github.com/hzoo))
|
||||
|
||||
Allows running `require()` in exec.js tests like for [babel/babel-preset-env#95](https://github.com/babel/babel-preset-env/pull/95)
|
||||
|
||||
|
||||
* Other
|
||||
* [#5005](https://github.com/babel/babel/pull/5005) internal: don't run watch with the test env (skip building with code …. ([@hzoo](https://github.com/hzoo))
|
||||
|
||||
@@ -648,8 +735,8 @@ try {
|
||||
return x;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
* `babel-helper-remap-async-to-generator`, `babel-plugin-transform-async-generator-functions`, `babel-plugin-transform-async-to-generator`
|
||||
* [#4901](https://github.com/babel/babel/pull/4901) Only base async fn arity on non-default/non-rest params - Closes [#4891](https://github.com/babel/babel/issues/4891). ([@loganfsmyth](https://github.com/loganfsmyth))
|
||||
|
||||
@@ -660,7 +747,7 @@ console.log(foo.length) // 0
|
||||
const asyncFoo = async (...args) => { }
|
||||
console.log(asyncFoo.length) // 0
|
||||
```
|
||||
|
||||
|
||||
* `babel-generator`, `babel-types`
|
||||
* [#4945](https://github.com/babel/babel/pull/4945) Add `babel-generator` support for `Import`. ([@TheLarkInn](https://github.com/TheLarkInn))
|
||||
|
||||
@@ -669,14 +756,14 @@ console.log(asyncFoo.length) // 0
|
||||
```js
|
||||
import("module.js");
|
||||
```
|
||||
|
||||
|
||||
* `babel-plugin-transform-object-rest-spread`
|
||||
* [#4883](https://github.com/babel/babel/pull/4883) Fix for object-rest with parameters destructuring nested rest. ([@christophehurpeau](https://github.com/christophehurpeau))
|
||||
|
||||
```js
|
||||
function a5({a3, b2: { ba1, ...ba2 }, ...c3}) {}
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
* `babel-traverse`
|
||||
* [#4875](https://github.com/babel/babel/pull/4875) Fix `path.evaluate` for references before declarations. ([@boopathi](https://github.com/boopathi))
|
||||
|
||||
@@ -981,7 +1068,7 @@ function render(_ref) {
|
||||
- Scott Stern ([sstern6](https://github.com/sstern6))
|
||||
- Shine Wang ([shinew](https://github.com/shinew))
|
||||
- lion ([lion-man44](https://github.com/lion-man44))
|
||||
|
||||
|
||||
## v6.18.2 (2016-11-01)
|
||||
|
||||
Weird publishing issue with v6.18.1, same release.
|
||||
@@ -1666,7 +1753,7 @@ export default {
|
||||
#### :bug: Bug Fix
|
||||
* `babel-helpers`, `babel-plugin-transform-es2015-typeof-symbol`
|
||||
* [#3686](https://github.com/babel/babel/pull/3686) Fix `typeof Symbol.prototype`. ([@brainlock](https://github.com/brainlock))
|
||||
|
||||
|
||||
```js
|
||||
// `typeof Symbol.prototype` should be 'object'
|
||||
typeof Symbol.prototype === 'object'
|
||||
@@ -1675,7 +1762,7 @@ typeof Symbol.prototype === 'object'
|
||||
* `babel-cli`
|
||||
* [#3456](https://github.com/babel/babel/pull/3456) Use the real sourcemap API and handle input sourcemaps - Fixes [#7259](https://github.com/babel/babel/issues/7259). ([@loganfsmyth](https://github.com/loganfsmyth))
|
||||
* [#4507](https://github.com/babel/babel/pull/4507) Only set options in cli if different from default. ([@danez](https://github.com/danez))
|
||||
|
||||
|
||||
Fix an issue with defaults not being overidden. This was causing options like `comments: false` not to work correctly.
|
||||
|
||||
* [#4508](https://github.com/babel/babel/pull/4508) Support custom ports for V8 --inspect. ([@andykant](https://github.com/andykant))
|
||||
@@ -1730,7 +1817,7 @@ We noticed that we can not make this optimizations if there are function calls o
|
||||
// was tranforming to
|
||||
x = a();
|
||||
y = obj.x;
|
||||
// now transforms to
|
||||
// now transforms to
|
||||
var _ref = [a(), obj.x];
|
||||
x = _ref[0];
|
||||
y = _ref[1];
|
||||
@@ -1796,7 +1883,7 @@ Cleanup tests, remove various unused dependencies, do not run CI with only readm
|
||||
#### Commiters: 20
|
||||
|
||||
First PRs!
|
||||
- Alberto Piai ([brainlock](https://github.com/brainlock))
|
||||
- Alberto Piai ([brainlock](https://github.com/brainlock))
|
||||
- Andy Kant ([andykant](https://github.com/andykant))
|
||||
- Basil Hosmer ([bhosmer](https://github.com/bhosmer))
|
||||
- Bo Borgerson ([gigabo](https://github.com/gigabo))
|
||||
@@ -1879,7 +1966,7 @@ npm install babel-preset-latest --save-dev
|
||||
{ "presets": [
|
||||
["latest", {
|
||||
"es2015": {
|
||||
"modules": false
|
||||
"modules": false
|
||||
}
|
||||
}]
|
||||
] }
|
||||
@@ -2117,7 +2204,7 @@ Can be `false` to not transform modules, or one of `["amd", "umd", "systemjs", "
|
||||
|
||||
## v6.11.5 (2016-07-23)
|
||||
|
||||
Thanks to Rob Eisenberg ([EisenbergEffect](https://github.com/EisenbergEffect)), Keyan Zhang ([keyanzhang](https://github.com/keyanzhang)), Rolf Timmermans ([rolftimmermans](https://github.com/rolftimmermans)), Thomas Grainger ([graingert](https://github.com/graingert)),
|
||||
Thanks to Rob Eisenberg ([EisenbergEffect](https://github.com/EisenbergEffect)), Keyan Zhang ([keyanzhang](https://github.com/keyanzhang)), Rolf Timmermans ([rolftimmermans](https://github.com/rolftimmermans)), Thomas Grainger ([graingert](https://github.com/graingert)),
|
||||
|
||||
we have few fixes: fix `babel-register` file paths on error, infer class name for classes with class properties, fix `export *` to account for previously compiled modules.
|
||||
|
||||
@@ -2165,7 +2252,7 @@ In this release among other things are some more optimizations for babel-generat
|
||||
|
||||
## v6.11.3 (2016-07-13)
|
||||
|
||||
The main fix is @loganfsmyth's changes of some parts in babel-generator in [#3565](https://github.com/babel/babel/pull/3565) to fix issues with exponential code generation times in certain cases.
|
||||
The main fix is @loganfsmyth's changes of some parts in babel-generator in [#3565](https://github.com/babel/babel/pull/3565) to fix issues with exponential code generation times in certain cases.
|
||||
|
||||
Items: the size of the array being generated
|
||||
Time: The time in ms to generate the code
|
||||
|
||||
@@ -31,6 +31,8 @@ Contributions are always welcome, no matter how large or small.
|
||||
- Check out [the Babel Plugin Handbook](https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#babel-plugin-handbook) - core plugins are written the same way as any other plugin!
|
||||
- Check out [AST Explorer](http://astexplorer.net/#/scUfOmVOG5) to learn more about ASTs or make your own plugin in the browser
|
||||
- When you feel ready to jump into the Babel source code, a good place to start is to look for issues tagged with [help-wanted](https://github.com/babel/babel/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) and/or [beginner-friendly](https://github.com/babel/babel/issues?q=is%3Aissue+is%3Aopen+label%3A%22beginner-friendly%22).
|
||||
- Follow along with what we are working on by joining our Slack, following our annoucements on [Twitter](https://twitter.com/babeljs), and reading (or participating!) in our [meeting notes](https://github.com/babel/notes).
|
||||
- Check out our [website](http://babeljs.io/) and the [repo](https://github.com/babel/website)
|
||||
|
||||
## Chat
|
||||
|
||||
@@ -40,11 +42,9 @@ Feel free to check out the `#discussion`/`#development` channels on our [Slack](
|
||||
|
||||
**Note:** Versions `< 5.1.10` can't be built.
|
||||
|
||||
Babel is built for Node.js 4 and up but we develop using Node.js 6. Make sure you are on npm 3.
|
||||
Babel is built for Node 4 and up but we develop using Node 8 and yarn. You can check this with `node -v`.
|
||||
|
||||
You can check this with `node -v` and `npm -v`.
|
||||
|
||||
In addition, make sure that Yarn is installed.
|
||||
Make sure that Yarn is installed with version >= `0.28.0`.
|
||||
Installation instructions can be found here: https://yarnpkg.com/en/docs/install.
|
||||
|
||||
### Setup
|
||||
@@ -114,12 +114,25 @@ To run tests for a specific package in [packages](https://github.com/babel/babel
|
||||
$ TEST_ONLY=babel-cli make test
|
||||
```
|
||||
|
||||
`TEST_ONLY` will also match substrings of the package name:
|
||||
|
||||
```sh
|
||||
# Run tests for the babel-plugin-transform-es2015-classes package.
|
||||
$ TEST_ONLY=es2015-class make test
|
||||
```
|
||||
|
||||
Use the `TEST_GREP` variable to run a subset of tests by name:
|
||||
|
||||
```sh
|
||||
$ TEST_GREP=transformation make test
|
||||
```
|
||||
|
||||
Substitute spaces for hyphens and forward slashes when targeting specific test names:
|
||||
|
||||
```sh
|
||||
$ TEST_GREP="arrow functions destructuring parameters" make test
|
||||
```
|
||||
|
||||
To enable the Node.js debugger added in v6.3.0, set the `TEST_DEBUG` environment variable:
|
||||
|
||||
```sh
|
||||
@@ -138,15 +151,15 @@ $ ./scripts/test-cov.sh
|
||||
|
||||
#### Troubleshooting Tests
|
||||
|
||||
In case you're not able to reproduce an error on CI locally, it may be due to
|
||||
In case you're not able to reproduce an error on CI locally, it may be due to
|
||||
|
||||
- Node Version: Travis CI runs the tests against all major node versions. If your tests use JavaScript features unsupported by lower versions of node, then use [minNodeVersion option](#writing-tests) in options.json.
|
||||
- Timeout: Check the CI log and if the only errors are timeout errors and you are sure that it's not related to the changes you made, ask someone in the slack channel to trigger rebuild on the CI build and it might be resolved
|
||||
|
||||
|
||||
In case you're locally getting errors which are not on the CI, it may be due to
|
||||
|
||||
- Updates in Dependencies: Make sure you run `make bootstrap` before you run `make build` or `make watch` before you run the tests.
|
||||
|
||||
|
||||
### Writing tests
|
||||
|
||||
Most packages in [`/packages`](https://github.com/babel/babel/tree/master/packages) have a `test` folder, however some tests might be in other packages or in [`/packages/babel-core`](https://github.com/babel/babel/tree/master/packages/babel-core/test/fixtures).
|
||||
@@ -261,7 +274,7 @@ To start the debugging in Chrome DevTools, open the given URL.
|
||||
The debugger starts at the first executed line of code, which is Mocha's first line by default.
|
||||
Click _Resume script execution_ <img src="https://i.imgur.com/TmYBn9d.png" alt="Resume script execution button." width="16"> to jump to the set breakpoint.
|
||||
Note that the code shown in Chrome DevTools is compiled code and therefore differs.
|
||||
|
||||
|
||||
## Internals
|
||||
- AST spec ([babylon/ast/spec.md](https://github.com/babel/babylon/blob/master/ast/spec.md))
|
||||
- Versioning ([doc/design/versioning.md](https://github.com/babel/babel/blob/master/doc/design/versioning.md)
|
||||
|
||||
53
Gulpfile.js
53
Gulpfile.js
@@ -21,32 +21,41 @@ function swapSrcWithLib(srcPath) {
|
||||
|
||||
gulp.task("default", ["build"]);
|
||||
|
||||
gulp.task("build", function () {
|
||||
return gulp.src(scripts, { base: base })
|
||||
.pipe(plumber({
|
||||
errorHandler: function (err) {
|
||||
gutil.log(err.stack);
|
||||
},
|
||||
}))
|
||||
.pipe(newer({
|
||||
dest: base,
|
||||
map: swapSrcWithLib,
|
||||
}))
|
||||
.pipe(through.obj(function (file, enc, callback) {
|
||||
gutil.log("Compiling", "'" + chalk.cyan(file.relative) + "'...");
|
||||
callback(null, file);
|
||||
}))
|
||||
gulp.task("build", function() {
|
||||
return gulp
|
||||
.src(scripts, { base: base })
|
||||
.pipe(
|
||||
plumber({
|
||||
errorHandler: function(err) {
|
||||
gutil.log(err.stack);
|
||||
},
|
||||
})
|
||||
)
|
||||
.pipe(
|
||||
newer({
|
||||
dest: base,
|
||||
map: swapSrcWithLib,
|
||||
})
|
||||
)
|
||||
.pipe(
|
||||
through.obj(function(file, enc, callback) {
|
||||
gutil.log("Compiling", "'" + chalk.cyan(file.relative) + "'...");
|
||||
callback(null, file);
|
||||
})
|
||||
)
|
||||
.pipe(babel())
|
||||
.pipe(through.obj(function (file, enc, callback) {
|
||||
// Passing 'file.relative' because newer() above uses a relative path and this keeps it consistent.
|
||||
file.path = path.resolve(file.base, swapSrcWithLib(file.relative));
|
||||
callback(null, file);
|
||||
}))
|
||||
.pipe(
|
||||
through.obj(function(file, enc, callback) {
|
||||
// Passing 'file.relative' because newer() above uses a relative path and this keeps it consistent.
|
||||
file.path = path.resolve(file.base, swapSrcWithLib(file.relative));
|
||||
callback(null, file);
|
||||
})
|
||||
)
|
||||
.pipe(gulp.dest(base));
|
||||
});
|
||||
|
||||
gulp.task("watch", ["build"], function () {
|
||||
watch(scripts, { debounceDelay: 200 }, function () {
|
||||
gulp.task("watch", ["build"], function() {
|
||||
watch(scripts, { debounceDelay: 200 }, function() {
|
||||
gulp.start("build");
|
||||
});
|
||||
});
|
||||
|
||||
21
Makefile
21
Makefile
@@ -2,10 +2,20 @@ MAKEFLAGS = -j1
|
||||
|
||||
export NODE_ENV = test
|
||||
|
||||
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
|
||||
export FORCE_COLOR = true
|
||||
|
||||
.PHONY: build build-dist watch lint fix clean test-clean test-only test test-ci publish bootstrap
|
||||
|
||||
build: clean
|
||||
rm -rf packages/*/lib
|
||||
./node_modules/.bin/gulp build
|
||||
ifneq ($(BABEL_ENV), "cov")
|
||||
make build-standalone
|
||||
endif
|
||||
|
||||
build-standalone:
|
||||
./node_modules/.bin/gulp build-babel-standalone --cwd=packages/babel-standalone/
|
||||
|
||||
build-dist: build
|
||||
cd packages/babel-polyfill; \
|
||||
@@ -19,13 +29,13 @@ watch: clean
|
||||
BABEL_ENV=development ./node_modules/.bin/gulp watch
|
||||
|
||||
lint:
|
||||
./node_modules/.bin/eslint scripts packages *.js --format=codeframe
|
||||
./node_modules/.bin/eslint scripts packages *.js --format=codeframe --rulesdir="./eslint_rules"
|
||||
|
||||
flow:
|
||||
./node_modules/.bin/flow check
|
||||
./node_modules/.bin/flow check --strip-root
|
||||
|
||||
fix:
|
||||
./node_modules/.bin/eslint scripts packages *.js --format=codeframe --fix
|
||||
./node_modules/.bin/eslint scripts packages *.js --format=codeframe --fix --rulesdir="./eslint_rules"
|
||||
|
||||
clean: test-clean
|
||||
rm -rf packages/babel-polyfill/browser*
|
||||
@@ -43,6 +53,8 @@ clean-all:
|
||||
rm -rf packages/*/lib
|
||||
rm -rf node_modules
|
||||
rm -rf packages/*/node_modules
|
||||
rm -rf package-lock.json
|
||||
rm -rf packages/*/package-lock.json
|
||||
make clean
|
||||
|
||||
test-only:
|
||||
@@ -55,10 +67,11 @@ test-ci:
|
||||
make bootstrap
|
||||
make test-only
|
||||
|
||||
test-ci-coverage: SHELL:=/bin/bash
|
||||
test-ci-coverage:
|
||||
BABEL_ENV=cov make bootstrap
|
||||
./scripts/test-cov.sh
|
||||
./node_modules/.bin/codecov -f coverage/coverage-final.json
|
||||
bash <(curl -s https://codecov.io/bash) -f coverage/coverage-final.json
|
||||
|
||||
publish:
|
||||
git pull --rebase
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
sebmck
|
||||
thejameskyle
|
||||
amasad
|
||||
hzoo
|
||||
loganfsmyth
|
||||
jmm
|
||||
117
README.md
117
README.md
@@ -44,127 +44,41 @@ When your supported environments don't support certain features natively, Babel
|
||||
Try it out at our [REPL](https://babeljs.io/repl/#?babili=false&evaluate=true&lineWrap=false&presets=latest&code=%5B1%2C2%2C3%5D.map(n%20%3D%3E%20n%20%2B%201)%3B&experimental=true&loose=true&spec=false&playground=false&stage=0) and follow us at [@babeljs](https://twitter.com/babeljs).
|
||||
|
||||
- [FAQ](#faq)
|
||||
- [Packages](#packages)
|
||||
- [Core Packages](#core-packages)
|
||||
- [Other](#other)
|
||||
- [Presets](#presets)
|
||||
- [Plugins](#plugins)
|
||||
- [Transform Plugins](#transform-plugins)
|
||||
- [Syntax Plugins](#syntax-plugins)
|
||||
- [Misc Packages](#misc-packages)
|
||||
- [Team](#team)
|
||||
- [Backers](#backers)
|
||||
- [Sponsors](#sponsors)
|
||||
- [License](#license)
|
||||
|
||||
# FAQ
|
||||
## FAQ
|
||||
|
||||
## Docs?
|
||||
### Docs?
|
||||
|
||||
Check out our website: [babeljs.io](http://babeljs.io/)
|
||||
|
||||
## Looking for support?
|
||||
### Looking for support?
|
||||
|
||||
For questions and support please visit our [discussion forum](https://discuss.babeljs.io/), sign up for our [Slack community](https://slack.babeljs.io/), or [StackOverflow](http://stackoverflow.com/questions/tagged/babeljs).
|
||||
|
||||
## Want to report a bug or request a feature?
|
||||
### Want to report a bug or request a feature?
|
||||
|
||||
Bugs and feature requests can be posted at https://github.com/babel/babel/issues.
|
||||
Read through our [CONTRIBUTING.md](https://github.com/babel/babel/blob/master/CONTRIBUTING.md) and fill out the issue template at [babel/issues](https://github.com/babel/babel/issues).
|
||||
|
||||
> We've moved our issues from phabricator back to github issues!
|
||||
### Want to report an issue with [babeljs.io](https://babeljs.io) (the website)?
|
||||
|
||||
Former phabricator issue URLs now automatically redirect to their corresponding Github issue:
|
||||
For documentation and website issues please visit the [babel/website](https://github.com/babel/website) repo.
|
||||
|
||||
https://phabricator.babeljs.io/T2168 mostly corresponds to https://github.com/babel/babel/issues/2168.
|
||||
|
||||
## Want to report an issue with [babeljs.io](https://babeljs.io) (the website)?
|
||||
|
||||
For documentation and website issues please visit the [babel/babel.github.io](https://github.com/babel/babel.github.io) repo.
|
||||
|
||||
## Want to contribute to Babel?
|
||||
### Want to contribute to Babel?
|
||||
|
||||
Check out our [CONTRIBUTING.md](https://github.com/babel/babel/blob/master/CONTRIBUTING.md). If you have already joined Slack, join our [#development](https://babeljs.slack.com/messages/development) channel!
|
||||
|
||||
You can also start by checking out the issues with the [help-wanted](https://github.com/babel/babel/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) label.
|
||||
|
||||
Our discussions/notes/roadmap: [babel/notes](https://github.com/babel/notes)
|
||||
Our progress on TC39 proposals: [babel/proposals](https://github.com/babel/proposals)
|
||||
|
||||
## Packages
|
||||
### How is the repo structured?
|
||||
|
||||
The Babel repo is managed as a [monorepo](https://github.com/babel/babel/blob/master/doc/design/monorepo.md) that is composed of many npm packages.
|
||||
|
||||
### Core Packages
|
||||
|
||||
| Package | Version | Dependencies |
|
||||
|--------|-------|------------|
|
||||
| [`babel-core`](/packages/babel-core) | [](https://www.npmjs.com/package/babel-core) | [](https://david-dm.org/babel/babel?path=packages/babel-core) |
|
||||
| [`babylon`](https://github.com/babel/babylon) | [](https://www.npmjs.com/package/babylon) | [](https://david-dm.org/babel/babylon) |
|
||||
| [`babel-traverse`](/packages/babel-traverse) | [](https://www.npmjs.com/package/babel-traverse) | [](https://david-dm.org/babel/babel?path=packages/babel-traverse) |
|
||||
| [`babel-generator`](/packages/babel-generator) | [](https://www.npmjs.com/package/babel-generator) | [](https://david-dm.org/babel/babel?path=packages/babel-generator) |
|
||||
|
||||
[`babel-core`](/packages/babel-core) is the Babel compiler itself; it exposes the `babel.transform` method, where `transformedCode = transform(src).code`.
|
||||
|
||||
The compiler can be broken down into 3 parts:
|
||||
- The parser: [`babylon`](https://github.com/babel/babylon) (moved to a separate repo and versioned independently)
|
||||
- The transformer[s]: All the plugins/presets
|
||||
- These all use [`babel-traverse`](/packages/babel-traverse) to traverse through the AST
|
||||
- The generator: [`babel-generator`](/packages/babel-generator)
|
||||
|
||||
The flow goes like this:
|
||||
|
||||
input string -> `babylon` parser -> `AST` -> transformer[s] -> `AST` -> `babel-generator` -> output string
|
||||
|
||||
Check out the [`babel-handbook`](https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#introduction) for more information on this.
|
||||
|
||||
#### Other
|
||||
|
||||
| Package | Version | Dependencies |
|
||||
|--------|-------|------------|
|
||||
| [`babel-cli`](/packages/babel-cli) | [](https://www.npmjs.com/package/babel-cli) | [](https://david-dm.org/babel/babel?path=packages/babel-cli) |
|
||||
| [`babel-types`](/packages/babel-types) | [](https://www.npmjs.com/package/babel-types) | [](https://david-dm.org/babel/babel?path=packages/babel-types) |
|
||||
| [`babel-polyfill`](/packages/babel-polyfill) | [](https://www.npmjs.com/package/babel-polyfill) | [](https://david-dm.org/babel/babel?path=packages/babel-polyfill) |
|
||||
| [`babel-runtime`](/packages/babel-runtime) | [](https://www.npmjs.com/package/babel-runtime) | [](https://david-dm.org/babel/babel?path=packages/babel-runtime) |
|
||||
| [`babel-register`](/packages/babel-register) | [](https://www.npmjs.com/package/babel-register) | [](https://david-dm.org/babel/babel?path=packages/babel-register) |
|
||||
| [`babel-template`](/packages/babel-template) | [](https://www.npmjs.com/package/babel-template) | [](https://david-dm.org/babel/babel?path=packages/babel-template) |
|
||||
| [`babel-helpers`](/packages/babel-helpers) | [](https://www.npmjs.com/package/babel-helpers) | [](https://david-dm.org/babel/babel?path=packages/babel-helpers) |
|
||||
| [`babel-code-frame`](/packages/babel-code-frame) | [](https://www.npmjs.com/package/babel-code-frame) | [](https://david-dm.org/babel/babel?path=packages/babel-code-frame) |
|
||||
|
||||
- [`babel-cli`](/packages/babel-cli) is the CLI tool that runs `babel-core` and helps with outputting to a directory, a file, stdout and more (also includes `babel-node`). Check out the [docs](https://babeljs.io/docs/usage/cli/).
|
||||
- [`babel-types`](/packages/babel-types) is used to validate, build and change AST nodes.
|
||||
- [`babel-polyfill`](/packages/babel-polyfill) is [literally a wrapper](https://github.com/babel/babel/blob/master/packages/babel-polyfill/src/index.js) around [`core-js`](https://github.com/zloirock/core-js) and [regenerator-runtime](https://github.com/facebook/regenerator/tree/master/packages/regenerator-runtime). Check out the [docs](https://babeljs.io/docs/usage/polyfill/).
|
||||
- [`babel-runtime`](/packages/babel-runtime) is similar to the polyfill except that it doesn't modify the global scope and is to be used with [`babel-plugin-transform-runtime`](/packages/babel-plugin-transform-runtime) (usually in library/plugin code). Check out the [docs](https://babeljs.io/docs/plugins/transform-runtime/).
|
||||
- [`babel-register`](/packages/babel-register) is a way to automatically compile files with Babel on the fly by binding to Node.js `require`. Check out the [docs](http://babeljs.io/docs/usage/require/).
|
||||
- [`babel-template`](/packages/babel-template) is a helper function that allows constructing AST nodes from a string presentation of the code; this eliminates the tedium of using `babel-types` for building AST nodes.
|
||||
- [`babel-helpers`](/packages/babel-helpers) is a set of pre-made `babel-template` functions that are used in some Babel plugins.
|
||||
- [`babel-code-frame`](/packages/babel-code-frame) is a standalone package used to generate errors that print the source code and point to error locations.
|
||||
|
||||
### [Presets](http://babeljs.io/docs/plugins/#presets)
|
||||
|
||||
After Babel 6, the default transforms were removed; if you don't specify any plugins/presets, Babel will just return the original source code.
|
||||
|
||||
The transformer[s] used in Babel are the independent pieces of code that transform specific things. For example: the [`es2015-arrow-functions`](/packages/babel-plugin-transform-es2015-arrow-functions) transform specifically changes arrow functions into regular functions. A preset is simply an array of plugins that make it easier to run a whole a set of transforms without specifying each one manually.
|
||||
|
||||
| Package | Version | Dependencies | Description |
|
||||
|--------|-------|------------|---|
|
||||
| [`babel-preset-env`](https://github.com/babel/babel-preset-env) | [](https://www.npmjs.com/package/babel-preset-env) | [](https://david-dm.org/babel/babel-preset-env) | automatically determines plugins and polyfills you need based on your supported environments |
|
||||
|
||||
> You can find community maintained presets on [npm](https://www.npmjs.com/search?q=babel-preset)
|
||||
|
||||
### [Plugins](http://babeljs.io/docs/plugins)
|
||||
|
||||
Plugins are the heart of Babel and what make it work.
|
||||
|
||||
> You can find community plugins on [npm](https://www.npmjs.com/search?q=babel-plugin).
|
||||
|
||||
#### Transform Plugins
|
||||
|
||||
There are many kinds of plugins: ones that convert ES6/ES2015 to ES5, transform to ES3, minification, JSX, flow, experimental features, and more. Check out our [website for more](http://babeljs.io/docs/plugins/#transform-plugins).
|
||||
|
||||
#### Syntax Plugins
|
||||
|
||||
These just enable the transform plugins to be able to parse certain features (the transform plugins already include the syntax plugins so you don't need both): `babel-plugin-syntax-x`. Check out our [website for more](http://babeljs.io/docs/plugins/#syntax-plugins).
|
||||
|
||||
### Helpers
|
||||
|
||||
These are mostly for internal use in various plugins: `babel-helper-x`.
|
||||
The Babel repo is managed as a [monorepo](https://github.com/babel/babel/blob/master/doc/design/monorepo.md) that is composed of many [npm packages](/packages#readme).
|
||||
|
||||
## Team
|
||||
|
||||
@@ -206,8 +120,7 @@ Amjad Masad | James Kyle | Jesse McCarthy | Sebastian McKenzie |
|
||||
[@amasad](https://github.com/amasad) | [@thejameskyle](https://github.com/thejameskyle) | [@jmm](https://github.com/jmm) | [@sebmck](https://twitter.com/sebmck) |
|
||||
| [@amasad](https://twitter.com/amasad) | [@thejameskyle](https://twitter.com/thejameskyle) | [@mccjm](https://twitter.com/mccjm) | [@kittens](https://github.com/kittens)
|
||||
|
||||
|
||||
# Backers
|
||||
## Backers
|
||||
|
||||
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/babel#backer)]
|
||||
|
||||
@@ -242,7 +155,7 @@ Support us with a monthly donation and help us continue our activities. [[Become
|
||||
<a href="https://opencollective.com/babel/backer/28/website" target="_blank"><img src="https://opencollective.com/babel/backer/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/29/website" target="_blank"><img src="https://opencollective.com/babel/backer/29/avatar.svg"></a>
|
||||
|
||||
# Sponsors
|
||||
## Sponsors
|
||||
|
||||
Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/babel#sponsor)]
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"settings": {
|
||||
"rulers": [
|
||||
110
|
||||
80
|
||||
],
|
||||
|
||||
// Set to false to disable detection of tabs vs. spaces on load
|
||||
|
||||
16
circle.yml
16
circle.yml
@@ -1,11 +1,17 @@
|
||||
general:
|
||||
artifacts:
|
||||
- "packages/babel-standalone/babel.js"
|
||||
- "packages/babel-standalone/babel.min.js"
|
||||
|
||||
machine:
|
||||
node:
|
||||
version:
|
||||
6
|
||||
8
|
||||
|
||||
dependencies:
|
||||
pre:
|
||||
- curl -o- -L https://yarnpkg.com/install.sh | bash
|
||||
# Version number can be removed once 0.28.x or higher is released as stable
|
||||
- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 0.28.4
|
||||
cache_directories:
|
||||
- ~/.yarn-cache
|
||||
override:
|
||||
@@ -14,3 +20,9 @@ dependencies:
|
||||
test:
|
||||
override:
|
||||
- make test-ci-coverage
|
||||
# Builds babel-standalone with the regular Babel config
|
||||
- make build
|
||||
# test-ci-coverage doesn't test babel-standalone, as trying to gather coverage
|
||||
# data for a JS file that's several megabytes large is bound to fail. Here,
|
||||
# we just run the babel-standalone test separately.
|
||||
- ./node_modules/mocha/bin/_mocha packages/babel-standalone/test/ --opts test/mocha.opts
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
# babel-plugin-codemod-optional-catch-binding
|
||||
|
||||
> If the argument bound to the catch block is not referenced in the catch block, that argument and the catch binding is removed.
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
```js
|
||||
try {
|
||||
throw 0;
|
||||
} catch (err) {
|
||||
console.log("it failed, but this code executes");
|
||||
}
|
||||
```
|
||||
Is transformed to:
|
||||
|
||||
```js
|
||||
try {
|
||||
throw 0;
|
||||
} catch {
|
||||
console.log("it failed, but this code executes");
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install --save-dev babel-plugin-codemod-optional-catch-binding
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Via `.babelrc` (Recommended)
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["codemod-optional-catch-binding"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins codemod-optional-catch-binding script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("babel-core").transform("code", {
|
||||
plugins: ["codemod-optional-catch-binding"]
|
||||
});
|
||||
```
|
||||
|
||||
## References
|
||||
This codemod updates your source code in line with the following proposal:
|
||||
- [Proposal: Optional Catch Binding for ECMAScript](https://github.com/babel/proposals/issues/7)
|
||||
@@ -0,0 +1,37 @@
|
||||
"use strict";
|
||||
|
||||
exports.__esModule = true;
|
||||
|
||||
exports.default = function (babel) {
|
||||
const {
|
||||
types: t
|
||||
} = babel;
|
||||
return {
|
||||
inherits: _babelPluginSyntaxOptionalCatchBinding2.default,
|
||||
visitor: {
|
||||
CatchClause(path) {
|
||||
if (path.node.param === null || !t.isIdentifier(path.node.param)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const binding = path.scope.getOwnBinding(path.node.param.name);
|
||||
|
||||
if (binding.constantViolations.length > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!binding.referenced) {
|
||||
const paramPath = path.get("param");
|
||||
paramPath.remove();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
var _babelPluginSyntaxOptionalCatchBinding = require("babel-plugin-syntax-optional-catch-binding");
|
||||
|
||||
var _babelPluginSyntaxOptionalCatchBinding2 = _interopRequireDefault(_babelPluginSyntaxOptionalCatchBinding);
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"name": "babel-plugin-codemod-optional-catch-binding",
|
||||
"version": "7.0.0-beta.0",
|
||||
"description": "Remove unused catch bindings",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-remove-unused-catch-binding",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"keywords": [
|
||||
"babel-plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"babel-plugin-syntax-optional-catch-binding": "7.0.0-beta.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-helper-plugin-test-runner": "7.0.0-beta.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import syntaxOptionalCatchBinding from "babel-plugin-syntax-optional-catch-binding";
|
||||
|
||||
export default function(babel) {
|
||||
const { types: t } = babel;
|
||||
return {
|
||||
inherits: syntaxOptionalCatchBinding,
|
||||
|
||||
visitor: {
|
||||
CatchClause(path) {
|
||||
if (path.node.param === null || !t.isIdentifier(path.node.param)) {
|
||||
return;
|
||||
}
|
||||
const binding = path.scope.getOwnBinding(path.node.param.name);
|
||||
if (binding.constantViolations.length > 0) {
|
||||
return;
|
||||
}
|
||||
if (!binding.referenced) {
|
||||
const paramPath = path.get("param");
|
||||
paramPath.remove();
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"plugins": ["transform-remove-unused-catch-binding"]
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch (e) {
|
||||
let e = new TypeError('Duplicate variable declaration; will throw an error.');
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"throws": "Duplicate declaration \"e\""
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch {
|
||||
console.log("it failed, but this code executes");
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch {
|
||||
console.log("it failed, but this code executes");
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch ([message]) {
|
||||
console.log("it failed, but this code executes");
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch ([message]) {
|
||||
console.log("it failed, but this code executes");
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch (err) {
|
||||
console.log("it failed, but this code executes");
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch {
|
||||
console.log("it failed, but this code executes");
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch ({
|
||||
message
|
||||
}) {
|
||||
console.log("it failed, but this code executes");
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch ({
|
||||
message
|
||||
}) {
|
||||
console.log("it failed, but this code executes");
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch ([message]) {
|
||||
console.log(message);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch ([message]) {
|
||||
console.log(message);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch (e) {
|
||||
e = new TypeError('A new variable is not being declared or initialized; the catch binding is being referenced and cannot be removed.');
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch (e) {
|
||||
e = new TypeError('A new variable is not being declared or initialized; the catch binding is being referenced and cannot be removed.');
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch (err) {
|
||||
console.log(err, "it failed, but this code executes");
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch (err) {
|
||||
console.log(err, "it failed, but this code executes");
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch ({
|
||||
message
|
||||
}) {
|
||||
console.log(message);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch ({
|
||||
message
|
||||
}) {
|
||||
console.log(message);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch (err) {
|
||||
console.log("it failed, but this code executes");
|
||||
} finally {
|
||||
console.log("this code also executes");
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch {
|
||||
console.log("it failed, but this code executes");
|
||||
} finally {
|
||||
console.log("this code also executes");
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch (err) {
|
||||
console.log(err, "it failed, but this code executes");
|
||||
} finally {
|
||||
console.log("this code also executes");
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
try {
|
||||
throw 0;
|
||||
} catch (err) {
|
||||
console.log(err, "it failed, but this code executes");
|
||||
} finally {
|
||||
console.log("this code also executes");
|
||||
}
|
||||
@@ -21,7 +21,6 @@ This is quite taboo but let's look at the pros and cons:
|
||||
|
||||
* Codebase looks more intimidating.
|
||||
* Repo is bigger in size.
|
||||
* Lower ranking in [npms](https://npms.io/) results. At least until [npms-io/npms-analyzer#83](https://github.com/npms-io/npms-analyzer/issues/83) is fixed.
|
||||
* ???
|
||||
|
||||
## This is dumb! Nobody in open source does this!
|
||||
|
||||
46
eslint_rules/no-undefined-identifier.js
Normal file
46
eslint_rules/no-undefined-identifier.js
Normal file
@@ -0,0 +1,46 @@
|
||||
"use strict";
|
||||
|
||||
function argumentsIsUndefinedString(argumentsArray) {
|
||||
return (
|
||||
argumentsArray.length === 1 &&
|
||||
argumentsArray[0].type === "Literal" &&
|
||||
argumentsArray[0].value === "undefined"
|
||||
);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
schema: [],
|
||||
},
|
||||
create: function(context) {
|
||||
if (context.getFilename().indexOf("packages/babel-plugin-") === -1) {
|
||||
return {};
|
||||
}
|
||||
|
||||
return {
|
||||
CallExpression: function(node) {
|
||||
const callee = node.callee;
|
||||
|
||||
if (
|
||||
callee.type === "MemberExpression" &&
|
||||
argumentsIsUndefinedString(node.arguments)
|
||||
) {
|
||||
const object = callee.object,
|
||||
property = callee.property;
|
||||
|
||||
if (
|
||||
object.type === "Identifier" &&
|
||||
object.name === "t" &&
|
||||
property.type === "Identifier" &&
|
||||
property.name === "identifier"
|
||||
) {
|
||||
context.report(
|
||||
node,
|
||||
"Use path.scope.buildUndefinedNode() to create an undefined identifier directly."
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
};
|
||||
16
lerna.json
16
lerna.json
@@ -1,16 +1,16 @@
|
||||
{
|
||||
"lerna": "2.0.0-rc.4",
|
||||
"version": "7.0.0-alpha.12",
|
||||
"version": "7.0.0-beta.1",
|
||||
"changelog": {
|
||||
"repo": "babel/babel",
|
||||
"labels": {
|
||||
"tag: spec compliancy": ":eyeglasses: Spec Compliancy",
|
||||
"tag: breaking change": ":boom: Breaking Change",
|
||||
"tag: new feature": ":rocket: New Feature",
|
||||
"tag: bug fix": ":bug: Bug Fix",
|
||||
"tag: polish": ":nail_care: Polish",
|
||||
"tag: documentation": ":memo: Documentation",
|
||||
"tag: internal": ":house: Internal"
|
||||
"Tag: Spec Compliancy": ":eyeglasses: Spec Compliancy",
|
||||
"Tag: Breaking Change": ":boom: Breaking Change",
|
||||
"Tag: New Feature": ":rocket: New Feature",
|
||||
"Tag: Bug Fix": ":bug: Bug Fix",
|
||||
"Tag: Polish": ":nail_care: Polish",
|
||||
"Tag: Docs": ":memo: Documentation",
|
||||
"Tag: Internal": ":house: Internal"
|
||||
}
|
||||
},
|
||||
"cacheDir": ".changelog",
|
||||
|
||||
790
lib/types.js
790
lib/types.js
File diff suppressed because it is too large
Load Diff
62
package.json
62
package.json
@@ -3,59 +3,71 @@
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "make test",
|
||||
"build": "make build",
|
||||
"fix": "make fix",
|
||||
"lint": "make lint",
|
||||
"fix": "make fix"
|
||||
"precommit": "lint-staged",
|
||||
"test": "make test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"async": "^1.5.0",
|
||||
"babel-cli": "7.0.0-alpha.9",
|
||||
"babel-core": "7.0.0-alpha.9",
|
||||
"babel-eslint": "^7.0.0",
|
||||
"babel-plugin-istanbul": "^2.0.1",
|
||||
"babel-preset-env": "2.0.0-alpha.7",
|
||||
"babel-preset-flow": "7.0.0-alpha.9",
|
||||
"babel-preset-stage-0": "7.0.0-alpha.9",
|
||||
"babel-register": "7.0.0-alpha.9",
|
||||
"babel-cli": "7.0.0-alpha.18",
|
||||
"babel-core": "7.0.0-alpha.18",
|
||||
"babel-eslint": "8.0.0-alpha.15",
|
||||
"babel-plugin-istanbul": "^4.1.4",
|
||||
"babel-preset-env": "2.0.0-alpha.18",
|
||||
"babel-preset-flow": "7.0.0-alpha.18",
|
||||
"babel-preset-stage-0": "7.0.0-alpha.18",
|
||||
"babel-register": "7.0.0-alpha.18",
|
||||
"babylon": "7.0.0-beta.22",
|
||||
"browserify": "^13.1.1",
|
||||
"bundle-collapser": "^1.2.1",
|
||||
"chai": "^3.5.0",
|
||||
"chalk": "1.1.1",
|
||||
"codecov": "^1.0.1",
|
||||
"chai": "^4.1.0",
|
||||
"chalk": "^2.0.0",
|
||||
"derequire": "^2.0.2",
|
||||
"eslint": "^3.9.0",
|
||||
"eslint-config-babel": "^6.0.0",
|
||||
"eslint": "^4.5.0",
|
||||
"eslint-config-babel": "^7.0.2",
|
||||
"eslint-plugin-flowtype": "^2.20.0",
|
||||
"flow-bin": "^0.41.0",
|
||||
"eslint-plugin-prettier": "^2.2.0",
|
||||
"flow-bin": "^0.53.1",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-babel": "babel/gulp-babel#b7-alpha",
|
||||
"gulp-babel": "^7.0.0",
|
||||
"gulp-newer": "^1.0.0",
|
||||
"gulp-plumber": "^1.0.1",
|
||||
"gulp-util": "^3.0.7",
|
||||
"gulp-watch": "^4.3.5",
|
||||
"lerna": "2.0.0-rc.4",
|
||||
"lerna-changelog": "^0.2.0",
|
||||
"husky": "^0.14.3",
|
||||
"lerna": "2.0.0",
|
||||
"lerna-changelog": "^0.5.0",
|
||||
"lint-staged": "^4.0.4",
|
||||
"lodash": "^4.2.0",
|
||||
"mocha": "^3.0.0",
|
||||
"nyc": "^10.0.0",
|
||||
"output-file-sync": "^1.1.1",
|
||||
"nyc": "^11.0.3",
|
||||
"output-file-sync": "^2.0.0",
|
||||
"prettier": "^1.6.1",
|
||||
"rimraf": "^2.4.3",
|
||||
"semver": "^5.0.0",
|
||||
"through2": "^2.0.0",
|
||||
"uglify-js": "^2.4.16"
|
||||
},
|
||||
"devEngines": {
|
||||
"node": ">= 4.x <= 7.x",
|
||||
"npm": "2.x || 3.x || 4.x"
|
||||
"engines": {
|
||||
"node": ">= 4.x <= 8.x",
|
||||
"npm": ">= 2.x <= 5.x",
|
||||
"yarn": ">=0.27.5 || >=1.0.0-20170811"
|
||||
},
|
||||
"nyc": {
|
||||
"all": true,
|
||||
"exclude": [
|
||||
"scripts/*.js",
|
||||
"packages/*/test/**"
|
||||
"packages/*/test/**",
|
||||
"packages/babel-standalone/**"
|
||||
],
|
||||
"sourceMap": false,
|
||||
"instrument": false
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"eslint --format=codeframe --rulesdir='./eslint_rules'"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
6
packages/.eslintrc
Normal file
6
packages/.eslintrc
Normal file
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"rules": {
|
||||
"prettier/prettier": ["error", { "trailingComma": "all" }],
|
||||
"no-undefined-identifier": 2
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,85 @@
|
||||
# Woah, what's going on here?
|
||||
|
||||
A monorepo, muhahahahahaha. See the [monorepo design doc](/doc/design/monorepo.md) for reasoning.
|
||||
|
||||
- [Core Packages](#core-packages)
|
||||
- [Other](#other)
|
||||
- [Presets](#presets)
|
||||
- [Plugins](#plugins)
|
||||
- [Transform Plugins](#transform-plugins)
|
||||
- [Syntax Plugins](#syntax-plugins)
|
||||
|
||||
### Core Packages
|
||||
|
||||
| Package | Version | Dependencies |
|
||||
|--------|-------|------------|
|
||||
| [`babel-core`](/packages/babel-core) | [](https://www.npmjs.com/package/babel-core) | [](https://david-dm.org/babel/babel?path=packages/babel-core) |
|
||||
| [`babylon`](https://github.com/babel/babylon) | [](https://www.npmjs.com/package/babylon) | [](https://david-dm.org/babel/babylon) |
|
||||
| [`babel-traverse`](/packages/babel-traverse) | [](https://www.npmjs.com/package/babel-traverse) | [](https://david-dm.org/babel/babel?path=packages/babel-traverse) |
|
||||
| [`babel-generator`](/packages/babel-generator) | [](https://www.npmjs.com/package/babel-generator) | [](https://david-dm.org/babel/babel?path=packages/babel-generator) |
|
||||
|
||||
[`babel-core`](/packages/babel-core) is the Babel compiler itself; it exposes the `babel.transform` method, where `transformedCode = transform(src).code`.
|
||||
|
||||
The compiler can be broken down into 3 parts:
|
||||
- The parser: [`babylon`](https://github.com/babel/babylon) (moved to a separate repo and versioned independently)
|
||||
- The transformer[s]: All the plugins/presets
|
||||
- These all use [`babel-traverse`](/packages/babel-traverse) to traverse through the AST
|
||||
- The generator: [`babel-generator`](/packages/babel-generator)
|
||||
|
||||
The flow goes like this:
|
||||
|
||||
input string -> `babylon` parser -> `AST` -> transformer[s] -> `AST` -> `babel-generator` -> output string
|
||||
|
||||
Check out the [`babel-handbook`](https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md#introduction) for more information on this.
|
||||
|
||||
#### Other
|
||||
|
||||
| Package | Version | Dependencies |
|
||||
|--------|-------|------------|
|
||||
| [`babel-cli`](/packages/babel-cli) | [](https://www.npmjs.com/package/babel-cli) | [](https://david-dm.org/babel/babel?path=packages/babel-cli) |
|
||||
| [`babel-types`](/packages/babel-types) | [](https://www.npmjs.com/package/babel-types) | [](https://david-dm.org/babel/babel?path=packages/babel-types) |
|
||||
| [`babel-polyfill`](/packages/babel-polyfill) | [](https://www.npmjs.com/package/babel-polyfill) | [](https://david-dm.org/babel/babel?path=packages/babel-polyfill) |
|
||||
| [`babel-runtime`](/packages/babel-runtime) | [](https://www.npmjs.com/package/babel-runtime) | [](https://david-dm.org/babel/babel?path=packages/babel-runtime) |
|
||||
| [`babel-register`](/packages/babel-register) | [](https://www.npmjs.com/package/babel-register) | [](https://david-dm.org/babel/babel?path=packages/babel-register) |
|
||||
| [`babel-template`](/packages/babel-template) | [](https://www.npmjs.com/package/babel-template) | [](https://david-dm.org/babel/babel?path=packages/babel-template) |
|
||||
| [`babel-helpers`](/packages/babel-helpers) | [](https://www.npmjs.com/package/babel-helpers) | [](https://david-dm.org/babel/babel?path=packages/babel-helpers) |
|
||||
| [`babel-code-frame`](/packages/babel-code-frame) | [](https://www.npmjs.com/package/babel-code-frame) | [](https://david-dm.org/babel/babel?path=packages/babel-code-frame) |
|
||||
|
||||
- [`babel-cli`](/packages/babel-cli) is the CLI tool that runs `babel-core` and helps with outputting to a directory, a file, stdout and more (also includes `babel-node`). Check out the [docs](https://babeljs.io/docs/usage/cli/).
|
||||
- [`babel-types`](/packages/babel-types) is used to validate, build and change AST nodes.
|
||||
- [`babel-polyfill`](/packages/babel-polyfill) is [literally a wrapper](https://github.com/babel/babel/blob/master/packages/babel-polyfill/src/index.js) around [`core-js`](https://github.com/zloirock/core-js) and [regenerator-runtime](https://github.com/facebook/regenerator/tree/master/packages/regenerator-runtime). Check out the [docs](https://babeljs.io/docs/usage/polyfill/).
|
||||
- [`babel-runtime`](/packages/babel-runtime) is similar to the polyfill except that it doesn't modify the global scope and is to be used with [`babel-plugin-transform-runtime`](/packages/babel-plugin-transform-runtime) (usually in library/plugin code). Check out the [docs](https://babeljs.io/docs/plugins/transform-runtime/).
|
||||
- [`babel-register`](/packages/babel-register) is a way to automatically compile files with Babel on the fly by binding to Node.js `require`. Check out the [docs](http://babeljs.io/docs/usage/require/).
|
||||
- [`babel-template`](/packages/babel-template) is a helper function that allows constructing AST nodes from a string presentation of the code; this eliminates the tedium of using `babel-types` for building AST nodes.
|
||||
- [`babel-helpers`](/packages/babel-helpers) is a set of pre-made `babel-template` functions that are used in some Babel plugins.
|
||||
- [`babel-code-frame`](/packages/babel-code-frame) is a standalone package used to generate errors that print the source code and point to error locations.
|
||||
|
||||
### [Presets](http://babeljs.io/docs/plugins/#presets)
|
||||
|
||||
After Babel 6, the default transforms were removed; if you don't specify any plugins/presets, Babel will just return the original source code.
|
||||
|
||||
The transformer[s] used in Babel are the independent pieces of code that transform specific things. For example: the [`es2015-arrow-functions`](/packages/babel-plugin-transform-es2015-arrow-functions) transform specifically changes arrow functions into regular functions. A preset is simply an array of plugins that make it easier to run a whole a set of transforms without specifying each one manually.
|
||||
|
||||
| Package | Version | Dependencies | Description |
|
||||
|--------|-------|------------|---|
|
||||
| [`babel-preset-env`](https://github.com/babel/babel-preset-env) | [](https://www.npmjs.com/package/babel-preset-env) | [](https://david-dm.org/babel/babel-preset-env) | automatically determines plugins and polyfills you need based on your supported environments |
|
||||
|
||||
> You can find community maintained presets on [npm](https://www.npmjs.com/search?q=babel-preset)
|
||||
|
||||
### [Plugins](http://babeljs.io/docs/plugins)
|
||||
|
||||
Plugins are the heart of Babel and what make it work.
|
||||
|
||||
> You can find community plugins on [npm](https://www.npmjs.com/search?q=babel-plugin).
|
||||
|
||||
#### Transform Plugins
|
||||
|
||||
There are many kinds of plugins: ones that convert ES6/ES2015 to ES5, transform to ES3, minification, JSX, flow, experimental features, and more. Check out our [website for more](http://babeljs.io/docs/plugins/#transform-plugins).
|
||||
|
||||
#### Syntax Plugins
|
||||
|
||||
These just enable the transform plugins to be able to parse certain features (the transform plugins already include the syntax plugins so you don't need both): `babel-plugin-syntax-x`. Check out our [website for more](http://babeljs.io/docs/plugins/#syntax-plugins).
|
||||
|
||||
### Helpers
|
||||
|
||||
These are mostly for internal use in various plugins: `babel-helper-x`.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "babel-cli",
|
||||
"version": "7.0.0-alpha.12",
|
||||
"version": "7.0.0-beta.1",
|
||||
"description": "Babel command line.",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -16,24 +16,24 @@
|
||||
"compiler"
|
||||
],
|
||||
"dependencies": {
|
||||
"babel-core": "7.0.0-alpha.12",
|
||||
"babel-polyfill": "7.0.0-alpha.12",
|
||||
"babel-register": "7.0.0-alpha.12",
|
||||
"babel-core": "7.0.0-beta.1",
|
||||
"babel-polyfill": "7.0.0-beta.1",
|
||||
"babel-register": "7.0.0-beta.1",
|
||||
"commander": "^2.8.1",
|
||||
"convert-source-map": "^1.1.0",
|
||||
"fs-readdir-recursive": "^1.0.0",
|
||||
"glob": "^7.0.0",
|
||||
"lodash": "^4.2.0",
|
||||
"output-file-sync": "^1.1.0",
|
||||
"output-file-sync": "^2.0.0",
|
||||
"slash": "^1.0.0",
|
||||
"source-map": "^0.5.0",
|
||||
"v8flags": "^2.0.10"
|
||||
"v8flags": "^3.0.0"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"chokidar": "^1.6.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-helper-fixtures": "7.0.0-alpha.12"
|
||||
"babel-helper-fixtures": "7.0.0-beta.1"
|
||||
},
|
||||
"bin": {
|
||||
"babel-doctor": "./bin/babel-doctor.js",
|
||||
|
||||
@@ -24,9 +24,21 @@ function collect(value, previousValue): Array<string> {
|
||||
/* eslint-disable max-len */
|
||||
program.option("-e, --eval [script]", "Evaluate script");
|
||||
program.option("-p, --print [code]", "Evaluate script and print result");
|
||||
program.option("-o, --only [globs]", "A comma-separated list of glob patterns to compile", collect);
|
||||
program.option("-i, --ignore [globs]", "A comma-separated list of glob patterns to skip compiling", collect);
|
||||
program.option("-x, --extensions [extensions]", "List of extensions to hook into [.es6,.js,.es,.jsx,.mjs]", collect);
|
||||
program.option(
|
||||
"-o, --only [globs]",
|
||||
"A comma-separated list of glob patterns to compile",
|
||||
collect,
|
||||
);
|
||||
program.option(
|
||||
"-i, --ignore [globs]",
|
||||
"A comma-separated list of glob patterns to skip compiling",
|
||||
collect,
|
||||
);
|
||||
program.option(
|
||||
"-x, --extensions [extensions]",
|
||||
"List of extensions to hook into [.es6,.js,.es,.jsx,.mjs]",
|
||||
collect,
|
||||
);
|
||||
program.option("-w, --plugins [string]", "", collect);
|
||||
program.option("-b, --presets [string]", "", collect);
|
||||
/* eslint-enable max-len */
|
||||
@@ -55,23 +67,28 @@ const replPlugin = ({ types: t }) => ({
|
||||
|
||||
VariableDeclaration(path) {
|
||||
if (path.node.kind !== "var") {
|
||||
throw path.buildCodeFrameError("Only `var` variables are supported in the REPL");
|
||||
throw path.buildCodeFrameError(
|
||||
"Only `var` variables are supported in the REPL",
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
Program(path) {
|
||||
if (path.get("body").some((child) => child.isExpressionStatement())) return;
|
||||
if (path.get("body").some(child => child.isExpressionStatement())) return;
|
||||
|
||||
// If the executed code doesn't evaluate to a value,
|
||||
// prevent implicit strict mode from printing 'use strict'.
|
||||
path.pushContainer("body", t.expressionStatement(t.identifier("undefined")));
|
||||
path.pushContainer(
|
||||
"body",
|
||||
t.expressionStatement(t.identifier("undefined")),
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
//
|
||||
|
||||
const _eval = function (code, filename) {
|
||||
const _eval = function(code, filename) {
|
||||
code = code.trim();
|
||||
if (!code) return undefined;
|
||||
|
||||
@@ -113,7 +130,7 @@ if (program.eval || program.print) {
|
||||
|
||||
let i = 0;
|
||||
let ignoreNext = false;
|
||||
args.some(function (arg, i2) {
|
||||
args.some(function(arg, i2) {
|
||||
if (ignoreNext) {
|
||||
ignoreNext = false;
|
||||
return;
|
||||
@@ -133,7 +150,9 @@ if (program.eval || program.print) {
|
||||
|
||||
// make the filename absolute
|
||||
const filename = args[0];
|
||||
if (!path.isAbsolute(filename)) args[0] = path.join(process.cwd(), filename);
|
||||
if (!path.isAbsolute(filename)) {
|
||||
args[0] = path.join(process.cwd(), filename);
|
||||
}
|
||||
|
||||
// add back on node and concat the sliced args
|
||||
process.argv = ["node"].concat(args);
|
||||
|
||||
@@ -10,8 +10,16 @@ function collect(value, previousValue): Array<string> {
|
||||
return previousValue ? previousValue.concat(values) : values;
|
||||
}
|
||||
|
||||
commander.option("-l, --whitelist [whitelist]", "Whitelist of helpers to ONLY include", collect);
|
||||
commander.option("-t, --output-type [type]", "Type of output (global|umd|var)", "global");
|
||||
commander.option(
|
||||
"-l, --whitelist [whitelist]",
|
||||
"Whitelist of helpers to ONLY include",
|
||||
collect,
|
||||
);
|
||||
commander.option(
|
||||
"-t, --output-type [type]",
|
||||
"Type of output (global|umd|var)",
|
||||
"global",
|
||||
);
|
||||
|
||||
commander.usage("[options]");
|
||||
commander.parse(process.argv);
|
||||
|
||||
@@ -33,7 +33,7 @@ function getNormalizedV8Flag(arg) {
|
||||
return arg;
|
||||
}
|
||||
|
||||
getV8Flags(function (err, v8Flags) {
|
||||
getV8Flags(function(err, v8Flags) {
|
||||
babelArgs.forEach(function(arg) {
|
||||
const flag = arg.split("=")[0];
|
||||
|
||||
@@ -54,12 +54,19 @@ getV8Flags(function (err, v8Flags) {
|
||||
args.unshift("--expose-gc");
|
||||
break;
|
||||
|
||||
case "--expose-http2":
|
||||
args.unshift("--expose-http2");
|
||||
break;
|
||||
|
||||
case "--nolazy":
|
||||
args.unshift(flag);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (v8Flags.indexOf(getNormalizedV8Flag(flag)) >= 0 || arg.indexOf("--trace") === 0) {
|
||||
if (
|
||||
v8Flags.indexOf(getNormalizedV8Flag(flag)) >= 0 ||
|
||||
arg.indexOf("--trace") === 0
|
||||
) {
|
||||
args.unshift(arg);
|
||||
} else {
|
||||
args.push(arg);
|
||||
@@ -80,9 +87,11 @@ getV8Flags(function (err, v8Flags) {
|
||||
if (err.code !== "MODULE_NOT_FOUND") throw err;
|
||||
|
||||
const child_process = require("child_process");
|
||||
const proc = child_process.spawn(process.argv[0], args, { stdio: "inherit" });
|
||||
proc.on("exit", function (code, signal) {
|
||||
process.on("exit", function () {
|
||||
const proc = child_process.spawn(process.argv[0], args, {
|
||||
stdio: "inherit",
|
||||
});
|
||||
proc.on("exit", function(code, signal) {
|
||||
process.on("exit", function() {
|
||||
if (signal) {
|
||||
process.kill(process.pid, signal);
|
||||
} else {
|
||||
@@ -90,5 +99,10 @@ getV8Flags(function (err, v8Flags) {
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
process.on("SIGINT", () => {
|
||||
proc.kill("SIGINT");
|
||||
process.exit(1);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -6,19 +6,27 @@ import fs from "fs";
|
||||
|
||||
import * as util from "./util";
|
||||
|
||||
export default function (commander, filenames, opts) {
|
||||
function write(src, relative) {
|
||||
if (!util.isCompilableExtension(relative, commander.extensions)) return false;
|
||||
export default function(commander, filenames, opts) {
|
||||
function write(src, relative, base) {
|
||||
if (!util.isCompilableExtension(relative, commander.extensions)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// remove extension and then append back on .js
|
||||
relative = relative.replace(/\.(\w*?)$/, "") + ".js";
|
||||
relative = util.adjustRelative(relative, commander.keepFileExtension);
|
||||
|
||||
const dest = path.join(commander.outDir, relative);
|
||||
const dest = getDest(commander, relative, base);
|
||||
|
||||
const data = util.compile(src, defaults({
|
||||
sourceFileName: slash(path.relative(dest + "/..", src)),
|
||||
sourceMapTarget: path.basename(relative),
|
||||
}, opts));
|
||||
const data = util.compile(
|
||||
src,
|
||||
defaults(
|
||||
{
|
||||
sourceFileName: slash(path.relative(dest + "/..", src)),
|
||||
sourceMapTarget: path.basename(relative),
|
||||
},
|
||||
opts,
|
||||
),
|
||||
);
|
||||
|
||||
if (!data) return false;
|
||||
|
||||
@@ -37,11 +45,16 @@ export default function (commander, filenames, opts) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function handleFile(src, filename) {
|
||||
const didWrite = write(src, filename);
|
||||
function getDest(commander, filename, base) {
|
||||
if (commander.relative) return path.join(base, commander.outDir, filename);
|
||||
return path.join(commander.outDir, filename);
|
||||
}
|
||||
|
||||
function handleFile(src, filename, base) {
|
||||
const didWrite = write(src, filename, base);
|
||||
|
||||
if (!didWrite && commander.copyFiles) {
|
||||
const dest = path.join(commander.outDir, filename);
|
||||
const dest = getDest(commander, filename, base);
|
||||
outputFileSync(dest, fs.readFileSync(src));
|
||||
util.chmod(src, dest);
|
||||
}
|
||||
@@ -55,12 +68,15 @@ export default function (commander, filenames, opts) {
|
||||
if (stat.isDirectory(filename)) {
|
||||
const dirname = filename;
|
||||
|
||||
util.readdir(dirname).forEach(function (filename) {
|
||||
if (commander.deleteDirOnStart) {
|
||||
util.deleteDir(commander.outDir);
|
||||
}
|
||||
util.readdir(dirname).forEach(function(filename) {
|
||||
const src = path.join(dirname, filename);
|
||||
handleFile(src, filename);
|
||||
handleFile(src, filename, dirname);
|
||||
});
|
||||
} else {
|
||||
write(filename, filename);
|
||||
write(filename, path.basename(filename), path.dirname(filename));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +87,7 @@ export default function (commander, filenames, opts) {
|
||||
if (commander.watch) {
|
||||
const chokidar = util.requireChokidar();
|
||||
|
||||
filenames.forEach(function (dirname) {
|
||||
filenames.forEach(function(dirname) {
|
||||
const watcher = chokidar.watch(dirname, {
|
||||
persistent: true,
|
||||
ignoreInitial: true,
|
||||
@@ -81,8 +97,8 @@ export default function (commander, filenames, opts) {
|
||||
},
|
||||
});
|
||||
|
||||
["add", "change"].forEach(function (type) {
|
||||
watcher.on(type, function (filename) {
|
||||
["add", "change"].forEach(function(type) {
|
||||
watcher.on(type, function(filename) {
|
||||
const relative = path.relative(dirname, filename) || filename;
|
||||
try {
|
||||
handleFile(filename, relative);
|
||||
|
||||
@@ -7,14 +7,14 @@ import fs from "fs";
|
||||
|
||||
import * as util from "./util";
|
||||
|
||||
export default function (commander, filenames, opts) {
|
||||
export default function(commander, filenames, opts) {
|
||||
if (commander.sourceMaps === "inline") {
|
||||
opts.sourceMaps = true;
|
||||
}
|
||||
|
||||
let results = [];
|
||||
|
||||
const buildResult = function () {
|
||||
const buildResult = function() {
|
||||
const map = new sourceMap.SourceMapGenerator({
|
||||
file: path.basename(commander.outFile || "") || "stdout",
|
||||
sourceRoot: opts.sourceRoot,
|
||||
@@ -23,14 +23,14 @@ export default function (commander, filenames, opts) {
|
||||
let code = "";
|
||||
let offset = 0;
|
||||
|
||||
results.forEach(function (result) {
|
||||
results.forEach(function(result) {
|
||||
code += result.code + "\n";
|
||||
|
||||
if (result.map) {
|
||||
const consumer = new sourceMap.SourceMapConsumer(result.map);
|
||||
const sources = new Set();
|
||||
|
||||
consumer.eachMapping(function (mapping) {
|
||||
consumer.eachMapping(function(mapping) {
|
||||
if (mapping.source != null) sources.add(mapping.source);
|
||||
|
||||
map.addMapping({
|
||||
@@ -39,14 +39,17 @@ export default function (commander, filenames, opts) {
|
||||
column: mapping.generatedColumn,
|
||||
},
|
||||
source: mapping.source,
|
||||
original: mapping.source == null ? null : {
|
||||
line: mapping.originalLine,
|
||||
column: mapping.originalColumn,
|
||||
},
|
||||
original:
|
||||
mapping.source == null
|
||||
? null
|
||||
: {
|
||||
line: mapping.originalLine,
|
||||
column: mapping.originalColumn,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
sources.forEach((source) => {
|
||||
sources.forEach(source => {
|
||||
const content = consumer.sourceContentFor(source, true);
|
||||
if (content !== null) {
|
||||
map.setSourceContent(source, content);
|
||||
@@ -59,7 +62,10 @@ export default function (commander, filenames, opts) {
|
||||
|
||||
// add the inline sourcemap comment if we've either explicitly asked for inline source
|
||||
// maps, or we've requested them without any output file
|
||||
if (commander.sourceMaps === "inline" || (!commander.outFile && commander.sourceMaps)) {
|
||||
if (
|
||||
commander.sourceMaps === "inline" ||
|
||||
(!commander.outFile && commander.sourceMaps)
|
||||
) {
|
||||
code += "\n" + convertSourceMap.fromObject(map).toComment();
|
||||
}
|
||||
|
||||
@@ -69,7 +75,7 @@ export default function (commander, filenames, opts) {
|
||||
};
|
||||
};
|
||||
|
||||
const output = function () {
|
||||
const output = function() {
|
||||
const result = buildResult();
|
||||
|
||||
if (commander.outFile) {
|
||||
@@ -86,36 +92,45 @@ export default function (commander, filenames, opts) {
|
||||
}
|
||||
};
|
||||
|
||||
const stdin = function () {
|
||||
const stdin = function() {
|
||||
let code = "";
|
||||
|
||||
process.stdin.setEncoding("utf8");
|
||||
|
||||
process.stdin.on("readable", function () {
|
||||
process.stdin.on("readable", function() {
|
||||
const chunk = process.stdin.read();
|
||||
if (chunk !== null) code += chunk;
|
||||
});
|
||||
|
||||
process.stdin.on("end", function () {
|
||||
results.push(util.transform(commander.filename, code, defaults({
|
||||
sourceFileName: "stdin",
|
||||
}, opts)));
|
||||
process.stdin.on("end", function() {
|
||||
results.push(
|
||||
util.transform(
|
||||
commander.filename,
|
||||
code,
|
||||
defaults(
|
||||
{
|
||||
sourceFileName: "stdin",
|
||||
},
|
||||
opts,
|
||||
),
|
||||
),
|
||||
);
|
||||
output();
|
||||
});
|
||||
};
|
||||
|
||||
const walk = function () {
|
||||
const walk = function() {
|
||||
const _filenames = [];
|
||||
results = [];
|
||||
|
||||
filenames.forEach(function (filename) {
|
||||
filenames.forEach(function(filename) {
|
||||
if (!fs.existsSync(filename)) return;
|
||||
|
||||
const stat = fs.statSync(filename);
|
||||
if (stat.isDirectory()) {
|
||||
const dirname = filename;
|
||||
|
||||
util.readdirFilter(filename).forEach(function (filename) {
|
||||
util.readdirFilter(filename).forEach(function(filename) {
|
||||
_filenames.push(path.join(dirname, filename));
|
||||
});
|
||||
} else {
|
||||
@@ -123,16 +138,25 @@ export default function (commander, filenames, opts) {
|
||||
}
|
||||
});
|
||||
|
||||
_filenames.forEach(function (filename) {
|
||||
_filenames.forEach(function(filename) {
|
||||
let sourceFilename = filename;
|
||||
if (commander.outFile) {
|
||||
sourceFilename = path.relative(path.dirname(commander.outFile), sourceFilename);
|
||||
sourceFilename = path.relative(
|
||||
path.dirname(commander.outFile),
|
||||
sourceFilename,
|
||||
);
|
||||
}
|
||||
sourceFilename = slash(sourceFilename);
|
||||
|
||||
const data = util.compile(filename, defaults({
|
||||
sourceFileName: sourceFilename,
|
||||
}, opts));
|
||||
const data = util.compile(
|
||||
filename,
|
||||
defaults(
|
||||
{
|
||||
sourceFileName: sourceFilename,
|
||||
},
|
||||
opts,
|
||||
),
|
||||
);
|
||||
|
||||
if (!data) return;
|
||||
|
||||
@@ -142,33 +166,36 @@ export default function (commander, filenames, opts) {
|
||||
output();
|
||||
};
|
||||
|
||||
const files = function () {
|
||||
|
||||
const files = function() {
|
||||
if (!commander.skipInitialBuild) {
|
||||
walk();
|
||||
}
|
||||
|
||||
if (commander.watch) {
|
||||
const chokidar = util.requireChokidar();
|
||||
chokidar.watch(filenames, {
|
||||
persistent: true,
|
||||
ignoreInitial: true,
|
||||
awaitWriteFinish: {
|
||||
stabilityThreshold: 50,
|
||||
pollInterval: 10,
|
||||
},
|
||||
}).on("all", function (type, filename) {
|
||||
if (!util.isCompilableExtension(filename, commander.extensions)) return;
|
||||
|
||||
if (type === "add" || type === "change") {
|
||||
util.log(type + " " + filename);
|
||||
try {
|
||||
walk();
|
||||
} catch (err) {
|
||||
console.error(err.stack);
|
||||
chokidar
|
||||
.watch(filenames, {
|
||||
persistent: true,
|
||||
ignoreInitial: true,
|
||||
awaitWriteFinish: {
|
||||
stabilityThreshold: 50,
|
||||
pollInterval: 10,
|
||||
},
|
||||
})
|
||||
.on("all", function(type, filename) {
|
||||
if (!util.isCompilableExtension(filename, commander.extensions)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (type === "add" || type === "change") {
|
||||
util.log(type + " " + filename);
|
||||
try {
|
||||
walk();
|
||||
} catch (err) {
|
||||
console.error(err.stack);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -34,46 +34,131 @@ function collect(value, previousValue): Array<string> {
|
||||
|
||||
/* eslint-disable max-len */
|
||||
// Standard Babel input configs.
|
||||
commander.option("-f, --filename [filename]", "filename to use when reading from stdin - this will be used in source-maps, errors etc");
|
||||
commander.option("--presets [list]", "comma-separated list of preset names", collect);
|
||||
commander.option("--plugins [list]", "comma-separated list of plugin names", collect);
|
||||
commander.option(
|
||||
"-f, --filename [filename]",
|
||||
"filename to use when reading from stdin - this will be used in source-maps, errors etc",
|
||||
);
|
||||
commander.option(
|
||||
"--presets [list]",
|
||||
"comma-separated list of preset names",
|
||||
collect,
|
||||
);
|
||||
commander.option(
|
||||
"--plugins [list]",
|
||||
"comma-separated list of plugin names",
|
||||
collect,
|
||||
);
|
||||
commander.option("--config-file [path]", "Path a to .babelrc file to use");
|
||||
|
||||
// Basic file input configuration.
|
||||
commander.option("--source-type [script|module]", "");
|
||||
commander.option("--no-babelrc", "Whether or not to look up .babelrc and .babelignore files");
|
||||
commander.option("--ignore [list]", "list of glob paths to **not** compile", collect);
|
||||
commander.option("--only [list]", "list of glob paths to **only** compile", collect);
|
||||
commander.option(
|
||||
"--no-babelrc",
|
||||
"Whether or not to look up .babelrc and .babelignore files",
|
||||
);
|
||||
commander.option(
|
||||
"--ignore [list]",
|
||||
"list of glob paths to **not** compile",
|
||||
collect,
|
||||
);
|
||||
commander.option(
|
||||
"--only [list]",
|
||||
"list of glob paths to **only** compile",
|
||||
collect,
|
||||
);
|
||||
|
||||
// Misc babel config.
|
||||
commander.option("--no-highlight-code", "enable/disable ANSI syntax highlighting of code frames (on by default)");
|
||||
commander.option(
|
||||
"--no-highlight-code",
|
||||
"enable/disable ANSI syntax highlighting of code frames (on by default)",
|
||||
);
|
||||
|
||||
// General output formatting.
|
||||
commander.option("--no-comments", "write comments to generated output (true by default)");
|
||||
commander.option("--retain-lines", "retain line numbers - will result in really ugly code");
|
||||
commander.option("--compact [true|false|auto]", "do not include superfluous whitespace characters and line terminators", booleanify);
|
||||
commander.option(
|
||||
"--no-comments",
|
||||
"write comments to generated output (true by default)",
|
||||
);
|
||||
commander.option(
|
||||
"--retain-lines",
|
||||
"retain line numbers - will result in really ugly code",
|
||||
);
|
||||
commander.option(
|
||||
"--compact [true|false|auto]",
|
||||
"do not include superfluous whitespace characters and line terminators",
|
||||
booleanify,
|
||||
);
|
||||
commander.option("--minified", "save as much bytes when printing [true|false]");
|
||||
commander.option("--auxiliary-comment-before [string]", "print a comment before any injected non-user code");
|
||||
commander.option("--auxiliary-comment-after [string]", "print a comment after any injected non-user code");
|
||||
commander.option(
|
||||
"--auxiliary-comment-before [string]",
|
||||
"print a comment before any injected non-user code",
|
||||
);
|
||||
commander.option(
|
||||
"--auxiliary-comment-after [string]",
|
||||
"print a comment after any injected non-user code",
|
||||
);
|
||||
|
||||
// General soucemap formatting.
|
||||
commander.option("-s, --source-maps [true|false|inline|both]", "", booleanify);
|
||||
commander.option("--source-map-target [string]", "set `file` on returned source map");
|
||||
commander.option("--source-file-name [string]", "set `sources[0]` on returned source map");
|
||||
commander.option("--source-root [filename]", "the root from which all sources are relative");
|
||||
commander.option(
|
||||
"--source-map-target [string]",
|
||||
"set `file` on returned source map",
|
||||
);
|
||||
commander.option(
|
||||
"--source-file-name [string]",
|
||||
"set `sources[0]` on returned source map",
|
||||
);
|
||||
commander.option(
|
||||
"--source-root [filename]",
|
||||
"the root from which all sources are relative",
|
||||
);
|
||||
|
||||
// Config params for certain module output formats.
|
||||
commander.option("--module-root [filename]", "optional prefix for the AMD module formatter that will be prepend to the filename on module definitions");
|
||||
commander.option(
|
||||
"--module-root [filename]",
|
||||
"optional prefix for the AMD module formatter that will be prepend to the filename on module definitions",
|
||||
);
|
||||
commander.option("-M, --module-ids", "insert an explicit id for modules");
|
||||
commander.option("--module-id [string]", "specify a custom name for module ids");
|
||||
commander.option(
|
||||
"--module-id [string]",
|
||||
"specify a custom name for module ids",
|
||||
);
|
||||
|
||||
// "babel" command specific arguments that are not passed to babel-core.
|
||||
commander.option("-x, --extensions [extensions]", "List of extensions to compile when a directory has been input [.es6,.js,.es,.jsx,.mjs]", collect);
|
||||
commander.option(
|
||||
"-x, --extensions [extensions]",
|
||||
"List of extensions to compile when a directory has been input [.es6,.js,.es,.jsx,.mjs]",
|
||||
collect,
|
||||
);
|
||||
commander.option(
|
||||
"--keep-file-extension",
|
||||
"Preserve the file extensions of the input files",
|
||||
);
|
||||
commander.option("-w, --watch", "Recompile files on changes");
|
||||
commander.option("--skip-initial-build", "Do not compile files before watching");
|
||||
commander.option("-o, --out-file [out]", "Compile all input files into a single file");
|
||||
commander.option("-d, --out-dir [out]", "Compile an input directory of modules into an output directory");
|
||||
commander.option("-D, --copy-files", "When compiling a directory copy over non-compilable files");
|
||||
commander.option(
|
||||
"--skip-initial-build",
|
||||
"Do not compile files before watching",
|
||||
);
|
||||
commander.option(
|
||||
"-o, --out-file [out]",
|
||||
"Compile all input files into a single file",
|
||||
);
|
||||
commander.option(
|
||||
"-d, --out-dir [out]",
|
||||
"Compile an input directory of modules into an output directory",
|
||||
);
|
||||
commander.option(
|
||||
"--relative",
|
||||
"Compile into an output directory relative to input directory or file. Requires --out-dir [out]",
|
||||
);
|
||||
commander.option(
|
||||
"-D, --copy-files",
|
||||
"When compiling a directory copy over non-compilable files",
|
||||
);
|
||||
commander.option("-q, --quiet", "Don't log anything");
|
||||
commander.option(
|
||||
"--delete-dir-on-start",
|
||||
"Delete's the out directory before compilation",
|
||||
);
|
||||
/* eslint-enable max-len */
|
||||
|
||||
commander.version(pkg.version + " (babel-core " + version + ")");
|
||||
@@ -84,7 +169,7 @@ commander.parse(process.argv);
|
||||
|
||||
const errors = [];
|
||||
|
||||
let filenames = commander.args.reduce(function (globbed, input) {
|
||||
let filenames = commander.args.reduce(function(globbed, input) {
|
||||
let files = glob.sync(input);
|
||||
if (!files.length) files = [input];
|
||||
return globbed.concat(files);
|
||||
@@ -92,7 +177,7 @@ let filenames = commander.args.reduce(function (globbed, input) {
|
||||
|
||||
filenames = uniq(filenames);
|
||||
|
||||
filenames.forEach(function (filename) {
|
||||
filenames.forEach(function(filename) {
|
||||
if (!fs.existsSync(filename)) {
|
||||
errors.push(filename + " doesn't exist");
|
||||
}
|
||||
@@ -106,6 +191,10 @@ if (commander.outFile && commander.outDir) {
|
||||
errors.push("cannot have --out-file and --out-dir");
|
||||
}
|
||||
|
||||
if (commander.relative && !commander.outDir) {
|
||||
errors.push("output directory required for --relative");
|
||||
}
|
||||
|
||||
if (commander.watch) {
|
||||
if (!commander.outFile && !commander.outDir) {
|
||||
errors.push("--watch requires --out-file or --out-dir");
|
||||
@@ -119,6 +208,9 @@ if (commander.watch) {
|
||||
if (commander.skipInitialBuild && !commander.watch) {
|
||||
errors.push("--skip-initial-build requires --watch");
|
||||
}
|
||||
if (commander.deleteDirOnStart && !commander.outDir) {
|
||||
errors.push("--delete-dir-on-start requires --out-dir");
|
||||
}
|
||||
|
||||
if (errors.length) {
|
||||
console.error(errors.join(". "));
|
||||
@@ -128,6 +220,10 @@ if (errors.length) {
|
||||
//
|
||||
|
||||
const opts = commander.opts();
|
||||
//the configFile CLI option maps to the extends option in the node API
|
||||
if (opts.configFile) {
|
||||
opts.extends = opts.configFile;
|
||||
}
|
||||
|
||||
// Delete options that are specific to babel-cli and shouldn't be passed to babel-core.
|
||||
delete opts.version;
|
||||
@@ -138,6 +234,9 @@ delete opts.outFile;
|
||||
delete opts.outDir;
|
||||
delete opts.copyFiles;
|
||||
delete opts.quiet;
|
||||
delete opts.configFile;
|
||||
delete opts.deleteDirOnStart;
|
||||
delete opts.keepFileExtension;
|
||||
|
||||
// Commander will default the "--no-" arguments to true, but we want to leave them undefined so that
|
||||
// babel-core can handle the default-assignment logic on its own.
|
||||
|
||||
@@ -10,8 +10,8 @@ export function chmod(src, dest) {
|
||||
}
|
||||
|
||||
export function readdirFilter(filename) {
|
||||
return readdir(filename).filter(function (filename) {
|
||||
return babel.util.isCompilableExtension(filename);
|
||||
return readdir(filename).filter(function(filename) {
|
||||
return isCompilableExtension(filename);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -20,7 +20,10 @@ export { readdir };
|
||||
/**
|
||||
* Test if a filename ends with a compilable extension.
|
||||
*/
|
||||
export function isCompilableExtension(filename: string, altExts?: Array<string>): boolean {
|
||||
export function isCompilableExtension(
|
||||
filename: string,
|
||||
altExts?: Array<string>,
|
||||
): boolean {
|
||||
const exts = altExts || babel.DEFAULT_EXTENSIONS;
|
||||
const ext = path.extname(filename);
|
||||
return includes(exts, ext);
|
||||
@@ -55,6 +58,22 @@ export function compile(filename, opts) {
|
||||
}
|
||||
}
|
||||
|
||||
export function deleteDir(path) {
|
||||
if (fs.existsSync(path)) {
|
||||
fs.readdirSync(path).forEach(function(file) {
|
||||
const curPath = path + "/" + file;
|
||||
if (fs.lstatSync(curPath).isDirectory()) {
|
||||
// recurse
|
||||
deleteDir(curPath);
|
||||
} else {
|
||||
// delete file
|
||||
fs.unlinkSync(curPath);
|
||||
}
|
||||
});
|
||||
fs.rmdirSync(path);
|
||||
}
|
||||
}
|
||||
|
||||
function toErrorStack(err) {
|
||||
if (err._babel && err instanceof SyntaxError) {
|
||||
return `${err.name}: ${err.message}\n${err.codeFrame}`;
|
||||
@@ -63,7 +82,7 @@ function toErrorStack(err) {
|
||||
}
|
||||
}
|
||||
|
||||
process.on("uncaughtException", function (err) {
|
||||
process.on("uncaughtException", function(err) {
|
||||
console.error(toErrorStack(err));
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -74,8 +93,15 @@ export function requireChokidar() {
|
||||
} catch (err) {
|
||||
console.error(
|
||||
"The optional dependency chokidar failed to install and is required for " +
|
||||
"--watch. Chokidar is likely not supported on your platform."
|
||||
"--watch. Chokidar is likely not supported on your platform.",
|
||||
);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
|
||||
export function adjustRelative(relative, keepFileExtension) {
|
||||
if (keepFileExtension) {
|
||||
return relative;
|
||||
}
|
||||
return relative.replace(/\.(\w*?)$/, "") + ".js";
|
||||
}
|
||||
|
||||
3
packages/babel-cli/test/.othername_babelrc
Normal file
3
packages/babel-cli/test/.othername_babelrc
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"comments": false
|
||||
}
|
||||
@@ -1,21 +1,21 @@
|
||||
(function (global) {
|
||||
var babelHelpers = global.babelHelpers = {};
|
||||
|
||||
babelHelpers.createClass = function () {
|
||||
function defineProperties(target, props) {
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var descriptor = props[i];
|
||||
descriptor.enumerable = descriptor.enumerable || false;
|
||||
descriptor.configurable = true;
|
||||
if ("value" in descriptor) descriptor.writable = true;
|
||||
Object.defineProperty(target, descriptor.key, descriptor);
|
||||
}
|
||||
function _defineProperties(target, props) {
|
||||
for (var i = 0; i < props.length; i++) {
|
||||
var descriptor = props[i];
|
||||
descriptor.enumerable = descriptor.enumerable || false;
|
||||
descriptor.configurable = true;
|
||||
if ("value" in descriptor) descriptor.writable = true;
|
||||
Object.defineProperty(target, descriptor.key, descriptor);
|
||||
}
|
||||
}
|
||||
|
||||
return function (Constructor, protoProps, staticProps) {
|
||||
if (protoProps) defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
};
|
||||
}();
|
||||
function _createClass(Constructor, protoProps, staticProps) {
|
||||
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
||||
if (staticProps) _defineProperties(Constructor, staticProps);
|
||||
return Constructor;
|
||||
}
|
||||
|
||||
babelHelpers.createClass = _createClass
|
||||
})(typeof global === "undefined" ? self : global);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"args": ["--expose-debug-as=customDebug", "--eval", "console.log(customDebug.Debug.DebugEvent.Break)"],
|
||||
"stdout": "1"
|
||||
"args": ["--expose-gc-as=garbageCollector", "--eval", "console.log(typeof global.garbageCollector)"],
|
||||
"stdout": "function"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"args": ["--expose_debug_as=customDebug", "--eval", "console.log(customDebug.Debug.DebugEvent.Break)"],
|
||||
"stdout": "1"
|
||||
"args": ["--expose_gc_as=garbageCollector", "--eval", "console.log(typeof global.garbageCollector)"],
|
||||
"stdout": "function"
|
||||
}
|
||||
|
||||
3
packages/babel-cli/test/fixtures/babel/--config-file babelrc nocomment/options.json
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/--config-file babelrc nocomment/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"args": ["--config-file", "../.othername_babelrc"]
|
||||
}
|
||||
7
packages/babel-cli/test/fixtures/babel/--config-file babelrc nocomment/stdin.txt
vendored
Normal file
7
packages/babel-cli/test/fixtures/babel/--config-file babelrc nocomment/stdin.txt
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
/*
|
||||
Test comment
|
||||
*/
|
||||
|
||||
arr.map(x => x * MULTIPLIER);
|
||||
|
||||
// END OF FILE
|
||||
5
packages/babel-cli/test/fixtures/babel/--config-file babelrc nocomment/stdout.txt
vendored
Normal file
5
packages/babel-cli/test/fixtures/babel/--config-file babelrc nocomment/stdout.txt
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(function (x) {
|
||||
return x * MULTIPLIER;
|
||||
});
|
||||
1
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/in-files/src/bar.json
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/in-files/src/bar.json
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
1
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/in-files/src/foo.js
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/in-files/src/foo.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
arr.map(x => x * MULTIPLIER);
|
||||
3
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/options.json
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"args": ["src", "--out-dir", "lib", "--copy-files"]
|
||||
}
|
||||
1
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/out-files/lib/bar.json
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/out-files/lib/bar.json
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
5
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/out-files/lib/foo.js
vendored
Normal file
5
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/out-files/lib/foo.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(function (x) {
|
||||
return x * MULTIPLIER;
|
||||
});
|
||||
1
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/stdout.txt
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/dir --out-dir --copy-files/stdout.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
src/foo.js -> lib/foo.js
|
||||
@@ -0,0 +1 @@
|
||||
arr.map(x => x / DIVIDER);
|
||||
@@ -0,0 +1 @@
|
||||
arr.map(x => x * MULTIPLIER);
|
||||
3
packages/babel-cli/test/fixtures/babel/dir --out-dir --keep-file-extension/options.json
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/dir --out-dir --keep-file-extension/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"args": ["src", "--out-dir", "lib", "--keep-file-extension"]
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(function (x) {
|
||||
return x / DIVIDER;
|
||||
});
|
||||
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(function (x) {
|
||||
return x * MULTIPLIER;
|
||||
});
|
||||
2
packages/babel-cli/test/fixtures/babel/dir --out-dir --keep-file-extension/stdout.txt
vendored
Normal file
2
packages/babel-cli/test/fixtures/babel/dir --out-dir --keep-file-extension/stdout.txt
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
src/bar.mjs -> lib/bar.mjs
|
||||
src/foo.js -> lib/foo.js
|
||||
@@ -0,0 +1,3 @@
|
||||
class Test1 {
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
arr.map(x => x * MULTIPLIER);
|
||||
@@ -0,0 +1,3 @@
|
||||
class Test2 {
|
||||
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
arr.map(x => x / DIVIDER);
|
||||
3
packages/babel-cli/test/fixtures/babel/dir --out-dir --relative/options.json
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/dir --out-dir --relative/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"args": ["**/src", "--out-dir", "../lib", "--relative"]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return right[Symbol.hasInstance](left); } else { return left instanceof right; } }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!_instanceof(instance, Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var Test1 = function Test1() {
|
||||
_classCallCheck(this, Test1);
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(function (x) {
|
||||
return x * MULTIPLIER;
|
||||
});
|
||||
@@ -0,0 +1,9 @@
|
||||
"use strict";
|
||||
|
||||
function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return right[Symbol.hasInstance](left); } else { return left instanceof right; } }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!_instanceof(instance, Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var Test2 = function Test2() {
|
||||
_classCallCheck(this, Test2);
|
||||
};
|
||||
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(function (x) {
|
||||
return x / DIVIDER;
|
||||
});
|
||||
4
packages/babel-cli/test/fixtures/babel/dir --out-dir --relative/stdout.txt
vendored
Normal file
4
packages/babel-cli/test/fixtures/babel/dir --out-dir --relative/stdout.txt
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
package1/src/bar/bar1.js -> package1/lib/bar/bar1.js
|
||||
package1/src/foo1.js -> package1/lib/foo1.js
|
||||
package2/src/bar/bar2.js -> package2/lib/bar/bar2.js
|
||||
package2/src/foo2.js -> package2/lib/foo2.js
|
||||
@@ -1,8 +1,10 @@
|
||||
"use strict";
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return right[Symbol.hasInstance](left); } else { return left instanceof right; } }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!_instanceof(instance, Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var Test = function Test() {
|
||||
_classCallCheck(this, Test);
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXIvYmFyLmpzIl0sIm5hbWVzIjpbIlRlc3QiXSwibWFwcGluZ3MiOiI7Ozs7SUFBTUEsSSIsImZpbGUiOiJiYXIuanMiLCJzb3VyY2VzQ29udGVudCI6WyJjbGFzcyBUZXN0IHtcblxufSJdfQ==
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXIvYmFyLmpzIl0sIm5hbWVzIjpbIlRlc3QiXSwibWFwcGluZ3MiOiI7Ozs7OztJQUFNQSxJIiwiZmlsZSI6ImJhci5qcyIsInNvdXJjZXNDb250ZW50IjpbImNsYXNzIFRlc3Qge1xuXG59Il19
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return right[Symbol.hasInstance](left); } else { return left instanceof right; } }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!_instanceof(instance, Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var Test = function Test() {
|
||||
_classCallCheck(this, Test);
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../src/bar/bar.js"],"names":["Test"],"mappings":";;;;IAAMA,I","file":"bar.js","sourcesContent":["class Test {\n\n}"]}
|
||||
{"version":3,"sources":["../../src/bar/bar.js"],"names":["Test"],"mappings":";;;;;;IAAMA,I","file":"bar.js","sourcesContent":["class Test {\n\n}"]}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
"use strict";
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return right[Symbol.hasInstance](left); } else { return left instanceof right; } }
|
||||
|
||||
function _classCallCheck(instance, Constructor) { if (!_instanceof(instance, Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
||||
|
||||
var Test = function Test() {
|
||||
_classCallCheck(this, Test);
|
||||
|
||||
4
packages/babel-cli/test/fixtures/babel/error --out-dir --out-file/options.json
vendored
Normal file
4
packages/babel-cli/test/fixtures/babel/error --out-dir --out-file/options.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"args": ["--out-dir", "lib"],
|
||||
"stderrContains": true
|
||||
}
|
||||
1
packages/babel-cli/test/fixtures/babel/error --out-dir --out-file/stderr.txt
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/error --out-dir --out-file/stderr.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
filenames required for --out-dir
|
||||
4
packages/babel-cli/test/fixtures/babel/error --out-dir/options.json
vendored
Normal file
4
packages/babel-cli/test/fixtures/babel/error --out-dir/options.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"args": ["--out-dir", "lib", "--out-file", "foo.js"],
|
||||
"stderrContains": true
|
||||
}
|
||||
1
packages/babel-cli/test/fixtures/babel/error --out-dir/stderr.txt
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/error --out-dir/stderr.txt
vendored
Normal file
@@ -0,0 +1 @@
|
||||
cannot have --out-file and --out-dir
|
||||
4
packages/babel-cli/test/fixtures/babel/error --relative/options.json
vendored
Normal file
4
packages/babel-cli/test/fixtures/babel/error --relative/options.json
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"args": ["--relative"],
|
||||
"stderrContains": true
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user