feat: migrate warnings/errors to structured diagnostics via logs-sdk#285
Draft
feat: migrate warnings/errors to structured diagnostics via logs-sdk#285
Conversation
Replace inconsistent console.warn/error/throw patterns with structured diagnostics using @antfu/experimental-logs-sdk. Each error gets a unique code (DTK0001-DTK0032 for core/rpc, RDDT0001-RDDT0002 for rolldown) with auto-generated docs URLs and ANSI-formatted output. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vitejs/devtools
@vitejs/devtools-kit
@vitejs/devtools-rolldown
@vitejs/devtools-rpc
@vitejs/devtools-self-inspect
commit: |
TypeScript doesn't narrow types after `logger.CODE().throw()` because the return type inference doesn't propagate `never` through the chained call. Adding `throw` before the expression fixes control flow analysis. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Description
Migrate all node-side
console.warn/console.error/throw new Errorpatterns to structured diagnostics using@antfu/experimental-logs-sdk. Each error/warning now gets a unique code (DTK0001–DTK0032for core/rpc,RDDT0001–RDDT0002for rolldown) with auto-generated docs URLs and ANSI-formatted console output.@antfu/experimental-logs-sdk(^0.0.3) as dependency torpc,core, androlldownpackagesdiagnostics.tsin each package withdefineDiagnostics()+createLogger()— flat code keys likeDTK0001(no prefix option)docs/errors/(one per code + index) with cause, fix, examples, and source linkspackages/rpc/src/dumps.test.tsto match newCodedErrormessage formatLinked Issues
Additional context
DTK= DevTools Kit (rpc + core),RDDT= Rolldown DevTools,VDTreserved for the vite packagerpcpackage usesplainFormatter(noansisdependency);coreandrolldownuseansiFormatter