@nuxt/devtools 4.0.0-alpha.7 → 4.0.0-alpha.9

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 (175) hide show
  1. package/README.md +2 -2
  2. package/dist/chunks/analyze-build.mjs +32 -0
  3. package/dist/chunks/code-server.mjs +75 -0
  4. package/dist/chunks/module-main.mjs +633 -304
  5. package/dist/chunks/timeline.mjs +2 -2
  6. package/dist/chunks/vite-inspect.mjs +75 -39
  7. package/dist/client/200.html +1 -1
  8. package/dist/client/404.html +1 -1
  9. package/dist/client/_nuxt/__blank-e7n6afwb.js +1 -0
  10. package/dist/client/_nuxt/analyze-build-hl5kov9g.js +1 -0
  11. package/dist/client/_nuxt/assets-mhs93a2v.js +6 -0
  12. package/dist/client/_nuxt/{auth-required-panel-gwrodxrm.js → auth-required-panel-fp6njgq4.js} +1 -1
  13. package/dist/client/_nuxt/builds/latest.json +1 -1
  14. package/dist/client/_nuxt/builds/meta/f408df35-fbed-4f67-b31a-84e2dcf7d5f4.json +1 -0
  15. package/dist/client/_nuxt/{client-jwk7bkap.js → client-e4xweo15.js} +1 -1
  16. package/dist/client/_nuxt/client-ox3ztino.js +2 -0
  17. package/dist/client/_nuxt/code-diff-g3koa3wx.js +8 -0
  18. package/dist/client/_nuxt/code-snippets-jiqnd4op.js +1 -0
  19. package/dist/client/_nuxt/components-jjqi3963.js +1 -0
  20. package/dist/client/_nuxt/composable-item-nslyhu40.js +1 -0
  21. package/dist/client/_nuxt/composables-jsh6xr6n.js +1 -0
  22. package/dist/client/_nuxt/custom-_name_-nby2wkqs.js +1 -0
  23. package/dist/client/_nuxt/data-schema-button-n858k5no.js +1 -0
  24. package/dist/client/_nuxt/data-schema-drawer-nd5v2dc8.js +2 -0
  25. package/dist/client/_nuxt/debug-iqz97avh.js +1 -0
  26. package/dist/client/_nuxt/{default-ibmlv6hu.js → default-kms351ji.js} +1 -1
  27. package/dist/client/_nuxt/dist-cwkxp5t4.js +1 -0
  28. package/dist/client/_nuxt/dist-das2ggjj.js +1 -0
  29. package/dist/client/_nuxt/dist-hhnji3pn.js +1 -0
  30. package/dist/client/_nuxt/{duration-display-cfe3xsok.js → duration-display-kvy6t3q5.js} +1 -1
  31. package/dist/client/_nuxt/entry.css-hsdbnv92.css +1 -0
  32. package/dist/client/_nuxt/error-404-m7lxn6po.js +1 -0
  33. package/dist/client/_nuxt/error-404.css-kodsrozu.css +1 -0
  34. package/dist/client/_nuxt/error-500-fa1284ej.js +1 -0
  35. package/dist/client/_nuxt/error-500.css-mq6ubyvk.css +1 -0
  36. package/dist/client/_nuxt/error-dnpxky1s.js +9 -0
  37. package/dist/client/_nuxt/{filepath-item-calgslzq.js → filepath-item-elq07qqm.js} +1 -1
  38. package/dist/client/_nuxt/full-muovlha1.js +1 -0
  39. package/dist/client/_nuxt/{help-fab-ietvwhig.js → help-fab-mk77l527.js} +1 -1
  40. package/dist/client/_nuxt/hooks-fuegc0zi.js +1 -0
  41. package/dist/client/_nuxt/imports-dxp64giy.js +1 -0
  42. package/dist/client/_nuxt/launch-page-ldhzltru.js +1 -0
  43. package/dist/client/_nuxt/mbruyqke.js +4 -0
  44. package/dist/client/_nuxt/modules-ip395o4i.js +1 -0
  45. package/dist/client/_nuxt/nbadge-odjar6lb.js +1 -0
  46. package/dist/client/_nuxt/ncheckbox-ecu968cz.js +1 -0
  47. package/dist/client/_nuxt/ncode-block-ivymjiov.js +2 -0
  48. package/dist/client/_nuxt/ndrawer-fbwc78mp.js +1 -0
  49. package/dist/client/_nuxt/ndropdown-j9whus4q.js +1 -0
  50. package/dist/client/_nuxt/{nicon-title-f3ho3hah.js → nicon-title-lthyup78.js} +1 -1
  51. package/dist/client/_nuxt/{nlink-endeyoly.js → nlink-iv6gnrhx.js} +1 -1
  52. package/dist/client/_nuxt/{nmarkdown-iw4stzqp.js → nmarkdown-mbwbivxu.js} +1 -1
  53. package/dist/client/_nuxt/{nnavbar-n8fcnalx.js → nnavbar-ivws4py6.js} +1 -1
  54. package/dist/client/_nuxt/none-f6zkixpn.js +1 -0
  55. package/dist/client/_nuxt/npanel-grids-jzjbt8z8.js +1 -0
  56. package/dist/client/_nuxt/nsection-block-xwt9b4fq.js +1 -0
  57. package/dist/client/_nuxt/nselect-efk0r1bm.js +1 -0
  58. package/dist/client/_nuxt/nselect-tabs-o18hum8e.js +1 -0
  59. package/dist/client/_nuxt/nsplit-pane-nl6gqw3a.js +1 -0
  60. package/dist/client/_nuxt/nsplit-pane.css-o64elxn9.css +1 -0
  61. package/dist/client/_nuxt/{ntip-m8x8y44j.js → ntip-e476flgx.js} +1 -1
  62. package/dist/client/_nuxt/nuxt-ck1m833g.js +2 -0
  63. package/dist/client/_nuxt/open-graph-fevqc4qw.js +3 -0
  64. package/dist/client/_nuxt/overview-mov3ns5a.js +1 -0
  65. package/dist/client/_nuxt/pages-hl3ggxo7.js +1 -0
  66. package/dist/client/_nuxt/payload-i1xm1c2a.js +1 -0
  67. package/dist/client/_nuxt/pinia-j5ib0mm9.js +1 -0
  68. package/dist/client/_nuxt/plugins-dmozf1ud.js +1 -0
  69. package/dist/client/_nuxt/ready-mci0xx49.js +1 -0
  70. package/dist/client/_nuxt/render-tree-ht6m4wvr.js +1 -0
  71. package/dist/client/_nuxt/runtime-configs-lwkz00jf.js +1 -0
  72. package/dist/client/_nuxt/server-route-inputs-oyv7niet.js +1 -0
  73. package/dist/client/_nuxt/server-routes-e2av60g4.js +7 -0
  74. package/dist/client/_nuxt/server-tasks-jdi82ndh.js +1 -0
  75. package/dist/client/_nuxt/settings-nqvn74vj.js +1 -0
  76. package/dist/client/_nuxt/splitpanes.esm-e6jbjw2k.js +1 -0
  77. package/dist/client/_nuxt/stacktrace-list-bw2f6i1o.js +1 -0
  78. package/dist/client/_nuxt/state-components-frowf3zr.js +1 -0
  79. package/dist/client/_nuxt/state-editor-dnnm0b1r.js +1 -0
  80. package/dist/client/_nuxt/state-modules-b9ourhpx.js +1 -0
  81. package/dist/client/_nuxt/storage-dtuxyb3g.js +1 -0
  82. package/dist/client/_nuxt/storage-options-o7q1mchx.js +1 -0
  83. package/dist/client/_nuxt/timeline-dtcyzchh.js +31 -0
  84. package/dist/client/_nuxt/{unocss-runtime-kfral2d7.js → unocss-runtime-l66gafm5.js} +1 -1
  85. package/dist/client/_nuxt/utils-d9q1xry0.js +1 -0
  86. package/dist/client/_nuxt/vendor/json-editor-vue-l1ffxhko.js +3861 -0
  87. package/dist/client/_nuxt/vendor/{markdown-it-gg8o3tmh.js → markdown-it-cx0uvu2o.js} +1 -1
  88. package/dist/client/_nuxt/vendor/{quicktype-core-ozubcbyl.js → quicktype-core-otmjigaj.js} +65 -65
  89. package/dist/client/_nuxt/vendor/shiki-mgsi4s2l.js +153 -0
  90. package/dist/client/_nuxt/vendor/unocss-b56v4bpd.js +3 -0
  91. package/dist/client/_nuxt/virtual-files-odf1l0xb.js +1 -0
  92. package/dist/client/_nuxt/vue-devtools-bho31pmk.js +4 -0
  93. package/dist/client/_nuxt/vue-router-d5qsebus.js +1 -0
  94. package/dist/client/index.html +1 -1
  95. package/dist/module.json +1 -1
  96. package/dist/module.mjs +1 -1
  97. package/dist/runtime/plugins/view/client.js +20 -3
  98. package/dist/shared/devtools.CCWq4fFE.mjs +113 -0
  99. package/dist/types.d.mts +1 -5
  100. package/dist/webcomponents/index.mjs +1 -1
  101. package/package.json +45 -52
  102. package/.discoveryrc.cjs +0 -13
  103. package/dist/chunks/vscode.mjs +0 -170
  104. package/dist/client/_nuxt/__blank-ekrx7eve.js +0 -1
  105. package/dist/client/_nuxt/analyze-build-gtjxxh9s.js +0 -1
  106. package/dist/client/_nuxt/assets-fxuoynew.js +0 -6
  107. package/dist/client/_nuxt/builds/meta/23fee0aa-9df9-4da8-b519-ce0799e7da4e.json +0 -1
  108. package/dist/client/_nuxt/code-diff-d1bf4mlz.js +0 -8
  109. package/dist/client/_nuxt/code-snippets-nodldh90.js +0 -1
  110. package/dist/client/_nuxt/components-ibu6c1zd.js +0 -1
  111. package/dist/client/_nuxt/composable-item-lb3qexrh.js +0 -1
  112. package/dist/client/_nuxt/custom-_name_-dt22ybu3.js +0 -1
  113. package/dist/client/_nuxt/data-schema-button-m4wb470q.js +0 -1
  114. package/dist/client/_nuxt/data-schema-drawer-5ccj6aug.js +0 -2
  115. package/dist/client/_nuxt/debug-nxl66qh3.js +0 -1
  116. package/dist/client/_nuxt/dist-nsuzcp77.js +0 -1
  117. package/dist/client/_nuxt/entry.css-m21ytcnz.css +0 -1
  118. package/dist/client/_nuxt/error-404-izmgsqlm.js +0 -1
  119. package/dist/client/_nuxt/error-404.css-l9jcssuy.css +0 -1
  120. package/dist/client/_nuxt/error-500-fejd4grh.js +0 -1
  121. package/dist/client/_nuxt/error-500.css-he4ew8b1.css +0 -1
  122. package/dist/client/_nuxt/error-mm873c55.js +0 -9
  123. package/dist/client/_nuxt/full-pesi6bu3.js +0 -1
  124. package/dist/client/_nuxt/hooks-mqgelnks.js +0 -1
  125. package/dist/client/_nuxt/imports-bofdhcsr.js +0 -1
  126. package/dist/client/_nuxt/launch-page-i8mgxym7.js +0 -1
  127. package/dist/client/_nuxt/modules-b6uha2ss.js +0 -1
  128. package/dist/client/_nuxt/nbadge-ft1i3ddy.js +0 -1
  129. package/dist/client/_nuxt/ncheckbox-gl62y715.js +0 -1
  130. package/dist/client/_nuxt/ncode-block-ksrq5ppu.js +0 -2
  131. package/dist/client/_nuxt/ndrawer-evv584t1.js +0 -1
  132. package/dist/client/_nuxt/ndropdown-dqqc8bnq.js +0 -1
  133. package/dist/client/_nuxt/none-gr24yqiq.js +0 -1
  134. package/dist/client/_nuxt/nsection-block-n5u7wj9x.js +0 -1
  135. package/dist/client/_nuxt/nselect-kdzalcm2.js +0 -1
  136. package/dist/client/_nuxt/nselect-tabs-e440xayq.js +0 -1
  137. package/dist/client/_nuxt/nswitch-pdw73751.js +0 -1
  138. package/dist/client/_nuxt/nuxt-kphganvs.js +0 -1
  139. package/dist/client/_nuxt/o7y7c26x.js +0 -4
  140. package/dist/client/_nuxt/open-graph-mtq8qyx5.js +0 -3
  141. package/dist/client/_nuxt/overview-idjgy9u4.js +0 -1
  142. package/dist/client/_nuxt/pages-g3tcvbsn.js +0 -1
  143. package/dist/client/_nuxt/pages-lk0hxlsc.js +0 -1
  144. package/dist/client/_nuxt/payload-ovd8emqe.js +0 -1
  145. package/dist/client/_nuxt/pinia-e6em75yg.js +0 -1
  146. package/dist/client/_nuxt/plugins-ojph2z4c.js +0 -1
  147. package/dist/client/_nuxt/ready-b5u27bv4.js +0 -1
  148. package/dist/client/_nuxt/render-tree-iwtso0n9.js +0 -1
  149. package/dist/client/_nuxt/rpc-ewzip6fb.js +0 -4
  150. package/dist/client/_nuxt/runtime-configs-gyhmrfcz.js +0 -1
  151. package/dist/client/_nuxt/server-discovery-cfu428ir.js +0 -1
  152. package/dist/client/_nuxt/server-route-inputs-hhxdu10p.js +0 -1
  153. package/dist/client/_nuxt/server-routes-efc7olve.js +0 -7
  154. package/dist/client/_nuxt/server-tasks-o59rfww6.js +0 -1
  155. package/dist/client/_nuxt/settings-c6tbo50r.js +0 -1
  156. package/dist/client/_nuxt/stacktrace-list-c5b46nul.js +0 -1
  157. package/dist/client/_nuxt/state-components-eaw2evd3.js +0 -1
  158. package/dist/client/_nuxt/state-editor-jm35t8p1.js +0 -1
  159. package/dist/client/_nuxt/state-modules-oox7nhib.js +0 -1
  160. package/dist/client/_nuxt/storage-fdd2zc94.js +0 -1
  161. package/dist/client/_nuxt/storage-options-ho965h55.js +0 -1
  162. package/dist/client/_nuxt/terminals-b8awmi75.js +0 -1
  163. package/dist/client/_nuxt/terminals.css-mejv43xm.css +0 -1
  164. package/dist/client/_nuxt/timeline-nsh72kov.js +0 -31
  165. package/dist/client/_nuxt/utils-hgmynvjd.js +0 -2
  166. package/dist/client/_nuxt/vendor/json-editor-vue-mkw4apmc.js +0 -3869
  167. package/dist/client/_nuxt/vendor/shiki-c7z35hpo.js +0 -293
  168. package/dist/client/_nuxt/vendor/unocss-lkro8gbr.js +0 -3
  169. package/dist/client/_nuxt/vendor/xterm-eb5atty5.js +0 -36
  170. package/dist/client/_nuxt/vendor/xterm.css-j9zpjwmg.css +0 -1
  171. package/dist/client/_nuxt/virtual-files-met9zkti.js +0 -1
  172. package/dist/client/_nuxt/vue-devtools-bl144b70.js +0 -4
  173. package/dist/client/_nuxt/vue-router-cnnrtyb0.js +0 -1
  174. package/dist/client/discovery/index.html +0 -611
  175. package/dist/shared/devtools.nEotcg1R.mjs +0 -113
