metro 0.84.0 → 0.84.2

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.
Files changed (101) hide show
  1. package/package.json +15 -14
  2. package/src/Assets.d.ts +90 -0
  3. package/src/Bundler/util.d.ts +34 -0
  4. package/src/Bundler.d.ts +45 -0
  5. package/src/DeltaBundler/DeltaCalculator.d.ts +78 -0
  6. package/src/DeltaBundler/Graph.d.ts +174 -0
  7. package/src/DeltaBundler/Serializers/baseJSBundle.d.ts +27 -0
  8. package/src/DeltaBundler/Serializers/getAllFiles.d.ts +29 -0
  9. package/src/DeltaBundler/Serializers/getAssets.d.ts +32 -0
  10. package/src/DeltaBundler/Serializers/getExplodedSourceMap.d.ts +33 -0
  11. package/src/DeltaBundler/Serializers/getRamBundleInfo.d.ts +55 -0
  12. package/src/DeltaBundler/Serializers/helpers/getInlineSourceMappingURL.d.ts +19 -0
  13. package/src/DeltaBundler/Serializers/helpers/getSourceMapInfo.d.ts +40 -0
  14. package/src/DeltaBundler/Serializers/helpers/getTransitiveDependencies.d.ts +24 -0
  15. package/src/DeltaBundler/Serializers/helpers/js.d.ts +37 -0
  16. package/src/DeltaBundler/Serializers/helpers/processModules.d.ts +32 -0
  17. package/src/DeltaBundler/Serializers/hmrJSBundle.d.ts +37 -0
  18. package/src/DeltaBundler/Serializers/sourceMapGenerator.d.ts +36 -0
  19. package/src/DeltaBundler/Serializers/sourceMapObject.d.ts +30 -0
  20. package/src/DeltaBundler/Serializers/sourceMapString.d.ts +29 -0
  21. package/src/DeltaBundler/Transformer.d.ts +45 -0
  22. package/src/DeltaBundler/Worker.d.ts +44 -0
  23. package/src/DeltaBundler/WorkerFarm.d.ts +77 -0
  24. package/src/DeltaBundler/buildSubgraph.d.ts +37 -0
  25. package/src/DeltaBundler/getTransformCacheKey.d.ts +25 -0
  26. package/src/DeltaBundler/mergeDeltas.d.ts +24 -0
  27. package/src/DeltaBundler/types.d.ts +170 -0
  28. package/src/DeltaBundler.d.ts +67 -0
  29. package/src/HmrServer.d.ts +86 -0
  30. package/src/IncrementalBundler/GraphNotFoundError.d.ts +24 -0
  31. package/src/IncrementalBundler/ResourceNotFoundError.d.ts +22 -0
  32. package/src/IncrementalBundler/RevisionNotFoundError.d.ts +24 -0
  33. package/src/IncrementalBundler.d.ts +103 -0
  34. package/src/ModuleGraph/worker/JsFileWrapping.d.ts +36 -0
  35. package/src/ModuleGraph/worker/collectDependencies.d.ts +138 -0
  36. package/src/ModuleGraph/worker/generateImportNames.d.ts +26 -0
  37. package/src/ModuleGraph/worker/importLocationsPlugin.d.ts +33 -0
  38. package/src/Server/MultipartResponse.d.ts +37 -0
  39. package/src/Server/symbolicate.d.ts +38 -0
  40. package/src/Server.d.ts +278 -0
  41. package/src/Server.js +10 -6
  42. package/src/Server.js.flow +9 -10
  43. package/src/cli/parseKeyValueParamArray.d.ts +21 -0
  44. package/src/cli-utils.d.ts +26 -0
  45. package/src/commands/build.d.ts +23 -0
  46. package/src/commands/dependencies.d.ts +23 -0
  47. package/src/commands/serve.d.ts +23 -0
  48. package/src/index.d.ts +187 -0
  49. package/src/index.flow.js +24 -10
  50. package/src/index.flow.js.flow +25 -10
  51. package/src/lib/BatchProcessor.d.ts +61 -0
  52. package/src/lib/CountingSet.d.ts +55 -0
  53. package/src/lib/JsonReporter.d.ts +44 -0
  54. package/src/lib/RamBundleParser.d.ts +36 -0
  55. package/src/lib/TerminalReporter.d.ts +125 -0
  56. package/src/lib/TerminalReporter.js +6 -7
  57. package/src/lib/TerminalReporter.js.flow +6 -15
  58. package/src/lib/bundleProgressUtils.d.ts +33 -0
  59. package/src/lib/bundleProgressUtils.js +19 -0
  60. package/src/lib/bundleProgressUtils.js.flow +35 -0
  61. package/src/lib/bundleToString.d.ts +26 -0
  62. package/src/lib/contextModule.d.ts +40 -0
  63. package/src/lib/contextModuleTemplates.d.ts +32 -0
  64. package/src/lib/countLines.d.ts +19 -0
  65. package/src/lib/createWebsocketServer.d.ts +50 -0
  66. package/src/lib/debounceAsyncQueue.d.ts +22 -0
  67. package/src/lib/formatBundlingError.d.ts +30 -0
  68. package/src/lib/getAppendScripts.d.ts +38 -0
  69. package/src/lib/getGraphId.d.ts +32 -0
  70. package/src/lib/getPreludeCode.d.ts +25 -0
  71. package/src/lib/getPrependedScripts.d.ts +31 -0
  72. package/src/lib/isResolvedDependency.d.ts +22 -0
  73. package/src/lib/logToConsole.d.ts +26 -0
  74. package/src/lib/parseBundleOptionsFromBundleRequestUrl.d.ts +24 -0
  75. package/src/lib/parseCustomResolverOptions.d.ts +23 -0
  76. package/src/lib/parseCustomTransformOptions.d.ts +23 -0
  77. package/src/lib/parseJsonBody.d.ts +34 -0
  78. package/src/lib/pathUtils.d.ts +21 -0
  79. package/src/lib/relativizeSourceMap.d.ts +24 -0
  80. package/src/lib/reporting.d.ts +135 -0
  81. package/src/lib/splitBundleOptions.d.ts +23 -0
  82. package/src/lib/transformHelpers.d.ts +42 -0
  83. package/src/node-haste/DependencyGraph/ModuleResolution.d.ts +133 -0
  84. package/src/node-haste/DependencyGraph/createFileMap.d.ts +36 -0
  85. package/src/node-haste/DependencyGraph.d.ts +93 -0
  86. package/src/node-haste/Package.d.ts +28 -0
  87. package/src/node-haste/PackageCache.d.ts +41 -0
  88. package/src/node-haste/lib/AssetPaths.d.ts +36 -0
  89. package/src/node-haste/lib/parsePlatformFilePath.d.ts +32 -0
  90. package/src/shared/output/RamBundle/as-assets.d.ts +32 -0
  91. package/src/shared/output/RamBundle/as-indexed-file.d.ts +45 -0
  92. package/src/shared/output/RamBundle/buildSourcemapWithMetadata.d.ts +30 -0
  93. package/src/shared/output/RamBundle/magic-number.d.ts +21 -0
  94. package/src/shared/output/RamBundle/util.d.ts +48 -0
  95. package/src/shared/output/RamBundle/write-sourcemap.d.ts +23 -0
  96. package/src/shared/output/RamBundle.d.ts +33 -0
  97. package/src/shared/output/bundle.d.ts +34 -0
  98. package/src/shared/output/meta.d.ts +22 -0
  99. package/src/shared/output/unbundle.d.ts +18 -0
  100. package/src/shared/output/writeFile.d.ts +23 -0
  101. package/src/shared/types.d.ts +152 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "metro",
