mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-29 16:29:19 -05:00
This handles when packages are symbol links in mono repo like scenarios to use source files instead of output d.ts from project reference (#34743)
* Fix incorrect outDir usage instead of out * Handle symlinks of packages in mono repo like packages Fixes #34723 * Added clarified comment
This commit is contained in:
@@ -2271,7 +2271,19 @@ namespace ts {
|
||||
// Get source file from normalized fileName
|
||||
function findSourceFile(fileName: string, path: Path, isDefaultLib: boolean, ignoreNoDefaultLib: boolean, refFile: RefFile | undefined, packageId: PackageId | undefined): SourceFile | undefined {
|
||||
if (useSourceOfProjectReferenceRedirect) {
|
||||
const source = getSourceOfProjectReferenceRedirect(fileName);
|
||||
let source = getSourceOfProjectReferenceRedirect(fileName);
|
||||
// If preserveSymlinks is true, module resolution wont jump the symlink
|
||||
// but the resolved real path may be the .d.ts from project reference
|
||||
// Note:: Currently we try the real path only if the
|
||||
// file is from node_modules to avoid having to run real path on all file paths
|
||||
if (!source &&
|
||||
host.realpath &&
|
||||
options.preserveSymlinks &&
|
||||
isDeclarationFileName(fileName) &&
|
||||
stringContains(fileName, nodeModulesPathPart)) {
|
||||
const realPath = host.realpath(fileName);
|
||||
if (realPath !== fileName) source = getSourceOfProjectReferenceRedirect(realPath);
|
||||
}
|
||||
if (source) {
|
||||
const file = isString(source) ?
|
||||
findSourceFile(source, toPath(source), isDefaultLib, ignoreNoDefaultLib, refFile, packageId) :
|
||||
|
||||
Reference in New Issue
Block a user