@nuxt/devtools 0.7.6 → 0.8.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.
Files changed (101) hide show
  1. package/dist/chunks/module-main.mjs +9 -3
  2. package/dist/client/200.html +2 -2
  3. package/dist/client/404.html +2 -2
  4. package/dist/client/__blank/index.html +2 -2
  5. package/dist/client/_nuxt/{Badge.f2e9b29c.js → Badge.73590739.js} +1 -1
  6. package/dist/client/_nuxt/{CodeDiff.vue.9b0b0885.js → CodeDiff.vue.5bc59452.js} +1 -1
  7. package/dist/client/_nuxt/{ComposableItem.vue.3f961e9e.js → ComposableItem.vue.b891778e.js} +1 -1
  8. package/dist/client/_nuxt/{DataSchemaButton.vue.a6df5cb8.js → DataSchemaButton.vue.58aa4fbb.js} +1 -1
  9. package/dist/client/_nuxt/{DataSchemaDrawer.be265d1e.js → DataSchemaDrawer.b54a9c8c.js} +1 -1
  10. package/dist/client/_nuxt/{DrawerRight.vue.92472251.js → DrawerRight.vue.462f9048.js} +1 -1
  11. package/dist/client/_nuxt/{DurationDisplay.vue.ebef3eee.js → DurationDisplay.vue.281ea057.js} +1 -1
  12. package/dist/client/_nuxt/FilepathItem.vue.3d85c8b7.js +1 -0
  13. package/dist/client/_nuxt/{HelpFab.vue.4d768974.js → HelpFab.vue.7e36821f.js} +1 -1
  14. package/dist/client/_nuxt/{LaunchPage.vue.c2e514b2.js → LaunchPage.vue.fd74a96c.js} +1 -1
  15. package/dist/client/_nuxt/{NCheckbox.vue.78fd8d82.js → NCheckbox.vue.1ddacd54.js} +1 -1
  16. package/dist/client/_nuxt/{NCodeBlock.vue.c7ed33b1.js → NCodeBlock.vue.31f18b3e.js} +1 -1
  17. package/dist/client/_nuxt/{NDropdown.vue.c7f63cd6.js → NDropdown.vue.ba86ab23.js} +1 -1
  18. package/dist/client/_nuxt/{NIconTitle.vue.2f7c2128.js → NIconTitle.vue.9acdbad1.js} +1 -1
  19. package/dist/client/_nuxt/{NLink.vue.3fcc5a37.js → NLink.vue.a8242afb.js} +1 -1
  20. package/dist/client/_nuxt/{NMarkdown.vue.e4405095.js → NMarkdown.vue.12b1eecd.js} +1 -1
  21. package/dist/client/_nuxt/{NSectionBlock.9c411590.js → NSectionBlock.00736ab5.js} +1 -1
  22. package/dist/client/_nuxt/NSelect.vue.d378258a.js +1 -0
  23. package/dist/client/_nuxt/NSelectTabs.vue.515b8214.js +1 -0
  24. package/dist/client/_nuxt/{NSwitch.vue.defcd586.js → NSwitch.vue.8201d15e.js} +1 -1
  25. package/dist/client/_nuxt/{NTip.vue.04791b31.js → NTip.vue.8812abb8.js} +1 -1
  26. package/dist/client/_nuxt/{Navbar.vue.3fbf7ca0.js → Navbar.vue.c509e5d2.js} +1 -1
  27. package/dist/client/_nuxt/{StateEditor.vue.01c203b9.js → StateEditor.vue.2dfb9208.js} +1 -1
  28. package/dist/client/_nuxt/{__blank.3dddd973.js → __blank.6f88f9ac.js} +1 -1
  29. package/dist/client/_nuxt/{analyze-build.3db956f4.js → analyze-build.ad9015ef.js} +1 -1
  30. package/dist/client/_nuxt/{assets.634c950e.js → assets.d0e2ffb5.js} +1 -1
  31. package/dist/client/_nuxt/{client.d5aff798.js → client.237dd3ea.js} +1 -1
  32. package/dist/client/_nuxt/{components.e360f866.js → components.5d298b86.js} +32 -32
  33. package/dist/client/_nuxt/{custom-_name_.95236ea5.js → custom-_name_.6bfb7c0f.js} +1 -1
  34. package/dist/client/_nuxt/{default.8f859e18.js → default.f2c7ccc5.js} +1 -1
  35. package/dist/client/_nuxt/entry.582098fc.css +1 -0
  36. package/dist/client/_nuxt/{entry.b81bf245.js → entry.d12f745d.js} +4 -4
  37. package/dist/client/_nuxt/{error-404.50ed5273.js → error-404.ed94fa51.js} +1 -1
  38. package/dist/client/_nuxt/{error-500.3f0ba72e.js → error-500.7606b55d.js} +1 -1
  39. package/dist/client/_nuxt/{full.778b4958.js → full.69c969de.js} +1 -1
  40. package/dist/client/_nuxt/{hooks.22b55b1c.js → hooks.2100ca5d.js} +1 -1
  41. package/dist/client/_nuxt/imports.cb581504.js +1 -0
  42. package/dist/client/_nuxt/{index.622264a3.js → index.0d56c910.js} +1 -1
  43. package/dist/client/_nuxt/{index.76729ecb.js → index.f204f87e.js} +1 -1
  44. package/dist/client/_nuxt/{json-editor-vue.58ea58a4.js → json-editor-vue.ddceb6bb.js} +1 -1
  45. package/dist/client/_nuxt/{middleware.f7a35d95.js → middleware.688539e5.js} +1 -1
  46. package/dist/client/_nuxt/{modules.15421639.js → modules.bd62827c.js} +2 -2
  47. package/dist/client/_nuxt/{none.3d88124b.js → none.1af6e0ee.js} +1 -1
  48. package/dist/client/_nuxt/{open-graph.73aa4a70.js → open-graph.11338a0a.js} +2 -2
  49. package/dist/client/_nuxt/overview.94507b31.js +1 -0
  50. package/dist/client/_nuxt/{pages.7e22d9e3.js → pages.e761585a.js} +1 -1
  51. package/dist/client/_nuxt/{payload.cc8ba563.js → payload.6d63ca94.js} +1 -1
  52. package/dist/client/_nuxt/{plugins.b4d83e48.js → plugins.37532eb5.js} +1 -1
  53. package/dist/client/_nuxt/runtime-configs.5354fdd6.js +1 -0
  54. package/dist/client/_nuxt/{server-routes.10f98ec2.js → server-routes.6fd21992.js} +1 -1
  55. package/dist/client/_nuxt/settings.5fe86309.js +1 -0
  56. package/dist/client/_nuxt/{state-components.c65acb0d.js → state-components.7bf3566d.js} +1 -1
  57. package/dist/client/_nuxt/{state-modules.e0b57d1b.js → state-modules.065d01b4.js} +1 -1
  58. package/dist/client/_nuxt/{storage-options.f095012b.js → storage-options.f9b1696b.js} +1 -1
  59. package/dist/client/_nuxt/{storage.81e195cf.js → storage.228d88e2.js} +1 -1
  60. package/dist/client/_nuxt/{terminals.57b44373.js → terminals.0377de90.js} +1 -1
  61. package/dist/client/_nuxt/{timeline.e3f428d4.js → timeline.e89330f3.js} +3 -3
  62. package/dist/client/_nuxt/unocss-runtime.a5ba4c7b.js +2 -0
  63. package/dist/client/_nuxt/{virtual-files.02aedd29.js → virtual-files.1f7c68a1.js} +1 -1
  64. package/dist/client/index.html +2 -2
  65. package/dist/client/modules/analyze-build/index.html +2 -2
  66. package/dist/client/modules/assets/index.html +2 -2
  67. package/dist/client/modules/components/index.html +2 -2
  68. package/dist/client/modules/hooks/index.html +2 -2
  69. package/dist/client/modules/imports/index.html +2 -2
  70. package/dist/client/modules/middleware/index.html +2 -2
  71. package/dist/client/modules/modules/index.html +2 -2
  72. package/dist/client/modules/open-graph/index.html +2 -2
  73. package/dist/client/modules/overview/index.html +2 -2
  74. package/dist/client/modules/pages/index.html +2 -2
  75. package/dist/client/modules/payload/index.html +2 -2
  76. package/dist/client/modules/plugins/index.html +2 -2
  77. package/dist/client/modules/runtime-configs/index.html +2 -2
  78. package/dist/client/modules/server-routes/index.html +2 -2
  79. package/dist/client/modules/storage/index.html +2 -2
  80. package/dist/client/modules/terminals/index.html +2 -2
  81. package/dist/client/modules/timeline/index.html +2 -2
  82. package/dist/client/modules/virtual-files/index.html +2 -2
  83. package/dist/client/settings/index.html +2 -2
  84. package/dist/{global-ea55645c.d.ts → global-2a48a9e5.d.ts} +5 -1
  85. package/dist/module.d.ts +1 -1
  86. package/dist/module.json +1 -1
  87. package/dist/runtime/plugins/view/FrameBox.vue +1 -1
  88. package/dist/runtime/plugins/view/Main.vue +3 -3
  89. package/dist/runtime/plugins/view/client.mjs +64 -44
  90. package/dist/runtime/use-nuxt-devtools.d.ts +8 -0
  91. package/dist/runtime/use-nuxt-devtools.mjs +23 -0
  92. package/dist/types.d.ts +1 -1
  93. package/package.json +9 -9
  94. package/dist/client/_nuxt/FilepathItem.vue.a967b383.js +0 -1
  95. package/dist/client/_nuxt/NSelect.vue.7a8edc85.js +0 -1
  96. package/dist/client/_nuxt/entry.2ee3a83f.css +0 -1
  97. package/dist/client/_nuxt/imports.2a0fb129.js +0 -1
  98. package/dist/client/_nuxt/overview.0aabd2ca.js +0 -1
  99. package/dist/client/_nuxt/runtime-configs.15955414.js +0 -1
  100. package/dist/client/_nuxt/settings.b2b35d44.js +0 -1
  101. package/dist/client/_nuxt/unocss-runtime.2f2f07ae.js +0 -2
