GitClassic
Feed
Explore
Random
Go Pro
Sign in
cloudflare
/
vinext
Code
/
Commits
/ aff5d24
fix(routing): allow hyphens in dynamic segment param names (#78)
* fix(routing): allow hyphens in dynamic segment param names Catch-all and dynamic route params with hyphens (e.g. [[...sign-in]], [auth-method]) caused 404 because the regex used \w+ which doesn't match hyphens. Next.js allows hyphens in param directory names — this is commonly used by Clerk ([[...sign-in]], [[...sign-up]]). Changed all \w+ patterns to [\w-]+ across: - app-router.ts (fileToAppRoute, discoverSlotSubRoutes, computeInterceptTarget) - pages-router.ts (fileToRoute, patternToNextFormat) - app-dev-server.ts (middleware matcher regex, config pattern matching) - middleware.ts (pattern matching) Closes #71 * fix(routing): allow hyphens in config matching and middleware-codegen param patterns Addresses review feedback on PR #78: the same \w+ bug that was fixed in routing/middleware also existed in the config pattern matching functions (redirects, rewrites, headers) and the middleware-codegen tokenizer. Updated all remaining param-related regex patterns to [\w-]+ across: - index.ts: matchConfigPattern guard, tokenizer, catchAllMatch, applyHeaders - config-matchers.ts: matchConfigPattern guard, tokenizer, catchAllMatch, escapeHeaderSource tokenizer - app-dev-server.ts: __matchConfigPattern template (4 .replace() chains, catchAllMatch, __applyConfigHeaders) - middleware-codegen.ts: generated matchMiddlewarePattern tokenizer Subsumes PR #127 which fixed middleware-codegen.ts independently. Co-authored-by: SeolJaeHyeok <milkboy2564@naver.com> --------- Co-authored-by: ask-bonk[bot] <ask-bonk[bot]@users.noreply.github.com> Co-authored-by: Fred K. Schott <622227+FredKSchott@users.noreply.github.com> Co-authored-by: SeolJaeHyeok <milkboy2564@naver.com>
ask-bonk[bot]
committed on Feb 27, 2026, 06:15 AM
Showing
14
changed files
+260 additions
-39 deletions
M
packages/vinext/src/config/config-matchers.ts
+9
-6
M
packages/vinext/src/index.ts
+5
-3
M
packages/vinext/src/routing/app-router.ts
+12
-12
M
packages/vinext/src/routing/pages-router.ts
+9
-9
M
packages/vinext/src/server/app-dev-server.ts
+7
-7
M
packages/vinext/src/server/middleware-codegen.ts
+1
-1
M
packages/vinext/src/server/middleware.ts
+2
-1
M
tests/app-router.test.ts
+33
A
tests/fixtures/app-basic/app/auth/[auth-method]/page.tsx
+13
A
tests/fixtures/app-basic/app/sign-in/[[...sign-in]]/page.tsx
+15
A
tests/fixtures/pages-basic/pages/sign-up/[[...sign-up]]/index.tsx
+21
M
tests/pages-router.test.ts
+22
M
tests/route-sorting.test.ts
+12
M
tests/routing.test.ts
+99
Browse files at this commit →