-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
Refactor Host Config Infra (getting rid of .inline*.js) #18240
Conversation
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 fd4699d:
|
Oh, this also delete react-reconciler/persistent since that's just a flag on host config now. |
This no longer makes any sense because it react-reconciler takes supportsMutation or supportsPersistence as options. It's no longer based on feature flags.
We now explicitly list which paths we want to be checked by a renderer. For every other renderer config we ignore those paths. Nothing is "any" typed. So if some transitive dependency isn't reachable it won't be accidentally "any" that leaks.
'react-dom', | ||
'react-dom/unstable-fizz', | ||
'react-dom/unstable-fizz.node', | ||
'react-dom/src/server/ReactDOMFizzServerNode.js', // react-dom/unstable-fizz.node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are explicitly called out so they get ignored in "dom-browser" and vice versa. Which otherwise has a lot of overlapping paths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't remember why I added any of this. Delete it
I kept forgetting what the various .inline files are supposed to do, and it made it hard to add more combinations.
The first thing this does is getting rid of the various renderer depending on the indirection pseudo entry point (inline.dom.js etc). Instead we just deep require the reconciler. We do this for other files anyway and there's nothing really preventing this. Instead, we can just use the entry-point of the actual renderer as the jest hook to initialize the correct host config.
The actual react-reconciler/index.js entry point should only represent the public API (currently a function wrapper published to npm). Not used by us.
There are no longer any untyped files so we don't need the special inline-typed form. The untyped files caused some uncertainty since once an untyped file gets into the system it leaks the any all over the place. It also wasn't a sufficient approach (I had some hacks to hide DOM).
Instead, for Flow, in this approach we explicitly select which paths we want to check for each renderer. The inverse gets ignored. So every path is still covered by some renderer.
These ignores are not untyped so if a dependency accidentally tries to reach into something that isn't covered, then that will be an error. Not silently leak "any".