globSafeResolvedPath() — vite Function Reference
Architecture documentation for the globSafeResolvedPath() function in importMetaGlob.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD ee8a5ec4_ca35_74a5_092e_1714daae7f56["globSafeResolvedPath()"] b68d9c02_4026_8cfa_8eb1_35ec4a8f23cb["importMetaGlob.ts"] ee8a5ec4_ca35_74a5_092e_1714daae7f56 -->|defined in| b68d9c02_4026_8cfa_8eb1_35ec4a8f23cb 2c2bd501_c65a_dbfd_7656_698e0b5e10f2["toAbsoluteGlob()"] 2c2bd501_c65a_dbfd_7656_698e0b5e10f2 -->|calls| ee8a5ec4_ca35_74a5_092e_1714daae7f56 dd94affa_a54f_fda1_045d_230eb3b29bf5["lastNthChar()"] ee8a5ec4_ca35_74a5_092e_1714daae7f56 -->|calls| dd94affa_a54f_fda1_045d_230eb3b29bf5 901430e9_a43f_1c7e_f014_5c6e77e1bb95["globSafePath()"] ee8a5ec4_ca35_74a5_092e_1714daae7f56 -->|calls| 901430e9_a43f_1c7e_f014_5c6e77e1bb95 style ee8a5ec4_ca35_74a5_092e_1714daae7f56 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/vite/src/node/plugins/importMetaGlob.ts lines 621–637
function globSafeResolvedPath(resolved: string, glob: string) {
// we have to escape special glob characters in the resolved path, but keep the user specified globby suffix
// walk back both strings until a character difference is found
// then slice up the resolved path at that pos and escape the first part
let numEqual = 0
const maxEqual = Math.min(resolved.length, glob.length)
while (
numEqual < maxEqual &&
lastNthChar(resolved, numEqual) === lastNthChar(glob, numEqual)
) {
numEqual += 1
}
const staticPartEnd = resolved.length - numEqual
const staticPart = resolved.slice(0, staticPartEnd)
const dynamicPart = resolved.slice(staticPartEnd)
return globSafePath(staticPart) + dynamicPart
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does globSafeResolvedPath() do?
globSafeResolvedPath() is a function in the vite codebase, defined in packages/vite/src/node/plugins/importMetaGlob.ts.
Where is globSafeResolvedPath() defined?
globSafeResolvedPath() is defined in packages/vite/src/node/plugins/importMetaGlob.ts at line 621.
What does globSafeResolvedPath() call?
globSafeResolvedPath() calls 2 function(s): globSafePath, lastNthChar.
What calls globSafeResolvedPath()?
globSafeResolvedPath() is called by 1 function(s): toAbsoluteGlob.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free