- 13 Jul, 2026 10 commits
-
-
next-js-bot[bot] authored
-
Tobias Koppers authored
## Summary The graph-based CSS chunker's `linearize` step produces the global module order that `split_into_chunks` then cuts into chunks. It previously broke ties between ready modules using a weight-sorted stack. It now prefers the ready module that shares the most chunk groups with the previously placed module, so modules that are loaded together end up adjacent in the global order and split into better-aligned chunks. On a real world example this measurably lowers the modeled chunk-loading cost, with fewer requests and less over-fetched CSS. The shared-group count is read from edge weights (how many chunk groups two modules co-occur in). Since `make_acyclic` deletes edges to break cycles, it now returns the edges it cut so `linearize` can still count those conflicting-order co-occurrences — reconstructing the full co-occurrence without cloning the graph. ## Verification - `cargo test -p turbopack-core style_groups_graph::tests` (all pass) - Validated on a real world example that the resulting global order is deterministic and the modeled chunk-loading cost decreases. <!-- NEXT_JS_LLM_PR -->
-
Sebastian "Sebbie" Silbermann authored
-
Sebastian "Sebbie" Silbermann authored
Ensures the module graph is not bundled. Right now this has no effect since all the modules imported by `navigation-test-lock` have legit uses in prod builds. Also nice to not have to fork every single implementation inline.
-
Joseph authored
Sync the runtime prefetching guide with latest App Shell changes
-
Jimmy Lai authored
## What Adds `next experimental-diagnose` and an MCP `get_request_insights` tool so agents and local users can inspect Request Insights without opening the DevTools overlay. Stack: 1. request insights: record local framework spans (1/5) 2. request insights: derive request history and fetch data (2/5) 3. request insights: expose dev snapshots to tools and HMR (3/5) 4. request insights: add agent diagnosis access (4/5) ← current 5. request insights: add DevTools request panel (5/5) ## Review Focus - CLI error handling and raw JSON output. - MCP gating when Request Insights is unavailable. - Telemetry registration for the new MCP tool name. ## Proof In This PR - `pnpm jest packages/next/src/telemetry/events/mcp-telemetry.test.ts --runInBand` - `pnpm --filter=next types` - Stack-tip smoke verifies `next experimental-diagnose --url http://localhost:3003 --json` against a real dev server. ## Deferred Coverage - A more curated agent summary format is intentionally deferred until the raw private snapshot contract settles. <!-- NEXT_JS_LLM_PR --> --------- Co-authored-by:
Tim Neutkens <tim@timneutkens.nl>
-
Niklas Mischkulnig authored
The problem is that the adapter expected a `output.pages` for the `/404` route so that it can add these files to other Pages handlers so that they can render a 404 at runtime (getStaticProps with revaliate/getServerSideProps): https://github.com/nextjs/adapter-vercel/blob/650effd340b4f676a9bca6e0cdaba9bf7d34595a/packages/adapter/src/outputs.ts#L421-L438 https://github.com/nextjs/adapter-vercel/blob/650effd340b4f676a9bca6e0cdaba9bf7d34595a/packages/adapter/src/node-handler.ts#L331-L340 But this 404 Pages handler was not actually emitted if it was prerendered, where it only emitted the `/404.html` static file. But that's not what the adapter needs. Tests: 1. Run as an e2e test 2. Add a variant with dynamically rendered 404 pages Full e2e test run: ~~https://github.com/vercel/next.js/actions/runs/29081105397~~ https://github.com/vercel/next.js/actions/runs/29087851475 Closes NEXT-4947
-
Niklas Mischkulnig authored
When using `nextConfig.i18n`, then static files for `404.html` and `500.html` were added multiple times to the list. These duplicate entries in `outputs.staticFiles` ended up causing race conditions in the Vercel adapter because the same output file path was written concurrently by multiple file operations.
-
Vercel Release Bot authored
This auto-generated PR updates font data with latest available Co-authored-by:next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
-
Sebastian "Sebbie" Silbermann authored
Co-authored-by:Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
-
- 12 Jul, 2026 4 commits
-
-
next-js-bot[bot] authored
-
Jimmy Lai authored
## What Adds the `experimental.requestInsights` flag, a private dev snapshot endpoint, and HMR snapshot/update transport so running dev servers can expose recent request insights to tools and browser clients. Stack: 1. request insights: record local framework spans (1/5) 2. request insights: derive request history and fetch data (2/5) 3. request insights: expose dev snapshots to tools and HMR (3/5) ← current 4. request insights: add agent diagnosis access (4/5) 5. request insights: add DevTools request panel (5/5) ## Review Focus - Dev-only gating for `experimental.requestInsights`. - Private endpoint behavior when enabled and disabled. - HMR snapshot/update shape and client-side retention. ## Proof In This PR - `pnpm --filter=next types` - Stack-tip Cache Components smoke verifies the endpoint and HMR-fed overlay state against a running dev server. ## Deferred Coverage - A dedicated isolated dev-server transport test can follow if reviewers want cheaper per-PR coverage than the stack-tip smoke. <!-- NEXT_JS_LLM_PR --> --------- Co-authored-by:Tim Neutkens <tim@timneutkens.nl>
-
Jimmy Lai authored
## What Builds the bounded request history store on top of local spans and fetch metrics. Request Insights now keeps the last 100 requests, dedupes fetch records, and preserves raw span details for later verbose consumers. Stack: 1. request insights: record local framework spans (1/5) 2. request insights: derive request history and fetch data (2/5) ← current 3. request insights: expose dev snapshots to tools and HMR (3/5) 4. request insights: add agent diagnosis access (4/5) 5. request insights: add DevTools request panel (5/5) ## Review Focus - The request insight schema shared by server, tools, and DevTools. - Fetch cache/status mapping from existing `AppRender.fetch` spans. - Dedupe between completed fetch spans and direct fetch metrics. ## Proof In This PR - `pnpm jest packages/next/src/server/lib/trace/request-insights.test.ts packages/next/src/server/lib/patch-fetch.test.ts --runInBand` - `pnpm --filter=next types` ## Deferred Coverage - Browser/HMR transport, CLI/MCP access, and the visual panel are later PRs. <!-- NEXT_JS_LLM_PR --> --------- Co-authored-by:Tim Neutkens <tim@timneutkens.nl>
-
Jimmy Lai authored
## What Adds a dev-only local recorder for framework OTEL spans. This lets Next mirror span data into an in-memory store when local span capture is enabled, without requiring a user to run an OTEL provider. Stack: 1. request insights: record local framework spans (1/5) ← current 2. request insights: derive request history and fetch data (2/5) 3. request insights: expose dev snapshots to tools and HMR (3/5) 4. request insights: add agent diagnosis access (4/5) 5. request insights: add DevTools request panel (5/5) ## Review Focus - Local recorder behavior when no OTEL provider is installed. - Preserving existing OTEL span API behavior when a provider is installed. - Request identity propagation through existing app render async storage. ## Proof In This PR - `pnpm jest packages/next/src/server/lib/trace/tracer.test.ts packages/next/src/server/lib/trace/span-store.test.ts --runInBand` - `pnpm --filter=next types` ## Deferred Coverage - Request-level aggregation, fetch enrichment, dev transport, CLI/MCP access, and the DevTools panel are later PRs in this stack. <!-- NEXT_JS_LLM_PR --> --------- Co-authored-by:Tim Neutkens <tim@timneutkens.nl>
-
- 10 Jul, 2026 17 commits
-
-
next-js-bot[bot] authored
-
Will Binns-Smith authored
We forked test assertions in places in the early days of merging Turbopack. Now that we more closely align, a bunch of these had the exact same assertions. Fold them into one.
-
Sam Poder authored
Closes https://github.com/vercel/next.js/issues/95677. Added an e2e test that roughly matches the original issue and tests that it works.
-
Benjamin Woodruff authored
## Summary Documents the policy around AI-assisted contributions, for both humans and agents: - `.github/pull_request_template.md`: notes that AI use is encouraged for researching, creating, and reviewing changes, but contributors must deeply understand their contributions, and PR descriptions from external contributors must be written by a human. - `.github/ISSUE_TEMPLATE/1.bug_report.yml`: adds the equivalent note for bug reports — issue descriptions from external contributors must be written by a human, though AI may help create reproductions. - `AGENTS.md`: replaces the old "PR Descriptions" section with two new sections. "GitHub Pull Requests" distinguishes branch PRs (agents may write descriptions) from fork PRs targeting `vercel/next.js` (agents may not). "GitHub Issues, Comments, and Discussions" restricts agent-written issues, discussions, and comments to members of the `vercel`/`vercel-labs` GitHub orgs, tells agents how to check membership via the GitHub API, lists what agents can still help non-members with (drafting details, reviewing, reproductions, translation, searching for duplicates), and carves out exceptions (commenting on the user's own PR, Vercel-operated bots, GitHub/Graphite review bots, and forks of the repo). - Renames the LLM watermark marker from `NEXT_JS_LLM_PR` to `NEXT_JS_LLM` everywhere it appears (`AGENTS.md`, `contributing/repository/pull-request-descriptions.md`, and the `create-pr`/`backport-pr` skills), since it now also applies to issues, discussions, and comments. Nothing in the repo consumes the old marker name. - `.agents/skills/create-pr/SKILL.md`: adds a "Fork PRs vs Branch PRs" section referencing the `AGENTS.md` policy. Assorted typo fixes along the way. ## Verification - `gh api /user/memberships/orgs` and `gh api orgs/vercel/members/<login>` (confirmed the documented membership checks work and return the documented statuses) - Not run: no test/build commands (docs-only change; prettier applied via the pre-commit hook) <!-- NEXT_JS_LLM -->
-
Aurora Scharff authored
Adds a **Building** guide (`docs/01-app/02-guides/building.mdx`): what `next build` does, how to read the route table (`○` Static, `◐` Partial Prerender, `ƒ` Dynamic), prerendering dynamic routes with `generateStaticParams`, streaming request-time work, and debugging prerender errors. Also links the guide from the deploying page and the `next build` CLI reference.
-
Aurora Scharff authored
## Summary Adds a clear incremental adoption path to the Cache Components migration guide and reorganizes the workflow sections so they read in dependency order. - New **Adopting incrementally** section documenting the staged flow: enable the flag, opt routes out with `instant = false` (including the `cache-components-instant-false` codemod for a one-pass opt-out), fix synchronous IO, then convert routes one at a time. - Makes explicit that **synchronous IO cannot be deferred** by `instant = false` (it is an unconditional prerender build error), and documents the actual fix: move the call to request time via `<Suspense>` + `connection()` or a Client Component. Previously the guide only said to "fix it," implying every route could be deferred. - Groups the workflow sections (`Following validation`, `Opting out of validation`, `Adopting incrementally`) together before the per-API reference, instead of leaving them stranded in the middle of the reference list. - Cross-links the adoption skill's **Incremental** mode to the manual `Adopting incrementally` flow so readers see they are the same workflow, automated vs. by hand. ## Verification - `pnpm prettier --with-node-modules --ignore-path .prettierignore --write docs/01-app/02-guides/migrating-to-cache-components.mdx` (clean) - Verified the sync-IO behavior against source (`throwIfSyncIOUsed` runs before the `allowEmptyStaticShell` / `instant = false` gate in `dynamic-rendering.ts`). - All intra-page anchor links and the `cache-components-instant-false` codemod anchor confirmed to resolve. <!-- NEXT_JS_LLM_PR -->
-
Janka Uryga authored
This PR makes Sync IO behavior more restrictive when `partialPrefetching` is on (either globally or for a page). - Previously, we allowed `await cookies(); Date.now()` in in segments that won't ever be runtime prefetched. This was achieved by separating segments into "early" and "late" stages and only erroring in the "early" ones. - After this PR, it will always be an error to do sync IO anywhere other than after `io()`/`connection()`/uncached IO (i.e. outside the Dynamic stage). We're doing this mainly because with `partialPrefetching`, `cookies()` resolves in App Shells, and sync IO causes a severe deopt in any prerender. `allow-runtime` also opts a route into `partialPrefetching`, which means that even the segments above the runtime prefetch boundary will need an App Shell and can't tolerate Sync IO. This PR removes all early/late stage separation, because we no longer need to vary the Sync IO behavior on the segment. Instead, we now pick whether a stageController should use - `SyncIOMode.AllowedInRuntimeOrDynamic` (legacy) - `SyncIOMode.AllowedInDynamic` (`partialPrefetching`) - `SyncIOMode.Untracked` if it needs to opt out I've removed the existing tests that asserted that sync IO is allowed in segments above the `allow-runtime` boundary. Instead, we check that sync io either errors (if partialPrefetching is on) or is allowed (if partialPrefetching is off) Closes NAR-855
-
Janka Uryga authored
We have a couple switches in `StagedRenderingController` where the main purpose ends up being eliminating `Before/Dynamic/Abandoned` (i.e. the start and the end stages). Since we migrated everything to `RENDER_STAGE_ORDER` loops, we no longer really need to list all the intermediate stages out explicitly in these switches. It's enough to rule out the "special" stages and let the rest of the code be generic. This saves some work when adding/removing intermediate stages. View with "hide whitespace", otherwise it looks messy.
-
Tim Neutkens authored
Recreation of https://github.com/vercel/next.js/pull/95370 ### What's the problem? A `POST` (or `PUT`/`PATCH`) request that passes through middleware returning `NextResponse.next()` hangs indefinitely when the downstream handler reads the body via Node's `Readable.toWeb()`. The request never completes and eventually times out. Reproduction: https://github.com/abir-taheer/next-js-readable-stream-bug ### Root cause When middleware runs, `runMiddleware` clones the request body and later calls `finalize()`, which grafts the buffered stream back onto the original `IncomingMessage` via `replaceRequestBody()` (`packages/next/src/server/body-streams.ts`). `replaceRequestBody` copies the buffered stream's enumerable properties onto the request. The buffered stream (`p2`) was a `PassThrough` — a `Duplex` — so its writable-side internals (`_writableState` plus the enumerable `Writable` methods like `write`/`end`) were copied onto the `IncomingMessage`. Because that `_writableState.finished` is `false`, Node stream utilities that inspect it — including `Readable.toWeb()`, which uses `finished()`/end-of-stream detection — treat the request as a still-open writable stream and wait forever. `NextResponse.rewrite()` is unaffected (it builds a new internal request and skips this path), and `GET`/`HEAD` requests are fine because there is no body to clone. ### The fix `p2` is only ever fed with `.push()`, so it never needs a writable side. Making it a plain `Readable` instead of a `PassThrough` keeps the finalized request a pure `Readable`, so `Readable.toWeb()` (and any other duck-typing based on `_writableState`) behaves correctly. No behavior change for the existing consumers, which only read the stream. ### Testing Added `test/unit/body-streams.test.ts`, which drives the real clone → `finalize()` flow and asserts the finalized request: - is no longer writable (`_writableState` is `undefined`), and - is fully consumable via `Readable.toWeb()` (this hangs before the fix). Fixes #95335 <!-- NEXT_JS_LLM_PR --> Co-authored-by:
UditDewan <udit.dewan21@gmail.com> Co-authored-by:
Baradhan-Madhu <26barum@gmail.com>
-
Joseph authored
Guidance for those who don't customize their own not-found page, pages router's 404, etc, because the defaults honor the system style, not any app-level theme settings.
-
Janka Uryga authored
this has been very flaky recently, see [datadog](https://app.datadoghq.com/ci/test/runs?query=test_level%3Atest%20%40git.repository.id%3A%22github.com%2Fvercel%2Fnext.js%22%20%40test.name%3A%22instant%20validation%20dev%20-%20client%20navigation%20invalid%20-%20static%20prefetch%20-%20missing%20suspense%20around%20search%20params%22%20%40test.type%3A%22turbopack%22%20%40test.status%3A%22fail%22&agg_m=count&agg_m_source=base&agg_t=count&fromUser=false&index=citest&start=1783042724737&end=1783647524737&paused=true) we had similar problems with the `runtime prefetch - missing suspense around search params` test from the same suite. still unsure about the cause, but redbox seems to not appear sometimes during client navigations. this does not seem to be a problem with instant validation itself, because it runs and forwards the errors to the browser as expected, so i suspect this is a bug with the redbox. as a workaround we assert on the instant validation CLI output instead.
-
Janka Uryga authored
See NAR-876. We discovered this problem in #95384, when removing the Early/Late stage split, but it turns out that this was a preexisting race that occurs for runtime-prefetchable segments the problem existed before for runtime (which currently render in EarlyStatic, a task earlier than non-runtime-prefetchable segments) adds failing tests for `passHref` with allow-runtime (i.e. when the segment runs early), and passing tests for it in the dynamic stage (when the passHref is gated behind dynamic, which seems to delay it long enough for the debug channel to initialize)
-
Niklas Mischkulnig 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 ### Signed commits - This repository requires verified commit signatures on protected branches. - If this pull request is blocked for unsigned commits, re-sign the commits and force-push the branch. - A `Signed-off-by` line in the commit message is not enough. ## 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 # -->
-
Sam Poder authored
This PR simplifies the way that we're preserving `registration.updateViaCache` after the code-gen that rewrites the options in the service worker registration
-
Sam Poder authored
This is a follow-up to https://github.com/vercel/next.js/pull/95431; I think we can directly mention this in this guide to make people's lives easier (the PWA guide is quite long for this small chunk of code)
-
Sam Poder authored
We recently rolled out this new syntax for bundling service workers with Turbopack: ``` await navigator.serviceWorker.register(new URL('../lib/service-workers/1.js', import.meta.url), ...) ``` This PR updates the documentation that previously mentioned service workers. --------- Co-authored-by:vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
-
Tim Neutkens authored
## Summary - add `experimental.useTypeScriptCli` so projects can explicitly run their local `tsc` during `next build`, including TypeScript 7 while the legacy JavaScript API is unavailable - preserve the TypeScript API backend as the default, with TypeScript 6-compatible dependency installation and actionable TypeScript 7 migration guidance - load effective compiler metadata through `tsc --showConfig`, preserve inherited path origins, stream native diagnostics, redirect incremental state, and forward worker termination to the compiler process tree - document the experimental behavior and cover TypeScript 6/7, both bundlers, raw diagnostics, full-project checking, dependency selection, and cleanup ## Demo ``` pnpm build > cna@0.1.0 build /Users/timneutkens/projects/sandbox/cna > next build ▲ Next.js 16.3.0-canary.81 (Turbopack) ✓ Running next.config.ts took 23ms - Cache Components enabled - Experiments (use with caution): ✓ useTypeScriptCli Creating an optimized production build ... ✓ Compiled successfully in 3.9s Running TypeScript ... app/page.tsx:8:3 - error TS2322: Type 'string' is not assignable to type 'number'. 8 return count++ + "abc"; ~~~~~~ Found 1 error in app/page.tsx:8 Failed to type check. Next.js build worker exited with code: 1 and signal: null ELIFECYCLE Command failed with exit code 1. ``` ## Verification - `pnpm test-start-turbo test/production/app-dir/typescript-cli/typescript-cli.test.ts` - `pnpm test-start-webpack test/production/app-dir/typescript-cli/typescript-cli.test.ts` - `pnpm test-start-turbo test/production/ci-missing-typescript-deps/index.test.ts` - `pnpm test-dev-turbo test/development/typescript-native-preview/index.test.ts` - `pnpm test-start-turbo test/production/typescript-basic/index.test.ts` <!-- NEXT_JS_LLM_PR -->
-
- 09 Jul, 2026 9 commits
-
-
next-js-bot[bot] authored
-
Sam Poder authored
Thanks @mischnic for catching this! I've added a test to ensure that service workers work in pages router.
-
Sam Poder authored
This should fix deployment tests because this now re-uses Vercel's support for static JS files
-
Luke Sandberg authored
Reduce the size, i don't really expect much of a win, but this is low hanging fruit and removes a few branches as well. Consolidate the implementation of CollectibleSource, no need for OperationVc to delegate to RawVc here.
-
Vercel Release Bot authored
Co-authored-by:next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
-
Tim Neutkens authored
### What? Add two dynamic routes to the render-pipeline benchmark and include both in the default route suite: - `/attributes` renders 1,000 rows with string, data, ARIA, title, and inline-style attributes. - `/tailwind` renders a realistic dashboard with dense Tailwind-style utility class names across navigation, metrics, project cards, and an activity table. ### Why? The existing benchmark routes focus on lightweight rendering or Suspense and Flight payload stress. They do not provide focused integration coverage for React Fizz attribute serialization. `/attributes` provides a synthetic stress case modeled after the upstream React benchmark for facebook/react#36899. `/tailwind` complements it with a production-like component tree and realistic class strings, including responsive, state, dark-mode, and arbitrary-value utilities. ### How? Both fixtures run through the real Next.js production-server render-pipeline harness and are forced dynamic so every request exercises server rendering. The Tailwind-style fixture contains 18 project cards, 36 activity rows, and 101 `className` attributes. It intentionally does not install or configure Tailwind because the benchmark targets React serialization of the class strings, not generated CSS or visual styling. The new routes are registered in the default stress suite and documented in the benchmark playbook and render-pipeline README. ### Verification - Prettier for all changed files - ESLint for both benchmark fixtures and `bench/render-pipeline/benchmark.ts` - Production `next build` + `next start` smoke benchmark for `/tailwind`; single-client and under-load phases completed with zero request errors - Three interleaved base/head `/attributes` runs with 500 serial and 5,000 loaded requests - `/attributes` PR-head median throughput: +8.26% single-client and +10.85% under load - `/attributes` PR-head median p95: 7.91% better single-client and 9.61% better under load - `git diff --check` <!-- NEXT_JS_LLM_PR -->
-
Aurora Scharff authored
docs(opengraph-image): load assets at module scope to keep route static under Cache Components (#95246) ### What? Document loading request-independent assets at module scope, and update the OG image examples to follow it. ### Why? Reading a local asset inside the component is async I/O during render, so the route defers to request time. A top-level `await` at module scope keeps the route prerendered without reaching for `use cache`. The pattern previously only lived as an inline snippet in the OG image docs. ### How? - Add an "Asynchronous I/O at module scope" section to the Cache Components guide as the canonical explanation. - Load fonts and local assets at module scope in `opengraph-image.mdx` and `image-response.mdx`, and link both to the new section. <!-- NEXT_JS_LLM_PR --> --------- Co-authored-by:Joseph <joseph.chamochumbi@vercel.com>
-
Jude Gao authored
Make the ppr test accept diverse solutions as long as they lead to a static shell. Achieved by `expect(environment).toSatisfyCriterion` (a.k.a., llm-as-judge)
-
Vercel Release Bot authored
Co-authored-by:next-js-bot[bot] <279046576+next-js-bot[bot]@users.noreply.github.com>
-