-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Add support for including dotted and .min.js files explicitly in include #9528
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
8325565
0966ebc
e0aca41
0fe6c55
fd2caf6
574851f
bd48e55
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd prefer this stay outside of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I rewrote the whole replace step as a separate function to make it clearer |
||
return match === "*" ? singleAsteriskRegexFragment : match === "?" ? "[^/]" : "\\" + match; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still introduces a closure. Another approach would be:
With this, no new closures are introduced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done