next 16.2.9 → 16.2.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.build-commit +1 -1
- package/dist/bin/next +2 -2
- package/dist/bin/next.map +0 -0
- package/dist/build/index.js +3 -3
- package/dist/build/swc/index.js +1 -1
- package/dist/build/turbopack-analyze/index.js +1 -1
- package/dist/build/turbopack-build/impl.js +1 -1
- package/dist/build/webpack-config.js +3 -3
- package/dist/bundle-analyzer/404.html +2 -2
- package/dist/bundle-analyzer/__next.__PAGE__.txt +1 -1
- package/dist/bundle-analyzer/__next._full.txt +1 -1
- package/dist/bundle-analyzer/__next._head.txt +1 -1
- package/dist/bundle-analyzer/__next._index.txt +1 -1
- package/dist/bundle-analyzer/__next._tree.txt +1 -1
- package/dist/bundle-analyzer/_not-found/__next._full.txt +1 -1
- package/dist/bundle-analyzer/_not-found/__next._head.txt +1 -1
- package/dist/bundle-analyzer/_not-found/__next._index.txt +1 -1
- package/dist/bundle-analyzer/_not-found/__next._not-found.__PAGE__.txt +1 -1
- package/dist/bundle-analyzer/_not-found/__next._not-found.txt +1 -1
- package/dist/bundle-analyzer/_not-found/__next._tree.txt +1 -1
- package/dist/bundle-analyzer/_not-found.html +2 -2
- package/dist/bundle-analyzer/_not-found.txt +1 -1
- package/dist/bundle-analyzer/index.html +2 -2
- package/dist/bundle-analyzer/index.txt +1 -1
- package/dist/client/app-bootstrap.js +1 -1
- package/dist/client/index.js +1 -1
- package/dist/compiled/next-server/pages-api-turbo.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages-api-turbo.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/pages-api-turbo.runtime.prod.js +1 -1
- package/dist/compiled/next-server/pages-api-turbo.runtime.prod.js.map +1 -1
- package/dist/compiled/next-server/pages-api.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages-api.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/pages-turbo.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages-turbo.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/pages-turbo.runtime.prod.js +1 -1
- package/dist/compiled/next-server/pages-turbo.runtime.prod.js.map +1 -1
- package/dist/compiled/next-server/pages.runtime.dev.js +1 -1
- package/dist/compiled/next-server/pages.runtime.dev.js.map +1 -1
- package/dist/compiled/next-server/server.runtime.prod.js +1 -1
- package/dist/compiled/next-server/server.runtime.prod.js.map +1 -1
- package/dist/docs/01-app/01-getting-started/02-project-structure.md +1 -1
- package/dist/docs/01-app/01-getting-started/03-layouts-and-pages.md +6 -4
- package/dist/docs/01-app/01-getting-started/04-linking-and-navigating.md +1 -1
- package/dist/docs/01-app/01-getting-started/05-server-and-client-components.md +1 -1
- package/dist/docs/01-app/01-getting-started/07-mutating-data.md +4 -3
- package/dist/docs/01-app/01-getting-started/09-revalidating.md +9 -8
- package/dist/docs/01-app/01-getting-started/13-fonts.md +1 -1
- package/dist/docs/01-app/01-getting-started/14-metadata-and-og-images.md +23 -9
- package/dist/docs/01-app/01-getting-started/17-deploying.md +1 -1
- package/dist/docs/01-app/02-guides/authentication.md +5 -5
- package/dist/docs/01-app/02-guides/backend-for-frontend.md +20 -8
- package/dist/docs/01-app/02-guides/cdn-caching.md +1 -1
- package/dist/docs/01-app/02-guides/custom-server.md +1 -1
- package/dist/docs/01-app/02-guides/data-security.md +19 -12
- package/dist/docs/01-app/02-guides/draft-mode.md +168 -105
- package/dist/docs/01-app/02-guides/forms.md +1 -1
- package/dist/docs/01-app/02-guides/how-revalidation-works.md +2 -2
- package/dist/docs/01-app/02-guides/mdx.md +1 -0
- package/dist/docs/01-app/02-guides/migrating-to-cache-components.md +533 -3
- package/dist/docs/01-app/02-guides/multi-zones.md +1 -1
- package/dist/docs/01-app/02-guides/package-bundling.md +1 -1
- package/dist/docs/01-app/02-guides/prefetching.md +5 -5
- package/dist/docs/01-app/02-guides/preventing-flash-before-hydration.md +3 -3
- package/dist/docs/01-app/02-guides/public-static-pages.md +1 -1
- package/dist/docs/01-app/02-guides/scripts.md +1 -1
- package/dist/docs/01-app/02-guides/server-actions.md +180 -0
- package/dist/docs/01-app/02-guides/streaming.md +0 -1
- package/dist/docs/01-app/02-guides/third-party-libraries.md +1 -0
- package/dist/docs/01-app/02-guides/upgrading/version-15.md +1 -1
- package/dist/docs/01-app/03-api-reference/01-directives/use-server.md +2 -0
- package/dist/docs/01-app/03-api-reference/03-file-conventions/dynamic-routes.md +4 -2
- package/dist/docs/01-app/03-api-reference/03-file-conventions/instrumentation.md +18 -4
- package/dist/docs/01-app/03-api-reference/05-config/01-next-config-js/rewrites.md +8 -6
- package/dist/docs/01-app/03-api-reference/05-config/01-next-config-js/serverActions.md +2 -0
- package/dist/docs/01-app/03-api-reference/05-config/01-next-config-js/transpilePackages.md +15 -3
- package/dist/docs/01-app/03-api-reference/05-config/02-typescript.md +1 -1
- package/dist/docs/01-app/04-glossary.md +1 -1
- package/dist/docs/02-pages/02-guides/upgrading/version-12.md +1 -1
- package/dist/docs/04-community/01-contribution-guide.md +2 -2
- package/dist/docs/index.md +0 -2
- package/dist/esm/build/index.js +3 -3
- package/dist/esm/build/swc/index.js +1 -1
- package/dist/esm/build/turbopack-analyze/index.js +1 -1
- package/dist/esm/build/turbopack-build/impl.js +1 -1
- package/dist/esm/build/webpack-config.js +3 -3
- package/dist/esm/client/app-bootstrap.js +1 -1
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/lib/patch-incorrect-lockfile.js +3 -3
- package/dist/esm/server/config.js +1 -1
- package/dist/esm/server/dev/hot-reloader-turbopack.js +2 -2
- package/dist/esm/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/esm/server/lib/app-info-log.js +1 -1
- package/dist/esm/server/lib/start-server.js +1 -1
- package/dist/esm/shared/lib/errors/canary-only-config-error.js +1 -1
- package/dist/lib/patch-incorrect-lockfile.js +3 -3
- package/dist/server/config.js +1 -1
- package/dist/server/dev/hot-reloader-turbopack.js +2 -2
- package/dist/server/dev/hot-reloader-webpack.js +1 -1
- package/dist/server/lib/app-info-log.js +1 -1
- package/dist/server/lib/start-server.js +1 -1
- package/dist/shared/lib/errors/canary-only-config-error.js +1 -1
- package/dist/telemetry/anonymous-meta.js +1 -1
- package/dist/telemetry/events/session-stopped.js +2 -2
- package/dist/telemetry/events/swc-load-failure.js +1 -1
- package/dist/telemetry/events/version.js +2 -2
- package/package.json +10 -252
- /package/dist/bundle-analyzer/_next/static/{ShlsHWUU3q2GhICNPxAIf → -wnBUGOTjuvnrsp1fJxyv}/_buildManifest.js +0 -0
- /package/dist/bundle-analyzer/_next/static/{ShlsHWUU3q2GhICNPxAIf → -wnBUGOTjuvnrsp1fJxyv}/_clientMiddlewareManifest.json +0 -0
- /package/dist/bundle-analyzer/_next/static/{ShlsHWUU3q2GhICNPxAIf → -wnBUGOTjuvnrsp1fJxyv}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Server Actions and Mutations
|
|
3
|
+
nav_title: Server Actions
|
|
4
|
+
description: How Server Actions work in Next.js, including the single-roundtrip response model, sequential dispatch, security, and caching integration.
|
|
5
|
+
related:
|
|
6
|
+
title: Next steps
|
|
7
|
+
description: Learn more about creating, securing, and configuring Server Actions.
|
|
8
|
+
links:
|
|
9
|
+
- app/getting-started/mutating-data
|
|
10
|
+
- app/guides/forms
|
|
11
|
+
- app/guides/data-security
|
|
12
|
+
- app/api-reference/directives/use-server
|
|
13
|
+
- app/api-reference/functions/revalidatePath
|
|
14
|
+
- app/api-reference/functions/revalidateTag
|
|
15
|
+
- app/api-reference/functions/redirect
|
|
16
|
+
- app/api-reference/functions/refresh
|
|
17
|
+
- app/api-reference/config/next-config-js/serverActions
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
A **Server Action** is a [React Server Function](https://react.dev/reference/rsc/server-functions) invoked through React's action mechanisms, such as `<form action>`, `<button formAction>`, or a client-side transition.
|
|
21
|
+
|
|
22
|
+
You create one by adding the [`'use server'`](/docs/app/api-reference/directives/use-server) directive, then invoke it from a form, or from an event handler or `useEffect` wrapped in `startTransition`. For the basics of creating and invoking Server Functions, see [Mutating data](/docs/app/getting-started/mutating-data) and the [Forms guide](/docs/app/guides/forms).
|
|
23
|
+
|
|
24
|
+
This page covers the parts of Server Actions that are specific to Next.js: how they commonly map to mutations, how the response carries both returned data and re-rendered UI, how the client dispatches them, the security boundary the framework enforces, and the configuration available.
|
|
25
|
+
|
|
26
|
+
## Sequential dispatch on the client
|
|
27
|
+
|
|
28
|
+
Next.js dispatches Server Actions one at a time per client. If a user triggers three actions in quick succession, the second waits for the first to finish, then the third waits for the second. This keeps the re-rendered server tree consistent with the action result that produced it.
|
|
29
|
+
|
|
30
|
+
A consequence: do not rely on `Promise.all` to parallelize Server Actions from the client. If you need parallel work, do it inside a single Server Action, fetch in parallel from a [Server Component](/docs/app/getting-started/fetching-data#server-components), or use a [Route Handler](/docs/app/guides/backend-for-frontend#manipulating-data) for non-mutation requests.
|
|
31
|
+
|
|
32
|
+
> **Good to know:** This is a property of the client dispatcher, not of Server Functions in general. Server-side, an action runs in its own request and can do anything an async function can do.
|
|
33
|
+
|
|
34
|
+
## A single response carries data and UI
|
|
35
|
+
|
|
36
|
+
When a Server Action triggers an immediate revalidation, Next.js does the work inside one HTTP request: it runs the action, then re-renders the current route server-side. The response that comes back contains both pieces in the same Flight stream:
|
|
37
|
+
|
|
38
|
+
- The action's return value, consumed by `useActionState` or the awaited promise on the client.
|
|
39
|
+
- A newly rendered [RSC Payload](/docs/app/glossary#rsc-payload) for the current route, which the client commits as a seeded navigation.
|
|
40
|
+
|
|
41
|
+
Your application code does not need a follow-up fetch to see the updated UI for the current page.
|
|
42
|
+
|
|
43
|
+
A re-render is included in the same response when the action does any of these:
|
|
44
|
+
|
|
45
|
+
- Calls [`updateTag`](/docs/app/api-reference/functions/updateTag) or [`revalidatePath`](/docs/app/api-reference/functions/revalidatePath) to immediately invalidate cached data.
|
|
46
|
+
- Calls [`refresh`](/docs/app/api-reference/functions/refresh) to refetch the current route's RSC Payload.
|
|
47
|
+
- Mutates cookies through [`cookies()`](/docs/app/api-reference/functions/cookies#understanding-cookie-behavior-in-server-functions). Setting or deleting a cookie automatically re-renders the current page so the UI reflects the new value.
|
|
48
|
+
- Calls [`redirect`](/docs/app/api-reference/functions/redirect). The response navigates the router and streams the destination's RSC Payload.
|
|
49
|
+
|
|
50
|
+
```ts filename="app/posts/actions.ts"
|
|
51
|
+
'use server'
|
|
52
|
+
|
|
53
|
+
import { revalidatePath } from 'next/cache'
|
|
54
|
+
import { auth } from '@/lib/auth'
|
|
55
|
+
import { db } from '@/lib/db'
|
|
56
|
+
|
|
57
|
+
export async function createPost(formData: FormData) {
|
|
58
|
+
const session = await auth()
|
|
59
|
+
if (!session?.user) throw new Error('Unauthorized')
|
|
60
|
+
|
|
61
|
+
await db.post.create({
|
|
62
|
+
data: {
|
|
63
|
+
title: String(formData.get('title')),
|
|
64
|
+
authorId: session.user.id,
|
|
65
|
+
},
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
revalidatePath('/posts')
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
The mutation, the cache invalidation, and the page re-render all complete in a single roundtrip. Because [`redirect`](/docs/app/api-reference/functions/redirect#behavior) throws a control-flow exception, any code after it does not run. Place revalidation calls before `redirect` if the destination needs the fresh data.
|
|
73
|
+
|
|
74
|
+
[`revalidateTag`](/docs/app/api-reference/functions/revalidateTag) with a stale-while-revalidate profile is the exception: it marks the tag for background refresh and does **not** include a re-render in the action response. The page reflects the change on a later read. An action that does none of the above carries only its return value, and the current route is not re-rendered.
|
|
75
|
+
|
|
76
|
+
## Security
|
|
77
|
+
|
|
78
|
+
A Server Action runs as a POST request against the page that invokes it. At build time, the `'use server'` directive tells the compiler to swap the function's implementation in client bundles for a reference (an action ID plus a dispatcher) that POSTs back to the server. The implementation stays on the server, but the route is reachable to anyone who can send the same POST. Treat every action as an untrusted entry point.
|
|
79
|
+
|
|
80
|
+
Next.js enforces a few framework-level protections:
|
|
81
|
+
|
|
82
|
+
- **CSRF check.** The request's `Origin` is compared to the `Host` (or `X-Forwarded-Host`). Mismatches are rejected. Configure [`serverActions.allowedOrigins`](/docs/app/api-reference/config/next-config-js/serverActions#allowedorigins) for proxy or CDN domains.
|
|
83
|
+
- **Body size limit.** Action requests are capped at 1MB by default. Configure [`serverActions.bodySizeLimit`](/docs/app/api-reference/config/next-config-js/serverActions#bodysizelimit) when accepting larger payloads.
|
|
84
|
+
- **Encrypted action IDs and dead code elimination.** Action references are encrypted at build time, and unused Server Functions are stripped from client bundles so they have no public endpoint. See [Built-in Server Actions security features](/docs/app/guides/data-security#built-in-server-actions-security-features).
|
|
85
|
+
- **Closure variable encryption.** Variables captured by an inline action are encrypted before being sent to the client. For multi-instance and self-hosted deployments, set `NEXT_SERVER_ACTIONS_ENCRYPTION_KEY` to a stable key shared across instances. See [Closures and encryption](/docs/app/guides/data-security#closures-and-encryption).
|
|
86
|
+
|
|
87
|
+
Framework protections are not a substitute for application-level checks. Inside every action:
|
|
88
|
+
|
|
89
|
+
- **Authenticate and authorize.** Render-time gating (only rendering a form on an authenticated page) is not a security boundary, because requests can be sent without going through the UI.
|
|
90
|
+
- **Validate inputs.** Treat `FormData`, query parameters, and headers as untrusted.
|
|
91
|
+
- **Constrain return values.** Action returns are serialized to the client. Shape them to what the UI renders, not raw database records.
|
|
92
|
+
|
|
93
|
+
For end-to-end patterns including a Data Access Layer, return-value tainting, and rate limiting, see the [Data Security guide](/docs/app/guides/data-security#mutating-data).
|
|
94
|
+
|
|
95
|
+
Destructive operations like deletes may warrant stronger handling, such as elevated session checks or re-authentication, and a loud failure when those checks miss.
|
|
96
|
+
|
|
97
|
+
```ts filename="app/posts/actions.ts" highlight={6,7,8}
|
|
98
|
+
'use server'
|
|
99
|
+
|
|
100
|
+
import { auth } from '@/lib/auth'
|
|
101
|
+
|
|
102
|
+
export async function deletePost(postId: string) {
|
|
103
|
+
const session = await auth()
|
|
104
|
+
if (!session?.user) throw new Error('Unauthorized')
|
|
105
|
+
if (!(await canDelete(session.user, postId))) throw new Error('Forbidden')
|
|
106
|
+
|
|
107
|
+
await db.post.delete({ where: { id: postId } })
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
If you've enabled the experimental [`authInterrupts`](/docs/app/api-reference/config/next-config-js/authInterrupts) flag, you can throw [`unauthorized()`](/docs/app/api-reference/functions/unauthorized) and [`forbidden()`](/docs/app/api-reference/functions/forbidden) from `next/navigation` instead, so Next.js renders the corresponding `unauthorized.tsx` / `forbidden.tsx` UI segment automatically.
|
|
112
|
+
|
|
113
|
+
For example, a client legitimately tells the server _which_ item to act on, but it should not supply the row's contents or ownership. Send a reference (typically an ID) plus the user's change, and re-read the rest from a trusted source using the session. Schema validation (zod or similar) only checks the _shape_ of the input. A well-formed `Item` object can still refer to a row the caller does not own.
|
|
114
|
+
|
|
115
|
+
```ts filename="app/items/actions.ts"
|
|
116
|
+
'use server'
|
|
117
|
+
|
|
118
|
+
import { auth } from '@/lib/auth'
|
|
119
|
+
import { db } from '@/lib/db'
|
|
120
|
+
|
|
121
|
+
// Unsafe: no auth, no ownership check. The whole item, including its id, comes
|
|
122
|
+
// from the client, so anyone who can POST here can mark any item complete.
|
|
123
|
+
export async function completeItemUnsafe(item: Item) {
|
|
124
|
+
await db.item.update({ where: { id: item.id }, data: { completed: true } })
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Safe: take only the change, derive identity from the session, look up by ownership.
|
|
128
|
+
export async function completeItem(itemId: string) {
|
|
129
|
+
const session = await auth()
|
|
130
|
+
if (!session?.user) return
|
|
131
|
+
|
|
132
|
+
const item = await db.item.findFirst({
|
|
133
|
+
where: { id: itemId, ownerId: session.user.id },
|
|
134
|
+
})
|
|
135
|
+
if (!item) return
|
|
136
|
+
|
|
137
|
+
await db.item.update({ where: { id: item.id }, data: { completed: true } })
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Choosing a cache update
|
|
142
|
+
|
|
143
|
+
After mutating data, on-demand revalidation updates the server cache, the client router, or both. Choose based on what needs to change:
|
|
144
|
+
|
|
145
|
+
- [`updateTag`](/docs/app/api-reference/functions/updateTag): immediate expiration of a tag. The next read (including the route re-render that ships with the action's response) waits for fresh data. Use when the action needs **read-your-own-writes** so the user immediately sees their change. Server Actions only.
|
|
146
|
+
- [`revalidateTag`](/docs/app/api-reference/functions/revalidateTag): stale-while-revalidate refresh of a tag with a cache-life profile. Subsequent reads get the stale value while a fresh fetch happens in the background, so the action's own re-render does **not** wait for the new data.
|
|
147
|
+
- [`revalidatePath`](/docs/app/api-reference/functions/revalidatePath): invalidate by URL path. Use when one route is affected and tagging is overkill.
|
|
148
|
+
- [`refresh`](/docs/app/api-reference/functions/refresh): refetch the current route's RSC Payload without invalidating cached data. Use when the view depends on state outside the cache that the action just changed.
|
|
149
|
+
|
|
150
|
+
When `updateTag`, `revalidatePath`, or `refresh` runs, Next.js re-renders the current route server-side and includes a newly rendered [RSC Payload](/docs/app/glossary#rsc-payload) in the action's response, so the page reflects the change in the same roundtrip. `revalidateTag` with a stale-while-revalidate profile intentionally skips that immediate re-render.
|
|
151
|
+
|
|
152
|
+
Unlike [`redirect`](/docs/app/api-reference/functions/redirect), none of these throw, so an action can call them and still return a value to the caller. See [How revalidation works](/docs/app/guides/how-revalidation-works) for the underlying model.
|
|
153
|
+
|
|
154
|
+
## Configuration
|
|
155
|
+
|
|
156
|
+
The [`serverActions`](/docs/app/api-reference/config/next-config-js/serverActions) option in `next.config.js` controls framework-level behavior:
|
|
157
|
+
|
|
158
|
+
```js filename="next.config.js"
|
|
159
|
+
/** @type {import('next').NextConfig} */
|
|
160
|
+
module.exports = {
|
|
161
|
+
experimental: {
|
|
162
|
+
serverActions: {
|
|
163
|
+
allowedOrigins: ['my-proxy.com', '*.my-proxy.com'],
|
|
164
|
+
bodySizeLimit: '2mb',
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
}
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
For the closure encryption key, set `NEXT_SERVER_ACTIONS_ENCRYPTION_KEY` in the deployment environment. See [Self-hosting: Server Functions encryption key](/docs/app/guides/self-hosting#server-functions-encryption-key) for deployment-specific guidance.
|
|
171
|
+
|
|
172
|
+
## Deployment considerations
|
|
173
|
+
|
|
174
|
+
Each Server Action is identified by the [action ID](#security) that is part of its build artifacts. New deployments typically generate new IDs (Next.js rotates them at most every 14 days, even when the source is unchanged), so a client still running the previous build may invoke an action ID that no longer exists. The error surfaces as "[Failed to find Server Action](https://nextjs.org/docs/messages/failed-to-find-server-action)".
|
|
175
|
+
|
|
176
|
+
To minimize disruption:
|
|
177
|
+
|
|
178
|
+
- Prefer rolling deployments over abrupt cutovers when active users are likely to be mid-mutation.
|
|
179
|
+
- Keep `NEXT_SERVER_ACTIONS_ENCRYPTION_KEY` stable across instances so action references remain decryptable everywhere.
|
|
180
|
+
- Surface the error as a retry path in the UI rather than a hard failure, so a refresh recovers the user.
|
|
@@ -383,7 +383,6 @@ Prefer explicit `<Suspense>` boundaries close to the dynamic access. When the pr
|
|
|
383
383
|
|
|
384
384
|
### Error handling mid-stream
|
|
385
385
|
|
|
386
|
-
{/* TODO: catchError semantics - not landed on stable yet */}
|
|
387
386
|
If a component throws an error after streaming has started, the nearest [`error.js`](/docs/app/api-reference/file-conventions/error) boundary catches it and renders the error UI in place of the failed component. The rest of the page remains intact, only the section that errored is replaced.
|
|
388
387
|
|
|
389
388
|
Because the HTTP status code (`200 OK`) has already been sent with the first chunk, it cannot be changed to a `4xx` or `5xx`. The error is handled entirely within the streamed HTML. See [The HTTP contract](#the-http-contract) for more on this constraint.
|
|
@@ -367,6 +367,7 @@ Options to pass to the `<GoogleAnalytics>` component.
|
|
|
367
367
|
| --------------- | -------- | ------------------------------------------------------------------------------------------------------ |
|
|
368
368
|
| `gaId` | Required | Your [measurement ID](https://support.google.com/analytics/answer/12270356). Usually starts with `G-`. |
|
|
369
369
|
| `dataLayerName` | Optional | Name of the data layer. Defaults to `dataLayer`. |
|
|
370
|
+
| `debugMode` | Optional | Enable Google Analytics [debug mode](https://support.google.com/analytics/answer/7201382). |
|
|
370
371
|
| `nonce` | Optional | A [nonce](/docs/app/guides/content-security-policy#nonces). |
|
|
371
372
|
|
|
372
373
|
### Google Maps Embed
|
|
@@ -374,7 +374,7 @@ export async function generateMetadata(props) {
|
|
|
374
374
|
const query = searchParams.query
|
|
375
375
|
}
|
|
376
376
|
|
|
377
|
-
export async function Page(props) {
|
|
377
|
+
export default async function Page(props) {
|
|
378
378
|
const params = await props.params
|
|
379
379
|
const searchParams = await props.searchParams
|
|
380
380
|
const slug = params.slug
|
|
@@ -5,6 +5,8 @@ description: Learn how to use the use server directive to execute code on the se
|
|
|
5
5
|
|
|
6
6
|
The `use server` directive designates a function or file to be executed on the **server side**. It can be used at the top of a file to indicate that all functions in the file are server-side, or inline at the top of a function to mark the function as a [Server Function](https://19.react.dev/reference/rsc/server-functions). This is a React feature.
|
|
7
7
|
|
|
8
|
+
For Next.js-specific Server Action behaviors (response model, security, configuration, deployment), see [Server Actions and Mutations](/docs/app/guides/server-actions).
|
|
9
|
+
|
|
8
10
|
## Using `use server` at the top of a file
|
|
9
11
|
|
|
10
12
|
The following example shows a file with a `use server` directive at the top. All functions in the file are executed on the server.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: Dynamic Route Segments
|
|
3
3
|
nav_title: Dynamic Segments
|
|
4
|
-
description: Dynamic
|
|
4
|
+
description: Use Dynamic Segments to read URL path params and generate routes from dynamic data.
|
|
5
5
|
related:
|
|
6
6
|
title: Next Steps
|
|
7
7
|
description: For more information on what to do next, we recommend the following sections
|
|
@@ -9,7 +9,9 @@ related:
|
|
|
9
9
|
- app/api-reference/functions/generate-static-params
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
When you don't know
|
|
12
|
+
A URL path is a sequence of path segments. In the App Router, a segment may be **static** (a literal value matched exactly) or **dynamic** (a placeholder that captures a value from the URL). When you don't know a segment's value ahead of time, define a Dynamic Segment to create routes from dynamic data. Next.js passes the captured values to your page via the path `params` prop, either filled in at request time or prerendered at build time.
|
|
13
|
+
|
|
14
|
+
> **Good to know**: Dynamic Segments are often referred to as path params, route params, or URL params.
|
|
13
15
|
|
|
14
16
|
## Convention
|
|
15
17
|
|
|
@@ -48,10 +48,17 @@ export const onRequestError: Instrumentation.onRequestError = async (
|
|
|
48
48
|
request,
|
|
49
49
|
context
|
|
50
50
|
) => {
|
|
51
|
+
const message = err instanceof Error ? err.message : String(err)
|
|
52
|
+
const digest =
|
|
53
|
+
typeof err === 'object' && err !== null && 'digest' in err
|
|
54
|
+
? String(err.digest)
|
|
55
|
+
: undefined
|
|
56
|
+
|
|
51
57
|
await fetch('https://.../report-error', {
|
|
52
58
|
method: 'POST',
|
|
53
59
|
body: JSON.stringify({
|
|
54
|
-
message
|
|
60
|
+
message,
|
|
61
|
+
digest,
|
|
55
62
|
request,
|
|
56
63
|
context,
|
|
57
64
|
}),
|
|
@@ -64,10 +71,17 @@ export const onRequestError: Instrumentation.onRequestError = async (
|
|
|
64
71
|
|
|
65
72
|
```js filename="instrumentation.js" switcher
|
|
66
73
|
export async function onRequestError(err, request, context) {
|
|
74
|
+
const message = err instanceof Error ? err.message : String(err)
|
|
75
|
+
const digest =
|
|
76
|
+
typeof err === 'object' && err !== null && 'digest' in err
|
|
77
|
+
? String(err.digest)
|
|
78
|
+
: undefined
|
|
79
|
+
|
|
67
80
|
await fetch('https://.../report-error', {
|
|
68
81
|
method: 'POST',
|
|
69
82
|
body: JSON.stringify({
|
|
70
|
-
message
|
|
83
|
+
message,
|
|
84
|
+
digest,
|
|
71
85
|
request,
|
|
72
86
|
context,
|
|
73
87
|
}),
|
|
@@ -84,7 +98,7 @@ The function accepts three parameters: `error`, `request`, and `context`.
|
|
|
84
98
|
|
|
85
99
|
```ts filename="Types"
|
|
86
100
|
export function onRequestError(
|
|
87
|
-
error:
|
|
101
|
+
error: unknown,
|
|
88
102
|
request: {
|
|
89
103
|
path: string // resource path, e.g. /blog?name=foo
|
|
90
104
|
method: string // request method. e.g. GET, POST, etc
|
|
@@ -104,7 +118,7 @@ export function onRequestError(
|
|
|
104
118
|
): void | Promise<void>
|
|
105
119
|
```
|
|
106
120
|
|
|
107
|
-
- `error`: The caught
|
|
121
|
+
- `error`: The caught value is typed as `unknown`. Narrow it before reading properties like `message` or `digest`.
|
|
108
122
|
- `request`: Read-only request information associated with the error.
|
|
109
123
|
- `context`: The context in which the error occurred. This can be the type of router (App or Pages Router), and/or (Server Components (`'render'`), Route Handlers (`'route'`), Server Actions (`'action'`), or Proxy (`'proxy'`)).
|
|
110
124
|
|
|
@@ -91,10 +91,11 @@ The order Next.js routes are checked is:
|
|
|
91
91
|
1. [headers](/docs/app/api-reference/config/next-config-js/headers) are checked/applied
|
|
92
92
|
2. [redirects](/docs/app/api-reference/config/next-config-js/redirects) are checked/applied
|
|
93
93
|
3. [proxy](/docs/app/api-reference/file-conventions/proxy)
|
|
94
|
-
4. `beforeFiles` rewrites
|
|
94
|
+
4. `beforeFiles` rewrites: for each entry, if `source`, `has`, and `missing` matches the request, it's rewritten to `destination`.
|
|
95
95
|
5. static files from the [public directory](/docs/app/api-reference/file-conventions/public-folder), `_next/static` files, and non-dynamic pages are checked/served
|
|
96
|
-
6. `afterFiles` rewrites are
|
|
97
|
-
7.
|
|
96
|
+
6. `afterFiles` rewrites are tried in order. If a `source`, `has`, and `missing` matches the request, it's rewritten to `destination`; the first rewrite that resolves to a static file, page, or dynamic route is served.
|
|
97
|
+
7. dynamic routes (e.g., `app/blog/[slug]/page.tsx`) are matched against the current path
|
|
98
|
+
8. `fallback` rewrites are checked/applied, these are applied before rendering the 404 page and after dynamic routes/all static assets have been checked. If you use [fallback: true/'blocking'](/docs/pages/api-reference/functions/get-static-paths#fallback-true) in `getStaticPaths`, those dynamic routes take priority over the fallback `rewrites` defined in your `next.config.js`.
|
|
98
99
|
|
|
99
100
|
</AppOnly>
|
|
100
101
|
|
|
@@ -102,10 +103,11 @@ The order Next.js routes are checked is:
|
|
|
102
103
|
|
|
103
104
|
1. [headers](/docs/pages/api-reference/config/next-config-js/headers) are checked/applied
|
|
104
105
|
2. [redirects](/docs/pages/api-reference/config/next-config-js/redirects) are checked/applied
|
|
105
|
-
3. `beforeFiles` rewrites
|
|
106
|
+
3. `beforeFiles` rewrites: for each entry, if `source` matches the request, it's rewritten to `destination`.
|
|
106
107
|
4. static files from the [public directory](/docs/pages/api-reference/file-conventions/public-folder), `_next/static` files, and non-dynamic pages are checked/served
|
|
107
|
-
5. `afterFiles` rewrites are
|
|
108
|
-
6.
|
|
108
|
+
5. `afterFiles` rewrites are tried in order. If a `source` matches the request, it's rewritten to `destination`; the first rewrite that resolves to a static file, page, or dynamic route is served.
|
|
109
|
+
6. dynamic routes (e.g., `pages/blog/[slug].tsx`) are matched against the current path
|
|
110
|
+
7. `fallback` rewrites are checked/applied, these are applied before rendering the 404 page and after dynamic routes/all static assets have been checked. If you use [fallback: true/'blocking'](/docs/pages/api-reference/functions/get-static-paths#fallback-true) in `getStaticPaths`, the fallback `rewrites` defined in your `next.config.js` will _not_ be run.
|
|
109
111
|
|
|
110
112
|
</PagesOnly>
|
|
111
113
|
|
|
@@ -39,6 +39,8 @@ module.exports = {
|
|
|
39
39
|
}
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
+
The limit applies to the raw HTTP request body, including the bytes that `multipart/form-data` adds for boundaries, part headers, and field metadata. If you expect uploads close to the configured value, leave some room for this overhead. For typical multipart uploads, an additional 10–20 KB is a reasonable rule of thumb.
|
|
43
|
+
|
|
42
44
|
## Enabling Server Actions (v13)
|
|
43
45
|
|
|
44
46
|
Server Actions became a stable feature in Next.js 14, and are enabled by default. However, if you are using an earlier version of Next.js, you can enable them by setting `experimental.serverActions` to `true`.
|
|
@@ -1,21 +1,33 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: transpilePackages
|
|
3
|
-
description:
|
|
3
|
+
description: Transpile and bundle dependencies from monorepo workspace packages or `node_modules` libraries that ship TypeScript, JSX, or modern syntax.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
{/* The content of this doc is shared between the app and pages router. You can use the `<PagesOnly>Content</PagesOnly>` component to add content that is specific to the Pages Router. Any shared content should not be wrapped in a component. */}
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Use `transpilePackages` to compile and bundle a dependency instead of treating it as untouched runtime code. Values are package names, including scoped names like `@scope/pkg`. Paths and glob patterns are not supported.
|
|
9
9
|
|
|
10
10
|
```js filename="next.config.js"
|
|
11
11
|
/** @type {import('next').NextConfig} */
|
|
12
12
|
const nextConfig = {
|
|
13
|
-
transpilePackages: ['package-name'],
|
|
13
|
+
transpilePackages: ['package-name', '@scope/pkg'],
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
module.exports = nextConfig
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
+
This replaces the `next-transpile-modules` package.
|
|
20
|
+
|
|
21
|
+
## When you need it
|
|
22
|
+
|
|
23
|
+
Turbopack transpiles workspace packages (npm, pnpm, or Yarn workspaces) in your monorepo automatically under both routers. Webpack does the same for the App Router. Add a package to `transpilePackages` when:
|
|
24
|
+
|
|
25
|
+
- **A `node_modules` dependency ships raw TypeScript or JSX.** Next.js does not compile code inside `node_modules` by default. Listing the package opts it in, or you can build the package to plain JavaScript and point its `main`/`exports` at the compiled output.
|
|
26
|
+
- **You build with webpack for the Pages Router and the dependency's source lives outside the next app's directory.** For example, an `apps/web` app importing `packages/ui` in the same monorepo.
|
|
27
|
+
- **You use the Pages Router and want a `node_modules` dependency bundled into the route.** Pages Router loads `node_modules` server-side dependencies through Node.js `require` at runtime. List the package to bundle its source into the route instead. App Router already bundles Server Component and Route Handler dependencies unless the package is listed in [`serverExternalPackages`](/docs/app/api-reference/config/next-config-js/serverExternalPackages).
|
|
28
|
+
|
|
29
|
+
> **Good to know**: A package cannot appear in both `transpilePackages` and [`serverExternalPackages`](/docs/app/api-reference/config/next-config-js/serverExternalPackages); Next.js throws at build start if it does. Packages listed in [`optimizePackageImports`](/docs/app/api-reference/config/next-config-js/optimizePackageImports) and the entries in [`default-transpiled-packages.json`](https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/default-transpiled-packages.json) are added automatically; you do not need to repeat them.
|
|
30
|
+
|
|
19
31
|
## Version History
|
|
20
32
|
|
|
21
33
|
| Version | Changes |
|
|
@@ -88,7 +88,7 @@ Running `next dev`, `next build`, or [`next typegen`](/docs/app/api-reference/cl
|
|
|
88
88
|
|
|
89
89
|
> **Good to know**:
|
|
90
90
|
>
|
|
91
|
-
> -
|
|
91
|
+
> - `next-env.d.ts` is managed by Next.js. Its contents are an implementation detail and may change over time. Add it to `.gitignore`. If your project already tracks the file, remove it from Git. Do not edit this file manually.
|
|
92
92
|
> - The file must be in your `tsconfig.json` `include` array (`create-next-app` does this automatically).
|
|
93
93
|
|
|
94
94
|
## Examples
|
|
@@ -223,7 +223,7 @@ The default component type in the App Router. Server Components render on the se
|
|
|
223
223
|
|
|
224
224
|
## Server Action
|
|
225
225
|
|
|
226
|
-
A [Server Function](#server-function) that is passed to a Client Component as a prop or bound to a form action. Server Actions are commonly used for form submissions and data mutations. Learn more in [Server Actions and Mutations](/docs/app/
|
|
226
|
+
A [Server Function](#server-function) that is passed to a Client Component as a prop or bound to a form action. Server Actions are commonly used for form submissions and data mutations. Learn more in [Server Actions and Mutations](/docs/app/guides/server-actions).
|
|
227
227
|
|
|
228
228
|
## Server Function
|
|
229
229
|
|
|
@@ -50,7 +50,7 @@ Next.js now uses the Rust-based compiler [SWC](https://swc.rs/) to compile JavaS
|
|
|
50
50
|
|
|
51
51
|
Next.js provides full backward compatibility with applications that have [custom Babel configuration](/docs/pages/guides/babel). All transformations that Next.js handles by default like styled-jsx and tree-shaking of `getStaticProps` / `getStaticPaths` / `getServerSideProps` have been ported to Rust.
|
|
52
52
|
|
|
53
|
-
When an application has a custom Babel configuration, Next.js will automatically opt-out of using SWC for compiling JavaScript/
|
|
53
|
+
When an application has a custom Babel configuration, Next.js will automatically opt-out of using SWC for compiling JavaScript/TypeScript and will fall back to using Babel in the same way that it was used in Next.js 11.
|
|
54
54
|
|
|
55
55
|
Many of the integrations with external libraries that currently require custom Babel transformations will be ported to Rust-based SWC transforms in the near future. These include but are not limited to:
|
|
56
56
|
|
|
@@ -34,7 +34,7 @@ The docs are written in [MDX](https://mdxjs.com/), a markdown format that suppor
|
|
|
34
34
|
|
|
35
35
|
VSCode has a built-in markdown previewer that you can use to see your edits locally. To enable the previewer for MDX files, you'll need to add a configuration option to your user settings.
|
|
36
36
|
|
|
37
|
-
Open the command palette (`⌘ + ⇧ + P` on Mac or `Ctrl + Shift + P` on Windows) and search
|
|
37
|
+
Open the command palette (`⌘ + ⇧ + P` on Mac or `Ctrl + Shift + P` on Windows) and search for `Preferences: Open User Settings (JSON)`.
|
|
38
38
|
|
|
39
39
|
Then, add the following line to your `settings.json` file:
|
|
40
40
|
|
|
@@ -396,7 +396,7 @@ While we don't have a strict template for pages, there are page sections you'll
|
|
|
396
396
|
- **Overview:** The first paragraph of a page should tell the user what the feature is and what it's used for. Followed by a minimum working example or its API reference.
|
|
397
397
|
- **Convention:** If the feature has a convention, it should be explained here.
|
|
398
398
|
- **Examples**: Show how the feature can be used with different use cases.
|
|
399
|
-
- **API Tables**: API Pages should have an overview table at the of the page with jump-to-section links (when possible).
|
|
399
|
+
- **API Tables**: API Pages should have an overview table at the top of the page with jump-to-section links (when possible).
|
|
400
400
|
- **Next Steps (Related Links)**: Add links to related pages to guide the user's learning journey.
|
|
401
401
|
|
|
402
402
|
Feel free to add these sections as needed.
|
package/dist/docs/index.md
CHANGED
|
@@ -8,8 +8,6 @@ related:
|
|
|
8
8
|
- app/getting-started
|
|
9
9
|
---
|
|
10
10
|
|
|
11
|
-
{/* AI agent hint: If fixing slow client-side navigations, Suspense alone is not enough. You must also export `unstable_instant` from the route. Read docs/01-app/02-guides/instant-navigation.mdx before making changes. */}
|
|
12
|
-
|
|
13
11
|
Welcome to the Next.js documentation!
|
|
14
12
|
|
|
15
13
|
## What is Next.js?
|
package/dist/esm/build/index.js
CHANGED
|
@@ -333,7 +333,7 @@ export default async function build(dir, experimentalAnalyze = false, reactProdu
|
|
|
333
333
|
try {
|
|
334
334
|
const nextBuildSpan = trace('next-build', undefined, {
|
|
335
335
|
buildMode: experimentalBuildMode,
|
|
336
|
-
version: "16.2.
|
|
336
|
+
version: "16.2.10",
|
|
337
337
|
...enabledFeatures
|
|
338
338
|
});
|
|
339
339
|
NextBuildContext.nextBuildSpan = nextBuildSpan;
|
|
@@ -769,7 +769,7 @@ export default async function build(dir, experimentalAnalyze = false, reactProdu
|
|
|
769
769
|
// Files outside of the distDir can be "type": "module"
|
|
770
770
|
await writeFileUtf8(path.join(distDir, 'package.json'), '{"type": "commonjs"}');
|
|
771
771
|
// These are written to distDir, so they need to come after creating and cleaning distDr.
|
|
772
|
-
await recordFrameworkVersion("16.2.
|
|
772
|
+
await recordFrameworkVersion("16.2.10");
|
|
773
773
|
await updateBuildDiagnostics({
|
|
774
774
|
buildStage: 'start'
|
|
775
775
|
});
|
|
@@ -2497,7 +2497,7 @@ export default async function build(dir, experimentalAnalyze = false, reactProdu
|
|
|
2497
2497
|
configOutDir: path.join(dir, configOutDir),
|
|
2498
2498
|
staticPages,
|
|
2499
2499
|
serverPropsPages,
|
|
2500
|
-
nextVersion: "16.2.
|
|
2500
|
+
nextVersion: "16.2.10",
|
|
2501
2501
|
tracingRoot: outputFileTracingRoot,
|
|
2502
2502
|
hasNodeMiddleware,
|
|
2503
2503
|
hasInstrumentationHook,
|
|
@@ -10,7 +10,7 @@ export var HmrTarget = /*#__PURE__*/ function(HmrTarget) {
|
|
|
10
10
|
HmrTarget["Server"] = "server";
|
|
11
11
|
return HmrTarget;
|
|
12
12
|
}({});
|
|
13
|
-
const nextVersion = "16.2.
|
|
13
|
+
const nextVersion = "16.2.10";
|
|
14
14
|
const ArchName = arch();
|
|
15
15
|
const PlatformName = platform();
|
|
16
16
|
function infoLog(...args) {
|
|
@@ -66,7 +66,7 @@ export async function turbopackAnalyze(analyzeContext) {
|
|
|
66
66
|
writeRoutesHashesManifest: false,
|
|
67
67
|
currentNodeJsVersion,
|
|
68
68
|
isPersistentCachingEnabled: persistentCaching,
|
|
69
|
-
nextVersion: "16.2.
|
|
69
|
+
nextVersion: "16.2.10"
|
|
70
70
|
}, {
|
|
71
71
|
memoryLimit: (_config_experimental2 = config.experimental) == null ? void 0 : _config_experimental2.turbopackMemoryLimit,
|
|
72
72
|
dependencyTracking: persistentCaching,
|
|
@@ -83,7 +83,7 @@ export async function turbopackBuild() {
|
|
|
83
83
|
currentNodeJsVersion,
|
|
84
84
|
isPersistentCachingEnabled: persistentCaching,
|
|
85
85
|
deferredEntries: config.experimental.deferredEntries,
|
|
86
|
-
nextVersion: "16.2.
|
|
86
|
+
nextVersion: "16.2.10"
|
|
87
87
|
};
|
|
88
88
|
const sharedTurboOptions = {
|
|
89
89
|
memoryLimit: (_config_experimental1 = config.experimental) == null ? void 0 : _config_experimental1.turbopackMemoryLimit,
|
|
@@ -1630,7 +1630,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
1630
1630
|
isClient && new CopyFilePlugin({
|
|
1631
1631
|
// file path to build output of `@next/polyfill-nomodule`
|
|
1632
1632
|
filePath: require.resolve('./polyfills/polyfill-nomodule'),
|
|
1633
|
-
cacheKey: "16.2.
|
|
1633
|
+
cacheKey: "16.2.10",
|
|
1634
1634
|
name: `static/chunks/polyfills${dev ? '' : '-[hash]'}.js`,
|
|
1635
1635
|
minimize: false,
|
|
1636
1636
|
info: {
|
|
@@ -1824,7 +1824,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
1824
1824
|
// - Next.js location on disk (some loaders use absolute paths and some resolve options depend on absolute paths)
|
|
1825
1825
|
// - Next.js version
|
|
1826
1826
|
// - next.config.js keys that affect compilation
|
|
1827
|
-
version: `${__dirname}|${"16.2.
|
|
1827
|
+
version: `${__dirname}|${"16.2.10"}|${configVars}`,
|
|
1828
1828
|
cacheDirectory: path.join(distDir, 'cache', 'webpack'),
|
|
1829
1829
|
// For production builds, it's more efficient to compress all cache files together instead of compression each one individually.
|
|
1830
1830
|
// So we disable compression here and allow the build runner to take care of compressing the cache as a whole.
|
|
@@ -1880,7 +1880,7 @@ export default async function getBaseWebpackConfig(dir, { buildId, encryptionKey
|
|
|
1880
1880
|
type: 'filesystem',
|
|
1881
1881
|
directory: cache.cacheDirectory
|
|
1882
1882
|
},
|
|
1883
|
-
version: `${__dirname}|${"16.2.
|
|
1883
|
+
version: `${__dirname}|${"16.2.10"}|${configVars}`
|
|
1884
1884
|
};
|
|
1885
1885
|
}
|
|
1886
1886
|
if (process.env.NEXT_WEBPACK_LOGGING) {
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* - next/script with `beforeInteractive` strategy
|
|
6
6
|
*/ import { getAssetPrefix } from './asset-prefix';
|
|
7
7
|
import { setAttributesFromProps } from './set-attributes-from-props';
|
|
8
|
-
const version = "16.2.
|
|
8
|
+
const version = "16.2.10";
|
|
9
9
|
window.next = {
|
|
10
10
|
version,
|
|
11
11
|
appDir: true
|
package/dist/esm/client/index.js
CHANGED
|
@@ -25,7 +25,7 @@ import { SearchParamsContext, PathParamsContext } from '../shared/lib/hooks-clie
|
|
|
25
25
|
import { onRecoverableError } from './react-client-callbacks/on-recoverable-error';
|
|
26
26
|
import tracer from './tracing/tracer';
|
|
27
27
|
import { isNextRouterError } from './components/is-next-router-error';
|
|
28
|
-
export const version = "16.2.
|
|
28
|
+
export const version = "16.2.10";
|
|
29
29
|
export let router;
|
|
30
30
|
export const emitter = mitt();
|
|
31
31
|
const looseToArray = (input)=>[].slice.call(input);
|
|
@@ -17,7 +17,7 @@ async function fetchPkgInfo(pkg) {
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
const data = await res.json();
|
|
20
|
-
const versionData = data.versions["16.2.
|
|
20
|
+
const versionData = data.versions["16.2.10"];
|
|
21
21
|
return {
|
|
22
22
|
os: versionData.os,
|
|
23
23
|
cpu: versionData.cpu,
|
|
@@ -50,7 +50,7 @@ async function fetchPkgInfo(pkg) {
|
|
|
50
50
|
const expectedSwcPkgs = Object.keys(nextOptionalDeps || {}).filter((pkg)=>pkg.startsWith('@next/swc-'));
|
|
51
51
|
const patchDependency = (pkg, pkgData)=>{
|
|
52
52
|
lockfileParsed.dependencies[pkg] = {
|
|
53
|
-
version: "16.2.
|
|
53
|
+
version: "16.2.10",
|
|
54
54
|
resolved: pkgData.tarball,
|
|
55
55
|
integrity: pkgData.integrity,
|
|
56
56
|
optional: true
|
|
@@ -58,7 +58,7 @@ async function fetchPkgInfo(pkg) {
|
|
|
58
58
|
};
|
|
59
59
|
const patchPackage = (pkg, pkgData)=>{
|
|
60
60
|
lockfileParsed.packages[pkg] = {
|
|
61
|
-
version: "16.2.
|
|
61
|
+
version: "16.2.10",
|
|
62
62
|
resolved: pkgData.tarball,
|
|
63
63
|
integrity: pkgData.integrity,
|
|
64
64
|
cpu: pkgData.cpu,
|
|
@@ -184,7 +184,7 @@ export async function createHotReloaderTurbopack(opts, serverFields, distDir, re
|
|
|
184
184
|
}
|
|
185
185
|
const hasRewrites = opts.fsChecker.rewrites.afterFiles.length > 0 || opts.fsChecker.rewrites.beforeFiles.length > 0 || opts.fsChecker.rewrites.fallback.length > 0;
|
|
186
186
|
const hotReloaderSpan = trace('hot-reloader', undefined, {
|
|
187
|
-
version: "16.2.
|
|
187
|
+
version: "16.2.10"
|
|
188
188
|
});
|
|
189
189
|
// Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
|
|
190
190
|
// of the current `next dev` invocation.
|
|
@@ -238,7 +238,7 @@ export async function createHotReloaderTurbopack(opts, serverFields, distDir, re
|
|
|
238
238
|
writeRoutesHashesManifest: false,
|
|
239
239
|
currentNodeJsVersion,
|
|
240
240
|
isPersistentCachingEnabled: isFileSystemCacheEnabledForDev(opts.nextConfig),
|
|
241
|
-
nextVersion: "16.2.
|
|
241
|
+
nextVersion: "16.2.10",
|
|
242
242
|
serverHmr: serverFastRefresh
|
|
243
243
|
}, {
|
|
244
244
|
memoryLimit: (_opts_nextConfig_experimental = opts.nextConfig.experimental) == null ? void 0 : _opts_nextConfig_experimental.turbopackMemoryLimit,
|
|
@@ -166,7 +166,7 @@ export default class HotReloaderWebpack {
|
|
|
166
166
|
this.previewProps = previewProps;
|
|
167
167
|
this.rewrites = rewrites;
|
|
168
168
|
this.hotReloaderSpan = trace('hot-reloader', undefined, {
|
|
169
|
-
version: "16.2.
|
|
169
|
+
version: "16.2.10"
|
|
170
170
|
});
|
|
171
171
|
// Ensure the hotReloaderSpan is flushed immediately as it's the parentSpan for all processing
|
|
172
172
|
// of the current `next dev` invocation.
|