Skip to content

Commit 02f2183

Browse files
authored
docs: adapterPath amends (#89930)
- use experimental versioning - fix spacing for graphs - spacing in [!NOTE]
1 parent ea8651a commit 02f2183

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

docs/01-app/03-api-reference/05-config/01-next-config-js/adapterPath.mdx

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
---
2-
title: experimental.adapterPath
2+
title: adapterPath
33
description: Configure a custom adapter for Next.js to hook into the build process with modifyConfig and onBuildComplete callbacks.
4+
version: experimental
45
---
56

67
Next.js provides an experimental API that allows you to create custom adapters to hook into the build process. This is useful for deployment platforms or custom build integrations that need to modify Next.js configuration or process build outputs.
78

8-
> [!WARNING]
9-
> `experimental.adapterPath` is experimental and may change.
10-
119
For a full reference implementation, see [`nextjs/adapter-vercel`](https://github.com/nextjs/adapter-vercel).
1210

1311
## Configuration
@@ -250,14 +248,20 @@ Client
250248
| GET /ppr-route
251249
v
252250
Adapter Router
253-
|-- read cached shell + postponedState --> Platform Cache
254-
|<------------- cache hit --------------|
251+
|
252+
|-- read cached shell + postponedState ---> Platform Cache
253+
|<------------- cache hit -----------------|
254+
|
255255
|-- create responseStream = concat(shellStream, resumedStream)
256-
|-- start piping shellStream -----------> Client (first bytes)
256+
|
257+
|-- start piping shellStream ------------> Client (first bytes)
258+
|
257259
|-- invoke handler(req, res, { requestMeta: { postponed } })
258-
| ------------------------------------> Entrypoint (handler)
259-
| <------------------------------------ resumed chunks/cache entry
260+
| -------------------------------------> Entrypoint (handler)
261+
| <------------------------------------- resumed chunks/cache entry
262+
|
260263
|-- append resumed chunks to resumedStream
264+
|
261265
'-- client receives one HTTP response:
262266
[shell bytes........][resumed bytes........]
263267
```
@@ -267,8 +271,10 @@ Adapter Router
267271
`requestMeta.onCacheEntryV2` is called when a response cache entry is looked up or generated. Use it to persist updated shell/postponed data.
268272

269273
> [!NOTE]
270-
> `requestMeta.onCacheEntry` still works, but is deprecated. Prefer `requestMeta.onCacheEntryV2`.
271-
> If your adapter uses an internal `onCacheCallback` abstraction, wire it to `requestMeta.onCacheEntryV2`.
274+
>
275+
> - `requestMeta.onCacheEntry` still works, but is deprecated.
276+
> - Prefer `requestMeta.onCacheEntryV2`.
277+
> - If your adapter uses an internal `onCacheCallback` abstraction, wire it to `requestMeta.onCacheEntryV2`.
272278
273279
```ts filename="my-adapter.ts"
274280
await handler(req, res, {
@@ -304,10 +310,11 @@ Entrypoint (handler)
304310
| onCacheEntryV2(cacheEntry, { url })
305311
v
306312
requestMeta.onCacheEntryV2 callback
307-
|-- if APP_PAGE --> persist html + postponedState + headers --> Platform Cache
313+
|
314+
|-- if APP_PAGE ---> persist html + postponedState + headers ---> Platform Cache
308315
|
309316
'-- return false: continue normal Next.js response flow
310-
return true: adapter already handled response (short-circuit)
317+
return true: adapter already handled response (short-circuit)
311318
```
312319

313320
## Invoking Entrypoints

0 commit comments

Comments
 (0)