Expose getDependencies when using RAM bundles

Reviewed By: rafeca

Differential Revision: D6965192

fbshipit-source-id: 8f4178aa4c38c03beab6da8bcaf4dc193c02b044
This commit is contained in:
Christoph Nakazawa 2018-02-12 09:43:47 -08:00 committed by Facebook Github Bot
parent 918e1a384c
commit 892b4ac9de
3 changed files with 10 additions and 3 deletions

View File

@ -37,6 +37,7 @@ export type Options = BundleOptions & {
export type RamModule = ModuleTransportLike; export type RamModule = ModuleTransportLike;
export type RamBundleInfo = { export type RamBundleInfo = {
getDependencies: string => Set<string>,
startupModules: $ReadOnlyArray<RamModule>, startupModules: $ReadOnlyArray<RamModule>,
lazyModules: $ReadOnlyArray<RamModule>, lazyModules: $ReadOnlyArray<RamModule>,
groups: Map<number, Set<number>>, groups: Map<number, Set<number>>,
@ -218,9 +219,10 @@ async function getRamBundleInfo(
); );
return { return {
startupModules, getDependencies,
lazyModules,
groups, groups,
lazyModules,
startupModules,
}; };
} }

View File

@ -117,6 +117,7 @@ Array [
exports[`Serializers should return the RAM bundle info 1`] = ` exports[`Serializers should return the RAM bundle info 1`] = `
Object { Object {
"getDependencies": [Function],
"groups": Map {}, "groups": Map {},
"lazyModules": Array [ "lazyModules": Array [
Object { Object {
@ -191,6 +192,7 @@ Object {
exports[`Serializers should return the RAM bundle info 2`] = ` exports[`Serializers should return the RAM bundle info 2`] = `
Object { Object {
"getDependencies": [Function],
"groups": Map {}, "groups": Map {},
"lazyModules": Array [ "lazyModules": Array [
Object { Object {
@ -403,6 +405,7 @@ Object {
exports[`Serializers should use the preloadedModules and ramGroup configs to build a RAM bundle 1`] = ` exports[`Serializers should use the preloadedModules and ramGroup configs to build a RAM bundle 1`] = `
Object { Object {
"getDependencies": [Function],
"groups": Map { "groups": Map {
5 => Set { 5 => Set {
6, 6,

View File

@ -338,8 +338,9 @@ exports.runBuild = async ({
try { try {
metroBundle = await output.build(metroServer, requestOptions); metroBundle = await output.build(metroServer, requestOptions);
} finally { } catch (error) {
await metroServer.end(); await metroServer.end();
throw error;
} }
if (onComplete) { if (onComplete) {
@ -358,6 +359,7 @@ exports.runBuild = async ({
}; };
await output.save(metroBundle, outputOptions, console.log); await output.save(metroBundle, outputOptions, console.log);
await metroServer.end();
return {metroServer, metroBundle}; return {metroServer, metroBundle};
}; };