Commit Graph

1310 Commits

Author SHA1 Message Date
Sebastian "Sebbie" Silbermann 76d9ab8e4e [test] Improve React performance track tests (#81359) 2025-07-07 16:04:53 +02:00
Sebastian "Sebbie" Silbermann 39f5d0f32c [test] Dedicate suite for React's Server Request performance track (#81312)
We're testing this here since framework integration via `filterStackTrace` determines what React uses to determine the name of the Performance entry.
2025-07-06 11:47:17 +02:00
Hendrik Liebau 2d19dc626b [dynamicIO] Use owner stacks for dynamic validation errors (#81277)
With recent improvements in React, and after switching to the React
builds for Node.js in #81048, we can now generate better dynamic
validation error stacks in dev mode by utilizing owner stacks instead of
component stacks.

For async I/O, we're using the owner stack exclusively. For sync I/O
we're appending the owner stack to the call stack. In a future iteration
we might instead log the original error as-is where it occurs, and let
`patchErrorInspectNodeJS` handle the owner stack appending as a general
solution.

Additionally, we're now guiding users in the build-time error messages
to using `next dev` for further debugging of dynamic validation errors –
or, alternatively, using `next build --debug-prerender`.

closes NAR-149
2025-07-04 22:09:23 +02:00
Sebastian "Sebbie" Silbermann 8d78992557 [sourcemaps] Ignore-list sources whose sourcemaps ignore-list everything (#81231)
webpack-only at the moment since I have no easy stack to test this on in Turbopack until we sourcemap the Turbopack runtime.

This applies the same heuristic Chrome uses. For sources whose associated sourcemap ignores everyone of its sources, we ignore-list that source even if we didn't find a mapping. This is similar to other common heuristic where the closest mapping is used when no exact mapping exists.
2025-07-04 21:23:50 +02:00
Sebastian "Sebbie" Silbermann c12c9c1f78 [test] Keep Playwright stackframes out of tests (#81240) 2025-07-04 10:24:02 +02:00
Sebastian "Sebbie" Silbermann 7ed2d23ae5 [devtools] Omit line/col numbers for anonymous sources (#81223) 2025-07-03 15:23:27 +02:00
Vercel Release Bot 52b185d813 Upgrade React from 7216c0f0-20250630 to 73aa744b-20250702 (#81192)
Co-authored-by: Sebastian Sebbie Silbermann <sebastian.silbermann@vercel.com>
2025-07-02 18:16:23 +00:00
JJ Kasper 58bc2f112c Migrate usage of web-server in edge-ssr (#80915)
This continues the work for the `handlers` interface for the edge
runtime and re-uses the existing `route-module` interface we have
instead of initializing and using `web-server`/`base-server`.

Validated against our deploy tests
https://github.com/vercel/vercel/actions/runs/15987684940/job/45095833866?pr=13505
https://github.com/vercel/next.js/actions/runs/15987664161/job/45095390463
2025-07-02 10:18:13 -07:00
Jiachi Liu 1e9f598ba6 [segment explorer] refactor boundary trigger with ui primitives (#81147) 2025-07-02 18:48:03 +02:00
Sebastian "Sebbie" Silbermann 16e1e1455e [node-webstreams] Use React builds for Node.js (#81048)
Closes https://linear.app/vercel/issue/NEXT-4560/

React now exposes Web stream APIs in their Node.js builds so we can use the Node.js builds.

That enable us to use some of the Node.js goodies like `async_hooks` which is required for the React's experimental Server Requests track.

## Test plan

`next-server` runtimes did not increase bundle size. We even saved some in the `app-page` entries since we no longer have to bundle Edge and Node.js versions of React Server. We can rely solely on the Node.js variant of React Server.

A build of `test/e2e/app-dir/hello-world` shows no significant bundle size changes
2025-07-02 07:53:34 +02:00
Jiachi Liu 19bf594b60 Revert "[devtool] merge segment explorer flag into panel ui flag (#81085)" (#81131)
Reverts #81085 to keep the flags separate so can test separately
2025-07-01 19:25:00 +02:00
Niklas Mischkulnig 7131d706ae Fix flakey devtools test (#81127)
A regression from #81085 @huozhi 


The problem is that `openDevToolsIndicatorPopover` doesn't tell anymore whether the popup menu is open, but if the panel is open, but the "Try Turbopack" text is in the popup menu (only in the old UI).
2025-07-01 18:01:18 +02:00
Jiachi Liu 13401d8fd8 [devtool] merge segment explorer flag into panel ui flag (#81085) 2025-07-01 15:35:21 +02:00
Jiachi Liu 82c85a5b7b [segment explorer] trigger boundary initial support (#80948) 2025-06-30 16:54:46 +02:00
Hendrik Liebau 36930024ff Ignore JSON.parse <anonymous> (0:0) stack frames in test snapshots (#81044)
These frames will be ignore-listed soon. Until then, we remove them from the test snapshots, because their occurrence seems to be non-deterministic. They come from React's RSC parsing.
2025-06-29 15:35:04 -04:00
Jiachi Liu 33477b7e64 [segment-explorer] display the builtin conventions (#80961)
Track built-in conventions in segment explorer. The default `global-not-found.js` and `global-error.js` will be displayed.
Their style will be different to the others, we'll follow up in the later PRs.

Closes NEXT-4576
2025-06-27 16:41:07 +02:00
Niklas Mischkulnig c2be57cc1d Turbopack: pass current Node.js version from JS side instead of invoking node (#80949) 2025-06-27 08:27:16 +02:00
Jiachi Liu 71cdce68e0 [refactor] group the built-in conventions (#80957)
Group all the built-in conventions into `src/client/components/builtin` with the actual same name of the conventions they represent.

e.g. 
The default `not-found.js` is `next/dist/client/compoents/builtin/not-found.js`;
The default `global-error.js` is `next/dist/client/compoents/builtin/global-error.js`;

This give us an easier way to track all the builtin conventions. This is also the preparation work for #80961 where we display the builtin conventions in the segment explorer.
2025-06-26 23:36:57 +02:00
Vercel Release Bot 65e76eafbe Upgrade React from 197d6a04-20250424 to fa3feba6-20250623 (#80804)
Co-authored-by: Sebastian Sebbie Silbermann <sebastian.silbermann@vercel.com>
2025-06-26 16:12:52 +02:00
Luke Sandberg 8ba3a99a10 [turbopack] Add user friendly names to trace labels (#80388)
# Enhance Layer Names with User-Friendly Descriptions

This PR improves the developer experience by enhancing layer names in Turbopack with user-friendly descriptions. Instead of just using internal identifiers like "app-client" or "app-rsc", the PR adds descriptive names like "Client Component Browser" or "Server Component" that better communicate the purpose of each layer to developers.

Key changes:
- Created a new `LayerName` struct that contains both the internal name and an optional user-friendly description
- Updated all layer references throughout the codebase to use this new structure
- Changed error message text from "Example import trace(s)" to "Import trace(s)" for more simplicty

These changes make error messages and debugging information more intuitive, helping developers better understand which part of the application is experiencing issues.
2025-06-26 00:10:04 -07:00
Tim Neutkens 5802ba8122 Turbopack Build: Implement browserslist for CSS / JS (#80603)
## What?

Implement browserslist for CSS / JS handling in Turbopack.

For JS it's not fully implemented yet, but for CSS it should be good
now.
2025-06-24 19:11:06 +02:00
Jiachi Liu 6aa630c6ad [test] separate hmr env test (#80802) 2025-06-24 17:40:27 +02:00
Donny/강동윤 52372be7cb build(turbopack): Update swc_core to v29.1.2 (#80659)
### What?

ChangeLog: https://github.com/swc-project/swc/compare/swc_core%40v27.0.6...swc_core%40v29.1.2

### Why?


To allow using https://github.com/swc-project/swc/pull/10625

### How?
2025-06-24 04:36:37 +00:00
Nils Schönwald 72cc7db1bd fix to use https urls in meta data images when using experimental-https (#80276)
fixes #80275 

.. to generate https image urls in meta data when using the
--experimental-https flag

---------

Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2025-06-24 01:23:52 +00:00
Jiachi Liu c54cc01902 [segment explorer] display default page in segment explorer (#80716) 2025-06-23 23:18:09 +02:00
Jiachi Liu 8324d8108c [segment explorer] handle custom error boundary (#80714)
Display custom error boundary `error.js` in segement explorer when it's rendered

![image](https://github.com/user-attachments/assets/4abad442-0703-4609-8202-b4f41f007afe)

Closes NEXT-4331
2025-06-23 22:23:47 +02:00
Jiachi Liu 9d4239a150 [segment explorer] handle display loading (#80698) 2025-06-23 21:03:17 +02:00
Jiachi Liu 6e508d4f93 [segment explorer] display navigation error boundaries (#80691) 2025-06-23 18:08:02 +02:00
Jiachi Liu 3981cccbe3 [segment explorer] handle custom global-error segment (#80685) 2025-06-23 17:36:20 +02:00
Jiachi Liu 5771ce12f8 [segment explorer] handle builtin not-found (#80607) 2025-06-23 15:23:43 +02:00
Jiachi Liu 9df0c8763c [segment explorer] handle edge and pages router (#80668) 2025-06-23 14:06:01 +02:00
Sebastian "Sebbie" Silbermann da46d66667 Downgrade React from 79d9aed7-20250620 to 197d6a04-20250424 (#80762) 2025-06-22 09:07:44 +00:00
Sebastian "Sebbie" Silbermann 322adb9835 [devtools] Fix Turbopack indicator (#80753) 2025-06-22 10:13:42 +02:00
Sebastian "Sebbie" Silbermann 6a0b7e9059 Upgrade React from 197d6a04-20250424 to 79d9aed7-20250620 (#79477) 2025-06-20 15:47:45 +02:00
Jiachi Liu f3d6af9525 [segment explorer] single row layout segment (#80576) 2025-06-18 16:16:19 +02:00
Zack Jackson 8f2e058c24 test: fix failures caused by format discrepancies between rspack and other bundlers (#80314)
This pull request updates error recovery tests to improve compatibility
with the Rspack bundler by introducing an `isRspack` flag and modifying
test cases to handle Rspack-specific error formats. The changes ensure
that runtime and build errors are correctly detected and displayed when
using Rspack.

### Rspack Compatibility Updates:

* Introduced the `isRspack` flag to determine if Rspack is being used,
based on the `NEXT_RSPACK` environment variable. This flag replaces
direct checks of `process.env.NEXT_RSPACK` for better readability and
maintainability.
(`test/development/acceptance-app/error-recovery.test.ts`
[[1]](diffhunk://#diff-ed42d009889881804f76e500465e132e4aa1df75c8659119e1b5cff4d230b7cdR8-R9)
`test/development/acceptance/error-recovery.test.ts`
[[2]](diffhunk://#diff-18cc654bcba9dbffcf77a6157fec144f9d0b1a0b3c59d46b33f6a2b95f543a91R9)

* Updated test cases in `error-recovery.test.ts` and
`acceptance-app/error-recovery.test.ts` to handle Rspack-specific error
messages. This includes adapting error expectations for syntax errors,
runtime errors, and build errors with the Rspack error format.
(`test/development/acceptance-app/error-recovery.test.ts`
[[1]](diffhunk://#diff-ed42d009889881804f76e500465e132e4aa1df75c8659119e1b5cff4d230b7cdR58-R79)
[[2]](diffhunk://#diff-ed42d009889881804f76e500465e132e4aa1df75c8659119e1b5cff4d230b7cdR574-R588)
[[3]](diffhunk://#diff-ed42d009889881804f76e500465e132e4aa1df75c8659119e1b5cff4d230b7cdR845-R872);
`test/development/acceptance/error-recovery.test.ts`
[[4]](diffhunk://#diff-18cc654bcba9dbffcf77a6157fec144f9d0b1a0b3c59d46b33f6a2b95f543a91L58-R74)
[[5]](diffhunk://#diff-18cc654bcba9dbffcf77a6157fec144f9d0b1a0b3c59d46b33f6a2b95f543a91L372-R394)
[[6]](diffhunk://#diff-18cc654bcba9dbffcf77a6157fec144f9d0b1a0b3c59d46b33f6a2b95f543a91L755-R766)

* Replaced outdated error message formats in Rspack-related test cases
with updated and more precise error descriptions, including detailed
stack traces and error causes.
(`test/development/acceptance/error-recovery.test.ts`
[[1]](diffhunk://#diff-18cc654bcba9dbffcf77a6157fec144f9d0b1a0b3c59d46b33f6a2b95f543a91L815-R835)
[[2]](diffhunk://#diff-18cc654bcba9dbffcf77a6157fec144f9d0b1a0b3c59d46b33f6a2b95f543a91L883-R903)

These changes improve test coverage for Rspack and ensure robust error
handling across different bundlers.
2025-06-17 04:28:14 +00:00
Donny/강동윤 7e310f8d2a fix(turbopack): Improve error message for PURE selector error (#80068)
### What?

Use CSS string for CSS errors instead of Rust debug representation, and remove `lightningcss` text from the error message.

### Why?

We don't need them.
2025-06-12 22:44:36 +00:00
Jiachi Liu f8add0d9ff [segment explorer] fix soft navigation case (#80443) 2025-06-12 13:10:33 +02:00
Sebastian "Sebbie" Silbermann ae1f0be351 [segment-explorer] Signal updates to React (#80316)
We never actually invoked the listeners attached by React. Updates only worked on soft-navigation because we also re-render the DevOverlayRoot and don't bail out anywhere at the moment.

Just invoking the listeners is not sufficient after https://github.com/vercel/next.js/pull/79699 since userspace and dev-overlay would read different versions of `listeners`. I ported the segment explorer into the new folder structure. Updates now flow through the `dispatcher` and then invoking the listeners actually works. Though mid term we should move the segment tree into actual React tree to get rid of the sync updates.

I also noticed that we're missing an implementation for a remove operation which is required to show the correct state during soft navigations.
2025-06-12 12:48:08 +02:00
Jiachi Liu 737d3199c6 [segment-explorer] optimize tree view (#80392) 2025-06-11 18:21:10 +02:00
Jiachi Liu cf1f47a5d1 [dev-overlay] fix duplicate re-render of errors (#80322)
### What

When there's a same error throwing constantly, we should avoid unnecessary re-renders on the exact same error. In dev overlay we already have strategies that can dedupe the error. And we noticed the error is shown correctly but just the dialog got re-rendered with animations.

After digging deeper, noticed we are still adding the same runtime error into the error collection, just because each time it got the new "ID", as the "ID" itself is incremental based on actions. Each action will get a new error ID. Hence we're adding a condition in deduping. If we found that the new error already existed in the previous events, we'll return with the same previous events instance to tell dev overlay that errors are not changed.

Fixes NEXT-4493

#### After
https://github.com/user-attachments/assets/c1f004b5-2de6-445a-aad0-efdfd0ecb8c9

#### Before
https://github.com/user-attachments/assets/1249ed54-ba63-4eb6-a08a-64560ab4014a
2025-06-10 11:42:20 +02:00
Luke Sandberg 19e8e3c3c2 Revert "Revert "[turbopack] Compute Import Traces for Issues"" (#80220)
Reverts vercel/next.js#80215 which was a revert of vercel/next.js#79351

Closes PACK-4105
2025-06-07 15:28:07 -07:00
Sebastian "Sebbie" Silbermann ee94be90cd [dev-overlay] Use same bundle for Pages and App Router (#80019) 2025-06-07 15:46:56 +02:00
Jiachi Liu 356cdf2393 [devtool] display segment explorer as tree view (#80261) 2025-06-07 01:07:06 +02:00
Sebastian "Sebbie" Silbermann 85c718fd65 [dev-overlay] Render /app Dev Overlay with a separate React instance (#79699) 2025-06-06 22:56:59 +02:00
Jiachi Liu c2621a14ef [devtool] style the segment explorer as nested view (#80212) 2025-06-06 14:38:58 +02:00
Luke Sandberg 0d2e80554a Revert "[turbopack] Compute Import Traces for Issues" (#80215)
Reverts vercel/next.js#79351

See https://github.com/vercel/next.js/actions/runs/15474422003/job/43570614813#step:34:1556
2025-06-05 13:44:39 -07:00
Luke Sandberg 7a66008cae [turbopack] Compute Import Traces for Issues (#79351)
When turbopack reports an issue, compute a set of import-traces for that file so the user can better understand the context of the issue and trivially answer questions like:

* Why is this file included at all?
* Why does next think this is a client-component?

To do this we leverage the `SingleModuleGraph` and use the `astar` algorithm from `petgraph` to compute the shortest path to a root module.  This isn't the most optimal approach but should be sufficient since we don't anticipate this being a performance issue.

A complex part of this is that the module-graph tracks the relationships between _modules_ but Issues are associated with _files_.  While modules are also associated with files this is a many-to-one relationship.  This is why we might report _multiple_ traces for a single issue and also why a single file might appear multiple times in a trace.

## Open formatting questions

* how should we represent paths from other 'filesystems'?
    - for disk filesystems i could compute relative paths to the root of the current directory? the `[project]` filesystem?  For now i just use the filesystem name as a hypothetically cromulent root.


## Alternatives

The main alternative investigated was associating  Issues with `Modules` by collecting them during graph construction. This unfortunately proved to be a non-trivial performance regression and so it was abandoned.  The core problem is that we would need to introduce additional `OperationVc` and task roots to simply `collect` the issues.  This also wouldn't eliminate the duplicate traces issue, and instead we might end up reporting duplicate issues instead.

## Performance
TODO

Closes PACK-4105
2025-06-05 11:21:11 -07:00
Sebastian "Sebbie" Silbermann 2bb89785c5 [test] Add test for dev rendering indicator (#80205)
Automated test for https://github.com/vercel/next.js/pull/74833
2025-06-05 18:37:57 +02:00
Sebastian "Sebbie" Silbermann 6f76e91dbc [dev-overlay] Remove unused onError in /pages (#79982)
Every implementation is a no-op and we don't have any plans.
Can use the same pattern as App Router when we need it.
2025-06-04 10:10:31 +02:00