metro 0.84.1 → 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 (93) hide show
  1. package/package.json +14 -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/cli/parseKeyValueParamArray.d.ts +21 -0
  42. package/src/cli-utils.d.ts +26 -0
  43. package/src/commands/build.d.ts +23 -0
  44. package/src/commands/dependencies.d.ts +23 -0
  45. package/src/commands/serve.d.ts +23 -0
  46. package/src/index.d.ts +187 -0
  47. package/src/lib/BatchProcessor.d.ts +61 -0
  48. package/src/lib/CountingSet.d.ts +55 -0
  49. package/src/lib/JsonReporter.d.ts +44 -0
  50. package/src/lib/RamBundleParser.d.ts +36 -0
  51. package/src/lib/TerminalReporter.d.ts +125 -0
  52. package/src/lib/bundleProgressUtils.d.ts +33 -0
  53. package/src/lib/bundleToString.d.ts +26 -0
  54. package/src/lib/contextModule.d.ts +40 -0
  55. package/src/lib/contextModuleTemplates.d.ts +32 -0
  56. package/src/lib/countLines.d.ts +19 -0
  57. package/src/lib/createWebsocketServer.d.ts +50 -0
  58. package/src/lib/debounceAsyncQueue.d.ts +22 -0
  59. package/src/lib/formatBundlingError.d.ts +30 -0
  60. package/src/lib/getAppendScripts.d.ts +38 -0
  61. package/src/lib/getGraphId.d.ts +32 -0
  62. package/src/lib/getPreludeCode.d.ts +25 -0
  63. package/src/lib/getPrependedScripts.d.ts +31 -0
  64. package/src/lib/isResolvedDependency.d.ts +22 -0
  65. package/src/lib/logToConsole.d.ts +26 -0
  66. package/src/lib/parseBundleOptionsFromBundleRequestUrl.d.ts +24 -0
  67. package/src/lib/parseCustomResolverOptions.d.ts +23 -0
  68. package/src/lib/parseCustomTransformOptions.d.ts +23 -0
  69. package/src/lib/parseJsonBody.d.ts +34 -0
  70. package/src/lib/pathUtils.d.ts +21 -0
  71. package/src/lib/relativizeSourceMap.d.ts +24 -0
  72. package/src/lib/reporting.d.ts +135 -0
  73. package/src/lib/splitBundleOptions.d.ts +23 -0
  74. package/src/lib/transformHelpers.d.ts +42 -0
  75. package/src/node-haste/DependencyGraph/ModuleResolution.d.ts +133 -0
  76. package/src/node-haste/DependencyGraph/createFileMap.d.ts +36 -0
  77. package/src/node-haste/DependencyGraph.d.ts +93 -0
  78. package/src/node-haste/Package.d.ts +28 -0
  79. package/src/node-haste/PackageCache.d.ts +41 -0
  80. package/src/node-haste/lib/AssetPaths.d.ts +36 -0
  81. package/src/node-haste/lib/parsePlatformFilePath.d.ts +32 -0
  82. package/src/shared/output/RamBundle/as-assets.d.ts +32 -0
  83. package/src/shared/output/RamBundle/as-indexed-file.d.ts +45 -0
  84. package/src/shared/output/RamBundle/buildSourcemapWithMetadata.d.ts +30 -0
  85. package/src/shared/output/RamBundle/magic-number.d.ts +21 -0
  86. package/src/shared/output/RamBundle/util.d.ts +48 -0
  87. package/src/shared/output/RamBundle/write-sourcemap.d.ts +23 -0
  88. package/src/shared/output/RamBundle.d.ts +33 -0
  89. package/src/shared/output/bundle.d.ts +34 -0
  90. package/src/shared/output/meta.d.ts +22 -0
  91. package/src/shared/output/unbundle.d.ts +18 -0
  92. package/src/shared/output/writeFile.d.ts +23 -0
  93. package/src/shared/types.d.ts +152 -0
