metro 0.84.1 → 0.84.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +15 -15
- package/src/Assets.d.ts +90 -0
- package/src/Bundler/util.d.ts +34 -0
- package/src/Bundler/util.js.flow +3 -3
- package/src/Bundler.d.ts +45 -0
- package/src/DeltaBundler/DeltaCalculator.d.ts +68 -0
- package/src/DeltaBundler/DeltaCalculator.js +55 -46
- package/src/DeltaBundler/DeltaCalculator.js.flow +72 -61
- package/src/DeltaBundler/Graph.d.ts +174 -0
- package/src/DeltaBundler/Serializers/baseJSBundle.d.ts +27 -0
- package/src/DeltaBundler/Serializers/getAllFiles.d.ts +29 -0
- package/src/DeltaBundler/Serializers/getAssets.d.ts +32 -0
- package/src/DeltaBundler/Serializers/getExplodedSourceMap.d.ts +33 -0
- package/src/DeltaBundler/Serializers/getRamBundleInfo.d.ts +55 -0
- package/src/DeltaBundler/Serializers/helpers/getInlineSourceMappingURL.d.ts +19 -0
- package/src/DeltaBundler/Serializers/helpers/getSourceMapInfo.d.ts +40 -0
- package/src/DeltaBundler/Serializers/helpers/getTransitiveDependencies.d.ts +24 -0
- package/src/DeltaBundler/Serializers/helpers/js.d.ts +37 -0
- package/src/DeltaBundler/Serializers/helpers/processModules.d.ts +32 -0
- package/src/DeltaBundler/Serializers/hmrJSBundle.d.ts +37 -0
- package/src/DeltaBundler/Serializers/sourceMapGenerator.d.ts +36 -0
- package/src/DeltaBundler/Serializers/sourceMapObject.d.ts +30 -0
- package/src/DeltaBundler/Serializers/sourceMapString.d.ts +29 -0
- package/src/DeltaBundler/Transformer.d.ts +45 -0
- package/src/DeltaBundler/Worker.d.ts +44 -0
- package/src/DeltaBundler/WorkerFarm.d.ts +77 -0
- package/src/DeltaBundler/buildSubgraph.d.ts +37 -0
- package/src/DeltaBundler/getTransformCacheKey.d.ts +25 -0
- package/src/DeltaBundler/getTransformCacheKey.js +3 -1
- package/src/DeltaBundler/getTransformCacheKey.js.flow +7 -2
- package/src/DeltaBundler/mergeDeltas.d.ts +24 -0
- package/src/DeltaBundler/types.d.ts +170 -0
- package/src/DeltaBundler.d.ts +67 -0
- package/src/HmrServer.d.ts +98 -0
- package/src/HmrServer.js +7 -0
- package/src/HmrServer.js.flow +15 -5
- package/src/IncrementalBundler/GraphNotFoundError.d.ts +24 -0
- package/src/IncrementalBundler/ResourceNotFoundError.d.ts +22 -0
- package/src/IncrementalBundler/RevisionNotFoundError.d.ts +24 -0
- package/src/IncrementalBundler.d.ts +103 -0
- package/src/ModuleGraph/worker/JsFileWrapping.d.ts +36 -0
- package/src/ModuleGraph/worker/collectDependencies.d.ts +138 -0
- package/src/ModuleGraph/worker/generateImportNames.d.ts +26 -0
- package/src/ModuleGraph/worker/importLocationsPlugin.d.ts +33 -0
- package/src/Server/MultipartResponse.d.ts +37 -0
- package/src/Server/symbolicate.d.ts +38 -0
- package/src/Server.d.ts +278 -0
- package/src/cli/parseKeyValueParamArray.d.ts +21 -0
- package/src/cli-utils.d.ts +26 -0
- package/src/commands/build.d.ts +23 -0
- package/src/commands/dependencies.d.ts +23 -0
- package/src/commands/serve.d.ts +23 -0
- package/src/index.d.ts +206 -0
- package/src/index.flow.js.flow +21 -2
- package/src/lib/BatchProcessor.d.ts +61 -0
- package/src/lib/CountingSet.d.ts +55 -0
- package/src/lib/JsonReporter.d.ts +44 -0
- package/src/lib/JsonReporter.js.flow +2 -2
- package/src/lib/RamBundleParser.d.ts +36 -0
- package/src/lib/TerminalReporter.d.ts +125 -0
- package/src/lib/bundleProgressUtils.d.ts +33 -0
- package/src/lib/bundleToString.d.ts +26 -0
- package/src/lib/contextModule.d.ts +40 -0
- package/src/lib/contextModuleTemplates.d.ts +32 -0
- package/src/lib/countLines.d.ts +19 -0
- package/src/lib/createWebsocketServer.d.ts +50 -0
- package/src/lib/debounceAsyncQueue.d.ts +22 -0
- package/src/lib/formatBundlingError.d.ts +30 -0
- package/src/lib/getAppendScripts.d.ts +38 -0
- package/src/lib/getAppendScripts.js.flow +2 -2
- package/src/lib/getGraphId.d.ts +32 -0
- package/src/lib/getPreludeCode.d.ts +25 -0
- package/src/lib/getPrependedScripts.d.ts +31 -0
- package/src/lib/isResolvedDependency.d.ts +22 -0
- package/src/lib/logToConsole.d.ts +26 -0
- package/src/lib/parseBundleOptionsFromBundleRequestUrl.d.ts +24 -0
- package/src/lib/parseCustomResolverOptions.d.ts +23 -0
- package/src/lib/parseCustomTransformOptions.d.ts +23 -0
- package/src/lib/parseJsonBody.d.ts +34 -0
- package/src/lib/pathUtils.d.ts +21 -0
- package/src/lib/relativizeSourceMap.d.ts +24 -0
- package/src/lib/reporting.d.ts +135 -0
- package/src/lib/splitBundleOptions.d.ts +23 -0
- package/src/lib/transformHelpers.d.ts +42 -0
- package/src/node-haste/DependencyGraph/ModuleResolution.d.ts +120 -0
- package/src/node-haste/DependencyGraph/ModuleResolution.js +4 -22
- package/src/node-haste/DependencyGraph/ModuleResolution.js.flow +10 -59
- package/src/node-haste/DependencyGraph/createFileMap.d.ts +36 -0
- package/src/node-haste/DependencyGraph/createFileMap.js +1 -1
- package/src/node-haste/DependencyGraph/createFileMap.js.flow +4 -2
- package/src/node-haste/DependencyGraph.d.ts +90 -0
- package/src/node-haste/DependencyGraph.js +22 -11
- package/src/node-haste/DependencyGraph.js.flow +24 -13
- package/src/node-haste/PackageCache.d.ts +37 -0
- package/src/node-haste/PackageCache.js +65 -54
- package/src/node-haste/PackageCache.js.flow +103 -79
- package/src/node-haste/lib/AssetPaths.d.ts +36 -0
- package/src/node-haste/lib/parsePlatformFilePath.d.ts +32 -0
- package/src/shared/output/RamBundle/as-assets.d.ts +32 -0
- package/src/shared/output/RamBundle/as-indexed-file.d.ts +45 -0
- package/src/shared/output/RamBundle/buildSourcemapWithMetadata.d.ts +30 -0
- package/src/shared/output/RamBundle/magic-number.d.ts +21 -0
- package/src/shared/output/RamBundle/util.d.ts +48 -0
- package/src/shared/output/RamBundle/write-sourcemap.d.ts +23 -0
- package/src/shared/output/RamBundle.d.ts +33 -0
- package/src/shared/output/bundle.d.ts +34 -0
- package/src/shared/output/meta.d.ts +22 -0
- package/src/shared/output/unbundle.d.ts +18 -0
- package/src/shared/output/writeFile.d.ts +23 -0
- package/src/shared/types.d.ts +152 -0
- package/src/node-haste/Package.js +0 -28
- package/src/node-haste/Package.js.flow +0 -39
|
@@ -9,117 +9,141 @@
|
|
|
9
9
|
* @oncall react_native
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import
|
|
12
|
+
import type {PackageJson} from 'metro-resolver/private/types';
|
|
13
|
+
|
|
14
|
+
import {readFileSync} from 'fs';
|
|
15
|
+
import {dirname, sep} from 'path';
|
|
13
16
|
|
|
14
17
|
type GetClosestPackageFn = (absoluteFilePath: string) => ?{
|
|
15
18
|
packageJsonPath: string,
|
|
16
19
|
packageRelativePath: string,
|
|
17
20
|
};
|
|
18
21
|
|
|
22
|
+
type PackageForModule = Readonly<{
|
|
23
|
+
packageJson: PackageJson,
|
|
24
|
+
rootPath: string,
|
|
25
|
+
packageRelativePath: string,
|
|
26
|
+
}>;
|
|
27
|
+
|
|
19
28
|
export class PackageCache {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
// Cache for "closest package.json" queries by module path.
|
|
27
|
-
_packagePathAndSubpathByModulePath: {
|
|
28
|
-
[filePath: string]: ?{
|
|
29
|
-
packageJsonPath: string,
|
|
30
|
-
packageRelativePath: string,
|
|
29
|
+
#getClosestPackage: GetClosestPackageFn;
|
|
30
|
+
#packageCache: Map<
|
|
31
|
+
string,
|
|
32
|
+
{
|
|
33
|
+
rootPath: string,
|
|
34
|
+
packageJson: PackageJson,
|
|
31
35
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
...
|
|
40
|
-
};
|
|
36
|
+
>;
|
|
37
|
+
// Single cache: module path → pre-built result object, or null (no allocation on hit)
|
|
38
|
+
#resultByModulePath: Map<string, PackageForModule | null>;
|
|
39
|
+
// Reverse index for invalidation: package.json path → set of module paths
|
|
40
|
+
#modulePathsByPackagePath: Map<string, Set<string>>;
|
|
41
|
+
// Module paths that resolved to no package.json (null), for invalidation
|
|
42
|
+
#modulePathsWithNoPackage: Set<string>;
|
|
41
43
|
|
|
42
44
|
constructor(options: {getClosestPackage: GetClosestPackageFn, ...}) {
|
|
43
|
-
this
|
|
44
|
-
this
|
|
45
|
-
this
|
|
46
|
-
this
|
|
45
|
+
this.#getClosestPackage = options.getClosestPackage;
|
|
46
|
+
this.#packageCache = new Map();
|
|
47
|
+
this.#resultByModulePath = new Map();
|
|
48
|
+
this.#modulePathsByPackagePath = new Map();
|
|
49
|
+
this.#modulePathsWithNoPackage = new Set();
|
|
47
50
|
}
|
|
48
51
|
|
|
49
|
-
getPackage(filePath: string):
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
getPackage(filePath: string): Readonly<{
|
|
53
|
+
rootPath: string,
|
|
54
|
+
packageJson: PackageJson,
|
|
55
|
+
}> {
|
|
56
|
+
let cached = this.#packageCache.get(filePath);
|
|
57
|
+
if (cached == null) {
|
|
58
|
+
cached = {
|
|
59
|
+
rootPath: dirname(filePath),
|
|
60
|
+
packageJson: JSON.parse(readFileSync(filePath, 'utf8')),
|
|
61
|
+
};
|
|
62
|
+
this.#packageCache.set(filePath, cached);
|
|
54
63
|
}
|
|
55
|
-
return
|
|
64
|
+
return cached;
|
|
56
65
|
}
|
|
57
66
|
|
|
58
|
-
|
|
59
|
-
absoluteModulePath
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
) {
|
|
67
|
-
return {
|
|
68
|
-
pkg: this._packageCache[packagePathAndSubpath.packageJsonPath],
|
|
69
|
-
packageRelativePath: packagePathAndSubpath.packageRelativePath,
|
|
70
|
-
};
|
|
67
|
+
getPackageForModule(absoluteModulePath: string): ?PackageForModule {
|
|
68
|
+
const cached = this.#resultByModulePath.get(absoluteModulePath);
|
|
69
|
+
|
|
70
|
+
// Distinguish between `null` (positively no closest package) and
|
|
71
|
+
// `undefined` (no cached result yet)
|
|
72
|
+
// eslint-disable-next-line lint/strictly-null
|
|
73
|
+
if (cached !== undefined) {
|
|
74
|
+
return cached;
|
|
71
75
|
}
|
|
72
76
|
|
|
73
|
-
|
|
74
|
-
if (
|
|
77
|
+
const closest = this.#getClosestPackage(absoluteModulePath);
|
|
78
|
+
if (closest == null) {
|
|
79
|
+
this.#resultByModulePath.set(absoluteModulePath, null);
|
|
80
|
+
this.#modulePathsWithNoPackage.add(absoluteModulePath);
|
|
75
81
|
return null;
|
|
76
82
|
}
|
|
77
83
|
|
|
78
|
-
const packagePath =
|
|
84
|
+
const packagePath = closest.packageJsonPath;
|
|
79
85
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
86
|
+
// Track module→package for invalidation
|
|
87
|
+
let modulePaths = this.#modulePathsByPackagePath.get(packagePath);
|
|
88
|
+
if (modulePaths == null) {
|
|
89
|
+
modulePaths = new Set();
|
|
90
|
+
this.#modulePathsByPackagePath.set(packagePath, modulePaths);
|
|
91
|
+
}
|
|
84
92
|
modulePaths.add(absoluteModulePath);
|
|
85
|
-
this._modulePathsByPackagePath[packagePath] = modulePaths;
|
|
86
93
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
94
|
+
const pkg = this.getPackage(packagePath);
|
|
95
|
+
if (pkg == null) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Cache the pre-built result object — no allocation on future hits
|
|
100
|
+
const result: PackageForModule = {
|
|
101
|
+
packageJson: pkg.packageJson,
|
|
102
|
+
packageRelativePath: closest.packageRelativePath,
|
|
103
|
+
rootPath: pkg.rootPath,
|
|
90
104
|
};
|
|
105
|
+
this.#resultByModulePath.set(absoluteModulePath, result);
|
|
106
|
+
return result;
|
|
91
107
|
}
|
|
92
108
|
|
|
93
109
|
invalidate(filePath: string) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
delete this._modulePathsByPackagePath[packagePath];
|
|
110
|
+
this.#packageCache.delete(filePath);
|
|
111
|
+
|
|
112
|
+
// Clean up any cached result for this module path (including null).
|
|
113
|
+
// Derive the package.json path from the cached result to clean up the
|
|
114
|
+
// reverse index.
|
|
115
|
+
const cachedResult = this.#resultByModulePath.get(filePath);
|
|
116
|
+
this.#resultByModulePath.delete(filePath);
|
|
117
|
+
this.#modulePathsWithNoPackage.delete(filePath);
|
|
118
|
+
|
|
119
|
+
if (cachedResult != null) {
|
|
120
|
+
const packagePath = cachedResult.rootPath + sep + 'package.json';
|
|
121
|
+
const modules = this.#modulePathsByPackagePath.get(packagePath);
|
|
122
|
+
if (modules != null) {
|
|
123
|
+
modules.delete(filePath);
|
|
124
|
+
if (modules.size === 0) {
|
|
125
|
+
this.#modulePathsByPackagePath.delete(packagePath);
|
|
111
126
|
}
|
|
112
127
|
}
|
|
113
128
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
129
|
+
|
|
130
|
+
// If filePath is a package.json, invalidate all module lookups pointing to it
|
|
131
|
+
const modulePaths = this.#modulePathsByPackagePath.get(filePath);
|
|
132
|
+
if (modulePaths != null) {
|
|
118
133
|
for (const modulePath of modulePaths) {
|
|
119
|
-
|
|
134
|
+
this.#resultByModulePath.delete(modulePath);
|
|
135
|
+
}
|
|
136
|
+
this.#modulePathsByPackagePath.delete(filePath);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// If a package.json was created, modified, or deleted, invalidate all
|
|
140
|
+
// null-cached module results, since modules that previously had no
|
|
141
|
+
// enclosing package.json may now resolve to this one.
|
|
142
|
+
if (filePath.endsWith(sep + 'package.json')) {
|
|
143
|
+
for (const modulePath of this.#modulePathsWithNoPackage) {
|
|
144
|
+
this.#resultByModulePath.delete(modulePath);
|
|
120
145
|
}
|
|
121
|
-
|
|
122
|
-
delete this._modulePathsByPackagePath[filePath];
|
|
146
|
+
this.#modulePathsWithNoPackage.clear();
|
|
123
147
|
}
|
|
124
148
|
}
|
|
125
149
|
}
|
|
@@ -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;
|
|
@@ -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
|
+
* @noformat
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
* @generated SignedSource<<17ae3fc242dc6b3915a72d04dad032b8>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro/src/shared/output/meta.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 meta(
|
|
19
|
+
code: Buffer | string,
|
|
20
|
+
encoding?: 'ascii' | 'utf16le' | 'utf8',
|
|
21
|
+
): Buffer;
|
|
22
|
+
export default meta;
|
|
@@ -0,0 +1,18 @@
|
|
|
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<<12b27507f799c8170067738c227bb2f3>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro/src/shared/output/unbundle.js
|
|
13
|
+
* To regenerate, run:
|
|
14
|
+
* js1 build metro-ts-defs (internal) OR
|
|
15
|
+
* yarn run build-ts-defs (OSS)
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
export * from './RamBundle';
|
|
@@ -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<<37de849e415f8aa1e94b73289a573ee3>>
|
|
10
|
+
*
|
|
11
|
+
* This file was translated from Flow by scripts/generateTypeScriptDefinitions.js
|
|
12
|
+
* Original file: packages/metro/src/shared/output/writeFile.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 writeFile(
|
|
19
|
+
filePath: string,
|
|
20
|
+
data: string | Buffer | Uint8Array,
|
|
21
|
+
encoding?: string,
|
|
22
|
+
): Promise<void>;
|
|
23
|
+
export default writeFile;
|