Home / Function/ findCorrespondingCloseParenthesisPosition() — vite Function Reference

findCorrespondingCloseParenthesisPosition() — vite Function Reference

Architecture documentation for the findCorrespondingCloseParenthesisPosition() function in importMetaGlob.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  c9d40398_718e_f740_f335_71974e4b9ccd["findCorrespondingCloseParenthesisPosition()"]
  b68d9c02_4026_8cfa_8eb1_35ec4a8f23cb["importMetaGlob.ts"]
  c9d40398_718e_f740_f335_71974e4b9ccd -->|defined in| b68d9c02_4026_8cfa_8eb1_35ec4a8f23cb
  e4ded9fb_6262_73a6_ae73_068c08e2b994["parseImportGlob()"]
  e4ded9fb_6262_73a6_ae73_068c08e2b994 -->|calls| c9d40398_718e_f740_f335_71974e4b9ccd
  style c9d40398_718e_f740_f335_71974e4b9ccd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/plugins/importMetaGlob.ts lines 371–397

function findCorrespondingCloseParenthesisPosition(
  cleanCode: string,
  openPos: number,
) {
  const closePos = cleanCode.indexOf(')', openPos)
  if (closePos < 0) return -1

  if (!cleanCode.slice(openPos, closePos).includes('(')) return closePos

  let remainingParenthesisCount = 0
  const cleanCodeLen = cleanCode.length
  for (let pos = openPos; pos < cleanCodeLen; pos++) {
    switch (cleanCode[pos]) {
      case '(': {
        remainingParenthesisCount++
        break
      }
      case ')': {
        remainingParenthesisCount--
        if (remainingParenthesisCount <= 0) {
          return pos
        }
      }
    }
  }
  return -1
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does findCorrespondingCloseParenthesisPosition() do?
findCorrespondingCloseParenthesisPosition() is a function in the vite codebase, defined in packages/vite/src/node/plugins/importMetaGlob.ts.
Where is findCorrespondingCloseParenthesisPosition() defined?
findCorrespondingCloseParenthesisPosition() is defined in packages/vite/src/node/plugins/importMetaGlob.ts at line 371.
What calls findCorrespondingCloseParenthesisPosition()?
findCorrespondingCloseParenthesisPosition() is called by 1 function(s): parseImportGlob.

Analyze Your Own Codebase

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

Try Supermodel Free