@nuxt/devtools-kit 0.4.6 → 0.5.1

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.
@@ -2,7 +2,7 @@ import { AppConfig } from 'nuxt/schema';
2
2
  import { NuxtApp } from 'nuxt/dist/app/nuxt';
3
3
  import { Hookable } from 'hookable';
4
4
  import { BirpcReturn } from 'birpc';
5
- import { v as VueInspectorData, V as VueInspectorClient, H as HookInfo, q as PluginMetric, F as ServerFunctions } from './rpc-ec33d45e.js';
5
+ import { x as VueInspectorData, V as VueInspectorClient, H as HookInfo, r as PluginMetric, K as ServerFunctions } from './server-ctx-607d5ba8.js';
6
6
 
7
7
  interface NuxtDevtoolsClientHooks {
8
8
  /**
@@ -0,0 +1,64 @@
1
+ import { N as NuxtDevtoolsInfo, M as ModuleCustomTab, T as TerminalState } from './server-ctx-607d5ba8.js';
2
+
3
+ declare module '@nuxt/schema' {
4
+ interface NuxtHooks {
5
+ /**
6
+ * Called before devtools starts. Useful to detect if devtools is enabled.
7
+ */
8
+ 'devtools:before': () => void;
9
+ /**
10
+ * Called after devtools is initialized.
11
+ */
12
+ 'devtools:initialized': (info: NuxtDevtoolsInfo) => void;
13
+ /**
14
+ * Hooks to extend devtools tabs.
15
+ */
16
+ 'devtools:customTabs': (tabs: ModuleCustomTab[]) => void;
17
+ /**
18
+ * Retrigger update for custom tabs, `devtools:customTabs` will be called again.
19
+ */
20
+ 'devtools:customTabs:refresh': () => void;
21
+ /**
22
+ * Register a terminal.
23
+ */
24
+ 'devtools:terminal:register': (terminal: TerminalState) => void;
25
+ /**
26
+ * Write to a terminal.
27
+ *
28
+ * Returns true if terminal is found.
29
+ */
30
+ 'devtools:terminal:write': (_: {
31
+ id: string;
32
+ data: string;
33
+ }) => void;
34
+ /**
35
+ * Remove a terminal from devtools.
36
+ *
37
+ * Returns true if terminal is found and deleted.
38
+ */
39
+ 'devtools:terminal:remove': (_: {
40
+ id: string;
41
+ }) => void;
42
+ /**
43
+ * Mark a terminal as terminated.
44
+ */
45
+ 'devtools:terminal:exit': (_: {
46
+ id: string;
47
+ code?: number;
48
+ }) => void;
49
+ }
50
+ }
51
+ declare module '@nuxt/schema' {
52
+ /**
53
+ * Runtime Hooks
54
+ */
55
+ interface RuntimeNuxtHooks {
56
+ /**
57
+ * On terminal data.
58
+ */
59
+ 'devtools:terminal:data': (payload: {
60
+ id: string;
61
+ data: string;
62
+ }) => void;
63
+ }
64
+ }
@@ -1,15 +1,17 @@
1
1
  import { Ref } from 'vue';
2
- import { c as NuxtDevtoolsIframeClient } from './client-api-f551dae7.js';
2
+ import { c as NuxtDevtoolsIframeClient } from './client-api-dfe1af35.js';
3
3
  import 'nuxt/schema';
4
4
  import 'nuxt/dist/app/nuxt';
5
5
  import 'hookable';
6
6
  import 'birpc';
7
- import './rpc-ec33d45e.js';
7
+ import './server-ctx-607d5ba8.js';
8
8
  import 'nitropack';
9
9
  import 'unstorage';
10
+ import 'vite-plugin-vue-inspector';
10
11
  import 'vue-router';
11
12
  import 'unimport';
12
13
  import 'execa';
14
+ import '@nuxt/schema';
13
15
 
14
16
  declare function onDevtoolsClientConnected(fn: (client: NuxtDevtoolsIframeClient) => void): (() => void) | undefined;
15
17
  declare function useDevtoolsClient(): Ref<NuxtDevtoolsIframeClient | undefined>;
