Skip to content

Commit 1973589

Browse files
authored
feat: remove internalIP methods and update references to findIp
1 parent b3efa60 commit 1973589

5 files changed

Lines changed: 8 additions & 36 deletions

File tree

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

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
@@ -113,7 +113,7 @@ describe("web socket server URL", () => {
113113
it(`should work behind proxy, when hostnames are different and ports are same ("${webSocketServer}")`, async () => {
114114
const devServerHost = "127.0.0.1";
115115
const devServerPort = port1;
116-
const proxyHost = Server.internalIPSync("v4");
116+
const proxyHost = Server.findIp("v4", false);
117117
const proxyPort = port1;
118118

119119
const compiler = webpack(config);
@@ -209,7 +209,7 @@ describe("web socket server URL", () => {
209209
it(`should work behind proxy, when hostnames are different and ports are different ("${webSocketServer}")`, async () => {
210210
const devServerHost = "localhost";
211211
const devServerPort = port1;
212-
const proxyHost = Server.internalIPSync("v4");
212+
const proxyHost = Server.findIp("v4", false);
213213
const proxyPort = port2;
214214

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

313-
const proxyHost = Server.internalIPSync("v4");
313+
const proxyHost = Server.findIp("v4", false);
314314
const proxyPort = port2;
315315

316316
const compiler = webpack(config);
@@ -2006,7 +2006,7 @@ describe("web socket server URL", () => {
20062006
});
20072007

20082008
it(`should work when "host" option is IPv4 ("${webSocketServer}")`, async () => {
2009-
const hostname = Server.internalIPSync("v4");
2009+
const hostname = Server.findIp("v4", false);
20102010
const compiler = webpack(config);
20112011
const devServerOptions = {
20122012
webSocketServer,
@@ -2074,7 +2074,7 @@ describe("web socket server URL", () => {
20742074
});
20752075

20762076
it(`should work when "host" option is "local-ip" ("${webSocketServer}")`, async () => {
2077-
const hostname = Server.internalIPSync("v4");
2077+
const hostname = Server.findIp("v4", false);
20782078
const compiler = webpack(config);
20792079
const devServerOptions = {
20802080
webSocketServer,
@@ -2143,7 +2143,7 @@ describe("web socket server URL", () => {
21432143
});
21442144

21452145
it(`should work when "host" option is "local-ipv4" ("${webSocketServer}")`, async () => {
2146-
const hostname = Server.internalIPSync("v4");
2146+
const hostname = Server.findIp("v4", false);
21472147
const compiler = webpack(config);
21482148
const devServerOptions = {
21492149
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)