(opts: NormalizedPluginOptions, dirPath: string)
| 21 | } |
| 22 | |
| 23 | export function getPathnameFromDirPath(opts: NormalizedPluginOptions, dirPath: string) { |
| 24 | // get relative file system path from the dirname |
| 25 | // ignoring the already known "index" filename |
| 26 | const relFilePath = relative(opts.routesDir, dirPath); |
| 27 | |
| 28 | // ensure file system path uses / (POSIX) instead of \\ (windows) |
| 29 | let pathname = normalizePath(relFilePath); |
| 30 | |
| 31 | pathname = normalizePathname(pathname, opts.basePathname, opts.trailingSlash)! |
| 32 | .split('/') |
| 33 | // remove grouped layout segments |
| 34 | .filter((segment) => !isGroupedLayoutName(segment)) |
| 35 | .join('/'); |
| 36 | if (pathname === '') { |
| 37 | return '/'; |
| 38 | } |
| 39 | return pathname; |
| 40 | } |
| 41 | |
| 42 | export function getMenuPathname(opts: NormalizedPluginOptions, filePath: string) { |
| 43 | let pathname = normalizePath(relative(opts.routesDir, filePath)); |
no test coverage detected
searching dependent graphs…