Skip to content

Commit 763cde1

Browse files
authored
refactor: move overlay option to client (#2888)
BREAKING CHANGE: the `overlay` option was moved into the `client` option
1 parent cee170c commit 763cde1

File tree

5 files changed

+71
-65
lines changed

5 files changed

+71
-65
lines changed

lib/Server.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -567,8 +567,8 @@ class Server {
567567
this.sockWrite([connection], 'progress', this.options.client.progress);
568568
}
569569

570-
if (this.options.clientOverlay) {
571-
this.sockWrite([connection], 'overlay', this.options.clientOverlay);
570+
if (this.options.client.overlay) {
571+
this.sockWrite([connection], 'overlay', this.options.client.overlay);
572572
}
573573

574574
if (!this.stats) {

lib/options.json

+18-19
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,24 @@
8686
},
8787
"progress": {
8888
"type": "boolean"
89+
},
90+
"overlay": {
91+
"anyOf": [
92+
{
93+
"type": "boolean"
94+
},
95+
{
96+
"type": "object",
97+
"properties": {
98+
"errors": {
99+
"type": "boolean"
100+
},
101+
"warnings": {
102+
"type": "boolean"
103+
}
104+
}
105+
}
106+
]
89107
}
90108
},
91109
"additionalProperties": false
@@ -264,24 +282,6 @@
264282
}
265283
]
266284
},
267-
"overlay": {
268-
"anyOf": [
269-
{
270-
"type": "boolean"
271-
},
272-
{
273-
"type": "object",
274-
"properties": {
275-
"errors": {
276-
"type": "boolean"
277-
},
278-
"warnings": {
279-
"type": "boolean"
280-
}
281-
}
282-
}
283-
]
284-
},
285285
"port": {
286286
"anyOf": [
287287
{
@@ -403,7 +403,6 @@
403403
"onListening": "should be {Function} (https://webpack.js.org/configuration/dev-server/#onlistening)",
404404
"open": "should be {String|Boolean|Object} (https://webpack.js.org/configuration/dev-server/#devserveropen)",
405405
"openPage": "should be {String|Array} (https://webpack.js.org/configuration/dev-server/#devserveropenpage)",
406-
"overlay": "should be {Boolean|Object} (https://webpack.js.org/configuration/dev-server/#devserveroverlay)",
407406
"port": "should be {Number|String|Null} (https://webpack.js.org/configuration/dev-server/#devserverport)",
408407
"proxy": "should be {Object|Array} (https://webpack.js.org/configuration/dev-server/#devserverproxy)",
409408
"public": "should be {String} (https://webpack.js.org/configuration/dev-server/#devserverpublic)",

test/Validation.test.js

-4
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,6 @@ describe('Validation', () => {
3333
name: 'invalid `injectHot` configuration',
3434
config: { injectHot: 1 },
3535
},
36-
{
37-
name: 'invalid `overlay` configuration',
38-
config: { overlay: { errors: 1 } },
39-
},
4036
{
4137
name: 'invalid `static` configuration',
4238
config: { static: [0] },

test/__snapshots__/Validation.test.js.snap

+1-6
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ exports[`Validation validation should fail validation for invalid \`injectHot\`
1818
* configuration.injectHot should be an instance of function."
1919
`;
2020

21-
exports[`Validation validation should fail validation for invalid \`overlay\` configuration 1`] = `
22-
"Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
23-
- configuration.overlay.errors should be a boolean."
24-
`;
25-
2621
exports[`Validation validation should fail validation for invalid \`static\` configuration 1`] = `
2722
"Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
2823
- configuration.static should be one of these:
@@ -39,5 +34,5 @@ exports[`Validation validation should fail validation for invalid \`static\` con
3934
exports[`Validation validation should fail validation for no additional properties 1`] = `
4035
"Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
4136
- configuration has an unknown property 'additional'. These properties are valid:
42-
object { bonjour?, client?, compress?, dev?, firewall?, headers?, historyApiFallback?, host?, hot?, http2?, https?, injectClient?, injectHot?, liveReload?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, openPage?, overlay?, port?, proxy?, public?, setupExitSignals?, static?, stdin?, transportMode?, useLocalIp? }"
37+
object { bonjour?, client?, compress?, dev?, firewall?, headers?, historyApiFallback?, host?, hot?, http2?, https?, injectClient?, injectHot?, liveReload?, onAfterSetupMiddleware?, onBeforeSetupMiddleware?, onListening?, open?, openPage?, port?, proxy?, public?, setupExitSignals?, static?, stdin?, transportMode?, useLocalIp? }"
4338
`;

test/options.test.js

+50-34
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,37 @@ describe('options', () => {
207207
progress: false,
208208
},
209209
},
210+
{
211+
client: {
212+
overlay: true,
213+
},
214+
},
215+
{
216+
client: {
217+
overlay: {},
218+
},
219+
},
220+
{
221+
client: {
222+
overlay: {
223+
error: true,
224+
},
225+
},
226+
},
227+
{
228+
client: {
229+
overlay: {
230+
warnings: true,
231+
},
232+
},
233+
},
234+
{
235+
client: {
236+
overlay: {
237+
arbitrary: '',
238+
},
239+
},
240+
},
210241
],
211242
failure: [
212243
'whoops!',
@@ -237,6 +268,25 @@ describe('options', () => {
237268
progress: '',
238269
},
239270
},
271+
{
272+
client: {
273+
overlay: '',
274+
},
275+
},
276+
{
277+
client: {
278+
overlay: {
279+
errors: '',
280+
},
281+
},
282+
},
283+
{
284+
client: {
285+
overlay: {
286+
warnings: '',
287+
},
288+
},
289+
},
240290
],
241291
},
242292
compress: {
@@ -327,40 +377,6 @@ describe('options', () => {
327377
success: [''],
328378
failure: [false],
329379
},
330-
overlay: {
331-
success: [
332-
true,
333-
{},
334-
{
335-
overlay: {
336-
errors: true,
337-
},
338-
},
339-
{
340-
overlay: {
341-
warnings: true,
342-
},
343-
},
344-
{
345-
overlay: {
346-
arbitrary: '',
347-
},
348-
},
349-
],
350-
failure: [
351-
'',
352-
{
353-
overlay: {
354-
errors: '',
355-
},
356-
},
357-
{
358-
overlay: {
359-
warnings: '',
360-
},
361-
},
362-
],
363-
},
364380
port: {
365381
success: ['', 0, null],
366382
failure: [false],

0 commit comments

Comments
 (0)