11import type { DevToolsNodeContext } from '@vitejs/devtools-kit'
22import type { ResolvedConfig , ViteDevServer } from 'vite'
3- import Debug from 'debug '
3+ import { createDebug } from 'obug '
44import { debounce } from 'perfect-debounce'
55import { searchForWorkspaceRoot } from 'vite'
66import { ContextUtils } from './context-utils'
@@ -10,7 +10,8 @@ import { DevToolsTerminalHost } from './host-terminals'
1010import { DevToolsViewHost } from './host-views'
1111import { builtinRpcDecalrations } from './rpc'
1212
13- const debug = Debug ( 'vite:devtools:context' )
13+ const debugSetup = createDebug ( 'vite:devtools:context:setup' )
14+ const debugEvent = createDebug ( 'vite:devtools:context:event' )
1415
1516export async function createDevToolsContext (
1617 viteConfig : ResolvedConfig ,
@@ -46,12 +47,14 @@ export async function createDevToolsContext(
4647
4748 // Register hosts side effects
4849 docksHost . events . on ( 'dock:entry:updated' , debounce ( ( ) => {
50+ debugEvent ( 'dock:entry:updated' )
4951 rpcHost . broadcast ( {
5052 method : 'vite:internal:docks:updated' ,
5153 args : [ ] ,
5254 } )
5355 } , 10 ) )
5456 terminalsHost . events . on ( 'terminal:session:updated' , debounce ( ( ) => {
57+ debugEvent ( 'terminal:session:updated' )
5558 rpcHost . broadcast ( {
5659 method : 'vite:internal:terminals:updated' ,
5760 args : [ ] ,
@@ -76,7 +79,7 @@ export async function createDevToolsContext(
7679 if ( ! plugin . devtools ?. setup )
7780 continue
7881 try {
79- debug ( `Setting up plugin ${ plugin . name } `)
82+ debugSetup ( `setting up plugin ${ JSON . stringify ( plugin . name ) } `)
8083 await plugin . devtools ?. setup ?.( context )
8184 }
8285 catch ( error ) {
0 commit comments