Skip to content

Commit

Permalink
Add resolver.unstable_hasteMapModulePath config setting
Browse files Browse the repository at this point in the history
Summary: Adds a config option exposing `jest-haste-map`'s `hasteMapModulePath` option (jestjs/jest#11107). This is marked as `unstable_` so as to not strongly tie Metro to this Jest implementation detail.

Reviewed By: GijsWeterings

Differential Revision: D30997892

fbshipit-source-id: 4a54b56edd7d16e195cb566476959cd57984a45f
  • Loading branch information
motiz88 authored and facebook-github-bot committed Sep 20, 2021
1 parent 9cf257e commit e8c0de0
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ Object {
"ts",
"tsx",
],
"unstable_hasteMapModulePath": undefined,
"useWatchman": true,
},
"serializer": Object {
Expand Down Expand Up @@ -212,6 +213,7 @@ Object {
"ts",
"tsx",
],
"unstable_hasteMapModulePath": undefined,
"useWatchman": true,
},
"serializer": Object {
Expand Down Expand Up @@ -356,6 +358,7 @@ Object {
"ts",
"tsx",
],
"unstable_hasteMapModulePath": undefined,
"useWatchman": true,
},
"serializer": Object {
Expand Down Expand Up @@ -500,6 +503,7 @@ Object {
"ts",
"tsx",
],
"unstable_hasteMapModulePath": undefined,
"useWatchman": true,
},
"serializer": Object {
Expand Down
1 change: 1 addition & 0 deletions packages/metro-config/src/configTypes.flow.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ 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: 1 addition & 0 deletions packages/metro-config/src/defaults/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const getDefaultValues = (projectRoot: ?string): ConfigT => ({
),
extraNodeModules: {},
hasteImplModulePath: undefined,
unstable_hasteMapModulePath: undefined,
nodeModulesPaths: [],
resolveRequest: null,
resolverMainFields: ['browser', 'main'],
Expand Down
1 change: 1 addition & 0 deletions packages/metro-config/src/defaults/validConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module.exports = (async () => {
...defaultConfig.resolver,
resolveRequest: function CustomResolver() {},
hasteImplModulePath: './path',
unstable_hasteMapModulePath: './path',
},
server: {
...defaultConfig.server,
Expand Down
1 change: 1 addition & 0 deletions packages/metro/src/node-haste/DependencyGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ class DependencyGraph extends EventEmitter {
extensions: config.resolver.sourceExts.concat(config.resolver.assetExts),
forceNodeFilesystemAPI: !config.resolver.useWatchman,
hasteImplModulePath: config.resolver.hasteImplModulePath,
hasteMapModulePath: config.resolver.unstable_hasteMapModulePath,
ignorePattern: this._getIgnorePattern(config),
maxWorkers: config.maxWorkers,
mocksPattern: '',
Expand Down

0 comments on commit e8c0de0

Please sign in to comment.