Expose customTransformOptions param on the buildGraph command

Reviewed By: mjesun

Differential Revision: D7759324

fbshipit-source-id: b1f8af7ecb992f97d41b7212467ed95658d88bed
This commit is contained in:
Rafael Oleza 2018-04-26 06:05:15 -07:00 committed by Facebook Github Bot
parent 7f8ee6daa8
commit 373ec95b2b
1 changed files with 6 additions and 1 deletions

View File

@ -59,6 +59,8 @@ type PrivateMetroOptions = {|
watch?: boolean, watch?: boolean,
|}; |};
import type {CustomTransformOptions} from './JSTransformer/worker';
// We'll be able to remove this to use the one provided by modern versions of // We'll be able to remove this to use the one provided by modern versions of
// fs-extra once https://github.com/jprichardson/node-fs-extra/pull/520 will // fs-extra once https://github.com/jprichardson/node-fs-extra/pull/520 will
// have been merged (until then, they'll break on devservers/Sandcastle) // have been merged (until then, they'll break on devservers/Sandcastle)
@ -270,11 +272,12 @@ exports.runServer = async ({
type BuildGraphOptions = {| type BuildGraphOptions = {|
...PublicMetroOptions, ...PublicMetroOptions,
entries: $ReadOnlyArray<string>, entries: $ReadOnlyArray<string>,
customTransformOptions?: CustomTransformOptions,
dev?: boolean, dev?: boolean,
minify?: boolean, minify?: boolean,
onProgress?: (transformedFileCount: number, totalFileCount: number) => void, onProgress?: (transformedFileCount: number, totalFileCount: number) => void,
platform?: string, platform?: string,
type: 'module' | 'script', type?: 'module' | 'script',
|}; |};
type RunBuildOptions = {| type RunBuildOptions = {|
@ -370,6 +373,7 @@ exports.runBuild = async ({
exports.buildGraph = async function({ exports.buildGraph = async function({
config, config,
customTransformOptions = Object.create(null),
dev = false, dev = false,
entries, entries,
minify = false, minify = false,
@ -386,6 +390,7 @@ exports.buildGraph = async function({
try { try {
return await metroServer.buildGraph(entries, { return await metroServer.buildGraph(entries, {
...MetroServer.DEFAULT_GRAPH_OPTIONS, ...MetroServer.DEFAULT_GRAPH_OPTIONS,
customTransformOptions,
dev, dev,
minify, minify,
onProgress, onProgress,