From 8292958c0004840ce3686b18dd345e2a6ec4e35f Mon Sep 17 00:00:00 2001 From: Miguel Jimenez Esun Date: Mon, 26 Feb 2018 03:21:11 -0800 Subject: [PATCH] Allow passing custom configs through the CLI ("js1 run") Reviewed By: jeanlauliac Differential Revision: D7081913 fbshipit-source-id: f5952599c840f2c65213bd2928b21f0c1d84f510 --- packages/metro/src/index.js | 1 + packages/metro/src/legacy.js | 1 + packages/metro/src/shared/types.flow.js | 7 ++++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/metro/src/index.js b/packages/metro/src/index.js index 7f1ec336..3162cad8 100644 --- a/packages/metro/src/index.js +++ b/packages/metro/src/index.js @@ -119,6 +119,7 @@ async function runMetro({ assetExts: normalizedConfig.assetTransforms ? [] : assetExts, assetRegistryPath: normalizedConfig.assetRegistryPath, blacklistRE: normalizedConfig.getBlacklistRE(), + cacheStores: normalizedConfig.cacheStores, cacheVersion: normalizedConfig.cacheVersion, createModuleIdFactory: normalizedConfig.createModuleIdFactory, dynamicDepsInPackages: normalizedConfig.dynamicDepsInPackages, diff --git a/packages/metro/src/legacy.js b/packages/metro/src/legacy.js index dc2d42b6..02450ff1 100644 --- a/packages/metro/src/legacy.js +++ b/packages/metro/src/legacy.js @@ -173,6 +173,7 @@ function toServerOptions(options: Options): ServerOptions { assetRegistryPath: options.assetRegistryPath, asyncRequireModulePath: options.asyncRequireModulePath, blacklistRE: options.blacklistRE, + cacheStores: options.cacheStores, cacheVersion: options.cacheVersion, dynamicDepsInPackages: options.dynamicDepsInPackages, enableBabelRCLookup: options.enableBabelRCLookup, diff --git a/packages/metro/src/shared/types.flow.js b/packages/metro/src/shared/types.flow.js index 2051dfa3..4c776432 100644 --- a/packages/metro/src/shared/types.flow.js +++ b/packages/metro/src/shared/types.flow.js @@ -15,11 +15,15 @@ import type { PostProcessBundleSourcemap, } from '../Bundler'; import type {PostProcessModules} from '../DeltaBundler'; -import type {CustomTransformOptions} from '../JSTransformer/worker'; +import type { + CustomTransformOptions, + TransformedCode, +} from '../JSTransformer/worker'; import type {DynamicRequiresBehavior} from '../ModuleGraph/worker/collectDependencies'; import type {GlobalTransformCache} from '../lib/GlobalTransformCache'; import type {TransformCache} from '../lib/TransformCaching'; import type {Reporter} from '../lib/reporting'; +import type {CacheStore} from 'metro-cache'; import type { MetroSourceMap, MetroSourceMapSegmentTuple, @@ -73,6 +77,7 @@ export type Options = {| +asyncRequireModulePath?: string, +assetRegistryPath: string, blacklistRE?: RegExp, + cacheStores: $ReadOnlyArray>, cacheVersion: string, createModuleIdFactory?: () => (path: string) => number, +dynamicDepsInPackages: DynamicRequiresBehavior,