in src/compiler.ts [444:481]
private findProjectReferences(): string[] {
const pkg = this.options.projectInfo.packageJson;
const ret = new Array<string>();
const dependencyNames = new Set<string>();
for (const dependencyMap of [pkg.dependencies, pkg.devDependencies, pkg.peerDependencies]) {
if (dependencyMap === undefined) {
continue;
}
for (const name of Object.keys(dependencyMap)) {
dependencyNames.add(name);
}
}
for (const tsconfigFile of Array.from(dependencyNames).map((depName) => this.findMonorepoPeerTsconfig(depName))) {
if (!tsconfigFile) {
continue;
}
const { config: tsconfig } = ts.readConfigFile(tsconfigFile, this.system.readFile);
// Add references to any TypeScript package we find that is 'composite' enabled.
// Make it relative.
if (tsconfig.compilerOptions?.composite) {
ret.push(path.relative(this.options.projectInfo.projectRoot, path.dirname(tsconfigFile)));
} else {
// Not a composite package--if this package is in a node_modules directory, that is most
// likely correct, otherwise it is most likely an error (heuristic here, I don't know how to
// properly check this).
if (tsconfigFile.includes('node_modules')) {
LOG.warn('%s: not a composite TypeScript package, but it probably should be', path.dirname(tsconfigFile));
}
}
}
return ret;
}