Skip to content

feat(devtools)!: replace server discovery with the Data Inspector plugin#1034

Merged
antfu merged 3 commits into
nuxt:mainfrom
antfubot:feat/data-inspector-plugin
Jul 23, 2026
Merged

feat(devtools)!: replace server discovery with the Data Inspector plugin#1034
antfu merged 3 commits into
nuxt:mainfrom
antfubot:feat/data-inspector-plugin

Conversation

@antfubot

@antfubot antfubot commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implements plans/vite-devtools-integration/04-data-inspector-plugin.md. Replaces the read-only Nuxt Options Viewer (the DiscoveryJS bundle, nested iframe, serialization RPC, and its build step) with a mounted @devframes/plugin-data-inspector member in the Nuxt dock group.

The Data Inspector member is always mounted when DevTools is enabled and exposes a single live source, Nuxt Application, over the current Nuxt / Nitro / Vite configuration:

  • three root fields — nuxt (options), nitro (options, populated once Nitro is created), and vite (client / ssr environment configs);
  • four read-only suggested queries (Overview, Nuxt options, Nitro options, Vite configs), each with function exclusion;
  • raw live objects are handed to the Data Inspector engine, which owns normalization, circular refs, depth limits, and lazy expansion.

Ecosystem modules add their own sources through the upstream registerDataSource API — no Nuxt-specific wrapper.

