@nuxt/devtools-kit 0.6.7 → 0.7.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.
@@ -4,8 +4,8 @@ import { NuxtOptions, Component, NuxtPage, NuxtLayout, NuxtApp, Nuxt } from 'nux
4
4
  import { StorageMounts } from 'nitropack';
5
5
  import { StorageValue } from 'unstorage';
6
6
  import { VitePluginInspectorOptions } from 'vite-plugin-vue-inspector';
7
- import { RouteRecordNormalized } from 'vue-router';
8
7
  import { Import, UnimportMeta } from 'unimport';
8
+ import { RouteRecordNormalized } from 'vue-router';
9
9
  import { Options } from 'execa';
10
10
  import { NuxtAnalyzeMeta } from '@nuxt/schema';
11
11
 
@@ -127,6 +127,7 @@ interface ModuleBuiltinTab {
127
127
  onClick?: () => void;
128
128
  }
129
129
  type ModuleTabInfo = ModuleCustomTab | ModuleBuiltinTab;
130
+ type CategorizedTabs = [TabCategory, (ModuleCustomTab | ModuleBuiltinTab)[]][];
130
131
 
131
132
  interface HookInfo {
132
133
  name: string;
@@ -330,6 +331,40 @@ interface ModuleOptions {
330
331
  * @default false
331
332
  */
332
333
  disableAuthorization?: boolean;
334
+ /**
335
+ * Experimental features
336
+ */
337
+ experimental?: {
338
+ /**
339
+ * Timline tab
340
+ * @deprecated Use `timeline.enable` instead
341
+ */
342
+ timeline?: boolean;
343
+ };
344
+ /**
345
+ * Options for the timeline tab
346
+ */
347
+ timeline?: {
348
+ /**
349
+ * Enable timeline tab
350
+ *
351
+ * @default false
352
+ */
353
+ enabled?: boolean;
354
+ /**
355
+ * Track on function calls
356
+ */
357
+ functions?: {
358
+ include?: (string | RegExp | ((item: Import) => boolean))[];
359
+ /**
360
+ * Include from specific modules
361
+ *
362
+ * @default ['#app', '@unhead/vue']
363
+ */
364
+ includeFrom?: string[];
365
+ exclude?: (string | RegExp | ((item: Import) => boolean))[];
366
+ };
367
+ };
333
368
  }
334
369
  interface ModuleGlobalOptions {
335
370
  /**
@@ -395,6 +430,8 @@ interface NuxtDevToolsOptions {
395
430
  };
396
431
  serverRoutes: {
397
432
  selectedRoute: ServerRouteInfo | null;
433
+ view: 'tree' | 'list';
434
+ inputDefaults: Record<string, ServerRouteInput[]>;
398
435
  };
399
436
  }
400
437
 
@@ -507,6 +544,7 @@ interface ServerFunctions {
507
544
  restartNuxt(hard?: boolean): Promise<void>;
508
545
  installNuxtModule(token: string, name: string, dry?: boolean): Promise<InstallModuleReturn>;
509
546
  uninstallNuxtModule(token: string, name: string, dry?: boolean): Promise<InstallModuleReturn>;
547
+ enableTimeline(dry: boolean): Promise<[string, string]>;
510
548
  }
511
549
  interface ClientFunctions {
512
550
  refresh(event: ClientUpdateEvent): void;
@@ -542,7 +580,7 @@ interface NuxtDevtoolsServerContext {
542
580
  * Ensure dev auth token is valid, throw if not
543
581
  */
544
582
  ensureDevAuthToken: (token: string) => Promise<void>;
545
- extendServerRpc: <ClientFunctions = {}, ServerFunctions = {}>(name: string, functions: ServerFunctions) => BirpcGroup<ClientFunctions, ServerFunctions>;
583
+ extendServerRpc: <ClientFunctions = Record<string, never>, ServerFunctions = Record<string, never>>(name: string, functions: ServerFunctions) => BirpcGroup<ClientFunctions, ServerFunctions>;
546
584
  }
547
585
  interface NuxtDevtoolsInfo {
548
586
  version: string;
@@ -619,4 +657,4 @@ declare module '@nuxt/schema' {
619
657
  }
620
658
  }
621
659
 
622
- export { AnalyzeBuildsInfo as $, AutoImportsWithMetadata as A, BasicModuleInfo as B, CompatibilityStatus as C, MaintainerInfo as D, AssetType as E, AssetInfo as F, GitHubContributor as G, HookInfo as H, ImageMeta as I, CodeSnippet as J, ComponentRelationship as K, LoadingTimeMetric as L, ModuleCustomTab as M, NuxtDevtoolsInfo as N, WizardActions as O, PluginMetric as P, GetWizardArgs as Q, RouteInfo as R, SubprocessOptions as S, TerminalState as T, ClientFunctions as U, VueInspectorData as V, WizardFunctions as W, ClientUpdateEvent as X, NuxtDevtoolsServerContext as Y, InstallModuleReturn as Z, AnalyzeBuildMeta as _, VueInspectorClient as a, ModuleOptions as a0, ModuleGlobalOptions as a1, VSCodeIntegrationOptions as a2, VSCodeTunnelOptions as a3, NuxtDevToolsOptions as a4, TabCategory as a5, ServerFunctions as b, ModuleLaunchView as c, ModuleIframeView as d, ModuleVNodeView as e, ModuleLaunchAction as f, ModuleView as g, ModuleIframeTabLazyOptions as h, ModuleBuiltinTab as i, ModuleTabInfo as j, TerminalBase as k, TerminalAction as l, TerminalInfo as m, PackageUpdateInfo as n, PackageManagerName as o, NpmCommandType as p, NpmCommandOptions as q, ServerRouteInfo as r, ServerRouteInputType as s, ServerRouteInput as t, Payload as u, PluginInfoWithMetic as v, InstalledModuleInfo as w, ModuleStaticInfo as x, ModuleCompatibility as y, ModuleType as z };
660
+ export { AnalyzeBuildMeta as $, AutoImportsWithMetadata as A, BasicModuleInfo as B, CategorizedTabs as C, ModuleType as D, MaintainerInfo as E, AssetType as F, GitHubContributor as G, HookInfo as H, ImageMeta as I, AssetInfo as J, CodeSnippet as K, LoadingTimeMetric as L, ModuleCustomTab as M, NuxtDevtoolsInfo as N, ComponentRelationship as O, PluginMetric as P, WizardActions as Q, RouteInfo as R, SubprocessOptions as S, TerminalState as T, GetWizardArgs as U, VueInspectorData as V, WizardFunctions as W, ClientFunctions as X, ClientUpdateEvent as Y, NuxtDevtoolsServerContext as Z, InstallModuleReturn as _, VueInspectorClient as a, AnalyzeBuildsInfo as a0, ModuleOptions as a1, ModuleGlobalOptions as a2, VSCodeIntegrationOptions as a3, VSCodeTunnelOptions as a4, NuxtDevToolsOptions as a5, TabCategory as a6, ServerFunctions as b, ModuleLaunchView as c, ModuleIframeView as d, ModuleVNodeView as e, ModuleLaunchAction as f, ModuleView as g, ModuleIframeTabLazyOptions as h, ModuleBuiltinTab as i, ModuleTabInfo as j, TerminalBase as k, TerminalAction as l, TerminalInfo as m, PackageUpdateInfo as n, PackageManagerName as o, NpmCommandType as p, NpmCommandOptions as q, ServerRouteInfo as r, ServerRouteInputType as s, ServerRouteInput as t, Payload as u, PluginInfoWithMetic as v, InstalledModuleInfo as w, ModuleStaticInfo as x, ModuleCompatibility as y, CompatibilityStatus as z };
package/dist/index.d.ts CHANGED
@@ -1,14 +1,14 @@
1
1
  import * as execa from 'execa';
2
2
  import * as _nuxt_schema from '@nuxt/schema';
3
3
  import { BirpcGroup } from 'birpc';
4
- import { M as ModuleCustomTab, S as SubprocessOptions, T as TerminalState, N as NuxtDevtoolsInfo } from './hooks-4850b104.js';
4
+ import { M as ModuleCustomTab, S as SubprocessOptions, T as TerminalState, N as NuxtDevtoolsInfo } from './hooks-983cdddc.js';
5
5
  import 'vue';
6
6
  import 'nuxt/schema';
7
7
  import 'nitropack';
8
8
  import 'unstorage';
9
9
  import 'vite-plugin-vue-inspector';
10
- import 'vue-router';
11
10
  import 'unimport';
11
+ import 'vue-router';
12
12
 
13
13
  /**
14
14
  * Hooks to extend a custom tab in devtools.
@@ -29,7 +29,7 @@ declare function startSubprocess(execaOptions: SubprocessOptions, tabOptions: Te
29
29
  restart: () => void;
30
30
  clear: () => void;
31
31
  };
32
- declare function extendServerRpc<ClientFunctions = {}, ServerFunctions = {}>(namespace: string, functions: ServerFunctions, nuxt?: _nuxt_schema.Nuxt): BirpcGroup<ClientFunctions, ServerFunctions>;
32
+ declare function extendServerRpc<ClientFunctions = Record<string, never>, ServerFunctions = Record<string, never>>(namespace: string, functions: ServerFunctions, nuxt?: _nuxt_schema.Nuxt): BirpcGroup<ClientFunctions, ServerFunctions>;
33
33
  declare function onDevToolsInitialized(fn: (info: NuxtDevtoolsInfo) => void, nuxt?: _nuxt_schema.Nuxt): void;
34
34
 
35
35
  export { addCustomTab, extendServerRpc, onDevToolsInitialized, refreshCustomTabs, startSubprocess };
@@ -1,4 +1,4 @@
1
1
  import type { Ref } from 'vue';
2
- import type { NuxtDevtoolsIframeClient } from '../../src/_types/client-api';
2
+ import type { NuxtDevtoolsIframeClient } from '../types';
3
3
  export declare function onDevtoolsClientConnected(fn: (client: NuxtDevtoolsIframeClient) => void): (() => void) | undefined;
4
4
  export declare function useDevtoolsClient(): Ref<NuxtDevtoolsIframeClient | undefined>;
@@ -30,13 +30,13 @@ export function useDevtoolsClient() {
30
30
  clientRef = shallowRef();
31
31
  onDevtoolsClientConnected(setup);
32
32
  }
33
+ function onUpdateReactivity() {
34
+ triggerRef(clientRef);
35
+ }
33
36
  function setup(client) {
34
37
  clientRef.value = client;
35
- if (client.host) {
36
- client.host.hooks.hook("host:update:reactivity", () => {
37
- triggerRef(clientRef);
38
- });
39
- }
38
+ if (client.host)
39
+ client.host.hooks.hook("host:update:reactivity", onUpdateReactivity);
40
40
  }
41
41
  return clientRef;
42
42
  }
package/dist/types.d.ts CHANGED
@@ -1,18 +1,65 @@
1
- import { V as VueInspectorData, a as VueInspectorClient, L as LoadingTimeMetric, H as HookInfo, P as PluginMetric, b as ServerFunctions } from './hooks-4850b104.js';
2
- export { _ as AnalyzeBuildMeta, $ as AnalyzeBuildsInfo, F as AssetInfo, E as AssetType, A as AutoImportsWithMetadata, B as BasicModuleInfo, U as ClientFunctions, X as ClientUpdateEvent, J as CodeSnippet, C as CompatibilityStatus, K as ComponentRelationship, Q as GetWizardArgs, G as GitHubContributor, I as ImageMeta, Z as InstallModuleReturn, w as InstalledModuleInfo, D as MaintainerInfo, i as ModuleBuiltinTab, y as ModuleCompatibility, M as ModuleCustomTab, a1 as ModuleGlobalOptions, h as ModuleIframeTabLazyOptions, d as ModuleIframeView, f as ModuleLaunchAction, c as ModuleLaunchView, a0 as ModuleOptions, x as ModuleStaticInfo, j as ModuleTabInfo, z as ModuleType, e as ModuleVNodeView, g as ModuleView, q as NpmCommandOptions, p as NpmCommandType, a4 as NuxtDevToolsOptions, N as NuxtDevtoolsInfo, Y as NuxtDevtoolsServerContext, o as PackageManagerName, n as PackageUpdateInfo, u as Payload, v as PluginInfoWithMetic, R as RouteInfo, r as ServerRouteInfo, t as ServerRouteInput, s as ServerRouteInputType, S as SubprocessOptions, a5 as TabCategory, l as TerminalAction, k as TerminalBase, m as TerminalInfo, T as TerminalState, a2 as VSCodeIntegrationOptions, a3 as VSCodeTunnelOptions, O as WizardActions, W as WizardFunctions } from './hooks-4850b104.js';
1
+ import { V as VueInspectorData, a as VueInspectorClient, L as LoadingTimeMetric, H as HookInfo, P as PluginMetric, b as ServerFunctions } from './hooks-983cdddc.js';
2
+ export { $ as AnalyzeBuildMeta, a0 as AnalyzeBuildsInfo, J as AssetInfo, F as AssetType, A as AutoImportsWithMetadata, B as BasicModuleInfo, C as CategorizedTabs, X as ClientFunctions, Y as ClientUpdateEvent, K as CodeSnippet, z as CompatibilityStatus, O as ComponentRelationship, U as GetWizardArgs, G as GitHubContributor, I as ImageMeta, _ as InstallModuleReturn, w as InstalledModuleInfo, E as MaintainerInfo, i as ModuleBuiltinTab, y as ModuleCompatibility, M as ModuleCustomTab, a2 as ModuleGlobalOptions, h as ModuleIframeTabLazyOptions, d as ModuleIframeView, f as ModuleLaunchAction, c as ModuleLaunchView, a1 as ModuleOptions, x as ModuleStaticInfo, j as ModuleTabInfo, D as ModuleType, e as ModuleVNodeView, g as ModuleView, q as NpmCommandOptions, p as NpmCommandType, a5 as NuxtDevToolsOptions, N as NuxtDevtoolsInfo, Z as NuxtDevtoolsServerContext, o as PackageManagerName, n as PackageUpdateInfo, u as Payload, v as PluginInfoWithMetic, R as RouteInfo, r as ServerRouteInfo, t as ServerRouteInput, s as ServerRouteInputType, S as SubprocessOptions, a6 as TabCategory, l as TerminalAction, k as TerminalBase, m as TerminalInfo, T as TerminalState, a3 as VSCodeIntegrationOptions, a4 as VSCodeTunnelOptions, Q as WizardActions, W as WizardFunctions } from './hooks-983cdddc.js';
3
3
  import { Ref } from 'vue';
4
4
  import { AppConfig } from 'nuxt/schema';
5
5
  import { NuxtApp } from 'nuxt/dist/app/nuxt';
6
6
  import { Hookable } from 'hookable';
7
7
  import { BirpcReturn } from 'birpc';
8
+ import { Lang } from 'shiki-es';
9
+ import { StackFrame } from 'error-stack-parser-es';
8
10
  import 'nitropack';
9
11
  import 'unstorage';
10
12
  import 'vite-plugin-vue-inspector';
11
- import 'vue-router';
12
13
  import 'unimport';
14
+ import 'vue-router';
13
15
  import 'execa';
14
16
  import '@nuxt/schema';
15
17
 
18
+ interface TimelineEventFunction {
19
+ type: 'function';
20
+ start: number;
21
+ end?: number;
22
+ name: string;
23
+ args?: any[];
24
+ result?: any;
25
+ stacktrace?: StackFrame[];
26
+ isPromise?: boolean;
27
+ }
28
+ interface TimelineEventRoute {
29
+ type: 'route';
30
+ start: number;
31
+ end?: number;
32
+ from: string;
33
+ to: string;
34
+ }
35
+ interface TimelineOptions {
36
+ enabled: boolean;
37
+ stacktrace: boolean;
38
+ arguments: boolean;
39
+ }
40
+ type TimelineEvent = TimelineEventFunction | TimelineEventRoute;
41
+ interface TimelineMetrics {
42
+ events: TimelineEvent[];
43
+ nonLiteralSymbol: symbol;
44
+ options: TimelineOptions;
45
+ }
46
+ interface TimelineEventNormalized<T> {
47
+ event: T;
48
+ segment: TimelineEventsSegment;
49
+ relativeStart: number;
50
+ relativeWidth: number;
51
+ layer: number;
52
+ }
53
+ interface TimelineEventsSegment {
54
+ start: number;
55
+ end: number;
56
+ events: TimelineEvent[];
57
+ functions: TimelineEventNormalized<TimelineEventFunction>[];
58
+ route?: TimelineEventNormalized<TimelineEventRoute>;
59
+ duration: number;
60
+ previousGap?: number;
61
+ }
62
+
16
63
  interface NuxtDevtoolsClientHooks {
17
64
  /**
18
65
  * When the DevTools navigates, used for persisting the current tab
@@ -52,7 +99,8 @@ interface NuxtDevtoolsHostClient {
52
99
  };
53
100
  loadingTimeMetrics: LoadingTimeMetric;
54
101
  getClientHooksMetrics(): HookInfo[];
55
- getClientPluginMetrics(): PluginMetric[];
102
+ clientPluginMetrics: PluginMetric[] | undefined;
103
+ clientTimelineMetrics: TimelineMetrics | undefined;
56
104
  reloadPage(): void;
57
105
  close(): void;
58
106
  open(): void;
@@ -76,13 +124,13 @@ interface NuxtDevtoolsHostClient {
76
124
  }
77
125
  interface NuxtDevtoolsClient {
78
126
  rpc: BirpcReturn<ServerFunctions>;
79
- renderCodeHighlight: (code: string, lang: string, lines?: boolean, theme?: string) => {
127
+ renderCodeHighlight: (code: string, lang?: Lang) => {
80
128
  code: string;
81
129
  supported: boolean;
82
130
  };
83
131
  renderMarkdown: (markdown: string) => string;
84
132
  colorMode: string;
85
- extendClientRpc: <ServerFunctions = {}, ClientFunctions = {}>(name: string, functions: ClientFunctions) => BirpcReturn<ServerFunctions, ClientFunctions>;
133
+ extendClientRpc: <ServerFunctions = Record<string, never>, ClientFunctions = Record<string, never>>(name: string, functions: ClientFunctions) => BirpcReturn<ServerFunctions, ClientFunctions>;
86
134
  }
87
135
  interface NuxtDevtoolsIframeClient {
88
136
  host: NuxtDevtoolsHostClient;
@@ -92,4 +140,4 @@ interface NuxtDevtoolsGlobal {
92
140
  setClient(client: NuxtDevtoolsHostClient): void;
93
141
  }
94
142
 
95
- export { HookInfo, LoadingTimeMetric, NuxtDevtoolsClient, NuxtDevtoolsClientHooks, NuxtDevtoolsGlobal, NuxtDevtoolsHostClient, NuxtDevtoolsIframeClient, PluginMetric, ServerFunctions, VueInspectorClient, VueInspectorData };
143
+ export { HookInfo, LoadingTimeMetric, NuxtDevtoolsClient, NuxtDevtoolsClientHooks, NuxtDevtoolsGlobal, NuxtDevtoolsHostClient, NuxtDevtoolsIframeClient, PluginMetric, ServerFunctions, TimelineEvent, TimelineEventFunction, TimelineEventNormalized, TimelineEventRoute, TimelineEventsSegment, TimelineMetrics, TimelineOptions, VueInspectorClient, VueInspectorData };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxt/devtools-kit",
3
3
  "type": "module",
4
- "version": "0.6.7",
4
+ "version": "0.7.1",
5
5
  "license": "MIT",
6
6
  "repository": "nuxt/devtools",
7
7
  "exports": {
@@ -33,17 +33,18 @@
33
33
  "vite": "*"
34
34
  },
35
35
  "dependencies": {
36
- "@nuxt/kit": "^3.6.1",
37
- "@nuxt/schema": "^3.6.1",
36
+ "@nuxt/kit": "^3.6.5",
37
+ "@nuxt/schema": "^3.6.5",
38
38
  "execa": "^7.1.1"
39
39
  },
40
40
  "devDependencies": {
41
41
  "birpc": "^0.2.12",
42
+ "error-stack-parser-es": "^0.1.0",
42
43
  "hookable": "^5.5.3",
43
44
  "unbuild": "^1.2.1",
44
- "unimport": "^3.0.12",
45
+ "unimport": "^3.1.0",
45
46
  "vite-plugin-vue-inspector": "^3.4.2",
46
- "vue-router": "^4.2.2"
47
+ "vue-router": "^4.2.4"
47
48
  },
48
49
  "scripts": {
49
50
  "build": "unbuild",