refactor: resolve the manual tsconfig per file instead of once at startup#10200
Conversation
✅ Deploy Preview for rolldown-rs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
How to use the Graphite Merge QueueAdd the label graphite: merge-when-ready 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. |
Merging this PR will not alter performance
Comparing Footnotes
|
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2a0d925f35
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…rse failures (#1287) Tsconfig files are loaded lazily during resolution, and when the load fails with anything other than "not found", the error surfaces as the generic `ResolveError::Json` or `ResolveError::IOError`. Both variants are also used for package.json failures, so callers cannot tell which file actually failed to load. Rolldown hit this while trying to report a broken tsconfig as a proper `TSCONFIG_ERROR` diagnostic instead of an internal error, see the discussion in rolldown/rolldown#10200 (rolldown/rolldown#10200 (comment)). This PR adds a dedicated variant that wraps the original error instead of replacing it, so the JSON details (path, line, column) stay reachable through `source`: ```rust /// Failed to read or parse a tsconfig file. #[error("Failed to load tsconfig {path:?}: {source}")] TsconfigLoadFailed { path: PathBuf, source: Box<Self> }, ``` The wrapping happens in `Cache::get_tsconfig`, the single entry point for tsconfig loading, so manual mode, auto discovery, the `extends` chain and project references are all covered at once. `TsconfigNotFound` keeps its dedicated variant, and package.json failures keep surfacing as plain `Json` / `IOError`. The auto discovery walk used to skip unreadable tsconfig files by matching `IOError` directly and now matches the wrapped form, keeping the same behavior. Since `ResolveError` is `#[non_exhaustive]`, adding the variant is not a breaking change for downstream matches. The existing `broken`, `test_extend_tsconfig_unreadable_file` and `test_references_unreadable_file` tests are updated to assert the new shape.
Merge activity
|
…rtup (#10200) Groundwork for #9598 (rebuild when tsconfig changes). A manual tsconfig without references was resolved and merged into the transform options once when the bundler is created (Normal mode). That merged result lives as long as the bundler, so a watch rebuild can never pick up tsconfig edits. This PR makes manual mode always go through Raw mode, the same per-file resolution path that auto-discovery and manual-with-references already use. Together with a follow-up that clears the tsconfig caches on watch rebuilds, tsconfig edits become re-readable for every mode. Since the eager `resolve_tsconfig` call is gone, a broken manual tsconfig now fails on the first resolution instead of at startup: every resolve consults the tsconfig for `paths`/`baseUrl`/`rootDirs` before doing normal path resolution, which lazily loads the tsconfig file. For the entry this used to end up as `UNHANDLEABLE_ERROR`, because `load_entry_module` only mapped `NotFound` and `PackagePathNotExported` and sent everything else to the unhandleable fallback. `TsconfigNotFound`, `TsconfigSelfReference` and `TsconfigCircularExtend` are now mapped to a proper `TSCONFIG_ERROR`. The rendered message is identical to the old startup-time one, so existing snapshots stay unchanged. The import side (`resolve_utils`) already prints readable messages for these variants and needs no change. Two behavior differences worth knowing while reviewing: files that per-file discovery skips (inside node_modules, virtual modules, plain JS) now get the base transform options instead of the merged manual tsconfig, which matches what auto-discovery and manual-with-references already do. And tsconfig merge-conflict warnings show up when the first file using that tsconfig is compiled, not at startup. Part of #9598.
2a0d925 to
b982305
Compare
…nfig lookups (#10205) Groundwork for #9598 (rebuild when tsconfig changes), on top of #10200. `RawTransformOptions` used to build its own private oxc `Resolver` just for per-file tsconfig discovery. That means two resolvers with two caches: the same tsconfig file is read and parsed twice, and clearing the main resolver's cache (as the watcher already does before every rebuild) never touches the transformer's copy, so the two sides can end up seeing different tsconfig contents. For #9598 we need one clear to invalidate both. `RawTransformOptions` now receives an `Arc<ResolverGeneric<OsFileSystem>>` derived from the main resolver via the new `Resolver::derive_cache_sharing_resolver()`. oxc's `clone_with_options` shares the cache `Arc` when the `yarn_pnp` option matches, and since we clone with the resolver's own options it always matches. Both sides now read the same tsconfig/fs/package.json cache, and one `clear_cache` on the main resolver invalidates both. The `TsConfig` and `yarn_pnp` parameters of `RawTransformOptions::new` are gone because the tsconfig discovery config comes with the shared resolver, which was built from the same `TsConfig` value. Notes for reviewers: `rolldown_common` gains a `rolldown_fs` dependency, which is cycle-free since `rolldown_fs` only depends on `oxc_resolver` and `vfs`. The two Raw-mode arms in `prepare_build_context` became identical after this change and were merged into one. The derived resolver inherits the main resolver's full options instead of oxc defaults, but `find_tsconfig` only depends on the `tsconfig` option, which was already configured identically on both sides, so per-file discovery results are unchanged. The transformer also now reads files through the same `OsFileSystem` instance as module resolution, so the yarn pnp setting is applied consistently. Part of #9598. <!-- - What is this PR solving? Write a clear and concise description. - Reference the issues it solves (e.g. `fixes #123`). - What other alternatives have you explored? - Are there any parts you think require more attention from reviewers? Also, please make sure you do the following: - Read the Contributing Guidelines at https://rolldown.rs/contribution-guide/. - Check that there isn't already a PR that solves the problem the same way. If you find a duplicate, please help us review it. - Update the corresponding documentation if needed. - Include relevant tests that fail without this PR but pass with it. If the tests are not included, explain why. Thank you for contributing to Rolldown! -->
## [1.2.0] - 2026-07-15 ### 🚀 Features - dev: skip shipping factories for newly imported top-level modules (#10223) by @h-a-n-a - dev: per-client ship map for HMR patch sizing (#10208) by @h-a-n-a - dev: client-side HMR (#10164) by @h-a-n-a - dev: send a full-reload update to clients when a tsconfig changes (#10262) by @shulaoda - treat `import.meta['url']` and `import.meta['ROLLUP_FILE_URL_*']` as side-effect free (#10267) by @sapphi-red - rewrite `import.meta['url']` (#10251) by @sapphi-red - add `FILE_NOT_FOUND` error (#10220) by @sapphi-red - treat `import.meta.ROLLUP_FILE_URL_*` as side-effect free (#10217) by @sapphi-red ### 🐛 Bug Fixes - sourcemap: preserve unmapped boundaries during composition (#10254) by @hyfdev - `[format]` in `*FileNames` option for ESM format should be `es` instead of `esm` (#10214) by @sapphi-red - sourcemap: preserve coarse mappings during composition (#10249) by @hyfdev - rolldown_plugin_vite_import_glob: support tsconfig paths with `import.meta.glob` (#10167) by @sapphi-red - dev: clear tsconfig caches for bare full builds (#10276) by @shulaoda - dev: force a full rebuild when a tsconfig changes (#10261) by @shulaoda - treat rooted drive-less module ids as absolute in preserveModules naming (#10235) by @IWANABETHATGUY - watch: rebuild when tsconfig files change (#10258) by @shulaoda - watch: drop tsconfig-merged transform options on each rebuild (#10257) by @shulaoda - incorrect `EMPTY_IMPORT_META` warning for `import.meta.ROLLUP_FILE_URL_*` for CJS output (#10221) by @sapphi-red - deconflict: rename CJS locals shadowing wrapped-ESM namespace objects (#9970) by @IWANABETHATGUY - rolldown: drop the unused runtime module after entry-level external flattening (#10237) by @IWANABETHATGUY - rolldown: re-propagate has_dynamic_exports to transitive star importers (#10239) by @IWANABETHATGUY - tree-shaking: tree-shake destructured dynamic import namespace bindings (#10213) by @logaretm - s390x: use json-escape-simd 3.1.1 for big-endian JSON escaping fix (#10211) by @satyamg1620 ### 🚜 Refactor - dev: move full-reload to client side (#10207) by @h-a-n-a - readability follow-ups to the ReplaceWith migration (#10286) by @IWANABETHATGUY - replace take_in-then-write-back with ReplaceWith and by-value moves (#10285) by @Boshen - share the main resolver's cache with the transformer's tsconfig lookups (#10205) by @shulaoda - rolldown: extract the ns star-external __reExport emission rule into LinkingMetadata (#10238) by @IWANABETHATGUY - rolldown: unify link/generate diagnostics into a Diagnostics accumulator (#10234) by @IWANABETHATGUY - sourcemap_filenames: drop dead sourcemap-filename plumbing (#10189) by @IWANABETHATGUY - extract external import symbol merging into a method (#10224) by @IWANABETHATGUY - rolldown: skip CJS namespace merging under strict execution order (#10203) by @hyfdev - resolve the manual tsconfig per file instead of once at startup (#10200) by @shulaoda - rolldown: route interop ESM init emission through a shared init-target view (#10202) by @hyfdev - rolldown: collapse vestigial wrap-kind state and share chunk sort helper (#10201) by @hyfdev ### 📚 Documentation - show plugin kinds in JSDoc and each hook's description (#10218) by @sapphi-red - add an explanation about removing imports from external modules without any messages (#10215) by @sapphi-red ### ⚡ Performance - sourcemap: owned merge in SourceJoiner::join (4005->5 allocs/chunk) (#10250) by @Boshen - avoid redundant sourcemap string copies in collapse and minify paths (#10093) by @Boshen ### 🧪 Testing - code-splitting: establish strict-order review baselines (#10287) by @hyfdev - dev: add hot API test cases (#10181) by @h-a-n-a - code-splitting: normalize strict execution order variants (#10277) by @hyfdev - code-splitting: harden strict execution order coverage (#10252) by @hyfdev - code-splitting: add strict execution order regressions (#10253) by @hyfdev ### ⚙️ Miscellaneous Tasks - deps: update github actions (#10241) by @renovate[bot] - deps: update oxc to 0.140.0 (#10274) by @shulaoda - update Yunfei's GitHub username (#10275) by @hyfdev - deps: update napi (#10260) by @renovate[bot] - deps: update test262 submodule for tests (#10266) by @rolldown-guard[bot] - deps: update dependency vite-plus to v0.2.4 (#10256) by @renovate[bot] - deps: update napi (#10240) by @renovate[bot] - deps: update oxc resolver to v11.24.2 (#10245) by @renovate[bot] - deps: update rust crates (#10244) by @renovate[bot] - disable Renovate updates for idna_adapter (#10248) by @shulaoda - deps: update oxc resolver to v11.24.1 (#10232) by @renovate[bot] - deps: update rust crate oxc_sourcemap to v8.1.1 (#10233) by @renovate[bot] - deps: update dependency rolldown-plugin-dts to ^0.27.0 (#10206) by @renovate[bot] - deps: upgrade sugar_path to v3 (#10230) by @hyfdev - add `dist-*` to `.gitignore` in sourcemap-filenames/hash-final-content fixture (#10216) by @sapphi-red - deps: update dependency rust to v1.97.0 (#10209) by @renovate[bot] ### ❤️ New Contributors * @satyamg1620 made their first contribution in [#10211](#10211) Co-authored-by: shulaoda <[email protected]>

Groundwork for #9598 (rebuild when tsconfig changes).
A manual tsconfig without references was resolved and merged into the transform options once when the bundler is created (Normal mode). That merged result lives as long as the bundler, so a watch rebuild can never pick up tsconfig edits. This PR makes manual mode always go through Raw mode, the same per-file resolution path that auto-discovery and manual-with-references already use. Together with a follow-up that clears the tsconfig caches on watch rebuilds, tsconfig edits become re-readable for every mode.
Since the eager
resolve_tsconfigcall is gone, a broken manual tsconfig now fails on the first resolution instead of at startup: every resolve consults the tsconfig forpaths/baseUrl/rootDirsbefore doing normal path resolution, which lazily loads the tsconfig file. For the entry this used to end up asUNHANDLEABLE_ERROR, becauseload_entry_moduleonly mappedNotFoundandPackagePathNotExportedand sent everything else to the unhandleable fallback.TsconfigNotFound,TsconfigSelfReferenceandTsconfigCircularExtendare now mapped to a properTSCONFIG_ERROR. The rendered message is identical to the old startup-time one, so existing snapshots stay unchanged. The import side (resolve_utils) already prints readable messages for these variants and needs no change.Two behavior differences worth knowing while reviewing: files that per-file discovery skips (inside node_modules, virtual modules, plain JS) now get the base transform options instead of the merged manual tsconfig, which matches what auto-discovery and manual-with-references already do. And tsconfig merge-conflict warnings show up when the first file using that tsconfig is compiled, not at startup.
Part of #9598.