- 26 Feb, 2026 29 commits
-
-
nextjs-bot authored
-
Luke Sandberg authored
## Summary - Remove the zstd key compression dictionary from SST files, simplifying the on-disk format - Key blocks now use plain LZ4 compression (same as value blocks), eliminating the zstd dependency - Update the turbo-persistence README to reflect the format changes ## Why The key compression dictionary added complexity (zstd dependency, dictionary computation, dual decompression paths) with diminishing returns. Plain LZ4 is already used for value blocks and provides sufficient compression for key blocks. This simplifies both the SST file format and the compaction/inspection tooling. This main goal is to unblock streaming SST writes. ## What Changed **On-disk format (breaking):** - SST files no longer start with a serialized key compression dictionary - Meta file entries no longer include the `key_compression_dictionary_length` field **Code:** - Removed `zstd` dependency from `turbo-persistence` - Removed dictionary computation in `StaticSortedFileBuilder` - Simplified `sst_inspect` tool (no more dictionary-aware decompression) - Removed `key_compression_dictionary_length` from `StaticSortedFileMetaData`, `MetaEntry`, and `MetaFileBuilder` **Docs:** - Updated README meta file format (removed dictionary length field) - Updated README SST file format (removed dictionary region) - Updated compression description to reference LZ4 directly ## Test Plan - Existing turbo-persistence tests and benchmarks pass with the format changes - `sst_inspect` tool updated to work without dictionary logic --------- Co-authored-by:Tobias Koppers <tobias.koppers@googlemail.com>
-
Jiwon Choi authored
Extends the error components API to give better control over recovery. Previously, the `reset()` prop only cleared the error state and re-rendered the children. However, this only handles a temporary rendering error. The error can be due to data fetching or an RSC phase. In these cases, `reset()` alone is not sufficient. Users would even need to implement retry logic using `router.refresh()`. Therefore, this PR adds a new `unstable_retry()` prop that calls `router.refresh()` and `reset()` within a `startTransition()` to provide built-in retry logic. This feature is expected to be preferred over the `reset()` prop. Only the cases where you'd choose `reset()` are when you have a reason to do a sync reset without loading any new data. Closes NAR-767
-
Hendrik Liebau authored
The `S` field in the RSC payload was only set to `true` during static generation, but the client used it to determine whether a route supports per-segment prefetching (`isPPREnabled` on the route cache entry). For partially static pages with Cache Components enabled, the initial HTML is served via PPR resume, which generates the RSC payload at request time with `isStaticGeneration` set to `false`. This caused `S` to be `false` even though the route fully supports per-segment prefetching. This caused the prefetch scheduler to fall back to the `LoadingBoundary` fetch strategy instead of `PPR`, which skipped fetching `_head.segment.rsc` and instead sent a `metadata-only` dynamic request. That request returned a 404 locally (harmless) but a 200 with an empty body on Vercel, which interfered with same-page navigation refreshes introduced in #76223 and exposed by the route cache keying fix in #90400. To fix this, `S` is now also set to `true` when `cacheComponents` is enabled, since all Cache Components routes support per-segment prefetching. When Cache Components is disabled, `S` continues to rely solely on `isStaticGeneration`, which is correct because fully static pages always have both their RSC payload and per-segment prefetch responses generated at build time. This PR also renames `isPPREnabled` to `supportsPerSegmentPrefetching` on the client and updates the `S` field comments in the RSC payload types to better reflect the field's actual meaning.
-
Jiwon Choi authored
User's `global-error.js` is within the router. There's no reason it shouldn't have access to the options available to the `error.js` component. It was already available on prod. This PR syncs dev behavior to prod. For the follow-up feature, `retry()` will also be available in `global-error.js`. --------- Co-authored-by:vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
-
Sebastian "Sebbie" Silbermann authored
Co-authored-by:Cursor Agent <cursoragent@cursor.com>
-
Sebastian "Sebbie" Silbermann authored
Co-authored-by:Cursor Agent <cursoragent@cursor.com>
-
Hendrik Liebau authored
`run-tests.js` explicitly unsets `CI` in the spawned Jest child process and preserves the original value as `NEXT_TEST_CI`. Since `test/lib/e2e-utils/index.ts` runs inside that child process, `process.env.CI` is always empty, making the `jest.retryTimes(1)` call effectively dead code in CI.
-
Tobias Koppers authored
## Summary Adds the Next.js version as a `version` field on the Turbopack "initialize project" tracing span. The version is passed from the TypeScript side (`process.env.__NEXT_VERSION`) through the NAPI bindings into Rust `ProjectOptions`, where it is recorded on the span. This makes it easy to correlate trace data with the specific Next.js version that produced it. Also standardizes all version reads in `packages/next/src/` to use `process.env.__NEXT_VERSION` (which is inlined at build time by `taskfile-swc.js`) instead of `require('next/package.json').version` or `import { version } from 'next/package.json'`. ### Changes **Trace span (commit 1):** - **`crates/next-api/src/project.rs`** — Added `next_version` field to `ProjectOptions`; recorded as `version` on the `"initialize project"` span - **`crates/next-napi-bindings/src/next_api/project.rs`** — Added `next_version` to `NapiProjectOptions` and wired it through the `From` impl - **`crates/next-build-test/src/main.rs`** — Added `next_version` to test `ProjectOptions` init - **`packages/next/src/build/swc/generated-native.d.ts`** — Added `nextVersion` to the TypeScript `NapiProjectOptions` interface - **`packages/next/src/server/dev/hot-reloader-turbopack.ts`**, **`packages/next/src/build/turbopack-build/impl.ts`**, **`packages/next/src/build/turbopack-analyze/index.ts`** — Pass `nextVersion: process.env.__NEXT_VERSION` when creating the Turbopack project - **`test/development/basic/next-rs-api.test.ts`** — Added `nextVersion` to both `createProject` call sites **Consistent `__NEXT_VERSION` usage (commit 2):** - **`packages/next/src/server/dev/hot-reloader-shared-utils.ts`** — `require('next/package.json').version` → `process.env.__NEXT_VERSION` - **`packages/next/src/lib/patch-incorrect-lockfile.ts`** — `nextPkgJson.version` → `process.env.__NEXT_VERSION`; narrowed import to only `optionalDependencies` - **`packages/next/src/telemetry/events/swc-load-failure.ts`** — `import { version as nextVersion }` → `process.env.__NEXT_VERSION`; narrowed import to only `optionalDependencies` ## Test Plan - Verified Rust compilation with `cargo check -p next-api`, `cargo check -p next-build-test` - Verified TypeScript types with `pnpm --filter=next types` --------- Co-authored-by:Claude <noreply@anthropic.com>
-
Vercel Release Bot authored
This auto-generated PR updates the production integration test manifest used when testing Rspack.
-
Vercel Release Bot authored
This auto-generated PR updates the development integration test manifest used when testing Rspack.
-
nextjs-bot authored
-
Niklas Mischkulnig authored
Forgot to remove this in https://github.com/vercel/next.js/pull/83335 This env var might filter some tests that should actually run (Webpack doesn't set it at all)
-
Niklas Mischkulnig authored
Move to 128 bit hashes, so that we can include the untruncated hashes in the manifest in #88607 If anything, this is faster, surprisingly: ``` upgrade twox-hash 448a36b449 pnpm next build --experimental-build-mode=compile 430.13s user, 73.72s system, 724% cpu, 1:09.53 total pnpm next build --experimental-build-mode=compile 430.05s user, 82.51s system, 736% cpu, 1:09.56 total pnpm next build --experimental-build-mode=compile 419.95s user, 89.50s system, 697% cpu, 1:13.03 total pnpm next build --experimental-build-mode=compile 425.95s user, 75.87s system, 748% cpu, 1:07.00 total use Xxh3Hash128Hex for content hashes ffd6a87f09 pnpm next build --experimental-build-mode=compile 397.42s user, 53.18s system, 670% cpu, 1:07.25 total pnpm next build --experimental-build-mode=compile 416.68s user, 66.32s system, 762% cpu, 1:03.32 total pnpm next build --experimental-build-mode=compile 412.63s user, 68.30s system, 774% cpu, 1:02.12 total pnpm next build --experimental-build-mode=compile 419.09s user, 68.57s system, 756% cpu, 1:04.50 total ``` https://github.com/Cyan4973/xxHash says: | Hash Name | Width | Bandwidth (GB/s) | Small Data Velocity | Quality | Comment | | --------- | ----- | ---------------- | ----- | --- | --- | | __XXH3__ (SSE2) | 64 | 31.5 GB/s | 133.1 | 10 | __XXH128__ (SSE2) | 128 | 29.6 GB/s | 118.1 | 10 | __XXH64__ | 64 | 19.4 GB/s | 71.0 | 10 | __XXH32__ | 32 | 9.7 GB/s | 71.9 | 10 -
Niklas Mischkulnig authored
_Two steps forward, one step back_ Reverts https://github.com/vercel/next.js/pull/88641 and https://github.com/vercel/next.js/pull/88806 I ended up having to keep the build id in `_next/data` routes anyway (and made the id a constant if skew protection is enabled). This was because it was utterly impossible to change the routes from `_next/data/:buildId/*` to `_next/data/*` in the builder in a backwards-compatible way. So there is no need to remove the build id from `_next/static` here either. It just makes testing a huge pain because the paths keep changing
-
Joseph authored
As we discussed, let's scale back how much Activity we teach and focus on UI preservation, choice of pattern, and wrap it all with a demo where these are implemented. - [x] rename file --------- Co-authored-by:Vercel <vercel[bot]@users.noreply.github.com>
-
Sebastian "Sebbie" Silbermann authored
Co-authored-by:Cursor Agent <cursoragent@cursor.com>
-
Sebastian "Sebbie" Silbermann authored
Co-authored-by:Cursor Agent <cursoragent@cursor.com>
-
Niklas Mischkulnig authored
- turbo-persistence used XxHash64, which is supposed to be slower than XxHash3_64 - refactor debug_id computation to just use `rope.content_hash()` which was added in the meantime - update and adjust feature flags of `twox_hash` https://github.com/Cyan4973/xxHash says: | Hash Name | Width | Bandwidth (GB/s) | Small Data Velocity | Quality | Comment | | --------- | ----- | ---------------- | ----- | --- | --- | | __XXH3__ (SSE2) | 64 | 31.5 GB/s | 133.1 | 10 | __XXH128__ (SSE2) | 128 | 29.6 GB/s | 118.1 | 10 | __XXH64__ | 64 | 19.4 GB/s | 71.0 | 10 | __XXH32__ | 32 | 9.7 GB/s | 71.9 | 10
-
Tobias Koppers authored
### What? Introduces a new `TransientEnvMap` type and changes `ProcessEnv::read_all()` to return `Vc<TransientEnvMap>` instead of `Vc<EnvMap>`. ### Why? `EnvMap` uses default (auto) serialization, which means all process environment variables — including secrets like API keys and tokens — could be written to the persistent disk cache. `TransientEnvMap` uses `serialization = "none"`, ensuring env vars are never persisted and must always be read fresh from the process environment on cache restore. ### How? - Added `TransientEnvMap` in `turbo-tasks-env/src/lib.rs`: a transparent wrapper around `FxIndexMap<RcStr, RcStr>` with `serialization = "none"` - Changed `ProcessEnv::read_all()` trait method return type from `Vc<EnvMap>` → `Vc<TransientEnvMap>` - Updated all 7 implementations of `ProcessEnv::read_all()` (`EnvMap`, `CommandLineProcessEnv`, `CustomProcessEnv`, `FilterProcessEnv`, `DotenvProcessEnv`, `TryDotenvProcessEnv`, `EmbeddableProcessEnv`) - Updated helper functions (`case_insensitive_read`, `to_uppercase_map`, `common_node_env`) to work with `TransientEnvMap` - `EnvMap` (serializable) is kept for config-derived env maps like `next.config.js` env and `edge_env`
-
Kristiyan Velkov authored
### What? Updates the [Deploying](https://nextjs.org/docs/app/getting-started/deploying) page Docker section to document the new and updated Docker examples and add description to old ones. ### Why? The Docker examples were added/updated in [#87069](https://github.com/vercel/next.js/pull/87069). The Deploying page still only listed the generic "Docker" and "Docker Multi-Environment" templates, so the new **Docker Standalone** and **Docker Export** examples were not discoverable from the docs. ### How? - Add **Docker Standalone** template linking to `examples/with-docker` (`output: "standalone"` for minimal container images). - Add **Docker Export** template linking to `examples/with-docker-export-output` (`output: "export"` for static HTML in a container). - Order templates as: Docker Standalone, Docker Export, then Docker Multi-Environment. --- **Related:** This PR follows up on the merged [PR #87069](https://github.com/vercel/next.js/pull/87069) (Docker examples for standalone and export output). It updates the docs so the Deploying page links to those examples. --------- Co-authored-by:
Wyatt Johnson <accounts+github@wyattjoh.ca> Co-authored-by:
Joseph <joseph.chamochumbi@vercel.com> Co-authored-by:
kristiyan.velkov <kristiyan.velkov@ffw.com> Co-authored-by:
Cursor <cursoragent@cursor.com>
-
Niklas Mischkulnig authored
So that we don't require `next/dist/compiled/@vercel/nft` or `next/dist/compiled/webpack/webpack` when using Turbopack
-
Sebastian "Sebbie" Silbermann authored
-
Jiwon Choi authored
I don't want agents to open up browsers for testing. <img width="1674" height="356" alt="CleanShot 2026-02-26 at 11 02 54@2x" src="https://github.com/user-attachments/assets/b71f1d57-6329-44aa-b663-cc876210f0d7" />
-
Sebastian "Sebbie" Silbermann authored
Co-authored-by:Hendrik Liebau <mail@hendrik-liebau.de>
-
Sebastian "Sebbie" Silbermann authored
-
Sebastian "Sebbie" Silbermann authored
-
Tobias Koppers authored
## Summary Replaces the runtime `mark_root()` call with a declarative `root` flag on the `#[turbo_tasks::function]` attribute macro. This moves root task aggregation number assignment from an imperative runtime call to a compile-time declaration, making the intent clearer and applying the aggregation number at task creation time rather than during execution. ### What changed - **Macro parsing**: Added `root` as a new flag option for `#[turbo_tasks::function(root)]` (can be combined with other flags, e.g. `#[turbo_tasks::function(operation, root)]`) - **NativeFunction**: Added `is_root: bool` field and parameter to all three constructors (`new_function`, `new_method`, `new_method_without_this`) - **Backend**: In `get_or_create_persistent_task` and `get_or_create_transient_task`, checks `native_fn.is_root` on brand-new task creation (not cache hits or backing storage restores) and sets `UpdateAggregationNumber` with `u32::MAX` - **Usage site**: Changed `whole_app_module_graph_operation` in `crates/next-api/src/project.rs` from `#[turbo_tasks::function(operation)]` + `mark_root()` to `#[turbo_tasks::function(operation, root)]` - **Cleanup**: Removed `mark_root()`, `set_own_task_aggregation_number` from `TurboTasksApi` trait, `Backend` trait, and all implementations (turbo-tasks-backend, turbo-tasks-testing) ### Key design decisions - Root aggregation number is only set on **brand-new task creation** (Vacant entry in the task cache when not found in backing storage either), not on cache hits or when restoring from backing storage - The `root` flag is stored on `NativeFunction` (which is a static singleton per function), so it's accessible via `CachedTaskType.native_fn.is_root` in the backend without any additional runtime overhead ## Test Plan - `cargo check -p turbo-tasks-macros -p turbo-tasks -p turbo-tasks-backend -p next-api` passes - `cargo test -p turbo-tasks-backend` passes - `pnpm swc-build-native` builds successfully
-
Andrew Imm authored
When examining the long trace this morning, it wasn't immediately clear what was running in the shell-out to Node. This doesn't fully fix the issue, but it makes it clearer which webpack loader is running, similar to how the PostCSS loader lists the name of the css file it's parsing. In this trace, the next config contains: ``` turbopack: { rules: { "**/*.{js,jsx,ts,tsx}": { loaders: ["./loader_test.js"], }, }, }, ``` And the trace renders as: <img width="995" height="553" alt="Screenshot 2025-12-15 at 11 22 39 PM" src="https://github.com/user-attachments/assets/b0936e2e-f9d5-45fc-8a1c-2f98b1aa38b6" />
-
- 25 Feb, 2026 11 commits
-
-
Andrew Clark authored
The 500ms settling period in router-act's `act()` polled for 500ms after the request queue emptied before exiting. This was added to accommodate the 300ms revalidation cooldown in the client router — after a server action calls `revalidatePath`/`revalidateTag`, the client delays re-prefetching for 300ms. The settling period ensured `act()` waited long enough to catch the resulting re-prefetch. The settling period applied to every `act()` call, not just ones involving revalidation, adding ~500ms per call across 28 test files. Remove it entirely and instead use Playwright's fake clock (`page.clock.install` / `page.clock.fastForward`) in the revalidation tests to deterministically control the cooldown. This is both faster and architecturally cleaner — the test utility no longer embeds knowledge of a specific client-side timer.
-
nextjs-bot authored
-
Benjamin Woodruff authored
#89819 has been causing a lot of pain for me, because I often have already compiled a version of Turbopack, usually with a custom profile or set of flags, and then I want to just compile the JS bits, but there's no way for me to do it without also recompiling Turbopack again, because the `maybe-build-native` doesn't understand my custom-built binary. This reverts the behavior of `pnpm build`, but adds a `pnpm build-all` command for people who want this automatic compilation behavior (e.g. agents?).
-
Jiwon Choi authored
The `unstable_instant` route segment config is not allowed in Client Components because the API mainly depends on prefetches, which Client Components aren't part of. Closes NAR-774 --------- Co-authored-by:vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
-
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 ## 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 # -->
-
Hendrik Liebau authored
When navigating to a dynamic (or partially static) page with Cache Components, the server now uses staged rendering to separate the static portion (backed by the Resume Data Cache) from the dynamic portion (runtime APIs like `cookies`, `headers`, `connection`, or uncached I/O). The static stage byte length is embedded in the RSC payload so the client can extract it. On the client, the first navigation clones the response stream, truncates it to the static stage byte length, decodes it as a partial Flight response, and writes the result into the segment cache. Subsequent navigations find these cached segments and display them instantly while fetching only the dynamic data from the server. Server-side changes: - Add `generateStagedDynamicFlightRenderResult` with `StaleTimeIterable`, byte counting via tee'd stream, and stage-separated rendering - Enable `asyncApiPromises` checks in production for `cookies`, `headers`, `connection`, `searchParams`, and `params` - Propagate stale time to `RequestStore` for Cache Components - Thread `fallbackParams` from prerender manifest to production renders - Rename `devFallbackParams` → `fallbackParams` (now used in both dev/prod) Client-side changes: - Clone response in `fetchServerResponse`, truncate to static byte length, decode with `allowPartialStream` - Write static stage into segment cache via `writeStaticStageResponseIntoCache` - Use `getFulfilledRouteVaryPath` in `writeRouteIntoCache` for `Fallback` keying - Refactor `writeDynamicRenderResponseIntoCache` (remove dead `task` param, accept `headers` directly) In follow-ups we'll also handle fully static pages, as well as extracting static segment data from the initial load.
-
Andrew Clark authored
When a navigation triggers a server-patch retry (due to a route tree mismatch), the retry was unconditionally using navigateType='replace'. This assumed the original navigation had already committed to the browser history. But if the original transition was still suspended, pushState never ran, so replaceState overwrote the initial history entry instead of creating a new one, breaking the back button. The fix tracks the last committed router tree. When a server-patch retry fires, it checks whether the original navigation has committed. If not, it inherits the original transition's push/replace intent instead of forcing 'replace'. This works because React entangles the retry with the original pending transition — they commit together. Fixes #90513
-
Sebastian "Sebbie" Silbermann authored
-
Janka Uryga authored
Fixes a bug where a loading.js isn't properly considered as providing a suspense boundary for a page. This is because we're placing the boundary around the segment component itself, but it should be rendered above the `LoadingBoundary` that is rendered around it (in `OuterLayoutRouter`). This PR reworks the boundary placement logic to insert the boundary above ErrorBoundary/LoadingBoundary (but below TemplateContext). It's a little bit tricky to communicate this from `instant-validation` to the client router. Instead of placing the boundary directly like before, we now add a context to the innermost parent segment (`PlaceValidationBoundaryBelowThisLevel`) and then the `OuterLayoutRouter`s for the segments below see this context value and add the validation boundary (`RenderValidationBoundaryAtThisLevel`)
-
Niklas Mischkulnig authored
Only start a Worker for typescript when type checking is actually enabled. When only validating the config (which doesn't load the `typescript` package itself, just invoke it in-process) testing with `pnpm next build bench/app-router-server` and `module.exports = {typescript: {ignoreBuildErrors: true}}` `startTypeChecking: Xms` is a `console.time` and `console.timeEnd` around `startTypeChecking` before: ``` ✓ Finished TypeScript config validation in 82ms startTypeChecking: 85.19ms ✓ Finished TypeScript config validation in 46ms startTypeChecking: 50.084ms ✓ Finished TypeScript config validation in 47ms startTypeChecking: 50.882ms ``` after: ``` ✓ Finished TypeScript config validation in 1ms startTypeChecking: 5.281ms ✓ Finished TypeScript config validation in 1ms startTypeChecking: 4.797ms ✓ Finished TypeScript config validation in 1ms startTypeChecking: 4.697ms ``` -
Niklas Mischkulnig authored
Revert "Turbopack: Add line numbers to debug info in release-with-assertions profile (#90474)" (#90525) Reverts #90474 It appears to have increased the artifact size so much that Turborepo remote caching doesn't work properly anymore see https://vercel.slack.com/archives/C03LMQZL205/p1772027662111429
-