Custom build options: Move transform options into own property

Summary: Moves custom transform options into their own property when returning custom properties. This helps both transitioning to a `select` function as well as implementing RAM bundle support for the new buck integration

Reviewed By: jeanlauliac

Differential Revision: D5028075

fbshipit-source-id: 25fe3072023cc063deef537a12012d4bb3173579
This commit is contained in:
David Aurelio 2017-05-09 13:40:09 -07:00 committed by Facebook Github Bot
parent f12e4ae8a7
commit 4877acd35c
1 changed files with 8 additions and 5 deletions

View File

@ -53,11 +53,11 @@ export type BundlingOptions = {|
+transformer: JSTransformerOptions, +transformer: JSTransformerOptions,
|}; |};
export type ExtraTransformOptions = {| export type ExtraTransformOptions = {
+inlineRequires?: {+blacklist: {[string]: true}} | boolean,
+preloadedModules?: {[path: string]: true} | false, +preloadedModules?: {[path: string]: true} | false,
+ramGroups?: Array<string>, +ramGroups?: Array<string>,
|}; +transform?: {+inlineRequires?: {+blacklist: {[string]: true}} | boolean},
};
export type GetTransformOptionsOpts = {| export type GetTransformOptionsOpts = {|
dev: boolean, dev: boolean,
@ -799,9 +799,12 @@ class Bundler {
.then(r => r.dependencies.map(d => d.path)); .then(r => r.dependencies.map(d => d.path));
const {dev, hot, platform} = options; const {dev, hot, platform} = options;
const extraOptions = this._getTransformOptions const extraOptions: ExtraTransformOptions = this._getTransformOptions
? await this._getTransformOptions(mainModuleName, {dev, hot, platform}, getDependencies) ? await this._getTransformOptions(mainModuleName, {dev, hot, platform}, getDependencies)
: {}; : {};
const {transform = {}} = extraOptions;
return { return {
transformer: { transformer: {
dev, dev,
@ -811,7 +814,7 @@ class Bundler {
dev, dev,
generateSourceMaps: options.generateSourceMaps, generateSourceMaps: options.generateSourceMaps,
hot, hot,
inlineRequires: extraOptions.inlineRequires || false, inlineRequires: transform.inlineRequires || false,
platform, platform,
projectRoot: options.projectRoots[0], projectRoot: options.projectRoots[0],
} }