mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #1084] [MERGED] refactor(utils): dedupe trailing-slash and basePath normalization #1082
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#1082
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/1084
Author: @james-elicx
Created: 5/5/2026
Status: ✅ Merged
Merged: 5/5/2026
Merged by: @james-elicx
Base:
main← Head:refactor/dedupe-trailing-slash-basepath📝 Commits (3)
e21f24brefactor(utils): dedupe trailing-slash and basePath normalizatione3e722dfix(utils): use char-code loop in removeTrailingSlash6f9ea75ci: retrigger workflows📊 Changes
8 files changed (+27 additions, -15 deletions)
View changed files
📝
packages/vinext/src/index.ts(+2 -2)📝
packages/vinext/src/routing/route-validation.ts(+3 -3)📝
packages/vinext/src/server/app-page-execution.ts(+2 -1)📝
packages/vinext/src/server/middleware-matcher.ts(+2 -1)📝
packages/vinext/src/server/prod-server.ts(+2 -2)📝
packages/vinext/src/server/request-pipeline.ts(+2 -2)📝
packages/vinext/src/shims/server.ts(+2 -4)📝
packages/vinext/src/utils/base-path.ts(+12 -0)📄 Description
Summary
removeTrailingSlashhelper topackages/vinext/src/utils/base-path.tsthat strips trailing slashes while preserving the root/(and collapsing repeated slashes like/a//to/a).pathname.replace(/\/+$/, \"\")sites that match this normalization (index.ts,server/prod-server.ts,server/request-pipeline.ts,server/middleware-matcher.ts,routing/route-validation.ts) to call the helper.server/app-page-execution.tsapplyAppPageRedirectBasePath,shims/server.ts_stripBasePath) to the existinghasBasePath/stripBasePathhelpers.cloudflare/tpr.ts(operates on a host string, not a pathname),utils/manifest-paths.ts(intentionally trims to empty for the/base case), and the inlined helpers inside thedeploy.tsworker code template (intentionally inlined because that code runs in Cloudflare Workers and cannot import from local source at build time).Pure refactor; no behaviour change. Follow-up to #1058.
Test plan
pnpm vp test run tests/app-router.test.ts tests/pages-router.test.ts(508 tests passed; one unrelatedafterAllhook timeout in pages-router allowedDevOrigins suite)pnpm vp test run tests/request-pipeline.test.ts tests/shims.test.ts tests/next-config.test.ts(992 tests passed)pnpm vp test run tests/route-trie.test.ts tests/route-sorting.test.ts tests/app-route-graph.test.ts tests/app-page-execution.test.ts(145 tests passed)pnpm fmt --writepnpm knip(clean)Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.