main
js 98 lines 2.54 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 export {default as rendererVersion} from 'shared/ReactVersion';
11 export const rendererPackageName = 'react-markup';
12
13 import type {Thenable} from 'shared/ReactTypes';
14
15 export * from 'react-markup/src/ReactMarkupLegacyClientStreamConfig.js';
16 export * from 'react-client/src/ReactClientConsoleConfigPlain';
17 export * from 'react-client/src/ReactClientDebugConfigPlain';
18
19 export type ModuleLoading = null;
20 export type ServerConsumerModuleMap = null;
21 export opaque type ServerManifest = null;
22 export type ServerReferenceId = string;
23 export opaque type ClientReferenceMetadata = null;
24 export opaque type ClientReference<T> = null; // eslint-disable-line no-unused-vars
25
26 export function prepareDestinationForModule(
27 moduleLoading: ModuleLoading,
28 nonce: ?string,
29 metadata: ClientReferenceMetadata,
30 ) {
31 throw new Error(
32 'renderToHTML should not have emitted Client References. This is a bug in React.',
33 );
34 }
35
36 export function resolveClientReference<T>(
37 bundlerConfig: ServerConsumerModuleMap,
38 metadata: ClientReferenceMetadata,
39 ): ClientReference<T> {
40 throw new Error(
41 'renderToHTML should not have emitted Client References. This is a bug in React.',
42 );
43 }
44
45 export function resolveServerReference<T>(
46 config: ServerManifest,
47 id: ServerReferenceId,
48 ): ClientReference<T> {
49 throw new Error(
50 'renderToHTML should not have emitted Server References. This is a bug in React.',
51 );
52 }
53
54 export function preloadModule<T>(
55 metadata: ClientReference<T>,
56 ): null | Thenable<T> {
57 return null;
58 }
59
60 export function requireModule<T>(metadata: ClientReference<T>): T {
61 throw new Error(
62 'renderToHTML should not have emitted Client References. This is a bug in React.',
63 );
64 }
65
66 export function getModuleDebugInfo<T>(metadata: ClientReference<T>): null {
67 throw new Error(
68 'renderToHTML should not have emitted Client References. This is a bug in React.',
69 );
70 }
71
72 export const usedWithSSR = true;
73
74 type HintCode = string;
75 type HintModel<T: HintCode> = null; // eslint-disable-line no-unused-vars
76
77 export function dispatchHint<Code: HintCode>(
78 code: Code,
79 model: HintModel<Code>,
80 ): void {
81 // Should never happen.
82 }
83
84 export function preinitModuleForSSR(
85 href: string,
86 nonce: ?string,
87 crossOrigin: ?string,
88 ) {
89 // Should never happen.
90 }
91
92 export function preinitScriptForSSR(
93 href: string,
94 nonce: ?string,
95 crossOrigin: ?string,
96 ) {
97 // Should never happen.
98 }