( pattern: string | RegExp, cwd: string, )
| 34 | } |
| 35 | |
| 36 | function patternToIdFilter( |
| 37 | pattern: string | RegExp, |
| 38 | cwd: string, |
| 39 | ): PluginFilter { |
| 40 | if (pattern instanceof RegExp) { |
| 41 | return (id: string) => { |
| 42 | const normalizedId = slash(id) |
| 43 | const result = pattern.test(normalizedId) |
| 44 | pattern.lastIndex = 0 |
| 45 | return result |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | const glob = getMatcherString(pattern, cwd) |
| 50 | const matcher = picomatch(glob, { dot: true }) |
| 51 | return (id: string) => { |
| 52 | const normalizedId = slash(id) |
| 53 | return matcher(normalizedId) |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | function patternToCodeFilter(pattern: string | RegExp): PluginFilter { |
| 58 | if (pattern instanceof RegExp) { |
no test coverage detected
searching dependent graphs…