mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-17 19:11:26 -06:00
Responding to PR feedback
This commit is contained in:
parent
0966ebcffb
commit
e0aca418bc
@ -987,17 +987,17 @@ namespace ts {
|
||||
// The * and ? wildcards should not match directories or files that start with . if they
|
||||
// appear first in a component. Dotted directories and files can be included explicitly
|
||||
// like so: **/.*/.*
|
||||
if (component.indexOf("*") === 0) {
|
||||
if (component.charCodeAt(0) === CharacterCodes.asterisk) {
|
||||
subpattern += "([^./]" + singleAsteriskRegexFragment + ")?";
|
||||
component = component.substr(1);
|
||||
}
|
||||
else if (component.indexOf("?") === 0) {
|
||||
else if (component.charCodeAt(0) === CharacterCodes.question) {
|
||||
subpattern += "[^./]";
|
||||
component = component.substr(1);
|
||||
}
|
||||
}
|
||||
|
||||
subpattern += component.replace(reservedCharacterPattern, replaceWildcardCharacter);
|
||||
subpattern += replaceWildcardCharacters(component, singleAsteriskRegexFragment);
|
||||
hasWrittenComponent = true;
|
||||
}
|
||||
}
|
||||
@ -1020,6 +1020,10 @@ namespace ts {
|
||||
}
|
||||
|
||||
return "^(" + pattern + (usage === "exclude" ? ")($|/)" : ")$");
|
||||
}
|
||||
|
||||
function replaceWildcardCharacters(component: string, singleAsteriskRegexFragment: string) {
|
||||
return component.replace(reservedCharacterPattern, replaceWildcardCharacter);
|
||||
|
||||
function replaceWildcardCharacter(match: string) {
|
||||
return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user