metro 0.84.4 → 0.86.0
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 +17 -17
- package/src/Assets.js +3 -1
- package/src/Assets.js.flow +31 -25
- package/src/Bundler.d.ts +1 -5
- package/src/DeltaBundler/DeltaCalculator.d.ts +1 -16
- package/src/DeltaBundler/DeltaCalculator.js.flow +1 -1
- package/src/DeltaBundler/Graph.d.ts +1 -102
- package/src/DeltaBundler/Graph.js.flow +7 -7
- package/src/DeltaBundler/Serializers/getAllFiles.js.flow +1 -1
- package/src/DeltaBundler/Serializers/getAssets.js.flow +1 -1
- package/src/DeltaBundler/Serializers/getExplodedSourceMap.d.ts +3 -2
- package/src/DeltaBundler/Serializers/getExplodedSourceMap.js.flow +6 -5
- package/src/DeltaBundler/Serializers/helpers/getSourceMapInfo.d.ts +3 -2
- package/src/DeltaBundler/Serializers/helpers/getSourceMapInfo.js.flow +10 -9
- package/src/DeltaBundler/Serializers/hmrJSBundle.js.flow +3 -3
- package/src/DeltaBundler/Serializers/sourceMapGenerator.d.ts +4 -4
- package/src/DeltaBundler/Serializers/sourceMapGenerator.js +2 -2
- package/src/DeltaBundler/Serializers/sourceMapGenerator.js.flow +7 -5
- package/src/DeltaBundler/Transformer.d.ts +2 -10
- package/src/DeltaBundler/Worker.flow.js.flow +1 -1
- package/src/DeltaBundler/WorkerFarm.d.ts +2 -47
- package/src/DeltaBundler/getTransformCacheKey.js.flow +3 -3
- package/src/DeltaBundler/types.js.flow +10 -10
- package/src/DeltaBundler.d.ts +1 -5
- package/src/HmrServer.d.ts +2 -45
- package/src/HmrServer.js.flow +10 -10
- package/src/IncrementalBundler.d.ts +1 -9
- package/src/IncrementalBundler.js.flow +9 -6
- package/src/ModuleGraph/worker/collectDependencies.d.ts +1 -2
- package/src/Server/symbolicate.js +66 -33
- package/src/Server/symbolicate.js.flow +90 -51
- package/src/Server.d.ts +3 -179
- package/src/Server.js.flow +25 -23
- package/src/index.d.ts +1 -23
- package/src/index.flow.js +1 -15
- package/src/index.flow.js.flow +0 -20
- package/src/lib/BatchProcessor.d.ts +1 -21
- package/src/lib/CountingSet.js.flow +1 -1
- package/src/lib/JsonReporter.d.ts +1 -2
- package/src/lib/JsonReporter.js.flow +4 -2
- package/src/lib/RamBundleParser.d.ts +1 -6
- package/src/lib/TerminalReporter.d.ts +2 -78
- package/src/lib/TerminalReporter.js.flow +1 -1
- package/src/lib/bundleToString.js.flow +2 -2
- package/src/lib/createWebsocketServer.js.flow +4 -4
- package/src/lib/formatBundlingError.js.flow +1 -1
- package/src/lib/getPreludeCode.js.flow +5 -5
- package/src/node-haste/DependencyGraph/ModuleResolution.d.ts +1 -13
- package/src/node-haste/DependencyGraph/ModuleResolution.js.flow +1 -1
- package/src/node-haste/DependencyGraph/createFileMap.js +23 -31
- package/src/node-haste/DependencyGraph/createFileMap.js.flow +23 -38
- package/src/node-haste/DependencyGraph.d.ts +1 -30
- package/src/node-haste/DependencyGraph.js.flow +2 -2
- package/src/shared/output/RamBundle/util.js.flow +4 -2
- package/src/shared/types.js.flow +31 -31
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @noformat
|
|
8
8
|
* @oncall react_native
|
|
9
|
-
* @generated SignedSource<<
|
|
9
|
+
* @generated SignedSource<<74d76149d62fc6d50282472fa1e271fe>>
|
|
10
10
|
*
|
|
11
11
|
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
12
|
* Original file: packages/metro/src/DeltaBundler/Transformer.js
|
|
@@ -15,22 +15,14 @@
|
|
|
15
15
|
* yarn run build-ts-defs (OSS)
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
import type {
|
|
18
|
+
import type {TransformResultWithSource} from '../DeltaBundler';
|
|
19
19
|
import type {TransformOptions} from './Worker';
|
|
20
20
|
import type {ConfigT} from 'metro-config';
|
|
21
21
|
|
|
22
|
-
import WorkerFarm from './WorkerFarm';
|
|
23
|
-
import {Cache} from 'metro-cache';
|
|
24
|
-
|
|
25
22
|
type GetOrComputeSha1Fn = (
|
|
26
23
|
$$PARAM_0$$: string,
|
|
27
24
|
) => Promise<Readonly<{content?: Buffer; sha1: string}>>;
|
|
28
25
|
declare class Transformer {
|
|
29
|
-
_config: ConfigT;
|
|
30
|
-
_cache: Cache<TransformResult>;
|
|
31
|
-
_baseHash: string;
|
|
32
|
-
_getSha1: GetOrComputeSha1Fn;
|
|
33
|
-
_workerFarm: WorkerFarm;
|
|
34
26
|
constructor(
|
|
35
27
|
config: ConfigT,
|
|
36
28
|
opts: Readonly<{getOrComputeSha1: GetOrComputeSha1Fn}>,
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @noformat
|
|
8
8
|
* @oncall react_native
|
|
9
|
-
* @generated SignedSource<<
|
|
9
|
+
* @generated SignedSource<<d9d13bcad23924cbcf706b93e621e91c>>
|
|
10
10
|
*
|
|
11
11
|
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
12
|
* Original file: packages/metro/src/DeltaBundler/WorkerFarm.js
|
|
@@ -16,29 +16,11 @@
|
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
18
|
import type {TransformResult} from '../DeltaBundler';
|
|
19
|
-
import type {TransformerConfig, TransformOptions
|
|
19
|
+
import type {TransformerConfig, TransformOptions} from './Worker';
|
|
20
20
|
import type {ConfigT} from 'metro-config';
|
|
21
|
-
import type {Readable} from 'stream';
|
|
22
21
|
|
|
23
|
-
type WorkerInterface = Readonly<
|
|
24
|
-
Omit<
|
|
25
|
-
Worker,
|
|
26
|
-
keyof {
|
|
27
|
-
end(): void | Promise<void>;
|
|
28
|
-
getStdout(): Readable;
|
|
29
|
-
getStderr(): Readable;
|
|
30
|
-
}
|
|
31
|
-
> & {
|
|
32
|
-
end(): void | Promise<void>;
|
|
33
|
-
getStdout(): Readable;
|
|
34
|
-
getStderr(): Readable;
|
|
35
|
-
}
|
|
36
|
-
>;
|
|
37
22
|
type TransformerResult = Readonly<{result: TransformResult; sha1: string}>;
|
|
38
23
|
declare class WorkerFarm {
|
|
39
|
-
_config: ConfigT;
|
|
40
|
-
_transformerConfig: TransformerConfig;
|
|
41
|
-
_worker: WorkerInterface | Worker;
|
|
42
24
|
constructor(config: ConfigT, transformerConfig: TransformerConfig);
|
|
43
25
|
kill(): Promise<void>;
|
|
44
26
|
transform(
|
|
@@ -46,32 +28,5 @@ declare class WorkerFarm {
|
|
|
46
28
|
options: TransformOptions,
|
|
47
29
|
fileBuffer?: Buffer,
|
|
48
30
|
): Promise<TransformerResult>;
|
|
49
|
-
_makeFarm(
|
|
50
|
-
absoluteWorkerPath: string,
|
|
51
|
-
exposedMethods: ReadonlyArray<string>,
|
|
52
|
-
numWorkers: number,
|
|
53
|
-
): WorkerInterface;
|
|
54
|
-
_computeWorkerKey(
|
|
55
|
-
method: string,
|
|
56
|
-
filename: string,
|
|
57
|
-
): null | undefined | string;
|
|
58
|
-
_formatGenericError(
|
|
59
|
-
err: Readonly<{message: string; stack?: string}>,
|
|
60
|
-
filename: string,
|
|
61
|
-
): TransformError;
|
|
62
|
-
_formatBabelError(
|
|
63
|
-
err: Readonly<{
|
|
64
|
-
message: string;
|
|
65
|
-
stack?: string;
|
|
66
|
-
type?: string;
|
|
67
|
-
codeFrame?: unknown;
|
|
68
|
-
loc: {line?: number; column?: number};
|
|
69
|
-
}>,
|
|
70
|
-
filename: string,
|
|
71
|
-
): TransformError;
|
|
72
31
|
}
|
|
73
32
|
export default WorkerFarm;
|
|
74
|
-
declare class TransformError extends SyntaxError {
|
|
75
|
-
type: string;
|
|
76
|
-
constructor(message: string);
|
|
77
|
-
}
|
|
@@ -26,9 +26,9 @@ type CacheKeyProvider = {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
export default function getTransformCacheKey(opts: {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
readonly cacheVersion: string,
|
|
30
|
+
readonly projectRoot: string,
|
|
31
|
+
readonly transformerConfig: TransformerConfig,
|
|
32
32
|
}): string {
|
|
33
33
|
const {transformerPath, transformerConfig} = opts.transformerConfig;
|
|
34
34
|
|
|
@@ -18,8 +18,8 @@ import type {JsTransformOptions} from 'metro-transform-worker';
|
|
|
18
18
|
import CountingSet from '../lib/CountingSet';
|
|
19
19
|
|
|
20
20
|
export type MixedOutput = {
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
readonly data: unknown,
|
|
22
|
+
readonly type: string,
|
|
23
23
|
};
|
|
24
24
|
|
|
25
25
|
export type AsyncDependencyType = 'async' | 'maybeSync' | 'prefetch' | 'weak';
|
|
@@ -106,10 +106,10 @@ export type GraphInputOptions = Readonly<{
|
|
|
106
106
|
}>;
|
|
107
107
|
|
|
108
108
|
export interface ReadOnlyGraph<T = MixedOutput> {
|
|
109
|
-
|
|
109
|
+
readonly entryPoints: ReadonlySet<string>;
|
|
110
110
|
// Unused in core but useful for custom serializers / experimentalSerializerHook
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
readonly transformOptions: Readonly<TransformInputOptions>;
|
|
112
|
+
readonly dependencies: ReadOnlyDependencies<T>;
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
export type {Graph};
|
|
@@ -136,7 +136,7 @@ export type ResolveFn = (
|
|
|
136
136
|
) => BundlerResolution;
|
|
137
137
|
|
|
138
138
|
export type AllowOptionalDependenciesWithOptions = {
|
|
139
|
-
|
|
139
|
+
readonly exclude: Array<string>,
|
|
140
140
|
};
|
|
141
141
|
export type AllowOptionalDependencies =
|
|
142
142
|
| boolean
|
|
@@ -160,10 +160,10 @@ export type Options<T = MixedOutput> = Readonly<{
|
|
|
160
160
|
}>;
|
|
161
161
|
|
|
162
162
|
export type DeltaResult<T = MixedOutput> = {
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
readonly added: Map<string, Module<T>>,
|
|
164
|
+
readonly modified: Map<string, Module<T>>,
|
|
165
|
+
readonly deleted: Set<string>,
|
|
166
|
+
readonly reset: boolean,
|
|
167
167
|
};
|
|
168
168
|
|
|
169
169
|
export type SerializerOptions = Readonly<{
|
package/src/DeltaBundler.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @noformat
|
|
8
8
|
* @oncall react_native
|
|
9
|
-
* @generated SignedSource<<
|
|
9
|
+
* @generated SignedSource<<4392a52adb92ee60889197cf5c38516d>>
|
|
10
10
|
*
|
|
11
11
|
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
12
|
* Original file: packages/metro/src/DeltaBundler.js
|
|
@@ -24,8 +24,6 @@ import type {
|
|
|
24
24
|
} from './DeltaBundler/types';
|
|
25
25
|
import type EventEmitter from 'events';
|
|
26
26
|
|
|
27
|
-
import DeltaCalculator from './DeltaBundler/DeltaCalculator';
|
|
28
|
-
|
|
29
27
|
export type {
|
|
30
28
|
DeltaResult,
|
|
31
29
|
Graph,
|
|
@@ -45,8 +43,6 @@ export type {
|
|
|
45
43
|
* `clientId` param (which maps a client to a specific delta transformer).
|
|
46
44
|
*/
|
|
47
45
|
declare class DeltaBundler<T = MixedOutput> {
|
|
48
|
-
_changeEventSource: EventEmitter;
|
|
49
|
-
_deltaCalculators: Map<Graph<T>, DeltaCalculator<T>>;
|
|
50
46
|
constructor(changeEventSource: EventEmitter);
|
|
51
47
|
end(): void;
|
|
52
48
|
getDependencies(
|
package/src/HmrServer.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
* @noformat
|
|
8
|
-
* @generated SignedSource<<
|
|
8
|
+
* @generated SignedSource<<48bfe42125bd22a8329f95a30fa90b64>>
|
|
9
9
|
*
|
|
10
10
|
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
11
11
|
* Original file: packages/metro/src/HmrServer.js
|
|
@@ -18,25 +18,13 @@ import type {
|
|
|
18
18
|
RevisionId,
|
|
19
19
|
default as IncrementalBundler,
|
|
20
20
|
} from './IncrementalBundler';
|
|
21
|
-
import type {
|
|
22
|
-
import type {ConfigT, RootPerfLogger} from 'metro-config';
|
|
23
|
-
import type {
|
|
24
|
-
HmrErrorMessage,
|
|
25
|
-
HmrUpdateMessage,
|
|
26
|
-
} from 'metro-runtime/src/modules/types';
|
|
21
|
+
import type {ConfigT} from 'metro-config';
|
|
27
22
|
|
|
28
23
|
export type Client = {
|
|
29
24
|
optedIntoHMR: boolean;
|
|
30
25
|
revisionIds: Array<RevisionId>;
|
|
31
26
|
readonly sendFn: ($$PARAM_0$$: string) => void;
|
|
32
27
|
};
|
|
33
|
-
type ClientGroup = {
|
|
34
|
-
readonly clients: Set<Client>;
|
|
35
|
-
clientUrl: URL;
|
|
36
|
-
revisionId: RevisionId;
|
|
37
|
-
readonly unlisten: () => void;
|
|
38
|
-
readonly graphOptions: GraphOptions;
|
|
39
|
-
};
|
|
40
28
|
/**
|
|
41
29
|
* The HmrServer (Hot Module Reloading) implements a lightweight interface
|
|
42
30
|
* to communicate easily to the logic in the React Native repository (which
|
|
@@ -47,10 +35,6 @@ type ClientGroup = {
|
|
|
47
35
|
* `onClientConnect`, `onClientDisconnect` and `onClientError` methods).
|
|
48
36
|
*/
|
|
49
37
|
declare class HmrServer<TClient extends Client> {
|
|
50
|
-
_config: ConfigT;
|
|
51
|
-
_bundler: IncrementalBundler;
|
|
52
|
-
_createModuleId: (path: string) => number;
|
|
53
|
-
_clientGroups: Map<RevisionId, ClientGroup>;
|
|
54
38
|
constructor(
|
|
55
39
|
bundler: IncrementalBundler,
|
|
56
40
|
createModuleId: (path: string) => number,
|
|
@@ -60,11 +44,6 @@ declare class HmrServer<TClient extends Client> {
|
|
|
60
44
|
requestUrl: string,
|
|
61
45
|
sendFn: (data: string) => void,
|
|
62
46
|
) => Promise<Client>;
|
|
63
|
-
_registerEntryPoint(
|
|
64
|
-
client: Client,
|
|
65
|
-
originalRequestUrl: string,
|
|
66
|
-
sendFn: (data: string) => void,
|
|
67
|
-
): Promise<void>;
|
|
68
47
|
onClientMessage: (
|
|
69
48
|
client: TClient,
|
|
70
49
|
message: string | Buffer | ArrayBuffer | Array<Buffer>,
|
|
@@ -72,27 +51,5 @@ declare class HmrServer<TClient extends Client> {
|
|
|
72
51
|
) => Promise<void>;
|
|
73
52
|
onClientError: (client: TClient, e: Error) => void;
|
|
74
53
|
onClientDisconnect: (client: TClient) => void;
|
|
75
|
-
_handleFileChange(
|
|
76
|
-
group: ClientGroup,
|
|
77
|
-
options: {isInitialUpdate: boolean},
|
|
78
|
-
changeEvent:
|
|
79
|
-
| null
|
|
80
|
-
| undefined
|
|
81
|
-
| {
|
|
82
|
-
readonly logger: null | undefined | RootPerfLogger;
|
|
83
|
-
readonly changeId?: string;
|
|
84
|
-
},
|
|
85
|
-
): Promise<void>;
|
|
86
|
-
_prepareMessage(
|
|
87
|
-
group: ClientGroup,
|
|
88
|
-
options: {isInitialUpdate: boolean},
|
|
89
|
-
changeEvent:
|
|
90
|
-
| null
|
|
91
|
-
| undefined
|
|
92
|
-
| {
|
|
93
|
-
readonly logger: null | undefined | RootPerfLogger;
|
|
94
|
-
readonly changeId?: string;
|
|
95
|
-
},
|
|
96
|
-
): Promise<HmrUpdateMessage | HmrErrorMessage>;
|
|
97
54
|
}
|
|
98
55
|
export default HmrServer;
|
package/src/HmrServer.js.flow
CHANGED
|
@@ -41,15 +41,15 @@ const {createActionStartEntry, createActionEndEntry, log} = Logger;
|
|
|
41
41
|
export type Client = {
|
|
42
42
|
optedIntoHMR: boolean,
|
|
43
43
|
revisionIds: Array<RevisionId>,
|
|
44
|
-
|
|
44
|
+
readonly sendFn: string => void,
|
|
45
45
|
};
|
|
46
46
|
|
|
47
47
|
type ClientGroup = {
|
|
48
|
-
|
|
48
|
+
readonly clients: Set<Client>,
|
|
49
49
|
clientUrl: URL,
|
|
50
50
|
revisionId: RevisionId,
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
readonly unlisten: () => void,
|
|
52
|
+
readonly graphOptions: GraphOptions,
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
function send(sendFns: Array<(string) => void>, message: HmrMessage): void {
|
|
@@ -181,8 +181,8 @@ export default class HmrServer<TClient extends Client> {
|
|
|
181
181
|
this._clientGroups.set(id, clientGroup);
|
|
182
182
|
|
|
183
183
|
let latestChangeEvent: ?{
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
readonly logger: ?RootPerfLogger,
|
|
185
|
+
readonly changeId: string,
|
|
186
186
|
} = null;
|
|
187
187
|
|
|
188
188
|
const debounceCallHandleFileChange = debounceAsyncQueue(async () => {
|
|
@@ -278,8 +278,8 @@ export default class HmrServer<TClient extends Client> {
|
|
|
278
278
|
group: ClientGroup,
|
|
279
279
|
options: {isInitialUpdate: boolean},
|
|
280
280
|
changeEvent: ?{
|
|
281
|
-
|
|
282
|
-
|
|
281
|
+
readonly logger: ?RootPerfLogger,
|
|
282
|
+
readonly changeId?: string,
|
|
283
283
|
},
|
|
284
284
|
): Promise<void> {
|
|
285
285
|
const logger = !options.isInitialUpdate ? changeEvent?.logger : null;
|
|
@@ -337,8 +337,8 @@ export default class HmrServer<TClient extends Client> {
|
|
|
337
337
|
group: ClientGroup,
|
|
338
338
|
options: {isInitialUpdate: boolean},
|
|
339
339
|
changeEvent: ?{
|
|
340
|
-
|
|
341
|
-
|
|
340
|
+
readonly logger: ?RootPerfLogger,
|
|
341
|
+
readonly changeId?: string,
|
|
342
342
|
},
|
|
343
343
|
): Promise<HmrUpdateMessage | HmrErrorMessage> {
|
|
344
344
|
const logger = !options.isInitialUpdate ? changeEvent?.logger : null;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @noformat
|
|
8
8
|
* @oncall react_native
|
|
9
|
-
* @generated SignedSource<<
|
|
9
|
+
* @generated SignedSource<<7ce634e158aa8f2ac74e32940e9e97c1>>
|
|
10
10
|
*
|
|
11
11
|
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
12
|
* Original file: packages/metro/src/IncrementalBundler.js
|
|
@@ -47,11 +47,6 @@ export type IncrementalBundlerOptions = Readonly<{
|
|
|
47
47
|
watch?: boolean;
|
|
48
48
|
}>;
|
|
49
49
|
declare class IncrementalBundler {
|
|
50
|
-
_config: ConfigT;
|
|
51
|
-
_bundler: Bundler;
|
|
52
|
-
_deltaBundler: DeltaBundler;
|
|
53
|
-
_revisionsById: Map<RevisionId, Promise<GraphRevision>>;
|
|
54
|
-
_revisionsByGraphId: Map<GraphId, Promise<GraphRevision>>;
|
|
55
50
|
static revisionIdFromString: (str: string) => RevisionId;
|
|
56
51
|
constructor(config: ConfigT, options?: IncrementalBundlerOptions);
|
|
57
52
|
end(): Promise<void>;
|
|
@@ -95,9 +90,6 @@ declare class IncrementalBundler {
|
|
|
95
90
|
reset: boolean,
|
|
96
91
|
): Promise<{delta: DeltaResult; revision: GraphRevision}>;
|
|
97
92
|
endGraph(graphId: GraphId): Promise<void>;
|
|
98
|
-
_getAbsoluteEntryFiles(
|
|
99
|
-
entryFiles: ReadonlyArray<string>,
|
|
100
|
-
): Promise<ReadonlyArray<string>>;
|
|
101
93
|
ready(): Promise<void>;
|
|
102
94
|
}
|
|
103
95
|
export default IncrementalBundler;
|
|
@@ -41,11 +41,11 @@ type OtherOptions = Readonly<{
|
|
|
41
41
|
|
|
42
42
|
export type GraphRevision = {
|
|
43
43
|
// Identifies the last computed revision.
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
readonly id: RevisionId,
|
|
45
|
+
readonly date: Date,
|
|
46
|
+
readonly graphId: GraphId,
|
|
47
|
+
readonly graph: OutputGraph,
|
|
48
|
+
readonly prepend: ReadonlyArray<Module<>>,
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
export type IncrementalBundlerOptions = Readonly<{
|
|
@@ -199,7 +199,10 @@ export default class IncrementalBundler {
|
|
|
199
199
|
shallow: false,
|
|
200
200
|
lazy: false,
|
|
201
201
|
},
|
|
202
|
-
): Promise<{
|
|
202
|
+
): Promise<{
|
|
203
|
+
readonly graph: OutputGraph,
|
|
204
|
+
readonly prepend: ReadonlyArray<Module<>>,
|
|
205
|
+
}> {
|
|
203
206
|
const graph = await this.buildGraphForEntries(
|
|
204
207
|
[entryFile],
|
|
205
208
|
transformOptions,
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*
|
|
7
7
|
* @noformat
|
|
8
|
-
* @generated SignedSource<<
|
|
8
|
+
* @generated SignedSource<<f072a86187014259ece27c02d9abfd6a>>
|
|
9
9
|
*
|
|
10
10
|
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
11
11
|
* Original file: packages/metro/src/ModuleGraph/worker/collectDependencies.js
|
|
@@ -132,7 +132,6 @@ export type ImportQualifier = Readonly<{
|
|
|
132
132
|
contextParams?: RequireContextParams;
|
|
133
133
|
}>;
|
|
134
134
|
declare class DependencyRegistry {
|
|
135
|
-
_dependencies: Map<string, InternalDependency>;
|
|
136
135
|
registerDependency(qualifier: ImportQualifier): InternalDependency;
|
|
137
136
|
getDependencies(): Array<InternalDependency>;
|
|
138
137
|
}
|
|
@@ -5,7 +5,67 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = symbolicate;
|
|
7
7
|
var _search = require("metro-source-map/private/Consumer/search");
|
|
8
|
+
var _LineIndexedMappings = _interopRequireDefault(
|
|
9
|
+
require("metro-source-map/private/LineIndexedMappings"),
|
|
10
|
+
);
|
|
8
11
|
var _Symbolication = require("metro-symbolicate/private/Symbolication");
|
|
12
|
+
function _interopRequireDefault(e) {
|
|
13
|
+
return e && e.__esModule ? e : { default: e };
|
|
14
|
+
}
|
|
15
|
+
const lineIndexCache = new WeakMap();
|
|
16
|
+
function originalPositionInModule(
|
|
17
|
+
map,
|
|
18
|
+
generatedLine1Based,
|
|
19
|
+
generatedColumn0Based,
|
|
20
|
+
) {
|
|
21
|
+
if (Array.isArray(map)) {
|
|
22
|
+
return originalPositionInTuples(
|
|
23
|
+
map,
|
|
24
|
+
generatedLine1Based,
|
|
25
|
+
generatedColumn0Based,
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
let decoded = lineIndexCache.get(map);
|
|
29
|
+
if (decoded == null) {
|
|
30
|
+
decoded = new _LineIndexedMappings.default(map.mappings);
|
|
31
|
+
lineIndexCache.set(map, decoded);
|
|
32
|
+
}
|
|
33
|
+
return decoded.originalPositionFor(
|
|
34
|
+
generatedLine1Based,
|
|
35
|
+
generatedColumn0Based,
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
function originalPositionInTuples(
|
|
39
|
+
mappings,
|
|
40
|
+
generatedLine1Based,
|
|
41
|
+
generatedColumn0Based,
|
|
42
|
+
) {
|
|
43
|
+
const target = {
|
|
44
|
+
line1Based: generatedLine1Based,
|
|
45
|
+
column0Based: generatedColumn0Based,
|
|
46
|
+
};
|
|
47
|
+
const mappingIndex = (0, _search.greatestLowerBound)(
|
|
48
|
+
mappings,
|
|
49
|
+
target,
|
|
50
|
+
(t, candidate) => {
|
|
51
|
+
if (t.line1Based === candidate[0]) {
|
|
52
|
+
return t.column0Based - candidate[1];
|
|
53
|
+
}
|
|
54
|
+
return t.line1Based - candidate[0];
|
|
55
|
+
},
|
|
56
|
+
);
|
|
57
|
+
if (mappingIndex == null) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
const mapping = mappings[mappingIndex];
|
|
61
|
+
if (mapping[0] !== target.line1Based || mapping.length < 4) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
return {
|
|
65
|
+
line1Based: mapping[2],
|
|
66
|
+
column0Based: mapping[3],
|
|
67
|
+
};
|
|
68
|
+
}
|
|
9
69
|
function createFunctionNameGetter(module) {
|
|
10
70
|
const consumer = new _Symbolication.SourceMetadataMapConsumer(
|
|
11
71
|
{
|
|
@@ -46,38 +106,16 @@ async function symbolicate(stack, maps, config, extraData) {
|
|
|
46
106
|
return map[moduleIndex];
|
|
47
107
|
}
|
|
48
108
|
function findOriginalPos(frame, module) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
frame.column == null
|
|
53
|
-
) {
|
|
109
|
+
const lineNumber = frame.lineNumber;
|
|
110
|
+
const column = frame.column;
|
|
111
|
+
if (module.map == null || lineNumber == null || column == null) {
|
|
54
112
|
return null;
|
|
55
113
|
}
|
|
56
|
-
|
|
57
|
-
line1Based: frame.lineNumber - module.firstLine1Based + 1,
|
|
58
|
-
column0Based: frame.column,
|
|
59
|
-
};
|
|
60
|
-
const mappingIndex = (0, _search.greatestLowerBound)(
|
|
114
|
+
return originalPositionInModule(
|
|
61
115
|
module.map,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
if (target.line1Based === candidate[0]) {
|
|
65
|
-
return target.column0Based - candidate[1];
|
|
66
|
-
}
|
|
67
|
-
return target.line1Based - candidate[0];
|
|
68
|
-
},
|
|
116
|
+
lineNumber - module.firstLine1Based + 1,
|
|
117
|
+
column,
|
|
69
118
|
);
|
|
70
|
-
if (mappingIndex == null) {
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
const mapping = module.map[mappingIndex];
|
|
74
|
-
if (mapping[0] !== generatedPosInModule.line1Based || mapping.length < 4) {
|
|
75
|
-
return null;
|
|
76
|
-
}
|
|
77
|
-
return {
|
|
78
|
-
line1Based: mapping[2],
|
|
79
|
-
column0Based: mapping[3],
|
|
80
|
-
};
|
|
81
119
|
}
|
|
82
120
|
function findFunctionName(originalPos, module) {
|
|
83
121
|
if (module.functionMap) {
|
|
@@ -97,11 +135,6 @@ async function symbolicate(stack, maps, config, extraData) {
|
|
|
97
135
|
...frame,
|
|
98
136
|
};
|
|
99
137
|
}
|
|
100
|
-
if (!Array.isArray(module.map)) {
|
|
101
|
-
throw new Error(
|
|
102
|
-
`Unexpected module with serialized source map found: ${module.path}`,
|
|
103
|
-
);
|
|
104
|
-
}
|
|
105
138
|
const originalPos = findOriginalPos(frame, module);
|
|
106
139
|
if (!originalPos) {
|
|
107
140
|
return {
|