packager: enable @flow in bundle/buildBundle.js

Reviewed By: cpojer

Differential Revision: D4377362

fbshipit-source-id: decd5ff9b245c9dfd4bb9af6e41717ee860fc1ba
This commit is contained in:
Jean Lauliac 2017-01-03 10:52:28 -08:00 committed by Facebook Github Bot
parent 21e8d2a47b
commit 05aef26893
1 changed files with 16 additions and 2 deletions

View File

@ -5,7 +5,10 @@
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @flow
*/
'use strict';
const log = require('../util/log').out('bundle');
@ -17,7 +20,8 @@ const path = require('path');
const saveAssets = require('./saveAssets');
const defaultAssetExts = require('../../packager/defaults').assetExts;
import type RequestOptions from './types.flow';
import type {RequestOptions, OutputOptions} from './types.flow';
import type {ConfigT} from '../util/Config';
function saveBundle(output, bundle, args) {
return Promise.resolve(
@ -25,7 +29,17 @@ function saveBundle(output, bundle, args) {
).then(() => bundle);
}
function buildBundle(args, config, output = outputBundle, packagerInstance) {
function buildBundle(
args: OutputOptions & {
assetsDest: mixed,
entryFile: string,
resetCache: boolean,
transformer: string,
},
config: ConfigT,
output = outputBundle,
packagerInstance,
) {
// This is used by a bazillion of npm modules we don't control so we don't
// have other choice than defining it as an env variable here.
process.env.NODE_ENV = args.dev ? 'development' : 'production';