-
Notifications
You must be signed in to change notification settings - Fork 598
/
types.d.ts
140 lines (124 loc) Β· 3.61 KB
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @oncall react_native
*/
import type {TransformProfile} from 'metro-babel-transformer';
import type {CustomResolverOptions} from 'metro-resolver';
import type {
MetroSourceMapSegmentTuple,
MixedSourceMap,
} from 'metro-source-map';
import type {
CustomTransformOptions,
MinifierOptions,
} from 'metro-transform-worker';
import type {
Options as DeltaBundlerOptions,
TransformInputOptions,
} from '../DeltaBundler/types';
export type BundleType =
| 'bundle'
| 'delta'
| 'meta'
| 'map'
| 'ram'
| 'cli'
| 'hmr'
| 'todo'
| 'graph';
type MetroSourceMapOrMappings = MixedSourceMap | MetroSourceMapSegmentTuple[];
export interface BundleOptions {
bundleType: BundleType;
readonly customResolverOptions: CustomResolverOptions;
customTransformOptions: CustomTransformOptions;
dev: boolean;
entryFile: string;
readonly excludeSource: boolean;
readonly hot: boolean;
readonly inlineSourceMap: boolean;
readonly lazy: boolean;
minify: boolean;
readonly modulesOnly: boolean;
onProgress?: (doneCont: number, totalCount: number) => unknown;
readonly platform?: string;
readonly runModule: boolean;
runtimeBytecodeVersion?: number;
readonly shallow: boolean;
sourceMapUrl?: string;
sourceUrl?: string;
createModuleIdFactory?: () => (path: string) => number | string;
readonly unstable_transformProfile: TransformProfile;
}
export interface ResolverInputOptions {
readonly customResolverOptions?: CustomResolverOptions;
}
export interface SerializerOptions {
readonly sourceMapUrl: string | null;
readonly sourceUrl: string | null;
readonly runModule: boolean;
readonly excludeSource: boolean;
readonly inlineSourceMap: boolean;
readonly modulesOnly: boolean;
}
export interface GraphOptions {
readonly lazy: boolean;
readonly shallow: boolean;
}
// Stricter representation of BundleOptions.
export interface SplitBundleOptions {
readonly entryFile: string;
readonly resolverOptions: ResolverInputOptions;
readonly transformOptions: TransformInputOptions;
readonly serializerOptions: SerializerOptions;
readonly graphOptions: GraphOptions;
readonly onProgress: DeltaBundlerOptions['onProgress'];
}
export interface ModuleGroups {
groups: Map<number, Set<number>>;
modulesById: Map<number, ModuleTransportLike>;
modulesInGroups: Set<number>;
}
export interface ModuleTransportLike {
readonly code: string;
readonly id: number;
readonly map: MetroSourceMapOrMappings | null;
readonly name?: string;
readonly sourcePath: string;
}
export interface ModuleTransportLikeStrict {
readonly code: string;
readonly id: number;
readonly map: MetroSourceMapOrMappings | null;
readonly name?: string;
readonly sourcePath: string;
}
export interface RamModuleTransport extends ModuleTransportLikeStrict {
readonly source: string;
readonly type: string;
}
export interface OutputOptions {
bundleOutput: string;
bundleEncoding?: 'utf8' | 'utf16le' | 'ascii';
dev?: boolean;
indexedRamBundle?: boolean;
platform: string;
sourcemapOutput?: string;
sourcemapSourcesRoot?: string;
sourcemapUseAbsolutePath?: boolean;
}
export interface RequestOptions {
entryFile: string;
inlineSourceMap?: boolean;
sourceMapUrl?: string;
dev?: boolean;
minify: boolean;
platform: string;
createModuleIdFactory?: () => (path: string) => number | string;
onProgress?: (transformedFileCount: number, totalFileCount: number) => void;
}
export type {MinifierOptions};