fix: print warning messages to stderr (#12626)
This commit is contained in:
parent
bd4590e546
commit
6e9a174e7f
@ -103,17 +103,14 @@ function outputDecimalWarning(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("Warning, the following targets are using a decimal version:");
|
console.warn("Warning, the following targets are using a decimal version:\n");
|
||||||
console.log("");
|
|
||||||
decimalTargets.forEach(({ target, value }) =>
|
decimalTargets.forEach(({ target, value }) =>
|
||||||
console.log(` ${target}: ${value}`),
|
console.warn(` ${target}: ${value}`),
|
||||||
);
|
);
|
||||||
console.log("");
|
console.warn(`
|
||||||
console.log(
|
We recommend using a string for minor/patch versions to avoid numbers like 6.10
|
||||||
"We recommend using a string for minor/patch versions to avoid numbers like 6.10",
|
getting parsed as 6.1, which can lead to unexpected behavior.
|
||||||
);
|
`);
|
||||||
console.log("getting parsed as 6.1, which can lead to unexpected behavior.");
|
|
||||||
console.log("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function semverifyTarget(target, value) {
|
function semverifyTarget(target, value) {
|
||||||
|
|||||||
@ -251,23 +251,18 @@ export default declare((api, opts) => {
|
|||||||
hasUglifyTarget = true;
|
hasUglifyTarget = true;
|
||||||
delete optionsTargets.uglify;
|
delete optionsTargets.uglify;
|
||||||
|
|
||||||
console.log("");
|
console.warn(`
|
||||||
console.log("The uglify target has been deprecated. Set the top level");
|
The uglify target has been deprecated. Set the top level
|
||||||
console.log("option `forceAllTransforms: true` instead.");
|
option \`forceAllTransforms: true\` instead.
|
||||||
console.log("");
|
`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (optionsTargets?.esmodules && optionsTargets.browsers) {
|
if (optionsTargets?.esmodules && optionsTargets.browsers) {
|
||||||
console.log("");
|
console.warn(`
|
||||||
console.log(
|
@babel/preset-env: esmodules and browsers targets have been specified together.
|
||||||
"@babel/preset-env: esmodules and browsers targets have been specified together.",
|
\`browsers\` target, \`${optionsTargets.browsers.toString()}\` will be ignored.
|
||||||
);
|
`);
|
||||||
console.log(
|
|
||||||
// $FlowIgnore
|
|
||||||
`\`browsers\` target, \`${optionsTargets.browsers}\` will be ignored.`,
|
|
||||||
);
|
|
||||||
console.log("");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const targets = getTargets(
|
const targets = getTargets(
|
||||||
|
|||||||
@ -184,7 +184,7 @@ export function normalizeCoreJSOption(
|
|||||||
const version = rawVersion ? coerce(String(rawVersion)) : false;
|
const version = rawVersion ? coerce(String(rawVersion)) : false;
|
||||||
|
|
||||||
if (!useBuiltIns && version) {
|
if (!useBuiltIns && version) {
|
||||||
console.log(
|
console.warn(
|
||||||
"\nWARNING (@babel/preset-env): The `corejs` option only has an effect when the `useBuiltIns` option is not `false`\n",
|
"\nWARNING (@babel/preset-env): The `corejs` option only has an effect when the `useBuiltIns` option is not `false`\n",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
1
packages/babel-preset-env/test/fixtures/debug/corejs-without-usebuiltins/stderr.txt
vendored
Normal file
1
packages/babel-preset-env/test/fixtures/debug/corejs-without-usebuiltins/stderr.txt
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
WARNING (@babel/preset-env): The `corejs` option only has an effect when the `useBuiltIns` option is not `false`
|
||||||
@ -1,5 +1,3 @@
|
|||||||
WARNING (@babel/preset-env): The `corejs` option only has an effect when the `useBuiltIns` option is not `false`
|
|
||||||
|
|
||||||
@babel/preset-env: `DEBUG` option
|
@babel/preset-env: `DEBUG` option
|
||||||
|
|
||||||
Using targets:
|
Using targets:
|
||||||
|
|||||||
6
packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/stderr.txt
vendored
Normal file
6
packages/babel-preset-env/test/fixtures/debug/entry-corejs2-electron/stderr.txt
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
Warning, the following targets are using a decimal version:
|
||||||
|
|
||||||
|
electron: 0.36
|
||||||
|
|
||||||
|
We recommend using a string for minor/patch versions to avoid numbers like 6.10
|
||||||
|
getting parsed as 6.1, which can lead to unexpected behavior.
|
||||||
@ -1,10 +1,3 @@
|
|||||||
Warning, the following targets are using a decimal version:
|
|
||||||
|
|
||||||
electron: 0.36
|
|
||||||
|
|
||||||
We recommend using a string for minor/patch versions to avoid numbers like 6.10
|
|
||||||
getting parsed as 6.1, which can lead to unexpected behavior.
|
|
||||||
|
|
||||||
@babel/preset-env: `DEBUG` option
|
@babel/preset-env: `DEBUG` option
|
||||||
|
|
||||||
Using targets:
|
Using targets:
|
||||||
|
|||||||
7
packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/stderr.txt
vendored
Normal file
7
packages/babel-preset-env/test/fixtures/debug/entry-corejs2-versions-decimals/stderr.txt
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Warning, the following targets are using a decimal version:
|
||||||
|
|
||||||
|
electron: 0.36
|
||||||
|
node: 6.1
|
||||||
|
|
||||||
|
We recommend using a string for minor/patch versions to avoid numbers like 6.10
|
||||||
|
getting parsed as 6.1, which can lead to unexpected behavior.
|
||||||
@ -1,11 +1,3 @@
|
|||||||
Warning, the following targets are using a decimal version:
|
|
||||||
|
|
||||||
electron: 0.36
|
|
||||||
node: 6.1
|
|
||||||
|
|
||||||
We recommend using a string for minor/patch versions to avoid numbers like 6.10
|
|
||||||
getting parsed as 6.1, which can lead to unexpected behavior.
|
|
||||||
|
|
||||||
@babel/preset-env: `DEBUG` option
|
@babel/preset-env: `DEBUG` option
|
||||||
|
|
||||||
Using targets:
|
Using targets:
|
||||||
|
|||||||
6
packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/stderr.txt
vendored
Normal file
6
packages/babel-preset-env/test/fixtures/debug/entry-corejs3-electron/stderr.txt
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
Warning, the following targets are using a decimal version:
|
||||||
|
|
||||||
|
electron: 0.36
|
||||||
|
|
||||||
|
We recommend using a string for minor/patch versions to avoid numbers like 6.10
|
||||||
|
getting parsed as 6.1, which can lead to unexpected behavior.
|
||||||
@ -1,10 +1,3 @@
|
|||||||
Warning, the following targets are using a decimal version:
|
|
||||||
|
|
||||||
electron: 0.36
|
|
||||||
|
|
||||||
We recommend using a string for minor/patch versions to avoid numbers like 6.10
|
|
||||||
getting parsed as 6.1, which can lead to unexpected behavior.
|
|
||||||
|
|
||||||
@babel/preset-env: `DEBUG` option
|
@babel/preset-env: `DEBUG` option
|
||||||
|
|
||||||
Using targets:
|
Using targets:
|
||||||
|
|||||||
7
packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/stderr.txt
vendored
Normal file
7
packages/babel-preset-env/test/fixtures/debug/entry-corejs3-versions-decimals/stderr.txt
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
Warning, the following targets are using a decimal version:
|
||||||
|
|
||||||
|
electron: 0.36
|
||||||
|
node: 6.1
|
||||||
|
|
||||||
|
We recommend using a string for minor/patch versions to avoid numbers like 6.10
|
||||||
|
getting parsed as 6.1, which can lead to unexpected behavior.
|
||||||
@ -1,11 +1,3 @@
|
|||||||
Warning, the following targets are using a decimal version:
|
|
||||||
|
|
||||||
electron: 0.36
|
|
||||||
node: 6.1
|
|
||||||
|
|
||||||
We recommend using a string for minor/patch versions to avoid numbers like 6.10
|
|
||||||
getting parsed as 6.1, which can lead to unexpected behavior.
|
|
||||||
|
|
||||||
@babel/preset-env: `DEBUG` option
|
@babel/preset-env: `DEBUG` option
|
||||||
|
|
||||||
Using targets:
|
Using targets:
|
||||||
|
|||||||
@ -7,3 +7,6 @@ You should also be sure that the version you pass to the `corejs` option matches
|
|||||||
|
|
||||||
More info about useBuiltIns: https://babeljs.io/docs/en/babel-preset-env#usebuiltins
|
More info about useBuiltIns: https://babeljs.io/docs/en/babel-preset-env#usebuiltins
|
||||||
More info about core-js: https://babeljs.io/docs/en/babel-preset-env#corejs
|
More info about core-js: https://babeljs.io/docs/en/babel-preset-env#corejs
|
||||||
|
|
||||||
|
The uglify target has been deprecated. Set the top level
|
||||||
|
option `forceAllTransforms: true` instead.
|
||||||
|
|||||||
@ -1,6 +1,3 @@
|
|||||||
The uglify target has been deprecated. Set the top level
|
|
||||||
option `forceAllTransforms: true` instead.
|
|
||||||
|
|
||||||
@babel/preset-env: `DEBUG` option
|
@babel/preset-env: `DEBUG` option
|
||||||
|
|
||||||
Using targets:
|
Using targets:
|
||||||
|
|||||||
6
packages/babel-preset-env/test/fixtures/debug/plugins-only/stderr.txt
vendored
Normal file
6
packages/babel-preset-env/test/fixtures/debug/plugins-only/stderr.txt
vendored
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
Warning, the following targets are using a decimal version:
|
||||||
|
|
||||||
|
node: 7.4
|
||||||
|
|
||||||
|
We recommend using a string for minor/patch versions to avoid numbers like 6.10
|
||||||
|
getting parsed as 6.1, which can lead to unexpected behavior.
|
||||||
@ -1,10 +1,3 @@
|
|||||||
Warning, the following targets are using a decimal version:
|
|
||||||
|
|
||||||
node: 7.4
|
|
||||||
|
|
||||||
We recommend using a string for minor/patch versions to avoid numbers like 6.10
|
|
||||||
getting parsed as 6.1, which can lead to unexpected behavior.
|
|
||||||
|
|
||||||
@babel/preset-env: `DEBUG` option
|
@babel/preset-env: `DEBUG` option
|
||||||
|
|
||||||
Using targets:
|
Using targets:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user