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

Refactor Host Config Infra (getting rid of .inline*.js) #18240

Merged
merged 5 commits into from
Mar 7, 2020

Conversation

sebmarkbage
Copy link
Collaborator

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".

@facebook-github-bot facebook-github-bot added React Core Team Opened by a member of the React Core Team CLA Signed labels Mar 6, 2020
@sebmarkbage sebmarkbage changed the title Refactor Host Config (getting rid of .inline*.js) Refactor Host Config Infra (getting rid of .inline*.js) Mar 6, 2020
@codesandbox-ci
Copy link

codesandbox-ci bot commented Mar 6, 2020

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:

Sandbox Source
heuristic-hertz-hmurl Configuration

@sizebot
Copy link

sizebot commented Mar 6, 2020

No significant bundle size changes to report.

Size changes (experimental)

Generated by 🚫 dangerJS against fd4699d

@sizebot
Copy link

sizebot commented Mar 6, 2020

No significant bundle size changes to report.

Size changes (stable)

Generated by 🚫 dangerJS against fd4699d

@sebmarkbage
Copy link
Collaborator Author

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
Copy link
Collaborator Author

@sebmarkbage sebmarkbage Mar 6, 2020

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.

Copy link
Collaborator

@gaearon gaearon left a 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

@sebmarkbage sebmarkbage merged commit 7a1691c into facebook:master Mar 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants