Compare commits
359 Commits
v7.0.0-bet
...
v7.0.0-bet
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6df92f245 | ||
|
|
f4b81ab101 | ||
|
|
360b632881 | ||
|
|
bdfeeb38c6 | ||
|
|
47ada5ab3a | ||
|
|
59ba3959dc | ||
|
|
0200e6256a | ||
|
|
9a26c2b07a | ||
|
|
901571d72f | ||
|
|
b09c729675 | ||
|
|
a36525be45 | ||
|
|
a10c91790f | ||
|
|
ab7d1231ad | ||
|
|
a5df709bc3 | ||
|
|
1dbed5f458 | ||
|
|
40e38646e4 | ||
|
|
9e4dd861ee | ||
|
|
a7bddc02ba | ||
|
|
023f8bd1cb | ||
|
|
c9b99af5a6 | ||
|
|
c8d82d6483 | ||
|
|
db42a5d70f | ||
|
|
0856f89882 | ||
|
|
921702ef8c | ||
|
|
8b57a3e3b9 | ||
|
|
21309cc8d4 | ||
|
|
19708e0154 | ||
|
|
f98dff9189 | ||
|
|
840ba187a7 | ||
|
|
de00d939f0 | ||
|
|
e80488f1d5 | ||
|
|
81c1b49f6a | ||
|
|
55bf55398a | ||
|
|
f0d681a238 | ||
|
|
6d6fe844fd | ||
|
|
edb0a70e14 | ||
|
|
669f6b97b2 | ||
|
|
e2c5f25e97 | ||
|
|
8eee435cd6 | ||
|
|
d260bfaec4 | ||
|
|
c662c2ada2 | ||
|
|
b6e54800b4 | ||
|
|
ae210a46d1 | ||
|
|
017d0e7078 | ||
|
|
b8d1d221f8 | ||
|
|
fed530f6bf | ||
|
|
29d44193cd | ||
|
|
82994ce087 | ||
|
|
586d3b5929 | ||
|
|
d682e32529 | ||
|
|
07ab02f6b2 | ||
|
|
91a114f74a | ||
|
|
6d9887fc0f | ||
|
|
d2a3a8151e | ||
|
|
270ea17fed | ||
|
|
da2aea31f5 | ||
|
|
1d69cd41ca | ||
|
|
a7ec312cfe | ||
|
|
6ff91cfdae | ||
|
|
dfb3795a97 | ||
|
|
353d3199c2 | ||
|
|
bdd70c37e0 | ||
|
|
9d2d499760 | ||
|
|
29807837bb | ||
|
|
c14a6a7735 | ||
|
|
3a7881379a | ||
|
|
f3f0197890 | ||
|
|
8e030e28b3 | ||
|
|
3c8e9acd4a | ||
|
|
958551fd89 | ||
|
|
b5e6536f26 | ||
|
|
0389035e15 | ||
|
|
4f4dd3d4a6 | ||
|
|
4da3f3bc64 | ||
|
|
7901e7d1b9 | ||
|
|
4b6c7ac0f6 | ||
|
|
24a07fc790 | ||
|
|
1c9b0ff49e | ||
|
|
828e9a8538 | ||
|
|
f97d4313c9 | ||
|
|
2a0071028d | ||
|
|
2c0d492674 | ||
|
|
e42cbb40a4 | ||
|
|
74ab2798e2 | ||
|
|
fef5c7e523 | ||
|
|
53825f8152 | ||
|
|
40819f112c | ||
|
|
2d36549541 | ||
|
|
7e423de911 | ||
|
|
8317f8ab14 | ||
|
|
65dcc4eabe | ||
|
|
c8992e4155 | ||
|
|
50b9fbb570 | ||
|
|
5d615dd198 | ||
|
|
eb2a0b0fcd | ||
|
|
eaa31b6ec3 | ||
|
|
4d76d5dddc | ||
|
|
a86d311986 | ||
|
|
a340a2614f | ||
|
|
f9857ca6ba | ||
|
|
f43bf7fcd5 | ||
|
|
653318b7e4 | ||
|
|
d187c26748 | ||
|
|
fc64ab5725 | ||
|
|
5cd8b5b7f0 | ||
|
|
a328b6ad1a | ||
|
|
15a80f0df8 | ||
|
|
a4795408b4 | ||
|
|
5f6e3122a0 | ||
|
|
7f8f4e86dc | ||
|
|
5c3092d86f | ||
|
|
7cc00cce0d | ||
|
|
beb99dfda1 | ||
|
|
5f9539e9cc | ||
|
|
aa669ef902 | ||
|
|
c92e8be612 | ||
|
|
ab1e295c74 | ||
|
|
ae0df86340 | ||
|
|
41bf66bca2 | ||
|
|
212058148c | ||
|
|
785131d8e6 | ||
|
|
81532103da | ||
|
|
cc6e739f15 | ||
|
|
3e95830646 | ||
|
|
53208d6998 | ||
|
|
fdfbd9a6f7 | ||
|
|
007f8d19b3 | ||
|
|
586ba35950 | ||
|
|
1a454f666c | ||
|
|
a07f96ce3f | ||
|
|
2c3eb3096f | ||
|
|
148e6dfc26 | ||
|
|
ddd40bf5c7 | ||
|
|
bf8b25289b | ||
|
|
b19b7fd2cf | ||
|
|
f004972625 | ||
|
|
5459c75d64 | ||
|
|
8e3e6e0a88 | ||
|
|
d4a8c7672c | ||
|
|
600106b9cb | ||
|
|
dffcef785a | ||
|
|
cb4f4f4d5f | ||
|
|
7ff4a73916 | ||
|
|
8823e4247e | ||
|
|
6f3be3a543 | ||
|
|
6f6c8dabba | ||
|
|
960fa66c9e | ||
|
|
df50cddd63 | ||
|
|
455c04e60a | ||
|
|
182fe7b04e | ||
|
|
959865b48d | ||
|
|
62c1046249 | ||
|
|
70627ac92c | ||
|
|
a99e9614a6 | ||
|
|
cfb830b5bd | ||
|
|
84de90e572 | ||
|
|
d283324f8a | ||
|
|
d75a6b8468 | ||
|
|
dad05ed503 | ||
|
|
7e90d56024 | ||
|
|
3d49766f6b | ||
|
|
4d17a96d50 | ||
|
|
6cbc585cf4 | ||
|
|
ee6dfd1580 | ||
|
|
e732ee0c5b | ||
|
|
128fc6864e | ||
|
|
6aed8e944f | ||
|
|
4d164bd8e6 | ||
|
|
ea3f2d9299 | ||
|
|
88a0f52230 | ||
|
|
4a2e1dbbc3 | ||
|
|
2979dd99ac | ||
|
|
534ee4734c | ||
|
|
a01007a3d3 | ||
|
|
493996e02a | ||
|
|
c03a34e509 | ||
|
|
92580e750d | ||
|
|
213805f21e | ||
|
|
28d13cb09b | ||
|
|
9a8ba76e1f | ||
|
|
d88173b9f8 | ||
|
|
85174b6ce1 | ||
|
|
ec2e0b664a | ||
|
|
a3ad518ce1 | ||
|
|
dd0337cc85 | ||
|
|
4887d81929 | ||
|
|
22555cd15d | ||
|
|
593c1a0861 | ||
|
|
7234442fde | ||
|
|
5ea1bfe780 | ||
|
|
2254ed45d2 | ||
|
|
278cd5e572 | ||
|
|
96c0415c86 | ||
|
|
ed98d2491e | ||
|
|
eb38ea2b10 | ||
|
|
f19d559ff3 | ||
|
|
73e64c6cb0 | ||
|
|
3deb246c7d | ||
|
|
1ebc229fa5 | ||
|
|
cc4913699b | ||
|
|
82b6ee734b | ||
|
|
22c8f6376c | ||
|
|
023550c87b | ||
|
|
8e0d247e8c | ||
|
|
65ae4ff15b | ||
|
|
2185256589 | ||
|
|
3316a554bf | ||
|
|
252ea5a966 | ||
|
|
912bcc186d | ||
|
|
63ae923987 | ||
|
|
dde9274986 | ||
|
|
ba111c13b5 | ||
|
|
967414d926 | ||
|
|
92fc26d399 | ||
|
|
fa5eb4f605 | ||
|
|
d6a782b09c | ||
|
|
567d25cfa5 | ||
|
|
1da831baa4 | ||
|
|
b0d8c62d1c | ||
|
|
0e570eceb2 | ||
|
|
ca18ea5e79 | ||
|
|
63d9998aa4 | ||
|
|
88e550c733 | ||
|
|
b96fdf8780 | ||
|
|
180eda3211 | ||
|
|
b3969d35fa | ||
|
|
dccfed3601 | ||
|
|
5759c33b4c | ||
|
|
193bccc93c | ||
|
|
5ce54799ff | ||
|
|
064c17e03f | ||
|
|
f9804e6beb | ||
|
|
47ce7e71c9 | ||
|
|
5ac8ba19a4 | ||
|
|
b5d20ab171 | ||
|
|
539009a980 | ||
|
|
c3654d83c8 | ||
|
|
667f5815c1 | ||
|
|
4f39e6ea4a | ||
|
|
64dfb7574e | ||
|
|
d36b142e30 | ||
|
|
3c8d831fe4 | ||
|
|
0a517b51cd | ||
|
|
79c84f2f9b | ||
|
|
ca86648726 | ||
|
|
2d05487293 | ||
|
|
c3352ad2e0 | ||
|
|
26e4911eb2 | ||
|
|
aa888e666a | ||
|
|
8659e1a88c | ||
|
|
9e384f3915 | ||
|
|
f694b5d034 | ||
|
|
d765573c0b | ||
|
|
64161fa0b5 | ||
|
|
52f22e9e1e | ||
|
|
3e5fce07e4 | ||
|
|
0f42accb87 | ||
|
|
07e69c009b | ||
|
|
ce420ba51c | ||
|
|
9fe30b98a1 | ||
|
|
0a9f136d5f | ||
|
|
e9ed687666 | ||
|
|
63157159ab | ||
|
|
74682f33bc | ||
|
|
b1bf7798ab | ||
|
|
7c99f4653f | ||
|
|
a19349a22a | ||
|
|
b93184e430 | ||
|
|
bb17b72f4f | ||
|
|
a76709cabc | ||
|
|
c292140254 | ||
|
|
f4a24a38ca | ||
|
|
193e841d89 | ||
|
|
1ded1d7ff6 | ||
|
|
aec6e5c370 | ||
|
|
152e95fb52 | ||
|
|
8250ff963e | ||
|
|
82c6ca2f96 | ||
|
|
820edd1e23 | ||
|
|
e872f0d975 | ||
|
|
c3f6f7fe28 | ||
|
|
49775e2f12 | ||
|
|
f3410e761c | ||
|
|
ebbd5c7321 | ||
|
|
4208099f5b | ||
|
|
068c65a1dd | ||
|
|
3956b3ee0e | ||
|
|
2297e2d764 | ||
|
|
d761d765bd | ||
|
|
ad2019aa30 | ||
|
|
f9e0805337 | ||
|
|
0f60d42fdf | ||
|
|
7d798952d2 | ||
|
|
ed2b88830e | ||
|
|
d25918aa5d | ||
|
|
035286a810 | ||
|
|
c9a00fbae8 | ||
|
|
758fd0369c | ||
|
|
7b861796cf | ||
|
|
f9825394a7 | ||
|
|
43e7d1d2cc | ||
|
|
de63443762 | ||
|
|
6a73f39199 | ||
|
|
2190e10e9a | ||
|
|
ae3f5b9149 | ||
|
|
0c885b3200 | ||
|
|
148fe7d3ff | ||
|
|
cabdf3769d | ||
|
|
1178799f07 | ||
|
|
b2f1d01965 | ||
|
|
4f53496546 | ||
|
|
1312a30d54 | ||
|
|
4afbc02476 | ||
|
|
080c7f1e2d | ||
|
|
3cea9f412a | ||
|
|
cd10ea03b4 | ||
|
|
5f8a1a2613 | ||
|
|
44da8201a5 | ||
|
|
2b065350b5 | ||
|
|
68476b6ddd | ||
|
|
17b37b5013 | ||
|
|
56638e1370 | ||
|
|
f0e46772a6 | ||
|
|
398bc43656 | ||
|
|
44ea9433c0 | ||
|
|
53826aaaa0 | ||
|
|
b900a3e5c2 | ||
|
|
ed4d90b33d | ||
|
|
209a598d51 | ||
|
|
9a146d01b0 | ||
|
|
f2437583ba | ||
|
|
a24c9f8ed6 | ||
|
|
6a7223af29 | ||
|
|
a66845169f | ||
|
|
8a4124b2ff | ||
|
|
05b22d2597 | ||
|
|
9cc0a26694 | ||
|
|
f5ef928586 | ||
|
|
42f66782be | ||
|
|
12ac1bccd7 | ||
|
|
82357d79a7 | ||
|
|
2958548c2c | ||
|
|
468aecca21 | ||
|
|
c7980b2b90 | ||
|
|
d6db5fb1e1 | ||
|
|
ac745ded0d | ||
|
|
a2aabbd33d | ||
|
|
fcfa987926 | ||
|
|
509dbb7302 | ||
|
|
e270fbe7f0 | ||
|
|
aa38c47160 | ||
|
|
62bbee97d7 | ||
|
|
ac72bfbd33 | ||
|
|
a7c9264c79 | ||
|
|
c41eb0d052 | ||
|
|
de5ab72c49 | ||
|
|
607916880d | ||
|
|
8270903ba2 | ||
|
|
95fe785354 |
128
.babelrc.js
128
.babelrc.js
@@ -1,64 +1,80 @@
|
||||
"use strict";
|
||||
|
||||
// Blame Logan for this.
|
||||
// This works around https://github.com/istanbuljs/istanbuljs/issues/92 until
|
||||
// we have a version of Istanbul that actually works with 7.x.
|
||||
function istanbulHacks() {
|
||||
return {
|
||||
inherits: require("babel-plugin-istanbul").default,
|
||||
visitor: {
|
||||
Program: {
|
||||
exit: function(path) {
|
||||
if (!this.__dv__) return
|
||||
module.exports = function(api) {
|
||||
const env = api.env();
|
||||
|
||||
const node = path.node.body[0];
|
||||
if (
|
||||
node.type !== "VariableDeclaration" ||
|
||||
node.declarations[0].id.type !== "Identifier" ||
|
||||
!node.declarations[0].id.name.match(/cov_/) ||
|
||||
node._blockHoist !== 3
|
||||
) {
|
||||
throw new Error("Something has gone wrong in Logan's hacks.");
|
||||
}
|
||||
const includeCoverage = process.env.BABEL_COVERAGE === "true";
|
||||
|
||||
// Gross hacks to put the code coverage block above all compiled
|
||||
// import statement output.
|
||||
node._blockHoist = 5;
|
||||
},
|
||||
const envOpts = {
|
||||
loose: true,
|
||||
modules: false,
|
||||
exclude: ["transform-typeof-symbol"],
|
||||
};
|
||||
|
||||
let convertESM = true;
|
||||
|
||||
switch (env) {
|
||||
// Configs used during bundling builds.
|
||||
case "babylon":
|
||||
case "standalone":
|
||||
convertESM = false;
|
||||
break;
|
||||
case "production":
|
||||
// Config during builds before publish.
|
||||
break;
|
||||
case "development":
|
||||
envOpts.debug = true;
|
||||
envOpts.targets = {
|
||||
node: "current",
|
||||
};
|
||||
break;
|
||||
case "test":
|
||||
envOpts.targets = {
|
||||
node: "current",
|
||||
};
|
||||
break;
|
||||
}
|
||||
|
||||
const config = {
|
||||
comments: false,
|
||||
presets: [["@babel/env", envOpts]],
|
||||
plugins: [
|
||||
// TODO: Use @babel/preset-flow when
|
||||
// https://github.com/babel/babel/issues/7233 is fixed
|
||||
"@babel/plugin-transform-flow-strip-types",
|
||||
["@babel/proposal-class-properties", { loose: true }],
|
||||
"@babel/proposal-export-namespace-from",
|
||||
"@babel/proposal-numeric-separator",
|
||||
["@babel/proposal-object-rest-spread", { useBuiltIns: true }],
|
||||
|
||||
// Explicitly use the lazy version of CommonJS modules.
|
||||
convertESM ? ["@babel/transform-modules-commonjs", { lazy: true }] : null,
|
||||
].filter(Boolean),
|
||||
overrides: [
|
||||
{
|
||||
test: "packages/babylon",
|
||||
plugins: [
|
||||
"babel-plugin-transform-charcodes",
|
||||
["@babel/transform-for-of", { assumeArray: true }],
|
||||
],
|
||||
},
|
||||
},
|
||||
{
|
||||
test: "./packages/babel-register",
|
||||
plugins: [
|
||||
// Override the root options to disable lazy imports for babel-register
|
||||
// because otherwise the require hook will try to lazy-import things
|
||||
// leading to dependency cycles.
|
||||
convertESM ? "@babel/transform-modules-commonjs" : null,
|
||||
].filter(Boolean),
|
||||
},
|
||||
],
|
||||
};
|
||||
}
|
||||
|
||||
let envOpts = {
|
||||
loose: true,
|
||||
exclude: ["transform-typeof-symbol"],
|
||||
// we need to do this as long as we do not test everything from source
|
||||
if (includeCoverage) {
|
||||
config.auxiliaryCommentBefore = "istanbul ignore next";
|
||||
config.plugins.push("babel-plugin-istanbul");
|
||||
}
|
||||
|
||||
return config;
|
||||
};
|
||||
|
||||
const config = {
|
||||
comments: false,
|
||||
presets: [
|
||||
["@babel/env", envOpts],
|
||||
"@babel/flow"
|
||||
],
|
||||
plugins: [
|
||||
["@babel/proposal-class-properties", { loose: true }],
|
||||
"@babel/proposal-export-namespace",
|
||||
"@babel/proposal-numeric-separator",
|
||||
["@babel/proposal-object-rest-spread", { useBuiltIns: true}],
|
||||
]
|
||||
};
|
||||
|
||||
if (process.env.BABEL_ENV === "cov") {
|
||||
config.auxiliaryCommentBefore = "istanbul ignore next";
|
||||
config.plugins.push(istanbulHacks);
|
||||
}
|
||||
|
||||
if (process.env.BABEL_ENV === "development") {
|
||||
envOpts.targets = {
|
||||
node: "current"
|
||||
};
|
||||
envOpts.debug = true;
|
||||
}
|
||||
|
||||
module.exports = config;
|
||||
|
||||
61
.circleci/config.yml
Normal file
61
.circleci/config.yml
Normal file
@@ -0,0 +1,61 @@
|
||||
version: 2
|
||||
aliases:
|
||||
- &restore-node-modules-cache
|
||||
keys:
|
||||
- v1-yarn-deps-{{ checksum "yarn.lock" }}
|
||||
|
||||
- &restore-yarn-cache
|
||||
keys:
|
||||
- v1-yarn-cache
|
||||
|
||||
- &save-node-modules-cache
|
||||
paths:
|
||||
- node_modules
|
||||
key: v1-yarn-deps-{{ checksum "yarn.lock" }}
|
||||
|
||||
- &save-yarn-cache
|
||||
paths:
|
||||
- ~/.yarn-cache
|
||||
key: v1-yarn-cache
|
||||
|
||||
- &yarn-install
|
||||
run: |
|
||||
sudo npm i -g yarn@^1.5.1
|
||||
yarn --version
|
||||
|
||||
- &artifact_babel
|
||||
path: ~/babel/packages/babel-standalone/babel.js
|
||||
|
||||
- &artifact_babel_min
|
||||
path: ~/babel/packages/babel-standalone/babel.min.js
|
||||
|
||||
- &artifact_env
|
||||
path: ~/babel/packages/babel-preset-env-standalone/babel-preset-env.js
|
||||
|
||||
- &artifact_env_min
|
||||
path: ~/babel/packages/babel-preset-env-standalone/babel-preset-env.min.js
|
||||
|
||||
jobs:
|
||||
build:
|
||||
working_directory: ~/babel
|
||||
docker:
|
||||
- image: circleci/node:9
|
||||
steps:
|
||||
- checkout
|
||||
- restore-cache: *restore-yarn-cache
|
||||
- restore-cache: *restore-node-modules-cache
|
||||
- *yarn-install
|
||||
- run: make test-ci-coverage
|
||||
# Builds babel-standalone with the regular Babel config
|
||||
- run: 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.
|
||||
- run: ./node_modules/.bin/jest packages/babel-standalone/test/
|
||||
- run: ./node_modules/.bin/jest packages/babel-preset-env-standalone/test/
|
||||
- store_artifacts: *artifact_babel
|
||||
- store_artifacts: *artifact_babel_min
|
||||
- store_artifacts: *artifact_env
|
||||
- store_artifacts: *artifact_env_min
|
||||
- save_cache: *save-node-modules-cache
|
||||
- save_cache: *save-yarn-cache
|
||||
@@ -9,3 +9,6 @@ end_of_line = lf
|
||||
[*.{js,json}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
[*.{md,markdown}]
|
||||
trim_trailing_whitespace = false
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
/lib
|
||||
/build
|
||||
package.json
|
||||
packages/babel-runtime
|
||||
!packages/babel-runtime/scripts
|
||||
!packages/babel-runtime/core-js.js
|
||||
@@ -18,5 +20,4 @@ packages/babel-preset-env-standalone/babel-preset-env.js
|
||||
packages/babel-preset-env-standalone/babel-preset-env.min.js
|
||||
packages/babel-standalone/babel.js
|
||||
packages/babel-standalone/babel.min.js
|
||||
packages/babylon/build
|
||||
packages/babylon/test/expressions
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
{
|
||||
"root": true,
|
||||
"extends": "babel",
|
||||
"plugins": [
|
||||
"prettier"
|
||||
],
|
||||
"plugins": ["prettier"],
|
||||
"rules": {
|
||||
"curly": ["error", "multi-line"],
|
||||
"prettier/prettier": "error",
|
||||
@@ -13,22 +12,21 @@
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": [
|
||||
"packages/*/src/**/*.js",
|
||||
"codemods/*/src/**/*.js"
|
||||
],
|
||||
"files": ["packages/*/src/**/*.js", "codemods/*/src/**/*.js"],
|
||||
"rules": {
|
||||
"no-undefined-identifier": "error"
|
||||
"no-undefined-identifier": "error",
|
||||
"no-deprecated-clone": "error"
|
||||
}
|
||||
},
|
||||
{
|
||||
"files": [
|
||||
"packages/*/test/**/*.js",
|
||||
"codemods/*/test/**/*.js",
|
||||
"packages/babel-helper-transform-fixture-test-runner/src/helpers.js",
|
||||
"test/**/*.js"
|
||||
],
|
||||
"env": {
|
||||
"mocha": true
|
||||
"jest": true
|
||||
}
|
||||
}
|
||||
]
|
||||
@@ -13,10 +13,11 @@ codemods/*/src
|
||||
[libs]
|
||||
lib/file.js
|
||||
lib/parser.js
|
||||
lib/types.js
|
||||
lib/third-party-libs.js.flow
|
||||
packages/babel-types/lib/index.js.flow
|
||||
|
||||
[options]
|
||||
include_warnings=true
|
||||
suppress_comment= \\(.\\|\n\\)*\\$FlowFixMe
|
||||
suppress_comment= \\(.\\|\n\\)*\\$FlowIssue
|
||||
suppress_comment= \\(.\\|\n\\)*\\$FlowIgnore
|
||||
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -16,15 +16,19 @@ package-lock.json
|
||||
!/packages/babel-runtime/core-js/map.js
|
||||
/packages/babel-runtime/helpers/*.js
|
||||
!/packages/babel-runtime/helpers/toArray.js
|
||||
!/packages/babel-runtime/helpers/iterableToArray.js
|
||||
!/packages/babel-runtime/helpers/temporalRef.js
|
||||
/packages/babel-runtime/helpers/builtin/*.js
|
||||
!/packages/babel-runtime/helpers/builtin/toArray.js
|
||||
!/packages/babel-runtime/helpers/builtin/iterableToArray.js
|
||||
!/packages/babel-runtime/helpers/builtin/temporalRef.js
|
||||
/packages/babel-runtime/helpers/builtin/es6/*.js
|
||||
!/packages/babel-runtime/helpers/builtin/es6/toArray.js
|
||||
!/packages/babel-runtime/helpers/builtin/es6/iterableToArray.js
|
||||
!/packages/babel-runtime/helpers/builtin/es6/temporalRef.js
|
||||
/packages/babel-runtime/helpers/es6/*.js
|
||||
!/packages/babel-runtime/helpers/es6/toArray.js
|
||||
!/packages/babel-runtime/helpers/es6/iterableToArray.js
|
||||
!/packages/babel-runtime/helpers/es6/temporalRef.js
|
||||
/packages/babel-register/test/.babel
|
||||
/packages/babel-cli/test/tmp
|
||||
|
||||
1
.prettierignore
Normal file
1
.prettierignore
Normal file
@@ -0,0 +1 @@
|
||||
package.json
|
||||
@@ -1,5 +1,14 @@
|
||||
{
|
||||
"arrowParens": "avoid",
|
||||
"trailingComma": "es5",
|
||||
"useTabs": false,
|
||||
"semi": true,
|
||||
"singleQuote": false,
|
||||
"bracketSpacing": true,
|
||||
"jsxBracketSameLine": false,
|
||||
"tabWidth": 2,
|
||||
"parser": "babylon",
|
||||
"printWidth": 80,
|
||||
"overrides": [{
|
||||
"files": [
|
||||
"**/codemods/*/src/**/*.js",
|
||||
|
||||
@@ -7,6 +7,7 @@ cache:
|
||||
directories:
|
||||
- node_modules
|
||||
node_js:
|
||||
# We test the latest version on circleci
|
||||
- '8'
|
||||
- '6'
|
||||
- '4'
|
||||
@@ -19,6 +20,8 @@ env:
|
||||
before_install:
|
||||
- curl -o- -L https://yarnpkg.com/install.sh | bash
|
||||
|
||||
install: yarn --ignore-engines
|
||||
|
||||
before_script:
|
||||
- 'if [ "$JOB" = "babylon-flow-tests" ]; then make bootstrap-flow; fi'
|
||||
- 'if [ "$JOB" = "babylon-test262-tests" ]; then make bootstrap-test262; fi'
|
||||
|
||||
@@ -116,7 +116,7 @@ $ TEST_ONLY=babel-cli make test
|
||||
|
||||
```sh
|
||||
# Run tests for the @babel/plugin-transform-classes package.
|
||||
$ TEST_ONLY=es2015-class make test
|
||||
$ TEST_ONLY=babel-plugin-transform-classes make test
|
||||
```
|
||||
|
||||
Use the `TEST_GREP` variable to run a subset of tests by name:
|
||||
@@ -175,21 +175,21 @@ For example, in [`@babel/plugin-transform-exponentiation-operator/test`](https:/
|
||||
|
||||
- In each subfolder, you can organize your directory structure by categories of tests. (Example: these folders can be named after the feature you are testing or can reference the issue number they fix)
|
||||
- Generally, there are two kinds of tests for plugins
|
||||
- The first is a simple test of the input and output produced by running Babel on some code. We do this by creating an [`actual.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/actual.js) file and an [`expected.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/expected.js) file.
|
||||
- If you need to expect an error, you can ignore creating the `expected.js` file and pass a new `throws` key to the `options.json` that contains the error string that is created.
|
||||
- The first is a simple test of the input and output produced by running Babel on some code. We do this by creating an [`input.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/input.js) file and an [`output.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/binary/output.js) file. This kind of test only works in sub-subdirectories of `/fixtures`, i.e. `/fixtures/exponentian-operator/binary/input.js` and **not** `/fixtures/exponentian-operator/input.js`.
|
||||
- If you need to expect an error, you can ignore creating the `output.js` file and pass a new `throws` key to the `options.json` that contains the error string that is created.
|
||||
- The second and preferred type is a test that actually evaluates the produced code and asserts that certain properties are true or false. We do this by creating an [`exec.js`](https://github.com/babel/babel/blob/master/packages/babel-plugin-transform-exponentiation-operator/test/fixtures/exponentian-operator/comprehensive/exec.js) file.
|
||||
|
||||
In an actual/expected test, you simply write out the code you want transformed in `actual.js`.
|
||||
In a fixture test, you simply write out the code you want transformed in `input.js`.
|
||||
|
||||
```js
|
||||
// actual.js
|
||||
// input.js
|
||||
2 ** 2;
|
||||
```
|
||||
|
||||
and the expected output after transforming it with your `options.json` in `expected.js`.
|
||||
and the expected output after transforming it with your `options.json` in `output.js`.
|
||||
|
||||
```js
|
||||
// expected.js
|
||||
// output.js
|
||||
Math.pow(2, 2);
|
||||
```
|
||||
In an `exec.js` test, we run or check that the code actually does what it's supposed to do rather than just check the static output.
|
||||
@@ -227,14 +227,14 @@ Inside the `packages/babylon/tests/fixtures` folder are categories/groupings of
|
||||
etc.). To add a test, create a folder under one of these groupings (or create a new one) with a
|
||||
descriptive name, and add the following:
|
||||
|
||||
* Create an `actual.js` file that contains the code you want Babylon to parse.
|
||||
* Create an `input.js` file that contains the code you want Babylon to parse.
|
||||
|
||||
* Add an `expected.json` file with the expected parser output. For added convenience, if there is no `expected.json` present, the test runner will generate one for you.
|
||||
* Add an `output.json` file with the expected parser output. For added convenience, if there is no `output.json` present, the test runner will generate one for you.
|
||||
|
||||
After writing tests for babylon, just build it by running:
|
||||
|
||||
```sh
|
||||
$ make build-babylon
|
||||
$ make build
|
||||
```
|
||||
|
||||
Then, to run the tests, use:
|
||||
@@ -245,7 +245,7 @@ $ TEST_ONLY=babylon make test-only
|
||||
|
||||
#### Bootstrapping expected output
|
||||
|
||||
For both `@babel/plugin-x` and `babylon`, you can easily generate an `expected.js`/`expected.json` automatically by just providing `actual.js` and running the tests as you usually would.
|
||||
For both `@babel/plugin-x` and `babylon`, you can easily generate an `output.js`/`output.json` automatically by just providing `input.js` and running the tests as you usually would.
|
||||
|
||||
```
|
||||
// Example
|
||||
@@ -256,8 +256,8 @@ For both `@babel/plugin-x` and `babylon`, you can easily generate an `expected.j
|
||||
- comments
|
||||
- basic
|
||||
- block-trailing-comment
|
||||
- actual.js
|
||||
- expected.json (will be generated if not created)
|
||||
- input.js
|
||||
- output.json (will be generated if not created)
|
||||
```
|
||||
|
||||
### Debugging code
|
||||
@@ -309,7 +309,7 @@ Note that the code shown in Chrome DevTools is compiled code and therefore diffe
|
||||
- Start working about the Babel transform itself!
|
||||
|
||||
## Internals
|
||||
- AST spec ([babylon/ast/spec.md](https://github.com/babel/babel/tree/master/packages/babylon/blob/master/ast/spec.md))
|
||||
- AST spec ([babylon/ast/spec.md](https://github.com/babel/babel/blob/master/packages/babylon/ast/spec.md))
|
||||
- Versioning ([doc/design/versioning.md](https://github.com/babel/babel/blob/master/doc/design/versioning.md))
|
||||
- Monorepo ([doc/design/monorepo.md](https://github.com/babel/babel/blob/master/doc/design/monorepo.md))
|
||||
- Compiler environment support ([doc/design/compiler-environment-support.md](https://github.com/babel/babel/blob/master/doc/design/compiler-environment-support.md))
|
||||
|
||||
119
Gulpfile.js
119
Gulpfile.js
@@ -12,6 +12,11 @@ const gulp = require("gulp");
|
||||
const path = require("path");
|
||||
const webpack = require("webpack");
|
||||
const merge = require("merge-stream");
|
||||
const rollup = require("rollup-stream");
|
||||
const source = require("vinyl-source-stream");
|
||||
const buffer = require("vinyl-buffer");
|
||||
const rollupBabel = require("rollup-plugin-babel");
|
||||
const rollupNodeResolve = require("rollup-plugin-node-resolve");
|
||||
const registerStandalonePackageTask = require("./scripts/gulp-tasks")
|
||||
.registerStandalonePackageTask;
|
||||
|
||||
@@ -27,53 +32,101 @@ function getGlobFromSource(source) {
|
||||
return `./${source}/*/src/**/*.js`;
|
||||
}
|
||||
|
||||
gulp.task("default", ["build"]);
|
||||
function getIndexFromPackage(name) {
|
||||
return `${name}/src/index.js`;
|
||||
}
|
||||
|
||||
gulp.task("build", function() {
|
||||
function compilationLogger(rollup) {
|
||||
return through.obj(function(file, enc, callback) {
|
||||
gutil.log(
|
||||
`Compiling '${chalk.cyan(file.relative)}'${
|
||||
rollup ? " with rollup " : ""
|
||||
}...`
|
||||
);
|
||||
callback(null, file);
|
||||
});
|
||||
}
|
||||
|
||||
function errorsLogger() {
|
||||
return plumber({
|
||||
errorHandler(err) {
|
||||
gutil.log(err.stack);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
function rename(fn) {
|
||||
return through.obj(function(file, enc, callback) {
|
||||
file.path = fn(file);
|
||||
callback(null, file);
|
||||
});
|
||||
}
|
||||
|
||||
function buildBabel(exclude) {
|
||||
return merge(
|
||||
sources.map(source => {
|
||||
const base = path.join(__dirname, source);
|
||||
const f = filter(["**", "!**/packages/babylon/**"]);
|
||||
|
||||
return gulp
|
||||
.src(getGlobFromSource(source), { base: base })
|
||||
.pipe(f)
|
||||
.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);
|
||||
})
|
||||
)
|
||||
let stream = gulp.src(getGlobFromSource(source), { base: base });
|
||||
|
||||
if (exclude) {
|
||||
const filters = exclude.map(p => `!**/${p}/**`);
|
||||
filters.unshift("**");
|
||||
stream = stream.pipe(filter(filters));
|
||||
}
|
||||
|
||||
return stream
|
||||
.pipe(errorsLogger())
|
||||
.pipe(newer({ dest: base, map: swapSrcWithLib }))
|
||||
.pipe(compilationLogger())
|
||||
.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);
|
||||
})
|
||||
// Passing 'file.relative' because newer() above uses a relative
|
||||
// path and this keeps it consistent.
|
||||
rename(file => path.resolve(file.base, swapSrcWithLib(file.relative)))
|
||||
)
|
||||
.pipe(gulp.dest(base));
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
function buildRollup(packages) {
|
||||
return merge(
|
||||
packages.map(pkg => {
|
||||
return rollup({
|
||||
input: getIndexFromPackage(pkg),
|
||||
format: "cjs",
|
||||
plugins: [
|
||||
rollupBabel({
|
||||
envName: "babylon",
|
||||
babelrc: false,
|
||||
extends: "./.babelrc.js",
|
||||
}),
|
||||
rollupNodeResolve(),
|
||||
],
|
||||
})
|
||||
.pipe(source("index.js"))
|
||||
.pipe(buffer())
|
||||
.pipe(errorsLogger())
|
||||
.pipe(compilationLogger(/* rollup */ true))
|
||||
.pipe(gulp.dest(path.join(pkg, "lib")));
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
gulp.task("default", ["build"]);
|
||||
|
||||
gulp.task("build", function() {
|
||||
const bundles = ["packages/babylon"];
|
||||
|
||||
return merge([buildBabel(/* exclude */ bundles), buildRollup(bundles)]);
|
||||
});
|
||||
|
||||
gulp.task("watch", ["build"], function() {
|
||||
gulp.task("build-no-bundle", () => buildBabel());
|
||||
|
||||
gulp.task("watch", ["build-no-bundle"], function() {
|
||||
watch(sources.map(getGlobFromSource), { debounceDelay: 200 }, function() {
|
||||
gulp.start("build");
|
||||
gulp.start("build-no-bundle");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
2
LICENSE
2
LICENSE
@@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-2017 Sebastian McKenzie <sebmck@gmail.com>
|
||||
Copyright (c) 2014-2018 Sebastian McKenzie <sebmck@gmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
|
||||
74
Makefile
74
Makefile
@@ -1,8 +1,6 @@
|
||||
MAKEFLAGS = -j1
|
||||
FLOW_COMMIT = 0dfdb8bf984205f03e95b71680e39bae6b8f7066
|
||||
TEST262_COMMIT = 1282e842febf418ca27df13fa4b32f7e5021b470
|
||||
|
||||
export NODE_ENV = test
|
||||
FLOW_COMMIT = 622bbc4f07acb77eb1109830c70815f827401d90
|
||||
TEST262_COMMIT = 52f70e2f637731aae92a9c9a2d831310c3ab2e1e
|
||||
|
||||
# Fix color output until TravisCI fixes https://github.com/travis-ci/travis-ci/issues/7967
|
||||
export FORCE_COLOR = true
|
||||
@@ -11,20 +9,21 @@ SOURCES = packages codemods
|
||||
|
||||
.PHONY: build build-dist watch lint fix clean test-clean test-only test test-ci publish bootstrap
|
||||
|
||||
build: clean
|
||||
make clean-lib
|
||||
# Build babylon before building all other projects
|
||||
make build-babylon
|
||||
build: clean clean-lib
|
||||
./node_modules/.bin/gulp build
|
||||
ifneq ("$(BABEL_ENV)", "cov")
|
||||
node ./packages/babel-types/scripts/generateTypeHelpers.js
|
||||
# call build again as the generated files might need to be compiled again.
|
||||
./node_modules/.bin/gulp build
|
||||
# generate flow and typescript typings
|
||||
node scripts/generators/flow.js > ./packages/babel-types/lib/index.js.flow
|
||||
node scripts/generators/typescript.js > ./packages/babel-types/lib/index.d.ts
|
||||
# generate docs
|
||||
node scripts/generators/docs.js > ./packages/babel-types/README.md
|
||||
ifneq ("$(BABEL_COVERAGE)", "true")
|
||||
make build-standalone
|
||||
make build-preset-env-standalone
|
||||
endif
|
||||
|
||||
build-babylon:
|
||||
cd packages/babylon; \
|
||||
./node_modules/.bin/rollup -c
|
||||
|
||||
build-standalone:
|
||||
./node_modules/.bin/gulp build-babel-standalone
|
||||
|
||||
@@ -36,24 +35,26 @@ build-dist: build
|
||||
scripts/build-dist.sh
|
||||
cd packages/babel-runtime; \
|
||||
node scripts/build-dist.js
|
||||
node scripts/generate-babel-types-docs.js
|
||||
|
||||
watch: clean
|
||||
make clean-lib
|
||||
watch: clean clean-lib
|
||||
|
||||
# Ensure that build artifacts for types are created during local
|
||||
# development too.
|
||||
BABEL_ENV=development ./node_modules/.bin/gulp build-no-bundle
|
||||
node ./packages/babel-types/scripts/generateTypeHelpers.js
|
||||
node scripts/generators/flow.js > ./packages/babel-types/lib/index.js.flow
|
||||
BABEL_ENV=development ./node_modules/.bin/gulp watch
|
||||
|
||||
watch-babylon:
|
||||
cd packages/babylon; \
|
||||
./node_modules/.bin/rollup -c -w
|
||||
|
||||
flow:
|
||||
./node_modules/.bin/flow check --strip-root
|
||||
|
||||
lint:
|
||||
./node_modules/.bin/eslint scripts $(SOURCES) *.js --format=codeframe --rulesdir="./scripts/eslint_rules"
|
||||
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' '**/.*.js' --format=codeframe --rulesdir="./scripts/eslint_rules"
|
||||
|
||||
fix:
|
||||
./node_modules/.bin/eslint scripts $(SOURCES) *.js --format=codeframe --fix --rulesdir="./scripts/eslint_rules"
|
||||
# The config is hardcoded because otherwise prettier searches for it and also picks up some broken package.json files from tests
|
||||
./node_modules/.bin/prettier --config .prettierrc --write --ignore-path .eslintignore '**/*.json'
|
||||
./node_modules/.bin/eslint scripts $(SOURCES) '*.js' '**/.*.js' --format=codeframe --fix --rulesdir="./scripts/eslint_rules"
|
||||
|
||||
clean: test-clean
|
||||
rm -rf packages/babel-polyfill/browser*
|
||||
@@ -66,19 +67,17 @@ test-clean:
|
||||
$(call clean-source-test, $(source)))
|
||||
|
||||
test-only:
|
||||
./scripts/test.sh
|
||||
BABEL_ENV=test ./scripts/test.sh
|
||||
make test-clean
|
||||
|
||||
test: lint test-only
|
||||
|
||||
test-ci:
|
||||
make bootstrap
|
||||
make test-only
|
||||
test-ci: bootstrap test-only
|
||||
|
||||
test-ci-coverage: SHELL:=/bin/bash
|
||||
test-ci-coverage:
|
||||
BABEL_ENV=cov make bootstrap
|
||||
./scripts/test-cov.sh
|
||||
BABEL_COVERAGE=true BABEL_ENV=test make bootstrap
|
||||
BABEL_ENV=test TEST_TYPE=cov ./scripts/test-cov.sh
|
||||
bash <(curl -s https://codecov.io/bash) -f coverage/coverage-final.json
|
||||
|
||||
bootstrap-flow:
|
||||
@@ -90,9 +89,7 @@ bootstrap-flow:
|
||||
test-flow:
|
||||
node scripts/tests/flow/run_babylon_flow_tests.js
|
||||
|
||||
test-flow-ci:
|
||||
make bootstrap
|
||||
make test-flow
|
||||
test-flow-ci: bootstrap test-flow
|
||||
|
||||
test-flow-update-whitelist:
|
||||
node scripts/tests/flow/run_babylon_flow_tests.js --update-whitelist
|
||||
@@ -106,9 +103,7 @@ bootstrap-test262:
|
||||
test-test262:
|
||||
node scripts/tests/test262/run_babylon_test262.js
|
||||
|
||||
test-test262-ci:
|
||||
make bootstrap
|
||||
make test-test262
|
||||
test-test262-ci: bootstrap test-test262
|
||||
|
||||
test-test262-update-whitelist:
|
||||
node scripts/tests/test262/run_babylon_test262.js --update-whitelist
|
||||
@@ -116,6 +111,8 @@ test-test262-update-whitelist:
|
||||
publish:
|
||||
git pull --rebase
|
||||
make clean-lib
|
||||
rm -rf packages/babel-runtime/helpers
|
||||
rm -rf packages/babel-runtime/core-js
|
||||
BABEL_ENV=production make build-dist
|
||||
make test
|
||||
# not using lerna independent mode atm, so only update packages that have changed since we use ^
|
||||
@@ -123,17 +120,14 @@ publish:
|
||||
./node_modules/.bin/lerna publish --force-publish=* --exact --skip-temp-tag
|
||||
make clean
|
||||
|
||||
bootstrap:
|
||||
make clean-all
|
||||
yarn
|
||||
./node_modules/.bin/lerna bootstrap
|
||||
bootstrap: clean-all
|
||||
yarn --ignore-engines
|
||||
./node_modules/.bin/lerna bootstrap -- --ignore-engines
|
||||
make build
|
||||
cd packages/babel-runtime; \
|
||||
node scripts/build-dist.js
|
||||
|
||||
clean-lib:
|
||||
rm -rf packages/babel-runtime/helpers
|
||||
rm -rf packages/babel-runtime/core-js
|
||||
$(foreach source, $(SOURCES), \
|
||||
$(call clean-source-lib, $(source)))
|
||||
|
||||
|
||||
100
README.md
100
README.md
@@ -65,6 +65,10 @@ Mostly a handful of volunteers! Please check out our [team page](https://babeljs
|
||||
|
||||
For questions and support please visit join our [Slack Community](https://slack.babeljs.io/), ask a question on [Stack Overflow](https://stackoverflow.com/questions/tagged/babeljs), or ping us on [Twitter](https://twitter.com/babeljs).
|
||||
|
||||
### Is there a Babel song?
|
||||
|
||||
I'm so glad you asked: [Hallelujah —— In Praise of Babel](SONG.md) by [@angus-c](https://github.com/angus-c). Tweet us your recordings!
|
||||
|
||||
### Where are the docs?
|
||||
|
||||
Check out our website: [babeljs.io](https://babeljs.io/), and report issues/features at [babel/website](https://github.com/babel/website/issues).
|
||||
@@ -95,30 +99,30 @@ Support us with a monthly donation and help us continue our activities. [[Become
|
||||
<a href="https://opencollective.com/babel/backer/2/website" target="_blank"><img src="https://opencollective.com/babel/backer/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/3/website" target="_blank"><img src="https://opencollective.com/babel/backer/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/4/website" target="_blank"><img src="https://opencollective.com/babel/backer/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/5/website" target="_blank"><img src="https://opencollective.com/babel/backer/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/6/website" target="_blank"><img src="https://opencollective.com/babel/backer/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/7/website" target="_blank"><img src="https://opencollective.com/babel/backer/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/8/website" target="_blank"><img src="https://opencollective.com/babel/backer/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/9/website" target="_blank"><img src="https://opencollective.com/babel/backer/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/10/website" target="_blank"><img src="https://opencollective.com/babel/backer/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/11/website" target="_blank"><img src="https://opencollective.com/babel/backer/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/12/website" target="_blank"><img src="https://opencollective.com/babel/backer/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/13/website" target="_blank"><img src="https://opencollective.com/babel/backer/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/14/website" target="_blank"><img src="https://opencollective.com/babel/backer/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/15/website" target="_blank"><img src="https://opencollective.com/babel/backer/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/16/website" target="_blank"><img src="https://opencollective.com/babel/backer/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/17/website" target="_blank"><img src="https://opencollective.com/babel/backer/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/18/website" target="_blank"><img src="https://opencollective.com/babel/backer/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/19/website" target="_blank"><img src="https://opencollective.com/babel/backer/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/20/website" target="_blank"><img src="https://opencollective.com/babel/backer/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/21/website" target="_blank"><img src="https://opencollective.com/babel/backer/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/22/website" target="_blank"><img src="https://opencollective.com/babel/backer/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/23/website" target="_blank"><img src="https://opencollective.com/babel/backer/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/24/website" target="_blank"><img src="https://opencollective.com/babel/backer/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/25/website" target="_blank"><img src="https://opencollective.com/babel/backer/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/26/website" target="_blank"><img src="https://opencollective.com/babel/backer/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/27/website" target="_blank"><img src="https://opencollective.com/babel/backer/27/avatar.svg"></a>
|
||||
<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/5/website" target="_blank"><img src="https://opencollective.com/babel/backer/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/6/website" target="_blank"><img src="https://opencollective.com/babel/backer/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/7/website" target="_blank"><img src="https://opencollective.com/babel/backer/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/8/website" target="_blank"><img src="https://opencollective.com/babel/backer/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/9/website" target="_blank"><img src="https://opencollective.com/babel/backer/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/10/website" target="_blank"><img src="https://opencollective.com/babel/backer/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/11/website" target="_blank"><img src="https://opencollective.com/babel/backer/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/12/website" target="_blank"><img src="https://opencollective.com/babel/backer/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/13/website" target="_blank"><img src="https://opencollective.com/babel/backer/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/14/website" target="_blank"><img src="https://opencollective.com/babel/backer/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/15/website" target="_blank"><img src="https://opencollective.com/babel/backer/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/16/website" target="_blank"><img src="https://opencollective.com/babel/backer/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/17/website" target="_blank"><img src="https://opencollective.com/babel/backer/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/18/website" target="_blank"><img src="https://opencollective.com/babel/backer/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/19/website" target="_blank"><img src="https://opencollective.com/babel/backer/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/20/website" target="_blank"><img src="https://opencollective.com/babel/backer/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/21/website" target="_blank"><img src="https://opencollective.com/babel/backer/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/22/website" target="_blank"><img src="https://opencollective.com/babel/backer/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/23/website" target="_blank"><img src="https://opencollective.com/babel/backer/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/24/website" target="_blank"><img src="https://opencollective.com/babel/backer/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/25/website" target="_blank"><img src="https://opencollective.com/babel/backer/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/26/website" target="_blank"><img src="https://opencollective.com/babel/backer/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/backer/27/website" target="_blank"><img src="https://opencollective.com/babel/backer/27/avatar.svg"></a>
|
||||
<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
|
||||
@@ -130,30 +134,30 @@ Become a sponsor and get your logo on our README on Github with a link to your s
|
||||
<a href="https://opencollective.com/babel/sponsor/2/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/2/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/3/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/3/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/4/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/4/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/5/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/6/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/7/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/8/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/9/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/10/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/11/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/12/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/13/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/14/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/15/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/16/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/17/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/18/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/19/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/20/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/21/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/22/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/23/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/24/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/25/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/26/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/27/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/28/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/5/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/5/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/6/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/6/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/7/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/7/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/8/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/8/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/9/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/9/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/10/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/10/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/11/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/11/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/12/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/12/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/13/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/13/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/14/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/14/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/15/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/15/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/16/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/16/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/17/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/17/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/18/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/18/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/19/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/19/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/20/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/20/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/21/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/21/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/22/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/22/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/23/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/23/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/24/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/24/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/25/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/25/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/26/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/26/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/27/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/27/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/28/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/28/avatar.svg"></a>
|
||||
<a href="https://opencollective.com/babel/sponsor/29/website" target="_blank"><img src="https://opencollective.com/babel/sponsor/29/avatar.svg"></a>
|
||||
|
||||
## License
|
||||
|
||||
67
SONG.md
Normal file
67
SONG.md
Normal file
@@ -0,0 +1,67 @@
|
||||
## Hallelujah—In Praise of Babel
|
||||
|
||||
I heard there was a clever trick
|
||||
That rewrote all your JavaScript
|
||||
But you don’t really care for magic, do you
|
||||
Well it goes like this: the source, the dist
|
||||
The ES five, the ES six
|
||||
The sacred script transforming Hallelujah
|
||||
|
||||
Hallelujah, Hallelujah
|
||||
Hallelujah, Hallelujah
|
||||
|
||||
So I added all the shiny things
|
||||
Classes, spreads and template strings
|
||||
Through syntax sugared code I tried to woo you
|
||||
Generators, const and let
|
||||
I used them all without regret
|
||||
And it’s a terse and a destructured Hallelujah
|
||||
|
||||
Hallelujah etc.
|
||||
|
||||
Well my faith was strong but I needed proof
|
||||
The standard was my source of truth
|
||||
But TC39 meant nothing to you
|
||||
So even though you weren’t impressed
|
||||
I checked the build against the spec
|
||||
And it’s a more-or-less compliant Hallelujah
|
||||
|
||||
Hallelujah etc.
|
||||
|
||||
Now you say the build step’s too complex
|
||||
And you claim no need for ES Next
|
||||
Well I used to think that way before I knew you
|
||||
But your code grows older with each line
|
||||
It’s a joyless dirge on a withered vine
|
||||
It’s a threnody for a bygone Hallelujah
|
||||
|
||||
Hallelujah etc.
|
||||
|
||||
Yes I learned about the danger signs
|
||||
How they’d polyfilled a thousand lines
|
||||
The cost of using Maps and Symbols threw you
|
||||
Still I disregarded common sense
|
||||
Now my source is small but the build’s immense
|
||||
And it’s a slow and unresponsive Hallelujah
|
||||
|
||||
Hallelujah etc.
|
||||
|
||||
There was a time when they let me know
|
||||
What’s really going on below
|
||||
But now there’s only source maps there to school you
|
||||
And debugging’s not a progress march
|
||||
It’s a frenzied fumble in the dark
|
||||
It’s a labyrinthine search for Hallelujah
|
||||
|
||||
Hallelujah etc.
|
||||
|
||||
Well, maybe there’s a god up there
|
||||
But all I ever got from prayers
|
||||
Was broken builds and errors that would spook you
|
||||
And that anguished cry you hear at night
|
||||
Is the plugin I forgot to write
|
||||
It’s a cold and it’s a broken Hallelujah
|
||||
|
||||
Hallelujah etc.
|
||||
|
||||
[Angus Croll](https://github.com/angus-c)
|
||||
30
circle.yml
30
circle.yml
@@ -1,30 +0,0 @@
|
||||
general:
|
||||
artifacts:
|
||||
- "packages/babel-standalone/babel.js"
|
||||
- "packages/babel-standalone/babel.min.js"
|
||||
- "packages/babel-preset-env-standalone/babel-preset-env.js"
|
||||
- "packages/babel-preset-env-standalone/babel-preset-env.min.js"
|
||||
|
||||
machine:
|
||||
node:
|
||||
version:
|
||||
8
|
||||
|
||||
dependencies:
|
||||
pre:
|
||||
- curl -o- -L https://yarnpkg.com/install.sh | bash
|
||||
cache_directories:
|
||||
- ~/.yarn-cache
|
||||
override:
|
||||
- yarn
|
||||
|
||||
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
|
||||
- ./node_modules/mocha/bin/_mocha packages/babel-preset-env-standalone/test/ --opts test/mocha.opts
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/plugin-codemod-optional-catch-binding",
|
||||
"version": "7.0.0-beta.33",
|
||||
"version": "7.0.0-beta.44",
|
||||
"description": "Remove unused catch bindings",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-remove-unused-catch-binding",
|
||||
"license": "MIT",
|
||||
@@ -9,13 +9,13 @@
|
||||
"@babel/plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"@babel/plugin-syntax-optional-catch-binding": "7.0.0-beta.33"
|
||||
"@babel/plugin-syntax-optional-catch-binding": "7.0.0-beta.44"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "7.0.0-beta.33"
|
||||
"@babel/core": "7.0.0-beta.44"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.0.0-beta.33",
|
||||
"@babel/helper-plugin-test-runner": "7.0.0-beta.33"
|
||||
"@babel/core": "7.0.0-beta.44",
|
||||
"@babel/helper-plugin-test-runner": "7.0.0-beta.44"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ This is quite taboo but let's look at the pros and cons:
|
||||
* Easy to coordinate changes across modules.
|
||||
* Single place to report issues.
|
||||
* Easier to setup a development environment.
|
||||
* Tests across modules are ran together which finds bugs that touch multiple modules easier.
|
||||
* Tests across modules are run together which finds bugs that touch multiple modules easier.
|
||||
|
||||
**Cons:**
|
||||
|
||||
|
||||
16
lerna.json
16
lerna.json
@@ -1,16 +1,16 @@
|
||||
{
|
||||
"lerna": "2.0.0-rc.4",
|
||||
"version": "7.0.0-beta.33",
|
||||
"version": "7.0.0-beta.44",
|
||||
"changelog": {
|
||||
"repo": "babel/babel",
|
||||
"labels": {
|
||||
"PR: Spec Compliancy": ":eyeglasses: Spec Compliancy",
|
||||
"PR: Breaking Change": ":boom: Breaking Change",
|
||||
"PR: New Feature": ":rocket: New Feature",
|
||||
"PR: Bug Fix": ":bug: Bug Fix",
|
||||
"PR: Polish": ":nail_care: Polish",
|
||||
"PR: Docs": ":memo: Documentation",
|
||||
"PR: Internal": ":house: Internal"
|
||||
"PR: Spec Compliancy :eyeglasses:": ":eyeglasses: Spec Compliancy",
|
||||
"PR: Breaking Change :boom:": ":boom: Breaking Change",
|
||||
"PR: New Feature :rocket:": ":rocket: New Feature",
|
||||
"PR: Bug Fix :bug:": ":bug: Bug Fix",
|
||||
"PR: Polish :nail_care:": ":nail_care: Polish",
|
||||
"PR: Docs :memo:": ":memo: Documentation",
|
||||
"PR: Internal :house:": ":house: Internal"
|
||||
}
|
||||
},
|
||||
"cacheDir": ".changelog",
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
*/
|
||||
|
||||
declare module "micromatch" {
|
||||
declare function exports(Array<string>, Array<string>, ?{
|
||||
nocase: boolean,
|
||||
}): Array<string>;
|
||||
declare module.exports: {
|
||||
(Array<string>, Array<string>, ?{ nocase: boolean }): Array<string>,
|
||||
};
|
||||
}
|
||||
|
||||
declare module "resolve" {
|
||||
|
||||
1769
lib/types.js
1769
lib/types.js
File diff suppressed because it is too large
Load Diff
96
package.json
96
package.json
@@ -10,31 +10,35 @@
|
||||
"test": "make test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/cli": "7.0.0-beta.31",
|
||||
"@babel/core": "7.0.0-beta.31",
|
||||
"@babel/preset-env": "7.0.0-beta.31",
|
||||
"@babel/preset-flow": "7.0.0-beta.31",
|
||||
"@babel/preset-stage-0": "7.0.0-beta.31",
|
||||
"@babel/register": "7.0.0-beta.31",
|
||||
"async": "^1.5.0",
|
||||
"@babel/cli": "7.0.0-beta.42",
|
||||
"@babel/core": "7.0.0-beta.42",
|
||||
"@babel/plugin-transform-modules-commonjs": "7.0.0-beta.42",
|
||||
"@babel/preset-env": "7.0.0-beta.42",
|
||||
"@babel/preset-flow": "7.0.0-beta.42",
|
||||
"@babel/preset-stage-0": "7.0.0-beta.42",
|
||||
"@babel/register": "7.0.0-beta.42",
|
||||
"babel-core": "^7.0.0-0",
|
||||
"babel-eslint": "^8.0.1",
|
||||
"babel-jest": "^22.4.1",
|
||||
"babel-loader": "8.0.0-beta.0",
|
||||
"babel-plugin-istanbul": "^4.1.4",
|
||||
"babylon": "7.0.0-beta.31",
|
||||
"babel-plugin-transform-charcodes": "^0.1.0",
|
||||
"babylon": "7.0.0-beta.42",
|
||||
"browserify": "^13.1.1",
|
||||
"bundle-collapser": "^1.2.1",
|
||||
"chai": "^4.1.0",
|
||||
"chalk": "^2.0.0",
|
||||
"chalk": "^2.3.2",
|
||||
"charcodes": "^0.1.0",
|
||||
"derequire": "^2.0.2",
|
||||
"eslint": "^4.5.0",
|
||||
"enhanced-resolve": "^3.0.0",
|
||||
"eslint": "^4.18.2",
|
||||
"eslint-config-babel": "^7.0.2",
|
||||
"eslint-plugin-flowtype": "^2.20.0",
|
||||
"eslint-plugin-prettier": "^2.2.0",
|
||||
"flow-bin": "^0.57.3",
|
||||
"eslint-plugin-prettier": "^2.5.0",
|
||||
"flow-bin": "^0.66.0",
|
||||
"graceful-fs": "^4.1.11",
|
||||
"gulp": "^3.9.0",
|
||||
"gulp-babel": "^8.0.0-beta.0",
|
||||
"gulp-filter": "^5.0.1",
|
||||
"gulp-babel": "^8.0.0-beta.2",
|
||||
"gulp-filter": "^5.1.0",
|
||||
"gulp-newer": "^1.0.0",
|
||||
"gulp-plumber": "^1.0.1",
|
||||
"gulp-rename": "^1.2.2",
|
||||
@@ -42,21 +46,24 @@
|
||||
"gulp-util": "^3.0.7",
|
||||
"gulp-watch": "^4.3.5",
|
||||
"husky": "^0.14.3",
|
||||
"jest": "^22.4.2",
|
||||
"lerna": "2.0.0",
|
||||
"lerna-changelog": "^0.5.0",
|
||||
"lint-staged": "^4.2.3",
|
||||
"lint-staged": "^6.0.1",
|
||||
"lodash": "^4.2.0",
|
||||
"merge-stream": "^1.0.1",
|
||||
"mocha": "^3.0.0",
|
||||
"nyc": "^11.0.3",
|
||||
"output-file-sync": "^2.0.0",
|
||||
"prettier": "1.7.3",
|
||||
"prettier": "1.11.1",
|
||||
"pump": "^1.0.2",
|
||||
"rimraf": "^2.4.3",
|
||||
"semver": "^5.0.0",
|
||||
"rollup-plugin-babel": "^4.0.0-beta.0",
|
||||
"rollup-plugin-node-resolve": "^3.0.2",
|
||||
"rollup-stream": "^1.24.1",
|
||||
"test262-stream": "^1.1.0",
|
||||
"through2": "^2.0.0",
|
||||
"uglify-js": "^2.4.16",
|
||||
"util.promisify": "^1.0.0",
|
||||
"vinyl-buffer": "^1.0.1",
|
||||
"vinyl-source-stream": "^2.0.0",
|
||||
"webpack": "^3.4.1",
|
||||
"webpack-dependency-suite": "^2.4.4",
|
||||
"webpack-stream": "^4.0.0"
|
||||
@@ -66,20 +73,45 @@
|
||||
"npm": ">= 2.x <= 5.x",
|
||||
"yarn": ">=0.27.5 || >=1.0.0-20170811"
|
||||
},
|
||||
"nyc": {
|
||||
"all": true,
|
||||
"exclude": [
|
||||
"scripts/*.js",
|
||||
"packages/*/test/**",
|
||||
"packages/babel-standalone/**",
|
||||
"codemods/*/test/**"
|
||||
],
|
||||
"sourceMap": false,
|
||||
"instrument": false
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.js": [
|
||||
"eslint --format=codeframe --rulesdir='./scripts/eslint_rules'"
|
||||
]
|
||||
},
|
||||
"jest": {
|
||||
"collectCoverageFrom": [
|
||||
"packages/*/src/**/*.mjs",
|
||||
"packages/*/src/**/*.js",
|
||||
"codemods/*/src/**/*.mjs",
|
||||
"codemods/*/src/**/*.js"
|
||||
],
|
||||
"testRegex": "./(packages|codemods)/[^/]+/test/.+\\.m?js$",
|
||||
"testPathIgnorePatterns": [
|
||||
"/node_modules/",
|
||||
"/test/fixtures/",
|
||||
"/test/debug-fixtures/",
|
||||
"/babylon/test/expressions/",
|
||||
"/test/tmp/",
|
||||
"/test/__data__/",
|
||||
"/test/helpers/",
|
||||
"<rootDir>/test/warning\\.js",
|
||||
"<rootDir>/build/",
|
||||
"_browser\\.js"
|
||||
],
|
||||
"testEnvironment": "node",
|
||||
"setupTestFrameworkScriptFile": "<rootDir>/test/testSetupFile.js",
|
||||
"transformIgnorePatterns": [
|
||||
"/node_modules/",
|
||||
"<rootDir>/packages/babel-standalone/babel(\\.min)?\\.js",
|
||||
"<rootDir>/packages/babel-preset-env-standalone/babel-preset-env(\\.min)?\\.js",
|
||||
"/test/(fixtures|tmp|__data__)/",
|
||||
"<rootDir>/(packages|codemods)/[^/]+/lib/"
|
||||
],
|
||||
"modulePathIgnorePatterns": [
|
||||
"/test/fixtures/",
|
||||
"/test/tmp/",
|
||||
"/test/__data__/",
|
||||
"<rootDir>/build/"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,15 +13,15 @@ A monorepo, muhahahahahaha. See the [monorepo design doc](/doc/design/monorepo.m
|
||||
|
||||
| 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/babel/tree/master/packages/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) | [](https://www.npmjs.com/package/@babel/core) | [](https://david-dm.org/babel/babel?path=packages/babel-core) |
|
||||
| [`babylon`](/packages/babylon) | [](https://www.npmjs.com/package/babylon) | [](https://david-dm.org/babel/babel?path=packages/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/babel/tree/master/packages/babylon)
|
||||
- The parser: [`babylon`](/packages/babylon)
|
||||
- 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)
|
||||
@@ -36,18 +36,18 @@ Check out the [`babel-handbook`](https://github.com/thejameskyle/babel-handbook/
|
||||
|
||||
| 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) | [](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` cli). 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/polyfill`](/packages/babel-polyfill) is [literally a wrapper](/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.
|
||||
@@ -62,7 +62,7 @@ The transformer[s] used in Babel are the independent pieces of code that transfo
|
||||
|
||||
| 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 |
|
||||
| [`@babel/preset-env`](/packages/babel-preset-env) | [](https://www.npmjs.com/package/@babel/preset-env) | [](https://david-dm.org/babel/babel?path=packages/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)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@babel/cli",
|
||||
"version": "7.0.0-beta.33",
|
||||
"version": "7.0.0-beta.44",
|
||||
"description": "Babel command line.",
|
||||
"author": "Sebastian McKenzie <sebmck@gmail.com>",
|
||||
"homepage": "https://babeljs.io/",
|
||||
@@ -29,11 +29,11 @@
|
||||
"chokidar": "^1.6.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@babel/core": "7.0.0-beta.33"
|
||||
"@babel/core": "7.0.0-beta.44"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "7.0.0-beta.33",
|
||||
"@babel/helper-fixtures": "7.0.0-beta.33"
|
||||
"@babel/core": "7.0.0-beta.44",
|
||||
"@babel/helper-fixtures": "7.0.0-beta.44"
|
||||
},
|
||||
"bin": {
|
||||
"babel": "./bin/babel.js",
|
||||
|
||||
@@ -6,10 +6,16 @@ import fs from "fs";
|
||||
|
||||
import * as util from "./util";
|
||||
|
||||
let compiledFiles = 0;
|
||||
|
||||
export default function(commander, filenames, opts) {
|
||||
function write(src, relative, base) {
|
||||
function write(src, relative, base, callback) {
|
||||
if (typeof base === "function") {
|
||||
callback = base;
|
||||
base = undefined;
|
||||
}
|
||||
if (!util.isCompilableExtension(relative, commander.extensions)) {
|
||||
return false;
|
||||
return process.nextTick(callback);
|
||||
}
|
||||
|
||||
// remove extension and then append back on .js
|
||||
@@ -17,32 +23,39 @@ export default function(commander, filenames, opts) {
|
||||
|
||||
const dest = getDest(commander, relative, base);
|
||||
|
||||
const data = util.compile(
|
||||
util.compile(
|
||||
src,
|
||||
defaults(
|
||||
{
|
||||
sourceFileName: slash(path.relative(dest + "/..", src)),
|
||||
sourceMapTarget: path.basename(relative),
|
||||
},
|
||||
opts,
|
||||
),
|
||||
function(err, res) {
|
||||
if (err) return callback(err);
|
||||
if (!res) return callback();
|
||||
|
||||
// we've requested explicit sourcemaps to be written to disk
|
||||
if (
|
||||
res.map &&
|
||||
commander.sourceMaps &&
|
||||
commander.sourceMaps !== "inline"
|
||||
) {
|
||||
const mapLoc = dest + ".map";
|
||||
res.code = util.addSourceMappingUrl(res.code, mapLoc);
|
||||
res.map.file = path.basename(relative);
|
||||
outputFileSync(mapLoc, JSON.stringify(res.map));
|
||||
}
|
||||
|
||||
outputFileSync(dest, res.code);
|
||||
util.chmod(src, dest);
|
||||
|
||||
compiledFiles += 1;
|
||||
|
||||
util.log(src + " -> " + dest);
|
||||
return callback(null, true);
|
||||
},
|
||||
);
|
||||
|
||||
if (!data) return false;
|
||||
|
||||
// we've requested explicit sourcemaps to be written to disk
|
||||
if (data.map && commander.sourceMaps && commander.sourceMaps !== "inline") {
|
||||
const mapLoc = dest + ".map";
|
||||
data.code = util.addSourceMappingUrl(data.code, mapLoc);
|
||||
outputFileSync(mapLoc, JSON.stringify(data.map));
|
||||
}
|
||||
|
||||
outputFileSync(dest, data.code);
|
||||
util.chmod(src, dest);
|
||||
|
||||
util.log(src + " -> " + dest);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function getDest(commander, filename, base) {
|
||||
@@ -50,17 +63,57 @@ export default function(commander, filenames, opts) {
|
||||
return path.join(commander.outDir, filename);
|
||||
}
|
||||
|
||||
function handleFile(src, filename, base) {
|
||||
const didWrite = write(src, filename, base);
|
||||
|
||||
if (!didWrite && commander.copyFiles) {
|
||||
const dest = getDest(commander, filename, base);
|
||||
outputFileSync(dest, fs.readFileSync(src));
|
||||
util.chmod(src, dest);
|
||||
function outputDestFolder(outDir) {
|
||||
const outDirPath = path.resolve(outDir);
|
||||
if (!fs.existsSync(outDirPath)) {
|
||||
fs.mkdirSync(outDirPath);
|
||||
}
|
||||
}
|
||||
|
||||
function handle(filename) {
|
||||
function handleFile(src, filename, base, callback) {
|
||||
if (typeof base === "function") {
|
||||
callback = base;
|
||||
base = undefined;
|
||||
}
|
||||
|
||||
write(src, filename, base, function(err, res) {
|
||||
if (err) return callback(err);
|
||||
if (!res && commander.copyFiles) {
|
||||
const dest = getDest(commander, filename, base);
|
||||
outputFileSync(dest, fs.readFileSync(src));
|
||||
util.chmod(src, dest);
|
||||
}
|
||||
|
||||
return callback();
|
||||
});
|
||||
}
|
||||
|
||||
function sequentialHandleFile(files, dirname, index, callback) {
|
||||
if (files.length === 0) {
|
||||
outputDestFolder(commander.outDir);
|
||||
return;
|
||||
}
|
||||
|
||||
if (typeof index === "function") {
|
||||
callback = index;
|
||||
index = 0;
|
||||
}
|
||||
|
||||
const filename = files[index];
|
||||
const src = path.join(dirname, filename);
|
||||
|
||||
handleFile(src, filename, dirname, function(err) {
|
||||
if (err) return callback(err);
|
||||
index++;
|
||||
if (index !== files.length) {
|
||||
sequentialHandleFile(files, dirname, index, callback);
|
||||
} else {
|
||||
callback();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function handle(filename, callback) {
|
||||
if (!fs.existsSync(filename)) return;
|
||||
|
||||
const stat = fs.statSync(filename);
|
||||
@@ -72,19 +125,39 @@ export default function(commander, filenames, opts) {
|
||||
util.deleteDir(commander.outDir);
|
||||
}
|
||||
|
||||
util
|
||||
.readdir(dirname, commander.includeDotfiles)
|
||||
.forEach(function(filename) {
|
||||
const src = path.join(dirname, filename);
|
||||
handleFile(src, filename, dirname);
|
||||
});
|
||||
const files = util.readdir(dirname, commander.includeDotfiles);
|
||||
sequentialHandleFile(files, dirname, callback);
|
||||
} else {
|
||||
write(filename, path.basename(filename), path.dirname(filename));
|
||||
write(
|
||||
filename,
|
||||
path.basename(filename),
|
||||
path.dirname(filename),
|
||||
callback,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function sequentialHandle(filenames, index = 0) {
|
||||
const filename = filenames[index];
|
||||
|
||||
handle(filename, function(err) {
|
||||
if (err) throw new Error(err);
|
||||
index++;
|
||||
if (index !== filenames.length) {
|
||||
sequentialHandle(filenames, index);
|
||||
} else {
|
||||
util.log(
|
||||
`🎉 Successfully compiled ${compiledFiles} ${
|
||||
compiledFiles > 1 ? "files" : "file"
|
||||
} with Babel.`,
|
||||
true,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!commander.skipInitialBuild) {
|
||||
filenames.forEach(handle);
|
||||
sequentialHandle(filenames);
|
||||
}
|
||||
|
||||
if (commander.watch) {
|
||||
@@ -104,7 +177,9 @@ export default function(commander, filenames, opts) {
|
||||
watcher.on(type, function(filename) {
|
||||
const relative = path.relative(dirname, filename) || filename;
|
||||
try {
|
||||
handleFile(filename, relative);
|
||||
handleFile(filename, relative, function(err) {
|
||||
if (err) throw err;
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(err.stack);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,10 @@ export default function(commander, filenames, opts) {
|
||||
|
||||
const buildResult = function() {
|
||||
const map = new sourceMap.SourceMapGenerator({
|
||||
file: path.basename(commander.outFile || "") || "stdout",
|
||||
file:
|
||||
commander.sourceMapTarget ||
|
||||
path.basename(commander.outFile || "") ||
|
||||
"stdout",
|
||||
sourceRoot: opts.sourceRoot,
|
||||
});
|
||||
|
||||
@@ -103,19 +106,21 @@ export default function(commander, filenames, opts) {
|
||||
});
|
||||
|
||||
process.stdin.on("end", function() {
|
||||
results.push(
|
||||
util.transform(
|
||||
commander.filename,
|
||||
code,
|
||||
defaults(
|
||||
{
|
||||
sourceFileName: "stdin",
|
||||
},
|
||||
opts,
|
||||
),
|
||||
util.transform(
|
||||
commander.filename,
|
||||
code,
|
||||
defaults(
|
||||
{
|
||||
sourceFileName: "stdin",
|
||||
},
|
||||
opts,
|
||||
),
|
||||
function(err, res) {
|
||||
if (err) throw err;
|
||||
results.push(res);
|
||||
output();
|
||||
},
|
||||
);
|
||||
output();
|
||||
});
|
||||
};
|
||||
|
||||
@@ -140,7 +145,9 @@ export default function(commander, filenames, opts) {
|
||||
}
|
||||
});
|
||||
|
||||
_filenames.forEach(function(filename) {
|
||||
let filesProcessed = 0;
|
||||
|
||||
_filenames.forEach(function(filename, index) {
|
||||
let sourceFilename = filename;
|
||||
if (commander.outFile) {
|
||||
sourceFilename = path.relative(
|
||||
@@ -150,7 +157,7 @@ export default function(commander, filenames, opts) {
|
||||
}
|
||||
sourceFilename = slash(sourceFilename);
|
||||
|
||||
const data = util.compile(
|
||||
util.compile(
|
||||
filename,
|
||||
defaults(
|
||||
{
|
||||
@@ -158,14 +165,18 @@ export default function(commander, filenames, opts) {
|
||||
},
|
||||
opts,
|
||||
),
|
||||
function(err, res) {
|
||||
if (err) throw err;
|
||||
|
||||
filesProcessed++;
|
||||
if (res) results[index] = res;
|
||||
|
||||
if (filesProcessed === _filenames.length) {
|
||||
output();
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
if (!data) return;
|
||||
|
||||
results.push(data);
|
||||
});
|
||||
|
||||
output();
|
||||
};
|
||||
|
||||
const files = function() {
|
||||
|
||||
@@ -32,7 +32,6 @@ function collect(value, previousValue): Array<string> {
|
||||
return previousValue ? previousValue.concat(values) : values;
|
||||
}
|
||||
|
||||
/* eslint-disable max-len */
|
||||
// Standard Babel input configs.
|
||||
commander.option(
|
||||
"-f, --filename [filename]",
|
||||
@@ -163,12 +162,11 @@ commander.option(
|
||||
"--include-dotfiles",
|
||||
"Include dotfiles when compiling and copying non-compilable files",
|
||||
);
|
||||
commander.option("-q, --quiet", "Don't log anything");
|
||||
commander.option("--verbose", "Log everything");
|
||||
commander.option(
|
||||
"--delete-dir-on-start",
|
||||
"Delete the out directory before compilation",
|
||||
);
|
||||
/* eslint-enable max-len */
|
||||
|
||||
commander.version(pkg.version + " (@babel/core " + version + ")");
|
||||
commander.usage("[options] <files ...>");
|
||||
@@ -221,6 +219,17 @@ if (commander.deleteDirOnStart && !commander.outDir) {
|
||||
errors.push("--delete-dir-on-start requires --out-dir");
|
||||
}
|
||||
|
||||
if (
|
||||
!commander.outDir &&
|
||||
filenames.length === 0 &&
|
||||
typeof commander.filename !== "string" &&
|
||||
commander.babelrc !== false
|
||||
) {
|
||||
errors.push(
|
||||
"stdin compilation requires either -f/--filename [filename] or --no-babelrc",
|
||||
);
|
||||
}
|
||||
|
||||
if (errors.length) {
|
||||
console.error(errors.join(". "));
|
||||
process.exit(2);
|
||||
@@ -243,11 +252,12 @@ delete opts.outFile;
|
||||
delete opts.outDir;
|
||||
delete opts.copyFiles;
|
||||
delete opts.includeDotfiles;
|
||||
delete opts.quiet;
|
||||
delete opts.verbose;
|
||||
delete opts.configFile;
|
||||
delete opts.deleteDirOnStart;
|
||||
delete opts.keepFileExtension;
|
||||
delete opts.relative;
|
||||
delete opts.sourceMapTarget;
|
||||
|
||||
// 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.
|
||||
|
||||
@@ -46,29 +46,30 @@ export function addSourceMappingUrl(code, loc) {
|
||||
return code + "\n//# sourceMappingURL=" + path.basename(loc);
|
||||
}
|
||||
|
||||
export function log(msg) {
|
||||
if (!commander.quiet) console.log(msg);
|
||||
export function log(msg, force) {
|
||||
if (force === true || commander.verbose) console.log(msg);
|
||||
}
|
||||
|
||||
export function transform(filename, code, opts) {
|
||||
export function transform(filename, code, opts, callback) {
|
||||
opts = Object.assign({}, opts, {
|
||||
filename,
|
||||
});
|
||||
|
||||
return babel.transform(code, opts);
|
||||
babel.transform(code, opts, callback);
|
||||
}
|
||||
|
||||
export function compile(filename, opts) {
|
||||
try {
|
||||
return babel.transformFileSync(filename, opts);
|
||||
} catch (err) {
|
||||
if (commander.watch) {
|
||||
console.error(err);
|
||||
return { ignored: true };
|
||||
} else {
|
||||
throw err;
|
||||
export function compile(filename, opts, callback) {
|
||||
babel.transformFile(filename, opts, function(err, res) {
|
||||
if (err) {
|
||||
if (commander.watch) {
|
||||
console.error(err);
|
||||
return callback(null, null);
|
||||
} else {
|
||||
return callback(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
return callback(null, res);
|
||||
});
|
||||
}
|
||||
|
||||
export function deleteDir(path) {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"args": ["--config-file", "../.othername_babelrc"]
|
||||
}
|
||||
"args": ["--config-file", "../.othername_babelrc", "-f", "file.js"]
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
"--out-dir", "lib",
|
||||
"--copy-files",
|
||||
"--include-dotfiles",
|
||||
"--ignore", "src/foo"
|
||||
"--ignore", "src/foo",
|
||||
"--verbose"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
src/index.js -> lib/index.js
|
||||
🎉 Successfully compiled 1 file with Babel.
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
"--out-dir", "lib",
|
||||
"--copy-files",
|
||||
"--include-dotfiles",
|
||||
"--only", "src/foo"
|
||||
"--only", "src/foo",
|
||||
"--verbose"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
src/foo/.foo.js -> lib/foo/.foo.js
|
||||
src/foo/bar.js -> lib/foo/bar.js
|
||||
🎉 Successfully compiled 2 files with Babel.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"args": ["src", "--out-dir", "lib", "--copy-files", "--include-dotfiles"]
|
||||
"args": ["src", "--out-dir", "lib", "--copy-files", "--include-dotfiles", "--verbose"]
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
src/.foo.js -> lib/.foo.js
|
||||
src/bar/index.js -> lib/bar/index.js
|
||||
src/foo/foo.js -> lib/foo/foo.js
|
||||
🎉 Successfully compiled 3 files with Babel.
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"src",
|
||||
"--out-dir", "lib",
|
||||
"--copy-files",
|
||||
"--ignore", "src/foo/*"
|
||||
"--ignore", "src/foo/*",
|
||||
"--verbose"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
src/index.js -> lib/index.js
|
||||
🎉 Successfully compiled 1 file with Babel.
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"src",
|
||||
"--out-dir", "lib",
|
||||
"--copy-files",
|
||||
"--only", "src/foo/*"
|
||||
"--only", "src/foo/*",
|
||||
"--verbose"
|
||||
]
|
||||
}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
src/foo/bar.js -> lib/foo/bar.js
|
||||
🎉 Successfully compiled 1 file with Babel.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"args": ["src", "--out-dir", "lib", "--copy-files"]
|
||||
"args": ["src", "--out-dir", "lib", "--copy-files", "--verbose"]
|
||||
}
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
src/bar/index.js -> lib/bar/index.js
|
||||
src/foo/foo.js -> lib/foo/foo.js
|
||||
🎉 Successfully compiled 2 files with Babel.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"args": ["src", "--out-dir", "lib", "--ignore", "src/bar"]
|
||||
"args": ["src", "--out-dir", "lib", "--ignore", "src/bar", "--verbose"]
|
||||
}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
src/foobar/foo.js -> lib/foobar/foo.js
|
||||
🎉 Successfully compiled 1 file with Babel.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"args": ["src", "--out-dir", "lib", "--ignore", "**/*.foo.js"]
|
||||
"args": ["src", "--out-dir", "lib", "--ignore", "**/*.foo.js", "--verbose"]
|
||||
}
|
||||
|
||||
@@ -2,3 +2,4 @@ src/a.js -> lib/a.js
|
||||
src/b.js -> lib/b.js
|
||||
src/baz/c.js -> lib/baz/c.js
|
||||
src/foo.js -> lib/foo.js
|
||||
🎉 Successfully compiled 4 files with Babel.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"args": ["src", "--out-dir", "lib", "--ignore", "src/foo/*"]
|
||||
"args": ["src", "--out-dir", "lib", "--ignore", "src/foo/*", "--verbose"]
|
||||
}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
src/bar/index.js -> lib/bar/index.js
|
||||
🎉 Successfully compiled 1 file with Babel.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"args": ["src", "--out-dir", "lib", "--only", "**/*.foo.js"]
|
||||
"args": ["src", "--out-dir", "lib", "--only", "**/*.foo.js", "--verbose"]
|
||||
}
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
src/a.foo.js -> lib/a.foo.js
|
||||
src/baz/b.foo.js -> lib/baz/b.foo.js
|
||||
🎉 Successfully compiled 2 files with Babel.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"args": ["src", "--out-dir", "lib", "--only", "src/bar/*"]
|
||||
"args": ["src", "--out-dir", "lib", "--only", "src/bar/*", "--verbose"]
|
||||
}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
src/bar/index.js -> lib/bar/index.js
|
||||
🎉 Successfully compiled 1 file with Babel.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"args": ["src", "--out-dir", "lib", "--copy-files"]
|
||||
"args": ["src", "--out-dir", "lib", "--copy-files", "--verbose"]
|
||||
}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
src/foo.js -> lib/foo.js
|
||||
🎉 Successfully compiled 1 file with Babel.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"args": ["src", "--out-dir", "lib", "--keep-file-extension"]
|
||||
"args": ["src", "--out-dir", "lib", "--keep-file-extension", "--verbose"]
|
||||
}
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
src/bar.mjs -> lib/bar.mjs
|
||||
src/foo.js -> lib/foo.js
|
||||
🎉 Successfully compiled 2 files with Babel.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"args": ["**/src", "--out-dir", "../lib", "--relative"]
|
||||
"args": ["**/src", "--out-dir", "../lib", "--relative", "--verbose"]
|
||||
}
|
||||
|
||||
@@ -2,3 +2,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
|
||||
🎉 Successfully compiled 4 files with Babel.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"args": ["src", "--source-maps", "inline", "--out-dir", "lib"]
|
||||
"args": ["src", "--source-maps", "inline", "--out-dir", "lib", "--verbose"]
|
||||
}
|
||||
|
||||
@@ -7,4 +7,4 @@ function _classCallCheck(instance, Constructor) { if (!_instanceof(instance, Con
|
||||
var Test = function Test() {
|
||||
_classCallCheck(this, Test);
|
||||
};
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXIvYmFyLmpzIl0sIm5hbWVzIjpbIlRlc3QiXSwibWFwcGluZ3MiOiI7Ozs7OztJQUFNQSxJIiwiZmlsZSI6ImJhci5qcyIsInNvdXJjZXNDb250ZW50IjpbImNsYXNzIFRlc3Qge1xuXG59Il19
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9iYXIvYmFyLmpzIl0sIm5hbWVzIjpbIlRlc3QiXSwibWFwcGluZ3MiOiI7Ozs7OztJQUFNQSxJIiwic291cmNlc0NvbnRlbnQiOlsiY2xhc3MgVGVzdCB7XG5cbn0iXX0=
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
arr.map(function (x) {
|
||||
return x * MULTIPLIER;
|
||||
});
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9mb28uanMiXSwibmFtZXMiOlsiYXJyIiwibWFwIiwieCIsIk1VTFRJUExJRVIiXSwibWFwcGluZ3MiOiI7O0FBQUFBLElBQUlDLEdBQUosQ0FBUTtBQUFBLFNBQUtDLElBQUlDLFVBQVQ7QUFBQSxDQUFSIiwiZmlsZSI6ImZvby5qcyIsInNvdXJjZXNDb250ZW50IjpbImFyci5tYXAoeCA9PiB4ICogTVVMVElQTElFUik7Il19
|
||||
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3NyYy9mb28uanMiXSwibmFtZXMiOlsiYXJyIiwibWFwIiwieCIsIk1VTFRJUExJRVIiXSwibWFwcGluZ3MiOiI7O0FBQUFBLElBQUlDLEdBQUosQ0FBUTtBQUFBLFNBQUtDLElBQUlDLFVBQVQ7QUFBQSxDQUFSIiwic291cmNlc0NvbnRlbnQiOlsiYXJyLm1hcCh4ID0+IHggKiBNVUxUSVBMSUVSKTsiXX0=
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
src/bar/bar.js -> lib/bar/bar.js
|
||||
src/foo.js -> lib/foo.js
|
||||
🎉 Successfully compiled 2 files with Babel.
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"args": ["src", "--source-maps", "--out-dir", "lib"]
|
||||
"args": ["src", "--source-maps", "--out-dir", "lib", "--verbose"]
|
||||
}
|
||||
|
||||
@@ -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","sourcesContent":["class Test {\n\n}"],"file":"bar.js"}
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../src/foo.js"],"names":["arr","map","x","MULTIPLIER"],"mappings":";;AAAAA,IAAIC,GAAJ,CAAQ;AAAA,SAAKC,IAAIC,UAAT;AAAA,CAAR","file":"foo.js","sourcesContent":["arr.map(x => x * MULTIPLIER);"]}
|
||||
{"version":3,"sources":["../src/foo.js"],"names":["arr","map","x","MULTIPLIER"],"mappings":";;AAAAA,IAAIC,GAAJ,CAAQ;AAAA,SAAKC,IAAIC,UAAT;AAAA,CAAR","sourcesContent":["arr.map(x => x * MULTIPLIER);"],"file":"foo.js"}
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
src/bar/bar.js -> lib/bar/bar.js
|
||||
src/foo.js -> lib/foo.js
|
||||
🎉 Successfully compiled 2 files with Babel.
|
||||
|
||||
3
packages/babel-cli/test/fixtures/babel/dir --out-dir --verbose/in-files/src/bar/bar.js
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/dir --out-dir --verbose/in-files/src/bar/bar.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
class Test {
|
||||
|
||||
}
|
||||
1
packages/babel-cli/test/fixtures/babel/dir --out-dir --verbose/in-files/src/foo.js
vendored
Normal file
1
packages/babel-cli/test/fixtures/babel/dir --out-dir --verbose/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 --verbose/options.json
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/dir --out-dir --verbose/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"args": ["src", "--out-dir", "lib", "--verbose"]
|
||||
}
|
||||
9
packages/babel-cli/test/fixtures/babel/dir --out-dir --verbose/out-files/lib/bar/bar.js
vendored
Normal file
9
packages/babel-cli/test/fixtures/babel/dir --out-dir --verbose/out-files/lib/bar/bar.js
vendored
Normal file
@@ -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 Test = function Test() {
|
||||
_classCallCheck(this, Test);
|
||||
};
|
||||
5
packages/babel-cli/test/fixtures/babel/dir --out-dir --verbose/out-files/lib/foo.js
vendored
Normal file
5
packages/babel-cli/test/fixtures/babel/dir --out-dir --verbose/out-files/lib/foo.js
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
|
||||
arr.map(function (x) {
|
||||
return x * MULTIPLIER;
|
||||
});
|
||||
3
packages/babel-cli/test/fixtures/babel/dir --out-dir --verbose/stdout.txt
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/dir --out-dir --verbose/stdout.txt
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
src/bar/bar.js -> lib/bar/bar.js
|
||||
src/foo.js -> lib/foo.js
|
||||
🎉 Successfully compiled 2 files with Babel.
|
||||
@@ -1,2 +1 @@
|
||||
src/bar/bar.js -> lib/bar/bar.js
|
||||
src/foo.js -> lib/foo.js
|
||||
🎉 Successfully compiled 2 files with Babel.
|
||||
|
||||
3
packages/babel-cli/test/fixtures/babel/empty dir --out-dir/options.json
vendored
Normal file
3
packages/babel-cli/test/fixtures/babel/empty dir --out-dir/options.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"args": ["src", "--out-dir", "lib"]
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"args": ["src/foo.js", "--out-dir", "../lib", "--relative"]
|
||||
"args": ["src/foo.js", "--out-dir", "../lib", "--relative", "--verbose"]
|
||||
}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
src/foo.js -> lib/foo.js
|
||||
🎉 Successfully compiled 1 file with Babel.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user