Expose the Flow 'all' option on the preset too. (#8016)

| Q                        | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues?            | 
| Patch: Bug Fix?          | 
| Major: Breaking Change?  |
| Minor: New Feature?      |
| Tests Added + Pass?      | Yes
| Documentation PR         | <!-- If so, add `[skip ci]` to your commit message to skip CI -->
| Any Dependency Changes?  |
| License                  | MIT

The `all` option landed in https://github.com/babel/babel/pull/7934/files#diff-3a8233bcd2766d2c7d87f23f944f7726R3 but it is only exposed from the plugin, not the preset, so this exposes it there too since the flow preset is what we want people to use.
This commit is contained in:
Logan Smyth 2018-05-23 13:40:22 -07:00 committed by GitHub
parent 2af7a33c4e
commit 5cd1276a27
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -7,6 +7,10 @@ export default declare((api, options) => {
// the @flow pragma was provided. // the @flow pragma was provided.
const { all } = options; const { all } = options;
if (typeof all !== "boolean" && typeof all !== "undefined") {
throw new Error(".all must be a boolean, or undefined");
}
return { return {
manipulateOptions(opts, parserOpts) { manipulateOptions(opts, parserOpts) {
// If the file has already enabled TS, assume that this is not a // If the file has already enabled TS, assume that this is not a

View File

@ -1,10 +1,10 @@
import { declare } from "@babel/helper-plugin-utils"; import { declare } from "@babel/helper-plugin-utils";
import transformFlowStripTypes from "@babel/plugin-transform-flow-strip-types"; import transformFlowStripTypes from "@babel/plugin-transform-flow-strip-types";
export default declare(api => { export default declare((api, { all }) => {
api.assertVersion(7); api.assertVersion(7);
return { return {
plugins: [transformFlowStripTypes], plugins: [[transformFlowStripTypes, { all }]],
}; };
}); });