From de35a7379835b266ab076ba94b4ecebe122724f1 Mon Sep 17 00:00:00 2001 From: Jean Lauliac Date: Fri, 9 Mar 2018 10:39:39 -0800 Subject: [PATCH] metro: collapse name verification into getHasteName() Reviewed By: rafeca, mjesun Differential Revision: D7196246 fbshipit-source-id: 425573f61148ac3a4e85bbcf4fb1033f3e560dab --- packages/metro/src/ModuleGraph/worker/transform-module.js | 8 +++----- packages/metro/src/node-haste/DependencyGraph.js | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/metro/src/ModuleGraph/worker/transform-module.js b/packages/metro/src/ModuleGraph/worker/transform-module.js index c08143ee..78ea3364 100644 --- a/packages/metro/src/ModuleGraph/worker/transform-module.js +++ b/packages/metro/src/ModuleGraph/worker/transform-module.js @@ -99,17 +99,15 @@ function transformModule( let hasteID = null; if (filename.indexOf(NODE_MODULES) === -1 && !polyfill) { - hasteID = docblock.parse(docblock.extract(sourceCode)).providesModule; if (options.hasteImplModulePath != null) { // eslint-disable-next-line no-useless-call const HasteImpl = (require.call( null, options.hasteImplModulePath, ): HasteImpl); - if (HasteImpl.enforceHasteNameMatches) { - HasteImpl.enforceHasteNameMatches(filename, hasteID); - } - hasteID = HasteImpl.getHasteName(filename); + hasteID = HasteImpl.getHasteName(filename, sourceCode); + } else { + hasteID = docblock.parse(docblock.extract(sourceCode)).providesModule; } } diff --git a/packages/metro/src/node-haste/DependencyGraph.js b/packages/metro/src/node-haste/DependencyGraph.js index bac24616..077a3319 100644 --- a/packages/metro/src/node-haste/DependencyGraph.js +++ b/packages/metro/src/node-haste/DependencyGraph.js @@ -66,7 +66,7 @@ type Options = {| +watch: boolean, |}; -const JEST_HASTE_MAP_CACHE_BREAKER = 2; +const JEST_HASTE_MAP_CACHE_BREAKER = 3; class DependencyGraph extends EventEmitter { _assetResolutionCache: AssetResolutionCache;