@@ -9542,7 +9542,7 @@ const wildcardCharCodes = [CharacterCodes.asterisk, CharacterCodes.question];
9542
9542
9543
9543
const commonPackageFolders : readonly string [ ] = [ "node_modules" , "bower_components" , "jspm_packages" ] ;
9544
9544
9545
- const implicitExcludePathRegexPattern = `(?!(${ commonPackageFolders . join ( "|" ) } )(/|$))` ;
9545
+ const implicitExcludePathRegexPattern = `(?!(?: ${ commonPackageFolders . join ( "|" ) } )(?: /|$))` ;
9546
9546
9547
9547
/** @internal */
9548
9548
export interface WildcardMatcher {
@@ -9558,12 +9558,12 @@ const filesMatcher: WildcardMatcher = {
9558
9558
* [^./] # matches everything up to the first . character (excluding directory separators)
9559
9559
* (\\.(?!min\\.js$))? # matches . characters but not if they are part of the .min.js file extension
9560
9560
*/
9561
- singleAsteriskRegexFragment : "([^./]|(\\.(?!min\\.js$))?)*" ,
9561
+ singleAsteriskRegexFragment : "(?: [^./]|(?: \\.(?!min\\.js$))?)*" ,
9562
9562
/**
9563
9563
* Regex for the ** wildcard. Matches any number of subdirectories. When used for including
9564
9564
* files or directories, does not match subdirectories that start with a . character
9565
9565
*/
9566
- doubleAsteriskRegexFragment : `(/${ implicitExcludePathRegexPattern } [^/.][^/]*)*?` ,
9566
+ doubleAsteriskRegexFragment : `(?: /${ implicitExcludePathRegexPattern } [^/.][^/]*)*?` ,
9567
9567
replaceWildcardCharacter : match => replaceWildcardCharacter ( match , filesMatcher . singleAsteriskRegexFragment ) ,
9568
9568
} ;
9569
9569
@@ -9573,13 +9573,13 @@ const directoriesMatcher: WildcardMatcher = {
9573
9573
* Regex for the ** wildcard. Matches any number of subdirectories. When used for including
9574
9574
* files or directories, does not match subdirectories that start with a . character
9575
9575
*/
9576
- doubleAsteriskRegexFragment : `(/${ implicitExcludePathRegexPattern } [^/.][^/]*)*?` ,
9576
+ doubleAsteriskRegexFragment : `(?: /${ implicitExcludePathRegexPattern } [^/.][^/]*)*?` ,
9577
9577
replaceWildcardCharacter : match => replaceWildcardCharacter ( match , directoriesMatcher . singleAsteriskRegexFragment ) ,
9578
9578
} ;
9579
9579
9580
9580
const excludeMatcher : WildcardMatcher = {
9581
9581
singleAsteriskRegexFragment : "[^/]*" ,
9582
- doubleAsteriskRegexFragment : "(/.+?)?" ,
9582
+ doubleAsteriskRegexFragment : "(?: /.+?)?" ,
9583
9583
replaceWildcardCharacter : match => replaceWildcardCharacter ( match , excludeMatcher . singleAsteriskRegexFragment ) ,
9584
9584
} ;
9585
9585
@@ -9596,10 +9596,10 @@ export function getRegularExpressionForWildcard(specs: readonly string[] | undef
9596
9596
return undefined ;
9597
9597
}
9598
9598
9599
- const pattern = patterns . map ( pattern => `(${ pattern } )` ) . join ( "|" ) ;
9599
+ const pattern = patterns . map ( pattern => `(?: ${ pattern } )` ) . join ( "|" ) ;
9600
9600
// If excluding, match "foo/bar/baz...", but if including, only allow "foo".
9601
- const terminator = usage === "exclude" ? "($|/)" : "$" ;
9602
- return `^(${ pattern } )${ terminator } ` ;
9601
+ const terminator = usage === "exclude" ? "(?: $|/)" : "$" ;
9602
+ return `^(?: ${ pattern } )${ terminator } ` ;
9603
9603
}
9604
9604
9605
9605
/** @internal */
@@ -9624,7 +9624,7 @@ export function isImplicitGlob(lastPathComponent: string): boolean {
9624
9624
/** @internal */
9625
9625
export function getPatternFromSpec ( spec : string , basePath : string , usage : "files" | "directories" | "exclude" ) : string | undefined {
9626
9626
const pattern = spec && getSubPatternFromSpec ( spec , basePath , usage , wildcardMatchers [ usage ] ) ;
9627
- return pattern && `^(${ pattern } )${ usage === "exclude" ? "($|/)" : "$" } ` ;
9627
+ return pattern && `^(?: ${ pattern } )${ usage === "exclude" ? "(?: $|/)" : "$" } ` ;
9628
9628
}
9629
9629
9630
9630
/** @internal */
@@ -9657,7 +9657,7 @@ export function getSubPatternFromSpec(
9657
9657
}
9658
9658
else {
9659
9659
if ( usage === "directories" ) {
9660
- subpattern += "(" ;
9660
+ subpattern += "(?: " ;
9661
9661
optionalCount ++ ;
9662
9662
}
9663
9663
@@ -9671,7 +9671,7 @@ export function getSubPatternFromSpec(
9671
9671
// appear first in a component. Dotted directories and files can be included explicitly
9672
9672
// like so: **/.*/.*
9673
9673
if ( component . charCodeAt ( 0 ) === CharacterCodes . asterisk ) {
9674
- componentPattern += "([^./]" + singleAsteriskRegexFragment + ")?" ;
9674
+ componentPattern += "(?: [^./]" + singleAsteriskRegexFragment + ")?" ;
9675
9675
component = component . substr ( 1 ) ;
9676
9676
}
9677
9677
else if ( component . charCodeAt ( 0 ) === CharacterCodes . question ) {
0 commit comments