@@ -0,0 +1,133 @@
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<<d5224d8913b7e0c52ac84b215b356422>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/node-haste/DependencyGraph/ModuleResolution.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 {
19
+ BundlerResolution,
20
+ TransformResultDependency,
21
+ } from '../../DeltaBundler/types';
22
+ import type {Reporter} from '../../lib/reporting';
23
+ import type {ResolverInputOptions} from '../../shared/types';
24
+ import type {
25
+ CustomResolver,
26
+ DoesFileExist,
27
+ FileCandidates,
28
+ FileSystemLookup,
29
+ Resolution,
30
+ ResolveAsset,
31
+ } from 'metro-resolver';
32
+ import type {PackageForModule, PackageJson} from 'metro-resolver/private/types';
33
+
34
+ export type DirExistsFn = (filePath: string) => boolean;
35
+ export type Packageish = {path: string; read(): PackageJson};
36
+ export type Moduleish = {readonly path: string};
37
+ export type PackageishCache<TPackage> = {
38
+ getPackage(
39
+ name: string,
40
+ platform?: string,
41
+ supportsNativePlatform?: boolean,
42
+ ): TPackage;
43
+ getPackageOf(
44
+ absolutePath: string,
45
+ ): null | undefined | {pkg: TPackage; packageRelativePath: string};
46
+ };
47
+ type Options<TPackage> = Readonly<{
48
+ assetExts: ReadonlySet<string>;
49
+ dirExists: DirExistsFn;
50
+ disableHierarchicalLookup: boolean;
51
+ doesFileExist: DoesFileExist;
52
+ emptyModulePath: string;
53
+ extraNodeModules: null | undefined | object;
54
+ fileSystemLookup: FileSystemLookup;
55
+ getHasteModulePath: (
56
+ name: string,
57
+ platform: null | undefined | string,
58
+ ) => null | undefined | string;
59
+ getHastePackagePath: (
60
+ name: string,
61
+ platform: null | undefined | string,
62
+ ) => null | undefined | string;
63
+ mainFields: ReadonlyArray<string>;
64
+ packageCache: PackageishCache<TPackage>;
65
+ nodeModulesPaths: ReadonlyArray<string>;
66
+ preferNativePlatform: boolean;
67
+ projectRoot: string;
68
+ reporter: Reporter;
69
+ resolveAsset: ResolveAsset;
70
+ resolveRequest: null | undefined | CustomResolver;
71
+ sourceExts: ReadonlyArray<string>;
72
+ unstable_conditionNames: ReadonlyArray<string>;
73
+ unstable_conditionsByPlatform: Readonly<{
74
+ [platform: string]: ReadonlyArray<string>;
75
+ }>;
76
+ unstable_enablePackageExports: boolean;
77
+ unstable_incrementalResolution: boolean;
78
+ }>;
79
+ export declare class ModuleResolver<TPackage extends Packageish> {
80
+ _options: Options<TPackage>;
81
+ _projectRootFakeModulePath: string;
82
+ _cachedEmptyModule: null | undefined | BundlerResolution;
83
+ constructor(options: Options<TPackage>);
84
+ _getEmptyModule(): BundlerResolution;
85
+ resolveDependency(
86
+ originModulePath: string,
87
+ dependency: TransformResultDependency,
88
+ allowHaste: boolean,
89
+ platform: string | null,
90
+ resolverOptions: ResolverInputOptions,
91
+ ): BundlerResolution;
92
+ _getPackage: (packageJsonPath: string) => null | undefined | PackageJson;
93
+ _getPackageForModule: (
94
+ absolutePath: string,
95
+ ) => null | undefined | PackageForModule;
96
+ /**
97
+ * TODO: Return Resolution instead of coercing to BundlerResolution here
98
+ */
99
+ _getFileResolvedModule(resolution: Resolution): BundlerResolution;
100
+ _logWarning: (message: string) => void;
101
+ _removeRoot(candidates: FileCandidates): FileCandidates;
102
+ }
103
+ export declare class UnableToResolveError extends Error {
104
+ /**
105
+ * File path of the module that tried to require a module, ex. `/js/foo.js`.
106
+ */
107
+ originModulePath: string;
108
+ /**
109
+ * The name of the module that was required, no necessarily a path,
110
+ * ex. `./bar`, or `invariant`.
111
+ */
112
+ targetModuleName: string;
113
+ /**
114
+ * Original error that causes this error
115
+ */
116
+ cause: null | undefined | Error;
117
+ /**
118
+ * Fixed type field in common with other Metro build errors.
119
+ */
120
+ readonly type: 'UnableToResolveError';
121
+ constructor(
122
+ originModulePath: string,
123
+ targetModuleName: string,
124
+ message: string,
125
+ options?: Readonly<{
126
+ dependency?: null | undefined | TransformResultDependency;
127
+ cause?: Error;
128
+ }>,
129
+ );
130
+ buildCodeFrameMessage(
131
+ dependency: null | undefined | TransformResultDependency,
132
+ ): null | undefined | string;
133
+ }
@@ -0,0 +1,36 @@
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<<c008adad2ea747972e2f301a6375b447>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/node-haste/DependencyGraph/createFileMap.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 {ConfigT} from 'metro-config';
19
+ import type {HasteMap} from 'metro-file-map';
20
+
21
+ import MetroFileMap, {DependencyPlugin} from 'metro-file-map';
22
+
23
+ declare function createFileMap(
24
+ config: ConfigT,
25
+ options?: Readonly<{
26
+ extractDependencies?: boolean;
27
+ watch?: boolean;
28
+ throwOnModuleCollision?: boolean;
29
+ cacheFilePrefix?: string;
30
+ }>,
31
+ ): {
32
+ fileMap: MetroFileMap;
33
+ hasteMap: HasteMap;
34
+ dependencyPlugin: null | undefined | DependencyPlugin;
35
+ };
36
+ export default createFileMap;
@@ -0,0 +1,93 @@
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<<eb945b3566e9ed370894adaada197736>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/node-haste/DependencyGraph.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 {
19
+ BundlerResolution,
20
+ TransformResultDependency,
21
+ } from '../DeltaBundler/types';
22
+ import type {ResolverInputOptions} from '../shared/types';
23
+ import type Package from './Package';
24
+ import type {ConfigT} from 'metro-config';
25
+ import type {
26
+ ChangeEvent,
27
+ FileSystem,
28
+ HasteMap,
29
+ HealthCheckResult,
30
+ WatcherStatus,
31
+ default as MetroFileMap,
32
+ } from 'metro-file-map';
33
+
34
+ import {ModuleResolver} from './DependencyGraph/ModuleResolution';
35
+ import {PackageCache} from './PackageCache';
36
+ import EventEmitter from 'events';
37
+
38
+ declare class DependencyGraph extends EventEmitter {
39
+ _config: ConfigT;
40
+ _haste: MetroFileMap;
41
+ _fileSystem: FileSystem;
42
+ _hasteMap: HasteMap;
43
+ _moduleResolver: ModuleResolver<Package>;
44
+ _resolutionCache: Map<
45
+ string | symbol,
46
+ Map<
47
+ string | symbol,
48
+ Map<string | symbol, Map<string | symbol, BundlerResolution>>
49
+ >
50
+ >;
51
+ _initializedPromise: Promise<void>;
52
+ constructor(
53
+ config: ConfigT,
54
+ options?: {
55
+ readonly hasReducedPerformance?: boolean;
56
+ readonly watch?: boolean;
57
+ },
58
+ );
59
+ _onWatcherHealthCheck(result: HealthCheckResult): void;
60
+ _onWatcherStatus(status: WatcherStatus): void;
61
+ ready(): Promise<void>;
62
+ _onHasteChange($$PARAM_0$$: ChangeEvent): void;
63
+ _createModuleResolver(): void;
64
+ _getClosestPackage(
65
+ absoluteModulePath: string,
66
+ ): null | undefined | {packageJsonPath: string; packageRelativePath: string};
67
+ _createPackageCache(): PackageCache;
68
+ getAllFiles(): Array<string>;
69
+ /**
70
+ * Used when watcher.unstable_lazySha1 is true
71
+ */
72
+ getOrComputeSha1(
73
+ mixedPath: string,
74
+ ): Promise<{content?: Buffer; sha1: string}>;
75
+ getWatcher(): EventEmitter;
76
+ end(): void;
77
+ /** Given a search context, return a list of file paths matching the query. */
78
+ matchFilesWithContext(
79
+ from: string,
80
+ context: Readonly<{recursive: boolean; filter: RegExp}>,
81
+ ): Iterable<string>;
82
+ resolveDependency(
83
+ originModulePath: string,
84
+ dependency: TransformResultDependency,
85
+ platform: string | null,
86
+ resolverOptions: ResolverInputOptions,
87
+ $$PARAM_4$$?: {assumeFlatNodeModules: boolean},
88
+ ): BundlerResolution;
89
+ doesFileExist: (filePath: string) => boolean;
90
+ getHasteName(filePath: string): string;
91
+ getDependencies(filePath: string): Array<string>;
92
+ }
93
+ export default DependencyGraph;
@@ -0,0 +1,28 @@
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<<17776d35467f02c7e07dcde4be309545>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/node-haste/Package.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 {PackageJson} from 'metro-resolver/private/types';
19
+
20
+ declare class Package {
21
+ path: string;
22
+ _root: string;
23
+ _content: null | undefined | PackageJson;
24
+ constructor($$PARAM_0$$: {file: string});
25
+ invalidate(): void;
26
+ read(): PackageJson;
27
+ }
28
+ export default Package;
@@ -0,0 +1,41 @@
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<<eaea6d7e01d54353f700cdadd60c4bf2>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/node-haste/PackageCache.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ import Package from './Package';
19
+
20
+ type GetClosestPackageFn = (
21
+ absoluteFilePath: string,
22
+ ) => null | undefined | {packageJsonPath: string; packageRelativePath: string};
23
+ export declare class PackageCache {
24
+ _getClosestPackage: GetClosestPackageFn;
25
+ _packageCache: {[filePath: string]: Package};
26
+ _packagePathAndSubpathByModulePath: {
27
+ [filePath: string]:
28
+ | null
29
+ | undefined
30
+ | {packageJsonPath: string; packageRelativePath: string};
31
+ };
32
+ _modulePathsByPackagePath: {
33
+ [filePath: string]: Set<string>;
34
+ };
35
+ constructor(options: {getClosestPackage: GetClosestPackageFn});
36
+ getPackage(filePath: string): Package;
37
+ getPackageOf(
38
+ absoluteModulePath: string,
39
+ ): null | undefined | {pkg: Package; packageRelativePath: string};
40
+ invalidate(filePath: string): void;
41
+ }
@@ -0,0 +1,36 @@
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<<31b3384bffa191e4c3c9916d93df8571>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/node-haste/lib/AssetPaths.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 AssetPath = {
19
+ assetName: string;
20
+ name: string;
21
+ platform: null | undefined | string;
22
+ resolution: number;
23
+ type: string;
24
+ };
25
+ /**
26
+ * Return `null` if the `filePath` doesn't have a valid extension, required
27
+ * to describe the type of an asset.
28
+ */
29
+ export declare function tryParse(
30
+ filePath: string,
31
+ platforms: ReadonlySet<string>,
32
+ ): null | undefined | AssetPath;
33
+ export declare function parse(
34
+ filePath: string,
35
+ platforms: ReadonlySet<string>,
36
+ ): AssetPath;
@@ -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<<61c16b5ef31517dc44347558a4dd431a>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/node-haste/lib/parsePlatformFilePath.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ type PlatformFilePathParts = {
19
+ dirPath: string;
20
+ baseName: string;
21
+ platform: null | undefined | string;
22
+ extension: null | undefined | string;
23
+ };
24
+ /**
25
+ * Extract the components of a file path that can have a platform specifier: Ex.
26
+ * `index.ios.js` is specific to the `ios` platform and has the extension `js`.
27
+ */
28
+ declare function parsePlatformFilePath(
29
+ filePath: string,
30
+ platforms: ReadonlySet<string>,
31
+ ): PlatformFilePathParts;
32
+ export default parsePlatformFilePath;
@@ -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<<02d7f6eec9c93d02612c9b2fdef18cef>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/shared/output/RamBundle/as-assets.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 {RamBundleInfo} from '../../../DeltaBundler/Serializers/getRamBundleInfo';
19
+ import type {OutputOptions} from '../../types';
20
+ /**
21
+ * Saves all JS modules of an app as single files
22
+ * The startup code (prelude, polyfills etc.) are written to the file
23
+ * designated by the `bundleOuput` option.
24
+ * All other modules go into a 'js-modules' folder that in the same parent
25
+ * directory as the startup file.
26
+ */
27
+ declare function saveAsAssets(
28
+ bundle: RamBundleInfo,
29
+ options: OutputOptions,
30
+ log: (...args: Array<string>) => void,
31
+ ): Promise<unknown>;
32
+ export default saveAsAssets;
@@ -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<<cf05d2127a356bae7e3789c2fefa25d3>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/shared/output/RamBundle/as-indexed-file.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 {RamBundleInfo} from '../../../DeltaBundler/Serializers/getRamBundleInfo';
19
+ import type {
20
+ ModuleGroups,
21
+ ModuleTransportLike,
22
+ OutputOptions,
23
+ } from '../../types';
24
+ /**
25
+ * Saves all JS modules of an app as a single file, separated with null bytes.
26
+ * The file begins with an offset table that contains module ids and their
27
+ * lengths/offsets.
28
+ * The module id for the startup code (prelude, polyfills etc.) is the
29
+ * empty string.
30
+ */
31
+ export declare function save(
32
+ bundle: RamBundleInfo,
33
+ options: OutputOptions,
34
+ log: (...args: Array<string>) => void,
35
+ ): Promise<unknown>;
36
+ export declare function buildTableAndContents(
37
+ startupCode: string,
38
+ modules: ReadonlyArray<ModuleTransportLike>,
39
+ moduleGroups: ModuleGroups,
40
+ encoding?: 'utf8' | 'utf16le' | 'ascii',
41
+ ): Array<Buffer>;
42
+ export declare function createModuleGroups(
43
+ groups: Map<number, Set<number>>,
44
+ modules: ReadonlyArray<ModuleTransportLike>,
45
+ ): ModuleGroups;
@@ -0,0 +1,30 @@
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<<669a46ab2a802ea2b93d98edf337fff0>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/shared/output/RamBundle/buildSourcemapWithMetadata.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 {ModuleGroups, ModuleTransportLike} from '../../types';
19
+ import type {IndexMap} from 'metro-source-map';
20
+
21
+ type Params = {
22
+ fixWrapperOffset: boolean;
23
+ lazyModules: ReadonlyArray<ModuleTransportLike>;
24
+ moduleGroups: null | undefined | ModuleGroups;
25
+ startupModules: ReadonlyArray<ModuleTransportLike>;
26
+ };
27
+ declare const $$EXPORT_DEFAULT_DECLARATION$$: ($$PARAM_0$$: Params) => IndexMap;
28
+ declare type $$EXPORT_DEFAULT_DECLARATION$$ =
29
+ typeof $$EXPORT_DEFAULT_DECLARATION$$;
30
+ export default $$EXPORT_DEFAULT_DECLARATION$$;
@@ -0,0 +1,21 @@
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<<94cd41a2f04528e81f82e6c2feadaf52>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/shared/output/RamBundle/magic-number.js
13
+ * To regenerate, run:
14
+ * js1 build metro-ts-defs (internal) OR
15
+ * yarn run build-ts-defs (OSS)
16
+ */
17
+
18
+ declare const $$EXPORT_DEFAULT_DECLARATION$$: 0xfb0bd1e5;
19
+ declare type $$EXPORT_DEFAULT_DECLARATION$$ =
20
+ typeof $$EXPORT_DEFAULT_DECLARATION$$;
21
+ export default $$EXPORT_DEFAULT_DECLARATION$$;
@@ -0,0 +1,48 @@
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<<cb3371e2f23da9cd30e08ed76ec4f7db>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/shared/output/RamBundle/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 {ModuleGroups, ModuleTransportLike} from '../../types';
19
+ import type {BasicSourceMap, IndexMap} from 'metro-source-map';
20
+
21
+ import countLines from '../../../lib/countLines';
22
+
23
+ declare function lineToLineSourceMap(
24
+ source: string,
25
+ filename?: string,
26
+ ): BasicSourceMap;
27
+ type CombineOptions = {fixWrapperOffset: boolean};
28
+ declare function combineSourceMaps(
29
+ modules: ReadonlyArray<ModuleTransportLike>,
30
+ moduleGroups?: ModuleGroups,
31
+ options?: null | undefined | CombineOptions,
32
+ ): IndexMap;
33
+ declare function combineSourceMapsAddingOffsets(
34
+ modules: ReadonlyArray<ModuleTransportLike>,
35
+ x_metro_module_paths: Array<string>,
36
+ moduleGroups?: null | undefined | ModuleGroups,
37
+ options?: null | undefined | CombineOptions,
38
+ ): IndexMap;
39
+ declare const joinModules: (
40
+ modules: ReadonlyArray<{readonly code: string}>,
41
+ ) => string;
42
+ export {
43
+ combineSourceMaps,
44
+ combineSourceMapsAddingOffsets,
45
+ countLines,
46
+ joinModules,
47
+ lineToLineSourceMap,
48
+ };
@@ -0,0 +1,23 @@
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<<000f29900c01342de92d247507075575>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/shared/output/RamBundle/write-sourcemap.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 writeSourcemap(
19
+ fileName: string,
20
+ contents: string,
21
+ log: (...args: Array<string>) => void,
22
+ ): Promise<unknown>;
23
+ export default writeSourcemap;
@@ -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<<bef82861a3de459220bf62515fd5900c>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/shared/output/RamBundle.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 {RamBundleInfo} from '../../DeltaBundler/Serializers/getRamBundleInfo';
19
+ import type {OutputOptions, RequestOptions} from '../types';
20
+
21
+ import Server from '../../Server';
22
+
23
+ export declare function build(
24
+ packagerClient: Server,
25
+ requestOptions: RequestOptions,
26
+ ): Promise<RamBundleInfo>;
27
+ export declare function save(
28
+ bundle: RamBundleInfo,
29
+ options: OutputOptions,
30
+ log: (x: string) => void,
31
+ ): Promise<unknown>;
32
+ export declare const formatName: 'bundle';
33
+ export declare type formatName = typeof formatName;
@@ -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<<d9877b2ba27e8e3f279901c80c7ad895>>
10
+ *
11
+ * This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
12
+ * Original file: packages/metro/src/shared/output/bundle.flow.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 {BuildOptions, OutputOptions, RequestOptions} from '../types';
20
+
21
+ import Server from '../../Server';
22
+
23
+ export declare function build(
24
+ packagerClient: Server,
25
+ requestOptions: RequestOptions,
26
+ buildOptions?: BuildOptions,
27
+ ): Promise<{code: string; map: string; assets?: ReadonlyArray<AssetData>}>;
28
+ export declare function save(
29
+ bundle: {code: string; map: string},
30
+ options: OutputOptions,
31
+ log: ($$PARAM_0$$: string) => void,
32
+ ): Promise<unknown>;
33
+ export declare const formatName: 'bundle';
34
+ export declare type formatName = typeof formatName;