dillon1000/react

Commit

[Fresh] Babel plugin now handles HOCs + add integration tests (#15724)

* Refactor component search to prepare for deeper traversals

* Register HOCs with intermediate results

* Register components that are used as JSX types

* Add integration test skeleton

The integration test combines testing runtime together with the Babel plugin. It's a bit harder to debug because multiple things can go wrong, but it helps us build confidence that specific scenarios work well.

* Add HOC integration test and fix conflict with JSX transform

* Infer usage from createElement too

This helps us avoid dependency on the plugin order.

* Remove outdated comments

* Wrap tests in __DEV__

* Support export default hoc(...) for anonymous functions

* Fix test indentation

* Fix comment typo

* Use named function for test as this case is more important
Browse files
Changed paths5 files
First-parent comparison
M packages/react-fresh/src/ReactFreshBabelPlugin.js ModifiedM packages/react-fresh/src/__tests__/ReactFresh-test.js ModifiedM packages/react-fresh/src/__tests__/ReactFreshBabelPlugin-test.js ModifiedA packages/react-fresh/src/__tests__/ReactFreshIntegration-test.js AddedM packages/react-fresh/src/__tests__/__snapshots__/ReactFreshBabelPlugin-test.js.snap Modified
Patch

Files changed

Rendering syntax-highlighted changes…