Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -2382,7 +2382,6 @@ class Server {
* @private
* @returns {void}
*/
// TODO: remove `--web-socket-server` in favor of `--web-socket-server-type`
createWebSocketServer() {
/** @type {WebSocketServerImplementation | undefined | null} */
this.webSocketServer = new /** @type {any} */ (this.getServerTransport())(
Expand Down
15 changes: 9 additions & 6 deletions lib/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -897,12 +897,12 @@
}
},
{
"$ref": "#/definitions/WebSocketServerType"
"enum": ["sockjs", "ws"],
"cli": {
"exclude": true
}
}
],
"cli": {
"description": "Deprecated: please use '--web-socket-server-type' option."
}
]
},
"WebSocketServerFunction": {
"instanceof": "Function"
Expand Down Expand Up @@ -935,7 +935,10 @@
},
"WebSocketServerString": {
"type": "string",
"minLength": 1
"minLength": 1,
"cli": {
"exclude": true
}
}
},
"additionalProperties": false,
Expand Down
1 change: 0 additions & 1 deletion test/cli/__snapshots__/basic.test.js.snap.webpack5
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ Options:
--static-public-path-reset Clear all items provided in 'static.publicPath' configuration. The static files will be available in the browser under this public path.
--watch-files <value...> Allows to configure list of globs/directories/files to watch for file changes.
--watch-files-reset Clear all items provided in 'watchFiles' configuration. Allows to configure list of globs/directories/files to watch for file changes.
--web-socket-server <value> Deprecated: please use '--web-socket-server-type' option. Allows to set web socket server and options (by default 'ws').
--no-web-socket-server Disallows to set web socket server and options.
--web-socket-server-type <value> Allows to set web socket server and options (by default 'ws').

Expand Down
24 changes: 6 additions & 18 deletions test/cli/webSocketServer-option.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,33 @@ const { testBin } = require("../helpers/test-bin");
const port = require("../ports-map")["cli-web-socket-server"];

describe('"webSocketServer" CLI option', () => {
it('should work using "--web-socket-server sockjs"', async () => {
const { exitCode } = await testBin([
"--port",
port,
"--web-socket-server",
"sockjs",
]);

expect(exitCode).toEqual(0);
});

it('should work using "--web-socket-server ws"', async () => {
it('should work using "--web-socket-server-type ws"', async () => {
const { exitCode } = await testBin([
"--port",
port,
"--web-socket-server",
"--web-socket-server-type",
"ws",
]);

expect(exitCode).toEqual(0);
});

it('should work using "--web-socket-server-type ws"', async () => {
it('should work using "--web-socket-server-type sockjs"', async () => {
const { exitCode } = await testBin([
"--port",
port,
"--web-socket-server-type",
"ws",
"sockjs",
]);

expect(exitCode).toEqual(0);
});

it('should work using "--web-socket-server-type sockjs"', async () => {
it('should work using "--no-web-socket-server"', async () => {
const { exitCode } = await testBin([
"--port",
port,
"--web-socket-server-type",
"sockjs",
"--no-web-socket-server",
]);

expect(exitCode).toEqual(0);
Expand Down
16 changes: 9 additions & 7 deletions types/lib/Server.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1291,18 +1291,17 @@ declare class Server {
enum: boolean[];
cli: {
negatedDescription: string;
exclude?: undefined;
};
$ref?: undefined;
}
| {
$ref: string;
enum?: undefined;
cli?: undefined /** @typedef {import("express").Request} Request */;
enum: string[];
cli: {
exclude: boolean;
negatedDescription?: undefined;
};
}
)[];
cli: {
description: string;
};
};
WebSocketServerFunction: {
instanceof: string;
Expand All @@ -1328,6 +1327,9 @@ declare class Server {
WebSocketServerString: {
type: string;
minLength: number;
cli: {
exclude: boolean;
};
};
};
additionalProperties: boolean;
Expand Down