@nuxt/devtools 4.0.0-alpha.6 → 4.0.0-alpha.8

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 (162) hide show
  1. package/dist/chunks/analyze-build.mjs +32 -0
  2. package/dist/chunks/module-main.mjs +611 -303
  3. package/dist/chunks/timeline.mjs +2 -2
  4. package/dist/chunks/vite-inspect.mjs +75 -39
  5. package/dist/chunks/vscode.mjs +6 -7
  6. package/dist/client/200.html +1 -1
  7. package/dist/client/404.html +1 -1
  8. package/dist/client/_nuxt/__blank-mr7fdmv7.js +1 -0
  9. package/dist/client/_nuxt/analyze-build-nemej5kd.js +1 -0
  10. package/dist/client/_nuxt/assets-cl372mus.js +6 -0
  11. package/dist/client/_nuxt/{auth-required-panel-gwrodxrm.js → auth-required-panel-gdnspumn.js} +1 -1
  12. package/dist/client/_nuxt/builds/latest.json +1 -1
  13. package/dist/client/_nuxt/builds/meta/9ec1ff21-8126-4e86-bc50-039a1d3867c9.json +1 -0
  14. package/dist/client/_nuxt/{client-jwk7bkap.js → client-ngo84kjy.js} +1 -1
  15. package/dist/client/_nuxt/{code-diff-d1bf4mlz.js → code-diff-lkyoam09.js} +3 -3
  16. package/dist/client/_nuxt/code-snippets-hxwvpad4.js +1 -0
  17. package/dist/client/_nuxt/components-f9ckplr6.js +1 -0
  18. package/dist/client/_nuxt/composable-item-kchrxdzu.js +1 -0
  19. package/dist/client/_nuxt/composables-in7qtp0e.js +1 -0
  20. package/dist/client/_nuxt/custom-_name_-i8pdh231.js +1 -0
  21. package/dist/client/_nuxt/data-schema-button-jy2w2afg.js +1 -0
  22. package/dist/client/_nuxt/{data-schema-drawer-5ccj6aug.js → data-schema-drawer-liuhj385.js} +2 -2
  23. package/dist/client/_nuxt/debug-inf9k7rz.js +1 -0
  24. package/dist/client/_nuxt/{default-ibmlv6hu.js → default-dgqm22gk.js} +1 -1
  25. package/dist/client/_nuxt/dist-cwkxp5t4.js +1 -0
  26. package/dist/client/_nuxt/dist-das2ggjj.js +1 -0
  27. package/dist/client/_nuxt/dist-hhnji3pn.js +1 -0
  28. package/dist/client/_nuxt/{duration-display-cfe3xsok.js → duration-display-m84jv0cg.js} +1 -1
  29. package/dist/client/_nuxt/entry.css-ivisc4pv.css +1 -0
  30. package/dist/client/_nuxt/error-404-eoz73pl9.js +1 -0
  31. package/dist/client/_nuxt/error-404.css-i7pin5fo.css +1 -0
  32. package/dist/client/_nuxt/error-500-h0agvsjp.js +1 -0
  33. package/dist/client/_nuxt/error-500.css-4ikva5xr.css +1 -0
  34. package/dist/client/_nuxt/error-h5jfp4d9.js +9 -0
  35. package/dist/client/_nuxt/{filepath-item-calgslzq.js → filepath-item-b7ye3und.js} +1 -1
  36. package/dist/client/_nuxt/full-bc145h1r.js +1 -0
  37. package/dist/client/_nuxt/{help-fab-ietvwhig.js → help-fab-l6k9jkcj.js} +1 -1
  38. package/dist/client/_nuxt/hooks-ce5n3mpx.js +1 -0
  39. package/dist/client/_nuxt/iefeupks.js +4 -0
  40. package/dist/client/_nuxt/imports-ib3kw7ns.js +1 -0
  41. package/dist/client/_nuxt/launch-page-f3nbtoc4.js +1 -0
  42. package/dist/client/_nuxt/modules-gf4tkhai.js +1 -0
  43. package/dist/client/_nuxt/nbadge-254fd0s4.js +1 -0
  44. package/dist/client/_nuxt/{ncheckbox-gl62y715.js → ncheckbox-jr3c6e4e.js} +1 -1
  45. package/dist/client/_nuxt/ncode-block-jv3jk7c5.js +2 -0
  46. package/dist/client/_nuxt/{ndrawer-evv584t1.js → ndrawer-myfvks89.js} +1 -1
  47. package/dist/client/_nuxt/{ndropdown-dqqc8bnq.js → ndropdown-jnrvla1s.js} +1 -1
  48. package/dist/client/_nuxt/{nicon-title-f3ho3hah.js → nicon-title-66kg2f9l.js} +1 -1
  49. package/dist/client/_nuxt/{nlink-endeyoly.js → nlink-gej31v24.js} +1 -1
  50. package/dist/client/_nuxt/{nmarkdown-iw4stzqp.js → nmarkdown-nskcr8pg.js} +1 -1
  51. package/dist/client/_nuxt/{nnavbar-n8fcnalx.js → nnavbar-bvq6rk5u.js} +1 -1
  52. package/dist/client/_nuxt/none-fcxnfo1z.js +1 -0
  53. package/dist/client/_nuxt/{nsection-block-n5u7wj9x.js → nsection-block-illvvuef.js} +1 -1
  54. package/dist/client/_nuxt/{nselect-kdzalcm2.js → nselect-hlo7a40m.js} +1 -1
  55. package/dist/client/_nuxt/nselect-tabs-f47fcdsg.js +1 -0
  56. package/dist/client/_nuxt/nswitch-iey7gi9t.js +1 -0
  57. package/dist/client/_nuxt/{ntip-m8x8y44j.js → ntip-kpuxzuo5.js} +1 -1
  58. package/dist/client/_nuxt/nuxt-hqfu72u1.js +2 -0
  59. package/dist/client/_nuxt/open-graph-m35euip2.js +3 -0
  60. package/dist/client/_nuxt/overview-egkv3tit.js +1 -0
  61. package/dist/client/_nuxt/pages-ddqyzugj.js +1 -0
  62. package/dist/client/_nuxt/pages-n0i7aw4m.js +1 -0
  63. package/dist/client/_nuxt/payload-d6h8l8l2.js +1 -0
  64. package/dist/client/_nuxt/pinia-dl2li4zl.js +1 -0
  65. package/dist/client/_nuxt/plugins-nhvbpqrg.js +1 -0
  66. package/dist/client/_nuxt/ready-if1s6ugr.js +1 -0
  67. package/dist/client/_nuxt/render-tree-h0xpx3p4.js +1 -0
  68. package/dist/client/_nuxt/rpc-jaaujnev.js +1 -0
  69. package/dist/client/_nuxt/runtime-configs-o91gwu2q.js +1 -0
  70. package/dist/client/_nuxt/server-route-inputs-ej6h9rh8.js +1 -0
  71. package/dist/client/_nuxt/server-routes-ocltmxje.js +7 -0
  72. package/dist/client/_nuxt/server-tasks-hhkstkby.js +1 -0
  73. package/dist/client/_nuxt/settings-i2ld0c8q.js +1 -0
  74. package/dist/client/_nuxt/stacktrace-list-epxhdumx.js +1 -0
  75. package/dist/client/_nuxt/{state-components-eaw2evd3.js → state-components-eipbhsbn.js} +1 -1
  76. package/dist/client/_nuxt/{state-editor-jm35t8p1.js → state-editor-ogobz58w.js} +1 -1
  77. package/dist/client/_nuxt/state-modules-egymhwqw.js +1 -0
  78. package/dist/client/_nuxt/storage-cciny388.js +1 -0
  79. package/dist/client/_nuxt/storage-options-g42elkwy.js +1 -0
  80. package/dist/client/_nuxt/timeline-oese6i7t.js +31 -0
  81. package/dist/client/_nuxt/{unocss-runtime-mcb0a6oh.js → unocss-runtime-dh4insrr.js} +1 -1
  82. package/dist/client/_nuxt/utils-h3uzf8s7.js +2 -0
  83. package/dist/client/_nuxt/vendor/json-editor-vue-c7zwcfg4.js +3861 -0
  84. package/dist/client/_nuxt/vendor/{markdown-it-gg8o3tmh.js → markdown-it-cx0uvu2o.js} +1 -1
  85. package/dist/client/_nuxt/vendor/{quicktype-core-ozubcbyl.js → quicktype-core-otmjigaj.js} +65 -65
  86. package/dist/client/_nuxt/vendor/shiki-mgsi4s2l.js +153 -0
  87. package/dist/client/_nuxt/vendor/unocss-maavuy8p.js +3 -0
  88. package/dist/client/_nuxt/virtual-files-pd2s0ff2.js +1 -0
  89. package/dist/client/_nuxt/vue-devtools-bxffe3ae.js +4 -0
  90. package/dist/client/_nuxt/vue-router-mro49nyg.js +1 -0
  91. package/dist/client/index.html +1 -1
  92. package/dist/module.json +1 -1
  93. package/dist/module.mjs +1 -1
  94. package/dist/runtime/plugins/view/client.js +15 -0
  95. package/dist/shared/devtools.B9TxdMuu.mjs +119 -0
  96. package/dist/types.d.mts +1 -5
  97. package/dist/webcomponents/index.mjs +1 -1
  98. package/package.json +45 -49
  99. package/.discoveryrc.cjs +0 -13
  100. package/dist/client/_nuxt/__blank-ekrx7eve.js +0 -1
  101. package/dist/client/_nuxt/analyze-build-gtjxxh9s.js +0 -1
  102. package/dist/client/_nuxt/assets-fxuoynew.js +0 -6
  103. package/dist/client/_nuxt/builds/meta/386e78c8-3698-49a8-a7c5-53c44542b939.json +0 -1
  104. package/dist/client/_nuxt/code-snippets-nodldh90.js +0 -1
  105. package/dist/client/_nuxt/components-ibu6c1zd.js +0 -1
  106. package/dist/client/_nuxt/composable-item-lb3qexrh.js +0 -1
  107. package/dist/client/_nuxt/custom-_name_-dt22ybu3.js +0 -1
  108. package/dist/client/_nuxt/data-schema-button-m4wb470q.js +0 -1
  109. package/dist/client/_nuxt/debug-nxl66qh3.js +0 -1
  110. package/dist/client/_nuxt/dist-nsuzcp77.js +0 -1
  111. package/dist/client/_nuxt/entry.css-m21ytcnz.css +0 -1
  112. package/dist/client/_nuxt/error-404-izmgsqlm.js +0 -1
  113. package/dist/client/_nuxt/error-404.css-l9jcssuy.css +0 -1
  114. package/dist/client/_nuxt/error-500-fejd4grh.js +0 -1
  115. package/dist/client/_nuxt/error-500.css-he4ew8b1.css +0 -1
  116. package/dist/client/_nuxt/error-mm873c55.js +0 -9
  117. package/dist/client/_nuxt/full-pesi6bu3.js +0 -1
  118. package/dist/client/_nuxt/h0fobd1u.js +0 -4
  119. package/dist/client/_nuxt/hooks-mqgelnks.js +0 -1
  120. package/dist/client/_nuxt/imports-bofdhcsr.js +0 -1
  121. package/dist/client/_nuxt/launch-page-i8mgxym7.js +0 -1
  122. package/dist/client/_nuxt/modules-b6uha2ss.js +0 -1
  123. package/dist/client/_nuxt/nbadge-ft1i3ddy.js +0 -1
  124. package/dist/client/_nuxt/ncode-block-ksrq5ppu.js +0 -2
  125. package/dist/client/_nuxt/none-gr24yqiq.js +0 -1
  126. package/dist/client/_nuxt/nselect-tabs-e440xayq.js +0 -1
  127. package/dist/client/_nuxt/nswitch-pdw73751.js +0 -1
  128. package/dist/client/_nuxt/nuxt-kphganvs.js +0 -1
  129. package/dist/client/_nuxt/open-graph-mtq8qyx5.js +0 -3
  130. package/dist/client/_nuxt/overview-mgkokpl9.js +0 -1
  131. package/dist/client/_nuxt/pages-g3tcvbsn.js +0 -1
  132. package/dist/client/_nuxt/pages-lk0hxlsc.js +0 -1
  133. package/dist/client/_nuxt/payload-ovd8emqe.js +0 -1
  134. package/dist/client/_nuxt/pinia-e6em75yg.js +0 -1
  135. package/dist/client/_nuxt/plugins-ojph2z4c.js +0 -1
  136. package/dist/client/_nuxt/ready-b5u27bv4.js +0 -1
  137. package/dist/client/_nuxt/render-tree-iwtso0n9.js +0 -1
  138. package/dist/client/_nuxt/rpc-ewzip6fb.js +0 -4
  139. package/dist/client/_nuxt/runtime-configs-gyhmrfcz.js +0 -1
  140. package/dist/client/_nuxt/server-discovery-cfu428ir.js +0 -1
  141. package/dist/client/_nuxt/server-route-inputs-hhxdu10p.js +0 -1
  142. package/dist/client/_nuxt/server-routes-efc7olve.js +0 -7
  143. package/dist/client/_nuxt/server-tasks-o59rfww6.js +0 -1
  144. package/dist/client/_nuxt/settings-c6tbo50r.js +0 -1
  145. package/dist/client/_nuxt/stacktrace-list-c5b46nul.js +0 -1
  146. package/dist/client/_nuxt/state-modules-oox7nhib.js +0 -1
  147. package/dist/client/_nuxt/storage-fdd2zc94.js +0 -1
  148. package/dist/client/_nuxt/storage-options-ho965h55.js +0 -1
  149. package/dist/client/_nuxt/terminals-b8awmi75.js +0 -1
  150. package/dist/client/_nuxt/terminals.css-mejv43xm.css +0 -1
  151. package/dist/client/_nuxt/timeline-nsh72kov.js +0 -31
  152. package/dist/client/_nuxt/utils-hgmynvjd.js +0 -2
  153. package/dist/client/_nuxt/vendor/json-editor-vue-mkw4apmc.js +0 -3869
  154. package/dist/client/_nuxt/vendor/shiki-c7z35hpo.js +0 -293
  155. package/dist/client/_nuxt/vendor/unocss-mfjt4fak.js +0 -3
  156. package/dist/client/_nuxt/vendor/xterm-eb5atty5.js +0 -36
  157. package/dist/client/_nuxt/vendor/xterm.css-j9zpjwmg.css +0 -1
  158. package/dist/client/_nuxt/virtual-files-met9zkti.js +0 -1
  159. package/dist/client/_nuxt/vue-devtools-bl144b70.js +0 -4
  160. package/dist/client/_nuxt/vue-router-cnnrtyb0.js +0 -1
  161. package/dist/client/discovery/index.html +0 -611
  162. 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.B9TxdMuu.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,170 @@ 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.6";
