MCPcopy
hub / github.com/vitejs/vite / matches

Function matches

packages/vite/src/node/plugins/preAlias.ts:107–118  ·  view source on GitHub ↗
(pattern: string | RegExp, importee: string)

Source from the content-addressed store, hash-verified

105
106// In sync with rollup plugin alias logic
107function matches(pattern: string | RegExp, importee: string) {
108 if (pattern instanceof RegExp) {
109 return pattern.test(importee)
110 }
111 if (importee.length < pattern.length) {
112 return false
113 }
114 if (importee === pattern) {
115 return true
116 }
117 return importee.startsWith(withTrailingSlash(pattern))
118}
119
120function getAliasPatterns(
121 entries: (AliasOptions | undefined) & Alias[],

Callers 2

resolveIdFunction · 0.85
getAliasPatternMatcherFunction · 0.85

Calls 1

withTrailingSlashFunction · 0.90

Tested by

no test coverage detected