@callstack/repack-dev-server
Version:
A bundler-agnostic development server for React Native applications as part of @callstack/repack.
29 lines (28 loc) • 837 B
JavaScript
function normalizeHttpsOptions(serverOptions) {
if (serverOptions &&
typeof serverOptions === 'object' &&
serverOptions.type === 'https') {
return serverOptions.options;
}
return undefined;
}
export function normalizeOptions(options) {
const host = options.host ?? 'localhost';
const port = options.port ?? 8081;
const https = normalizeHttpsOptions(options.server);
const hot = options.hot ?? false;
const protocol = https ? 'https' : 'http';
const url = `${protocol}://${host}:${options.port}`;
return {
// webpack dev server compatible options
host,
port,
https,
hot,
url,
// fastify options
disableRequestLogging: !options.logRequests,
// project options
rootDir: options.rootDir,
};
}