@@ -532,11 +532,18 @@ async function* contentSelectorsFromJsConfig(
532
532
if ( typeof item !== 'string' ) continue
533
533
534
534
let filepath = item . startsWith ( '!' )
535
- ? `! ${ path . resolve ( contentBase , item . slice ( 1 ) ) } `
535
+ ? path . resolve ( contentBase , item . slice ( 1 ) )
536
536
: path . resolve ( contentBase , item )
537
537
538
+ filepath = normalizePath ( filepath )
539
+ filepath = normalizeDriveLetter ( filepath )
540
+
541
+ if ( item . startsWith ( '!' ) ) {
542
+ filepath = `!${ filepath } `
543
+ }
544
+
538
545
yield {
539
- pattern : normalizePath ( filepath ) ,
546
+ pattern : filepath ,
540
547
priority : DocumentSelectorPriority . CONTENT_FILE ,
541
548
}
542
549
}
@@ -549,8 +556,11 @@ async function* contentSelectorsFromCssConfig(
549
556
let auto = false
550
557
for ( let item of entry . content ) {
551
558
if ( item . kind === 'file' ) {
559
+ let filepath = item . file
560
+ filepath = normalizePath ( filepath )
561
+ filepath = normalizeDriveLetter ( filepath )
552
562
yield {
553
- pattern : normalizePath ( item . file ) ,
563
+ pattern : filepath ,
554
564
priority : DocumentSelectorPriority . CONTENT_FILE ,
555
565
}
556
566
} else if ( item . kind === 'auto' && ! auto ) {
@@ -603,12 +613,16 @@ async function* detectContentFiles(
603
613
if ( ! result ) return
604
614
605
615
for ( let file of result . files ) {
606
- yield normalizePath ( file )
616
+ file = normalizePath ( file )
617
+ file = normalizeDriveLetter ( file )
618
+ yield file
607
619
}
608
620
609
621
for ( let { base, pattern } of result . globs ) {
610
622
// Do not normalize the glob itself as it may contain escape sequences
611
- yield normalizePath ( base ) + '/' + pattern
623
+ base = normalizePath ( base )
624
+ base = normalizeDriveLetter ( base )
625
+ yield `${ base } /${ pattern } `
612
626
}
613
627
} catch {
614
628
//
@@ -754,14 +768,14 @@ export async function calculateDocumentSelectors(
754
768
if ( entry . type !== 'css' ) continue
755
769
756
770
selectors . push ( {
757
- pattern : entry . path ,
771
+ pattern : normalizeDriveLetter ( normalizePath ( entry . path ) ) ,
758
772
priority : DocumentSelectorPriority . CSS_FILE ,
759
773
} )
760
774
}
761
775
762
776
// - Config File
763
777
selectors . push ( {
764
- pattern : config . path ,
778
+ pattern : normalizeDriveLetter ( normalizePath ( config . path ) ) ,
765
779
priority : DocumentSelectorPriority . CONFIG_FILE ,
766
780
} )
767
781
@@ -775,20 +789,20 @@ export async function calculateDocumentSelectors(
775
789
if ( entry . type !== 'css' ) continue
776
790
777
791
selectors . push ( {
778
- pattern : normalizePath ( path . join ( path . dirname ( entry . path ) , '**' ) ) ,
792
+ pattern : normalizeDriveLetter ( normalizePath ( path . join ( path . dirname ( entry . path ) , '**' ) ) ) ,
779
793
priority : DocumentSelectorPriority . CSS_DIRECTORY ,
780
794
} )
781
795
}
782
796
783
797
// - Directory containing the config
784
798
selectors . push ( {
785
- pattern : normalizePath ( path . join ( path . dirname ( config . path ) , '**' ) ) ,
799
+ pattern : normalizeDriveLetter ( normalizePath ( path . join ( path . dirname ( config . path ) , '**' ) ) ) ,
786
800
priority : DocumentSelectorPriority . CONFIG_DIRECTORY ,
787
801
} )
788
802
789
803
// - Root of package that contains the config
790
804
selectors . push ( {
791
- pattern : normalizePath ( path . join ( config . packageRoot , '**' ) ) ,
805
+ pattern : normalizeDriveLetter ( normalizePath ( path . join ( config . packageRoot , '**' ) ) ) ,
792
806
priority : DocumentSelectorPriority . PACKAGE_DIRECTORY ,
793
807
} )
794
808
0 commit comments