Skip to content

Commit 738aeee

Browse files
committedDec 5, 2022
[ServerRenderer] Move fizz external runtime implementation to react-dom-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. -->
1 parent 5cfed75 commit 738aeee

File tree

5 files changed

+6
-5
lines changed

5 files changed

+6
-5
lines changed
 

‎packages/react-dom/src/server/ReactDOMServerExternalRuntime.js ‎packages/react-dom-bindings/src/server/ReactDOMServerExternalRuntime.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import {
1111
completeBoundaryWithStyles,
1212
completeBoundary,
1313
completeSegment,
14-
} from '../../../react-dom-bindings/src/server/fizz-instruction-set/ReactDOMFizzInstructionSet';
14+
} from './fizz-instruction-set/ReactDOMFizzInstructionSet';
1515

1616
// Intentionally does nothing. Implementation will be added in future PR.
1717
// eslint-disable-next-line no-unused-vars

‎packages/react-dom/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
"./profiling": "./profiling.js",
6666
"./test-utils": "./test-utils.js",
6767
"./unstable_testing": "./unstable_testing.js",
68+
"./unstable_server-external-runtime": "./unstable_server-external-runtime.js",
6869
"./src/*": "./src/*",
6970
"./package.json": "./package.json"
7071
},

‎packages/react-dom/unstable_server-external-runtime.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
* @flow
88
*/
99

10-
export * from 'react-dom/src/server/ReactDOMServerExternalRuntime';
10+
export * from 'react-dom-bindings/src/server/ReactDOMServerExternalRuntime';

‎scripts/rollup/bundles.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ const bundles = [
357357
{
358358
bundleTypes: [BROWSER_SCRIPT],
359359
moduleType: RENDERER,
360-
entry: 'react-dom/src/server/ReactDOMServerExternalRuntime.js',
360+
entry: 'react-dom/unstable_server-external-runtime',
361361
outputPath: 'unstable_server-external-runtime.js',
362362
global: 'ReactDOMServerExternalRuntime',
363363
minifyWithProdErrorCodes: false,

‎scripts/shared/inlinedHostConfigs.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = [
1515
'react-dom/src/server/ReactDOMFizzServerNode.js',
1616
'react-dom/static.node',
1717
'react-dom/server-rendering-stub',
18-
'react-dom/src/server/ReactDOMServerExternalRuntime.js',
18+
'react-dom/unstable_server-external-runtime',
1919
'react-server-dom-webpack/writer.node.server',
2020
'react-server-dom-webpack',
2121
],
@@ -52,7 +52,7 @@ module.exports = [
5252
'react-dom/src/server/ReactDOMFizzServerBrowser.js',
5353
'react-dom/static.browser',
5454
'react-dom/server-rendering-stub',
55-
'react-dom/src/server/ReactDOMServerExternalRuntime.js',
55+
'react-dom/unstable_server-external-runtime',
5656
'react-server-dom-webpack/writer.browser.server',
5757
'react-server-dom-webpack',
5858
],

0 commit comments

Comments
 (0)
Please sign in to comment.