- 11 Aug, 2025 17 commits
-
-
nextjs-bot 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.
-
Steven authored
This is a follow up to PR https://github.com/vercel/next.js/pull/82384 which fixed it for `<link>` but not for `next/font` that embeds local fonts in css. https://nextjs.org/docs/14/app/building-your-application/deploying#version-skew
-
Steven authored
In a previous PR https://github.com/vercel/next.js/pull/82118 we added a fallback to `sharp().metadata()` when the magic number didn't detect the image format in order to improve detection. But `sharp` can be slow to read metadata, so we should avoid it if we can. So this PR uses the existing `image-size` package to detect the content type in JS and only then does it fallback to the native `sharp` code if necessary. No tests were added since this doesn't change the behavior, only performance.
-
Benjamin Woodruff authored
These files need to be committed (why they're not in `.gitignore`), but I'm tired of `ripgrep` capturing these generated files.
-
nextjs-bot authored
-
nextjs-bot authored
-
Niklas Mischkulnig authored
Let's try this again ~~Blocked by https://github.com/vercel/next.js/pull/78058~~ Blocked by https://github.com/vercel/next.js/pull/82448 - [x] Add regression test - [x] Update failing assertions Closes PACK-4304
-
Niklas Mischkulnig authored
Replaces and closes https://github.com/vercel/next.js/pull/78058 Closes PACK-4324 Before, you got duplicate modules because `transition_to_client(postcss(webpack(source in rsc)) != postcss(webpack(transition_to_client(source in rsc))` Now, we have: ``` rsc layer --ESM import-> CSSModuleAsset(in rsc, contains raw SCSS source) --CssReferenceSubType::Inner-> CssAsset(first in client layer, then processed with Webpack loader) ``` This aligns it with when you import CSS from a client component, in both cases the CSS module is first transitioned into the client layer, and then processed with Webpack
-
Benjamin Woodruff authored
**This should be merged alongside #82258, as this introduces a potentially high time complexity operation that #82258 solves.** With this PR and the previous one, my fuzzer shows that we capture every (currently tested) file change correctly: ``` rm -rf /tmp/fuzz && cargo run --release -p turbo-tasks-fuzz -- fs-watcher --fs-root /tmp/fuzz ``` However, this does add an `O(n)` iteration of the `watching` map that I'm working on cleaning up (why this is still a draft). I'll do something similar to https://github.com/vercel/next.js/pull/82133, but it's a bit more complicated to switch to a `BTreeSet` because it's currently using a `DashSet`, and I don't want to introduce more locking than I have to.
-
nextjs-bot authored
-
Luke Sandberg authored
## Fix the build under the `tokio_tracing` feature https://github.com/vercel/next.js/pull/80738 changed the definition of LocalTaskSpec and moved the Display trait impl down to LocalTaskType but updating this use was missed since it is guarded by a feature.
-
Luke Sandberg authored
## Optimze cjs codegen by promoting `module` and `exports` to factory parameters *tl;dr; destructing is hard, lets go shopping!* Currently we prefix factories for cjs modules with `var {m:module, e:exports} = __turbopack_context__;` This is problematic since swc is unable to eliminate these bindings when they are dead (too afraid of es5 getter properties and side effects😭 ). Furthermore we are playing a game of telephone with ourselves since our caller basically is doing `factory({m:module, e: module.exports})` when they call us (this is skimming over a bunch of details, ofc). Instead just pass them directly as function parameters. One downside of this is that we still pass them to `esm` factories even though they are ignored (and simply not declared by the factories). This is not too costly since the caller has trivial access already and browsers are pretty good at handling/ignoring extra parameters (see https://v8.dev/blog/adaptor-frame for the clever way v8 optimizes this). ### Alternatives The main alternative considered was compile time replacing references to `module` and `exports` with `__turbopack_context__.(m|e)`. Unfortunately this breaks subtle edge cases of the cjs spec since it is allowed for users to rewrite `module` and `exports` with assignments (e.g. `exports = 'bad idea'`). This is generally a linter error but not unheard of and we cannot break it. The other alternative considered was enhancing `swc` to inline and dead code eliminate destructuring patterns, but from playing with the playgound it looks like swc is pretty conservative about moving/inlining variables across side effectful statements, so we would still be paying the cost of the declaration in many cases. ## Turbopack Performance Comparison: Head vs Change As expected this is a substantial improvement to commonjs evaluation. The ESM results are kind of confusing. I generally expected 'neutral' since the cost of passing a dead parameters is so small in modern vms. | Test Case | Metric | Head (ms) | Change (ms) | Speedup | Improvement | |-----------|--------|-----------|-------------|---------|-------------| | **Client CommonJS** | Load - Average | 31.61 | 24.38 | **1.30x** | **+29.6%** | | | Load - Median | 32.05 | 24.30 | **1.32x** | **+31.9%** | | | Load - P75 | 33.10 | 24.90 | **1.33x** | **+32.9%** | | | Execute - Average | 25.96 | 19.80 | **1.31x** | **+31.1%** | | | Execute - Median | 25.90 | 19.50 | **1.33x** | **+32.8%** | | | Execute - P75 | 26.50 | 20.20 | **1.31x** | **+31.2%** | | **Client ESM** | Load - Average | 22.28 | 21.94 | **1.02x** | **+1.6%** | | | Load - Median | 21.80 | 21.60 | **1.01x** | **+0.9%** | | | Load - P75 | 23.50 | 22.10 | **1.06x** | **+6.3%** | | | Execute - Average | 50.77 | 48.12 | **1.06x** | **+5.5%** | | | Execute - Median | 50.85 | 47.55 | **1.07x** | **+6.9%** | | | Execute - P75 | 51.60 | 48.30 | **1.07x** | **+6.8%** | | **Pages API CommonJS** | Load - Average | 24.18 | 23.33 | **1.04x** | **+3.7%** | | | Load - Median | 23.27 | 23.57 | 0.99x | -1.3% | | | Load - P75 | 25.29 | 23.96 | **1.06x** | **+5.5%** | | | Execute - Average | 32.23 | 24.26 | **1.33x** | **+32.8%** | | | Execute - Median | 31.16 | 24.34 | **1.28x** | **+28.0%** | | | Execute - P75 | 33.42 | 24.52 | **1.36x** | **+36.3%** | | **Pages API ESM** | Load - Average | 23.48 | 28.91 | 0.81x | -18.8% | | | Load - Median | 23.13 | 28.91 | 0.80x | -20.0% | | | Load - P75 | 25.55 | 29.57 | 0.86x | -13.6% | | | Execute - Average | 63.01 | 55.94 | **1.13x** | **+12.6%** | | | Execute - Median | 61.56 | 55.22 | **1.11x** | **+11.5%** | | | Execute - P75 | 69.56 | 56.40 | **1.23x** | **+23.3%** | **Legend:** - **Bold values** indicate performance improvements (speedups) - Regular values indicate performance regressions (slowdowns) - Speedup = Head Time ÷ Change Time (>1.0 = faster, <1.0 = slower) - P75 = 75th percentile -
Luke Sandberg authored
[turbopack] Fix a small issue in the analyzer where we wouldn't skip assignments to free vars that were just identifiers (#82392) Correctly skip assignments when replacing free variables Drop an `Option<..>` for a parameter that is always supplied. These are fixes i tripped over when attempting to compile time replace `module` and `exports`. That approach failed (see #82285 for what happened instead), but we can keep these cleanups.
-
Tobias Koppers authored
### What? Decrease the frequency of persisting since this is very expensive.
-
Andrew Clark authored
Originally, as part of the clientParamParsing feature, I expected that I would omit param values from the FlightRouterState when sending data from the server, and add it on the client. However, I've since realized this is unnecessary because FlightRouterState is only used during runtime server responses. Not in static responses, like per-segment prefetches. Since the goal of clientParamParsing is to omit param values from static responses, we don't need to change anything about FlightRouterState. We may still want to update how params are processed on the server to more closely match the implementation on the client, but that still doesn't require any changes to FlightRouterState. So, this deletes all the code related to adding client-parsed params to FlightRouterState on the client. None of this was being used anywhere; it was added by previous PRs in anticipation that it would eventually be used. But now we don't need it.
-
- 09 Aug, 2025 3 commits
-
-
nextjs-bot authored
-
nextjs-bot authored
-
Maia Teegarden authored
-
- 08 Aug, 2025 15 commits
-
-
nextjs-bot authored
-
Iakhub Seitasanov authored
regression introduced in https://github.com/vercel/next.js/pull/67166/files#diff-907b7be0cfc75bd37773e5ebc38d1deffa40861b8ac1cde92e4992e284a1ee59R1324 <!-- 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 ### Adding or Updating Examples - The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md ### 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 # --> Co-authored-by:
JJ Kasper <jj@jjsweb.site>
-
JJ Kasper authored
This adds some additional API surface for `build-complete` adapter hook. Wiring up prerenders and additional configs.
-
Jimmy Lai authored
docs: update revalidatePath, revalidateTag docs to be more consistent + highlight res.revalidate case (#82479) - uses invalidate instead of revalidate to make more explicit the revalidatePath, revalidateTag behavior - highlights that eager revalidation can still happen with the pages router method <!-- 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 ### Adding or Updating Examples - The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md ### 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 # -->
-
Vercel Release Bot authored
This auto-generated PR updates the development integration test manifest used when testing Rspack.
-
Benjamin Woodruff authored
Devcontainers support custom `Dockerfile`s, but it seems like it's more recommended to use a base image with "features" on top: https://containers.dev/implementors/features/ Features get applied after the `Dockerfile`, so e.g. if we're installing `rust` with a feature, then we can't install things that depend on `rust` (e.g. `cargo-nextest`: https://nexte.st/) in the `Dockerfile`. So you're forced to do things with features instead, which can specify dependencies and ordering requirements. I removed a bunch of comments that were left over from the template. People wishing to update this file should refer to the https://aka.ms/devcontainer.json link at the top of the file. Also added a lockfile for the features, generated with: ``` devcontainer upgrade --workspace-folder=. ``` **Note:** The `base.Dockerfile` here was entirely unused. ### Testing ``` podman stop --all && podman rm --all # replace podman with docker if you're using docker devcontainer up --workspace-folder=. devcontainer exec --workspace-folder=. zsh ```
-
Jude Gao authored
The issue was that DOM bots with PPR-enabled routes were being forced to use BLOCKING_STATIC_RENDER mode, which prevented them from using the fallback cache lookup mechanism. This caused them to generate new content with isRevalidating: true, which blocks postponed data and triggers the Math.random() static generation bailout error. For HTML bots, they keep using BLOCKING_STATIC_RENDER because SSG was turned off for them and won't see the SSG bailout error. For DOM bots, they should behave like a normal user. Fixes NAR-273
-
Jiachi Liu authored
-
Kit Foster 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 ### Adding or Updating Examples - The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md ### 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 ### How? Closes NEXT- Fixes # --> ### What? Add the `path` field to the App Router https://nextjs.org/docs/app/api-reference/components/image and Pages Router https://nextjs.org/docs/pages/api-reference/components/image docs. This field is valid for both, and currently it's use is hidden in the code. ### Why? Allow people to find and use the field as it is useful for prefixing the `/_next/image` path. --------- Co-authored-by:
Steven <steven@ceriously.com>
-
Tobias Koppers authored
### What? Refactors the side effects optimization. * Gets rid of the `<module evaluation>` and the `<exports>` module. * Only two modules: `<local>` and the facade. * The local module has all the evaluation side effects and local exports. * The facade reexports the local module and all reexports of the module. * `require()` and `import *` will resolve to the facade module * `import "..."` will resolve to the locals * `import { x } from "..."` will follow reexports and finally imports from a locals module -
Tobias Koppers authored
### What? Add more test cases for the side effects optimization that are currently broken Closes https://github.com/vercel/next.js/pull/82411
-
Tobias Koppers authored
### What? Split the existing big `basic` test case into smaller test cases to make it easier to figure out problems
-
Tobias Koppers authored
### What? enable side effects optimization by default in all but 2 test cases
-
Joseph authored
Follow up for: https://github.com/vercel/next.js/issues/74730
-
Benjamin Woodruff authored
## Goal With three different bundlers, we're often forced to duplicate next.js-specific logic and configuration across two or three different bundlers. E.g. https://github.com/SyMind/next-rspack-binding/ would cause us to duplicate our current externals logic across all three. To help, we'd like to have a shared crate that can be used in a few different ways: - Via turbopack (which is itself called through native napi bindings) - Via direct native napi bindings to JS for webpack - Via wasm bindings to JS for webpack [*(note: ideally these would be replaced with napi's recent wasm support, but it doesn't make sense to do that until after the napi v3 migration is done)*](https://napi.rs/blog/announce-v3#webassembly) - Via Rspack (we'd build a custom binary) The wasm bindings (in their current state) and Rspack cannot (or should not) depend on `turbo-tasks`. However, all of the current `next-*` crates depend on `turbo-tasks`. This introduces a `next-taskless` crate for code that can be isolated from performing IO and that does not need to depend on `turbo-tasks`. Code in this crate can be used from wasm or Rspack. ## This PR As a proof-of-concept, this deduplicates our next.js entrypoint templating logic across webpack and Turbopack. It's a large function that doesn't need to directly depend on file IO. Some path manipulation had to be moved out of `turbo-tasks-fs` to support this, so that code is in `turbo-unix-path`. I'm happy to accept different bikeshedded crate names. ## Testing Tested wasm with: ``` pnpm i pnpm swc-build-wasm --target nodejs pnpm build NODE_TEST_MODE=start NEXT_TEST_WASM=true NEXT_SKIP_NATIVE_POSTINSTALL=1 NEXT_TEST_PREFER_OFFLINE=1 node run-tests.js test/production/pages-dir/production/test/index.test.ts ``` Tested turbopack with: ``` pnpm i pnpm swc-build-native pnpm build pnpm test-start-turbo test/production/pages-dir/production/test/index.test.ts ``` Tested webpack with: ``` pnpm i pnpm swc-build-native pnpm build pnpm test-start test/production/pages-dir/production/test/index.test.ts ```
-
- 07 Aug, 2025 5 commits
-
-
nextjs-bot authored
-
JJ Kasper authored
As discussed we can move these tests to run on canary release instead of on every PR. x-ref: [slack thread](https://vercel.slack.com/archives/C02CDC2ALJH/p1754522330101839?thread_ts=1754493332.436339&cid=C02CDC2ALJH)
-
Jiachi Liu authored
-
Josh Story authored
Prior to this change on every navigation we would validate that the initial static shell satisified the rules of cache components. This offers more protection as you edit pages but it slows down navigations and we are already concerned with dev speed and the extra CPU contention can potenially hide or exacerbate other performance characteristics you might notice in dev. So for now we will only validate a page on initial load. This means that if you are trying to debug a page's static shell suitability you will need to refresh the page not just navigate to and from it.
-
Vercel Release Bot authored
This auto-generated PR updates the production integration test manifest used when testing Rspack.
-