MCPcopy
hub / github.com/vitejs/vite / createDebugger

Function createDebugger

packages/vite/src/node/utils.ts:187–211  ·  view source on GitHub ↗
(
  namespace: ViteDebugScope,
  options: DebuggerOptions = {},
)

Source from the content-addressed store, hash-verified

185export type ViteDebugScope = `vite:${string}`
186
187export function createDebugger(
188 namespace: ViteDebugScope,
189 options: DebuggerOptions = {},
190): Debugger['log'] | undefined {
191 const log = debug(namespace)
192 const { onlyWhenFocused, depth } = options
193
194 if (depth && log.inspectOpts && log.inspectOpts.depth == null) {
195 log.inspectOpts.depth = options.depth
196 }
197
198 let enabled = log.enabled
199 if (enabled && onlyWhenFocused) {
200 const ns = typeof onlyWhenFocused === 'string' ? onlyWhenFocused : namespace
201 enabled = !!DEBUG?.includes(ns)
202 }
203
204 if (enabled) {
205 return (...args: [string, ...any[]]) => {
206 if (!filter || args.some((a) => a?.includes?.(filter))) {
207 log(...args)
208 }
209 }
210 }
211}
212
213function testCaseInsensitiveFS() {
214 if (!CLIENT_ENTRY.endsWith('client.mjs')) {

Callers 15

config.tsFile · 0.90
env.tsFile · 0.90
external.tsFile · 0.90
onRollupLogFunction · 0.90
pluginContainer.tsFile · 0.90
sourcemap.tsFile · 0.90
bundledDev.tsFile · 0.90
hmr.tsFile · 0.90
send.tsFile · 0.90
proxy.tsFile · 0.90
time.tsFile · 0.90

Calls 1

logFunction · 0.85

Tested by

no test coverage detected