From 892b4ac9deae4606cdc0fea8e0a329b9c6973398 Mon Sep 17 00:00:00 2001 From: Christoph Nakazawa Date: Mon, 12 Feb 2018 09:43:47 -0800 Subject: [PATCH] Expose getDependencies when using RAM bundles Reviewed By: rafeca Differential Revision: D6965192 fbshipit-source-id: 8f4178aa4c38c03beab6da8bcaf4dc193c02b044 --- packages/metro/src/DeltaBundler/Serializers.js | 6 ++++-- .../__tests__/__snapshots__/Serializers-test.js.snap | 3 +++ packages/metro/src/index.js | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/metro/src/DeltaBundler/Serializers.js b/packages/metro/src/DeltaBundler/Serializers.js index b1108a38..c233ac46 100644 --- a/packages/metro/src/DeltaBundler/Serializers.js +++ b/packages/metro/src/DeltaBundler/Serializers.js @@ -37,6 +37,7 @@ export type Options = BundleOptions & { export type RamModule = ModuleTransportLike; export type RamBundleInfo = { + getDependencies: string => Set, startupModules: $ReadOnlyArray, lazyModules: $ReadOnlyArray, groups: Map>, @@ -218,9 +219,10 @@ async function getRamBundleInfo( ); return { - startupModules, - lazyModules, + getDependencies, groups, + lazyModules, + startupModules, }; } diff --git a/packages/metro/src/DeltaBundler/__tests__/__snapshots__/Serializers-test.js.snap b/packages/metro/src/DeltaBundler/__tests__/__snapshots__/Serializers-test.js.snap index bcb7cdc5..00d4a8f7 100644 --- a/packages/metro/src/DeltaBundler/__tests__/__snapshots__/Serializers-test.js.snap +++ b/packages/metro/src/DeltaBundler/__tests__/__snapshots__/Serializers-test.js.snap @@ -117,6 +117,7 @@ Array [ exports[`Serializers should return the RAM bundle info 1`] = ` Object { + "getDependencies": [Function], "groups": Map {}, "lazyModules": Array [ Object { @@ -191,6 +192,7 @@ Object { exports[`Serializers should return the RAM bundle info 2`] = ` Object { + "getDependencies": [Function], "groups": Map {}, "lazyModules": Array [ Object { @@ -403,6 +405,7 @@ Object { exports[`Serializers should use the preloadedModules and ramGroup configs to build a RAM bundle 1`] = ` Object { + "getDependencies": [Function], "groups": Map { 5 => Set { 6, diff --git a/packages/metro/src/index.js b/packages/metro/src/index.js index 0edfa4a2..ea022fb5 100644 --- a/packages/metro/src/index.js +++ b/packages/metro/src/index.js @@ -338,8 +338,9 @@ exports.runBuild = async ({ try { metroBundle = await output.build(metroServer, requestOptions); - } finally { + } catch (error) { await metroServer.end(); + throw error; } if (onComplete) { @@ -358,6 +359,7 @@ exports.runBuild = async ({ }; await output.save(metroBundle, outputOptions, console.log); + await metroServer.end(); return {metroServer, metroBundle}; };