1
1
'use strict' ;
2
2
3
- /* eslint no-console: off, func-names: off */
3
+ /* eslint func-names: off */
4
4
require ( './polyfills' ) ;
5
5
6
6
const fs = require ( 'fs' ) ;
@@ -24,6 +24,7 @@ const OptionsValidationError = require('./OptionsValidationError');
24
24
const optionsSchema = require ( './optionsSchema.json' ) ;
25
25
26
26
const clientStats = { errorDetails : false } ;
27
+ const log = console . log ; // eslint-disable-line no-console
27
28
28
29
function Server ( compiler , options ) {
29
30
// Default options
@@ -275,8 +276,8 @@ function Server(compiler, options) {
275
276
app . get ( '*' , express . static ( item ) ) ;
276
277
} ) ;
277
278
} else if ( / ^ ( h t t p s ? : ) ? \/ \/ / . test ( contentBase ) ) {
278
- console . log ( 'Using a URL as contentBase is deprecated and will be removed in the next major version. Please use the proxy option instead.' ) ;
279
- console . log ( 'proxy: {\n\t"*": "<your current contentBase configuration>"\n}' ) ; // eslint-disable-line quotes
279
+ log ( 'Using a URL as contentBase is deprecated and will be removed in the next major version. Please use the proxy option instead.' ) ;
280
+ log ( 'proxy: {\n\t"*": "<your current contentBase configuration>"\n}' ) ; // eslint-disable-line quotes
280
281
// Redirect every request to contentBase
281
282
app . get ( '*' , ( req , res ) => {
282
283
res . writeHead ( 302 , {
@@ -285,8 +286,8 @@ function Server(compiler, options) {
285
286
res . end ( ) ;
286
287
} ) ;
287
288
} else if ( typeof contentBase === 'number' ) {
288
- console . log ( 'Using a number as contentBase is deprecated and will be removed in the next major version. Please use the proxy option instead.' ) ;
289
- console . log ( 'proxy: {\n\t"*": "//localhost:<your current contentBase configuration>"\n}' ) ; // eslint-disable-line quotes
289
+ log ( 'Using a number as contentBase is deprecated and will be removed in the next major version. Please use the proxy option instead.' ) ;
290
+ log ( 'proxy: {\n\t"*": "//localhost:<your current contentBase configuration>"\n}' ) ; // eslint-disable-line quotes
290
291
// Redirect every request to the port contentBase
291
292
app . get ( '*' , ( req , res ) => {
292
293
res . writeHead ( 302 , {
@@ -384,14 +385,14 @@ function Server(compiler, options) {
384
385
385
386
// cert is more than 30 days old, kill it with fire
386
387
if ( ( now - certStat . ctime ) / certTtl > 30 ) {
387
- console . log ( 'SSL Certificate is more than 30 days old. Removing.' ) ;
388
+ log ( 'SSL Certificate is more than 30 days old. Removing.' ) ;
388
389
del . sync ( [ certPath ] , { force : true } ) ;
389
390
certExists = false ;
390
391
}
391
392
}
392
393
393
394
if ( ! certExists ) {
394
- console . log ( 'Generating SSL Certificate' ) ;
395
+ log ( 'Generating SSL Certificate' ) ;
395
396
const attrs = [ { name : 'commonName' , value : 'localhost' } ] ;
396
397
const pems = selfsigned . generate ( attrs , {
397
398
algorithm : 'sha256' ,
@@ -549,13 +550,12 @@ Server.prototype.listen = function (port, hostname, fn) {
549
550
// Limit useless logs
550
551
log ( severity , line ) {
551
552
if ( severity === 'error' ) {
552
- console . log ( line ) ;
553
+ log ( line ) ;
553
554
}
554
555
}
555
556
} ) ;
556
557
557
558
sockServer . on ( 'connection' , ( conn ) => {
558
- console . log ( 'connection.remotePort' , conn . remotePort ) ;
559
559
if ( ! conn ) return ;
560
560
if ( ! this . checkHost ( conn . headers ) ) {
561
561
this . sockWrite ( [ conn ] , 'error' , 'Invalid Host header' ) ;
0 commit comments