* Resolve a dependency group, recursively following `{include-group: "..."}` references. * Cycle detection via `ancestors` prevents infinite recursion.
( groupName: string, allGroups: PyProjectDependencyGroups, ancestors: Set<string> = new Set() )
| 29 | * Cycle detection via `ancestors` prevents infinite recursion. |
| 30 | */ |
| 31 | function resolveDependencyGroup( |
| 32 | groupName: string, |
| 33 | allGroups: PyProjectDependencyGroups, |
| 34 | ancestors: Set<string> = new Set() |
| 35 | ): string[] { |
| 36 | if (ancestors.has(groupName)) return []; |
| 37 | const entries = allGroups[groupName]; |
| 38 | if (!Array.isArray(entries)) return []; |
| 39 | |
| 40 | ancestors.add(groupName); |
| 41 | const result: string[] = []; |
| 42 | for (const entry of entries) { |
| 43 | if (typeof entry === 'string') { |
| 44 | result.push(entry); |
| 45 | } else if (isDependencyGroupInclude(entry)) { |
| 46 | result.push( |
| 47 | ...resolveDependencyGroup(entry['include-group'], allGroups, ancestors) |
| 48 | ); |
| 49 | } |
| 50 | } |
| 51 | ancestors.delete(groupName); |
| 52 | return result; |
| 53 | } |
| 54 | |
| 55 | function mapSource(src: UvLockPackageSource | undefined): { |
| 56 | source?: string; |
no test coverage detected