Skip to content

Commit b319964

Browse files
authored
feat!: remove useLegacyWDSSocket option (#498)
1 parent a56d7a5 commit b319964

File tree

10 files changed

+5
-115
lines changed

10 files changed

+5
-115
lines changed

client/LegacyWDSSocketEntry.js

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

docs/API.md

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ interface ErrorOverlayOptions {
154154
sockPath?: string;
155155
sockPort?: number;
156156
sockProtocol?: 'http' | 'https' | 'ws' | 'wss';
157-
useLegacyWDSSockets?: boolean;
158157
useURLPolyfill?: boolean;
159158
}
160159
```
@@ -269,29 +268,6 @@ Type: `http`, `https`, `ws` or `wss`
269268
Force a protocol for the error overlay to listen for Webpack build messages.
270269
Useful if you want to enforce https communication, or if you're working under a non-HTTP path.
271270

272-
#### `useLegacyWDSSockets`
273-
274-
Default: `undefined`
275-
276-
Type: `boolean`
277-
278-
**This is relevant for `webpack-dev-server` only.**
279-
280-
Wraps the `SockJS` client from `webpack-dev-server` prior to version `3.7.0` to make it compatible with the plugin.
281-
282-
You will also need to install `[email protected]` as a peer dependency with one of the commands below:
283-
284-
```sh
285-
# if you prefer npm
286-
npm install -D [email protected]
287-
288-
# if you prefer yarn
289-
yarn add -D [email protected]
290-
291-
# if you prefer pnpm
292-
pnpm add -D [email protected]
293-
```
294-
295271
#### `useURLPolyfill`
296272

297273
Default: Detected from availability in the global scope

lib/options.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
"sockPath": { "type": "string" },
5151
"sockPort": { "type": "number", "minimum": 0 },
5252
"sockProtocol": { "enum": ["http", "https", "ws", "wss"] },
53-
"useLegacyWDSSockets": { "type": "boolean" },
5453
"useURLPolyfill": { "type": "boolean" }
5554
}
5655
}

lib/types.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
* @property {string} [sockPath] The socket path to use (WDS only).
88
* @property {number} [sockPort] The socket port to use (WDS only).
99
* @property {'http' | 'https' | 'ws' | 'wss'} [sockProtocol] The socket protocol to use (WDS only).
10-
* @property {boolean} [useLegacyWDSSockets] Uses a custom SocketJS implementation for older versions of WDS.
1110
* @property {boolean} [useURLPolyfill] Uses a polyfill for the DOM URL API (WDS only).
1211
*/
1312

lib/utils/getAdditionalEntries.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ function getAdditionalEntries({ devServer, options }) {
5050
];
5151

5252
const overlayEntries = [
53-
// Legacy WDS SockJS integration
54-
options.overlay &&
55-
options.overlay.useLegacyWDSSockets &&
56-
require.resolve('../../client/LegacyWDSSocketEntry'),
5753
// Error overlay runtime
5854
options.overlay &&
5955
options.overlay.entry &&

lib/utils/normalizeOptions.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ const normalizeOptions = (options) => {
3333
d(overlay, 'sockPath');
3434
d(overlay, 'sockPort');
3535
d(overlay, 'sockProtocol');
36-
d(options, 'useLegacyWDSSockets');
3736
d(options, 'useURLPolyfill');
3837

3938
return overlay;

test/unit/getAdditionalEntries.test.js

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,22 +24,6 @@ describe('getAdditionalEntries', () => {
2424
});
2525
});
2626

27-
it('should append legacy WDS entry when required', () => {
28-
expect(
29-
getAdditionalEntries({
30-
options: {
31-
overlay: {
32-
entry: ErrorOverlayEntry,
33-
useLegacyWDSSockets: true,
34-
},
35-
},
36-
})
37-
).toStrictEqual({
38-
overlayEntries: [require.resolve('../../client/LegacyWDSSocketEntry'), ErrorOverlayEntry],
39-
prependEntries: [ReactRefreshEntry],
40-
});
41-
});
42-
4327
it('should append resource queries to the overlay entry when specified in overlay options', () => {
4428
expect(
4529
getAdditionalEntries({

test/unit/normalizeOptions.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ describe('normalizeOptions', () => {
3131
sockPath: '/socket',
3232
sockPort: 9000,
3333
sockProtocol: 'https',
34-
useLegacyWDSSockets: true,
3534
useURLPolyfill: true,
3635
},
3736
})
@@ -48,7 +47,6 @@ describe('normalizeOptions', () => {
4847
sockPath: '/socket',
4948
sockPort: 9000,
5049
sockProtocol: 'https',
51-
useLegacyWDSSockets: true,
5250
useURLPolyfill: true,
5351
},
5452
});

test/unit/validateOptions.test.js

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,11 @@ describe('validateOptions', () => {
145145
}).toThrowErrorMatchingInlineSnapshot(`
146146
"Invalid options object. React Refresh Plugin has been initialized using an options object that does not match the API schema.
147147
- options.overlay should be one of these:
148-
boolean | object { entry?, module?, sockIntegration?, sockHost?, sockPath?, sockPort?, sockProtocol?, useLegacyWDSSockets?, useURLPolyfill? }
148+
boolean | object { entry?, module?, sockIntegration?, sockHost?, sockPath?, sockPort?, sockProtocol?, useURLPolyfill? }
149149
Details:
150150
* options.overlay should be a boolean.
151151
* options.overlay should be an object:
152-
object { entry?, module?, sockIntegration?, sockHost?, sockPath?, sockPort?, sockProtocol?, useLegacyWDSSockets?, useURLPolyfill? }"
152+
object { entry?, module?, sockIntegration?, sockHost?, sockPath?, sockPort?, sockProtocol?, useURLPolyfill? }"
153153
`);
154154
});
155155

@@ -185,7 +185,7 @@ describe('validateOptions', () => {
185185
}).toThrowErrorMatchingInlineSnapshot(`
186186
"Invalid options object. React Refresh Plugin has been initialized using an options object that does not match the API schema.
187187
- options.overlay should be one of these:
188-
boolean | object { entry?, module?, sockIntegration?, sockHost?, sockPath?, sockPort?, sockProtocol?, useLegacyWDSSockets?, useURLPolyfill? }
188+
boolean | object { entry?, module?, sockIntegration?, sockHost?, sockPath?, sockPort?, sockProtocol?, useURLPolyfill? }
189189
Details:
190190
* options.overlay.entry should be one of these:
191191
false | string
@@ -227,7 +227,7 @@ describe('validateOptions', () => {
227227
}).toThrowErrorMatchingInlineSnapshot(`
228228
"Invalid options object. React Refresh Plugin has been initialized using an options object that does not match the API schema.
229229
- options.overlay should be one of these:
230-
boolean | object { entry?, module?, sockIntegration?, sockHost?, sockPath?, sockPort?, sockProtocol?, useLegacyWDSSockets?, useURLPolyfill? }
230+
boolean | object { entry?, module?, sockIntegration?, sockHost?, sockPath?, sockPort?, sockProtocol?, useURLPolyfill? }
231231
Details:
232232
* options.overlay.module should be one of these:
233233
false | string
@@ -293,7 +293,7 @@ describe('validateOptions', () => {
293293
}).toThrowErrorMatchingInlineSnapshot(`
294294
"Invalid options object. React Refresh Plugin has been initialized using an options object that does not match the API schema.
295295
- options.overlay should be one of these:
296-
boolean | object { entry?, module?, sockIntegration?, sockHost?, sockPath?, sockPort?, sockProtocol?, useLegacyWDSSockets?, useURLPolyfill? }
296+
boolean | object { entry?, module?, sockIntegration?, sockHost?, sockPath?, sockPort?, sockProtocol?, useURLPolyfill? }
297297
Details:
298298
* options.overlay.sockIntegration should be one of these:
299299
false | \\"wds\\" | \\"whm\\" | \\"wps\\" | string
@@ -409,33 +409,6 @@ describe('validateOptions', () => {
409409
`);
410410
});
411411

412-
it('should accept "overlay.useLegacyWDSSockets" when it is true', () => {
413-
expect(() => {
414-
new ReactRefreshPlugin({
415-
overlay: { useLegacyWDSSockets: true },
416-
});
417-
}).not.toThrow();
418-
});
419-
420-
it('should accept "overlay.useLegacyWDSSockets" when it is false', () => {
421-
expect(() => {
422-
new ReactRefreshPlugin({
423-
overlay: { useLegacyWDSSockets: false },
424-
});
425-
}).not.toThrow();
426-
});
427-
428-
it('should reject "overlay.useLegacyWDSSockets" when it is not a boolean', () => {
429-
expect(() => {
430-
new ReactRefreshPlugin({
431-
overlay: { useLegacyWDSSockets: 1 },
432-
});
433-
}).toThrowErrorMatchingInlineSnapshot(`
434-
"Invalid options object. React Refresh Plugin has been initialized using an options object that does not match the API schema.
435-
- options.overlay.useLegacyWDSSockets should be a boolean."
436-
`);
437-
});
438-
439412
it('should reject any unknown options', () => {
440413
expect(() => {
441414
new ReactRefreshPlugin({ unknown: true });

types/lib/types.d.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ export type ErrorOverlayOptions = {
2929
* The socket protocol to use (WDS only).
3030
*/
3131
sockProtocol?: 'http' | 'https' | 'ws' | 'wss' | undefined;
32-
/**
33-
* Uses a custom SocketJS implementation for older versions of WDS.
34-
*/
35-
useLegacyWDSSockets?: boolean | undefined;
3632
/**
3733
* Uses a polyfill for the DOM URL API (WDS only).
3834
*/

0 commit comments

Comments
 (0)