mirror of https://github.com/status-im/metro.git
react-packager/index.js: @flow
Reviewed By: cpojer Differential Revision: D4036668 fbshipit-source-id: 286963fd1f18f92389ec642c43dcf4c9d55f19f8
This commit is contained in:
parent
6ac3ae73a3
commit
2a1c443a36
|
@ -5,6 +5,8 @@
|
||||||
* 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';
|
||||||
|
|
||||||
|
@ -15,9 +17,15 @@ require('./src/node-haste/fastpath').replace();
|
||||||
var debug = require('debug');
|
var debug = require('debug');
|
||||||
var Activity = require('./src/Activity');
|
var Activity = require('./src/Activity');
|
||||||
|
|
||||||
|
type Options = {
|
||||||
|
nonPersistent: boolean,
|
||||||
|
verbose: boolean,
|
||||||
|
}
|
||||||
|
|
||||||
exports.createServer = createServer;
|
exports.createServer = createServer;
|
||||||
exports.Activity = Activity;
|
exports.Activity = Activity;
|
||||||
exports.getOrderedDependencyPaths = function(options, bundleOptions) {
|
|
||||||
|
exports.getOrderedDependencyPaths = function(options: Options, bundleOptions: mixed) {
|
||||||
var server = createNonPersistentServer(options);
|
var server = createNonPersistentServer(options);
|
||||||
return server.getOrderedDependencyPaths(bundleOptions)
|
return server.getOrderedDependencyPaths(bundleOptions)
|
||||||
.then(function(paths) {
|
.then(function(paths) {
|
||||||
|
@ -40,7 +48,7 @@ function enableDebug() {
|
||||||
debug.enable(debugPattern);
|
debug.enable(debugPattern);
|
||||||
}
|
}
|
||||||
|
|
||||||
function createServer(options) {
|
function createServer(options: Options) {
|
||||||
// the debug module is configured globally, we need to enable debugging
|
// the debug module is configured globally, we need to enable debugging
|
||||||
// *before* requiring any packages that use `debug` for logging
|
// *before* requiring any packages that use `debug` for logging
|
||||||
if (options.verbose) {
|
if (options.verbose) {
|
||||||
|
@ -51,7 +59,7 @@ function createServer(options) {
|
||||||
return new Server(omit(options, ['verbose']));
|
return new Server(omit(options, ['verbose']));
|
||||||
}
|
}
|
||||||
|
|
||||||
function createNonPersistentServer(options) {
|
function createNonPersistentServer(options: Options) {
|
||||||
Activity.disable();
|
Activity.disable();
|
||||||
// Don't start the filewatcher or the cache.
|
// Don't start the filewatcher or the cache.
|
||||||
if (options.nonPersistent == null) {
|
if (options.nonPersistent == null) {
|
||||||
|
|
Loading…
Reference in New Issue