packager: enable @flow in bundle/buildBundle.js
Reviewed By: cpojer Differential Revision: D4377362 fbshipit-source-id: decd5ff9b245c9dfd4bb9af6e41717ee860fc1ba
This commit is contained in:
parent
21e8d2a47b
commit
05aef26893
|
@ -5,7 +5,10 @@
|
||||||
* This source code is licensed under the BSD-style license found in the
|
* 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
|
* 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.
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||||||
|
*
|
||||||
|
* @flow
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const log = require('../util/log').out('bundle');
|
const log = require('../util/log').out('bundle');
|
||||||
|
@ -17,7 +20,8 @@ const path = require('path');
|
||||||
const saveAssets = require('./saveAssets');
|
const saveAssets = require('./saveAssets');
|
||||||
const defaultAssetExts = require('../../packager/defaults').assetExts;
|
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) {
|
function saveBundle(output, bundle, args) {
|
||||||
return Promise.resolve(
|
return Promise.resolve(
|
||||||
|
@ -25,7 +29,17 @@ function saveBundle(output, bundle, args) {
|
||||||
).then(() => bundle);
|
).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
|
// 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.
|
// have other choice than defining it as an env variable here.
|
||||||
process.env.NODE_ENV = args.dev ? 'development' : 'production';
|
process.env.NODE_ENV = args.dev ? 'development' : 'production';
|
||||||
|
|
Loading…
Reference in New Issue