package/dist/index.cjs CHANGED
@@ -21,11 +21,14 @@ function startSubprocess(execaOptions, tabOptions, nuxt = kit.useNuxt()) {
21
21
  execaOptions.command,
22
22
  execaOptions.args,
23
23
  {
24
+ reject: false,
24
25
  ...execaOptions,
25
26
  env: {
26
27
  COLORS: "true",
27
28
  FORCE_COLOR: "true",
28
- ...execaOptions.env
29
+ ...execaOptions.env,
30
+ // Force disable Nuxi CLI override
31
+ __CLI_ARGV__: void 0
29
32
  }
30
33
  }
31
34
  );
package/dist/index.d.ts CHANGED
@@ -1,11 +1,12 @@
1
1
  import * as execa from 'execa';
2
2
  import * as _nuxt_schema from '@nuxt/schema';
3
3
  import { BirpcGroup } from 'birpc';
4
- import { N as NuxtDevtoolsInfo } from './hooks-32e9f430.js';
5
- import { M as ModuleCustomTab, S as SubprocessOptions, T as TerminalState } from './rpc-ec33d45e.js';
4
+ import './hooks-7f0d2759.js';
5
+ import { M as ModuleCustomTab, S as SubprocessOptions, T as TerminalState, N as NuxtDevtoolsInfo } from './server-ctx-607d5ba8.js';
6
6
  import 'nuxt/schema';
7
7
  import 'nitropack';
8
8
  import 'unstorage';
9
+ import 'vite-plugin-vue-inspector';
9
10
  import 'vue';
10
11
  import 'vue-router';
11
12
  import 'unimport';
package/dist/index.mjs CHANGED
@@ -19,11 +19,14 @@ function startSubprocess(execaOptions, tabOptions, nuxt = useNuxt()) {
19
19
  execaOptions.command,
20
20
  execaOptions.args,
21
21
  {
22
+ reject: false,
22
23
  ...execaOptions,
23
24
  env: {
24
25
  COLORS: "true",
25
26
  FORCE_COLOR: "true",
26
- ...execaOptions.env
27
+ ...execaOptions.env,
28
+ // Force disable Nuxi CLI override
29
+ __CLI_ARGV__: void 0
27
30
  }
28
31
  }
29
32
  );
@@ -1,10 +1,13 @@
1
- import { NuxtOptions, Component, NuxtPage, NuxtLayout, NuxtApp } from 'nuxt/schema';
1
+ import { BirpcGroup } from 'birpc';
2
+ import { NuxtOptions, Component, NuxtPage, NuxtLayout, NuxtApp, Nuxt } from 'nuxt/schema';
2
3
  import { StorageMounts } from 'nitropack';
3
4
  import { StorageValue } from 'unstorage';
5
+ import { VitePluginInspectorOptions } from 'vite-plugin-vue-inspector';
4
6
  import { VNode } from 'vue';
5
7
  import { RouteRecordNormalized } from 'vue-router';
6
8
  import { Import, UnimportMeta } from 'unimport';
7
9
  import { Options } from 'execa';
10
+ import { NuxtAnalyzeMeta } from '@nuxt/schema';
8
11
 
9
12
  type TabCategory = 'app' | 'analyze' | 'server' | 'modules' | 'documentation' | 'advanced';
10
13
 
@@ -114,9 +117,100 @@ interface ModuleBuiltinTab {
114
117
  category?: TabCategory;
115
118
  show?: () => any;
116
119
  badge?: () => number | string | undefined;
120
+ onClick?: () => void;
117
121
  }
118
122
  type ModuleTabInfo = ModuleCustomTab | ModuleBuiltinTab;
119
123
 
