diff --git a/packages/metro/src/node-haste/DependencyGraph.js b/packages/metro/src/node-haste/DependencyGraph.js index e22afdd5..c3f16ab9 100644 --- a/packages/metro/src/node-haste/DependencyGraph.js +++ b/packages/metro/src/node-haste/DependencyGraph.js @@ -219,14 +219,7 @@ class DependencyGraph extends EventEmitter { } getSha1(filename: string): string { - // $FlowFixMe: TODO T27501330: Use getSha1 from HasteFS. - const file = this._hasteFS._files[filename]; - - if (!file) { - throw new ReferenceError(`File ${filename} is not tracked by haste-map`); - } - - const sha1 = file[4]; + const sha1 = this._hasteFS.getSha1(filename); if (!sha1) { throw new ReferenceError(`SHA-1 for file ${filename} is not computed`); diff --git a/packages/metro/src/node-haste/types.js b/packages/metro/src/node-haste/types.js index 540cbd68..2cc5719b 100644 --- a/packages/metro/src/node-haste/types.js +++ b/packages/metro/src/node-haste/types.js @@ -15,5 +15,6 @@ export type HasteFS = { exists(filePath: string): boolean, getAllFiles(): Array, getModuleName(filePath: string): ?string, + getSha1(string): ?string, matchFiles(pattern: RegExp | string): Array, };