From e1a2633f697bb87a94d60fb559535ac0d58bebcb Mon Sep 17 00:00:00 2001 From: Jean Lauliac Date: Fri, 10 Mar 2017 04:00:52 -0800 Subject: [PATCH] packager: node-haste: async load() Reviewed By: cpojer Differential Revision: D4673384 fbshipit-source-id: 816529f8947079b4003c8e91443e221184fd589d --- .../metro-bundler/src/node-haste/index.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/packages/metro-bundler/src/node-haste/index.js b/packages/metro-bundler/src/node-haste/index.js index e4b502ec..55bf309a 100644 --- a/packages/metro-bundler/src/node-haste/index.js +++ b/packages/metro-bundler/src/node-haste/index.js @@ -115,20 +115,19 @@ class DependencyGraph extends EventEmitter { }); } - static load(opts: Options): Promise { + static async load(opts: Options): Promise { const initializingPackagerLogEntry = log(createActionStartEntry('Initializing Packager')); opts.reporter.update({type: 'dep_graph_loading'}); const haste = DependencyGraph._createHaste(opts); - return haste.build().then(({hasteFS, moduleMap}) => { - log(createActionEndEntry(initializingPackagerLogEntry)); - opts.reporter.update({type: 'dep_graph_loaded'}); - return new DependencyGraph({ - opts, - haste, - initialHasteFS: hasteFS, - initialModuleMap: moduleMap, - }); + const {hasteFS, moduleMap} = await haste.build(); + log(createActionEndEntry(initializingPackagerLogEntry)); + opts.reporter.update({type: 'dep_graph_loaded'}); + return new DependencyGraph({ + opts, + haste, + initialHasteFS: hasteFS, + initialModuleMap: moduleMap, }); }