From 11eef69936fabb455271caa870e7fde17460d954 Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Thu, 4 May 2017 08:28:50 -0700 Subject: [PATCH] Force `'default'` transform variant to be present Summary: Enforces a `'default'` property to be present on the transform variant mapping. This will allow us to simplify transforms of assets and json to only provide one variant for the new Buck build system. Reviewed By: jeanlauliac Differential Revision: D5002052 fbshipit-source-id: 2a7240c1b2450f62de686c46ab2c2e5a75dea399 --- local-cli/util/Config.js | 3 ++- packager/src/ModuleGraph/types.flow.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/local-cli/util/Config.js b/local-cli/util/Config.js index 987046bae..5454e2121 100644 --- a/local-cli/util/Config.js +++ b/local-cli/util/Config.js @@ -21,6 +21,7 @@ const RN_CLI_CONFIG = 'rn-cli.config.js'; import type {GetTransformOptions, PostMinifyProcess, PostProcessModules} from '../../packager/src/Bundler'; import type {HasteImpl} from '../../packager/src/node-haste/Module'; +import type {TransformVariants} from '../../packager/src/ModuleGraph/types.flow'; /** * Configuration file of the CLI. @@ -89,7 +90,7 @@ export type ConfigT = { */ hasteImpl?: HasteImpl, - transformVariants: () => {[name: string]: Object}, + transformVariants: () => TransformVariants, }; const defaultConfig: ConfigT = { diff --git a/packager/src/ModuleGraph/types.flow.js b/packager/src/ModuleGraph/types.flow.js index dd1056302..4070f27c3 100644 --- a/packager/src/ModuleGraph/types.flow.js +++ b/packager/src/ModuleGraph/types.flow.js @@ -123,7 +123,7 @@ export type TransformResult = {| export type TransformResults = {[string]: TransformResult}; -export type TransformVariants = {[key: string]: Object}; +export type TransformVariants = {+[name: string]: {}, +default: {}}; export type TransformedCodeFile = { +code: string,