optimizeSafeRealPathSync() — vite Function Reference
Architecture documentation for the optimizeSafeRealPathSync() function in utils.ts from the vite codebase.
Entity Profile
Dependency Diagram
graph TD 49983da6_08ff_5c1b_b63f_c429d1e6b269["optimizeSafeRealPathSync()"] 031bc221_67a8_c579_f2bf_bb30a08beeb2["utils.ts"] 49983da6_08ff_5c1b_b63f_c429d1e6b269 -->|defined in| 031bc221_67a8_c579_f2bf_bb30a08beeb2 b37c4caa_8852_a76d_d1fb_15d16a693604["windowsSafeRealPathSync()"] b37c4caa_8852_a76d_d1fb_15d16a693604 -->|calls| 49983da6_08ff_5c1b_b63f_c429d1e6b269 style 49983da6_08ff_5c1b_b63f_c429d1e6b269 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/vite/src/node/utils.ts lines 708–735
function optimizeSafeRealPathSync() {
// Check the availability `fs.realpathSync.native`
// in Windows virtual and RAM disks that bypass the Volume Mount Manager, in programs such as imDisk
// get the error EISDIR: illegal operation on a directory
try {
fs.realpathSync.native(path.resolve('./'))
} catch (error) {
if (error.message.includes('EISDIR: illegal operation on a directory')) {
safeRealpathSync = fs.realpathSync
return
}
}
exec('net use', (error, stdout) => {
if (error) return
const lines = stdout.split('\n')
// OK Y: \\NETWORKA\Foo Microsoft Windows Network
// OK Z: \\NETWORKA\Bar Microsoft Windows Network
for (const line of lines) {
const m = parseNetUseRE.exec(line)
if (m) windowsNetworkMap.set(m[2], m[1])
}
if (windowsNetworkMap.size === 0) {
safeRealpathSync = fs.realpathSync.native
} else {
safeRealpathSync = windowsMappedRealpathSync
}
})
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does optimizeSafeRealPathSync() do?
optimizeSafeRealPathSync() is a function in the vite codebase, defined in packages/vite/src/node/utils.ts.
Where is optimizeSafeRealPathSync() defined?
optimizeSafeRealPathSync() is defined in packages/vite/src/node/utils.ts at line 708.
What calls optimizeSafeRealPathSync()?
optimizeSafeRealPathSync() is called by 1 function(s): windowsSafeRealPathSync.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free