feat(devtools): devtools:ready hook + nostics-driven deprecation foundation - #1021
Conversation
… deprecations Lay the compatibility foundation for the next major on Vite DevTools / devframe: keep the existing Nuxt DevTools API working while exposing the devframe-native surface and making deprecations self-discoverable. - Surface connect-safe `docks`/`terminals`/`messages`/`commands`/`diagnostics` accessors on `nuxt.devtools` that forward to the Vite DevTools kit once connected and buffer/replay mutating calls made before connect. - Add a `nostics` deprecation catalog with a `deprecate()` helper that routes to the DevTools diagnostics host when connected (surfacing in the DevTools UI) and to the terminal otherwise, deduped per code. - Pilot the mechanism on two APIs: `startSubprocess().getProcess()` (warn) and `disableAuthorization`, which becomes functional again by forwarding to Vite DevTools' `clientAuth: false` while soft-deprecating in favour of the Vite-native option. - Document the forward path and the deprecation codes in the module docs. Created with the help of an agent.
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (16)
📝 WalkthroughWalkthroughAdds structured deprecation diagnostics with console and DevTools-host reporting, deduplication, migration links, and tests. Introduces the Estimated code review effort: 4 (Complex) | ~60 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install timed out. The project may have too many dependencies for the sandbox. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ools RPC registration Add a connect-safe `nuxt.devtools.rpc.register` that forwards to the Vite DevTools RPC host (buffering registrations until connect), and soft-deprecate `extendServerRpc` (NDT_DEP_0003) to point at it. The old API keeps working as a shim; the compat `rpc.broadcast`/`rpc.functions` are unchanged. Created with the help of an agent.
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/devtools-kit/src/index.ts`:
- Around line 126-134: Update the deprecate call inside getProcess to provide a
call-site-specific key for NDT_DEP_0001, using the available startSubprocess
instance identifier so each instance can warn independently while preserving the
existing API and replacement metadata.
In `@packages/devtools/src/module-main.ts`:
- Around line 53-60: Move the deprecation check block keyed by
disableAuthorization in enableModule to execute after setupRPC has initialized
nuxt.devtools. Keep the existing condition and deprecate arguments unchanged,
ensuring the call uses the initialized DevTools context.
In `@packages/devtools/src/server-rpc/connect-safe-hosts.ts`:
- Around line 304-308: Update flushPendingHostCalls to isolate failures from
each queued call: continue invoking all pending calls even when one throws,
while preserving queue cleanup after the flush. Ensure errors are handled
consistently with the existing async deferred-rejection behavior rather than
allowing one synchronous thunk to abort replay.
In `@packages/devtools/src/server-rpc/index.ts`:
- Around line 89-100: Wrap the RPC registration logic inside register’s apply
closure with try/catch, covering both devtoolsKitCtx!.rpc.update and
devtoolsKitCtx!.rpc.register. Handle the caught error using the same guarded
execution pattern already used for serverFunctions in connectDevToolsKit,
allowing flushPendingHostCalls() to continue processing remaining registrations.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3db74b66-e01e-4f6a-ad31-2d6008477a87
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (13)
docs/content/2.module/1.utils-kit.mddocs/content/2.module/3.migration-v4.mdpackages/devtools-kit/package.jsonpackages/devtools-kit/src/_types/options.tspackages/devtools-kit/src/_types/server-ctx.tspackages/devtools-kit/src/diagnostics.tspackages/devtools-kit/src/index.tspackages/devtools-kit/test/diagnostics.test.tspackages/devtools/src/module-main.tspackages/devtools/src/server-rpc/connect-safe-hosts.tspackages/devtools/src/server-rpc/index.tspackages/devtools/test/connect-safe-hosts.test.tspnpm-workspace.yaml
| // Soft-deprecate the Nuxt-specific option in favour of the Vite-native one — | ||
| // only when the user explicitly set it, not for the sandbox default. | ||
| if (nuxt.options.devtools && typeof nuxt.options.devtools !== 'boolean' && 'disableAuthorization' in nuxt.options.devtools) { | ||
| logger.warn('[nuxt-devtools] `disableAuthorization` option is deprecated. Auth is now handled by Vite DevTools.') | ||
| deprecate(nuxt, 'NDT_DEP_0002', { | ||
| api: 'disableAuthorization', | ||
| replacement: 'vite: { devtools: { clientAuth: false } }', | ||
| }) | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Move deprecate() call after setupRPC to ensure the DevTools context is initialized.
At this point in enableModule, setupRPC has not yet been called, meaning nuxt.devtools is currently undefined. When deprecate() internally resolves the server context via getServerContext(nuxt), it will receive undefined. If the underlying diagnostic state management expects a valid context, this can lead to an early runtime crash or an inconsistent state where the deprecation falls back entirely to the global scope.
Consider moving this deprecation check block below the setupRPC call (around line 170) so that the nuxt.devtools context is reliably populated before emitting any deprecations.
📦 Proposed move
- // Soft-deprecate the Nuxt-specific option in favour of the Vite-native one —
- // only when the user explicitly set it, not for the sandbox default.
- if (nuxt.options.devtools && typeof nuxt.options.devtools !== 'boolean' && 'disableAuthorization' in nuxt.options.devtools) {
- deprecate(nuxt, 'NDT_DEP_0002', {
- api: 'disableAuthorization',
- replacement: 'vite: { devtools: { clientAuth: false } }',
- })
- }
-
if (options.iframeProps) {Then append it after the setupRPC call:
const {
connectDevToolsKit: _connectDevToolsKit,
...ctx
} = setupRPC(nuxt, options)
connectDevToolsKit = _connectDevToolsKit
+ // Soft-deprecate the Nuxt-specific option in favour of the Vite-native one —
+ // only when the user explicitly set it, not for the sandbox default.
+ if (nuxt.options.devtools && typeof nuxt.options.devtools !== 'boolean' && 'disableAuthorization' in nuxt.options.devtools) {
+ deprecate(nuxt, 'NDT_DEP_0002', {
+ api: 'disableAuthorization',
+ replacement: 'vite: { devtools: { clientAuth: false } }',
+ })
+ }
+
const clientDirExists = existsSync(clientDir)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // Soft-deprecate the Nuxt-specific option in favour of the Vite-native one — | |
| // only when the user explicitly set it, not for the sandbox default. | |
| if (nuxt.options.devtools && typeof nuxt.options.devtools !== 'boolean' && 'disableAuthorization' in nuxt.options.devtools) { | |
| logger.warn('[nuxt-devtools] `disableAuthorization` option is deprecated. Auth is now handled by Vite DevTools.') | |
| deprecate(nuxt, 'NDT_DEP_0002', { | |
| api: 'disableAuthorization', | |
| replacement: 'vite: { devtools: { clientAuth: false } }', | |
| }) | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/devtools/src/module-main.ts` around lines 53 - 60, Move the
deprecation check block keyed by disableAuthorization in enableModule to execute
after setupRPC has initialized nuxt.devtools. Keep the existing condition and
deprecate arguments unchanged, ensuring the call uses the initialized DevTools
context.
| export function flushPendingHostCalls(queue: PendingHostCalls): void { | ||
| for (const call of queue) | ||
| call() | ||
| queue.length = 0 | ||
| } |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
flushPendingHostCalls has no per-call error isolation.
If any buffered call throws (e.g. lazy.bind((getHost() as any)[prop](...args)) at Line 156, or the syncDefaults/unknown-method thunks at Lines 164 and 175), the for loop aborts and every remaining queued call across all five hosts is silently dropped — undermining the "buffered and replayed" guarantee this file exists to provide. The async branch already isolates errors via deferred.reject (Lines 145-147); the other branches don't.
🩹 Proposed fix
export function flushPendingHostCalls(queue: PendingHostCalls): void {
- for (const call of queue)
- call()
+ for (const call of queue) {
+ try {
+ call()
+ }
+ catch (error) {
+ console.error('[Nuxt DevTools] Failed to replay a buffered host call:', error)
+ }
+ }
queue.length = 0
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| export function flushPendingHostCalls(queue: PendingHostCalls): void { | |
| for (const call of queue) | |
| call() | |
| queue.length = 0 | |
| } | |
| export function flushPendingHostCalls(queue: PendingHostCalls): void { | |
| for (const call of queue) { | |
| try { | |
| call() | |
| } | |
| catch (error) { | |
| console.error('[Nuxt DevTools] Failed to replay a buffered host call:', error) | |
| } | |
| } | |
| queue.length = 0 | |
| } |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/devtools/src/server-rpc/connect-safe-hosts.ts` around lines 304 -
308, Update flushPendingHostCalls to isolate failures from each queued call:
continue invoking all pending calls even when one throws, while preserving queue
cleanup after the flush. Ensure errors are handled consistently with the
existing async deferred-rejection behavior rather than allowing one synchronous
thunk to abort replay.
…eshCustomTabs Continue steering module authors onto the devframe-native surface: - `startSubprocess` (NDT_DEP_0004) → `nuxt.devtools.terminals.startChildProcess`. Extract a non-warning internal core so Nuxt DevTools' own npm/analyze-build/ vscode usage doesn't emit the warning; the real terminals-host migration of those call sites is deferred to a later plan (pending devframe gaining an awaitable result/exit-code API). - `addCustomTab` (NDT_DEP_0005) and `refreshCustomTabs` (NDT_DEP_0006) → `nuxt.devtools.docks.register(...)`, noting the docks host doesn't yet cover vnode views / tab categories. All shims keep working; docs and the migration guide document each code. Created with the help of an agent.
Reverse the soft-deprecation of `disableAuthorization`: it stays a valid, supported module option that disables the DevTools client-auth prompt (still defaulting to on in sandboxes), with no user-facing nudge toward `vite.devtools.clientAuth`. The NDT_DEP_0002 code is retired (left unused so the remaining codes keep their numbers). Created with the help of an agent.
There was a problem hiding this comment.
♻️ Duplicate comments (1)
packages/devtools-kit/src/index.ts (1)
173-179: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winPass a call-site-specific dedupe key for
NDT_DEP_0001.
deprecate()here omitskey, so the dedupe key defaults to the code itself — only the firststartSubprocessinstance whosegetProcess()is ever called across the process gets warned; other call sites are silently deduped forever. The siblingNDT_DEP_0003deprecation (extendServerRpc, inpackages/devtools/src/server-rpc/index.ts) passeskey: namespacefor exactly this reason.🩹 Proposed fix
getProcess: () => { deprecate(nuxt, 'NDT_DEP_0001', { api: 'startSubprocess().getProcess()', replacement: 'getResult()', - }) + }, { key: id }) return result.process },🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@packages/devtools-kit/src/index.ts` around lines 173 - 179, Update the deprecate call in getProcess to provide a call-site-specific key, using the relevant startSubprocess instance or call-site identifier so each distinct caller can emit its own NDT_DEP_0001 warning while preserving deduplication for repeated calls from that caller.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Duplicate comments:
In `@packages/devtools-kit/src/index.ts`:
- Around line 173-179: Update the deprecate call in getProcess to provide a
call-site-specific key, using the relevant startSubprocess instance or call-site
identifier so each distinct caller can emit its own NDT_DEP_0001 warning while
preserving deduplication for repeated calls from that caller.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: f0bd7f6b-42b2-484c-a092-5a3974a367e0
📒 Files selected for processing (10)
docs/content/2.module/1.utils-kit.mddocs/content/2.module/3.migration-v4.mdpackages/devtools-kit/src/_types/options.tspackages/devtools-kit/src/diagnostics.tspackages/devtools-kit/src/index.tspackages/devtools-kit/test/diagnostics.test.tspackages/devtools/src/integrations/vscode.tspackages/devtools/src/module-main.tspackages/devtools/src/server-rpc/analyze-build.tspackages/devtools/src/server-rpc/npm.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/devtools-kit/src/_types/options.ts
- packages/devtools-kit/test/diagnostics.test.ts
`nuxt.devtools.rpc` is now the devframe RpcFunctionsHost, exposed connect-safe (register/update/has/get/list/invokeLocal/broadcast/sharedState/streaming/… forward to the kit once connected, buffering pre-connect mutations). The legacy Nuxt compat is kept but deprecated (NDT_DEP_0007): `broadcast` is a hybrid that is callable natively yet still supports the deprecated `broadcast.<method>.asEvent(...)` proxy, and `functions` remains the deprecated read/write proxy. Our own internal broadcast/functions usages (terminals, storage, vscode, vite-inspect) are migrated to the native forms so they don't self-warn. Created with the help of an agent.
Fire a `devtools:ready` Nuxt hook once the Vite DevTools kit connects, passing the connected ViteDevToolsNodeContext, and add an `onDevtoolsReady()` helper. This is the recommended entry point for module DevTools integration: the kit is guaranteed available there, so authors can use ctx.docks/terminals/messages/ commands/rpc/diagnostics directly without the connect-safe accessors. Created with the help of an agent.
…eady hook Now that `devtools:ready` / `onDevtoolsReady()` hand modules the connected kit context, the connect-safe host accessors are redundant. Remove `nuxt.devtools.docks/terminals/messages/commands/diagnostics` and the whole connect-safe proxy machinery (generic host proxy, lazy handles, deferreds, buffering). `nuxt.devtools.rpc` reverts to the lean legacy broadcast/functions compat (broadcast still buffered via the existing queue); the devframe RPC host is reached through `ctx.rpc` in the hook. Deprecation fixes now point at `onDevtoolsReady((ctx) => …)`, and the internal vite-inspect registration moves into the hook. NDT_DEP_0007 is retired. Created with the help of an agent.
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
docs/content/2.module/3.migration-v4.md (1)
61-77: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winClarify that
getResult()replacesgetProcess()as the preferred API, not that it was removed.The implementation still exposes
getProcess()as a deprecated shim. Also,deprecate()emits the structuredNDT_DEP_0001diagnostic, so “logs a deprecation warning” is narrower and inconsistent with the surrounding documentation.Proposed wording
-The return value of `startSubprocess()` now provides `getResult()` instead of `getProcess()`. +The return value of `startSubprocess()` now also provides `getResult()`; use it instead of the deprecated `getProcess()` method. -Calling `getProcess()` emits the `NDT_DEP_0001` deprecation diagnostic. +Calling `getProcess()` emits the `NDT_DEP_0001` deprecation diagnostic. -- `getProcess()` still works but logs a deprecation warning and returns `ChildProcess | undefined` (was `ExecaChildProcess<string>`) +- `getProcess()` still works but emits a deprecation diagnostic and returns `ChildProcess | undefined` (was `ExecaChildProcess<string>`)🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@docs/content/2.module/3.migration-v4.md` around lines 61 - 77, Update the migration section for getProcess() to state that getResult() is the preferred replacement while getProcess() remains available as a deprecated shim. Replace the narrower “logs a deprecation warning” wording with language indicating that calling getProcess() emits the structured NDT_DEP_0001 deprecation diagnostic, and preserve the existing return-type details and example.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/content/2.module/1.utils-kit.md`:
- Line 158: Update the availability claim mentioning ViteDevToolsNodeContext by
changing “guaranteed available” to “guaranteed to be available,” preserving the
rest of the sentence.
In `@packages/devtools/src/server-rpc/connect-safe-hosts.ts`:
- Around line 331-344: Update the createHostProxy configuration in the native
proxy setup to explicitly handle the nested sharedState and streaming RPC APIs
before connection, preserving their expected API shapes instead of routing
access through the buffered fallback thunk. Follow the existing maps, emitters,
async, handles, and reads configuration patterns and use the established host
API symbols for these two namespaces.
---
Outside diff comments:
In `@docs/content/2.module/3.migration-v4.md`:
- Around line 61-77: Update the migration section for getProcess() to state that
getResult() is the preferred replacement while getProcess() remains available as
a deprecated shim. Replace the narrower “logs a deprecation warning” wording
with language indicating that calling getProcess() emits the structured
NDT_DEP_0001 deprecation diagnostic, and preserve the existing return-type
details and example.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: b4977fa2-676b-4de0-af41-fa5c15268355
📒 Files selected for processing (15)
docs/content/2.module/1.utils-kit.mddocs/content/2.module/3.migration-v4.mdpackages/devtools-kit/src/_types/hooks.tspackages/devtools-kit/src/_types/server-ctx.tspackages/devtools-kit/src/diagnostics.tspackages/devtools-kit/src/index.tspackages/devtools-kit/test/diagnostics.test.tspackages/devtools/src/integrations/vite-inspect.tspackages/devtools/src/integrations/vscode.tspackages/devtools/src/module-main.tspackages/devtools/src/server-rpc/connect-safe-hosts.tspackages/devtools/src/server-rpc/index.tspackages/devtools/src/server-rpc/storage.tspackages/devtools/src/server-rpc/terminals.tspackages/devtools/test/connect-safe-hosts.test.ts
🚧 Files skipped from review as they are similar to previous changes (4)
- packages/devtools/src/server-rpc/index.ts
- packages/devtools-kit/test/diagnostics.test.ts
- packages/devtools-kit/src/diagnostics.ts
- packages/devtools-kit/src/index.ts
| const native = createHostProxy<RpcFunctionsHost>(getHost, queue, { | ||
| maps: ['definitions'], | ||
| emitters: [], | ||
| async: ['invokeLocal', 'getHandler'], | ||
| handles: [], | ||
| reads: { | ||
| has: () => false, | ||
| list: () => [], | ||
| get: () => undefined, | ||
| getSchema: () => ({ args: undefined, returns: undefined }), | ||
| getCurrentRpcSession: () => undefined, | ||
| }, | ||
| syncDefaults: {}, | ||
| }) |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Inspect createHostProxy's fallback branch for unlisted properties
sed -n '91,183p' packages/devtools/src/server-rpc/connect-safe-hosts.tsRepository: nuxt/devtools
Length of output: 3123
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- RpcFunctionsHost and native proxy config ---'
sed -n '1,220p' packages/devtools/src/server-rpc/connect-safe-hosts.ts
echo
echo '--- search for sharedState / streaming ---'
rg -n --no-heading '\bsharedState\b|\bstreaming\b' packages/devtools/src | sed -n '1,200p'
echo
echo '--- tests mentioning connect-safe-hosts ---'
rg -n --no-heading 'connect-safe-hosts|createConnectSafeRpc|sharedState|streaming' packages/devtools/src/server-rpc/*.test.* packages/devtools/src/server-rpc/**/*.test.* | sed -n '1,220p'Repository: nuxt/devtools
Length of output: 7175
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- full native proxy config area ---'
sed -n '300,380p' packages/devtools/src/server-rpc/connect-safe-hosts.ts
echo
echo '--- repo-wide sharedState / streaming references ---'
rg -n --no-heading '\bsharedState\b|\bstreaming\b' . | sed -n '1,240p'
echo
echo '--- connect-safe-hosts tests ---'
git ls-files 'packages/devtools/src/server-rpc/*test*' 'packages/devtools/src/server-rpc/**/*test*' | sed -n '1,200p'Repository: nuxt/devtools
Length of output: 3752
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo '--- RpcFunctionsHost definition and related types ---'
rg -n --no-heading 'interface RpcFunctionsHost|type RpcFunctionsHost|sharedState|streaming' packages/devtools-kit/src packages/devtools/src | sed -n '1,260p'
echo
echo '--- likely relevant type file ---'
sed -n '1,220p' packages/devtools-kit/src/_types/server-ctx.tsRepository: nuxt/devtools
Length of output: 5346
🌐 Web query:
"@vitejs/devtools-kit RpcFunctionsHost sharedState streaming source"
💡 Result:
In @vitejs/devtools-kit, the RpcFunctionsHost, sharedState, and streaming are distinct but complementary components of the Vite DevTools communication infrastructure [1][2][3]. RpcFunctionsHost The RpcFunctionsHost is an implementation of the RPC host (built on birpc-x) that manages the registration and broadcasting of functions between the Vite server and the devtools client [4][5]. It serves as the core coordinator for RPC calls [1]. Access to rpc.sharedState is permitted during plugin setup, allowing developers to initialize or subscribe to shared state early in the lifecycle [6]. Shared State The sharedState system is designed for snapshot-based synchronization between server and client [3]. Changes made on either side are broadcast to all connected parties [3]. - Usage: Accessed via ctx.rpc.sharedState.get [3]. - Mutation: Updates are performed via state.mutate, which receives a mutable draft (often leveraging Immer) and automatically syncs changes [3][7]. - Behavior: It is intended for authoritative state that must survive reloads and sync across panels [2]. For large datasets, it is recommended to store IDs in shared state and fetch full records via RPC on demand [3]. Streaming The streaming API is designed for chunk-based data, such as LLM tokens, logs, or build progress, where low-latency delivery is prioritized over persistent state [1][2]. - Implementation: It utilizes the same primitives as the shared state infrastructure but operates as a streaming channel [2][8]. - Integration: Streaming and shared state often compose for complex UIs [2]. For example, a chat application might use a streaming channel for real-time token rendering while maintaining the conversation log in shared state [2][8]. Once a stream completes, the final content is typically committed to shared state to ensure the data is persisted for subsequent reloads [2][8]. In summary, use sharedState for persistent, authoritative data that needs to be synchronized and survive reloads, and use the streaming channel for transient, low-latency chunked data [2][3]. Developers frequently use both in tandem to provide a responsive user experience that maintains state consistency [2][8].
Citations:
- 1: https://devtools.vite.dev/kit/rpc
- 2: https://devtools.vite.dev/kit/streaming
- 3: https://devtools.vite.dev/kit/shared-state
- 4: vitejs/devtools@30780b7
- 5: vitejs/devtools@135f89d
- 6: vitejs/devtools@39b11d8
- 7: vitejs/devtools@5daecec
- 8: vitejs/devtools@343d2c7
Add pre-connect handling for sharedState and streaming.
They’re exposed as nested RPC APIs (ctx.rpc.sharedState.get(...), streaming channels), but this proxy only special-cases methods/emitters/maps. Leaving them to the fallback path turns pre-connect access into a buffered thunk instead of preserving their API shape.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/devtools/src/server-rpc/connect-safe-hosts.ts` around lines 331 -
344, Update the createHostProxy configuration in the native proxy setup to
explicitly handle the nested sharedState and streaming RPC APIs before
connection, preserving their expected API shapes instead of routing access
through the buffered fallback thunk. Follow the existing maps, emitters, async,
handles, and reads configuration patterns and use the established host API
symbols for these two namespaces.
Bump devframe / @devframes/hub to 0.6.1, whose child-process terminal session
now exposes a tinyexec-style `getResult()` ({ stdout, stderr, exitCode }).
Migrate Nuxt DevTools' own subprocess usages (npm install/uninstall, analyze
build, VS Code server) off the deprecated `startSubprocess` onto
`ctx.devtoolsKit.terminals.startChildProcess(...)`, awaiting `getResult()` where
exit code / stderr are needed. The `devtoolsKit` escape hatch is now typed as the
connected `ViteDevToolsNodeContext`. With no internal callers left, the
`startSubprocessInternal` split is folded back into the public (deprecated)
`startSubprocess` shim.
Created with the help of an agent.
…s access Accessing `nuxt.devtools.rpc.broadcast` or `nuxt.devtools.rpc.functions` now emits NDT_DEP_0007, steering module authors to the connected `ctx.rpc` from the `devtools:ready` hook. Our own internal broadcasts (terminals/storage/vscode) move to the devframe-native `ctx.devtoolsKit.rpc.broadcast(...)` so they don't trip the warning. Created with the help of an agent.
# Conflicts: # pnpm-lock.yaml
- Pass a call-site key (`{ key: id }`) to the `getProcess()` NDT_DEP_0001
deprecation so each subprocess instance warns independently.
- Docs: clarify `getProcess()` remains a deprecated shim (emits a diagnostic)
and fix a grammar nit in the onDevtoolsReady section.
Created with the help of an agent.
|
Addressed CodeRabbit review feedback in c86a7a4: Applied
Skipped (no longer applicable — code removed in later commits of this PR)
|
…ntion Register Nuxt DevTools' own server RPC functions under the devframe-style `nuxt:devtools:` namespace and have the client call them by that name. Bare, un-namespaced aliases are still registered for backward compatibility and are clearly marked (TODO) for removal in the next major. Also fixes the `DF0021: getComponentsRelationships already registered` crash: vite-inspect now overwrites the `setupGeneralRPC` placeholder with `register(..., true)` (force) under the namespaced name. Created with the help of an agent.
…n 00 Rebased feat/ecosystem-playgrounds onto main after #1021 (devframe-native hosts + nostics deprecation foundation) and #1023 (client RPC registration fix) merged, and re-ran the full dogfooding pass. No git conflicts during the rebase. Findings added to REPORTS.md: - The earlier DF0022 "RPC function not registered" console errors (refresh/callHook/onTerminalData/onTerminalExit/navigateTo) no longer reproduce — fixed by #1023. - Plan 00's deprecation diagnostics are live and already flagging real ecosystem usage: NDT_DEP_0003 (extendServerRpc deprecated) fires from both @nuxt/fonts and nuxt-og-image's nuxtseo-shared dependency. NDT_DEP_0004 (startSubprocess deprecated) fires from this repo's own local.ts dev helper, not from any ecosystem module. - @nuxt/scripts's legacy addCustomTab still works but didn't trigger a matching deprecation diagnostic — flagged as a follow-up. Everything else held: all three modules still load, all three tabs are still reachable (still only via the SideNav overflow menu), builds still succeed against both the stubbed and fully-built local @nuxt/devtools. Co-authored-by: opencode <noreply@opencode.ai>
What & why
Implements Plan 00 — compatibility & deprecation foundation (
plans/vite-devtools-integration/00-compat-foundation.md) for the new major on top of Vite DevTools 0.4 / devframe 0.6.We're moving module authors onto the devframe-native API while keeping the existing Nuxt DevTools API working. The migration must be minimal and self-discoverable, so this PR establishes the entry point and the deprecation mechanism, then applies them.
Highlights
devtools:readyhook — the recommended integration entry pointdevtools:readyNuxt hook +onDevtoolsReady((ctx) => …)helper, fired once the Vite DevTools kit connects, handing you the connectedViteDevToolsNodeContext.ctx.docks/ctx.terminals/ctx.messages/ctx.commands/ctx.rpc/ctx.diagnostics— no connect-timing juggling.nuxt.devtools.devtoolsKitremains as the raw escape hatch (typed as the connected context,undefineduntil connect).Self-discoverable deprecations (nostics)
NDT_DEP_xxxx) +deprecate()helper built onnostics. A single emission per call, deduped, routed to the DevTools diagnostics host once connected (so it also shows in the DevTools UI) and to the terminal otherwise. Each code carries awhy, afix, and a migration-guide link.NDT_DEP_0001—startSubprocess().getProcess()→getResult()NDT_DEP_0003—extendServerRpc()→ctx.rpc.register(...)NDT_DEP_0004—startSubprocess()→ctx.terminals.startChildProcess(...)NDT_DEP_0005—addCustomTab()→ctx.docks.register(...)NDT_DEP_0006—refreshCustomTabs()→ dock entry.update()NDT_DEP_0007— directnuxt.devtools.rpc.broadcast/.functions→ctx.rpcTerminals migration (devframe 0.6.1)
devframe/@devframes/hubto 0.6.1, whose child-process session now exposes atinyexec-stylegetResult()({ stdout, stderr, exitCode }).ctx.terminals.startChildProcess(...)instead of the deprecatedstartSubprocess.disableAuthorizationstays first-classNotes
nosticsas a dependency of@nuxt/devtools-kit.addCustomTab/refreshCustomTabs) note that the docks host doesn't yet covervnodeviews / tab categories.onDevtoolsReadyguidance in the utils-kit page and per-code sections in the v4 migration guide.pnpm lint,pnpm build,pnpm typecheck, and unit tests all pass.This PR was created with the help of an agent.