cloudflare / vinext

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] ask-bonk[bot] committed on Feb 27, 2026, 06:15 AM
Showing 14 changed files +260 additions -39 deletions
Browse files at this commit →