Skip to content

feat(devframe)!: upgrade nostics to v0.2.0, drop deprecated APIs#20

Merged
antfu merged 1 commit into
mainfrom
antfu/fix-publint-types
May 21, 2026
Merged

feat(devframe)!: upgrade nostics to v0.2.0, drop deprecated APIs#20
antfu merged 1 commit into
mainfrom
antfu/fix-publint-types

Conversation

@antfu
Copy link
Copy Markdown
Contributor

@antfu antfu commented May 21, 2026

Summary

  • Bumps nostics from ^0.1.0 to ^0.2.0 and migrates all 23 diagnostics call sites across 13 source files from the deprecated .throw() / .report() methods to the new callable DiagnosticHandle form (throw diagnostics.DFxxxx(...)).
  • Refreshes the DevToolsDiagnosticsHost JSDoc and docs/guide/diagnostics.md guide so the documented API matches v0.2.0.
  • Fixes the publint FILE_DOES_NOT_EXIST finding for pkg.types: now points at ./dist/index.d.mts (the file tsdown actually emits), matching what nostics itself ships.
  • Bumps devframe to v0.4.0 — breaking for plugin authors who consume ctx.diagnostics.logger.CODE.report() / .throw().

Test plan

  • pnpm typecheck clean
  • pnpm lint clean
  • pnpm test — 319/319 passing, including the tsnapi api-snapshot guard
  • pnpm dlx publint packages/devframe — "All good!"

- Bump `nostics` catalog from `^0.1.0` to `^0.2.0`.
- Migrate all 23 diagnostics call sites from `.throw()` / `.report()` methods
  to the new callable `DiagnosticHandle` form (`throw diagnostics.DFxxxx(...)`
  / `diagnostics.DFxxxx(..., { method })`).
- Refresh `DevToolsDiagnosticsHost` JSDoc and the `docs/guide/diagnostics.md`
  guide to describe the callable handle.
- Fix publint `FILE_DOES_NOT_EXIST` finding: `pkg.types` now points at
  `./dist/index.d.mts` (the file tsdown actually emits).
- Bump devframe to `v0.4.0` — breaking change for plugin authors who consume
  `ctx.diagnostics.logger.CODE.report()` / `.throw()`.
Copilot AI review requested due to automatic review settings May 21, 2026 07:07
@netlify
Copy link
Copy Markdown

netlify Bot commented May 21, 2026

Deploy Preview for devfra ready!

Name Link
🔨 Latest commit 8bb252a
🔍 Latest deploy log https://app.netlify.com/projects/devfra/deploys/6a0eaf489d3417000883af81
😎 Deploy Preview https://deploy-preview-20--devfra.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.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR upgrades nostics to v0.2.0 and migrates devframe’s diagnostics usage from deprecated .throw() / .report() methods to the new callable DiagnosticHandle API, while aligning documentation and package metadata with the new behavior.

Changes:

  • Bump nostics to ^0.2.0 and update lockfile-resolved versions.
  • Migrate diagnostics emissions across node/RPC codepaths to diagnostics.CODE(params, opts) with throw diagnostics.CODE(...) for thrown cases.
  • Update docs/JSDoc and fix devframe package types entry to match emitted tsdown declaration output.

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pnpm-workspace.yaml Updates the workspace catalog to nostics ^0.2.0.
pnpm-lock.yaml Locks nostics@0.2.0 and related dependency graph updates.
packages/devframe/src/types/diagnostics.ts Updates public type/JSDoc text to describe callable diagnostic handles.
packages/devframe/src/rpc/validation.ts Migrates thrown diagnostics to throw diagnostics.DF00xx(...).
packages/devframe/src/rpc/serialization.ts Migrates DF0020 creation to callable handle form.
packages/devframe/src/rpc/handler.ts Migrates missing-handler diagnostic throw to callable form.
packages/devframe/src/rpc/dump/collect.ts Migrates dump/client diagnostics to callable handle form.
packages/devframe/src/rpc/collector.ts Migrates RPC collector diagnostics to callable handle form.
packages/devframe/src/node/storage.ts Migrates warn reporting to callable handle + reporter options.
packages/devframe/src/node/rpc-streaming.ts Migrates stream error reporting and channel-dup throw to callable form.
packages/devframe/src/node/rpc-shared-state.ts Migrates shared-state missing diagnostic to callable form.
packages/devframe/src/node/host-views.ts Migrates distDir missing diagnostic throw to callable form.
packages/devframe/src/node/host-functions.ts Migrates function-not-registered and ALS-not-set throws to callable form.
packages/devframe/src/node/host-agent.ts Migrates agent/tool/resource validation throws to callable form.
packages/devframe/src/helpers/vite.ts Migrates DF0033 warning reporting to callable form.
packages/devframe/src/adapters/mcp/build-server.ts Migrates DF0017 throws (transport/start failure) to callable form.
packages/devframe/package.json Bumps devframe version and updates types path to ./dist/index.d.mts.
docs/guide/diagnostics.md Updates guide examples and narrative to callable handle semantics.
AGENTS.md Updates contributor guidance examples to callable handle usage (but has an internal inconsistency noted in comments).
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

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

Comment thread AGENTS.md
Comment on lines 66 to +75
import { diagnostics } from './diagnostics'

// For thrown errors — always prefix with `throw` for TypeScript control flow:
throw diagnostics.DF0033.throw({ name })
throw diagnostics.DF0033({ id, reason })

// For reported warnings/errors (not thrown). The default console method is `warn`;
// override with the 2nd-arg reporter options when needed:
diagnostics.DF0033.report({ name }) // console.warn
diagnostics.DF0033.report({ name }, { method: 'error' }) // console.error
diagnostics.DF0033.report({ name, cause: error }, { method: 'warn' }) // attach cause
diagnostics.DF0033({ id, reason }) // console.warn
diagnostics.DF0033({ id, reason }, { method: 'error' }) // console.error
diagnostics.DF0033({ id, reason, cause: error }, { method: 'warn' }) // attach cause
@antfu antfu merged commit b83431f into main May 21, 2026
13 checks passed
@antfu antfu deleted the antfu/fix-publint-types branch May 21, 2026 07:18
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.

2 participants