@nuxt/devtools-kit 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.
- package/dist/index.cjs +130 -1
- package/dist/index.d.cts +231 -9
- package/dist/index.d.mts +231 -9
- package/dist/index.d.ts +231 -9
- package/dist/index.mjs +121 -2
- package/dist/runtime/iframe-client.d.ts +18 -0
- package/dist/runtime/iframe-client.mjs +7 -0
- package/dist/shared/{devtools-kit.BwQLAI1z.d.cts → devtools-kit.CC-eVeXW.d.cts} +196 -76
- package/dist/shared/{devtools-kit.BwQLAI1z.d.mts → devtools-kit.CC-eVeXW.d.mts} +196 -76
- package/dist/shared/{devtools-kit.BwQLAI1z.d.ts → devtools-kit.CC-eVeXW.d.ts} +196 -76
- package/dist/types.d.cts +27 -3
- package/dist/types.d.mts +27 -3
- package/dist/types.d.ts +27 -3
- package/package.json +8 -7
package/dist/index.d.mts
CHANGED
|
@@ -1,44 +1,266 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
+
import { ViteDevToolsNodeContext } from '@vitejs/devtools-kit';
|
|
2
3
|
import { BirpcGroup } from 'birpc';
|
|
3
4
|
import { ChildProcess } from 'node:child_process';
|
|
4
5
|
import { Result } from 'tinyexec';
|
|
5
|
-
import {
|
|
6
|
+
import { N as NuxtDevtoolsServerContext, M as ModuleCustomTab, a as NuxtDevtoolsInfo, S as SubprocessOptions, T as TerminalState } from './shared/devtools-kit.CC-eVeXW.mjs';
|
|
7
|
+
import * as nostics from 'nostics';
|
|
8
|
+
import { defineDiagnostics } from 'nostics';
|
|
9
|
+
export { createConsoleReporter, defineDiagnostics } from 'nostics';
|
|
10
|
+
import { Nuxt } from 'nuxt/schema';
|
|
6
11
|
import 'vue';
|
|
7
|
-
import '@vitejs/devtools-kit';
|
|
8
|
-
import 'nuxt/schema';
|
|
9
12
|
import 'unimport';
|
|
10
13
|
import 'vue-router';
|
|
11
14
|
import 'nitropack';
|
|
12
15
|
import 'unstorage';
|
|
13
16
|
import 'vite';
|
|
14
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Canonical docs URL for a Nuxt DevTools diagnostic code.
|
|
20
|
+
*
|
|
21
|
+
* Each code links to a per-code anchor in the v4 migration guide, e.g.
|
|
22
|
+
* `NDT_DEP_0001` → `.../module/migration-v4#ndt_dep_0001`.
|
|
23
|
+
*/
|
|
24
|
+
declare function diagnosticsDocsBase(code: string | number): string;
|
|
25
|
+
/**
|
|
26
|
+
* Parameters shared by every deprecation code: the API being used and its
|
|
27
|
+
* recommended replacement. Interpolated into the `why`/`fix` messages.
|
|
28
|
+
*/
|
|
29
|
+
interface DeprecationParams {
|
|
30
|
+
/** The deprecated API / option being used. */
|
|
31
|
+
api: string;
|
|
32
|
+
/** The recommended replacement to migrate to. */
|
|
33
|
+
replacement: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The Nuxt DevTools diagnostics catalog.
|
|
37
|
+
*
|
|
38
|
+
* Codes are grouped by prefix:
|
|
39
|
+
* - `NDT_DEP_xxxx` — soft/hard deprecations (this is the only range used today).
|
|
40
|
+
*
|
|
41
|
+
* Severity is **not** encoded here; it is chosen per emission via the reporter
|
|
42
|
+
* `method` (`warn` by default, `error` for hard breaks).
|
|
43
|
+
*/
|
|
44
|
+
declare const diagnosticCodes: {
|
|
45
|
+
/** `startSubprocess().getProcess()` → `getResult()`. */
|
|
46
|
+
NDT_DEP_0001: {
|
|
47
|
+
why: (p: DeprecationParams) => string;
|
|
48
|
+
fix: (p: DeprecationParams) => string;
|
|
49
|
+
};
|
|
50
|
+
/** `extendServerRpc` → `onDevtoolsReady((ctx) => ctx.rpc.register(...))`. */
|
|
51
|
+
NDT_DEP_0003: {
|
|
52
|
+
why: (p: DeprecationParams) => string;
|
|
53
|
+
fix: (p: DeprecationParams) => string;
|
|
54
|
+
};
|
|
55
|
+
/** `startSubprocess` → `onDevtoolsReady((ctx) => ctx.terminals.startChildProcess(...))`. */
|
|
56
|
+
NDT_DEP_0004: {
|
|
57
|
+
why: (p: DeprecationParams) => string;
|
|
58
|
+
fix: (p: DeprecationParams) => string;
|
|
59
|
+
};
|
|
60
|
+
/** `addCustomTab` → `onDevtoolsReady((ctx) => ctx.docks.register(...))`. */
|
|
61
|
+
NDT_DEP_0005: {
|
|
62
|
+
why: (p: DeprecationParams) => string;
|
|
63
|
+
fix: (p: DeprecationParams) => string;
|
|
64
|
+
};
|
|
65
|
+
/** `refreshCustomTabs` → `onDevtoolsReady((ctx) => ctx.docks.register(...))`. */
|
|
66
|
+
NDT_DEP_0006: {
|
|
67
|
+
why: (p: DeprecationParams) => string;
|
|
68
|
+
fix: (p: DeprecationParams) => string;
|
|
69
|
+
};
|
|
70
|
+
/** Direct `nuxt.devtools.rpc` access (`broadcast` / `functions`). */
|
|
71
|
+
NDT_DEP_0007: {
|
|
72
|
+
why: (p: DeprecationParams) => string;
|
|
73
|
+
fix: (p: DeprecationParams) => string;
|
|
74
|
+
};
|
|
75
|
+
/** `getServerData()` RPC → the Data Inspector panel's `Nuxt Application` source. */
|
|
76
|
+
NDT_DEP_0009: {
|
|
77
|
+
why: (p: DeprecationParams) => string;
|
|
78
|
+
fix: (p: DeprecationParams) => string;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
type NuxtDiagnosticCode = keyof typeof diagnosticCodes;
|
|
82
|
+
/**
|
|
83
|
+
* Standalone catalog that prints to the terminal via nostics'
|
|
84
|
+
* {@link createConsoleReporter} (default method `warn`). Works before the Vite
|
|
85
|
+
* DevTools kit connects, so it is the fallback sink for pre-connect emissions.
|
|
86
|
+
*/
|
|
87
|
+
declare const consoleDiagnostics: nostics.Diagnostics<{
|
|
88
|
+
/** `startSubprocess().getProcess()` → `getResult()`. */
|
|
89
|
+
NDT_DEP_0001: {
|
|
90
|
+
why: (p: DeprecationParams) => string;
|
|
91
|
+
fix: (p: DeprecationParams) => string;
|
|
92
|
+
};
|
|
93
|
+
/** `extendServerRpc` → `onDevtoolsReady((ctx) => ctx.rpc.register(...))`. */
|
|
94
|
+
NDT_DEP_0003: {
|
|
95
|
+
why: (p: DeprecationParams) => string;
|
|
96
|
+
fix: (p: DeprecationParams) => string;
|
|
97
|
+
};
|
|
98
|
+
/** `startSubprocess` → `onDevtoolsReady((ctx) => ctx.terminals.startChildProcess(...))`. */
|
|
99
|
+
NDT_DEP_0004: {
|
|
100
|
+
why: (p: DeprecationParams) => string;
|
|
101
|
+
fix: (p: DeprecationParams) => string;
|
|
102
|
+
};
|
|
103
|
+
/** `addCustomTab` → `onDevtoolsReady((ctx) => ctx.docks.register(...))`. */
|
|
104
|
+
NDT_DEP_0005: {
|
|
105
|
+
why: (p: DeprecationParams) => string;
|
|
106
|
+
fix: (p: DeprecationParams) => string;
|
|
107
|
+
};
|
|
108
|
+
/** `refreshCustomTabs` → `onDevtoolsReady((ctx) => ctx.docks.register(...))`. */
|
|
109
|
+
NDT_DEP_0006: {
|
|
110
|
+
why: (p: DeprecationParams) => string;
|
|
111
|
+
fix: (p: DeprecationParams) => string;
|
|
112
|
+
};
|
|
113
|
+
/** Direct `nuxt.devtools.rpc` access (`broadcast` / `functions`). */
|
|
114
|
+
NDT_DEP_0007: {
|
|
115
|
+
why: (p: DeprecationParams) => string;
|
|
116
|
+
fix: (p: DeprecationParams) => string;
|
|
117
|
+
};
|
|
118
|
+
/** `getServerData()` RPC → the Data Inspector panel's `Nuxt Application` source. */
|
|
119
|
+
NDT_DEP_0009: {
|
|
120
|
+
why: (p: DeprecationParams) => string;
|
|
121
|
+
fix: (p: DeprecationParams) => string;
|
|
122
|
+
};
|
|
123
|
+
}, readonly [nostics.DiagnosticReporter<{
|
|
124
|
+
method?: nostics.ConsoleMethod;
|
|
125
|
+
}>]>;
|
|
126
|
+
/**
|
|
127
|
+
* Register the Nuxt deprecation codes into the connected Vite DevTools kit's
|
|
128
|
+
* diagnostics host so they are known to DevTools and post-connect emissions
|
|
129
|
+
* surface in the DevTools diagnostics UI. Safe to call when no host is present.
|
|
130
|
+
*
|
|
131
|
+
* Called from `connectDevToolsKit`.
|
|
132
|
+
*/
|
|
133
|
+
declare function registerHostDiagnostics(ctx: NuxtDevtoolsServerContext): void;
|
|
134
|
+
/**
|
|
135
|
+
* Options for {@link deprecate}.
|
|
136
|
+
*/
|
|
137
|
+
interface DeprecateOptions {
|
|
138
|
+
/**
|
|
139
|
+
* Dedupe key appended to the code. Defaults to the code itself, i.e. the
|
|
140
|
+
* deprecation warns once per process. Pass a finer key (e.g. a subprocess id)
|
|
141
|
+
* to warn once per distinct call site instead.
|
|
142
|
+
*/
|
|
143
|
+
key?: string;
|
|
144
|
+
/**
|
|
145
|
+
* Reporter method / severity. `warn` (default) for soft deprecations, `error`
|
|
146
|
+
* for hard breaks. The returned {@link Diagnostic} can be thrown to abort.
|
|
147
|
+
*/
|
|
148
|
+
method?: 'warn' | 'error';
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Emit a Nuxt DevTools deprecation diagnostic.
|
|
152
|
+
*
|
|
153
|
+
* Routing: when the Vite DevTools kit is connected the emission goes through the
|
|
154
|
+
* DevTools host catalog (terminal **and** the DevTools diagnostics UI); before
|
|
155
|
+
* connect it falls back to the terminal-only console catalog. A single emission
|
|
156
|
+
* per call — no double printing.
|
|
157
|
+
*
|
|
158
|
+
* Deduped per `${code}:${key ?? code}` on the resolved server context, so a hot
|
|
159
|
+
* path warns only once.
|
|
160
|
+
*
|
|
161
|
+
* @returns the built `Diagnostic` (which extends `Error`, so it can be thrown
|
|
162
|
+
* for hard breaks), or `undefined` if the emission was deduped.
|
|
163
|
+
*/
|
|
164
|
+
declare function deprecate(nuxt: Nuxt, code: NuxtDiagnosticCode, params: DeprecationParams, options?: DeprecateOptions): Error | undefined;
|
|
165
|
+
/**
|
|
166
|
+
* Build a standalone nostics catalog that prints to the terminal.
|
|
167
|
+
*
|
|
168
|
+
* Used by the connect-safe `nuxt.devtools.diagnostics` accessor so module
|
|
169
|
+
* authors can define + emit diagnostics before the Vite DevTools kit connects.
|
|
170
|
+
* A `createConsoleReporter()` is added automatically unless the caller supplies
|
|
171
|
+
* its own `reporters`.
|
|
172
|
+
*/
|
|
173
|
+
declare function defineStandaloneDiagnostics(options: Parameters<typeof defineDiagnostics>[0]): ReturnType<typeof defineDiagnostics>;
|
|
174
|
+
/**
|
|
175
|
+
* Convenience wrapper for call sites that don't already hold the Nuxt instance.
|
|
176
|
+
*/
|
|
177
|
+
declare function deprecateWithNuxt(code: NuxtDiagnosticCode, params: DeprecationParams, options?: DeprecateOptions): Error | undefined;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* The public `Nuxt` dock group id registered on the Vite DevTools framework
|
|
181
|
+
* category. Module authors join the group natively by pointing their own
|
|
182
|
+
* dock entries at it — no special Nuxt API required:
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* import { NUXT_DEVTOOLS_GROUP_ID, onDevtoolsReady } from '@nuxt/devtools-kit'
|
|
187
|
+
*
|
|
188
|
+
* onDevtoolsReady((ctx) => {
|
|
189
|
+
* ctx.docks.register({
|
|
190
|
+
* id: 'my-module',
|
|
191
|
+
* type: 'iframe',
|
|
192
|
+
* title: 'My Module',
|
|
193
|
+
* icon: 'i-ph-puzzle-piece',
|
|
194
|
+
* url: '/my-module/',
|
|
195
|
+
* groupId: NUXT_DEVTOOLS_GROUP_ID,
|
|
196
|
+
* })
|
|
197
|
+
* })
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
declare const NUXT_DEVTOOLS_GROUP_ID = "nuxt";
|
|
15
201
|
/**
|
|
16
202
|
* Hooks to extend a custom tab in devtools.
|
|
17
203
|
*
|
|
18
204
|
* Provide a function to pass a factory that can be updated dynamically.
|
|
205
|
+
*
|
|
206
|
+
* @deprecated Register a dock entry from the `devtools:ready` hook instead:
|
|
207
|
+
* `onDevtoolsReady((ctx) => ctx.docks.register(...))`. Still works as a shim, but
|
|
208
|
+
* emits the `NDT_DEP_0005` deprecation diagnostic. Note the docks host does not
|
|
209
|
+
* yet cover `vnode` views or tab categories.
|
|
19
210
|
*/
|
|
20
211
|
declare function addCustomTab(tab: ModuleCustomTab | (() => ModuleCustomTab | Promise<ModuleCustomTab>), nuxt?: _nuxt_schema.Nuxt): void;
|
|
21
212
|
/**
|
|
22
213
|
* Retrigger update for custom tabs, `devtools:customTabs` will be called again.
|
|
214
|
+
*
|
|
215
|
+
* @deprecated Update dock entries directly via the handle returned by
|
|
216
|
+
* `ctx.docks.register(...)` inside the `devtools:ready` hook. Still works as a
|
|
217
|
+
* shim, but emits the `NDT_DEP_0006` deprecation diagnostic.
|
|
23
218
|
*/
|
|
24
219
|
declare function refreshCustomTabs(nuxt?: _nuxt_schema.Nuxt): void | Promise<any>;
|
|
25
|
-
|
|
26
|
-
* Create a subprocess that handled by the DevTools.
|
|
27
|
-
*/
|
|
28
|
-
declare function startSubprocess(execaOptions: SubprocessOptions, tabOptions: TerminalState, nuxt?: _nuxt_schema.Nuxt): {
|
|
220
|
+
interface StartSubprocessReturn {
|
|
29
221
|
/** @deprecated Use `getResult()` instead */
|
|
30
222
|
getProcess: () => ChildProcess | undefined;
|
|
31
223
|
getResult: () => Result;
|
|
32
224
|
terminate: () => void;
|
|
33
225
|
restart: () => void;
|
|
34
226
|
clear: () => void;
|
|
35
|
-
}
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Create a subprocess that handled by the DevTools.
|
|
230
|
+
*
|
|
231
|
+
* @deprecated Use the Vite DevTools terminals host from the `devtools:ready`
|
|
232
|
+
* hook instead: `onDevtoolsReady((ctx) => ctx.terminals.startChildProcess(...))`.
|
|
233
|
+
* Still works as a shim, but emits the `NDT_DEP_0004` deprecation diagnostic.
|
|
234
|
+
*/
|
|
235
|
+
declare function startSubprocess(execaOptions: SubprocessOptions, tabOptions: TerminalState, nuxt?: _nuxt_schema.Nuxt): StartSubprocessReturn;
|
|
36
236
|
/**
|
|
37
237
|
* Extend server RPC with namespaced functions.
|
|
38
238
|
*
|
|
39
239
|
* Returns an object with a `broadcast` proxy for calling client functions.
|
|
240
|
+
*
|
|
241
|
+
* @deprecated Register RPC functions from the `devtools:ready` hook instead:
|
|
242
|
+
* `onDevtoolsReady((ctx) => ctx.rpc.register(defineRpcFunction(...)))`. Still
|
|
243
|
+
* works as a shim, but emits the `NDT_DEP_0003` deprecation diagnostic.
|
|
40
244
|
*/
|
|
41
245
|
declare function extendServerRpc<ClientFunctions extends object = Record<string, unknown>, ServerFunctions extends object = Record<string, unknown>>(namespace: string, functions: ServerFunctions, nuxt?: _nuxt_schema.Nuxt): BirpcGroup<ClientFunctions, ServerFunctions>;
|
|
42
246
|
declare function onDevToolsInitialized(fn: (info: NuxtDevtoolsInfo) => void, nuxt?: _nuxt_schema.Nuxt): void;
|
|
247
|
+
/**
|
|
248
|
+
* Run a callback once the Vite DevTools kit has connected, receiving the
|
|
249
|
+
* connected `ViteDevToolsNodeContext`.
|
|
250
|
+
*
|
|
251
|
+
* This is the recommended entry point for DevTools integration: the kit is
|
|
252
|
+
* guaranteed available, so you can use `ctx.docks` / `ctx.terminals` /
|
|
253
|
+
* `ctx.messages` / `ctx.commands` / `ctx.rpc` / `ctx.diagnostics` directly
|
|
254
|
+
* without the connect-safe accessors on `nuxt.devtools`.
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* ```ts
|
|
258
|
+
* onDevtoolsReady((ctx) => {
|
|
259
|
+
* ctx.docks.register({ id: 'my-module', title: 'My Module', type: 'iframe', url: '/…' })
|
|
260
|
+
* })
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
263
|
+
declare function onDevtoolsReady(fn: (ctx: ViteDevToolsNodeContext) => void | Promise<void>, nuxt?: _nuxt_schema.Nuxt): void;
|
|
43
264
|
|
|
44
|
-
export { addCustomTab, extendServerRpc, onDevToolsInitialized, refreshCustomTabs, startSubprocess };
|
|
265
|
+
export { NUXT_DEVTOOLS_GROUP_ID, addCustomTab, consoleDiagnostics, defineStandaloneDiagnostics, deprecate, deprecateWithNuxt, diagnosticCodes, diagnosticsDocsBase, extendServerRpc, onDevToolsInitialized, onDevtoolsReady, refreshCustomTabs, registerHostDiagnostics, startSubprocess };
|
|
266
|
+
export type { DeprecateOptions, DeprecationParams, NuxtDiagnosticCode, StartSubprocessReturn };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,44 +1,266 @@
|
|
|
1
1
|
import * as _nuxt_schema from '@nuxt/schema';
|
|
2
|
+
import { ViteDevToolsNodeContext } from '@vitejs/devtools-kit';
|
|
2
3
|
import { BirpcGroup } from 'birpc';
|
|
3
4
|
import { ChildProcess } from 'node:child_process';
|
|
4
5
|
import { Result } from 'tinyexec';
|
|
5
|
-
import {
|
|
6
|
+
import { N as NuxtDevtoolsServerContext, M as ModuleCustomTab, a as NuxtDevtoolsInfo, S as SubprocessOptions, T as TerminalState } from './shared/devtools-kit.CC-eVeXW.js';
|
|
7
|
+
import * as nostics from 'nostics';
|
|
8
|
+
import { defineDiagnostics } from 'nostics';
|
|
9
|
+
export { createConsoleReporter, defineDiagnostics } from 'nostics';
|
|
10
|
+
import { Nuxt } from 'nuxt/schema';
|
|
6
11
|
import 'vue';
|
|
7
|
-
import '@vitejs/devtools-kit';
|
|
8
|
-
import 'nuxt/schema';
|
|
9
12
|
import 'unimport';
|
|
10
13
|
import 'vue-router';
|
|
11
14
|
import 'nitropack';
|
|
12
15
|
import 'unstorage';
|
|
13
16
|
import 'vite';
|
|
14
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Canonical docs URL for a Nuxt DevTools diagnostic code.
|
|
20
|
+
*
|
|
21
|
+
* Each code links to a per-code anchor in the v4 migration guide, e.g.
|
|
22
|
+
* `NDT_DEP_0001` → `.../module/migration-v4#ndt_dep_0001`.
|
|
23
|
+
*/
|
|
24
|
+
declare function diagnosticsDocsBase(code: string | number): string;
|
|
25
|
+
/**
|
|
26
|
+
* Parameters shared by every deprecation code: the API being used and its
|
|
27
|
+
* recommended replacement. Interpolated into the `why`/`fix` messages.
|
|
28
|
+
*/
|
|
29
|
+
interface DeprecationParams {
|
|
30
|
+
/** The deprecated API / option being used. */
|
|
31
|
+
api: string;
|
|
32
|
+
/** The recommended replacement to migrate to. */
|
|
33
|
+
replacement: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The Nuxt DevTools diagnostics catalog.
|
|
37
|
+
*
|
|
38
|
+
* Codes are grouped by prefix:
|
|
39
|
+
* - `NDT_DEP_xxxx` — soft/hard deprecations (this is the only range used today).
|
|
40
|
+
*
|
|
41
|
+
* Severity is **not** encoded here; it is chosen per emission via the reporter
|
|
42
|
+
* `method` (`warn` by default, `error` for hard breaks).
|
|
43
|
+
*/
|
|
44
|
+
declare const diagnosticCodes: {
|
|
45
|
+
/** `startSubprocess().getProcess()` → `getResult()`. */
|
|
46
|
+
NDT_DEP_0001: {
|
|
47
|
+
why: (p: DeprecationParams) => string;
|
|
48
|
+
fix: (p: DeprecationParams) => string;
|
|
49
|
+
};
|
|
50
|
+
/** `extendServerRpc` → `onDevtoolsReady((ctx) => ctx.rpc.register(...))`. */
|
|
51
|
+
NDT_DEP_0003: {
|
|
52
|
+
why: (p: DeprecationParams) => string;
|
|
53
|
+
fix: (p: DeprecationParams) => string;
|
|
54
|
+
};
|
|
55
|
+
/** `startSubprocess` → `onDevtoolsReady((ctx) => ctx.terminals.startChildProcess(...))`. */
|
|
56
|
+
NDT_DEP_0004: {
|
|
57
|
+
why: (p: DeprecationParams) => string;
|
|
58
|
+
fix: (p: DeprecationParams) => string;
|
|
59
|
+
};
|
|
60
|
+
/** `addCustomTab` → `onDevtoolsReady((ctx) => ctx.docks.register(...))`. */
|
|
61
|
+
NDT_DEP_0005: {
|
|
62
|
+
why: (p: DeprecationParams) => string;
|
|
63
|
+
fix: (p: DeprecationParams) => string;
|
|
64
|
+
};
|
|
65
|
+
/** `refreshCustomTabs` → `onDevtoolsReady((ctx) => ctx.docks.register(...))`. */
|
|
66
|
+
NDT_DEP_0006: {
|
|
67
|
+
why: (p: DeprecationParams) => string;
|
|
68
|
+
fix: (p: DeprecationParams) => string;
|
|
69
|
+
};
|
|
70
|
+
/** Direct `nuxt.devtools.rpc` access (`broadcast` / `functions`). */
|
|
71
|
+
NDT_DEP_0007: {
|
|
72
|
+
why: (p: DeprecationParams) => string;
|
|
73
|
+
fix: (p: DeprecationParams) => string;
|
|
74
|
+
};
|
|
75
|
+
/** `getServerData()` RPC → the Data Inspector panel's `Nuxt Application` source. */
|
|
76
|
+
NDT_DEP_0009: {
|
|
77
|
+
why: (p: DeprecationParams) => string;
|
|
78
|
+
fix: (p: DeprecationParams) => string;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
type NuxtDiagnosticCode = keyof typeof diagnosticCodes;
|
|
82
|
+
/**
|
|
83
|
+
* Standalone catalog that prints to the terminal via nostics'
|
|
84
|
+
* {@link createConsoleReporter} (default method `warn`). Works before the Vite
|
|
85
|
+
* DevTools kit connects, so it is the fallback sink for pre-connect emissions.
|
|
86
|
+
*/
|
|
87
|
+
declare const consoleDiagnostics: nostics.Diagnostics<{
|
|
88
|
+
/** `startSubprocess().getProcess()` → `getResult()`. */
|
|
89
|
+
NDT_DEP_0001: {
|
|
90
|
+
why: (p: DeprecationParams) => string;
|
|
91
|
+
fix: (p: DeprecationParams) => string;
|
|
92
|
+
};
|
|
93
|
+
/** `extendServerRpc` → `onDevtoolsReady((ctx) => ctx.rpc.register(...))`. */
|
|
94
|
+
NDT_DEP_0003: {
|
|
95
|
+
why: (p: DeprecationParams) => string;
|
|
96
|
+
fix: (p: DeprecationParams) => string;
|
|
97
|
+
};
|
|
98
|
+
/** `startSubprocess` → `onDevtoolsReady((ctx) => ctx.terminals.startChildProcess(...))`. */
|
|
99
|
+
NDT_DEP_0004: {
|
|
100
|
+
why: (p: DeprecationParams) => string;
|
|
101
|
+
fix: (p: DeprecationParams) => string;
|
|
102
|
+
};
|
|
103
|
+
/** `addCustomTab` → `onDevtoolsReady((ctx) => ctx.docks.register(...))`. */
|
|
104
|
+
NDT_DEP_0005: {
|
|
105
|
+
why: (p: DeprecationParams) => string;
|
|
106
|
+
fix: (p: DeprecationParams) => string;
|
|
107
|
+
};
|
|
108
|
+
/** `refreshCustomTabs` → `onDevtoolsReady((ctx) => ctx.docks.register(...))`. */
|
|
109
|
+
NDT_DEP_0006: {
|
|
110
|
+
why: (p: DeprecationParams) => string;
|
|
111
|
+
fix: (p: DeprecationParams) => string;
|
|
112
|
+
};
|
|
113
|
+
/** Direct `nuxt.devtools.rpc` access (`broadcast` / `functions`). */
|
|
114
|
+
NDT_DEP_0007: {
|
|
115
|
+
why: (p: DeprecationParams) => string;
|
|
116
|
+
fix: (p: DeprecationParams) => string;
|
|
117
|
+
};
|
|
118
|
+
/** `getServerData()` RPC → the Data Inspector panel's `Nuxt Application` source. */
|
|
119
|
+
NDT_DEP_0009: {
|
|
120
|
+
why: (p: DeprecationParams) => string;
|
|
121
|
+
fix: (p: DeprecationParams) => string;
|
|
122
|
+
};
|
|
123
|
+
}, readonly [nostics.DiagnosticReporter<{
|
|
124
|
+
method?: nostics.ConsoleMethod;
|
|
125
|
+
}>]>;
|
|
126
|
+
/**
|
|
127
|
+
* Register the Nuxt deprecation codes into the connected Vite DevTools kit's
|
|
128
|
+
* diagnostics host so they are known to DevTools and post-connect emissions
|
|
129
|
+
* surface in the DevTools diagnostics UI. Safe to call when no host is present.
|
|
130
|
+
*
|
|
131
|
+
* Called from `connectDevToolsKit`.
|
|
132
|
+
*/
|
|
133
|
+
declare function registerHostDiagnostics(ctx: NuxtDevtoolsServerContext): void;
|
|
134
|
+
/**
|
|
135
|
+
* Options for {@link deprecate}.
|
|
136
|
+
*/
|
|
137
|
+
interface DeprecateOptions {
|
|
138
|
+
/**
|
|
139
|
+
* Dedupe key appended to the code. Defaults to the code itself, i.e. the
|
|
140
|
+
* deprecation warns once per process. Pass a finer key (e.g. a subprocess id)
|
|
141
|
+
* to warn once per distinct call site instead.
|
|
142
|
+
*/
|
|
143
|
+
key?: string;
|
|
144
|
+
/**
|
|
145
|
+
* Reporter method / severity. `warn` (default) for soft deprecations, `error`
|
|
146
|
+
* for hard breaks. The returned {@link Diagnostic} can be thrown to abort.
|
|
147
|
+
*/
|
|
148
|
+
method?: 'warn' | 'error';
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Emit a Nuxt DevTools deprecation diagnostic.
|
|
152
|
+
*
|
|
153
|
+
* Routing: when the Vite DevTools kit is connected the emission goes through the
|
|
154
|
+
* DevTools host catalog (terminal **and** the DevTools diagnostics UI); before
|
|
155
|
+
* connect it falls back to the terminal-only console catalog. A single emission
|
|
156
|
+
* per call — no double printing.
|
|
157
|
+
*
|
|
158
|
+
* Deduped per `${code}:${key ?? code}` on the resolved server context, so a hot
|
|
159
|
+
* path warns only once.
|
|
160
|
+
*
|
|
161
|
+
* @returns the built `Diagnostic` (which extends `Error`, so it can be thrown
|
|
162
|
+
* for hard breaks), or `undefined` if the emission was deduped.
|
|
163
|
+
*/
|
|
164
|
+
declare function deprecate(nuxt: Nuxt, code: NuxtDiagnosticCode, params: DeprecationParams, options?: DeprecateOptions): Error | undefined;
|
|
165
|
+
/**
|
|
166
|
+
* Build a standalone nostics catalog that prints to the terminal.
|
|
167
|
+
*
|
|
168
|
+
* Used by the connect-safe `nuxt.devtools.diagnostics` accessor so module
|
|
169
|
+
* authors can define + emit diagnostics before the Vite DevTools kit connects.
|
|
170
|
+
* A `createConsoleReporter()` is added automatically unless the caller supplies
|
|
171
|
+
* its own `reporters`.
|
|
172
|
+
*/
|
|
173
|
+
declare function defineStandaloneDiagnostics(options: Parameters<typeof defineDiagnostics>[0]): ReturnType<typeof defineDiagnostics>;
|
|
174
|
+
/**
|
|
175
|
+
* Convenience wrapper for call sites that don't already hold the Nuxt instance.
|
|
176
|
+
*/
|
|
177
|
+
declare function deprecateWithNuxt(code: NuxtDiagnosticCode, params: DeprecationParams, options?: DeprecateOptions): Error | undefined;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* The public `Nuxt` dock group id registered on the Vite DevTools framework
|
|
181
|
+
* category. Module authors join the group natively by pointing their own
|
|
182
|
+
* dock entries at it — no special Nuxt API required:
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* import { NUXT_DEVTOOLS_GROUP_ID, onDevtoolsReady } from '@nuxt/devtools-kit'
|
|
187
|
+
*
|
|
188
|
+
* onDevtoolsReady((ctx) => {
|
|
189
|
+
* ctx.docks.register({
|
|
190
|
+
* id: 'my-module',
|
|
191
|
+
* type: 'iframe',
|
|
192
|
+
* title: 'My Module',
|
|
193
|
+
* icon: 'i-ph-puzzle-piece',
|
|
194
|
+
* url: '/my-module/',
|
|
195
|
+
* groupId: NUXT_DEVTOOLS_GROUP_ID,
|
|
196
|
+
* })
|
|
197
|
+
* })
|
|
198
|
+
* ```
|
|
199
|
+
*/
|
|
200
|
+
declare const NUXT_DEVTOOLS_GROUP_ID = "nuxt";
|
|
15
201
|
/**
|
|
16
202
|
* Hooks to extend a custom tab in devtools.
|
|
17
203
|
*
|
|
18
204
|
* Provide a function to pass a factory that can be updated dynamically.
|
|
205
|
+
*
|
|
206
|
+
* @deprecated Register a dock entry from the `devtools:ready` hook instead:
|
|
207
|
+
* `onDevtoolsReady((ctx) => ctx.docks.register(...))`. Still works as a shim, but
|
|
208
|
+
* emits the `NDT_DEP_0005` deprecation diagnostic. Note the docks host does not
|
|
209
|
+
* yet cover `vnode` views or tab categories.
|
|
19
210
|
*/
|
|
20
211
|
declare function addCustomTab(tab: ModuleCustomTab | (() => ModuleCustomTab | Promise<ModuleCustomTab>), nuxt?: _nuxt_schema.Nuxt): void;
|
|
21
212
|
/**
|
|
22
213
|
* Retrigger update for custom tabs, `devtools:customTabs` will be called again.
|
|
214
|
+
*
|
|
215
|
+
* @deprecated Update dock entries directly via the handle returned by
|
|
216
|
+
* `ctx.docks.register(...)` inside the `devtools:ready` hook. Still works as a
|
|
217
|
+
* shim, but emits the `NDT_DEP_0006` deprecation diagnostic.
|
|
23
218
|
*/
|
|
24
219
|
declare function refreshCustomTabs(nuxt?: _nuxt_schema.Nuxt): void | Promise<any>;
|
|
25
|
-
|
|
26
|
-
* Create a subprocess that handled by the DevTools.
|
|
27
|
-
*/
|
|
28
|
-
declare function startSubprocess(execaOptions: SubprocessOptions, tabOptions: TerminalState, nuxt?: _nuxt_schema.Nuxt): {
|
|
220
|
+
interface StartSubprocessReturn {
|
|
29
221
|
/** @deprecated Use `getResult()` instead */
|
|
30
222
|
getProcess: () => ChildProcess | undefined;
|
|
31
223
|
getResult: () => Result;
|
|
32
224
|
terminate: () => void;
|
|
33
225
|
restart: () => void;
|
|
34
226
|
clear: () => void;
|
|
35
|
-
}
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Create a subprocess that handled by the DevTools.
|
|
230
|
+
*
|
|
231
|
+
* @deprecated Use the Vite DevTools terminals host from the `devtools:ready`
|
|
232
|
+
* hook instead: `onDevtoolsReady((ctx) => ctx.terminals.startChildProcess(...))`.
|
|
233
|
+
* Still works as a shim, but emits the `NDT_DEP_0004` deprecation diagnostic.
|
|
234
|
+
*/
|
|
235
|
+
declare function startSubprocess(execaOptions: SubprocessOptions, tabOptions: TerminalState, nuxt?: _nuxt_schema.Nuxt): StartSubprocessReturn;
|
|
36
236
|
/**
|
|
37
237
|
* Extend server RPC with namespaced functions.
|
|
38
238
|
*
|
|
39
239
|
* Returns an object with a `broadcast` proxy for calling client functions.
|
|
240
|
+
*
|
|
241
|
+
* @deprecated Register RPC functions from the `devtools:ready` hook instead:
|
|
242
|
+
* `onDevtoolsReady((ctx) => ctx.rpc.register(defineRpcFunction(...)))`. Still
|
|
243
|
+
* works as a shim, but emits the `NDT_DEP_0003` deprecation diagnostic.
|
|
40
244
|
*/
|
|
41
245
|
declare function extendServerRpc<ClientFunctions extends object = Record<string, unknown>, ServerFunctions extends object = Record<string, unknown>>(namespace: string, functions: ServerFunctions, nuxt?: _nuxt_schema.Nuxt): BirpcGroup<ClientFunctions, ServerFunctions>;
|
|
42
246
|
declare function onDevToolsInitialized(fn: (info: NuxtDevtoolsInfo) => void, nuxt?: _nuxt_schema.Nuxt): void;
|
|
247
|
+
/**
|
|
248
|
+
* Run a callback once the Vite DevTools kit has connected, receiving the
|
|
249
|
+
* connected `ViteDevToolsNodeContext`.
|
|
250
|
+
*
|
|
251
|
+
* This is the recommended entry point for DevTools integration: the kit is
|
|
252
|
+
* guaranteed available, so you can use `ctx.docks` / `ctx.terminals` /
|
|
253
|
+
* `ctx.messages` / `ctx.commands` / `ctx.rpc` / `ctx.diagnostics` directly
|
|
254
|
+
* without the connect-safe accessors on `nuxt.devtools`.
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* ```ts
|
|
258
|
+
* onDevtoolsReady((ctx) => {
|
|
259
|
+
* ctx.docks.register({ id: 'my-module', title: 'My Module', type: 'iframe', url: '/…' })
|
|
260
|
+
* })
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
263
|
+
declare function onDevtoolsReady(fn: (ctx: ViteDevToolsNodeContext) => void | Promise<void>, nuxt?: _nuxt_schema.Nuxt): void;
|
|
43
264
|
|
|
44
|
-
export { addCustomTab, extendServerRpc, onDevToolsInitialized, refreshCustomTabs, startSubprocess };
|
|
265
|
+
export { NUXT_DEVTOOLS_GROUP_ID, addCustomTab, consoleDiagnostics, defineStandaloneDiagnostics, deprecate, deprecateWithNuxt, diagnosticCodes, diagnosticsDocsBase, extendServerRpc, onDevToolsInitialized, onDevtoolsReady, refreshCustomTabs, registerHostDiagnostics, startSubprocess };
|
|
266
|
+
export type { DeprecateOptions, DeprecationParams, NuxtDiagnosticCode, StartSubprocessReturn };
|