@@ -1,14 +1,16 @@
1
1
  import fs$1, { promises, statSync, realpathSync, readFileSync, existsSync, accessSync, constants } from 'node:fs';
2
2
  import fs from 'node:fs/promises';
3
3
  import os, { homedir } from 'node:os';
4
- import { logger, useNuxt, addVitePlugin, addPlugin, addTemplate, extendViteConfig, addImports } from '@nuxt/kit';
4
+ import { onDevtoolsReady, NUXT_DEVTOOLS_GROUP_ID, deprecate, registerHostDiagnostics } from '@nuxt/devtools-kit';
5
+ import { logger, useNuxt, extendViteConfig, addPlugin, addVitePlugin, addTemplate, addImports } from '@nuxt/kit';
5
6
  import { colors } from 'consola/utils';
6
7
  import { join, dirname, resolve, isAbsolute } from 'pathe';
7
8
  import sirv from 'sirv';
8
9
  import { searchForWorkspaceRoot } from 'vite';
9
- import { d as defaultAllowedExtensions, a as defaultTabOptions } from '../shared/devtools.nEotcg1R.mjs';
10
+ import { d as defaultAllowedExtensions, c as createDefaultTabOptions, s as setServerTasksEnabledByDefault } from '../shared/devtools.CCWq4fFE.mjs';
10
11
  import { runtimeDir, clientDir, packageDir } from '../dirs.mjs';
11
- import { startSubprocess } from '@nuxt/devtools-kit';
12
+ import { registerDataSource, createDataInspectorDevframe } from '@devframes/plugin-data-inspector';
13
+ import { mountDevframe } from '@vitejs/devtools-kit/node';
12
14
  import { x } from 'tinyexec';
13
15
  import { glob } from 'tinyglobby';
14
16
  import path, { relative, parse, dirname as dirname$1 } from 'node:path';
@@ -27,41 +29,169 @@ import { format, inspect } from 'node:util';
27
29
  import { resolveModule, getPackageInfo } from 'local-pkg';
28
30
  import { parseModule } from 'magicast';
29
31
  import { getDefaultExportOptions, addNuxtModule } from 'magicast/helpers';
30
- import semver from 'semver';
32
+ import { isLess } from 'verkit';
33
+ import { DEVTOOLS_TERMINALS_DOCK_ID } from '@vitejs/devtools-kit/constants';
31
34
  import { normalizeBaseKey, normalizeKey } from 'unstorage';
32
35
 
33
- const version$1 = "4.0.0-alpha.7";
36
+ const version$1 = "4.0.0-alpha.9";
37
+
38
+ const captured = {};
39
+ function normalizeViteConfig(config) {
40
+ return {
41
+ ...config,
42
+ environments: Object.fromEntries(
43
+ Object.entries(config.env ?? {}).map(([key, _]) => {
44
+ return [key, null];
45
+ })
46
+ ),
47
+ plugins: (config.plugins ?? []).map((i) => {
48
+ const clone = { ...i };
49
+ delete clone.api;
50
+ return clone;
51
+ }),
52
+ inlineConfig: null
53
+ };
54
+ }
55
+ function setup(ctx) {
56
+ const { nuxt } = ctx;
57
+ nuxt.hook("nitro:build:before", (nitro) => {
58
+ captured.nitro = nitro;
59
+ });
60
+ nuxt.hook("vite:configResolved", (config, env) => {
61
+ if (env.isClient)
62
+ captured.viteClient = config;
63
+ if (env.isServer)
64
+ captured.viteSsr = config;
65
+ });
66
+ const unregister = registerDataSource({
67
+ id: "nuxt:application",
68
+ title: "Nuxt Application",
69
+ description: "Live Nuxt, Nitro, and Vite configuration",
70
+ icon: "i-ph:database-duotone",
71
+ static: false,
72
+ data: () => ({
73
+ nuxt: nuxt.options,
74
+ nitro: captured.nitro?.options,
75
+ vite: {
76
+ client: captured.viteClient,
77
+ ssr: captured.viteSsr
78
+ }
79
+ }),
80
+ queries: [
81
+ { title: "Overview", query: "", excludeFunctions: true },
82
+ { title: "Nuxt options", query: "nuxt", excludeFunctions: true },
83
+ { title: "Nitro options", query: "nitro", excludeFunctions: true },
84
+ { title: "Vite configs", query: "vite", excludeFunctions: true }
85
+ ]
86
+ });
87
+ nuxt.hook("close", () => {
88
+ unregister();
89
+ captured.nitro = void 0;
90
+ captured.viteClient = void 0;
91
+ captured.viteSsr = void 0;
92
+ });
93
+ const definition = createDataInspectorDevframe({ exampleSource: false });
94
+ onDevtoolsReady((kit) => {
95
+ return mountDevframe(kit, definition, {
96
+ dock: {
97
+ groupId: NUXT_DEVTOOLS_GROUP_ID,
98
+ category: "advanced"
99
+ }
100
+ });
101
+ }, nuxt);
102
+ }
103
+ function getServerData(nuxt) {
104
+ deprecate(nuxt, "NDT_DEP_0009", {
105
+ api: "getServerData()",
106
+ replacement: "the Nuxt Application source in the Data Inspector panel"
107
+ });
108
+ return {
109
+ nuxt: nuxt.options,
110
+ nitro: captured.nitro?.options,
111
+ vite: {
112
+ server: captured.viteSsr ? normalizeViteConfig(captured.viteSsr) : void 0,
113
+ client: captured.viteClient ? normalizeViteConfig(captured.viteClient) : void 0
114
+ }
115
+ // `nuxt.options` is `@nuxt/schema`'s `NuxtOptions` while `NuxtServerData`
116
+ // pins the structurally-identical `nuxt/schema` one; bridge the two.
117
+ };
118
+ }
119
+
120
+ const dataInspector = {
121
+ __proto__: null,
122
+ getServerData: getServerData,
123
+ setup: setup
124
+ };
125
+
126
+ const RPC_NAMESPACE = "nuxt:devtools";
127
+
128
+ let counter = 0;
129
+ function createUniqueSessionId(baseId) {
130
+ counter += 1;
131
+ return `${baseId}#${counter}`;
132
+ }
34
133
 
