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

Normalize ReactFlightServerConfig and related files #26589

Merged
merged 1 commit into from
Apr 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/react-client/src/ReactFlightClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ import type {
UninitializedModel,
Response,
SSRManifest,
} from './ReactFlightClientHostConfig';
} from './ReactFlightClientConfig';

import {
resolveClientReference,
preloadModule,
requireModule,
parseModel,
} from './ReactFlightClientHostConfig';
} from './ReactFlightClientConfig';

import {knownServerReferences} from './ReactFlightServerReferenceRegistry';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*/

import type {ResponseBase} from './ReactFlightClient';
import type {StringDecoder} from './ReactFlightClientHostConfig';
import type {StringDecoder} from './ReactFlightClientConfig';

export type Response = ResponseBase & {
_partialRow: string,
Expand Down
6 changes: 3 additions & 3 deletions packages/react-client/src/ReactFlightClientStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
*/

import type {CallServerCallback} from './ReactFlightClient';
import type {Response} from './ReactFlightClientHostConfigStream';
import type {SSRManifest} from './ReactFlightClientHostConfig';
import type {Response} from './ReactFlightClientConfigStream';
import type {SSRManifest} from './ReactFlightClientConfig';

import {
resolveModule,
Expand All @@ -26,7 +26,7 @@ import {
readFinalStringChunk,
supportsBinaryStreams,
createStringDecoder,
} from './ReactFlightClientHostConfig';
} from './ReactFlightClientConfig';

export type {Response};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

export * from 'react-client/src/ReactFlightClientConfigBrowser';
export * from 'react-client/src/ReactFlightClientConfigStream';
export * from 'react-server-dom-webpack/src/ReactFlightClientConfigWebpackBundler';
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
* @flow
*/

export * from 'react-client/src/ReactFlightClientHostConfigBrowser';
export * from 'react-client/src/ReactFlightClientHostConfigStream';
export * from 'react-client/src/ReactFlightClientConfigBrowser';
export * from 'react-client/src/ReactFlightClientConfigStream';

export type Response = any;
export opaque type SSRManifest = mixed;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

export * from 'react-client/src/ReactFlightClientConfigBrowser';
export * from 'react-client/src/ReactFlightClientConfigStream';
export * from 'react-server-dom-webpack/src/ReactFlightClientConfigWebpackBundler';
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

export * from 'react-client/src/ReactFlightClientConfigBrowser';
export * from 'react-client/src/ReactFlightClientConfigStream';
export * from 'react-server-dom-webpack/src/ReactFlightClientConfigWebpackBundler';
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

export * from 'react-client/src/ReactFlightClientConfigNode';
export * from 'react-client/src/ReactFlightClientConfigStream';
export * from 'react-server-dom-webpack/src/ReactFlightClientConfigWebpackBundler';
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

export * from 'react-client/src/ReactFlightClientConfigNode';
export * from 'react-client/src/ReactFlightClientConfigStream';
export * from 'react-server-dom-webpack/src/ReactFlightClientConfigNodeBundler';
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
* @flow
*/

export * from 'react-server-dom-relay/src/ReactFlightDOMRelayClientHostConfig';
export * from '../ReactFlightClientHostConfigNoStream';
export * from 'react-server-dom-relay/src/ReactFlightClientConfigDOMRelay';
export * from '../ReactFlightClientConfigNoStream';
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
* @flow
*/

export * from 'react-server-native-relay/src/ReactFlightNativeRelayClientHostConfig';
export * from '../ReactFlightClientHostConfigNoStream';
export * from 'react-server-native-relay/src/ReactFlightClientConfigNativeRelay';
export * from '../ReactFlightClientConfigNoStream';

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/

export const isPrimaryRenderer = true;
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {ReactClientValue} from 'react-server/src/ReactFlightServer';
import type {
ClientManifest,
Destination,
} from './ReactFlightDOMRelayServerHostConfig';
} from './ReactFlightServerConfigDOMRelay';

