2015-10-05 16:15:09 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
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-01-12 14:23:16 +00:00
|
|
|
function bundleWithOutput(argv, config, 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-01-12 14:23:16 +00:00
|
|
|
return buildBundle(args, config, 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,
|
|
|
|
};
|