mirror of https://github.com/status-im/metro.git
Use SHA-1 on experimental caches
Reviewed By: jeanlauliac Differential Revision: D7399785 fbshipit-source-id: c8e842390e27d7954ca78dcd5c4b7e2a115d1b9d
This commit is contained in:
parent
caf4fe379f
commit
9045aad7e4
|
@ -291,9 +291,9 @@ class Bundler {
|
||||||
// This is the hash related to the global Bundler config.
|
// This is the hash related to the global Bundler config.
|
||||||
this._baseHash,
|
this._baseHash,
|
||||||
|
|
||||||
// Path and code.
|
// Path and code hash.
|
||||||
module.localPath,
|
module.localPath,
|
||||||
code,
|
(await this.getDependencyGraph()).getSha1(module.path),
|
||||||
|
|
||||||
// We cannot include "transformCodeOptions" because of "projectRoot".
|
// We cannot include "transformCodeOptions" because of "projectRoot".
|
||||||
assetDataPlugins,
|
assetDataPlugins,
|
||||||
|
|
|
@ -109,6 +109,7 @@ class DependencyGraph extends EventEmitter {
|
||||||
useWatchman?: boolean = true,
|
useWatchman?: boolean = true,
|
||||||
): JestHasteMap {
|
): JestHasteMap {
|
||||||
return new JestHasteMap({
|
return new JestHasteMap({
|
||||||
|
computeSha1: true,
|
||||||
extensions: opts.sourceExts.concat(opts.assetExts),
|
extensions: opts.sourceExts.concat(opts.assetExts),
|
||||||
forceNodeFilesystemAPI: !useWatchman,
|
forceNodeFilesystemAPI: !useWatchman,
|
||||||
hasteImplModulePath: opts.hasteImplModulePath,
|
hasteImplModulePath: opts.hasteImplModulePath,
|
||||||
|
@ -234,6 +235,17 @@ class DependencyGraph extends EventEmitter {
|
||||||
return result.dependencies;
|
return result.dependencies;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getSha1(filename: string): string {
|
||||||
|
// $FlowFixMe: TODO T27501330: Use getSha1 from HasteFS.
|
||||||
|
const sha1 = this._hasteFS._files[filename][4];
|
||||||
|
|
||||||
|
if (!sha1) {
|
||||||
|
throw new ReferenceError(`SHA-1 for file ${filename} is not computed`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return sha1;
|
||||||
|
}
|
||||||
|
|
||||||
getWatcher() {
|
getWatcher() {
|
||||||
return this._haste;
|
return this._haste;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue