File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -987,17 +987,17 @@ namespace ts {
987987 // The * and ? wildcards should not match directories or files that start with . if they
988988 // appear first in a component. Dotted directories and files can be included explicitly
989989 // like so: **/.*/.*
990- if ( component . indexOf ( "*" ) === 0 ) {
990+ if ( component . charCodeAt ( 0 ) === CharacterCodes . asterisk ) {
991991 subpattern += "([^./]" + singleAsteriskRegexFragment + ")?" ;
992992 component = component . substr ( 1 ) ;
993993 }
994- else if ( component . indexOf ( "?" ) === 0 ) {
994+ else if ( component . charCodeAt ( 0 ) === CharacterCodes . question ) {
995995 subpattern += "[^./]" ;
996996 component = component . substr ( 1 ) ;
997997 }
998998 }
999999
1000- subpattern += component . replace ( reservedCharacterPattern , replaceWildcardCharacter ) ;
1000+ subpattern += replaceWildcardCharacters ( component , singleAsteriskRegexFragment ) ;
10011001 hasWrittenComponent = true ;
10021002 }
10031003 }
@@ -1020,6 +1020,10 @@ namespace ts {
10201020 }
10211021
10221022 return "^(" + pattern + ( usage === "exclude" ? ")($|/)" : ")$" ) ;
1023+ }
1024+
1025+ function replaceWildcardCharacters ( component : string , singleAsteriskRegexFragment : string ) {
1026+ return component . replace ( reservedCharacterPattern , replaceWildcardCharacter ) ;
10231027
10241028 function replaceWildcardCharacter ( match : string ) {
10251029 return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match ;
You can’t perform that action at this time.
0 commit comments