The nested root (see WorkspacePackages.nestedRoots) `file` is under, the deepest; `''` for the project's own.
(file: string, roots: string[])
| 750 | |
| 751 | /** The nested root (see WorkspacePackages.nestedRoots) `file` is under, the deepest; `''` for the project's own. */ |
| 752 | function workspaceRootOf(file: string, roots: string[]): string { |
| 753 | let root = ''; |
| 754 | for (const dir of roots) { |
| 755 | if (dir.length > root.length && file.startsWith(dir + '/')) root = dir; |
| 756 | } |
| 757 | return root; |
| 758 | } |
| 759 | |
| 760 | /** Whether `target`, a project path, lies outside the nested root `file` is under, if it is under one. */ |
| 761 | export function leavesWorkspaceRoot(file: string, target: string, ws: WorkspacePackages | null | undefined): boolean { |
no outgoing calls
no test coverage detected