1. 30 Apr, 2026 12 commits
    • next-js-bot[bot]'s avatar
      v16.3.0-canary.7 · ca7b3a11
      next-js-bot[bot] authored
      ca7b3a11
    • Zack Tanner's avatar
      [ci]: remove PR creation from deploy test workflow (#93400) · d72a0355
      Zack Tanner authored
      We're not planning to re-enable this workflow, and instead are handling
      the upgrade PRs from within the applications themselves.
      
      This removes them since they are currently failing.
      d72a0355
    • Tim Neutkens's avatar
      Remove leftover Turbopack manifests (#93398) · f476c5f8
      Tim Neutkens authored
      ## What?
      
      Removes the leftover manifests that are no longer needed.
      f476c5f8
    • Hendrik Liebau's avatar
      Fix deploy tests crashing under AI coding assistants (#93394) · 2dece0e9
      Hendrik Liebau authored
      The Vercel CLI bundles `@vercel/detect-agent`, which inspects
      environment variables that AI coding assistants (Claude Code, Cursor,
      Codex, Gemini CLI, GitHub Copilot CLI, and others) set in every shell
      they spawn. When the CLI detects one, `vercel deploy` writes a JSON
      payload to stdout instead of the plain deployment URL. The harness then
      crashes when `new URL(deployRes.stdout)` in `next-deploy.ts` runs, which
      breaks every `test-deploy*` run launched from such a shell.
      
      The fix appends `--non-interactive=false` to `vercelFlags` so it is
      passed to both `vercel link` and `vercel deploy`. The CLI honors that
      flag as an explicit override of the agent-derived default, and the
      deploy command's JSON-vs-plain output decision is gated on
      `client.nonInteractive` (`const asJson = formatResult.jsonOutput ||
      client.nonInteractive` in the deploy source), so a single flag is enough
      to restore plain-URL stdout.
      
      The alternative considered was reading `deployment.url` out of the JSON
      payload at the single call site that breaks. That is a more localized
      change but couples the harness to an undocumented payload shape that
      exists only for AI agents, so a future rename of that field would
      silently break deploy tests again. Forcing the CLI's output mode avoids
      that coupling, which is why the flag won.
      
      With this change, `pnpm test-deploy` and `pnpm test-deploy-turbo` work
      uniformly whether they are launched from a human's interactive terminal
      or from inside an AI coding assistant.
      2dece0e9
    • Sebastian "Sebbie" Silbermann's avatar
    • Sebastian "Sebbie" Silbermann's avatar
    • next-js-bot[bot]'s avatar
      v16.3.0-canary.6 · fb776884
      next-js-bot[bot] authored
      fb776884
    • Sebastian "Sebbie" Silbermann's avatar
    • Sebastian "Sebbie" Silbermann's avatar
    • Joseph's avatar
    • Zana Abdi's avatar
      Update 05-server-and-client-components.mdx (#93374) · 92210e34
      Zana Abdi authored
      Added an important exception (for when client components wrap server
      components) under an original line that seems to claim a universal law.
      
      <!-- 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 #
      
      -->
      
      ---------
      Co-authored-by: 's avatarJoseph <sephxd1234@gmail.com>
      Co-authored-by: 's avatarJoseph <joseph.chamochumbi@vercel.com>
      92210e34
    • Tim Neutkens's avatar
      Deprecate edge runtime (#93369) · 84f1e44d
      Tim Neutkens authored
      Note: re-apply of #92817
      
      ### What?
      
      Deprecates the Edge Runtime and the `preferredRegion` route segment
      config that only applied to edge runtime with build-time warnings,
      TypeScript IDE hints, error documentation pages, and documentation
      updates.
      
      ### Why?
      
      Edge Runtime in Next.js is being deprecated in favor of the Node.js
      runtime (the default). The `preferredRegion` route segment config is
      tightly coupled to Edge Runtime and is also being deprecated.
      
      ### How?
      
      **Edge Runtime deprecation:**
      - Added `warnAboutEdgeRuntime()` helper using `Log.warnOnce` in
      `packages/next/src/build/warn-about-edge-runtime.ts`
      - Warning fires in `get-page-static-info.ts` (Webpack dev/build +
      Turbopack build) and `turbopack-utils.ts` (Turbopack dev) when `runtime
      = 'edge'` is detected
      - Marked `'edge'` as `@deprecated` in the TypeScript language service
      plugin (`rules/config.ts`)
      - Created `errors/edge-runtime-deprecated.mdx` with migration guidance
      - Updated documentation across 11 files to add deprecation notices or
      simplify/remove outdated Edge Runtime references
      
      **`preferredRegion` deprecation:**
      - Added `warnAboutPreferredRegion()` helper in the same file
      - Warning fires in `get-page-static-info.ts` for both App Router
      (`config.preferredRegion`) and Pages Router (`config.config?.regions`)
      - Marked `preferredRegion` as `@deprecated` in the TypeScript language
      service plugin and the generated types (`next-types-plugin`)
      - Created `errors/preferred-region-deprecated.mdx` with migration
      guidance (remove the export)
      - Updated documentation across 4 files to add deprecation notices
      
      **Tests:**
      - Added `test/e2e/edge-runtime-deprecated/` with fixture and assertions
      for the edge runtime warning (dev + production)
      - Added `test/production/preferred-region-deprecated/` with fixture and
      assertions for the preferredRegion warning (production only -- Turbopack
      dev does not surface `preferredRegion` from the Rust layer to JS)
      
      <!-- NEXT_JS_LLM_PR -->
      
      ---------
      Co-authored-by: 's avatarVercel <vercel[bot]@users.noreply.github.com>
      84f1e44d
  2. 29 Apr, 2026 17 commits
    • Zack Tanner's avatar
      enable validateRSCRequestHeaders by default (#93367) · 4ba05cc3
      Zack Tanner authored
      This flag has been enabled by default on canary for some time. This
      turns it on by default to ensure that CDNs that don't respect `Vary`
      properly distinguish between different response types.
      4ba05cc3
    • Tim Neutkens's avatar
      Update upload trace url (#93350) · f3f7c7c0
      Tim Neutkens authored
      ## What?
      
      Updates the trace upload url as it has been moved.
      
      Since this subcommand is only available on canary currently the previous
      API url will not be preserved.
      f3f7c7c0
    • Janka Uryga's avatar
      fix: handling of falsey values in error boundaries (#93134) · ea541987
      Janka Uryga authored
      our error boundaries had a bunch of logic that set `state.error = error`
      and then checked `if (state.error)`, which only works correctly if
      thrown value is truthy. it breaks if something does e.g. `throw
      undefined`. in this case, we would incorrectly think that no error
      occurred and render children again (instead of a fallback), which can
      then lead to an infinite loop if the children throw again.
      
      the fix is to wrap the thrown value, so `state.error` is either `null`
      (initial/reset) or `{ thrownValue: ... }` if something errored. i
      initially considered using a separate `state.hasError` boolean, but
      that's a bit annoying to type, and really we want to model this as a
      discriminated union, so using a pseudo-Optional thing is nicer.
      ea541987
    • Sebastian "Sebbie" Silbermann's avatar
    • Will Binns-Smith's avatar
      Enable server HMR for metadata routes (manifest.ts, robots.ts, etc.) (#93110) · a2fd4ea5
      Will Binns-Smith authored
      **This PR removes the special-case handling for metadata routes so it
      benefits from server hmr. It also adds tests.**
      
      Previously, metadata routes were excluded from Turbopack's server-side
      HMR and fell back to a full require-cache eviction on every change. This
      meant unmodified dependency modules were unnecessarily re-evaluated.
      
      Metadata routes use the same app-route.js template and getUserland()
      per-request getter as regular route handlers, so they can participate in
      in-place server HMR the same way. Remove the isMetadataRoute() exclusion
      from the usesServerHmr gate.
      
      Test Plan: Added e2e test for testing selective hmr eviction
      Co-authored-by: 's avatarWill Binns-Smith <wbinnssmith@users.noreply.github.com>
      Co-authored-by: 's avatarClaude <noreply@anthropic.com>
      a2fd4ea5
    • Luke Sandberg's avatar
      fix a snapshot encoding error that could happen under concurrent mutation and snapshotting (#92658) · 00a671b7
      Luke Sandberg authored
      ## What?
      
      Fixes a snapshot encoding panic introduced by #89370 in
      `turbopack/crates/turbo-tasks-backend/src/backend/storage.rs`.
      
      ## Why?
      
      #89370 refactored snapshot iteration and in doing so introduced two
      incorrect assertions in `SnapshotShardIter::next` for tasks in the
      `modified` list that were re-modified during snapshot iteration:
      
      1. **`.expect("snapshot entry for modified_during_snapshot task must
      contain a value")`** — this panics in the `(true, false)` branch of
      `track_modification_internal`, where a task was modified in one category
      before the snapshot and then modified in a *different* category during
      iteration. The second modification stores a `None` entry in `snapshots`
      (because there was no pre-existing data to copy for that category), but
      the iterator unconditionally unwrapped `Some`.
      
      2. **`debug_assert!(!inner.flags.any_modified())`** — after clearing the
      live `data_modified`/`meta_modified` flags and before promoting
      `_during_snapshot` flags, the old code asserted that no modified flags
      remained. This fires in the `(true, true)` branch because clearing the
      flags happens after the snapshot copy was taken, so the assert races
      with the flag state.
      
      ## How?
      
      - Unify the `direct_snapshots` fast-path and the `modified` list into a
      single path that handles both `(true, true)` and `(true, false)` cases
      gracefully: if `any_modified_during_snapshot()` is set, check the
      `snapshots` map — use the `Some(copy)` if present, otherwise fall back
      to live data (which is correct for the `None`/first-time-modified case).
      - Add a regression test covering the `(true, false)` branch
      (`modify_different_category_during_snapshot`).
      
      <!-- NEXT_JS_LLM_PR -->
      00a671b7
    • Niklas Mischkulnig's avatar
      Turbopack: delete unused turbo-static crate (#93324) · 6eb0126d
      Niklas Mischkulnig authored
      Added in https://github.com/vercel/turborepo/pull/8037
      
      Nobody uses this, and it's also the only crate that uses the lsp-server
      dependency.
      6eb0126d
    • Maxime COLIN's avatar
      chore: bump postcss to 8.5.10 (#93288) · 4945b6e2
      Maxime COLIN authored
      4945b6e2
    • Sebastian "Sebbie" Silbermann's avatar
      [test] Fix broken terminal output (#93357) · 8adb4ea8
      Sebastian "Sebbie" Silbermann authored
      Nesting TUIs is hard but also a bit excessive since Turborepo's TUI
      isn't interactive if `stdin` is ignored.
      Co-authored-by: 's avatarCopilot <copilot@github.com>
      8adb4ea8
    • Sebastian "Sebbie" Silbermann's avatar
      [test] Suppress build when preparing next for cache hits (#93355) · 8ff558ef
      Sebastian "Sebbie" Silbermann authored
      In https://github.com/vercel/next.js/pull/92575 we started using
      Turborepo to build a fresh copy of Next.js before each test. This can
      become quite noisy IMO since Turborepo replays logs by default. Now we
      hide logs for cache hits.
      
      If you want to debug logs from cached builds, you should use `pnpm
      build` directly.
      
      
      ```terminal
      @next/polyfill-nomodule#build > cache hit, suppressing logs 951e3e04258a486d 
       @next/playwright#build > cache hit, suppressing logs a37fc1279a93411b 
       @next/routing#build > cache hit, suppressing logs e29bf8207712d9ea 
       @next/env#build > cache hit, suppressing logs 6f68cdf7c8f202f6 
       @next/bundle-analyzer-ui#build > cache hit, suppressing logs 5dbf9112c4f7029e 
       @next/polyfill-module#build > cache hit, suppressing logs 601b6f5afa47853d 
       @vercel/devlow-bench#build > cache hit, suppressing logs dfd1c037ef4e8100 
       @next/codemod#build > cache hit, suppressing logs a5eac293134b4263 
       @next/react-refresh-utils#build > cache hit, suppressing logs 51d64c1f7e8e5cfb 
       @next/eslint-plugin-next#build > cache hit, suppressing logs 74ec27fec9910c71 
       create-next-app#build > cache hit, suppressing logs 0c4c9d38e0e0913e 
       @next/font#build > cache hit, suppressing logs d1d057c5ffe70285 
       @next/bundle-analyzer#pack-for-isolated-tests > cache hit, suppressing logs 867b1e9082440087 
       @next/env#pack-for-isolated-tests > cache hit, suppressing logs 50d7a018277cafb8 
       next-rspack#pack-for-isolated-tests > cache hit, suppressing logs 1046e9cfa3ba6879 
       @next/mdx#pack-for-isolated-tests > cache hit, suppressing logs 6da45b672b5b081a 
       eslint-config-next#build > cache hit, suppressing logs fcf529c5b1428c5d 
       @next/font#pack-for-isolated-tests > cache hit, suppressing logs 9675f7ed199b9841 
       next#build > cache hit, suppressing logs 8c62df3806949bad 
       @vercel/turbopack-next#build > cache hit, suppressing logs 94890b06e4b937bf 
       @next/third-parties#build > cache hit, suppressing logs f1da8c56f9222a0c 
       next#pack-for-isolated-tests > cache hit, suppressing logs f11a5a11e2584c14 
       @next/third-parties#pack-for-isolated-tests > cache hit, suppressing logs 988b5be9471a943e
      ```
      8ff558ef
    • Niklas Mischkulnig's avatar
      Turbopack: remove ModuleResolveResultItem::OutputAsset (#93349) · bed584b3
      Niklas Mischkulnig authored
      It never made sense to have module references that point to an output
      asset, and the `ChunkingType` value on those made even less sense. We
      had already migrated almost everything off anyway
      bed584b3
    • Niklas Mischkulnig's avatar
      Turbopack: remove unused module references (#93335) · 5eec78a1
      Niklas Mischkulnig authored
      - SingleModuleReference is dead code, never actually called
      - SingleOutputAssetReference was created, but never actually did anything because of the ChunkingType being None
      5eec78a1
    • Sebastian "Sebbie" Silbermann's avatar
    • Tobias Koppers's avatar
      Report OS memory pressure in TurboMalloc and trace samples (#93333) · 292a3fba
      Tobias Koppers authored
      ### What?
      
      Adds a new `TurboMalloc::memory_pressure()` method that returns a
      normalized OS-level memory pressure value in the range `0..=100` as
      `Option<u8>`. That value is attached to every memory sample in the
      tracing layer (`TraceRow::MemorySample`) and propagated through the
      trace-server so that span queries return a `memory_pressure_samples`
      vector next to the existing `memory_samples`.
      
      ### Why?
      
      Our current tracing only records the in-process allocator usage
      (`TurboMalloc::memory_usage()`), which does not tell us when the
      *operating system* is actually under memory pressure. We want that
      signal in the trace output to:
      
      1. Surface real OS memory pressure in trace dashboards alongside our own
      allocation totals.
      2. Eventually use it as input to task-eviction decisions in
      `turbo-tasks` (see branch description). This PR lands the plumbing; the
      eviction heuristic is not part of this change.
      
      ### How?
      
      **`TurboMalloc::memory_pressure() -> Option<u8>`** — new, in
      `turbopack/crates/turbo-tasks-malloc/`. Values are normalized so that
      `0` = no pressure, `100` = maximum pressure. Platform-specific backends:
      
      | Platform | Source | Notes |
      |---|---|---|
      | Linux | `/proc/pressure/memory` (`some` `avg10`), fallback to
      `(MemTotal - MemAvailable) / MemTotal` from `/proc/meminfo` | PSI is not
      available on all kernels (< 4.20, without `CONFIG_PSI`, restricted
      containers). The meminfo fallback keeps the signal meaningful on any
      standard Linux system and matches the semantics of Windows'
      `dwMemoryLoad`. |
      | macOS | `kern.memorystatus_level` sysctl (% free memory) | Pressure =
      `100 - level`, read via `libc::sysctlbyname`. |
      | Windows | `MEMORYSTATUSEX::dwMemoryLoad` via `GlobalMemoryStatusEx`
      (`windows-sys`) | Already a 0–100 percentage of physical memory in use.
      |
      | Other / wasm | — | Returns `None`. |
      
      All runtime failures (missing file, sysctl error, failed API call,
      unparseable content) silently yield `None` rather than panicking.
      
      **Wiring into tracing:**
      
      - `TraceRow::MemorySample` gains a `memory_pressure: u8` field. `0` is
      used when `memory_pressure()` returns `None` on unsupported platforms.
      - `RawTraceLayer::maybe_report_memory_sample` populates it on every
      sample (sampling cadence unchanged).
      - This is a breaking change to the postcard wire format of
      `MemorySample`; old trace files cannot be read by the new
      `turbopack-trace-server`. Given the dev-only nature of this data that
      seemed acceptable — let me know if a migration is desired.
      
      **Wiring into the trace-server:**
      
      - `Store::memory_samples` is now `Vec<(Timestamp, u64, u8)>` and
      `add_memory_sample(ts, memory, memory_pressure)`.
      - A new `Store::memory_pressure_samples_for_range(start, end) ->
      Vec<u8>` mirrors `memory_samples_for_range`: same `MAX_MEMORY_SAMPLES =
      200` cap and same group-and-max downsampling, so both vectors align
      index-by-index for a given span query.
      - `ServerToClientMessage::QueryResult` gains a `memory_pressure_samples:
      Vec<u8>` field next to `memory_samples`.
      
      **Dependencies:** `libc` (macOS only, `cfg`-gated), `windows-sys` with
      the `Win32_System_SystemInformation` feature (Windows only,
      `cfg`-gated). No new deps on Linux.
      
      ### Verification
      
      - `cargo build -p turbo-tasks-malloc -p turbopack-trace-utils -p
      turbopack-trace-server`
      - `cargo clippy -p turbo-tasks-malloc -p turbopack-trace-utils -p
      turbopack-trace-server --all-targets -- -D warnings`
      - `cargo test -p turbo-tasks-malloc` — 7 tests pass, including:
      - `memory_pressure_is_in_range`: asserts `Some(_)` and `≤ 100` on Linux,
      macOS and Windows (via `cfg`-gated `.expect()`), and allows `None`
      elsewhere.
      - Parser tests for both PSI and `/proc/meminfo` code paths (typical
      content, malformed input, clamping).
      - Runtime sanity check on the Linux sandbox: `/proc/pressure/memory` is
      absent (kernel 5.10 without `CONFIG_PSI`); the `/proc/meminfo` fallback
      returned `Some(3)` as expected.
      
      <!-- NEXT_JS_LLM_PR -->
      
      ---------
      Co-authored-by: 's avatarTobias Koppers <sokra@users.noreply.github.com>
      Co-authored-by: 's avatarClaude <noreply@anthropic.com>
      292a3fba
    • 张昊's avatar
      Turbopack: add `experimental.turbopackWorkerAssetPrefix` to keep Workers… · 668094ed
      张昊 authored
      Turbopack: add `experimental.turbopackWorkerAssetPrefix` to keep Workers same-origin when `assetPrefix` is a CDN (#93271)
      
      ### What?
      
      Adds `experimental.turbopackWorkerAssetPrefix` — a Turbopack counterpart
      to webpack's
      [`output.workerPublicPath`](https://webpack.js.org/configuration/output/#outputworkerpublicpath).
      Opt-in, off by default, fully backward compatible.
      
      ```js
      // next.config.js
      module.exports = {
        assetPrefix: 'https://cdn.example.com',
        experimental: {
          // Same shape as `assetPrefix`: bare prefix, no trailing slash, no `/_next`.
          // `/_next/` is appended automatically. `''` → same-origin `/_next/...`.
          turbopackWorkerAssetPrefix: '',
        },
      }
      ```
      
      ### Why?
      
      When `assetPrefix` points to a cross-origin CDN (common production
      setup), Turbopack emits Worker URLs under that CDN origin. Browsers
      reject cross-origin `new Worker(url)` with `SecurityError`, breaking
      every feature that uses `new Worker(new URL('./worker.ts',
      import.meta.url))` — image decoders, WebP/GIF renderers, compression,
      OffscreenCanvas, etc.
      
      webpack solved this with `output.workerPublicPath`. Turbopack ignores
      the `webpack()` callback in `next.config.js`, so the existing
      same-origin workaround silently breaks when projects switch to
      Turbopack.
      
      Full design doc, alternatives considered, related issues (#88602,
      #92676, #74621, #29468): **#93044**
      
      Repro repo (`pnpm dev` reproduces, `pnpm dev:webpack` works):
      https://github.com/GuinsooRocky/next-turbopack-worker-cdn-repro
      
      ### How?
      
      Threads a new optional `turbopack_worker_asset_prefix: Option<RcStr>`
      from `ExperimentalConfig` → `BrowserChunkingContext` → the JS runtime,
      where `createWorker` reads it via a new `WORKER_BASE_PATH` global
      emitted alongside the existing `CHUNK_BASE_PATH`. When unset, behavior
      is identical to today.
      
      Semantics, modeled on `assetPrefix`:
      
      - **Bare prefix.** `/_next/` is appended automatically (same as
      `computed_asset_prefix`); the user supplies just the origin (or empty
      string for same-origin).
      - **`undefined` vs `''`.** `undefined` falls back to the regular chunk
      base path; `''` is a literal empty prefix that resolves to same-origin
      `/_next/...`. The runtime distinguishes the two by injecting a JS `null`
      literal vs a quoted string, and uses `WORKER_BASE_PATH ??
      CHUNK_BASE_PATH` (not `||`).
      - **Applies to entrypoint and module chunks.** The Turbopack worker
      bootstrap rejects cross-origin module chunks (`Refusing to load script
      from foreign origin`), so the override has to cover both — overriding
      only the entrypoint would leave the worker unable to load any chunks
      under a cross-origin `assetPrefix`.
      
      Touchpoints:
      
      - `packages/next/src/server/config-{shared,schema}.ts` — public option +
      zod under `experimental`
      - `crates/next-{api,core}/...` — wiring through to
      `ClientChunkingContextOptions`;
      `NextConfig::turbopack_worker_asset_prefix()` resolves to
      `Some("<prefix>/_next/")` or `None`
      - `turbopack/crates/turbopack-browser/src/chunking_context.rs` — new
      field + builder + getter
      - `turbopack/crates/turbopack-ecmascript-runtime/src/browser_runtime.rs`
      — emit `WORKER_BASE_PATH` declaration as `null` or a quoted string
      - `turbopack/.../runtime-base.ts` — `createWorker` resolves
      `workerBasePath` and uses it for both the entrypoint URL and
      module-chunk URLs delivered via params
      - `test/e2e/turbopack-worker-asset-prefix/` — e2e fixture using real
      cross-origin (`localhost` page, `127.0.0.1` `assetPrefix`); intercepts
      `new Worker()` to assert on the URL the runtime helper resolved. Three
      cases: no override (cross-origin URL → `SecurityError`), explicit
      override origin, and `''` (relative `/_next/...`).
      - `docs/01-app/03-api-reference/08-turbopack.mdx` — option reference
      - `telemetry/events/version.ts` — `useTurbopackWorkerAssetPrefix:
      boolean` (set on any explicit value, including empty string)
      
      ### Notes
      
      - Opening as **Draft** to invite API-shape feedback before going to
      review. Per the contributing guide, the design discussion is at #93044.
      - All checklist items the PR template requires for a feature are
      covered: e2e tests, docs, telemetry, no error-link path applies.
      
      cc @sokra
      
      Closes #93044
      
      <!-- NEXT_JS_LLM_PR -->
      
      ---------
      Co-authored-by: 's avatarTobias Koppers <tobias.koppers@googlemail.com>
      668094ed
    • Hendrik Liebau's avatar
      Honor the route-level `expire` value with blocking revalidation (#93211) · 8e4cfc50
      Hendrik Liebau authored
      A prerendered route's `expire` — set via `cacheLife({ expire })` inside
      `'use cache'` or via the `expireTime` config fallback — lands in the
      prerender manifest as `initialExpireSeconds` / `fallbackExpire`
      (#76207), but the runtime never read it: `IncrementalCache.get` only
      considered `revalidate`. So past expire, Next.js served stale with a
      background refresh instead of the blocking regeneration the `cacheLife`
      `expire` docs describe.
      
      The fix is three coordinated changes. The render-time
      `responseGenerator` in `app-page.ts`, `app-route.ts`, and
      `pages-handler.ts` now applies the `expireTime` fallback as soon as it
      has the render's `cacheControl`, so every downstream consumer (the cache
      stored via `IncrementalCache.set`, the response `Cache-Control` header,
      the entry returned to `handleResponse`) sees a finalized `cacheControl`
      with a populated `expire` — mirroring the build-time fallback.
      `IncrementalCache.get` then returns `isStale = -1` when `lastModified +
      expire * 1000 < now`, and `response-cache.handleGet` skips its early
      `resolve(previousEntry)` for `isStale === -1` so the blocking
      revalidation inside `responseGenerator` (which already picks
      `BLOCKING_STATIC_RENDER` on that signal) can return its fresh output to
      the user. Previously the early resolve committed the stale value to the
      response first, so even though `responseGenerator` still ran a fresh
      render its output only warmed the cache for the next request. As a side
      effect this also closes the same early-resolve hole on the existing
      tag-expired `isStale = -1` path.
      
      On Vercel, ISR cache decisions live at the Proxy and the Proxy currently
      ignores `staleExpiration` (using a hard-coded one-year value instead).
      It is also expected, once it starts honoring `staleExpiration`, to pick
      up updated values from the `stale-while-revalidate` response header.
      Until that lands this change is only observable on `next start` —
      deploy-mode behavior is tracked independently of Next.js.
      
      Two test suites cover the new behavior.
      `test/production/app-dir/use-cache-expire` uses `cacheComponents` +
      `cacheLife({ expire: 300 })` with a custom cache handler that shifts
      `lastModified` via an `x-test-cache-age-offset-ms` header, exercising
      the fully-static shell, the partially-static route shell for a known
      param, and the partially-static fallback shell for unknown params.
      `test/e2e/app-dir/expire-time` covers classic ISR (`revalidate = 1`,
      `expireTime: 2`) with a real three-second wait and is `it.failing` on
      deploy, so it will flip the moment the Proxy honors the expire value.
      
      fixes #78269
      8e4cfc50
    • Matt Mastracci's avatar
      turbo-tasks: precompute trait-impl vtables at compile time (#93092) · e1bb911c
      Matt Mastracci authored
      ## What
      
      Remove another lazy lock from trait vtables.
      
      ---------
      Co-authored-by: 's avatarLuke Sandberg <lukesandberg@users.noreply.github.com>
      e1bb911c
  3. 28 Apr, 2026 11 commits
    • next-js-bot[bot]'s avatar
      v16.3.0-canary.5 · 16150ccf
      next-js-bot[bot] authored
      16150ccf
    • Tobias Koppers's avatar
      [rust-deps] Update tokio (#93195) · 99bbaa00
      Tobias Koppers authored
      ## What?
      
      Updates the tokio and tokio-util dependencies to their latest versions:
      - `tokio`: `~1.47.3` → `1.52.1`
      - `tokio-util`: `0.7.13` → `0.7.18`
      
      ## Why?
      
      Keep Rust dependencies up-to-date to benefit from bug fixes, performance
      improvements, and security patches.
      
      ## How?
      
      Updated version constraints in `Cargo.toml` and regenerated
      `Cargo.lock`.
      
      <!-- NEXT_JS_LLM_PR -->
      99bbaa00
    • Luke Sandberg's avatar
      [turbopack-trace-server] optimize loading (#93264) · 8dee7acb
      Luke Sandberg authored
      Land a few optimizations to the trace server
      
      * Change `SpanEvent` so it is 32 bytes instead of 40 bytes by triggering a `niche` optimization
      * Change `args` and `events` to be a `smallvec` with inline size 1
        * for `args` it is size <=1 ~31% of the time
        * for `events` it is size <=1 69% of the time
      * Compute min/max timestamps in a single pass instead of 2 when inserting into the selftimetree
      * Bundle dynamically computed 'total' fields behind a single OnceLock
         * saves 40 bytes per span due to `Oncelock` overheads
      * Inline SpanTimeData and SpanNames into Span
         * We get little benefit from deferring the allocations and by inlining we save time and improve memory locality.
           * post load SpanTimeData is allocated for 94% of spans, but after loading `trace.nextjs.org` it is 100%
           * post load SpanNames is allocated for 0% of spans, but after loading it is 96.2% of spans
      * Remove the `inner` `OnceLocks` from `SpanNames` we can just allocate these all together
      
      
      Measuring with one 10gb trace file I see loading times progress from 75.7s (33G of ram)  to 60.5s (19.5G of ram).  With loading times hitting >200mb/s occasionally
      8dee7acb
    • Niklas Mischkulnig's avatar
      Turbopack: pull in updated vercel/nft tests (#93321) · 470cf12a
      Niklas Mischkulnig authored
      From
      https://github.com/vercel/nft/commit/baf9df627e30f3e3c4199eeda128a527c715fffc
      
      Still need to eventually look into actually enabling all of these
      470cf12a
    • Niklas Mischkulnig's avatar
      Turbopack: also add edge count to trace (#93314) · 8384791e
      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 #
      
      -->
      8384791e
    • Niklas Mischkulnig's avatar
      Turbopack: add failing test for cross-module side-effect inference (#93323) · 99bfe967
      Niklas Mischkulnig authored
      Currently not implemented, but maybe in the future
      99bfe967
    • Niklas Mischkulnig's avatar
      Turbopack: iter_reachable_modules (#93315) · 28c9eefa
      Niklas Mischkulnig authored
      Add `iter_reachable_modules` and `iter_reachable_nodes`. They actually respect unused references
      28c9eefa
    • Niklas Mischkulnig's avatar
      ci: Fix caching of test-cargo-unit (#93327) · 6d2cb42f
      Niklas Mischkulnig authored
      Previously, it only used the rust files as the cache key via `rust-fingerprint`.
      So changing fixtures didn't invalidate the turborepo run.
      6d2cb42f
    • Will Binns-Smith's avatar
      HMR: debounce status indicator transitions to prevent flicker during bursts of changes (#93229) · 6ca4390a
      Will Binns-Smith authored
      This adds a debounce to the _ui_ in development, reducing churn and
      flicker from the Next.js logo indicator's "Compiling" and "Rendering"
      messages. This is wholistic and covers any rapid changes in dev, usually
      caused by agents making a series of changes.
      
      **There's currently a debounce of 30ms coming from the subscription to
      changes in Turbopack itself, we could consider lengthening that as
      well.**
      
      This commit adds a useDebouncedValue hook and uses it to debounce status
      transitions in NextLogo, so rapid active->active alternations (e.g.
      Compiling→Rendering→Compiling) are smoothed into a single stable state
      for 300ms. Transitions to/from None remain immediate so:
      
      - Fast single builds that complete before the 400ms enterDelay still
      never show the pill.
      - The pill still appears promptly when a long build starts (no added
      latency on top of the existing enter delay).
      
      Changes:
      - use-debounced-value.ts: new generic trailing-edge debounce hook with
      an optional leading predicate to bypass the delay for specific
      transitions.
      - next-logo.tsx: apply the debounce to the computed status; derive
      shouldShowStatus from the debounced value so both pill mount-gating and
        label transitions are smoothed together.
      
      Test Plan: Ran a script that simulated an agent making hundreds of
      changes in rapid successions. Verified before this change, the indicator
      would flash between Compiling and Rendering rapidly. Now, it
      consistently stays on "Compiling" before the final render.
      6ca4390a
    • Hendrik Liebau's avatar
      Forward invalid dynamic usage errors on client-side navigations (#93184) · f5e54c06
      Hendrik Liebau authored
      In dev mode, the static shell validation only runs during the initial
      page load and HMR refreshes, not during client-side navigations. During
      a client-side navigation an invalid dynamic usage error — for example a
      `'use cache'` fill timeout, or a request API like `cookies()` called
      inside a `'use cache'` scope — does still reach the browser via the
      errored `'use cache'` stream. But when the cache invocation is wrapped
      in a user-space `try`/`catch`, the error is caught and swallowed in user
      code, and because the static shell validation isn't running to surface
      it separately, the error is then neither sent to the browser nor logged
      to the terminal.
      
      When we skip the validation, we now wait for the full render stream to
      finish and then, if an error was recorded during the render, send it to
      the browser and log it to the terminal. Waiting for the stream to finish
      mirrors what the static shell validation already does, and ensures we
      also catch errors from `'use cache'` invocations that only run in the
      dynamic stage.
      f5e54c06
    • Niklas Mischkulnig's avatar
      Turbopack: only compute module ids for included modules (#93276) · b694eeb5
      Niklas Mischkulnig authored
      Currently doesn't have a measureable performance impact.
      
      Previously we assigned module ids for all nodes in the graph, even the subgraphs we detect as unused. They weren't chunked already, but the codegen that references those wasn't gracefully handling `.chunk_item_id(m)` failing (where `m` is a unused skipped module)
      
      So `.iter_nodes()` should basically be deprecated. It doesn't respect `removed_unused_imports` and the side-effect-free inference. 
      And this would get much much worse once NFT is on the module graph, because then there are way more modules that should be skipped via the same mechanism
      
      This manifested as the following error after switching from `.iter_nodes` to `.traverse_edges_unordered` in global_module_ids.rs
      ```
      Debug info:
      - An error occurred while generating the chunk item [project]/node_modules/.pnpm/next@file+..+next.js+packages+next_@babel+core@7.29.0_@opentelemetry+api@1.7.0_@playwri_9a8ea08672cbf59c2720abbb0c8879be/node_modules/next/dist/esm/server/stream-utils/node-web-streams-helper.js [app-rsc] (ecmascript)
      - Execution of <MergedEcmascriptModule as EcmascriptChunkPlaceable>::chunk_item_content failed
      - Execution of *EcmascriptChunkItemContent::new failed
      - Execution of EcmascriptModuleContent::new_merged failed
      - ModuleId not found for ident: [project]/node_modules/.pnpm/next@file+..+next.js+packages+next_@babel+core@7.29.0_@opentelemetry+api@1.7.0_@playwri_9a8ea08672cbf59c2720abbb0c8879be/node_modules/next/dist/esm/shared/lib/hash.js [app-rsc] (ecmascript)
      
      ```
      b694eeb5