Notable decisions

  • Vite capture uses Nuxt's typed vite:configResolved hook (per-environment isClient / isServer). The returned-environment-plugin (applyToEnvironment) path is unreliable under Vite 8 — verified in a browser to leave the configs empty — so this is the only host API that reports both configs semantically.
  • getServerData kept as a deprecated shim. It is public in @nuxt/devtools-kit's RPC types, so rather than removing it outright it now emits NDT_DEP_0009 and returns the legacy NuxtServerData shape (vite: { server, client }) with the configs normalized for transport. The live source uses the raw objects.
  • Stays on the tested Devframe 0.7.7 / @vitejs/devtools-kit 0.4.2 baseline. (An attempt to bump to kit 0.4.3 forced Devframe 0.7.9, but the Vite DevTools UI client @vitejs/devtools has no matching release and speaks the older protocol — the resulting client/server skew broke the dock rail; both releases are also within the repo's minimum-release-age window. Reverted.)
  • Also fixes a pre-existing drift where the Nuxt dock group omitted category: 'framework' that nuxt-group.spec.ts already asserted (the new members rely on it).

Removed

Nuxt Options Viewer page, getServerData's DiscoveryJS backing (server-rpc/server-data.ts), the duplicate getServerConfig, jsonStringifyCircular, .discoveryrc.cjs, the build:discovery / dev:discovery scripts and their invocations, and the @discoveryjs/* deps + catalog entries. getServerConfig (canonical, in general.ts), Runtime Config editing, and Storage editing are unchanged.

Verification

pnpm lint, pnpm build, pnpm typecheck, and pnpm test:unit (53 passing, incl. new source-shape / unregister / preset / shim / diagnostic-once tests) pass; pnpm install --frozen-lockfile is clean. Verified end-to-end in a browser: the member mounts under groupId: nuxt / category: framework, the source picker contains only Nuxt Application (no example source), the Data Inspector SPA opens and connects, and nuxt / nitro / vite queries all resolve with live data (vite.client/vite.ssr populated). A dev e2e spec is included.

This PR was created with the help of an agent.

Replace the read-only Nuxt Options Viewer (the DiscoveryJS bundle, nested
iframe, serialization RPC, and build step) with a mounted
@devframes/plugin-data-inspector member in the Nuxt dock group, backed by a
single live `Nuxt Application` source (Nuxt, Nitro, and Vite client/SSR
configuration) with four read-only suggested queries.

Upgrade the Vite DevTools kit to 0.4.3 and align the whole Devframe family
to 0.7.9.

BREAKING CHANGE: the Nuxt Options Viewer page and the DiscoveryJS bundle,
build scripts, and dependencies are removed. The `getServerData` RPC is kept
as a deprecated compatibility shim that emits `NDT_DEP_0009`.
@socket-security

socket-security Bot commented Jul 22, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​vitejs/​devtools-kit@​0.4.2 ⏵ 0.4.378 +110071 +197 +2100
Updated@​vitejs/​devtools@​0.4.2 ⏵ 0.4.37710074 +197 +2100

View full report

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1216e598-8cb3-413d-b6d8-75f5a28013df

📥 Commits

Reviewing files that changed from the base of the PR and between f554b05 and c0f039d.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (1)
  • pnpm-workspace.yaml

📝 Walkthrough

Walkthrough

This change replaces the server discovery page with a Data Inspector integration. It captures live Nitro and Vite configuration in a nuxt:application source, mounts the inspector UI, and preserves getServerData through a deprecated compatibility shim with transport-safe Vite normalization. DevTools wiring, dependencies, diagnostics, unit tests, end-to-end coverage, and migration documentation are updated accordingly.

Estimated code review effort: 4 (Complex) | ~45 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 54.55% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the main change: replacing server discovery with the Data Inspector plugin.
Description check ✅ Passed The description is directly related to the changeset and accurately describes the Data Inspector migration.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

🔧 Checkov (3.3.8)
pnpm-workspace.yaml

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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/src/integrations/data-inspector.ts`:
- Around line 38-53: Update normalizeViteConfig to derive the sanitized
environments object from config.environments rather than config.env, ensuring
the returned payload removes the original per-environment configuration and does
not repurpose the flat runtime env map. Preserve the existing plugin
sanitization and inlineConfig handling.
🪄 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: 0ee3a9c3-3070-4681-8e71-f4ebc76d9eb6

📥 Commits

Reviewing files that changed from the base of the PR and between c081250 and aa91b13.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (16)
  • docs/content/1.guide/1.features.md
  • docs/content/2.module/3.migration-v4.md
  • packages/devtools-kit/src/_types/rpc.ts
  • packages/devtools-kit/src/diagnostics.ts
  • packages/devtools-kit/test/diagnostics.test.ts
  • packages/devtools/.discoveryrc.cjs
  • packages/devtools/client/composables/utils.ts
  • packages/devtools/client/pages/modules/server-discovery.vue
  • packages/devtools/package.json
  • packages/devtools/src/integrations/data-inspector.ts
  • packages/devtools/src/module-main.ts
  • packages/devtools/src/server-rpc/index.ts
  • packages/devtools/src/server-rpc/server-data.ts
  • packages/devtools/test/data-inspector.test.ts
  • pnpm-workspace.yaml
  • tests/e2e/specs/data-inspector.spec.ts
💤 Files with no reviewable changes (3)
  • packages/devtools/src/server-rpc/server-data.ts
  • packages/devtools/.discoveryrc.cjs
  • packages/devtools/client/pages/modules/server-discovery.vue

Comment on lines +38 to +53
function normalizeViteConfig(config: ResolvedConfig): ResolvedConfig {
return {
...config,
environments: Object.fromEntries(
Object.entries(config.env ?? {}).map(([key, _]) => {
return [key, null]
}),
),
plugins: (config.plugins ?? []).map((i) => {
const clone = { ...i }
delete clone.api
return clone
}),
inlineConfig: null,
} as any as ResolvedConfig
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

Vite ResolvedConfig env vs environments fields

💡 Result:

In the Vite ResolvedConfig interface, env and environments serve entirely different purposes related to environment variables and multi-environment architecture, respectively [1][2]. env The env field in ResolvedConfig holds the final, resolved environment variables for the current Vite process [2][3]. - It is a record (key-value pairs) of variables loaded from.env files (filtered by prefixes, typically VITE_) along with other system-level environment variables defined by Vite, such as BASE_URL and MODE [2][3][4]. - This field is populated during the config resolution process by the loadEnv utility [2][3]. environments The environments field is part of Vite's newer Environment API (introduced prominently in Vite 6) [5][1]. - It represents the configuration for multiple independent execution environments (e.g., client, ssr, or custom environments) within a single Vite project [1]. - Unlike the flat, process-level env field, environments contains a record of configured environment options, allowing each environment to have its own specific build and dev configurations (like resolve, define, and build/dev settings) [6][1]. - While the top-level UserConfig allows defining these environments, the ResolvedConfig processes them into a resolved state to manage how different parts of an application are transformed and executed [7][8]. In summary, env is about configuration of variables available to your code at runtime, while environments is about the architectural configuration of the different runtime contexts (like client vs server) in which your code runs [1][2].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== packages/devtools/src/integrations/data-inspector.ts ==\n'
sed -n '1,220p' packages/devtools/src/integrations/data-inspector.ts

printf '\n== search for environments / env handling in relevant files ==\n'
rg -n "config\.environments|config\.env|vite:configResolved|isClient|isServer|normalizeViteConfig" packages/devtools/src -S

printf '\n== package files mentioning shared configuration / Nuxt 5 / Vite 8 ==\n'
rg -n "shared configuration|Nuxt 5|Vite 8|vite:configResolved|vite:extendConfig" packages -S

Repository: nuxt/devtools

Length of output: 9103


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Check the Vite type surface in any vendored docs or lockfile references, without running repo code.
rg -n "interface ResolvedConfig|environments:|env:" . -g '!**/node_modules/**' -g '!**/.git/**' -S | head -n 80

Repository: nuxt/devtools

Length of output: 4890


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Focus on the specific file with line numbers for precise context.
nl -ba packages/devtools/src/integrations/data-inspector.ts | sed -n '30,95p'

Repository: nuxt/devtools

Length of output: 191


normalizeViteConfig should strip config.environments, not config.env.
env is Vite's flat runtime env map; environments is the per-environment config branch. As written, the spread keeps the real config.environments intact and replaces the wrong field, so the RPC payload can still carry non-serializable config and the environments key ends up with unrelated env vars.

🤖 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 38 - 53,
Update normalizeViteConfig to derive the sanitized environments object from
config.environments rather than config.env, ensuring the returned payload
removes the original per-environment configuration and does not repurpose the
flat runtime env map. Preserve the existing plugin sanitization and inlineConfig
handling.

The `@vitejs/devtools-kit@0.4.3` release pulls the Devframe family up to
0.7.9, but the Vite DevTools UI client (`@vitejs/devtools`) has no matching
release and stays at 0.4.2, whose prebuilt client speaks the older Devframe
wire protocol. The client/server version skew breaks the DevTools panel: the
dock rail crashes (`undefined.length`) and the Nuxt group + Data Inspector
fail to render and connect ("Failed to get connection meta"). Both 0.7.9 and
0.4.3 are also inside the repo's minimum-release-age window.

Return to the tested Devframe 0.7.7 / kit 0.4.2 baseline. The
`vite:configResolved` capture is retained and verified end-to-end on 0.7.7
(the Data Inspector SPA opens, connects, and shows live nuxt/nitro/vite).

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 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 `@pnpm-workspace.yaml`:
- Line 9: Update the `@devframes/plugin-data-inspector` catalog entry to use the
exact version 0.7.7 without a caret or other range prefix, preserving the
intended protocol-compatible dependency pin.
🪄 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: 501751ac-214b-4351-8d10-0f3bf0cd50fd

📥 Commits

Reviewing files that changed from the base of the PR and between aa91b13 and f554b05.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (2)
  • packages/devtools/src/integrations/data-inspector.ts
  • pnpm-workspace.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/devtools/src/integrations/data-inspector.ts

Comment thread pnpm-workspace.yaml Outdated
- '@vitejs/devtools-rolldown@0.4.0 || 0.4.1 || 0.4.2'
- '@vitejs/devtools@0.4.0 || 0.4.1 || 0.4.2'
- '@devframes/hub@0.6.1 || 0.7.5 || 0.7.7'
- '@devframes/plugin-data-inspector@0.7.7'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

test "$(pnpm --version | cut -d. -f1)" = "11"

pnpm why `@devframes/plugin-data-inspector`
rg -n 'plugin-data-inspector|0\.7\.(7|9)' pnpm-workspace.yaml pnpm-lock.yaml

Repository: nuxt/devtools

Length of output: 143


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf 'pnpm version: '
pnpm --version

printf '\nRelevant workspace lines:\n'
grep -n -A3 -B3 "`@devframes/plugin-data-inspector`" pnpm-workspace.yaml || true

printf '\nLockfile occurrences:\n'
grep -n "`@devframes/plugin-data-inspector`" pnpm-lock.yaml | head -20 || true

printf '\nCatalog entries near line 160:\n'
sed -n '150,175p' pnpm-workspace.yaml

Repository: nuxt/devtools

Length of output: 143


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf 'workspace excerpt:\n'
sed -n '1,40p' pnpm-workspace.yaml

printf '\nplugin-data-inspector references:\n'
grep -n "`@devframes/plugin-data-inspector`" pnpm-workspace.yaml pnpm-lock.yaml || true

printf '\nrelease-age exclusions around line 1-20:\n'
sed -n '1,25p' pnpm-workspace.yaml

Repository: nuxt/devtools

Length of output: 2630


Pin @devframes/plugin-data-inspector to 0.7.7
^0.7.7 can drift to later 0.7.x releases once they age in, which reintroduces the protocol incompatibility this change is avoiding. Keep the catalog entry at an exact 0.7.7 pin.

Proposed fix
-    '`@devframes/plugin-data-inspector`': ^0.7.7
+    '`@devframes/plugin-data-inspector`': 0.7.7
📝 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.

Suggested change
- '@devframes/plugin-data-inspector@0.7.7'
'`@devframes/plugin-data-inspector`': 0.7.7
🤖 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 `@pnpm-workspace.yaml` at line 9, Update the `@devframes/plugin-data-inspector`
catalog entry to use the exact version 0.7.7 without a caret or other range
prefix, preserving the intended protocol-compatible dependency pin.

@antfu
antfu merged commit 35defc3 into nuxt:main Jul 23, 2026
3 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants