From aa02d19db7d52fc80062cfd6bc48f0ab35694383 Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Thu, 25 May 2017 10:11:17 -0700 Subject: [PATCH] Allow RAM bundle output Summary: Hooks up indexed RAM bundle output for the build. Reviewed By: jeanlauliac Differential Revision: D5121515 fbshipit-source-id: 47a540d8ec016a36e21e1daa2876f582dbdb8504 --- packager/src/ModuleGraph/ModuleGraph.js | 8 ++++++-- packager/src/ModuleGraph/types.flow.js | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packager/src/ModuleGraph/ModuleGraph.js b/packager/src/ModuleGraph/ModuleGraph.js index 9b29505d6..3c00b69c6 100644 --- a/packager/src/ModuleGraph/ModuleGraph.js +++ b/packager/src/ModuleGraph/ModuleGraph.js @@ -17,6 +17,7 @@ const seq = require('async/seq'); const virtualModule = require('./module').virtual; import type { + BuildResult, Callback, GraphFn, GraphResult, @@ -27,7 +28,7 @@ import type { type BuildFn = ( entryPoints: Iterable, options: BuildOptions, - callback: Callback, + callback: Callback, ) => void; type BuildOptions = {| @@ -86,9 +87,12 @@ exports.createBuildSetup = ( polyfills, } = nullthrows(result); + const preludeScript = prelude(optimize); + const prependedScripts = [preludeScript, ...moduleSystem, ...polyfills]; callback(null, { entryModules, - modules: concat([prelude(optimize)], moduleSystem, polyfills, modules), + modules: concat(prependedScripts, modules), + prependedScripts, }); }); }; diff --git a/packager/src/ModuleGraph/types.flow.js b/packager/src/ModuleGraph/types.flow.js index 4f66d3039..b75b6655f 100644 --- a/packager/src/ModuleGraph/types.flow.js +++ b/packager/src/ModuleGraph/types.flow.js @@ -15,6 +15,11 @@ import type {Ast} from 'babel-core'; import type {Console} from 'console'; export type {Transformer} from '../JSTransformer/worker/worker.js'; +export type BuildResult = {| + ...GraphResult, + prependedScripts: $ReadOnlyArray, +|}; + export type Callback = (Error => void) & ((null | void, A, B) => void);