packager: node-haste: async load()

Reviewed By: cpojer

Differential Revision: D4673384

fbshipit-source-id: 816529f8947079b4003c8e91443e221184fd589d
This commit is contained in:
Jean Lauliac 2017-03-10 04:00:52 -08:00 committed by Facebook Github Bot
parent e2ffd8d08b
commit e1a2633f69
1 changed files with 9 additions and 10 deletions

View File

@ -115,20 +115,19 @@ class DependencyGraph extends EventEmitter {
}); });
} }
static load(opts: Options): Promise<DependencyGraph> { static async load(opts: Options): Promise<DependencyGraph> {
const initializingPackagerLogEntry = const initializingPackagerLogEntry =
log(createActionStartEntry('Initializing Packager')); log(createActionStartEntry('Initializing Packager'));
opts.reporter.update({type: 'dep_graph_loading'}); opts.reporter.update({type: 'dep_graph_loading'});
const haste = DependencyGraph._createHaste(opts); const haste = DependencyGraph._createHaste(opts);
return haste.build().then(({hasteFS, moduleMap}) => { const {hasteFS, moduleMap} = await haste.build();
log(createActionEndEntry(initializingPackagerLogEntry)); log(createActionEndEntry(initializingPackagerLogEntry));
opts.reporter.update({type: 'dep_graph_loaded'}); opts.reporter.update({type: 'dep_graph_loaded'});
return new DependencyGraph({ return new DependencyGraph({
opts, opts,
haste, haste,
initialHasteFS: hasteFS, initialHasteFS: hasteFS,
initialModuleMap: moduleMap, initialModuleMap: moduleMap,
});
}); });
} }