@@ -521,51 +521,49 @@ class Server {
521
521
} ,
522
522
} ;
523
523
524
- const defaultFeatures = [ 'setup' , 'before' , 'headers' , 'middleware' ] ;
524
+ const runnableFeatures = [ ] ;
525
525
526
- if ( this . options . proxy ) {
527
- defaultFeatures . push ( 'proxy' , 'middleware' ) ;
526
+ // compress is placed last and uses unshift so that it will be the first middleware used
527
+ if ( this . options . compress ) {
528
+ runnableFeatures . push ( 'compress' ) ;
528
529
}
529
530
530
- const contentBase = this . options . contentBase ;
531
+ runnableFeatures . push ( 'setup' , 'before' , 'headers' , 'middleware' ) ;
531
532
532
- if ( contentBase !== false ) {
533
- defaultFeatures . push ( 'contentBaseFiles ' ) ;
533
+ if ( this . options . proxy ) {
534
+ runnableFeatures . push ( 'proxy' , 'middleware ') ;
534
535
}
535
536
536
- if ( this . options . watchContentBase ) {
537
- defaultFeatures . push ( 'watchContentBase ' ) ;
537
+ if ( this . options . contentBase !== false ) {
538
+ runnableFeatures . push ( 'contentBaseFiles ' ) ;
538
539
}
539
540
540
541
if ( this . options . historyApiFallback ) {
541
- defaultFeatures . push ( 'historyApiFallback' , 'middleware' ) ;
542
+ runnableFeatures . push ( 'historyApiFallback' , 'middleware' ) ;
542
543
543
- if ( contentBase !== false ) {
544
- defaultFeatures . push ( 'contentBaseFiles' ) ;
544
+ if ( this . options . contentBase !== false ) {
545
+ runnableFeatures . push ( 'contentBaseFiles' ) ;
545
546
}
546
547
}
547
548
548
- defaultFeatures . push ( 'magicHtml' ) ;
549
-
550
549
// checking if it's set to true or not set (Default : undefined => true)
551
550
this . serveIndex = this . serveIndex || this . serveIndex === undefined ;
552
551
553
- const shouldHandleServeIndex = contentBase && this . serveIndex ;
554
-
555
- if ( shouldHandleServeIndex ) {
556
- defaultFeatures . push ( 'contentBaseIndex' ) ;
552
+ if ( this . options . contentBase && this . serveIndex ) {
553
+ runnableFeatures . push ( 'contentBaseIndex' ) ;
557
554
}
558
555
559
- // compress is placed last and uses unshift so that it will be the first middleware used
560
- if ( this . options . compress ) {
561
- defaultFeatures . unshift ( 'compress' ) ;
556
+ if ( this . options . watchContentBase ) {
557
+ runnableFeatures . push ( 'watchContentBase' ) ;
562
558
}
563
559
560
+ runnableFeatures . push ( 'magicHtml' ) ;
561
+
564
562
if ( this . options . after ) {
565
- defaultFeatures . push ( 'after' ) ;
563
+ runnableFeatures . push ( 'after' ) ;
566
564
}
567
565
568
- ( this . options . features || defaultFeatures ) . forEach ( ( feature ) => {
566
+ ( this . options . features || runnableFeatures ) . forEach ( ( feature ) => {
569
567
features [ feature ] ( ) ;
570
568
} ) ;
571
569
}
0 commit comments