Packager postprocessing hook
Reviewed By: davidaurelio Differential Revision: D5244060 fbshipit-source-id: 3f5f9ab9aeeb63eca13d6dab089c2bda42f70c33
This commit is contained in:
parent
83faa4b608
commit
c0505cedf1
|
@ -94,6 +94,7 @@ function buildBundle(
|
|||
platforms: defaultPlatforms.concat(platforms),
|
||||
postMinifyProcess: config.postMinifyProcess,
|
||||
postProcessModules: config.postProcessModules,
|
||||
postProcessBundleSourcemap: config.postProcessBundleSourcemap,
|
||||
projectRoots: config.getProjectRoots(),
|
||||
providesModuleNodeModules: providesModuleNodeModules,
|
||||
resetCache: args.resetCache,
|
||||
|
|
|
@ -20,7 +20,13 @@ const {providesModuleNodeModules} = require('metro-bundler/src/defaults');
|
|||
|
||||
const RN_CLI_CONFIG = 'rn-cli.config.js';
|
||||
|
||||
import type {GetTransformOptions, PostMinifyProcess, PostProcessModules} from 'metro-bundler/src/Bundler';
|
||||
import type {
|
||||
GetTransformOptions,
|
||||
PostMinifyProcess,
|
||||
PostProcessModules,
|
||||
// $FlowFixMe: Exported by metro bundler
|
||||
PostProcessBundleSourcemap
|
||||
} from 'metro-bundler/src/Bundler';
|
||||
import type {HasteImpl} from 'metro-bundler/src/node-haste/Module';
|
||||
import type {TransformVariants} from 'metro-bundler/src/ModuleGraph/types.flow';
|
||||
import type {PostProcessModules as PostProcessModulesForBuck} from 'metro-bundler/src/ModuleGraph/types.flow.js';
|
||||
|
@ -86,7 +92,7 @@ export type ConfigT = {
|
|||
|
||||
/**
|
||||
* An optional function that can modify the code and source map of bundle
|
||||
* after the minifaction took place.
|
||||
* after the minifaction took place. (Function applied per module).
|
||||
*/
|
||||
postMinifyProcess: PostMinifyProcess,
|
||||
|
||||
|
@ -96,6 +102,13 @@ export type ConfigT = {
|
|||
*/
|
||||
postProcessModules: PostProcessModules,
|
||||
|
||||
/**
|
||||
* An optional function that can modify the code and source map of the bundle
|
||||
* before it is written. Applied once for the entire bundle, only works if
|
||||
* output is a plainBundle.
|
||||
*/
|
||||
postProcessBundleSourcemap: PostProcessBundleSourcemap,
|
||||
|
||||
/**
|
||||
* Same as `postProcessModules` but for the Buck worker. Eventually we do want
|
||||
* to unify both variants.
|
||||
|
@ -161,6 +174,7 @@ const Config = {
|
|||
postMinifyProcess: x => x,
|
||||
postProcessModules: modules => modules,
|
||||
postProcessModulesForBuck: modules => modules,
|
||||
postProcessBundleSourcemap: ({code, map, outFileName}) => ({code, map}),
|
||||
transformVariants: () => ({default: {}}),
|
||||
getWorkerPath: () => null,
|
||||
}: ConfigT),
|
||||
|
|
Loading…
Reference in New Issue