- 13 Aug, 2025 5 commits
-
-
nextjs-bot authored
-
nextjs-bot authored
[diff facebook/react@1dc3bdea...f1222f76](https://github.com/facebook/react/compare/1dc3bdea...f1222f76) <details> <summary>React upstream changes</summary> - https://github.com/facebook/react/pull/34183 - https://github.com/facebook/react/pull/34192 - https://github.com/facebook/react/pull/34186 - https://github.com/facebook/react/pull/34187 </details>
-
nextjs-bot authored
-
Jude Gao authored
The `key` prop on `<Head>` component differs during prerender and a PPR resume because of search params being part of the key, causing the resume to treat them as distinct components, hence the error\*. However, it is necessary semantically to include search params in the key for `<Head>`, so we will remove the search params from the key during the resume SSR. \*Mismatch Error: ``` ⨯ [Error: Couldn't find all resumable slots by key/index during replaying. The tree doesn't match so React will fallback to client rendering.] ```
-
Zack Tanner authored
When middleware sets a `Location` header on the response, we should not assume that the target URL is the one we want to handle the request. We only want to route to the underlying location header when a rewrite is explicitly triggered rather than relying on the presence of the response header. --------- Co-authored-by:JJ Kasper <jj@jjsweb.site>
-
- 12 Aug, 2025 30 commits
-
-
nextjs-bot authored
-
Niklas Mischkulnig authored
Closes PACK-5239 https://vercel.slack.com/archives/C04RPSD7EPM/p1753968554253779
-
Zack Tanner authored
`unstable_rootParams()` is deprecated in favor of importing specific params from `next/root-params`. This also requires enabling the experimental feature in nextConfig via `experimental.rootParams`.
-
Benjamin Woodruff authored
Noticed while skimming over this code. It looks like `react-loadable` had a separate `Loadable.Map` API (https://github.com/jamiebuilds/react-loadable/tree/master?tab=readme-ov-file#loading-multiple-resources), but `next/dynamic` doesn't, so we shouldn't check for this. The SWC version of this transform doesn't appear to have copied this code, and doesn't have the `Map` logic.
-
Hendrik Liebau authored
When a page component (or a parallel route slot) is cached, but other parts of the component tree are dynamic, we generate a partially static shell at buildtime that's resumed at runtime. During the resume, we need to ensure that the cache key is the same as during prerendering. This is currently not the case because we automatically include the (unused) `searchParams` prop in the cache key. Its value is a hanging promise during prerendering, and a resolving promise at runtime, leading to a cache miss when looking up the cached page data in the Resume Data Cache (RDC). Subsequently, hydration errors might occur when the recomputed result is different than the prerendered result. Since search params are not allowed to be read in public cache scopes anyways, we can pass erroring search params into the cached page, instead of using a hanging promise, and omit them from the generated cache key. We already used this technique when `cacheComponents` is not enabled. closes NAR-87
-
Benjamin Woodruff authored
- Did my best to reduce the amount of stuff that's `any`-typed. - Add comments for bare null or boolean arguments - The loader was doing `.call(...)` to set `this` all over the place. Pass it as an explicit argument instead.
-
Jiwon Choi authored
-
Vercel Release Bot authored
This auto-generated PR updates the production integration test manifest used when testing Rspack.
-
Vercel Release Bot authored
This auto-generated PR updates the development integration test manifest used when testing Rspack.
-
Janka Uryga authored
In a runtime prefetch, sync IO is dangerous, because it makes us abort the whole prerender. If this abort happens early, a runtime prefetch can end up giving us *less* data than a static prefetch. To prevent this, we can split the final prerender into two separate tasks (which i'm calling "stages" in the code): 1. The static stage (task 1). This is meant to be equivalent to what we'd do during build, so runtime APIs like `cookies()` aren't resolved yet. This lets us render everything that's reachable statically. We should not hit a sync IO here -- if we had, it would've also caused an error during build. 2. The runtime stage (task 2). Here, we allow `cookies()` (and all other runtime APIs available in a runtime prerender) to resolve. We might encounter sync IO errors here (e.g. `await cookies(); Date.now()`), which will make the result suboptimal, but still usable.
-
nextjs-bot authored
-
Ben Gubler authored
# Typed Links: Turbopack support This PR replaces the old `experimental.typedRoutes` implementation with a new approach that works on both Turbopack and Webpack. _Note: a previous version of this PR contained new props for the `Link` component: `path`, `params`, and `searchParams`. In the interest of bringing typed links support to Turbopack as soon as possible, I've removed that change from this PR and will create a new one later._
-
xusd320 authored
### What Avoid using two versions of `twox-hash`
-
nextjs-bot authored
-
Benjamin Woodruff authored
Turbopack: Watch parent directories before watching children in `non_recursive_helpers::start_watching_dir_and_parents` (#82454) Fixes a potential race condition https://github.com/vercel/next.js/pull/82130#discussion_r2249131891: > I think there is a race condition here, when the child dir is created while we are walking the parent directories. > > 1. we try to watch /path/to/dir but it doesn't exist. > 2. /path/to/dir is created > 3. we move to the parent directory (`path/to`) and start watching it. > 4. But we already missed the event that path/to/dir was created. > > I think we need to run the loop reverse direction, watching parent directories first before watching the child directories. This way we already have the parent directory watcher setup before "reading" the child directory (reading in the sense of starting to watch it). Tested by putting a `println!()` in `start_watching_dir` and observing that the parents were watched first when running ``` rm -rf /tmp/fuzz && cargo run -p turbo-tasks-fuzz -- fs-watcher --fs-root /tmp/fuzz ```
-
Joseph authored
Fixes: https://github.com/vercel/next.js/issues/82515 When global-error, and presumably other similar files are defined by users,`next build` (Webpack) outputs this to `.next/server/app/page.js`(removed some values for brevity, see OP for more): ```js layout: [/* */], "global-error": [() => Promise.resolve().then(c.bind(c, 6076)), "/my-app/app/global-error.tsx"], "global-error": [() => Promise.resolve().then(c.bind(c, 6076)), "/my-app/app/global-error.tsx"], "not-found": [/* */], forbidden: [/* */], unauthorized: [/* */], metadata: { /* content */ } ``` Since this is then loaded into memory (copied to a JS file that's later parsed - rather), the last `global-error` key is used ( `{a: 0, a: 100}` is just `{a: 100}`) - In this case though, the duplicate keys have the same value too which makes this a **nice** to fix. This PR does a `reduceRight` pass checking if we have seen this `file` already, if so, skip. That should be safe enough to not introduce regressions. Verified Turbopack builds just for the sake of it - no "issue" there.
-
Jiachi Liu authored
-
Niklas Mischkulnig authored
It ran `postcss(webpack(postcss(filesource)))`, which doesn't work. And changing the order does make sense, since we do want Webpack (SCSS) to run first, and only then PostCSS? #82554 didn't catch every case
-
nextjs-bot authored
-
Steven authored
As a follow up to PR https://github.com/vercel/next.js/pull/82538 this PR adds an experimental flag to optionally skip `sharp.metadata()` and rely only on the JS implementation for format detection.
-
Zack Tanner authored
We are dropping amp support in an upcoming major. This adds a warning for using these configuration options and updates the docs with the warning. --------- Co-authored-by:Sebastian "Sebbie" Silbermann <sebastian.silbermann@vercel.com>
-
Niklas Mischkulnig authored
1. Don't resolve symlinks in `outputFileTracingIncludes`. Otherwise if you specify `node_modules/foo/*` in there, it will resolve to `node_modules/.pnpm/foo/*` and `require("foo")` won't work anymore because there no symlink in `node_modules/foo` anymore. This is also what happens with Webpack 2. Align `read_glob` with `read_dir` in that the hashmap keys only contain the path segment, and not the full path. 3. Support globing parents of the start folder: if the glob can match `..`, then also try to match `directory.parent_folder().read_glob(glob)` Closes PACK-5219 -
Luke Sandberg authored
# Fix glob handling for NFT JSON asset includes and excludes The current webpack version uses the https://www.npmjs.com/package/glob package to match and notably only handles `../` when it appears in a prefix position ([ref](https://www.npmjs.com/package/glob#:~:text=..%20path%20portions%20are%20not%20handled%20unless%20they%20appear%20at%20the%20start%20of%20the%20pattern)), so we do the exact same thing here. This allows our read_glob traversal to only consider traversing 'down' from the root since we can preprocess the patterns to not include `../` or `./` Part-Of PACK-5219
-
Niklas Mischkulnig authored
Don't return the `Result:Err`, but turn into an issue and return `Unparseable` Also fixes the location translation: Lightning CSS uses 1-based columns, while Turbopack uses 0-based column indices.
-
nextjs-bot authored
-
Sebastian "Sebbie" Silbermann authored
-
Tobias Koppers authored
### What? make sure to apply PostCSS on .module.css that is requested from RSC. Fixes a regression from #82448 Closes #82545
-
Sebastian "Sebbie" Silbermann authored
To enable `name` on `Activity`.
-
Rob Pruzan authored
Wraps stories in context providers, and replaces any old arguments that were being passed before the props -> context refactor in devtools Closes NEXT-4642
-
Jude Gao authored
The prelude is empty when the entire app is suspended during prerender. Typically this indicates a lack of suspense boundary in the app, which creates no static shell, thus throwing error. However, if the root layout itself is dynamic but wrapped under a suspense, we need special logic in this PR to detect that.
-
- 11 Aug, 2025 5 commits
-
-
Jude Gao authored
`Mediapartners-Google` used to match both `HEADLESS_BROWSER_BOT_UA_RE` and `HTML_LIMITED_BOT_UA_RE`, causing inconsistent state values for `getBotType`, `isDomBotUA`, and `isHtmlLimitedBotUA`.
-
Benjamin Woodruff authored
Turbopack: Rework watcher data structures, store watched list and watcher behind the same RwLock (#82258) Reworks the data structures used for the watcher to achieve a few goals: - I want to avoid multiple locks, as I don't think we actually need two different locks, and multiple locks leaves more room for bugs (e.g. lock inversion). - The information about if we're in non-recursive mode or recursive mode needs to be available outside of the lock for performance reasons. - The `watching`/`watched` set needs to be ordered. We don't have a convenient concurrent BTreeSet or Trie/Radix Tree pulled in, and I'd like to avoid adding more dependencies. We end up locking `notify_watcher` anywhere we'd need a write lock anyways, so it might block a few reads, but otherwise it's not that bad. Fixes in this PR: - Fixes an issue where multiple concurrent calls to `ensure_watching` for the same directory could cause one of those calls to exit early. This may cause a file in that directory to be read before the filesystem watcher is set up, potentially missing events. - Improves the time complexity of `restore_if_watching` using an ordered set to avoid iterating over all of `watched` to find child directories. See `OrderedPathSetExt`. This time complexity problem is introduced in the previous PR, #82130. Other changes: - It turns out that we don't need to explicitly set up any watchers during `start_watching` except for the `root_dir`. If paths have already been read, they'll set up watchers before re-reading the file when we invalidate it! This simplifies things, and means there's less stuff we need to track if you never start the watcher (i.e. `next build`). - Added a `--start-watching-late` option to the fuzzer to test calling `start_watching` after all the initial reads happen, to help validate the safety of the claim in the previous bullet point. Minor (aesthetic) changes: - Use past tense: `watching` is now `watched` and `ensure_watching` is now `ensure_watched`, as the `watched` list includes both currently active paths *and* previously watched but deleted paths. - Shorten the names of non-public types, because we have a lot more of them, and the names would get long otherwise ## Benchmarking This replaces a `DashSet<_>` with (essentially) a `RwLock<BTreeSet<_>>`. There's some risk of increased contention, particularly in the read-only fast-path for `ensure_watched`/`ensure_watching`. Under the assumption that the most heavily lock-contended use-case for this code is after restoring from persistent cache on a large repository: 1. Check out `vercel-site` in `front`. 2. Hack the new tracing span onto the canary version. 3. Build a release version with `pnpm pack-next --project ~/front/apps/vercel-site --no-js-build -- --release` 4. `rm -rf .next` 5. `NEXT_TURBOPACK_TRACING='turbo_tasks_fs' TURBO_ENGINE_IGNORE_DIRTY=1 pnpm next dev --turbopack` 6. Load `http://localhost:3000/vercel`. Wait for it to fully finish loading. Stop the server with `ctrl+c`. 7. Restart the server, wait for it to finish initializing, and then exit. 8. Start the trace viewer: `pnpm next internal trace .next/trace-turbopack`, and look at the aggregated times of `ensure_watched`/`ensure_watching`. Results: before (canary): 313ms ensure_watching (2235x spans) after (this pr): 279ms ensure_watched (2235x spans) So no significant difference.
-
nextjs-bot authored
-
Joseph authored
Adding docs for `browserDebugInfoInTerminal`
-
Niklas Mischkulnig authored
A few months ago, this was fixed for Turbopack. Adding a regression test now
-