mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #557] [MERGED] fix: preserve named has captures in config destinations #673
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#673
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/557
Author: @NathanDrake2406
Created: 3/16/2026
Status: ✅ Merged
Merged: 3/16/2026
Merged by: @james-elicx
Base:
main← Head:fix/has-missing-capture-destinations📝 Commits (2)
47657c6fix: preserve named has captures in config destinationse668444fix: align locale-static has capture precedence📊 Changes
2 files changed (+155 additions, -53 deletions)
View changed files
📝
packages/vinext/src/config/config-matchers.ts(+90 -53)📝
tests/shims.test.ts(+65 -0)📄 Description
Summary
This preserves named capture groups from
hasconditions when vinext builds redirect and rewrite destinations.Before this change, a rule could match successfully but still leave placeholders like
:authorizedunresolved in the destination. That diverged from documented Next.js behavior for config redirects and rewrites.What Changed
config-matchers.tsso satisfiedhasconditions can return captured params instead of only a booleancheckHasConditions()as the boolean wrapper for existing callershascaptures into the destination param bag for redirects and rewrites, matching Next.js's route-param-then-has-param merge order(?<authorized>yes|true)is reused in redirect and rewrite destinationsWhy It Matters
Redirects and rewrites that depend on captured header, cookie, query, or host values now produce the right destination instead of silently shipping unresolved placeholders.
Risks Or Limits
missingconditions still act only as gates and do not contribute paramshascapture name collides with a path param, thehascapture wins, which matches Next.js's current merge orderVerification
vp test run tests/shims.test.tsvp run typecheck🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.