Skip to content

Commit

Permalink
fix: rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Aug 16, 2021
1 parent 8852916 commit dced920
Showing 1 changed file with 3 additions and 85 deletions.
88 changes: 3 additions & 85 deletions lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,13 @@ class Server {
}

// eslint-disable-next-line class-methods-use-this
normalizeOptions() {
async normalizeOptions() {
const { options } = this;

if (!this.logger) {
this.logger = this.compiler.getInfrastructureLogger("webpack-dev-server");
}

const compilerOptions = this.getCompilerOptions();
// TODO remove `{}` after drop webpack v4 support
const watchOptions = compilerOptions.watchOptions || {};
Expand Down Expand Up @@ -528,7 +528,7 @@ class Server {

return level;
};

if (typeof proxyOptions.logLevel === "undefined") {
proxyOptions.logLevel = getLogLevelForProxy(
compilerOptions.infrastructureLogging
Expand Down Expand Up @@ -1581,28 +1581,6 @@ class Server {
});
}

close(callback) {
if (this.webSocketServer) {
this.webSocketServer.implementation.close();
}

const prom = Promise.all(
this.staticWatchers.map((watcher) => watcher.close())
);
this.staticWatchers = [];

if (this.server) {
this.server.kill(() => {
// watchers must be closed before closing middleware
prom.then(() => {
this.middleware.close(callback);
});
});
} else if (callback) {
callback();
}
}

getStats(statsObj) {
const stats = Server.DEFAULT_STATS;
const compilerOptions = this.getCompilerOptions();
Expand Down Expand Up @@ -1942,66 +1920,6 @@ class Server {
this.stop().then(() => callback(null), callback);
}

// TODO remove in the next major release
listen(port, hostname, fn) {
util.deprecate(
() => {},
"'listen' is deprecated. Please use async 'start' or 'startCallback' methods.",
"DEP_WEBPACK_DEV_SERVER_LISTEN"
)();

this.logger = this.compiler.getInfrastructureLogger("webpack-dev-server");

if (typeof port === "function") {
fn = port;
}

if (
typeof port !== "undefined" &&
typeof this.options.port !== "undefined" &&
port !== this.options.port
) {
this.options.port = port;

this.logger.warn(
'The "port" specified in options is different from the port passed as an argument. Will be used from arguments.'
);
}

if (!this.options.port) {
this.options.port = port;
}

if (
typeof hostname !== "undefined" &&
typeof this.options.host !== "undefined" &&
hostname !== this.options.host
) {
this.options.host = hostname;

this.logger.warn(
'The "host" specified in options is different from the host passed as an argument. Will be used from arguments.'
);
}

if (!this.options.host) {
this.options.host = hostname;
}

return this.start()
.then(() => {
if (fn) {
fn.call(this.server);
}
})
.catch((error) => {
// Nothing
if (fn) {
fn.call(this.server, error);
}
});
}

// TODO remove in the next major release
close(callback) {
util.deprecate(
Expand Down

0 comments on commit dced920

Please sign in to comment.