[test] Add `findSourceMapURL` to `ReactNoopFlightClient` (#30395)
Sebastian Silbermann committed
Jul 19, 2024 at 22:45 UTC
fac78affb0dd64537e6154cb36bc6f50f57eb049
1 file changed
+8
-2
packages/react-noop-renderer/src/ReactNoopFlightClient.js
+8
-2
@@ -14,6 +14,8 @@
14
* environment.
15
*/
16
17
+import type {FindSourceMapURLCallback} from 'react-client/flight';
18
+
19
import {readModule} from 'react-noop-renderer/flight-modules';
20
21
import ReactFlightClient from 'react-client/flight';
@@ -49,7 +51,11 @@ const {createResponse, processBinaryChunk, getRoot, close} = ReactFlightClient({
51
},
52
});
53
52
-function read<T>(source: Source): Thenable<T> {
54
+type ReadOptions = {|
55
+ findSourceMapURL?: FindSourceMapURLCallback,
56
+|};
57
+
58
+function read<T>(source: Source, options: ReadOptions): Thenable<T> {
59
const response = createResponse(
60
source,
61
null,
@@ -57,7 +63,7 @@ function read<T>(source: Source): Thenable<T> {
63
undefined,
64
undefined,
65
undefined,
60
- undefined,
66
+ options !== undefined ? options.findSourceMapURL : undefined,
67
true,
68
);
69
for (let i = 0; i < source.length; i++) {