Skip to content

Commit

Permalink
fix: remove lazy and filename options
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroppy committed Apr 28, 2020
1 parent 023c194 commit 51cc950
Show file tree
Hide file tree
Showing 18 changed files with 4 additions and 295 deletions.
5 changes: 0 additions & 5 deletions bin/cli-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ module.exports = {
type: Boolean,
describe: 'Broadcasts the server via ZeroConf networking on start',
},
{
name: 'lazy',
type: Boolean,
describe: 'Lazy',
},
{
name: 'liveReload',
type: Boolean,
Expand Down
4 changes: 0 additions & 4 deletions bin/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ const options = {
type: 'boolean',
describe: 'Broadcasts the server via ZeroConf networking on start',
},
lazy: {
type: 'boolean',
describe: 'Lazy',
},
liveReload: {
type: 'boolean',
describe: 'Enables/Disables live reloading on changing files',
Expand Down
19 changes: 0 additions & 19 deletions examples/cli/lazy/README.md

This file was deleted.

12 changes: 0 additions & 12 deletions examples/cli/lazy/app.js

This file was deleted.

10 changes: 0 additions & 10 deletions examples/cli/lazy/webpack.config.js

This file was deleted.

9 changes: 1 addition & 8 deletions lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ if (!process.env.WEBPACK_DEV_SERVER) {

class Server {
constructor(compiler, options = {}, _log) {
if (options.lazy && !options.filename) {
throw new Error("'filename' option must be set in lazy mode.");
}

validateOptions(schema, options, 'webpack Dev Server');

this.compiler = compiler;
Expand Down Expand Up @@ -758,10 +754,7 @@ class Server {
}

showStatus() {
const suffix =
this.options.inline !== false || this.options.lazy === true
? '/'
: '/webpack-dev-server/';
const suffix = this.options.inline !== false ? '/' : '/webpack-dev-server/';
const uri = `${createDomain(this.options, this.listeningApp)}${suffix}`;

status(
Expand Down
18 changes: 0 additions & 18 deletions lib/options.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,6 @@
"type": "string"
}
},
"filename": {
"anyOf": [
{
"type": "string"
},
{
"instanceof": "RegExp"
},
{
"instanceof": "Function"
}
]
},
"fs": {
"type": "object"
},
Expand Down Expand Up @@ -188,9 +175,6 @@
}
]
},
"lazy": {
"type": "boolean"
},
"liveReload": {
"type": "boolean"
},
Expand Down Expand Up @@ -441,7 +425,6 @@
"contentBase": "should be {Number|String|Array} (https://webpack.js.org/configuration/dev-server/#devservercontentbase)",
"disableHostCheck": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverdisablehostcheck)",
"features": "should be {Array}",
"filename": "should be {String|RegExp|Function} (https://webpack.js.org/configuration/dev-server/#devserverfilename-)",
"fs": "should be {Object} (https://github.com/webpack/webpack-dev-middleware#fs)",
"headers": "should be {Object} (https://webpack.js.org/configuration/dev-server/#devserverheaders-)",
"historyApiFallback": "should be {Boolean|Object} (https://webpack.js.org/configuration/dev-server/#devserverhistoryapifallback)",
Expand All @@ -455,7 +438,6 @@
"injectHot": "should be {Boolean|Function} (https://webpack.js.org/configuration/dev-server/#devserverinjecthot)",
"inline": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverinline)",
"key": "should be {String|Buffer}",
"lazy": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverlazy-)",
"liveReload": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserverlivereload-)",
"log": "should be {Function}",
"logLevel": "should be {String} and equal to one of the allowed values\n\n [ 'info', 'warn', 'error', 'debug', 'trace', 'silent' ]\n\n (https://github.com/webpack/webpack-dev-middleware#loglevel)",
Expand Down
8 changes: 0 additions & 8 deletions lib/utils/createConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ function createConfig(config, argv, { port }) {
}
}

if (!options.filename && firstWpOpt.output && firstWpOpt.output.filename) {
options.filename = firstWpOpt.output && firstWpOpt.output.filename;
}

if (!options.watchOptions && firstWpOpt.watchOptions) {
options.watchOptions = firstWpOpt.watchOptions;
}
Expand Down Expand Up @@ -143,10 +139,6 @@ function createConfig(config, argv, { port }) {
options.stats = Object.assign({}, options.stats, { colors: argv.color });
}

if (argv.lazy) {
options.lazy = true;
}

// TODO remove in `v4`
if (!argv.info) {
options.noInfo = true;
Expand Down
20 changes: 0 additions & 20 deletions test/Validation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,26 +76,6 @@ describe('Validation', () => {
});
});

