fix: hint dev-only deps in dts diagnostics#962
Open
M-Hassan-Raza wants to merge 1 commit into
Open
Conversation
✅ Deploy Preview for tsdown-main ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
There was a problem hiding this comment.
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-diagnosticsmodule that augments rolldown errors with dev-dependency hints forMISSING_EXPORTdiagnostics in.d.tsfiles. - New
getDevDependencyOnlyNamehelper indeps.tsto detect packages exclusively indevDependencies. - Wiring in
build.tsto 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.
tsdown
create-tsdown
@tsdown/css
@tsdown/exe
tsdown-migrate
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.