MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / workspacePackageDirOf

Function workspacePackageDirOf

src/resolution/workspace-packages.ts:849–858  ·  view source on GitHub ↗
(ws: WorkspacePackages, file: string)

Source from the content-addressed store, hash-verified

847 * files included.
848 */
849export function workspacePackageDirOf(ws: WorkspacePackages, file: string): string | null {
850 let dirs = PACKAGE_DIRS.get(ws);
851 if (!dirs) {
852 const all = new Set(ws.byName.values());
853 for (const names of ws.scopedByName?.values() ?? []) for (const dir of names.values()) all.add(dir);
854 dirs = [...all].filter((dir) => dir !== '').sort((a, b) => a.length - b.length);
855 PACKAGE_DIRS.set(ws, dirs);
856 }
857 return dirs.find((dir) => file.startsWith(dir + '/')) ?? null;
858}
859
860/** Read workspace glob patterns from package.json + pnpm-workspace.yaml. */
861function readWorkspaceGlobs(projectRoot: string): string[] {

Callers 1

workspacePackageDirOfMethod · 0.90

Calls 3

getMethod · 0.65
addMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected