Allow RAM bundle output

Summary: Hooks up indexed RAM bundle output for the build.

Reviewed By: jeanlauliac

Differential Revision: D5121515

fbshipit-source-id: 47a540d8ec016a36e21e1daa2876f582dbdb8504
This commit is contained in:
David Aurelio 2017-05-25 10:11:17 -07:00 committed by Facebook Github Bot
parent 7f64874c7d
commit 683c8ddad8
2 changed files with 11 additions and 2 deletions

View File

@ -17,6 +17,7 @@ const seq = require('async/seq');
const virtualModule = require('./module').virtual; const virtualModule = require('./module').virtual;
import type { import type {
BuildResult,
Callback, Callback,
GraphFn, GraphFn,
GraphResult, GraphResult,
@ -27,7 +28,7 @@ import type {
type BuildFn = ( type BuildFn = (
entryPoints: Iterable<string>, entryPoints: Iterable<string>,
options: BuildOptions, options: BuildOptions,
callback: Callback<GraphResult>, callback: Callback<BuildResult>,
) => void; ) => void;
type BuildOptions = {| type BuildOptions = {|
@ -86,9 +87,12 @@ exports.createBuildSetup = (
polyfills, polyfills,
} = nullthrows(result); } = nullthrows(result);
const preludeScript = prelude(optimize);
const prependedScripts = [preludeScript, ...moduleSystem, ...polyfills];
callback(null, { callback(null, {
entryModules, entryModules,
modules: concat([prelude(optimize)], moduleSystem, polyfills, modules), modules: concat(prependedScripts, modules),
prependedScripts,
}); });
}); });
}; };

View File

@ -15,6 +15,11 @@ import type {Ast} from 'babel-core';
import type {Console} from 'console'; import type {Console} from 'console';
export type {Transformer} from '../JSTransformer/worker/worker.js'; export type {Transformer} from '../JSTransformer/worker/worker.js';
export type BuildResult = {|
...GraphResult,
prependedScripts: $ReadOnlyArray<Module>,
|};
export type Callback<A = void, B = void> export type Callback<A = void, B = void>
= (Error => void) = (Error => void)
& ((null | void, A, B) => void); & ((null | void, A, B) => void);