[PR #732] feat(prerender): usability enhancements for pre-rendering (#565) #802

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

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/732
Author: @raed04
Created: 4/1/2026
Status: 🔄 Open

Base: mainHead: feat/prerender-usability-565


📝 Commits (1)

  • e7a7c9a feat(prerender): usability enhancements for pre-rendering (#565)

📊 Changes

4 files changed (+760 additions, -41 deletions)

View changed files

📝 packages/vinext/src/build/report.ts (+120 -22)
📝 packages/vinext/src/build/run-prerender.ts (+209 -17)
📝 packages/vinext/src/index.ts (+14 -0)
📝 tests/build-report.test.ts (+417 -2)

📄 Description

Summary

Closes #565 — Pre-rendering usability enhancements.

  • Improved progress bar: Shows phase labels (App Router / Pages Router), elapsed time, render rate (routes/s), and real-time status breakdown (rendered/skipped/errors)
  • Better route classification: Detects dynamic API imports (headers, cookies, draftMode from next/headers; connection from next/server; unstable_noStore/noStore from next/cache) via static analysis — routes importing these are classified as ssr instead of unknown
  • Prerender info in build report: Routes show [prerendered], [prerendered: N paths], [skipped], or [error] annotations; prerender summary section added
  • Public API for external control: runPrerender, PrerenderProgress, compileRouteGlob, matchRouteGlob and types exported from package entry point
  • Route filtering: includeRoutes/excludeRoutes glob patterns (* and **) with compiled regex caching
  • Dry-run mode: Scan and classify routes without rendering — shows what would be prerendered
  • External progress callback: onProgress option for programmatic tracking alongside built-in TTY progress bar

Files changed

File Changes
packages/vinext/src/build/report.ts Dynamic API detection, prerender annotations in report, SYMBOLS export
packages/vinext/src/build/run-prerender.ts Enhanced progress bar, route filtering, dry-run, public API
packages/vinext/src/index.ts New public exports
tests/build-report.test.ts 120 tests (44 new) covering all new features

Test plan

  • 120/120 unit tests pass (44 new tests added)
  • Full test suite: 3733 pass — same pre-existing failures as main, zero regressions
  • Lint (oxlint): 0 warnings, 0 errors
  • Formatting: all modified files clean
  • Build: successful
  • Backward compatible — all new type fields optional, no breaking API changes
  • classifyAppRoute behavioral change documented: routes importing dynamic APIs now return ssr instead of unknown (more accurate, errs toward restrictive)

🔄 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/732 **Author:** [@raed04](https://github.com/raed04) **Created:** 4/1/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `feat/prerender-usability-565` --- ### 📝 Commits (1) - [`e7a7c9a`](https://github.com/cloudflare/vinext/commit/e7a7c9a3afaf27f36d42b61f11d78dbac1bcaa57) feat(prerender): usability enhancements for pre-rendering (#565) ### 📊 Changes **4 files changed** (+760 additions, -41 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/build/report.ts` (+120 -22) 📝 `packages/vinext/src/build/run-prerender.ts` (+209 -17) 📝 `packages/vinext/src/index.ts` (+14 -0) 📝 `tests/build-report.test.ts` (+417 -2) </details> ### 📄 Description ## Summary Closes #565 — Pre-rendering usability enhancements. - **Improved progress bar**: Shows phase labels (App Router / Pages Router), elapsed time, render rate (routes/s), and real-time status breakdown (rendered/skipped/errors) - **Better route classification**: Detects dynamic API imports (`headers`, `cookies`, `draftMode` from `next/headers`; `connection` from `next/server`; `unstable_noStore`/`noStore` from `next/cache`) via static analysis — routes importing these are classified as `ssr` instead of `unknown` - **Prerender info in build report**: Routes show `[prerendered]`, `[prerendered: N paths]`, `[skipped]`, or `[error]` annotations; prerender summary section added - **Public API for external control**: `runPrerender`, `PrerenderProgress`, `compileRouteGlob`, `matchRouteGlob` and types exported from package entry point - **Route filtering**: `includeRoutes`/`excludeRoutes` glob patterns (`*` and `**`) with compiled regex caching - **Dry-run mode**: Scan and classify routes without rendering — shows what would be prerendered - **External progress callback**: `onProgress` option for programmatic tracking alongside built-in TTY progress bar ### Files changed | File | Changes | |------|---------| | `packages/vinext/src/build/report.ts` | Dynamic API detection, prerender annotations in report, `SYMBOLS` export | | `packages/vinext/src/build/run-prerender.ts` | Enhanced progress bar, route filtering, dry-run, public API | | `packages/vinext/src/index.ts` | New public exports | | `tests/build-report.test.ts` | 120 tests (44 new) covering all new features | ## Test plan - [x] 120/120 unit tests pass (44 new tests added) - [x] Full test suite: 3733 pass — same pre-existing failures as main, zero regressions - [x] Lint (oxlint): 0 warnings, 0 errors - [x] Formatting: all modified files clean - [x] Build: successful - [x] Backward compatible — all new type fields optional, no breaking API changes - [x] `classifyAppRoute` behavioral change documented: routes importing dynamic APIs now return `ssr` instead of `unknown` (more accurate, errs toward restrictive) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#802
No description provided.