Skip to content

Commit

Permalink
Custom build options: Move transform options into own property
Browse files Browse the repository at this point in the history
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
  • Loading branch information
davidaurelio authored and facebook-github-bot committed May 9, 2017
1 parent ffbb2a0 commit 8533c0d
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions packager/src/Bundler/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ export type BundlingOptions = {|
+transformer: JSTransformerOptions,
|};

export type ExtraTransformOptions = {|
+inlineRequires?: {+blacklist: {[string]: true}} | boolean,
export type ExtraTransformOptions = {
+preloadedModules?: {[path: string]: true} | false,
+ramGroups?: Array<string>,
|};
+transform?: {+inlineRequires?: {+blacklist: {[string]: true}} | boolean},
};

export type GetTransformOptionsOpts = {|
dev: boolean,
Expand Down Expand Up @@ -799,9 +799,12 @@ class Bundler {
.then(r => r.dependencies.map(d => d.path));

const {dev, hot, platform} = options;
const extraOptions = this._getTransformOptions
const extraOptions: ExtraTransformOptions = this._getTransformOptions
? await this._getTransformOptions(mainModuleName, {dev, hot, platform}, getDependencies)
: {};

const {transform = {}} = extraOptions;

return {
transformer: {
dev,
Expand All @@ -811,7 +814,7 @@ class Bundler {
dev,
generateSourceMaps: options.generateSourceMaps,
hot,
inlineRequires: extraOptions.inlineRequires || false,
inlineRequires: transform.inlineRequires || false,
platform,
projectRoot: options.projectRoots[0],
}
Expand Down

1 comment on commit 8533c0d

@henrikra
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can someone show example on how to use this? Some usecase? :D

Please sign in to comment.