- 13 Feb, 2026 4 commits
-
-
nextjs-bot authored
-
Will Binns-Smith authored
This fixes a bug introduced in d77eb040 where installCompressedModuleFactories would skip installing factories for an entire group of module IDs if any ID in the group already had a factory registered. Test Plan: build https://github.com/vercel/workflow/tree/main/workbench/nextjs-turbopack
-
Matt Mastracci authored
## What Add a `#[derive(ValueToString)]` proc macro and convert ~45 manual `ValueToString` implementations across turbopack crates to use it (-660 lines of boilerplate, 49 files touched). ## Why Nearly every `ValueToString` impl follows the same pattern: format some fields into a string, possibly awaiting `Vc` values first. These hand-written impls are noisy boilerplate that obscure the actual format string. ## How The derive macro generates the `#[turbo_tasks::value_impl] impl ValueToString` block automatically. A helper trait `ValueToStringify` with a blanket impl for `Display` and specializations for `Vc<T>`/`ResolvedVc<T>` handles async resolution of fields. ### Supported forms - **No attribute** — delegates to `Display::to_string(&self)` - `#[value_to_string("constant")]` — emits `rcstr!` directly - `#[value_to_string("{field} text {other_field}")]` — auto-resolves named/positional fields via `ValueToStringify` - `#[value_to_string("fmt {}", expr1, expr2)]` — explicit expressions as format args - `#[value_to_string(expr)]` — single expression delegation Enums support per-variant attributes (defaulting to variant name) or a single top-level attribute. -
Joseph authored
- use experimental versioning - fix spacing for graphs - spacing in [!NOTE]
-
- 12 Feb, 2026 20 commits
-
-
nextjs-bot authored
-
Luke Sandberg authored
Add a more direct error message when next is running on a platform that turbopack doesn't support document supported turbopack platforms ## Testing To test i just set `NEXT_TEST_WASM=1` and ran a build ``` Error: Turbopack is not supported on this platform (darwin/arm64) because native bindings are not available. Only WebAssembly (WASM) bindings were loaded, and Turbopack requires native bindings. To use Next.js on this platform, use Webpack instead: next dev --webpack For more information, see: https://nextjs.org/docs/app/api-reference/turbopack#supported-platforms at ignore-listed frames ``` so it should work. Messaging probably could be better (there is also a messge about not being able to set the lockfile) but this should be much better Fixes #89305
-
nextjs-bot authored
-
nextjs-bot authored
-
Will Binns-Smith authored
This includes the set of experimental flag states in events sent to the trace upload receiver when `--experimental-trace-upload` is set. It only includes a subset of experimental flags (so things like the trace upload flag itself isn't meaninglessly sent). Since reporting is often limited to the scope of a single span, the flag state attributes are denormalized and copied onto every descendent span. Limiting the set of flags prevents this from being unnecessarily large. Test Plan: Added `test/development` test and built an app and verified these tags are sent with `NEXT_TRACE_UPLOAD_DEBUG` --------- Co-authored-by:
vercel[bot] <35613825+vercel[bot]@users.noreply.github.com> Co-authored-by:
Luke Sandberg <lukesandberg@users.noreply.github.com>
-
Andreas Lubbe authored
## Summary Fixes dev-time memory retention in `fast-set-immediate` caused by module re-evaluation chaining patched globals. ## Root Cause In dev/HMR, `fast-set-immediate.external` can be re-evaluated multiple times. On each evaluation, it captured `globalThis.setImmediate`, `globalThis.clearImmediate`, and `process.nextTick` as “originals”. If those were already patched, new patched closures referenced older patched closures, retaining old module graphs. I have 2GB local heapdump from a few minutes before the local dev server crashed OOM that looks like this because of it: <img width="632" height="253" alt="Screenshot 2026-02-10 at 18 49 24" src="https://github.com/user-attachments/assets/8162b042-ae5a-4289-9166-b11d6374a57a" /> ## What Changed - Added a process-wide sentinel of base/original timer functions on `globalThis`: - `Symbol.for('next.fast-set-immediate.originals')` - `originalSetImmediate`, `originalClearImmediate`, and `originalNextTick` now always resolve from that base sentinel, not from currently patched globals. - Kept the existing patch behavior/API surface: - `install()` still runs at module load - `DANGEROUSLY_runPendingImmediatesAfterCurrentTask`, `expectNoPendingImmediates`, and `unpatchedSetImmediate` exports remain available ## Tests `module re-evaluation` test now verifies `unpatchedSetImmediate` remains bound to the same base/original function across repeated `jest.resetModules()` reloads, and is not rebound to the previously patched global.
-
Janka Uryga authored
In dev validation, we're disassembling a payload from a dynamic render. If the request had search params, page segments in the router state will have them attached: `__PAGE__?{"q":"123"}`. In `findNavigationsToValidate`, we do the equivalent of constructing a flightRouterState, so we need to match that, otherwise we'll name the segment `__PAGE__` instead and then can't look it up in the cache, and crash during validation. -
Luke Sandberg authored
## Summary Changes `UrlBehavior.static_suffix` from `Option<RcStr>` to `ResolvedVc<Option<RcStr>>` so that `css_url_suffix` stays as a Vc longer instead of being eagerly resolved at the call site. This improves caching behavior by keeping the value cell-based through the chunking context construction. - Updated `UrlBehavior` struct definition in `turbopack-core` - Updated default fallbacks in browser/nodejs chunking contexts - Updated CSS url reference consumer to `.await?` the `ResolvedVc` - Replaced `.owned().await?` with `.to_resolved().await?` in next-core callers
-
nextjs-bot authored
-
Matt Mastracci authored
# What Removes the vast majority of `ChunkItem` implementations in favour of one `EcmascriptModuleChunkItem`. # Why Almost all of the `ChunkItem` implementations are trivial and were, for the most part, just places where additional traits could be implemented. By removing all of the various, trivial implementations, this might open up opportunities to better implement other features across the entire codebase. # How Most chunk items are migrated over to EcmascriptModuleChunkItem. The EcmascriptChunkPlaceable trait gains three new methods that modules can optionally override: - `chunk_item_content()` - generates the chunk item's JavaScript code - `chunk_item_content_ident()` - returns the content identity for cache invalidation - `chunk_item_output_assets()` - returns output assets the chunk item depends on The generic EcmascriptModuleChunkItem delegates to these trait methods, eliminating the need for per-module wrapper structs.
-
Tobias Koppers authored
## Summary - Pass `asset_suffix_path` as `Vc<Option<RcStr>>` instead of eagerly resolving it to `Option<RcStr>` in the chunking context option structs - Add filesystem cache size growth assertions to e2e tests to detect unbounded cache growth regressions ## Why Previously, `css_url_suffix` was eagerly awaited in `project.rs` before being passed into `ClientChunkingContextOptions`, `ServerChunkingContextOptions`, and `EdgeChunkingContextOptions`. This caused a new chunking context `Vc` to be created for every build, duplicating the entire build in cache and recompiling it. By keeping it as a `Vc`, the chunking context identity is stable across builds, preventing unnecessary cache duplication. ## How - Changed `css_url_suffix` field from `Option<RcStr>` to `Vc<Option<RcStr>>` in all three chunking context option structs - Removed `.owned().await?.clone()` in `project.rs` (3 call sites), passing the `Vc` directly - Added `.owned().await?` at the point of use in the 5 context builder functions - Added cache size measurements to `filesystem-cache.test.ts`: normal changes limited to 10% growth, renames allow up to 50% due to dead cache entries
-
Joseph authored
Closes: https://linear.app/vercel/issue/DOC-3953/encryption-keys-in-server-actions, https://linear.app/vercel/issue/DOC-4975/next-server-actions-encryption-key-and-deploymentid Closes https://github.com/vercel/next.js/discussions/88327 --------- Co-authored-by:
Allen Zhou <46854522+allenzhou101@users.noreply.github.com>
-
Sebastian "Sebbie" Silbermann authored
Just plumbing and enabling that flag in the experimental shards. The flag will enable our Layout router to use Fragment refs for scroll restoration. Implementation will be done in a follow-up.
-
Sebastian "Sebbie" Silbermann authored
Just removing some unnecessary runtime checks and typecasts to make future diffs smaller.
-
Tobias Koppers authored
Store task error as pointer to the source error <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # -->
-
Vercel Release Bot authored
This auto-generated PR updates the development integration test manifest used when testing Rspack.
-
JJ Kasper authored
## Summary - apply the same deploy query-suffix tolerance (`(?:\?.*)?`) to related e2e background-image URL assertions - update SCSS URL tests (`url-global-partial`, `url-global-asset-prefix-1`, `url-global-asset-prefix-2`) and `url-imports` CSS background-image assertion ## Context - follow-up to #89856, which applied this fix to `url-global` ## Verification - regex sanity checks with and without query suffixes passed - attempted local `testonly` run for `url-imports`, but local Turbopack+urlImports limitations caused unrelated failures
-
Andrew Imm authored
Solves #78609 Today, Turbopack maps `app/sitemap.ts` to an AppPage of `/sitemap/route`, and `app/sitemap/page.tsx` maps to `/sitemap/page`, which leads to a conflict. This treats sitemap.xml the same way as robots.txt and site.webmanifest, and puts the xml extension in the AppPage, and not later in the path resolution. This creates an AppPage of `/sitemap.xml/route` which no longer conflicts. This is pretty much what webpack was doing. Because the page segment is now sitemap.xml, I had to update downstream logic for routes that export sitemap / generateSitemap. The turbopack-utils is needed for dynamic sitemap routes like the example here: https://nextjs.org/docs/app/api-reference/file-conventions/metadata/sitemap#generating-multiple-sitemaps In that setup, when a request for /product/sitemap/1.xml comes in, the "multiple" matcher matches and definition.page is "/product/sitemap/[__metadata_id__]/route". This becomes the page in the hot reloader. After that, normalizedPageToTurbopackStructureRoute strips [__metadata_id__] and it becomes /products/sitemap, but our updated Rust key is now /products/sitemap.xml/route... so add back the .xml! My demo app tests four things in parallel: 1) app/sitemap.ts renders at /sitemap.xml 2) app/sitemap/page.tsx renders at /sitemap and the two do not conflict 3) app/product/sitemap.ts works when generating a static sitemap (/product/sitemap.xml) 4) app/product/sitemap.ts works when generating a dynamic sitemapo (/product/sitemap/1.xml) as in the linked docs above Also I asked Claude if I've fixed all the relevant codepaths, and here's its output: ``` Case 1: Single dynamic sitemap — app/products/sitemap.ts (no generateSitemaps) - Input page: /products/sitemap.xml/route, ext: .ts - Strip /route → /products/sitemap.xml - No [__metadata_id__] → skip - Doesn't end with /sitemap (ends with /sitemap.xml) → skip - Add /route → /products/sitemap.xml/route - Entry key: /products/sitemap.xml/route ✓ Case 2: Multi-dynamic sitemap — app/products/sitemap.ts with generateSitemaps - Input page: /products/sitemap/[__metadata_id__]/route, ext: .ts - Strip /route → /products/sitemap/[__metadata_id__] - Strip [__metadata_id__] → /products/sitemap - Ends with /sitemap and ext .ts ≠ .xml → add .xml → /products/sitemap.xml - Add /route → /products/sitemap.xml/route - Entry key: /products/sitemap.xml/route ✓ Case 3: Static sitemap — app/sitemap.xml - Input page: /sitemap.xml/route, ext: .xml - Strip /route → /sitemap.xml - No [__metadata_id__] → skip - ext IS .xml → skip .xml addition - Add /route → /sitemap.xml/route - Entry key: /sitemap.xml/route ✓ Case 4: Non-sitemap metadata — app/opengraph-image.tsx - Input page: /opengraph-image/route, ext: .tsx - Strip /route → /opengraph-image - No [__metadata_id__] → skip - Doesn't end with /sitemap → skip - Add /route → /opengraph-image/route ✓ Case 5: Non-sitemap multi-dynamic — app/opengraph-image.tsx with generateImageMetadata - Input page: /opengraph-image/[__metadata_id__]/route, ext: .tsx - Strip /route → /opengraph-image/[__metadata_id__] - Strip [__metadata_id__] → /opengraph-image - Doesn't end with /sitemap → skip - Add /route → /opengraph-image/route ✓ All cases produce the correct entry key. ``` Seems legit. Would still appreciate someone with more Next.js knowledge validating my assumptions
-
freek-boon-greenberry authored
<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # --> --------- Co-authored-by:
Joseph <sephxd1234@gmail.com> Co-authored-by:
vercel[bot] <35613825+vercel[bot]@users.noreply.github.com> Co-authored-by:
Joseph <joseph.chamochumbi@vercel.com>
-
Joseph authored
`browserToTerminal` stabilizes `browserDebugInfoInTerminal` - since it lives under logging, let's remove the page and redirect to logging w/ fragment
-
- 11 Feb, 2026 16 commits
-
-
Jimmy Lai authored
<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - [x] Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - [x] Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? Reworded the "With request APIs" section in the `after()` documentation. ### Why? To clearly differentiate when `cookies()` and `headers()` can be used inside `after()` in App Router pages (Server Components) versus Route Handlers/Server Functions, addressing potential confusion and potential runtime errors. ### How? - Split the "With request APIs" section into two subsections: "In Route Handlers and Server Functions" and "In Server Components (pages and layouts)". - Clarified that `cookies()`/`headers()` can be used directly in `after()` for Route Handlers/Server Functions. - Explained that `cookies()`/`headers()` *cannot* be used directly in `after()` for Server Components due to partial prerendering/Cache Components, and will throw a runtime error. - Added a new code example demonstrating the correct pattern for Server Components (reading request data *before* `after()` and passing it in). - Corrected `await` syntax in existing Route Handler examples and updated highlight line numbers. Closes NEXT- Fixes # --> --- [Slack Thread](https://vercel.slack.com/archives/C03KAR5DCKC/p1770819029314169?thread_ts=1770819029.314169&cid=C03KAR5DCKC) <p><a href="https://cursor.com/background-agent?bcId=bc-73042547-63d7-59b4-8f69-6e569308d2e9"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> <a href="https://cursor.com/agents?id=bc-73042547-63d7-59b4-8f69-6e569308d2e9"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a></p> --------- Co-authored-by:
Cursor Agent <cursoragent@cursor.com> Co-authored-by:
Joseph Chamochumbi <joseph.chamochumbi@vercel.com>
-
nextjs-bot authored
-
Benjamin Woodruff authored
We don't need this argument now that @lukesandberg switched us to inventory. We do still need some top-level macro and the `Registration` object to resolve the `test_config.trs` file relative to the currently-running test, though we could rename them if anyone thinks of a better name for it, now that it isn't doing function registration.
-
Will Binns-Smith authored
This implements the remainder of functionality needed for Server HMR (Fast Refresh). How It Works - Turbopack detects file changes in RSC modules - Rust sends HMR update payloads to the Node.js runtime via the existing chunk update system - A Node-specific HMR client evaluates changed modules using shared HMR runtime logic (extracted earlier in this stack) - Only modified modules are re-evaluated. Unmodified modules retain their state - Next.js hot-reloader forwards updates to RSC workers, triggering automatic re-renders in clients Test Plan: Added an e2e test confirming that unaffected modules don't get re-evaluated when others change.
-
JJ Kasper authored
## Summary - stabilize the hash navigation assertion in `navigation.test.ts` by checking for query-param-specific RSC requests instead of any RSC request - switch request header reads from `req.allHeaders()` to synchronous `req.headers()` in the request listener to avoid teardown timing errors - keep the existing behavior check that query-param navigation triggers an RSC request
-
JJ Kasper authored
Fixes deployment test failure from https://github.com/vercel/next.js/pull/89771 x-ref: https://github.com/vercel/next.js/actions/runs/21921362927/job/63302154502 ## Summary - update the SCSS `url-global` background-image assertion to allow optional query suffixes on emitted svg asset URLs - this handles deploy-mode URLs that include `?dpl=...` while keeping the existing path checks intact ## Verification - validated against deploy logs from failing job `63302154502`: URLs are correct and include `?dpl=...` - local run: `NEXT_SKIP_ISOLATE=1 NEXT_TEST_MODE=dev pnpm testonly test/e2e/app-dir/scss/url-global/url-global.test.ts` - `sass` case passed - `sass-embedded` case blocked locally by missing `sass-embedded` module in this environment
-
Jude Gao authored
AI coding agents often rely on outdated training data when working with Next.js projects, leading to hallucinated APIs and deprecated patterns. This PR addresses that by shipping version-matched documentation inside the `next` npm package and generating agent instruction files during `create-next-app`. During `next` build, a new `copy_docs` task copies `docs/` from the repo root into `dist/docs/`. Since `"dist"` is already in the package's `files` array, the docs are automatically published at `node_modules/next/dist/docs/`. `create-next-app` gains a new `--agents-md` / `--no-agents-md` flag (defaults to `true`). When enabled it writes two files: - `AGENTS.md` — instructs agents to read `node_modules/next/dist/docs/` instead of relying on training data - `CLAUDE.md` — uses `@AGENTS.md` import syntax for Claude Code The option appears in the recommended defaults display and is prompted during the customize flow. Existing tests are updated with `--no-agents-md` to avoid the new prompt.
-
Sebastian "Sebbie" Silbermann authored
-
Joseph authored
-
nextjs-bot authored
-
JJ Kasper authored
## Summary - update `experimental.adapterPath` docs to match current `onBuildComplete` shape (`routing`, `buildId`, and latest output types) - document `@next/routing` usage and note its experimental status - add runtime entrypoint signature details for Node.js and Edge (`handler(..., ctx)`) - add a new PPR implementation section with markdown flow diagrams for shell/resume stream composition and `requestMeta.onCacheEntryV2` cache updates - link to `nextjs/adapter-vercel` as the reference adapter example
-
Sebastian "Sebbie" Silbermann authored
Co-authored-by:
Cursor Agent <cursoragent@cursor.com> Co-authored-by:
Joseph Chamochumbi <joseph.chamochumbi@vercel.com>
-
Niklas Mischkulnig authored
In all of these cases, the only reason the prerender manifest was passed around was for the previewProps. So do that directly instead.
-
Hendrik Liebau authored
When links remount (e.g. toggling between tabs), the prefetch scheduler processes tasks across multiple async batches due to network bandwidth limits. Between batches, LRU cleanup could fire and evict cache entries for tasks that hadn't been processed yet. Those tasks would then see cache misses, fetch fresh data, push the LRU over the limit again, and trigger more cleanup, cascading through nearly all entries. We fix this by moving LRU cleanup into the prefetch scheduler loop. Instead of scheduling cleanup independently via `requestIdleCallback`/`setTimeout`, the LRU module pings the scheduler when the cache exceeds its size limit, and the scheduler runs cleanup only when it's fully idle (no queued tasks, no in-flight requests). At that point, all active prefetch tasks have finished reading from the cache, so eviction targets genuinely stale data. The tradeoff is that the cache can temporarily exceed its size limit while prefetch tasks are in flight. This was already the case since cleanup was always async, but it's now more explicit since cleanup is tied to the scheduler settling rather than the next idle callback.
-
Sebastian "Sebbie" Silbermann authored
-