mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #606] Improve build report route analysis with AST parsing #706
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#706
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/606
Author: @Boyeep
Created: 3/20/2026
Status: 🔄 Open
Base:
main← Head:fix/scope-getstaticprops-revalidate📝 Commits (10+)
e6b1264fix: scope getStaticProps revalidate parsing5a1f4c8fix: handle early returns in getStaticProps revalidate parsing8e6136ffix: scope getStaticProps parsing to its declaration98598e2fix: handle destructured getStaticProps params1a86e86fix: ignore nested helper returns in getStaticProps8942db5fix: avoid re-export false positives in getStaticProps parsing4280a13fix: harden getStaticProps revalidate parsingf3d2a60chore: polish getStaticProps parser follow-up78a438bImprove build report route analysis with AST parsing685b5c9Merge upstream/main into fix/scope-getstaticprops-revalidate📊 Changes
16 files changed (+781 additions, -569 deletions)
View changed files
📝
packages/vinext/package.json(+1 -0)📝
packages/vinext/src/build/report.ts(+447 -425)📝
pnpm-lock.yaml(+3 -0)📝
tests/build-report.test.ts(+262 -144)➕
tests/fixtures/build-report/lib/build-report-shared-gsp.ts(+3 -0)➕
tests/fixtures/build-report/lib/build-report-types.ts(+7 -0)➕
tests/fixtures/build-report/pages/build-report-alias-export.tsx(+7 -0)➕
tests/fixtures/build-report/pages/build-report-default-export-gsp.tsx(+3 -0)➕
tests/fixtures/build-report/pages/build-report-default-export-gssp.tsx(+3 -0)➕
tests/fixtures/build-report/pages/build-report-factory-gsp.tsx(+11 -0)➕
tests/fixtures/build-report/pages/build-report-generic-gsp.ts(+5 -0)➕
tests/fixtures/build-report/pages/build-report-import-reexport-gsp.tsx(+7 -0)➕
tests/fixtures/build-report/pages/build-report-local-identifier-gsp.tsx(+7 -0)➕
tests/fixtures/build-report/pages/build-report-reexport-gsp.tsx(+5 -0)➕
tests/fixtures/build-report/pages/build-report-type-only-gsp.tsx(+5 -0)➕
tests/fixtures/build-report/pages/build-report-type-only-gssp.tsx(+5 -0)📄 Description
Fixes #605
This replaces the build report’s regex/string-based route analysis with AST-based analysis using the TypeScript compiler API.
The main goal is to make route classification more accurate, especially around getStaticProps and exported route config, while keeping the existing report flow intact.
Switched build-report source inspection in
packages/vinext/src/build/report.tsto TypeScript AST parsingReplaced regex-based detection for:
named exports
export const dynamic = ...export const revalidate = ...getStaticPropsrevalidateextractionReused a single parsed AST per file during route classification instead of reparsing for each helper
Added support for:
aliased exports
local identifier aliases
as constsatisfiesextension-aware TS vs TSX parsing
Ignored non-runtime exports:
export type { ... }export { type ... }export declare ...Treated non-local or non-analyzable getStaticProps exports conservatively as unknown instead of incorrectly reporting static
Applied speculative prerender promotion to Pages routes as well, so Pages routes classified as unknown can still be upgraded to static when prerender confirms them
Added regression coverage for:
getStaticPropsgetStaticPropsfactoriesas const/satisfiesvp test tests/build-report.test.tspasses with 107 tests.vp lintstill reports the existing unrelated benchmark import errors:benchmarks/vinext/vite.config.tsbenchmarks/vinext-rolldown/vite.config.ts🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.