1. 23 Jul, 2026 2 commits
    • next-js-bot[bot]'s avatar
      v16.3.0-preview.9 · 838bd19b
      next-js-bot[bot] authored
      838bd19b
    • dan's avatar
      [Bench] Add client-trace attribution pass and document metrics to render-pipeline (#95828) · 5f688d27
      dan authored
      Added a bunch of stuff to the bench.
      
      ---
      
      **New metrics in the HTTP benchmark**
      - Report TTFB per route (time to first body byte), next to total
      latency.
      - Report each route's document size, how many bytes are inline Flight
      payload, and the Flight share.
      
      **New script: `pnpm bench:render-pipeline:client`**
      - Loads each route in Chrome with tracing and 4x CPU throttling, and
      breaks down where client time goes: evaluating chunks, evaluating inline
      Flight scripts, compiling, background parsing, GC, time to hydration,
      and blocking time before hydration.
      - Also prints FCP/LCP/DOMContentLoaded/load from the same trace, and JS
      transferred vs parsed.
      - Off by default, separate from the timing benchmark, since tracing
      perturbs timing.
      - Hydration time comes from a small client component added to the
      fixture root layout that calls `performance.mark`.
      
      **Bug fixes**
      - The benchmark was replacing the fixture's `next.config.js` with an
      empty one during runs.
      - If the port was already taken, the benchmark could silently measure
      whatever server was already running there. Both scripts now refuse to
      start if something is already on the port.
      - A server that died on startup used to look like a slow server; now it
      errors immediately.
      - One failed request used to abort the whole run and throw away all
      results. Now it costs one sample and gets counted in `errors`.
      - Killing an already-dead server used to hang the script.
      - Bad flags now error upfront instead of crashing at the end.
      
      ---------
      Co-authored-by: 's avatarClaude Fable 5 <noreply@anthropic.com>
      5f688d27
  2. 22 Jul, 2026 23 commits
    • Benjamin Woodruff's avatar
      Turbopack: Split up turbo-tasks-fs/src/lib.rs into smaller modules (#96030) · 89c94877
      Benjamin Woodruff authored
      This file was way too huge and was wasting a ton of tokens when trying
      to use it with agents.
      
      `turbo-tasks-fs/src/disk.rs` is still a little bigger than I'd like, but
      I think this is an overall improvement.
      89c94877
    • Benjamin Woodruff's avatar
      Turbopack: Use Arc<PathMap> and Box<Path> to make InvalidatorMap slightly more efficient (#95987) · 8882653a
      Benjamin Woodruff authored
      Addresses
      https://github.com/vercel/next.js/pull/95951/changes#r3617631291
      
      - We often already have an `Arc<PathBuf>` here.
      - The data stored in the queue is temporary, so the slight extra size of
      `Arc<PathBuf>` is fine, and saving the clone is nice.
      - The other references to the `Arc<PathBuf>` are not long-lived, so
      convert it into a `Box<Path>` once it goes into the locked map.
      8882653a
    • Benjamin Woodruff's avatar
      Turbopack: Use `swc_core::ecma::utils::prop_name_eq` for a couple of the… · 5639c4ec
      Benjamin Woodruff authored
      Turbopack: Use `swc_core::ecma::utils::prop_name_eq` for a couple of the `next-custom-transforms` (#96035)
      
      Found this helper while looking through one of @sampoder's PRs, noticed
      that these places could benefit from it.
      5639c4ec
    • next-js-bot[bot]'s avatar
      v16.3.0-canary.94 · b2144ddb
      next-js-bot[bot] authored
      b2144ddb
    • Josh Story's avatar
      [Cache Components] Exclude dynamic params from prerenders when no… · 6a39e9d2
      Josh Story authored
      [Cache Components] Exclude dynamic params from prerenders when no generateStaticParams values is provided (#95872)
      
      Fixes an issue in self-hosted and Vercel Adapter that causes some routes
      that prerender static pages to include more route params than expected
      when running in Cache Components.
      
      For all Next.js environments any route matching a root param not already
      in the cache will result in a prerender that includes all params
      regardless of whether they were omitted from generateStaticParams.
      
      For Vercel Adapter environments any route without a fallback that has an
      empty shell during the build will prerender misses with all params
      regardless of whether they were omitted from generateStaticParams.
      
      This change fixes both issues and introduces a comprehensive test matrix
      to catch regressions in these kinds of prerender decisions in the future
      
      closes NAR-882
      6a39e9d2
    • Andrew Clark's avatar
      Gate `partialFallback` behavior behind `partialPrefetching` flag (#96074) · 203177bb
      Andrew Clark authored
      `partialFallback` is an internal flag in the build output that controls
      the behavior of ISR. When it's enabled, in a Cache Components app, pages
      that are not generated at build time are upgraded to a full ISR entry
      upon the first request.
      
      This is a useful feature but there's a risk it could lead to an
      explosion in ISR costs, because even a prefetch request is sufficient to
      trigger an upgrade.
      
      The desired behavior is that we only trigger an upgrade for an actual
      navigation request, or if a link opts into prefetching with the
      `prefetch` prop.
      
      Currently there's no way for ISR to differentiate between a shell
      prefetch request (no prefetch prop on the link) and an actual prefetch
      (`prefetch={true}`). The plan is to introduce additional configuration
      to the build output that specifies which headers should trigger which
      operations.
      
      So by default, this PR turns the `partialFallback` flag back off until
      the new mechanism is available to us.
      
      However, for apps that opt into Partial Prefetching, we will continue to
      set `partialFallback` to true. That's because in a Partial Prefetching
      app, per-link prefetch requests are always opt-in. So even without
      additional support at the ISR behavior, we avoid an unexpected surge in
      ISR costs by not sending the prefetching request in the first place.
      There will still be a single request per distinct route (_not_ per
      distinct URL!), which we will optimize later.
      203177bb
    • Sam Poder's avatar
      [turbopack] Fix deployment skew protection for component chunks (#96079) · 5b9d43b5
      Sam Poder authored
      Noticed this bug where we were assuming chunks were plain strings, which
      may not always be the case given #95261. When putting together
      https://github.com/react/react/pull/37095, I noticed this was also a
      spot we were missing so this fixes that.
      
      Almost all of this diff is a regression test.
      5b9d43b5
    • dan's avatar
      Turbopack: stop copying sourcesContent into every serialized source map (#95934) · 3d018005
      dan authored
      This reduces peak memory consumption with the original repro case in
      [vercel/next.js#81161](https://github.com/vercel/next.js/issues/81161).
      
      If you walk the 15 routes in a quick succession and capture vmmap
      --summary at the end of each fast sweep (before memory is released),
      with this change the number reliably goes down from 3 GB to 2.6 GB:
      
      ```
      before	1	3.0G	17
      after	1	2.6G	16
      before	2	3.0G	16
      after	2	2.6G	16
      before	3	3.1G	18
      after	3	2.6G	17
      before	4	3.1G	17
      after	4	2.6G	16
      before	5	3.1G	17
      after	5	2.6G	17
      before	6	3.0G	17
      after	6	2.5G	17
      before	7	3.1G	17
      after	7	2.6G	17
      before	8	3.0G	25
      after	8	2.6G	24
      before: [3.0, 3.0, 3.1, 3.1, 3.1, 3.0, 3.1, 3.0] 
      after:  [2.6, 2.6, 2.6, 2.6, 2.6, 2.5, 2.6, 2.6]
      mean before=3.050G after=2.587G  diff=0.462G (-15.2%)
      exact permutation test: p = 2/12870 = 0.00016
      ```
      
      More runs on this app:
      
      <img width="938" height="623" alt="Screenshot 2026-07-22 at 20 59 12"
      src="https://github.com/user-attachments/assets/01c41656-eb5a-41f9-8871-b4ce262c54d5"
      />
      
      And here's an internal app showing ~20% dev memory win at peak (although
      reclaiming memory settles it):
      
      <img width="832" height="402" alt="Screenshot 2026-07-22 at 16 45 34"
      src="https://github.com/user-attachments/assets/8c39f668-d431-43f9-b533-d39dfaa97c15"
      />
      
      ---
      
      <details>
      
      Module source maps are serialized to a JSON rope right after code
      generation and treated as opaque bytes from then on. Since
      `sourcesContent` — the full original source text — is inlined into that
      JSON, every later step that modifies the map has to copy all of it:
      rewriting the `sources` URLs for each chunking context copies the entire
      map per context, and embedding the module map into a chunk's sectioned
      map copies it again, once per layer that includes the module. In a dev
      session on a dependency-heavy app, each module's source text ends up
      resident ~5 times over, and source maps end up dominating the memory the
      task store holds for codegen output (in one measured app, maps were 57%
      of module factory bytes, and `sourcesContent` alone was 36%).
      
      This PR stops copying the text. `StructuredSourceMap` keeps a map in
      field form until the moment it is actually emitted:
      
      - Fields we never touch (`mappings`, `names`, `version`, ...) are stored
      as verbatim raw JSON snippets, so producers' bytes round-trip untouched
      and re-emission is rope sharing rather than re-serialization.
      - `sources` is the one field rewrites modify, so it is stored typed, and
      the per-chunking-context "fileify" rewrites become a plain string
      rewrite of that field instead of a parse–modify–reserialize of the whole
      map.
      - `sourcesContent` entries are individual, already-JSON-escaped ropes.
      Rewritten maps and chunk maps share them; the source text is escaped
      once per module and never copied again.
      
      Two construction paths, chosen by where the bytes come from: maps we
      generate ourselves are built directly from the `swc_sourcemap` object
      (`from_swc_map` takes the contents out, serializes the small remainder,
      and never round-trips source text through JSON), while maps that arrive
      as bytes (prebuilt maps next to external code, the
      single-complete-original fast path) go through `from_json`. The emitter
      writes fields in exactly `swc_sourcemap`'s order and format, pinned by
      golden tests that assert byte-identity with `to_writer` — so emitted
      chunks and maps are byte-for-byte unchanged, and no snapshot fixtures
      change. The CSS pipeline gets the same treatment; the single-file output
      path is left alone since it serializes straight into the final artifact
      and there is nothing to share.
      
      The win is proportional to how much duplicated source-map text an app
      holds, so results range accordingly. On a dependency-heavy reproduction
      app (13 routes sharing large wallet SDKs; rapid route sweep in `next
      dev`, macOS physical footprint, 8 interleaved cold runs per side): 3.05
      GB → 2.59 GB mean (−15%), with zero overlap between the two
      distributions (exact permutation test p ≈ 0.00016) and per-route
      latencies unchanged. On `bench/basic-app` (small first-party modules): a
      full sweep of all 42 routes drops the post-sweep footprint 3.4–3.5 GB →
      2.4–2.5 GB (−29%, interleaved runs); cold compile −4%, idle footprint
      identical (eviction reclaims both sides equally at idle). On
      `bench/heavy-npm-deps` (heavy deps disabled in its default config) and
      on very large first-party apps whose memory is dominated by the JS heap
      and application state rather than map text, the change measures flat —
      as expected, since there is little duplicated text for sharing to
      recover. `small_apps` build benchmarks are flat except `date-fns-all` at
      +1–2% (~2.5 ms): that app is 1000+ tiny modules and `from_swc_map` adds
      one small-skeleton JSON parse per module, with no redundancy to win back
      in a single-context one-shot build. The single-complete-original fast
      path (per prebuilt module with a shipped map, and per minified chunk) is
      cost-neutral: the structured map is built by splitting the raw map's
      serde fields directly (`from_serialize`), so the serialized document is
      never materialized or re-parsed — 93 ms per 5 iterations on a synthetic
      21.7 MB map, matching the pre-PR baseline exactly, with byte-identical
      output pinned by a property test. Serialized task-store size is
      unchanged (bincode expands sharing back out), so this is purely a
      live-memory change.
      
      Verified: snapshot suite passes with zero fixture changes, execution
      suite matches canary (the single pre-existing failure reproduces on the
      base tag), unit suites pass including new golden byte-identity tests,
      and emitted `.map` files were validated end-to-end in a running dev
      server (multi-section chunk maps, fileified `file://` sources,
      `sourcesContent` present and byte-identical between base and this
      branch).
      
      </details>
      3d018005
    • Vercel Release Bot's avatar
    • Janka Uryga's avatar
      fix: cache miss in App Shell for cached pages with gSP (#95665) · 63f14c6c
      Janka Uryga authored
      If we're prerendering an App Shell, then url data is excluded (i.e. we
      don't advance beyond the `ShellRuntime` stage). however the prospective
      prerender was still letting params/searchParams resolve, so if those
      ended up being inputs to a page, they wouldn't be hanging inputs, and
      we'd get a cache miss for them in the final prerender.
      
      closes NAR-883
      
      ---------
      Co-authored-by: 's avatarHendrik Liebau <mail@hendrik-liebau.de>
      63f14c6c
    • Aurora Scharff's avatar
      skill(cc-adoption): add dev-only validation sweep reference (#96057) · e8a2dd17
      Aurora Scharff authored
      ### What?
      
      Add an optional post-adoption reference to the Cache Components adoption
      skill, `references/dev-only-validations.md`, and point to it from the
      skill's further reading.
      
      ### Why?
      
      After adoption the build passes, but dev validation (default
      `validationLevel: 'warning'`) still raises instant-navigation insights
      on every page load that never fail the build. The skill had no recipe
      for sweeping them, so this closes that gap as a recommended next step,
      offered as the smaller path to instant navigation for users who don't
      want to adopt Partial Prefetching.
      
      ### How?
      
      The reference details the loop: reuse the `next-dev-loop` preflight,
      load each route in `next dev`, read the Insights tab and dev log, and
      fix. The mechanics mirror the tested `next-partial-prefetching-adoption`
      skill (dev log record, amber Insights tab, `get_errors` not
      `get_request_insights`, webpack fallback). The further-reading section
      now recommends the sweep and drops the standalone Prefetching bullet,
      which the Partial Prefetching adoption skill already carries.
      e8a2dd17
    • Aurora Scharff's avatar
      Refine Cache Components and Partial Prefetching adoption skills (#95817) · ba55bd63
      Aurora Scharff authored
      Refinements to the Cache Components and Partial Prefetching adoption
      skills from running them cold against real apps, plus the doc changes
      they lean on.
      
      **Skills**
      - PPF: URL-data sweep reworked to feature-by-feature with a resumable
      hand-off, and the requires section now says unfinished Cache Components
      adoption doesn't gate the skill. Prerender insights are non-blocking dev
      signals expected on a fresh branch; only a build-blocking failure stops
      the run.
      - PPF: install `next-dev-loop` without asking, and verify a real blocker
      before falling back.
      - CC: dropped the hard-coded `agent-browser` version pin; updated the
      PPF cross-reference to the current enable-first flow.
      
      **Docs**
      - `runtime-prefetching`: the per-card server cost of `allow-runtime`
      grids is specific to `prefetch={true}`, with hover-triggered prefetch as
      the mitigation.
      - `use-cache`: the request-API restriction follows the call stack
      (`next-request-in-use-cache`, can pass build and fail under `next
      start`), and the nested-`cacheLife` build error with its fix.
      - `instant` route segment config: removed a stale `version: draft` so
      the page publishes.
      
      <!-- NEXT_JS_LLM_PR -->
      ba55bd63
    • Hendrik Liebau's avatar
      [test] Move the dev-only `use cache` test suite to `test/development` (#96023) · c3d5b927
      Hendrik Liebau authored
      The `use-cache-dev` suite only covers dev-mode HMR behavior of `use
      cache`, so it belongs under `test/development/app-dir` alongside the
      other `cache-components-dev-*` suites rather than in `test/e2e`. Because
      `test/development` runs only in dev mode and is never deployed, the
      production-mode placeholder guard, the `skipDeployment` option, and the
      `if (skipped)` early return are all dropped. The three test manifests
      that referenced the old path are updated.
      
      
      ---
      
      <sub>Stack created with <a
      href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
      href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
      c3d5b927
    • Hendrik Liebau's avatar
      Fix stale dev `'use cache'` for cookieless requests and route handlers (#96022) · 286862e3
      Hendrik Liebau authored
      In development, editing a file does not evict existing `'use cache'`
      entries; an entry is invalidated only by re-keying, and the key includes
      an HMR refresh hash. That hash was delivered through the
      `__next_hmr_refresh_hash__` cookie, which the browser HMR client set
      from each server-components change and sent back on later requests. Two
      cases were therefore broken. First, any request that does not carry the
      cookie (a `curl`, a plain `fetch`, a fresh browser profile, a second
      device) served stale cached content after an edit, for both pages and
      route handlers. Second, on Turbopack a route handler served stale
      content even when fetched from a page whose HMR client had the cookie,
      because a route-handler edit never advanced the hash there and so never
      updated the cookie; on webpack that case happens to work, leaving only
      cookieless route handlers broken.
      
      The hash is server-authored to begin with (webpack's `stats.hash`,
      Turbopack's `hmrHash` counter), so this change sources it directly on
      the server and removes the cookie entirely. The hot-reloader exposes it,
      and `base-server` attaches it to each request with `addRequestMeta`,
      next to `serverComponentsHmrCache`, so it reaches every render,
      including the internal Cache Components validation and warmup renders.
      It is threaded onto the request store the same way
      `serverComponentsHmrCache` is, so `'use cache'` is invalidated for every
      client regardless of whether it ran the HMR client. Route handlers,
      whose `NextRequest` does not carry request meta, receive it through the
      app-route template's `renderOpts`.
      
      Editing a route handler also has to advance the hash in the first place.
      On webpack it already did, but on Turbopack the `app-route` entry wired
      no change subscription, so a route edit recompiled the module without
      advancing `hmrHash`; it now subscribes to the route endpoint so an edit
      advances the hash without broadcasting a page refresh. That subscription
      is also made the only thing that advances `hmrHash`: the
      config-invalidation and server Fast Refresh reset paths previously
      bumped it even without a content change, for example on a route's first
      load, and with the hash now read synchronously instead of bounced back
      through a cookie, such a bump would land between a route's cold write
      and warm read and evict a still-valid entry. The getter returns the
      counter unconditionally so the key is present and stable for every
      request, matching webpack's always-present `stats.hash`.
      
      With the cookie gone, the `hash` field on the `SERVER_COMPONENT_CHANGES`
      HMR message has no remaining consumer, so it is dropped from the message
      type and both bundlers.
      
      This is a short-term stopgap until the granular implementation hash
      (`codeHash` plus `runtimeEnvVars` plus the Next.js version) is used in
      `next dev`, which invalidates server-authoritatively by construction and
      will let this mechanism be removed.
      
      > [!TIP]
      > Best reviewed with hidden whitespace changes. 
      
      closes NAR-894
      
      ---
      
      <sub>Stack created with <a
      href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
      href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
      286862e3
    • Hendrik Liebau's avatar
      [test] Add failing tests for stale route handler and page cached data (#96021) · 70f8b678
      Hendrik Liebau authored
      In dev, editing a file does not evict existing `use cache` entries; an
      entry is invalidated only by re-keying, which today is driven by the
      `__next_hmr_refresh_hash__` cookie that the browser HMR client sets
      after each server-component change. A client that fetches directly
      (curl, a plain fetch, a second device) never sends that cookie, so its
      `use cache` key does not change across an edit and the stale entry keeps
      being served even after the module recompiles. This affects both route
      handlers and pages.
      
      This adds two e2e tests, each with its own fixture: a route handler at
      `app/api/cached` fetched through `next.fetch`, and a page at
      `app/cached-page` rendered through `next.render$`. Both paths bypass the
      browser HMR client, so neither request carries the cookie. Each test
      edits its source, waits for the module to recompile (observed through a
      literal read outside `use cache`), then asserts the cached value
      reflects the edit. Both are marked `it.failing` because the gap is not
      yet fixed. They run in dev only and fail in both Turbopack and webpack.
      
      A follow-up change sources the HMR refresh hash on the server rather
      than via the client cookie, so the cache is invalidated for every client
      regardless of how it fetches. Because route handlers and pages build
      their request stores through different paths, covering both here guards
      each one; that change will flip these tests to regular `it`.
      
      closes #95931
      
      ---
      
      <sub>Stack created with <a
      href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
      href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
      70f8b678
    • Hendrik Liebau's avatar
      Add a dedicated HMR message for static params changes (#96020) · a07e947a
      Hendrik Liebau authored
      When `generateStaticParams` is added, removed, or edited in dev, the dev
      server tells connected App Router clients to re-fetch the router tree so
      the next render picks up the new set of statically-known params, and
      thus the fresh `fallbackParams` that blocking-route validation depends
      on. Until now this reused the `SERVER_COMPONENT_CHANGES` message, which
      carries a `hash` field, forcing us to pass a meaningless synthetic value
      (`generateStaticParams-${Date.now()}`). Because that hash flows into the
      `use cache` key through `getHmrRefreshHash`, reusing the message also
      invalidated every `use cache` entry on each static params change, which
      is not the intent here.
      
      This change introduces a dedicated `STATIC_PARAMS_CHANGED` HMR message
      that carries no hash. The App Router client handles it by refreshing the
      current router tree without recording an HMR refresh hash, so it
      reflects the new params without evicting unrelated `use cache` entries.
      The Pages Router client ignores it, since static params are an App
      Router concept.
      
      Beyond removing the unnecessary invalidation, this keeps
      `SERVER_COMPONENT_CHANGES` reserved for genuine server-component
      changes. A follow-up change makes the `use cache` HMR refresh hash
      server-authoritative by capturing webpack's content hash where it is
      produced, in `refreshServerComponents`. With the static params emit
      moved to its own message, that method becomes the sole producer of
      `SERVER_COMPONENT_CHANGES` in the webpack path, so the captured hash is
      complete and correct without a synthetic timestamp producer to
      reconcile.
      
      
      ---
      
      <sub>Stack created with <a
      href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
      href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
      a07e947a
    • Hendrik Liebau's avatar
      Emit the static paths HMR update after updating the cache (#96019) · 35bf8dab
      Hendrik Liebau authored
      In dev, the server sends a `SERVER_COMPONENT_CHANGES` HMR update when
      `generateStaticParams` produces a different set of static paths, so the
      render picks up the new `fallbackParams` (added in #85741). It was
      emitting that update before writing the new result to
      `staticPathsCache`, so the refresh it triggered could read the previous,
      stale result and keep rendering with the old `fallbackParams` (there are
      `await`s for the prerender manifest between the two points, which widens
      the window). This moves the emit to after `staticPathsCache.set`, so the
      triggered refresh always observes the updated result.
      
      This also adds the end-to-end regression test that was missing for this
      behavior. Reusing the existing `use-cache-params/[slug]` fixture, it
      asserts the blocking-route redbox shown when a route reads a fallback
      (unknown) param outside a Suspense boundary, then adds a
      `generateStaticParams` covering the requested slug and asserts the
      redbox clears. Editing the page produces two refreshes: the one the edit
      itself triggers, which still renders with the stale `fallbackParams`,
      and the follow-up update this code emits once the new result is cached,
      which renders with the fresh ones. To ensure the test only passes
      because of the latter, `generateStaticParams` is given a deliberate
      delay so its recompute finishes only after the edit's own refresh has
      already re-rendered with the stale params.
      
      closes NAR-496
      
      ---
      
      <sub>Stack created with <a
      href="https://github.com/github/gh-stack">GitHub Stacks CLI</a> • <a
      href="https://gh.io/stacks-feedback">Give Feedback 💬</a></sub>
      35bf8dab
    • dan's avatar
      [test] Add source-mapping coverage of React's fake stack frame scripts in `use cache` (#95945) · 2549514a
      dan authored
      Adds tests verifying that`use cache` stacks get symbolicated.
      
      We noticed insufficient coverage in
      https://github.com/vercel/next.js/pull/95936, which should have failed
      the tests (it broke symbolication) but tests passed. So this restores
      the missing stack assertions. This also adds some new coverage that
      specifically verifies that symbolicating via CDP also works.
      2549514a
    • Tim Neutkens's avatar
      Fix basePath fallback parameter parsing (#95966) · 2802106d
      Tim Neutkens authored
      ## Summary
      
      - Strip the configured `basePath` from response URL pathnames before
      reconstructing fallback route parameters on the client.
      - Add production regression coverage for both direct hydration and
      client navigation with Cache Components enabled.
      
      This prevents dynamic parameters from shifting when the response URL
      includes a base path but the App Router tree does not.
      
      ## Verification
      
      - Added production Turbopack E2E coverage for direct visits and client
      navigation.
      
      <!-- NEXT_JS_LLM_PR -->
      2802106d
    • next-js-bot[bot]'s avatar
    • next-js-bot[bot]'s avatar
      v16.3.0-preview.8 · bedbdcfe
      next-js-bot[bot] authored
      bedbdcfe
    • Sebastian "Sebbie" Silbermann's avatar
      Always consult `npm_config_user_agent` first (#95879) · 1353c788
      Sebastian "Sebbie" Silbermann authored
      The `getPkgManager` helpers previously consulted the filesystem first
      for files hinting at the used package manager. Only if none were found
      did we check `process.env.npm_config_user_agent` and then shelled out to
      testing which package manager is available.
      
      This change makes all helpers check the `npm_config_user_agent`
      environment variable first. The variable is set by the package manager
      that invoked the process, so when present it is both the cheapest and
      the most direct signal, avoiding filesystem access and subprocess spawns
      entirely. `create-next-app` already used this user-agent-first approach
      and is unchanged.
      
      The check order is now consistent across all three implementations:
      yarn, pnpm, bun, npm for the user agent (the `packages/next` variant has
      no `bun` in its `PackageManager` type and falls through to lockfile
      detection there), and the same order for the codemod's lockfile walk,
      which previously prioritized `package-lock.json`.
      
      Because the invoking package manager now takes precedence over lockfile
      inference, running `npx next ...` or `npx @next/codemod ...` inside a
      pnpm or yarn app is now detected as npm. Use `pnpx` (or `pnpm dlx`) and
      `yarn dlx` instead so the detected package manager matches the project.
      1353c788
    • Jude Gao's avatar
      Rewrite next-cache-components-optimizer around a test-driven instant() loop (#94721) · 1d3bf10c
      Jude Gao authored
      Rewrites `skills/next-cache-components-optimizer` in place: an agentic
      loop that encodes the goal as a failing `@next/playwright` `instant()`
      e2e, works it to green one route at a time, and ships the test as the
      regression guard. Covers initial load (hard navigation) and client-side
      navigation (soft navigation) with a test variant each, a VERIFY-RED gate
      against tests that fail for the wrong reason, and a setup phase that
      records the project's build/deploy/test infrastructure in a
      project-local `instant-nav.rig.md`, so the skill assumes no platform.
      
      Keeps the existing skill name, so the path from adoption to optimizer
      stays one story and there is nothing new to announce. The previous
      dev-loop workflow is replaced wholesale. A PREREQS gate requires Next.js
      16+ with `cacheComponents` and a matching `@next/playwright`, and
      directs an upgrade first when unmet.
      
      Generalized from a burn-down in the v0 codebase, where this loop ran
      agent-driven against CI previews; app-specific examples are scrubbed.
      Related: #94152 adds `instant-navs`; happy to converge the two.
      
      
      Also updates the one paragraph in
      `docs/01-app/02-guides/instant-navigation.mdx` that describes this skill
      to match the new loop.
      
      ---------
      Co-authored-by: 's avatarAurora Scharff <66901228+aurorascharff@users.noreply.github.com>
      Co-authored-by: 's avatarAurora Scharff <aurora.sofie@gmail.com>
      1d3bf10c
  3. 21 Jul, 2026 15 commits