MCPcopy
hub / github.com/rollup/rollup / patternToIdFilter

Function patternToIdFilter

src/utils/pluginFilter.ts:23–39  ·  view source on GitHub ↗
(pattern: StringOrRegExp)

Source from the content-addressed store, hash-verified

21}
22
23function 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
41function patternToCodeFilter(pattern: StringOrRegExp): PluginFilter {
42 if (pattern instanceof RegExp) {

Callers

nothing calls this directly

Calls 3

normalizeFunction · 0.90
getMatcherStringFunction · 0.85
testMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…