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

Function leavesWorkspaceRoot

src/resolution/workspace-packages.ts:761–766  ·  view source on GitHub ↗
(file: string, target: string, ws: WorkspacePackages | null | undefined)

Source from the content-addressed store, hash-verified

759
760/** Whether `target`, a project path, lies outside the nested root `file` is under, if it is under one. */
761export function leavesWorkspaceRoot(file: string, target: string, ws: WorkspacePackages | null | undefined): boolean {
762 const roots = ws?.nestedRoots;
763 if (!roots) return false;
764 const root = workspaceRootOf(file.replace(/\\/g, '/'), roots);
765 return root !== '' && !target.replace(/\\/g, '/').startsWith(root + '/');
766}
767
768/** The path dependency the nearest declaring manifest above `fromFile` maps `importPath` to. */
769function scopedPackage(importPath: string, ws: WorkspacePackages, fromFile?: string): { name: string; dir: string } | null {

Callers 1

matchPackageFunction · 0.85

Calls 1

workspaceRootOfFunction · 0.85

Tested by

no test coverage detected