Skip to content

fix: hint dev-only deps in dts diagnostics#962

Open
M-Hassan-Raza wants to merge 1 commit into
rolldown:mainfrom
M-Hassan-Raza:fix-devdep-dts-warning-hint
Open

fix: hint dev-only deps in dts diagnostics#962
M-Hassan-Raza wants to merge 1 commit into
rolldown:mainfrom
M-Hassan-Raza:fix-devdep-dts-warning-hint

Conversation

@M-Hassan-Raza

Copy link
Copy Markdown

Fixes #743.

This adds a declaration diagnostic hint when Rolldown reports a missing export from a package that only appears in devDependencies. The hint points users to move that package to dependencies or peerDependencies when published declarations need it.

The implementation keeps dependency ownership in deps.ts and declaration error handling in declaration-diagnostics.ts. It only handles structured MISSING_EXPORT diagnostics for declaration files, so it does not guess from unstructured messages or runtime errors.

Validated with pnpm typecheck, pnpm lint, pnpm test src/features/declaration-diagnostics.test.ts tests/e2e.test.ts --run, and pnpm test src/features/deps.test.ts --run.

Copilot AI review requested due to automatic review settings May 28, 2026 17:01
@netlify

netlify Bot commented May 28, 2026

Copy link
Copy Markdown

Deploy Preview for tsdown-main ready!

Name Link
🔨 Latest commit 6cd0c32
🔍 Latest deploy log https://app.netlify.com/projects/tsdown-main/deploys/6a1874fd2e09c40008f0eee1
😎 Deploy Preview https://deploy-preview-962--tsdown-main.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

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

Note

Copilot was unable to run its full agentic suite in this review.

Adds a diagnostic hint when a missing export error in declaration (.d.ts) files originates from a package listed only in devDependencies, helping users understand they should promote it to dependencies or peerDependencies.

Changes:

  • New declaration-diagnostics module that augments rolldown errors with dev-dependency hints for MISSING_EXPORT diagnostics in .d.ts files.
  • New getDevDependencyOnlyName helper in deps.ts to detect packages exclusively in devDependencies.
  • Wiring in build.ts to apply hints in both single-build and watch-mode error paths, plus unit and e2e tests.

Reviewed changes

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

Show a summary per file
File Description
src/features/declaration-diagnostics.ts New module that inspects errors and appends dev-dependency hints.
src/features/declaration-diagnostics.test.ts Unit tests covering hint behavior across diagnostic shapes.
src/features/deps.ts Adds getDevDependencyOnlyName and hasDependency helpers.
src/build.ts Invokes hint augmentation on build and watch errors.
tests/e2e.test.ts End-to-end test asserting hint surfaces during a real build.

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

@pkg-pr-new

pkg-pr-new Bot commented May 28, 2026

Copy link
Copy Markdown

Open in StackBlitz

tsdown

pnpm add https://pkg.pr.new/tsdown@962 -D
npm i https://pkg.pr.new/tsdown@962 -D
yarn add https://pkg.pr.new/tsdown@962.tgz -D

create-tsdown

pnpm add https://pkg.pr.new/create-tsdown@962 -D
npm i https://pkg.pr.new/create-tsdown@962 -D
yarn add https://pkg.pr.new/create-tsdown@962.tgz -D

@tsdown/css

pnpm add https://pkg.pr.new/@tsdown/css@962 -D
npm i https://pkg.pr.new/@tsdown/css@962 -D
yarn add https://pkg.pr.new/@tsdown/css@962.tgz -D

@tsdown/exe

pnpm add https://pkg.pr.new/@tsdown/exe@962 -D
npm i https://pkg.pr.new/@tsdown/exe@962 -D
yarn add https://pkg.pr.new/@tsdown/exe@962.tgz -D

tsdown-migrate

pnpm add https://pkg.pr.new/tsdown-migrate@962 -D
npm i https://pkg.pr.new/tsdown-migrate@962 -D
yarn add https://pkg.pr.new/tsdown-migrate@962.tgz -D

commit: 6cd0c32

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.

When outputting undefined import messages, indicate that this could also happen due to a devDependencey that should by a normal dependency

2 participants