metro 0.76.1 → 0.76.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +21 -23
- package/src/DeltaBundler/Graph.js +6 -19
- package/src/DeltaBundler/Graph.js.flow +8 -15
- package/src/DeltaBundler/Serializers/baseJSBundle.js +1 -0
- package/src/DeltaBundler/Serializers/baseJSBundle.js.flow +1 -0
- package/src/DeltaBundler/Serializers/helpers/js.js +22 -6
- package/src/DeltaBundler/Serializers/helpers/js.js.flow +24 -6
- package/src/DeltaBundler/Serializers/helpers/processModules.js +2 -0
- package/src/DeltaBundler/Serializers/helpers/processModules.js.flow +3 -0
- package/src/DeltaBundler/Serializers/hmrJSBundle.js +1 -0
- package/src/DeltaBundler/Serializers/hmrJSBundle.js.flow +1 -0
- package/src/DeltaBundler/types.d.ts +5 -3
- package/src/DeltaBundler/types.flow.js.flow +1 -1
- package/src/HmrServer.js +3 -3
- package/src/HmrServer.js.flow +5 -3
- package/src/IncrementalBundler.js +7 -6
- package/src/IncrementalBundler.js.flow +8 -6
- package/src/Server/symbolicate.js +33 -5
- package/src/Server/symbolicate.js.flow +40 -9
- package/src/Server.js +19 -11
- package/src/Server.js.flow +31 -16
- package/src/index.d.ts +16 -6
- package/src/index.flow.js +15 -2
- package/src/index.flow.js.flow +29 -4
- package/{types/lib/getGraphId.d.ts → src/integration_tests/basic_bundle/loadBundleAsyncForTest.js} +7 -2
- package/src/integration_tests/basic_bundle/loadBundleAsyncForTest.js.flow +20 -0
- package/src/integration_tests/execBundle.js +3 -0
- package/src/integration_tests/execBundle.js.flow +4 -1
- package/src/integration_tests/metro.config.js +5 -0
- package/src/lib/getGraphId.js +2 -7
- package/src/lib/getGraphId.js.flow +3 -3
- package/src/lib/getPrependedScripts.js +1 -2
- package/src/lib/getPrependedScripts.js.flow +1 -2
- package/src/lib/parseOptionsFromUrl.js +1 -0
- package/src/lib/parseOptionsFromUrl.js.flow +1 -0
- package/src/lib/splitBundleOptions.js +1 -0
- package/src/lib/splitBundleOptions.js.flow +1 -0
- package/src/lib/transformHelpers.js +1 -2
- package/src/lib/transformHelpers.js.flow +1 -2
- package/src/node-haste/DependencyGraph.js +6 -1
- package/src/node-haste/DependencyGraph.js.flow +7 -1
- package/src/shared/types.d.ts +2 -0
- package/src/shared/types.flow.js.flow +2 -1
- package/types/Asset.d.ts +0 -25
- package/types/Bundler.d.ts +0 -39
- package/types/DeltaBundler/Graph.d.ts +0 -40
- package/types/DeltaBundler/Serializers/getRamBundleInfo.d.ts +0 -18
- package/types/DeltaBundler/Worker.d.ts +0 -47
- package/types/DeltaBundler/types.d.ts +0 -167
- package/types/DeltaBundler.d.ts +0 -58
- package/types/IncrementalBundler.d.ts +0 -97
- package/types/ModuleGraph/worker/collectDependencies.d.ts +0 -27
- package/types/Server/MultipartResponse.d.ts +0 -31
- package/types/Server.d.ts +0 -113
- package/types/index.d.ts +0 -151
- package/types/lib/CountingSet.d.ts +0 -48
- package/types/lib/TerminalReporter.d.ts +0 -27
- package/types/lib/contextModule.d.ts +0 -22
- package/types/lib/reporting.d.ts +0 -140
- package/types/node-haste/DependencyGraph.d.ts +0 -59
- package/types/shared/output/bundle.d.ts +0 -31
- package/types/shared/types.d.ts +0 -138
|
@@ -1,97 +0,0 @@
|
|
|
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
|
-
* @format
|
|
8
|
-
* @oncall react_native
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import type {
|
|
12
|
-
Options as DeltaBundlerOptions,
|
|
13
|
-
ReadOnlyDependencies,
|
|
14
|
-
TransformInputOptions,
|
|
15
|
-
} from './DeltaBundler/types';
|
|
16
|
-
import {ResolverInputOptions} from './shared/types';
|
|
17
|
-
import type {ConfigT} from 'metro-config';
|
|
18
|
-
import type {GraphId} from './lib/getGraphId';
|
|
19
|
-
import DeltaBundler, {DeltaResult, Graph, Module} from './DeltaBundler';
|
|
20
|
-
import type Bundler from './Bundler';
|
|
21
|
-
|
|
22
|
-
export type RevisionId = string;
|
|
23
|
-
|
|
24
|
-
export type OutputGraph = Graph<void>;
|
|
25
|
-
|
|
26
|
-
export interface OtherOptions {
|
|
27
|
-
readonly onProgress: DeltaBundlerOptions<void>['onProgress'];
|
|
28
|
-
readonly shallow: boolean;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface GraphRevision {
|
|
32
|
-
readonly id: RevisionId;
|
|
33
|
-
readonly date: Date;
|
|
34
|
-
readonly graphId: GraphId;
|
|
35
|
-
readonly graph: OutputGraph;
|
|
36
|
-
readonly prepend: ReadonlyArray<Module<void>>;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface IncrementalBundlerOptions {
|
|
40
|
-
readonly hasReducedPerformance?: boolean;
|
|
41
|
-
readonly watch?: boolean;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export default class IncrementalBundler {
|
|
45
|
-
static revisionIdFromString: (str: string) => RevisionId;
|
|
46
|
-
constructor(config: ConfigT, options?: IncrementalBundlerOptions);
|
|
47
|
-
|
|
48
|
-
end(): void;
|
|
49
|
-
getBundler(): Bundler;
|
|
50
|
-
getDeltaBundler(): DeltaBundler<void>;
|
|
51
|
-
getRevision(revisionId: RevisionId): Promise<GraphRevision> | null;
|
|
52
|
-
getRevisionByGraphId(graphId: GraphId): Promise<GraphRevision> | null;
|
|
53
|
-
|
|
54
|
-
buildGraphForEntries(
|
|
55
|
-
entryFiles: ReadonlyArray<string>,
|
|
56
|
-
transformOptions: TransformInputOptions,
|
|
57
|
-
resolverOptions: ResolverInputOptions,
|
|
58
|
-
otherOptions?: OtherOptions,
|
|
59
|
-
): Promise<OutputGraph>;
|
|
60
|
-
|
|
61
|
-
getDependencies(
|
|
62
|
-
entryFiles: ReadonlyArray<string>,
|
|
63
|
-
transformOptions: TransformInputOptions,
|
|
64
|
-
resolverOptions: ResolverInputOptions,
|
|
65
|
-
otherOptions?: OtherOptions,
|
|
66
|
-
): Promise<ReadOnlyDependencies<void>>;
|
|
67
|
-
|
|
68
|
-
buildGraph(
|
|
69
|
-
entryFile: string,
|
|
70
|
-
transformOptions: TransformInputOptions,
|
|
71
|
-
resolverOptions: ResolverInputOptions,
|
|
72
|
-
otherOptions?: OtherOptions,
|
|
73
|
-
): Promise<
|
|
74
|
-
Readonly<{graph: OutputGraph; prepend: ReadonlyArray<Module<void>>}>
|
|
75
|
-
>;
|
|
76
|
-
|
|
77
|
-
initializeGraph(
|
|
78
|
-
entryFile: string,
|
|
79
|
-
transformOptions: TransformInputOptions,
|
|
80
|
-
resolverOptions: ResolverInputOptions,
|
|
81
|
-
otherOptions?: OtherOptions,
|
|
82
|
-
): Promise<{
|
|
83
|
-
delta: DeltaResult<void>;
|
|
84
|
-
revision: GraphRevision;
|
|
85
|
-
}>;
|
|
86
|
-
|
|
87
|
-
updateGraph(
|
|
88
|
-
revision: GraphRevision,
|
|
89
|
-
reset: boolean,
|
|
90
|
-
): Promise<{
|
|
91
|
-
delta: DeltaResult<void>;
|
|
92
|
-
revision: GraphRevision;
|
|
93
|
-
}>;
|
|
94
|
-
|
|
95
|
-
endGraph(graphId: GraphId): Promise<void>;
|
|
96
|
-
ready(): Promise<void>;
|
|
97
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
* @format
|
|
8
|
-
* @oncall react_native
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export type ContextMode = 'sync' | 'eager' | 'lazy' | 'lazy-once';
|
|
12
|
-
|
|
13
|
-
export interface ContextFilter {
|
|
14
|
-
pattern: string;
|
|
15
|
-
flags: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface RequireContextParams {
|
|
19
|
-
/* Should search for files recursively. Optional, default `true` when `require.context` is used */
|
|
20
|
-
readonly recursive: boolean;
|
|
21
|
-
/* Filename filter pattern for use in `require.context`. Optional, default `.*` (any file) when `require.context` is used */
|
|
22
|
-
readonly filter: Readonly<ContextFilter>;
|
|
23
|
-
/** Mode for resolving dynamic dependencies. Defaults to `sync` */
|
|
24
|
-
readonly mode: ContextMode;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export type DynamicRequiresBehavior = 'throwAtRuntime' | 'reject';
|
|
@@ -1,31 +0,0 @@
|
|
|
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
|
-
* @format
|
|
8
|
-
* @oncall react_native
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import type {IncomingMessage, ServerResponse} from 'http';
|
|
12
|
-
|
|
13
|
-
export type Data = string | Buffer | Uint8Array;
|
|
14
|
-
export interface Headers {
|
|
15
|
-
[name: string]: string | number;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default class MultipartResponse {
|
|
19
|
-
static wrapIfSupported(
|
|
20
|
-
req: IncomingMessage,
|
|
21
|
-
res: ServerResponse,
|
|
22
|
-
): MultipartResponse | ServerResponse;
|
|
23
|
-
static serializeHeaders(headers: Headers): string;
|
|
24
|
-
res: ServerResponse;
|
|
25
|
-
headers: Headers;
|
|
26
|
-
constructor(res: ServerResponse);
|
|
27
|
-
writeChunk(headers: Headers | null, data?: Data, isLast?: boolean): void;
|
|
28
|
-
writeHead(status: number, headers?: Headers): void;
|
|
29
|
-
setHeader(name: string, value: string | number): void;
|
|
30
|
-
end(data?: Data): void;
|
|
31
|
-
}
|
package/types/Server.d.ts
DELETED
|
@@ -1,113 +0,0 @@
|
|
|
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
|
-
* @format
|
|
8
|
-
* @oncall react_native
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import type {AssetData} from './Asset';
|
|
12
|
-
import type {RamBundleInfo} from './DeltaBundler/Serializers/getRamBundleInfo';
|
|
13
|
-
import IncrementalBundler, {RevisionId} from './IncrementalBundler';
|
|
14
|
-
import type {GraphId} from './lib/getGraphId';
|
|
15
|
-
import type MultipartResponse from './Server/MultipartResponse';
|
|
16
|
-
import type {
|
|
17
|
-
BundleOptions,
|
|
18
|
-
GraphOptions,
|
|
19
|
-
SplitBundleOptions,
|
|
20
|
-
} from './shared/types';
|
|
21
|
-
import type {IncomingMessage, ServerResponse} from 'http';
|
|
22
|
-
import type {
|
|
23
|
-
CustomTransformOptions,
|
|
24
|
-
TransformProfile,
|
|
25
|
-
} from 'metro-babel-transformer';
|
|
26
|
-
import type {ConfigT, RootPerfLogger} from 'metro-config';
|
|
27
|
-
import type {CustomResolverOptions} from 'metro-resolver';
|
|
28
|
-
|
|
29
|
-
export interface SegmentLoadData {
|
|
30
|
-
[index: number]: [number[], number | null];
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface BundleMetadata {
|
|
34
|
-
hash: string;
|
|
35
|
-
otaBuildNumber: string | null;
|
|
36
|
-
mobileConfigs: string[];
|
|
37
|
-
segmentHashes: string[];
|
|
38
|
-
segmentLoadData: SegmentLoadData;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export interface ProcessStartContext extends SplitBundleOptions {
|
|
42
|
-
readonly buildNumber: number;
|
|
43
|
-
readonly bundleOptions: BundleOptions;
|
|
44
|
-
readonly graphId: GraphId;
|
|
45
|
-
readonly graphOptions: GraphOptions;
|
|
46
|
-
readonly mres: MultipartResponse | ServerResponse;
|
|
47
|
-
readonly req: IncomingMessage;
|
|
48
|
-
readonly revisionId?: RevisionId | null;
|
|
49
|
-
readonly bundlePerfLogger: RootPerfLogger;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export interface ProcessDeleteContext {
|
|
53
|
-
readonly graphId: GraphId;
|
|
54
|
-
readonly req: IncomingMessage;
|
|
55
|
-
readonly res: ServerResponse;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface ProcessEndContext<T> extends ProcessStartContext {
|
|
59
|
-
readonly result: T;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export type ServerOptions = Readonly<{
|
|
63
|
-
hasReducedPerformance?: boolean;
|
|
64
|
-
onBundleBuilt?: (bundlePath: string) => void;
|
|
65
|
-
watch?: boolean;
|
|
66
|
-
}>;
|
|
67
|
-
|
|
68
|
-
export interface DefaultGraphOptions {
|
|
69
|
-
customResolverOptions: CustomResolverOptions;
|
|
70
|
-
customTransformOptions: CustomTransformOptions;
|
|
71
|
-
dev: boolean;
|
|
72
|
-
hot: boolean;
|
|
73
|
-
minify: boolean;
|
|
74
|
-
runtimeBytecodeVersion?: number;
|
|
75
|
-
unstable_transformProfile: TransformProfile;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export interface DefaultBundleOptions extends DefaultGraphOptions {
|
|
79
|
-
excludeSource: false;
|
|
80
|
-
inlineSourceMap: false;
|
|
81
|
-
modulesOnly: false;
|
|
82
|
-
onProgress: null;
|
|
83
|
-
runModule: true;
|
|
84
|
-
shallow: false;
|
|
85
|
-
sourceMapUrl: null;
|
|
86
|
-
sourceUrl: null;
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export default class Server {
|
|
90
|
-
static DEFAULT_GRAPH_OPTIONS: DefaultGraphOptions;
|
|
91
|
-
static DEFAULT_BUNDLE_OPTIONS: BundleOptions;
|
|
92
|
-
constructor(config: ConfigT, options?: ServerOptions);
|
|
93
|
-
end(): void;
|
|
94
|
-
getBundler(): IncrementalBundler;
|
|
95
|
-
getCreateModuleId(): (path: string) => number;
|
|
96
|
-
build(options: BundleOptions): Promise<{
|
|
97
|
-
code: string;
|
|
98
|
-
map: string;
|
|
99
|
-
}>;
|
|
100
|
-
getRamBundleInfo(options: BundleOptions): Promise<RamBundleInfo>;
|
|
101
|
-
getAssets(options: BundleOptions): Promise<ReadonlyArray<AssetData>>;
|
|
102
|
-
getOrderedDependencyPaths(options: {
|
|
103
|
-
readonly dev: boolean;
|
|
104
|
-
readonly entryFile: string;
|
|
105
|
-
readonly minify: boolean;
|
|
106
|
-
readonly platform: string;
|
|
107
|
-
}): Promise<string[]>;
|
|
108
|
-
processRequest(
|
|
109
|
-
IncomingMessage: IncomingMessage,
|
|
110
|
-
ServerResponse: ServerResponse,
|
|
111
|
-
next: (e: Error | null) => unknown,
|
|
112
|
-
): void;
|
|
113
|
-
}
|
package/types/index.d.ts
DELETED
|
@@ -1,151 +0,0 @@
|
|
|
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
|
-
* @format
|
|
8
|
-
* @oncall react_native
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export * from './Asset';
|
|
12
|
-
export * from './DeltaBundler/types';
|
|
13
|
-
export * from './ModuleGraph/worker/collectDependencies';
|
|
14
|
-
export * from './Server';
|
|
15
|
-
export * from './lib/reporting';
|
|
16
|
-
|
|
17
|
-
import type {Server as HttpServer} from 'http';
|
|
18
|
-
import type {Server as HttpsServer} from 'https';
|
|
19
|
-
import type {
|
|
20
|
-
ConfigT,
|
|
21
|
-
InputConfigT,
|
|
22
|
-
loadConfig,
|
|
23
|
-
MetroConfig,
|
|
24
|
-
Middleware,
|
|
25
|
-
} from 'metro-config';
|
|
26
|
-
import type {CustomTransformOptions} from 'metro-babel-transformer';
|
|
27
|
-
import type {ReadOnlyGraph} from './DeltaBundler/types';
|
|
28
|
-
import type {Server} from 'ws';
|
|
29
|
-
import Yargs = require('yargs');
|
|
30
|
-
import type {default as MetroServer, ServerOptions} from './Server';
|
|
31
|
-
import type {OutputOptions, RequestOptions} from './shared/types';
|
|
32
|
-
|
|
33
|
-
export {HttpServer, HttpsServer};
|
|
34
|
-
|
|
35
|
-
interface MetroMiddleWare {
|
|
36
|
-
attachHmrServer: (httpServer: HttpServer | HttpsServer) => void;
|
|
37
|
-
end: () => void;
|
|
38
|
-
metroServer: MetroServer;
|
|
39
|
-
middleware: Middleware;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface RunMetroOptions extends ServerOptions {
|
|
43
|
-
waitForBundler?: boolean;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export interface RunServerOptions {
|
|
47
|
-
hasReducedPerformance?: boolean;
|
|
48
|
-
host?: string;
|
|
49
|
-
onError?: (error: Error & {code?: string}) => void;
|
|
50
|
-
onReady?: (server: HttpServer | HttpsServer) => void;
|
|
51
|
-
runInspectorProxy?: boolean;
|
|
52
|
-
secureServerOptions?: Record<string, unknown>;
|
|
53
|
-
|
|
54
|
-
/** @deprecated since version 0.61 */
|
|
55
|
-
secure?: boolean;
|
|
56
|
-
|
|
57
|
-
/** @deprecated since version 0.61 */
|
|
58
|
-
secureCert?: string;
|
|
59
|
-
|
|
60
|
-
/** @deprecated since version 0.61 */
|
|
61
|
-
secureKey?: string;
|
|
62
|
-
|
|
63
|
-
waitForBundler?: boolean;
|
|
64
|
-
watch?: boolean;
|
|
65
|
-
websocketEndpoints?: {
|
|
66
|
-
[path: string]: Server;
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export interface RunBuildOptions {
|
|
71
|
-
entry: string;
|
|
72
|
-
dev?: boolean;
|
|
73
|
-
out?: string;
|
|
74
|
-
onBegin?: () => void;
|
|
75
|
-
onComplete?: () => void;
|
|
76
|
-
onProgress?: (transformedFileCount: number, totalFileCount: number) => void;
|
|
77
|
-
minify?: boolean;
|
|
78
|
-
output?: {
|
|
79
|
-
build: (
|
|
80
|
-
server: MetroServer,
|
|
81
|
-
options: RequestOptions,
|
|
82
|
-
) => Promise<{
|
|
83
|
-
code: string;
|
|
84
|
-
map: string;
|
|
85
|
-
}>;
|
|
86
|
-
save: (
|
|
87
|
-
entry: {
|
|
88
|
-
code: string;
|
|
89
|
-
map: string;
|
|
90
|
-
},
|
|
91
|
-
options: OutputOptions,
|
|
92
|
-
postSave: (...args: string[]) => void,
|
|
93
|
-
) => Promise<unknown>;
|
|
94
|
-
};
|
|
95
|
-
platform?: string;
|
|
96
|
-
sourceMap?: boolean;
|
|
97
|
-
sourceMapUrl?: string;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
interface BuildGraphOptions {
|
|
101
|
-
entries: ReadonlyArray<string>;
|
|
102
|
-
customTransformOptions?: CustomTransformOptions;
|
|
103
|
-
dev?: boolean;
|
|
104
|
-
minify?: boolean;
|
|
105
|
-
onProgress?: (transformedFileCount: number, totalFileCount: number) => void;
|
|
106
|
-
platform?: string;
|
|
107
|
-
type?: 'module' | 'script';
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export {MetroConfig};
|
|
111
|
-
|
|
112
|
-
export function runMetro(
|
|
113
|
-
config: InputConfigT,
|
|
114
|
-
options?: RunMetroOptions,
|
|
115
|
-
): Promise<MetroServer>;
|
|
116
|
-
|
|
117
|
-
export {loadConfig};
|
|
118
|
-
|
|
119
|
-
export function createConnectMiddleWare(
|
|
120
|
-
config: ConfigT,
|
|
121
|
-
options?: RunMetroOptions,
|
|
122
|
-
): Promise<MetroMiddleWare>;
|
|
123
|
-
|
|
124
|
-
export function runServer(
|
|
125
|
-
config: ConfigT,
|
|
126
|
-
options: RunServerOptions,
|
|
127
|
-
): Promise<HttpServer | HttpsServer>;
|
|
128
|
-
|
|
129
|
-
export function runBuild(
|
|
130
|
-
config: ConfigT,
|
|
131
|
-
options: RunBuildOptions,
|
|
132
|
-
): Promise<void>;
|
|
133
|
-
|
|
134
|
-
export function buildGraph(
|
|
135
|
-
config: ConfigT,
|
|
136
|
-
options: BuildGraphOptions,
|
|
137
|
-
): Promise<ReadOnlyGraph<void>>;
|
|
138
|
-
|
|
139
|
-
type BuildCommandOptions = Record<string, unknown> | null;
|
|
140
|
-
type ServeCommandOptions = Record<string, unknown> | null;
|
|
141
|
-
|
|
142
|
-
interface AttachMetroCLIOptions {
|
|
143
|
-
build?: BuildCommandOptions;
|
|
144
|
-
serve?: ServeCommandOptions;
|
|
145
|
-
dependencies?: unknown;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
export function attachMetroCli(
|
|
149
|
-
yargs: typeof Yargs,
|
|
150
|
-
options?: AttachMetroCLIOptions,
|
|
151
|
-
): typeof Yargs;
|
|
@@ -1,48 +0,0 @@
|
|
|
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
|
-
* @format
|
|
8
|
-
* @oncall react_native
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
export interface ReadOnlyCountingSet<T> extends Iterable<T> {
|
|
12
|
-
has(item: T): boolean;
|
|
13
|
-
[Symbol.iterator](): Iterator<T>;
|
|
14
|
-
readonly size: number;
|
|
15
|
-
count(item: T): number;
|
|
16
|
-
forEach<ThisT>(
|
|
17
|
-
callbackFn: (
|
|
18
|
-
this: ThisT,
|
|
19
|
-
value: T,
|
|
20
|
-
key: T,
|
|
21
|
-
set: ReadOnlyCountingSet<T>,
|
|
22
|
-
) => unknown,
|
|
23
|
-
thisArg: ThisT,
|
|
24
|
-
): void;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export default class CountingSet<T> implements ReadOnlyCountingSet<T> {
|
|
28
|
-
constructor(items?: Iterable<T>);
|
|
29
|
-
get size(): number;
|
|
30
|
-
has(item: T): boolean;
|
|
31
|
-
add(item: T): void;
|
|
32
|
-
delete(item: T): void;
|
|
33
|
-
keys(): Iterator<T>;
|
|
34
|
-
values(): Iterator<T>;
|
|
35
|
-
[Symbol.iterator](): Iterator<T>;
|
|
36
|
-
count(item: T): number;
|
|
37
|
-
clear(): void;
|
|
38
|
-
forEach<ThisT>(
|
|
39
|
-
callbackFn: (
|
|
40
|
-
this: ThisT,
|
|
41
|
-
value: T,
|
|
42
|
-
key: T,
|
|
43
|
-
set: ReadOnlyCountingSet<T>,
|
|
44
|
-
) => unknown,
|
|
45
|
-
thisArg: ThisT,
|
|
46
|
-
): void;
|
|
47
|
-
toJSON(): unknown;
|
|
48
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
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
|
-
* @format
|
|
8
|
-
* @oncall react_native
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import {ReportableEvent} from './reporting';
|
|
12
|
-
import {Terminal} from 'metro-core';
|
|
13
|
-
|
|
14
|
-
export type TerminalReportableEvent =
|
|
15
|
-
| ReportableEvent
|
|
16
|
-
| {
|
|
17
|
-
buildID: string;
|
|
18
|
-
type: 'bundle_transform_progressed_throttled';
|
|
19
|
-
transformedFileCount: number;
|
|
20
|
-
totalFileCount: number;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export class TerminalReporter {
|
|
24
|
-
constructor(terminal: Terminal);
|
|
25
|
-
readonly terminal: Terminal;
|
|
26
|
-
update(event: TerminalReportableEvent): void;
|
|
27
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
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
|
-
* @format
|
|
8
|
-
* @oncall react_native
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import type {ContextMode} from '../ModuleGraph/worker/collectDependencies';
|
|
12
|
-
|
|
13
|
-
export interface RequireContext {
|
|
14
|
-
/* Should search for files recursively. Optional, default `true` when `require.context` is used */
|
|
15
|
-
readonly recursive: boolean;
|
|
16
|
-
/* Filename filter pattern for use in `require.context`. Optional, default `.*` (any file) when `require.context` is used */
|
|
17
|
-
readonly filter: RegExp;
|
|
18
|
-
/** Mode for resolving dynamic dependencies. Defaults to `sync` */
|
|
19
|
-
readonly mode: ContextMode;
|
|
20
|
-
/** Absolute path of the directory to search in */
|
|
21
|
-
readonly from: string;
|
|
22
|
-
}
|
package/types/lib/reporting.d.ts
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
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
|
-
* @format
|
|
8
|
-
* @oncall react_native
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import type {HealthCheckResult, WatcherStatus} from 'metro-file-map';
|
|
12
|
-
|
|
13
|
-
export type GlobalCacheDisabledReason = 'too_many_errors' | 'too_many_misses';
|
|
14
|
-
|
|
15
|
-
export interface BundleDetails {
|
|
16
|
-
bundleType: string;
|
|
17
|
-
dev: boolean;
|
|
18
|
-
entryFile: string;
|
|
19
|
-
minify: boolean;
|
|
20
|
-
platform?: string;
|
|
21
|
-
runtimeBytecodeVersion?: number;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* A tagged union of all the actions that may happen and we may want to
|
|
26
|
-
* report to the tool user.
|
|
27
|
-
*/
|
|
28
|
-
export type ReportableEvent =
|
|
29
|
-
| {
|
|
30
|
-
port: number;
|
|
31
|
-
hasReducedPerformance: boolean;
|
|
32
|
-
type: 'initialize_started';
|
|
33
|
-
}
|
|
34
|
-
| {
|
|
35
|
-
type: 'initialize_failed';
|
|
36
|
-
port: number;
|
|
37
|
-
error: Error;
|
|
38
|
-
}
|
|
39
|
-
| {
|
|
40
|
-
buildID: string;
|
|
41
|
-
type: 'bundle_build_done';
|
|
42
|
-
}
|
|
43
|
-
| {
|
|
44
|
-
buildID: string;
|
|
45
|
-
type: 'bundle_build_failed';
|
|
46
|
-
}
|
|
47
|
-
| {
|
|
48
|
-
buildID: string;
|
|
49
|
-
bundleDetails: BundleDetails;
|
|
50
|
-
type: 'bundle_build_started';
|
|
51
|
-
}
|
|
52
|
-
| {
|
|
53
|
-
error: Error;
|
|
54
|
-
type: 'bundling_error';
|
|
55
|
-
}
|
|
56
|
-
| {
|
|
57
|
-
type: 'dep_graph_loading';
|
|
58
|
-
hasReducedPerformance: boolean;
|
|
59
|
-
}
|
|
60
|
-
| {type: 'dep_graph_loaded'}
|
|
61
|
-
| {
|
|
62
|
-
buildID: string;
|
|
63
|
-
type: 'bundle_transform_progressed';
|
|
64
|
-
transformedFileCount: number;
|
|
65
|
-
totalFileCount: number;
|
|
66
|
-
}
|
|
67
|
-
| {
|
|
68
|
-
type: 'global_cache_error';
|
|
69
|
-
error: Error;
|
|
70
|
-
}
|
|
71
|
-
| {
|
|
72
|
-
type: 'global_cache_disabled';
|
|
73
|
-
reason: GlobalCacheDisabledReason;
|
|
74
|
-
}
|
|
75
|
-
| {type: 'transform_cache_reset'}
|
|
76
|
-
| {
|
|
77
|
-
type: 'worker_stdout_chunk';
|
|
78
|
-
chunk: string;
|
|
79
|
-
}
|
|
80
|
-
| {
|
|
81
|
-
type: 'worker_stderr_chunk';
|
|
82
|
-
chunk: string;
|
|
83
|
-
}
|
|
84
|
-
| {
|
|
85
|
-
type: 'hmr_client_error';
|
|
86
|
-
error: Error;
|
|
87
|
-
}
|
|
88
|
-
| {
|
|
89
|
-
type: 'client_log';
|
|
90
|
-
level:
|
|
91
|
-
| 'trace'
|
|
92
|
-
| 'info'
|
|
93
|
-
| 'warn'
|
|
94
|
-
| 'log'
|
|
95
|
-
| 'group'
|
|
96
|
-
| 'groupCollapsed'
|
|
97
|
-
| 'groupEnd'
|
|
98
|
-
| 'debug';
|
|
99
|
-
data: unknown[];
|
|
100
|
-
}
|
|
101
|
-
| {
|
|
102
|
-
type: 'transformer_load_started';
|
|
103
|
-
}
|
|
104
|
-
| {
|
|
105
|
-
type: 'transformer_load_done';
|
|
106
|
-
}
|
|
107
|
-
| {
|
|
108
|
-
type: 'transformer_load_failed';
|
|
109
|
-
error: Error;
|
|
110
|
-
}
|
|
111
|
-
| {
|
|
112
|
-
type: 'watcher_health_check_result';
|
|
113
|
-
result: HealthCheckResult;
|
|
114
|
-
}
|
|
115
|
-
| {
|
|
116
|
-
type: 'watcher_status';
|
|
117
|
-
status: WatcherStatus;
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
/**
|
|
121
|
-
* Code across the application takes a reporter as an option and calls the
|
|
122
|
-
* update whenever one of the ReportableEvent happens. Code does not directly
|
|
123
|
-
* write to the standard output, because a build would be:
|
|
124
|
-
*
|
|
125
|
-
* 1. ad-hoc, embedded into another tool, in which case we do not want to
|
|
126
|
-
* pollute that tool's own output. The tool is free to present the
|
|
127
|
-
* warnings/progress we generate any way they want, by specifing a custom
|
|
128
|
-
* reporter.
|
|
129
|
-
* 2. run as a background process from another tool, in which case we want
|
|
130
|
-
* to expose updates in a way that is easily machine-readable, for example
|
|
131
|
-
* a JSON-stream. We don't want to pollute it with textual messages.
|
|
132
|
-
*
|
|
133
|
-
* We centralize terminal reporting into a single place because we want the
|
|
134
|
-
* output to be robust and consistent. The most common reporter is
|
|
135
|
-
* TerminalReporter, that should be the only place in the application should
|
|
136
|
-
* access the `terminal` module (nor the `console`).
|
|
137
|
-
*/
|
|
138
|
-
export interface Reporter {
|
|
139
|
-
update: (event: ReportableEvent) => void;
|
|
140
|
-
}
|