Skip to content

feat(schema): add augmentable NuxtPageMeta interface for NuxtPage.meta#34816

Open
Flo0806 wants to merge 4 commits intonuxt:mainfrom
Flo0806:feat/meta-augmentation
Open

feat(schema): add augmentable NuxtPageMeta interface for NuxtPage.meta#34816
Flo0806 wants to merge 4 commits intonuxt:mainfrom
Flo0806:feat/meta-augmentation

Conversation

@Flo0806
Copy link
Copy Markdown
Member

@Flo0806 Flo0806 commented Apr 15, 2026

🔗 Linked issue

Resolves: #34795

📚 Description

Introduce a NuxtPageMeta interface that replaces the hardcoded Record<string, any> on NuxtPage.meta.

This allows module authors to augment the meta type. Example:

declare module '@nuxt/schema' {
  interface NuxtPageMeta {
    requiresAuth?: boolean
  }
}

@Flo0806 Flo0806 requested a review from danielroe as a code owner April 15, 2026 12:53
@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Apr 15, 2026

Open in StackBlitz

@nuxt/kit

npm i https://pkg.pr.new/@nuxt/kit@34816

@nuxt/nitro-server

npm i https://pkg.pr.new/@nuxt/nitro-server@34816

nuxt

npm i https://pkg.pr.new/nuxt@34816

@nuxt/rspack-builder

npm i https://pkg.pr.new/@nuxt/rspack-builder@34816

@nuxt/schema

npm i https://pkg.pr.new/@nuxt/schema@34816

@nuxt/vite-builder

npm i https://pkg.pr.new/@nuxt/vite-builder@34816

@nuxt/webpack-builder

npm i https://pkg.pr.new/@nuxt/webpack-builder@34816

commit: 8940425

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 15, 2026

Walkthrough

A new NuxtPageMeta interface type was introduced in the schema package and exported alongside existing types. The NuxtPage type was updated to use NuxtPageMeta for its meta property instead of the generic Record<string, any>. Documentation was updated to reflect this typing change and demonstrate how to augment NuxtPageMeta via TypeScript module augmentation for custom properties. The normalizeRoutes function was updated to explicitly type the dynamic metadata key with a TypeScript cast.

🚥 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 accurately summarizes the main change: introducing an augmentable NuxtPageMeta interface for the NuxtPage.meta field, which is the core objective of this pull request.
Description check ✅ Passed The pull request description accurately describes the changeset: introducing a NuxtPageMeta interface to replace Record<string, any> on NuxtPage.meta, with a clear example of module augmentation.

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

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

Copy link
Copy Markdown
Contributor

@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/4.api/5.kit/7.pages.md`:
- Line 54: Update the table description for the `meta` entry so the sentence is
complete: change the fragment "Can be used in layouts, middlewares, or
navigation guards." to "It can be used in layouts, middlewares, or navigation
guards." in the row that lists `meta` with type `NuxtPageMeta`.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: d0fb1c67-f918-4e4d-ae76-533a7df76818

📥 Commits

Reviewing files that changed from the base of the PR and between 95e6b9f and 8940425.

📒 Files selected for processing (4)
  • docs/4.api/5.kit/7.pages.md
  • packages/nuxt/src/pages/utils.ts
  • packages/schema/src/index.ts
  • packages/schema/src/types/hooks.ts

| `path` | `string` | `false` | The route URL path. If not set, Nuxt will infer it from the file location. |
| `file` | `string` | `false` | Path to the Vue file that should be used as the component for the route. |
| `meta` | `Record<string, any>`{lang="ts"} | `false` | Custom metadata for the route. Can be used in layouts, middlewares, or navigation guards. |
| `meta` | `NuxtPageMeta`{lang="ts"} | `false` | Custom metadata for the route. Can be used in layouts, middlewares, or navigation guards. |
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.

⚠️ Potential issue | 🟡 Minor

Minor wording fix for sentence completeness.

Please change “Can be used …” to “It can be used …” for a complete sentence in the table description.

✏️ Suggested edit
-| `meta`     | `NuxtPageMeta`{lang="ts"}          | `false`  | Custom metadata for the route. Can be used in layouts, middlewares, or navigation guards.    |
+| `meta`     | `NuxtPageMeta`{lang="ts"}          | `false`  | Custom metadata for the route. It can be used in layouts, middlewares, or navigation guards. |
📝 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
| `meta` | `NuxtPageMeta`{lang="ts"} | `false` | Custom metadata for the route. Can be used in layouts, middlewares, or navigation guards. |
| `meta` | `NuxtPageMeta`{lang="ts"} | `false` | Custom metadata for the route. It can be used in layouts, middlewares, or navigation guards. |
🧰 Tools
🪛 LanguageTool

[style] ~54-~54: To form a complete sentence, be sure to include a subject.
Context: ...alse` | Custom metadata for the route. Can be used in layouts, middlewares, or nav...

(MISSING_IT_THERE)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/4.api/5.kit/7.pages.md` at line 54, Update the table description for the
`meta` entry so the sentence is complete: change the fragment "Can be used in
layouts, middlewares, or navigation guards." to "It can be used in layouts,
middlewares, or navigation guards." in the row that lists `meta` with type
`NuxtPageMeta`.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Apr 15, 2026

Merging this PR will not alter performance

✅ 20 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing Flo0806:feat/meta-augmentation (8940425) with main (95e6b9f)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce a separate type for meta property of NuxtPage

1 participant