124
+ interface ModuleOptions {
125
+ /**
126
+ * Enable DevTools
127
+ *
128
+ * @default true
129
+ */
130
+ enabled?: boolean;
131
+ /**
132
+ * Custom tabs
133
+ *
134
+ * This is in static format, for dynamic injection, call `nuxt.hook('devtools:customTabs')` instead
135
+ */
136
+ customTabs?: ModuleCustomTab[];
137
+ /**
138
+ * VS Code Server integration options.
139
+ */
140
+ vscode?: VSCodeIntegrationOptions;
141
+ /**
142
+ * Enable Vue Component Inspector
143
+ *
144
+ * @default true
145
+ */
146
+ componentInspector?: boolean | VitePluginInspectorOptions;
147
+ /**
148
+ * Enable vite-plugin-inspect
149
+ *
150
+ * @default true
151
+ */
152
+ viteInspect?: boolean;
153
+ }
154
+ interface ModuleGlobalOptions {
155
+ /**
156
+ * List of projects to enable devtools for. Only works when devtools is installed globally.
157
+ */
158
+ projects?: string[];
159
+ }
160
+ interface VSCodeIntegrationOptions {
161
+ /**
162
+ * Enable VS Code Server integration
163
+ */
164
+ enabled?: boolean;
165
+ /**
166
+ * Start VS Code Server on boot
167
+ *
168
+ * @default false
169
+ */
170
+ startOnBoot?: boolean;
171
+ /**
172
+ * Port to start VS Code Server
173
+ *
174
+ * @default 3080
175
+ */
176
+ port?: number;
177
+ /**
178
+ * Reuse existing server if available (same port)
179
+ */
180
+ reuseExistingServer?: boolean;
181
+ /**
182
+ * Determine whether to use code-server or vs code tunnel
183
+ *
184
+ * @default 'local-serve'
185
+ */
186
+ mode?: 'local-serve' | 'tunnel';
187
+ /**
188
+ * Options for VS Code tunnel
189
+ */
190
+ tunnel?: VSCodeTunnelOptions;
191
+ }
192
+ interface VSCodeTunnelOptions {
193
+ /**
194
+ * the machine name for port forwarding service
195
+ *
196
+ * default: device hostname
197
+ */
198
+ name?: string;
199
+ }
200
+ interface NuxtDevToolsUIOptions {
201
+ componentsView: 'list' | 'graph';
202
+ componentsGraphShowNodeModules: boolean;
203
+ componentsGraphShowPages: boolean;
204
+ componentsGraphShowLayouts: boolean;
205
+ componentsGraphShowWorkspace: boolean;
206
+ interactionCloseOnOutsideClick: boolean;
207
+ showExperimentalFeatures: boolean;
208
+ showHelpButtons: boolean;
209
+ scale: number;
210
+ hiddenTabs: string[];
211
+ hiddenTabCategories: string[];
212
+ }
213
+
120
214
  interface HookInfo {
121
215
  name: string;
122
216
  start: number;
@@ -184,7 +278,17 @@ interface BasicModuleInfo {
184
278
  name?: string;
185
279
  };
186
280
  }
