Commit graph

20208 commits

Author SHA1 Message Date
OJ Kwon
daec5be052
test(scss): rename test suites (#63060)
### What

To verify manifest issues.


Closes PACK-2697
2024-03-08 10:57:02 -08:00
Wyatt Johnson
ea56c8f7ad
DX: add route context to dynamic errors for app routes (#62844)
Gives the users pathname context on routes that access Dynamic API's so
that if these errors are caught they can modify their code accordingly.
This is a followup to #61332.


Closes NEXT-2695
2024-03-08 11:35:24 -07:00
Balázs Orbán
31a3aff755
docs: Update route-segment-config.mdx (#63046)
Fix a broken link

Closes NEXT-2761
2024-03-08 10:26:56 -05:00
vercel-release-bot
5482940dd9 v14.2.0-canary.10 2024-03-08 15:19:20 +00:00
Tobias Koppers
72d88c1596
app layouts/pages depend on shared main files (#63042)
### What?

avoid duplication of next.js internals in app dir

For the example/hello-world:

Before:

```
Route (app)                                          Size     First Load JS
┌ ○ /                                                15 kB           184 kB
└ ○ /_not-found                                      15 kB           184 kB
+ First Load JS shared by all                        169 kB
  ├ chunks/[project]__929616._.js                    85.2 kB
  ├ chunks/[project]_packages_next_dist_0f911b._.js  83.2 kB
  └ other shared chunks (total)                      230 B
```

After:

```
Route (app)                                          Size     First Load JS
┌ ○ /                                                15 kB           104 kB
└ ○ /_not-found                                      15 kB           104 kB
+ First Load JS shared by all                        88.9 kB
  ├ chunks/[project]_packages_next_dist_0f911b._.js  83.2 kB
  └ other shared chunks (total)                      5.7 kB
```


Closes PACK-2695

### Turbopack changes

* https://github.com/vercel/turbo/pull/7617 <!-- OJ Kwon -
feat(turbopack): add missing webpack context property -->
* https://github.com/vercel/turbo/pull/7676 <!-- Tim Neutkens -
Implement minify for Turbopack runtime file -->
* https://github.com/vercel/turbo/pull/7677 <!-- Tobias Koppers - add
FullContextTransition -->
2024-03-08 16:12:33 +01:00
Delba de Oliveira
c07f872169
docs: Update CRA migration guide (#63037) 2024-03-08 08:56:45 -06:00
Karl Horky
d71a842f89
Switch CodeSandbox repros to pnpm (#63038)
Closes #57895
Closes #57896

### What?

Switch Yarn v1 to pnpm for reproduction repos, avoiding the CodeSandbox
Yarn v1 `yarn.lock` caching problem described below

### Why?

As confirmed with @CompuIves, CodeSandbox caches the `yarn.lock` file
generated after the first start + `yarn install` of a GitHub template
(Yarn v1) - this saves old versions of Next.js (not the latest canary)
in the lockfile and causes old versions of Next.js to be installed when
users click on the CodeSandbox Reproduction link during issue creation.

This leads to the current breakage, where Next.js actually cannot even
start in the reproduction sandbox:

1. Start creating a new GitHub issue on the `vercel/next` GitHub repo
2. Open [the CodeSandbox reproduction
link](https://codesandbox.io/p/sandbox/github/vercel/next.js/tree/canary/examples/reproduction-template)
linked in the **Link to the code that reproduces this issue** section
3. Observe the error message below in the `dev` task started below
(`experimental.appDir: true` was required in the `13.0.8-canary.0`
version of Next.js in the cached `yarn.lock` file, but the
`next.config.js` file no longer includes this config)

```bash
$ yarn dev
yarn run v1.22.19
$ next dev
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
Error: > The `app` directory is experimental. To enable, add `appDir: true` to your `next.config.js` configuration under `experimental`. See https://nextjs.org/docs/messages/experimental-app-dir-config
    at Object.findPagesDir (/project/sandbox/node_modules/next/dist/lib/find-pages-dir.js:80:19)
    at new DevServer (/project/sandbox/node_modules/next/dist/server/dev/next-dev-server.js:110:59)
    at NextServer.createServer (/project/sandbox/node_modules/next/dist/server/next.js:140:20)
    at /project/sandbox/node_modules/next/dist/server/next.js:155:42
    at async NextServer.prepare (/project/sandbox/node_modules/next/dist/server/next.js:130:24)
    at async /project/sandbox/node_modules/next/dist/cli/next-dev.js:344:17
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
```

Sandbox demo:
https://codesandbox.io/p/sandbox/quirky-pascal-n32xk2?file=%2Fnext.config.js%3A5%2C1

![Screenshot 2023-11-01 at 16 09
59](https://github.com/vercel/next.js/assets/1935696/b8287a2e-86b4-4c08-afca-bc9219b6d411)

### How?

Switch to pnpm installation commands instead of Yarn v1

### Caveats

This uses CodeSandbox-specific config

### Alternatives considered

- Delete the outdated yarn.lock file on setup of the sandbox, PR open
here: #57895
- Commit an empty `yarn.lock` file to block caching of this file, PR
open here: #57896

cc @samcx @CompuIves
2024-03-08 14:09:59 +00:00
vercel-release-bot
af5b4db98a v14.2.0-canary.9 2024-03-08 08:29:26 +00:00
Tim Neutkens
36e401ecc5
Enable minification for Turbopack (#62994)
## What?

Implementation for https://github.com/vercel/turbo/pull/7660. Enables
minification of browser files.

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

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
2024-03-08 08:11:50 +01:00
Zack Tanner
ff1d4cb3e7
fix dynamic api route test (#63027)
While looking at flakey tests I noticed that this test has a typo which
means the assertion was being skipped all together.

Closes NEXT-2760
<!-- 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 #

-->
2024-03-08 02:11:20 +00:00
Will Binns-Smith
bd72f39ca8
Turbopack + pages router: recover from runtime errors by reloading (#63024)
An iteration of #62359, this uses the module-local flag instead of a
shared dedicated module for flagging runtime errors, correctly reloading
the page when these occur.

Test Plan: See now-passing tests in the manifest.


Closes PACK-2690
2024-03-07 17:24:50 -08:00
Sam Ko
8c7f0dc960
Fix flaky test by removing unecessary NODE_OPTIONS='--inspect' (#63025)
## Why?

We have a flaky test with `NODE_OPTIONS='--inspect'` test in
https://github.com/vercel/next.js/blob/canary/test/integration/cli/test/index.test.js
because with Turbopack, we run several integration tests concurrently.

Our integration tests are ran concurrently, so anything that adds
`NODE_OPTIONS='--inspect'` can clash with another when `run-tests.js` is
ran. Hence, the result below.

-
https://github.com/vercel/next.js/actions/runs/8189378285/job/22394053022?pr=62999

You can confirm this locally by running `TURBOPACK=1 node run-tests.js
--test-pattern
"test\\/integration\\/(cli|config-mjs)\\/test\\/index\\.test\\.js"`.

## Changes

Both
https://github.com/vercel/next.js/blob/canary/test/integration/config-mjs/test/index.test.js
and
https://github.com/vercel/next.js/blob/canary/test/integration/config/test/index.test.js
add a now unnecessary `NODE_OPTIONS='--inspect'`, so we should be good
to remove them.

Closes NEXT-2759
2024-03-07 17:18:26 -08:00
Nhan Doan
22de32702c
chore(blog-starter): update import paths to use aliases (#62986)
### What?
Update import paths to use aliases.

### Why?
For clearer and shorter imports.

### How?

https://nextjs.org/docs/app/building-your-application/configuring/absolute-imports-and-module-aliases

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-07 17:08:06 -08:00
Zack Tanner
7a7068cadb
fix transpile-packages test (#63023)
A recent `aws-sdk` publish broke the release. This adds a dependency to
unblock these tests from failing.

x-ref:
https://github.com/aws/aws-sdk-js-v3/issues/5866#issuecomment-1984616572
<!-- 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-2758
2024-03-08 00:36:42 +00:00
Zack Tanner
333d3ad768
fix flakey HMR test (#63022)
The "Compiled" HMR log is emitted as follows:

> Compiled in 54ms

When running this string through the matcher, we get:
```
> const matches = "Compiled in 54ms".match(/Compiled.*? in ([\d.]{1,})\s?(?:s|ms)/i) 
console.log(matches[1]); // 54
```

We correctly assign `compileTime` to `matches[1]`. However, we then
assign `compileTimeMs` to `parseFloat(compileTime[1])`. This is
definitely an error, as `compileTime[1]` would be `4` in the above
example.

This means that if the compilation time takes less than a single digit
value, it'd be coerced to NaN.

<!-- 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-2757
2024-03-07 23:49:12 +00:00
Jiachi Liu
25be9cafec
Fix the plugin state for async modules in webpack plugins (#62998)
### What

Use the plugin state directly in flight plugins to access the async
modules collection

### Why

This change is cherry-picked from #62349 , where I found the plugin
state didn't store the async modules reousces properly due to the clone
of the array in flight manifest plugin. So for flight manifestp plugin
itself, it's holding a different instance rather than the one from proxy
state.

Closes NEXT-2743
2024-03-08 00:25:32 +01:00
vercel-release-bot
ea5b23c870 v14.2.0-canary.8 2024-03-07 23:24:26 +00:00
Zack Tanner
77f88004a8
fix flakey app-action test (#63021)
This test is flaking because the assertion before it triggers a redbox
error, and the HMR event to remove the redbox is occasionally happening
after we've moved onto the next test assertion. It also just checks for
"h1" which is heavily overloaded in this test suite for various UI
elements so I added a more specific selector.


[x-ref](https://github.com/vercel/next.js/actions/runs/8195295576/job/22413257207?pr=63019#step:27:1550)

<!-- 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-2756
2024-03-07 15:15:20 -08:00
Zack Tanner
e5ac6aeea8
fix broken create-next-app tests (#63019)
#62980 migrated `examples/basic-css` to use app router. A handful of our
create-next-app tests use this example when asserting the correct
project files are created, so we were asserting on a pages file existing
rather than an app dir page. This PR updates those tests.

<!-- 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-2754
2024-03-07 22:21:12 +00:00
nauvalazhar
2598ec8c1e
docs: change the Router Cache link reference (#62976)
<!-- 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 #

-->

### What?

Currently, the Router Cache on the [Linking and
Navigating](https://nextjs.org/docs/app/building-your-application/routing/linking-and-navigating)
page is linked to the "[Data Fetching, Caching, and
Revalidating](https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#caching-data#router-cache)"
page, isn't it would be more accurate if Router Cache referenced to the
[Router Cache section on the
Caching](https://nextjs.org/docs/app/building-your-application/caching#router-cache)
page instead?

### Why?

This change would avoid confusion in two ways:
1. The first link used in the Linking and Navigating page does not exist
(https://nextjs.org/docs/app/building-your-application/data-fetching/fetching-caching-and-revalidating#caching-data#router-cache)
2. Router Cache on the Caching page offers specific context and a
detailed guide on the topic

Thank you.

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-07 22:13:50 +00:00
Darius Cepulis
eace44d129
with-mux-video: move to app router and update packages (#62297)
## App Router

Moves the `with-mux-video` example to idiomatic App Router, with goodies
like
* server component data fetching
* server actions
* layouts
* route groups
* loading UI

## Mux Dependencies

* @mux/mux-node 7 -> 8
* @mux/mux-player-react 1 -> 2
* @mux/upchunk + custom UI -> @mux/mux-uploader

## In other news...

* Fleshed out the README
* Updated imagery
* Moved from styled jsx to tailwind and lightly updated styles

## Contributor Checklist

* [x] The "examples guidelines" are followed from our contributing doc
https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md
* [x] Make sure the linting passes by running `pnpm build && pnpm lint`.
See
https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md

---------

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-07 22:08:49 +00:00
vercel-release-bot
0b679a0fed v14.2.0-canary.7 2024-03-07 21:37:05 +00:00
OJ Kwon
710933b033
feat(next): fallback lightning if swc/wasm loaded (#62952)
### What?

Currently wasm binding cannot build lightningcss, until we can make it
work falls back to normal css if lightningcss is enabled + wasm bindings
are loaded.



Closes PACK-2678
2024-03-07 13:30:14 -08:00
OJ Kwon
862b1e0273
fix(next-core): do not apply ecma transforms for custom js rules (#62831)
### What

Looks like we allow d.ts to be included in `match_js_extension`, so if
custom rules have an ecmatransform it could raise an error with d.ts.

This doesn't make test passes yet, seems there are other issues need to
be resolved.

Closes PACK-2653
2024-03-07 13:19:27 -08:00
OJ Kwon
2a6199c2d9
fix(next-core): honor basepath for the metadata property (#62846)
### What?

When we write path for the og metadata, basePath was omitted regardless
of config. (Actual asset emission was correct, just writing the path in
the metadata route)

PR updates template code to use config's basePath if exists.

Closes PACK-2655
2024-03-07 13:19:15 -08:00
Delba de Oliveira
446083e21a
Docs: Document crossOrigin option (#61455) 2024-03-07 12:24:04 -06:00
Delba de Oliveira
c1aa8ddfd6
Docs: Clarify AbortController.signal usage in React fetch memoization (#63009)
As per @SukkaW's feedback. Closes:
https://linear.app/vercel/issue/DX-2379/clarify-abortcontrollersignal-usage-in-react-fetch-memoization
2024-03-07 12:08:37 -06:00
lhfmartin
c9cf8b9537
Fix syntax error in the TypeScript example (#63003)
### What?
Missing comma to separate dict entries

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-03-07 16:50:13 +00:00
Tobias Koppers
c1d4450209
Move timeout to test step and give whole job a bigger timeout (#62997)
### Why?

Sometimes the turbo build-native command takes longer to restore
stealing time from the actual test job


Closes PACK-2681
2024-03-07 17:31:00 +01:00
Delba de Oliveira
e93472e7d1
Docs: Clarify fetch caching exceptions (#63004)
Clarify that fetch is not cached when used in a Server Action (see
https://github.com/vercel/next.js/pull/60170), and in `POST` requests in
Route Handlers.
2024-03-07 10:01:43 -06:00
Arian
832cbb3330
chore: migrate basic-css example from page router to app router (#62980)
### Adding or Updating Examples

Migrate the basic-css example from page router to app router. If it
needs further updates, Please let me know

Happy to contribute

---------

Co-authored-by: Steven <steven@ceriously.com>
2024-03-07 15:44:13 +00:00
Vercel Release Bot
6dc28b3148
Update Turbopack test manifest (#62981)
This auto-generated PR updates the integration test manifest used when
testing Turbopack.
2024-03-07 14:31:55 +01:00
Donny/강동윤
03d89bc56d
Update turbopack (#62971)
# Turbopack

* https://github.com/vercel/turbo/pull/7625 <!-- Tobias Koppers -
generate calls of bindings correctly without this context -->
* https://github.com/vercel/turbo/pull/7621 <!-- Donny/강동윤 - fix: Fix
purity lint for CSS Modules in swc mode -->
* https://github.com/vercel/turbo/pull/7640 <!-- Tobias Koppers - very
dynamic requests will only lead to a warning -->
* https://github.com/vercel/turbo/pull/7639 <!-- Donny/강동윤 - build:
Update `swc_core` to `v0.90.17` -->


### What?

Update turbopack

### Why?

To keep in sync

### How?
2024-03-07 14:30:54 +01:00
Jiachi Liu
27ed7820a8
[error overlay] move missing tags error inside error overlay (#62993)
### What

* Move missing html tags error into error overlay, from outside we don't
have to manually determine when to render a dummy component with runtime
missing tag error or error overlay.
* Add brackets `<>` to the html tags in the error



![image](https://github.com/vercel/next.js/assets/4800338/cd3467b7-74c2-477e-8516-c31761adb064)


### Why

In #62815, we're having throwing an missing required error, this will
trigger another runtime error. Then when error overlay caught it through
error event listener, it will render it as an unhandled runtime error:

You will see the below message in the overlay.
```
Unhandled Runtime Error
Error: The following tas are missing...

[Error stack]
```

This error message will bring a message that the error is happened on
client during runtime, but actually we already know that is a user side
mistake which doesn't have a error trace. This couldn't hmr as you fix
the error as well.

This PR moves the rendering into error overlay that we're aware of the
errors and can render the correct html on client, with the `html` tag
attached with error id and `body` wrapping the error overlay. We tell
overlay that there're missing tags through props, let it handle
everything inside.

It can also hmr once you fix the error. One drawback is that when you
re-introduce the error, it might trigger react DOM updates exception
(`Failed to execute 'removeChild' on 'Node': The node to be removed is
not a child of this node.`) instead of the "missing tags" message again.
Besides that the HMR works properly.

Closes NEXT-2741
2024-03-07 14:24:00 +01:00
Balázs Orbán
5740ef3e1e
refactor(ts): type fastRefresh (#62848) 2024-03-07 12:21:17 +01:00
Arian
5f3b13584c
chore: update pnpm version from 8.15.1 to 8.15.4 (#62979)
Update pnpm version from 8.15.1 to 8.15.4
pnpm 8.15.4 release note
https://github.com/pnpm/pnpm/releases/tag/v8.15.4

Previous comment form reviewer  
https://github.com/vercel/next.js/pull/62963#issuecomment-1982010314
2024-03-07 09:22:45 +00:00
Donny/강동윤
5be869b667
build: Update swc_core to v0.90.17 (#62924)
### What?

Update SWC crates.

### Why?

To keep in sync.

### How?

Closes PACK-2670
2024-03-07 11:25:16 +09:00
Zack Tanner
b580b87269
Pass whole prefetch entry rather than status property (#62345)
No change in behavior -- this PR updates `applyFlightData` and its recursive functions to receive the prefetch entry rather than a boolean. We only use the actual prefetch entry in `fillLazyItemsTillLeafWithHead` but I found kept getting confused about what this argument was needed for when it was provided so far away from the part where we read the boolean. 

<!-- 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-2556
2024-03-06 17:14:14 -08:00
JJ Kasper
80fa841c7c
Add CI check to validate externals doc (#62968)
This avoids the need to manually check when these get out of sync by
having an automated check to keep them in sync when one or the other is
updated.

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

Closes NEXT-2734
2024-03-06 17:00:25 -08:00
Balázs Orbán
6b111ec6d3
docs: sync serverComponentsExternalPackages.mdx with implementation (#62966)
I noticed in #62965 that these were out-of-sync.

Content should match:
https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/server-external-packages.json

Also sorted alphabetically.

Closes NEXT-2732
2024-03-06 16:27:24 -08:00
James Mikrut
a1e294b706
Remove Payload from server-external-packages.json (#62965)
Payload is moving to ESM, and we need to be removed from the default
list of `serverComponentsExternalPackages`.

This PR simply removes Payload from the default list. Developers can add
it back in if they are using older versions of Payload.

---------

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-03-06 15:52:40 -08:00
vercel-release-bot
dd6cfd9882 v14.2.0-canary.6 2024-03-06 23:22:59 +00:00
Sam Ko
e9cc67df61
docs(cli): add mention of our default port behavior (#62964)
## Changes

- We need to document how that we retry until a port is found when we're
not specifying a port via the CLI (`--port`) or the `PORT` environment
variable. For example, if `3000` and `3001` are used, we will check
`3000`, `3001`, and then land on `3002`.

Closes NEXT-2731
2024-03-06 14:57:29 -08:00
Eleni Stavropoulou
41cb6c488d
[docs] Fix the TS Type from the function sitemap #62947 (#62960)
Closes https://github.com/vercel/next.js/issues/62947

This PR fixes the TS Type from the function sitemap.

Co-authored-by: JJ Kasper <jj@jjsweb.site>
2024-03-06 20:35:13 +00:00
Sam Ko
ee273c42bc
chore(next-font): update @capsize/metrics package to the latest (#62896)
## Why?

We need to be up-to-date with this package so our `next/font` is working
optimally. → https://github.com/seek-oss/capsize/releases.

Unlikely related to the latest
[comment](https://github.com/vercel/next.js/issues/47115#issuecomment-1979248754),
but a good reminder I need to check this regularly (or we should
automate it, or have a better solution).

Closes NEXT-2715
2024-03-06 12:04:20 -08:00
vercel-release-bot
e28be5377f v14.2.0-canary.5 2024-03-06 19:57:27 +00:00
JJ Kasper
67eca23ae5
Upgrade to latest @edge-runtime packages (#62955)
This upgrades to the latest edge-runtime packages as it includes
exposing `performance`. This was reverted previously as our publishes
were failing with a specific change that has since been removed
upstream.

Closes NEXT-2730
2024-03-06 11:43:48 -08:00
KaygNas
47380b1080
Add missing await keyword in code block. (#62919)
### Improving Documentation

Add missing `await` keyword in code block.

Co-authored-by: Sam Ko <sam@vercel.com>
2024-03-06 19:13:16 +00:00
JJ Kasper
83172a90db
Allow ppr only flag in test mode (#62911) 2024-03-06 18:20:20 +00:00
Ethan Arrowood
3c75ae7cf5
simplify streamToString method from node-web-streams.helper.ts (#62841)
The `encode-decode.ts` file is completely replaceable with the
[`TextDecoderStream`](https://developer.mozilla.org/en-US/docs/Web/API/TextDecoderStream)
api, but also we can simplify the `streamToString` function too.

Working on some benchmarks now - wanted to get CI running to see if this
breaks anything though.
2024-03-06 18:14:58 +00:00