Skip to content

Commit

Permalink
Remove unstable_hasteMapModulePath from Metro config
Browse files Browse the repository at this point in the history
Summary:
Remove the `unstable_hasteMapModulePath` config option from Metro and the corresponding `hasteMapModulePath` option from `metro-file-map`.

We no longer need these internally and removing this indirection makes things easier to reason about, especially as this API effectively exposed internal behaviour in a way that could be broken unknowingly.

Reviewed By: motiz88

Differential Revision: D36875896

fbshipit-source-id: 34214abadcc6fd56c6033ecb40452f59008b924f
  • Loading branch information
robhogan authored and facebook-github-bot committed Jun 9, 2022
1 parent 6aab0ef commit 1cae8d8
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ Object {
"ts",
"tsx",
],
"unstable_hasteMapModulePath": undefined,
"useWatchman": true,
},
"serializer": Object {
Expand Down Expand Up @@ -215,7 +214,6 @@ Object {
"ts",
"tsx",
],
"unstable_hasteMapModulePath": undefined,
"useWatchman": true,
},
"serializer": Object {
Expand Down Expand Up @@ -361,7 +359,6 @@ Object {
"ts",
"tsx",
],
"unstable_hasteMapModulePath": undefined,
"useWatchman": true,
},
"serializer": Object {
Expand Down Expand Up @@ -507,7 +504,6 @@ Object {
"ts",
"tsx",
],
"unstable_hasteMapModulePath": undefined,
"useWatchman": true,
},
"serializer": Object {
Expand Down
1 change: 0 additions & 1 deletion packages/metro-config/src/configTypes.flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ type ResolverConfigT = {
emptyModulePath: string,
extraNodeModules: {[name: string]: string, ...},
hasteImplModulePath: ?string,
unstable_hasteMapModulePath: ?string,
nodeModulesPaths: $ReadOnlyArray<string>,
platforms: $ReadOnlyArray<string>,
resolveRequest: ?CustomResolver,
Expand Down
1 change: 0 additions & 1 deletion packages/metro-config/src/defaults/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ const getDefaultValues = (projectRoot: ?string): ConfigT => ({
),
extraNodeModules: {},
hasteImplModulePath: undefined,
unstable_hasteMapModulePath: undefined,
nodeModulesPaths: [],
resolveRequest: null,
resolverMainFields: ['browser', 'main'],
Expand Down
1 change: 0 additions & 1 deletion packages/metro-config/src/defaults/validConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ module.exports = (async () => {
...defaultConfig.resolver,
resolveRequest: function CustomResolver() {},
hasteImplModulePath: './path',
unstable_hasteMapModulePath: './path',
},
server: {
...defaultConfig.server,
Expand Down
9 changes: 0 additions & 9 deletions packages/metro-file-map/src/flow-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,6 @@ export type HasteMap = {
moduleMap: ModuleMap,
};

export type HasteMapStatic<S = SerializableModuleMap> = {
getCacheFilePath(
cacheDirectory: string,
cacheFilePrefix: string,
buildParameters: BuildParameters,
): string,
getModuleMapFromJSON(json: S): IModuleMap<S>,
};

export type HType = {
ID: 0,
MTIME: 1,
Expand Down
19 changes: 0 additions & 19 deletions packages/metro-file-map/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import type {
FileData,
FileMetaData,
HasteMap as InternalDataObject,
HasteMapStatic,
HType,
InternalData,
MockData,
Expand Down Expand Up @@ -87,7 +86,6 @@ export type InputOptions = $ReadOnly<{
throwOnModuleCollision?: ?boolean,
useWatchman?: ?boolean,
watch?: ?boolean,
hasteMapModulePath?: ?string,
console?: Console,
cacheManagerFactory?: ?CacheManagerFactory,
}>;
Expand Down Expand Up @@ -230,24 +228,7 @@ export default class HasteMap extends EventEmitter {
_worker: ?WorkerInterface;
_cacheManager: CacheManager;

static getStatic(
config: $ReadOnly<{haste: $ReadOnly<{hasteMapModulePath?: string}>}>,
): HasteMapStatic<> {
if (config.haste.hasteMapModulePath != null) {
// $FlowFixMe[unsupported-syntax] - Dynamic require
return require(config.haste.hasteMapModulePath);
}
// $FlowFixMe[prop-missing] - returning static class
// $FlowFixMe[method-unbinding] - returning static class
return HasteMap;
}

static create(options: InputOptions): HasteMap {
if (options.hasteMapModulePath != null) {
// $FlowFixMe[unsupported-syntax] - Dynamic require
const CustomHasteMap = require(options.hasteMapModulePath);
return new CustomHasteMap(options);
}
return new HasteMap(options);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ function createHasteMap(
extensions: config.resolver.sourceExts.concat(config.resolver.assetExts),
forceNodeFilesystemAPI: !config.resolver.useWatchman,
hasteImplModulePath: config.resolver.hasteImplModulePath,
hasteMapModulePath: config.resolver.unstable_hasteMapModulePath,
ignorePattern: getIgnorePattern(config),
maxWorkers: config.maxWorkers,
mocksPattern: '',
Expand Down

0 comments on commit 1cae8d8

Please sign in to comment.