MCPcopy Create free account
hub / github.com/vercel/vercel / resolveDependencyGroup

Function resolveDependencyGroup

packages/python/src/diagnostics.ts:31–53  ·  view source on GitHub ↗

* 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()
)

Source from the content-addressed store, hash-verified

29 * Cycle detection via `ancestors` prevents infinite recursion.
30 */
31function 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
55function mapSource(src: UvLockPackageSource | undefined): {
56 source?: string;

Callers 1

generateProjectManifestFunction · 0.85

Calls 5

isDependencyGroupIncludeFunction · 0.85
pushMethod · 0.65
hasMethod · 0.45
addMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected