1. 22 Aug, 2026 2 commits
  2. 21 Aug, 2026 24 commits
    • next-js-bot[bot]'s avatar
      v16.4.0-canary.1 · 74a30b10
      next-js-bot[bot] authored
      74a30b10
    • Marcos Hernanz's avatar
      docs: fix parallelRouteKey parameter name in useSelectedLayoutSegment(s) (#97710) · e694c08b
      Marcos Hernanz authored
      The `useSelectedLayoutSegment` and `useSelectedLayoutSegments` hooks
      accept a
      parameter named `parallelRouteKey` (singular), as declared in
      `packages/next/src/client/components/navigation.ts`:
      
      export function useSelectedLayoutSegment(parallelRouteKey: string =
      'children')
      
      The docs wrote it as `parallelRoutesKey` (plural) in three files, which
      doesn't
      match the generated `navigation.d.ts` type that editors surface via
      IntelliSense:
      
      - `use-selected-layout-segment.mdx` — parameter signature and
      description
      - `use-selected-layout-segments.mdx` — parameter signature and
      description
      - `parallel-routes.mdx` — "With useSelectedLayoutSegment(s)" section
      
      Docs-only change; no behavior change.
      
      ---
      
      Credit: This contribution was originally authored by @see-stack in
      #97690 and is recreated here with signed commits.
      Co-authored-by: 's avatarSaid Nasser <sdnssr001@gmail.com>
      e694c08b
    • Benjamin Woodruff ‮'s avatar
      Turbopack: Avoid cloning paths in fs watcher if the path is already in a map (#97655) · 49bfb650
      Benjamin Woodruff authored
      This is a spiritual continuation of
      https://github.com/vercel/next.js/pull/96114 . See
      https://github.com/vercel/next.js/pull/94735 for motivation.
      
      This codepath should already be pretty cheap, but in some cases (notably
      inotify on Linux where updates aren't debounced as aggressively by the
      OS) it could become somewhat hot and waste CPU while other
      somewhat-CPU-heavy work is happening in other software (e.g. `pnpm`).
      
      This removes two more sources of clones:
      - If we only have a `&Path`, but it's already in the `paths` map, we can
      use the raw entry API to avoid cloning it.
      - `new_paths` can use `usize` indexes into the `FxIndexMap` instead of
      storing another clone of the path. We could also encode this information
      as flags on `path`, but the iteration over `new_paths` must happen as a
      separate loop before the normal batch execution loop (near the bottom of
      `DiskWatcher::watch_thread`), so I'd like to keep it as a separate data
      structure to avoid having to filter out a bunch of unrelated keys
      without the flag when finally processing the batch.
      49bfb650
    • Jiwon Choi's avatar
      Remove generated error codes (#97687) · d7aa66c3
      Jiwon Choi authored
      ### Why?
      
      Should come up with better solution that does not block PRs with git
      conflict
      
      x-ref:
      https://vercel.slack.com/archives/C02CDC2ALJH/p1785263902728189?thread_ts=1785263687.502649&cid=C02CDC2ALJH
      
      ### How?
      
      - Delete `errors.json`, the error-code SWC plugin, generated WASM, merge
      driver, and validation/build tooling.
      - Stop attaching error codes to server-rendering digests, redboxes, and
      telemetry; native `Error.code` and `Error.name` remain available where
      applicable.
      - Remove the development-overlay error feedback UI, middleware, and
      telemetry event that depended on stable codes.
      - Update fixtures, snapshots, and guidance for code-free errors and
      numeric-only digests.
      
      <!-- NEXT_JS_LLM -->
      d7aa66c3
    • Janka Uryga's avatar
      [PPF] Instant validation for unstable_navigation() (#97309) · 43273a1d
      Janka Uryga authored
      Adds discriminated error messages for `unstable_navigation()` used
      outside of Suspense.
      
      Previously we only had to discriminate two kinds of errors in each
      validation flow:
      - App Shell -- 1. link data (if it resolves in `Runtime`) or 2. dynamic
      data (if it resolves in `Dynamic`)
      - Static Shell -- 1. runtime data (if it resolves in `Runtime`) or 2.
      dynamic data (if it resolves in `Dynamic`)
      
      However, with `navigation()` (96908), the App Shell flow needs to
      distinguish three kinds: 1. link data, 2. navigation (if it resolves in
      `NavigationRuntime`), and 3. dynamic data. This complicates the
      validation code a bit, because we can no longer get away with one retry.
      To accommodate this, i restructured the validation code to no longer
      recurse as a method of retrying. We just loop over an array that defines
      what order we should try the stages in + what kind of hole shows up in
      each stage.
      
      I've also removed `hasAmbiguousErrors` and the associated logic. since
      we're no longer mixing Static+Runtime segments in a runtime prefetch,
      this is no longer relevant -- all segments used for validation use one
      stage, so whether or not the error is ambiguous only depends on the
      stage.
      
      For ease of reviewing, this is split into two commits:
      1. updating the (many) places that need a new `DynamicHoleKind` in our
      error messages. This one has a lot of pretty mechanical changes, and was
      also machine-reviewed for consistency already, but the messages
      themselves are worth looking at (we'll also need to update docs --
      leaving that for a follow-up)
      2. the actual instant validation changes, i.e. using the new
      `DynamicHoleKind` and adding the new pass
      43273a1d
    • Niklas Mischkulnig's avatar
      f5841365
    • Niklas Mischkulnig's avatar
      Migrate some async blocks to async closures (#97666) · 9fbec930
      Niklas Mischkulnig authored
      This is everything except `turbo-tasks-[backend]`
      
      Using ast-grep replacement:
      
      - search: `|$$$ARGS| async move {$$$BODY}`
      - replace: `async |$$$ARGS| {$$$BODY}`
      
      This also made it obvious in some places that we don't actually need
      async-await,
      e.g. `.map(async |v| v.to_resolved.await)`
      9fbec930
    • Luke Sandberg's avatar
      turbo-tasks: add scope_unbounded, a scoped execution primitive that allows more… · 1c86b8a4
      Luke Sandberg authored
      turbo-tasks: add scope_unbounded, a scoped execution primitive that allows more work to be discovered (#95974)
      
      ## What
      
      Adds `scope_unbounded `, a parallel scope to turbo-tasks: jobs run on a
      shared work-queue, any job may enqueue more, and the pool is drained by
      the runtime worker threads plus the calling thread until empty.
      
      ## Why
      
      The garbage collector (later in this stack) needs to process a pool of
      work that *discovers more work as it runs* — collecting a task cascades
      into collecting newly-parentless children. A fixed `parallel::for_each`
      can't express that. `scope_self_feeding` is the general primitive for
      "parallel pool where jobs spawn jobs".
      
      ## Design notes
      
      - **Deadlock-safe on thread-limited / contended runtimes.** Helper
      workers are a pure optimization: the calling thread always makes
      progress on the shared queue on its own, so the pool completes even when
      no worker threads are available.
      - Supports growing/shrinking the set of workers pulling from the queue
      based on the amount of work available.
      - Supports a simple mostly lock free way to aggregate data from the
      tasks
      - Supports a way for tasks to abort the whole queue, which is important
      for making GC interruptible
      
      ## Testing
      
      There are a fair number of new unit tests and i have done some runs
      under miri
      1c86b8a4
    • Niklas Mischkulnig's avatar
      test: make app-document-import-order more robust (#97682) · 8482890a
      Niklas Mischkulnig authored
      - The `brower.eval(callback)` version was a bit weird, use
      beforePageLoad as we do everywhere else
      - Properly parse the URL and match against the pathname, to not break
      with `?dpl`
      8482890a
    • David Alexandru Ilie's avatar
      Add a Turbopack error for missing root layouts (#97639) · ba9f073c
      David Alexandru Ilie authored
      ## Summary
      
      Turbopack currently builds an App Router page without a root layout,
      leaving the problem to surface later at runtime. Report it while
      building the app structure instead:
      
      `route/page.js doesn't have a root layout. To fix this error, make sure
      every page has a root layout.`
      
      The check uses the layouts already inherited during directory-tree
      traversal, so route groups and apps with multiple root layouts keep
      working. Route handlers are unaffected.
      
      Webpack behavior is intentionally unchanged in this PR.
      
      ## Verification
      
      - `HEADLESS=true pnpm test-dev-turbo
      test/e2e/app-dir/create-root-layout/create-root-layout.test.ts`
      - `HEADLESS=true pnpm test-start-turbo
      test/e2e/app-dir/create-root-layout/create-root-layout.test.ts`
      - `HEADLESS=true pnpm test-dev-webpack
      test/e2e/app-dir/create-root-layout/create-root-layout.test.ts`
      - `HEADLESS=true pnpm test-start-webpack
      test/e2e/app-dir/create-root-layout/create-root-layout.test.ts`
      - `HEADLESS=true pnpm test-dev-turbo
      test/e2e/app-dir/root-layout/root-layout.test.ts`
      ba9f073c
    • Aurora Scharff's avatar
      Improve Partial Prefetching adoption checks (#97637) · d2efd9ce
      Aurora Scharff authored
      ## Summary
      
      Dogfooding the Partial Prefetching adoption skill on v0 exposed two
      preservation checks that should be part of the main workflow:
      
      - trace custom Link wrapper consumers and distinguish declarative
      prefetch props from imperative hover or touch prefetching
      - treat existing instant() assertions as preservation contracts, and
      expand caching only to the smallest coherent rendered subtree when a
      data-only cache does not restore the prefetched UI
      
      ## Verification
      
      - pnpm prettier --with-node-modules --ignore-path .prettierignore
      --check skills/next-partial-prefetching-adoption/SKILL.md
      - Commit hook lint-staged formatting passed
      - Not run: quick_validate.py because PyYAML is unavailable in the local
      skill validator runtime
      
      <!-- NEXT_JS_LLM -->
      d2efd9ce
    • Tobias Koppers's avatar
      test: stabilize poisoned proxy error overlay (#97609) · c0e749f6
      Tobias Koppers authored
      ### What?
      
      Stabilizes the RSC poisoned-import error-overlay test for `proxy.js`
      without weakening or retrying its redbox assertion.
      
      ### Why?
      
      An initially broken proxy can emit the expected build error and then
      force a startup full reload. That reload can clear the overlay before
      the test begins observing it, causing an intermittent `Expected Redbox
      but found no visible one` failure even though validation worked.
      
      ### How?
      
      The proxy parameter now starts from a valid module and introduces the
      poisoned import only after the sandbox page has hydrated. This moves the
      assertion onto the live HMR path and removes the startup-reload race.
      Middleware and instrumentation retain their initial-compile setup
      because their error overlays are reliable there and instrumentation does
      not reliably surface this edit through Turbopack HMR.
      
      ### Verification
      
      - `pnpm test-dev-webpack
      test/development/acceptance-app/rsc-build-errors-poisoned-imports.test.ts`
      - `pnpm test-dev-turbo
      test/development/acceptance-app/rsc-build-errors-poisoned-imports.test.ts`
      - Proxy case repeated 5 times with Webpack and 3 times with Turbopack
      - Prettier, ESLint, and `git diff --check`
      
      <!-- NEXT_JS_LLM -->
      
      ---------
      Co-authored-by: 's avatarvercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
      Co-authored-by: 's avatarTobias Koppers <1365881+sokra@users.noreply.github.com>
      c0e749f6
    • Joseph's avatar
      docs: correct the upper stale bound for App Shell exclusion in cacheLife (#97653) · b2c48352
      Joseph authored
      Clarifying that:
      
      > - **`stale` from 30 seconds up to 5 minutes**: included in prerenders,
      but excluded from the route's [App Shell](/docs/app/glossary#app-shell).
      
      Means, 30 <= stale and stale < 5minutes
      b2c48352
    • Joseph's avatar
      docs: Adapters entry page lists its children pages twice (#97677) · a91dff6e
      Joseph authored
      Both https://nextjs.org/docs/app/api-reference/adapters, and
      https://nextjs.org/docs/pages/api-reference/adapters lists their
      children twice, once from the PR content, and another from next-site's
      rendering engine. Let's keep the next-site UI, as it lists each entry as
      a card with title + description.
      a91dff6e
    • Janka Uryga's avatar
      [PPF] unstable_prefetch() (#97622) · 3cdb56c2
      Janka Uryga authored
      Implements `unstable_prefetch()`, which is intended for use in
      `partialPrefetching`. `await unstable_prefetch()` excludes content from
      the app shell -- it will only be available when using `prefetch={true}`
      (speculative prefetch) or during navigations.
      
      As a rule of thumb, `unstable_prefetch()` resolves whenever static
      `params` would:
      - in a static prerender
        - but NOT the app shell extracted from it, which is param-less
      - in a runtime prefetch (`prefetch={true}`)
        - but NOT a runtime app shell, which is param-less
      
      Note that `prefetch()` is URL data, so using it in an App Shell without
      Suspense will trigger an instant insight.
      
      ### Implementation notes
      
      `prefetch()` is treated like URL data, so it resolves in the
      `PrefetchStatic/PrefetchRuntime` stages added in #96908. The
      implementation is basically analogous to `unstable_navigation()` except
      using different stages. i've considered abstracting them into one
      implementation, but decided against that for now, we can deduplicate
      later.
      
      Error messages about URL data have not been updated to mention it yet --
      we will do that as a follow up, along with docs.
      
      `await prefetch()` does not count as a runtime data access, meaning that
      it won't affect the static prefetch hint for a route. however `await
      prefetch(); await cookies()` does deopt the route, because using a
      speculative runtime prefetch would reveal more content. Note that this
      may cause us to unnecessarily deopt a shell to runtime even if only the
      speculative part of the content would be improved by a runtime request;
      this is not a new issue, but it's something we should optimize.
      3cdb56c2
    • Janka Uryga's avatar
      [PPF] Scaffold unstable_prefetch() (#97618) · 55b26f96
      Janka Uryga authored
      Scaffolds a new API, `unstable_prefetch()`. It's only allowed in server
      code, so we ban it from being imported in the client.
      Implementation follows upstack. Intended to be merged together.
      55b26f96
    • Joseph's avatar
    • Tobias Koppers's avatar
      fix(turbopack): give eager `import.meta.glob` values the ESM namespace (#96559) · e6ad5cf8
      Tobias Koppers authored
      Eager glob values were built with a plain CommonJS require, so the value
      was a
      module's `exports` object rather than its ESM namespace — for JSON (or
      any
      CommonJS) module that meant no CommonJS interop ran, so
      `modules[path].default`
      (the shape our own docs show) and `{ import: 'default' }` were
      `undefined`. A
      hand-written `import * as ns from './data.json'` did have `default`.
      
      Eager values now use the same namespace-import primitive a static
      `import * as ns from '…'` produces.
      
      <!-- NEXT_JS_LLM -->
      Co-authored-by: 's avatarvercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
      Co-authored-by: 's avatarTobias Koppers <1365881+sokra@users.noreply.github.com>
      e6ad5cf8
    • next-js-bot[bot]'s avatar
      v16.4.0-canary.0 · 32af7900
      next-js-bot[bot] authored
      32af7900
    • zoomdong's avatar
      feat(turbopack): isolate HMR listeners across microfrontends (#95997) · d8203505
      zoomdong authored
      ## Summary
      
      When two Next.js microfrontend child applications run in development
      mode at the same time, their HMR clients conflict because they share the
      same global chunk-update listener registry.
      
      Since turbopack added support for the chunkloadingglobal configuration,
      I think this configuration can also consume HMR's global object
      simultaneously: PR: https://github.com/vercel/next.js/pull/88790 and
      https://github.com/vercel/next.js/pull/93488
      
      This change scopes the listener registry to each runtime chunk-loading
      global so the applications can receive HMR updates independently.
      
      ## Test
      
      Update snapshot test case
      d8203505
    • Niklas Mischkulnig's avatar
      Turbopack: deduplicate Pages Router app chunks (#97664) · 6c0dd840
      Niklas Mischkulnig authored
      Previously, Turbopack treated `_app` and Pages router pages as
      completely separate.
      
      So using code both in `_app` and `pages/foo.tsx` would lead to a lot of
      duplicated code to be loaded at runtime.
      But in reality, `_app` is always loaded for Pages, so we can thread the
      availability info and skip chunking modules that were already loaded by
      `_app`.
      
      Recreation of https://github.com/vercel/next.js/pull/97549Co-authored-by: 's avatarvercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
      6c0dd840
    • Sebastian "Sebbie" Silbermann's avatar
      [react-sync] Check assignability before assigning the actor (#97638) · 8c7ed006
      Sebastian "Sebbie" Silbermann authored
      On scheduled runs of the Update React workflow, `github.actor` often
      resolves to `github-actions[bot]`, which cannot be assigned to pull
      requests in `vercel/next.js`. Since the sync switched to the GitHub App
      token, adding a non-assignable assignee fails the request with 403 e.g.
      https://github.com/vercel/next.js/actions/runs/32392135342/job/96500520936#step:8:781
      (user tokens silently ignored it instead), which failed the entire sync
      run and raced the in-flight reviewer request, leaving the created pull
      request without a reviewer.
      
      The script now checks assignability and skips assignment with a warning
      when the actor cannot be assigned, and the finalize requests (assign,
      request reviewers, add labels) run through `Promise.allSettled`, with
      any failures rethrown together as an `AggregateError` so the run still
      fails on real errors.
      Co-authored-by: 's avatarClaude Code (kimi-k3[1m]) <noreply@anthropic.com>
      8c7ed006
    • WangTao's avatar
      fix: preserve trailing slash during export MPA fallback (#97613) · 14a69ef7
      WangTao authored
      Keeps the trailing slash when a static export falls back to a full page
      load, so you land on the canonical URL instead of bouncing through a
      redirect.
      
      Fixes https://github.com/vercel/next.js/issues/97608
      
      ---------
      Co-authored-by: 's avatarJude Gao <jude.gao@vercel.com>
      Co-authored-by: 's avatarClaude Opus 5 (1M context) <noreply@anthropic.com>
      14a69ef7
    • Benjamin Woodruff ‮'s avatar
      Turbopack: Split the read and write codepath data structures for symlinks (#97395) · b2e835de
      Benjamin Woodruff authored
      Another attempt at cleanup, similar to
      https://github.com/vercel/next.js/pull/96955.
      
      We need different information to write symlinks or junction points (most
      notably, if it's a directory or not) than we get when reading symlinks.
      
      We were trying to use the same data structure for both, but this lead us
      to always call `get_type()` as part of reading a link, which was just
      silly.
      
      This also meant that `write_link` had to handle `NotFound` and
      `Invalid`. `NotFound` is somewhat reasonable (just delete the file), but
      `Invalid` is awkward.
      b2e835de
  3. 20 Aug, 2026 14 commits
    • Benjamin Woodruff ‮'s avatar
      Turbopack: Show last modified file when waiting for the filesystem to settle (#97648) · ee690921
      Benjamin Woodruff authored
      This is a follow-up to https://github.com/vercel/next.js/pull/96116
      
      If we're waiting a long time for your filesystem to settle, we should
      show you the last modified path, so at least you can have an idea of why
      this is happening.
      ee690921
    • next-js-bot[bot]'s avatar
      v16.3.1-canary.26 · 38c38991
      next-js-bot[bot] authored
      38c38991
    • Joseph's avatar
    • next-js-bot[bot]'s avatar
    • Niklas Mischkulnig's avatar
      Turbopack: rename to use turbopack: no side effects (#94427) · 605425e1
      Niklas Mischkulnig authored
      Consistent naming:
      - `"use turbopack no side effects"`
      - `"use turbopack: constants"`
      605425e1
    • Janka Uryga's avatar
      refactor: move useDynamic{Route,Search}Params to reduce snapshot churn (#97360) · e3a78fd3
      Janka Uryga authored
      Relocates `useDynamicRouteParams` and `useDynamicSearchParams` to avoid
      having to update `client-hook-abort-reasons.test.ts` every time there's
      changes in `dynamic-rendering.ts`. Webpack leaked the source location of
      the `React.use` calls inside, so any code change that moved the source
      of the hook would require a snapshot update.
      
      For reasons i don't quite understand, moving the hooks to a different
      file improved the ignore-listing, i.e. we no longer point to the
      internals of the hooks. This is surprising but not unwelcome.
      e3a78fd3
    • Janka Uryga's avatar
      [PPF] unstable_navigation() (#96908) · 1be0ab80
      Janka Uryga authored
      `navigation()` is a new API that allows omitting contents from runtime
      shells and runtime prefetches. Conceptually, the point is to express
      that something is expensive to compute, so we shouldn't do it for
      requests that may not get used (shells and prefetches). Notably, this
      means that it's fine to include it in a static prerender -- it'll be
      computed once and used for many requests, so it doesn't make sense to
      exclude it.
      
      
      
      ## Implementation
      
      The split in behavior across static and runtime prerenders is a
      departure from how most of our APIs behave -- usually, if something
      resolves statically, then it also resolves in "more complete" prerender.
      Departing from this leads to some implementation complexity.
      
      We include three new stages, used by two facets of the implementation:
      
      ```diff
      export enum RenderStage {
        Before = 1,
        //
        ShellStatic = 10,
      + PrefetchStatic = 11, <------- params, prefetch()  [static prerenders]
      + NavigationStatic = 12  <------navigation()        [static prerenders]
        Static = 13, <--------------- finish accumulators [static prerenders]
        //
        ShellRuntime = 20,
        Runtime = 21, <-------------- params, prefetch() [runtime prerenders]
      + NavigationRuntime = 22, <---- navigation()       [runtime prerenders]
        //
        Dynamic = 30,
        Abandoned = 40,
      }
      ```
      
      ### NavigationRuntime
      
      In runtime prerenders (or dev renders that simulate them),
      `navigation()` resolves in `NavigationRuntime`
      We only reach this stage in 1. the embedded runtime prerender produced
      for Cached Navigations and 2. during dev/prod full staged renders --
      runtime shells end in `ShellRuntime`, and runtime prefetches end in
      `Runtime`.
      
      Notably, this means that content gated behind `navigation()` is included
      in the embedded runtime prefetch stream.
      
      ### PrefetchStatic & NavigationStatic
      
      This is a helper stage added before `Static`. Static prefetches still
      use the `Static` stage for their output. This new stage exists so that
      we can resolve static `params` (and `prefetch()` when we implement it)
      which the stage is named after) separately from `navigation()`, which
      resolves in `NavigationStatic`, after which the prerender ends in
      `Static`. This separation is important, because during static prerenders
      we track whether or not runtime APIs are used (see
      `trackRuntimeDataAccessed`) to determine if a runtime shell (or runtime
      prefetch) might give us more content than the static ones. However, a
      runtime shell/prefethc **would not resolve navigation()**, so `await
      navigation(); await cookies()` would not reveal more content, and thus
      shouldn't count as a usage that prevents static optimization.
      We achieve this by checking the stage inside
      `trackRuntimeDataAccessedImpl` and not tracking anything if we reached
      the `NavigationStatic` stage.
      
      ### Behavior of shells and validation
      
      As noted before, `navigation()` has an incompatible resolution order
      between static and runtime prerenders. In #97040, we did some groundwork
      to deal with this in validation.
      
      Static prerenders resolve `navigation()`, which means that static shells
      include content gated behind navigation(). This means that Static Shell
      Validation allows them.
      
      On the other hand, App shells **do not** resolve `navigation()`. This
      leads to an inconsistency for Instant Validation -- a `await
      navigation()` might be fine if a page is prefetched statically, but
      would become blocking as soon as the page starts using runtime data and
      switches to a runtime shell. To avoid this pitfall, we pessimistically
      assume that any `navigation()` _might_ be part of a runtime
      shell/prefetch, so any `navigation()` unguarded by Suspense will error
      in IV.
      
      In practice, this is handled analogously to static params: we do a dev
      render with `needsAppShell: true`, which makes `navigation()` resolve in
      `NavigationRuntime`, and then we use the `ShellRuntime` stage when
      validating, which means that `navigation()` will be a hole. Note that
      the discriminated error message logic currently only retries errors
      using the `Runtime` stage, which won't have `navigation()` resolved
      either, so it will be incorrectly reported as dynamic data. This will be
      improved in a follow up.
      1be0ab80
    • Janka Uryga's avatar
      [PPF] Scaffold unstable_navigation() (#97236) · 2cc3694f
      Janka Uryga authored
      Scaffolds a new API, `unstable_navigation()`. It's only allowed in
      server code, so we ban it from being imported in the client.
      Implementation follows upstack. Intended to be merged together.
      2cc3694f
    • Joseph's avatar
      docs: Explicit cache output description (#97548) · 9b2387d2
      Joseph authored
      Completing the input-output pair for cached functions.
      
      This is addressing user confusion around what happens to a cached
      function, and functions within the scope.
      9b2387d2
    • Aurora Scharff's avatar
      Improve Cache Components sync IO migration guidance (#97572) · e0acfa0b
      Aurora Scharff authored
      ## Summary
      
      - keep incompatible segment config migration before the codemod
      - move synchronous IO fixes after the codemod and normal build so
      `connection()` is applied only to reported blockers
      - use a scoped debug build only when the normal build does not locate
      the reported call
      
      ## Verification
      
      - Not run: product tests (agent skill guidance only)
      
      <!-- NEXT_JS_LLM -->
      e0acfa0b
    • Sebastian "Sebbie" Silbermann's avatar
      [test] Use a non-native stub for the server externals list test (#97614) · 6cb85b58
      Sebastian "Sebbie" Silbermann authored
      Using `keyv` instead of `sqlite3`. This test never installed the package
      but it just looked like it's native binding related due to its choice of
      package.
      6cb85b58
    • Tobias Koppers's avatar
      Avoid GitHub API rate limits for create-next-app examples (#97612) · 52e0cf3f
      Tobias Koppers authored
      ### What?
      
      Use GitHub's raw content endpoint to validate the `package.json` for
      create-next-app examples supplied as repository URLs.
      
      ### Why?
      
      The previous validation used GitHub's unauthenticated Contents API.
      Parallel create-next-app tests can exhaust the shared runner IP's low
      API quota, after which valid examples are reported as missing before
      download or package-manager installation begins.
      
      This surfaced as `EPERM` because execa labels a child exit code of `1`
      with Node's matching errno name; the underlying create-next-app output
      showed the repository lookup failure.
      
      ### How?
      
      Probe the example's `package.json` directly on
      `raw.githubusercontent.com`. This preserves the existing existence check
      while removing the rate-limited API request from URL-based example
      creation. The actual archive download continues to use
      `codeload.github.com` as before.
      
      ### Verification
      
      - `IS_WEBPACK_TEST=1 NEXT_TEST_MODE=start pnpm test-start
      test/production/create-next-app/package-manager/yarn.test.ts`
      - `pnpm build-all`
      - `pnpm --filter create-next-app build`
      - `pnpm types`
      
      <!-- NEXT_JS_LLM -->
      Co-authored-by: 's avatarvercel-fleet-prod[bot] <318278635+vercel-fleet-prod[bot]@users.noreply.github.com>
      Co-authored-by: 's avatarTobias Koppers <1365881+sokra@users.noreply.github.com>
      52e0cf3f
    • Sebastian "Sebbie" Silbermann's avatar
      [test] Cover the prerender worker-thread backend with an addon we control (#97543) · 55e7e190
      Sebastian "Sebbie" Silbermann authored
      `experimental.workerThreads` decides whether static generation runs in
      real worker threads or forked child processes, and a native addon
      declared with `NODE_MODULE` can only be loaded once per process. That is
      why the flag defaults to false (#9199) and why the static export worker
      was fixed to respect it rather than hardcoding threads on (#25063).
      Nothing tested it: the only suite that tried, `firebase-grpc`, had its
      assertion skipped since 2019, and modern `firebase` ships no native
      module at all, so its remaining test asserted only that a build
      succeeds.
      
      This adds a `single-context-addon` fixture, deliberately declared with
      `NODE_MODULE`, and a production suite asserting both directions: the
      build succeeds by default and fails with "Module did not self-register"
      once worker threads are enabled. The fixture loads the addon from
      `next.config.js` as well as from the page, because that failure only
      happens on a second `dlopen` within one process, so an addon loaded only
      inside the worker would register there and the build would pass.
      
      A third case documents a bug rather than intended behaviour. `next
      build` runs Turbopack in a worker thread and that worker re-evaluates
      `next.config.js`, so requiring a non-context-aware addon from the config
      breaks the build even with `experimental.workerThreads` off. Webpack and
      rspack are unaffected, since their build workers are forked child
      processes. Isolated with an unguarded `require` and default flags,
      Turbopack exits 1 with "Module did not self-register" where webpack
      exits 0. It is the same class of failure #9199 and #25063 fixed, in a
      worker those PRs did not touch. The assertion is branched on the bundler
      and carries a note to drop the branch once Turbopack stops evaluating
      the config on a worker thread. The `isMainThread` guard in the fixture's
      config keeps the first two cases pointed at the static generation worker
      instead.
      
      A development suite covers the other direction, asserting that
      evaluating a route does not put such an addon on one of the threads
      `next dev` uses regardless of the flag, so it would catch a change that
      moved route evaluation onto the dev validation pool. The expectation is
      the same with and without Cache Components; both were checked by logging
      the thread id from the page's module scope, and the route is evaluated
      on the main thread either way.
      
      `firebase-grpc` is removed, since it covered the same flag with a
      skipped assertion and a vacuous one.
      55e7e190
    • Sebastian "Sebbie" Silbermann's avatar
      [test] Convert the `prerender-native-module` suite to local fixture packages (#97542) · 33af645b
      Sebastian "Sebbie" Silbermann authored
      This suite installed `sqlite` and `sqlite3` on every run to prerender a
      page from a checked-in SQLite database. Neither package was needed for
      what the test covers. The pinned `sqlite3@5.0.2` has no linux-arm64
      prebuild, and every job that runs this suite is linux-arm64, so each one
      compiled the SQLite amalgamation from source. That pin is also Node-API
      based and therefore context-aware, so it could no longer reproduce the
      abort the suite was originally added for.
      
      The fixture now uses its own compiled `native-addon` plus a
      dependency-free JS wrapper standing in for `sqlite`'s role, and reads
      its rows from a plain JSON file. The `path.join(process.cwd(), ...)`
      expression stays in the page, because output file tracing only follows
      it from the app's own code, so moving it into the wrapper would stop the
      data file being traced.
      
      The emitted traces were read rather than assumed. Turbopack and
      `@vercel/nft` produce the same fixture entries, including the compiled
      binary at `native-addon/build/Release/native_addon.node` and the
      `process.cwd()`-derived `users.json`.
      
      The trace assertion now checks each pattern separately instead of
      collapsing them into a single `every(...)`, which could only report that
      something did not match. The `notTests` block went away with it, since
      `[].some(...)` asserted nothing.
      33af645b