MCPcopy
hub / github.com/QwikDev/qwik / getPathnameFromDirPath

Function getPathnameFromDirPath

packages/qwik-city/src/utils/fs.ts:23–40  ·  view source on GitHub ↗
(opts: NormalizedPluginOptions, dirPath: string)

Source from the content-addressed store, hash-verified

21}
22
23export 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
42export function getMenuPathname(opts: NormalizedPluginOptions, filePath: string) {
43 let pathname = normalizePath(relative(opts.routesDir, filePath));

Callers 5

fs.unit.tsFile · 0.90
getMarkdownRelativeUrlFunction · 0.90
resolveRouteFunction · 0.90
resolveEntryFunction · 0.90

Calls 5

normalizePathnameFunction · 0.90
relativeFunction · 0.85
isGroupedLayoutNameFunction · 0.85
normalizePathFunction · 0.70
joinMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…