Skip to content

Commit

Permalink
[ServerRenderer] Move fizz external runtime implementation to react-d…
Browse files Browse the repository at this point in the history
…om-bindings (facebook#25617)

<!--
  Thanks for submitting a pull request!
We appreciate you spending the time to work on these changes. Please
provide enough information so that others can review your pull request.
The three fields below are mandatory.

Before submitting a pull request, please make sure the following is
done:

1. Fork [the repository](https://github.com/facebook/react) and create
your branch from `main`.
  2. Run `yarn` in the repository root.
3. If you've fixed a bug or added code that should be tested, add tests!
4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch
TestName` is helpful in development.
5. Run `yarn test --prod` to test in the production environment. It
supports the same options as `yarn test`.
6. If you need a debugger, run `yarn debug-test --watch TestName`, open
`chrome://inspect`, and press "Inspect".
7. Format your code with
[prettier](https://github.com/prettier/prettier) (`yarn prettier`).
8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only
check changed files.
  9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`).
  10. If you haven't already, complete the CLA.

Learn more about contributing:
https://reactjs.org/docs/how-to-contribute.html
-->

Following
[comment](facebook#25437 (comment))
in facebook#25437 , the external runtime implementation should be moved from
`react-dom` to `react-dom-bindings`.

I did have a question here:
I set the entrypoint to `react-dom/unstable_server-external-runtime.js`,
since a.) I was following facebook#25436 as an example and b.)
`react-dom-bindings` was missing a `README.md` and `npm/`. This also
involved adding the external runtime to `package.json`.
However, the external runtime isn't really a `react-dom` entrypoint. Is
this change alright, or should I change the bundling code instead?

<!--
Demonstrate the code is solid. Example: The exact commands you ran and
their output, screenshots / videos if the pull request changes the user
interface.
How exactly did you verify that your PR solves the issue you wanted to
solve?
  If you leave this empty, your PR will very likely be closed.
-->
  • Loading branch information
mofeiZ committed Dec 5, 2022
1 parent 5cfed75 commit 738aeee
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
completeBoundaryWithStyles,
completeBoundary,
completeSegment,
} from '../../../react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSet';
} from './fizz-instruction-set/ReactDOMFizzInstructionSet';

// Intentionally does nothing. Implementation will be added in future PR.
// eslint-disable-next-line no-unused-vars
Expand Down
1 change: 1 addition & 0 deletions packages/react-dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"./profiling": "./profiling.js",
"./test-utils": "./test-utils.js",
"./unstable_testing": "./unstable_testing.js",
"./unstable_server-external-runtime": "./unstable_server-external-runtime.js",
"./src/*": "./src/*",
"./package.json": "./package.json"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/unstable_server-external-runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
* @flow
*/

export * from 'react-dom/src/server/ReactDOMServerExternalRuntime';
export * from 'react-dom-bindings/src/server/ReactDOMServerExternalRuntime';
2 changes: 1 addition & 1 deletion scripts/rollup/bundles.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ const bundles = [
{
bundleTypes: [BROWSER_SCRIPT],
moduleType: RENDERER,
entry: 'react-dom/src/server/ReactDOMServerExternalRuntime.js',
entry: 'react-dom/unstable_server-external-runtime',
outputPath: 'unstable_server-external-runtime.js',
global: 'ReactDOMServerExternalRuntime',
minifyWithProdErrorCodes: false,
Expand Down
4 changes: 2 additions & 2 deletions scripts/shared/inlinedHostConfigs.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = [
'react-dom/src/server/ReactDOMFizzServerNode.js',
'react-dom/static.node',
'react-dom/server-rendering-stub',
'react-dom/src/server/ReactDOMServerExternalRuntime.js',
'react-dom/unstable_server-external-runtime',
'react-server-dom-webpack/writer.node.server',
'react-server-dom-webpack',
],
Expand Down Expand Up @@ -52,7 +52,7 @@ module.exports = [
'react-dom/src/server/ReactDOMFizzServerBrowser.js',
'react-dom/static.browser',
'react-dom/server-rendering-stub',
'react-dom/src/server/ReactDOMServerExternalRuntime.js',
'react-dom/unstable_server-external-runtime',
'react-server-dom-webpack/writer.browser.server',
'react-server-dom-webpack',
],
Expand Down

0 comments on commit 738aeee

Please sign in to comment.