Commit Graph

51 Commits

Author SHA1 Message Date
Hendrik Liebau dae438dc0d Stop printing a stack frame for error message text (#97829)
Next.js printed a stack frame that does not exist for an error whose
message ends with text that looks like a file location. A logged
connection failure read `at <unknown> (Error: connect ECONNREFUSED
::1:45999)` in front of its real frames.

`stacktrace-parser` tries five patterns on every line, and the pattern
for JavaScriptCore makes the `<name>@` prefix optional. That pattern
`:<line>:<column>`, and a line of an error message can end that way. A
JavaScriptCore frame always holds `@`, also at the top level, so the
prefix is not optional in a real stack.

The patch for `stacktrace-parser` now requires that prefix. A line of a
message no longer becomes a frame, and every JavaScriptCore frame still
parses, including one whose path holds a space.

A Turbopack build error puts the file and the position of the error in
its message, and the parser read that line as a frame as well. That
frame is gone now, and the location stays in the message. The snapshots
of the build errors record the change.
2026-08-25 13:38:47 +02:00
Jiwon Choi d7aa66c345 Remove generated error codes (#97687)
### Why?

Should come up with better solution that does not block PRs with git
conflict

x-ref:
https://vercel.slack.com/archives/C02CDC2ALJH/p1785263902728189?thread_ts=1785263687.502649&cid=C02CDC2ALJH

### How?

- Delete `errors.json`, the error-code SWC plugin, generated WASM, merge
driver, and validation/build tooling.
- Stop attaching error codes to server-rendering digests, redboxes, and
telemetry; native `Error.code` and `Error.name` remain available where
applicable.
- Remove the development-overlay error feedback UI, middleware, and
telemetry event that depended on stable codes.
- Update fixtures, snapshots, and guidance for code-free errors and
numeric-only digests.

<!-- NEXT_JS_LLM -->
2026-08-21 22:45:12 +02:00
Sebastian "Sebbie" Silbermann 7612eaeda1 Consolidate unhandled rejection logging into a single listener (#95999)
An unhandled rejection was previously logged by up to three independent
process listeners at once: the render runtime's crash-prevention handler
in `process-error-handlers.ts` (a bare `console.error`), the router
server's `Log.error('unhandledRejection: ', err)`, and the dev server's
`logErrorWithOriginalStack`. The runtime handler must exist on every
deployment target (#77997), but on self-hosted `next start`/`next dev`
it shares a process with the router server's and dev server's listeners,
so a single rejection was logged multiple times in different formats.

THe first commits adds a test showing the current behavior where we log
multiple times.

The second commit introduces `registerUnhandledRejectionListener` and
`isUnhandledRejectionListenerRegistered` in `process-error-handlers.ts`,
and converts the router server and dev server to check-then-register
instead of installing their own rejection loggers:

- The listener function is shared via a `Symbol.for` key on
`globalThis`, so multiple copies of the module (e.g. in the pre-compiled
server bundle and in a route module bundle) register and detect a single
listener instance.
- The registration check queries
`process.listeners('unhandledRejection')` instead of a module-global
flag, so it stays accurate even after external code calls
`process.removeAllListeners`. `installProcessErrorHandlers` therefore
calls the register function unconditionally.

The `uncaughtException` handlers are left as they are; they have the
same duplication and could be consolidated the same way in a follow-up.
2026-07-31 11:36:40 -04:00
Hendrik Liebau dd8b154d9f Ignore-list internal frames whose source maps chain to original sources (#95448)
Next's dev error output (terminal logs and the browser overlay)
ignore-lists framework-internal stack frames. The forked
`EvalSourceMapDevToolPlugin` recomputes this ignore-list per module
because the vendored `webpack-sources` has no runtime `ignoreList`
support, so it drops the field when it combines a module's input source
map with the generated mappings. `shouldIgnorePath` matches on the
emitted source path, which works while a source resolves back to its
module. But a Next-internal module that ships an input source map (its
`.js.map`, which taskfile-swc marks entirely ignore-listed) resolves its
sources to the original files such as `src/server/web/adapter.ts`, which
no longer contain the `node_modules`/`next/dist` marker and no longer
resolve back to a module. Those frames then escape ignore-listing and
leak into both the terminal output and the overlay.

For such unresolved sources this falls back to the module's own resource
path, so a frame whose module lives in `node_modules`/`next/dist` stays
ignore-listed even when its source map points at the original source.
The fallback applies only to a `NormalModule`, whose sources all belong
to that one module; a `ConcatenatedModule` merges several modules'
sources under one map and is left to the path check, which the dev
`eval-source-map` devtool never produces anyway.
2026-07-03 14:27:48 +02:00
Hendrik Liebau f83bc252fc Type resolved cacheLife profiles, dropping runtime asserts (#95428)
Runtime `"use cache"` code validated the default cache-life profile on
every invocation because `cacheLifeProfiles` was typed as optional with
partial profiles: `assertDefaultCacheLife` on the generate and RDC-read
paths, a per-`cacheLife()` presence `InvariantError`, and optional
chaining on reads.

Config normalization already guarantees this once:
`assignDefaultsAndValidate` builds the config from `{...defaultConfig,
...config}`, so `cacheLife` is always present, and it backfills the
`default` profile's `stale`, `revalidate`, and `expire`. This moves that
guarantee into the type. A new `ResolvedCacheLifeProfiles` (in
`config-shared`) types the `default` profile as `Required<CacheLife>`
and overrides `NextConfigComplete.cacheLife`, and the type is threaded,
non-optional, through the render options, work store, and the build,
export, and dev workers. Runtime code now reads
`cacheLifeProfiles.default` directly, and the asserts, the presence
guard, and the optional chaining are gone.

The proxy (middleware) work store is the one construction site without a
resolved profile: the proxy does not support `"use cache"`, so it never
reads `cacheLife`. It is given a sentinel whose `default` getter throws
if ever read, matching the "never read" sentinels already used for its
other unused render options.
2026-07-03 14:27:47 +02:00
Niklas Mischkulnig 9b8a7a1055 Turbopack: improve issue printing colors (#94858)
1. Align the code highlight marker color with the issue severity
2. Make the issue title colored
3. Prefix issues with `Warning` or `Error`


<img width="1383" height="862" alt="Bildschirmfoto 2026-06-16 um 18 59
03"
src="https://github.com/user-attachments/assets/f98c606d-4ea8-40c2-836d-e395f1df904c"
/>


<img width="1039" height="450" alt="Bildschirmfoto 2026-06-16 um 19 03
39"
src="https://github.com/user-attachments/assets/2747f914-0587-4178-a87d-344f24715c96"
/>



<details>
<summary>Old</summary>

<img width="1267" height="745" alt="Bildschirmfoto 2026-06-16 um 17 04
35"
src="https://github.com/user-attachments/assets/837739ff-82f7-4ea2-8767-ca7d866a8570"
/>

</details>
2026-06-16 21:29:37 +02:00
Tobias Koppers 1287f9a027 Turbopack: show specific SWC error messages as error titles (#91022)
### What?

Changes Turbopack's error overlay to show specific SWC diagnostic
messages as the error title instead of generic messages like "Parsing
ecmascript source code failed" or "Ecmascript file had an error".

### Why?

Previously, all SWC parse/analysis errors in Turbopack showed a generic
title (e.g. "Parsing ecmascript source code failed") in the redbox
header, with the actual specific error message buried in the description
below the code frame. This made it harder for developers to quickly
understand what went wrong.

**Before:**
```
Parsing ecmascript source code failed
> 1 | export default () => <div/
    |                           ^
Expected '>', got '<eof>'
```

**After:**
```
Expected '>', got '<eof>'
> 1 | export default () => <div/
    |                           ^
Parsing ecmascript source code failed
```

### How?

**Core change** in
`turbopack/crates/turbopack-swc-utils/src/emitter.rs`:

When the `IssueEmitter` has a `self.title` set (the generic title like
"Parsing ecmascript source code failed"), the SWC diagnostic message is
now used as the issue title, and the generic title is demoted to the
description. When `self.title` is not set, the existing behavior is
preserved (first line of message becomes title, rest becomes
description).

**Test updates** across ~15 test files:

Updated all `isTurbopack` branches in test expectations to reflect the
swapped title/description. Only Turbopack-specific branches were
modified; webpack and rspack expectations are unchanged.

**New test suite** (`test/development/app-dir/ecmascript-error-title/`):

Dedicated tests verifying that both syntax errors (e.g. `Expected '>',
got '<eof>'`) and analysis errors (e.g. `the name 'Table' is defined
multiple times`) show the specific SWC message as the redbox title.

**Turbopack snapshot updates:**

4 snapshot files renamed to reflect new titles (e.g. `Parsing ecmascript
source code failed-*.txt` → `Expression expected-*.txt`).

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-03-09 08:00:37 +01:00
Sebastian "Sebbie" Silbermann 7d98e0b534 [test] Include error code in Redbox snapshot (#90497) 2026-02-26 11:01:25 +00:00
Cong-Cong Pan affb52dafc chore: update rspack 1.6.5 (#86853)
update @next/rspack-core version to 1.0.2 and update the snapshot

other changes:

- packages/next/src/build/webpack-config.ts
Adjusted configuration to account for differences in default node config
between Rspack and Webpack.

- packages/next/src/shared/lib/format-webpack-messages.ts
Added a fallback to moduleIdentifier in cases where Rspack does not
correctly populate moduleName.
2025-12-17 05:07:52 +00:00
Sebastian "Sebbie" Silbermann dc8f77375d Stop adding additional padding to Next.js logs (#86139) 2025-11-17 19:10:24 -08:00
Cong-Cong Pan ed41ac1a74 chore: upgrade rspack 1.6.0 (#84210)
1. Fixed the incremental update bug in buildChunkGraph.
2. Fixed a bug in Rspack's built-in CssChunkingPlugin.

For detailed release information, please see
https://github.com/web-infra-dev/rspack/releases.

Note: All the faulty Rspack test cases on GitHub, from what I can see,
either time out or also produce errors in Rspack version 1.5.0.

---------

Co-authored-by: Benjamin Woodruff <benjamin.woodruff@vercel.com>
2025-11-06 01:29:04 +00:00
Sebastian "Sebbie" Silbermann 0b58a32c45 [test] assert* -> waitFor* when the util is not instant (#85450) 2025-10-30 14:44:08 +01:00
Benjamin Woodruff 40f48ebb5e Turbopack: Remove redundant log line, increase delay for compiling log message (#85133)
We've already got output logging for this stuff, and the "compiling" message is too noisy.

Only print `Compiling /...` it if the compilation takes more than 3s, stop printing `Compiled in` altogether.

After this PR:
<img width="1075" height="335" alt="Screenshot 2025-10-20 at 3 15 59 PM" src="https://github.com/user-attachments/assets/34e87d18-8feb-4470-ae11-0d8e4b3a8a6b" />

Removes this line:
<img width="1095" height="254" alt="Screenshot 2025-10-20 at 3 17 56 PM" src="https://github.com/user-attachments/assets/76fb795e-760a-4782-889a-dd98bcf09125" />
2025-10-20 22:53:45 -07:00
Tobias Koppers 3567c153b3 Turbopack: improve module evaluation name (#84633)
### What?

We can use the demangled name directly, which is much easier and applies to more cases.
2025-10-20 14:03:50 -07:00
Jiwon Choi c388db43dc CI: Enable experimental.isolatedDevBuild for test-dev (#84562)
Enabling `experimental.isolatedDevBuild` required many changes to the
current workflow, so we will incrementally roll out to the tests.

Enabling on test-dev instead of test-experimental-dev because
`-experimental` CIs are filtered via `experimental-tests-manifest.json`
and they don't cover all tests. We want to enable this feature by
default so we should ensure this incremental rollout is covered on all
test cases.

The flag was enabled for `test-experimental-dev` at
https://github.com/vercel/next.js/pull/84099, and this PR moves the flag
to the `test-dev` job.

1. ~~test-experimental-dev
([link](https://github.com/vercel/next.js/pull/84099))~~
2. test-dev (here)
3. test-prod
4. test-integration
5. test-unit
6. Enable by default, remove the flag, and update the rest

x-ref: https://github.com/vercel/next.js/pull/84043
2025-10-07 00:44:08 +02:00
Cong-Cong Pan 45b4a985c5 chore: update Rspack test cases snapshot (#83202) 2025-09-03 14:08:13 +00:00
Sebastian "Sebbie" Silbermann 00261e9154 [test] Run all dev tests with sourcemaps enabled (#83173) 2025-08-29 10:18:11 +02:00
Tobias Koppers 825753a284 Turbopack: name the module factory function (#73553)
### What?

In development give the module factory a useful name, so it's clear in stack traces that this is the module evaluation part of the execution.

This also fixes some bugs with the stack trace parser, which seems to struggle if function names contain brackets. The automatically inferred function name would be the module id, which contains brackets.
2025-08-02 10:15:24 -07:00
Sebastian "Sebbie" Silbermann 382b79bcc9 [sourcemaps] Consistent cursor columns (#81375)
Co-authored-by: Niklas Mischkulnig <4586894+mischnic@users.noreply.github.com>
2025-07-16 20:45:34 +02:00
Sebastian "Sebbie" Silbermann 8ea7d4bb35 [dev-overlay] Move error.name to label (#78198) 2025-04-25 11:00:58 +02:00
Sebastian "Sebbie" Silbermann b9d65b8afe [test] Assert on all errors in Redbox matchers (#77907) 2025-04-10 10:00:42 +02:00
Sebastian "Sebbie" Silbermann 639dbbd36f [test] Use new Redbox matchers in pages/ middleware-errors (#76797) 2025-03-05 09:02:02 +01:00
Niklas Mischkulnig 63f2a78fee Turbopack: unique node middleware layer name (#76447) 2025-02-25 09:09:08 +01:00
Jiachi Liu 8e9f92b649 [dev-overlay] pick up build error message (#76290) 2025-02-21 14:10:39 +01:00
Xiaoyi d69f796522 Bump webpack to 5.98.0 (#75847)
Co-authored-by: Sebastian Sebbie Silbermann <sebastian.silbermann@vercel.com>
2025-02-17 14:44:13 +01:00
Sebastian "Sebbie" Silbermann 848c22977b Stop sourcemapping function names (#74085) 2024-12-19 20:54:35 +01:00
Sebastian "Sebbie" Silbermann 4c7ef6a727 Ignore-list stack frames in node_modules even if not explicitly ignore-listed by their sourcemaps (#73689) 2024-12-09 18:18:12 +01:00
Sebastian "Sebbie" Silbermann 98de5db6d4 Use consistent error formatting in terminal (#71909) 2024-12-06 14:43:59 +01:00
Jude Gao 6ade55999f upgrade amphtml-validator to 1.0.38 (#72645)
Tests have been inconsistent due to flaky build-time failures caused by
AMP validation errors:
https://github.com/vercel/next.js/actions/runs/11807856104/attempts/1.

We’re updating the library version with the expectation that this will
resolve the issue.

```
info: undefined
   Generating static pages (9/37) 
   Generating static pages (18/37) 
   Generating static pages (27/37) 
Error occurred prerendering page "/amp-hybrid". Read more: https://nextjs.org/docs/messages/prerender-error
AssertionError: Assertion failed: WebAssembly is uninitialized
    at new module$contents$goog$asserts_AssertionError (evalmachine.<anonymous>:102:1441)
    at module$contents$goog$asserts_doAssertFailure (evalmachine.<anonymous>:103:354)
    at goog.asserts.assertExists (evalmachine.<anonymous>:104:374)
    at Object.module$contents$amp$validator_validateString [as validateString] (evalmachine.<anonymous>:2238:108)
    at Validator.validateString (/tmp/next-install-89c7ccfd9a04886e2e88ccffb9ad709b236d4b8c8398fcdbb34c9c897118b9e9/node_modules/.pnpm/next@file+..+next-repo-99a8e0af0510a7a2958e71c9affe3d5d83d452a304c40ea8b352506d74651d57+packa_6sb2ai4rhstsynpbl53dxgpt7e/node_modules/next/dist/compiled/amphtml-validator/index.js:17:2057)
    at validateAmp (/tmp/next-install-89c7ccfd9a04886e2e88ccffb9ad709b236d4b8c8398fcdbb34c9c897118b9e9/node_modules/.pnpm/next@file+..+next-repo-99a8e0af0510a7a2958e71c9affe3d5d83d452a304c40ea8b352506d74651d57+packa_6sb2ai4rhstsynpbl53dxgpt7e/node_modules/next/dist/export/routes/pages.js:100:34)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async exportPagesPage (/tmp/next-install-89c7ccfd9a04886e2e88ccffb9ad709b236d4b8c8398fcdbb34c9c897118b9e9/node_modules/.pnpm/next@file+..+next-repo-99a8e0af0510a7a2958e71c9affe3d5d83d452a304c40ea8b352506d74651d57+packa_6sb2ai4rhstsynpbl53dxgpt7e/node_modules/next/dist/export/routes/pages.js:134:17)
    at async Span.traceAsyncFn (/tmp/next-install-89c7ccfd9a04886e2e88ccffb9ad709b236d4b8c8398fcdbb34c9c897118b9e9/node_modules/.pnpm/next@file+..+next-repo-99a8e0af0510a7a2958e71c9affe3d5d83d452a304c40ea8b352506d74651d57+packa_6sb2ai4rhstsynpbl53dxgpt7e/node_modules/next/dist/trace/trace.js:153:20)
    at async exportPage (/tmp/next-install-89c7ccfd9a04886e2e88ccffb9ad709b236d4b8c8398fcdbb34c9c897118b9e9/node_modules/.pnpm/next@file+..+next-repo-99a8e0af0510a7a2958e71c9affe3d5d83d452a304c40ea8b352506d74651d57+packa_6sb2ai4rhstsynpbl53dxgpt7e/node_modules/next/dist/export/worker.js:336:18)

```

Note that this failure breaks the production integration test almost 10%
of times.

![CleanShot 2024-11-12 at 23 15
11@2x](https://github.com/user-attachments/assets/89ad041c-22b1-47ad-aa56-58ea3a269811)
2024-11-13 11:21:11 -05:00
Jude Gao d6dd69f210 (e2e) module-level patchFileDelay flag (#72439) 2024-11-12 06:29:03 -05:00
Jude Gao bc5443dd3e patchFile awaits compilation (#72267)
We will wait the server to respond with a compile success message after
a file is patched before proceeding to the next steps in the test to
reduce flakiness.

By doing so, we uncovered a few tests that were passing accidentally due
to flakiness of `patchFile`, and fixed them in the PR.
2024-11-04 17:33:06 -05:00
Sebastian "Sebbie" Silbermann 5de1a68152 Clickable stack trace links in logged terminal errors (#71940)
Co-authored-by: Hendrik Liebau <mail@hendrik-liebau.de>
2024-11-01 15:12:33 +00:00
Sebastian "Sebbie" Silbermann 0105f6bf77 Populate sourcemap ignoreList when Webpack is used (#71821)
This enables DevTools (e.g. Chrome debugger) to collapse stackframes from 3rd party dependencies.

Webpack only. Turbopack added support in https://github.com/vercel/next.js/pull/71770. Replays from RSC will follow.



Had to fork `EvalSourceMapDevToolPlugin` (with blessing from @sokra) to be able to inject `ignoreList`. 

For `source-map`, we can use https://github.com/mondaychen/devtools-ignore-webpack-plugin/ instead since we can operate on the assets on disk. I inlined it to iterate on it faster. Though it'd be faster for bundling to also fork `SourceMapDevToolPlugin` since `DevToolsIgnorePlugin` adds another parse/serialize roundtrip.

## test plan

We'll start leveraging `ignoreList` in the terminal as well which will allow us to write automated tests. I haven't found a way to automatically test this ignore-listing in browsers.

Note that this is on Chrome Beta. Chrome Stable does not ignore-list logged stacks yet. Only stacks of the actual `console` call or in the debugger.
(the frame from our console instrumentation is a bug that may be fixed once we populate our own sourcemaps)
`pnpm debug dev test/e2e/app-dir/server-source-maps/fixtures/default/`
`/ssr-error-log` shows
browser:
![CleanShot 2024-10-24 at 20 37 43](https://github.com/user-attachments/assets/fec14ec7-4c2c-4ce3-8454-1e43a0c8d0a7)
![CleanShot 2024-10-24 at 20 37 52](https://github.com/user-attachments/assets/53a233be-448e-4110-93c5-b5c4f6f98b6b)

Node.js debugger doesn't seem to work. Will look at that in a follow-up
2024-10-29 00:56:44 +01:00
Sebastian "Sebbie" Silbermann 655b808c5b Run with --enable-source-maps by default in next dev (#71820)
We already create server source maps in dev by default,
so we should make use of them.

To opt-out, run `next dev --disable-source-maps` instead.

Our internal `next-no-sourcemaps` script is now defunct.
2024-10-28 10:23:03 +01:00
Niklas Mischkulnig 21f0c30e2c Turbopack: improve stack trace in overlay (#70343)
## Before:

<img width="965" alt="Bildschirmfoto 2024-09-23 um 14 55 16"
src="https://github.com/user-attachments/assets/26aabfdd-0e43-4dd2-a025-5eaf6a717043">


## After:
<img width="972" alt="Bildschirmfoto 2024-09-23 um 14 52 54"
src="https://github.com/user-attachments/assets/3b7ce28a-c2ea-475b-ab53-ed9838546400">

## The whole Turbopack module registry is hidden in `Next.js`:
<img width="612" alt="Bildschirmfoto 2024-09-23 um 14 53 04"
src="https://github.com/user-attachments/assets/a38295ad-90a7-49b2-a272-661e0b80bfbb">
2024-09-24 09:53:06 +02:00
JJ Kasper e8dec1f3bc Ensure we hard error on invalid config export (#68638)
Currently we only log warnings when we fail to parse config values and
then fall back to their defaults, this is very dangerous as this can
cause unexpected behavior and the warning log can be easy to miss. To
prevent this unexpected behavior this updates to treat these as errors
instead and fails the build if any invalid config exports are provided.

x-ref: NDX-190
2024-08-08 09:28:46 -07:00
Jiachi Liu ba3959bb46 feat: instrumentation onRequestError (#67539)
## What

This PR introduces a new API `onRequestError` in `instrumentation.js`
convention, which can help you track the errors thrown from pages and
routes on server side.

### API

```ts
type RequestInfo = {
  url: string
  method: string
  headers: Record<string, string | string [] | undefined>
}

type ErrorContext = {
  routerKind: 'Pages Router' | 'App Router'
  routePath: string
  routeType: 'render' | 'route' | 'middleware'
}

export function onRequestError(error: unknown, request: RequestInfo, errorContext: ErrorContext) {
}
```

This experimental feature is now scoped behind an experimental env var
`__NEXT_EXPERIMENTAL_INSTRUMENTATION` now. You need to enable to use it
before the feature is fully ready off from experimental.

## Why

The purpose is to provide a way to track the server errors from Next.js
much easier, especially when users're uing an o11y provider such as
sentry/datadog/newrelic etc. to monitor server side exceptions. There're
different runtime (Node.js or Edge) and different type of routes (App
Router pages/API routes, Pages Router pages/API routes, middleware) that
makes the error tracking story more complex. This API will be an
universal way to get all the errors.

The reason of providing the related arguments like request info and
error context is aimed to provide more insights about associated
request, also the context about Next.js framework itself, like which
feature is throwing the error.
2024-07-10 19:05:30 +02:00
Sebastian Silbermann fe8d953e2d Replace hasRedbox() (#67025)
...with `assertHasRedbox` and `assertNoRedbox`.

`hasRedbox()` has a hardcoded timeout of 5s that is only required for
the negative assertion.
Instead, we now have dedicated assertions for the positive
(`assertHasRedbox`) and negative case (`assertNoRedbox`).
The negative assertion still has the hardcoded timeout.
But the positive assertion just retries until we find the Redbox.

This speeds up tests using the positive assertion.
Removing `hasRedbox` also uncovered some unused expressions e.g. `await
hasRedbox(browser)`.
These expressions probably wanted to use `expect(await
hasRedbox(browser)).toBe(true)
2024-06-20 10:37:32 +02:00
hrmny 6c1d700afc feat(turbopack-ecmascript): cache external modules with wrapper (#63337)
### What?
This is a fix for a bundle potentially referring to two different
external modules (e.g. `react` because it gets invalided from the
require cache)

See https://github.com/vercel/turbo/pull/7988

### Turbopack Updates
* https://github.com/vercel/turbo/pull/8376 <!-- Tim Neutkens - Rename
ChunkLoading::None to ChunkLoading::Edge -->
* https://github.com/vercel/turbo/pull/8371 <!-- Donny/강동윤 - test: Add
an execution test for `paren_remover` -->
* https://github.com/vercel/turbo/pull/8370 <!-- Tobias Koppers - Tree
Shaking shared state and side effects -->
* https://github.com/vercel/turbo/pull/7988 <!-- hrmny -
feat(turbopack-ecmascript): cache external modules with wrapper -->

Closes PACK-2622
2024-06-10 15:39:40 +00:00
Wyatt Johnson c6320ed87a Replace createNextDescribe with nextTestSetup (#64817)
<!-- 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 #

-->

I took some time and [wrote a
codemod](https://gist.github.com/wyattjoh/0d4464427506cb02062a4729ca906b62)
that replaces the old usage of the `createNextDescribe` with the new
`nextTestSetup`. You'll likely have to turn on hiding of whitespace in
order to review, but this should primarily introduce no changes to the
test structure other than using the new mechanism now.

Closes NEXT-3178
2024-04-25 12:06:12 -06:00
Jiachi Liu 14c8900e70 style(dev-overlay): refine the error message header styling (#63823)
### What

Polish the UX based on the feedbacks from @sambecker 

* Fix the font that still use mono
* Align the color, to use red for the warnings
* Give the title to build error
* Only highlight the nextjs doc url as link

### After vs Before

#### Runtime Error


<img width="335" alt="image"
src="https://github.com/vercel/next.js/assets/4800338/64f2f692-1eae-41db-9287-046aff9ba112">
<img width="335" alt="image"
src="https://github.com/vercel/next.js/assets/4800338/2d4bad15-745e-4083-ba57-8968c0f321c2">

#### Build Error

<img width="335" alt="image"
src="https://github.com/vercel/next.js/assets/4800338/ecfc3883-4522-40c6-b042-6d85e7ea970e">
<img width="335" alt="image"
src="https://github.com/vercel/next.js/assets/4800338/bbf37ec5-b639-4b95-a87f-9911182e431c">



Closes NEXT-2958
2024-04-05 23:39:22 +02:00
OJ Kwon 6b2e2a0d2e test(fixture): update middleware test fixture & manifest (#63340)
### What

Small update to test fixture to make test stable.

Closes PACK-2749
2024-03-15 15:12:24 -07:00
OJ Kwon 655227f4e1 Revert "refactor(analysis): rust based page-static-info, deprecate js parse interface in next-swc" (#62838)
Reverts vercel/next.js#61832

Closes PACK-2654
2024-03-04 21:43:56 +00:00
OJ Kwon 372c74b620 refactor(analysis): rust based page-static-info, deprecate js parse interface in next-swc (#61832)
Reenabling https://github.com/vercel/next.js/pull/59300 with fixes for
the unsupported inputs.

Closes [PACK-2088](https://linear.app/vercel/issue/PACK-2088)

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2024-03-04 08:07:36 -08:00
Jiachi Liu dd24033caf DX: hide the webpack info prefix for module paths (#62101)
### What

Hide the module file path webpack prefix for better visualization.
There're few types of webpack module prefixes 

- `wepack://`
- `wepack:///`
- `webpack://_N_E`
- `webpack-internal:///`

We're stripping them from the module path

### After vs Before
<img width="320"
src="https://github.com/vercel/next.js/assets/4800338/a9f5ae61-4fbf-42d7-b3e0-9bed1c7babb4">
<img width="420"
src="https://github.com/vercel/next.js/assets/4800338/ed6e120a-7c1c-4c31-be5d-9a1726d4e20c">


Closes NEXT-1966
Closes NEXT-1983
Closes NEXT-2504
2024-02-16 11:33:34 +01:00
Tobias Koppers 3a7fea4034 Revert "refactor(analysis): rust based page-static-info, deprecate js parse interface in next-swc" (#61021)
Reverts vercel/next.js#59300

Breaks `app/page.mdx` files

Closes PACK-2279
2024-01-23 12:00:36 +01:00
OJ Kwon 9d5f62eb4a refactor(analysis): rust based page-static-info, deprecate js parse interface in next-swc (#59300)
### Description

This PR refactors existing `analysis/get-static-page-info`, moves over
most of parse / ast visiting logic into next-swc's rust codebase. By
having this, turbopack can reuse same logic to extract info for the
analysis. Also as a side effect, this removes JS side parse which is
known to be inefficient due to serialization / deserialization.

The entrypoint `getPageStaticInfo` is still in the existing
`get-page-static-info`, only for extracting / visiting logic is moved.
There are some JS specific context to postprocess extracted information
which would require additional effort to move into.


Closes PACK-2088
2024-01-22 14:42:28 -08:00
Tim Neutkens e169e73b45 Add hasRedbox fix (#60522)
## What?

As @leerob and I found in-person when opening #57230 the `hasRedBox()`
helper was incorrectly passing when it shouldn't pass in both the true
and false case.

This PR uses a different approach by waiting 7 seconds before checking,
this leaves enough room for HMR / reloads to apply, it doesn't
meaningfully slow down the test suite and increases reliability of the
check as you can see below in the tests that were previously passing
that are no longer passing.

I've moved these to skipped tests for landing this PR as I want to avoid
further issues being introduced while we fix them. @huozhi will
investigate these next week 👍

Failing tests that are temporarily skipped:
-
https://github.com/vercel/next.js/pull/60522/files#diff-513b477050bf1a620697b4d16bc1e6850282cb54e0609bdc5fd34307bfa9e471R9
-
https://github.com/vercel/next.js/pull/60522/files#diff-fa7d7c8c40914005c138d852eaf6a69ac0df51ec77bec548cbc5f0bfbdc8ebc5R25
-
https://github.com/vercel/next.js/pull/60522/files#diff-6f9f7dc131416cb17938311939a56d8c0e685a8fe6e8fc0cf5cd04939c74f388R41
-
https://github.com/vercel/next.js/pull/60522/files#diff-439830e340a320c56645e9d00aaf0fd0b492ddb90b6d7f9db89458ccc5158eb7R8
-
https://github.com/vercel/next.js/pull/60522/files#diff-62938bf5cd4d84f96dde8b6bcb2c8e18099e6dfca269c4302229b79175c0250cR18
-
https://github.com/vercel/next.js/pull/60522/files#diff-513b477050bf1a620697b4d16bc1e6850282cb54e0609bdc5fd34307bfa9e471R9


<!-- 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 #

-->


Closes NEXT-2059
2024-01-15 09:36:44 +01:00
JJ Kasper 4fc7ec1c8c Update flakey dev middleware test (#60590)
This error can show more than just once depending on number of requests
to the page and refreshes.

x-ref:
https://github.com/vercel/next.js/actions/runs/7507976633/job/20442621189?pr=60589

Closes NEXT-2093
2024-01-12 22:43:37 +00:00
Jiachi Liu f5bef049f5 Polish error icon for error log (#55618)
### After 💅 

<img width="109" alt="image" src="https://github.com/vercel/next.js/assets/4800338/f90d15a1-ac6e-4fe1-8241-d9e40e9d2e0e">

 ### Before 

<img width="143" alt="image" src="https://github.com/vercel/next.js/assets/4800338/fbc09a29-cac2-459d-8a96-d1a5948947cc">
2023-09-20 14:56:34 +00:00