2015-10-05 16:15:09 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
*
|
2018-02-17 02:24:55 +00:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2018-05-11 19:43:49 +00:00
|
|
|
*
|
|
|
|
* @format
|
2015-10-05 16:15:09 +00:00
|
|
|
*/
|
2018-05-11 19:43:49 +00:00
|
|
|
|
2016-11-14 19:12:24 +00:00
|
|
|
'use strict';
|
2015-10-05 16:15:09 +00:00
|
|
|
|
2015-10-20 20:47:41 +00:00
|
|
|
const buildBundle = require('./buildBundle');
|
2016-07-30 15:59:16 +00:00
|
|
|
const bundleCommandLineArgs = require('./bundleCommandLineArgs');
|
2017-11-29 11:00:49 +00:00
|
|
|
const outputBundle = require('metro/src/shared/output/bundle');
|
2015-10-05 16:15:09 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Builds the bundle starting to look for dependencies at the given entry path.
|
|
|
|
*/
|
2018-07-25 12:44:38 +00:00
|
|
|
function bundleWithOutput(argv, configPromise, args, output) {
|
2015-12-01 15:42:44 +00:00
|
|
|
if (!output) {
|
2016-11-07 11:36:51 +00:00
|
|
|
output = outputBundle;
|
2015-12-01 15:42:44 +00:00
|
|
|
}
|
2018-07-25 12:44:38 +00:00
|
|
|
return buildBundle(args, configPromise, output);
|
2015-10-05 16:15:09 +00:00
|
|
|
}
|
|
|
|
|
2016-07-30 15:59:16 +00:00
|
|
|
module.exports = {
|
|
|
|
name: 'bundle',
|
|
|
|
description: 'builds the javascript bundle for offline use',
|
2018-01-12 14:23:16 +00:00
|
|
|
func: bundleWithOutput,
|
2016-07-30 15:59:16 +00:00
|
|
|
options: bundleCommandLineArgs,
|
|
|
|
|
|
|
|
// not used by the CLI itself
|
|
|
|
withOutput: bundleWithOutput,
|
|
|
|
};
|