mirror of https://github.com/status-im/metro.git
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:
parent
7f64874c7d
commit
683c8ddad8
|
@ -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,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue