Skip to content

Explain why Arc<dyn TsconfigFinder> is necessary over using Resolver directly#8414

Closed
Copilot wants to merge 1 commit intoperf/unify-tsconfig-discoveryfrom
copilot/sub-pr-8413
Closed

Explain why Arc<dyn TsconfigFinder> is necessary over using Resolver directly#8414
Copilot wants to merge 1 commit intoperf/unify-tsconfig-discoveryfrom
copilot/sub-pr-8413

Conversation

Copy link
Contributor

Copilot AI commented Feb 22, 2026

Addresses the review question on #8413: is Arc<dyn TsconfigFinder> necessary, or can Resolver be used directly?

Why Resolver cannot be used directly in RawTransformOptions:

RawTransformOptions lives in rolldown_common. rolldown_resolver (which owns Resolver<Fs>) already depends on rolldown_common, making the reverse direction a circular dependency.

Alternatives evaluated:

  • Arc<ResolverGeneric<Fs>> from oxc_resolver — would require making RawTransformOptions<Fs> generic, propagating through TransformOptionsInner, TransformOptions, and NormalizedBundlerOptions; or adding rolldown_fs as a rolldown_common dependency for the OsFileSystem default. Both add more coupling than the current trait.
  • Arc<dyn Fn(&Path) -> ...> — avoids a named type but is less readable; same dynamic dispatch underneath.
  • Thread Resolver as a parameter to options_for_fileoptions_for_file is defined in rolldown_common, so it still requires an abstraction to reference the rolldown_resolver type there.

TsconfigFinder is the standard Rust dependency-inversion pattern for this constraint. No code changes made; reply left on the review thread.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Fix issues raised on tsconfig discovery PR Explain why Arc<dyn TsconfigFinder> is necessary over using Resolver directly Feb 22, 2026
Copilot AI requested a review from hyf0 February 22, 2026 04:45
@hyf0 hyf0 closed this Feb 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants