(
namespace: ViteDebugScope,
options: DebuggerOptions = {},
)
| 185 | export type ViteDebugScope = `vite:${string}` |
| 186 | |
| 187 | export 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 | |
| 213 | function testCaseInsensitiveFS() { |
| 214 | if (!CLIENT_ENTRY.endsWith('client.mjs')) { |
no test coverage detected