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

Function leavesWorkspaceRoot

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

Source from the content-addressed store, hash-verified

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