one
Version:
One is a new React Framework that makes Vite serve both native and web.
12 lines (10 loc) • 390 B
text/typescript
import { getPathnameFromFilePath } from '../../utils/getPathnameFromFilePath'
import type { RouteInfo } from '../../vite/types'
export function getPathFromRoute(
route: RouteInfo<string>,
options: { includeIndex?: boolean } = {}
) {
return getPathnameFromFilePath(route.file, {}, false, { ...options, preserveExtensions: true })
.replace(/^\.\//, '/')
.replace(/\/+$/, '')
}