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

Pass assumptions set in presets to plugins #13321

Merged

Conversation

nicolo-ribaudo
Copy link
Member

@nicolo-ribaudo nicolo-ribaudo commented May 16, 2021

Q                       A
Fixed Issues? Fixes #13316
Patch: Bug Fix?
Major: Breaking Change?
Minor: New Feature?
Tests Added + Pass? Yes
Documentation PR Link
Any Dependency Changes?
License MIT

The problem was that we where building the plugin API context using assumptions coming from the config options, completely ignoring the assumptions set by presets.

@nicolo-ribaudo nicolo-ribaudo added PR: Bug Fix 🐛 A type of pull request used for our changelog categories area: assumptions labels May 16, 2021
@babel-bot
Copy link
Collaborator

babel-bot commented May 16, 2021

Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/46185/

@billyjanitsch
Copy link

Thank you for the quick fix, @nicolo-ribaudo! ❤️

(The assumptions feature is great btw, can't wait to use it.)

@codesandbox-ci
Copy link

codesandbox-ci bot commented May 16, 2021

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit f1ab26e:

Sandbox Source
babel-repl-custom-plugin Configuration
babel-plugin-multi-config Configuration

@@ -68,10 +68,9 @@ export default gensync<(inputOpts: unknown) => ResolvedConfig | null>(
throw new Error("Assertion failure - plugins and presets exist");
}

const pluginContext: Context.FullPlugin = {
const presetContext: Context.FullPreset = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Will presetContext.assumptions be undefined?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but it doesn't matter because the preset API doesn't have a method to read assumptions anyway.

@nicolo-ribaudo nicolo-ribaudo merged commit f85c643 into babel:main May 17, 2021
@nicolo-ribaudo nicolo-ribaudo deleted the assumptions-preset-to-plugin branch May 17, 2021 20:00
@github-actions github-actions bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Aug 17, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: assumptions outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Bug Fix 🐛 A type of pull request used for our changelog categories
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: assumptions specified in presets are not respected
6 participants