Pass cacheVersion param via the new API

Reviewed By: BYK

Differential Revision: D6980337

fbshipit-source-id: 72c01136b6720390ffec8593f0375c8756dc1d4a
This commit is contained in:
Rafael Oleza 2018-02-14 08:42:30 -08:00 committed by Facebook Github Bot
parent afa3307659
commit d9b6fd7102
4 changed files with 10 additions and 2 deletions

View File

@ -32,6 +32,12 @@ type Middleware = (IncomingMessage, ServerResponse, ?() => mixed) => mixed;
export type ConfigT = {
assetRegistryPath: string,
/**
* Can be used to generate a key that will invalidate the whole metro cache
* (for example a global dependency version used by the transformer).
*/
cacheVersion: string,
/**
* Called with the Metro middleware in parameter; can be used to wrap this
* middleware inside another one
@ -163,6 +169,7 @@ const DEFAULT = ({
enhanceMiddleware: middleware => middleware,
extraNodeModules: {},
assetTransforms: false,
cacheVersion: '1.0',
dynamicDepsInPackages: 'throwAtRuntime',
getAssetExts: () => [],
getBlacklistRE: () => blacklist(),

View File

@ -121,7 +121,7 @@ class Server {
assetExts: options.assetTransforms ? [] : assetExts,
assetRegistryPath: options.assetRegistryPath,
blacklistRE: options.blacklistRE,
cacheVersion: options.cacheVersion || '1.0',
cacheVersion: options.cacheVersion,
dynamicDepsInPackages: options.dynamicDepsInPackages || 'throwAtRuntime',
createModuleIdFactory: options.createModuleIdFactory,
enableBabelRCLookup:

View File

@ -123,6 +123,7 @@ async function runMetro({
assetExts: normalizedConfig.assetTransforms ? [] : assetExts,
assetRegistryPath: normalizedConfig.assetRegistryPath,
blacklistRE: normalizedConfig.getBlacklistRE(),
cacheVersion: normalizedConfig.cacheVersion,
createModuleIdFactory: normalizedConfig.createModuleIdFactory,
dynamicDepsInPackages: normalizedConfig.dynamicDepsInPackages,
enableBabelRCLookup: normalizedConfig.getEnableBabelRCLookup(),

View File

@ -75,7 +75,7 @@ export type Options = {|
+asyncRequireModulePath?: string,
+assetRegistryPath: string,
blacklistRE?: RegExp,
cacheVersion?: string,
cacheVersion: string,
createModuleIdFactory?: () => (path: string) => number,
+dynamicDepsInPackages: DynamicRequiresBehavior,
enableBabelRCLookup: boolean,