mirror of
https://github.com/status-im/metro.git
synced 2025-01-20 16:09:21 +00:00
Enable flow type for a file and fix a related typo/bug
Reviewed By: rafeca Differential Revision: D6473575 fbshipit-source-id: 7b96b6bfb2aff96e6d4697ad29fd96fb85d1ceda
This commit is contained in:
parent
5c06a80fd7
commit
dfa05cbcd4
@ -120,7 +120,7 @@ type Options = {|
|
||||
|
||||
class Bundler {
|
||||
_opts: Options;
|
||||
_getModuleId: ({path: string}) => number;
|
||||
_getModuleId: (path: string) => number;
|
||||
_transformer: Transformer;
|
||||
_resolverPromise: Promise<Resolver>;
|
||||
_projectRoots: $ReadOnlyArray<string>;
|
||||
|
@ -6,20 +6,22 @@
|
||||
* LICENSE file in the root directory of this source tree. An additional grant
|
||||
* of patent rights can be found in the PATENTS file in the same directory.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
function createModuleIdFactory(): (path: string) => number {
|
||||
const fileToIdMap = new Map();
|
||||
const fileToIdMap: Map<string, number> = new Map();
|
||||
let nextId = 0;
|
||||
return (path: string) => {
|
||||
if (!fileToIdMap.has(path)) {
|
||||
fileToIdMap.set(path, nextId);
|
||||
nextId += 1;
|
||||
let id = fileToIdMap.get(path);
|
||||
if (typeof id !== 'number') {
|
||||
id = nextId++;
|
||||
fileToIdMap.set(path, id);
|
||||
}
|
||||
return fileToIdMap.get(path);
|
||||
return id;
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user