@nuxt/devtools-kit 0.6.7 → 0.7.0

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 };
@@ -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,64 @@
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 { StackFrame } from 'error-stack-parser-es';
8
9
  import 'nitropack';
9
10
  import 'unstorage';
10
11
  import 'vite-plugin-vue-inspector';
11
- import 'vue-router';
12
12
  import 'unimport';
13
+ import 'vue-router';
13
14
  import 'execa';
14
15
  import '@nuxt/schema';
15
16
 
17
+ interface TimelineEventFunction {
18
+ type: 'function';
19
+ start: number;
20
+ end?: number;
21
+ name: string;
22
+ args?: any[];
23
+ result?: any;
24
+ stacktrace?: StackFrame[];
25
+ isPromise?: boolean;
26
+ }
27
+ interface TimelineEventRoute {
28
+ type: 'route';
29
+ start: number;
30
+ end?: number;
31
+ from: string;
32
+ to: string;
33
+ }
34
+ interface TimelineOptions {
35
+ enabled: boolean;
36
+ stacktrace: boolean;
37
+ arguments: boolean;
38
+ }
39
+ type TimelineEvent = TimelineEventFunction | TimelineEventRoute;
40
+ interface TimelineMetrics {
41
+ events: TimelineEvent[];
42
+ nonLiteralSymbol: symbol;
43
+ options: TimelineOptions;
44
+ }
45
+ interface TimelineEventNormalized<T> {
46
+ event: T;
47
+ segment: TimelineEventsSegment;
48
+ relativeStart: number;
49
+ relativeWidth: number;
50
+ layer: number;
51
+ }
52
+ interface TimelineEventsSegment {
53
+ start: number;
54
+ end: number;
55
+ events: TimelineEvent[];
56
+ functions: TimelineEventNormalized<TimelineEventFunction>[];
57
+ route?: TimelineEventNormalized<TimelineEventRoute>;
58
+ duration: number;
59
+ previousGap?: number;
60
+ }
61
+
16
62
  interface NuxtDevtoolsClientHooks {
17
63
  /**
18
64
  * When the DevTools navigates, used for persisting the current tab
@@ -52,7 +98,8 @@ interface NuxtDevtoolsHostClient {
52
98
  };
53
99
  loadingTimeMetrics: LoadingTimeMetric;
54
100
  getClientHooksMetrics(): HookInfo[];
55
- getClientPluginMetrics(): PluginMetric[];
101
+ clientPluginMetrics: PluginMetric[] | undefined;
102
+ clientTimelineMetrics: TimelineMetrics | undefined;
56
103
  reloadPage(): void;
57
104
  close(): void;
58
105
  open(): void;
@@ -82,7 +129,7 @@ interface NuxtDevtoolsClient {
82
129
  };
83
130
  renderMarkdown: (markdown: string) => string;
84
131
  colorMode: string;
85
- extendClientRpc: <ServerFunctions = {}, ClientFunctions = {}>(name: string, functions: ClientFunctions) => BirpcReturn<ServerFunctions, ClientFunctions>;
132
+ extendClientRpc: <ServerFunctions = Record<string, never>, ClientFunctions = Record<string, never>>(name: string, functions: ClientFunctions) => BirpcReturn<ServerFunctions, ClientFunctions>;
86
133
  }
87
134
  interface NuxtDevtoolsIframeClient {
88
135
  host: NuxtDevtoolsHostClient;
@@ -92,4 +139,4 @@ interface NuxtDevtoolsGlobal {
92
139
  setClient(client: NuxtDevtoolsHostClient): void;
93
140
  }
94
141
 
95
- export { HookInfo, LoadingTimeMetric, NuxtDevtoolsClient, NuxtDevtoolsClientHooks, NuxtDevtoolsGlobal, NuxtDevtoolsHostClient, NuxtDevtoolsIframeClient, PluginMetric, ServerFunctions, VueInspectorClient, VueInspectorData };
142
+ 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.0",
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.2",
37
+ "@nuxt/schema": "^3.6.2",
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",