- 05 Feb, 2025 16 commits
-
-
vercel-release-bot authored
-
Niklas Mischkulnig authored
Maintain a cache of `VariableId -> JsValue` (per-module), so that we don't reevaluate variables (mostly, unless it's a local variable inside a function call) ``` canary 82026906: 15,3gb TURBO_ENGINE_READ_ONLY=1 NEXT_TURBOPACK_TRACING= TURBOPACK=1 TURBOPACK_BUILD= 501.72s user 108.30s system 760% cpu 1:20.26 total TURBO_ENGINE_READ_ONLY=1 NEXT_TURBOPACK_TRACING= TURBOPACK=1 TURBOPACK_BUILD= 502.01s user 102.27s system 774% cpu 1:18.04 total mischnic/analyzer-link-cache 66d7e1f00c: 15,3gb TURBO_ENGINE_READ_ONLY=1 NEXT_TURBOPACK_TRACING= TURBOPACK=1 TURBOPACK_BUILD= 490.36s user 104.63s system 731% cpu 1:21.34 total TURBO_ENGINE_READ_ONLY=1 NEXT_TURBOPACK_TRACING= TURBOPACK=1 TURBOPACK_BUILD= 489.22s user 106.89s system 780% cpu 1:16.39 total ```
-
Niklas Mischkulnig authored
This might make a difference if the `RequireContextMap` is huge and used across many files More importantly, this seems to solve this failure in the testing backend on https://github.com/vercel/next.js/pull/75440: ``` called 'Result::unwrap()' on an 'Err' value: Cell is empty Stack backtrace: 0: <anyhow::Error>::msg::<&str> 1: <turbo_tasks::backend::TypedCellContent>::cast::<turbopack_emascript::analyzer::RequireContextValue> 2: <turbo_tasks::vc::read::ReadVcFuture<turbopack_ecmascript::analyzer::RequireContextValue> as core::future::future::Future>::poll 3: turbopack_ecmascript::analyzer::well_known::replace_well_known::{closure#0} 4: turbopack_ecmascript::analyzer::linker::visit::<mod::analyzer::bench_link::{closure#0}::{closure#0}::{closure#0}::{closure#0}, turbopack_emascript: analyzer: it {closure#0}>::{closure#0} ```
-
Niklas Mischkulnig authored
AFAICT, Next.js doesn't do this either and this seems to solve this error ``` thread '<unnamed>' panicked at turbopack/crates/turbo-tasks-backend/src/backend/mod.rs:949:13: Dependency tracking is disabled so invalidation is not allowed thread 'tokio-runtime-worker' panicked at turbopack/crates/turbo-tasks-fs/src/lib.rs:265:63: called `Result::unwrap()` on an `Err` value: PoisonError { .. } ``` -
Vercel Release Bot authored
-
Hendrik Liebau authored
[flakiness metric](https://app.datadoghq.com/ci/test/runs?query=test_level%3Atest%20env%3Aci%20%40git.repository.id%3Agithub.com%2Fvercel%2Fnext.js%20%40test.service%3Anextjs%20%40test.status%3Afail%20%40test.name%3A%22use-cache%20should%20error%20when%20cookies%2Fheaders%2FdraftMode%20is%20used%20inside%20%5C%22use%20cache%5C%22%22&agg_m=count&agg_m_source=base&agg_t=count¤tTab=overview&eventStack=&fromUser=false&graphType=flamegraph&index=citest&start=1730967696059&end=1738743696059&paused=false) The error chunks are streaming in while the page is loaded, so `waitForElementByCss` is not sufficient because the error boundary is initially rendered without content, before React replaces it with the expected error messages. https://github.com/user-attachments/assets/adb24a85-d7ac-4bcc-841d-d8f3e0644389
-
Niklas Mischkulnig authored
Meaning fewer cells and fewer tasks No measureable perf difference
-
rauno authored
This PR adds a lot of polish to the experimental Error Overlay: https://github.com/user-attachments/assets/2540b966-c61d-43eb-b816-5ef25f3ecb11 ### Motion - Stacked layers transition smoothly when switching between errors - Height transition for the dialog panel to complement the stacked layers transition - Dialog contents and the backdrop fade in as per Geist Motion Guidelines (`scale`, `opacity`) ### Design - New language icon based on file extension à la (`app.tsx`) - Shadows are clipped with translucent borders to visually be more crisp - Use `backdrop-filter: blur()` for backdrop to blend with application content - Use `font-variant-numeric: tabular-nums` for ←→ switcher to avoid layout shift - Misc alignment improvements ### Interactions - Focus is now trapped in the dialog, <kbd>Escape</kbd> will un-trap and re-focus the last `root.activeElement` - Focus states for all interactive elements - Fluid reveal & collapse of ignored Call Stack items ↓ https://github.com/user-attachments/assets/59a81cea-24ec-4fe4-be00-b911ab484757 Closes NDX-711 Closes NDX-744 --------- Co-authored-by:
devjiwonchoi <devjiwonchoi@gmail.com> Co-authored-by:
Zack Tanner <1939140+ztanner@users.noreply.github.com>
-
Donny/강동윤 authored
### What? Remove one allocation per `transform()` and `minify()`. ### Why? We don't need to allocate `Compiler` in an `Arc`, because we don't share it.
-
Tobias Koppers authored
### What? Allow to continue follow-up tasks even if a task is not completely finished. It can do task completion work in background. This enables more concurrency, especially since all task connecting is at the end of the task now.
-
Tobias Koppers authored
### What? Skip some methods for tasks without children. Reduces number of spans created in tracing.
-
Donny/강동윤 authored
### What? Use `swc_atoms::Atom` instead of `String` in `next-swc`. ### Why? `Atom` does not allocate if another instance has the same value, meaning that `clone()` is a single atomic operation. But `String` allocates regardless of any other occurrence.
-
Donny/강동윤 authored
### What? Use `swc_atoms::Atom` instead of `String` in `next-swc`. ### Why? `Atom` does not allocate if another instance has the same value, meaning that `clone()` is a single atomic operation. But `String` allocates regardless of any other occurrence.
-
Tobias Koppers authored
### What? This changes to order of operations to upper aggregation numbers before connecting children, so they can be added based on the new aggregation numbers.
-
Tobias Koppers authored
### What? Due to the thread local buffer of spans it happens that they are in unexpected order in the trace file. This sorts them by start date.
-
Tobias Koppers authored
### What? Make sure to gracefully shutdown the Turbopack process, by waiting for shutdown before killing the process. This makes sure Persistent Caching will have time to store the cache, before it's killed. That should happen in background while doing SSG. (Maybe we need to change that in future for memory reasons, but it will work for now.)
-
- 04 Feb, 2025 24 commits
-
-
Donny/강동윤 authored
### What? Use `swc_atoms::Atom` instead of `String` in `next-swc`. ### Why? `Atom` does not allocate if another instance has the same value, meaning that `clone()` is a single atomic operation. But `String` allocates regardless of any other occurrence.
-
Donny/강동윤 authored
### What? Use `swc_atoms::Atom` instead of `String` in `next-swc`. ### Why? `Atom` does not allocate if another instance has the same value, meaning that `clone()` is a single atomic operation. But `String` allocates regardless of any other occurrence.
-
Donny/강동윤 authored
### What? Use `swc_atoms::Atom` instead of `String` in `next-swc`. ### Why? `Atom` does not allocate if another instance has the same value, meaning that `clone()` is a single atomic operation. But `String` allocates regardless of any other occurrence.
-
vercel-release-bot authored
-
Wyatt Johnson authored
Designed to enable the client prefetch segments feature when deployed on Vercel, this adds additional fields and data to the manifests to allow the CLI to create the rewrite rules needed to serve the prefetch segments. The fallback routes also now emit their RSC data to disk even though only their filenames are used. We emit the routes for the prefetches using backreferences. For example, for the route: ``` /blog/[...slug].segments/$c$slug$[...slug]/__PAGE__.segment.rsc ``` We create the following Regular Expression: ```ts /^\/blog\/(?<nxtPslug>.+?)\.segments\/\$c\$slug\$\k<nxtPslug>\/__PAGE__\.segment\.rsc$/ ``` Which enforces that the named capture group `nxtPslug` is the same for both the `[...slug].segments` and the `$c$slug$[...slug]`: ``` Matching: /blog/my-post.segments/$c$slug$my-post/__PAGE__.segment.rsc /blog/hello-world.segments/$c$slug$hello-world/__PAGE__.segment.rsc /blog/2024-01.segments/$c$slug$2024-01/__PAGE__.segment.rsc Not Matching /blog/post-1.segments/$c$slug$post-2/__PAGE__.segment.rsc ``` This also fixed a bug where the client segment prefetch keys included double `//`. <!-- 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>
-
Jiachi Liu authored
-
Niklas Mischkulnig authored
No need to cell them, they are module-specific anyway. ``` testing against 0293c96cf32 canary dd676ccb: 14,7 GB TURBO_ENGINE_READ_ONLY=1 NEXT_TURBOPACK_TRACING= TURBOPACK=1 TURBOPACK_BUILD= 533.84s user 84.44s system 834% cpu 1:14.10 total TURBO_ENGINE_READ_ONLY=1 NEXT_TURBOPACK_TRACING= TURBOPACK=1 TURBOPACK_BUILD= 526.68s user 86.15s system 834% cpu 1:13.48 total plus fewer cells b5ce9afeb5: 14,3 GB TURBO_ENGINE_READ_ONLY=1 NEXT_TURBOPACK_TRACING= TURBOPACK=1 TURBOPACK_BUILD= 517.74s user 85.77s system 831% cpu 1:12.54 total TURBO_ENGINE_READ_ONLY=1 NEXT_TURBOPACK_TRACING= TURBOPACK=1 TURBOPACK_BUILD= 516.06s user 85.35s system 836% cpu 1:11.89 total plus no self reads b3370a59ca: 13,8 GB TURBO_ENGINE_READ_ONLY=1 NEXT_TURBOPACK_TRACING= TURBOPACK=1 TURBOPACK_BUILD= 516.65s user 84.11s system 834% cpu 1:12.01 total TURBO_ENGINE_READ_ONLY=1 NEXT_TURBOPACK_TRACING= TURBOPACK=1 TURBOPACK_BUILD= 518.01s user 87.55s system 839% cpu 1:12.15 total ``` <details> <summary>Old</summary> ``` canary 82026906: 15,3gb 492.59s user 103.43s system 736% cpu 1:20.90 total 495.16s user 96.50s system 739% cpu 1:20.01 total code-gen bd58ad63a7: 14,95gb 489.30s user 102.66s system 745% cpu 1:19.36 total 501.91s user 105.99s system 743% cpu 1:21.80 total ``` </details>
-
Tobias Koppers authored
### What? Defines like `process.env.NODE_ENV` were not correctly applied to turbopack-cli. This fixes it.
-
JJ Kasper authored
This allows setting `runtime: 'nodejs'` in middleware, which removes the constraint of only using edge runtime APIs for middleware. This doesn't change the signature of middleware and it still receives `(req: NextRequest, event: NextFetchEvent) => Response`. x-ref: https://github.com/vercel/next.js/discussions/71727 x-ref: https://github.com/vercel/next.js/discussions/46722
-
Niklas Mischkulnig authored
Use the final `__turbopack_context_.X` directly, which saves use the long destructuring. The original versions (`__turbopack_load__`, `__turbopack_import__`) are still available as the user-facing API (implemented via free var replacements). src-rolldown-1000 before: ``` input_len 6.776151mb output_len 1.318701mb ``` src-rolldown-1000 after: ``` input_len 2.879056mb output_len 1.147727mb ``` ``` canary (0f7251fc): without sourcemaps: 15,3 506.01s user 104.05s system 780% cpu 1:18.21 total 500.73s user 105.54s system 767% cpu 1:18.98 total with sourcemaps: 23,3gb 542.87s user 119.60s system 752% cpu 1:28.06 total 537.84s user 117.53s system 799% cpu 1:22.02 total ``` ``` after (e09b2a5517): without sourcemaps: 14,65gb 503.89s user 102.31s system 770% cpu 1:18.63 total 493.39s user 100.04s system 768% cpu 1:17.18 total 494.93s user 101.16s system 769% cpu 1:17.44 total with sourcemaps: 22,7 529.38s user 115.85s system 785% cpu 1:22.09 total 522.39s user 115.70s system 781% cpu 1:21.66 total ```
-
Tobias Koppers authored
### What? The minimum span size of 1µs was a bit limiting. This changes it to 0.01µs. A trace viewer update is also needed: https://github.com/vercel/turbo-trace-viewer/pull/11
-
Niklas Mischkulnig authored
-
Tobias Koppers authored
### What? fixes a case where tasks where hanging or recomputed when they read they own cells
-
Jude Gao authored
## What? Minimizes unnecessary network requests in the development overlay by batching stack frame resolutions. ## Why? Instead of sending individual HTTP requests for each stack frame, this change consolidates them into a single POST request. This helps declutter the network tab in browser devtools, especially in cases where multiple failed requests occur due to server-side errors. ## How? - Introduces a new endpoint `/__nextjs_original-stack-frames` to handle batched stack frame requests - Updates Webpack and Turbopack middlewares to support batched resolutions - Refactors stack frame processing to work with batched responses Closes NDX-500
-
Tim Neutkens authored
Removes this step as it fails on self-hosted runners. <!-- 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 # -->
-
Donny/강동윤 authored
### What? ### Why? `swc_atoms::Atom` is better for repeatedly used strings.
-
Tim Neutkens authored
## What? All the test runs that happen after this workflow runs are running on our self hosted runners but the initial setup is running on GitHub's runner, this causes an environment mismatch that seems to be causing these errors: ```
⚠ Error: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.39' not found (required by /root/actions-runner/_work/next.js/next.js/packages/next-swc/native/next-swc.linux-x64-gnu.node) at mod.require (packages/next/dist/server/require-hook.js:65:28) at loadNative (packages/next/dist/build/swc/index.js:853:69) at <unknown> (packages/next/dist/build/swc/index.js:264:28) at new Promise (<anonymous>) at loadBindings (packages/next/dist/build/swc/index.js:232:23) { code: 'ERR_DLOPEN_FAILED' } ``` Going to land this to verify it remedies the problem. <!-- 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 # --> -
Lee Robinson authored
-
Vercel Release Bot authored
-
Hendrik Liebau authored
Console logs in server components are replayed in the browser. For example, when you run `console.log('foo')`, the log will be replayed in the browser as `[Server] foo`. When the component is inside of a `"use cache"` scope, it's replayed as `[Cache] foo`. However, when logging directly in the function body of a `"use cache"` function, we are currently not replaying the log in the browser. The reason for that is that the function is called outside of React's rendering, before handing the result promise over to React for serialization. Since the function is called without React's request storage, no console chunks are emitted. We can work around this by invoking the function lazily when React calls `.then()` on the promise. This ensures that the function is run inside of React's request storage and console chunks can be emitted. In addition, this also unlocks that `React.cache` can be used in a `"use cache"` function to dedupe other function calls. closes NAR-83 -
Hendrik Liebau authored
The two scenarios that test rewrite headers for vercel.com are dependent on how the Vercel site has currently configured its rewrites, and thus are prone to be flaky. Until we've figured out what Next.js logic this is supposed to test, and how we can decouple it from this external source, we are disabling them to unblock other PRs. An attempt to fix the expectation was done yesterday in #75602, but in the meantime the returned `x-nextjs-rewritten-path` header has changed again (`/home/eyJhbGciOiJIUzI1NiJ9.AP0.7cQg-Q2tj1BAyHFfT32HLI3JRdEfYCiANjbtqRiDfLs`).
-
Vercel Release Bot authored
-
Benjamin Woodruff authored
Migrate as many things as possible that I could find with: ``` rg '\b(Index|Hash)(Map|Set)<' ``` # Benchmarks I tried building next-site, differences are likely within noise threshold. ## Before this change ``` $ hyperfine --warmup 1 --runs 5 --prepare 'rm -rf .next' 'TURBOPACK=1 TURBOPACK_BUILD=1 TURBO_ENGINE_READ_ONLY=1 pnpm next build --experimental-build-mode=compile' Benchmark 1: TURBOPACK=1 TURBOPACK_BUILD=1 TURBO_ENGINE_READ_ONLY=1 pnpm next build --experimental-build-mode=compile Time (mean ± σ): 27.254 s ± 0.268 s [User: 125.055 s, System: 16.090 s] Range (min … max): 26.810 s … 27.529 s 5 runs ``` ## After this change ``` $ hyperfine --warmup 1 --runs 5 --prepare 'rm -rf .next' 'TURBOPACK=1 TURBOPACK_BUILD=1 TURBO_ENGINE_READ_ONLY=1 pnpm next build --experimental-build-mode=compile' Benchmark 1: TURBOPACK=1 TURBOPACK_BUILD=1 TURBO_ENGINE_READ_ONLY=1 pnpm next build --experimental-build-mode=compile Time (mean ± σ): 26.711 s ± 0.461 s [User: 123.910 s, System: 15.667 s] Range (min … max): 26.346 s … 27.463 s 5 runs ```
-
Benjamin Woodruff authored
This is similar to the `FxHashMap`/`FxHashSet`/`FxIndexMap`/`FxIndexSet` aliases we use everywhere.
-