@@ -2,7 +2,9 @@ import type { Plugin } from 'vite'
22import { createInspectDevframe } from '@devframes/plugin-inspect'
33import { createMessagesDevframe } from '@devframes/plugin-messages'
44import { createTerminalsDevframe } from '@devframes/plugin-terminals'
5+ import { DEVTOOLS_INSPECTOR_DOCK_ID } from '@vitejs/devtools-kit/constants'
56import { createPluginFromDevframe } from '@vitejs/devtools-kit/node'
7+ import { hideDockWhenEmpty } from './auto-hide'
68import { DevToolsBuild } from './build'
79import { DevToolsInjection } from './injection'
810import { DevToolsServer } from './server'
@@ -58,17 +60,32 @@ export async function DevTools(options: DevToolsOptions = {}): Promise<Plugin[]>
5860 // dock — rather than the `~viteplus` group (which collects integrations
5961 // like Rolldown). The hub's own `~terminals` / `~messages` docks are
6062 // suppressed via `builtinDocks` in `createDevToolsContext`.
61- plugins . push ( createPluginFromDevframe ( createTerminalsDevframe ( ) , {
63+ //
64+ // The hub's built-in `~terminals` / `~messages` docks auto-hid themselves
65+ // when empty; the plugin-mounted iframe docks that replaced them carry no
66+ // such rule, so we restore it here — the dock is filtered out of the bar
67+ // (`when: 'false'`) whenever there are no sessions / messages.
68+ const terminalsDevframe = createTerminalsDevframe ( )
69+ plugins . push ( createPluginFromDevframe ( terminalsDevframe , {
6270 dock : { category : '~builtin' } ,
71+ setup ( ctx ) {
72+ hideDockWhenEmpty ( ctx , terminalsDevframe . id , ( ) => ctx . terminals . sessions . size === 0 )
73+ } ,
6374 } ) )
64- plugins . push ( createPluginFromDevframe ( createMessagesDevframe ( ) , {
75+ const messagesDevframe = createMessagesDevframe ( )
76+ plugins . push ( createPluginFromDevframe ( messagesDevframe , {
6577 dock : { category : '~builtin' } ,
78+ setup ( ctx ) {
79+ hideDockWhenEmpty ( ctx , messagesDevframe . id , ( ) => ctx . messages . entries . size === 0 )
80+ } ,
6681 } ) )
6782
6883 // Meta-introspection ("DevTools for the DevTools"), provided by the
6984 // official devframe inspector plugin (replaces the former
70- // `@vitejs/devtools-self-inspect` package).
71- plugins . push ( createPluginFromDevframe ( createInspectDevframe ( ) , {
85+ // `@vitejs/devtools-self-inspect` package). Pinned to a stable id so the
86+ // client can gate it behind the `showDevframeInspector` user setting;
87+ // hidden by default (opt in via Settings → Advanced).
88+ plugins . push ( createPluginFromDevframe ( createInspectDevframe ( { id : DEVTOOLS_INSPECTOR_DOCK_ID } ) , {
7289 dock : { category : '~builtin' , icon : 'ph:stethoscope-duotone' } ,
7390 } ) )
7491 }
0 commit comments