webpack-dev-server 4.10.1 → 4.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client/index.js +2 -2
- package/lib/Server.js +25 -27
- package/package.json +3 -2
package/client/index.js
CHANGED
|
@@ -98,12 +98,11 @@ if (parsedResourceQuery.logging) {
|
|
|
98
98
|
if (typeof parsedResourceQuery.reconnect !== "undefined") {
|
|
99
99
|
options.reconnect = Number(parsedResourceQuery.reconnect);
|
|
100
100
|
}
|
|
101
|
-
|
|
102
|
-
logEnabledFeatures(enabledFeatures);
|
|
103
101
|
/**
|
|
104
102
|
* @param {string} level
|
|
105
103
|
*/
|
|
106
104
|
|
|
105
|
+
|
|
107
106
|
function setAllLogLevel(level) {
|
|
108
107
|
// This is needed because the HMR logger operate separately from dev server logger
|
|
109
108
|
webpackHotLog.setLogLevel(level === "verbose" || level === "log" ? "info" : level);
|
|
@@ -114,6 +113,7 @@ if (options.logging) {
|
|
|
114
113
|
setAllLogLevel(options.logging);
|
|
115
114
|
}
|
|
116
115
|
|
|
116
|
+
logEnabledFeatures(enabledFeatures);
|
|
117
117
|
self.addEventListener("beforeunload", function () {
|
|
118
118
|
status.isUnloading = true;
|
|
119
119
|
});
|
package/lib/Server.js
CHANGED
|
@@ -2131,32 +2131,6 @@ class Server {
|
|
|
2131
2131
|
});
|
|
2132
2132
|
}
|
|
2133
2133
|
|
|
2134
|
-
{
|
|
2135
|
-
/**
|
|
2136
|
-
*
|
|
2137
|
-
* @param {Request} req
|
|
2138
|
-
* @param {Response} res
|
|
2139
|
-
* @param {NextFunction} next
|
|
2140
|
-
* @returns {void}
|
|
2141
|
-
*
|
|
2142
|
-
*/
|
|
2143
|
-
const optionsRequestResponseMiddleware = (req, res, next) => {
|
|
2144
|
-
if (req.method === "OPTIONS") {
|
|
2145
|
-
res.statusCode = 204;
|
|
2146
|
-
res.setHeader("Content-Length", "0");
|
|
2147
|
-
res.end();
|
|
2148
|
-
return;
|
|
2149
|
-
}
|
|
2150
|
-
next();
|
|
2151
|
-
};
|
|
2152
|
-
|
|
2153
|
-
middlewares.push({
|
|
2154
|
-
name: "options-middleware",
|
|
2155
|
-
path: "*",
|
|
2156
|
-
middleware: optionsRequestResponseMiddleware,
|
|
2157
|
-
});
|
|
2158
|
-
}
|
|
2159
|
-
|
|
2160
2134
|
middlewares.push({
|
|
2161
2135
|
name: "webpack-dev-middleware",
|
|
2162
2136
|
middleware:
|
|
@@ -2411,6 +2385,28 @@ class Server {
|
|
|
2411
2385
|
});
|
|
2412
2386
|
}
|
|
2413
2387
|
|
|
2388
|
+
// Register this middleware always as the last one so that it's only used as a
|
|
2389
|
+
// fallback when no other middleware responses.
|
|
2390
|
+
middlewares.push({
|
|
2391
|
+
name: "options-middleware",
|
|
2392
|
+
path: "*",
|
|
2393
|
+
/**
|
|
2394
|
+
* @param {Request} req
|
|
2395
|
+
* @param {Response} res
|
|
2396
|
+
* @param {NextFunction} next
|
|
2397
|
+
* @returns {void}
|
|
2398
|
+
*/
|
|
2399
|
+
middleware: (req, res, next) => {
|
|
2400
|
+
if (req.method === "OPTIONS") {
|
|
2401
|
+
res.statusCode = 204;
|
|
2402
|
+
res.setHeader("Content-Length", "0");
|
|
2403
|
+
res.end();
|
|
2404
|
+
return;
|
|
2405
|
+
}
|
|
2406
|
+
next();
|
|
2407
|
+
},
|
|
2408
|
+
});
|
|
2409
|
+
|
|
2414
2410
|
if (typeof this.options.setupMiddlewares === "function") {
|
|
2415
2411
|
middlewares = this.options.setupMiddlewares(middlewares, this);
|
|
2416
2412
|
}
|
|
@@ -2987,12 +2983,14 @@ class Server {
|
|
|
2987
2983
|
// an IPv6-address in URLs,
|
|
2988
2984
|
// these are removed from the hostname in url.parse(),
|
|
2989
2985
|
// so we have the pure IPv6-address in hostname.
|
|
2990
|
-
// always allow localhost
|
|
2986
|
+
// For convenience, always allow localhost (hostname === 'localhost')
|
|
2987
|
+
// and its subdomains (hostname.endsWith(".localhost")).
|
|
2991
2988
|
// allow hostname of listening address (hostname === this.options.host)
|
|
2992
2989
|
const isValidHostname =
|
|
2993
2990
|
(hostname !== null && ipaddr.IPv4.isValid(hostname)) ||
|
|
2994
2991
|
(hostname !== null && ipaddr.IPv6.isValid(hostname)) ||
|
|
2995
2992
|
hostname === "localhost" ||
|
|
2993
|
+
(hostname !== null && hostname.endsWith(".localhost")) ||
|
|
2996
2994
|
hostname === this.options.host;
|
|
2997
2995
|
|
|
2998
2996
|
if (isValidHostname) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webpack-dev-server",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.11.1",
|
|
4
4
|
"description": "Serves a webpack app. Updates the browser on changes.",
|
|
5
5
|
"bin": "bin/webpack-dev-server.js",
|
|
6
6
|
"main": "lib/Server.js",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"p-retry": "^4.5.0",
|
|
68
68
|
"rimraf": "^3.0.2",
|
|
69
69
|
"schema-utils": "^4.0.0",
|
|
70
|
-
"selfsigned": "^2.
|
|
70
|
+
"selfsigned": "^2.1.1",
|
|
71
71
|
"serve-index": "^1.9.1",
|
|
72
72
|
"sockjs": "^0.3.24",
|
|
73
73
|
"spdy": "^4.0.2",
|
|
@@ -86,6 +86,7 @@
|
|
|
86
86
|
"@commitlint/config-conventional": "^16.2.1",
|
|
87
87
|
"@types/compression": "^1.7.2",
|
|
88
88
|
"@types/default-gateway": "^3.0.1",
|
|
89
|
+
"@types/node-forge": "^1.0.4",
|
|
89
90
|
"@types/rimraf": "^3.0.2",
|
|
90
91
|
"@types/sockjs-client": "^1.5.1",
|
|
91
92
|
"@types/trusted-types": "^2.0.2",
|