- 11 Feb, 2026 33 commits
-
-
nextjs-bot authored
-
Benjamin Woodruff authored
We don't need this argument now that @lukesandberg switched us to inventory. We do still need some top-level macro and the `Registration` object to resolve the `test_config.trs` file relative to the currently-running test, though we could rename them if anyone thinks of a better name for it, now that it isn't doing function registration.
-
Will Binns-Smith authored
This implements the remainder of functionality needed for Server HMR (Fast Refresh). How It Works - Turbopack detects file changes in RSC modules - Rust sends HMR update payloads to the Node.js runtime via the existing chunk update system - A Node-specific HMR client evaluates changed modules using shared HMR runtime logic (extracted earlier in this stack) - Only modified modules are re-evaluated. Unmodified modules retain their state - Next.js hot-reloader forwards updates to RSC workers, triggering automatic re-renders in clients Test Plan: Added an e2e test confirming that unaffected modules don't get re-evaluated when others change.
-
JJ Kasper authored
## Summary - stabilize the hash navigation assertion in `navigation.test.ts` by checking for query-param-specific RSC requests instead of any RSC request - switch request header reads from `req.allHeaders()` to synchronous `req.headers()` in the request listener to avoid teardown timing errors - keep the existing behavior check that query-param navigation triggers an RSC request
-
JJ Kasper authored
Fixes deployment test failure from https://github.com/vercel/next.js/pull/89771 x-ref: https://github.com/vercel/next.js/actions/runs/21921362927/job/63302154502 ## Summary - update the SCSS `url-global` background-image assertion to allow optional query suffixes on emitted svg asset URLs - this handles deploy-mode URLs that include `?dpl=...` while keeping the existing path checks intact ## Verification - validated against deploy logs from failing job `63302154502`: URLs are correct and include `?dpl=...` - local run: `NEXT_SKIP_ISOLATE=1 NEXT_TEST_MODE=dev pnpm testonly test/e2e/app-dir/scss/url-global/url-global.test.ts` - `sass` case passed - `sass-embedded` case blocked locally by missing `sass-embedded` module in this environment
-
Jude Gao authored
AI coding agents often rely on outdated training data when working with Next.js projects, leading to hallucinated APIs and deprecated patterns. This PR addresses that by shipping version-matched documentation inside the `next` npm package and generating agent instruction files during `create-next-app`. During `next` build, a new `copy_docs` task copies `docs/` from the repo root into `dist/docs/`. Since `"dist"` is already in the package's `files` array, the docs are automatically published at `node_modules/next/dist/docs/`. `create-next-app` gains a new `--agents-md` / `--no-agents-md` flag (defaults to `true`). When enabled it writes two files: - `AGENTS.md` — instructs agents to read `node_modules/next/dist/docs/` instead of relying on training data - `CLAUDE.md` — uses `@AGENTS.md` import syntax for Claude Code The option appears in the recommended defaults display and is prompted during the customize flow. Existing tests are updated with `--no-agents-md` to avoid the new prompt.
-
Sebastian "Sebbie" Silbermann authored
-
Joseph authored
-
nextjs-bot authored
-
JJ Kasper authored
## Summary - update `experimental.adapterPath` docs to match current `onBuildComplete` shape (`routing`, `buildId`, and latest output types) - document `@next/routing` usage and note its experimental status - add runtime entrypoint signature details for Node.js and Edge (`handler(..., ctx)`) - add a new PPR implementation section with markdown flow diagrams for shell/resume stream composition and `requestMeta.onCacheEntryV2` cache updates - link to `nextjs/adapter-vercel` as the reference adapter example
-
Sebastian "Sebbie" Silbermann authored
Co-authored-by:
Cursor Agent <cursoragent@cursor.com> Co-authored-by:
Joseph Chamochumbi <joseph.chamochumbi@vercel.com>
-
Niklas Mischkulnig authored
In all of these cases, the only reason the prerender manifest was passed around was for the previewProps. So do that directly instead.
-
Hendrik Liebau authored
When links remount (e.g. toggling between tabs), the prefetch scheduler processes tasks across multiple async batches due to network bandwidth limits. Between batches, LRU cleanup could fire and evict cache entries for tasks that hadn't been processed yet. Those tasks would then see cache misses, fetch fresh data, push the LRU over the limit again, and trigger more cleanup, cascading through nearly all entries. We fix this by moving LRU cleanup into the prefetch scheduler loop. Instead of scheduling cleanup independently via `requestIdleCallback`/`setTimeout`, the LRU module pings the scheduler when the cache exceeds its size limit, and the scheduler runs cleanup only when it's fully idle (no queued tasks, no in-flight requests). At that point, all active prefetch tasks have finished reading from the cache, so eviction targets genuinely stale data. The tradeoff is that the cache can temporarily exceed its size limit while prefetch tasks are in flight. This was already the case since cleanup was always async, but it's now more explicit since cleanup is tied to the scheduler settling rather than the next idle callback.
-
Sebastian "Sebbie" Silbermann authored
-
Tobias Koppers authored
## Summary Adds deployment ID suffix (`?dpl=<deployment_id>`) to asset URLs referenced in CSS `url()` declarations (images, fonts) for both Turbopack and Webpack builds. This enables proper cache busting for CSS-referenced assets when using `deploymentId` in `next.config.js`. ### Turbopack - Added `static_suffix` field to the existing `UrlBehavior` struct, providing a build-time constant suffix for contexts that cannot use dynamic JS expressions (e.g., CSS `url()` references) - CSS URL resolution now calls `url_behavior(None)` and uses `static_suffix` instead of a separate method - Wired the suffix from `next.config.js` `deploymentId` through `asset_suffix_path()` into all three chunking contexts (client, server, edge) via `default_url_behavior` and `url_behavior_override` ### Webpack - Passed `deploymentId` through the CSS loader config pipeline (`webpack-config.ts` → `config/index.ts` → `css/loaders/` → `postcss-url-parser.ts`) - Appended `?dpl=<id>` to resolved asset URLs in the PostCSS URL parser plugin, placed before any hash fragment so it remains a server-visible query parameter ### Test - Added production test (`test/production/css-url-deployment-id/`) covering global CSS, CSS modules, and SCSS modules with image and font `url()` references - Verifies all asset URLs contain the `dpl` query parameter in both Turbopack and Webpack modes
-
Sebastian "Sebbie" Silbermann authored
This allows rendering the overlay in the background at a lower priority while it's hidden. Part of a larger refactor how we sourcemap errors. The end-goal is to lazily do the sourcemapping with some prefetching which should make the overlay more responsive for many errors or errors in modules with large sourcemaps or source content.
-
Sebastian "Sebbie" Silbermann authored
Co-authored-by:Cursor Agent <cursoragent@cursor.com>
-
Sebastian "Sebbie" Silbermann authored
-
Sebastian "Sebbie" Silbermann authored
-
Tobias Koppers 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 # -->
-
Vasiliy Vanchuk authored
### What? `use` is not a hook. It's highlighted in the doc > Unlike React Hooks, use can be called within loops and conditional statements like if. Like React Hooks, the function that calls use must be a Component or Hook. ### Why? It confuses consumers of Next.js and adds field provide misleading proofs ### How? Closes NEXT- Fixes # --> --------- Co-authored-by:
Joseph <joseph.chamochumbi@vercel.com> Co-authored-by:
Joseph <sephxd1234@gmail.com>
-
Tim Neutkens authored
## What? Remove the `--turbopack` and `--webpack` CLI flags from `create-next-app`. ## Why? Turbopack is now the default bundler in Next.js. The `--turbopack` flag is redundant since it's already the default, and the `--webpack` flag is no longer needed as a `create-next-app` option. The only alternative bundler flag retained is `--rspack`. ## How? - Removed `--turbopack` and `--webpack` option definitions from the CLI in `packages/create-next-app/index.ts` - Simplified bundler selection logic: defaults to Turbopack, with `--rspack` as the only override - Removed `--turbopack` documentation from `packages/create-next-app/README.md` - Removed all `--no-turbopack` flags from test invocations across all create-next-app test files - Removed `--webpack` test cases from app, pages, and app-api template tests
-
Tim Neutkens authored
### What? Improves the Graphite workflow documentation in `.cursor/commands/gt-workflow.md`. ### Why? The previous documentation was unclear about when to use `gt` vs `git` commands, leading to potential workflow issues. ### How? - Clarifies that `gt` should be used for ALL git commands (not just specific ones) - Adds a critical section about staging changes BEFORE running `gt create` to avoid creating empty branches - Updates all `git` references to `gt` for consistency (`git show` → `gt show`, `git status` → `gt status`, etc.) - Improves the command reference table with `gt add` - Reorganizes checklists for clarity ### Improving Documentation - [x] Run `pnpm prettier-fix` to fix formatting issues before opening the PR (handled by lint-staged)
-
Niklas Mischkulnig authored
-
Luke Sandberg authored
Add support for with `type: "text"` under a new experimental flag, following what webpack did (#89560) ## Summary Adds support for the TC39 `import ... with { type: "text" }` proposal to Turbopack, allowing files to be imported as strings. This is gated behind a new experimental flag `turbopackImportTypeText`. ```js // next.config.js export default { experimental: { turbopackImportTypeText: true, }, } ``` ```js import text from './file.txt' with { type: 'text' } // text is a string containing the file contents ``` ### Related TC39 Proposals - **[`type: "text"`](https://github.com/tc39/proposal-import-text)** - Stage 2 - Import file contents as a string - **[`type: "bytes"`](https://github.com/nicolo-ribaudo/proposal-import-bytes)** - Stage 2.7 - Import file contents as a Uint8Array (already supported via `turbopackImportTypeBytes`) ### Implementation Details - Created `TextSourceTransform` which transforms any file into an ES module exporting the file contents as a string - Added `ResourceHasModifier` rule condition to match on ident modifiers, enabling proper module type resolution after source transforms - Refactored `BytesSourceTransform` to use the same pattern for consistency - Both transforms add a modifier to the ident (`text_module` / `bytes_module`) for uniqueness, allowing the same file to be imported both normally and with a type attribute Using a source transform is simpler and allows the modules to participate in other bundler optimizations more easily (scope hoisting in particular) This also fixes a few bugs where `with` imports would conflict with other module type rules: * if you attempted to import a `.js` file with `type:'bytes'` didn't work since the file extension matching would trigger first. * if you set a module type rule in your next config it would override the `with` attribute ## Test Plan - Expanded e2e tests at `test/e2e/turbopack-import-with-type/` -
Tobias Koppers authored
## What? Adds the `experimental.turbopackIgnoreIssue` configuration option, which allows developers to suppress specific Turbopack warnings and errors based on file path, issue title, and/or description patterns. Filtered issues are hidden from both CLI output and the error overlay. ## Why? Developers need a way to suppress noisy or expected warnings from Turbopack without disabling all warnings. This is useful for: - Suppressing warnings from third-party code, generated files, or optional dependencies - Reducing noise in development server output - Hiding expected issues from the error overlay ## How? ### Configuration → Filtering Pipeline 1. **Config types** (`packages/next/src/server/config-shared.ts`, `config-schema.ts`): Each rule has a required `path` (glob string or RegExp) and optional `title`/`description` (exact string or RegExp). All specified fields must match (AND logic). 2. **RegExp serialization** (`packages/next/src/build/swc/index.ts`): Converts RegExp objects to `{ source, flags }` and glob strings to `{ type: 'glob', value }` for transfer to Rust. 3. **Rust deserialization** (`crates/next-core/src/next_config.rs`): `TurbopackIgnoreIssueRule`, `TurbopackIgnoreIssuePathPattern`, and `TurbopackIgnoreIssueTextPattern` types deserialize the config. A `turbopack_ignore_issue_rules()` turbo-tasks function converts them to `IgnoreIssue` rules with proper cache invalidation. 4. **Issue filtering** (`turbopack/crates/turbopack-core/src/issue/mod.rs`): `IssueFilter` is a turbo-tasks value that holds both severity filters and ignore rules. `IgnoreIssuePattern` supports exact string, glob, and regex matching (using `turbo-esregex` for ES-style regex). Matching issues are excluded before severity filtering. 5. **Integration** (`crates/next-api/src/project.rs`, `route.rs`, `empty.rs`): `Endpoint::project()` trait method provides access to the project config. `issue_filter()` builds the `IssueFilter` from project config. All issue collection points use the project's dynamic filter instead of the previous hardcoded `NEXT_ISSUE_FILTER`. ### Documentation - New docs page: `docs/01-app/03-api-reference/05-config/01-next-config-js/turbopackIgnoreIssue.mdx` - Updated Turbopack reference page with experimental options table: `docs/01-app/03-api-reference/08-turbopack.mdx` ### Testing E2E test suite (`test/development/app-dir/turbopack-ignore-issue/`): - **With config**: verifies matching warnings are suppressed from CLI output, matching errors are suppressed from the error overlay, and unrelated pages still compile normally - **Without config**: verifies warnings and errors appear when no rules are defined ### Dependencies - Added `turbo-esregex` for ES-style regex support in Rust ## Example ```js // next.config.js module.exports = { experimental: { turbopackIgnoreIssue: [ { path: '**/vendor/**' }, { path: 'app/**', title: 'Module not found' }, { path: /generated\/.*\.ts/, description: /expected error/i }, ], }, } ``` -
Tobias Koppers authored
### What? Adjusts block sizing constants and heuristics in turbo-persistence to improve the balance between small and medium values, reduce block count, and improve access performance. ### Changes 1. **`MAX_SMALL_VALUE_SIZE`**: 64 KiB → **4 KiB**. Values up to 4 KiB are now stored as small values (packed into shared blocks). Values larger than 4 KiB become medium values with dedicated blocks that can be copied without decompression during compaction. 2. **`MAX_SMALL_VALUE_BLOCK_SIZE` → `MIN_SMALL_VALUE_BLOCK_SIZE`**: Renamed and changed from a maximum (64 KiB) to a **minimum (8 KiB)**. Small value blocks are now emitted once they accumulate at least 8 KiB, resulting in actual block sizes of 8–12 KiB. 3. **`KEY_BLOCK_ENTRY_META_OVERHEAD`**: Updated from 8 to 20 to reflect the actual worst-case overhead per entry in a key block (type, position, hash, block index, size, position in block). 4. **Block count overflow protection**: Added `ValueBlockCountTracker` to prevent exceeding the u16 block index limit (`MAX_VALUE_BLOCK_COUNT = u16::MAX / 2`), which accounts for the 50/50 merge-and-split during compaction. 5. **README**: Updated value type documentation with size boundaries and added a trade-off table covering compression, compaction, access cost, and storage overhead. ### Value type trade-offs | | Inline | Small | Medium | Blob | | --------------------- | --------- | --------------------------- | --------------------- | ----------------------------------------- | | Size | ≤ 8 B | 9 B .. 4 kB | 4 kB .. 64 MB | > 64 MB | | Compression unit size | ≤ 16 kB | 8 kB .. 12 kB | 4 kB .. 64 MB | > 64 MB | | Access cost | none | decompress ~8 kB | decompress value size | open file, decompress value size | | Compaction | re-compressed | re-compressed | copied compressed | pointer copied |
-
Vercel Release Bot authored
This auto-generated PR updates the development integration test manifest used when testing Rspack.
-
JJ Kasper authored
Attempting to fix the devlow job timeouts that have been happening on canary for a bit x-ref: https://github.com/vercel/next.js/actions/runs/21889767463/job/63192963474
-
Vercel Release Bot authored
This auto-generated PR updates the production integration test manifest used when testing Rspack.
-
Benjamin Woodruff authored
Apparently we broke this about 6 months ago and didn't notice: - We briefly had both a `println` (legacy) and a compilation event, leading to duplicate logging. - First: https://github.com/vercel/next.js/pull/80631 - I added a filter to `backgroundLogCompilationEvents` that inadvertently filtered out `SlowFilesystemEvent` on dev. - Around the same time: https://github.com/vercel/next.js/pull/81972 - This removed the old `println` in favor of the compilation event Changes in this PR: - Add `SlowFilesystemEvent` to the filter used in dev. - Increase the threshold from 100ms to 200ms. I'm concerned that with Turbopack's File System cache, that the FS might be more heavily loaded during this benchmark than it was before, and I'd rather err on the "less aggressive" side. - Add a link to https://nextjs.org/docs/app/guides/local-development, which now has documentation on the antivirus thing. Tested with a threshold of 0ms:  There's not any easy way to test this, but it's also clearly not a big deal if it does break, as it's just a debugging hint for performance issues.
-
JJ Kasper authored
Addressing this test being very flakey as well x-ref: https://github.com/vercel/next.js/actions/runs/21887115229/job/63188106850
-
- 10 Feb, 2026 7 commits
-
-
JJ Kasper authored
These have been flaking for quite a while but when going through the steps manually on the deployments they do not repro issues so this appears to be flakey assertions from timing. x-ref: https://github.com/vercel/next.js/actions/runs/21881258559/job/63170127185
-
nextjs-bot authored
-
Will Binns-Smith authored
This PR mostly moves existing code. Most of the diff churn is from re-recording shapshots. This PR is nowhere as scary as the diffstat would have you believe. This extracts the core HMR client logic, abstracting away hooks for platform-specific features like the websocket transport and page reload. In a future PR this will be implemented as an in-process backend for nodejs server hmr. Test Plan: CI, existing hmr tests -
Janka Uryga authored
This PR makes instant validation work for client navigations, albeit in a pretty inefficent way. If we're navigating and have an `instant` config somewhere in the tree, we won't skip shared layouts like a client navigation usually would. Instead, we render all the shared segments too (via `createFullTreeFlightDataForNavigation`, a very simplified variation of `walkTreeWithFlightRouterState`) and use them to perform instant validation on the current page. The client router doesn't mind getting extra segments -- `startPPRNavigation` (and `updateCacheNodeOnNavigation` specifically) ignore segments that are already present in the old tree. This approach has some downsides: - It doesn't match prod behavior (parent layouts don't render there), so it could lead to user confusion - We're validating using different segments that the browser actually has, so we could see an error in the validation that isn't present in the browser but we'll iterate on this later. We only do this when a page is using `instant`, so for now the impact is narrowed down to early adopters. ### Test changes For each test case we have, we now run it both on initial load and on client nav. This got somewhat noisy because i had to reorganize the test files a bit. We use the index pages to test client navigations, but in order to do that, we need the source and the target to be inside the same root layout -- otherwise, they'd be an MPA nav.
-
Will Binns-Smith authored
This change moves runtime code that does not use a module system and is concatenated by Rust into a dedicated `runtime/` directory so it's not confused with other code. It also codifies this in a README and instructs agents to read nearby READMEs so they enforce this convention. **This change only moves code and does not refactor any further.** Snapshot updates reflect the new file paths in the generated runtime code. **Test Plan:** CI, existing tests
-
Will Binns-Smith authored
This adds some basic JavaScript/TypeScript infrastructure for Next to receive and handle server-side HMR updates from Turbopack. This: - Renames some existing hmr code as explicitly client hmr - Adds counterpart apis for server hmr (e.g. subscribe to server HMR events via `project.serverHmrEvents()`) - Add `__turbopack_server_hmr_apply__` runtime function (this is a stub for now, just logs on updates) **Alternatives considered** A single firehose for hmr events, pushing the filtering to the JS side. I figured separate dedicated apis would be cleaner since they’d have to be filtered and switched on anyway. **In future PRs** - Rust: Make Turbopack send 'partial' updates for server file changes - Node dev runtime: Implement module factory replacement in `__turbopack_server_hmr_apply__` - add client notification to trigger re-fetch of rsc - e2e tests
-
nextjs-bot authored
-