You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.2 KiB
40 lines
1.2 KiB
"use strict"; |
|
Object.defineProperty(exports, "__esModule", { value: true }); |
|
exports.handleServerOption = void 0; |
|
const immutable_1 = require("immutable"); |
|
function handleServerOption(incoming) { |
|
const value = incoming.get("server"); |
|
if (value === false) { |
|
return [incoming, []]; |
|
} |
|
// server: true |
|
if (value === true) { |
|
const obj = { |
|
baseDir: ["./"] |
|
}; |
|
return [incoming.set("server", (0, immutable_1.fromJS)(obj)), []]; |
|
} |
|
// server: "./app" |
|
if (typeof value === "string") { |
|
const obj = { |
|
baseDir: [value] |
|
}; |
|
return [incoming.set("server", (0, immutable_1.fromJS)(obj)), []]; |
|
} |
|
if (immutable_1.List.isList(value)) { |
|
const obj = { |
|
baseDir: value |
|
}; |
|
return [incoming.set("server", (0, immutable_1.fromJS)(obj)), []]; |
|
} |
|
if (immutable_1.Map.isMap(value)) { |
|
const dirs = (0, immutable_1.List)([]) |
|
.concat(value.get("baseDir", "./")) |
|
.filter(Boolean); |
|
const merged = value.merge({ baseDir: dirs }); |
|
return [incoming.set("server", merged), []]; |
|
} |
|
return [incoming, []]; |
|
} |
|
exports.handleServerOption = handleServerOption; |
|
//# sourceMappingURL=handleServerOption.js.map
|