Skip to content

refactor: migrate to tsdown #629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

refactor: migrate to tsdown #629

wants to merge 1 commit into from

Conversation

sxzz
Copy link
Contributor

@sxzz sxzz commented Apr 24, 2025

Summary by CodeRabbit

  • Chores
    • Updated build scripts and development dependencies to use a new build tool.
    • Adjusted configuration files to align with the new build process.

Copy link

coderabbitai bot commented Apr 24, 2025

Walkthrough

The build system was switched from tsup to tsdown. This involved updating build scripts and development dependencies in package.json, changing import sources in configuration files, and removing two configuration options specific to tsup.

Changes

Files Change Summary
package.json Replaced tsup with tsdown in build scripts and devDependencies.
tsdown-runtime.config.ts Updated imports from tsup to tsdown and changed config import path accordingly.
tsdown.config.ts Changed imports from tsup to tsdown; removed cjsInterop and splitting from options object.

📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a73a3eb and 2fe0da3.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (3)
  • package.json (2 hunks)
  • tsdown-runtime.config.ts (1 hunks)
  • tsdown.config.ts (1 hunks)
🔇 Additional comments (5)
tsdown.config.ts (2)

1-1: Package import updated to tsdown.

Import source updated from 'tsup' to 'tsdown' as part of the migration.


3-15: Properties removed from commonOptions.

The 'cjsInterop' and 'splitting' properties were removed from the configuration. These options are likely not supported or needed in tsdown.

tsdown-runtime.config.ts (1)

1-2: Import sources updated for tsdown migration.

Both imports have been updated:

  1. 'defineConfig' now from 'tsdown' instead of 'tsup'
  2. 'commonOptions' now from './tsdown.config' instead of './tsup.config'
package.json (2)

108-109: Build commands updated to use tsdown.

Build scripts correctly updated to use the new tool and configuration files.


185-185:

✅ Verification successful

Dependency updated from tsup to tsdown.

Replaced tsup with tsdown version ^0.9.6.


🌐 Web query:

Is tsdown a stable replacement for tsup? What are the differences?

💡 Result:

Is tsdown a stable replacement for tsup? Differences Explained

tsdown is positioned as a modern, fast, and library-focused alternative to tsup, and recent developments indicate that it is both compatible and a promising upgrade for most use cases—especially for library bundling in the TypeScript ecosystem.

Stability and Maturity

  • Stability: As of April 2025, tsdown is actively maintained, recently released (v0.9.1), and reports 100% JSR score, suggesting a high degree of reliability and adoption for production usage[9][4].
  • Migration Compatibility: tsdown is explicitly designed to be compatible with tsup’s main options and features. The migration process is streamlined: a dedicated command (npx tsdown migrate) is provided, ensuring a smooth transition from tsup with minimal changes required[1][3][6][9].
  • Codebase Heritage: tsdown’s codebase incorporates and builds upon code from tsup, ensuring that common practices and configurations from tsup projects are well-supported[1][3][6][9].

Major Differences

Feature tsup tsdown
Underlying Bundler esbuild Rolldown (Rust-based, much faster)
Performance Fast (esbuild-optimized) Even faster (Rolldown-optimized, written in Rust)
Focus General-purpose JS/TS bundling Library bundling (TypeScript/JavaScript)
Default Experience Simple, but may require more config for libraries Out-of-the-box for libraries; minimal config
Plugin Ecosystem esbuild and some Rollup plugins Full Rollup, Rolldown, unplugin & some Vite plugins
Type Declarations (.d.ts) Supported (can require config) Automatic generation built-in
Multiple Output Formats Supported Built-in for esm, cjs, and iife
Migration Tool N/A Provided (tsdown migrate command)
Integration Standalone Part of Rolldown ecosystem, future-ready (Vite Library)

Technical Distinctions

  • Performance: tsdown is notably faster thanks to Rolldown’s Rust core[2][3][6].
  • Configuration: tsdown minimizes configuration, offering sensible defaults for most library needs[2].
  • Ecosystem Extensibility: tsdown supports the entire Rolldown and most of the Rollup plugin ecosystems, offering more flexibility than tsup[2][3][6].
  • Future-Proof: tsdown is described as the “official project of Rolldown” and is expected to be foundational for tools like Rolldown Vite’s Library Mode, indicating ongoing support and integration with modern tooling[2].

Migration Considerations

  • A migration tool (npx tsdown migrate) is available to convert tsup-based projects, minimizing friction[1][3][6][9].
  • The migration may modify configuration files, so committing or backing up before running is advised[1].

Conclusion

tsdown is a stable and, in many cases, superior replacement for tsup, especially for library bundling. It offers better performance, a richer ecosystem, and easier migration for existing tsup users. Projects focused on building libraries with TypeScript or JavaScript will likely benefit most from switching[1][2][3][6][9]. However, users deeply tied to the esbuild ecosystem or with highly custom build requirements not addressed by tsdown may want to test migration on a non-critical project first.

Citations:


Approve tsdown replacement

tsdown ^0.9.6 is a production-ready, actively maintained alternative to tsup with faster Rust-powered bundling, built-in type declaration support, and a dedicated migration tool (npx tsdown migrate). This change can be merged as is.

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License

View full report

Copy link

pkg-pr-new bot commented Apr 24, 2025

Open in StackBlitz

npm i https://pkg.pr.new/unplugin-vue-router@629

commit: 2fe0da3

Copy link

codecov bot commented Apr 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 62.35%. Comparing base (a73a3eb) to head (2fe0da3).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #629   +/-   ##
=======================================
  Coverage   62.35%   62.35%           
=======================================
  Files          32       32           
  Lines        3140     3140           
  Branches      586      586           
=======================================
  Hits         1958     1958           
  Misses       1176     1176           
  Partials        6        6           

☔ 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.

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.

1 participant