Skip to content

fix(rslib): align isolated dts diagnostics#14143

Merged
Timeless0911 merged 1 commit into
mainfrom
david/fix-rslib-dts-diagnostics
May 25, 2026
Merged

fix(rslib): align isolated dts diagnostics#14143
Timeless0911 merged 1 commit into
mainfrom
david/fix-rslib-dts-diagnostics

Conversation

@Timeless0911

Copy link
Copy Markdown
Contributor

Summary

Fixes isolated dts reference-completion diagnostics in RslibPlugin so failures are collected into stats with the same module-build formatting as swc-loader while avoiding duplicate diagnostics for TypeScript sources already present in the normal module graph. The diagnostic file path now uses the existing request formatting helper, and the stats output case covers both direct and referenced dts failures.

Checklist

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

@Timeless0911 Timeless0911 requested a review from LingyuCoder as a code owner May 25, 2026 07:44
Copilot AI review requested due to automatic review settings May 25, 2026 07:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Aligns RslibPlugin’s isolated .d.ts reference-completion diagnostics with existing module-build error formatting (matching swc-loader), while preventing duplicate diagnostics for TS sources already present in the normal module graph.

Changes:

  • Collect and attach reference-completion .d.ts generation failures as ModuleBuildError diagnostics on the compilation (instead of returning early), with request-formatted diagnostic.file.
  • Avoid generating reference-completion diagnostics for TS sources already in the normal module graph by seeding a completed-resource set from module resources.
  • Extend the existing stats output case to cover both direct and referenced isolated-dts failures (now expecting 3 errors).

Reviewed changes

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

Show a summary per file
File Description
tests/rspack-test/statsOutputCases/rslib-emit-isolated-dts-error/sum.ts Adds a TS module that triggers isolated declarations diagnostics.
tests/rspack-test/statsOutputCases/rslib-emit-isolated-dts-error/foo.ts Adds a type-only referenced TS source that fails isolated declarations.
tests/rspack-test/statsOutputCases/rslib-emit-isolated-dts-error/reference.ts Adds an entry that type-references foo.ts to exercise reference completion.
tests/rspack-test/statsOutputCases/rslib-emit-isolated-dts-error/rspack.config.js Switches to multi-entry to ensure both direct and referenced failures appear in stats.
tests/rspack-test/statsOutputCases/rslib-emit-isolated-dts-error/snapshots/stats.txt Updates snapshot to assert module-build formatted errors for both paths (3 total).
crates/rspack_plugin_rslib/src/plugin.rs Collects module resources, runs completion with dedupe inputs, and extends compilation diagnostics.
crates/rspack_plugin_rslib/src/isolated_dts.rs Returns assets + diagnostics, formats diagnostic file paths via absolute_to_request, and emits ModuleBuildError diagnostics for reference-completion failures.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 5 projects in monorepo, 5 projects with changes.

📊 Quick Summary
Project Total Size Change
popular-libs 1.7 MB -
react-10k 5.7 MB -
react-1k 827.2 KB -
react-5k 2.7 MB -
ui-components 4.8 MB -
📋 Detailed Reports (Click to expand)

📁 popular-libs

Path: ../build-tools-performance/cases/popular-libs/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 1.7 MB - -
📄 JavaScript 1.7 MB - -
🎨 CSS 0 B - -
🌐 HTML 289.0 B - -
📁 Other Assets 0 B - -

📁 react-10k

Path: ../build-tools-performance/cases/react-10k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 5.7 MB - -
📄 JavaScript 5.7 MB - -
🎨 CSS 21.0 B - -
🌐 HTML 328.0 B - -
📁 Other Assets 0 B - -

📁 react-1k

Path: ../build-tools-performance/cases/react-1k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 827.2 KB - -
📄 JavaScript 826.9 KB - -
🎨 CSS 0 B - -
🌐 HTML 328.0 B - -
📁 Other Assets 0 B - -

📁 react-5k

Path: ../build-tools-performance/cases/react-5k/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 2.7 MB - -
📄 JavaScript 2.7 MB - -
🎨 CSS 21.0 B - -
🌐 HTML 328.0 B - -
📁 Other Assets 0 B - -

📁 ui-components

Path: ../build-tools-performance/cases/ui-components/dist/rsdoctor-data.json

⚠️ No baseline data found - Unable to perform comparison analysis

Metric Current Baseline Change
📊 Total Size 4.8 MB - -
📄 JavaScript 4.7 MB - -
🎨 CSS 107.0 KB - -
🌐 HTML 328.0 B - -
📁 Other Assets 0 B - -

Generated by Rsdoctor GitHub Action

@github-actions

Copy link
Copy Markdown
Contributor

📦 Binary Size-limit

Comparing 117c441 to test: satisfy socket.dev security (#14138) by AsyncIter

❌ Size increased by 4.00KB from 61.75MB to 61.75MB (⬆️0.01%)

@codspeed-hq

codspeed-hq Bot commented May 25, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 37 untouched benchmarks
⏩ 25 skipped benchmarks1


Comparing david/fix-rslib-dts-diagnostics (117c441) with main (b0bdcf8)2

Open in CodSpeed

Footnotes

  1. 25 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (0ccfa7b) during the generation of this report, so b0bdcf8 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@Timeless0911 Timeless0911 enabled auto-merge (squash) May 25, 2026 11:18
@Timeless0911 Timeless0911 merged commit e66c3db into main May 25, 2026
38 checks passed
@Timeless0911 Timeless0911 deleted the david/fix-rslib-dts-diagnostics branch May 25, 2026 11:47
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.

3 participants