-
Notifications
You must be signed in to change notification settings - Fork 814
ExplainFiles to handle duplicated files #2617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Eg it doesnt need to store resolutions in the file etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request implements support for explaining redirect/deduplicated files in the --explainFiles compiler output. When the same package (same name@version) is installed in multiple node_modules locations due to symlinks or other reasons, TypeScript deduplicates them by redirecting to a canonical instance. This PR ensures these redirect files are properly explained in the output.
Changes:
- Added
redirectsFiletype to track redirect files with their insertion position for proper ordering - Modified
ExplainFilesto interleave redirect files with source files in the correct order based on their indices - Updated
explainRedirectAndImpliedFormatto handle both source files and redirect files, generating appropriate diagnostic messages - Removed unused
fileIncludeKindconstants and replaceddeduplicatedPathstracking with more preciseredirectFilesByPathmap
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
internal/compiler/program.go |
Updated UpdateProgram to check redirect files early, modified ExplainFiles to interleave redirect and source files, updated HasSameFileNames to compare redirect files |
internal/compiler/processingDiagnostic.go |
Changed explainRedirectAndImpliedFormat signature to accept filePath instead of *ast.SourceFile |
internal/compiler/includeprocessor.go |
Enhanced explainRedirectAndImpliedFormat to handle redirect files and generate redirect diagnostic messages |
internal/compiler/filesparser.go |
Added logic to create redirectsFile entries when duplicates are detected, adjusted indices for proper ordering |
internal/compiler/fileloader.go |
Added redirectsFile type and replaced deduplicatedPaths with redirectFilesByPath in processedFiles |
internal/compiler/fileInclude.go |
Removed unused fileIncludeKindSourceFromProjectReference and fileIncludeKindOutputFromProjectReference constants and related code |
internal/execute/tsctests/tsc_test.go |
Removed TODO comments for now-implemented features |
testdata/baselines/reference/tsc/declarationEmit/*.js |
Updated test baselines to include redirect file explanations |
No description provided.