mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
Building on top of @agadzik work (see first commit) Adds prerender route metadata to help downstream consumers understand the nature of build-time prerenders We break down prerender taxonomy as follows routeType describes what the prerender serves: * `route`: a non-UI endpoint, such as a Route Handler. * `page`: a page whose route parameters are fully known. * `shell`: a reusable PPR shell for a parameterized page. * `fallback`: a fallback that may serve or specialize additional parameter values. response describes how complete the static response is: * `complete`: the prerender contains the completed response. * `initial`: an initial response is available, but the page UI is incomplete; in practice this applies to partially prerenderable UI routes. * `empty`: there is no initial static response to send. compute describes the request-time work required: * `static`: no request-time server compute is needed. * `resuming`: request-time compute resumes from the static response. * `blocking`: the initial response is blocked until request-time compute starts, but it may stream while that compute continues. `htmlSize` reports the byte size of prerendered HTML when the output has HTML. The taxonomy is included only on a prerender group’s canonical primary output—the HTML output for pages or the response output for Route Handlers—and is omitted from secondary RSC and segment-data outputs. --------- Co-authored-by: agadzik <[email protected]>
10 lines
242 B
JavaScript
10 lines
242 B
JavaScript
import fs from 'fs/promises'
|
|
|
|
/** @type {import('next').NextAdapter } */
|
|
export default {
|
|
name: 'adapter-prerender-metadata',
|
|
async onBuildComplete(ctx) {
|
|
await fs.writeFile('build-complete.json', JSON.stringify(ctx, null, 2))
|
|
},
|
|
}
|