33 lines
1 KiB
JavaScript
33 lines
1 KiB
JavaScript
|
"use strict";
|
||
|
|
||
|
const { validateOptions, required, isString, isBoolean, isNumber, isFunction, oneOf, allowExtraProperties, arrayOf, either } = require("validatem");
|
||
|
|
||
|
const validateExpressApp = require("./validate-express-app");
|
||
|
const isWritableStream = require("./is-writable-stream");
|
||
|
const isAbsolutePath = require("./is-absolute-path");
|
||
|
|
||
|
module.exports = function validateBudoExpressOptions(_options) {
|
||
|
validateOptions(arguments, {
|
||
|
expressApp: [ required, validateExpressApp ],
|
||
|
port: [ required, isNumber ],
|
||
|
livereloadPattern: [ required, isString ],
|
||
|
browserify: [ required, allowExtraProperties({}) ],
|
||
|
basePath: [ required, isAbsolutePath ],
|
||
|
entryFiles: [ required, either(
|
||
|
isString,
|
||
|
arrayOf(isString)
|
||
|
)],
|
||
|
staticPath: [ required, isString ],
|
||
|
bundlePath: [ required, isString ],
|
||
|
|
||
|
staticPrefix: isString,
|
||
|
host: isString,
|
||
|
allowUnsafeHost: isBoolean,
|
||
|
developmentMode: oneOf([ true, false, "auto" ]),
|
||
|
middleware: arrayOf(isFunction),
|
||
|
stream: isWritableStream,
|
||
|
livereloadPort: isNumber,
|
||
|
sourceMaps: isBoolean
|
||
|
});
|
||
|
};
|