35
134
  const COLON_RE = /:/g;
36
- function setupAnalyzeBuildRPC({ nuxt, refresh }) {
135
+ function setupAnalyzeBuildRPC(ctx) {
136
+ const { nuxt, refresh } = ctx;
37
137
  let builds = [];
38
138
  let promise;
39
139
  let initalized;
40
- const processId = "devtools:analyze-build";
140
+ let activeSessionId;
41
141
  const devtoolsAnalyzeDir = join(nuxt.options.rootDir, "node_modules/.cache/nuxt-devtools/analyze");
42
142
  async function startAnalyzeBuild(name) {
43
143
  if (promise)
44
144
  throw new Error("[Nuxt DevTools] A building process is already running");
45
- const result = startSubprocess({
145
+ const kit = ctx.devtoolsKit;
146
+ if (!kit)
147
+ throw new Error("[Nuxt DevTools] Vite DevTools kit is not connected yet.");
148
+ const sessionId = createUniqueSessionId("devtools:analyze-build");
149
+ activeSessionId = sessionId;
150
+ const session = await kit.terminals.startChildProcess({
46
151
  command: "npx",
47
152
  args: ["nuxi", "analyze", "--no-serve", "--name", name],
48
153
  cwd: nuxt.options.rootDir
49
154
  }, {
50
- id: processId,
51
- name: "Analyze Build",
155
+ id: sessionId,
156
+ title: "Analyze Build",
52
157
  icon: "logos-nuxt-icon"
53
- }, nuxt);
158
+ });
54
159
  refresh("getAnalyzeBuildInfo");
55
160
  initalized = void 0;
56
- promise = Promise.resolve(result.getResult()).then(() => {
161
+ promise = Promise.resolve(session.getResult()).then((result) => {
162
+ if (result.exitCode && result.exitCode !== 0) {
163
+ ctx.notify({
164
+ message: `Build analysis "${name}" failed`,
165
+ level: "error",
166
+ description: `Process exited with code ${result.exitCode}. Check the Analyze Build terminal for details.`,
167
+ category: "build",
168
+ notify: true
169
+ });
170
+ } else {
171
+ ctx.notify({
172
+ message: `Build analysis "${name}" complete`,
173
+ level: "success",
174
+ category: "build",
175
+ notify: true
176
+ });
177
+ }
57
178
  refresh("getAnalyzeBuildInfo");
58
179
  return readBuildInfo();
180
+ }).catch((error) => {
181
+ ctx.notify({
182
+ message: `Build analysis "${name}" failed`,
183
+ level: "error",
184
+ description: error instanceof Error ? error.message : String(error),
185
+ category: "build",
186
+ notify: true
187
+ });
59
188
  }).finally(() => {
60
189
  promise = void 0;
61
190
  initalized = void 0;
191
+ activeSessionId = void 0;
62
192
  refresh("getAnalyzeBuildInfo");
63
193
  });
64
- return processId;
194
+ return sessionId;
65
195
  }
66
196
  async function readBuildInfo() {
67
197
  for (const dir of /* @__PURE__ */ new Set([
@@ -124,6 +254,7 @@ function setupAnalyzeBuildRPC({ nuxt, refresh }) {
124
254
  await initalized;
125
255
  return {
126
256
  isBuilding: !!promise,
257
+ activeSessionId,
127
258
  builds
128
259
  };
129
260
  },
@@ -726,6 +857,9 @@ var defaultOptions = {
726
857
  // Can be either `"script"`, `"module"` or `"commonjs"`. This influences global
727
858
  // strict mode and parsing of `import` and `export` declarations.
728
859
  sourceType: "script",
860
+ // When set to true, enable strict parsing mode even if `sourceType`
861
+ // is `"script"`.
862
+ strict: false,
729
863
  // `onInsertedSemicolon` can be a callback that will be called when
730
864
  // a semicolon is automatically inserted. It will be passed the
731
865
  // position of the inserted semicolon as an offset, and if
@@ -952,7 +1086,7 @@ var Parser = function Parser(options, input, startPos) {
952
1086
 
953
1087
  // Figure out if it's a module code.
954
1088
  this.inModule = options.sourceType === "module";
955
- this.strict = this.inModule || this.strictDirective(this.pos);
1089
+ this.strict = this.inModule || options.strict === true || this.strictDirective(this.pos);
956
1090
 
957
1091
  // Used to signify the start of a potential arrow function
958
1092
  this.potentialArrowAt = -1;
@@ -990,9 +1124,11 @@ var Parser = function Parser(options, input, startPos) {
990
1124
  var prototypeAccessors = { inFunction: { configurable: true },inGenerator: { configurable: true },inAsync: { configurable: true },canAwait: { configurable: true },allowReturn: { configurable: true },allowSuper: { configurable: true },allowDirectSuper: { configurable: true },treatFunctionsAsVar: { configurable: true },allowNewDotTarget: { configurable: true },allowUsing: { configurable: true },inClassStaticBlock: { configurable: true } };
991
1125
 
992
1126
  Parser.prototype.parse = function parse () {
1127
+ var this$1$1 = this;
1128
+
993
1129
  var node = this.options.program || this.startNode();
994
1130
  this.nextToken();
995
- return this.parseTopLevel(node)
1131
+ return this.catchStackOverflow(function () { return this$1$1.parseTopLevel(node); })
996
1132
  };
997
1133
 
998
1134
  prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
@@ -1131,6 +1267,17 @@ pp$9.eatContextual = function(name) {
1131
1267
  return true
1132
1268
  };
1133
1269
 
1270
+ pp$9.catchStackOverflow = function(f) {
1271
+ try {
1272
+ return f()
1273
+ } catch (e) {
1274
+ if (e instanceof Error && (/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message) || /\btoo much recursion\b/i.test(e.message)))
1275
+ { this.raise(this.start, "Not enough stack space to parse input"); }
1276
+ else
1277
+ { throw e }
1278
+ }
1279
+ };
1280
+
1134
1281
  // Asserts that following token is given contextual keyword.
1135
1282
 
1136
1283
  pp$9.expectContextual = function(name) {
@@ -1234,10 +1381,10 @@ var pp$8 = Parser.prototype;
1234
1381
  // to its body instead of creating a new node.
1235
1382
 
1236
1383
  pp$8.parseTopLevel = function(node) {
1237
- var exports = Object.create(null);
1384
+ var exports$1 = Object.create(null);
1238
1385
  if (!node.body) { node.body = []; }
1239
1386
  while (this.type !== types$1.eof) {
1240
- var stmt = this.parseStatement(null, true, exports);
1387
+ var stmt = this.parseStatement(null, true, exports$1);
1241
1388
  node.body.push(stmt);
1242
1389
  }
1243
1390
  if (this.inModule)
@@ -1326,7 +1473,18 @@ pp$8.isUsingKeyword = function(isAwaitUsing, isFor) {
1326
1473
  while (isIdentifierChar(ch = this.fullCharCodeAt(next)))
1327
1474
  if (ch === 92) { return true }
1328
1475
  var id = this.input.slice(idStart, next);
1329
- if (keywordRelationalOperator.test(id) || isFor && id === "of") { return false }
1476
+ if (keywordRelationalOperator.test(id)) { return false }
1477
+ if (isFor && !isAwaitUsing && id === "of") {
1478
+ // Look ahead for using declaration with initializer, i.e., `for (using of = ...)`
1479
+ skipWhiteSpace.lastIndex = next;
1480
+ var skipAfterOf = skipWhiteSpace.exec(this.input);
1481
+ next = next + skipAfterOf[0].length;
1482
+ if (this.input.charCodeAt(next) !== 61 /* '=' */ ||
1483
+ // Check for ==, === and => operators
1484
+ (ch = this.input.charCodeAt(next + 1)) === 61 /* '=' */ || ch === 62 /* '>' */) {
1485
+ return false
1486
+ }
1487
+ }
1330
1488
  return true
1331
1489
  };
1332
1490
 
@@ -1345,7 +1503,7 @@ pp$8.isUsing = function(isFor) {
1345
1503
  // `if (foo) /blah/.exec(foo)`, where looking at the previous token
1346
1504
  // does not help.
1347
1505
 
1348
- pp$8.parseStatement = function(context, topLevel, exports) {
1506
+ pp$8.parseStatement = function(context, topLevel, exports$1) {
1349
1507
  var starttype = this.type, node = this.startNode(), kind;
1350
1508
 
1351
1509
  if (this.isLet(context)) {
@@ -1400,7 +1558,7 @@ pp$8.parseStatement = function(context, topLevel, exports) {
1400
1558
  if (!this.inModule)
1401
1559
  { this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
1402
1560
  }
1403
- return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports)
1561
+ return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports$1)
1404
1562
 
1405
1563
  // If the statement does not start with a statement keyword or a
1406
1564
  // brace, it's an ExpressionStatement or LabeledStatement. We
@@ -1419,6 +1577,10 @@ pp$8.parseStatement = function(context, topLevel, exports) {
1419
1577
  if (!this.allowUsing) {
1420
1578
  this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement");
1421
1579
  }
1580
+ if (context) {
1581
+ // Cases like `for (;;) using x = ...;`, `if (true) await using x = ...;`, etc. are not allowed.
1582
+ this.raise(this.start, "Using declaration is not allowed in single-statement positions");
1583
+ }
1422
1584
  if (usingKind === "await using") {
1423
1585
  if (!this.canAwait) {
1424
1586
  this.raise(this.start, "Await using cannot appear outside of async function");
@@ -1552,11 +1714,12 @@ pp$8.parseForStatement = function(node) {
1552
1714
  // Helper method to parse for loop after variable initialization
1553
1715
  pp$8.parseForAfterInit = function(node, init, awaitAt) {
1554
1716
  if ((this.type === types$1._in || (this.options.ecmaVersion >= 6 && this.isContextual("of"))) && init.declarations.length === 1) {
1555
- if (this.options.ecmaVersion >= 9) {
1556
- if (this.type === types$1._in) {
1557
- if (awaitAt > -1) { this.unexpected(awaitAt); }
1558
- } else { node.await = awaitAt > -1; }
1559
- }
1717
+ if (this.type === types$1._in) {
1718
+ if ((init.kind === "using" || init.kind === "await using") && !init.declarations[0].init) {
1719
+ this.raise(this.start, "Using declaration is not allowed in for-in loops");
1720
+ }
1721
+ if (this.options.ecmaVersion >= 9 && awaitAt > -1) { this.unexpected(awaitAt); }
1722
+ } else if (this.options.ecmaVersion >= 9) { node.await = awaitAt > -1; }
1560
1723
  return this.parseForIn(node, init)
1561
1724
  }
1562
1725
  if (awaitAt > -1) { this.unexpected(awaitAt); }
@@ -2161,11 +2324,11 @@ function checkKeyName(node, name) {
2161
2324
 
2162
2325
  // Parses module export declaration.
2163
2326
 
2164
- pp$8.parseExportAllDeclaration = function(node, exports) {
2327
+ pp$8.parseExportAllDeclaration = function(node, exports$1) {
2165
2328
  if (this.options.ecmaVersion >= 11) {
2166
2329
  if (this.eatContextual("as")) {
2167
2330
  node.exported = this.parseModuleExportName();
2168
- this.checkExport(exports, node.exported, this.lastTokStart);
2331
+ this.checkExport(exports$1, node.exported, this.lastTokStart);
2169
2332
  } else {
2170
2333
  node.exported = null;
2171
2334
  }
@@ -2179,14 +2342,14 @@ pp$8.parseExportAllDeclaration = function(node, exports) {
2179
2342
  return this.finishNode(node, "ExportAllDeclaration")
2180
2343
  };
2181
2344
 
2182
- pp$8.parseExport = function(node, exports) {
2345
+ pp$8.parseExport = function(node, exports$1) {
2183
2346
  this.next();
2184
2347
  // export * from '...'
2185
2348
  if (this.eat(types$1.star)) {
2186
- return this.parseExportAllDeclaration(node, exports)
2349
+ return this.parseExportAllDeclaration(node, exports$1)
2187
2350
  }
2188
2351
  if (this.eat(types$1._default)) { // export default ...
2189
- this.checkExport(exports, "default", this.lastTokStart);
2352
+ this.checkExport(exports$1, "default", this.lastTokStart);
2190
2353
  node.declaration = this.parseExportDefaultDeclaration();
2191
2354
  return this.finishNode(node, "ExportDefaultDeclaration")
2192
2355
  }
@@ -2194,16 +2357,16 @@ pp$8.parseExport = function(node, exports) {
2194
2357
  if (this.shouldParseExportStatement()) {
2195
2358
  node.declaration = this.parseExportDeclaration(node);
2196
2359
  if (node.declaration.type === "VariableDeclaration")
2197
- { this.checkVariableExport(exports, node.declaration.declarations); }
2360
+ { this.checkVariableExport(exports$1, node.declaration.declarations); }
2198
2361
  else
2199
- { this.checkExport(exports, node.declaration.id, node.declaration.id.start); }
2362
+ { this.checkExport(exports$1, node.declaration.id, node.declaration.id.start); }
2200
2363
  node.specifiers = [];
2201
2364
  node.source = null;
2202
2365
  if (this.options.ecmaVersion >= 16)
2203
2366
  { node.attributes = []; }
2204
2367
  } else { // export { x, y as z } [from '...']
2205
2368
  node.declaration = null;
2206
- node.specifiers = this.parseExportSpecifiers(exports);
2369
+ node.specifiers = this.parseExportSpecifiers(exports$1);
2207
2370
  if (this.eatContextual("from")) {
2208
2371
  if (this.type !== types$1.string) { this.unexpected(); }
2209
2372
  node.source = this.parseExprAtom();
@@ -2253,47 +2416,47 @@ pp$8.parseExportDefaultDeclaration = function() {
2253
2416
  }
2254
2417
  };
2255
2418
 
2256
- pp$8.checkExport = function(exports, name, pos) {
2257
- if (!exports) { return }
2419
+ pp$8.checkExport = function(exports$1, name, pos) {
2420
+ if (!exports$1) { return }
2258
2421
  if (typeof name !== "string")
2259
2422
  { name = name.type === "Identifier" ? name.name : name.value; }
2260
- if (hasOwn(exports, name))
2423
+ if (hasOwn(exports$1, name))
2261
2424
  { this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
2262
- exports[name] = true;
2425
+ exports$1[name] = true;
2263
2426
  };
2264
2427
 
2265
- pp$8.checkPatternExport = function(exports, pat) {
2428
+ pp$8.checkPatternExport = function(exports$1, pat) {
2266
2429
  var type = pat.type;
2267
2430
  if (type === "Identifier")
2268
- { this.checkExport(exports, pat, pat.start); }
2431
+ { this.checkExport(exports$1, pat, pat.start); }
2269
2432
  else if (type === "ObjectPattern")
2270
2433
  { for (var i = 0, list = pat.properties; i < list.length; i += 1)
2271
2434
  {
2272
2435
  var prop = list[i];
2273
2436
 
2274
- this.checkPatternExport(exports, prop);
2437
+ this.checkPatternExport(exports$1, prop);
2275
2438
  } }
2276
2439
  else if (type === "ArrayPattern")
2277
2440
  { for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
2278
2441
  var elt = list$1[i$1];
2279
2442
 
2280
- if (elt) { this.checkPatternExport(exports, elt); }
2443
+ if (elt) { this.checkPatternExport(exports$1, elt); }
2281
2444
  } }
2282
2445
  else if (type === "Property")
2283
- { this.checkPatternExport(exports, pat.value); }
2446
+ { this.checkPatternExport(exports$1, pat.value); }
2284
2447
  else if (type === "AssignmentPattern")
2285
- { this.checkPatternExport(exports, pat.left); }
2448
+ { this.checkPatternExport(exports$1, pat.left); }
2286
2449
  else if (type === "RestElement")
2287
- { this.checkPatternExport(exports, pat.argument); }
2450
+ { this.checkPatternExport(exports$1, pat.argument); }
2288
2451
  };
2289
2452
 
2290
- pp$8.checkVariableExport = function(exports, decls) {
2291
- if (!exports) { return }
2453
+ pp$8.checkVariableExport = function(exports$1, decls) {
2454
+ if (!exports$1) { return }
2292
2455
  for (var i = 0, list = decls; i < list.length; i += 1)
2293
2456
  {
2294
2457
  var decl = list[i];
2295
2458
 
2296
- this.checkPatternExport(exports, decl.id);
2459
+ this.checkPatternExport(exports$1, decl.id);
2297
2460
  }
2298
2461
  };
2299
2462
 
@@ -2308,13 +2471,13 @@ pp$8.shouldParseExportStatement = function() {
2308
2471
 
2309
2472
  // Parses a comma-separated list of module exports.
2310
2473
 
2311
- pp$8.parseExportSpecifier = function(exports) {
2474
+ pp$8.parseExportSpecifier = function(exports$1) {
2312
2475
  var node = this.startNode();
2313
2476
  node.local = this.parseModuleExportName();
2314
2477
 
2315
2478
  node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
2316
2479
  this.checkExport(
2317
- exports,
2480
+ exports$1,
2318
2481
  node.exported,
2319
2482
  node.exported.start
2320
2483
  );
@@ -2322,7 +2485,7 @@ pp$8.parseExportSpecifier = function(exports) {
2322
2485
  return this.finishNode(node, "ExportSpecifier")
2323
2486
  };
2324
2487
 
2325
- pp$8.parseExportSpecifiers = function(exports) {
2488
+ pp$8.parseExportSpecifiers = function(exports$1) {
2326
2489
  var nodes = [], first = true;
2327
2490
  // export { x, y as z } [from '...']
2328
2491
  this.expect(types$1.braceL);
@@ -2332,7 +2495,7 @@ pp$8.parseExportSpecifiers = function(exports) {
2332
2495
  if (this.afterTrailingComma(types$1.braceR)) { break }
2333
2496
  } else { first = false; }
2334
2497
 
2335
- nodes.push(this.parseExportSpecifier(exports));
2498
+ nodes.push(this.parseExportSpecifier(exports$1));
2336
2499
  }
2337
2500
  return nodes
2338
2501
  };
@@ -3063,15 +3226,19 @@ pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {
3063
3226
  // delayed syntax error at correct position).
3064
3227
 
3065
3228
  pp$5.parseExpression = function(forInit, refDestructuringErrors) {
3066
- var startPos = this.start, startLoc = this.startLoc;
3067
- var expr = this.parseMaybeAssign(forInit, refDestructuringErrors);
3068
- if (this.type === types$1.comma) {
3069
- var node = this.startNodeAt(startPos, startLoc);
3070
- node.expressions = [expr];
3071
- while (this.eat(types$1.comma)) { node.expressions.push(this.parseMaybeAssign(forInit, refDestructuringErrors)); }
3072
- return this.finishNode(node, "SequenceExpression")
3073
- }
3074
- return expr
3229
+ var this$1$1 = this;
3230
+
3231
+ return this.catchStackOverflow(function () {
3232
+ var startPos = this$1$1.start, startLoc = this$1$1.startLoc;
3233
+ var expr = this$1$1.parseMaybeAssign(forInit, refDestructuringErrors);
3234
+ if (this$1$1.type === types$1.comma) {
3235
+ var node = this$1$1.startNodeAt(startPos, startLoc);
3236
+ node.expressions = [expr];
3237
+ while (this$1$1.eat(types$1.comma)) { node.expressions.push(this$1$1.parseMaybeAssign(forInit, refDestructuringErrors)); }
3238
+ return this$1$1.finishNode(node, "SequenceExpression")
3239
+ }
3240
+ return expr
3241
+ })
3075
3242
  };
3076
3243
 
3077
3244
  // Parse an assignment expression. This includes applications of
@@ -3136,7 +3303,7 @@ pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {
3136
3303
  var startPos = this.start, startLoc = this.startLoc;
3137
3304
  var expr = this.parseExprOps(forInit, refDestructuringErrors);
3138
3305
  if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
3139
- if (this.eat(types$1.question)) {
3306
+ if (!(expr.type === "ArrowFunctionExpression" && expr.start === startPos) && this.eat(types$1.question)) {
3140
3307
  var node = this.startNodeAt(startPos, startLoc);
3141
3308
  node.test = expr;
3142
3309
  node.consequent = this.parseMaybeAssign();
@@ -3688,6 +3855,8 @@ pp$5.parseNew = function() {
3688
3855
  }
3689
3856
  var startPos = this.start, startLoc = this.startLoc;
3690
3857
  node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
3858
+ if (node.callee.type === "Super")
3859
+ { this.raiseRecoverable(startPos, "Invalid use of 'super'"); }
3691
3860
  if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
3692
3861
  else { node.arguments = empty; }
3693
3862
  return this.finishNode(node, "NewExpression")
@@ -6604,7 +6773,7 @@ pp.readWord = function() {
6604
6773
  // [ghbt]: https://github.com/acornjs/acorn/issues
6605
6774
 
6606
6775
 
6607
- var version = "8.16.0";
6776
+ var version = "8.17.0";
6608
6777
 
6609
6778
  Parser.acorn = {
6610
6779
  Parser: Parser,
@@ -10238,18 +10407,20 @@ function getOptions() {
10238
10407
  return options;
10239
10408
  }
10240
10409
  function setupOptionsRPC({ nuxt }) {
10410
+ const hasReadOnce = /* @__PURE__ */ new Set();
10241
10411
  async function getOptions2(tab) {
10242
- if (!options || options[tab]) {
10243
- options = defaultTabOptions;
10412
+ if (!options)
10413
+ options = createDefaultTabOptions();
10414
+ if (!hasReadOnce.has(tab))
10244
10415
  await read(tab);
10245
- }
10246
10416
  return options[tab];
10247
10417
  }
10248
10418
  async function read(tab) {
10249
- options[tab] = await readLocalOptions(defaultTabOptions[tab], {
10419
+ options[tab] = await readLocalOptions(createDefaultTabOptions()[tab], {
10250
10420
  root: nuxt.options.rootDir,
10251
10421
  key: tab !== "ui" && tab
10252
10422
  });
10423
+ hasReadOnce.add(tab);
10253
10424
  return options;
10254
10425
  }
10255
10426
  getOptions2("ui");
@@ -10516,19 +10687,70 @@ const route = useRoute()
10516
10687
  };
10517
10688
  }
10518
10689
 
10690
+ function toEntryInput(input) {
10691
+ return {
10692
+ message: input.message,
10693
+ level: input.level ?? "info",
10694
+ description: input.description,
10695
+ labels: input.labels,
10696
+ category: input.category,
10697
+ filePosition: input.filePosition,
10698
+ stacktrace: input.stacktrace,
10699
+ notify: input.notify,
10700
+ autoDismiss: input.autoDismiss,
10701
+ autoDelete: input.autoDelete
10702
+ };
10703
+ }
10704
+ function createNotifier(nuxt) {
10705
+ let messages;
10706
+ const pending = [];
10707
+ function add(input) {
10708
+ void messages.add(toEntryInput(input)).catch(() => {
10709
+ });
10710
+ }
10711
+ function notify(input) {
10712
+ if (!messages) {
10713
+ pending.push(input);
10714
+ return;
10715
+ }
10716
+ add(input);
10717
+ }
10718
+ onDevtoolsReady((kit) => {
10719
+ messages = kit.messages;
10720
+ for (const input of pending)
10721
+ add(input);
10722
+ pending.length = 0;
10723
+ }, nuxt);
10724
+ nuxt.hook("devtools:notify", notify);
10725
+ return notify;
10726
+ }
10727
+ function setupMessagesRPC(ctx) {
10728
+ return {
10729
+ async notify(input) {
10730
+ ctx.notify(input);
10731
+ }
10732
+ };
10733
+ }
10734
+
10519
10735
  const AGENTS = [
10520
10736
  "npm",
10521
10737
  "yarn",
10522
10738
  "yarn@berry",
10523
10739
  "pnpm",
10524
10740
  "pnpm@6",
10741
+ "pnpm-rush",
10525
10742
  "bun",
10526
- "deno"
10743
+ "deno",
10744
+ "nub",
10745
+ "aube"
10527
10746
  ];
10528
10747
  const LOCKS = {
10748
+ "aube-lock.yaml": "aube",
10749
+ "aube-workspace.yaml": "aube",
10529
10750
  "bun.lock": "bun",
10530
10751
  "bun.lockb": "bun",
10531
10752
  "deno.lock": "deno",
10753
+ "nub.lock": "nub",
10532
10754
  "pnpm-lock.yaml": "pnpm",
10533
10755
  "pnpm-workspace.yaml": "pnpm",
10534
10756
  "yarn.lock": "yarn",
@@ -10536,6 +10758,7 @@ const LOCKS = {
10536
10758
  "npm-shrinkwrap.json": "npm"
10537
10759
  };
10538
10760
  const INSTALL_METADATA = {
10761
+ "node_modules/.aube/": "aube",
10539
10762
  "node_modules/.deno/": "deno",
10540
10763
  "node_modules/.pnpm/": "pnpm",
10541
10764
  "node_modules/.yarn-state.yml": "yarn",
@@ -10588,6 +10811,9 @@ async function detect(options = {}) {
10588
10811
  for (const strategy of strategies) {
10589
10812
  switch (strategy) {
10590
10813
  case "lockfile": {
10814
+ if (await pathExists(path.join(directory, "rush.json"), "file")) {
10815
+ return { name: "pnpm", agent: "pnpm-rush" };
10816
+ }
10591
10817
  for (const lock of Object.keys(LOCKS)) {
10592
10818
  if (await pathExists(path.join(directory, lock), "file")) {
10593
10819
  const name = LOCKS[lock];
@@ -11055,7 +11281,7 @@ async function checkForUpdateOf(name, current, nuxt = useNuxt()) {
11055
11281
  const { version: latest } = await getLatestVersion(name, {
11056
11282
  fetch
11057
11283
  });
11058
- const needsUpdate = !!latest && latest !== current && semver.lt(current, latest);
11284
+ const needsUpdate = !!latest && latest !== current && isLess(current, latest);
11059
11285
  return {
11060
11286
  name,
11061
11287
  current,
@@ -11079,7 +11305,179 @@ async function magicastGuard(fn, message = "") {
11079
11305
  return generated;
11080
11306
  }
11081
11307
 
11082
- function setupNpmRPC({ nuxt }) {
11308
+ function removeNuxtModuleFromCode(source, name, filepath) {
11309
+ const mod = parseModule(source, filepath ? { sourceFileName: filepath } : void 0);
11310
+ const config = getDefaultExportOptions(mod);
11311
+ if (!Array.isArray(config.modules))
11312
+ return mod.generate().code;
11313
+ for (let i = config.modules.length - 1; i >= 0; i--) {
11314
+ const entry = config.modules[i];
11315
+ const matches = typeof entry === "string" ? entry === name : Array.isArray(entry) && entry[0] === name;
11316
+ if (matches)
11317
+ config.modules.splice(i, 1);
11318
+ }
11319
+ return mod.generate().code;
11320
+ }
11321
+
11322
+ function broadcastTerminalExit(ctx, id, code) {
11323
+ ctx.devtoolsKit?.rpc.broadcast({ method: "onTerminalExit", args: [{ id, code }], event: true });
11324
+ }
11325
+ function statusForExit(code) {
11326
+ return code == null || code === 0 ? "stopped" : "error";
11327
+ }
11328
+ function setupTerminalsBridge(ctx) {
11329
+ const { nuxt } = ctx;
11330
+ const runs = /* @__PURE__ */ new Map();
11331
+ const generations = /* @__PURE__ */ new Map();
11332
+ let host;
11333
+ function createRun(terminal) {
11334
+ const legacyId = terminal.id;
11335
+ const generation = (generations.get(legacyId) ?? 0) + 1;
11336
+ generations.set(legacyId, generation);
11337
+ let controller;
11338
+ const stream = new ReadableStream({
11339
+ start(c) {
11340
+ controller = c;
11341
+ }
11342
+ });
11343
+ const session = {
11344
+ id: createUniqueSessionId(legacyId),
11345
+ title: terminal.name,
11346
+ description: terminal.description,
11347
+ icon: terminal.icon,
11348
+ status: "running",
11349
+ interactive: false,
11350
+ stream
11351
+ };
11352
+ return {
11353
+ legacyId,
11354
+ sessionId: session.id,
11355
+ generation,
11356
+ session,
11357
+ controller,
11358
+ registered: false,
11359
+ streamClosed: false,
11360
+ pendingChunks: []
11361
+ };
11362
+ }
11363
+ function isCurrent(run) {
11364
+ return runs.get(run.legacyId) === run;
11365
+ }
11366
+ function closeStream(run) {
11367
+ if (run.streamClosed)
11368
+ return;
11369
+ run.streamClosed = true;
11370
+ try {
11371
+ run.controller?.close();
11372
+ } catch {
11373
+ }
11374
+ }
11375
+ function applyExit(run, code) {
11376
+ if (!isCurrent(run) || run.streamClosed)
11377
+ return;
11378
+ closeStream(run);
11379
+ run.session.status = statusForExit(code);
11380
+ host?.update(run.session);
11381
+ }
11382
+ function registerWithHost(run) {
11383
+ if (!host || run.registered || !isCurrent(run))
11384
+ return;
11385
+ host.register(run.session);
11386
+ run.registered = true;
11387
+ for (const chunk of run.pendingChunks) {
11388
+ try {
11389
+ run.controller?.enqueue(chunk);
11390
+ } catch {
11391
+ }
11392
+ }
11393
+ run.pendingChunks.length = 0;
11394
+ if (run.pendingExit) {
11395
+ const { code } = run.pendingExit;
11396
+ run.pendingExit = void 0;
11397
+ applyExit(run, code);
11398
+ }
11399
+ }
11400
+ nuxt.hook("devtools:terminal:register", (terminal) => {
11401
+ const existing = runs.get(terminal.id);
11402
+ if (existing) {
11403
+ closeStream(existing);
11404
+ if (host && existing.registered)
11405
+ host.remove(existing.session);
11406
+ }
11407
+ const run = createRun(terminal);
11408
+ runs.set(terminal.id, run);
11409
+ if (host)
11410
+ registerWithHost(run);
11411
+ return terminal.id;
11412
+ });
11413
+ nuxt.hook("devtools:terminal:write", ({ id, data }) => {
11414
+ const run = runs.get(id);
11415
+ if (!run || run.streamClosed)
11416
+ return false;
11417
+ if (run.registered) {
11418
+ try {
11419
+ run.controller?.enqueue(data);
11420
+ } catch {
11421
+ }
11422
+ } else {
11423
+ run.pendingChunks.push(data);
11424
+ }
11425
+ return true;
11426
+ });
11427
+ nuxt.hook("devtools:terminal:exit", ({ id, code }) => {
11428
+ const run = runs.get(id);
11429
+ if (!run)
11430
+ return false;
11431
+ if (run.registered)
11432
+ applyExit(run, code);
11433
+ else
11434
+ run.pendingExit = { code };
11435
+ return true;
11436
+ });
11437
+ nuxt.hook("devtools:terminal:remove", ({ id }) => {
11438
+ const run = runs.get(id);
11439
+ if (!run)
11440
+ return false;
11441
+ closeStream(run);
11442
+ runs.delete(id);
11443
+ if (host && run.registered)
11444
+ host.remove(run.session);
11445
+ return true;
11446
+ });
11447
+ nuxt.hook("devtools:ready", (kit) => {
11448
+ host = kit.terminals;
11449
+ for (const run of runs.values())
11450
+ registerWithHost(run);
11451
+ });
11452
+ return {
11453
+ /**
11454
+ * Focus the built-in **Terminals** dock on a session (Devframe 0.7
11455
+ * `docks.activate`, driven by the `hub:docks:activate` RPC). Replaces the
11456
+ * old in-client "go to Terminals tab" navigation now that terminals live in
11457
+ * the hub dock. `id` is a unique Devframe session id (from a bridged run or
11458
+ * a `startChildProcess` call). Returns `false` when the kit isn't connected
11459
+ * or the session is unknown.
11460
+ */
11461
+ async revealTerminal(id) {
11462
+ const kit = ctx.devtoolsKit;
11463
+ if (!kit)
11464
+ return false;
11465
+ if (!kit.terminals.sessions.has(id))
11466
+ return false;
11467
+ kit.docks.activate(DEVTOOLS_TERMINALS_DOCK_ID, { sessionId: id });
11468
+ return true;
11469
+ }
11470
+ };
11471
+ }
11472
+
11473
+ function setupNpmRPC(ctx) {
11474
+ const { nuxt } = ctx;
11475
+ function getTerminals() {
11476
+ const kit = ctx.devtoolsKit;
11477
+ if (!kit)
11478
+ throw new Error("[Nuxt DevTools] Vite DevTools kit is not connected yet.");
11479
+ return kit.terminals;
11480
+ }
11083
11481
  let detectPromise;
11084
11482
  const updatesPromise = /* @__PURE__ */ new Map();
11085
11483
  function getPackageManager() {
@@ -11114,15 +11512,18 @@ function setupNpmRPC({ nuxt }) {
11114
11512
  const args = await getNpmCommand(command, packageName, options);
11115
11513
  if (!args)
11116
11514
  return;
11117
- const processId = `npm:${command}:${packageName}`;
11118
- startSubprocess({
11515
+ const processId = createUniqueSessionId(`npm:${command}:${packageName}`);
11516
+ const session = await getTerminals().startChildProcess({
11119
11517
  command: args[0],
11120
11518
  args: args.slice(1)
11121
11519
  }, {
11122
11520
  id: processId,
11123
- name: `${command} ${packageName}`,
11124
- icon: "i-logos-npm-icon",
11125
- restartable: false
11521
+ title: `${command} ${packageName}`,
11522
+ icon: "i-logos-npm-icon"
11523
+ });
11524
+ void Promise.resolve(session.getResult()).then((result) => {
11525
+ broadcastTerminalExit(ctx, processId, result.exitCode);
11526
+ }).catch(() => {
11126
11527
  });
11127
11528
  return {
11128
11529
  processId
@@ -11140,7 +11541,7 @@ function setupNpmRPC({ nuxt }) {
11140
11541
  async runNpmCommand(...args) {
11141
11542
  return runNpmCommand(...args);
11142
11543
  },
11143
- async installNuxtModule(name, dry = true) {
11544
+ async installNuxtModule(name, dry = true, sessionId) {
11144
11545
  const commands = await getNpmCommand("install", name, { dev: true });
11145
11546
  const filepath = nuxt.options._nuxtConfigFile;
11146
11547
  let source = latestGenerated;
@@ -11150,27 +11551,39 @@ function setupNpmRPC({ nuxt }) {
11150
11551
  addNuxtModule(mod, name);
11151
11552
  return mod.generate().code;
11152
11553
  });
11153
- const processId = `nuxt:add-module:${name}`;
11554
+ const processId = sessionId ?? createUniqueSessionId(`nuxt:add-module:${name}`);
11154
11555
  if (!dry) {
11155
11556
  latestGenerated = generated;
11156
11557
  installSet.add(name);
11157
- const process = startSubprocess({
11558
+ const session = await getTerminals().startChildProcess({
11158
11559
  command: commands[0],
11159
11560
  args: commands.slice(1)
11160
11561
  }, {
11161
11562
  id: processId,
11162
- name: `Install ${name}`,
11163
- icon: "carbon:intent-request-create",
11164
- restartable: false
11563
+ title: `Install ${name}`,
11564
+ icon: "carbon:intent-request-create"
11165
11565
  });
11166
- const result = await process.getResult();
11566
+ const result = await session.getResult();
11167
11567
  await Promise.resolve();
11168
11568
  installSet.delete(name);
11169
11569
  const code = result.exitCode;
11170
11570
  if (code !== 0) {
11171
11571
  console.error(result.stderr);
11572
+ ctx.notify({
11573
+ message: `Failed to install ${name}`,
11574
+ level: "error",
11575
+ description: `Process exited with code ${code}. Check the Install ${name} terminal for details.`,
11576
+ category: "module",
11577
+ notify: true
11578
+ });
11172
11579
  throw new Error(`[Nuxt DevTools] Failed to install module, process exited with ${code}`);
11173
11580
  }
11581
+ ctx.notify({
11582
+ message: `Installed ${name}`,
11583
+ level: "success",
11584
+ category: "module",
11585
+ notify: true
11586
+ });
11174
11587
  if (installSet.size === 0) {
11175
11588
  latestGenerated = null;
11176
11589
  await fs.writeFile(filepath, generated, "utf-8");
@@ -11183,40 +11596,43 @@ function setupNpmRPC({ nuxt }) {
11183
11596
  processId
11184
11597
  };
11185
11598
  },
11186
- async uninstallNuxtModule(name, dry = true) {
11599
+ async uninstallNuxtModule(name, dry = true, sessionId) {
11187
11600
  const commands = await getNpmCommand("uninstall", name);
11188
11601
  const filepath = nuxt.options._nuxtConfigFile;
11189
11602
  const source = await fs.readFile(filepath, "utf-8");
11190
11603
  const generated = await magicastGuard(async () => {
11191
- const mod = parseModule(source, { sourceFileName: filepath });
11192
- const config = getDefaultExportOptions(mod);
11193
- config.modules ||= [];
11194
- if (config.modules.includes(name)) {
11195
- Object.values(config.modules).forEach((value, index) => {
11196
- if (value === name)
11197
- config.modules.splice(index - 1, 1);
11198
- });
11199
- }
11200
- return mod.generate().code;
11604
+ return removeNuxtModuleFromCode(source, name, filepath);
11201
11605
  });
11202
- const processId = `nuxt:remove-module:${name}`;
11606
+ const processId = sessionId ?? createUniqueSessionId(`nuxt:remove-module:${name}`);
11203
11607
  if (!dry) {
11204
- const process = startSubprocess({
11608
+ const session = await getTerminals().startChildProcess({
11205
11609
  command: commands[0],
11206
11610
  args: commands.slice(1)
11207
11611
  }, {
11208
11612
  id: processId,
11209
- name: `Uninstall ${name}`,
11210
- icon: "carbon:intent-request-uninstall",
11211
- restartable: false
11613
+ title: `Uninstall ${name}`,
11614
+ icon: "carbon:intent-request-uninstall"
11212
11615
  });
11213
- const result = await process.getResult();
11616
+ const result = await session.getResult();
11214
11617
  await Promise.resolve();
11215
11618
  const code = result.exitCode;
11216
11619
  if (code !== 0) {
11217
11620
  console.error(result.stderr);
11621
+ ctx.notify({
11622
+ message: `Failed to uninstall ${name}`,
11623
+ level: "error",
11624
+ description: `Process exited with code ${code}. Check the Uninstall ${name} terminal for details.`,
11625
+ category: "module",
11626
+ notify: true
11627
+ });
11218
11628
  throw new Error(`[Nuxt DevTools] Failed to uninstall module, process exited with ${code}`);
11219
11629
  }
11630
+ ctx.notify({
11631
+ message: `Uninstalled ${name}`,
11632
+ level: "success",
11633
+ category: "module",
11634
+ notify: true
11635
+ });
11220
11636
  await fs.writeFile(filepath, generated, "utf-8");
11221
11637
  }
11222
11638
  return {
@@ -11229,71 +11645,6 @@ function setupNpmRPC({ nuxt }) {
11229
11645
  };
11230
11646
  }
11231
11647
 
11232
- function setupServerDataRPC({
11233
- nuxt
11234
- }) {
11235
- let nitro;
11236
- let viteServer;
11237
- let viteClient;
11238
- function normalizeViteConfig(config) {
11239
- return {
11240
- ...config,
11241
- environments: Object.fromEntries(
11242
- Object.entries(config.env).map(([key, _]) => {
11243
- return [key, null];
11244
- })
11245
- ),
11246
- plugins: config.plugins.map((i) => {
11247
- const clone = { ...i };
11248
- delete clone.api;
11249
- return clone;
11250
- }),
11251
- inlineConfig: null
11252
- };
11253
- }
11254
- nuxt.hook("nitro:build:before", (_nitro) => {
11255
- nitro = _nitro;
11256
- });
11257
- addVitePlugin({
11258
- name: "nuxt:devtools:config",
11259
- applyToEnvironment(environment) {
11260
- if (environment.name === "ssr") {
11261
- return {
11262
- name: "nuxt:devtools:config-retriever",
11263
- enforce: "post",
11264
- configResolved(config) {
11265
- viteServer = normalizeViteConfig(config);
11266
- }
11267
- };
11268
- }
11269
- if (environment.name === "client") {
11270
- return {
11271
- name: "nuxt:devtools:config-retriever",
11272
- enforce: "post",
11273
- configResolved(config) {
11274
- viteClient = normalizeViteConfig(config);
11275
- }
11276
- };
11277
- }
11278
- }
11279
- });
11280
- return {
11281
- getServerConfig() {
11282
- return nuxt.options;
11283
- },
11284
- async getServerData() {
11285
- return {
11286
- nuxt: nuxt.options,
11287
- nitro: nitro?.options,
11288
- vite: {
11289
- server: viteServer,
11290
- client: viteClient
11291
- }
11292
- };
11293
- }
11294
- };
11295
- }
11296
-
11297
11648
  async function watchStorageMount(storage, mountName, onChange) {
11298
11649
  const mountKey = normalizeBaseKey(mountName);
11299
11650
  const mount = storage.getMount(mountKey);
@@ -11417,14 +11768,16 @@ function setupServerTasksRPC({ nuxt, refresh }) {
11417
11768
  };
11418
11769
  }
11419
11770
 
11771
+ function skipInSSR(ctx) {
11772
+ return Boolean(ctx?.viteConfig?.build?.ssr);
11773
+ }
11774
+
11420
11775
  const IGNORE_STORAGE_MOUNTS = ["root", "build", "src", "cache"];
11421
11776
  function shouldIgnoreStorageKey(key) {
11422
11777
  return IGNORE_STORAGE_MOUNTS.includes(key.split(":")[0]);
11423
11778
  }
11424
- function setupStorageRPC({
11425
- nuxt,
11426
- rpc
11427
- }) {
11779
+ function setupStorageRPC(ctx) {
11780
+ const { nuxt } = ctx;
11428
11781
  const storageMounts = {};
11429
11782
  let storage;
11430
11783
  let unwatchStorageMounts = [];
@@ -11448,7 +11801,7 @@ function setupStorageRPC({
11448
11801
  return;
11449
11802
  await Promise.all(unwatchStorageMounts.map((unwatch) => unwatch()));
11450
11803
  unwatchStorageMounts = await Promise.all(Object.keys(storageMounts).map((mountName) => watchStorageMount(activeStorage, mountName, (event, key) => {
11451
- rpc.broadcast.callHook.asEvent("storage:key:update", key, event);
11804
+ ctx.devtoolsKit?.rpc.broadcast({ method: "callHook", args: ["storage:key:update", key, event], event: true });
11452
11805
  })));
11453
11806
  });
11454
11807
  nuxt.hook("close", async () => {
@@ -11536,89 +11889,6 @@ function telemetryEvent(payload, immediate = false) {
11536
11889
  throttledSend();
11537
11890
  }
11538
11891
 
11539
- function setupTerminalRPC({ nuxt, rpc, refresh }) {
11540
- const terminals = /* @__PURE__ */ new Map();
11541
- nuxt.hook("devtools:terminal:register", (terminal) => {
11542
- terminals.set(terminal.id, terminal);
11543
- refresh("getTerminals");
11544
- return terminal.id;
11545
- });
11546
- nuxt.hook("devtools:terminal:remove", ({ id }) => {
11547
- if (!terminals.has(id))
11548
- return false;
11549
- terminals.delete(id);
11550
- refresh("getTerminals");
11551
- return true;
11552
- });
11553
- nuxt.hook("devtools:terminal:write", ({ id, data }) => {
11554
- const terminal = terminals.get(id);
11555
- if (!terminal)
11556
- return false;
11557
- terminal.buffer ||= "";
11558
- terminal.buffer += data;
11559
- rpc.broadcast.onTerminalData.asEvent({ id, data });
11560
- return true;
11561
- });
11562
- nuxt.hook("devtools:terminal:exit", ({ id, code }) => {
11563
- const terminal = terminals.get(id);
11564
- if (!terminal)
11565
- return false;
11566
- terminal.isTerminated = true;
11567
- rpc.broadcast.onTerminalExit.asEvent({ id, code });
11568
- refresh("getTerminals");
11569
- return true;
11570
- });
11571
- function serializeTerminal(terminal, buffer = false) {
11572
- if (!terminal)
11573
- return;
11574
- return {
11575
- id: terminal.id,
11576
- name: terminal.name,
11577
- description: terminal.description,
11578
- icon: terminal.icon,
11579
- terminatable: terminal.terminatable ?? !!terminal.onActionTerminate,
11580
- restartable: terminal.restartable ?? !!terminal.onActionRestart,
11581
- isTerminated: terminal.isTerminated,
11582
- buffer: buffer ? terminal.buffer : void 0
11583
- };
11584
- }
11585
- return {
11586
- getTerminals() {
11587
- return Array.from(terminals.values(), (i) => serializeTerminal(i));
11588
- },
11589
- async getTerminalDetail(id) {
11590
- return serializeTerminal(terminals.get(id), true);
11591
- },
11592
- async runTerminalAction(id, action) {
11593
- const terminal = terminals.get(id);
11594
- if (!terminal)
11595
- return false;
11596
- switch (action) {
11597
- case "restart":
11598
- if (!terminal.onActionRestart)
11599
- return false;
11600
- await terminal.onActionRestart();
11601
- return true;
11602
- case "terminate":
11603
- if (!terminal.onActionTerminate)
11604
- return false;
11605
- await terminal.onActionTerminate();
11606
- return true;
11607
- case "remove":
11608
- if (!terminal.isTerminated)
11609
- terminal.onActionTerminate?.();
11610
- terminals.delete(id);
11611
- refresh("getTerminals");
11612
- return true;
11613
- case "clear":
11614
- terminal.buffer = "";
11615
- refresh("getTerminals");
11616
- return true;
11617
- }
11618
- }
11619
- };
11620
- }
11621
-
11622
11892
  function setupTimelineRPC({ nuxt }) {
11623
11893
  return {
11624
11894
  async enableTimeline(dry) {
@@ -11682,14 +11952,29 @@ function setupRPC(nuxt, options) {
11682
11952
  return true;
11683
11953
  }
11684
11954
  });
11685
- const rpc = {
11955
+ const rpc = new Proxy({
11686
11956
  broadcast: createBroadcastProxy(),
11687
11957
  functions: functionsProxy
11688
- };
11958
+ }, {
11959
+ get(target, prop, receiver) {
11960
+ if (prop === "broadcast" || prop === "functions") {
11961
+ deprecate(nuxt, "NDT_DEP_0007", {
11962
+ api: `nuxt.devtools.rpc.${prop}`,
11963
+ replacement: "the connected ctx.rpc from onDevtoolsReady((ctx) => ...)"
11964
+ }, { key: prop });
11965
+ }
11966
+ return Reflect.get(target, prop, receiver);
11967
+ }
11968
+ });
11689
11969
  function refresh(event) {
11690
11970
  broadcast("refresh", event);
11691
11971
  }
11972
+ const notify = createNotifier(nuxt);
11692
11973
  function extendServerRpc(namespace, functions) {
11974
+ deprecate(nuxt, "NDT_DEP_0003", {
11975
+ api: "extendServerRpc",
11976
+ replacement: "onDevtoolsReady((ctx) => ctx.rpc.register(defineRpcFunction(...)))"
11977
+ }, { key: namespace });
11693
11978
  extendedRpcMap.set(namespace, functions);
11694
11979
  if (devtoolsKitCtx) {
11695
11980
  for (const [fnName, handler] of Object.entries(functions)) {
@@ -11713,70 +11998,71 @@ function setupRPC(nuxt, options) {
11713
11998
  return devtoolsKitCtx;
11714
11999
  },
11715
12000
  refresh,
12001
+ notify,
11716
12002
  extendServerRpc,
11717
12003
  openInEditorHooks: []
11718
12004
  };
11719
12005
  nuxt.devtools = ctx;
11720
12006
  Object.assign(serverFunctions, {
11721
12007
  ...setupGeneralRPC(ctx),
12008
+ ...setupMessagesRPC(ctx),
11722
12009
  ...setupCustomTabRPC(ctx),
11723
12010
  ...setupStorageRPC(ctx),
11724
12011
  ...setupAssetsRPC(ctx),
11725
12012
  ...setupNpmRPC(ctx),
11726
- ...setupTerminalRPC(ctx),
12013
+ // Bridge the `devtools:terminal:*` hooks onto the Vite DevTools terminals
12014
+ // host so module terminals surface in the built-in Terminals dock. Also
12015
+ // registers its own hook listeners (including `devtools:ready`) as a side
12016
+ // effect, and contributes the `revealTerminal` RPC.
12017
+ ...setupTerminalsBridge(ctx),
11727
12018
  ...setupServerRoutesRPC(ctx),
11728
12019
  ...setupServerTasksRPC(ctx),
11729
12020
  ...setupAnalyzeBuildRPC(ctx),
11730
12021
  ...setupOptionsRPC(ctx),
11731
12022
  ...setupTimelineRPC(ctx),
11732
12023
  ...setupTelemetryRPC(ctx),
11733
- ...setupServerDataRPC(ctx)
12024
+ // Deprecated compat shim (NDT_DEP_0009). The capture + live source now live
12025
+ // in the Data Inspector integration; `getServerConfig` is served by the
12026
+ // canonical `setupGeneralRPC` above.
12027
+ getServerData: async () => getServerData(nuxt)
11734
12028
  });
11735
- function connectDevToolsKit(ctx2) {
11736
- if (devtoolsKitCtx)
12029
+ async function connectDevToolsKit(kitCtx) {
12030
+ if (devtoolsKitCtx || skipInSSR(kitCtx))
11737
12031
  return;
11738
- devtoolsKitCtx = ctx2;
11739
- const host = ctx2.rpc;
12032
+ devtoolsKitCtx = kitCtx;
12033
+ const host = kitCtx.rpc;
11740
12034
  for (const { method, args } of pendingBroadcasts) {
11741
12035
  broadcast(method, ...args);
11742
12036
  }
11743
12037
  pendingBroadcasts.length = 0;
11744
- for (const [name, handler] of Object.entries(serverFunctions)) {
11745
- if (typeof handler === "function") {
11746
- try {
11747
- host.register({
11748
- name,
11749
- handler
11750
- });
11751
- } catch (e) {
11752
- logger.warn(
11753
- colors.yellow(`[nuxt-devtools] Failed to register RPC function "${name}":
12038
+ registerHostDiagnostics(ctx);
12039
+ function registerFn(name, handler) {
12040
+ try {
12041
+ host.register({ name, handler });
12042
+ } catch (e) {
12043
+ logger.warn(
12044
+ colors.yellow(`[nuxt-devtools] Failed to register RPC function "${name}":
11754
12045
  `) + colors.red(e?.message || "")
11755
- );
11756
- }
12046
+ );
11757
12047
  }
11758
12048
  }
12049
+ for (const [name, handler] of Object.entries(serverFunctions)) {
12050
+ if (typeof handler !== "function")
12051
+ continue;
12052
+ registerFn(`${RPC_NAMESPACE}:${name}`, handler);
12053
+ registerFn(name, handler);
12054
+ }
11759
12055
  for (const [namespace, fns] of extendedRpcMap) {
11760
12056
  for (const [fnName, handler] of Object.entries(fns)) {
11761
- if (typeof handler === "function") {
11762
- try {
11763
- host.register({
11764
- name: `${namespace}:${fnName}`,
11765
- handler
11766
- });
11767
- } catch (e) {
11768
- logger.warn(
11769
- colors.yellow(`[nuxt-devtools] Failed to register RPC function "${namespace}:${fnName}":
11770
- `) + colors.red(e?.message || "")
11771
- );
11772
- }
11773
- }
12057
+ if (typeof handler === "function")
12058
+ registerFn(`${namespace}:${fnName}`, handler);
11774
12059
  }
11775
12060
  }
12061
+ await nuxt.callHook("devtools:ready", kitCtx);
11776
12062
  }
11777
12063
  return {
11778
12064
  connectDevToolsKit,
11779
- ...ctx
12065
+ ctx
11780
12066
  };
11781
12067
  }
11782
12068
 
@@ -11795,8 +12081,12 @@ async function enableModule(options, nuxt) {
11795
12081
  return;
11796
12082
  }
11797
12083
  await nuxt.callHook("devtools:before");
11798
- if (nuxt.options.devtools && typeof nuxt.options.devtools !== "boolean" && "disableAuthorization" in nuxt.options.devtools) {
11799
- logger.warn("[nuxt-devtools] `disableAuthorization` option is deprecated. Auth is now handled by Vite DevTools.");
12084
+ if (options.disableAuthorization) {
12085
+ extendViteConfig((config) => {
12086
+ const devtoolsConfig = config.devtools ||= {};
12087
+ if (devtoolsConfig.clientAuth === void 0)
12088
+ devtoolsConfig.clientAuth = false;
12089
+ });
11800
12090
  }
11801
12091
  if (options.iframeProps) {
11802
12092
  nuxt.options.runtimeConfig.app.devtools ||= {};
@@ -11829,15 +12119,49 @@ async function enableModule(options, nuxt) {
11829
12119
  addVitePlugin(defineViteDevToolsPlugin({
11830
12120
  name: "nuxt:devtools",
11831
12121
  devtools: {
11832
- setup(ctx2) {
11833
- ctx2.docks.register({
11834
- id: "nuxt:devtools",
11835
- type: "iframe",
11836
- icon: "https://nuxt.com/assets/design-kit/icon-green.svg",
11837
- title: "Nuxt DevTools",
11838
- url: "/__nuxt_devtools__/client/"
11839
- });
11840
- connectDevToolsKit?.(ctx2);
12122
+ async setup(ctx2) {
12123
+ if (!skipInSSR(ctx2)) {
12124
+ ctx2.docks.register({
12125
+ id: NUXT_DEVTOOLS_GROUP_ID,
12126
+ type: "group",
12127
+ title: "Nuxt",
12128
+ icon: "/__nuxt_devtools__/client/nuxt.svg",
12129
+ category: "framework",
12130
+ defaultOrder: -2e3,
12131
+ defaultChildId: "nuxt:devtools",
12132
+ // Order the in-group sub-categories (each member's `category`) the
12133
+ // way Nuxt DevTools orders its own tab categories, rather than the
12134
+ // dock's shared default table. Requires `@vitejs/devtools` >= 0.4.6
12135
+ // / `@devframes/hub` >= 0.7.12 (vitejs/devtools#468).
12136
+ categoryOrder: {
12137
+ "pinned": 0,
12138
+ "app": 1,
12139
+ "vue-devtools": 2,
12140
+ "analyze": 3,
12141
+ "server": 4,
12142
+ "modules": 5,
12143
+ "documentation": 6,
12144
+ "advanced": 7
12145
+ }
12146
+ });
12147
+ ctx2.docks.register({
12148
+ id: "nuxt:devtools",
12149
+ type: "iframe",
12150
+ title: "Nuxt DevTools",
12151
+ icon: "/__nuxt_devtools__/client/nuxt.svg",
12152
+ // The client renders chromelessly as this shared-frame anchor (no
12153
+ // SideNav/split pane) and runs the frame-nav shim, which announces
12154
+ // one member dock per tab and soft-navigates within this one iframe.
12155
+ url: "/__nuxt_devtools__/client/",
12156
+ groupId: NUXT_DEVTOOLS_GROUP_ID,
12157
+ frameId: "nuxt:devtools",
12158
+ subTabs: { protocol: "postmessage" },
12159
+ // TODO: this seems still not working correctly with defaultChildId, enable it back later.
12160
+ // visibility: 'false',
12161
+ defaultOrder: -300
12162
+ });
12163
+ }
12164
+ await connectDevToolsKit?.(ctx2);
11841
12165
  }
11842
12166
  }
11843
12167
  }));
@@ -11849,9 +12173,7 @@ async function enableModule(options, nuxt) {
11849
12173
  filename: "devtools/settings.mjs",
11850
12174
  async getContents() {
11851
12175
  const uiOptions = await readLocalOptions(
11852
- {
11853
- ...defaultTabOptions.ui
11854
- },
12176
+ createDefaultTabOptions().ui,
11855
12177
  { root: nuxt.options.rootDir }
11856
12178
  );
11857
12179
  return `export default ${JSON.stringify({
@@ -11861,7 +12183,7 @@ async function enableModule(options, nuxt) {
11861
12183
  });
11862
12184
  nuxt.hook("nitro:config", (config) => {
11863
12185
  if (config.experimental?.tasks)
11864
- defaultTabOptions.serverTasks.enabled = true;
12186
+ setServerTasksEnabledByDefault(true);
11865
12187
  config.externals = config.externals || {};
11866
12188
  config.externals.inline = config.externals.inline || [];
11867
12189
  config.externals.inline.push(join(runtimeDir, "nitro"));
@@ -11881,7 +12203,7 @@ window.__NUXT_DEVTOOLS_TIME_METRIC__.appInit = Date.now()
11881
12203
  });
11882
12204
  const {
11883
12205
  connectDevToolsKit: _connectDevToolsKit,
11884
- ...ctx
12206
+ ctx
11885
12207
  } = setupRPC(nuxt, options);
11886
12208
  connectDevToolsKit = _connectDevToolsKit;
11887
12209
  const clientDirExists = existsSync(clientDir);
@@ -11923,13 +12245,15 @@ window.__NUXT_DEVTOOLS_TIME_METRIC__.appInit = Date.now()
11923
12245
  res.end();
11924
12246
  };
11925
12247
  server.middlewares.use(ROUTE_CLIENT, (req, res) => {
11926
- if (req.url === "/")
12248
+ const pathname = (req.url || "/").split("?")[0];
12249
+ if (pathname === "/" || pathname === "")
11927
12250
  return handleIndex(res);
11928
12251
  return handleStatic(req, res, () => handleIndex(res));
11929
12252
  });
11930
12253
  }
11931
12254
  });
11932
12255
  await import('./plugin-metrics.mjs').then(({ setup }) => setup(ctx));
12256
+ await Promise.resolve().then(function () { return dataInspector; }).then(({ setup }) => setup(ctx));
11933
12257
  if (options.vueDevTools !== false)
11934
12258
  await import('./vue-devtools.mjs').then(({ setup }) => setup(ctx));
11935
12259
  if (options.viteInspect !== false)
@@ -11937,7 +12261,7 @@ window.__NUXT_DEVTOOLS_TIME_METRIC__.appInit = Date.now()
11937
12261
  if (options.componentInspector !== false)
11938
12262
  await import('./vue-tracer.mjs').then(({ setup }) => setup(ctx));
11939
12263
  const integrations = [
11940
- options.vscode?.enabled ? import('./vscode.mjs').then(({ setup }) => setup(ctx)) : null,
12264
+ import('./code-server.mjs').then(({ setup }) => setup(ctx)),
11941
12265
  options.experimental?.timeline || options.timeline?.enabled ? import('./timeline.mjs').then(({ setup }) => setup(ctx)) : null
11942
12266
  ];
11943
12267
  await Promise.all(integrations);
@@ -11962,4 +12286,9 @@ function defineViteDevToolsPlugin(plugin) {
11962
12286
  return plugin;
11963
12287
  }
11964
12288
 
11965
- export { enableModule };
12289
+ const moduleMain = {
12290
+ __proto__: null,
12291
+ enableModule: enableModule
12292
+ };
12293
+
12294
+ export { RPC_NAMESPACE as R, moduleMain as m };