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

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,15 +1,17 @@
1
+ import { DevToolsMessageLevel, DevToolsMessageFilePosition, ViteDevToolsNodeContext } from '@vitejs/devtools-kit';
1
2
  import { VNode, MaybeRefOrGetter } from 'vue';
2
3
  import { BirpcGroup } from 'birpc';
3
- import { Component, NuxtOptions, NuxtPage, NuxtLayout, NuxtApp, NuxtDebugModuleMutationRecord, Nuxt } from 'nuxt/schema';
4
+ import { Component, NuxtOptions, NuxtPage, NuxtLayout, NuxtApp, Nuxt, NuxtDebugModuleMutationRecord } from 'nuxt/schema';
4
5
  import { Import, UnimportMeta } from 'unimport';
5
6
  import { RouteRecordNormalized } from 'vue-router';
6
- import { Nitro, StorageMounts } from 'nitropack';
7
7
  import { StorageValue } from 'unstorage';
8
8
  import { ResolvedConfig } from 'vite';
9
9
  import { NuxtAnalyzeMeta } from '@nuxt/schema';
10
- import { Options } from 'execa';
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';
11
13
 
12
- type TabCategory = 'pinned' | 'app' | 'vue-devtools' | 'analyze' | 'server' | 'modules' | 'documentation' | 'advanced';
14
+ type TabCategory = 'pinned' | 'app' | 'analyze' | 'server' | 'modules' | 'documentation' | 'advanced';
13
15
 
