lunaisadev-website-old/node_modules/browser-sync/dist/cli/transforms/handleServerOption.js

39 lines
1.2 KiB
JavaScript
Raw Normal View History

2021-07-28 01:40:12 +00:00
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var immutable_1 = require("immutable");
function handleServerOption(incoming) {
var value = incoming.get("server");
if (value === false) {
return [incoming, []];
}
// server: true
if (value === true) {
var obj = {
baseDir: ["./"]
};
return [incoming.set("server", immutable_1.fromJS(obj)), []];
}
// server: "./app"
if (typeof value === "string") {
var obj = {
baseDir: [value]
};
return [incoming.set("server", immutable_1.fromJS(obj)), []];
}
if (immutable_1.List.isList(value)) {
var obj = {
baseDir: value
};
return [incoming.set("server", immutable_1.fromJS(obj)), []];
}
if (immutable_1.Map.isMap(value)) {
var dirs = immutable_1.List([])
.concat(value.get("baseDir", "./"))
.filter(Boolean);
var merged = value.merge({ baseDir: dirs });
return [incoming.set("server", merged), []];
}
return [incoming, []];
}
exports.handleServerOption = handleServerOption;
//# sourceMappingURL=handleServerOption.js.map