feat(middleware): add page-level feature flag protection via definePageMeta#77
Merged
Conversation
Signed-off-by: Nico Kempe <git@nicokempe.de>
…ration Signed-off-by: Nico Kempe <git@nicokempe.de>
…gh definePageMeta Signed-off-by: Nico Kempe <git@nicokempe.de>
Signed-off-by: Nico Kempe <git@nicokempe.de>
Signed-off-by: Nico Kempe <git@nicokempe.de>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
✅ PR Checklist
Please ensure the following before submitting your PR:
🔗 Linked Issue
No issue created.
📖 Description
This PR introduces page-level feature flag protection via Nuxt middleware, enabling developers to guard entire pages with
definePageMeta.Key changes:
Added global route middleware (
src/runtime/middleware/featureFlag.ts) that restricts access to routes based on feature flags.featureFlagfor required featurefeatureFallbackfor redirects when disabledfeatureNotifyOnBlockfor logging blocked accessUpdated
README.mdwith usage examples fordefinePageMetato demonstrate page-level protection.PageMetainterface (types/feature-flags.d.ts) to extend Nuxt schema withfeatureFlag,featureFallback, andfeatureNotifyOnBlock.Added unit tests (
test/unit/featureFlagMiddleware.test.ts) covering:playground/pages/new-protected.vue) showing feature-flag-based route protection in action.This feature makes it easier to manage feature-gated access at the routing level, ensuring consistent user access control across the app.
🚨 Breaking Changes
🧪 Type of Change
🧩 Additional Context
Thank you for contributing! 💚