import {
createRequest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {Thenable} from 'shared/ReactTypes.js';

import type {Response as FlightResponse} from 'react-client/src/ReactFlightClientStream';

import type {SSRManifest} from './ReactFlightClientWebpackBundlerConfig';
import type {SSRManifest} from './ReactFlightClientConfigWebpackBundler';

import {
createResponse,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {Thenable} from 'shared/ReactTypes.js';

import type {Response} from 'react-client/src/ReactFlightClientStream';

import type {SSRManifest} from 'react-client/src/ReactFlightClientHostConfig';
import type {SSRManifest} from 'react-client/src/ReactFlightClientConfig';

import type {Readable} from 'stream';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

import type {ReactClientValue} from 'react-server/src/ReactFlightServer';
import type {ServerContextJSONValue, Thenable} from 'shared/ReactTypes';
import type {ClientManifest} from './ReactFlightServerWebpackBundlerConfig';
import type {ServerManifest} from 'react-client/src/ReactFlightClientHostConfig';
import type {ClientManifest} from './ReactFlightServerConfigWebpackBundler';
import type {ServerManifest} from 'react-client/src/ReactFlightClientConfig';

import {
createRequest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

import type {ReactClientValue} from 'react-server/src/ReactFlightServer';
import type {ServerContextJSONValue, Thenable} from 'shared/ReactTypes';
import type {ClientManifest} from './ReactFlightServerWebpackBundlerConfig';
import type {ServerManifest} from 'react-client/src/ReactFlightClientHostConfig';
import type {ClientManifest} from './ReactFlightServerConfigWebpackBundler';
import type {ServerManifest} from 'react-client/src/ReactFlightClientConfig';

import {
createRequest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import type {
ReactClientValue,
} from 'react-server/src/ReactFlightServer';
import type {Destination} from 'react-server/src/ReactServerStreamConfigNode';
import type {ClientManifest} from './ReactFlightServerWebpackBundlerConfig';
import type {ServerManifest} from 'react-client/src/ReactFlightClientHostConfig';
import type {ClientManifest} from './ReactFlightServerConfigWebpackBundler';
import type {ServerManifest} from 'react-client/src/ReactFlightClientConfig';
import type {Busboy} from 'busboy';
import type {Writable} from 'stream';
import type {ServerContextJSONValue, Thenable} from 'shared/ReactTypes';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import type {ReactClientValue} from 'react-server/src/ReactFlightServer';
import type {
ClientManifest,
Destination,
} from './ReactFlightNativeRelayServerHostConfig';
} from './ReactFlightServerConfigNativeRelay';

import {
createRequest,
Expand Down
4 changes: 2 additions & 2 deletions packages/react-server/src/ReactFlightReplyServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ import type {
ServerReferenceId,
ServerManifest,
ClientReference as ServerReference,
} from 'react-client/src/ReactFlightClientHostConfig';
} from 'react-client/src/ReactFlightClientConfig';

import {
resolveServerReference,
preloadModule,
requireModule,
} from 'react-client/src/ReactFlightClientHostConfig';
} from 'react-client/src/ReactFlightClientConfig';

export type JSONValue =
| number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@
*/

export * from '../ReactFlightServerConfigStream';
export * from '../ReactFlightServerBundlerConfigCustom';
export * from '../ReactFlightServerConfigBundlerCustom';

export const isPrimaryRenderer = false;
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
*/

export * from '../ReactFlightServerConfigStream';
export * from 'react-server-dom-webpack/src/ReactFlightServerWebpackBundlerConfig';
export * from 'react-server-dom-webpack/src/ReactFlightServerConfigWebpackBundler';
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
*/

export * from '../ReactFlightServerConfigStream';
export * from '../ReactFlightServerBundlerConfigCustom';
export * from '../ReactFlightServerConfigBundlerCustom';
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
*/

export * from '../ReactFlightServerConfigStream';
export * from 'react-server-dom-webpack/src/ReactFlightServerWebpackBundlerConfig';
export * from 'react-server-dom-webpack/src/ReactFlightServerConfigWebpackBundler';
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
*/

export * from '../ReactFlightServerConfigStream';
export * from 'react-server-dom-webpack/src/ReactFlightServerWebpackBundlerConfig';
export * from 'react-server-dom-webpack/src/ReactFlightServerConfigWebpackBundler';
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
*/

export * from '../ReactFlightServerConfigStream';
export * from 'react-server-dom-webpack/src/ReactFlightServerWebpackBundlerConfig';
export * from 'react-server-dom-webpack/src/ReactFlightServerConfigWebpackBundler';
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
*/

export * from '../ReactFlightServerConfigStream';
export * from 'react-server-dom-webpack/src/ReactFlightServerWebpackBundlerConfig';
export * from 'react-server-dom-webpack/src/ReactFlightServerConfigWebpackBundler';
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
* @flow
*/

export * from 'react-server-dom-relay/src/ReactFlightDOMRelayServerHostConfig';
export * from 'react-server-dom-relay/src/ReactFlightServerConfigDOMRelay';
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
* @flow
*/

export * from 'react-server-native-relay/src/ReactFlightNativeRelayServerHostConfig';
export * from 'react-server-native-relay/src/ReactFlightServerConfigNativeRelay';
export * from 'react-native-renderer/src/server/ReactFlightServerConfigNative';
2 changes: 1 addition & 1 deletion scripts/flow/createFlowConfigs.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ module.name_mapper='ReactFiberHostConfig$$' -> 'forks/ReactFiberHostConfig.${ren
module.name_mapper='ReactServerStreamConfig$$' -> 'forks/ReactServerStreamConfig.${serverRenderer}'
module.name_mapper='ReactServerFormatConfig$$' -> 'forks/ReactServerFormatConfig.${serverRenderer}'
module.name_mapper='ReactFlightServerConfig$$' -> 'forks/ReactFlightServerConfig.${serverRenderer}'
module.name_mapper='ReactFlightClientHostConfig$$' -> 'forks/ReactFlightClientHostConfig.${serverRenderer}'
module.name_mapper='ReactFlightClientConfig$$' -> 'forks/ReactFlightClientConfig.${serverRenderer}'
module.name_mapper='react-devtools-feature-flags' -> 'react-devtools-shared/src/config/DevToolsFeatureFlags.default'
`.trim(),
)
Expand Down
9 changes: 4 additions & 5 deletions scripts/jest/setupHostConfigs.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jest.mock('react-server/flight', () => {
return config => {
jest.mock(shimServerStreamConfigPath, () => config);
jest.mock(shimServerFormatConfigPath, () => config);
jest.mock('react-server/src/ReactFlightServerBundlerConfigCustom', () => ({
jest.mock('react-server/src/ReactFlightServerConfigBundlerCustom', () => ({
isClientReference: config.isClientReference,
isServerReference: config.isServerReference,
getClientReferenceKey: config.getClientReferenceKey,
Expand All @@ -95,18 +95,17 @@ jest.mock('react-server/flight', () => {
return jest.requireActual('react-server/flight');
};
});
const shimFlightClientHostConfigPath =
'react-client/src/ReactFlightClientHostConfig';
const shimFlightClientConfigPath = 'react-client/src/ReactFlightClientConfig';
jest.mock('react-client/flight', () => {
return config => {
jest.mock(shimFlightClientHostConfigPath, () => config);
jest.mock(shimFlightClientConfigPath, () => config);
return jest.requireActual('react-client/flight');
};
});

const configPaths = [
'react-reconciler/src/ReactFiberHostConfig',
'react-client/src/ReactFlightClientHostConfig',
'react-client/src/ReactFlightClientConfig',
'react-server/src/ReactServerStreamConfig',
'react-server/src/ReactServerFormatConfig',
'react-server/src/ReactFlightServerConfig',
Expand Down
Loading