Skip to content

perf(dts): switch plugin-dts to multi-entry build#1547

Merged
Timeless0911 merged 2 commits intomainfrom
chore/dts-runtime-bundle
Mar 20, 2026
Merged

perf(dts): switch plugin-dts to multi-entry build#1547
Timeless0911 merged 2 commits intomainfrom
chore/dts-runtime-bundle

Conversation

@Timeless0911
Copy link
Copy Markdown
Contributor

@Timeless0911 Timeless0911 commented Mar 19, 2026

Summary

Change rsbuild-plugin-dts from a bundleless build to a multi-entry build, with explicit index and dts runtime entries instead of emitting the whole source tree as-is.

Enable declaration extension redirection by default for the package build so generated dts files automatically use the correct extension for the emitted format.

Remove cjs-module-lexer calls.

Before

image

Now

image

Related Links

N/A

Checklist

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

Copilot AI review requested due to automatic review settings March 19, 2026 12:49
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 19, 2026

📝 Rslib Ecosystem CI: Open

suite result
rspress ✅ success
rsdoctor ❌ failure
rspack ❌ failure
rsbuild ✅ success
rstest ✅ success

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e8ea75e82

ℹ️ 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".

Copy link
Copy Markdown
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 updates the rsbuild-plugin-dts package build to use an explicit multi-entry setup (runtime index + dts worker entry) instead of emitting the entire source tree, and enables declaration extension redirection for the package build to better match emitted JS formats.

Changes:

  • Switch package build output from bundleless “emit all src” to a multi-entry build (index + dts entries).
  • Enable redirect.dts.extension for the package build so generated declaration imports use the correct emitted extension by default.
  • Simplify prebundle/external configuration by only prebundling tsconfig-paths and bundling previously prebundled runtime utilities.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/plugin-dts/tsconfig.json Removes the magic-string path alias, aligning TS path overrides with the reduced prebundle set.
packages/plugin-dts/src/utils.ts Refactors tsconfig-paths imports and lazily loads @ast-grep/napi to reduce startup cost.
packages/plugin-dts/src/index.ts Updates worker path resolution to use import.meta.filename/dirname for locating the dts entry at runtime.
packages/plugin-dts/src/dts.ts Extracts options type for calcBundledPackages to clarify the signature without behavior changes.
packages/plugin-dts/rslib.config.ts Converts to explicit index + dts entries and enables redirect.dts.extension for the package build.
packages/plugin-dts/prebundle.config.mjs Drops tinyglobby/magic-string from prebundle dependencies, keeping only tsconfig-paths.

@Timeless0911 Timeless0911 merged commit 5d34a4e into main Mar 20, 2026
8 checks passed
@Timeless0911 Timeless0911 deleted the chore/dts-runtime-bundle branch March 20, 2026 03:32
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.

3 participants