getTransformOptions based on bundle and module

Summary:
Currently, the app server accepts `transformModulePath` which allows us to use different transformation variants. However, these options persist through the lifetime of the server. So we cannot conditionally transform a module differently for two bundles without restarting the server with different options.

`getTransformOptions` basically allows us to change the options to the transformer at runtime based on the bundle and module being transformed.

These options are also used as a cache key for the transformedSource to ensure that if a file is transformed with different options, caching doesn't cause any inconsistencies.

public

Reviewed By: martinbigio

Differential Revision: D2776399

fb-gh-sync-id: 1e0f34d8fa7f0377fcf81f23eb6f3236bd397d56
This commit is contained in:
Bhuwan Khattar
2015-12-21 12:14:33 -08:00
committed by facebook-github-bot-7
parent 4cb775286c
commit 6c02d5b14b
6 changed files with 20 additions and 3 deletions

View File

@@ -112,6 +112,8 @@ middleware. Takes the following options:
should be used as a persistent deamon to watch files and update
itself
* `assetRoots` array: Where should the packager look for assets
* `getTransformOptions` function: Middleware to get custom options for the
transformer based on the bundle and module being transformed.
### ReactPackager.buildPackageFromUrl(options, url)