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

Function prettifyUrl

packages/vite/src/node/utils.ts:378–390  ·  packages/vite/src/node/utils.ts::prettifyUrl
(url: string, root: string)

Source from the content-addressed store, hash-verified

376 * pretty url for logging.
377 */
378export function prettifyUrl(url: string, root: string): string {
379 url = removeTimestampQuery(url)
380 const isAbsoluteFile = url.startsWith(root)
381 if (isAbsoluteFile || url.startsWith(FS_PREFIX)) {
382 const file = path.posix.relative(
383 root,
384 isAbsoluteFile ? url : fsPathFromId(url),
385 )
386 return colors.dim(file)
387 } else {
388 return colors.dim(url)
389 }
390}
391
392export function isObject(value: unknown): value is Record<string, any> {
393 return Object.prototype.toString.call(value) === class="st">'[object Object]'

Callers 9

resolveIdMethod · 0.90
transformMethod · 0.90
getCachedTransformResultFunction · 0.90
loadAndTransformFunction · 0.90
timeMiddlewareFunction · 0.90
transformMiddlewareFunction · 0.90
transformFunction · 0.90
bundleWorkerEntryFunction · 0.90

Calls 2

removeTimestampQueryFunction · 0.85
fsPathFromIdFunction · 0.85

Tested by

no test coverage detected