UNPKG

4.46 kBJavaScriptView Raw
1'use strict';
2
3/* eslint-disable
4 multiline-ternary,
5 space-before-function-paren
6*/
7const ADVANCED_GROUP = 'Advanced options:';
8const DISPLAY_GROUP = 'Stats options:';
9const SSL_GROUP = 'SSL options:';
10const CONNECTION_GROUP = 'Connection options:';
11const RESPONSE_GROUP = 'Response options:';
12const BASIC_GROUP = 'Basic options:';
13
14const options = {
15 bonjour: {
16 type: 'boolean',
17 describe: 'Broadcasts the server via ZeroConf networking on start',
18 },
19 lazy: {
20 type: 'boolean',
21 describe: 'Lazy',
22 },
23 liveReload: {
24 type: 'boolean',
25 describe: 'Enables/Disables live reloading on changing files',
26 default: true,
27 },
28 serveIndex: {
29 type: 'boolean',
30 describe: 'Enables/Disables serveIndex middleware',
31 default: true,
32 },
33 inline: {
34 type: 'boolean',
35 default: true,
36 describe:
37 'Inline mode (set to false to disable including client scripts like livereload)',
38 },
39 profile: {
40 type: 'boolean',
41 describe: 'Print compilation profile data for progress steps',
42 },
43 progress: {
44 type: 'boolean',
45 describe: 'Print compilation progress in percentage',
46 group: BASIC_GROUP,
47 },
48 'hot-only': {
49 type: 'boolean',
50 describe: 'Do not refresh page if HMR fails',
51 group: ADVANCED_GROUP,
52 },
53 stdin: {
54 type: 'boolean',
55 describe: 'close when stdin ends',
56 },
57 open: {
58 type: 'string',
59 describe: 'Open the default browser, or optionally specify a browser name',
60 },
61 useLocalIp: {
62 type: 'boolean',
63 describe: 'Open default browser with local IP',
64 },
65 'open-page': {
66 type: 'string',
67 describe: 'Open default browser with the specified page',
68 requiresArg: true,
69 },
70 color: {
71 type: 'boolean',
72 alias: 'colors',
73 default: function supportsColor() {
74 // Use `require('supports-color').stdout` for supports-color >= 5.0.0.
75 // See https://github.com/webpack/webpack-dev-server/pull/1555.
76 return require('supports-color').stdout;
77 },
78 group: DISPLAY_GROUP,
79 describe: 'Enables/Disables colors on the console',
80 },
81 info: {
82 type: 'boolean',
83 group: DISPLAY_GROUP,
84 default: true,
85 describe: 'Info',
86 },
87 quiet: {
88 type: 'boolean',
89 group: DISPLAY_GROUP,
90 describe: 'Quiet',
91 },
92 'client-log-level': {
93 type: 'string',
94 group: DISPLAY_GROUP,
95 default: 'info',
96 describe:
97 'Log level in the browser (trace, debug, info, warn, error or silent)',
98 },
99 https: {
100 type: 'boolean',
101 group: SSL_GROUP,
102 describe: 'HTTPS',
103 },
104 http2: {
105 type: 'boolean',
106 group: SSL_GROUP,
107 describe: 'HTTP/2, must be used with HTTPS',
108 },
109 key: {
110 type: 'string',
111 describe: 'Path to a SSL key.',
112 group: SSL_GROUP,
113 },
114 cert: {
115 type: 'string',
116 describe: 'Path to a SSL certificate.',
117 group: SSL_GROUP,
118 },
119 cacert: {
120 type: 'string',
121 describe: 'Path to a SSL CA certificate.',
122 group: SSL_GROUP,
123 },
124 pfx: {
125 type: 'string',
126 describe: 'Path to a SSL pfx file.',
127 group: SSL_GROUP,
128 },
129 'pfx-passphrase': {
130 type: 'string',
131 describe: 'Passphrase for pfx file.',
132 group: SSL_GROUP,
133 },
134 'content-base': {
135 type: 'string',
136 describe: 'A directory or URL to serve HTML content from.',
137 group: RESPONSE_GROUP,
138 },
139 'watch-content-base': {
140 type: 'boolean',
141 describe: 'Enable live-reloading of the content-base.',
142 group: RESPONSE_GROUP,
143 },
144 'history-api-fallback': {
145 type: 'boolean',
146 describe: 'Fallback to /index.html for Single Page Applications.',
147 group: RESPONSE_GROUP,
148 },
149 compress: {
150 type: 'boolean',
151 describe: 'Enable gzip compression',
152 group: RESPONSE_GROUP,
153 },
154 port: {
155 describe: 'The port',
156 group: CONNECTION_GROUP,
157 },
158 'disable-host-check': {
159 type: 'boolean',
160 describe: 'Will not check the host',
161 group: CONNECTION_GROUP,
162 },
163 socket: {
164 type: 'String',
165 describe: 'Socket to listen',
166 group: CONNECTION_GROUP,
167 },
168 public: {
169 type: 'string',
170 describe: 'The public hostname/ip address of the server',
171 group: CONNECTION_GROUP,
172 },
173 host: {
174 type: 'string',
175 default: 'localhost',
176 describe: 'The hostname/ip address the server will bind to',
177 group: CONNECTION_GROUP,
178 },
179 'allowed-hosts': {
180 type: 'string',
181 describe:
182 'A comma-delimited string of hosts that are allowed to access the dev server',
183 group: CONNECTION_GROUP,
184 },
185};
186
187module.exports = options;