feat(devtools): unify Data Inspector Vite instance and refresh builtin queries - #1047
Conversation
…n queries
Nuxt 5 merged the separate client and SSR Vite dev servers into a single
instance, so the Data Inspector's live source now captures and surfaces one
Vite config (the former per-environment configs live under `vite.environments`)
instead of a `vite: { client, ssr }` split.
Refresh the source's suggested queries to target the surfaces authors care
about: Nuxt modules, Vite plugins, Vite config, Vite environments, and Nitro
routes.
The deprecated `getServerData()` shim keeps its legacy `vite: { server, client }`
contract independently by projecting the one captured config onto both fields.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughNuxt DevTools now captures the unified Vite development server through Estimated code review effort: 3 (Moderate) | ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/devtools/src/integrations/data-inspector.ts (1)
137-154: 🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy liftMake the legacy projections deeply independent.
normalizeViteConfig()only shallow-copiesconfig, so nested branches such asbuild,resolve, andserverare shared byvite.serverandvite.client. This contradicts the stated mutation-isolation guarantee; the current test checks only root identity. Deeply clone/sanitize retained nested branches and add a nested-mutation assertion.🤖 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/integrations/data-inspector.ts` around lines 137 - 154, Update getServerData and normalizeViteConfig so the vite.server and vite.client projections do not share nested objects, especially within build, resolve, and server; deeply clone or sanitize retained configuration branches while preserving the existing normalization behavior. Extend the relevant test to mutate a nested branch in one projection and assert the corresponding branch in the other remains unchanged.
🤖 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.
Outside diff comments:
In `@packages/devtools/src/integrations/data-inspector.ts`:
- Around line 137-154: Update getServerData and normalizeViteConfig so the
vite.server and vite.client projections do not share nested objects, especially
within build, resolve, and server; deeply clone or sanitize retained
configuration branches while preserving the existing normalization behavior.
Extend the relevant test to mutate a nested branch in one projection and assert
the corresponding branch in the other remains unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: bba5d8e9-fd0c-486c-a77f-2d07eba79534
📒 Files selected for processing (2)
packages/devtools/src/integrations/data-inspector.tspackages/devtools/test/data-inspector.test.ts
…s config The Data Inspector's `vite` object is now the live Vite dev server instance (captured from `vite:serverCreated`), which carries the runtime environments, module graph, and websocket in addition to the resolved config at `vite.config`. Suggested queries and the deprecated `getServerData()` shim read the config through `vite.config` accordingly.
Summary
Nuxt 5 merged the separate client and SSR Vite dev servers into a single instance. This aligns the Data Inspector's live
Nuxt Applicationsource with that reality and refreshes its suggested queries.vite, instead of avite: { client, ssr }split. The former per-environment configs remain reachable undervite.environments.OverviewNuxt modules→nuxt.modulesVite plugins→vite.pluginsVite config→viteVite environments→vite.environmentsNitro routes→nitro.handlersgetServerData()shim keeps its legacyvite: { server, client }contract independently, by projecting the single captured config onto both fields (each normalized separately).Unit tests updated to cover the unified capture flow, the new query set, and the shim's projection behavior.
This PR was created with the help of an agent.