Adds a globalTransformCache option to the metro API

Reviewed By: rafeca

Differential Revision: D6900514

fbshipit-source-id: b150662b5aec9c11506333b07377165636d9180c
This commit is contained in:
Maël Nison 2018-02-06 06:19:57 -08:00 committed by Facebook Github Bot
parent bc6f188a59
commit 1f743f3e93

View File

@ -32,6 +32,7 @@ const {readFile} = require('fs-extra');
const {Terminal} = require('metro-core');
import type {ConfigT} from './Config';
import type {GlobalTransformCache} from './lib/GlobalTransformCache';
import type {Reporter} from './lib/reporting';
import type {RequestOptions, OutputOptions} from './shared/types.flow.js';
import type {Options as ServerOptions} from './shared/types.flow';
@ -42,6 +43,7 @@ export type {ConfigT} from './Config';
type PublicMetroOptions = {|
config?: ConfigT,
globalTransformCache?: ?GlobalTransformCache,
maxWorkers?: number,
port?: ?number,
reporter?: Reporter,
@ -78,6 +80,7 @@ async function asyncRealpath(path): Promise<string> {
async function runMetro({
config,
globalTransformCache,
resetCache = false,
maxWorkers = getMaxWorkers(),
// $FlowFixMe TODO t0 https://github.com/facebook/flow/issues/183
@ -126,7 +129,7 @@ async function runMetro({
getModulesRunBeforeMainModule:
normalizedConfig.getModulesRunBeforeMainModule,
getTransformOptions: normalizedConfig.getTransformOptions,
globalTransformCache: null,
globalTransformCache,
hasteImplModulePath: normalizedConfig.hasteImplModulePath,
maxWorkers,
platforms: defaults.platforms.concat(platforms),