feat!: migrate logs-sdk to nostics, bump devframe to v0.3#350
Open
antfu wants to merge 3 commits into
Open
Conversation
`logs-sdk` has been renamed and rewritten as `nostics`. Devframe v0.3.0
is the first release on the new dep. Doing both together keeps
`ctx.diagnostics` (re-exported from devframe) and our internal
diagnostics backed by the same library.
API delta:
- `defineDiagnostics({ docsBase, codes })` + separate `createLogger()`
→ `defineDiagnostics({ docsBase, reporters, codes })`
- Code fields `message`/`hint`/`level` → `why`/`fix` (no `level`)
- `logger.CODE(params).throw() / .log()` → `diagnostics.CODE.throw(params) / .report(params)`
- `cause` moves from a 2nd arg to inside the params object
For plugin authors, `ctx.diagnostics.logger.CODE` is now a proxy that
resolves directly to a `nostics` handle, so emission is
`ctx.diagnostics.logger.CODE.throw(params)` instead of the old
`logger.CODE(params).throw()` shape.
# Conflicts: # devframe # pnpm-lock.yaml # pnpm-workspace.yaml
commit: |
`tsdown`'s client/server split in devframe v0.2.3+ emits the
`DevToolsRpc{Server,Client}Functions` and `DevToolsRpcSharedStates`
interfaces twice — once in the canonical `devframe-*.d.mts` chunk and
again in the `index-*.d.mts` chunk consumed by `devframe/client`. The
duplicate declarations are seen by TypeScript as separate identities,
so `declare module '@vitejs/devtools-kit'` augmentations applied to
the canonical interface don't reach client-side consumers.
The patch replaces the duplicate declarations in the client chunk with
type imports from the canonical chunk, so both sides resolve to the
same interface. Remove the patch once devframe ships a fix upstream.
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
logs-sdkhas been renamed and rewritten asnostics. Devframe v0.3.0 is the first release that consumes the new dep, so this PR bumps both together to keepctx.diagnostics(re-exported from devframe) and the in-repodiagnosticsfiles backed by the same library and emission API.API delta (also applies to plugin-facing
ctx.diagnostics):defineDiagnostics({ docsBase, codes })+ separatecreateLogger()→defineDiagnostics({ docsBase, reporters, codes })(no morecreateLogger).message/hint/level→why/fix(nolevel).logger.CODE(params).throw() / .log()→diagnostics.CODE.throw(params) / .report(params)(andctx.diagnostics.logger.CODEis now a proxy that resolves directly to the nostics handle).causemoves from a 2nd arg into the params object.Convention docs (
AGENTS.md/CLAUDE.md), plugin-author docs (docs/kit/diagnostics.md,docs/errors/index.md), and the vite-devtools-kit skill have been rewritten to teach the new API.Linked Issues
Additional context
Verification:
pnpm sync --check✓ (devframe atv0.3.0),pnpm lint✓,pnpm test✓ (190/190),pnpm build✓. The remainingpnpm typecheckerrors are pre-existing RPC-type registration issues unrelated to this migration.