@nuxt/devtools-nightly 3.2.4-29563482.f9a1d97 → 4.0.0-29884714.dcb247f

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 (151) hide show
  1. package/README.md +48 -10
  2. package/dist/chunks/analyze-build.mjs +31 -3
  3. package/dist/chunks/assets.mjs +24 -0
  4. package/dist/chunks/code-server.mjs +74 -0
  5. package/dist/chunks/data-inspector.mjs +82 -0
  6. package/dist/chunks/module-main.mjs +906 -10876
  7. package/dist/chunks/og.mjs +32 -0
  8. package/dist/chunks/timeline.mjs +102 -41
  9. package/dist/chunks/vite-inspect.mjs +89 -53
  10. package/dist/chunks/vue-devtools.mjs +48 -5
  11. package/dist/dirs.d.mts +1 -3
  12. package/dist/dirs.mjs +2 -4
  13. package/dist/module.d.mts +1 -1
  14. package/dist/module.json +2 -2
  15. package/dist/module.mjs +1 -1
  16. package/dist/runtime/plugins/devtools.client.d.ts +3 -2
  17. package/dist/runtime/plugins/devtools.client.js +3 -6
  18. package/dist/runtime/plugins/view/client.js +15 -82
  19. package/dist/runtime/plugins/vite-devtools.client.js +5 -1
  20. package/dist/runtime/shared/hooks.d.ts +10 -2
  21. package/dist/shared/{devtools-nightly.LsRDzDTD.d.mts → devtools-nightly.DIKI0iiX.d.mts} +1 -7
  22. package/dist/shared/devtools-nightly.DnJkSJYB.mjs +122 -0
  23. package/dist/types.d.mts +2 -31
  24. package/dist/webcomponents/index.mjs +42 -44
  25. package/package.json +90 -88
  26. package/.discoveryrc.cjs +0 -13
  27. package/dist/chunks/vscode.mjs +0 -170
  28. package/dist/client/200.html +0 -1
  29. package/dist/client/404.html +0 -1
  30. package/dist/client/_nuxt/__blank-cpzbm3dn.js +0 -1
  31. package/dist/client/_nuxt/_plugin-vue_export-helper-n58akrbk.js +0 -1
  32. package/dist/client/_nuxt/analyze-build-e7v5vkef.js +0 -1
  33. package/dist/client/_nuxt/assets-b5c187l4.js +0 -6
  34. package/dist/client/_nuxt/assets.css-hmxl533k.css +0 -1
  35. package/dist/client/_nuxt/builds/latest.json +0 -1
  36. package/dist/client/_nuxt/builds/meta/fac6756b-364c-424d-9354-b01ecbf17dce.json +0 -1
  37. package/dist/client/_nuxt/client-im47u3kz.js +0 -1
  38. package/dist/client/_nuxt/code-diff-idsu3m0z.js +0 -8
  39. package/dist/client/_nuxt/code-snippets-k81hoi4s.js +0 -1
  40. package/dist/client/_nuxt/color-b9xoe9j2.js +0 -1
  41. package/dist/client/_nuxt/components-bmictfph.js +0 -1
  42. package/dist/client/_nuxt/composable-item-cza22cup.js +0 -1
  43. package/dist/client/_nuxt/composables-b2ccklz4.js +0 -1
  44. package/dist/client/_nuxt/constants-ih922r91.js +0 -1
  45. package/dist/client/_nuxt/custom-_name_-gqm5kr56.js +0 -1
  46. package/dist/client/_nuxt/data-schema-button-b308wyi0.js +0 -1
  47. package/dist/client/_nuxt/data-schema-drawer-lr34uwsh.js +0 -2
  48. package/dist/client/_nuxt/debug-kgc8fptp.js +0 -1
  49. package/dist/client/_nuxt/default-jvhm51ri.js +0 -1
  50. package/dist/client/_nuxt/dev-auth-ojiqold5.js +0 -1
  51. package/dist/client/_nuxt/dist-duc3zu0y.js +0 -1
  52. package/dist/client/_nuxt/dist-m49wlq01.js +0 -1
  53. package/dist/client/_nuxt/dist-mnod32r1.js +0 -1
  54. package/dist/client/_nuxt/duration-display-f7ucshmo.js +0 -1
  55. package/dist/client/_nuxt/entry.css-me26coxn.css +0 -1
  56. package/dist/client/_nuxt/error-404-nggtc73s.js +0 -1
  57. package/dist/client/_nuxt/error-404.css-j1aav08u.css +0 -1
  58. package/dist/client/_nuxt/error-500-dym2gzqx.js +0 -1
  59. package/dist/client/_nuxt/error-500.css-eu9fz4va.css +0 -1
  60. package/dist/client/_nuxt/error-fqinfa1x.js +0 -9
  61. package/dist/client/_nuxt/filepath-item-e1s52fbh.js +0 -1
  62. package/dist/client/_nuxt/full-et0weok9.js +0 -1
  63. package/dist/client/_nuxt/help-fab-hz6r2oxa.js +0 -1
  64. package/dist/client/_nuxt/help-fab.css-ms50khsu.css +0 -1
  65. package/dist/client/_nuxt/hooks-i7nsduqp.js +0 -1
  66. package/dist/client/_nuxt/i1wyrjhl.js +0 -4
  67. package/dist/client/_nuxt/imports-9o2qs53q.js +0 -1
  68. package/dist/client/_nuxt/launch-page-hpkkqhit.js +0 -1
  69. package/dist/client/_nuxt/mitt.es-fjx0h8xe.js +0 -1
  70. package/dist/client/_nuxt/modules-jok0opuq.js +0 -1
  71. package/dist/client/_nuxt/nbadge-m66xoquo.js +0 -1
  72. package/dist/client/_nuxt/nbutton-gygn07c2.js +0 -1
  73. package/dist/client/_nuxt/ncard-mqcl8pso.js +0 -1
  74. package/dist/client/_nuxt/ncheckbox-c0r45qtu.js +0 -1
  75. package/dist/client/_nuxt/ncode-block-figzf35k.js +0 -2
  76. package/dist/client/_nuxt/ncode-block.css-o2ixs97j.css +0 -1
  77. package/dist/client/_nuxt/ndrawer-bgqyrlmt.js +0 -1
  78. package/dist/client/_nuxt/ndropdown-cip8lboe.js +0 -1
  79. package/dist/client/_nuxt/nicon-m1crov2l.js +0 -1
  80. package/dist/client/_nuxt/nicon-title-tqdvw0w0.js +0 -1
  81. package/dist/client/_nuxt/nlink-od4lllbl.js +0 -1
  82. package/dist/client/_nuxt/nmarkdown-hw0hmqw7.js +0 -1
  83. package/dist/client/_nuxt/nnavbar-lpozm5fj.js +0 -1
  84. package/dist/client/_nuxt/none-bdxkqeml.js +0 -1
  85. package/dist/client/_nuxt/npanel-grids-dd23ifsw.js +0 -1
  86. package/dist/client/_nuxt/nsection-block-lqrohs9v.js +0 -1
  87. package/dist/client/_nuxt/nsection-block.css-h05mpq8x.css +0 -1
  88. package/dist/client/_nuxt/nselect-gczoit0g.js +0 -1
  89. package/dist/client/_nuxt/nselect-tabs-bsw5fg3d.js +0 -1
  90. package/dist/client/_nuxt/nswitch-ke379yjx.js +0 -1
  91. package/dist/client/_nuxt/ntext-input-cygthohl.js +0 -1
  92. package/dist/client/_nuxt/ntip-ke63ovgc.js +0 -1
  93. package/dist/client/_nuxt/nuxt-link-bumooa9d.js +0 -1
  94. package/dist/client/_nuxt/nuxt-otp6bp04.js +0 -1
  95. package/dist/client/_nuxt/open-graph-lumhcitx.js +0 -3
  96. package/dist/client/_nuxt/open-graph.css-dk03m1qz.css +0 -1
  97. package/dist/client/_nuxt/overview-gvx68ogm.js +0 -1
  98. package/dist/client/_nuxt/pages-cf1hvns3.js +0 -1
  99. package/dist/client/_nuxt/pages-lgihsvbt.js +0 -1
  100. package/dist/client/_nuxt/payload-fvgw4hh9.js +0 -1
  101. package/dist/client/_nuxt/pinia-lmrgyjxw.js +0 -1
  102. package/dist/client/_nuxt/plugins-ccaip8nh.js +0 -1
  103. package/dist/client/_nuxt/ready-dadbdj5i.js +0 -1
  104. package/dist/client/_nuxt/render-tree-corj3giw.js +0 -1
  105. package/dist/client/_nuxt/rolldown-runtime-oipoa1or.js +0 -1
  106. package/dist/client/_nuxt/rpc-ez4fzlum.js +0 -1
  107. package/dist/client/_nuxt/runtime-configs-im0uu24n.js +0 -1
  108. package/dist/client/_nuxt/server-discovery-ffkkczqi.js +0 -1
  109. package/dist/client/_nuxt/server-route-inputs-lspeoiem.js +0 -1
  110. package/dist/client/_nuxt/server-routes-dhvqrowz.js +0 -7
  111. package/dist/client/_nuxt/server-tasks-mr9ezn8q.js +0 -1
  112. package/dist/client/_nuxt/settings-issronwn.js +0 -1
  113. package/dist/client/_nuxt/splitpanes.es-bxyirks2.js +0 -1
  114. package/dist/client/_nuxt/stacktrace-list-hiui24c3.js +0 -1
  115. package/dist/client/_nuxt/state-components-fbls8ka7.js +0 -1
  116. package/dist/client/_nuxt/state-editor-c7e04uj2.js +0 -1
  117. package/dist/client/_nuxt/state-modules-inqbwd7z.js +0 -1
  118. package/dist/client/_nuxt/state-routes-jln33b1m.js +0 -1
  119. package/dist/client/_nuxt/state-tabs-etl5jr30.js +0 -1
  120. package/dist/client/_nuxt/storage-husj5pg6.js +0 -1
  121. package/dist/client/_nuxt/storage-options-cth3coln.js +0 -1
  122. package/dist/client/_nuxt/telemetry-eqv6a0hn.js +0 -1
  123. package/dist/client/_nuxt/terminals-kitd8oja.js +0 -1
  124. package/dist/client/_nuxt/terminals.css-mejv43xm.css +0 -1
  125. package/dist/client/_nuxt/timeline-gr4tcvcz.js +0 -31
  126. package/dist/client/_nuxt/timeline.css-m03aec2q.css +0 -1
  127. package/dist/client/_nuxt/unocss-runtime-cpug61u1.js +0 -1
  128. package/dist/client/_nuxt/utils-nbkl6byi.js +0 -2
  129. package/dist/client/_nuxt/vendor/json-editor-vue-eojr4v24.js +0 -3869
  130. package/dist/client/_nuxt/vendor/json-editor-vue.css-lkbe0qhh.css +0 -1
  131. package/dist/client/_nuxt/vendor/markdown-it-ckeo8pwp.js +0 -14
  132. package/dist/client/_nuxt/vendor/quicktype-core-k4qx3809.js +0 -929
  133. package/dist/client/_nuxt/vendor/shiki-lqo1hg2n.js +0 -153
  134. package/dist/client/_nuxt/vendor/unocss-k727ub0h.js +0 -3
  135. package/dist/client/_nuxt/vendor/unocss.css-3gd0e2sv.css +0 -1
  136. package/dist/client/_nuxt/vendor/vis-id8udisj.js +0 -26
  137. package/dist/client/_nuxt/vendor/xterm-ed0pys2e.js +0 -36
  138. package/dist/client/_nuxt/vendor/xterm.css-jqmddlol.css +0 -1
  139. package/dist/client/_nuxt/virtual-files-ky9cc4av.js +0 -1
  140. package/dist/client/_nuxt/virtual-files.css-l97kh4kx.css +0 -1
  141. package/dist/client/_nuxt/vue-devtools-dunhx2nz.js +0 -4
  142. package/dist/client/_nuxt/vue-router-jbnxw7nb.js +0 -1
  143. package/dist/client/discovery/index.html +0 -611
  144. package/dist/client/index.html +0 -1
  145. package/dist/client/nuxt.svg +0 -3
  146. package/dist/runtime/plugins/view/state.d.ts +0 -2
  147. package/dist/runtime/plugins/view/state.js +0 -12
  148. package/dist/runtime/vue-devtools-client.d.ts +0 -2
  149. package/dist/runtime/vue-devtools-client.js +0 -8
  150. package/dist/shared/devtools-nightly.COlX0Gls.mjs +0 -114
  151. package/types.d.ts +0 -1
