Skip to content

feat(devtools): unify notifications on the devframe Messages system#1025

Merged
antfu merged 1 commit into
mainfrom
feat/messages-unification
Jul 15, 2026
Merged

feat(devtools): unify notifications on the devframe Messages system#1025
antfu merged 1 commit into
mainfrom
feat/messages-unification

Conversation

@antfubot

Copy link
Copy Markdown
Collaborator

Summary

Implements plan 01 — Messages unification. All Nuxt DevTools notifications now flow through devframe's Messages subsystem, so ephemeral toasts and persistent, leveled notifications both surface in Vite DevTools' built-in Messages dock and its toast overlay. Nuxt's bespoke devtoolsUiShowNotification toast is retired to a thin adapter.

Built on the landed compat/deprecation foundation (#1021 / #1023) — reaches the connected context via the onDevtoolsReady hooks; no queue/plumbing rebuilt.

What's included

Server — a notify path into ctx.messages

  • New devtools:notify Nuxt hook, a notify RPC function, and ctx.notify, all forwarding to the connected ctx.messages host. Calls emitted before the kit connects are buffered and replayed on connect.
  • New shared type NuxtDevtoolsNotifyInput (a Nuxt-friendly subset of the devframe message entry input).

Curated built-in sources (persisted + leveled)

  • Build analysis completion/failure and module install/uninstall results now push notifications.

Client — ephemeral toast re-pointed

  • devtoolsUiShowNotification is re-implemented over the Messages system (toast-only: notify + autoDismiss + autoDelete, so no dock history), via the preserved devtoolsUiProvideNotificationFn seam so the UI kit keeps no dependency on the client RPC.

Retire the bespoke toast

  • <NNotification /> unmounted; the component is kept as a no-op shim to avoid a hard break on external mounts.

Public API

  • notify(...) exposed on the injected client (client.devtools.notify(...)) for custom tabs / host code.

Tiering

  • Ephemeral client feedback (e.g. "Copied!") → toast-only, never persisted.
  • Server-originated notifications → persisted with a real level, building history in the Messages dock.

Deliberate deviation

The plan floated a nostics soft-deprecation code for devtoolsUiShowNotification. It was not added: deprecate() is server-side (needs a Nuxt instance) while this helper runs in the browser, and it remains the supported thin ephemeral-toast adapter, so there is no replacement to migrate to.

Testing

  • pnpm build, pnpm typecheck, pnpm lint, and pnpm test:unit all pass.
  • The tab-pinia playground dev server boots cleanly with the new wiring.
  • Manual in-browser verification of live toast placement + Messages-dock persistence for both tiers is still recommended before merge.

This PR was created with the help of an agent.

Route all Nuxt DevTools notifications through devframe's Messages
subsystem so ephemeral toasts and persistent leveled notifications both
surface in Vite DevTools' built-in Messages dock and toast overlay.

- add a `devtools:notify` hook, a `notify` RPC function and `ctx.notify`
  that forward into the connected `ctx.messages` host (buffered pre-connect)
- wire curated built-in sources (build analysis, module install/uninstall)
- re-point the ephemeral `devtoolsUiShowNotification` toast onto the
  Messages system via the preserved provider seam; retire the bespoke
  NNotification toast (kept as a no-op shim)
- expose `notify` on the injected client for custom tabs / host code
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying nuxt-devtools with  Cloudflare Pages  Cloudflare Pages

Latest commit: 9d3b4c9
Status: ✅  Deploy successful!
Preview URL: https://1bcc15cc.nuxt-devtools.pages.dev
Branch Preview URL: https://feat-messages-unification.nuxt-devtools.pages.dev

View logs

@antfu antfu merged commit 6bfe9c7 into main Jul 15, 2026
8 checks passed
@antfu antfu deleted the feat/messages-unification branch July 15, 2026 06:31
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