From 05aef26893384cb9dd0e4abb367bcb573f8f50d4 Mon Sep 17 00:00:00 2001 From: Jean Lauliac Date: Tue, 3 Jan 2017 10:52:28 -0800 Subject: [PATCH] packager: enable @flow in bundle/buildBundle.js Reviewed By: cpojer Differential Revision: D4377362 fbshipit-source-id: decd5ff9b245c9dfd4bb9af6e41717ee860fc1ba --- local-cli/bundle/buildBundle.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/local-cli/bundle/buildBundle.js b/local-cli/bundle/buildBundle.js index 60a88411a..df2c19d3a 100644 --- a/local-cli/bundle/buildBundle.js +++ b/local-cli/bundle/buildBundle.js @@ -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';