36
+ const version$1 = "4.0.0-alpha.8";
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: "framework",
99
+ defaultOrder: -100
100
+ }
101
+ });
102
+ }, nuxt);
103
+ }
104
+ function getServerData(nuxt) {
105
+ deprecate(nuxt, "NDT_DEP_0009", {
106
+ api: "getServerData()",
107
+ replacement: "the Nuxt Application source in the Data Inspector panel"
108
+ });
109
+ return {
110
+ nuxt: nuxt.options,
111
+ nitro: captured.nitro?.options,
112
+ vite: {
113
+ server: captured.viteSsr ? normalizeViteConfig(captured.viteSsr) : void 0,
114
+ client: captured.viteClient ? normalizeViteConfig(captured.viteClient) : void 0
115
+ }
116
+ // `nuxt.options` is `@nuxt/schema`'s `NuxtOptions` while `NuxtServerData`
117
+ // pins the structurally-identical `nuxt/schema` one; bridge the two.
118
+ };
119
+ }
120
+
121
+ const dataInspector = {
122
+ __proto__: null,
123
+ getServerData: getServerData,
124
+ setup: setup
125
+ };
126
+
127
+ const RPC_NAMESPACE = "nuxt:devtools";
128
+
129
+ let counter = 0;
130
+ function createUniqueSessionId(baseId) {
131
+ counter += 1;
132
+ return `${baseId}#${counter}`;
133
+ }
34
134
 
35
135
  const COLON_RE = /:/g;
