Opal-Estate-Pro/node_modules/browser-sync/dist/public/init.js

33 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-09-13 04:44:33 +02:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var _ = require("../lodash.custom");
var cli_options_1 = require("../cli/cli-options");
/**
* @param {BrowserSync} browserSync
* @param {String} [name] - instance name
* @param {Object} pjson
* @returns {Function}
*/
module.exports = function (browserSync, name, pjson) {
return function () {
/**
* Handle new + old signatures for init.
*/
var args = require("../args")(_.toArray(arguments));
/**
* If the current instance is already running, just return an error
*/
if (browserSync.active) {
return args.cb(new Error("Instance: " + name + " is already running!"));
}
// Env specific items
args.config.version = pjson.version;
args.config.cwd = args.config.cwd || process.cwd();
var _a = cli_options_1.merge(args.config), opts = _a[0], errors = _a[1];
if (errors.length) {
return args.cb(new Error(cli_options_1.printErrors(errors)));
}
return browserSync.init(opts, args.cb);
};
};
//# sourceMappingURL=init.js.map