metro 0.83.3 → 0.83.5
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 +28 -24
- package/src/Assets.d.ts +83 -0
- package/src/Assets.js +42 -29
- package/src/Assets.js.flow +26 -15
- package/src/Bundler/util.d.ts +27 -0
- package/src/Bundler/util.js +25 -21
- package/src/Bundler/util.js.flow +2 -2
- package/src/Bundler.d.ts +14 -15
- package/src/Bundler.js.flow +1 -1
- package/src/DeltaBundler/DeltaCalculator.d.ts +71 -0
- package/src/DeltaBundler/DeltaCalculator.js +4 -4
- package/src/DeltaBundler/DeltaCalculator.js.flow +8 -8
- package/src/DeltaBundler/Graph.d.ts +135 -8
- package/src/DeltaBundler/Graph.js +16 -16
- package/src/DeltaBundler/Graph.js.flow +30 -30
- package/src/DeltaBundler/Serializers/baseJSBundle.d.ts +20 -0
- package/src/DeltaBundler/Serializers/baseJSBundle.js.flow +1 -1
- package/src/DeltaBundler/Serializers/getAllFiles.d.ts +22 -0
- package/src/DeltaBundler/Serializers/getAllFiles.js.flow +2 -2
- package/src/DeltaBundler/Serializers/getAssets.d.ts +25 -0
- package/src/DeltaBundler/Serializers/getAssets.js.flow +2 -2
- package/src/DeltaBundler/Serializers/getExplodedSourceMap.js.flow +2 -2
- package/src/DeltaBundler/Serializers/getRamBundleInfo.d.ts +36 -6
- package/src/DeltaBundler/Serializers/getRamBundleInfo.js.flow +8 -8
- package/src/DeltaBundler/Serializers/helpers/getInlineSourceMappingURL.d.ts +12 -0
- package/src/DeltaBundler/Serializers/helpers/getSourceMapInfo.d.ts +33 -0
- package/src/DeltaBundler/Serializers/helpers/getTransitiveDependencies.d.ts +17 -0
- package/src/DeltaBundler/Serializers/helpers/js.d.ts +30 -0
- package/src/DeltaBundler/Serializers/helpers/js.js +25 -21
- package/src/DeltaBundler/Serializers/helpers/js.js.flow +6 -6
- package/src/DeltaBundler/Serializers/helpers/processModules.d.ts +25 -0
- package/src/DeltaBundler/Serializers/helpers/processModules.js.flow +3 -3
- package/src/DeltaBundler/Serializers/hmrJSBundle.d.ts +30 -0
- package/src/DeltaBundler/Serializers/hmrJSBundle.js +25 -21
- package/src/DeltaBundler/Serializers/hmrJSBundle.js.flow +5 -5
- package/src/DeltaBundler/Serializers/sourceMapGenerator.d.ts +29 -0
- package/src/DeltaBundler/Serializers/sourceMapGenerator.js.flow +6 -6
- package/src/DeltaBundler/Serializers/sourceMapObject.d.ts +23 -0
- package/src/DeltaBundler/Serializers/sourceMapObject.js.flow +2 -2
- package/src/DeltaBundler/Serializers/sourceMapString.d.ts +22 -0
- package/src/DeltaBundler/Serializers/sourceMapString.js.flow +2 -2
- package/src/DeltaBundler/Transformer.d.ts +38 -0
- package/src/DeltaBundler/Transformer.js.flow +3 -3
- package/src/DeltaBundler/Worker.d.ts +19 -27
- package/src/DeltaBundler/Worker.flow.js.flow +1 -1
- package/src/DeltaBundler/WorkerFarm.d.ts +70 -0
- package/src/DeltaBundler/WorkerFarm.js +1 -1
- package/src/DeltaBundler/WorkerFarm.js.flow +26 -13
- package/src/DeltaBundler/buildSubgraph.d.ts +30 -0
- package/src/DeltaBundler/buildSubgraph.js +4 -4
- package/src/DeltaBundler/buildSubgraph.js.flow +8 -8
- package/src/DeltaBundler/getTransformCacheKey.d.ts +18 -0
- package/src/DeltaBundler/mergeDeltas.d.ts +17 -0
- package/src/DeltaBundler/types.d.ts +97 -100
- package/src/DeltaBundler/types.js.flow +36 -34
- package/src/DeltaBundler.d.ts +14 -12
- package/src/DeltaBundler.js.flow +2 -2
- package/src/HmrServer.d.ts +79 -0
- package/src/HmrServer.js +34 -29
- package/src/HmrServer.js.flow +17 -12
- package/src/IncrementalBundler/GraphNotFoundError.d.ts +17 -0
- package/src/IncrementalBundler/ResourceNotFoundError.d.ts +15 -0
- package/src/IncrementalBundler/RevisionNotFoundError.d.ts +17 -0
- package/src/IncrementalBundler.d.ts +43 -45
- package/src/IncrementalBundler.js +29 -21
- package/src/IncrementalBundler.js.flow +13 -9
- package/src/ModuleGraph/worker/JsFileWrapping.d.ts +29 -0
- package/src/ModuleGraph/worker/JsFileWrapping.js +25 -21
- package/src/ModuleGraph/worker/JsFileWrapping.js.flow +10 -5
- package/src/ModuleGraph/worker/collectDependencies.d.ts +118 -14
- package/src/ModuleGraph/worker/collectDependencies.js +25 -21
- package/src/ModuleGraph/worker/collectDependencies.js.flow +27 -21
- package/src/ModuleGraph/worker/generateImportNames.d.ts +19 -0
- package/src/ModuleGraph/worker/generateImportNames.js.flow +4 -2
- package/src/ModuleGraph/worker/importLocationsPlugin.d.ts +26 -0
- package/src/ModuleGraph/worker/importLocationsPlugin.js.flow +7 -3
- package/src/Server/MultipartResponse.d.ts +5 -6
- package/src/Server/MultipartResponse.js.flow +1 -1
- package/src/Server/symbolicate.js.flow +4 -4
- package/src/Server.d.ts +220 -67
- package/src/Server.js +149 -45
- package/src/Server.js.flow +167 -57
- package/src/cli/parseKeyValueParamArray.d.ts +14 -0
- package/src/cli/parseKeyValueParamArray.js.flow +1 -1
- package/src/cli-utils.d.ts +19 -0
- package/src/cli-utils.js.flow +2 -2
- package/src/commands/build.d.ts +16 -0
- package/src/commands/build.js.flow +11 -10
- package/src/commands/dependencies.d.ts +16 -0
- package/src/commands/dependencies.js.flow +8 -4
- package/src/commands/serve.d.ts +16 -0
- package/src/commands/serve.js +2 -0
- package/src/commands/serve.js.flow +14 -9
- package/src/index.d.ts +97 -110
- package/src/index.flow.js +53 -35
- package/src/index.flow.js.flow +49 -29
- package/src/integration_tests/basic_bundle/AssetRegistry.js.flow +1 -1
- package/src/integration_tests/basic_bundle/ErrorBundle.js.flow +1 -1
- package/src/integration_tests/basic_bundle/build-errors/cannot-resolve-import.js.flow +1 -1
- package/src/integration_tests/basic_bundle/build-errors/cannot-resolve-multi-line-import-with-escapes.js.flow +1 -1
- package/src/integration_tests/basic_bundle/build-errors/cannot-resolve-multi-line-import.js.flow +1 -1
- package/src/integration_tests/basic_bundle/build-errors/cannot-resolve-require-with-embedded-comment.js.flow +1 -1
- package/src/integration_tests/basic_bundle/build-errors/cannot-resolve-require.js.flow +1 -1
- package/src/integration_tests/basic_bundle/build-errors/cannot-resolve-specifier-with-escapes.js.flow +1 -1
- package/src/integration_tests/basic_bundle/build-errors/inline-requires-cannot-resolve-import.js.flow +1 -1
- package/src/integration_tests/basic_bundle/build-errors/inline-requires-cannot-resolve-require.js.flow +1 -1
- package/src/integration_tests/basic_bundle/import-export/index.js +25 -21
- package/src/integration_tests/basic_bundle/import-export/index.js.flow +3 -3
- package/src/integration_tests/basic_bundle/import-export/utils.js.flow +2 -2
- package/src/integration_tests/basic_bundle/loadBundleAsyncForTest.js.flow +1 -1
- package/src/integration_tests/basic_bundle/optional-dependencies/index.js.flow +1 -1
- package/src/integration_tests/basic_bundle/require-context/conflict.js.flow +1 -1
- package/src/integration_tests/basic_bundle/require-context/empty.js.flow +1 -1
- package/src/integration_tests/basic_bundle/require-context/matching.js.flow +1 -1
- package/src/integration_tests/basic_bundle/require-context/mode-eager.js.flow +1 -1
- package/src/integration_tests/basic_bundle/require-context/mode-lazy-once.js.flow +1 -1
- package/src/integration_tests/basic_bundle/require-context/mode-lazy.js.flow +1 -1
- package/src/integration_tests/basic_bundle/require-context/mode-sync.js.flow +2 -2
- package/src/integration_tests/basic_bundle/require-context/utils.js.flow +1 -1
- package/src/integration_tests/basic_bundle/require-resolveWeak/import-and-resolveWeak.js.flow +1 -1
- package/src/integration_tests/basic_bundle/require-resolveWeak/multiple.js.flow +1 -1
- package/src/integration_tests/basic_bundle/require-resolveWeak/never-required.js.flow +1 -1
- package/src/integration_tests/basic_bundle/require-resolveWeak/require-and-resolveWeak.js.flow +1 -1
- package/src/integration_tests/execBundle.js.flow +1 -1
- package/src/lib/BatchProcessor.d.ts +54 -0
- package/src/lib/BatchProcessor.js +5 -2
- package/src/lib/BatchProcessor.js.flow +10 -7
- package/src/lib/CountingSet.d.ts +10 -10
- package/src/lib/CountingSet.js.flow +4 -4
- package/src/lib/JsonReporter.d.ts +37 -0
- package/src/lib/JsonReporter.js +5 -3
- package/src/lib/JsonReporter.js.flow +19 -17
- package/src/lib/RamBundleParser.d.ts +29 -0
- package/src/lib/RamBundleParser.js.flow +1 -1
- package/src/lib/TerminalReporter.d.ts +97 -6
- package/src/lib/TerminalReporter.js +37 -34
- package/src/lib/TerminalReporter.js.flow +21 -30
- package/src/lib/bundleProgressUtils.d.ts +26 -0
- package/src/lib/bundleProgressUtils.js +19 -0
- package/src/lib/bundleProgressUtils.js.flow +35 -0
- package/src/lib/bundleToString.d.ts +19 -0
- package/src/lib/contextModule.d.ts +20 -9
- package/src/lib/contextModule.js.flow +1 -1
- package/src/lib/contextModuleTemplates.d.ts +25 -0
- package/src/lib/contextModuleTemplates.js +25 -21
- package/src/lib/countLines.d.ts +12 -0
- package/src/lib/countLines.js +4 -3
- package/src/lib/countLines.js.flow +3 -4
- package/src/lib/createWebsocketServer.d.ts +43 -0
- package/src/lib/createWebsocketServer.js +9 -2
- package/src/lib/createWebsocketServer.js.flow +16 -9
- package/src/lib/debounceAsyncQueue.d.ts +15 -0
- package/src/lib/debounceAsyncQueue.js.flow +1 -1
- package/src/lib/formatBundlingError.d.ts +23 -0
- package/src/lib/formatBundlingError.js.flow +1 -1
- package/src/lib/getAppendScripts.d.ts +31 -0
- package/src/lib/getAppendScripts.js.flow +4 -4
- package/src/lib/getGraphId.d.ts +15 -1
- package/src/lib/getGraphId.js.flow +1 -1
- package/src/lib/getPreludeCode.d.ts +18 -0
- package/src/lib/getPreludeCode.js +4 -0
- package/src/lib/getPreludeCode.js.flow +10 -3
- package/src/lib/getPrependedScripts.d.ts +24 -0
- package/src/lib/getPrependedScripts.js +36 -22
- package/src/lib/getPrependedScripts.js.flow +10 -3
- package/src/lib/isResolvedDependency.d.ts +15 -0
- package/src/lib/logToConsole.d.ts +19 -0
- package/src/lib/logToConsole.js.flow +2 -2
- package/src/lib/parseBundleOptionsFromBundleRequestUrl.d.ts +17 -0
- package/src/lib/parseBundleOptionsFromBundleRequestUrl.js +25 -21
- package/src/lib/parseCustomResolverOptions.d.ts +16 -0
- package/src/lib/parseCustomResolverOptions.js.flow +2 -2
- package/src/lib/parseCustomTransformOptions.d.ts +16 -0
- package/src/lib/parseCustomTransformOptions.js.flow +1 -1
- package/src/lib/parseJsonBody.d.ts +27 -0
- package/src/lib/parseJsonBody.js.flow +11 -1
- package/src/lib/pathUtils.d.ts +14 -0
- package/src/lib/pathUtils.js +25 -21
- package/src/lib/pathUtils.js.flow +1 -1
- package/src/lib/relativizeSourceMap.d.ts +17 -0
- package/src/lib/reporting.d.ts +65 -81
- package/src/lib/reporting.js.flow +4 -4
- package/src/lib/splitBundleOptions.d.ts +16 -0
- package/src/lib/transformHelpers.d.ts +35 -0
- package/src/lib/transformHelpers.js +11 -9
- package/src/lib/transformHelpers.js.flow +17 -15
- package/src/node-haste/DependencyGraph/ModuleResolution.d.ts +126 -0
- package/src/node-haste/DependencyGraph/ModuleResolution.js +48 -42
- package/src/node-haste/DependencyGraph/ModuleResolution.js.flow +35 -32
- package/src/node-haste/DependencyGraph/createFileMap.d.ts +29 -0
- package/src/node-haste/DependencyGraph/createFileMap.js +56 -38
- package/src/node-haste/DependencyGraph/createFileMap.js.flow +44 -18
- package/src/node-haste/DependencyGraph.d.ts +57 -33
- package/src/node-haste/DependencyGraph.js +40 -31
- package/src/node-haste/DependencyGraph.js.flow +35 -37
- package/src/node-haste/Package.d.ts +21 -0
- package/src/node-haste/PackageCache.d.ts +34 -0
- package/src/node-haste/lib/AssetPaths.d.ts +29 -0
- package/src/node-haste/lib/AssetPaths.js +2 -2
- package/src/node-haste/lib/AssetPaths.js.flow +4 -4
- package/src/node-haste/lib/parsePlatformFilePath.d.ts +25 -0
- package/src/node-haste/lib/parsePlatformFilePath.js +6 -6
- package/src/node-haste/lib/parsePlatformFilePath.js.flow +4 -4
- package/src/shared/output/RamBundle/as-assets.d.ts +25 -0
- package/src/shared/output/RamBundle/as-assets.js.flow +6 -6
- package/src/shared/output/RamBundle/as-indexed-file.d.ts +38 -0
- package/src/shared/output/RamBundle/as-indexed-file.js.flow +5 -5
- package/src/shared/output/RamBundle/buildSourcemapWithMetadata.d.ts +23 -0
- package/src/shared/output/RamBundle/buildSourcemapWithMetadata.js.flow +5 -5
- package/src/shared/output/RamBundle/magic-number.d.ts +14 -0
- package/src/shared/output/RamBundle/util.d.ts +41 -0
- package/src/shared/output/RamBundle/util.js.flow +5 -5
- package/src/shared/output/RamBundle/write-sourcemap.d.ts +16 -0
- package/src/shared/output/RamBundle/write-sourcemap.js.flow +1 -1
- package/src/shared/output/RamBundle.d.ts +26 -0
- package/src/shared/output/RamBundle.js.flow +1 -1
- package/src/shared/output/bundle.d.ts +9 -17
- package/src/shared/output/bundle.flow.js.flow +3 -3
- package/src/shared/output/meta.d.ts +15 -0
- package/src/shared/output/meta.js +2 -2
- package/src/shared/output/meta.js.flow +1 -1
- package/src/shared/output/unbundle.d.ts +11 -0
- package/src/shared/output/writeFile.d.ts +16 -0
- package/src/shared/output/writeFile.js +8 -3
- package/src/shared/output/writeFile.js.flow +8 -2
- package/src/shared/types.d.ts +81 -66
- package/src/shared/types.js.flow +20 -5
- package/src/Asset.d.ts +0 -25
- package/src/ModuleGraph/test-helpers.js +0 -75
|
@@ -34,12 +34,12 @@ export default class DeltaCalculator<T> extends EventEmitter {
|
|
|
34
34
|
_deletedFiles: Set<string> = new Set();
|
|
35
35
|
_modifiedFiles: Set<string> = new Set();
|
|
36
36
|
_addedFiles: Set<string> = new Set();
|
|
37
|
-
_requiresReset = false;
|
|
37
|
+
_requiresReset: boolean = false;
|
|
38
38
|
|
|
39
39
|
_graph: Graph<T>;
|
|
40
40
|
|
|
41
41
|
constructor(
|
|
42
|
-
entryPoints:
|
|
42
|
+
entryPoints: ReadonlySet<string>,
|
|
43
43
|
changeEventSource: EventEmitter,
|
|
44
44
|
options: Options<T>,
|
|
45
45
|
) {
|
|
@@ -154,8 +154,8 @@ export default class DeltaCalculator<T> extends EventEmitter {
|
|
|
154
154
|
|
|
155
155
|
return {
|
|
156
156
|
added: this._graph.dependencies,
|
|
157
|
-
modified: new Map(),
|
|
158
157
|
deleted: new Set(),
|
|
158
|
+
modified: new Map(),
|
|
159
159
|
reset: true,
|
|
160
160
|
};
|
|
161
161
|
}
|
|
@@ -186,7 +186,7 @@ export default class DeltaCalculator<T> extends EventEmitter {
|
|
|
186
186
|
_handleFileChange = (
|
|
187
187
|
{type, filePath, metadata}: ChangeEvent['eventsQueue'][number],
|
|
188
188
|
logger: ?RootPerfLogger,
|
|
189
|
-
):
|
|
189
|
+
): unknown => {
|
|
190
190
|
debug('Handling %s: %s (type: %s)', type, filePath, metadata.type);
|
|
191
191
|
if (
|
|
192
192
|
metadata.type === 'l' ||
|
|
@@ -234,7 +234,7 @@ export default class DeltaCalculator<T> extends EventEmitter {
|
|
|
234
234
|
this._addedFiles.delete(filePath);
|
|
235
235
|
break;
|
|
236
236
|
default:
|
|
237
|
-
|
|
237
|
+
nextState as empty;
|
|
238
238
|
}
|
|
239
239
|
|
|
240
240
|
// Notify users that there is a change in some of the bundle files. This
|
|
@@ -256,8 +256,8 @@ export default class DeltaCalculator<T> extends EventEmitter {
|
|
|
256
256
|
|
|
257
257
|
return {
|
|
258
258
|
added,
|
|
259
|
-
modified: new Map(),
|
|
260
259
|
deleted: new Set(),
|
|
260
|
+
modified: new Map(),
|
|
261
261
|
reset: true,
|
|
262
262
|
};
|
|
263
263
|
}
|
|
@@ -297,8 +297,8 @@ export default class DeltaCalculator<T> extends EventEmitter {
|
|
|
297
297
|
if (modifiedDependencies.length === 0) {
|
|
298
298
|
return {
|
|
299
299
|
added: new Map(),
|
|
300
|
-
modified: new Map(),
|
|
301
300
|
deleted: new Set(),
|
|
301
|
+
modified: new Map(),
|
|
302
302
|
reset: false,
|
|
303
303
|
};
|
|
304
304
|
}
|
|
@@ -317,8 +317,8 @@ export default class DeltaCalculator<T> extends EventEmitter {
|
|
|
317
317
|
|
|
318
318
|
return {
|
|
319
319
|
added,
|
|
320
|
-
modified,
|
|
321
320
|
deleted,
|
|
321
|
+
modified,
|
|
322
322
|
reset: false,
|
|
323
323
|
};
|
|
324
324
|
}
|
|
@@ -8,33 +8,160 @@
|
|
|
8
8
|
* @oncall react_native
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Portions of this code are based on the Synchronous Cycle Collection
|
|
13
|
+
* algorithm described in:
|
|
14
|
+
*
|
|
15
|
+
* David F. Bacon and V. T. Rajan. 2001. Concurrent Cycle Collection in
|
|
16
|
+
* Reference Counted Systems. In Proceedings of the 15th European Conference on
|
|
17
|
+
* Object-Oriented Programming (ECOOP '01). Springer-Verlag, Berlin,
|
|
18
|
+
* Heidelberg, 207–235.
|
|
19
|
+
*
|
|
20
|
+
* Notable differences from the algorithm in the paper:
|
|
21
|
+
* 1. Our implementation uses the inverseDependencies set (which we already
|
|
22
|
+
* have to maintain) instead of a separate refcount variable. A module's
|
|
23
|
+
* reference count is equal to the size of its inverseDependencies set, plus
|
|
24
|
+
* 1 if it's an entry point of the graph.
|
|
25
|
+
* 2. We keep the "root buffer" (possibleCycleRoots) free of duplicates by
|
|
26
|
+
* making it a Set, instead of storing a "buffered" flag on each node.
|
|
27
|
+
* 3. On top of tracking edges between nodes, we also count references between
|
|
28
|
+
* nodes and entries in the importBundleNodes set.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
import type {RequireContext} from '../lib/contextModule';
|
|
11
32
|
import type {
|
|
12
33
|
Dependencies,
|
|
34
|
+
Dependency,
|
|
13
35
|
GraphInputOptions,
|
|
14
36
|
MixedOutput,
|
|
15
37
|
Module,
|
|
38
|
+
ModuleData,
|
|
16
39
|
Options,
|
|
40
|
+
ResolvedDependency,
|
|
17
41
|
TransformInputOptions,
|
|
18
42
|
} from './types';
|
|
19
43
|
|
|
20
|
-
|
|
44
|
+
import CountingSet from '../lib/CountingSet';
|
|
45
|
+
|
|
46
|
+
export type Result<T> = {
|
|
21
47
|
added: Map<string, Module<T>>;
|
|
22
48
|
modified: Map<string, Module<T>>;
|
|
23
49
|
deleted: Set<string>;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
50
|
+
};
|
|
51
|
+
type Delta<T> = Readonly<{
|
|
52
|
+
added: Set<string>;
|
|
53
|
+
touched: Set<string>;
|
|
54
|
+
deleted: Set<string>;
|
|
55
|
+
updatedModuleData: ReadonlyMap<string, ModuleData<T>>;
|
|
56
|
+
baseModuleData: Map<string, ModuleData<T>>;
|
|
57
|
+
errors: ReadonlyMap<string, Error>;
|
|
58
|
+
}>;
|
|
59
|
+
type InternalOptions<T> = Readonly<{
|
|
60
|
+
lazy: boolean;
|
|
61
|
+
onDependencyAdd: () => unknown;
|
|
62
|
+
onDependencyAdded: () => unknown;
|
|
63
|
+
resolve: Options<T>['resolve'];
|
|
64
|
+
transform: Options<T>['transform'];
|
|
65
|
+
shallow: boolean;
|
|
66
|
+
}>;
|
|
67
|
+
export declare class Graph<T = MixedOutput> {
|
|
68
|
+
readonly entryPoints: ReadonlySet<string>;
|
|
69
|
+
readonly transformOptions: TransformInputOptions;
|
|
70
|
+
readonly dependencies: Dependencies<T>;
|
|
30
71
|
constructor(options: GraphInputOptions);
|
|
72
|
+
/**
|
|
73
|
+
* Dependency Traversal logic for the Delta Bundler. This method calculates
|
|
74
|
+
* the modules that should be included in the bundle by traversing the
|
|
75
|
+
* dependency graph.
|
|
76
|
+
* Instead of traversing the whole graph each time, it just calculates the
|
|
77
|
+
* difference between runs by only traversing the added/removed dependencies.
|
|
78
|
+
* To do so, it uses the passed graph dependencies and it mutates it.
|
|
79
|
+
* The paths parameter contains the absolute paths of the root files that the
|
|
80
|
+
* method should traverse. Normally, these paths should be the modified files
|
|
81
|
+
* since the last traversal.
|
|
82
|
+
*/
|
|
31
83
|
traverseDependencies(
|
|
32
84
|
paths: ReadonlyArray<string>,
|
|
33
85
|
options: Options<T>,
|
|
34
86
|
): Promise<Result<T>>;
|
|
35
87
|
initialTraverseDependencies(options: Options<T>): Promise<Result<T>>;
|
|
88
|
+
_buildDelta(
|
|
89
|
+
pathsToVisit: ReadonlySet<string>,
|
|
90
|
+
options: InternalOptions<T>,
|
|
91
|
+
moduleFilter?: (path: string) => boolean,
|
|
92
|
+
): Promise<Delta<T>>;
|
|
93
|
+
_recursivelyCommitModule(
|
|
94
|
+
path: string,
|
|
95
|
+
delta: Delta<T>,
|
|
96
|
+
options: InternalOptions<T>,
|
|
97
|
+
commitOptions?: Readonly<{onlyRemove: boolean}>,
|
|
98
|
+
): Module<T>;
|
|
99
|
+
_addDependency(
|
|
100
|
+
parentModule: Module<T>,
|
|
101
|
+
key: string,
|
|
102
|
+
dependency: Dependency,
|
|
103
|
+
requireContext: null | undefined | RequireContext,
|
|
104
|
+
delta: Delta<T>,
|
|
105
|
+
options: InternalOptions<T>,
|
|
106
|
+
): void;
|
|
107
|
+
_removeDependency(
|
|
108
|
+
parentModule: Module<T>,
|
|
109
|
+
key: string,
|
|
110
|
+
dependency: Dependency,
|
|
111
|
+
delta: Delta<T>,
|
|
112
|
+
options: InternalOptions<T>,
|
|
113
|
+
): void;
|
|
114
|
+
/**
|
|
115
|
+
* Collect a list of context modules which include a given file.
|
|
116
|
+
*/
|
|
36
117
|
markModifiedContextModules(
|
|
37
118
|
filePath: string,
|
|
38
|
-
modifiedPaths: Set<string>,
|
|
119
|
+
modifiedPaths: Set<string> | CountingSet<string>,
|
|
120
|
+
): void;
|
|
121
|
+
/**
|
|
122
|
+
* Gets the list of modules affected by the deletion of a given file. The
|
|
123
|
+
* caller is expected to mark these modules as modified in the next call to
|
|
124
|
+
* traverseDependencies. Note that the list may contain duplicates.
|
|
125
|
+
*/
|
|
126
|
+
getModifiedModulesForDeletedPath(filePath: string): Iterable<string>;
|
|
127
|
+
/**
|
|
128
|
+
* Re-traverse the dependency graph in DFS order to reorder the modules and
|
|
129
|
+
* guarantee the same order between runs. This method mutates the passed graph.
|
|
130
|
+
*/
|
|
131
|
+
reorderGraph(options: {shallow: boolean}): void;
|
|
132
|
+
_reorderDependencies(
|
|
133
|
+
module: Module<T>,
|
|
134
|
+
orderedDependencies: Map<string, Module<T>>,
|
|
135
|
+
options: {shallow: boolean},
|
|
136
|
+
): void;
|
|
137
|
+
/** Garbage collection functions */
|
|
138
|
+
|
|
139
|
+
_incrementImportBundleReference(
|
|
140
|
+
dependency: ResolvedDependency,
|
|
141
|
+
parentModule: Module<T>,
|
|
142
|
+
): void;
|
|
143
|
+
_decrementImportBundleReference(
|
|
144
|
+
dependency: ResolvedDependency,
|
|
145
|
+
parentModule: Module<T>,
|
|
39
146
|
): void;
|
|
147
|
+
_markModuleInUse(module: Module<T>): void;
|
|
148
|
+
_children(
|
|
149
|
+
module: Module<T>,
|
|
150
|
+
options: InternalOptions<T>,
|
|
151
|
+
): Iterator<Module<T>>;
|
|
152
|
+
_moduleSnapshot(module: Module<T>): ModuleData<T>;
|
|
153
|
+
_releaseModule(
|
|
154
|
+
module: Module<T>,
|
|
155
|
+
delta: Delta<T>,
|
|
156
|
+
options: InternalOptions<T>,
|
|
157
|
+
): void;
|
|
158
|
+
_freeModule(module: Module<T>, delta: Delta<T>): void;
|
|
159
|
+
_markAsPossibleCycleRoot(module: Module<T>): void;
|
|
160
|
+
_collectCycles(delta: Delta<T>, options: InternalOptions<T>): void;
|
|
161
|
+
_markGray(module: Module<T>, options: InternalOptions<T>): void;
|
|
162
|
+
_scan(module: Module<T>, options: InternalOptions<T>): void;
|
|
163
|
+
_scanBlack(module: Module<T>, options: InternalOptions<T>): void;
|
|
164
|
+
_collectWhite(module: Module<T>, delta: Delta<T>): void;
|
|
165
|
+
|
|
166
|
+
/** End of garbage collection functions */
|
|
40
167
|
}
|
|
@@ -18,11 +18,11 @@ function getInternalOptions({ transform, resolve, onProgress, lazy, shallow }) {
|
|
|
18
18
|
let total = 0;
|
|
19
19
|
return {
|
|
20
20
|
lazy,
|
|
21
|
-
transform,
|
|
22
|
-
resolve,
|
|
23
21
|
onDependencyAdd: () => onProgress && onProgress(numProcessed, ++total),
|
|
24
22
|
onDependencyAdded: () => onProgress && onProgress(++numProcessed, total),
|
|
23
|
+
resolve,
|
|
25
24
|
shallow,
|
|
25
|
+
transform,
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
28
|
function isWeakOrLazy(dependency, options) {
|
|
@@ -88,11 +88,11 @@ class Graph {
|
|
|
88
88
|
} catch (error) {
|
|
89
89
|
const rollbackDelta = {
|
|
90
90
|
added: delta.added,
|
|
91
|
+
baseModuleData: new Map(),
|
|
91
92
|
deleted: delta.deleted,
|
|
93
|
+
errors: new Map(),
|
|
92
94
|
touched: new Set(),
|
|
93
95
|
updatedModuleData: delta.baseModuleData,
|
|
94
|
-
baseModuleData: new Map(),
|
|
95
|
-
errors: new Map(),
|
|
96
96
|
};
|
|
97
97
|
for (const modified of modifiedPathsInBaseGraph) {
|
|
98
98
|
const module = this.dependencies.get(modified);
|
|
@@ -127,8 +127,8 @@ class Graph {
|
|
|
127
127
|
}
|
|
128
128
|
return {
|
|
129
129
|
added,
|
|
130
|
-
modified,
|
|
131
130
|
deleted: delta.deleted,
|
|
131
|
+
modified,
|
|
132
132
|
};
|
|
133
133
|
}
|
|
134
134
|
async initialTraverseDependencies(options) {
|
|
@@ -155,8 +155,8 @@ class Graph {
|
|
|
155
155
|
});
|
|
156
156
|
return {
|
|
157
157
|
added: this.dependencies,
|
|
158
|
-
modified: new Map(),
|
|
159
158
|
deleted: new Set(),
|
|
159
|
+
modified: new Map(),
|
|
160
160
|
};
|
|
161
161
|
}
|
|
162
162
|
async _buildDelta(pathsToVisit, options, moduleFilter) {
|
|
@@ -165,27 +165,27 @@ class Graph {
|
|
|
165
165
|
this.#resolvedContexts,
|
|
166
166
|
{
|
|
167
167
|
resolve: options.resolve,
|
|
168
|
-
transform: async (absolutePath, requireContext) => {
|
|
169
|
-
options.onDependencyAdd();
|
|
170
|
-
const result = await options.transform(absolutePath, requireContext);
|
|
171
|
-
options.onDependencyAdded();
|
|
172
|
-
return result;
|
|
173
|
-
},
|
|
174
168
|
shouldTraverse: (dependency) => {
|
|
175
169
|
if (options.shallow || isWeakOrLazy(dependency, options)) {
|
|
176
170
|
return false;
|
|
177
171
|
}
|
|
178
172
|
return moduleFilter == null || moduleFilter(dependency.absolutePath);
|
|
179
173
|
},
|
|
174
|
+
transform: async (absolutePath, requireContext) => {
|
|
175
|
+
options.onDependencyAdd();
|
|
176
|
+
const result = await options.transform(absolutePath, requireContext);
|
|
177
|
+
options.onDependencyAdded();
|
|
178
|
+
return result;
|
|
179
|
+
},
|
|
180
180
|
},
|
|
181
181
|
);
|
|
182
182
|
return {
|
|
183
183
|
added: new Set(),
|
|
184
|
-
touched: new Set(),
|
|
185
|
-
deleted: new Set(),
|
|
186
|
-
updatedModuleData: subGraph.moduleData,
|
|
187
184
|
baseModuleData: new Map(),
|
|
185
|
+
deleted: new Set(),
|
|
188
186
|
errors: subGraph.errors,
|
|
187
|
+
touched: new Set(),
|
|
188
|
+
updatedModuleData: subGraph.moduleData,
|
|
189
189
|
};
|
|
190
190
|
}
|
|
191
191
|
_recursivelyCommitModule(
|
|
@@ -462,9 +462,9 @@ class Graph {
|
|
|
462
462
|
}
|
|
463
463
|
return {
|
|
464
464
|
dependencies: new Map(dependencies),
|
|
465
|
-
resolvedContexts,
|
|
466
465
|
getSource,
|
|
467
466
|
output,
|
|
467
|
+
resolvedContexts,
|
|
468
468
|
unstable_transformResultKey,
|
|
469
469
|
};
|
|
470
470
|
}
|
|
@@ -73,12 +73,12 @@ export type Result<T> = {
|
|
|
73
73
|
deleted: Set<string>,
|
|
74
74
|
};
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
/*
|
|
77
77
|
* Internal data structure that the traversal logic uses to know which of the
|
|
78
78
|
* files have been modified. This allows to return the added modules before the
|
|
79
79
|
* modified ones (which is useful for things like Hot Module Reloading).
|
|
80
|
-
|
|
81
|
-
type Delta<T> =
|
|
80
|
+
*/
|
|
81
|
+
type Delta<T> = Readonly<{
|
|
82
82
|
// `added` and `deleted` are mutually exclusive.
|
|
83
83
|
// Internally, a module can be in both `touched` and (either) `added` or
|
|
84
84
|
// `deleted`. Before returning the result, we'll calculate
|
|
@@ -87,15 +87,15 @@ type Delta<T> = $ReadOnly<{
|
|
|
87
87
|
touched: Set<string>,
|
|
88
88
|
deleted: Set<string>,
|
|
89
89
|
|
|
90
|
-
updatedModuleData:
|
|
90
|
+
updatedModuleData: ReadonlyMap<string, ModuleData<T>>,
|
|
91
91
|
baseModuleData: Map<string, ModuleData<T>>,
|
|
92
|
-
errors:
|
|
92
|
+
errors: ReadonlyMap<string, Error>,
|
|
93
93
|
}>;
|
|
94
94
|
|
|
95
|
-
type InternalOptions<T> =
|
|
95
|
+
type InternalOptions<T> = Readonly<{
|
|
96
96
|
lazy: boolean,
|
|
97
|
-
onDependencyAdd: () =>
|
|
98
|
-
onDependencyAdded: () =>
|
|
97
|
+
onDependencyAdd: () => unknown,
|
|
98
|
+
onDependencyAdded: () => unknown,
|
|
99
99
|
resolve: Options<T>['resolve'],
|
|
100
100
|
transform: Options<T>['transform'],
|
|
101
101
|
shallow: boolean,
|
|
@@ -113,11 +113,11 @@ function getInternalOptions<T>({
|
|
|
113
113
|
|
|
114
114
|
return {
|
|
115
115
|
lazy,
|
|
116
|
-
transform,
|
|
117
|
-
resolve,
|
|
118
116
|
onDependencyAdd: () => onProgress && onProgress(numProcessed, ++total),
|
|
119
117
|
onDependencyAdded: () => onProgress && onProgress(++numProcessed, total),
|
|
118
|
+
resolve,
|
|
120
119
|
shallow,
|
|
120
|
+
transform,
|
|
121
121
|
};
|
|
122
122
|
}
|
|
123
123
|
|
|
@@ -130,12 +130,12 @@ function isWeakOrLazy<T>(
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
export class Graph<T = MixedOutput> {
|
|
133
|
-
+entryPoints:
|
|
133
|
+
+entryPoints: ReadonlySet<string>;
|
|
134
134
|
+transformOptions: TransformInputOptions;
|
|
135
135
|
+dependencies: Dependencies<T> = new Map();
|
|
136
136
|
+#importBundleNodes: Map<
|
|
137
137
|
string,
|
|
138
|
-
|
|
138
|
+
Readonly<{
|
|
139
139
|
inverseDependencies: CountingSet<string>,
|
|
140
140
|
}>,
|
|
141
141
|
> = new Map();
|
|
@@ -169,7 +169,7 @@ export class Graph<T = MixedOutput> {
|
|
|
169
169
|
* since the last traversal.
|
|
170
170
|
*/
|
|
171
171
|
async traverseDependencies(
|
|
172
|
-
paths:
|
|
172
|
+
paths: ReadonlyArray<string>,
|
|
173
173
|
options: Options<T>,
|
|
174
174
|
): Promise<Result<T>> {
|
|
175
175
|
const internalOptions = getInternalOptions(options);
|
|
@@ -246,11 +246,11 @@ export class Graph<T = MixedOutput> {
|
|
|
246
246
|
// Roll back to base before re-throwing.
|
|
247
247
|
const rollbackDelta: Delta<T> = {
|
|
248
248
|
added: delta.added,
|
|
249
|
+
baseModuleData: new Map(),
|
|
249
250
|
deleted: delta.deleted,
|
|
251
|
+
errors: new Map(),
|
|
250
252
|
touched: new Set(),
|
|
251
253
|
updatedModuleData: delta.baseModuleData,
|
|
252
|
-
baseModuleData: new Map(),
|
|
253
|
-
errors: new Map(),
|
|
254
254
|
};
|
|
255
255
|
for (const modified of modifiedPathsInBaseGraph) {
|
|
256
256
|
const module = this.dependencies.get(modified);
|
|
@@ -295,8 +295,8 @@ export class Graph<T = MixedOutput> {
|
|
|
295
295
|
|
|
296
296
|
return {
|
|
297
297
|
added,
|
|
298
|
-
modified,
|
|
299
298
|
deleted: delta.deleted,
|
|
299
|
+
modified,
|
|
300
300
|
};
|
|
301
301
|
}
|
|
302
302
|
|
|
@@ -338,39 +338,39 @@ export class Graph<T = MixedOutput> {
|
|
|
338
338
|
|
|
339
339
|
return {
|
|
340
340
|
added: this.dependencies,
|
|
341
|
-
modified: new Map(),
|
|
342
341
|
deleted: new Set(),
|
|
342
|
+
modified: new Map(),
|
|
343
343
|
};
|
|
344
344
|
}
|
|
345
345
|
|
|
346
346
|
async _buildDelta(
|
|
347
|
-
pathsToVisit:
|
|
347
|
+
pathsToVisit: ReadonlySet<string>,
|
|
348
348
|
options: InternalOptions<T>,
|
|
349
349
|
moduleFilter?: (path: string) => boolean,
|
|
350
350
|
): Promise<Delta<T>> {
|
|
351
351
|
const subGraph = await buildSubgraph(pathsToVisit, this.#resolvedContexts, {
|
|
352
352
|
resolve: options.resolve,
|
|
353
|
-
transform: async (absolutePath, requireContext) => {
|
|
354
|
-
options.onDependencyAdd();
|
|
355
|
-
const result = await options.transform(absolutePath, requireContext);
|
|
356
|
-
options.onDependencyAdded();
|
|
357
|
-
return result;
|
|
358
|
-
},
|
|
359
353
|
shouldTraverse: (dependency: ResolvedDependency) => {
|
|
360
354
|
if (options.shallow || isWeakOrLazy(dependency, options)) {
|
|
361
355
|
return false;
|
|
362
356
|
}
|
|
363
357
|
return moduleFilter == null || moduleFilter(dependency.absolutePath);
|
|
364
358
|
},
|
|
359
|
+
transform: async (absolutePath, requireContext) => {
|
|
360
|
+
options.onDependencyAdd();
|
|
361
|
+
const result = await options.transform(absolutePath, requireContext);
|
|
362
|
+
options.onDependencyAdded();
|
|
363
|
+
return result;
|
|
364
|
+
},
|
|
365
365
|
});
|
|
366
366
|
|
|
367
367
|
return {
|
|
368
368
|
added: new Set(),
|
|
369
|
-
touched: new Set(),
|
|
370
|
-
deleted: new Set(),
|
|
371
|
-
updatedModuleData: subGraph.moduleData,
|
|
372
369
|
baseModuleData: new Map(),
|
|
370
|
+
deleted: new Set(),
|
|
373
371
|
errors: subGraph.errors,
|
|
372
|
+
touched: new Set(),
|
|
373
|
+
updatedModuleData: subGraph.moduleData,
|
|
374
374
|
};
|
|
375
375
|
}
|
|
376
376
|
|
|
@@ -378,7 +378,7 @@ export class Graph<T = MixedOutput> {
|
|
|
378
378
|
path: string,
|
|
379
379
|
delta: Delta<T>,
|
|
380
380
|
options: InternalOptions<T>,
|
|
381
|
-
commitOptions:
|
|
381
|
+
commitOptions: Readonly<{
|
|
382
382
|
onlyRemove: boolean,
|
|
383
383
|
}> = {onlyRemove: false},
|
|
384
384
|
): Module<T> {
|
|
@@ -775,9 +775,9 @@ export class Graph<T = MixedOutput> {
|
|
|
775
775
|
}
|
|
776
776
|
return {
|
|
777
777
|
dependencies: new Map(dependencies),
|
|
778
|
-
resolvedContexts,
|
|
779
778
|
getSource,
|
|
780
779
|
output,
|
|
780
|
+
resolvedContexts,
|
|
781
781
|
unstable_transformResultKey,
|
|
782
782
|
};
|
|
783
783
|
}
|
|
@@ -936,7 +936,7 @@ export class Graph<T = MixedOutput> {
|
|
|
936
936
|
function dependenciesEqual(
|
|
937
937
|
a: Dependency,
|
|
938
938
|
b: Dependency,
|
|
939
|
-
options:
|
|
939
|
+
options: Readonly<{lazy: boolean, ...}>,
|
|
940
940
|
): boolean {
|
|
941
941
|
return (
|
|
942
942
|
a === b ||
|
|
@@ -0,0 +1,20 @@
|
|
|
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 {Module, ReadOnlyGraph, SerializerOptions} from '../types';
|
|
12
|
+
import type {Bundle} from 'metro-runtime/src/modules/types';
|
|
13
|
+
|
|
14
|
+
declare function baseJSBundle(
|
|
15
|
+
entryPoint: string,
|
|
16
|
+
preModules: ReadonlyArray<Module>,
|
|
17
|
+
graph: ReadOnlyGraph,
|
|
18
|
+
options: SerializerOptions,
|
|
19
|
+
): Bundle;
|
|
20
|
+
export default baseJSBundle;
|
|
@@ -22,7 +22,7 @@ import processModules from './helpers/processModules';
|
|
|
22
22
|
|
|
23
23
|
export default function baseJSBundle(
|
|
24
24
|
entryPoint: string,
|
|
25
|
-
preModules:
|
|
25
|
+
preModules: ReadonlyArray<Module<>>,
|
|
26
26
|
graph: ReadOnlyGraph<>,
|
|
27
27
|
options: SerializerOptions,
|
|
28
28
|
): Bundle {
|
|
@@ -0,0 +1,22 @@
|
|
|
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 {Module, ReadOnlyGraph} from '../types';
|
|
12
|
+
|
|
13
|
+
type Options = {
|
|
14
|
+
platform: null | undefined | string;
|
|
15
|
+
readonly processModuleFilter: (module: Module) => boolean;
|
|
16
|
+
};
|
|
17
|
+
declare function getAllFiles(
|
|
18
|
+
pre: ReadonlyArray<Module>,
|
|
19
|
+
graph: ReadOnlyGraph,
|
|
20
|
+
options: Options,
|
|
21
|
+
): Promise<ReadonlyArray<string>>;
|
|
22
|
+
export default getAllFiles;
|
|
@@ -20,10 +20,10 @@ type Options = {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
export default async function getAllFiles(
|
|
23
|
-
pre:
|
|
23
|
+
pre: ReadonlyArray<Module<>>,
|
|
24
24
|
graph: ReadOnlyGraph<>,
|
|
25
25
|
options: Options,
|
|
26
|
-
): Promise
|
|
26
|
+
): Promise<ReadonlyArray<string>> {
|
|
27
27
|
const modules = graph.dependencies;
|
|
28
28
|
const {processModuleFilter} = options;
|
|
29
29
|
|
|
@@ -0,0 +1,25 @@
|
|
|
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 '../../Assets';
|
|
12
|
+
import type {Module, ReadOnlyDependencies} from '../types';
|
|
13
|
+
|
|
14
|
+
type Options = {
|
|
15
|
+
readonly processModuleFilter: (module: Module) => boolean;
|
|
16
|
+
assetPlugins: ReadonlyArray<string>;
|
|
17
|
+
platform: null | undefined | string;
|
|
18
|
+
projectRoot: string;
|
|
19
|
+
publicPath: string;
|
|
20
|
+
};
|
|
21
|
+
declare function getAssets(
|
|
22
|
+
dependencies: ReadOnlyDependencies,
|
|
23
|
+
options: Options,
|
|
24
|
+
): Promise<ReadonlyArray<AssetData>>;
|
|
25
|
+
export default getAssets;
|
|
@@ -18,7 +18,7 @@ import path from 'path';
|
|
|
18
18
|
|
|
19
19
|
type Options = {
|
|
20
20
|
+processModuleFilter: (module: Module<>) => boolean,
|
|
21
|
-
assetPlugins:
|
|
21
|
+
assetPlugins: ReadonlyArray<string>,
|
|
22
22
|
platform: ?string,
|
|
23
23
|
projectRoot: string,
|
|
24
24
|
publicPath: string,
|
|
@@ -27,7 +27,7 @@ type Options = {
|
|
|
27
27
|
export default async function getAssets(
|
|
28
28
|
dependencies: ReadOnlyDependencies<>,
|
|
29
29
|
options: Options,
|
|
30
|
-
): Promise
|
|
30
|
+
): Promise<ReadonlyArray<AssetData>> {
|
|
31
31
|
const promises = [];
|
|
32
32
|
const {processModuleFilter} = options;
|
|
33
33
|
|
|
@@ -17,7 +17,7 @@ import type {
|
|
|
17
17
|
|
|
18
18
|
import {getJsOutput, isJsModule} from './helpers/js';
|
|
19
19
|
|
|
20
|
-
export type ExplodedSourceMap =
|
|
20
|
+
export type ExplodedSourceMap = ReadonlyArray<{
|
|
21
21
|
+map: Array<MetroSourceMapSegmentTuple>,
|
|
22
22
|
+firstLine1Based: number,
|
|
23
23
|
+functionMap: ?FBSourceFunctionMap,
|
|
@@ -25,7 +25,7 @@ export type ExplodedSourceMap = $ReadOnlyArray<{
|
|
|
25
25
|
}>;
|
|
26
26
|
|
|
27
27
|
export function getExplodedSourceMap(
|
|
28
|
-
modules:
|
|
28
|
+
modules: ReadonlyArray<Module<>>,
|
|
29
29
|
options: {
|
|
30
30
|
+processModuleFilter: (module: Module<>) => boolean,
|
|
31
31
|
},
|
|
@@ -8,11 +8,41 @@
|
|
|
8
8
|
* @oncall react_native
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import {ModuleTransportLike} from '../../shared/types';
|
|
11
|
+
import type {ModuleTransportLike} from '../../shared/types';
|
|
12
|
+
import type {Module, ReadOnlyGraph, SerializerOptions} from '../types';
|
|
13
|
+
import type {SourceMapGeneratorOptions} from './sourceMapGenerator';
|
|
14
|
+
import type {GetTransformOptions} from 'metro-config';
|
|
12
15
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
type Options = Readonly<
|
|
17
|
+
Omit<
|
|
18
|
+
SerializerOptions,
|
|
19
|
+
| keyof SourceMapGeneratorOptions
|
|
20
|
+
| keyof {
|
|
21
|
+
getTransformOptions: null | undefined | GetTransformOptions;
|
|
22
|
+
platform: null | undefined | string;
|
|
23
|
+
}
|
|
24
|
+
> &
|
|
25
|
+
Omit<
|
|
26
|
+
SourceMapGeneratorOptions,
|
|
27
|
+
keyof {
|
|
28
|
+
getTransformOptions: null | undefined | GetTransformOptions;
|
|
29
|
+
platform: null | undefined | string;
|
|
30
|
+
}
|
|
31
|
+
> & {
|
|
32
|
+
getTransformOptions: null | undefined | GetTransformOptions;
|
|
33
|
+
platform: null | undefined | string;
|
|
34
|
+
}
|
|
35
|
+
>;
|
|
36
|
+
export type RamBundleInfo = {
|
|
37
|
+
getDependencies: ($$PARAM_0$$: string) => Set<string>;
|
|
38
|
+
startupModules: ReadonlyArray<ModuleTransportLike>;
|
|
39
|
+
lazyModules: ReadonlyArray<ModuleTransportLike>;
|
|
17
40
|
groups: Map<number, Set<number>>;
|
|
18
|
-
}
|
|
41
|
+
};
|
|
42
|
+
declare function getRamBundleInfo(
|
|
43
|
+
entryPoint: string,
|
|
44
|
+
pre: ReadonlyArray<Module>,
|
|
45
|
+
graph: ReadOnlyGraph,
|
|
46
|
+
options: Options,
|
|
47
|
+
): Promise<RamBundleInfo>;
|
|
48
|
+
export default getRamBundleInfo;
|