Drop whitelist option (#181)

This commit is contained in:
Artem Yavorsky 2017-03-07 04:41:55 +02:00 committed by Brian Ng
parent 7348637a1e
commit 970f8ebaf8
2 changed files with 2 additions and 21 deletions

View File

@ -146,8 +146,6 @@ Outputs the targets/plugins used and the version specified in [plugin data versi
`Array<string>`, defaults to `[]`.
> NOTE: `whitelist` is deprecated and will be removed in the next major in favor of this.
An array of plugins to always include.
Valid options include any of the [babel plugins](https://github.com/babel/babel-preset-env/blob/master/data/plugin-features.js) or [built-ins](https://github.com/babel/babel-preset-env/blob/master/data/built-in-features.js), such as `transform-es2015-arrow-functions`, `map`, `set`, or `object.assign`.

View File

@ -12,8 +12,6 @@ const validIncludesAndExcludes = [
...defaultInclude
];
let hasBeenWarned = false;
export const validateIncludesAndExcludes = (opts = [], type) => {
invariant(
Array.isArray(opts),
@ -82,27 +80,12 @@ export const getElectronChromeVersion = (electronVersion) => {
};
export default function normalizeOptions(opts) {
// TODO: remove whitelist in favor of include in next major
if (opts.whitelist && !hasBeenWarned) {
console.warn(
`Deprecation Warning: The "whitelist" option has been deprecated in favor of "include" to
match the newly added "exclude" option (instead of "blacklist").`
);
hasBeenWarned = true;
}
invariant(
!(opts.whitelist && opts.include),
`Invalid Option: The "whitelist" and the "include" option are the same and one can be used at
a time`
);
checkDuplicateIncludeExcludes(opts.whitelist || opts.include, opts.exclude);
checkDuplicateIncludeExcludes(opts.include, opts.exclude);
return {
debug: opts.debug,
exclude: validateIncludesAndExcludes(opts.exclude, "exclude"),
include: validateIncludesAndExcludes(opts.whitelist || opts.include, "include"),
include: validateIncludesAndExcludes(opts.include, "include"),
loose: validateLooseOption(opts.loose),
moduleType: validateModulesOption(opts.modules),
targets: opts.targets,