Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not bail on SHOW_CONFIG_FOR matches #12954

Merged
merged 6 commits into from Mar 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1 +1,2 @@
"use strict";
"use strict";
Expand Up @@ -29,3 +29,4 @@ programmatic options from @babel/cli
},
"filename": "src//foo.js"
}
-----End Babel configs-----
@@ -1 +1,2 @@
"use strict";
"use strict";
Expand Up @@ -29,3 +29,4 @@ programmatic options from @babel/cli
},
"filename": "src/foo.js"
}
-----End Babel configs-----
@@ -0,0 +1 @@
"use strict";
Expand Up @@ -29,4 +29,5 @@ programmatic options from @babel/cli
},
"filename": "src//foo.js"
}
Successfully compiled 1 file with Babel (123ms).
-----End Babel configs-----
Successfully compiled 2 files with Babel (123ms).
Expand Up @@ -11,7 +11,6 @@ module.exports = {
"@foo/babel-preset-1",
[
{
name: "@foo/inline-babel-preset-1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Q: What is this change needed for?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Babel will throw name is not a valid option. I didn't know name is forbidden on preset until now. 🤦‍♂️

plugins: [
{
name: "@foo/inline-babel-plugin-1",
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Expand Up @@ -39,7 +39,6 @@ config <CWD>/my-extended.js .overrides[0].env["test"]
"@foo/babel-preset-1",
[
{
"name": "@foo/inline-babel-preset-1",
"plugins": [
{
"name": "@foo/inline-babel-plugin-1",
Expand Down Expand Up @@ -125,3 +124,5 @@ programmatic options from @babel/cli
},
"filename": "./src/index.js"
}
-----End Babel configs-----
"use strict";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should print a separator between the code and the config? Something like


================================================================================

As an alternative, maybe it would be better to print the config on stderr so that it doesn't breaks things such as

cat input.js | babel --config-file ./babel.config.json > output.js

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the debug output should be directed to stderr.

For example curl -v http://example.com/example.avif > example.avif will also break, unless we specify -O example.avif. Similary in this case, consider use --out-file example.js instead.

4 changes: 2 additions & 2 deletions packages/babel-core/src/config/config-chain.js
Expand Up @@ -261,9 +261,9 @@ export function* buildRootChain(
// print config by the order of ascending priority
[configReport, babelRcReport, programmaticReport]
.filter(x => !!x)
.join("\n\n"),
.join("\n\n") +
"\n-----End Babel configs-----",
);
return null;
}
// Insert file chain in front so programmatic options have priority
// over configuration file chain items.
Expand Down