describe('filename', () => {
afterEach((done) => {
server.close(() => {
done();
});
});

it('should allow filename to be a function', () => {
try {
server = new Server(compiler, { filename: () => {} });
} catch (err) {
if (err === 'ValidationError') {
throw err;
}

throw new Error("Validation failed and it shouldn't");
}
});
});

describe('checkHost', () => {
afterEach((done) => {
server.close(() => {
Expand Down
2 changes: 1 addition & 1 deletion test/__snapshots__/Validation.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ exports[`Validation validation should fail validation for invalid \`writeToDisk\
exports[`Validation validation should fail validation for no additional properties 1`] = `
"Invalid configuration object. Object has been initialized using a configuration object that does not match the API schema.
- configuration has an unknown property 'additional'. These properties are valid:
object { after?, allowedHosts?, before?, bonjour?, ca?, cert?, clientLogLevel?, compress?, contentBasePublicPath?, contentBase?, disableHostCheck?, features?, filename?, fs?, headers?, historyApiFallback?, host?, hot?, hotOnly?, http2?, https?, index?, injectClient?, injectHot?, inline?, key?, lazy?, liveReload?, log?, logLevel?, logTime?, mimeTypes?, noInfo?, onListening?, open?, openPage?, overlay?, pfx?, pfxPassphrase?, port?, profile?, progress?, proxy?, public?, publicPath?, quiet?, reporter?, requestCert?, serveIndex?, serverSideRender?, setup?, sockHost?, sockPath?, sockPort?, socket?, staticOptions?, stats?, transportMode?, useLocalIp?, warn?, watchContentBase?, watchOptions?, writeToDisk? }"
object { after?, allowedHosts?, before?, bonjour?, ca?, cert?, clientLogLevel?, compress?, contentBasePublicPath?, contentBase?, disableHostCheck?, features?, fs?, headers?, historyApiFallback?, host?, hot?, hotOnly?, http2?, https?, index?, injectClient?, injectHot?, inline?, key?, liveReload?, log?, logLevel?, logTime?, mimeTypes?, noInfo?, onListening?, open?, openPage?, overlay?, pfx?, pfxPassphrase?, port?, profile?, progress?, proxy?, public?, publicPath?, quiet?, reporter?, requestCert?, serveIndex?, serverSideRender?, setup?, sockHost?, sockPath?, sockPort?, socket?, staticOptions?, stats?, transportMode?, useLocalIp?, warn?, watchContentBase?, watchOptions?, writeToDisk? }"
`;
2 changes: 0 additions & 2 deletions test/fixtures/schema/webpack.config.no-dev-stats.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ module.exports = {
socket: '_socket',
progress: '_progress',
publicPath: '_publicPath',
filename: '_filename',
hot: '_hot',
hotOnly: '_hotOnly',
clientLogLevel: '_clientLogLevel',
contentBase: '_contentBase',
watchContentBase: '_watchContentBase',
lazy: '_lazy',
noInfo: '_noInfo',
quiet: '_quiet',
https: '_https',
Expand Down
18 changes: 0 additions & 18 deletions test/options.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,6 @@ describe('options', () => {
success: [['before'], []],
failure: [false],
},
filename: {
success: ['', new RegExp(''), () => {}],
failure: [false],
},
fs: {
success: [
{
Expand Down Expand Up @@ -223,20 +219,6 @@ describe('options', () => {
success: ['', Buffer.from('')],
failure: [false],
},
lazy: {
success: [
{
lazy: true,
filename: '.',
},
],
failure: [
{
lazy: '',
filename: '.',
},
],
},
log: {
success: [() => {}],
failure: [''],
Expand Down
1 change: 0 additions & 1 deletion test/ports-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const portsList = {
'http2-option': 1,
'https-option': 1,
'inline-option': 1,
'lazy-option': 1,
'liveReload-option': 1,
'mineTypes-option': 1,
'onListening-option': 1,
Expand Down
30 changes: 0 additions & 30 deletions test/server/lazy-option.test.js

This file was deleted.

2 changes: 1 addition & 1 deletion test/server/open-option.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('open option', () => {
server.close(() => {
expect(open.mock.calls[0]).toMatchInlineSnapshot(`
Array [
"http://localhost:8120/",
"http://localhost:8119/",
Object {
"wait": false,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`WebsocketServer should receive connection, send message, and close client 1`] = `"localhost:8131"`;
exports[`WebsocketServer should receive connection, send message, and close client 1`] = `"localhost:8130"`;

exports[`WebsocketServer should receive connection, send message, and close client 2`] = `
Array [
Expand Down
Loading

0 comments on commit 51cc950

Please sign in to comment.