metro 0.83.4 → 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 +17 -15
- package/src/Assets.d.ts +83 -0
- package/src/Assets.js +2 -9
- package/src/Bundler/util.d.ts +27 -0
- package/src/Bundler/util.js +2 -9
- package/src/Bundler.d.ts +38 -0
- package/src/Bundler.js +1 -5
- package/src/DeltaBundler/DeltaCalculator.d.ts +71 -0
- package/src/DeltaBundler/DeltaCalculator.js +1 -5
- package/src/DeltaBundler/Graph.d.ts +167 -0
- package/src/DeltaBundler/Graph.js +1 -5
- package/src/DeltaBundler/Serializers/baseJSBundle.d.ts +20 -0
- package/src/DeltaBundler/Serializers/baseJSBundle.js +1 -5
- package/src/DeltaBundler/Serializers/getAllFiles.d.ts +22 -0
- package/src/DeltaBundler/Serializers/getAssets.d.ts +25 -0
- package/src/DeltaBundler/Serializers/getAssets.js +1 -5
- package/src/DeltaBundler/Serializers/getExplodedSourceMap.d.ts +26 -0
- package/src/DeltaBundler/Serializers/getRamBundleInfo.d.ts +48 -0
- package/src/DeltaBundler/Serializers/getRamBundleInfo.js +1 -5
- 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 +2 -9
- package/src/DeltaBundler/Serializers/helpers/processModules.d.ts +25 -0
- package/src/DeltaBundler/Serializers/hmrJSBundle.d.ts +30 -0
- package/src/DeltaBundler/Serializers/hmrJSBundle.js +2 -9
- package/src/DeltaBundler/Serializers/sourceMapGenerator.d.ts +29 -0
- package/src/DeltaBundler/Serializers/sourceMapGenerator.js +1 -5
- package/src/DeltaBundler/Serializers/sourceMapObject.d.ts +23 -0
- package/src/DeltaBundler/Serializers/sourceMapString.d.ts +22 -0
- package/src/DeltaBundler/Transformer.d.ts +38 -0
- package/src/DeltaBundler/Transformer.js +1 -5
- package/src/DeltaBundler/Worker.d.ts +37 -0
- package/src/DeltaBundler/Worker.flow.js +1 -5
- package/src/DeltaBundler/WorkerFarm.d.ts +70 -0
- package/src/DeltaBundler/buildSubgraph.d.ts +30 -0
- package/src/DeltaBundler/buildSubgraph.js +1 -5
- package/src/DeltaBundler/getTransformCacheKey.d.ts +18 -0
- package/src/DeltaBundler/getTransformCacheKey.js +1 -5
- package/src/DeltaBundler/mergeDeltas.d.ts +17 -0
- package/src/DeltaBundler/types.d.ts +163 -0
- package/src/DeltaBundler/types.js +1 -5
- package/src/DeltaBundler.d.ts +60 -0
- package/src/DeltaBundler.js +1 -5
- package/src/HmrServer.d.ts +79 -0
- package/src/HmrServer.js +2 -9
- 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 +96 -0
- package/src/IncrementalBundler.js +2 -9
- package/src/ModuleGraph/worker/JsFileWrapping.d.ts +29 -0
- package/src/ModuleGraph/worker/JsFileWrapping.js +2 -9
- package/src/ModuleGraph/worker/collectDependencies.d.ts +131 -0
- package/src/ModuleGraph/worker/collectDependencies.js +2 -9
- package/src/ModuleGraph/worker/generateImportNames.d.ts +19 -0
- package/src/ModuleGraph/worker/generateImportNames.js +1 -5
- package/src/ModuleGraph/worker/importLocationsPlugin.d.ts +26 -0
- package/src/Server/MultipartResponse.d.ts +30 -0
- package/src/Server/MultipartResponse.js +1 -5
- package/src/Server/symbolicate.d.ts +31 -0
- package/src/Server.d.ts +271 -0
- package/src/Server.js +47 -15
- package/src/Server.js.flow +57 -10
- package/src/cli/parseKeyValueParamArray.d.ts +14 -0
- package/src/cli-utils.d.ts +19 -0
- package/src/cli-utils.js +1 -5
- package/src/commands/build.d.ts +16 -0
- package/src/commands/build.js +1 -5
- package/src/commands/dependencies.d.ts +16 -0
- package/src/commands/dependencies.js +1 -5
- package/src/commands/serve.d.ts +16 -0
- package/src/index.d.ts +180 -0
- package/src/index.flow.js +26 -19
- package/src/index.flow.js.flow +25 -10
- package/src/integration_tests/basic_bundle/build-errors/cannot-resolve-import.js +1 -5
- package/src/integration_tests/basic_bundle/build-errors/inline-requires-cannot-resolve-import.js +1 -5
- package/src/integration_tests/basic_bundle/import-export/index.js +2 -9
- package/src/integration_tests/execBundle.js +1 -5
- package/src/lib/BatchProcessor.d.ts +54 -0
- package/src/lib/BatchProcessor.js +1 -5
- package/src/lib/CountingSet.d.ts +48 -0
- package/src/lib/JsonReporter.d.ts +37 -0
- package/src/lib/RamBundleParser.d.ts +29 -0
- package/src/lib/RamBundleParser.js +1 -5
- package/src/lib/TerminalReporter.d.ts +118 -0
- package/src/lib/TerminalReporter.js +8 -16
- package/src/lib/TerminalReporter.js.flow +6 -15
- 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 +33 -0
- package/src/lib/contextModule.js +1 -5
- package/src/lib/contextModuleTemplates.d.ts +25 -0
- package/src/lib/contextModuleTemplates.js +1 -4
- package/src/lib/countLines.d.ts +12 -0
- package/src/lib/createWebsocketServer.d.ts +43 -0
- package/src/lib/createWebsocketServer.js +1 -5
- package/src/lib/debounceAsyncQueue.d.ts +15 -0
- package/src/lib/formatBundlingError.d.ts +23 -0
- package/src/lib/formatBundlingError.js +1 -5
- package/src/lib/getAppendScripts.d.ts +31 -0
- package/src/lib/getAppendScripts.js +1 -5
- package/src/lib/getGraphId.d.ts +25 -0
- package/src/lib/getGraphId.js +1 -5
- package/src/lib/getPreludeCode.d.ts +18 -0
- package/src/lib/getPrependedScripts.d.ts +24 -0
- package/src/lib/getPrependedScripts.js +2 -9
- package/src/lib/isResolvedDependency.d.ts +15 -0
- package/src/lib/logToConsole.d.ts +19 -0
- package/src/lib/logToConsole.js +1 -5
- package/src/lib/parseBundleOptionsFromBundleRequestUrl.d.ts +17 -0
- package/src/lib/parseBundleOptionsFromBundleRequestUrl.js +2 -9
- package/src/lib/parseCustomResolverOptions.d.ts +16 -0
- package/src/lib/parseCustomTransformOptions.d.ts +16 -0
- package/src/lib/parseJsonBody.d.ts +27 -0
- package/src/lib/pathUtils.d.ts +14 -0
- package/src/lib/pathUtils.js +1 -4
- package/src/lib/relativizeSourceMap.d.ts +17 -0
- package/src/lib/relativizeSourceMap.js +1 -5
- package/src/lib/reporting.d.ts +128 -0
- package/src/lib/reporting.js +1 -5
- package/src/lib/splitBundleOptions.d.ts +16 -0
- package/src/lib/transformHelpers.d.ts +35 -0
- package/src/lib/transformHelpers.js +1 -5
- package/src/node-haste/DependencyGraph/ModuleResolution.d.ts +126 -0
- package/src/node-haste/DependencyGraph/ModuleResolution.js +2 -9
- package/src/node-haste/DependencyGraph/createFileMap.d.ts +29 -0
- package/src/node-haste/DependencyGraph/createFileMap.js +2 -9
- package/src/node-haste/DependencyGraph.d.ts +86 -0
- package/src/node-haste/DependencyGraph.js +1 -5
- package/src/node-haste/Package.d.ts +21 -0
- package/src/node-haste/Package.js +1 -5
- package/src/node-haste/PackageCache.d.ts +34 -0
- package/src/node-haste/PackageCache.js +1 -5
- package/src/node-haste/lib/AssetPaths.d.ts +29 -0
- package/src/node-haste/lib/AssetPaths.js +1 -5
- package/src/node-haste/lib/parsePlatformFilePath.d.ts +25 -0
- package/src/node-haste/lib/parsePlatformFilePath.js +1 -5
- package/src/shared/output/RamBundle/as-assets.d.ts +25 -0
- package/src/shared/output/RamBundle/as-assets.js +1 -5
- package/src/shared/output/RamBundle/as-indexed-file.d.ts +38 -0
- package/src/shared/output/RamBundle/as-indexed-file.js +1 -5
- package/src/shared/output/RamBundle/buildSourcemapWithMetadata.d.ts +23 -0
- 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 +1 -5
- package/src/shared/output/RamBundle/write-sourcemap.d.ts +16 -0
- package/src/shared/output/RamBundle/write-sourcemap.js +1 -5
- package/src/shared/output/RamBundle.d.ts +26 -0
- package/src/shared/output/RamBundle.js +1 -5
- package/src/shared/output/bundle.d.ts +27 -0
- package/src/shared/output/bundle.flow.js +1 -5
- package/src/shared/output/meta.d.ts +15 -0
- package/src/shared/output/meta.js +1 -5
- package/src/shared/output/unbundle.d.ts +11 -0
- package/src/shared/output/writeFile.d.ts +16 -0
- package/src/shared/output/writeFile.js +1 -5
- package/src/shared/types.d.ts +145 -0
|
@@ -0,0 +1,126 @@
|
|
|
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 {
|
|
12
|
+
BundlerResolution,
|
|
13
|
+
TransformResultDependency,
|
|
14
|
+
} from '../../DeltaBundler/types';
|
|
15
|
+
import type {Reporter} from '../../lib/reporting';
|
|
16
|
+
import type {ResolverInputOptions} from '../../shared/types';
|
|
17
|
+
import type {
|
|
18
|
+
CustomResolver,
|
|
19
|
+
DoesFileExist,
|
|
20
|
+
FileCandidates,
|
|
21
|
+
FileSystemLookup,
|
|
22
|
+
Resolution,
|
|
23
|
+
ResolveAsset,
|
|
24
|
+
} from 'metro-resolver';
|
|
25
|
+
import type {PackageForModule, PackageJson} from 'metro-resolver/private/types';
|
|
26
|
+
|
|
27
|
+
export type DirExistsFn = (filePath: string) => boolean;
|
|
28
|
+
export type Packageish = {path: string; read(): PackageJson};
|
|
29
|
+
export type Moduleish = {readonly path: string};
|
|
30
|
+
export type PackageishCache<TPackage> = {
|
|
31
|
+
getPackage(
|
|
32
|
+
name: string,
|
|
33
|
+
platform?: string,
|
|
34
|
+
supportsNativePlatform?: boolean,
|
|
35
|
+
): TPackage;
|
|
36
|
+
getPackageOf(
|
|
37
|
+
absolutePath: string,
|
|
38
|
+
): null | undefined | {pkg: TPackage; packageRelativePath: string};
|
|
39
|
+
};
|
|
40
|
+
type Options<TPackage> = Readonly<{
|
|
41
|
+
assetExts: ReadonlySet<string>;
|
|
42
|
+
dirExists: DirExistsFn;
|
|
43
|
+
disableHierarchicalLookup: boolean;
|
|
44
|
+
doesFileExist: DoesFileExist;
|
|
45
|
+
emptyModulePath: string;
|
|
46
|
+
extraNodeModules: null | undefined | object;
|
|
47
|
+
fileSystemLookup: FileSystemLookup;
|
|
48
|
+
getHasteModulePath: (
|
|
49
|
+
name: string,
|
|
50
|
+
platform: null | undefined | string,
|
|
51
|
+
) => null | undefined | string;
|
|
52
|
+
getHastePackagePath: (
|
|
53
|
+
name: string,
|
|
54
|
+
platform: null | undefined | string,
|
|
55
|
+
) => null | undefined | string;
|
|
56
|
+
mainFields: ReadonlyArray<string>;
|
|
57
|
+
packageCache: PackageishCache<TPackage>;
|
|
58
|
+
nodeModulesPaths: ReadonlyArray<string>;
|
|
59
|
+
preferNativePlatform: boolean;
|
|
60
|
+
projectRoot: string;
|
|
61
|
+
reporter: Reporter;
|
|
62
|
+
resolveAsset: ResolveAsset;
|
|
63
|
+
resolveRequest: null | undefined | CustomResolver;
|
|
64
|
+
sourceExts: ReadonlyArray<string>;
|
|
65
|
+
unstable_conditionNames: ReadonlyArray<string>;
|
|
66
|
+
unstable_conditionsByPlatform: Readonly<{
|
|
67
|
+
[platform: string]: ReadonlyArray<string>;
|
|
68
|
+
}>;
|
|
69
|
+
unstable_enablePackageExports: boolean;
|
|
70
|
+
unstable_incrementalResolution: boolean;
|
|
71
|
+
}>;
|
|
72
|
+
export declare class ModuleResolver<TPackage extends Packageish> {
|
|
73
|
+
_options: Options<TPackage>;
|
|
74
|
+
_projectRootFakeModulePath: string;
|
|
75
|
+
_cachedEmptyModule: null | undefined | BundlerResolution;
|
|
76
|
+
constructor(options: Options<TPackage>);
|
|
77
|
+
_getEmptyModule(): BundlerResolution;
|
|
78
|
+
resolveDependency(
|
|
79
|
+
originModulePath: string,
|
|
80
|
+
dependency: TransformResultDependency,
|
|
81
|
+
allowHaste: boolean,
|
|
82
|
+
platform: string | null,
|
|
83
|
+
resolverOptions: ResolverInputOptions,
|
|
84
|
+
): BundlerResolution;
|
|
85
|
+
_getPackage: (packageJsonPath: string) => null | undefined | PackageJson;
|
|
86
|
+
_getPackageForModule: (
|
|
87
|
+
absolutePath: string,
|
|
88
|
+
) => null | undefined | PackageForModule;
|
|
89
|
+
/**
|
|
90
|
+
* TODO: Return Resolution instead of coercing to BundlerResolution here
|
|
91
|
+
*/
|
|
92
|
+
_getFileResolvedModule(resolution: Resolution): BundlerResolution;
|
|
93
|
+
_logWarning: (message: string) => void;
|
|
94
|
+
_removeRoot(candidates: FileCandidates): FileCandidates;
|
|
95
|
+
}
|
|
96
|
+
export declare class UnableToResolveError extends Error {
|
|
97
|
+
/**
|
|
98
|
+
* File path of the module that tried to require a module, ex. `/js/foo.js`.
|
|
99
|
+
*/
|
|
100
|
+
originModulePath: string;
|
|
101
|
+
/**
|
|
102
|
+
* The name of the module that was required, no necessarily a path,
|
|
103
|
+
* ex. `./bar`, or `invariant`.
|
|
104
|
+
*/
|
|
105
|
+
targetModuleName: string;
|
|
106
|
+
/**
|
|
107
|
+
* Original error that causes this error
|
|
108
|
+
*/
|
|
109
|
+
cause: null | undefined | Error;
|
|
110
|
+
/**
|
|
111
|
+
* Fixed type field in common with other Metro build errors.
|
|
112
|
+
*/
|
|
113
|
+
readonly type: 'UnableToResolveError';
|
|
114
|
+
constructor(
|
|
115
|
+
originModulePath: string,
|
|
116
|
+
targetModuleName: string,
|
|
117
|
+
message: string,
|
|
118
|
+
options?: Readonly<{
|
|
119
|
+
dependency?: null | undefined | TransformResultDependency;
|
|
120
|
+
cause?: Error;
|
|
121
|
+
}>,
|
|
122
|
+
);
|
|
123
|
+
buildCodeFrameMessage(
|
|
124
|
+
dependency: null | undefined | TransformResultDependency,
|
|
125
|
+
): null | undefined | string;
|
|
126
|
+
}
|
|
@@ -21,10 +21,7 @@ function _interopRequireWildcard(e, t) {
|
|
|
21
21
|
if (!t && e && e.__esModule) return e;
|
|
22
22
|
var o,
|
|
23
23
|
i,
|
|
24
|
-
f = {
|
|
25
|
-
__proto__: null,
|
|
26
|
-
default: e,
|
|
27
|
-
};
|
|
24
|
+
f = { __proto__: null, default: e };
|
|
28
25
|
if (null === e || ("object" != typeof e && "function" != typeof e))
|
|
29
26
|
return f;
|
|
30
27
|
if ((o = t ? n : r)) {
|
|
@@ -44,11 +41,7 @@ function _interopRequireWildcard(e, t) {
|
|
|
44
41
|
})(e, t);
|
|
45
42
|
}
|
|
46
43
|
function _interopRequireDefault(e) {
|
|
47
|
-
return e && e.__esModule
|
|
48
|
-
? e
|
|
49
|
-
: {
|
|
50
|
-
default: e,
|
|
51
|
-
};
|
|
44
|
+
return e && e.__esModule ? e : { default: e };
|
|
52
45
|
}
|
|
53
46
|
class ModuleResolver {
|
|
54
47
|
constructor(options) {
|
|
@@ -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
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {ConfigT} from 'metro-config';
|
|
12
|
+
import type {HasteMap} from 'metro-file-map';
|
|
13
|
+
|
|
14
|
+
import MetroFileMap, {DependencyPlugin} from 'metro-file-map';
|
|
15
|
+
|
|
16
|
+
declare function createFileMap(
|
|
17
|
+
config: ConfigT,
|
|
18
|
+
options?: Readonly<{
|
|
19
|
+
extractDependencies?: boolean;
|
|
20
|
+
watch?: boolean;
|
|
21
|
+
throwOnModuleCollision?: boolean;
|
|
22
|
+
cacheFilePrefix?: string;
|
|
23
|
+
}>,
|
|
24
|
+
): {
|
|
25
|
+
fileMap: MetroFileMap;
|
|
26
|
+
hasteMap: HasteMap;
|
|
27
|
+
dependencyPlugin: null | undefined | DependencyPlugin;
|
|
28
|
+
};
|
|
29
|
+
export default createFileMap;
|
|
@@ -14,10 +14,7 @@ function _interopRequireWildcard(e, t) {
|
|
|
14
14
|
if (!t && e && e.__esModule) return e;
|
|
15
15
|
var o,
|
|
16
16
|
i,
|
|
17
|
-
f = {
|
|
18
|
-
__proto__: null,
|
|
19
|
-
default: e,
|
|
20
|
-
};
|
|
17
|
+
f = { __proto__: null, default: e };
|
|
21
18
|
if (null === e || ("object" != typeof e && "function" != typeof e))
|
|
22
19
|
return f;
|
|
23
20
|
if ((o = t ? n : r)) {
|
|
@@ -37,11 +34,7 @@ function _interopRequireWildcard(e, t) {
|
|
|
37
34
|
})(e, t);
|
|
38
35
|
}
|
|
39
36
|
function _interopRequireDefault(e) {
|
|
40
|
-
return e && e.__esModule
|
|
41
|
-
? e
|
|
42
|
-
: {
|
|
43
|
-
default: e,
|
|
44
|
-
};
|
|
37
|
+
return e && e.__esModule ? e : { default: e };
|
|
45
38
|
}
|
|
46
39
|
function getIgnorePattern(config) {
|
|
47
40
|
const { blockList, blacklistRE } = config.resolver;
|
|
@@ -0,0 +1,86 @@
|
|
|
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 {
|
|
12
|
+
BundlerResolution,
|
|
13
|
+
TransformResultDependency,
|
|
14
|
+
} from '../DeltaBundler/types';
|
|
15
|
+
import type {ResolverInputOptions} from '../shared/types';
|
|
16
|
+
import type Package from './Package';
|
|
17
|
+
import type {ConfigT} from 'metro-config';
|
|
18
|
+
import type {
|
|
19
|
+
ChangeEvent,
|
|
20
|
+
FileSystem,
|
|
21
|
+
HasteMap,
|
|
22
|
+
HealthCheckResult,
|
|
23
|
+
WatcherStatus,
|
|
24
|
+
default as MetroFileMap,
|
|
25
|
+
} from 'metro-file-map';
|
|
26
|
+
|
|
27
|
+
import {ModuleResolver} from './DependencyGraph/ModuleResolution';
|
|
28
|
+
import {PackageCache} from './PackageCache';
|
|
29
|
+
import EventEmitter from 'events';
|
|
30
|
+
|
|
31
|
+
declare class DependencyGraph extends EventEmitter {
|
|
32
|
+
_config: ConfigT;
|
|
33
|
+
_haste: MetroFileMap;
|
|
34
|
+
_fileSystem: FileSystem;
|
|
35
|
+
_hasteMap: HasteMap;
|
|
36
|
+
_moduleResolver: ModuleResolver<Package>;
|
|
37
|
+
_resolutionCache: Map<
|
|
38
|
+
string | symbol,
|
|
39
|
+
Map<
|
|
40
|
+
string | symbol,
|
|
41
|
+
Map<string | symbol, Map<string | symbol, BundlerResolution>>
|
|
42
|
+
>
|
|
43
|
+
>;
|
|
44
|
+
_initializedPromise: Promise<void>;
|
|
45
|
+
constructor(
|
|
46
|
+
config: ConfigT,
|
|
47
|
+
options?: {
|
|
48
|
+
readonly hasReducedPerformance?: boolean;
|
|
49
|
+
readonly watch?: boolean;
|
|
50
|
+
},
|
|
51
|
+
);
|
|
52
|
+
_onWatcherHealthCheck(result: HealthCheckResult): void;
|
|
53
|
+
_onWatcherStatus(status: WatcherStatus): void;
|
|
54
|
+
ready(): Promise<void>;
|
|
55
|
+
_onHasteChange($$PARAM_0$$: ChangeEvent): void;
|
|
56
|
+
_createModuleResolver(): void;
|
|
57
|
+
_getClosestPackage(
|
|
58
|
+
absoluteModulePath: string,
|
|
59
|
+
): null | undefined | {packageJsonPath: string; packageRelativePath: string};
|
|
60
|
+
_createPackageCache(): PackageCache;
|
|
61
|
+
getAllFiles(): Array<string>;
|
|
62
|
+
/**
|
|
63
|
+
* Used when watcher.unstable_lazySha1 is true
|
|
64
|
+
*/
|
|
65
|
+
getOrComputeSha1(
|
|
66
|
+
mixedPath: string,
|
|
67
|
+
): Promise<{content?: Buffer; sha1: string}>;
|
|
68
|
+
getWatcher(): EventEmitter;
|
|
69
|
+
end(): void;
|
|
70
|
+
/** Given a search context, return a list of file paths matching the query. */
|
|
71
|
+
matchFilesWithContext(
|
|
72
|
+
from: string,
|
|
73
|
+
context: Readonly<{recursive: boolean; filter: RegExp}>,
|
|
74
|
+
): Iterable<string>;
|
|
75
|
+
resolveDependency(
|
|
76
|
+
originModulePath: string,
|
|
77
|
+
dependency: TransformResultDependency,
|
|
78
|
+
platform: string | null,
|
|
79
|
+
resolverOptions: ResolverInputOptions,
|
|
80
|
+
$$PARAM_4$$?: {assumeFlatNodeModules: boolean},
|
|
81
|
+
): BundlerResolution;
|
|
82
|
+
doesFileExist: (filePath: string) => boolean;
|
|
83
|
+
getHasteName(filePath: string): string;
|
|
84
|
+
getDependencies(filePath: string): Array<string>;
|
|
85
|
+
}
|
|
86
|
+
export default DependencyGraph;
|
|
@@ -20,11 +20,7 @@ var _metroResolver = require("metro-resolver");
|
|
|
20
20
|
var _nullthrows = _interopRequireDefault(require("nullthrows"));
|
|
21
21
|
var _path = _interopRequireDefault(require("path"));
|
|
22
22
|
function _interopRequireDefault(e) {
|
|
23
|
-
return e && e.__esModule
|
|
24
|
-
? e
|
|
25
|
-
: {
|
|
26
|
-
default: e,
|
|
27
|
-
};
|
|
23
|
+
return e && e.__esModule ? e : { default: e };
|
|
28
24
|
}
|
|
29
25
|
const { createActionStartEntry, createActionEndEntry, log } = _metroCore.Logger;
|
|
30
26
|
const NULL_PLATFORM = Symbol();
|
|
@@ -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
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {PackageJson} from 'metro-resolver/private/types';
|
|
12
|
+
|
|
13
|
+
declare class Package {
|
|
14
|
+
path: string;
|
|
15
|
+
_root: string;
|
|
16
|
+
_content: null | undefined | PackageJson;
|
|
17
|
+
constructor($$PARAM_0$$: {file: string});
|
|
18
|
+
invalidate(): void;
|
|
19
|
+
read(): PackageJson;
|
|
20
|
+
}
|
|
21
|
+
export default Package;
|
|
@@ -7,11 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
var _fs = _interopRequireDefault(require("fs"));
|
|
8
8
|
var _path = _interopRequireDefault(require("path"));
|
|
9
9
|
function _interopRequireDefault(e) {
|
|
10
|
-
return e && e.__esModule
|
|
11
|
-
? e
|
|
12
|
-
: {
|
|
13
|
-
default: e,
|
|
14
|
-
};
|
|
10
|
+
return e && e.__esModule ? e : { default: e };
|
|
15
11
|
}
|
|
16
12
|
class Package {
|
|
17
13
|
constructor({ file }) {
|
|
@@ -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
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import Package from './Package';
|
|
12
|
+
|
|
13
|
+
type GetClosestPackageFn = (
|
|
14
|
+
absoluteFilePath: string,
|
|
15
|
+
) => null | undefined | {packageJsonPath: string; packageRelativePath: string};
|
|
16
|
+
export declare class PackageCache {
|
|
17
|
+
_getClosestPackage: GetClosestPackageFn;
|
|
18
|
+
_packageCache: {[filePath: string]: Package};
|
|
19
|
+
_packagePathAndSubpathByModulePath: {
|
|
20
|
+
[filePath: string]:
|
|
21
|
+
| null
|
|
22
|
+
| undefined
|
|
23
|
+
| {packageJsonPath: string; packageRelativePath: string};
|
|
24
|
+
};
|
|
25
|
+
_modulePathsByPackagePath: {
|
|
26
|
+
[filePath: string]: Set<string>;
|
|
27
|
+
};
|
|
28
|
+
constructor(options: {getClosestPackage: GetClosestPackageFn});
|
|
29
|
+
getPackage(filePath: string): Package;
|
|
30
|
+
getPackageOf(
|
|
31
|
+
absoluteModulePath: string,
|
|
32
|
+
): null | undefined | {pkg: Package; packageRelativePath: string};
|
|
33
|
+
invalidate(filePath: string): void;
|
|
34
|
+
}
|
|
@@ -6,11 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.PackageCache = void 0;
|
|
7
7
|
var _Package = _interopRequireDefault(require("./Package"));
|
|
8
8
|
function _interopRequireDefault(e) {
|
|
9
|
-
return e && e.__esModule
|
|
10
|
-
? e
|
|
11
|
-
: {
|
|
12
|
-
default: e,
|
|
13
|
-
};
|
|
9
|
+
return e && e.__esModule ? e : { default: e };
|
|
14
10
|
}
|
|
15
11
|
class PackageCache {
|
|
16
12
|
constructor(options) {
|
|
@@ -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
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
export type AssetPath = {
|
|
12
|
+
assetName: string;
|
|
13
|
+
name: string;
|
|
14
|
+
platform: null | undefined | string;
|
|
15
|
+
resolution: number;
|
|
16
|
+
type: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Return `null` if the `filePath` doesn't have a valid extension, required
|
|
20
|
+
* to describe the type of an asset.
|
|
21
|
+
*/
|
|
22
|
+
export declare function tryParse(
|
|
23
|
+
filePath: string,
|
|
24
|
+
platforms: ReadonlySet<string>,
|
|
25
|
+
): null | undefined | AssetPath;
|
|
26
|
+
export declare function parse(
|
|
27
|
+
filePath: string,
|
|
28
|
+
platforms: ReadonlySet<string>,
|
|
29
|
+
): AssetPath;
|
|
@@ -10,11 +10,7 @@ var _parsePlatformFilePath = _interopRequireDefault(
|
|
|
10
10
|
);
|
|
11
11
|
var _path = _interopRequireDefault(require("path"));
|
|
12
12
|
function _interopRequireDefault(e) {
|
|
13
|
-
return e && e.__esModule
|
|
14
|
-
? e
|
|
15
|
-
: {
|
|
16
|
-
default: e,
|
|
17
|
-
};
|
|
13
|
+
return e && e.__esModule ? e : { default: e };
|
|
18
14
|
}
|
|
19
15
|
const ASSET_BASE_NAME_RE = /(.+?)(@([\d.]+)x)?$/;
|
|
20
16
|
function parseBaseName(baseName) {
|
|
@@ -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
|
+
type PlatformFilePathParts = {
|
|
12
|
+
dirPath: string;
|
|
13
|
+
baseName: string;
|
|
14
|
+
platform: null | undefined | string;
|
|
15
|
+
extension: null | undefined | string;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* Extract the components of a file path that can have a platform specifier: Ex.
|
|
19
|
+
* `index.ios.js` is specific to the `ios` platform and has the extension `js`.
|
|
20
|
+
*/
|
|
21
|
+
declare function parsePlatformFilePath(
|
|
22
|
+
filePath: string,
|
|
23
|
+
platforms: ReadonlySet<string>,
|
|
24
|
+
): PlatformFilePathParts;
|
|
25
|
+
export default parsePlatformFilePath;
|
|
@@ -6,11 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = parsePlatformFilePath;
|
|
7
7
|
var _path = _interopRequireDefault(require("path"));
|
|
8
8
|
function _interopRequireDefault(e) {
|
|
9
|
-
return e && e.__esModule
|
|
10
|
-
? e
|
|
11
|
-
: {
|
|
12
|
-
default: e,
|
|
13
|
-
};
|
|
9
|
+
return e && e.__esModule ? e : { default: e };
|
|
14
10
|
}
|
|
15
11
|
const PATH_RE = /^(.+?)(\.([^.]+))?\.([^.]+)$/;
|
|
16
12
|
function parsePlatformFilePath(filePath, platforms) {
|
|
@@ -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 {RamBundleInfo} from '../../../DeltaBundler/Serializers/getRamBundleInfo';
|
|
12
|
+
import type {OutputOptions} from '../../types';
|
|
13
|
+
/**
|
|
14
|
+
* Saves all JS modules of an app as single files
|
|
15
|
+
* The startup code (prelude, polyfills etc.) are written to the file
|
|
16
|
+
* designated by the `bundleOuput` option.
|
|
17
|
+
* All other modules go into a 'js-modules' folder that in the same parent
|
|
18
|
+
* directory as the startup file.
|
|
19
|
+
*/
|
|
20
|
+
declare function saveAsAssets(
|
|
21
|
+
bundle: RamBundleInfo,
|
|
22
|
+
options: OutputOptions,
|
|
23
|
+
log: (...args: Array<string>) => void,
|
|
24
|
+
): Promise<unknown>;
|
|
25
|
+
export default saveAsAssets;
|
|
@@ -17,11 +17,7 @@ var _writeSourcemap = _interopRequireDefault(require("./write-sourcemap"));
|
|
|
17
17
|
var _fs = require("fs");
|
|
18
18
|
var _path = _interopRequireDefault(require("path"));
|
|
19
19
|
function _interopRequireDefault(e) {
|
|
20
|
-
return e && e.__esModule
|
|
21
|
-
? e
|
|
22
|
-
: {
|
|
23
|
-
default: e,
|
|
24
|
-
};
|
|
20
|
+
return e && e.__esModule ? e : { default: e };
|
|
25
21
|
}
|
|
26
22
|
const MAGIC_RAM_BUNDLE_FILENAME = "UNBUNDLE";
|
|
27
23
|
const MODULES_DIR = "js-modules";
|
|
@@ -0,0 +1,38 @@
|
|
|
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 {RamBundleInfo} from '../../../DeltaBundler/Serializers/getRamBundleInfo';
|
|
12
|
+
import type {
|
|
13
|
+
ModuleGroups,
|
|
14
|
+
ModuleTransportLike,
|
|
15
|
+
OutputOptions,
|
|
16
|
+
} from '../../types';
|
|
17
|
+
/**
|
|
18
|
+
* Saves all JS modules of an app as a single file, separated with null bytes.
|
|
19
|
+
* The file begins with an offset table that contains module ids and their
|
|
20
|
+
* lengths/offsets.
|
|
21
|
+
* The module id for the startup code (prelude, polyfills etc.) is the
|
|
22
|
+
* empty string.
|
|
23
|
+
*/
|
|
24
|
+
export declare function save(
|
|
25
|
+
bundle: RamBundleInfo,
|
|
26
|
+
options: OutputOptions,
|
|
27
|
+
log: (...args: Array<string>) => void,
|
|
28
|
+
): Promise<unknown>;
|
|
29
|
+
export declare function buildTableAndContents(
|
|
30
|
+
startupCode: string,
|
|
31
|
+
modules: ReadonlyArray<ModuleTransportLike>,
|
|
32
|
+
moduleGroups: ModuleGroups,
|
|
33
|
+
encoding?: 'utf8' | 'utf16le' | 'ascii',
|
|
34
|
+
): Array<Buffer>;
|
|
35
|
+
export declare function createModuleGroups(
|
|
36
|
+
groups: Map<number, Set<number>>,
|
|
37
|
+
modules: ReadonlyArray<ModuleTransportLike>,
|
|
38
|
+
): ModuleGroups;
|
|
@@ -17,11 +17,7 @@ var _util = require("./util");
|
|
|
17
17
|
var _writeSourcemap = _interopRequireDefault(require("./write-sourcemap"));
|
|
18
18
|
var _fs = _interopRequireDefault(require("fs"));
|
|
19
19
|
function _interopRequireDefault(e) {
|
|
20
|
-
return e && e.__esModule
|
|
21
|
-
? e
|
|
22
|
-
: {
|
|
23
|
-
default: e,
|
|
24
|
-
};
|
|
20
|
+
return e && e.__esModule ? e : { default: e };
|
|
25
21
|
}
|
|
26
22
|
const SIZEOF_UINT32 = 4;
|
|
27
23
|
function save(bundle, options, log) {
|
|
@@ -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
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {ModuleGroups, ModuleTransportLike} from '../../types';
|
|
12
|
+
import type {IndexMap} from 'metro-source-map';
|
|
13
|
+
|
|
14
|
+
type Params = {
|
|
15
|
+
fixWrapperOffset: boolean;
|
|
16
|
+
lazyModules: ReadonlyArray<ModuleTransportLike>;
|
|
17
|
+
moduleGroups: null | undefined | ModuleGroups;
|
|
18
|
+
startupModules: ReadonlyArray<ModuleTransportLike>;
|
|
19
|
+
};
|
|
20
|
+
declare const $$EXPORT_DEFAULT_DECLARATION$$: ($$PARAM_0$$: Params) => IndexMap;
|
|
21
|
+
declare type $$EXPORT_DEFAULT_DECLARATION$$ =
|
|
22
|
+
typeof $$EXPORT_DEFAULT_DECLARATION$$;
|
|
23
|
+
export default $$EXPORT_DEFAULT_DECLARATION$$;
|
|
@@ -0,0 +1,14 @@
|
|
|
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
|
+
declare const $$EXPORT_DEFAULT_DECLARATION$$: 0xfb0bd1e5;
|
|
12
|
+
declare type $$EXPORT_DEFAULT_DECLARATION$$ =
|
|
13
|
+
typeof $$EXPORT_DEFAULT_DECLARATION$$;
|
|
14
|
+
export default $$EXPORT_DEFAULT_DECLARATION$$;
|
|
@@ -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
|
+
* @format
|
|
8
|
+
* @oncall react_native
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type {ModuleGroups, ModuleTransportLike} from '../../types';
|
|
12
|
+
import type {BasicSourceMap, IndexMap} from 'metro-source-map';
|
|
13
|
+
|
|
14
|
+
import countLines from '../../../lib/countLines';
|
|
15
|
+
|
|
16
|
+
declare function lineToLineSourceMap(
|
|
17
|
+
source: string,
|
|
18
|
+
filename?: string,
|
|
19
|
+
): BasicSourceMap;
|
|
20
|
+
type CombineOptions = {fixWrapperOffset: boolean};
|
|
21
|
+
declare function combineSourceMaps(
|
|
22
|
+
modules: ReadonlyArray<ModuleTransportLike>,
|
|
23
|
+
moduleGroups?: ModuleGroups,
|
|
24
|
+
options?: null | undefined | CombineOptions,
|
|
25
|
+
): IndexMap;
|
|
26
|
+
declare function combineSourceMapsAddingOffsets(
|
|
27
|
+
modules: ReadonlyArray<ModuleTransportLike>,
|
|
28
|
+
x_metro_module_paths: Array<string>,
|
|
29
|
+
moduleGroups?: null | undefined | ModuleGroups,
|
|
30
|
+
options?: null | undefined | CombineOptions,
|
|
31
|
+
): IndexMap;
|
|
32
|
+
declare const joinModules: (
|
|
33
|
+
modules: ReadonlyArray<{readonly code: string}>,
|
|
34
|
+
) => string;
|
|
35
|
+
export {
|
|
36
|
+
combineSourceMaps,
|
|
37
|
+
combineSourceMapsAddingOffsets,
|
|
38
|
+
countLines,
|
|
39
|
+
joinModules,
|
|
40
|
+
lineToLineSourceMap,
|
|
41
|
+
};
|
|
@@ -16,11 +16,7 @@ exports.lineToLineSourceMap = lineToLineSourceMap;
|
|
|
16
16
|
var _countLines = _interopRequireDefault(require("../../../lib/countLines"));
|
|
17
17
|
var _invariant = _interopRequireDefault(require("invariant"));
|
|
18
18
|
function _interopRequireDefault(e) {
|
|
19
|
-
return e && e.__esModule
|
|
20
|
-
? e
|
|
21
|
-
: {
|
|
22
|
-
default: e,
|
|
23
|
-
};
|
|
19
|
+
return e && e.__esModule ? e : { default: e };
|
|
24
20
|
}
|
|
25
21
|
function lineToLineSourceMap(source, filename = "") {
|
|
26
22
|
const firstLine = "AAAA;";
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
declare function writeSourcemap(
|
|
12
|
+
fileName: string,
|
|
13
|
+
contents: string,
|
|
14
|
+
log: (...args: Array<string>) => void,
|
|
15
|
+
): Promise<unknown>;
|
|
16
|
+
export default writeSourcemap;
|