feat: support tsconfig loading & inputMap for transform#8180
Conversation
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. |
✅ Deploy Preview for rolldown-rs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
@rolldown/browser
@rolldown/debug
@rolldown/pluginutils
rolldown
@rolldown/binding-android-arm64
@rolldown/binding-darwin-arm64
@rolldown/binding-darwin-x64
@rolldown/binding-freebsd-x64
@rolldown/binding-linux-arm-gnueabihf
@rolldown/binding-linux-arm64-gnu
@rolldown/binding-linux-arm64-musl
@rolldown/binding-linux-x64-gnu
@rolldown/binding-linux-x64-musl
@rolldown/binding-openharmony-arm64
@rolldown/binding-wasm32-wasi
@rolldown/binding-win32-arm64-msvc
@rolldown/binding-win32-x64-msvc
commit: |
e333a5a to
6682c9c
Compare
6682c9c to
8bd5462
Compare
8bd5462 to
806d5fa
Compare
806d5fa to
9c3041f
Compare
9c3041f to
e094474
Compare
e094474 to
cfa1306
Compare
There was a problem hiding this comment.
Pull request overview
This PR enhances the transform and transformSync APIs to support tsconfig loading and input source maps, enabling plugins to use the same transformation logic as Rolldown's internal bundler. The implementation adds auto-discovery of tsconfig files, inline tsconfig options, and a caching mechanism for improved performance.
Changes:
- Added enhanced transform APIs with tsconfig loading support (auto-discovery or inline configuration)
- Introduced
TsconfigCacheclass to optimize repeated tsconfig resolution across multiple transformations - Extended transform options to include
inputMap,helpers, and improved TypeScript configuration support
Reviewed changes
Copilot reviewed 22 out of 23 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
packages/rolldown/tests/utils/transform.test.ts |
Comprehensive test suite covering basic transformation, tsconfig options, cache usage, and helper modes |
packages/rolldown/tests/utils/fixtures/tsconfig.json |
Test fixture for tsconfig auto-discovery tests |
packages/rolldown/tests/utils/fixtures/test1.ts |
Test fixture file with TypeScript code |
packages/rolldown/src/utils/transform.ts |
TypeScript wrapper for enhanced transform APIs with error normalization |
packages/rolldown/src/utils/error.ts |
Exported normalizeBindingError for use in transform utilities |
packages/rolldown/src/experimental-index.ts |
Updated exports to use new enhanced transform API instead of old oxc_transform_napi exports |
packages/rolldown/src/rolldown-binding.wasi.cjs |
Added TsconfigCache and enhanced transform function exports for WASI |
packages/rolldown/src/rolldown-binding.wasi-browser.js |
Added TsconfigCache and enhanced transform function exports for WASI browser |
packages/rolldown/src/binding.d.cts |
TypeScript type definitions for TsconfigCache, enhanced transform options and results |
packages/rolldown/src/binding.cjs |
Added exports for TsconfigCache and enhanced transform functions |
crates/rolldown_common/src/utils/mod.rs |
Module declaration for enhanced_transform |
crates/rolldown_common/src/utils/enhanced_transform.rs |
Core transformation logic with tsconfig merging, AST parsing, and code generation |
crates/rolldown_common/src/lib.rs |
Exported enhanced transform types and functions in bundler_options module |
crates/rolldown_common/src/inner_bundler_options/types/transform_option/mod.rs |
Added helpers field and conversion implementations between TransformOptions and EnhancedTransformOptions |
crates/rolldown_binding/src/utils/normalize_binding_transform_options.rs |
Added helpers option normalization from binding types |
crates/rolldown_binding/src/types/binding_sourcemap.rs |
Added Clone derives for BindingSourcemap types |
crates/rolldown_binding/src/transform_cache.rs |
TsconfigCache implementation with resolver and cache management |
crates/rolldown_binding/src/transform.rs |
Enhanced transform functions (async and sync) with cache integration |
crates/rolldown_binding/src/options/mod.rs |
Added binding_transform_options module export |
crates/rolldown_binding/src/options/binding_transform_options.rs |
Binding types for enhanced transform options, results, and tsconfig configuration |
crates/rolldown_binding/src/lib.rs |
Added transform and transform_cache module declarations |
crates/rolldown_binding/Cargo.toml |
Added oxc_resolver and oxc_sourcemap dependencies |
Cargo.lock |
Updated dependency lock file |
crates/rolldown_binding/src/options/binding_transform_options.rs
Outdated
Show resolved
Hide resolved
crates/rolldown_binding/src/options/binding_transform_options.rs
Outdated
Show resolved
Hide resolved
Benchmarks Rust |
cfa1306 to
2f0d785
Compare
crates/rolldown_binding/src/options/binding_transform_options.rs
Outdated
Show resolved
Hide resolved
087af0f to
4473ebf
Compare
|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
crates/rolldown_binding/src/options/binding_transform_options.rs
Outdated
Show resolved
Hide resolved
4473ebf to
28ccfe0
Compare
202653a to
600dbe6
Compare
hyf0
left a comment
There was a problem hiding this comment.
@sapphi-red Should we support it within oxc transform? It's also postive for migrating to oxc transform from esbuild.transfrm?
|
Personally I think this should live in Rolldown because it loads tsconfig and collapses sourcemaps. But not opposed to move the feature to oxc transform side. /cc @Boshen if you have any opinions |
Merge activity
|
Improved `transform` & `transformSync` to receive `tsconfig?: boolean | TsconfigRawOptions` and `inputMap?: SourceMap` and `tsconfigCache?: TSConfigCache`. This allows plugins to run the same transformation that is done internally by Rolldown so that you can use plugins that doesn't support TS & JSX internally (#4004).
600dbe6 to
d07abd0
Compare
## [1.0.0-rc.4] - 2026-02-11 💡 Granular `comments` Option - New `output.comments` option provides fine-grained control over comment preservation - The `output.legalComments` option is now deprecated and use `comments.legal` instead ### 🚀 Features - rename error name to `RolldownError` from `RollupError` (#8262) by @sapphi-red - add hidden `resolve_tsconfig` function for Vite (#8257) by @sapphi-red - rust: introduce `rolldown_watcher` (#8161) by @hyf0 - unify `comments` and `legalComments` into a single granular `comments` option (#8229) by @IWANABETHATGUY - add builtin plugin for visualizing chunk graph (#8162) by @IWANABETHATGUY - show import declaration location in AssignToImport errors (#8222) by @Copilot - show import declaration span in CannotCallNamespace error (#8223) by @Copilot - emit error when plugin accidentally removes runtime module symbols (#8203) by @IWANABETHATGUY - support tsconfig loading & inputMap for `transform` (#8180) by @sapphi-red - rolldown_plugin_vite_reporter: update warning message to link to Rolldown docs (#8205) by @sapphi-red ### 🐛 Bug Fixes - avoid panic on untranspiled JSX syntax by reporting a diagnostic error (#8226) by @IWANABETHATGUY - rolldown_plugin_vite_import_glob: relax absolute path check and improve invalid glob warning (#8219) by @shulaoda - merge chunks after detect circular reference (#8154) by @IWANABETHATGUY - rust: detect runtime module side effects based on its content (#8209) by @hyf0 ### 🚜 Refactor - rename `other` to `jsdoc` in comments options (#8256) by @IWANABETHATGUY - rename chunk-visualize plugin with bundle-analyzer plugin (#8255) by @IWANABETHATGUY - remove EXPORT_UNDEFINED_VARIABLE error (#8228) by @Copilot - consolidate missing runtime symbol errors into a single diagnostic (#8220) by @IWANABETHATGUY - stabilize `parse` and `parseSync` (#8215) by @sapphi-red - return errors instead of panicking on builtin plugin conversion failure (#8217) by @shulaoda - expose `parse` / `minify` / `transform` from `rolldown/utils` (#8214) by @sapphi-red - prepare defer chunk merging (#8153) by @IWANABETHATGUY ### 📚 Documentation - remove `<script>` escape behavior difference note from `platform` option (#8253) by @sapphi-red - TypeScript & JSX support by plugins (#8183) by @sapphi-red ### 🧪 Testing - ensure runtime module is preserved even if it's not used but has side effects (#8213) by @hyf0 ### ⚙️ Miscellaneous Tasks - deps: update oxc to v0.113.0 (#8267) by @renovate[bot] - deps: update dependency oxlint-tsgolint to v0.12.0 (#8272) by @renovate[bot] - deps: update oxc apps (#8269) by @renovate[bot] - deps: update test262 submodule for tests (#8261) by @sapphi-red - deps: update crate-ci/typos action to v1.43.4 (#8260) by @renovate[bot] - deps: update dependency esbuild to v0.27.3 (#8250) by @renovate[bot] - deps: update rust crates (#8244) by @renovate[bot] - deps: update dependency semver to v7.7.4 (#8247) by @renovate[bot] - deps: update github-actions (#8243) by @renovate[bot] - deps: update npm packages (#8245) by @renovate[bot] - deps: update oxc resolver to v11.17.1 (#8240) by @renovate[bot] - deps: update rust crate oxc_sourcemap to v6.0.2 (#8241) by @renovate[bot] - rust: handle ignored `RUSTSEC-2025-0141` cargo check error (#8235) by @hyf0 - deps: update dependency oxlint-tsgolint to v0.11.5 (#8233) by @renovate[bot] - deps: update dependency rolldown-plugin-dts to ^0.22.0 (#8232) by @renovate[bot] - deps: update crate-ci/typos action to v1.43.3 (#8225) by @renovate[bot] - deps: update dependency rolldown-plugin-dts to v0.21.9 (#8224) by @renovate[bot] - deps: update crate-ci/typos action to v1.43.2 (#8212) by @renovate[bot] - remove rolldown_plugin_vite_wasm_helper (#8207) by @shulaoda - build docs for production (#8206) by @sapphi-red Co-authored-by: shulaoda <165626830+shulaoda@users.noreply.github.com>

Improved
transform&transformSyncto receivetsconfig?: boolean | TsconfigRawOptionsandinputMap?: SourceMapandtsconfigCache?: TSConfigCache.This allows plugins to run the same transformation that is done internally by Rolldown so that you can use plugins that doesn't support TS & JSX internally (#4004).