Skip to content

Commit 6b6c081

Browse files
committed
Merge branch 'next' of github.com:webpack/webpack-dev-server into sockjs-remove
2 parents ea76289 + 09bdda5 commit 6b6c081

File tree

10 files changed

+33
-74
lines changed

10 files changed

+33
-74
lines changed
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# internalIP(family: "v4" | "v6")
1+
# findIp(family: "v4" | "v6")
22

3-
Returns the internal IP address asynchronously.
3+
Returns the internal IP address.
44

55
```js
66
const WebpackDevServer = require("webpack-dev-server");
77

88
const logInternalIPs = async () => {
9-
const localIPv4 = await WebpackDevServer.internalIP("v4");
10-
const localIPv6 = await WebpackDevServer.internalIP("v6");
9+
const localIPv4 = WebpackDevServer.findIp("v4", false);
10+
const localIPv6 = WebpackDevServer.findIp("v6", false);
1111

1212
console.log("Local IPv4 address:", localIPv4);
1313
console.log("Local IPv6 address:", localIPv6);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
const WebpackDevServer = require("../../../lib/Server");
44

55
const logInternalIPs = async () => {
6-
const localIPv4 = await WebpackDevServer.internalIP("v4");
7-
const localIPv6 = await WebpackDevServer.internalIP("v6");
6+
const localIPv4 = WebpackDevServer.findIp("v4", false);
7+
const localIPv6 = WebpackDevServer.findIp("v6", false);
88

99
console.log("Local IPv4 address:", localIPv4);
1010
console.log("Local IPv6 address:", localIPv6);

examples/api/internal-ip-sync/README.md

Lines changed: 0 additions & 23 deletions
This file was deleted.

examples/api/internal-ip-sync/app.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

lib/Server.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -475,24 +475,6 @@ class Server {
475475
}
476476
}
477477

478-
// TODO remove me in the next major release, we have `findIp`
479-
/**
480-
* @param {"v4" | "v6"} family family
481-
* @returns {Promise<string | undefined>} internal API
482-
*/
483-
static async internalIP(family) {
484-
return Server.findIp(family, false);
485-
}
486-
487-
// TODO remove me in the next major release, we have `findIp`
488-
/**
489-
* @param {"v4" | "v6"} family family
490-
* @returns {string | undefined} internal IP
491-
*/
492-
static internalIPSync(family) {
493-
return Server.findIp(family, false);
494-
}
495-
496478
/**
497479
* @param {Host} hostname hostname
498480
* @returns {Promise<string>} resolved hostname

migration-v6.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Migration guide
2+
3+
This document serves as a migration guide for `[email protected]`.
4+
5+
## Deprecations
6+
7+
- The static methods `internalIP` and `internalIPSync` were removed. Use `findIp` instead.
8+
9+
v4:
10+
11+
```js
12+
const ip = Server.internalIP("v4");
13+
```
14+
15+
v5:
16+
17+
```js
18+
const ip = Server.findIp("v4", true);
19+
```

test/e2e/allowed-hosts.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1657,7 +1657,7 @@ describe("allowed hosts", () => {
16571657
});
16581658

16591659
it("should always allow value from the `host` options if options.allowedHosts is auto", async () => {
1660-
const networkIP = Server.internalIPSync("v4");
1660+
const networkIP = Server.findIp("v4", false);
16611661
const options = {
16621662
host: networkIP,
16631663
allowedHosts: "auto",

test/e2e/web-socket-server-url.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ describe("web socket server URL", () => {
105105
it(`should work behind proxy, when hostnames are different and ports are same ("${webSocketServer}")`, async () => {
106106
const devServerHost = "127.0.0.1";
107107
const devServerPort = port1;
108-
const proxyHost = Server.internalIPSync("v4");
108+
const proxyHost = Server.findIp("v4", false);
109109
const proxyPort = port1;
110110

111111
const compiler = webpack(config);
@@ -193,7 +193,7 @@ describe("web socket server URL", () => {
193193
it(`should work behind proxy, when hostnames are different and ports are different ("${webSocketServer}")`, async () => {
194194
const devServerHost = "localhost";
195195
const devServerPort = port1;
196-
const proxyHost = Server.internalIPSync("v4");
196+
const proxyHost = Server.findIp("v4", false);
197197
const proxyPort = port2;
198198

199199
const compiler = webpack(config);
@@ -286,7 +286,7 @@ describe("web socket server URL", () => {
286286
it(`should work behind proxy, when the "host" option is "local-ip" and the "port" option is "auto" ("${webSocketServer}")`, async () => {
287287
process.env.WEBPACK_DEV_SERVER_BASE_PORT = 40000;
288288

289-
const proxyHost = Server.internalIPSync("v4");
289+
const proxyHost = Server.findIp("v4", false);
290290
const proxyPort = port2;
291291

292292
const compiler = webpack(config);
@@ -1788,7 +1788,7 @@ describe("web socket server URL", () => {
17881788
});
17891789

17901790
it(`should work when "host" option is IPv4 ("${webSocketServer}")`, async () => {
1791-
const hostname = Server.internalIPSync("v4");
1791+
const hostname = Server.findIp("v4", false);
17921792
const compiler = webpack(config);
17931793
const devServerOptions = {
17941794
webSocketServer,
@@ -1848,7 +1848,7 @@ describe("web socket server URL", () => {
18481848
});
18491849

18501850
it(`should work when "host" option is "local-ip" ("${webSocketServer}")`, async () => {
1851-
const hostname = Server.internalIPSync("v4");
1851+
const hostname = Server.findIp("v4", false);
18521852
const compiler = webpack(config);
18531853
const devServerOptions = {
18541854
webSocketServer,
@@ -1909,7 +1909,7 @@ describe("web socket server URL", () => {
19091909
});
19101910

19111911
it(`should work when "host" option is "local-ipv4" ("${webSocketServer}")`, async () => {
1912-
const hostname = Server.internalIPSync("v4");
1912+
const hostname = Server.findIp("v4", false);
19131913
const compiler = webpack(config);
19141914
const devServerOptions = {
19151915
webSocketServer,

test/server/open-option.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const Server = require("../../lib/Server");
55
const config = require("../fixtures/simple-config/webpack.config");
66
const port = require("../ports-map")["open-option"];
77

8-
const internalIPv4 = Server.internalIPSync("v4");
8+
const internalIPv4 = Server.findIp("v4", false);
99

1010
let open;
1111

types/lib/Server.d.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,16 +1141,6 @@ declare class Server<
11411141
gatewayOrFamily: string,
11421142
isInternal?: boolean | undefined,
11431143
): string | undefined;
1144-
/**
1145-
* @param {"v4" | "v6"} family family
1146-
* @returns {Promise<string | undefined>} internal API
1147-
*/
1148-
static internalIP(family: "v4" | "v6"): Promise<string | undefined>;
1149-
/**
1150-
* @param {"v4" | "v6"} family family
1151-
* @returns {string | undefined} internal IP
1152-
*/
1153-
static internalIPSync(family: "v4" | "v6"): string | undefined;
11541144
/**
11551145
* @param {Host} hostname hostname
11561146
* @returns {Promise<string>} resolved hostname

0 commit comments

Comments
 (0)