main
js 58 lines 2.11 KB
Raw
1 /**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @flow
8 */
9
10 // This is a host config that's used for the `react-server` package on npm.
11 // It is only used by third-party renderers.
12 //
13 // Its API lets you pass the host config as an argument.
14 // However, inside the `react-server` we treat host config as a module.
15 // This file is a shim between two worlds.
16 //
17 // It works because the `react-server` bundle is wrapped in something like:
18 //
19 // module.exports = function ($$$config) {
20 // /* renderer code */
21 // }
22 //
23 // So `$$$config` looks like a global variable, but it's
24 // really an argument to a top-level wrapping function.
25
26 declare const $$$config: any;
27
28 export opaque type ModuleLoading = mixed;
29 export opaque type ServerConsumerModuleMap = mixed;
30 export opaque type ServerManifest = mixed;
31 export opaque type ServerReferenceId = string;
32 export opaque type ClientReferenceMetadata = mixed;
33 export opaque type ClientReference<T> = mixed; // eslint-disable-line no-unused-vars
34 export const resolveClientReference = $$$config.resolveClientReference;
35 export const resolveServerReference = $$$config.resolveServerReference;
36 export const preloadModule = $$$config.preloadModule;
37 export const requireModule = $$$config.requireModule;
38 export const getModuleDebugInfo = $$$config.getModuleDebugInfo;
39 export const dispatchHint = $$$config.dispatchHint;
40 export const prepareDestinationForModule =
41 $$$config.prepareDestinationForModule;
42 export const usedWithSSR = true;
43
44 export opaque type Source = mixed;
45
46 export opaque type StringDecoder = mixed;
47
48 export const createStringDecoder = $$$config.createStringDecoder;
49 export const readPartialStringChunk = $$$config.readPartialStringChunk;
50 export const readFinalStringChunk = $$$config.readFinalStringChunk;
51
52 export const bindToConsole = $$$config.bindToConsole;
53
54 export const rendererVersion = $$$config.rendererVersion;
55 export const rendererPackageName = $$$config.rendererPackageName;
56
57 export const checkEvalAvailabilityOnceDev =
58 $$$config.checkEvalAvailabilityOnceDev;