@@ -18,52 +18,72 @@ export async function setupDevToolsClient({
18
18
  const timeline = initTimelineMetrics();
19
19
  const client = shallowReactive({
20
20
  nuxt: markRaw(nuxt),
21
- appConfig: useAppConfig(),
22
21
  hooks: createHooks(),
23
- getClientHooksMetrics: () => Object.values(clientHooks),
24
- clientPluginMetrics: window.__NUXT_DEVTOOLS_PLUGINS_METRIC__,
25
- clientTimelineMetrics: timeline,
26
- loadingTimeMetrics: timeMetric,
27
- reloadPage() {
28
- location.reload();
29
- },
30
- toggle() {
31
- if (state.value.open)
32
- client.close();
33
- else
34
- client.open();
35
- },
36
- close() {
37
- if (!state.value.open)
38
- return;
39
- state.value.open = false;
40
- if (popupWindow.value) {
41
- try {
42
- popupWindow.value.close();
43
- } catch (e) {
22
+ inspector: getInspectorInstance(),
23
+ getIframe,
24
+ syncClient,
25
+ devtools: {
26
+ toggle() {
27
+ if (state.value.open)
28
+ client.devtools.close();
29
+ else
30
+ client.devtools.open();
31
+ },
32
+ close() {
33
+ if (!state.value.open)
34
+ return;
35
+ state.value.open = false;
36
+ if (popupWindow.value) {
37
+ try {
38
+ popupWindow.value.close();
39
+ } catch (e) {
40
+ }
41
+ popupWindow.value = null;
44
42
  }
45
- popupWindow.value = null;
43
+ },
44
+ open() {
45
+ if (state.value.open)
46
+ return;
47
+ state.value.open = true;
48
+ return nextTick(() => {
49
+ client.syncClient();
50
+ });
51
+ },
52
+ async navigate(path) {
53
+ if (!state.value.open)
54
+ await client.devtools.open();
55
+ await client.hooks.callHook("host:action:navigate", path);
56
+ },
57
+ async reload() {
58
+ await client.hooks.callHook("host:action:reload");
46
59
  }
47
60
  },
48
- open() {
49
- if (state.value.open)
50
- return;
51
- state.value.open = true;
52
- nextTick(() => {
53
- client.updateClient();
54
- });
61
+ app: {
62
+ appConfig: useAppConfig(),
63
+ reload() {
64
+ location.reload();
65
+ },
66
+ navigate(path, hard = false) {
67
+ if (hard)
68
+ location.href = path;
69
+ else
70
+ router.push(path);
71
+ },
72
+ colorMode,
73
+ frameState: state
55
74
  },
56
- inspector: getInspectorInstance(),
57
- colorMode,
58
- getIframe,
59
- updateClient,
60
- frameState: state
75
+ metrics: {
76
+ clientPlugins: () => window.__NUXT_DEVTOOLS_PLUGINS_METRIC__,
77
+ clientHooks: () => Object.values(clientHooks),
78
+ clientTimeline: () => timeline,
79
+ loading: () => timeMetric
80
+ }
61
81
  });
82
+ window.__NUXT_DEVTOOLS_HOST__ = client;
62
83
  let iframe;
63
- function updateClient() {
84
+ function syncClient() {
64
85
  if (!client.inspector)
65
86
  client.inspector = getInspectorInstance();
66
- client.clientPluginMetrics = window.__NUXT_DEVTOOLS_PLUGINS_METRIC__;
67
87
  try {
68
88
  iframe?.contentWindow?.__NUXT_DEVTOOLS_VIEW__?.setClient(client);
69
89
  } catch (e) {
@@ -80,7 +100,7 @@ export async function setupDevToolsClient({
80
100
  iframe.src = initialUrl;
81
101
  iframe.onload = async () => {
82
102
  await waitForClientInjection();
83
- client.updateClient();
103
+ client.syncClient();
84
104
  };
85
105
  } catch (e) {
86
106
  console.error(e);
@@ -105,7 +125,7 @@ export async function setupDevToolsClient({
105
125
  resolve();
106
126
  } else if (retry-- <= 0) {
107
127
  clearInterval(interval);
108
- reject("Nuxt Devtools client injection failed");
128
+ reject("Nuxt DevTools client injection failed");
109
129
  }
110
130
  }, timeout);
111
131
  });
@@ -153,7 +173,7 @@ export async function setupDevToolsClient({
153
173
  clientRef.value = client;
154
174
  const documentPictureInPicture = window.documentPictureInPicture;
155
175
  if (documentPictureInPicture?.requestWindow) {
156
- client.popup = async () => {
176
+ client.devtools.popup = async () => {
157
177
  const iframe2 = getIframe();
158
178
  if (!iframe2)
159
179
  return;
@@ -189,14 +209,14 @@ export async function setupDevToolsClient({
189
209
  });
190
210
  };
191
211
  }
192
- client.updateClient();
212
+ client.syncClient();
193
213
  const holder = document.createElement("div");
194
214
  holder.id = "nuxt-devtools-container";
195
215
  holder.setAttribute("data-v-inspector-ignore", "true");
196
216
  document.body.appendChild(holder);
197
217
  addEventListener("keydown", (e) => {
198
218
  if (e.code === "KeyD" && e.altKey && e.shiftKey)
199
- client.toggle();
219
+ client.devtools.toggle();
200
220
  });
201
221
  const app = createApp({
202
222
  render: () => h(Main, { client }),
@@ -284,8 +304,8 @@ function setupReactivity(client, router, timeMetric) {
284
304
  }, 100, { trailing: true });
285
305
  watch(() => [
286
306
  client.nuxt.payload,
287
- client.colorMode.value,
288
- client.loadingTimeMetrics,
307
+ client.app.colorMode.value,
308
+ client.metrics.loading(),
289
309
  timeMetric
290
310
  ], () => {
291
311
  refreshReactivity();
@@ -0,0 +1,8 @@
1
+ import type { Ref } from 'vue';
2
+ import type { NuxtDevtoolsHostClient } from '../types';
3
+ /**
4
+ * Get Nuxt DevTools client for host app
5
+ *
6
+ * Returns undefined if not in development mode or the devtools is not enabled
7
+ */
8
+ export declare function useNuxtDevTools(): Ref<NuxtDevtoolsHostClient | undefined>;
@@ -0,0 +1,23 @@
1
+ import { shallowRef } from "vue";
2
+ export function useNuxtDevTools() {
3
+ const r = shallowRef();
4
+ if (!process.dev)
5
+ return r;
6
+ if (process.server)
7
+ return r;
8
+ if (window.__NUXT_DEVTOOLS_HOST__) {
9
+ r.value = window.__NUXT_DEVTOOLS_HOST__;
10
+ } else {
11
+ Object.defineProperty(window, "__NUXT_DEVTOOLS_HOST__", {
12
+ set(value) {
13
+ r.value = value;
14
+ },
15
+ get() {
16
+ return r.value;
17
+ },
18
+ enumerable: false,
19
+ configurable: true
20
+ });
21
+ }
22
+ return r;
23
+ }
package/dist/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import './global-ea55645c.js';
1
+ import './global-2a48a9e5.js';
2
2
  import { ModuleStaticInfo } from '@nuxt/devtools-kit/types';
3
3
  export * from '@nuxt/devtools-kit/types';
4
4
  import 'vite-plugin-vue-inspector';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@nuxt/devtools",
3
3
  "type": "module",
4
- "version": "0.7.6",
4
+ "version": "0.8.0",
5
5
  "license": "MIT",
6
6
  "repository": "nuxt/devtools",
7
7
  "exports": {
@@ -62,8 +62,8 @@
62
62
  "wait-on": "^7.0.1",
63
63
  "which": "^3.0.1",
64
64
  "ws": "^8.13.0",
65
- "@nuxt/devtools-kit": "0.7.6",
66
- "@nuxt/devtools-wizard": "0.7.6"
65
+ "@nuxt/devtools-kit": "0.8.0",
66
+ "@nuxt/devtools-wizard": "0.8.0"
67
67
  },
68
68
  "devDependencies": {
69
69
  "@antfu/utils": "^0.7.5",
@@ -78,10 +78,10 @@
78
78
  "@parcel/watcher": "^2.2.0",
79
79
  "@types/markdown-it-link-attributes": "^3.0.1",
80
80
  "@types/ua-parser-js": "^0.7.36",
81
- "@unocss/nuxt": "^0.54.2",
82
- "@unocss/preset-icons": "^0.54.2",
83
- "@unocss/preset-uno": "^0.54.2",
84
- "@unocss/runtime": "^0.54.2",
81
+ "@unocss/nuxt": "^0.55.0",
82
+ "@unocss/preset-icons": "^0.55.0",
83
+ "@unocss/preset-uno": "^0.55.0",
84
+ "@unocss/runtime": "^0.55.0",
85
85
  "@vueuse/nuxt": "^10.3.0",
86
86
  "esno": "^0.17.0",
87
87
  "flatted": "^3.2.7",
@@ -102,7 +102,7 @@
102
102
  "splitpanes": "^3.1.5",
103
103
  "theme-vitesse": "^0.7.2",
104
104
  "ua-parser-js": "^1.0.35",
105
- "unocss": "^0.54.2",
105
+ "unocss": "^0.55.0",
106
106
  "vanilla-jsoneditor": "^0.17.8",
107
107
  "vis-data": "^7.1.6",
108
108
  "vis-network": "^9.1.6",
@@ -111,7 +111,7 @@
111
111
  "vue-virtual-scroller": "2.0.0-beta.8",
112
112
  "xterm": "^5.2.1",
113
113
  "xterm-addon-fit": "^0.7.0",
114
- "@nuxt/devtools": "0.7.6"
114
+ "@nuxt/devtools": "0.8.0"
115
115
  },
116
116
  "scripts": {
117
117
  "build": "pnpm dev:prepare && pnpm build:module && pnpm build:client && esno scripts/prepare.ts",
@@ -1 +0,0 @@
1
- import{d as u,a6 as f,a7 as c,a as k,b4 as v,o as t,h as y,j as B,m as s,F as p,v as d,t as n,f as a,k as C,p as N,E as b,ap as g}from"./entry.b81bf245.js";const E={key:0,op50:""},F=u({__name:"FilepathItem",props:{filepath:{},lineBreak:{type:Boolean},subpath:{type:Boolean},override:{}},setup(m){const r=m,h=f(),l=c(),o=k(()=>r.filepath&&l.value?v(r.filepath,l.value.rootDir):{path:r.filepath||""});return(e,i)=>(t(),y(g(e.filepath?"button":"span"),{class:b([e.filepath?"hover:underline":"",e.lineBreak?"":"ws-nowrap of-hidden truncate"]),"font-mono":"",title:e.override||e.filepath,onClick:i[0]||(i[0]=w=>e.filepath&&a(h)(e.filepath))},{default:B(()=>[e.override?(t(),s(p,{key:0},[d(n(e.override),1)],64)):a(o).moduleName?(t(),s(p,{key:1},[C("span",null,n(a(o).moduleName),1),e.subpath?(t(),s("span",E,n(a(o).path.slice(a(o).moduleName.length)),1)):N("",!0)],64)):(t(),s(p,{key:2},[d(n(a(o).path),1)],64))]),_:1},8,["class","title"]))}});export{F as _};
@@ -1 +0,0 @@
1
- import{d as u,a4 as p,m as l,a5 as t,H as f,bC as m,f as b,k as h,t as _,p as n,l as v,o as s,h as k,a0 as V}from"./entry.b81bf245.js";const y={class:"n-text-input flex flex items-center border n-border-base rounded px-2 py-1 focus-within:n-focus-base focus-within:border-context n-bg-base"},B=["disabled"],w={key:0,value:"",disabled:"",hidden:""},g=u({__name:"NSelect",props:{modelValue:{default:void 0},placeholder:{default:""},icon:{default:""},disabled:{type:Boolean,default:!1}},setup(d,{emit:i}){const o=p(d,"modelValue",i,{passive:!0});return(e,a)=>{const r=V;return s(),l("div",y,[t(e.$slots,"icon",{},()=>[e.icon?(s(),k(r,{key:0,icon:e.icon,class:"mr-0.4em text-1.1em op50"},null,8,["icon"])):n("",!0)]),f(h("select",{"onUpdate:modelValue":a[0]||(a[0]=c=>v(o)?o.value=c:null),disabled:e.disabled,class:"w-full flex-auto n-bg-base !outline-none"},[e.placeholder?(s(),l("option",w,_(e.placeholder),1)):n("",!0),t(e.$slots,"default")],8,B),[[m,b(o)]])])}}});export{g as _};