Commit graph

19743 commits

Author SHA1 Message Date
Jiachi Liu
5f635de51f
Revert "Ensure webpack build worker defaults on" (#62342)
Reverts vercel/next.js#62214

Enabling build worker by default breaks some mdx rendering pages with
`next build`
x-ref: https://vercel.slack.com/archives/C04DUD7EB1B/p1708543258307169
2024-02-21 12:00:18 -08:00
JJ Kasper
f994d409c2
Revert "Revert "Update split chunk handling for edge/node" (#62313)" (#62336)
This re-lands the chunking optimization with fix for the split chunks
config to ensure we aren't generating duplicate chunks from not chunking
`all` together.

Tested various configs against our repro case here:

https://vercel.com/vercel/vercel-site/2D5Xirs9Vr1M29WHAuNawgjvgE4G
https://vercel.com/vercel/vercel-site/B2aez1NNCyVvoUBTSMFy8npBKK3j

Closes NEXT-2552
closes: https://github.com/vercel/next.js/issues/51298
x-ref: https://github.com/vercel/next.js/pull/62313
2024-02-21 11:40:29 -08:00
Sébastien Vanvelthem
cd6dacd59f
eslint-config-next: allow typescript eslint v7 (#62137)
### What?

Allow [typescript-eslint
v7](https://typescript-eslint.io/blog/announcing-typescript-eslint-v7)
support

### Why?

Allow compatibility with typescript eslint v7, pave the way to support
eslint flat config and possibly typescript 5.4

### How?

Add a v7 to the allowed versions in eslint-config-next dependencies and
regenerate the lock with pnpm install. Be aware that some eslint peer
dev deps have been updated in the process. See the lock

Tested with pnpm build && ppm lint

## Close

- Closes https://github.com/vercel/next.js/issues/62138
2024-02-21 14:01:43 -05:00
Balázs Orbán
a1b20470c6
feat(error-overlay): hide <unknown>/stringify methods in <anonymous> file from stack (#62325)
### What?

Clean up the error overlay:

<details>
<summary><b>Before:</b></summary>
<img
src="https://github.com/vercel/next.js/assets/18369201/22c3ab2c-8445-4c25-8554-a5ab51100af4"/>
</details>

<details>
<summary><b>After:</b></summary>
<img
src="https://github.com/vercel/next.js/assets/18369201/403c30fc-8b27-4529-838c-47d9cbe52381"/></details>


I also simplified the current code as it was likely using `useMemo` a
bit eagerly.

### Why?

This is an unactionable line by the user, no value in showing it in the
overlay.

### How?

Filter out the frame before rendering it in the overlay.

This answers [this
question](https://github.com/vercel/next.js/pull/62206#issuecomment-1956636486)
too, since the module grouping is local. Now that `<anonymous>` is
filtered out, the two Next.js groups are now merged into one, further
cleaning up the stack.

Closes NEXT-2505
2024-02-21 16:58:22 +01:00
Tobias Koppers
79cb2b2256
Revert "Turbopack: reduce tasks needed for emitting" (#62324)
Reverts vercel/next.js#62291

Closes PACK-2563
2024-02-21 15:29:03 +01:00
Balázs Orbán
2a9a7a2cbe
fix(error-overlay): correct module grouping, hide useless frames (#62206)
### What?

While working on hiding useless frames, I also noticed that we regressed
on #44137, meaning it was totally ignored. I haven't tracked down at
which point this happened but made it work again in the same PR.

This should significantly clear up the shown error stack in the error
overlay:

<details>
<summary><b>Before:</b></summary>
<img
src="https://github.com/vercel/next.js/assets/18369201/1833abfe-7c0b-4a34-bad8-735799f1cf42"/>
<img
src="https://github.com/vercel/next.js/assets/18369201/70ecc124-1241-4df9-adfe-7f0c8f47d6d3"/>
</details>


<details>
<summary><b>After:</b></summary>
<img
src="https://github.com/vercel/next.js/assets/18369201/d0395320-c52c-47a0-a281-f7721410f4da"/>
</details>

### Why?

Some frames in the error stack are useless/unactionable to the user and
make it harder to parse the error. This PR filters out some of them, to
make the stack more readable.

### How?

The stack traces are run through a `.filter()` before being displayed.


Closes NEXT-2505
Closes NEXT-2522
2024-02-21 13:07:40 +00:00
Tobias Koppers
7d448236a2
Turbopack: add SSR category to tracing (#62318)
### Why?

Show correct type of processing in tracing


Closes PACK-2560
2024-02-21 13:42:41 +01:00
Tobias Koppers
bf196f5e5a
Turbopack: reduce tasks needed for emitting (#62291)
### What?

* reduce tasks needed for emitting
* add user level tracing


Closes PACK-2552
2024-02-21 13:36:57 +01:00
vercel-release-bot
063c286416 v14.1.1-canary.67 2024-02-21 11:00:29 +00:00
JJ Kasper
fc0f94f8c0
Revert "Update split chunk handling for edge/node" (#62313)
We have a reproduction of OOMs still occurring with this chunking so
going to revert while we investigate further

x-ref:
https://github.com/vercel/next.js/issues/51298#issuecomment-1953004425

Reverts vercel/next.js#62205

Closes NEXT-2548
2024-02-21 11:57:08 +01:00
Vercel Release Bot
0b9d635555
Update Turbopack test manifest (#62314)
This auto-generated PR updates the integration test manifest used when
testing Turbopack.
2024-02-21 10:48:24 +00:00
Tim Neutkens
2f961d39ed
Move scss tests into individual directories (#62277)
## What?

Further simplifying the way the tests are created for Sass so that they
can be moved into `test/e2e` in a follow-up PR.


<!-- 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-2537
2024-02-21 09:49:12 +01:00
Ethan Arrowood
eea4e6079f
Fix draft mode invariant (#62121)
### What?

In today's implementation, requests that don't end in `.rsc` are getting
the data request query. We need to remove this toggle to prevent them
from 500'ing.

### Why?

The invariant triggered was:


212553958c/packages/next/src/server/base-server.ts (L2838-L2842)

Crawling up the code, the conditional:


212553958c/packages/next/src/server/base-server.ts (L2815)

must be `true`.

The variable `isDataReq` is set here:


212553958c/packages/next/src/server/base-server.ts (L1833-L1839)

This conditional expression is a bit complex, but it simplifies down to:
- `isDataReq` is `true` when (TODO)
- `isDataReq` is `false` when (TODO)

### How?

Closes NEXT-2341
Fixes #61377

Tested manually by:
- Building and packaging this branch locally
- Deploying tarball and then depending on it as the Next.js version for
an example app similar to the one reported by #61377
- Inspecting console for 500 errors.

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Zack Tanner <zacktanner@gmail.com>
2024-02-21 08:34:22 +00:00
vercel-release-bot
79b7cb5f07 v14.1.1-canary.66 2024-02-21 06:09:07 +00:00
Sam Ko
745b1b59b2
fix(next-font): update capsize css so fallbacks are updated with the … (#62309)
## Description
We need to manually update the `@capsizecss/metrics` every time it
updates so we get the latest fallback fonts.

## Changes
- https://github.com/vercel/next.js/issues/47115

Closes NEXT-2547
2024-02-20 22:04:56 -08:00
suu3
9feaffaf68
docs: add an explanation about prefetch on hover to the link.mdx (#62182)
<!-- 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 #

-->

Hello, I noticed the following code in `link.tsx`.
```
//client/link.tsx
...
onMouseEnter(e) {
    ...
    if (
        (!prefetchEnabled || process.env.NODE_ENV === 'development') &&
        isAppRouter
    ) {
        return
    }

    prefetch(
          ...
    )
},
```
It seems that when prefetch={false} is set, prefetch still occurs on
hover for page routers.
However, there is no explanation in the <Link> documentation, which
caused misleading.
I added the explanation inside PageOnly component, could you please
review it?
2024-02-21 05:56:07 +00:00
OJ Kwon
6f87054c76
fix(next-core): properly normalize app route for _ (#62307)
### What

This PR amends turbopack's behavior to handle some cases of normalized
path (`%5F` starting path), mainly fixes entry lookup works against
original path without normalization, also bends the output path of
client reference manifest matchs to what next.js expects.

Closes PACK-2553
2024-02-20 21:11:40 -08:00
Javi Velasco
2f9d718695
Fix perf spans (#62306)
- Remove a not-needed `performance.measure()` call.
- Fixes reporting client component loading span to happen on headers
flush.
- Simplifies measures by using `performance.now()`


Closes NEXT-2546
2024-02-21 01:06:50 +00:00
vercel-release-bot
ad992d4576 v14.1.1-canary.65 2024-02-20 23:21:37 +00:00
Nick Muller
1783e55c28
Fix typo in unstable_cache.mdx (#62301) 2024-02-20 22:25:20 +00:00
vercel-release-bot
51e231b0b1 v14.1.1-canary.64 2024-02-20 21:39:22 +00:00
JJ Kasper
6feb803f78
Add otel span for client component loading (#62296)
This adds a new span to allow tracking the sum of all client component
loading times for a specific request along with the count of items
loaded.

Closes NEXT-2540

---------

Co-authored-by: Zack Tanner <zacktanner@gmail.com>
2024-02-20 13:27:16 -08:00
Jiachi Liu
f4ac92d320
Add flag for early import app router modules (#61168)
Closes NEXT-2236

---------

Co-authored-by: Ethan Arrowood <ethan@arrowood.dev>
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-02-20 12:29:30 -08:00
Tim Neutkens
5be8135982
Move scss tests into test/integration/scss directory (#62276)
## What?

Groups together the scss tests. I'm working on refactoring these to use
`test/e2e` instead as many tests currently only run during builds and we
want to make sure these Sass tests run for Turbopack (which is dev only
currently) to catch bugs.

<!-- 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-2536
2024-02-20 20:30:49 +01:00
Dima Voytenko
662472370e
Allow fetch to propagate arbitrary init options (#62168)
Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-02-20 18:31:06 +00:00
Tobias Koppers
6d3ede147d
update turbopack (#62285)
* https://github.com/vercel/turbo/pull/7430 <!-- Tobias Koppers -
disable manifest chunks by default -->
* https://github.com/vercel/turbo/pull/7431 <!-- Donny/강동윤 -
fix(turbopack): Fix `pure` lint for CSS Modules in lightningcss mode -->
2024-02-20 19:13:00 +01:00
OJ Kwon
dd4b52e77e
fix(next-core): fix aliased free var for edge runtime (#62289)
### What?

Matches global free var alias to what webpack does (to the native
instead of polyfill)


Closes PACK-2550
2024-02-20 10:11:34 -08:00
Cody Lundquist
fb99d2eaf5
docs: Update unstable_cache.mdx with important info about dynamic data (#62202)
<!-- 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?

This caused me a ton of issues in production due to inconsistent cache.
It does not manifest itself in local development. The only reason I
figured it out was because I upgraded to the canary release and someone
added a helpful exception explaining that I shouldn't be doing what I
was doing. To hopefully help people in the future, I'm adding a blurb to
the `unstable_cache` docs.

Co-authored-by: Sam Ko <sam@vercel.com>
2024-02-20 17:52:53 +00:00
Zack Tanner
d371f648d2
Renew prefetch cache entry after update from server (#61573)
### What
When a prefetch cache entry becomes "stale", it'll remain stale until
eventually it gets evicted. However during that stale window, the cache
is never revalidated, and so instant navigations stop working and data
is fetched from origin every navigation.

### Why
The `lastUsedTime` entry on the prefetch cache is currently only updated
after the first read. Once it becomes stale, `applyFlightData`'s
recursive functions will see that there is no longer a reusable prefetch
cache entry, and will trigger a lazy fetch of the new data on every
subsequent navigation.

### How
This updates prefetch cache handling to always ensure we’re using a
fresh or reusable prefetch cache entry. This means that stale prefetch
entries will be refreshed on a navigation event. As a result of this,
I’ve had to disable one of our tests that relies on this stale cache
behavior. It’s not ideal that we’re blocked on the loading boundary when
fetching child segment data—ideally we can refactor this to cache the
loading component in the CacheNode and copy it over on navigations,
similar to how ‘head’ is handled. I’ll work on this in a separate PR.

Note: The new client cache test for this is disabled in PPR for the same
reason as the other tests: auto prefetching with PPR navigations is
currently loading fresh data rather than reusing the prefetch cache.


Fixes #58969
Fixes #58723
Closes NEXT-1904
2024-02-20 09:07:18 -08:00
Tobias Koppers
73322aa3d8
Verify correctness of externals (#62235)
### What?

* Verify correctness of externals
* error when packages can't be made external

### Why?

* Resolving to incorrect externals might lead to runtime errors
* Give users hints how to fix these issues

### How?


Closes PACK-2535

---------

Co-authored-by: Tim Neutkens <tim@timneutkens.nl>
2024-02-20 16:38:31 +00:00
vercel-release-bot
d894fac0e1 v14.1.1-canary.63 2024-02-20 16:18:08 +00:00
Jiachi Liu
d7d636adf5
Tree shake the unused exports in direct relative imported client component module (#62238)
### What & Why

This PR helps fixes a long time tree-shaking issue that if you're import
some identifiers from client components, the whole client component is
being included in the client chunk. Because we're using import eager
mode in webpack to include all the client component modules that make
sure they're present in SSR entry and browser entry when they're
transformed to client reference on RSC layer.

But the way we collect client components is a bit "aggressive" where
contains some spaces to optimize.

### How

We change the collected client components from simpliy collecting it
resolved module request, into collecting both the imported identifiers
(by server components) and the module request. And when we inserted the
used client components imports into the SSR and Client entry, leverage
webpack magic comments `"webpackExports"` to only contain the used
exports in the bundle. Thank you webpack for this nice feature : )

Along the way we also fixed an issue that when you only used default
export, the `default` export itself should also be proxied when the
bundle is in ESM.

#### Notice

There's a limitation yet that it can't work with barrel file, if you
have a shared component `index.js` to re-export the changes several
client components there and you only partially import few from
`index.js` it won't work. For the cases that the node_modules package
contain a barrel file importing multiple client components, please use
[optimizePackageImports](https://nextjs.org/docs/app/api-reference/next-config-js/optimizePackageImports)
config for now. We'll have follow up optimizations

### Testing Result

If we compare the `react-aria-components` the reproduction from #60246,
you'll see the result being optimized a lot:

#### After vs Before

134KB being tree-shaked out 🤯 
```
Route (app)                              Size     First Load JS
┌ ○ /                                    324 B           127 kB
├ ○ /_not-found                          872 B          86.5 kB
└ ○ /other-page                          174 B           127 kB
```

```
Route (app)                              Size     First Load JS
┌ ○ /                                    325 B           261 kB
├ ○ /_not-found                          870 B          86.5 kB
└ ○ /other-page                          176 B           261 kB
```

Fixes #60246
Related report: https://github.com/adobe/react-spectrum/issues/5639
Closes NEXT-2527
phase 1 of NEXT-1799

---------

Co-authored-by: Shu Ding <g@shud.in>
2024-02-20 17:07:25 +01:00
Kuzey Kose
09c0065c3d
fix(create-next-app): add --no-import-alias for non-interactive (#62035)
### What?

The [create-next-app
documentation](https://nextjs.org/docs/app/api-reference/create-next-app#non-interactive)
under API reference says that;

> Further, you can negate default options by prefixing them with --no-
(e.g., --no-eslint).

When I tried to use --no-import-alias, I thought that it would
automatically use the default alias (@/*), but it does not.

### Why?

Each option has --no prefix control but import-alias has no --no prefix
control to give default value to program.

In an [Interactive](https://nextjs.org/#interactive) approach, the user
can select a prompt; `Would you like to customize the default import
alias (@/*)? No / Yes.` If the user selects no, then the default alias
is applied with @/*.

### How?

Implementing a condition solve the problem for general purpose. If
arguments includes `--no-import-alias` then the importAlias section
automatically apply the default value.

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
Co-authored-by: Steven <steven@ceriously.com>
2024-02-20 10:23:04 -05:00
Leah
a97725f5f6
fix(turbopack): print missing slots in debug message (#62280)
### What?

The console message was added in
https://github.com/vercel/next.js/pull/60186, but Turbopack outputs
fully resolved paths.


Closes PACK-2548
2024-02-20 16:22:15 +01:00
Balázs Orbán
0d64d592f4
docs(cli): tweak next info docs (#62274)
### What?

Follow-up on #62249

### Why?

I noticed the example `next info` output was outdated/missing a few
parts in the docs.
2024-02-20 09:55:49 -05:00
Tobias Koppers
0c7cc02527
tests are no longer flaky (#62278)
### What?

Next automatic update will update them

Closes PACK-2547
2024-02-20 14:44:11 +01:00
Vercel Release Bot
2af197b81c
Update Turbopack test manifest (#62268)
This auto-generated PR updates the integration test manifest used when
testing Turbopack.
2024-02-20 12:59:12 +00:00
Leah
c623a3fa1f
docs: remove reference to createNextDescribe in favor of nextTestSetup (#62245)
Rendered:
https://github.com/vercel/next.js/blob/hrmny/next-test-setup-docs/contributing/core/testing.md
(the same except for `createNextDescribe` being replaced with
`nextTestSetup`)

Also split up the lines a bit and ran a grammar checker over it.

Closes PACK-2536

---------

Co-authored-by: Balázs Orbán <info@balazsorban.com>
2024-02-20 11:57:48 +01:00
Balázs Orbán
ac1c14b8ce
feat(cli): show available memory/CPU cores in next info (#62249)
### What?

Adds a new line to the `next info` output:

```diff
Operating System:
  Platform: linux
  Arch: x64
  Version: #18~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb  7 11:40:03 UTC 2
+ Available memory (MB): 31795
+ Available CPU cores: 16
Binaries:
  Node: 18.18.2
  npm: 9.8.1
  Yarn: N/A
  pnpm: 8.15.1
Relevant Packages:
  next: 14.1.1-canary.61 // Latest available version is detected (14.1.1-canary.61).
  eslint-config-next: 14.1.1-canary.61
  react: 18.2.0
  react-dom: 18.2.0
  typescript: 5.2.2
Next.js Config:
  output: N/A
```

### Why?

This can help in debugging

### How?

Using [`os.totalmem()`](https://nodejs.org/api/os.html#ostotalmem) and
[`os.cpus()`](https://nodejs.org/api/os.html#oscpus)

Closes NEXT-2529
[Slack
thread](https://vercel.slack.com/archives/C046HAU4H7F/p1708359702870269?thread_ts=1708355509.771049&cid=C046HAU4H7F)
2024-02-20 11:46:51 +01:00
Donny/강동윤
2d8462eaf4
Update turbopack (#62263)
### What?


* https://github.com/vercel/turbo/pull/7416 <!-- Donny/강동윤 - Update
`swc_core` to `v0.90.10` -->


### Why?

To keep in sync

### How?



Closes PACK-2540
2024-02-20 08:26:39 +01:00
JJ Kasper
9c44024139
Add test log prefix for otel (#62258) 2024-02-19 21:19:49 -08:00
Donny/강동윤
a78ed66726
Update swc_core to v0.90.10 (#62222)
### What?

Update SWC crates.

### Why?

There was an important bug fix in SWC.

 - https://github.com/swc-project/swc/pull/8647

### How?



Closes PACK-2529
2024-02-20 03:20:56 +00:00
Jiwon Choi
b63196f0fe
fix(next): terser-webpack-plugin path in taskfile.js is missing 'src' (#62229)
### Why?

While developing https://github.com/vercel/next.js/pull/57656, using
`webpack`(which runs `bundle5.js`) gives me the following error:

```
Error: Cannot find module 'next/dist/build/webpack/plugins/terser-webpack-plugin'
Require stack:
- .../node_modules/next/dist/compiled/webpack/bundle5.js
```

### What?

The path to
[terser-webpack-plugin](https://github.com/vercel/next.js/blob/canary/packages/next/src/build/webpack/plugins/terser-webpack-plugin/src/index.ts)
seems to be modified, but the `taskfile.js` for building `bundle5.js`
hasn't been updated since https://github.com/vercel/next.js/pull/29168.

### How?

- Added `src` after the `terser-webpack-plugin` path in `taskfile.js`
- Run `pnpm ncc-compiled` (not sure if this is the right command to
run), built `bundle5.js` only.

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-02-19 16:17:13 -08:00
Sina-Abdollahi
65369991d8
fix: 💯 typescript issue with-jest example (#62227)
So there are some toBe property's with React-testing-library that when
written shows this error for example: Property 'toBeInTheDocument' does
not exist on type 'JestMatchers<HTMLElement>'. the commit fixes it

<!-- 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: Sam Ko <sam@vercel.com>
2024-02-20 00:07:35 +00:00
vercel-release-bot
321e4d0f2e v14.1.1-canary.62 2024-02-19 23:21:18 +00:00
JJ Kasper
1a102fb273
Fix type error in build.ts (#62253)
Fixes:
https://github.com/vercel/next.js/actions/runs/7964464677/job/21742122219

x-ref: https://github.com/vercel/next.js/pull/62234

Closes NEXT-2530
2024-02-19 12:09:21 -08:00
Adrian Hartanto
92fdcc75d4
update: allow providing stale-while-revalidate delta (#61330)
<!-- 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: https://github.com/vercel/next.js/pull/52251
Closes: https://github.com/vercel/next.js/issues/51823

### Adding a feature

Added `stale-while-revalidate` delta amount to indicate that the cache
could reuse a stale response while it revalidates,
[reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control).
It's also already supported by
[CloudFront](https://aws.amazon.com/about-aws/whats-new/2023/05/amazon-cloudfront-stale-while-revalidate-stale-if-error-cache-control-directives/).

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-02-19 11:51:13 -08:00
Tim Neutkens
544444b9da
Ensure handleRouteType does not throw in production builds (#62234)
## What?

Ensures the build can finish before issues are reported with Turbopack.

<!-- 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-2525
2024-02-19 20:39:33 +01:00
Leah
ecb4d7484e
refactor(turbopack): resolve routes by page name instead of pathname (#61778)
### Why?

We currently use `page` and `pathname` in different places for file
system paths (manifests can be in a different folder to the js entry),
this PR makes more things just use `page` directly instead of going
through `pathname`.

This PR also adds an entry key (similar to the webpack version) uniquely
identifying all entry points (and assets).


Closes PACK-2432
2024-02-19 15:13:39 +00:00
Leah
6926688a1e
refactor(turbopack): wrap manifest loading in helper class (#62118)
### What?

All the manifest loading logic now lives in the
`TurbopackManifestLoader` class.
We have to pass way fewer arguments around to the functions now.

I've also cleaned up / restructured the arguments of the bigger
functions in `turbopack-utils.ts` and gave some functions better names.


Closes PACK-2520
2024-02-19 14:27:09 +00:00