@@ -62,60 +62,6 @@ export function readDxtIgnorePatterns(baseDir: string): string[] {
6262 }
6363}
6464
65- /**
66- * Tests if a file path matches a given pattern
67- */
68- function matchesPattern (
69- pattern : string ,
70- filePath : string ,
71- fileName : string ,
72- ) : boolean {
73- if ( pattern . includes ( "*" ) ) {
74- // Enhanced glob matching to handle directory paths like "temp/*"
75- let patternToMatch = pattern ;
76-
77- // Handle patterns like "dir/" by converting to "dir/**"
78- if ( pattern . endsWith ( "/" ) ) {
79- patternToMatch = pattern + "**" ;
80- }
81-
82- // Convert glob pattern to regex, with case sensitivity
83- const regexPattern =
84- "^" +
85- patternToMatch
86- . replace ( / \. / g, "\\." ) // Escape dots
87- . replace ( / \* \* / g, ".*" ) // ** matches anything including /
88- . replace ( / \* / g, "[^/]*" ) + // * matches anything except /
89- "$" ;
90-
91- const regex = new RegExp ( regexPattern ) ;
92-
93- // Test full path
94- if ( regex . test ( filePath ) ) return true ;
95-
96- // Test filename
97- if ( regex . test ( fileName ) ) return true ;
98-
99- // Check if any part of the path matches for patterns like "node_modules"
100- const pathParts = filePath . split ( sep ) ;
101- for ( const part of pathParts ) {
102- if ( regex . test ( part ) ) return true ;
103- }
104- } else {
105- // Exact match
106- if ( fileName === pattern ) return true ;
107-
108- // Check if any part of the path matches
109- if ( filePath . includes ( pattern ) ) return true ;
110-
111- // Handle directory patterns like "tests/"
112- if ( pattern . endsWith ( "/" ) && filePath . startsWith ( pattern ) ) {
113- return true ;
114- }
115- }
116- return false ;
117- }
118-
11965function buildIgnoreChecker ( additionalPatterns : string [ ] ) {
12066 return ignore ( ) . add ( EXCLUDE_PATTERNS ) . add ( additionalPatterns ) ;
12167}
0 commit comments