packager: Fix typing of more Resolver options

Reviewed By: davidaurelio

Differential Revision: D4351879

fbshipit-source-id: aab3eb031ae3137d43d88ad1853aa7e6f5d165c5
This commit is contained in:
Jean Lauliac 2016-12-21 03:39:50 -08:00 committed by Facebook Github Bot
parent b1132a91ab
commit efc12cd5bf
1 changed files with 4 additions and 25 deletions

View File

@ -13,7 +13,6 @@
const DependencyGraph = require('../node-haste'); const DependencyGraph = require('../node-haste');
const declareOpts = require('../lib/declareOpts');
const defaults = require('../../../defaults'); const defaults = require('../../../defaults');
const pathJoin = require('path').join; const pathJoin = require('path').join;
@ -44,25 +43,6 @@ type Options = {
watch?: boolean, watch?: boolean,
}; };
const getDependenciesValidateOpts = declareOpts({
dev: {
type: 'boolean',
default: true,
},
platform: {
type: 'string',
required: false,
},
unbundle: {
type: 'boolean',
default: false,
},
recursive: {
type: 'boolean',
default: true,
},
});
class Resolver { class Resolver {
_depGraph: DependencyGraph; _depGraph: DependencyGraph;
@ -116,12 +96,12 @@ class Resolver {
getDependencies( getDependencies(
entryPath: string, entryPath: string,
options: {}, options: {platform: string, recursive?: boolean},
transformOptions: TransformOptions, transformOptions: TransformOptions,
onProgress?: ?(finishedModules: number, totalModules: number) => mixed, onProgress?: ?(finishedModules: number, totalModules: number) => mixed,
getModuleId: mixed, getModuleId: mixed,
): Promise<ResolutionResponse> { ): Promise<ResolutionResponse> {
const {platform, recursive} = getDependenciesValidateOpts(options); const {platform, recursive = true} = options;
return this._depGraph.getDependencies({ return this._depGraph.getDependencies({
entryPath, entryPath,
platform, platform,
@ -138,10 +118,9 @@ class Resolver {
}); });
} }
getModuleSystemDependencies(options: {}): Array<Module> { getModuleSystemDependencies({dev = true}: {dev?: boolean}): Array<Module> {
const opts = getDependenciesValidateOpts(options);
const prelude = opts.dev const prelude = dev
? pathJoin(__dirname, 'polyfills/prelude_dev.js') ? pathJoin(__dirname, 'polyfills/prelude_dev.js')
: pathJoin(__dirname, 'polyfills/prelude.js'); : pathJoin(__dirname, 'polyfills/prelude.js');