3
- "version": "0.84.0",
3
+ "version": "0.84.2",
4
4
  "description": "🚇 The JavaScript bundler for React Native.",
5
5
  "main": "src/index.js",
6
6
  "bin": "src/cli.js",
@@ -40,18 +40,18 @@
40
40
  "jest-worker": "^29.7.0",
41
41
  "jsc-safe-url": "^0.2.2",
42
42
  "lodash.throttle": "^4.1.1",
43
- "metro-babel-transformer": "0.84.0",
44
- "metro-cache": "0.84.0",
45
- "metro-cache-key": "0.84.0",
46
- "metro-config": "0.84.0",
47
- "metro-core": "0.84.0",
48
- "metro-file-map": "0.84.0",
49
- "metro-resolver": "0.84.0",
50
- "metro-runtime": "0.84.0",
51
- "metro-source-map": "0.84.0",
52
- "metro-symbolicate": "0.84.0",
53
- "metro-transform-plugins": "0.84.0",
54
- "metro-transform-worker": "0.84.0",
43
+ "metro-babel-transformer": "0.84.2",
44
+ "metro-cache": "0.84.2",
45
+ "metro-cache-key": "0.84.2",
46
+ "metro-config": "0.84.2",
47
+ "metro-core": "0.84.2",
48
+ "metro-file-map": "0.84.2",
49
+ "metro-resolver": "0.84.2",
50
+ "metro-runtime": "0.84.2",
51
+ "metro-source-map": "0.84.2",
52
+ "metro-symbolicate": "0.84.2",
53
+ "metro-transform-plugins": "0.84.2",
54
+ "metro-transform-worker": "0.84.2",
55
55
  "mime-types": "^3.0.1",
