Home / Function/ matches() — vite Function Reference

matches() — vite Function Reference

Architecture documentation for the matches() function in preAlias.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  9bace565_4b23_b1e6_8d82_883dae6cfae8["matches()"]
  1ad4458e_b744_979c_c30e_c1021fdd26b7["preAlias.ts"]
  9bace565_4b23_b1e6_8d82_883dae6cfae8 -->|defined in| 1ad4458e_b744_979c_c30e_c1021fdd26b7
  200356af_4305_31b8_b090_47f38784e182["preAliasPlugin()"]
  200356af_4305_31b8_b090_47f38784e182 -->|calls| 9bace565_4b23_b1e6_8d82_883dae6cfae8
  ae0e5a50_b89b_8a12_820a_fee4d319a219["getAliasPatternMatcher()"]
  ae0e5a50_b89b_8a12_820a_fee4d319a219 -->|calls| 9bace565_4b23_b1e6_8d82_883dae6cfae8
  1a3bec7b_1a11_316f_5831_a0535b829bbf["withTrailingSlash()"]
  9bace565_4b23_b1e6_8d82_883dae6cfae8 -->|calls| 1a3bec7b_1a11_316f_5831_a0535b829bbf
  style 9bace565_4b23_b1e6_8d82_883dae6cfae8 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/plugins/preAlias.ts lines 104–115

function matches(pattern: string | RegExp, importee: string) {
  if (pattern instanceof RegExp) {
    return pattern.test(importee)
  }
  if (importee.length < pattern.length) {
    return false
  }
  if (importee === pattern) {
    return true
  }
  return importee.startsWith(withTrailingSlash(pattern))
}

Domain

Subdomains

Frequently Asked Questions

What does matches() do?
matches() is a function in the vite codebase, defined in packages/vite/src/node/plugins/preAlias.ts.
Where is matches() defined?
matches() is defined in packages/vite/src/node/plugins/preAlias.ts at line 104.
What does matches() call?
matches() calls 1 function(s): withTrailingSlash.
What calls matches()?
matches() is called by 2 function(s): getAliasPatternMatcher, preAliasPlugin.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free