"use strict";

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

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

var _constants = require("../../shared/constants");

function optionsProcessor(options) {
  const {
    context,
    mode,
    noPublicPath
  } = options;
  const serverExtras = (0, _decidePublicPath.modifiedServerOptions)(options);
  const publicPath = noPublicPath ? undefined : (0, _decidePublicPath.decidePublicPath)(serverExtras);
  const contextFolderPath = (0, _constants.joinWithAppPath)(context);
  const defaultAppliedOptions = { ...options,
    // eslint-disable-next-line no-nested-ternary
    mode: options.mode === null ? 'dev' : mode === 'prod' ? 'prod' : 'dev',
    serverExtras,
    publicPath,
    contextFolderPath,
    httpsOptions: serverExtras.httpsOptions
  };
  return defaultAppliedOptions;
}