[Fresh] Make transform resilient to plugin order#15883
Merged
gaearon merged 3 commits intofacebook:masterfrom Jun 14, 2019
Merged
[Fresh] Make transform resilient to plugin order#15883gaearon merged 3 commits intofacebook:masterfrom
gaearon merged 3 commits intofacebook:masterfrom
Conversation
Destructuring transform messes up the way we collect signatures for Hooks. This adds failing tests.
This introduces a bit of a perf penalty but makes our plugin resilient to presence of destructuring transform and their order. Fixes new tests.
Details of bundled changes.Comparing: 2fe8fd2...3d654b2 react-fresh
Generated by 🚫 dangerJS |
threepointone
approved these changes
Jun 14, 2019
gaearon
added a commit
to gaearon/react
that referenced
this pull request
Jun 19, 2019
* Run Fresh tests in two modes: with and without destructuring Destructuring transform messes up the way we collect signatures for Hooks. This adds failing tests. * Extract collecting calls to Hooks into a separate visitor This introduces a bit of a perf penalty but makes our plugin resilient to presence of destructuring transform and their order. Fixes new tests. * Inline some logic into the call visitor
rickhanlonii
pushed a commit
to rickhanlonii/react
that referenced
this pull request
Jun 25, 2019
* Run Fresh tests in two modes: with and without destructuring Destructuring transform messes up the way we collect signatures for Hooks. This adds failing tests. * Extract collecting calls to Hooks into a separate visitor This introduces a bit of a perf penalty but makes our plugin resilient to presence of destructuring transform and their order. Fixes new tests. * Inline some logic into the call visitor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
First commit makes Fresh integration tests run in two modes: with and without destructuring transform. This adds failing tests because currently we're not resilient to the plugin order issues. If destructuring transform visits our nodes first, we can't recover info about Hook signatures later. (Look at it with
?w=1.)Second commit solves this problem by adding an early traversal that collects Hook calls. In general early traversals should be avoided. But that's the only way we can collect signatures before they're mangled. To mitigate the perf concern, we make sure this early traversal doesn't do any mutations. So at least it won't have cause cascade issues. It's also very simple. This fixes the new tests.
The last commit is just a minor refactoring.