forked from babel/babel
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/pipeline-operator-proposals
* master: (140 commits) Update to beta.42 (babel#7609) Disable flow on transformClass, fix preset-env errors (babel#7605) Logical Assignment: ensure computed key isn't recomputed (babel#7604) Remove obsolete max-len eslint rule and reformat some stuff to fit (babel#7602) Centralize Babel's own compilation config to make it easier to follow. (babel#7599) Run prettier to format all JSON. Tweak es2015-related plugin order in preset-env (babel#7586) Refactored quirky inheritance in babel-plugin-transform-classes (babel#7444) Add RegExp support to include/exclude preset-env options (babel#7242) v7.0.0-beta.42 Use strict namespace behavior for mjs files. (babel#7545) Remove outdated spec deviation note [skip ci] (babel#7571) Ensure that the backward-compat logic for plugin-utils copies over the version API properly. (babel#7580) Rename actual/expected test files to input/output (babel#7578) Use helper-module-import inside entry plugin too Use helper-module-imports instead of custom import (babel#7457) Fix "Module build failed: Error: Cannot find module '@babel/types'" (babel#7575) Wrap wrapNativeSuper helpers in redefining functions for better tree-shakeability (babel#7188) Favour extends helper over objectWithoutProperties when whole object gets copied anyway (babel#7390) Fix incorrect value of _cache in _wrapNativeSuper (babel#7570) ...
- Loading branch information
Showing
1,411 changed files
with
15,320 additions
and
7,451 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,72 +1,69 @@ | ||
"use strict"; | ||
|
||
// Thanks 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 envOpts = { | ||
loose: true, | ||
}; | ||
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 }], | ||
], | ||
overrides: [{ | ||
test: "packages/babylon", | ||
const config = { | ||
comments: false, | ||
presets: [["@babel/env", envOpts]], | ||
plugins: [ | ||
"babel-plugin-transform-charcodes", | ||
["@babel/transform-for-of", { assumeArray: true }], | ||
// 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 }], | ||
convertESM ? "@babel/transform-modules-commonjs" : null, | ||
].filter(Boolean), | ||
overrides: [ | ||
{ | ||
test: "packages/babylon", | ||
plugins: [ | ||
"babel-plugin-transform-charcodes", | ||
["@babel/transform-for-of", { assumeArray: 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; | ||
// 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; | ||
}; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
package.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.