187
- interface ModuleMetric {
281
+ interface InstalledModuleInfo {
282
+ name?: string;
283
+ isPackageModule: boolean;
284
+ isUninstallable: boolean;
285
+ info?: ModuleStaticInfo;
286
+ entryPath?: string;
287
+ meta?: {
288
+ name?: string;
289
+ };
290
+ }
291
+ interface ModuleStaticInfo {
188
292
  name: string;
189
293
  description: string;
190
294
  repo: string;
@@ -301,6 +405,22 @@ interface WizardFunctions {
301
405
  type WizardActions = keyof WizardFunctions;
302
406
  type GetWizardArgs<T extends WizardActions> = WizardFunctions[T] extends (nuxt: any, ...args: infer A) => any ? A : never;
303
407
 
408
+ interface AnalyzeBuildMeta extends NuxtAnalyzeMeta {
409
+ features: {
410
+ bundleClient: boolean;
411
+ bundleNitro: boolean;
412
+ viteInspect: boolean;
413
+ };
414
+ size: {
415
+ clientBundle?: number;
416
+ nitroBundle?: number;
417
+ };
418
+ }
419
+ interface AnalyzeBuildsInfo {
420
+ isBuilding: boolean;
421
+ builds: AnalyzeBuildMeta[];
422
+ }
423
+
304
424
  interface ServerFunctions {
305
425
  getServerConfig(): NuxtOptions;
306
426
  getComponents(): Component[];
@@ -313,6 +433,8 @@ interface ServerFunctions {
313
433
  getStaticAssets(): Promise<AssetInfo[]>;
314
434
  getServerRoutes(): Promise<ServerRouteInfo[]>;
315
435
  getServerApp(): NuxtApp | undefined;
436
+ getUIOptions(): Promise<NuxtDevToolsUIOptions>;
437
+ updateUIOptions(settings: Partial<NuxtDevToolsUIOptions>): Promise<void>;
316
438
  checkForUpdateFor(name: string): Promise<PackageUpdateInfo | undefined>;
317
439
  getPackageManager(): Promise<PackageManagerName>;
318
440
  getNpmCommand(command: NpmCommandType, packageName: string, options?: NpmCommandOptions): Promise<string[] | undefined>;
@@ -327,6 +449,10 @@ interface ServerFunctions {
327
449
  getStorageItem(key: string): Promise<StorageValue>;
328
450
  setStorageItem(key: string, value: StorageValue): Promise<void>;
329
451
  removeStorageItem(key: string): Promise<void>;
452
+ getAnalyzeBuildInfo(): Promise<AnalyzeBuildsInfo>;
453
+ generateAnalyzeBuildName(): Promise<string>;
454
+ startAnalyzeBuild(name: string): Promise<string>;
455
+ clearAnalyzeBuilds(names?: string[]): Promise<void>;
330
456
  getImageMeta(filepath: string): Promise<ImageMeta | undefined>;
331
457
  getTextAssetContent(filepath: string, limit?: number): Promise<string | undefined>;
332
458
  writeStaticAssets(file: {
@@ -337,6 +463,8 @@ interface ServerFunctions {
337
463
  runWizard<T extends WizardActions>(name: T, ...args: GetWizardArgs<T>): Promise<void>;
338
464
  openInEditor(filepath: string): Promise<boolean>;
339
465
  restartNuxt(hard?: boolean): Promise<void>;
466
+ installNuxtModule(name: string, dry?: boolean): Promise<InstallModuleReturn>;
467
+ uninstallNuxtModule(name: string, dry?: boolean): Promise<InstallModuleReturn>;
340
468
  }
341
469
  interface ClientFunctions {
342
470
  refresh(event: ClientUpdateEvent): void;
@@ -353,4 +481,33 @@ interface ClientFunctions {
353
481
  }
354
482
  type ClientUpdateEvent = keyof ServerFunctions;
355
483
 
356
- export { AutoImportsWithMetadata as A, BasicModuleInfo as B, CompatibilityStatus as C, WizardActions as D, GetWizardArgs as E, ServerFunctions as F, GitHubContributor as G, HookInfo as H, ImageMeta as I, ClientFunctions as J, ClientUpdateEvent as K, TabCategory as L, ModuleCustomTab as M, NpmCommandType as N, PackageUpdateInfo as P, RouteInfo as R, SubprocessOptions as S, TerminalState as T, VueInspectorClient as V, WizardFunctions as W, ModuleLaunchView as a, ModuleIframeView as b, ModuleVNodeView as c, ModuleLaunchAction as d, ModuleView as e, ModuleIframeTabLazyOptions as f, ModuleBuiltinTab as g, ModuleTabInfo as h, TerminalBase as i, TerminalAction as j, TerminalInfo as k, PackageManagerName as l, NpmCommandOptions as m, ServerRouteInfo as n, Payload as o, PluginInfoWithMetic as p, PluginMetric as q, ModuleMetric as r, ModuleCompatibility as s, ModuleType as t, MaintainerInfo as u, VueInspectorData as v, AssetType as w, AssetInfo as x, CodeSnippet as y, ComponentRelationship as z };
484
+ /**
485
+ * @internal
486
+ */
487
+ interface NuxtDevtoolsServerContext {
488
+ nuxt: Nuxt;
489
+ options: ModuleOptions;
490
+ rpc: BirpcGroup<ClientFunctions, ServerFunctions>;
491
+ /**
492
+ * Hook to open file in editor
493
+ */
494
+ openInEditorHooks: ((filepath: string) => boolean | void | Promise<boolean | void>)[];
495
+ /**
496
+ * Invalidate client cache for a function and ask for re-fetching
497
+ */
498
+ refresh: (event: keyof ServerFunctions) => void;
499
+ extendServerRpc: <ClientFunctions = {}, ServerFunctions = {}>(name: string, functions: ServerFunctions) => BirpcGroup<ClientFunctions, ServerFunctions>;
500
+ }
501
+ interface NuxtDevtoolsInfo {
502
+ version: string;
503
+ packagePath: string;
504
+ isGlobalInstall: boolean;
505
+ }
506
+ interface InstallModuleReturn {
507
+ configOriginal: string;
508
+ configGenerated: string;
509
+ commands: string[];
510
+ processId: string;
511
+ }
512
+
513
+ export { VSCodeIntegrationOptions as $, AutoImportsWithMetadata as A, BasicModuleInfo as B, CompatibilityStatus as C, CodeSnippet as D, ComponentRelationship as E, WizardActions as F, GitHubContributor as G, HookInfo as H, ImageMeta as I, GetWizardArgs as J, ServerFunctions as K, ClientFunctions as L, ModuleCustomTab as M, NuxtDevtoolsInfo as N, ClientUpdateEvent as O, PackageUpdateInfo as P, NuxtDevtoolsServerContext as Q, RouteInfo as R, SubprocessOptions as S, TerminalState as T, InstallModuleReturn as U, VueInspectorClient as V, WizardFunctions as W, AnalyzeBuildMeta as X, AnalyzeBuildsInfo as Y, ModuleOptions as Z, ModuleGlobalOptions as _, ModuleLaunchView as a, VSCodeTunnelOptions as a0, NuxtDevToolsUIOptions as a1, TabCategory as a2, ModuleIframeView as b, ModuleVNodeView as c, ModuleLaunchAction as d, ModuleView as e, ModuleIframeTabLazyOptions as f, ModuleBuiltinTab as g, ModuleTabInfo as h, TerminalBase as i, TerminalAction as j, TerminalInfo as k, PackageManagerName as l, NpmCommandType as m, NpmCommandOptions as n, ServerRouteInfo as o, Payload as p, PluginInfoWithMetic as q, PluginMetric as r, InstalledModuleInfo as s, ModuleStaticInfo as t, ModuleCompatibility as u, ModuleType as v, MaintainerInfo as w, VueInspectorData as x, AssetType as y, AssetInfo as z };
package/dist/types.d.ts CHANGED
@@ -1,13 +1,15 @@
1
- export { b as ModuleGlobalOptions, M as ModuleOptions, N as NuxtDevtoolsInfo, a as NuxtDevtoolsServerContext, V as VSCodeIntegrationOptions, c as VSCodeTunnelOptions } from './hooks-32e9f430.js';
2
- export { x as AssetInfo, w as AssetType, A as AutoImportsWithMetadata, B as BasicModuleInfo, J as ClientFunctions, K as ClientUpdateEvent, y as CodeSnippet, C as CompatibilityStatus, z as ComponentRelationship, E as GetWizardArgs, G as GitHubContributor, H as HookInfo, I as ImageMeta, u as MaintainerInfo, g as ModuleBuiltinTab, s as ModuleCompatibility, M as ModuleCustomTab, f as ModuleIframeTabLazyOptions, b as ModuleIframeView, d as ModuleLaunchAction, a as ModuleLaunchView, r as ModuleMetric, h as ModuleTabInfo, t as ModuleType, c as ModuleVNodeView, e as ModuleView, m as NpmCommandOptions, N as NpmCommandType, l as PackageManagerName, P as PackageUpdateInfo, o as Payload, p as PluginInfoWithMetic, q as PluginMetric, R as RouteInfo, F as ServerFunctions, n as ServerRouteInfo, S as SubprocessOptions, L as TabCategory, j as TerminalAction, i as TerminalBase, k as TerminalInfo, T as TerminalState, V as VueInspectorClient, v as VueInspectorData, D as WizardActions, W as WizardFunctions } from './rpc-ec33d45e.js';
3
- export { b as NuxtDevtoolsClient, N as NuxtDevtoolsClientHooks, d as NuxtDevtoolsGlobal, a as NuxtDevtoolsHostClient, c as NuxtDevtoolsIframeClient } from './client-api-f551dae7.js';
1
+ import './hooks-7f0d2759.js';
2
+ export { X as AnalyzeBuildMeta, Y as AnalyzeBuildsInfo, z as AssetInfo, y as AssetType, A as AutoImportsWithMetadata, B as BasicModuleInfo, L as ClientFunctions, O as ClientUpdateEvent, D as CodeSnippet, C as CompatibilityStatus, E as ComponentRelationship, J as GetWizardArgs, G as GitHubContributor, H as HookInfo, I as ImageMeta, U as InstallModuleReturn, s as InstalledModuleInfo, w as MaintainerInfo, g as ModuleBuiltinTab, u as ModuleCompatibility, M as ModuleCustomTab, _ as ModuleGlobalOptions, f as ModuleIframeTabLazyOptions, b as ModuleIframeView, d as ModuleLaunchAction, a as ModuleLaunchView, Z as ModuleOptions, t as ModuleStaticInfo, h as ModuleTabInfo, v as ModuleType, c as ModuleVNodeView, e as ModuleView, n as NpmCommandOptions, m as NpmCommandType, a1 as NuxtDevToolsUIOptions, N as NuxtDevtoolsInfo, Q as NuxtDevtoolsServerContext, l as PackageManagerName, P as PackageUpdateInfo, p as Payload, q as PluginInfoWithMetic, r as PluginMetric, R as RouteInfo, K as ServerFunctions, o as ServerRouteInfo, S as SubprocessOptions, a2 as TabCategory, j as TerminalAction, i as TerminalBase, k as TerminalInfo, T as TerminalState, $ as VSCodeIntegrationOptions, a0 as VSCodeTunnelOptions, V as VueInspectorClient, x as VueInspectorData, F as WizardActions, W as WizardFunctions } from './server-ctx-607d5ba8.js';
3
+ export { b as NuxtDevtoolsClient, N as NuxtDevtoolsClientHooks, d as NuxtDevtoolsGlobal, a as NuxtDevtoolsHostClient, c as NuxtDevtoolsIframeClient } from './client-api-dfe1af35.js';
4
4
  import 'birpc';
5
5
  import 'nuxt/schema';
6
6
  import 'nitropack';
7
7
  import 'unstorage';
8
+ import 'vite-plugin-vue-inspector';
8
9
  import 'vue';
9
10
  import 'vue-router';
10
11
  import 'unimport';
11
12
  import 'execa';
13
+ import '@nuxt/schema';
12
14
  import 'nuxt/dist/app/nuxt';
13
15
  import 'hookable';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxt/devtools-kit",
3
3
  "type": "module",
4
- "version": "0.4.6",
4
+ "version": "0.5.1",
5
5
  "license": "MIT",
6
6
  "repository": "nuxt/devtools",
7
7
  "exports": {
@@ -34,8 +34,8 @@
34
34
  "vite": "*"
35
35
  },
36
36
  "dependencies": {
37
- "@nuxt/kit": "^3.4.3",
38
- "@nuxt/schema": "^3.4.3",
37
+ "@nuxt/kit": "^3.5.0",
38
+ "@nuxt/schema": "^3.5.0",
39
39
  "execa": "^7.1.1"
40
40
  },
41
41
  "devDependencies": {
@@ -43,7 +43,8 @@
43
43
  "hookable": "^5.5.3",
44
44
  "unbuild": "^1.2.1",
45
45
  "unimport": "^3.0.6",
46
- "vue-router": "^4.1.6"
46
+ "vite-plugin-vue-inspector": "^3.4.2",
47
+ "vue-router": "^4.2.0"
47
48
  },
48
49
  "scripts": {
49
50
  "build": "unbuild",
@@ -1,168 +0,0 @@
1
- import { M as ModuleCustomTab, J as ClientFunctions, F as ServerFunctions, T as TerminalState } from './rpc-ec33d45e.js';
2
- import { BirpcGroup } from 'birpc';
3
- import { Nuxt } from 'nuxt/schema';
4
-
5
- interface ModuleOptions {
6
- /**
7
- * Enable DevTools
8
- *
9
- * @default true
10
- */
11
- enabled?: boolean;
12
- /**
13
- * Custom tabs
14
- *
15
- * This is in static format, for dynamic injection, call `nuxt.hook('devtools:customTabs')` instead
16
- */
17
- customTabs?: ModuleCustomTab[];
18
- /**
19
- * VS Code Server integration options.
20
- */
21
- vscode?: VSCodeIntegrationOptions;
22
- /**
23
- * Enable Vue Component Inspector
24
- *
25
- * @default true
26
- */
27
- componentInspector?: boolean;
28
- /**
29
- * Enable vite-plugin-inspect
30
- *
31
- * @default true
32
- */
33
- viteInspect?: boolean;
34
- }
35
- interface ModuleGlobalOptions {
36
- /**
37
- * List of projects to enable devtools for. Only works when devtools is installed globally.
38
- */
39
- projects?: string[];
40
- }
41
- interface VSCodeIntegrationOptions {
42
- /**
43
- * Enable VS Code Server integration
44
- */
45
- enabled?: boolean;
46
- /**
47
- * Start VS Code Server on boot
48
- *
49
- * @default false
50
- */
51
- startOnBoot?: boolean;
52
- /**
53
- * Port to start VS Code Server
54
- *
55
- * @default 3080
56
- */
57
- port?: number;
58
- /**
59
- * Reuse existing server if available (same port)
60
- */
61
- reuseExistingServer?: boolean;
62
- /**
63
- * Determine whether to use code-server or vs code tunnel
64
- *
65
- * @default 'local-serve'
66
- */
67
- mode?: 'local-serve' | 'tunnel';
68
- /**
69
- * Options for VS Code tunnel
70
- */
71
- tunnel?: VSCodeTunnelOptions;
72
- }
73
- interface VSCodeTunnelOptions {
74
- /**
75
- * the machine name for port forwarding service
76
- *
77
- * default: device hostname
78
- */
79
- name?: string;
80
- }
81
-
82
- /**
83
- * @internal
84
- */
85
- interface NuxtDevtoolsServerContext {
86
- nuxt: Nuxt;
87
- options: ModuleOptions;
88
- rpc: BirpcGroup<ClientFunctions, ServerFunctions>;
89
- /**
90
- * Hook to open file in editor
91
- */
92
- openInEditorHooks: ((filepath: string) => boolean | void | Promise<boolean | void>)[];
93
- /**
94
- * Invalidate client cache for a function and ask for re-fetching
95
- */
96
- refresh: (event: keyof ServerFunctions) => void;
97
- extendServerRpc: <ClientFunctions = {}, ServerFunctions = {}>(name: string, functions: ServerFunctions) => BirpcGroup<ClientFunctions, ServerFunctions>;
98
- }
99
- interface NuxtDevtoolsInfo {
100
- version: string;
101
- packagePath: string;
102
- isGlobalInstall: boolean;
103
- }
104
-
105
- declare module '@nuxt/schema' {
106
- interface NuxtHooks {
107
- /**
108
- * Called before devtools starts. Useful to detect if devtools is enabled.
109
- */
110
- 'devtools:before': () => void;
111
- /**
112
- * Called after devtools is initialized.
113
- */
114
- 'devtools:initialized': (info: NuxtDevtoolsInfo) => void;
115
- /**
116
- * Hooks to extend devtools tabs.
117
- */
118
- 'devtools:customTabs': (tabs: ModuleCustomTab[]) => void;
119
- /**
120
- * Retrigger update for custom tabs, `devtools:customTabs` will be called again.
121
- */
122
- 'devtools:customTabs:refresh': () => void;
123
- /**
124
- * Register a terminal.
125
- */
126
- 'devtools:terminal:register': (terminal: TerminalState) => void;
127
- /**
128
- * Write to a terminal.
129
- *
130
- * Returns true if terminal is found.
131
- */
132
- 'devtools:terminal:write': (_: {
133
- id: string;
134
- data: string;
135
- }) => void;
136
- /**
137
- * Remove a terminal from devtools.
138
- *
139
- * Returns true if terminal is found and deleted.
140
- */
141
- 'devtools:terminal:remove': (_: {
142
- id: string;
143
- }) => void;
144
- /**
145
- * Mark a terminal as terminated.
146
- */
147
- 'devtools:terminal:exit': (_: {
148
- id: string;
149
- code?: number;
150
- }) => void;
151
- }
152
- }
153
- declare module '@nuxt/schema' {
154
- /**
155
- * Runtime Hooks
156
- */
157
- interface RuntimeNuxtHooks {
158
- /**
159
- * On terminal data.
160
- */
161
- 'devtools:terminal:data': (payload: {
162
- id: string;
163
- data: string;
164
- }) => void;
165
- }
166
- }
167
-
168
- export { ModuleOptions as M, NuxtDevtoolsInfo as N, VSCodeIntegrationOptions as V, NuxtDevtoolsServerContext as a, ModuleGlobalOptions as b, VSCodeTunnelOptions as c };