[PR #657] [MERGED] refactor: extract pages page response helpers #750

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

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/657
Author: @southpolesteve
Created: 3/22/2026
Status: Merged
Merged: 3/22/2026
Merged by: @southpolesteve

Base: mainHead: codex/pages-page-response-runtime


📝 Commits (2)

  • a3a48f9 refactor: extract pages page response helpers
  • e539f08 fix: preserve array-valued pages gssp headers

📊 Changes

5 files changed (+590 additions, -281 deletions)

View changed files

📝 packages/vinext/src/entries/pages-server-entry.ts (+61 -140)
packages/vinext/src/server/pages-page-response.ts (+291 -0)
📝 tests/__snapshots__/entry-templates.test.ts.snap (+58 -140)
📝 tests/entry-templates.test.ts (+10 -1)
tests/pages-page-response.test.ts (+170 -0)

📄 Description

Summary

This PR starts the Pages Router side of the generated-entry refactor by extracting the page HTML shell / stream / response construction out of pages-server-entry.ts and into a typed runtime helper:

  • adds packages/vinext/src/server/pages-page-response.ts
  • moves document shell construction, font/style injection, __NEXT_DATA__ serialization, streamed HTML response shaping, and ISR cache fill HTML assembly into that helper
  • keeps packages/vinext/src/entries/pages-server-entry.ts as thinner route/data wiring
  • adds direct unit coverage in tests/pages-page-response.test.ts
  • updates the Pages entry generator assertions and snapshot to check delegation instead of the old inline implementation details

This PR was written by Codex.

Why

After the App Router extraction series landed, pages-server-entry.ts is the next major generated module that still owns too much real runtime behavior. This is the first Pages Router slice: pull the HTML render/response lifecycle into normal typed code, then follow with the data/ISR and API/runtime seams on top of that.

Testing

  • vp check packages/vinext/src/server/pages-page-response.ts packages/vinext/src/entries/pages-server-entry.ts tests/pages-page-response.test.ts tests/entry-templates.test.ts
  • vp test run tests/pages-page-response.test.ts tests/entry-templates.test.ts -t 'pages page response|server entry delegates Pages HTML stream/response shaping to a typed helper'
  • vp test run tests/pages-router.test.ts -t 'getServerSideProps headers and status are applied to the response|getServerSideProps calling res.end\(\) short-circuits the response|renders Suspense \+ React.lazy content via streaming SSR|Production Pages Router SSR streaming'
  • vp test run tests/entry-templates.test.ts -u
  • vp run vinext#build

🔄 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/657 **Author:** [@southpolesteve](https://github.com/southpolesteve) **Created:** 3/22/2026 **Status:** ✅ Merged **Merged:** 3/22/2026 **Merged by:** [@southpolesteve](https://github.com/southpolesteve) **Base:** `main` ← **Head:** `codex/pages-page-response-runtime` --- ### 📝 Commits (2) - [`a3a48f9`](https://github.com/cloudflare/vinext/commit/a3a48f928786d2e3caa559d8f8541678d83129cf) refactor: extract pages page response helpers - [`e539f08`](https://github.com/cloudflare/vinext/commit/e539f082ad1215d53f53efe65e5985d41c3c2921) fix: preserve array-valued pages gssp headers ### 📊 Changes **5 files changed** (+590 additions, -281 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/entries/pages-server-entry.ts` (+61 -140) ➕ `packages/vinext/src/server/pages-page-response.ts` (+291 -0) 📝 `tests/__snapshots__/entry-templates.test.ts.snap` (+58 -140) 📝 `tests/entry-templates.test.ts` (+10 -1) ➕ `tests/pages-page-response.test.ts` (+170 -0) </details> ### 📄 Description ## Summary This PR starts the Pages Router side of the generated-entry refactor by extracting the page HTML shell / stream / response construction out of `pages-server-entry.ts` and into a typed runtime helper: - adds `packages/vinext/src/server/pages-page-response.ts` - moves document shell construction, font/style injection, `__NEXT_DATA__` serialization, streamed HTML response shaping, and ISR cache fill HTML assembly into that helper - keeps `packages/vinext/src/entries/pages-server-entry.ts` as thinner route/data wiring - adds direct unit coverage in `tests/pages-page-response.test.ts` - updates the Pages entry generator assertions and snapshot to check delegation instead of the old inline implementation details This PR was written by Codex. ## Why After the App Router extraction series landed, `pages-server-entry.ts` is the next major generated module that still owns too much real runtime behavior. This is the first Pages Router slice: pull the HTML render/response lifecycle into normal typed code, then follow with the data/ISR and API/runtime seams on top of that. ## Testing - `vp check packages/vinext/src/server/pages-page-response.ts packages/vinext/src/entries/pages-server-entry.ts tests/pages-page-response.test.ts tests/entry-templates.test.ts` - `vp test run tests/pages-page-response.test.ts tests/entry-templates.test.ts -t 'pages page response|server entry delegates Pages HTML stream/response shaping to a typed helper'` - `vp test run tests/pages-router.test.ts -t 'getServerSideProps headers and status are applied to the response|getServerSideProps calling res.end\(\) short-circuits the response|renders Suspense \+ React.lazy content via streaming SSR|Production Pages Router SSR streaming'` - `vp test run tests/entry-templates.test.ts -u` - `vp run vinext#build` --- <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:55 +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#750
No description provided.