chore(build): switch dts generation to rolldown-plugin-dts - #58
Conversation
Replace vite-plugin-dts with rolldown-plugin-dts across all 15 library
packages. rolldown-plugin-dts is the rolldown-native declaration bundler
(used by tsdown) and drops the @microsoft/api-extractor dependency chain.
It bundles types with the project's own TypeScript 6.0.3 instead of
api-extractor's bundled 5.9.3, so the version-mismatch warning is gone.
Config changes per package:
- import { dts } from "rolldown-plugin-dts" (default export -> named)
- gate the plugin to the build command so it does not run under vitest
(vite-plugin-dts guarded this internally; this plugin does not, and its
buildStart hook throws in serve/test mode)
- use object-form lib.entry so the emitted chunk keeps its .d.ts extension
(a string entry + fileName clobbers it to .ts)
- add the oxc.exclude guard recommended for Vite so generated declaration
files are not re-transformed
The published type surface is unchanged. The only diff versus the previous
output is that api-extractor's collision rename TransitionEvent_2 is gone;
the author's intended export name TransitionEvent is kept. Declaration
output now code-splits shared types into a chunk, mirroring the existing
JS code-splitting.
Also bump vite to ^8.1.3 and vitest to ^4.1.10 workspace-wide. pnpm added
a minimumReleaseAgeExclude entry for vitest@4.1.10 since it is newer than
the workspace release-age gate.
|
Warning Review limit reached
Next review available in: 49 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (14)
📝 WalkthroughWalkthroughThis PR uniformly bumps ChangesTooling migration across packages
Estimated code review effort: 2 (Simple) | ~15 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
pnpm peer resolution was resolving rolldown-plugin-dts against two different rolldown backends: most packages got rolldown@1.1.4 (from vite 8.1.x), but frontend-core and journeys-engine got the pre-release rolldown@1.0.0-rc.18 that is still in the tree via the examples' vite 8.0.x. That meant dts for those two packages was generated through a different, pre-release backend than the rest of the workspace. Add a scoped `rolldown-plugin-dts>rolldown: 1.1.4` override so every package generates declarations through the same rolldown, without touching the examples' own vite. Full build (34/34) and typecheck (113/113) pass.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/frontend-core/vite.config.ts (1)
2-16: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winConsider extracting the shared dts/oxc boilerplate into a workspace helper.
The
plugins: command === "build" ? [dts()] : []activation andoxc: { exclude: [/\.js$/, /\.d\.[cm]?ts$/] }block are duplicated verbatim across every migratedvite.config.ts(frontend-core, tanstack-router-core, tanstack-router-runtime, tanstack-router-testing, and reportedly 11 more packages per the PR objectives). Extracting a small shared factory (e.g.createLibConfig()in a workspace-internal package) would let all 15 configs stay in sync automatically for future tweaks (e.g. addingdts()options).♻️ Example shared helper
// tools/vite-lib-preset.ts import { dts } from "rolldown-plugin-dts"; import type { ConfigEnv, UserConfig } from "vite"; export function libDtsPlugins({ command }: ConfigEnv) { return command === "build" ? [dts()] : []; } export const oxcDtsExclude = { exclude: [/\.js$/, /\.d\.[cm]?ts$/], } satisfies UserConfig["oxc"];🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/frontend-core/vite.config.ts` around lines 2 - 16, The Vite config still contains duplicated dts/oxc boilerplate, so extract the shared lib preset into a workspace helper and reuse it here. Move the build-only dts plugin activation from the existing defineConfig callback and the repeated oxc.exclude pattern into a shared factory such as createLibConfig() or equivalent, then have this config consume that helper so future changes stay consistent across all migrated packages.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@packages/frontend-core/vite.config.ts`:
- Around line 2-16: The Vite config still contains duplicated dts/oxc
boilerplate, so extract the shared lib preset into a workspace helper and reuse
it here. Move the build-only dts plugin activation from the existing
defineConfig callback and the repeated oxc.exclude pattern into a shared factory
such as createLibConfig() or equivalent, then have this config consume that
helper so future changes stay consistent across all migrated packages.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 136f4cc6-e9c0-4aa6-9d15-335403a50cf6
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (34)
packages/catalog/package.jsonpackages/compositions-engine/package.jsonpackages/compositions-engine/vite.config.tspackages/compositions/package.jsonpackages/compositions/vite.config.tspackages/core/package.jsonpackages/core/vite.config.tspackages/frontend-core/package.jsonpackages/frontend-core/vite.config.tspackages/journeys-engine/package.jsonpackages/journeys-engine/vite.config.tspackages/journeys/package.jsonpackages/journeys/vite.config.tspackages/react-router-cli/package.jsonpackages/react-router-core/package.jsonpackages/react-router-core/vite.config.tspackages/react-router-runtime/package.jsonpackages/react-router-runtime/vite.config.tspackages/react-router-testing/package.jsonpackages/react-router-testing/vite.config.tspackages/react/package.jsonpackages/react/vite.config.tspackages/tanstack-router-cli/package.jsonpackages/tanstack-router-core/package.jsonpackages/tanstack-router-core/vite.config.tspackages/tanstack-router-runtime/package.jsonpackages/tanstack-router-runtime/vite.config.tspackages/tanstack-router-testing/package.jsonpackages/tanstack-router-testing/vite.config.tspackages/testing/package.jsonpackages/testing/vite.config.tspackages/vue/package.jsonpackages/vue/vite.config.tspnpm-workspace.yaml
Move all 13 example shells to vite ^8.1.3 (nine were on ^8.0.3, four on ^6.0.0), and bump the four vite-6 shells' @vitejs/plugin-react to ^6.0.1 to match the rest. This removes vite 8.0.11 and vite 6 from the tree, which also removes the pre-release rolldown@1.0.0-rc.18 that the earlier dts-backend split resolved through. The rolldown-plugin-dts>rolldown override now has nothing older to resolve against, so it stays purely as a guard against a future example reintroducing an older vite. Comment reworded to reflect that. All four vite 6->8 shells build under vite 8.1.3. Full build (34/34) and typecheck (113/113) pass.
What
Replaces
vite-plugin-dtswithrolldown-plugin-dtsacross all 15 library packages, and bumpsviteto^8.1.3andvitestto^4.1.10workspace-wide.Why
rolldown-plugin-dtsis the rolldown-native declaration bundler (the onetsdownuses, and the one Vite itself moved to internally). Vite 8 is already rolldown-powered here, so this is the natural fit:@microsoft/api-extractordependency chain thatvite-plugin-dtspulls in forrollupTypes.*** The target project appears to use TypeScript 6.0.3 which is newer than the bundled compiler enginewarning is gone.Config changes per package
import { dts } from "rolldown-plugin-dts"(named export instead of default).buildcommand so it does not run under vitest.vite-plugin-dtsguarded this internally; this plugin does not, and itsbuildStarthook throws in serve/test mode (TypeError: Cannot convert undefined or null to object).lib.entryso the emitted chunk keeps its.d.tsextension. A stringentry+fileNameclobbers it to.ts.oxc.excludeguard recommended for Vite so generated declaration files are not re-transformed.Compatibility
The published type surface is unchanged. The only difference versus the previous output is that api-extractor's collision rename
TransitionEvent_2is gone; the author's intended export nameTransitionEventis kept (it was already re-exported under that name).Considered alternative
unplugin-dtsis the cross-bundler successor tovite-plugin-dtsand supports rolldown, but itsbundleTypesstill relies on@microsoft/api-extractor.rolldown-plugin-dtswas chosen because it is genuinely rolldown-native and removes api-extractor entirely.Verification
pnpm build: 34/34 tasks pass; every package emits a properindex.d.ts(andtesting.d.tsfor multi-entry packages).pnpm typecheck: clean across the whole workspace, including all example apps that consume the generated.d.ts.pnpm test: all pass except@tanstack-react-modules/cli#test, which is the pre-existing Windows.test-outputEPERM flake (unrelated; that package does not use the dts plugin).Note
pnpm auto-added a
minimumReleaseAgeExcludeblock inpnpm-workspace.yamlforvitest@4.1.10because it is newer than the workspace release-age gate. This is required for the vitest bump to install.Summary by CodeRabbit