@nuxt/devtools-kit 4.0.0-alpha.6 → 4.0.0-alpha.8

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.
package/dist/index.mjs CHANGED
@@ -1,7 +1,112 @@
1
1
  import { useNuxt } from '@nuxt/kit';
2
2
  import { x } from 'tinyexec';
3
+ import { defineDiagnostics, createConsoleReporter } from 'nostics';
4
+ export { createConsoleReporter, defineDiagnostics } from 'nostics';
3
5
 
6
+ function diagnosticsDocsBase(code) {
7
+ return `https://devtools.nuxt.com/module/migration-v4#${String(code).toLowerCase()}`;
8
+ }
9
+ const diagnosticCodes = {
10
+ /** `startSubprocess().getProcess()` → `getResult()`. */
11
+ NDT_DEP_0001: {
12
+ why: (p) => `\`${p.api}\` is deprecated.`,
13
+ fix: (p) => `Use \`${p.replacement}\` instead.`
14
+ },
15
+ // NDT_DEP_0002 is retired (was `disableAuthorization`, now a supported
16
+ // first-class option). The code is left unused so numbers stay stable.
17
+ /** `extendServerRpc` → `onDevtoolsReady((ctx) => ctx.rpc.register(...))`. */
18
+ NDT_DEP_0003: {
19
+ why: (p) => `\`${p.api}\` is deprecated.`,
20
+ fix: (p) => `Use \`${p.replacement}\` instead.`
21
+ },
22
+ /** `startSubprocess` → `onDevtoolsReady((ctx) => ctx.terminals.startChildProcess(...))`. */
23
+ NDT_DEP_0004: {
24
+ why: (p) => `\`${p.api}\` is deprecated.`,
25
+ fix: (p) => `Use \`${p.replacement}\` instead.`
26
+ },
27
+ /** `addCustomTab` → `onDevtoolsReady((ctx) => ctx.docks.register(...))`. */
28
+ NDT_DEP_0005: {
29
+ why: (p) => `\`${p.api}\` is deprecated.`,
30
+ fix: (p) => `Use \`${p.replacement}\` instead.`
31
+ },
32
+ /** `refreshCustomTabs` → `onDevtoolsReady((ctx) => ctx.docks.register(...))`. */
33
+ NDT_DEP_0006: {
34
+ why: (p) => `\`${p.api}\` is deprecated.`,
35
+ fix: (p) => `Use \`${p.replacement}\` instead.`
36
+ },
37
+ /** Direct `nuxt.devtools.rpc` access (`broadcast` / `functions`). */
38
+ NDT_DEP_0007: {
39
+ why: (p) => `\`${p.api}\` is deprecated.`,
40
+ fix: (p) => `Use \`${p.replacement}\` instead.`
41
+ },
42
+ // NDT_DEP_0008 is reserved for the removed `vscode` module option.
43
+ /** `getServerData()` RPC → the Data Inspector panel's `Nuxt Application` source. */
44
+ NDT_DEP_0009: {
45
+ why: (p) => `\`${p.api}\` is deprecated.`,
46
+ fix: (p) => `Use \`${p.replacement}\` instead.`
47
+ }
48
+ };
49
+ const consoleDiagnostics = defineDiagnostics({
50
+ docsBase: diagnosticsDocsBase,
51
+ reporters: [createConsoleReporter()],
52
+ codes: diagnosticCodes
53
+ });
54
+ const stateByCtx = /* @__PURE__ */ new WeakMap();
55
+ const fallbackState = { emitted: /* @__PURE__ */ new Set() };
56
+ function getState(ctx) {
57
+ if (!ctx)
58
+ return fallbackState;
59
+ let state = stateByCtx.get(ctx);
60
+ if (!state) {
61
+ state = { emitted: /* @__PURE__ */ new Set() };
62
+ stateByCtx.set(ctx, state);
63
+ }
64
+ return state;
65
+ }
66
+ function getServerContext(nuxt) {
67
+ return nuxt?.devtools;
68
+ }
69
+ function registerHostDiagnostics(ctx) {
70
+ const host = ctx.devtoolsKit?.diagnostics;
71
+ if (!host)
72
+ return;
73
+ const catalog = host.defineDiagnostics({
74
+ docsBase: diagnosticsDocsBase,
75
+ codes: diagnosticCodes
76
+ });
77
+ host.register(catalog);
78
+ getState(ctx).hostCatalog = catalog;
79
+ }
80
+ function deprecate(nuxt, code, params, options = {}) {
81
+ const ctx = getServerContext(nuxt);
82
+ const state = getState(ctx);
83
+ const dedupeKey = `${code}:${options.key ?? code}`;
84
+ if (state.emitted.has(dedupeKey))
85
+ return;
86
+ state.emitted.add(dedupeKey);
87
+ const method = options.method ?? "warn";
88
+ const hostHandle = state.hostCatalog?.[code];
89
+ if (hostHandle)
90
+ return hostHandle(params, { method });
91
+ const handle = consoleDiagnostics[code];
92
+ return handle(params, { method });
93
+ }
94
+ function defineStandaloneDiagnostics(options) {
95
+ return defineDiagnostics({
96
+ ...options,
97
+ reporters: options.reporters ?? [createConsoleReporter()]
98
+ });
99
+ }
100
+ function deprecateWithNuxt(code, params, options) {
101
+ return deprecate(useNuxt(), code, params, options);
102
+ }
103
+
104
+ const NUXT_DEVTOOLS_GROUP_ID = "nuxt";
4
105
  function addCustomTab(tab, nuxt = useNuxt()) {
106
+ deprecate(nuxt, "NDT_DEP_0005", {
107
+ api: "addCustomTab",
108
+ replacement: "onDevtoolsReady((ctx) => ctx.docks.register(...))"
109
+ }, { key: typeof tab === "function" ? void 0 : tab.name });
5
110
  nuxt.hook("devtools:customTabs", async (tabs) => {
6
111
  if (typeof tab === "function")
7
112
  tab = await tab();
@@ -9,9 +114,17 @@ function addCustomTab(tab, nuxt = useNuxt()) {
9
114
  });
10
115
  }
11
116
  function refreshCustomTabs(nuxt = useNuxt()) {
117
+ deprecate(nuxt, "NDT_DEP_0006", {
118
+ api: "refreshCustomTabs",
119
+ replacement: "onDevtoolsReady((ctx) => ctx.docks.register(...).update(...))"
120
+ });
12
121
  return nuxt.callHook("devtools:customTabs:refresh");
13
122
  }
14
123
  function startSubprocess(execaOptions, tabOptions, nuxt = useNuxt()) {
124
+ deprecate(nuxt, "NDT_DEP_0004", {
125
+ api: "startSubprocess",
126
+ replacement: "onDevtoolsReady((ctx) => ctx.terminals.startChildProcess(...))"
127
+ }, { key: tabOptions.id });
15
128
  const id = tabOptions.id;
16
129
  let restarting = false;
17
130
  function start() {
@@ -87,7 +200,10 @@ function startSubprocess(execaOptions, tabOptions, nuxt = useNuxt()) {
87
200
  return {
88
201
  /** @deprecated Use `getResult()` instead */
89
202
  getProcess: () => {
90
- console.warn("[nuxt-devtools] `getProcess()` is deprecated, use `getResult()` instead.");
203
+ deprecate(nuxt, "NDT_DEP_0001", {
204
+ api: "startSubprocess().getProcess()",
205
+ replacement: "getResult()"
206
+ }, { key: id });
91
207
  return result.process;
92
208
  },
93
209
  getResult: () => result,
@@ -105,8 +221,11 @@ function extendServerRpc(namespace, functions, nuxt = useNuxt()) {
105
221
  function onDevToolsInitialized(fn, nuxt = useNuxt()) {
106
222
  nuxt.hook("devtools:initialized", fn);
107
223
  }
224
+ function onDevtoolsReady(fn, nuxt = useNuxt()) {
225
+ nuxt.hook("devtools:ready", fn);
226
+ }
108
227
  function _getContext(nuxt = useNuxt()) {
109
228
  return nuxt?.devtools;
110
229
  }
111
230
 
112
- export { addCustomTab, extendServerRpc, onDevToolsInitialized, refreshCustomTabs, startSubprocess };
231
+ export { NUXT_DEVTOOLS_GROUP_ID, addCustomTab, consoleDiagnostics, defineStandaloneDiagnostics, deprecate, deprecateWithNuxt, diagnosticCodes, diagnosticsDocsBase, extendServerRpc, onDevToolsInitialized, onDevtoolsReady, refreshCustomTabs, registerHostDiagnostics, startSubprocess };
@@ -1,4 +1,22 @@
1
+ import type { DevToolsRpcClient } from '@vitejs/devtools-kit/client';
1
2
  import type { Ref } from 'vue';
2
3
  import type { NuxtDevtoolsIframeClient } from '../types';
3
4
  export declare function onDevtoolsClientConnected(fn: (client: NuxtDevtoolsIframeClient) => void): (() => void) | undefined;
5
+ /**
6
+ * Run a callback once the Vite DevTools client is ready, receiving the connected
7
+ * `DevToolsRpcClient` — the client-side mirror of the server's
8
+ * `onDevtoolsReady((ctx) => …)`.
9
+ *
10
+ * This is the recommended way to do client-side DevTools integration (register
11
+ * client RPC functions, call server functions, shared state, streaming, …):
12
+ *
13
+ * ```ts
14
+ * import { onDevtoolsReady } from '@nuxt/devtools-kit/iframe-client'
15
+ *
16
+ * onDevtoolsReady((kit) => {
17
+ * kit.client.register({ name: 'my-module:on-update', type: 'event', handler })
18
+ * })
19
+ * ```
20
+ */
21
+ export declare function onDevtoolsReady(fn: (kit: DevToolsRpcClient) => void): (() => void) | undefined;
4
22
  export declare function useDevtoolsClient(): Ref<NuxtDevtoolsIframeClient | undefined, NuxtDevtoolsIframeClient | undefined>;
@@ -25,6 +25,13 @@ export function onDevtoolsClientConnected(fn) {
25
25
  fns.splice(fns.indexOf(fn), 1);
26
26
  };
27
27
  }
28
+ export function onDevtoolsReady(fn) {
29
+ return onDevtoolsClientConnected((client) => {
30
+ const kit = client.devtools.devtoolsKit;
31
+ if (kit)
32
+ fn(kit);
33
+ });
34
+ }
28
35
  export function useDevtoolsClient() {
29
36
  if (!clientRef) {
30
37
  clientRef = shallowRef();
@@ -1,7 +1,7 @@
1
+ import { DevToolsMessageLevel, DevToolsMessageFilePosition, ViteDevToolsNodeContext } from '@vitejs/devtools-kit';
1
2
  import { VNode, MaybeRefOrGetter } from 'vue';
2
- import { DevToolsNodeContext } from '@vitejs/devtools-kit';
3
3
  import { BirpcGroup } from 'birpc';
4
- import { Component, NuxtOptions, NuxtPage, NuxtLayout, NuxtApp, NuxtDebugModuleMutationRecord, Nuxt } from 'nuxt/schema';
4
+ import { Component, NuxtOptions, NuxtPage, NuxtLayout, NuxtApp, Nuxt, NuxtDebugModuleMutationRecord } from 'nuxt/schema';
5
5
  import { Import, UnimportMeta } from 'unimport';
6
6
  import { RouteRecordNormalized } from 'vue-router';
7
7
  import { Nitro, StorageMounts } from 'nitropack';
@@ -137,6 +137,51 @@ interface ModuleBuiltinTab {
137
137
  type ModuleTabInfo = ModuleCustomTab | ModuleBuiltinTab;
138
138
  type CategorizedTabs = [TabCategory, (ModuleCustomTab | ModuleBuiltinTab)[]][];
139
139
 
140
+ /**
141
+ * Severity level of a notification, mirroring devframe's message levels.
142
+ *
143
+ * Determines the color/icon of the entry in the Vite DevTools **Messages** dock
144
+ * and its toast.
145
+ */
146
+ type NuxtDevtoolsNotifyLevel = DevToolsMessageLevel;
147
+ /**
148
+ * A Nuxt-friendly subset of devframe's `DevframeMessageEntryInput`.
149
+ *
150
+ * This is the input accepted by the `devtools:notify` Nuxt hook, the `notify`
151
+ * RPC function and the injected client's `notify()` — all of which forward to
152
+ * the connected `ctx.messages` host so notifications flow through the single
153
+ * devframe Messages system (persistent dock list + toast overlay).
154
+ *
155
+ * Tiers are expressed through the flags below:
156
+ * - **Ephemeral** (toast-only feedback like "Copied!"): `notify: true` with an
157
+ * `autoDismiss` (toast lifetime) and `autoDelete` (entry lifetime) so it never
158
+ * builds up history in the Messages dock.
159
+ * - **Persistent** (server-originated, leveled): omit `autoDelete` so the entry
160
+ * is kept in the Messages dock list.
161
+ */
162
+ interface NuxtDevtoolsNotifyInput {
163
+ /** Short title / summary of the message. */
164
+ message: string;
165
+ /** Severity level. Defaults to `'info'`. */
166
+ level?: NuxtDevtoolsNotifyLevel;
167
+ /** Optional detailed description or explanation. */
168
+ description?: string;
169
+ /** Optional tags/labels for filtering in the Messages dock. */
170
+ labels?: string[];
171
+ /** Optional grouping category (e.g. `'build'`, `'lint'`, `'runtime'`). */
172
+ category?: string;
173
+ /** Optional source file position (e.g. for a build/lint error). */
174
+ filePosition?: DevToolsMessageFilePosition;
175
+ /** Optional stack trace string. */
176
+ stacktrace?: string;
177
+ /** Whether this message should also appear as a transient toast. */
178
+ notify?: boolean;
179
+ /** Time in ms to auto-dismiss the toast (client-side). */
180
+ autoDismiss?: number;
181
+ /** Time in ms to auto-delete the entry from the persistent list (server-side). */
182
+ autoDelete?: number;
183
+ }
184
+
140
185
  interface HookInfo {
141
186
  name: string;
142
187
  start: number;
@@ -380,7 +425,14 @@ interface ModuleOptions {
380
425
  */
381
426
  viteInspect?: boolean;
382
427
  /**
383
- * @deprecated Auth is now handled by Vite DevTools. This option is ignored.
428
+ * Disable the DevTools client authorization prompt, allowing any browser to
429
+ * connect without approving it first.
430
+ *
431
+ * Defaults to `true` in sandboxed environments (StackBlitz, CodeSandbox).
432
+ *
433
+ * Note: disabling authorization lets any browser (including other devices, if
434
+ * you expose the dev server to your LAN/WAN) connect to DevTools and access
435
+ * your server and filesystem. Only disable it in trusted environments.
384
436
  */
385
437
  disableAuthorization?: boolean;
386
438
  /**
@@ -547,55 +599,23 @@ interface AnalyzeBuildMeta extends NuxtAnalyzeMeta {
547
599
  }
548
600
  interface AnalyzeBuildsInfo {
549
601
  isBuilding: boolean;
550
- builds: AnalyzeBuildMeta[];
551
- }
552
-
553
- interface TerminalBase {
554
- id: string;
555
- name: string;
556
- description?: string;
557
- icon?: string;
558
- }
559
- type TerminalAction = 'restart' | 'terminate' | 'clear' | 'remove';
560
- interface SubprocessOptions {
561
- command: string;
562
- args?: string[];
563
- cwd?: string;
564
- env?: Record<string, string | undefined>;
565
- nodeOptions?: SpawnOptions;
566
- }
567
- interface TerminalInfo extends TerminalBase {
568
- /**
569
- * Whether the terminal can be restarted
570
- */
571
- restartable?: boolean;
572
- /**
573
- * Whether the terminal can be terminated
574
- */
575
- terminatable?: boolean;
576
- /**
577
- * Whether the terminal is terminated
578
- */
579
- isTerminated?: boolean;
580
- /**
581
- * Content buffer
582
- */
583
- buffer?: string;
584
- }
585
- interface TerminalState extends TerminalInfo {
586
602
  /**
587
- * User action to restart the terminal, when not provided, this action will be disabled
603
+ * Unique id of the terminal session for the build currently in flight, or
604
+ * `undefined` when idle. The client reveals this session and derives its
605
+ * "Building…" state from it instead of an `onTerminalExit` broadcast.
588
606
  */
589
- onActionRestart?: () => Promise<void> | void;
590
- /**
591
- * User action to terminate the terminal, when not provided, this action will be disabled
592
- */
593
- onActionTerminate?: () => Promise<void> | void;
607
+ activeSessionId?: string;
608
+ builds: AnalyzeBuildMeta[];
594
609
  }
595
610
 
596
611
  interface ServerFunctions {
597
612
  getServerConfig: () => NuxtOptions;
598
613
  getServerDebugContext: () => Promise<ServerDebugContext | undefined>;
614
+ /**
615
+ * @deprecated Replaced by the Data Inspector panel's live `Nuxt Application`
616
+ * source. Kept as a compatibility shim (emits `NDT_DEP_0009`) for one
617
+ * migration window and will be removed in a future major.
618
+ */
599
619
  getServerData: () => Promise<NuxtServerData>;
600
620
  getServerRuntimeConfig: () => Record<string, any>;
601
621
  getModuleOptions: () => ModuleOptions;
@@ -618,9 +638,7 @@ interface ServerFunctions {
618
638
  runNpmCommand: (command: NpmCommandType, packageName: string, options?: NpmCommandOptions) => Promise<{
619
639
  processId: string;
620
640
  } | undefined>;
621
- getTerminals: () => TerminalInfo[];
622
- getTerminalDetail: (id: string) => Promise<TerminalInfo | undefined>;
623
- runTerminalAction: (id: string, action: TerminalAction) => Promise<boolean>;
641
+ revealTerminal: (id: string) => Promise<boolean>;
624
642
  getStorageMounts: () => Promise<StorageMounts>;
625
643
  getStorageKeys: (base?: string) => Promise<string[]>;
626
644
  getStorageItem: (key: string) => Promise<StorageValue>;
@@ -635,13 +653,14 @@ interface ServerFunctions {
635
653
  writeStaticAssets: (file: AssetEntry[], folder: string) => Promise<string[]>;
636
654
  deleteStaticAsset: (filepath: string) => Promise<void>;
637
655
  renameStaticAsset: (oldPath: string, newPath: string) => Promise<void>;
656
+ notify: (input: NuxtDevtoolsNotifyInput) => Promise<void>;
638
657
  telemetryEvent: (payload: object, immediate?: boolean) => void;
639
658
  customTabAction: (name: string, action: number) => Promise<boolean>;
640
659
  enablePages: () => Promise<void>;
641
660
  openInEditor: (filepath: string) => Promise<boolean>;
642
661
  restartNuxt: (hard?: boolean) => Promise<void>;
643
- installNuxtModule: (name: string, dry?: boolean) => Promise<InstallModuleReturn>;
644
- uninstallNuxtModule: (name: string, dry?: boolean) => Promise<InstallModuleReturn>;
662
+ installNuxtModule: (name: string, dry?: boolean, sessionId?: string) => Promise<InstallModuleReturn>;
663
+ uninstallNuxtModule: (name: string, dry?: boolean, sessionId?: string) => Promise<InstallModuleReturn>;
645
664
  enableTimeline: (dry: boolean) => Promise<[string, string]>;
646
665
  requestForAuth: (info?: string, origin?: string) => Promise<void>;
647
666
  verifyAuthToken: () => Promise<boolean>;
@@ -650,15 +669,23 @@ interface ClientFunctions {
650
669
  refresh: (event: ClientUpdateEvent) => void;
651
670
  callHook: (hook: string, ...args: any[]) => Promise<void>;
652
671
  navigateTo: (path: string) => void;
653
- onTerminalData: (_: {
654
- id: string;
655
- data: string;
656
- }) => void;
672
+ /**
673
+ * Minimal server→client completion signal for generic package updates only
674
+ * (`runNpmCommand`): the run RPC returns before the process exits, so this
675
+ * lets `usePackageUpdate` and the restart prompt settle once it finishes. It
676
+ * carries only `{ id, code }` and is not a terminal-data transport. Module
677
+ * install/uninstall and analyze-build no longer rely on it — they clear their
678
+ * UI from the awaited RPC / refreshed info instead.
679
+ */
657
680
  onTerminalExit: (_: {
658
681
  id: string;
659
682
  code?: number;
660
683
  }) => void;
661
684
  }
685
+ /**
686
+ * @deprecated The payload of the deprecated {@link ServerFunctions.getServerData}
687
+ * shim. Use the Data Inspector panel's live `Nuxt Application` source instead.
688
+ */
662
689
  interface NuxtServerData {
663
690
  nuxt: NuxtOptions;
664
691
  nitro?: Nitro['options'];
@@ -670,13 +697,16 @@ interface NuxtServerData {
670
697
  type ClientUpdateEvent = keyof ServerFunctions;
671
698
 
672
699
  /**
673
- * Compatibility RPC interface that supports broadcast and function access.
674
- * Backed by Vite DevTools Kit's RpcFunctionsHost internally.
700
+ * Legacy Nuxt DevTools RPC compatibility surface exposed on `nuxt.devtools.rpc`.
701
+ *
702
+ * For new integrations prefer {@link onDevtoolsReady}, where the connected
703
+ * `ViteDevToolsNodeContext` gives you the full devframe `ctx.rpc`
704
+ * (`register`/`invokeLocal`/`broadcast`/`sharedState`/…).
675
705
  */
676
706
  interface NuxtDevtoolsRpc {
677
707
  /**
678
708
  * Broadcast proxy for calling client functions.
679
- * Supports `rpc.broadcast.refresh.asEvent(event)` pattern for backward compatibility.
709
+ * Supports `rpc.broadcast.refresh.asEvent(event)` for backward compatibility.
680
710
  */
681
711
  broadcast: {
682
712
  [K in keyof ClientFunctions]: ClientFunctions[K] & {
@@ -684,7 +714,7 @@ interface NuxtDevtoolsRpc {
684
714
  };
685
715
  };
686
716
  /**
687
- * Proxy for accessing server functions locally.
717
+ * Proxy for reading/writing server functions locally.
688
718
  */
689
719
  functions: ServerFunctions;
690
720
  }
@@ -696,9 +726,14 @@ interface NuxtDevtoolsServerContext {
696
726
  options: ModuleOptions;
697
727
  rpc: NuxtDevtoolsRpc;
698
728
  /**
699
- * The Vite DevTools Kit context, available after connection.
729
+ * The connected Vite DevTools kit context (`docks`/`terminals`/`messages`/
730
+ * `commands`/`rpc`/`diagnostics`/…).
731
+ *
732
+ * This is the raw escape hatch and is `undefined` until the Vite DevTools
733
+ * plugin connects. Prefer {@link onDevtoolsReady}, which hands you the
734
+ * connected context.
700
735
  */
701
- devtoolsKit: DevToolsNodeContext | undefined;
736
+ devtoolsKit: ViteDevToolsNodeContext | undefined;
702
737
  /**
703
738
  * Hook to open file in editor
704
739
  */
@@ -707,6 +742,19 @@ interface NuxtDevtoolsServerContext {
707
742
  * Invalidate client cache for a function and ask for re-fetching
708
743
  */
709
744
  refresh: (event: keyof ServerFunctions) => void;
745
+ /**
746
+ * Push a notification through the devframe Messages system (`ctx.messages`).
747
+ *
748
+ * The connected messages host surfaces it in the Vite DevTools **Messages**
749
+ * dock and/or as a toast. Calls made before the kit connects are buffered and
750
+ * replayed on connect. Used by the `devtools:notify` hook, the `notify` RPC
751
+ * function and the curated built-in notification sources.
752
+ */
753
+ notify: (input: NuxtDevtoolsNotifyInput) => void;
754
+ /**
755
+ * @deprecated Use the Vite DevTools RPC registration instead:
756
+ * `nuxt.devtools.rpc.register(defineRpcFunction(...))`. Kept working as a shim.
757
+ */
710
758
  extendServerRpc: <ClientFunctions extends object = Record<string, unknown>, ServerFunctions extends object = Record<string, unknown>>(name: string, functions: ServerFunctions) => BirpcGroup<ClientFunctions, ServerFunctions>;
711
759
  }
712
760
  interface NuxtDevtoolsInfo {
@@ -726,6 +774,64 @@ interface ServerDebugContext {
726
774
  moduleMutationRecords: ServerDebugModuleMutationRecord[];
727
775
  }
728
776
 
777
+ interface TerminalBase {
778
+ id: string;
779
+ name: string;
780
+ description?: string;
781
+ icon?: string;
782
+ }
783
+ type TerminalAction = 'restart' | 'terminate' | 'clear' | 'remove';
784
+ interface SubprocessOptions {
785
+ command: string;
786
+ args?: string[];
787
+ cwd?: string;
788
+ env?: Record<string, string | undefined>;
789
+ nodeOptions?: SpawnOptions;
790
+ }
791
+ interface TerminalInfo extends TerminalBase {
792
+ /**
793
+ * Whether the terminal can be restarted.
794
+ *
795
+ * @deprecated Ignored since v4: legacy terminals are bridged onto the built-in
796
+ * Terminals dock as read-only, output-only sessions, so Devframe shows no
797
+ * restart control. Restart a `startSubprocess()`-owned process through its
798
+ * returned handle instead. Will be removed in v5.
799
+ */
800
+ restartable?: boolean;
801
+ /**
802
+ * Whether the terminal can be terminated.
803
+ *
804
+ * @deprecated Ignored since v4 (see {@link TerminalInfo.restartable}). Will be
805
+ * removed in v5.
806
+ */
807
+ terminatable?: boolean;
808
+ /**
809
+ * Whether the terminal is terminated
810
+ */
811
+ isTerminated?: boolean;
812
+ /**
813
+ * Content buffer
814
+ */
815
+ buffer?: string;
816
+ }
817
+ interface TerminalState extends TerminalInfo {
818
+ /**
819
+ * User action to restart the terminal, when not provided, this action will be disabled.
820
+ *
821
+ * @deprecated Ignored since v4: the bridge to the built-in Terminals dock
822
+ * cannot attach action callbacks to an externally registered session. Will be
823
+ * removed in v5.
824
+ */
825
+ onActionRestart?: () => Promise<void> | void;
826
+ /**
827
+ * User action to terminate the terminal, when not provided, this action will be disabled.
828
+ *
829
+ * @deprecated Ignored since v4 (see {@link TerminalState.onActionRestart}).
830
+ * Will be removed in v5.
831
+ */
832
+ onActionTerminate?: () => Promise<void> | void;
833
+ }
834
+
729
835
  declare module '@nuxt/schema' {
730
836
  interface NuxtHooks {
731
837
  /**
@@ -736,6 +842,30 @@ declare module '@nuxt/schema' {
736
842
  * Called after devtools is initialized.
737
843
  */
738
844
  'devtools:initialized': (info: NuxtDevtoolsInfo) => void;
845
+ /**
846
+ * Called once the Vite DevTools kit has connected, with the connected
847
+ * `ViteDevToolsNodeContext`.
848
+ *
849
+ * This is the recommended place to do all DevTools integration
850
+ * (registering docks, terminals, messages, commands, RPC functions,
851
+ * diagnostics, …): the kit is guaranteed to be available here, so you don't
852
+ * need the connect-safe accessors on `nuxt.devtools`.
853
+ */
854
+ 'devtools:ready': (ctx: ViteDevToolsNodeContext) => void | Promise<void>;
855
+ /**
856
+ * Push a notification through the devframe Messages system.
857
+ *
858
+ * Forwarded to the connected `ctx.messages` host, so it surfaces in the
859
+ * Vite DevTools **Messages** dock (persistent, when leveled) and/or as a
860
+ * transient toast (when `notify` is set). Calls made before the kit connects
861
+ * are buffered and replayed once it does.
862
+ *
863
+ * @example
864
+ * ```ts
865
+ * nuxt.callHook('devtools:notify', { message: 'Build failed', level: 'error' })
866
+ * ```
867
+ */
868
+ 'devtools:notify': (input: NuxtDevtoolsNotifyInput) => void;
739
869
  /**
740
870
  * Hooks to extend devtools tabs.
741
871
  */
@@ -745,7 +875,11 @@ declare module '@nuxt/schema' {
745
875
  */
746
876
  'devtools:customTabs:refresh': () => void;
747
877
  /**
748
- * Register a terminal.
878
+ * Register a terminal whose process is owned by the caller (module).
879
+ *
880
+ * The registered session is surfaced **read-only** in the built-in Vite
881
+ * DevTools **Terminals** dock; stream output into it via
882
+ * `devtools:terminal:write`.
749
883
  */
750
884
  'devtools:terminal:register': (terminal: TerminalState) => void;
751
885
  /**
@@ -774,19 +908,5 @@ declare module '@nuxt/schema' {
774
908
  }) => void;
775
909
  }
776
910
  }
777
- declare module '@nuxt/schema' {
778
- /**
779
- * Runtime Hooks
780
- */
781
- interface RuntimeNuxtHooks {
782
- /**
783
- * On terminal data.
784
- */
785
- 'devtools:terminal:data': (payload: {
786
- id: string;
787
- data: string;
788
- }) => void;
789
- }
790
- }
791
911
 
792
- export type { ServerFunctions as $, AnalyzeBuildMeta as A, BasicModuleInfo as B, CategorizedTabs as C, ModuleType as D, ModuleVNodeView as E, ModuleView as F, GitHubContributor as G, HookInfo as H, ImageMeta as I, NpmCommandType as J, NuxtDevToolsOptions as K, LoadingTimeMetric as L, MaintainerInfo as M, NpmCommandOptions as N, NuxtDevtoolsInfo as O, NuxtDevtoolsRpc as P, NuxtDevtoolsServerContext as Q, NuxtServerData as R, PackageManagerName as S, PackageUpdateInfo as T, Payload as U, PluginInfoWithMetic as V, PluginMetric as W, RouteInfo as X, ScannedNitroTasks as Y, ServerDebugContext as Z, ServerDebugModuleMutationRecord as _, AnalyzeBuildsInfo as a, ServerRouteInfo as a0, ServerRouteInput as a1, ServerRouteInputType as a2, ServerTaskInfo as a3, SubprocessOptions as a4, TabCategory as a5, TerminalAction as a6, TerminalBase as a7, TerminalInfo as a8, TerminalState as a9, VSCodeIntegrationOptions as aa, VSCodeTunnelOptions as ab, VueInspectorClient as ac, VueInspectorData as ad, AssetEntry as b, AssetInfo as c, AssetType as d, AutoImportsWithMetadata as e, ClientFunctions as f, ClientUpdateEvent as g, CodeServerOptions as h, CodeServerType as i, CodeSnippet as j, CompatibilityStatus as k, ComponentRelationship as l, ComponentWithRelationships as m, InstallModuleReturn as n, InstalledModuleInfo as o, ModuleBuiltinTab as p, ModuleCompatibility as q, ModuleCustomTab as r, ModuleIframeTabLazyOptions as s, ModuleIframeView as t, ModuleLaunchAction as u, ModuleLaunchView as v, ModuleOptions as w, ModuleStaticInfo as x, ModuleStats as y, ModuleTabInfo as z };
912
+ 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, CodeServerOptions 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 };