[Flight] Test the node-register hooks in unit tests#25132
Conversation
|
Comparing: 19e9a4c...d7dd77b Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: (No significant changes) |
39f671c to
d7dd77b
Compare
| }; | ||
|
|
||
| (require: any).extensions['.client.js'] = function(module, path) { | ||
| Module._extensions['.client.js'] = function(module, path) { |
There was a problem hiding this comment.
I made this change only because of tests. jest annoyingly overrides require.extensions for every module so there's no way to inspect this otherwise since it's not shared.
So I moved it to use Module._extensions which is more of an internal implementation detail but both are "deprecated" but effectively stable and no reasonable alternative.
We currently override _resolveFilename anyway but we can get rid of that when we change to the new conventions.
| */ | ||
|
|
||
| export * from './src/ReactFlightWebpackNodeRegister'; | ||
| module.exports = require('./src/ReactFlightWebpackNodeRegister'); |
There was a problem hiding this comment.
This is just because jest's treatment of ESM is not the same as rollup. So I switched this to use the jest way, and then just skip this file in the rollup bundling.
* 'main' of ssh://github.com/GrinZero/react: (26 commits) [devtools][easy] Fix flow type (react#25147) Remove Symbol Polyfill (again) (react#25144) Remove ReactFiberFlags MountLayoutDev and MountPassiveDev (react#25091) experimental_use(promise) (react#25084) [Transition Tracing] onMarkerIncomplete - Tracing Marker/Suspense Boundary Deletions (react#24885) [Flight] Add support for Webpack Async Modules (react#25138) Fix typo: supportsMicrotask -> supportsMicrotasks (react#25142) Allow functions to be used as module references (react#25137) Test the node-register hooks in unit tests (react#25132) Return closestInstance in `getInspectorDataForViewAtPoint` (react#25118) [DevTools] Highlight RN elements on hover (react#25106) Update fixtures/flight to webpack 5 (react#25115) Align StrictMode behaviour with production (react#25049) Scaffolding for useMemoCache hook (react#25123) devtools: Fix typo from directores to directories (react#25124) fixture: Fix typo from perfomrance to performance (react#25100) [DevTools] Add events necessary for click to inspect on RN (react#25111) Add missing createServerContext for experimental shared subset (react#25114) support subresource integrity for bootstrapScripts and bootstrapModules (react#25104) make preamble and postamble types explicit and fix typo (react#25102) ...
Summary: This sync includes the following changes: - **[c28f313](react/react@c28f313e6 )**: experimental_use(promise) for SSR ([#25214](react/react#25214)) //<Andrew Clark>// - **[d6f9628](react/react@d6f9628a8 )**: Remove some RSC subset entry points that were removed in the main entry point ([#25209](react/react#25209)) //<Sebastian Markbåge>// - **[a473d08](react/react@a473d08fc )**: Update to Flow from 0.97 to 0.122 ([#25204](react/react#25204)) //<Jan Kassens>// - **[7028ce7](react/react@7028ce745 )**: experimental_use(promise) for Server Components ([#25207](react/react#25207)) //<Andrew Clark>// - **[bfb6568](react/react@bfb65681e )**: experimental_use(context)([#25202](react/react#25202)) //<mofeiZ>// - **[f0efa11](react/react@f0efa1164 )**: [flow] remove custom suppress comment config ([#25170](react/react#25170)) //<Jan Kassens>// - **[2e7f422](react/react@2e7f422fe )**: Refactor: its type is Container ([#25153](react/react#25153)) //<bubucuo>// - **[2c2d9a1](react/react@2c2d9a1df )**: [eslint-plugin-react-hooks] only allow capitalized component names ([#25162](react/react#25162)) //<Jan Kassens>// - **[36c908a](react/react@36c908a6c )**: Don't use the Flight terminology in public error messages ([#25166](react/react#25166)) //<Sebastian Markbåge>// - **[8d1b057](react/react@8d1b057ec )**: [Flight] Minor error handling fixes ([#25151](react/react#25151)) //<Sebastian Markbåge>// - **[9ff738f](react/react@9ff738f53 )**: [devtools][easy] Fix flow type ([#25147](react/react#25147)) //<Tianyu Yao>// - **[0de3ddf](react/react@0de3ddf56 )**: Remove Symbol Polyfill (again) ([#25144](react/react#25144)) //<Ricky>// - **[b36f722](react/react@b36f72235 )**: Remove ReactFiberFlags MountLayoutDev and MountPassiveDev ([#25091](react/react#25091)) //<Samuel Susla>// - **[b6978bc](react/react@b6978bc38 )**: experimental_use(promise) ([#25084](react/react#25084)) //<Andrew Clark>// - **[11ed701](react/react@11ed7010c )**: [Transition Tracing] onMarkerIncomplete - Tracing Marker/Suspense Boundary Deletions ([#24885](react/react#24885)) //<Luna Ruan>// - **[b798942](react/react@b79894259 )**: [Flight] Add support for Webpack Async Modules ([#25138](react/react#25138)) //<Sebastian Markbåge>// - **[c8b778b](react/react@c8b778b7f )**: Fix typo: supportsMicrotask -> supportsMicrotasks ([#25142](react/react#25142)) //<kwzr>// - **[d0f3966](react/react@d0f396651 )**: Allow functions to be used as module references ([#25137](react/react#25137)) //<Sebastian Markbåge>// - **[38c5d8a](react/react@38c5d8a03 )**: Test the node-register hooks in unit tests ([#25132](react/react#25132)) //<Sebastian Markbåge>// - **[3f70e68](react/react@3f70e68ce )**: Return closestInstance in `getInspectorDataForViewAtPoint` ([#25118](react/react#25118)) //<Tianyu Yao>// - **[3d443ca](react/react@3d443cad7 )**: Update fixtures/flight to webpack 5 ([#25115](react/react#25115)) //<Tim Neutkens>// - **[5d1ce65](react/react@5d1ce6513 )**: Align StrictMode behaviour with production ([#25049](react/react#25049)) //<Samuel Susla>// - **[9e67e7a](react/react@9e67e7a31 )**: Scaffolding for useMemoCache hook ([#25123](react/react#25123)) //<Joseph Savona>// - **[19e9a4c](react/react@19e9a4c68 )**: Add missing createServerContext for experimental shared subset ([#25114](react/react#25114)) //<Jiachi Liu>// - **[6ef466c](react/react@6ef466c68 )**: make preamble and postamble types explicit and fix typo ([#25102](react/react#25102)) //<Josh Story>// - **[796d318](react/react@796d31809 )**: Implement basic stylesheet Resources for react-dom ([#25060](react/react#25060)) //<Josh Story>// - **[32baab3](react/react@32baab38f )**: [Transition Tracing] Add Tag Field to Marker Instance ([#25085](react/react#25085)) //<Luna Ruan>// - **[8ef3a7c](react/react@8ef3a7c08 )**: Resume immediately pinged fiber without unwinding ([#25074](react/react#25074)) //<Andrew Clark>// - **[7bcc687](react/react@7bcc68772 )**: Remove argument committedLanes from reappearLayoutEffects and recursivelyTraverseReappearLayoutEffects ([#25080](react/react#25080)) //<Samuel Susla>// - **[ca990e9](react/react@ca990e9a7 )**: Add API to force Scheduler to yield for macrotask ([#25044](react/react#25044)) //<Andrew Clark>// - **[b4204ed](react/react@b4204ede6 )**: Clean up unused Deletion flag ([#24992](react/react#24992)) //<Andrew Clark>// - **[e193be8](react/react@e193be87e )**: [Transition Tracing] Add Offscreen Test ([#25035](react/react#25035)) //<Luna Ruan>// - **[9fcaf88](react/react@9fcaf88d5 )**: Remove rootContainerInstance from unnecessary places ([#25024](react/react#25024)) //<Sebastian Markbåge>// - **[80f3d88](react/react@80f3d8819 )**: Mount/unmount passive effects when Offscreen visibility changes ([#24977](react/react#24977)) //<Andrew Clark>// Changelog: [General][Changed] - React Native sync for revisions 4ea064e...c28f313 Reviewed By: rickhanlonii Differential Revision: D39384898 fbshipit-source-id: 20b080a53851d6dd9d522c8468dd02aab9ba76db
We used to just test the runtime and not the loaders that emit client references. This moves some of that to a separate helper for these tests, that extracts the loader from the Node.js CJS loader.
This lets us test a bit more of the real implementation but it's still not testing the Webpack client plugin parts.