webpack-dev-server 2.6.1 → 2.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -204,6 +204,11 @@ yargs.options({
204
204
  default: "localhost",
205
205
  describe: "The hostname/ip address the server will bind to",
206
206
  group: CONNECTION_GROUP
207
+ },
208
+ "allowed-hosts": {
209
+ type: "string",
210
+ describe: "A comma-delimited string of hosts that are allowed to access the dev server",
211
+ group: CONNECTION_GROUP
207
212
  }
208
213
  });
209
214
 
@@ -233,6 +238,9 @@ function processOptions(wpOpt) {
233
238
  if(argv.host !== "localhost" || !options.host)
234
239
  options.host = argv.host;
235
240
 
241
+ if(argv["allowed-hosts"])
242
+ options.allowedHosts = argv["allowed-hosts"].split(",");
243
+
236
244
  if(argv.public)
237
245
  options.public = argv.public;
238
246
 
@@ -338,9 +346,12 @@ function processOptions(wpOpt) {
338
346
 
339
347
  if(argv["open"] || argv["open-page"]) {
340
348
  options.open = true;
341
- options.openPage = argv["open-page"] || "";
349
+ options.openPage = argv["open-page"];
342
350
  }
343
351
 
352
+ if(options.open && !options.openPage)
353
+ options.openPage = "";
354
+
344
355
  if(argv["useLocalIp"])
345
356
  options.useLocalIp = true;
346
357
 
@@ -440,6 +451,8 @@ function startDevServer(wpOpt, options) {
440
451
 
441
452
  function reportReadiness(uri, options) {
442
453
  const useColor = argv.color;
454
+ const contentBase = Array.isArray(options.contentBase) ? options.contentBase.join(", ") : options.contentBase;
455
+
443
456
  if(!options.quiet) {
444
457
  let startSentence = `Project is running at ${colorInfo(useColor, uri)}`
445
458
  if(options.socket) {
@@ -448,19 +461,21 @@ function reportReadiness(uri, options) {
448
461
  console.log((argv["progress"] ? "\n" : "") + startSentence);
449
462
 
450
463
  console.log(`webpack output is served from ${colorInfo(useColor, options.publicPath)}`);
464
+
465
+ if(contentBase)
466
+ console.log(`Content not from webpack is served from ${colorInfo(useColor, contentBase)}`);
467
+
468
+ if(options.historyApiFallback)
469
+ console.log(`404s will fallback to ${colorInfo(useColor, options.historyApiFallback.index || "/index.html")}`);
470
+
471
+ if(options.bonjour)
472
+ console.log("Broadcasting \"http\" with subtype of \"webpack\" via ZeroConf DNS (Bonjour)");
451
473
  }
452
- const contentBase = Array.isArray(options.contentBase) ? options.contentBase.join(", ") : options.contentBase;
453
- if(contentBase)
454
- console.log(`Content not from webpack is served from ${colorInfo(useColor, contentBase)}`);
455
- if(options.historyApiFallback)
456
- console.log(`404s will fallback to ${colorInfo(useColor, options.historyApiFallback.index || "/index.html")}`);
457
474
  if(options.open) {
458
475
  open(uri + options.openPage).catch(function() {
459
476
  console.log("Unable to open browser. If you are running in a headless environment, please do not use the open flag.");
460
477
  });
461
478
  }
462
- if(options.bonjour)
463
- console.log("Broadcasting \"http\" with subtype of \"webpack\" via ZeroConf DNS (Bonjour)");
464
479
  }
465
480
 
466
481
  function broadcastZeroconf(options) {