main
js 48 lines 1.16 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 // Custom implementation of FlightServerConfigDOM.
11 // Resource hint dispatching is a no-op since we handle resource loading
12 // through our own runtime.
13
14 // We keep the same type definitions so the Flight server protocol is compatible.
15
16 // prettier-ignore
17 type TypeMap = {
18 'D': string,
19 'C': string | [string, string],
20 'L': [string, string] | [string, string, any],
21 'm': string | [string, any],
22 'S': string | [string, string] | [string, string | 0, any],
23 'X': string | [string, any],
24 'M': string | [string, any],
25 }
26
27 export type HintCode = $Keys<TypeMap>;
28 export type HintModel<T: HintCode> = TypeMap[T];
29
30 export type Hints = Set<string>;
31
32 export function createHints(): Hints {
33 return new Set();
34 }
35
36 export opaque type FormatContext = number;
37
38 export function createRootFormatContext(): FormatContext {
39 return 0;
40 }
41
42 export function getChildFormatContext(
43 parentContext: FormatContext,
44 type: string,
45 props: Object,
46 ): FormatContext {
47 return parentContext;
48 }