Move Option types from Server to shared/types.flow

Reviewed By: davidaurelio

Differential Revision: D6384292

fbshipit-source-id: 58cba889f549cbd7a8c82856d5283048f4f2a8c5
This commit is contained in:
Peter van der Zee 2017-11-22 03:36:57 -08:00 committed by Facebook Github Bot
parent 1017f8ab7e
commit efceeacd77
9 changed files with 70 additions and 59 deletions

View File

@ -20,9 +20,9 @@ const {EventEmitter} = require('events');
import type Bundler from '../Bundler';
import type {Options as JSTransformerOptions} from '../JSTransformer/worker';
import type {BundleOptions} from '../Server';
import type DependencyGraph from '../node-haste/DependencyGraph';
import type Module from '../node-haste/Module';
import type {BundleOptions} from '../shared/types.flow';
export type DeltaResult = {|
+modified: Map<string, Module>,

View File

@ -18,8 +18,8 @@ const {fromRawMappings} = require('../Bundler/source-map');
const {createRamBundleGroups} = require('../Bundler/util');
import type {AssetData} from '../AssetServer';
import type {BundleOptions} from '../Server';
import type {MappingsMap} from '../lib/SourceMap';
import type {BundleOptions} from '../shared/types.flow';
import type {ModuleTransportLike} from '../shared/types.flow';
import type DeltaBundler, {Options as BuildOptions} from './';
import type DeltaTransformer, {

View File

@ -15,7 +15,7 @@
const DeltaTransformer = require('./DeltaTransformer');
import type Bundler from '../Bundler';
import type {BundleOptions} from '../Server';
import type {BundleOptions} from '../shared/types.flow';
import type {DeltaEntry} from './DeltaTransformer';
export type PostProcessModules = (

View File

@ -33,13 +33,13 @@ import type {HasteImpl} from '../node-haste/Module';
import type {IncomingMessage, ServerResponse} from 'http';
import type {Reporter} from '../lib/reporting';
import type {Options as DeltaBundlerOptions} from '../DeltaBundler/Serializers';
import type {BundleOptions, Options} from '../shared/types.flow';
import type {
GetTransformOptions,
PostMinifyProcess,
PostProcessBundleSourcemap,
} from '../Bundler';
import type {TransformCache} from '../lib/TransformCaching';
import type {GlobalTransformCache} from '../lib/GlobalTransformCache';
import type {SourceMap, Symbolicate} from './symbolicate';
import type {AssetData} from '../AssetServer';
import type {RamBundleInfo} from '../DeltaBundler/Serializers';
@ -64,57 +64,6 @@ function debounceAndBatch(fn, delay) {
};
}
export type Options = {|
assetExts?: Array<string>,
+assetRegistryPath: string,
blacklistRE?: RegExp,
cacheVersion?: string,
enableBabelRCLookup?: boolean,
extraNodeModules?: {},
getPolyfills: ({platform: ?string}) => $ReadOnlyArray<string>,
getTransformOptions?: GetTransformOptions,
globalTransformCache: ?GlobalTransformCache,
hasteImpl?: HasteImpl,
maxWorkers?: number,
moduleFormat?: string,
platforms?: Array<string>,
polyfillModuleNames?: Array<string>,
postProcessModules?: PostProcessModules,
postMinifyProcess: PostMinifyProcess,
postProcessBundleSourcemap: PostProcessBundleSourcemap,
projectRoots: $ReadOnlyArray<string>,
providesModuleNodeModules?: Array<string>,
reporter?: Reporter,
resetCache?: boolean,
+getModulesRunBeforeMainModule: (entryPoint: string) => Array<string>,
silent?: boolean,
+sourceExts: ?Array<string>,
+transformCache: TransformCache,
transformModulePath?: string,
watch?: boolean,
workerPath: ?string,
|};
export type BundleOptions = {
+assetPlugins: Array<string>,
dev: boolean,
entryFile: string,
+entryModuleOnly: boolean,
+excludeSource: boolean,
+generateSourceMaps: boolean,
+hot: boolean,
+inlineSourceMap: boolean,
+isolateModuleIDs: boolean,
minify: boolean,
onProgress: ?(doneCont: number, totalCount: number) => mixed,
+platform: ?string,
+resolutionResponse: ?{},
+runBeforeMainModule: Array<string>,
+runModule: boolean,
sourceMapUrl: ?string,
unbundle: boolean,
};
const FILES_CHANGED_COUNT_HEADER = 'X-Metro-Files-Changed-Count';
class Server {

View File

@ -40,7 +40,7 @@ import type {Server as HttpServer} from 'http';
import type {Server as HttpsServer} from 'https';
import type {ConfigT} from './Config';
import type {Options as ServerOptions} from './Server';
import type {Options as ServerOptions} from './shared/types.flow';
import type {RequestOptions, OutputOptions} from './shared/types.flow.js';
export type {ConfigT} from './Config';

View File

@ -23,8 +23,9 @@ const invariant = require('fbjs/lib/invariant');
const {fromRawMappings, compactMapping} = require('./Bundler/source-map');
import type {ConfigT as MetroConfig} from './Config';
import type Server, {Options as ServerOptions} from './Server';
import type Server from './Server';
import type {TransformCache} from './lib/TransformCaching';
import type {Options as ServerOptions} from './shared/types.flow';
exports.createBlacklist = blacklist;
exports.sourceMaps = {fromRawMappings, compactMapping};

View File

@ -23,7 +23,7 @@ const {
AmbiguousModuleResolutionError,
} = require('../node-haste/DependencyGraph/ResolutionRequest');
import type {BundleOptions} from '../Server';
import type {BundleOptions} from '../shared/types.flow';
import type Terminal from './Terminal';
import type {ReportableEvent, GlobalCacheDisabledReason} from './reporting';

View File

@ -15,7 +15,7 @@
const chalk = require('chalk');
const util = require('util');
import type {BundleOptions} from '../Server';
import type {BundleOptions} from '../shared/types.flow';
import type Terminal from './Terminal';
export type GlobalCacheDisabledReason = 'too_many_errors' | 'too_many_misses';

View File

@ -12,10 +12,40 @@
'use strict';
import type {RawMapping} from '../Bundler/source-map';
import type {
GetTransformOptions,
PostMinifyProcess,
PostProcessBundleSourcemap,
} from '../Bundler';
import type {PostProcessModules} from '../DeltaBundler';
import type {GlobalTransformCache} from '../lib/GlobalTransformCache';
import type {SourceMap} from '../lib/SourceMap';
import type {TransformCache} from '../lib/TransformCaching';
import type {Reporter} from '../lib/reporting';
import type {HasteImpl} from '../node-haste/Module';
type SourceMapOrMappings = SourceMap | Array<RawMapping>;
export type BundleOptions = {
+assetPlugins: Array<string>,
dev: boolean,
entryFile: string,
+entryModuleOnly: boolean,
+excludeSource: boolean,
+generateSourceMaps: boolean,
+hot: boolean,
+inlineSourceMap: boolean,
+isolateModuleIDs: boolean,
minify: boolean,
onProgress: ?(doneCont: number, totalCount: number) => mixed,
+platform: ?string,
+resolutionResponse: ?{},
+runBeforeMainModule: Array<string>,
+runModule: boolean,
sourceMapUrl: ?string,
unbundle: boolean,
};
export type ModuleGroups = {|
groups: Map<number, Set<number>>,
modulesById: Map<number, ModuleTransportLike>,
@ -30,6 +60,37 @@ export type ModuleTransportLike = {
+sourcePath: string,
};
export type Options = {|
assetExts?: Array<string>,
+assetRegistryPath: string,
blacklistRE?: RegExp,
cacheVersion?: string,
enableBabelRCLookup?: boolean,
extraNodeModules?: {},
getPolyfills: ({platform: ?string}) => $ReadOnlyArray<string>,
getTransformOptions?: GetTransformOptions,
globalTransformCache: ?GlobalTransformCache,
hasteImpl?: HasteImpl,
maxWorkers?: number,
moduleFormat?: string,
platforms?: Array<string>,
polyfillModuleNames?: Array<string>,
postProcessModules?: PostProcessModules,
postMinifyProcess: PostMinifyProcess,
postProcessBundleSourcemap: PostProcessBundleSourcemap,
projectRoots: $ReadOnlyArray<string>,
providesModuleNodeModules?: Array<string>,
reporter?: Reporter,
resetCache?: boolean,
+getModulesRunBeforeMainModule: (entryPoint: string) => Array<string>,
silent?: boolean,
+sourceExts: ?Array<string>,
+transformCache: TransformCache,
transformModulePath?: string,
watch?: boolean,
workerPath: ?string,
|};
export type OutputOptions = {
bundleOutput: string,
bundleEncoding?: 'utf8' | 'utf16le' | 'ascii',