-
-
Notifications
You must be signed in to change notification settings - Fork 34
feat: add resolve_file API for tsconfig auto discovery to work
#860
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: 11-18-feat_port_tsconfck
Are you sure you want to change the base?
feat: add resolve_file API for tsconfig auto discovery to work
#860
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd the label merge to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 11-18-feat_port_tsconfck #860 +/- ##
============================================================
+ Coverage 94.14% 94.29% +0.14%
============================================================
Files 17 17
Lines 3092 3208 +116
============================================================
+ Hits 2911 3025 +114
- Misses 181 183 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
CodSpeed Performance ReportMerging #860 will improve performances by 10.26%Comparing Summary
Benchmarks breakdown
Footnotes
|
src/tsconfig_resolver.rs
Outdated
| if !cached_path.path.is_absolute() { | ||
| return Ok(None); | ||
| match &self.options.tsconfig { | ||
| None | Some(TsconfigDiscovery::Auto) => self.find_tsconfig_auto(cached_path), |
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.
When tsconfig is set to None, we shouldn’t attempt to look for a tsconfig file.
src/tsconfig_resolver.rs
Outdated
| let Some(tsconfig) = tsconfig else { return Ok(None) }; | ||
| let paths = tsconfig.resolve(cached_path.path(), specifier); |
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.
In auto mode, the tsconfig may include references, so tsconfig.resolve ends up resolving the paths from those referenced configs too.
Lines 354 to 362 in 39ca611
| pub(crate) fn resolve(&self, path: &Path, specifier: &str) -> Vec<PathBuf> { | |
| let paths = self.resolve_path_alias(specifier); | |
| for tsconfig in &self.references_resolved { | |
| if path.starts_with(tsconfig.base_path()) { | |
| return [tsconfig.resolve_path_alias(specifier), paths].concat(); | |
| } | |
| } | |
| paths | |
| } |
a0ff198 to
62c4497
Compare
b38832c to
24c9f80
Compare

Add a new API to make tsconfig paths work with the auto-discovered tsconfig.
New concept:
Given an input file: