import { VNode, MaybeRefOrGetter } from 'vue'; import { DevToolsNodeContext } from '@vitejs/devtools-kit'; import { BirpcGroup } from 'birpc'; import { Component, NuxtOptions, NuxtPage, NuxtLayout, NuxtApp, NuxtDebugModuleMutationRecord, Nuxt } from 'nuxt/schema'; import { Import, UnimportMeta } from 'unimport'; import { RouteRecordNormalized } from 'vue-router'; import { Nitro, StorageMounts } from 'nitropack'; import { StorageValue } from 'unstorage'; import { ResolvedConfig } from 'vite'; import { NuxtAnalyzeMeta } from '@nuxt/schema'; import { SpawnOptions } from 'node:child_process'; type TabCategory = 'pinned' | 'app' | 'vue-devtools' | 'analyze' | 'server' | 'modules' | 'documentation' | 'advanced'; interface ModuleCustomTab { /** * The name of the tab, must be unique */ name: string; /** * Icon of the tab, support any Iconify icons, or a url to an image */ icon?: string; /** * Title of the tab */ title: string; /** * Main view of the tab */ view: ModuleView; /** * Category of the tab * @default 'app' */ category?: TabCategory; /** * Insert static vnode to the tab entry * * Advanced options. You don't usually need this. */ extraTabVNode?: VNode; /** * Require local authentication to access the tab * It's highly recommended to enable this if the tab have sensitive information or have access to the OS * * @default false */ requireAuth?: boolean; } interface ModuleLaunchView { /** * A view for module to lazy launch some actions */ type: 'launch'; title?: string; icon?: string; description: string; /** * Action buttons */ actions: ModuleLaunchAction[]; } interface ModuleIframeView { /** * Iframe view */ type: 'iframe'; /** * Url of the iframe */ src: string; /** * Persist the iframe instance even if the tab is not active * * @default true */ persistent?: boolean; /** * Additional permissions to allow in the iframe * These will be merged with the default permissions (clipboard-write, clipboard-read) * * @example ['camera', 'microphone', 'geolocation'] */ permissions?: string[]; } interface ModuleVNodeView { /** * Vue's VNode view */ type: 'vnode'; /** * Send vnode to the client, they must be static and serializable * * Call `nuxt.hook('devtools:customTabs:refresh')` to trigger manual refresh */ vnode: VNode; } interface ModuleLaunchAction { /** * Label of the action button */ label: string; /** * Additional HTML attributes to the action button */ attrs?: Record; /** * Indicate if the action is pending, will show a loading indicator and disable the button */ pending?: boolean; /** * Function to handle the action, this is executed on the server side. * Will automatically refresh the tabs after the action is resolved. */ handle?: () => void | Promise; /** * Treat the action as a link, will open the link in a new tab */ src?: string; } type ModuleView = ModuleIframeView | ModuleLaunchView | ModuleVNodeView; interface ModuleIframeTabLazyOptions { description?: string; onLoad?: () => Promise; } interface ModuleBuiltinTab { name: string; icon?: string; title?: string; path?: string; category?: TabCategory; show?: () => MaybeRefOrGetter; badge?: () => MaybeRefOrGetter; onClick?: () => void; } type ModuleTabInfo = ModuleCustomTab | ModuleBuiltinTab; type CategorizedTabs = [TabCategory, (ModuleCustomTab | ModuleBuiltinTab)[]][]; interface HookInfo { name: string; start: number; end?: number; duration?: number; listeners: number; executions: number[]; } interface ImageMeta { width: number; height: number; orientation?: number; type?: string; mimeType?: string; } interface PackageUpdateInfo { name: string; current: string; latest: string; needsUpdate: boolean; } type PackageManagerName = 'npm' | 'yarn' | 'pnpm' | 'bun'; type NpmCommandType = 'install' | 'uninstall' | 'update'; interface NpmCommandOptions { dev?: boolean; } interface AutoImportsWithMetadata { imports: Import[]; metadata?: UnimportMeta; dirs: string[]; } interface RouteInfo extends Pick { file?: string; } interface ServerRouteInfo { route: string; filepath: string; method?: string; type: 'api' | 'route' | 'runtime' | 'collection'; routes?: ServerRouteInfo[]; } type ServerRouteInputType = 'string' | 'number' | 'boolean' | 'file' | 'date' | 'time' | 'datetime-local'; interface ServerRouteInput { active: boolean; key: string; value: any; type?: ServerRouteInputType; } interface Payload { url: string; time: number; data?: Record; state?: Record; functions?: Record; } interface ServerTaskInfo { name: string; handler: string; description: string; type: 'collection' | 'task'; tasks?: ServerTaskInfo[]; } interface ScannedNitroTasks { tasks: { [name: string]: { handler: string; description: string; }; }; scheduledTasks: { [cron: string]: string[]; }; } interface PluginInfoWithMetic { src: string; mode?: 'client' | 'server' | 'all'; ssr?: boolean; metric?: PluginMetric; } interface PluginMetric { src: string; start: number; end: number; duration: number; } interface LoadingTimeMetric { ssrStart?: number; appInit?: number; appLoad?: number; pageStart?: number; pageEnd?: number; pluginInit?: number; hmrStart?: number; hmrEnd?: number; } interface BasicModuleInfo { entryPath?: string; meta?: { name?: string; }; } interface InstalledModuleInfo { name?: string; isPackageModule: boolean; isUninstallable: boolean; info?: ModuleStaticInfo; entryPath?: string; timings?: Record; meta?: { name?: string; }; } interface ModuleStaticInfo { name: string; description: string; repo: string; npm: string; icon?: string; github: string; website: string; learn_more: string; category: string; type: ModuleType; stats: ModuleStats; maintainers: MaintainerInfo[]; contributors: GitHubContributor[]; compatibility: ModuleCompatibility; } interface ModuleCompatibility { nuxt: string; requires: { bridge?: boolean | 'optional'; }; } interface ModuleStats { downloads: number; stars: number; publishedAt: number; createdAt: number; } type CompatibilityStatus = 'working' | 'wip' | 'unknown' | 'not-working'; type ModuleType = 'community' | 'official' | '3rd-party'; interface MaintainerInfo { name: string; github: string; twitter?: string; } interface GitHubContributor { login: string; name?: string; avatar_url?: string; } interface VueInspectorClient { enabled: boolean; position: { x: number; y: number; }; linkParams: { file: string; line: number; column: number; }; enable: () => void; disable: () => void; toggleEnabled: () => void; openInEditor: (url: URL) => void; onUpdated: () => void; } type VueInspectorData = VueInspectorClient['linkParams'] & Partial; type AssetType = 'image' | 'font' | 'video' | 'audio' | 'text' | 'json' | 'other'; interface AssetInfo { path: string; type: AssetType; publicPath: string; filePath: string; size: number; mtime: number; layer?: string; } interface AssetEntry { path: string; content: string; encoding?: BufferEncoding; override?: boolean; } interface CodeSnippet { code: string; lang: string; name: string; docs?: string; } interface ComponentRelationship { id: string; deps: string[]; } interface ComponentWithRelationships { component: Component; dependencies?: string[]; dependents?: string[]; } interface CodeServerOptions { codeBinary: string; launchArg: string; licenseTermsArg: string; connectionTokenArg: string; } type CodeServerType = 'ms-code-cli' | 'ms-code-server' | 'coder-code-server'; interface ModuleOptions { /** * Enable DevTools * * @default true */ enabled?: boolean; /** * Custom tabs * * This is in static format, for dynamic injection, call `nuxt.hook('devtools:customTabs')` instead */ customTabs?: ModuleCustomTab[]; /** * VS Code Server integration options. */ vscode?: VSCodeIntegrationOptions; /** * Enable Vue Component Inspector * * @default true */ componentInspector?: boolean; /** * Enable Vue DevTools integration */ vueDevTools?: boolean; /** * Enable vite-plugin-inspect * * @default true */ viteInspect?: boolean; /** * @deprecated Auth is now handled by Vite DevTools. This option is ignored. */ disableAuthorization?: boolean; /** * Props for the iframe element, useful for environment with stricter CSP */ iframeProps?: Record; /** * Experimental features */ experimental?: { /** * Timeline tab * @deprecated Use `timeline.enable` instead */ timeline?: boolean; }; /** * Options for the timeline tab */ timeline?: { /** * Enable timeline tab * * @default false */ enabled?: boolean; /** * Track on function calls */ functions?: { include?: (string | RegExp | ((item: Import) => boolean))[]; /** * Include from specific modules * * @default ['#app', '@unhead/vue'] */ includeFrom?: string[]; exclude?: (string | RegExp | ((item: Import) => boolean))[]; }; }; /** * Options for assets tab */ assets?: { /** * Allowed file extensions for assets tab to upload. * To security concern. * * Set to '*' to disbale this limitation entirely * * @default Common media and txt files */ uploadExtensions?: '*' | string[]; }; /** * Enable anonymous telemetry, helping us improve Nuxt DevTools. * * By default it will respect global Nuxt telemetry settings. */ telemetry?: boolean; } interface VSCodeIntegrationOptions { /** * Enable VS Code Server integration */ enabled?: boolean; /** * Start VS Code Server on boot * * @default false */ startOnBoot?: boolean; /** * Port to start VS Code Server * * @default 3080 */ port?: number; /** * Reuse existing server if available (same port) */ reuseExistingServer?: boolean; /** * Determine whether to use code-server or vs code tunnel * * @default 'local-serve' */ mode?: 'local-serve' | 'tunnel'; /** * Options for VS Code tunnel */ tunnel?: VSCodeTunnelOptions; /** * Determines which binary and arguments to use for VS Code. * * By default, uses the MS Code Server (ms-code-server). * Can alternatively use the open source Coder code-server (coder-code-server), * or the MS VS Code CLI (ms-code-cli) * @default 'ms-code-server' */ codeServer?: CodeServerType; /** * Host address to listen on. Unspecified by default. */ host?: string; } interface VSCodeTunnelOptions { /** * the machine name for port forwarding service * * default: device hostname */ name?: string; } interface NuxtDevToolsOptions { behavior: { telemetry: boolean | null; openInEditor: string | undefined; }; ui: { componentsGraphShowGlobalComponents: boolean; componentsGraphShowLayouts: boolean; componentsGraphShowNodeModules: boolean; componentsGraphShowPages: boolean; componentsGraphShowWorkspace: boolean; componentsView: 'list' | 'graph'; hiddenTabCategories: string[]; hiddenTabs: string[]; interactionCloseOnOutsideClick: boolean; pinnedTabs: string[]; scale: number; showExperimentalFeatures: boolean; showHelpButtons: boolean; sidebarExpanded: boolean; sidebarScrollable: boolean; }; serverRoutes: { selectedRoute: ServerRouteInfo | null; view: 'tree' | 'list'; inputDefaults: Record; sendFrom: 'app' | 'devtools'; }; serverTasks: { enabled: boolean; selectedTask: ServerTaskInfo | null; view: 'tree' | 'list'; inputDefaults: Record; }; assets: { view: 'grid' | 'list'; }; } interface AnalyzeBuildMeta extends NuxtAnalyzeMeta { features: { bundleClient: boolean; bundleNitro: boolean; viteInspect: boolean; }; size: { clientBundle?: number; nitroBundle?: number; }; } interface AnalyzeBuildsInfo { isBuilding: boolean; builds: AnalyzeBuildMeta[]; } interface TerminalBase { id: string; name: string; description?: string; icon?: string; } type TerminalAction = 'restart' | 'terminate' | 'clear' | 'remove'; interface SubprocessOptions { command: string; args?: string[]; cwd?: string; env?: Record; nodeOptions?: SpawnOptions; } interface TerminalInfo extends TerminalBase { /** * Whether the terminal can be restarted */ restartable?: boolean; /** * Whether the terminal can be terminated */ terminatable?: boolean; /** * Whether the terminal is terminated */ isTerminated?: boolean; /** * Content buffer */ buffer?: string; } interface TerminalState extends TerminalInfo { /** * User action to restart the terminal, when not provided, this action will be disabled */ onActionRestart?: () => Promise | void; /** * User action to terminate the terminal, when not provided, this action will be disabled */ onActionTerminate?: () => Promise | void; } interface ServerFunctions { getServerConfig: () => NuxtOptions; getServerDebugContext: () => Promise; getServerData: () => Promise; getServerRuntimeConfig: () => Record; getModuleOptions: () => ModuleOptions; getComponents: () => Component[]; getComponentsRelationships: () => Promise; getAutoImports: () => AutoImportsWithMetadata; getServerPages: () => NuxtPage[]; getCustomTabs: () => ModuleCustomTab[]; getServerHooks: () => HookInfo[]; getServerLayouts: () => NuxtLayout[]; getStaticAssets: () => Promise; getServerRoutes: () => ServerRouteInfo[]; getServerTasks: () => ScannedNitroTasks | null; getServerApp: () => NuxtApp | undefined; getOptions: (tab: T) => Promise; updateOptions: (tab: T, settings: Partial) => Promise; clearOptions: () => Promise; checkForUpdateFor: (name: string) => Promise; getNpmCommand: (command: NpmCommandType, packageName: string, options?: NpmCommandOptions) => Promise; runNpmCommand: (command: NpmCommandType, packageName: string, options?: NpmCommandOptions) => Promise<{ processId: string; } | undefined>; getTerminals: () => TerminalInfo[]; getTerminalDetail: (id: string) => Promise; runTerminalAction: (id: string, action: TerminalAction) => Promise; getStorageMounts: () => Promise; getStorageKeys: (base?: string) => Promise; getStorageItem: (key: string) => Promise; setStorageItem: (key: string, value: StorageValue) => Promise; removeStorageItem: (key: string) => Promise; getAnalyzeBuildInfo: () => Promise; generateAnalyzeBuildName: () => Promise; startAnalyzeBuild: (name: string) => Promise; clearAnalyzeBuilds: (names?: string[]) => Promise; getImageMeta: (filepath: string) => Promise; getTextAssetContent: (filepath: string, limit?: number) => Promise; writeStaticAssets: (file: AssetEntry[], folder: string) => Promise; deleteStaticAsset: (filepath: string) => Promise; renameStaticAsset: (oldPath: string, newPath: string) => Promise; telemetryEvent: (payload: object, immediate?: boolean) => void; customTabAction: (name: string, action: number) => Promise; enablePages: () => Promise; openInEditor: (filepath: string) => Promise; restartNuxt: (hard?: boolean) => Promise; installNuxtModule: (name: string, dry?: boolean) => Promise; uninstallNuxtModule: (name: string, dry?: boolean) => Promise; enableTimeline: (dry: boolean) => Promise<[string, string]>; requestForAuth: (info?: string, origin?: string) => Promise; verifyAuthToken: () => Promise; } interface ClientFunctions { refresh: (event: ClientUpdateEvent) => void; callHook: (hook: string, ...args: any[]) => Promise; navigateTo: (path: string) => void; onTerminalData: (_: { id: string; data: string; }) => void; onTerminalExit: (_: { id: string; code?: number; }) => void; } interface NuxtServerData { nuxt: NuxtOptions; nitro?: Nitro['options']; vite: { server?: ResolvedConfig; client?: ResolvedConfig; }; } type ClientUpdateEvent = keyof ServerFunctions; /** * Compatibility RPC interface that supports broadcast and function access. * Backed by Vite DevTools Kit's RpcFunctionsHost internally. */ interface NuxtDevtoolsRpc { /** * Broadcast proxy for calling client functions. * Supports `rpc.broadcast.refresh.asEvent(event)` pattern for backward compatibility. */ broadcast: { [K in keyof ClientFunctions]: ClientFunctions[K] & { asEvent: ClientFunctions[K]; }; }; /** * Proxy for accessing server functions locally. */ functions: ServerFunctions; } /** * @internal */ interface NuxtDevtoolsServerContext { nuxt: Nuxt; options: ModuleOptions; rpc: NuxtDevtoolsRpc; /** * The Vite DevTools Kit context, available after connection. */ devtoolsKit: DevToolsNodeContext | undefined; /** * Hook to open file in editor */ openInEditorHooks: ((filepath: string) => boolean | void | Promise)[]; /** * Invalidate client cache for a function and ask for re-fetching */ refresh: (event: keyof ServerFunctions) => void; extendServerRpc: , ServerFunctions extends object = Record>(name: string, functions: ServerFunctions) => BirpcGroup; } interface NuxtDevtoolsInfo { version: string; packagePath: string; } interface InstallModuleReturn { configOriginal: string; configGenerated: string; commands: string[]; processId: string; } type ServerDebugModuleMutationRecord = (Omit & { name: string; }); interface ServerDebugContext { moduleMutationRecords: ServerDebugModuleMutationRecord[]; } declare module '@nuxt/schema' { interface NuxtHooks { /** * Called before devtools starts. Useful to detect if devtools is enabled. */ 'devtools:before': () => void; /** * Called after devtools is initialized. */ 'devtools:initialized': (info: NuxtDevtoolsInfo) => void; /** * Hooks to extend devtools tabs. */ 'devtools:customTabs': (tabs: ModuleCustomTab[]) => void; /** * Retrigger update for custom tabs, `devtools:customTabs` will be called again. */ 'devtools:customTabs:refresh': () => void; /** * Register a terminal. */ 'devtools:terminal:register': (terminal: TerminalState) => void; /** * Write to a terminal. * * Returns true if terminal is found. */ 'devtools:terminal:write': (_: { id: string; data: string; }) => void; /** * Remove a terminal from devtools. * * Returns true if terminal is found and deleted. */ 'devtools:terminal:remove': (_: { id: string; }) => void; /** * Mark a terminal as terminated. */ 'devtools:terminal:exit': (_: { id: string; code?: number; }) => void; } } declare module '@nuxt/schema' { /** * Runtime Hooks */ interface RuntimeNuxtHooks { /** * On terminal data. */ 'devtools:terminal:data': (payload: { id: string; data: string; }) => void; } } export type { ScannedNitroTasks as $, AnalyzeBuildMeta as A, BasicModuleInfo as B, CategorizedTabs as C, ModuleTabInfo as D, ModuleType as E, ModuleVNodeView as F, GitHubContributor as G, HookInfo as H, ImageMeta as I, ModuleView as J, NpmCommandOptions as K, LoadingTimeMetric as L, ModuleCustomTab as M, NuxtDevtoolsInfo as N, NpmCommandType as O, PluginMetric as P, NuxtDevToolsOptions as Q, NuxtDevtoolsRpc as R, SubprocessOptions as S, TerminalState as T, NuxtDevtoolsServerContext as U, NuxtServerData as V, PackageManagerName as W, PackageUpdateInfo as X, Payload as Y, PluginInfoWithMetic as Z, RouteInfo as _, ServerFunctions as a, ServerDebugContext as a0, ServerDebugModuleMutationRecord as a1, ServerRouteInfo as a2, ServerRouteInput as a3, ServerRouteInputType as a4, ServerTaskInfo as a5, TabCategory as a6, TerminalAction as a7, TerminalBase as a8, TerminalInfo as a9, VSCodeIntegrationOptions as aa, VSCodeTunnelOptions as ab, VueInspectorClient as ac, VueInspectorData as ad, AnalyzeBuildsInfo as b, AssetEntry as c, AssetInfo as d, AssetType as e, AutoImportsWithMetadata as f, ClientFunctions as g, ClientUpdateEvent as h, CodeServerOptions as i, CodeServerType as j, CodeSnippet as k, CompatibilityStatus as l, ComponentRelationship as m, ComponentWithRelationships as n, InstallModuleReturn as o, InstalledModuleInfo as p, MaintainerInfo as q, ModuleBuiltinTab as r, ModuleCompatibility as s, ModuleIframeTabLazyOptions as t, ModuleIframeView as u, ModuleLaunchAction as v, ModuleLaunchView as w, ModuleOptions as x, ModuleStaticInfo as y, ModuleStats as z };