package/README.md CHANGED
@@ -24,15 +24,15 @@ Unleash Nuxt Developer Experience.
24
24
  </p>
25
25
 
26
26
  > [!NOTE]
27
- > You are current at the `main` branch for v4 development. The latest stable branch is [`v3`](https://github.com/nuxt/devtools/tree/v3).
27
+ > You are at the `main` branch for v4. The v3 branch is [`v3`](https://github.com/nuxt/devtools/tree/v3).
28
28
 
29
29
  <br>
30
30
 
31
31
  ## Installation
32
32
 
33
- > Nuxt DevTools v2 requires **Nuxt v3.15.0 or higher**.
33
+ > Nuxt DevTools v4 requires **Nuxt v4.5.0 or higher** (Vite 8). It is built on [Vite DevTools](https://github.com/vitejs/devtools) and shows up as the `Nuxt` group inside the Vite DevTools panel.
34
34
 
35
- Nuxt DevTools is **enabled by default** in Nuxt v3.8.0. You can press <kbd>Shift</kbd> + <kbd>Alt</kbd> / <kbd>⇧ Shift</kbd> + <kbd>⌥ Option</kbd> + <kbd>D</kbd> in your app to open it up.
35
+ Nuxt DevTools is **enabled by default**. You can press <kbd>Shift</kbd> + <kbd>Alt</kbd> / <kbd>⇧ Shift</kbd> + <kbd>⌥ Option</kbd> + <kbd>D</kbd> in your app to open it up.
36
36
 
37
37
  If you want to explicitly enable or disable Nuxt DevTools, you can update your `nuxt.config` with:
38
38
 
@@ -44,21 +44,57 @@ export default defineNuxtConfig({
44
44
  })
45
45
  ```
46
46
 
47
+ ### Nuxt 4
48
+
49
+ Nuxt 5 ships with Nuxt DevTools v4. Nuxt 4.5+ still bundles v3; override `@nuxt/devtools` to `^4.0.0` with your package manager (`overrides` for npm and pnpm, `resolutions` for yarn), remove your lockfile and reinstall. See the [upgrade guide](https://devtools.nuxt.com/guide/upgrading-to-v4) for details and for what changed.
50
+
47
51
  ### Nightly Release Channel
48
52
 
49
53
  Similar to [Nuxt's Nightly Channel](https://nuxt.com/docs/guide/going-further/nightly-release-channel), DevTools also offers a nightly release channel, that automatically releases for every commit to `main` branch.
50
54
 
51
- You can opt-in to the nightly release channel by running:
55
+ You can opt-in to the nightly release channel by using package manager resolutions:
56
+
57
+ <details>
58
+ <summary>npm</summary>
59
+
60
+ ```json
61
+ {
62
+ "overrides": {
63
+ "@nuxt/devtools": "npm:@nuxt/devtools-nightly@latest"
64
+ }
65
+ }
66
+ ```
67
+
68
+ </details>
69
+
70
+ <details>
71
+ <summary>yarn</summary>
52
72
 
53
- ```diff
73
+ ```json
54
74
  {
55
- "devDependencies": {
56
- -- "@nuxt/devtools": "^0.1.0"
57
- ++ "@nuxt/devtools": "npm:@nuxt/devtools-nightly@latest"
75
+ "resolutions": {
76
+ "@nuxt/devtools": "npm:@nuxt/devtools-nightly@latest"
58
77
  }
59
78
  }
60
79
  ```
61
80
 
81
+ </details>
82
+
83
+ <details>
84
+ <summary>pnpm</summary>
85
+
86
+ ```json
87
+ {
88
+ "pnpm": {
89
+ "overrides": {
90
+ "@nuxt/devtools": "npm:@nuxt/devtools-nightly@latest"
91
+ }
92
+ }
93
+ }
94
+ ```
95
+
96
+ </details>
97
+
62
98
  Remove lockfile (`package-lock.json`, `yarn.lock`, or `pnpm-lock.yaml`) and reinstall dependencies.
63
99
 
64
100
  ### Module Options
@@ -71,8 +107,8 @@ export default defineNuxtConfig({
71
107
  devtools: {
72
108
  // Enable devtools (default: true)
73
109
  enabled: true,
74
- // VS Code Server options
75
- vscode: {},
110
+ // Coder code-server options (enabled by default)
111
+ codeServer: {},
76
112
  // ...other options
77
113
  }
78
114
  })
@@ -98,6 +134,8 @@ Nuxt DevTools collects anonymous telemetry data about general usage. This helps
98
134
 
99
135
  Nuxt DevTools' telemetry data is piped through [Nuxt Telemetry](https://github.com/nuxt/telemetry), meaning that Nuxt DevTools will respect your local and global Nuxt Telemetry settings. You can also opt-out Nuxt DevTools' telemetry in the Nuxt DevTools settings.
100
136
 
137
+ Nuxt DevTools also respects the [`DO_NOT_TRACK`](https://donottrack.sh/) environment variable convention — set `DO_NOT_TRACK=1` in your environment to disable Nuxt DevTools telemetry regardless of any other setting.
138
+
101
139
  The data we collect is completely anonymous, not traceable to the source (using hash+seed), and only meaningful in aggregate form. No data we collect is personally identifiable or trackable.
102
140
 
103
141
  ### Events
@@ -1,8 +1,33 @@
1
1
  import { addVitePlugin } from '@nuxt/kit';
2
2
  import { resolve, join } from 'pathe';
3
3
  import { readdir, lstat } from 'node:fs/promises';
4
- import { createVitePluginInspect } from './vite-inspect.mjs';
4
+ import { isVitePluginInspectAvailable, createVitePluginInspect } from './vite-inspect.mjs';
5
5
  import '@nuxt/devtools-kit';
6
+ import '@vitejs/devtools-kit/node';
7
+ import 'local-pkg';
8
+ import './module-main.mjs';
9
+ import 'node:os';
10
+ import 'consola/utils';
11
+ import 'devframe/utils/serve-static';
12
+ import 'verkit';
13
+ import 'vite';
14
+ import '../shared/devtools-nightly.DnJkSJYB.mjs';
15
+ import '../dirs.mjs';
16
+ import 'node:path';
17
+ import 'node:url';
18
+ import 'node:child_process';
19
+ import 'node:fs';
20
+ import 'node:util';
21
+ import 'tinyglobby';
22
+ import 'destr';
23
+ import '../../dist/runtime/shared/hooks.js';
24
+ import 'devframe/utils/hash';
25
+ import 'magicast';
26
+ import 'magicast/helpers';
27
+ import 'node:process';
28
+ import 'node:module';
29
+ import '@vitejs/devtools-kit/constants';
30
+ import 'perfect-debounce';
6
31
 
7
32
  async function getFolderSize(dir) {
8
33
  const dirents = await readdir(dir, {
@@ -37,7 +62,7 @@ async function getFolderSize(dir) {
37
62
  }
38
63
 
39
64
  async function setup(nuxt, options) {
40
- if (options.viteInspect !== false) {
65
+ if (options.viteInspect !== false && isVitePluginInspectAvailable(nuxt.options.rootDir)) {
41
66
  addVitePlugin(
42
67
  await createVitePluginInspect({
43
68
  build: true,
@@ -48,7 +73,10 @@ async function setup(nuxt, options) {
48
73
  nuxt.hook("build:analyze:done", async (meta) => {
49
74
  const _meta = meta;
50
75
  _meta.size = _meta.size || {};
51
- const dirs = [join(meta.buildDir, "dist/client"), meta.outDir];
76
+ const dirs = [
77
+ join(meta.buildDir, "dist/client"),
78
+ meta.outDir
79
+ ];
52
80
  const [clientBundleSize, nitroBundleSize] = await Promise.all(dirs.map(getFolderSize));
53
81
  _meta.size.clientBundle = clientBundleSize;
54
82
  _meta.size.nitroBundle = nitroBundleSize;
@@ -0,0 +1,24 @@
1
+ import { createAssetsDevframe } from '@devframes/plugin-assets';
2
+ import { onDevtoolsReady, NUXT_DEVTOOLS_GROUP_ID } from '@nuxt/devtools-kit';
3
+ import { resolve } from 'pathe';
4
+ import { d as defaultAllowedExtensions } from '../shared/devtools-nightly.DnJkSJYB.mjs';
5
+ import '@nuxt/kit';
6
+
7
+ function setup({ nuxt, options }) {
8
+ const definition = createAssetsDevframe({
9
+ dir: resolve(nuxt.options.srcDir, nuxt.options.dir.public),
10
+ baseURL: nuxt.options.app.baseURL,
11
+ uploadExtensions: options.assets?.uploadExtensions || defaultAllowedExtensions
12
+ });
13
+ onDevtoolsReady((kit) => {
14
+ const services = definition.services?.filter((service) => !kit.services.has(service.package));
15
+ return kit.install({ ...definition, services }, {
16
+ dock: {
17
+ groupId: NUXT_DEVTOOLS_GROUP_ID,
18
+ category: "analyze"
19
+ }
20
+ });
21
+ }, nuxt);
22
+ }
23
+
24
+ export { setup };
@@ -0,0 +1,74 @@
1
+ import { createCodeServerDevframe } from '@devframes/plugin-code-server';
2
+ import { setupCodeServer } from '@devframes/plugin-code-server/node';
3
+ import { deprecate, onDevtoolsReady, NUXT_DEVTOOLS_GROUP_ID } from '@nuxt/devtools-kit';
4
+
5
+ const RESERVED_ARGS = ["--auth", "--bind-addr", "--cookie-suffix"];
6
+ const RESERVED_ENV = ["PASSWORD", "HASHED_PASSWORD"];
7
+ function matchesOption(arg, option) {
8
+ return arg === option || arg.startsWith(`${option}=`);
9
+ }
10
+ function resolveCodeServerOptions(options, rootDir) {
11
+ const args = options?.args;
12
+ const reservedArg = args?.find((arg) => RESERVED_ARGS.some((option) => matchesOption(arg, option)));
13
+ if (reservedArg) {
14
+ throw new Error(
15
+ `[Nuxt DevTools] codeServer.args cannot override ${reservedArg.split("=")[0]}. Configure host and cookieSuffix through their dedicated codeServer options; authentication is managed automatically.`
16
+ );
17
+ }
18
+ const env = options?.env;
19
+ const reservedEnv = RESERVED_ENV.find((key) => Object.hasOwn(env ?? {}, key));
20
+ if (reservedEnv) {
21
+ throw new Error(
22
+ `[Nuxt DevTools] codeServer.env cannot set ${reservedEnv}. Code Server authentication credentials are generated and managed automatically.`
23
+ );
24
+ }
25
+ return {
26
+ // The 0.7 plugin also knows about Microsoft's serve-web and tunnels. Nuxt
27
+ // intentionally exposes only Coder code-server for this integration.
28
+ backend: "code-server",
29
+ bin: options?.bin,
30
+ cwd: options?.cwd ?? rootDir,
31
+ serverPort: options?.serverPort,
32
+ host: options?.host,
33
+ args,
34
+ env,
35
+ cookieSuffix: options?.cookieSuffix,
36
+ startTimeout: options?.startTimeout
37
+ };
38
+ }
39
+ function setup(ctx) {
40
+ const { nuxt, options } = ctx;
41
+ if (options.vscode !== void 0) {
42
+ deprecate(nuxt, "NDT_DEP_0008", {
43
+ api: "devtools.vscode",
44
+ replacement: "devtools.codeServer"
45
+ });
46
+ }
47
+ if (options.codeServer?.enabled === false)
48
+ return;
49
+ const codeServerOptions = resolveCodeServerOptions(options.codeServer, nuxt.options.rootDir);
50
+ const definition = createCodeServerDevframe(codeServerOptions);
51
+ let supervisor;
52
+ let setupPromise;
53
+ const mountedDefinition = {
54
+ ...definition,
55
+ async setup(devframeCtx) {
56
+ setupPromise = setupCodeServer(devframeCtx, codeServerOptions);
57
+ supervisor = await setupPromise;
58
+ }
59
+ };
60
+ nuxt.hook("close", async () => {
61
+ await setupPromise;
62
+ supervisor?.dispose();
63
+ });
64
+ onDevtoolsReady((kit) => {
65
+ return kit.install(mountedDefinition, {
66
+ dock: {
67
+ groupId: NUXT_DEVTOOLS_GROUP_ID,
68
+ category: "modules"
69
+ }
70
+ });
71
+ }, nuxt);
72
+ }
73
+
74
+ export { resolveCodeServerOptions, setup };
@@ -0,0 +1,82 @@
1
+ import { registerDataSource, createDataInspectorDevframe } from '@devframes/plugin-data-inspector';
2
+ import { onDevtoolsReady, NUXT_DEVTOOLS_GROUP_ID, deprecate } from '@nuxt/devtools-kit';
3
+
4
+ const captured = {};
5
+ function normalizeViteConfig(config) {
6
+ return {
7
+ ...config,
8
+ environments: Object.fromEntries(
9
+ Object.entries(config.env ?? {}).map(([key, _]) => {
10
+ return [key, null];
11
+ })
12
+ ),
13
+ plugins: (config.plugins ?? []).map((i) => {
14
+ const clone = { ...i };
15
+ delete clone.api;
16
+ return clone;
17
+ }),
18
+ inlineConfig: null
19
+ };
20
+ }
21
+ function setup(ctx) {
22
+ const { nuxt } = ctx;
23
+ nuxt.hook("nitro:build:before", (nitro) => {
24
+ captured.nitro = nitro;
25
+ });
26
+ nuxt.hook("vite:serverCreated", (server) => {
27
+ captured.vite = server;
28
+ });
29
+ const dataSource = registerDataSource({
30
+ id: "nuxt:application",
31
+ title: "Nuxt Application",
32
+ description: "Live Nuxt, Nitro, and Vite configuration",
33
+ icon: "i-ph:database-duotone",
34
+ static: false,
35
+ data: () => ({
36
+ nuxt: nuxt.options,
37
+ nitro: captured.nitro?.options,
38
+ vite: captured.vite
39
+ }),
40
+ queries: [
41
+ { title: "Overview", query: "", excludeFunctions: true },
42
+ { title: "Nuxt modules", query: "nuxt.modules", excludeFunctions: true },
43
+ { title: "Vite plugins", query: "vite.config.plugins", excludeFunctions: true },
44
+ { title: "Vite config", query: "vite.config", excludeFunctions: true },
45
+ { title: "Vite environments", query: "vite.environments", excludeFunctions: true },
46
+ { title: "Nitro routes", query: "nitro.handlers", excludeFunctions: true }
47
+ ]
48
+ });
49
+ nuxt.hook("close", () => {
50
+ dataSource.unregister();
51
+ captured.nitro = void 0;
52
+ captured.vite = void 0;
53
+ });
54
+ const definition = createDataInspectorDevframe({ exampleSource: false });
55
+ onDevtoolsReady((kit) => {
56
+ return kit.install(definition, {
57
+ dock: {
58
+ groupId: NUXT_DEVTOOLS_GROUP_ID,
59
+ category: "advanced"
60
+ }
61
+ });
62
+ }, nuxt);
63
+ }
64
+ function getServerData(nuxt) {
65
+ deprecate(nuxt, "NDT_DEP_0009", {
66
+ api: "getServerData()",
67
+ replacement: "the Nuxt Application source in the Data Inspector panel"
68
+ });
69
+ const config = captured.vite?.config;
70
+ return {
71
+ nuxt: nuxt.options,
72
+ nitro: captured.nitro?.options,
73
+ vite: {
74
+ server: config ? normalizeViteConfig(config) : void 0,
75
+ client: config ? normalizeViteConfig(config) : void 0
76
+ }
77
+ // `nuxt.options` is `@nuxt/schema`'s `NuxtOptions` while `NuxtServerData`
78
+ // pins the structurally-identical `nuxt/schema` one; bridge the two.
79
+ };
80
+ }
81
+
82
+ export { getServerData, setup };