[PR #1076] [MERGED] refactor(routing): dedupe findFileWithExtensions helper #1073

Closed
opened 2026-05-06 13:11:50 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/1076
Author: @james-elicx
Created: 5/5/2026
Status: Merged
Merged: 5/5/2026
Merged by: @james-elicx

Base: mainHead: refactor/dedupe-find-file-with-extensions


📝 Commits (2)

  • db6277c refactor(routing): dedupe findFileWithExtensions helper
  • 4830e17 fix(build): drop stale ValidFileMatcher type import

📊 Changes

3 files changed (+12 additions, -12 deletions)

View changed files

📝 packages/vinext/src/build/prerender.ts (+1 -5)
📝 packages/vinext/src/routing/file-matcher.ts (+6 -0)
📝 packages/vinext/src/server/dev-server.ts (+5 -7)

📄 Description

Summary

  • Extract the matcher.dottedExtensions.some((ext) => existsSync(basePath + ext)) one-liner into a single shared helper in routing/file-matcher.ts.
  • Replace the two identical local copies in build/prerender.ts and server/dev-server.ts with the shared export.
  • Pure refactor: same return type, same semantics. Follow-up to #1058.

Files changed

  • packages/vinext/src/routing/file-matcher.ts — add findFileWithExtensions export (+ existsSync import).
  • packages/vinext/src/build/prerender.ts — drop local helper, import shared one.
  • packages/vinext/src/server/dev-server.ts — drop local helper, import shared one. Removed now-unused import fs from "node:fs".

Test plan

  • pnpm vp test run tests/app-router.test.ts tests/pages-router.test.ts (508 tests pass)
  • pnpm fmt --write on touched files
  • pnpm knip (clean)

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/1076 **Author:** [@james-elicx](https://github.com/james-elicx) **Created:** 5/5/2026 **Status:** ✅ Merged **Merged:** 5/5/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `refactor/dedupe-find-file-with-extensions` --- ### 📝 Commits (2) - [`db6277c`](https://github.com/cloudflare/vinext/commit/db6277c93e2b12aa565f7febb43d0e3405bc8a4b) refactor(routing): dedupe findFileWithExtensions helper - [`4830e17`](https://github.com/cloudflare/vinext/commit/4830e179bc568aec9f251fd12232b794976b7523) fix(build): drop stale ValidFileMatcher type import ### 📊 Changes **3 files changed** (+12 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/build/prerender.ts` (+1 -5) 📝 `packages/vinext/src/routing/file-matcher.ts` (+6 -0) 📝 `packages/vinext/src/server/dev-server.ts` (+5 -7) </details> ### 📄 Description ## Summary - Extract the `matcher.dottedExtensions.some((ext) => existsSync(basePath + ext))` one-liner into a single shared helper in `routing/file-matcher.ts`. - Replace the two identical local copies in `build/prerender.ts` and `server/dev-server.ts` with the shared export. - Pure refactor: same return type, same semantics. Follow-up to #1058. ## Files changed - `packages/vinext/src/routing/file-matcher.ts` — add `findFileWithExtensions` export (+ `existsSync` import). - `packages/vinext/src/build/prerender.ts` — drop local helper, import shared one. - `packages/vinext/src/server/dev-server.ts` — drop local helper, import shared one. Removed now-unused `import fs from "node:fs"`. ## Test plan - [x] `pnpm vp test run tests/app-router.test.ts tests/pages-router.test.ts` (508 tests pass) - [x] `pnpm fmt --write` on touched files - [x] `pnpm knip` (clean) 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:11:50 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#1073
No description provided.