- 02 Mar, 2026 10 commits
-
-
nextjs-bot authored
-
Tim Neutkens authored
## What? Skip bfcache handling server-side.
-
Sebastian "Sebbie" Silbermann authored
-
Tim Neutkens authored
## What? Reduces confusion of time spent in Next.js compared to application code executing
-
Andrew Clark authored
@next/playwright is an experimental package that provides Playwright helpers for testing Next.js navigation behavior. Its main feature is an `instant()` API that lets you assert whether a route is correctly structured for instant navigation — rendering only cached/prefetched content without waiting for dynamic data. The package requires Cache Components to be enabled. It works by setting a cookie that tells Next.js to serve only cached data during navigations, deferring dynamic content until the cookie is cleared. The design is intentionally thin so that other testing frameworks can replicate the same mechanism. Removing the "private" field so the package is included in the next canary publish.
-
Abhishek Mardiya authored
While reviewing the [JSON-LD documentation](https://nextjs.org/docs/app/guides/json-ld ), I noticed that seeing `<script>` instead of `<Script>` can easily feel like a typo > Our current recommendation for JSON-LD is to render structured data as a <script> tag in your layout.js or page.js components. This PR adds a short clarification explaining why the native `<script>` tag is intentionally recommended for JSON-LD. The goal is to reduce confusion and make the guidance clearer for developers reading the docs. @icyJoseph --------- Co-authored-by:
Joseph <joseph.chamochumbi@vercel.com>
-
Karl Horky authored
<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # --> ### What? Update config files in the `with-docker` example inside the `.dockerignore` ### Why? They are outdated ### How? Add lines cc @icyJoseph --------- Co-authored-by:
Joseph <sephxd1234@gmail.com>
-
Niklas Mischkulnig authored
The "cell in async map" pattern
-
Dmitrii authored
Co-authored-by:Dmitrii Troitskii <jsleitor@gmail.com>
-
Tobias Koppers authored
## Summary Fixes `spawnSync /bin/sh ENOBUFS` errors in `scripts/pr-status.js` when fetching large CI job logs. The script uses `execSync` (which internally uses `spawnSync`) to fetch CI job logs via `gh api .../jobs/{id}/logs`. `execSync` has a hard `maxBuffer` limit (set to 50MB), and when CI job logs exceed that size, Node.js throws an `ENOBUFS` error. This causes the flaky test detection to silently fail, reporting 0 flaky tests. **Before:** ``` Fetching logs for 37 failed jobs... [stderr] Command failed: gh api "repos/vercel/next.js/actions/jobs/65135029618/logs" spawnSync /bin/sh ENOBUFS [stderr] Command failed: gh api "repos/vercel/next.js/actions/jobs/65135029722/logs" spawnSync /bin/sh ENOBUFS Found 0 flaky tests (failing on 2+ different branches) ``` **After:** ``` Fetching logs for 18 failed jobs... Found 0 flaky tests (failing on 2+ different branches) ``` ## Changes - Added an `execAsync()` helper that uses `child_process.spawn` instead of `execSync`. `spawn` streams data through pipes with no built-in buffer limit, avoiding `ENOBUFS` entirely. - Updated `getJobLogs()` and the log-fetching loop in `getFlakyTests()` to use `execAsync` instead of `exec`. - All other API calls (small JSON responses) continue using the synchronous `exec()` helper since they are well within the 50MB limit. ## Test Plan Ran `node scripts/pr-status.js 90617` against a PR with multiple failed jobs — completes successfully with no ENOBUFS errors.
-
- 01 Mar, 2026 7 commits
-
-
nextjs-bot authored
-
Andrew Clark authored
Previously, instant() used page.evaluate() to set the cookie via document.cookie, which required a page to already be loaded. This meant the cookie wasn't present on the very first navigation. Switch to Playwright's browser context cookie API so the cookie is set before any page loads. If the page is already loaded, the base URL is inferred automatically. Otherwise, a new baseURL option allows setting the cookie before the first navigation.
-
Andrew Clark authored
## Background Next.js 16 introduced per-segment prefetching through the Client Segment Cache. Rather than fetching all data for a route in a single request, the client issues individual requests for each segment in the route tree. This design improves cache efficiency: shared layouts between sibling routes (e.g., /dashboard/settings and /dashboard/profile sharing a /dashboard layout) are fetched once and reused from the client cache, avoiding redundant data transfer. The trade-off is request volume. A route with N segments now produces N prefetch requests instead of one. Users upgrading from older versions notice significantly more network activity in their devtools, even though the total bytes transferred may be similar or lower due to deduplication. Per-segment fetching is still a reasonable default for many sites. These prefetch requests are served from cache, they're fast, and they run in parallel. The main scenario where the trade-off breaks down is deployment environments that charge per-request. But even setting aside cost, there is a theoretical performance threshold where very small segments are better off inlined — the per-request overhead (connection setup, headers, scheduling) exceeds the cost of transferring duplicate bytes. This is analogous to JS bundlers, which inline small modules rather than creating separate chunks, because the overhead of an additional script tag or dynamic import outweighs the bytes saved. ## What this change does This adds `experimental.prefetchInlining`, a boolean option in next.config.js. When enabled, the server bundles all segment data for a route into a single `/_inlined` response rather than serving each segment individually. The tree prefetch (`/_tree`), which provides route structure metadata, remains a separate request — but optimistic routing (#88965) eliminates that request entirely by predicting the route structure client-side. With both features enabled, prefetching is effectively one request per link. The fundamental trade-off is straightforward: inlining reduces request count at the cost of deduplication. Each inlined response includes its own copy of any shared layout data, so two sibling routes will each transfer the shared layout rather than sharing a single cached copy. This is the same trade-off that compilers and bundlers face when deciding whether to inline a function: inlining eliminates the overhead of indirection (here, extra HTTP requests) but increases total size when the same data appears in multiple call sites. ## Future direction The boolean flag is a stepping stone. The observation that there is a natural size threshold below which inlining is strictly better — where per-request overhead dominates the cost of any duplicate bytes — points toward a size-based heuristic, analogous to how compilers choose an inlining threshold. Small segments would be inlined automatically; segments exceeding a byte threshold would be "outlined" into separate requests where deduplication can take effect. For most applications, this would require no configuration. For applications with specific latency or bandwidth constraints, an option to adjust the threshold would let developers tune their position on the requests-vs-bytes curve. Adaptive heuristics based on network conditions are also possible, though further out.
-
Michal Piechowiak authored
For providers that either don't manage or allow for custom build commands, checking Next.js version in their builders is not reliable. Especially for providers that already have existing support there needs to be very reliable way to only apply certain configuration adjustments for supported versions of Adapters API. So this adds `nextVersion` to `modifyConfig` to allow that. It also brings parity to this hook (`onBuildComplete` already does receive `nextVersion`. Corresponding adjustments for docs (just types update) prepared in https://github.com/vercel/next.js/compare/canary...pieh:next.js:docs/nextVersion-in-adapter-modifyConfig <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # -->
-
Sebastian "Sebbie" Silbermann authored
-
Jiwon Choi authored
The previous method of using the PR endpoint under the hood calls the GitHub API to get the commit SHA, which is a waste of resources, so just use the commit SHA directly in the tarball URL.
-
Sebastian "Sebbie" Silbermann authored
-
- 28 Feb, 2026 9 commits
-
-
nextjs-bot authored
-
JJ Kasper authored
## Summary - Adds `cleanupScriptPath` workflow dispatch input and `NEXT_TEST_CLEANUP_SCRIPT_PATH` env var to `test_e2e_deploy_release.yml` (webpack + turbopack jobs) - Adds `cleanupUsingCustomScript()` method to `NextDeployInstance` following the same pattern as the existing deploy and logs scripts - Calls the cleanup script in `destroy()` before existing teardown logic --------- Co-authored-by:Vercel <vercel[bot]@users.noreply.github.com>
-
Benjamin Woodruff authored
We're getting crashes in node: https://github.com/vercel/workflow/actions/runs/22500511618/job/65186125774#step:10:224 It looks like this should be fixed in newer versions of node: - https://github.com/napi-rs/napi-rs/issues/2555#issuecomment-3645173223 - https://github.com/nodejs/node/pull/55877 - https://github.com/nodejs/node/pull/61400 - https://github.com/nodejs/node/pull/61661 So we may enable the worker threads feature by default if we detect a new enough version of node or bun.
-
Benjamin Woodruff authored
Turbopack: Allow turbopack-node backend to be swapped at runtime using an experimental config option (#90671) <!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? ### Why? ### How? Closes NEXT- Fixes # --> Follow-up to https://github.com/vercel/next.js/pull/86266 This was mostly LLM-generated, but it's just moving things around and threading through a config option. We'd like to be able to turn this on/off with an experimental config option: \- Fixes issues where RA thinks a bunch of code is dead. \- Lets us isolate potential issues to the worker thread implementation. \- Provides an escape hatch for users in case there are issues. \- Better fits the cargo "additive feature" model.
-
Luke Sandberg authored
### What? Replace the two-pass SST file write approach with a single-pass `StreamingSstWriter` that writes blocks incrementally as entries arrive. Also replace the compaction `Collector`'s double-buffered `last_entries` pattern with a streaming collector that wraps the new writer. ### Why? The previous SST write path materialized all entries in memory (keys + values), then wrote all value blocks, then all key blocks. During compaction, the `Collector` maintained two full entry vectors (`entries` + `last_entries`) for size balancing. For large SST files (256MB+), this required holding hundreds of MB of entry data in memory simultaneously. The streaming approach reduces peak memory per writer from hundreds of MB to ~200KB by writing blocks to disk as soon as possible rather than buffering everything. ### How? **Phase 1: `StreamingSstWriter` in `static_sorted_file_builder.rs`** The key insight is that the SST reader is **block-index-addressed** — it locates blocks by index via the offset table, not by file position. So interleaving value blocks and key blocks in any order is fully compatible with the reader. The writer processes entries one at a time: - **Medium values** are written to disk immediately as individual blocks - **Small values** accumulate in a buffer and flush when reaching 8KB - **Key blocks** flush incrementally as the resolved boundary advances A `VecDeque<PendingKeyEntry>` holds entries waiting for their value blocks to be written. Each pending entry contains a `ValueRef` that tracks where its value lives: - `Small { block_index, offset, size }` — already resolved - `PendingSmall { small_block_id, offset, size }` — waiting for small block flush - `Medium { block_index }` — already resolved (written immediately) - `Inline`, `Blob`, `Deleted` — no value block needed The `first_pending_small_index` partitions `pending_keys` into resolved entries (front) and unresolved entries (back). Key blocks are flushed **incrementally** via `try_flush_key_blocks()` at the two points where this boundary advances: - When a small value block is flushed — resolves all `PendingSmall` entries, then calls `try_flush_key_blocks()` to flush any complete key blocks from the resolved region - In `advance_boundary_to()` — processes resolved entries and flushes key blocks via `try_flush_key_block()` when they exceed size or entry count limits This makes adding N entries **O(N) total** instead of O(N²) from the earlier per-call scan approach. **Key block flushing**: The `try_flush_key_block()` method combines the check-and-flush logic — it tests whether adding the next entry would exceed `MAX_KEY_BLOCK_SIZE` (16KB) or `MAX_KEY_BLOCK_ENTRIES`, and if so, flushes the accumulated key block. Entries sharing the same key hash are never split across blocks. **AMQF filter**: Created with `max_entry_count` (an upper bound), then shrunk via `shrink_to_fit()` on `close()` to reclaim unused capacity while preserving false positive rates. **Index block writing**: `IndexBlockBuilder` is generic over `Write` and writes directly to the `BufWriter` during `close()`, avoiding an intermediate buffer allocation. Index blocks use `write_raw_block_to_file` since they are never compressed. **File size**: Computed from the last block offset plus the offset table size, avoiding a `stream_position()` call (which would trigger an unnecessary flush + seek syscall). `write_static_stored_file()` is reimplemented as a thin wrapper around `StreamingSstWriter`, so existing callers (`write_batch.rs`, benchmarks) need zero changes. **Phase 2: Streaming compaction in `db.rs`** The compaction `Collector` is simplified to wrap an `Option<(u32, StreamingSstWriter)>`. The old pattern of maintaining `entries` + `last_entries` vectors with swap/early-flush/split logic (~100 lines) is replaced by direct calls to `writer.add()`. The collector tracks total key/value sizes and a `ValueBlockCountTracker` to know when to finish the current writer and start a new one. **Memory savings:** | | Previous (compaction) | Streaming | |---|---|---| | Entry storage | `entries` + `last_entries` (up to 2× full entry vecs) | ~800 pending key entries (~80KB) | | Value data | All values held in memory until written | Written immediately (medium) or after 8KB (small) | | Peak for 256MB SST | Hundreds of MB | ~200KB per writer | **Performance** Both compaction and write benchmarks are within the noise. It makes sense that this might be slightly slower due to some additional per-entry work, but writing is dominated by other factors `write` syscalls, compression and memcopies into temporary buffers. **Files changed:** - `turbopack/crates/turbo-persistence/src/static_sorted_file_builder.rs` — `StreamingSstWriter` with incremental key block flushing via `try_flush_key_block()`, `PendingKeyEntry`, `ValueRef`; generic `IndexBlockBuilder<W: Write>`; `write_static_stored_file` as wrapper; AMQF `shrink_to_fit()` on close - `turbopack/crates/turbo-persistence/src/db.rs` — Replaced compaction `Collector` with streaming version - `turbopack/crates/turbo-persistence/src/lib.rs` — Export `StreamingSstWriter` - `turbopack/crates/turbo-persistence/src/value_block_count_tracker.rs` — Removed dead `is_half_full()`/`reset_to()` methods **Verification:** - `cargo clippy -p turbo-persistence` — zero warnings - `cargo test -p turbo-persistence` — all 46 tests pass - `cargo fmt -p turbo-persistence -- --check` — clean - Criterion benchmarks show no performance regressions (write + compaction within noise) -
nextjs-bot authored
-
Will Binns-Smith authored
App router types like routes go through the traditional `require` route bypassing the Turbopack runtime, so they aren't easily solved with server HMR right now. Test Plan: Added an e2e test. --------- Co-authored-by:vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
-
Niklas Mischkulnig authored
Fixes this deploy test failure: https://github.com/vercel/next.js/actions/runs/22499483165/attempts/2 The output might be: ``` Building: └ ○ /nested Building: ○ (Static) prerendered as static content Building: ƒ (Dynamic) server-rendered on demand Building: > @ post-build /vercel/path0 Building: > node -e 'console.log("BUILD" + "_ID: " + fs.readFileSync(".next/BUILD_ID") + "\nDEPLOYMENT" + "_ID: " + process.env.NEXT_DEPLOYMENT_ID + "\nIMMUTABLE_ASSET" + "_TOKEN: " + process.env.VERCEL_IMMUTABLE_ASSET_TOKEN)' Building: BUILD_ID: build-TfctsWXpff2fKS Building: DEPLOYMENT_ID: dpl_5Qad8NbhCPWn7QRf5TiCePi58vVi Building: IMMUTABLE_ASSET_TOKEN: undefined Building: Build Completed in /vercel/output [15s] Building: Deploying outputs... Building: Deployment completed ``` Co-authored-by:
JJ Kasper <jj@jjsweb.site>
-
JJ Kasper authored
## Summary For context we discovered jobs were not reliably always running in https://github.com/vercel/next.js/pull/90668 as addapters + turbopack group ran more tests than just turbopack group. - Each sharded test sub-job independently fetched test timings from KV via a turbo task. Because turbo cache keys can vary across job groups and KV can return slightly different data at different times, the sharding algorithm produced different test-to-shard assignments across groups — causing some tests to be missing entirely and others to run in multiple shards. - Adds a `--require-timings` flag to `run-tests.js` that fails loudly if `test-timings.json` can't be loaded from disk, preventing silent fallback to KV or round-robin. - Adds a `testTimingsArtifact` input to `build_reusable.yml` that downloads a pre-built timings artifact instead of fetching via turbo. When unset (default), existing behavior is preserved. - In both `test_e2e_deploy_release.yml` and `build_and_test.yml`, timings are now fetched once in a setup job, uploaded as a GitHub artifact, and downloaded by all sub-jobs — guaranteeing identical shard assignments across all job groups. ## Test plan - [ ] Verify `build_and_test.yml` jobs pick up the shared `test-timings` artifact - [ ] Verify `test_e2e_deploy_release.yml` deploy jobs pick up the shared `test-timings` artifact - [ ] Verify workflows that don't pass `testTimingsArtifact` (e.g. `integration_tests_reusable.yml`, `pull_request_stats.yml`) still use the turbo fallback path unchanged
-
- 27 Feb, 2026 14 commits
-
-
nextjs-bot authored
-
JJ Kasper authored
This ensures we don't try running both webpack and turbopack suites or the report/PR jobs when a custom deploy script is provided.
-
nextjs-bot authored
-
Joseph authored
<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change(s) that you're making: ## For Contributors ### Improving Documentation - Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Fixing a bug - Related issues linked using `fixes #number` - Tests added. See: https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ### Adding a feature - Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. (A discussion must be opened, see https://github.com/vercel/next.js/discussions/new?category=ideas) - Related issues/discussions are linked using `fixes #number` - e2e tests added (https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) - Documentation added - Telemetry added. In case of a feature if it's used or not. - Errors have a helpful link attached, see https://github.com/vercel/next.js/blob/canary/contributing.md ## For Maintainers - Minimal description (aim for explaining to someone not on the team to understand the PR) - When linking to a Slack thread, you might want to share details of the conclusion - Link both the Linear (Fixes NEXT-xxx) and the GitHub issues - Add review comments if necessary to explain to the reviewer the logic behind a change ### What? Added a new "Content negotiation" subsection to the Backend For Frontend (BFF) guide. Updated the `related` links in the frontmatter of the BFF guide to include "rewrites". ### Why? To document how to implement content negotiation using Next.js rewrites and Route Handlers, specifically for serving different content types (e.g., Markdown) based on the `Accept` header. This includes explaining the role of the `Vary: Accept` header for correct caching behavior. ### How? A new subsection was added to `docs/01-app/02-guides/backend-for-frontend.mdx`. The section includes a `next.config.js` rewrite example using `has` to match the `Accept` header. A corresponding Route Handler example (`app/docs/md/[...slug]/route.ts`) demonstrates serving Markdown content. The documentation explains the `Vary: Accept` header and its implications for caching. The `related` links in the frontmatter were updated to point to the rewrites documentation. Closes NEXT- Fixes # --> --- [Slack Thread](https://vercel.slack.com/archives/C07BS1WEYAZ/p1772118031912479?thread_ts=1772118031.912479&cid=C07BS1WEYAZ) <p><a href="https://cursor.com/agents/bc-2c93f44d-958d-5c0b-abe0-a2b36aa76f19"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-web-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-web-light.png"><img alt="Open in Web" width="114" height="28" src="https://cursor.com/assets/images/open-in-web-dark.png"></picture></a> <a href="https://cursor.com/background-agent?bcId=bc-2c93f44d-958d-5c0b-abe0-a2b36aa76f19"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cursor.com/assets/images/open-in-cursor-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://cursor.com/assets/images/open-in-cursor-light.png"><img alt="Open in Cursor" width="131" height="28" src="https://cursor.com/assets/images/open-in-cursor-dark.png"></picture></a> </p> --------- Co-authored-by:
Cursor Agent <cursoragent@cursor.com> Co-authored-by:
Joseph <icyJoseph@users.noreply.github.com> Co-authored-by:
vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
-
Janka Uryga authored
The `runInContext` pattern that's used all over `stream-ops` is weird and feels very unnecessary -- we're passing in callbacks that just get invoked immediately, and all they do is call `AsyncLocalStorage.run`. We should just use the standard `AsyncLocalStorage.run` method outside instead. I commented about getting rid of it somewhere on the original node streams PR, but that got lost when it was was split up. I believe the original reasoning for addding it at all was that some of the node-streams implementations needed to preserve async context for callbacks -- see eg [here](https://github.com/vercel/next.js/blob/558f4248e5e5641d78b865a291c099791460d486/packages/next/src/server/app-render/node-stream-tee.ts#L244). But if that's the motivation, then the current `runInContext` pattern **is wrong anyway** -- sure, it preserves `workUnitAsyncStorage`, but doesn't preserve `workAsyncStorage` and whetever other ALSes may be present, so it's not semantically correct. If this is the goal, then the relevant callbacks should use `bindSnapshot` (i.e. `AsyncLocalStorage.bind`) instead, because it preserves the entire context, not just one ALS. (Note that technically the `runInContext` pattern is salvageable if we just always pass `AsyncLocalStorage.snapshot()`, but then i see no reason why the caller should have to do that. `AsyncLocalStorage.bind` is cleaner) Note that this'll require changes in #89859
-
Joseph authored
- Remove BuildKit cache mount on `.next/cache` that trapped fetch cache in a volume unreachable by the runner stage - Restore `mkdir .next && chown` in runner stage for writable prerender cache - Add commented-out `COPY .next/cache` line as opt-in for persisting build-time fetch cache - Apply same fixes to `Dockerfile.bun` (only needed the `mkdir`/`chown`, it never had the BuildKit mount) Closes #90648
-
Mimori authored
## For Contributors ### Improving Documentation - [x] Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - [x] Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### What? Fix two bugs in the `useReportWebVitals` API reference docs: 1. `navigationType` value `"back_forward"` → `"back-forward"`: the `web-vitals` library intentionally renames this value to use a hyphen for consistency. 2. Variable name mismatch in `handleCustomMetrics` example: parameter was named `metrics` (plural) but the function body referenced `metric.name` (singular), causing a `ReferenceError`. ### Why? The `navigationType` description reflected the raw `PerformanceNavigationTiming` API value (`"back_forward"`), not the actual value emitted by the `web-vitals` library (`"back-forward"`), which `useReportWebVitals` is built on top of Ref: https://github.com/GoogleChrome/web-vitals?tab=readme-ov-file#types The variable name mismatch in the code example would cause a `ReferenceError` if copied as-is. ### How? - Updated `navigationType` description to use `"back-forward"`. - Renamed parameter `metrics` → `metric` in the `handleCustomMetrics` example --------- Co-authored-by:
Joseph <sephxd1234@gmail.com> Co-authored-by:
Joseph <joseph.chamochumbi@vercel.com>
-
Sebastian "Sebbie" Silbermann authored
-
agneliutkiene authored
This proposal adds Hostinger Web Apps Hosting as one additional deployment option in existing deployment documentation. - Keeps language provider-neutral - No runtime or code behavior changes - Keeps current structure and recommendations intact Link used: https://github.com/hostinger/deploy-nextjs --------- Co-authored-by:
Joseph <joseph.chamochumbi@vercel.com>
-
Niklas Mischkulnig authored
This allows specifying a different deployment id for static immutable assets - [x] rename `getImmutableAssetToken` to `getAssetToken` (because it can be non-immutable as well) - [x] disable for webpack Closes PACK-6534 For https://github.com/nextjs/adapter-vercel/pull/25 Part of PACK-6802
-
Tobias Koppers authored
### What? Adds periodic process memory sampling to the Turbopack trace system. Two new capabilities: 1. **`TraceRow::MemorySample`** — A new trace row variant that captures `TurboMalloc::memory_usage()` at ~10ms intervals 2. **`memory_samples`** **in** **`QueryResult`** — When querying a span, returns up to 200 memory usage samples covering the span's time range ### Why? To provide visibility into process memory usage over time in the Turbopack trace viewer. Currently the trace system tracks per-span allocations/deallocations but has no global memory usage timeline. ### How? **Sampling (`turbopack-trace-utils`):** - New `TraceRow::MemorySample { ts, memory }` variant - Sampling triggered from `on_enter` using a three-tier dedup strategy to minimize overhead: 1. Thread-local check (no synchronization) 2. Global atomic read (single load) 3. CAS to claim the sample (only one thread wins per interval) - This ensures at most one sample per 10ms across all threads **Storage (`turbopack-trace-server`):** - Global sorted `Vec<(Timestamp, u64)>` in the `Store` - Insertion-sort step on add (efficient since samples arrive nearly sorted) - Binary search for range queries **Query (`turbopack-trace-server`):** - `memory_samples_for_range(start, end)` returns up to 200 samples - When more exist, merges groups of N by taking the max value per group - Added `memory_samples: Vec<u64>` field to `QueryResult` https://github.com/vercel/turbo-trace-viewer/pull/24 -
Niklas Mischkulnig authored
Disabled for now Expose a hash for each file that should be treated as immutable For https://github.com/nextjs/adapter-vercel/pull/25 Part of PACK-6802
-
Sebastian "Sebbie" Silbermann authored
Instead of just limiting the transform to any file within the app dir, we now restrict it to any page, default, or layout file in the app dir. This avoids having the transform applied to random modules. The inserted value would not have been used by anything.
-
Niklas Mischkulnig authored
Enable skew protection for all start-mode tests when Turbopack is enabled (i.e. not dev). This works by setting `NEXT_DEPLOYMENT_ID` in the test infra - When running the tests, `packages/next/src/server/lib/router-utils/resolve-routes.ts` now validates that all static asset requests have the correct `?dpl=...` query param value, and returns a 404 if missing. - It can be disabled with `disableAutoSkewProtection: true` in the test options - There were various tests that were asserting URLs and were missing the optional `?dpl` at the end. - `next.getDeploymentIdQuery()` can be used to get the `?dpl=dpl_123912js` string (or an empty string) - `next.getAssetQuery()` currently behaves like `getDeploymentIdQuery`, but will switch to prefer the immutable static token in #88607
-