mirror of https://github.com/status-im/metro.git
packager: runServer: @flow
Summary: This makes it easier to verify correctness when adding new config/args. Reviewed By: davidaurelio Differential Revision: D5069537 fbshipit-source-id: 4d8058851900b23163d0f2744e91dd14dfcdd461
This commit is contained in:
parent
2482fa8956
commit
218cab5e88
|
@ -31,7 +31,7 @@ type Options = {
|
||||||
nonPersistent?: boolean,
|
nonPersistent?: boolean,
|
||||||
postProcessModules?: PostProcessModules,
|
postProcessModules?: PostProcessModules,
|
||||||
postMinifyProcess?: PostMinifyProcess,
|
postMinifyProcess?: PostMinifyProcess,
|
||||||
projectRoots: Array<string>,
|
projectRoots: $ReadOnlyArray<string>,
|
||||||
reporter?: Reporter,
|
reporter?: Reporter,
|
||||||
+sourceExts: ?Array<string>,
|
+sourceExts: ?Array<string>,
|
||||||
+transformModulePath: string,
|
+transformModulePath: string,
|
||||||
|
|
|
@ -128,7 +128,7 @@ type Options = {|
|
||||||
+polyfillModuleNames: Array<string>,
|
+polyfillModuleNames: Array<string>,
|
||||||
+postProcessModules?: PostProcessModules,
|
+postProcessModules?: PostProcessModules,
|
||||||
+postMinifyProcess: PostMinifyProcess,
|
+postMinifyProcess: PostMinifyProcess,
|
||||||
+projectRoots: Array<string>,
|
+projectRoots: $ReadOnlyArray<string>,
|
||||||
+providesModuleNodeModules?: Array<string>,
|
+providesModuleNodeModules?: Array<string>,
|
||||||
+reporter: Reporter,
|
+reporter: Reporter,
|
||||||
+resetCache: boolean,
|
+resetCache: boolean,
|
||||||
|
@ -146,7 +146,7 @@ class Bundler {
|
||||||
_getModuleId: (opts: Module) => number;
|
_getModuleId: (opts: Module) => number;
|
||||||
_transformer: Transformer;
|
_transformer: Transformer;
|
||||||
_resolverPromise: Promise<Resolver>;
|
_resolverPromise: Promise<Resolver>;
|
||||||
_projectRoots: Array<string>;
|
_projectRoots: $ReadOnlyArray<string>;
|
||||||
_assetServer: AssetServer;
|
_assetServer: AssetServer;
|
||||||
_getTransformOptions: void | GetTransformOptions;
|
_getTransformOptions: void | GetTransformOptions;
|
||||||
|
|
||||||
|
@ -785,7 +785,7 @@ class Bundler {
|
||||||
hot: boolean,
|
hot: boolean,
|
||||||
minify: boolean,
|
minify: boolean,
|
||||||
platform: ?string,
|
platform: ?string,
|
||||||
projectRoots: Array<string>,
|
projectRoots: $ReadOnlyArray<string>,
|
||||||
|},
|
|},
|
||||||
): Promise<BundlingOptions> {
|
): Promise<BundlingOptions> {
|
||||||
const getDependencies = (entryFile: string) =>
|
const getDependencies = (entryFile: string) =>
|
||||||
|
|
|
@ -42,7 +42,7 @@ type Options = {|
|
||||||
+postMinifyProcess: PostMinifyProcess,
|
+postMinifyProcess: PostMinifyProcess,
|
||||||
+platforms: Set<string>,
|
+platforms: Set<string>,
|
||||||
+polyfillModuleNames?: Array<string>,
|
+polyfillModuleNames?: Array<string>,
|
||||||
+projectRoots: Array<string>,
|
+projectRoots: $ReadOnlyArray<string>,
|
||||||
+providesModuleNodeModules: Array<string>,
|
+providesModuleNodeModules: Array<string>,
|
||||||
+reporter: Reporter,
|
+reporter: Reporter,
|
||||||
+resetCache: boolean,
|
+resetCache: boolean,
|
||||||
|
|
|
@ -69,7 +69,7 @@ type Options = {
|
||||||
polyfillModuleNames?: Array<string>,
|
polyfillModuleNames?: Array<string>,
|
||||||
postProcessModules?: PostProcessModules,
|
postProcessModules?: PostProcessModules,
|
||||||
postMinifyProcess: PostMinifyProcess,
|
postMinifyProcess: PostMinifyProcess,
|
||||||
projectRoots: Array<string>,
|
projectRoots: $ReadOnlyArray<string>,
|
||||||
providesModuleNodeModules?: Array<string>,
|
providesModuleNodeModules?: Array<string>,
|
||||||
reporter: Reporter,
|
reporter: Reporter,
|
||||||
resetCache?: boolean,
|
resetCache?: boolean,
|
||||||
|
@ -125,7 +125,7 @@ class Server {
|
||||||
polyfillModuleNames: Array<string>,
|
polyfillModuleNames: Array<string>,
|
||||||
postProcessModules?: PostProcessModules,
|
postProcessModules?: PostProcessModules,
|
||||||
postMinifyProcess: PostMinifyProcess,
|
postMinifyProcess: PostMinifyProcess,
|
||||||
projectRoots: Array<string>,
|
projectRoots: $ReadOnlyArray<string>,
|
||||||
providesModuleNodeModules?: Array<string>,
|
providesModuleNodeModules?: Array<string>,
|
||||||
reporter: Reporter,
|
reporter: Reporter,
|
||||||
resetCache: boolean,
|
resetCache: boolean,
|
||||||
|
@ -135,7 +135,7 @@ class Server {
|
||||||
transformTimeoutInterval: ?number,
|
transformTimeoutInterval: ?number,
|
||||||
watch: boolean,
|
watch: boolean,
|
||||||
};
|
};
|
||||||
_projectRoots: Array<string>;
|
_projectRoots: $ReadOnlyArray<string>;
|
||||||
_bundles: {};
|
_bundles: {};
|
||||||
_changeWatchers: Array<{
|
_changeWatchers: Array<{
|
||||||
req: IncomingMessage,
|
req: IncomingMessage,
|
||||||
|
|
|
@ -60,7 +60,7 @@ type Options = {|
|
||||||
+providesModuleNodeModules: Array<string>,
|
+providesModuleNodeModules: Array<string>,
|
||||||
+reporter: Reporter,
|
+reporter: Reporter,
|
||||||
+resetCache: boolean,
|
+resetCache: boolean,
|
||||||
+roots: Array<string>,
|
+roots: $ReadOnlyArray<string>,
|
||||||
+sourceExts: Array<string>,
|
+sourceExts: Array<string>,
|
||||||
+transformCode: TransformCode,
|
+transformCode: TransformCode,
|
||||||
+useWatchman: boolean,
|
+useWatchman: boolean,
|
||||||
|
|
|
@ -41,7 +41,7 @@ class ModuleCache {
|
||||||
_platforms: Set<string>;
|
_platforms: Set<string>;
|
||||||
_transformCode: TransformCode;
|
_transformCode: TransformCode;
|
||||||
_reporter: Reporter;
|
_reporter: Reporter;
|
||||||
_roots: Array<string>;
|
_roots: $ReadOnlyArray<string>;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
{
|
{
|
||||||
|
@ -62,7 +62,7 @@ class ModuleCache {
|
||||||
getTransformCacheKey: GetTransformCacheKey,
|
getTransformCacheKey: GetTransformCacheKey,
|
||||||
globalTransformCache: ?GlobalTransformCache,
|
globalTransformCache: ?GlobalTransformCache,
|
||||||
moduleOptions: ModuleOptions,
|
moduleOptions: ModuleOptions,
|
||||||
roots: Array<string>,
|
roots: $ReadOnlyArray<string>,
|
||||||
reporter: Reporter,
|
reporter: Reporter,
|
||||||
transformCode: TransformCode,
|
transformCode: TransformCode,
|
||||||
|},
|
|},
|
||||||
|
|
|
@ -18,7 +18,7 @@ export type LocalPath = OpaqueLocalPath & string;
|
||||||
|
|
||||||
// FIXME: This function has the shortcoming of potentially returning identical
|
// FIXME: This function has the shortcoming of potentially returning identical
|
||||||
// paths for two files in different roots.
|
// paths for two files in different roots.
|
||||||
function toLocalPath(roots: Array<string>, absolutePath: string): LocalPath {
|
function toLocalPath(roots: $ReadOnlyArray<string>, absolutePath: string): LocalPath {
|
||||||
for (let i = 0; i < roots.length; i++) {
|
for (let i = 0; i < roots.length; i++) {
|
||||||
const localPath = relative(roots[i], absolutePath);
|
const localPath = relative(roots[i], absolutePath);
|
||||||
if (localPath[0] !== '.') {
|
if (localPath[0] !== '.') {
|
||||||
|
|
Loading…
Reference in New Issue