36
- function setupAnalyzeBuildRPC({ nuxt, refresh }) {
136
+ function setupAnalyzeBuildRPC(ctx) {
137
+ const { nuxt, refresh } = ctx;
37
138
  let builds = [];
38
139
  let promise;
39
140
  let initalized;
40
- const processId = "devtools:analyze-build";
141
+ let activeSessionId;
41
142
  const devtoolsAnalyzeDir = join(nuxt.options.rootDir, "node_modules/.cache/nuxt-devtools/analyze");
42
143
  async function startAnalyzeBuild(name) {
43
144
  if (promise)
44
145
  throw new Error("[Nuxt DevTools] A building process is already running");
45
- const result = startSubprocess({
146
+ const kit = ctx.devtoolsKit;
147
+ if (!kit)
148
+ throw new Error("[Nuxt DevTools] Vite DevTools kit is not connected yet.");
149
+ const sessionId = createUniqueSessionId("devtools:analyze-build");
150
+ activeSessionId = sessionId;
151
+ const session = await kit.terminals.startChildProcess({
46
152
  command: "npx",
47
153
  args: ["nuxi", "analyze", "--no-serve", "--name", name],
48
154
  cwd: nuxt.options.rootDir
49
155
  }, {
50
- id: processId,
51
- name: "Analyze Build",
156
+ id: sessionId,
157
+ title: "Analyze Build",
52
158
  icon: "logos-nuxt-icon"
53
- }, nuxt);
159
+ });
54
160
  refresh("getAnalyzeBuildInfo");
55
161
  initalized = void 0;
56
- promise = Promise.resolve(result.getResult()).then(() => {
162
+ promise = Promise.resolve(session.getResult()).then((result) => {
163
+ if (result.exitCode && result.exitCode !== 0) {
164
+ ctx.notify({
165
+ message: `Build analysis "${name}" failed`,
166
+ level: "error",
167
+ description: `Process exited with code ${result.exitCode}. Check the Analyze Build terminal for details.`,
168
+ category: "build",
169
+ notify: true
170
+ });
171
+ } else {
172
+ ctx.notify({
173
+ message: `Build analysis "${name}" complete`,
174
+ level: "success",
175
+ category: "build",
176
+ notify: true
177
+ });
178
+ }
57
179
  refresh("getAnalyzeBuildInfo");
58
180
  return readBuildInfo();
181
+ }).catch((error) => {
182
+ ctx.notify({
183
+ message: `Build analysis "${name}" failed`,
184
+ level: "error",
185
+ description: error instanceof Error ? error.message : String(error),
186
+ category: "build",
187
+ notify: true
188
+ });
59
189
  }).finally(() => {
60
190
  promise = void 0;
61
191
  initalized = void 0;
192
+ activeSessionId = void 0;
62
193
  refresh("getAnalyzeBuildInfo");
63
194
  });
64
- return processId;
195
+ return sessionId;
65
196
  }
66
197
  async function readBuildInfo() {
67
198
  for (const dir of /* @__PURE__ */ new Set([
@@ -124,6 +255,7 @@ function setupAnalyzeBuildRPC({ nuxt, refresh }) {
124
255
  await initalized;
125
256
  return {
126
257
  isBuilding: !!promise,
258
+ activeSessionId,
127
259
  builds
128
260
  };
129
261
  },
@@ -726,6 +858,9 @@ var defaultOptions = {
726
858
  // Can be either `"script"`, `"module"` or `"commonjs"`. This influences global
727
859
  // strict mode and parsing of `import` and `export` declarations.
728
860
  sourceType: "script",
861
+ // When set to true, enable strict parsing mode even if `sourceType`
862
+ // is `"script"`.
863
+ strict: false,
729
864
  // `onInsertedSemicolon` can be a callback that will be called when
730
865
  // a semicolon is automatically inserted. It will be passed the
731
866
  // position of the inserted semicolon as an offset, and if
@@ -952,7 +1087,7 @@ var Parser = function Parser(options, input, startPos) {
952
1087
 
953
1088
  // Figure out if it's a module code.
954
1089
  this.inModule = options.sourceType === "module";
955
- this.strict = this.inModule || this.strictDirective(this.pos);
1090
+ this.strict = this.inModule || options.strict === true || this.strictDirective(this.pos);
956
1091
 
957
1092
  // Used to signify the start of a potential arrow function
958
1093
  this.potentialArrowAt = -1;
@@ -990,9 +1125,11 @@ var Parser = function Parser(options, input, startPos) {
990
1125
  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
1126
 
992
1127
  Parser.prototype.parse = function parse () {
1128
+ var this$1$1 = this;
1129
+
993
1130
  var node = this.options.program || this.startNode();
994
1131
  this.nextToken();
995
- return this.parseTopLevel(node)
1132
+ return this.catchStackOverflow(function () { return this$1$1.parseTopLevel(node); })
996
1133
  };
997
1134
 
998
1135
  prototypeAccessors.inFunction.get = function () { return (this.currentVarScope().flags & SCOPE_FUNCTION) > 0 };
@@ -1131,6 +1268,17 @@ pp$9.eatContextual = function(name) {
1131
1268
  return true
1132
1269
  };
1133
1270
 
1271
+ pp$9.catchStackOverflow = function(f) {
1272
+ try {
1273
+ return f()
1274
+ } catch (e) {
1275
+ if (e instanceof Error && (/\bstack\b.*\b(exceeded|overflow)\b/i.test(e.message) || /\btoo much recursion\b/i.test(e.message)))
1276
+ { this.raise(this.start, "Not enough stack space to parse input"); }
1277
+ else
1278
+ { throw e }
1279
+ }
1280
+ };
1281
+
1134
1282
  // Asserts that following token is given contextual keyword.
1135
1283
 
1136
1284
  pp$9.expectContextual = function(name) {
@@ -1234,10 +1382,10 @@ var pp$8 = Parser.prototype;
1234
1382
  // to its body instead of creating a new node.
1235
1383
 
1236
1384
  pp$8.parseTopLevel = function(node) {
1237
- var exports = Object.create(null);
1385
+ var exports$1 = Object.create(null);
1238
1386
  if (!node.body) { node.body = []; }
1239
1387
  while (this.type !== types$1.eof) {
1240
- var stmt = this.parseStatement(null, true, exports);
1388
+ var stmt = this.parseStatement(null, true, exports$1);
1241
1389
  node.body.push(stmt);
1242
1390
  }
1243
1391
  if (this.inModule)
@@ -1326,7 +1474,18 @@ pp$8.isUsingKeyword = function(isAwaitUsing, isFor) {
1326
1474
  while (isIdentifierChar(ch = this.fullCharCodeAt(next)))
1327
1475
  if (ch === 92) { return true }
1328
1476
  var id = this.input.slice(idStart, next);
1329
- if (keywordRelationalOperator.test(id) || isFor && id === "of") { return false }
1477
+ if (keywordRelationalOperator.test(id)) { return false }
1478
+ if (isFor && !isAwaitUsing && id === "of") {
1479
+ // Look ahead for using declaration with initializer, i.e., `for (using of = ...)`
1480
+ skipWhiteSpace.lastIndex = next;
1481
+ var skipAfterOf = skipWhiteSpace.exec(this.input);
1482
+ next = next + skipAfterOf[0].length;
1483
+ if (this.input.charCodeAt(next) !== 61 /* '=' */ ||
1484
+ // Check for ==, === and => operators
1485
+ (ch = this.input.charCodeAt(next + 1)) === 61 /* '=' */ || ch === 62 /* '>' */) {
1486
+ return false
1487
+ }
1488
+ }
1330
1489
  return true
1331
1490
  };
1332
1491
 
@@ -1345,7 +1504,7 @@ pp$8.isUsing = function(isFor) {
1345
1504
  // `if (foo) /blah/.exec(foo)`, where looking at the previous token
1346
1505
  // does not help.
1347
1506
 
1348
- pp$8.parseStatement = function(context, topLevel, exports) {
1507
+ pp$8.parseStatement = function(context, topLevel, exports$1) {
1349
1508
  var starttype = this.type, node = this.startNode(), kind;
1350
1509
 
1351
1510
  if (this.isLet(context)) {
@@ -1400,7 +1559,7 @@ pp$8.parseStatement = function(context, topLevel, exports) {
1400
1559
  if (!this.inModule)
1401
1560
  { this.raise(this.start, "'import' and 'export' may appear only with 'sourceType: module'"); }
1402
1561
  }
1403
- return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports)
1562
+ return starttype === types$1._import ? this.parseImport(node) : this.parseExport(node, exports$1)
1404
1563
 
1405
1564
  // If the statement does not start with a statement keyword or a
1406
1565
  // brace, it's an ExpressionStatement or LabeledStatement. We
@@ -1419,6 +1578,10 @@ pp$8.parseStatement = function(context, topLevel, exports) {
1419
1578
  if (!this.allowUsing) {
1420
1579
  this.raise(this.start, "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement");
1421
1580
  }
1581
+ if (context) {
1582
+ // Cases like `for (;;) using x = ...;`, `if (true) await using x = ...;`, etc. are not allowed.
1583
+ this.raise(this.start, "Using declaration is not allowed in single-statement positions");
1584
+ }
1422
1585
  if (usingKind === "await using") {
1423
1586
  if (!this.canAwait) {
1424
1587
  this.raise(this.start, "Await using cannot appear outside of async function");
@@ -1552,11 +1715,12 @@ pp$8.parseForStatement = function(node) {
1552
1715
  // Helper method to parse for loop after variable initialization
1553
1716
  pp$8.parseForAfterInit = function(node, init, awaitAt) {
1554
1717
  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
- }
1718
+ if (this.type === types$1._in) {
1719
+ if ((init.kind === "using" || init.kind === "await using") && !init.declarations[0].init) {
1720
+ this.raise(this.start, "Using declaration is not allowed in for-in loops");
1721
+ }
1722
+ if (this.options.ecmaVersion >= 9 && awaitAt > -1) { this.unexpected(awaitAt); }
1723
+ } else if (this.options.ecmaVersion >= 9) { node.await = awaitAt > -1; }
1560
1724
  return this.parseForIn(node, init)
1561
1725
  }
1562
1726
  if (awaitAt > -1) { this.unexpected(awaitAt); }
@@ -2161,11 +2325,11 @@ function checkKeyName(node, name) {
2161
2325
 
2162
2326
  // Parses module export declaration.
2163
2327
 
2164
- pp$8.parseExportAllDeclaration = function(node, exports) {
2328
+ pp$8.parseExportAllDeclaration = function(node, exports$1) {
2165
2329
  if (this.options.ecmaVersion >= 11) {
2166
2330
  if (this.eatContextual("as")) {
2167
2331
  node.exported = this.parseModuleExportName();
2168
- this.checkExport(exports, node.exported, this.lastTokStart);
2332
+ this.checkExport(exports$1, node.exported, this.lastTokStart);
2169
2333
  } else {
2170
2334
  node.exported = null;
2171
2335
  }
@@ -2179,14 +2343,14 @@ pp$8.parseExportAllDeclaration = function(node, exports) {
2179
2343
  return this.finishNode(node, "ExportAllDeclaration")
2180
2344
  };
2181
2345
 
2182
- pp$8.parseExport = function(node, exports) {
2346
+ pp$8.parseExport = function(node, exports$1) {
2183
2347
  this.next();
2184
2348
  // export * from '...'
2185
2349
  if (this.eat(types$1.star)) {
2186
- return this.parseExportAllDeclaration(node, exports)
2350
+ return this.parseExportAllDeclaration(node, exports$1)
2187
2351
  }
2188
2352
  if (this.eat(types$1._default)) { // export default ...
2189
- this.checkExport(exports, "default", this.lastTokStart);
2353
+ this.checkExport(exports$1, "default", this.lastTokStart);
2190
2354
  node.declaration = this.parseExportDefaultDeclaration();
2191
2355
  return this.finishNode(node, "ExportDefaultDeclaration")
2192
2356
  }
@@ -2194,16 +2358,16 @@ pp$8.parseExport = function(node, exports) {
2194
2358
  if (this.shouldParseExportStatement()) {
2195
2359
  node.declaration = this.parseExportDeclaration(node);
2196
2360
  if (node.declaration.type === "VariableDeclaration")
2197
- { this.checkVariableExport(exports, node.declaration.declarations); }
2361
+ { this.checkVariableExport(exports$1, node.declaration.declarations); }
2198
2362
  else
2199
- { this.checkExport(exports, node.declaration.id, node.declaration.id.start); }
2363
+ { this.checkExport(exports$1, node.declaration.id, node.declaration.id.start); }
2200
2364
  node.specifiers = [];
2201
2365
  node.source = null;
2202
2366
  if (this.options.ecmaVersion >= 16)
2203
2367
  { node.attributes = []; }
2204
2368
  } else { // export { x, y as z } [from '...']
2205
2369
  node.declaration = null;
2206
- node.specifiers = this.parseExportSpecifiers(exports);
2370
+ node.specifiers = this.parseExportSpecifiers(exports$1);
2207
2371
  if (this.eatContextual("from")) {
2208
2372
  if (this.type !== types$1.string) { this.unexpected(); }
2209
2373
  node.source = this.parseExprAtom();
@@ -2253,47 +2417,47 @@ pp$8.parseExportDefaultDeclaration = function() {
2253
2417
  }
2254
2418
  };
2255
2419
 
2256
- pp$8.checkExport = function(exports, name, pos) {
2257
- if (!exports) { return }
2420
+ pp$8.checkExport = function(exports$1, name, pos) {
2421
+ if (!exports$1) { return }
2258
2422
  if (typeof name !== "string")
2259
2423
  { name = name.type === "Identifier" ? name.name : name.value; }
2260
- if (hasOwn(exports, name))
2424
+ if (hasOwn(exports$1, name))
2261
2425
  { this.raiseRecoverable(pos, "Duplicate export '" + name + "'"); }
2262
- exports[name] = true;
2426
+ exports$1[name] = true;
2263
2427
  };
2264
2428
 
2265
- pp$8.checkPatternExport = function(exports, pat) {
2429
+ pp$8.checkPatternExport = function(exports$1, pat) {
2266
2430
  var type = pat.type;
2267
2431
  if (type === "Identifier")
2268
- { this.checkExport(exports, pat, pat.start); }
2432
+ { this.checkExport(exports$1, pat, pat.start); }
2269
2433
  else if (type === "ObjectPattern")
2270
2434
  { for (var i = 0, list = pat.properties; i < list.length; i += 1)
2271
2435
  {
2272
2436
  var prop = list[i];
2273
2437
 
2274
- this.checkPatternExport(exports, prop);
2438
+ this.checkPatternExport(exports$1, prop);
2275
2439
  } }
2276
2440
  else if (type === "ArrayPattern")
2277
2441
  { for (var i$1 = 0, list$1 = pat.elements; i$1 < list$1.length; i$1 += 1) {
2278
2442
  var elt = list$1[i$1];
2279
2443
 
2280
- if (elt) { this.checkPatternExport(exports, elt); }
2444
+ if (elt) { this.checkPatternExport(exports$1, elt); }
2281
2445
  } }
2282
2446
  else if (type === "Property")
2283
- { this.checkPatternExport(exports, pat.value); }
2447
+ { this.checkPatternExport(exports$1, pat.value); }
2284
2448
  else if (type === "AssignmentPattern")
2285
- { this.checkPatternExport(exports, pat.left); }
2449
+ { this.checkPatternExport(exports$1, pat.left); }
2286
2450
  else if (type === "RestElement")
2287
- { this.checkPatternExport(exports, pat.argument); }
2451
+ { this.checkPatternExport(exports$1, pat.argument); }
2288
2452
  };
2289
2453
 
2290
- pp$8.checkVariableExport = function(exports, decls) {
2291
- if (!exports) { return }
2454
+ pp$8.checkVariableExport = function(exports$1, decls) {
2455
+ if (!exports$1) { return }
2292
2456
  for (var i = 0, list = decls; i < list.length; i += 1)
2293
2457
  {
2294
2458
  var decl = list[i];
2295
2459
 
2296
- this.checkPatternExport(exports, decl.id);
2460
+ this.checkPatternExport(exports$1, decl.id);
2297
2461
  }
2298
2462
  };
2299
2463
 
@@ -2308,13 +2472,13 @@ pp$8.shouldParseExportStatement = function() {
2308
2472
 
2309
2473
  // Parses a comma-separated list of module exports.
2310
2474
 
2311
- pp$8.parseExportSpecifier = function(exports) {
2475
+ pp$8.parseExportSpecifier = function(exports$1) {
2312
2476
  var node = this.startNode();
2313
2477
  node.local = this.parseModuleExportName();
2314
2478
 
2315
2479
  node.exported = this.eatContextual("as") ? this.parseModuleExportName() : node.local;
2316
2480
  this.checkExport(
2317
- exports,
2481
+ exports$1,
2318
2482
  node.exported,
2319
2483
  node.exported.start
2320
2484
  );
@@ -2322,7 +2486,7 @@ pp$8.parseExportSpecifier = function(exports) {
2322
2486
  return this.finishNode(node, "ExportSpecifier")
2323
2487
  };
2324
2488
 
2325
- pp$8.parseExportSpecifiers = function(exports) {
2489
+ pp$8.parseExportSpecifiers = function(exports$1) {
2326
2490
  var nodes = [], first = true;
2327
2491
  // export { x, y as z } [from '...']
2328
2492
  this.expect(types$1.braceL);
@@ -2332,7 +2496,7 @@ pp$8.parseExportSpecifiers = function(exports) {
2332
2496
  if (this.afterTrailingComma(types$1.braceR)) { break }
2333
2497
  } else { first = false; }
2334
2498
 
2335
- nodes.push(this.parseExportSpecifier(exports));
2499
+ nodes.push(this.parseExportSpecifier(exports$1));
2336
2500
  }
2337
2501
  return nodes
2338
2502
  };
@@ -3063,15 +3227,19 @@ pp$5.checkPropClash = function(prop, propHash, refDestructuringErrors) {
3063
3227
  // delayed syntax error at correct position).
3064
3228
 
3065
3229
  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
3230
+ var this$1$1 = this;
3231
+
3232
+ return this.catchStackOverflow(function () {
3233
+ var startPos = this$1$1.start, startLoc = this$1$1.startLoc;
3234
+ var expr = this$1$1.parseMaybeAssign(forInit, refDestructuringErrors);
3235
+ if (this$1$1.type === types$1.comma) {
3236
+ var node = this$1$1.startNodeAt(startPos, startLoc);
3237
+ node.expressions = [expr];
3238
+ while (this$1$1.eat(types$1.comma)) { node.expressions.push(this$1$1.parseMaybeAssign(forInit, refDestructuringErrors)); }
3239
+ return this$1$1.finishNode(node, "SequenceExpression")
3240
+ }
3241
+ return expr
3242
+ })
3075
3243
  };
3076
3244
 
3077
3245
  // Parse an assignment expression. This includes applications of
@@ -3136,7 +3304,7 @@ pp$5.parseMaybeConditional = function(forInit, refDestructuringErrors) {
3136
3304
  var startPos = this.start, startLoc = this.startLoc;
3137
3305
  var expr = this.parseExprOps(forInit, refDestructuringErrors);
3138
3306
  if (this.checkExpressionErrors(refDestructuringErrors)) { return expr }
3139
- if (this.eat(types$1.question)) {
3307
+ if (!(expr.type === "ArrowFunctionExpression" && expr.start === startPos) && this.eat(types$1.question)) {
3140
3308
  var node = this.startNodeAt(startPos, startLoc);
3141
3309
  node.test = expr;
3142
3310
  node.consequent = this.parseMaybeAssign();
@@ -3688,6 +3856,8 @@ pp$5.parseNew = function() {
3688
3856
  }
3689
3857
  var startPos = this.start, startLoc = this.startLoc;
3690
3858
  node.callee = this.parseSubscripts(this.parseExprAtom(null, false, true), startPos, startLoc, true, false);
3859
+ if (node.callee.type === "Super")
3860
+ { this.raiseRecoverable(startPos, "Invalid use of 'super'"); }
3691
3861
  if (this.eat(types$1.parenL)) { node.arguments = this.parseExprList(types$1.parenR, this.options.ecmaVersion >= 8, false); }
3692
3862
  else { node.arguments = empty; }
3693
3863
  return this.finishNode(node, "NewExpression")
@@ -6604,7 +6774,7 @@ pp.readWord = function() {
6604
6774
  // [ghbt]: https://github.com/acornjs/acorn/issues
6605
6775
 
6606
6776
 
6607
- var version = "8.16.0";
6777
+ var version = "8.17.0";
6608
6778
 
6609
6779
  Parser.acorn = {
6610
6780
  Parser: Parser,
@@ -10238,18 +10408,20 @@ function getOptions() {
10238
10408
  return options;
10239
10409
  }
10240
10410
  function setupOptionsRPC({ nuxt }) {
10411
+ const hasReadOnce = /* @__PURE__ */ new Set();
10241
10412
  async function getOptions2(tab) {
10242
- if (!options || options[tab]) {
10243
- options = defaultTabOptions;
10413
+ if (!options)
10414
+ options = createDefaultTabOptions();
10415
+ if (!hasReadOnce.has(tab))
10244
10416
  await read(tab);
10245
- }
10246
10417
  return options[tab];
10247
10418
  }
10248
10419
  async function read(tab) {
10249
- options[tab] = await readLocalOptions(defaultTabOptions[tab], {
10420
+ options[tab] = await readLocalOptions(createDefaultTabOptions()[tab], {
10250
10421
  root: nuxt.options.rootDir,
10251
10422
  key: tab !== "ui" && tab
10252
10423
  });
10424
+ hasReadOnce.add(tab);
10253
10425
  return options;
10254
10426
  }
10255
10427
  getOptions2("ui");
@@ -10516,19 +10688,70 @@ const route = useRoute()
10516
10688
  };
10517
10689
  }
10518
10690
 
10691
+ function toEntryInput(input) {
10692
+ return {
10693
+ message: input.message,
10694
+ level: input.level ?? "info",
10695
+ description: input.description,
10696
+ labels: input.labels,
10697
+ category: input.category,
10698
+ filePosition: input.filePosition,
10699
+ stacktrace: input.stacktrace,
10700
+ notify: input.notify,
10701
+ autoDismiss: input.autoDismiss,
10702
+ autoDelete: input.autoDelete
10703
+ };
10704
+ }
10705
+ function createNotifier(nuxt) {
10706
+ let messages;
10707
+ const pending = [];
10708
+ function add(input) {
10709
+ void messages.add(toEntryInput(input)).catch(() => {
10710
+ });
10711
+ }
10712
+ function notify(input) {
10713
+ if (!messages) {
10714
+ pending.push(input);
10715
+ return;
10716
+ }
10717
+ add(input);
10718
+ }
10719
+ onDevtoolsReady((kit) => {
10720
+ messages = kit.messages;
10721
+ for (const input of pending)
10722
+ add(input);
10723
+ pending.length = 0;
10724
+ }, nuxt);
10725
+ nuxt.hook("devtools:notify", notify);
10726
+ return notify;
10727
+ }
10728
+ function setupMessagesRPC(ctx) {
10729
+ return {
10730
+ async notify(input) {
10731
+ ctx.notify(input);
10732
+ }
10733
+ };
10734
+ }
10735
+
10519
10736
  const AGENTS = [
10520
10737
  "npm",
10521
10738
  "yarn",
10522
10739
  "yarn@berry",
10523
10740
  "pnpm",
10524
10741
  "pnpm@6",
10742
+ "pnpm-rush",
10525
10743
  "bun",
10526
- "deno"
10744
+ "deno",
10745
+ "nub",
10746
+ "aube"
10527
10747
  ];
10528
10748
  const LOCKS = {
10749
+ "aube-lock.yaml": "aube",
10750
+ "aube-workspace.yaml": "aube",
10529
10751
  "bun.lock": "bun",
10530
10752
  "bun.lockb": "bun",
10531
10753
  "deno.lock": "deno",
10754
+ "nub.lock": "nub",
10532
10755
  "pnpm-lock.yaml": "pnpm",
10533
10756
  "pnpm-workspace.yaml": "pnpm",
10534
10757
  "yarn.lock": "yarn",
@@ -10536,6 +10759,7 @@ const LOCKS = {
10536
10759
  "npm-shrinkwrap.json": "npm"
10537
10760
  };
10538
10761
  const INSTALL_METADATA = {
10762
+ "node_modules/.aube/": "aube",
10539
10763
  "node_modules/.deno/": "deno",
10540
10764
  "node_modules/.pnpm/": "pnpm",
10541
10765
  "node_modules/.yarn-state.yml": "yarn",
@@ -10588,6 +10812,9 @@ async function detect(options = {}) {
10588
10812
  for (const strategy of strategies) {
10589
10813
  switch (strategy) {
10590
10814
  case "lockfile": {
10815
+ if (await pathExists(path.join(directory, "rush.json"), "file")) {
10816
+ return { name: "pnpm", agent: "pnpm-rush" };
10817
+ }
10591
10818
  for (const lock of Object.keys(LOCKS)) {
10592
10819
  if (await pathExists(path.join(directory, lock), "file")) {
10593
10820
  const name = LOCKS[lock];
@@ -11055,7 +11282,7 @@ async function checkForUpdateOf(name, current, nuxt = useNuxt()) {
11055
11282
  const { version: latest } = await getLatestVersion(name, {
11056
11283
  fetch
11057
11284
  });
11058
- const needsUpdate = !!latest && latest !== current && semver.lt(current, latest);
11285
+ const needsUpdate = !!latest && latest !== current && isLess(current, latest);
11059
11286
  return {
11060
11287
  name,
11061
11288
  current,
@@ -11079,7 +11306,179 @@ async function magicastGuard(fn, message = "") {
11079
11306
  return generated;
11080
11307
  }
11081
11308
 
11082
- function setupNpmRPC({ nuxt }) {
11309
+ function removeNuxtModuleFromCode(source, name, filepath) {
11310
+ const mod = parseModule(source, filepath ? { sourceFileName: filepath } : void 0);
11311
+ const config = getDefaultExportOptions(mod);
11312
+ if (!Array.isArray(config.modules))
11313
+ return mod.generate().code;
11314
+ for (let i = config.modules.length - 1; i >= 0; i--) {
11315
+ const entry = config.modules[i];
11316
+ const matches = typeof entry === "string" ? entry === name : Array.isArray(entry) && entry[0] === name;
11317
+ if (matches)
11318
+ config.modules.splice(i, 1);
11319
+ }
11320
+ return mod.generate().code;
11321
+ }
11322
+
11323
+ function broadcastTerminalExit(ctx, id, code) {
11324
+ ctx.devtoolsKit?.rpc.broadcast({ method: "onTerminalExit", args: [{ id, code }], event: true });
11325
+ }
11326
+ function statusForExit(code) {
11327
+ return code == null || code === 0 ? "stopped" : "error";
11328
+ }
11329
+ function setupTerminalsBridge(ctx) {
11330
+ const { nuxt } = ctx;
11331
+ const runs = /* @__PURE__ */ new Map();
11332
+ const generations = /* @__PURE__ */ new Map();
11333
+ let host;
11334
+ function createRun(terminal) {
11335
+ const legacyId = terminal.id;
11336
+ const generation = (generations.get(legacyId) ?? 0) + 1;
11337
+ generations.set(legacyId, generation);
11338
+ let controller;
11339
+ const stream = new ReadableStream({
11340
+ start(c) {
11341
+ controller = c;
11342
+ }
11343
+ });
11344
+ const session = {
11345
+ id: createUniqueSessionId(legacyId),
11346
+ title: terminal.name,
11347
+ description: terminal.description,
11348
+ icon: terminal.icon,
11349
+ status: "running",
11350
+ interactive: false,
11351
+ stream
11352
+ };
11353
+ return {
11354
+ legacyId,
11355
+ sessionId: session.id,
11356
+ generation,
11357
+ session,
11358
+ controller,
11359
+ registered: false,
11360
+ streamClosed: false,
11361
+ pendingChunks: []
11362
+ };
11363
+ }
11364
+ function isCurrent(run) {
11365
+ return runs.get(run.legacyId) === run;
11366
+ }
11367
+ function closeStream(run) {
11368
+ if (run.streamClosed)
11369
+ return;
11370
+ run.streamClosed = true;
11371
+ try {
11372
+ run.controller?.close();
11373
+ } catch {
11374
+ }
11375
+ }
11376
+ function applyExit(run, code) {
11377
+ if (!isCurrent(run) || run.streamClosed)
11378
+ return;
11379
+ closeStream(run);
11380
+ run.session.status = statusForExit(code);
11381
+ host?.update(run.session);
11382
+ }
11383
+ function registerWithHost(run) {
11384
+ if (!host || run.registered || !isCurrent(run))
11385
+ return;
11386
+ host.register(run.session);
11387
+ run.registered = true;
11388
+ for (const chunk of run.pendingChunks) {
11389
+ try {
11390
+ run.controller?.enqueue(chunk);
11391
+ } catch {
11392
+ }
11393
+ }
11394
+ run.pendingChunks.length = 0;
11395
+ if (run.pendingExit) {
11396
+ const { code } = run.pendingExit;
11397
+ run.pendingExit = void 0;
11398
+ applyExit(run, code);
11399
+ }
11400
+ }
11401
+ nuxt.hook("devtools:terminal:register", (terminal) => {
11402
+ const existing = runs.get(terminal.id);
11403
+ if (existing) {
11404
+ closeStream(existing);
11405
+ if (host && existing.registered)
11406
+ host.remove(existing.session);
11407
+ }
11408
+ const run = createRun(terminal);
11409
+ runs.set(terminal.id, run);
11410
+ if (host)
11411
+ registerWithHost(run);
11412
+ return terminal.id;
11413
+ });
11414
+ nuxt.hook("devtools:terminal:write", ({ id, data }) => {
11415
+ const run = runs.get(id);
11416
+ if (!run || run.streamClosed)
11417
+ return false;
11418
+ if (run.registered) {
11419
+ try {
11420
+ run.controller?.enqueue(data);
11421
+ } catch {
11422
+ }
11423
+ } else {
11424
+ run.pendingChunks.push(data);
11425
+ }
11426
+ return true;
11427
+ });
11428
+ nuxt.hook("devtools:terminal:exit", ({ id, code }) => {
11429
+ const run = runs.get(id);
11430
+ if (!run)
11431
+ return false;
11432
+ if (run.registered)
11433
+ applyExit(run, code);
11434
+ else
11435
+ run.pendingExit = { code };
11436
+ return true;
11437
+ });
11438
+ nuxt.hook("devtools:terminal:remove", ({ id }) => {
11439
+ const run = runs.get(id);
11440
+ if (!run)
11441
+ return false;
11442
+ closeStream(run);
11443
+ runs.delete(id);
11444
+ if (host && run.registered)
11445
+ host.remove(run.session);
11446
+ return true;
11447
+ });
11448
+ nuxt.hook("devtools:ready", (kit) => {
11449
+ host = kit.terminals;
11450
+ for (const run of runs.values())
11451
+ registerWithHost(run);
11452
+ });
11453
+ return {
11454
+ /**
11455
+ * Focus the built-in **Terminals** dock on a session (Devframe 0.7
11456
+ * `docks.activate`, driven by the `hub:docks:activate` RPC). Replaces the
11457
+ * old in-client "go to Terminals tab" navigation now that terminals live in
11458
+ * the hub dock. `id` is a unique Devframe session id (from a bridged run or
11459
+ * a `startChildProcess` call). Returns `false` when the kit isn't connected
11460
+ * or the session is unknown.
11461
+ */
11462
+ async revealTerminal(id) {
11463
+ const kit = ctx.devtoolsKit;
11464
+ if (!kit)
11465
+ return false;
11466
+ if (!kit.terminals.sessions.has(id))
11467
+ return false;
11468
+ kit.docks.activate(DEVTOOLS_TERMINALS_DOCK_ID, { sessionId: id });
11469
+ return true;
11470
+ }
11471
+ };
11472
+ }
11473
+
11474
+ function setupNpmRPC(ctx) {
11475
+ const { nuxt } = ctx;
11476
+ function getTerminals() {
11477
+ const kit = ctx.devtoolsKit;
11478
+ if (!kit)
11479
+ throw new Error("[Nuxt DevTools] Vite DevTools kit is not connected yet.");
11480
+ return kit.terminals;
11481
+ }
11083
11482
  let detectPromise;
11084
11483
  const updatesPromise = /* @__PURE__ */ new Map();
11085
11484
  function getPackageManager() {
@@ -11114,15 +11513,18 @@ function setupNpmRPC({ nuxt }) {
11114
11513
  const args = await getNpmCommand(command, packageName, options);
11115
11514
  if (!args)
11116
11515
  return;
11117
- const processId = `npm:${command}:${packageName}`;
11118
- startSubprocess({
11516
+ const processId = createUniqueSessionId(`npm:${command}:${packageName}`);
11517
+ const session = await getTerminals().startChildProcess({
11119
11518
  command: args[0],
11120
11519
  args: args.slice(1)
11121
11520
  }, {
11122
11521
  id: processId,
11123
- name: `${command} ${packageName}`,
11124
- icon: "i-logos-npm-icon",
11125
- restartable: false
11522
+ title: `${command} ${packageName}`,
11523
+ icon: "i-logos-npm-icon"
11524
+ });
11525
+ void Promise.resolve(session.getResult()).then((result) => {
11526
+ broadcastTerminalExit(ctx, processId, result.exitCode);
11527
+ }).catch(() => {
11126
11528
  });
11127
11529
  return {
11128
11530
  processId
@@ -11140,7 +11542,7 @@ function setupNpmRPC({ nuxt }) {
11140
11542
  async runNpmCommand(...args) {
11141
11543
  return runNpmCommand(...args);
11142
11544
  },
11143
- async installNuxtModule(name, dry = true) {
11545
+ async installNuxtModule(name, dry = true, sessionId) {
11144
11546
  const commands = await getNpmCommand("install", name, { dev: true });
11145
11547
  const filepath = nuxt.options._nuxtConfigFile;
11146
11548
  let source = latestGenerated;
@@ -11150,27 +11552,39 @@ function setupNpmRPC({ nuxt }) {
11150
11552
  addNuxtModule(mod, name);
11151
11553
  return mod.generate().code;
11152
11554
  });
11153
- const processId = `nuxt:add-module:${name}`;
11555
+ const processId = sessionId ?? createUniqueSessionId(`nuxt:add-module:${name}`);
11154
11556
  if (!dry) {
11155
11557
  latestGenerated = generated;
11156
11558
  installSet.add(name);
11157
- const process = startSubprocess({
11559
+ const session = await getTerminals().startChildProcess({
11158
11560
  command: commands[0],
11159
11561
  args: commands.slice(1)
11160
11562
  }, {
11161
11563
  id: processId,
11162
- name: `Install ${name}`,
11163
- icon: "carbon:intent-request-create",
11164
- restartable: false
11564
+ title: `Install ${name}`,
11565
+ icon: "carbon:intent-request-create"
11165
11566
  });
11166
- const result = await process.getResult();
11567
+ const result = await session.getResult();
11167
11568
  await Promise.resolve();
11168
11569
  installSet.delete(name);
11169
11570
  const code = result.exitCode;
11170
11571
  if (code !== 0) {
11171
11572
  console.error(result.stderr);
11573
+ ctx.notify({
11574
+ message: `Failed to install ${name}`,
11575
+ level: "error",
11576
+ description: `Process exited with code ${code}. Check the Install ${name} terminal for details.`,
11577
+ category: "module",
11578
+ notify: true
11579
+ });
11172
11580
  throw new Error(`[Nuxt DevTools] Failed to install module, process exited with ${code}`);
11173
11581
  }
11582
+ ctx.notify({
11583
+ message: `Installed ${name}`,
11584
+ level: "success",
11585
+ category: "module",
11586
+ notify: true
11587
+ });
11174
11588
  if (installSet.size === 0) {
11175
11589
  latestGenerated = null;
11176
11590
  await fs.writeFile(filepath, generated, "utf-8");
@@ -11183,40 +11597,43 @@ function setupNpmRPC({ nuxt }) {
11183
11597
  processId
11184
11598
  };
11185
11599
  },
11186
- async uninstallNuxtModule(name, dry = true) {
11600
+ async uninstallNuxtModule(name, dry = true, sessionId) {
11187
11601
  const commands = await getNpmCommand("uninstall", name);
11188
11602
  const filepath = nuxt.options._nuxtConfigFile;
11189
11603
  const source = await fs.readFile(filepath, "utf-8");
11190
11604
  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;
11605
+ return removeNuxtModuleFromCode(source, name, filepath);
11201
11606
  });
11202
- const processId = `nuxt:remove-module:${name}`;
11607
+ const processId = sessionId ?? createUniqueSessionId(`nuxt:remove-module:${name}`);
11203
11608
  if (!dry) {
11204
- const process = startSubprocess({
11609
+ const session = await getTerminals().startChildProcess({
11205
11610
  command: commands[0],
11206
11611
  args: commands.slice(1)
11207
11612
  }, {
11208
11613
  id: processId,
11209
- name: `Uninstall ${name}`,
11210
- icon: "carbon:intent-request-uninstall",
11211
- restartable: false
11614
+ title: `Uninstall ${name}`,
11615
+ icon: "carbon:intent-request-uninstall"
11212
11616
  });
11213
- const result = await process.getResult();
11617
+ const result = await session.getResult();
11214
11618
  await Promise.resolve();
11215
11619
  const code = result.exitCode;
11216
11620
  if (code !== 0) {
11217
11621
  console.error(result.stderr);
11622
+ ctx.notify({
11623
+ message: `Failed to uninstall ${name}`,
11624
+ level: "error",
11625
+ description: `Process exited with code ${code}. Check the Uninstall ${name} terminal for details.`,
11626
+ category: "module",
11627
+ notify: true
11628
+ });
11218
11629
  throw new Error(`[Nuxt DevTools] Failed to uninstall module, process exited with ${code}`);
11219
11630
  }
11631
+ ctx.notify({
11632
+ message: `Uninstalled ${name}`,
11633
+ level: "success",
11634
+ category: "module",
11635
+ notify: true
11636
+ });
11220
11637
  await fs.writeFile(filepath, generated, "utf-8");
11221
11638
  }
11222
11639
  return {
@@ -11229,71 +11646,6 @@ function setupNpmRPC({ nuxt }) {
11229
11646
  };
11230
11647
  }
11231
11648
 
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
11649
  async function watchStorageMount(storage, mountName, onChange) {
11298
11650
  const mountKey = normalizeBaseKey(mountName);
11299
11651
  const mount = storage.getMount(mountKey);
@@ -11417,14 +11769,16 @@ function setupServerTasksRPC({ nuxt, refresh }) {
11417
11769
  };
11418
11770
  }
11419
11771
 
11772
+ function skipInSSR(ctx) {
11773
+ return Boolean(ctx?.viteConfig?.build?.ssr);
11774
+ }
11775
+
11420
11776
  const IGNORE_STORAGE_MOUNTS = ["root", "build", "src", "cache"];
11421
11777
  function shouldIgnoreStorageKey(key) {
11422
11778
  return IGNORE_STORAGE_MOUNTS.includes(key.split(":")[0]);
11423
11779
  }
11424
- function setupStorageRPC({
11425
- nuxt,
11426
- rpc
11427
- }) {
11780
+ function setupStorageRPC(ctx) {
11781
+ const { nuxt } = ctx;
11428
11782
  const storageMounts = {};
11429
11783
  let storage;
11430
11784
  let unwatchStorageMounts = [];
@@ -11448,7 +11802,7 @@ function setupStorageRPC({
11448
11802
  return;
11449
11803
  await Promise.all(unwatchStorageMounts.map((unwatch) => unwatch()));
11450
11804
  unwatchStorageMounts = await Promise.all(Object.keys(storageMounts).map((mountName) => watchStorageMount(activeStorage, mountName, (event, key) => {
11451
- rpc.broadcast.callHook.asEvent("storage:key:update", key, event);
11805
+ ctx.devtoolsKit?.rpc.broadcast({ method: "callHook", args: ["storage:key:update", key, event], event: true });
11452
11806
  })));
11453
11807
  });
11454
11808
  nuxt.hook("close", async () => {
@@ -11536,89 +11890,6 @@ function telemetryEvent(payload, immediate = false) {
11536
11890
  throttledSend();
11537
11891
  }
11538
11892
 
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
11893
  function setupTimelineRPC({ nuxt }) {
11623
11894
  return {
11624
11895
  async enableTimeline(dry) {
@@ -11682,14 +11953,29 @@ function setupRPC(nuxt, options) {
11682
11953
  return true;
11683
11954
  }
11684
11955
  });
11685
- const rpc = {
11956
+ const rpc = new Proxy({
11686
11957
  broadcast: createBroadcastProxy(),
11687
11958
  functions: functionsProxy
11688
- };
11959
+ }, {
11960
+ get(target, prop, receiver) {
11961
+ if (prop === "broadcast" || prop === "functions") {
11962
+ deprecate(nuxt, "NDT_DEP_0007", {
11963
+ api: `nuxt.devtools.rpc.${prop}`,
11964
+ replacement: "the connected ctx.rpc from onDevtoolsReady((ctx) => ...)"
11965
+ }, { key: prop });
11966
+ }
11967
+ return Reflect.get(target, prop, receiver);
11968
+ }
11969
+ });
11689
11970
  function refresh(event) {
11690
11971
  broadcast("refresh", event);
11691
11972
  }
11973
+ const notify = createNotifier(nuxt);
11692
11974
  function extendServerRpc(namespace, functions) {
11975
+ deprecate(nuxt, "NDT_DEP_0003", {
11976
+ api: "extendServerRpc",
11977
+ replacement: "onDevtoolsReady((ctx) => ctx.rpc.register(defineRpcFunction(...)))"
11978
+ }, { key: namespace });
11693
11979
  extendedRpcMap.set(namespace, functions);
11694
11980
  if (devtoolsKitCtx) {
11695
11981
  for (const [fnName, handler] of Object.entries(functions)) {
@@ -11713,70 +11999,71 @@ function setupRPC(nuxt, options) {
11713
11999
  return devtoolsKitCtx;
11714
12000
  },
11715
12001
  refresh,
12002
+ notify,
11716
12003
  extendServerRpc,
11717
12004
  openInEditorHooks: []
11718
12005
  };
11719
12006
  nuxt.devtools = ctx;
11720
12007
  Object.assign(serverFunctions, {
11721
12008
  ...setupGeneralRPC(ctx),
12009
+ ...setupMessagesRPC(ctx),
11722
12010
  ...setupCustomTabRPC(ctx),
11723
12011
  ...setupStorageRPC(ctx),
11724
12012
  ...setupAssetsRPC(ctx),
11725
12013
  ...setupNpmRPC(ctx),
11726
- ...setupTerminalRPC(ctx),
12014
+ // Bridge the `devtools:terminal:*` hooks onto the Vite DevTools terminals
12015
+ // host so module terminals surface in the built-in Terminals dock. Also
12016
+ // registers its own hook listeners (including `devtools:ready`) as a side
12017
+ // effect, and contributes the `revealTerminal` RPC.
12018
+ ...setupTerminalsBridge(ctx),
11727
12019
  ...setupServerRoutesRPC(ctx),
11728
12020
  ...setupServerTasksRPC(ctx),
11729
12021
  ...setupAnalyzeBuildRPC(ctx),
11730
12022
  ...setupOptionsRPC(ctx),
11731
12023
  ...setupTimelineRPC(ctx),
11732
12024
  ...setupTelemetryRPC(ctx),
11733
- ...setupServerDataRPC(ctx)
12025
+ // Deprecated compat shim (NDT_DEP_0009). The capture + live source now live
12026
+ // in the Data Inspector integration; `getServerConfig` is served by the
12027
+ // canonical `setupGeneralRPC` above.
12028
+ getServerData: async () => getServerData(nuxt)
11734
12029
  });
11735
- function connectDevToolsKit(ctx2) {
11736
- if (devtoolsKitCtx)
12030
+ async function connectDevToolsKit(kitCtx) {
12031
+ if (devtoolsKitCtx || skipInSSR(kitCtx))
11737
12032
  return;
11738
- devtoolsKitCtx = ctx2;
11739
- const host = ctx2.rpc;
12033
+ devtoolsKitCtx = kitCtx;
12034
+ const host = kitCtx.rpc;
11740
12035
  for (const { method, args } of pendingBroadcasts) {
11741
12036
  broadcast(method, ...args);
11742
12037
  }
11743
12038
  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}":
12039
+ registerHostDiagnostics(ctx);
12040
+ function registerFn(name, handler) {
12041
+ try {
12042
+ host.register({ name, handler });
12043
+ } catch (e) {
12044
+ logger.warn(
12045
+ colors.yellow(`[nuxt-devtools] Failed to register RPC function "${name}":
11754
12046
  `) + colors.red(e?.message || "")
11755
- );
11756
- }
12047
+ );
11757
12048
  }
11758
12049
  }
12050
+ for (const [name, handler] of Object.entries(serverFunctions)) {
12051
+ if (typeof handler !== "function")
12052
+ continue;
12053
+ registerFn(`${RPC_NAMESPACE}:${name}`, handler);
12054
+ registerFn(name, handler);
12055
+ }
11759
12056
  for (const [namespace, fns] of extendedRpcMap) {
11760
12057
  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
- }
12058
+ if (typeof handler === "function")
12059
+ registerFn(`${namespace}:${fnName}`, handler);
11774
12060
  }
11775
12061
  }
12062
+ await nuxt.callHook("devtools:ready", kitCtx);
11776
12063
  }
11777
12064
  return {
11778
12065
  connectDevToolsKit,
11779
- ...ctx
12066
+ ctx
11780
12067
  };
11781
12068
  }
11782
12069
 
@@ -11795,8 +12082,12 @@ async function enableModule(options, nuxt) {
11795
12082
  return;
11796
12083
  }
11797
12084
  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.");
12085
+ if (options.disableAuthorization) {
12086
+ extendViteConfig((config) => {
12087
+ const devtoolsConfig = config.devtools ||= {};
12088
+ if (devtoolsConfig.clientAuth === void 0)
12089
+ devtoolsConfig.clientAuth = false;
12090
+ });
11800
12091
  }
11801
12092
  if (options.iframeProps) {
11802
12093
  nuxt.options.runtimeConfig.app.devtools ||= {};
@@ -11829,18 +12120,31 @@ async function enableModule(options, nuxt) {
11829
12120
  addVitePlugin(defineViteDevToolsPlugin({
11830
12121
  name: "nuxt:devtools",
11831
12122
  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);
12123
+ async setup(ctx2) {
12124
+ if (!skipInSSR(ctx2)) {
12125
+ ctx2.docks.register({
12126
+ id: NUXT_DEVTOOLS_GROUP_ID,
12127
+ type: "group",
12128
+ title: "Nuxt",
12129
+ icon: "/__nuxt_devtools__/client/nuxt.svg",
12130
+ category: "framework",
12131
+ defaultOrder: -2e3,
12132
+ defaultChildId: "nuxt:devtools"
12133
+ });
12134
+ ctx2.docks.register({
12135
+ id: "nuxt:devtools",
12136
+ type: "iframe",
12137
+ icon: "/__nuxt_devtools__/client/nuxt.svg",
12138
+ title: "Nuxt DevTools",
12139
+ url: "/__nuxt_devtools__/client/",
12140
+ groupId: NUXT_DEVTOOLS_GROUP_ID,
12141
+ defaultOrder: -300
12142
+ });
12143
+ }
12144
+ await connectDevToolsKit?.(ctx2);
11841
12145
  }
11842
12146
  }
11843
- }), { server: false });
12147
+ }));
11844
12148
  addPlugin({
11845
12149
  src: join(runtimeDir, "plugins/vite-devtools.client"),
11846
12150
  mode: "client"
@@ -11849,9 +12153,7 @@ async function enableModule(options, nuxt) {
11849
12153
  filename: "devtools/settings.mjs",
11850
12154
  async getContents() {
11851
12155
  const uiOptions = await readLocalOptions(
11852
- {
11853
- ...defaultTabOptions.ui
11854
- },
12156
+ createDefaultTabOptions().ui,
11855
12157
  { root: nuxt.options.rootDir }
11856
12158
  );
11857
12159
  return `export default ${JSON.stringify({
@@ -11861,7 +12163,7 @@ async function enableModule(options, nuxt) {
11861
12163
  });
11862
12164
  nuxt.hook("nitro:config", (config) => {
11863
12165
  if (config.experimental?.tasks)
11864
- defaultTabOptions.serverTasks.enabled = true;
12166
+ setServerTasksEnabledByDefault(true);
11865
12167
  config.externals = config.externals || {};
11866
12168
  config.externals.inline = config.externals.inline || [];
11867
12169
  config.externals.inline.push(join(runtimeDir, "nitro"));
@@ -11881,7 +12183,7 @@ window.__NUXT_DEVTOOLS_TIME_METRIC__.appInit = Date.now()
11881
12183
  });
11882
12184
  const {
11883
12185
  connectDevToolsKit: _connectDevToolsKit,
11884
- ...ctx
12186
+ ctx
11885
12187
  } = setupRPC(nuxt, options);
11886
12188
  connectDevToolsKit = _connectDevToolsKit;
11887
12189
  const clientDirExists = existsSync(clientDir);
@@ -11930,6 +12232,7 @@ window.__NUXT_DEVTOOLS_TIME_METRIC__.appInit = Date.now()
11930
12232
  }
11931
12233
  });
11932
12234
  await import('./plugin-metrics.mjs').then(({ setup }) => setup(ctx));
12235
+ await Promise.resolve().then(function () { return dataInspector; }).then(({ setup }) => setup(ctx));
11933
12236
  if (options.vueDevTools !== false)
11934
12237
  await import('./vue-devtools.mjs').then(({ setup }) => setup(ctx));
11935
12238
  if (options.viteInspect !== false)
@@ -11962,4 +12265,9 @@ function defineViteDevToolsPlugin(plugin) {
11962
12265
  return plugin;
11963
12266
  }
11964
12267
 
11965
- export { enableModule };
12268
+ const moduleMain = {
12269
+ __proto__: null,
12270
+ enableModule: enableModule
12271
+ };
12272
+
12273
+ export { RPC_NAMESPACE as R, moduleMain as m };