Last change
on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | 'use strict';
|
---|
2 |
|
---|
3 | const logger = require('webpack-log');
|
---|
4 | const colors = require('./colors');
|
---|
5 | const runOpen = require('./runOpen');
|
---|
6 |
|
---|
7 | // TODO: don't emit logs when webpack-dev-server is used via Node.js API
|
---|
8 | function status(uri, options, log, useColor) {
|
---|
9 | if (options.quiet === true) {
|
---|
10 | // Add temporary logger to output just the status of the dev server
|
---|
11 | log = logger({
|
---|
12 | name: 'wds',
|
---|
13 | level: 'info',
|
---|
14 | timestamp: options.logTime,
|
---|
15 | });
|
---|
16 | }
|
---|
17 |
|
---|
18 | const contentBase = Array.isArray(options.contentBase)
|
---|
19 | ? options.contentBase.join(', ')
|
---|
20 | : options.contentBase;
|
---|
21 |
|
---|
22 | if (options.socket) {
|
---|
23 | log.info(`Listening to socket at ${colors.info(useColor, options.socket)}`);
|
---|
24 | } else {
|
---|
25 | log.info(`Project is running at ${colors.info(useColor, uri)}`);
|
---|
26 | }
|
---|
27 |
|
---|
28 | log.info(
|
---|
29 | `webpack output is served from ${colors.info(useColor, options.publicPath)}`
|
---|
30 | );
|
---|
31 |
|
---|
32 | if (contentBase) {
|
---|
33 | log.info(
|
---|
34 | `Content not from webpack is served from ${colors.info(
|
---|
35 | useColor,
|
---|
36 | contentBase
|
---|
37 | )}`
|
---|
38 | );
|
---|
39 | }
|
---|
40 |
|
---|
41 | if (options.historyApiFallback) {
|
---|
42 | log.info(
|
---|
43 | `404s will fallback to ${colors.info(
|
---|
44 | useColor,
|
---|
45 | options.historyApiFallback.index || '/index.html'
|
---|
46 | )}`
|
---|
47 | );
|
---|
48 | }
|
---|
49 |
|
---|
50 | if (options.bonjour) {
|
---|
51 | log.info(
|
---|
52 | 'Broadcasting "http" with subtype of "webpack" via ZeroConf DNS (Bonjour)'
|
---|
53 | );
|
---|
54 | }
|
---|
55 |
|
---|
56 | if (options.open) {
|
---|
57 | runOpen(uri, options, log);
|
---|
58 | }
|
---|
59 | }
|
---|
60 |
|
---|
61 | module.exports = status;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.