14
16
  interface ModuleCustomTab {
15
17
  /**
@@ -129,6 +131,7 @@ interface ModuleBuiltinTab {
129
131
  title?: string;
130
132
  path?: string;
131
133
  category?: TabCategory;
134
+ defaultOrder?: number;
132
135
  show?: () => MaybeRefOrGetter<any>;
133
136
  badge?: () => MaybeRefOrGetter<number | string | undefined>;
134
137
  onClick?: () => void;
@@ -136,6 +139,51 @@ interface ModuleBuiltinTab {
136
139
  type ModuleTabInfo = ModuleCustomTab | ModuleBuiltinTab;
137
140
  type CategorizedTabs = [TabCategory, (ModuleCustomTab | ModuleBuiltinTab)[]][];
138
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
+
139
187
  interface HookInfo {
140
188
  name: string;
141
189
  start: number;
@@ -161,7 +209,6 @@ type PackageManagerName = 'npm' | 'yarn' | 'pnpm' | 'bun';
161
209
  type NpmCommandType = 'install' | 'uninstall' | 'update';
162
210
  interface NpmCommandOptions {
163
211
  dev?: boolean;
164
- global?: boolean;
165
212
  }
166
213
  interface AutoImportsWithMetadata {
167
214
  imports: Import[];
@@ -338,13 +385,8 @@ interface ComponentWithRelationships {
338
385
  dependencies?: string[];
339
386
  dependents?: string[];
340
387
  }
341
- interface CodeServerOptions {
342
- codeBinary: string;
343
- launchArg: string;
344
- licenseTermsArg: string;
345
- connectionTokenArg: string;
346
- }
347
388
 
389
+ /** @deprecated Part of the removed `vscode` integration. */
348
390
  type CodeServerType = 'ms-code-cli' | 'ms-code-server' | 'coder-code-server';
349
391
  interface ModuleOptions {
350
392
  /**
@@ -359,8 +401,12 @@ interface ModuleOptions {
359
401
  * This is in static format, for dynamic injection, call `nuxt.hook('devtools:customTabs')` instead
360
402
  */
361
403
  customTabs?: ModuleCustomTab[];
404
+ /** Code Server integration options. */
405
+ codeServer?: CodeServerIntegrationOptions;
362
406
  /**
363
- * VS Code Server integration options.
407
+ * Legacy VS Code Server integration options.
408
+ *
409
+ * @deprecated Use `codeServer`. Legacy modes are no longer supported.
364
410
  */
365
411
  vscode?: VSCodeIntegrationOptions;
366
412
  /**
@@ -370,29 +416,25 @@ interface ModuleOptions {
370
416
  */
371
417
  componentInspector?: boolean;
372
418
  /**
373
- * Enable Vue DevTools integration
374
- */
375
- vueDevTools?: boolean;
376
- /**
377
- * Enable vite-plugin-inspect
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.
378
425
  *
379
426
  * @default true
380
427
  */
381
428
  viteInspect?: boolean;
382
429
  /**
383
- * Enable Vite DevTools integration
384
- *
385
- * @experimental
386
- * @default false
387
- */
388
- viteDevTools?: boolean;
389
- /**
390
- * Disable dev time authorization check.
430
+ * Disable the DevTools client authorization prompt, allowing any browser to
431
+ * connect without approving it first.
391
432
  *
392
- * **NOT RECOMMENDED**, only use this if you know what you are doing.
433
+ * Defaults to `true` in sandboxed environments (StackBlitz, CodeSandbox).
393
434
  *
394
- * @see https://github.com/nuxt/devtools/pull/257
395
- * @default false
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.
396
438
  */
397
439
  disableAuthorization?: boolean;
398
440
  /**
@@ -454,12 +496,31 @@ interface ModuleOptions {
454
496
  */
455
497
  telemetry?: boolean;
456
498
  }
457
- interface ModuleGlobalOptions {
499
+ interface CodeServerIntegrationOptions {
458
500
  /**
459
- * List of projects to enable devtools for. Only works when devtools is installed globally.
501
+ * Enable the Code Server integration.
502
+ *
503
+ * @default true
460
504
  */
461
- projects?: string[];
462
- }
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}. */
463
524
  interface VSCodeIntegrationOptions {
464
525
  /**
465
526
  * Enable VS Code Server integration
@@ -505,6 +566,7 @@ interface VSCodeIntegrationOptions {
505
566
  */
506
567
  host?: string;
507
568
  }
569
+ /** @deprecated Tunnels are not supported by the Code Server integration. */
508
570
  interface VSCodeTunnelOptions {
509
571
  /**
510
572
  * the machine name for port forwarding service
@@ -527,15 +589,10 @@ interface NuxtDevToolsOptions {
527
589
  componentsView: 'list' | 'graph';
528
590
  hiddenTabCategories: string[];
529
591
  hiddenTabs: string[];
530
- interactionCloseOnOutsideClick: boolean;
531
- minimizePanelInactive: number;
532
592
  pinnedTabs: string[];
533
593
  scale: number;
534
594
  showExperimentalFeatures: boolean;
535
595
  showHelpButtons: boolean;
536
- showPanel: boolean | null;
537
- sidebarExpanded: boolean;
538
- sidebarScrollable: boolean;
539
596
  };
540
597
  serverRoutes: {
541
598
  selectedRoute: ServerRouteInfo | null;
@@ -567,60 +624,39 @@ interface AnalyzeBuildMeta extends NuxtAnalyzeMeta {
567
624
  }
568
625
  interface AnalyzeBuildsInfo {
569
626
  isBuilding: boolean;
570
- builds: AnalyzeBuildMeta[];
571
- }
572
-
573
- interface TerminalBase {
574
- id: string;
575
- name: string;
576
- description?: string;
577
- icon?: string;
578
- }
579
- type TerminalAction = 'restart' | 'terminate' | 'clear' | 'remove';
580
- interface SubprocessOptions extends Options {
581
- command: string;
582
- args?: string[];
583
- }
584
- interface TerminalInfo extends TerminalBase {
585
- /**
586
- * Whether the terminal can be restarted
587
- */
588
- restartable?: boolean;
589
- /**
590
- * Whether the terminal can be terminated
591
- */
592
- terminatable?: boolean;
593
- /**
594
- * Whether the terminal is terminated
595
- */
596
- isTerminated?: boolean;
597
- /**
598
- * Content buffer
599
- */
600
- buffer?: string;
601
- }
602
- interface TerminalState extends TerminalInfo {
603
627
  /**
604
- * User action to restart the terminal, when not provided, this action will be disabled
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.
605
631
  */
606
- onActionRestart?: () => Promise<void> | void;
607
- /**
608
- * User action to terminate the terminal, when not provided, this action will be disabled
609
- */
610
- onActionTerminate?: () => Promise<void> | void;
632
+ activeSessionId?: string;
633
+ builds: AnalyzeBuildMeta[];
611
634
  }
612
635
 
613
- interface WizardFunctions {
614
- enablePages: (nuxt: any) => Promise<void>;
615
- }
616
- type WizardActions = keyof WizardFunctions;
617
- type GetWizardArgs<T extends WizardActions> = WizardFunctions[T] extends (nuxt: any, ...args: infer A) => any ? A : never;
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;
618
649
 
619
650
  interface ServerFunctions {
620
651
  getServerConfig: () => NuxtOptions;
621
652
  getServerDebugContext: () => Promise<ServerDebugContext | undefined>;
622
- getServerData: (token: string) => Promise<NuxtServerData>;
623
- getServerRuntimeConfig: (token: string) => Promise<Record<string, any>>;
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>;
624
660
  getModuleOptions: () => ModuleOptions;
625
661
  getComponents: () => Component[];
626
662
  getComponentsRelationships: () => Promise<ComponentRelationship[]>;
@@ -634,57 +670,64 @@ interface ServerFunctions {
634
670
  getServerTasks: () => ScannedNitroTasks | null;
635
671
  getServerApp: () => NuxtApp | undefined;
636
672
  getOptions: <T extends keyof NuxtDevToolsOptions>(tab: T) => Promise<NuxtDevToolsOptions[T]>;
637
- updateOptions: <T extends keyof NuxtDevToolsOptions>(token: string, tab: T, settings: Partial<NuxtDevToolsOptions[T]>) => Promise<void>;
638
- clearOptions: (token: string) => Promise<void>;
673
+ updateOptions: <T extends keyof NuxtDevToolsOptions>(tab: T, settings: Partial<NuxtDevToolsOptions[T]>) => Promise<void>;
674
+ clearOptions: () => Promise<void>;
639
675
  checkForUpdateFor: (name: string) => Promise<PackageUpdateInfo | undefined>;
640
676
  getNpmCommand: (command: NpmCommandType, packageName: string, options?: NpmCommandOptions) => Promise<string[] | undefined>;
641
- runNpmCommand: (token: string, command: NpmCommandType, packageName: string, options?: NpmCommandOptions) => Promise<{
677
+ runNpmCommand: (command: NpmCommandType, packageName: string, options?: NpmCommandOptions) => Promise<{
642
678
  processId: string;
643
679
  } | undefined>;
644
- getTerminals: () => TerminalInfo[];
645
- getTerminalDetail: (token: string, id: string) => Promise<TerminalInfo | undefined>;
646
- runTerminalAction: (token: string, id: string, action: TerminalAction) => Promise<boolean>;
647
- getStorageMounts: () => Promise<StorageMounts>;
680
+ revealTerminal: (id: string) => Promise<boolean>;
681
+ getStorageMounts: () => Promise<AnyStorageMounts>;
648
682
  getStorageKeys: (base?: string) => Promise<string[]>;
649
- getStorageItem: (token: string, key: string) => Promise<StorageValue>;
650
- setStorageItem: (token: string, key: string, value: StorageValue) => Promise<void>;
651
- removeStorageItem: (token: string, key: string) => Promise<void>;
683
+ getStorageItem: (key: string) => Promise<StorageValue>;
684
+ setStorageItem: (key: string, value: StorageValue) => Promise<void>;
685
+ removeStorageItem: (key: string) => Promise<void>;
652
686
  getAnalyzeBuildInfo: () => Promise<AnalyzeBuildsInfo>;
653
687
  generateAnalyzeBuildName: () => Promise<string>;
654
- startAnalyzeBuild: (token: string, name: string) => Promise<string>;
655
- clearAnalyzeBuilds: (token: string, names?: string[]) => Promise<void>;
656
- getImageMeta: (token: string, filepath: string) => Promise<ImageMeta | undefined>;
657
- getTextAssetContent: (token: string, filepath: string, limit?: number) => Promise<string | undefined>;
658
- writeStaticAssets: (token: string, file: AssetEntry[], folder: string) => Promise<string[]>;
659
- deleteStaticAsset: (token: string, filepath: string) => Promise<void>;
660
- renameStaticAsset: (token: string, oldPath: string, newPath: string) => Promise<void>;
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>;
661
696
  telemetryEvent: (payload: object, immediate?: boolean) => void;
662
- customTabAction: (token: string, name: string, action: number) => Promise<boolean>;
663
- runWizard: <T extends WizardActions>(token: string, name: T, ...args: GetWizardArgs<T>) => Promise<void>;
664
- openInEditor: (token: string, filepath: string) => Promise<boolean>;
665
- restartNuxt: (token: string, hard?: boolean) => Promise<void>;
666
- installNuxtModule: (token: string, name: string, dry?: boolean) => Promise<InstallModuleReturn>;
667
- uninstallNuxtModule: (token: string, name: string, dry?: boolean) => Promise<InstallModuleReturn>;
668
- enableTimeline: (token: string, dry: boolean) => Promise<[string, string]>;
669
- requestForAuth: (info?: string) => Promise<void>;
670
- verifyAuthToken: (token: string) => Promise<boolean>;
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>;
671
706
  }
672
707
  interface ClientFunctions {
673
708
  refresh: (event: ClientUpdateEvent) => void;
674
709
  callHook: (hook: string, ...args: any[]) => Promise<void>;
675
710
  navigateTo: (path: string) => void;
676
- onTerminalData: (_: {
677
- id: string;
678
- data: string;
679
- }) => 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
+ */
680
719
  onTerminalExit: (_: {
681
720
  id: string;
682
721
  code?: number;
683
722
  }) => void;
684
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
+ */
685
728
  interface NuxtServerData {
686
729
  nuxt: NuxtOptions;
687
- nitro?: Nitro['options'];
730
+ nitro?: AnyNitro['options'];
688
731
  vite: {
689
732
  server?: ResolvedConfig;
690
733
  client?: ResolvedConfig;
@@ -692,13 +735,44 @@ interface NuxtServerData {
692
735
  }
693
736
  type ClientUpdateEvent = keyof ServerFunctions;
694
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
+ }
695
760
  /**
696
761
  * @internal
697
762
  */
698
763
  interface NuxtDevtoolsServerContext {
699
764
  nuxt: Nuxt;
700
765
  options: ModuleOptions;
701
- rpc: BirpcGroup<ClientFunctions, ServerFunctions>;
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;
702
776
  /**
703
777
  * Hook to open file in editor
704
778
  */
@@ -708,15 +782,23 @@ interface NuxtDevtoolsServerContext {
708
782
  */
709
783
  refresh: (event: keyof ServerFunctions) => void;
710
784
  /**
711
- * Ensure dev auth token is valid, throw if not
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.
712
796
  */
713
- ensureDevAuthToken: (token: string) => Promise<void>;
714
797
  extendServerRpc: <ClientFunctions extends object = Record<string, unknown>, ServerFunctions extends object = Record<string, unknown>>(name: string, functions: ServerFunctions) => BirpcGroup<ClientFunctions, ServerFunctions>;
715
798
  }
716
799
  interface NuxtDevtoolsInfo {
717
800
  version: string;
718
801
  packagePath: string;
719
- isGlobalInstall: boolean;
720
802
  }
721
803
  interface InstallModuleReturn {
722
804
  configOriginal: string;
@@ -731,6 +813,64 @@ interface ServerDebugContext {
731
813
  moduleMutationRecords: ServerDebugModuleMutationRecord[];
732
814
  }
733
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
+
734
874
  declare module '@nuxt/schema' {
735
875
  interface NuxtHooks {
736
876
  /**
@@ -741,6 +881,30 @@ declare module '@nuxt/schema' {
741
881
  * Called after devtools is initialized.
742
882
  */
743
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;
744
908
  /**
745
909
  * Hooks to extend devtools tabs.
746
910
  */
@@ -750,7 +914,11 @@ declare module '@nuxt/schema' {
750
914
  */
751
915
  'devtools:customTabs:refresh': () => void;
752
916
  /**
753
- * Register a terminal.
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`.
754
922
  */
755
923
  'devtools:terminal:register': (terminal: TerminalState) => void;
756
924
  /**
@@ -779,19 +947,5 @@ declare module '@nuxt/schema' {
779
947
  }) => void;
780
948
  }
781
949
  }
782
- declare module '@nuxt/schema' {
783
- /**
784
- * Runtime Hooks
785
- */
786
- interface RuntimeNuxtHooks {
787
- /**
788
- * On terminal data.
789
- */
790
- 'devtools:terminal:data': (payload: {
791
- id: string;
792
- data: string;
793
- }) => void;
794
- }
795
- }
796
950
 
797
- export type { RouteInfo as $, AnalyzeBuildMeta as A, BasicModuleInfo as B, ClientFunctions as C, ModuleStaticInfo as D, ModuleStats as E, ModuleTabInfo as F, GetWizardArgs as G, HookInfo as H, ImageMeta as I, ModuleType as J, ModuleVNodeView as K, LoadingTimeMetric as L, ModuleCustomTab as M, NuxtDevtoolsInfo as N, ModuleView as O, PluginMetric as P, NpmCommandOptions as Q, NpmCommandType as R, SubprocessOptions as S, TerminalState as T, NuxtDevToolsOptions as U, NuxtDevtoolsServerContext as V, NuxtServerData as W, PackageManagerName as X, PackageUpdateInfo as Y, Payload as Z, PluginInfoWithMetic as _, ServerFunctions as a, ScannedNitroTasks as a0, ServerDebugContext as a1, ServerDebugModuleMutationRecord as a2, ServerRouteInfo as a3, ServerRouteInput as a4, ServerRouteInputType as a5, ServerTaskInfo as a6, TabCategory as a7, TerminalAction as a8, TerminalBase as a9, TerminalInfo as aa, VSCodeIntegrationOptions as ab, VSCodeTunnelOptions as ac, VueInspectorClient as ad, VueInspectorData as ae, WizardActions as af, WizardFunctions as ag, AnalyzeBuildsInfo as b, AssetEntry as c, AssetInfo as d, AssetType as e, AutoImportsWithMetadata as f, CategorizedTabs as g, ClientUpdateEvent as h, CodeServerOptions as i, CodeServerType as j, CodeSnippet as k, CompatibilityStatus as l, ComponentRelationship as m, ComponentWithRelationships as n, GitHubContributor as o, InstallModuleReturn as p, InstalledModuleInfo as q, MaintainerInfo as r, ModuleBuiltinTab as s, ModuleCompatibility as t, ModuleGlobalOptions as u, ModuleIframeTabLazyOptions as v, ModuleIframeView as w, ModuleLaunchAction as x, ModuleLaunchView as y, ModuleOptions as z };
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 };