mirror of https://github.com/status-im/metro.git
Pass cacheVersion param via the new API
Reviewed By: BYK Differential Revision: D6980337 fbshipit-source-id: 72c01136b6720390ffec8593f0375c8756dc1d4a
This commit is contained in:
parent
afa3307659
commit
d9b6fd7102
|
@ -32,6 +32,12 @@ type Middleware = (IncomingMessage, ServerResponse, ?() => mixed) => mixed;
|
||||||
export type ConfigT = {
|
export type ConfigT = {
|
||||||
assetRegistryPath: string,
|
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
|
* Called with the Metro middleware in parameter; can be used to wrap this
|
||||||
* middleware inside another one
|
* middleware inside another one
|
||||||
|
@ -163,6 +169,7 @@ const DEFAULT = ({
|
||||||
enhanceMiddleware: middleware => middleware,
|
enhanceMiddleware: middleware => middleware,
|
||||||
extraNodeModules: {},
|
extraNodeModules: {},
|
||||||
assetTransforms: false,
|
assetTransforms: false,
|
||||||
|
cacheVersion: '1.0',
|
||||||
dynamicDepsInPackages: 'throwAtRuntime',
|
dynamicDepsInPackages: 'throwAtRuntime',
|
||||||
getAssetExts: () => [],
|
getAssetExts: () => [],
|
||||||
getBlacklistRE: () => blacklist(),
|
getBlacklistRE: () => blacklist(),
|
||||||
|
|
|
@ -121,7 +121,7 @@ class Server {
|
||||||
assetExts: options.assetTransforms ? [] : assetExts,
|
assetExts: options.assetTransforms ? [] : assetExts,
|
||||||
assetRegistryPath: options.assetRegistryPath,
|
assetRegistryPath: options.assetRegistryPath,
|
||||||
blacklistRE: options.blacklistRE,
|
blacklistRE: options.blacklistRE,
|
||||||
cacheVersion: options.cacheVersion || '1.0',
|
cacheVersion: options.cacheVersion,
|
||||||
dynamicDepsInPackages: options.dynamicDepsInPackages || 'throwAtRuntime',
|
dynamicDepsInPackages: options.dynamicDepsInPackages || 'throwAtRuntime',
|
||||||
createModuleIdFactory: options.createModuleIdFactory,
|
createModuleIdFactory: options.createModuleIdFactory,
|
||||||
enableBabelRCLookup:
|
enableBabelRCLookup:
|
||||||
|
|
|
@ -123,6 +123,7 @@ async function runMetro({
|
||||||
assetExts: normalizedConfig.assetTransforms ? [] : assetExts,
|
assetExts: normalizedConfig.assetTransforms ? [] : assetExts,
|
||||||
assetRegistryPath: normalizedConfig.assetRegistryPath,
|
assetRegistryPath: normalizedConfig.assetRegistryPath,
|
||||||
blacklistRE: normalizedConfig.getBlacklistRE(),
|
blacklistRE: normalizedConfig.getBlacklistRE(),
|
||||||
|
cacheVersion: normalizedConfig.cacheVersion,
|
||||||
createModuleIdFactory: normalizedConfig.createModuleIdFactory,
|
createModuleIdFactory: normalizedConfig.createModuleIdFactory,
|
||||||
dynamicDepsInPackages: normalizedConfig.dynamicDepsInPackages,
|
dynamicDepsInPackages: normalizedConfig.dynamicDepsInPackages,
|
||||||
enableBabelRCLookup: normalizedConfig.getEnableBabelRCLookup(),
|
enableBabelRCLookup: normalizedConfig.getEnableBabelRCLookup(),
|
||||||
|
|
|
@ -75,7 +75,7 @@ export type Options = {|
|
||||||
+asyncRequireModulePath?: string,
|
+asyncRequireModulePath?: string,
|
||||||
+assetRegistryPath: string,
|
+assetRegistryPath: string,
|
||||||
blacklistRE?: RegExp,
|
blacklistRE?: RegExp,
|
||||||
cacheVersion?: string,
|
cacheVersion: string,
|
||||||
createModuleIdFactory?: () => (path: string) => number,
|
createModuleIdFactory?: () => (path: string) => number,
|
||||||
+dynamicDepsInPackages: DynamicRequiresBehavior,
|
+dynamicDepsInPackages: DynamicRequiresBehavior,
|
||||||
enableBabelRCLookup: boolean,
|
enableBabelRCLookup: boolean,
|
||||||
|
|
Loading…
Reference in New Issue