Output Types
Core Idea
Reference for every entry shape inside AdapterOutputs, the typed build-output arrays an adapter receives in onBuildComplete.
Key Concepts
outputs.pages: React pages from pages/ (type: 'PAGES').
outputs.pagesApi: API routes from pages/api/ (type: 'PAGES_API').
outputs.appPages: React pages from app/ (type: 'APP_PAGE'); pathname includes .rsc suffix for RSC routes.
outputs.appRoutes: API/metadata routes from app/ (type: 'APP_ROUTE').
outputs.prerenders: ISR-enabled routes and static prerenders (type: 'PRERENDER'), with routeType/response/compute classification.
outputs.staticFiles: static assets and auto-statically-optimized pages (type: 'STATIC_FILE'), carrying immutableHash when content-hashed.
outputs.middleware: the middleware.ts/proxy.ts function, if present (type: 'MIDDLEWARE').
config.output: 'export': when set, only outputs.staticFiles is populated; all other arrays are empty.
Code Examples
// Shared shape for pages / pagesApi / appPages / appRoutes / middleware
{
type: 'PAGES' | 'PAGES_API' | 'APP_PAGE' | 'APP_ROUTE' | 'MIDDLEWARE'
id: string
filePath: string
pathname: string
sourcePage: string
runtime: 'nodejs' | 'edge'
assets: Record<string, string> // relative repo path -> absolute path
wasmAssets?: Record<string, string>
edgeRuntime?: {
modulePath: string
entryKey: string
handlerExport: string
}
config: {
maxDuration?: number
preferredRegion?: string | string[] // deprecated
env?: Record<string, string> // edge runtime only
}
}
// PRERENDER
{
type: 'PRERENDER'
id: string
pathname: string
parentOutputId: string
groupId: number // shared groupId revalidates together
route: string // e.g. /blog/[slug]
routeType?: 'route' | 'fallback' | 'shell' | 'page'
response?: 'empty' | 'initial' | 'complete'
compute?: 'blocking' | 'resuming' | 'static'
htmlSize?: number
pprChain?: { headers: Record<string, string> }
parentFallbackMode?: false | null | string
fallback?: {
filePath: string | undefined
initialStatus?: number
initialHeaders?: Record<string, string | string[]>
initialExpiration?: number
initialRevalidate?: number | false
postponedState: string | undefined
}
config: {
allowQuery?: string[]
allowHeader?: string[]
bypassFor?: RouteHas[]
renderingMode?: 'STATIC' | 'PARTIALLY_STATIC'
partialFallback?: boolean
bypassToken?: string
}
}
// STATIC_FILE
{
type: 'STATIC_FILE'
id: string
filePath: string
pathname: string
immutableHash: string | undefined
}
- O que demonstra: as três formas de saída mais distintas: o "shape" comum de rotas, o shape especializado de prerenders (com classificação PPR/ISR), e o shape simples de arquivos estáticos.
Reference Tables
routeType | Meaning |
|---|
route | Non-UI route (Route Handler) |
page | Page with no missing prerenderable params |
shell | Most specific reusable page shell for a URL class |
fallback | Reusable response specialized by filling more params |
response | Meaning |
|---|
empty | No initial page response can be served |
initial | Initial response servable, but not the completed UI (partially prerenderable) |
complete | Response is complete (can be zero-byte, e.g. 204) |
compute | Meaning |
|---|
blocking | No response before request-time compute starts; can stream once started |
resuming | Initial response served while postponed work resumes server-side |
static | No per-request server compute needed |
Anti-patterns
- Assuming all output types are populated with
output: 'export': only staticFiles is populated in that mode; code iterating outputs.pages etc. must handle empty arrays gracefully.
- Reading
htmlSize/routeType/response/compute off related RSC/data/segment outputs: these fields exist only on the primary App Router HTML output within a prerender group.
Key Takeaways
routeType + response + compute together classify exactly how much of a prerendered route can be served statically vs. requires request-time work.
htmlSize: 0 specifically means an empty HTML shell, not "field absent" — check for undefined vs 0 explicitly.
assets/wasmAssets maps give the adapter the full traced dependency graph per output, keyed by relative repo path.
- Static export mode collapses the whole output surface down to
staticFiles only — a major branch point for adapter logic.
Connects To
- ch276 implementing-ppr-in-an-adapter: consumes
prerenders[].fallback fields directly.
- ch282 supporting-immutable-static-assets: consumes
staticFiles[].immutableHash.
- ch278 invoking-entrypoints: consumes
edgeRuntime metadata shown here.