in src/implementationGuides/IGCompiler.ts [179:195]
private depthFirst(parents: string[], pMap: { [key: string]: string[] }): void {
const igId = parents[parents.length - 1];
const dependencies = pMap[igId];
if (!dependencies) {
throw new Error(`Missing dependency ${igId}`);
}
for (const parentId of dependencies) {
if (parents.includes(parentId)) {
throw new Error(`Circular dependency found: ${parents.join(' -> ')} -> ${parentId}`);
}
if (!parentId.startsWith(BASE_FHIR_NAME)) {
parents.push(parentId);
this.depthFirst(parents, pMap);
parents.pop();
}
}
}