From ae001ed612fef7e242c13e55c04055f7454bb06c Mon Sep 17 00:00:00 2001 From: shulaoda <165626830+shulaoda@users.noreply.github.com> Date: Wed, 1 Jul 2026 07:59:52 +0800 Subject: [PATCH] chore(void): remove dead detectSsrPrerender helper This removes the detectSsrPrerender function and its two module level regexes PRERENDER_RE and GET_PRERENDER_PATHS_RE from packages/void/src/ssr/entry.ts. The function is dead code. detectSsrPrerender is never called anywhere in the monorepo, and ssr/entry.ts is not part of the package exports surface, so it is unreachable from outside the package as well. SSR prerender detection is actually performed by pages/scan.ts, which carries its own PRERENDER_RE and GET_PRERENDER_PATHS_RE and uses them during the page scan. The copy in ssr/entry.ts is a superseded duplicate. There is no behavior change. The function had no callers, the two regexes were used only by that function, and the rest of ssr/entry.ts, including getSsrServerEntryPath and validateSsrEntries, is untouched. The readFileSync import stays because it is still used elsewhere in the file. There are zero references to detectSsrPrerender across packages including tests. The void package typechecks cleanly with tsgo. The net change removes 27 lines. --- packages/void/src/ssr/entry.ts | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/packages/void/src/ssr/entry.ts b/packages/void/src/ssr/entry.ts index c31a16d3e..dff08f716 100644 --- a/packages/void/src/ssr/entry.ts +++ b/packages/void/src/ssr/entry.ts @@ -183,30 +183,3 @@ export function validateSsrEntry( ): string | null { return validateSsrEntries(root, paths)?.server.absolutePath ?? null; } - -const PRERENDER_RE = /export\s+const\s+prerender\s*=\s*true\s*;/; -const GET_PRERENDER_PATHS_RE = /export\s+(?:async\s+)?function\s+getPrerenderPaths\b/; - -/** - * Detect prerender exports in the SSR server entry file. - * Returns null when SSR mode is not used. - */ -export function detectSsrPrerender( - root: string, - paths: ProjectPaths = readProjectPaths(root), -): { prerender: boolean; hasGetPrerenderPaths: boolean } | null { - const entryPath = getSsrServerEntryPath(root, paths); - if (!entryPath) { - return null; - } - - const content = readFileSync(entryPath, 'utf-8'); - const prerender = PRERENDER_RE.test(content); - const hasGetPrerenderPaths = GET_PRERENDER_PATHS_RE.test(content); - - if (!prerender && !hasGetPrerenderPaths) { - return null; - } - - return { prerender, hasGetPrerenderPaths }; -}