From 77662166c954b96c077b37c8df2832c02e2d2b33 Mon Sep 17 00:00:00 2001 From: Divanshu Chauhan Date: Mon, 16 Mar 2026 18:46:34 -0700 Subject: [PATCH 1/2] refactor: remove dead code identified by static analysis Remove unused exports and private functions that were never called: - cloudflare/index.ts: Remove unused type exports TPROptions, TPRResult - app-ssr-entry.ts: Remove unused collectStreamChunks function - pages-server-entry.ts: Remove unused i18n helpers (extractLocale, detectLocaleFromHeaders, parseCookieLocaleFromHeader) - routing/file-matcher.ts: Remove export from internal-only DEFAULT_PAGE_EXTENSIONS and buildExtensionGlob - routing/utils.ts: Remove export from internal-only routePrecedence and decodeRouteSegmentStrict - shims/internal/utils.ts: Remove unused SP and ST constants These were identified as dead code through cross-referencing exports against imports across the entire codebase. --- packages/vinext/src/cloudflare/index.ts | 2 +- packages/vinext/src/entries/app-ssr-entry.ts | 20 -------- .../vinext/src/entries/pages-server-entry.ts | 47 ------------------- packages/vinext/src/routing/file-matcher.ts | 4 +- packages/vinext/src/routing/utils.ts | 4 +- packages/vinext/src/shims/internal/utils.ts | 3 -- 6 files changed, 5 insertions(+), 75 deletions(-) diff --git a/packages/vinext/src/cloudflare/index.ts b/packages/vinext/src/cloudflare/index.ts index 175d6d1ff..a17d116ae 100644 --- a/packages/vinext/src/cloudflare/index.ts +++ b/packages/vinext/src/cloudflare/index.ts @@ -5,4 +5,4 @@ */ export { KVCacheHandler } from "./kv-cache-handler.js"; -export { runTPR, type TPROptions, type TPRResult } from "./tpr.js"; +export { runTPR } from "./tpr.js"; diff --git a/packages/vinext/src/entries/app-ssr-entry.ts b/packages/vinext/src/entries/app-ssr-entry.ts index 6c0057c10..c76430f9a 100644 --- a/packages/vinext/src/entries/app-ssr-entry.ts +++ b/packages/vinext/src/entries/app-ssr-entry.ts @@ -21,26 +21,6 @@ import * as _clientRefs from "virtual:vite-rsc/client-references"; let _clientRefsPreloaded = false; -/** - * Collect all chunks from a ReadableStream into an array of text strings. - * Used to capture the RSC payload for embedding in HTML. - * The RSC flight protocol is text-based (line-delimited key:value pairs), - * so we decode to text strings instead of byte arrays — this is dramatically - * more compact when JSON-serialized into inline