Skip to content

Conversation

@Timeless0911
Copy link
Contributor

@Timeless0911 Timeless0911 commented Sep 4, 2025

Summary

Support dts.tsgo.

Since watch mode is not supported by tsgo, this PR do rebuild when Rspack triggered to rebuild.

Example: perf improvement for @rsbuild/core

  • TypeScript Compiler API
rslib build
  Time (mean ± σ):      2.568 s ±  0.029 s    [User: 5.499 s, System: 0.419 s]
  Range (min … max):    2.524 s …  2.614 s    10 runs
  • tsgo
rslib build
  Time (mean ± σ):      1.097 s ±  0.029 s    [User: 2.106 s, System: 0.382 s]
  Range (min … max):    1.049 s …  1.140 s    10 runs

dts.tsgo

  • Type: boolean
  • Default: false

Whether to generate declaration files with tsgo, which can provide faster generation of declaration files, especially for large projects.

Tip

This feature is currently an experimental feature. Since tsgo is still in the experimental stage, there may be some bugs and unresolved issues or limitations. So, make sure to fully test it in your project before enabling this option.

To enable this option, you need to:

  1. Install @typescript/native-preview as a development dependency.

Tip

@typescript/native-preview requires Node.js 20.6.0 or higher.

  1. Configure in the Rslib config file:
export default {
  lib: [
    {
      dts: {
        tsgo: true,
      },
    },
  ],
};
  1. In order to ensure the consistency of local development, you need to install the corresponding VS Code Preview Extension and add the following configuration in the VS Code settings:
{
  "typescript.experimental.useTsgo": true
}

Related Links

close: #1103

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings September 4, 2025 13:27
@netlify
Copy link

netlify bot commented Sep 4, 2025

Deploy Preview for rslib ready!

Name Link
🔨 Latest commit 1db1b95
🔍 Latest deploy log https://app.netlify.com/projects/rslib/deploys/68bab70ec5ca4a0008565f66
😎 Deploy Preview https://deploy-preview-1205--rslib.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for the experimental dts.experiments.tsgo option, enabling users to generate TypeScript declaration files using the tsgo tool instead of the traditional TypeScript Compiler API.

  • Introduces dts.experiments.tsgo configuration option to enable tsgo-based declaration file generation
  • Adds comprehensive test coverage for both bundled and unbundled declaration files with tsgo
  • Updates documentation to explain the new experimental feature and its usage

Reviewed Changes

Copilot reviewed 138 out of 142 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
packages/core/src/types/config.ts Adds TypeScript type definitions for the new experiments.tsgo option
packages/plugin-dts/src/tsgo.ts Implements the tsgo integration with process spawning and output handling
packages/plugin-dts/src/utils.ts Adds utilities for file renaming and source map content updates
website/docs/**/*.mdx Updates documentation to describe the new tsgo experimental feature
tests/integration/dts-tsgo/** Adds comprehensive test cases for tsgo functionality
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

website/docs/en/config/lib/dts.mdx:1

---

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Timeless0911 Timeless0911 changed the title feat(dts): support dts.experiments.tsgo feat(dts): support dts.tsgo Sep 5, 2025
@Timeless0911 Timeless0911 merged commit 2787dde into main Sep 8, 2025
14 checks passed
@Timeless0911 Timeless0911 deleted the tsgo branch September 8, 2025 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Support experimental tsgo to generate declaration files

3 participants