Skip to content

Conversation

@Boshen
Copy link
Member

@Boshen Boshen commented Nov 22, 2025

Add a new API to make tsconfig paths work with the auto-discovered tsconfig.

    /// Resolve `specifier` for an absolute path to a file.
    ///
    /// NOTE: [TsconfigDiscovery::Auto] only work for this API, use `ResolverGeneric::resolve_file` instead.
    ///
    /// # Errors
    ///
    /// * See [ResolveError]
    ///
    /// # Panics
    ///
    /// * If the provided path is not a file.
    pub fn resolve_file<P: AsRef<Path>>(
        &self,
        file: P,
        specifier: &str,
    ) -> Result<Resolution, ResolveError> {

New concept:

Given an input file:

  • There is always a tsconfig associated with this file, we call it the resolved tsconfig, or tsconfig solution (in tsconfck)
  • When resolving path aliases, always use the resolved tsconfig.

Copy link
Member Author

Boshen commented Nov 22, 2025


How to use the Graphite Merge Queue

Add 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
Copy link

codecov bot commented Nov 22, 2025

Codecov Report

❌ Patch coverage is 97.77778% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.28%. Comparing base (feafed8) to head (5b1ae7f).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/tsconfig_resolver.rs 93.44% 4 Missing ⚠️
src/lib.rs 99.36% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #860      +/-   ##
==========================================
+ Coverage   94.14%   94.28%   +0.13%     
==========================================
  Files          17       17              
  Lines        3092     3218     +126     
==========================================
+ Hits         2911     3034     +123     
- Misses        181      184       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 22, 2025

CodSpeed Performance Report

Merging #860 will degrade performances by 3.08%

Comparing 11-22-feat_add_resolve_file_api_for_tsconfig_auto_discovery_to_work (5b1ae7f) with main (feafed8)1

Summary

⚡ 1 improvement
❌ 1 regression
✅ 10 untouched
⏩ 5 skipped2

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark BASE HEAD Change
medium 16.8 µs 17.3 µs -3.08%
resolver_memory[find tsconfig] 15.6 µs 14.1 µs +10.58%

Footnotes

  1. No successful run was found on main (5b1ae7f) during the generation of this report, so feafed8 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 5 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@Boshen Boshen requested a review from shulaoda November 22, 2025 14:58
@Boshen Boshen force-pushed the 11-18-feat_port_tsconfck branch from a0ff198 to 62c4497 Compare November 23, 2025 07:07
@Boshen Boshen force-pushed the 11-22-feat_add_resolve_file_api_for_tsconfig_auto_discovery_to_work branch from b38832c to 24c9f80 Compare November 23, 2025 07:07
@graphite-app graphite-app bot changed the base branch from 11-18-feat_port_tsconfck to graphite-base/860 November 24, 2025 05:15
@Boshen Boshen force-pushed the 11-22-feat_add_resolve_file_api_for_tsconfig_auto_discovery_to_work branch from aba0c5b to 0aed399 Compare November 24, 2025 06:23
@Boshen Boshen changed the base branch from graphite-base/860 to main November 24, 2025 06:27
@Boshen Boshen force-pushed the 11-22-feat_add_resolve_file_api_for_tsconfig_auto_discovery_to_work branch from 0aed399 to f856d8c Compare November 24, 2025 06:28
@Boshen Boshen added the merge label Nov 24, 2025
Copy link
Member Author

Boshen commented Nov 24, 2025

Merge activity

Add a new API to make tsconfig paths work with the auto-discovered tsconfig.

```rust
    /// Resolve `specifier` for an absolute path to a file.
    ///
    /// NOTE: [TsconfigDiscovery::Auto] only work for this API, use `ResolverGeneric::resolve_file` instead.
    ///
    /// # Errors
    ///
    /// * See [ResolveError]
    ///
    /// # Panics
    ///
    /// * If the provided path is not a file.
    pub fn resolve_file<P: AsRef<Path>>(
        &self,
        file: P,
        specifier: &str,
    ) -> Result<Resolution, ResolveError> {
```

---

New concept:

Given an input file:

* There is always a tsconfig associated with this file, we call it the resolved tsconfig, or tsconfig solution (in tsconfck)
* When resolving path aliases, always use the resolved tsconfig.
@graphite-app graphite-app bot force-pushed the 11-22-feat_add_resolve_file_api_for_tsconfig_auto_discovery_to_work branch from f856d8c to 5b1ae7f Compare November 24, 2025 06:33
@graphite-app graphite-app bot merged commit 5b1ae7f into main Nov 24, 2025
17 checks passed
@graphite-app graphite-app bot deleted the 11-22-feat_add_resolve_file_api_for_tsconfig_auto_discovery_to_work branch November 24, 2025 06:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants