(options: Options)
| 295 | } |
| 296 | |
| 297 | private async setupCachePath(options: Options): Promise<void> { |
| 298 | const rootDirHash = createHash('sha1') |
| 299 | .update(options.rootDir) |
| 300 | .digest('hex') |
| 301 | .slice(0, 32); |
| 302 | let hasteImplHash = ''; |
| 303 | let dependencyExtractorHash = ''; |
| 304 | |
| 305 | if (options.hasteImplModulePath) { |
| 306 | const hasteImpl = require(options.hasteImplModulePath); |
| 307 | if (hasteImpl.getCacheKey) { |
| 308 | hasteImplHash = String(hasteImpl.getCacheKey()); |
| 309 | } |
| 310 | } |
| 311 | |
| 312 | if (options.dependencyExtractor) { |
| 313 | const dependencyExtractor = |
| 314 | await requireOrImportModule<DependencyExtractor>( |
| 315 | options.dependencyExtractor, |
| 316 | false, |
| 317 | ); |
| 318 | if (dependencyExtractor.getCacheKey) { |
| 319 | dependencyExtractorHash = String(dependencyExtractor.getCacheKey()); |
| 320 | } |
| 321 | } |
| 322 | |
| 323 | this._cachePath = HasteMap.getCacheFilePath( |
| 324 | this._options.cacheDirectory, |
| 325 | `haste-map-${this._options.id}-${rootDirHash}`, |
| 326 | VERSION, |
| 327 | this._options.id, |
| 328 | this._options.roots |
| 329 | .map(root => fastPath.relative(options.rootDir, root)) |
| 330 | .join(':'), |
| 331 | this._options.extensions.join(':'), |
| 332 | this._options.platforms.join(':'), |
| 333 | this._options.computeSha1.toString(), |
| 334 | options.mocksPattern || '', |
| 335 | (options.ignorePattern || '').toString(), |
| 336 | hasteImplHash, |
| 337 | dependencyExtractorHash, |
| 338 | this._options.computeDependencies.toString(), |
| 339 | ); |
| 340 | } |
| 341 | |
| 342 | static getCacheFilePath( |
| 343 | tmpdir: string, |
no test coverage detected