-
Notifications
You must be signed in to change notification settings - Fork 658
Implement tryLoadInputFileForPath, file loader diags #1302
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
Conversation
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 PR implements the tryLoadInputFileForPath function to map output file paths back to input files for package self-names when outDir or declarationDir are used, addressing #1079. It also updates several baseline files to reflect the expected output changes and introduces new helper functions to compute common source directories and candidate output directories.
Reviewed Changes
Copilot reviewed 57 out of 57 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
testdata/baselines/reference/** | Baseline files for conformance, types, symbols, and errors have been updated to align with the self-name resolution changes. |
internal/module/resolver.go | The tryLoadInputFileForPath function and several related helper methods have been added/modified to support output-to-input path mapping. |
Comments suppressed due to low confidence (1)
internal/module/resolver.go:773
- [nitpick] Given the multiple branching paths and the intricate logic for guessing the common source directory, additional compiler tests to cover edge cases for these calculations would help ensure stability as the project evolves.
var commonSourceDirGuesses []string
...ata/baselines/reference/submodule/compiler/nodeNextPackageSelfNameWithOutDir.errors.txt.diff
Outdated
Show resolved
Hide resolved
I've removed the guessing logic, erroring if we don't have RootDir or ConfigFilePath. This still works to fix the two linked issues. |
if r.compilerOptions.RootDir != "" { | ||
// A `rootDir` compiler option strongly indicates the root location | ||
rootDir = r.compilerOptions.RootDir | ||
} else if r.compilerOptions.Composite.IsTrue() && r.compilerOptions.ConfigFilePath != "" { |
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.
According to microsoft/TypeScript#54500, the --composite
check will go away in 6.0, making the error below only possible for non-tsconfig builds.
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.
Should I do that now?
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.
I'm just going to let this merge and address it separately if needed, given this will unbreak people
Fixes #1079
Fixes #1345