@@ -26,7 +26,9 @@ namespace vpath {
2626
2727 const invalidRootComponentRegExp = / ^ (? ! ( \/ | \/ \/ \w + \/ | [ a - z A - Z ] : \/ ? | ) $ ) / ;
2828 const invalidNavigableComponentRegExp = / [: * ? " < > | ] / ;
29+ const invalidNavigableComponentWithWildcardsRegExp = / [: " < > | ] / ;
2930 const invalidNonNavigableComponentRegExp = / ^ \. { 1 , 2 } $ | [: * ? " < > | ] / ;
31+ const invalidNonNavigableComponentWithWildcardsRegExp = / ^ \. { 1 , 2 } $ | [: " < > | ] / ;
3032 const extRegExp = / \. \w + $ / ;
3133
3234 export const enum ValidationFlags {
@@ -44,6 +46,7 @@ namespace vpath {
4446 AllowExtname = 1 << 8 ,
4547 AllowTrailingSeparator = 1 << 9 ,
4648 AllowNavigation = 1 << 10 ,
49+ AllowWildcard = 1 << 11 ,
4750
4851 /** Path must be a valid directory root */
4952 Root = RequireRoot | AllowRoot | AllowTrailingSeparator ,
@@ -63,7 +66,9 @@ namespace vpath {
6366 const hasDirname = components . length > 2 ;
6467 const hasBasename = components . length > 1 ;
6568 const hasExtname = hasBasename && extRegExp . test ( components [ components . length - 1 ] ) ;
66- const invalidComponentRegExp = flags & ValidationFlags . AllowNavigation ? invalidNavigableComponentRegExp : invalidNonNavigableComponentRegExp ;
69+ const invalidComponentRegExp = flags & ValidationFlags . AllowNavigation
70+ ? flags & ValidationFlags . AllowWildcard ? invalidNavigableComponentWithWildcardsRegExp : invalidNavigableComponentRegExp
71+ : flags & ValidationFlags . AllowWildcard ? invalidNonNavigableComponentWithWildcardsRegExp : invalidNonNavigableComponentRegExp ;
6772
6873 // Validate required components
6974 if ( flags & ValidationFlags . RequireRoot && ! hasRoot ) return false ;
0 commit comments