Files
react/scripts/flow/react-relay-hooks.js
Sebastian Markbåge ce6fe50b01 Add server-runtime to create Server Blocks (#18392)
This is equivalent to the jsx-runtime in that this is what the compiled
output on the server is supposed to target.

It's really just the same code for all the different Flights, but they
have different types in their arguments so each one gets their own entry
point. We might use this to add runtime warnings per entry point.

Unlike the client-side React.block call this doesn't provide the factory
function that curries the load function. The compiler is expected to wrap
this call in the currying factory.
2020-03-25 19:03:31 -07:00

53 lines
1.4 KiB
JavaScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
type JSONValue =
| string
| boolean
| number
| null
| {+[key: string]: JSONValue}
| $ReadOnlyArray<JSONValue>;
declare module 'ReactFlightDOMRelayServerIntegration' {
declare export opaque type Destination;
declare export function emitModel(
destination: Destination,
id: number,
json: JSONValue,
): void;
declare export function emitError(
destination: Destination,
id: number,
message: string,
stack: string,
): void;
declare export function close(destination: Destination): void;
declare export opaque type ModuleReference<T>;
declare export type ModuleMetaData = JSONValue;
declare export function resolveModuleMetaData<T>(
resourceReference: ModuleReference<T>,
): ModuleMetaData;
}
declare module 'ReactFlightDOMRelayClientIntegration' {
declare export opaque type ModuleReference<T>;
declare export opaque type ModuleMetaData;
declare export function resolveModuleReference<T>(
moduleData: ModuleMetaData,
): ModuleReference<T>;
declare export function preloadModule<T>(
moduleReference: ModuleReference<T>,
): void;
declare export function requireModule<T>(
moduleReference: ModuleReference<T>,
): T;
}