@@ -170,13 +170,13 @@ class Server {
170
170
}
171
171
172
172
// eslint-disable-next-line class-methods-use-this
173
- normalizeOptions ( ) {
173
+ async normalizeOptions ( ) {
174
174
const { options } = this ;
175
175
176
176
if ( ! this . logger ) {
177
177
this . logger = this . compiler . getInfrastructureLogger ( "webpack-dev-server" ) ;
178
178
}
179
-
179
+
180
180
const compilerOptions = this . getCompilerOptions ( ) ;
181
181
// TODO remove `{}` after drop webpack v4 support
182
182
const watchOptions = compilerOptions . watchOptions || { } ;
@@ -528,7 +528,7 @@ class Server {
528
528
529
529
return level ;
530
530
} ;
531
-
531
+
532
532
if ( typeof proxyOptions . logLevel === "undefined" ) {
533
533
proxyOptions . logLevel = getLogLevelForProxy (
534
534
compilerOptions . infrastructureLogging
@@ -1581,28 +1581,6 @@ class Server {
1581
1581
} ) ;
1582
1582
}
1583
1583
1584
- close ( callback ) {
1585
- if ( this . webSocketServer ) {
1586
- this . webSocketServer . implementation . close ( ) ;
1587
- }
1588
-
1589
- const prom = Promise . all (
1590
- this . staticWatchers . map ( ( watcher ) => watcher . close ( ) )
1591
- ) ;
1592
- this . staticWatchers = [ ] ;
1593
-
1594
- if ( this . server ) {
1595
- this . server . kill ( ( ) => {
1596
- // watchers must be closed before closing middleware
1597
- prom . then ( ( ) => {
1598
- this . middleware . close ( callback ) ;
1599
- } ) ;
1600
- } ) ;
1601
- } else if ( callback ) {
1602
- callback ( ) ;
1603
- }
1604
- }
1605
-
1606
1584
getStats ( statsObj ) {
1607
1585
const stats = Server . DEFAULT_STATS ;
1608
1586
const compilerOptions = this . getCompilerOptions ( ) ;
@@ -1942,66 +1920,6 @@ class Server {
1942
1920
this . stop ( ) . then ( ( ) => callback ( null ) , callback ) ;
1943
1921
}
1944
1922
1945
- // TODO remove in the next major release
1946
- listen ( port , hostname , fn ) {
1947
- util . deprecate (
1948
- ( ) => { } ,
1949
- "'listen' is deprecated. Please use async 'start' or 'startCallback' methods." ,
1950
- "DEP_WEBPACK_DEV_SERVER_LISTEN"
1951
- ) ( ) ;
1952
-
1953
- this . logger = this . compiler . getInfrastructureLogger ( "webpack-dev-server" ) ;
1954
-
1955
- if ( typeof port === "function" ) {
1956
- fn = port ;
1957
- }
1958
-
1959
- if (
1960
- typeof port !== "undefined" &&
1961
- typeof this . options . port !== "undefined" &&
1962
- port !== this . options . port
1963
- ) {
1964
- this . options . port = port ;
1965
-
1966
- this . logger . warn (
1967
- 'The "port" specified in options is different from the port passed as an argument. Will be used from arguments.'
1968
- ) ;
1969
- }
1970
-
1971
- if ( ! this . options . port ) {
1972
- this . options . port = port ;
1973
- }
1974
-
1975
- if (
1976
- typeof hostname !== "undefined" &&
1977
- typeof this . options . host !== "undefined" &&
1978
- hostname !== this . options . host
1979
- ) {
1980
- this . options . host = hostname ;
1981
-
1982
- this . logger . warn (
1983
- 'The "host" specified in options is different from the host passed as an argument. Will be used from arguments.'
1984
- ) ;
1985
- }
1986
-
1987
- if ( ! this . options . host ) {
1988
- this . options . host = hostname ;
1989
- }
1990
-
1991
- return this . start ( )
1992
- . then ( ( ) => {
1993
- if ( fn ) {
1994
- fn . call ( this . server ) ;
1995
- }
1996
- } )
1997
- . catch ( ( error ) => {
1998
- // Nothing
1999
- if ( fn ) {
2000
- fn . call ( this . server , error ) ;
2001
- }
2002
- } ) ;
2003
- }
2004
-
2005
1923
// TODO remove in the next major release
2006
1924
close ( callback ) {
2007
1925
util . deprecate (
0 commit comments