@nuxt/devtools-kit 4.0.0-alpha.10 → 4.0.0-alpha.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,951 +0,0 @@
1
- import { DevToolsMessageLevel, DevToolsMessageFilePosition, ViteDevToolsNodeContext } from '@vitejs/devtools-kit';
2
- import { VNode, MaybeRefOrGetter } from 'vue';
3
- import { BirpcGroup } from 'birpc';
4
- import { Component, NuxtOptions, NuxtPage, NuxtLayout, NuxtApp, Nuxt, NuxtDebugModuleMutationRecord } from 'nuxt/schema';
5
- import { Import, UnimportMeta } from 'unimport';
6
- import { RouteRecordNormalized } from 'vue-router';
7
- import { StorageValue } from 'unstorage';
8
- import { ResolvedConfig } from 'vite';
9
- import { NuxtAnalyzeMeta } from '@nuxt/schema';
10
- import { Nitro as Nitro$1, StorageMounts as StorageMounts$1 } from 'nitro/types';
11
- import { Nitro, StorageMounts } from 'nitropack';
12
- import { SpawnOptions } from 'node:child_process';
13
-
14
- type TabCategory = 'pinned' | 'app' | 'analyze' | 'server' | 'modules' | 'documentation' | 'advanced';
15
-
16
- interface ModuleCustomTab {
17
- /**
18
- * The name of the tab, must be unique
19
- */
20
- name: string;
21
- /**
22
- * Icon of the tab, support any Iconify icons, or a url to an image
23
- */
24
- icon?: string;
25
- /**
26
- * Title of the tab
27
- */
28
- title: string;
29
- /**
30
- * Main view of the tab
31
- */
32
- view: ModuleView;
33
- /**
34
- * Category of the tab
35
- * @default 'app'
36
- */
37
- category?: TabCategory;
38
- /**
39
- * Insert static vnode to the tab entry
40
- *
41
- * Advanced options. You don't usually need this.
42
- */
43
- extraTabVNode?: VNode;
44
- /**
45
- * Require local authentication to access the tab
46
- * It's highly recommended to enable this if the tab have sensitive information or have access to the OS
47
- *
48
- * @default false
49
- */
50
- requireAuth?: boolean;
51
- }
52
- interface ModuleLaunchView {
53
- /**
54
- * A view for module to lazy launch some actions
55
- */
56
- type: 'launch';
57
- title?: string;
58
- icon?: string;
59
- description: string;
60
- /**
61
- * Action buttons
62
- */
63
- actions: ModuleLaunchAction[];
64
- }
65
- interface ModuleIframeView {
66
- /**
67
- * Iframe view
68
- */
69
- type: 'iframe';
70
- /**
71
- * Url of the iframe
72
- */
73
- src: string;
74
- /**
75
- * Persist the iframe instance even if the tab is not active
76
- *
77
- * @default true
78
- */
79
- persistent?: boolean;
80
- /**
81
- * Additional permissions to allow in the iframe
82
- * These will be merged with the default permissions (clipboard-write, clipboard-read)
83
- *
84
- * @example ['camera', 'microphone', 'geolocation']
85
- */
86
- permissions?: string[];
87
- }
88
- interface ModuleVNodeView {
89
- /**
90
- * Vue's VNode view
91
- */
92
- type: 'vnode';
93
- /**
94
- * Send vnode to the client, they must be static and serializable
95
- *
96
- * Call `nuxt.hook('devtools:customTabs:refresh')` to trigger manual refresh
97
- */
98
- vnode: VNode;
99
- }
100
- interface ModuleLaunchAction {
101
- /**
102
- * Label of the action button
103
- */
104
- label: string;
105
- /**
106
- * Additional HTML attributes to the action button
107
- */
108
- attrs?: Record<string, string>;
109
- /**
110
- * Indicate if the action is pending, will show a loading indicator and disable the button
111
- */
112
- pending?: boolean;
113
- /**
114
- * Function to handle the action, this is executed on the server side.
115
- * Will automatically refresh the tabs after the action is resolved.
116
- */
117
- handle?: () => void | Promise<void>;
118
- /**
119
- * Treat the action as a link, will open the link in a new tab
120
- */
121
- src?: string;
122
- }
123
- type ModuleView = ModuleIframeView | ModuleLaunchView | ModuleVNodeView;
124
- interface ModuleIframeTabLazyOptions {
125
- description?: string;
126
- onLoad?: () => Promise<void>;
127
- }
128
- interface ModuleBuiltinTab {
129
- name: string;
130
- icon?: string;
131
- title?: string;
132
- path?: string;
133
- category?: TabCategory;
134
- defaultOrder?: number;
135
- show?: () => MaybeRefOrGetter<any>;
136
- badge?: () => MaybeRefOrGetter<number | string | undefined>;
137
- onClick?: () => void;
138
- }
139
- type ModuleTabInfo = ModuleCustomTab | ModuleBuiltinTab;
140
- type CategorizedTabs = [TabCategory, (ModuleCustomTab | ModuleBuiltinTab)[]][];
141
-
142
- /**
143
- * Severity level of a notification, mirroring devframe's message levels.
144
- *
145
- * Determines the color/icon of the entry in the Vite DevTools **Messages** dock
146
- * and its toast.
147
- */
148
- type NuxtDevtoolsNotifyLevel = DevToolsMessageLevel;
149
- /**
150
- * A Nuxt-friendly subset of devframe's `DevframeMessageEntryInput`.
151
- *
152
- * This is the input accepted by the `devtools:notify` Nuxt hook, the `notify`
153
- * RPC function and the injected client's `notify()` — all of which forward to
154
- * the connected `ctx.messages` host so notifications flow through the single
155
- * devframe Messages system (persistent dock list + toast overlay).
156
- *
157
- * Tiers are expressed through the flags below:
158
- * - **Ephemeral** (toast-only feedback like "Copied!"): `notify: true` with an
159
- * `autoDismiss` (toast lifetime) and `autoDelete` (entry lifetime) so it never
160
- * builds up history in the Messages dock.
161
- * - **Persistent** (server-originated, leveled): omit `autoDelete` so the entry
162
- * is kept in the Messages dock list.
163
- */
164
- interface NuxtDevtoolsNotifyInput {
165
- /** Short title / summary of the message. */
166
- message: string;
167
- /** Severity level. Defaults to `'info'`. */
168
- level?: NuxtDevtoolsNotifyLevel;
169
- /** Optional detailed description or explanation. */
170
- description?: string;
171
- /** Optional tags/labels for filtering in the Messages dock. */
172
- labels?: string[];
173
- /** Optional grouping category (e.g. `'build'`, `'lint'`, `'runtime'`). */
174
- category?: string;
175
- /** Optional source file position (e.g. for a build/lint error). */
176
- filePosition?: DevToolsMessageFilePosition;
177
- /** Optional stack trace string. */
178
- stacktrace?: string;
179
- /** Whether this message should also appear as a transient toast. */
180
- notify?: boolean;
181
- /** Time in ms to auto-dismiss the toast (client-side). */
182
- autoDismiss?: number;
183
- /** Time in ms to auto-delete the entry from the persistent list (server-side). */
184
- autoDelete?: number;
185
- }
186
-
187
- interface HookInfo {
188
- name: string;
189
- start: number;
190
- end?: number;
191
- duration?: number;
192
- listeners: number;
193
- executions: number[];
194
- }
195
- interface ImageMeta {
196
- width: number;
197
- height: number;
198
- orientation?: number;
199
- type?: string;
200
- mimeType?: string;
201
- }
202
- interface PackageUpdateInfo {
203
- name: string;
204
- current: string;
205
- latest: string;
206
- needsUpdate: boolean;
207
- }
208
- type PackageManagerName = 'npm' | 'yarn' | 'pnpm' | 'bun';
209
- type NpmCommandType = 'install' | 'uninstall' | 'update';
210
- interface NpmCommandOptions {
211
- dev?: boolean;
212
- }
213
- interface AutoImportsWithMetadata {
214
- imports: Import[];
215
- metadata?: UnimportMeta;
216
- dirs: string[];
217
- }
218
- interface RouteInfo extends Pick<RouteRecordNormalized, 'name' | 'path' | 'meta' | 'props' | 'children'> {
219
- file?: string;
220
- }
221
- interface ServerRouteInfo {
222
- route: string;
223
- filepath: string;
224
- method?: string;
225
- type: 'api' | 'route' | 'runtime' | 'collection';
226
- routes?: ServerRouteInfo[];
227
- }
228
- type ServerRouteInputType = 'string' | 'number' | 'boolean' | 'file' | 'date' | 'time' | 'datetime-local';
229
- interface ServerRouteInput {
230
- active: boolean;
231
- key: string;
232
- value: any;
233
- type?: ServerRouteInputType;
234
- }
235
- interface Payload {
236
- url: string;
237
- time: number;
238
- data?: Record<string, any>;
239
- state?: Record<string, any>;
240
- functions?: Record<string, any>;
241
- }
242
- interface ServerTaskInfo {
243
- name: string;
244
- handler: string;
245
- description: string;
246
- type: 'collection' | 'task';
247
- tasks?: ServerTaskInfo[];
248
- }
249
- interface ScannedNitroTasks {
250
- tasks: {
251
- [name: string]: {
252
- handler: string;
253
- description: string;
254
- };
255
- };
256
- scheduledTasks: {
257
- [cron: string]: string[];
258
- };
259
- }
260
- interface PluginInfoWithMetic {
261
- src: string;
262
- mode?: 'client' | 'server' | 'all';
263
- ssr?: boolean;
264
- metric?: PluginMetric;
265
- }
266
- interface PluginMetric {
267
- src: string;
268
- start: number;
269
- end: number;
270
- duration: number;
271
- }
272
- interface LoadingTimeMetric {
273
- ssrStart?: number;
274
- appInit?: number;
275
- appLoad?: number;
276
- pageStart?: number;
277
- pageEnd?: number;
278
- pluginInit?: number;
279
- hmrStart?: number;
280
- hmrEnd?: number;
281
- }
282
- interface BasicModuleInfo {
283
- entryPath?: string;
284
- meta?: {
285
- name?: string;
286
- };
287
- }
288
- interface InstalledModuleInfo {
289
- name?: string;
290
- isPackageModule: boolean;
291
- isUninstallable: boolean;
292
- info?: ModuleStaticInfo;
293
- entryPath?: string;
294
- timings?: Record<string, number | undefined>;
295
- meta?: {
296
- name?: string;
297
- };
298
- }
299
- interface ModuleStaticInfo {
300
- name: string;
301
- description: string;
302
- repo: string;
303
- npm: string;
304
- icon?: string;
305
- github: string;
306
- website: string;
307
- learn_more: string;
308
- category: string;
309
- type: ModuleType;
310
- stats: ModuleStats;
311
- maintainers: MaintainerInfo[];
312
- contributors: GitHubContributor[];
313
- compatibility: ModuleCompatibility;
314
- }
315
- interface ModuleCompatibility {
316
- nuxt: string;
317
- requires: {
318
- bridge?: boolean | 'optional';
319
- };
320
- }
321
- interface ModuleStats {
322
- downloads: number;
323
- stars: number;
324
- publishedAt: number;
325
- createdAt: number;
326
- }
327
- type CompatibilityStatus = 'working' | 'wip' | 'unknown' | 'not-working';
328
- type ModuleType = 'community' | 'official' | '3rd-party';
329
- interface MaintainerInfo {
330
- name: string;
331
- github: string;
332
- twitter?: string;
333
- }
334
- interface GitHubContributor {
335
- login: string;
336
- name?: string;
337
- avatar_url?: string;
338
- }
339
- interface VueInspectorClient {
340
- enabled: boolean;
341
- position: {
342
- x: number;
343
- y: number;
344
- };
345
- linkParams: {
346
- file: string;
347
- line: number;
348
- column: number;
349
- };
350
- enable: () => void;
351
- disable: () => void;
352
- toggleEnabled: () => void;
353
- openInEditor: (url: URL) => void;
354
- onUpdated: () => void;
355
- }
356
- type VueInspectorData = VueInspectorClient['linkParams'] & Partial<VueInspectorClient['position']>;
357
- type AssetType = 'image' | 'font' | 'video' | 'audio' | 'text' | 'json' | 'other';
358
- interface AssetInfo {
359
- path: string;
360
- type: AssetType;
361
- publicPath: string;
362
- filePath: string;
363
- size: number;
364
- mtime: number;
365
- layer?: string;
366
- }
367
- interface AssetEntry {
368
- path: string;
369
- content: string;
370
- encoding?: BufferEncoding;
371
- override?: boolean;
372
- }
373
- interface CodeSnippet {
374
- code: string;
375
- lang: string;
376
- name: string;
377
- docs?: string;
378
- }
379
- interface ComponentRelationship {
380
- id: string;
381
- deps: string[];
382
- }
383
- interface ComponentWithRelationships {
384
- component: Component;
385
- dependencies?: string[];
386
- dependents?: string[];
387
- }
388
-
389
- /** @deprecated Part of the removed `vscode` integration. */
390
- type CodeServerType = 'ms-code-cli' | 'ms-code-server' | 'coder-code-server';
391
- interface ModuleOptions {
392
- /**
393
- * Enable DevTools
394
- *
395
- * @default true
396
- */
397
- enabled?: boolean;
398
- /**
399
- * Custom tabs
400
- *
401
- * This is in static format, for dynamic injection, call `nuxt.hook('devtools:customTabs')` instead
402
- */
403
- customTabs?: ModuleCustomTab[];
404
- /** Code Server integration options. */
405
- codeServer?: CodeServerIntegrationOptions;
406
- /**
407
- * Legacy VS Code Server integration options.
408
- *
409
- * @deprecated Use `codeServer`. Legacy modes are no longer supported.
410
- */
411
- vscode?: VSCodeIntegrationOptions;
412
- /**
413
- * Enable Vue Component Inspector
414
- *
415
- * @default true
416
- */
417
- componentInspector?: boolean;
418
- /**
419
- * Enable the Vite Inspect integration.
420
- *
421
- * `vite-plugin-inspect` is an optional peer dependency. When it isn't
422
- * installed, DevTools shows an install launcher in its place (like Vite Plus
423
- * DevTools); once installed, the real Inspect view is mounted. Set this to
424
- * `false` to disable the integration (and its launcher) entirely.
425
- *
426
- * @default true
427
- */
428
- viteInspect?: boolean;
429
- /**
430
- * Disable the DevTools client authorization prompt, allowing any browser to
431
- * connect without approving it first.
432
- *
433
- * Defaults to `true` in sandboxed environments (StackBlitz, CodeSandbox).
434
- *
435
- * Note: disabling authorization lets any browser (including other devices, if
436
- * you expose the dev server to your LAN/WAN) connect to DevTools and access
437
- * your server and filesystem. Only disable it in trusted environments.
438
- */
439
- disableAuthorization?: boolean;
440
- /**
441
- * Props for the iframe element, useful for environment with stricter CSP
442
- */
443
- iframeProps?: Record<string, string | boolean>;
444
- /**
445
- * Experimental features
446
- */
447
- experimental?: {
448
- /**
449
- * Timeline tab
450
- * @deprecated Use `timeline.enable` instead
451
- */
452
- timeline?: boolean;
453
- };
454
- /**
455
- * Options for the timeline tab
456
- */
457
- timeline?: {
458
- /**
459
- * Enable timeline tab
460
- *
461
- * @default false
462
- */
463
- enabled?: boolean;
464
- /**
465
- * Track on function calls
466
- */
467
- functions?: {
468
- include?: (string | RegExp | ((item: Import) => boolean))[];
469
- /**
470
- * Include from specific modules
471
- *
472
- * @default ['#app', '@unhead/vue']
473
- */
474
- includeFrom?: string[];
475
- exclude?: (string | RegExp | ((item: Import) => boolean))[];
476
- };
477
- };
478
- /**
479
- * Options for assets tab
480
- */
481
- assets?: {
482
- /**
483
- * Allowed file extensions for assets tab to upload.
484
- * To security concern.
485
- *
486
- * Set to '*' to disbale this limitation entirely
487
- *
488
- * @default Common media and txt files
489
- */
490
- uploadExtensions?: '*' | string[];
491
- };
492
- /**
493
- * Enable anonymous telemetry, helping us improve Nuxt DevTools.
494
- *
495
- * By default it will respect global Nuxt telemetry settings.
496
- */
497
- telemetry?: boolean;
498
- }
499
- interface CodeServerIntegrationOptions {
500
- /**
501
- * Enable the Code Server integration.
502
- *
503
- * @default true
504
- */
505
- enabled?: boolean;
506
- /** Path or command name for Coder's `code-server` binary. */
507
- bin?: string;
508
- /** Workspace opened by Code Server. Defaults to the Nuxt root directory. */
509
- cwd?: string;
510
- /** Port for the Code Server process. Defaults to the plugin's free-port behavior. */
511
- serverPort?: number;
512
- /** Host for the Code Server process. Defaults to the plugin's loopback host. */
513
- host?: string;
514
- /** Additional safe arguments passed to `code-server`. */
515
- args?: string[];
516
- /** Additional safe environment variables passed to `code-server`. */
517
- env?: Record<string, string>;
518
- /** Suffix used to isolate the authenticated Code Server session cookie. */
519
- cookieSuffix?: string;
520
- /** Milliseconds to wait for Code Server to become ready. */
521
- startTimeout?: number;
522
- }
523
- /** @deprecated Use {@link CodeServerIntegrationOptions}. */
524
- interface VSCodeIntegrationOptions {
525
- /**
526
- * Enable VS Code Server integration
527
- */
528
- enabled?: boolean;
529
- /**
530
- * Start VS Code Server on boot
531
- *
532
- * @default false
533
- */
534
- startOnBoot?: boolean;
535
- /**
536
- * Port to start VS Code Server
537
- *
538
- * @default 3080
539
- */
540
- port?: number;
541
- /**
542
- * Reuse existing server if available (same port)
543
- */
544
- reuseExistingServer?: boolean;
545
- /**
546
- * Determine whether to use code-server or vs code tunnel
547
- *
548
- * @default 'local-serve'
549
- */
550
- mode?: 'local-serve' | 'tunnel';
551
- /**
552
- * Options for VS Code tunnel
553
- */
554
- tunnel?: VSCodeTunnelOptions;
555
- /**
556
- * Determines which binary and arguments to use for VS Code.
557
- *
558
- * By default, uses the MS Code Server (ms-code-server).
559
- * Can alternatively use the open source Coder code-server (coder-code-server),
560
- * or the MS VS Code CLI (ms-code-cli)
561
- * @default 'ms-code-server'
562
- */
563
- codeServer?: CodeServerType;
564
- /**
565
- * Host address to listen on. Unspecified by default.
566
- */
567
- host?: string;
568
- }
569
- /** @deprecated Tunnels are not supported by the Code Server integration. */
570
- interface VSCodeTunnelOptions {
571
- /**
572
- * the machine name for port forwarding service
573
- *
574
- * default: device hostname
575
- */
576
- name?: string;
577
- }
578
- interface NuxtDevToolsOptions {
579
- behavior: {
580
- telemetry: boolean | null;
581
- openInEditor: string | undefined;
582
- };
583
- ui: {
584
- componentsGraphShowGlobalComponents: boolean;
585
- componentsGraphShowLayouts: boolean;
586
- componentsGraphShowNodeModules: boolean;
587
- componentsGraphShowPages: boolean;
588
- componentsGraphShowWorkspace: boolean;
589
- componentsView: 'list' | 'graph';
590
- hiddenTabCategories: string[];
591
- hiddenTabs: string[];
592
- pinnedTabs: string[];
593
- scale: number;
594
- showExperimentalFeatures: boolean;
595
- showHelpButtons: boolean;
596
- };
597
- serverRoutes: {
598
- selectedRoute: ServerRouteInfo | null;
599
- view: 'tree' | 'list';
600
- inputDefaults: Record<string, ServerRouteInput[]>;
601
- sendFrom: 'app' | 'devtools';
602
- };
603
- serverTasks: {
604
- enabled: boolean;
605
- selectedTask: ServerTaskInfo | null;
606
- view: 'tree' | 'list';
607
- inputDefaults: Record<string, ServerRouteInput[]>;
608
- };
609
- assets: {
610
- view: 'grid' | 'list';
611
- };
612
- }
613
-
614
- interface AnalyzeBuildMeta extends NuxtAnalyzeMeta {
615
- features: {
616
- bundleClient: boolean;
617
- bundleNitro: boolean;
618
- viteInspect: boolean;
619
- };
620
- size: {
621
- clientBundle?: number;
622
- nitroBundle?: number;
623
- };
624
- }
625
- interface AnalyzeBuildsInfo {
626
- isBuilding: boolean;
627
- /**
628
- * Unique id of the terminal session for the build currently in flight, or
629
- * `undefined` when idle. The client reveals this session and derives its
630
- * "Building…" state from it instead of an `onTerminalExit` broadcast.
631
- */
632
- activeSessionId?: string;
633
- builds: AnalyzeBuildMeta[];
634
- }
635
-
636
- /**
637
- * `nitropack` (Nitro v2) and `nitro` (Nitro v3) are both declared as *optional*
638
- * peer dependencies, so a consumer only ever has one installed (Nuxt 4 →
639
- * `nitropack`, Nuxt 5 → `nitro`). A missing peer resolves its `import type` to
640
- * `any`, which would collapse a naive `V2 | V3` union to `any`. Detect which
641
- * package actually resolved — `keyof any` matches every key, so probing an
642
- * impossible `'___INVALID'` key tells a real Nitro type from the `any`
643
- * fallback — and resolve to just that one. Mirrors `@nuxt/kit`'s own detection.
644
- */
645
- type HasNitroV2 = 'options' extends keyof Nitro ? ('___INVALID' extends keyof Nitro ? false : true) : false;
646
- type HasNitroV3 = 'options' extends keyof Nitro$1 ? ('___INVALID' extends keyof Nitro$1 ? false : true) : false;
647
- type AnyNitro = HasNitroV2 extends true ? (HasNitroV3 extends true ? Nitro | Nitro$1 : Nitro) : Nitro$1;
648
- type AnyStorageMounts = HasNitroV2 extends true ? (HasNitroV3 extends true ? StorageMounts | StorageMounts$1 : StorageMounts) : StorageMounts$1;
649
-
650
- interface ServerFunctions {
651
- getServerConfig: () => NuxtOptions;
652
- getServerDebugContext: () => Promise<ServerDebugContext | undefined>;
653
- /**
654
- * @deprecated Replaced by the Data Inspector panel's live `Nuxt Application`
655
- * source. Kept as a compatibility shim (emits `NDT_DEP_0009`) for one
656
- * migration window and will be removed in a future major.
657
- */
658
- getServerData: () => Promise<NuxtServerData>;
659
- getServerRuntimeConfig: () => Record<string, any>;
660
- getModuleOptions: () => ModuleOptions;
661
- getComponents: () => Component[];
662
- getComponentsRelationships: () => Promise<ComponentRelationship[]>;
663
- getAutoImports: () => AutoImportsWithMetadata;
664
- getServerPages: () => NuxtPage[];
665
- getCustomTabs: () => ModuleCustomTab[];
666
- getServerHooks: () => HookInfo[];
667
- getServerLayouts: () => NuxtLayout[];
668
- getStaticAssets: () => Promise<AssetInfo[]>;
669
- getServerRoutes: () => ServerRouteInfo[];
670
- getServerTasks: () => ScannedNitroTasks | null;
671
- getServerApp: () => NuxtApp | undefined;
672
- getOptions: <T extends keyof NuxtDevToolsOptions>(tab: T) => Promise<NuxtDevToolsOptions[T]>;
673
- updateOptions: <T extends keyof NuxtDevToolsOptions>(tab: T, settings: Partial<NuxtDevToolsOptions[T]>) => Promise<void>;
674
- clearOptions: () => Promise<void>;
675
- checkForUpdateFor: (name: string) => Promise<PackageUpdateInfo | undefined>;
676
- getNpmCommand: (command: NpmCommandType, packageName: string, options?: NpmCommandOptions) => Promise<string[] | undefined>;
677
- runNpmCommand: (command: NpmCommandType, packageName: string, options?: NpmCommandOptions) => Promise<{
678
- processId: string;
679
- } | undefined>;
680
- revealTerminal: (id: string) => Promise<boolean>;
681
- getStorageMounts: () => Promise<AnyStorageMounts>;
682
- getStorageKeys: (base?: string) => Promise<string[]>;
683
- getStorageItem: (key: string) => Promise<StorageValue>;
684
- setStorageItem: (key: string, value: StorageValue) => Promise<void>;
685
- removeStorageItem: (key: string) => Promise<void>;
686
- getAnalyzeBuildInfo: () => Promise<AnalyzeBuildsInfo>;
687
- generateAnalyzeBuildName: () => Promise<string>;
688
- startAnalyzeBuild: (name: string) => Promise<string>;
689
- clearAnalyzeBuilds: (names?: string[]) => Promise<void>;
690
- getImageMeta: (filepath: string) => Promise<ImageMeta | undefined>;
691
- getTextAssetContent: (filepath: string, limit?: number) => Promise<string | undefined>;
692
- writeStaticAssets: (file: AssetEntry[], folder: string) => Promise<string[]>;
693
- deleteStaticAsset: (filepath: string) => Promise<void>;
694
- renameStaticAsset: (oldPath: string, newPath: string) => Promise<void>;
695
- notify: (input: NuxtDevtoolsNotifyInput) => Promise<void>;
696
- telemetryEvent: (payload: object, immediate?: boolean) => void;
697
- customTabAction: (name: string, action: number) => Promise<boolean>;
698
- enablePages: () => Promise<void>;
699
- openInEditor: (filepath: string) => Promise<boolean>;
700
- restartNuxt: (hard?: boolean) => Promise<void>;
701
- installNuxtModule: (name: string, dry?: boolean, sessionId?: string) => Promise<InstallModuleReturn>;
702
- uninstallNuxtModule: (name: string, dry?: boolean, sessionId?: string) => Promise<InstallModuleReturn>;
703
- enableTimeline: (dry: boolean) => Promise<[string, string]>;
704
- requestForAuth: (info?: string, origin?: string) => Promise<void>;
705
- verifyAuthToken: () => Promise<boolean>;
706
- }
707
- interface ClientFunctions {
708
- refresh: (event: ClientUpdateEvent) => void;
709
- callHook: (hook: string, ...args: any[]) => Promise<void>;
710
- navigateTo: (path: string) => void;
711
- /**
712
- * Minimal server→client completion signal for generic package updates only
713
- * (`runNpmCommand`): the run RPC returns before the process exits, so this
714
- * lets `usePackageUpdate` and the restart prompt settle once it finishes. It
715
- * carries only `{ id, code }` and is not a terminal-data transport. Module
716
- * install/uninstall and analyze-build no longer rely on it — they clear their
717
- * UI from the awaited RPC / refreshed info instead.
718
- */
719
- onTerminalExit: (_: {
720
- id: string;
721
- code?: number;
722
- }) => void;
723
- }
724
- /**
725
- * @deprecated The payload of the deprecated {@link ServerFunctions.getServerData}
726
- * shim. Use the Data Inspector panel's live `Nuxt Application` source instead.
727
- */
728
- interface NuxtServerData {
729
- nuxt: NuxtOptions;
730
- nitro?: AnyNitro['options'];
731
- vite: {
732
- server?: ResolvedConfig;
733
- client?: ResolvedConfig;
734
- };
735
- }
736
- type ClientUpdateEvent = keyof ServerFunctions;
737
-
738
- /**
739
- * Legacy Nuxt DevTools RPC compatibility surface exposed on `nuxt.devtools.rpc`.
740
- *
741
- * For new integrations prefer {@link onDevtoolsReady}, where the connected
742
- * `ViteDevToolsNodeContext` gives you the full devframe `ctx.rpc`
743
- * (`register`/`invokeLocal`/`broadcast`/`sharedState`/…).
744
- */
745
- interface NuxtDevtoolsRpc {
746
- /**
747
- * Broadcast proxy for calling client functions.
748
- * Supports `rpc.broadcast.refresh.asEvent(event)` for backward compatibility.
749
- */
750
- broadcast: {
751
- [K in keyof ClientFunctions]: ClientFunctions[K] & {
752
- asEvent: ClientFunctions[K];
753
- };
754
- };
755
- /**
756
- * Proxy for reading/writing server functions locally.
757
- */
758
- functions: ServerFunctions;
759
- }
760
- /**
761
- * @internal
762
- */
763
- interface NuxtDevtoolsServerContext {
764
- nuxt: Nuxt;
765
- options: ModuleOptions;
766
- rpc: NuxtDevtoolsRpc;
767
- /**
768
- * The connected Vite DevTools kit context (`docks`/`terminals`/`messages`/
769
- * `commands`/`rpc`/`diagnostics`/…).
770
- *
771
- * This is the raw escape hatch and is `undefined` until the Vite DevTools
772
- * plugin connects. Prefer {@link onDevtoolsReady}, which hands you the
773
- * connected context.
774
- */
775
- devtoolsKit: ViteDevToolsNodeContext | undefined;
776
- /**
777
- * Hook to open file in editor
778
- */
779
- openInEditorHooks: ((filepath: string) => boolean | void | Promise<boolean | void>)[];
780
- /**
781
- * Invalidate client cache for a function and ask for re-fetching
782
- */
783
- refresh: (event: keyof ServerFunctions) => void;
784
- /**
785
- * Push a notification through the devframe Messages system (`ctx.messages`).
786
- *
787
- * The connected messages host surfaces it in the Vite DevTools **Messages**
788
- * dock and/or as a toast. Calls made before the kit connects are buffered and
789
- * replayed on connect. Used by the `devtools:notify` hook, the `notify` RPC
790
- * function and the curated built-in notification sources.
791
- */
792
- notify: (input: NuxtDevtoolsNotifyInput) => void;
793
- /**
794
- * @deprecated Use the Vite DevTools RPC registration instead:
795
- * `nuxt.devtools.rpc.register(defineRpcFunction(...))`. Kept working as a shim.
796
- */
797
- extendServerRpc: <ClientFunctions extends object = Record<string, unknown>, ServerFunctions extends object = Record<string, unknown>>(name: string, functions: ServerFunctions) => BirpcGroup<ClientFunctions, ServerFunctions>;
798
- }
799
- interface NuxtDevtoolsInfo {
800
- version: string;
801
- packagePath: string;
802
- }
803
- interface InstallModuleReturn {
804
- configOriginal: string;
805
- configGenerated: string;
806
- commands: string[];
807
- processId: string;
808
- }
809
- type ServerDebugModuleMutationRecord = (Omit<NuxtDebugModuleMutationRecord, 'module'> & {
810
- name: string;
811
- });
812
- interface ServerDebugContext {
813
- moduleMutationRecords: ServerDebugModuleMutationRecord[];
814
- }
815
-
816
- interface TerminalBase {
817
- id: string;
818
- name: string;
819
- description?: string;
820
- icon?: string;
821
- }
822
- type TerminalAction = 'restart' | 'terminate' | 'clear' | 'remove';
823
- interface SubprocessOptions {
824
- command: string;
825
- args?: string[];
826
- cwd?: string;
827
- env?: Record<string, string | undefined>;
828
- nodeOptions?: SpawnOptions;
829
- }
830
- interface TerminalInfo extends TerminalBase {
831
- /**
832
- * Whether the terminal can be restarted.
833
- *
834
- * @deprecated Ignored since v4: legacy terminals are bridged onto the built-in
835
- * Terminals dock as read-only, output-only sessions, so Devframe shows no
836
- * restart control. Restart a `startSubprocess()`-owned process through its
837
- * returned handle instead. Will be removed in v5.
838
- */
839
- restartable?: boolean;
840
- /**
841
- * Whether the terminal can be terminated.
842
- *
843
- * @deprecated Ignored since v4 (see {@link TerminalInfo.restartable}). Will be
844
- * removed in v5.
845
- */
846
- terminatable?: boolean;
847
- /**
848
- * Whether the terminal is terminated
849
- */
850
- isTerminated?: boolean;
851
- /**
852
- * Content buffer
853
- */
854
- buffer?: string;
855
- }
856
- interface TerminalState extends TerminalInfo {
857
- /**
858
- * User action to restart the terminal, when not provided, this action will be disabled.
859
- *
860
- * @deprecated Ignored since v4: the bridge to the built-in Terminals dock
861
- * cannot attach action callbacks to an externally registered session. Will be
862
- * removed in v5.
863
- */
864
- onActionRestart?: () => Promise<void> | void;
865
- /**
866
- * User action to terminate the terminal, when not provided, this action will be disabled.
867
- *
868
- * @deprecated Ignored since v4 (see {@link TerminalState.onActionRestart}).
869
- * Will be removed in v5.
870
- */
871
- onActionTerminate?: () => Promise<void> | void;
872
- }
873
-
874
- declare module '@nuxt/schema' {
875
- interface NuxtHooks {
876
- /**
877
- * Called before devtools starts. Useful to detect if devtools is enabled.
878
- */
879
- 'devtools:before': () => void;
880
- /**
881
- * Called after devtools is initialized.
882
- */
883
- 'devtools:initialized': (info: NuxtDevtoolsInfo) => void;
884
- /**
885
- * Called once the Vite DevTools kit has connected, with the connected
886
- * `ViteDevToolsNodeContext`.
887
- *
888
- * This is the recommended place to do all DevTools integration
889
- * (registering docks, terminals, messages, commands, RPC functions,
890
- * diagnostics, …): the kit is guaranteed to be available here, so you don't
891
- * need the connect-safe accessors on `nuxt.devtools`.
892
- */
893
- 'devtools:ready': (ctx: ViteDevToolsNodeContext) => void | Promise<void>;
894
- /**
895
- * Push a notification through the devframe Messages system.
896
- *
897
- * Forwarded to the connected `ctx.messages` host, so it surfaces in the
898
- * Vite DevTools **Messages** dock (persistent, when leveled) and/or as a
899
- * transient toast (when `notify` is set). Calls made before the kit connects
900
- * are buffered and replayed once it does.
901
- *
902
- * @example
903
- * ```ts
904
- * nuxt.callHook('devtools:notify', { message: 'Build failed', level: 'error' })
905
- * ```
906
- */
907
- 'devtools:notify': (input: NuxtDevtoolsNotifyInput) => void;
908
- /**
909
- * Hooks to extend devtools tabs.
910
- */
911
- 'devtools:customTabs': (tabs: ModuleCustomTab[]) => void;
912
- /**
913
- * Retrigger update for custom tabs, `devtools:customTabs` will be called again.
914
- */
915
- 'devtools:customTabs:refresh': () => void;
916
- /**
917
- * Register a terminal whose process is owned by the caller (module).
918
- *
919
- * The registered session is surfaced **read-only** in the built-in Vite
920
- * DevTools **Terminals** dock; stream output into it via
921
- * `devtools:terminal:write`.
922
- */
923
- 'devtools:terminal:register': (terminal: TerminalState) => void;
924
- /**
925
- * Write to a terminal.
926
- *
927
- * Returns true if terminal is found.
928
- */
929
- 'devtools:terminal:write': (_: {
930
- id: string;
931
- data: string;
932
- }) => void;
933
- /**
934
- * Remove a terminal from devtools.
935
- *
936
- * Returns true if terminal is found and deleted.
937
- */
938
- 'devtools:terminal:remove': (_: {
939
- id: string;
940
- }) => void;
941
- /**
942
- * Mark a terminal as terminated.
943
- */
944
- 'devtools:terminal:exit': (_: {
945
- id: string;
946
- code?: number;
947
- }) => void;
948
- }
949
- }
950
-
951
- export type { PluginInfoWithMetic as $, AnalyzeBuildMeta as A, BasicModuleInfo as B, CategorizedTabs as C, ModuleStaticInfo as D, ModuleStats as E, ModuleTabInfo as F, GitHubContributor as G, HookInfo as H, ImageMeta as I, ModuleType as J, ModuleVNodeView as K, LoadingTimeMetric as L, ModuleCustomTab as M, NuxtDevtoolsServerContext as N, ModuleView as O, PluginMetric as P, NpmCommandOptions as Q, NpmCommandType as R, SubprocessOptions as S, TerminalState as T, NuxtDevToolsOptions as U, NuxtDevtoolsNotifyLevel as V, NuxtDevtoolsRpc as W, NuxtServerData as X, PackageManagerName as Y, PackageUpdateInfo as Z, Payload as _, NuxtDevtoolsInfo as a, RouteInfo as a0, ScannedNitroTasks as a1, ServerDebugContext as a2, ServerDebugModuleMutationRecord as a3, ServerRouteInfo as a4, ServerRouteInput as a5, ServerRouteInputType as a6, ServerTaskInfo as a7, TabCategory as a8, TerminalAction as a9, TerminalBase as aa, TerminalInfo as ab, VSCodeIntegrationOptions as ac, VSCodeTunnelOptions as ad, VueInspectorClient as ae, VueInspectorData as af, ServerFunctions as b, NuxtDevtoolsNotifyInput as c, AnalyzeBuildsInfo as d, AssetEntry as e, AssetInfo as f, AssetType as g, AutoImportsWithMetadata as h, ClientFunctions as i, ClientUpdateEvent as j, CodeServerIntegrationOptions as k, CodeServerType as l, CodeSnippet as m, CompatibilityStatus as n, ComponentRelationship as o, ComponentWithRelationships as p, InstallModuleReturn as q, InstalledModuleInfo as r, MaintainerInfo as s, ModuleBuiltinTab as t, ModuleCompatibility as u, ModuleIframeTabLazyOptions as v, ModuleIframeView as w, ModuleLaunchAction as x, ModuleLaunchView as y, ModuleOptions as z };