mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #516] [MERGED] fix: add basePath and locale properties to NextURL #638
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#638
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/516
Author: @NathanDrake2406
Created: 3/13/2026
Status: ✅ Merged
Merged: 3/18/2026
Merged by: @james-elicx
Base:
main← Head:fix/nexturl-basepath-locale📝 Commits (6)
79a24b0fix: add basePath and locale properties to NextURL93e8084fix: address review feedback on NextURL81e258dfix: address second round of review feedback46ec93ffix: address third round of review feedback on NextURLa365cf8fix: locale setter resets to defaultLocale on falsy value when i18n configured57b8534Update packages/vinext/src/shims/server.ts📊 Changes
7 files changed (+467 additions, -14 deletions)
View changed files
📝
packages/vinext/src/entries/app-rsc-entry.ts(+2 -1)📝
packages/vinext/src/entries/pages-server-entry.ts(+2 -1)📝
packages/vinext/src/index.ts(+1 -0)📝
packages/vinext/src/server/middleware.ts(+9 -1)📝
packages/vinext/src/shims/server.ts(+132 -8)📝
tests/__snapshots__/entry-templates.test.ts.snap(+4 -2)📝
tests/shims.test.ts(+317 -1)📄 Description
Summary
NextURLwas missingbasePath,locale,defaultLocale, andlocalesproperties that Next.js documents and real middleware depends onhref/toString()reconstruct the full URL with locale + basePath prefixes — matching Next.jsformatPathname()semanticsNextRequest→NextURLin all three middleware construction paths (dev runner, App Router RSC entry codegen, Pages Router prod entry codegen)localesetter validates against configured locales (throwsTypeErroron invalid, matching Next.js)localesgetter returns a defensive copy to prevent internal mutationclone()passes config through the constructor for proper re-analysisTest plan
href/toString()reconstruction, locale setter validation, clone preservation, and NextRequest integrationtsgo --noEmit)oxlint)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.