"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.optionsProcesser = optionsProcesser;

var _path = require("path");

var _decidePublicPath = require("../../shared/bundler/webpack/common/decidePublicPath");

var _urlConcat = require("../../shared/server/urlConcat");

function optionsProcesser(options) {
  const {
    server,
    context
  } = options;
  const {
    disableContextURL
  } = server;
  const serverExtras = (0, _decidePublicPath.modifiedServerOptions)(options);
  const publicPath = (0, _decidePublicPath.decidePublicPath)(serverExtras);
  const contextURL = disableContextURL ? '' : `/${context}`;
  const serverURL = (0, _urlConcat.urlConcat)(publicPath, contextURL);
  const contextFolderPath = (0, _path.join)(process.cwd(), context);
  const defaultApplyedOptions = { ...options,
    serverExtras,
    publicPath,
    contextURL,
    serverURL,
    contextFolderPath,
    httpsOptions: serverExtras.httpsOptions
  };
  return defaultApplyedOptions;
}