webpack-dev-server 3.1.3 → 3.1.7
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.
- package/CHANGELOG.md +23 -0
- package/README.md +0 -11
- package/bin/options.js +164 -0
- package/bin/utils.js +114 -0
- package/bin/webpack-dev-server.js +254 -334
- package/client/index.bundle.js +1 -1
- package/client/index.js +1 -0
- package/client/live.bundle.js +39 -1
- package/client/sockjs.bundle.js +1 -1
- package/lib/Server.js +381 -209
- package/lib/options.json +354 -0
- package/lib/utils/addEntries.js +55 -0
- package/lib/utils/createCertificate.js +65 -0
- package/lib/utils/createDomain.js +35 -0
- package/lib/utils/createLogger.js +26 -0
- package/package.json +43 -53
- package/ssl/server.pem +46 -0
- package/lib/OptionsValidationError.js +0 -152
- package/lib/createLog.js +0 -19
- package/lib/optionsSchema.json +0 -347
- package/lib/polyfills.js +0 -8
- package/lib/util/addDevServerEntrypoints.js +0 -40
- package/lib/util/createDomain.js +0 -23
- package/ssl/.DS_Store +0 -0
package/lib/options.json
ADDED
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"properties": {
|
|
4
|
+
"hot": {
|
|
5
|
+
"type": "boolean"
|
|
6
|
+
},
|
|
7
|
+
"hotOnly": {
|
|
8
|
+
"type": "boolean"
|
|
9
|
+
},
|
|
10
|
+
"lazy": {
|
|
11
|
+
"type": "boolean"
|
|
12
|
+
},
|
|
13
|
+
"bonjour": {
|
|
14
|
+
"type": "boolean"
|
|
15
|
+
},
|
|
16
|
+
"host": {
|
|
17
|
+
"type": "string"
|
|
18
|
+
},
|
|
19
|
+
"allowedHosts": {
|
|
20
|
+
"type": "array",
|
|
21
|
+
"items": {
|
|
22
|
+
"type": "string"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"filename": {
|
|
26
|
+
"anyOf": [
|
|
27
|
+
{
|
|
28
|
+
"type": "string"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
"instanceof": "RegExp"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"instanceof": "Function"
|
|
35
|
+
}
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
"publicPath": {
|
|
39
|
+
"type": "string"
|
|
40
|
+
},
|
|
41
|
+
"port": {
|
|
42
|
+
"anyOf": [
|
|
43
|
+
{
|
|
44
|
+
"type": "number"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
"type": "string"
|
|
48
|
+
}
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
"socket": {
|
|
52
|
+
"type": "string"
|
|
53
|
+
},
|
|
54
|
+
"watchOptions": {
|
|
55
|
+
"type": "object"
|
|
56
|
+
},
|
|
57
|
+
"headers": {
|
|
58
|
+
"type": "object"
|
|
59
|
+
},
|
|
60
|
+
"logLevel": {
|
|
61
|
+
"enum": [
|
|
62
|
+
"info",
|
|
63
|
+
"warn",
|
|
64
|
+
"error",
|
|
65
|
+
"debug",
|
|
66
|
+
"trace",
|
|
67
|
+
"silent"
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
"clientLogLevel": {
|
|
71
|
+
"enum": [
|
|
72
|
+
"none",
|
|
73
|
+
"info",
|
|
74
|
+
"error",
|
|
75
|
+
"warning"
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
"overlay": {
|
|
79
|
+
"anyOf": [
|
|
80
|
+
{
|
|
81
|
+
"type": "boolean"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"type": "object",
|
|
85
|
+
"properties": {
|
|
86
|
+
"errors": {
|
|
87
|
+
"type": "boolean"
|
|
88
|
+
},
|
|
89
|
+
"warnings": {
|
|
90
|
+
"type": "boolean"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
"progress": {
|
|
97
|
+
"type": "boolean"
|
|
98
|
+
},
|
|
99
|
+
"key": {
|
|
100
|
+
"anyOf": [
|
|
101
|
+
{
|
|
102
|
+
"type": "string"
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"instanceof": "Buffer"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
"cert": {
|
|
110
|
+
"anyOf": [
|
|
111
|
+
{
|
|
112
|
+
"type": "string"
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"instanceof": "Buffer"
|
|
116
|
+
}
|
|
117
|
+
]
|
|
118
|
+
},
|
|
119
|
+
"ca": {
|
|
120
|
+
"anyOf": [
|
|
121
|
+
{
|
|
122
|
+
"type": "string"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"instanceof": "Buffer"
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
},
|
|
129
|
+
"pfx": {
|
|
130
|
+
"anyOf": [
|
|
131
|
+
{
|
|
132
|
+
"type": "string"
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
"instanceof": "Buffer"
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
"pfxPassphrase": {
|
|
140
|
+
"type": "string"
|
|
141
|
+
},
|
|
142
|
+
"requestCert": {
|
|
143
|
+
"type": "boolean"
|
|
144
|
+
},
|
|
145
|
+
"inline": {
|
|
146
|
+
"type": "boolean"
|
|
147
|
+
},
|
|
148
|
+
"disableHostCheck": {
|
|
149
|
+
"type": "boolean"
|
|
150
|
+
},
|
|
151
|
+
"public": {
|
|
152
|
+
"type": "string"
|
|
153
|
+
},
|
|
154
|
+
"https": {
|
|
155
|
+
"anyOf": [
|
|
156
|
+
{
|
|
157
|
+
"type": "object"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"type": "boolean"
|
|
161
|
+
}
|
|
162
|
+
]
|
|
163
|
+
},
|
|
164
|
+
"contentBase": {
|
|
165
|
+
"anyOf": [
|
|
166
|
+
{
|
|
167
|
+
"enum": [
|
|
168
|
+
false
|
|
169
|
+
]
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"type": "number"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"type": "string"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"type": "array",
|
|
179
|
+
"items": {
|
|
180
|
+
"type": "string"
|
|
181
|
+
},
|
|
182
|
+
"minItems": 1
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
"watchContentBase": {
|
|
187
|
+
"type": "boolean"
|
|
188
|
+
},
|
|
189
|
+
"open": {
|
|
190
|
+
"anyOf": [
|
|
191
|
+
{
|
|
192
|
+
"type": "string"
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
"type": "boolean"
|
|
196
|
+
}
|
|
197
|
+
]
|
|
198
|
+
},
|
|
199
|
+
"useLocalIp": {
|
|
200
|
+
"type": "boolean"
|
|
201
|
+
},
|
|
202
|
+
"openPage": {
|
|
203
|
+
"type": "string"
|
|
204
|
+
},
|
|
205
|
+
"features": {
|
|
206
|
+
"type": "array",
|
|
207
|
+
"items": {
|
|
208
|
+
"type": "string"
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
"compress": {
|
|
212
|
+
"type": "boolean"
|
|
213
|
+
},
|
|
214
|
+
"proxy": {
|
|
215
|
+
"anyOf": [
|
|
216
|
+
{
|
|
217
|
+
"type": "object"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"type": "array",
|
|
221
|
+
"items": {
|
|
222
|
+
"anyOf": [
|
|
223
|
+
{
|
|
224
|
+
"type": "object"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"instanceof": "Function"
|
|
228
|
+
}
|
|
229
|
+
]
|
|
230
|
+
},
|
|
231
|
+
"minItems": 1
|
|
232
|
+
}
|
|
233
|
+
]
|
|
234
|
+
},
|
|
235
|
+
"historyApiFallback": {
|
|
236
|
+
"anyOf": [
|
|
237
|
+
{
|
|
238
|
+
"type": "boolean"
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"type": "object"
|
|
242
|
+
}
|
|
243
|
+
]
|
|
244
|
+
},
|
|
245
|
+
"staticOptions": {
|
|
246
|
+
"type": "object"
|
|
247
|
+
},
|
|
248
|
+
"setup": {
|
|
249
|
+
"instanceof": "Function"
|
|
250
|
+
},
|
|
251
|
+
"before": {
|
|
252
|
+
"instanceof": "Function"
|
|
253
|
+
},
|
|
254
|
+
"after": {
|
|
255
|
+
"instanceof": "Function"
|
|
256
|
+
},
|
|
257
|
+
"stats": {
|
|
258
|
+
"anyOf": [
|
|
259
|
+
{
|
|
260
|
+
"type": "object"
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"type": "boolean"
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"enum": [
|
|
267
|
+
"none",
|
|
268
|
+
"errors-only",
|
|
269
|
+
"minimal",
|
|
270
|
+
"normal",
|
|
271
|
+
"verbose"
|
|
272
|
+
]
|
|
273
|
+
}
|
|
274
|
+
]
|
|
275
|
+
},
|
|
276
|
+
"reporter": {
|
|
277
|
+
"instanceof": "Function"
|
|
278
|
+
},
|
|
279
|
+
"logTime": {
|
|
280
|
+
"type": "boolean"
|
|
281
|
+
},
|
|
282
|
+
"noInfo": {
|
|
283
|
+
"type": "boolean"
|
|
284
|
+
},
|
|
285
|
+
"quiet": {
|
|
286
|
+
"type": "boolean"
|
|
287
|
+
},
|
|
288
|
+
"serverSideRender": {
|
|
289
|
+
"type": "boolean"
|
|
290
|
+
},
|
|
291
|
+
"index": {
|
|
292
|
+
"type": "string"
|
|
293
|
+
},
|
|
294
|
+
"log": {
|
|
295
|
+
"instanceof": "Function"
|
|
296
|
+
},
|
|
297
|
+
"warn": {
|
|
298
|
+
"instanceof": "Function"
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
"errorMessage": {
|
|
302
|
+
"properties": {
|
|
303
|
+
"hot": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserver-hot)",
|
|
304
|
+
"hotOnly": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserver-hotonly)",
|
|
305
|
+
"lazy": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserver-lazy-)",
|
|
306
|
+
"bonjour": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserver-bonjour)",
|
|
307
|
+
"publicPath": "should be {String} (https://webpack.js.org/configuration/dev-server/#devserver-publicpath-)",
|
|
308
|
+
"host": "should be {String} (https://webpack.js.org/configuration/dev-server/#devserver-host)",
|
|
309
|
+
"allowedHosts": "should be {Array} (https://webpack.js.org/configuration/dev-server/#devserver-allowedhosts)",
|
|
310
|
+
"logLevel": "should be {String} and equal to one of the allowed values\n\n [ 'trace', 'debug', 'info', 'warn', 'error', 'silent' ]\n\n(https://webpack.js.org/configuration/dev-server/#devserver-loglevel)",
|
|
311
|
+
"filename": "should be {String|RegExp|Function} (https://webpack.js.org/configuration/dev-server/#devserver-filename-)",
|
|
312
|
+
"port": "should be {String|Number} (https://webpack.js.org/configuration/dev-server/#devserver-port)",
|
|
313
|
+
"socket": "should be {String} (https://webpack.js.org/configuration/dev-server/#devserver-socket)",
|
|
314
|
+
"watchOptions": "should be {Object} (https://webpack.js.org/configuration/dev-server/#devserver-watchoptions)",
|
|
315
|
+
"headers": "should be {Object} (https://webpack.js.org/configuration/dev-server/#devserver-headers-)",
|
|
316
|
+
"clientLogLevel": "should be {String} and equal to one of the allowed values\n\n [ 'trace', 'debug', 'info', 'warn', 'error', 'silent' ]\n\n(https://webpack.js.org/configuration/dev-server/#devserver-clientloglevel)",
|
|
317
|
+
"overlay": "should be {Object|Boolean} (https://webpack.js.org/configuration/dev-server/#devserver-overlay)",
|
|
318
|
+
"progress": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserver-progress-cli-only)",
|
|
319
|
+
"key": "should be {String|Buffer} (https://webpack.js.org/configuration/dev-server/#devserver-key)",
|
|
320
|
+
"cert": "should be {String|Buffer} (https://webpack.js.org/configuration/dev-server/#devserver-cert)",
|
|
321
|
+
"ca": "should be {String|Buffer} (https://webpack.js.org/configuration/dev-server/#devserver-ca)",
|
|
322
|
+
"pfx": "should be {String|Buffer} (https://webpack.js.org/configuration/dev-server/#devserver-pfx)",
|
|
323
|
+
"pfxPassphrase": "should be {String} (https://webpack.js.org/configuration/dev-server/#devserver-pfxpassphrase)",
|
|
324
|
+
"requestCert": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserver-requestcert)",
|
|
325
|
+
"inline": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserver-inline)",
|
|
326
|
+
"disableHostCheck": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserver-disablehostcheck)",
|
|
327
|
+
"public": "should be {String} (https://webpack.js.org/configuration/dev-server/#devserver-public)",
|
|
328
|
+
"https": "should be {Object|Boolean} (https://webpack.js.org/configuration/dev-server/#devserver-https)",
|
|
329
|
+
"contentBase": "should be {Array} (https://webpack.js.org/configuration/dev-server/#devserver-contentbase)",
|
|
330
|
+
"watchContentBase": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserver-watchcontentbase)",
|
|
331
|
+
"open": "should be {String|Boolean} (https://webpack.js.org/configuration/dev-server/#devserver-open)",
|
|
332
|
+
"useLocalIp": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserver-uselocalip)",
|
|
333
|
+
"openPage": "should be {String} (https://webpack.js.org/configuration/dev-server/#devserver-openpage)",
|
|
334
|
+
"features": "should be {Array} (https://webpack.js.org/configuration/dev-server/#devserver-features)",
|
|
335
|
+
"compress": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserver-compress)",
|
|
336
|
+
"proxy": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserver-hot)",
|
|
337
|
+
"historyApiFallback": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserver-historyapifallback)",
|
|
338
|
+
"staticOptions": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserver-staticOptions)",
|
|
339
|
+
"setup": "should be {Function} (https://webpack.js.org/configuration/dev-server/#devserver-setup)",
|
|
340
|
+
"before": "should be {Function} (https://webpack.js.org/configuration/dev-server/#devserver-before)",
|
|
341
|
+
"after": "should be {Function} (https://webpack.js.org/configuration/dev-server/#devserver-after)",
|
|
342
|
+
"stats": "should be {Boolean|Object|String} (https://webpack.js.org/configuration/dev-server/#devserver-stats-)",
|
|
343
|
+
"reporter": "should be {Function} (https://webpack.js.org/configuration/dev-server/#devserver-reporter)",
|
|
344
|
+
"logTime": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserver-logtime)",
|
|
345
|
+
"noInfo": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserver-noinfo-)",
|
|
346
|
+
"quiet": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserver-quiet-)",
|
|
347
|
+
"serverSideRender": "should be {Boolean} (https://webpack.js.org/configuration/dev-server/#devserver-serversiderender)",
|
|
348
|
+
"index": "should be {String} (https://webpack.js.org/configuration/dev-server/#devserver-index)",
|
|
349
|
+
"log": "should be {Function} (https://webpack.js.org/configuration/dev-server/#devserver-log)",
|
|
350
|
+
"warn": "should be {Function} (https://webpack.js.org/configuration/dev-server/#devserver-warn)"
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
"additionalProperties": false
|
|
354
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable
|
|
4
|
+
no-shadow,
|
|
5
|
+
no-param-reassign,
|
|
6
|
+
array-bracket-spacing,
|
|
7
|
+
space-before-function-paren
|
|
8
|
+
*/
|
|
9
|
+
const createDomain = require('./createDomain');
|
|
10
|
+
|
|
11
|
+
function addEntries (config, options, server) {
|
|
12
|
+
if (options.inline !== false) {
|
|
13
|
+
// we're stubbing the app in this method as it's static and doesn't require
|
|
14
|
+
// a server to be supplied. createDomain requires an app with the
|
|
15
|
+
// address() signature.
|
|
16
|
+
const app = server || {
|
|
17
|
+
address() {
|
|
18
|
+
return { port: options.port };
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
const domain = createDomain(options, app);
|
|
23
|
+
const entries = [ `${require.resolve('../../client/')}?${domain}` ];
|
|
24
|
+
|
|
25
|
+
if (options.hotOnly) {
|
|
26
|
+
entries.push(require.resolve('webpack/hot/only-dev-server'));
|
|
27
|
+
} else if (options.hot) {
|
|
28
|
+
entries.push(require.resolve('webpack/hot/dev-server'));
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const prependEntry = (entry) => {
|
|
32
|
+
if (typeof entry === 'function') {
|
|
33
|
+
return () => Promise.resolve(entry()).then(prependEntry);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (typeof entry === 'object' && !Array.isArray(entry)) {
|
|
37
|
+
const clone = {};
|
|
38
|
+
|
|
39
|
+
Object.keys(entry).forEach((key) => {
|
|
40
|
+
clone[key] = entries.concat(entry[key]);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
return clone;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return entries.concat(entry);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
[].concat(config).forEach((config) => {
|
|
50
|
+
config.entry = prependEntry(config.entry || './src');
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
module.exports = addEntries;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable
|
|
4
|
+
space-before-function-paren
|
|
5
|
+
*/
|
|
6
|
+
const selfsigned = require('selfsigned');
|
|
7
|
+
|
|
8
|
+
function createCertificate (attrs) {
|
|
9
|
+
return selfsigned.generate(attrs, {
|
|
10
|
+
algorithm: 'sha256',
|
|
11
|
+
days: 30,
|
|
12
|
+
keySize: 2048,
|
|
13
|
+
extensions: [
|
|
14
|
+
{
|
|
15
|
+
name: 'basicConstraints',
|
|
16
|
+
cA: true
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'keyUsage',
|
|
20
|
+
keyCertSign: true,
|
|
21
|
+
digitalSignature: true,
|
|
22
|
+
nonRepudiation: true,
|
|
23
|
+
keyEncipherment: true,
|
|
24
|
+
dataEncipherment: true
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'subjectAltName',
|
|
28
|
+
altNames: [
|
|
29
|
+
{
|
|
30
|
+
// type 2 is DNS
|
|
31
|
+
type: 2,
|
|
32
|
+
value: 'localhost'
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: 2,
|
|
36
|
+
value: 'localhost.localdomain'
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
type: 2,
|
|
40
|
+
value: 'lvh.me'
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
type: 2,
|
|
44
|
+
value: '*.lvh.me'
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: 2,
|
|
48
|
+
value: '[::1]'
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
// type 7 is IP
|
|
52
|
+
type: 7,
|
|
53
|
+
ip: '127.0.0.1'
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
type: 7,
|
|
57
|
+
ip: 'fe80::1'
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
]
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
module.exports = createCertificate;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable
|
|
4
|
+
no-nested-ternary,
|
|
5
|
+
multiline-ternary,
|
|
6
|
+
space-before-function-paren
|
|
7
|
+
*/
|
|
8
|
+
const url = require('url');
|
|
9
|
+
const ip = require('internal-ip');
|
|
10
|
+
|
|
11
|
+
function createDomain (options, server) {
|
|
12
|
+
const protocol = options.https ? 'https' : 'http';
|
|
13
|
+
const hostname = options.useLocalIp ? ip.v4.sync() || 'localhost' : options.host;
|
|
14
|
+
|
|
15
|
+
const port = options.socket
|
|
16
|
+
? 0
|
|
17
|
+
: server
|
|
18
|
+
? server.address().port
|
|
19
|
+
: 0;
|
|
20
|
+
// use explicitly defined public url
|
|
21
|
+
// (prefix with protocol if not explicitly given)
|
|
22
|
+
if (options.public) {
|
|
23
|
+
return /^[a-zA-Z]+:\/\//.test(options.public)
|
|
24
|
+
? `${options.public}`
|
|
25
|
+
: `${protocol}://${options.public}`;
|
|
26
|
+
}
|
|
27
|
+
// the formatted domain (url without path) of the webpack server
|
|
28
|
+
return url.format({
|
|
29
|
+
protocol,
|
|
30
|
+
hostname,
|
|
31
|
+
port
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
module.exports = createDomain;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable
|
|
4
|
+
space-before-function-paren
|
|
5
|
+
*/
|
|
6
|
+
const log = require('webpack-log');
|
|
7
|
+
|
|
8
|
+
function createLogger (options) {
|
|
9
|
+
let level = options.logLevel || 'info';
|
|
10
|
+
|
|
11
|
+
if (options.quiet === true) {
|
|
12
|
+
level = 'silent';
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (options.noInfo === true) {
|
|
16
|
+
level = 'warn';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return log({
|
|
20
|
+
name: 'wds',
|
|
21
|
+
level,
|
|
22
|
+
timestamp: options.logTime
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
module.exports = createLogger;
|
package/package.json
CHANGED
|
@@ -1,49 +1,31 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webpack-dev-server",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.7",
|
|
4
4
|
"description": "Serves a webpack app. Updates the browser on changes.",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"repository": "webpack/webpack-dev-server",
|
|
7
|
-
"author": "Tobias Koppers @sokra",
|
|
8
|
-
"homepage": "https://github.com/webpack/webpack-dev-server",
|
|
9
|
-
"maintainers": [
|
|
10
|
-
{
|
|
11
|
-
"name": "Andrew Powell",
|
|
12
|
-
"email": "andrew@shellscape.org",
|
|
13
|
-
"url": "shellscape.org"
|
|
14
|
-
}
|
|
15
|
-
],
|
|
16
|
-
"main": "lib/Server.js",
|
|
17
5
|
"bin": "bin/webpack-dev-server.js",
|
|
6
|
+
"main": "lib/Server.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"bin",
|
|
9
|
+
"lib",
|
|
10
|
+
"ssl",
|
|
11
|
+
"client"
|
|
12
|
+
],
|
|
18
13
|
"engines": {
|
|
19
|
-
"node": ">=6.11.5"
|
|
14
|
+
"node": ">= 6.11.5"
|
|
20
15
|
},
|
|
21
16
|
"scripts": {
|
|
22
|
-
"beautify": "npm run lint -- --fix",
|
|
23
|
-
"ci": "npm run cover -- --report lcovonly && npm run test",
|
|
24
|
-
"cover": "istanbul cover node_modules/mocha/bin/_mocha",
|
|
25
17
|
"lint": "eslint bin lib test examples client-src",
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"test": "npm run lint && npm run mocha",
|
|
18
|
+
"test": "nyc --reporter lcovonly mocha --full-trace --check-leaks --exit",
|
|
19
|
+
"prepare": "(rm ssl/*.pem || true) && npm run -s transpile:index && npm run -s build:live && npm run -s build:index && npm run -s build:sockjs",
|
|
29
20
|
"transpile:index": "babel client-src/default --out-dir client --ignore *.config.js",
|
|
30
21
|
"build:index": "webpack ./client-src/default/index.js -o client/index.bundle.js --color --config client-src/default/webpack.config.js",
|
|
31
22
|
"build:live": "webpack ./client-src/live/index.js -o client/live.bundle.js --color --config client-src/live/webpack.config.js",
|
|
32
23
|
"build:sockjs": "webpack ./client-src/sockjs/index.js -o client/sockjs.bundle.js --color --config client-src/sockjs/webpack.config.js",
|
|
33
|
-
"webpack-dev-server": "cd $INIT_CWD && node ../../../bin/webpack-dev-server.js"
|
|
34
|
-
|
|
35
|
-
"files": [
|
|
36
|
-
"lib/",
|
|
37
|
-
"bin",
|
|
38
|
-
"client/",
|
|
39
|
-
"ssl/"
|
|
40
|
-
],
|
|
41
|
-
"peerDependencies": {
|
|
42
|
-
"webpack": "^4.0.0-beta.1"
|
|
24
|
+
"webpack-dev-server": "cd $INIT_CWD && node ../../../bin/webpack-dev-server.js",
|
|
25
|
+
"release": "standard-version"
|
|
43
26
|
},
|
|
44
27
|
"dependencies": {
|
|
45
28
|
"ansi-html": "0.0.7",
|
|
46
|
-
"array-includes": "^3.0.3",
|
|
47
29
|
"bonjour": "^3.5.0",
|
|
48
30
|
"chokidar": "^2.0.0",
|
|
49
31
|
"compression": "^1.5.2",
|
|
@@ -54,53 +36,61 @@
|
|
|
54
36
|
"html-entities": "^1.2.0",
|
|
55
37
|
"http-proxy-middleware": "~0.18.0",
|
|
56
38
|
"import-local": "^1.0.0",
|
|
57
|
-
"internal-ip": "
|
|
39
|
+
"internal-ip": "^3.0.1",
|
|
58
40
|
"ip": "^1.1.5",
|
|
59
41
|
"killable": "^1.0.0",
|
|
60
42
|
"loglevel": "^1.4.1",
|
|
61
43
|
"opn": "^5.1.0",
|
|
62
44
|
"portfinder": "^1.0.9",
|
|
45
|
+
"schema-utils": "^1.0.0",
|
|
63
46
|
"selfsigned": "^1.9.1",
|
|
64
47
|
"serve-index": "^1.7.2",
|
|
65
48
|
"sockjs": "0.3.19",
|
|
66
|
-
"sockjs-client": "1.1.
|
|
49
|
+
"sockjs-client": "1.1.5",
|
|
67
50
|
"spdy": "^3.4.1",
|
|
68
51
|
"strip-ansi": "^3.0.0",
|
|
69
52
|
"supports-color": "^5.1.0",
|
|
70
|
-
"webpack-dev-middleware": "3.
|
|
71
|
-
"webpack-log": "^
|
|
72
|
-
"yargs": "
|
|
53
|
+
"webpack-dev-middleware": "3.2.0",
|
|
54
|
+
"webpack-log": "^2.0.0",
|
|
55
|
+
"yargs": "12.0.1"
|
|
73
56
|
},
|
|
74
57
|
"devDependencies": {
|
|
75
58
|
"babel-cli": "^6.26.0",
|
|
76
59
|
"babel-core": "^6.26.0",
|
|
77
60
|
"babel-loader": "^7.1.4",
|
|
78
61
|
"babel-preset-env": "^1.6.1",
|
|
79
|
-
"codecov.io": "^0.1.6",
|
|
80
62
|
"copy-webpack-plugin": "^4.5.1",
|
|
81
|
-
"css-loader": "^0.
|
|
82
|
-
"eslint": "^4.
|
|
63
|
+
"css-loader": "^1.0.0",
|
|
64
|
+
"eslint": "^5.4.0",
|
|
83
65
|
"eslint-config-webpack": "^1.2.5",
|
|
84
66
|
"eslint-plugin-import": "^2.9.0",
|
|
85
|
-
"execa": "^0.
|
|
86
|
-
"file-loader": "^
|
|
67
|
+
"execa": "^0.11.0",
|
|
68
|
+
"file-loader": "^2.0.0",
|
|
87
69
|
"html-loader": "^0.5.5",
|
|
88
70
|
"html-webpack-plugin": "^3.0.6",
|
|
89
|
-
"istanbul": "^0.4.5",
|
|
90
71
|
"jquery": "^3.2.1",
|
|
91
|
-
"less": "^3.
|
|
72
|
+
"less": "^3.7.1",
|
|
92
73
|
"less-loader": "^4.1.0",
|
|
93
|
-
"marked": "^0.
|
|
94
|
-
"mocha": "^
|
|
74
|
+
"marked": "^0.5.0",
|
|
75
|
+
"mocha": "^5.2.0",
|
|
95
76
|
"mocha-sinon": "^2.0.0",
|
|
96
|
-
"
|
|
77
|
+
"nyc": "^12.0.2",
|
|
97
78
|
"should": "^13.2.0",
|
|
98
|
-
"sinon": "^
|
|
99
|
-
"
|
|
79
|
+
"sinon": "^6.1.5",
|
|
80
|
+
"standard-version": "^4.4.0",
|
|
81
|
+
"style-loader": "^0.22.1",
|
|
100
82
|
"supertest": "^3.0.0",
|
|
101
|
-
"url-loader": "^
|
|
102
|
-
"webpack": "^4.
|
|
103
|
-
"webpack-cli": "^
|
|
104
|
-
"ws": "^
|
|
105
|
-
}
|
|
83
|
+
"url-loader": "^1.1.1",
|
|
84
|
+
"webpack": "^4.17.1",
|
|
85
|
+
"webpack-cli": "^3.1.0",
|
|
86
|
+
"ws": "^6.0.0"
|
|
87
|
+
},
|
|
88
|
+
"peerDependencies": {
|
|
89
|
+
"webpack": "^4.0.0"
|
|
90
|
+
},
|
|
91
|
+
"author": "Tobias Koppers @sokra",
|
|
92
|
+
"bugs": "https://github.com/webpack/webpack-dev-server/issues",
|
|
93
|
+
"homepage": "https://github.com/webpack/webpack-dev-server#readme",
|
|
94
|
+
"repository": "https://github.com/webpack/webpack-dev-server.git",
|
|
95
|
+
"license": "MIT"
|
|
106
96
|
}
|