@nuxt/devtools-kit 4.0.0-alpha.1 → 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.
- package/dist/index.cjs +135 -1
- package/dist/index.d.cts +248 -9
- package/dist/index.d.mts +248 -9
- package/dist/index.d.ts +248 -9
- package/dist/index.mjs +126 -2
- package/dist/runtime/iframe-client.d.ts +18 -0
- package/dist/runtime/iframe-client.mjs +7 -0
- package/dist/shared/{devtools-kit.f1VcjZlm.d.cts → devtools-kit.DepvFgru.d.cts} +283 -109
- package/dist/shared/{devtools-kit.f1VcjZlm.d.mts → devtools-kit.DepvFgru.d.mts} +283 -109
- package/dist/shared/{devtools-kit.f1VcjZlm.d.ts → devtools-kit.DepvFgru.d.ts} +283 -109
- package/dist/types.d.cts +37 -8
- package/dist/types.d.mts +37 -8
- package/dist/types.d.ts +37 -8
- package/package.json +21 -8
|
@@ -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,
|
|
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 { Nitro as Nitro$1, StorageMounts as StorageMounts$1 } from 'nitro/types';
|
|
11
|
+
import { Nitro, StorageMounts } from 'nitropack';
|
|
10
12
|
import { SpawnOptions } from 'node:child_process';
|
|
11
13
|
|
|
12
|
-
type TabCategory = 'pinned' | 'app' | '
|
|
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;
|
|
@@ -337,13 +385,8 @@ interface ComponentWithRelationships {
|
|
|
337
385
|
dependencies?: string[];
|
|
338
386
|
dependents?: string[];
|
|
339
387
|
}
|
|
340
|
-
interface CodeServerOptions {
|
|
341
|
-
codeBinary: string;
|
|
342
|
-
launchArg: string;
|
|
343
|
-
licenseTermsArg: string;
|
|
344
|
-
connectionTokenArg: string;
|
|
345
|
-
}
|
|
346
388
|
|
|
389
|
+
/** @deprecated Part of the removed `vscode` integration. */
|
|
347
390
|
type CodeServerType = 'ms-code-cli' | 'ms-code-server' | 'coder-code-server';
|
|
348
391
|
interface ModuleOptions {
|
|
349
392
|
/**
|
|
@@ -358,8 +401,12 @@ interface ModuleOptions {
|
|
|
358
401
|
* This is in static format, for dynamic injection, call `nuxt.hook('devtools:customTabs')` instead
|
|
359
402
|
*/
|
|
360
403
|
customTabs?: ModuleCustomTab[];
|
|
404
|
+
/** Code Server integration options. */
|
|
405
|
+
codeServer?: CodeServerIntegrationOptions;
|
|
361
406
|
/**
|
|
362
|
-
* VS Code Server integration options.
|
|
407
|
+
* Legacy VS Code Server integration options.
|
|
408
|
+
*
|
|
409
|
+
* @deprecated Use `codeServer`. Legacy modes are no longer supported.
|
|
363
410
|
*/
|
|
364
411
|
vscode?: VSCodeIntegrationOptions;
|
|
365
412
|
/**
|
|
@@ -369,22 +416,25 @@ interface ModuleOptions {
|
|
|
369
416
|
*/
|
|
370
417
|
componentInspector?: boolean;
|
|
371
418
|
/**
|
|
372
|
-
* Enable
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
*
|
|
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.
|
|
377
425
|
*
|
|
378
426
|
* @default true
|
|
379
427
|
*/
|
|
380
428
|
viteInspect?: boolean;
|
|
381
429
|
/**
|
|
382
|
-
* Disable
|
|
430
|
+
* Disable the DevTools client authorization prompt, allowing any browser to
|
|
431
|
+
* connect without approving it first.
|
|
383
432
|
*
|
|
384
|
-
*
|
|
433
|
+
* Defaults to `true` in sandboxed environments (StackBlitz, CodeSandbox).
|
|
385
434
|
*
|
|
386
|
-
*
|
|
387
|
-
*
|
|
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.
|
|
388
438
|
*/
|
|
389
439
|
disableAuthorization?: boolean;
|
|
390
440
|
/**
|
|
@@ -446,6 +496,31 @@ interface ModuleOptions {
|
|
|
446
496
|
*/
|
|
447
497
|
telemetry?: boolean;
|
|
448
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}. */
|
|
449
524
|
interface VSCodeIntegrationOptions {
|
|
450
525
|
/**
|
|
451
526
|
* Enable VS Code Server integration
|
|
@@ -491,6 +566,7 @@ interface VSCodeIntegrationOptions {
|
|
|
491
566
|
*/
|
|
492
567
|
host?: string;
|
|
493
568
|
}
|
|
569
|
+
/** @deprecated Tunnels are not supported by the Code Server integration. */
|
|
494
570
|
interface VSCodeTunnelOptions {
|
|
495
571
|
/**
|
|
496
572
|
* the machine name for port forwarding service
|
|
@@ -513,13 +589,10 @@ interface NuxtDevToolsOptions {
|
|
|
513
589
|
componentsView: 'list' | 'graph';
|
|
514
590
|
hiddenTabCategories: string[];
|
|
515
591
|
hiddenTabs: string[];
|
|
516
|
-
interactionCloseOnOutsideClick: boolean;
|
|
517
592
|
pinnedTabs: string[];
|
|
518
593
|
scale: number;
|
|
519
594
|
showExperimentalFeatures: boolean;
|
|
520
595
|
showHelpButtons: boolean;
|
|
521
|
-
sidebarExpanded: boolean;
|
|
522
|
-
sidebarScrollable: boolean;
|
|
523
596
|
};
|
|
524
597
|
serverRoutes: {
|
|
525
598
|
selectedRoute: ServerRouteInfo | null;
|
|
@@ -551,56 +624,38 @@ interface AnalyzeBuildMeta extends NuxtAnalyzeMeta {
|
|
|
551
624
|
}
|
|
552
625
|
interface AnalyzeBuildsInfo {
|
|
553
626
|
isBuilding: boolean;
|
|
554
|
-
builds: AnalyzeBuildMeta[];
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
interface TerminalBase {
|
|
558
|
-
id: string;
|
|
559
|
-
name: string;
|
|
560
|
-
description?: string;
|
|
561
|
-
icon?: string;
|
|
562
|
-
}
|
|
563
|
-
type TerminalAction = 'restart' | 'terminate' | 'clear' | 'remove';
|
|
564
|
-
interface SubprocessOptions {
|
|
565
|
-
command: string;
|
|
566
|
-
args?: string[];
|
|
567
|
-
cwd?: string;
|
|
568
|
-
env?: Record<string, string | undefined>;
|
|
569
|
-
nodeOptions?: SpawnOptions;
|
|
570
|
-
}
|
|
571
|
-
interface TerminalInfo extends TerminalBase {
|
|
572
|
-
/**
|
|
573
|
-
* Whether the terminal can be restarted
|
|
574
|
-
*/
|
|
575
|
-
restartable?: boolean;
|
|
576
|
-
/**
|
|
577
|
-
* Whether the terminal can be terminated
|
|
578
|
-
*/
|
|
579
|
-
terminatable?: boolean;
|
|
580
|
-
/**
|
|
581
|
-
* Whether the terminal is terminated
|
|
582
|
-
*/
|
|
583
|
-
isTerminated?: boolean;
|
|
584
|
-
/**
|
|
585
|
-
* Content buffer
|
|
586
|
-
*/
|
|
587
|
-
buffer?: string;
|
|
588
|
-
}
|
|
589
|
-
interface TerminalState extends TerminalInfo {
|
|
590
627
|
/**
|
|
591
|
-
*
|
|
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.
|
|
592
631
|
*/
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
* User action to terminate the terminal, when not provided, this action will be disabled
|
|
596
|
-
*/
|
|
597
|
-
onActionTerminate?: () => Promise<void> | void;
|
|
632
|
+
activeSessionId?: string;
|
|
633
|
+
builds: AnalyzeBuildMeta[];
|
|
598
634
|
}
|
|
599
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
|
+
|
|
600
650
|
interface ServerFunctions {
|
|
601
651
|
getServerConfig: () => NuxtOptions;
|
|
602
652
|
getServerDebugContext: () => Promise<ServerDebugContext | undefined>;
|
|
603
|
-
|
|
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>;
|
|
604
659
|
getServerRuntimeConfig: () => Record<string, any>;
|
|
605
660
|
getModuleOptions: () => ModuleOptions;
|
|
606
661
|
getComponents: () => Component[];
|
|
@@ -619,53 +674,60 @@ interface ServerFunctions {
|
|
|
619
674
|
clearOptions: () => Promise<void>;
|
|
620
675
|
checkForUpdateFor: (name: string) => Promise<PackageUpdateInfo | undefined>;
|
|
621
676
|
getNpmCommand: (command: NpmCommandType, packageName: string, options?: NpmCommandOptions) => Promise<string[] | undefined>;
|
|
622
|
-
runNpmCommand: (
|
|
677
|
+
runNpmCommand: (command: NpmCommandType, packageName: string, options?: NpmCommandOptions) => Promise<{
|
|
623
678
|
processId: string;
|
|
624
679
|
} | undefined>;
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
runTerminalAction: (token: string, id: string, action: TerminalAction) => Promise<boolean>;
|
|
628
|
-
getStorageMounts: () => Promise<StorageMounts>;
|
|
680
|
+
revealTerminal: (id: string) => Promise<boolean>;
|
|
681
|
+
getStorageMounts: () => Promise<AnyStorageMounts>;
|
|
629
682
|
getStorageKeys: (base?: string) => Promise<string[]>;
|
|
630
|
-
getStorageItem: (
|
|
631
|
-
setStorageItem: (
|
|
632
|
-
removeStorageItem: (
|
|
683
|
+
getStorageItem: (key: string) => Promise<StorageValue>;
|
|
684
|
+
setStorageItem: (key: string, value: StorageValue) => Promise<void>;
|
|
685
|
+
removeStorageItem: (key: string) => Promise<void>;
|
|
633
686
|
getAnalyzeBuildInfo: () => Promise<AnalyzeBuildsInfo>;
|
|
634
687
|
generateAnalyzeBuildName: () => Promise<string>;
|
|
635
|
-
startAnalyzeBuild: (
|
|
636
|
-
clearAnalyzeBuilds: (
|
|
637
|
-
getImageMeta: (
|
|
638
|
-
getTextAssetContent: (
|
|
639
|
-
writeStaticAssets: (
|
|
640
|
-
deleteStaticAsset: (
|
|
641
|
-
renameStaticAsset: (
|
|
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>;
|
|
642
696
|
telemetryEvent: (payload: object, immediate?: boolean) => void;
|
|
643
697
|
customTabAction: (name: string, action: number) => Promise<boolean>;
|
|
644
|
-
enablePages: (
|
|
698
|
+
enablePages: () => Promise<void>;
|
|
645
699
|
openInEditor: (filepath: string) => Promise<boolean>;
|
|
646
|
-
restartNuxt: (
|
|
647
|
-
installNuxtModule: (
|
|
648
|
-
uninstallNuxtModule: (
|
|
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>;
|
|
649
703
|
enableTimeline: (dry: boolean) => Promise<[string, string]>;
|
|
650
704
|
requestForAuth: (info?: string, origin?: string) => Promise<void>;
|
|
651
|
-
verifyAuthToken: (
|
|
705
|
+
verifyAuthToken: () => Promise<boolean>;
|
|
652
706
|
}
|
|
653
707
|
interface ClientFunctions {
|
|
654
708
|
refresh: (event: ClientUpdateEvent) => void;
|
|
655
709
|
callHook: (hook: string, ...args: any[]) => Promise<void>;
|
|
656
710
|
navigateTo: (path: string) => void;
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
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
|
+
*/
|
|
661
719
|
onTerminalExit: (_: {
|
|
662
720
|
id: string;
|
|
663
721
|
code?: number;
|
|
664
722
|
}) => void;
|
|
665
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
|
+
*/
|
|
666
728
|
interface NuxtServerData {
|
|
667
729
|
nuxt: NuxtOptions;
|
|
668
|
-
nitro?:
|
|
730
|
+
nitro?: AnyNitro['options'];
|
|
669
731
|
vite: {
|
|
670
732
|
server?: ResolvedConfig;
|
|
671
733
|
client?: ResolvedConfig;
|
|
@@ -673,13 +735,44 @@ interface NuxtServerData {
|
|
|
673
735
|
}
|
|
674
736
|
type ClientUpdateEvent = keyof ServerFunctions;
|
|
675
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
|
+
}
|
|
676
760
|
/**
|
|
677
761
|
* @internal
|
|
678
762
|
*/
|
|
679
763
|
interface NuxtDevtoolsServerContext {
|
|
680
764
|
nuxt: Nuxt;
|
|
681
765
|
options: ModuleOptions;
|
|
682
|
-
rpc:
|
|
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;
|
|
683
776
|
/**
|
|
684
777
|
* Hook to open file in editor
|
|
685
778
|
*/
|
|
@@ -689,9 +782,18 @@ interface NuxtDevtoolsServerContext {
|
|
|
689
782
|
*/
|
|
690
783
|
refresh: (event: keyof ServerFunctions) => void;
|
|
691
784
|
/**
|
|
692
|
-
*
|
|
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.
|
|
693
796
|
*/
|
|
694
|
-
ensureDevAuthToken: (token: string) => Promise<void>;
|
|
695
797
|
extendServerRpc: <ClientFunctions extends object = Record<string, unknown>, ServerFunctions extends object = Record<string, unknown>>(name: string, functions: ServerFunctions) => BirpcGroup<ClientFunctions, ServerFunctions>;
|
|
696
798
|
}
|
|
697
799
|
interface NuxtDevtoolsInfo {
|
|
@@ -711,6 +813,64 @@ interface ServerDebugContext {
|
|
|
711
813
|
moduleMutationRecords: ServerDebugModuleMutationRecord[];
|
|
712
814
|
}
|
|
713
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
|
+
|
|
714
874
|
declare module '@nuxt/schema' {
|
|
715
875
|
interface NuxtHooks {
|
|
716
876
|
/**
|
|
@@ -721,6 +881,30 @@ declare module '@nuxt/schema' {
|
|
|
721
881
|
* Called after devtools is initialized.
|
|
722
882
|
*/
|
|
723
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;
|
|
724
908
|
/**
|
|
725
909
|
* Hooks to extend devtools tabs.
|
|
726
910
|
*/
|
|
@@ -730,7 +914,11 @@ declare module '@nuxt/schema' {
|
|
|
730
914
|
*/
|
|
731
915
|
'devtools:customTabs:refresh': () => void;
|
|
732
916
|
/**
|
|
733
|
-
* 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`.
|
|
734
922
|
*/
|
|
735
923
|
'devtools:terminal:register': (terminal: TerminalState) => void;
|
|
736
924
|
/**
|
|
@@ -759,19 +947,5 @@ declare module '@nuxt/schema' {
|
|
|
759
947
|
}) => void;
|
|
760
948
|
}
|
|
761
949
|
}
|
|
762
|
-
declare module '@nuxt/schema' {
|
|
763
|
-
/**
|
|
764
|
-
* Runtime Hooks
|
|
765
|
-
*/
|
|
766
|
-
interface RuntimeNuxtHooks {
|
|
767
|
-
/**
|
|
768
|
-
* On terminal data.
|
|
769
|
-
*/
|
|
770
|
-
'devtools:terminal:data': (payload: {
|
|
771
|
-
id: string;
|
|
772
|
-
data: string;
|
|
773
|
-
}) => void;
|
|
774
|
-
}
|
|
775
|
-
}
|
|
776
950
|
|
|
777
|
-
export type {
|
|
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 };
|
package/dist/types.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { A as AnalyzeBuildMeta,
|
|
3
|
-
import {
|
|
1
|
+
import { b as ServerFunctions, c as NuxtDevtoolsNotifyInput, H as HookInfo, P as PluginMetric, L as LoadingTimeMetric } from './shared/devtools-kit.DepvFgru.cjs';
|
|
2
|
+
export { A as AnalyzeBuildMeta, d as AnalyzeBuildsInfo, e as AssetEntry, f as AssetInfo, g as AssetType, h as AutoImportsWithMetadata, B as BasicModuleInfo, C as CategorizedTabs, i as ClientFunctions, j as ClientUpdateEvent, k as CodeServerIntegrationOptions, l as CodeServerType, m as CodeSnippet, n as CompatibilityStatus, o as ComponentRelationship, p as ComponentWithRelationships, G as GitHubContributor, I as ImageMeta, q as InstallModuleReturn, r as InstalledModuleInfo, s as MaintainerInfo, t as ModuleBuiltinTab, u as ModuleCompatibility, M as ModuleCustomTab, v as ModuleIframeTabLazyOptions, w as ModuleIframeView, x as ModuleLaunchAction, y as ModuleLaunchView, z as ModuleOptions, D as ModuleStaticInfo, E as ModuleStats, F as ModuleTabInfo, J as ModuleType, K as ModuleVNodeView, O as ModuleView, Q as NpmCommandOptions, R as NpmCommandType, U as NuxtDevToolsOptions, a as NuxtDevtoolsInfo, V as NuxtDevtoolsNotifyLevel, W as NuxtDevtoolsRpc, N as NuxtDevtoolsServerContext, X as NuxtServerData, Y as PackageManagerName, Z as PackageUpdateInfo, _ as Payload, $ as PluginInfoWithMetic, a0 as RouteInfo, a1 as ScannedNitroTasks, a2 as ServerDebugContext, a3 as ServerDebugModuleMutationRecord, a4 as ServerRouteInfo, a5 as ServerRouteInput, a6 as ServerRouteInputType, a7 as ServerTaskInfo, S as SubprocessOptions, a8 as TabCategory, a9 as TerminalAction, aa as TerminalBase, ab as TerminalInfo, T as TerminalState, ac as VSCodeIntegrationOptions, ad as VSCodeTunnelOptions, ae as VueInspectorClient, af as VueInspectorData } from './shared/devtools-kit.DepvFgru.cjs';
|
|
3
|
+
import { DevToolsRpcClient } from '@vitejs/devtools-kit/client';
|
|
4
4
|
import { Hookable } from 'hookable';
|
|
5
5
|
import { NuxtApp } from 'nuxt/app';
|
|
6
6
|
import { AppConfig } from 'nuxt/schema';
|
|
@@ -8,12 +8,15 @@ import { $Fetch } from 'ofetch';
|
|
|
8
8
|
import { BuiltinLanguage } from 'shiki';
|
|
9
9
|
import { Ref } from 'vue';
|
|
10
10
|
import { StackFrame } from 'error-stack-parser-es';
|
|
11
|
+
import '@vitejs/devtools-kit';
|
|
12
|
+
import 'birpc';
|
|
11
13
|
import 'unimport';
|
|
12
14
|
import 'vue-router';
|
|
13
|
-
import 'nitropack';
|
|
14
15
|
import 'unstorage';
|
|
15
16
|
import 'vite';
|
|
16
17
|
import '@nuxt/schema';
|
|
18
|
+
import 'nitro/types';
|
|
19
|
+
import 'nitropack';
|
|
17
20
|
import 'node:child_process';
|
|
18
21
|
|
|
19
22
|
interface TimelineEventFunction {
|
|
@@ -149,15 +152,41 @@ interface NuxtDevtoolsHostClient {
|
|
|
149
152
|
interface CodeHighlightOptions {
|
|
150
153
|
grammarContextCode?: string;
|
|
151
154
|
}
|
|
155
|
+
type AsyncServerFunctions = {
|
|
156
|
+
[K in keyof ServerFunctions]: (...args: Parameters<ServerFunctions[K]>) => Promise<Awaited<ReturnType<ServerFunctions[K]>>>;
|
|
157
|
+
};
|
|
152
158
|
interface NuxtDevtoolsClient {
|
|
153
|
-
rpc:
|
|
159
|
+
rpc: AsyncServerFunctions;
|
|
154
160
|
renderCodeHighlight: (code: string, lang?: BuiltinLanguage, options?: CodeHighlightOptions) => {
|
|
155
161
|
code: string;
|
|
156
162
|
supported: boolean;
|
|
157
163
|
};
|
|
158
164
|
renderMarkdown: (markdown: string) => string;
|
|
159
165
|
colorMode: string;
|
|
160
|
-
|
|
166
|
+
/**
|
|
167
|
+
* Push a notification through the devframe Messages system.
|
|
168
|
+
*
|
|
169
|
+
* Routes to the shared Messages host, so it surfaces in the Vite DevTools
|
|
170
|
+
* **Messages** dock and/or as a transient toast (when `notify` is set — the
|
|
171
|
+
* default). Use this from custom tabs / in-client code to give feedback
|
|
172
|
+
* through the same notification system as the rest of DevTools.
|
|
173
|
+
*/
|
|
174
|
+
notify: (input: NuxtDevtoolsNotifyInput) => Promise<void>;
|
|
175
|
+
/**
|
|
176
|
+
* The connected Vite DevTools RPC client, mirroring `nuxt.devtools.devtoolsKit`
|
|
177
|
+
* on the server. Use it for full devframe-native access — register client RPC
|
|
178
|
+
* functions (`devtoolsKit.client.register(...)`), call server functions
|
|
179
|
+
* (`devtoolsKit.call(...)`), shared state, streaming, scoping, etc.
|
|
180
|
+
*
|
|
181
|
+
* `undefined` until the DevTools client has connected.
|
|
182
|
+
*/
|
|
183
|
+
devtoolsKit: DevToolsRpcClient | undefined;
|
|
184
|
+
/**
|
|
185
|
+
* @deprecated Use `onDevtoolsReady((kit) => kit.client.register(...))` from
|
|
186
|
+
* `@nuxt/devtools-kit/iframe-client`, or the exposed `devtoolsKit` client
|
|
187
|
+
* directly (`client.devtools.devtoolsKit?.client.register(...)`).
|
|
188
|
+
*/
|
|
189
|
+
extendClientRpc: <ServerFunctions extends object = Record<string, unknown>, ClientFunctions extends object = Record<string, unknown>>(name: string, functions: ClientFunctions) => ServerFunctions;
|
|
161
190
|
}
|
|
162
191
|
interface NuxtDevtoolsIframeClient {
|
|
163
192
|
host: NuxtDevtoolsHostClient;
|
|
@@ -167,5 +196,5 @@ interface NuxtDevtoolsGlobal {
|
|
|
167
196
|
setClient: (client: NuxtDevtoolsHostClient) => void;
|
|
168
197
|
}
|
|
169
198
|
|
|
170
|
-
export {
|
|
171
|
-
export type { CodeHighlightOptions, DevToolsFrameState, NuxtDevtoolsClient, NuxtDevtoolsClientHooks, NuxtDevtoolsGlobal, NuxtDevtoolsHostClient, NuxtDevtoolsIframeClient, TimelineEvent, TimelineEventFunction, TimelineEventNormalized, TimelineEventRoute, TimelineEventsSegment, TimelineMetrics, TimelineOptions, TimelineServerState };
|
|
199
|
+
export { HookInfo, LoadingTimeMetric, NuxtDevtoolsNotifyInput, PluginMetric, ServerFunctions };
|
|
200
|
+
export type { AsyncServerFunctions, CodeHighlightOptions, DevToolsFrameState, NuxtDevtoolsClient, NuxtDevtoolsClientHooks, NuxtDevtoolsGlobal, NuxtDevtoolsHostClient, NuxtDevtoolsIframeClient, TimelineEvent, TimelineEventFunction, TimelineEventNormalized, TimelineEventRoute, TimelineEventsSegment, TimelineMetrics, TimelineOptions, TimelineServerState };
|