- 27 Feb, 2026 4 commits
-
-
nextjs-bot authored
-
JJ Kasper authored
Follow-up to https://github.com/vercel/next.js/pull/90611 this fixes the middleware case to ensure it doesn't create a `_next/data` output. x-ref: https://github.com/vercel/next.js/actions/runs/22465910596/job/65075127711#step:34:302
-
Will Binns-Smith authored
Previously, we lost stack frame information when server hmr code was applied through `eval`. This adds and calls \`maybeInlineSourcemap()\` to the Turbopack Node.js HMR runtime that appends \`//# sourceURL\` and \`//# sourceMappingURL\` (base64-encoded) to each `eval`ed module entry. Test Plan: CI for #90389 -
Benjamin Woodruff authored
We've had some really bad bugs in the past, which can be hard to root-cause due to eventually-consistent reads a the top-level, e.g. https://github.com/vercel/next.js/pull/77511 Outside of tests, there's no good justification for doing an eventually-consistent read at the top level. It may leak incomplete computations, which can contain errors that would otherwise be resolved by a strongly consistent read. The basic idea here is simple: - Store a flag in `CURRENT_TASK_STATE` indicating that we're in a top-level task. - When reading a task output or cell, check for that flag. But, there are a few complications: - `RawVc`'s read and resolution logic is wrong, and internally uses multiple eventually consistent operations after a strongly consistent read. - For this to be correct, it needs to happen as one atomic operation inside of the task backend, but it would change the backend API contract, so it's not straightforward to do that. - I added a `SUPPRESS_EVENTUAL_CONSISTENCY_TOP_LEVEL_TASK_CHECK` flag that I'm using for now. - There are a ton of places that are doing eventually consistent reads for no good reason. These aren't causing problems today, but we should fix them instead of suppressing them. Claude helped with this, but it's still a lot. - Some tests actually do need eventually-consistent reads because they're testing some internal behavior of turbo-tasks. I added an intentionally long-named `unmark_top_level_task_may_leak_eventually_consistent_state` helper for this. I manually tested `turbopack-cli` against our bundler-benchmark repository that uses it.
-
- 26 Feb, 2026 33 commits
-
-
nextjs-bot authored
-
Will Binns-Smith authored
This implements the `restart` event, fully evicting all caches. This is needed for when client manifest changes are made. Test Plan: CI for https://github.com/vercel/next.js/pull/90389
-
Andrew Imm authored
When cold-booting `next dev` on a fresh create-next-app, on the first server hit we need to fetch fonts and compile CSS, which takes up nearly half of the request time. It shouldn't be necessary to wait until the first server request to launch the first NodeJS process (eventually used for PostCSS processing in Tailwind). Once the server has started, we can anticipate that first request and pre-warm a single Node process. Because we grab the boot semaphore, if a request comes in as soon as the server is ready, it waits on the semaphore to resolve, and at most it takes as long as it would before this change. In all likelihood, the Node process is ready before any server request comes in. It also slightly saves time on `next build` I'd appreciate scrutiny of all the ways this can go wrong.
-
JJ Kasper authored
Fixes failing assertion with turbopack Verified against turbopack + adapter deploy test locally <img width="2076" height="1336" alt="CleanShot 2026-02-26 at 13 25 30@2x" src="https://github.com/user-attachments/assets/a8c66314-8163-4371-b02a-dc7146989425" /> x-ref: https://github.com/vercel/next.js/pull/90600#issuecomment-3968044160
-
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 3 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?).
-