Deprecate postProcessModules config param

Reviewed By: mjesun

Differential Revision: D7320671

fbshipit-source-id: 979108f0931f9ee0dd820025782137d4c726d19f
This commit is contained in:
Rafael Oleza 2018-03-20 06:53:37 -07:00 committed by Facebook Github Bot
parent 2d77ecc6c0
commit 5c6bdd35f0
8 changed files with 0 additions and 38 deletions

View File

@ -92,7 +92,6 @@ Given a set of options that you would typically pass to a server, plus a set of
* `getUseGlobalHotkey (() => boolean)`: Method that returns whether the global hotkey should be used or not. Useful especially on Linux servers.
* `maxWorkers (number)`: Maximum amount of workers to use when transforming and bundling. By default it uses an amount computed using the available cores of the processor (approximately 50% of them).
* `platforms (Array<string>)`: Array of platforms supported. Currently you can pass `'ios'` and `'android'` there. This information will be used for bundle generation (both the code included and the format to be served).
* `postProcessModules ((modules, entryPoints) => Array<Module>)`: Allows to post process the list of modules, either by adding, removing or modifying the existing ones.
* `projectRoots (Array<string>)`: List of all directories to look for source files. When asking for a particular bundle, each of the roots will be examined to see if the requested file exists in one of these.
* `reporter (Reporter)`: a reporter instance that will be used to report progress. Various reporters are provided with Metro Bundler,
* `resetCache (boolean)`: Metro bundler holds an internal, persisted cache where all the transformed modules (using the provided transformer in `transformModulePath`) is stored. If the file does not change, the transformed file will be served. When passing `true` to `resetCache`, all of the cache will be thrown away.

View File

@ -25,7 +25,6 @@ const {
toBabelSegments,
} = require('metro-source-map');
import type {PostProcessModules} from '../DeltaBundler';
import type {
TransformedCode,
Options as WorkerOptions,
@ -95,7 +94,6 @@ export type Options = {|
+polyfillModuleNames: Array<string>,
+postMinifyProcess: PostMinifyProcess,
+postProcessBundleSourcemap: PostProcessBundleSourcemap,
+postProcessModules?: PostProcessModules,
+projectRoots: $ReadOnlyArray<string>,
+providesModuleNodeModules?: Array<string>,
+reporter: Reporter,

View File

@ -19,7 +19,6 @@ import type {
PostMinifyProcess,
PostProcessBundleSourcemap,
} from './Bundler';
import type {PostProcessModules} from './DeltaBundler';
import type {TransformedCode} from './JSTransformer/worker';
import type {DynamicRequiresBehavior} from './ModuleGraph/worker/collectDependencies';
import type {IncomingMessage, ServerResponse} from 'http';
@ -129,12 +128,6 @@ export type ConfigT = {
*/
postMinifyProcess: PostMinifyProcess,
/**
* An optional function that can modify the module array before the bundle is
* finalized.
*/
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
@ -184,7 +177,6 @@ const DEFAULT = ({
getPolyfills: () => [],
getUseGlobalHotkey: () => true,
postMinifyProcess: x => x,
postProcessModules: modules => modules,
postProcessBundleSourcemap: ({code, map, outFileName}) => ({code, map}),
getModulesRunBeforeMainModule: () => [],
getWorkerPath: () => null,

View File

@ -20,17 +20,10 @@ import type {
Graph as CalculatorGraph,
Options,
} from './DeltaCalculator';
import type {DeltaEntry} from './DeltaTransformer';
export type PostProcessModules = (
modules: $ReadOnlyArray<DeltaEntry>,
entryFile: string,
) => $ReadOnlyArray<DeltaEntry>;
export type MainOptions = {|
getPolyfills: ({platform: ?string}) => $ReadOnlyArray<string>,
polyfillModuleNames: $ReadOnlyArray<string>,
postProcessModules?: PostProcessModules,
|};
export type Delta = DeltaResult;
@ -139,18 +132,6 @@ class DeltaBundler {
this._deltaCalculators.delete(graph);
}
getPostProcessModulesFn(
entryPoint: string,
): (modules: $ReadOnlyArray<DeltaEntry>) => $ReadOnlyArray<DeltaEntry> {
const postProcessFn = this._options.postProcessModules;
if (!postProcessFn) {
return modules => modules;
}
return entries => postProcessFn(entries, entryPoint);
}
}
module.exports = DeltaBundler;

View File

@ -58,7 +58,6 @@ import type {MetroSourceMap} from 'metro-source-map';
import type {TransformCache} from '../lib/TransformCaching';
import type {Symbolicate} from './symbolicate/symbolicate';
import type {AssetData} from '../Assets';
import type {PostProcessModules} from '../DeltaBundler';
import type {TransformedCode} from '../JSTransformer/worker';
const {
Logger: {createActionStartEntry, createActionEndEntry, log},
@ -104,7 +103,6 @@ class Server {
moduleFormat: string,
platforms: Array<string>,
polyfillModuleNames: Array<string>,
postProcessModules?: PostProcessModules,
postMinifyProcess: PostMinifyProcess,
postProcessBundleSourcemap: PostProcessBundleSourcemap,
projectRoots: $ReadOnlyArray<string>,
@ -174,7 +172,6 @@ class Server {
options.moduleFormat != null ? options.moduleFormat : 'haste',
platforms: options.platforms || defaults.platforms,
polyfillModuleNames: options.polyfillModuleNames || [],
postProcessModules: options.postProcessModules,
postMinifyProcess: options.postMinifyProcess,
postProcessBundleSourcemap: options.postProcessBundleSourcemap,
projectRoots: options.projectRoots,
@ -238,7 +235,6 @@ class Server {
this._deltaBundler = new DeltaBundler(this._bundler, {
getPolyfills: this._opts.getPolyfills,
polyfillModuleNames: this._opts.polyfillModuleNames,
postProcessModules: this._opts.postProcessModules,
});
}

View File

@ -136,7 +136,6 @@ async function runMetro({
minifierPath,
platforms: defaults.platforms.concat(platforms),
postMinifyProcess: normalizedConfig.postMinifyProcess,
postProcessModules: normalizedConfig.postProcessModules,
postProcessBundleSourcemap: normalizedConfig.postProcessBundleSourcemap,
providesModuleNodeModules,
resetCache,

View File

@ -188,7 +188,6 @@ function toServerOptions(options: Options): ServerOptions {
moduleFormat: options.moduleFormat,
platforms: options.platforms,
polyfillModuleNames: options.polyfillModuleNames,
postProcessModules: options.postProcessModules,
postMinifyProcess: options.postMinifyProcess,
postProcessBundleSourcemap: options.postProcessBundleSourcemap,
projectRoots: options.projectRoots,

View File

@ -14,7 +14,6 @@ import type {
PostMinifyProcess,
PostProcessBundleSourcemap,
} from '../Bundler';
import type {PostProcessModules} from '../DeltaBundler';
import type {
CustomTransformOptions,
TransformedCode,
@ -100,7 +99,6 @@ export type Options = {|
moduleFormat?: string,
platforms?: Array<string>,
polyfillModuleNames?: Array<string>,
postProcessModules?: PostProcessModules,
postMinifyProcess: PostMinifyProcess,
postProcessBundleSourcemap: PostProcessBundleSourcemap,
projectRoots: $ReadOnlyArray<string>,