Skip to content

feat(modules): show Nuxt version compatibility on modules page#2331

Open
Ibochkarev wants to merge 3 commits into
nuxt:mainfrom
Ibochkarev:feat/issue-2053-modules-nuxt-version
Open

feat(modules): show Nuxt version compatibility on modules page#2331
Ibochkarev wants to merge 3 commits into
nuxt:mainfrom
Ibochkarev:feat/issue-2053-modules-nuxt-version

Conversation

@Ibochkarev

@Ibochkarev Ibochkarev commented Jul 20, 2026

Copy link
Copy Markdown

Summary

Adds Nuxt 3/4 compatibility badges and a version filter on /modules, using the existing compatibility.nuxt metadata from @nuxt/modules (as suggested in the issue thread).

  • Badges on module cards and detail pages via shared semver helpers
  • Filter: Nuxt 3 (default) | Nuxt 4 | All — forwarded to /api/v1/modules?version=
  • API accepts version=4
  • Detail alert no longer uses brittle .includes('^3') checks
image image image

Fixes #2053

Test plan

  • Open /modules — default list matches Nuxt 3–compatible modules; cards show Nuxt 3/4 badges
  • Switch filter to Nuxt 4 — URL has version=4; Nuxt 4–only modules appear
  • Switch to All — broader list including other majors returned by the API
  • Open a Nuxt 2–only module detail page — legacy alert still shows
  • Open a module with ^3.x || ^4.x — both badges; no false legacy alert
  • pnpm exec vitest run --config / unit project: test/unit/modules-compatibility.spec.ts passes

@vercel

vercel Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

@Ibochkarev is attempting to deploy a commit to the Nuxt Team on Vercel.

A member of the Team first needs to authorize it.

@Ibochkarev
Ibochkarev force-pushed the feat/issue-2053-modules-nuxt-version branch from 9985291 to 9c993ae Compare July 20, 2026 09:23
@Ibochkarev
Ibochkarev marked this pull request as ready for review July 20, 2026 10:15
@Ibochkarev
Ibochkarev requested a review from atinux as a code owner July 20, 2026 10:15
@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The change adds shared Nuxt compatibility and module-query utilities, then applies them to API, composable, and MCP module filtering. Module cards, detail pages, generated Markdown, and MCP responses now expose Nuxt 3/4 compatibility badges. The modules page adds version filters for desktop and mobile views and displays filtered counts. Unit and browser tests cover compatibility detection, query normalization, cache keys, and version filtering.

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

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR implements the requested Nuxt 3/4 tags and filtering for modules, including API support and legacy alert updates.
Out of Scope Changes check ✅ Passed The changes all support the Nuxt compatibility and filtering feature, with tests and shared utilities remaining in scope.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%.
Title check ✅ Passed The title clearly summarizes the main change: showing Nuxt version compatibility on the modules page.
Description check ✅ Passed The description is clearly related to the changeset and matches the added badges, filters, API support, and legacy alert updates.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

🧹 Nitpick comments (2)
test/unit/modules-compatibility.spec.ts (1)

4-13: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Avoid making live network requests in unit tests.

Fetching live data from an external CDN makes the unit test suite rely on network access, which can lead to flaky tests, increased test duration, and failures in offline or restricted CI environments.

Consider using a local JSON fixture or mocking the fetch call to ensure deterministic and fast test execution.

🤖 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 `@test/unit/modules-compatibility.spec.ts` around lines 4 - 13, Replace the
live CDN fetch in the “moduleSupportsNuxt against CDN registry” test with
deterministic local data, using a fixture or mocked fetch response that
represents the required module compatibility cases. Preserve the assertions
validating module count and Nuxt 4 compatibility while ensuring the test
performs no external network requests.
app/pages/modules/index.vue (1)

155-155: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Remove the static + if displaying dynamic filtered counts.

Since the count now reflects filteredModules.length rather than the total modules.length, retaining the static + sign may result in awkward wording when filtering or searching yields small or exact numbers (e.g., "Build faster with 1+ Nuxt Modules").

Consider removing the + when displaying exact filtered results, or use modules.length if the intent is to show the total catalog size.

♻️ Proposed fix
-        Build faster with <span class="text-primary">{{ filteredModules.length }}+</span> Nuxt Modules
+        Build faster with <span class="text-primary">{{ filteredModules.length }}</span> Nuxt Modules
🤖 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 `@app/pages/modules/index.vue` at line 155, Update the module count text in the
page template to remove the static “+” when displaying filteredModules.length,
so the label presents the exact filtered result. Keep the existing
filteredModules count and surrounding wording 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.

Inline comments:
In `@server/api/v1/modules/index.get.ts`:
- Around line 4-5: Update the query parsing in the cached event handler around
normalizeModulesQuery so Zod validation failures are converted into a 400 Bad
Request instead of propagating as unhandled 500 errors. Reuse getValidatedQuery
if it provides the established validation handling, or use safeParse and
explicitly return the corresponding 400 response while preserving the existing
version and category extraction.

---

Nitpick comments:
In `@app/pages/modules/index.vue`:
- Line 155: Update the module count text in the page template to remove the
static “+” when displaying filteredModules.length, so the label presents the
exact filtered result. Keep the existing filteredModules count and surrounding
wording unchanged.

In `@test/unit/modules-compatibility.spec.ts`:
- Around line 4-13: Replace the live CDN fetch in the “moduleSupportsNuxt
against CDN registry” test with deterministic local data, using a fixture or
mocked fetch response that represents the required module compatibility cases.
Preserve the assertions validating module count and Nuxt 4 compatibility while
ensuring the test performs no external network requests.
🪄 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: 46feec60-9357-42ea-958e-954e0f3fd305

📥 Commits

Reviewing files that changed from the base of the PR and between 8ff099f and 9c993ae.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (15)
  • app/components/module/ModuleItem.vue
  • app/composables/useModules.ts
  • app/pages/modules/[slug].vue
  • app/pages/modules/index.vue
  • content/modules.yml
  • package.json
  • server/api/v1/modules/index.get.ts
  • server/mcp/tools/modules/get-module.ts
  • server/mcp/tools/modules/list-modules.ts
  • server/routes/raw/modules.md.get.ts
  • shared/utils/modules-query.ts
  • shared/utils/modules.ts
  • test/browser/modules.spec.ts
  • test/unit/modules-compatibility.spec.ts
  • test/unit/modules-query.spec.ts

Comment thread server/api/v1/modules/index.get.ts Outdated
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.

Include Nuxt version support in Modules Documentation

1 participant