Summary:
Release notes: none
Currently, you register a React component tree with `__registerReactComponent(component)`.
This PR changes this global to `__optimizeReactComponentTree(rootComponent, config)`. Notice it now supports two arguments `rootComponent` and `config` – although config is optional.
This global now also returns the original component passed in, so it can be added to existing codebase without having to break logic flow.
This config argument allows the user to define how that React component tree will be optimized. More work will be added to this in upcoming PRs, but for now this PR is just a quick rename plus small refactor of the Prepack global.
I've also had to rename the global in all tests. I've also added some doc as to how all this works: https://github.com/facebook/prepack/wiki/React-Compiler
Closes https://github.com/facebook/prepack/pull/1527
Differential Revision: D7149728
Pulled By: trueadm
fbshipit-source-id: 8d04d8dec8c0a03a6ccdb9587884bf6375010203
Summary:
Currently, there are too many cases where ReactElement evaluation bails out. This PR aims to solve many of those cases:
- [x] Ensure `props` have a deleted `key` and `ref`
- [x] Refactor JSX evaluation to properly handle and deal with JSX spreads
- [x] Ensure all react-tests run both transpiled and non-transpiled so the `React.createElement` route can be evaluated and tested
- [x] Refactor React.createElement mock to work like the JSX evaluator
- [x] Throw and error when we've detected cases where `key` and `ref` are abstract and not deleted or defined
Will do in a follow up PR once other PRs land:
- Ensure that we internally pass around `reactHint` in cases of `Object.assign`
Closes https://github.com/facebook/prepack/pull/1447
Differential Revision: D7049578
Pulled By: trueadm
fbshipit-source-id: 7f8330c8e4c47c5095b672f686cedc593852a6a8