toAbsoluteGlob() — vite Function Reference
Architecture documentation for the toAbsoluteGlob() function in importMetaGlob.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD 2c2bd501_c65a_dbfd_7656_698e0b5e10f2["toAbsoluteGlob()"] b68d9c02_4026_8cfa_8eb1_35ec4a8f23cb["importMetaGlob.ts"] 2c2bd501_c65a_dbfd_7656_698e0b5e10f2 -->|defined in| b68d9c02_4026_8cfa_8eb1_35ec4a8f23cb e4ded9fb_6262_73a6_ae73_068c08e2b994["parseImportGlob()"] e4ded9fb_6262_73a6_ae73_068c08e2b994 -->|calls| 2c2bd501_c65a_dbfd_7656_698e0b5e10f2 901430e9_a43f_1c7e_f014_5c6e77e1bb95["globSafePath()"] 2c2bd501_c65a_dbfd_7656_698e0b5e10f2 -->|calls| 901430e9_a43f_1c7e_f014_5c6e77e1bb95 a4adb1a7_cf54_091f_eb63_8217e684a8e1["normalizePath()"] 2c2bd501_c65a_dbfd_7656_698e0b5e10f2 -->|calls| a4adb1a7_cf54_091f_eb63_8217e684a8e1 ee8a5ec4_ca35_74a5_092e_1714daae7f56["globSafeResolvedPath()"] 2c2bd501_c65a_dbfd_7656_698e0b5e10f2 -->|calls| ee8a5ec4_ca35_74a5_092e_1714daae7f56 style 2c2bd501_c65a_dbfd_7656_698e0b5e10f2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/vite/src/node/plugins/importMetaGlob.ts lines 639–685
export async function toAbsoluteGlob(
glob: string,
root: string,
importer: string | undefined,
resolveId: IdResolver,
base?: string,
): Promise<string> {
let pre = ''
if (glob[0] === '!') {
pre = '!'
glob = glob.slice(1)
}
root = globSafePath(root)
let dir
if (base) {
if (base[0] === '/') {
dir = posix.join(root, base)
} else {
dir = posix.resolve(
importer ? globSafePath(dirname(importer)) : root,
base,
)
}
} else {
dir = importer ? globSafePath(dirname(importer)) : root
}
if (glob[0] === '/') return pre + posix.join(root, glob.slice(1))
if (glob.startsWith('./')) return pre + posix.join(dir, glob.slice(2))
if (glob.startsWith('../')) return pre + posix.join(dir, glob)
if (glob.startsWith('**')) return pre + glob
const isSubImportsPattern = glob[0] === '#' && glob.includes('*')
const resolved = normalizePath(
(await resolveId(glob, importer, {
custom: { 'vite:import-glob': { isSubImportsPattern } },
})) || glob,
)
if (isAbsolute(resolved)) {
return pre + globSafeResolvedPath(resolved, glob)
}
throw new Error(
`Invalid glob: "${glob}" (resolved: "${resolved}"). It must start with '/' or './'`,
)
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does toAbsoluteGlob() do?
toAbsoluteGlob() is a function in the vite codebase, defined in packages/vite/src/node/plugins/importMetaGlob.ts.
Where is toAbsoluteGlob() defined?
toAbsoluteGlob() is defined in packages/vite/src/node/plugins/importMetaGlob.ts at line 639.
What does toAbsoluteGlob() call?
toAbsoluteGlob() calls 3 function(s): globSafePath, globSafeResolvedPath, normalizePath.
What calls toAbsoluteGlob()?
toAbsoluteGlob() 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