跳到主要内容

React flight client config (custom)


// This is a host config that's used for the `react-server` package on npm.
// It is only used by third-party renderers.
// 这是一个用于 npm 上 `react-server` 包的主机配置。它仅被第三方渲染器使用。
//
// Its API lets you pass the host config as an argument.
// However, inside the `react-server` we treat host config as a module.
// This file is a shim between two worlds.
// 它的 API 允许你将主机配置作为参数传入。然而,在 `react-server` 内部,我们将主机配置视为
// 一个模块。这个文件是在两个世界之间的一个垫片。
//
// It works because the `react-server` bundle is wrapped in something like:
// 它之所以能工作,是因为 `react-server` 捆绑包被包装在类似这样的东西中:
// module.exports = function ($$$config) {
// /* renderer code */
// }
//
// So `$$$config` looks like a global variable, but it's
// really an argument to a top-level wrapping function.
// 所以 `$$$config` 看起来像一个全局变量,但它实际上是顶层包装函数的一个参数。

declare const $$$config: any;

export opaque type ModuleLoading = mixed;
export opaque type ServerConsumerModuleMap = mixed;
export opaque type ServerManifest = mixed;
export opaque type ServerReferenceId = string;
export opaque type ClientReferenceMetadata = mixed;
export opaque type ClientReference<T> = mixed;
export const resolveClientReference = $$$config.resolveClientReference;
export const resolveServerReference = $$$config.resolveServerReference;
export const preloadModule = $$$config.preloadModule;
export const requireModule = $$$config.requireModule;
export const getModuleDebugInfo = $$$config.getModuleDebugInfo;
export const dispatchHint = $$$config.dispatchHint;
export const prepareDestinationForModule =
$$$config.prepareDestinationForModule;
export const usedWithSSR = true;

export opaque type Source = mixed;

export opaque type StringDecoder = mixed;

export const createStringDecoder = $$$config.createStringDecoder;
export const readPartialStringChunk = $$$config.readPartialStringChunk;
export const readFinalStringChunk = $$$config.readFinalStringChunk;

export const bindToConsole = $$$config.bindToConsole;

export const rendererVersion = $$$config.rendererVersion;
export const rendererPackageName = $$$config.rendererPackageName;

export const checkEvalAvailabilityOnceDev =
$$$config.checkEvalAvailabilityOnceDev;