[PR #573] [CLOSED] refactor: remove dead code identified by static analysis #680

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

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/573
Author: @Divkix
Created: 3/17/2026
Status: Closed

Base: mainHead: refactor/remove-dead-code


📝 Commits (2)

  • 7766216 refactor: remove dead code identified by static analysis
  • d8fc66d test: update snapshots to reflect removed dead code

📊 Changes

7 files changed (+5 additions, -142 deletions)

View changed files

📝 packages/vinext/src/cloudflare/index.ts (+1 -1)
📝 packages/vinext/src/entries/app-ssr-entry.ts (+0 -20)
📝 packages/vinext/src/entries/pages-server-entry.ts (+0 -47)
📝 packages/vinext/src/routing/file-matcher.ts (+2 -2)
📝 packages/vinext/src/routing/utils.ts (+2 -2)
📝 packages/vinext/src/shims/internal/utils.ts (+0 -3)
📝 tests/__snapshots__/entry-templates.test.ts.snap (+0 -67)

📄 Description

This PR removes dead code identified through comprehensive static analysis across the codebase.

Dead Code Removed

1. cloudflare/index.ts

  • Removed unused type exports TPROptions and TPRResult (never imported from public API)

2. entries/app-ssr-entry.ts

  • Removed unused collectStreamChunks function (defined but never called)

3. entries/pages-server-entry.ts

  • Removed 3 unused i18n helper functions:
    • extractLocale - duplicate of functionality in pages-i18n.ts
    • detectLocaleFromHeaders - never called
    • parseCookieLocaleFromHeader - never called

4. routing/file-matcher.ts

  • Removed export from DEFAULT_PAGE_EXTENSIONS (internal constant)
  • Removed export from buildExtensionGlob (internal function)

5. routing/utils.ts

  • Removed export from routePrecedence (only used internally by compareRoutes)
  • Removed export from decodeRouteSegmentStrict (only used internally)

6. shims/internal/utils.ts

  • Removed unused constants SP and ST (defined but never referenced)

Methodology

The dead code was identified by:

  1. Searching for exported functions/constants/types that have no imports across the codebase
  2. Identifying private functions that are defined but never called within their files
  3. Cross-referencing each export against test files, entry points, and other source files

Impact

  • 75 lines of dead code removed
  • No functional changes - all removed code was genuinely unused
  • Reduces bundle size and maintenance surface area

🔄 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/573 **Author:** [@Divkix](https://github.com/Divkix) **Created:** 3/17/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `refactor/remove-dead-code` --- ### 📝 Commits (2) - [`7766216`](https://github.com/cloudflare/vinext/commit/77662166c954b96c077b37c8df2832c02e2d2b33) refactor: remove dead code identified by static analysis - [`d8fc66d`](https://github.com/cloudflare/vinext/commit/d8fc66d143a14636a8ae5c69b58b9ef64cbd5347) test: update snapshots to reflect removed dead code ### 📊 Changes **7 files changed** (+5 additions, -142 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/cloudflare/index.ts` (+1 -1) 📝 `packages/vinext/src/entries/app-ssr-entry.ts` (+0 -20) 📝 `packages/vinext/src/entries/pages-server-entry.ts` (+0 -47) 📝 `packages/vinext/src/routing/file-matcher.ts` (+2 -2) 📝 `packages/vinext/src/routing/utils.ts` (+2 -2) 📝 `packages/vinext/src/shims/internal/utils.ts` (+0 -3) 📝 `tests/__snapshots__/entry-templates.test.ts.snap` (+0 -67) </details> ### 📄 Description This PR removes dead code identified through comprehensive static analysis across the codebase. ## Dead Code Removed ### 1. cloudflare/index.ts - Removed unused type exports TPROptions and TPRResult (never imported from public API) ### 2. entries/app-ssr-entry.ts - Removed unused collectStreamChunks function (defined but never called) ### 3. entries/pages-server-entry.ts - Removed 3 unused i18n helper functions: - extractLocale - duplicate of functionality in pages-i18n.ts - detectLocaleFromHeaders - never called - parseCookieLocaleFromHeader - never called ### 4. routing/file-matcher.ts - Removed export from DEFAULT_PAGE_EXTENSIONS (internal constant) - Removed export from buildExtensionGlob (internal function) ### 5. routing/utils.ts - Removed export from routePrecedence (only used internally by compareRoutes) - Removed export from decodeRouteSegmentStrict (only used internally) ### 6. shims/internal/utils.ts - Removed unused constants SP and ST (defined but never referenced) ## Methodology The dead code was identified by: 1. Searching for exported functions/constants/types that have no imports across the codebase 2. Identifying private functions that are defined but never called within their files 3. Cross-referencing each export against test files, entry points, and other source files ## Impact - 75 lines of dead code removed - No functional changes - all removed code was genuinely unused - Reduces bundle size and maintenance surface area --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:09:30 +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#680
No description provided.