Skip to content

Commit

Permalink
packager: enable @flow in bundle/buildBundle.js
Browse files Browse the repository at this point in the history
Reviewed By: cpojer

Differential Revision: D4377362

fbshipit-source-id: decd5ff9b245c9dfd4bb9af6e41717ee860fc1ba
  • Loading branch information
Jean Lauliac authored and facebook-github-bot committed Jan 3, 2017
1 parent 21e8d2a commit 05aef26
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions local-cli/bundle/buildBundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -17,15 +20,26 @@ 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(
output.save(bundle, args, log)
).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';
Expand Down

0 comments on commit 05aef26

Please sign in to comment.