Skip to content

add(hook): content:manifest#3734

Draft
hareland wants to merge 8 commits intonuxt:mainfrom
hareland:feat/manifest-hook
Draft

add(hook): content:manifest#3734
hareland wants to merge 8 commits intonuxt:mainfrom
hareland:feat/manifest-hook

Conversation

@hareland
Copy link

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Adds a hook for other modules to hook into the manifest generation, since this module only register other layers automatically.

This allows modules to hook into the generation process and add/modify it.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@vercel
Copy link

vercel bot commented Feb 26, 2026

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

A member of the Team first needs to authorize it.

@coderabbitai
Copy link

coderabbitai bot commented Feb 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d236e62 and 763d5ca.

📒 Files selected for processing (2)
  • docs/content/docs/8.advanced/5.hooks.md
  • src/module.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/module.ts
  • docs/content/docs/8.advanced/5.hooks.md

📝 Walkthrough

Walkthrough

Adds a new content:manifest Nuxt hook that is called with the generated Manifest after content config is loaded (nuxt.callHook('content:manifest', manifest)). Extends Nuxt hook types with 'content:manifest': (manifest: Manifest) => Promise<void> | void. Adds a unit test verifying hook handlers can mutate manifest.collections by reference. Adds documentation for the hook and re-exports resolveCollection from src/utils/index.ts.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding a new 'content:manifest' hook to allow modules to hook into the manifest generation process.
Description check ✅ Passed The description is directly related to the changeset, explaining the purpose and benefit of adding the content:manifest hook for allowing other modules to hook into manifest generation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 26, 2026

npm i https://pkg.pr.new/@nuxt/content@3734

commit: 763d5ca

Copy link

@coderabbitai coderabbitai bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@docs/content/docs/8.advanced/5.hooks.md`:
- Around line 46-49: The docs example incorrectly shows pushing
defineCollection() into manifest.collections; manifest.collections expects
ResolvedCollection, not the un-resolved collection builder. Update the snippet
around the 'content:manifest' hook to push a ResolvedCollection (for example the
object returned by resolveCollection or the result of calling the resolver you
use) or make the example generic (e.g., show pushing a variable typed as
ResolvedCollection) so that manifest.collections receives the correct
ResolvedCollection shape; reference the manifest.collections property and the
defineCollection() usage to locate and correct the example.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f406942 and 71c808f.

📒 Files selected for processing (3)
  • docs/content/docs/8.advanced/5.hooks.md
  • src/types/hooks.ts
  • test/unit/hooks.test.ts

Copy link

@coderabbitai coderabbitai bot left a comment

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 the current code and only fix it if needed.

Inline comments:
In `@src/module.ts`:
- Line 123: The call to nuxt.callHook('content:manifest', manifest) is not
awaited, so async hook handlers (which can return Promise<void>) may not
complete before subsequent code runs; update the call site in module.ts to await
the hook invocation (i.e., use await nuxt.callHook('content:manifest',
manifest)) and ensure the surrounding function is marked async if needed so
manifest mutations from registered handlers complete before proceeding.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 71c808f and 633b11f.

📒 Files selected for processing (2)
  • src/module.ts
  • test/unit/hooks.test.ts

@hareland hareland marked this pull request as draft February 26, 2026 02:41
@hareland
Copy link
Author

hareland commented Feb 26, 2026

Would be nice to have a util like in nuxt @nuxt/kit#extendPages as extendCollections or similar.

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.

1 participant