56
56
  "nullthrows": "^1.1.1",
57
57
  "serialize-error": "^2.1.0",
@@ -72,10 +72,11 @@
72
72
  "dedent": "^0.7.0",
73
73
  "jest-snapshot": "^29.7.0",
74
74
  "jest-snapshot-serializer-raw": "^1.2.0",
75
- "metro-babel-register": "0.84.0",
75
+ "metro-babel-register": "0.84.2",
76
76
  "metro-memory-fs": "*",
77
77
  "mock-req": "^0.2.0",
78
78
  "mock-res": "^0.6.0",
79
+ "selfsigned": "^5.5.0",
79
80
  "stack-trace": "^0.0.10"
80
81
  },
81
82
  "license": "MIT",
@@ -0,0 +1,90 @@
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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<a58b1d0332fe424196b6d106eacdc2fe>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/Assets.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ export type AssetInfo = {
19
+ readonly files: Array<string>;
20
+ readonly hash: string;
21
+ readonly name: string;
22
+ readonly scales: Array<number>;
23
+ readonly type: string;
24
+ };
25
+ export type AssetDataWithoutFiles = {
26
+ readonly __packager_asset: boolean;
27
+ readonly fileSystemLocation: string;
28
+ readonly hash: string;
29
+ readonly height: null | undefined | number;
30
+ readonly httpServerLocation: string;
31
+ readonly name: string;
32
+ readonly scales: Array<number>;
33
+ readonly type: string;
34
+ readonly width: null | undefined | number;
35
+ };
36
+ export type AssetDataFiltered = {
37
+ readonly __packager_asset: boolean;
38
+ readonly hash: string;
39
+ readonly height: null | undefined | number;
40
+ readonly httpServerLocation: string;
41
+ readonly name: string;
42
+ readonly scales: Array<number>;
43
+ readonly type: string;
44
+ readonly width: null | undefined | number;
45
+ };
46
+ export declare function isAssetTypeAnImage(type: string): boolean;
47
+ export declare function getAssetSize(
48
+ type: string,
49
+ content: Buffer,
50
+ filePath: string,
51
+ ): null | undefined | {readonly width: number; readonly height: number};
52
+ export type AssetData = AssetDataWithoutFiles & {
53
+ readonly files: Array<string>;
54
+ };
55
+ export type AssetDataPlugin = (
56
+ assetData: AssetData,
57
+ ) => AssetData | Promise<AssetData>;
58
+ export declare function getAssetData(
59
+ assetPath: string,
60
+ localPath: string,
61
+ assetDataPlugins: ReadonlyArray<string>,
62
+ platform: null | undefined | string,
63
+ publicPath: string,
64
+ ): Promise<AssetData>;
65
+ /**
66
+ * Returns all the associated files (for different resolutions) of an asset.
67
+ **/
68
+ export declare function getAssetFiles(
69
+ assetPath: string,
70
+ platform?: null | undefined | string,
71
+ ): Promise<Array<string>>;
72
+ /**
73
+ * Return a buffer with the actual image given a request for an image by path.
74
+ * The relativePath can contain a resolution postfix, in this case we need to
75
+ * find that image (or the closest one to it's resolution) in one of the
76
+ * project roots:
77
+ *
78
+ * 1. We first parse the directory of the asset
79
+ * 2. We then build a map of all assets and their scales in this directory
80
+ * 3. Then try to pick platform-specific asset records
81
+ * 4. Then pick the closest resolution (rounding up) to the requested one
82
+ */
83
+ export declare function getAsset(
84
+ relativePath: string,
85
+ projectRoot: string,
86
+ watchFolders: ReadonlyArray<string>,
87
+ platform: null | undefined | string,
88
+ assetExts: ReadonlyArray<string>,
89
+ fileExistsInFileMap?: (absolutePath: string) => boolean,
90
+ ): Promise<Buffer>;
@@ -0,0 +1,34 @@
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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<adf0e819f93597b57ff231cca9c918ef>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/Bundler/util.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ import type {AssetDataWithoutFiles} from '../Assets';
19
+ import type {ModuleTransportLike} from '../shared/types';
20
+ import type {File} from '@babel/types';
21
+
22
+ type SubTree<T extends ModuleTransportLike> = (
23
+ moduleTransport: T,
24
+ moduleTransportsByPath: Map<string, T>,
25
+ ) => Iterable<number>;
26
+ export declare function generateAssetCodeFileAst(
27
+ assetRegistryPath: string,
28
+ assetDescriptor: AssetDataWithoutFiles,
29
+ ): File;
30
+ export declare function createRamBundleGroups<T extends ModuleTransportLike>(
31
+ ramGroups: ReadonlyArray<string>,
32
+ groupableModules: ReadonlyArray<T>,
33
+ subtree: SubTree<T>,
34
+ ): Map<number, Set<number>>;
@@ -0,0 +1,45 @@
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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<3d5664309abdece0f247fcd0c53c3aaf>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/Bundler.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ import type {TransformResultWithSource} from './DeltaBundler';
19
+ import type {TransformOptions} from './DeltaBundler/Worker';
20
+ import type EventEmitter from 'events';
21
+ import type {ConfigT} from 'metro-config';
22
+
23
+ import Transformer from './DeltaBundler/Transformer';
24
+ import DependencyGraph from './node-haste/DependencyGraph';
25
+
26
+ export type BundlerOptions = Readonly<{
27
+ hasReducedPerformance?: boolean;
28
+ watch?: boolean;
29
+ }>;
30
+ declare class Bundler {
31
+ _depGraph: DependencyGraph;
32
+ _initializedPromise: Promise<void>;
33
+ _transformer: Transformer;
34
+ constructor(config: ConfigT, options?: BundlerOptions);
35
+ getWatcher(): EventEmitter;
36
+ end(): Promise<void>;
37
+ getDependencyGraph(): Promise<DependencyGraph>;
38
+ transformFile(
39
+ filePath: string,
40
+ transformOptions: TransformOptions,
41
+ fileBuffer?: Buffer,
42
+ ): Promise<TransformResultWithSource>;
43
+ ready(): Promise<void>;
44
+ }
45
+ export default Bundler;
@@ -0,0 +1,78 @@
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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<b825a92cd295988e6e972591f11221fd>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/DeltaBundler/DeltaCalculator.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ import type {DeltaResult, Options} from './types';
19
+ import type {RootPerfLogger} from 'metro-config';
20
+ import type {ChangeEvent} from 'metro-file-map';
21
+
22
+ import {Graph} from './Graph';
23
+ import EventEmitter from 'events';
24
+ /**
25
+ * This class is in charge of calculating the delta of changed modules that
26
+ * happen between calls. To do so, it subscribes to file changes, so it can
27
+ * traverse the files that have been changed between calls and avoid having to
28
+ * traverse the whole dependency tree for trivial small changes.
29
+ */
30
+ declare class DeltaCalculator<T> extends EventEmitter {
31
+ _changeEventSource: EventEmitter;
32
+ _options: Options<T>;
33
+ _currentBuildPromise: null | undefined | Promise<DeltaResult<T>>;
34
+ _deletedFiles: Set<string>;
35
+ _modifiedFiles: Set<string>;
36
+ _addedFiles: Set<string>;
37
+ _requiresReset: boolean;
38
+ _graph: Graph<T>;
39
+ constructor(
40
+ entryPoints: ReadonlySet<string>,
41
+ changeEventSource: EventEmitter,
42
+ options: Options<T>,
43
+ );
44
+ /**
45
+ * Stops listening for file changes and clears all the caches.
46
+ */
47
+ end(): void;
48
+ /**
49
+ * Main method to calculate the delta of modules. It returns a DeltaResult,
50
+ * which contain the modified/added modules and the removed modules.
51
+ */
52
+ getDelta($$PARAM_0$$: {
53
+ reset: boolean;
54
+ shallow: boolean;
55
+ }): Promise<DeltaResult<T>>;
56
+ /**
57
+ * Returns the graph with all the dependencies. Each module contains the
58
+ * needed information to do the traversing (dependencies, inverseDependencies)
59
+ * plus some metadata.
60
+ */
61
+ getGraph(): Graph<T>;
62
+ _handleMultipleFileChanges: (changeEvent: ChangeEvent) => void;
63
+ /**
64
+ * Handles a single file change. To avoid doing any work before it's needed,
65
+ * the listener only stores the modified file, which will then be used later
66
+ * when the delta needs to be calculated.
67
+ */
68
+ _handleFileChange: (
69
+ $$PARAM_0$$: ChangeEvent['eventsQueue'][number],
70
+ logger: null | undefined | RootPerfLogger,
71
+ ) => unknown;
72
+ _getChangedDependencies(
73
+ modifiedFiles: Set<string>,
74
+ deletedFiles: Set<string>,
75
+ addedFiles: Set<string>,
76
+ ): Promise<DeltaResult<T>>;
77
+ }
78
+ export default DeltaCalculator;
@@ -0,0 +1,174 @@
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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<2af7aa3b61c2afa4d8794e127666c226>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/DeltaBundler/Graph.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ /**
19
+ * Portions of this code are based on the Synchronous Cycle Collection
20
+ * algorithm described in:
21
+ *
22
+ * David F. Bacon and V. T. Rajan. 2001. Concurrent Cycle Collection in
23
+ * Reference Counted Systems. In Proceedings of the 15th European Conference on
24
+ * Object-Oriented Programming (ECOOP '01). Springer-Verlag, Berlin,
25
+ * Heidelberg, 207–235.
26
+ *
27
+ * Notable differences from the algorithm in the paper:
28
+ * 1. Our implementation uses the inverseDependencies set (which we already
29
+ * have to maintain) instead of a separate refcount variable. A module's
30
+ * reference count is equal to the size of its inverseDependencies set, plus
31
+ * 1 if it's an entry point of the graph.
32
+ * 2. We keep the "root buffer" (possibleCycleRoots) free of duplicates by
33
+ * making it a Set, instead of storing a "buffered" flag on each node.
34
+ * 3. On top of tracking edges between nodes, we also count references between
35
+ * nodes and entries in the importBundleNodes set.
36
+ */
37
+
38
+ import type {RequireContext} from '../lib/contextModule';
39
+ import type {
40
+ Dependencies,
41
+ Dependency,
42
+ GraphInputOptions,
43
+ MixedOutput,
44
+ Module,
45
+ ModuleData,
46
+ Options,
47
+ ResolvedDependency,
48
+ TransformInputOptions,
49
+ } from './types';
50
+
51
+ import CountingSet from '../lib/CountingSet';
52
+
53
+ export type Result<T> = {
54
+ added: Map<string, Module<T>>;
55
+ modified: Map<string, Module<T>>;
56
+ deleted: Set<string>;
57
+ };
58
+ type Delta<T> = Readonly<{
59
+ added: Set<string>;
60
+ touched: Set<string>;
61
+ deleted: Set<string>;
62
+ updatedModuleData: ReadonlyMap<string, ModuleData<T>>;
63
+ baseModuleData: Map<string, ModuleData<T>>;
64
+ errors: ReadonlyMap<string, Error>;
65
+ }>;
66
+ type InternalOptions<T> = Readonly<{
67
+ lazy: boolean;
68
+ onDependencyAdd: () => unknown;
69
+ onDependencyAdded: () => unknown;
70
+ resolve: Options<T>['resolve'];
71
+ transform: Options<T>['transform'];
72
+ shallow: boolean;
73
+ }>;
74
+ export declare class Graph<T = MixedOutput> {
75
+ readonly entryPoints: ReadonlySet<string>;
76
+ readonly transformOptions: TransformInputOptions;
77
+ readonly dependencies: Dependencies<T>;
78
+ constructor(options: GraphInputOptions);
79
+ /**
80
+ * Dependency Traversal logic for the Delta Bundler. This method calculates
81
+ * the modules that should be included in the bundle by traversing the
82
+ * dependency graph.
83
+ * Instead of traversing the whole graph each time, it just calculates the
84
+ * difference between runs by only traversing the added/removed dependencies.
85
+ * To do so, it uses the passed graph dependencies and it mutates it.
86
+ * The paths parameter contains the absolute paths of the root files that the
87
+ * method should traverse. Normally, these paths should be the modified files
88
+ * since the last traversal.
89
+ */
90
+ traverseDependencies(
91
+ paths: ReadonlyArray<string>,
92
+ options: Options<T>,
93
+ ): Promise<Result<T>>;
94
+ initialTraverseDependencies(options: Options<T>): Promise<Result<T>>;
95
+ _buildDelta(
96
+ pathsToVisit: ReadonlySet<string>,
97
+ options: InternalOptions<T>,
98
+ moduleFilter?: (path: string) => boolean,
99
+ ): Promise<Delta<T>>;
100
+ _recursivelyCommitModule(
101
+ path: string,
102
+ delta: Delta<T>,
103
+ options: InternalOptions<T>,
104
+ commitOptions?: Readonly<{onlyRemove: boolean}>,
105
+ ): Module<T>;
106
+ _addDependency(
107
+ parentModule: Module<T>,
108
+ key: string,
109
+ dependency: Dependency,
110
+ requireContext: null | undefined | RequireContext,
111
+ delta: Delta<T>,
112
+ options: InternalOptions<T>,
113
+ ): void;
114
+ _removeDependency(
115
+ parentModule: Module<T>,
116
+ key: string,
117
+ dependency: Dependency,
118
+ delta: Delta<T>,
119
+ options: InternalOptions<T>,
120
+ ): void;
121
+ /**
122
+ * Collect a list of context modules which include a given file.
123
+ */
124
+ markModifiedContextModules(
125
+ filePath: string,
126
+ modifiedPaths: Set<string> | CountingSet<string>,
127
+ ): void;
128
+ /**
129
+ * Gets the list of modules affected by the deletion of a given file. The
130
+ * caller is expected to mark these modules as modified in the next call to
131
+ * traverseDependencies. Note that the list may contain duplicates.
132
+ */
133
+ getModifiedModulesForDeletedPath(filePath: string): Iterable<string>;
134
+ /**
135
+ * Re-traverse the dependency graph in DFS order to reorder the modules and
136
+ * guarantee the same order between runs. This method mutates the passed graph.
137
+ */
138
+ reorderGraph(options: {shallow: boolean}): void;
139
+ _reorderDependencies(
140
+ module: Module<T>,
141
+ orderedDependencies: Map<string, Module<T>>,
142
+ options: {shallow: boolean},
143
+ ): void;
144
+ /** Garbage collection functions */
145
+
146
+ _incrementImportBundleReference(
147
+ dependency: ResolvedDependency,
148
+ parentModule: Module<T>,
149
+ ): void;
150
+ _decrementImportBundleReference(
151
+ dependency: ResolvedDependency,
152
+ parentModule: Module<T>,
153
+ ): void;
154
+ _markModuleInUse(module: Module<T>): void;
155
+ _children(
156
+ module: Module<T>,
157
+ options: InternalOptions<T>,
158
+ ): Iterator<Module<T>>;
159
+ _moduleSnapshot(module: Module<T>): ModuleData<T>;
160
+ _releaseModule(
161
+ module: Module<T>,
162
+ delta: Delta<T>,
163
+ options: InternalOptions<T>,
164
+ ): void;
165
+ _freeModule(module: Module<T>, delta: Delta<T>): void;
166
+ _markAsPossibleCycleRoot(module: Module<T>): void;
167
+ _collectCycles(delta: Delta<T>, options: InternalOptions<T>): void;
168
+ _markGray(module: Module<T>, options: InternalOptions<T>): void;
169
+ _scan(module: Module<T>, options: InternalOptions<T>): void;
170
+ _scanBlack(module: Module<T>, options: InternalOptions<T>): void;
171
+ _collectWhite(module: Module<T>, delta: Delta<T>): void;
172
+
173
+ /** End of garbage collection functions */
174
+ }
@@ -0,0 +1,27 @@
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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<e21aeb433f191f32b37d05733b0b76bd>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/DeltaBundler/Serializers/baseJSBundle.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ import type {Module, ReadOnlyGraph, SerializerOptions} from '../types';
19
+ import type {Bundle} from 'metro-runtime/src/modules/types';
20
+
21
+ declare function baseJSBundle(
22
+ entryPoint: string,
23
+ preModules: ReadonlyArray<Module>,
24
+ graph: ReadOnlyGraph,
25
+ options: SerializerOptions,
26
+ ): Bundle;
27
+ export default baseJSBundle;
@@ -0,0 +1,29 @@
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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<1d044a890d1eebbef947f78609d7c58f>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/DeltaBundler/Serializers/getAllFiles.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ import type {Module, ReadOnlyGraph} from '../types';
19
+
20
+ type Options = {
21
+ platform: null | undefined | string;
22
+ readonly processModuleFilter: (module: Module) => boolean;
23
+ };
24
+ declare function getAllFiles(
25
+ pre: ReadonlyArray<Module>,
26
+ graph: ReadOnlyGraph,
27
+ options: Options,
28
+ ): Promise<ReadonlyArray<string>>;
29
+ export default getAllFiles;
@@ -0,0 +1,32 @@
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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<0a49d828c4a80d52ccab4d4766b84c86>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/DeltaBundler/Serializers/getAssets.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ import type {AssetData} from '../../Assets';
19
+ import type {Module, ReadOnlyDependencies} from '../types';
20
+
21
+ type Options = {
22
+ readonly processModuleFilter: (module: Module) => boolean;
23
+ assetPlugins: ReadonlyArray<string>;
24
+ platform: null | undefined | string;
25
+ projectRoot: string;
26
+ publicPath: string;
27
+ };
28
+ declare function getAssets(
29
+ dependencies: ReadOnlyDependencies,
30
+ options: Options,
31
+ ): Promise<ReadonlyArray<AssetData>>;
32
+ export default getAssets;
@@ -0,0 +1,33 @@
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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<623892927b76c4f68802bb69f19d9974>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/DeltaBundler/Serializers/getExplodedSourceMap.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ import type {Module} from '../types';
19
+ import type {
20
+ FBSourceFunctionMap,
21
+ MetroSourceMapSegmentTuple,
22
+ } from 'metro-source-map';
23
+
24
+ export type ExplodedSourceMap = ReadonlyArray<{
25
+ readonly map: Array<MetroSourceMapSegmentTuple>;
26
+ readonly firstLine1Based: number;
27
+ readonly functionMap: null | undefined | FBSourceFunctionMap;
28
+ readonly path: string;
29
+ }>;
30
+ export declare function getExplodedSourceMap(
31
+ modules: ReadonlyArray<Module>,
32
+ options: {readonly processModuleFilter: (module: Module) => boolean},
33
+ ): ExplodedSourceMap;
@@ -0,0 +1,55 @@
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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<b01899b6156596978e6b8e7ba93e97a4>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/DeltaBundler/Serializers/getRamBundleInfo.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ import type {ModuleTransportLike} from '../../shared/types';
19
+ import type {Module, ReadOnlyGraph, SerializerOptions} from '../types';
20
+ import type {SourceMapGeneratorOptions} from './sourceMapGenerator';
21
+ import type {GetTransformOptions} from 'metro-config';
22
+
23
+ type Options = Readonly<
24
+ Omit<
25
+ SerializerOptions,
26
+ | keyof SourceMapGeneratorOptions
27
+ | keyof {
28
+ getTransformOptions: null | undefined | GetTransformOptions;
29
+ platform: null | undefined | string;
30
+ }
31
+ > &
32
+ Omit<
33
+ SourceMapGeneratorOptions,
34
+ keyof {
35
+ getTransformOptions: null | undefined | GetTransformOptions;
36
+ platform: null | undefined | string;
37
+ }
38
+ > & {
39
+ getTransformOptions: null | undefined | GetTransformOptions;
40
+ platform: null | undefined | string;
41
+ }
42
+ >;
43
+ export type RamBundleInfo = {
44
+ getDependencies: ($$PARAM_0$$: string) => Set<string>;
45
+ startupModules: ReadonlyArray<ModuleTransportLike>;
46
+ lazyModules: ReadonlyArray<ModuleTransportLike>;
47
+ groups: Map<number, Set<number>>;
48
+ };
49
+ declare function getRamBundleInfo(
50
+ entryPoint: string,
51
+ pre: ReadonlyArray<Module>,
52
+ graph: ReadOnlyGraph,
53
+ options: Options,
54
+ ): Promise<RamBundleInfo>;
55
+ export default getRamBundleInfo;
@@ -0,0 +1,19 @@
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
+ * @noformat
8
+ * @oncall react_native
9
+ * @generated SignedSource<<f9cd017db02091bdd4f6d114e4744087>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/DeltaBundler/Serializers/helpers/getInlineSourceMappingURL.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ declare function getInlineSourceMappingURL(sourceMap: string): string;
19
+ export default getInlineSourceMappingURL;