MCPcopy
hub / github.com/vitejs/vite / fileToUrl

Function fileToUrl

packages/vite/src/node/server/warmup.ts:63–71  ·  view source on GitHub ↗
(file: string, root: string)

Source from the content-addressed store, hash-verified

61}
62
63function fileToUrl(file: string, root: string) {
64 const url = path.relative(root, file)
65 // out of root, use /@fs/ prefix
66 if (url[0] === '.') {
67 return path.posix.join(FS_PREFIX, normalizePath(file))
68 }
69 // file within root, create root-relative url
70 return '/' + normalizePath(url)
71}
72
73async function mapFiles(files: string[], root: string) {
74 if (!files.length) return []

Callers 1

warmupFileFunction · 0.70

Calls 1

normalizePathFunction · 0.90

Tested by

no test coverage detected