From c398cd99a15998160d5cf5020daeca69c548d896 Mon Sep 17 00:00:00 2001 From: Miguel Jimenez Esun Date: Sat, 21 Apr 2018 11:21:00 -0700 Subject: [PATCH] Use "getSha1" from HasteFS Reviewed By: cpojer Differential Revision: D7721378 fbshipit-source-id: 441666df325c60d94eb6e14b50c3c4cde76b3dfe --- packages/metro/src/node-haste/DependencyGraph.js | 9 +-------- packages/metro/src/node-haste/types.js | 1 + 2 files changed, 2 insertions(+), 8 deletions(-) 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, };