feat(schema): add augmentable `NuxtPageMeta` interface for `NuxtPage.meta` by Flo0806 · Pull Request #34816 · nuxt/nuxt · GitHub
Skip to content

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

Merged
danielroe merged 6 commits into
nuxt:mainfrom
Flo0806:feat/meta-augmentation
Jul 19, 2026
Merged

danielroe merged 6 commits into
nuxt:mainfrom
Flo0806:feat/meta-augmentation

Conversation

@Flo0806

@Flo0806 Flo0806 commented Apr 15, 2026 •

Copy link
Copy Markdown
Member

🔗 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

@github-actions github-actions Bot added 5.x ✨ enhancement New feature or improvement to existing functionality labels Apr 15, 2026
@pkg-pr-new

pkg-pr-new Bot commented Apr 15, 2026 •

Copy link
Copy Markdown

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: 1fb7191

@coderabbitai

coderabbitai Bot commented Apr 15, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b7181670-5a8a-47be-84ab-d7084ccde49b

📥 Commits

Reviewing files that changed from the base of the PR and between c0a0e69 and 1fb7191.

📒 Files selected for processing (1)
  • packages/nitro-server/src/runtime/diagnostics.ts

Walkthrough

A new NuxtPageMeta interface was added and exported from the schema package. NuxtPage.meta now uses NuxtPageMeta instead of Record<string, any>. Route normalisation explicitly types dynamic metadata as Set<string> | undefined. Documentation reflects the new type and demonstrates module augmentation for custom metadata properties.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning A whitespace-only comment change in nitro-server appears unrelated to the NuxtPageMeta objective. Remove the incidental nitro-server whitespace change or bundle it into a separate cleanup PR.
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 (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: introducing an augmentable NuxtPageMeta type for NuxtPage.meta.
Description check ✅ Passed The description is directly related and correctly explains the new augmentable NuxtPageMeta interface.
Linked Issues check ✅ Passed The changes satisfy #34795 by separating NuxtPage.meta into an augmentable NuxtPageMeta type and documenting augmentation.
✨ 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

🤖 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

codspeed Bot commented Apr 15, 2026 •

Copy link
Copy Markdown

@danielroe
danielroe added this pull request to the merge queue Jul 19, 2026
Merged via the queue into nuxt:main with commit 1dfe8e5 Jul 19, 2026
30 of 31 checks passed
@Flo0806
Flo0806 deleted the feat/meta-augmentation branch July 19, 2026 17:34
@github-actions github-actions Bot mentioned this pull request Jul 19, 2026
2 of 5 tasks
danielroe added a commit that referenced this pull request Aug 12, 2026
…meta` (#34816)

Co-authored-by: Daniel Roe <daniel@roe.dev>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This was referenced Aug 12, 2026
@github-actions github-actions Bot mentioned this pull request Aug 28, 2026
@github-actions github-actions Bot mentioned this pull request Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5.x ✨ enhancement New feature or improvement to existing functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce a separate type for meta property of NuxtPage

2 participants