MCPcopy
hub / github.com/rollup/plugins / allowPatterns

Function allowPatterns

packages/node-resolve/src/index.js:88–97  ·  view source on GitHub ↗
(patterns)

Source from the content-addressed store, hash-verified

86
87 // creates a function from the patterns to test if a particular module should be bundled.
88 const allowPatterns = (patterns) => {
89 const regexPatterns = patterns.map((pattern) => {
90 if (pattern instanceof RegExp) {
91 return pattern;
92 }
93 const normalized = pattern.replace(/[\\^$*+?.()|[\]{}]/g, '\\$&');
94 return new RegExp(`^${normalized}$`);
95 });
96 return (id) => !regexPatterns.length || regexPatterns.some((pattern) => pattern.test(id));
97 };
98
99 const resolveOnly =
100 typeof options.resolveOnly === 'function'

Callers 1

nodeResolveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected