(pattern: StringOrRegExp)
| 21 | } |
| 22 | |
| 23 | function patternToIdFilter(pattern: StringOrRegExp): PluginFilter { |
| 24 | if (pattern instanceof RegExp) { |
| 25 | return (id: string) => { |
| 26 | const normalizedId = normalize(id); |
| 27 | const result = pattern.test(normalizedId); |
| 28 | pattern.lastIndex = 0; |
| 29 | return result; |
| 30 | }; |
| 31 | } |
| 32 | const cwd = process.cwd(); |
| 33 | const glob = getMatcherString(pattern, cwd); |
| 34 | const matcher = picomatch(glob, { dot: true }); |
| 35 | return (id: string) => { |
| 36 | const normalizedId = normalize(id); |
| 37 | return matcher(normalizedId); |
| 38 | }; |
| 39 | } |
| 40 | |
| 41 | function patternToCodeFilter(pattern: StringOrRegExp): PluginFilter { |
| 42 | if (pattern instanceof RegExp) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…